# Template file for 'gdk-pixbuf'
pkgname=gdk-pixbuf
version=2.38.0
revision=1
build_style=meson
configure_args="-Dgir=$(vopt_if gir true false) -Djasper=false
 -Dpng=true -Dx11=true -Dinstalled_tests=false"
hostmakedepends="gettext-devel glib-devel pkg-config
 $(vopt_if gir 'gobject-introspection') libxslt docbook-xsl"
makedepends="libX11-devel libglib-devel libpng-devel tiff-devel
 shared-mime-info"
short_desc="Image loading library for The GTK+ toolkit (v2)"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
license="GPL-2.0-or-later"
homepage="https://wiki.gnome.org/Projects/GdkPixbuf"
distfiles="${GNOME_SITE}/${pkgname}/${version%.*}/${pkgname}-${version}.tar.xz"
checksum=dd50973c7757bcde15de6bcd3a6d462a445efd552604ae6435a0532fbbadae47

# Package build options
build_options="gir"

# Disable gir for cross builds.
if [ "$CROSS_BUILD" ]; then
	hostmakedepends+=" gdk-pixbuf-devel"
else
	build_options_default="gir"
fi

pre_configure() {
	if [ "$CROSS_BUILD" ]; then
		touch gdk-pixbuf/loaders.cache
	fi
	sed -i "s|subdir('tests')||g" -i meson.build
}

gdk-pixbuf-xlib_package() {
	short_desc+=" - xlib rendering library"
	pkg_install() {
		vmove usr/lib/libgdk_pixbuf_xlib*.so.*
	}
}

gdk-pixbuf-devel_package() {
	depends="${makedepends} ${sourcepkg}-xlib>=${version}_${revision} ${sourcepkg}>=${version}_${revision}"
	short_desc+=" - development files"
	pkg_install() {
		vmove "usr/lib/*.so"
		vmove usr/lib/pkgconfig
		vmove usr/include
		vmove "usr/bin/*csource*"
		vmove "usr/share/man/man1/*csource*"
		if [ "$build_option_gir" ]; then
			vmove usr/share/gir-1.0
		fi
	}
}
