summaryrefslogtreecommitdiff
path: root/scripts/build
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/build')
-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
16 files changed, 119 insertions, 53 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: