From b4fcba27bfd7d3b1e847ef91600caaa9d18ef46a Mon Sep 17 00:00:00 2001
From: Jeremy Bicha <jbicha@ubuntu.com>
Date: Wed, 21 Dec 2016 22:16:09 -0500
Subject: [PATCH 2/6] Use dh7 style rules

---
 debian/rules | 78 +++++++-----------------------------------------------------
 1 file changed, 8 insertions(+), 70 deletions(-)

diff --git a/debian/rules b/debian/rules
index 68edba9..be2581e 100755
--- a/debian/rules
+++ b/debian/rules
@@ -2,87 +2,25 @@
 # spice-gtk debian/rules using debhelper
 # Copyright (C) 2011 Liang Guo <bluestonechina@gmail.com>
 
-ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
-  CXXFLAGS += -g
-endif
-
-ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
-	CFLAGS += -O0
-else
-	CFLAGS += -O2
-endif
-
-DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
-DPKG_EXPORT_BUILDFLAGS = 1
-include /usr/share/dpkg/buildflags.mk
 
-build-arch: build
-build-indep: build
+%:
+	dh $@ --with gir
 
-build: build-stamp
-build-stamp: build-gtk3-stamp 
-	touch build-stamp
-
-build-gtk3-stamp:
-	mkdir build-gtk3
-	ls |egrep -v '(debian|build-gtk)'|xargs -i cp -r {} build-gtk3/
-	cp .version .tarball-version build-gtk3/
-	cd build-gtk3 && autoreconf
-	cd build-gtk3 && ./configure --prefix=/usr --libdir=/usr/lib/$(DEB_HOST_MULTIARCH) \
+override_dh_auto_configure:
+	dh_auto_configure -- \
 		--enable-smartcard=yes --with-gtk=3.0 --disable-static \
 		--enable-introspection --enable-vala --disable-celt051 \
 		--enable-usbredir=yes --enable-polkit=yes --enable-dbus=yes \
 		--enable-lz4=yes --enable-python-checks \
 		--with-usb-acl-helper-dir=/usr/lib/spice-gtk
-	$(MAKE) -C build-gtk3
-	touch build-gtk3-stamp
-
-clean: clean-patched 
-clean-patched: 
-	dh_testdir
-	dh_testroot
-	[ ! -d $(CURDIR)/build-gtk3 ] || rm -rf $(CURDIR)/build-gtk3
-	dh_clean 
 
-install: install-stamp
-install-stamp: build-stamp
-	dh_testdir
-	dh_testroot
-	dh_prep
-	dh_installdirs
-	$(MAKE) -C $(CURDIR)/build-gtk3 install DESTDIR=$(CURDIR)/debian/tmp
-	dh_install --sourcedir=debian/tmp
-	touch install-stamp
+override_dh_install:
+	find debian -name '*.la' -delete
+	dh_install --fail-missing
 
-binary-arch: build install
-	dh_testdir
-	dh_testroot
-	dh_install  --list-missing
-	dh_installchangelogs
-	dh_installdocs 
-	dh_installexamples
-	dh_installman
-	dh_python2 --no-guessing-versions
-	dh_link
+override_dh_strip:
 	dh_strip -pspice-client-gtk --ddeb-migration='spice-client-gtk-dbg  (<< 0.30~)'
 	dh_strip -pspice-client-glib-usb-acl-helper --ddeb-migration='spice-client-glib-usb-acl-helper-dbg (<< 0.30~)'
 	dh_strip -plibspice-client-glib-2.0-8 --ddeb-migration='spice-gtk-dbg (<< 0.30~)'
 	dh_strip -plibspice-client-gtk-3.0-5 --ddeb-migration='spice-gtk-dbg (<< 0.30~)'
-	dh_compress
-	dh_fixperms
-	dh_makeshlibs
-	dh_girepository
-	dh_installdeb
-	dh_shlibdeps
-	dh_gencontrol
-	dh_md5sums
-	dh_builddeb
-
-# Build architecture-independent files here.
-binary-indep: build install
-# We have nothing to do by default.
-
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install
-
-- 
2.10.2

