Set +x on debian/rules
[deb_dpdk.git] / debian / rules
index bc593fa..068fd8e 100755 (executable)
@@ -5,6 +5,7 @@ export DH_VERBOSE=1
 export DH_OPTIONS=-v
 
 VERSION := $(shell dpkg-parsechangelog | sed -nr '/^Version:/s/Version: (.*:)?(.*)-(.*)/\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
@@ -37,6 +38,7 @@ ifeq (yes, $(dpkg_version_lt))
 endif
 
 export RTE_DEVEL_BUILD=n
+export EXTRA_CFLAGS+=-g
 
 # People rebuilding this package can overwrite DPDK_CONFIG, RTE_MACHINE and
 # RTE_TARGET via DEB_BUILD_OPTIONS if they like
@@ -112,12 +114,6 @@ DPDK_CONFIG_BUILD_KMOD=y
 # dpkg-genchanges, and also would require a lot of overrides for debhelpers.
 get_built_using        ?= $(filter-out (=),$(shell dpkg-query -f='$${source:Package} (=$${source:Version})' -W $1))
 
-override_dh_gencontrol:
-       dh_gencontrol
-       dh_gencontrol -p dpdk-modules-$(KVERS) -- \
-               -v`cat debian/VERSION` \
-               -V'built:using:kernel=$(call get_built_using,linux-headers-$(KVERS))'
-
 build:
        @if [ x"$(KVERS)" = x ] ; then \
            echo 'No version in $(KSRC)/include/linux/version.h' >&2; \
@@ -131,18 +127,42 @@ endif
 %:
        dh $@ --with python2,dkms
 
+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.
+       # 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.
+       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'`"
+ifneq (,$(findstring kernel_modules,$(DEB_BUILD_OPTIONS)))
+       dh_gencontrol -p dpdk-modules-$(KVERS) -- \
+               -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
        test -L config/defconfig_$(DPDK_CONFIG) && rm -f config/defconfig_$(DPDK_CONFIG) || true
 
-override_dh_clean:
-       dh_clean
-       rm -f debian/libethdev4.links
-       rm -f debian/librte-cryptodev1.links
-       rm -f debian/librte-eal2.links
-
 override_dh_auto_configure:
        # Add support for a custom defconfig file in the debian directory.
 ifneq (,$(filter dpdk_config=%,$(DEB_BUILD_OPTIONS)))
@@ -167,6 +187,8 @@ 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
        dh_auto_configure
 
 override_dh_auto_build-indep:
@@ -231,8 +253,10 @@ endif
                debian/dpdk-dev/usr/share/dpdk/dpdk-sdk-env.sh
        # include the bundled autotest suite to be usable from the dpdk-dev package
        mkdir -p debian/dpdk-dev/usr/share/dpdk/test
-       cp -a app/test/autotest* debian/dpdk-dev/usr/share/dpdk/test
+       cp -a test/test/autotest* debian/dpdk-dev/usr/share/dpdk/test
        cp $(DPDK_SHARED_DIR)/app/test debian/dpdk-dev/usr/share/dpdk/test/
+       cp $(DPDK_SHARED_DIR)/app/testacl debian/dpdk-dev/usr/share/dpdk/test/
+       cp $(DPDK_SHARED_DIR)/app/testpipeline debian/dpdk-dev/usr/share/dpdk/test/
        # since we move libs to multiarch dirs update the non aware symlink
        rm debian/dpdk-dev/usr/share/dpdk/$(RTE_TARGET)/lib
        ln -rs debian/dpdk-dev/$(LIBDIR)/ \
@@ -256,16 +280,15 @@ endif
        # Package(s): libdpdk-<NAME><VER> (bare runtime libs)
        for lib in $$(ls -1 debian/dpdk/$(LIBDIR)/*.so.*); do \
          BN=$$(basename $${lib}); \
-         VER=$$(echo $${BN} | sed -e 's/^.*\.so\.//'); \
-         LN=$$(echo $${BN} | sed -e 's/\.so\.[0-9]*$$//' | tr '_' '-'); \
+         LN=$$(echo $${BN} | sed -e 's/\.so\.[0-9\.]*$$//' | tr '_' '-'); \
          if echo $${LN} | grep -q ".*[0-9]$$"; then \
-           PKG=$${LN}-$${VER}; \
+           PKG=$${LN}-$(DPDK_ABI); \
          else \
-           PKG=$${LN}$${VER}; \
+           PKG=$${LN}$(DPDK_ABI); \
          fi; \
          LIBF="$$(basename $${lib})"; \
          LIBD="debian/$${PKG}/$(LIBDIR)"; \
-         echo "moving $${lib} for library $${PKG}"; \
+         echo "moving $${lib} to dir $${LIBD} (PKG=$${PKG} BN=$${BN} LN={$${LN} LIBF=$${LIBF} LIBD=$${LIBD})"; \
          mkdir -p $${LIBD}; \
          mv $${lib} $${LIBD}; \
          if [ "$${LIBF#librte_pmd_}x" != "$${LIBF}x" ]; then \
@@ -273,6 +296,11 @@ endif
            echo "PMD: linking $${LIBF} into RTE_EAL_PMD_PATH at $${LIBD}/dpdk-pmds/"; \
            ln -s --relative --target-directory=$${LIBD}/dpdk-pmds/ $${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}; \
+         fi; \
          if [ "$${LIBF#librte_eal}x" != "$${LIBF}x" ]; then \
            mkdir -p $${LIBD}/dpdk-pmds; \
          fi; \
@@ -299,15 +327,6 @@ ifneq (,$(KVERS))
                DESTDIR=debian/dpdk-modules-$(KVERS) install-kmod
 endif
 
-debian/libethdev4.links: debian/libethdev4.links.in
-       sed -e 's/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/g' < $< > $@
-debian/librte-cryptodev1.links: debian/librte-cryptodev1.links.in
-       sed -e 's/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/g' < $< > $@
-debian/librte-eal2.links: debian/librte-eal2.links.in
-       sed -e 's/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/g' < $< > $@
-override_dh_link: debian/libethdev4.links debian/librte-cryptodev1.links debian/librte-eal2.links
-       dh_link
-
 override_dh_dkms:
        dh_dkms -V $(VERSION)