From 874f4bd668e0ab9293eb10fa19fe5279768a0ce7 Mon Sep 17 00:00:00 2001 From: Alexey Neyman Date: Fri, 16 Dec 2016 15:51:04 -0800 Subject: Disallow c++ for baremetal. libstdc++ configure fails to find . Signed-off-by: Alexey Neyman diff --git a/config/cc/gcc.in b/config/cc/gcc.in index a98b9f1..7808241 100644 --- a/config/cc/gcc.in +++ b/config/cc/gcc.in @@ -1,7 +1,7 @@ # Compiler options # ## default y -## select CC_SUPPORT_CXX +## select CC_SUPPORT_CXX if !LIBC_none ## select CC_SUPPORT_FORTRAN ## select CC_SUPPORT_JAVA ## select CC_SUPPORT_ADA -- cgit v0.10.2-6-g49f6 From 11f87cfa5da701e156450910a3c586419a3bf00a Mon Sep 17 00:00:00 2001 From: Alexey Neyman Date: Fri, 16 Dec 2016 15:52:26 -0800 Subject: Kill CT_COMPLIBS_SHARED. There is no such option so the check is always true. Signed-off-by: Alexey Neyman diff --git a/scripts/build/cc/100-gcc.sh b/scripts/build/cc/100-gcc.sh index 164fb9b..cb0a4fa 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 @@ -985,14 +984,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 -- cgit v0.10.2-6-g49f6 From ca0700010e9be397414b1eba8d82e66c976e03f6 Mon Sep 17 00:00:00 2001 From: Alexey Neyman Date: Fri, 16 Dec 2016 15:53:13 -0800 Subject: Simplify a bit, no functional changes. Signed-off-by: Alexey Neyman 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[@]}" -- cgit v0.10.2-6-g49f6 From 8e7ac5fcd94d68cdd7cc7ad4638bdc0e48e9baf5 Mon Sep 17 00:00:00 2001 From: Alexey Neyman Date: Fri, 16 Dec 2016 15:54:11 -0800 Subject: Change when libiconv/gettext are built. Make them configurable, default to y when build!=host (i.e. canadian or cross-native) because we don't know what libraries the host will provide. GLIBC, as previously, selects them explicitly. Signed-off-by: Alexey Neyman diff --git a/config/companion_libs.in b/config/companion_libs.in index 67094cb..e7e3ebb 100644 --- a/config/companion_libs.in +++ b/config/companion_libs.in @@ -62,11 +62,13 @@ config COMPLIBS bool config LIBICONV - bool + bool "Build local libiconv" + default y if CANADIAN || CROSS_NATIVE select COMPLIBS config GETTEXT - bool + bool "Build local gettext" + default y if CANADIAN || CROSS_NATIVE select COMPLIBS config GMP 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" -- cgit v0.10.2-6-g49f6 From 1f84e9caf4f0a0d7c362b108d3c303078c1bbe97 Mon Sep 17 00:00:00 2001 From: Alexey Neyman Date: Fri, 16 Dec 2016 15:56:32 -0800 Subject: Point FOR_BUILD flags to buildtools/{include,lib}. Similarly to FOR_HOST; recent change in 100-gcc.sh that switched FOR_HOST->FOR_BUILD broke simple cross configurations on macos. Signed-off-by: Alexey Neyman diff --git a/scripts/crosstool-NG.sh.in b/scripts/crosstool-NG.sh.in index bbefb1f..5037c86 100644 --- a/scripts/crosstool-NG.sh.in +++ b/scripts/crosstool-NG.sh.in @@ -478,21 +478,22 @@ if [ -z "${CT_RESTART}" ]; then # Help build gcc # Explicitly optimise, else the lines below will overide the # package's default optimisation flags - CT_CFLAGS_FOR_BUILD="-O2 -g" + CT_CFLAGS_FOR_BUILD="-O2 -g -I${CT_BUILDTOOLS_PREFIX_DIR}/include" CT_CFLAGS_FOR_BUILD+=" ${CT_EXTRA_CFLAGS_FOR_BUILD}" - CT_LDFLAGS_FOR_BUILD= + CT_LDFLAGS_FOR_BUILD="-L${CT_BUILDTOOLS_PREFIX_DIR}/lib" CT_LDFLAGS_FOR_BUILD+=" ${CT_EXTRA_LDFLAGS_FOR_BUILD}" + CT_DoLog DEBUG "CFLAGS for build compiler: '${CT_CFLAGS_FOR_BUILD}'" + CT_DoLog DEBUG "LDFLAGS for build compiler: '${CT_LDFLAGS_FOR_BUILD}'" # Help host gcc # Explicitly optimise, else the lines below will overide the # package's default optimisation flags CT_CFLAGS_FOR_HOST="-O2 -g" [ "${CT_USE_PIPES}" = "y" ] && CT_CFLAGS_FOR_HOST+=" -pipe" + CT_CFLAGS_FOR_HOST+=" -I${CT_HOST_COMPLIBS_DIR}/include" CT_CFLAGS_FOR_HOST+=" ${CT_EXTRA_CFLAGS_FOR_HOST}" - CT_LDFLAGS_FOR_HOST= + CT_LDFLAGS_FOR_HOST="-L${CT_HOST_COMPLIBS_DIR}/lib" CT_LDFLAGS_FOR_HOST+=" ${CT_EXTRA_LDFLAGS_FOR_HOST}" - CT_CFLAGS_FOR_HOST+=" -I${CT_HOST_COMPLIBS_DIR}/include" - CT_LDFLAGS_FOR_HOST+=" -L${CT_HOST_COMPLIBS_DIR}/lib" CT_DoLog DEBUG "CFLAGS for host compiler: '${CT_CFLAGS_FOR_HOST}'" CT_DoLog DEBUG "LDFLAGS for host compiler: '${CT_LDFLAGS_FOR_HOST}'" -- cgit v0.10.2-6-g49f6 From 9f62ca8deb3a16ac86ebc35c0093b82423900633 Mon Sep 17 00:00:00 2001 From: Alexey Neyman Date: Sun, 18 Dec 2016 19:04:37 -0800 Subject: Select libintl from gettext we built. Also, require gettext for NLS, and require iconv/ncurses for gettext. Signed-off-by: Alexey Neyman diff --git a/config/companion_libs.in b/config/companion_libs.in index e7e3ebb..7d1d4f7 100644 --- a/config/companion_libs.in +++ b/config/companion_libs.in @@ -69,6 +69,8 @@ config LIBICONV config GETTEXT bool "Build local gettext" default y if CANADIAN || CROSS_NATIVE + select LIBICONV_NEEDED + select NCURSES_NEEDED select COMPLIBS config GMP diff --git a/config/toolchain.in b/config/toolchain.in index ca74ee7..b8c1b4a 100644 --- a/config/toolchain.in +++ b/config/toolchain.in @@ -308,6 +308,7 @@ comment "Misc options" config TOOLCHAIN_ENABLE_NLS bool prompt "Enable nls" + select GETTEXT_NEEDED help Say 'Y' here to enable native language support (nls). diff --git a/scripts/build/cc/100-gcc.sh b/scripts/build/cc/100-gcc.sh index cb0a4fa..947d4af 100644 --- a/scripts/build/cc/100-gcc.sh +++ b/scripts/build/cc/100-gcc.sh @@ -560,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") @@ -1084,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") -- cgit v0.10.2-6-g49f6 From 36bbcf4b4f26e414438d7535b111b5a1159ebb22 Mon Sep 17 00:00:00 2001 From: Alexey Neyman Date: Mon, 19 Dec 2016 10:28:15 -0800 Subject: For simple cross or native pick up both build/host flags. Signed-off-by: Alexey Neyman diff --git a/scripts/crosstool-NG.sh.in b/scripts/crosstool-NG.sh.in index 5037c86..3495867 100644 --- a/scripts/crosstool-NG.sh.in +++ b/scripts/crosstool-NG.sh.in @@ -469,10 +469,24 @@ if [ -z "${CT_RESTART}" ]; then # - fall back to searching user's PATH # Of course, neither cross-native nor canadian can run on BUILD, # so don't add those PATHs in this case... + # For native and simple cross, build==host, combine the extra CFLAGS/LDFLAGS + # supplied for both (so that it doesn't matter where the user supplied them). case "${CT_TOOLCHAIN_TYPE}" in - cross) export PATH="${CT_PREFIX_DIR}/bin:${CT_BUILDTOOLS_PREFIX_DIR}/bin:${PATH}";; - canadian) export PATH="${CT_BUILDTOOLS_PREFIX_DIR}/bin:${PATH}";; - *) ;; + cross|native) + export PATH="${CT_PREFIX_DIR}/bin:${CT_BUILDTOOLS_PREFIX_DIR}/bin:${PATH}" + bh_cflags="${CT_EXTRA_CFLAGS_FOR_BUILD} ${CT_EXTRA_CFLAGS_FOR_HOST}" + bh_ldflags="${CT_EXTRA_LDFLAGS_FOR_BUILD} ${CT_EXTRA_LDFLAGS_FOR_HOST}" + CT_EXTRA_CFLAGS_FOR_BUILD="${bh_cflags}" + CT_EXTRA_CFLAGS_FOR_HOST="${bh_cflags}" + CT_EXTRA_LDFLAGS_FOR_BUILD="${bh_ldflags}" + CT_EXTRA_LDFLAGS_FOR_HOST="${bh_ldflags}" + ;; + canadian|cross-native) + export PATH="${CT_BUILDTOOLS_PREFIX_DIR}/bin:${PATH}" + # build!=host in this case + ;; + *) + ;; esac # Help build gcc -- cgit v0.10.2-6-g49f6 From f14c2900789ec3edcdeca42170375deee5d81438 Mon Sep 17 00:00:00 2001 From: Alexey Neyman Date: Tue, 20 Dec 2016 11:49:17 -0800 Subject: Patch GCC to leave -framework alone. Signed-off-by: Alexey Neyman diff --git a/patches/gcc/4.8.5/1000-libtool-leave-framework-alone.patch b/patches/gcc/4.8.5/1000-libtool-leave-framework-alone.patch new file mode 100644 index 0000000..525592e --- /dev/null +++ b/patches/gcc/4.8.5/1000-libtool-leave-framework-alone.patch @@ -0,0 +1,14 @@ +--- gcc-4.9.4/libtool-ldflags 2016-12-20 11:13:12.669668125 -0800 ++++ gcc-4.9.4/libtool-ldflags 2016-12-20 11:28:34.894826286 -0800 +@@ -36,6 +36,11 @@ + for arg + do + case $arg in ++ -framework) ++ # libtool handles this option. It should not be prefixed with ++ # -Xcompiler, as that would split it from the argument that ++ # follows. ++ ;; + -f*|--*) + # Libtool does not ascribe any special meaning options + # that begin with -f or with a double-dash. So, it will diff --git a/patches/gcc/4.9.4/1000-libtool-leave-framework-alone.patch b/patches/gcc/4.9.4/1000-libtool-leave-framework-alone.patch new file mode 100644 index 0000000..525592e --- /dev/null +++ b/patches/gcc/4.9.4/1000-libtool-leave-framework-alone.patch @@ -0,0 +1,14 @@ +--- gcc-4.9.4/libtool-ldflags 2016-12-20 11:13:12.669668125 -0800 ++++ gcc-4.9.4/libtool-ldflags 2016-12-20 11:28:34.894826286 -0800 +@@ -36,6 +36,11 @@ + for arg + do + case $arg in ++ -framework) ++ # libtool handles this option. It should not be prefixed with ++ # -Xcompiler, as that would split it from the argument that ++ # follows. ++ ;; + -f*|--*) + # Libtool does not ascribe any special meaning options + # that begin with -f or with a double-dash. So, it will diff --git a/patches/gcc/5.4.0/1000-libtool-leave-framework-alone.patch b/patches/gcc/5.4.0/1000-libtool-leave-framework-alone.patch new file mode 100644 index 0000000..0f4912a --- /dev/null +++ b/patches/gcc/5.4.0/1000-libtool-leave-framework-alone.patch @@ -0,0 +1,14 @@ +--- gcc-5.4.0/libtool-ldflags 2016-12-20 11:13:12.669668125 -0800 ++++ gcc-5.4.0/libtool-ldflags 2016-12-20 11:28:34.894826286 -0800 +@@ -36,6 +36,11 @@ + for arg + do + case $arg in ++ -framework) ++ # libtool handles this option. It should not be prefixed with ++ # -Xcompiler, as that would split it from the argument that ++ # follows. ++ ;; + -f*|--*|-static-lib*|-shared-lib*|-B*) + # Libtool does not ascribe any special meaning options + # that begin with -f or with a double-dash. So, it will diff --git a/patches/gcc/6.3.0/1000-libtool-leave-framework-alone.patch b/patches/gcc/6.3.0/1000-libtool-leave-framework-alone.patch new file mode 100644 index 0000000..bce09eb --- /dev/null +++ b/patches/gcc/6.3.0/1000-libtool-leave-framework-alone.patch @@ -0,0 +1,14 @@ +--- gcc-6.2.0/libtool-ldflags 2016-12-20 11:13:12.669668125 -0800 ++++ gcc-6.2.0/libtool-ldflags 2016-12-20 11:28:34.894826286 -0800 +@@ -36,6 +36,11 @@ + for arg + do + case $arg in ++ -framework) ++ # libtool handles this option. It should not be prefixed with ++ # -Xcompiler, as that would split it from the argument that ++ # follows. ++ ;; + -f*|--*|-static-lib*|-shared-lib*|-B*) + # Libtool does not ascribe any special meaning options + # that begin with -f or with a double-dash. So, it will -- cgit v0.10.2-6-g49f6 From c1b7324fc3963daebda52b837a14eb4b83bc40f4 Mon Sep 17 00:00:00 2001 From: Alexey Neyman Date: Tue, 20 Dec 2016 21:02:54 -0800 Subject: Avoid trampling user's LDFLAGS_FOR_HOST... ... by passing BUILD_LDFLAGS twice (the 2nd argument overrides the first). Also, no need to pass -I/-L for BUILD_CFLAGS/LDFLAGS, they are already included by crosstool-NG.sh (but keep for BUILD_CPPFLAGS, as we set it up here). Remove -Wl,-Bstatic/-Wl,-Bdynamic (we only build static complibs). Signed-off-by: Alexey Neyman diff --git a/scripts/build/libc/glibc.sh b/scripts/build/libc/glibc.sh index 2db69cb..cf96ecf 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,26 @@ 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 # 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" ) + build_cppflags="${build_cppflags} -I${CT_BUILDTOOLS_PREFIX_DIR}/include/" + build_ldflags="${build_ldflags} -lintl -liconv" ;; *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" ;; 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" -- cgit v0.10.2-6-g49f6 From 25bc99f4d084780ca9d81a41213fe982377fc038 Mon Sep 17 00:00:00 2001 From: Alexey Neyman Date: Mon, 9 Jan 2017 17:43:48 -0800 Subject: Darwin needs -liconv when building glibc. Signed-off-by: Alexey Neyman diff --git a/scripts/build/libc/glibc.sh b/scripts/build/libc/glibc.sh index cf96ecf..019dd90 100644 --- a/scripts/build/libc/glibc.sh +++ b/scripts/build/libc/glibc.sh @@ -283,17 +283,12 @@ do_libc_backend_once() { 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. build_cppflags="${build_cppflags} -I${CT_BUILDTOOLS_PREFIX_DIR}/include/" build_ldflags="${build_ldflags} -lintl -liconv" ;; - *darwin*) - # .. and the same goes for Darwin. - build_cppflags="${build_cppflags} -I${CT_BUILDTOOLS_PREFIX_DIR}/include/" - build_ldflags="${build_ldflags} -lintl" - ;; esac extra_make_args+=( "BUILD_CFLAGS=${build_cflags}" ) extra_make_args+=( "BUILD_CPPFLAGS=${build_cppflags}" ) -- cgit v0.10.2-6-g49f6 From 4a138d84078ab89a8f8bc636d5c4260951d4ee11 Mon Sep 17 00:00:00 2001 From: Alexey Neyman Date: Sun, 8 Jan 2017 01:26:52 -0600 Subject: Shut clang's warning that confuses configure. Warning causes gdb's configure to not detect declarations of LONG_MIN/MAX. Found-by: Kirill Smirnov Signed-off-by: Alexey Neyman 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 -- cgit v0.10.2-6-g49f6 From 7989e5d7434cc5bf822bf659875a3e0e105cfca7 Mon Sep 17 00:00:00 2001 From: Alexey Neyman Date: Sun, 8 Jan 2017 01:28:54 -0600 Subject: ${LD_TARGET} -> ${CT_TARGET}. Obvious typo, worked by some miracle. Signed-off-by: Alexey Neyman diff --git a/scripts/build/debug/500-strace.sh b/scripts/build/debug/500-strace.sh index 0d33ca0..69408de 100644 --- a/scripts/build/debug/500-strace.sh +++ b/scripts/build/debug/500-strace.sh @@ -21,7 +21,7 @@ do_debug_strace_build() { CT_DoExecLog CFG \ CC="${CT_TARGET}-gcc" \ CPP="${CT_TARGET}-cpp" \ - LD="${LD_TARGET}-ld" \ + LD="${CT_TARGET}-ld" \ "${CT_SRC_DIR}/strace-${CT_STRACE_VERSION}/configure" \ --build=${CT_BUILD} \ --host=${CT_TARGET} \ -- cgit v0.10.2-6-g49f6 From 37a5a09e6505b28deb7cb4aaa5643950e4f892e9 Mon Sep 17 00:00:00 2001 From: Alexey Neyman Date: Sun, 8 Jan 2017 02:32:10 -0600 Subject: Add MacOS options. Needed for linking gettext/libiconv. Signed-off-by: Alexey Neyman diff --git a/scripts/crosstool-NG.sh.in b/scripts/crosstool-NG.sh.in index 3495867..ba36bc8 100644 --- a/scripts/crosstool-NG.sh.in +++ b/scripts/crosstool-NG.sh.in @@ -496,6 +496,22 @@ if [ -z "${CT_RESTART}" ]; then CT_CFLAGS_FOR_BUILD+=" ${CT_EXTRA_CFLAGS_FOR_BUILD}" CT_LDFLAGS_FOR_BUILD="-L${CT_BUILDTOOLS_PREFIX_DIR}/lib" CT_LDFLAGS_FOR_BUILD+=" ${CT_EXTRA_LDFLAGS_FOR_BUILD}" + + case "${CT_BUILD}" in + *darwin*) + # Two issues while building on MacOS. Really, we should be checking for + # clang instead. + # - gettext static library fails to link unless CoreFoundation framework + # is included + # - ranlib on MacOS does not include common symbols into the symbol index + # for a static library, and hence linker fails to pull in the right + # archive members; hence, avoid common symbols. Alternative is to + # have ranlib wrapper in buildtools/bin supply -c option. + CT_CFLAGS_FOR_BUILD+=" -fno-common" + CT_LDFLAGS_FOR_BUILD+=" -framework CoreFoundation" + ;; + esac + CT_DoLog DEBUG "CFLAGS for build compiler: '${CT_CFLAGS_FOR_BUILD}'" CT_DoLog DEBUG "LDFLAGS for build compiler: '${CT_LDFLAGS_FOR_BUILD}'" @@ -508,6 +524,13 @@ if [ -z "${CT_RESTART}" ]; then CT_CFLAGS_FOR_HOST+=" ${CT_EXTRA_CFLAGS_FOR_HOST}" CT_LDFLAGS_FOR_HOST="-L${CT_HOST_COMPLIBS_DIR}/lib" CT_LDFLAGS_FOR_HOST+=" ${CT_EXTRA_LDFLAGS_FOR_HOST}" + case "${CT_HOST}" in + *darwin*) + # Same as above, for host + CT_CFLAGS_FOR_HOST+=" -fno-common" + CT_LDFLAGS_FOR_HOST+=" -framework CoreFoundation" + ;; + esac CT_DoLog DEBUG "CFLAGS for host compiler: '${CT_CFLAGS_FOR_HOST}'" CT_DoLog DEBUG "LDFLAGS for host compiler: '${CT_LDFLAGS_FOR_HOST}'" -- cgit v0.10.2-6-g49f6 From c69e593a9272ad186b6669bc5b12886890cea7fe Mon Sep 17 00:00:00 2001 From: Alexey Neyman Date: Mon, 9 Jan 2017 01:01:52 -0600 Subject: Pick up and friends from TARGET. Otherwise, cross-compiling fails on non-Linux build machines. Signed-off-by: Alexey Neyman diff --git a/scripts/build/debug/500-strace.sh b/scripts/build/debug/500-strace.sh index 69408de..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 . + # While cross-compiling on a non-Linux host, we don't have this header. Replacing + # with , 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="${CT_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" -- cgit v0.10.2-6-g49f6