misc: fix ubuntu 20.04 python deps
[vpp.git] / src / pkg / debian / rules.in
1 #!/usr/bin/make -f
2 # See debhelper(7) (uncomment to enable)
3 # output every command that modifies files on the build system.
4 DH_VERBOSE = 1
5
6 # see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/*
7 DPKG_EXPORT_BUILDFLAGS = 1
8 include /usr/share/dpkg/default.mk
9
10 export PYBUILD_NAME = vpp-api
11 export PYBUILD_DIR = @CMAKE_SOURCE_DIR@/vpp-api/python
12 export PYBUILD_DESTDIR_python3=debian/python3-vpp-api/
13 export PYBUILD_DISABLE_python3=test
14 export PYBUILD_SYSTEM=distutils
15 ifeq (@VPP_DEB_WITH_PYTHON2@,yes)
16 export PYBUILD_DESTDIR_python2=debian/vpp-api-python/
17 export PYBUILD_DISABLE_python2=test
18 buildvers := $(shell pyversions -sv)
19 DH_WITH = systemd,python2,python3
20 else
21 DH_WITH = systemd,python3
22 endif
23
24 build3vers := $(shell py3versions -sv)
25
26 # main packaging script based on dh7 syntax
27 %:
28         dh $@ --with $(DH_WITH) --buildsystem=pybuild
29
30 override_dh_strip:
31         dh_strip --dbg-package=vpp-dbg
32
33 DEB_HOST_MULTIARCH = $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
34
35 override_dh_install:
36         @for c in @VPP_COMPONENTS@; do \
37           @CMAKE_COMMAND@ \
38             -D CMAKE_INSTALL_CONFIG_NAME=@CMAKE_BUILD_TYPE@ \
39             -D CMAKE_INSTALL_COMPONENT=$$c \
40             -D CMAKE_INSTALL_PREFIX=@CMAKE_BINARY_DIR@/debian/$$c \
41             -P @CMAKE_BINARY_DIR@/cmake_install.cmake 2>&1 \
42             | grep -v 'Set runtime path of' ; \
43           if [ -d debian/$$c/lib ] ; then \
44             mv debian/$$c/lib debian/$$c/$(DEB_HOST_MULTIARCH) ; \
45             mkdir -p debian/$$c/usr/lib ; \
46             mv debian/$$c/$(DEB_HOST_MULTIARCH) debian/$$c/usr/lib ; \
47           fi ; \
48           for d in bin include share ; do \
49             if [ -d debian/$$c/$$d ] ; then \
50               mkdir -p debian/$$c/usr ; \
51               mv debian/$$c/$$d debian/$$c/usr/$$d ; \
52             fi ; \
53           done ; \
54           if [ -d debian/$$c ] ; then \
55             @CMAKE_SOURCE_DIR@/scripts/remove-rpath debian/$$c ; \
56           fi ; \
57         done