# Contributor: knuxify <knuxify@gmail.com>
# Maintainer: knuxify <knuxify@gmail.com>
pkgname=liblcf
pkgver=0.8
pkgrel=2
pkgdesc="Library to handle RPG Maker 2000/2003 and EasyRPG projects"
url="https://easyrpg.org/"
arch="all"
license="MIT"
depends="shared-mime-info" # provides MIME type data
makedepends="cmake samurai icu-dev expat-dev"
install="$pkgname.post-install"
subpackages="$pkgname-dev $pkgname-tools:_tools"
source="https://github.com/EasyRPG/liblcf/archive/refs/tags/$pkgver/liblcf-$pkgver.tar.gz
	include-cstdint.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_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-GNinja \
		$CMAKE_CROSSOPTS
	cmake --build build
}

check() {
	cmake --build build --target check
}

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

_tools() {
	amove usr/bin
}

sha512sums="
54f3c2d330e82cbf7a17256cfe9a17e968895bb58968c212d4e3604d79f9c1e0492163ab01c53f060cffd8ee7f4280bb8ac939be110927f6a524c1799ba335b5  liblcf-0.8.tar.gz
e52609272e6416e20f961553d711acc08671029f77b8c54d8e6cb8da0c4cfa7d6aacd68c918ad81f634fba1d68e3342b61f52a13bb5b39acda256f2baebcf2b4  include-cstdint.patch
"
