abuild: allow build results outside the source tree

A reasonable configuration that minimizes disk traffic
could be

    $ abuild -o /tmp/abuild-$$ -z

Change-Id: Ic91798af7e799a40a77025e09a6078ea6758cdac
Signed-off-by: Patrick Georgi <patrick@georgi-clan.de>
Reviewed-on: http://review.coreboot.org/5805
Tested-by: build bot (Jenkins)
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
Patrick Georgi 2014-05-21 23:00:32 +02:00
parent b0bc63b519
commit ad27322702
1 changed files with 15 additions and 4 deletions

View File

@ -277,7 +277,7 @@ function build_target
CONFIG=$3 CONFIG=$3
TARCH=$( architecture $VENDOR $MAINBOARD ) TARCH=$( architecture $VENDOR $MAINBOARD )
if [ "`cat $TOP/$TARGET/${VENDOR}_${MAINBOARD}/compile.status 2>/dev/null`" = "ok" -a \ if [ "`cat $TARGET/${VENDOR}_${MAINBOARD}/compile.status 2>/dev/null`" = "ok" -a \
"$buildall" = "false" ]; then "$buildall" = "false" ]; then
printf "Skipping $VENDOR/$MAINBOARD; (already successful)\n" printf "Skipping $VENDOR/$MAINBOARD; (already successful)\n"
return return
@ -286,8 +286,9 @@ function build_target
HOSTCC='gcc' HOSTCC='gcc'
printf "Building $VENDOR/$MAINBOARD; " printf "Building $VENDOR/$MAINBOARD; "
mkdir -p $TOP/$TARGET/${VENDOR}_${MAINBOARD} $TOP/$TARGET/abuild mkdir -p $TARGET/${VENDOR}_${MAINBOARD} $TARGET/abuild
XMLFILE=$TOP/$TARGET/abuild/${VENDOR}_${MAINBOARD}.xml ABSPATH=`cd $TARGET/abuild; pwd`
XMLFILE=$ABSPATH/${VENDOR}_${MAINBOARD}.xml
stime=`perl -e 'print time();' 2>/dev/null || date +%s` stime=`perl -e 'print time();' 2>/dev/null || date +%s`
@ -398,6 +399,8 @@ function myhelp
printf " [-P|--prefix <name>] file name prefix in CBFS\n" printf " [-P|--prefix <name>] file name prefix in CBFS\n"
printf " [-B|--blobs] Allow using binary files\n" printf " [-B|--blobs] Allow using binary files\n"
printf " [-z|--clean] Remove build results when finished\n" printf " [-z|--clean] Remove build results when finished\n"
printf " [-o|--outdir <path>] store build results in path\n"
printf " (defaults to $TARGET)\n"
printf " [-L|--clang] Use clang\n" printf " [-L|--clang] Use clang\n"
printf " [--scan-build] use clang's static analyzer\n" printf " [--scan-build] use clang's static analyzer\n"
printf " [cbroot] absolute path to coreboot sources\n" printf " [cbroot] absolute path to coreboot sources\n"
@ -440,7 +443,7 @@ cmdline="$* -c 1"
getoptbrand="`getopt -V`" getoptbrand="`getopt -V`"
if [ "${getoptbrand:0:6}" == "getopt" ]; then if [ "${getoptbrand:0:6}" == "getopt" ]; then
# Detected GNU getopt that supports long options. # Detected GNU getopt that supports long options.
args=`getopt -l version,verbose,help,all,target:,payloads:,test,cpus:,silent,junit,config,loglevel:,remove,prefix:,update,scan-build,ccache,blobs,clang,clean -o Vvhat:p:Tc:sJCl:rP:uyBLz -- "$@"` || exit 1 args=`getopt -l version,verbose,help,all,target:,payloads:,test,cpus:,silent,junit,config,loglevel:,remove,prefix:,update,scan-build,ccache,blobs,clang,clean,outdir: -o Vvhat:p:Tc:sJCl:rP:uyBLzo: -- "$@"` || exit 1
eval set -- $args eval set -- $args
else else
# Detected non-GNU getopt # Detected non-GNU getopt
@ -509,12 +512,20 @@ while true ; do
customizing="${customizing}, clean" customizing="${customizing}, clean"
clean_work=true clean_work=true
;; ;;
-o|--outdir) shift
TARGET=$1; shift
;;
--) shift; break;; --) shift; break;;
-*) printf "Invalid option\n\n"; myhelp; exit 1;; -*) printf "Invalid option\n\n"; myhelp; exit 1;;
*) break;; *) break;;
esac esac
done done
if [ -z "$TARGET" -o "$TARGET" = "/" ]; then
echo "Please specify a valid, non-root build directory."
exit 1
fi
customizing=`echo $customizing |cut -c3-` customizing=`echo $customizing |cut -c3-`
if [ "$customizing" = "" ]; then if [ "$customizing" = "" ]; then
customizing="default configuration" customizing="default configuration"