Alexander Afanasyev | b81cff9 | 2015-07-09 09:45:09 +0800 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Davide Pesavento | 72517b5 | 2022-08-13 18:50:55 -0400 | [diff] [blame] | 2 | set -eo pipefail |
Alexander Afanasyev | b81cff9 | 2015-07-09 09:45:09 +0800 | [diff] [blame] | 3 | |
Davide Pesavento | 72517b5 | 2022-08-13 18:50:55 -0400 | [diff] [blame] | 4 | APT_PKGS=(build-essential pkg-config python3-minimal |
| 5 | libboost-all-dev libssl-dev libsqlite3-dev |
| 6 | libpcap-dev libsystemd-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+=(doxygen graphviz python3-pip) |
Davide Pesavento | 8f0028d | 2021-07-27 20:01:06 -0400 | [diff] [blame] | 16 | FORMULAE+=(doxygen graphviz) |
Davide Pesavento | 72517b5 | 2022-08-13 18:50:55 -0400 | [diff] [blame] | 17 | PIP_PKGS+=(sphinx sphinxcontrib-doxylink) |
| 18 | ;; |
| 19 | esac |
Alexander Afanasyev | b81cff9 | 2015-07-09 09:45:09 +0800 | [diff] [blame] | 20 | |
Davide Pesavento | 72517b5 | 2022-08-13 18:50:55 -0400 | [diff] [blame] | 21 | set -x |
| 22 | |
| 23 | if [[ $ID == macos ]]; then |
Davide Pesavento | f28a061 | 2021-09-29 23:13:32 -0400 | [diff] [blame] | 24 | if [[ -n $GITHUB_ACTIONS ]]; then |
Davide Pesavento | 72517b5 | 2022-08-13 18:50:55 -0400 | [diff] [blame] | 25 | export HOMEBREW_NO_INSTALL_UPGRADE=1 |
| 26 | fi |
| 27 | brew update |
| 28 | brew install --formula "${FORMULAE[@]}" |
| 29 | |
| 30 | if (( ${#PIP_PKGS[@]} )); then |
| 31 | pip3 install --upgrade --upgrade-strategy=eager "${PIP_PKGS[@]}" |
Davide Pesavento | 69857c3 | 2020-04-05 16:36:26 -0400 | [diff] [blame] | 32 | fi |
| 33 | |
Davide Pesavento | 72517b5 | 2022-08-13 18:50:55 -0400 | [diff] [blame] | 34 | elif [[ $ID_LIKE == *debian* ]]; then |
Davide Pesavento | cc7bee7 | 2016-04-22 02:21:13 +0200 | [diff] [blame] | 35 | sudo apt-get -qq update |
Davide Pesavento | 72517b5 | 2022-08-13 18:50:55 -0400 | [diff] [blame] | 36 | sudo apt-get -qy install "${APT_PKGS[@]}" |
Davide Pesavento | 8d61c03 | 2017-04-29 20:06:33 -0400 | [diff] [blame] | 37 | |
Davide Pesavento | 72517b5 | 2022-08-13 18:50:55 -0400 | [diff] [blame] | 38 | if (( ${#PIP_PKGS[@]} )); then |
| 39 | pip3 install --user --upgrade --upgrade-strategy=eager "${PIP_PKGS[@]}" |
| 40 | fi |
Md Ashiqur Rahman | 922330b | 2018-09-04 17:55:18 +0000 | [diff] [blame] | 41 | |
Davide Pesavento | 72517b5 | 2022-08-13 18:50:55 -0400 | [diff] [blame] | 42 | elif [[ $ID_LIKE == *fedora* ]]; then |
Davide Pesavento | 6d6f207 | 2022-09-12 23:08:34 -0400 | [diff] [blame^] | 43 | sudo dnf -y install gcc-c++ libasan lld pkgconf-pkg-config python3 \ |
Davide Pesavento | 8f290fc | 2020-04-12 13:20:07 -0400 | [diff] [blame] | 44 | boost-devel openssl-devel sqlite-devel \ |
| 45 | libpcap-devel systemd-devel |
Md Ashiqur Rahman | 922330b | 2018-09-04 17:55:18 +0000 | [diff] [blame] | 46 | fi |