# Contributor: David Demelier <markand@malikania.fr>
# Maintainer: David Demelier <markand@malikania.fr>
pkgname=wesnoth
pkgver=1.18.3
_major=${pkgver%.*}
pkgrel=0
pkgdesc="turn-based strategy game in fantasy world"
url="https://www.wesnoth.org"
arch="all !riscv64" # textrel on rv64
license="GPL-2.0-only"
makedepends="
	boost-dev
	cairo-dev
	curl-dev
	cmake
	dbus-dev
	fontconfig-dev
	libvorbis-dev
	openssl-dev>3
	pango-dev
	readline-dev
	samurai
	sdl2-dev
	sdl2_image-dev
	sdl2_mixer-dev
	"
subpackages="$pkgname-doc"
source="https://sourceforge.net/projects/wesnoth/files/wesnoth-$_major/wesnoth-$pkgver/wesnoth-$pkgver.tar.bz2"
options="!check !fhs" # No tests, creates dirs under /var/run

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=Release \
		$CMAKE_CROSSOPTS
	cmake --build build
}

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

sha512sums="
def324c9ed66ac59e2a9d0ab9ab95f00ddab2d31dacb2d0b5cfba42c5acdba210937f7dd6afde8870a387847a6d021a28dffcb04ce513272df6a4b52a626f30a  wesnoth-1.18.3.tar.bz2
"
