diff options
-rw-r--r-- | Makefile | 14 | ||||
-rw-r--r-- | src/pkg/CMakeLists.txt | 24 | ||||
-rw-r--r-- | src/pkg/debian/control.in (renamed from src/pkg/debian/control) | 4 | ||||
-rwxr-xr-x | src/pkg/debian/rules.in | 13 | ||||
-rw-r--r-- | src/vpp-api/python/CMakeLists.txt | 6 |
5 files changed, 44 insertions, 17 deletions
@@ -65,8 +65,7 @@ DEB_DEPENDS = curl build-essential autoconf automake ccache DEB_DEPENDS += debhelper dkms git libtool libapr1-dev dh-systemd DEB_DEPENDS += libconfuse-dev git-review exuberant-ctags cscope pkg-config DEB_DEPENDS += lcov chrpath autoconf indent clang-format libnuma-dev -DEB_DEPENDS += python-all python3-all python3-setuptools -DEB_DEPENDS += python-virtualenv python-pip check +DEB_DEPENDS += python3-all python3-setuptools check DEB_DEPENDS += libboost-all-dev libffi-dev python3-ply libmbedtls-dev DEB_DEPENDS += cmake ninja-build uuid-dev python3-jsonschema python3-yaml DEB_DEPENDS += python3-venv # ensurepip @@ -75,20 +74,21 @@ DEB_DEPENDS += python3-dev # needed for python3 -m pip install psutil LIBFFI=libffi6 # works on all but 20.04 -ifeq ($(OS_VERSION_ID),16.04) - DEB_DEPENDS += python-dev - DEB_DEPENDS += libssl-dev -else ifeq ($(OS_VERSION_ID),18.04) - DEB_DEPENDS += python-dev +ifeq ($(OS_VERSION_ID),18.04) + DEB_DEPENDS += python-dev python-all python-pip python-virtualenv DEB_DEPENDS += libssl-dev DEB_DEPENDS += clang-9 else ifeq ($(OS_VERSION_ID),20.04) + DEB_DEPENDS += python3-virtualenv LIBFFI=libffi7 else ifeq ($(OS_ID)-$(OS_VERSION_ID),debian-8) DEB_DEPENDS += libssl-dev + DEB_DEPENDS += python-dev python-all python-pip python-virtualenv APT_ARGS = -t jessie-backports else ifeq ($(OS_ID)-$(OS_VERSION_ID),debian-9) DEB_DEPENDS += libssl1.0-dev + DEB_DEPENDS += python-all python-pip + DEB_DEPENDS += python-dev python-all python-pip python-virtualenv else DEB_DEPENDS += libssl-dev endif diff --git a/src/pkg/CMakeLists.txt b/src/pkg/CMakeLists.txt index 357d966ddee..a5a0ffe5827 100644 --- a/src/pkg/CMakeLists.txt +++ b/src/pkg/CMakeLists.txt @@ -20,14 +20,34 @@ execute_process( OUTPUT_STRIP_TRAILING_WHITESPACE ) -foreach(f rules changelog) +# parse /etc/os-release +file(READ "/etc/os-release" os_release) +string(REPLACE "\n" ";" os_release ${os_release}) +foreach(l ${os_release}) + string(REPLACE "=" ";" l ${l}) + list(GET l 0 _name) + list(GET l 1 _value) + string(REPLACE "\"" "" _value ${_value}) + set(OS_${_name} ${_value}) +endforeach() + +if (OS_ID STREQUAL "ubuntu" AND OS_VERSION_ID VERSION_LESS 20.04) + set(VPP_DEB_BUILD_DEPENDS "python-all, python3-all, python3-setuptools") + set(VPP_DEB_WITH_PYTHON2 "yes") +else() + set(VPP_DEB_BUILD_DEPENDS "python3-all, python3-setuptools") + set(VPP_DEB_WITH_PYTHON2 "no") +endif() + +foreach(f rules changelog control) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/debian/${f}.in ${CMAKE_BINARY_DIR}/debian/${f} + @ONLY ) endforeach() -foreach(f control copyright vpp.preinst vpp.postrm vpp.postinst vpp.service) +foreach(f copyright vpp.preinst vpp.postrm vpp.postinst vpp.service) file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/debian/${f} DESTINATION ${CMAKE_BINARY_DIR}/debian diff --git a/src/pkg/debian/control b/src/pkg/debian/control.in index 48de48ab115..0b0c621e50c 100644 --- a/src/pkg/debian/control +++ b/src/pkg/debian/control.in @@ -5,9 +5,7 @@ Maintainer: fd.io VPP Packaging Team <vpp-dev@fd.io> Build-Depends: debhelper (>= 9), dh-systemd, dh-python, - python-all, - python3-all, - python3-setuptools + @VPP_DEB_BUILD_DEPENDS@ Standards-Version: 3.9.4 Package: vpp diff --git a/src/pkg/debian/rules.in b/src/pkg/debian/rules.in index ceef46a297a..f09db38e2a1 100755 --- a/src/pkg/debian/rules.in +++ b/src/pkg/debian/rules.in @@ -9,18 +9,23 @@ include /usr/share/dpkg/default.mk export PYBUILD_NAME = vpp-api export PYBUILD_DIR = @CMAKE_SOURCE_DIR@/vpp-api/python -export PYBUILD_DESTDIR_python2=debian/vpp-api-python/ -export PYBUILD_DISABLE_python2=test export PYBUILD_DESTDIR_python3=debian/python3-vpp-api/ export PYBUILD_DISABLE_python3=test export PYBUILD_SYSTEM=distutils - +ifeq (@VPP_DEB_WITH_PYTHON2@,yes) +export PYBUILD_DESTDIR_python2=debian/vpp-api-python/ +export PYBUILD_DISABLE_python2=test buildvers := $(shell pyversions -sv) +DH_WITH = systemd,python2,python3 +else +DH_WITH = systemd,python3 +endif + build3vers := $(shell py3versions -sv) # main packaging script based on dh7 syntax %: - dh $@ --with systemd,python2,python3 --buildsystem=pybuild + dh $@ --with $(DH_WITH) --buildsystem=pybuild override_dh_strip: dh_strip --dbg-package=vpp-dbg diff --git a/src/vpp-api/python/CMakeLists.txt b/src/vpp-api/python/CMakeLists.txt index 910df6bfd6b..6450fd92f2d 100644 --- a/src/vpp-api/python/CMakeLists.txt +++ b/src/vpp-api/python/CMakeLists.txt @@ -11,7 +11,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -find_package(Python3 COMPONENTS Interpreter) +if (CMAKE_VERSION VERSION_LESS 3.12) + find_package(PythonInterp 2.7) +else() + find_package(Python3 COMPONENTS Interpreter) +endif() if(PYTHONINTERP_FOUND) install( |