-
Notifications
You must be signed in to change notification settings - Fork 40
/
compile.sh
executable file
·109 lines (87 loc) · 3.57 KB
/
compile.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/bin/bash
# Bash immediate exit and verbosity
set -ev
# from smlib travis tests
SMPATTERN="http:.*sourcemod-.*-linux\..*"
SMURL="http://www.sourcemod.net/smdrop/$SMVERSION/"
SMPACKAGE=`lynx -dump "$SMURL" | egrep -o "$SMPATTERN" | tail -1`
# get sourcemod package and copy plugin code into scripting folder
if [ ! -d "build" ]; then
mkdir build
cd build
wget $SMPACKAGE
tar -xzf $(basename "$SMPACKAGE")
rm addons/sourcemod/scripting/*.sp
cp -R ../scripting/ addons/sourcemod/
# get dependency libraries.
git clone -b transitional_syntax --single-branch https://github.com/bcserv/smlib.git
cp -R smlib/scripting/include/ addons/sourcemod/scripting/
git clone https://github.com/Impact123/AutoExecConfig.git
cp AutoExecConfig/autoexecconfig.inc addons/sourcemod/scripting/include/
git clone https://github.com/Drifter321/DHooks2.git
cp DHooks2/sourcemod/scripting/include/dhooks.inc addons/sourcemod/scripting/include/
git clone https://github.com/Drixevel/Chat-Processor.git
cp Chat-Processor/scripting/include/chat-processor.inc addons/sourcemod/scripting/include/
git clone https://bitbucket.org/minimoney1/simple-chat-processor.git
cp simple-chat-processor/scripting/include/scp.inc addons/sourcemod/scripting/include/
git clone https://github.com/KissLick/ColorVariables.git
cp ColorVariables/addons/sourcemod/scripting/includes/colorvariables.inc addons/sourcemod/scripting/include/
git clone https://github.com/peace-maker/mapzonelib.git
cp mapzonelib/scripting/include/mapzonelib.inc addons/sourcemod/scripting/include/
cd ..
fi
# setup the auto version file to have the git revision in the version convar.
# get the correct revision count
# https://github.com/travis-ci/travis-ci/issues/3412
git fetch --unshallow
GITREVCOUNT=$(git rev-list --count HEAD)
echo -e "#if defined _smrpg_version_included\n#endinput\n#endif\n#define _smrpg_version_included\n\n" > build/addons/sourcemod/scripting/include/smrpg/smrpg_autoversion.inc
echo -e "#define SMRPG_VERSION \"1.0-$GITREVCOUNT\"\n" >> build/addons/sourcemod/scripting/include/smrpg/smrpg_autoversion.inc
# setup package folders
PACKAGEDIR=$(pwd)/package
if [ ! -d "package" ]; then
mkdir package
mkdir package/plugins
mkdir package/plugins/upgrades
fi
cp -R configs/ package/
cp -R gamedata/ package/
cp -R scripting/ package/
cp -R translations/ package/
# compile the plugins
cd build/addons/sourcemod/scripting/
chmod +x spcomp
# compile base plugins
for f in *.sp
do
if [ "$f" != "smrpg_chattags.sp" ]; then
echo -e "\nCompiling $f..."
smxfile="`echo $f | sed -e 's/\.sp$/\.smx/'`"
./spcomp $f -o$PACKAGEDIR/plugins/$smxfile -E
fi
done
# compile both versions of chattags for both chat processors..
echo -e "\nCompiling smrpg_chattags.sp for Chat Processor..."
./spcomp smrpg_chattags.sp -o$PACKAGEDIR/plugins/smrpg_chattags_cp.smx -E
echo -e "\nCompiling smrpg_chattags.sp for Simple Chat Processor..."
./spcomp smrpg_chattags.sp -o$PACKAGEDIR/plugins/smrpg_chattags_scp.smx -E USE_SIMPLE_PROCESSOR=
# compile all upgrades
for f in upgrades/*.sp
do
# skip the skeleton
if [ "$f" != "upgrades/smrpg_upgrade_example.sp" ]; then
echo -e "\nCompiling upgrade $f..."
smxfile="`echo $f | sed -e 's/\.sp$/\.smx/'`"
./spcomp $f -o$PACKAGEDIR/plugins/$smxfile -E
fi
done
# put the files into a nice archive
cd $PACKAGEDIR
ARCHIVE=smrpg-rev$GITREVCOUNT.tar.gz
tar -zcvf ../$ARCHIVE *
cd ..
# upload package
# TODO: put into seperate deploy script
if [ ! -z "$DROPURL" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ]; then
curl -F "sm=$SMVERSION" -F "key=$UPLOADKEY" -F "drop=@$ARCHIVE" $DROPURL
fi