2020-06-03 21:10:13 +01:00
|
|
|
#!/usr/bin/env bash
|
2020-12-05 00:30:46 +09:00
|
|
|
# DESCRIPTION: Verilator: CI dependency install script
|
2020-06-03 21:10:13 +01:00
|
|
|
#
|
|
|
|
|
# Copyright 2020 by Geza Lore. This program is free software; you
|
|
|
|
|
# can redistribute it and/or modify it under the terms of either the GNU
|
|
|
|
|
# Lesser General Public License Version 3 or the Perl Artistic License
|
|
|
|
|
# Version 2.0.
|
|
|
|
|
#
|
|
|
|
|
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
|
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
|
# This script runs in the 'install' phase of all jobs, in all stages. We try to
|
|
|
|
|
# minimize the time spent in this by selectively installing only the components
|
|
|
|
|
# required by the particular build stage.
|
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
set -x
|
|
|
|
|
|
2020-12-23 17:53:05 +00:00
|
|
|
cd $(dirname "$0")/..
|
|
|
|
|
|
2022-09-07 22:49:09 -04:00
|
|
|
# Avoid occasional cpan failures "Issued certificate has expired."
|
|
|
|
|
export PERL_LWP_SSL_VERIFY_HOSTNAME=0
|
2022-09-08 11:06:44 -04:00
|
|
|
echo "check_certificate = off" >> ~/.wgetrc
|
2022-09-07 22:49:09 -04:00
|
|
|
|
2020-06-03 21:10:13 +01:00
|
|
|
fatal() {
|
|
|
|
|
echo "ERROR: $(basename "$0"): $1" >&2; exit 1;
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-05 00:30:46 +09:00
|
|
|
if [ "$CI_OS_NAME" = "linux" ]; then
|
2020-06-04 21:08:32 +01:00
|
|
|
MAKE=make
|
2020-12-05 00:30:46 +09:00
|
|
|
elif [ "$CI_OS_NAME" = "osx" ]; then
|
2020-06-04 21:08:32 +01:00
|
|
|
MAKE=make
|
2020-12-05 00:30:46 +09:00
|
|
|
elif [ "$CI_OS_NAME" = "freebsd" ]; then
|
2020-06-04 21:08:32 +01:00
|
|
|
MAKE=gmake
|
|
|
|
|
else
|
2020-12-05 00:30:46 +09:00
|
|
|
fatal "Unknown os: '$CI_OS_NAME'"
|
2020-06-04 21:08:32 +01:00
|
|
|
fi
|
|
|
|
|
|
2020-06-03 21:10:13 +01:00
|
|
|
install-vcddiff() {
|
|
|
|
|
TMP_DIR="$(mktemp -d)"
|
|
|
|
|
git clone https://github.com/veripool/vcddiff "$TMP_DIR"
|
2021-07-01 21:35:19 +01:00
|
|
|
git -C "${TMP_DIR}" checkout e5664be5fe39d353bf3fcb50aa05214ab7ed4ac4
|
2020-06-04 21:08:32 +01:00
|
|
|
"$MAKE" -C "${TMP_DIR}"
|
2020-06-03 21:10:13 +01:00
|
|
|
sudo cp "${TMP_DIR}/vcddiff" /usr/local/bin
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-05 00:30:46 +09:00
|
|
|
if [ "$CI_BUILD_STAGE_NAME" = "build" ]; then
|
2020-06-03 21:10:13 +01:00
|
|
|
##############################################################################
|
|
|
|
|
# Dependencies of jobs in the 'build' stage, i.e.: packages required to
|
|
|
|
|
# build Verilator
|
|
|
|
|
|
2020-12-05 00:30:46 +09:00
|
|
|
if [ "$CI_OS_NAME" = "linux" ]; then
|
2023-01-07 20:27:00 -05:00
|
|
|
sudo apt-get update ||
|
2020-06-22 10:13:54 +01:00
|
|
|
sudo apt-get update
|
2023-01-17 19:15:54 -05:00
|
|
|
sudo apt-get install ccache help2man libfl-dev ||
|
|
|
|
|
sudo apt-get install ccache help2man libfl-dev
|
2023-05-23 22:25:03 -04:00
|
|
|
if [ "$CI_RUNS_ON" = "ubuntu-20.04" ]; then
|
2022-05-30 16:51:40 +01:00
|
|
|
# Some conflict of libunwind verison on 22.04, can live without it for now
|
2023-05-23 21:30:39 -04:00
|
|
|
sudo apt-get install libgoogle-perftools-dev ||
|
|
|
|
|
sudo apt-get install libgoogle-perftools-dev
|
2022-05-30 16:51:40 +01:00
|
|
|
fi
|
2024-09-07 10:12:35 -04:00
|
|
|
if [ "$CI_RUNS_ON" = "ubuntu-20.04" ] || [ "$CI_RUNS_ON" = "ubuntu-22.04" ] || [ "$CI_RUNS_ON" = "ubuntu-24.04" ]; then
|
2023-01-07 20:27:00 -05:00
|
|
|
sudo apt-get install libsystemc libsystemc-dev ||
|
2020-12-10 20:22:00 -05:00
|
|
|
sudo apt-get install libsystemc libsystemc-dev
|
|
|
|
|
fi
|
2024-09-07 10:12:35 -04:00
|
|
|
if [ "$CI_RUNS_ON" = "ubuntu-22.04" ] || [ "$CI_RUNS_ON" = "ubuntu-24.04" ]; then
|
2023-09-08 23:26:11 +02:00
|
|
|
sudo apt-get install bear mold ||
|
|
|
|
|
sudo apt-get install bear mold
|
2023-05-23 21:30:39 -04:00
|
|
|
fi
|
2020-12-05 00:30:46 +09:00
|
|
|
elif [ "$CI_OS_NAME" = "osx" ]; then
|
2020-06-22 10:13:54 +01:00
|
|
|
brew update
|
|
|
|
|
brew install ccache perl gperftools
|
2020-12-05 00:30:46 +09:00
|
|
|
elif [ "$CI_OS_NAME" = "freebsd" ]; then
|
2020-06-04 21:08:32 +01:00
|
|
|
sudo pkg install -y autoconf bison ccache gmake perl5
|
2020-06-03 21:10:13 +01:00
|
|
|
else
|
2020-12-05 00:30:46 +09:00
|
|
|
fatal "Unknown os: '$CI_OS_NAME'"
|
2020-06-03 21:10:13 +01:00
|
|
|
fi
|
2020-12-23 17:53:05 +00:00
|
|
|
|
2020-12-23 19:52:37 +01:00
|
|
|
if [ -n "$CCACHE_DIR" ]; then
|
|
|
|
|
mkdir -p "$CCACHE_DIR" && ./ci/ci-ccache-maint.bash
|
|
|
|
|
fi
|
2020-12-05 00:30:46 +09:00
|
|
|
elif [ "$CI_BUILD_STAGE_NAME" = "test" ]; then
|
2020-06-03 21:10:13 +01:00
|
|
|
##############################################################################
|
|
|
|
|
# Dependencies of jobs in the 'test' stage, i.e.: packages required to
|
|
|
|
|
# run the tests
|
|
|
|
|
|
2020-12-05 00:30:46 +09:00
|
|
|
if [ "$CI_OS_NAME" = "linux" ]; then
|
2023-01-07 20:27:00 -05:00
|
|
|
sudo apt-get update ||
|
2020-06-03 21:10:13 +01:00
|
|
|
sudo apt-get update
|
2021-01-02 21:42:41 -05:00
|
|
|
# libfl-dev needed for internal coverage's test runs
|
2024-05-17 16:38:34 +02:00
|
|
|
sudo apt-get install gdb gtkwave lcov libfl-dev ccache jq z3 ||
|
|
|
|
|
sudo apt-get install gdb gtkwave lcov libfl-dev ccache jq z3
|
2024-09-08 13:00:03 -04:00
|
|
|
# Required for test_regress/t/t_dist_attributes.py
|
2024-09-07 10:12:35 -04:00
|
|
|
if [ "$CI_RUNS_ON" = "ubuntu-22.04" ] || [ "$CI_RUNS_ON" = "ubuntu-24.04" ]; then
|
2024-03-17 12:10:13 +00:00
|
|
|
sudo apt-get install python3-clang mold ||
|
|
|
|
|
sudo apt-get install python3-clang mold
|
2022-12-16 17:19:27 +01:00
|
|
|
fi
|
2024-09-07 10:12:35 -04:00
|
|
|
if [ "$CI_RUNS_ON" = "ubuntu-20.04" ] || [ "$CI_RUNS_ON" = "ubuntu-22.04" ] || [ "$CI_RUNS_ON" = "ubuntu-24.04" ]; then
|
2023-01-07 20:27:00 -05:00
|
|
|
sudo apt-get install libsystemc-dev ||
|
2020-06-03 21:10:13 +01:00
|
|
|
sudo apt-get install libsystemc-dev
|
|
|
|
|
fi
|
2020-12-05 00:30:46 +09:00
|
|
|
elif [ "$CI_OS_NAME" = "osx" ]; then
|
2020-06-22 10:13:54 +01:00
|
|
|
brew update
|
|
|
|
|
# brew cask install gtkwave # fst2vcd hangs at launch, so don't bother
|
2024-05-17 16:38:34 +02:00
|
|
|
brew install ccache perl jq z3
|
2020-12-05 00:30:46 +09:00
|
|
|
elif [ "$CI_OS_NAME" = "freebsd" ]; then
|
2020-06-04 21:08:32 +01:00
|
|
|
# fst2vcd fails with "Could not open '<input file>', exiting."
|
2024-05-17 16:38:34 +02:00
|
|
|
sudo pkg install -y ccache gmake perl5 python3 jq z3
|
2020-06-03 21:10:13 +01:00
|
|
|
else
|
2020-12-05 00:30:46 +09:00
|
|
|
fatal "Unknown os: '$CI_OS_NAME'"
|
2020-06-03 21:10:13 +01:00
|
|
|
fi
|
2020-08-02 08:47:09 -04:00
|
|
|
# Common installs
|
|
|
|
|
install-vcddiff
|
2024-03-15 21:06:21 -04:00
|
|
|
# Workaround -fsanitize=address crash
|
|
|
|
|
sudo sysctl -w vm.mmap_rnd_bits=28
|
2020-06-03 21:10:13 +01:00
|
|
|
else
|
|
|
|
|
##############################################################################
|
|
|
|
|
# Unknown build stage
|
2020-12-05 00:30:46 +09:00
|
|
|
fatal "Unknown build stage: '$CI_BUILD_STAGE_NAME'"
|
2020-06-03 21:10:13 +01:00
|
|
|
fi
|