Get rid of CT_LIBC_FILE, remove useless CT_MakeAbsolutePath.
CT_LIBC_FILE:
- that one was not easy, as it had sneaked into CT_ExtractAndPatch
- which in turn made CT_ExtractAndPatch have references to C library addons
- which in turn relieved the C library _extract functions from doing their own job
- which in turn imposed some nasty tricks in CT_ExtractAndPatch
- which in turn made life easier for the DUMA _get and _extract functions
- which unveiled some bizare behavior for pushd and popd:
- if using smthg ike: 'pushd foo |bar':
- the directory is *neither* changed
- *nor* is it pushed onto the stack
- which made popd fail
CT_MakeAbsolutePath:
- used only to make CT_LOCAL_TARBALLS_DIR canonical
- which is ((almost) useless:
- hopefully, the user entered a full path already
- if it's not the case, too bad...
/trunk/scripts/build/debug/200-duma.sh | 5 1 4 0 +--
/trunk/scripts/build/libc/glibc.sh | 61 32 29 0 +++++++++++++++++---------------
/trunk/scripts/build/libc/uClibc.sh | 16 10 6 0 +++++---
/trunk/scripts/build/libc/eglibc.sh | 48 26 22 0 ++++++++++++++-----------
/trunk/scripts/crosstool.sh | 8 0 8 0 ----
/trunk/scripts/functions | 77 15 62 0 ++++++++--------------------------------
6 files changed, 84 insertions(+), 131 deletions(-)
1 # eglibc build functions (initially by Thomas JOURDAN).
3 # Download eglibc repository
7 case "${CT_LIBC_VERSION}" in
8 trunk) svn_url="svn://svn.eglibc.org/trunk";;
9 *) svn_url="svn://svn.eglibc.org/branches/eglibc-${CT_LIBC_VERSION}";;
12 case "${CT_EGLIBC_CHECKOUT}" in
13 y) svn_action="checkout";;
14 *) svn_action="export --force";;
17 CT_DoSetProxy ${CT_PROXY_TYPE}
18 CT_DoExecLog ALL svn ${svn_action} -r "${CT_EGLIBC_REVISION:-HEAD}" "${svn_url}" . 2>&1
21 CT_DoExecLog ALL mv libc "eglibc-${CT_LIBC_VERSION}"
22 CT_DoExecLog ALL tar cjf "eglibc-${CT_LIBC_VERSION}.tar.bz2" "eglibc-${CT_LIBC_VERSION}"
24 # Compress linuxthreads, localedef and ports
25 # Assign them the name the way ct-ng like it
26 for addon in linuxthreads localedef ports; do
27 CT_DoExecLog ALL mv "${addon}" "eglibc-${addon}-${CT_LIBC_VERSION}"
28 CT_DoExecLog ALL tar cjf "eglibc-${addon}-${CT_LIBC_VERSION}.tar.bz2" "eglibc-${addon}-${CT_LIBC_VERSION}"
34 # eglibc is only available through subversion, there are no
35 # snapshots available. Moreover, addons will be downloaded
39 eglibc="eglibc-${CT_LIBC_VERSION}.tar.bz2"
40 eglibc_linuxthreads="${CT_LIBC}-linuxthreads-${CT_LIBC_VERSION}.tar.bz2"
41 eglibc_localedef="${CT_LIBC}-localedef-${CT_LIBC_VERSION}.tar.bz2"
42 eglibc_ports="${CT_LIBC}-ports-${CT_LIBC_VERSION}.tar.bz2"
44 # Check if every tarballs are already present
45 if [ -a "${CT_TARBALLS_DIR}/${eglibc}" ] && \
46 [ -a "${CT_TARBALLS_DIR}/${eglibc_linuxthreads}" ] && \
47 [ -a "${CT_TARBALLS_DIR}/${eglibc_localedef}" ] && \
48 [ -a "${CT_TARBALLS_DIR}/${eglibc_ports}" ]; then
49 CT_DoLog DEBUG "Already have 'eglibc-${CT_LIBC_VERSION}'"
53 if [ -a "${CT_LOCAL_TARBALLS_DIR}/${eglibc}" ] && \
54 [ -a "${CT_LOCAL_TARBALLS_DIR}/${eglibc_linuxthreads}" ] && \
55 [ -a "${CT_LOCAL_TARBALLS_DIR}/${eglibc_localedef}" ] && \
56 [ -a "${CT_LOCAL_TARBALLS_DIR}/${eglibc_ports}" ] && \
57 [ "${CT_FORCE_DOWNLOAD}" != "y" ]; then
58 CT_DoLog DEBUG "Got 'eglibc-${CT_LIBC_VERSION}' from local storage"
59 for file in ${eglibc} ${eglibc_linuxthreads} ${eglibc_localedef} ${eglibc_ports}; do
60 CT_DoExecLog ALL ln -s "${CT_LOCAL_TARBALLS_DIR}/${file}" "${CT_TARBALLS_DIR}/${file}"
65 # Not found locally, try from the network
66 CT_DoLog EXTRA "Retrieving 'eglibc-${CT_LIBC_VERSION}'"
72 CT_DoLog DEBUG "Moving 'eglibc-${CT_LIBC_VERSION}' to tarball directory"
73 for file in ${eglibc} ${eglibc_linuxthreads} ${eglibc_localedef} ${eglibc_ports}; do
74 CT_DoExecLog ALL mv -f "${file}" "${CT_TARBALLS_DIR}"
80 CT_DoExecLog ALL rm -rf "${tmp_dir}"
82 if [ "${CT_SAVE_TARBALLS}" = "y" ]; then
83 CT_DoLog EXTRA "Saving 'eglibc-${CT_LIBC_VERSION}' to local storage"
84 for file in ${eglibc} ${eglibc_linuxthreads} ${eglibc_localedef} ${eglibc_ports}; do
85 CT_DoExecLog ALL mv -f "${CT_TARBALLS_DIR}/${file}" "${CT_LOCAL_TARBALLS_DIR}"
86 CT_DoExecLog ALL ln -s "${CT_LOCAL_TARBALLS_DIR}/${file}" "${CT_TARBALLS_DIR}/${file}"
95 CT_ExtractAndPatch "eglibc-${CT_LIBC_VERSION}"
98 for addon in $(do_libc_add_ons_list " "); do
99 # NPTL addon is not to be extracted, in any case
100 [ "${addon}" = "nptl" ] && continue || true
101 CT_Pushd "${CT_SRC_DIR}/eglibc-${CT_LIBC_VERSION}"
102 CT_ExtractAndPatch "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}" nochdir
103 [ ! -d "${addon}" ] && ln -s "eglibc-${addon}-${CT_LIBC_VERSION}" "${addon}"
107 # The configure files may be older than the configure.in files
108 # if using a snapshot (or even some tarballs). Fake them being
110 find "${CT_SRC_DIR}/eglibc-${CT_LIBC_VERSION}" -type f -name configure -exec touch {} \; 2>&1 |CT_DoLog ALL
115 # There is nothing to do for eglibc check config
116 do_libc_check_config() {
120 # This function installs the eglibc headers needed to build the core compiler
122 # Instead of doing two time the same actions, headers will
123 # be installed with start files
127 # Build and install start files
128 do_libc_start_files() {
129 CT_DoStep INFO "Installing C library headers / start files"
131 mkdir -p "${CT_BUILD_DIR}/build-libc-startfiles"
132 cd "${CT_BUILD_DIR}/build-libc-startfiles"
134 CT_DoLog EXTRA "Configuring C library"
136 cross_cc=$(CT_Which "${CT_TARGET}-gcc")
137 cross_cxx=$(CT_Which "${CT_TARGET}-g++")
138 cross_ar=$(CT_Which "${CT_TARGET}-ar")
139 cross_ranlib=$(CT_Which "${CT_TARGET}-ranlib")
141 CT_DoLog DEBUG "Using gcc for target: '${cross_cc}'"
142 CT_DoLog DEBUG "Using g++ for target: '${cross_cxx}'"
143 CT_DoLog DEBUG "Using ar for target: '${cross_ar}'"
144 CT_DoLog DEBUG "Using ranlib for target: '${cross_ranlib}'"
146 BUILD_CC="${CT_BUILD}-gcc" \
150 RANLIB=${cross_ranlib} \
152 "${CT_SRC_DIR}/eglibc-${CT_LIBC_VERSION}/configure" \
154 --with-headers="${CT_HEADERS_DIR}" \
155 --build="${CT_BUILD}" \
156 --host="${CT_TARGET}" \
162 CT_DoLog EXTRA "Installing C library headers"
164 # use the 'install-headers' makefile target to install the
168 make install-headers \
169 install_root=${CT_SYSROOT_DIR} \
170 install-bootstrap-headers=yes
172 CT_DoLog EXTRA "Installing C library start files"
174 # there are a few object files needed to link shared libraries,
175 # which we build and install by hand
177 CT_DoExecLog ALL mkdir -p ${CT_SYSROOT_DIR}/usr/lib
178 CT_DoExecLog ALL make csu/subdir_lib
179 CT_DoExecLog ALL cp csu/crt1.o csu/crti.o csu/crtn.o \
180 ${CT_SYSROOT_DIR}/usr/lib
182 # Finally, 'libgcc_s.so' requires a 'libc.so' to link against.
183 # However, since we will never actually execute its code,
184 # it doesn't matter what it contains. So, treating '/dev/null'
185 # as a C source file, we produce a dummy 'libc.so' in one step
187 CT_DoExecLog ALL ${cross_cc} -nostdlib -nostartfiles -shared -x c /dev/null -o ${CT_SYSROOT_DIR}/usr/lib/libc.so
192 # This function builds and install the full glibc
194 CT_DoStep INFO "Installing C library"
196 mkdir -p "${CT_BUILD_DIR}/build-libc"
197 cd "${CT_BUILD_DIR}/build-libc"
199 CT_DoLog EXTRA "Configuring C library"
201 # Add some default glibc config options if not given by user.
202 # We don't need to be conditional on wether the user did set different
203 # values, as they CT_LIBC_GLIBC_EXTRA_CONFIG is passed after extra_config
205 extra_config="--enable-kernel=$(echo ${CT_LIBC_GLIBC_MIN_KERNEL} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')"
207 case "${CT_THREADS}" in
208 nptl) extra_config="${extra_config} --with-__thread --with-tls";;
209 linuxthreads) extra_config="${extra_config} --with-__thread --without-tls --without-nptl";;
210 none) extra_config="${extra_config} --without-__thread --without-nptl"
211 case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in
213 *) extra_config="${extra_config} --without-tls";;
218 case "${CT_SHARED_LIBS}" in
219 y) extra_config="${extra_config} --enable-shared";;
220 *) extra_config="${extra_config} --disable-shared";;
223 case "${CT_ARCH_FLOAT_HW},${CT_ARCH_FLOAT_SW}" in
224 y,) extra_config="${extra_config} --with-fp";;
225 ,y) extra_config="${extra_config} --without-fp";;
228 case "$(do_libc_add_ons_list ,)" in
230 *) extra_config="${extra_config} --enable-add-ons=$(do_libc_add_ons_list ,)";;
233 extra_cc_args="${extra_cc_args} ${CT_ARCH_ENDIAN_OPT}"
235 cross_cc=$(CT_Which "${CT_TARGET}-gcc")
237 CT_DoLog DEBUG "Using gcc for target: '${cross_cc}'"
238 CT_DoLog DEBUG "Configuring with addons : '$(do_libc_add_ons_list ,)'"
239 CT_DoLog DEBUG "Extra config args passed: '${extra_config}'"
240 CT_DoLog DEBUG "Extra CC args passed : '${extra_cc_args}'"
242 BUILD_CC="${CT_BUILD}-gcc" \
243 CFLAGS="${CT_TARGET_CFLAGS} ${CT_LIBC_GLIBC_EXTRA_CFLAGS} -O" \
244 CC="${CT_TARGET}-gcc ${CT_LIBC_EXTRA_CC_ARGS} ${extra_cc_args}" \
246 RANLIB=${CT_TARGET}-ranlib \
248 "${CT_SRC_DIR}/eglibc-${CT_LIBC_VERSION}/configure" \
250 --with-headers="${CT_HEADERS_DIR}" \
251 --build=${CT_BUILD} \
252 --host=${CT_TARGET} \
257 ${CT_LIBC_GLIBC_EXTRA_CONFIG}
259 CT_DoLog EXTRA "Building C library"
261 CT_DoExecLog ALL make
263 CT_DoLog EXTRA "Installing C library"
265 CT_DoExecLog ALL make install install_root="${CT_SYSROOT_DIR}"
270 # This function finishes the glibc install
272 # Nothing to be done for eglibc
276 # Build up the addons list, separated with $1
277 do_libc_add_ons_list() {
279 local addons_list=$(echo "${CT_LIBC_ADDONS_LIST//,/${sep}}" |tr -s ,)
280 case "${CT_THREADS}" in
282 *) addons_list="${addons_list}${sep}${CT_THREADS}";;
284 [ "${CT_LIBC_GLIBC_USE_PORTS}" = "y" ] && addons_list="${addons_list}${sep}ports"
285 addons_list="${addons_list%%${sep}}"
286 echo "${addons_list##${sep}}"