File PKGBUILD of Package xash3d-sdl

# Maintainer: robertfoster
# Thanks, robertfoster :)
# -- a1batross 

pkgname=xash3d-sdl
pkgver=0
pkgrel=1
pkgdesc=""Xash3D FWGS Engine"
arch=('i686' 'x86_64' 'arm' 'armv6h' 'armv7h')
url="http://xash.su/"
license=('GPL3')
depends_i686=('sdl2' 'freetype2' 'fontconfig' )
depends_arm=('sdl2' 'freetype2' 'fontconfig')
depends_armv6h=('sdl2' 'freetype2' 'fontconfig')
depends_armv7h=('sdl2' 'freetype2' 'fontconfig')
depends_x86_64=('lib32-sdl2' 'lib32-freetype2' 'lib32-fontconfig' 'iib32-vgui')
makedepends=('make' 'binutils' 'cmake')
makedepends_i686=('gcc')
makedepends_arm=('gcc')
makedepends_armv6h=('gcc')
makedepends_armv7h=('gcc')
makedepends_x86_64=('gcc-multilib' 'lib32-gcc-libs')
install=
source=("xash3d-$pkgver.tar.gz")

prepare() {
	cd $srcdir/$pkgname
	git submodule init && git submodule update
	mkdir -p build
}

build_x86_64() {
	cd $srcdir/$pkgname
	cd build
	cmake ../. \
       	-DXASH_SDL=yes \
        -DXASH_VGUI=yes \
        -DXASH_DLL_LOADER=yes \
        -DXASH_DEDICATED=no \
        -DHL_SDK_DIR=${PWD}/hlsdk/ \
        -DCMAKE_BUILD_TYPE=release \
        -DCMAKE_INSTALL_PREFIX=/usr \
        -DXASH_RELEASE=yes \
		-DCMAKE_CXX_FLAGS="-m32" \
        -DCMAKE_EXE_LINKER_FLAGS="-m32" \
        -DLIB_INSTALL_DIR=lib32
	make
}

build() {
	cd $srcdir/$pkgname
	cd build
	cmake ../. \
    	-DXASH_SDL=yes \
        -DXASH_VGUI=yes \
        -DXASH_DLL_LOADER=yes \
        -DXASH_DEDICATED=no \
        -DHL_SDK_DIR=${PWD}/hlsdk/ \
        -DCMAKE_BUILD_TYPE=release \
        -DCMAKE_INSTALL_PREFIX=/usr \
        -DXASH_RELEASE=yes
	make V=1
}

package() {
	cd $srcdir/$pkgname/
	cd build
	make DESTDIR="$pkgdir" V=1 install
}