1 # eglibc build functions (initially by Thomas JOURDAN).
3 # Add the definitions common to glibc and eglibc
8 . "${CT_LIB_DIR}/scripts/build/libc/glibc-eglibc.sh-common"
10 # Download eglibc repository
14 case "${CT_LIBC_VERSION}" in
15 trunk) svn_url="svn://svn.eglibc.org/trunk";;
16 *) svn_url="svn://svn.eglibc.org/branches/eglibc-${CT_LIBC_VERSION}";;
19 case "${CT_EGLIBC_CHECKOUT}" in
20 y) svn_action="checkout";;
21 *) svn_action="export --force";;
24 CT_DoExecLog ALL svn ${svn_action} -r "${CT_EGLIBC_REVISION:-HEAD}" "${svn_url}" "$(pwd)"
27 CT_DoExecLog ALL mv libc "eglibc-${CT_LIBC_VERSION}"
28 CT_DoExecLog ALL tar cjf "eglibc-${CT_LIBC_VERSION}.tar.bz2" "eglibc-${CT_LIBC_VERSION}"
30 # Compress linuxthreads, localedef and ports
31 # Assign them the name the way ct-ng like it
32 for addon in linuxthreads localedef ports; do
33 CT_DoExecLog ALL mv "${addon}" "eglibc-${addon}-${CT_LIBC_VERSION}"
34 CT_DoExecLog ALL tar cjf "eglibc-${addon}-${CT_LIBC_VERSION}.tar.bz2" "eglibc-${addon}-${CT_LIBC_VERSION}"
40 # eglibc is only available through subversion, there are no
41 # snapshots available. Moreover, addons will be downloaded
45 eglibc="eglibc-${CT_LIBC_VERSION}.tar.bz2"
46 eglibc_linuxthreads="${CT_LIBC}-linuxthreads-${CT_LIBC_VERSION}.tar.bz2"
47 eglibc_localedef="${CT_LIBC}-localedef-${CT_LIBC_VERSION}.tar.bz2"
48 eglibc_ports="${CT_LIBC}-ports-${CT_LIBC_VERSION}.tar.bz2"
50 # Check if every tarballs are already present
51 if [ -f "${CT_TARBALLS_DIR}/${eglibc}" \
52 -a -f "${CT_TARBALLS_DIR}/${eglibc_linuxthreads}" \
53 -a -f "${CT_TARBALLS_DIR}/${eglibc_localedef}" \
54 -a -f "${CT_TARBALLS_DIR}/${eglibc_ports}" \
56 CT_DoLog DEBUG "Already have 'eglibc-${CT_LIBC_VERSION}'"
60 if [ -f "${CT_LOCAL_TARBALLS_DIR}/${eglibc}" \
61 -a -f "${CT_LOCAL_TARBALLS_DIR}/${eglibc_linuxthreads}" \
62 -a -f "${CT_LOCAL_TARBALLS_DIR}/${eglibc_localedef}" \
63 -a -f "${CT_LOCAL_TARBALLS_DIR}/${eglibc_ports}" \
64 -a "${CT_FORCE_DOWNLOAD}" != "y" \
66 CT_DoLog DEBUG "Got 'eglibc-${CT_LIBC_VERSION}' from local storage"
67 for file in ${eglibc} ${eglibc_linuxthreads} ${eglibc_localedef} ${eglibc_ports}; do
68 CT_DoExecLog ALL ln -s "${CT_LOCAL_TARBALLS_DIR}/${file}" "${CT_TARBALLS_DIR}/${file}"
73 # Not found locally, try from the network
74 CT_DoLog EXTRA "Retrieving 'eglibc-${CT_LIBC_VERSION}'"
80 CT_DoLog DEBUG "Moving 'eglibc-${CT_LIBC_VERSION}' to tarball directory"
81 for file in ${eglibc} ${eglibc_linuxthreads} ${eglibc_localedef} ${eglibc_ports}; do
82 CT_DoExecLog ALL mv -f "${file}" "${CT_TARBALLS_DIR}"
88 CT_DoExecLog ALL rm -rf "${tmp_dir}"
90 if [ "${CT_SAVE_TARBALLS}" = "y" ]; then
91 CT_DoLog EXTRA "Saving 'eglibc-${CT_LIBC_VERSION}' to local storage"
92 for file in ${eglibc} ${eglibc_linuxthreads} ${eglibc_localedef} ${eglibc_ports}; do
93 CT_DoExecLog ALL mv -f "${CT_TARBALLS_DIR}/${file}" "${CT_LOCAL_TARBALLS_DIR}"
94 CT_DoExecLog ALL ln -s "${CT_LOCAL_TARBALLS_DIR}/${file}" "${CT_TARBALLS_DIR}/${file}"
103 CT_Extract "eglibc-${CT_LIBC_VERSION}"
104 CT_Patch "eglibc" "${CT_LIBC_VERSION}"
107 for addon in $(do_libc_add_ons_list " "); do
108 # NPTL addon is not to be extracted, in any case
109 [ "${addon}" = "nptl" ] && continue || true
110 CT_Pushd "${CT_SRC_DIR}/eglibc-${CT_LIBC_VERSION}"
111 CT_Extract nochdir "eglibc-${addon}-${CT_LIBC_VERSION}"
112 # Some addons have the 'long' name, while others have the
113 # 'short' name, but patches are non-uniformly built with
114 # either the 'long' or 'short' name, whatever the addons name
115 # so we have to make symlinks from the existing to the missing
116 # Fortunately for us, [ -d foo ], when foo is a symlink to a
117 # directory, returns true!
118 [ -d "${addon}" ] || ln -s "eglibc-${addon}-${CT_LIBC_VERSION}" "${addon}"
119 [ -d "eglibc-${addon}-${CT_LIBC_VERSION}" ] || ln -s "${addon}" "eglibc-${addon}-${CT_LIBC_VERSION}"
120 CT_Patch nochdir "eglibc" "${addon}-${CT_LIBC_VERSION}"
124 # The configure files may be older than the configure.in files
125 # if using a snapshot (or even some tarballs). Fake them being
127 find "${CT_SRC_DIR}/eglibc-${CT_LIBC_VERSION}" -type f -name configure -exec touch {} \; 2>&1 |CT_DoLog ALL
132 # Copy user provided eglibc configuration file if provided
133 do_libc_check_config() {
134 if [ "${CT_EGLIBC_CUSTOM_CONFIG}" != "y" ]; then
138 CT_DoStep INFO "Checking C library configuration"
140 CT_TestOrAbort "You did not provide an eglibc config file!" \
141 -n "${CT_EGLIBC_OPTION_GROUPS_FILE}" -a \
142 -f "${CT_EGLIBC_OPTION_GROUPS_FILE}"
144 CT_DoExecLog ALL cp "${CT_EGLIBC_OPTION_GROUPS_FILE}" "${CT_CONFIG_DIR}/eglibc.config"
147 if grep -E '^OPTION_EGLIBC_NSSWITCH[[:space:]]*=[[:space:]]*n' "${CT_EGLIBC_OPTION_GROUPS_FILE}" >/dev/null 2>&1; then
148 CT_DoLog DEBUG "Using fixed-configuration nsswitch facility"
150 if [ "${CT_EGLIBC_BUNDLED_NSS_CONFIG}" = "y" ]; then
151 nss_config="${CT_SRC_DIR}/eglibc-${CT_LIBC_VERSION}/nss/fixed-nsswitch.conf"
153 nss_config="${CT_EGLIBC_NSS_CONFIG_FILE}"
155 CT_TestOrAbort "NSS config file not found!" -n "${nss_config}" -a -f "${nss_config}"
157 CT_DoExecLog ALL cp "${nss_config}" "${CT_CONFIG_DIR}/nsswitch.config"
158 echo "OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG = ${CT_CONFIG_DIR}/nsswitch.config" \
159 >> "${CT_CONFIG_DIR}/eglibc.config"
161 if [ "${CT_EGLIBC_BUNDLED_NSS_FUNCTIONS}" = "y" ]; then
162 nss_functions="${CT_SRC_DIR}/eglibc-${CT_LIBC_VERSION}/nss/fixed-nsswitch.functions"
164 nss_functions="${CT_EGLIBC_NSS_FUNCTIONS_FILE}"
166 CT_TestOrAbort "NSS functions file not found!" -n "${nss_functions}" -a -f "${nss_functions}"
168 CT_DoExecLog ALL cp "${nss_functions}" "${CT_CONFIG_DIR}/nsswitch.functions"
169 echo "OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS = ${CT_CONFIG_DIR}/nsswitch.functions" \
170 >> "${CT_CONFIG_DIR}/eglibc.config"
172 CT_DoLog DEBUG "Using full-blown nsswitch facility"