# Compiling Time: 0.71 SBU
# Maintainer: PacMiam <PacMiam@gmx.fr>

pkgname=xonotic
pkgver=0.7.0
pkgrel=1
pkgdesc="A free, fast-paced crossplatform first-person shooter"
url="http://xonotic.org"
depends=('alsa-lib' 'curl' 'libjpeg' 'libmodplug' 'libvorbis' 'libxpm' 'libxxf86dga' 'libxxf86vm' 'sdl' 'libpng>=1.4.0')
makedepends=('unzip' 'mesa')
groups=('games-extra')
archs=('i686' 'x86_64')
up2date="Flastarchive http://www.xonotic.org/download/  .zip"
source=(http://dl.xonotic.org/$pkgname-$pkgver.zip)
sha1sums=('436d4d3901e5e886f83888f31e670933dc8a715f')
options+=('nobuild')

build() {
        # le compiling
        Fcd Xonotic/source/darkplaces

        # build the binaries separately instead to avoid truncated files
        make CPUOPTIMIZATIONS="${CFLAGS}" DP_LINK_TO_LIBJPEG=1 cl-nexuiz || Fdie
        make CPUOPTIMIZATIONS="${CFLAGS}" DP_LINK_TO_LIBJPEG=1 sdl-nexuiz || Fdie
        make CPUOPTIMIZATIONS="${CFLAGS}" DP_LINK_TO_LIBJPEG=1 sv-nexuiz || Fdie

        Fmkdir usr/share/$pkgname

        # binaries
        Fexerel nexuiz-dedicated usr/share/$pkgname/$pkgname-dedicated
        Fexerel nexuiz-glx $pkgdir/usr/share/$pkgname/$pkgname-glx
        Fexerel nexuiz-sdl $pkgdir/usr/share/$pkgname/$pkgname-sdl

        # data
        Fcprel ../../data usr/share/$pkgname/

        # convenience files

	Fmkdir usr/share/pixmaps/
	Fcp  /Xonotic/misc/logos/icons_png/xonotic_512.png /usr/share/pixmaps/xonotic.png
        _F_desktop_filename="xonotic-glx"
        _F_desktop_name="Xonotic (GLX)"
        _F_desktop_icon="xonotic.png"
        _F_desktop_exec="xonotic-glx"
        _F_desktop_categories="Game"
        Fdesktop2

        _F_desktop_filename="xonotic-sdl"
        _F_desktop_name="Xonotic (SDL)"
        _F_desktop_icon="xonotic.png"
        _F_desktop_exec="xonotic-sdl"
        _F_desktop_categories="Game"
        Fdesktop2

        Fwrapper "cd /usr/share/xonotic && ./xonotic-glx $@" $pkgname-glx
        Fwrapper "cd /usr/share/xonotic && ./xonotic-sdl $@" $pkgname-sdl
        Fwrapper "cd /usr/share/xonotic && ./xonotic-dedicated $@" $pkgname-dedicated
}

# optimization OK
