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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
|
#!/bin/bash
# Slackware build script for iortcw
# Copyright 2016-2019 Sébastien Ballet, France
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PRGNAM=iortcw
VERSION=${VERSION:-1.51c}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
INSTALL_COMMON_DATA=${INSTALL_COMMON_DATA:-yes}
# When INSTALL_COMMON_DATA=yes, define which language-specific
# patches (for single player) must be installed. Can be :
# no (default) : do not install any language-specific patches
# de : install german language-specific patches
# fr : install french language-specific patches
# es : install spanish language-specific patches
# it : install italian language-specific patches
#
LANG=${LANG:-no}
# Define whether iortcw must be build with internal libraries
# instead of dynamically linking against system libraries. Can
# be set to yes or no (default).
#
# Define whether iortcw must be or not build and linked against
# internal libraries (ie. zlib, jpeg, ogg, opus). Can be set
# to yes or no (default).
#
_USE_INTERNAL_LIBS=${_USE_INTERNAL_LIBS:-no}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i586 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
LIBDIRSUFFIX=""
BUILDARCH="x86"
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
LIBDIRSUFFIX=""
BUILDARCH="x86"
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
BUILDARCH="x86_64"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
BUILDARCH="$ARCH"
fi
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION
if [ "$INSTALL_COMMON_DATA" = "yes" ] ; then
# Extract common game data file in ./common-game-data :
#
# * game data files to extract from $CWD/patch-data-141.zip archive :
# main/mp_bin.pk3
# main/mp_pak3.pk3
# main/mp_pak4.pk3
# main/mp_pak5.pk3
# main/mp_pakmaps0.pk3
# main/mp_pakmaps1.pk3
# main/mp_pakmaps2.pk3
# main/mp_pakmaps3.pk3
# main/mp_pakmaps4.pk3
# main/mp_pakmaps5.pk3
# main/mp_pakmaps6.pk3
# main/rotate.cfg
# main/scripts/translation.cfg
# main/sp_pak3.pk3
# main/sp_pak4.pk3
#
# * game data files to extract from $CWD/patch-data-SP_deutsch.zip when LANG=de :
# main/sp_pak3.pk3
# main/language.cfg
#
# * game data files to extract from $CWD/patch-data-SP_espanol.zip when LANG=es :
# main/sp_pak3.pk3
# main/Language.cfg
#
# * game data files to extract from $CWD/patch-data-SP_francais.zip when LANG=fr :
# main/sp_pak3.pk3
# main/language.cfg
#
# * game data files to extract from $CWD/patch-data-SP_italiano.zip when LANG=it :
# main/sp_pak3.pk3
# main/Language.cfg
unzip $CWD/patch-data-141.zip "main/*.pk3" "main/*.cfg" -d ./common-game-data
case $LANG in
de) unzip -o $CWD/patch-data-SP_deutsch.zip -d ./common-game-data
;;
es) unzip -o $CWD/patch-data-SP_espanol.zip -d ./common-game-data
;;
fr) unzip -o $CWD/patch-data-SP_francais.zip -d ./common-game-data
;;
it) unzip -o $CWD/patch-data-SP_italiano.zip -d ./common-game-data
;;
esac
fi
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
-o -perm 511 \) -exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
# Reminder :
# * targets defined in SP/MP makefiles :
# debug, release, makedirs, clean-debug, clean-release
# clean2, toolsclean-debug, toolsclean-release, toolsclean2
# dist
#
# * Variables used by the SP/MP makefiles and their default values :
#
# Variables ! Default values
# ! single player ! multiplayer
# ----------------------------+------------------+-----------------
# BUILD_STANDALONE ! - ! -
# BUILD_CLIENT ! - ! -
# BUILD_SERVER ! 0 ! -
# BUILD_GAME_SO ! - ! -
# BUILD_GAME_QVM ! 0 ! -
# BUILD_BASEGAME ! - ! -
# BUILD_RENDERER_REND2 ! - ! -
# BUILD_ARCHIVE ! 0 ! 0
# CLIENTBIN ! iowolfsp ! iowolfmp
# SERVERBIN ! iowolfspded ! iowolfded
# BASEGAME ! main ! main
# BASEGAME_CFLAGS ! - ! -
# COPYDIR ! /usr/local/games/wolf
# TEMPDIR ! /tmp
# USE_OPENAL ! 1 ! 1
# USE_OPENAL_DLOPEN ! 1 ! 1
# USE_CURL ! 0 ! 0
# USE_CURL_DLOPEN ! 1 ! 1
# USE_CODEC_VORBIS ! 1 ! 1
# USE_CODEC_OPUS ! 1 ! 1
# USE_MUMBLE ! 1 ! 1
# USE_VOIP ! 1 ! 1
# USE_FREETYPE ! 1 ! 1
# USE_INTERNAL_LIBS ! 1 ! 1
# USE_INTERNAL_OGG ! ${USE_INTERNAL_LIBS}
# USE_INTERNAL_VORBIS ! ${USE_INTERNAL_LIBS}
# USE_INTERNAL_OPUS ! ${USE_INTERNAL_LIBS}
# USE_INTERNAL_ZLIB ! ${USE_INTERNAL_LIBS}
# USE_INTERNAL_JPEG ! ${USE_INTERNAL_LIBS}
# USE_INTERNAL_FREETYPE ! ${USE_INTERNAL_LIBS}
# USE_LOCAL_HEADERS ! ${USE_INTERNAL_LIBS}
# USE_RENDERER_DLOPEN ! 1 ! 1
# USE_XDG ! 0 ! 0
# USE_YACC ! 0 ! 0
# DEBUG_CFLAGS ! -g -O0 ! -g -O0
# USE_BLOOM ! 1 ! 1
# USE_OPENGLES ! 0 ! 0
# RASPBERRY_PI ! 0 ! 0
# USE_AUTHORIZE_SERVER ! 0 ! 0
# V (ie. verbose) ! 0 ! 0
[ "$_USE_INTERNAL_LIBS" = "no" ] && _USE_INTERNAL_LIBS=0 || _USE_INTERNAL_LIBS=1
# define args that must be passed to make for better readability.
#
# Nota: even if BUILD_GAME_QVM is set to 1, qvm files are not
# generated on x86_64 systems.
#
MAKE_ARGS="ARCH=$BUILDARCH \
BUILD_CLIENT=1 \
BUILD_SERVER=1 \
BUILD_GAME_SO=1 \
BUILD_GAME_QVM=1 \
BUILD_BASEGAME=1 \
BUILD_RENDERER_REND2=1 \
USE_CURL=1 \
USE_CURL_DLOPEN=0 \
USE_OPENAL=1 \
USE_OPENAL_DLOPEN=0 \
USE_INTERNAL_LIBS=${_USE_INTERNAL_LIBS} \
USE_CODEC_VORBIS=1 \
USE_CODEC_OPUS=1 \
USE_FREETYPE=1 \
COPYDIR=\"$PKG/usr/share/games/rtcw\""
# Build single player game binaries
cd SP
CFLAGS="$SLKCFLAGS" \
make $MAKE_ARGS release copyfiles
# Build multi player game binaries
cd ../MP
CFLAGS="$SLKCFLAGS" \
make $MAKE_ARGS release copyfiles
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
# go back into rtcw source root directory, generate pk3
# files required by alternate renderer (ie. mp_rend2_shaders0.pk3
# and sp_rend2_shaders0.pk3), in $PKG/usr/share/games/rtcw/main
#
cd ..
(
cd SP/media/
zip -r $PKG/usr/share/games/rtcw/main/sp_rend2_shaders0.pk3 .
)
(
cd MP/media/
zip -r $PKG/usr/share/games/rtcw/main/mp_rend2_shaders0.pk3 .
)
if [ "$INSTALL_COMMON_DATA" = "yes" ] ; then
# Copy content of ./common-game-data into $PKG/usr/share/games/rtcw
#
cp -a ./common-game-data/* $PKG/usr/share/games/rtcw
fi
mkdir -p $PKG/usr/share/{applications,pixmaps}
cat $CWD/iortcw.desktop > $PKG/usr/share/applications/iortcw.desktop
cat $CWD/iortcw-mp.desktop > $PKG/usr/share/applications/iortcw-mp.desktop
install -m 644 $CWD/iortcw.png $PKG/usr/share/pixmaps/iortcw.png
# Add launchers
mkdir $PKG/usr/games
cat $CWD/launcher.iortcw > $PKG/usr/games/iortcw
cat $CWD/launcher.iortcw-mp > $PKG/usr/games/iortcw-mp
chmod 0755 $PKG/usr/games/iortcw
chmod 0755 $PKG/usr/games/iortcw-mp
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/{SP,MP}
cp -a HOWTO-Build.txt \
README_RASPBERRYPI \
iortcw-command-changes.txt \
rend2-cvars.txt \
iortcw-cvars-new.txt \
rend2-readme.md \
README.md \
iortcw-cvars-removed.txt \
voip-readme.txt \
$PKG/usr/doc/$PRGNAM-$VERSION
cp -a SP/COPYING.txt SP/README.txt \
$PKG/usr/doc/$PRGNAM-$VERSION/SP
cp -a MP/COPYING.txt MP/README.txt \
$PKG/usr/doc/$PRGNAM-$VERSION/MP
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
|