Get rid of all command (which is a bashism), and replace them with $(command), which is POSIX.

Get rid of all remaining \"text\" in log messages and replace them with 'text'.
Optimise the progress bar, should go un-noticed at log level DEBUG and below.

 /trunk/scripts/build/tools/200-sstrip.sh  |   16     8     8     0 ++--
 /trunk/scripts/build/libc_glibc.sh        |   50    25    25     0 +++++++-------
 /trunk/scripts/build/libc_uClibc.sh       |    4     2     2     0
 /trunk/scripts/build/debug/100-dmalloc.sh |    2     1     1     0
 /trunk/scripts/build/debug/400-ltrace.sh  |    2     1     1     0
 /trunk/scripts/build/debug/300-gdb.sh     |    8     4     4     0 +-
 /trunk/scripts/build/debug/200-duma.sh    |    6     3     3     0 +-
 /trunk/scripts/build/kernel_linux.sh      |   30    15    15     0 ++++----
 /trunk/scripts/build/cc_gcc.sh            |   14     7     7     0 ++--
 /trunk/scripts/crosstool.sh               |   54    27    27     0 ++++++++--------
 /trunk/scripts/functions                  |  128    64    64     0 ++++++++++++++++++------------------
 /trunk/scripts/saveSample.sh              |    4     2     2     0
 /trunk/scripts/tarball.sh.broken          |   20    10    10     0 +++---
 /trunk/tools/addToolVersion.sh            |    8     4     4     0 +-
 /trunk/tools/populate.in                  |   18     9     9     0 ++--
 15 files changed, 182 insertions(+), 182 deletions(-)
This commit is contained in:
Yann E. MORIN" 2008-05-20 21:32:39 +00:00
parent 62c87c5adf
commit 0c4633c37f
15 changed files with 182 additions and 182 deletions

View File

@ -62,7 +62,7 @@ do_cc_core_static() {
[ "${CT_CC_CXA_ATEXIT}" = "y" ] && extra_config="${extra_config} --enable-__cxa_atexit" [ "${CT_CC_CXA_ATEXIT}" = "y" ] && extra_config="${extra_config} --enable-__cxa_atexit"
[ "${CT_CC_GCC_GMP_MPFR}" = "y" ] && extra_config="${extra_config} --with-gmp=${CT_PREFIX_DIR} --with-mpfr=${CT_PREFIX_DIR}" [ "${CT_CC_GCC_GMP_MPFR}" = "y" ] && extra_config="${extra_config} --with-gmp=${CT_PREFIX_DIR} --with-mpfr=${CT_PREFIX_DIR}"
CT_DoLog DEBUG "Extra config passed: \"${extra_config}\"" CT_DoLog DEBUG "Extra config passed: '${extra_config}'"
# Use --with-local-prefix so older gccs don't look in /usr/local (http://gcc.gnu.org/PR10532) # Use --with-local-prefix so older gccs don't look in /usr/local (http://gcc.gnu.org/PR10532)
CC_FOR_BUILD="${CT_CC_NATIVE}" \ CC_FOR_BUILD="${CT_CC_NATIVE}" \
@ -117,7 +117,7 @@ do_cc_core_shared() {
[ "${CT_CC_CXA_ATEXIT}" = "y" ] && extra_config="${extra_config} --enable-__cxa_atexit" [ "${CT_CC_CXA_ATEXIT}" = "y" ] && extra_config="${extra_config} --enable-__cxa_atexit"
[ "${CT_CC_GCC_GMP_MPFR}" = "y" ] && extra_config="${extra_config} --with-gmp=${CT_PREFIX_DIR} --with-mpfr=${CT_PREFIX_DIR}" [ "${CT_CC_GCC_GMP_MPFR}" = "y" ] && extra_config="${extra_config} --with-gmp=${CT_PREFIX_DIR} --with-mpfr=${CT_PREFIX_DIR}"
CT_DoLog DEBUG "Extra config passed: \"${extra_config}\"" CT_DoLog DEBUG "Extra config passed: '${extra_config}'"
CC_FOR_BUILD="${CT_CC_NATIVE}" \ CC_FOR_BUILD="${CT_CC_NATIVE}" \
CFLAGS="${CT_CFLAGS_FOR_HOST}" \ CFLAGS="${CT_CFLAGS_FOR_HOST}" \
@ -210,7 +210,7 @@ do_cc() {
CT_Test "Building Objective-C language is not yet supported. Will try..." "${CT_CC_LANG_OBJC}" = "y" CT_Test "Building Objective-C language is not yet supported. Will try..." "${CT_CC_LANG_OBJC}" = "y"
CT_Test "Building Objective-C++ language is not yet supported. Will try..." "${CT_CC_LANG_OBJCXX}" = "y" CT_Test "Building Objective-C++ language is not yet supported. Will try..." "${CT_CC_LANG_OBJCXX}" = "y"
CT_Test "Building ${CT_CC_LANG_OTHERS//,/ } language(s) is not yet supported. Will try..." -n "${CT_CC_LANG_OTHERS}" CT_Test "Building ${CT_CC_LANG_OTHERS//,/ } language(s) is not yet supported. Will try..." -n "${CT_CC_LANG_OTHERS}"
lang_opt=`echo "${lang_opt},${CT_CC_LANG_OTHERS}" |sed -r -e 's/,+/,/g; s/,*$//;'` lang_opt=$(echo "${lang_opt},${CT_CC_LANG_OTHERS}" |sed -r -e 's/,+/,/g; s/,*$//;')
extra_config="--enable-languages=${lang_opt}" extra_config="--enable-languages=${lang_opt}"
extra_config="${extra_config} ${CT_ARCH_WITH_ARCH} ${CT_ARCH_WITH_ABI} ${CT_ARCH_WITH_CPU} ${CT_ARCH_WITH_TUNE} ${CT_ARCH_WITH_FPU} ${CT_ARCH_WITH_FLOAT}" extra_config="${extra_config} ${CT_ARCH_WITH_ARCH} ${CT_ARCH_WITH_ABI} ${CT_ARCH_WITH_CPU} ${CT_ARCH_WITH_TUNE} ${CT_ARCH_WITH_FPU} ${CT_ARCH_WITH_FLOAT}"
@ -223,7 +223,7 @@ do_cc() {
fi fi
[ "${CT_CC_GCC_GMP_MPFR}" = "y" ] && extra_config="${extra_config} --with-gmp=${CT_PREFIX_DIR} --with-mpfr=${CT_PREFIX_DIR}" [ "${CT_CC_GCC_GMP_MPFR}" = "y" ] && extra_config="${extra_config} --with-gmp=${CT_PREFIX_DIR} --with-mpfr=${CT_PREFIX_DIR}"
CT_DoLog DEBUG "Extra config passed: \"${extra_config}\"" CT_DoLog DEBUG "Extra config passed: '${extra_config}'"
# --enable-symvers=gnu really only needed for sh4 to work around a # --enable-symvers=gnu really only needed for sh4 to work around a
# detection problem only matters for gcc-3.2.x and later, I think. # detection problem only matters for gcc-3.2.x and later, I think.
@ -262,10 +262,10 @@ do_cc() {
gcc-3.3.[34]) gcc-3.3.[34])
case "${CT_TARGET}" in case "${CT_TARGET}" in
powerpc64-unknown-linux-gnu|x86_64-unknown-linux-gnu) powerpc64-unknown-linux-gnu|x86_64-unknown-linux-gnu)
for d in `find "${CT_SYSROOT_DIR}" -name lib -type d -empty`; do for d in $(find "${CT_SYSROOT_DIR}" -name lib -type d -empty); do
if [ -d `dirname "${d}"`/lib64 ] ; then if [ -d $(dirname "${d}")/lib64 ] ; then
rm -rf "${d}" rm -rf "${d}"
ln -s `dirname "${d}"`/lib64 "${d}" ln -s $(dirname "${d}")/lib64 "${d}"
fi fi
done ;; done ;;
*) ;; *) ;;

View File

@ -36,7 +36,7 @@ do_debug_dmalloc_build() {
*) extra_config="${extra_config} --disable-shlib";; *) extra_config="${extra_config} --disable-shlib";;
esac esac
CT_DoLog DEBUG "Extra config passed: \"${extra_config}\"" CT_DoLog DEBUG "Extra config passed: '${extra_config}'"
LD="${CT_TARGET}-ld" \ LD="${CT_TARGET}-ld" \
AR="${CT_TARGET}-ar" \ AR="${CT_TARGET}-ar" \

View File

@ -13,7 +13,7 @@ do_debug_duma_get() {
# but with an underscore. Create a link so that crosstool-NG can # but with an underscore. Create a link so that crosstool-NG can
# work correctly: # work correctly:
cd "${CT_TARBALLS_DIR}" cd "${CT_TARBALLS_DIR}"
duma_ext=`CT_GetFileExtension "duma_${CT_DUMA_VERSION}"` duma_ext=$(CT_GetFileExtension "duma_${CT_DUMA_VERSION}")
rm -f "duma-${CT_DUMA_VERSION}${duma_ext}" rm -f "duma-${CT_DUMA_VERSION}${duma_ext}"
ln -sf "duma_${CT_DUMA_VERSION}${duma_ext}" "duma-${CT_DUMA_VERSION}${duma_ext}" ln -sf "duma_${CT_DUMA_VERSION}${duma_ext}" "duma-${CT_DUMA_VERSION}${duma_ext}"
} }
@ -38,14 +38,14 @@ do_debug_duma_build() {
[ "${CT_DUMA_A}" = "y" ] && libs="${libs} libduma.a" [ "${CT_DUMA_A}" = "y" ] && libs="${libs} libduma.a"
[ "${CT_DUMA_SO}" = "y" ] && libs="${libs} libduma.so.0.0" [ "${CT_DUMA_SO}" = "y" ] && libs="${libs} libduma.so.0.0"
for lib in ${libs}; do for lib in ${libs}; do
CT_DoLog EXTRA "Building library \"${lib}\"" CT_DoLog EXTRA "Building library '${lib}'"
make HOSTCC="${CT_CC_NATIVE}" \ make HOSTCC="${CT_CC_NATIVE}" \
HOSTCXX="${CT_CC_NATIVE}" \ HOSTCXX="${CT_CC_NATIVE}" \
CC="${CT_TARGET}-${CT_CC}" \ CC="${CT_TARGET}-${CT_CC}" \
CXX="${CT_TARGET}-${CT_CC}" \ CXX="${CT_TARGET}-${CT_CC}" \
DUMA_CPP="${DUMA_CPP}" \ DUMA_CPP="${DUMA_CPP}" \
${libs} 2>&1 |CT_DoLog ALL ${libs} 2>&1 |CT_DoLog ALL
CT_DoLog EXTRA "Installing library \"${lib}\"" CT_DoLog EXTRA "Installing library '${lib}'"
install -m 644 "${lib}" "${CT_SYSROOT_DIR}/usr/lib" 2>&1 |CT_DoLog ALL install -m 644 "${lib}" "${CT_SYSROOT_DIR}/usr/lib" 2>&1 |CT_DoLog ALL
done done
if [ "${CT_DUMA_SO}" = "y" ]; then if [ "${CT_DUMA_SO}" = "y" ]; then

View File

@ -4,7 +4,7 @@ is_enabled="${CT_GDB}"
do_print_filename() { do_print_filename() {
[ "${CT_GDB}" = "y" ] || return 0 [ "${CT_GDB}" = "y" ] || return 0
echo "gdb`do_debug_gdb_suffix`" echo "gdb$(do_debug_gdb_suffix)"
} }
do_debug_gdb_suffix() { do_debug_gdb_suffix() {
@ -15,17 +15,17 @@ do_debug_gdb_suffix() {
} }
do_debug_gdb_get() { do_debug_gdb_get() {
CT_GetFile "gdb`do_debug_gdb_suffix`" \ CT_GetFile "gdb$(do_debug_gdb_suffix)" \
{ftp,http}://ftp.gnu.org/pub/gnu/gdb \ {ftp,http}://ftp.gnu.org/pub/gnu/gdb \
ftp://sources.redhat.com/pub/gdb/{{,old-}releases,snapshots/current} ftp://sources.redhat.com/pub/gdb/{{,old-}releases,snapshots/current}
} }
do_debug_gdb_extract() { do_debug_gdb_extract() {
CT_ExtractAndPatch "gdb`do_debug_gdb_suffix`" CT_ExtractAndPatch "gdb$(do_debug_gdb_suffix)"
} }
do_debug_gdb_build() { do_debug_gdb_build() {
gdb_src_dir="${CT_SRC_DIR}/gdb`do_debug_gdb_suffix`" gdb_src_dir="${CT_SRC_DIR}/gdb$(do_debug_gdb_suffix)"
extra_config= extra_config=
# Version 6.3 and below behave badly with gdbmi # Version 6.3 and below behave badly with gdbmi

View File

@ -11,7 +11,7 @@ do_debug_ltrace_get() {
CT_GetFile "ltrace_${CT_LTRACE_VERSION}.orig" {ftp,http}://ftp.de.debian.org/debian/pool/main/l/ltrace/ CT_GetFile "ltrace_${CT_LTRACE_VERSION}.orig" {ftp,http}://ftp.de.debian.org/debian/pool/main/l/ltrace/
# Create a link so that the following steps are easier to do: # Create a link so that the following steps are easier to do:
cd "${CT_TARBALLS_DIR}" cd "${CT_TARBALLS_DIR}"
ltrace_ext=`CT_GetFileExtension "ltrace_${CT_LTRACE_VERSION}.orig"` ltrace_ext=$(CT_GetFileExtension "ltrace_${CT_LTRACE_VERSION}.orig")
ln -sf "ltrace_${CT_LTRACE_VERSION}.orig${ltrace_ext}" "ltrace-${CT_LTRACE_VERSION}${ltrace_ext}" ln -sf "ltrace_${CT_LTRACE_VERSION}.orig${ltrace_ext}" "ltrace-${CT_LTRACE_VERSION}${ltrace_ext}"
} }

View File

@ -44,10 +44,10 @@ do_kernel_check_config() {
mkdir -p "${CT_BUILD_DIR}/build-kernel-defconfig" mkdir -p "${CT_BUILD_DIR}/build-kernel-defconfig"
cd "${CT_BUILD_DIR}/build-kernel-defconfig" cd "${CT_BUILD_DIR}/build-kernel-defconfig"
make -C "${CT_SRC_DIR}/${CT_KERNEL_FILE}" O=`pwd` \ make -C "${CT_SRC_DIR}/${CT_KERNEL_FILE}" O=$(pwd) \
ARCH=${CT_KERNEL_ARCH} defconfig 2>&1 |CT_DoLog ALL ARCH=${CT_KERNEL_ARCH} defconfig 2>&1 |CT_DoLog ALL
CT_KERNEL_LINUX_CONFIG_FILE="`pwd`/.config" CT_KERNEL_LINUX_CONFIG_FILE="$(pwd)/.config"
CT_EndStep CT_EndStep
fi fi
@ -64,20 +64,20 @@ do_kernel_headers() {
# We need to enter this directory to find the kernel version strings # We need to enter this directory to find the kernel version strings
cd "${CT_SRC_DIR}/${CT_KERNEL_FILE}" cd "${CT_SRC_DIR}/${CT_KERNEL_FILE}"
if [ "${CT_KERNEL_LINUX_HEADERS_SANITISED}" != "y" ]; then if [ "${CT_KERNEL_LINUX_HEADERS_SANITISED}" != "y" ]; then
k_version=`awk '/^VERSION =/ { print $3 }' Makefile` k_version=$(awk '/^VERSION =/ { print $3 }' Makefile)
k_patchlevel=`awk '/^PATCHLEVEL =/ { print $3 }' Makefile` k_patchlevel=$(awk '/^PATCHLEVEL =/ { print $3 }' Makefile)
k_sublevel=`awk '/^SUBLEVEL =/ { print $3 }' Makefile` k_sublevel=$(awk '/^SUBLEVEL =/ { print $3 }' Makefile)
k_extraversion=`awk '/^EXTRAVERSION =/ { print $3 }' Makefile` k_extraversion=$(awk '/^EXTRAVERSION =/ { print $3 }' Makefile)
else else
k_version=`echo "${CT_KERNEL_VERSION}." |cut -d . -f 1` k_version=$(echo "${CT_KERNEL_VERSION}." |cut -d . -f 1)
k_patchlevel=`echo "${CT_KERNEL_VERSION}." |cut -d . -f 2` k_patchlevel=$(echo "${CT_KERNEL_VERSION}." |cut -d . -f 2)
k_sublevel=`echo "${CT_KERNEL_VERSION}." |cut -d . -f 3` k_sublevel=$(echo "${CT_KERNEL_VERSION}." |cut -d . -f 3)
k_extraversion=`echo "${CT_KERNEL_VERSION}." |cut -d . -f 4` k_extraversion=$(echo "${CT_KERNEL_VERSION}." |cut -d . -f 4)
fi fi
case "${k_version}.${k_patchlevel}" in case "${k_version}.${k_patchlevel}" in
2.2|2.4|2.6) ;; 2.2|2.4|2.6) ;;
*) CT_Abort "Unsupported kernel version \"linux-${k_version}.${k_patchlevel}\".";; *) CT_Abort "Unsupported kernel version 'linux-${k_version}.${k_patchlevel}'.";;
esac esac
# Kernel version that support verbosity will use this, others will ignore it: # Kernel version that support verbosity will use this, others will ignore it:
@ -109,7 +109,7 @@ do_kernel_install() {
CT_DoLog EXTRA "Installing kernel headers" CT_DoLog EXTRA "Installing kernel headers"
make -C "${CT_SRC_DIR}/${CT_KERNEL_FILE}" \ make -C "${CT_SRC_DIR}/${CT_KERNEL_FILE}" \
O="`pwd`" \ O=$(pwd) \
ARCH=${CT_KERNEL_ARCH} \ ARCH=${CT_KERNEL_ARCH} \
INSTALL_HDR_PATH="${CT_SYSROOT_DIR}/usr" \ INSTALL_HDR_PATH="${CT_SYSROOT_DIR}/usr" \
${V_OPT} \ ${V_OPT} \
@ -118,7 +118,7 @@ do_kernel_install() {
if [ "${CT_KERNEL_LINUX_HEADERS_INSTALL_CHECK}" = "y" ]; then if [ "${CT_KERNEL_LINUX_HEADERS_INSTALL_CHECK}" = "y" ]; then
CT_DoLog EXTRA "Checking installed headers" CT_DoLog EXTRA "Checking installed headers"
make -C "${CT_SRC_DIR}/${CT_KERNEL_FILE}" \ make -C "${CT_SRC_DIR}/${CT_KERNEL_FILE}" \
O="`pwd`" \ O=$(pwd) \
ARCH=${CT_KERNEL_ARCH} \ ARCH=${CT_KERNEL_ARCH} \
INSTALL_HDR_PATH="${CT_SYSROOT_DIR}/usr" \ INSTALL_HDR_PATH="${CT_SYSROOT_DIR}/usr" \
${V_OPT} \ ${V_OPT} \
@ -154,7 +154,7 @@ do_kernel_copy() {
cd "${CT_BUILD_DIR}/build-kernel-headers" cd "${CT_BUILD_DIR}/build-kernel-headers"
cp "${CT_KERNEL_LINUX_CONFIG_FILE}" .config cp "${CT_KERNEL_LINUX_CONFIG_FILE}" .config
CT_DoYes "" |make -C "${CT_SRC_DIR}/${CT_KERNEL_FILE}" \ CT_DoYes "" |make -C "${CT_SRC_DIR}/${CT_KERNEL_FILE}" \
O="`pwd`" ${V_OPT} ARCH=${CT_KERNEL_ARCH} \ O=$(pwd) ${V_OPT} ARCH=${CT_KERNEL_ARCH} \
oldconfig oldconfig
case "${CT_KERNEL_ARCH}" in case "${CT_KERNEL_ARCH}" in
sh*) # sh does secret stuff in 'make prepare' that can't be sh*) # sh does secret stuff in 'make prepare' that can't be
@ -166,7 +166,7 @@ do_kernel_copy() {
ARCH=${CT_KERNEL_ARCH} ${V_OPT} \ ARCH=${CT_KERNEL_ARCH} ${V_OPT} \
prepare include/linux/version.h prepare include/linux/version.h
;; ;;
arm*|cris*) make ${PARALLELMFLAGS} \ arm*|cris*) make ${PARALLELMFLAGS} \
ARCH=${CT_KERNEL_ARCH} ${V_OPT} \ ARCH=${CT_KERNEL_ARCH} ${V_OPT} \
include/asm include/linux/version.h \ include/asm include/linux/version.h \
include/asm-${CT_KERNEL_ARCH}/.arch include/asm-${CT_KERNEL_ARCH}/.arch

View File

@ -5,7 +5,7 @@
do_print_filename() { do_print_filename() {
[ "${CT_LIBC}" = "glibc" ] || return 0 [ "${CT_LIBC}" = "glibc" ] || return 0
echo "glibc-${CT_LIBC_VERSION}" echo "glibc-${CT_LIBC_VERSION}"
for addon in `do_libc_add_ons_list " "`; do for addon in $(do_libc_add_ons_list " "); do
# NPTL addon is not to be downloaded, in any case # NPTL addon is not to be downloaded, in any case
[ "${addon}" = "nptl" ] && continue || true [ "${addon}" = "nptl" ] && continue || true
echo "glibc-${addon}-${CT_LIBC_VERSION}" echo "glibc-${addon}-${CT_LIBC_VERSION}"
@ -20,7 +20,7 @@ do_libc_get() {
CT_GetFile "${CT_LIBC_FILE}" {ftp,http}://ftp.gnu.org/gnu/glibc CT_GetFile "${CT_LIBC_FILE}" {ftp,http}://ftp.gnu.org/gnu/glibc
# C library addons # C library addons
for addon in `do_libc_add_ons_list " "`; do for addon in $(do_libc_add_ons_list " "); do
# NPTL addon is not to be downloaded, in any case # NPTL addon is not to be downloaded, in any case
[ "${addon}" = "nptl" ] && continue || true [ "${addon}" = "nptl" ] && continue || true
CT_GetFile "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}" {ftp,http}://ftp.gnu.org/gnu/glibc CT_GetFile "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}" {ftp,http}://ftp.gnu.org/gnu/glibc
@ -34,7 +34,7 @@ do_libc_extract() {
CT_ExtractAndPatch "${CT_LIBC_FILE}" CT_ExtractAndPatch "${CT_LIBC_FILE}"
# C library addons # C library addons
for addon in `do_libc_add_ons_list " "`; do for addon in $(do_libc_add_ons_list " "); do
# NPTL addon is not to be extracted, in any case # NPTL addon is not to be extracted, in any case
[ "${addon}" = "nptl" ] && continue || true [ "${addon}" = "nptl" ] && continue || true
CT_ExtractAndPatch "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}" CT_ExtractAndPatch "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}"
@ -77,15 +77,15 @@ do_libc_headers() {
# Override libc_cv_ppc_machine so glibc-cvs doesn't complain # Override libc_cv_ppc_machine so glibc-cvs doesn't complain
# 'a version of binutils that supports .machine "altivec" is needed'. # 'a version of binutils that supports .machine "altivec" is needed'.
addons_config="--enable-add-ons=`do_libc_add_ons_list ,`" addons_config="--enable-add-ons=$(do_libc_add_ons_list ,)"
# We need to remove any threading addon when installing headers # We need to remove any threading addon when installing headers
addons_config="${addons_config//nptl/}" addons_config="${addons_config//nptl/}"
addons_config="${addons_config//linuxthreads/}" addons_config="${addons_config//linuxthreads/}"
addons_config=`echo "${addons_config}" |sed -r -e 's/^,+//; s/,+$//; s/,+/,/g;'` addons_config=$(echo "${addons_config}" |sed -r -e 's/^,+//; s/,+$//; s/,+/,/g;')
cross_cc=`CT_Which "${CT_TARGET}-gcc"` cross_cc=$(CT_Which "${CT_TARGET}-gcc")
CT_DoLog DEBUG "Using gcc for target: \"${cross_cc}\"" CT_DoLog DEBUG "Using gcc for target: '${cross_cc}'"
CT_DoLog DEBUG "Extra config passed : \"${addons_config}\"" CT_DoLog DEBUG "Extra config passed : '${addons_config}'"
libc_cv_ppc_machine=yes \ libc_cv_ppc_machine=yes \
CC=${cross_cc} \ CC=${cross_cc} \
@ -196,7 +196,7 @@ do_libc_start_files() {
extra_config="" extra_config=""
case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in
*enable-kernel*) ;; *enable-kernel*) ;;
*) extra_config="${extra_config} --enable-kernel=`echo ${CT_KERNEL_VERSION} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;'`" *) extra_config="${extra_config} --enable-kernel=$(echo ${CT_KERNEL_VERSION} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')"
esac esac
case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in
*-tls*) ;; *-tls*) ;;
@ -213,7 +213,7 @@ do_libc_start_files() {
# Obviously, we want threads, as we come here only for NPTL # Obviously, we want threads, as we come here only for NPTL
extra_config="${extra_config} --with-__thread" extra_config="${extra_config} --with-__thread"
addons_config="--enable-add-ons=`do_libc_add_ons_list ,`" addons_config="--enable-add-ons=$(do_libc_add_ons_list ,)"
extra_config="${extra_config} ${addons_config}" extra_config="${extra_config} ${addons_config}"
# Add some default CC args # Add some default CC args
@ -229,11 +229,11 @@ do_libc_start_files() {
fi fi
extra_cc_args="${extra_cc_args} ${CT_ARCH_ENDIAN_OPT}" extra_cc_args="${extra_cc_args} ${CT_ARCH_ENDIAN_OPT}"
cross_cc=`CT_Which "${CT_TARGET}-gcc"` cross_cc=$(CT_Which "${CT_TARGET}-gcc")
CT_DoLog DEBUG "Using gcc for target : \"${cross_cc}\"" CT_DoLog DEBUG "Using gcc for target : '${cross_cc}'"
CT_DoLog DEBUG "Configuring with addons : \"`do_libc_add_ons_list ,`\"" CT_DoLog DEBUG "Configuring with addons : '$(do_libc_add_ons_list ,)'"
CT_DoLog DEBUG "Extra config args passed: \"${extra_config}\"" CT_DoLog DEBUG "Extra config args passed: '${extra_config}'"
CT_DoLog DEBUG "Extra CC args passed : \"${extra_cc_args}\"" CT_DoLog DEBUG "Extra CC args passed : '${extra_cc_args}'"
# Super-H really needs to set configparms as of gcc-3.4/glibc-2.3.2 # Super-H really needs to set configparms as of gcc-3.4/glibc-2.3.2
# note: this is awkward, doesn't work well if you need more than one # note: this is awkward, doesn't work well if you need more than one
@ -292,7 +292,7 @@ do_libc() {
# We don't need to be conditional on wether the user did set different # We don't need to be conditional on wether the user did set different
# values, as they CT_LIBC_GLIBC_EXTRA_CONFIG is passed after extra_config # values, as they CT_LIBC_GLIBC_EXTRA_CONFIG is passed after extra_config
extra_config="--enable-kernel=`echo ${CT_KERNEL_VERSION} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;'`" extra_config="--enable-kernel=$(echo ${CT_KERNEL_VERSION} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')"
case "${CT_THREADS}" in case "${CT_THREADS}" in
nptl) extra_config="${extra_config} --with-__thread --with-tls";; nptl) extra_config="${extra_config} --with-__thread --with-tls";;
@ -315,9 +315,9 @@ do_libc() {
,y) extra_config="${extra_config} --without-fp";; ,y) extra_config="${extra_config} --without-fp";;
esac esac
case "`do_libc_add_ons_list ,`" in case "$(do_libc_add_ons_list ,)" in
"") ;; "") ;;
*) extra_config="${extra_config} --enable-add-ons=`do_libc_add_ons_list ,`";; *) extra_config="${extra_config} --enable-add-ons=$(do_libc_add_ons_list ,)";;
esac esac
@ -334,11 +334,11 @@ do_libc() {
fi fi
extra_cc_args="${extra_cc_args} ${CT_ARCH_ENDIAN_OPT}" extra_cc_args="${extra_cc_args} ${CT_ARCH_ENDIAN_OPT}"
cross_cc=`CT_Which "${CT_TARGET}-gcc"` cross_cc=$(CT_Which "${CT_TARGET}-gcc")
CT_DoLog DEBUG "Using gcc for target : \"${cross_cc}\"" CT_DoLog DEBUG "Using gcc for target : '${cross_cc}'"
CT_DoLog DEBUG "Configuring with addons : \"`do_libc_add_ons_list ,`\"" CT_DoLog DEBUG "Configuring with addons : '$(do_libc_add_ons_list ,)'"
CT_DoLog DEBUG "Extra config args passed: \"${extra_config}\"" CT_DoLog DEBUG "Extra config args passed: '${extra_config}'"
CT_DoLog DEBUG "Extra CC args passed : \"${extra_cc_args}\"" CT_DoLog DEBUG "Extra CC args passed : '${extra_cc_args}'"
# sh3 and sh4 really need to set configparms as of gcc-3.4/glibc-2.3.2 # sh3 and sh4 really need to set configparms as of gcc-3.4/glibc-2.3.2
# note: this is awkward, doesn't work well if you need more than one line in configparms # note: this is awkward, doesn't work well if you need more than one line in configparms
@ -446,7 +446,7 @@ do_libc() {
for dir in lib lib64 usr/lib usr/lib64; do for dir in lib lib64 usr/lib usr/lib64; do
if [ -f "${CT_SYSROOT_DIR}/${dir}/${file}" -a ! -L ${CT_SYSROOT_DIR}/$lib/$file ]; then if [ -f "${CT_SYSROOT_DIR}/${dir}/${file}" -a ! -L ${CT_SYSROOT_DIR}/$lib/$file ]; then
cp "${CT_SYSROOT_DIR}/${dir}/${file}" "${CT_SYSROOT_DIR}/${dir}/${file}_orig" cp "${CT_SYSROOT_DIR}/${dir}/${file}" "${CT_SYSROOT_DIR}/${dir}/${file}_orig"
CT_DoLog DEBUG "Fixing \"${CT_SYS_ROOT_DIR}/${dir}/${file}\"" CT_DoLog DEBUG "Fixing '${CT_SYS_ROOT_DIR}/${dir}/${file}'"
sed -i -r -e 's,/usr/lib/,,g; sed -i -r -e 's,/usr/lib/,,g;
s,/usr/lib64/,,g; s,/usr/lib64/,,g;
s,/lib/,,g; s,/lib/,,g;
@ -488,7 +488,7 @@ do_libc_finish() {
# Build up the addons list, separated with $1 # Build up the addons list, separated with $1
do_libc_add_ons_list() { do_libc_add_ons_list() {
local sep="$1" local sep="$1"
local addons_list=`echo "${CT_LIBC_ADDONS_LIST//,/${sep}}" |tr -s ,` local addons_list=$(echo "${CT_LIBC_ADDONS_LIST//,/${sep}}" |tr -s ,)
case "${CT_THREADS}" in case "${CT_THREADS}" in
none) ;; none) ;;
*) addons_list="${addons_list}${sep}${CT_THREADS}";; *) addons_list="${addons_list}${sep}${CT_THREADS}";;

View File

@ -218,8 +218,8 @@ ENDSED
# From http://www.uclibc.org/cgi-bin/viewcvs.cgi?rev=16846&view=rev # From http://www.uclibc.org/cgi-bin/viewcvs.cgi?rev=16846&view=rev
# " we just want the kernel headers, not the whole kernel source ... # " we just want the kernel headers, not the whole kernel source ...
# " so people may need to update their paths slightly # " so people may need to update their paths slightly
quoted_kernel_source=`echo "${CT_HEADERS_DIR}" | sed -r -e 's,/include/?$,,; s,/,\\\\/,g;'` quoted_kernel_source=$(echo "${CT_HEADERS_DIR}" | sed -r -e 's,/include/?$,,; s,/,\\/,g;')
quoted_headers_dir=`echo ${CT_HEADERS_DIR} | sed -r -e 's,/,\\\\/,g;'` quoted_headers_dir=$(echo "${CT_HEADERS_DIR}" | sed -r -e 's,/,\\/,g;')
# CROSS_COMPILER_PREFIX is left as is, as the CROSS parameter is forced on the command line # CROSS_COMPILER_PREFIX is left as is, as the CROSS parameter is forced on the command line
# DEVEL_PREFIX is left as '/usr/' because it is post-pended to $PREFIX, wich is the correct value of ${PREFIX}/${TARGET} # DEVEL_PREFIX is left as '/usr/' because it is post-pended to $PREFIX, wich is the correct value of ${PREFIX}/${TARGET}
# Some (old) versions of uClibc use KERNEL_SOURCE (which is _wrong_), and # Some (old) versions of uClibc use KERNEL_SOURCE (which is _wrong_), and

View File

@ -42,24 +42,24 @@ case "${CT_SSTRIP_FROM}" in
return 0 return 0
fi fi
if [ -f "${CT_LOCAL_TARBALLS_DIR}/sstrip.c" ]; then if [ -f "${CT_LOCAL_TARBALLS_DIR}/sstrip.c" ]; then
CT_DoLog EXTRA "Using \"sstrip\" from local storage" CT_DoLog EXTRA "Using 'sstrip' from local storage"
ln -sf "${CT_LOCAL_TARBALLS_DIR}/sstrip.c" \ ln -sf "${CT_LOCAL_TARBALLS_DIR}/sstrip.c" \
"${CT_TARBALLS_DIR}/sstrip.c" 2>&1 |CT_DoLog ALL "${CT_TARBALLS_DIR}/sstrip.c" 2>&1 |CT_DoLog ALL
return 0 return 0
fi fi
CT_Pushd "${CT_TARBALLS_DIR}" CT_Pushd "${CT_TARBALLS_DIR}"
CT_DoLog EXTRA "Retrieving \"sstrip\" from network" CT_DoLog EXTRA "Retrieving 'sstrip' from network"
http_data=`lynx -dump "${sstrip_url}"` http_data=$(lynx -dump "${sstrip_url}")
link=`echo -en "${http_data}" \ link=$(echo -en "${http_data}" \
|egrep '\[[[:digit:]]+\]download' \ |egrep '\[[[:digit:]]+\]download' \
|sed -r -e 's/.*\[([[:digit:]]+)\]download.*/\1/;'` |sed -r -e 's/.*\[([[:digit:]]+)\]download.*/\1/;')
rev_url=`echo -en "${http_data}" \ rev_url=$(echo -en "${http_data}" \
|egrep '^ *8\.' \ |egrep '^ *8\.' \
|sed -r -e 's/^ *'${link}'\. +(.+)$/\1/;'` |sed -r -e 's/^ *'${link}'\. +(.+)$/\1/;')
CT_DoGetFile "${rev_url}" 2>&1 |CT_DoLog ALL CT_DoGetFile "${rev_url}" 2>&1 |CT_DoLog ALL
mv -v sstrip.c?* sstrip.c 2>&1 |CT_DoLog DEBUG mv -v sstrip.c?* sstrip.c 2>&1 |CT_DoLog DEBUG
if [ "${CT_SAVE_TARBALLS}" = "y" ]; then if [ "${CT_SAVE_TARBALLS}" = "y" ]; then
CT_DoLog EXTRA "Saving \"sstrip.c\" to local storage" CT_DoLog EXTRA "Saving 'sstrip.c' to local storage"
cp -v sstrip.c "${CT_LOCAL_TARBALLS_DIR}" 2>&1 |CT_DoLog DEBUG cp -v sstrip.c "${CT_LOCAL_TARBALLS_DIR}" 2>&1 |CT_DoLog DEBUG
fi fi
CT_Popd CT_Popd

View File

@ -20,8 +20,8 @@
# - initialise logging. # - initialise logging.
. "${CT_LIB_DIR}/scripts/functions" . "${CT_LIB_DIR}/scripts/functions"
CT_STAR_DATE=`CT_DoDate +%s%N` CT_STAR_DATE=$(CT_DoDate +%s%N)
CT_STAR_DATE_HUMAN=`CT_DoDate +%Y%m%d.%H%M%S` CT_STAR_DATE_HUMAN=$(CT_DoDate +%Y%m%d.%H%M%S)
# Are we configured? We'll need that later... # Are we configured? We'll need that later...
CT_TestOrAbort "Configuration file not found. Please create one." -f "${CT_TOP_DIR}/.config" CT_TestOrAbort "Configuration file not found. Please create one." -f "${CT_TOP_DIR}/.config"
@ -104,12 +104,12 @@ if [ -n "${CT_RESTART}" -a ! -d "${CT_STATE_DIR}" ]; then
fi fi
# Make all path absolute, it so much easier! # Make all path absolute, it so much easier!
CT_LOCAL_TARBALLS_DIR="`CT_MakeAbsolutePath \"${CT_LOCAL_TARBALLS_DIR}\"`" CT_LOCAL_TARBALLS_DIR=$(CT_MakeAbsolutePath "${CT_LOCAL_TARBALLS_DIR}")
# If the local tarball directory does not exist, say so, and don't try to save there! # If the local tarball directory does not exist, say so, and don't try to save there!
if [ ! -d "${CT_LOCAL_TARBALLS_DIR}" ]; then 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." CT_DoLog WARN "Directory '${CT_LOCAL_TARBALLS_DIR}' does not exist. Will not save downloaded tarballs to local storage."
CT_SAVE_TARBALLS="" CT_SAVE_TARBALLS=
fi fi
# Some more sanity checks now that we have all paths set up # Some more sanity checks now that we have all paths set up
@ -119,23 +119,23 @@ esac
# Check now if we can write to the destination directory: # Check now if we can write to the destination directory:
if [ -d "${CT_INSTALL_DIR}" ]; then if [ -d "${CT_INSTALL_DIR}" ]; then
CT_TestAndAbort "Destination directory \"${CT_INSTALL_DIR}\" is not removable" ! -w `dirname "${CT_INSTALL_DIR}"` CT_TestAndAbort "Destination directory '${CT_INSTALL_DIR}' is not removable" ! -w $(dirname "${CT_INSTALL_DIR}")
fi fi
# Good, now grab a bit of informations on the system we're being run on, # Good, now grab a bit of informations on the system we're being run on,
# just in case something goes awok, and it's not our fault: # just in case something goes awok, and it's not our fault:
CT_SYS_USER="`id -un`" CT_SYS_USER=$(id -un)
CT_SYS_HOSTNAME=`hostname -f 2>/dev/null || true` CT_SYS_HOSTNAME=$(hostname -f 2>/dev/null || true)
# Hmmm. Some non-DHCP-enabled machines do not have an FQDN... Fall back to node name. # Hmmm. Some non-DHCP-enabled machines do not have an FQDN... Fall back to node name.
CT_SYS_HOSTNAME="${CT_SYS_HOSTNAME:-`uname -n`}" CT_SYS_HOSTNAME="${CT_SYS_HOSTNAME:-$(uname -n)}"
CT_SYS_KERNEL=`uname -s` CT_SYS_KERNEL=$(uname -s)
CT_SYS_REVISION=`uname -r` CT_SYS_REVISION=$(uname -r)
# MacOS X lacks '-o' : # MacOS X lacks '-o' :
CT_SYS_OS=`uname -o || echo "Unknown (maybe MacOS-X)"` CT_SYS_OS=$(uname -o || echo "Unknown (maybe MacOS-X)")
CT_SYS_MACHINE=`uname -m` CT_SYS_MACHINE=$(uname -m)
CT_SYS_PROCESSOR=`uname -p` CT_SYS_PROCESSOR=$(uname -p)
CT_SYS_GCC=`gcc -dumpversion` CT_SYS_GCC=$(gcc -dumpversion)
CT_SYS_TARGET=`CT_DoConfigGuess` CT_SYS_TARGET=$(CT_DoConfigGuess)
CT_TOOLCHAIN_ID="crosstool-${CT_VERSION} build ${CT_STAR_DATE_HUMAN} by ${CT_SYS_USER}@${CT_SYS_HOSTNAME}" CT_TOOLCHAIN_ID="crosstool-${CT_VERSION} build ${CT_STAR_DATE_HUMAN} by ${CT_SYS_USER}@${CT_SYS_HOSTNAME}"
CT_DoLog EXTRA "Preparing working directories" CT_DoLog EXTRA "Preparing working directories"
@ -315,8 +315,8 @@ esac
if [ -z "${CT_RESTART}" ]; then if [ -z "${CT_RESTART}" ]; then
# Determine build system if not set by the user # Determine build system if not set by the user
CT_Test "You did not specify the build system. That's OK, I can guess..." -z "${CT_BUILD}" CT_Test "You did not specify the build system. That's OK, I can guess..." -z "${CT_BUILD}"
CT_BUILD="${CT_BUILD:-`CT_DoConfigGuess`}" CT_BUILD="${CT_BUILD:-$(CT_DoConfigGuess)}"
CT_BUILD=`CT_DoConfigSub "${CT_BUILD}"` CT_BUILD=$(CT_DoConfigSub "${CT_BUILD}")
# Arrange paths depending on wether we use sys-root or not. # Arrange paths depending on wether we use sys-root or not.
if [ "${CT_USE_SYSROOT}" = "y" ]; then if [ "${CT_USE_SYSROOT}" = "y" ]; then
@ -352,7 +352,7 @@ if [ -z "${CT_RESTART}" ]; then
mkdir -p "${CT_SYSROOT_DIR}/usr/lib" mkdir -p "${CT_SYSROOT_DIR}/usr/lib"
# Canadian-cross are really picky on the way they are built. Tweak the values. # Canadian-cross are really picky on the way they are built. Tweak the values.
CT_UNIQ_BUILD=`echo "${CT_BUILD}" |sed -r -e 's/-/-build_/'` CT_UNIQ_BUILD=$(echo "${CT_BUILD}" |sed -r -e 's/-/-build_/')
if [ "${CT_CANADIAN}" = "y" ]; then if [ "${CT_CANADIAN}" = "y" ]; then
# Arrange so that gcc never, ever think that build system == host system # Arrange so that gcc never, ever think that build system == host system
CT_CANADIAN_OPT="--build=${CT_UNIQ_BUILD}" CT_CANADIAN_OPT="--build=${CT_UNIQ_BUILD}"
@ -383,7 +383,7 @@ if [ -z "${CT_RESTART}" ]; then
# (Copied almost as-is from original crosstool): # (Copied almost as-is from original crosstool):
case "${CT_KERNEL},${CT_CANADIAN}" in case "${CT_KERNEL},${CT_CANADIAN}" in
cygwin,y) ;; cygwin,y) ;;
*,y) CT_HOST="`echo \"${CT_HOST}\" |sed -r -e 's/-/-host_/;'`";; *,y) CT_HOST=$(echo "${CT_HOST}" |sed -r -e 's/-/-host_/;');;
esac esac
# Ah! Recent versions of binutils need some of the build and/or host system # Ah! Recent versions of binutils need some of the build and/or host system
@ -392,7 +392,7 @@ if [ -z "${CT_RESTART}" ]; then
CT_DoLog DEBUG "Making build system tools available" CT_DoLog DEBUG "Making build system tools available"
mkdir -p "${CT_PREFIX_DIR}/bin" mkdir -p "${CT_PREFIX_DIR}/bin"
for tool in ar as dlltool ${CT_CC_NATIVE:=gcc} gnatbind gnatmake ld nm ranlib strip windres objcopy objdump; do for tool in ar as dlltool ${CT_CC_NATIVE:=gcc} gnatbind gnatmake ld nm ranlib strip windres objcopy objdump; do
tmp=`CT_Which ${tool}` tmp=$(CT_Which ${tool})
if [ -n "${tmp}" ]; then if [ -n "${tmp}" ]; then
ln -sfv "${tmp}" "${CT_PREFIX_DIR}/bin/${CT_BUILD}-${tool}" ln -sfv "${tmp}" "${CT_PREFIX_DIR}/bin/${CT_BUILD}-${tool}"
ln -sfv "${tmp}" "${CT_PREFIX_DIR}/bin/${CT_UNIQ_BUILD}-${tool}" ln -sfv "${tmp}" "${CT_PREFIX_DIR}/bin/${CT_UNIQ_BUILD}-${tool}"
@ -480,7 +480,7 @@ if [ "${CT_ONLY_DOWNLOAD}" != "y" -a "${CT_ONLY_EXTRACT}" != "y" ]; then
else else
CT_DoSaveState ${step} CT_DoSaveState ${step}
if [ ${do_stop} -eq 1 ]; then if [ ${do_stop} -eq 1 ]; then
CT_DoLog ERROR "Stopping just after step \"${prev_step}\", as requested." CT_DoLog ERROR "Stopping just after step '${prev_step}', as requested."
exit 0 exit 0
fi fi
fi fi
@ -490,7 +490,7 @@ if [ "${CT_ONLY_DOWNLOAD}" != "y" -a "${CT_ONLY_EXTRACT}" != "y" ]; then
do_stop=1 do_stop=1
fi fi
if [ "${CTDEBUG_CT_PAUSE_STEPS}" = "y" ]; then if [ "${CTDEBUG_CT_PAUSE_STEPS}" = "y" ]; then
CT_DoPause "Step \"${step}\" finished" CT_DoPause "Step '${step}' finished"
fi fi
fi fi
prev_step="${step}" prev_step="${step}"
@ -513,13 +513,13 @@ if [ "${CT_ONLY_DOWNLOAD}" != "y" -a "${CT_ONLY_EXTRACT}" != "y" ]; then
CT_Pushd "${CT_PREFIX_DIR}/bin" CT_Pushd "${CT_PREFIX_DIR}/bin"
for t in "${CT_TARGET}-"*; do for t in "${CT_TARGET}-"*; do
if [ -n "${CT_TARGET_ALIAS}" ]; then if [ -n "${CT_TARGET_ALIAS}" ]; then
_t="`echo \"$t\" |sed -r -e 's/^'\"${CT_TARGET}\"'-/'\"${CT_TARGET_ALIAS}\"'-/;'`" _t=$(echo "$t" |sed -r -e 's/^'"${CT_TARGET}"'-/'"${CT_TARGET_ALIAS}"'-/;')
CT_DoLog DEBUG "Linking \"${_t}\" -> \"${t}\"" CT_DoLog DEBUG "Linking '${_t}' -> '${t}'"
ln -sv "${t}" "${_t}" 2>&1 |CT_DoLog ALL ln -sv "${t}" "${_t}" 2>&1 |CT_DoLog ALL
fi fi
if [ -n "${CT_TARGET_ALIAS_SED_EXPR}" ]; then if [ -n "${CT_TARGET_ALIAS_SED_EXPR}" ]; then
_t="`echo \"$t\" |sed -r -e \"${CT_TARGET_ALIAS_SED_EXPR}\"`" _t=$(echo "$t" |sed -r -e "${CT_TARGET_ALIAS_SED_EXPR}")
CT_DoLog DEBUG "Linking \"${_t}\" -> \"${t}\"" CT_DoLog DEBUG "Linking '${_t}' -> '${t}'"
ln -sv "${t}" "${_t}" 2>&1 |CT_DoLog ALL ln -sv "${t}" "${_t}" 2>&1 |CT_DoLog ALL
fi fi
done done

View File

@ -5,15 +5,15 @@
# Prepare the fault handler # Prepare the fault handler
CT_OnError() { CT_OnError() {
ret=$? ret=$?
CT_DoLog ERROR "Build failed in step \"${CT_STEP_MESSAGE[${CT_STEP_COUNT}]}\"" CT_DoLog ERROR "Build failed in step '${CT_STEP_MESSAGE[${CT_STEP_COUNT}]}'"
for((step=(CT_STEP_COUNT-1); step>1; step--)); do for((step=(CT_STEP_COUNT-1); step>1; step--)); do
CT_DoLog ERROR " called in step \"${CT_STEP_MESSAGE[${step}]}\"" CT_DoLog ERROR " called in step '${CT_STEP_MESSAGE[${step}]}'"
done done
CT_DoLog ERROR "Error happened in \"${BASH_SOURCE[1]}\" in function \"${FUNCNAME[1]}\" (line unknown, sorry)" CT_DoLog ERROR "Error happened in '${BASH_SOURCE[1]}' in function '${FUNCNAME[1]}' (line unknown, sorry)"
for((depth=2; ${BASH_LINENO[$((${depth}-1))]}>0; depth++)); do for((depth=2; ${BASH_LINENO[$((${depth}-1))]}>0; depth++)); do
CT_DoLog ERROR " called from \"${BASH_SOURCE[${depth}]}\" at line # ${BASH_LINENO[${depth}-1]} in function \"${FUNCNAME[${depth}]}\"" CT_DoLog ERROR " called from '${BASH_SOURCE[${depth}]}' at line # ${BASH_LINENO[${depth}-1]} in function '${FUNCNAME[${depth}]}'"
done done
[ "${CT_LOG_TO_FILE}" = "y" ] && CT_DoLog ERROR "Look at \"${CT_LOG_FILE}\" for more info on this error." [ "${CT_LOG_TO_FILE}" = "y" ] && CT_DoLog ERROR "Look at '${CT_LOG_FILE}' for more info on this error."
CT_STEP_COUNT=1 CT_STEP_COUNT=1
CT_DoEnd ERROR CT_DoEnd ERROR
exit $ret exit $ret
@ -75,7 +75,11 @@ CT_DoLog() {
else else
echo "${1}" echo "${1}"
fi |( IFS="\n" # We want the full lines, even leading spaces fi |( IFS="\n" # We want the full lines, even leading spaces
CT_PROG_BAR_CPT=0 _prog_bar_cpt=0
_prog_bar[0]='/'
_prog_bar[1]='-'
_prog_bar[2]='\'
_prog_bar[3]='|'
indent=$((2*CT_STEP_COUNT)) indent=$((2*CT_STEP_COUNT))
while read line; do while read line; do
case "${CT_LOG_SEE_TOOLS_WARN},${line}" in case "${CT_LOG_SEE_TOOLS_WARN},${line}" in
@ -85,19 +89,15 @@ CT_DoLog() {
*"make["?*"]:"*"Stop.") cur_L=ERROR; cur_l=${CT_LOG_LEVEL_ERROR};; *"make["?*"]:"*"Stop.") cur_L=ERROR; cur_l=${CT_LOG_LEVEL_ERROR};;
*) cur_L="${LEVEL}"; cur_l="${level}";; *) cur_L="${LEVEL}"; cur_l="${level}";;
esac esac
l="`printf \"[%-5s]%*s%s%s\" \"${cur_L}\" \"${indent}\" \" \" \"${line}\"`" # There will always be a log file (stdout, fd #1), be it /dev/null
# There will always be a log file, be it /dev/null printf "[%-5s]%*s%s%s\n" "${cur_L}" "${indent}" " " "${line}"
echo -e "${l}"
if [ ${cur_l} -le ${max_level} ]; then if [ ${cur_l} -le ${max_level} ]; then
echo -e "\r${l}" >&6 # Only print to console (fd #6) if log level is high enough.
printf "\r[%-5s]%*s%s%s\n" "${cur_L}" "${indent}" " " "${line}" >&6
fi fi
if [ "${CT_LOG_PROGRESS_BAR}" = "y" ]; then if [ "${CT_LOG_PROGRESS_BAR}" = "y" ]; then
[ ${CT_PROG_BAR_CPT} -eq 0 ] && bar="/" printf "\r[%02d:%02d] %s " $((SECONDS/60)) $((SECONDS%60)) "${_prog_bar[$((_prog_bar_cpt/10))]}" >&6
[ ${CT_PROG_BAR_CPT} -eq 10 ] && bar="-" _prog_bar_cpt=$(((_prog_bar_cpt+1)%40))
[ ${CT_PROG_BAR_CPT} -eq 20 ] && bar="\\"
[ ${CT_PROG_BAR_CPT} -eq 30 ] && bar="|"
printf "\r[%02d:%02d] %s " $((SECONDS/60)) $((SECONDS%60)) "${bar}" >&6
CT_PROG_BAR_CPT=$(((CT_PROG_BAR_CPT+1)%40))
fi fi
done done
) )
@ -110,13 +110,13 @@ CT_DoLog() {
CT_DoEnd() CT_DoEnd()
{ {
local level="$1" local level="$1"
CT_STOP_DATE=`CT_DoDate +%s%N` CT_STOP_DATE=$(CT_DoDate +%s%N)
CT_STOP_DATE_HUMAN=`CT_DoDate +%Y%m%d.%H%M%S` CT_STOP_DATE_HUMAN=$(CT_DoDate +%Y%m%d.%H%M%S)
CT_DoLog "${level:-INFO}" "Build completed at ${CT_STOP_DATE_HUMAN}" CT_DoLog "${level:-INFO}" "Build completed at ${CT_STOP_DATE_HUMAN}"
elapsed=$((CT_STOP_DATE-CT_STAR_DATE)) elapsed=$((CT_STOP_DATE-CT_STAR_DATE))
elapsed_min=$((elapsed/(60*1000*1000*1000))) elapsed_min=$((elapsed/(60*1000*1000*1000)))
elapsed_sec=`printf "%02d" $(((elapsed%(60*1000*1000*1000))/(1000*1000*1000)))` elapsed_sec=$(printf "%02d" $(((elapsed%(60*1000*1000*1000))/(1000*1000*1000))))
elapsed_csec=`printf "%02d" $(((elapsed%(1000*1000*1000))/(10*1000*1000)))` elapsed_csec=$(printf "%02d" $(((elapsed%(1000*1000*1000))/(10*1000*1000))))
CT_DoLog ${level:-INFO} "(elapsed: ${elapsed_min}:${elapsed_sec}.${elapsed_csec})" CT_DoLog ${level:-INFO} "(elapsed: ${elapsed_min}:${elapsed_sec}.${elapsed_csec})"
} }
@ -158,7 +158,7 @@ CT_TestOrAbort() {
# Test the presence of a tool, or abort if not found # Test the presence of a tool, or abort if not found
# Usage: CT_HasOrAbort <tool> # Usage: CT_HasOrAbort <tool>
CT_HasOrAbort() { CT_HasOrAbort() {
CT_TestAndAbort "\"${1}\" not found and needed for successful toolchain build." -z "`CT_Which \"${1}\"`" CT_TestAndAbort "'${1}' not found and needed for successful toolchain build." -z ""$(CT_Which "${1}")
return 0 return 0
} }
@ -183,7 +183,7 @@ CT_STEP_MESSAGE[${CT_STEP_COUNT}]="<none>"
# Memorise a step being done so that any error is caught # Memorise a step being done so that any error is caught
# Usage: CT_DoStep <loglevel> <message> # Usage: CT_DoStep <loglevel> <message>
CT_DoStep() { CT_DoStep() {
local start=`CT_DoDate +%s%N` local start=$(CT_DoDate +%s%N)
CT_DoLog "$1" "=================================================================" CT_DoLog "$1" "================================================================="
CT_DoLog "$1" "$2" CT_DoLog "$1" "$2"
CT_STEP_COUNT=$((CT_STEP_COUNT+1)) CT_STEP_COUNT=$((CT_STEP_COUNT+1))
@ -196,8 +196,8 @@ CT_DoStep() {
# End the step just being done # End the step just being done
# Usage: CT_EndStep # Usage: CT_EndStep
CT_EndStep() { CT_EndStep() {
local stop=`CT_DoDate +%s%N` local stop=$(CT_DoDate +%s%N)
local duration=`printf "%032d" $((stop-${CT_STEP_START[${CT_STEP_COUNT}]})) |sed -r -e 's/([[:digit:]]{2})[[:digit:]]{7}$/\.\1/; s/^0+//; s/^\./0\./;'` local duration=$(printf "%032d" $((stop-${CT_STEP_START[${CT_STEP_COUNT}]})) |sed -r -e 's/([[:digit:]]{2})[[:digit:]]{7}$/\.\1/; s/^0+//; s/^\./0\./;')
local level="${CT_STEP_LEVEL[${CT_STEP_COUNT}]}" local level="${CT_STEP_LEVEL[${CT_STEP_COUNT}]}"
local message="${CT_STEP_MESSAGE[${CT_STEP_COUNT}]}" local message="${CT_STEP_MESSAGE[${CT_STEP_COUNT}]}"
CT_STEP_COUNT=$((CT_STEP_COUNT-1)) CT_STEP_COUNT=$((CT_STEP_COUNT-1))
@ -225,7 +225,7 @@ CT_MakeAbsolutePath() {
# No such directory, fail back to guessing # No such directory, fail back to guessing
case "$1" in case "$1" in
/*) echo "$1";; /*) echo "$1";;
*) echo "`pwd`/$1";; *) echo "$(pwd)/$1";;
esac esac
fi fi
@ -237,7 +237,7 @@ CT_MakeAbsolutePath() {
# Usage: CT_MktempDir foo # Usage: CT_MktempDir foo
CT_MktempDir() { CT_MktempDir() {
# Some mktemp do not allow more than 6 Xs # Some mktemp do not allow more than 6 Xs
eval "$1"="`mktemp -q -d \"${CT_BUILD_DIR}/.XXXXXX\"`" eval "$1"=$(mktemp -q -d "${CT_BUILD_DIR}/.XXXXXX")
CT_TestOrAbort "Could not make temporary directory" -n "${!1}" -a -d "${!1}" CT_TestOrAbort "Could not make temporary directory" -n "${!1}" -a -d "${!1}"
} }
@ -302,8 +302,8 @@ CT_DoGetFileCurl() {
|| true || true
} }
_wget=`CT_Which wget` _wget=$(CT_Which wget)
_curl=`CT_Which curl` _curl=$(CT_Which curl)
# Wrapper function to call one of curl or wget # Wrapper function to call one of curl or wget
# Usage: CT_DoGetFile <URL> # Usage: CT_DoGetFile <URL>
CT_DoGetFile() { CT_DoGetFile() {
@ -330,9 +330,9 @@ CT_GetFile() {
esac esac
# Do we already have it? # Do we already have it?
ext=`CT_GetFileExtension "${file}"` ext=$(CT_GetFileExtension "${file}")
if [ -n "${ext}" ]; then if [ -n "${ext}" ]; then
CT_DoLog DEBUG "Already have \"${file}\"" CT_DoLog DEBUG "Already have '${file}'"
return 0 return 0
fi fi
@ -341,27 +341,27 @@ CT_GetFile() {
# or, as a failover, a file without extension. # or, as a failover, a file without extension.
# Try local copy first, if it exists # Try local copy first, if it exists
for ext in ${first_ext} .tar.bz2 .tar.gz .tgz .tar ''; do for ext in ${first_ext} .tar.bz2 .tar.gz .tgz .tar ''; do
CT_DoLog DEBUG "Trying \"${CT_LOCAL_TARBALLS_DIR}/${file}${ext}\"" CT_DoLog DEBUG "Trying '${CT_LOCAL_TARBALLS_DIR}/${file}${ext}'"
if [ -r "${CT_LOCAL_TARBALLS_DIR}/${file}${ext}" -a \ if [ -r "${CT_LOCAL_TARBALLS_DIR}/${file}${ext}" -a \
"${CT_FORCE_DOWNLOAD}" != "y" ]; then "${CT_FORCE_DOWNLOAD}" != "y" ]; then
CT_DoLog EXTRA "Using \"${file}\" from local storage" CT_DoLog EXTRA "Using '${file}' from local storage"
ln -sv "${CT_LOCAL_TARBALLS_DIR}/${file}${ext}" "${file}${ext}" |CT_DoLog ALL ln -sv "${CT_LOCAL_TARBALLS_DIR}/${file}${ext}" "${file}${ext}" |CT_DoLog ALL
return 0 return 0
fi fi
done done
# Try to download it # Try to download it
CT_DoLog EXTRA "Retrieving \"${file}\" from network" CT_DoLog EXTRA "Retrieving '${file}' from network"
for ext in ${first_ext} .tar.bz2 .tar.gz .tgz .tar ''; do for ext in ${first_ext} .tar.bz2 .tar.gz .tgz .tar ''; do
# Try all urls in turn # Try all urls in turn
for url in "$@"; do for url in "$@"; do
CT_DoLog DEBUG "Trying \"${url}/${file}${ext}\"" CT_DoLog DEBUG "Trying '${url}/${file}${ext}'"
CT_DoGetFile "${url}/${file}${ext}" CT_DoGetFile "${url}/${file}${ext}"
if [ -f "${file}${ext}" ]; then if [ -f "${file}${ext}" ]; then
# No need to test if the file already exists because # No need to test if the file already exists because
# it does NOT. If it did exist, we'd have been stopped # it does NOT. If it did exist, we'd have been stopped
# above, when looking for local copies. # above, when looking for local copies.
if [ "${CT_SAVE_TARBALLS}" = "y" ]; then if [ "${CT_SAVE_TARBALLS}" = "y" ]; then
CT_DoLog EXTRA "Saving \"${file}\" to local storage" CT_DoLog EXTRA "Saving '${file}' to local storage"
mv "${file}${ext}" "${CT_LOCAL_TARBALLS_DIR}" |CT_DoLog ALL mv "${file}${ext}" "${CT_LOCAL_TARBALLS_DIR}" |CT_DoLog ALL
ln -sv "${CT_LOCAL_TARBALLS_DIR}/${file}${ext}" "${file}${ext}" |CT_DoLog ALL ln -sv "${CT_LOCAL_TARBALLS_DIR}/${file}${ext}" "${file}${ext}" |CT_DoLog ALL
fi fi
@ -371,7 +371,7 @@ CT_GetFile() {
done done
CT_Popd CT_Popd
CT_Abort "Could not download \"${file}\", and not present in \"${CT_LOCAL_TARBALLS_DIR}\"" CT_Abort "Could not download '${file}', and not present in '${CT_LOCAL_TARBALLS_DIR}'"
} }
# Extract a tarball and patch the resulting sources if necessary. # Extract a tarball and patch the resulting sources if necessary.
@ -380,13 +380,13 @@ CT_GetFile() {
# in the extra/locale sub-directory of uClibc. # in the extra/locale sub-directory of uClibc.
CT_ExtractAndPatch() { CT_ExtractAndPatch() {
local file="$1" local file="$1"
local base_file=`echo "${file}" |cut -d - -f 1` local base_file=$(echo "${file}" |cut -d - -f 1)
local ver_file=`echo "${file}" |cut -d - -f 2-` local ver_file=$(echo "${file}" |cut -d - -f 2-)
local official_patch_dir local official_patch_dir
local custom_patch_dir local custom_patch_dir
local libc_addon local libc_addon
local ext=`CT_GetFileExtension "${file}"` local ext=$(CT_GetFileExtension "${file}")
CT_TestAndAbort "\"${file}\" not found in \"${CT_TARBALLS_DIR}\"" -z "${ext}" CT_TestAndAbort "'${file}' not found in '${CT_TARBALLS_DIR}'" -z "${ext}"
local full_file="${CT_TARBALLS_DIR}/${file}${ext}" local full_file="${CT_TARBALLS_DIR}/${file}${ext}"
CT_Pushd "${CT_SRC_DIR}" CT_Pushd "${CT_SRC_DIR}"
@ -394,14 +394,14 @@ CT_ExtractAndPatch() {
# Add-ons need a little love, really. # Add-ons need a little love, really.
case "${file}" in case "${file}" in
glibc-[a-z]*-*) glibc-[a-z]*-*)
CT_TestAndAbort "Trying to extract the C-library addon/locales \"${file}\" when C-library not yet extracted" ! -d "${CT_LIBC_FILE}" 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}" cd "${CT_LIBC_FILE}"
libc_addon=y libc_addon=y
[ -f ".${file}.extracted" ] && return 0 [ -f ".${file}.extracted" ] && return 0
touch ".${file}.extracted" touch ".${file}.extracted"
;; ;;
uClibc-locale-*) uClibc-locale-*)
CT_TestAndAbort "Trying to extract the C-library addon/locales \"${file}\" when C-library not yet extracted" ! -d "${CT_LIBC_FILE}" 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" cd "${CT_LIBC_FILE}/extra/locale"
libc_addon=y libc_addon=y
[ -f ".${file}.extracted" ] && return 0 [ -f ".${file}.extracted" ] && return 0
@ -411,16 +411,16 @@ CT_ExtractAndPatch() {
# If the directory exists, then consider extraction and patching done # If the directory exists, then consider extraction and patching done
if [ -d "${file}" ]; then if [ -d "${file}" ]; then
CT_DoLog DEBUG "Already extracted \"${file}\"" CT_DoLog DEBUG "Already extracted '${file}'"
return 0 return 0
fi fi
CT_DoLog EXTRA "Extracting \"${file}\"" CT_DoLog EXTRA "Extracting '${file}'"
case "${ext}" in case "${ext}" in
.tar.bz2) tar xvjf "${full_file}" |CT_DoLog ALL;; .tar.bz2) tar xvjf "${full_file}" |CT_DoLog ALL;;
.tar.gz|.tgz) tar xvzf "${full_file}" |CT_DoLog ALL;; .tar.gz|.tgz) tar xvzf "${full_file}" |CT_DoLog ALL;;
.tar) tar xvf "${full_file}" |CT_DoLog ALL;; .tar) tar xvf "${full_file}" |CT_DoLog ALL;;
*) CT_Abort "Don't know how to handle \"${file}\": unknown extension" ;; *) CT_Abort "Don't know how to handle '${file}': unknown extension" ;;
esac esac
# Snapshots might not have the version number in the extracted directory # Snapshots might not have the version number in the extracted directory
@ -428,23 +428,23 @@ CT_ExtractAndPatch() {
# Overcome this issue by symlink'ing the directory. # Overcome this issue by symlink'ing the directory.
if [ ! -d "${file}" -a "${libc_addon}" != "y" ]; then if [ ! -d "${file}" -a "${libc_addon}" != "y" ]; then
case "${ext}" in case "${ext}" in
.tar.bz2) base=`tar tjf "${full_file}" |head -n 1 |cut -d / -f 1 || true`;; .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.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`;; .tar) base=$(tar tf "${full_file}" |head -n 1 |cut -d / -f 1 || true);;
esac esac
CT_TestOrAbort "There was a problem when extracting \"${file}\"" -d "${base}" -o "${base}" != "${file}" CT_TestOrAbort "There was a problem when extracting '${file}'" -d "${base}" -o "${base}" != "${file}"
ln -s "${base}" "${file}" ln -s "${base}" "${file}"
fi fi
# Kludge: outside this function, we wouldn't know if we had just extracted # Kludge: outside this function, we wouldn't know if we had just extracted
# a libc addon, or a plain package. Apply patches now. # a libc addon, or a plain package. Apply patches now.
CT_DoLog EXTRA "Patching \"${file}\"" CT_DoLog EXTRA "Patching '${file}'"
if [ "${libc_addon}" = "y" ]; then if [ "${libc_addon}" = "y" ]; then
# Some addon tarballs directly contain the correct addon directory, # Some addon tarballs directly contain the correct addon directory,
# while others have the addon directory named after the tarball. # while others have the addon directory named after the tarball.
# Fix that by always using the short name (eg: linuxthreads, ports, etc...) # Fix that by always using the short name (eg: linuxthreads, ports, etc...)
addon_short_name=`echo "${file}" |sed -r -e 's/^[^-]+-//; s/-[^-]+$//;'` addon_short_name=$(echo "${file}" |sed -r -e 's/^[^-]+-//; s/-[^-]+$//;')
[ -d "${addon_short_name}" ] || ln -s "${file}" "${addon_short_name}" [ -d "${addon_short_name}" ] || ln -s "${file}" "${addon_short_name}"
# If libc addon, we're already in the correct place # If libc addon, we're already in the correct place
else else
@ -459,9 +459,9 @@ CT_ExtractAndPatch() {
if [ -n "${patch_dir}" -a -d "${patch_dir}" ]; then if [ -n "${patch_dir}" -a -d "${patch_dir}" ]; then
for p in "${patch_dir}"/*.patch; do for p in "${patch_dir}"/*.patch; do
if [ -f "${p}" ]; then if [ -f "${p}" ]; then
CT_DoLog DEBUG "Applying patch \"${p}\"" CT_DoLog DEBUG "Applying patch '${p}'"
patch -g0 -F1 -p1 -f <"${p}" |CT_DoLog ALL patch -g0 -F1 -p1 -f <"${p}" |CT_DoLog ALL
CT_TestAndAbort "Failed while applying patch file \"${p}\"" ${PIPESTATUS[0]} -ne 0 CT_TestAndAbort "Failed while applying patch file '${p}'" ${PIPESTATUS[0]} -ne 0
fi fi
done done
fi fi
@ -542,7 +542,7 @@ CT_DoBuildTargetTuple() {
case "${CT_KERNEL}" in case "${CT_KERNEL}" in
linux*) CT_TARGET_KERNEL=linux;; linux*) CT_TARGET_KERNEL=linux;;
esac esac
CT_TARGET=`CT_DoConfigSub "${CT_TARGET_ARCH}-${CT_TARGET_VENDOR:-unknown}-${CT_TARGET_KERNEL}-${CT_TARGET_SYS}"` CT_TARGET=$(CT_DoConfigSub "${CT_TARGET_ARCH}-${CT_TARGET_VENDOR:-unknown}-${CT_TARGET_KERNEL}-${CT_TARGET_SYS}")
# Prepare the target CFLAGS # Prepare the target CFLAGS
CT_ARCH_TARGET_CFLAGS="${CT_ARCH_ARCH_CFLAG}" CT_ARCH_TARGET_CFLAGS="${CT_ARCH_ARCH_CFLAG}"
@ -560,7 +560,7 @@ CT_DoPause() {
local foo local foo
local message="${1:-Pausing for your pleasure}" local message="${1:-Pausing for your pleasure}"
CT_DoLog INFO "${message}" CT_DoLog INFO "${message}"
read -p "Press \"Enter\" to continue, or Ctrl-C to stop..." foo >&6 read -p "Press 'Enter' to continue, or Ctrl-C to stop..." foo >&6
return 0 return 0
} }
@ -572,7 +572,7 @@ CT_DoSaveState() {
local state_name="$1" local state_name="$1"
local state_dir="${CT_STATE_DIR}/${state_name}" local state_dir="${CT_STATE_DIR}/${state_name}"
CT_DoLog DEBUG "Saving state to restart at step \"${state_name}\"..." CT_DoLog DEBUG "Saving state to restart at step '${state_name}'..."
rm -rf "${state_dir}" rm -rf "${state_dir}"
mkdir -p "${state_dir}" mkdir -p "${state_dir}"
@ -590,17 +590,17 @@ CT_DoSaveState() {
$0 == "}" { _p = 1; } $0 == "}" { _p = 1; }
' >"${state_dir}/env.sh" ' >"${state_dir}/env.sh"
CT_DoLog DEBUG " Saving CT_CC_CORE_STATIC_PREFIX_DIR=\"${CT_CC_CORE_STATIC_PREFIX_DIR}\"" CT_DoLog DEBUG " Saving CT_CC_CORE_STATIC_PREFIX_DIR='${CT_CC_CORE_STATIC_PREFIX_DIR}'"
CT_Pushd "${CT_CC_CORE_STATIC_PREFIX_DIR}" CT_Pushd "${CT_CC_CORE_STATIC_PREFIX_DIR}"
tar cv${tar_opt}f "${state_dir}/cc_core_static_prefix_dir.tar${tar_ext}" . |CT_DoLog DEBUG tar cv${tar_opt}f "${state_dir}/cc_core_static_prefix_dir.tar${tar_ext}" . |CT_DoLog DEBUG
CT_Popd CT_Popd
CT_DoLog DEBUG " Saving CT_CC_CORE_SHARED_PREFIX_DIR=\"${CT_CC_CORE_SHARED_PREFIX_DIR}\"" CT_DoLog DEBUG " Saving CT_CC_CORE_SHARED_PREFIX_DIR='${CT_CC_CORE_SHARED_PREFIX_DIR}'"
CT_Pushd "${CT_CC_CORE_SHARED_PREFIX_DIR}" CT_Pushd "${CT_CC_CORE_SHARED_PREFIX_DIR}"
tar cv${tar_opt}f "${state_dir}/cc_core_shared_prefix_dir.tar${tar_ext}" . |CT_DoLog DEBUG tar cv${tar_opt}f "${state_dir}/cc_core_shared_prefix_dir.tar${tar_ext}" . |CT_DoLog DEBUG
CT_Popd CT_Popd
CT_DoLog DEBUG " Saving CT_PREFIX_DIR=\"${CT_PREFIX_DIR}\"" CT_DoLog DEBUG " Saving CT_PREFIX_DIR='${CT_PREFIX_DIR}'"
CT_Pushd "${CT_PREFIX_DIR}" CT_Pushd "${CT_PREFIX_DIR}"
tar cv${tar_opt}f "${state_dir}/prefix_dir.tar${tar_ext}" --exclude '*.log' . |CT_DoLog DEBUG tar cv${tar_opt}f "${state_dir}/prefix_dir.tar${tar_ext}" --exclude '*.log' . |CT_DoLog DEBUG
CT_Popd CT_Popd
@ -624,13 +624,13 @@ CT_DoLoadState(){
local old_RESTART="${CT_RESTART}" local old_RESTART="${CT_RESTART}"
local old_STOP="${CT_STOP}" local old_STOP="${CT_STOP}"
CT_TestOrAbort "The previous build did not reach the point where it could be restarted at \"${CT_RESTART}\"" -d "${state_dir}" CT_TestOrAbort "The previous build did not reach the point where it could be restarted at '${CT_RESTART}'" -d "${state_dir}"
# We need to do something special with the log file! # We need to do something special with the log file!
if [ "${CT_LOG_TO_FILE}" = "y" ]; then if [ "${CT_LOG_TO_FILE}" = "y" ]; then
exec >"${state_dir}/tail.log" exec >"${state_dir}/tail.log"
fi fi
CT_DoLog INFO "Restoring state at step \"${state_name}\", as requested." CT_DoLog INFO "Restoring state at step '${state_name}', as requested."
case "${CT_DEBUG_CT_SAVE_STEPS_GZIP}" in case "${CT_DEBUG_CT_SAVE_STEPS_GZIP}" in
y) tar_opt=z; tar_ext=.gz;; y) tar_opt=z; tar_ext=.gz;;
@ -642,17 +642,17 @@ CT_DoLoadState(){
rm -rf "${CT_PREFIX_DIR}" "${CT_CC_CORE_SHARED_PREFIX_DIR}" "${CT_CC_CORE_STATIC_PREFIX_DIR}" rm -rf "${CT_PREFIX_DIR}" "${CT_CC_CORE_SHARED_PREFIX_DIR}" "${CT_CC_CORE_STATIC_PREFIX_DIR}"
mkdir -p "${CT_PREFIX_DIR}" "${CT_CC_CORE_SHARED_PREFIX_DIR}" "${CT_CC_CORE_STATIC_PREFIX_DIR}" mkdir -p "${CT_PREFIX_DIR}" "${CT_CC_CORE_SHARED_PREFIX_DIR}" "${CT_CC_CORE_STATIC_PREFIX_DIR}"
CT_DoLog DEBUG " Restoring CT_PREFIX_DIR=\"${CT_PREFIX_DIR}\"" CT_DoLog DEBUG " Restoring CT_PREFIX_DIR='${CT_PREFIX_DIR}'"
CT_Pushd "${CT_PREFIX_DIR}" CT_Pushd "${CT_PREFIX_DIR}"
tar xv${tar_opt}f "${state_dir}/prefix_dir.tar${tar_ext}" |CT_DoLog DEBUG tar xv${tar_opt}f "${state_dir}/prefix_dir.tar${tar_ext}" |CT_DoLog DEBUG
CT_Popd CT_Popd
CT_DoLog DEBUG " Restoring CT_CC_CORE_SHARED_PREFIX_DIR=\"${CT_CC_CORE_SHARED_PREFIX_DIR}\"" CT_DoLog DEBUG " Restoring CT_CC_CORE_SHARED_PREFIX_DIR='${CT_CC_CORE_SHARED_PREFIX_DIR}'"
CT_Pushd "${CT_CC_CORE_SHARED_PREFIX_DIR}" CT_Pushd "${CT_CC_CORE_SHARED_PREFIX_DIR}"
tar xv${tar_opt}f "${state_dir}/cc_core_shared_prefix_dir.tar${tar_ext}" |CT_DoLog DEBUG tar xv${tar_opt}f "${state_dir}/cc_core_shared_prefix_dir.tar${tar_ext}" |CT_DoLog DEBUG
CT_Popd CT_Popd
CT_DoLog DEBUG " Restoring CT_CC_CORE_STATIC_PREFIX_DIR=\"${CT_CC_CORE_STATIC_PREFIX_DIR}\"" CT_DoLog DEBUG " Restoring CT_CC_CORE_STATIC_PREFIX_DIR='${CT_CC_CORE_STATIC_PREFIX_DIR}'"
CT_Pushd "${CT_CC_CORE_STATIC_PREFIX_DIR}" CT_Pushd "${CT_CC_CORE_STATIC_PREFIX_DIR}"
tar xv${tar_opt}f "${state_dir}/cc_core_static_prefix_dir.tar${tar_ext}" |CT_DoLog DEBUG tar xv${tar_opt}f "${state_dir}/cc_core_static_prefix_dir.tar${tar_ext}" |CT_DoLog DEBUG
CT_Popd CT_Popd

View File

@ -47,8 +47,8 @@ cp "${CT_TOP_DIR}/.config" "${CT_TOP_DIR}/samples/${CT_TARGET}/crosstool.config"
CT_DoAddFileToSample() { CT_DoAddFileToSample() {
source="$1" source="$1"
dest="$2" dest="$2"
inode_s=`ls -i "${source}"` inode_s=$(ls -i "${source}")
inode_d=`ls -i "${dest}" 2>/dev/null || true` inode_d=$(ls -i "${dest}" 2>/dev/null || true)
if [ "${inode_s}" != "${inode_d}" ]; then if [ "${inode_s}" != "${inode_d}" ]; then
cp "${source}" "${dest}" cp "${source}" "${dest}"
fi fi

View File

@ -31,18 +31,18 @@ CT_DoStep DEBUG "Building list of tarballs to add"
CT_TARBALLS_DIR="${CT_TOP_DIR}/targets/tarballs" CT_TARBALLS_DIR="${CT_TOP_DIR}/targets/tarballs"
CT_TARBALLS="" CT_TARBALLS=""
for dir in '' tools debug; do for dir in '' tools debug; do
CT_DoStep DEBUG "Scanning directory \"${dir}\"" CT_DoStep DEBUG "Scanning directory '${dir}'"
for script in "${CT_TOP_DIR}/scripts/build/${dir}/"*.sh; do for script in "${CT_TOP_DIR}/scripts/build/${dir}/"*.sh; do
CT_DoStep DEBUG "Testing component \"${script}\"" CT_DoStep DEBUG "Testing component '${script}'"
[ -n "${script}" ] || continue [ -n "${script}" ] || continue
unset do_print_file_name unset do_print_file_name
. "${script}" . "${script}"
for file in `do_print_filename`; do for file in $(do_print_filename); do
CT_DoLog DEBUG "Finding tarball for \"${file}\"" CT_DoLog DEBUG "Finding tarball for '${file}'"
[ -n "${file}" ] || continue [ -n "${file}" ] || continue
ext=`CT_GetFileExtension "${file}"` ext=$(CT_GetFileExtension "${file}")
CT_TestOrAbort "Missing tarball for: \"${file}\"" -f "${CT_TOP_DIR}/targets/tarballs/${file}${ext}" CT_TestOrAbort "Missing tarball for: '${file}'" -f "${CT_TOP_DIR}/targets/tarballs/${file}${ext}"
CT_DoLog DEBUG "Found \"${file}${ext}\"" CT_DoLog DEBUG "Found '${file}${ext}'"
CT_TARBALLS="${CT_TARBALLS} ${file}${ext}" CT_TARBALLS="${CT_TARBALLS} ${file}${ext}"
done done
CT_EndStep CT_EndStep
@ -57,10 +57,10 @@ mkdir -p "${CT_BUILD_DIR}"
CT_MktempDir tempdir CT_MktempDir tempdir
# Save crosstool-NG, as it is configured for the current toolchain. # Save crosstool-NG, as it is configured for the current toolchain.
topdir=`basename "${CT_TOP_DIR}"` topdir=$(basename "${CT_TOP_DIR}")
CT_Pushd "${CT_TOP_DIR}/.." CT_Pushd "${CT_TOP_DIR}/.."
botdir=`pwd` botdir=$(pwd)
# Build the list of files to exclude # Build the list of files to exclude
CT_DoLog DEBUG "Building list of files to exclude" CT_DoLog DEBUG "Building list of files to exclude"
@ -70,7 +70,7 @@ exclude_list="${tempdir}/${CT_TARGET}.list"
echo "${topdir}/targets/src"; \ echo "${topdir}/targets/src"; \
echo "${topdir}/targets/tst"; \ echo "${topdir}/targets/tst"; \
echo "${topdir}/targets/*-*-*-*"; \ echo "${topdir}/targets/*-*-*-*"; \
for t in `ls -1 "${topdir}/targets/tarballs/"`; do \ for t in $(ls -1 "${topdir}/targets/tarballs/"); do \
case " ${CT_TARBALLS} " in \ case " ${CT_TARBALLS} " in \
*" ${t} "*) ;; \ *" ${t} "*) ;; \
*) echo "${topdir}/targets/tarballs/${t}";; \ *) echo "${topdir}/targets/tarballs/${t}";; \

View File

@ -66,7 +66,7 @@ while [ $i -le $# ]; do
--copy) tool_suffix=copy;; --copy) tool_suffix=copy;;
# Misc: # Misc:
-h|--help) doHelp; exit 0;; -h|--help) doHelp; exit 0;;
-*) echo "Unknown option: \"${!i}\" (use -h/--help for help)."; exit 1;; -*) echo "Unknown option: '${!i}' (use -h/--help for help)."; exit 1;;
*) VERSION="${VERSION} ${!i}";; *) VERSION="${VERSION} ${!i}";;
esac esac
i=$((i+1)) i=$((i+1))
@ -81,9 +81,9 @@ esac
for ver in ${VERSION}; do for ver in ${VERSION}; do
unset DEP L1 L2 L3 L4 L5 FILE unset DEP L1 L2 L3 L4 L5 FILE
v=`echo "${ver}" |sed -r -e 's/-/_/g; s/\./_/g;'` v=$(echo "${ver}" |sed -r -e 's/-/_/g; s/\./_/g;')
if [ "${cat}" = "KERNEL" ]; then if [ "${cat}" = "KERNEL" ]; then
TOOL_SUFFIX="`echo \"${tool_suffix}\" |tr [[:lower:]] [[:upper:]]`" TOOL_SUFFIX=$(echo "${tool_suffix}" |tr [[:lower:]] [[:upper:]])
L1="config ${cat}_${TOOL_SUFFIX}_V_${v}\n" L1="config ${cat}_${TOOL_SUFFIX}_V_${v}\n"
L2=" bool\n" L2=" bool\n"
L3=" prompt \"${ver}${prompt_suffix}\"\n" L3=" prompt \"${ver}${prompt_suffix}\"\n"
@ -105,7 +105,7 @@ for ver in ${VERSION}; do
[ -n "${OBS}" ] && DEP="${DEP} && OBSOLETE" [ -n "${OBS}" ] && DEP="${DEP} && OBSOLETE"
case "${DEP}" in case "${DEP}" in
"") ;; "") ;;
*) L4=" depends on `echo \"${DEP}\" |sed -r -e 's/^ \\&\\& //; s/\\&/\\\\&/g;'`\n" *) L4=" depends on "$(echo "${DEP}" |sed -r -e 's/^ \\&\\& //; s/\\&/\\\\&/g;')"\n"
esac esac
sed -r -i -e 's/^(# CT_INSERT_VERSION_ABOVE)$/'"${L1}${L2}${L3}${L4}"'\n\1/; sed -r -i -e 's/^(# CT_INSERT_VERSION_ABOVE)$/'"${L1}${L2}${L3}${L4}"'\n\1/;
s/^(# CT_INSERT_VERSION_STRING_ABOVE)$/'"${L5}"'\n\1/;' "${FILE}" s/^(# CT_INSERT_VERSION_STRING_ABOVE)$/'"${L5}"'\n\1/;' "${FILE}"

View File

@ -39,10 +39,10 @@ while getopts ":s:d:fvh" CT_OPT; do
h) doHelp h) doHelp
exit 0 exit 0
;; ;;
:) echo "$myname: \"-${OPTARG}\" takes exactly one argument." :) echo "$myname: '-${OPTARG}' takes exactly one argument."
exit 1 exit 1
;; ;;
?) echo "$myname: unknown option \"-${OPTARG}\"." ?) echo "$myname: unknown option '-${OPTARG}'."
exit 1 exit 1
;; ;;
esac esac
@ -54,11 +54,11 @@ if [ -z "${CT_ROOT_SRC_DIR}" -o -z "${CT_ROOT_DST_DIR}" ]; then
exit 1 exit 1
fi fi
if [ ! -d "${CT_ROOT_SRC_DIR}" ]; then if [ ! -d "${CT_ROOT_SRC_DIR}" ]; then
echo "$myname: \"${CT_ROOT_SRC_DIR}\": no such file or directory" echo "$myname: '${CT_ROOT_SRC_DIR}': no such file or directory"
exit 1 exit 1
fi fi
if [ -d "${CT_ROOT_DST_DIR}" -a "${CT_FORCE}" != "y" ]; then if [ -d "${CT_ROOT_DST_DIR}" -a "${CT_FORCE}" != "y" ]; then
echo "$myname: \"${CT_ROOT_DST_DIR}\": already exists" echo "$myname: '${CT_ROOT_DST_DIR}': already exists"
exit 1 exit 1
fi fi
src_inode=$(ls -di "${CT_ROOT_SRC_DIR}") src_inode=$(ls -di "${CT_ROOT_SRC_DIR}")
@ -91,9 +91,9 @@ while [ ${still_needed} -eq 1 ]; do
${CT_ECHO} "Looping..." ${CT_ECHO} "Looping..."
still_needed=0 still_needed=0
for f in $(find . -type f -exec file {} \; |egrep ': ELF [[:digit:]]+-bit .SB (executable|shared object),' |cut -d ":" -f 1); do for f in $(find . -type f -exec file {} \; |egrep ': ELF [[:digit:]]+-bit .SB (executable|shared object),' |cut -d ":" -f 1); do
${CT_ECHO} "Scanning \"${f}\"" ${CT_ECHO} "Scanning '${f}'"
for libname in $("${CT_READELF}" -d "${f}" |egrep '(NEEDED)' |sed -r -e 's,.+\[(.+)\] *$,\1,;'); do for libname in $("${CT_READELF}" -d "${f}" |egrep '(NEEDED)' |sed -r -e 's,.+\[(.+)\] *$,\1,;'); do
${CT_ECHO} " searching for \"${libname}\"" ${CT_ECHO} " searching for '${libname}'"
if [ -e "lib/${libname}" \ if [ -e "lib/${libname}" \
-o -e "usr/lib/${libname}" ]; then -o -e "usr/lib/${libname}" ]; then
${CT_ECHO} " already present" ${CT_ECHO} " already present"
@ -101,14 +101,14 @@ while [ ${still_needed} -eq 1 ]; do
fi fi
# Need to scan .. for libgcc_s et al. # Need to scan .. for libgcc_s et al.
for dir in . usr ..; do for dir in . usr ..; do
${CT_ECHO} -n " trying in \"${dir}\"" ${CT_ECHO} -n " trying in '${dir}'"
tgt_dir="${dir}" tgt_dir="${dir}"
[ "${tgt_dir}" = ".." ] && tgt_dir="usr" [ "${tgt_dir}" = ".." ] && tgt_dir="usr"
libfile="${CT_SYSROOT_DIR}/${dir}/lib/${libname}" libfile="${CT_SYSROOT_DIR}/${dir}/lib/${libname}"
${CT_ECHO} ": \"${libfile}\"" ${CT_ECHO} ": '${libfile}'"
if [ -e "${libfile}" ]; then if [ -e "${libfile}" ]; then
mkdir -p "${dir}/lib" mkdir -p "${dir}/lib"
${CT_ECHO} " installing \"${tgt_dir}/lib/${libname}\"" ${CT_ECHO} " installing '${tgt_dir}/lib/${libname}'"
cp "${libfile}" "${tgt_dir}/lib/${libname}" cp "${libfile}" "${tgt_dir}/lib/${libname}"
still_needed=1 still_needed=1
break break