blob: 8d84e1bb4020f3228d5f482000129393de4acb09 [file] [log] [blame]
Junxiao Shi439d9722015-03-20 15:08:44 -07001#!/usr/bin/env bash
Davide Pesaventobd3642f2022-08-12 18:19:31 -04002set -eo pipefail
Davide Pesavento956ac312016-09-20 19:11:30 +02003
Davide Pesaventobd3642f2022-08-12 18:19:31 -04004APT_PKGS=(build-essential pkg-config python3-minimal
5 libboost-all-dev libssl-dev libsqlite3-dev
6 libpcap-dev)
7FORMULAE=(boost openssl pkg-config)
8PIP_PKGS=()
9case $JOB_NAME in
10 *code-coverage)
11 APT_PKGS+=(lcov python3-pip)
12 PIP_PKGS+=('gcovr~=5.2')
13 ;;
14 *Docs)
15 APT_PKGS+=(python3-pip)
16 PIP_PKGS+=(sphinx)
17 ;;
18esac
Junxiao Shi439d9722015-03-20 15:08:44 -070019
Davide Pesaventobd3642f2022-08-12 18:19:31 -040020set -x
21
22if [[ $ID == macos ]]; then
Davide Pesavento2c8ec072021-09-30 00:04:23 -040023 if [[ -n $GITHUB_ACTIONS ]]; then
Davide Pesaventobd3642f2022-08-12 18:19:31 -040024 export HOMEBREW_NO_INSTALL_UPGRADE=1
25 fi
26 brew update
27 brew install --formula "${FORMULAE[@]}"
28
29 if (( ${#PIP_PKGS[@]} )); then
30 pip3 install --upgrade --upgrade-strategy=eager "${PIP_PKGS[@]}"
Davide Pesaventoa1a9d702020-03-29 00:58:15 -040031 fi
32
Davide Pesaventobd3642f2022-08-12 18:19:31 -040033elif [[ $ID_LIKE == *debian* ]]; then
Davide Pesavento0e8edde2016-05-03 18:08:39 +020034 sudo apt-get -qq update
Davide Pesaventobd3642f2022-08-12 18:19:31 -040035 sudo apt-get -qy install "${APT_PKGS[@]}"
Davide Pesavento931dfe82017-04-29 20:33:45 -040036
Davide Pesaventobd3642f2022-08-12 18:19:31 -040037 if (( ${#PIP_PKGS[@]} )); then
38 pip3 install --user --upgrade --upgrade-strategy=eager "${PIP_PKGS[@]}"
39 fi
Md Ashiqur Rahman25c37f12018-10-12 17:59:20 +000040
Davide Pesaventobd3642f2022-08-12 18:19:31 -040041elif [[ $ID_LIKE == *fedora* ]]; then
Davide Pesaventod8398822020-03-29 18:46:19 -040042 sudo dnf -y install gcc-c++ libasan pkgconf-pkg-config python3 \
43 boost-devel openssl-devel sqlite-devel \
44 libpcap-devel
Md Ashiqur Rahman25c37f12018-10-12 17:59:20 +000045fi