diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/addToolVersion.sh | 10 | ||||
-rw-r--r-- | scripts/build/arch/x86.sh | 4 | ||||
-rw-r--r-- | scripts/build/binutils/binutils.sh | 20 | ||||
-rw-r--r-- | scripts/build/cc/100-gcc.sh | 106 | ||||
-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/200-duma.sh | 6 | ||||
-rw-r--r-- | scripts/build/debug/300-gdb.sh | 66 | ||||
-rw-r--r-- | scripts/build/debug/500-strace.sh | 18 | ||||
-rw-r--r-- | scripts/build/libc/glibc.sh | 56 | ||||
-rw-r--r-- | scripts/build/libc/musl.sh | 2 | ||||
-rw-r--r-- | scripts/build/libc/newlib.sh | 99 | ||||
-rw-r--r-- | scripts/build/libc/uClibc.sh | 4 | ||||
-rw-r--r-- | scripts/crosstool-NG.sh.in | 54 | ||||
-rw-r--r-- | scripts/functions | 46 |
16 files changed, 302 insertions, 219 deletions
diff --git a/scripts/addToolVersion.sh b/scripts/addToolVersion.sh index 1976743..1ac9517 100755 --- a/scripts/addToolVersion.sh +++ b/scripts/addToolVersion.sh @@ -18,7 +18,7 @@ doHelp() { 'tool' in one of: gcc, binutils, glibc, uClibc, uClibc-ng, newlib, linux, gdb, duma, strace, ltrace, libelf, gmp, mpfr, isl, cloog, mpc, - mingw-w64, expat, ncurses + mingw-w64, expat, ncurses, musl Valid options for all tools: --stable, -s, +x (default) @@ -122,7 +122,9 @@ addToolVersion() { ver_M=$(getVersionField "${version}" . 1) ver_m=$(getVersionField "${version}" . 2) ver_p=$(getVersionField "${version}" . 3) - if [ ${ver_M} -eq 2 -a ${ver_m} -eq 26 ]; then + if [ ${ver_M} -eq 2 -a ${ver_m} -eq 27 ]; then + SedExpr1="${SedExpr1}\n select BINUTILS_2_27_or_later" + elif [ ${ver_M} -eq 2 -a ${ver_m} -eq 26 ]; then SedExpr1="${SedExpr1}\n select BINUTILS_2_26_or_later" elif [ ${ver_M} -eq 2 -a ${ver_m} -eq 25 -a ${ver_p} -eq 1 ]; then SedExpr1="${SedExpr1}\n select BINUTILS_2_25_1_or_later" @@ -149,13 +151,14 @@ addToolVersion() { ver_M=$(getVersionField "${version}" . 1) ver_m=$(getVersionField "${version}" . 2) ver_p=$(getVersionField "${version}" . 3) - if [ ${ver_M} -eq 0 -a ${ver_m} -eq 9 -a ${ver_p} -eq 33 ]; then + if [ ${ver_M} -eq 1 -a ${ver_m} -eq 0 -a ${ver_p} -eq 15 ]; then SedExpr1="${SedExpr1}\n select LIBC_UCLIBC_NG_1_0_15_or_later" fi ;; gdb) # gdb-7.0 and above have special handling ver_M=$(getVersionField "${version}" . 1) + ver_m=$(getVersionField "${version}" . 2) if [ ${ver_M} -ge 7 ]; then if [ ${ver_m} -ge 2 ]; then SedExpr1="${SedExpr1}\n select GDB_7_2_or_later" @@ -192,6 +195,7 @@ while [ $# -gt 0 ]; do --uClibc-ng)EXP=; OBS=; cat=LIBC_UCLIBC_NG; tool=uClibc; tool_prefix=libc; dot2suffix=;; --newlib) EXP=; OBS=; cat=LIBC_NEWLIB; tool=newlib; tool_prefix=libc; dot2suffix=;; --mingw-w64)EXP=; OBS=; cat=WINAPI; tool=mingw; tool_prefix=libc; dot2suffix=;; + --musl) EXP=; OBS=; cat=LIBC_MUSL; tool=musl; tool_prefix=libc; dot2suffix=;; --linux) EXP=; OBS=; cat=KERNEL; tool=linux; tool_prefix=kernel; dot2suffix=;; --gdb) EXP=; OBS=; cat=GDB; tool=gdb; tool_prefix=debug; dot2suffix=;; --duma) EXP=; OBS=; cat=DUMA; tool=duma; tool_prefix=debug; dot2suffix=;; diff --git a/scripts/build/arch/x86.sh b/scripts/build/arch/x86.sh index 2c8a226..3a7a2ce 100644 --- a/scripts/build/arch/x86.sh +++ b/scripts/build/arch/x86.sh @@ -166,7 +166,7 @@ CT_DoArchUClibcHeaderDir() { # If it is non-default multilib, add a suffix with architecture (reported by gcc) # to the headers installation path. if [ -n "${cflags}" ]; then - eval "${dir_var}="$( ${CT_TARGET}-gcc -print-multiarch ${cflags} ) + eval "${dir_var}="$( ${CT_TARGET}-${CT_CC} -print-multiarch ${cflags} ) fi } @@ -177,6 +177,6 @@ CT_DoArchMUSLHeaderDir() { # If it is non-default multilib, add a suffix with architecture (reported by gcc) # to the headers installation path. if [ -n "${cflags}" ]; then - eval "${dir_var}="$( ${CT_TARGET}-gcc -print-multiarch ${cflags} ) + eval "${dir_var}="$( ${CT_TARGET}-${CT_CC} -print-multiarch ${cflags} ) fi } diff --git a/scripts/build/binutils/binutils.sh b/scripts/build/binutils/binutils.sh index 0e285b6..17ea138 100644 --- a/scripts/build/binutils/binutils.sh +++ b/scripts/build/binutils/binutils.sh @@ -8,16 +8,16 @@ do_binutils_get() { CT_GetCustom "binutils" "${CT_BINUTILS_CUSTOM_VERSION}" \ "${CT_BINUTILS_CUSTOM_LOCATION}" else - if echo ${CT_BINUTILS_VERSION} |grep -q linaro; then - YYMM=`echo ${CT_BINUTILS_VERSION} |cut -d- -f3 |sed -e 's,^..,,'` - CT_GetFile "binutils-${CT_BINUTILS_VERSION}" \ - https://releases.linaro.org/${YYMM}/components/toolchain/binutils-linaro \ - http://cbuild.validation.linaro.org/snapshots - else - CT_GetFile "binutils-${CT_BINUTILS_VERSION}" \ - {http,ftp}://{ftp.gnu.org/gnu,ftp.kernel.org/pub/linux/devel}/binutils \ - ftp://{sourceware.org,gcc.gnu.org}/pub/binutils/{releases,snapshots} - fi + case "${CT_BINUTILS_VERSION}" in + linaro-*) + CT_GetLinaro "binutils" "${CT_BINUTILS_VERSION}" + ;; + *) + CT_GetFile "binutils-${CT_BINUTILS_VERSION}" \ + {http,ftp}://{ftp.gnu.org/gnu,ftp.kernel.org/pub/linux/devel}/binutils \ + ftp://{sourceware.org,gcc.gnu.org}/pub/binutils/{releases,snapshots} + ;; + esac fi if [ -n "${CT_ARCH_BINFMT_FLAT}" ]; then diff --git a/scripts/build/cc/100-gcc.sh b/scripts/build/cc/100-gcc.sh index 164fb9b..0bf4aed 100644 --- a/scripts/build/cc/100-gcc.sh +++ b/scripts/build/cc/100-gcc.sh @@ -11,30 +11,18 @@ do_gcc_get() { CT_GetCustom "gcc" "${CT_CC_GCC_CUSTOM_VERSION}" \ "${CT_CC_GCC_CUSTOM_LOCATION}" else - # Account for the Linaro versioning - linaro_version="$( echo "${CT_CC_GCC_VERSION}" \ - |sed -r -e 's/^linaro-//;' \ - )" - linaro_series="$( echo "${linaro_version}" \ - |sed -r -e 's/-.*//;' \ - )" - - # The official gcc hosts put gcc under a gcc/release/ directory, - # whereas the mirrors put it in the gcc/ directory. - # Also, Split out linaro mirrors, so that downloads happen faster. - if [ x"${linaro_version}" = x"${CT_CC_GCC_VERSION}" ]; then - CT_GetFile "gcc-${CT_CC_GCC_VERSION}" \ - {http,ftp,https}://ftp.gnu.org/gnu/gcc/gcc-${CT_CC_GCC_VERSION} \ - ftp://{gcc.gnu.org,sourceware.org}/pub/gcc/releases/gcc-${CT_CC_GCC_VERSION} - else - YYMM=`echo ${CT_CC_GCC_VERSION} |cut -d- -f3 |sed -e 's,^..,,'` - CT_GetFile "gcc-${CT_CC_GCC_VERSION}" \ - "https://releases.linaro.org/components/toolchain/gcc-linaro/${linaro_version}" \ - "https://releases.linaro.org/${YYMM}/components/toolchain/gcc-linaro/${linaro_series}" \ - "http://launchpad.net/gcc-linaro/${linaro_series}/${linaro_version}/+download" \ - http://cbuild.validation.linaro.org/snapshots - fi - + case "${CT_CC_GCC_VERSION}" in + linaro-*) + CT_GetLinaro "gcc" "${CT_CC_GCC_VERSION}" + ;; + *) + # The official gcc hosts put gcc under a gcc/release/ directory, + # whereas the mirrors put it in the gcc/ directory. + CT_GetFile "gcc-${CT_CC_GCC_VERSION}" \ + {http,ftp,https}://ftp.gnu.org/gnu/gcc/gcc-${CT_CC_GCC_VERSION} \ + ftp://{gcc.gnu.org,sourceware.org}/pub/gcc/releases/gcc-${CT_CC_GCC_VERSION} + ;; + esac fi # ! custom location # Starting with GCC 4.3, ecj is used for Java, and will only be # built if the configure script finds ecj.jar at the top of the @@ -180,7 +168,7 @@ cc_gcc_multilib_housekeeping() { "directly; will use build-compiler for housekeeping." # Since we cannot run the desired compiler, substitute build-CC with the assumption # that the host-CC is configured in the same way. - cc="${CT_BUILDTOOLS_PREFIX_DIR}/bin/${CT_TARGET}-gcc" + cc="${CT_BUILDTOOLS_PREFIX_DIR}/bin/${CT_TARGET}-${CT_CC}" fi # sed: prepend dashes or do nothing if default is empty string @@ -409,8 +397,12 @@ do_gcc_core_backend() { ;; esac - CT_DoLog DEBUG "Copying headers to install area of core C compiler" - CT_DoExecLog ALL cp -a "${CT_HEADERS_DIR}" "${prefix}/${CT_TARGET}/include" + # This is only needed when building libstdc++ in a canadian environment with + # this function being used for final step (i.e., when building for bare metal). + if [ "${build_step}" = "gcc_build" ]; then + CT_DoLog DEBUG "Copying headers to install area of core C compiler" + CT_DoExecLog ALL cp -a "${CT_HEADERS_DIR}" "${prefix}/${CT_TARGET}/include" + fi for tmp in ARCH ABI CPU TUNE FPU FLOAT; do eval tmp="\${CT_ARCH_WITH_${tmp}}" @@ -478,14 +470,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 +552,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") @@ -658,7 +653,7 @@ do_gcc_core_backend() { if [ "${CT_BARE_METAL},${CT_CANADIAN}" = "y,y" ]; then repair_cc="CC_FOR_BUILD=${CT_BUILD}-gcc \ CXX_FOR_BUILD=${CT_BUILD}-g++ \ - GCC_FOR_TARGET=${CT_TARGET}-gcc" + GCC_FOR_TARGET=${CT_TARGET}-${CT_CC}" else repair_cc="" fi @@ -723,16 +718,16 @@ do_gcc_core_backend() { CT_DoExecLog ALL make install-{pdf,html}-gcc fi - # Create a symlink ${CT_TARGET}-cc to ${CT_TARGET}-gcc to always be able + # Create a symlink ${CT_TARGET}-cc to ${CT_TARGET}-${CT_CC} to always be able # to call the C compiler with the same, somewhat canonical name. # check whether compiler has an extension - file="$( ls -1 "${prefix}/bin/${CT_TARGET}-gcc."* 2>/dev/null || true )" + file="$( ls -1 "${prefix}/bin/${CT_TARGET}-${CT_CC}."* 2>/dev/null || true )" [ -z "${file}" ] || ext=".${file##*.}" - if [ -f "${prefix}/bin/${CT_TARGET}-gcc${ext}" ]; then - CT_DoExecLog ALL ln -sfv "${CT_TARGET}-gcc${ext}" "${prefix}/bin/${CT_TARGET}-cc${ext}" + if [ -f "${prefix}/bin/${CT_TARGET}-${CT_CC}${ext}" ]; then + CT_DoExecLog ALL ln -sfv "${CT_TARGET}-${CT_CC}${ext}" "${prefix}/bin/${CT_TARGET}-cc${ext}" fi - cc_gcc_multilib_housekeeping cc="${prefix}/bin/${CT_TARGET}-gcc" \ + cc_gcc_multilib_housekeeping cc="${prefix}/bin/${CT_TARGET}-${CT_CC}" \ host="${host}" } @@ -985,14 +980,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 +1080,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") @@ -1162,15 +1160,15 @@ do_gcc_backend() { CT_DoExecLog ALL make install-{pdf,html}-gcc fi - # Create a symlink ${CT_TARGET}-cc to ${CT_TARGET}-gcc to always be able + # Create a symlink ${CT_TARGET}-cc to ${CT_TARGET}-${CT_CC} to always be able # to call the C compiler with the same, somewhat canonical name. # check whether compiler has an extension - file="$( ls -1 "${CT_PREFIX_DIR}/bin/${CT_TARGET}-gcc."* 2>/dev/null || true )" + file="$( ls -1 "${CT_PREFIX_DIR}/bin/${CT_TARGET}-${CT_CC}."* 2>/dev/null || true )" [ -z "${file}" ] || ext=".${file##*.}" - if [ -f "${CT_PREFIX_DIR}/bin/${CT_TARGET}-gcc${ext}" ]; then - CT_DoExecLog ALL ln -sfv "${CT_TARGET}-gcc${ext}" "${prefix}/bin/${CT_TARGET}-cc${ext}" + if [ -f "${CT_PREFIX_DIR}/bin/${CT_TARGET}-${CT_CC}${ext}" ]; then + CT_DoExecLog ALL ln -sfv "${CT_TARGET}-${CT_CC}${ext}" "${prefix}/bin/${CT_TARGET}-cc${ext}" fi - cc_gcc_multilib_housekeeping cc="${prefix}/bin/${CT_TARGET}-gcc" \ + cc_gcc_multilib_housekeeping cc="${prefix}/bin/${CT_TARGET}-${CT_CC}" \ host="${host}" } 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/200-duma.sh b/scripts/build/debug/200-duma.sh index 0e5291c..7196fcf 100644 --- a/scripts/build/debug/200-duma.sh +++ b/scripts/build/debug/200-duma.sh @@ -40,9 +40,9 @@ do_debug_duma_build() { libs="${libs# }" CT_DoLog EXTRA "Building libraries '${libs}'" CT_DoExecLog ALL \ - make HOSTCC="${CT_BUILD}-gcc" \ - CC="${CT_TARGET}-gcc" \ - CXX="${CT_TARGET}-gcc" \ + make HOSTCC="${CT_BUILD}-gcc" \ + CC="${CT_TARGET}-${CT_CC}" \ + CXX="${CT_TARGET}-g++" \ RANLIB="${CT_TARGET}-ranlib" \ DUMA_CPP="${DUMA_CPP}" \ ${libs} diff --git a/scripts/build/debug/300-gdb.sh b/scripts/build/debug/300-gdb.sh index ba13591..fe7787b 100644 --- a/scripts/build/debug/300-gdb.sh +++ b/scripts/build/debug/300-gdb.sh @@ -10,26 +10,17 @@ do_debug_gdb_get() { CT_GetCustom "gdb" "${CT_GDB_CUSTOM_VERSION}" \ "${CT_GDB_CUSTOM_LOCATION}" else - # Account for the Linaro versioning - linaro_version="$( echo "${CT_GDB_VERSION}" \ - |sed -r -e 's/^linaro-//;' \ - )" - linaro_series="$( echo "${linaro_version}" \ - |sed -r -e 's/-.*//;' \ - )" - - if [ x"${linaro_version}" = x"${CT_GDB_VERSION}" ]; then - CT_GetFile "gdb-${CT_GDB_VERSION}" \ - http://mirrors.kernel.org/sourceware/gdb \ - {http,ftp,https}://ftp.gnu.org/pub/gnu/gdb \ - ftp://{sourceware.org,gcc.gnu.org}/pub/gdb/releases - else - YYMM=`echo ${CT_GDB_VERSION} |cut -d- -f3 |sed -e 's,^..,,'` - CT_GetFile "gdb-${CT_GDB_VERSION}" \ - "http://launchpad.net/gdb-linaro/${linaro_series}/${linaro_version}/+download" \ - https://releases.linaro.org/${YYMM}/components/toolchain/gdb-linaro \ - http://cbuild.validation.linaro.org/snapshots - fi + case "${CT_GDB_VERSION}" in + linaro-*) + CT_GetLinaro "gdb" "${CT_GDB_VERSION}" + ;; + *) + CT_GetFile "gdb-${CT_GDB_VERSION}" \ + http://mirrors.kernel.org/sourceware/gdb \ + {http,ftp,https}://ftp.gnu.org/pub/gnu/gdb \ + ftp://{sourceware.org,gcc.gnu.org}/pub/gdb/releases + ;; + esac fi } @@ -99,18 +90,30 @@ do_debug_gdb_build() { cross_extra_config+=("--disable-nls") fi + CPP_for_gdb="${CT_HOST}-cpp ${CT_CFLAGS_FOR_HOST}" CC_for_gdb="${CT_HOST}-gcc ${CT_CFLAGS_FOR_HOST} ${CT_LDFLAGS_FOR_HOST}" + CXX_for_gdb="${CT_HOST}-g++ ${CT_CFLAGS_FOR_HOST} ${CT_LDFLAGS_FOR_HOST}" LD_for_gdb="${CT_HOST}-ld ${CT_LDFLAGS_FOR_HOST}" if [ "${CT_GDB_CROSS_STATIC}" = "y" ]; then CC_for_gdb+=" -static" + CXX_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" + CXX_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 # single space and then complain that $CC value changed from that in # the master directory. + CPP_for_gdb=`echo $CPP_for_gdb` CC_for_gdb=`echo $CC_for_gdb` + CXX_for_gdb=`echo $CXX_for_gdb` LD_for_gdb=`echo $LD_for_gdb` # Disable binutils options when building from the binutils-gdb repo. @@ -121,7 +124,9 @@ do_debug_gdb_build() { CT_DoLog DEBUG "Extra config passed: '${cross_extra_config[*]}'" CT_DoExecLog CFG \ + CPP="${CPP_for_gdb}" \ CC="${CC_for_gdb}" \ + CXX="${CXX_for_gdb}" \ LD="${LD_for_gdb}" \ "${gdb_src_dir}/configure" \ --build=${CT_BUILD} \ @@ -168,7 +173,6 @@ do_debug_gdb_build() { if [ "${CT_GDB_NATIVE}" = "y" ]; then local -a native_extra_config - local -a gdb_native_CFLAGS CT_DoStep INFO "Installing native gdb" @@ -211,12 +215,14 @@ do_debug_gdb_build() { [ "${CT_TOOLCHAIN_ENABLE_NLS}" != "y" ] && \ native_extra_config+=("--disable-nls") + CPP_for_gdb="${CT_TARGET}-cpp" + CC_for_gdb="${CT_TARGET}-${CT_CC}" + CXX_for_gdb="${CT_TARGET}-g++" + LD_for_gdb="${CT_TARGET}-ld" if [ "${CT_GDB_NATIVE_STATIC}" = "y" ]; then - CC_for_gdb="${CT_TARGET}-gcc -static" - LD_for_gdb="${CT_TARGET}-ld -static" - else - CC_for_gdb="${CT_TARGET}-gcc" - LD_for_gdb="${CT_TARGET}-ld" + CC_for_gdb+=" -static" + CXX_for_gdb+=" -static" + LD_for_gdb+=" -static" fi export ac_cv_func_strncmp_works=yes @@ -229,9 +235,10 @@ do_debug_gdb_build() { CT_DoLog DEBUG "Extra config passed: '${native_extra_config[*]}'" CT_DoExecLog CFG \ + CPP="${CPP_for_gdb}" \ CC="${CC_for_gdb}" \ + CXX="${CXX_for_gdb}" \ LD="${LD_for_gdb}" \ - CFLAGS="${gdb_native_CFLAGS[*]}" \ "${gdb_src_dir}/configure" \ --build=${CT_BUILD} \ --host=${CT_TARGET} \ @@ -249,7 +256,7 @@ do_debug_gdb_build() { "${native_extra_config[@]}" CT_DoLog EXTRA "Building native gdb" - CT_DoExecLog ALL make ${JOBSFLAGS} CC=${CT_TARGET}-${CT_CC} + CT_DoExecLog ALL make ${JOBSFLAGS} CT_DoLog EXTRA "Installing native gdb" CT_DoExecLog ALL make DESTDIR="${CT_DEBUGROOT_DIR}" install @@ -264,6 +271,7 @@ do_debug_gdb_build() { if [ "${CT_GDB_GDBSERVER}" = "y" ]; then local -a gdbserver_extra_config + local gdbserver_LDFLAGS CT_DoStep INFO "Installing gdbserver" CT_DoLog EXTRA "Configuring gdbserver" @@ -297,7 +305,7 @@ do_debug_gdb_build() { gdbserver_extra_config+=("--disable-gas") CT_DoExecLog CFG \ - CC="${CT_TARGET}-gcc" \ + CC="${CT_TARGET}-${CT_CC}" \ CPP="${CT_TARGET}-cpp" \ LD="${CT_TARGET}-ld" \ LDFLAGS="${gdbserver_LDFLAGS}" \ diff --git a/scripts/build/debug/500-strace.sh b/scripts/build/debug/500-strace.sh index 0d33ca0..2d8c7df 100644 --- a/scripts/build/debug/500-strace.sh +++ b/scripts/build/debug/500-strace.sh @@ -14,17 +14,17 @@ 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" + + 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 \ + CC="${CT_TARGET}-${CT_CC}" \ + 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..bce4cb8 100644 --- a/scripts/build/libc/glibc.sh +++ b/scripts/build/libc/glibc.sh @@ -11,17 +11,16 @@ do_libc_get() { CT_GetCustom "glibc" "${CT_LIBC_GLIBC_CUSTOM_VERSION}" \ "${CT_LIBC_GLIBC_CUSTOM_LOCATION}" else - if echo ${CT_LIBC_VERSION} |grep -q linaro; then - # Linaro glibc releases come from regular downloads... - YYMM=`echo ${CT_LIBC_VERSION} |cut -d- -f3 |sed -e 's,^..,,'` - CT_GetFile "glibc-${CT_LIBC_VERSION}" \ - https://releases.linaro.org/${YYMM}/components/toolchain/glibc-linaro \ - http://cbuild.validation.linaro.org/snapshots - else - CT_GetFile "glibc-${CT_LIBC_VERSION}" \ - {http,ftp,https}://ftp.gnu.org/gnu/glibc \ - ftp://{sourceware.org,gcc.gnu.org}/pub/glibc/{releases,snapshots} - fi + case "${CT_LIBC_VERSION}" in + linaro-*) + CT_GetLinaro "glibc" "${CT_LIBC_VERSION}" + ;; + *) + CT_GetFile "glibc-${CT_LIBC_VERSION}" \ + {http,ftp,https}://ftp.gnu.org/gnu/glibc \ + ftp://{sourceware.org,gcc.gnu.org}/pub/glibc/{releases,snapshots} + ;; + esac fi return 0 @@ -96,6 +95,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 @@ -252,7 +252,7 @@ do_libc_backend_once() { # but they are not passed by configure. Thus, pass everything in CC instead. CT_DoExecLog CFG \ BUILD_CC=${CT_BUILD}-gcc \ - CC="${CT_TARGET}-gcc ${glibc_cflags}" \ + CC="${CT_TARGET}-${CT_CC} ${glibc_cflags}" \ AR=${CT_TARGET}-ar \ RANLIB=${CT_TARGET}-ranlib \ "${CONFIG_SHELL}" \ @@ -277,23 +277,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" @@ -364,11 +362,11 @@ do_libc_backend_once() { # However, since we will never actually execute its code, # it doesn't matter what it contains. So, treating '/dev/null' # as a C source file, we produce a dummy 'libc.so' in one step - CT_DoExecLog ALL "${CT_TARGET}-gcc" ${multi_flags} \ - -nostdlib \ - -nostartfiles \ - -shared \ - -x c /dev/null \ + CT_DoExecLog ALL "${CT_TARGET}-${CT_CC}" ${multi_flags} \ + -nostdlib \ + -nostartfiles \ + -shared \ + -x c /dev/null \ -o "${startfiles_dir}/libc.so" fi # threads == nptl fi # libc_mode = startfiles diff --git a/scripts/build/libc/musl.sh b/scripts/build/libc/musl.sh index acd14c2..3eb0357 100644 --- a/scripts/build/libc/musl.sh +++ b/scripts/build/libc/musl.sh @@ -126,7 +126,7 @@ do_libc_backend_once() { obj/crt/crt1.o obj/crt/crti.o obj/crt/crtn.o CT_DoLog EXTRA "Installing C library start files" CT_DoExecLog ALL cp -av obj/crt/crt*.o "${multi_root}${multilib_dir}" - CT_DoExecLog ALL ${CT_TARGET}-gcc -nostdlib \ + CT_DoExecLog ALL ${CT_TARGET}-${CT_CC} -nostdlib \ -nostartfiles -shared -x c /dev/null -o "${multi_root}${multilib_dir}/libc.so" fi if [ "${libc_mode}" = "final" ]; then diff --git a/scripts/build/libc/newlib.sh b/scripts/build/libc/newlib.sh index 6ae579b..0c0c2aa 100644 --- a/scripts/build/libc/newlib.sh +++ b/scripts/build/libc/newlib.sh @@ -5,10 +5,6 @@ # Edited by Martin Lund <mgl@doredevelopment.dk> # -LIBC_NEWLIB_AVR_HDRS_URI="http://www.atmel.com/Images" -LIBC_NEWLIB_AVR_HDRS_BASE="avr-headers-3.2.3.970" -LIBC_NEWLIB_AVR_HDRS_EXT=".zip" - do_libc_get() { local libc_src="{http://mirrors.kernel.org/sourceware/newlib, ftp://sourceware.org/pub/newlib}" @@ -17,15 +13,18 @@ do_libc_get() { CT_GetCustom "newlib" "${CT_LIBC_NEWLIB_CUSTOM_VERSION}" \ "${CT_LIBC_NEWLIB_CUSTOM_LOCATION}" else # ! custom location - if echo ${CT_LIBC_VERSION} |grep -q linaro; then - YYMM=`echo ${CT_LIBC_VERSION} |cut -d- -f3 |sed -e 's,^..,,'` - CT_GetFile "newlib-${CT_LIBC_VERSION}" ${libc_src} \ - https://releases.linaro.org/${YYMM}/components/toolchain/newlib-linaro \ - http://cbuild.validation.linaro.org/snapshots - else - CT_GetFile "newlib-${CT_LIBC_VERSION}" ${libc_src} \ - http://mirrors.kernel.org/sources.redhat.com/newlib - fi + case "${CT_LIBC_VERSION}" in + linaro-*) + CT_GetLinaro "newlib" "${CT_LIBC_VERSION}" + ;; + *) + # kernel.org mirror is outdated, keep last as a fallback + CT_GetFile "newlib-${CT_LIBC_VERSION}" \ + ftp://sourceware.org/pub/newlib \ + http://mirrors.kernel.org/sourceware/newlib \ + http://mirrors.kernel.org/sources.redhat.com/newlib + ;; + esac fi # ! custom location } @@ -66,16 +65,6 @@ do_libc() { extra_config+=("--disable-multilib") fi - if [ "${CT_LIBC_NEWLIB_IO_C99FMT}" = "y" ]; then - newlib_opts+=( "--enable-newlib-io-c99-formats" ) - else - newlib_opts+=( "--disable-newlib-io-c99-formats" ) - fi - if [ "${CT_LIBC_NEWLIB_IO_LL}" = "y" ]; then - newlib_opts+=( "--enable-newlib-io-long-long" ) - else - newlib_opts+=( "--disable-newlib-io-long-long" ) - fi if [ "${CT_LIBC_NEWLIB_IO_FLOAT}" = "y" ]; then newlib_opts+=( "--enable-newlib-io-float" ) if [ "${CT_LIBC_NEWLIB_IO_LDBL}" = "y" ]; then @@ -87,19 +76,47 @@ do_libc() { newlib_opts+=( "--disable-newlib-io-float" ) newlib_opts+=( "--disable-newlib-io-long-double" ) fi + if [ "${CT_LIBC_NEWLIB_DISABLE_SUPPLIED_SYSCALLS}" = "y" ]; then newlib_opts+=( "--disable-newlib-supplied-syscalls" ) else newlib_opts+=( "--enable-newlib-supplied-syscalls" ) fi - if [ "${CT_LIBC_NEWLIB_NANO_MALLOC}" = "y" ]; then - newlib_opts+=( "--enable-newlib-nano-malloc" ) - fi - if [ "${CT_LIBC_NEWLIB_NANO_FORMATTED_IO}" = "y" ]; then - newlib_opts+=( "--enable-newlib-nano-formatted-io" ) - fi - [ "${CT_LIBC_NEWLIB_ENABLE_TARGET_OPTSPACE}" = "y" ] && newlib_opts+=("--enable-target-optspace") + yn_args="IO_POS_ARGS:newlib-io-pos-args +IO_C99FMT:newlib-io-c99-formats +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 +GLOBAL_ATEXIT:newlib-global-atexit +LITE_EXIT:lite-exit +REENT_SMALL:reent-small +MULTITHREAD:multithread +WIDE_ORIENT:newlib-wide-orient +UNBUF_STREAM_OPT:unbuf-stream-opt +ENABLE_TARGET_OPTSPACE:target-optspace + " + + for ynarg in $yn_args; do + var="CT_LIBC_NEWLIB_${ynarg%:*}" + eval var=\$${var} + argument=${ynarg#*:} + + + if [ "${var}" = "y" ]; then + newlib_opts+=( "--enable-$argument" ) + else + newlib_opts+=( "--disable-$argument" ) + fi + done + + [ "${CT_LIBC_NEWLIB_EXTRA_SECTIONS}" = "y" ] && \ + CT_LIBC_NEWLIB_TARGET_CFLAGS="${CT_LIBC_NEWLIB_TARGET_CFLAGS} -ffunction-sections -fdata-sections" + + [ "${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}" @@ -108,23 +125,23 @@ do_libc() { # build : not used # host : the machine building newlib # target : the machine newlib runs on - CT_DoExecLog CFG \ - CC_FOR_BUILD="${CT_BUILD}-gcc" \ - CFLAGS_FOR_TARGET="${cflags_for_target}" \ - AR=${CT_TARGET}-ar \ - RANLIB=${CT_TARGET}-ranlib \ - "${CT_SRC_DIR}/newlib-${CT_LIBC_VERSION}/configure" \ - --host=${CT_BUILD} \ - --target=${CT_TARGET} \ - --prefix=${CT_PREFIX_DIR} \ - "${newlib_opts[@]}" \ + CT_DoExecLog CFG \ + CC_FOR_BUILD="${CT_BUILD}-gcc" \ + CFLAGS_FOR_TARGET="${cflags_for_target}" \ + AR_FOR_TARGET="`which ${CT_TARGET}-gcc-ar`" \ + RANLIB_FOR_TARGET="`which ${CT_TARGET}-gcc-ranlib`" \ + "${CT_SRC_DIR}/newlib-${CT_LIBC_VERSION}/configure" \ + --host=${CT_BUILD} \ + --target=${CT_TARGET} \ + --prefix=${CT_PREFIX_DIR} \ + "${newlib_opts[@]}" \ "${CT_LIBC_NEWLIB_EXTRA_CONFIG_ARRAY[@]}" CT_DoLog EXTRA "Building C library" CT_DoExecLog ALL make ${JOBSFLAGS} CT_DoLog EXTRA "Installing C library" - CT_DoExecLog ALL make install install_root="${CT_SYSROOT_DIR}" + CT_DoExecLog ALL make install if [ "${CT_BUILD_MANUALS}" = "y" ]; then local -a doc_dir="${CT_BUILD_DIR}/build-libc/${CT_TARGET}" diff --git a/scripts/build/libc/uClibc.sh b/scripts/build/libc/uClibc.sh index 96d4b51..d86ae1a 100644 --- a/scripts/build/libc/uClibc.sh +++ b/scripts/build/libc/uClibc.sh @@ -197,7 +197,7 @@ do_libc_backend_once() { # libm.so is needed for ppc, as libgcc is linked against libm.so # No problem to create it for other archs. CT_DoLog EXTRA "Building dummy shared libs" - CT_DoExecLog ALL "${CT_TARGET}-gcc" -nostdlib -nostartfiles \ + CT_DoExecLog ALL "${CT_TARGET}-${CT_CC}" -nostdlib -nostartfiles \ -shared ${multi_flags} -x c /dev/null -o libdummy.so CT_DoLog EXTRA "Installing start files" @@ -470,7 +470,7 @@ do_libc_ldso_fixup() { multilib_dir="/lib/${multi_os_dir}" CT_SanitizeVarDir multilib_dir - CT_DoExecLog ALL "${CT_TARGET}-gcc" -o test-ldso ../test-ldso.c ${multi_flags} + CT_DoExecLog ALL "${CT_TARGET}-${CT_CC}" -o test-ldso ../test-ldso.c ${multi_flags} if [ -r "test-ldso.gdb" ]; then binary="test-ldso.gdb" else diff --git a/scripts/crosstool-NG.sh.in b/scripts/crosstool-NG.sh.in index bbefb1f..ba36bc8 100644 --- a/scripts/crosstool-NG.sh.in +++ b/scripts/crosstool-NG.sh.in @@ -469,30 +469,68 @@ 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 # 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}" + 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}'" + # 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" + 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}'" diff --git a/scripts/functions b/scripts/functions index f687504..cbef48b 100644 --- a/scripts/functions +++ b/scripts/functions @@ -798,6 +798,40 @@ CT_GetFile() { return 1 } +# Get a component from Linaro archives. +# Usage: CT_GetLinaro <component> <version> +CT_GetLinaro() { + local comp="$1" + local version="$2" + local linaro_version + local yyyymm_p + local yymm + local base + + case "${version}" in + linaro-*) + linaro_version="${version#linaro-}" + ;; + *) + CT_Abort "Version ${version} is not a Linaro package" + ;; + esac + + # Recent releases reside in top of the directory tree; older releases + # are moved into the archive. Subdirectories are named differently + # in archive! + # In archive, some URLs also contain base component version + # (e.g. "gcc-linaro/4.9") while some do not (e.g. just "newlib-linaro"). + base="${linaro_version%%-*}" + # Strip base version, first two digits of the year and optional patchlevel + yymm="${linaro_version#*-??}" + yymm="${yymm%-*}" + CT_GetFile "${comp}-${version}" \ + "https://releases.linaro.org/components/toolchain/${comp}-linaro/${linaro_version}" \ + "https://releases.linaro.org/archive/${yymm}/components/toolchain/${comp}-linaro/${base}" \ + "https://releases.linaro.org/archive/${yymm}/components/toolchain/${comp}-linaro" +} + # Checkout from CVS, and build the associated tarball # The tarball will be called ${basename}.tar.bz2 # Prerequisite: either the server does not require password, @@ -1587,7 +1621,7 @@ CT_IterateMultilibs() { # If gcc is not configured for multilib, it still prints a single line # for the default settings - multilibs=( $("${CT_TARGET}-gcc" -print-multi-lib 2>/dev/null) ) + multilibs=( $("${CT_TARGET}-${CT_CC}" -print-multi-lib 2>/dev/null) ) CT_DoExecLog ALL rm -rf "sysroot-check" for multilib in "${multilibs[@]}"; do # GCC makes the distinction between: @@ -1623,8 +1657,8 @@ CT_IterateMultilibs() { # multi_os_dir_gcc. multi_flags=$( echo "${multilib#*;}" | sed -r -e 's/@/ -/g;' ) multi_dir="${multilib%%;*}" - multi_os_dir=$( "${CT_TARGET}-gcc" -print-multi-os-directory ${multi_flags} ) - multi_root=$( "${CT_TARGET}-gcc" -print-sysroot ${multi_flags} ) + multi_os_dir=$( "${CT_TARGET}-${CT_CC}" -print-multi-os-directory ${multi_flags} ) + multi_root=$( "${CT_TARGET}-${CT_CC}" -print-sysroot ${multi_flags} ) root_suffix="${multi_root#${CT_SYSROOT_DIR}}" CT_DoExecLog ALL mkdir -p "sysroot-check${root_suffix}" if [ -e "sysroot-check${root_suffix}/seen" ]; then @@ -1643,10 +1677,10 @@ CT_IterateMultilibs() { for multilib in "${multilibs[@]}"; do multi_flags=$( echo "${multilib#*;}" | sed -r -e 's/@/ -/g;' ) multi_dir="${multilib%%;*}" - multi_os_dir=$( "${CT_TARGET}-gcc" -print-multi-os-directory ${multi_flags} ) + multi_os_dir=$( "${CT_TARGET}-${CT_CC}" -print-multi-os-directory ${multi_flags} ) multi_os_dir_gcc="${multi_os_dir}" - multi_root=$( "${CT_TARGET}-gcc" -print-sysroot ${multi_flags} ) - multi_target=$( "${CT_TARGET}-gcc" -print-multiarch ${multi_flags} ) + multi_root=$( "${CT_TARGET}-${CT_CC}" -print-sysroot ${multi_flags} ) + multi_target=$( "${CT_TARGET}-${CT_CC}" -print-multiarch ${multi_flags} ) root_suffix="${multi_root#${CT_SYSROOT_DIR}}" # If GCC did not report the target tuple (i.e. this configuration is not |