scripts/build/libc/eglibc.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Mon May 30 23:05:28 2011 +0200 (2011-05-30)
changeset 2496 cc9b84a83b34
parent 2495 98b02f85db29
child 2504 3fc114996b20
permissions -rw-r--r--
glibc: properly handle internal addons

Some addons are bundled with glibc/eglibc, so we should not try to
download and extract them.

This is done as thus:
- at download time:
- if the add-on download fails, keep going;
- at extract time:
- if the addon is present in the source tree, ignore it;
- if the addon is missing in the source tree:
- if the archive is present, extract it;
- if the archive is missing, bail out.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
     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="svn://svn.eglibc.org"
    18 
    19     case "${CT_LIBC_VERSION}" in
    20         trunk)  svn_base+="/trunk";;
    21         *)      svn_base+="/branches/eglibc-${CT_LIBC_VERSION}";;
    22     esac
    23 
    24     CT_GetSVN "eglibc-${CT_LIBC_VERSION}"   \
    25               "${svn_base}/libc"            \
    26               "${CT_EGLIBC_REVISION:-HEAD}"
    27 
    28     for addon in $(do_libc_add_ons_list " "); do
    29         # NPTL addon is not to be downloaded, in any case
    30         [ "${addon}" = "nptl" ] && continue || true
    31         if ! CT_GetSVN "eglibc-${addon}-${CT_LIBC_VERSION}" \
    32                        "${svn_base}/${addon}"               \
    33                        "${CT_EGLIBC_REVISION:-HEAD}"
    34         then
    35             # Some add-ons are bundled with the main sources
    36             # so failure to download them is expected
    37             CT_DoLog DEBUG "Addon '${addon}' could not be downloaded."
    38             CT_DoLog DEBUG "We'll see later if we can find it in the source tree"
    39         fi
    40     done
    41 }
    42 
    43 # Copy user provided eglibc configuration file if provided
    44 do_libc_check_config() {
    45     if [ "${CT_EGLIBC_CUSTOM_CONFIG}" != "y" ]; then
    46         return 0
    47     fi
    48 
    49     CT_DoStep INFO "Checking C library configuration"
    50 
    51     CT_TestOrAbort "You did not provide an eglibc config file!" \
    52         -n "${CT_EGLIBC_OPTION_GROUPS_FILE}" -a \
    53         -f "${CT_EGLIBC_OPTION_GROUPS_FILE}"
    54 
    55     CT_DoExecLog ALL cp "${CT_EGLIBC_OPTION_GROUPS_FILE}" "${CT_CONFIG_DIR}/eglibc.config"
    56 
    57     # NSS configuration
    58     if grep -E '^OPTION_EGLIBC_NSSWITCH[[:space:]]*=[[:space:]]*n' "${CT_EGLIBC_OPTION_GROUPS_FILE}" >/dev/null 2>&1; then
    59         CT_DoLog DEBUG "Using fixed-configuration nsswitch facility"
    60 
    61         if [ "${CT_EGLIBC_BUNDLED_NSS_CONFIG}" = "y" ]; then
    62             nss_config="${CT_SRC_DIR}/eglibc-${CT_LIBC_VERSION}/nss/fixed-nsswitch.conf"
    63         else
    64             nss_config="${CT_EGLIBC_NSS_CONFIG_FILE}"
    65         fi
    66         CT_TestOrAbort "NSS config file not found!" -n "${nss_config}" -a -f "${nss_config}"
    67 
    68         CT_DoExecLog ALL cp "${nss_config}" "${CT_CONFIG_DIR}/nsswitch.config"
    69         echo "OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG = ${CT_CONFIG_DIR}/nsswitch.config" \
    70             >> "${CT_CONFIG_DIR}/eglibc.config"
    71 
    72         if [ "${CT_EGLIBC_BUNDLED_NSS_FUNCTIONS}" = "y" ]; then
    73             nss_functions="${CT_SRC_DIR}/eglibc-${CT_LIBC_VERSION}/nss/fixed-nsswitch.functions"
    74         else
    75             nss_functions="${CT_EGLIBC_NSS_FUNCTIONS_FILE}"
    76         fi
    77         CT_TestOrAbort "NSS functions file not found!" -n "${nss_functions}" -a -f "${nss_functions}"
    78 
    79         CT_DoExecLog ALL cp "${nss_functions}" "${CT_CONFIG_DIR}/nsswitch.functions"
    80         echo "OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS = ${CT_CONFIG_DIR}/nsswitch.functions" \
    81             >> "${CT_CONFIG_DIR}/eglibc.config"
    82     else
    83         CT_DoLog DEBUG "Using full-blown nsswitch facility"
    84     fi
    85 
    86     CT_EndStep
    87 }