# Template file for 'doom3'
pkgname=doom3
version=1.3.1.1304
revision=4
depends="virtual?libudev alsa-lib libXext desktop-file-utils"
short_desc="Doom 3 for Linux"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
license="Propietary"
homepage="http://www.doom3.com/"
distfiles="http://www.1337-server.net/doom3/doom3-linux-${version}.x86.run"
skip_extraction="doom3-linux-${version}.x86.run"
checksum=2f90dff20f2d3c0c47f17b3d6d45c4f0e7d27b986bf6084f21b85180cd1e03b4

# 32bit package for x86_64 built on x86 :-)
only_for_archs="i686"
repository="nonfree"
nostrip="yes"

create_wrksrc=yes
lib32mode=full

do_install() {
	# Extract files
	/bin/sh ${XBPS_SRCDISTDIR}/${pkgname}-${version}/doom3-linux-${version}.x86.run --noexec --target doom3

	cd doom3
	# Create Destination Directories
	install -d ${DESTDIR}/opt/doom3/{base,d3xp,pb/htm}

	# Install Game Files
	install -m 644 base/*   ${DESTDIR}/opt/doom3/base
	install -m 644 d3xp/*   ${DESTDIR}/opt/doom3/d3xp
	install -m 644 pb/htm/* ${DESTDIR}/opt/doom3/pb/htm
	install -m 644 {CHANGES,README,version.info} ${DESTDIR}/opt/doom3

	# Install Punkbuster Libraries
	install -m 755 pb/{pbag.so,pbags.so,pbcl.so,pbcls.so,pbsv.so} ${DESTDIR}/opt/doom3/pb

	# Install Game Binaries
	install -m 755 bin/Linux/x86/{doom.x86,doomded.x86} ${DESTDIR}/opt/doom3

	# Install Game Launcher (Client)
	vinstall ${FILESDIR}/doom3.launcher 755 usr/bin doom3

        # Install Game Launcher (Server)
        vinstall ${FILESDIR}/doom3-dedicated.launcher 755 usr/bin doom3-dedicated

	# Install License (DOOM 3)
	vinstall License.txt 644 usr/share/licenses/${pkgname}

	# Install License (Punkbuster)
	vinstall pb/PB_EULA.txt 644 usr/share/licenses/${pkgname}

	# Install Icon
	vinstall doom3.png 644 usr/share/pixmaps

	# Install Desktop File
	vinstall ${FILESDIR}/doom3.desktop 644 usr/share/applications
}
