aboutsummaryrefslogtreecommitdiffstats
path: root/src/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg')
-rw-r--r--src/pkg/CMakeLists.txt43
-rw-r--r--src/pkg/debian/changelog.in6
-rw-r--r--src/pkg/debian/control75
-rw-r--r--src/pkg/debian/copyright9
-rwxr-xr-xsrc/pkg/debian/rules.in45
-rw-r--r--src/pkg/debian/vpp.postinst8
-rw-r--r--src/pkg/debian/vpp.postrm21
-rw-r--r--src/pkg/debian/vpp.preinst4
-rw-r--r--src/pkg/debian/vpp.service13
9 files changed, 224 insertions, 0 deletions
diff --git a/src/pkg/CMakeLists.txt b/src/pkg/CMakeLists.txt
new file mode 100644
index 00000000000..a725e668405
--- /dev/null
+++ b/src/pkg/CMakeLists.txt
@@ -0,0 +1,43 @@
+# Copyright (c) 2019 Cisco and/or its affiliates.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+get_cmake_property(VPP_COMPONENTS COMPONENTS)
+string(REPLACE ";" " " VPP_COMPONENTS "${VPP_COMPONENTS}")
+
+execute_process(
+ COMMAND date -R
+ OUTPUT_VARIABLE TIMESTAMP
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+
+foreach(f rules changelog)
+ configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/debian/${f}.in
+ ${CMAKE_BINARY_DIR}/debian/${f}
+ )
+endforeach()
+
+foreach(f control copyright vpp.postinst vpp.postrm vpp.postinst vpp.service)
+ file(COPY
+ ${CMAKE_CURRENT_SOURCE_DIR}/debian/${f}
+ DESTINATION ${CMAKE_BINARY_DIR}/debian
+ )
+endforeach()
+
+file(WRITE ${CMAKE_BINARY_DIR}/debian/compat "9\n")
+
+add_custom_target(package-deb
+ COMMENT "Building .deb packages..."
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+ COMMAND "dpkg-buildpackage" "-us" "-uc" "-b"
+)
diff --git a/src/pkg/debian/changelog.in b/src/pkg/debian/changelog.in
new file mode 100644
index 00000000000..4d9b87ab553
--- /dev/null
+++ b/src/pkg/debian/changelog.in
@@ -0,0 +1,6 @@
+vpp (@VPP_VERSION@) unstable; urgency=low
+
+ * no description
+
+ -- fd.io VPP <vpp-dev@fd.io> @TIMESTAMP@
+
diff --git a/src/pkg/debian/control b/src/pkg/debian/control
new file mode 100644
index 00000000000..c9d4c4642de
--- /dev/null
+++ b/src/pkg/debian/control
@@ -0,0 +1,75 @@
+Source: vpp
+Section: net
+Priority: extra
+Maintainer: fd.io VPP Packaging Team <vpp-dev@fd.io>
+Build-Depends: debhelper (>= 9),
+ dh-systemd,
+ dh-python,
+ python-all
+Standards-Version: 3.9.4
+
+Package: vpp
+Architecture: any
+Depends: libvppinfra (= ${source:Version}),
+ ${shlibs:Depends},
+ ${misc:Depends},
+ ${python:Depends}
+Description: Vector Packet Processing--executables
+ This package provides VPP executables: vpp, vpp_api_test, vpp_json_test
+ vpp - the vector packet engine
+ vpp_api_test - vector packet engine API test tool
+ vpp_json_test - vector packet engine JSON test tool
+
+Package: vpp-dbg
+Architecture: any
+Depends: ${misc:Depends}
+Description: Vector Packet Processing--debug symbols
+
+Package: vpp-dev
+Architecture: any
+Depends: libvppinfra-dev (= ${source:Version}),
+ ${misc:Depends},
+ ${python:Depends}
+Description: Vector Packet Processing--development support
+ This package contains development support files for the VPP libraries
+ .
+
+Package: libvppinfra
+Architecture: any
+Depends: ${shlibs:Depends},
+ ${misc:Depends}
+Description: Vector Packet Processing--runtime libraries
+ This package contains the VPP shared libraries, including:
+ .
+
+Package: libvppinfra-dev
+Architecture: any
+Depends: ${misc:Depends}
+Description: Vector Packet Processing--runtime libraries
+ This package contains the VPP shared libraries, including:
+ .
+
+Package: vpp-plugin-core
+Architecture: any
+Depends: vpp (= ${source:Version}),
+ ${misc:Depends}
+Description: Vector Packet Processing--runtime core plugins
+ This package contains VPP core plugins
+ .
+
+Package: vpp-plugin-dpdk
+Architecture: any
+Depends: vpp (= ${source:Version}),
+ ${misc:Depends}
+Description: Vector Packet Processing--runtime dpdk plugin
+ This package contains the VPP dpdk plugin
+ .
+
+Package: vpp-api-python
+Architecture: any
+Depends: vpp (= ${source:Version}),
+ ${python2:Depends},
+ ${misc:Depends}
+Description: VPP Python API bindings
+ This package contains VPP python api bindings
+ .
diff --git a/src/pkg/debian/copyright b/src/pkg/debian/copyright
new file mode 100644
index 00000000000..f9775c158f9
--- /dev/null
+++ b/src/pkg/debian/copyright
@@ -0,0 +1,9 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: optional.
+Upstream-Contact: optional.
+Source: optional.
+Disclaimer: optional.
+Comment: optional.
+License: Apache-2.0
+Copyright: 2015 Cisco and/or its affiliates and others.
+
diff --git a/src/pkg/debian/rules.in b/src/pkg/debian/rules.in
new file mode 100755
index 00000000000..4d2bb408116
--- /dev/null
+++ b/src/pkg/debian/rules.in
@@ -0,0 +1,45 @@
+#!/usr/bin/make -f
+# See debhelper(7) (uncomment to enable)
+# output every command that modifies files on the build system.
+DH_VERBOSE = 1
+
+# see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/*
+DPKG_EXPORT_BUILDFLAGS = 1
+include /usr/share/dpkg/default.mk
+
+export PYBUILD_NAME = vpp-api-python
+export PYBUILD_DIR = @CMAKE_SOURCE_DIR@/vpp-api/python
+export PYBUILD_DESTDIR_python2=debian/vpp-api-python/
+export PYBUILD_DISABLE_python2=test
+export PYBUILD_SYSTEM=distutils
+
+# main packaging script based on dh7 syntax
+%:
+ dh $@ --with systemd,python2 --buildsystem=pybuild
+
+override_dh_shlibdeps:
+ @dh_shlibdeps -X_plugin 2>&1 \
+ | { grep -v -e "probably a plugin" || true; }
+
+override_dh_strip:
+ dh_strip --dbg-package=vpp-dbg
+
+DEB_HOST_MULTIARCH = $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
+
+override_dh_install:
+ for c in @VPP_COMPONENTS@; do \
+ @CMAKE_COMMAND@ \
+ -D CMAKE_INSTALL_CONFIG_NAME=@CMAKE_BUILD_TYPE@ \
+ -D CMAKE_INSTALL_COMPONENT=$$c \
+ -D CMAKE_INSTALL_PREFIX=@CMAKE_BINARY_DIR@/debian/$$c \
+ -P @CMAKE_BINARY_DIR@/cmake_install.cmake ; \
+ if [ -d debian/$$c/lib ] ; then \
+ mv debian/$$c/lib debian/$$c/$(DEB_HOST_MULTIARCH) ; \
+ mkdir -p debian/$$c/usr/lib ; \
+ mv debian/$$c/$(DEB_HOST_MULTIARCH) debian/$$c/usr/lib ; \
+ fi ; \
+ if [ -d debian/$$c/bin ] ; then \
+ mv debian/$$c/bin debian/$$c/usr/bin ; \
+ fi ; \
+ @CMAKE_SOURCE_DIR@/scripts/remove-rpath debian/$$c ; \
+ done
diff --git a/src/pkg/debian/vpp.postinst b/src/pkg/debian/vpp.postinst
new file mode 100644
index 00000000000..78fcac226a8
--- /dev/null
+++ b/src/pkg/debian/vpp.postinst
@@ -0,0 +1,8 @@
+#!/bin/sh -e
+
+# try to set the required values now. This may or may not work.
+sysctl --system
+
+#DEBHELPER#
+
+exit 0
diff --git a/src/pkg/debian/vpp.postrm b/src/pkg/debian/vpp.postrm
new file mode 100644
index 00000000000..24b4842fd0a
--- /dev/null
+++ b/src/pkg/debian/vpp.postrm
@@ -0,0 +1,21 @@
+#!/bin/sh -e
+
+removed=
+
+# Unbind user-mode PCI drivers
+pci_dirs=`find /sys/bus/pci/drivers -type d -name igb_uio -o -name uio_pci_generic -o -name vfio-pci`
+for d in $pci_dirs; do
+ for f in ${d}/*; do
+ [ -e "${f}/config" ] || continue
+ echo ${f##*/} > ${d}/unbind
+ basename `dirname ${f}` | xargs echo -n "Removing driver"; echo " for PCI ID" `basename ${f}`
+ removed=y
+ done
+done
+if [ -n "${removed}" ]; then
+ echo "There are changes in PCI drivers, rescaning"
+ echo 1 > /sys/bus/pci/rescan
+else
+ echo "There weren't PCI devices binded"
+fi
+
diff --git a/src/pkg/debian/vpp.preinst b/src/pkg/debian/vpp.preinst
new file mode 100644
index 00000000000..d33cacfc3fa
--- /dev/null
+++ b/src/pkg/debian/vpp.preinst
@@ -0,0 +1,4 @@
+#!/bin/sh -e
+
+# Add the vpp group
+groupadd -f -r vpp
diff --git a/src/pkg/debian/vpp.service b/src/pkg/debian/vpp.service
new file mode 100644
index 00000000000..2e86941de8b
--- /dev/null
+++ b/src/pkg/debian/vpp.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=vector packet processing engine
+After=network.target
+
+[Service]
+Type=simple
+ExecStartPre=-/sbin/modprobe uio_pci_generic
+ExecStart=/usr/bin/vpp -c /etc/vpp/startup.conf
+ExecStopPost=/bin/rm -f /dev/shm/db /dev/shm/global_vm /dev/shm/vpe-api
+Restart=always
+
+[Install]
+WantedBy=multi-user.target