-
Notifications
You must be signed in to change notification settings - Fork 4
/
make.sh
69 lines (56 loc) · 2.47 KB
/
make.sh
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
61
62
63
64
65
66
67
68
69
#!/usr/bin/env bash
# Settings
MAKE_PBO=0 # Build a PBO if true. (Requires mikeros PBO tools)
LINT_MISSION=0 # Lint the Mission Folder
RENAME_MISSION_FILE=1 # Adds timestamp to the mission folder/pbo file
RENAME_MISSION_TITLE=0 # Replaces <#DATETIME> with timestamp in mission name
DATE=`date +%Y%m%d-%H%M` # Timestamp call & Format specification
# Check for --pbo Arg
if [[ "$@" = "--pbo" ]]; then
MAKE_PBO=1
fi
###############################################################
echo "Building Liberation missions Now..."
# Build/Rebuild Dist Dir
if [ -d dist ]; then
echo "Dist mission directory found. Deleting old version..."
rm -rf dist
fi
mkdir dist
for mission in `find src/ -maxdepth 1 -name "fp_*" -type d`; do
DST_MAIN=${mission/src/dist}
echo "Processing: $mission"
# Copy Base Files into dist folder
cp -r 'src/greuh_liberation.Default' $DST_MAIN
# Copy customized files into dist folder
cp -r ${mission}/* "${DST_MAIN}/"
# Begin Pre-Processing of certain custom files
cat "${DST_MAIN}/arsenal.sqf" | gpp -x -H --nostdinc --nocurinc -I${DST_MAIN}/meta -o "${DST_MAIN}/arsenal.sqf"
cat "${DST_MAIN}/classnames.sqf" | gpp -x -H --nostdinc --nocurinc -I${DST_MAIN}/meta -o "${DST_MAIN}/classnames.sqf"
# Edit the mission Title if defined.
# While developing the mission, you don't want the mission title to be processed or else the <#DATETIME> May get lost.
# But you want to have it enabled for release builds, in order to have the timestamp in the mission name.
if [ $RENAME_MISSION_TITLE -eq 1 ]; then
echo "Editing Mission title to include timestamp"
cat "${DST_MAIN}/mission.sqm" | gpp -H --nostdinc --nocurinc -I${DST_MAIN}/meta -o "${DST_MAIN}/mission.sqm" -DDATETIME=${DATE}
fi
###############################################################
# Delete meta folder (For Include Files) from the mission when done processing.
if [ -d "${DST_MAIN}/meta" ]; then
echo "Removing Meta Folder from Mission"
rm -rf "${DST_MAIN}/meta"
fi
if [ $LINT_MISSION -eq 1 ]; then
makepbo -PQ "${DST_MAIN}"
fi
# Finish up by renaming the folder with a timestamp
if [ $RENAME_MISSION_FILE -eq 1 ]; then
MAP_BEGIN=`echo "$DST_MAIN" | grep -E -o "^dist/[a-zA-Z0-9_-]+"`
MAP_ENDIN=`echo "$DST_MAIN" | grep -E -o "\.[a-zA-Z0-9_]+$"`
mv "${DST_MAIN}" "${MAP_BEGIN}_${DATE}${MAP_ENDIN}"
fi
if [ $MAKE_PBO -eq 1 ]; then
echo "Building PBO File."
makepbo -P -N "${MAP_BEGIN}_${DATE}${MAP_ENDIN}"
fi
done