diff options
Diffstat (limited to 'scripts/build/libc')
-rw-r--r-- | scripts/build/libc/bionic.sh | 6 | ||||
-rw-r--r-- | scripts/build/libc/glibc.sh | 8 | ||||
-rw-r--r-- | scripts/build/libc/mingw-w64.sh | 18 | ||||
-rw-r--r-- | scripts/build/libc/newlib.sh | 12 |
4 files changed, 34 insertions, 10 deletions
diff --git a/scripts/build/libc/bionic.sh b/scripts/build/libc/bionic.sh index 027493d4..93dcea0c 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 3b4b6268..125ccf74 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 21afb29d..3026b879 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 5c4a3562..6449d68a 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: |