From 4bebda79408555db1987ebb57be87a15d896cf01 Mon Sep 17 00:00:00 2001 From: Marco Hladik Date: Sat, 7 Aug 2021 12:27:19 +0200 Subject: [PATCH] build.cfg: Add BUILD_UPDATE, which will control whether or not to run a vcs update command before building a project --- build.cfg | 3 +++ build_editor.sh | 10 +++++++--- build_engine.sh | 12 ++++++++---- build_game.sh | 13 ++++++++++++- get_gamepacks.sh | 7 ++++++- 5 files changed, 36 insertions(+), 9 deletions(-) diff --git a/build.cfg b/build.cfg index a335f6cf..bceeb844 100755 --- a/build.cfg +++ b/build.cfg @@ -27,3 +27,6 @@ BUILD_IMGTOOL=1 # Specify which engine revision to build, these are considered 'stable' BUILD_ENGINEREVISION=5997 + +# Whether or not to run 'git pull' or 'svn up' before building a component +BUILD_UPDATE=1 diff --git a/build_editor.sh b/build_editor.sh index 898955e0..0e3839db 100755 --- a/build_editor.sh +++ b/build_editor.sh @@ -45,9 +45,13 @@ fi mkdir -p ./bin if [ -f "$WS_MAKEFILE" ]; then - printf "WorldSpawn is present, updating...\n" - cd ./src/worldspawn/ - git pull + if [ "$BUILD_UPDATE" -eq 1 ]; then + printf "WorldSpawn is present, updating...\n" + cd ./src/worldspawn/ + git pull + else + cd ./src/worldspawn/ + fi else printf "WorldSpawn is NOT present, cloning...\n" cd ./src/ diff --git a/build_engine.sh b/build_engine.sh index 5bbd4aba..8b7bc6af 100755 --- a/build_engine.sh +++ b/build_engine.sh @@ -59,10 +59,14 @@ fi mkdir -p ./bin if [ -f "$FTE_MAKEFILE" ]; then - printf "Engine is present, updating...\n" - cd ./src/engine/ - svn -r $BUILD_ENGINEREVISION up - cd ./engine + if [ "$BUILD_UPDATE" -eq 1 ]; then + printf "Engine is present, updating...\n" + cd ./src/engine/ + svn -r $BUILD_ENGINEREVISION up + cd ./engine + else + cd ./src/engine/engine + fi else printf "Engine is NOT present, cloning...\n" cd ./src/ diff --git a/build_game.sh b/build_game.sh index 1133874f..f824a374 100755 --- a/build_game.sh +++ b/build_game.sh @@ -4,12 +4,17 @@ set -e SCRPATH="$( cd "$( dirname $(readlink -nf $0) )" && pwd )" PATH="$SCRPATH"/bin:"$PATH" - if [ -f "$SCRPATH"/bin/fteqcc ]; then # We want to compile a specific game if [ $# -gt 0 ]; then cd "$SCRPATH/$1"/src + + if [ "$BUILD_UPDATE" -eq 1 ]; then + # git pull on the main repo + git pull + fi + make cd "$SCRPATH" ./make_mapdef.sh "$1" @@ -21,8 +26,14 @@ if [ -f "$SCRPATH"/bin/fteqcc ]; then make cd "$OLDDIR" + if [ "$BUILD_UPDATE" -eq 1 ]; then + # git pull on the main repo + git pull + fi + find "$SCRPATH" -name Makefile | grep 'src\/Makefile' | grep -v engine | grep -v worldspawn | while read MFILE_N; do cd $(dirname $MFILE_N) + git pull make cd .. export GAMEDIR=$(basename $PWD) diff --git a/get_gamepacks.sh b/get_gamepacks.sh index e0ace3bf..2cf05a12 100755 --- a/get_gamepacks.sh +++ b/get_gamepacks.sh @@ -1,4 +1,5 @@ #!/bin/sh +. ./build.cfg set -e SCRPATH="$( cd "$( dirname $(readlink -nf $0) )" && pwd )" @@ -6,7 +7,10 @@ grab_mod() { if [ -f "$SCRPATH/$1"/LICENSE ]; then cd "$SCRPATH/$1" - git pull + + if [ "$BUILD_UPDATE" -eq 1 ]; then + git pull + fi else cd "$SCRPATH" git clone "$2" "$1" @@ -23,3 +27,4 @@ grab_mod scihunt https://www.github.com/eukara/freesci grab_mod hunger https://www.github.com/eukara/freehunger grab_mod valve https://www.github.com/eukara/freehl grab_mod cstrike https://www.github.com/eukara/freecs +grab_mod ts https://www.github.com/Frag-Net/FreeTS