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.1 --- a/scripts/build/debug/200-duma.sh Sun Jan 04 14:39:39 2009 +0000
1.2 +++ b/scripts/build/debug/200-duma.sh Sun Jan 04 22:17:53 2009 +0000
1.3 @@ -16,15 +16,12 @@
1.4
1.5 do_debug_duma_extract() {
1.6 CT_ExtractAndPatch "duma-${CT_DUMA_VERSION}"
1.7 - cd "${CT_SRC_DIR}"
1.8 - rm -f "duma-${CT_DUMA_VERSION}"
1.9 - ln -sf "duma_${CT_DUMA_VERSION}" "duma-${CT_DUMA_VERSION}"
1.10 }
1.11
1.12 do_debug_duma_build() {
1.13 CT_DoStep INFO "Installing D.U.M.A."
1.14 CT_DoLog EXTRA "Copying sources"
1.15 - cp -a "${CT_SRC_DIR}/duma_${CT_DUMA_VERSION}" "${CT_BUILD_DIR}/build-duma"
1.16 + cp -a "${CT_SRC_DIR}/duma-${CT_DUMA_VERSION}" "${CT_BUILD_DIR}/build-duma"
1.17 CT_Pushd "${CT_BUILD_DIR}/build-duma"
1.18
1.19 DUMA_CPP=
2.1 --- a/scripts/build/libc/eglibc.sh Sun Jan 04 14:39:39 2009 +0000
2.2 +++ b/scripts/build/libc/eglibc.sh Sun Jan 04 22:17:53 2009 +0000
2.3 @@ -18,13 +18,14 @@
2.4 CT_DoExecLog ALL svn ${svn_action} -r "${CT_EGLIBC_REVISION:-HEAD}" "${svn_url}" . 2>&1
2.5
2.6 # Compress eglibc
2.7 - CT_DoExecLog ALL mv libc "${CT_LIBC_FILE}"
2.8 - CT_DoExecLog ALL tar cjf "${CT_LIBC_FILE}.tar.bz2" "${CT_LIBC_FILE}"
2.9 + CT_DoExecLog ALL mv libc "eglibc-${CT_LIBC_VERSION}"
2.10 + CT_DoExecLog ALL tar cjf "eglibc-${CT_LIBC_VERSION}.tar.bz2" "eglibc-${CT_LIBC_VERSION}"
2.11
2.12 # Compress linuxthreads, localedef and ports
2.13 # Assign them the name the way ct-ng like it
2.14 for addon in linuxthreads localedef ports; do
2.15 - CT_DoExecLog ALL tar cjf "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}.tar.bz2" "${addon}"
2.16 + CT_DoExecLog ALL mv "${addon}" "eglibc-${addon}-${CT_LIBC_VERSION}"
2.17 + CT_DoExecLog ALL tar cjf "eglibc-${addon}-${CT_LIBC_VERSION}.tar.bz2" "eglibc-${addon}-${CT_LIBC_VERSION}"
2.18 done
2.19 }
2.20
2.21 @@ -35,7 +36,7 @@
2.22 # simultaneously.
2.23
2.24 # build filename
2.25 - eglibc="${CT_LIBC_FILE}.tar.bz2"
2.26 + eglibc="eglibc-${CT_LIBC_VERSION}.tar.bz2"
2.27 eglibc_linuxthreads="${CT_LIBC}-linuxthreads-${CT_LIBC_VERSION}.tar.bz2"
2.28 eglibc_localedef="${CT_LIBC}-localedef-${CT_LIBC_VERSION}.tar.bz2"
2.29 eglibc_ports="${CT_LIBC}-ports-${CT_LIBC_VERSION}.tar.bz2"
2.30 @@ -91,19 +92,22 @@
2.31
2.32 # Extract eglibc
2.33 do_libc_extract() {
2.34 - CT_ExtractAndPatch "${CT_LIBC_FILE}"
2.35 + CT_ExtractAndPatch "eglibc-${CT_LIBC_VERSION}"
2.36
2.37 # C library addons
2.38 for addon in $(do_libc_add_ons_list " "); do
2.39 # NPTL addon is not to be extracted, in any case
2.40 [ "${addon}" = "nptl" ] && continue || true
2.41 - CT_ExtractAndPatch "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}"
2.42 + CT_Pushd "${CT_SRC_DIR}/eglibc-${CT_LIBC_VERSION}"
2.43 + CT_ExtractAndPatch "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}" nochdir
2.44 + [ ! -d "${addon}" ] && ln -s "eglibc-${addon}-${CT_LIBC_VERSION}" "${addon}"
2.45 + CT_Popd
2.46 done
2.47
2.48 # The configure files may be older than the configure.in files
2.49 # if using a snapshot (or even some tarballs). Fake them being
2.50 # up to date.
2.51 - find "${CT_SRC_DIR}/${CT_LIBC_FILE}" -type f -name configure -exec touch {} \; 2>&1 |CT_DoLog ALL
2.52 + find "${CT_SRC_DIR}/eglibc-${CT_LIBC_VERSION}" -type f -name configure -exec touch {} \; 2>&1 |CT_DoLog ALL
2.53
2.54 return 0
2.55 }
2.56 @@ -139,20 +143,20 @@
2.57 CT_DoLog DEBUG "Using ar for target: '${cross_ar}'"
2.58 CT_DoLog DEBUG "Using ranlib for target: '${cross_ranlib}'"
2.59
2.60 - BUILD_CC="${CT_BUILD}-gcc" \
2.61 - CC=${cross_cc} \
2.62 - CXX=${cross_cxx} \
2.63 - AR=${cross_ar} \
2.64 - RANLIB=${cross_ranlib} \
2.65 - CT_DoExecLog ALL \
2.66 - "${CT_SRC_DIR}/${CT_LIBC_FILE}/configure" \
2.67 - --prefix=/usr \
2.68 - --with-headers="${CT_HEADERS_DIR}" \
2.69 - --build="${CT_BUILD}" \
2.70 - --host="${CT_TARGET}" \
2.71 - --disable-profile \
2.72 - --without-gd \
2.73 - --without-cvs \
2.74 + BUILD_CC="${CT_BUILD}-gcc" \
2.75 + CC=${cross_cc} \
2.76 + CXX=${cross_cxx} \
2.77 + AR=${cross_ar} \
2.78 + RANLIB=${cross_ranlib} \
2.79 + CT_DoExecLog ALL \
2.80 + "${CT_SRC_DIR}/eglibc-${CT_LIBC_VERSION}/configure" \
2.81 + --prefix=/usr \
2.82 + --with-headers="${CT_HEADERS_DIR}" \
2.83 + --build="${CT_BUILD}" \
2.84 + --host="${CT_TARGET}" \
2.85 + --disable-profile \
2.86 + --without-gd \
2.87 + --without-cvs \
2.88 --enable-add-ons
2.89
2.90 CT_DoLog EXTRA "Installing C library headers"
2.91 @@ -241,7 +245,7 @@
2.92 AR=${CT_TARGET}-ar \
2.93 RANLIB=${CT_TARGET}-ranlib \
2.94 CT_DoExecLog ALL \
2.95 - "${CT_SRC_DIR}/${CT_LIBC_FILE}/configure" \
2.96 + "${CT_SRC_DIR}/eglibc-${CT_LIBC_VERSION}/configure" \
2.97 --prefix=/usr \
2.98 --with-headers="${CT_HEADERS_DIR}" \
2.99 --build=${CT_BUILD} \
3.1 --- a/scripts/build/libc/glibc.sh Sun Jan 04 14:39:39 2009 +0000
3.2 +++ b/scripts/build/libc/glibc.sh Sun Jan 04 22:17:53 2009 +0000
3.3 @@ -16,11 +16,11 @@
3.4 if [ "${CT_LIBC_GLIBC_2_8_or_later}" = "y" ]; then
3.5 # No release tarball available...
3.6 date="${CT_LIBC_GLIBC_CVS_date}"
3.7 - CT_GetCVS "${CT_LIBC_FILE}" \
3.8 + CT_GetCVS "glibc-${CT_LIBC_VERSION}" \
3.9 ":pserver:anoncvs@sources.redhat.com:/cvs/glibc" \
3.10 "libc" \
3.11 "glibc-${CT_LIBC_VERSION}-branch${date:+:}${date}" \
3.12 - "${CT_LIBC_FILE}"
3.13 + "glibc-${CT_LIBC_VERSION}"
3.14
3.15 # C library addons
3.16 for addon in $(do_libc_add_ons_list " "); do
3.17 @@ -34,7 +34,7 @@
3.18 done
3.19 else
3.20 # Release tarballs are available
3.21 - CT_GetFile "${CT_LIBC_FILE}" \
3.22 + CT_GetFile "glibc-${CT_LIBC_VERSION}" \
3.23 {ftp,http}://ftp.gnu.org/gnu/glibc \
3.24 ftp://gcc.gnu.org/pub/glibc/releases \
3.25 ftp://gcc.gnu.org/pub/glibc/snapshots
3.26 @@ -43,7 +43,7 @@
3.27 for addon in $(do_libc_add_ons_list " "); do
3.28 # NPTL addon is not to be downloaded, in any case
3.29 [ "${addon}" = "nptl" ] && continue || true
3.30 - CT_GetFile "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}" \
3.31 + CT_GetFile "glibc-${addon}-${CT_LIBC_VERSION}" \
3.32 {ftp,http}://ftp.gnu.org/gnu/glibc \
3.33 ftp://gcc.gnu.org/pub/glibc/releases \
3.34 ftp://gcc.gnu.org/pub/glibc/snapshots
3.35 @@ -55,19 +55,22 @@
3.36
3.37 # Extract glibc
3.38 do_libc_extract() {
3.39 - CT_ExtractAndPatch "${CT_LIBC_FILE}"
3.40 + CT_ExtractAndPatch "glibc-${CT_LIBC_VERSION}"
3.41
3.42 # C library addons
3.43 for addon in $(do_libc_add_ons_list " "); do
3.44 # NPTL addon is not to be extracted, in any case
3.45 [ "${addon}" = "nptl" ] && continue || true
3.46 - CT_ExtractAndPatch "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}"
3.47 + CT_Pushd "${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}"
3.48 + CT_ExtractAndPatch "glibc-${addon}-${CT_LIBC_VERSION}" nochdir
3.49 + [ ! -d "${addon}" ] && ln -s "glibc-${addon}-${CT_LIBC_VERSION}" "${addon}"
3.50 + CT_Popd
3.51 done
3.52
3.53 # The configure files may be older than the configure.in files
3.54 # if using a snapshot (or even some tarballs). Fake them being
3.55 # up to date.
3.56 - find "${CT_SRC_DIR}/${CT_LIBC_FILE}" -type f -name configure -exec touch {} \; 2>&1 |CT_DoLog ALL
3.57 + find "${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}" -type f -name configure -exec touch {} \; 2>&1 |CT_DoLog ALL
3.58
3.59 return 0
3.60 }
3.61 @@ -115,23 +118,23 @@
3.62 CT_DoLog DEBUG "Using gcc for target: '${cross_cc}'"
3.63 CT_DoLog DEBUG "Extra config passed : '${extra_config}'"
3.64
3.65 - libc_cv_ppc_machine=yes \
3.66 - CC=${cross_cc} \
3.67 - CT_DoExecLog ALL \
3.68 - "${CT_SRC_DIR}/${CT_LIBC_FILE}/configure" \
3.69 - --build="${CT_BUILD}" \
3.70 - --host="${CT_TARGET}" \
3.71 - --prefix=/usr \
3.72 - --with-headers="${CT_HEADERS_DIR}" \
3.73 - --without-cvs \
3.74 - --disable-sanity-checks \
3.75 - --enable-hacker-mode \
3.76 - ${extra_config} \
3.77 + libc_cv_ppc_machine=yes \
3.78 + CC=${cross_cc} \
3.79 + CT_DoExecLog ALL \
3.80 + "${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/configure" \
3.81 + --build="${CT_BUILD}" \
3.82 + --host="${CT_TARGET}" \
3.83 + --prefix=/usr \
3.84 + --with-headers="${CT_HEADERS_DIR}" \
3.85 + --without-cvs \
3.86 + --disable-sanity-checks \
3.87 + --enable-hacker-mode \
3.88 + ${extra_config} \
3.89 --without-nptl
3.90
3.91 CT_DoLog EXTRA "Installing C library headers"
3.92
3.93 - if grep -q GLIBC_2.3 "${CT_SRC_DIR}/${CT_LIBC_FILE}/ChangeLog"; then
3.94 + if grep -q GLIBC_2.3 "${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/ChangeLog"; then
3.95 # glibc-2.3.x passes cross options to $(CC) when generating errlist-compat.c,
3.96 # which fails without a real cross-compiler.
3.97 # Fortunately, we don't need errlist-compat.c, since we just need .h
3.98 @@ -172,7 +175,7 @@
3.99 # See e.g. http://gcc.gnu.org/ml/gcc/2002-01/msg00900.html
3.100 mkdir -p "${CT_HEADERS_DIR}/gnu"
3.101 CT_DoExecLog ALL touch "${CT_HEADERS_DIR}/gnu/stubs.h"
3.102 - CT_DoExecLog ALL cp -v "${CT_SRC_DIR}/${CT_LIBC_FILE}/include/features.h" \
3.103 + CT_DoExecLog ALL cp -v "${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/include/features.h" \
3.104 "${CT_HEADERS_DIR}/features.h"
3.105
3.106 # Building the bootstrap gcc requires either setting inhibit_libc, or
3.107 @@ -187,20 +190,20 @@
3.108 [ "${CT_ARCH}" != "arm" ] && CT_DoExecLog ALL cp -v misc/syscall-list.h "${CT_HEADERS_DIR}/bits/syscall.h" || true
3.109
3.110 # Those headers are to be manually copied so gcc can build properly
3.111 - pthread_h="${CT_SRC_DIR}/${CT_LIBC_FILE}/${CT_THREADS}/sysdeps/pthread/pthread.h"
3.112 + pthread_h="${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/${CT_THREADS}/sysdeps/pthread/pthread.h"
3.113 pthreadtypes_h=
3.114 case "${CT_THREADS}" in
3.115 nptl)
3.116 # NOTE: for some archs, the pathes are different, but they are not
3.117 # supported by crosstool-NG right now. See original crosstool when they are.
3.118 - pthread_h="${CT_SRC_DIR}/${CT_LIBC_FILE}/${CT_THREADS}/sysdeps/pthread/pthread.h"
3.119 - pthreadtypes_h="${CT_SRC_DIR}/${CT_LIBC_FILE}/nptl/sysdeps/unix/sysv/linux/${CT_KERNEL_ARCH}/bits/pthreadtypes.h"
3.120 + pthread_h="${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/${CT_THREADS}/sysdeps/pthread/pthread.h"
3.121 + pthreadtypes_h="${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/nptl/sysdeps/unix/sysv/linux/${CT_KERNEL_ARCH}/bits/pthreadtypes.h"
3.122 if [ ! -f "${pthreadtypes_h}" ]; then
3.123 - pthreadtypes_h="${CT_SRC_DIR}/${CT_LIBC_FILE}/${CT_LIBC}-ports-${CT_LIBC_VERSION}/sysdeps/unix/sysv/linux/${CT_KERNEL_ARCH}/nptl/bits/pthreadtypes.h"
3.124 + pthreadtypes_h="${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/ports/sysdeps/unix/sysv/linux/${CT_KERNEL_ARCH}/nptl/bits/pthreadtypes.h"
3.125 fi
3.126 ;;
3.127 linuxthreads)
3.128 - pthreadtypes_h="${CT_SRC_DIR}/${CT_LIBC_FILE}/linuxthreads/sysdeps/pthread/bits/pthreadtypes.h"
3.129 + pthreadtypes_h="${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/linuxthreads/sysdeps/pthread/bits/pthreadtypes.h"
3.130 ;;
3.131 *)
3.132 pthread_h=
3.133 @@ -292,7 +295,7 @@
3.134 AR=${CT_TARGET}-ar \
3.135 RANLIB=${CT_TARGET}-ranlib \
3.136 CT_DoExecLog ALL \
3.137 - "${CT_SRC_DIR}/${CT_LIBC_FILE}/configure" \
3.138 + "${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/configure" \
3.139 --prefix=/usr \
3.140 --build="${CT_BUILD}" \
3.141 --host=${CT_TARGET} \
3.142 @@ -420,7 +423,7 @@
3.143 AR=${CT_TARGET}-ar \
3.144 RANLIB=${CT_TARGET}-ranlib \
3.145 CT_DoExecLog ALL \
3.146 - "${CT_SRC_DIR}/${CT_LIBC_FILE}/configure" \
3.147 + "${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/configure" \
3.148 --prefix=/usr \
3.149 --build=${CT_BUILD} \
3.150 --host=${CT_TARGET} \
3.151 @@ -434,7 +437,7 @@
3.152 ${extra_config} \
3.153 ${CT_LIBC_GLIBC_EXTRA_CONFIG}
3.154
3.155 - if grep -l '^install-lib-all:' "${CT_SRC_DIR}/${CT_LIBC_FILE}/Makerules" > /dev/null; then
3.156 + if grep -l '^install-lib-all:' "${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/Makerules" > /dev/null; then
3.157 # nptl-era glibc.
3.158 # If the install-lib-all target (which is added by our make-install-lib-all.patch)
3.159 # is present, it means we're building glibc-2.3.3 or later, and we can't
4.1 --- a/scripts/build/libc/uClibc.sh Sun Jan 04 14:39:39 2009 +0000
4.2 +++ b/scripts/build/libc/uClibc.sh Sun Jan 04 22:17:53 2009 +0000
4.3 @@ -10,7 +10,7 @@
4.4 # For uClibc, we have almost every thing: releases, and snapshots
4.5 # for the last month or so. We'll have to deal with svn revisions
4.6 # later...
4.7 - CT_GetFile "${CT_LIBC_FILE}" ${libc_src}
4.8 + CT_GetFile "uClibc-${CT_LIBC_VERSION}" ${libc_src}
4.9 # uClibc locales
4.10 [ "${CT_LIBC_UCLIBC_LOCALES}" = "y" ] && CT_GetFile "uClibc-locale-030818" ${libc_src} || true
4.11
4.12 @@ -19,9 +19,13 @@
4.13
4.14 # Extract uClibc
4.15 do_libc_extract() {
4.16 - CT_ExtractAndPatch "${CT_LIBC_FILE}"
4.17 + CT_ExtractAndPatch "uClibc-${CT_LIBC_VERSION}"
4.18 # uClibc locales
4.19 - [ "${CT_LIBC_UCLIBC_LOCALES}" = "y" ] && CT_ExtractAndPatch "uClibc-locale-030818" || true
4.20 + if [ "${CT_LIBC_UCLIBC_LOCALES}" = "y" ]; then
4.21 + CT_Pushd "${CT_SRC_DIR}/uClibc-${CT_LIBC_VERSION}"
4.22 + CT_ExtractAndPatch "uClibc-locale-030818" nochdir || true
4.23 + CT_Popd
4.24 + fi
4.25
4.26 return 0
4.27 }
4.28 @@ -52,7 +56,7 @@
4.29
4.30 # Simply copy files until uClibc has the ablity to build out-of-tree
4.31 CT_DoLog EXTRA "Copying sources to build dir"
4.32 - { cd "${CT_SRC_DIR}/${CT_LIBC_FILE}"; tar cf - .; } |tar xf -
4.33 + { cd "${CT_SRC_DIR}/uClibc-${CT_LIBC_VERSION}"; tar cf - .; } |tar xf -
4.34
4.35 # Retrieve the config file
4.36 cp "${CT_BUILD_DIR}/uClibc.config" .config
4.37 @@ -87,7 +91,7 @@
4.38
4.39 # Simply copy files until uClibc has the ablity to build out-of-tree
4.40 CT_DoLog EXTRA "Copying sources to build dir"
4.41 - { cd "${CT_SRC_DIR}/${CT_LIBC_FILE}"; tar cf - .; } |tar xf -
4.42 + { cd "${CT_SRC_DIR}/uClibc-${CT_LIBC_VERSION}"; tar cf - .; } |tar xf -
4.43
4.44 # Retrieve the config file
4.45 cp "${CT_BUILD_DIR}/uClibc.config" .config
4.46 @@ -146,7 +150,7 @@
4.47
4.48 # Simply copy files until uClibc has the ablity to build out-of-tree
4.49 CT_DoLog EXTRA "Copying sources to build dir"
4.50 - { cd "${CT_SRC_DIR}/${CT_LIBC_FILE}"; tar cf - .; } |tar xf -
4.51 + { cd "${CT_SRC_DIR}/uClibc-${CT_LIBC_VERSION}"; tar cf - .; } |tar xf -
4.52
4.53 # Retrieve the config file
4.54 cp "${CT_BUILD_DIR}/uClibc.config" .config
5.1 --- a/scripts/crosstool.sh Sun Jan 04 14:39:39 2009 +0000
5.2 +++ b/scripts/crosstool.sh Sun Jan 04 22:17:53 2009 +0000
5.3 @@ -84,9 +84,6 @@
5.4 CT_CC_CORE_EXTRA_CONFIG="${CT_ARCH_CC_CORE_EXTRA_CONFIG} ${CT_CC_CORE_EXTRA_CONFIG}"
5.5 CT_CC_EXTRA_CONFIG="${CT_ARCH_CC_EXTRA_CONFIG} ${CT_CC_EXTRA_CONFIG}"
5.6
5.7 -# Now, build up the variables from the user-configured options.
5.8 -CT_LIBC_FILE="${CT_LIBC}-${CT_LIBC_VERSION}"
5.9 -
5.10 # Where will we work?
5.11 : "${CT_WORK_DIR:=${CT_TOP_DIR}/targets}"
5.12 CT_TARBALLS_DIR="${CT_WORK_DIR}/tarballs"
5.13 @@ -108,11 +105,6 @@
5.14 CT_Abort "I will stop here to avoid any carnage"
5.15 fi
5.16
5.17 -if [ -n "${CT_LOCAL_TARBALLS_DIR}" ]; then
5.18 - # Make absolute path, it so much easier!
5.19 - CT_LOCAL_TARBALLS_DIR=$(CT_MakeAbsolutePath "${CT_LOCAL_TARBALLS_DIR}")
5.20 -fi
5.21 -
5.22 # If the local tarball directory does not exist, say so, and don't try to save there!
5.23 if [ ! -d "${CT_LOCAL_TARBALLS_DIR}" ]; then
5.24 CT_DoLog WARN "Directory '${CT_LOCAL_TARBALLS_DIR}' does not exist. Will not save downloaded tarballs to local storage."
6.1 --- a/scripts/functions Sun Jan 04 14:39:39 2009 +0000
6.2 +++ b/scripts/functions Sun Jan 04 22:17:53 2009 +0000
6.3 @@ -231,25 +231,6 @@
6.4 popd >/dev/null 2>&1
6.5 }
6.6
6.7 -# Makes a path absolute
6.8 -# Usage: CT_MakeAbsolutePath path
6.9 -CT_MakeAbsolutePath() {
6.10 - # Try to cd in that directory
6.11 - if [ -d "$1" ]; then
6.12 - CT_Pushd "$1"
6.13 - pwd
6.14 - CT_Popd
6.15 - else
6.16 - # No such directory, fail back to guessing
6.17 - case "$1" in
6.18 - /*) echo "$1";;
6.19 - *) echo "$(pwd)/$1";;
6.20 - esac
6.21 - fi
6.22 -
6.23 - return 0
6.24 -}
6.25 -
6.26 # Creates a temporary directory
6.27 # $1: variable to assign to
6.28 # Usage: CT_MktempDir foo
6.29 @@ -279,17 +260,15 @@
6.30 shift
6.31 local first_ext="$1"
6.32
6.33 - CT_Pushd "${CT_TARBALLS_DIR}"
6.34 # we need to also check for an empty extension for those very
6.35 # peculiar components that don't have one (such as sstrip from
6.36 # buildroot).
6.37 for ext in ${first_ext} .tar.gz .tar.bz2 .tgz .tar ''; do
6.38 - if [ -f "${file}${ext}" ]; then
6.39 + if [ -f "${CT_TARBALLS_DIR}/${file}${ext}" ]; then
6.40 echo "${ext}"
6.41 break
6.42 fi
6.43 done
6.44 - CT_Popd
6.45
6.46 return 0
6.47 }
6.48 @@ -578,40 +557,25 @@
6.49 # Extract a tarball and patch the resulting sources if necessary.
6.50 # Some tarballs need to be extracted in specific places. Eg.: glibc addons
6.51 # must be extracted in the glibc directory; uCLibc locales must be extracted
6.52 -# in the extra/locale sub-directory of uClibc.
6.53 +# in the extra/locale sub-directory of uClibc. This is taken into account
6.54 +# by the caller, that did a 'cd' into the correct path before calling us
6.55 +# and sets nochdir to 'nochdir'.
6.56 +# Usage: CT_ExtractAndPatch <basename> [nochdir]
6.57 CT_ExtractAndPatch() {
6.58 local file="$1"
6.59 + local nochdir="$2"
6.60 local base_file=$(echo "${file}" |cut -d - -f 1)
6.61 local ver_file=$(echo "${file}" |cut -d - -f 2-)
6.62 local official_patch_dir
6.63 local custom_patch_dir
6.64 - local libc_addon
6.65 local ext=$(CT_GetFileExtension "${file}")
6.66 CT_TestAndAbort "'${file}' not found in '${CT_TARBALLS_DIR}'" -z "${ext}"
6.67 local full_file="${CT_TARBALLS_DIR}/${file}${ext}"
6.68
6.69 - CT_Pushd "${CT_SRC_DIR}"
6.70 + [ "${nochdir}" = "nochdir" ] || CT_Pushd "${CT_SRC_DIR}"
6.71
6.72 - # Add-ons need a little love, really.
6.73 - case "${file}" in
6.74 - glibc-[a-z]*-*|eglibc-[a-z]*-*)
6.75 - CT_TestAndAbort "Trying to extract the C-library addon/locales '${file}' when C-library not yet extracted" ! -d "${CT_LIBC_FILE}"
6.76 - cd "${CT_LIBC_FILE}"
6.77 - libc_addon=y
6.78 - [ -f ".${file}.extracted" ] && return 0
6.79 - touch ".${file}.extracted"
6.80 - ;;
6.81 - uClibc-locale-*)
6.82 - CT_TestAndAbort "Trying to extract the C-library addon/locales '${file}' when C-library not yet extracted" ! -d "${CT_LIBC_FILE}"
6.83 - cd "${CT_LIBC_FILE}/extra/locale"
6.84 - libc_addon=y
6.85 - [ -f ".${file}.extracted" ] && return 0
6.86 - touch ".${file}.extracted"
6.87 - ;;
6.88 - esac
6.89 -
6.90 - # If the directory exists, then consider extraction and patching done
6.91 - if [ -d "${file}" ]; then
6.92 + # Check if already extracted
6.93 + if [ -e "${CT_SRC_DIR}/.${file}.extracted" ]; then
6.94 CT_DoLog DEBUG "Already extracted '${file}'"
6.95 return 0
6.96 fi
6.97 @@ -623,36 +587,25 @@
6.98 .tar) CT_DoExecLog ALL tar xvf "${full_file}";;
6.99 *) CT_Abort "Don't know how to handle '${file}': unknown extension" ;;
6.100 esac
6.101 + touch "${CT_SRC_DIR}/.${file}.extracted"
6.102
6.103 # Snapshots might not have the version number in the extracted directory
6.104 # name. This is also the case for some (odd) packages, such as D.U.M.A.
6.105 # Overcome this issue by symlink'ing the directory.
6.106 - if [ ! -d "${file}" -a "${libc_addon}" != "y" ]; then
6.107 + if [ ! -d "${file}" ]; then
6.108 case "${ext}" in
6.109 .tar.bz2) base=$(tar tjf "${full_file}" |head -n 1 |cut -d / -f 1 || true);;
6.110 .tar.gz|.tgz) base=$(tar tzf "${full_file}" |head -n 1 |cut -d / -f 1 || true);;
6.111 .tar) base=$(tar tf "${full_file}" |head -n 1 |cut -d / -f 1 || true);;
6.112 esac
6.113 CT_TestOrAbort "There was a problem when extracting '${file}'" -d "${base}" -o "${base}" != "${file}"
6.114 - ln -s "${base}" "${file}"
6.115 + mv "${base}" "${file}"
6.116 fi
6.117
6.118 # Kludge: outside this function, we wouldn't know if we had just extracted
6.119 # a libc addon, or a plain package. Apply patches now.
6.120 - if [ "${libc_addon}" = "y" ]; then
6.121 - # Some addon tarballs directly contain the correct addon directory,
6.122 - # while others have the addon directory named after the tarball.
6.123 - # Fix that by always using the short name (eg: linuxthreads, ports, etc...)
6.124 - addon_short_name=$(echo "${file}" |sed -r -e 's/^[^-]+-([^-]+)-.*$/\1/;')
6.125 - if [ ! -d "${addon_short_name}" ]; then
6.126 - mv "${file}" "${addon_short_name}"
6.127 - # Keep a symlink to avoid re-extracting later on.
6.128 - ln -s "${addon_short_name}" "${file}"
6.129 - fi
6.130 - # If libc addon, we're already in the correct place
6.131 - else
6.132 - cd "${file}"
6.133 - fi
6.134 +
6.135 + [ "${nochdir}" = "nochdir" ] || cd "${file}"
6.136
6.137 official_patch_dir=
6.138 custom_patch_dir=
6.139 @@ -680,7 +633,7 @@
6.140 done
6.141 fi
6.142
6.143 - CT_Popd
6.144 + [ "${nochdir}" = "nochdir" ] || CT_Popd
6.145 }
6.146
6.147 # Two wrappers to call config.(guess|sub) either from CT_TOP_DIR or CT_LIB_DIR.