1.1 --- a/scripts/build/libc_glibc.sh Thu Sep 11 09:02:00 2008 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,531 +0,0 @@
1.4 -# This file adds functions to build glibc
1.5 -# Copyright 2007 Yann E. MORIN
1.6 -# Licensed under the GPL v2. See COPYING in the root of this package
1.7 -
1.8 -do_print_filename() {
1.9 - [ "${CT_LIBC}" = "glibc" ] || return 0
1.10 - echo "glibc-${CT_LIBC_VERSION}"
1.11 - for addon in $(do_libc_add_ons_list " "); do
1.12 - # NPTL addon is not to be downloaded, in any case
1.13 - [ "${addon}" = "nptl" ] && continue || true
1.14 - echo "glibc-${addon}-${CT_LIBC_VERSION}"
1.15 - done
1.16 -}
1.17 -
1.18 -# Download glibc
1.19 -do_libc_get() {
1.20 - # Ah! Not all GNU folks seem stupid. All glibc releases are in the same
1.21 - # directory. Good. Alas, there is no snapshot there. I'll deal with them
1.22 - # later on... :-/
1.23 - CT_GetFile "${CT_LIBC_FILE}" \
1.24 - {ftp,http}://ftp.gnu.org/gnu/glibc \
1.25 - ftp://gcc.gnu.org/pub/glibc/releases \
1.26 - ftp://gcc.gnu.org/pub/glibc/snapshots
1.27 -
1.28 - # C library addons
1.29 - for addon in $(do_libc_add_ons_list " "); do
1.30 - # NPTL addon is not to be downloaded, in any case
1.31 - [ "${addon}" = "nptl" ] && continue || true
1.32 - CT_GetFile "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}" \
1.33 - {ftp,http}://ftp.gnu.org/gnu/glibc \
1.34 - ftp://gcc.gnu.org/pub/glibc/releases \
1.35 - ftp://gcc.gnu.org/pub/glibc/snapshots
1.36 - done
1.37 -
1.38 - return 0
1.39 -}
1.40 -
1.41 -# Extract glibc
1.42 -do_libc_extract() {
1.43 - CT_ExtractAndPatch "${CT_LIBC_FILE}"
1.44 -
1.45 - # C library addons
1.46 - for addon in $(do_libc_add_ons_list " "); do
1.47 - # NPTL addon is not to be extracted, in any case
1.48 - [ "${addon}" = "nptl" ] && continue || true
1.49 - CT_ExtractAndPatch "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}"
1.50 - done
1.51 -
1.52 - return 0
1.53 -}
1.54 -
1.55 -# There is nothing to do for glibc check config
1.56 -do_libc_check_config() {
1.57 - :
1.58 -}
1.59 -
1.60 -# This function installs the glibc headers needed to build the core compiler
1.61 -do_libc_headers() {
1.62 - # Only need to install bootstrap glibc headers for gcc-3.0 and above? Or maybe just gcc-3.3 and above?
1.63 - # See also http://gcc.gnu.org/PR8180, which complains about the need for this step.
1.64 - grep -q 'gcc-[34]' "${CT_SRC_DIR}/${CT_CC_FILE}/ChangeLog" 2>/dev/null || return 0
1.65 -
1.66 - CT_DoStep INFO "Installing C library headers"
1.67 -
1.68 - mkdir -p "${CT_BUILD_DIR}/build-libc-headers"
1.69 - cd "${CT_BUILD_DIR}/build-libc-headers"
1.70 -
1.71 - CT_DoLog EXTRA "Configuring C library"
1.72 -
1.73 - # The following three things have to be done to build glibc-2.3.x, but they don't hurt older versions.
1.74 - # 1. override CC to keep glibc's configure from using $TARGET-gcc.
1.75 - # 2. disable linuxthreads, which needs a real cross-compiler to generate tcb-offsets.h properly
1.76 - # 3. build with gcc 3.2 or later
1.77 - # Compare these options with the ones used when building glibc for real below - they're different.
1.78 - # As of glibc-2.3.2, to get this step to work for hppa-linux, you need --enable-hacker-mode
1.79 - # so when configure checks to make sure gcc has access to the assembler you just built...
1.80 - # Alternately, we could put ${PREFIX}/${TARGET}/bin on the path.
1.81 - # Set --build so maybe we don't have to specify "cross-compiling=yes" below (haven't tried yet)
1.82 - # Note: the warning
1.83 - # "*** WARNING: Are you sure you do not want to use the `linuxthreads'"
1.84 - # *** add-on?"
1.85 - # is ok here, since all we want are the basic headers at this point.
1.86 - # Override libc_cv_ppc_machine so glibc-cvs doesn't complain
1.87 - # 'a version of binutils that supports .machine "altivec" is needed'.
1.88 -
1.89 - addons_config="--enable-add-ons=$(do_libc_add_ons_list ,)"
1.90 - # We need to remove any threading addon when installing headers
1.91 - addons_config="${addons_config//nptl/}"
1.92 - addons_config="${addons_config//linuxthreads/}"
1.93 - addons_config=$(echo "${addons_config}" |sed -r -e 's/^,+//; s/,+$//; s/,+/,/g;')
1.94 -
1.95 - cross_cc=$(CT_Which "${CT_TARGET}-gcc")
1.96 - CT_DoLog DEBUG "Using gcc for target: '${cross_cc}'"
1.97 - CT_DoLog DEBUG "Extra config passed : '${addons_config}'"
1.98 -
1.99 - libc_cv_ppc_machine=yes \
1.100 - CC=${cross_cc} \
1.101 - CT_DoExecLog ALL \
1.102 - "${CT_SRC_DIR}/${CT_LIBC_FILE}/configure" \
1.103 - --build="${CT_UNIQ_BUILD}" \
1.104 - --host="${CT_TARGET}" \
1.105 - --prefix=/usr \
1.106 - --with-headers="${CT_HEADERS_DIR}" \
1.107 - --without-cvs \
1.108 - --disable-sanity-checks \
1.109 - --enable-hacker-mode \
1.110 - ${addons_config} \
1.111 - --without-nptl
1.112 -
1.113 - CT_DoLog EXTRA "Installing C library headers"
1.114 -
1.115 - if grep -q GLIBC_2.3 "${CT_SRC_DIR}/${CT_LIBC_FILE}/ChangeLog"; then
1.116 - # glibc-2.3.x passes cross options to $(CC) when generating errlist-compat.c,
1.117 - # which fails without a real cross-compiler.
1.118 - # Fortunately, we don't need errlist-compat.c, since we just need .h
1.119 - # files, so work around this by creating a fake errlist-compat.c and
1.120 - # satisfying its dependencies.
1.121 - # Another workaround might be to tell configure to not use any cross
1.122 - # options to $(CC).
1.123 - # The real fix would be to get install-headers to not generate
1.124 - # errlist-compat.c.
1.125 - # Note: BOOTSTRAP_GCC is used by:
1.126 - # patches/glibc-2.3.5/glibc-mips-bootstrap-gcc-header-install.patch
1.127 -
1.128 - libc_cv_ppc_machine=yes \
1.129 - CT_DoExecLog ALL \
1.130 - make CFLAGS="-O -DBOOTSTRAP_GCC" \
1.131 - OBJDUMP_FOR_HOST="${CT_TARGET}-objdump" \
1.132 - sysdeps/gnu/errlist.c
1.133 - mkdir -p stdio-common
1.134 -
1.135 - # sleep for 2 seconds for benefit of filesystems with lousy time
1.136 - # resolution, like FAT, so make knows for sure errlist-compat.c doesn't
1.137 - # need generating
1.138 - sleep 2
1.139 - CT_DoExecLog ALL touch stdio-common/errlist-compat.c
1.140 - fi
1.141 - # Note: BOOTSTRAP_GCC (see above)
1.142 - libc_cv_ppc_machine=yes \
1.143 - CT_DoExecLog ALL \
1.144 - make cross-compiling=yes \
1.145 - install_root=${CT_SYSROOT_DIR} \
1.146 - CFLAGS="-O -DBOOTSTRAP_GCC" \
1.147 - ${LIBC_SYSROOT_ARG} \
1.148 - OBJDUMP_FOR_HOST="${CT_TARGET}-objdump" \
1.149 - install-headers
1.150 -
1.151 - # Two headers -- stubs.h and features.h -- aren't installed by install-headers,
1.152 - # so do them by hand. We can tolerate an empty stubs.h for the moment.
1.153 - # See e.g. http://gcc.gnu.org/ml/gcc/2002-01/msg00900.html
1.154 - mkdir -p "${CT_HEADERS_DIR}/gnu"
1.155 - CT_DoExecLog ALL touch "${CT_HEADERS_DIR}/gnu/stubs.h"
1.156 - CT_DoExecLog ALL cp -v "${CT_SRC_DIR}/${CT_LIBC_FILE}/include/features.h" \
1.157 - "${CT_HEADERS_DIR}/features.h"
1.158 -
1.159 - # Building the bootstrap gcc requires either setting inhibit_libc, or
1.160 - # having a copy of stdio_lim.h... see
1.161 - # http://sources.redhat.com/ml/libc-alpha/2003-11/msg00045.html
1.162 - CT_DoExecLog ALL cp -v bits/stdio_lim.h "${CT_HEADERS_DIR}/bits/stdio_lim.h"
1.163 -
1.164 - # Following error building gcc-4.0.0's gcj:
1.165 - # error: bits/syscall.h: No such file or directory
1.166 - # solved by following copy; see http://sourceware.org/ml/crossgcc/2005-05/msg00168.html
1.167 - # but it breaks arm, see http://sourceware.org/ml/crossgcc/2006-01/msg00091.html
1.168 - [ "${CT_ARCH}" != "arm" ] && CT_DoExecLog ALL cp -v misc/syscall-list.h "${CT_HEADERS_DIR}/bits/syscall.h" || true
1.169 -
1.170 - # Those headers are to be manually copied so gcc can build properly
1.171 - pthread_h="${CT_SRC_DIR}/${CT_LIBC_FILE}/${CT_THREADS}/sysdeps/pthread/pthread.h"
1.172 - pthreadtypes_h=
1.173 - case "${CT_THREADS}" in
1.174 - nptl)
1.175 - # NOTE: for some archs, the pathes are different, but they are not
1.176 - # supported by crosstool-NG right now. See original crosstool when they are.
1.177 - pthread_h="${CT_SRC_DIR}/${CT_LIBC_FILE}/${CT_THREADS}/sysdeps/pthread/pthread.h"
1.178 - pthreadtypes_h="${CT_SRC_DIR}/${CT_LIBC_FILE}/nptl/sysdeps/unix/sysv/linux/${CT_KERNEL_ARCH}/bits/pthreadtypes.h"
1.179 - if [ ! -f "${pthreadtypes_h}" ]; then
1.180 - pthreadtypes_h="${CT_SRC_DIR}/${CT_LIBC_FILE}/${CT_LIBC}-ports-${CT_LIBC_VERSION}/sysdeps/unix/sysv/linux/${CT_KERNEL_ARCH}/nptl/bits/pthreadtypes.h"
1.181 - fi
1.182 - ;;
1.183 - linuxthreads)
1.184 - pthreadtypes_h="${CT_SRC_DIR}/${CT_LIBC_FILE}/linuxthreads/sysdeps/pthread/bits/pthreadtypes.h"
1.185 - ;;
1.186 - *)
1.187 - pthread_h=
1.188 - pthreadtypes_h=
1.189 - ;;
1.190 - esac
1.191 - if [ -n "${pthread_h}" ]; then
1.192 - CT_DoExecLog ALL cp -v "${pthread_h}" "${CT_HEADERS_DIR}/pthread.h"
1.193 - fi
1.194 - if [ -n "${pthreadtypes_h}" ]; then
1.195 - CT_DoExecLog ALL cp -v "${pthreadtypes_h}" "${CT_HEADERS_DIR}/bits/pthreadtypes.h"
1.196 - fi
1.197 -
1.198 - CT_EndStep
1.199 -}
1.200 -
1.201 -# Build and install start files
1.202 -do_libc_start_files() {
1.203 - # Needed only in the NPTL case. Otherwise, return.
1.204 - [ "${CT_THREADS}" = "nptl" ] || return 0
1.205 -
1.206 - CT_DoStep INFO "Installing C library start files"
1.207 -
1.208 - mkdir -p "${CT_BUILD_DIR}/build-libc-startfiles"
1.209 - cd "${CT_BUILD_DIR}/build-libc-startfiles"
1.210 -
1.211 - CT_DoLog EXTRA "Configuring C library"
1.212 -
1.213 - # Add some default glibc config options if not given by user.
1.214 - extra_config=""
1.215 - case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in
1.216 - *enable-kernel*) ;;
1.217 - *) extra_config="${extra_config} --enable-kernel=$(echo ${CT_LIBC_GLIBC_MIN_KERNEL} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')"
1.218 - esac
1.219 - case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in
1.220 - *-tls*) ;;
1.221 - *) extra_config="${extra_config} --with-tls"
1.222 - esac
1.223 - case "${CT_SHARED_LIBS}" in
1.224 - y) extra_config="${extra_config} --enable-shared";;
1.225 - *) extra_config="${extra_config} --disable-shared";;
1.226 - esac
1.227 - case "${CT_ARCH_FLOAT_HW},${CT_ARCH_FLOAT_SW}" in
1.228 - y,) extra_config="${extra_config} --with-fp";;
1.229 - ,y) extra_config="${extra_config} --without-fp";;
1.230 - esac
1.231 - # Obviously, we want threads, as we come here only for NPTL
1.232 - extra_config="${extra_config} --with-__thread"
1.233 -
1.234 - addons_config="--enable-add-ons=$(do_libc_add_ons_list ,)"
1.235 - extra_config="${extra_config} ${addons_config}"
1.236 -
1.237 - # Add some default CC args
1.238 - glibc_version_major=$(echo ${CT_LIBC_VERSION} |sed -r -e 's/^([^\.]+)\..*/\1/')
1.239 - glibc_version_minor=$(echo ${CT_LIBC_VERSION} |sed -r -e 's/^[^\.]+\.([^.]+).*/\1/')
1.240 - # In case we're using a snapshot, fake a >=2.6 version.
1.241 - if [ "${CT_LIBC_V_LATEST}" = "y" \
1.242 - -o "${CT_LIBC_V_date}" = "y" ]; then
1.243 - glibc_version_major=3
1.244 - glibc_version_minor=0
1.245 - fi
1.246 - if [ ${glibc_version_major} -eq 2 -a ${glibc_version_minor} -ge 6 \
1.247 - -o ${glibc_version_major} -gt 2 ]; then
1.248 - # Don't use -pipe: configure chokes on it for glibc >= 2.6.
1.249 - CT_Test 'Removing "-pipe" for use with glibc>=2.6' "${CT_USE_PIPES}" = "y"
1.250 - extra_cc_args="${CT_CFLAGS_FOR_HOST/-pipe}"
1.251 - else
1.252 - extra_cc_args="${CT_CFLAGS_FOR_HOST}"
1.253 - fi
1.254 - extra_cc_args="${extra_cc_args} ${CT_ARCH_ENDIAN_OPT}"
1.255 -
1.256 - cross_cc=$(CT_Which "${CT_TARGET}-gcc")
1.257 - CT_DoLog DEBUG "Using gcc for target : '${cross_cc}'"
1.258 - CT_DoLog DEBUG "Configuring with addons : '$(do_libc_add_ons_list ,)'"
1.259 - CT_DoLog DEBUG "Extra config args passed: '${extra_config}'"
1.260 - CT_DoLog DEBUG "Extra CC args passed : '${extra_cc_args}'"
1.261 -
1.262 - # Super-H really needs to set configparms as of gcc-3.4/glibc-2.3.2
1.263 - # note: this is awkward, doesn't work well if you need more than one
1.264 - # line in configparms
1.265 - echo ${CT_LIBC_GLIBC_CONFIGPARMS} > configparms
1.266 -
1.267 - echo "libc_cv_forced_unwind=yes" > config.cache
1.268 - echo "libc_cv_c_cleanup=yes" >> config.cache
1.269 -
1.270 - # Please see the comment for the configure step in do_libc().
1.271 -
1.272 - BUILD_CC=${CT_CC_NATIVE} \
1.273 - CFLAGS="${CT_TARGET_CFLAGS} ${CT_LIBC_GLIBC_EXTRA_CFLAGS} -O " \
1.274 - CC="${cross_cc} ${CT_LIBC_EXTRA_CC_ARGS} ${extra_cc_args}" \
1.275 - AR=${CT_TARGET}-ar \
1.276 - RANLIB=${CT_TARGET}-ranlib \
1.277 - CT_DoExecLog ALL \
1.278 - "${CT_SRC_DIR}/${CT_LIBC_FILE}/configure" \
1.279 - --prefix=/usr \
1.280 - --build="${CT_UNIQ_BUILD}" \
1.281 - --host=${CT_TARGET} \
1.282 - --without-cvs \
1.283 - --disable-profile \
1.284 - --disable-debug \
1.285 - --without-gd \
1.286 - --with-headers="${CT_HEADERS_DIR}" \
1.287 - --cache-file=config.cache \
1.288 - ${extra_config} \
1.289 - ${CT_LIBC_GLIBC_EXTRA_CONFIG}
1.290 -
1.291 -
1.292 - #TODO: should check whether slibdir has been set in configparms to */lib64
1.293 - # and copy the startfiles into the appropriate libdir.
1.294 - CT_DoLog EXTRA "Building C library start files"
1.295 - CT_DoExecLog ALL make OBJDUMP_FOR_HOST="${CT_TARGET}-objdump" csu/subdir_lib
1.296 -
1.297 - CT_DoLog EXTRA "Installing C library start files"
1.298 - if [ "${CT_USE_SYSROOT}" = "y" ]; then
1.299 - CT_DoExecLog ALL cp -fpv csu/crt[1in].o "${CT_SYSROOT_DIR}/usr/lib/"
1.300 - else
1.301 - CT_DoExecLog ALL cp -fpv csu/crt[1in].o "${CT_SYSROOT_DIR}/lib/"
1.302 - fi
1.303 -
1.304 - CT_EndStep
1.305 -}
1.306 -
1.307 -# This function builds and install the full glibc
1.308 -do_libc() {
1.309 - CT_DoStep INFO "Installing C library"
1.310 -
1.311 - mkdir -p "${CT_BUILD_DIR}/build-libc"
1.312 - cd "${CT_BUILD_DIR}/build-libc"
1.313 -
1.314 - CT_DoLog EXTRA "Configuring C library"
1.315 -
1.316 - # Add some default glibc config options if not given by user.
1.317 - # We don't need to be conditional on wether the user did set different
1.318 - # values, as they CT_LIBC_GLIBC_EXTRA_CONFIG is passed after extra_config
1.319 -
1.320 - extra_config="--enable-kernel=$(echo ${CT_LIBC_GLIBC_MIN_KERNEL} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')"
1.321 -
1.322 - case "${CT_THREADS}" in
1.323 - nptl) extra_config="${extra_config} --with-__thread --with-tls";;
1.324 - linuxthreads) extra_config="${extra_config} --with-__thread --without-tls --without-nptl";;
1.325 - none) extra_config="${extra_config} --without-__thread --without-nptl"
1.326 - case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in
1.327 - *-tls*) ;;
1.328 - *) extra_config="${extra_config} --without-tls";;
1.329 - esac
1.330 - ;;
1.331 - esac
1.332 -
1.333 - case "${CT_SHARED_LIBS}" in
1.334 - y) extra_config="${extra_config} --enable-shared";;
1.335 - *) extra_config="${extra_config} --disable-shared";;
1.336 - esac
1.337 -
1.338 - case "${CT_ARCH_FLOAT_HW},${CT_ARCH_FLOAT_SW}" in
1.339 - y,) extra_config="${extra_config} --with-fp";;
1.340 - ,y) extra_config="${extra_config} --without-fp";;
1.341 - esac
1.342 -
1.343 - case "$(do_libc_add_ons_list ,)" in
1.344 - "") ;;
1.345 - *) extra_config="${extra_config} --enable-add-ons=$(do_libc_add_ons_list ,)";;
1.346 - esac
1.347 -
1.348 - # Add some default CC args
1.349 - glibc_version_major=$(echo ${CT_LIBC_VERSION} |sed -r -e 's/^([^\.]+)\..*/\1/')
1.350 - glibc_version_minor=$(echo ${CT_LIBC_VERSION} |sed -r -e 's/^[^\.]+\.([^.]+).*/\1/')
1.351 - # In case we're using a snapshot, fake a >=2.6 version.
1.352 - if [ "${CT_LIBC_V_LATEST}" = "y" \
1.353 - -o "${CT_LIBC_V_date}" = "y" ]; then
1.354 - glibc_version_major=3
1.355 - glibc_version_minor=0
1.356 - fi
1.357 - if [ ${glibc_version_major} -eq 2 -a ${glibc_version_minor} -ge 6 \
1.358 - -o ${glibc_version_major} -gt 2 ]; then
1.359 - # Don't use -pipe: configure chokes on it for glibc >= 2.6.
1.360 - CT_Test 'Removing "-pipe" for use with glibc>=2.6' "${CT_USE_PIPES}" = "y"
1.361 - extra_cc_args="${CT_CFLAGS_FOR_HOST/-pipe}"
1.362 - else
1.363 - extra_cc_args="${CT_CFLAGS_FOR_HOST}"
1.364 - fi
1.365 - extra_cc_args="${extra_cc_args} ${CT_ARCH_ENDIAN_OPT}"
1.366 -
1.367 - cross_cc=$(CT_Which "${CT_TARGET}-gcc")
1.368 - CT_DoLog DEBUG "Using gcc for target : '${cross_cc}'"
1.369 - CT_DoLog DEBUG "Configuring with addons : '$(do_libc_add_ons_list ,)'"
1.370 - CT_DoLog DEBUG "Extra config args passed: '${extra_config}'"
1.371 - CT_DoLog DEBUG "Extra CC args passed : '${extra_cc_args}'"
1.372 -
1.373 - # sh3 and sh4 really need to set configparms as of gcc-3.4/glibc-2.3.2
1.374 - # note: this is awkward, doesn't work well if you need more than one line in configparms
1.375 - echo ${CT_LIBC_GLIBC_CONFIGPARMS} > configparms
1.376 -
1.377 - # For glibc 2.3.4 and later we need to set some autoconf cache
1.378 - # variables, because nptl/sysdeps/pthread/configure.in does not
1.379 - # work when cross-compiling.
1.380 - if [ "${CT_THREADS}" = "nptl" ]; then
1.381 - echo libc_cv_forced_unwind=yes
1.382 - echo libc_cv_c_cleanup=yes
1.383 - fi >config.cache
1.384 -
1.385 - # Configure with --prefix the way we want it on the target...
1.386 - # There are a whole lot of settings here. You'll probably want
1.387 - # to read up on what they all mean, and customize a bit, possibly by setting GLIBC_EXTRA_CONFIG
1.388 - # Compare these options with the ones used when installing the glibc headers above - they're different.
1.389 - # Adding "--without-gd" option to avoid error "memusagestat.c:36:16: gd.h: No such file or directory"
1.390 - # See also http://sources.redhat.com/ml/libc-alpha/2000-07/msg00024.html.
1.391 - # Set BUILD_CC, or you won't be able to build datafiles
1.392 - # Set --build, else glibc-2.3.2 will think you're not cross-compiling, and try to run the test programs
1.393 -
1.394 - # OK. I'm fed up with those folks telling me what I should do.
1.395 - # I don't configure nptl? Well, maybe that's purposedly because
1.396 - # I don't want nptl! --disable-sanity-checks will shut up those
1.397 - # silly messages. GNU folks again, he?
1.398 -
1.399 - BUILD_CC=${CT_CC_NATIVE} \
1.400 - CFLAGS="${CT_TARGET_CFLAGS} ${CT_LIBC_GLIBC_EXTRA_CFLAGS} -O" \
1.401 - CC="${CT_TARGET}-gcc ${CT_LIBC_EXTRA_CC_ARGS} ${extra_cc_args}" \
1.402 - AR=${CT_TARGET}-ar \
1.403 - RANLIB=${CT_TARGET}-ranlib \
1.404 - CT_DoExecLog ALL \
1.405 - "${CT_SRC_DIR}/${CT_LIBC_FILE}/configure" \
1.406 - --prefix=/usr \
1.407 - --build=${CT_UNIQ_BUILD} \
1.408 - --host=${CT_TARGET} \
1.409 - --without-cvs \
1.410 - --disable-profile \
1.411 - --disable-debug \
1.412 - --without-gd \
1.413 - --disable-sanity-checks \
1.414 - --cache-file=config.cache \
1.415 - --with-headers="${CT_HEADERS_DIR}" \
1.416 - ${extra_config} \
1.417 - ${CT_LIBC_GLIBC_EXTRA_CONFIG}
1.418 -
1.419 - if grep -l '^install-lib-all:' "${CT_SRC_DIR}/${CT_LIBC_FILE}/Makerules" > /dev/null; then
1.420 - # nptl-era glibc.
1.421 - # If the install-lib-all target (which is added by our make-install-lib-all.patch)
1.422 - # is present, it means we're building glibc-2.3.3 or later, and we can't
1.423 - # build programs yet, as they require libeh, which won't be installed
1.424 - # until full build of gcc
1.425 - # YEM-FIXME: This comment is misleading: latest glibc-s do not have the
1.426 - # make-install-lib-all.patch applied, so do not pass through this
1.427 - # part of the if statement; nonetheless, they do build, and
1.428 - # the result is useable (maybe the dual-pass core gcc is
1.429 - # responsible for this).
1.430 - GLIBC_INITIAL_BUILD_RULE=lib
1.431 - GLIBC_INITIAL_INSTALL_RULE="install-lib-all install-headers"
1.432 - GLIBC_INSTALL_APPS_LATER=yes
1.433 - else
1.434 - # classic glibc.
1.435 - # We can build and install everything with the bootstrap compiler.
1.436 - # YEM-FIXME: See the above FIXME as well.
1.437 - GLIBC_INITIAL_BUILD_RULE=all
1.438 - GLIBC_INITIAL_INSTALL_RULE=install
1.439 - GLIBC_INSTALL_APPS_LATER=no
1.440 - fi
1.441 -
1.442 - # If this fails with an error like this:
1.443 - # ... linux/autoconf.h: No such file or directory
1.444 - # then you need to set the KERNELCONFIG variable to point to a .config file for this arch.
1.445 - # The following architectures are known to need kernel .config: alpha, arm, ia64, s390, sh, sparc
1.446 - # Note: LD and RANLIB needed by glibc-2.1.3's c_stub directory, at least on macosx
1.447 - # No need for PARALLELMFLAGS here, Makefile already reads this environment variable
1.448 - CT_DoLog EXTRA "Building C library"
1.449 - CT_DoExecLog ALL make LD=${CT_TARGET}-ld \
1.450 - RANLIB=${CT_TARGET}-ranlib \
1.451 - OBJDUMP_FOR_HOST="${CT_TARGET}-objdump" \
1.452 - ${GLIBC_INITIAL_BUILD_RULE}
1.453 -
1.454 - CT_DoLog EXTRA "Installing C library"
1.455 - CT_DoExecLog ALL make install_root="${CT_SYSROOT_DIR}" \
1.456 - ${LIBC_SYSROOT_ARG} \
1.457 - OBJDUMP_FOR_HOST="${CT_TARGET}-objdump" \
1.458 - ${GLIBC_INITIAL_INSTALL_RULE}
1.459 -
1.460 - # This doesn't seem to work when building a crosscompiler,
1.461 - # as it tries to execute localedef using the just-built ld.so!?
1.462 - #CT_DoLog EXTRA "Installing locales"
1.463 - #make localedata/install-locales install_root=${SYSROOT} 2>&1 |CT_DoLog ALL
1.464 -
1.465 - # Fix problems in linker scripts.
1.466 - #
1.467 - # 1. Remove absolute paths
1.468 - # Any file in a list of known suspects that isn't a symlink is assumed to be a linker script.
1.469 - # FIXME: test -h is not portable
1.470 - # FIXME: probably need to check more files than just these three...
1.471 - # Need to use sed instead of just assuming we know what's in libc.so because otherwise alpha breaks
1.472 - #
1.473 - # 2. Remove lines containing BUG per http://sources.redhat.com/ml/bug-glibc/2003-05/msg00055.html,
1.474 - # needed to fix gcc-3.2.3/glibc-2.3.2 targeting arm
1.475 - #
1.476 - # To make "strip *.so.*" not fail (ptxdist does this), rename to .so_orig rather than .so.orig
1.477 - CT_DoLog EXTRA "Fixing C library linker scripts"
1.478 - for file in libc.so libpthread.so libgcc_s.so; do
1.479 - for dir in lib lib64 usr/lib usr/lib64; do
1.480 - if [ -f "${CT_SYSROOT_DIR}/${dir}/${file}" -a ! -L ${CT_SYSROOT_DIR}/$lib/$file ]; then
1.481 - CT_DoExecLog ALL cp -v "${CT_SYSROOT_DIR}/${dir}/${file}" "${CT_SYSROOT_DIR}/${dir}/${file}_orig"
1.482 - CT_DoLog DEBUG "Fixing '${CT_SYS_ROOT_DIR}/${dir}/${file}'"
1.483 - CT_DoExecLog ALL sed -i -r -e 's,/usr/lib/,,g;
1.484 - s,/usr/lib64/,,g;
1.485 - s,/lib/,,g;
1.486 - s,/lib64/,,g;
1.487 - /BUG in libc.scripts.output-format.sed/d' "${CT_SYSROOT_DIR}/${dir}/${file}"
1.488 - fi
1.489 - done
1.490 - done
1.491 -
1.492 - CT_EndStep
1.493 -}
1.494 -
1.495 -# This function finishes the glibc install
1.496 -do_libc_finish() {
1.497 - # Finally, build and install glibc programs, now that libeh (if any) is installed
1.498 - # Don't do this unless needed, 'cause it causes glibc-2.{1.3,2.2} to fail here with
1.499 - # .../gcc-3.4.1-glibc-2.1.3/build-glibc/libc.so.6: undefined reference to `__deregister_frame_info'
1.500 - # .../gcc-3.4.1-glibc-2.1.3/build-glibc/libc.so.6: undefined reference to `__register_frame_info'
1.501 - [ "${GLIBC_INSTALL_APPS_LATER}" = "yes" ] || return 0
1.502 -
1.503 - CT_DoStep INFO "Finishing C library"
1.504 -
1.505 - cd "${CT_BUILD_DIR}/build-libc"
1.506 -
1.507 - CT_DoLog EXTRA "Re-building C library"
1.508 - CT_DoExecLog ALL make LD=${CT_TARGET}-ld RANLIB=${CT_TARGET}-ranlib
1.509 -
1.510 - CT_DoLog EXTRA "Installing missing C library components"
1.511 - # note: should do full install and then fix linker scripts, but this is faster
1.512 - for t in bin rootsbin sbin data others; do
1.513 - CT_DoExecLog ALL make install_root="${CT_SYSROOT_DIR}" \
1.514 - ${LIBC_SYSROOT_ARG} \
1.515 - OBJDUMP_FOR_HOST="${CT_TARGET}-objdump" \
1.516 - install-${t}
1.517 - done
1.518 -
1.519 - CT_EndStep
1.520 -}
1.521 -
1.522 -# Build up the addons list, separated with $1
1.523 -do_libc_add_ons_list() {
1.524 - local sep="$1"
1.525 - local addons_list=$(echo "${CT_LIBC_ADDONS_LIST//,/${sep}}" |tr -s ,)
1.526 - case "${CT_THREADS}" in
1.527 - none) ;;
1.528 - *) addons_list="${addons_list}${sep}${CT_THREADS}";;
1.529 - esac
1.530 - [ "${CT_LIBC_GLIBC_USE_PORTS}" = "y" ] && addons_list="${addons_list}${sep}ports"
1.531 - addons_list="${addons_list%%${sep}}"
1.532 - echo "${addons_list##${sep}}"
1.533 -}
1.534 -