# SPDX-License-Identifier: CC0-1.0
#
# SPDX-FileContributor: Adrian "asie" Siekierka, 2023

pkgname=wf-superfamiconv
_pkgver=0.11.0
pkgver=0.11.0.r185.f797d3d
pkgrel=1
epoch=
pkgdesc="Flexible and composable tile graphics converter"
arch=("i686" "x86_64" "armv6h" "aarch64")
url="https://github.com/WonderfulToolchain/SuperFamiconv"
license=("MIT")
source=("$pkgname::git+https://github.com/WonderfulToolchain/SuperFamiconv#branch=main")
depends=(runtime-gcc-libs runtime-musl)
makedepends=(runtime-musl-dev)
sha256sums=('SKIP')

. "/wf/config/runtime-env-vars.sh"

. "../templates/git-pkgver.PKGBUILD"

build() {
	CFLAGS="-O3 -flto -U_FORTIFY_SOURCE $WF_RUNTIME_INCLUDES" \
	CXXFLAGS="-O3 -flto -U_FORTIFY_SOURCE $WF_RUNTIME_INCLUDES" \
	LDFLAGS="$WF_RUNTIME_LDFLAGS" \
		cmake -B build -S "$pkgname" -DCMAKE_BUILD_TYPE=Release
	cmake --build build
}

package() {
	mkdir -p "$pkgdir$WF_DESTDIR"/bin
	cp -a build/superfamiconv "$pkgdir$WF_DESTDIR"/bin/wf-superfamiconv
}
