util/crossgcc: Add bootstrap-only mode

buildgcc -B (--bootstrap-only) builds only a bootstrap compiler. That
useful if you want to package the cross compilers: first build the
bootstrap compiler, then all required cross compilers in a separate
directory (using the bootstrap compiler through an adjusted PATH).

Change-Id: I089b51d1b898d4cf530845ba51283997fd229451
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-on: https://review.coreboot.org/21683
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
Patrick Georgi 2017-09-22 18:57:10 +02:00
parent d6735b0f14
commit 9681cdc1b4
1 changed files with 27 additions and 18 deletions

View File

@ -902,12 +902,12 @@ getopt - > /dev/null 2>/dev/null || gcc -o getopt getopt.c
getoptbrand="$(getopt -V | sed -e '1!d' -e 's,^\(......\).*,\1,')"
if [ "${getoptbrand}" = "getopt" ]; then
# Detected GNU getopt that supports long options.
args=$(getopt -l version,help,clean,directory:,bootstrap,platform:,languages:,package:,jobs:,destdir:,savetemps,scripting,ccache,supported:,urls,nocolor -o Vhcd:bp:l:P:j:D:tSys:un -- "$@")
args=$(getopt -l version,help,clean,directory:,bootstrap,bootstrap-only,platform:,languages:,package:,jobs:,destdir:,savetemps,scripting,ccache,supported:,urls,nocolor -o Vhcd:bBp:l:P:j:D:tSys:un -- "$@")
getopt_ret=$?
eval set -- "$args"
else
# Detected non-GNU getopt
args=$(getopt Vhcd:bp:l:P:j:D:tSys:un $*)
args=$(getopt Vhcd:bBp:l:P:j:D:tSys:un $*)
getopt_ret=$?
set -- $args
fi
@ -925,6 +925,7 @@ while true ; do
-t|--savetemps) shift; SAVETEMPS=1;;
-d|--directory) shift; TARGETDIR="$1"; shift;;
-b|--bootstrap) shift; BOOTSTRAP=1;;
-B|--bootstrap-only) shift; BOOTSTRAPONLY=1; BOOTSTRAP=1;;
-p|--platform) shift; TARGETARCH="$1"; shift;;
-l|--languages) shift; LANGUAGES="$1"; shift;;
-D|--destdir) shift; DESTDIR="$1"; shift;;
@ -1215,6 +1216,14 @@ for P in $PACKAGES; do
done
printf "Unpacked and patched ... ${green}ok${NC}\n"
if [ -n "$BOOTSTRAPONLY" ]; then
printf "Building bootstrap compiler only ... \n"
for pkg in GMP MPFR MPC LIBELF GCC; do
build_for_host $pkg
done
exit 0
fi
printf "Building packages ... \n"
for package in $PACKAGES; do
build $package