# Template file for 'opensonic'
pkgname=opensonic
version=0.1.4
revision=10
_loggcompat_ver=4.4.2
build_wrksrc="opensnc-src-${version}"
build_style=cmake
configure_args="-DCMAKE_C_STANDARD_LIBRARIES=-lalleg"
hostmakedepends="allegro4-devel cmake"
makedepends="allegro4-devel libpng-devel libvorbis-devel"
depends="desktop-file-utils"
short_desc="Open-source game based on the Sonic the Hedgehog universe"
maintainer="Orphaned <orphan@voidlinux.org>"
license="GPL-2.0-or-later"
homepage="http://opensnc.sourceforge.net/"
distfiles="${SOURCEFORGE_SITE}/opensnc/opensnc-src-${version}.tar.gz
 https://github.com/t6/loggcompat/archive/${_loggcompat_ver}.tar.gz"
checksum="3a4c3fa9538ee27c04b5ea848c9ad0a83f335471936d4617a18d3648c42588e9
 481fe569959eefa92d0babeca27709b2efcf7a815cd5c49596b6c0403db76a4e"
patch_args="-Np1 --directory=${build_wrksrc}"

replaces="opensonic-data>=0"
CFLAGS="-I./../loggcompat-${_loggcompat_ver}"

post_extract() {
	cd ${build_wrksrc}
	mv ${wrksrc}/loggcompat-${_loggcompat_ver} .
}

pre_configure() {
	# mimic what ./configure would do
	export _ALLEGRO_LIBS="$(allegro-config --libs)"
	export _ALLEGRO_VERSION="$(allegro-config --version)"
}

post_install() {
	rm ${DESTDIR}/usr/share/opensonic/opensonic
	vbin build/opensonic
	vinstall icon.png 644 usr/share/${pkgname}
	vinstall ${FILESDIR}/opensonic.desktop 644 usr/share/applications
}
