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