From 10ca5f2bd6aa3dea03c64933d60fdd23f0119882 Mon Sep 17 00:00:00 2001 From: Spoike Date: Mon, 20 Jan 2020 17:28:24 +0000 Subject: [PATCH] Allow cross-compiling etc without forcing to the latest(and breakiest) version. This should help with recreating older builds deterministically, as proof that microsoft suck and that I'm fully complying with the GPL without injecting any malware. Fuck you microsoft. Fuck you and your slander. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5601 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- build_setup.sh | 58 ++++++++++++++++++++++++++++++++++++++++++++------ build_wip.sh | 49 +++++++++++++++++++++++++++++++++++++----- 2 files changed, 96 insertions(+), 11 deletions(-) diff --git a/build_setup.sh b/build_setup.sh index 98ee88802..cd67d46a2 100755 --- a/build_setup.sh +++ b/build_setup.sh @@ -89,6 +89,46 @@ else fi fi + + +if [ "$BUILD_CLEAN" == "n" ]; then + NOUPDATE="y" +fi + +#check args (and override config as desired) +while [[ $# -gt 0 ]] +do + case $1 in + -r) + SVN_REV_ARG="-r $2" + NOUPDATE= + shift + ;; + -j) + THREADS="-j $2" + shift + ;; + -help|--help) + echo " -r VER Specifies the SVN revision to update to" + echo " -j THREADS Specifies how many jobs to make with" + echo " --help This text" + exit 0 + ;; + -build|--build) + TARGET="FTE_CONFIG=$2" + shift + ;; + --noupdate) + NOUPDATE="y" + ;; + *) + echo "Unknown option $1" + ;; + esac + shift +done + + if [ "$REUSE_CONFIG" != "y" ]; then #linux compiles are native-only, so don't bug out on cygwin which lacks a cross compiler. BUILD_LINUXx86=n @@ -139,6 +179,7 @@ if [ "$REUSE_CONFIG" != "y" ]; then read -n 1 -p "Build for NaCL? [y/N] " BUILD_NACL && echo fi +BUILD_CLEAN=${BUILD_CLEAN:-y} BUILD_LINUXx86=${BUILD_LINUXx86:-y} BUILD_LINUXx64=${BUILD_LINUXx64:-y} BUILD_LINUXx32=${BUILD_LINUXx32:-n} @@ -169,6 +210,8 @@ if [ "$UID" != "0" ]; then echo "NACL_SDK_ROOT=\"$NACLROOT/nacl_sdk/$NACLSDKVERSION\"" >>$FTECONFIG echo "NACLSDKVERSION=\"$NACLSDKVERSION\"" >>$FTECONFIG + echo "BUILD_CLEAN=\"$BUILD_CLEAN\"" >>$FTECONFIG + echo "BUILD_LINUXx86=\"$BUILD_LINUXx86\"" >>$FTECONFIG echo "BUILD_LINUXx64=\"$BUILD_LINUXx64\"" >>$FTECONFIG echo "BUILD_LINUXx32=\"$BUILD_LINUXx32\"" >>$FTECONFIG @@ -381,13 +424,15 @@ if [ "$BUILD_NACL" == "y" ] && [ $UID -ne 0 ] && [ $REBUILD_TOOLCHAINS == "y" ]; fi -#initial checkout of fte's svn if [ $UID -ne 0 ] && [ $REBUILD_TOOLCHAINS == "y" ]; then - if [ ! -d $SVNROOT ]; then - svn checkout https://svn.code.sf.net/p/fteqw/code/trunk $SVNROOT - else - cd $SVNROOT - svn up + #initial checkout of fte's svn + if [ "$NOUPDATE"!="n" ]; then + if [ ! -d $SVNROOT ]; then + svn checkout https://svn.code.sf.net/p/fteqw/code/trunk $SVNROOT $SVN_REV_ARG + else + cd $SVNROOT + svn up $SVN_REV_ARG + fi fi #FIXME: there may be race conditions when compiling. @@ -449,3 +494,4 @@ fi echo "Setup script complete." echo "When you run build_wip.sh output will be written to $BUILDFOLDER/*" + diff --git a/build_wip.sh b/build_wip.sh index 31442c694..7c44bca3f 100755 --- a/build_wip.sh +++ b/build_wip.sh @@ -39,6 +39,45 @@ else echo "WARNING: $FTECONFIG does not exist yet." fi +if [ "$BUILD_CLEAN" == "n" ]; then + NOUPDATE="y" +fi + +#check args (and override config as desired) +while [[ $# -gt 0 ]] +do + case $1 in + -r) + SVN_REV_ARG="-r $2" + NOUPDATE= + shift + ;; + -j) + THREADS="-j $2" + shift + ;; + -help|--help) + echo " -r VER Specifies the SVN revision to update to" + echo " -j THREADS Specifies how many jobs to make with" + echo " --help This text" + exit 0 + ;; + -build|--build) + TARGET="FTE_CONFIG=$2" + shift + ;; + --noupdate) + NOUPDATE="y" + ;; + *) + echo "Unknown option $1" + ;; + esac + shift +done + +MAKEARGS="$THREADS $TARGET" + export NACL_SDK_ROOT ########### Emscripten / Web Stuff @@ -84,14 +123,14 @@ fi mkdir -p $BUILDLOGFOLDER if [ ! -d $SVNROOT ]; then #just in case... - svn checkout https://svn.code.sf.net/p/fteqw/code/trunk $SVNROOT + svn checkout https://svn.code.sf.net/p/fteqw/code/trunk $SVNROOT $SVN_REV_ARG fi cd $SVNROOT/ -if [ "$BUILD_CLEAN" != "n" ]; then +if [ "$NOUPDATE" != "y" ]; then echo "SVN Update" - svn update + svn update $SVN_REV_ARG fi cd engine @@ -109,8 +148,8 @@ function build { fi echo -n "Making $NAME... " date > $BUILDLOGFOLDER/$DEST.txt - echo make $THREADS $* >> $BUILDLOGFOLDER/$DEST.txt 2>&1 - make $THREADS $* >> $BUILDLOGFOLDER/$DEST.txt 2>&1 + echo make $MAKEARGS $* >> $BUILDLOGFOLDER/$DEST.txt 2>&1 + make $MAKEARGS $* >> $BUILDLOGFOLDER/$DEST.txt 2>&1 if [ $? -eq 0 ]; then BUILDEND=$(date +%s) BUILDTIME=$(( $BUILDEND - $BUILDSTART ))