1 # eglibc build functions (initially by Thomas JOURDAN).
3 # Add the definitions common to glibc and eglibc
9 # do_libc_min_kernel_config
10 . "${CT_LIB_DIR}/scripts/build/libc/glibc-eglibc.sh-common"
12 # Download eglibc repository
16 case "${CT_LIBC_VERSION}" in
17 trunk) svn_url="svn://svn.eglibc.org/trunk";;
18 *) svn_url="svn://svn.eglibc.org/branches/eglibc-${CT_LIBC_VERSION}";;
21 case "${CT_EGLIBC_CHECKOUT}" in
22 y) svn_action="checkout";;
23 *) svn_action="export --force";;
26 CT_DoExecLog ALL svn ${svn_action} -r "${CT_EGLIBC_REVISION:-HEAD}" "${svn_url}" "$(pwd)"
29 CT_DoExecLog ALL mv libc "eglibc-${CT_LIBC_VERSION}"
30 CT_DoExecLog ALL tar cjf "eglibc-${CT_LIBC_VERSION}.tar.bz2" "eglibc-${CT_LIBC_VERSION}"
32 # Compress linuxthreads, localedef and ports
33 # Assign them the name the way ct-ng like it
34 for addon in linuxthreads localedef ports; do
35 CT_DoExecLog ALL mv "${addon}" "eglibc-${addon}-${CT_LIBC_VERSION}"
36 CT_DoExecLog ALL tar cjf "eglibc-${addon}-${CT_LIBC_VERSION}.tar.bz2" "eglibc-${addon}-${CT_LIBC_VERSION}"
42 # eglibc is only available through subversion, there are no
43 # snapshots available. Moreover, addons will be downloaded
47 eglibc="eglibc-${CT_LIBC_VERSION}.tar.bz2"
48 eglibc_linuxthreads="${CT_LIBC}-linuxthreads-${CT_LIBC_VERSION}.tar.bz2"
49 eglibc_localedef="${CT_LIBC}-localedef-${CT_LIBC_VERSION}.tar.bz2"
50 eglibc_ports="${CT_LIBC}-ports-${CT_LIBC_VERSION}.tar.bz2"
52 # Check if every tarballs are already present
53 if [ -f "${CT_TARBALLS_DIR}/${eglibc}" \
54 -a -f "${CT_TARBALLS_DIR}/${eglibc_linuxthreads}" \
55 -a -f "${CT_TARBALLS_DIR}/${eglibc_localedef}" \
56 -a -f "${CT_TARBALLS_DIR}/${eglibc_ports}" \
58 CT_DoLog DEBUG "Already have 'eglibc-${CT_LIBC_VERSION}'"
62 if [ -f "${CT_LOCAL_TARBALLS_DIR}/${eglibc}" \
63 -a -f "${CT_LOCAL_TARBALLS_DIR}/${eglibc_linuxthreads}" \
64 -a -f "${CT_LOCAL_TARBALLS_DIR}/${eglibc_localedef}" \
65 -a -f "${CT_LOCAL_TARBALLS_DIR}/${eglibc_ports}" \
66 -a "${CT_FORCE_DOWNLOAD}" != "y" \
68 CT_DoLog DEBUG "Got 'eglibc-${CT_LIBC_VERSION}' from local storage"
69 for file in ${eglibc} ${eglibc_linuxthreads} ${eglibc_localedef} ${eglibc_ports}; do
70 CT_DoExecLog ALL ln -s "${CT_LOCAL_TARBALLS_DIR}/${file}" "${CT_TARBALLS_DIR}/${file}"
75 # Not found locally, try from the network
76 CT_DoLog EXTRA "Retrieving 'eglibc-${CT_LIBC_VERSION}'"
82 CT_DoLog DEBUG "Moving 'eglibc-${CT_LIBC_VERSION}' to tarball directory"
83 for file in ${eglibc} ${eglibc_linuxthreads} ${eglibc_localedef} ${eglibc_ports}; do
84 CT_DoExecLog ALL mv -f "${file}" "${CT_TARBALLS_DIR}"
90 CT_DoExecLog ALL rm -rf "${tmp_dir}"
92 if [ "${CT_SAVE_TARBALLS}" = "y" ]; then
93 CT_DoLog EXTRA "Saving 'eglibc-${CT_LIBC_VERSION}' to local storage"
94 for file in ${eglibc} ${eglibc_linuxthreads} ${eglibc_localedef} ${eglibc_ports}; do
95 CT_DoExecLog ALL mv -f "${CT_TARBALLS_DIR}/${file}" "${CT_LOCAL_TARBALLS_DIR}"
96 CT_DoExecLog ALL ln -s "${CT_LOCAL_TARBALLS_DIR}/${file}" "${CT_TARBALLS_DIR}/${file}"
103 # Copy user provided eglibc configuration file if provided
104 do_libc_check_config() {
105 if [ "${CT_EGLIBC_CUSTOM_CONFIG}" != "y" ]; then
109 CT_DoStep INFO "Checking C library configuration"
111 CT_TestOrAbort "You did not provide an eglibc config file!" \
112 -n "${CT_EGLIBC_OPTION_GROUPS_FILE}" -a \
113 -f "${CT_EGLIBC_OPTION_GROUPS_FILE}"
115 CT_DoExecLog ALL cp "${CT_EGLIBC_OPTION_GROUPS_FILE}" "${CT_CONFIG_DIR}/eglibc.config"
118 if grep -E '^OPTION_EGLIBC_NSSWITCH[[:space:]]*=[[:space:]]*n' "${CT_EGLIBC_OPTION_GROUPS_FILE}" >/dev/null 2>&1; then
119 CT_DoLog DEBUG "Using fixed-configuration nsswitch facility"
121 if [ "${CT_EGLIBC_BUNDLED_NSS_CONFIG}" = "y" ]; then
122 nss_config="${CT_SRC_DIR}/eglibc-${CT_LIBC_VERSION}/nss/fixed-nsswitch.conf"
124 nss_config="${CT_EGLIBC_NSS_CONFIG_FILE}"
126 CT_TestOrAbort "NSS config file not found!" -n "${nss_config}" -a -f "${nss_config}"
128 CT_DoExecLog ALL cp "${nss_config}" "${CT_CONFIG_DIR}/nsswitch.config"
129 echo "OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG = ${CT_CONFIG_DIR}/nsswitch.config" \
130 >> "${CT_CONFIG_DIR}/eglibc.config"
132 if [ "${CT_EGLIBC_BUNDLED_NSS_FUNCTIONS}" = "y" ]; then
133 nss_functions="${CT_SRC_DIR}/eglibc-${CT_LIBC_VERSION}/nss/fixed-nsswitch.functions"
135 nss_functions="${CT_EGLIBC_NSS_FUNCTIONS_FILE}"
137 CT_TestOrAbort "NSS functions file not found!" -n "${nss_functions}" -a -f "${nss_functions}"
139 CT_DoExecLog ALL cp "${nss_functions}" "${CT_CONFIG_DIR}/nsswitch.functions"
140 echo "OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS = ${CT_CONFIG_DIR}/nsswitch.functions" \
141 >> "${CT_CONFIG_DIR}/eglibc.config"
143 CT_DoLog DEBUG "Using full-blown nsswitch facility"