-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·60 lines (46 loc) · 2.16 KB
/
build.sh
File metadata and controls
executable file
·60 lines (46 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env bash
if [ -n "${ZIP:-}" ]; then
tput bold; tput setaf 3; echo "WARNING: Processing without compression..."; tput sgr0
fi
if [ -e $(dirname "$0")/compiled/csprogs.dat -o -e $(dirname "$0")/compiled/menu.dat -o -e $(dirname "$0")/compiled/progs.dat -o -e $(dirname "$0")/compiled/csprogs.lno -o -e $(dirname "$0")/compiled/menu.lno -o -e $(dirname "$0")/compiled/progs.lno -o -e $(dirname "$0")/compiled/*.pk3 -o -e $(dirname "$0")/csprogs.dat -o -e $(dirname "$0")/menu.dat -o -e $(dirname "$0")/progs.dat -o -e $(dirname "$0")/csprogs.lno -o -e $(dirname "$0")/menu.lno -o -e $(dirname "$0")/progs.lno ]; then
tput bold; tput setaf 3; echo "There are compiled files here. The operation will proceed to delete the current compiled files in and out of the 'compiled' directory, replace and get new compiled ones (*.dat, *.lno, and *.pk3 files will be removed)."
# deletes any remaining compiled files that weren't moved to 'compiled' directory
tput bold; tput setaf 1
rm -vf $(dirname "$0")/*.dat
rm -vf $(dirname "$0")/*.lno
rm -vf $(dirname "$0")/*.pk3
rm -vf $(dirname "$0")/compiled/*.dat
rm -vf $(dirname "$0")/compiled/*.lno
rm -vf $(dirname "$0")/compiled/*.pk3
tput sgr0
fi
cd ${0%[\\/]*}
set -eu
declare base=xonotic
if [ ! -d "$base" ]; then
echo "RTFM (README.md)"
exit 1
fi
: ${PROGS_OUT:=$PWD}
export PROGS_OUT
: ${QCC:=$PWD/gmqcc/gmqcc}
export QCC
export QCCFLAGS_WATERMARK=$(git describe --tags --dirty='~' --always)
relpath() {
b=; s=$(cd $(readlink -f ${1%%/}); pwd); d=$(cd $2; pwd)
while [ "${d#$s/}" == "${d}" ]; do s=$(dirname ${s}); b="../${b}"; done
echo ${b}${d#${s}/}
}
export BUILD_MOD="$(relpath $base/qcsrc $PWD)"
export XONOTIC=1
make -C ${base}
tput bold; tput setaf 2; echo "Compiled successfully!"; tput sgr0
mkdir -vp $(dirname "$0")/compiled
mv -v *.lno $(dirname "$0")/compiled
mv -v *.dat $(dirname "$0")/compiled
if [ -n "${ZIP:-}" ]; then
tput bold; tput setaf 3; echo "Done without compression."; tput sgr0
else
cp -v $base/qcsrc/csprogs-*.pk3 ./compiled
fi
tput bold; tput setaf 3; echo "Now you can look at the compiled files inside $(dirname "$0")/compiled directory."