1.1 --- a/scripts/build/libc/glibc.sh Sat Jan 22 22:35:43 2011 +0100
1.2 +++ b/scripts/build/libc/glibc.sh Sat Jan 22 22:35:58 2011 +0100
1.3 @@ -77,187 +77,3 @@
1.4 do_libc_check_config() {
1.5 :
1.6 }
1.7 -
1.8 -# This function builds and install the full glibc
1.9 -do_libc() {
1.10 - local -a extra_config
1.11 -
1.12 - CT_DoStep INFO "Installing C library"
1.13 -
1.14 - mkdir -p "${CT_BUILD_DIR}/build-libc"
1.15 - cd "${CT_BUILD_DIR}/build-libc"
1.16 -
1.17 - CT_DoLog EXTRA "Configuring C library"
1.18 -
1.19 - # Add some default glibc config options if not given by user.
1.20 - # We don't need to be conditional on wether the user did set different
1.21 - # values, as they CT_LIBC_GLIBC_EXTRA_CONFIG is passed after extra_config
1.22 -
1.23 - case "${CT_THREADS}" in
1.24 - nptl) extra_config+=("--with-__thread" "--with-tls");;
1.25 - linuxthreads) extra_config+=("--with-__thread" "--without-tls" "--without-nptl");;
1.26 - none) extra_config+=("--without-__thread" "--without-nptl")
1.27 - case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in
1.28 - *-tls*) ;;
1.29 - *) extra_config+=("--without-tls");;
1.30 - esac
1.31 - ;;
1.32 - esac
1.33 -
1.34 - case "${CT_SHARED_LIBS}" in
1.35 - y) extra_config+=("--enable-shared");;
1.36 - *) extra_config+=("--disable-shared");;
1.37 - esac
1.38 -
1.39 - case "${CT_ARCH_FLOAT_HW},${CT_ARCH_FLOAT_SW}" in
1.40 - y,) extra_config+=("--with-fp");;
1.41 - ,y) extra_config+=("--without-fp");;
1.42 - esac
1.43 -
1.44 - if [ "${CT_LIBC_DISABLE_VERSIONING}" = "y" ]; then
1.45 - extra_config+=("--disable-versioning")
1.46 - fi
1.47 -
1.48 - if [ "${CT_LIBC_OLDEST_ABI}" != "" ]; then
1.49 - extra_config+=("--enable-oldest-abi=${CT_LIBC_OLDEST_ABI}")
1.50 - fi
1.51 -
1.52 - case "$(do_libc_add_ons_list ,)" in
1.53 - "") ;;
1.54 - *) extra_config+=("--enable-add-ons=$(do_libc_add_ons_list ,)");;
1.55 - esac
1.56 -
1.57 - extra_config+=("$(do_libc_min_kernel_config)")
1.58 -
1.59 - # Add some default CC args
1.60 - glibc_version="$( grep -E '\<VERSION\>' "${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/version.h" \
1.61 - |cut -d '"' -f 2
1.62 - )"
1.63 - glibc_version_major=$(echo ${glibc_version} |sed -r -e 's/^([[:digit:]]+).*/\1/')
1.64 - glibc_version_minor=$(echo ${glibc_version} |sed -r -e 's/^[[:digit:]]+[\.-_]([[:digit:]]+).*/\1/')
1.65 - if [ ${glibc_version_major} -eq 2 -a ${glibc_version_minor} -ge 6 \
1.66 - -o ${glibc_version_major} -gt 2 ]; then
1.67 - # Don't use -pipe: configure chokes on it for glibc >= 2.6.
1.68 - CT_Test 'Removing "-pipe" for use with glibc>=2.6' "${CT_USE_PIPES}" = "y"
1.69 - extra_cc_args="${CT_CFLAGS_FOR_HOST/-pipe}"
1.70 - else
1.71 - extra_cc_args="${CT_CFLAGS_FOR_HOST}"
1.72 - fi
1.73 - extra_cc_args="${extra_cc_args} ${CT_ARCH_ENDIAN_OPT}"
1.74 -
1.75 - cross_cc=$(CT_Which "${CT_TARGET}-gcc")
1.76 - CT_DoLog DEBUG "Using gcc for target : '${cross_cc}'"
1.77 - CT_DoLog DEBUG "Configuring with addons : '$(do_libc_add_ons_list ,)'"
1.78 - CT_DoLog DEBUG "Extra config args passed: '${extra_config}'"
1.79 - CT_DoLog DEBUG "Extra CC args passed : '${extra_cc_args}'"
1.80 -
1.81 - # Pre-seed the configparms file with values from the config option
1.82 - printf "${CT_LIBC_GLIBC_CONFIGPARMS}\n" > configparms
1.83 -
1.84 - # For glibc 2.3.4 and later we need to set some autoconf cache
1.85 - # variables, because nptl/sysdeps/pthread/configure.in does not
1.86 - # work when cross-compiling.
1.87 - if [ "${CT_THREADS}" = "nptl" ]; then
1.88 - echo libc_cv_forced_unwind=yes
1.89 - echo libc_cv_c_cleanup=yes
1.90 - fi >config.cache
1.91 -
1.92 - # ./configure is mislead by our tools override wrapper for bash
1.93 - # so just tell it where the real bash is _on_the_target_!
1.94 - # Notes:
1.95 - # - ${ac_cv_path_BASH_SHELL} is only used to set BASH_SHELL
1.96 - # - ${BASH_SHELL} is only used to set BASH
1.97 - # - ${BASH} is only used to set the shebang
1.98 - # in two scripts to run on the target
1.99 - # So we can safely bypass bash detection at compile time.
1.100 - # Should this change in a future glibc release, we'd better
1.101 - # directly mangle the generated scripts _after_ they get built,
1.102 - # or even after they get installed... glibc is such a sucker...
1.103 - echo "ac_cv_path_BASH_SHELL=/bin/bash" >>config.cache
1.104 -
1.105 - # Configure with --prefix the way we want it on the target...
1.106 - # There are a whole lot of settings here. You'll probably want
1.107 - # to read up on what they all mean, and customize a bit, possibly by setting GLIBC_EXTRA_CONFIG
1.108 - # Compare these options with the ones used when installing the glibc headers above - they're different.
1.109 - # Adding "--without-gd" option to avoid error "memusagestat.c:36:16: gd.h: No such file or directory"
1.110 - # See also http://sources.redhat.com/ml/libc-alpha/2000-07/msg00024.html.
1.111 - # Set BUILD_CC, or you won't be able to build datafiles
1.112 - # Set --build, else glibc-2.3.2 will think you're not cross-compiling, and try to run the test programs
1.113 -
1.114 - # OK. I'm fed up with those folks telling me what I should do.
1.115 - # I don't configure nptl? Well, maybe that's purposedly because
1.116 - # I don't want nptl! --disable-sanity-checks will shut up those
1.117 - # silly messages. GNU folks again, he?
1.118 -
1.119 - BUILD_CC="${CT_BUILD}-gcc" \
1.120 - CFLAGS="${CT_TARGET_CFLAGS} ${CT_LIBC_GLIBC_EXTRA_CFLAGS} -O2" \
1.121 - CC="${CT_TARGET}-gcc ${CT_LIBC_EXTRA_CC_ARGS} ${extra_cc_args}" \
1.122 - AR=${CT_TARGET}-ar \
1.123 - RANLIB=${CT_TARGET}-ranlib \
1.124 - CT_DoExecLog CFG \
1.125 - "${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/configure" \
1.126 - --prefix=/usr \
1.127 - --build=${CT_BUILD} \
1.128 - --host=${CT_TARGET} \
1.129 - --without-cvs \
1.130 - --disable-profile \
1.131 - --disable-debug \
1.132 - --without-gd \
1.133 - --disable-sanity-checks \
1.134 - --cache-file=config.cache \
1.135 - --with-headers="${CT_HEADERS_DIR}" \
1.136 - "${extra_config[@]}" \
1.137 - ${CT_LIBC_GLIBC_EXTRA_CONFIG}
1.138 -
1.139 - # glibc initial build hacks
1.140 - # http://sourceware.org/ml/crossgcc/2008-10/msg00068.html
1.141 - case "${CT_ARCH},${CT_ARCH_CPU}" in
1.142 - powerpc,8??)
1.143 - CT_DoLog DEBUG "Activating support for memset on broken ppc-8xx (CPU15 erratum)"
1.144 - GLIBC_INITIAL_BUILD_ASFLAGS="-DBROKEN_PPC_8xx_CPU15";;
1.145 - esac
1.146 -
1.147 - # If this fails with an error like this:
1.148 - # ... linux/autoconf.h: No such file or directory
1.149 - # then you need to set the KERNELCONFIG variable to point to a .config file for this arch.
1.150 - # The following architectures are known to need kernel .config: alpha, arm, ia64, s390, sh, sparc
1.151 - # Note: LD and RANLIB needed by glibc-2.1.3's c_stub directory, at least on macosx
1.152 - CT_DoLog EXTRA "Building C library"
1.153 - CT_DoExecLog ALL make LD=${CT_TARGET}-ld \
1.154 - RANLIB=${CT_TARGET}-ranlib \
1.155 - OBJDUMP_FOR_HOST="${CT_TARGET}-objdump" \
1.156 - ASFLAGS="${GLIBC_INITIAL_BUILD_ASFLAGS}" \
1.157 - all
1.158 -
1.159 - CT_DoLog EXTRA "Installing C library"
1.160 - CT_DoExecLog ALL make install_root="${CT_SYSROOT_DIR}" \
1.161 - ${LIBC_SYSROOT_ARG} \
1.162 - OBJDUMP_FOR_HOST="${CT_TARGET}-objdump" \
1.163 - install
1.164 -
1.165 - # This doesn't seem to work when building a crosscompiler,
1.166 - # as it tries to execute localedef using the just-built ld.so!?
1.167 - #CT_DoLog EXTRA "Installing locales"
1.168 - #make localedata/install-locales install_root=${SYSROOT} 2>&1 |CT_DoLog ALL
1.169 -
1.170 - # Fix problems in linker scripts.
1.171 - #
1.172 - # Remove lines containing BUG per http://sources.redhat.com/ml/bug-glibc/2003-05/msg00055.html,
1.173 - # needed to fix gcc-3.2.3/glibc-2.3.2 targeting arm
1.174 - # No need to look into the lib64/ dirs here and there, they point to the
1.175 - # corresponding lib/ directories.
1.176 - #
1.177 - # To make "strip *.so.*" not fail (ptxdist does this), rename to .so_orig rather than .so.orig
1.178 - CT_DoLog EXTRA "Fixing C library linker scripts"
1.179 - for file in libc.so libpthread.so libgcc_s.so; do
1.180 - for dir in lib usr/lib; do
1.181 - if [ -f "${CT_SYSROOT_DIR}/${dir}/${file}" -a ! -L ${CT_SYSROOT_DIR}/$lib/$file ]; then
1.182 - CT_DoExecLog ALL cp -v "${CT_SYSROOT_DIR}/${dir}/${file}" "${CT_SYSROOT_DIR}/${dir}/${file}_orig"
1.183 - CT_DoLog DEBUG "Fixing '${CT_SYS_ROOT_DIR}/${dir}/${file}'"
1.184 - CT_DoExecLog ALL sed -i -r -e '/BUG in libc.scripts.output-format.sed/d' "${CT_SYSROOT_DIR}/${dir}/${file}"
1.185 - fi
1.186 - done
1.187 - done
1.188 -
1.189 - CT_EndStep
1.190 -}