# Contributor: A. Wilcox <awilfox@adelielinux.org>
# Maintainer: A. Wilcox <awilfox@adelielinux.org>
pkgname=xmoto
pkgver=0.5.11
pkgrel=0
pkgdesc="Challenging 2D motocross platform game"
url="https://xmoto.tuxfamily.org/"
arch="all"
license="GPL-2.0+"
depends=""
makedepends="bzip2-dev curl-dev glu-dev libjpeg-turbo-dev libpng-dev
	libxdg-basedir-dev libxml2-dev lua5.3-dev mesa-dev ode-dev sdl-dev
	sdl_mixer-dev sdl_net-dev sdl_ttf-dev sqlite-dev zlib-dev"
subpackages="$pkgname-doc $pkgname-lang"
source="http://download.tuxfamily.org/xmoto/xmoto/0.5.11/xmoto-$pkgver-src.tar.gz
	stupid-lua.patch
	utf8.patch
	"

prepare() {
	cd "$builddir"
	default_prepare
	update_config_sub
	rm -r src/ode
}

build() {
	cd "$builddir"
	./bootstrap
	CPPFLAGS="$CPPFLAGS -D_GLIBCXX_USE_CXX11_ABI=0" \
	LDFLAGS="$LDFLAGS $(pkg-config --libs lua)" \
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var
	make
}

check() {
	cd "$builddir"
	make check
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install
	install -D -m644 "$builddir"/extra/xmoto.desktop \
		"$pkgdir"/usr/share/applications/xmoto.desktop
	install -D -m644 "$builddir"/extra/xmoto.xpm \
		"$pkgdir"/usr/share/icons/hicolor/48x48/apps/xmoto.xpm
}

sha512sums="7046745e8f7a045fa2ce1deb3fd75b73b233dc1092f5ecd6dd4e42938f70269a93a3a623a39a1f0520c90643a42dc1ce93c43ad07bf225ff6c50741cc02511f6  xmoto-0.5.11-src.tar.gz
34dc4d83df72d0323d2995b35faacd6c097f1f381805a724c6a8a1edbf59c894e3db68057ef68b65f659d73e9d0976263bc5229b0502281d7c748519de86c55b  stupid-lua.patch
a43cafba12864bc2efd978fcef69ac5256b625dd581f02a93bafae7c4edaad9ebcadbd597fe31db77c85747400405c9fb6b55e494b9d6ded893e5d48f37e57ec  utf8.patch"