From 7090b3d9222e6f5841f3636ad28c2e23f92c3e14 Mon Sep 17 00:00:00 2001 From: Vitor Bandeira Date: Thu, 21 Nov 2024 12:29:16 +0000 Subject: [PATCH] etc: add support for rhel9 and ubuntu24 Signed-off-by: Vitor Bandeira --- etc/DependencyInstaller.sh | 148 +++++++++---------------------------- etc/DockerHelper.sh | 23 +++--- 2 files changed, 50 insertions(+), 121 deletions(-) diff --git a/etc/DependencyInstaller.sh b/etc/DependencyInstaller.sh index 7d0d3ac1f01..202de11fdec 100755 --- a/etc/DependencyInstaller.sh +++ b/etc/DependencyInstaller.sh @@ -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 @@ -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 @@ -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 @@ -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}" @@ -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 @@ -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 \ @@ -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 \ @@ -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 \ @@ -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() { @@ -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 } @@ -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 <&2 fi @@ -927,7 +851,7 @@ EOF fi if [[ "${option}" == "common" || "${option}" == "all" ]]; then _installCommonDev - _installOrTools "centos" "8" "amd64" + _installOrTools "rockylinux" "9" "amd64" fi ;; "Darwin" ) diff --git a/etc/DockerHelper.sh b/etc/DockerHelper.sh index a726c547668..44d1216b488 100755 --- a/etc/DockerHelper.sh +++ b/etc/DockerHelper.sh @@ -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 @@ -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 @@ -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 @@ -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 \ @@ -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