Skip to content

Commit 66004d8

Browse files
authored
Merge pull request The-OpenROAD-Project#7606 from vvbandeira/rhel
etc: add RHEL8 to DependencyInstaller
2 parents a245958 + 3107bc7 commit 66004d8

File tree

1 file changed

+44
-9
lines changed

1 file changed

+44
-9
lines changed

etc/DependencyInstaller.sh

Lines changed: 44 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
set -euo pipefail
44

55
CMAKE_PACKAGE_ROOT_ARGS=""
6+
rhelVersion=NONE
67

78
_versionCompare() {
89
local a b IFS=. ; set -f
@@ -76,6 +77,8 @@ _installCommonDev() {
7677
gtestChecksum="a1279c6fb5bf7d4a5e0d0b2a4adb39ac"
7778
bisonVersion=3.8.2
7879
bisonChecksum="1e541a097cda9eca675d29dd2832921f"
80+
flexVersion=2.6.4
81+
flexChecksum="2882e3179748cc9f9c23ec593d6adc8d"
7982

8083
rm -rf "${baseDir}"
8184
mkdir -p "${baseDir}"
@@ -116,6 +119,21 @@ _installCommonDev() {
116119
fi
117120
CMAKE_PACKAGE_ROOT_ARGS+=" -D bison_ROOT=$(realpath ${bisonPrefix}) "
118121

122+
# Flex
123+
flexPrefix=${PREFIX:-"/usr/local"}
124+
if [[ ${rhelVersion} == 9 ]] && [ ! -f ${flexPrefix}/bin/flex ]; then
125+
cd "${baseDir}"
126+
eval wget https://github.com/westes/flex/releases/download/v${flexVersion}/flex-${flexVersion}.tar.gz
127+
md5sum -c <(echo "${flexChecksum} flex-${flexVersion}.tar.gz") || exit 1
128+
tar xf flex-${flexVersion}.tar.gz
129+
cd flex-${flexVersion}
130+
./configure --prefix=${flexPrefix}
131+
make -j $(nproc)
132+
make -j $(nproc) install
133+
else
134+
echo "Flex already installed."
135+
fi
136+
119137
# SWIG
120138
swigPrefix=${PREFIX:-"/usr/local"}
121139
swigBin=${swigPrefix}/bin/swig
@@ -423,7 +441,7 @@ _installRHELPackages() {
423441
yum -y update
424442
yum -y install tzdata
425443
yum -y install redhat-rpm-config rpm-build
426-
yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
444+
yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-${rhelVersion}.noarch.rpm
427445
yum -y install \
428446
autoconf \
429447
automake \
@@ -452,17 +470,29 @@ _installRHELPackages() {
452470
qt5-qtcharts-devel \
453471
qt5-qtimageformats \
454472
readline \
473+
tcl-devel \
455474
tcl-tclreadline \
456475
tcl-tclreadline-devel \
457476
tcl-thread-devel \
458477
tcllib \
459478
wget \
460479
zlib-devel
461480

462-
yum install -y \
463-
https://mirror.stream.centos.org/9-stream/AppStream/x86_64/os/Packages/flex-2.6.4-9.el9.x86_64.rpm \
464-
https://mirror.stream.centos.org/9-stream/AppStream/x86_64/os/Packages/readline-devel-8.1-4.el9.x86_64.rpm \
465-
https://rpmfind.net/linux/centos-stream/9-stream/AppStream/x86_64/os/Packages/tcl-devel-8.6.10-7.el9.x86_64.rpm
481+
if [[ ${rhelVersion} == 8 ]]; then
482+
yum install -y \
483+
gcc-toolset-13 \
484+
python3.12 \
485+
python3.12-devel \
486+
python3.12-pip
487+
alternatives --set python $(command -v python3.12)
488+
alternatives --set python3 $(command -v python3.12)
489+
fi
490+
if [[ ${rhelVersion} == 9 ]]; then
491+
yum install -y \
492+
https://mirror.stream.centos.org/9-stream/AppStream/x86_64/os/Packages/flex-2.6.4-9.el9.x86_64.rpm \
493+
https://mirror.stream.centos.org/9-stream/AppStream/x86_64/os/Packages/readline-devel-8.1-4.el9.x86_64.rpm \
494+
https://rpmfind.net/linux/centos-stream/9-stream/AppStream/x86_64/os/Packages/tcl-devel-8.6.10-7.el9.x86_64.rpm
495+
fi
466496

467497
eval wget https://github.com/jgm/pandoc/releases/download/${pandocVersion}/pandoc-${pandocVersion}-linux-${arch}.tar.gz
468498
tar xvzf pandoc-${pandocVersion}-linux-${arch}.tar.gz --strip-components 1 -C /usr/local/
@@ -902,21 +932,26 @@ case "${os}" in
902932
elif [[ "${os}" == "Rocky Linux" ]]; then
903933
rhelVersion=$(rpm -q --queryformat '%{VERSION}' rocky-release | cut -d. -f1)
904934
fi
905-
if [[ "${rhelVersion}" != "9" ]]; then
906-
echo "ERROR: Unsupported ${rhelVersion} version. Only '9' is supported."
935+
if [[ "${rhelVersion}" != "8" ]] && [[ "${rhelVersion}" != "9" ]]; then
936+
echo "ERROR: Unsupported ${rhelVersion} version. Versions '8' and '9' are supported."
907937
exit 1
908938
fi
909939
if [[ ${CI} == "yes" ]]; then
910940
echo "WARNING: Installing CI dependencies is only supported on Ubuntu 22.04" >&2
911941
fi
912942
if [[ "${option}" == "base" || "${option}" == "all" ]]; then
913943
_checkIsLocal
914-
_installRHELPackages
944+
_installRHELPackages "${rhelVersion}"
915945
_installRHELCleanUp
916946
fi
917947
if [[ "${option}" == "common" || "${option}" == "all" ]]; then
918948
_installCommonDev
919-
_installOrTools "rockylinux" "9" "amd64"
949+
if [[ "${rhelVersion}" == "8" ]]; then
950+
_installOrTools "AlmaLinux" "8.10" "x86_64"
951+
fi
952+
if [[ "${rhelVersion}" == "9" ]]; then
953+
_installOrTools "rockylinux" "9" "amd64"
954+
fi
920955
fi
921956
;;
922957
"Darwin" )

0 commit comments

Comments
 (0)