yann@850: # This file adds functions to build glibc yann@850: # Copyright 2007 Yann E. MORIN yann@850: # Licensed under the GPL v2. See COPYING in the root of this package yann@850: yann@2272: # Add the definitions common to glibc and eglibc yann@2483: # do_libc_extract yann@2272: # do_libc_start_files yann@2277: # do_libc yann@2277: # do_libc_finish yann@2277: # do_libc_add_ons_list yann@2277: # do_libc_min_kernel_config yann@2272: . "${CT_LIB_DIR}/scripts/build/libc/glibc-eglibc.sh-common" yann@2272: yann@850: # Download glibc yann@850: do_libc_get() { yann@1260: local date yann@1260: local version yann@1482: local -a addons_list yann@1482: yann@1482: addons_list=($(do_libc_add_ons_list " ")) yann@1114: yann@1759: # Main source yann@1759: CT_GetFile "glibc-${CT_LIBC_VERSION}" \ yann@1759: {ftp,http}://ftp.gnu.org/gnu/glibc \ yann@1759: ftp://gcc.gnu.org/pub/glibc/releases \ yann@1759: ftp://gcc.gnu.org/pub/glibc/snapshots yann@1759: yann@1759: # C library addons yann@1759: for addon in "${addons_list[@]}"; do yann@2504: # Never ever try to download these add-ons, yann@2504: # they've always been internal yann@2504: case "${addon}" in yann@2504: nptl) continue;; yann@2504: esac yann@2504: yann@2496: if ! CT_GetFile "glibc-${addon}-${CT_LIBC_VERSION}" \ yann@2496: {ftp,http}://ftp.gnu.org/gnu/glibc \ yann@2496: ftp://gcc.gnu.org/pub/glibc/releases \ yann@2496: ftp://gcc.gnu.org/pub/glibc/snapshots yann@2496: then yann@2496: # Some add-ons are bundled with glibc, others are yann@2496: # bundled in their own tarball. Eg. NPTL is internal, yann@2496: # while LinuxThreads was external. Also, for old yann@2496: # versions of glibc, the libidn add-on was external, yann@2496: # but with version >=2.10, it is internal. yann@2496: CT_DoLog DEBUG "Addon '${addon}' could not be downloaded." yann@2496: CT_DoLog DEBUG "We'll see later if we can find it in the source tree" yann@2496: fi yann@1759: done yann@850: yann@850: return 0 yann@850: } yann@850: yann@850: # There is nothing to do for glibc check config yann@850: do_libc_check_config() { yann@850: : yann@850: } benoit@2587: benoit@2587: # Extract the files required for the libc locales benoit@2587: # Nothing to do benoit@2587: do_libc_locales_extract() { benoit@2587: : benoit@2587: } benoit@2587: benoit@2587: # Build and install the libc locales benoit@2587: do_libc_locales() { benoit@2587: local src_dir="${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}" benoit@2587: local -a extra_config benoit@2587: local glibc_cflags benoit@2587: benoit@2587: mkdir -p "${CT_BUILD_DIR}/build-localedef" benoit@2587: cd "${CT_BUILD_DIR}/build-localedef" benoit@2587: benoit@2587: CT_DoLog EXTRA "Configuring C library localedef" benoit@2587: benoit@2587: if [ "${CT_LIBC_EGLIBC_HAS_PKGVERSION_BUGURL}" = "y" ]; then benoit@2587: extra_config+=("--with-pkgversion=${CT_PKGVERSION}") benoit@2587: [ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}") benoit@2587: fi benoit@2587: benoit@2587: CT_DoLog DEBUG "Extra config args passed: '${extra_config[*]}'" benoit@2587: benoit@2587: glibc_cflags="-O2 -fno-stack-protector" benoit@2587: case "${CT_LIBC_ENABLE_FORTIFIED_BUILD}" in benoit@2587: y) ;; benoit@2587: *) glibc_cflags+=" -U_FORTIFY_SOURCE";; benoit@2587: esac benoit@2587: benoit@2587: # ./configure is misled by our tools override wrapper for bash benoit@2587: # so just tell it where the real bash is _on_the_target_! benoit@2587: # Notes: benoit@2587: # - ${ac_cv_path_BASH_SHELL} is only used to set BASH_SHELL benoit@2587: # - ${BASH_SHELL} is only used to set BASH benoit@2587: # - ${BASH} is only used to set the shebang benoit@2587: # in two scripts to run on the target benoit@2587: # So we can safely bypass bash detection at compile time. benoit@2587: # Should this change in a future eglibc release, we'd better benoit@2587: # directly mangle the generated scripts _after_ they get built, yann@3041: # or even after they get installed... benoit@2587: echo "ac_cv_path_BASH_SHELL=/bin/bash" >>config.cache benoit@2587: benoit@2587: # Configure with --prefix the way we want it on the target... benoit@2587: benoit@2587: CT_DoExecLog CFG \ benoit@2587: CFLAGS="${glibc_cflags}" \ benoit@2587: "${src_dir}/configure" \ benoit@2587: --prefix=/usr \ benoit@2587: --cache-file="$(pwd)/config.cache" \ benoit@2587: --without-cvs \ benoit@2587: --disable-profile \ benoit@2587: --without-gd \ benoit@2587: --disable-debug \ benoit@2587: "${extra_config[@]}" benoit@2587: benoit@2587: CT_DoLog EXTRA "Building C library localedef" benoit@2587: CT_DoExecLog ALL make ${JOBSFLAGS} benoit@2587: benoit@2587: # The target's endianness and uint32_t alignment should be passed as options benoit@2587: # to localedef, but glibc's localedef does not support these options, which benoit@2587: # means that the locale files generated here will be suitable for the target benoit@2587: # only if it has the same endianness and uint32_t alignment as the host's. benoit@2587: benoit@2587: CT_DoLog EXTRA "Installing C library locales" benoit@2587: CT_DoExecLog ALL make ${JOBSFLAGS} \ benoit@2587: install_root="${CT_SYSROOT_DIR}" \ benoit@2587: localedata/install-locales benoit@2587: }