eglibc: add support for user provided option groups
authorArnaud Vrac <avrac@freebox.fr>
Fri Oct 09 16:22:09 2009 +0200 (2009-10-09)
changeset 1569a4e30d311569
parent 1567 56bba7d4fc89
child 1570 1d43b65599a4
child 1574 07684767f873
eglibc: add support for user provided option groups

Signed-off-by: Arnaud Vrac <avrac@freebox.fr>
config/libc/eglibc.in
scripts/build/libc/eglibc.sh
     1.1 --- a/config/libc/eglibc.in	Thu Oct 08 23:29:45 2009 +0200
     1.2 +++ b/config/libc/eglibc.in	Fri Oct 09 16:22:09 2009 +0200
     1.3 @@ -90,3 +90,55 @@
     1.4        
     1.5        Note that crosstool-NG will *not* update your working copy, you will
     1.6        have to do that yourself.
     1.7 +
     1.8 +config EGLIBC_CUSTOM_CONFIG
     1.9 +    bool
    1.10 +    prompt "Use custom configuration file"
    1.11 +    default n
    1.12 +    help
    1.13 +      Use a custom configuration file to disable some features in the eglibc
    1.14 +      library. The configuration file options are described in detail in the
    1.15 +      option-groups.def file in the eglibc source directory.
    1.16 +
    1.17 +if EGLIBC_CUSTOM_CONFIG
    1.18 +    config EGLIBC_OPTION_GROUPS_FILE
    1.19 +        string
    1.20 +        prompt "Path to the option-groups configuration file"
    1.21 +        default ""
    1.22 +        help
    1.23 +          Path to the option groups configuration file.
    1.24 +
    1.25 +    config EGLIBC_BUNDLED_NSS_CONFIG
    1.26 +        bool
    1.27 +        prompt "Use bundled NSS config file"
    1.28 +        default y
    1.29 +        help
    1.30 +          Use minimal nsswitch configuration file bundled in eglibc.
    1.31 +          This option is only meaningful when runtime nss configuration
    1.32 +          is disabled in the option groups file.
    1.33 +
    1.34 +    config EGLIBC_NSS_CONFIG_FILE
    1.35 +        string
    1.36 +        prompt "Path to the NSS config file"
    1.37 +        default ""
    1.38 +        depends on !EGLIBC_BUNDLED_NSS_CONFIG
    1.39 +        help
    1.40 +          Path to the nsswitch configuration file
    1.41 +
    1.42 +    config EGLIBC_BUNDLED_NSS_FUNCTIONS
    1.43 +        bool
    1.44 +        prompt "Use bundled NSS functions file"
    1.45 +        default y
    1.46 +        help
    1.47 +          Use minimal nsswitch functions file bundled in eglibc.
    1.48 +          This option is only meaningful when runtime nss configuration
    1.49 +          is disabled in the option groups file.
    1.50 +
    1.51 +    config EGLIBC_NSS_FUNCTIONS_FILE
    1.52 +        string
    1.53 +        prompt "Path to the NSS functions file"
    1.54 +        default ""
    1.55 +        depends on !EGLIBC_BUNDLED_NSS_FUNCTIONS
    1.56 +        help
    1.57 +          Path to the nsswitch functions file
    1.58 +endif
     2.1 --- a/scripts/build/libc/eglibc.sh	Thu Oct 08 23:29:45 2009 +0200
     2.2 +++ b/scripts/build/libc/eglibc.sh	Fri Oct 09 16:22:09 2009 +0200
     2.3 @@ -122,9 +122,50 @@
     2.4      return 0
     2.5  }
     2.6  
     2.7 -# There is nothing to do for eglibc check config
     2.8 +# Copy user provided eglibc configuration file if provided
     2.9  do_libc_check_config() {
    2.10 -    :
    2.11 +    if [ "${CT_EGLIBC_CUSTOM_CONFIG}" != "y" ]; then
    2.12 +        return 0
    2.13 +    fi
    2.14 +
    2.15 +    CT_DoStep INFO "Checking C library configuration"
    2.16 +
    2.17 +    CT_TestOrAbort "You did not provide an eglibc config file!" \
    2.18 +        -n "${CT_EGLIBC_OPTION_GROUPS_FILE}" -a \
    2.19 +        -f "${CT_EGLIBC_OPTION_GROUPS_FILE}"
    2.20 +
    2.21 +    CT_DoExecLog ALL cp "${CT_EGLIBC_OPTION_GROUPS_FILE}" "${CT_CONFIG_DIR}/eglibc.config"
    2.22 +
    2.23 +    # NSS configuration
    2.24 +    if grep -E '^OPTION_EGLIBC_NSSWITCH[[:space:]]*=[[:space:]]*n' "${CT_EGLIBC_OPTION_GROUPS_FILE}" >/dev/null 2>&1; then
    2.25 +        CT_DoLog DEBUG "Using fixed-configuration nsswitch facility"
    2.26 +
    2.27 +        if [ "${CT_EGLIBC_BUNDLED_NSS_CONFIG}" = "y" ]; then
    2.28 +            nss_config="${CT_SRC_DIR}/eglibc-${CT_LIBC_VERSION}/nss/fixed-nsswitch.conf"
    2.29 +        else
    2.30 +            nss_config="${CT_EGLIBC_NSS_CONFIG_FILE}"
    2.31 +        fi
    2.32 +        CT_TestOrAbort "NSS config file not found!" -n "${nss_config}" -a -f "${nss_config}"
    2.33 +
    2.34 +        CT_DoExecLog ALL cp "${nss_config}" "${CT_CONFIG_DIR}/nsswitch.config"
    2.35 +        echo "OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG = ${CT_CONFIG_DIR}/nsswitch.config" \
    2.36 +            >> "${CT_CONFIG_DIR}/eglibc.config"
    2.37 +
    2.38 +        if [ "${CT_EGLIBC_BUNDLED_NSS_FUNCTIONS}" = "y" ]; then
    2.39 +            nss_functions="${CT_SRC_DIR}/eglibc-${CT_LIBC_VERSION}/nss/fixed-nsswitch.functions"
    2.40 +        else
    2.41 +            nss_functions="${CT_EGLIBC_NSS_FUNCTIONS_FILE}"
    2.42 +        fi
    2.43 +        CT_TestOrAbort "NSS functions file not found!" -n "${nss_functions}" -a -f "${nss_functions}"
    2.44 +
    2.45 +        CT_DoExecLog ALL cp "${nss_functions}" "${CT_CONFIG_DIR}/nsswitch.functions"
    2.46 +        echo "OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS = ${CT_CONFIG_DIR}/nsswitch.functions" \
    2.47 +            >> "${CT_CONFIG_DIR}/eglibc.config"
    2.48 +    else
    2.49 +        CT_DoLog DEBUG "Using full-blown nsswitch facility"
    2.50 +    fi
    2.51 +
    2.52 +    CT_EndStep
    2.53  }
    2.54  
    2.55  # This function installs the eglibc headers needed to build the core compiler
    2.56 @@ -143,6 +184,10 @@
    2.57  
    2.58      CT_DoLog EXTRA "Configuring C library"
    2.59  
    2.60 +    if [ "${CT_EGLIBC_CUSTOM_CONFIG}" = "y" ]; then
    2.61 +        CT_DoExecLog ALL cp "${CT_CONFIG_DIR}/eglibc.config" option-groups.config
    2.62 +    fi
    2.63 +
    2.64      cross_cc=$(CT_Which "${CT_TARGET}-gcc")
    2.65      cross_cxx=$(CT_Which "${CT_TARGET}-g++")
    2.66      cross_ar=$(CT_Which "${CT_TARGET}-ar")
    2.67 @@ -210,6 +255,10 @@
    2.68  
    2.69      CT_DoLog EXTRA "Configuring C library"
    2.70  
    2.71 +    if [ "${CT_EGLIBC_CUSTOM_CONFIG}" = "y" ]; then
    2.72 +        CT_DoExecLog ALL cp "${CT_CONFIG_DIR}/eglibc.config" option-groups.config
    2.73 +    fi
    2.74 +
    2.75      # Add some default glibc config options if not given by user.
    2.76      # We don't need to be conditional on wether the user did set different
    2.77      # values, as they CT_LIBC_GLIBC_EXTRA_CONFIG is passed after extra_config