diff options
author | Sergey Kosukhin <sergey.kosukhin@mpimet.mpg.de> | 2021-06-30 02:34:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-29 18:34:12 -0600 |
commit | 55dd306790eee6165e9076402bb6e674be7df324 (patch) | |
tree | a382d3af7f1f394d9561fe92774cc73cc7b24504 /var | |
parent | a2b7f9997d96624e85c5db285592ac0c20f6ec9e (diff) | |
download | spack-55dd306790eee6165e9076402bb6e674be7df324.tar.gz spack-55dd306790eee6165e9076402bb6e674be7df324.tar.bz2 spack-55dd306790eee6165e9076402bb6e674be7df324.tar.xz spack-55dd306790eee6165e9076402bb6e674be7df324.zip |
hdf5: a follow-up to #18937 (#23820)
Diffstat (limited to 'var')
6 files changed, 170 insertions, 826 deletions
diff --git a/var/spack/repos/builtin/packages/hdf5/1.10.7_cmake.patch b/var/spack/repos/builtin/packages/hdf5/1.10.7_cmake.patch deleted file mode 100644 index a85aad1bb3..0000000000 --- a/var/spack/repos/builtin/packages/hdf5/1.10.7_cmake.patch +++ /dev/null @@ -1,90 +0,0 @@ -diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt -index 8608c67..4b1a2d6 100644 ---- a/c++/src/CMakeLists.txt -+++ b/c++/src/CMakeLists.txt -@@ -209,7 +209,11 @@ install ( - ) - - if (NOT WIN32 AND NOT MINGW) -- set (_PKG_CONFIG_COMPILER ${CMAKE_CXX_COMPILER}) -+ if (HDF5_ENABLE_PARALLEL AND MPI_CXX_FOUND) -+ set (_PKG_CONFIG_COMPILER ${MPI_CXX_COMPILER}) -+ else () -+ set (_PKG_CONFIG_COMPILER ${CMAKE_CXX_COMPILER}) -+ endif () - configure_file ( - ${HDF_RESOURCES_DIR}/libh5cc.in - ${HDF5_BINARY_DIR}/CMakeFiles/h5c++ - ${HDF5_BINARY_DIR}/CMakeFiles/h5fc -diff --git a/hl/c++/src/CMakeLists.txt b/hl/c++/src/CMakeLists.txt -index 1eac9fe..e488656 100644 ---- a/hl/c++/src/CMakeLists.txt -+++ b/hl/c++/src/CMakeLists.txt -@@ -120,7 +120,11 @@ install ( - ) - - if (NOT WIN32 AND NOT MINGW) -- set (_PKG_CONFIG_COMPILER ${CMAKE_CXX_COMPILER}) -+ if (HDF5_ENABLE_PARALLEL AND MPI_CXX_FOUND) -+ set (_PKG_CONFIG_COMPILER ${MPI_CXX_COMPILER}) -+ else () -+ set (_PKG_CONFIG_COMPILER ${CMAKE_CXX_COMPILER}) -+ endif () - configure_file ( - ${HDF_RESOURCES_DIR}/libh5cc.in - ${HDF5_BINARY_DIR}/CMakeFiles/h5hlc++ -diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt -index 785bdcf..427424e 100644 ---- a/hl/src/CMakeLists.txt -+++ b/hl/src/CMakeLists.txt -@@ -152,7 +152,11 @@ install ( - ) - - if (NOT WIN32 AND NOT MINGW) -- set (_PKG_CONFIG_COMPILER ${CMAKE_C_COMPILER}) -+ if (HDF5_ENABLE_PARALLEL AND MPI_C_FOUND) -+ set (_PKG_CONFIG_COMPILER ${MPI_C_COMPILER}) -+ else () -+ set (_PKG_CONFIG_COMPILER ${CMAKE_C_COMPILER}) -+ endif () - configure_file ( - ${HDF_RESOURCES_DIR}/libh5cc.in - ${HDF5_BINARY_DIR}/CMakeFiles/h5hlcc -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 329a2dc..97019fa 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -1282,7 +1282,11 @@ install ( - ) - - if (NOT WIN32) -- set (_PKG_CONFIG_COMPILER ${CMAKE_C_COMPILER}) -+ if (HDF5_ENABLE_PARALLEL AND MPI_C_FOUND) -+ set (_PKG_CONFIG_COMPILER ${MPI_C_COMPILER}) -+ else () -+ set (_PKG_CONFIG_COMPILER ${CMAKE_C_COMPILER}) -+ endif () - configure_file ( - ${HDF_RESOURCES_DIR}/libh5cc.in - ${HDF5_BINARY_DIR}/CMakeFiles/h5cc -@@ -1294,6 +1298,20 @@ if (NOT WIN32) - PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE - COMPONENT libraries - ) -+ if (HDF5_ENABLE_PARALLEL AND MPI_C_FOUND) -+ #legacy requires a different name -+ configure_file ( -+ ${HDF_RESOURCES_DIR}/libh5cc.in -+ ${HDF5_BINARY_DIR}/CMakeFiles/h5pcc -+ @ONLY -+ ) -+ install ( -+ FILES ${HDF5_BINARY_DIR}/CMakeFiles/h5pcc -+ DESTINATION ${HDF5_INSTALL_BIN_DIR} -+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE -+ COMPONENT libraries -+ ) -+ endif () - endif () - - #----------------------------------------------------------------------------- diff --git a/var/spack/repos/builtin/packages/hdf5/1.12.0_cmake.patch b/var/spack/repos/builtin/packages/hdf5/1.12.0_cmake.patch deleted file mode 100644 index 68e56e96e7..0000000000 --- a/var/spack/repos/builtin/packages/hdf5/1.12.0_cmake.patch +++ /dev/null @@ -1,104 +0,0 @@ -diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt -index 39f0f3a..9dc69d6 100644 ---- a/c++/src/CMakeLists.txt -+++ b/c++/src/CMakeLists.txt -@@ -196,7 +196,11 @@ install ( - ) - - if (NOT WIN32 AND NOT MINGW) -- set (_PKG_CONFIG_COMPILER ${CMAKE_CXX_COMPILER}) -+ if (HDF5_ENABLE_PARALLEL AND MPI_CXX_FOUND) -+ set (_PKG_CONFIG_COMPILER ${MPI_CXX_COMPILER}) -+ else () -+ set (_PKG_CONFIG_COMPILER ${CMAKE_CXX_COMPILER}) -+ endif () - configure_file ( - ${HDF_RESOURCES_DIR}/libh5cc.in - ${HDF5_BINARY_DIR}/CMakeFiles/h5c++ -diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt -index b5d1a60..22ed7fb 100644 ---- a/fortran/src/CMakeLists.txt -+++ b/fortran/src/CMakeLists.txt -@@ -533,7 +533,11 @@ install ( - ) - - if (NOT WIN32 AND NOT MINGW) -- set (_PKG_CONFIG_COMPILER ${CMAKE_Fortran_COMPILER}) -+ if (HDF5_ENABLE_PARALLEL AND MPI_Fortran_FOUND) -+ set (_PKG_CONFIG_COMPILER ${MPI_Fortran_COMPILER}) -+ else () -+ set (_PKG_CONFIG_COMPILER ${CMAKE_Fortran_COMPILER}) -+ endif () - configure_file ( - ${HDF_RESOURCES_DIR}/libh5cc.in - ${HDF5_BINARY_DIR}/CMakeFiles/h5fc -diff --git a/hl/c++/src/CMakeLists.txt b/hl/c++/src/CMakeLists.txt -index 866f372..6abd376 100644 ---- a/hl/c++/src/CMakeLists.txt -+++ b/hl/c++/src/CMakeLists.txt -@@ -109,7 +109,11 @@ install ( - ) - - if (NOT WIN32 AND NOT MINGW) -- set (_PKG_CONFIG_COMPILER ${CMAKE_CXX_COMPILER}) -+ if (HDF5_ENABLE_PARALLEL AND MPI_CXX_FOUND) -+ set (_PKG_CONFIG_COMPILER ${MPI_CXX_COMPILER}) -+ else () -+ set (_PKG_CONFIG_COMPILER ${CMAKE_CXX_COMPILER}) -+ endif () - configure_file ( - ${HDF_RESOURCES_DIR}/libh5cc.in - ${HDF5_BINARY_DIR}/CMakeFiles/h5hlc++ -diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt -index 55d84c7..857a390 100644 ---- a/hl/src/CMakeLists.txt -+++ b/hl/src/CMakeLists.txt -@@ -133,7 +133,11 @@ install ( - ) - - if (NOT WIN32 AND NOT MINGW) -- set (_PKG_CONFIG_COMPILER ${CMAKE_C_COMPILER}) -+ if (HDF5_ENABLE_PARALLEL AND MPI_C_FOUND) -+ set (_PKG_CONFIG_COMPILER ${MPI_C_COMPILER}) -+ else () -+ set (_PKG_CONFIG_COMPILER ${CMAKE_C_COMPILER}) -+ endif () - configure_file ( - ${HDF_RESOURCES_DIR}/libh5cc.in - ${HDF5_BINARY_DIR}/CMakeFiles/h5hlcc -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index f582056..d7ddee4 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -1272,7 +1272,11 @@ install ( - ) - - if (NOT WIN32) -- set (_PKG_CONFIG_COMPILER ${CMAKE_C_COMPILER}) -+ if (HDF5_ENABLE_PARALLEL AND MPI_C_FOUND) -+ set (_PKG_CONFIG_COMPILER ${MPI_C_COMPILER}) -+ else () -+ set (_PKG_CONFIG_COMPILER ${CMAKE_C_COMPILER}) -+ endif () - configure_file ( - ${HDF_RESOURCES_DIR}/libh5cc.in - ${HDF5_BINARY_DIR}/CMakeFiles/h5cc -@@ -1284,4 +1288,18 @@ if (NOT WIN32) - PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE - COMPONENT libraries - ) -+ if (HDF5_ENABLE_PARALLEL AND MPI_C_FOUND) -+ #legacy requires a different name -+ configure_file ( -+ ${HDF_RESOURCES_DIR}/libh5cc.in -+ ${HDF5_BINARY_DIR}/CMakeFiles/h5pcc -+ @ONLY -+ ) -+ install ( -+ FILES ${HDF5_BINARY_DIR}/CMakeFiles/h5pcc -+ DESTINATION ${HDF5_INSTALL_BIN_DIR} -+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE -+ COMPONENT libraries -+ ) -+ endif () - endif () diff --git a/var/spack/repos/builtin/packages/hdf5/1.8.21_cmake.patch b/var/spack/repos/builtin/packages/hdf5/1.8.21_cmake.patch deleted file mode 100644 index 227c4db565..0000000000 --- a/var/spack/repos/builtin/packages/hdf5/1.8.21_cmake.patch +++ /dev/null @@ -1,362 +0,0 @@ -diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt -index 9b9b745..3f05fa0 100644 ---- a/c++/src/CMakeLists.txt -+++ b/c++/src/CMakeLists.txt -@@ -178,7 +178,11 @@ install ( - ) - - if (NOT WIN32) -- set (_PKG_CONFIG_COMPILER ${CMAKE_CXX_COMPILER}) -+ if (HDF5_ENABLE_PARALLEL AND MPI_CXX_FOUND) -+ set (_PKG_CONFIG_COMPILER ${MPI_CXX_COMPILER}) -+ else () -+ set (_PKG_CONFIG_COMPILER ${CMAKE_CXX_COMPILER}) -+ endif () - configure_file ( - ${HDF_RESOURCES_DIR}/libh5cc.in - ${HDF5_BINARY_DIR}/CMakeFiles/h5c++ -diff --git a/config/cmake_ext_mod/FindSZIP.cmake b/config/cmake_ext_mod/FindSZIP.cmake -index 699be85..846a3d1 100644 ---- a/config/cmake_ext_mod/FindSZIP.cmake -+++ b/config/cmake_ext_mod/FindSZIP.cmake -@@ -5,140 +5,112 @@ - # This file is part of HDF5. The full HDF5 copyright notice, including - # terms governing use, modification, and redistribution, is contained in - # the COPYING file, which can be found at the root of the source code --# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. -+# distribution tree, or in https://www.hdfgroup.org/licenses. - # If you do not have access to either file, you may request a copy from - # help@hdfgroup.org. - # -+######################################################################### -+ -+# - Derived from the FindTiff.cmake and FindJPEG.cmake that is included with cmake -+# FindSZIP - --# - Find SZIP library --# - Derived from the FindTiff.cmake that is included with cmake - # Find the native SZIP includes and library --# This module defines --# SZIP_INCLUDE_DIRS, where to find tiff.h, etc. --# SZIP_LIBRARIES, libraries to link against to use SZIP. --# SZIP_FOUND, If false, do not try to use SZIP. --# also defined, but not for general use are --# SZIP_LIBRARY, where to find the SZIP library. --# SZIP_LIBRARY_DEBUG - Debug version of SZIP library --# SZIP_LIBRARY_RELEASE - Release Version of SZIP library - --# message (STATUS "Finding SZIP library and headers..." ) -+# Imported targets -+################## - --############################################ -+# This module defines the following :prop_tgt:`IMPORTED` targets: - # --# Check the existence of the libraries. -+# SZIP::SZIP -+# The SZIP library, if found. - # --############################################ --# This macro was taken directly from the FindQt4.cmake file that is included --# with the CMake distribution. This is NOT my work. All work was done by the --# original authors of the FindQt4.cmake file. Only minor modifications were --# made to remove references to Qt and make this file more generally applicable --######################################################################### -+# Result variables -+################### - --macro (SZIP_ADJUST_LIB_VARS basename) -- if (${basename}_INCLUDE_DIR) -+# This module will set the following variables in your project: - -- # if only the release version was found, set the debug variable also to the release version -- if (${basename}_LIBRARY_RELEASE AND NOT ${basename}_LIBRARY_DEBUG) -- set (${basename}_LIBRARY_DEBUG ${${basename}_LIBRARY_RELEASE}) -- set (${basename}_LIBRARY ${${basename}_LIBRARY_RELEASE}) -- set (${basename}_LIBRARIES ${${basename}_LIBRARY_RELEASE}) -- endif () -+# SZIP_FOUND, true if the SZIP headers and libraries were found. -+# SZIP_INCLUDE_DIR, the directory containing the SZIP headers. -+# SZIP_INCLUDE_DIRS, the directory containing the SZIP headers. -+# SZIP_LIBRARIES, libraries to link against to use SZIP. - -- # if only the debug version was found, set the release variable also to the debug version -- if (${basename}_LIBRARY_DEBUG AND NOT ${basename}_LIBRARY_RELEASE) -- set (${basename}_LIBRARY_RELEASE ${${basename}_LIBRARY_DEBUG}) -- set (${basename}_LIBRARY ${${basename}_LIBRARY_DEBUG}) -- set (${basename}_LIBRARIES ${${basename}_LIBRARY_DEBUG}) -- endif () -- if (${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE) -- # if the generator supports configuration types then set -- # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value -- if (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) -- set (${basename}_LIBRARY optimized ${${basename}_LIBRARY_RELEASE} debug ${${basename}_LIBRARY_DEBUG}) -- else () -- # if there are no configuration types and CMAKE_BUILD_TYPE has no value -- # then just use the release libraries -- set (${basename}_LIBRARY ${${basename}_LIBRARY_RELEASE} ) -- endif () -- set (${basename}_LIBRARIES optimized ${${basename}_LIBRARY_RELEASE} debug ${${basename}_LIBRARY_DEBUG}) -- endif () -+# Cache variables -+################# - -- set (${basename}_LIBRARY ${${basename}_LIBRARY} CACHE FILEPATH "The ${basename} library") -+# The following variables may also be set: - -- if (${basename}_LIBRARY) -- set (${basename}_FOUND 1) -- endif () -- endif () -+# SZIP_LIBRARY, where to find the SZIP library. -+# SZIP_LIBRARY_DEBUG - Debug version of SZIP library -+# SZIP_LIBRARY_RELEASE - Release Version of SZIP library - -- # Make variables changeble to the advanced user -- MARK_AS_ADVANCED (${basename}_LIBRARY ${basename}_LIBRARY_RELEASE ${basename}_LIBRARY_DEBUG ${basename}_INCLUDE_DIR ) --endmacro () -- -- --# Look for the header file. --set (SZIP_INCLUDE_SEARCH_DIRS -- $ENV{SZIP_INSTALL}/include -- $ENV{SZIP_INSTALL}/include/szip -- /usr/include -- /usr/include/szip --) -- --set (SZIP_LIB_SEARCH_DIRS -- $ENV{SZIP_INSTALL}/lib -- /usr/lib --) -- --set (SZIP_BIN_SEARCH_DIRS -- $ENV{SZIP_INSTALL}/bin -- /usr/bin --) -- --FIND_PATH (SZIP_INCLUDE_DIR -- NAMES szlib.h -- PATHS ${SZIP_INCLUDE_SEARCH_DIRS} -- NO_DEFAULT_PATH --) -- --if (WIN32) -- set (SZIP_SEARCH_DEBUG_NAMES "sz_d;libsz_d") -- set (SZIP_SEARCH_RELEASE_NAMES "sz;libsz;libszip") --else () -- set (SZIP_SEARCH_DEBUG_NAMES "sz_d") -- set (SZIP_SEARCH_RELEASE_NAMES "sz;szip") --endif () -+# message (STATUS "Finding SZIP library and headers..." ) -+######################################################################### - --# Look for the library. --FIND_LIBRARY (SZIP_LIBRARY_DEBUG -- NAMES ${SZIP_SEARCH_DEBUG_NAMES} -- PATHS ${SZIP_LIB_SEARCH_DIRS} -- NO_DEFAULT_PATH --) -- --FIND_LIBRARY (SZIP_LIBRARY_RELEASE -- NAMES ${SZIP_SEARCH_RELEASE_NAMES} -- PATHS ${SZIP_LIB_SEARCH_DIRS} -- NO_DEFAULT_PATH --) -- --SZIP_ADJUST_LIB_VARS (SZIP) -- --if (SZIP_INCLUDE_DIR AND SZIP_LIBRARY) -- set (SZIP_FOUND 1) -- set (SZIP_LIBRARIES ${SZIP_LIBRARY}) -- set (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIR}) -- if (SZIP_LIBRARY_DEBUG) -- get_filename_component (SZIP_LIBRARY_PATH ${SZIP_LIBRARY_DEBUG} PATH) -- set (SZIP_LIB_DIR ${SZIP_LIBRARY_PATH}) -- elseif () -- get_filename_component (SZIP_LIBRARY_PATH ${SZIP_LIBRARY_RELEASE} PATH) -- set (SZIP_LIB_DIR ${SZIP_LIBRARY_PATH}) -- endif () --else () -- set (SZIP_FOUND 0) -- set (SZIP_LIBRARIES) -- set (SZIP_INCLUDE_DIRS) --endif () -+ -+find_path(SZIP_INCLUDE_DIR szlib.h) -+ -+set(szip_names ${SZIP_NAMES} sz szip szip-static libsz libszip libszip-static) -+foreach(name ${szip_names}) -+ list (APPEND szip_names_debug "${name}d") -+endforeach() -+ -+if(NOT SZIP_LIBRARY) -+ find_library(SZIP_LIBRARY_RELEASE NAMES ${szip_names}) -+ find_library(SZIP_LIBRARY_DEBUG NAMES ${szip_names_debug}) -+ include(SelectLibraryConfigurations) -+ select_library_configurations(SZIP) -+ mark_as_advanced(SZIP_LIBRARY_RELEASE SZIP_LIBRARY_DEBUG) -+endif() -+unset(szip_names) -+unset(szip_names_debug) -+ -+if(SZIP_INCLUDE_DIR AND EXISTS "${SZIP_INCLUDE_DIR}/SZconfig.h") -+ file(STRINGS "${SZIP_INCLUDE_DIR}/SZconfig.h" szip_version_str -+ REGEX "^#define[\t ]+SZIP_PACKAGE_VERSION[\t ]+.*") -+ -+ string(REGEX REPLACE "^#define[\t ]+SZIP_PACKAGE_VERSION[\t ]+([0-9]+).*" -+ "\\1" SZIP_VERSION "${szip_version_str}") -+ unset(szip_version_str) -+endif() -+ -+include(FindPackageHandleStandardArgs) -+find_package_handle_standard_args(SZIP -+ REQUIRED_VARS SZIP_LIBRARY SZIP_INCLUDE_DIR -+ VERSION_VAR SZIP_VERSION) -+ -+if(SZIP_FOUND) -+ set(SZIP_LIBRARIES ${SZIP_LIBRARY}) -+ set(SZIP_INCLUDE_DIRS "${SZIP_INCLUDE_DIR}") -+ -+ if(NOT TARGET SZIP::SZIP) -+ add_library(SZIP::SZIP UNKNOWN IMPORTED) -+ if(SZIP_INCLUDE_DIRS) -+ set_target_properties(SZIP::SZIP PROPERTIES -+ INTERFACE_INCLUDE_DIRECTORIES "${SZIP_INCLUDE_DIRS}") -+ endif() -+ if(EXISTS "${SZIP_LIBRARY}") -+ set_target_properties(SZIP::SZIP PROPERTIES -+ IMPORTED_LINK_INTERFACE_LANGUAGES "C" -+ IMPORTED_LOCATION "${SZIP_LIBRARY}") -+ endif() -+ if(EXISTS "${SZIP_LIBRARY_RELEASE}") -+ set_property(TARGET SZIP::SZIP APPEND PROPERTY -+ IMPORTED_CONFIGURATIONS RELEASE) -+ set_target_properties(SZIP::SZIP PROPERTIES -+ IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C" -+ IMPORTED_LOCATION_RELEASE "${SZIP_LIBRARY_RELEASE}") -+ endif() -+ if(EXISTS "${SZIP_LIBRARY_DEBUG}") -+ set_property(TARGET SZIP::SZIP APPEND PROPERTY -+ IMPORTED_CONFIGURATIONS DEBUG) -+ set_target_properties(SZIP::SZIP PROPERTIES -+ IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C" -+ IMPORTED_LOCATION_DEBUG "${SZIP_LIBRARY_DEBUG}") -+ endif() -+ endif() -+endif() -+ -+mark_as_advanced(SZIP_LIBRARY SZIP_INCLUDE_DIR) - - # Report the results. - if (NOT SZIP_FOUND) -@@ -146,36 +118,12 @@ if (NOT SZIP_FOUND) - "SZip was not found. Make sure SZIP_LIBRARY and SZIP_INCLUDE_DIR are set or set the SZIP_INSTALL environment variable." - ) - if (NOT SZIP_FIND_QUIETLY) -- message (STATUS "${SZIP_DIR_MESSAGE}") -+ if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") -+ message (VERBOSE "${SZIP_DIR_MESSAGE}") -+ endif () - else () - if (SZIP_FIND_REQUIRED) - message (FATAL_ERROR "SZip was NOT found and is Required by this project") - endif () - endif () - endif () -- --if (SZIP_FOUND) -- include (CheckSymbolExists) -- ############################################# -- # Find out if SZIP was build using dll's -- ############################################# -- # Save required variable -- set (CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES}) -- set (CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS}) -- # Add SZIP_INCLUDE_DIR to CMAKE_REQUIRED_INCLUDES -- set (CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};${SZIP_INCLUDE_DIRS}") -- -- # Restore CMAKE_REQUIRED_INCLUDES and CMAKE_REQUIRED_FLAGS variables -- set (CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE}) -- set (CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE}) -- # -- ############################################# --endif () -- --if (FIND_SZIP_DEBUG) -- message (STATUS "SZIP_INCLUDE_DIR: ${SZIP_INCLUDE_DIR}") -- message (STATUS "SZIP_INCLUDE_DIRS: ${SZIP_INCLUDE_DIRS}") -- message (STATUS "SZIP_LIBRARY_DEBUG: ${SZIP_LIBRARY_DEBUG}") -- message (STATUS "SZIP_LIBRARY_RELEASE: ${SZIP_LIBRARY_RELEASE}") -- message (STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}") --endif () -diff --git a/hl/c++/src/CMakeLists.txt b/hl/c++/src/CMakeLists.txt -index 7949b73..a633bdd 100644 ---- a/hl/c++/src/CMakeLists.txt -+++ b/hl/c++/src/CMakeLists.txt -@@ -102,7 +102,11 @@ install ( - ) - - if (NOT WIN32) -- set (_PKG_CONFIG_COMPILER ${CMAKE_CXX_COMPILER}) -+ if (HDF5_ENABLE_PARALLEL AND MPI_CXX_FOUND) -+ set (_PKG_CONFIG_COMPILER ${MPI_CXX_COMPILER}) -+ else () -+ set (_PKG_CONFIG_COMPILER ${CMAKE_CXX_COMPILER}) -+ endif () - configure_file ( - ${HDF_RESOURCES_DIR}/libh5cc.in - ${HDF5_BINARY_DIR}/CMakeFiles/h5hlc++ -diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt -index d570265..e652ed3 100644 ---- a/hl/src/CMakeLists.txt -+++ b/hl/src/CMakeLists.txt -@@ -118,7 +118,11 @@ install ( - ) - - if (NOT WIN32) -- set (_PKG_CONFIG_COMPILER ${CMAKE_C_COMPILER}) -+ if (HDF5_ENABLE_PARALLEL AND MPI_C_FOUND) -+ set (_PKG_CONFIG_COMPILER ${MPI_C_COMPILER}) -+ else () -+ set (_PKG_CONFIG_COMPILER ${CMAKE_C_COMPILER}) -+ endif () - configure_file ( - ${HDF_RESOURCES_DIR}/libh5cc.in - ${HDF5_BINARY_DIR}/CMakeFiles/h5hlcc -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 4d2f1bc..39cfbca 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -820,7 +820,11 @@ install ( - ) - - if (NOT WIN32) -- set (_PKG_CONFIG_COMPILER ${CMAKE_C_COMPILER}) -+ if (HDF5_ENABLE_PARALLEL AND MPI_C_FOUND) -+ set (_PKG_CONFIG_COMPILER ${MPI_C_COMPILER}) -+ else () -+ set (_PKG_CONFIG_COMPILER ${CMAKE_C_COMPILER}) -+ endif () - configure_file ( - ${HDF_RESOURCES_DIR}/libh5cc.in - ${HDF5_BINARY_DIR}/CMakeFiles/h5cc -@@ -832,4 +836,18 @@ if (NOT WIN32) - PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE - COMPONENT libraries - ) -+ if (HDF5_ENABLE_PARALLEL AND MPI_C_FOUND) -+ #legacy requires a different name -+ configure_file ( -+ ${HDF_RESOURCES_DIR}/libh5cc.in -+ ${HDF5_BINARY_DIR}/CMakeFiles/h5pcc -+ @ONLY -+ ) -+ install ( -+ FILES ${HDF5_BINARY_DIR}/CMakeFiles/h5pcc -+ DESTINATION ${HDF5_INSTALL_BIN_DIR} -+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE -+ COMPONENT libraries -+ ) -+ endif () - endif () diff --git a/var/spack/repos/builtin/packages/hdf5/1.8.22_cmake.patch b/var/spack/repos/builtin/packages/hdf5/1.8.22_cmake.patch deleted file mode 100644 index b6016fd5b0..0000000000 --- a/var/spack/repos/builtin/packages/hdf5/1.8.22_cmake.patch +++ /dev/null @@ -1,121 +0,0 @@ -diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt -index 65d1d43..9e4bf24 100644 ---- a/c++/src/CMakeLists.txt -+++ b/c++/src/CMakeLists.txt -@@ -211,7 +211,11 @@ install ( - ) - - if (NOT WIN32 AND NOT MINGW) -- set (_PKG_CONFIG_COMPILER ${CMAKE_CXX_COMPILER}) -+ if (HDF5_ENABLE_PARALLEL AND MPI_CXX_FOUND) -+ set (_PKG_CONFIG_COMPILER ${MPI_CXX_COMPILER}) -+ else () -+ set (_PKG_CONFIG_COMPILER ${CMAKE_CXX_COMPILER}) -+ endif () - configure_file ( - ${HDF_RESOURCES_DIR}/libh5cc.in - ${HDF5_BINARY_DIR}/CMakeFiles/h5c++ -diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt -index dd03439..f58dde9 100644 ---- a/fortran/src/CMakeLists.txt -+++ b/fortran/src/CMakeLists.txt -@@ -595,7 +595,11 @@ install ( - ) - - if (NOT WIN32 AND NOT MINGW) -- set (_PKG_CONFIG_COMPILER ${CMAKE_Fortran_COMPILER}) -+ if (HDF5_ENABLE_PARALLEL AND MPI_Fortran_FOUND) -+ set (_PKG_CONFIG_COMPILER ${MPI_Fortran_COMPILER}) -+ else () -+ set (_PKG_CONFIG_COMPILER ${CMAKE_Fortran_COMPILER}) -+ endif () - configure_file ( - ${HDF_RESOURCES_DIR}/libh5cc.in - ${HDF5_BINARY_DIR}/CMakeFiles/h5fc -diff --git a/hl/c++/src/CMakeLists.txt b/hl/c++/src/CMakeLists.txt -index 1eac9fe..e488656 100644 ---- a/hl/c++/src/CMakeLists.txt -+++ b/hl/c++/src/CMakeLists.txt -@@ -120,7 +120,11 @@ install ( - ) - - if (NOT WIN32 AND NOT MINGW) -- set (_PKG_CONFIG_COMPILER ${CMAKE_CXX_COMPILER}) -+ if (HDF5_ENABLE_PARALLEL AND MPI_CXX_FOUND) -+ set (_PKG_CONFIG_COMPILER ${MPI_CXX_COMPILER}) -+ else () -+ set (_PKG_CONFIG_COMPILER ${CMAKE_CXX_COMPILER}) -+ endif () - configure_file ( - ${HDF_RESOURCES_DIR}/libh5cc.in - ${HDF5_BINARY_DIR}/CMakeFiles/h5hlc++ -diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt -index b309e92..c889736 100644 ---- a/hl/fortran/src/CMakeLists.txt -+++ b/hl/fortran/src/CMakeLists.txt -@@ -260,7 +260,11 @@ install ( - ) - - if (NOT WIN32 AND NOT MINGW) -- set (_PKG_CONFIG_COMPILER ${CMAKE_Fortran_COMPILER}) -+ if (HDF5_ENABLE_PARALLEL AND MPI_Fortran_FOUND) -+ set (_PKG_CONFIG_COMPILER ${MPI_Fortran_COMPILER}) -+ else () -+ set (_PKG_CONFIG_COMPILER ${CMAKE_Fortran_COMPILER}) -+ endif () - configure_file ( - ${HDF_RESOURCES_DIR}/libh5cc.in - ${HDF5_BINARY_DIR}/CMakeFiles/h5hlfc -diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt -index cc5aca5..d07f354 100644 ---- a/hl/src/CMakeLists.txt -+++ b/hl/src/CMakeLists.txt -@@ -148,7 +148,11 @@ install ( - ) - - if (NOT WIN32 AND NOT MINGW) -- set (_PKG_CONFIG_COMPILER ${CMAKE_C_COMPILER}) -+ if (HDF5_ENABLE_PARALLEL AND MPI_C_FOUND) -+ set (_PKG_CONFIG_COMPILER ${MPI_C_COMPILER}) -+ else () -+ set (_PKG_CONFIG_COMPILER ${CMAKE_C_COMPILER}) -+ endif () - configure_file ( - ${HDF_RESOURCES_DIR}/libh5cc.in - ${HDF5_BINARY_DIR}/CMakeFiles/h5hlcc -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 217c55d..521d3fd 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -1129,7 +1129,11 @@ install ( - ) - - if (NOT WIN32) -- set (_PKG_CONFIG_COMPILER ${CMAKE_C_COMPILER}) -+ if (HDF5_ENABLE_PARALLEL AND MPI_C_FOUND) -+ set (_PKG_CONFIG_COMPILER ${MPI_C_COMPILER}) -+ else () -+ set (_PKG_CONFIG_COMPILER ${CMAKE_C_COMPILER}) -+ endif () - configure_file ( - ${HDF_RESOURCES_DIR}/libh5cc.in - ${HDF5_BINARY_DIR}/CMakeFiles/h5cc -@@ -1141,4 +1145,18 @@ if (NOT WIN32) - PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE - COMPONENT libraries - ) -+ if (HDF5_ENABLE_PARALLEL AND MPI_C_FOUND) -+ #legacy requires a different name -+ configure_file ( -+ ${HDF_RESOURCES_DIR}/libh5cc.in -+ ${HDF5_BINARY_DIR}/CMakeFiles/h5pcc -+ @ONLY -+ ) -+ install ( -+ FILES ${HDF5_BINARY_DIR}/CMakeFiles/h5pcc -+ DESTINATION ${HDF5_INSTALL_BIN_DIR} -+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE -+ COMPONENT libraries -+ ) -+ endif () - endif () diff --git a/var/spack/repos/builtin/packages/hdf5/nag.mpi.libtool.patch b/var/spack/repos/builtin/packages/hdf5/nag.mpi.libtool.patch deleted file mode 100644 index a6fcb1e9a9..0000000000 --- a/var/spack/repos/builtin/packages/hdf5/nag.mpi.libtool.patch +++ /dev/null @@ -1,62 +0,0 @@ ---- a/bin/ltmain.sh -+++ b/bin/ltmain.sh -@@ -8881,7 +8881,8 @@ func_mode_link () - xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" - verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" - # On Darwin other compilers -- case $CC in -+ func_cc_basename $CC -+ case $func_cc_basename_result in - nagfor*) - verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" - ;; ---- a/configure -+++ b/configure -@@ -12817,6 +12817,15 @@ func_cc_basename () - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; -+ mpicc | *[\\/]mpicc | \ -+ mpic++ | *[\\/]mpic++ | mpicxx | *[\\/]mpicxx | mpiCC | *[\\/]mpiCC | \ -+ mpif77 | *[\\/]mpif77 | mpif90 | *[\\/]mpif90 | mpifort | *[\\/]mpifort ) -+ # OpenMPI or MPICH wrapper -+ mpi_cc_temp= -+ mpi_show=`$cc_temp -show 2>/dev/null` -+ test $? -eq 0 && mpi_cc_temp=`$ECHO "$mpi_show" | cut -d' ' -f1` -+ test -z $mpi_cc_temp >/dev/null 2>&1 || cc_temp=$mpi_cc_temp -+ break;; - *) break;; - esac - done -@@ -33230,6 +33239,15 @@ func_cc_basename () - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; -+ mpicc | *[\\/]mpicc | \ -+ mpic++ | *[\\/]mpic++ | mpicxx | *[\\/]mpicxx | mpiCC | *[\\/]mpiCC | \ -+ mpif77 | *[\\/]mpif77 | mpif90 | *[\\/]mpif90 | mpifort | *[\\/]mpifort ) -+ # OpenMPI or MPICH wrapper -+ mpi_cc_temp= -+ mpi_show=`$cc_temp -show 2>/dev/null` -+ test $? -eq 0 && mpi_cc_temp=`$ECHO "$mpi_show" | cut -d' ' -f1` -+ test -z $mpi_cc_temp >/dev/null 2>&1 || cc_temp=$mpi_cc_temp -+ break;; - *) break;; - esac - done -@@ -36300,6 +36318,15 @@ func_cc_basename () - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; -+ mpicc | *[\\/]mpicc | \ -+ mpic++ | *[\\/]mpic++ | mpicxx | *[\\/]mpicxx | mpiCC | *[\\/]mpiCC | \ -+ mpif77 | *[\\/]mpif77 | mpif90 | *[\\/]mpif90 | mpifort | *[\\/]mpifort ) -+ # OpenMPI or MPICH wrapper -+ mpi_cc_temp= -+ mpi_show=`$cc_temp -show 2>/dev/null` -+ test $? -eq 0 && mpi_cc_temp=`$ECHO "$mpi_show" | cut -d' ' -f1` -+ test -z $mpi_cc_temp >/dev/null 2>&1 || cc_temp=$mpi_cc_temp -+ break;; - *) break;; - esac - done diff --git a/var/spack/repos/builtin/packages/hdf5/package.py b/var/spack/repos/builtin/packages/hdf5/package.py index 99cb1e4975..adc0510f43 100644 --- a/var/spack/repos/builtin/packages/hdf5/package.py +++ b/var/spack/repos/builtin/packages/hdf5/package.py @@ -3,9 +3,12 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) +import os import shutil import sys +import llnl.util.tty as tty + class Hdf5(CMakePackage): """HDF5 is a data model, library, and file format for storing and managing @@ -23,7 +26,9 @@ class Hdf5(CMakePackage): test_requires_compiler = True - version('develop', branch='develop') + # The 'develop' version is renamed so that we could uninstall (or patch) it + # without affecting other develop version. + version('develop-1.13', branch='develop') version('develop-1.12', branch='hdf5_1_12') version('develop-1.10', branch='hdf5_1_10') version('develop-1.8', branch='hdf5_1_8') @@ -66,17 +71,13 @@ class Hdf5(CMakePackage): variant('tools', default=True, description='Enable building tools') variant('mpi', default=True, description='Enable MPI support') variant('szip', default=False, description='Enable szip support') - variant('pic', default=True, - description='Produce position-independent code (for shared libs)') # Build HDF5 with API compatibility. - variant('api', default='default', description='Choose api compatibility for earlier version', values=('default', 'v114', 'v112', 'v110', 'v18', 'v16'), multi=False) - - conflicts('api=v114', when='@1.6:1.12.99', msg='v114 is not compatible with this release') - conflicts('api=v112', when='@1.6:1.10.99', msg='v112 is not compatible with this release') - conflicts('api=v110', when='@1.6:1.8.99', msg='v110 is not compatible with this release') - conflicts('api=v18', when='@1.6:1.6.99', msg='v18 is not compatible with this release') + variant('api', default='default', + description='Choose api compatibility for earlier version', + values=('default', 'v114', 'v112', 'v110', 'v18', 'v16'), + multi=False) - depends_on('cmake@3.12:') + depends_on('cmake@3.12:', type='build') depends_on('mpi', when='+mpi') depends_on('java', type=('build', 'run'), when='+java') @@ -86,16 +87,24 @@ class Hdf5(CMakePackage): depends_on('szip', when='+szip') depends_on('zlib@1.1.2:') + # The compiler wrappers (h5cc, h5fc, etc.) run 'pkg-config'. + depends_on('pkgconfig', type='run') + + conflicts('api=v114', when='@1.6:1.12.99', + msg='v114 is not compatible with this release') + conflicts('api=v112', when='@1.6:1.10.99', + msg='v112 is not compatible with this release') + conflicts('api=v110', when='@1.6:1.8.99', + msg='v110 is not compatible with this release') + conflicts('api=v18', when='@1.6:1.6.99', + msg='v18 is not compatible with this release') + # The Java wrappers and associated libhdf5_java library # were first available in 1.10 conflicts('+java', when='@:1.9') # The Java wrappers cannot be built without shared libs. conflicts('+java', when='~shared') - # Earlier versions of HDF5 will not correctly find szip without the patches - # in the <version>_cmake.patch files - conflicts('+szip', when='@:1.8.19,1.9.0:1.10.5') - # There are several officially unsupported combinations of the features: # 1. Thread safety is not guaranteed via high-level C-API but in some cases # it works. @@ -147,20 +156,6 @@ class Hdf5(CMakePackage): patch('hdf5_1.8_gcc10.patch', when='@:1.8.21', sha256='0e20187cda3980a4fdff410da92358b63de7ebef2df1d7a425371af78e50f666') - # Libtool fails to recognize NAG compiler behind the MPI wrappers and apply - # correct linker flags enabling shared libraries. # We support only versions - # based on Libtool 2.4.6. - patch('nag.mpi.libtool.patch', when='@1.8.18:%nag+fortran+mpi+shared') - - patch('1.12.0_cmake.patch', when='@1.12.0', - sha256='e5b3bc2eecb693e88ce084dfceb35fdce68a0749945173c4bff7cf29fa81de4c') - patch('1.10.7_cmake.patch', when='@1.10.6:1.10.7', - sha256='dd9491bbe833b13929cb14b52137f7f44a539b4bfc89fc31e6e50a36e3e1b171') - patch('1.8.22_cmake.patch', when='@1.8.22', - sha256='2ca847df0f4aa24e8fe9aa7f156d48aae505a0226ca8df5d3e9b21d8087035bd') - patch('1.8.21_cmake.patch', when='@1.8.21', - sha256='b6a39255b2cc4fdf5767969a3f0cf83fc278b1750221b55ad48352a6ee3e4071') - # The argument 'buf_size' of the C function 'h5fget_file_image_c' is # declared as intent(in) though it is modified by the invocation. As a # result, aggressive compilers such as Fujitsu's may do a wrong @@ -177,28 +172,41 @@ class Hdf5(CMakePackage): 'fortran/src/H5Fff_F03.f90', string=True, ignore_absent=True) - filter_compiler_wrappers('h5cc', 'h5c++', 'h5fc', - 'h5pcc', 'h5pfc', relative_root='bin') + # The parallel compiler wrappers (i.e. h5pcc, h5pfc, etc.) reference MPI + # compiler wrappers and do not need to be changed. + filter_compiler_wrappers('h5cc', 'h5hlcc', + 'h5fc', 'h5hlfc', + 'h5c++', 'h5hlc++', + relative_root='bin') def url_for_version(self, version): url = "https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-{0}/hdf5-{1}/src/hdf5-{1}.tar.gz" return url.format(version.up_to(2), version) def flag_handler(self, name, flags): - if '+pic' in self.spec: - if name == "cflags": - flags.append(self.compiler.cc_pic_flag) - elif name == "cxxflags": - flags.append(self.compiler.cxx_pic_flag) - elif name == "fflags": - flags.append(self.compiler.fc_pic_flag) - - # Quiet warnings/errors about implicit declaration of functions in C99 - if name == "cflags": - if "%clang" in self.spec or "%gcc" in self.spec: - flags.append("-Wno-implicit-function-declaration") + cmake_flags = [] - return (None, None, flags) + if name == "cflags": + if "clang" in self.compiler.cc or "gcc" in self.compiler.cc: + # Quiet warnings/errors about implicit declaration of functions + # in C99: + cmake_flags.append("-Wno-implicit-function-declaration") + if self.spec.satisfies('@:1.8.12~shared'): + # More recent versions set CMAKE_POSITION_INDEPENDENT_CODE to + # True and build with PIC flags. + cmake_flags.append(self.compiler.cc_pic_flag) + elif name == 'cxxflags': + if self.spec.satisfies('@:1.8.12+cxx~shared'): + cmake_flags.append(self.compiler.cxx_pic_flag) + elif name == "fflags": + if self.spec.satisfies('@:1.8.12+fortran~shared'): + cmake_flags.append(self.compiler.fc_pic_flag) + elif name == "ldlibs": + if '+fortran %fj' in self.spec: + cmake_flags.extend(['-lfj90i', '-lfj90f', + '-lfjsrcinfo', '-lelf']) + + return flags, None, (cmake_flags or None) @property def libs(self): @@ -220,10 +228,32 @@ class Hdf5(CMakePackage): query2libraries = { tuple(): ['libhdf5'], ('cxx', 'fortran', 'hl', 'java'): [ - 'libhdf5hl_fortran', + # When installed with Autotools, the basename of the real + # library file implementing the High-level Fortran interface is + # 'libhdf5hl_fortran'. Starting versions 1.8.22, 1.10.5 and + # 1.12.0, the Autotools installation also produces a symbolic + # link 'libhdf5_hl_fortran.<so/a>' to + # 'libhdf5hl_fortran.<so/a>'. Note that in the case of the + # dynamic library, the latter is a symlink to the real sonamed + # file 'libhdf5_fortran.so.<abi-version>'. This means that all + # dynamically linked executables/libraries of the dependent + # packages need 'libhdf5_fortran.so.<abi-version>' with the same + # DT_SONAME entry. However, the CMake installation (at least + # starting version 1.8.10) does not produce it. Instead, the + # basename of the library file is 'libhdf5_hl_fortran'. Which + # means that switching to CMake requires rebuilding of all + # dependant packages that use the High-level Fortran interface. + # Therefore, we do not try to preserve backward compatibility + # with Autotools installations by creating symlinks. The only + # packages that could benefit from it would be those that + # hardcode the library name in their building systems. Such + # packages should simply be patched. + 'libhdf5_hl_fortran', + 'libhdf5_hl_f90cstub', 'libhdf5_hl_cpp', 'libhdf5_hl', 'libhdf5_fortran', + 'libhdf5_f90cstub', 'libhdf5_java', 'libhdf5', ], @@ -233,9 +263,11 @@ class Hdf5(CMakePackage): 'libhdf5', ], ('fortran', 'hl'): [ - 'libhdf5hl_fortran', + 'libhdf5_hl_fortran', + 'libhdf5_hl_f90cstub', 'libhdf5_hl', 'libhdf5_fortran', + 'libhdf5_f90cstub', 'libhdf5', ], ('hl',): [ @@ -244,6 +276,7 @@ class Hdf5(CMakePackage): ], ('cxx', 'fortran'): [ 'libhdf5_fortran', + 'libhdf5_f90cstub', 'libhdf5_cpp', 'libhdf5', ], @@ -253,6 +286,7 @@ class Hdf5(CMakePackage): ], ('fortran',): [ 'libhdf5_fortran', + 'libhdf5_f90cstub', 'libhdf5', ], ('java',): [ @@ -269,6 +303,10 @@ class Hdf5(CMakePackage): libraries, root=self.prefix, shared=shared, recursive=True ) + @when('@:1.8.21,1.10.0:1.10.5+szip') + def setup_build_environment(self, env): + env.set('SZIP_INSTALL', self.spec['szip'].prefix) + @run_before('cmake') def fortran_check(self): if '+fortran' in self.spec and not self.compiler.fc: @@ -278,15 +316,27 @@ class Hdf5(CMakePackage): def cmake_args(self): spec = self.spec - # Always enable this option. This does not actually enable any - # features: it only *allows* the user to specify certain - # combinations of other arguments. Enabling it just skips a - # sanity check in configure, so this doesn't merit a variant. + if spec.satisfies('@:1.8.15+shared'): + tty.warn('hdf5@:1.8.15+shared does not produce static libraries') + args = [ + # Always enable this option. This does not actually enable any + # features: it only *allows* the user to specify certain + # combinations of other arguments. self.define('ALLOW_UNSUPPORTED', True), + # Speed-up the building by skipping the examples: + self.define('HDF5_BUILD_EXAMPLES', False), + self.define( + 'BUILD_TESTING', + self.run_tests or + # Version 1.8.22 fails to build the tools when shared libraries + # are enabled but the tests are disabled. + spec.satisfies('@1.8.22+shared+tools')), self.define('HDF5_ENABLE_Z_LIB_SUPPORT', True), self.define_from_variant('HDF5_ENABLE_SZIP_SUPPORT', 'szip'), + self.define_from_variant('HDF5_ENABLE_SZIP_ENCODING', 'szip'), self.define_from_variant('BUILD_SHARED_LIBS', 'shared'), + self.define('ONLY_SHARED_LIBS', False), self.define_from_variant('HDF5_ENABLE_PARALLEL', 'mpi'), self.define_from_variant('HDF5_ENABLE_THREADSAFE', 'threadsafe'), self.define_from_variant('HDF5_BUILD_HL_LIB', 'hl'), @@ -296,57 +346,90 @@ class Hdf5(CMakePackage): self.define_from_variant('HDF5_BUILD_TOOLS', 'tools') ] - if '+szip' in spec: - args.append(self.define('HDF5_ENABLE_SZIP_ENCODING', True)) - api = spec.variants['api'].value if api != 'default': args.append(self.define('DEFAULT_API_VERSION', api)) - # The variable CMAKE_POSITION_INDEPENDENT_CODE is set to True by default in - # HDF5 Cmake code; this should insure that it is off if '~pic' in spec. The - # flags that were previously set for '+pic' in the Autotools version are kept - # in case CMake doesn't set them as expected. Both the 'pic' variant and the - # CMAKE_POSITION_INDEPENDENT_CODE variable are True by default, but '~pic' - # should disable them both. - args.append(self.define_from_variant('CMAKE_POSITION_INDEPENDENT_CODE', 'pic')) - if '+pic' in spec: - # use global spack compiler flags - _flags = self.compiler.cc_pic_flag - _flags += " " + ' '.join(spec.compiler_flags['cflags']) - args.append('CFLAGS={0}'.format(_flags)) - - if '+cxx' in spec: - _flags = self.compiler.cxx_pic_flag - _flags += " " + ' '.join(spec.compiler_flags['cxxflags']) - args.append('CXXFLAGS={0}'.format(_flags)) - - if '+fortran' in spec: - _flags = self.compiler.fc_pic_flag - _flags += " " + ' '.join(spec.compiler_flags['fflags']) - args.append('FCFLAGS={0}'.format(_flags)) - - # Fujitsu Compiler does not add Fortran runtime in rpath. - if '+fortran %fj' in spec: - args.append('LDFLAGS=-lfj90i -lfj90f -lfjsrcinfo -lelf') - if '+mpi' in spec: - # The HDF5 configure script warns if cxx and mpi are enabled - # together. There doesn't seem to be a real reason for this, except - # that parts of the MPI interface are not accessible via the C++ - # interface. Since they are still accessible via the C interface, - # this is not actually a problem. - args.append('CC=%s' % self.spec['mpi'].mpicc) + args.append(self.define('CMAKE_C_COMPILER', spec['mpi'].mpicc)) if '+cxx' in self.spec: - args.append('CXX=%s' % self.spec['mpi'].mpicxx) + args.append(self.define('CMAKE_CXX_COMPILER', + spec['mpi'].mpicxx)) if '+fortran' in self.spec: - args.append('FC=%s' % self.spec['mpi'].mpifc) + args.append(self.define('CMAKE_Fortran_COMPILER', + spec['mpi'].mpifc)) return args @run_after('install') + def ensure_parallel_compiler_wrappers(self): + # When installed with Autotools and starting at least version 1.8.10, + # the package produces C compiler wrapper called either 'h5cc' (when MPI + # support is disabled) or 'h5pcc' (when MPI support is enabled). The + # CMake installation produces the wrapper called 'h5cc' (regardless of + # whether MPI support is enabled) only starting versions 1.8.21, 1.10.2 + # and 1.12.0. The current develop versions also produce 'h5pcc' when MPI + # support is enabled and the file is identical to 'h5cc'. Here, we make + # sure that 'h5pcc' is available when MPI support is enabled (only for + # versions that generate 'h5cc'). + if self.spec.satisfies('@1.8.21:1.8.22,1.10.2:1.10.7,1.12.0+mpi'): + with working_dir(self.prefix.bin): + # No try/except here, fix the condition above instead: + symlink('h5cc', 'h5pcc') + + # The same as for 'h5pcc'. However, the CMake installation produces the + # Fortran compiler wrapper called 'h5fc' only starting versions 1.8.22, + # 1.10.6 and 1.12.0. The current develop versions do not produce 'h5pfc' + # at all. Here, we make sure that 'h5pfc' is available when Fortran and + # MPI support are enabled (only for versions that generate 'h5fc'). + if self.spec.satisfies('@1.8.22:1.8.999,' + '1.10.6:1.10.999,' + '1.12.0:1.12.999,' + 'develop:' + '+fortran+mpi'): + with working_dir(self.prefix.bin): + # No try/except here, fix the condition above instead: + symlink('h5fc', 'h5pfc') + + @run_after('install') + def fix_package_config(self): + # We need to fix the pkg-config files, which are also used by the + # compiler wrappers. The files are created starting versions 1.8.21, + # 1.10.2 and 1.12.0. However, they are broken (except for the version + # 1.8.22): the files are named <name>-<version>.pc but reference <name> + # packages. This was fixed in the develop versions at some point: the + # files started referencing <name>-<version> packages but got broken + # again: the files got names <name>.pc but references had not been + # updated accordingly. Another issue, which we address here, is that + # some Linux distributions install pkg-config files named hdf5.pc and we + # want to override them. Therefore, the following solution makes sure + # that each <name>-<version>.pc file is symlinked by <name>.pc and all + # references to <name>-<version> packages in the original files are + # replaced with references to <name> packages. + pc_files = find(self.prefix.lib.pkgconfig, 'hdf5*.pc', recursive=False) + + if not pc_files: + # This also tells us that the pkgconfig directory does not exist. + return + + # Replace versioned references in all pkg-config files: + filter_file( + r'(Requires(?:\.private)?:.*)(hdf5[^\s,]*)(?:-[^\s,]*)(.*)', + r'\1\2\3', *pc_files, backup=False) + + # Create non-versioned symlinks to the versioned pkg-config files: + with working_dir(self.prefix.lib.pkgconfig): + for f in pc_files: + src_filename = os.path.basename(f) + version_sep_idx = src_filename.find('-') + if version_sep_idx > -1: + tgt_filename = src_filename[:version_sep_idx] + '.pc' + if not os.path.exists(tgt_filename): + symlink(src_filename, tgt_filename) + + @run_after('install') @on_package_attributes(run_tests=True) def check_install(self): self._check_install() |