scripts/build/libc/eglibc.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sat Jun 04 17:15:58 2011 +0200 (2011-06-04)
changeset 2504 3fc114996b20
parent 2496 cc9b84a83b34
child 2520 e3523df95b6b
permissions -rw-r--r--
libc/glibc: do not try to download NPTL add-on

The NPTL add-on has always been internal, so there is no
reason to try downloading it, it will never succeed.
Add provision to skip other add-ons as well.

For consistency, do the same test in both glibc and eglibc.

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