commit:     d18c2c2350f97e4eec032d01c672f6ced09cc2fa
Author:     Guilherme Amadio <amadio <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 23 11:47:43 2021 +0000
Commit:     Guilherme Amadio <amadio <AT> gentoo <DOT> org>
CommitDate: Mon Aug 23 11:48:18 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d18c2c23

sci-physics/geant: fix build with CMake 3.20 and above

Package-Manager: Portage-3.0.22, Repoman-3.0.3
Signed-off-by: Guilherme Amadio <amadio <AT> gentoo.org>

 sci-physics/geant/files/geant4.10.7-hdf5.patch     | 70 ++++++++++++++++++++++
 ...ant-4.10.7-r2.ebuild => geant-4.10.7-r3.ebuild} |  2 +
 ...4.10.7.1-r2.ebuild => geant-4.10.7.1-r3.ebuild} |  2 +
 ...4.10.7.2-r2.ebuild => geant-4.10.7.2-r3.ebuild} |  2 +
 ...eta1-r1.ebuild => geant-4.11.0_beta1-r2.ebuild} |  2 +
 5 files changed, 78 insertions(+)

diff --git a/sci-physics/geant/files/geant4.10.7-hdf5.patch 
b/sci-physics/geant/files/geant4.10.7-hdf5.patch
new file mode 100644
index 00000000000..679cdfbed9d
--- /dev/null
+++ b/sci-physics/geant/files/geant4.10.7-hdf5.patch
@@ -0,0 +1,70 @@
+From 4e86e523e7f0e419b990520a15ef7d524102cd06 Mon Sep 17 00:00:00 2001
+From: Guilherme Amadio <[email protected]>
+Date: Mon, 23 Aug 2021 13:18:25 +0200
+Subject: [PATCH] Rename Geant4::HDF5 to hdf5::hdf5
+
+Needed to be compatible with CMake 3.20, which now provides imported
+targets for HDF5 (https://cmake.org/cmake/help/v3.20/module/FindHDF5.html).
+---
+ cmake/Modules/G4HDF5Shim.cmake           | 16 ++++++++--------
+ cmake/Modules/G4OptionalComponents.cmake |  2 +-
+
+diff --git a/cmake/Modules/G4HDF5Shim.cmake b/cmake/Modules/G4HDF5Shim.cmake
+index 963a7bb5be..97d97248d8 100644
+--- a/cmake/Modules/G4HDF5Shim.cmake
++++ b/cmake/Modules/G4HDF5Shim.cmake
+@@ -1,10 +1,10 @@
+- # - G4HDF5Shim
++# - G4HDF5Shim
+ #
+ # Geant4's Geant4Config.cmake file aims to support CMake 3.8 and newer
+ # The HDF5 dependency is located through CMake's builtin FindHDF5
+-# module, but this does not supply imported targets as of CMake 3.16.
++# module, but this does not supply imported targets until CMake 3.20.
+ # It may use HDF5's hdf5-config.cmake file if available, so create
+-# custom imported target Geant4::HDF5 to allow both cases to be handled
++# custom imported target hdf5::hdf5 to allow both cases to be handled
+ # without interference with either.
+  
+ if(HDF5_FOUND)
+@@ -24,18 +24,18 @@ if(HDF5_FOUND)
+    endif()
+  endif()
+ 
+- # As FindHDF5 does not yet supply imported targets, we
++ # If FindHDF5 does not yet supply imported targets, we
+  # create an internal INTERFACE target to wrap these.
+  # This still hard-codes include/library paths, but limits it
+  # to one place. Later, we'll create proper imported targets
+  # with re-finds but for now this is the best minimally invasive proceedure
+- if(NOT TARGET Geant4::HDF5)
+-   add_library(Geant4::HDF5 IMPORTED UNKNOWN)
+-   set_target_properties(Geant4::HDF5 PROPERTIES
++ if(NOT TARGET hdf5::hdf5)
++   add_library(hdf5::hdf5 IMPORTED UNKNOWN)
++   set_target_properties(hdf5::hdf5 PROPERTIES
+      IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+      IMPORTED_LOCATION "${HDF5_C_LIBRARY_hdf5}"
+      INTERFACE_INCLUDE_DIRECTORIES "${HDF5_C_INCLUDE_DIRS}"
+      INTERFACE_LINK_LIBRARIES "${HDF5_C_LIBRARIES}"
+      )
+  endif()
+-endif()
+\ No newline at end of file
++endif()
+diff --git a/cmake/Modules/G4OptionalComponents.cmake 
b/cmake/Modules/G4OptionalComponents.cmake
+index c0639a538b..77b3c91241 100644
+--- a/cmake/Modules/G4OptionalComponents.cmake
++++ b/cmake/Modules/G4OptionalComponents.cmake
+@@ -369,7 +369,7 @@ if(GEANT4_USE_HDF5)
+   find_package(HDF5 1.8 REQUIRED)
+   include("${CMAKE_CURRENT_LIST_DIR}/G4HDF5Shim.cmake")
+   # Backward compatibility
+-  set(HDF5_LIBRARIES Geant4::HDF5)
++  set(HDF5_LIBRARIES hdf5::hdf5)
+ 
+   # May have found via config mode...
+   if(HDF5_DIR)
+-- 
+2.33.0
+

diff --git a/sci-physics/geant/geant-4.10.7-r2.ebuild 
b/sci-physics/geant/geant-4.10.7-r3.ebuild
similarity index 98%
rename from sci-physics/geant/geant-4.10.7-r2.ebuild
rename to sci-physics/geant/geant-4.10.7-r3.ebuild
index fcc83668274..085e5abcf44 100644
--- a/sci-physics/geant/geant-4.10.7-r2.ebuild
+++ b/sci-physics/geant/geant-4.10.7-r3.ebuild
@@ -62,6 +62,8 @@ RDEPEND="
                x11-libs/libXmu
        )"
 
+PATCHES=( "${FILESDIR}"/geant4.10.7-hdf5.patch )
+
 S="${WORKDIR}/${MY_P}"
 
 src_configure() {

diff --git a/sci-physics/geant/geant-4.10.7.1-r2.ebuild 
b/sci-physics/geant/geant-4.10.7.1-r3.ebuild
similarity index 98%
rename from sci-physics/geant/geant-4.10.7.1-r2.ebuild
rename to sci-physics/geant/geant-4.10.7.1-r3.ebuild
index fcc83668274..085e5abcf44 100644
--- a/sci-physics/geant/geant-4.10.7.1-r2.ebuild
+++ b/sci-physics/geant/geant-4.10.7.1-r3.ebuild
@@ -62,6 +62,8 @@ RDEPEND="
                x11-libs/libXmu
        )"
 
+PATCHES=( "${FILESDIR}"/geant4.10.7-hdf5.patch )
+
 S="${WORKDIR}/${MY_P}"
 
 src_configure() {

diff --git a/sci-physics/geant/geant-4.10.7.2-r2.ebuild 
b/sci-physics/geant/geant-4.10.7.2-r3.ebuild
similarity index 98%
rename from sci-physics/geant/geant-4.10.7.2-r2.ebuild
rename to sci-physics/geant/geant-4.10.7.2-r3.ebuild
index 2b4f8cd92a1..32f62303ec7 100644
--- a/sci-physics/geant/geant-4.10.7.2-r2.ebuild
+++ b/sci-physics/geant/geant-4.10.7.2-r3.ebuild
@@ -62,6 +62,8 @@ RDEPEND="
                x11-libs/libXmu
        )"
 
+PATCHES=( "${FILESDIR}"/geant4.10.7-hdf5.patch )
+
 S="${WORKDIR}/${MY_P}"
 
 src_configure() {

diff --git a/sci-physics/geant/geant-4.11.0_beta1-r1.ebuild 
b/sci-physics/geant/geant-4.11.0_beta1-r2.ebuild
similarity index 98%
rename from sci-physics/geant/geant-4.11.0_beta1-r1.ebuild
rename to sci-physics/geant/geant-4.11.0_beta1-r2.ebuild
index 19e28827a13..0b9fdfbf25e 100644
--- a/sci-physics/geant/geant-4.11.0_beta1-r1.ebuild
+++ b/sci-physics/geant/geant-4.11.0_beta1-r2.ebuild
@@ -62,6 +62,8 @@ RDEPEND="
                x11-libs/libXmu
        )"
 
+PATCHES=( "${FILESDIR}"/geant4.10.7-hdf5.patch )
+
 S="${WORKDIR}/${MY_P}"
 
 src_configure() {

Reply via email to