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

pkgname=wf-psxavenc
_pkgver=0.3.1
pkgver=0.3.1.r42.bdc24e8
pkgrel=1
epoch=
pkgdesc="PS1 audio/video encoding tool"
arch=("i686" "x86_64" "armv6h" "aarch64")
url="https://github.com/WonderfulToolchain/psxavenc"
license=("zlib")
source=("$pkgname::git+https://github.com/WonderfulToolchain/psxavenc#branch=main")
depends=(runtime-musl runtime-ffmpeg)
makedepends=(runtime-musl-dev runtime-ffmpeg-dev)
sha256sums=('SKIP')

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

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

build() {
	cd "$pkgname"

	PKG_CONFIG_PATH="$WF_RUNTIME_PKG_CONFIG_PATH" \
	CFLAGS="$WF_RUNTIME_INCLUDES" \
	LDFLAGS="$WF_RUNTIME_LDFLAGS" \
	meson setup build \
		--prefix="$WF_PATH" \
		-Db_lto=true
	cd build
	meson compile
}

package() {
	cd "$pkgname"/build

	mkdir -p "$pkgdir$WF_DESTDIR"/bin
	cp -a psxavenc "$pkgdir$WF_DESTDIR"/bin/wf-psxavenc
}
