# Description: set of bindings for the GTK widget set
# URL: http://www.pygtk.org/
# Maintainer: Petar Petrov, slackalaxy at gmail dot com
# Depends on: libglade python-cairo python-gobject

name=pygtk
version=2.24.0
release=1
source=(https://download.gnome.org/sources/$name/${version::4}/$name-$version.tar.bz2
	python27.patch
	fix-leaks-of-pango-objects.patch
	drop-pangofont.patch)

build() {
	cd $name-$version

	# https://bugzilla.gnome.org/show_bug.cgi?id=623965
	patch -p1 -i $SRC/python27.patch

	# https://bugzilla.gnome.org/show_bug.cgi?id=660216
	patch -p1 -i $SRC/fix-leaks-of-pango-objects.patch
	
	# fix build with new pango:
	# https://gitlab.gnome.org/Archive/pygtk/-/merge_requests/1
	patch -p1 -i $SRC/drop-pangofont.patch

	PYTHON=/usr/bin/python2  \
	./configure --prefix=/usr

	sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool

	make
	make DESTDIR=$PKG install

	install -m 0644 gtk/gtk-extrafuncs.defs $PKG/usr/share/pygtk/2.0/defs/

	rm -r $PKG/usr/share/gtk-doc
}