#! /usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

%:
	dh $@ --with python2,autoreconf

override_dh_auto_configure:
	dh_auto_configure -B build/gtk2 -- --with-gtk=2.0 \
                                           --with-python \
                                           --disable-introspection \
                                           --libdir="\$${prefix}/lib/$(DEB_HOST_MULTIARCH)" \
                                           $(shell dpkg-buildflags --export=configure)
	dh_auto_configure -B build/gtk3 -- --with-gtk=3.0 \
                                           --with-examples \
                                           --enable-introspection \
                                           --libdir="\$${prefix}/lib/$(DEB_HOST_MULTIARCH)" \
                                           $(shell dpkg-buildflags --export=configure)

override_dh_auto_build:
	dh_auto_build -D build/gtk2
	dh_auto_build -D build/gtk3

override_dh_auto_install:
	dh_auto_install -D build/gtk2 --destdir=debian/gtk2
	dh_auto_install -D build/gtk3 --destdir=debian/gtk3

override_dh_auto_clean:
	rm -rf debian/gtk2 debian/gtk3 build
	dh_auto_clean -B build/gtk2
	dh_auto_clean -B build/gtk3

override_dh_auto_test:
	dh_auto_test -B build/gtk2
	dh_auto_test -B build/gtk3

override_dh_install:
	dh_install -plibgvnc-1.0-0 \
                   -plibgvnc-1.0-dev \
                   -plibgtk-vnc-2.0-0 \
                   -plibgtk-vnc-2.0-dev \
                   -pgir1.2-gtk-vnc-2.0 \
                   -pgvncviewer \
                  --sourcedir=debian/gtk3

	dh_install -plibgtk-vnc-1.0-0 \
                   -plibgtk-vnc-1.0-dev \
                   -ppython-gtk-vnc \
                  --sourcedir=debian/gtk2

override_dh_strip:
	dh_strip -plibgvnc-1.0-0
	dh_strip -plibgtk-vnc-1.0-0
	dh_strip -plibgtk-vnc-2.0-0
	dh_strip -pgvncviewer -ppython-gtk-vnc

override_dh_python2:
	dh_python2 --no-guessing-versions

override_dh_makeshlibs:
	dh_makeshlibs -plibgtk-vnc-1.0-0 -V 'libgtk-vnc-1.0-0 (>= 0.3.9)'
	dh_makeshlibs -a -Nlibgtk-vnc-1.0-0
	dh_girepository
