Skip to content

Commit 1592c42

Browse files
authored
Merge pull request The-OpenROAD-Project#3408 from kcaisley/fix-build-AlmaLinux9-Ubuntu24.04
Adding explicit install configuration for EL8 and EL9 systems
2 parents ffa73bc + b2b351c commit 1592c42

File tree

1 file changed

+100
-7
lines changed

1 file changed

+100
-7
lines changed

etc/DependencyInstaller.sh

Lines changed: 100 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,14 @@ _installCommon() {
6363
fi
6464
}
6565

66-
_installCentosCleanUp() {
66+
# Enterprise Linux 7 cleanup
67+
_install_EL7_CleanUp() {
6768
yum clean -y all
6869
rm -rf /var/lib/apt/lists/*
6970
}
7071

71-
_installCentosPackages() {
72+
# Enterprise Linux 7 package installation (EL7 = RHEL 7 or CentOS 7)
73+
_install_EL7_Packages() {
7274
yum -y update
7375
yum -y install \
7476
time \
@@ -89,6 +91,67 @@ _installCentosPackages() {
8991
fi
9092
}
9193

94+
95+
# Enterprise Linux 8/9 cleanup
96+
_install_EL8_EL9_CleanUp() {
97+
dnf clean -y all
98+
rm -rf /var/lib/apt/lists/*
99+
}
100+
101+
# Enterprise Linux 8/9 package installation (EL8/EL9 = RHEL, Rocky Linux, AlmaLinux, or CentOS 8 as no CentOS 9 exists)
102+
_install_EL8_EL9_Packages() {
103+
# Re-detect EL version for appropriate KLayout package
104+
if [[ -f /etc/os-release ]]; then
105+
elVersion=$(awk -F= '/^VERSION_ID/{print $2}' /etc/os-release | sed 's/"//g' | cut -d. -f1)
106+
else
107+
echo "ERROR: Could not detect Enterprise Linux version"
108+
exit 1
109+
fi
110+
111+
# EL8 and EL9 use `dnf`, instead of `yum`
112+
dnf -y update
113+
dnf -y install \
114+
time \
115+
ruby \
116+
ruby-devel
117+
118+
# Install KLayout based on EL version, note the different URLs
119+
case "${elVersion}" in
120+
"8")
121+
if ! [ -x "$(command -v klayout)" ]; then
122+
dnf -y install https://www.klayout.org/downloads/CentOS_8/klayout-${klayoutVersion}-0.x86_64.rpm
123+
else
124+
currentVersion=$(klayout -v | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+')
125+
if _versionCompare "$currentVersion" -ge $klayoutVersion; then
126+
echo "KLayout version greater than or equal to ${klayoutVersion}"
127+
else
128+
echo "KLayout version less than ${klayoutVersion}"
129+
sudo dnf remove -y klayout
130+
dnf -y install https://www.klayout.org/downloads/CentOS_8/klayout-${klayoutVersion}-0.x86_64.rpm
131+
fi
132+
fi
133+
;;
134+
"9")
135+
if ! [ -x "$(command -v klayout)" ]; then
136+
dnf -y install https://www.klayout.org/downloads/RockyLinux_9/klayout-${klayoutVersion}-0.x86_64.rpm
137+
else
138+
currentVersion=$(klayout -v | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+')
139+
if _versionCompare "$currentVersion" -ge $klayoutVersion; then
140+
echo "KLayout version greater than or equal to ${klayoutVersion}"
141+
else
142+
echo "KLayout version less than ${klayoutVersion}"
143+
sudo dnf remove -y klayout
144+
dnf -y install https://www.klayout.org/downloads/RockyLinux_9/klayout-${klayoutVersion}-0.x86_64.rpm
145+
fi
146+
fi
147+
;;
148+
*)
149+
echo "ERROR: Unsupported Enterprise Linux version: ${elVersion}"
150+
exit 1
151+
;;
152+
esac
153+
}
154+
92155
_installUbuntuCleanUp() {
93156
apt-get autoclean -y
94157
apt-get autoremove -y
@@ -365,15 +428,45 @@ case "${platform}" in
365428
esac
366429

367430
case "${os}" in
368-
"CentOS Linux" )
431+
"CentOS Linux" | "Red Hat Enterprise Linux"* | "AlmaLinux" | "Rocky Linux")
432+
# Enterprise Linux support - dispatch based on specific version
369433
if [[ ${CI} == "yes" ]]; then
370434
echo "WARNING: Installing CI dependencies is only supported on Ubuntu 22.04" >&2
371435
fi
372-
_installORDependencies
373-
if [[ "${option}" == "base" || "${option}" == "all" ]]; then
374-
_installCentosPackages
375-
_installCentosCleanUp
436+
437+
# Detect EL version to choose appropriate functions
438+
if [[ -f /etc/os-release ]]; then
439+
elVersion=$(awk -F= '/^VERSION_ID/{print $2}' /etc/os-release | sed 's/"//g' | cut -d. -f1)
440+
else
441+
echo "ERROR: Could not detect Enterprise Linux version" >&2
442+
exit 1
376443
fi
444+
445+
# First install OpenROAD base
446+
_installORDependencies
447+
448+
# Determine between EL7 vs EL8/9, since yum vs dnf should be used, and different Klayout builds exist
449+
case "${elVersion}" in
450+
"7")
451+
# EL7 = RHEL 7 or CentOS 7
452+
if [[ "${option}" == "base" || "${option}" == "all" ]]; then
453+
_install_EL7_Packages
454+
_install_EL7_CleanUp
455+
fi
456+
;;
457+
"8"|"9")
458+
# EL8/EL9 = RHEL, Rocky Linux, AlmaLinux, or CentOS 8+
459+
if [[ "${option}" == "base" || "${option}" == "all" ]]; then
460+
_install_EL8_EL9_Packages
461+
_install_EL8_EL9_CleanUp
462+
fi
463+
;;
464+
*)
465+
echo "ERROR: Unsupported Enterprise Linux version: ${elVersion}" >&2
466+
exit 1
467+
;;
468+
esac
469+
377470
if [[ "${option}" == "common" || "${option}" == "all" ]]; then
378471
_installCommon
379472
fi

0 commit comments

Comments
 (0)