Junxiao Shi | 439d972 | 2015-03-20 15:08:44 -0700 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Davide Pesavento | bd3642f | 2022-08-12 18:19:31 -0400 | [diff] [blame] | 2 | set -eo pipefail |
Davide Pesavento | 956ac31 | 2016-09-20 19:11:30 +0200 | [diff] [blame] | 3 | |
Davide Pesavento | bd3642f | 2022-08-12 18:19:31 -0400 | [diff] [blame] | 4 | APT_PKGS=(build-essential pkg-config python3-minimal |
| 5 | libboost-all-dev libssl-dev libsqlite3-dev |
| 6 | libpcap-dev) |
| 7 | FORMULAE=(boost openssl pkg-config) |
| 8 | PIP_PKGS=() |
| 9 | case $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 | ;; |
| 18 | esac |
Junxiao Shi | 439d972 | 2015-03-20 15:08:44 -0700 | [diff] [blame] | 19 | |
Davide Pesavento | bd3642f | 2022-08-12 18:19:31 -0400 | [diff] [blame] | 20 | set -x |
| 21 | |
| 22 | if [[ $ID == macos ]]; then |
Davide Pesavento | 2c8ec07 | 2021-09-30 00:04:23 -0400 | [diff] [blame] | 23 | if [[ -n $GITHUB_ACTIONS ]]; then |
Davide Pesavento | bd3642f | 2022-08-12 18:19:31 -0400 | [diff] [blame] | 24 | 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 Pesavento | a1a9d70 | 2020-03-29 00:58:15 -0400 | [diff] [blame] | 31 | fi |
| 32 | |
Davide Pesavento | bd3642f | 2022-08-12 18:19:31 -0400 | [diff] [blame] | 33 | elif [[ $ID_LIKE == *debian* ]]; then |
Davide Pesavento | 0e8edde | 2016-05-03 18:08:39 +0200 | [diff] [blame] | 34 | sudo apt-get -qq update |
Davide Pesavento | bd3642f | 2022-08-12 18:19:31 -0400 | [diff] [blame] | 35 | sudo apt-get -qy install "${APT_PKGS[@]}" |
Davide Pesavento | 931dfe8 | 2017-04-29 20:33:45 -0400 | [diff] [blame] | 36 | |
Davide Pesavento | bd3642f | 2022-08-12 18:19:31 -0400 | [diff] [blame] | 37 | if (( ${#PIP_PKGS[@]} )); then |
| 38 | pip3 install --user --upgrade --upgrade-strategy=eager "${PIP_PKGS[@]}" |
| 39 | fi |
Md Ashiqur Rahman | 25c37f1 | 2018-10-12 17:59:20 +0000 | [diff] [blame] | 40 | |
Davide Pesavento | bd3642f | 2022-08-12 18:19:31 -0400 | [diff] [blame] | 41 | elif [[ $ID_LIKE == *fedora* ]]; then |
Davide Pesavento | d839882 | 2020-03-29 18:46:19 -0400 | [diff] [blame] | 42 | sudo dnf -y install gcc-c++ libasan pkgconf-pkg-config python3 \ |
| 43 | boost-devel openssl-devel sqlite-devel \ |
| 44 | libpcap-devel |
Md Ashiqur Rahman | 25c37f1 | 2018-10-12 17:59:20 +0000 | [diff] [blame] | 45 | fi |