diff options
Diffstat (limited to 'scripts/build')
-rw-r--r-- | scripts/build/cc/100-gcc.sh | 38 | ||||
-rw-r--r-- | scripts/build/companion_libs/121-isl.sh | 18 | ||||
-rw-r--r-- | scripts/build/companion_libs/320-libiconv.sh | 6 | ||||
-rw-r--r-- | scripts/build/companion_libs/330-gettext.sh | 6 | ||||
-rw-r--r-- | scripts/build/debug/300-gdb.sh | 6 | ||||
-rw-r--r-- | scripts/build/debug/500-strace.sh | 30 | ||||
-rw-r--r-- | scripts/build/libc/glibc.sh | 23 |
7 files changed, 68 insertions, 59 deletions
diff --git a/scripts/build/cc/100-gcc.sh b/scripts/build/cc/100-gcc.sh index 164fb9b..947d4af 100644 --- a/scripts/build/cc/100-gcc.sh +++ b/scripts/build/cc/100-gcc.sh @@ -478,14 +478,13 @@ do_gcc_core_backend() { host_libstdcxx_flags+=("-static-libgcc") host_libstdcxx_flags+=("-Wl,-Bstatic,-lstdc++,-Bdynamic") host_libstdcxx_flags+=("-lm") - elif [ "${CT_COMPLIBS_SHARED}" != "y" ]; then - # When companion libraries are build static (eg !shared), - # the libstdc++ is not pulled automatically, although it - # is needed. Shoe-horn it in our LDFLAGS - # Ditto libm on some Fedora boxen - core_LDFLAGS+=("-lstdc++") - core_LDFLAGS+=("-lm") fi + # When companion libraries are build static (eg !shared), + # the libstdc++ is not pulled automatically, although it + # is needed. Shoe-horn it in our LDFLAGS + # Ditto libm on some Fedora boxen + core_LDFLAGS+=("-lstdc++") + core_LDFLAGS+=("-lm") fi if [ "${CT_CC_GCC_USE_GMP_MPFR}" = "y" ]; then @@ -561,7 +560,11 @@ do_gcc_core_backend() { ;; # ARCH is mips esac - [ "${CT_TOOLCHAIN_ENABLE_NLS}" != "y" ] && extra_config+=("--disable-nls") + if [ "${CT_TOOLCHAIN_ENABLE_NLS}" = "y" ]; then + extra_config+=("--with-libintl-prefix=${complibs}") + else + extra_config+=("--disable-nls") + fi if [ "${CT_CC_GCC_SYSTEM_ZLIB}" = "y" ]; then extra_config+=("--with-system-zlib") @@ -985,14 +988,13 @@ do_gcc_backend() { host_libstdcxx_flags+=("-static-libgcc") host_libstdcxx_flags+=("-Wl,-Bstatic,-lstdc++,-Bdynamic") host_libstdcxx_flags+=("-lm") - elif [ "${CT_COMPLIBS_SHARED}" != "y" ]; then - # When companion libraries are build static (eg !shared), - # the libstdc++ is not pulled automatically, although it - # is needed. Shoe-horn it in our LDFLAGS - # Ditto libm on some Fedora boxen - final_LDFLAGS+=("-lstdc++") - final_LDFLAGS+=("-lm") fi + # When companion libraries are build static (eg !shared), + # the libstdc++ is not pulled automatically, although it + # is needed. Shoe-horn it in our LDFLAGS + # Ditto libm on some Fedora boxen + final_LDFLAGS+=("-lstdc++") + final_LDFLAGS+=("-lm") fi if [ "${CT_CC_GCC_USE_GMP_MPFR}" = "y" ]; then @@ -1086,7 +1088,11 @@ do_gcc_backend() { ;; # ARCH is mips esac - [ "${CT_TOOLCHAIN_ENABLE_NLS}" != "y" ] && extra_config+=("--disable-nls") + if [ "${CT_TOOLCHAIN_ENABLE_NLS}" = "y" ]; then + extra_config+=("--with-libintl-prefix=${complibs}") + else + extra_config+=("--disable-nls") + fi if [ "${CT_CC_GCC_SYSTEM_ZLIB}" = "y" ]; then extra_config+=("--with-system-zlib") diff --git a/scripts/build/companion_libs/121-isl.sh b/scripts/build/companion_libs/121-isl.sh index 823dbd5..8cc6dc2 100644 --- a/scripts/build/companion_libs/121-isl.sh +++ b/scripts/build/companion_libs/121-isl.sh @@ -29,8 +29,6 @@ do_isl_extract() { # - install in build-tools prefix do_isl_for_build() { local -a isl_opts - local isl_cflags - local isl_cxxflags case "${CT_TOOLCHAIN_TYPE}" in native|cross) return 0;; @@ -39,13 +37,10 @@ do_isl_for_build() { CT_DoStep INFO "Installing ISL for build" CT_mkdir_pushd "${CT_BUILD_DIR}/build-isl-build-${CT_BUILD}" - isl_cflags="${CT_CFLAGS_FOR_BUILD}" - isl_cxxflags="${CT_CFLAGS_FOR_BUILD}" - isl_opts+=( "host=${CT_BUILD}" ) isl_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" ) - isl_opts+=( "cflags=${isl_cflags}" ) - isl_opts+=( "cxxflags=${isl_cxxflags}" ) + isl_opts+=( "cflags=${CT_CFLAGS_FOR_BUILD}" ) + isl_opts+=( "cxxflags=${CT_CFLAGS_FOR_BUILD}" ) isl_opts+=( "ldflags=${CT_LDFLAGS_FOR_BUILD}" ) do_isl_backend "${isl_opts[@]}" @@ -56,19 +51,14 @@ do_isl_for_build() { # Build ISL for running on host do_isl_for_host() { local -a isl_opts - local isl_cflags - local isl_cxxflags CT_DoStep INFO "Installing ISL for host" CT_mkdir_pushd "${CT_BUILD_DIR}/build-isl-host-${CT_HOST}" - isl_cflags="${CT_CFLAGS_FOR_HOST}" - isl_cxxflags="${CT_CFLAGS_FOR_HOST}" - isl_opts+=( "host=${CT_HOST}" ) isl_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" ) - isl_opts+=( "cflags=${isl_cflags}" ) - isl_opts+=( "cxxflags=${isl_cxxflags}" ) + isl_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" ) + isl_opts+=( "cxxflags=${CT_CFLAGS_FOR_HOST}" ) isl_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" ) do_isl_backend "${isl_opts[@]}" diff --git a/scripts/build/companion_libs/320-libiconv.sh b/scripts/build/companion_libs/320-libiconv.sh index 55da586..3f3ce24 100644 --- a/scripts/build/companion_libs/320-libiconv.sh +++ b/scripts/build/companion_libs/320-libiconv.sh @@ -22,10 +22,8 @@ do_libiconv_extract() { do_libiconv_for_build() { local -a libiconv_opts - case "$CT_BUILD" in - *darwin*|*linux*) - return 0 - ;; + case "${CT_TOOLCHAIN_TYPE}" in + native|cross) return 0;; esac CT_DoStep INFO "Installing libiconv for build" diff --git a/scripts/build/companion_libs/330-gettext.sh b/scripts/build/companion_libs/330-gettext.sh index 07ea02b..88384f8 100644 --- a/scripts/build/companion_libs/330-gettext.sh +++ b/scripts/build/companion_libs/330-gettext.sh @@ -22,10 +22,8 @@ do_gettext_extract() { do_gettext_for_build() { local -a gettext_opts - case "$CT_BUILD" in - *linux*) - return 0 - ;; + case "${CT_TOOLCHAIN_TYPE}" in + native|cross) return 0;; esac CT_DoStep INFO "Installing gettext for build" diff --git a/scripts/build/debug/300-gdb.sh b/scripts/build/debug/300-gdb.sh index ba13591..3d3af7b 100644 --- a/scripts/build/debug/300-gdb.sh +++ b/scripts/build/debug/300-gdb.sh @@ -105,6 +105,12 @@ do_debug_gdb_build() { CC_for_gdb+=" -static" LD_for_gdb+=" -static" fi + case "${CT_HOST}" in + *darwin*) + # FIXME: Really, we should be testing for host compiler being clang. + CC_for_gdb+=" -Qunused-arguments" + ;; + esac # Fix up whitespace. Some older GDB releases (e.g. 6.8a) get confused if there # are multiple consecutive spaces: sub-configure scripts replace them with a diff --git a/scripts/build/debug/500-strace.sh b/scripts/build/debug/500-strace.sh index 0d33ca0..2961879 100644 --- a/scripts/build/debug/500-strace.sh +++ b/scripts/build/debug/500-strace.sh @@ -14,17 +14,29 @@ do_debug_strace_extract() { do_debug_strace_build() { CT_DoStep INFO "Installing strace" - mkdir -p "${CT_BUILD_DIR}/build-strace" - CT_Pushd "${CT_BUILD_DIR}/build-strace" + + # Strace needs _IOC definitions, and it tries to pick them up from <linux/ioctl.h>. + # While cross-compiling on a non-Linux host, we don't have this header. Replacing + # <linux/ioctl.h> with <sys/ioctl.h>, as suggested by many internet "solutions", + # is wrong: for example, MacOS defines _IOC macros differently, and we need the + # definitions for the target! + # Hence, create a "window" into target includes. + CT_DoExecLog ALL mkdir -p "${CT_BUILD_DIR}/build-strace-headers" + for d in linux asm asm-generic; do + CT_DoExecLog ALL ln -sf "${CT_HEADERS_DIR}/${d}" "${CT_BUILD_DIR}/build-strace-headers/${d}" + done + + CT_mkdir_pushd "${CT_BUILD_DIR}/build-strace" CT_DoLog EXTRA "Configuring strace" - CT_DoExecLog CFG \ - CC="${CT_TARGET}-gcc" \ - CPP="${CT_TARGET}-cpp" \ - LD="${LD_TARGET}-ld" \ - "${CT_SRC_DIR}/strace-${CT_STRACE_VERSION}/configure" \ - --build=${CT_BUILD} \ - --host=${CT_TARGET} \ + CT_DoExecLog CFG \ + CFLAGS_FOR_BUILD="-I ${CT_BUILD_DIR}/build-strace-headers" \ + CC="${CT_TARGET}-gcc" \ + CPP="${CT_TARGET}-cpp" \ + LD="${CT_TARGET}-ld" \ + "${CT_SRC_DIR}/strace-${CT_STRACE_VERSION}/configure" \ + --build=${CT_BUILD} \ + --host=${CT_TARGET} \ --prefix=/usr CT_DoLog EXTRA "Building strace" diff --git a/scripts/build/libc/glibc.sh b/scripts/build/libc/glibc.sh index 2db69cb..019dd90 100644 --- a/scripts/build/libc/glibc.sh +++ b/scripts/build/libc/glibc.sh @@ -96,6 +96,7 @@ do_libc_backend() { # multi_* : as defined in CT_IterateMultilibs : (varies) : do_libc_backend_once() { local multi_flags multi_dir multi_os_dir multi_root multi_index multi_count + local build_cflags build_cppflags build_ldflags local startfiles_dir local src_dir="${CT_SRC_DIR}/${CT_LIBC}-${CT_LIBC_VERSION}" local -a extra_config @@ -277,23 +278,21 @@ do_libc_backend_once() { ;; esac - CT_CFLAGS_FOR_BUILD+=" ${CT_EXTRA_CFLAGS_FOR_BUILD}" - CT_LDFLAGS_FOR_BUILD+=" ${CT_EXTRA_LDFLAGS_FOR_BUILD}" - extra_make_args+=( "BUILD_CFLAGS=${CT_CFLAGS_FOR_BUILD}" "BUILD_LDFLAGS=${CT_LDFLAGS_FOR_BUILD}" ) + build_cflags="${CT_CFLAGS_FOR_BUILD}" + build_cppflags= + build_ldflags="${CT_LDFLAGS_FOR_BUILD}" case "$CT_BUILD" in - *mingw*|*cygwin*|*msys*) - # When installing headers on Cygwin, MSYS2 and MinGW-w64 sunrpc needs + *mingw*|*cygwin*|*msys*|*darwin*) + # When installing headers on Cygwin, Darwin, MSYS2 and MinGW-w64 sunrpc needs # gettext for building cross-rpcgen. - extra_make_args+=( BUILD_CPPFLAGS="-I${CT_BUILDTOOLS_PREFIX_DIR}/include/" ) - extra_make_args+=( BUILD_LDFLAGS="-L${CT_BUILDTOOLS_PREFIX_DIR}/lib -Wl,-Bstatic -lintl -liconv -Wl,-Bdynamic" ) - ;; - *darwin*) - # .. and the same goes for Darwin. - extra_make_args+=( BUILD_CPPFLAGS="-I${CT_BUILDTOOLS_PREFIX_DIR}/include/" ) - extra_make_args+=( BUILD_LDFLAGS="-L${CT_BUILDTOOLS_PREFIX_DIR}/lib -lintl" ) + build_cppflags="${build_cppflags} -I${CT_BUILDTOOLS_PREFIX_DIR}/include/" + build_ldflags="${build_ldflags} -lintl -liconv" ;; esac + extra_make_args+=( "BUILD_CFLAGS=${build_cflags}" ) + extra_make_args+=( "BUILD_CPPFLAGS=${build_cppflags}" ) + extra_make_args+=( "BUILD_LDFLAGS=${build_ldflags}" ) if [ "${libc_mode}" = "startfiles" -a ! -r "${multi_root}/.libc_headers_installed" ]; then CT_DoLog EXTRA "Installing C library headers" |