summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/build/arch/arc.sh34
-rw-r--r--scripts/build/arch/arm.sh1
-rw-r--r--scripts/build/arch/powerpc.sh8
-rw-r--r--scripts/build/binutils/binutils.sh9
-rw-r--r--scripts/build/cc/gcc.sh18
-rw-r--r--scripts/build/companion_libs/200-libelf.sh2
-rw-r--r--scripts/build/companion_libs/210-expat.sh2
-rw-r--r--scripts/build/companion_libs/220-ncurses.sh2
-rw-r--r--scripts/build/debug/200-duma.sh4
-rw-r--r--scripts/build/debug/300-gdb.sh39
-rw-r--r--scripts/build/debug/400-ltrace.sh2
-rw-r--r--scripts/build/debug/500-strace.sh7
-rw-r--r--scripts/build/libc/bionic.sh6
-rw-r--r--scripts/build/libc/glibc.sh8
-rw-r--r--scripts/build/libc/mingw-w64.sh18
-rw-r--r--scripts/build/libc/newlib.sh12
-rw-r--r--scripts/crosstool-NG.sh40
-rw-r--r--scripts/functions160
-rw-r--r--scripts/override/__default3
19 files changed, 275 insertions, 100 deletions
diff --git a/scripts/build/arch/arc.sh b/scripts/build/arch/arc.sh
new file mode 100644
index 0000000..2b48e4b
--- /dev/null
+++ b/scripts/build/arch/arc.sh
@@ -0,0 +1,34 @@
+# Compute ARC-specific values
+
+CT_DoArchTupleValues() {
+ # The architecture part of the tuple:
+ CT_TARGET_ARCH="${CT_ARCH}${CT_ARCH_SUFFIX:-${target_endian_eb}}"
+
+ # The system part of the tuple:
+ case "${CT_LIBC}" in
+ glibc) CT_TARGET_SYS=gnu;;
+ uClibc) CT_TARGET_SYS=uclibc;;
+ esac
+}
+
+CT_DoArchUClibcConfig() {
+ local cfg="${1}"
+
+ CT_DoArchUClibcSelectArch "${cfg}" "arc"
+}
+
+CT_DoArchUClibcCflags() {
+ local cfg="${1}"
+ local cflags="${2}"
+ local f
+
+ CT_KconfigDisableOption "CONFIG_ARC_HAS_ATOMICS" "${cfg}"
+
+ for f in ${cflags}; do
+ case "${f}" in
+ -matomic)
+ CT_KconfigEnableOption "CONFIG_ARC_HAS_ATOMICS" "${cfg}"
+ ;;
+ esac
+ done
+}
diff --git a/scripts/build/arch/arm.sh b/scripts/build/arch/arm.sh
index 7433c92..4873df1 100644
--- a/scripts/build/arch/arm.sh
+++ b/scripts/build/arch/arm.sh
@@ -96,6 +96,7 @@ CT_DoArchUClibcCflags() {
case "${f}" in
-mthumb)
CT_KconfigEnableOption "COMPILE_IN_THUMB_MODE" "${cfg}"
+ CT_KconfigDisableOption "UCLIBC_HAS_CONTEXT_FUNCS" "${cfg}"
;;
-marm)
CT_KconfigDisableOption "COMPILE_IN_THUMB_MODE" "${cfg}"
diff --git a/scripts/build/arch/powerpc.sh b/scripts/build/arch/powerpc.sh
index 52f3f8b..36a727a 100644
--- a/scripts/build/arch/powerpc.sh
+++ b/scripts/build/arch/powerpc.sh
@@ -12,18 +12,18 @@ CT_DoArchTupleValues () {
;;
spe)
case "${CT_LIBC}" in
- none|newlib) CT_TARGET_SYS="spe";;
+ none|newlib) CT_TARGET_SYS="elfspe";;
*glibc) CT_TARGET_SYS="gnuspe";;
uClibc) CT_TARGET_SYS="uclibcgnuspe";;
esac
;;
esac
- # Add extra flags for SPE if needed
+ # Add extra flags for SPE if needed. SPE is obsolete in GCC8.
if [ "${CT_ARCH_powerpc_ABI_SPE}" = "y" ]; then
CT_ARCH_TARGET_CFLAGS="-mabi=spe -mspe"
- CT_ARCH_CC_CORE_EXTRA_CONFIG="--enable-e500_double"
- CT_ARCH_CC_EXTRA_CONFIG="--enable-e500_double"
+ CT_ARCH_CC_CORE_EXTRA_CONFIG="--enable-e500_double --enable-obsolete"
+ CT_ARCH_CC_EXTRA_CONFIG="--enable-e500_double --enable-obsolete"
fi
}
diff --git a/scripts/build/binutils/binutils.sh b/scripts/build/binutils/binutils.sh
index 703a6fa..f61b556 100644
--- a/scripts/build/binutils/binutils.sh
+++ b/scripts/build/binutils/binutils.sh
@@ -223,13 +223,14 @@ do_binutils_backend() {
sed -r -e "s/@@DEFAULT_LD@@/${CT_BINUTILS_LINKER_DEFAULT}/" \
"${CT_LIB_DIR}/scripts/build/binutils/binutils-ld.in" \
>"${prefix}/bin/${CT_TARGET}-ld"
- chmod +x "${prefix}/bin/${CT_TARGET}-ld"
+ chmod a+x "${prefix}/bin/${CT_TARGET}-ld"
cp -a "${prefix}/bin/${CT_TARGET}-ld" \
"${prefix}/${CT_TARGET}/bin/ld"
- # If needed, force using ld.bfd during the toolchain build
- if [ "${CT_BINUTILS_FORCE_LD_BFD}" = "y" ]; then
- export CTNG_LD_IS=bfd
+ # If needed, force using ld.bfd during the toolchain build.
+ # Note that
+ if [ "${CT_BINUTILS_FORCE_LD_BFD_DEFAULT}" = "y" ]; then
+ CT_EnvModify export CTNG_LD_IS bfd
fi
fi
}
diff --git a/scripts/build/cc/gcc.sh b/scripts/build/cc/gcc.sh
index c95c5b9..7aceee3 100644
--- a/scripts/build/cc/gcc.sh
+++ b/scripts/build/cc/gcc.sh
@@ -171,13 +171,13 @@ cc_gcc_multilib_housekeeping() {
fi
done
CT_DoLog DEBUG "Filtered target CFLAGS: '${new_cflags}'"
- CT_EnvModify CT_TARGET_CFLAGS "${new_cflags} ${CT_TARGET_CFLAGS}"
+ CT_EnvModify CT_ALL_TARGET_CFLAGS "${new_cflags} ${CT_TARGET_CFLAGS}"
CT_EnvModify CT_ARCH_TARGET_CFLAGS_MULTILIB ""
# Currently, the only LDFLAGS are endianness-related
CT_DoLog DEBUG "Configured target LDFLAGS: '${CT_ARCH_TARGET_LDFLAGS_MULTILIB}'"
if [ "${ml_endian}" != "seen" ]; then
- CT_EnvModify CT_TARGET_LDFLAGS "${CT_ARCH_TARGET_LDFLAGS_MULTILIB} ${CT_TARGET_LDFLAGS}"
+ CT_EnvModify CT_ALL_TARGET_LDFLAGS "${CT_ARCH_TARGET_LDFLAGS_MULTILIB} ${CT_TARGET_LDFLAGS}"
CT_EnvModify CT_ARCH_TARGET_LDFLAGS_MULTILIB ""
fi
CT_DoLog DEBUG "Filtered target LDFLAGS: '${CT_ARCH_TARGET_LDFLAGS_MULTILIB}'"
@@ -467,7 +467,11 @@ do_gcc_core_backend() {
local glibc_version
CT_GetPkgVersion GLIBC glibc_version
- glibc_version=`echo "${glibc_version}" | sed 's/\([1-9][0-9]*\.[1-9][0-9]*\).*/\1/'`
+ case "${glibc_version}" in
+ new) glibc_version=99.99;;
+ old) glibc_version=1.0;;
+ *) glibc_version=`echo "${glibc_version}" | sed 's/\([1-9][0-9]*\.[1-9][0-9]*\).*/\1/'`;;
+ esac
extra_config+=("--with-glibc-version=${glibc_version}")
fi
@@ -560,7 +564,11 @@ do_gcc_core_backend() {
fi
fi
- # Use --with-local-prefix so older gccs don't look in /usr/local (http://gcc.gnu.org/PR10532)
+ # Use --with-local-prefix so older gccs don't look in /usr/local (http://gcc.gnu.org/PR10532).
+ # Pass only user-specified CFLAGS/LDFLAGS in CFLAGS_FOR_TARGET/LDFLAGS_FOR_TARGET: during
+ # the build of, for example, libatomic, GCC tried to compile multiple variants for runtime
+ # selection and passing architecture/CPU selectors, as detemined by crosstool-NG, may
+ # miscompile or outright fail.
CT_DoExecLog CFG \
CC_FOR_BUILD="${CT_BUILD}-gcc" \
CFLAGS="${cflags}" \
@@ -1109,6 +1117,8 @@ do_gcc_backend() {
fi
fi
+ # NB: not using CT_ALL_TARGET_CFLAGS/CT_ALL_TARGET_LDFLAGS here!
+ # See do_gcc_core_backend for explanation.
CT_DoExecLog CFG \
CC_FOR_BUILD="${CT_BUILD}-gcc" \
CFLAGS="${cflags}" \
diff --git a/scripts/build/companion_libs/200-libelf.sh b/scripts/build/companion_libs/200-libelf.sh
index 5f1a8d7..f0d8be4 100644
--- a/scripts/build/companion_libs/200-libelf.sh
+++ b/scripts/build/companion_libs/200-libelf.sh
@@ -81,7 +81,7 @@ do_libelf_for_target() {
libelf_opts+=( "destdir=${CT_SYSROOT_DIR}" )
libelf_opts+=( "host=${CT_TARGET}" )
- libelf_opts+=( "cflags=${CT_TARGET_CFLAGS}" )
+ libelf_opts+=( "cflags=${CT_ALL_TARGET_CFLAGS}" )
libelf_opts+=( "prefix=${prefix}" )
libelf_opts+=( "shared=${CT_SHARED_LIBS}" )
do_libelf_backend "${libelf_opts[@]}"
diff --git a/scripts/build/companion_libs/210-expat.sh b/scripts/build/companion_libs/210-expat.sh
index f848541..75a78bf 100644
--- a/scripts/build/companion_libs/210-expat.sh
+++ b/scripts/build/companion_libs/210-expat.sh
@@ -54,7 +54,7 @@ do_expat_for_target() {
prefix="/usr"
;;
esac
- expat_opts+=( "cflags=${CT_TARGET_CFLAGS}" )
+ expat_opts+=( "cflags=${CT_ALL_TARGET_CFLAGS}" )
expat_opts+=( "prefix=${prefix}" )
expat_opts+=( "destdir=${CT_SYSROOT_DIR}" )
expat_opts+=( "shared=${CT_SHARED_LIBS}" )
diff --git a/scripts/build/companion_libs/220-ncurses.sh b/scripts/build/companion_libs/220-ncurses.sh
index 97fb834..b5dee13 100644
--- a/scripts/build/companion_libs/220-ncurses.sh
+++ b/scripts/build/companion_libs/220-ncurses.sh
@@ -97,7 +97,7 @@ do_ncurses_for_target() {
prefix="${prefix}" \
destdir="${CT_SYSROOT_DIR}" \
shared="${CT_SHARED_LIBS}" \
- cflags="${CT_TARGET_CFLAGS}" \
+ cflags="${CT_ALL_TARGET_CFLAGS}" \
"${opts[@]}"
CT_Popd
CT_EndStep
diff --git a/scripts/build/debug/200-duma.sh b/scripts/build/debug/200-duma.sh
index 0d98c38..9e2379e 100644
--- a/scripts/build/debug/200-duma.sh
+++ b/scripts/build/debug/200-duma.sh
@@ -19,8 +19,8 @@ do_debug_duma_build() {
make_args=(
prefix="${CT_DEBUGROOT_DIR}/usr"
HOSTCC="${CT_BUILD}-gcc"
- CC="${CT_TARGET}-${CT_CC} ${CT_TARGET_CFLAGS}"
- CXX="${CT_TARGET}-g++ ${CT_TARGET_CFLAGS}"
+ CC="${CT_TARGET}-${CT_CC} ${CT_ALL_TARGET_CFLAGS}"
+ CXX="${CT_TARGET}-g++ ${CT_ALL_TARGET_CFLAGS}"
RANLIB="${CT_TARGET}-ranlib"
OS="${CT_KERNEL}"
)
diff --git a/scripts/build/debug/300-gdb.sh b/scripts/build/debug/300-gdb.sh
index 74744cc..c73e430 100644
--- a/scripts/build/debug/300-gdb.sh
+++ b/scripts/build/debug/300-gdb.sh
@@ -22,7 +22,7 @@ do_debug_gdb_build() {
local CT_HOST_LD="${CT_HOST}-ld"
local CT_CXXFLAGS_FOR_HOST=${CT_CFLAGS_FOR_HOST}
- local CT_TARGET_CXXFLAGS=${CT_TARGET_CFLAGS}
+ local CT_TARGET_CXXFLAGS=${CT_ALL_TARGET_CFLAGS}
gdb_src_dir="${CT_SRC_DIR}/gdb"
@@ -34,7 +34,7 @@ do_debug_gdb_build() {
if [ "${CT_GDB_CROSS}" = "y" ]; then
local -a cross_extra_config
local gcc_version p _p
- local cross_CPPFLAGS cross_CFLAGS cross_CXXFLAGS cross_LDFLAGS
+ local cross_CFLAGS cross_CXXFLAGS cross_LDFLAGS
CT_DoStep INFO "Installing cross-gdb"
CT_DoLog EXTRA "Configuring cross-gdb"
@@ -44,6 +44,10 @@ do_debug_gdb_build() {
cross_extra_config=("${extra_config[@]}")
+ if [ "${CT_GDB_HAS_DISABLE_CXX_BUILD}" = "y" ]; then
+ cross_extra_config+=("--disable-build-with-cxx")
+ fi
+
# For gdb-cross this combination of flags forces
# gdb configure to fall back to default '-lexpat' flag
# which is acceptable.
@@ -90,7 +94,6 @@ do_debug_gdb_build() {
cross_extra_config+=("--disable-nls")
fi
- cross_CPPFLAGS="${CT_CPPFLAGS_FOR_HOST}"
cross_CFLAGS="${CT_CFLAGS_FOR_HOST}"
cross_CXXFLAGS="${CT_CXXFLAGS_FOR_HOST}"
cross_LDFLAGS="${CT_LDFLAGS_FOR_HOST}"
@@ -118,7 +121,6 @@ do_debug_gdb_build() {
# are multiple consecutive spaces: sub-configure scripts replace them with a
# single space and then complain that $CC value changed from that in
# the master directory.
- cross_CPPFLAGS=`echo ${cross_CPPFLAGS}`
cross_CFLAGS=`echo ${cross_CFLAGS}`
cross_CXXFLAGS=`echo ${cross_CXXFLAGS}`
cross_LDFLAGS=`echo ${cross_LDFLAGS}`
@@ -135,7 +137,6 @@ do_debug_gdb_build() {
CC="${CT_HOST_CC}" \
CXX="${CT_HOST_CXX}" \
LD="${CT_HOST_LD}" \
- CPPFLAGS="${cross_CPPFLAGS}" \
CFLAGS="${cross_CFLAGS}" \
CXXFLAGS="${cross_CXXFLAGS}" \
LDFLAGS="${cross_LDFLAGS}" \
@@ -187,7 +188,7 @@ do_debug_gdb_build() {
# TBD combine GDB native and gdbserver backends, build either or both in a single pass.
if [ "${CT_GDB_NATIVE}" = "y" ]; then
local -a native_extra_config
- local native_CPPFLAGS native_CFLAGS native_CXXFLAGS native_LDFLAGS
+ local native_CFLAGS native_CXXFLAGS native_LDFLAGS
CT_DoStep INFO "Installing native gdb"
CT_DoLog EXTRA "Configuring native gdb"
@@ -198,7 +199,7 @@ do_debug_gdb_build() {
native_extra_config=("${extra_config[@]}")
# We may not have C++ language configured for target
- if [ "${GDB_TARGET_DISABLE_CXX_BUILD}" = "y" ]; then
+ if [ "${CT_GDB_HAS_DISABLE_CXX_BUILD}" = "y" ]; then
native_extra_config+=("--disable-build-with-cxx")
fi
@@ -239,10 +240,9 @@ do_debug_gdb_build() {
native_extra_config+=("--disable-nls")
fi
- native_CPPFLAGS="${CT_TARGET_CPPFLAGS}"
- native_CFLAGS="${CT_TARGET_CFLAGS}"
- native_CXXFLAGS="${CT_TARGET_CXXFLAGS}"
- native_LDFLAGS="${CT_TARGET_LDFLAGS}"
+ native_CFLAGS="${CT_ALL_TARGET_CFLAGS}"
+ native_CXXFLAGS="${CT_ALL_TARGET_CFLAGS}"
+ native_LDFLAGS="${CT_ALL_TARGET_LDFLAGS}"
if [ "${CT_GDB_NATIVE_STATIC}" = "y" ]; then
native_CFLAGS+=" -static"
@@ -257,7 +257,6 @@ do_debug_gdb_build() {
native_extra_config+=("--disable-ld")
native_extra_config+=("--disable-gas")
- native_CPPFLAGS=`echo ${native_CPPFLAGS}`
native_CFLAGS=`echo ${native_CFLAGS}`
native_CXXFLAGS=`echo ${native_CXXFLAGS}`
native_LDFLAGS=`echo ${native_LDFLAGS}`
@@ -269,7 +268,6 @@ do_debug_gdb_build() {
CC="${CT_TARGET_CC}" \
CXX="${CT_TARGET_CXX}" \
LD="${CT_TARGET_LD}" \
- CPPFLAGS="${native_CPPFLAGS}" \
CFLAGS="${native_CFLAGS}" \
CXXFLAGS="${native_CXXFLAGS}" \
LDFLAGS="${native_LDFLAGS}" \
@@ -306,7 +304,7 @@ do_debug_gdb_build() {
if [ "${CT_GDB_GDBSERVER}" = "y" ]; then
local -a gdbserver_extra_config
- local gdbserver_CPPFLAGS gdbserver_CFLAGS gdbserver_CXXFLAGS gdbserver_LDFLAGS
+ local gdbserver_CFLAGS gdbserver_CXXFLAGS gdbserver_LDFLAGS
CT_DoStep INFO "Installing gdbserver"
CT_DoLog EXTRA "Configuring gdbserver"
@@ -317,12 +315,12 @@ do_debug_gdb_build() {
# Workaround for bad versions, where the configure
# script for gdbserver is not executable...
# Bah, GNU folks strike again... :-(
- chmod +x "${gdb_src_dir}/gdb/gdbserver/configure"
+ chmod a+x "${gdb_src_dir}/gdb/gdbserver/configure"
gdbserver_extra_config=("${extra_config[@]}")
# We may not have C++ language configured for target
- if [ "${GDB_TARGET_DISABLE_CXX_BUILD}" = "y" ]; then
+ if [ "${CT_GDB_HAS_DISABLE_CXX_BUILD}" = "y" ]; then
gdbserver_extra_config+=("--disable-build-with-cxx")
fi
@@ -339,10 +337,9 @@ do_debug_gdb_build() {
gdbserver_extra_config+=("--disable-ld")
gdbserver_extra_config+=("--disable-gas")
- gdbserver_CPPFLAGS="${CT_TARGET_CPPFLAGS}"
- gdbserver_CFLAGS="${CT_TARGET_CFLAGS}"
- gdbserver_CXXFLAGS="${CT_TARGET_CXXFLAGS}"
- gdbserver_LDFLAGS="${CT_TARGET_LDFLAGS}"
+ gdbserver_CFLAGS="${CT_ALL_TARGET_CFLAGS}"
+ gdbserver_CXXFLAGS="${CT_ALL_TARGET_CFLAGS}"
+ gdbserver_LDFLAGS="${CT_ALL_TARGET_LDFLAGS}"
if [ "${CT_GDB_GDBSERVER_STATIC}" = "y" ]; then
gdbserver_CFLAGS+=" -static"
@@ -354,7 +351,6 @@ do_debug_gdb_build() {
gdbserver_LDFLAGS+=" -static-libstdc++"
fi
- gdbserver_CPPFLAGS=`echo ${gdbserver_CPPFLAGS}`
gdbserver_CFLAGS=`echo ${gdbserver_CFLAGS}`
gdbserver_CXXFLAGS=`echo ${gdbserver_CXXFLAGS}`
gdbserver_LDFLAGS=`echo ${gdbserver_LDFLAGS}`
@@ -366,7 +362,6 @@ do_debug_gdb_build() {
CC="${CT_TARGET_CC}" \
CXX="${CT_TARGET_CXX}" \
LD="${CT_TARGET_LD}" \
- CPPFLAGS="${gdbserver_CPPFLAGS}" \
CFLAGS="${gdbserver_CFLAGS}" \
CXXFLAGS="${gdbserver_CXXFLAGS}" \
LDFLAGS="${gdbserver_LDFLAGS}" \
diff --git a/scripts/build/debug/400-ltrace.sh b/scripts/build/debug/400-ltrace.sh
index ce299c2..3f08226 100644
--- a/scripts/build/debug/400-ltrace.sh
+++ b/scripts/build/debug/400-ltrace.sh
@@ -34,7 +34,7 @@ do_debug_ltrace_build() {
AR="${CT_TARGET}-ar" \
HOST="${ltrace_host}" \
HOST_OS="${CT_TARGET_KERNEL}" \
- CFLAGS="${CT_TARGET_CFLAGS}" \
+ CFLAGS="${CT_ALL_TARGET_CFLAGS}"\
${CONFIG_SHELL} \
./configure --prefix=/usr
else
diff --git a/scripts/build/debug/500-strace.sh b/scripts/build/debug/500-strace.sh
index 305a76c..4f6d6aa 100644
--- a/scripts/build/debug/500-strace.sh
+++ b/scripts/build/debug/500-strace.sh
@@ -12,7 +12,7 @@ do_debug_strace_extract()
do_debug_strace_build()
{
- local cflags="${CT_TARGET_CFLAGS}"
+ local cflags="${CT_ALL_TARGET_CFLAGS}"
CT_DoStep INFO "Installing strace"
@@ -30,14 +30,15 @@ do_debug_strace_build()
CT_DoExecLog CFG \
CC="${CT_TARGET}-${CT_CC}" \
CFLAGS="${cflags}" \
- LDFLAGS="${CT_TARGET_LDFLAGS}" \
+ LDFLAGS="${CT_ALL_TARGET_LDFLAGS}" \
CPP="${CT_TARGET}-cpp" \
LD="${CT_TARGET}-ld" \
${CONFIG_SHELL} \
"${CT_SRC_DIR}/strace/configure" \
--build=${CT_BUILD} \
--host=${CT_TARGET} \
- --prefix=/usr
+ --prefix=/usr \
+ --enable-mpers=check
CT_DoLog EXTRA "Building strace"
CT_DoExecLog ALL make
diff --git a/scripts/build/libc/bionic.sh b/scripts/build/libc/bionic.sh
index 027493d..93dcea0 100644
--- a/scripts/build/libc/bionic.sh
+++ b/scripts/build/libc/bionic.sh
@@ -26,6 +26,12 @@ do_libc() {
fi
CT_DoStep INFO "Installing C library binaries"
CT_DoExecLog ALL cp -r "${CT_SRC_DIR}/android-ndk/platforms/android-${CT_ANDROID_API}/arch-${arch}/usr" "${CT_SYSROOT_DIR}"
+
+ # NB: Modifying CT_TARGET_CFLAGS here, not CT_ALL_TARGET_CFLAGS: the __ANDROID_API__
+ # definition needs to be passed into GCC build, or the resulting libstdc++ gets
+ # miscompiled (attempt to link against it results in unresolved symbols to stdout/...).
+ # And since __ANDROID_API__ is a user config option, placing it with other user-supplied
+ # options isn't completely out of character.
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 3b4b626..125ccf7 100644
--- a/scripts/build/libc/glibc.sh
+++ b/scripts/build/libc/glibc.sh
@@ -23,10 +23,9 @@ do_libc_extract() {
# we do not support concurrent use of the source directory
# and next run, if using different glibc-ports source, will override
# this symlink anyway.
- CT_DoExecLog ALL ln -sf "${CT_GLIBC_PORTS_SRC_DIR}/${CT_GLIBC_PORTS_BASENAME}" \
- "${CT_GLIBC_SRC_DIR}/${CT_GLIBC_BASENAME}/ports"
+ CT_DoExecLog ALL ln -sf "${CT_SRC_DIR}/${CT_GLIBC_PORTS_DIR_NAME}" \
+ "${CT_SRC_DIR}/${CT_GLIBC_DIR_NAME}/ports"
fi
- # TBD make the configure timestamp fix in all patched packages (e.g. part of CT_ExtractPatch)
}
# Build and install headers and start files
@@ -171,6 +170,7 @@ do_libc_backend_once() {
*) extra_config+=("--enable-add-ons=$(do_libc_add_ons_list ,)");;
esac
+ [ "${CT_GLIBC_ENABLE_WERROR}" != "y" ] && extra_config+=("--disable-werror")
[ -n "${CT_PKGVERSION}" ] && extra_config+=("--with-pkgversion=${CT_PKGVERSION}")
[ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}")
@@ -196,7 +196,7 @@ do_libc_backend_once() {
esac
# In the order of increasing precedence. Flags common to compiler and linker.
- glibc_cflags+=" ${CT_TARGET_CFLAGS}"
+ glibc_cflags+=" ${CT_ALL_TARGET_CFLAGS}"
glibc_cflags+=" ${CT_GLIBC_EXTRA_CFLAGS}"
glibc_cflags+=" ${multi_flags}"
diff --git a/scripts/build/libc/mingw-w64.sh b/scripts/build/libc/mingw-w64.sh
index 21afb29..3026b87 100644
--- a/scripts/build/libc/mingw-w64.sh
+++ b/scripts/build/libc/mingw-w64.sh
@@ -161,11 +161,29 @@ do_mingw_pthreads()
CT_DoLog EXTRA "Installing mingw-w64-winpthreads"
CT_DoExecLog ALL make install DESTDIR=${CT_SYSROOT_DIR}
+ # Post-install hackery: all libwinpthread-1.dll end up being installed
+ # into /bin, which is broken on multilib install. Hence, stash it back
+ # into /lib - and after iterating over multilibs, copy the default one
+ # back into /bin.
+ if [ "${multi_index}" != 1 -o "${multi_count}" != 1 ]; then
+ CT_DoExecLog ALL mv "${CT_SYSROOT_DIR}${MINGW_INSTALL_PREFIX}/bin/libwinpthread-1.dll" \
+ "${CT_SYSROOT_DIR}${libprefix}/libwinpthread-1.dll"
+ if [ "${multi_index}" = 1 ]; then
+ default_libprefix="${libprefix}"
+ elif [ "${multi_index}" = "${multi_count}" ]; then
+ CT_DoExecLog ALL cp "${CT_SYSROOT_DIR}${default_libprefix}/libwinpthread-1.dll" \
+ "${CT_SYSROOT_DIR}${MINGW_INSTALL_PREFIX}/bin/libwinpthread-1.dll"
+ fi
+ fi
+
CT_EndStep
}
do_libc()
{
+ # Used when iterating over libwinpthread
+ local default_libprefix
+
do_check_mingw_vendor_tuple
CT_DoStep INFO "Building mingw-w64"
diff --git a/scripts/build/libc/newlib.sh b/scripts/build/libc/newlib.sh
index 5c4a356..6449d68 100644
--- a/scripts/build/libc/newlib.sh
+++ b/scripts/build/libc/newlib.sh
@@ -38,7 +38,7 @@ do_libc() {
# Multilib is the default, so if it is not enabled, disable it.
if [ "${CT_MULTILIB}" != "y" ]; then
- extra_config+=("--disable-multilib")
+ newlib_opts+=("--disable-multilib")
fi
if [ "${CT_LIBC_NEWLIB_IO_FLOAT}" = "y" ]; then
@@ -65,13 +65,13 @@ IO_LL:newlib-io-long-long
NEWLIB_REGISTER_FINI:newlib-register-fini
NANO_MALLOC:newlib-nano-malloc
NANO_FORMATTED_IO:newlib-nano-formatted-io
-ATEXIT_DYNAMIC_ALLOC:atexit-dynamic-alloc
+ATEXIT_DYNAMIC_ALLOC:newlib-atexit-dynamic-alloc
GLOBAL_ATEXIT:newlib-global-atexit
LITE_EXIT:lite-exit
-REENT_SMALL:reent-small
-MULTITHREAD:multithread
+REENT_SMALL:newlib-reent-small
+MULTITHREAD:newlib-multithread
WIDE_ORIENT:newlib-wide-orient
-UNBUF_STREAM_OPT:unbuf-stream-opt
+UNBUF_STREAM_OPT:newlib-unbuf-stream-opt
ENABLE_TARGET_OPTSPACE:target-optspace
"
@@ -94,7 +94,7 @@ ENABLE_TARGET_OPTSPACE:target-optspace
[ "${CT_LIBC_NEWLIB_LTO}" = "y" ] && \
CT_LIBC_NEWLIB_TARGET_CFLAGS="${CT_LIBC_NEWLIB_TARGET_CFLAGS} -flto"
- cflags_for_target="${CT_TARGET_CFLAGS} ${CT_LIBC_NEWLIB_TARGET_CFLAGS}"
+ cflags_for_target="${CT_ALL_TARGET_CFLAGS} ${CT_LIBC_NEWLIB_TARGET_CFLAGS}"
# Note: newlib handles the build/host/target a little bit differently
# than one would expect:
diff --git a/scripts/crosstool-NG.sh b/scripts/crosstool-NG.sh
index d4414b5..ccfe29c 100644
--- a/scripts/crosstool-NG.sh
+++ b/scripts/crosstool-NG.sh
@@ -74,6 +74,7 @@ for d in \
LOCAL_TARBALLS \
WORK \
PREFIX \
+ BUILD_TOP \
INSTALL \
; do
eval dir="\${CT_${d}_DIR}"
@@ -88,6 +89,17 @@ for d in \
CT_Abort "'CT_${d}_DIR'='${dir}' contains a comma in it.\nDon't use commas in paths, it breaks things."
;;
esac
+ case "${dir}" in
+ /*)
+ # Absolute path, okay
+ ;;
+ *)
+ # Relative path from CT_TOP_DIR, make absolute
+ eval CT_${d}_DIR="${CT_TOP_DIR}/${dir}"
+ # Having .. inside CT_PREFIX breaks relocatability.
+ CT_SanitizeVarDir CT_${d}_DIR
+ ;;
+ esac
done
# Where will we work?
@@ -115,11 +127,14 @@ cat "${paths_sh_location}" |while read trash line; do
tool="${line%%=*}"
# Suppress extra quoting
eval path=${line#*=}
- if [ -r "${CT_LIB_DIR}/scripts/override/$tool" ]; then
- tmpl="${CT_LIB_DIR}/scripts/override/$tool"
- else
- tmpl="${CT_LIB_DIR}/scripts/override/__default"
+ if [ ! -r "${CT_LIB_DIR}/scripts/override/$tool" ]; then
+ if [ -n "${path}" ]; then
+ CT_DoExecLog ALL rm -f "${CT_TOOLS_OVERRIDE_DIR}/bin/${tool}"
+ CT_DoExecLog ALL ln -s "${path}" "${CT_TOOLS_OVERRIDE_DIR}/bin/${tool}"
+ fi
+ continue
fi
+ tmpl="${CT_LIB_DIR}/scripts/override/$tool"
CT_DoLog DEBUG "Creating script-override for '${tool}' -> '${path}' using '${tmpl}' template"
CT_DoExecLog ALL cp "${tmpl}" "${CT_TOOLS_OVERRIDE_DIR}/bin/${tool}"
CT_DoExecLog ALL ${sed} -i -r \
@@ -163,8 +178,8 @@ CT_PREFIX_DIR="$( ${sed} -r -e 's:/+:/:g; s:/*$::;' <<<"${CT_PREFIX_DIR}" )"
# Second kludge: merge user-supplied target CFLAGS with architecture-provided
# target CFLAGS. Do the same for LDFLAGS in case it happens in the future.
# Put user-supplied flags at the end, so that they take precedence.
-CT_TARGET_CFLAGS="${CT_ARCH_TARGET_CFLAGS} ${CT_TARGET_CFLAGS}"
-CT_TARGET_LDFLAGS="${CT_ARCH_TARGET_LDFLAGS} ${CT_TARGET_LDFLAGS}"
+CT_ALL_TARGET_CFLAGS="${CT_ARCH_TARGET_CFLAGS} ${CT_TARGET_CFLAGS}"
+CT_ALL_TARGET_LDFLAGS="${CT_ARCH_TARGET_LDFLAGS} ${CT_TARGET_LDFLAGS}"
# FIXME move to gcc.sh
CT_CC_GCC_CORE_EXTRA_CONFIG_ARRAY=( ${CT_ARCH_CC_CORE_EXTRA_CONFIG} "${CT_CC_GCC_CORE_EXTRA_CONFIG_ARRAY[@]}" )
@@ -193,7 +208,7 @@ CT_TARBALLS_DIR="${CT_WORK_DIR}/tarballs"
CT_COMMON_SRC_DIR="${CT_WORK_DIR}/src"
CT_SRC_DIR="${CT_BUILD_TOP_DIR}/src"
CT_BUILDTOOLS_PREFIX_DIR="${CT_BUILD_TOP_DIR}/buildtools"
-CT_STATE_DIR="${CT_WORK_DIR}/${CT_TARGET}/state"
+CT_STATE_DIR="${CT_BUILD_TOP_DIR}/state"
# Note about HOST_COMPLIBS_DIR: it's always gonna be in the buildtools dir, or a
# sub-dir. So we won't have to save/restore it, not even create it.
# In case of cross or native, host-complibs are used for build-complibs;
@@ -301,20 +316,17 @@ CT_DoExecLog ALL mkdir -p "${CT_HOST_COMPLIBS_DIR}"
# Only create the state dir if asked for a restartable build
[ -n "${CT_DEBUG_CT_SAVE_STEPS}" ] && CT_DoExecLog ALL mkdir -p "${CT_STATE_DIR}"
+# Kludge: CT_PREFIX_DIR might have grown read-only if
+# the previous build was successful.
+CT_DoExecLog ALL chmod -R u+w "${CT_PREFIX_DIR}"
+
# Check install file system case-sensitiveness
CT_DoExecLog DEBUG touch "${CT_PREFIX_DIR}/foo"
CT_TestAndAbort "Your file system in '${CT_PREFIX_DIR}' is *not* case-sensitive!" -f "${CT_PREFIX_DIR}/FOO"
CT_DoExecLog DEBUG rm -f "${CT_PREFIX_DIR}/foo"
-# Kludge: CT_PREFIX_DIR might have grown read-only if
-# the previous build was successful.
-CT_DoExecLog ALL chmod -R u+w "${CT_PREFIX_DIR}"
-
# Setting up the rest of the environment only if not restarting
if [ -z "${CT_RESTART}" ]; then
- # Having .. inside CT_PREFIX breaks relocatability.
- CT_SanitizeVarDir CT_PREFIX_DIR
-
case "${CT_SYSROOT_NAME}" in
"") CT_SYSROOT_NAME="sysroot";;
.) CT_Abort "Sysroot name is set to '.' which is forbidden";;
diff --git a/scripts/functions b/scripts/functions
index 0b8fba5..ab235d8 100644
--- a/scripts/functions
+++ b/scripts/functions
@@ -13,7 +13,7 @@ CT_LoadConfig() {
# It also sets KERNEL/ARCH/... for file inclusion below. Does not handle
# recursive definitions yet. We don't need arrays at this point.
CT_TestOrAbort "Configuration file not found. Please create one." -r .config
- . .config
+ . ./.config # Prefixing with ./ prevents Bash from searching $PATH
# Include sub-scripts instead of calling them: that way, we do not have to
# export any variable, nor re-parse the configuration and functions files.
@@ -37,7 +37,7 @@ CT_LoadConfig() {
oldvals=""
try=0
while [ "$try" -le 10 ]; do
- . .config
+ . ./.config # Prefixing with ./ prevents Bash from searching $PATH
vals=`set | ${grep} -E '^CT_'`
if [ "$oldvals" = "$vals" ]; then
break
@@ -287,6 +287,7 @@ CT_DoLog() {
y,*"warning:"*) cur_L=WARN; cur_l=${CT_LOG_LEVEL_WARN};;
y,*"WARNING:"*) cur_L=WARN; cur_l=${CT_LOG_LEVEL_WARN};;
*"error:"*) cur_L=ERROR; cur_l=${CT_LOG_LEVEL_ERROR};;
+ *"Error:"*) cur_L=ERROR; cur_l=${CT_LOG_LEVEL_ERROR};;
*"make["*"]: ***"*) cur_L=ERROR; cur_l=${CT_LOG_LEVEL_ERROR};;
*) cur_L="${LEVEL}"; cur_l="${level}";;
esac
@@ -751,7 +752,9 @@ CT_DoGetFile()
}
# This function saves the specified to local storage if possible,
-# and if so, symlinks it for later usage
+# and if so, symlinks it for later usage. This function is called from
+# the `if' condition (via the CT_GetFile) and therefore must return
+# on error rather than relying on the shell's ERR trap to catch it.
# Usage: CT_SaveLocal </full/path/file.name>
CT_SaveLocal()
{
@@ -761,9 +764,22 @@ CT_SaveLocal()
if [ "${CT_SAVE_TARBALLS}" = "y" ]; then
CT_DoLog EXTRA "Saving '${basename}' to local storage"
# The file may already exist if downloads are forced: remove it first
- CT_DoExecLog ALL rm -f "${CT_LOCAL_TARBALLS_DIR}/${basename}"
- CT_DoExecLog ALL mv -f "${file}" "${CT_LOCAL_TARBALLS_DIR}"
- CT_DoExecLog ALL ln -s "${CT_LOCAL_TARBALLS_DIR}/${basename}" "${file}"
+ if ! CT_DoExecLog ALL rm -f "${CT_LOCAL_TARBALLS_DIR}/${basename}"; then
+ return 1
+ fi
+ if ! CT_DoExecLog ALL mv -f "${file}" "${CT_LOCAL_TARBALLS_DIR}"; then
+ # Move may have failed if the local tarball storage is on a different
+ # filesystem. Fallback to copy+delete.
+ if ! CT_DoExecLog ALL cp -f "${file}" "${CT_LOCAL_TARBALLS_DIR}"; then
+ return 1
+ fi
+ if ! CT_DoExecLog ALL rm -f "${file}"; then
+ return 1
+ fi
+ fi
+ if ! CT_DoExecLog ALL ln -s "${CT_LOCAL_TARBALLS_DIR}/${basename}" "${file}"; then
+ return 1
+ fi
fi
}
@@ -886,7 +902,12 @@ CT_DoVerifySignature()
CT_Popd
# If we get here, verification succeeded.
- CT_SaveLocal "${CT_TARBALLS_DIR}/${sigfile}${ext}"
+ if ! CT_SaveLocal "${CT_TARBALLS_DIR}/${sigfile}${ext}"; then
+ CT_Popd
+ return 1
+ fi
+
+ return 0
}
# Download the file from one of the URLs passed as argument
@@ -971,7 +992,9 @@ CT_GetFile()
CT_DoExecLog ALL rm "${CT_TARBALLS_DIR}/${basename}${ext}"
return 1
fi
- CT_SaveLocal "${CT_TARBALLS_DIR}/${basename}${ext}"
+ if ! CT_SaveLocal "${CT_TARBALLS_DIR}/${basename}${ext}"; then
+ return 1
+ fi
return 0
fi
done
@@ -1003,9 +1026,15 @@ CT_DoConfigSub() {
# Normally, each step is executed in a sub-shell and thus cannot modify the
# environment for the next step(s). When this is needed, it can do so by
# invoking this function.
-# Usage: CT_EnvModify VAR VALUE
+# Usage: CT_EnvModify [export] VAR VALUE
CT_EnvModify() {
- echo "${1}=\"${2}\"" >> "${CT_BUILD_DIR}/env.modify.sh"
+ local e
+ if [ "$1" = "export" ]; then
+ shift
+ e="export "
+ fi
+ eval "${e}${1}=\"${2}\""
+ echo "${e}${1}=\"${2}\"" >> "${CT_BUILD_DIR}/env.modify.sh"
}
# Compute the target tuple from what is provided by the user
@@ -1793,7 +1822,6 @@ CT_GetVersion_hg()
# 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"
@@ -1830,46 +1858,97 @@ CT_GetVersion_git()
CT_Abort "${pkg_name}: cannot specify both branch and changeset for Git"
fi
- devel_branch="${devel_branch:-master}"
+ # Do not modify devel_branch so that we can check if it has been set by user
+ # in CT_Download_git.
+ local branch="${devel_branch:-master}"
+
if [ -z "${devel_revision}" ]; then
- local matches=`git ls-remote --exit-code "${devel_url}" --refs "${devel_branch}" \
+ local matches=`git ls-remote --exit-code "${devel_url}" --refs "${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}"
+ CT_Abort "Failed to find git ref ${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
+ if echo "${matches}" | grep '[[:space:]]\(refs/heads/\)\?'"${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}\$"`
+ best=`echo "${matches}" | grep '[[:space:]]\(refs/heads/\)\?'"${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})"
+ CT_DoLog WARN "Ambiguous ref ${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}"
+ # Similarly, do not modify the devel_revision, we'll need to know if it
+ # has been set by the user in CT_Download_git.
+ unique_id=`echo "${best}" | cut -c1-8`
+ CT_DoLog DEBUG "ref ${branch} at ${devel_url} has cset of ${unique_id}"
+ else
+ unique_id=`echo "${devel_revision}" | cut -c1-8`
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}" --
+ local new_unique_id fetched=n shallow_id
+
+ # Some of these operations are part of a `git clone`, but fetching a specific commit
+ # (if it is supported by the server) is not expressable as a `git clone`.
+ CT_mkdir_pushd "${pkg_name}"
+ CT_DoExecLog ALL git init
+ CT_DoExecLog ALL git remote add origin "${devel_url}"
+
+ if [ -z "${devel_revision}" ]; then
+ # Configuration didn't care about a specific commit; we'll use the most recent
+ # commit on the branch and will update the unique_id (and warn the user) if it
+ # differs from what we've previously determined.
+ shallow_id="${devel_branch:-master}"
+ else
+ local tmp=`echo "${devel_revision}" | sed 's/^[0-9a-z]\{40\}//'`
+
+ if [ -z "${tmp}" ]; then
+ shallow_id="${devel_revision}"
+ else
+ CT_DoLog WARN "Git only allows full 40-character SHA-1 hashes to identify a commit for shallow clone."
+ fi
+ fi
+
+ if [ -n "${shallow_id}" ]; then
+ if CT_DoExecLog ALL git fetch --quiet --depth 1 origin "${shallow_id}"; then
+ CT_DoExecLog ALL git checkout --quiet FETCH_HEAD --
+ else
+ # Git 2.15 and newer (which must be the case on both the client and the server)
+ # allows fetching a single commit so long as the server is configured
+ # to allow it (by having uploadpack.allowReachableSHA1InWant=true set
+ # in its config).
+ CT_DoLog WARN "Shallow clone failed (likely disallowed on the server)."
+ shallow_id=
+ fi
+ fi
+
+ if [ -z "${shallow_id}" ]; then
+ # In this case, we already determined the changeset we need
+ CT_DoLog WARN "Falling back to full clone; may take some time..."
+ CT_DoExecLog ALL git fetch --quiet origin
+ CT_DoExecLog ALL git checkout --quiet "${unique_id}" --
+ fi
+
+ new_unique_id=`git rev-parse HEAD | cut -c1-8`
+ if [ "${new_unique_id}" != "${unique_id}" ]; then
+ CT_DoLog EXTRA "Revision being fetched changed to ${new_unique_id}; source repository had more revisions pushed?"
+ unique_id="${new_unique_id}"
+ fi
+
CT_DoExecLog ALL rm -rf .git
CT_Popd
}
@@ -1897,7 +1976,7 @@ CT_PackageRun()
for v in basename pkg_name version pkg_dir \
src_release mirrors archive_filename archive_dirname archive_formats signature_format \
src_devel devel_vcs devel_url devel_branch devel_revision devel_subdir devel_bootstrap \
- src_custom custom_location; do
+ src_custom custom_location patch_order; do
eval "local ${v}=\${CT_${use}_${v^^}}"
done
@@ -1980,10 +2059,10 @@ CT_DoFetch()
if [ "${CT_FORBID_DOWNLOAD}" = "y" ]; then
CT_DoLog WARN "Downloads forbidden, not trying ${devel_vcs} retrieval"
- return 1
+ CT_Abort "${pkg_name}: cannot check out"
fi
- CT_DoLog EXTRA "Retrieving '${basename}' (${devel_vcs} ${devel_url} ${devel_branch} ${devel_revision})"
+ CT_DoLog EXTRA "Checking out '${basename}' (${devel_vcs} ${devel_url}${devel_branch:+, branch ${devel_branch}}${devel_revision:+, revision ${devel_revision}})"
CT_MktempDir tmp_dir
CT_Pushd "${tmp_dir}"
CT_Download_${devel_vcs}
@@ -1995,7 +2074,9 @@ CT_DoFetch()
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"
+ if ! CT_SaveLocal "${CT_TARBALLS_DIR}/${basename}.tar.bz2"; then
+ CT_Abort "${pkg_name}: failed to save to local storage"
+ fi
CT_Popd
CT_DoExecLog ALL rm -rf "${tmp_dir}"
@@ -2055,6 +2136,11 @@ CT_DoExtractPatch()
local local_patch_dir
local overlay
+ # Inherit global value if requested
+ if [ "${patch_order}" = "global" ]; then
+ patch_order="${CT_PATCH_ORDER}"
+ fi
+
# If using overlay, prepare it first - we need to determine where to unpack
# this component.
if [ "${CT_TARGET_USE_OVERLAY}" = "y" -a ! -d "${CT_BUILD_DIR}/overlay" ]; then
@@ -2071,7 +2157,7 @@ CT_DoExtractPatch()
# and no overlays. Otherwise, this source directory is custom-tailored for this
# particular configuration and cannot be reused by different configurations.
if [ "${src_custom}" != "y" -a \
- "${CT_PATCH_ORDER}" = "bundled" -a \
+ "${patch_order}" = "bundled" -a \
! -d "${CT_BUILD_DIR}/overlay/${dir_name}" ]; then
src_dir="${CT_COMMON_SRC_DIR}"
else
@@ -2120,7 +2206,7 @@ CT_DoExtractPatch()
bundled_patch_dir="${CT_LIB_DIR}/packages/${pkg_dir}"
local_patch_dir="${CT_LOCAL_PATCH_DIR}/${pkg_dir}"
- case "${CT_PATCH_ORDER}" in
+ case "${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}");;
@@ -2159,6 +2245,20 @@ CT_DoExtractPatch()
CT_DoExecLog ALL "${CT_CONFIG_SHELL}" -c "${devel_bootstrap}"
fi
+ # Fix up the timestamps on the file we may be patching: otherwise, we may
+ # have a circular dependency. For example, we need make to build autoconf
+ # and automake companion tools, but we need autoconf and automake to regenerate
+ # aclocal.m4 or config.h.in after the patch touches configure.ac. Instead,
+ # assume the patch fixes all the files it needs.
+ find . -type f -name "aclocal.m4" \
+ -exec touch {} \; -exec echo touch {} \; | CT_DoLog ALL
+ find . -type f -name "config.h.in" \
+ -exec touch {} \; -exec echo touch {} \; | CT_DoLog ALL
+ find . -type f -name "Makefile.in" \
+ -exec touch {} \; -exec echo touch {} \; | CT_DoLog ALL
+ find . -type f -name "configure" \
+ -exec touch {} \; -exec echo touch {} \; | CT_DoLog ALL
+
if [ -n "${patchfunc}" ]; then
${patchfunc}
fi
diff --git a/scripts/override/__default b/scripts/override/__default
deleted file mode 100644
index 977b1f5..0000000
--- a/scripts/override/__default
+++ /dev/null
@@ -1,3 +0,0 @@
-#!@CONFIG_SHELL@
-
-exec @TOOL_PATH@ "$@"