summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/build/arch/sparc.sh2
-rw-r--r--scripts/build/arch/xtensa.sh61
-rw-r--r--scripts/build/binutils/binutils.sh45
-rw-r--r--scripts/build/cc.sh58
-rw-r--r--scripts/build/cc/gcc.sh (renamed from scripts/build/cc/100-gcc.sh)63
-rw-r--r--scripts/build/companion_libs/050-zlib.sh10
-rw-r--r--scripts/build/companion_libs/100-gmp.sh13
-rw-r--r--scripts/build/companion_libs/110-mpfr.sh10
-rw-r--r--scripts/build/companion_libs/121-isl.sh12
-rw-r--r--scripts/build/companion_libs/130-cloog.sh14
-rw-r--r--scripts/build/companion_libs/140-mpc.sh9
-rw-r--r--scripts/build/companion_libs/200-libelf.sh10
-rw-r--r--scripts/build/companion_libs/210-expat.sh8
-rw-r--r--scripts/build/companion_libs/220-ncurses.sh10
-rw-r--r--scripts/build/companion_libs/320-libiconv.sh8
-rw-r--r--scripts/build/companion_libs/330-gettext.sh8
-rw-r--r--scripts/build/companion_tools.sh2
-rw-r--r--scripts/build/companion_tools/050-make.sh9
-rw-r--r--scripts/build/companion_tools/100-m4.sh8
-rw-r--r--scripts/build/companion_tools/200-autoconf.sh9
-rw-r--r--scripts/build/companion_tools/300-automake.sh9
-rw-r--r--scripts/build/companion_tools/400-libtool.sh9
-rw-r--r--scripts/build/debug.sh2
-rw-r--r--scripts/build/debug/200-duma.sh19
-rw-r--r--scripts/build/debug/300-gdb.sh36
-rw-r--r--scripts/build/debug/400-ltrace.sh15
-rw-r--r--scripts/build/debug/500-strace.sh10
-rw-r--r--scripts/build/internals.sh11
-rw-r--r--scripts/build/kernel/linux.sh77
-rw-r--r--scripts/build/libc/avr-libc.sh38
-rw-r--r--scripts/build/libc/bionic.sh22
-rw-r--r--scripts/build/libc/glibc.sh159
-rw-r--r--scripts/build/libc/mingw-w64.sh (renamed from scripts/build/libc/mingw.sh)34
-rw-r--r--scripts/build/libc/musl.sh14
-rw-r--r--scripts/build/libc/newlib.sh36
-rw-r--r--scripts/build/libc/uClibc.sh83
-rw-r--r--scripts/build/test_suite.sh3
-rw-r--r--scripts/build/test_suite/gcc.sh2
-rw-r--r--scripts/crosstool-NG.sh.in10
-rw-r--r--scripts/functions1088
-rw-r--r--scripts/saveSample.sh.in4
-rw-r--r--scripts/showSamples.sh33
-rw-r--r--scripts/upgrade.sed25
43 files changed, 871 insertions, 1237 deletions
diff --git a/scripts/build/arch/sparc.sh b/scripts/build/arch/sparc.sh
index b5f8140..7433c4d 100644
--- a/scripts/build/arch/sparc.sh
+++ b/scripts/build/arch/sparc.sh
@@ -60,7 +60,7 @@ CT_DoArchGlibcAdjustTuple() {
# earlier (corresponding pthread barrier code is missing). Until this
# support is reintroduced, configure as sparcv9.
sparc-*)
- if [ "${CT_LIBC_GLIBC_2_23_or_later}" = y ]; then
+ if [ "${CT_GLIBC_NO_SPARC_V8}" = y ]; then
CT_DoLog WARN "GLIBC 2.23 and newer only support SPARCv9"
target_=${target_/#sparc-/sparcv9-}
fi
diff --git a/scripts/build/arch/xtensa.sh b/scripts/build/arch/xtensa.sh
index bf94ddf..744bbb2 100644
--- a/scripts/build/arch/xtensa.sh
+++ b/scripts/build/arch/xtensa.sh
@@ -12,67 +12,6 @@ CT_DoArchTupleValues() {
esac
}
-# This function updates the specified component (binutils, gcc, gdb, etc.)
-# with the processor specific configuration.
-CT_ConfigureXtensa() {
- local component="${1}"
- local version="${2}"
- local custom_overlay="xtensa_${CT_ARCH_XTENSA_CUSTOM_NAME}.tar"
- local custom_location="${CT_ARCH_XTENSA_CUSTOM_OVERLAY_LOCATION}"
-
- if [ -z "${CT_ARCH_XTENSA_CUSTOM_NAME}" ]; then
- custom_overlay="xtensa-overlay.tar"
- fi
-
- CT_TestAndAbort "${custom_overlay}: CT_ARCH_XTENSA_CUSTOM_OVERLAY_LOCATION must be set." -z "${custom_location}"
-
- local full_file="${custom_location}/${custom_overlay}"
- local basename="${component}-${version}"
- local ext
-
- ext=${full_file/*./.}
-
- if [ -z "${ext}" ] ; then
- CT_DoLog WARN "'${full_file}' not found"
- return 1
- fi
-
- if [ -e "${CT_SRC_DIR}/.${basename}.configuring" ]; then
- CT_DoLog ERROR "The '${basename}' source were partially configured."
- CT_DoLog ERROR "Please remove first:"
- CT_DoLog ERROR " - the source dir for '${basename}', in '${CT_SRC_DIR}'"
- CT_DoLog ERROR " - the file '${CT_SRC_DIR}/.${basename}.extracted'"
- CT_DoLog ERROR " - the file '${CT_SRC_DIR}/.${basename}.patch'"
- CT_DoLog ERROR " - the file '${CT_SRC_DIR}/.${basename}.configuring'"
- CT_Abort
- fi
-
- CT_DoLog EXTRA "Using '${custom_overlay}' from ${custom_location}"
- CT_DoExecLog DEBUG ln -sf "${custom_location}/${custom_overlay}" \
- "${CT_TARBALLS_DIR}/${custom_overlay}"
-
- CT_DoExecLog DEBUG touch "${CT_SRC_DIR}/.${basename}.configuring"
-
- CT_Pushd "${CT_SRC_DIR}/${basename}"
-
- tar_opts=( "--strip-components=1" )
- tar_opts+=( "-xv" )
-
- case "${ext}" in
- .tar) CT_DoExecLog FILE tar "${tar_opts[@]}" -f "${full_file}" "${component}";;
- .gz|.tgz) gzip -dc "${full_file}" | CT_DoExecLog FILE tar "${tar_opts[@]}" -f - "${component}";;
- .bz2) bzip2 -dc "${full_file}" | CT_DoExecLog FILE tar "${tar_opts[@]}" -f - "${component}";;
- *) CT_DoLog WARN "Don't know how to handle '${basename}${ext}': unknown extension"
- return 1
- ;;
- esac
-
- CT_DoExecLog DEBUG touch "${CT_SRC_DIR}/.${basename}.configured"
- CT_DoExecLog DEBUG rm -f "${CT_SRC_DIR}/.${basename}.configuring"
-
- CT_Popd
-}
-
CT_DoArchUClibcConfig() {
local cfg="${1}"
diff --git a/scripts/build/binutils/binutils.sh b/scripts/build/binutils/binutils.sh
index f378b4f..8fb51b8 100644
--- a/scripts/build/binutils/binutils.sh
+++ b/scripts/build/binutils/binutils.sh
@@ -4,44 +4,17 @@
# Download binutils
do_binutils_get() {
- if [ "${CT_BINUTILS_CUSTOM}" = "y" ]; then
- CT_GetCustom "binutils" "${CT_BINUTILS_CUSTOM_VERSION}" \
- "${CT_BINUTILS_CUSTOM_LOCATION}"
- else
- case "${CT_BINUTILS_VERSION}" in
- linaro-*)
- CT_GetLinaro "binutils" "${CT_BINUTILS_VERSION}"
- ;;
- *)
- CT_GetFile "binutils-${CT_BINUTILS_VERSION}" \
- {http,ftp}://{ftp.gnu.org/gnu,ftp.kernel.org/pub/linux/devel}/binutils \
- ftp://{sourceware.org,gcc.gnu.org}/pub/binutils/{releases,snapshots}
- ;;
- esac
- fi
-
+ CT_Fetch BINUTILS
if [ -n "${CT_ARCH_BINFMT_FLAT}" ]; then
- if [ "${CT_ELF2FLT_CUSTOM}" = "y" ]; then
- CT_GetCustom "elf2flt" "${CT_ELF2FLT_CUSTOM_VERSION}" \
- "${CT_ELF2FLT_CUSTOM_LOCATION}"
- else
- CT_GetGit elf2flt "${CT_ELF2FLT_GIT_CSET}" https://github.com/uclinux-dev/elf2flt.git
- fi
+ CT_Fetch ELF2FLT
fi
}
# Extract binutils
do_binutils_extract() {
- CT_Extract "binutils-${CT_BINUTILS_VERSION}"
- CT_Patch "binutils" "${CT_BINUTILS_VERSION}"
-
+ CT_ExtractPatch BINUTILS
if [ -n "${CT_ARCH_BINFMT_FLAT}" ]; then
- CT_Extract "elf2flt-${CT_ELF2FLT_GIT_CSET}"
- CT_Patch "elf2flt" "${CT_ELF2FLT_GIT_CSET}"
- fi
-
- if [ -n "${CT_ARCH_XTENSA_CUSTOM_NAME}" ]; then
- CT_ConfigureXtensa "binutils" "${CT_BINUTILS_VERSION}"
+ CT_ExtractPatch ELF2FLT
fi
}
@@ -67,7 +40,7 @@ do_binutils_for_build() {
if [ -n "${CT_ARCH_BINFMT_FLAT}" ]; then
# We re-use binutils' options, plus our owns
- binutils_opts+=( "binutils_src=${CT_SRC_DIR}/binutils-${CT_BINUTILS_VERSION}" )
+ binutils_opts+=( "binutils_src=${CT_SRC_DIR}/binutils" )
binutils_opts+=( "binutils_bld=${CT_BUILD_DIR}/build-binutils-build-${CT_BUILD}" )
CT_mkdir_pushd "${CT_BUILD_DIR}/build-elf2flt-build-${CT_BUILD}"
@@ -100,7 +73,7 @@ do_binutils_for_host() {
if [ -n "${CT_ARCH_BINFMT_FLAT}" ]; then
# We re-use binutils' options, plus our owns
- binutils_opts+=( "binutils_src=${CT_SRC_DIR}/binutils-${CT_BINUTILS_VERSION}" )
+ binutils_opts+=( "binutils_src=${CT_SRC_DIR}/binutils" )
binutils_opts+=( "binutils_bld=${CT_BUILD_DIR}/build-binutils-host-${CT_HOST}" )
CT_mkdir_pushd "${CT_BUILD_DIR}/build-elf2flt-host-${CT_HOST}"
@@ -207,7 +180,7 @@ do_binutils_backend() {
CXXFLAGS="${cflags}" \
LDFLAGS="${ldflags}" \
${CONFIG_SHELL} \
- "${CT_SRC_DIR}/binutils-${CT_BINUTILS_VERSION}/configure" \
+ "${CT_SRC_DIR}/binutils/configure" \
--build=${CT_BUILD} \
--host=${host} \
--target=${CT_TARGET} \
@@ -291,7 +264,7 @@ do_elf2flt_backend() {
CFLAGS="${cflags}" \
LDFLAGS="${ldflags}" \
${CONFIG_SHELL} \
- "${CT_SRC_DIR}/elf2flt-${CT_ELF2FLT_VERSION}/configure" \
+ "${CT_SRC_DIR}/elf2flt/configure" \
--build=${CT_BUILD} \
--host=${host} \
--target=${CT_TARGET} \
@@ -351,7 +324,7 @@ do_binutils_for_target() {
CT_DoExecLog CFG \
${CONFIG_SHELL} \
- "${CT_SRC_DIR}/binutils-${CT_BINUTILS_VERSION}/configure" \
+ "${CT_SRC_DIR}/binutils/configure" \
--build=${CT_BUILD} \
--host=${CT_TARGET} \
--target=${CT_TARGET} \
diff --git a/scripts/build/cc.sh b/scripts/build/cc.sh
deleted file mode 100644
index 0db6b9c..0000000
--- a/scripts/build/cc.sh
+++ /dev/null
@@ -1,58 +0,0 @@
-# Wrapper to build the companion tools facilities
-
-# List all companion tools facilities, and parse their scripts
-CT_CC_FACILITY_LIST=
-for f in "${CT_LIB_DIR}/scripts/build/cc/"*.sh; do
- _f="$(basename "${f}" .sh)"
- _f="${_f#???-}"
- __f="CT_CC_${_f}"
- if [ "${!__f}" = "y" ]; then
- CT_DoLog DEBUG "Enabling cc '${_f}'"
- . "${f}"
- CT_CC_FACILITY_LIST="${CT_CC_FACILITY_LIST} ${_f}"
- else
- CT_DoLog DEBUG "Disabling cc '${_f}'"
- fi
-done
-
-# Download the cc facilities
-do_cc_get() {
- for f in ${CT_CC_FACILITY_LIST}; do
- do_${f}_get
- done
-}
-
-# Extract and patch the cc facilities
-do_cc_extract() {
- for f in ${CT_CC_FACILITY_LIST}; do
- do_${f}_extract
- done
-}
-
-# Core pass 1 the cc facilities
-do_cc_core_pass_1() {
- for f in ${CT_CC_FACILITY_LIST}; do
- do_${f}_core_pass_1
- done
-}
-
-# Core pass 2 the cc facilities
-do_cc_core_pass_2() {
- for f in ${CT_CC_FACILITY_LIST}; do
- do_${f}_core_pass_2
- done
-}
-
-# Build for build the cc facilities
-do_cc_for_build() {
- for f in ${CT_CC_FACILITY_LIST}; do
- do_${f}_for_build
- done
-}
-
-# Build for host the cc facilities
-do_cc_for_host() {
- for f in ${CT_CC_FACILITY_LIST}; do
- do_${f}_for_host
- done
-}
diff --git a/scripts/build/cc/100-gcc.sh b/scripts/build/cc/gcc.sh
index 2ca8e6f..6019b35 100644
--- a/scripts/build/cc/100-gcc.sh
+++ b/scripts/build/cc/gcc.sh
@@ -3,53 +3,32 @@
# Licensed under the GPL v2. See COPYING in the root of this package
# Download gcc
-do_gcc_get() {
+do_cc_get() {
local linaro_version=""
local linaro_series=""
- if [ "${CT_CC_GCC_CUSTOM}" = "y" ]; then
- CT_GetCustom "gcc" "${CT_CC_GCC_CUSTOM_VERSION}" \
- "${CT_CC_GCC_CUSTOM_LOCATION}"
- else
- case "${CT_CC_GCC_VERSION}" in
- linaro-*)
- CT_GetLinaro "gcc" "${CT_CC_GCC_VERSION}"
- ;;
- *)
- # The official gcc hosts put gcc under a gcc/release/ directory,
- # whereas the mirrors put it in the gcc/ directory.
- CT_GetFile "gcc-${CT_CC_GCC_VERSION}" \
- {http,ftp,https}://ftp.gnu.org/gnu/gcc/gcc-${CT_CC_GCC_VERSION} \
- ftp://{gcc.gnu.org,sourceware.org}/pub/gcc/releases/gcc-${CT_CC_GCC_VERSION}
- ;;
- esac
- fi # ! custom location
+ CT_Fetch GCC
+
# Starting with GCC 4.3, ecj is used for Java, and will only be
# built if the configure script finds ecj.jar at the top of the
# GCC source tree, which will not be there unless we get it and
# put it there ourselves
if [ "${CT_CC_LANG_JAVA_USE_ECJ}" = "y" ]; then
- CT_GetFile ecj-latest .jar http://mirrors.kernel.org/sourceware/java/ \
- http://crosstool-ng.org/pub/java \
- ftp://gcc.gnu.org/pub/java \
- ftp://sourceware.org/pub/java
+ if ! CT_GetFile ecj-latest .jar $(CT_Mirrors sourceware java); then
+ # Should be a package, too - but with Java retirement in GCC,
+ # it may not make sense.
+ CT_Abort "Failed to download ecj-latest.jar"
+ fi
fi
}
# Extract gcc
-do_gcc_extract() {
- CT_Extract "gcc-${CT_CC_GCC_VERSION}"
- CT_Patch "gcc" "${CT_CC_GCC_VERSION}"
+do_cc_extract() {
+ CT_ExtractPatch GCC
# Copy ecj-latest.jar to ecj.jar at the top of the GCC source tree
- if [ "${CT_CC_LANG_JAVA_USE_ECJ}" = "y" \
- -a ! -f "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/ecj.jar" \
- ]; then
- CT_DoExecLog ALL cp -v "${CT_TARBALLS_DIR}/ecj-latest.jar" "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/ecj.jar"
- fi
-
- if [ -n "${CT_ARCH_XTENSA_CUSTOM_NAME}" ]; then
- CT_ConfigureXtensa "gcc" "${CT_CC_GCC_VERSION}"
+ if [ "${CT_CC_LANG_JAVA_USE_ECJ}" = "y" -a ! -f "${CT_SRC_DIR}/gcc/ecj.jar" ]; then
+ CT_DoExecLog ALL cp -v "${CT_TARBALLS_DIR}/ecj-latest.jar" "${CT_SRC_DIR}/gcc/ecj.jar"
fi
}
@@ -205,7 +184,7 @@ cc_gcc_multilib_housekeeping() {
#------------------------------------------------------------------------------
# Core gcc pass 1
-do_gcc_core_pass_1() {
+do_cc_core_pass_1() {
local -a core_opts
if [ "${CT_CC_CORE_PASS_1_NEEDED}" != "y" ]; then
@@ -231,7 +210,7 @@ do_gcc_core_pass_1() {
}
# Core gcc pass 2
-do_gcc_core_pass_2() {
+do_cc_core_pass_2() {
local -a core_opts
if [ "${CT_CC_CORE_PASS_2_NEEDED}" != "y" ]; then
@@ -575,7 +554,7 @@ do_gcc_core_backend() {
CXXFLAGS_FOR_TARGET="${CT_TARGET_CFLAGS}" \
LDFLAGS_FOR_TARGET="${CT_TARGET_LDFLAGS}" \
${CONFIG_SHELL} \
- "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/configure" \
+ "${CT_SRC_DIR}/gcc/configure" \
--build=${CT_BUILD} \
--host=${host} \
--target=${CT_TARGET} \
@@ -603,7 +582,7 @@ do_gcc_core_backend() {
# so we configure then build it.
# Next we have to configure gcc, create libgcc.mk then edit it...
# So much easier if we just edit the source tree, but hey...
- if [ ! -f "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/gcc/BASE-VER" ]; then
+ if [ ! -f "${CT_SRC_DIR}/gcc/gcc/BASE-VER" ]; then
CT_DoExecLog CFG make ${JOBSFLAGS} configure-libiberty
CT_DoExecLog ALL make ${JOBSFLAGS} -C libiberty libiberty.a
CT_DoExecLog CFG make ${JOBSFLAGS} configure-gcc configure-libcpp
@@ -613,12 +592,12 @@ do_gcc_core_backend() {
CT_DoExecLog ALL make ${JOBSFLAGS} all-libcpp all-build-libiberty
fi
# HACK: gcc-4.2 uses libdecnumber to build libgcc.mk, so build it here.
- if [ -d "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/libdecnumber" ]; then
+ if [ -d "${CT_SRC_DIR}/gcc/libdecnumber" ]; then
CT_DoExecLog CFG make ${JOBSFLAGS} configure-libdecnumber
CT_DoExecLog ALL make ${JOBSFLAGS} -C libdecnumber libdecnumber.a
fi
# HACK: gcc-4.8 uses libbacktrace to make libgcc.mvars, so make it here.
- if [ -d "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/libbacktrace" ]; then
+ if [ -d "${CT_SRC_DIR}/gcc/libbacktrace" ]; then
CT_DoExecLog CFG make ${JOBSFLAGS} configure-libbacktrace
CT_DoExecLog ALL make ${JOBSFLAGS} -C libbacktrace
fi
@@ -711,7 +690,7 @@ do_gcc_core_backend() {
#------------------------------------------------------------------------------
# Build complete gcc to run on build
-do_gcc_for_build() {
+do_cc_for_build() {
local -a build_final_opts
local build_final_backend
@@ -796,7 +775,7 @@ gcc_movelibs() {
#------------------------------------------------------------------------------
# Build final gcc to run on host
-do_gcc_for_host() {
+do_cc_for_host() {
local -a final_opts
local final_backend
@@ -1121,7 +1100,7 @@ do_gcc_backend() {
CXXFLAGS_FOR_TARGET="${CT_TARGET_CFLAGS}" \
LDFLAGS_FOR_TARGET="${CT_TARGET_LDFLAGS}" \
${CONFIG_SHELL} \
- "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/configure" \
+ "${CT_SRC_DIR}/gcc/configure" \
--build=${CT_BUILD} \
--host=${host} \
--target=${CT_TARGET} \
diff --git a/scripts/build/companion_libs/050-zlib.sh b/scripts/build/companion_libs/050-zlib.sh
index a3ba638..868bf3d 100644
--- a/scripts/build/companion_libs/050-zlib.sh
+++ b/scripts/build/companion_libs/050-zlib.sh
@@ -13,14 +13,12 @@ if [ "${CT_ZLIB}" = "y" ]; then
# Download zlib
do_zlib_get() {
- CT_GetFile "zlib-${CT_ZLIB_VERSION}" \
- "http://downloads.sourceforge.net/project/libpng/zlib/${CT_ZLIB_VERSION}"
+ CT_Fetch ZLIB
}
# Extract zlib
do_zlib_extract() {
- CT_Extract "zlib-${CT_ZLIB_VERSION}"
- CT_Patch "zlib" "${CT_ZLIB_VERSION}"
+ CT_ExtractPatch ZLIB
}
# Build zlib for running on build
@@ -87,7 +85,7 @@ do_zlib_backend() {
# zlib treats mingw host differently and requires using a different
# makefile rather than configure+make. It also does not support
# out-of-tree building.
- cp -av "${CT_SRC_DIR}/zlib-${CT_ZLIB_VERSION}/." .
+ cp -av "${CT_SRC_DIR}/zlib/." .
extra_make=( -f win32/Makefile.gcc \
PREFIX="${host}-" \
SHAREDLIB= \
@@ -107,7 +105,7 @@ do_zlib_backend() {
LDFLAGS="${ldflags}" \
CHOST="${host}" \
${CONFIG_SHELL} \
- "${CT_SRC_DIR}/zlib-${CT_ZLIB_VERSION}/configure" \
+ "${CT_SRC_DIR}/zlib/configure" \
--prefix="${prefix}" \
--static \
"${extra_config[@]}"
diff --git a/scripts/build/companion_libs/100-gmp.sh b/scripts/build/companion_libs/100-gmp.sh
index e6a4875..272af66 100644
--- a/scripts/build/companion_libs/100-gmp.sh
+++ b/scripts/build/companion_libs/100-gmp.sh
@@ -13,15 +13,12 @@ if [ "${CT_GMP}" = "y" ]; then
# Download GMP
do_gmp_get() {
- CT_GetFile "gmp-${CT_GMP_VERSION}" \
- https://gmplib.org/download/gmp \
- {http,ftp,https}://ftp.gnu.org/gnu/gmp
+ CT_Fetch GMP
}
# Extract GMP
do_gmp_extract() {
- CT_Extract "gmp-${CT_GMP_VERSION}"
- CT_Patch "gmp" "${CT_GMP_VERSION}"
+ CT_ExtractPatch GMP
}
# Build GMP for running on build
@@ -84,7 +81,9 @@ do_gmp_backend() {
CT_DoLog EXTRA "Configuring GMP"
- if [ ! "${CT_GMP_5_0_2_or_later}" = "y" ]; then
+ # FIXME is it needed even for older versions? They seem to compile fine
+ # without it.
+ if [ "${CT_GMP_HAS_MPBSD}" = "y" ]; then
extra_config+=("--enable-mpbsd")
fi
@@ -95,7 +94,7 @@ do_gmp_backend() {
CFLAGS="${cflags} -fexceptions" \
LDFLAGS="${ldflags}" \
${CONFIG_SHELL} \
- "${CT_SRC_DIR}/gmp-${CT_GMP_VERSION}/configure" \
+ "${CT_SRC_DIR}/gmp/configure" \
--build=${CT_BUILD} \
--host=${host} \
--prefix="${prefix}" \
diff --git a/scripts/build/companion_libs/110-mpfr.sh b/scripts/build/companion_libs/110-mpfr.sh
index 5a89077..b4be3f4 100644
--- a/scripts/build/companion_libs/110-mpfr.sh
+++ b/scripts/build/companion_libs/110-mpfr.sh
@@ -13,16 +13,14 @@ if [ "${CT_MPFR}" = "y" ]; then
# Download MPFR
do_mpfr_get() {
- CT_GetFile "mpfr-${CT_MPFR_VERSION}" \
- {https,http,ftp}://ftp.gnu.org/gnu/mpfr \
- http://www.mpfr.org/mpfr-${CT_MPFR_VERSION}
+ CT_Fetch MPFR
}
# Extract MPFR
do_mpfr_extract() {
- CT_Extract "mpfr-${CT_MPFR_VERSION}"
- CT_Patch "mpfr" "${CT_MPFR_VERSION}"
+ CT_ExtractPatch MPFR
+ # TBD is it a problem with 2.4.x? The comment says it is not, yet the code is run
# OK, Gentoo have a sanity check that libtool.m4 and ltmain.sh have the
# same version number. Unfortunately, some tarballs of MPFR are not
# built sanely, and thus ./configure fails on Gentoo.
@@ -115,7 +113,7 @@ do_mpfr_backend() {
CFLAGS="${cflags}" \
LDFLAGS="${ldflags}" \
${CONFIG_SHELL} \
- "${CT_SRC_DIR}/mpfr-${CT_MPFR_VERSION}/configure" \
+ "${CT_SRC_DIR}/mpfr/configure" \
--build=${CT_BUILD} \
--host=${host} \
--prefix="${prefix}" \
diff --git a/scripts/build/companion_libs/121-isl.sh b/scripts/build/companion_libs/121-isl.sh
index ef93bbd..d96e9ce 100644
--- a/scripts/build/companion_libs/121-isl.sh
+++ b/scripts/build/companion_libs/121-isl.sh
@@ -13,14 +13,12 @@ if [ "${CT_ISL}" = "y" ]; then
# Download ISL
do_isl_get() {
- CT_GetFile "isl-${CT_ISL_VERSION}" \
- http://isl.gforge.inria.fr
+ CT_Fetch ISL
}
# Extract ISL
do_isl_extract() {
- CT_Extract "isl-${CT_ISL_VERSION}"
- CT_Patch "isl" "${CT_ISL_VERSION}"
+ CT_ExtractPatch ISL
}
# Build ISL for running on build
@@ -86,12 +84,12 @@ do_isl_backend() {
CT_DoLog EXTRA "Configuring ISL"
- if [ "${CT_ISL_V_0_12_or_later}" != "y" ]; then
+ if [ "${CT_ISL_NEEDS_WITH_GMP}" != "y" ]; then
extra_config+=("--with-libgmp-prefix=${prefix}")
extra_config+=("--with-libgmpxx-prefix=${prefix}")
fi
- if [ "${CT_ISL_V_0_14_or_later}" != "y" ]; then
+ if [ "${CT_ISL_HAS_WITH_PIPLIB}" != "y" ]; then
extra_config+=("--with-piplib=no")
fi
@@ -100,7 +98,7 @@ do_isl_backend() {
CXXFLAGS="${cxxflags}" \
LDFLAGS="${ldflags}" \
${CONFIG_SHELL} \
- "${CT_SRC_DIR}/isl-${CT_ISL_VERSION}/configure" \
+ "${CT_SRC_DIR}/isl/configure" \
--build=${CT_BUILD} \
--host=${host} \
--prefix="${prefix}" \
diff --git a/scripts/build/companion_libs/130-cloog.sh b/scripts/build/companion_libs/130-cloog.sh
index b21b028..445d259 100644
--- a/scripts/build/companion_libs/130-cloog.sh
+++ b/scripts/build/companion_libs/130-cloog.sh
@@ -13,18 +13,12 @@ if [ "${CT_CLOOG}" = "y" ]; then
# Download CLooG
do_cloog_get() {
- CT_GetFile "cloog-${CT_CLOOG_VERSION}" \
- http://www.bastoul.net/cloog/pages/download \
- ftp://gcc.gnu.org/pub/gcc/infrastructure
+ CT_Fetch CLOOG
}
# Extract CLooG
do_cloog_extract() {
- CT_Extract "cloog-${CT_CLOOG_VERSION}"
- CT_Patch "cloog" "${CT_CLOOG_VERSION}"
-
- # Help the autostuff in case it thinks there are things to regenerate...
- CT_DoExecLog DEBUG mkdir -p "${CT_SRC_DIR}/cloog-${CT_CLOOG_VERSION}/m4"
+ CT_ExtractPatch CLOOG
}
# Build CLooG for running on build
@@ -85,7 +79,7 @@ do_cloog_backend() {
eval "${arg// /\\ }"
done
- if [ "${CT_CLOOG_0_18_or_later}" = y ]; then
+ if [ "${CT_CLOOG_HAS_WITH_GMP_ISL_OSL}" = y ]; then
cloog_opts+=( --with-gmp=system --with-gmp-prefix="${prefix}" )
cloog_opts+=( --with-isl=system --with-isl-prefix="${prefix}" )
cloog_opts+=( --without-osl )
@@ -98,7 +92,7 @@ do_cloog_backend() {
LDFLAGS="${ldflags}" \
LIBS="-lm" \
${CONFIG_SHELL} \
- "${CT_SRC_DIR}/cloog-${CT_CLOOG_VERSION}/configure" \
+ "${CT_SRC_DIR}/cloog/configure" \
--build=${CT_BUILD} \
--host=${host} \
--prefix="${prefix}" \
diff --git a/scripts/build/companion_libs/140-mpc.sh b/scripts/build/companion_libs/140-mpc.sh
index e6efb4f..3136ab4 100644
--- a/scripts/build/companion_libs/140-mpc.sh
+++ b/scripts/build/companion_libs/140-mpc.sh
@@ -13,15 +13,12 @@ if [ "${CT_MPC}" = "y" ]; then
# Download MPC
do_mpc_get() {
- CT_GetFile "mpc-${CT_MPC_VERSION}" .tar.gz \
- {http,ftp,https}://ftp.gnu.org/gnu/mpc \
- http://www.multiprecision.org/mpc/download
+ CT_Fetch MPC
}
# Extract MPC
do_mpc_extract() {
- CT_Extract "mpc-${CT_MPC_VERSION}"
- CT_Patch "mpc" "${CT_MPC_VERSION}"
+ CT_ExtractPatch MPC
}
# Build MPC for running on build
@@ -87,7 +84,7 @@ do_mpc_backend() {
CFLAGS="${cflags}" \
LDFLAGS="${ldflags}" \
${CONFIG_SHELL} \
- "${CT_SRC_DIR}/mpc-${CT_MPC_VERSION}/configure" \
+ "${CT_SRC_DIR}/mpc/configure" \
--build=${CT_BUILD} \
--host=${host} \
--prefix="${prefix}" \
diff --git a/scripts/build/companion_libs/200-libelf.sh b/scripts/build/companion_libs/200-libelf.sh
index 807ce7e..d1ac0b4 100644
--- a/scripts/build/companion_libs/200-libelf.sh
+++ b/scripts/build/companion_libs/200-libelf.sh
@@ -9,15 +9,11 @@ do_libelf_for_target() { :; }
if [ "${CT_LIBELF}" = "y" -o "${CT_LIBELF_TARGET}" = "y" ]; then
do_libelf_get() {
- # The server hosting libelf will return an "HTTP 300 : Multiple Choices"
- # error code if we try to download a file that does not exists there.
- # So we have to request the file with an explicit extension.
- CT_GetFile "libelf-${CT_LIBELF_VERSION}" .tar.gz http://www.mr511.de/software/
+ CT_Fetch LIBELF
}
do_libelf_extract() {
- CT_Extract "libelf-${CT_LIBELF_VERSION}"
- CT_Patch "libelf" "${CT_LIBELF_VERSION}"
+ CT_ExtractPatch LIBELF
}
if [ "${CT_LIBELF}" = "y" ]; then
@@ -131,7 +127,7 @@ do_libelf_backend() {
CFLAGS="${cflags} -fPIC" \
LDFLAGS="${ldflags}" \
${CONFIG_SHELL} \
- "${CT_SRC_DIR}/libelf-${CT_LIBELF_VERSION}/configure" \
+ "${CT_SRC_DIR}/libelf/configure" \
--build=${CT_BUILD} \
--host=${host} \
--target=${CT_TARGET} \
diff --git a/scripts/build/companion_libs/210-expat.sh b/scripts/build/companion_libs/210-expat.sh
index 5aa8e31..dcb7208 100644
--- a/scripts/build/companion_libs/210-expat.sh
+++ b/scripts/build/companion_libs/210-expat.sh
@@ -9,13 +9,11 @@ do_expat_for_target() { :; }
if [ "${CT_EXPAT_TARGET}" = "y" -o "${CT_EXPAT}" = "y" ]; then
do_expat_get() {
- CT_GetFile "expat-${CT_EXPAT_VERSION}" .tar.gz \
- http://downloads.sourceforge.net/project/expat/expat/${CT_EXPAT_VERSION}
+ CT_Fetch EXPAT
}
do_expat_extract() {
- CT_Extract "expat-${CT_EXPAT_VERSION}"
- CT_Patch "expat" "${CT_EXPAT_VERSION}"
+ CT_ExtractPatch EXPAT
}
if [ "${CT_EXPAT}" = "y" ]; then
@@ -95,7 +93,7 @@ do_expat_backend() {
CFLAGS="${cflags}" \
LDFLAGS="${ldflags}" \
${CONFIG_SHELL} \
- "${CT_SRC_DIR}/expat-${CT_EXPAT_VERSION}/configure" \
+ "${CT_SRC_DIR}/expat/configure" \
--build=${CT_BUILD} \
--host=${host} \
--prefix="${prefix}" \
diff --git a/scripts/build/companion_libs/220-ncurses.sh b/scripts/build/companion_libs/220-ncurses.sh
index 7a1379d..815cf4b 100644
--- a/scripts/build/companion_libs/220-ncurses.sh
+++ b/scripts/build/companion_libs/220-ncurses.sh
@@ -9,15 +9,11 @@ do_ncurses_for_target() { :; }
if [ "${CT_NCURSES_TARGET}" = "y" -o "${CT_NCURSES}" = "y" ]; then
do_ncurses_get() {
- CT_GetFile "ncurses-${CT_NCURSES_VERSION}" .tar.gz \
- {http,ftp,https}://ftp.gnu.org/pub/gnu/ncurses \
- ftp://invisible-island.net/ncurses
+ CT_Fetch NCURSES
}
do_ncurses_extract() {
- CT_Extract "ncurses-${CT_NCURSES_VERSION}"
- CT_DoExecLog ALL chmod -R u+w "${CT_SRC_DIR}/ncurses-${CT_NCURSES_VERSION}"
- CT_Patch "ncurses" "${CT_NCURSES_VERSION}"
+ CT_ExtractPatch NCURSES
}
# We need tic that runs on the build when building ncurses for host/target
@@ -157,7 +153,7 @@ do_ncurses_backend() {
CFLAGS="${cflags}" \
LDFLAGS="${ldflags}" \
${CONFIG_SHELL} \
- "${CT_SRC_DIR}/ncurses-${CT_NCURSES_VERSION}/configure" \
+ "${CT_SRC_DIR}/ncurses/configure" \
--build=${CT_BUILD} \
--host=${host} \
--prefix="${prefix}" \
diff --git a/scripts/build/companion_libs/320-libiconv.sh b/scripts/build/companion_libs/320-libiconv.sh
index f2f0bef..ad571a9 100644
--- a/scripts/build/companion_libs/320-libiconv.sh
+++ b/scripts/build/companion_libs/320-libiconv.sh
@@ -9,13 +9,11 @@ do_libiconv_for_target() { :; }
if [ "${CT_LIBICONV}" = "y" ]; then
do_libiconv_get() {
- CT_GetFile "libiconv-${CT_LIBICONV_VERSION}" \
- http://ftp.gnu.org/pub/gnu/libiconv/
+ CT_Fetch LIBICONV
}
do_libiconv_extract() {
- CT_Extract "libiconv-${CT_LIBICONV_VERSION}"
- CT_Patch "libiconv" "${CT_LIBICONV_VERSION}"
+ CT_ExtractPatch LIBICONV
}
# Build libiconv for running on build
@@ -93,7 +91,7 @@ do_libiconv_backend() {
CFLAGS="${cflags}" \
LDFLAGS="${ldflags}" \
${CONFIG_SHELL} \
- "${CT_SRC_DIR}/libiconv-${CT_LIBICONV_VERSION}/configure" \
+ "${CT_SRC_DIR}/libiconv/configure" \
--build=${CT_BUILD} \
--host="${host}" \
--prefix="${prefix}" \
diff --git a/scripts/build/companion_libs/330-gettext.sh b/scripts/build/companion_libs/330-gettext.sh
index 8828e5d..f3f1497 100644
--- a/scripts/build/companion_libs/330-gettext.sh
+++ b/scripts/build/companion_libs/330-gettext.sh
@@ -9,13 +9,11 @@ do_gettext_for_target() { :; }
if [ "${CT_GETTEXT}" = "y" ]; then
do_gettext_get() {
- CT_GetFile "gettext-${CT_GETTEXT_VERSION}" \
- http://ftp.gnu.org/pub/gnu/gettext/
+ CT_Fetch GETTEXT
}
do_gettext_extract() {
- CT_Extract "gettext-${CT_GETTEXT_VERSION}"
- CT_Patch "gettext" "${CT_GETTEXT_VERSION}"
+ CT_ExtractPatch GETTEXT
}
# Build gettext for running on build
@@ -112,7 +110,7 @@ do_gettext_backend() {
CFLAGS="${cflags}" \
LDFLAGS="${ldflags}" \
${CONFIG_SHELL} \
- "${CT_SRC_DIR}/gettext-${CT_GETTEXT_VERSION}/configure" \
+ "${CT_SRC_DIR}/gettext/configure" \
--build=${CT_BUILD} \
--host="${host}" \
--prefix="${prefix}" \
diff --git a/scripts/build/companion_tools.sh b/scripts/build/companion_tools.sh
index b190ed7..7776f64 100644
--- a/scripts/build/companion_tools.sh
+++ b/scripts/build/companion_tools.sh
@@ -5,7 +5,7 @@ CT_COMP_TOOLS_FACILITY_LIST=
for f in "${CT_LIB_DIR}/scripts/build/companion_tools/"*.sh; do
_f="$(basename "${f}" .sh)"
_f="${_f#???-}"
- __f="CT_COMP_TOOLS_${_f}"
+ __f="CT_COMP_TOOLS_${_f^^}"
if [ "${!__f}" = "y" ]; then
CT_DoLog DEBUG "Enabling companion tool '${_f}'"
. "${f}"
diff --git a/scripts/build/companion_tools/050-make.sh b/scripts/build/companion_tools/050-make.sh
index 76b24aa..3253f5b 100644
--- a/scripts/build/companion_tools/050-make.sh
+++ b/scripts/build/companion_tools/050-make.sh
@@ -1,14 +1,11 @@
# Build script for make
do_companion_tools_make_get() {
- CT_GetFile "make-${CT_MAKE_VERSION}" \
- {http,ftp,https}://ftp.gnu.org/gnu/make
+ CT_Fetch MAKE
}
do_companion_tools_make_extract() {
- CT_Extract "make-${CT_MAKE_VERSION}"
- CT_DoExecLog ALL chmod -R u+w "${CT_SRC_DIR}/make-${CT_MAKE_VERSION}"
- CT_Patch "make" "${CT_MAKE_VERSION}"
+ CT_ExtractPatch MAKE
}
do_companion_tools_make_for_build() {
@@ -61,7 +58,7 @@ do_make_backend() {
CFLAGS="${cflags}" \
LDFLAGS="${ldflags}" \
${CONFIG_SHELL} \
- "${CT_SRC_DIR}/make-${CT_MAKE_VERSION}/configure" \
+ "${CT_SRC_DIR}/make/configure" \
--host="${host}" \
--prefix="${prefix}" \
"${extra_config[@]}"
diff --git a/scripts/build/companion_tools/100-m4.sh b/scripts/build/companion_tools/100-m4.sh
index e0fccd7..1707d64 100644
--- a/scripts/build/companion_tools/100-m4.sh
+++ b/scripts/build/companion_tools/100-m4.sh
@@ -1,13 +1,11 @@
# Build script for m4
do_companion_tools_m4_get() {
- CT_GetFile "m4-${CT_M4_VERSION}" \
- {http,ftp,https}://ftp.gnu.org/gnu/m4
+ CT_Fetch M4
}
do_companion_tools_m4_extract() {
- CT_Extract "m4-${CT_M4_VERSION}"
- CT_Patch "m4" "${CT_M4_VERSION}"
+ CT_ExtractPatch M4
}
do_companion_tools_m4_for_build() {
@@ -58,7 +56,7 @@ do_m4_backend() {
CFLAGS="${cflags}" \
LDFLAGS="${ldflags}" \
${CONFIG_SHELL} \
- "${CT_SRC_DIR}/m4-${CT_M4_VERSION}/configure" \
+ "${CT_SRC_DIR}/m4/configure" \
--host="${host}" \
--prefix="${prefix}"
diff --git a/scripts/build/companion_tools/200-autoconf.sh b/scripts/build/companion_tools/200-autoconf.sh
index bccef75..52149ea 100644
--- a/scripts/build/companion_tools/200-autoconf.sh
+++ b/scripts/build/companion_tools/200-autoconf.sh
@@ -1,14 +1,11 @@
# Build script for autoconf
do_companion_tools_autoconf_get() {
- CT_GetFile "autoconf-${CT_AUTOCONF_VERSION}" \
- {http,ftp,https}://ftp.gnu.org/gnu/autoconf
+ CT_Fetch AUTOCONF
}
do_companion_tools_autoconf_extract() {
- CT_Extract "autoconf-${CT_AUTOCONF_VERSION}"
- CT_DoExecLog ALL chmod -R u+w "${CT_SRC_DIR}/autoconf-${CT_AUTOCONF_VERSION}"
- CT_Patch "autoconf" "${CT_AUTOCONF_VERSION}"
+ CT_ExtractPatch AUTOCONF
}
do_companion_tools_autoconf_for_build() {
@@ -42,7 +39,7 @@ do_autoconf_backend() {
CT_DoLog EXTRA "Configuring autoconf"
CT_DoExecLog CFG \
${CONFIG_SHELL} \
- "${CT_SRC_DIR}/autoconf-${CT_AUTOCONF_VERSION}/configure" \
+ "${CT_SRC_DIR}/autoconf/configure" \
--host="${host}" \
--prefix="${prefix}"
diff --git a/scripts/build/companion_tools/300-automake.sh b/scripts/build/companion_tools/300-automake.sh
index ee76463..2d7eded 100644
--- a/scripts/build/companion_tools/300-automake.sh
+++ b/scripts/build/companion_tools/300-automake.sh
@@ -1,14 +1,11 @@
# Build script for automake
do_companion_tools_automake_get() {
- CT_GetFile "automake-${CT_AUTOMAKE_VERSION}" \
- {http,ftp,https}://ftp.gnu.org/gnu/automake
+ CT_Fetch AUTOMAKE
}
do_companion_tools_automake_extract() {
- CT_Extract "automake-${CT_AUTOMAKE_VERSION}"
- CT_DoExecLog ALL chmod -R u+w "${CT_SRC_DIR}/automake-${CT_AUTOMAKE_VERSION}"
- CT_Patch "automake" "${CT_AUTOMAKE_VERSION}"
+ CT_ExtractPatch AUTOMAKE
}
do_companion_tools_automake_for_build() {
@@ -38,7 +35,7 @@ do_automake_backend() {
CT_DoLog EXTRA "Configuring automake"
CT_DoExecLog CFG \
${CONFIG_SHELL} \
- "${CT_SRC_DIR}/automake-${CT_AUTOMAKE_VERSION}/configure" \
+ "${CT_SRC_DIR}/automake/configure" \
--host="${host}" \
--prefix="${prefix}"
diff --git a/scripts/build/companion_tools/400-libtool.sh b/scripts/build/companion_tools/400-libtool.sh
index 4461207..3733072 100644
--- a/scripts/build/companion_tools/400-libtool.sh
+++ b/scripts/build/companion_tools/400-libtool.sh
@@ -1,14 +1,11 @@
# Build script for libtool
do_companion_tools_libtool_get() {
- CT_GetFile "libtool-${CT_LIBTOOL_VERSION}" \
- {http,ftp,https}://ftp.gnu.org/gnu/libtool
+ CT_Fetch LIBTOOL
}
do_companion_tools_libtool_extract() {
- CT_Extract "libtool-${CT_LIBTOOL_VERSION}"
- CT_DoExecLog ALL chmod -R u+w "${CT_SRC_DIR}/libtool-${CT_LIBTOOL_VERSION}"
- CT_Patch "libtool" "${CT_LIBTOOL_VERSION}"
+ CT_ExtractPatch LIBTOOL
}
do_companion_tools_libtool_for_build() {
@@ -38,7 +35,7 @@ do_libtool_backend() {
CT_DoLog EXTRA "Configuring libtool"
CT_DoExecLog CFG \
${CONFIG_SHELL} \
- "${CT_SRC_DIR}/libtool-${CT_LIBTOOL_VERSION}/configure" \
+ "${CT_SRC_DIR}/libtool/configure" \
--host="${host}" \
--prefix="${prefix}"
diff --git a/scripts/build/debug.sh b/scripts/build/debug.sh
index f07b295..f8178dd 100644
--- a/scripts/build/debug.sh
+++ b/scripts/build/debug.sh
@@ -5,7 +5,7 @@ CT_DEBUG_FACILITY_LIST=
for f in "${CT_LIB_DIR}/scripts/build/debug/"*.sh; do
_f="$(basename "${f}" .sh)"
_f="${_f#???-}"
- __f="CT_DEBUG_${_f}"
+ __f="CT_DEBUG_${_f^^}"
if [ "${!__f}" = "y" ]; then
CT_DoLog DEBUG "Enabling debug '${_f}'"
. "${f}"
diff --git a/scripts/build/debug/200-duma.sh b/scripts/build/debug/200-duma.sh
index 2a9b01f..bd35030 100644
--- a/scripts/build/debug/200-duma.sh
+++ b/scripts/build/debug/200-duma.sh
@@ -1,24 +1,11 @@
# Build script for D.U.M.A.
do_debug_duma_get() {
- local dl_base
-
- dl_base="http://downloads.sourceforge.net/project/duma/duma"
- dl_base+="/${CT_DUMA_VERSION//_/.}"
-
- # Downloading an non-existing file from sourceforge will give you an
- # HTML file containing an error message, instead of returning a 404.
- # Sigh...
- CT_GetFile "duma_${CT_DUMA_VERSION}" .tar.gz "${dl_base}"
- # Downloading from sourceforge may leave garbage, cleanup
- CT_DoExecLog ALL rm -f "${CT_TARBALLS_DIR}/showfiles.php"*
+ CT_Fetch DUMA
}
do_debug_duma_extract() {
- CT_Extract "duma_${CT_DUMA_VERSION}"
- CT_Pushd "${CT_SRC_DIR}/duma_${CT_DUMA_VERSION}"
- CT_Patch nochdir "duma" "${CT_DUMA_VERSION}"
- CT_Popd
+ CT_ExtractPatch DUMA
}
do_debug_duma_build() {
@@ -26,7 +13,7 @@ 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_BUILD_DIR}/build-duma"
CT_Pushd "${CT_BUILD_DIR}/build-duma"
make_args=(
diff --git a/scripts/build/debug/300-gdb.sh b/scripts/build/debug/300-gdb.sh
index e5276d0..19d9d6d 100644
--- a/scripts/build/debug/300-gdb.sh
+++ b/scripts/build/debug/300-gdb.sh
@@ -1,40 +1,17 @@
# Build script for the gdb debug facility
do_debug_gdb_get() {
- local linaro_version=""
- local linaro_series=""
-
- if [ "${CT_GDB_CUSTOM}" = "y" ]; then
- CT_GetCustom "gdb" "${CT_GDB_CUSTOM_VERSION}" \
- "${CT_GDB_CUSTOM_LOCATION}"
- else
- case "${CT_GDB_VERSION}" in
- linaro-*)
- CT_GetLinaro "gdb" "${CT_GDB_VERSION}"
- ;;
- *)
- CT_GetFile "gdb-${CT_GDB_VERSION}" \
- http://mirrors.kernel.org/sourceware/gdb \
- {http,ftp,https}://ftp.gnu.org/pub/gnu/gdb \
- ftp://{sourceware.org,gcc.gnu.org}/pub/gdb/releases
- ;;
- esac
- fi
+ CT_Fetch GDB
}
do_debug_gdb_extract() {
- CT_Extract "gdb-${CT_GDB_VERSION}"
- CT_Patch "gdb" "${CT_GDB_VERSION}"
-
- if [ -n "${CT_ARCH_XTENSA_CUSTOM_NAME}" ]; then
- CT_ConfigureXtensa "gdb" "${CT_GDB_VERSION}"
- fi
+ CT_ExtractPatch GDB
}
do_debug_gdb_build() {
local -a extra_config
- gdb_src_dir="${CT_SRC_DIR}/gdb-${CT_GDB_VERSION}"
+ gdb_src_dir="${CT_SRC_DIR}/gdb"
# Version 6.3 and below behave badly with gdbmi
case "${CT_GDB_VERSION}" in
@@ -174,11 +151,12 @@ do_debug_gdb_build() {
if [ "${CT_GDB_INSTALL_GDBINIT}" = "y" ]; then
CT_DoLog EXTRA "Installing '.gdbinit' template"
# See in scripts/build/internals.sh for why we do this
- if [ -f "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/gcc/BASE-VER" ]; then
- gcc_version=$( cat "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/gcc/BASE-VER" )
+ # TBD GCC 3.x and older not supported
+ if [ -f "${CT_SRC_DIR}/gcc/gcc/BASE-VER" ]; then
+ gcc_version=$( cat "${CT_SRC_DIR}/gcc/gcc/BASE-VER" )
else
gcc_version=$(sed -r -e '/version_string/!d; s/^.+= "([^"]+)".*$/\1/;' \
- "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/gcc/version.c" \
+ "${CT_SRC_DIR}/gcc/gcc/version.c" \
)
fi
sed -r \
diff --git a/scripts/build/debug/400-ltrace.sh b/scripts/build/debug/400-ltrace.sh
index 6b860e9..ce299c2 100644
--- a/scripts/build/debug/400-ltrace.sh
+++ b/scripts/build/debug/400-ltrace.sh
@@ -1,19 +1,11 @@
# Build script for ltrace
do_debug_ltrace_get() {
- CT_GetFile "ltrace_${CT_LTRACE_VERSION}.orig" .tar.gz \
- {http,ftp}://ftp.debian.org/debian/pool/main/l/ltrace/
- # Create a link so that the following steps are easier to do:
- CT_Pushd "${CT_TARBALLS_DIR}"
- ltrace_ext=$(CT_GetFileExtension "ltrace_${CT_LTRACE_VERSION}.orig")
- ln -sf "ltrace_${CT_LTRACE_VERSION}.orig${ltrace_ext}" \
- "ltrace-${CT_LTRACE_VERSION}${ltrace_ext}"
- CT_Popd
+ CT_Fetch LTRACE
}
do_debug_ltrace_extract() {
- CT_Extract "ltrace-${CT_LTRACE_VERSION}"
- CT_Patch "ltrace" "${CT_LTRACE_VERSION}"
+ CT_ExtractPatch LTRACE
}
do_debug_ltrace_build() {
@@ -22,7 +14,7 @@ do_debug_ltrace_build() {
CT_DoStep INFO "Installing ltrace"
CT_DoLog EXTRA "Copying sources to build dir"
- CT_DoExecLog ALL cp -av "${CT_SRC_DIR}/ltrace-${CT_LTRACE_VERSION}/." \
+ CT_DoExecLog ALL cp -av "${CT_SRC_DIR}/ltrace/." \
"${CT_BUILD_DIR}/build-ltrace"
CT_Pushd "${CT_BUILD_DIR}/build-ltrace"
@@ -63,4 +55,3 @@ do_debug_ltrace_build() {
CT_Popd
CT_EndStep
}
-
diff --git a/scripts/build/debug/500-strace.sh b/scripts/build/debug/500-strace.sh
index 6eb2357..cb4643a 100644
--- a/scripts/build/debug/500-strace.sh
+++ b/scripts/build/debug/500-strace.sh
@@ -1,15 +1,11 @@
# Build script for strace
do_debug_strace_get() {
- local base_url="http://downloads.sourceforge.net/project/strace/strace"
- CT_GetFile "strace-${CT_STRACE_VERSION}" "${base_url}/${CT_STRACE_VERSION}"
- # Downloading from sourceforge leaves garbage, cleanup
- CT_DoExecLog ALL rm -f "${CT_TARBALLS_DIR}/showfiles.php"*
+ CT_Fetch STRACE
}
do_debug_strace_extract() {
- CT_Extract "strace-${CT_STRACE_VERSION}"
- CT_Patch "strace" "${CT_STRACE_VERSION}"
+ CT_ExtractPatch STRACE
}
do_debug_strace_build() {
@@ -23,7 +19,7 @@ do_debug_strace_build() {
CPP="${CT_TARGET}-cpp" \
LD="${CT_TARGET}-ld" \
${CONFIG_SHELL} \
- "${CT_SRC_DIR}/strace-${CT_STRACE_VERSION}/configure" \
+ "${CT_SRC_DIR}/strace/configure" \
--build=${CT_BUILD} \
--host=${CT_TARGET} \
--prefix=/usr
diff --git a/scripts/build/internals.sh b/scripts/build/internals.sh
index db9b1fd..e407de8 100644
--- a/scripts/build/internals.sh
+++ b/scripts/build/internals.sh
@@ -69,18 +69,19 @@ do_finish() {
CT_DoExecLog ALL "${CT_TARGET}-strip" ${strip_args} \
"${CT_TARGET}/debug-root/usr/bin/gdbserver${exe_suffix}"
fi
- if [ "${CT_CC_gcc}" = "y" ]; then
- # We can not use the version in CT_CC_GCC_VERSION because
+ if [ "${CT_CC_GCC}" = "y" ]; then
+ # TBD GCC 3.x/2.x is no longer supported by ctng
+ # We can not use the version in CT_GCC_VERSION because
# of the Linaro stuff. So, harvest the version string
# directly from the gcc sources...
# All gcc 4.x seem to have the version in gcc/BASE-VER
# while version prior to 4.x have the version in gcc/version.c
# Of course, here is not the better place to do that...
- if [ -f "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/gcc/BASE-VER" ]; then
- gcc_version=$( cat "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/gcc/BASE-VER" )
+ if [ -f "${CT_SRC_DIR}/gcc/gcc/BASE-VER" ]; then
+ gcc_version=$( cat "${CT_SRC_DIR}/gcc/gcc/BASE-VER" )
else
gcc_version=$(sed -r -e '/version_string/!d; s/^.+= "([^"]+)".*$/\1/;' \
- "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/gcc/version.c" \
+ "${CT_SRC_DIR}/gcc/gcc/version.c" \
)
fi
for _t in "bin/${CT_TARGET}-"* \
diff --git a/scripts/build/kernel/linux.sh b/scripts/build/kernel/linux.sh
index cd4a456..5ab4918 100644
--- a/scripts/build/kernel/linux.sh
+++ b/scripts/build/kernel/linux.sh
@@ -19,69 +19,26 @@ CT_DoKernelTupleValues() {
# Download the kernel
do_kernel_get() {
- local k_ver
- local custom_name
- local rel_dir
- local korg_base mirror_base
+ CT_Fetch LINUX
+}
- if [ "${CT_KERNEL_LINUX_CUSTOM}" = "y" ]; then
- CT_GetCustom "linux" "${CT_KERNEL_LINUX_CUSTOM_VERSION}" \
- "${CT_KERNEL_LINUX_CUSTOM_LOCATION}"
- else # Not a custom tarball
- case "${CT_KERNEL_VERSION}" in
- 2.6.*.*|3.*.*|4.*.*)
- # 4-part versions (for 2.6 stables and long-terms), and
- # 3-part versions (for 3.x.y and 4.x.y stables and long-terms)
- # we need to trash the last digit
- k_ver="${CT_KERNEL_VERSION%.*}"
- ;;
- 2.6.*|3.*|4.*)
- # 3-part version (for 2.6.x initial releases), and 2-part
- # versions (for 3.x and 4.x initial releases), use all of it
- k_ver="${CT_KERNEL_VERSION}"
- ;;
- esac
- case "${CT_KERNEL_VERSION}" in
- 2.6.*) rel_dir=v2.6;;
- 3.*) rel_dir=v3.x;;
- 4.*) rel_dir=v4.x;;
- esac
- korg_base="http://www.kernel.org/pub/linux/kernel/${rel_dir}"
- CT_GetFile "linux-${CT_KERNEL_VERSION}" \
- "${korg_base}" \
- "${korg_base}/longterm/v${k_ver}" \
- "${korg_base}/longterm"
- fi
+# Disable building relocs application - it needs <linux/types.h>
+# on the host, which may not be present on Cygwin or MacOS; it
+# needs <elf.h>, which again is not present on MacOS; and most
+# important, we don't need it to install the headers.
+# This is not done as a patch, since it varies from Linux version
+# to version - patching each particular Linux version would be
+# too cumbersome.
+linux_disable_build_relocs()
+{
+ sed -i -r 's/(\$\(MAKE\) .* relocs)$/:/' arch/*/Makefile
}
# Extract kernel
-do_kernel_extract() {
- # If using a custom directory location, nothing to do
- if [ "${CT_KERNEL_LINUX_CUSTOM}" = "y" \
- -a -d "${CT_SRC_DIR}/linux-${CT_KERNEL_VERSION}" ]; then
- return 0
- fi
-
- # Otherwise, we're using either a mainstream tarball, or a custom
- # tarball; in either case, we need to extract
- CT_Extract "linux-${CT_KERNEL_VERSION}"
-
- # If using a custom tarball, no need to patch
- if [ "${CT_KERNEL_LINUX_CUSTOM}" = "y" ]; then
- return 0
- fi
- CT_Patch "linux" "${CT_KERNEL_VERSION}"
-
- # Disable building relocs application - it needs <linux/types.h>
- # on the host, which may not be present on Cygwin or MacOS; it
- # needs <elf.h>, which again is not present on MacOS; and most
- # important, we don't need it to install the headers.
- # This is not done as a patch, since it varies from Linux version
- # to version - patching each particular Linux version would be
- # too cumbersome.
- CT_Pushd "${CT_SRC_DIR}/linux-${CT_KERNEL_VERSION}"
- sed -i -r 's/(\$\(MAKE\) .* relocs)$/:/' arch/*/Makefile
- CT_Popd
+do_kernel_extract()
+{
+ # TBD verify linux_disable_build_relocs is run
+ CT_ExtractPatch LINUX linux_disable_build_relocs
}
# Install kernel headers using headers_install from kernel sources.
@@ -93,7 +50,7 @@ do_kernel_headers() {
mkdir -p "${CT_BUILD_DIR}/build-kernel-headers"
- kernel_path="${CT_SRC_DIR}/linux-${CT_KERNEL_VERSION}"
+ kernel_path="${CT_SRC_DIR}/linux"
V_OPT="V=${CT_KERNEL_LINUX_VERBOSE_LEVEL}"
kernel_arch="${CT_ARCH}"
diff --git a/scripts/build/libc/avr-libc.sh b/scripts/build/libc/avr-libc.sh
index f94b601..7003f38 100644
--- a/scripts/build/libc/avr-libc.sh
+++ b/scripts/build/libc/avr-libc.sh
@@ -1,33 +1,11 @@
# This file adds functions to build the avr-libc C library
do_libc_get() {
- local libc_src
-
- libc_src="http://download.savannah.gnu.org/releases/avr-libc"
-
- if [ "${CT_LIBC_AVR_LIBC_CUSTOM}" = "y" ]; then
- CT_GetCustom "avr-libc" "${CT_LIBC_AVR_LIBC_CUSTOM_VERSION}" \
- "${CT_LIBC_AVR_LIBC_CUSTOM_LOCATION}"
- else # ! custom location
- CT_GetFile "avr-libc-${CT_LIBC_VERSION}" "${libc_src}"
- fi # ! custom location
+ CT_Fetch AVR_LIBC
}
do_libc_extract() {
- CT_Extract "avr-libc-${CT_LIBC_VERSION}"
- CT_Patch "avr-libc" "${CT_LIBC_VERSION}"
-}
-
-do_libc_configure() {
- CT_DoLog EXTRA "Configuring C library"
-
- CT_DoExecLog CFG \
- ${CONFIG_SHELL} \
- ./configure \
- --build=${CT_BUILD} \
- --host=${CT_TARGET} \
- --prefix=${CT_PREFIX_DIR} \
- "${CT_LIBC_AVR_LIBC_EXTRA_CONFIG_ARRAY[@]}"
+ CT_ExtractPatch AVR_LIBC
}
do_libc_start_files() {
@@ -42,11 +20,19 @@ do_libc_post_cc() {
CT_DoStep INFO "Installing C library"
CT_DoLog EXTRA "Copying sources to build directory"
- CT_DoExecLog ALL cp -av "${CT_SRC_DIR}/avr-libc-${CT_LIBC_VERSION}/." \
+ CT_DoExecLog ALL cp -av "${CT_SRC_DIR}/avr-libc/." \
"${CT_BUILD_DIR}/build-libc-post-cc"
cd "${CT_BUILD_DIR}/build-libc-post-cc"
- do_libc_configure
+ CT_DoLog EXTRA "Configuring C library"
+
+ CT_DoExecLog CFG \
+ ${CONFIG_SHELL} \
+ ./configure \
+ --build=${CT_BUILD} \
+ --host=${CT_TARGET} \
+ --prefix=${CT_PREFIX_DIR} \
+ "${CT_LIBC_AVR_LIBC_EXTRA_CONFIG_ARRAY[@]}"
CT_DoLog EXTRA "Building C library"
CT_DoExecLog ALL make ${JOBSFLAGS}
diff --git a/scripts/build/libc/bionic.sh b/scripts/build/libc/bionic.sh
index fcdc57f..027493d 100644
--- a/scripts/build/libc/bionic.sh
+++ b/scripts/build/libc/bionic.sh
@@ -3,37 +3,29 @@
# Licensed under the GPL v2. See COPYING in the root of this package
do_libc_get() {
- if [ "${CT_LIBC_BIONIC_CUSTOM}" = "y" ]; then
- CT_GetCustom "bionic" "${CT_LIBC_BIONIC_CUSTOM_VERSION}" \
- "${CT_LIBC_BIONIC_CUSTOM_LOCATION}"
- else # ! custom location
- CT_GetFile "android-ndk-${CT_LIBC_VERSION}-linux-x86_64.zip" https://dl.google.com/android/repository
- fi # ! custom location
+ CT_Fetch ANDROID_NDK
}
do_libc_extract() {
- CT_Extract "android-ndk-${CT_LIBC_VERSION}-linux-x86_64"
- CT_Pushd "${CT_SRC_DIR}/android-ndk-${CT_LIBC_VERSION}/"
- CT_Patch nochdir bionic "${CT_LIBC_VERSION}"
- CT_Popd
+ CT_ExtractPatch ANDROID_NDK
}
# Install Unified headers
do_libc_start_files() {
CT_DoStep INFO "Installing C library headers"
- CT_DoExecLog ALL cp -r "${CT_SRC_DIR}/android-ndk-${CT_LIBC_VERSION}/sysroot/usr" "${CT_SYSROOT_DIR}"
+ CT_DoExecLog ALL cp -r "${CT_SRC_DIR}/android-ndk/sysroot/usr" "${CT_SYSROOT_DIR}"
}
do_libc() {
local arch="${CT_ARCH}"
if [ "${CT_ARCH_64}" = "y" ]; then
if [ "${CT_ARCH}" = "x86" ]; then
- arch="${arch}_"
- fi
- arch="${arch}64"
+ arch="${arch}_"
+ fi
+ arch="${arch}64"
fi
CT_DoStep INFO "Installing C library binaries"
- CT_DoExecLog ALL cp -r "${CT_SRC_DIR}/android-ndk-${CT_LIBC_VERSION}/platforms/android-${CT_ANDROID_API}/arch-${arch}/usr" "${CT_SYSROOT_DIR}"
+ CT_DoExecLog ALL cp -r "${CT_SRC_DIR}/android-ndk/platforms/android-${CT_ANDROID_API}/arch-${arch}/usr" "${CT_SYSROOT_DIR}"
CT_EnvModify CT_TARGET_CFLAGS "${CT_TARGET_CFLAGS} -D__ANDROID_API__=${CT_ANDROID_API}"
}
diff --git a/scripts/build/libc/glibc.sh b/scripts/build/libc/glibc.sh
index 3eac3ba..eae64bc 100644
--- a/scripts/build/libc/glibc.sh
+++ b/scripts/build/libc/glibc.sh
@@ -7,102 +7,22 @@ do_libc_get() {
local version
local -a addons_list
- addons_list=($(do_libc_add_ons_list " "))
-
- # Main source
- if [ "${CT_LIBC_GLIBC_CUSTOM}" = "y" ]; then
- CT_GetCustom "glibc" "${CT_LIBC_GLIBC_CUSTOM_VERSION}" \
- "${CT_LIBC_GLIBC_CUSTOM_LOCATION}"
- else
- case "${CT_LIBC_VERSION}" in
- linaro-*)
- CT_GetLinaro "glibc" "${CT_LIBC_VERSION}"
- ;;
- *)
- CT_GetFile "glibc-${CT_LIBC_VERSION}" \
- {http,ftp,https}://ftp.gnu.org/gnu/glibc \
- ftp://{sourceware.org,gcc.gnu.org}/pub/glibc/{releases,snapshots}
- ;;
- esac
+ CT_Fetch GLIBC
+ if [ "${CT_GLIBC_USE_PORTS_EXTERNAL}" = "y" ]; then
+ CT_Fetch GLIBC_PORTS
fi
-
- # C library addons
- for addon in "${addons_list[@]}"; do
- # Never ever try to download these add-ons,
- # they've always been internal
- case "${addon}" in
- nptl) continue;;
- esac
-
- case "${addon}:${CT_LIBC_GLIBC_PORTS_EXTERNAL}" in
- ports:y) ;;
- ports:*) continue;;
- esac
-
- if ! CT_GetFile "glibc-${addon}-${CT_LIBC_VERSION}" \
- http://mirrors.kernel.org/sourceware/glibc \
- {http,ftp,https}://ftp.gnu.org/gnu/glibc \
- ftp://{sourceware.org,gcc.gnu.org}/pub/glibc/{releases,snapshots}
- then
- # Some add-ons are bundled with glibc, others are
- # bundled in their own tarball. Eg. NPTL is internal,
- # while LinuxThreads was external. Also, for old
- # versions of glibc, the libidn add-on was external,
- # but with version >=2.10, it is internal.
- CT_DoLog DEBUG "Addon '${addon}' could not be downloaded."
- CT_DoLog DEBUG "We'll see later if we can find it in the source tree"
- fi
- done
-
return 0
}
do_libc_extract() {
local addon
- CT_Extract "${CT_LIBC}-${CT_LIBC_VERSION}"
- CT_Pushd "${CT_SRC_DIR}/${CT_LIBC}-${CT_LIBC_VERSION}"
- # Custom glibc won't get patched, because CT_GetCustom
- # marks custom glibc as patched.
- CT_Patch nochdir "${CT_LIBC}" "${CT_LIBC_VERSION}"
-
- for addon in $(do_libc_add_ons_list " "); do
- # If the addon was bundled with the main archive, we do not
- # need to extract it. Worse, if we were to try to extract
- # it, we'd get an error.
- if [ -d "${addon}" ]; then
- CT_DoLog DEBUG "Add-on '${addon}' already present, skipping extraction"
- continue
- fi
-
- CT_Extract nochdir "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}"
-
- CT_TestAndAbort "Error in add-on '${addon}': both short and long names in tarball" \
- -d "${addon}" -a -d "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}"
-
- # Some addons have the 'long' name, while others have the
- # 'short' name, but patches are non-uniformly built with
- # either the 'long' or 'short' name, whatever the addons name
- # but we prefer the 'short' name and avoid duplicates.
- if [ -d "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}" ]; then
- CT_DoExecLog FILE mv "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}" "${addon}"
- fi
-
- CT_DoExecLog FILE ln -s "${addon}" "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}"
-
- CT_Patch nochdir "${CT_LIBC}" "${addon}-${CT_LIBC_VERSION}"
-
- # Remove the long name since it can confuse configure scripts to run
- # the same source twice.
- rm "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}"
- 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 . -type f -name configure -exec touch {} \; 2>&1 |CT_DoLog ALL
-
- CT_Popd
+ CT_ExtractPatch GLIBC
+ if [ "${CT_GLIBC_USE_PORTS_EXTERNAL}" = "y" ]; then
+ CT_ExtractPatch GLIBC_PORTS
+ fi
+ # TBD make patches for addons (ports? anything else?) uniformly using short names
+ # TBD make the configure timestamp fix in all patched packages (e.g. part of CT_ExtractPatch)
}
# Build and install headers and start files
@@ -161,7 +81,7 @@ do_libc_backend_once() {
local multi_flags multi_dir multi_os_dir multi_root multi_index multi_count multi_target
local build_cflags build_cppflags build_ldflags
local startfiles_dir
- local src_dir="${CT_SRC_DIR}/${CT_LIBC}-${CT_LIBC_VERSION}"
+ local src_dir="${CT_SRC_DIR}/glibc"
local -a extra_config
local -a extra_make_args
local glibc_cflags
@@ -209,7 +129,7 @@ do_libc_backend_once() {
# Add some default glibc config options if not given by user.
# We don't need to be conditional on whether the user did set different
- # values, as they CT_LIBC_GLIBC_EXTRA_CONFIG_ARRAY is passed after
+ # values, as they CT_GLIBC_EXTRA_CONFIG_ARRAY is passed after
# extra_config
extra_config+=("$(do_libc_min_kernel_config)")
@@ -218,7 +138,7 @@ do_libc_backend_once() {
nptl) extra_config+=("--with-__thread" "--with-tls");;
linuxthreads) extra_config+=("--with-__thread" "--without-tls" "--without-nptl");;
none) extra_config+=("--without-__thread" "--without-nptl")
- case "${CT_LIBC_GLIBC_EXTRA_CONFIG_ARRAY[*]}" in
+ case "${CT_GLIBC_EXTRA_CONFIG_ARRAY[*]}" in
*-tls*) ;;
*) extra_config+=("--without-tls");;
esac
@@ -230,12 +150,12 @@ do_libc_backend_once() {
*) extra_config+=("--disable-shared");;
esac
- if [ "${CT_LIBC_DISABLE_VERSIONING}" = "y" ]; then
+ if [ "${CT_GLIBC_DISABLE_VERSIONING}" = "y" ]; then
extra_config+=("--disable-versioning")
fi
- if [ "${CT_LIBC_OLDEST_ABI}" != "" ]; then
- extra_config+=("--enable-oldest-abi=${CT_LIBC_OLDEST_ABI}")
+ if [ "${CT_GLIBC_OLDEST_ABI}" != "" ]; then
+ extra_config+=("--enable-oldest-abi=${CT_GLIBC_OLDEST_ABI}")
fi
case "$(do_libc_add_ons_list ,)" in
@@ -251,25 +171,25 @@ do_libc_backend_once() {
# Hide host C++ binary from configure
echo "ac_cv_prog_ac_ct_CXX=${CT_TARGET}-g++" >>config.cache
- if [ "${CT_LIBC_GLIBC_FORCE_UNWIND}" = "y" ]; then
+ if [ "${CT_GLIBC_FORCE_UNWIND}" = "y" ]; then
echo "libc_cv_forced_unwind=yes" >>config.cache
echo "libc_cv_c_cleanup=yes" >>config.cache
fi
# Pre-seed the configparms file with values from the config option
- printf "%s\n" "${CT_LIBC_GLIBC_CONFIGPARMS}" > configparms
+ printf "%s\n" "${CT_GLIBC_CONFIGPARMS}" > configparms
# glibc can't be built without -O2 (reference needed!)
glibc_cflags+=" -O2"
- case "${CT_LIBC_ENABLE_FORTIFIED_BUILD}" in
+ case "${CT_GLIBC_ENABLE_FORTIFIED_BUILD}" in
y) ;;
*) glibc_cflags+=" -U_FORTIFY_SOURCE";;
esac
# In the order of increasing precedence. Flags common to compiler and linker.
glibc_cflags+=" ${CT_TARGET_CFLAGS}"
- glibc_cflags+=" ${CT_LIBC_GLIBC_EXTRA_CFLAGS}"
+ glibc_cflags+=" ${CT_GLIBC_EXTRA_CFLAGS}"
glibc_cflags+=" ${multi_flags}"
# Analyze the resulting options for any extra configure switches to throw in.
@@ -336,7 +256,7 @@ do_libc_backend_once() {
--without-gd \
--with-headers="${CT_HEADERS_DIR}" \
"${extra_config[@]}" \
- "${CT_LIBC_GLIBC_EXTRA_CONFIG_ARRAY[@]}"
+ "${CT_GLIBC_EXTRA_CONFIG_ARRAY[@]}"
# build hacks
case "${CT_ARCH},${CT_ARCH_CPU}" in
@@ -390,7 +310,7 @@ do_libc_backend_once() {
# 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}/glibc-${CT_LIBC_VERSION}/include/features.h" \
+ CT_DoExecLog ALL cp -v "${CT_SRC_DIR}/glibc/include/features.h" \
"${CT_HEADERS_DIR}/features.h"
# Building the bootstrap gcc requires either setting inhibit_libc, or
@@ -475,7 +395,7 @@ do_libc_backend_once() {
${CT_PREFIX_DIR}/share/doc
fi
- if [ "${CT_LIBC_LOCALES}" = "y" -a "${multi_index}" = "${multi_count}" ]; then
+ if [ "${CT_GLIBC_LOCALES}" = "y" -a "${multi_index}" = "${multi_count}" ]; then
do_libc_locales
fi
fi # libc_mode = final
@@ -486,27 +406,28 @@ do_libc_backend_once() {
# Build up the addons list, separated with $1
do_libc_add_ons_list() {
local sep="$1"
- local addons_list="$( echo "${CT_LIBC_ADDONS_LIST}" \
- |sed -r -e "s/[[:space:],]/${sep}/g;" \
- )"
- if [ "${CT_LIBC_GLIBC_2_20_or_later}" != "y" ]; then
- case "${CT_THREADS}" in
- none) ;;
- *) addons_list="${addons_list}${sep}${CT_THREADS}";;
- esac
+ local addons_list
+
+ if [ "${CT_GLIBC_USE_PORTS_ADDON}" = "y" ]; then
+ addons_list="${addons_list}${sep}ports"
+ fi
+ if [ "${CT_GLIBC_USE_NPTL_ADDON}" = "y" ]; then
+ addons_list="${addons_list}${sep}nptl"
+ fi
+ if [ "${CT_GLIBC_USE_LIBIDN_ADDON}" = "y" ]; then
+ addons_list="${addons_list}${sep}libidn"
fi
- [ "${CT_LIBC_GLIBC_USE_PORTS}" = "y" ] && addons_list="${addons_list}${sep}ports"
- # Remove duplicate, leading and trailing separators
- echo "${addons_list}" |sed -r -e "s/${sep}+/${sep}/g; s/^${sep}//; s/${sep}\$//;"
+ echo "${addons_list#${sep}}" # Remove leading separator if any
}
# Compute up the minimum supported Linux kernel version
do_libc_min_kernel_config() {
local min_kernel_config
- case "${CT_LIBC_GLIBC_EXTRA_CONFIG_ARRAY[*]}" in
+ case "${CT_GLIBC_EXTRA_CONFIG_ARRAY[*]}" in
*--enable-kernel*) ;;
- *) if [ "${CT_LIBC_GLIBC_KERNEL_VERSION_AS_HEADERS}" = "y" ]; then
+ *) if [ "${CT_GLIBC_KERNEL_VERSION_AS_HEADERS}" = "y" ]; then
+ # TBD do we support that currently? We always seem to install kernel headers
# We can't rely on the kernel version from the configuration,
# because it might not be available if the user uses pre-installed
# headers. On the other hand, both method will have the kernel
@@ -523,9 +444,9 @@ do_libc_min_kernel_config() {
patchlevel=$(((version_code>>8)&0xFF))
sublevel=$((version_code&0xFF))
min_kernel_config="${version}.${patchlevel}.${sublevel}"
- elif [ "${CT_LIBC_GLIBC_KERNEL_VERSION_CHOSEN}" = "y" ]; then
+ elif [ "${CT_GLIBC_KERNEL_VERSION_CHOSEN}" = "y" ]; then
# Trim the fourth part of the linux version, keeping only the first three numbers
- min_kernel_config="$( echo "${CT_LIBC_GLIBC_MIN_KERNEL_VERSION}" \
+ min_kernel_config="$( echo "${CT_GLIBC_MIN_KERNEL_VERSION}" \
|sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;' \
)"
fi
@@ -536,7 +457,7 @@ do_libc_min_kernel_config() {
# Build and install the libc locales
do_libc_locales() {
- local src_dir="${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}"
+ local src_dir="${CT_SRC_DIR}/glibc"
local -a extra_config
local glibc_cflags
@@ -567,7 +488,7 @@ do_libc_locales() {
CT_DoLog DEBUG "Extra config args passed: '${extra_config[*]}'"
glibc_cflags="-O2 -fno-stack-protector"
- case "${CT_LIBC_ENABLE_FORTIFIED_BUILD}" in
+ case "${CT_GLIBC_ENABLE_FORTIFIED_BUILD}" in
y) ;;
*) glibc_cflags+=" -U_FORTIFY_SOURCE";;
esac
diff --git a/scripts/build/libc/mingw.sh b/scripts/build/libc/mingw-w64.sh
index 1471785..295b313 100644
--- a/scripts/build/libc/mingw.sh
+++ b/scripts/build/libc/mingw-w64.sh
@@ -1,29 +1,17 @@
# Copyright 2012 Yann Diorcet
# Licensed under the GPL v2. See COPYING in the root of this package
-CT_WINAPI_VERSION_DOWNLOADED=
-
do_libc_get() {
- if [ "${CT_WINAPI_VERSION}" = "devel" ]; then
- CT_GetGit "mingw-w64" "ref=HEAD" "git://git.code.sf.net/p/mingw-w64/mingw-w64" CT_WINAPI_VERSION_DOWNLOADED
- CT_DoLog DEBUG "Fetched mingw-w64 as ${CT_WINAPI_VERSION_DOWNLOADED}"
- else
- CT_GetFile "mingw-w64-v${CT_WINAPI_VERSION}" \
- http://downloads.sourceforge.net/sourceforge/mingw-w64
- CT_WINAPI_VERSION_DOWNLOADED=v${CT_WINAPI_VERSION}
- fi
+ CT_Fetch MINGW_W64
}
do_libc_extract() {
- CT_Extract "mingw-w64-${CT_WINAPI_VERSION_DOWNLOADED}"
- CT_Pushd "${CT_SRC_DIR}/mingw-w64-${CT_WINAPI_VERSION_DOWNLOADED}/"
- CT_Patch nochdir mingw-w64 "${CT_WINAPI_VERSION_DOWNLOADED}"
- CT_Popd
+ CT_ExtractPatch MINGW_W64
}
do_set_mingw_install_prefix(){
MINGW_INSTALL_PREFIX=/usr/${CT_TARGET}
- if [[ ${CT_WINAPI_VERSION} == 2* ]]; then
+ if [[ ${CT_MINGW_W64_VERSION} == 2* ]]; then
MINGW_INSTALL_PREFIX=/usr
fi
}
@@ -51,7 +39,7 @@ do_libc_start_files() {
do_set_mingw_install_prefix
CT_DoExecLog CFG \
${CONFIG_SHELL} \
- "${CT_SRC_DIR}/mingw-w64-${CT_WINAPI_VERSION_DOWNLOADED}/mingw-w64-headers/configure" \
+ "${CT_SRC_DIR}/mingw-w64/mingw-w64-headers/configure" \
--build=${CT_BUILD} \
--host=${CT_TARGET} \
--prefix=${MINGW_INSTALL_PREFIX} \
@@ -75,9 +63,9 @@ do_libc_start_files() {
do_check_mingw_vendor_tuple()
{
- if [[ ${CT_WINAPI_VERSION} == 4* ]]; then
- CT_DoStep INFO "Checking vendor tuple configured in crosstool-ng .config"
- if [[ ${CT_TARGET_VENDOR} == w64 ]]; then
+ if [ "${CT_MINGW_W64_VERSION%%.*}" -ge 4 ]; then
+ CT_DoStep INFO "Checking configured vendor tuple"
+ if [ ${CT_TARGET_VENDOR} == w64 ]; then
CT_DoLog EXTRA "The tuple is set to '${CT_TARGET_VENDOR}', as recommended by mingw-64 developers."
else
CT_DoLog WARN "The tuple vendor is '${CT_TARGET_VENDOR}', not equal to 'w64' and might break the toolchain!"
@@ -92,7 +80,7 @@ do_mingw_tools()
for f in "${CT_MINGW_TOOL_LIST_ARRAY[@]}"; do
CT_mkdir_pushd "${f}"
- if [ ! -d "${CT_SRC_DIR}/mingw-w64-${CT_WINAPI_VERSION_DOWNLOADED}/mingw-w64-tools/${f}" ]; then
+ if [ ! -d "${CT_SRC_DIR}/mingw-w64/mingw-w64-tools/${f}" ]; then
CT_DoLog WARN "Skipping ${f}: not found"
CT_Popd
continue
@@ -101,7 +89,7 @@ do_mingw_tools()
CT_DoLog EXTRA "Configuring ${f}"
CT_DoExecLog CFG \
${CONFIG_SHELL} \
- "${CT_SRC_DIR}/mingw-w64-${CT_WINAPI_VERSION_DOWNLOADED}/mingw-w64-tools/${f}/configure" \
+ "${CT_SRC_DIR}/mingw-w64/mingw-w64-tools/${f}/configure" \
--build=${CT_BUILD} \
--host=${CT_HOST} \
--target=${CT_TARGET} \
@@ -159,7 +147,7 @@ do_mingw_pthreads()
RCFLAGS="${rcflags}" \
DLLTOOLFLAGS="${dlltoolflags}" \
${CONFIG_SHELL} \
- "${CT_SRC_DIR}/mingw-w64-${CT_WINAPI_VERSION_DOWNLOADED}/mingw-w64-libraries/winpthreads/configure" \
+ "${CT_SRC_DIR}/mingw-w64/mingw-w64-libraries/winpthreads/configure" \
--with-sysroot=${CT_SYSROOT_DIR} \
--prefix=${MINGW_INSTALL_PREFIX} \
--libdir=${libprefix} \
@@ -189,7 +177,7 @@ do_libc()
do_set_mingw_install_prefix
CT_DoExecLog CFG \
${CONFIG_SHELL} \
- "${CT_SRC_DIR}/mingw-w64-${CT_WINAPI_VERSION_DOWNLOADED}/mingw-w64-crt/configure" \
+ "${CT_SRC_DIR}/mingw-w64/mingw-w64-crt/configure" \
--with-sysroot=${CT_SYSROOT_DIR} \
--prefix=${MINGW_INSTALL_PREFIX} \
--build=${CT_BUILD} \
diff --git a/scripts/build/libc/musl.sh b/scripts/build/libc/musl.sh
index 5a53fd0..430fb8d 100644
--- a/scripts/build/libc/musl.sh
+++ b/scripts/build/libc/musl.sh
@@ -3,17 +3,11 @@
# Licensed under the GPL v2. See COPYING in the root of this package
do_libc_get() {
- if [ "${CT_LIBC_MUSL_CUSTOM}" = "y" ]; then
- CT_GetCustom "musl" "${CT_LIBC_MUSL_CUSTOM_VERSION}" \
- "${CT_LIBC_MUSL_CUSTOM_LOCATION}"
- else # ! custom location
- CT_GetFile "musl-${CT_LIBC_VERSION}" http://www.musl-libc.org/releases
- fi # ! custom location
+ CT_Fetch MUSL
}
do_libc_extract() {
- CT_Extract "musl-${CT_LIBC_VERSION}"
- CT_Patch "musl" "${CT_LIBC_VERSION}"
+ CT_ExtractPatch MUSL
}
# Build and install headers and start files
@@ -62,7 +56,7 @@ do_libc_backend_once() {
local libc_mode
local -a extra_cflags
local -a extra_config
- local src_dir="${CT_SRC_DIR}/${CT_LIBC}-${CT_LIBC_VERSION}"
+ local src_dir="${CT_SRC_DIR}/musl"
local multi_dir multi_os_dir multi_root multi_flags multi_index multi_count
local multilib_dir
local hdr_install_subdir
@@ -83,7 +77,7 @@ do_libc_backend_once() {
# From buildroot:
# gcc constant folding bug with weak aliases workaround
# See http://www.openwall.com/lists/musl/2014/05/15/1
- if [ "${CT_CC_GCC_4_9_or_later}" = "y" ]; then
+ if [ "${CT_GCC_BUG_61144}" = "y" ]; then
extra_cflags+=("-fno-toplevel-reorder")
fi
diff --git a/scripts/build/libc/newlib.sh b/scripts/build/libc/newlib.sh
index 3b48507..5c4a356 100644
--- a/scripts/build/libc/newlib.sh
+++ b/scripts/build/libc/newlib.sh
@@ -6,44 +6,20 @@
#
do_libc_get() {
- local libc_src="{http://mirrors.kernel.org/sourceware/newlib,
- ftp://sourceware.org/pub/newlib}"
-
- if [ "${CT_LIBC_NEWLIB_CUSTOM}" = "y" ]; then
- CT_GetCustom "newlib" "${CT_LIBC_NEWLIB_CUSTOM_VERSION}" \
- "${CT_LIBC_NEWLIB_CUSTOM_LOCATION}"
- else # ! custom location
- case "${CT_LIBC_VERSION}" in
- linaro-*)
- CT_GetLinaro "newlib" "${CT_LIBC_VERSION}"
- ;;
- *)
- # kernel.org mirror is outdated, keep last as a fallback
- CT_GetFile "newlib-${CT_LIBC_VERSION}" \
- ftp://sourceware.org/pub/newlib \
- http://mirrors.kernel.org/sourceware/newlib \
- http://mirrors.kernel.org/sources.redhat.com/newlib
- ;;
- esac
- fi # ! custom location
+ CT_Fetch NEWLIB
}
do_libc_extract() {
- CT_Extract "newlib-${CT_LIBC_VERSION}"
- CT_Patch "newlib" "${CT_LIBC_VERSION}"
-
- if [ -n "${CT_ARCH_XTENSA_CUSTOM_NAME}" ]; then
- CT_ConfigureXtensa "newlib" "${CT_LIBC_VERSION}"
- fi
+ CT_ExtractPatch NEWLIB
}
do_libc_start_files() {
CT_DoStep INFO "Installing C library headers & start files"
- CT_DoExecLog ALL cp -a "${CT_SRC_DIR}/newlib-${CT_LIBC_VERSION}/newlib/libc/include/." \
+ CT_DoExecLog ALL cp -a "${CT_SRC_DIR}/newlib/newlib/libc/include/." \
"${CT_HEADERS_DIR}"
- if [ "${CT_ARCH_xtensa}" = "y" ]; then
+ if [ "${CT_ARCH_XTENSA}" = "y" ]; then
CT_DoLog EXTRA "Installing Xtensa headers"
- CT_DoExecLog ALL cp -r "${CT_SRC_DIR}/newlib-${CT_LIBC_VERSION}/newlib/libc/sys/xtensa/include/." \
+ CT_DoExecLog ALL cp -r "${CT_SRC_DIR}/newlib/newlib/libc/sys/xtensa/include/." \
"${CT_HEADERS_DIR}"
fi
CT_EndStep
@@ -131,7 +107,7 @@ ENABLE_TARGET_OPTSPACE:target-optspace
AR_FOR_TARGET="`which ${CT_TARGET}-gcc-ar`" \
RANLIB_FOR_TARGET="`which ${CT_TARGET}-gcc-ranlib`" \
${CONFIG_SHELL} \
- "${CT_SRC_DIR}/newlib-${CT_LIBC_VERSION}/configure" \
+ "${CT_SRC_DIR}/newlib/configure" \
--host=${CT_BUILD} \
--target=${CT_TARGET} \
--prefix=${CT_PREFIX_DIR} \
diff --git a/scripts/build/libc/uClibc.sh b/scripts/build/libc/uClibc.sh
index a730a1d..af07888 100644
--- a/scripts/build/libc/uClibc.sh
+++ b/scripts/build/libc/uClibc.sh
@@ -2,53 +2,14 @@
# Copyright 2007 Yann E. MORIN
# Licensed under the GPL v2. See COPYING in the root of this package
-# This is a constant because it does not change very often.
-# We're in 2010, and are still using data from 7 years ago.
-uclibc_locales_version=030818
-uclibc_locale_tarball="uClibc-locale-${uclibc_locales_version}"
-
-if [ "${CT_LIBC_UCLIBC_NG}" = "y" ]; then
- uclibc_name="uClibc-ng"
- libc_src="http://downloads.uclibc-ng.org/releases/${CT_LIBC_VERSION}"
-else
- uclibc_name="uClibc"
- libc_src="http://www.uclibc.org/downloads
- http://www.uclibc.org/downloads/old-releases"
-fi
-
# Download uClibc
do_libc_get() {
- if [ "${CT_LIBC_UCLIBC_CUSTOM}" = "y" ]; then
- CT_GetCustom "${uclibc_name}" "${CT_LIBC_UCLIBC_CUSTOM_VERSION}" \
- "${CT_LIBC_UCLIBC_CUSTOM_LOCATION}"
- else
- CT_GetFile "${uclibc_name}-${CT_LIBC_VERSION}" ${libc_src}
- fi
- # uClibc locales
- if [ "${CT_LIBC_UCLIBC_LOCALES_PREGEN_DATA}" = "y" ]; then
- CT_GetFile "${uclibc_locale_tarball}" ${libc_src}
- fi
-
- return 0
+ CT_Fetch UCLIBC
}
# Extract uClibc
do_libc_extract() {
- CT_Extract "${uclibc_name}-${CT_LIBC_VERSION}"
- CT_Patch "${uclibc_name}" "${CT_LIBC_VERSION}"
-
- # uClibc locales
- # Extracting pregen locales ourselves is kinda
- # broken, so just link it in place...
- if [ "${CT_LIBC_UCLIBC_LOCALES_PREGEN_DATA}" = "y" \
- -a ! -f "${CT_SRC_DIR}/.${uclibc_locale_tarball}.extracted" ]; then
- CT_Pushd "${CT_SRC_DIR}/${uclibc_name}-${CT_LIBC_VERSION}/extra/locale"
- CT_DoExecLog ALL ln -s "${CT_TARBALLS_DIR}/${uclibc_locale_tarball}.tgz" .
- CT_Popd
- touch "${CT_SRC_DIR}/.${uclibc_locale_tarball}.extracted"
- fi
-
- return 0
+ CT_ExtractPatch UCLIBC
}
# Build and install headers and start files
@@ -93,16 +54,19 @@ do_libc_backend_once() {
local -a make_args
local extra_cflags f cfg_cflags cf
local hdr_install_subdir
+ local uclibc_name
for arg in "$@"; do
eval "${arg// /\\ }"
done
- CT_DoStep INFO "Building for multilib ${multi_index}/${multi_count}: '${multi_flags}'"
+ if [ "${CT_UCLIBC_USE_UCLIBC_NG_ORG}" = "y" ]; then
+ uclibc_name="uClibc-ng"
+ elif [ "${CT_UCLIBC_USE_UCLIBC_ORG}" = "y" ]; then
+ uclibc_name="uClibc"
+ fi
- # Simply copy files until uClibc has the ability to build out-of-tree
- CT_DoLog EXTRA "Copying sources to build dir"
- CT_DoExecLog ALL cp -av "${CT_SRC_DIR}/${uclibc_name}-${CT_LIBC_VERSION}/." .
+ CT_DoStep INFO "Building for multilib ${multi_index}/${multi_count}: '${multi_flags}'"
multilib_dir="lib/${multi_os_dir}"
startfiles_dir="${multi_root}/usr/${multilib_dir}"
@@ -122,11 +86,14 @@ do_libc_backend_once() {
HOSTCC="${CT_BUILD}-gcc" \
PREFIX="${multi_root}/" \
MULTILIB_DIR="${multilib_dir}" \
- LOCALE_DATA_FILENAME="${uclibc_locale_tarball}.tgz" \
STRIPTOOL=true \
${CT_LIBC_UCLIBC_VERBOSITY} \
)
+ # Simply copy files until uClibc has the ability to build out-of-tree
+ CT_DoLog EXTRA "Copying sources to build dir"
+ CT_DoExecLog ALL cp -av "${CT_SRC_DIR}/uClibc/." .
+
# Force the date of the pregen locale data, as the
# newer ones that are referenced are not available
CT_DoLog EXTRA "Applying configuration"
@@ -323,27 +290,15 @@ manage_uClibc_config() {
# entirely if LOCALE is not set. If LOCALE was already set, we'll
# assume the user has already made all the appropriate generation
# arrangements. Note that having the uClibc Makefile download the
- # pregenerated locales is not compatible with crosstool; besides,
- # crosstool downloads them as part of getandpatch.sh.
- CT_KconfigDeleteOption "UCLIBC_DOWNLOAD_PREGENERATED_LOCALE" "${dst}"
- case "${CT_LIBC_UCLIBC_LOCALES}:${CT_LIBC_UCLIBC_LOCALES_PREGEN_DATA}" in
- :*)
- ;;
- y:)
+ # pregenerated locales is not compatible with crosstool.
+ if [ -z "${CT_LIBC_UCLIBC_LOCALES}" ]; then
+ CT_KconfigDisableOption "UCLIBC_HAS_LOCALE" "${dst}"
+ else
CT_KconfigEnableOption "UCLIBC_HAS_LOCALE" "${dst}"
CT_KconfigDeleteOption "UCLIBC_PREGENERATED_LOCALE_DATA" "${dst}"
- CT_KconfigDeleteOption "UCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA" \
- "${dst}"
+ CT_KconfigDeleteOption "UCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA" "${dst}"
CT_KconfigDeleteOption "UCLIBC_HAS_XLOCALE" "${dst}"
- ;;
- y:y)
- CT_KconfigEnableOption "UCLIBC_HAS_LOCALE" "${dst}"
- CT_KconfigEnableOption "UCLIBC_PREGENERATED_LOCALE_DATA" "${dst}"
- CT_KconfigDeleteOption "UCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA" \
- "${dst}"
- CT_KconfigDeleteOption "UCLIBC_HAS_XLOCALE" "${dst}"
- ;;
- esac
+ fi
# WCHAR support
if [ "${CT_LIBC_UCLIBC_WCHAR}" = "y" ]; then
diff --git a/scripts/build/test_suite.sh b/scripts/build/test_suite.sh
index 8fabf42..e963a99 100644
--- a/scripts/build/test_suite.sh
+++ b/scripts/build/test_suite.sh
@@ -7,8 +7,7 @@
CT_TEST_SUITE_FACILITY_LIST=
for f in "${CT_LIB_DIR}/scripts/build/test_suite/"*.sh; do
_f="$(basename "${f}" .sh)"
- __f="CT_TEST_SUITE_${_f}"
- __f=`echo ${__f} | tr "[:lower:]" "[:upper:]"`
+ __f="CT_TEST_SUITE_${_f^^}"
if [ "${!__f}" = "y" ]; then
CT_DoLog DEBUG "Enabling test suite '${_f}'"
. "${f}"
diff --git a/scripts/build/test_suite/gcc.sh b/scripts/build/test_suite/gcc.sh
index c829a43..6c6e5a7 100644
--- a/scripts/build/test_suite/gcc.sh
+++ b/scripts/build/test_suite/gcc.sh
@@ -18,7 +18,7 @@ do_test_suite_gcc_build() {
CT_DoExecLog ALL cp -av "${CT_LIB_DIR}/contrib/gcc-test-suite/default.cfg" \
"${CT_LIB_DIR}/contrib/gcc-test-suite/Makefile" \
"${CT_LIB_DIR}/contrib/gcc-test-suite/README" \
- "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/gcc/testsuite" \
+ "${CT_SRC_DIR}/gcc/gcc/testsuite" \
"${CT_TEST_SUITE_DIR}/gcc"
CT_DoExecLog ALL sed -i -r -e "s/@@DG_TARGET@@/${CT_TARGET}/g;" \
diff --git a/scripts/crosstool-NG.sh.in b/scripts/crosstool-NG.sh.in
index 78b3d0f..bd07c6b 100644
--- a/scripts/crosstool-NG.sh.in
+++ b/scripts/crosstool-NG.sh.in
@@ -166,7 +166,8 @@ CT_PKGVERSION="crosstool-NG ${CT_VERSION}${CT_TOOLCHAIN_PKGVERSION:+ - ${CT_TOOL
# Compute the working directories names
CT_TARBALLS_DIR="${CT_WORK_DIR}/tarballs"
-CT_SRC_DIR="${CT_WORK_DIR}/src"
+CT_COMMON_SRC_DIR="${CT_WORK_DIR}/src"
+CT_SRC_DIR="${CT_BUILD_DIR}/src"
CT_BUILDTOOLS_PREFIX_DIR="${CT_BUILD_TOP_DIR}/buildtools"
CT_STATE_DIR="${CT_WORK_DIR}/${CT_TARGET}/state"
# Note about HOST_COMPLIBS_DIR: it's always gonna be in the buildtools dir, or a
@@ -244,12 +245,14 @@ CT_DoForceRmdir "${CT_BUILD_DIR}" "${CT_BUILDTOOLS_PREFIX_DIR}"
# Don't eradicate directories if we need to restart
if [ -z "${CT_RESTART}" ]; then
+ # Per-target sources: eliminate
+ CT_DoForceRmdir "${CT_SRC_DIR}"
# Get rid of pre-existing installed toolchain and previous build directories.
if [ "${CT_FORCE_DOWNLOAD}" = "y" -a -d "${CT_TARBALLS_DIR}" ]; then
CT_DoForceRmdir "${CT_TARBALLS_DIR}"
fi
- if [ "${CT_FORCE_EXTRACT}" = "y" -a -d "${CT_SRC_DIR}" ]; then
- CT_DoForceRmdir "${CT_SRC_DIR}"
+ if [ "${CT_FORCE_EXTRACT}" = "y" -a -d "${CT_COMMON_SRC_DIR}" ]; then
+ CT_DoForceRmdir "${CT_COMMON_SRC_DIR}"
fi
if [ -d "${CT_PREFIX_DIR}" -a "${CT_RM_RF_PREFIX_DIR}" = "y" ]; then
CT_DoForceRmdir "${CT_PREFIX_DIR}"
@@ -264,6 +267,7 @@ fi
# create already existent directories, and CT_BUILD_DIR needs to be created
# anyway
CT_DoExecLog ALL mkdir -p "${CT_TARBALLS_DIR}"
+CT_DoExecLog ALL mkdir -p "${CT_COMMON_SRC_DIR}"
CT_DoExecLog ALL mkdir -p "${CT_SRC_DIR}"
CT_DoExecLog ALL mkdir -p "${CT_BUILD_DIR}"
CT_DoExecLog ALL mkdir -p "${CT_BUILDTOOLS_PREFIX_DIR}/bin"
diff --git a/scripts/functions b/scripts/functions
index c1b99ce..79b7321 100644
--- a/scripts/functions
+++ b/scripts/functions
@@ -5,7 +5,7 @@
# Licensed under the GPL v2. See COPYING in the root of this package
CT_LoadConfig() {
- local o
+ local o oldvals vals
# Parse the configuration file
# It has some info about the logging facility, so include it early
@@ -23,7 +23,7 @@ CT_LoadConfig() {
. "${CT_LIB_DIR}/scripts/build/companion_libs.sh"
. "${CT_LIB_DIR}/scripts/build/binutils/${CT_BINUTILS}.sh"
. "${CT_LIB_DIR}/scripts/build/libc/${CT_LIBC}.sh"
- . "${CT_LIB_DIR}/scripts/build/cc.sh"
+ . "${CT_LIB_DIR}/scripts/build/cc/${CT_CC}.sh"
. "${CT_LIB_DIR}/scripts/build/debug.sh"
. "${CT_LIB_DIR}/scripts/build/test_suite.sh"
@@ -200,7 +200,7 @@ CT_LogEnable() {
exec 6>&1 7>&2 8<&0
CT_BUILD_LOG="${CT_TOP_DIR}/build.log"
CT_LOG_ENABLED=y
- if [ "$clean" = "yes" ]; then
+ if [ "$clean" = "yes" ]; then
rm -f "${CT_BUILD_LOG}"
fi
exec >>"${CT_BUILD_LOG}"
@@ -283,7 +283,7 @@ CT_DoLog() {
_prog_bar_cpt=$(((_prog_bar_cpt+1)%40))
fi
elif [ ${cur_l} -le ${CT_LOG_LEVEL_WARN} ]; then
- printf "[%-5s]%*s%s%s\n" "${cur_L}" "${indent}" " " "${line}"
+ printf "[%-5s]%*s%s%s\n" "${cur_L}" "${indent}" " " "${line}" >&2
fi
done
)
@@ -537,18 +537,14 @@ CT_Pushd() {
pushd "$1" >/dev/null 2>&1
}
CT_Popd() {
+ local dir=`dirs +0`
+
+ CT_DoLog DEBUG "Leaving '${dir}'"
popd >/dev/null 2>&1
}
-# Create a dir and cd or pushd into it
-# Usage: CT_mkdir_cd <dir/to/create>
-# CT_mkdir_pushd <dir/to/create>
-CT_mkdir_cd() {
- local dir="${1}"
-
- mkdir -p "${dir}"
- cd "${dir}"
-}
+# Create a dir and pushd into it
+# Usage: CT_mkdir_pushd <dir/to/create>
CT_mkdir_pushd() {
local dir="${1}"
@@ -624,7 +620,8 @@ CT_SetLibPath() {
# Build up the list of allowed tarball extensions
# Add them in the prefered order; most preferred comes first
-CT_DoListTarballExt() {
+CT_DoListTarballExt()
+{
printf ".tar.xz\n"
printf ".tar.lzma\n"
printf ".tar.bz2\n"
@@ -637,17 +634,15 @@ CT_DoListTarballExt() {
# Usage: CT_GetFileExtension <component_name-component_version> [extension]
# If found, echoes the extension to stdout, and return 0
# If not found, echoes nothing on stdout, and return !0.
-CT_GetFileExtension() {
+CT_GetFileExtension()
+{
local ext
local file="$1"
shift
local first_ext="$1"
- # 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} $(CT_DoListTarballExt) /.git ''; do
- if [ -e "${CT_TARBALLS_DIR}/${file}${ext}" -o -L "${CT_TARBALLS_DIR}/${file}${ext}" ]; then
+ for ext in ${first_ext} $(CT_DoListTarballExt); do
+ if [ -e "${file}${ext}" -o -L "${file}${ext}" ]; then
echo "${ext}"
exit 0
fi
@@ -656,6 +651,20 @@ CT_GetFileExtension() {
exit 1
}
+# Get file's basename by stripping supported archive extensions
+CT_GetFileBasename()
+{
+ local bn="${1}"
+ local ext
+
+ for ext in $(CT_DoListTarballExt); do
+ if [ "${bn%.${ext}}" != "${bn}" ]; then
+ echo "${bn%.${ext}}"
+ exit 0
+ fi
+ done
+}
+
# Try to retrieve the specified URL (HTTP or FTP)
# Usage: CT_DoGetFile <URL>
# This functions always returns true (0), as it can be legitimate not
@@ -711,8 +720,8 @@ CT_GetLocal() {
local ext
# Do we already have it in *our* tarballs dir?
- if ext="$( CT_GetFileExtension "${basename}" ${first_ext} )"; then
- CT_DoLog DEBUG "Already have '${basename}'"
+ if ext="$( CT_GetFileExtension "${CT_TARBALLS_DIR}/${basename}" ${first_ext} )"; then
+ CT_DoLog DEBUG "Already have '${CT_TARBALLS_DIR}/${basename}${ext}'"
return 0
fi
@@ -733,61 +742,6 @@ CT_GetLocal() {
return 1
}
-# This function gets the custom source from either a tarball or directory
-# Usage: CT_GetCustom <name> <version> <location>
-CT_GetCustom() {
- local component_name="$1"
- local component_version="$2"
- local component_location="$3"
-
- # Some local variables we use to help us figure out what to do
- local component_location_type="dir" # str: 'file' or 'dir'
- local component_location_filename="" # filename... if it's a file
-
- CT_TestAndAbort \
- "${component_name}: Custom location setting is empty" \
- -z "${component_location}"
-
- CT_TestAndAbort \
- "${component_name}: Custom version setting is empty" \
- -z "${component_version}"
-
- if [ -f "${component_location}" ]; then
- component_location_type="file"
- component_location_filename="$(basename ${component_location})"
- elif [ -d "${component_location}" ]; then
- # Yes, it's the default, but it rules out the else case in the `if'.
- component_location_type="dir"
- # as -d and -f say: it's a <directory|file> and is readable!
- else
- CT_Abort "${component_name}: Unable to read ${component_location}, make sure the setting is correct and double check the permissions!"
- fi
-
- if [ "${component_location_type}" = "file" ]; then
- CT_DoLog EXTRA "Got '${component_location}' from custom location"
- # We need to know the custom tarball extension,
- # so we can create a properly-named symlink, which
- # we use later on in 'extract'
- case "${component_location}" in
- *.tar.xz|*.tar.bz2|*.tar.lzma|*.tar.gz|*.tgz|*.tar|*.zip) ;;
- *) CT_Abort "Unknown extension for custom tarball '${component_location}'" ;;
- esac
- [ ! -L "${CT_TARBALLS_DIR}/${component_location_filename}" ] && \
- CT_DoExecLog DEBUG ln -sf "${component_location}" \
- "${CT_TARBALLS_DIR}/${component_location_filename}"
- elif [ "${component_location_type}" = "dir" ]; then
- CT_DoLog EXTRA "Got '${component_location}' from custom location"
- [ ! -d "${CT_SRC_DIR}/${component_name}-${component_version}" ] && \
- CT_DoExecLog DEBUG ln -sf "${component_location}" \
- "${CT_SRC_DIR}/${component_name}-${component_version}"
-
- # Don't try to extract from source directory, it's extracted!
- touch "${CT_SRC_DIR}/.${component_name}-${component_version}.extracted"
- fi
- # Don't patch a custom source, it's custom!
- touch "${CT_SRC_DIR}/.${component_name}-${component_version}.patched"
-}
-
# This function saves the specified to local storage if possible,
# and if so, symlinks it for later usage
# Usage: CT_SaveLocal </full/path/file.name>
@@ -864,437 +818,11 @@ CT_GetFile() {
done
done
- # Just return error, someone may want to catch and handle the error
- # (eg. glibc add-ons can be missing).
+ # Just return error: CT_DoFetch will check it and will handle it appropriately.
return 1
}
-# Get a component from Linaro archives.
-# Usage: CT_GetLinaro <component> <version>
-CT_GetLinaro() {
- local comp="$1"
- local version="$2"
- local linaro_version
- local yyyymm_p
- local yymm
- local base
-
- case "${version}" in
- linaro-*)
- linaro_version="${version#linaro-}"
- ;;
- *)
- CT_Abort "Version ${version} is not a Linaro package"
- ;;
- esac
-
- # Recent releases reside in top of the directory tree; older releases
- # are moved into the archive. Subdirectories are named differently
- # in archive!
- # In archive, some URLs also contain base component version
- # (e.g. "gcc-linaro/4.9") while some do not (e.g. just "newlib-linaro").
- base="${linaro_version%%-*}"
- # Strip base version, first two digits of the year and optional patchlevel
- yymm="${linaro_version#*-??}"
- yymm="${yymm%-*}"
- CT_GetFile "${comp}-${version}" \
- "https://releases.linaro.org/components/toolchain/${comp}-linaro/${linaro_version}" \
- "https://releases.linaro.org/archive/${yymm}/components/toolchain/${comp}-linaro/${base}" \
- "https://releases.linaro.org/archive/${yymm}/components/toolchain/${comp}-linaro"
-}
-
-# Checkout from CVS, and build the associated tarball
-# The tarball will be called ${basename}.tar.bz2
-# Prerequisite: either the server does not require password,
-# or the user must already be logged in.
-# 'tag' is the tag to retrieve. Must be specified, but can be empty.
-# If dirname is specified, then module will be renamed to dirname
-# prior to building the tarball.
-# Usage: CT_GetCVS <basename> <url> <module> <tag> [dirname[=subdir]]
-# Note: if '=subdir' is given, then it is used instead of 'module'.
-CT_GetCVS() {
- local basename="$1"
- local uri="$2"
- local module="$3"
- local tag="${4:+-r ${4}}"
- local dirname="$5"
- local tmp_dir
-
- # First try locally, then the mirror
- if CT_GetFile "${basename}"; then
- # Got it! Return early! :-)
- return 0
- fi
-
- if [ "${CT_FORBID_DOWNLOAD}" = "y" ]; then
- CT_DoLog WARN "Downloads forbidden, not trying cvs retrieval"
- return 1
- fi
-
- CT_MktempDir tmp_dir
- CT_Pushd "${tmp_dir}"
-
- CT_DoExecLog ALL cvs -z 9 -d "${uri}" co -P ${tag} "${module}"
- if [ -n "${dirname}" ]; then
- case "${dirname}" in
- *=*)
- CT_DoExecLog DEBUG mv "${dirname#*=}" "${dirname%%=*}"
- CT_DoExecLog ALL tar cjf "${CT_TARBALLS_DIR}/${basename}.tar.bz2" "${dirname%%=*}"
- ;;
- *)
- CT_DoExecLog ALL mv "${module}" "${dirname}"
- CT_DoExecLog ALL tar cjf "${CT_TARBALLS_DIR}/${basename}.tar.bz2" "${dirname:-${module}}"
- ;;
- esac
- fi
- CT_SaveLocal "${CT_TARBALLS_DIR}/${basename}.tar.bz2"
-
- CT_Popd
- CT_DoExecLog ALL rm -rf "${tmp_dir}"
-}
-
-# Check out from SVN, and build the associated tarball
-# The tarball will be called ${basename}.tar.bz2
-# Prerequisite: either the server does not require password,
-# or the user must already be logged in.
-# 'rev' is the revision to retrieve
-# Usage: CT_GetSVN <basename> <url> [rev]
-CT_GetSVN() {
- local basename="$1"
- local uri="$2"
- local rev="$3"
-
- # First try locally, then the mirror
- if CT_GetFile "${basename}"; then
- # Got it! Return early! :-)
- return 0
- fi
-
- if [ "${CT_FORBID_DOWNLOAD}" = "y" ]; then
- CT_DoLog WARN "Downloads forbidden, not trying svn retrieval"
- return 1
- fi
-
- CT_MktempDir tmp_dir
- CT_Pushd "${tmp_dir}"
-
- if ! CT_DoExecLog ALL svn export ${rev:+-r ${rev}} "${uri}" "${basename}"; then
- CT_DoLog WARN "Could not retrieve '${basename}'"
- return 1
- fi
- CT_DoExecLog ALL tar cjf "${CT_TARBALLS_DIR}/${basename}.tar.bz2" "${basename}"
- CT_SaveLocal "${CT_TARBALLS_DIR}/${basename}.tar.bz2"
-
- CT_Popd
- CT_DoExecLog ALL rm -rf "${tmp_dir}"
-}
-
-# Clone a git tree
-# Tries the given URLs in turn until one can get cloned. No tarball will be created.
-# Prerequisites: either the server does not require password,
-# or the user has already taken any action to authenticate to the server.
-# The cloned tree will *not* be stored in the local tarballs dir!
-# cset_or_ref can be a branch or tag, if specified as 'ref=name'
-# In this case, 'git ls-remote' is used to get the sha1 and can also
-# be used to get a list valid refs (e.g. HEAD, refs/heads/master, refs/tags/v3.3.0)
-# Usage: CT_GetGit <basename> <cset_or_ref> <url> <out_cset>
-CT_GetGit() {
- local basename="${1}"
- local cset_or_ref="${2}"
- local url="${3}"
- local _out_cset="${4}"
-
- local ref=$(echo "${cset_or_ref}" | ${sed} -n 's/^ref=\(.*\)/\1/p')
- if [ -n "$ref" ]; then
- local matches=$(git ls-remote --exit-code "$url" --refs "${ref}")
- local result=$?
- CT_TestAndAbort "Failed to find git ref ${ref} at ${url}" "${result}" != "0"
- if [ $( echo "$matches" | wc -l) -gt 1 ]; then
- CT_DoLog WARN "Ambiguous ref ${ref} at ${url}, using first"
- fi
- local cset=$(echo "$matches" | head -n1 | cut -c1-6)
- CT_DoLog DEBUG "ref ${ref} at ${url} has cset of ${cset}"
- else
- local cset=${cset_or_ref}
- CT_DoLog DEBUG "cset ${cset}"
- fi
-
- if [ -n "${_out_cset}" ]; then
- eval ${_out_cset}=\${cset}
- fi
-
- local dir="${CT_TARBALLS_DIR}/${basename}-${cset}.git"
- local file="${basename}-${cset}.tar.gz"
- local dest="${CT_TARBALLS_DIR}/${file}"
- local tmp="${CT_TARBALLS_DIR}/${file}.tmp-dl"
-
- # Do we already have it?
- if CT_GetLocal "${file}"; then
- echo ${cset}
- return 0
- fi
- # Nope...
-
- if [ "${CT_FORBID_DOWNLOAD}" = "y" ]; then
- CT_DoLog WARN "Downloads forbidden, not trying git retrieval"
- return 1
- fi
-
- # Add URLs on the LAN mirror
- # We subvert the normal download method, just to look for
- # looking at the local mirror
- if CT_GetFile "${basename}-${cset}" .tar.gz; then
- return 0
- fi
-
- CT_DoLog EXTRA "Retrieving '${basename}-${cset}' (git)"
-
- # Remove potential left-over from a previous run
- CT_DoExecLog ALL rm -rf "${tmp}.tar.gz" "${tmp}.tar" "${tmp}" "${dir}"
-
- if CT_DoExecLog ALL git clone "${url}" "${dir}"; then
- # Yep, cloned OK
- CT_Pushd "${dir}"
- CT_DoExecLog ALL git archive --format=tar \
- --prefix="${basename}-${cset}/" \
- -o "${tmp}.tar" \
- "${cset}"
- CT_DoExecLog ALL gzip -9 "${tmp}.tar"
- CT_DoExecLog ALL mv -f "${tmp}.tar.gz" "${dest}"
- CT_SaveLocal "${dest}"
- CT_DoExecLog ALL rm -rf "${tmp}.tar.gz" "${tmp}.tar" "${tmp}" "${dir}"
- CT_Popd
- echo ${cset}
- return 0
- else
- # Woops...
- CT_DoExecLog ALL rm -rf "${dir}"
- CT_DoLog DEBUG "Could not clone '${basename}'"
- return 1
- fi
-}
-
-# Extract a tarball
-# 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. This is taken into account
-# by the caller, that did a 'cd' into the correct path before calling us
-# and sets nochdir to 'nochdir'.
-# Note also that this function handles the git trees!
-# Usage: CT_Extract [nochdir] <basename> [options]
-# where 'options' are dependent on the source (eg. git branch/tag...)
-CT_Extract() {
- local nochdir="$1"
- local basename
- local ext
- local -a tar_opts
-
- if [ "${nochdir}" = "nochdir" ]; then
- shift
- nochdir="$(pwd)"
- else
- nochdir="${CT_SRC_DIR}"
- fi
-
- basename="$1"
- shift
-
- # Check if already extracted
- if [ -e "${CT_SRC_DIR}/.${basename}.extracted" ]; then
- CT_DoLog DEBUG "Already extracted '${basename}'"
- return 0
- fi
-
- if ! ext="$(CT_GetFileExtension "${basename}")"; then
- CT_DoLog WARN "'${basename}' not found in '${CT_TARBALLS_DIR}'"
- return 1
- fi
- local full_file="${CT_TARBALLS_DIR}/${basename}${ext}"
-
- # Check if previously partially extracted
- if [ -e "${CT_SRC_DIR}/.${basename}.extracting" ]; then
- CT_DoLog ERROR "The '${basename}' sources were partially extracted."
- CT_DoLog ERROR "Please remove first:"
- CT_DoLog ERROR " - the source dir for '${basename}', in '${CT_SRC_DIR}'"
- CT_DoLog ERROR " - the file '${CT_SRC_DIR}/.${basename}.extracting'"
- CT_Abort "I'll stop now to avoid any carnage..."
- fi
- CT_DoExecLog DEBUG touch "${CT_SRC_DIR}/.${basename}.extracting"
-
- CT_Pushd "${nochdir}"
-
- CT_DoLog EXTRA "Extracting '${basename}'"
- CT_DoExecLog FILE mkdir -p "${basename}"
- tar_opts=( "--strip-components=1" )
- tar_opts+=( "-C" "${basename}" )
- tar_opts+=( "-xv" )
-
- case "${ext}" in
- .tar.xz) xz -fdc "${full_file}" | CT_DoExecLog FILE tar "${tar_opts[@]}" -f -;;
- .tar.lzma) xz -fdc "${full_file}" | CT_DoExecLog FILE tar "${tar_opts[@]}" -f -;;
- .tar.bz2) bzip2 -dc "${full_file}" | CT_DoExecLog FILE tar "${tar_opts[@]}" -f -;;
- .tar.gz|.tgz) gzip -dc "${full_file}" | CT_DoExecLog FILE tar "${tar_opts[@]}" -f -;;
- .tar) CT_DoExecLog FILE tar "${tar_opts[@]}" -f "${full_file}";;
- .zip) CT_DoExecLog FILE unzip "${@}" "${full_file}";;
- /.git) CT_ExtractGit "${basename}" "${@}";;
- *) CT_DoLog WARN "Don't know how to handle '${basename}${ext}': unknown extension"
- return 1
- ;;
- esac
-
- # Don't mark as being extracted for git
- case "${ext}" in
- /.git) ;;
- *) CT_DoExecLog DEBUG touch "${CT_SRC_DIR}/.${basename}.extracted";;
- esac
- CT_DoExecLog DEBUG rm -f "${CT_SRC_DIR}/.${basename}.extracting"
-
- CT_Popd
-}
-
-# Create a working git clone of a local git repository
-# Usage: CT_ExtractGit <basename> [ref]
-# where 'ref' is the reference to use:
-# the full name of a branch, like "remotes/origin/branch_name"
-# a date as understandable by git, like "YYYY-MM-DD[ hh[:mm[:ss]]]"
-# a tag name
-# If 'ref' is not given, the current repository HEAD will be used
-CT_ExtractGit() {
- local basename="${1}"
- local ref="${2}"
- local repo
- local ref_type
-
- # pushd now to be able to get git revlist in case ref is a date
- repo="${CT_TARBALLS_DIR}/${basename}"
- CT_Pushd "${repo}"
-
- # What kind of reference is ${ref} ?
- if [ -z "${ref}" ]; then
- ref_type=head
- ref=$(git rev-list -n1 HEAD)
- elif git tag |{grep} -E "^${ref}$" >/dev/null 2>&1; then
- ref_type=tag
- elif git branch -a --no-color |${grep} -E "^. ${ref}$" >/dev/null 2>&1; then
- ref_type=branch
- elif date -d "${ref}" >/dev/null 2>&1; then
- ref_type=date
- ref=$(git rev-list -n1 --before="${ref}")
- else
- CT_Abort "Reference '${ref}' is an incorrect git reference: neither tag, branch nor date"
- fi
-
- CT_Popd
-
- CT_DoExecLog FILE rmdir "${basename}"
- case "${ref_type}" in
- branch) CT_DoExecLog FILE git clone -b "${ref}" "${repo}" "${basename}" ;;
- *) CT_DoExecLog FILE git clone "${repo}" "${basename}"
- CT_Pushd "${basename}"
- CT_DoExecLog FILE git checkout "${ref}"
- CT_Popd
- ;;
- esac
-}
-
-# Patches the specified component
-# See CT_Extract, above, for explanations on 'nochdir'
-# Usage: CT_Patch [nochdir] <packagename> <packageversion>
-# If the package directory is *not* packagename-packageversion, then
-# the caller must cd into the proper directory first, and call us
-# with nochdir
-CT_Patch() {
- local nochdir="$1"
- local pkgname
- local version
- local pkgdir
- local base_file
- local ver_file
- local d
- local -a patch_dirs
- local bundled_patch_dir
- local local_patch_dir
- local bundled_exp_patch_dir
- local local_exp_patch_dir
-
- if [ "${nochdir}" = "nochdir" ]; then
- shift
- pkgname="$1"
- version="$2"
- pkgdir="${pkgname}-${version}"
- nochdir="$(pwd)"
- else
- pkgname="$1"
- version="$2"
- pkgdir="${pkgname}-${version}"
- nochdir="${CT_SRC_DIR}/${pkgdir}"
- fi
-
- # Check if already patched
- if [ -e "${CT_SRC_DIR}/.${pkgdir}.patched" ]; then
- CT_DoLog DEBUG "Already patched '${pkgdir}'"
- return 0
- fi
-
- # Check if already partially patched
- if [ -e "${CT_SRC_DIR}/.${pkgdir}.patching" ]; then
- CT_DoLog ERROR "The '${pkgdir}' sources were partially patched."
- CT_DoLog ERROR "Please remove first:"
- CT_DoLog ERROR " - the source dir for '${pkgdir}', in '${CT_SRC_DIR}'"
- CT_DoLog ERROR " - the file '${CT_SRC_DIR}/.${pkgdir}.extracted'"
- CT_DoLog ERROR " - the file '${CT_SRC_DIR}/.${pkgdir}.patching'"
- CT_Abort "I'll stop now to avoid any carnage..."
- fi
- touch "${CT_SRC_DIR}/.${pkgdir}.patching"
-
- CT_Pushd "${nochdir}"
-
- CT_DoLog EXTRA "Patching '${pkgdir}'"
-
- bundled_patch_dir="${CT_LIB_DIR}/patches/${pkgname}/${version}"
- bundled_patch_arch_dir="${bundled_patch_dir}/${CT_ARCH}"
- local_patch_dir="${CT_LOCAL_PATCH_DIR}/${pkgname}/${version}"
-
- case "${CT_PATCH_ORDER}" in
- bundled) patch_dirs=("${bundled_patch_dir}" "${bundled_patch_arch_dir}");;
- local) patch_dirs=("${local_patch_dir}");;
- bundled,local) patch_dirs=("${bundled_patch_dir}" "${bundled_patch_arch_dir}" "${local_patch_dir}");;
- local,bundled) patch_dirs=("${local_patch_dir}" "${bundled_patch_dir}" "${bundled_patch_arch_dir}");;
- none) patch_dirs=;;
- esac
-
- for d in "${patch_dirs[@]}"; do
- CT_DoLog DEBUG "Looking for patches in '${d}'..."
- if [ -n "${d}" -a -d "${d}" ]; then
- for p in "${d}"/*.patch; do
- if [ -f "${p}" ]; then
- CT_DoExecLog ALL ${patch} --no-backup-if-mismatch -g0 -F1 -p1 -f -i "${p}"
- fi
- done
- if [ "${CT_PATCH_SINGLE}" = "y" ]; then
- break
- fi
- fi
- done
-
- if [ "${CT_OVERRIDE_CONFIG_GUESS_SUB}" = "y" ]; then
- CT_DoLog ALL "Overiding config.guess and config.sub"
- for cfg in config_guess config_sub; do
- eval ${cfg}="${CT_LIB_DIR}/scripts/${cfg/_/.}"
- [ -e "${CT_TOP_DIR}/scripts/${cfg/_/.}" ] && eval ${cfg}="${CT_TOP_DIR}/scripts/${cfg/_/.}"
- # Can't use CT_DoExecLog because of the '{} \;' to be passed un-mangled to find
- find . -type f -name "${cfg/_/.}" \
- -exec chmod -v u+w {} \; \
- -exec cp -v "${!cfg}" {} \; |CT_DoLog ALL
- done
- fi
-
- CT_DoExecLog DEBUG touch "${CT_SRC_DIR}/.${pkgdir}.patched"
- CT_DoExecLog DEBUG rm -f "${CT_SRC_DIR}/.${pkgdir}.patching"
-
- CT_Popd
-}
-
+# TBD these should not be needed if config.sub/guess is a package
# Two wrappers to call config.(guess|sub) either from CT_TOP_DIR or CT_LIB_DIR.
# Those from CT_TOP_DIR, if they exist, will be be more recent than those from CT_LIB_DIR.
CT_DoConfigGuess() {
@@ -1915,3 +1443,553 @@ CT_MultilibFixupLDSO()
CT_Popd
CT_EndStep
}
+
+# List the download mirrors. Usage:
+# CT_Mirrors ORGANIZATION PROJECT [...]
+CT_Mirrors()
+{
+ local org="${1}"
+ local project="${2}"
+
+ case "${org}" in
+ GNU)
+ echo "https://ftpmirror.gnu.org/gnu/${project}"
+ echo "http://ftpmirror.gnu.org/gnu/${project}"
+ echo "https://ftp.gnu.org/gnu/${project}"
+ echo "http://ftp.gnu.org/gnu/${project}"
+ echo "ftp://ftp.gnu.org/gnu/${project}"
+ ;;
+ sourceware)
+ echo "ftp://sourceware.org/pub/${project}"
+ echo "http://mirrors.kernel.org/sourceware/${project}"
+ echo "http://gcc.gnu.org/pub/${project}"
+ ;;
+ Linaro)
+ eval "local version=\"\${${3}}\""
+ local base yymm
+ base="${version%%-*}"
+ yymm="${version##*-??}"
+ echo "https://releases.linaro.org/components/toolchain/${project}-linaro/${version}"
+ echo "https://releases.linaro.org/archive/${yymm}/components/toolchain/${project}-linaro/${base}"
+ echo "https://releases.linaro.org/archive/${yymm}/components/toolchain/${project}-linaro"
+ ;;
+ kernel.org)
+ # TBD move to linux.sh?
+ if [ "${project}" != "linux" ]; then
+ CT_Abort "Unsupported project"
+ fi
+ local version="${CT_LINUX_VERSION}"
+ case "${version}" in
+ '')
+ # Ignore, this happens before .config is fully evaluated
+ ;;
+ [34].*)
+ echo "http://www.kernel.org/pub/linux/kernel/v${version%%.*}.x"
+ ;;
+ 2.6.*)
+ echo "http://www.kernel.org/pub/linux/kernel/v2.6"
+ case "${version}" in
+ 2.6.*.*)
+ echo "http://www.kernel.org/pub/linux/kernel/v2.6/longterm"
+ echo "http://www.kernel.org/pub/linux/kernel/v2.6/longterm/v${version%.*}"
+ ;;
+ esac
+ ;;
+ *)
+ CT_Abort "Unsupported Linux kernel version '${version}'"
+ ;;
+ esac
+ ;;
+ *)
+ CT_Abort "Unknown mirror '${org}'"
+ ;;
+ esac
+}
+
+# Get most recent version for CVS check-out.
+# CVS does not have a repository-wide identifier for a commit, so we must
+# use date. Variables are set by CT_PackageRun
+CT_GetVersion_cvs()
+{
+ # If date is not given, use current. Otherwise, check if format is correct.
+ # We don't support fancy CVS specifications like "1 day ago", as we'll need
+ # to convert them to some stable representation like 20170617231304.
+ if [ -z "${devel_revision}" ]; then
+ devel_revision=`LANG=C TZ=UTC date '+%Y/%m/%d %H:%M:%S'`
+ else
+ case "${devel_revision}" in
+ [12][0-9][0-9][0-9]/[01][0-9]/[0-3][0-9]\ [0-2][0-9]:[0-5][0-9]:[0-5][0-9])
+ ;;
+ *)
+ CT_Abort "${pkg_name}: invalid date format ${devel_revision}"
+ ;;
+ esac
+ fi
+ unique_id="${devel_branch:-trunk}-${devel_revision//[^0-9]/}"
+}
+
+# Check out sources from CVS. Variables are set by CT_PackageRun.
+CT_Download_cvs()
+{
+ local pserver="${devel_url%% *}"
+ local module="${devel_url##* }"
+
+ # CVS has no name for "main" branch, so use -r only if non-default
+ # TBD try -'d ${basename}', with/without -N
+ CT_DoExecLog ALL cvs -z 9 -d "${pserver}" co -P ${devel_branch:+-r ${devel_branch}} \
+ -D "${devel_revision} UTC" "${module}"
+ if [ "${module}" != "${pkg_name}" ]; then
+ CT_DoExecLog ALL mv "${module}" "${pkg_name}"
+ fi
+}
+
+# Find the most recent version from Subversion.
+CT_GetVersion_svn()
+{
+ local version
+
+ devel_branch="${devel_branch:-/trunk}"
+
+ # If revision is not given, find the most recent
+ if [ -z "${devel_revision}" ]; then
+ devel_revision=`svn info "${devel_url}${devel_branch}" | sed -n 's/^Last Changed Rev: //p'`
+ fi
+
+ # Construct version from branch/revision
+ version="${devel_branch//\//_}"
+ version="${version#_}"
+ version="${version%_}"
+ version="${version}-${devel_revision}"
+ unique_id="${version}"
+}
+
+# Retrieve sources from Subversion.
+CT_Download_svn()
+{
+ CT_DoExecLog ALL svn export -r "${devel_revision}" "${devel_url}${devel_branch}" "${pkg_name}"
+}
+
+# Find the most recent version from Mercurial.
+CT_GetVersion_hg()
+{
+ if [ -n "${devel_branch}" -a -n "${devel_revision}" ]; then
+ CT_Abort "${pkg_name}: cannot specify both branch and changeset for Mercurial"
+ fi
+
+ # Mercurial cannot query remote branches except the default, so we'll have
+ # to clone if cset is not known and a branch is given.
+ if [ -z "${devel_revision}" ]; then
+ if [ -z "${devel_branch}" ]; then
+ # Mercurial does not allow querying branches
+ devel_revision=`hg identify "${devel_url}"`
+ else
+ CT_DoLog WARN "${pkg_name}: Mercurial cannot query non-default branch, will clone"
+ devel_revision="to.be.determined"
+ fi
+ fi
+ unique_id="${devel_revision}"
+}
+
+# Retrieve sources from Mercurial.
+CT_Download_hg()
+{
+ CT_DoExecLog ALL hg clone "${devel_url}" "${pkg_name}"
+ CT_Pushd "${pkg_name}"
+ if [ -n "${devel_branch}" ]; then
+ CT_DoExecLog ALL hg update "${devel_branch}"
+ fi
+ if [ "${devel_revision}" = "to.be.determined" ]; then
+ # Report what we found out (as common message lacks the revision)
+ devel_revision=`hg identify -i`
+ unique_id="${devel_revision}"
+ CT_DoLog EXTRA "Retrieved revision ${devel_revision}"
+ else
+ CT_DoExecLog ALL hg update "${devel_revision}"
+ fi
+ CT_DoExecLog ALL rm -rf .hg
+ CT_Popd
+}
+
+# Get the most recent version from Git.
+CT_GetVersion_git()
+{
+ if [ -n "${devel_branch}" -a -n "${devel_revision}" ]; then
+ CT_Abort "${pkg_name}: cannot specify both branch and changeset for Git"
+ fi
+
+ devel_branch="${devel_branch:-master}"
+ if [ -z "${devel_revision}" ]; then
+ local matches=`git ls-remote --exit-code "${devel_url}" --refs "${devel_branch}" \
+ || echo "not found"`
+ local best using ref
+
+ # Cannot test $?, setting a trap on ERR prevents bash from returning the
+ # status code.
+ if [ "${matches}" = "not found" ]; then
+ CT_Abort "Failed to find git ref ${devel_branch} at ${devel_url}"
+ fi
+ if [ `echo "${matches}" | wc -l` -gt 1 ]; then
+ if echo "${matches}" | grep '[[:space:]]\(refs/heads/\)\?'"${devel_branch}\$" >/dev/null; then
+ # Try exact match, or prepended with "refs/heads". Some projects (e.g. binutils)
+ # have refs/original/refs/heads/master as well as refs/heads/master, and
+ # `git ls-remote refs/heads/master` prints both.
+ best=`echo "${matches}" | grep '[[:space:]]\(refs/heads/\)\?'"${devel_branch}\$"`
+ using="best match"
+ else
+ best=`echo "${matches}" | head -n1`
+ using="first"
+ fi
+ ref=`echo "${best}" | sed 's/.*[[:space:]]//'`
+ CT_DoLog WARN "Ambiguous ref ${devel_branch} at ${devel_url}, using ${using} (${ref})"
+ else
+ best="${matches}"
+ fi
+ devel_revision=`echo "${best}" | cut -c1-8`
+ CT_DoLog DEBUG "ref ${devel_branch} at ${devel_url} has cset of ${devel_revision}"
+ fi
+ unique_id="${devel_revision}"
+}
+
+# Retrieve sources from Git.
+CT_Download_git()
+{
+ # Git does not allow making a shallow clone of a specific commit.
+ CT_DoExecLog ALL git clone "${devel_url}" "${pkg_name}"
+ CT_Pushd "${pkg_name}"
+ CT_DoExecLog ALL git checkout "${devel_revision}" --
+ CT_DoExecLog ALL rm -rf .git
+ CT_Popd
+}
+
+# Helper: run another action after setting local variables
+CT_PackageRun()
+{
+ local sym="${1}"
+ local run="${2}"
+ local v
+
+ # Get rid of our arguments
+ shift 2
+
+ # Variables that are per-project
+ for v in use dir_name; do
+ eval "local ${v}=\${CT_${sym}_${v^^}}"
+ done
+
+ # If $use is not set, we only have one fork to handle
+ use="${use:-${sym}}"
+
+ # Variables that are per-fork
+ for v in basename pkg_name version \
+ src_release mirrors archive_filename archive_dirname \
+ src_devel devel_vcs devel_url devel_branch devel_revision devel_subdir devel_bootstrap \
+ src_custom custom_location; do
+ eval "local ${v}=\${CT_${use}_${v^^}}"
+ done
+
+ for v in archive_filename archive_dirname; do
+ # kconfig and shell have different quoting rules, so it seems impossible to make
+ # kconfig quote '$' properly for eval (i.e. not have it expanded when loading the
+ # .config). Therefore, use '@' instead of '$' in kconfig files and substitute it
+ # here for select variables.
+ eval "eval ${v}=\${${v}//@/$}"
+ done
+
+ ${run} "$@"
+
+ # Save certain variables that may be modified by the callback.
+ # Fetching the sources is run in the main process, so no need to
+ # use CT_EnvModify.
+ for v in devel_branch devel_revision basename version; do
+ eval "CT_${use}_${v^^}=\${${v}}"
+ eval "CT_DoLog DEBUG \"Override CT_${use}_${v^^}=\${CT_${use}_${v^^}}\""
+ done
+}
+
+# Closure for fetching the sources
+CT_DoFetch()
+{
+ local tmp_dir
+
+ if [ "${src_release}" = "y" ]; then
+ # Some packages do not contain any directory level at all
+ if [ "${archive_dirname}" != "." ]; then
+ basename="${archive_dirname}"
+ else
+ basename="${pkg_name}-${version}"
+ fi
+ if ! CT_GetFile "${archive_filename}" ${mirrors}; then
+ CT_Abort "${pkg_name}: download failed"
+ fi
+
+ elif [ "${src_devel}" = "y" ]; then
+ local unique_id
+
+ if [ -z "${devel_revision}" -a "${CT_FORBID_DOWNLOAD}" = "y" ]; then
+ CT_Abort "${pkg_name}: cannot find most recent revisions with downloads prohibited"
+ fi
+
+ # Each VCS backend must provide two methods:
+ # - CT_GetVersion_xxx that sets the base name for the package (package name
+ # and some unique identifier for the version)
+ # - CT_Download_xxx that retrieves the sources into the directory named as
+ # ${pkg_name}
+ # Both these methods can also modify devel_branch/devel_revision. Typically,
+ # this would override empty (default) values with "default branch name" and
+ # "most current revision", respectively.
+
+ CT_GetVersion_${devel_vcs}
+ if [ -z "${unique_id}" ]; then
+ CT_Abort "${pkg_name}: ${devel_vcs} did not set unique ID for branch/revision"
+ fi
+ basename="${pkg_name}-${devel_vcs}-${unique_id}"
+ version="${devel_vcs}-${unique_id}"
+
+ # Try getting the tarball with empty list of URLs: it will only
+ # attempt getting it from local storage or from the mirror if configured.
+ if [ "${unique_id}" != "to.be.determined" ] && \
+ CT_GetFile "${basename}" .tar.bz2; then
+ return 0
+ fi
+
+ if [ "${CT_FORBID_DOWNLOAD}" = "y" ]; then
+ CT_DoLog WARN "Downloads forbidden, not trying ${devel_vcs} retrieval"
+ return 1
+ fi
+
+ CT_DoLog EXTRA "Retrieving '${basename}' (${devel_vcs} ${devel_url} ${devel_branch} ${devel_revision})"
+ CT_MktempDir tmp_dir
+ CT_Pushd "${tmp_dir}"
+ CT_Download_${devel_vcs}
+
+ # First setting above may not have determined the version (e.g. with Mercurial)
+ # Set the final, downloaded version.
+ version="${devel_vcs}-${unique_id}"
+ basename="${pkg_name}-${version}"
+
+ CT_DoExecLog ALL mv "${pkg_name}${devel_subdir:+/${devel_subdir}}" "${basename}"
+ CT_DoExecLog ALL tar cjf "${CT_TARBALLS_DIR}/${basename}.tar.bz2" "${basename}"
+ CT_SaveLocal "${CT_TARBALLS_DIR}/${basename}.tar.bz2"
+ CT_Popd
+ CT_DoExecLog ALL rm -rf "${tmp_dir}"
+
+ elif [ "${src_custom}" = "y" ]; then
+ # Will be handled during extraction/patching
+ version="local"
+ basename="${pkg_name}-${version}"
+ :;
+ else
+ CT_Abort "No known source for ${pkg_name}"
+ fi
+}
+
+# Obtain the sources for a component, either from a tarball, version control system
+# or a custom location.
+CT_Fetch()
+{
+ CT_PackageRun "${1}" CT_DoFetch
+}
+
+# Unpack an archive.
+CT_Extract()
+{
+ local file="${1}"
+ local dir="${2}"
+ local components="${3}"
+
+ CT_DoExecLog ALL mkdir -p "${dir}"
+ case "${file}" in
+ *.tar.xz)
+ xz -fdc "${file}" | CT_DoExecLog FILE tar x -v -f - -C "${dir}" ${components}
+ ;;
+ *.tar.lzma)
+ xz -fdc "${file}" | CT_DoExecLog FILE tar x -v -f - -C "${dir}" ${components}
+ ;;
+ *.tar.bz2)
+ bzip2 -dc "${file}" | CT_DoExecLog FILE tar x -v -f - -C "${dir}" ${components}
+ ;;
+ *.tar.gz|*.tgz)
+ gzip -dc "${file}" | CT_DoExecLog FILE tar x -v -f - -C "${dir}" ${components}
+ ;;
+ *.tar)
+ CT_DoExecLog FILE tar x -v -f "${file}" -C "${dir}" ${components}
+ ;;
+ *.zip)
+ CT_Pushd "${dir}"
+ CT_DoExecLog FILE unzip "${file}" ${components}
+ CT_Popd
+ ;;
+ *)
+ CT_Abort "Don't know how to handle ${file}: unknown extension"
+ ;;
+ esac
+}
+
+# Closure for unpacking/patching the sources. There are two source directories:
+# - CT_COMMON_SRC_DIR stores common sources, such as released tarballs (including
+# bundled or local patches, if necessary) or checked out working copies.
+# Custom sources cannot be placed here, as they may have similarly named
+# packages coming from different origins.
+# - CT_SRC_DIR stores per-configuration sources. These are either symlinks back
+# to CT_ORIG_SRC_DIR sources, or a copy from the custom source, or a copy
+# from CT_ORIG_SRC_DIR + target-specific overrides.
+CT_DoExtractPatch()
+{
+ local patchfunc="${1}"
+ local archive ext
+ local -a patch_dirs
+ local bundled_patch_dir
+ local local_patch_dir
+
+ if [ "${src_custom}" != "y" ]; then
+ # Non-custom: extract to shared location
+ # If the previous extraction/patching was aborted, clean up.
+ if [ -r "${CT_COMMON_SRC_DIR}/.${basename}.extracting" -o \
+ -r "${CT_COMMON_SRC_DIR}/.${basename}.patching" ]; then
+ CT_DoLog WARN "Sources for ${basename} were partially extracted/patched, cleaning up"
+ CT_DoExecLog ALL rm -rf "${CT_COMMON_SRC_DIR}/${basename}"
+ CT_DoExecLog ALL rm -f "${CT_COMMON_SRC_DIR}/.${basename}".*
+ fi
+
+ if [ -f "${CT_COMMON_SRC_DIR}/.${basename}.extracted" ]; then
+ CT_DoLog DEBUG "Already extracted ${basename}"
+ else
+ CT_DoLog EXTRA "Extracting ${basename}"
+ CT_DoExecLog ALL touch "${CT_COMMON_SRC_DIR}/.${basename}.extracting"
+ if [ "${src_release}" = "y" ]; then
+ archive="${archive_filename}"
+ else
+ archive="${basename}"
+ fi
+ # TBD save/discover the extension while fetching
+ ext=`CT_GetFileExtension "${CT_TARBALLS_DIR}/${archive}"`
+ if [ "${archive_dirname}" = "." ]; then
+ CT_mkdir_pushd "${CT_COMMON_SRC_DIR}/${basename}"
+ CT_Extract "${CT_TARBALLS_DIR}/${archive}${ext}" "${CT_COMMON_SRC_DIR}/${basename}"
+ CT_Popd
+ else
+ CT_Extract "${CT_TARBALLS_DIR}/${archive}${ext}" "${CT_COMMON_SRC_DIR}"
+ fi
+ CT_DoExecLog ALL touch "${CT_COMMON_SRC_DIR}/.${basename}.extracted"
+ CT_DoExecLog ALL rm -f "${CT_COMMON_SRC_DIR}/.${basename}.extracting"
+ fi
+
+ if [ -f "${CT_COMMON_SRC_DIR}/.${basename}.patched" ]; then
+ CT_DoLog DEBUG "Already patched ${basename}"
+ else
+ CT_DoLog EXTRA "Patching ${basename}"
+ CT_DoExecLog ALL touch "${CT_COMMON_SRC_DIR}/.${basename}.patching"
+
+ bundled_patch_dir="${CT_LIB_DIR}/packages/${pkg_name}/${version}"
+ local_patch_dir="${CT_LOCAL_PATCH_DIR}/${pkg_name}/${version}"
+
+ case "${CT_PATCH_ORDER}" in
+ bundled) patch_dirs=("${bundled_patch_dir}");;
+ local) patch_dirs=("${local_patch_dir}");;
+ bundled,local) patch_dirs=("${bundled_patch_dir}" "${local_patch_dir}");;
+ local,bundled) patch_dirs=("${local_patch_dir}" "${bundled_patch_dir}");;
+ none) patch_dirs=;;
+ esac
+
+ CT_Pushd "${CT_COMMON_SRC_DIR}/${basename}"
+ for d in "${patch_dirs[@]}"; do
+ CT_DoLog DEBUG "Looking for patches in '${d}'..."
+ if [ -n "${d}" -a -d "${d}" ]; then
+ for p in "${d}"/*.patch; do
+ if [ -f "${p}" ]; then
+ CT_DoExecLog ALL ${patch} --no-backup-if-mismatch -g0 -F1 -p1 -f -i "${p}"
+ fi
+ done
+ fi
+ done
+
+ # TBD create meta-package for config.sub/config.guess with replacement script
+ if [ "${CT_OVERRIDE_CONFIG_GUESS_SUB}" = "y" ]; then
+ CT_DoLog ALL "Overiding config.guess and config.sub"
+ for cfg in config.guess config.sub; do
+ # Can't use CT_DoExecLog because of the '{} \;' to be passed un-mangled to find
+ find . -type f -name "${cfg}" \
+ -exec chmod -v u+w {} \; \
+ -exec cp -v "${CT_TOP_DIR}/scripts/${cfg}" {} \; |CT_DoLog ALL
+ done
+ fi
+
+ # FIXME: This currently means we end up using host's autotools,
+ # but changing this requires reworking the order of operations in crosstool-NG:
+ # we'd need to defer the download/extraction/patching of a package until after
+ # the companion tools are built.
+ if [ -n "${devel_bootstrap}" ]; then
+ CT_DoExecLog ALL "${CT_CONFIG_SHELL}" -c "${devel_bootstrap}"
+ fi
+
+ if [ -n "${patchfunc}" ]; then
+ ${patchfunc}
+ fi
+
+ CT_Popd
+
+ CT_DoExecLog ALL touch "${CT_COMMON_SRC_DIR}/.${basename}.patched"
+ CT_DoExecLog ALL rm -f "${CT_COMMON_SRC_DIR}/.${basename}.patching"
+ fi
+ else
+ CT_DoLog WARN "${pkg_name}: using custom location, no patches applied"
+ fi
+
+ # Symlink/copy/overlay into per-target source directory
+ if [ "${src_custom}" = "y" ]; then
+ # Custom sources: unpack or copy into per-target directory
+ if [ "${CT_TARGET_USE_OVERLAY}" ]; then
+ CT_DoLog WARN "${pkg_name}: using custom location, no overlays applied"
+ fi
+ if [ -d "${custom_location}" ]; then
+ CT_DoExecLog ALL cp -av "${custom_location}" "${CT_SRC_DIR}/${dir_name}"
+ elif [ -f "${custom_location}" ]; then
+ # Assume "foo.tar.gz" (or likes) contain the "foo" directory
+ local bn
+
+ CT_Extract "${custom_location}" "${CT_SRC_DIR}"
+ bn=`CT_GetFileBasename "${custom_location##*/}"`
+ CT_TestOrAbort "Unknown file extension: ${custom_location}" -n "${bn}"
+ CT_DoExecLog ALL mv -v "${CT_SRC_DIR}/${bn%${ext}}" "${CT_SRC_DIR}/${dir_name}"
+ else
+ CT_Abort "Neither file nor directory: ${custom_location}"
+ fi
+ elif [ "${CT_TARGET_USE_OVERLAY}" = "y" ]; then
+ # Possibly has overlays; check and if it has, copy from common source and apply
+ # overlays.
+ local overlay
+
+ if [ ! -d "${CT_BUILD_DIR}/overlay" ]; then
+ CT_DoLog ALL mkdir -p "${CT_BUILD_DIR}/overlay"
+ overlay="${CT_OVERLAY_LOCATION}/${CT_ARCH}_${CT_OVERLAY_NAME:-overlay}"
+ ext=`CT_GetFileExtension "${overlay}"`
+ if [ ! -r "${overlay}${ext}" ]; then
+ CT_Abort "Overlay ${overlay} not found"
+ fi
+ CT_Extract "${overlay}${ext}" "${CT_BUILD_DIR}/overlay"
+ fi
+
+ if [ -d "${CT_BUILD_DIR}/overlay/${dir_name}" ]; then
+ CT_DoExecLog ALL cp -a "${CT_COMMON_SRC_DIR}/${basename}" "${CT_SRC_DIR}/${dir_name}"
+ tar cf - -C "${CT_BUILD_DIR}/overlay" "${dir_name}" | \
+ CT_DoExecLog FILE tar xvf - -C "${CT_SRC_DIR}"
+ else
+ # No overlay for this component, just symlink
+ CT_DoExecLog ALL ln -s "${CT_COMMON_SRC_DIR}/${basename}" "${CT_SRC_DIR}/${dir_name}"
+ fi
+ else
+ # Common source, just symlink
+ CT_DoExecLog ALL ln -s "${CT_COMMON_SRC_DIR}/${basename}" "${CT_SRC_DIR}/${dir_name}"
+ fi
+}
+
+# Extract/copy the sources to the shared source directory, then either symlink
+# or copy the sources into a private source directory and apply target-specific
+# changes (such as xtensa overrides).
+CT_ExtractPatch()
+{
+ local pkg="${1}"
+
+ shift
+ CT_PackageRun "${pkg}" CT_DoExtractPatch "$@"
+}
diff --git a/scripts/saveSample.sh.in b/scripts/saveSample.sh.in
index d9d999c..2c666db 100644
--- a/scripts/saveSample.sh.in
+++ b/scripts/saveSample.sh.in
@@ -72,8 +72,8 @@ fi
# Save the uClibc .config file
if [ -n "${CT_LIBC_UCLIBC_CONFIG_FILE}" ]; then
# We save the file, and then point the saved sample to this file
- CT_DoAddFileToSample "${CT_LIBC_UCLIBC_CONFIG_FILE}" "${samp_dir}/${CT_LIBC}-${CT_LIBC_VERSION}.config"
- "${sed}" -r -i -e 's|^(CT_LIBC_UCLIBC_CONFIG_FILE)=.+$|\1="'"${samp_top_dir}"'/samples/${CT_TARGET}/${CT_LIBC}-${CT_LIBC_VERSION}.config"|;' \
+ CT_DoAddFileToSample "${CT_LIBC_UCLIBC_CONFIG_FILE}" "${samp_dir}/${CT_LIBC}-${CT_UCLIBC_NG_VERSION}.config"
+ "${sed}" -r -i -e 's|^(CT_LIBC_UCLIBC_CONFIG_FILE)=.+$|\1="'"${samp_top_dir}"'/samples/${CT_TARGET}/${CT_LIBC}-${CT_UCLIBC_NG_VERSION}.config"|;' \
.defconfig
else
# remove any dangling files
diff --git a/scripts/showSamples.sh b/scripts/showSamples.sh
index 1e5d50b..726ea2e 100644
--- a/scripts/showSamples.sh
+++ b/scripts/showSamples.sh
@@ -11,6 +11,9 @@
# GREP_OPTIONS screws things up.
export GREP_OPTIONS=
+# Dummy version which is invoked from .config
+CT_Mirrors() { :; }
+
# Dump a single sample
# Note: we use the specific .config.sample config file
dump_single_sample() {
@@ -23,13 +26,26 @@ dump_single_sample() {
. $(pwd)/.config.sample
# libc needs some love
+ # TBD after conversion of gen-kconfig to template, use CT_LIBC_USE as a selector for other variables
+ # (i.e. whether to use CT_GLIBC_VERSION or CT_MUSL_VERSION)
local libc_name="${CT_LIBC}"
- local libc_ver="${CT_LIBC_VERSION}"
- if [ "${CT_LIBC}" = "uClibc" -a "${CT_LIBC_UCLIBC_NG}" = "y" ]; then
- libc_name="uClibc-ng"
- elif [ "${CT_LIBC}" = "mingw" ]; then
- libc_ver="${CT_WINAPI_VERSION}"
- fi
+ local libc_ver ksym
+
+ ksym=${libc_name//[^0-9A-Za-z_]/_}
+ ksym=${ksym^^}
+ case ${ksym} in
+ GLIBC|NEWLIB)
+ if eval "[ \"\${CT_${ksym}_USE_LINARO}\" = y ]"; then
+ ksym="${ksym}_LINARO"
+ fi
+ ;;
+ UCLIBC)
+ if [ "${UCLIBC_NG_USE_UCLIBC_NG_ORG}" = y ]; then
+ ksym="${ksym}_NG"
+ fi
+ ;;
+ esac
+ eval "libc_ver=\"\${CT_${ksym}_VERSION}\""
case "${sample}" in
current)
@@ -63,7 +79,8 @@ dump_single_sample() {
printf " %-*s : %s\n" ${width} "Host" "${CT_HOST}"
;;
esac
- printf " %-*s : %s\n" ${width} "OS" "${CT_KERNEL}${CT_KERNEL_VERSION:+-}${CT_KERNEL_VERSION}"
+ # TBD currently only Linux is used. General handling for single-select (compiler/binutils/libc/os) and multi-select (debug/companions) components?
+ printf " %-*s : %s\n" ${width} "OS" "${CT_KERNEL}${CT_LINUX_VERSION:+-}${CT_LINUX_VERSION}"
if [ -n "${CT_GMP}" \
-o -n "${CT_MPFR}" \
-o -n "${CT_ISL}" \
@@ -139,7 +156,7 @@ dump_single_sample() {
if [ "${CT_KERNEL_LINUX_HEADERS_USE_CUSTOM_DIR}" = "y" ]; then
printf " //custom// "
else
- printf " ${CT_KERNEL_VERSION} "
+ printf " ${CT_LINUX_VERSION} "
fi
fi
printf "| ${CT_BINUTILS_VERSION} "
diff --git a/scripts/upgrade.sed b/scripts/upgrade.sed
new file mode 100644
index 0000000..995b804
--- /dev/null
+++ b/scripts/upgrade.sed
@@ -0,0 +1,25 @@
+# After 1.23.0, generated config options were standardized to upper case
+s/\<CT_ARCH_(alpha|arm|avr|m68k|microblaze|mips|msp430|nios2|powerpc|s390|sh|sparc|x86|xtensa)\>/CT_ARCH_\U\1/g
+s/\<CT_BINUTILS_binutils\>/CT_BINUTILS_BINUTILS/g
+s/\<CT_CC_gcc\>/CT_CC_GCC/g
+s/\<CT_COMP_TOOLS_(autoconf|automake|libtool|m4|make)\>/CT_COMP_TOOLS_\U\1/g
+s/\<CT_DEBUG_(duma|gdb|ltrace|strace)\>/CT_DEBUG_\U\1/g
+s/\<CT_KERNEL_(bare_metal|linux|windows)\>/CT_KERNEL_\U\1/g
+s/\<CT_LIBC_(avr_libc|bionic|glibc|mingw|musl|newlib|none|uClibc)\>/CT_LIBC_\U\1/g
+
+# Also after 1.23.0, package versions were brought to the same format
+s/\<CT_LIBC_BIONIC_V_([0-9a-z]+)\>/CT_ANDROID_NDK_V_R\U\1/g
+s/\<CT_ANDROID_NDK_V_R15BETA1\>/CT_ANDROID_NDK_V_R15B/g
+s/\<CT_LIBC_AVR_LIBC_V_/CT_AVR_LIBC_V_/g
+s/\<CT_CC_GCC_V_/CT_GCC_V_/g
+s/\<CT_LIBC_GLIBC_V_/CT_GLIBC_V_/g
+s/\<CT_KERNEL_V_/CT_LINUX_V_/g
+s/\<CT_WINAPI_V_/CT_MINGW_W64_V_V/g
+s/\<CT_LIBC_MUSL_V_/CT_MUSL_V_/g
+s/\<CT_LIBC_NEWLIB_V_/CT_NEWLIB_V_/g
+s/\<CT_LIBC_UCLIBC_NG_V_/CT_UCLIBC_NG_V_/g
+
+# Special cases that need manual intervention (require setting of supporting options)
+s/\<CT_LIBC_UCLIBC_V_.*/# [&] not handled by upgrade script, use menuconfig./w/dev/stderr
+s/\<CT_[A-Za-z0-9_]*_SHOW_LINARO.*/# [&] not handled by upgrade script, use menuconfig./w/dev/stderr
+s/\<CT_[A-Za-z0-9_]*_CUSTOM_LOCATION.*/# [&] not handled by upgrade script, use menuconfig./w/dev/stderr