buildgcc: move to a package centric user interface

Instead of building IASL and GDB implicitly when building
GCC, this patch changes buildgcc to let you explicitly specify
what you want to build.

This will prevent IASL from building over and over again, when
all you need is GDB.

The new command line option is -P | --package <package> where
package is one of the following: GCC, GDB, CLANG, IASL
If no package is specified, buildgcc will default to GCC.

Change-Id: I8836bed16fc2bc39e0951199143581cc6d71cb4d
Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Reviewed-on: http://review.coreboot.org/10492
Tested-by: build bot (Jenkins)
Reviewed-by: Marc Jones <marc.jones@se-eng.com>
This commit is contained in:
Stefan Reinauer 2015-06-09 14:45:14 -07:00
parent 28a28e23fb
commit 85b07d68c1
1 changed files with 39 additions and 34 deletions

View File

@ -26,9 +26,12 @@ CROSSGCC_DATE="June 9th, 2015"
CROSSGCC_VERSION="1.30" CROSSGCC_VERSION="1.30"
# default settings # default settings
PACKAGE=GCC
TARGETDIR=$(pwd)/xgcc TARGETDIR=$(pwd)/xgcc
TARGETARCH=i386-elf TARGETARCH=i386-elf
DESTDIR= DESTDIR=
SAVETEMPS=0
SKIPPYTHON=1
# GCC toolchain version numbers # GCC toolchain version numbers
GMP_VERSION=6.0.0 GMP_VERSION=6.0.0
@ -81,11 +84,6 @@ CTE_DIR="clang-tools-extra-${CLANG_VERSION}.src"
unset MAKELEVEL MAKEFLAGS unset MAKELEVEL MAKEFLAGS
SAVETEMPS=0
BUILDCLANG=0
SKIPGDB=1
SKIPPYTHON=1
red='\033[0;31m' red='\033[0;31m'
RED='\033[1;31m' RED='\033[1;31m'
green='\033[0;32m' green='\033[0;32m'
@ -293,16 +291,19 @@ myhelp()
printf " [-t|--savetemps] don't remove temporary files after build\n" printf " [-t|--savetemps] don't remove temporary files after build\n"
printf " [-y|--ccache] Use ccache when building cross compiler\n" printf " [-y|--ccache] Use ccache when building cross compiler\n"
printf " [-j|--jobs <num>] run <num> jobs in parallel in make\n" printf " [-j|--jobs <num>] run <num> jobs in parallel in make\n"
printf " [-C|--clang] build CLANG toolchain"
printf " [-p|--platform <platform>] target platform to build cross compiler for\n"
printf " (defaults to $TARGETARCH) *)\n"
printf " [-d|--directory <target dir>] target directory to install cross compiler to\n" printf " [-d|--directory <target dir>] target directory to install cross compiler to\n"
printf " (defaults to $TARGETDIR)\n\n" printf " (defaults to $TARGETDIR)\n\n"
printf " [-D|--destdir <dest dir>] destination directory to install cross compiler to\n" printf " [-D|--destdir <dest dir>] destination directory to install cross compiler to\n"
printf " (for RPM builds, default unset)\n" printf " (for RPM builds, default unset)\n"
printf " [-G|--gdb] build GNU debugger *)\n" printf " [-P|--package <package>] Build a specific package: GCC, CLANG, IASL, GDB\n"
printf " [-S|--scripting] build scripting support for GDB *)\n\n" printf " (defaults to $PACKAGE)\n"
printf " *) option only available when building GCC toolchain (not with CLANG)\n\n" printf "GCC specific options:\n"
printf " [-p|--platform <platform>] target platform to build cross compiler for\n"
printf " (defaults to $TARGETARCH)\n"
printf "GDB specific options:\n"
printf " [-p|--platform <platform>] target platform to build cross compiler for\n"
printf " (defaults to $TARGETARCH)\n"
printf " [-S|--scripting] build scripting support for GDB\n\n"
} }
myversion() myversion()
@ -507,8 +508,7 @@ while true ; do
-p|--platform) shift; TARGETARCH="$1"; shift;; -p|--platform) shift; TARGETARCH="$1"; shift;;
-D|--destdir) shift; DESTDIR="$1"; shift;; -D|--destdir) shift; DESTDIR="$1"; shift;;
-j|--jobs) shift; JOBS="-j $1"; shift;; -j|--jobs) shift; JOBS="-j $1"; shift;;
-C|--clang) shift; BUILDCLANG=1;; -P|--package) shift; PACKAGE="$1"; shift;;
-G|--gdb) shift; SKIPGDB=0;;
-S|--scripting) shift; SKIPPYTHON=0;; -S|--scripting) shift; SKIPPYTHON=0;;
-y|--ccache) shift; USECCACHE=1;; -y|--ccache) shift; USECCACHE=1;;
--) shift; break;; --) shift; break;;
@ -532,27 +532,32 @@ esac
# Figure out which packages to build # Figure out which packages to build
if [ "$BUILDCLANG" -eq 0 ]; then case "$PACKAGE" in
echo "Target architecture is now $TARGETARCH" GCC|gcc)
NAME="${TARGETARCH} cross" echo "Target architecture is now $TARGETARCH"
PACKAGES="GMP MPFR MPC LIBELF BINUTILS GCC IASL" NAME="${TARGETARCH} cross GCC"
else PACKAGES="GMP MPFR MPC LIBELF BINUTILS GCC IASL"
NAME=clang ;;
PACKAGES="LLVM CFE CRT CTE" GDB|gdb)
fi NAME="${TARGETARCH} cross GDB"
PACKAGES="GDB"
if [ $SKIPGDB -eq 1 ]; then if [ $SKIPPYTHON -eq 0 ]; then
printf "Will skip GDB ... ${green}ok${NC}\n" PACKAGES="EXPAT PYTHON $PACKAGES"
if [ $SKIPPYTHON -eq 0 ]; then fi
printf "Python scripting needs GDB ... disabling ... ${green}ok${NC}\n" ;;
SKIPPYTHON=1 CLANG|clang)
fi NAME=clang
else PACKAGES="LLVM CFE CRT CTE"
if [ $SKIPPYTHON -eq 0 ]; then ;;
PACKAGES="$PACKAGES EXPAT PYTHON" IASL|iasl)
fi NAME="IASL ACPI compiler"
PACKAGES="$PACKAGES GDB" PACKAGES=IASL
fi ;;
*)
printf "${red}ERROR: Unsupported package $PACKAGE. (Supported packages are GCC, GDB, CLANG, IASL)${NC}\n\n";
exit 1
;;
esac
# This initial cleanup is useful when updating the toolchain script. # This initial cleanup is useful when updating the toolchain script.