aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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