# Template file for 'openmw'
pkgname=openmw
version=0.47.0
revision=1
wrksrc="${pkgname}-${pkgname}-${version}"
build_style=cmake
# System bullet doesn't use double precision (double precision would break vdrift)
# LTO gives a measurable performance boost, while not hurting compile time too much
configure_args="-DDESIRED_QT_VERSION=5 -DOPENMW_USE_SYSTEM_BULLET=OFF
 -DOPENMW_LTO_BUILD=ON"
hostmakedepends="pkg-config qt5-host-tools qt5-qmake"
makedepends="SDL2-devel boost-devel ffmpeg-devel libXt-devel
 libmygui-devel libopenal-devel libunshield-devel osg-devel qt5-devel
 liblz4-devel"
short_desc="Open Implementation of Morrowind's Engine"
maintainer="John <me@johnnynator.dev>"
license="GPL-3.0-or-later"
homepage="http://openmw.org"
changelog="https://openmw.org/2021/openmw-0-47-0-released/"
distfiles="https://gitlab.com/OpenMW/openmw/-/archive/openmw-${version}/openmw-openmw-${version}.tar.gz"
checksum=bd7f77e1527c2180e9b0dfcbe401d6fb48f24dbb37701dac7747697873d6edb4

if [ "$XBPS_TARGET_ENDIAN" != "le" ]; then
	broken="https://gitlab.com/OpenMW/openmw/issues/564"
fi

if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
	broken="https://build.voidlinux.org/builders/armv6l_builder/builds/26346/steps/shell_3/logs/stdio"
fi

openmw-cs_package() {
	short_desc="Open Implementation of Morrowinds Creation Set"
	depends="openmw-${version}_${revision}"
	pkg_install() {
		vmove usr/bin/openmw-cs
		vmove usr/share/applications/org.openmw.cs.desktop
		vmove usr/share/pixmaps/openmw-cs.png
		vmove etc/openmw/defaults-cs.bin
	}
}

esmtool_package() {
	short_desc="Tool for inspecting and extracting Morrowind's ES files"
	pkg_install() {
		vmove usr/bin/esmtool
	}
}

bsatool_package() {
	short_desc="Tool for inspecting Bethesda's BSA archives"
	pkg_install() {
		vmove usr/bin/bsatool
	}
}
