summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2020-03-18 10:14:40 -0400
committerFlorin Coras <florin.coras@gmail.com>2020-03-18 16:14:52 +0000
commit6d97e62c009086030cddb38c5432c8f860b1c02c (patch)
treebbf3cad3b264e550b9d711339c07c2bd5922a411
parent6a32ce326495bfe48ebef74dfbb8a9c1cf37a530 (diff)
build: add snap packaging (experimental)
Type: feature Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I5a5efde5378f63d89d82d71ae009c7595aaa800c
-rw-r--r--Makefile18
-rwxr-xr-xextras/snap/prep11
-rw-r--r--extras/snap/snapcraft.yaml55
3 files changed, 83 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 545ccdb66fe..fde91c4a680 100644
--- a/Makefile
+++ b/Makefile
@@ -72,7 +72,7 @@ DEB_DEPENDS += cmake ninja-build uuid-dev python3-jsonschema python3-yaml
DEB_DEPENDS += python3-venv # ensurepip
DEB_DEPENDS += python3-dev # needed for python3 -m pip install psutil
# python3.6 on 16.04 requires python36-dev
-
+
ifeq ($(OS_VERSION_ID),16.04)
DEB_DEPENDS += python-dev
DEB_DEPENDS += libssl-dev
@@ -207,6 +207,8 @@ help:
@echo " run-vat - run vpp-api-test tool"
@echo " pkg-deb - build DEB packages"
@echo " pkg-deb-debug - build DEB debug packages"
+ @echo " pkg-snap - build SNAP package"
+ @echo " snap-clean - clean up snap build environment"
@echo " vom-pkg-deb - build vom DEB packages"
@echo " vom-pkg-deb-debug - build vom DEB debug packages"
@echo " pkg-rpm - build RPM packages"
@@ -578,6 +580,20 @@ run-vat:
pkg-deb:
$(call make,$(PLATFORM),vpp-package-deb)
+.PHONY: pkg-snap
+pkg-snap:
+ cd extras/snap ; \
+ ./prep ; \
+ SNAPCRAFT_BUILD_ENVIRONMENT_MEMORY=8G \
+ SNAPCRAFT_BUILD_ENVIRONMENT_CPU=6 \
+ snapcraft --debug
+
+.PHONY: snap-clean
+snap-clean:
+ cd extras/snap ; \
+ snapcraft clean ; \
+ rm -f *.snap *.tgz
+
.PHONY: vom-pkg-deb
vom-pkg-deb: pkg-deb
$(call make,$(PLATFORM),vom-package-deb)
diff --git a/extras/snap/prep b/extras/snap/prep
new file mode 100755
index 00000000000..caabd85ccd6
--- /dev/null
+++ b/extras/snap/prep
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+set -eu
+
+cd ../../build-root
+echo "make distclean..."
+make distclean > /dev/null 2>&1
+cd ../
+echo "construct source tarball..."
+tar -zcf extras/snap/vpp.tgz --exclude=extras/snap/vpp.tgz .
+exit 0
diff --git a/extras/snap/snapcraft.yaml b/extras/snap/snapcraft.yaml
new file mode 100644
index 00000000000..7fce0af372b
--- /dev/null
+++ b/extras/snap/snapcraft.yaml
@@ -0,0 +1,55 @@
+name: vpp
+base: core18
+version: '20.05'
+summary: Vector Packet Processor
+description: |
+ High performance user-mode network stack
+
+grade: devel
+confinement: classic
+
+parts:
+ vpp:
+ source-type: tar
+ source: vpp.tgz
+ plugin: nil
+ build-packages:
+ - gcc-8
+ - make
+ - libnuma-dev
+ stage-packages:
+ # For the dpdk plugin
+ - libnuma1
+ override-build: |
+ UNATTENDED=y make install-dep build-release
+ override-prime: |
+ # Copy the build results into SNAPCRAFT_PRIME
+ cd $SNAPCRAFT_PART_BUILD/build-root/install-vpp-native
+ tar cf - . | (cd $SNAPCRAFT_PRIME ; tar xf -)
+ # Copy staged libraries into SNAPCRAFT_PRIME
+ cp $SNAPCRAFT_STAGE/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/lib* $SNAPCRAFT_PRIME/vpp/lib
+ # Strip (unneeded) symbols
+ cd $SNAPCRAFT_PRIME
+ find . -type f -exec strip --strip-unneeded '{}' ';' 2> /dev/null || true
+
+apps:
+ vpp:
+ command: vpp/bin/vpp -c $SNAP/vpp/etc/vpp/startup.conf
+ daemon: simple
+ environment:
+ "LD_LIBRARY_PATH": "$SNAP/vpp/lib:$SNAP/vpp/lib/vpp_plugins:$SNAP/vpp/lib/vpp_api_test_plugins"
+
+ vppctl:
+ command: vpp/bin/vppctl
+ environment:
+ "LD_LIBRARY_PATH": "$SNAP/vpp/lib"
+
+ vpp-api-test:
+ command: vpp/bin/vpp_api_test
+ environment:
+ "LD_LIBRARY_PATH": "$SNAP/vpp/lib"
+
+ svmtool:
+ command: vpp/bin/svmtool
+ environment:
+ "LD_LIBRARY_PATH": "$SNAP/vpp/lib"