aboutsummaryrefslogtreecommitdiffstats
path: root/debian
diff options
context:
space:
mode:
authorSantiago <santiagorr@riseup.net>2016-11-09 15:57:31 +0100
committerSantiago <santiagorr@riseup.net>2016-11-09 15:57:31 +0100
commit5577c7853ac4aed35ee28f17c56c3b0b8e2cd251 (patch)
treed18eabb4543647f58cb96a8f38fa68b6b93c4f65 /debian
parent1ca62d953cd9846ff516065ae35a742f948b335e (diff)
debian/rules: Only export hardening related building HOST_/EXTRA flags when dpkg-dev < 1.18.11.
On newer dpkg-dev versions, dpkg-buildflags handle them directly and are injected by gcc (6.x). Change-Id: I1fd99405d9b07e10c3bc41034256212ebeaf7549 Signed-off-by: Santiago <santiagorr@riseup.net>
Diffstat (limited to 'debian')
-rwxr-xr-xdebian/rules32
1 files changed, 19 insertions, 13 deletions
diff --git a/debian/rules b/debian/rules
index b652adc2..3ef1c669 100755
--- a/debian/rules
+++ b/debian/rules
@@ -15,20 +15,26 @@ DEB_HOST_GNU_CPU := $(shell dpkg-architecture -qDEB_HOST_GNU_CPU)
export DEB_BUILD_MAINT_OPTIONS = hardening=+all,-pie
# see ENVIRONMENT in dpkg-buildflags(1)
-# package maintainers to append CFLAGS
-export DEB_CFLAGS_MAINT_APPEND = -fPIC
-# package maintainers to append LDFLAGS
-#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
-
+DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk
-export EXTRA_CFLAGS=$(CFLAGS)
-export EXTRA_CPPFLAGS=$(CPPFLAGS)
-export HOST_EXTRA_CFLAGS=$(CFLAGS)
-export HOST_EXTRA_CPPFLAGS=$(CPPFLAGS)
-# need to be stripped as DPDK build system adds them and it would be -Wl,-Wl,opt
-export EXTRA_LDFLAGS=$(shell echo $(LDFLAGS) | sed 's/-Wl,//g')
-# HOST_CC build system does not add -Wl ...
-export EXTRA_HOST_LDFLAGS=$(LDFLAGS)
+
+# Support backporting to jessie
+dpkg_version_lt = $(shell dpkg --compare-versions $$(dpkg --status dpkg-dev | grep Version | cut -d' ' -f2) lt-nl "1.18.11" && echo yes)
+ifeq (yes, $(dpkg_version_lt))
+ # package maintainers to append CFLAGS
+ # For Debian, dpkg-dev >= 1.18.11 and gcc 6.x, dpkg-buildflags and gcc
+ # handle -fPIC and related flags relying on specs files
+ # (/usr/share/dpkg/*specs)
+ export DEB_CFLAGS_MAINT_APPEND = -fPIC
+ export EXTRA_CFLAGS=$(CFLAGS)
+ export EXTRA_CPPFLAGS=$(CPPFLAGS)
+ export HOST_EXTRA_CFLAGS=$(CFLAGS)
+ export HOST_EXTRA_CPPFLAGS=$(CPPFLAGS)
+ # need to be stripped as DPDK build system adds them and it would be -Wl,-Wl,opt
+ export EXTRA_LDFLAGS=$(shell echo $(LDFLAGS) | sed 's/-Wl,//g')
+ # HOST_CC build system does not add -Wl ...
+ export EXTRA_HOST_LDFLAGS=$(LDFLAGS)
+endif
export RTE_DEVEL_BUILD=n