1 # This file adds functions to build glibc
2 # Copyright 2007 Yann E. MORIN
3 # Licensed under the GPL v2. See COPYING in the root of this package
5 # Add the definitions common to glibc and eglibc
10 # do_libc_add_ons_list
11 # do_libc_min_kernel_config
12 . "${CT_LIB_DIR}/scripts/build/libc/glibc-eglibc.sh-common"
20 addons_list=($(do_libc_add_ons_list " "))
23 CT_GetFile "glibc-${CT_LIBC_VERSION}" \
24 {ftp,http}://ftp.gnu.org/gnu/glibc \
25 ftp://gcc.gnu.org/pub/glibc/releases \
26 ftp://gcc.gnu.org/pub/glibc/snapshots
29 for addon in "${addons_list[@]}"; do
30 # Never ever try to download these add-ons,
31 # they've always been internal
36 if ! CT_GetFile "glibc-${addon}-${CT_LIBC_VERSION}" \
37 {ftp,http}://ftp.gnu.org/gnu/glibc \
38 ftp://gcc.gnu.org/pub/glibc/releases \
39 ftp://gcc.gnu.org/pub/glibc/snapshots
41 # Some add-ons are bundled with glibc, others are
42 # bundled in their own tarball. Eg. NPTL is internal,
43 # while LinuxThreads was external. Also, for old
44 # versions of glibc, the libidn add-on was external,
45 # but with version >=2.10, it is internal.
46 CT_DoLog DEBUG "Addon '${addon}' could not be downloaded."
47 CT_DoLog DEBUG "We'll see later if we can find it in the source tree"
54 # There is nothing to do for glibc check config
55 do_libc_check_config() {
59 # Extract the files required for the libc locales
61 do_libc_locales_extract() {
65 # Build and install the libc locales
67 local src_dir="${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}"
71 mkdir -p "${CT_BUILD_DIR}/build-localedef"
72 cd "${CT_BUILD_DIR}/build-localedef"
74 CT_DoLog EXTRA "Configuring C library localedef"
76 if [ "${CT_LIBC_EGLIBC_HAS_PKGVERSION_BUGURL}" = "y" ]; then
77 extra_config+=("--with-pkgversion=${CT_PKGVERSION}")
78 [ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}")
81 CT_DoLog DEBUG "Extra config args passed: '${extra_config[*]}'"
83 glibc_cflags="-O2 -fno-stack-protector"
84 case "${CT_LIBC_ENABLE_FORTIFIED_BUILD}" in
86 *) glibc_cflags+=" -U_FORTIFY_SOURCE";;
89 # ./configure is misled by our tools override wrapper for bash
90 # so just tell it where the real bash is _on_the_target_!
92 # - ${ac_cv_path_BASH_SHELL} is only used to set BASH_SHELL
93 # - ${BASH_SHELL} is only used to set BASH
94 # - ${BASH} is only used to set the shebang
95 # in two scripts to run on the target
96 # So we can safely bypass bash detection at compile time.
97 # Should this change in a future eglibc release, we'd better
98 # directly mangle the generated scripts _after_ they get built,
99 # or even after they get installed...
100 echo "ac_cv_path_BASH_SHELL=/bin/bash" >>config.cache
102 # Configure with --prefix the way we want it on the target...
105 CFLAGS="${glibc_cflags}" \
106 "${src_dir}/configure" \
108 --cache-file="$(pwd)/config.cache" \
115 CT_DoLog EXTRA "Building C library localedef"
116 CT_DoExecLog ALL make ${JOBSFLAGS}
118 # The target's endianness and uint32_t alignment should be passed as options
119 # to localedef, but glibc's localedef does not support these options, which
120 # means that the locale files generated here will be suitable for the target
121 # only if it has the same endianness and uint32_t alignment as the host's.
123 CT_DoLog EXTRA "Installing C library locales"
124 CT_DoExecLog ALL make ${JOBSFLAGS} \
125 install_root="${CT_SYSROOT_DIR}" \
126 localedata/install-locales