diff options
Diffstat (limited to 'scripts/build')
38 files changed, 229 insertions, 719 deletions
diff --git a/scripts/build/arch/sparc.sh b/scripts/build/arch/sparc.sh index b5f8140..7433c4d 100644 --- a/scripts/build/arch/sparc.sh +++ b/scripts/build/arch/sparc.sh @@ -60,7 +60,7 @@ CT_DoArchGlibcAdjustTuple() { # earlier (corresponding pthread barrier code is missing). Until this # support is reintroduced, configure as sparcv9. sparc-*) - if [ "${CT_LIBC_GLIBC_2_23_or_later}" = y ]; then + if [ "${CT_GLIBC_NO_SPARC_V8}" = y ]; then CT_DoLog WARN "GLIBC 2.23 and newer only support SPARCv9" target_=${target_/#sparc-/sparcv9-} fi diff --git a/scripts/build/arch/xtensa.sh b/scripts/build/arch/xtensa.sh index bf94ddf..744bbb2 100644 --- a/scripts/build/arch/xtensa.sh +++ b/scripts/build/arch/xtensa.sh @@ -12,67 +12,6 @@ CT_DoArchTupleValues() { esac } -# This function updates the specified component (binutils, gcc, gdb, etc.) -# with the processor specific configuration. -CT_ConfigureXtensa() { - local component="${1}" - local version="${2}" - local custom_overlay="xtensa_${CT_ARCH_XTENSA_CUSTOM_NAME}.tar" - local custom_location="${CT_ARCH_XTENSA_CUSTOM_OVERLAY_LOCATION}" - - if [ -z "${CT_ARCH_XTENSA_CUSTOM_NAME}" ]; then - custom_overlay="xtensa-overlay.tar" - fi - - CT_TestAndAbort "${custom_overlay}: CT_ARCH_XTENSA_CUSTOM_OVERLAY_LOCATION must be set." -z "${custom_location}" - - local full_file="${custom_location}/${custom_overlay}" - local basename="${component}-${version}" - local ext - - ext=${full_file/*./.} - - if [ -z "${ext}" ] ; then - CT_DoLog WARN "'${full_file}' not found" - return 1 - fi - - if [ -e "${CT_SRC_DIR}/.${basename}.configuring" ]; then - CT_DoLog ERROR "The '${basename}' source were partially configured." - CT_DoLog ERROR "Please remove first:" - CT_DoLog ERROR " - the source dir for '${basename}', in '${CT_SRC_DIR}'" - CT_DoLog ERROR " - the file '${CT_SRC_DIR}/.${basename}.extracted'" - CT_DoLog ERROR " - the file '${CT_SRC_DIR}/.${basename}.patch'" - CT_DoLog ERROR " - the file '${CT_SRC_DIR}/.${basename}.configuring'" - CT_Abort - fi - - CT_DoLog EXTRA "Using '${custom_overlay}' from ${custom_location}" - CT_DoExecLog DEBUG ln -sf "${custom_location}/${custom_overlay}" \ - "${CT_TARBALLS_DIR}/${custom_overlay}" - - CT_DoExecLog DEBUG touch "${CT_SRC_DIR}/.${basename}.configuring" - - CT_Pushd "${CT_SRC_DIR}/${basename}" - - tar_opts=( "--strip-components=1" ) - tar_opts+=( "-xv" ) - - case "${ext}" in - .tar) CT_DoExecLog FILE tar "${tar_opts[@]}" -f "${full_file}" "${component}";; - .gz|.tgz) gzip -dc "${full_file}" | CT_DoExecLog FILE tar "${tar_opts[@]}" -f - "${component}";; - .bz2) bzip2 -dc "${full_file}" | CT_DoExecLog FILE tar "${tar_opts[@]}" -f - "${component}";; - *) CT_DoLog WARN "Don't know how to handle '${basename}${ext}': unknown extension" - return 1 - ;; - esac - - CT_DoExecLog DEBUG touch "${CT_SRC_DIR}/.${basename}.configured" - CT_DoExecLog DEBUG rm -f "${CT_SRC_DIR}/.${basename}.configuring" - - CT_Popd -} - CT_DoArchUClibcConfig() { local cfg="${1}" diff --git a/scripts/build/binutils/binutils.sh b/scripts/build/binutils/binutils.sh index f378b4f..8fb51b8 100644 --- a/scripts/build/binutils/binutils.sh +++ b/scripts/build/binutils/binutils.sh @@ -4,44 +4,17 @@ # Download binutils do_binutils_get() { - if [ "${CT_BINUTILS_CUSTOM}" = "y" ]; then - CT_GetCustom "binutils" "${CT_BINUTILS_CUSTOM_VERSION}" \ - "${CT_BINUTILS_CUSTOM_LOCATION}" - else - 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 - + CT_Fetch BINUTILS if [ -n "${CT_ARCH_BINFMT_FLAT}" ]; then - if [ "${CT_ELF2FLT_CUSTOM}" = "y" ]; then - CT_GetCustom "elf2flt" "${CT_ELF2FLT_CUSTOM_VERSION}" \ - "${CT_ELF2FLT_CUSTOM_LOCATION}" - else - CT_GetGit elf2flt "${CT_ELF2FLT_GIT_CSET}" https://github.com/uclinux-dev/elf2flt.git - fi + CT_Fetch ELF2FLT fi } # Extract binutils do_binutils_extract() { - CT_Extract "binutils-${CT_BINUTILS_VERSION}" - CT_Patch "binutils" "${CT_BINUTILS_VERSION}" - + CT_ExtractPatch BINUTILS if [ -n "${CT_ARCH_BINFMT_FLAT}" ]; then - CT_Extract "elf2flt-${CT_ELF2FLT_GIT_CSET}" - CT_Patch "elf2flt" "${CT_ELF2FLT_GIT_CSET}" - fi - - if [ -n "${CT_ARCH_XTENSA_CUSTOM_NAME}" ]; then - CT_ConfigureXtensa "binutils" "${CT_BINUTILS_VERSION}" + CT_ExtractPatch ELF2FLT fi } @@ -67,7 +40,7 @@ do_binutils_for_build() { if [ -n "${CT_ARCH_BINFMT_FLAT}" ]; then # We re-use binutils' options, plus our owns - binutils_opts+=( "binutils_src=${CT_SRC_DIR}/binutils-${CT_BINUTILS_VERSION}" ) + binutils_opts+=( "binutils_src=${CT_SRC_DIR}/binutils" ) binutils_opts+=( "binutils_bld=${CT_BUILD_DIR}/build-binutils-build-${CT_BUILD}" ) CT_mkdir_pushd "${CT_BUILD_DIR}/build-elf2flt-build-${CT_BUILD}" @@ -100,7 +73,7 @@ do_binutils_for_host() { if [ -n "${CT_ARCH_BINFMT_FLAT}" ]; then # We re-use binutils' options, plus our owns - binutils_opts+=( "binutils_src=${CT_SRC_DIR}/binutils-${CT_BINUTILS_VERSION}" ) + binutils_opts+=( "binutils_src=${CT_SRC_DIR}/binutils" ) binutils_opts+=( "binutils_bld=${CT_BUILD_DIR}/build-binutils-host-${CT_HOST}" ) CT_mkdir_pushd "${CT_BUILD_DIR}/build-elf2flt-host-${CT_HOST}" @@ -207,7 +180,7 @@ do_binutils_backend() { CXXFLAGS="${cflags}" \ LDFLAGS="${ldflags}" \ ${CONFIG_SHELL} \ - "${CT_SRC_DIR}/binutils-${CT_BINUTILS_VERSION}/configure" \ + "${CT_SRC_DIR}/binutils/configure" \ --build=${CT_BUILD} \ --host=${host} \ --target=${CT_TARGET} \ @@ -291,7 +264,7 @@ do_elf2flt_backend() { CFLAGS="${cflags}" \ LDFLAGS="${ldflags}" \ ${CONFIG_SHELL} \ - "${CT_SRC_DIR}/elf2flt-${CT_ELF2FLT_VERSION}/configure" \ + "${CT_SRC_DIR}/elf2flt/configure" \ --build=${CT_BUILD} \ --host=${host} \ --target=${CT_TARGET} \ @@ -351,7 +324,7 @@ do_binutils_for_target() { CT_DoExecLog CFG \ ${CONFIG_SHELL} \ - "${CT_SRC_DIR}/binutils-${CT_BINUTILS_VERSION}/configure" \ + "${CT_SRC_DIR}/binutils/configure" \ --build=${CT_BUILD} \ --host=${CT_TARGET} \ --target=${CT_TARGET} \ diff --git a/scripts/build/cc.sh b/scripts/build/cc.sh deleted file mode 100644 index 0db6b9c..0000000 --- a/scripts/build/cc.sh +++ /dev/null @@ -1,58 +0,0 @@ -# Wrapper to build the companion tools facilities - -# List all companion tools facilities, and parse their scripts -CT_CC_FACILITY_LIST= -for f in "${CT_LIB_DIR}/scripts/build/cc/"*.sh; do - _f="$(basename "${f}" .sh)" - _f="${_f#???-}" - __f="CT_CC_${_f}" - if [ "${!__f}" = "y" ]; then - CT_DoLog DEBUG "Enabling cc '${_f}'" - . "${f}" - CT_CC_FACILITY_LIST="${CT_CC_FACILITY_LIST} ${_f}" - else - CT_DoLog DEBUG "Disabling cc '${_f}'" - fi -done - -# Download the cc facilities -do_cc_get() { - for f in ${CT_CC_FACILITY_LIST}; do - do_${f}_get - done -} - -# Extract and patch the cc facilities -do_cc_extract() { - for f in ${CT_CC_FACILITY_LIST}; do - do_${f}_extract - done -} - -# Core pass 1 the cc facilities -do_cc_core_pass_1() { - for f in ${CT_CC_FACILITY_LIST}; do - do_${f}_core_pass_1 - done -} - -# Core pass 2 the cc facilities -do_cc_core_pass_2() { - for f in ${CT_CC_FACILITY_LIST}; do - do_${f}_core_pass_2 - done -} - -# Build for build the cc facilities -do_cc_for_build() { - for f in ${CT_CC_FACILITY_LIST}; do - do_${f}_for_build - done -} - -# Build for host the cc facilities -do_cc_for_host() { - for f in ${CT_CC_FACILITY_LIST}; do - do_${f}_for_host - done -} diff --git a/scripts/build/cc/100-gcc.sh b/scripts/build/cc/gcc.sh index 2ca8e6f..6019b35 100644 --- a/scripts/build/cc/100-gcc.sh +++ b/scripts/build/cc/gcc.sh @@ -3,53 +3,32 @@ # Licensed under the GPL v2. See COPYING in the root of this package # Download gcc -do_gcc_get() { +do_cc_get() { local linaro_version="" local linaro_series="" - if [ "${CT_CC_GCC_CUSTOM}" = "y" ]; then - CT_GetCustom "gcc" "${CT_CC_GCC_CUSTOM_VERSION}" \ - "${CT_CC_GCC_CUSTOM_LOCATION}" - else - 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 + CT_Fetch GCC + # 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 # GCC source tree, which will not be there unless we get it and # put it there ourselves if [ "${CT_CC_LANG_JAVA_USE_ECJ}" = "y" ]; then - CT_GetFile ecj-latest .jar http://mirrors.kernel.org/sourceware/java/ \ - http://crosstool-ng.org/pub/java \ - ftp://gcc.gnu.org/pub/java \ - ftp://sourceware.org/pub/java + if ! CT_GetFile ecj-latest .jar $(CT_Mirrors sourceware java); then + # Should be a package, too - but with Java retirement in GCC, + # it may not make sense. + CT_Abort "Failed to download ecj-latest.jar" + fi fi } # Extract gcc -do_gcc_extract() { - CT_Extract "gcc-${CT_CC_GCC_VERSION}" - CT_Patch "gcc" "${CT_CC_GCC_VERSION}" +do_cc_extract() { + CT_ExtractPatch GCC # Copy ecj-latest.jar to ecj.jar at the top of the GCC source tree - if [ "${CT_CC_LANG_JAVA_USE_ECJ}" = "y" \ - -a ! -f "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/ecj.jar" \ - ]; then - CT_DoExecLog ALL cp -v "${CT_TARBALLS_DIR}/ecj-latest.jar" "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/ecj.jar" - fi - - if [ -n "${CT_ARCH_XTENSA_CUSTOM_NAME}" ]; then - CT_ConfigureXtensa "gcc" "${CT_CC_GCC_VERSION}" + if [ "${CT_CC_LANG_JAVA_USE_ECJ}" = "y" -a ! -f "${CT_SRC_DIR}/gcc/ecj.jar" ]; then + CT_DoExecLog ALL cp -v "${CT_TARBALLS_DIR}/ecj-latest.jar" "${CT_SRC_DIR}/gcc/ecj.jar" fi } @@ -205,7 +184,7 @@ cc_gcc_multilib_housekeeping() { #------------------------------------------------------------------------------ # Core gcc pass 1 -do_gcc_core_pass_1() { +do_cc_core_pass_1() { local -a core_opts if [ "${CT_CC_CORE_PASS_1_NEEDED}" != "y" ]; then @@ -231,7 +210,7 @@ do_gcc_core_pass_1() { } # Core gcc pass 2 -do_gcc_core_pass_2() { +do_cc_core_pass_2() { local -a core_opts if [ "${CT_CC_CORE_PASS_2_NEEDED}" != "y" ]; then @@ -575,7 +554,7 @@ do_gcc_core_backend() { CXXFLAGS_FOR_TARGET="${CT_TARGET_CFLAGS}" \ LDFLAGS_FOR_TARGET="${CT_TARGET_LDFLAGS}" \ ${CONFIG_SHELL} \ - "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/configure" \ + "${CT_SRC_DIR}/gcc/configure" \ --build=${CT_BUILD} \ --host=${host} \ --target=${CT_TARGET} \ @@ -603,7 +582,7 @@ do_gcc_core_backend() { # so we configure then build it. # Next we have to configure gcc, create libgcc.mk then edit it... # So much easier if we just edit the source tree, but hey... - if [ ! -f "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/gcc/BASE-VER" ]; then + if [ ! -f "${CT_SRC_DIR}/gcc/gcc/BASE-VER" ]; then CT_DoExecLog CFG make ${JOBSFLAGS} configure-libiberty CT_DoExecLog ALL make ${JOBSFLAGS} -C libiberty libiberty.a CT_DoExecLog CFG make ${JOBSFLAGS} configure-gcc configure-libcpp @@ -613,12 +592,12 @@ do_gcc_core_backend() { CT_DoExecLog ALL make ${JOBSFLAGS} all-libcpp all-build-libiberty fi # HACK: gcc-4.2 uses libdecnumber to build libgcc.mk, so build it here. - if [ -d "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/libdecnumber" ]; then + if [ -d "${CT_SRC_DIR}/gcc/libdecnumber" ]; then CT_DoExecLog CFG make ${JOBSFLAGS} configure-libdecnumber CT_DoExecLog ALL make ${JOBSFLAGS} -C libdecnumber libdecnumber.a fi # HACK: gcc-4.8 uses libbacktrace to make libgcc.mvars, so make it here. - if [ -d "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/libbacktrace" ]; then + if [ -d "${CT_SRC_DIR}/gcc/libbacktrace" ]; then CT_DoExecLog CFG make ${JOBSFLAGS} configure-libbacktrace CT_DoExecLog ALL make ${JOBSFLAGS} -C libbacktrace fi @@ -711,7 +690,7 @@ do_gcc_core_backend() { #------------------------------------------------------------------------------ # Build complete gcc to run on build -do_gcc_for_build() { +do_cc_for_build() { local -a build_final_opts local build_final_backend @@ -796,7 +775,7 @@ gcc_movelibs() { #------------------------------------------------------------------------------ # Build final gcc to run on host -do_gcc_for_host() { +do_cc_for_host() { local -a final_opts local final_backend @@ -1121,7 +1100,7 @@ do_gcc_backend() { CXXFLAGS_FOR_TARGET="${CT_TARGET_CFLAGS}" \ LDFLAGS_FOR_TARGET="${CT_TARGET_LDFLAGS}" \ ${CONFIG_SHELL} \ - "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/configure" \ + "${CT_SRC_DIR}/gcc/configure" \ --build=${CT_BUILD} \ --host=${host} \ --target=${CT_TARGET} \ diff --git a/scripts/build/companion_libs/050-zlib.sh b/scripts/build/companion_libs/050-zlib.sh index a3ba638..868bf3d 100644 --- a/scripts/build/companion_libs/050-zlib.sh +++ b/scripts/build/companion_libs/050-zlib.sh @@ -13,14 +13,12 @@ if [ "${CT_ZLIB}" = "y" ]; then # Download zlib do_zlib_get() { - CT_GetFile "zlib-${CT_ZLIB_VERSION}" \ - "http://downloads.sourceforge.net/project/libpng/zlib/${CT_ZLIB_VERSION}" + CT_Fetch ZLIB } # Extract zlib do_zlib_extract() { - CT_Extract "zlib-${CT_ZLIB_VERSION}" - CT_Patch "zlib" "${CT_ZLIB_VERSION}" + CT_ExtractPatch ZLIB } # Build zlib for running on build @@ -87,7 +85,7 @@ do_zlib_backend() { # zlib treats mingw host differently and requires using a different # makefile rather than configure+make. It also does not support # out-of-tree building. - cp -av "${CT_SRC_DIR}/zlib-${CT_ZLIB_VERSION}/." . + cp -av "${CT_SRC_DIR}/zlib/." . extra_make=( -f win32/Makefile.gcc \ PREFIX="${host}-" \ SHAREDLIB= \ @@ -107,7 +105,7 @@ do_zlib_backend() { LDFLAGS="${ldflags}" \ CHOST="${host}" \ ${CONFIG_SHELL} \ - "${CT_SRC_DIR}/zlib-${CT_ZLIB_VERSION}/configure" \ + "${CT_SRC_DIR}/zlib/configure" \ --prefix="${prefix}" \ --static \ "${extra_config[@]}" diff --git a/scripts/build/companion_libs/100-gmp.sh b/scripts/build/companion_libs/100-gmp.sh index e6a4875..272af66 100644 --- a/scripts/build/companion_libs/100-gmp.sh +++ b/scripts/build/companion_libs/100-gmp.sh @@ -13,15 +13,12 @@ if [ "${CT_GMP}" = "y" ]; then # Download GMP do_gmp_get() { - CT_GetFile "gmp-${CT_GMP_VERSION}" \ - https://gmplib.org/download/gmp \ - {http,ftp,https}://ftp.gnu.org/gnu/gmp + CT_Fetch GMP } # Extract GMP do_gmp_extract() { - CT_Extract "gmp-${CT_GMP_VERSION}" - CT_Patch "gmp" "${CT_GMP_VERSION}" + CT_ExtractPatch GMP } # Build GMP for running on build @@ -84,7 +81,9 @@ do_gmp_backend() { CT_DoLog EXTRA "Configuring GMP" - if [ ! "${CT_GMP_5_0_2_or_later}" = "y" ]; then + # FIXME is it needed even for older versions? They seem to compile fine + # without it. + if [ "${CT_GMP_HAS_MPBSD}" = "y" ]; then extra_config+=("--enable-mpbsd") fi @@ -95,7 +94,7 @@ do_gmp_backend() { CFLAGS="${cflags} -fexceptions" \ LDFLAGS="${ldflags}" \ ${CONFIG_SHELL} \ - "${CT_SRC_DIR}/gmp-${CT_GMP_VERSION}/configure" \ + "${CT_SRC_DIR}/gmp/configure" \ --build=${CT_BUILD} \ --host=${host} \ --prefix="${prefix}" \ diff --git a/scripts/build/companion_libs/110-mpfr.sh b/scripts/build/companion_libs/110-mpfr.sh index 5a89077..b4be3f4 100644 --- a/scripts/build/companion_libs/110-mpfr.sh +++ b/scripts/build/companion_libs/110-mpfr.sh @@ -13,16 +13,14 @@ if [ "${CT_MPFR}" = "y" ]; then # Download MPFR do_mpfr_get() { - CT_GetFile "mpfr-${CT_MPFR_VERSION}" \ - {https,http,ftp}://ftp.gnu.org/gnu/mpfr \ - http://www.mpfr.org/mpfr-${CT_MPFR_VERSION} + CT_Fetch MPFR } # Extract MPFR do_mpfr_extract() { - CT_Extract "mpfr-${CT_MPFR_VERSION}" - CT_Patch "mpfr" "${CT_MPFR_VERSION}" + CT_ExtractPatch MPFR + # TBD is it a problem with 2.4.x? The comment says it is not, yet the code is run # OK, Gentoo have a sanity check that libtool.m4 and ltmain.sh have the # same version number. Unfortunately, some tarballs of MPFR are not # built sanely, and thus ./configure fails on Gentoo. @@ -115,7 +113,7 @@ do_mpfr_backend() { CFLAGS="${cflags}" \ LDFLAGS="${ldflags}" \ ${CONFIG_SHELL} \ - "${CT_SRC_DIR}/mpfr-${CT_MPFR_VERSION}/configure" \ + "${CT_SRC_DIR}/mpfr/configure" \ --build=${CT_BUILD} \ --host=${host} \ --prefix="${prefix}" \ diff --git a/scripts/build/companion_libs/121-isl.sh b/scripts/build/companion_libs/121-isl.sh index ef93bbd..d96e9ce 100644 --- a/scripts/build/companion_libs/121-isl.sh +++ b/scripts/build/companion_libs/121-isl.sh @@ -13,14 +13,12 @@ if [ "${CT_ISL}" = "y" ]; then # Download ISL do_isl_get() { - CT_GetFile "isl-${CT_ISL_VERSION}" \ - http://isl.gforge.inria.fr + CT_Fetch ISL } # Extract ISL do_isl_extract() { - CT_Extract "isl-${CT_ISL_VERSION}" - CT_Patch "isl" "${CT_ISL_VERSION}" + CT_ExtractPatch ISL } # Build ISL for running on build @@ -86,12 +84,12 @@ do_isl_backend() { CT_DoLog EXTRA "Configuring ISL" - if [ "${CT_ISL_V_0_12_or_later}" != "y" ]; then + if [ "${CT_ISL_NEEDS_WITH_GMP}" != "y" ]; then extra_config+=("--with-libgmp-prefix=${prefix}") extra_config+=("--with-libgmpxx-prefix=${prefix}") fi - if [ "${CT_ISL_V_0_14_or_later}" != "y" ]; then + if [ "${CT_ISL_HAS_WITH_PIPLIB}" != "y" ]; then extra_config+=("--with-piplib=no") fi @@ -100,7 +98,7 @@ do_isl_backend() { CXXFLAGS="${cxxflags}" \ LDFLAGS="${ldflags}" \ ${CONFIG_SHELL} \ - "${CT_SRC_DIR}/isl-${CT_ISL_VERSION}/configure" \ + "${CT_SRC_DIR}/isl/configure" \ --build=${CT_BUILD} \ --host=${host} \ --prefix="${prefix}" \ diff --git a/scripts/build/companion_libs/130-cloog.sh b/scripts/build/companion_libs/130-cloog.sh index b21b028..445d259 100644 --- a/scripts/build/companion_libs/130-cloog.sh +++ b/scripts/build/companion_libs/130-cloog.sh @@ -13,18 +13,12 @@ if [ "${CT_CLOOG}" = "y" ]; then # Download CLooG do_cloog_get() { - CT_GetFile "cloog-${CT_CLOOG_VERSION}" \ - http://www.bastoul.net/cloog/pages/download \ - ftp://gcc.gnu.org/pub/gcc/infrastructure + CT_Fetch CLOOG } # Extract CLooG do_cloog_extract() { - CT_Extract "cloog-${CT_CLOOG_VERSION}" - CT_Patch "cloog" "${CT_CLOOG_VERSION}" - - # Help the autostuff in case it thinks there are things to regenerate... - CT_DoExecLog DEBUG mkdir -p "${CT_SRC_DIR}/cloog-${CT_CLOOG_VERSION}/m4" + CT_ExtractPatch CLOOG } # Build CLooG for running on build @@ -85,7 +79,7 @@ do_cloog_backend() { eval "${arg// /\\ }" done - if [ "${CT_CLOOG_0_18_or_later}" = y ]; then + if [ "${CT_CLOOG_HAS_WITH_GMP_ISL_OSL}" = y ]; then cloog_opts+=( --with-gmp=system --with-gmp-prefix="${prefix}" ) cloog_opts+=( --with-isl=system --with-isl-prefix="${prefix}" ) cloog_opts+=( --without-osl ) @@ -98,7 +92,7 @@ do_cloog_backend() { LDFLAGS="${ldflags}" \ LIBS="-lm" \ ${CONFIG_SHELL} \ - "${CT_SRC_DIR}/cloog-${CT_CLOOG_VERSION}/configure" \ + "${CT_SRC_DIR}/cloog/configure" \ --build=${CT_BUILD} \ --host=${host} \ --prefix="${prefix}" \ diff --git a/scripts/build/companion_libs/140-mpc.sh b/scripts/build/companion_libs/140-mpc.sh index e6efb4f..3136ab4 100644 --- a/scripts/build/companion_libs/140-mpc.sh +++ b/scripts/build/companion_libs/140-mpc.sh @@ -13,15 +13,12 @@ if [ "${CT_MPC}" = "y" ]; then # Download MPC do_mpc_get() { - CT_GetFile "mpc-${CT_MPC_VERSION}" .tar.gz \ - {http,ftp,https}://ftp.gnu.org/gnu/mpc \ - http://www.multiprecision.org/mpc/download + CT_Fetch MPC } # Extract MPC do_mpc_extract() { - CT_Extract "mpc-${CT_MPC_VERSION}" - CT_Patch "mpc" "${CT_MPC_VERSION}" + CT_ExtractPatch MPC } # Build MPC for running on build @@ -87,7 +84,7 @@ do_mpc_backend() { CFLAGS="${cflags}" \ LDFLAGS="${ldflags}" \ ${CONFIG_SHELL} \ - "${CT_SRC_DIR}/mpc-${CT_MPC_VERSION}/configure" \ + "${CT_SRC_DIR}/mpc/configure" \ --build=${CT_BUILD} \ --host=${host} \ --prefix="${prefix}" \ diff --git a/scripts/build/companion_libs/200-libelf.sh b/scripts/build/companion_libs/200-libelf.sh index 807ce7e..d1ac0b4 100644 --- a/scripts/build/companion_libs/200-libelf.sh +++ b/scripts/build/companion_libs/200-libelf.sh @@ -9,15 +9,11 @@ do_libelf_for_target() { :; } if [ "${CT_LIBELF}" = "y" -o "${CT_LIBELF_TARGET}" = "y" ]; then do_libelf_get() { - # The server hosting libelf will return an "HTTP 300 : Multiple Choices" - # error code if we try to download a file that does not exists there. - # So we have to request the file with an explicit extension. - CT_GetFile "libelf-${CT_LIBELF_VERSION}" .tar.gz http://www.mr511.de/software/ + CT_Fetch LIBELF } do_libelf_extract() { - CT_Extract "libelf-${CT_LIBELF_VERSION}" - CT_Patch "libelf" "${CT_LIBELF_VERSION}" + CT_ExtractPatch LIBELF } if [ "${CT_LIBELF}" = "y" ]; then @@ -131,7 +127,7 @@ do_libelf_backend() { CFLAGS="${cflags} -fPIC" \ LDFLAGS="${ldflags}" \ ${CONFIG_SHELL} \ - "${CT_SRC_DIR}/libelf-${CT_LIBELF_VERSION}/configure" \ + "${CT_SRC_DIR}/libelf/configure" \ --build=${CT_BUILD} \ --host=${host} \ --target=${CT_TARGET} \ diff --git a/scripts/build/companion_libs/210-expat.sh b/scripts/build/companion_libs/210-expat.sh index 5aa8e31..dcb7208 100644 --- a/scripts/build/companion_libs/210-expat.sh +++ b/scripts/build/companion_libs/210-expat.sh @@ -9,13 +9,11 @@ do_expat_for_target() { :; } if [ "${CT_EXPAT_TARGET}" = "y" -o "${CT_EXPAT}" = "y" ]; then do_expat_get() { - CT_GetFile "expat-${CT_EXPAT_VERSION}" .tar.gz \ - http://downloads.sourceforge.net/project/expat/expat/${CT_EXPAT_VERSION} + CT_Fetch EXPAT } do_expat_extract() { - CT_Extract "expat-${CT_EXPAT_VERSION}" - CT_Patch "expat" "${CT_EXPAT_VERSION}" + CT_ExtractPatch EXPAT } if [ "${CT_EXPAT}" = "y" ]; then @@ -95,7 +93,7 @@ do_expat_backend() { CFLAGS="${cflags}" \ LDFLAGS="${ldflags}" \ ${CONFIG_SHELL} \ - "${CT_SRC_DIR}/expat-${CT_EXPAT_VERSION}/configure" \ + "${CT_SRC_DIR}/expat/configure" \ --build=${CT_BUILD} \ --host=${host} \ --prefix="${prefix}" \ diff --git a/scripts/build/companion_libs/220-ncurses.sh b/scripts/build/companion_libs/220-ncurses.sh index 7a1379d..815cf4b 100644 --- a/scripts/build/companion_libs/220-ncurses.sh +++ b/scripts/build/companion_libs/220-ncurses.sh @@ -9,15 +9,11 @@ do_ncurses_for_target() { :; } if [ "${CT_NCURSES_TARGET}" = "y" -o "${CT_NCURSES}" = "y" ]; then do_ncurses_get() { - CT_GetFile "ncurses-${CT_NCURSES_VERSION}" .tar.gz \ - {http,ftp,https}://ftp.gnu.org/pub/gnu/ncurses \ - ftp://invisible-island.net/ncurses + CT_Fetch NCURSES } do_ncurses_extract() { - CT_Extract "ncurses-${CT_NCURSES_VERSION}" - CT_DoExecLog ALL chmod -R u+w "${CT_SRC_DIR}/ncurses-${CT_NCURSES_VERSION}" - CT_Patch "ncurses" "${CT_NCURSES_VERSION}" + CT_ExtractPatch NCURSES } # We need tic that runs on the build when building ncurses for host/target @@ -157,7 +153,7 @@ do_ncurses_backend() { CFLAGS="${cflags}" \ LDFLAGS="${ldflags}" \ ${CONFIG_SHELL} \ - "${CT_SRC_DIR}/ncurses-${CT_NCURSES_VERSION}/configure" \ + "${CT_SRC_DIR}/ncurses/configure" \ --build=${CT_BUILD} \ --host=${host} \ --prefix="${prefix}" \ diff --git a/scripts/build/companion_libs/320-libiconv.sh b/scripts/build/companion_libs/320-libiconv.sh index f2f0bef..ad571a9 100644 --- a/scripts/build/companion_libs/320-libiconv.sh +++ b/scripts/build/companion_libs/320-libiconv.sh @@ -9,13 +9,11 @@ do_libiconv_for_target() { :; } if [ "${CT_LIBICONV}" = "y" ]; then do_libiconv_get() { - CT_GetFile "libiconv-${CT_LIBICONV_VERSION}" \ - http://ftp.gnu.org/pub/gnu/libiconv/ + CT_Fetch LIBICONV } do_libiconv_extract() { - CT_Extract "libiconv-${CT_LIBICONV_VERSION}" - CT_Patch "libiconv" "${CT_LIBICONV_VERSION}" + CT_ExtractPatch LIBICONV } # Build libiconv for running on build @@ -93,7 +91,7 @@ do_libiconv_backend() { CFLAGS="${cflags}" \ LDFLAGS="${ldflags}" \ ${CONFIG_SHELL} \ - "${CT_SRC_DIR}/libiconv-${CT_LIBICONV_VERSION}/configure" \ + "${CT_SRC_DIR}/libiconv/configure" \ --build=${CT_BUILD} \ --host="${host}" \ --prefix="${prefix}" \ diff --git a/scripts/build/companion_libs/330-gettext.sh b/scripts/build/companion_libs/330-gettext.sh index 8828e5d..f3f1497 100644 --- a/scripts/build/companion_libs/330-gettext.sh +++ b/scripts/build/companion_libs/330-gettext.sh @@ -9,13 +9,11 @@ do_gettext_for_target() { :; } if [ "${CT_GETTEXT}" = "y" ]; then do_gettext_get() { - CT_GetFile "gettext-${CT_GETTEXT_VERSION}" \ - http://ftp.gnu.org/pub/gnu/gettext/ + CT_Fetch GETTEXT } do_gettext_extract() { - CT_Extract "gettext-${CT_GETTEXT_VERSION}" - CT_Patch "gettext" "${CT_GETTEXT_VERSION}" + CT_ExtractPatch GETTEXT } # Build gettext for running on build @@ -112,7 +110,7 @@ do_gettext_backend() { CFLAGS="${cflags}" \ LDFLAGS="${ldflags}" \ ${CONFIG_SHELL} \ - "${CT_SRC_DIR}/gettext-${CT_GETTEXT_VERSION}/configure" \ + "${CT_SRC_DIR}/gettext/configure" \ --build=${CT_BUILD} \ --host="${host}" \ --prefix="${prefix}" \ diff --git a/scripts/build/companion_tools.sh b/scripts/build/companion_tools.sh index b190ed7..7776f64 100644 --- a/scripts/build/companion_tools.sh +++ b/scripts/build/companion_tools.sh @@ -5,7 +5,7 @@ CT_COMP_TOOLS_FACILITY_LIST= for f in "${CT_LIB_DIR}/scripts/build/companion_tools/"*.sh; do _f="$(basename "${f}" .sh)" _f="${_f#???-}" - __f="CT_COMP_TOOLS_${_f}" + __f="CT_COMP_TOOLS_${_f^^}" if [ "${!__f}" = "y" ]; then CT_DoLog DEBUG "Enabling companion tool '${_f}'" . "${f}" diff --git a/scripts/build/companion_tools/050-make.sh b/scripts/build/companion_tools/050-make.sh index 76b24aa..3253f5b 100644 --- a/scripts/build/companion_tools/050-make.sh +++ b/scripts/build/companion_tools/050-make.sh @@ -1,14 +1,11 @@ # Build script for make do_companion_tools_make_get() { - CT_GetFile "make-${CT_MAKE_VERSION}" \ - {http,ftp,https}://ftp.gnu.org/gnu/make + CT_Fetch MAKE } do_companion_tools_make_extract() { - CT_Extract "make-${CT_MAKE_VERSION}" - CT_DoExecLog ALL chmod -R u+w "${CT_SRC_DIR}/make-${CT_MAKE_VERSION}" - CT_Patch "make" "${CT_MAKE_VERSION}" + CT_ExtractPatch MAKE } do_companion_tools_make_for_build() { @@ -61,7 +58,7 @@ do_make_backend() { CFLAGS="${cflags}" \ LDFLAGS="${ldflags}" \ ${CONFIG_SHELL} \ - "${CT_SRC_DIR}/make-${CT_MAKE_VERSION}/configure" \ + "${CT_SRC_DIR}/make/configure" \ --host="${host}" \ --prefix="${prefix}" \ "${extra_config[@]}" diff --git a/scripts/build/companion_tools/100-m4.sh b/scripts/build/companion_tools/100-m4.sh index e0fccd7..1707d64 100644 --- a/scripts/build/companion_tools/100-m4.sh +++ b/scripts/build/companion_tools/100-m4.sh @@ -1,13 +1,11 @@ # Build script for m4 do_companion_tools_m4_get() { - CT_GetFile "m4-${CT_M4_VERSION}" \ - {http,ftp,https}://ftp.gnu.org/gnu/m4 + CT_Fetch M4 } do_companion_tools_m4_extract() { - CT_Extract "m4-${CT_M4_VERSION}" - CT_Patch "m4" "${CT_M4_VERSION}" + CT_ExtractPatch M4 } do_companion_tools_m4_for_build() { @@ -58,7 +56,7 @@ do_m4_backend() { CFLAGS="${cflags}" \ LDFLAGS="${ldflags}" \ ${CONFIG_SHELL} \ - "${CT_SRC_DIR}/m4-${CT_M4_VERSION}/configure" \ + "${CT_SRC_DIR}/m4/configure" \ --host="${host}" \ --prefix="${prefix}" diff --git a/scripts/build/companion_tools/200-autoconf.sh b/scripts/build/companion_tools/200-autoconf.sh index bccef75..52149ea 100644 --- a/scripts/build/companion_tools/200-autoconf.sh +++ b/scripts/build/companion_tools/200-autoconf.sh @@ -1,14 +1,11 @@ # Build script for autoconf do_companion_tools_autoconf_get() { - CT_GetFile "autoconf-${CT_AUTOCONF_VERSION}" \ - {http,ftp,https}://ftp.gnu.org/gnu/autoconf + CT_Fetch AUTOCONF } do_companion_tools_autoconf_extract() { - CT_Extract "autoconf-${CT_AUTOCONF_VERSION}" - CT_DoExecLog ALL chmod -R u+w "${CT_SRC_DIR}/autoconf-${CT_AUTOCONF_VERSION}" - CT_Patch "autoconf" "${CT_AUTOCONF_VERSION}" + CT_ExtractPatch AUTOCONF } do_companion_tools_autoconf_for_build() { @@ -42,7 +39,7 @@ do_autoconf_backend() { CT_DoLog EXTRA "Configuring autoconf" CT_DoExecLog CFG \ ${CONFIG_SHELL} \ - "${CT_SRC_DIR}/autoconf-${CT_AUTOCONF_VERSION}/configure" \ + "${CT_SRC_DIR}/autoconf/configure" \ --host="${host}" \ --prefix="${prefix}" diff --git a/scripts/build/companion_tools/300-automake.sh b/scripts/build/companion_tools/300-automake.sh index ee76463..2d7eded 100644 --- a/scripts/build/companion_tools/300-automake.sh +++ b/scripts/build/companion_tools/300-automake.sh @@ -1,14 +1,11 @@ # Build script for automake do_companion_tools_automake_get() { - CT_GetFile "automake-${CT_AUTOMAKE_VERSION}" \ - {http,ftp,https}://ftp.gnu.org/gnu/automake + CT_Fetch AUTOMAKE } do_companion_tools_automake_extract() { - CT_Extract "automake-${CT_AUTOMAKE_VERSION}" - CT_DoExecLog ALL chmod -R u+w "${CT_SRC_DIR}/automake-${CT_AUTOMAKE_VERSION}" - CT_Patch "automake" "${CT_AUTOMAKE_VERSION}" + CT_ExtractPatch AUTOMAKE } do_companion_tools_automake_for_build() { @@ -38,7 +35,7 @@ do_automake_backend() { CT_DoLog EXTRA "Configuring automake" CT_DoExecLog CFG \ ${CONFIG_SHELL} \ - "${CT_SRC_DIR}/automake-${CT_AUTOMAKE_VERSION}/configure" \ + "${CT_SRC_DIR}/automake/configure" \ --host="${host}" \ --prefix="${prefix}" diff --git a/scripts/build/companion_tools/400-libtool.sh b/scripts/build/companion_tools/400-libtool.sh index 4461207..3733072 100644 --- a/scripts/build/companion_tools/400-libtool.sh +++ b/scripts/build/companion_tools/400-libtool.sh @@ -1,14 +1,11 @@ # Build script for libtool do_companion_tools_libtool_get() { - CT_GetFile "libtool-${CT_LIBTOOL_VERSION}" \ - {http,ftp,https}://ftp.gnu.org/gnu/libtool + CT_Fetch LIBTOOL } do_companion_tools_libtool_extract() { - CT_Extract "libtool-${CT_LIBTOOL_VERSION}" - CT_DoExecLog ALL chmod -R u+w "${CT_SRC_DIR}/libtool-${CT_LIBTOOL_VERSION}" - CT_Patch "libtool" "${CT_LIBTOOL_VERSION}" + CT_ExtractPatch LIBTOOL } do_companion_tools_libtool_for_build() { @@ -38,7 +35,7 @@ do_libtool_backend() { CT_DoLog EXTRA "Configuring libtool" CT_DoExecLog CFG \ ${CONFIG_SHELL} \ - "${CT_SRC_DIR}/libtool-${CT_LIBTOOL_VERSION}/configure" \ + "${CT_SRC_DIR}/libtool/configure" \ --host="${host}" \ --prefix="${prefix}" diff --git a/scripts/build/debug.sh b/scripts/build/debug.sh index f07b295..f8178dd 100644 --- a/scripts/build/debug.sh +++ b/scripts/build/debug.sh @@ -5,7 +5,7 @@ CT_DEBUG_FACILITY_LIST= for f in "${CT_LIB_DIR}/scripts/build/debug/"*.sh; do _f="$(basename "${f}" .sh)" _f="${_f#???-}" - __f="CT_DEBUG_${_f}" + __f="CT_DEBUG_${_f^^}" if [ "${!__f}" = "y" ]; then CT_DoLog DEBUG "Enabling debug '${_f}'" . "${f}" diff --git a/scripts/build/debug/200-duma.sh b/scripts/build/debug/200-duma.sh index 2a9b01f..bd35030 100644 --- a/scripts/build/debug/200-duma.sh +++ b/scripts/build/debug/200-duma.sh @@ -1,24 +1,11 @@ # Build script for D.U.M.A. do_debug_duma_get() { - local dl_base - - dl_base="http://downloads.sourceforge.net/project/duma/duma" - dl_base+="/${CT_DUMA_VERSION//_/.}" - - # Downloading an non-existing file from sourceforge will give you an - # HTML file containing an error message, instead of returning a 404. - # Sigh... - CT_GetFile "duma_${CT_DUMA_VERSION}" .tar.gz "${dl_base}" - # Downloading from sourceforge may leave garbage, cleanup - CT_DoExecLog ALL rm -f "${CT_TARBALLS_DIR}/showfiles.php"* + CT_Fetch DUMA } do_debug_duma_extract() { - CT_Extract "duma_${CT_DUMA_VERSION}" - CT_Pushd "${CT_SRC_DIR}/duma_${CT_DUMA_VERSION}" - CT_Patch nochdir "duma" "${CT_DUMA_VERSION}" - CT_Popd + CT_ExtractPatch DUMA } do_debug_duma_build() { @@ -26,7 +13,7 @@ do_debug_duma_build() { CT_DoStep INFO "Installing D.U.M.A." CT_DoLog EXTRA "Copying sources" - cp -a "${CT_SRC_DIR}/duma_${CT_DUMA_VERSION}/." "${CT_BUILD_DIR}/build-duma" + cp -a "${CT_SRC_DIR}/duma/." "${CT_BUILD_DIR}/build-duma" CT_Pushd "${CT_BUILD_DIR}/build-duma" make_args=( diff --git a/scripts/build/debug/300-gdb.sh b/scripts/build/debug/300-gdb.sh index e5276d0..19d9d6d 100644 --- a/scripts/build/debug/300-gdb.sh +++ b/scripts/build/debug/300-gdb.sh @@ -1,40 +1,17 @@ # Build script for the gdb debug facility do_debug_gdb_get() { - local linaro_version="" - local linaro_series="" - - if [ "${CT_GDB_CUSTOM}" = "y" ]; then - CT_GetCustom "gdb" "${CT_GDB_CUSTOM_VERSION}" \ - "${CT_GDB_CUSTOM_LOCATION}" - else - 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 + CT_Fetch GDB } do_debug_gdb_extract() { - CT_Extract "gdb-${CT_GDB_VERSION}" - CT_Patch "gdb" "${CT_GDB_VERSION}" - - if [ -n "${CT_ARCH_XTENSA_CUSTOM_NAME}" ]; then - CT_ConfigureXtensa "gdb" "${CT_GDB_VERSION}" - fi + CT_ExtractPatch GDB } do_debug_gdb_build() { local -a extra_config - gdb_src_dir="${CT_SRC_DIR}/gdb-${CT_GDB_VERSION}" + gdb_src_dir="${CT_SRC_DIR}/gdb" # Version 6.3 and below behave badly with gdbmi case "${CT_GDB_VERSION}" in @@ -174,11 +151,12 @@ do_debug_gdb_build() { if [ "${CT_GDB_INSTALL_GDBINIT}" = "y" ]; then CT_DoLog EXTRA "Installing '.gdbinit' template" # See in scripts/build/internals.sh for why we do this - if [ -f "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/gcc/BASE-VER" ]; then - gcc_version=$( cat "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/gcc/BASE-VER" ) + # TBD GCC 3.x and older not supported + if [ -f "${CT_SRC_DIR}/gcc/gcc/BASE-VER" ]; then + gcc_version=$( cat "${CT_SRC_DIR}/gcc/gcc/BASE-VER" ) else gcc_version=$(sed -r -e '/version_string/!d; s/^.+= "([^"]+)".*$/\1/;' \ - "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/gcc/version.c" \ + "${CT_SRC_DIR}/gcc/gcc/version.c" \ ) fi sed -r \ diff --git a/scripts/build/debug/400-ltrace.sh b/scripts/build/debug/400-ltrace.sh index 6b860e9..ce299c2 100644 --- a/scripts/build/debug/400-ltrace.sh +++ b/scripts/build/debug/400-ltrace.sh @@ -1,19 +1,11 @@ # Build script for ltrace do_debug_ltrace_get() { - CT_GetFile "ltrace_${CT_LTRACE_VERSION}.orig" .tar.gz \ - {http,ftp}://ftp.debian.org/debian/pool/main/l/ltrace/ - # Create a link so that the following steps are easier to do: - CT_Pushd "${CT_TARBALLS_DIR}" - ltrace_ext=$(CT_GetFileExtension "ltrace_${CT_LTRACE_VERSION}.orig") - ln -sf "ltrace_${CT_LTRACE_VERSION}.orig${ltrace_ext}" \ - "ltrace-${CT_LTRACE_VERSION}${ltrace_ext}" - CT_Popd + CT_Fetch LTRACE } do_debug_ltrace_extract() { - CT_Extract "ltrace-${CT_LTRACE_VERSION}" - CT_Patch "ltrace" "${CT_LTRACE_VERSION}" + CT_ExtractPatch LTRACE } do_debug_ltrace_build() { @@ -22,7 +14,7 @@ do_debug_ltrace_build() { CT_DoStep INFO "Installing ltrace" CT_DoLog EXTRA "Copying sources to build dir" - CT_DoExecLog ALL cp -av "${CT_SRC_DIR}/ltrace-${CT_LTRACE_VERSION}/." \ + CT_DoExecLog ALL cp -av "${CT_SRC_DIR}/ltrace/." \ "${CT_BUILD_DIR}/build-ltrace" CT_Pushd "${CT_BUILD_DIR}/build-ltrace" @@ -63,4 +55,3 @@ do_debug_ltrace_build() { CT_Popd CT_EndStep } - diff --git a/scripts/build/debug/500-strace.sh b/scripts/build/debug/500-strace.sh index 6eb2357..cb4643a 100644 --- a/scripts/build/debug/500-strace.sh +++ b/scripts/build/debug/500-strace.sh @@ -1,15 +1,11 @@ # Build script for strace do_debug_strace_get() { - local base_url="http://downloads.sourceforge.net/project/strace/strace" - CT_GetFile "strace-${CT_STRACE_VERSION}" "${base_url}/${CT_STRACE_VERSION}" - # Downloading from sourceforge leaves garbage, cleanup - CT_DoExecLog ALL rm -f "${CT_TARBALLS_DIR}/showfiles.php"* + CT_Fetch STRACE } do_debug_strace_extract() { - CT_Extract "strace-${CT_STRACE_VERSION}" - CT_Patch "strace" "${CT_STRACE_VERSION}" + CT_ExtractPatch STRACE } do_debug_strace_build() { @@ -23,7 +19,7 @@ do_debug_strace_build() { CPP="${CT_TARGET}-cpp" \ LD="${CT_TARGET}-ld" \ ${CONFIG_SHELL} \ - "${CT_SRC_DIR}/strace-${CT_STRACE_VERSION}/configure" \ + "${CT_SRC_DIR}/strace/configure" \ --build=${CT_BUILD} \ --host=${CT_TARGET} \ --prefix=/usr diff --git a/scripts/build/internals.sh b/scripts/build/internals.sh index db9b1fd..e407de8 100644 --- a/scripts/build/internals.sh +++ b/scripts/build/internals.sh @@ -69,18 +69,19 @@ do_finish() { CT_DoExecLog ALL "${CT_TARGET}-strip" ${strip_args} \ "${CT_TARGET}/debug-root/usr/bin/gdbserver${exe_suffix}" fi - if [ "${CT_CC_gcc}" = "y" ]; then - # We can not use the version in CT_CC_GCC_VERSION because + if [ "${CT_CC_GCC}" = "y" ]; then + # TBD GCC 3.x/2.x is no longer supported by ctng + # We can not use the version in CT_GCC_VERSION because # of the Linaro stuff. So, harvest the version string # directly from the gcc sources... # All gcc 4.x seem to have the version in gcc/BASE-VER # while version prior to 4.x have the version in gcc/version.c # Of course, here is not the better place to do that... - if [ -f "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/gcc/BASE-VER" ]; then - gcc_version=$( cat "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/gcc/BASE-VER" ) + if [ -f "${CT_SRC_DIR}/gcc/gcc/BASE-VER" ]; then + gcc_version=$( cat "${CT_SRC_DIR}/gcc/gcc/BASE-VER" ) else gcc_version=$(sed -r -e '/version_string/!d; s/^.+= "([^"]+)".*$/\1/;' \ - "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/gcc/version.c" \ + "${CT_SRC_DIR}/gcc/gcc/version.c" \ ) fi for _t in "bin/${CT_TARGET}-"* \ diff --git a/scripts/build/kernel/linux.sh b/scripts/build/kernel/linux.sh index cd4a456..5ab4918 100644 --- a/scripts/build/kernel/linux.sh +++ b/scripts/build/kernel/linux.sh @@ -19,69 +19,26 @@ CT_DoKernelTupleValues() { # Download the kernel do_kernel_get() { - local k_ver - local custom_name - local rel_dir - local korg_base mirror_base + CT_Fetch LINUX +} - if [ "${CT_KERNEL_LINUX_CUSTOM}" = "y" ]; then - CT_GetCustom "linux" "${CT_KERNEL_LINUX_CUSTOM_VERSION}" \ - "${CT_KERNEL_LINUX_CUSTOM_LOCATION}" - else # Not a custom tarball - case "${CT_KERNEL_VERSION}" in - 2.6.*.*|3.*.*|4.*.*) - # 4-part versions (for 2.6 stables and long-terms), and - # 3-part versions (for 3.x.y and 4.x.y stables and long-terms) - # we need to trash the last digit - k_ver="${CT_KERNEL_VERSION%.*}" - ;; - 2.6.*|3.*|4.*) - # 3-part version (for 2.6.x initial releases), and 2-part - # versions (for 3.x and 4.x initial releases), use all of it - k_ver="${CT_KERNEL_VERSION}" - ;; - esac - case "${CT_KERNEL_VERSION}" in - 2.6.*) rel_dir=v2.6;; - 3.*) rel_dir=v3.x;; - 4.*) rel_dir=v4.x;; - esac - korg_base="http://www.kernel.org/pub/linux/kernel/${rel_dir}" - CT_GetFile "linux-${CT_KERNEL_VERSION}" \ - "${korg_base}" \ - "${korg_base}/longterm/v${k_ver}" \ - "${korg_base}/longterm" - fi +# Disable building relocs application - it needs <linux/types.h> +# on the host, which may not be present on Cygwin or MacOS; it +# needs <elf.h>, which again is not present on MacOS; and most +# important, we don't need it to install the headers. +# This is not done as a patch, since it varies from Linux version +# to version - patching each particular Linux version would be +# too cumbersome. +linux_disable_build_relocs() +{ + sed -i -r 's/(\$\(MAKE\) .* relocs)$/:/' arch/*/Makefile } # Extract kernel -do_kernel_extract() { - # If using a custom directory location, nothing to do - if [ "${CT_KERNEL_LINUX_CUSTOM}" = "y" \ - -a -d "${CT_SRC_DIR}/linux-${CT_KERNEL_VERSION}" ]; then - return 0 - fi - - # Otherwise, we're using either a mainstream tarball, or a custom - # tarball; in either case, we need to extract - CT_Extract "linux-${CT_KERNEL_VERSION}" - - # If using a custom tarball, no need to patch - if [ "${CT_KERNEL_LINUX_CUSTOM}" = "y" ]; then - return 0 - fi - CT_Patch "linux" "${CT_KERNEL_VERSION}" - - # Disable building relocs application - it needs <linux/types.h> - # on the host, which may not be present on Cygwin or MacOS; it - # needs <elf.h>, which again is not present on MacOS; and most - # important, we don't need it to install the headers. - # This is not done as a patch, since it varies from Linux version - # to version - patching each particular Linux version would be - # too cumbersome. - CT_Pushd "${CT_SRC_DIR}/linux-${CT_KERNEL_VERSION}" - sed -i -r 's/(\$\(MAKE\) .* relocs)$/:/' arch/*/Makefile - CT_Popd +do_kernel_extract() +{ + # TBD verify linux_disable_build_relocs is run + CT_ExtractPatch LINUX linux_disable_build_relocs } # Install kernel headers using headers_install from kernel sources. @@ -93,7 +50,7 @@ do_kernel_headers() { mkdir -p "${CT_BUILD_DIR}/build-kernel-headers" - kernel_path="${CT_SRC_DIR}/linux-${CT_KERNEL_VERSION}" + kernel_path="${CT_SRC_DIR}/linux" V_OPT="V=${CT_KERNEL_LINUX_VERBOSE_LEVEL}" kernel_arch="${CT_ARCH}" diff --git a/scripts/build/libc/avr-libc.sh b/scripts/build/libc/avr-libc.sh index f94b601..7003f38 100644 --- a/scripts/build/libc/avr-libc.sh +++ b/scripts/build/libc/avr-libc.sh @@ -1,33 +1,11 @@ # This file adds functions to build the avr-libc C library do_libc_get() { - local libc_src - - libc_src="http://download.savannah.gnu.org/releases/avr-libc" - - if [ "${CT_LIBC_AVR_LIBC_CUSTOM}" = "y" ]; then - CT_GetCustom "avr-libc" "${CT_LIBC_AVR_LIBC_CUSTOM_VERSION}" \ - "${CT_LIBC_AVR_LIBC_CUSTOM_LOCATION}" - else # ! custom location - CT_GetFile "avr-libc-${CT_LIBC_VERSION}" "${libc_src}" - fi # ! custom location + CT_Fetch AVR_LIBC } do_libc_extract() { - CT_Extract "avr-libc-${CT_LIBC_VERSION}" - CT_Patch "avr-libc" "${CT_LIBC_VERSION}" -} - -do_libc_configure() { - CT_DoLog EXTRA "Configuring C library" - - CT_DoExecLog CFG \ - ${CONFIG_SHELL} \ - ./configure \ - --build=${CT_BUILD} \ - --host=${CT_TARGET} \ - --prefix=${CT_PREFIX_DIR} \ - "${CT_LIBC_AVR_LIBC_EXTRA_CONFIG_ARRAY[@]}" + CT_ExtractPatch AVR_LIBC } do_libc_start_files() { @@ -42,11 +20,19 @@ do_libc_post_cc() { CT_DoStep INFO "Installing C library" CT_DoLog EXTRA "Copying sources to build directory" - CT_DoExecLog ALL cp -av "${CT_SRC_DIR}/avr-libc-${CT_LIBC_VERSION}/." \ + CT_DoExecLog ALL cp -av "${CT_SRC_DIR}/avr-libc/." \ "${CT_BUILD_DIR}/build-libc-post-cc" cd "${CT_BUILD_DIR}/build-libc-post-cc" - do_libc_configure + CT_DoLog EXTRA "Configuring C library" + + CT_DoExecLog CFG \ + ${CONFIG_SHELL} \ + ./configure \ + --build=${CT_BUILD} \ + --host=${CT_TARGET} \ + --prefix=${CT_PREFIX_DIR} \ + "${CT_LIBC_AVR_LIBC_EXTRA_CONFIG_ARRAY[@]}" CT_DoLog EXTRA "Building C library" CT_DoExecLog ALL make ${JOBSFLAGS} diff --git a/scripts/build/libc/bionic.sh b/scripts/build/libc/bionic.sh index fcdc57f..027493d 100644 --- a/scripts/build/libc/bionic.sh +++ b/scripts/build/libc/bionic.sh @@ -3,37 +3,29 @@ # Licensed under the GPL v2. See COPYING in the root of this package do_libc_get() { - if [ "${CT_LIBC_BIONIC_CUSTOM}" = "y" ]; then - CT_GetCustom "bionic" "${CT_LIBC_BIONIC_CUSTOM_VERSION}" \ - "${CT_LIBC_BIONIC_CUSTOM_LOCATION}" - else # ! custom location - CT_GetFile "android-ndk-${CT_LIBC_VERSION}-linux-x86_64.zip" https://dl.google.com/android/repository - fi # ! custom location + CT_Fetch ANDROID_NDK } do_libc_extract() { - CT_Extract "android-ndk-${CT_LIBC_VERSION}-linux-x86_64" - CT_Pushd "${CT_SRC_DIR}/android-ndk-${CT_LIBC_VERSION}/" - CT_Patch nochdir bionic "${CT_LIBC_VERSION}" - CT_Popd + CT_ExtractPatch ANDROID_NDK } # Install Unified headers do_libc_start_files() { CT_DoStep INFO "Installing C library headers" - CT_DoExecLog ALL cp -r "${CT_SRC_DIR}/android-ndk-${CT_LIBC_VERSION}/sysroot/usr" "${CT_SYSROOT_DIR}" + CT_DoExecLog ALL cp -r "${CT_SRC_DIR}/android-ndk/sysroot/usr" "${CT_SYSROOT_DIR}" } do_libc() { local arch="${CT_ARCH}" if [ "${CT_ARCH_64}" = "y" ]; then if [ "${CT_ARCH}" = "x86" ]; then - arch="${arch}_" - fi - arch="${arch}64" + arch="${arch}_" + fi + arch="${arch}64" fi CT_DoStep INFO "Installing C library binaries" - CT_DoExecLog ALL cp -r "${CT_SRC_DIR}/android-ndk-${CT_LIBC_VERSION}/platforms/android-${CT_ANDROID_API}/arch-${arch}/usr" "${CT_SYSROOT_DIR}" + CT_DoExecLog ALL cp -r "${CT_SRC_DIR}/android-ndk/platforms/android-${CT_ANDROID_API}/arch-${arch}/usr" "${CT_SYSROOT_DIR}" 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 3eac3ba..eae64bc 100644 --- a/scripts/build/libc/glibc.sh +++ b/scripts/build/libc/glibc.sh @@ -7,102 +7,22 @@ do_libc_get() { local version local -a addons_list - addons_list=($(do_libc_add_ons_list " ")) - - # Main source - if [ "${CT_LIBC_GLIBC_CUSTOM}" = "y" ]; then - CT_GetCustom "glibc" "${CT_LIBC_GLIBC_CUSTOM_VERSION}" \ - "${CT_LIBC_GLIBC_CUSTOM_LOCATION}" - else - 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 + CT_Fetch GLIBC + if [ "${CT_GLIBC_USE_PORTS_EXTERNAL}" = "y" ]; then + CT_Fetch GLIBC_PORTS fi - - # C library addons - for addon in "${addons_list[@]}"; do - # Never ever try to download these add-ons, - # they've always been internal - case "${addon}" in - nptl) continue;; - esac - - case "${addon}:${CT_LIBC_GLIBC_PORTS_EXTERNAL}" in - ports:y) ;; - ports:*) continue;; - esac - - if ! CT_GetFile "glibc-${addon}-${CT_LIBC_VERSION}" \ - http://mirrors.kernel.org/sourceware/glibc \ - {http,ftp,https}://ftp.gnu.org/gnu/glibc \ - ftp://{sourceware.org,gcc.gnu.org}/pub/glibc/{releases,snapshots} - then - # Some add-ons are bundled with glibc, others are - # bundled in their own tarball. Eg. NPTL is internal, - # while LinuxThreads was external. Also, for old - # versions of glibc, the libidn add-on was external, - # but with version >=2.10, it is internal. - CT_DoLog DEBUG "Addon '${addon}' could not be downloaded." - CT_DoLog DEBUG "We'll see later if we can find it in the source tree" - fi - done - return 0 } do_libc_extract() { local addon - CT_Extract "${CT_LIBC}-${CT_LIBC_VERSION}" - CT_Pushd "${CT_SRC_DIR}/${CT_LIBC}-${CT_LIBC_VERSION}" - # Custom glibc won't get patched, because CT_GetCustom - # marks custom glibc as patched. - CT_Patch nochdir "${CT_LIBC}" "${CT_LIBC_VERSION}" - - for addon in $(do_libc_add_ons_list " "); do - # If the addon was bundled with the main archive, we do not - # need to extract it. Worse, if we were to try to extract - # it, we'd get an error. - if [ -d "${addon}" ]; then - CT_DoLog DEBUG "Add-on '${addon}' already present, skipping extraction" - continue - fi - - CT_Extract nochdir "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}" - - CT_TestAndAbort "Error in add-on '${addon}': both short and long names in tarball" \ - -d "${addon}" -a -d "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}" - - # Some addons have the 'long' name, while others have the - # 'short' name, but patches are non-uniformly built with - # either the 'long' or 'short' name, whatever the addons name - # but we prefer the 'short' name and avoid duplicates. - if [ -d "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}" ]; then - CT_DoExecLog FILE mv "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}" "${addon}" - fi - - CT_DoExecLog FILE ln -s "${addon}" "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}" - - CT_Patch nochdir "${CT_LIBC}" "${addon}-${CT_LIBC_VERSION}" - - # Remove the long name since it can confuse configure scripts to run - # the same source twice. - rm "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}" - done - - # The configure files may be older than the configure.in files - # if using a snapshot (or even some tarballs). Fake them being - # up to date. - find . -type f -name configure -exec touch {} \; 2>&1 |CT_DoLog ALL - - CT_Popd + CT_ExtractPatch GLIBC + if [ "${CT_GLIBC_USE_PORTS_EXTERNAL}" = "y" ]; then + CT_ExtractPatch GLIBC_PORTS + fi + # TBD make patches for addons (ports? anything else?) uniformly using short names + # TBD make the configure timestamp fix in all patched packages (e.g. part of CT_ExtractPatch) } # Build and install headers and start files @@ -161,7 +81,7 @@ do_libc_backend_once() { local multi_flags multi_dir multi_os_dir multi_root multi_index multi_count multi_target local build_cflags build_cppflags build_ldflags local startfiles_dir - local src_dir="${CT_SRC_DIR}/${CT_LIBC}-${CT_LIBC_VERSION}" + local src_dir="${CT_SRC_DIR}/glibc" local -a extra_config local -a extra_make_args local glibc_cflags @@ -209,7 +129,7 @@ do_libc_backend_once() { # Add some default glibc config options if not given by user. # We don't need to be conditional on whether the user did set different - # values, as they CT_LIBC_GLIBC_EXTRA_CONFIG_ARRAY is passed after + # values, as they CT_GLIBC_EXTRA_CONFIG_ARRAY is passed after # extra_config extra_config+=("$(do_libc_min_kernel_config)") @@ -218,7 +138,7 @@ do_libc_backend_once() { nptl) extra_config+=("--with-__thread" "--with-tls");; linuxthreads) extra_config+=("--with-__thread" "--without-tls" "--without-nptl");; none) extra_config+=("--without-__thread" "--without-nptl") - case "${CT_LIBC_GLIBC_EXTRA_CONFIG_ARRAY[*]}" in + case "${CT_GLIBC_EXTRA_CONFIG_ARRAY[*]}" in *-tls*) ;; *) extra_config+=("--without-tls");; esac @@ -230,12 +150,12 @@ do_libc_backend_once() { *) extra_config+=("--disable-shared");; esac - if [ "${CT_LIBC_DISABLE_VERSIONING}" = "y" ]; then + if [ "${CT_GLIBC_DISABLE_VERSIONING}" = "y" ]; then extra_config+=("--disable-versioning") fi - if [ "${CT_LIBC_OLDEST_ABI}" != "" ]; then - extra_config+=("--enable-oldest-abi=${CT_LIBC_OLDEST_ABI}") + if [ "${CT_GLIBC_OLDEST_ABI}" != "" ]; then + extra_config+=("--enable-oldest-abi=${CT_GLIBC_OLDEST_ABI}") fi case "$(do_libc_add_ons_list ,)" in @@ -251,25 +171,25 @@ do_libc_backend_once() { # Hide host C++ binary from configure echo "ac_cv_prog_ac_ct_CXX=${CT_TARGET}-g++" >>config.cache - if [ "${CT_LIBC_GLIBC_FORCE_UNWIND}" = "y" ]; then + if [ "${CT_GLIBC_FORCE_UNWIND}" = "y" ]; then echo "libc_cv_forced_unwind=yes" >>config.cache echo "libc_cv_c_cleanup=yes" >>config.cache fi # Pre-seed the configparms file with values from the config option - printf "%s\n" "${CT_LIBC_GLIBC_CONFIGPARMS}" > configparms + printf "%s\n" "${CT_GLIBC_CONFIGPARMS}" > configparms # glibc can't be built without -O2 (reference needed!) glibc_cflags+=" -O2" - case "${CT_LIBC_ENABLE_FORTIFIED_BUILD}" in + case "${CT_GLIBC_ENABLE_FORTIFIED_BUILD}" in y) ;; *) glibc_cflags+=" -U_FORTIFY_SOURCE";; esac # In the order of increasing precedence. Flags common to compiler and linker. glibc_cflags+=" ${CT_TARGET_CFLAGS}" - glibc_cflags+=" ${CT_LIBC_GLIBC_EXTRA_CFLAGS}" + glibc_cflags+=" ${CT_GLIBC_EXTRA_CFLAGS}" glibc_cflags+=" ${multi_flags}" # Analyze the resulting options for any extra configure switches to throw in. @@ -336,7 +256,7 @@ do_libc_backend_once() { --without-gd \ --with-headers="${CT_HEADERS_DIR}" \ "${extra_config[@]}" \ - "${CT_LIBC_GLIBC_EXTRA_CONFIG_ARRAY[@]}" + "${CT_GLIBC_EXTRA_CONFIG_ARRAY[@]}" # build hacks case "${CT_ARCH},${CT_ARCH_CPU}" in @@ -390,7 +310,7 @@ do_libc_backend_once() { # See e.g. http://gcc.gnu.org/ml/gcc/2002-01/msg00900.html mkdir -p "${CT_HEADERS_DIR}/gnu" CT_DoExecLog ALL touch "${CT_HEADERS_DIR}/gnu/stubs.h" - CT_DoExecLog ALL cp -v "${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/include/features.h" \ + CT_DoExecLog ALL cp -v "${CT_SRC_DIR}/glibc/include/features.h" \ "${CT_HEADERS_DIR}/features.h" # Building the bootstrap gcc requires either setting inhibit_libc, or @@ -475,7 +395,7 @@ do_libc_backend_once() { ${CT_PREFIX_DIR}/share/doc fi - if [ "${CT_LIBC_LOCALES}" = "y" -a "${multi_index}" = "${multi_count}" ]; then + if [ "${CT_GLIBC_LOCALES}" = "y" -a "${multi_index}" = "${multi_count}" ]; then do_libc_locales fi fi # libc_mode = final @@ -486,27 +406,28 @@ do_libc_backend_once() { # Build up the addons list, separated with $1 do_libc_add_ons_list() { local sep="$1" - local addons_list="$( echo "${CT_LIBC_ADDONS_LIST}" \ - |sed -r -e "s/[[:space:],]/${sep}/g;" \ - )" - if [ "${CT_LIBC_GLIBC_2_20_or_later}" != "y" ]; then - case "${CT_THREADS}" in - none) ;; - *) addons_list="${addons_list}${sep}${CT_THREADS}";; - esac + local addons_list + + if [ "${CT_GLIBC_USE_PORTS_ADDON}" = "y" ]; then + addons_list="${addons_list}${sep}ports" + fi + if [ "${CT_GLIBC_USE_NPTL_ADDON}" = "y" ]; then + addons_list="${addons_list}${sep}nptl" + fi + if [ "${CT_GLIBC_USE_LIBIDN_ADDON}" = "y" ]; then + addons_list="${addons_list}${sep}libidn" fi - [ "${CT_LIBC_GLIBC_USE_PORTS}" = "y" ] && addons_list="${addons_list}${sep}ports" - # Remove duplicate, leading and trailing separators - echo "${addons_list}" |sed -r -e "s/${sep}+/${sep}/g; s/^${sep}//; s/${sep}\$//;" + echo "${addons_list#${sep}}" # Remove leading separator if any } # Compute up the minimum supported Linux kernel version do_libc_min_kernel_config() { local min_kernel_config - case "${CT_LIBC_GLIBC_EXTRA_CONFIG_ARRAY[*]}" in + case "${CT_GLIBC_EXTRA_CONFIG_ARRAY[*]}" in *--enable-kernel*) ;; - *) if [ "${CT_LIBC_GLIBC_KERNEL_VERSION_AS_HEADERS}" = "y" ]; then + *) if [ "${CT_GLIBC_KERNEL_VERSION_AS_HEADERS}" = "y" ]; then + # TBD do we support that currently? We always seem to install kernel headers # We can't rely on the kernel version from the configuration, # because it might not be available if the user uses pre-installed # headers. On the other hand, both method will have the kernel @@ -523,9 +444,9 @@ do_libc_min_kernel_config() { patchlevel=$(((version_code>>8)&0xFF)) sublevel=$((version_code&0xFF)) min_kernel_config="${version}.${patchlevel}.${sublevel}" - elif [ "${CT_LIBC_GLIBC_KERNEL_VERSION_CHOSEN}" = "y" ]; then + elif [ "${CT_GLIBC_KERNEL_VERSION_CHOSEN}" = "y" ]; then # Trim the fourth part of the linux version, keeping only the first three numbers - min_kernel_config="$( echo "${CT_LIBC_GLIBC_MIN_KERNEL_VERSION}" \ + min_kernel_config="$( echo "${CT_GLIBC_MIN_KERNEL_VERSION}" \ |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;' \ )" fi @@ -536,7 +457,7 @@ do_libc_min_kernel_config() { # Build and install the libc locales do_libc_locales() { - local src_dir="${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}" + local src_dir="${CT_SRC_DIR}/glibc" local -a extra_config local glibc_cflags @@ -567,7 +488,7 @@ do_libc_locales() { CT_DoLog DEBUG "Extra config args passed: '${extra_config[*]}'" glibc_cflags="-O2 -fno-stack-protector" - case "${CT_LIBC_ENABLE_FORTIFIED_BUILD}" in + case "${CT_GLIBC_ENABLE_FORTIFIED_BUILD}" in y) ;; *) glibc_cflags+=" -U_FORTIFY_SOURCE";; esac diff --git a/scripts/build/libc/mingw.sh b/scripts/build/libc/mingw-w64.sh index 1471785..295b313 100644 --- a/scripts/build/libc/mingw.sh +++ b/scripts/build/libc/mingw-w64.sh @@ -1,29 +1,17 @@ # Copyright 2012 Yann Diorcet # Licensed under the GPL v2. See COPYING in the root of this package -CT_WINAPI_VERSION_DOWNLOADED= - do_libc_get() { - if [ "${CT_WINAPI_VERSION}" = "devel" ]; then - CT_GetGit "mingw-w64" "ref=HEAD" "git://git.code.sf.net/p/mingw-w64/mingw-w64" CT_WINAPI_VERSION_DOWNLOADED - CT_DoLog DEBUG "Fetched mingw-w64 as ${CT_WINAPI_VERSION_DOWNLOADED}" - else - CT_GetFile "mingw-w64-v${CT_WINAPI_VERSION}" \ - http://downloads.sourceforge.net/sourceforge/mingw-w64 - CT_WINAPI_VERSION_DOWNLOADED=v${CT_WINAPI_VERSION} - fi + CT_Fetch MINGW_W64 } do_libc_extract() { - CT_Extract "mingw-w64-${CT_WINAPI_VERSION_DOWNLOADED}" - CT_Pushd "${CT_SRC_DIR}/mingw-w64-${CT_WINAPI_VERSION_DOWNLOADED}/" - CT_Patch nochdir mingw-w64 "${CT_WINAPI_VERSION_DOWNLOADED}" - CT_Popd + CT_ExtractPatch MINGW_W64 } do_set_mingw_install_prefix(){ MINGW_INSTALL_PREFIX=/usr/${CT_TARGET} - if [[ ${CT_WINAPI_VERSION} == 2* ]]; then + if [[ ${CT_MINGW_W64_VERSION} == 2* ]]; then MINGW_INSTALL_PREFIX=/usr fi } @@ -51,7 +39,7 @@ do_libc_start_files() { do_set_mingw_install_prefix CT_DoExecLog CFG \ ${CONFIG_SHELL} \ - "${CT_SRC_DIR}/mingw-w64-${CT_WINAPI_VERSION_DOWNLOADED}/mingw-w64-headers/configure" \ + "${CT_SRC_DIR}/mingw-w64/mingw-w64-headers/configure" \ --build=${CT_BUILD} \ --host=${CT_TARGET} \ --prefix=${MINGW_INSTALL_PREFIX} \ @@ -75,9 +63,9 @@ do_libc_start_files() { do_check_mingw_vendor_tuple() { - if [[ ${CT_WINAPI_VERSION} == 4* ]]; then - CT_DoStep INFO "Checking vendor tuple configured in crosstool-ng .config" - if [[ ${CT_TARGET_VENDOR} == w64 ]]; then + if [ "${CT_MINGW_W64_VERSION%%.*}" -ge 4 ]; then + CT_DoStep INFO "Checking configured vendor tuple" + if [ ${CT_TARGET_VENDOR} == w64 ]; then CT_DoLog EXTRA "The tuple is set to '${CT_TARGET_VENDOR}', as recommended by mingw-64 developers." else CT_DoLog WARN "The tuple vendor is '${CT_TARGET_VENDOR}', not equal to 'w64' and might break the toolchain!" @@ -92,7 +80,7 @@ do_mingw_tools() for f in "${CT_MINGW_TOOL_LIST_ARRAY[@]}"; do CT_mkdir_pushd "${f}" - if [ ! -d "${CT_SRC_DIR}/mingw-w64-${CT_WINAPI_VERSION_DOWNLOADED}/mingw-w64-tools/${f}" ]; then + if [ ! -d "${CT_SRC_DIR}/mingw-w64/mingw-w64-tools/${f}" ]; then CT_DoLog WARN "Skipping ${f}: not found" CT_Popd continue @@ -101,7 +89,7 @@ do_mingw_tools() CT_DoLog EXTRA "Configuring ${f}" CT_DoExecLog CFG \ ${CONFIG_SHELL} \ - "${CT_SRC_DIR}/mingw-w64-${CT_WINAPI_VERSION_DOWNLOADED}/mingw-w64-tools/${f}/configure" \ + "${CT_SRC_DIR}/mingw-w64/mingw-w64-tools/${f}/configure" \ --build=${CT_BUILD} \ --host=${CT_HOST} \ --target=${CT_TARGET} \ @@ -159,7 +147,7 @@ do_mingw_pthreads() RCFLAGS="${rcflags}" \ DLLTOOLFLAGS="${dlltoolflags}" \ ${CONFIG_SHELL} \ - "${CT_SRC_DIR}/mingw-w64-${CT_WINAPI_VERSION_DOWNLOADED}/mingw-w64-libraries/winpthreads/configure" \ + "${CT_SRC_DIR}/mingw-w64/mingw-w64-libraries/winpthreads/configure" \ --with-sysroot=${CT_SYSROOT_DIR} \ --prefix=${MINGW_INSTALL_PREFIX} \ --libdir=${libprefix} \ @@ -189,7 +177,7 @@ do_libc() do_set_mingw_install_prefix CT_DoExecLog CFG \ ${CONFIG_SHELL} \ - "${CT_SRC_DIR}/mingw-w64-${CT_WINAPI_VERSION_DOWNLOADED}/mingw-w64-crt/configure" \ + "${CT_SRC_DIR}/mingw-w64/mingw-w64-crt/configure" \ --with-sysroot=${CT_SYSROOT_DIR} \ --prefix=${MINGW_INSTALL_PREFIX} \ --build=${CT_BUILD} \ diff --git a/scripts/build/libc/musl.sh b/scripts/build/libc/musl.sh index 5a53fd0..430fb8d 100644 --- a/scripts/build/libc/musl.sh +++ b/scripts/build/libc/musl.sh @@ -3,17 +3,11 @@ # Licensed under the GPL v2. See COPYING in the root of this package do_libc_get() { - if [ "${CT_LIBC_MUSL_CUSTOM}" = "y" ]; then - CT_GetCustom "musl" "${CT_LIBC_MUSL_CUSTOM_VERSION}" \ - "${CT_LIBC_MUSL_CUSTOM_LOCATION}" - else # ! custom location - CT_GetFile "musl-${CT_LIBC_VERSION}" http://www.musl-libc.org/releases - fi # ! custom location + CT_Fetch MUSL } do_libc_extract() { - CT_Extract "musl-${CT_LIBC_VERSION}" - CT_Patch "musl" "${CT_LIBC_VERSION}" + CT_ExtractPatch MUSL } # Build and install headers and start files @@ -62,7 +56,7 @@ do_libc_backend_once() { local libc_mode local -a extra_cflags local -a extra_config - local src_dir="${CT_SRC_DIR}/${CT_LIBC}-${CT_LIBC_VERSION}" + local src_dir="${CT_SRC_DIR}/musl" local multi_dir multi_os_dir multi_root multi_flags multi_index multi_count local multilib_dir local hdr_install_subdir @@ -83,7 +77,7 @@ do_libc_backend_once() { # From buildroot: # gcc constant folding bug with weak aliases workaround # See http://www.openwall.com/lists/musl/2014/05/15/1 - if [ "${CT_CC_GCC_4_9_or_later}" = "y" ]; then + if [ "${CT_GCC_BUG_61144}" = "y" ]; then extra_cflags+=("-fno-toplevel-reorder") fi diff --git a/scripts/build/libc/newlib.sh b/scripts/build/libc/newlib.sh index 3b48507..5c4a356 100644 --- a/scripts/build/libc/newlib.sh +++ b/scripts/build/libc/newlib.sh @@ -6,44 +6,20 @@ # do_libc_get() { - local libc_src="{http://mirrors.kernel.org/sourceware/newlib, - ftp://sourceware.org/pub/newlib}" - - if [ "${CT_LIBC_NEWLIB_CUSTOM}" = "y" ]; then - CT_GetCustom "newlib" "${CT_LIBC_NEWLIB_CUSTOM_VERSION}" \ - "${CT_LIBC_NEWLIB_CUSTOM_LOCATION}" - else # ! custom location - 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 + CT_Fetch NEWLIB } do_libc_extract() { - CT_Extract "newlib-${CT_LIBC_VERSION}" - CT_Patch "newlib" "${CT_LIBC_VERSION}" - - if [ -n "${CT_ARCH_XTENSA_CUSTOM_NAME}" ]; then - CT_ConfigureXtensa "newlib" "${CT_LIBC_VERSION}" - fi + CT_ExtractPatch NEWLIB } do_libc_start_files() { CT_DoStep INFO "Installing C library headers & start files" - CT_DoExecLog ALL cp -a "${CT_SRC_DIR}/newlib-${CT_LIBC_VERSION}/newlib/libc/include/." \ + CT_DoExecLog ALL cp -a "${CT_SRC_DIR}/newlib/newlib/libc/include/." \ "${CT_HEADERS_DIR}" - if [ "${CT_ARCH_xtensa}" = "y" ]; then + if [ "${CT_ARCH_XTENSA}" = "y" ]; then CT_DoLog EXTRA "Installing Xtensa headers" - CT_DoExecLog ALL cp -r "${CT_SRC_DIR}/newlib-${CT_LIBC_VERSION}/newlib/libc/sys/xtensa/include/." \ + CT_DoExecLog ALL cp -r "${CT_SRC_DIR}/newlib/newlib/libc/sys/xtensa/include/." \ "${CT_HEADERS_DIR}" fi CT_EndStep @@ -131,7 +107,7 @@ ENABLE_TARGET_OPTSPACE:target-optspace AR_FOR_TARGET="`which ${CT_TARGET}-gcc-ar`" \ RANLIB_FOR_TARGET="`which ${CT_TARGET}-gcc-ranlib`" \ ${CONFIG_SHELL} \ - "${CT_SRC_DIR}/newlib-${CT_LIBC_VERSION}/configure" \ + "${CT_SRC_DIR}/newlib/configure" \ --host=${CT_BUILD} \ --target=${CT_TARGET} \ --prefix=${CT_PREFIX_DIR} \ diff --git a/scripts/build/libc/uClibc.sh b/scripts/build/libc/uClibc.sh index a730a1d..af07888 100644 --- a/scripts/build/libc/uClibc.sh +++ b/scripts/build/libc/uClibc.sh @@ -2,53 +2,14 @@ # Copyright 2007 Yann E. MORIN # Licensed under the GPL v2. See COPYING in the root of this package -# This is a constant because it does not change very often. -# We're in 2010, and are still using data from 7 years ago. -uclibc_locales_version=030818 -uclibc_locale_tarball="uClibc-locale-${uclibc_locales_version}" - -if [ "${CT_LIBC_UCLIBC_NG}" = "y" ]; then - uclibc_name="uClibc-ng" - libc_src="http://downloads.uclibc-ng.org/releases/${CT_LIBC_VERSION}" -else - uclibc_name="uClibc" - libc_src="http://www.uclibc.org/downloads - http://www.uclibc.org/downloads/old-releases" -fi - # Download uClibc do_libc_get() { - if [ "${CT_LIBC_UCLIBC_CUSTOM}" = "y" ]; then - CT_GetCustom "${uclibc_name}" "${CT_LIBC_UCLIBC_CUSTOM_VERSION}" \ - "${CT_LIBC_UCLIBC_CUSTOM_LOCATION}" - else - CT_GetFile "${uclibc_name}-${CT_LIBC_VERSION}" ${libc_src} - fi - # uClibc locales - if [ "${CT_LIBC_UCLIBC_LOCALES_PREGEN_DATA}" = "y" ]; then - CT_GetFile "${uclibc_locale_tarball}" ${libc_src} - fi - - return 0 + CT_Fetch UCLIBC } # Extract uClibc do_libc_extract() { - CT_Extract "${uclibc_name}-${CT_LIBC_VERSION}" - CT_Patch "${uclibc_name}" "${CT_LIBC_VERSION}" - - # uClibc locales - # Extracting pregen locales ourselves is kinda - # broken, so just link it in place... - if [ "${CT_LIBC_UCLIBC_LOCALES_PREGEN_DATA}" = "y" \ - -a ! -f "${CT_SRC_DIR}/.${uclibc_locale_tarball}.extracted" ]; then - CT_Pushd "${CT_SRC_DIR}/${uclibc_name}-${CT_LIBC_VERSION}/extra/locale" - CT_DoExecLog ALL ln -s "${CT_TARBALLS_DIR}/${uclibc_locale_tarball}.tgz" . - CT_Popd - touch "${CT_SRC_DIR}/.${uclibc_locale_tarball}.extracted" - fi - - return 0 + CT_ExtractPatch UCLIBC } # Build and install headers and start files @@ -93,16 +54,19 @@ do_libc_backend_once() { local -a make_args local extra_cflags f cfg_cflags cf local hdr_install_subdir + local uclibc_name for arg in "$@"; do eval "${arg// /\\ }" done - CT_DoStep INFO "Building for multilib ${multi_index}/${multi_count}: '${multi_flags}'" + if [ "${CT_UCLIBC_USE_UCLIBC_NG_ORG}" = "y" ]; then + uclibc_name="uClibc-ng" + elif [ "${CT_UCLIBC_USE_UCLIBC_ORG}" = "y" ]; then + uclibc_name="uClibc" + fi - # Simply copy files until uClibc has the ability to build out-of-tree - CT_DoLog EXTRA "Copying sources to build dir" - CT_DoExecLog ALL cp -av "${CT_SRC_DIR}/${uclibc_name}-${CT_LIBC_VERSION}/." . + CT_DoStep INFO "Building for multilib ${multi_index}/${multi_count}: '${multi_flags}'" multilib_dir="lib/${multi_os_dir}" startfiles_dir="${multi_root}/usr/${multilib_dir}" @@ -122,11 +86,14 @@ do_libc_backend_once() { HOSTCC="${CT_BUILD}-gcc" \ PREFIX="${multi_root}/" \ MULTILIB_DIR="${multilib_dir}" \ - LOCALE_DATA_FILENAME="${uclibc_locale_tarball}.tgz" \ STRIPTOOL=true \ ${CT_LIBC_UCLIBC_VERBOSITY} \ ) + # Simply copy files until uClibc has the ability to build out-of-tree + CT_DoLog EXTRA "Copying sources to build dir" + CT_DoExecLog ALL cp -av "${CT_SRC_DIR}/uClibc/." . + # Force the date of the pregen locale data, as the # newer ones that are referenced are not available CT_DoLog EXTRA "Applying configuration" @@ -323,27 +290,15 @@ manage_uClibc_config() { # entirely if LOCALE is not set. If LOCALE was already set, we'll # assume the user has already made all the appropriate generation # arrangements. Note that having the uClibc Makefile download the - # pregenerated locales is not compatible with crosstool; besides, - # crosstool downloads them as part of getandpatch.sh. - CT_KconfigDeleteOption "UCLIBC_DOWNLOAD_PREGENERATED_LOCALE" "${dst}" - case "${CT_LIBC_UCLIBC_LOCALES}:${CT_LIBC_UCLIBC_LOCALES_PREGEN_DATA}" in - :*) - ;; - y:) + # pregenerated locales is not compatible with crosstool. + if [ -z "${CT_LIBC_UCLIBC_LOCALES}" ]; then + CT_KconfigDisableOption "UCLIBC_HAS_LOCALE" "${dst}" + else CT_KconfigEnableOption "UCLIBC_HAS_LOCALE" "${dst}" CT_KconfigDeleteOption "UCLIBC_PREGENERATED_LOCALE_DATA" "${dst}" - CT_KconfigDeleteOption "UCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA" \ - "${dst}" + CT_KconfigDeleteOption "UCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA" "${dst}" CT_KconfigDeleteOption "UCLIBC_HAS_XLOCALE" "${dst}" - ;; - y:y) - CT_KconfigEnableOption "UCLIBC_HAS_LOCALE" "${dst}" - CT_KconfigEnableOption "UCLIBC_PREGENERATED_LOCALE_DATA" "${dst}" - CT_KconfigDeleteOption "UCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA" \ - "${dst}" - CT_KconfigDeleteOption "UCLIBC_HAS_XLOCALE" "${dst}" - ;; - esac + fi # WCHAR support if [ "${CT_LIBC_UCLIBC_WCHAR}" = "y" ]; then diff --git a/scripts/build/test_suite.sh b/scripts/build/test_suite.sh index 8fabf42..e963a99 100644 --- a/scripts/build/test_suite.sh +++ b/scripts/build/test_suite.sh @@ -7,8 +7,7 @@ CT_TEST_SUITE_FACILITY_LIST= for f in "${CT_LIB_DIR}/scripts/build/test_suite/"*.sh; do _f="$(basename "${f}" .sh)" - __f="CT_TEST_SUITE_${_f}" - __f=`echo ${__f} | tr "[:lower:]" "[:upper:]"` + __f="CT_TEST_SUITE_${_f^^}" if [ "${!__f}" = "y" ]; then CT_DoLog DEBUG "Enabling test suite '${_f}'" . "${f}" diff --git a/scripts/build/test_suite/gcc.sh b/scripts/build/test_suite/gcc.sh index c829a43..6c6e5a7 100644 --- a/scripts/build/test_suite/gcc.sh +++ b/scripts/build/test_suite/gcc.sh @@ -18,7 +18,7 @@ do_test_suite_gcc_build() { CT_DoExecLog ALL cp -av "${CT_LIB_DIR}/contrib/gcc-test-suite/default.cfg" \ "${CT_LIB_DIR}/contrib/gcc-test-suite/Makefile" \ "${CT_LIB_DIR}/contrib/gcc-test-suite/README" \ - "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/gcc/testsuite" \ + "${CT_SRC_DIR}/gcc/gcc/testsuite" \ "${CT_TEST_SUITE_DIR}/gcc" CT_DoExecLog ALL sed -i -r -e "s/@@DG_TARGET@@/${CT_TARGET}/g;" \ |