### this file is sourced not run
PKGVER=2.42.10
PKGBUILD=1
PKGARCH=x86_64

# source: BLFS 11.3
TARBALL=gdk-pixbuf-$PKGVER.tar.xz
MD5SUM=4a62f339cb1424693fba9bb7ffef8150
SRC_URL=https://download.gnome.org/sources/gdk-pixbuf/2.42/$TARBALL
BUNDLE=

SLACKREQ='glib libjpeg-turbo libpng libtiff'
SLACKDESC="gdk-pixbuf: gdk-pixbuf $PKGVER (GTK Pixel Buffer library)  
gdk-pixbuf:  
gdk-pixbuf: The Gdk Pixbuf is a toolkit for image loading and pixel buffer 
gdk-pixbuf: manipulation. It is used by GTK+ 2 and GTK+ 3 to load and 
gdk-pixbuf: manipulate images. In the past it was distributed as part of GTK+ 
gdk-pixbuf: 2 but it was split off into a separate package in preparation for 
gdk-pixbuf: the change to GTK+ 3.  
gdk-pixbuf: 
gdk-pixbuf: 
gdk-pixbuf: 
gdk-pixbuf:
"

### default pkg_download
### prepare
pkg_prepare() {
	pkg_prepare_default &&

	# add back pcx loader. we can also add back jasper loader but loader-jp2 is superior
	cd tmp/gdk* &&
	patch -Np1 -i ../pkg/reinstate-pcx-loader-2.42.10.patch &&
	cp ../pkg/io-pcx.c gdk-pixbuf
}

### defaulg pkg_package
### build
pkg_build() {
	
	MESONFLAGS="$MESONFLAGS     \
		--wrap-mode=nofallback  \
		-Dtests=false           \
		-Dinstalled_tests=false \
		-Dman=true              \
		-Dgtk_doc=true          \
		-Dbuiltin_loaders=none  \
	"
	pkg_build_meson &&
	pkg_build_slackdesc &&
	
	# multilib
	mv -v /usr/bin/gdk-pixbuf-csource{,-64}                     &&
	mv -v /usr/bin/gdk-pixbuf-query-loaders{,-64}               &&
	ln -sfv multiarch_wrapper /usr/bin/gdk-pixbuf-csource       &&
	ln -sfv multiarch_wrapper /usr/bin/gdk-pixbuf-query-loaders &&

	mv -v /usr/share/gir-1.0/* /usr/share/gir-1.0-64 &&
	rm -r /usr/share/gir-1.0/
}
