# Template file for 'gtk+'
pkgname=gtk+
version=2.24.33
revision=3
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 gtk-update-icon-cache
 $(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="Orphaned <orphan@voidlinux.org>"
license="LGPL-2.1-or-later"
homepage="https://gtk.org"
changelog="https://gitlab.gnome.org/GNOME/gtk/-/raw/gtk-2-24/NEWS"
distfiles="${GNOME_SITE}/gtk+/2.24/gtk+-${version}.tar.xz"
checksum=ac2ac757f5942d318a311a54b0c80b5ef295f299c2a73c632f6bfb1ff49cc6da
# X11 tests fail, not worth bothering on this dying package
make_check=no
# gtk-builder-convert
python_version=3

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

if [ "$CROSS_BUILD" ]; then
	hostmakedepends+=" automake libtool gtk-doc glib-devel gdk-pixbuf-devel"
fi

pre_configure() {
	if [ "$CROSS_BUILD" ]; then
		autoreconf -if
	fi
	vsed -i -e '/DATADIRNAME=/s/=.*/=share/' \
		-e '/CATOBJEXT=/s/\.mo/.gmo/' \
		configure
}

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

	# This is now provided by gtk+3
	rm ${DESTDIR}/usr/bin/gtk-update-icon-cache
	rm ${DESTDIR}/usr/share/man/man1/gtk-update-icon-cache.1
}

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
	}
}
