From: Christian Ehrhardt Date: Thu, 23 Jun 2016 12:03:57 +0000 (+0200) Subject: d/rules: transfer dpkg-buildflags to the dpdk build system X-Git-Tag: debian/16.07-1~113 X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=bfb8eeb20fbe6a96e7bc9d663370b871fe77717b;p=deb_dpdk.git d/rules: transfer dpkg-buildflags to the dpdk build system 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 --- diff --git a/debian/rules b/debian/rules index 094f6f2f..8758dc66 100755 --- a/debian/rules +++ b/debian/rules @@ -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,' \