This is an automated email from the ASF dual-hosted git repository.

lordgamez pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git

commit 6372d67abf0fdee041fc6402a120d6b05488d96b
Author: Martin Zink <martinz...@apache.org>
AuthorDate: Thu Jul 27 21:14:19 2023 +0200

    MINIFICPP-2175 Increase CMAKE requirements to 3.24
    
    Co-authored-by: Márton Szász <szasz...@gmail.com>
    Signed-off-by: Gabor Gyimesi <gamezb...@gmail.com>
    
    This closes #1624
---
 .github/workflows/ci.yml     |  2 +-
 CMakeLists.txt               |  2 +-
 README.md                    |  2 +-
 centos.sh                    |  8 +-------
 docker/Dockerfile            |  2 +-
 docker/centos/Dockerfile     |  2 +-
 docker/rockylinux/Dockerfile |  4 ++--
 linux.sh                     | 30 ++++++++++++++++++++++++++++++
 8 files changed, 38 insertions(+), 14 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 9eff11a07..5ba42fe6f 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -332,7 +332,7 @@ jobs:
           path: /tmp/bin
   docker_build:
     name: "Docker build for integration tests"
-    runs-on: ubuntu-20.04
+    runs-on: ubuntu-22.04
     timeout-minutes: 180
     steps:
       - id: checkout
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6600abd9c..17ea231da 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -17,7 +17,7 @@
 # under the License.
 #
 
-cmake_minimum_required(VERSION 3.17)
+cmake_minimum_required(VERSION 3.24)
 cmake_policy(SET CMP0096 NEW) # policy to preserve the leading zeros in 
PROJECT_VERSION_{MAJOR,MINOR,PATCH,TWEAK}
 cmake_policy(SET CMP0065 OLD) # default export policy, required for self-dlopen
 if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.24)
diff --git a/README.md b/README.md
index 1866219c2..060eacddf 100644
--- a/README.md
+++ b/README.md
@@ -116,7 +116,7 @@ Through JNI extensions you can run NiFi processors using 
NARs. The JNI extension
 ### To build
 
 #### Utilities
-* CMake 3.17 or greater
+* CMake 3.24 or greater
 * gcc 11 or greater
 * bison 3.0.x+ (3.2 has been shown to fail builds)
 * flex 2.6 or greater
diff --git a/centos.sh b/centos.sh
index 1649c775a..000a47800 100644
--- a/centos.sh
+++ b/centos.sh
@@ -57,13 +57,7 @@ install_libusb() {
 
 
 bootstrap_cmake(){
-    case "$OS_MAJOR" in
-        7)
-            install_pkgs epel-release
-            install_pkgs cmake3
-            ;;
-        *) install_pkgs cmake ;;
-    esac
+    install_cmake_from_binary
 }
 
 bootstrap_compiler() {
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 6de245ac7..e3ee1022e 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -16,7 +16,7 @@
 # under the License.
 #
 
-ARG BASE_IMAGE="alpine:3.16"
+ARG BASE_IMAGE="alpine:3.17"
 
 # Build image
 FROM ${BASE_IMAGE} AS build
diff --git a/docker/centos/Dockerfile b/docker/centos/Dockerfile
index 9ae84e426..19449ff62 100644
--- a/docker/centos/Dockerfile
+++ b/docker/centos/Dockerfile
@@ -69,5 +69,5 @@ RUN cd $MINIFI_BASE_DIR && \
     source /opt/rh/devtoolset-11/enable && \
     export PATH=/usr/lib64/ccache${PATH:+:${PATH}} && \
     export CCACHE_DIR=${MINIFI_BASE_DIR}/.ccache && \
-    cmake3 -DSTATIC_BUILD= -DSKIP_TESTS=${DOCKER_SKIP_TESTS} ${MINIFI_OPTIONS} 
-DAWS_ENABLE_UNITY_BUILD=OFF -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" .. && \
+    cmake -DSTATIC_BUILD= -DSKIP_TESTS=${DOCKER_SKIP_TESTS} ${MINIFI_OPTIONS} 
-DAWS_ENABLE_UNITY_BUILD=OFF -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" .. && \
     make -j "$(nproc)" ${DOCKER_MAKE_TARGET}
diff --git a/docker/rockylinux/Dockerfile b/docker/rockylinux/Dockerfile
index d90112e8f..fe02f5ce8 100644
--- a/docker/rockylinux/Dockerfile
+++ b/docker/rockylinux/Dockerfile
@@ -40,7 +40,7 @@ COPY . ${MINIFI_BASE_DIR}
 
 # Install the system dependencies needed for a build
 # gpsd-devel and ccache are in EPEL
-RUN dnf -y install epel-release && dnf -y install sudo git which make 
libarchive ccache ca-certificates cmake perl && \
+RUN dnf -y install epel-release && dnf -y install sudo git which make 
libarchive ccache ca-certificates perl && \
     if echo "$MINIFI_OPTIONS" | grep -q "ENABLE_GPS=ON"; then dnf -y install 
gpsd-devel; fi && \
     if echo "$MINIFI_OPTIONS" | grep -q "ENABLE_JNI=ON"; then dnf -y install 
java-1.8.0-openjdk maven; fi && \
     if echo "$MINIFI_OPTIONS" | grep -q "ENABLE_PCAP=ON"; then dnf -y install 
libpcap-devel; fi && \
@@ -66,5 +66,5 @@ RUN cd $MINIFI_BASE_DIR && \
     source /opt/rh/gcc-toolset-12/enable && \
     export PATH=/usr/lib64/ccache${PATH:+:${PATH}} && \
     export CCACHE_DIR=${MINIFI_BASE_DIR}/.ccache && \
-    cmake3 -DSTATIC_BUILD= -DSKIP_TESTS=${DOCKER_SKIP_TESTS} ${MINIFI_OPTIONS} 
-DAWS_ENABLE_UNITY_BUILD=OFF -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" .. && \
+    cmake -DSTATIC_BUILD= -DSKIP_TESTS=${DOCKER_SKIP_TESTS} ${MINIFI_OPTIONS} 
-DAWS_ENABLE_UNITY_BUILD=OFF -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" .. && \
     make -j "$(nproc)" ${DOCKER_MAKE_TARGET}
diff --git a/linux.sh b/linux.sh
index c172bdd47..2d58dcf1c 100644
--- a/linux.sh
+++ b/linux.sh
@@ -19,3 +19,33 @@ verify_gcc_enable(){
   #feature="$1"
   [ "$COMPILER_MAJOR" -ge 11 ] && echo true || echo false
 }
+
+install_cmake_from_binary() {
+  CMAKE_VERSION="3.24.4"
+  CMAKE_URL="https://cmake.org/files/v3.24/cmake-3.24.4-linux-x86_64.tar.gz";
+  
EXPECTED_SHA256="cac77d28fb8668c179ac02c283b058aeb846fe2133a57d40b503711281ed9f19"
+
+  TMP_DIR=$(mktemp -d)
+
+  install_pkgs wget
+  wget -P "$TMP_DIR" "$CMAKE_URL"
+
+  ACTUAL_SHA256=$(sha256sum 
"$TMP_DIR/cmake-$CMAKE_VERSION-linux-x86_64.tar.gz" | cut -d " " -f 1)
+
+  if [ "$ACTUAL_SHA256" != "$EXPECTED_SHA256" ]; then
+    echo "ERROR: SHA-256 verification failed. Aborting."
+    rm -r "$TMP_DIR"
+    exit 1
+  fi
+
+  echo "Installing CMake $CMAKE_VERSION to /opt/cmake-$CMAKE_VERSION..."
+  set -x
+  tar -C "$TMP_DIR" -zxf "$TMP_DIR/cmake-$CMAKE_VERSION-linux-x86_64.tar.gz"
+  sudo mv "$TMP_DIR/cmake-$CMAKE_VERSION-linux-x86_64" 
/opt/cmake-$CMAKE_VERSION
+
+  sudo ln -s "/opt/cmake-$CMAKE_VERSION/bin/cmake" /usr/local/bin/cmake
+  set +x
+
+  echo "CMake $CMAKE_VERSION has been installed successfully."
+  rm -r "$TMP_DIR"
+}

Reply via email to