[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[PATCH 5/6] debian/rules: let build machine admins tweak build flags



Use the dpkg-buildflags tool to retrieve build flags.  This makes
build-specific tweaks (e.g., hardening options) possible without
having to touch the packaging again.

So now "DEB_CFLAGS_APPEND=-W debian/rules build" to build with
additional warnings will work, for example.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 debian/changelog |    3 +++
 debian/control   |    1 +
 debian/rules     |    7 +------
 3 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index f100a0a..a0625c3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,9 @@ libpciaccess (0.12.0-2) UNRELEASED; urgency=low
   * Use dh_prep instead of dh_clean -k.  Requires a build-time
     dependency on debhelper 7.
   * Bump debhelper compatibility level to v7.
+  * Support buildflags.conf and DEB_CFLAGS_APPEND by using
+    dpkg-buildflags to retrieve CFLAGS.  Requires a build-time
+    dependency on dpkg-dev 1.15.7.
 
  -- Jonathan Nieder <jrnieder@gmail.com>  Fri, 04 Feb 2011 19:51:53 -0600
 
diff --git a/debian/control b/debian/control
index 7b967c2..c1096e4 100644
--- a/debian/control
+++ b/debian/control
@@ -5,6 +5,7 @@ Maintainer: Debian X Strike Force <debian-x@lists.debian.org>
 Uploaders: David Nusinow <dnusinow@debian.org>, Cyril Brulebois <kibi@debian.org>
 Build-Depends:
  debhelper (>= 7),
+ dpkg-dev (>= 1.15.7),
  libtool,
  automake,
  zlib1g-dev,
diff --git a/debian/rules b/debian/rules
index 6ad11a5..b5c3ce7 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,13 +1,8 @@
 #!/usr/bin/make -f
 
 PACKAGE = libpciaccess0
+CFLAGS := -Wall $(shell dpkg-buildflags --get CFLAGS)
 
-CFLAGS = -Wall -g
-ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
-	CFLAGS += -O0
-else
-	CFLAGS += -O2
-endif
 ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
 	NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
 	MAKEFLAGS += -j$(NUMJOBS)
-- 
1.7.4


Reply to: