Update this w86_64 sample.
/trunk/samples/x86_64-unknown-linux-uclibc/crosstool.config | 155 84 71 0 ++++++++++---------
/trunk/samples/x86_64-unknown-linux-uclibc/reported.by | 3 3 0 0 +
2 files changed, 87 insertions(+), 71 deletions(-)
1 # eglibc build functions (initially by Thomas JOURDAN).
4 [ "${CT_LIBC}" = "eglibc" ] || return 0
5 echo "eglibc-${CT_LIBC_VERSION}"
6 for addon in $(do_libc_add_ons_list " "); do
7 # NPTL addon is not to be downloaded, in any case
8 [ "${addon}" = "nptl" ] && continue || true
9 echo "eglibc-${addon}-${CT_LIBC_VERSION}"
13 # Download eglibc repository
17 case "${CT_LIBC_VERSION}" in
18 trunk) svn_url="svn://svn.eglibc.org/trunk";;
19 *) svn_url="svn://svn.eglibc.org/branches/eglibc-${CT_LIBC_VERSION}";;
22 case "${CT_EGLIBC_CHECKOUT}" in
23 y) svn_action="checkout";;
24 *) svn_action="export --force";;
27 CT_DoSetProxy ${CT_PROXY_TYPE}
28 CT_DoExecLog ALL svn ${svn_action} -r "${CT_EGLIBC_REVISION:-HEAD}" "${svn_url}" . 2>&1
31 CT_DoExecLog ALL mv libc "${CT_LIBC_FILE}"
32 CT_DoExecLog ALL tar cjf "${CT_LIBC_FILE}.tar.bz2" "${CT_LIBC_FILE}"
34 # Compress linuxthreads, localedef and ports
35 # Assign them the name the way ct-ng like it
36 for addon in linuxthreads localedef ports; do
37 CT_DoExecLog ALL tar cjf "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}.tar.bz2" "${addon}"
43 # eglibc is only available through subversion, there are no
44 # snapshots available. Moreover, addons will be downloaded
48 eglibc="${CT_LIBC_FILE}.tar.bz2"
49 eglibc_linuxthreads="${CT_LIBC}-linuxthreads-${CT_LIBC_VERSION}.tar.bz2"
50 eglibc_localedef="${CT_LIBC}-localedef-${CT_LIBC_VERSION}.tar.bz2"
51 eglibc_ports="${CT_LIBC}-ports-${CT_LIBC_VERSION}.tar.bz2"
53 # Check if every tarballs are already present
54 if [ -a "${CT_TARBALLS_DIR}/${eglibc}" ] && \
55 [ -a "${CT_TARBALLS_DIR}/${eglibc_linuxthreads}" ] && \
56 [ -a "${CT_TARBALLS_DIR}/${eglibc_localedef}" ] && \
57 [ -a "${CT_TARBALLS_DIR}/${eglibc_ports}" ]; then
58 CT_DoLog DEBUG "Already have 'eglibc-${CT_LIBC_VERSION}'"
62 if [ -a "${CT_LOCAL_TARBALLS_DIR}/${eglibc}" ] && \
63 [ -a "${CT_LOCAL_TARBALLS_DIR}/${eglibc_linuxthreads}" ] && \
64 [ -a "${CT_LOCAL_TARBALLS_DIR}/${eglibc_localedef}" ] && \
65 [ -a "${CT_LOCAL_TARBALLS_DIR}/${eglibc_ports}" ] && \
66 [ "${CT_FORCE_DOWNLOAD}" != "y" ]; then
67 CT_DoLog DEBUG "Got 'eglibc-${CT_LIBC_VERSION}' from local storage"
68 for file in ${eglibc} ${eglibc_linuxthreads} ${eglibc_localedef} ${eglibc_ports}; do
69 CT_DoExecLog ALL ln -s "${CT_LOCAL_TARBALLS_DIR}/${file}" "${CT_TARBALLS_DIR}/${file}"
74 # Not found locally, try from the network
75 CT_DoLog EXTRA "Retrieving 'eglibc-${CT_LIBC_VERSION}'"
81 CT_DoLog DEBUG "Moving 'eglibc-${CT_LIBC_VERSION}' to tarball directory"
82 for file in ${eglibc} ${eglibc_linuxthreads} ${eglibc_localedef} ${eglibc_ports}; do
83 CT_DoExecLog ALL mv -f "${file}" "${CT_TARBALLS_DIR}"
89 CT_DoExecLog ALL rm -rf "${tmp_dir}"
91 if [ "${CT_SAVE_TARBALLS}" = "y" ]; then
92 CT_DoLog EXTRA "Saving 'eglibc-${CT_LIBC_VERSION}' to local storage"
93 for file in ${eglibc} ${eglibc_linuxthreads} ${eglibc_localedef} ${eglibc_ports}; do
94 CT_DoExecLog ALL mv -f "${CT_TARBALLS_DIR}/${file}" "${CT_LOCAL_TARBALLS_DIR}"
95 CT_DoExecLog ALL ln -s "${CT_LOCAL_TARBALLS_DIR}/${file}" "${CT_TARBALLS_DIR}/${file}"
104 CT_ExtractAndPatch "${CT_LIBC_FILE}"
107 for addon in $(do_libc_add_ons_list " "); do
108 # NPTL addon is not to be extracted, in any case
109 [ "${addon}" = "nptl" ] && continue || true
110 CT_ExtractAndPatch "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}"
113 # The configure files may be older than the configure.in files
114 # if using a snapshot (or even some tarballs). Fake them being
116 find "${CT_SRC_DIR}/${CT_LIBC_FILE}" -type f -name configure -exec touch {} \; 2>&1 |CT_DoLog ALL
121 # There is nothing to do for eglibc check config
122 do_libc_check_config() {
126 # This function installs the eglibc headers needed to build the core compiler
128 # Instead of doing two time the same actions, headers will
129 # be installed with start files
133 # Build and install start files
134 do_libc_start_files() {
135 CT_DoStep INFO "Installing C library headers / start files"
137 mkdir -p "${CT_BUILD_DIR}/build-libc-startfiles"
138 cd "${CT_BUILD_DIR}/build-libc-startfiles"
140 CT_DoLog EXTRA "Configuring C library"
142 cross_cc=$(CT_Which "${CT_TARGET}-gcc")
143 cross_cxx=$(CT_Which "${CT_TARGET}-g++")
144 cross_ar=$(CT_Which "${CT_TARGET}-ar")
145 cross_ranlib=$(CT_Which "${CT_TARGET}-ranlib")
147 CT_DoLog DEBUG "Using gcc for target: '${cross_cc}'"
148 CT_DoLog DEBUG "Using g++ for target: '${cross_cxx}'"
149 CT_DoLog DEBUG "Using ar for target: '${cross_ar}'"
150 CT_DoLog DEBUG "Using ranlib for target: '${cross_ranlib}'"
152 BUILD_CC=${CT_CC_NATIVE} \
156 RANLIB=${cross_ranlib} \
158 "${CT_SRC_DIR}/${CT_LIBC_FILE}/configure" \
160 --with-headers="${CT_HEADERS_DIR}" \
161 --build="${CT_UNIQ_BUILD}" \
162 --host="${CT_TARGET}" \
168 CT_DoLog EXTRA "Installing C library headers"
170 # use the 'install-headers' makefile target to install the
174 make install-headers \
175 install_root=${CT_SYSROOT_DIR} \
176 install-bootstrap-headers=yes
178 CT_DoLog EXTRA "Installing C library start files"
180 # there are a few object files needed to link shared libraries,
181 # which we build and install by hand
183 CT_DoExecLog ALL mkdir -p ${CT_SYSROOT_DIR}/usr/lib
184 CT_DoExecLog ALL make csu/subdir_lib
185 CT_DoExecLog ALL cp csu/crt1.o csu/crti.o csu/crtn.o \
186 ${CT_SYSROOT_DIR}/usr/lib
188 # Finally, 'libgcc_s.so' requires a 'libc.so' to link against.
189 # However, since we will never actually execute its code,
190 # it doesn't matter what it contains. So, treating '/dev/null'
191 # as a C source file, we produce a dummy 'libc.so' in one step
193 CT_DoExecLog ALL ${cross_cc} -nostdlib -nostartfiles -shared -x c /dev/null -o ${CT_SYSROOT_DIR}/usr/lib/libc.so
198 # This function builds and install the full glibc
200 CT_DoStep INFO "Installing C library"
202 mkdir -p "${CT_BUILD_DIR}/build-libc"
203 cd "${CT_BUILD_DIR}/build-libc"
205 CT_DoLog EXTRA "Configuring C library"
207 # Add some default glibc config options if not given by user.
208 # We don't need to be conditional on wether the user did set different
209 # values, as they CT_LIBC_GLIBC_EXTRA_CONFIG is passed after extra_config
211 extra_config="--enable-kernel=$(echo ${CT_LIBC_GLIBC_MIN_KERNEL} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')"
213 case "${CT_THREADS}" in
214 nptl) extra_config="${extra_config} --with-__thread --with-tls";;
215 linuxthreads) extra_config="${extra_config} --with-__thread --without-tls --without-nptl";;
216 none) extra_config="${extra_config} --without-__thread --without-nptl"
217 case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in
219 *) extra_config="${extra_config} --without-tls";;
224 case "${CT_SHARED_LIBS}" in
225 y) extra_config="${extra_config} --enable-shared";;
226 *) extra_config="${extra_config} --disable-shared";;
229 case "${CT_ARCH_FLOAT_HW},${CT_ARCH_FLOAT_SW}" in
230 y,) extra_config="${extra_config} --with-fp";;
231 ,y) extra_config="${extra_config} --without-fp";;
234 case "$(do_libc_add_ons_list ,)" in
236 *) extra_config="${extra_config} --enable-add-ons=$(do_libc_add_ons_list ,)";;
239 extra_cc_args="${extra_cc_args} ${CT_ARCH_ENDIAN_OPT}"
241 cross_cc=$(CT_Which "${CT_TARGET}-gcc")
243 CT_DoLog DEBUG "Using gcc for target: '${cross_cc}'"
244 CT_DoLog DEBUG "Configuring with addons : '$(do_libc_add_ons_list ,)'"
245 CT_DoLog DEBUG "Extra config args passed: '${extra_config}'"
246 CT_DoLog DEBUG "Extra CC args passed : '${extra_cc_args}'"
248 BUILD_CC=${CT_CC_NATIVE} \
249 CFLAGS="${CT_TARGET_CFLAGS} ${CT_LIBC_GLIBC_EXTRA_CFLAGS} -O" \
250 CC="${CT_TARGET}-gcc ${CT_LIBC_EXTRA_CC_ARGS} ${extra_cc_args}" \
252 RANLIB=${CT_TARGET}-ranlib \
254 "${CT_SRC_DIR}/${CT_LIBC_FILE}/configure" \
256 --with-headers="${CT_HEADERS_DIR}" \
257 --build=${CT_UNIQ_BUILD} \
258 --host=${CT_TARGET} \
263 ${CT_LIBC_GLIBC_EXTRA_CONFIG}
265 CT_DoLog EXTRA "Building C library"
267 CT_DoExecLog ALL make
269 CT_DoLog EXTRA "Installing C library"
271 CT_DoExecLog ALL make install install_root="${CT_SYSROOT_DIR}"
276 # This function finishes the glibc install
278 # Nothing to be done for eglibc
282 # Build up the addons list, separated with $1
283 do_libc_add_ons_list() {
285 local addons_list=$(echo "${CT_LIBC_ADDONS_LIST//,/${sep}}" |tr -s ,)
286 case "${CT_THREADS}" in
288 *) addons_list="${addons_list}${sep}${CT_THREADS}";;
290 [ "${CT_LIBC_GLIBC_USE_PORTS}" = "y" ] && addons_list="${addons_list}${sep}ports"
291 addons_list="${addons_list%%${sep}}"
292 echo "${addons_list##${sep}}"