Implemente terse DEB_BUILD_OPTIONS
[deb_dpdk.git] / debian / rules
index e2b018c..3d35e1c 100755 (executable)
@@ -1,17 +1,10 @@
 #!/usr/bin/make -f
-# See debhelper(7) (uncomment to enable)
-# output every command that modifies files on the build system.
-export DH_VERBOSE=1
-export DH_OPTIONS=-v
-
-VERSION := $(shell dpkg-parsechangelog --show-field Version | sed -nr 's/(.*:)?([^-])(-.*)/\2/p')
-DPDK_ABI := $(shell echo $(VERSION) | cut -d '.'  -f1-2)
 
 # see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/*
 include /usr/share/dpkg/default.mk
 
-DEB_HOST_GNU_CPU := $(shell dpkg-architecture -qDEB_HOST_GNU_CPU)
-DEB_HOST_MULTIARCH := $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
+DPDK_ABI := $(shell echo $(DEB_VERSION_UPSTREAM) | cut -d '-' -f1 | cut -d '.'  -f1-2 | cut -d '~' -f1)
+DPDK_DRIVER_DIR ?= dpdk-$(DPDK_ABI)-drivers
 
 # see FEATURE AREAS in dpkg-buildflags(1)
 export DEB_BUILD_MAINT_OPTIONS = hardening=+all,-pie
@@ -20,6 +13,11 @@ export DEB_BUILD_MAINT_OPTIONS = hardening=+all,-pie
 DPKG_EXPORT_BUILDFLAGS = 1
 include /usr/share/dpkg/buildflags.mk
 
+ifeq (,$(findstring terse,$(DEB_BUILD_OPTIONS)))
+       export DH_VERBOSE=1
+       export DH_OPTIONS=-v
+endif
+
 # Support backporting to jessie
 dpkg_version_lt = $(shell dpkg --compare-versions $$(dpkg --status dpkg-dev | grep Version | cut -d' ' -f2) lt-nl "1.18.11" && echo yes)
 ifeq (yes, $(dpkg_version_lt))
@@ -59,6 +57,12 @@ RTE_MACHINE ?= "armv8a"
 RTE_TARGET ?= "arm64-armv8a-linuxapp-gcc"
 INCLUDE_ARCH := arm
 else
+ifneq (,$(filter $(DEB_HOST_ARCH), armhf))
+DPDK_CONFIG ?= "arm-armv7a-linuxapp-gcc"
+RTE_MACHINE ?= "armv7a"
+RTE_TARGET ?= "arm-armv7a-linuxapp-gcc"
+INCLUDE_ARCH := arm
+else
 ifneq (,$(filter $(DEB_HOST_ARCH), ppc64el))
 DPDK_CONFIG ?= "ppc_64-power8-linuxapp-gcc"
 RTE_MACHINE ?= "power8"
@@ -71,6 +75,7 @@ RTE_TARGET ?= "$(DEB_HOST_GNU_CPU)-default-linuxapp-gcc"
 INCLUDE_ARCH := x86
 endif
 endif
+endif
 DPDK_STATIC_DIR = "debian/build/static-root"
 DPDK_SHARED_DIR = "debian/build/shared-root"
 
@@ -125,11 +130,11 @@ build:
        fi
        sh debian/prep-modules $(KSRC)
        cat debian/control.modules >> debian/control
-       dh $@ --with python2,dkms
+       dh $@ --with python3,dkms,systemd
 endif
 
 %:
-       dh $@ --with python2,dkms
+       dh $@ --with python3,dkms,systemd
 
 override_dh_gencontrol:
        dh_gencontrol
@@ -185,16 +190,23 @@ ifeq (,$(filter dpdk_config=%,$(DEB_BUILD_OPTIONS)))
                -e 's,(CONFIG_RTE_EAL_IGB_UIO=).*,\1$(DPDK_CONFIG_BUILD_KMOD),' \
                -e 's,(CONFIG_RTE_KNI_KMOD=).*,\1$(DPDK_CONFIG_BUILD_KMOD),' \
                -e 's,(LIBRTE_PMD_PCAP=).*,\1y,' \
-               -e 's,(LIBRTE_PMD_XENVIRT=).*,\1y,' \
-               -e 's,(CONFIG_RTE_EAL_PMD_PATH=).*,\1"/usr/lib/$(DEB_HOST_MULTIARCH)/dpdk-pmds/",' \
+               -e 's,(CONFIG_RTE_EAL_PMD_PATH=).*,\1"/usr/lib/$(DEB_HOST_MULTIARCH)/$(DPDK_DRIVER_DIR)/",' \
+               $(DPDK_STATIC_DIR)/.config
+ifeq (,$(filter $(DEB_HOST_ARCH), armhf))
+       sed -ri -e 's,(CONFIG_RTE_LIBRTE_MLX4_PMD=).*,\1y,' \
+               -e 's,(CONFIG_RTE_LIBRTE_MLX5_PMD=).*,\1y,' \
+               -e 's,(LIBRTE_PMD_OPENSSL=).*,\1y,' \
                $(DPDK_STATIC_DIR)/.config
-       # xen not available on ppc64el
-ifneq (,$(filter $(DEB_HOST_ARCH), ppc64el))
-       sed -ri -e 's,(LIBRTE_PMD_XENVIRT=).*,\1n,' $(DPDK_STATIC_DIR)/.config
 endif
 endif
        echo "CONFIG_RTE_MAJOR_ABI=\"$(DPDK_ABI)\"" >> \
                $(DPDK_STATIC_DIR)/.config
+       # Intel IPSEC library is amd64-only
+ifneq (,$(filter $(DEB_HOST_ARCH), amd64))
+       sed -ri -e 's,(CONFIG_RTE_LIBRTE_PMD_AESNI_MB=).*,\1y,' \
+               -e 's,(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM=).*,\1y,' \
+               $(DPDK_STATIC_DIR)/.config
+endif
        dh_auto_configure
 
 override_dh_auto_build-indep:
@@ -327,34 +339,39 @@ endif
          mkdir -p $${LIBD}; \
          mv $${lib} $${LIBD}; \
          if [ "$${LIBF#librte_pmd_}x" != "$${LIBF}x" ]; then \
-           mkdir -p $${LIBD}/dpdk-pmds; \
-           echo "PMD: linking $${LIBF} into RTE_EAL_PMD_PATH at $${LIBD}/dpdk-pmds/"; \
-           ln -s --relative --target-directory=$${LIBD}/dpdk-pmds/ $${LIBD}/$${LIBF}; \
+           mkdir -p $${LIBD}/$(DPDK_DRIVER_DIR); \
+           echo "PMD: linking $${LIBF} into RTE_EAL_PMD_PATH at $${LIBD}/$(DPDK_DRIVER_DIR)/"; \
+           ln -s --relative --target-directory=$${LIBD}/$(DPDK_DRIVER_DIR)/ $${LIBD}/$${LIBF}; \
          fi; \
          if [ "$${LIBF#librte_mempool_}x" != "$${LIBF}x" ]; then \
-           mkdir -p $${LIBD}/dpdk-pmds; \
-           echo "MEMPOOL: linking $${LIBF} into RTE_EAL_PMD_PATH at $${LIBD}/dpdk-pmds/"; \
-           ln -s --relative --target-directory=$${LIBD}/dpdk-pmds/ $${LIBD}/$${LIBF}; \
+           mkdir -p $${LIBD}/$(DPDK_DRIVER_DIR); \
+           echo "MEMPOOL: linking $${LIBF} into RTE_EAL_PMD_PATH at $${LIBD}/$(DPDK_DRIVER_DIR)/"; \
+           ln -s --relative --target-directory=$${LIBD}/$(DPDK_DRIVER_DIR)/ $${LIBD}/$${LIBF}; \
+         fi; \
+         if [ "$${LIBF#librte_ifcvf_}x" != "$${LIBF}x" ]; then \
+           mkdir -p $${LIBD}/$(DPDK_DRIVER_DIR); \
+           echo "IFCVF: linking $${LIBF} into RTE_EAL_PMD_PATH at $${LIBD}/$(DPDK_DRIVER_DIR)/"; \
+           ln -s --relative --target-directory=$${LIBD}/$(DPDK_DRIVER_DIR)/ $${LIBD}/$${LIBF}; \
          fi; \
          if [ "$${LIBF#librte_eal}x" != "$${LIBF}x" ]; then \
-           mkdir -p $${LIBD}/dpdk-pmds; \
+           mkdir -p $${LIBD}/$(DPDK_DRIVER_DIR); \
          fi; \
        done
        # pkg-config
        mkdir -p debian/libdpdk-dev/$(LIBDIR)/pkgconfig
        LIBS=$$(sed -e 's/GROUP ( \(.*\) )/\1/' -e 's/lib/-l/g' -e 's/\.so//g' \
                $(CURDIR)/debian/libdpdk-dev/$(LIBDIR)/libdpdk.so); \
-       sed -e "s/@DPDK_LIBS@/$${LIBS}/" -e "s/@VERSION@/$(VERSION)/" \
+       sed -e "s/@DPDK_LIBS@/$${LIBS}/" -e "s/@VERSION@/$(DEB_VERSION_UPSTREAM)/" \
                -e "s|@DEB_HOST_MULTIARCH@|$(DEB_HOST_MULTIARCH)|g" \
                debian/libdpdk.pc.in > debian/libdpdk-dev/$(LIBDIR)/pkgconfig/libdpdk.pc
        # Package: dpdk-igb-uio-dkms
-       mkdir -p debian/dpdk-igb-uio-dkms/usr/src/dpdk-igb-uio-$(VERSION)
-       cp lib/librte_eal/linuxapp/igb_uio/* \
-               debian/dpdk-igb-uio-dkms/usr/src/dpdk-igb-uio-$(VERSION)
+       mkdir -p debian/dpdk-igb-uio-dkms/usr/src/dpdk-igb-uio-$(DEB_VERSION_UPSTREAM)
+       cp kernel/linux/igb_uio/* \
+               debian/dpdk-igb-uio-dkms/usr/src/dpdk-igb-uio-$(DEB_VERSION_UPSTREAM)
        # Package: dpdk-rte-kni-dkms
-       mkdir -p debian/dpdk-rte-kni-dkms/usr/src/dpdk-rte-kni-$(VERSION)
-       cp -a lib/librte_eal/linuxapp/kni/* \
-               debian/dpdk-rte-kni-dkms/usr/src/dpdk-rte-kni-$(VERSION)
+       mkdir -p debian/dpdk-rte-kni-dkms/usr/src/dpdk-rte-kni-$(DEB_VERSION_UPSTREAM)
+       cp -a kernel/linux/kni/* \
+               debian/dpdk-rte-kni-dkms/usr/src/dpdk-rte-kni-$(DEB_VERSION_UPSTREAM)
 ifneq (,$(KVERS))
        # Package: dpdk-modules-<kernel version>
        $(MAKE) V=$(DH_VERBOSE) O=$(DPDK_SHARED_DIR) \
@@ -363,7 +380,7 @@ ifneq (,$(KVERS))
 endif
 
 override_dh_dkms:
-       dh_dkms -V $(VERSION)
+       dh_dkms -V $(DEB_VERSION_UPSTREAM)
 
 override_dh_installinit:
        dh_installinit --no-start --no-restart-on-upgrade
@@ -373,3 +390,8 @@ override_dh_systemd_start:
 
 override_dh_auto_test:
 
+override_dh_python3:
+       # dh_python only looks in /usr/share/package_name but dpdk-doc installs in
+       # /usr/share/dpdk, so pass /usr to catch all
+       dh_python3 --shebang=/usr/bin/python3 /usr
+