scripts/build/libc/eglibc.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Fri Aug 19 00:52:05 2011 +0200 (2011-08-19)
branch1.12
changeset 2633 22e779b0a4ed
parent 2504 3fc114996b20
child 2586 4f9efd2c6627
permissions -rw-r--r--
scripts: simplify and fix the toolchain config script

The script that is installed, and which sole purpose is to dump
the .config that was used to build the toolchain, is pure insanity.

Let's make it much, much more simpler...

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
(transplanted from 814ea73df7e0fab3db1cbe7623932714359c732b)
     1 # eglibc build functions (initially by Thomas JOURDAN).
     2 
     3 # Add the definitions common to glibc and eglibc
     4 #   do_libc_extract
     5 #   do_libc_start_files
     6 #   do_libc
     7 #   do_libc_finish
     8 #   do_libc_add_ons_list
     9 #   do_libc_min_kernel_config
    10 . "${CT_LIB_DIR}/scripts/build/libc/glibc-eglibc.sh-common"
    11 
    12 # Download glibc
    13 # eglibc is only available through subversion, there are no
    14 # snapshots available.
    15 do_libc_get() {
    16     local addon
    17     local svn_base
    18 
    19     if [ "${CT_EGLIBC_HTTP}" = "y" ]; then
    20         svn_base="http://www.eglibc.org/svn"
    21     else
    22         svn_base="svn://svn.eglibc.org"
    23     fi
    24 
    25     case "${CT_LIBC_VERSION}" in
    26         trunk)  svn_base+="/trunk";;
    27         *)      svn_base+="/branches/eglibc-${CT_LIBC_VERSION}";;
    28     esac
    29 
    30     CT_GetSVN "eglibc-${CT_LIBC_VERSION}"   \
    31               "${svn_base}/libc"            \
    32               "${CT_EGLIBC_REVISION:-HEAD}"
    33 
    34     for addon in $(do_libc_add_ons_list " "); do
    35         # Never ever try to download these add-ons,
    36         # they've always been internal
    37         case "${addon}" in
    38             nptl)   continue;;
    39         esac
    40 
    41         if ! CT_GetSVN "eglibc-${addon}-${CT_LIBC_VERSION}" \
    42                        "${svn_base}/${addon}"               \
    43                        "${CT_EGLIBC_REVISION:-HEAD}"
    44         then
    45             # Some add-ons are bundled with the main sources
    46             # so failure to download them is expected
    47             CT_DoLog DEBUG "Addon '${addon}' could not be downloaded."
    48             CT_DoLog DEBUG "We'll see later if we can find it in the source tree"
    49         fi
    50     done
    51 }
    52 
    53 # Copy user provided eglibc configuration file if provided
    54 do_libc_check_config() {
    55     if [ "${CT_EGLIBC_CUSTOM_CONFIG}" != "y" ]; then
    56         return 0
    57     fi
    58 
    59     CT_DoStep INFO "Checking C library configuration"
    60 
    61     CT_TestOrAbort "You did not provide an eglibc config file!" \
    62         -n "${CT_EGLIBC_OPTION_GROUPS_FILE}" -a \
    63         -f "${CT_EGLIBC_OPTION_GROUPS_FILE}"
    64 
    65     CT_DoExecLog ALL cp "${CT_EGLIBC_OPTION_GROUPS_FILE}" "${CT_CONFIG_DIR}/eglibc.config"
    66 
    67     # NSS configuration
    68     if grep -E '^OPTION_EGLIBC_NSSWITCH[[:space:]]*=[[:space:]]*n' "${CT_EGLIBC_OPTION_GROUPS_FILE}" >/dev/null 2>&1; then
    69         CT_DoLog DEBUG "Using fixed-configuration nsswitch facility"
    70 
    71         if [ "${CT_EGLIBC_BUNDLED_NSS_CONFIG}" = "y" ]; then
    72             nss_config="${CT_SRC_DIR}/eglibc-${CT_LIBC_VERSION}/nss/fixed-nsswitch.conf"
    73         else
    74             nss_config="${CT_EGLIBC_NSS_CONFIG_FILE}"
    75         fi
    76         CT_TestOrAbort "NSS config file not found!" -n "${nss_config}" -a -f "${nss_config}"
    77 
    78         CT_DoExecLog ALL cp "${nss_config}" "${CT_CONFIG_DIR}/nsswitch.config"
    79         echo "OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG = ${CT_CONFIG_DIR}/nsswitch.config" \
    80             >> "${CT_CONFIG_DIR}/eglibc.config"
    81 
    82         if [ "${CT_EGLIBC_BUNDLED_NSS_FUNCTIONS}" = "y" ]; then
    83             nss_functions="${CT_SRC_DIR}/eglibc-${CT_LIBC_VERSION}/nss/fixed-nsswitch.functions"
    84         else
    85             nss_functions="${CT_EGLIBC_NSS_FUNCTIONS_FILE}"
    86         fi
    87         CT_TestOrAbort "NSS functions file not found!" -n "${nss_functions}" -a -f "${nss_functions}"
    88 
    89         CT_DoExecLog ALL cp "${nss_functions}" "${CT_CONFIG_DIR}/nsswitch.functions"
    90         echo "OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS = ${CT_CONFIG_DIR}/nsswitch.functions" \
    91             >> "${CT_CONFIG_DIR}/eglibc.config"
    92     else
    93         CT_DoLog DEBUG "Using full-blown nsswitch facility"
    94     fi
    95 
    96     CT_EndStep
    97 }