# Contributor: David Demelier <markand@malikania.fr>
# Maintainer: David Demelier <markand@malikania.fr>
pkgname=opensurge
pkgver=0.6.0.3
pkgrel=0
pkgdesc="2D retro platformer inspired by Sonic games"
url="https://opensurge2d.org"
arch="all"
license="GPL-3.0-only"
makedepends="allegro-dev cmake linux-headers surgescript-dev"
source="opensurge-$pkgver.tar.gz::https://github.com/alemart/opensurge/archive/refs/tags/v$pkgver.tar.gz
	patch-zip.patch
"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_BUILD_TYPE=None \
		-DGAME_BINDIR=/bin \
		$CMAKE_CROSSOPTS .
	cmake --build build
}

check() {
	cd build
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
b8c4573d5fda0d5b70d372418e41ee94ba75f1cd0aa1b71b11e5ac22bd5b6864a641e63971d2693fc3df991662c80312fccabc3f6f9114f403a727a3c17ce15c  opensurge-0.6.0.3.tar.gz
e830dcac54afa3d8042a5ac647dbcf96df065639b425070f7b5874741360996b46a6ffe30b14b6b01f19b9404e2541d020d7bba7caf0c29f2408a2531deba991  patch-zip.patch
"
