# HG changeset patch # User Arnaud Vrac # Date 1255098129 -7200 # Node ID a4e30d311569d92a941d1bfec571110dd19a56a5 # Parent 56bba7d4fc8924d276b71134b7f1ef57bed57f52 eglibc: add support for user provided option groups Signed-off-by: Arnaud Vrac diff -r 56bba7d4fc89 -r a4e30d311569 config/libc/eglibc.in --- a/config/libc/eglibc.in Thu Oct 08 23:29:45 2009 +0200 +++ b/config/libc/eglibc.in Fri Oct 09 16:22:09 2009 +0200 @@ -90,3 +90,55 @@ Note that crosstool-NG will *not* update your working copy, you will have to do that yourself. + +config EGLIBC_CUSTOM_CONFIG + bool + prompt "Use custom configuration file" + default n + help + Use a custom configuration file to disable some features in the eglibc + library. The configuration file options are described in detail in the + option-groups.def file in the eglibc source directory. + +if EGLIBC_CUSTOM_CONFIG + config EGLIBC_OPTION_GROUPS_FILE + string + prompt "Path to the option-groups configuration file" + default "" + help + Path to the option groups configuration file. + + config EGLIBC_BUNDLED_NSS_CONFIG + bool + prompt "Use bundled NSS config file" + default y + help + Use minimal nsswitch configuration file bundled in eglibc. + This option is only meaningful when runtime nss configuration + is disabled in the option groups file. + + config EGLIBC_NSS_CONFIG_FILE + string + prompt "Path to the NSS config file" + default "" + depends on !EGLIBC_BUNDLED_NSS_CONFIG + help + Path to the nsswitch configuration file + + config EGLIBC_BUNDLED_NSS_FUNCTIONS + bool + prompt "Use bundled NSS functions file" + default y + help + Use minimal nsswitch functions file bundled in eglibc. + This option is only meaningful when runtime nss configuration + is disabled in the option groups file. + + config EGLIBC_NSS_FUNCTIONS_FILE + string + prompt "Path to the NSS functions file" + default "" + depends on !EGLIBC_BUNDLED_NSS_FUNCTIONS + help + Path to the nsswitch functions file +endif diff -r 56bba7d4fc89 -r a4e30d311569 scripts/build/libc/eglibc.sh --- a/scripts/build/libc/eglibc.sh Thu Oct 08 23:29:45 2009 +0200 +++ b/scripts/build/libc/eglibc.sh Fri Oct 09 16:22:09 2009 +0200 @@ -122,9 +122,50 @@ return 0 } -# There is nothing to do for eglibc check config +# Copy user provided eglibc configuration file if provided do_libc_check_config() { - : + if [ "${CT_EGLIBC_CUSTOM_CONFIG}" != "y" ]; then + return 0 + fi + + CT_DoStep INFO "Checking C library configuration" + + CT_TestOrAbort "You did not provide an eglibc config file!" \ + -n "${CT_EGLIBC_OPTION_GROUPS_FILE}" -a \ + -f "${CT_EGLIBC_OPTION_GROUPS_FILE}" + + CT_DoExecLog ALL cp "${CT_EGLIBC_OPTION_GROUPS_FILE}" "${CT_CONFIG_DIR}/eglibc.config" + + # NSS configuration + if grep -E '^OPTION_EGLIBC_NSSWITCH[[:space:]]*=[[:space:]]*n' "${CT_EGLIBC_OPTION_GROUPS_FILE}" >/dev/null 2>&1; then + CT_DoLog DEBUG "Using fixed-configuration nsswitch facility" + + if [ "${CT_EGLIBC_BUNDLED_NSS_CONFIG}" = "y" ]; then + nss_config="${CT_SRC_DIR}/eglibc-${CT_LIBC_VERSION}/nss/fixed-nsswitch.conf" + else + nss_config="${CT_EGLIBC_NSS_CONFIG_FILE}" + fi + CT_TestOrAbort "NSS config file not found!" -n "${nss_config}" -a -f "${nss_config}" + + CT_DoExecLog ALL cp "${nss_config}" "${CT_CONFIG_DIR}/nsswitch.config" + echo "OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG = ${CT_CONFIG_DIR}/nsswitch.config" \ + >> "${CT_CONFIG_DIR}/eglibc.config" + + if [ "${CT_EGLIBC_BUNDLED_NSS_FUNCTIONS}" = "y" ]; then + nss_functions="${CT_SRC_DIR}/eglibc-${CT_LIBC_VERSION}/nss/fixed-nsswitch.functions" + else + nss_functions="${CT_EGLIBC_NSS_FUNCTIONS_FILE}" + fi + CT_TestOrAbort "NSS functions file not found!" -n "${nss_functions}" -a -f "${nss_functions}" + + CT_DoExecLog ALL cp "${nss_functions}" "${CT_CONFIG_DIR}/nsswitch.functions" + echo "OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS = ${CT_CONFIG_DIR}/nsswitch.functions" \ + >> "${CT_CONFIG_DIR}/eglibc.config" + else + CT_DoLog DEBUG "Using full-blown nsswitch facility" + fi + + CT_EndStep } # This function installs the eglibc headers needed to build the core compiler @@ -143,6 +184,10 @@ CT_DoLog EXTRA "Configuring C library" + if [ "${CT_EGLIBC_CUSTOM_CONFIG}" = "y" ]; then + CT_DoExecLog ALL cp "${CT_CONFIG_DIR}/eglibc.config" option-groups.config + fi + cross_cc=$(CT_Which "${CT_TARGET}-gcc") cross_cxx=$(CT_Which "${CT_TARGET}-g++") cross_ar=$(CT_Which "${CT_TARGET}-ar") @@ -210,6 +255,10 @@ CT_DoLog EXTRA "Configuring C library" + if [ "${CT_EGLIBC_CUSTOM_CONFIG}" = "y" ]; then + CT_DoExecLog ALL cp "${CT_CONFIG_DIR}/eglibc.config" option-groups.config + fi + # Add some default glibc config options if not given by user. # We don't need to be conditional on wether the user did set different # values, as they CT_LIBC_GLIBC_EXTRA_CONFIG is passed after extra_config