From 6fe60dea3cd11830400f4f840797289c5d8ae7c0 Mon Sep 17 00:00:00 2001 From: Thiago Silva Date: Wed, 17 May 2023 17:03:54 -0300 Subject: [PATCH] Update to use RockyLinux 8 as RHEL 8 compatible base Also applies changes to build C++20 (Starting on V25.0) --- .github/workflows/live_artifacts.yml | 4 +-- ci/build-rhel.sh | 9 ++++-- docker/ci/Dockerfile-rhel | 12 ++++---- nanocurrency.spec.in | 14 ++++------ util/build_prep/rhel/prep.sh.in | 42 +++------------------------- 5 files changed, 24 insertions(+), 57 deletions(-) diff --git a/.github/workflows/live_artifacts.yml b/.github/workflows/live_artifacts.yml index 765b97a6..d5fa7df5 100644 --- a/.github/workflows/live_artifacts.yml +++ b/.github/workflows/live_artifacts.yml @@ -65,7 +65,7 @@ jobs: AWS_DEFAULT_REGION: us-east-2 linux_rpm_job: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 timeout-minutes: 90 steps: - name: Sets the tag and repo variables (to build) @@ -77,7 +77,7 @@ jobs: submodules: "recursive" ref: ${{ github.ref }} repository: ${{ github.repository }} - - name: CentOS Base + - name: RockyLinux 8 Base run: ci/build-docker-image.sh docker/ci/Dockerfile-rhel nanocurrency/nano-env:rhel - name: Build Artifact run: | diff --git a/ci/build-rhel.sh b/ci/build-rhel.sh index bfd3f707..67265675 100755 --- a/ci/build-rhel.sh +++ b/ci/build-rhel.sh @@ -12,9 +12,12 @@ run_build() { mkdir -p ~/rpmbuild/SOURCES/ mv -f ~/nano-${VERSION}.tar.gz ~/rpmbuild/SOURCES/. if [ "${LIVE:-}" == "1" ]; then - scl enable devtoolset-7 'rpmbuild -ba nanocurrency.spec' - else - scl enable devtoolset-7 'rpmbuild -ba nanocurrency-beta.spec' + scl enable gcc-toolset-12 'rpmbuild --nodebuginfo -ba nanocurrency.spec' + elif [ "${BETA:-}" == "1" ]; then + scl enable gcc-toolset-12 'rpmbuild -ba nanocurrency-beta.spec' + else + echo "Error: the node network was not defined." + exit 1 fi } diff --git a/docker/ci/Dockerfile-rhel b/docker/ci/Dockerfile-rhel index e68f4faa..5eb6c733 100644 --- a/docker/ci/Dockerfile-rhel +++ b/docker/ci/Dockerfile-rhel @@ -1,8 +1,10 @@ -FROM centos:7 +FROM rockylinux:8 WORKDIR /workspace -ADD util /build -RUN bash /build/build_prep/update-common -RUN bash /build/build_prep/rhel/prep.sh -RUN rm -rf /build +RUN yum update -y +RUN yum install -y git wget openssl bzip2 +RUN yum install -y rpm-build +RUN yum install -y glibc-devel glibc-headers make which +RUN yum install -y cmake gcc-toolset-12 +RUN yum install -y python38 diff --git a/nanocurrency.spec.in b/nanocurrency.spec.in index 2850de29..5a9fcb7e 100644 --- a/nanocurrency.spec.in +++ b/nanocurrency.spec.in @@ -6,7 +6,7 @@ License: BSD-2-Clause URL: https://nano.org/ Requires(pre): /usr/sbin/useradd, /usr/bin/getent Requires(postun): /usr/sbin/userdel -BuildRequires: make, libstdc++-static, glibc-devel, glibc-headers +BuildRequires: make, glibc-devel, glibc-headers Source: nano-%{version}.tar.gz %description @@ -17,22 +17,18 @@ the nano daemon, and a service. %prep if [ ! -x "$(which cmake)" ]; then echo "cmake must exist, try:" >&2 - echo " scl enable devtoolset-7 'rpmbuild ...'" >&2 + echo " scl enable gcc-toolset-12 'rpmbuild ...'" >&2 exit 1 fi -if cc --std=c++14 --version 2>&1 >/dev/null | grep '^' >/dev/null; then +if cc --std=c++20 --version 2>&1 >/dev/null | grep '^' >/dev/null; then echo "Unsupported C++ compiler, try:" >&2 - echo " scl enable devtoolset-7 'rpmbuild ...'" >&2 - exit 1 -fi -if test ! -d /usr/local/boost; then - echo "Boost should be in /usr/local/boost" >&2 + echo " scl enable gcc-toolset-12 'rpmbuild ...'" >&2 exit 1 fi %autosetup -n nano-%{version} %build -cmake -DCMAKE_VERBOSE_MAKEFILE=ON -DBOOST_ROOT=/usr/local/boost . +cmake -DCMAKE_VERBOSE_MAKEFILE=ON . make nano_node %{?_smp_mflags} make nano_rpc %{?_smp_mflags} diff --git a/util/build_prep/rhel/prep.sh.in b/util/build_prep/rhel/prep.sh.in index 8835fa2c..ffdda4d5 100644 --- a/util/build_prep/rhel/prep.sh.in +++ b/util/build_prep/rhel/prep.sh.in @@ -4,44 +4,10 @@ # -----END COMMON.SH----- yes | yum update -y - -yes | yum install -y git wget openssl bzip2 # - -yes | yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm # epel 7 -yes | yum install -y jq || exit 1 - +yes | yum install -y git wget openssl bzip2 yes | yum install -y rpm-build || exit 1 -yes | yum install -y glibc-devel glibc-headers make which libstdc++-static || exit 1 -yes | yum install -y centos-release-scl || exit 1 -yes | yum install -y devtoolset-7-gcc-c++ || exit 1 -yes | yum install -y rh-python38 || exit 1 - - -wget -O cmake_install.sh https://github.com/Kitware/CMake/releases/download/v3.15.4/cmake-3.15.4-Linux-x86_64.sh -chmod +x cmake_install.sh -./cmake_install.sh --prefix=/usr --exclude-subdir --skip-license - -rm -f ./cmake_install.sh - -# Ensure we have a new enough Boost -( - eval "$(scl enable devtoolset-7 "bash -c 'set | grep ^PATH='")" - if ! have boost; then - bootstrap_boost -m -s -j`nproc` - fi - - if ! have boost; then - echo "Unable to install boost" >&2 - - exit 1 - fi - - if ! version_min 'boost --version' 1.69.999; then - echo "boost version too low (1.70.0+ required)" >&2 - exit 1 - fi - - exit 0 -) || exit 1 +yes | yum install -y glibc-devel glibc-headers make which || exit 1 +yes | yum install -y cmake gcc-toolset-12 || exit 1 +yes | yum install -y python38 || exit 1 exit 0