Damjan Marion | 01fe7ab | 2023-10-23 18:36:18 +0200 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | PKG=vpp-dep-octeon-roc |
| 4 | URL=https://github.com/MarvellEmbeddedProcessors/marvell-vpp.git |
| 5 | ARCH=$(dpkg --print-architecture) |
| 6 | TMP_DIR=$(mktemp -d -p $PWD) |
| 7 | |
| 8 | set -eEuo pipefail |
| 9 | |
| 10 | err_handler() |
| 11 | { |
| 12 | trap '' INT TERM EXIT ERR |
| 13 | echo "Cleaning up ${TMP_DIR}" |
| 14 | rm -rf ${TMP_DIR} |
| 15 | exit |
| 16 | } |
| 17 | trap "err_handler" INT TERM EXIT ERR |
| 18 | |
| 19 | SRC=${TMP_DIR}/src |
| 20 | BUILD=${TMP_DIR}/build |
| 21 | STAGE=${TMP_DIR}/pkg |
| 22 | INSTALL_PREFIX=/opt/vpp/external/$(uname -m) |
| 23 | |
| 24 | git clone ${URL} ${SRC} |
| 25 | VER=0.0.$(git -C ${SRC} rev-list --count HEAD) |
| 26 | |
| 27 | cmake -S ${SRC} -B ${BUILD} |
| 28 | cmake --build ${BUILD} --parallel |
| 29 | cmake --install ${BUILD} --prefix ${STAGE}${INSTALL_PREFIX} |
| 30 | |
| 31 | mkdir -p ${STAGE}/DEBIAN |
| 32 | |
| 33 | cat > ${STAGE}/DEBIAN/control << __EOF__ |
| 34 | Package: ${PKG} |
| 35 | Version: ${VER} |
| 36 | Architecture: ${ARCH} |
| 37 | Maintainer: vpp-dev <vpp-dev@fd.io> |
| 38 | Installed-Size: $(du -ks ${STAGE}|cut -f 1) |
| 39 | Section: system |
| 40 | Priority: extra |
| 41 | Description: Marvell Octeon ROC library for VPP |
| 42 | See https://github.com/MarvellEmbeddedProcessors/marvell-vpp |
| 43 | __EOF__ |
| 44 | |
| 45 | DEB=${PKG}_${VER}_${ARCH}.deb |
| 46 | dpkg-deb -b ${STAGE} ${DEB} |