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>
VERSION := $(shell dpkg-parsechangelog | sed -nr '/^Version:/s/Version: (.*:)?(.*)-(.*)/\2/p')
# see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/*
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)
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
# 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
# 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))
# 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))
dh_testdir
# report dpkg-buildflags status to build log
dpkg-buildflags --status
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,' \
$(MAKE) O=$(DPDK_STATIC_DIR) T=$(DPDK_CONFIG) config
sed -ri -e 's,(RTE_MACHINE=).*,\1$(RTE_MACHINE),' \
-e 's,(RTE_NEXT_ABI=).*,\1n,' \