yann@2270: # This file contains the functions common to glibc and eglibc yann@850: yann@2483: # Extract the C library tarball(s) yann@2483: do_libc_extract() { yann@2483: local addon yann@2483: yann@2483: # Extract the main tarball yann@2483: CT_Extract "${CT_LIBC}-${CT_LIBC_VERSION}" yann@2483: CT_Pushd "${CT_SRC_DIR}/${CT_LIBC}-${CT_LIBC_VERSION}" yann@2483: CT_Patch nochdir "${CT_LIBC}" "${CT_LIBC_VERSION}" yann@2483: yann@2483: # Extract the add-opns yann@2483: for addon in $(do_libc_add_ons_list " "); do yann@2496: # If the addon was bundled with the main archive, we do not yann@2496: # need to extract it. Worse, if we were to try to extract yann@2496: # it, we'd get an error. yann@2496: if [ -d "${addon}" ]; then yann@2496: CT_DoLog DEBUG "Add-on already present, spkipping extraction" yann@2496: continue yann@2496: fi yann@2483: yann@2483: CT_Extract nochdir "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}" yann@2483: yann@2483: CT_TestAndAbort "Error in add-on '${addon}': both short and long names in tarball" \ yann@2483: -d "${addon}" -a -d "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}" yann@2483: yann@2483: # Some addons have the 'long' name, while others have the yann@2483: # 'short' name, but patches are non-uniformly built with yann@2483: # either the 'long' or 'short' name, whatever the addons name yann@2483: # but we prefer the 'short' name and avoid duplicates. yann@2483: if [ -d "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}" ]; then esben@2699: CT_DoExecLog FILE mv "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}" "${addon}" yann@2483: fi yann@2483: esben@2699: CT_DoExecLog FILE ln -s "${addon}" "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}" yann@2483: yann@2483: CT_Patch nochdir "${CT_LIBC}" "${addon}-${CT_LIBC_VERSION}" yann@2483: yann@2483: # Remove the long name since it can confuse configure scripts to run yann@2483: # the same source twice. yann@2483: rm "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}" yann@2483: done yann@2483: yann@2483: # The configure files may be older than the configure.in files yann@2483: # if using a snapshot (or even some tarballs). Fake them being yann@2483: # up to date. yann@2483: find . -type f -name configure -exec touch {} \; 2>&1 |CT_DoLog ALL yann@2483: yann@2483: CT_Popd benoit@2585: benoit@2585: if [ "${CT_LIBC_LOCALES}" = "y" ]; then benoit@2585: do_libc_locales_extract benoit@2585: fi yann@2483: } yann@2483: yann@2270: # Build and install headers and start files yann@850: do_libc_start_files() { bryanhundven@2515: # Start files and Headers should be configured the same way as the bryanhundven@2515: # final libc, but built and installed differently. bryanhundven@2515: do_libc_backend libc_mode=startfiles yann@850: } yann@850: yann@2270: # This function builds and install the full C library yann@850: do_libc() { bryanhundven@2515: do_libc_backend libc_mode=final bryanhundven@2515: } bryanhundven@2515: yann@2825: # This backend builds the C library once for each multilib yann@2825: # variant the compiler gives us yann@2806: # Usage: do_libc_backend param=value [...] yann@2806: # Parameter : Definition : Type : Default yann@2819: # libc_mode : 'startfiles' or 'final' : string : (none) yann@2825: do_libc_backend() { yann@2825: local libc_mode yann@2825: local -a multilibs yann@2825: local multilib yann@2825: local multi_dir yann@2825: local multi_flags yann@2825: local extra_dir yann@2826: local libc_headers libc_startfiles libc_full yann@2826: local hdr yann@2826: local arg yann@2825: yann@2825: for arg in "$@"; do yann@2825: eval "${arg// /\\ }" yann@2825: done yann@2825: yann@2825: case "${libc_mode}" in yann@2826: startfiles) yann@2826: CT_DoStep INFO "Installing C library headers & start files" yann@2826: hdr=y yann@2826: libc_startfiles=y yann@2826: libc_full= yann@2826: ;; yann@2826: final) yann@2826: CT_DoStep INFO "Installing C library" yann@2826: hdr= yann@2826: libc_startfiles= yann@2826: libc_full=y yann@2826: ;; yann@2826: *) CT_Abort "Unsupported (or unset) libc_mode='${libc_mode}'";; yann@2825: esac yann@2825: yann@2825: # If gcc is not configured for multilib, it still prints yann@2825: # a single line for the default settings yann@2825: multilibs=( $("${CT_TARGET}-gcc" -print-multi-lib 2>/dev/null) ) yann@2825: for multilib in "${multilibs[@]}"; do yann@2825: multi_dir="${multilib%%;*}" yann@2825: if [ "${multi_dir}" != "." ]; then yann@2825: CT_DoStep INFO "Building for multilib subdir='${multi_dir}'" yann@2825: yann@2825: extra_flags="$( echo "${multilib#*;}" \ yann@2825: |${sed} -r -e 's/@/ -/g;' \ yann@2825: )" yann@2825: extra_dir="/${multi_dir}" yann@2825: yann@2825: # glibc install its files in ${extra_dir}/{usr/,}lib yann@2825: # while gcc expects them in {,usr/}lib/${extra_dir}. yann@2825: # Prepare some symlinks so glibc installs in fact in yann@2825: # the proper place yann@2825: # We do it in the start-files step, so it is not needed yann@2825: # to do it in the final step, as the symlinks will yann@2825: # already exist yann@2825: if [ "${libc_mode}" = "startfiles" ]; then yann@2825: CT_Pushd "${CT_SYSROOT_DIR}" yann@2825: CT_DoExecLog ALL mkdir -p "lib/${multi_dir}" \ yann@2825: "usr/lib/${multi_dir}" \ yann@2825: "${multi_dir}" \ yann@2825: "${multi_dir}/usr" yann@2825: CT_DoExecLog ALL ln -sf "../lib/${multi_dir}" "${multi_dir}/lib" yann@2825: CT_DoExecLog ALL ln -sf "../../usr/lib/${multi_dir}" "${multi_dir}/usr/lib" yann@2825: CT_Popd yann@2825: fi yann@2826: libc_headers= yann@2825: else yann@2825: extra_dir= yann@2825: extra_flags= yann@2826: libc_headers="${hdr}" yann@2825: fi yann@2825: yann@2825: mkdir -p "${CT_BUILD_DIR}/build-libc-${libc_mode}${extra_dir//\//_}" yann@2825: CT_Pushd "${CT_BUILD_DIR}/build-libc-${libc_mode}${extra_dir//\//_}" yann@2825: yann@2826: do_libc_backend_once extra_dir="${extra_dir}" \ yann@2826: extra_flags="${extra_flags}" \ yann@2826: libc_headers="${libc_headers}" \ yann@2826: libc_startfiles="${libc_startfiles}" \ yann@2826: libc_full="${libc_full}" yann@2825: yann@2825: CT_Popd yann@2825: yann@2825: if [ "${multi_dir}" != "." ]; then yann@2825: if [ "${libc_mode}" = "final" ]; then yann@2825: CT_DoLog EXTRA "Fixing up multilib location" yann@2825: yann@2825: # rewrite the library multiplexers yann@2825: for d in "lib/${multi_dir}" "usr/lib/${multi_dir}"; do yann@2825: for l in libc libpthread libgcc_s; do yann@2825: if [ -f "${CT_SYSROOT_DIR}/${d}/${l}.so" \ yann@2825: -a ! -L ${CT_SYSROOT_DIR}/${d}/${l}.so ] yann@2825: then yann@2825: CT_DoExecLog DEBUG ${sed} -r -i \ yann@2825: -e "s:/lib/:/lib/${multi_dir}/:g;" \ yann@2825: "${CT_SYSROOT_DIR}/${d}/${l}.so" yann@2825: fi yann@2825: done yann@2825: done yann@2827: # Remove the multi_dir now it is no longer useful yann@2827: CT_DoExecLog DEBUG rm -rf "${CT_SYSROOT_DIR}/${multi_dir}" yann@2825: fi # libc_mode == final yann@2827: yann@2825: CT_EndStep yann@2825: fi yann@2825: done yann@2825: yann@2825: CT_EndStep yann@2825: } yann@2825: yann@2825: # This backend builds the C library once yann@2825: # Usage: do_libc_backend_once param=value [...] yann@2825: # Parameter : Definition : Type : Default yann@2826: # libc_headers : Build libc headers : bool : n yann@2826: # libc_startfiles : Build libc start-files : bool : n yann@2826: # libc_full : Build full libc : bool : n yann@2820: # extra_flags : Extra CFLAGS to use (for multilib) : string : (empty) yann@2823: # extra_dir : Extra subdir for multilib : string : (empty) yann@2825: do_libc_backend_once() { yann@2826: local libc_headers yann@2826: local libc_startfiles yann@2826: local libc_full yann@2820: local extra_flags yann@2823: local extra_dir yann@2271: local src_dir="${CT_SRC_DIR}/${CT_LIBC}-${CT_LIBC_VERSION}" yann@2276: local extra_cc_args yann@1478: local -a extra_config yann@2271: local -a extra_make_args yann@2312: local glibc_cflags yann@2821: local float_extra yann@2822: local endian_extra yann@2883: local arg yann@1478: yann@2883: for arg in "$@"; do yann@2883: eval "${arg// /\\ }" bryanhundven@2515: done yann@850: yann@850: CT_DoLog EXTRA "Configuring C library" yann@850: yann@2271: case "${CT_LIBC}" in yann@2271: eglibc) yann@2271: if [ "${CT_EGLIBC_CUSTOM_CONFIG}" = "y" ]; then yann@2271: CT_DoExecLog ALL cp "${CT_CONFIG_DIR}/eglibc.config" option-groups.config yann@2271: fi yann@2271: if [ "${CT_EGLIBC_OPT_SIZE}" = "y" ]; then yann@2271: OPTIMIZE=-Os yann@2271: else yann@2271: OPTIMIZE=-O2 yann@2271: fi yann@2271: ;; yann@2276: glibc) yann@2276: # glibc can't be built without -O2 (reference needed!) yann@2276: OPTIMIZE=-O2 yann@2276: # Also, if those two are missing, iconv build breaks yann@2276: extra_config+=( --disable-debug --disable-sanity-checks ) yann@2276: ;; yann@2271: esac richard@1796: yann@850: # Add some default glibc config options if not given by user. yann@850: # We don't need to be conditional on wether the user did set different yann@2467: # values, as they CT_LIBC_GLIBC_EXTRA_CONFIG_ARRAY is passed after yann@2467: # extra_config yann@850: yann@2273: extra_config+=("$(do_libc_min_kernel_config)") yann@850: yann@850: case "${CT_THREADS}" in yann@1478: nptl) extra_config+=("--with-__thread" "--with-tls");; yann@1478: linuxthreads) extra_config+=("--with-__thread" "--without-tls" "--without-nptl");; yann@1478: none) extra_config+=("--without-__thread" "--without-nptl") yann@2467: case "${CT_LIBC_GLIBC_EXTRA_CONFIG_ARRAY[*]}" in yann@850: *-tls*) ;; yann@1478: *) extra_config+=("--without-tls");; yann@850: esac yann@850: ;; yann@850: esac yann@850: yann@850: case "${CT_SHARED_LIBS}" in yann@1478: y) extra_config+=("--enable-shared");; yann@1478: *) extra_config+=("--disable-shared");; yann@850: esac yann@850: yann@2821: float_extra="$( echo "${extra_flags}" \ yann@2821: |${sed} -r -e '/^(.*[[:space:]])?-m(hard|soft)-float([[:space:]].*)?$/!d;' \ yann@2821: -e 's//\2/;' \ yann@2821: )" yann@2821: case "${float_extra}" in michael@2737: hard) extra_config+=("--with-fp");; michael@2737: soft) extra_config+=("--without-fp");; yann@2821: "") yann@2821: case "${CT_ARCH_FLOAT}" in yann@2821: hard|softfp) extra_config+=("--with-fp");; yann@2821: soft) extra_config+=("--without-fp");; yann@2821: esac yann@2821: ;; yann@850: esac yann@850: bryanhundven@2180: if [ "${CT_LIBC_DISABLE_VERSIONING}" = "y" ]; then bryanhundven@2180: extra_config+=("--disable-versioning") bryanhundven@2180: fi bryanhundven@2180: bryanhundven@2181: if [ "${CT_LIBC_OLDEST_ABI}" != "" ]; then bryanhundven@2181: extra_config+=("--enable-oldest-abi=${CT_LIBC_OLDEST_ABI}") bryanhundven@2181: fi bryanhundven@2181: yann@850: case "$(do_libc_add_ons_list ,)" in benoit@2573: "") extra_config+=("--enable-add-ons=no");; yann@1478: *) extra_config+=("--enable-add-ons=$(do_libc_add_ons_list ,)");; yann@850: esac yann@850: benoit@2489: if [ "${CT_LIBC_EGLIBC_HAS_PKGVERSION_BUGURL}" = "y" ]; then benoit@2503: extra_config+=("--with-pkgversion=${CT_PKGVERSION}") benoit@2503: [ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}") benoit@2489: fi benoit@2489: yann@2822: # Extract the endianness options if any yann@2822: # This should cover all possible endianness options yann@2822: # in gcc, but it is prone to bit-rot... :-( yann@2822: endian_extra="$( echo "${extra_flags}" \ yann@2822: |${sed} -r -e '/^(.*[[:space:]])?-(E[BL]|m((big|little)(-endian)?|e?[bl]))([[:space:]].*)?$/!d;' \ yann@2822: -e 's//\2/;' \ yann@2822: )" yann@2822: case "${endian_extra}" in yann@2822: EB|mbig-endian|mbig|meb|mb) yann@2822: extra_cc_args="${extra_cc_args} ${endian_extra}" yann@2822: ;; yann@2822: EL|mlittle-endian|mlittle|mel|ml) yann@2822: extra_cc_args="${extra_cc_args} ${endian_extra}" yann@2822: ;; yann@2822: "") extra_cc_args="${extra_cc_args} ${CT_ARCH_ENDIAN_OPT}" yann@2822: ;; yann@2822: esac yann@850: yann@2289: touch config.cache yann@2289: if [ "${CT_LIBC_GLIBC_FORCE_UNWIND}" = "y" ]; then yann@2289: echo "libc_cv_forced_unwind=yes" >>config.cache yann@2289: echo "libc_cv_c_cleanup=yes" >>config.cache yann@2289: fi yann@2289: yann@2276: # Pre-seed the configparms file with values from the config option yann@2276: printf "${CT_LIBC_GLIBC_CONFIGPARMS}\n" > configparms yann@2276: benoit@2489: cross_cc=$(CT_Which "${CT_TARGET}-gcc") yann@2820: extra_cc_args+=" ${extra_flags}" yann@850: yann@2312: case "${CT_LIBC_ENABLE_FORTIFIED_BUILD}" in yann@2312: y) ;; yann@2312: *) glibc_cflags+=" -U_FORTIFY_SOURCE";; yann@2312: esac yann@2828: glibc_cflags+=" ${CT_TARGET_CFLAGS} ${OPTIMIZE} ${CT_LIBC_GLIBC_EXTRA_CFLAGS}" yann@2312: bryanhundven@2229: # ./configure is mislead by our tools override wrapper for bash bryanhundven@2229: # so just tell it where the real bash is _on_the_target_! bryanhundven@2229: # Notes: bryanhundven@2229: # - ${ac_cv_path_BASH_SHELL} is only used to set BASH_SHELL bryanhundven@2229: # - ${BASH_SHELL} is only used to set BASH bryanhundven@2229: # - ${BASH} is only used to set the shebang bryanhundven@2229: # in two scripts to run on the target bryanhundven@2229: # So we can safely bypass bash detection at compile time. bryanhundven@2229: # Should this change in a future eglibc release, we'd better bryanhundven@2229: # directly mangle the generated scripts _after_ they get built, bryanhundven@2229: # or even after they get installed... eglibc is such a sucker... yann@2289: echo "ac_cv_path_BASH_SHELL=/bin/bash" >>config.cache bryanhundven@2229: yann@2276: # Configure with --prefix the way we want it on the target... yann@2276: # There are a whole lot of settings here. You'll probably want yann@2467: # to read up on what they all mean, and customize a bit, possibly by setting GLIBC_EXTRA_CONFIG_ARRAY yann@2276: # Compare these options with the ones used when installing the glibc headers above - they're different. yann@2276: # Adding "--without-gd" option to avoid error "memusagestat.c:36:16: gd.h: No such file or directory" yann@2276: # See also http://sources.redhat.com/ml/libc-alpha/2000-07/msg00024.html. yann@2276: # Set BUILD_CC, or we won't be able to build datafiles yann@2706: # Run explicitly through CONFIG_SHELL, or the build breaks badly (loop-of-death) yann@2706: # when the shell is not bash... Sigh... :-( yann@2276: yann@2828: CT_DoLog DEBUG "Using gcc for target : '${cross_cc}'" yann@2828: CT_DoLog DEBUG "Configuring with addons : '$(do_libc_add_ons_list ,)'" yann@2828: CT_DoLog DEBUG "Extra config args passed: '${extra_config[*]}'" yann@2828: CT_DoLog DEBUG "Extra CC args passed : '${glibc_cflags}'" yann@2828: CT_DoLog DEBUG "Extra flags (multilib) : '${extra_flags}'" yann@2828: yann@2353: CT_DoExecLog CFG \ yann@1041: BUILD_CC="${CT_BUILD}-gcc" \ yann@2312: CFLAGS="${glibc_cflags}" \ yann@850: CC="${CT_TARGET}-gcc ${CT_LIBC_EXTRA_CC_ARGS} ${extra_cc_args}" \ yann@850: AR=${CT_TARGET}-ar \ yann@850: RANLIB=${CT_TARGET}-ranlib \ yann@2706: "${CONFIG_SHELL}" \ yann@2271: "${src_dir}/configure" \ yann@850: --prefix=/usr \ yann@1041: --build=${CT_BUILD} \ yann@850: --host=${CT_TARGET} \ yann@2289: --cache-file="$(pwd)/config.cache" \ yann@2276: --without-cvs \ yann@850: --disable-profile \ yann@850: --without-gd \ yann@2276: --with-headers="${CT_HEADERS_DIR}" \ yann@1478: "${extra_config[@]}" \ yann@2467: "${CT_LIBC_GLIBC_EXTRA_CONFIG_ARRAY[@]}" benoit@2489: yann@2276: # build hacks yann@2276: case "${CT_ARCH},${CT_ARCH_CPU}" in yann@2276: powerpc,8??) yann@2276: # http://sourceware.org/ml/crossgcc/2008-10/msg00068.html yann@2276: CT_DoLog DEBUG "Activating support for memset on broken ppc-8xx (CPU15 erratum)" yann@2276: extra_make_args+=( ASFLAGS="-DBROKEN_PPC_8xx_CPU15" ) yann@2271: ;; yann@1328: esac yann@1328: yann@2826: if [ "${libc_headers}" = "y" ]; then bryanhundven@2515: CT_DoLog EXTRA "Installing C library headers" yann@850: bryanhundven@2515: # use the 'install-headers' makefile target to install the bryanhundven@2515: # headers yann@2824: CT_DoExecLog ALL make ${JOBSFLAGS} \ yann@2823: install_root=${CT_SYSROOT_DIR}${extra_dir} \ yann@2824: install-bootstrap-headers=yes \ yann@2824: "${extra_make_args[@]}" \ bryanhundven@2515: install-headers bryanhundven@2515: bryanhundven@2515: # For glibc, a few headers need to be manually installed bryanhundven@2515: if [ "${CT_LIBC}" = "glibc" ]; then bryanhundven@2515: # Two headers -- stubs.h and features.h -- aren't installed by install-headers, bryanhundven@2515: # so do them by hand. We can tolerate an empty stubs.h for the moment. bryanhundven@2515: # See e.g. http://gcc.gnu.org/ml/gcc/2002-01/msg00900.html bryanhundven@2515: mkdir -p "${CT_HEADERS_DIR}/gnu" bryanhundven@2515: CT_DoExecLog ALL touch "${CT_HEADERS_DIR}/gnu/stubs.h" bryanhundven@2515: CT_DoExecLog ALL cp -v "${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/include/features.h" \ bryanhundven@2515: "${CT_HEADERS_DIR}/features.h" bryanhundven@2515: bryanhundven@2515: # Building the bootstrap gcc requires either setting inhibit_libc, or bryanhundven@2515: # having a copy of stdio_lim.h... see bryanhundven@2515: # http://sources.redhat.com/ml/libc-alpha/2003-11/msg00045.html bryanhundven@2515: CT_DoExecLog ALL cp -v bits/stdio_lim.h "${CT_HEADERS_DIR}/bits/stdio_lim.h" bryanhundven@2515: bryanhundven@2515: # Following error building gcc-4.0.0's gcj: bryanhundven@2515: # error: bits/syscall.h: No such file or directory bryanhundven@2515: # solved by following copy; see http://sourceware.org/ml/crossgcc/2005-05/msg00168.html bryanhundven@2515: # but it breaks arm, see http://sourceware.org/ml/crossgcc/2006-01/msg00091.html bryanhundven@2515: case "${CT_ARCH}" in bryanhundven@2515: arm) ;; bryanhundven@2515: *) CT_DoExecLog ALL cp -v "misc/syscall-list.h" \ bryanhundven@2515: "${CT_HEADERS_DIR}/bits/syscall.h" bryanhundven@2515: ;; bryanhundven@2515: esac bryanhundven@2515: fi yann@2826: fi # libc_headers == y bryanhundven@2515: yann@2826: if [ "${libc_startfiles}" = "y" ]; then bryanhundven@2515: if [ "${CT_THREADS}" = "nptl" ]; then bryanhundven@2515: CT_DoLog EXTRA "Installing C library start files" bryanhundven@2515: bryanhundven@2515: # there are a few object files needed to link shared libraries, bryanhundven@2515: # which we build and install by hand yann@2823: CT_DoExecLog ALL mkdir -p "${CT_SYSROOT_DIR}${extra_dir}/usr/lib" bryanhundven@2515: CT_DoExecLog ALL make ${JOBSFLAGS} \ bryanhundven@2515: "${extra_make_args[@]}" \ bryanhundven@2515: csu/subdir_lib yann@2824: CT_DoExecLog ALL cp csu/crt1.o csu/crti.o csu/crtn.o \ yann@2823: "${CT_SYSROOT_DIR}${extra_dir}/usr/lib" bryanhundven@2515: bryanhundven@2515: # Finally, 'libgcc_s.so' requires a 'libc.so' to link against. bryanhundven@2515: # However, since we will never actually execute its code, bryanhundven@2515: # it doesn't matter what it contains. So, treating '/dev/null' bryanhundven@2515: # as a C source file, we produce a dummy 'libc.so' in one step bryanhundven@2515: CT_DoExecLog ALL "${cross_cc}" -nostdlib \ bryanhundven@2515: -nostartfiles \ bryanhundven@2515: -shared \ bryanhundven@2515: -x c /dev/null \ yann@2823: -o "${CT_SYSROOT_DIR}${extra_dir}/usr/lib/libc.so" bryanhundven@2515: fi # threads == nptl yann@2826: fi # libc_headers == y yann@2826: yann@2826: if [ "${libc_full}" = "y" ]; then bryanhundven@2515: CT_DoLog EXTRA "Building C library" yann@2824: CT_DoExecLog ALL make ${JOBSFLAGS} \ yann@2824: "${extra_make_args[@]}" \ bryanhundven@2515: all bryanhundven@2515: bryanhundven@2515: CT_DoLog EXTRA "Installing C library" yann@2824: CT_DoExecLog ALL make ${JOBSFLAGS} \ yann@2824: "${extra_make_args[@]}" \ yann@2823: install_root="${CT_SYSROOT_DIR}${extra_dir}" \ bryanhundven@2515: install benoit@2585: michael@2765: if [ "${CT_BUILD_MANUALS}" = "y" ]; then michael@2765: CT_DoLog EXTRA "Building and installing the C library manual" michael@2765: # Omit JOBSFLAGS as GLIBC has problems building the michael@2765: # manuals in parallel michael@2765: CT_DoExecLog ALL make pdf html michael@2765: # EGLIBC doesn't have a install-{pdf.html} and leaves the manuals michael@2765: # in the source directory michael@2765: CT_DoExecLog ALL mkdir -p ${CT_PREFIX_DIR}/share/doc michael@2765: CT_DoExecLog ALL cp -av ${src_dir}/manual/*.pdf ${src_dir}/manual/libc \ michael@2765: ${CT_PREFIX_DIR}/share/doc michael@2765: fi michael@2765: benoit@2585: if [ "${CT_LIBC_LOCALES}" = "y" ]; then benoit@2585: do_libc_locales benoit@2585: fi yann@2826: fi # libc_full == y yann@850: } yann@850: yann@2270: # This function finishes the C library install yann@2270: # This is a no-op yann@850: do_libc_finish() { yann@850: : yann@850: } yann@850: yann@850: # Build up the addons list, separated with $1 yann@850: do_libc_add_ons_list() { yann@850: local sep="$1" yann@2274: local addons_list="$( echo "${CT_LIBC_ADDONS_LIST}" \ yann@2274: |sed -r -e "s/[[:space:],]/${sep}/g;" \ yann@2274: )" yann@850: case "${CT_THREADS}" in yann@850: none) ;; yann@850: *) addons_list="${addons_list}${sep}${CT_THREADS}";; yann@850: esac yann@850: [ "${CT_LIBC_GLIBC_USE_PORTS}" = "y" ] && addons_list="${addons_list}${sep}ports" yann@2274: # Remove duplicate, leading and trailing separators yann@2274: echo "${addons_list}" |sed -r -e "s/${sep}+/${sep}/g; s/^${sep}//; s/${sep}\$//;" yann@850: } yann@2273: yann@2273: # Compute up the minimum supported Linux kernel version yann@2273: do_libc_min_kernel_config() { yann@2273: local min_kernel_config yann@2273: yann@2467: case "${CT_LIBC_GLIBC_EXTRA_CONFIG_ARRAY[*]}" in yann@2273: *--enable-kernel*) ;; yann@2273: *) if [ "${CT_LIBC_GLIBC_KERNEL_VERSION_AS_HEADERS}" = "y" ]; then yann@2273: # We can't rely on the kernel version from the configuration, yann@2273: # because it might not be available if the user uses pre-installed yann@2273: # headers. On the other hand, both method will have the kernel yann@2279: # version installed in "usr/include/linux/version.h" in the sysroot. yann@2273: # Parse that instead of having two code-paths. yann@2273: version_code_file="${CT_SYSROOT_DIR}/usr/include/linux/version.h" yann@2273: if [ ! -f "${version_code_file}" -o ! -r "${version_code_file}" ]; then yann@2273: CT_Abort "Linux version is unavailable in installed headers files" yann@2273: fi yann@2273: version_code="$( grep -E LINUX_VERSION_CODE "${version_code_file}" \ yann@2273: |cut -d ' ' -f 3 \ yann@2273: )" yann@2273: version=$(((version_code>>16)&0xFF)) yann@2273: patchlevel=$(((version_code>>8)&0xFF)) yann@2273: sublevel=$((version_code&0xFF)) yann@2273: min_kernel_config="${version}.${patchlevel}.${sublevel}" yann@2273: elif [ "${CT_LIBC_GLIBC_KERNEL_VERSION_CHOSEN}" = "y" ]; then yann@2273: # Trim the fourth part of the linux version, keeping only the first three numbers yann@2276: min_kernel_config="$( echo "${CT_LIBC_GLIBC_MIN_KERNEL_VERSION}" \ yann@2276: |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;' \ yann@2273: )" yann@2273: fi yann@2273: echo "--enable-kernel=${min_kernel_config}" yann@2273: ;; yann@2273: esac yann@2273: }