Skip to content

Commit

Permalink
etc: add support for rhel9 and ubuntu24
Browse files Browse the repository at this point in the history
Signed-off-by: Vitor Bandeira <[email protected]>
  • Loading branch information
Vitor Bandeira committed Nov 21, 2024
1 parent 064cfbc commit 7090b3d
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 121 deletions.
148 changes: 36 additions & 112 deletions etc/DependencyInstaller.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ _equivalenceDeps() {
# yosys
yosysPrefix=${PREFIX:-"/usr/local"}
if [[ ! $(command -v yosys) || ! $(command -v yosys-config) ]]; then (
if [[ -f /opt/rh/llvm-toolset-7.0/enable ]]; then
source /opt/rh/llvm-toolset-7.0/enable
fi
cd "${baseDir}"
git clone --depth=1 -b "${yosysVersion}" --recursive https://github.com/YosysHQ/yosys
cd yosys
Expand All @@ -31,9 +28,6 @@ _equivalenceDeps() {
# eqy
eqyPrefix=${PREFIX:-"/usr/local"}
if ! command -v eqy &> /dev/null; then (
if [[ -f /opt/rh/llvm-toolset-7.0/enable ]]; then
source /opt/rh/llvm-toolset-7.0/enable
fi
cd "${baseDir}"
git clone --depth=1 -b "${yosysVersion}" https://github.com/YosysHQ/eqy
cd eqy
Expand All @@ -46,9 +40,6 @@ _equivalenceDeps() {
# sby
sbyPrefix=${PREFIX:-"/usr/local"}
if ! command -v sby &> /dev/null; then (
if [[ -f /opt/rh/llvm-toolset-7.0/enable ]]; then
source /opt/rh/llvm-toolset-7.0/enable
fi
cd "${baseDir}"
git clone --depth=1 -b "${yosysVersion}" --recursive https://github.com/YosysHQ/sby
cd sby
Expand Down Expand Up @@ -264,8 +255,8 @@ _installOrTools() {
os=$1
version=$2
arch=$3
orToolsVersionBig=9.10
orToolsVersionSmall=${orToolsVersionBig}.4067
orToolsVersionBig=9.11
orToolsVersionSmall=${orToolsVersionBig}.4210

rm -rf "${baseDir}"
mkdir -p "${baseDir}"
Expand All @@ -274,7 +265,7 @@ _installOrTools() {

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

_installRHELPackages() {
arch=amd64
version=3.1.11.1
pandocVersion=3.1.11.1

yum -y update
if [[ $(yum repolist | egrep -c "rhel-8-for-x86_64-appstream-rpms") -eq 0 ]]; then
yum -y install http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/Packages/centos-gpg-keys-8-6.el8.noarch.rpm
yum -y install http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/Packages/centos-stream-repos-8-6.el8.noarch.rpm
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
fi
yum -y install tzdata
yum -y install redhat-rpm-config rpm-build
yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
yum -y install \
autoconf \
automake \
Expand All @@ -409,11 +395,11 @@ _installRHELPackages() {
gdb \
git \
glibc-devel \
libtool \
libffi-devel \
llvm7.0 \
llvm7.0-devel \
llvm7.0-libs \
libtool \
llvm \
llvm-devel \
llvm-libs \
make \
pcre-devel \
pcre2-devel \
Expand All @@ -424,10 +410,9 @@ _installRHELPackages() {
python3-devel \
python3-pip \
qt5-qtbase-devel \
qt5-qtcharts-devel \
qt5-qtimageformats \
readline \
readline-devel \
tcl-devel \
tcl-tclreadline \
tcl-tclreadline-devel \
tcl-thread-devel \
Expand All @@ -436,65 +421,14 @@ _installRHELPackages() {
zlib-devel

yum install -y \
http://repo.okay.com.mx/centos/8/x86_64/release/bison-3.0.4-10.el8.x86_64.rpm \
https://forensics.cert.org/centos/cert/7/x86_64/flex-2.6.1-9.el7.x86_64.rpm

eval wget https://github.com/jgm/pandoc/releases/download/${version}/pandoc-${version}-linux-${arch}.tar.gz
tar xvzf pandoc-${version}-linux-${arch}.tar.gz --strip-components 1 -C /usr/local/
rm -rf pandoc-${version}-linux-${arch}.tar.gz
}

_installCentosCleanUp() {
yum clean -y all
rm -rf /var/lib/apt/lists/*
}

_installCentosPackages() {
yum update -y
yum install -y tzdata
yum groupinstall -y "Development Tools"
if ! command -v lcov &> /dev/null; then
yum install -y http://downloads.sourceforge.net/ltp/lcov-1.14-1.noarch.rpm
fi
if ! command -v yum list installed ius-release &> /dev/null; then
yum install -y https://repo.ius.io/ius-release-el7.rpm
fi
if ! command -v yum list installed epel-release &> /dev/null; then
yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
fi
yum install -y centos-release-scl
yum install -y \
devtoolset-8 \
devtoolset-8-libatomic-devel \
groff \
libffi-devel \
libgomp \
libstdc++ \
llvm-toolset-7.0 \
llvm-toolset-7.0-libomp-devel \
pandoc \
pcre-devel \
pcre2-devel \
python-devel \
python36 \
python36-devel \
python36-libs \
python36-pip \
qt5-qtbase-devel \
qt5-qtimageformats \
readline-devel \
rh-python38-python \
rh-python38-python-libs \
rh-python38-python-pip \
rh-python38-scldevel \
tcl \
tcl-devel \
tcl-tclreadline \
tcl-tclreadline-devel \
tcllib \
wget \
ccache \
zlib-devel
https://mirror.stream.centos.org/9-stream/AppStream/x86_64/os/Packages/bison-3.7.4-5.el9.x86_64.rpm \
https://mirror.stream.centos.org/9-stream/AppStream/x86_64/os/Packages/flex-2.6.4-9.el9.x86_64.rpm \
https://mirror.stream.centos.org/9-stream/AppStream/x86_64/os/Packages/readline-devel-8.1-4.el9.x86_64.rpm \
https://rpmfind.net/linux/centos-stream/9-stream/AppStream/x86_64/os/Packages/tcl-devel-8.6.10-7.el9.x86_64.rpm

eval wget https://github.com/jgm/pandoc/releases/download/${pandocVersion}/pandoc-${pandocVersion}-linux-${arch}.tar.gz
tar xvzf pandoc-${pandocVersion}-linux-${arch}.tar.gz --strip-components 1 -C /usr/local/
rm -rf pandoc-${pandocVersion}-linux-${arch}.tar.gz
}

_installOpenSuseCleanUp() {
Expand Down Expand Up @@ -699,10 +633,12 @@ _installCI() {
containerd.io \
docker-buildx-plugin

# Install clang for C++20 support
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
./llvm.sh 16 all
if _versionCompare ${version} -lt 24.04; then
# Install clang for C++20 support
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
./llvm.sh 16 all
fi

}

Expand Down Expand Up @@ -873,31 +809,10 @@ case "${platform}" in
esac

case "${os}" in
"CentOS Linux" )
if [[ ${CI} == "yes" ]]; then
echo "WARNING: Installing CI dependencies is only supported on Ubuntu 22.04" >&2
fi
if [[ "${option}" == "base" || "${option}" == "all" ]]; then
_checkIsLocal
_installCentosPackages
_installCentosCleanUp
fi
if [[ "${option}" == "common" || "${option}" == "all" ]]; then
_installCommonDev
_installOrTools "centos" "7" "amd64"
fi
cat <<EOF
To enable Python 3.8 (required for eqy) you need to run:
source /opt/rh/rh-python38/enable
To enable GCC-8 or Clang-7 you need to run:
source /opt/rh/devtoolset-8/enable
source /opt/rh/llvm-toolset-7.0/enable
EOF
;;
"Ubuntu" )
version=$(awk -F= '/^VERSION_ID/{print $2}' /etc/os-release | sed 's/"//g')
if [[ ${CI} == "yes" ]]; then
_installCI
_installCI "${version}"
fi
if [[ "${option}" == "base" || "${option}" == "all" ]]; then
_checkIsLocal
Expand All @@ -916,7 +831,16 @@ EOF
_installOrTools "ubuntu" "${version}" "amd64"
fi
;;
"Red Hat Enterprise Linux")
"Red Hat Enterprise Linux" | "Rocky Linux")
if [[ "${os}" == "Red Hat Enterprise Linux" ]]; then
rhelVersion=$(rpm -q --queryformat '%{VERSION}' redhat-release | cut -d. -f1)
elif [[ "${os}" == "Rocky Linux" ]]; then
rhelVersion=$(rpm -q --queryformat '%{VERSION}' rocky-release | cut -d. -f1)
fi
if [[ "${rhelVersion}" != "9" ]]; then
echo "ERROR: Unsupported RHEL ${rhelVersion} version. Only '9' is supported."
exit 1
fi
if [[ ${CI} == "yes" ]]; then
echo "WARNING: Installing CI dependencies is only supported on Ubuntu 22.04" >&2
fi
Expand All @@ -927,7 +851,7 @@ EOF
fi
if [[ "${option}" == "common" || "${option}" == "all" ]]; then
_installCommonDev
_installOrTools "centos" "8" "amd64"
_installOrTools "rockylinux" "9" "amd64"
fi
;;
"Darwin" )
Expand Down
23 changes: 14 additions & 9 deletions etc/DockerHelper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,17 @@ _setup() {
"ubuntu22.04")
osBaseImage="ubuntu:22.04"
;;
"ubuntu24.04")
osBaseImage="ubuntu:24.04"
;;
"opensuse")
osBaseImage="opensuse/leap"
;;
"debian11")
osBaseImage="debian:bullseye"
;;
"rhel")
osBaseImage="redhat/ubi8"
"rhel9")
osBaseImage="redhat/ubi9"
;;
*)
echo "Target OS ${os} not supported" >&2
Expand All @@ -91,7 +94,7 @@ _setup() {
imageName="${IMAGE_NAME_OVERRIDE:-"${imageName}-${compiler}"}"
;;
"dev" )
fromImage="${FROM_IMAGE_OVERRIDE:-$osBaseImage}"
fromImage="${FROM_IMAGE_OVERRIDE:-${osBaseImage}}"
context="etc"
buildArgs="-save-deps-prefixes=${depsPrefixesFile}"
if [[ "${isLocal}" == "yes" ]]; then
Expand All @@ -100,7 +103,7 @@ _setup() {
if [[ "${equivalenceDeps}" == "yes" ]]; then
buildArgs="${buildArgs} -eqy"
fi
if [[ "$CI" == "yes" ]]; then
if [[ "${CI}" == "yes" ]]; then
buildArgs="${buildArgs} -ci"
fi
if [[ "${buildArgs}" != "" ]]; then
Expand Down Expand Up @@ -181,12 +184,14 @@ _checkFromImage() {
fi
fi
set -e
exit 42
}

_create() {
if [[ "${target}" != "dev" ]]; then
_checkFromImage
if [[ "${target}" == "binary" ]]; then
_checkFromImage "builder"
fi
if [[ "${target}" == "builder" ]]; then
_checkFromImage "dev"
fi
echo "Create docker image ${imagePath} using ${file}"
eval docker buildx build \
Expand Down Expand Up @@ -308,9 +313,9 @@ while [ "$#" -gt 0 ]; do
done

if [[ "${numThreads}" == "-1" ]]; then
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
if [[ "${OSTYPE}" == "linux-gnu"* ]]; then
numThreads=$(nproc --all)
elif [[ "$OSTYPE" == "darwin"* ]]; then
elif [[ "${OSTYPE}" == "darwin"* ]]; then
numThreads=$(sysctl -n hw.ncpu)
else
numThreads=2
Expand Down

0 comments on commit 7090b3d

Please sign in to comment.