# Template file for 'gdash'
pkgname=gdash
version=20130427
revision=1
wrksrc=${pkgname}-${version}unstable
build_style=gnu-configure
hostmakedepends="automake libtool gettext-devel glib-devel gtk+-devel SDL-devel pkg-config"
makedepends="glu-devel gtk+-devel SDL_image-devel SDL_mixer-devel"
depends="gdash-data>=${version}_${revision}"
configure_args="--with-sdl-prefix=${XBPS_CROSS_BASE}/usr"

short_desc="Boulder Dash clone close to the original"
maintainer="Jürgen Buchmüller <pullmoll@t-online.de>"
license="MIT"
homepage="https://bitbucket.org/czirkoszoltan/gdash"
distfiles="https://bitbucket.org/czirkoszoltan/${pkgname}/downloads/${pkgname}-${version}unstable.tar.gz"
checksum="e50d18bcd0d08fcfd07a6a213f7e93be5e56154214de83623f6247ca6e98ac21"

if [ -n "$CROSS_BUILD" ]; then
	# Make sure SDL_opengl.h finds GL/gl.h
	CXXFLAGS="-I${XBPS_CROSS_BASE}/usr/include"
fi

pre_configure() {
	mv configure.{in,ac}
	sed -i Makefile.am -e "/ACLOCAL_AMFLAGS = -Im4/a AUTOMAKE_OPTIONS = subdir-objects"
	sed -i src/Makefile.am -e "1a AUTOMAKE_OPTIONS = subdir-objects"
	autoreconf -if
}

pre_build() {
	if [ "$CROSS_BUILD" ]; then
		cd ${wrksrc}/include
		g++ -O2 -o file2c file2c.cpp
		sed -i Makefile -e "s; file2c;;"
	fi
}

post_install() {
	vlicense COPYING
}

gdash-data_package() {
	short_desc+=" - data files"
	noarch=yes
	pkg_install() {
		vmove usr/share/gdash
	}
}
