-
Notifications
You must be signed in to change notification settings - Fork 44
/
install_builddeps.sh
executable file
·61 lines (51 loc) · 1.38 KB
/
install_builddeps.sh
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env bash
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2019 Intel Corporation
SUDO=''
[[ $EUID -ne 0 ]] && SUDO=sudo
CUR_DIR=$PWD
function finish() {
cd $CUR_DIR
}
trap finish EXIT
install_pkg_deps() {
$SUDO apt-get update && $SUDO apt-get -y install \
build-essential \
libcurl4-openssl-dev \
libhyperscan-dev \
libjson-c-dev \
libnuma-dev \
libpcap0.8-dev \
libssl-dev \
libmnl-dev \
libzmq3-dev \
wget
}
DEPS_DIR=${DEPS_DIR:-"$PWD/third_party"}
CPUS=${CPUS:-''}
# Install DPDK
DPDK_VER=${DPDK_VER:-'18.02.2'}
export RTE_SDK=${RTE_SDK:-$DEPS_DIR/dpdk}
export RTE_TARGET=${RTE_TARGET:-'x86_64-native-linuxapp-gcc'}
export RTE_MACHINE=${RTE_MACHINE:-'native'}
install_dpdk() {
[ -d $RTE_SDK ] && echo "DPDK already exists at $RTE_SDK" && return
mkdir -p ${RTE_SDK} && cd ${RTE_SDK}/../
wget http://fast.dpdk.org/rel/dpdk-${DPDK_VER}.tar.xz
tar -xvf dpdk-${DPDK_VER}.tar.xz -C ${RTE_SDK} --strip-components 1
cd ${RTE_SDK}
sed -ri 's,(IGB_UIO=).*,\1n,' config/common_linuxapp
sed -ri 's,(KNI_KMOD=).*,\1n,' config/common_linuxapp
make -j $CPUS install T=${RTE_TARGET} RTE_MACHINE=${RTE_MACHINE}
echo "Installed DPDK at $RTE_SDK"
}
install_build_deps() {
install_pkg_deps
install_dpdk
}
(return 2>/dev/null) && echo "Sourced" && return
set -o errexit
set -o pipefail
set -o nounset
install_build_deps
echo "Dependency install complete"