diff --git a/scripts/build/binutils/binutils.sh b/scripts/build/binutils/binutils.sh index 0e285b61..17ea1389 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 947d4afd..8fd850be 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 diff --git a/scripts/build/debug/300-gdb.sh b/scripts/build/debug/300-gdb.sh index 3d3af7b1..dabd81a8 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 } diff --git a/scripts/build/libc/glibc.sh b/scripts/build/libc/glibc.sh index 019dd902..3e2c88ed 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 diff --git a/scripts/build/libc/newlib.sh b/scripts/build/libc/newlib.sh index 0a87581e..06e88e4d 100644 --- a/scripts/build/libc/newlib.sh +++ b/scripts/build/libc/newlib.sh @@ -17,15 +17,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 } diff --git a/scripts/functions b/scripts/functions index f687504d..35b38729 100644 --- a/scripts/functions +++ b/scripts/functions @@ -798,6 +798,40 @@ CT_GetFile() { return 1 } +# Get a component from Linaro archives. +# Usage: CT_GetLinaro +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,