From: Moritz Muehlenhoff Date: Tue, 17 Jan 2012 22:52:20 +0000 (+0100) Subject: rules: Use dpkg-buildflags to determine compiler/linker flags. X-Git-Tag: collectd-4.10.7-1~26 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=0c66997a52ef9feb929ebb03782e53b45713bd73;p=pkg-collectd.git rules: Use dpkg-buildflags to determine compiler/linker flags. This also enables hardening build flags. --- diff --git a/debian/rules b/debian/rules index 5e7add1..b506e2d 100755 --- a/debian/rules +++ b/debian/rules @@ -12,8 +12,10 @@ DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH) DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) -CPPFLAGS = -I$(CURDIR)/debian/include -CFLAGS = -Wall -g +CPPFLAGS = `dpkg-buildflags --get CPPFLAGS` +CPPFLAGS += -I$(CURDIR)/debian/include +CFLAGS = `dpkg-buildflags --get CFLAGS` +CFLAGS += -Wall # There is no way to tell lt_dlopen() to use the RTLD_GLOBAL flag which is # however required by the perl plugin (which would otherwise be unable to find @@ -26,11 +28,7 @@ CPPFLAGS += -DLT_LAZY_OR_NOW='RTLD_LAZY|RTLD_GLOBAL' CPPFLAGS += -UCONFIGFILE CPPFLAGS += -DCONFIGFILE='\"/etc/collectd/collectd.conf\"' -ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS))) - CFLAGS += -O0 -else - CFLAGS += -O2 -endif +LDFLAGS = `dpkg-buildflags --get LDFLAGS` # The archdir map has been copied from openjdk-6's debian/rules. JAVA_ARCHDIR_MAP = armel=arm hppa=parisc lpia=i386 powerpc=ppc powerpcspe=ppc sh4=sh @@ -155,7 +153,7 @@ config.status: configure $(DPATCH_STAMPFN) > debian/pkgconfig/OpenIPMIpthread.pc PKG_CONFIG_PATH="$(CURDIR)/debian/pkgconfig:$$PKG_CONFIG_PATH" \ - ./configure $(confflags) CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" \ + ./configure $(confflags) CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \ JAVAC="$(JAVAC)" JAR="$(JAR)" JAVA_CPPFLAGS="$(JAVA_CPPFLAGS)" \ JAVA_LDFLAGS="$(JAVA_LDFLAGS)" \ || ( status=$$?; cat config.log; exit $$status )