aboutsummaryrefslogtreecommitdiffstats
path: root/extras/deb/mkdeb-octeon-roc
blob: 08e57f4bd1e995a0380fc925fb74998260096491 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash

PKG=vpp-dep-octeon-roc
URL=https://github.com/MarvellEmbeddedProcessors/marvell-vpp.git
ARCH=$(dpkg --print-architecture)
TMP_DIR=$(mktemp -d -p $PWD)

set -eEuo pipefail

err_handler()
{
  trap '' INT TERM EXIT ERR
  echo "Cleaning up ${TMP_DIR}"
  rm -rf ${TMP_DIR}
  exit
}
trap "err_handler" INT TERM EXIT ERR

SRC=${TMP_DIR}/src
BUILD=${TMP_DIR}/build
STAGE=${TMP_DIR}/pkg
INSTALL_PREFIX=/opt/vpp/external/$(uname -m)

git clone ${URL} ${SRC}
VER=0.0.$(git -C ${SRC} rev-list --count HEAD)

cmake -S ${SRC} -B ${BUILD}
cmake --build ${BUILD} --parallel
cmake --install ${BUILD} --prefix ${STAGE}${INSTALL_PREFIX}

mkdir -p ${STAGE}/DEBIAN

cat > ${STAGE}/DEBIAN/control << __EOF__
Package: ${PKG}
Version: ${VER}
Architecture: ${ARCH}
Maintainer: vpp-dev <vpp-dev@fd.io>
Installed-Size: $(du -ks ${STAGE}|cut -f 1)
Section: system
Priority: extra
Description: Marvell Octeon ROC library for VPP
 See https://github.com/MarvellEmbeddedProcessors/marvell-vpp
__EOF__

DEB=${PKG}_${VER}_${ARCH}.deb
dpkg-deb -b ${STAGE} ${DEB}