1 # Contributor: Slash <demodevil5 [at] yahoo [dot] com>
2 # Contributor: Andrew Simmons <andrew.simmons@gmail.com>
3 # Contributor: Premysl Janouch <warriant@gmail.com>
8 pkgdesc="Quake 2 engine. You need the retail .pak files to play."
9 url="http://www.icculus.org/quake2/"
10 arch=('i686' 'x86_64')
12 depends=('libjpeg' 'sdl' 'libxxf86vm' 'libxxf86dga')
13 makedepends=('patch' 'unzip')
14 install="quake2.install"
15 source=("http://www.icculus.org/quake2/files/quake2-$pkgver.tar.gz" \
16 'http://cesium.di.uminho.pt/pub/games/quake2/source/xatrixsrc320.shar.Z' \
17 'http://cesium.di.uminho.pt/pub/games/quake2/source/roguesrc320.shar.Z' \
18 'ftp://ftp.idsoftware.com/idstuff/quake2/q2-3.20-x86-full-ctf.exe' \
19 'http://www.icculus.org/quake2/files/maxpak.pak' \
20 'http://www.icculus.org/quake2/files/pak10.pak' \
21 'http://www.icculus.org/quake2/files/pak11.pak' \
22 'http://www.icculus.org/quake2/files/pak12.pak' \
23 'http://www.icculus.org/quake2/files/pak13.pak' \
24 'http://www.icculus.org/quake2/files/pak14.pak' \
25 'http://www.icculus.org/quake2/files/pak16.pak' \
26 'http://www.icculus.org/quake2/files/pak17.pak' \
27 'http://www.icculus.org/quake2/files/pak19.pak' \
28 'quake2.sh' 'q2ded.sh' 'xatrix.sh' 'rogue.sh' 'ctf.sh' 'snd_alsa.c' 'gnusource.patch')
29 md5sums=('872fee27fb13a2a4c8876d5973c3c691'
30 '41fc4ecc4f25c068e7d1f488bd4a1e1a'
31 '7d5e052839c9e629bad0a6570aa70554'
32 '490557d4a90ff346a175d865a2bade87'
33 '04d3f1fb7fb4dada7175a41f4595c7eb'
34 'fc2de3c33c23cca5f0e6fcec068ce616'
35 '221019679613a13c6d7e5f9e21701d85'
36 '0c8b49c303014e535394168aed9b668a'
37 '9628c82566535e48c59caaee5281b963'
38 '5d47605de09c458c7f1c69d8e6fea6a7'
39 '94b18e1f2d76fb7e7d0c5bd0ae8d7c69'
40 'e24d79286ba3c1f3da1f9642a78c49af'
41 '070a4d00b93a2a427ca92adee2736000'
42 '4d17fc480cc413b890fa06998643edc0'
43 '50c72cc1ded252ee86db31ac8fa5b569'
44 '1a63caa4b66e6dbc63ed5c5fb15b9777'
45 '2deb322d859490f9178393abf74a3a27'
46 '3fe30c3a48f93f431ea191f13d49ea22'
47 'c16644a6ddf93159ccc71e4c06e312c4'
48 '5788ed0d1bde8b00fa8b91a0c865f427')
53 # Computer Architecture Variable used by Quake2
54 [ "$CARCH" = "i686" ] && _dirarch=i386
55 [ "$CARCH" = "x86_64" ] && _dirarch=x86_64
57 # Create Temporary Directories
58 install -d $pkgname-$pkgver/src/xatrix $pkgname-$pkgver/src/rogue
60 # Decompress and patch The Reckoning (xatrix) and Ground Zero (rouge) Expansions
61 for _addon in xatrix rogue; do
62 _shar=${_addon}src320.shar
64 cp $srcdir/${_shar}.Z $srcdir/$pkgname-$pkgver/src/${_addon}
65 cd $srcdir/$pkgname-$pkgver/src/${_addon}
68 msg "Unpacking ${_shar}.Z"
72 /bin/sed -i -e 's:^read ans:ans=yes :' ${_shar}
73 /bin/sed -i -e 's:^more <<EOF:cat <<EOF:' ${_shar}
76 msg "Running ${_shar}"
79 msg "Patching ${_addon}"
82 if [ ${_addon} = "rogue" ]; then
83 /bin/sed -e "s/#include <nan.h>/#include <bits\/nan.h>/" -i g_local.h
86 # Patches (Both Expansions)
87 /bin/sed -e "s/extern\tint\tjacket_armor_index/static\tint\tjacket_armor_index/" -i g_local.h
88 /bin/sed -e "s/extern\tint\tcombat_armor_index/static\tint\tcombat_armor_index/" -i g_local.h
89 /bin/sed -e "s/extern\tint\tbody_armor_index/static\tint\tbody_armor_index/" -i g_local.h
92 msg "The Reckoning and Ground Zero Expansion install complete"
94 cd $srcdir/$pkgname-$pkgver/
97 cp $srcdir/snd_alsa.c ./src/linux/snd_alsa.c
99 # x86_64 patch from Gentoo
100 patch -p1 < $srcdir/gnusource.patch
103 /bin/sed -i -e 's:jpeg_mem_src:_&:' \
104 $srcdir/$pkgname-$pkgver/src/ref_candygl/gl_image.c
106 msg "Compiling Quake 2"
109 make -s BUILD_XATRIX=YES BUILD_ROGUE=YES BUILD_DEDICATED=YES BUILD_CTF=YES BUILD_QMAX=YES build_release
111 cd $srcdir/$pkgname-$pkgver/release$_dirarch
113 # Create Destination Directories
114 install -d $pkgdir/opt/quake2/{baseq2,ctf,xatrix,rogue}
117 install -m 755 quake2 $pkgdir/opt/quake2/quake2
119 # Install Binary (SDL)
120 install -m 755 sdlquake2 $pkgdir/opt/quake2/sdlquake2
122 # Install Base Game Library
123 install -m 755 game$_dirarch.so $pkgdir/opt/quake2/baseq2/
125 # Install CTF Library
126 install -m 755 ctf/game$_dirarch.so $pkgdir/opt/quake2/ctf/
128 # Install Xatrix Library
129 install -m 755 xatrix/game$_dirarch.so $pkgdir/opt/quake2/xatrix/
131 # Install Rogue Library
132 install -m 755 rogue/game$_dirarch.so $pkgdir/opt/quake2/rogue/
134 # Install Additional Libraries
135 cp ref_*.so $pkgdir/opt/quake2/
139 # Decompress and Install CTF Patch Data
141 cp $srcdir/q2-3.20-x86-full-ctf.exe $srcdir/q2
143 unzip -L q2-3.20-x86-full-ctf.exe
144 cp baseq2/pak1.pak baseq2/pak2.pak $pkgdir/opt/quake2/baseq2/
145 cp -r baseq2/players $pkgdir/opt/quake2/baseq2/
146 cp ctf/* $pkgdir/opt/quake2/ctf/
148 # Install Q2Max Pak File
149 install $srcdir/maxpak.pak $pkgdir/opt/quake2/baseq2/
151 # Install Additional pak Files
152 for i in {10,11,12,13,14,16,17,19}; do
153 install -m 644 $srcdir/pak${i}.pak $pkgdir/opt/quake2/baseq2/pak${i}.pak
156 # Install Game Launchers
157 install -D -m 755 $startdir/quake2.sh $pkgdir/usr/bin/quake2
158 install -D -m 755 $startdir/q2ded.sh $pkgdir/usr/bin/q2ded
159 install -D -m 755 $startdir/xatrix.sh $pkgdir/usr/bin/quake2-the-reckoning
160 install -D -m 755 $startdir/rogue.sh $pkgdir/usr/bin/quake2-ground-zero
161 install -D -m 755 $startdir/ctf.sh $pkgdir/usr/bin/quake2-ctf