d/rules: transfer dpkg-buildflags to the dpdk build system 41/1741/2
authorChristian Ehrhardt <christian.ehrhardt@canonical.com>
Thu, 23 Jun 2016 12:03:57 +0000 (14:03 +0200)
committerC.J. Collier <cjcollier@linuxfoundation.org>
Thu, 23 Jun 2016 15:57:29 +0000 (15:57 +0000)
DPDK build ignores the usual way of dpdk-buildflag exports.
We have to set EXTRA_CFLAFS and EXTRA_LDFLAGS properly after setting up
and including dpdk-buildflags properly to have the control over flags a
debian package should have.
LDFLAG fPIC is now added via DEB_CFLAGS_MAINT_APPEND and fPIE disabled from
the default hardening set (incompatibility with fPIC on shared libraries)

Change-Id: I74febe97da99c338e6c3e0992c65ca4a007f381c
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
debian/rules

index 094f6f2..8758dc6 100755 (executable)
@@ -7,24 +7,23 @@ export DH_OPTIONS=-v
 VERSION := $(shell dpkg-parsechangelog | sed -nr '/^Version:/s/Version: (.*:)?(.*)-(.*)/\2/p')
 
 # see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/*
-DPKG_EXPORT_BUILDFLAGS = 1
 include /usr/share/dpkg/default.mk
 
 DEB_HOST_GNU_CPU := $(shell dpkg-architecture -qDEB_HOST_GNU_CPU)
 
 # see FEATURE AREAS in dpkg-buildflags(1)
-export DEB_BUILD_MAINT_OPTIONS = hardening=+all
-
-# build with debug symbols, dh_strip will create -dgbsyms packages by that
-# also export -fPIC for the static build (already used by shared by default)
-export EXTRA_CFLAGS = -g -fPIC
+export DEB_BUILD_MAINT_OPTIONS = hardening=+all,-pie
 
 # see ENVIRONMENT in dpkg-buildflags(1)
 # package maintainers to append CFLAGS
-#export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic
+export DEB_CFLAGS_MAINT_APPEND  = -fPIC
 # package maintainers to append LDFLAGS
 #export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
 
+include /usr/share/dpkg/buildflags.mk
+export EXTRA_CFLAGS=$(CFLAGS)
+export EXTRA_LDFLAGS=$(LDFLAGS)
+
 # People rebuilding this package can overwrite DPDK_CONFIG, RTE_MACHINE and
 # RTE_TARGET via environment variables if they like
 ifneq (,$(filter $(DEB_HOST_ARCH), arm64))
@@ -48,6 +47,8 @@ build-config:
        dh_testdir
        # report dpkg-buildflags status to build log
        dpkg-buildflags --status
+       echo EXTRA_CFLAGS $$EXTRA_CFLAGS
+       echo EXTRA_LDFLAGS: $$EXTRA_LDFLAGS
        $(MAKE) O=$(DPDK_STATIC_DIR) T=$(DPDK_CONFIG) config
        sed -ri -e 's,(RTE_MACHINE=).*,\1$(RTE_MACHINE),' \
                -e 's,(RTE_NEXT_ABI=).*,\1n,' \