# Template file for 'gtk+'
pkgname=gtk+
version=2.24.32
revision=2
build_style=gnu-configure
build_helper="gir"
configure_args="--enable-man $(vopt_enable cups) --with-xinput $(vopt_enable gir introspection)"
hostmakedepends="pkg-config perl xmlto glib-devel $(vopt_if gir gobject-introspection)"
makedepends="libglib-devel libXcursor-devel
 libXext-devel libXrender-devel libXinerama-devel libXi-devel libXrandr-devel
 libXcomposite-devel libXdamage-devel fontconfig-devel gdk-pixbuf-devel
 cairo-devel pango-devel atk-devel $(vopt_if cups cups-devel)"
depends="shared-mime-info dbus-x11 gtk-update-icon-cache"
conf_files="/etc/gtk-2.0/im-multipress.conf"
short_desc="GTK+ toolkit (v2)"
maintainer="Juan RP <xtraeme@voidlinux.org>"
license="LGPL-2.1-or-later"
homepage="http://www.gtk.org"
distfiles="${GNOME_SITE}/gtk+/2.24/gtk+-${version}.tar.xz"
checksum=b6c8a93ddda5eabe3bfee1eb39636c9a03d2a56c7b62828b359bf197943c582e

CFLAGS="-UGDK_PIXBUF_DISABLE_DEPRECATED"
# Package build options
build_options="gir cups"
build_options_default="cups"

case "$XBPS_TARGET_MACHINE" in
	i686-musl|x86_64-musl) build_options_default+=" gir" ;;
	*-musl) ;;
	*) build_options_default+=" gir" ;;
esac

if [ "$CROSS_BUILD" ]; then
	hostmakedepends+=" automake libtool gtk-doc glib-devel gdk-pixbuf-devel gtk-update-icon-cache"
	pre_configure() {
		autoreconf -if
	}
fi

post_install() {
	# Provide a default (icon)theme and font.
	vinstall ${FILESDIR}/gtkrc 644 usr/share/gtk-2.0
}

gtk+-devel_package() {
	depends="libglib-devel atk-devel cairo-devel gdk-pixbuf-devel pango-devel gtk+>=${version}_${revision}"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/include
		vmove usr/lib/pkgconfig
		vmove "usr/lib/*.so"
		vmove usr/lib/gtk-2.0/include
		if [ "$build_option_gir" ]; then
			vmove usr/share/gir-1.0
		fi
		vmove usr/share/gtk-doc
		vmove usr/share/aclocal
	}
}
gtk+-demo_package() {
	short_desc+=" - demonstration application"
	pkg_install() {
		vmove usr/bin/gtk-demo
		vmove usr/share/gtk-2.0/demo
	}
}
gtk-update-icon-cache_package() {
	short_desc+=" - The GTK+ update icon cache tool"
	pkg_install() {
		vmove usr/bin/gtk-update-icon-cache
		vmove usr/share/man/man1/gtk-update-icon-cache.1
	}
}