# Contributor: Saijin-Naib <Saijin-Naib_package-maintenance@outlook.com>
# Maintainer: Saijin-Naib <Saijin-Naib_package-maintenance@outlook.com>
pkgname=libopenraw
pkgver=0.3.7
pkgrel=1
pkgdesc="Desktop agnostic effort to support digital camera RAW files"
url="https://libopenraw.freedesktop.org/"
arch="all"
license="LGPL-3.0-or-later"
makedepends="
	boost-dev
	cargo
	curl-dev
	gdk-pixbuf-dev
	libjpeg-turbo-dev
	libxml2-dev
	"
subpackages="$pkgname-dev $pkgname-pixbuf-loader"
source="https://libopenraw.freedesktop.org/download/libopenraw-$pkgver.tar.bz2
	getrandom-0.2.10.patch
	"
options="net" # cargo fetch

prepare() {
	default_prepare
	update_config_sub

	cd lib/mp4
	mv -v .cargo/config.toml .cargo/config.toml.temp
	cargo vendor --locked
	mv -v .cargo/config.toml.temp .cargo/config.toml
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--disable-static
	make
}

check() {
	make check
}

package() {
	make install DESTDIR="$pkgdir"
}

loader() {
	pkgdesc="$pkgdesc (pixbuf loader)"
	install_if="$pkgname=$pkgver-r$pkgrel gdk-pixbuf-loaders"

	amove \
		usr/lib/gdk-pixbuf-*/*/loaders
}

sha512sums="
1ee8386617d8ea6d0d6b755ddb8f268ed37e553ad52f2c9a19d7c81654d7bfa61d5fab6dc4bce1b79d534a4c77dbd68b8d07b665be9bf29c03a7eb8aa01fdc28  libopenraw-0.3.7.tar.bz2
49601fea0d3370ab2bef52a74fdad108d1bb1bc6448f70df0dde722ad4bedbfb1c6fff160605183e0b4100bf7b3b1d32c3da379348abdd9215278ec3592188db  getrandom-0.2.10.patch
"
