# Template file for 'gtk-vnc'
pkgname=gtk-vnc
version=0.4.4
revision=4
makedepends="perl>=0 pkg-config intltool gobject-introspection gtk+3-devel
 gnutls-devel>=3.1.5 libsasl-devel vala-devel python-devel pygtk-devel"
short_desc="VNC viewer widget for GTK"
maintainer="Juan RP <xtraeme@gmail.com>"
homepage="http://www.gnome.org"
license="GPL-2"
distfiles="${GNOME_SITE}/$pkgname/0.4/$pkgname-$version.tar.xz"
checksum=c93fdb53c78b52a1cfa067c1a0be0b93d4adfc17ccea1215f20eeab2818308b7

post_extract() {
	cp -a ${wrksrc} /tmp/gtk2-build
	cp -a ${wrksrc} /tmp/gtk3-build
	mv /tmp/gtk[23]-build ${wrksrc}
}

do_configure() {
	cd ${wrksrc}/gtk2-build
	./configure ${configure_args} --with-python --disable-static --with-gtk=2.0

	cd ${wrksrc}/gtk3-build
	./configure ${configure_args} --with-python --disable-static --with-gtk=3.0
}

do_build() {
	cd ${wrksrc}/gtk2-build
	make ${makejobs}

	cd ${wrksrc}/gtk3-build
	make ${makejobs}
}

do_install() {
	cd ${wrksrc}/gtk2-build
	make DESTDIR=${DESTDIR} install

	cd ${wrksrc}/gtk3-build
	make DESTDIR=${DESTDIR} install
}

gtk2-vnc_package() {
	short_desc+=" - GTK+2 port"
	pkg_install() {
		vmove "usr/lib/libgtk-vnc-1.0.so*"
		vmove usr/lib/girepository-1.0/GtkVnc-1.0.typelib
	}
}

gtk2-vnc-devel_package() {
	depends="gtk+-devel gtk-vnc-devel>=${version}"
	short_desc+=" - GTK+2 development files"
	pkg_install() {
		vmove usr/include/gtk-vnc-1.0
		#vmove usr/share/vala/vapi/gtk-vnc-1.0.vapi
		vmove usr/share/gir-1.0/GtkVnc-1.0.gir
		vmove usr/lib/pkgconfig/gtk-vnc-1.0.pc
	}
}

gtk2-vnc-python_package() {
	short_desc+=" - python bindings"
	pkg_install() {
		vmove usr/lib/python2.7
	}
}

gtk-vnc-devel_package() {
	depends="glib-devel gtk+3-devel gtk-vnc>=${version}"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/include/gvnc-1.0
		vmove usr/include/gtk-vnc-2.0
		vmove usr/lib/pkgconfig/gtk-vnc-2.0.pc
		vmove usr/lib/pkgconfig/gvnc-1.0.pc
		vmove usr/share/vala/vapi/gtk-vnc-2.0.deps
		vmove usr/share/vala/vapi/gtk-vnc-2.0.vapi
		vmove usr/share/vala/vapi/gvnc-1.0.vapi
		vmove usr/share/gir-1.0/GVnc-1.0.gir
		vmove usr/share/gir-1.0/GtkVnc-2.0.gir
	}
}

gtk-vnc_package() {
	pkg_install() {
		vmove usr
	}
}