set RTE_MACHINE after potential external override
[deb_dpdk.git] / debian / rules
index 68eaaa7..a2c553c 100755 (executable)
@@ -2,7 +2,7 @@
 
 # see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/*
 DPKG_EXPORT_BUILDFLAGS = 1
-export DEB_BUILD_MAINT_OPTIONS = hardening=+all,-pie
+export DEB_BUILD_MAINT_OPTIONS = hardening=+all
 include /usr/share/dpkg/default.mk
 
 DPDK_ABI := $(shell echo $(DEB_VERSION_UPSTREAM) | cut -d '-' -f1 | cut -d '.'  -f1-2 | cut -d '~' -f1)
@@ -12,6 +12,15 @@ ifeq (,$(findstring terse,$(DEB_BUILD_OPTIONS)))
        export DH_OPTIONS=-v
 endif
 
+# People rebuilding this package can overwrite RTE_MACHINE
+# via DEB_BUILD_OPTIONS if they like
+ifneq (,$(filter rte_machine=%,$(DEB_BUILD_OPTIONS)))
+    RTE_MACHINE ?= $(patsubst rte_machine=%,%,$(filter rte_machine=%,$(DEB_BUILD_OPTIONS)))
+endif
+# default to minimal base, without setting this it would build
+# -march=native which is a non portable invariant
+RTE_MACHINE ?= "default"
+
 # now stable with parallel comilation, so support -j
 ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
     PAR := $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
@@ -72,7 +81,7 @@ endif
 override_dh_gencontrol:
        dh_gencontrol
        # debian/files will not exist until dh_gencontrol has ran at least once,
-       # so we need to run gencontrol for libdpdk-dev and libdpdk-dbgsym after.
+       # so we need to run gencontrol for libdpdk-dev after.
        # The list of libraries and PMDs is everchanging, so generate the dependency
        # list for libdpdk-dev to avoid having to maintain it manually.
        # Same for the recommends list for dpdk, were we want the PMDs and the mempools.
@@ -83,28 +92,12 @@ ifneq (,$(findstring kernel_modules,$(DEB_BUILD_OPTIONS)))
                -v`cat debian/VERSION` \
                -V'built:using:kernel=$(call get_built_using,linux-headers-$(KVERS))'
 endif
-ifneq (,$(findstring dbgsym_meta,$(DEB_BUILD_OPTIONS)))
-       ./debian/dh-dbgsym-metapkg libdpdk$(DPDK_ABI)-dbgsym
-endif
-
-# dbgsym_meta can be passed via DEB_BUILD_OPTIONS to enable building the
-# optional dbgsym meta package libdpdk<ABI>-dbgsym.
-# This is not built by default as it would go in main but depend on
-# packages in the debian-debug archive.
-# Debian Developers and FTP masters strongly discourage this.
-# We provide this optional flag as a convenience for rebuilders.
-ifneq (,$(findstring dbgsym_meta,$(DEB_BUILD_OPTIONS)))
-override_dh_builddeb:
-       dh_builddeb
-       dh_builddeb -plibdpdk$(DPDK_ABI)-dbgsym
-endif
 
 override_dh_auto_clean:
        rm -rf debian/build debian/tmp debian/dpdk-modules-* \
                debian/control.modules debian/VERSION
        sed -i '/Package: dpdk-modules-/,/`tail -n1 debian/control.modules.in`/d' debian/control
        rm -f debian/dpdk-igb-uio-dkms.dkms debian/dpdk-rte-kni-dkms.dkms
-       rm -f debian/dpdk-dev.preinst
        dh_auto_clean
 
 override_dh_auto_configure:
@@ -112,7 +105,7 @@ override_dh_auto_configure:
                --includedir=include/dpdk \
                -Dper_library_versions=false \
                -Dinclude_subdir_arch=../$(DEB_HOST_MULTIARCH)/dpdk \
-               -Dmachine=corei7 \
+               -Dmachine=$(RTE_MACHINE) \
                -Dkernel_dir=$(KSRC) \
                -Denable_kmods=$(DPDK_CONFIG_BUILD_KMOD)
 
@@ -129,8 +122,6 @@ override_dh_auto_install-indep:
 
 override_dh_auto_install-arch:
        dh_auto_install
-       # generate the preinst to deal with the symlink -> directory transition smoothly
-       sed "s/@@RTE_TARGET@@/$(RTE_TARGET)/g" debian/dpdk-dev.preinst.in > debian/dpdk-dev.preinst
        # have the DKMS build include the correct per-arch directory
        sed "s/@@DEB_HOST_MULTIARCH@@/$(DEB_HOST_MULTIARCH)/g" debian/dpdk-igb-uio-dkms.dkms.in > debian/dpdk-igb-uio-dkms.dkms
        sed "s/@@DEB_HOST_MULTIARCH@@/$(DEB_HOST_MULTIARCH)/g" debian/dpdk-rte-kni-dkms.dkms.in > debian/dpdk-rte-kni-dkms.dkms