Skip to content

Commit 8b5e62f

Browse files
authored
Merge pull request #4687 from The-OpenROAD-Project-staging/deps-own-cmake-set
fix(deps): install ORFS's Ubuntu deps instead of OpenROAD's CMake set
2 parents 3ed9783 + d67d822 commit 8b5e62f

1 file changed

Lines changed: 73 additions & 2 deletions

File tree

‎etc/DependencyInstaller.sh‎

Lines changed: 73 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,58 @@ _versionCompare() {
2626
test $a "$2" $b
2727
}
2828

29+
# Yosys and kepler-formal are built with CMake. Yosys needs CMake >= 3.28,
30+
# newer than Ubuntu 22.04 ships, so fetch a release from Kitware when the
31+
# one on PATH is too old.
32+
cmakeMinVersion=3.28
33+
cmakeVersion=3.31.9
34+
cmakeChecksumX86_64=64797150473dabe9de95459cb1ce0715
35+
cmakeChecksumAarch64=8d426361ce8c54494c0a041a0e3bcc5c
36+
37+
# True if version $1 >= version $2. Unlike _versionCompare, this handles
38+
# versions with a different number of components (3.22.1 vs 3.28).
39+
_versionAtLeast() {
40+
[[ "$(printf '%s\n%s\n' "$2" "$1" | sort -V | head -n1)" == "$2" ]]
41+
}
42+
43+
# Prints the version of tool $2, looking in prefix $1 first, or 0 if absent.
44+
_toolVersion() {
45+
local bin
46+
bin=$(PATH="$1/bin:${PATH}" command -v "$2" || true)
47+
if [[ -z "${bin}" ]]; then
48+
echo 0
49+
return
50+
fi
51+
"${bin}" --version | head -n1 | grep -oE '[0-9]+\.[0-9]+(\.[0-9]+)?' | head -n1
52+
}
53+
54+
_installCmake() {
55+
local prefix=${PREFIX:-"/usr/local"}
56+
local current
57+
current=$(_toolVersion "${prefix}" cmake)
58+
if _versionAtLeast "${current}" "${cmakeMinVersion}"; then
59+
echo "CMake ${current} found, skipping install"
60+
return
61+
fi
62+
local arch checksum installer workDir
63+
arch=$(uname -m)
64+
if [[ "${arch}" == "aarch64" ]]; then
65+
checksum=${cmakeChecksumAarch64}
66+
else
67+
checksum=${cmakeChecksumX86_64}
68+
fi
69+
installer="cmake-${cmakeVersion}-linux-${arch}.sh"
70+
workDir=$(mktemp -d)
71+
(
72+
cd "${workDir}"
73+
wget -q "https://github.com/Kitware/CMake/releases/download/v${cmakeVersion}/${installer}"
74+
md5sum -c <(echo "${checksum} ${installer}")
75+
mkdir -p "${prefix}"
76+
sh "${installer}" --skip-license --prefix="${prefix}"
77+
)
78+
rm -rf "${workDir}"
79+
}
80+
2981
_installORDependencies() {
3082
if [[ ${YOSYS_VER} == "" ]]; then
3183
YOSYS_VER=v$(grep 'yosys_ver =' tools/yosys/docs/source/conf.py | awk -F'"' '{print $2}')
@@ -197,15 +249,20 @@ _installUbuntuPackages() {
197249
apt-get -y update
198250
apt-get -y install --no-install-recommends \
199251
bison \
252+
build-essential \
253+
ca-certificates \
200254
capnproto \
201255
curl \
202256
flex \
257+
git \
203258
help2man \
204259
libboost-iostreams-dev \
205260
libcapnp-dev \
261+
libffi-dev \
206262
libfl-dev \
207263
libfl2 \
208264
libgit2-dev \
265+
libgmock-dev \
209266
libgoogle-perftools-dev \
210267
libgtest-dev \
211268
libqt5multimediawidgets5 \
@@ -217,14 +274,19 @@ _installUbuntuPackages() {
217274
libz-dev \
218275
perl \
219276
pkg-config \
277+
python3-dev \
220278
python3-pip \
221279
python3-venv \
222280
qtmultimedia5-dev \
223281
qttools5-dev \
224282
ruby \
225283
ruby-dev \
284+
tcl-dev \
226285
tcl-tclreadline \
286+
tcllib \
227287
time \
288+
unzip \
289+
wget \
228290
zlib1g \
229291
zlib1g-dev
230292

@@ -322,8 +384,13 @@ _installCI() {
322384
ca-certificates \
323385
coreutils \
324386
curl \
387+
gnupg \
388+
jq \
389+
lsb-release \
390+
parallel \
325391
python3 \
326-
software-properties-common
392+
software-properties-common \
393+
zip
327394
}
328395

329396
_help() {
@@ -368,7 +435,7 @@ EOF
368435
}
369436

370437
# default args
371-
OR_INSTALLER_ARGS="-eqy"
438+
OR_INSTALLER_ARGS=""
372439
YOSYS_VER=""
373440
# default prefix
374441
PREFIX=""
@@ -405,6 +472,7 @@ while [ "$#" -gt 0 ]; do
405472
;;
406473
-local)
407474
OR_INSTALLER_ARGS="${OR_INSTALLER_ARGS} -local"
475+
PREFIX="${HOME}/.local"
408476
;;
409477
-ci)
410478
CI="yes"
@@ -529,6 +597,9 @@ case "${os}" in
529597
_installUbuntuPackages "${version}"
530598
_installUbuntuCleanUp
531599
fi
600+
if [[ "${option}" == "common" || "${option}" == "all" ]]; then
601+
_installCmake
602+
fi
532603
if [[ $version != "rodete" ]]; then
533604
if [[ "${option}" == "common" || "${option}" == "all" ]]; then
534605
if _versionCompare ${version} -lt 23.04 ; then

0 commit comments

Comments
 (0)