binary module build: use kernel headers from highest version
[deb_dpdk.git] / debian / rules
index 59c620c..2d69b82 100755 (executable)
@@ -17,23 +17,9 @@ endif
 ifneq (,$(filter rte_machine=%,$(DEB_BUILD_OPTIONS)))
     RTE_MACHINE ?= $(patsubst rte_machine=%,%,$(filter rte_machine=%,$(DEB_BUILD_OPTIONS)))
 endif
-
-# Use default for arm* where there is a defined list.
-# x86 and power would just use "native", which is an invariant, so set
-# power8 and corei7 to keep it stable.
-ifneq (,$(filter $(DEB_HOST_ARCH), arm64))
+# default to minimal base, without setting this it would build
+# -march=native which is a non portable invariant
 RTE_MACHINE ?= "default"
-else
-ifneq (,$(filter $(DEB_HOST_ARCH), armhf))
-RTE_MACHINE ?= "armv7a"
-else
-ifneq (,$(filter $(DEB_HOST_ARCH), ppc64el))
-RTE_MACHINE ?= "power8"
-else
-RTE_MACHINE ?= "corei7"
-endif
-endif
-endif
 
 # now stable with parallel comilation, so support -j
 ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
@@ -53,6 +39,15 @@ BUILD_DOCS=y
 endif
 endif
 
+# Allow to pass specific configure flags to meson as a comma separated list
+ifneq (,$(filter dpdk_config_options=%,$(DEB_BUILD_OPTIONS)))
+# GNU Makefile hack: can't directly escape comma and spaces, so use variables
+    comma := ,
+    space :=
+    space +=
+    DPDK_CONFIG_OPTIONS ?= $(subst $(comma),$(space),$(patsubst dpdk_config_options=%,%,$(filter dpdk_config_options=%,$(DEB_BUILD_OPTIONS))))
+endif
+
 # kernel_modules can be passed via DEB_BUILD_OPTIONS to enable building the
 # optional binary kernel modules package. By default it will be built against
 # the current kernel, or ksrc can be passed with a path to the target kernel
@@ -64,7 +59,7 @@ else
 ifneq (,$(filter ksrc=%,$(DEB_BUILD_OPTIONS)))
     KSRC := $(patsubst ksrc=%,%,$(filter ksrc=%,$(DEB_BUILD_OPTIONS)))
 else
-    KSRC := /lib/modules/$(shell uname -r)/build
+    KSRC := /lib/modules/$(shell LIST=$$(ls /lib/modules/); for dir in $$LIST; do test -d /lib/modules/$$dir/build && echo $$dir; done | sort -V | tail -n1)/build
 endif
 
 KVERS := $(shell perl debian/kernel-version $(KSRC))
@@ -100,7 +95,7 @@ override_dh_gencontrol:
        # 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.
        dh_gencontrol -p libdpdk-dev -- -V"librte:Depends=`grep -E 'librte-*' ./debian/files | grep -v dbgsym | tr '_' ' ' | awk '{ print $$1,"(=",$$2 ")" }' | paste -sd ',' - | sed -e 's/,/, /g'`"
-       dh_gencontrol -p dpdk -- -V"librte:Recommends=`grep -E 'librte-(pmd|mempool).*' ./debian/files | grep -v dbgsym | tr '_' ' ' | awk '{ print $$1,"(=",$$2 ")" }' | paste -sd ',' - | sed -e 's/,/, /g'`"
+       dh_gencontrol -p dpdk -- -V"librte:Suggests=`grep -E 'librte-(pmd|mempool).*' ./debian/files | grep -v dbgsym | tr '_' ' ' | awk '{ print $$1,"(=",$$2 ")" }' | paste -sd ',' - | sed -e 's/,/, /g'`"
 ifneq (,$(findstring kernel_modules,$(DEB_BUILD_OPTIONS)))
        dh_gencontrol -p dpdk-modules-$(KVERS) -- \
                -v`cat debian/VERSION` \
@@ -115,8 +110,9 @@ override_dh_auto_clean:
        dh_auto_clean
 
 override_dh_auto_configure:
-       dh_auto_configure -- \
+       dh_auto_configure -- $(DPDK_CONFIG_OPTIONS) \
                --includedir=include/dpdk \
+               --default-library=shared \
                -Dper_library_versions=false \
                -Dinclude_subdir_arch=../$(DEB_HOST_MULTIARCH)/dpdk \
                -Dmachine=$(RTE_MACHINE) \