From 2d8e32882d3e007e64ddd80be7c3d6a61d6d2dc9 Mon Sep 17 00:00:00 2001
From: Jari Aalto <jari.aalto@cante.net>
Date: Sat, 14 Apr 2012 16:25:37 +0300
Subject: [PATCH] dh-harden
Organization: Private
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit

Signed-off-by: Jari Aalto <jari.aalto@cante.net>
---
 debian/changelog                       |   11 +++++
 debian/compat                          |    2 +-
 debian/control                         |    2 +-
 debian/copyright                       |    2 +-
 debian/patches/02-arg-req-space.patch  |   11 +++--
 debian/patches/03-userinput-font.patch |   13 +++---
 debian/rules                           |   70 ++++++--------------------------
 debian/source/format                   |    1 +
 8 files changed, 43 insertions(+), 69 deletions(-)
 create mode 100644 debian/source/format

diff --git a/debian/changelog b/debian/changelog
index dbc61b1..fa00ca6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,14 @@
+docbook-to-man (1:2.0.0-29.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Remove quilt dependency and upgrade to packaging format "3.0 quilt"
+    - Includes quilt style patch management built-in.
+    - Patches 02, 03: run "quilt refresh" to make them apply cleanly.
+  * Update to debhelper to 9 and enable all hardened build flags in rules file.
+  * Use dh_prep in rules file.
+
+ -- Jari Aalto <jari.aalto@cante.net>  Sat, 14 Apr 2012 16:05:33 +0300
+
 docbook-to-man (1:2.0.0-29) unstable; urgency=low
 
   * debian/control: added multi-arch foreign, standards version 3.9.3.
diff --git a/debian/compat b/debian/compat
index 7ed6ff8..ec63514 100644
--- a/debian/compat
+++ b/debian/compat
@@ -1 +1 @@
-5
+9
diff --git a/debian/control b/debian/control
index bb404f3..f14a561 100644
--- a/debian/control
+++ b/debian/control
@@ -2,7 +2,7 @@ Source: docbook-to-man
 Section: text
 Priority: optional
 Maintainer: Philipp Benner <philipp@debian.org>
-Build-Depends: debhelper (>= 5), quilt
+Build-Depends: debhelper (>= 9)
 Standards-Version: 3.9.3
 Vcs-Browser: http://svn.debian.org/wsvn/collab-maint/deb-maint/docbook-to-man/
 Vcs-Svn: svn://svn.debian.org/collab-maint/deb-maint/docbook-to-man/
diff --git a/debian/copyright b/debian/copyright
index aa51d4e..6bb5d89 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -36,4 +36,4 @@ License: GPL-2+
  and is licensed under the GPL. It is now maintained by Philipp Benner.
 
 On Debian GNU/Linux systems, the complete text of the GNU General
-Public License can be found in `/usr/share/common-licenses/GPL'.
+Public License can be found in `/usr/share/common-licenses/GPL-2'.
diff --git a/debian/patches/02-arg-req-space.patch b/debian/patches/02-arg-req-space.patch
index 8a38010..439d250 100644
--- a/debian/patches/02-arg-req-space.patch
+++ b/debian/patches/02-arg-req-space.patch
@@ -6,10 +6,13 @@
 
 @DPATCH@
 
-diff -urNad docbook-to-man-2.0.0~/Transpec/docbook-to-man.ts docbook-to-man-2.0.0/Transpec/docbook-to-man.ts
---- docbook-to-man-2.0.0~/Transpec/docbook-to-man.ts	2007-04-01 23:56:17.000000000 +0200
-+++ docbook-to-man-2.0.0/Transpec/docbook-to-man.ts	2007-04-01 23:57:28.000000000 +0200
-@@ -1196,6 +1196,11 @@
+---
+ Transpec/docbook-to-man.ts |    5 +++++
+ 1 file changed, 5 insertions(+)
+
+--- a/Transpec/docbook-to-man.ts
++++ b/Transpec/docbook-to-man.ts
+@@ -1218,6 +1218,11 @@
  EndText:	${_attval REP REPEAT 505}]\s
  -
  #
diff --git a/debian/patches/03-userinput-font.patch b/debian/patches/03-userinput-font.patch
index 61efff8..94edce5 100644
--- a/debian/patches/03-userinput-font.patch
+++ b/debian/patches/03-userinput-font.patch
@@ -7,10 +7,13 @@
 
 @DPATCH@
 
-diff -urNad docbook-to-man-2.0.0~/Transpec/docbook-to-man.ts docbook-to-man-2.0.0/Transpec/docbook-to-man.ts
---- docbook-to-man-2.0.0~/Transpec/docbook-to-man.ts	2007-04-02 20:18:03.000000000 +0200
-+++ docbook-to-man-2.0.0/Transpec/docbook-to-man.ts	2007-04-02 20:19:04.000000000 +0200
-@@ -1893,8 +1893,8 @@
+---
+ Transpec/docbook-to-man.ts |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/Transpec/docbook-to-man.ts
++++ b/Transpec/docbook-to-man.ts
+@@ -1930,8 +1930,8 @@
  -
  #
  GI:		USERINPUT
@@ -20,4 +23,4 @@ diff -urNad docbook-to-man-2.0.0~/Transpec/docbook-to-man.ts docbook-to-man-2.0.
 +EndText:	^.ft
  -
  #
- GI:		AUTHOR
+ GI:		VARNAME
diff --git a/debian/rules b/debian/rules
index a293f88..207976e 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,47 +1,19 @@
 #!/usr/bin/make -f
 
-# Uncomment this to turn on verbose mode.
-#export DH_VERBOSE=1
+export DEB_BUILD_MAINT_OPTIONS	= hardening=+all
+export DEB_CFLAGS_MAINT_APPEND	= -Wall
+export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
 
-include /usr/share/quilt/quilt.make
+override_dh_auto_build:
+	dh_auto_build -- \
+	CFLAGS="$(CFLAGS) $(CPPFLAGS)" \
+	LDFLAGS="$(LDFLAGS)" \
+	ROOT=/usr
 
-CFLAGS = -Wall -g
-
-ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
-	CFLAGS += -O0
-else
-	CFLAGS += -O2
-endif
-
-build: build-stamp
-build-arch: build-stamp
-build-indep: build-stamp
-build-stamp: patch
-	dh_testdir
-
-#	# Building package
-	CFLAGS="$(CFLAGS)" $(MAKE) ROOT=/usr
-
-	touch build-stamp
-
-clean: unpatch
-	dh_testdir
-	dh_testroot
-	rm -f build-stamp
-
-#	# Cleaning package
-	$(MAKE) clean
+override_dh_auto_clean:
 	$(MAKE) clobber
 
-	dh_clean
-
-install: build
-	dh_testdir
-	dh_testroot
-	dh_clean -k 
-	dh_installdirs
-
-#	# Installing package
+override_dh_auto_install:
 	$(MAKE) install ROOT=$(CURDIR)/debian/docbook-to-man/usr
 
 #	# Installing manpages
@@ -50,23 +22,7 @@ install: build
 	install -D -m 0644 Doc/transpec.1 debian/docbook-to-man/usr/share/man/man5/transpec.5
 #	install -D -m 0644 Instant/tptregexp/regexp.3 debian/docbook-to-man/usr/share/man/man3/regexp.3
 
-binary-indep: build install
-
-binary-arch: build install
-	dh_testdir
-	dh_testroot
-	dh_installchangelogs
-	dh_installdocs
-	dh_install
-	dh_link
-	dh_strip
-	dh_compress
-	dh_fixperms
-	dh_installdeb
-	dh_shlibdeps
-	dh_gencontrol
-	dh_md5sums
-	dh_builddeb
+%:
+	dh $@
 
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install
+# End of file
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..163aaf8
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (quilt)
-- 
1.7.9.5

