# Maintainer: Antoni Aloy <aaloytorrens@gmail.com>
pkgname=lzdoom
pkgver=3.88a
pkgrel=2
pkgdesc="Feature centric port for all Doom engine games (legacy GL 2.0 support)"
url="https://www.zdoom.org/"
# x86 blocked by sse2
# ppc64 blocked by zmusic
# riscv64 fails to build, link-make applet not found
# s390x: no desktop
# armhf: blocked by openmp
#arch="all !x86 !ppc64le !s390x !riscv64 !armhf"
license="GPL-3.0-or-later"
depends="fluidsynth"
makedepends="
	cmake nasm musl-fts-dev sdl2-dev gtk+3.0-dev zlib-dev
	zmusic-dev bzip2-dev libjpeg-turbo-dev libgme-dev
	openal-soft-dev mpg123-dev libsndfile-dev
	mesa-dev samurai vulkan-loader-dev openmp-dev
	"
subpackages="$pkgname-doc"
source="
	no-execinfo.patch
	0001-link-zipdir-against-fts.patch
	0002-fix-musl-fts.patch
	$pkgname-$pkgver.tar.gz::https://github.com/drfrag666/gzdoom/archive/refs/tags/$pkgver.tar.gz
	"
builddir="$srcdir/gzdoom-$pkgver"
options="!check" # No test suite

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi

	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DBUILD_SHARED_LIBS=True \
		-DDYN_GTK=OFF \
		-DDYN_OPENAL=OFF \
		$CMAKE_CROSSOPTS
	cmake --build build
}

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

sha512sums="
11704040f77f0ebf94ab7d25a497e28efa0d373f9ee4854a0f5ec6175cdaa8f2e9230ff35552a962092a7ed852ac5b97a73966fd11fed3e4ebdc585b9dd1672b  no-execinfo.patch
7e2f5e593cabf618c2e5c520380af01ba4aa3fef9955a6305888d2bb017af25579ee02bd16b6c6080ac4e823498b224edb553f998b8a6d7833d4789070931c38  0001-link-zipdir-against-fts.patch
7fed60cb9006653c9a85c226e98efae02b3f7f6bd34c47db03f29bc98bf1584f7e128394ab920956d799efa6bace3605f628fd806e130410243e3fdc78b417bc  0002-fix-musl-fts.patch
7c083bc57c32cefcc84dbe157e3bf76e67d6fd61ff5d65c50bfaf7ed60a8bf54874ed98c80ebda61d6ef4133758186a8a8b2814d52a335c51b08630b1774fec4  lzdoom-3.88a.tar.gz
"
