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(-)
This commit is contained in:
Yann E. MORIN" 2009-01-04 22:17:53 +00:00
parent ddaf4012ae
commit 31cc00829e
6 changed files with 84 additions and 131 deletions

View File

@ -16,15 +16,12 @@ do_debug_duma_get() {
do_debug_duma_extract() {
CT_ExtractAndPatch "duma-${CT_DUMA_VERSION}"
cd "${CT_SRC_DIR}"
rm -f "duma-${CT_DUMA_VERSION}"
ln -sf "duma_${CT_DUMA_VERSION}" "duma-${CT_DUMA_VERSION}"
}
do_debug_duma_build() {
CT_DoStep INFO "Installing D.U.M.A."
CT_DoLog EXTRA "Copying sources"
cp -a "${CT_SRC_DIR}/duma_${CT_DUMA_VERSION}" "${CT_BUILD_DIR}/build-duma"
cp -a "${CT_SRC_DIR}/duma-${CT_DUMA_VERSION}" "${CT_BUILD_DIR}/build-duma"
CT_Pushd "${CT_BUILD_DIR}/build-duma"
DUMA_CPP=

View File

@ -18,13 +18,14 @@ do_eglibc_get() {
CT_DoExecLog ALL svn ${svn_action} -r "${CT_EGLIBC_REVISION:-HEAD}" "${svn_url}" . 2>&1
# Compress eglibc
CT_DoExecLog ALL mv libc "${CT_LIBC_FILE}"
CT_DoExecLog ALL tar cjf "${CT_LIBC_FILE}.tar.bz2" "${CT_LIBC_FILE}"
CT_DoExecLog ALL mv libc "eglibc-${CT_LIBC_VERSION}"
CT_DoExecLog ALL tar cjf "eglibc-${CT_LIBC_VERSION}.tar.bz2" "eglibc-${CT_LIBC_VERSION}"
# Compress linuxthreads, localedef and ports
# Assign them the name the way ct-ng like it
for addon in linuxthreads localedef ports; do
CT_DoExecLog ALL tar cjf "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}.tar.bz2" "${addon}"
CT_DoExecLog ALL mv "${addon}" "eglibc-${addon}-${CT_LIBC_VERSION}"
CT_DoExecLog ALL tar cjf "eglibc-${addon}-${CT_LIBC_VERSION}.tar.bz2" "eglibc-${addon}-${CT_LIBC_VERSION}"
done
}
@ -35,7 +36,7 @@ do_libc_get() {
# simultaneously.
# build filename
eglibc="${CT_LIBC_FILE}.tar.bz2"
eglibc="eglibc-${CT_LIBC_VERSION}.tar.bz2"
eglibc_linuxthreads="${CT_LIBC}-linuxthreads-${CT_LIBC_VERSION}.tar.bz2"
eglibc_localedef="${CT_LIBC}-localedef-${CT_LIBC_VERSION}.tar.bz2"
eglibc_ports="${CT_LIBC}-ports-${CT_LIBC_VERSION}.tar.bz2"
@ -91,19 +92,22 @@ do_libc_get() {
# Extract eglibc
do_libc_extract() {
CT_ExtractAndPatch "${CT_LIBC_FILE}"
CT_ExtractAndPatch "eglibc-${CT_LIBC_VERSION}"
# C library addons
for addon in $(do_libc_add_ons_list " "); do
# NPTL addon is not to be extracted, in any case
[ "${addon}" = "nptl" ] && continue || true
CT_ExtractAndPatch "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}"
CT_Pushd "${CT_SRC_DIR}/eglibc-${CT_LIBC_VERSION}"
CT_ExtractAndPatch "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}" nochdir
[ ! -d "${addon}" ] && ln -s "eglibc-${addon}-${CT_LIBC_VERSION}" "${addon}"
CT_Popd
done
# The configure files may be older than the configure.in files
# if using a snapshot (or even some tarballs). Fake them being
# up to date.
find "${CT_SRC_DIR}/${CT_LIBC_FILE}" -type f -name configure -exec touch {} \; 2>&1 |CT_DoLog ALL
find "${CT_SRC_DIR}/eglibc-${CT_LIBC_VERSION}" -type f -name configure -exec touch {} \; 2>&1 |CT_DoLog ALL
return 0
}
@ -139,20 +143,20 @@ do_libc_start_files() {
CT_DoLog DEBUG "Using ar for target: '${cross_ar}'"
CT_DoLog DEBUG "Using ranlib for target: '${cross_ranlib}'"
BUILD_CC="${CT_BUILD}-gcc" \
CC=${cross_cc} \
CXX=${cross_cxx} \
AR=${cross_ar} \
RANLIB=${cross_ranlib} \
CT_DoExecLog ALL \
"${CT_SRC_DIR}/${CT_LIBC_FILE}/configure" \
--prefix=/usr \
--with-headers="${CT_HEADERS_DIR}" \
--build="${CT_BUILD}" \
--host="${CT_TARGET}" \
--disable-profile \
--without-gd \
--without-cvs \
BUILD_CC="${CT_BUILD}-gcc" \
CC=${cross_cc} \
CXX=${cross_cxx} \
AR=${cross_ar} \
RANLIB=${cross_ranlib} \
CT_DoExecLog ALL \
"${CT_SRC_DIR}/eglibc-${CT_LIBC_VERSION}/configure" \
--prefix=/usr \
--with-headers="${CT_HEADERS_DIR}" \
--build="${CT_BUILD}" \
--host="${CT_TARGET}" \
--disable-profile \
--without-gd \
--without-cvs \
--enable-add-ons
CT_DoLog EXTRA "Installing C library headers"
@ -241,7 +245,7 @@ do_libc() {
AR=${CT_TARGET}-ar \
RANLIB=${CT_TARGET}-ranlib \
CT_DoExecLog ALL \
"${CT_SRC_DIR}/${CT_LIBC_FILE}/configure" \
"${CT_SRC_DIR}/eglibc-${CT_LIBC_VERSION}/configure" \
--prefix=/usr \
--with-headers="${CT_HEADERS_DIR}" \
--build=${CT_BUILD} \

View File

@ -16,11 +16,11 @@ do_libc_get() {
if [ "${CT_LIBC_GLIBC_2_8_or_later}" = "y" ]; then
# No release tarball available...
date="${CT_LIBC_GLIBC_CVS_date}"
CT_GetCVS "${CT_LIBC_FILE}" \
CT_GetCVS "glibc-${CT_LIBC_VERSION}" \
":pserver:anoncvs@sources.redhat.com:/cvs/glibc" \
"libc" \
"glibc-${CT_LIBC_VERSION}-branch${date:+:}${date}" \
"${CT_LIBC_FILE}"
"glibc-${CT_LIBC_VERSION}"
# C library addons
for addon in $(do_libc_add_ons_list " "); do
@ -34,7 +34,7 @@ do_libc_get() {
done
else
# Release tarballs are available
CT_GetFile "${CT_LIBC_FILE}" \
CT_GetFile "glibc-${CT_LIBC_VERSION}" \
{ftp,http}://ftp.gnu.org/gnu/glibc \
ftp://gcc.gnu.org/pub/glibc/releases \
ftp://gcc.gnu.org/pub/glibc/snapshots
@ -43,7 +43,7 @@ do_libc_get() {
for addon in $(do_libc_add_ons_list " "); do
# NPTL addon is not to be downloaded, in any case
[ "${addon}" = "nptl" ] && continue || true
CT_GetFile "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}" \
CT_GetFile "glibc-${addon}-${CT_LIBC_VERSION}" \
{ftp,http}://ftp.gnu.org/gnu/glibc \
ftp://gcc.gnu.org/pub/glibc/releases \
ftp://gcc.gnu.org/pub/glibc/snapshots
@ -55,19 +55,22 @@ do_libc_get() {
# Extract glibc
do_libc_extract() {
CT_ExtractAndPatch "${CT_LIBC_FILE}"
CT_ExtractAndPatch "glibc-${CT_LIBC_VERSION}"
# C library addons
for addon in $(do_libc_add_ons_list " "); do
# NPTL addon is not to be extracted, in any case
[ "${addon}" = "nptl" ] && continue || true
CT_ExtractAndPatch "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}"
CT_Pushd "${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}"
CT_ExtractAndPatch "glibc-${addon}-${CT_LIBC_VERSION}" nochdir
[ ! -d "${addon}" ] && ln -s "glibc-${addon}-${CT_LIBC_VERSION}" "${addon}"
CT_Popd
done
# The configure files may be older than the configure.in files
# if using a snapshot (or even some tarballs). Fake them being
# up to date.
find "${CT_SRC_DIR}/${CT_LIBC_FILE}" -type f -name configure -exec touch {} \; 2>&1 |CT_DoLog ALL
find "${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}" -type f -name configure -exec touch {} \; 2>&1 |CT_DoLog ALL
return 0
}
@ -115,23 +118,23 @@ do_libc_headers() {
CT_DoLog DEBUG "Using gcc for target: '${cross_cc}'"
CT_DoLog DEBUG "Extra config passed : '${extra_config}'"
libc_cv_ppc_machine=yes \
CC=${cross_cc} \
CT_DoExecLog ALL \
"${CT_SRC_DIR}/${CT_LIBC_FILE}/configure" \
--build="${CT_BUILD}" \
--host="${CT_TARGET}" \
--prefix=/usr \
--with-headers="${CT_HEADERS_DIR}" \
--without-cvs \
--disable-sanity-checks \
--enable-hacker-mode \
${extra_config} \
libc_cv_ppc_machine=yes \
CC=${cross_cc} \
CT_DoExecLog ALL \
"${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/configure" \
--build="${CT_BUILD}" \
--host="${CT_TARGET}" \
--prefix=/usr \
--with-headers="${CT_HEADERS_DIR}" \
--without-cvs \
--disable-sanity-checks \
--enable-hacker-mode \
${extra_config} \
--without-nptl
CT_DoLog EXTRA "Installing C library headers"
if grep -q GLIBC_2.3 "${CT_SRC_DIR}/${CT_LIBC_FILE}/ChangeLog"; then
if grep -q GLIBC_2.3 "${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/ChangeLog"; then
# glibc-2.3.x passes cross options to $(CC) when generating errlist-compat.c,
# which fails without a real cross-compiler.
# Fortunately, we don't need errlist-compat.c, since we just need .h
@ -172,7 +175,7 @@ do_libc_headers() {
# See e.g. http://gcc.gnu.org/ml/gcc/2002-01/msg00900.html
mkdir -p "${CT_HEADERS_DIR}/gnu"
CT_DoExecLog ALL touch "${CT_HEADERS_DIR}/gnu/stubs.h"
CT_DoExecLog ALL cp -v "${CT_SRC_DIR}/${CT_LIBC_FILE}/include/features.h" \
CT_DoExecLog ALL cp -v "${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/include/features.h" \
"${CT_HEADERS_DIR}/features.h"
# Building the bootstrap gcc requires either setting inhibit_libc, or
@ -187,20 +190,20 @@ do_libc_headers() {
[ "${CT_ARCH}" != "arm" ] && CT_DoExecLog ALL cp -v misc/syscall-list.h "${CT_HEADERS_DIR}/bits/syscall.h" || true
# Those headers are to be manually copied so gcc can build properly
pthread_h="${CT_SRC_DIR}/${CT_LIBC_FILE}/${CT_THREADS}/sysdeps/pthread/pthread.h"
pthread_h="${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/${CT_THREADS}/sysdeps/pthread/pthread.h"
pthreadtypes_h=
case "${CT_THREADS}" in
nptl)
# NOTE: for some archs, the pathes are different, but they are not
# supported by crosstool-NG right now. See original crosstool when they are.
pthread_h="${CT_SRC_DIR}/${CT_LIBC_FILE}/${CT_THREADS}/sysdeps/pthread/pthread.h"
pthreadtypes_h="${CT_SRC_DIR}/${CT_LIBC_FILE}/nptl/sysdeps/unix/sysv/linux/${CT_KERNEL_ARCH}/bits/pthreadtypes.h"
pthread_h="${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/${CT_THREADS}/sysdeps/pthread/pthread.h"
pthreadtypes_h="${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/nptl/sysdeps/unix/sysv/linux/${CT_KERNEL_ARCH}/bits/pthreadtypes.h"
if [ ! -f "${pthreadtypes_h}" ]; then
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"
pthreadtypes_h="${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/ports/sysdeps/unix/sysv/linux/${CT_KERNEL_ARCH}/nptl/bits/pthreadtypes.h"
fi
;;
linuxthreads)
pthreadtypes_h="${CT_SRC_DIR}/${CT_LIBC_FILE}/linuxthreads/sysdeps/pthread/bits/pthreadtypes.h"
pthreadtypes_h="${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/linuxthreads/sysdeps/pthread/bits/pthreadtypes.h"
;;
*)
pthread_h=
@ -292,7 +295,7 @@ do_libc_start_files() {
AR=${CT_TARGET}-ar \
RANLIB=${CT_TARGET}-ranlib \
CT_DoExecLog ALL \
"${CT_SRC_DIR}/${CT_LIBC_FILE}/configure" \
"${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/configure" \
--prefix=/usr \
--build="${CT_BUILD}" \
--host=${CT_TARGET} \
@ -420,7 +423,7 @@ do_libc() {
AR=${CT_TARGET}-ar \
RANLIB=${CT_TARGET}-ranlib \
CT_DoExecLog ALL \
"${CT_SRC_DIR}/${CT_LIBC_FILE}/configure" \
"${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/configure" \
--prefix=/usr \
--build=${CT_BUILD} \
--host=${CT_TARGET} \
@ -434,7 +437,7 @@ do_libc() {
${extra_config} \
${CT_LIBC_GLIBC_EXTRA_CONFIG}
if grep -l '^install-lib-all:' "${CT_SRC_DIR}/${CT_LIBC_FILE}/Makerules" > /dev/null; then
if grep -l '^install-lib-all:' "${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/Makerules" > /dev/null; then
# nptl-era glibc.
# If the install-lib-all target (which is added by our make-install-lib-all.patch)
# is present, it means we're building glibc-2.3.3 or later, and we can't

View File

@ -10,7 +10,7 @@ do_libc_get() {
# For uClibc, we have almost every thing: releases, and snapshots
# for the last month or so. We'll have to deal with svn revisions
# later...
CT_GetFile "${CT_LIBC_FILE}" ${libc_src}
CT_GetFile "uClibc-${CT_LIBC_VERSION}" ${libc_src}
# uClibc locales
[ "${CT_LIBC_UCLIBC_LOCALES}" = "y" ] && CT_GetFile "uClibc-locale-030818" ${libc_src} || true
@ -19,9 +19,13 @@ do_libc_get() {
# Extract uClibc
do_libc_extract() {
CT_ExtractAndPatch "${CT_LIBC_FILE}"
CT_ExtractAndPatch "uClibc-${CT_LIBC_VERSION}"
# uClibc locales
[ "${CT_LIBC_UCLIBC_LOCALES}" = "y" ] && CT_ExtractAndPatch "uClibc-locale-030818" || true
if [ "${CT_LIBC_UCLIBC_LOCALES}" = "y" ]; then
CT_Pushd "${CT_SRC_DIR}/uClibc-${CT_LIBC_VERSION}"
CT_ExtractAndPatch "uClibc-locale-030818" nochdir || true
CT_Popd
fi
return 0
}
@ -52,7 +56,7 @@ do_libc_headers() {
# Simply copy files until uClibc has the ablity to build out-of-tree
CT_DoLog EXTRA "Copying sources to build dir"
{ cd "${CT_SRC_DIR}/${CT_LIBC_FILE}"; tar cf - .; } |tar xf -
{ cd "${CT_SRC_DIR}/uClibc-${CT_LIBC_VERSION}"; tar cf - .; } |tar xf -
# Retrieve the config file
cp "${CT_BUILD_DIR}/uClibc.config" .config
@ -87,7 +91,7 @@ do_libc() {
# Simply copy files until uClibc has the ablity to build out-of-tree
CT_DoLog EXTRA "Copying sources to build dir"
{ cd "${CT_SRC_DIR}/${CT_LIBC_FILE}"; tar cf - .; } |tar xf -
{ cd "${CT_SRC_DIR}/uClibc-${CT_LIBC_VERSION}"; tar cf - .; } |tar xf -
# Retrieve the config file
cp "${CT_BUILD_DIR}/uClibc.config" .config
@ -146,7 +150,7 @@ do_libc_finish() {
# Simply copy files until uClibc has the ablity to build out-of-tree
CT_DoLog EXTRA "Copying sources to build dir"
{ cd "${CT_SRC_DIR}/${CT_LIBC_FILE}"; tar cf - .; } |tar xf -
{ cd "${CT_SRC_DIR}/uClibc-${CT_LIBC_VERSION}"; tar cf - .; } |tar xf -
# Retrieve the config file
cp "${CT_BUILD_DIR}/uClibc.config" .config

View File

@ -84,9 +84,6 @@ CT_TARGET_LDFLAGS="${CT_ARCH_TARGET_LDFLAGS} ${CT_TARGET_LDFLAGS}"
CT_CC_CORE_EXTRA_CONFIG="${CT_ARCH_CC_CORE_EXTRA_CONFIG} ${CT_CC_CORE_EXTRA_CONFIG}"
CT_CC_EXTRA_CONFIG="${CT_ARCH_CC_EXTRA_CONFIG} ${CT_CC_EXTRA_CONFIG}"
# Now, build up the variables from the user-configured options.
CT_LIBC_FILE="${CT_LIBC}-${CT_LIBC_VERSION}"
# Where will we work?
: "${CT_WORK_DIR:=${CT_TOP_DIR}/targets}"
CT_TARBALLS_DIR="${CT_WORK_DIR}/tarballs"
@ -108,11 +105,6 @@ if [ -n "${CT_RESTART}" -a ! -d "${CT_STATE_DIR}" ]; then
CT_Abort "I will stop here to avoid any carnage"
fi
if [ -n "${CT_LOCAL_TARBALLS_DIR}" ]; then
# Make absolute path, it so much easier!
CT_LOCAL_TARBALLS_DIR=$(CT_MakeAbsolutePath "${CT_LOCAL_TARBALLS_DIR}")
fi
# If the local tarball directory does not exist, say so, and don't try to save there!
if [ ! -d "${CT_LOCAL_TARBALLS_DIR}" ]; then
CT_DoLog WARN "Directory '${CT_LOCAL_TARBALLS_DIR}' does not exist. Will not save downloaded tarballs to local storage."

View File

@ -231,25 +231,6 @@ CT_Popd() {
popd >/dev/null 2>&1
}
# Makes a path absolute
# Usage: CT_MakeAbsolutePath path
CT_MakeAbsolutePath() {
# Try to cd in that directory
if [ -d "$1" ]; then
CT_Pushd "$1"
pwd
CT_Popd
else
# No such directory, fail back to guessing
case "$1" in
/*) echo "$1";;
*) echo "$(pwd)/$1";;
esac
fi
return 0
}
# Creates a temporary directory
# $1: variable to assign to
# Usage: CT_MktempDir foo
@ -279,17 +260,15 @@ CT_GetFileExtension() {
shift
local first_ext="$1"
CT_Pushd "${CT_TARBALLS_DIR}"
# we need to also check for an empty extension for those very
# peculiar components that don't have one (such as sstrip from
# buildroot).
for ext in ${first_ext} .tar.gz .tar.bz2 .tgz .tar ''; do
if [ -f "${file}${ext}" ]; then
if [ -f "${CT_TARBALLS_DIR}/${file}${ext}" ]; then
echo "${ext}"
break
fi
done
CT_Popd
return 0
}
@ -578,40 +557,25 @@ CT_GetCVS() {
# Extract a tarball and patch the resulting sources if necessary.
# Some tarballs need to be extracted in specific places. Eg.: glibc addons
# must be extracted in the glibc directory; uCLibc locales must be extracted
# in the extra/locale sub-directory of uClibc.
# in the extra/locale sub-directory of uClibc. This is taken into account
# by the caller, that did a 'cd' into the correct path before calling us
# and sets nochdir to 'nochdir'.
# Usage: CT_ExtractAndPatch <basename> [nochdir]
CT_ExtractAndPatch() {
local file="$1"
local nochdir="$2"
local base_file=$(echo "${file}" |cut -d - -f 1)
local ver_file=$(echo "${file}" |cut -d - -f 2-)
local official_patch_dir
local custom_patch_dir
local libc_addon
local ext=$(CT_GetFileExtension "${file}")
CT_TestAndAbort "'${file}' not found in '${CT_TARBALLS_DIR}'" -z "${ext}"
local full_file="${CT_TARBALLS_DIR}/${file}${ext}"
CT_Pushd "${CT_SRC_DIR}"
[ "${nochdir}" = "nochdir" ] || CT_Pushd "${CT_SRC_DIR}"
# Add-ons need a little love, really.
case "${file}" in
glibc-[a-z]*-*|eglibc-[a-z]*-*)
CT_TestAndAbort "Trying to extract the C-library addon/locales '${file}' when C-library not yet extracted" ! -d "${CT_LIBC_FILE}"
cd "${CT_LIBC_FILE}"
libc_addon=y
[ -f ".${file}.extracted" ] && return 0
touch ".${file}.extracted"
;;
uClibc-locale-*)
CT_TestAndAbort "Trying to extract the C-library addon/locales '${file}' when C-library not yet extracted" ! -d "${CT_LIBC_FILE}"
cd "${CT_LIBC_FILE}/extra/locale"
libc_addon=y
[ -f ".${file}.extracted" ] && return 0
touch ".${file}.extracted"
;;
esac
# If the directory exists, then consider extraction and patching done
if [ -d "${file}" ]; then
# Check if already extracted
if [ -e "${CT_SRC_DIR}/.${file}.extracted" ]; then
CT_DoLog DEBUG "Already extracted '${file}'"
return 0
fi
@ -623,36 +587,25 @@ CT_ExtractAndPatch() {
.tar) CT_DoExecLog ALL tar xvf "${full_file}";;
*) CT_Abort "Don't know how to handle '${file}': unknown extension" ;;
esac
touch "${CT_SRC_DIR}/.${file}.extracted"
# Snapshots might not have the version number in the extracted directory
# name. This is also the case for some (odd) packages, such as D.U.M.A.
# Overcome this issue by symlink'ing the directory.
if [ ! -d "${file}" -a "${libc_addon}" != "y" ]; then
if [ ! -d "${file}" ]; then
case "${ext}" in
.tar.bz2) base=$(tar tjf "${full_file}" |head -n 1 |cut -d / -f 1 || true);;
.tar.gz|.tgz) base=$(tar tzf "${full_file}" |head -n 1 |cut -d / -f 1 || true);;
.tar) base=$(tar tf "${full_file}" |head -n 1 |cut -d / -f 1 || true);;
esac
CT_TestOrAbort "There was a problem when extracting '${file}'" -d "${base}" -o "${base}" != "${file}"
ln -s "${base}" "${file}"
mv "${base}" "${file}"
fi
# Kludge: outside this function, we wouldn't know if we had just extracted
# a libc addon, or a plain package. Apply patches now.
if [ "${libc_addon}" = "y" ]; then
# Some addon tarballs directly contain the correct addon directory,
# while others have the addon directory named after the tarball.
# Fix that by always using the short name (eg: linuxthreads, ports, etc...)
addon_short_name=$(echo "${file}" |sed -r -e 's/^[^-]+-([^-]+)-.*$/\1/;')
if [ ! -d "${addon_short_name}" ]; then
mv "${file}" "${addon_short_name}"
# Keep a symlink to avoid re-extracting later on.
ln -s "${addon_short_name}" "${file}"
fi
# If libc addon, we're already in the correct place
else
cd "${file}"
fi
[ "${nochdir}" = "nochdir" ] || cd "${file}"
official_patch_dir=
custom_patch_dir=
@ -680,7 +633,7 @@ CT_ExtractAndPatch() {
done
fi
CT_Popd
[ "${nochdir}" = "nochdir" ] || CT_Popd
}
# Two wrappers to call config.(guess|sub) either from CT_TOP_DIR or CT_LIB_DIR.