# Contributor: Elly Fong-Jones <elly@elly.town>
# Maintainer: Elly Fong-Jones <elly@elly.town>
pkgname=qoi
pkgver=0.0.0_git20230312
_commit=f6dffaf1e8170cdd79945a4fb60f6403e447e020
pkgrel=0
pkgdesc="Quite OK Image format reference implementation"
url="https://github.com/phoboslab/qoi"
arch="all"
license="MIT"
depends_dev="$pkgname=$pkgver-r$pkgrel"
makedepends="stb" # for qoiconv
subpackages="qoiconv qoi-dev"
source="https://github.com/phoboslab/qoi/archive/$_commit.tar.gz"
builddir="$srcdir/qoi-$_commit"
options="!check" # no tests

build() {
	# pass through ldflags, single-file
	make CFLAGS="$CFLAGS $LDFLAGS" qoiconv
}

package() {
	depends="qoiconv=$pkgver-r$pkgrel"
	install -Dm644 qoi.h -t "$pkgdir"/usr/include

	# note that qoibench is not built: it is a tool for benchmarking qoi
	# compression vs libpng, so it adds a dep on libpng, and is more useful
	# for development of qoi than users of qoi.
	install -Dm755 qoiconv -t "$pkgdir"/usr/bin
}

qoiconv() {
	pkgdesc="$pkgdesc (qoiconv utility)"
	amove usr/bin/qoiconv
}

sha512sums="
4e19584895232fa5b3a06598cc272fc51b58c2a59006f9443afdb8f728b9724ae57a3c6c6937c684cc1b2e7e8f9c58785b1933a3b5321fd7cd34651e884f76d7  f6dffaf1e8170cdd79945a4fb60f6403e447e020.tar.gz
"
