Peter Stuge | 09377b7 | 2011-08-21 06:24:55 +0200 | [diff] [blame] | 1 | #!/bin/sh |
Stefan Reinauer | 074d913 | 2009-09-26 16:43:17 +0000 | [diff] [blame] | 2 | # |
Stefan Reinauer | 5f1ad89 | 2010-05-17 11:02:25 +0000 | [diff] [blame] | 3 | # Copyright (C) 2008-2010 by coresystems GmbH |
Stefan Reinauer | 074d913 | 2009-09-26 16:43:17 +0000 | [diff] [blame] | 4 | # written by Patrick Georgi <patrick.georgi@coresystems.de> and |
| 5 | # Stefan Reinauer <stefan.reinauer@coresystems.de> |
Stefan Reinauer | 14e2277 | 2010-04-27 06:56:47 +0000 | [diff] [blame] | 6 | # |
Marc Jones | 2aac3f6 | 2011-08-08 16:07:50 -0600 | [diff] [blame] | 7 | # Copyright (C) 2011 by Sage Electronic Engineering |
| 8 | # |
Stefan Reinauer | 074d913 | 2009-09-26 16:43:17 +0000 | [diff] [blame] | 9 | # This program is free software; you can redistribute it and/or modify |
| 10 | # it under the terms of the GNU General Public License as published by |
| 11 | # the Free Software Foundation; version 2 of the License. |
| 12 | # |
| 13 | # This program is distributed in the hope that it will be useful, |
| 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | # GNU General Public License for more details. |
| 17 | # |
Stefan Reinauer | 074d913 | 2009-09-26 16:43:17 +0000 | [diff] [blame] | 18 | |
Stefan Reinauer | d764912 | 2015-06-09 11:44:25 -0700 | [diff] [blame] | 19 | cd $(dirname $0) |
Patrick Georgi | 8135dba | 2015-03-17 21:05:20 +0100 | [diff] [blame] | 20 | |
Martin Roth | 64b35f3 | 2015-12-30 15:10:13 -0700 | [diff] [blame] | 21 | CROSSGCC_DATE="March 21st, 2016" |
| 22 | CROSSGCC_VERSION="1.37" |
Stefan Reinauer | 074d913 | 2009-09-26 16:43:17 +0000 | [diff] [blame] | 23 | |
| 24 | # default settings |
Stefan Reinauer | 85b07d6 | 2015-06-09 14:45:14 -0700 | [diff] [blame] | 25 | PACKAGE=GCC |
Stefan Reinauer | d764912 | 2015-06-09 11:44:25 -0700 | [diff] [blame] | 26 | TARGETDIR=$(pwd)/xgcc |
Stefan Reinauer | 074d913 | 2009-09-26 16:43:17 +0000 | [diff] [blame] | 27 | TARGETARCH=i386-elf |
Nico Huber | 32c4a06 | 2016-01-25 18:30:57 +0100 | [diff] [blame] | 28 | LANGUAGES=c |
Stefan Reinauer | 074d913 | 2009-09-26 16:43:17 +0000 | [diff] [blame] | 29 | DESTDIR= |
Stefan Reinauer | 85b07d6 | 2015-06-09 14:45:14 -0700 | [diff] [blame] | 30 | SAVETEMPS=0 |
| 31 | SKIPPYTHON=1 |
Stefan Reinauer | 074d913 | 2009-09-26 16:43:17 +0000 | [diff] [blame] | 32 | |
Stefan Reinauer | 699ac27 | 2015-06-05 12:43:28 -0700 | [diff] [blame] | 33 | # GCC toolchain version numbers |
Timothy Pearson | 9631016 | 2015-12-28 22:53:29 -0600 | [diff] [blame] | 34 | GMP_VERSION=6.1.0 |
Timothy Pearson | 74432e1 | 2016-01-05 10:41:36 -0600 | [diff] [blame] | 35 | MPFR_VERSION=3.1.3 |
Paul Menzel | e661942 | 2015-02-23 10:33:59 +0100 | [diff] [blame] | 36 | MPC_VERSION=1.0.3 |
Stefan Reinauer | 5f1ad89 | 2010-05-17 11:02:25 +0000 | [diff] [blame] | 37 | LIBELF_VERSION=0.8.13 |
Patrick Georgi | af473ed | 2015-07-17 23:35:54 +0200 | [diff] [blame] | 38 | GCC_VERSION=5.2.0 |
Stefan Reinauer | 0d2119d | 2013-07-10 14:27:56 -0700 | [diff] [blame] | 39 | GCC_AUTOCONF_VERSION=2.69 |
Patrick Georgi | 53c388f | 2015-03-07 09:55:18 +0100 | [diff] [blame] | 40 | BINUTILS_VERSION=2.25 |
Stefan Reinauer | bed95b2 | 2015-06-09 13:41:40 -0700 | [diff] [blame] | 41 | GDB_VERSION=7.9.1 |
Martin Roth | 64b35f3 | 2015-12-30 15:10:13 -0700 | [diff] [blame] | 42 | IASL_VERSION=20160318 |
Patrick Georgi | 53c388f | 2015-03-07 09:55:18 +0100 | [diff] [blame] | 43 | PYTHON_VERSION=3.4.3 |
Idwer Vollering | 296a015 | 2012-10-26 01:48:04 +0200 | [diff] [blame] | 44 | EXPAT_VERSION=2.1.0 |
Stefan Reinauer | 14ce213 | 2015-06-05 13:01:13 -0700 | [diff] [blame] | 45 | # CLANG version number |
Stefan Reinauer | ea1a5fe | 2016-01-29 17:33:56 -0800 | [diff] [blame] | 46 | CLANG_VERSION=3.7.1 |
Stefan Reinauer | a851bbb | 2016-01-29 18:03:26 -0800 | [diff] [blame] | 47 | MAKE_VERSION=4.1 |
Stefan Reinauer | 074d913 | 2009-09-26 16:43:17 +0000 | [diff] [blame] | 48 | |
Stefan Reinauer | 699ac27 | 2015-06-05 12:43:28 -0700 | [diff] [blame] | 49 | # GCC toolchain archive locations |
Martin Roth | 1484c03 | 2016-03-08 09:37:14 -0700 | [diff] [blame] | 50 | # These are sanitized by the jenkins toolchain test builder, so if |
| 51 | # a completely new URL is added here, it probably needs to be added |
| 52 | # to the jenkins build as well, or the builder won't download it. |
Timothy Pearson | 9631016 | 2015-12-28 22:53:29 -0600 | [diff] [blame] | 53 | GMP_ARCHIVE="http://ftpmirror.gnu.org/gmp/gmp-${GMP_VERSION}.tar.bz2" |
Patrick Georgi | 6e61ad3 | 2012-05-12 23:19:30 +0200 | [diff] [blame] | 54 | MPFR_ARCHIVE="http://ftpmirror.gnu.org/mpfr/mpfr-${MPFR_VERSION}.tar.bz2" |
Idwer Vollering | 7962fc7 | 2012-10-25 02:14:09 +0200 | [diff] [blame] | 55 | MPC_ARCHIVE="http://ftpmirror.gnu.org/mpc/mpc-${MPC_VERSION}.tar.gz" |
Stefan Reinauer | 5f1ad89 | 2010-05-17 11:02:25 +0000 | [diff] [blame] | 56 | LIBELF_ARCHIVE="http://www.mr511.de/software/libelf-${LIBELF_VERSION}.tar.gz" |
Idwer Vollering | 1cfee0b | 2012-10-25 02:03:53 +0200 | [diff] [blame] | 57 | GCC_ARCHIVE="http://ftpmirror.gnu.org/gcc/gcc-${GCC_VERSION}/gcc-${GCC_VERSION}.tar.bz2" |
Stefan Reinauer | 0d2119d | 2013-07-10 14:27:56 -0700 | [diff] [blame] | 58 | BINUTILS_ARCHIVE="http://ftpmirror.gnu.org/binutils/binutils-${BINUTILS_VERSION}.tar.bz2" |
Patrick Georgi | 53c388f | 2015-03-07 09:55:18 +0100 | [diff] [blame] | 59 | GDB_ARCHIVE="http://ftpmirror.gnu.org/gdb/gdb-${GDB_VERSION}.tar.xz" |
Patrick Georgi | 85bb946 | 2016-02-11 17:22:16 +0100 | [diff] [blame] | 60 | IASL_ARCHIVE="https://acpica.org/sites/acpica/files/acpica-unix2-${IASL_VERSION}.tar.gz" |
Patrick Georgi | 53c388f | 2015-03-07 09:55:18 +0100 | [diff] [blame] | 61 | PYTHON_ARCHIVE="http://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tar.xz" |
Stefan Reinauer | 2c3cd12 | 2011-11-01 21:43:50 +0100 | [diff] [blame] | 62 | EXPAT_ARCHIVE="http://downloads.sourceforge.net/sourceforge/expat/expat-${EXPAT_VERSION}.tar.gz" |
Stefan Reinauer | 14ce213 | 2015-06-05 13:01:13 -0700 | [diff] [blame] | 63 | # CLANG toolchain archive locations |
| 64 | LLVM_ARCHIVE="http://llvm.org/releases/${CLANG_VERSION}/llvm-${CLANG_VERSION}.src.tar.xz" |
| 65 | CFE_ARCHIVE="http://llvm.org/releases/${CLANG_VERSION}/cfe-${CLANG_VERSION}.src.tar.xz" |
| 66 | CRT_ARCHIVE="http://llvm.org/releases/${CLANG_VERSION}/compiler-rt-${CLANG_VERSION}.src.tar.xz" |
| 67 | CTE_ARCHIVE="http://llvm.org/releases/${CLANG_VERSION}/clang-tools-extra-${CLANG_VERSION}.src.tar.xz" |
Stefan Reinauer | a851bbb | 2016-01-29 18:03:26 -0800 | [diff] [blame] | 68 | MAKE_ARCHIVE="http://ftpmirror.gnu.org/make/make-${MAKE_VERSION}.tar.bz2" |
Stefan Reinauer | 074d913 | 2009-09-26 16:43:17 +0000 | [diff] [blame] | 69 | |
Martin Roth | 58c68d5 | 2016-03-01 15:22:42 -0700 | [diff] [blame] | 70 | ALL_ARCHIVES="$GMP_ARCHIVE $MPFR_ARCHIVE $MPC_ARCHIVE $LIBELF_ARCHIVE \ |
| 71 | $GCC_ARCHIVE $BINUTILS_ARCHIVE $GDB_ARCHIVE $IASL_ARCHIVE \ |
| 72 | $PYTHON_ARCHIVE $EXPAT_ARCHIVE $LLVM_ARCHIVE $CFE_ARCHIVE \ |
| 73 | $CRT_ARCHIVE $CTE_ARCHIVE $MAKE_ARCHIVE" |
| 74 | |
Stefan Reinauer | 699ac27 | 2015-06-05 12:43:28 -0700 | [diff] [blame] | 75 | # GCC toolchain directories |
Stefan Reinauer | 074d913 | 2009-09-26 16:43:17 +0000 | [diff] [blame] | 76 | GMP_DIR="gmp-${GMP_VERSION}" |
| 77 | MPFR_DIR="mpfr-${MPFR_VERSION}" |
Stefan Reinauer | 5f1ad89 | 2010-05-17 11:02:25 +0000 | [diff] [blame] | 78 | MPC_DIR="mpc-${MPC_VERSION}" |
| 79 | LIBELF_DIR="libelf-${LIBELF_VERSION}" |
Stefan Reinauer | 074d913 | 2009-09-26 16:43:17 +0000 | [diff] [blame] | 80 | GCC_DIR="gcc-${GCC_VERSION}" |
| 81 | BINUTILS_DIR="binutils-${BINUTILS_VERSION}" |
| 82 | GDB_DIR="gdb-${GDB_VERSION}" |
Patrick Georgi | 85bb946 | 2016-02-11 17:22:16 +0100 | [diff] [blame] | 83 | IASL_DIR="acpica-unix2-${IASL_VERSION}" |
Stefan Reinauer | 2c3cd12 | 2011-11-01 21:43:50 +0100 | [diff] [blame] | 84 | PYTHON_DIR="Python-${PYTHON_VERSION}" |
| 85 | EXPAT_DIR="expat-${EXPAT_VERSION}" |
Stefan Reinauer | 14ce213 | 2015-06-05 13:01:13 -0700 | [diff] [blame] | 86 | # CLANG toolchain directories |
| 87 | LLVM_DIR="llvm-${CLANG_VERSION}.src" |
| 88 | CFE_DIR="cfe-${CLANG_VERSION}.src" |
| 89 | CRT_DIR="compiler-rt-${CLANG_VERSION}.src" |
| 90 | CTE_DIR="clang-tools-extra-${CLANG_VERSION}.src" |
Stefan Reinauer | a851bbb | 2016-01-29 18:03:26 -0800 | [diff] [blame] | 91 | MAKE_DIR="make-${MAKE_VERSION}" |
Stefan Reinauer | 074d913 | 2009-09-26 16:43:17 +0000 | [diff] [blame] | 92 | |
Patrick Georgi | 6321f52 | 2015-02-27 23:36:26 +0100 | [diff] [blame] | 93 | unset MAKELEVEL MAKEFLAGS |
| 94 | |
Patrick Georgi | 1861ff7 | 2011-10-31 12:15:55 +0100 | [diff] [blame] | 95 | red='\033[0;31m' |
| 96 | RED='\033[1;31m' |
| 97 | green='\033[0;32m' |
| 98 | GREEN='\033[1;32m' |
| 99 | blue='\033[0;34m' |
| 100 | BLUE='\033[1;34m' |
| 101 | cyan='\033[0;36m' |
| 102 | CYAN='\033[1;36m' |
| 103 | NC='\033[0m' # No Color |
Stefan Reinauer | 074d913 | 2009-09-26 16:43:17 +0000 | [diff] [blame] | 104 | |
zbao | e05c1ea | 2015-08-05 23:10:05 -0400 | [diff] [blame] | 105 | UNAME=$(uname | grep -iq cygwin && echo Cygwin || uname) |
Martin Roth | 8846382 | 2016-01-07 11:03:36 -0700 | [diff] [blame] | 106 | HALT_FOR_TOOLS=0 |
Stefan Reinauer | 0d2119d | 2013-07-10 14:27:56 -0700 | [diff] [blame] | 107 | |
Patrick Georgi | 198d23c | 2012-12-08 08:02:44 +0100 | [diff] [blame] | 108 | normalize_dirs() |
| 109 | { |
| 110 | mkdir -p $DESTDIR$TARGETDIR/lib |
| 111 | test -d $DESTDIR$TARGETDIR/lib32 && mv $DESTDIR$TARGETDIR/lib32/* $DESTDIR$TARGETDIR/lib |
| 112 | test -d $DESTDIR$TARGETDIR/lib64 && mv $DESTDIR$TARGETDIR/lib64/* $DESTDIR$TARGETDIR/lib |
| 113 | rmdir -p $DESTDIR$TARGETDIR/lib32 $DESTDIR$TARGETDIR/lib64 |
| 114 | |
| 115 | perl -pi -e "s,/lib32,/lib," $DESTDIR$TARGETDIR/lib/*.la |
| 116 | perl -pi -e "s,/lib64,/lib," $DESTDIR$TARGETDIR/lib/*.la |
| 117 | } |
| 118 | |
Stefan Reinauer | 93a9630 | 2015-06-15 12:36:53 -0700 | [diff] [blame] | 119 | please_install() |
| 120 | { |
Martin Roth | 8846382 | 2016-01-07 11:03:36 -0700 | [diff] [blame] | 121 | HALT_FOR_TOOLS=1 |
Patrick Georgi | 5da95dc | 2015-07-17 23:33:05 +0200 | [diff] [blame] | 122 | test -r /etc/os-release && . /etc/os-release |
Stefan Reinauer | 93a9630 | 2015-06-15 12:36:53 -0700 | [diff] [blame] | 123 | case "$ID_LIKE" in |
| 124 | debian) solution="sudo apt-get install $1" ;; |
| 125 | suse) solution="sudo zypper install $1" ;; |
| 126 | *) solution="using your OS packaging system" ;; |
| 127 | esac |
| 128 | |
| 129 | printf "${RED}ERROR:${red} Missing tool: Please install \'$1\' utility. (eg $solution)${NC}\n" >&2 |
Martin Roth | e396317 | 2016-01-06 13:54:32 -0700 | [diff] [blame] | 130 | if [ -n "$2" ]; then |
| 131 | printf "${RED}ERROR:${red} or install \'$2\' utility. (eg $solution)${NC}\n" >&2 |
| 132 | fi |
Stefan Reinauer | 93a9630 | 2015-06-15 12:36:53 -0700 | [diff] [blame] | 133 | } |
| 134 | |
Patrick Georgi | b706288 | 2015-02-24 10:52:14 +0100 | [diff] [blame] | 135 | searchtool() |
Stefan Reinauer | 074d913 | 2009-09-26 16:43:17 +0000 | [diff] [blame] | 136 | { |
| 137 | # $1 short name |
Patrick Georgi | b706288 | 2015-02-24 10:52:14 +0100 | [diff] [blame] | 138 | # $2 search string |
| 139 | # $3 soft fail if set |
Martin Roth | e396317 | 2016-01-06 13:54:32 -0700 | [diff] [blame] | 140 | # $4 alternative package to install on failure |
Patrick Georgi | b706288 | 2015-02-24 10:52:14 +0100 | [diff] [blame] | 141 | # result: file name of that tool on stdout |
| 142 | # or no output if nothing suitable was found |
| 143 | search=GNU |
| 144 | if [ -n "$2" ]; then |
| 145 | search="$2" |
| 146 | fi |
Stefan Reinauer | 074d913 | 2009-09-26 16:43:17 +0000 | [diff] [blame] | 147 | for i in "$1" "g$1" "gnu$1"; do |
Stefan Reinauer | dbc0087 | 2015-06-09 11:50:05 -0700 | [diff] [blame] | 148 | if [ -x "$(which $i 2>/dev/null)" ]; then |
| 149 | if [ "$(cat /dev/null | $i --version 2>&1 | grep -c "$search")" \ |
| 150 | -gt 0 ]; then |
Stefan Reinauer | 074d913 | 2009-09-26 16:43:17 +0000 | [diff] [blame] | 151 | echo $i |
| 152 | return |
| 153 | fi |
| 154 | fi |
| 155 | done |
Andrew Wu | b67e9a1 | 2014-04-28 18:13:44 +0800 | [diff] [blame] | 156 | # A workaround for OSX 10.9 and some BSDs, whose nongnu |
| 157 | # patch and tar also work. |
Patrick Georgi | 7cb26b4 | 2015-04-28 21:29:22 +0200 | [diff] [blame] | 158 | if [ $UNAME = "Darwin" -o $UNAME = "FreeBSD" -o $UNAME = "NetBSD" -o $UNAME = "OpenBSD" ]; then |
Patrick Georgi | b706288 | 2015-02-24 10:52:14 +0100 | [diff] [blame] | 159 | if [ "$1" = "patch" -o "$1" = "tar" ]; then |
Stefan Reinauer | dbc0087 | 2015-06-09 11:50:05 -0700 | [diff] [blame] | 160 | if [ -x "$(which $1 2>/dev/null)" ]; then |
Zheng Bao | 36156ff | 2012-09-28 16:18:58 +0800 | [diff] [blame] | 161 | echo $1 |
| 162 | return |
| 163 | fi |
| 164 | fi |
| 165 | fi |
Stefan Reinauer | d764912 | 2015-06-09 11:44:25 -0700 | [diff] [blame] | 166 | if [ "$(echo $1 | cut -b -3)" = "sha" ]; then |
zbao | 939dc84 | 2015-04-30 04:44:07 +0800 | [diff] [blame] | 167 | if [ $UNAME = "FreeBSD" ]; then |
Stefan Reinauer | dbc0087 | 2015-06-09 11:50:05 -0700 | [diff] [blame] | 168 | if [ -x "$(which sha1 2>/dev/null)" ]; then |
zbao | 939dc84 | 2015-04-30 04:44:07 +0800 | [diff] [blame] | 169 | echo sha1 |
| 170 | return |
| 171 | fi |
| 172 | fi |
| 173 | if [ $UNAME = "NetBSD" ]; then |
Stefan Reinauer | dbc0087 | 2015-06-09 11:50:05 -0700 | [diff] [blame] | 174 | if [ -x "$(which cksum 2>/dev/null)" ]; then |
Stefan Reinauer | d764912 | 2015-06-09 11:44:25 -0700 | [diff] [blame] | 175 | echo cksum -a $(echo $1 | sed -e 's,sum,,') |
zbao | 939dc84 | 2015-04-30 04:44:07 +0800 | [diff] [blame] | 176 | return |
| 177 | fi |
| 178 | fi |
| 179 | if [ $UNAME = "Darwin" ]; then |
Stefan Reinauer | dbc0087 | 2015-06-09 11:50:05 -0700 | [diff] [blame] | 180 | if [ -x "$(which openssl 2>/dev/null)" ]; then |
Stefan Reinauer | d764912 | 2015-06-09 11:44:25 -0700 | [diff] [blame] | 181 | echo openssl $(echo $1 | sed -e 's,sum,,') |
zbao | 939dc84 | 2015-04-30 04:44:07 +0800 | [diff] [blame] | 182 | return |
| 183 | fi |
| 184 | fi |
| 185 | fi |
Martin Roth | e396317 | 2016-01-06 13:54:32 -0700 | [diff] [blame] | 186 | |
Martin Roth | 8846382 | 2016-01-07 11:03:36 -0700 | [diff] [blame] | 187 | [ -z "$3" ] && please_install $1 $4 |
Patrick Georgi | b706288 | 2015-02-24 10:52:14 +0100 | [diff] [blame] | 188 | false |
Stefan Reinauer | 074d913 | 2009-09-26 16:43:17 +0000 | [diff] [blame] | 189 | } |
| 190 | |
zbao | 06e85ac | 2015-08-24 22:08:36 -0400 | [diff] [blame] | 191 | check_sum() { |
| 192 | test -z "$CHECKSUM" || \ |
| 193 | test "$(cat sum/$1.cksum 2>/dev/null | sed -e 's@.*\([0-9a-f]\{40,\}\).*@\1@')" = \ |
| 194 | "$($CHECKSUM tarballs/$1 2>/dev/null | sed -e 's@.*\([0-9a-f]\{40,\}\).*@\1@')" |
| 195 | } |
| 196 | |
| 197 | compute_sum() { |
| 198 | test ! -f sum/$1.cksum && test -f tarballs/$1 && \ |
| 199 | (test -z "$CHECKSUM" || $CHECKSUM tarballs/$1 > sum/$1.cksum ) && \ |
| 200 | printf "(checksum created. ${RED}Note. Please upload sum/$1.cksum if the corresponding archive is upgraded.)${NC}" |
| 201 | } |
| 202 | |
zbao | 282dd95 | 2015-09-06 05:00:04 -0400 | [diff] [blame] | 203 | download_showing_percentage() { |
| 204 | url=$1 |
| 205 | printf " ..${red} 0%%" |
| 206 | wget --no-check-certificate $url 2>&1 | while read line; do |
| 207 | printf "${red}" |
| 208 | echo $line | grep -o "[0-9]\+%" | awk '{printf("\b\b\b\b%4s", $1)}' |
| 209 | printf "${NC}" |
| 210 | done |
| 211 | } |
| 212 | |
Stefan Reinauer | 8893548 | 2015-06-05 09:51:10 -0700 | [diff] [blame] | 213 | download() { |
Stefan Reinauer | e7757bd | 2015-06-05 13:59:44 -0700 | [diff] [blame] | 214 | package=$1 |
| 215 | archive="$(eval echo \$$package"_ARCHIVE")" |
Stefan Reinauer | 699ac27 | 2015-06-05 12:43:28 -0700 | [diff] [blame] | 216 | |
Stefan Reinauer | d764912 | 2015-06-09 11:44:25 -0700 | [diff] [blame] | 217 | FILE=$(basename $archive) |
Stefan Reinauer | 8893548 | 2015-06-05 09:51:10 -0700 | [diff] [blame] | 218 | printf " * $FILE " |
| 219 | |
zbao | d22b9ea | 2015-08-30 23:35:16 -0400 | [diff] [blame] | 220 | if test -f tarballs/$FILE && check_sum $FILE ; then |
| 221 | printf "(cached)" |
| 222 | else |
Paul Menzel | b2ba395 | 2015-06-12 11:58:14 +0200 | [diff] [blame] | 223 | printf "(downloading from $archive)" |
Stefan Reinauer | 8893548 | 2015-06-05 09:51:10 -0700 | [diff] [blame] | 224 | rm -f tarballs/$FILE |
| 225 | cd tarballs |
zbao | 282dd95 | 2015-09-06 05:00:04 -0400 | [diff] [blame] | 226 | download_showing_percentage $archive |
Stefan Reinauer | 8893548 | 2015-06-05 09:51:10 -0700 | [diff] [blame] | 227 | cd .. |
zbao | 06e85ac | 2015-08-24 22:08:36 -0400 | [diff] [blame] | 228 | compute_sum $FILE |
zbao | d22b9ea | 2015-08-30 23:35:16 -0400 | [diff] [blame] | 229 | fi |
| 230 | |
Stefan Reinauer | dbc0087 | 2015-06-09 11:50:05 -0700 | [diff] [blame] | 231 | if [ ! -f tarballs/$FILE ]; then |
zbao | 282dd95 | 2015-09-06 05:00:04 -0400 | [diff] [blame] | 232 | printf "\n${RED}Failed to download $FILE.${NC}\n" |
Stefan Reinauer | dbc0087 | 2015-06-09 11:50:05 -0700 | [diff] [blame] | 233 | exit 1 |
| 234 | fi |
Stefan Reinauer | 8893548 | 2015-06-05 09:51:10 -0700 | [diff] [blame] | 235 | printf "\n" |
| 236 | } |
| 237 | |
| 238 | unpack_and_patch() { |
Stefan Reinauer | e7757bd | 2015-06-05 13:59:44 -0700 | [diff] [blame] | 239 | package=$1 |
| 240 | archive="$(eval echo \$$package"_ARCHIVE")" |
| 241 | dir="$(eval echo \$$package"_DIR")" |
Stefan Reinauer | 8893548 | 2015-06-05 09:51:10 -0700 | [diff] [blame] | 242 | test -d ${dir} && test -f ${dir}/.unpack_success || ( |
Stefan Reinauer | d764912 | 2015-06-09 11:44:25 -0700 | [diff] [blame] | 243 | printf " * $(basename $archive)\n" |
Stefan Reinauer | 8893548 | 2015-06-05 09:51:10 -0700 | [diff] [blame] | 244 | FLAGS=zxf |
Stefan Reinauer | d764912 | 2015-06-09 11:44:25 -0700 | [diff] [blame] | 245 | suffix=$(echo $archive | sed 's,.*\.,,') |
Stefan Reinauer | 8893548 | 2015-06-05 09:51:10 -0700 | [diff] [blame] | 246 | test "$suffix" = "gz" && FLAGS=zxf |
| 247 | test "$suffix" = "bz2" && FLAGS=jxf |
| 248 | test "$suffix" = "xz" && FLAGS="--xz -xf" |
| 249 | test "$suffix" = "lzma" && FLAGS="--lzma -xf" |
Stefan Reinauer | d764912 | 2015-06-09 11:44:25 -0700 | [diff] [blame] | 250 | $TAR $FLAGS tarballs/$(basename $archive) |
Stefan Reinauer | 8893548 | 2015-06-05 09:51:10 -0700 | [diff] [blame] | 251 | for patch in patches/${dir}_*.patch; do |
| 252 | test -r $patch || continue |
Stefan Reinauer | d764912 | 2015-06-09 11:44:25 -0700 | [diff] [blame] | 253 | printf " o $(basename $patch)\n" |
Stefan Reinauer | 916b845 | 2015-06-09 11:54:49 -0700 | [diff] [blame] | 254 | $PATCH -s -N -p0 < $(echo $patch) || { |
Stefan Reinauer | 8893548 | 2015-06-05 09:51:10 -0700 | [diff] [blame] | 255 | printf "\n${RED}Failed $patch.${NC}\n" |
Stefan Reinauer | 916b845 | 2015-06-09 11:54:49 -0700 | [diff] [blame] | 256 | exit 1 |
| 257 | } |
Stefan Reinauer | 8893548 | 2015-06-05 09:51:10 -0700 | [diff] [blame] | 258 | done |
| 259 | touch ${dir}/.unpack_success |
| 260 | ) |
| 261 | } |
| 262 | |
Stefan Reinauer | 1c70e05 | 2015-06-09 11:47:28 -0700 | [diff] [blame] | 263 | fn_exists() |
| 264 | { |
Patrick Georgi | c866591 | 2015-06-11 21:04:31 +0200 | [diff] [blame] | 265 | type $1 >/dev/null 2>&1 |
Patrick Georgi | 74c0642 | 2015-03-25 18:40:13 +0100 | [diff] [blame] | 266 | } |
| 267 | |
Patrick Georgi | f2c15f5 | 2015-06-11 21:07:31 +0200 | [diff] [blame] | 268 | is_package_enabled() |
| 269 | { |
| 270 | echo "$PACKAGES" |grep -q "\<$1\>" |
| 271 | } |
| 272 | |
Stefan Reinauer | e7757bd | 2015-06-05 13:59:44 -0700 | [diff] [blame] | 273 | build() { |
| 274 | package=$1 |
Stefan Reinauer | 1c70e05 | 2015-06-09 11:47:28 -0700 | [diff] [blame] | 275 | |
| 276 | fn_exists build_$package || return |
| 277 | |
Stefan Reinauer | 05bbc920 | 2015-06-09 12:21:42 -0700 | [diff] [blame] | 278 | version="$(eval echo \$$package"_VERSION")" |
| 279 | BUILDDIR=build-${TARGETARCH}-$package |
| 280 | |
| 281 | mkdir -p ${BUILDDIR} |
Stefan Reinauer | 1c70e05 | 2015-06-09 11:47:28 -0700 | [diff] [blame] | 282 | |
Patrick Georgi | f2c15f5 | 2015-06-11 21:07:31 +0200 | [diff] [blame] | 283 | is_package_enabled "$package" && \ |
Stefan Reinauer | 05bbc920 | 2015-06-09 12:21:42 -0700 | [diff] [blame] | 284 | if [ -f ${BUILDDIR}/.success ]; then |
Stefan Reinauer | e7757bd | 2015-06-05 13:59:44 -0700 | [diff] [blame] | 285 | printf "Skipping $package as it is already built\n" |
| 286 | else |
| 287 | printf "Building $package $version ... " |
Stefan Reinauer | 1c70e05 | 2015-06-09 11:47:28 -0700 | [diff] [blame] | 288 | DIR=$PWD |
Stefan Reinauer | 05bbc920 | 2015-06-09 12:21:42 -0700 | [diff] [blame] | 289 | cd ${BUILDDIR} |
Stefan Reinauer | 1c70e05 | 2015-06-09 11:47:28 -0700 | [diff] [blame] | 290 | rm -f .failed |
| 291 | build_${package} > build.log 2>&1 |
Stefan Reinauer | 05bbc920 | 2015-06-09 12:21:42 -0700 | [diff] [blame] | 292 | cd $DIR/${BUILDDIR} |
Stefan Reinauer | 1c70e05 | 2015-06-09 11:47:28 -0700 | [diff] [blame] | 293 | if [ ! -f .failed ]; then touch .success; fi |
| 294 | cd .. |
| 295 | |
Stefan Reinauer | 05bbc920 | 2015-06-09 12:21:42 -0700 | [diff] [blame] | 296 | if [ -r "${BUILDDIR}/.failed" ]; then |
| 297 | printf "${RED}failed${NC}. Check ${BUILDDIR}/build.log.\n" |
Stefan Reinauer | 1c70e05 | 2015-06-09 11:47:28 -0700 | [diff] [blame] | 298 | exit 1 |
| 299 | fi |
| 300 | printf "${green}ok${NC}\n" |
Stefan Reinauer | e7757bd | 2015-06-05 13:59:44 -0700 | [diff] [blame] | 301 | fi |
| 302 | } |
| 303 | |
Stefan Reinauer | 074d913 | 2009-09-26 16:43:17 +0000 | [diff] [blame] | 304 | cleanup() |
| 305 | { |
| 306 | printf "Cleaning up temporary files... " |
Stefan Reinauer | e7757bd | 2015-06-05 13:59:44 -0700 | [diff] [blame] | 307 | for package in $PACKAGES; do |
Stefan Reinauer | 05bbc920 | 2015-06-09 12:21:42 -0700 | [diff] [blame] | 308 | rm -rf build-${TARGETARCH}-$package $(eval echo \$$package"_DIR") |
Stefan Reinauer | e7757bd | 2015-06-05 13:59:44 -0700 | [diff] [blame] | 309 | done |
zbao | ff3f15c | 2015-08-26 22:00:31 -0400 | [diff] [blame] | 310 | rm -f getopt |
Stefan Reinauer | 074d913 | 2009-09-26 16:43:17 +0000 | [diff] [blame] | 311 | printf "${green}ok${NC}\n" |
| 312 | } |
| 313 | |
| 314 | myhelp() |
| 315 | { |
Stefan Reinauer | 14ce213 | 2015-06-05 13:01:13 -0700 | [diff] [blame] | 316 | printf "Usage: $0 [-V] [-c] [-p <platform>] [-d <target directory>] [-D <dest dir>] [-C] [-G] [-S]\n" |
Stefan Reinauer | 074d913 | 2009-09-26 16:43:17 +0000 | [diff] [blame] | 317 | printf " $0 [-V|--version]\n" |
| 318 | printf " $0 [-h|--help]\n\n" |
| 319 | |
| 320 | printf "Options:\n" |
| 321 | printf " [-V|--version] print version number and exit\n" |
| 322 | printf " [-h|--help] print this help and exit\n" |
| 323 | printf " [-c|--clean] remove temporary files before build\n" |
| 324 | printf " [-t|--savetemps] don't remove temporary files after build\n" |
Patrick Georgi | c1a75b1 | 2011-11-04 21:37:14 +0100 | [diff] [blame] | 325 | printf " [-y|--ccache] Use ccache when building cross compiler\n" |
Martin Roth | 4a53db0 | 2016-03-01 15:21:07 -0700 | [diff] [blame] | 326 | printf " [--nocolor] don't print color codes in output\n" |
Martin Roth | 58c68d5 | 2016-03-01 15:22:42 -0700 | [diff] [blame] | 327 | printf " [--urls] print the urls for all packages\n" |
Patrick Georgi | 73166c7 | 2010-04-14 20:42:42 +0000 | [diff] [blame] | 328 | printf " [-j|--jobs <num>] run <num> jobs in parallel in make\n" |
Martin Roth | edf965a | 2015-11-25 16:58:33 -0700 | [diff] [blame] | 329 | printf " [-s]--supported <tool> print supported version of a tool" |
Stefan Reinauer | 074d913 | 2009-09-26 16:43:17 +0000 | [diff] [blame] | 330 | printf " [-d|--directory <target dir>] target directory to install cross compiler to\n" |
| 331 | printf " (defaults to $TARGETDIR)\n\n" |
| 332 | printf " [-D|--destdir <dest dir>] destination directory to install cross compiler to\n" |
Stefan Reinauer | 2c3cd12 | 2011-11-01 21:43:50 +0100 | [diff] [blame] | 333 | printf " (for RPM builds, default unset)\n" |
Stefan Reinauer | 85b07d6 | 2015-06-09 14:45:14 -0700 | [diff] [blame] | 334 | printf " [-P|--package <package>] Build a specific package: GCC, CLANG, IASL, GDB\n" |
| 335 | printf " (defaults to $PACKAGE)\n" |
| 336 | printf "GCC specific options:\n" |
| 337 | printf " [-p|--platform <platform>] target platform to build cross compiler for\n" |
| 338 | printf " (defaults to $TARGETARCH)\n" |
Nico Huber | bb313bf | 2015-09-08 12:30:27 +0200 | [diff] [blame] | 339 | printf " [-l|--languages <languages>] comma separated list of target languages\n" |
| 340 | printf " (defaults to $LANGUAGES)\n" |
Stefan Reinauer | 85b07d6 | 2015-06-09 14:45:14 -0700 | [diff] [blame] | 341 | printf "GDB specific options:\n" |
| 342 | printf " [-p|--platform <platform>] target platform to build cross compiler for\n" |
| 343 | printf " (defaults to $TARGETARCH)\n" |
| 344 | printf " [-S|--scripting] build scripting support for GDB\n\n" |
Martin Roth | d1da74f | 2015-06-21 12:06:28 -0600 | [diff] [blame] | 345 | printf "Platforms for GCC & GDB:\n" |
Martin Roth | 3e0f74d | 2016-03-08 12:07:04 -0700 | [diff] [blame] | 346 | printf " x86_64 i386-elf i386-mingw32 mipsel-elf riscv-elf arm aarch64\n" |
Jonathan Neuschäfer | f14f640 | 2016-03-11 20:22:23 +0100 | [diff] [blame] | 347 | printf " powerpc64le-linux-gnu nds32le-elf\n\n" |
Stefan Reinauer | 074d913 | 2009-09-26 16:43:17 +0000 | [diff] [blame] | 348 | } |
| 349 | |
Martin Roth | edf965a | 2015-11-25 16:58:33 -0700 | [diff] [blame] | 350 | printversion() { |
| 351 | printf "${blue}Welcome to the ${red}coreboot${blue} cross toolchain builder v$CROSSGCC_VERSION ($CROSSGCC_DATE)${NC}\n\n" |
| 352 | } |
| 353 | |
Stefan Reinauer | 074d913 | 2009-09-26 16:43:17 +0000 | [diff] [blame] | 354 | myversion() |
| 355 | { |
Martin Roth | edf965a | 2015-11-25 16:58:33 -0700 | [diff] [blame] | 356 | printversion |
Stefan Reinauer | 074d913 | 2009-09-26 16:43:17 +0000 | [diff] [blame] | 357 | |
| 358 | cat << EOF |
Stefan Reinauer | 5f1ad89 | 2010-05-17 11:02:25 +0000 | [diff] [blame] | 359 | Copyright (C) 2008-2010 by coresystems GmbH |
Marc Jones | 2aac3f6 | 2011-08-08 16:07:50 -0600 | [diff] [blame] | 360 | Copyright (C) 2011 by Sage Electronic Engineering |
Stefan Reinauer | 074d913 | 2009-09-26 16:43:17 +0000 | [diff] [blame] | 361 | |
| 362 | This program is free software; you can redistribute it and/or modify |
| 363 | it under the terms of the GNU General Public License as published by |
| 364 | the Free Software Foundation; version 2 of the License. |
| 365 | |
| 366 | This program is distributed in the hope that it will be useful, |
| 367 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 368 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 369 | GNU General Public License for more details. |
| 370 | |
| 371 | EOF |
| 372 | } |
| 373 | |
Stefan Reinauer | e7757bd | 2015-06-05 13:59:44 -0700 | [diff] [blame] | 374 | build_GMP() { |
| 375 | CC="$CC" CFLAGS="-Os" ../${GMP_DIR}/configure --disable-shared --enable-fat --prefix=$TARGETDIR $OPTIONS \ |
| 376 | || touch .failed |
| 377 | $MAKE $JOBS || touch .failed |
| 378 | $MAKE install DESTDIR=$DESTDIR || touch .failed |
| 379 | |
| 380 | normalize_dirs |
Stefan Reinauer | 1c70e05 | 2015-06-09 11:47:28 -0700 | [diff] [blame] | 381 | |
| 382 | # Now set CFLAGS to match GMP CFLAGS but strip out -pedantic |
| 383 | # as GCC 4.6.x fails if it's there. |
| 384 | export HOSTCFLAGS=$(grep __GMP_CFLAGS $DESTDIR$TARGETDIR/include/gmp.h |cut -d\" -f2 |\ |
| 385 | sed s,-pedantic,,) |
Stefan Reinauer | e7757bd | 2015-06-05 13:59:44 -0700 | [diff] [blame] | 386 | } |
| 387 | |
| 388 | build_MPFR() { |
| 389 | test $UNAME = "Darwin" && CFLAGS="$CFLAGS -force_cpusubtype_ALL" |
| 390 | CC="$CC" ../${MPFR_DIR}/configure --disable-shared --prefix=$TARGETDIR \ |
| 391 | --infodir=$TARGETDIR/info \ |
| 392 | --with-gmp=$DESTDIR$TARGETDIR CFLAGS="$HOSTCFLAGS" || \ |
| 393 | touch .failed |
| 394 | $MAKE $JOBS || touch .failed |
| 395 | $MAKE install DESTDIR=$DESTDIR || touch .failed |
| 396 | |
| 397 | normalize_dirs |
| 398 | |
| 399 | # work around build problem of libgmp.la |
| 400 | if [ "$DESTDIR" != "" ]; then |
| 401 | perl -pi -e "s,$DESTDIR,," $DESTDIR$TARGETDIR/libgmp.la |
| 402 | fi |
| 403 | } |
| 404 | |
| 405 | build_MPC() { |
| 406 | CC="$CC" ../${MPC_DIR}/configure --disable-shared --prefix=$TARGETDIR \ |
| 407 | --infodir=$TARGETDIR/info --with-mpfr=$DESTDIR$TARGETDIR \ |
| 408 | --with-gmp=$DESTDIR$TARGETDIR CFLAGS="$HOSTCFLAGS" || \ |
| 409 | touch .failed |
| 410 | $MAKE $JOBS || touch .failed |
| 411 | $MAKE install DESTDIR=$DESTDIR || touch .failed |
| 412 | |
| 413 | normalize_dirs |
| 414 | } |
| 415 | |
| 416 | build_LIBELF() { |
| 417 | CC="$CC" CFLAGS="$HOSTCFLAGS" libelf_cv_elf_h_works=no \ |
| 418 | ../${LIBELF_DIR}/configure --disable-shared --prefix=$TARGETDIR \ |
| 419 | --infodir=$TARGETDIR/info CFLAGS="$HOSTCFLAGS" || touch .failed |
| 420 | $MAKE $JOBS || touch .failed |
| 421 | $MAKE install prefix=$DESTDIR$TARGETDIR || touch .failed |
| 422 | |
| 423 | normalize_dirs |
| 424 | } |
| 425 | |
| 426 | build_BINUTILS() { |
Stefan Reinauer | 682a90c | 2015-06-09 14:59:58 -0700 | [diff] [blame] | 427 | if [ $TARGETARCH == "x86_64-elf" ]; then |
| 428 | ADDITIONALTARGET=",i386-elf" |
| 429 | fi |
Stefan Reinauer | e7757bd | 2015-06-05 13:59:44 -0700 | [diff] [blame] | 430 | CC="$CC" ../binutils-${BINUTILS_VERSION}/configure --prefix=$TARGETDIR \ |
Stefan Reinauer | 682a90c | 2015-06-09 14:59:58 -0700 | [diff] [blame] | 431 | --target=${TARGETARCH} --enable-targets=${TARGETARCH}${ADDITIONALTARGET} \ |
| 432 | --disable-werror --disable-nls --enable-lto --enable-gold \ |
| 433 | --enable-plugins --enable-multilibs CFLAGS="$HOSTCFLAGS" || touch .failed |
Stefan Reinauer | e7757bd | 2015-06-05 13:59:44 -0700 | [diff] [blame] | 434 | $MAKE $JOBS || touch .failed |
| 435 | $MAKE install DESTDIR=$DESTDIR || touch .failed |
| 436 | } |
| 437 | |
| 438 | |
| 439 | build_GCC() { |
Stefan Reinauer | d0f8372 | 2015-06-09 11:52:28 -0700 | [diff] [blame] | 440 | # GCC does not honor HOSTCFLAGS at all. CFLAGS are used for |
| 441 | # both target and host object files. |
Stefan Reinauer | e7757bd | 2015-06-05 13:59:44 -0700 | [diff] [blame] | 442 | # There's a work-around called CFLAGS_FOR_BUILD and CFLAGS_FOR_TARGET |
| 443 | # but it does not seem to work properly. At least the host library |
| 444 | # libiberty is not compiled with CFLAGS_FOR_BUILD. |
Patrick Georgi | 0a97d7e | 2016-01-25 09:51:22 +0100 | [diff] [blame] | 445 | CC="$CC" CFLAGS_FOR_TARGET="-O2 -Dinhibit_libc" CFLAGS="$HOSTCFLAGS" \ |
Stefan Reinauer | e7757bd | 2015-06-05 13:59:44 -0700 | [diff] [blame] | 446 | CFLAGS_FOR_BUILD="$HOSTCFLAGS" ../gcc-${GCC_VERSION}/configure \ |
| 447 | --prefix=$TARGETDIR --libexecdir=$TARGETDIR/lib \ |
| 448 | --target=${TARGETARCH} --disable-werror --disable-shared \ |
Stefan Reinauer | 2f97ebc | 2015-06-09 12:24:54 -0700 | [diff] [blame] | 449 | --enable-lto --enable-plugins --enable-gold --enable-ld=default \ |
Stefan Reinauer | e7757bd | 2015-06-05 13:59:44 -0700 | [diff] [blame] | 450 | --disable-libssp --disable-bootstrap --disable-nls \ |
| 451 | --disable-libquadmath --without-headers \ |
Patrick Georgi | 0a97d7e | 2016-01-25 09:51:22 +0100 | [diff] [blame] | 452 | --disable-threads \ |
Patrick Georgi | 1fc02d1 | 2016-03-23 21:44:43 +0100 | [diff] [blame^] | 453 | --enable-interwork --enable-multilib --enable-targets=all \ |
Patrick Georgi | 0a97d7e | 2016-01-25 09:51:22 +0100 | [diff] [blame] | 454 | --disable-libatomic --disable-libcc1 --disable-decimal-float \ |
Nico Huber | bb313bf | 2015-09-08 12:30:27 +0200 | [diff] [blame] | 455 | ${GCC_OPTIONS} --enable-languages="${LANGUAGES}" \ |
Ronald G. Minnich | 7ee16b7 | 2016-02-12 21:54:59 +0000 | [diff] [blame] | 456 | --with-system-zlib \ |
Stefan Reinauer | e7757bd | 2015-06-05 13:59:44 -0700 | [diff] [blame] | 457 | --with-gmp=$DESTDIR$TARGETDIR --with-mpfr=$DESTDIR$TARGETDIR \ |
| 458 | --with-mpc=$DESTDIR$TARGETDIR --with-libelf=$DESTDIR$TARGETDIR \ |
| 459 | --with-pkgversion="coreboot toolchain v$CROSSGCC_VERSION $CROSSGCC_DATE" \ |
| 460 | || touch .failed |
| 461 | $MAKE $JOBS CFLAGS_FOR_BUILD="$HOSTCFLAGS" all-gcc || touch .failed |
| 462 | $MAKE install-gcc DESTDIR=$DESTDIR || touch .failed |
| 463 | |
Stefan Reinauer | d764912 | 2015-06-09 11:44:25 -0700 | [diff] [blame] | 464 | if [ "$(echo $TARGETARCH | grep -c -- -mingw32)" -eq 0 ]; then |
Stefan Reinauer | e7757bd | 2015-06-05 13:59:44 -0700 | [diff] [blame] | 465 | $MAKE $JOBS CFLAGS_FOR_BUILD="$HOSTCFLAGS" all-target-libgcc || touch .failed |
| 466 | $MAKE install-target-libgcc DESTDIR=$DESTDIR || touch .failed |
| 467 | fi |
| 468 | } |
| 469 | |
| 470 | build_EXPAT() { |
| 471 | CC="$CC" CFLAGS="$HOSTCFLAGS" ../${EXPAT_DIR}/configure --disable-shared \ |
| 472 | --prefix=$TARGETDIR --target=${TARGETARCH} || touch .failed |
| 473 | $MAKE || touch .failed |
| 474 | $MAKE install DESTDIR=$DESTDIR || touch .failed |
| 475 | |
| 476 | normalize_dirs |
| 477 | } |
| 478 | |
| 479 | build_PYTHON() { |
| 480 | CC="$CC" CFLAGS="$HOSTCFLAGS" ../${PYTHON_DIR}/configure --prefix=$TARGETDIR \ |
| 481 | --target=${TARGETARCH} || touch .failed |
| 482 | $MAKE $JOBS || touch .failed |
| 483 | $MAKE install DESTDIR=$DESTDIR || touch .failed |
| 484 | |
| 485 | normalize_dirs |
| 486 | } |
| 487 | |
| 488 | build_GDB() { |
| 489 | export PYTHONHOME=$DESTDIR$TARGETDIR |
| 490 | if [ $(uname) != "FreeBSD" -a $(uname) != "NetBSD" ]; then |
| 491 | LIBDL="-ldl" |
| 492 | fi |
| 493 | LDFLAGS="-Wl,-rpath,\$\$ORIGIN/../lib/ -L$DESTDIR$TARGETDIR/lib \ |
| 494 | -lpthread $LIBDL -lutil" \ |
| 495 | CC="$CC" CFLAGS="$HOSTCFLAGS -I$DESTDIR$TARGETDIR/include" \ |
Stefan Reinauer | 7b40e42 | 2015-06-09 11:56:32 -0700 | [diff] [blame] | 496 | ../${GDB_DIR}/configure --prefix=$TARGETDIR \ |
Stefan Reinauer | e7757bd | 2015-06-05 13:59:44 -0700 | [diff] [blame] | 497 | --target=${TARGETARCH} --disable-werror --disable-nls |
| 498 | $MAKE $JOBS || touch .failed |
| 499 | $MAKE install DESTDIR=$DESTDIR || touch .failed |
| 500 | } |
| 501 | |
| 502 | build_IASL() { |
| 503 | RDIR=$PWD |
| 504 | cd ../$IASL_DIR/generate/unix |
| 505 | CFLAGS="$HOSTCFLAGS" |
| 506 | HOST="_LINUX" |
| 507 | test $UNAME = "Darwin" && HOST="_APPLE" |
| 508 | test $UNAME = "FreeBSD" && HOST="_FreeBSD" |
| 509 | test $UNAME = "Cygwin" && HOST="_CYGWIN" |
Martin Roth | 6f65613 | 2015-12-08 11:14:10 -0700 | [diff] [blame] | 510 | HOST="$HOST" OPT_CFLAGS="-O -D_FORTIFY_SOURCE=2 -D COREBOOT_TOOLCHAIN_VERSION='\"coreboot toolchain v$CROSSGCC_VERSION $CROSSGCC_DATE\"' " CFLAGS="$CFLAGS" $MAKE CC="$CC" iasl || touch $RDIR/.failed |
Stefan Reinauer | e7757bd | 2015-06-05 13:59:44 -0700 | [diff] [blame] | 511 | rm -f $DESTDIR$TARGETDIR/bin/iasl || touch $RDIR/.failed |
| 512 | cp bin/iasl $DESTDIR$TARGETDIR/bin || touch $RDIR/.failed |
| 513 | } |
| 514 | |
| 515 | build_LLVM() { |
| 516 | cd .. |
| 517 | ln -sf $PWD/$CFE_DIR $LLVM_DIR/tools/clang |
| 518 | ln -sf $PWD/$CTE_DIR $LLVM_DIR/tools/clang/tools/extra |
| 519 | ln -sf $PWD/$CRT_DIR $LLVM_DIR/projects/compiler-rt |
| 520 | cd - |
| 521 | |
| 522 | $CMAKE -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=$DESTDIR$TARGETDIR \ |
Martin Roth | fb5647a | 2015-12-18 09:26:45 -0700 | [diff] [blame] | 523 | -DCLANG_VENDOR="coreboot toolchain v$CROSSGCC_VERSION $CROSSGCC_DATE - " \ |
Stefan Reinauer | e7757bd | 2015-06-05 13:59:44 -0700 | [diff] [blame] | 524 | -DCMAKE_BUILD_TYPE=Release ../$LLVM_DIR || touch .failed |
| 525 | $MAKE $JOBS || touch .failed |
| 526 | $MAKE install || touch .failed |
| 527 | |
| 528 | cp -a ../$CFE_DIR/tools/scan-build/* $DESTDIR$TARGETDIR/bin |
| 529 | cp -a ../$CFE_DIR/tools/scan-view/* $DESTDIR$TARGETDIR/bin |
Stefan Reinauer | e9e6e3d | 2015-07-07 00:20:42 +0200 | [diff] [blame] | 530 | |
| 531 | # create symlinks to work around broken --print-librt-file-name |
| 532 | # when used with -target. |
| 533 | cd $DESTDIR$TARGETDIR/lib/clang/${CLANG_VERSION}/lib |
| 534 | for i in */libclang_rt.builtins*.a; do |
| 535 | ln -s $i . |
| 536 | done |
Stefan Reinauer | e7757bd | 2015-06-05 13:59:44 -0700 | [diff] [blame] | 537 | } |
| 538 | |
Stefan Reinauer | a851bbb | 2016-01-29 18:03:26 -0800 | [diff] [blame] | 539 | build_MAKE() { |
| 540 | CC="$CC" CFLAGS="$HOSTCFLAGS" ../${MAKE_DIR}/configure --prefix=$TARGETDIR \ |
| 541 | --disable-nls || touch .failed |
| 542 | $MAKE $JOBS || touch .failed |
| 543 | $MAKE install DESTDIR=$DESTDIR || touch .failed |
| 544 | |
| 545 | normalize_dirs |
| 546 | } |
| 547 | |
Martin Roth | edf965a | 2015-11-25 16:58:33 -0700 | [diff] [blame] | 548 | print_stable() { |
| 549 | case "$PRINTSTABLE" in |
| 550 | AUTOCONF|autoconf) printf "%s\n" "$GCC_AUTOCONF_VERSION";; |
| 551 | BINUTILS|binutils) printf "%s\n" "$BINUTILS_VERSION";; |
| 552 | CLANG|clang) printf "%s\n" "$CLANG_VERSION";; |
| 553 | EXPAT|expat) printf "%s\n" "$EXPAT_VERSION";; |
| 554 | GCC|gcc) printf "%s\n" "$GCC_VERSION";; |
| 555 | GDB|gdb) printf "%s\n" "$GDB_VERSION";; |
| 556 | GMP|gmp) printf "%s\n" "$GMP_VERSION";; |
| 557 | IASL|iasl) printf "%s\n" "$IASL_VERSION";; |
| 558 | LIBELF|libelf) printf "%s\n" "$LIBELF_VERSION";; |
| 559 | MPC|mpc) printf "%s\n" "$MPC_VERSION";; |
| 560 | MPFR|mpfr) printf "%s\n" "$MPFR_VERSION";; |
| 561 | PYTHON|python) printf "%s\n" "$PYTHON_VERSION";; |
Stefan Reinauer | a851bbb | 2016-01-29 18:03:26 -0800 | [diff] [blame] | 562 | MAKE|make) printf "%s\n" "$MAKE_VERSION";; |
Martin Roth | edf965a | 2015-11-25 16:58:33 -0700 | [diff] [blame] | 563 | *) printf "Unknown tool %s\n" "$PRINTSTABLE";; |
| 564 | esac |
| 565 | } |
Stefan Reinauer | 074d913 | 2009-09-26 16:43:17 +0000 | [diff] [blame] | 566 | |
Patrick Georgi | 6bba29f | 2010-01-29 17:40:52 +0000 | [diff] [blame] | 567 | # Look if we have getopt. If not, build it. |
| 568 | export PATH=$PATH:. |
| 569 | getopt - > /dev/null 2>/dev/null || gcc -o getopt getopt.c |
| 570 | |
Stefan Reinauer | 074d913 | 2009-09-26 16:43:17 +0000 | [diff] [blame] | 571 | # parse parameters.. try to find out whether we're running GNU getopt |
Stefan Reinauer | d764912 | 2015-06-09 11:44:25 -0700 | [diff] [blame] | 572 | getoptbrand="$(getopt -V | sed -e '1!d' -e 's,^\(......\).*,\1,')" |
Peter Stuge | 09377b7 | 2011-08-21 06:24:55 +0200 | [diff] [blame] | 573 | if [ "${getoptbrand}" = "getopt" ]; then |
Stefan Reinauer | 074d913 | 2009-09-26 16:43:17 +0000 | [diff] [blame] | 574 | # Detected GNU getopt that supports long options. |
Martin Roth | edf965a | 2015-11-25 16:58:33 -0700 | [diff] [blame] | 575 | args=$(getopt -l version,help,clean,directory:,platform:,languages:,package:,jobs:,destdir:,savetemps,scripting,ccache,supported: Vhcd:p:l:P:j:D:tSys: -- "$@") |
Stefan Reinauer | 074d913 | 2009-09-26 16:43:17 +0000 | [diff] [blame] | 576 | eval set "$args" |
| 577 | else |
| 578 | # Detected non-GNU getopt |
Martin Roth | edf965a | 2015-11-25 16:58:33 -0700 | [diff] [blame] | 579 | args=$(getopt Vhcd:p:l:P:j:D:tSys: $*) |
Stefan Reinauer | 074d913 | 2009-09-26 16:43:17 +0000 | [diff] [blame] | 580 | set -- $args |
| 581 | fi |
| 582 | |
| 583 | if [ $? != 0 ]; then |
| 584 | myhelp |
| 585 | exit 1 |
| 586 | fi |
| 587 | |
| 588 | while true ; do |
| 589 | case "$1" in |
| 590 | -V|--version) shift; myversion; exit 0;; |
| 591 | -h|--help) shift; myhelp; exit 0;; |
Patrick Georgi | 44af57a | 2013-12-19 22:06:22 +0100 | [diff] [blame] | 592 | -c|--clean) shift; clean=1;; |
Stefan Reinauer | 074d913 | 2009-09-26 16:43:17 +0000 | [diff] [blame] | 593 | -t|--savetemps) shift; SAVETEMPS=1;; |
| 594 | -d|--directory) shift; TARGETDIR="$1"; shift;; |
| 595 | -p|--platform) shift; TARGETARCH="$1"; shift;; |
Nico Huber | bb313bf | 2015-09-08 12:30:27 +0200 | [diff] [blame] | 596 | -l|--languages) shift; LANGUAGES="$1"; shift;; |
Stefan Reinauer | 074d913 | 2009-09-26 16:43:17 +0000 | [diff] [blame] | 597 | -D|--destdir) shift; DESTDIR="$1"; shift;; |
Patrick Georgi | 73166c7 | 2010-04-14 20:42:42 +0000 | [diff] [blame] | 598 | -j|--jobs) shift; JOBS="-j $1"; shift;; |
Stefan Reinauer | 85b07d6 | 2015-06-09 14:45:14 -0700 | [diff] [blame] | 599 | -P|--package) shift; PACKAGE="$1"; shift;; |
Stefan Reinauer | 2c3cd12 | 2011-11-01 21:43:50 +0100 | [diff] [blame] | 600 | -S|--scripting) shift; SKIPPYTHON=0;; |
Patrick Georgi | c1a75b1 | 2011-11-04 21:37:14 +0100 | [diff] [blame] | 601 | -y|--ccache) shift; USECCACHE=1;; |
Martin Roth | edf965a | 2015-11-25 16:58:33 -0700 | [diff] [blame] | 602 | -s|--supported) shift; PRINTSTABLE="$1"; shift;; |
Martin Roth | 58c68d5 | 2016-03-01 15:22:42 -0700 | [diff] [blame] | 603 | --urls) shift; printf "%s\n" "$ALL_ARCHIVES"; exit 0;; |
Martin Roth | 4a53db0 | 2016-03-01 15:21:07 -0700 | [diff] [blame] | 604 | --nocolor) shift; \ |
| 605 | unset red RED green GREEN blue BLUE cyan CYAN NC;; |
Patrick Georgi | d2e0dd5 | 2013-06-09 08:05:45 +0200 | [diff] [blame] | 606 | --) shift; break;; |
Stefan Reinauer | 074d913 | 2009-09-26 16:43:17 +0000 | [diff] [blame] | 607 | -*) printf "Invalid option\n\n"; myhelp; exit 1;; |
Patrick Georgi | d2e0dd5 | 2013-06-09 08:05:45 +0200 | [diff] [blame] | 608 | *) break;; |
Stefan Reinauer | 074d913 | 2009-09-26 16:43:17 +0000 | [diff] [blame] | 609 | esac |
| 610 | done |
| 611 | |
Martin Roth | edf965a | 2015-11-25 16:58:33 -0700 | [diff] [blame] | 612 | if [ -n "$PRINTSTABLE" ]; then |
| 613 | print_stable |
| 614 | exit 0 |
| 615 | fi |
| 616 | |
| 617 | #print toolchain builder version string as the header |
| 618 | printversion |
| 619 | |
Ronald G. Minnich | b460a66 | 2013-05-26 05:33:35 -0700 | [diff] [blame] | 620 | case "$TARGETARCH" in |
Timothy Pearson | a9f6235 | 2015-12-30 18:59:00 -0600 | [diff] [blame] | 621 | x86_64-elf) ;; |
| 622 | x86_64*) TARGETARCH=x86_64-elf;; |
| 623 | i386-elf) ;; |
| 624 | i386-mingw32) ;; |
| 625 | mipsel-elf) ;; |
| 626 | riscv-elf) ;; |
Patrick Georgi | 0a97d7e | 2016-01-25 09:51:22 +0100 | [diff] [blame] | 627 | powerpc64*-linux*) ;; |
Timothy Pearson | a9f6235 | 2015-12-30 18:59:00 -0600 | [diff] [blame] | 628 | i386*) TARGETARCH=i386-elf;; |
Stefan Reinauer | 27522ad | 2016-01-29 17:31:34 -0800 | [diff] [blame] | 629 | arm*) TARGETARCH=arm-eabi;; |
Timothy Pearson | a9f6235 | 2015-12-30 18:59:00 -0600 | [diff] [blame] | 630 | aarch64*) TARGETARCH=aarch64-elf;; |
Martin Roth | 3e0f74d | 2016-03-08 12:07:04 -0700 | [diff] [blame] | 631 | nds32le-elf) ;; |
Timothy Pearson | a9f6235 | 2015-12-30 18:59:00 -0600 | [diff] [blame] | 632 | *) printf "${red}WARNING: Unsupported architecture $TARGETARCH.${NC}\n\n"; ;; |
Ronald G. Minnich | b460a66 | 2013-05-26 05:33:35 -0700 | [diff] [blame] | 633 | esac |
| 634 | |
Stefan Reinauer | 5dd2635 | 2015-06-09 14:52:22 -0700 | [diff] [blame] | 635 | # Figure out which packages to build |
Stefan Reinauer | 699ac27 | 2015-06-05 12:43:28 -0700 | [diff] [blame] | 636 | |
Stefan Reinauer | 85b07d6 | 2015-06-09 14:45:14 -0700 | [diff] [blame] | 637 | case "$PACKAGE" in |
| 638 | GCC|gcc) |
| 639 | echo "Target architecture is now $TARGETARCH" |
| 640 | NAME="${TARGETARCH} cross GCC" |
Stefan Reinauer | bd8b2e3 | 2015-06-17 11:55:02 -0700 | [diff] [blame] | 641 | PACKAGES="GMP MPFR MPC LIBELF BINUTILS GCC" |
Stefan Reinauer | 85b07d6 | 2015-06-09 14:45:14 -0700 | [diff] [blame] | 642 | ;; |
| 643 | GDB|gdb) |
| 644 | NAME="${TARGETARCH} cross GDB" |
Stefan Reinauer | 85b07d6 | 2015-06-09 14:45:14 -0700 | [diff] [blame] | 645 | if [ $SKIPPYTHON -eq 0 ]; then |
Ronald G. Minnich | fb944f4 | 2016-02-27 04:06:42 +0000 | [diff] [blame] | 646 | PACKAGES="EXPAT PYTHON GDB" |
| 647 | else |
| 648 | PACKAGES="EXPAT GDB" |
Stefan Reinauer | 85b07d6 | 2015-06-09 14:45:14 -0700 | [diff] [blame] | 649 | fi |
| 650 | ;; |
| 651 | CLANG|clang) |
| 652 | NAME=clang |
| 653 | PACKAGES="LLVM CFE CRT CTE" |
David Hendricks | cd5cdd3 | 2015-06-15 17:03:22 -0700 | [diff] [blame] | 654 | CMAKE=$(searchtool cmake "cmake") || exit $? |
Stefan Reinauer | 85b07d6 | 2015-06-09 14:45:14 -0700 | [diff] [blame] | 655 | ;; |
| 656 | IASL|iasl) |
| 657 | NAME="IASL ACPI compiler" |
| 658 | PACKAGES=IASL |
| 659 | ;; |
Stefan Reinauer | a851bbb | 2016-01-29 18:03:26 -0800 | [diff] [blame] | 660 | MAKE|make) |
| 661 | NAME="GNU Make" |
| 662 | PACKAGES=MAKE |
| 663 | ;; |
Stefan Reinauer | 85b07d6 | 2015-06-09 14:45:14 -0700 | [diff] [blame] | 664 | *) |
Stefan Reinauer | a851bbb | 2016-01-29 18:03:26 -0800 | [diff] [blame] | 665 | printf "${red}ERROR: Unsupported package $PACKAGE. (Supported packages are GCC, GDB, CLANG, IASL, MAKE)${NC}\n\n"; |
Stefan Reinauer | 85b07d6 | 2015-06-09 14:45:14 -0700 | [diff] [blame] | 666 | exit 1 |
| 667 | ;; |
| 668 | esac |
Peter Stuge | ceacd77 | 2011-06-09 04:54:16 +0200 | [diff] [blame] | 669 | |
Stefan Reinauer | 66e9335 | 2015-06-16 22:38:23 +0200 | [diff] [blame] | 670 | # Find all the required tools: |
| 671 | |
| 672 | TAR=$(searchtool tar) || exit $? |
| 673 | PATCH=$(searchtool patch) || exit $? |
| 674 | MAKE=$(searchtool make) || exit $? |
| 675 | SHA1SUM=$(searchtool sha1sum) |
| 676 | SHA512SUM=$(searchtool sha512sum) |
| 677 | CHECKSUM=$SHA1SUM |
| 678 | |
| 679 | searchtool m4 > /dev/null |
| 680 | searchtool bison > /dev/null |
| 681 | searchtool flex flex > /dev/null |
| 682 | searchtool g++ "Free Software Foundation" nofail > /dev/null || \ |
Marc Jones | 5ee6951 | 2015-06-17 15:38:17 -0600 | [diff] [blame] | 683 | searchtool clang "clang version" nofail > /dev/null || \ |
Martin Roth | e396317 | 2016-01-06 13:54:32 -0700 | [diff] [blame] | 684 | searchtool clang "LLVM" "" "g++" > /dev/null |
Stefan Reinauer | 66e9335 | 2015-06-16 22:38:23 +0200 | [diff] [blame] | 685 | searchtool wget > /dev/null |
| 686 | searchtool bzip2 "bzip2," > /dev/null |
| 687 | |
Martin Roth | 8846382 | 2016-01-07 11:03:36 -0700 | [diff] [blame] | 688 | if [ "$HALT_FOR_TOOLS" -ne 0 ]; then |
| 689 | exit 1 |
| 690 | fi |
| 691 | |
Stefan Reinauer | 5dd2635 | 2015-06-09 14:52:22 -0700 | [diff] [blame] | 692 | # This initial cleanup is useful when updating the toolchain script. |
Stefan Reinauer | 5f1ad89 | 2010-05-17 11:02:25 +0000 | [diff] [blame] | 693 | |
Stefan Reinauer | 5dd2635 | 2015-06-09 14:52:22 -0700 | [diff] [blame] | 694 | if [ "$clean" = "1" ]; then |
| 695 | cleanup |
| 696 | fi |
Stefan Reinauer | 074d913 | 2009-09-26 16:43:17 +0000 | [diff] [blame] | 697 | |
Stefan Reinauer | 5dd2635 | 2015-06-09 14:52:22 -0700 | [diff] [blame] | 698 | # Set up host compiler and flags needed for various OSes |
Stefan Reinauer | 074d913 | 2009-09-26 16:43:17 +0000 | [diff] [blame] | 699 | |
Stefan Reinauer | 9491b4d | 2011-10-11 22:37:59 -0700 | [diff] [blame] | 700 | CC=cc |
Patrick Georgi | f2c15f5 | 2015-06-11 21:07:31 +0200 | [diff] [blame] | 701 | if is_package_enabled "GCC"; then |
Stefan Reinauer | 0d2119d | 2013-07-10 14:27:56 -0700 | [diff] [blame] | 702 | if [ $UNAME = "Darwin" ]; then |
Stefan Reinauer | 5f1ad89 | 2010-05-17 11:02:25 +0000 | [diff] [blame] | 703 | #GCC_OPTIONS="$GCC_OPTIONS --enable-threads=posix" |
| 704 | |
| 705 | # generally the OS X compiler can create x64 binaries. |
| 706 | # Per default it generated i386 binaries in 10.5 and x64 |
| 707 | # binaries in 10.6 (even if the kernel is 32bit) |
| 708 | # For some weird reason, 10.5 autodetects an ABI=64 though |
| 709 | # so we're setting the ABI explicitly here. |
Stefan Reinauer | d764912 | 2015-06-09 11:44:25 -0700 | [diff] [blame] | 710 | if [ $(sysctl -n hw.optional.x86_64 2>/dev/null) -eq 1 ] 2>/dev/null; then |
Stefan Reinauer | 5f1ad89 | 2010-05-17 11:02:25 +0000 | [diff] [blame] | 711 | OPTIONS="ABI=64" |
| 712 | else |
| 713 | OPTIONS="ABI=32" |
| 714 | fi |
Stefan Reinauer | 9491b4d | 2011-10-11 22:37:59 -0700 | [diff] [blame] | 715 | |
Stefan Reinauer | 4266b92 | 2012-12-05 16:18:32 -0800 | [diff] [blame] | 716 | # In Xcode 4.5.2 the default compiler is clang. |
| 717 | # However, this compiler fails to compile gcc 4.7.x. As a |
| 718 | # workaround it's possible to compile gcc with llvm-gcc. |
Stefan Reinauer | 9491b4d | 2011-10-11 22:37:59 -0700 | [diff] [blame] | 719 | if $CC -v 2>&1 | grep -q LLVM; then |
Stefan Reinauer | 4266b92 | 2012-12-05 16:18:32 -0800 | [diff] [blame] | 720 | CC=llvm-gcc |
Stefan Reinauer | 9491b4d | 2011-10-11 22:37:59 -0700 | [diff] [blame] | 721 | fi |
zbao | 11f1d31 | 2015-08-05 23:15:54 -0400 | [diff] [blame] | 722 | elif [ $UNAME = "Linux" -o $UNAME = "Cygwin" ]; then |
Patrick Georgi | ddb8f80 | 2015-07-04 17:45:54 +0200 | [diff] [blame] | 723 | # gmp is overeager with detecting 64bit CPUs even if they run |
| 724 | # a 32bit kernel and userland. |
| 725 | if [ "$(uname -m 2>/dev/null)" = "i686" ]; then |
| 726 | OPTIONS="ABI=32" |
| 727 | fi |
Nico Huber | de45c59 | 2016-01-20 23:22:33 +0100 | [diff] [blame] | 728 | elif [ $UNAME = "NetBSD" ]; then |
| 729 | # same for NetBSD but this one reports an i386 |
| 730 | if [ "$(uname -m 2>/dev/null)" = "i386" ]; then |
| 731 | OPTIONS="ABI=32" |
| 732 | fi |
Stefan Reinauer | 5f1ad89 | 2010-05-17 11:02:25 +0000 | [diff] [blame] | 733 | fi |
Stefan Reinauer | 14ce213 | 2015-06-05 13:01:13 -0700 | [diff] [blame] | 734 | fi # GCC |
Stefan Reinauer | 5f1ad89 | 2010-05-17 11:02:25 +0000 | [diff] [blame] | 735 | |
Patrick Georgi | c1a75b1 | 2011-11-04 21:37:14 +0100 | [diff] [blame] | 736 | if [ "$USECCACHE" = 1 ]; then |
| 737 | CC="ccache $CC" |
| 738 | fi |
| 739 | |
Stefan Reinauer | 5dd2635 | 2015-06-09 14:52:22 -0700 | [diff] [blame] | 740 | # Prepare target directory for building GCC |
| 741 | # (dependencies must be in the PATH) |
Stefan Reinauer | 16bd789 | 2012-12-07 23:57:01 +0100 | [diff] [blame] | 742 | mkdir -p $DESTDIR$TARGETDIR/bin |
| 743 | export PATH=$DESTDIR$TARGETDIR/bin:$PATH |
| 744 | |
Stefan Reinauer | 5dd2635 | 2015-06-09 14:52:22 -0700 | [diff] [blame] | 745 | # Download, unpack, patch and build all packages |
| 746 | |
Martin Roth | 0362517 | 2016-02-17 14:44:14 -0700 | [diff] [blame] | 747 | printf "Downloading tarballs ... \n" |
Stefan Reinauer | 5dd2635 | 2015-06-09 14:52:22 -0700 | [diff] [blame] | 748 | mkdir -p tarballs |
| 749 | for P in $PACKAGES; do |
| 750 | download $P |
| 751 | done |
Martin Roth | 0362517 | 2016-02-17 14:44:14 -0700 | [diff] [blame] | 752 | printf "Downloaded tarballs ... ${green}ok${NC}\n" |
Stefan Reinauer | 5dd2635 | 2015-06-09 14:52:22 -0700 | [diff] [blame] | 753 | |
| 754 | printf "Unpacking and patching ... \n" |
| 755 | for P in $PACKAGES; do |
| 756 | unpack_and_patch $P || exit 1 |
| 757 | done |
| 758 | printf "Unpacked and patched ... ${green}ok${NC}\n" |
| 759 | |
| 760 | printf "Building packages ... \n" |
Stefan Reinauer | 1c70e05 | 2015-06-09 11:47:28 -0700 | [diff] [blame] | 761 | for package in $PACKAGES; do |
| 762 | build $package |
| 763 | done |
Stefan Reinauer | 5dd2635 | 2015-06-09 14:52:22 -0700 | [diff] [blame] | 764 | printf "Packages built ... ${green}ok${NC}\n" |
Stefan Reinauer | 14ce213 | 2015-06-05 13:01:13 -0700 | [diff] [blame] | 765 | |
Stefan Reinauer | 699ac27 | 2015-06-05 12:43:28 -0700 | [diff] [blame] | 766 | # Adding git information of current tree to target directory |
| 767 | # for reproducibility |
Stefan Reinauer | d764912 | 2015-06-09 11:44:25 -0700 | [diff] [blame] | 768 | PROGNAME=$(basename "$0") |
Patrick Georgi | 5602f2c | 2015-03-28 15:48:47 +0100 | [diff] [blame] | 769 | rm -f "$DESTDIR$TARGETDIR/$PROGNAME".commit.* |
Stefan Reinauer | d764912 | 2015-06-09 11:44:25 -0700 | [diff] [blame] | 770 | cp "$PROGNAME" $DESTDIR$TARGETDIR/"$PROGNAME.commit.$(git describe)" |
Zheng Bao | 30b895f | 2013-02-06 18:04:40 +0800 | [diff] [blame] | 771 | |
Stefan Reinauer | 074d913 | 2009-09-26 16:43:17 +0000 | [diff] [blame] | 772 | if [ $SAVETEMPS -eq 0 ]; then |
Stefan Reinauer | 699ac27 | 2015-06-05 12:43:28 -0700 | [diff] [blame] | 773 | cleanup |
Stefan Reinauer | 074d913 | 2009-09-26 16:43:17 +0000 | [diff] [blame] | 774 | else |
| 775 | printf "Leaving temporary files around... ${green}ok${NC}\n" |
| 776 | fi |
| 777 | |
Stefan Reinauer | 699ac27 | 2015-06-05 12:43:28 -0700 | [diff] [blame] | 778 | printf "\n${green}You can now run your $NAME toolchain from $TARGETDIR.${NC}\n" |