From 954ff42267336f4898a5c439d11505f59844068c Mon Sep 17 00:00:00 2001 From: Funda Wang Date: Sun, 16 Mar 2025 02:33:13 +0800 Subject: [PATCH] fix build with cmake 4.0 --- artemis-1.4.0-port-to-newer-cmake.patch | 58 +++++++++++++++++++++++++ artemis.spec | 12 +++-- 2 files changed, 66 insertions(+), 4 deletions(-) create mode 100644 artemis-1.4.0-port-to-newer-cmake.patch diff --git a/artemis-1.4.0-port-to-newer-cmake.patch b/artemis-1.4.0-port-to-newer-cmake.patch new file mode 100644 index 0000000..bb6245a --- /dev/null +++ b/artemis-1.4.0-port-to-newer-cmake.patch @@ -0,0 +1,58 @@ +--- activemq-artemis-1.4.0/artemis-native/CMakeLists.txt.orig 2025-03-15 21:16:03.142298400 +0800 ++++ activemq-artemis-1.4.0/artemis-native/CMakeLists.txt 2025-03-15 21:16:38.186442000 +0800 +@@ -13,6 +13,6 @@ + # See the License for the specific language governing permissions and + # limitations under the License. + +-CMAKE_MINIMUM_REQUIRED(VERSION 2.6) ++CMAKE_MINIMUM_REQUIRED(VERSION 2.6...${CMAKE_VERSION}) + + SUBDIRS(src/main/c) +--- activemq-artemis-1.4.0/artemis-native/src/main/c/CMakeLists.txt.orig 2025-03-15 21:16:28.499058500 +0800 ++++ activemq-artemis-1.4.0/artemis-native/src/main/c/CMakeLists.txt 2025-03-15 21:18:34.060378900 +0800 +@@ -14,7 +14,7 @@ + # limitations under the License. + + +-CMAKE_MINIMUM_REQUIRED(VERSION 2.6) ++CMAKE_MINIMUM_REQUIRED(VERSION 2.6...${CMAKE_VERSION}) + + PROJECT(artemis-native) + SET(${PROJECT_NAME}_MAJOR_VERSION 1) +@@ -36,12 +36,12 @@ + + find_library(LIBAIO NAMES aio) + +-INCLUDE_DIRECTORIES(. ${JNI_INCLUDE_DIRS}) ++INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/src/main/c ${JNI_INCLUDE_DIRS}) + + ADD_CUSTOM_COMMAND( + OUTPUT org_apache_activemq_artemis_jlibaio_LibaioContext.h +- COMMAND javah -cp ../java/ org.apache.activemq.artemis.jlibaio.LibaioContext +- DEPENDS ../java/org/apache/activemq/artemis/jlibaio/LibaioContext.java ++ COMMAND javah -cp ${CMAKE_SOURCE_DIR}/src/main/java/ org.apache.activemq.artemis.jlibaio.LibaioContext ++ DEPENDS ${CMAKE_SOURCE_DIR}/src/main/java/org/apache/activemq/artemis/jlibaio/LibaioContext.java + ) + + ADD_LIBRARY(artemis-native SHARED org_apache_activemq_artemis_jlibaio_LibaioContext.c org_apache_activemq_artemis_jlibaio_LibaioContext.h exception_helper.h) +@@ -49,17 +49,17 @@ + target_link_libraries(artemis-native aio) + + set_target_properties(artemis-native PROPERTIES +- LIBRARY_OUTPUT_DIRECTORY ../../../bin) ++ LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + + # It is weird but this is how you are supposed to validate between 32 and 64 bits architecture + if (CMAKE_SIZEOF_VOID_P EQUAL 8) + set_target_properties(artemis-native PROPERTIES +- LIBRARY_OUTPUT_DIRECTORY ../../../bin ++ LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin + LIBRARY_OUTPUT_NAME artemis-native-64) + message("-- Setting up library as artemis-native-64 based on current architecture") + else() + set_target_properties(artemis-native PROPERTIES +- LIBRARY_OUTPUT_DIRECTORY ../../../bin ++ LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin + LIBRARY_OUTPUT_NAME artemis-native-32) + message("-- Setting up library as artemis-native-32 based on current architecture") + endif() diff --git a/artemis.spec b/artemis.spec index 41af87a..c00ec3f 100644 --- a/artemis.spec +++ b/artemis.spec @@ -1,12 +1,12 @@ -%global __cmake_in_source_build 1 Name: artemis Version: 1.4.0 -Release: 4 +Release: 5 Summary: Java high performance, clustered, asynchronous messaging system License: Apache-2.0 URL: https://github.com/apache/activemq-artemis/ Source0: https://github.com/apache/activemq-artemis/archive/%{version}/%{name}-%{version}.tar.gz Patch0: artemis-netty-4.1.patch +Patch1: artemis-1.4.0-port-to-newer-cmake.patch BuildRequires: gcc-c++ cmake libaio-devel libtool maven-local mvn(com.google.guava:guava) BuildRequires: mvn(commons-beanutils:commons-beanutils) mvn(io.airlift:airline) BuildRequires: mvn(io.netty:netty-all) mvn(javax.inject:javax.inject) @@ -226,7 +226,8 @@ Documentation for %{name}. %prep %setup -q -n activemq-%{name}-%{version} -%patch0 -p1 +%patch -P0 -p1 +%patch -P1 -p1 find -name "*.class" -print -delete find -name "*.dll" -print -delete find -name "*.exe" -print -delete @@ -278,7 +279,7 @@ done %build pushd artemis-native %cmake -%cmake_build +%cmake_build -j1 popd %mvn_build -fs @@ -357,6 +358,9 @@ install -pm 755 artemis-native/%{__cmake_builddir}/bin/libartemis-native-%{__isa %license LICENSE NOTICE %changelog +* Sat Mar 15 2025 Funda Wang - 1.4.0-5 +- fix build with cmake 4.0 + * Thu Jan 16 2025 wangkai <13474090681@163.com> - 1.4.0-4 - Fix force in-source build -- Gitee