summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config/libc/glibc-eglibc.in-common9
-rw-r--r--scripts/build/libc/glibc.sh70
2 files changed, 79 insertions, 0 deletions
diff --git a/config/libc/glibc-eglibc.in-common b/config/libc/glibc-eglibc.in-common
index 32cf357..0c88596 100644
--- a/config/libc/glibc-eglibc.in-common
+++ b/config/libc/glibc-eglibc.in-common
@@ -151,6 +151,15 @@ config LIBC_LOCALES
Whether to build and install the libc locale files for the target,
which is required in order to support internationalization.
+if LIBC_glibc && LIBC_LOCALES
+comment "WARNING! "
+comment "| The built locales will be usable if and only if the build "
+comment "| machine and the target: "
+comment "| - have the same endianness, "
+comment "| - and have the same alignment requirements for uint32_t. "
+comment "| You will have to check by yourself (for now). "
+endif # LIBC_glibc && LIBC_LOCALES
+
if KERNEL_linux
choice LIBC_GLIBC_SUPPORTED_KERNEL
diff --git a/scripts/build/libc/glibc.sh b/scripts/build/libc/glibc.sh
index 195e618..e8b6637 100644
--- a/scripts/build/libc/glibc.sh
+++ b/scripts/build/libc/glibc.sh
@@ -55,3 +55,73 @@ do_libc_get() {
do_libc_check_config() {
:
}
+
+# Extract the files required for the libc locales
+# Nothing to do
+do_libc_locales_extract() {
+ :
+}
+
+# Build and install the libc locales
+do_libc_locales() {
+ local src_dir="${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}"
+ local -a extra_config
+ local glibc_cflags
+
+ mkdir -p "${CT_BUILD_DIR}/build-localedef"
+ cd "${CT_BUILD_DIR}/build-localedef"
+
+ CT_DoLog EXTRA "Configuring C library localedef"
+
+ if [ "${CT_LIBC_EGLIBC_HAS_PKGVERSION_BUGURL}" = "y" ]; then
+ extra_config+=("--with-pkgversion=${CT_PKGVERSION}")
+ [ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}")
+ fi
+
+ CT_DoLog DEBUG "Extra config args passed: '${extra_config[*]}'"
+
+ glibc_cflags="-O2 -fno-stack-protector"
+ case "${CT_LIBC_ENABLE_FORTIFIED_BUILD}" in
+ y) ;;
+ *) glibc_cflags+=" -U_FORTIFY_SOURCE";;
+ esac
+
+ # ./configure is misled by our tools override wrapper for bash
+ # so just tell it where the real bash is _on_the_target_!
+ # Notes:
+ # - ${ac_cv_path_BASH_SHELL} is only used to set BASH_SHELL
+ # - ${BASH_SHELL} is only used to set BASH
+ # - ${BASH} is only used to set the shebang
+ # in two scripts to run on the target
+ # So we can safely bypass bash detection at compile time.
+ # Should this change in a future eglibc release, we'd better
+ # directly mangle the generated scripts _after_ they get built,
+ # or even after they get installed... eglibc is such a sucker...
+ echo "ac_cv_path_BASH_SHELL=/bin/bash" >>config.cache
+
+ # Configure with --prefix the way we want it on the target...
+
+ CT_DoExecLog CFG \
+ CFLAGS="${glibc_cflags}" \
+ "${src_dir}/configure" \
+ --prefix=/usr \
+ --cache-file="$(pwd)/config.cache" \
+ --without-cvs \
+ --disable-profile \
+ --without-gd \
+ --disable-debug \
+ "${extra_config[@]}"
+
+ CT_DoLog EXTRA "Building C library localedef"
+ CT_DoExecLog ALL make ${JOBSFLAGS}
+
+ # The target's endianness and uint32_t alignment should be passed as options
+ # to localedef, but glibc's localedef does not support these options, which
+ # means that the locale files generated here will be suitable for the target
+ # only if it has the same endianness and uint32_t alignment as the host's.
+
+ CT_DoLog EXTRA "Installing C library locales"
+ CT_DoExecLog ALL make ${JOBSFLAGS} \
+ install_root="${CT_SYSROOT_DIR}" \
+ localedata/install-locales
+}