# Maintainer: Arkham <arkham at archlinux dot us>
# Contributor: Travis Nickles <ryoohki7@yahoo.com>
# Contributor: Slash <demodevil5[at]yahoo[dot]com>
pkgname=enemy-territory
pkgver=2.60b
pkgrel=12
pkgdesc="Wolfenstein: Enemy Territory is a completely free, standalone, team-based, multiplayer FPS."
arch=('i686' 'x86_64')
url="http://www.planetwolfenstein.com/"
license=('custom')
depends=('mesa' 'libxext')
optdepends=('et-sdl-sound')
[[ "$CARCH" == "x86_64" ]] && depends=('lib32-mesa' 'lib32-libxext' 'lib32-libxdamage') && optdepends=('et-sdl-sound')
makedepends=('unzip')
backup=(opt/enemy-territory/etmain/server.cfg
opt/enemy-territory/etmain/punkbuster.cfg)
install=$pkgname.install
source=(http://ftp.gwdg.de/pub/misc/ftp.idsoftware.com/idstuff/et/linux/et-linux-2.60.x86.run
http://ftp.gwdg.de/pub/misc/ftp.idsoftware.com/idstuff/et/ET-$pkgver.zip http://nullkey.kapsi.fi/et-sdl-sound/et-sdl-sound.gz
$pkgname.desktop et-ded et-pbupdate.sh et.sh etded.sh)
options=(!strip)
md5sums=('2d2373f29f02e18d365d7f1860eee435'
'fb83b8732fc7373c277180b663debf57'
'd4f6bc413c67ece7c8f30219edc9a16c'
'c0f9fc3f6d77814dae435be2aa42c46e'
'665f288d654758343f11898031efeda5'
'ce374bdbae3c8e4f4319b37984a7d9e2'
'd55fc4880bcb2a93d2294b8861a852df'
'0645baca975faa176a388e8c41a9ff8d')
build() {
cd $srcdir
#Make Loki installer executable
chmod +x et-linux-2.60.x86.run
# Extract data from installer
./et-linux-2.60.x86.run --noexec --target $pkgname
# Remove unnecessary files
rm -r $pkgname/bin $pkgname/setup.{data,sh} $pkgname/README
# Copy game EULA to main directory
cp $pkgname/Docs/EULA_Wolfenstein_Enemy_Territory.txt $pkgname
# Patch for x86_64 compatibility
if [[ "$CARCH" == "x86_64" ]]; then
sed "5,5c\export LD_LIBRARY_PATH=/opt/lib32/usr/lib/:/opt/lib32/lib/:\$LD_LIBRARY_PATH" -i et.sh
sed "5,5c\export LD_LIBRARY_PATH=/opt/lib32/usr/lib/:/opt/lib32/lib/:\$LD_LIBRARY_PATH" -i etded.sh
fi
# Place scripts in main directory
install -Dm 755 et.sh $pkgname/et
install -Dm 755 etded.sh $pkgname/etded
# Apply patched executables
cp Enemy\ Territory\ $pkgver/linux/{et,etded}.x86 $pkgname
# Make PunkBuster updater utility executable
chmod +x $pkgname/pb/pbweb.x86
# Make directories for PunkBuster with necessary permissions to
# work with games user and group
install -dm 2775 -g games $pkgname/pb $pkgname/pb/{dll,htm,svlogs,svss}
# Install licenses
install -Dm 644 $pkgname/EULA_Wolfenstein_Enemy_Territory.txt \
$pkgdir/usr/share/licenses/$pkgname/EULA_Wolfenstein_Enemy_Territory.txt
install -Dm 644 $pkgname/pb/PB_EULA.txt $pkgdir/usr/share/licenses/$pkgname/PB_EULA.txt
# Make directories and move game data
install -d $pkgdir/{opt,usr/bin}
mv $pkgname $pkgdir/opt
# Install PunkBuster updater script
install -Dm 755 et-pbupdate.sh $pkgdir/usr/sbin/et-pbupdate
# Install rc.d script
install -Dm 755 et-ded $pkgdir/etc/rc.d/et-ded
# Install desktop file and icon
install -Dm 644 $pkgname.desktop $pkgdir/usr/share/applications/$pkgname.desktop
install -Dm 644 $pkgdir/opt/$pkgname/ET.xpm $pkgdir/usr/share/pixmaps/$pkgname.xpm
# Install et-sdl-sound
install -m 755 et-sdl-sound $pkgdir/usr/bin/enemy-territory
# Make symlinks to main scripts
ln -sf /opt/$pkgname/etded $pkgdir/usr/bin/${pkgname}d
}