2020-11-06 16:42:44 +00:00
|
|
|
#!/bin/sh
|
2021-06-26 19:50:17 +00:00
|
|
|
. ./build.cfg
|
2021-08-07 21:14:51 +00:00
|
|
|
|
2021-09-09 17:18:50 +00:00
|
|
|
if [ "$SKIP_UPDATE" == "1" ]; then
|
|
|
|
BUILD_UPDATE=0
|
|
|
|
fi
|
|
|
|
|
2021-08-07 21:14:51 +00:00
|
|
|
# if we're attempting to update the projects, check for git
|
|
|
|
if [ "$BUILD_UPDATE" -eq 1 ]; then
|
|
|
|
if ! [ -x "$(command -v git)" ]; then
|
|
|
|
printf "'git' is not installed.\n"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2020-11-06 16:42:44 +00:00
|
|
|
set -e
|
2020-11-24 16:21:34 +00:00
|
|
|
SCRPATH="$( cd "$( dirname $(readlink -nf $0) )" && pwd )"
|
|
|
|
PATH="$SCRPATH"/bin:"$PATH"
|
2020-11-06 16:42:44 +00:00
|
|
|
|
2020-11-24 16:21:34 +00:00
|
|
|
if [ -f "$SCRPATH"/bin/fteqcc ]; then
|
2021-03-09 10:40:17 +00:00
|
|
|
|
|
|
|
# We want to compile a specific game
|
|
|
|
if [ $# -gt 0 ]; then
|
2021-08-29 17:10:55 +00:00
|
|
|
if [ "$BUILD_UPDATE" -eq 1 ]; then
|
|
|
|
# git pull on the main repo
|
|
|
|
git pull
|
|
|
|
fi
|
|
|
|
|
2021-03-09 10:40:17 +00:00
|
|
|
cd "$SCRPATH/$1"/src
|
2021-08-07 10:27:19 +00:00
|
|
|
|
|
|
|
if [ "$BUILD_UPDATE" -eq 1 ]; then
|
|
|
|
# git pull on the main repo
|
|
|
|
git pull
|
|
|
|
fi
|
|
|
|
|
2021-03-09 10:40:17 +00:00
|
|
|
make
|
|
|
|
cd "$SCRPATH"
|
|
|
|
./make_mapdef.sh "$1"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2021-02-20 11:01:27 +00:00
|
|
|
export OLDDIR=$(pwd)
|
2021-03-06 00:20:25 +00:00
|
|
|
cd ./src
|
|
|
|
|
2021-08-07 10:27:19 +00:00
|
|
|
if [ "$BUILD_UPDATE" -eq 1 ]; then
|
|
|
|
# git pull on the main repo
|
|
|
|
git pull
|
|
|
|
fi
|
|
|
|
|
2021-09-02 19:16:18 +00:00
|
|
|
make
|
|
|
|
cd "$OLDDIR"
|
|
|
|
|
|
|
|
# update repos first in case there's dependencies
|
2021-08-06 06:46:00 +00:00
|
|
|
find "$SCRPATH" -name Makefile | grep 'src\/Makefile' | grep -v engine | grep -v worldspawn | while read MFILE_N; do
|
2021-08-07 21:14:51 +00:00
|
|
|
NEWDIR=$(dirname "$MFILE_N")
|
|
|
|
cd "$NEWDIR"
|
|
|
|
if [ -f "$NEWDIR/../.git/config" ]; then
|
|
|
|
printf "Updating git repo inside $NEWDIR\n"
|
|
|
|
if [ "$BUILD_UPDATE" -eq 1 ]; then
|
|
|
|
set +e
|
|
|
|
git pull
|
|
|
|
set -e
|
|
|
|
fi
|
|
|
|
fi
|
2021-09-02 19:16:18 +00:00
|
|
|
cd $OLDDIR
|
|
|
|
done;
|
|
|
|
|
|
|
|
# now loop through _again_ to build
|
|
|
|
find "$SCRPATH" -name Makefile | grep 'src\/Makefile' | grep -v engine | grep -v worldspawn | while read MFILE_N; do
|
|
|
|
NEWDIR=$(dirname "$MFILE_N")
|
|
|
|
cd "$NEWDIR"
|
2021-02-20 11:01:27 +00:00
|
|
|
make
|
2021-03-04 04:04:14 +00:00
|
|
|
cd ..
|
|
|
|
export GAMEDIR=$(basename $PWD)
|
2021-02-20 11:01:27 +00:00
|
|
|
cd $OLDDIR
|
2021-03-06 00:20:25 +00:00
|
|
|
if [ -f "$SCRPATH"/bin/worldspawn ]; then
|
2021-09-02 19:16:18 +00:00
|
|
|
./make_mapdef.sh $GAMEDIR
|
2021-03-06 00:20:25 +00:00
|
|
|
fi
|
2021-02-20 11:01:27 +00:00
|
|
|
done;
|
2020-11-06 16:42:44 +00:00
|
|
|
else
|
|
|
|
printf "FTEQCC compiler is not present, please run build_engine.sh\n"
|
|
|
|
fi
|