Skip to content

Commit 7090b3d

Browse files
author
Vitor Bandeira
committed
etc: add support for rhel9 and ubuntu24
Signed-off-by: Vitor Bandeira <vvbandeira@precisioninno.com>
1 parent 064cfbc commit 7090b3d

File tree

2 files changed

+50
-121
lines changed

2 files changed

+50
-121
lines changed

etc/DependencyInstaller.sh

Lines changed: 36 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ _equivalenceDeps() {
1616
# yosys
1717
yosysPrefix=${PREFIX:-"/usr/local"}
1818
if [[ ! $(command -v yosys) || ! $(command -v yosys-config) ]]; then (
19-
if [[ -f /opt/rh/llvm-toolset-7.0/enable ]]; then
20-
source /opt/rh/llvm-toolset-7.0/enable
21-
fi
2219
cd "${baseDir}"
2320
git clone --depth=1 -b "${yosysVersion}" --recursive https://github.com/YosysHQ/yosys
2421
cd yosys
@@ -31,9 +28,6 @@ _equivalenceDeps() {
3128
# eqy
3229
eqyPrefix=${PREFIX:-"/usr/local"}
3330
if ! command -v eqy &> /dev/null; then (
34-
if [[ -f /opt/rh/llvm-toolset-7.0/enable ]]; then
35-
source /opt/rh/llvm-toolset-7.0/enable
36-
fi
3731
cd "${baseDir}"
3832
git clone --depth=1 -b "${yosysVersion}" https://github.com/YosysHQ/eqy
3933
cd eqy
@@ -46,9 +40,6 @@ _equivalenceDeps() {
4640
# sby
4741
sbyPrefix=${PREFIX:-"/usr/local"}
4842
if ! command -v sby &> /dev/null; then (
49-
if [[ -f /opt/rh/llvm-toolset-7.0/enable ]]; then
50-
source /opt/rh/llvm-toolset-7.0/enable
51-
fi
5243
cd "${baseDir}"
5344
git clone --depth=1 -b "${yosysVersion}" --recursive https://github.com/YosysHQ/sby
5445
cd sby
@@ -264,8 +255,8 @@ _installOrTools() {
264255
os=$1
265256
version=$2
266257
arch=$3
267-
orToolsVersionBig=9.10
268-
orToolsVersionSmall=${orToolsVersionBig}.4067
258+
orToolsVersionBig=9.11
259+
orToolsVersionSmall=${orToolsVersionBig}.4210
269260

270261
rm -rf "${baseDir}"
271262
mkdir -p "${baseDir}"
@@ -274,7 +265,7 @@ _installOrTools() {
274265

275266
# Disable exit on error for 'find' command, as it might return non zero
276267
set +euo pipefail
277-
LIST=($(find / -type f -name "libortools.so*" 2>/dev/null))
268+
LIST=($(find /local* /opt* /lib* /usr* /bin* -type f -name "libortools.so*" 2>/dev/null))
278269
# Bring back exit on error
279270
set -euo pipefail
280271
# Return if right version of or-tools is installed
@@ -388,17 +379,12 @@ _installRHELCleanUp() {
388379

389380
_installRHELPackages() {
390381
arch=amd64
391-
version=3.1.11.1
382+
pandocVersion=3.1.11.1
392383

393384
yum -y update
394-
if [[ $(yum repolist | egrep -c "rhel-8-for-x86_64-appstream-rpms") -eq 0 ]]; then
395-
yum -y install http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/Packages/centos-gpg-keys-8-6.el8.noarch.rpm
396-
yum -y install http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/Packages/centos-stream-repos-8-6.el8.noarch.rpm
397-
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
398-
fi
399385
yum -y install tzdata
400386
yum -y install redhat-rpm-config rpm-build
401-
yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
387+
yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
402388
yum -y install \
403389
autoconf \
404390
automake \
@@ -409,11 +395,11 @@ _installRHELPackages() {
409395
gdb \
410396
git \
411397
glibc-devel \
412-
libtool \
413398
libffi-devel \
414-
llvm7.0 \
415-
llvm7.0-devel \
416-
llvm7.0-libs \
399+
libtool \
400+
llvm \
401+
llvm-devel \
402+
llvm-libs \
417403
make \
418404
pcre-devel \
419405
pcre2-devel \
@@ -424,10 +410,9 @@ _installRHELPackages() {
424410
python3-devel \
425411
python3-pip \
426412
qt5-qtbase-devel \
413+
qt5-qtcharts-devel \
427414
qt5-qtimageformats \
428415
readline \
429-
readline-devel \
430-
tcl-devel \
431416
tcl-tclreadline \
432417
tcl-tclreadline-devel \
433418
tcl-thread-devel \
@@ -436,65 +421,14 @@ _installRHELPackages() {
436421
zlib-devel
437422

438423
yum install -y \
439-
http://repo.okay.com.mx/centos/8/x86_64/release/bison-3.0.4-10.el8.x86_64.rpm \
440-
https://forensics.cert.org/centos/cert/7/x86_64/flex-2.6.1-9.el7.x86_64.rpm
441-
442-
eval wget https://github.com/jgm/pandoc/releases/download/${version}/pandoc-${version}-linux-${arch}.tar.gz
443-
tar xvzf pandoc-${version}-linux-${arch}.tar.gz --strip-components 1 -C /usr/local/
444-
rm -rf pandoc-${version}-linux-${arch}.tar.gz
445-
}
446-
447-
_installCentosCleanUp() {
448-
yum clean -y all
449-
rm -rf /var/lib/apt/lists/*
450-
}
451-
452-
_installCentosPackages() {
453-
yum update -y
454-
yum install -y tzdata
455-
yum groupinstall -y "Development Tools"
456-
if ! command -v lcov &> /dev/null; then
457-
yum install -y http://downloads.sourceforge.net/ltp/lcov-1.14-1.noarch.rpm
458-
fi
459-
if ! command -v yum list installed ius-release &> /dev/null; then
460-
yum install -y https://repo.ius.io/ius-release-el7.rpm
461-
fi
462-
if ! command -v yum list installed epel-release &> /dev/null; then
463-
yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
464-
fi
465-
yum install -y centos-release-scl
466-
yum install -y \
467-
devtoolset-8 \
468-
devtoolset-8-libatomic-devel \
469-
groff \
470-
libffi-devel \
471-
libgomp \
472-
libstdc++ \
473-
llvm-toolset-7.0 \
474-
llvm-toolset-7.0-libomp-devel \
475-
pandoc \
476-
pcre-devel \
477-
pcre2-devel \
478-
python-devel \
479-
python36 \
480-
python36-devel \
481-
python36-libs \
482-
python36-pip \
483-
qt5-qtbase-devel \
484-
qt5-qtimageformats \
485-
readline-devel \
486-
rh-python38-python \
487-
rh-python38-python-libs \
488-
rh-python38-python-pip \
489-
rh-python38-scldevel \
490-
tcl \
491-
tcl-devel \
492-
tcl-tclreadline \
493-
tcl-tclreadline-devel \
494-
tcllib \
495-
wget \
496-
ccache \
497-
zlib-devel
424+
https://mirror.stream.centos.org/9-stream/AppStream/x86_64/os/Packages/bison-3.7.4-5.el9.x86_64.rpm \
425+
https://mirror.stream.centos.org/9-stream/AppStream/x86_64/os/Packages/flex-2.6.4-9.el9.x86_64.rpm \
426+
https://mirror.stream.centos.org/9-stream/AppStream/x86_64/os/Packages/readline-devel-8.1-4.el9.x86_64.rpm \
427+
https://rpmfind.net/linux/centos-stream/9-stream/AppStream/x86_64/os/Packages/tcl-devel-8.6.10-7.el9.x86_64.rpm
428+
429+
eval wget https://github.com/jgm/pandoc/releases/download/${pandocVersion}/pandoc-${pandocVersion}-linux-${arch}.tar.gz
430+
tar xvzf pandoc-${pandocVersion}-linux-${arch}.tar.gz --strip-components 1 -C /usr/local/
431+
rm -rf pandoc-${pandocVersion}-linux-${arch}.tar.gz
498432
}
499433

500434
_installOpenSuseCleanUp() {
@@ -699,10 +633,12 @@ _installCI() {
699633
containerd.io \
700634
docker-buildx-plugin
701635

702-
# Install clang for C++20 support
703-
wget https://apt.llvm.org/llvm.sh
704-
chmod +x llvm.sh
705-
./llvm.sh 16 all
636+
if _versionCompare ${version} -lt 24.04; then
637+
# Install clang for C++20 support
638+
wget https://apt.llvm.org/llvm.sh
639+
chmod +x llvm.sh
640+
./llvm.sh 16 all
641+
fi
706642

707643
}
708644

@@ -873,31 +809,10 @@ case "${platform}" in
873809
esac
874810

875811
case "${os}" in
876-
"CentOS Linux" )
877-
if [[ ${CI} == "yes" ]]; then
878-
echo "WARNING: Installing CI dependencies is only supported on Ubuntu 22.04" >&2
879-
fi
880-
if [[ "${option}" == "base" || "${option}" == "all" ]]; then
881-
_checkIsLocal
882-
_installCentosPackages
883-
_installCentosCleanUp
884-
fi
885-
if [[ "${option}" == "common" || "${option}" == "all" ]]; then
886-
_installCommonDev
887-
_installOrTools "centos" "7" "amd64"
888-
fi
889-
cat <<EOF
890-
To enable Python 3.8 (required for eqy) you need to run:
891-
source /opt/rh/rh-python38/enable
892-
To enable GCC-8 or Clang-7 you need to run:
893-
source /opt/rh/devtoolset-8/enable
894-
source /opt/rh/llvm-toolset-7.0/enable
895-
EOF
896-
;;
897812
"Ubuntu" )
898813
version=$(awk -F= '/^VERSION_ID/{print $2}' /etc/os-release | sed 's/"//g')
899814
if [[ ${CI} == "yes" ]]; then
900-
_installCI
815+
_installCI "${version}"
901816
fi
902817
if [[ "${option}" == "base" || "${option}" == "all" ]]; then
903818
_checkIsLocal
@@ -916,7 +831,16 @@ EOF
916831
_installOrTools "ubuntu" "${version}" "amd64"
917832
fi
918833
;;
919-
"Red Hat Enterprise Linux")
834+
"Red Hat Enterprise Linux" | "Rocky Linux")
835+
if [[ "${os}" == "Red Hat Enterprise Linux" ]]; then
836+
rhelVersion=$(rpm -q --queryformat '%{VERSION}' redhat-release | cut -d. -f1)
837+
elif [[ "${os}" == "Rocky Linux" ]]; then
838+
rhelVersion=$(rpm -q --queryformat '%{VERSION}' rocky-release | cut -d. -f1)
839+
fi
840+
if [[ "${rhelVersion}" != "9" ]]; then
841+
echo "ERROR: Unsupported RHEL ${rhelVersion} version. Only '9' is supported."
842+
exit 1
843+
fi
920844
if [[ ${CI} == "yes" ]]; then
921845
echo "WARNING: Installing CI dependencies is only supported on Ubuntu 22.04" >&2
922846
fi
@@ -927,7 +851,7 @@ EOF
927851
fi
928852
if [[ "${option}" == "common" || "${option}" == "all" ]]; then
929853
_installCommonDev
930-
_installOrTools "centos" "8" "amd64"
854+
_installOrTools "rockylinux" "9" "amd64"
931855
fi
932856
;;
933857
"Darwin" )

etc/DockerHelper.sh

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,17 @@ _setup() {
5858
"ubuntu22.04")
5959
osBaseImage="ubuntu:22.04"
6060
;;
61+
"ubuntu24.04")
62+
osBaseImage="ubuntu:24.04"
63+
;;
6164
"opensuse")
6265
osBaseImage="opensuse/leap"
6366
;;
6467
"debian11")
6568
osBaseImage="debian:bullseye"
6669
;;
67-
"rhel")
68-
osBaseImage="redhat/ubi8"
70+
"rhel9")
71+
osBaseImage="redhat/ubi9"
6972
;;
7073
*)
7174
echo "Target OS ${os} not supported" >&2
@@ -91,7 +94,7 @@ _setup() {
9194
imageName="${IMAGE_NAME_OVERRIDE:-"${imageName}-${compiler}"}"
9295
;;
9396
"dev" )
94-
fromImage="${FROM_IMAGE_OVERRIDE:-$osBaseImage}"
97+
fromImage="${FROM_IMAGE_OVERRIDE:-${osBaseImage}}"
9598
context="etc"
9699
buildArgs="-save-deps-prefixes=${depsPrefixesFile}"
97100
if [[ "${isLocal}" == "yes" ]]; then
@@ -100,7 +103,7 @@ _setup() {
100103
if [[ "${equivalenceDeps}" == "yes" ]]; then
101104
buildArgs="${buildArgs} -eqy"
102105
fi
103-
if [[ "$CI" == "yes" ]]; then
106+
if [[ "${CI}" == "yes" ]]; then
104107
buildArgs="${buildArgs} -ci"
105108
fi
106109
if [[ "${buildArgs}" != "" ]]; then
@@ -181,12 +184,14 @@ _checkFromImage() {
181184
fi
182185
fi
183186
set -e
184-
exit 42
185187
}
186188

187189
_create() {
188-
if [[ "${target}" != "dev" ]]; then
189-
_checkFromImage
190+
if [[ "${target}" == "binary" ]]; then
191+
_checkFromImage "builder"
192+
fi
193+
if [[ "${target}" == "builder" ]]; then
194+
_checkFromImage "dev"
190195
fi
191196
echo "Create docker image ${imagePath} using ${file}"
192197
eval docker buildx build \
@@ -308,9 +313,9 @@ while [ "$#" -gt 0 ]; do
308313
done
309314

310315
if [[ "${numThreads}" == "-1" ]]; then
311-
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
316+
if [[ "${OSTYPE}" == "linux-gnu"* ]]; then
312317
numThreads=$(nproc --all)
313-
elif [[ "$OSTYPE" == "darwin"* ]]; then
318+
elif [[ "${OSTYPE}" == "darwin"* ]]; then
314319
numThreads=$(sysctl -n hw.ncpu)
315320
else
316321
numThreads=2

0 commit comments

Comments
 (0)