aboutsummaryrefslogtreecommitdiff
path: root/scripts/build/companion_libs
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/build/companion_libs')
-rw-r--r--scripts/build/companion_libs/050-zlib.sh2
-rw-r--r--scripts/build/companion_libs/070-zstd.sh16
-rw-r--r--scripts/build/companion_libs/100-gmp.sh4
-rw-r--r--scripts/build/companion_libs/220-ncurses.sh4
-rw-r--r--scripts/build/companion_libs/340-picolibc.sh28
-rw-r--r--scripts/build/companion_libs/400-gnuprumcu.sh19
6 files changed, 50 insertions, 23 deletions
diff --git a/scripts/build/companion_libs/050-zlib.sh b/scripts/build/companion_libs/050-zlib.sh
index 07c95496..fff326b2 100644
--- a/scripts/build/companion_libs/050-zlib.sh
+++ b/scripts/build/companion_libs/050-zlib.sh
@@ -92,8 +92,6 @@ do_zlib_backend() {
cp -av "${CT_SRC_DIR}/zlib/." .
extra_make=( -f win32/Makefile.gcc \
PREFIX="${host}-" \
- SHAREDLIB= \
- IMPLIB= \
LIBRARY_PATH="${prefix}/lib" \
INCLUDE_PATH="${prefix}/include" \
BINARY_PATH="${prefix}/bin" \
diff --git a/scripts/build/companion_libs/070-zstd.sh b/scripts/build/companion_libs/070-zstd.sh
index bc334142..d8ef8c2e 100644
--- a/scripts/build/companion_libs/070-zstd.sh
+++ b/scripts/build/companion_libs/070-zstd.sh
@@ -81,19 +81,9 @@ do_zstd_backend() {
done
CT_DoLog EXTRA "Building zstd"
- CT_DoExecLog ALL make ${CT_JOBSFLAGS} -C "${CT_SRC_DIR}/zstd/lib" libzstd.a BUILD_DIR="${PWD}" CC="${host}-gcc" AS="${host}-as" CFLAGS="${cflags}" LDFLAGS="${ldflags}"
-
- # TODO: Has to be tested
-
- #if [ "${CT_COMPLIBS_CHECK}" = "y" ]; then
- # if [ "${host}" = "${CT_BUILD}" ]; then
- # CT_DoLog EXTRA "Checking zstd"
- # CT_DoExecLog ALL make ${CT_JOBSFLAGS} -s check
- # else
- # # Cannot run host binaries on build in a canadian cross
- # CT_DoLog EXTRA "Skipping check for zstd on the host"
- # fi
- #fi
+ CT_DoExecLog ALL make ${CT_JOBSFLAGS} -C "${CT_SRC_DIR}/zstd/lib" libzstd.a-nomt-release BUILD_DIR="${PWD}" CC="${host}-gcc" AS="${host}-as" CFLAGS="${cflags}" LDFLAGS="${ldflags}"
+
+ # There is no library only check in zstd
CT_DoLog EXTRA "Installing zstd"
CT_DoExecLog ALL make -C "${CT_SRC_DIR}/zstd/lib" install-static install-includes BUILD_DIR="${PWD}" PREFIX="$prefix"
diff --git a/scripts/build/companion_libs/100-gmp.sh b/scripts/build/companion_libs/100-gmp.sh
index 28deff97..4ecaa721 100644
--- a/scripts/build/companion_libs/100-gmp.sh
+++ b/scripts/build/companion_libs/100-gmp.sh
@@ -122,12 +122,14 @@ do_gmp_backend() {
extra_config+=("--with-pic")
fi
+ cflags+=" ${CT_GMP_EXTRA_CFLAGS}"
+
# GMP's configure script doesn't respect the host parameter
# when not cross-compiling, ie when build == host so set
# CC_FOR_BUILD and CPP_FOR_BUILD.
CT_DoExecLog CFG \
CC_FOR_BUILD="${CT_BUILD}-gcc" \
- CPP_FOR_BUILD="{CT_BUILD}-cpp" \
+ CPP_FOR_BUILD="${CT_BUILD}-cpp" \
CC="${host}-gcc" \
CFLAGS="${cflags} -fexceptions" \
LDFLAGS="${ldflags}" \
diff --git a/scripts/build/companion_libs/220-ncurses.sh b/scripts/build/companion_libs/220-ncurses.sh
index f1fcd1a1..36aadae6 100644
--- a/scripts/build/companion_libs/220-ncurses.sh
+++ b/scripts/build/companion_libs/220-ncurses.sh
@@ -133,6 +133,8 @@ do_ncurses_backend() {
esac
done
+ ncurses_opts+=("--disable-widec")
+
if [ "${CT_NCURSES_NEW_ABI}" != "y" ]; then
ncurses_opts+=("--with-abi-version=5")
fi
@@ -150,6 +152,8 @@ do_ncurses_backend() {
ncurses_opts+=("--with-shared")
fi
+ cflags+=" ${CT_NCURSES_EXTRA_CFLAGS}"
+
CT_DoLog EXTRA "Configuring ncurses"
CT_DoExecLog CFG \
CFLAGS="${cflags}" \
diff --git a/scripts/build/companion_libs/340-picolibc.sh b/scripts/build/companion_libs/340-picolibc.sh
index 0b2038e6..bef72e0f 100644
--- a/scripts/build/companion_libs/340-picolibc.sh
+++ b/scripts/build/companion_libs/340-picolibc.sh
@@ -26,13 +26,7 @@ do_picolibc_common_install() {
yn_args="IO_C99FMT:io-c99-formats
IO_LL:io-long-long
-REGISTER_FINI:newlib-register-fini
NANO_MALLOC:newlib-nano-malloc
-ATEXIT_DYNAMIC_ALLOC:newlib-atexit-dynamic-alloc
-GLOBAL_ATEXIT:newlib-global-atexit
-LITE_EXIT:lite-exit
-MULTITHREAD:newlib-multithread
-RETARGETABLE_LOCKING:newlib-retargetable-locking
"
for ynarg in $yn_args; do
@@ -48,6 +42,24 @@ RETARGETABLE_LOCKING:newlib-retargetable-locking
fi
done
+ # Check how picolibc wants threading support to be specified
+
+ if grep -q single-thread "${CT_SRC_DIR}/picolibc/meson_options.txt"; then
+ if [ "${CT_LIBC_PICOLIBC_MULTITHREAD}" = "y" ]; then
+ picolibc_opts+=("-Dsingle-thread=false")
+ else
+ picolibc_opts+=("-Dsingle-thread=true")
+ fi
+ else
+ if [ "${CT_LIBC_PICOLIBC_MULTITHREAD}" = "y" ]; then
+ picolibc_opts+=("-Dnewlib-retargetable-locking=true")
+ picolibc_opts+=("-Dnewlib-multithread=true")
+ else
+ picolibc_opts+=("-Dnewlib-retargetable-locking=false")
+ picolibc_opts+=("-Dnewlib-multithread=false")
+ fi
+ fi
+
[ "${CT_LIBC_PICOLIBC_EXTRA_SECTIONS}" = "y" ] && \
CT_LIBC_PICOLIBC_TARGET_CFLAGS="${CT_LIBC_PICOLIBC_TARGET_CFLAGS} -ffunction-sections -fdata-sections"
@@ -150,12 +162,16 @@ do_cc_libstdcxx_picolibc()
final_opts+=( "lang_list=c,c++" )
final_opts+=( "build_step=libstdcxx" )
final_opts+=( "extra_config+=('--enable-stdio=stdio_pure')" )
+ final_opts+=( "extra_config+=('--with-headers=${CT_PREFIX_DIR}/picolibc/include')" )
if [ "${CT_PICOLIBC_older_than_1_8}" = "y" ]; then
final_opts+=( "extra_config+=('--disable-wchar_t')" )
fi
if [ "${CT_LIBC_PICOLIBC_ENABLE_TARGET_OPTSPACE}" = "y" ]; then
final_opts+=( "enable_optspace=yes" )
fi
+ if [ -n "${CT_LIBC_PICOLIBC_GCC_LIBSTDCXX_TARGET_CXXFLAGS}" ]; then
+ final_opts+=( "extra_cxxflags_for_target=${CT_LIBC_PICOLIBC_GCC_LIBSTDCXX_TARGET_CXXFLAGS}" )
+ fi
if [ "${CT_BARE_METAL}" = "y" ]; then
final_opts+=( "mode=baremetal" )
diff --git a/scripts/build/companion_libs/400-gnuprumcu.sh b/scripts/build/companion_libs/400-gnuprumcu.sh
index bba85748..7d17853c 100644
--- a/scripts/build/companion_libs/400-gnuprumcu.sh
+++ b/scripts/build/companion_libs/400-gnuprumcu.sh
@@ -19,6 +19,22 @@ do_gnuprumcu_extract() {
do_gnuprumcu_for_target() {
local -a gnuprumcu_opts
+ local -a cflags
+
+ cflags=${CT_ALL_TARGET_CFLAGS}
+
+ # When building a canadian, newlib is installed
+ # only in the host' sysroot. Thus the build toolchain
+ # lacks CRT0 and LibC objects. Consequently the
+ # gnuprumcu configure script fails with:
+ # .../ld: cannot find crt0.o: No such file or directory
+ # configure:3738: error: C compiler cannot create executables
+ #
+ # Fix by pointing the build toolchain to the host sysroot,
+ # where the necessary target runtime files are available.
+ case "${CT_TOOLCHAIN_TYPE}" in
+ canadian) cflags="${cflags} --sysroot=${CT_SYSROOT_DIR}";;
+ esac
CT_DoStep INFO "Installing gnuprumcu for the target"
CT_mkdir_pushd "${CT_BUILD_DIR}/build-gnuprumcu-target-${CT_TARGET}"
@@ -26,7 +42,8 @@ do_gnuprumcu_for_target() {
gnuprumcu_opts+=( "destdir=${CT_SYSROOT_DIR}" )
gnuprumcu_opts+=( "host=${CT_TARGET}" )
- gnuprumcu_opts+=( "cflags=${CT_ALL_TARGET_CFLAGS}" )
+ gnuprumcu_opts+=( "cflags=${cflags}" )
+ gnuprumcu_opts+=( "ldflags=${CT_ALL_TARGET_LDFLAGS}" )
gnuprumcu_opts+=( "prefix=${CT_PREFIX_DIR}" )
do_gnuprumcu_backend "${gnuprumcu_opts[@]}"