summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAlexey Neyman <stilor@att.net>2017-01-12 06:20:46 (GMT)
committerAlexey Neyman <stilor@att.net>2017-01-13 07:00:41 (GMT)
commit9f5a92a783eb33430a3c8e5518e7e1c723fe3a15 (patch)
treebc4abff0bedeb7155996c89a41656fd406823149 /scripts
parent5e0f715ea7d032207d20593e43b02c1a1d7cd759 (diff)
Unify fetching Linaro components.
Add CT_GetLinaro, use it from gcc/binutils/gdb/glibc/newlib. Signed-off-by: Alexey Neyman <stilor@att.net>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/build/binutils/binutils.sh20
-rw-r--r--scripts/build/cc/100-gcc.sh36
-rw-r--r--scripts/build/debug/300-gdb.sh31
-rw-r--r--scripts/build/libc/glibc.sh21
-rw-r--r--scripts/build/libc/newlib.sh21
-rw-r--r--scripts/functions34
6 files changed, 89 insertions, 74 deletions
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 947d4af..8fd850b 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 3d3af7b..dabd81a 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 019dd90..3e2c88e 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 0a87581..06e88e4 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 f687504..35b3872 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,