summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvvolkl <valentin.volkl@cern.ch>2020-05-05 02:40:13 +0200
committerGitHub <noreply@github.com>2020-05-04 19:40:13 -0500
commitbefd47259493aae407eec8d69b99ecb15d7df6bd (patch)
tree61a6d9eaeb3b40bfe2fdb9eb2a937e0145e9f93a
parent8e2f5ba861bee449e7ad60f7da51767c23942c75 (diff)
downloadspack-befd47259493aae407eec8d69b99ecb15d7df6bd.tar.gz
spack-befd47259493aae407eec8d69b99ecb15d7df6bd.tar.bz2
spack-befd47259493aae407eec8d69b99ecb15d7df6bd.tar.xz
spack-befd47259493aae407eec8d69b99ecb15d7df6bd.zip
[gaudi] fixes and patches (#16433)
* [gaudi] fixes and patches * Update var/spack/repos/builtin/packages/gaudi/package.py Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com> * Update var/spack/repos/builtin/packages/gaudi/package.py Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com> * Apply suggestions from code review Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com> * [gaudi] add older versions and fold +tests into +optional * [gaudi] set run environment Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
-rw-r--r--var/spack/repos/builtin/packages/gaudi/build_testing.patch13
-rw-r--r--var/spack/repos/builtin/packages/gaudi/link_target_fixes.patch106
-rw-r--r--var/spack/repos/builtin/packages/gaudi/link_target_fixes32.patch107
-rw-r--r--var/spack/repos/builtin/packages/gaudi/package.py83
-rw-r--r--var/spack/repos/builtin/packages/gaudi/python2.patch14
-rw-r--r--var/spack/repos/builtin/packages/podio/cpack.patch11
6 files changed, 315 insertions, 19 deletions
diff --git a/var/spack/repos/builtin/packages/gaudi/build_testing.patch b/var/spack/repos/builtin/packages/gaudi/build_testing.patch
new file mode 100644
index 0000000000..ee736fd6dd
--- /dev/null
+++ b/var/spack/repos/builtin/packages/gaudi/build_testing.patch
@@ -0,0 +1,13 @@
+diff --git a/GaudiExamples/CMakeLists.txt b/GaudiExamples/CMakeLists.txt
+index ef6f9fcff..672b76d26 100644
+--- a/GaudiExamples/CMakeLists.txt
++++ b/GaudiExamples/CMakeLists.txt
+@@ -0,0 +1,7 @@
++# GaudiExamples subdirectory
++if(NOT BUILD_TESTING)
++ # Ignore examples if not building tests
++ # see https://gitlab.cern.ch/atlas/atlasexternals/-/merge_requests/664#note_3395313
++ return()
++endif()
++
+
diff --git a/var/spack/repos/builtin/packages/gaudi/link_target_fixes.patch b/var/spack/repos/builtin/packages/gaudi/link_target_fixes.patch
new file mode 100644
index 0000000000..468c117b51
--- /dev/null
+++ b/var/spack/repos/builtin/packages/gaudi/link_target_fixes.patch
@@ -0,0 +1,106 @@
+diff --git a/cmake/GaudiProjectConfig.cmake b/cmake/GaudiProjectConfig.cmake
+index d7049233e..a9ef71e9a 100644
+--- a/cmake/GaudiProjectConfig.cmake
++++ b/cmake/GaudiProjectConfig.cmake
+@@ -356,6 +356,8 @@ macro(gaudi_project project version)
+ # Make sure we select the version of Python provided by LCG (if we are building in that context)
+ if(Python_config_version)
+ set(Python_config_version ${Python_config_version} CACHE STRING "LCG version of Python")
++ # Prevent special LCG versions (like 2.7.9.p1) to confuse CMake
++ string(REGEX REPLACE "([0-9]+\\.[0-9]+\\.[0-9]+).*" "\\1" Python_config_version "${Python_config_version}")
+ find_package(PythonInterp ${Python_config_version} QUIET)
+ find_package(PythonLibs ${Python_config_version} QUIET)
+ if(CMAKE_VERSION VERSION_GREATER 3.12)
+@@ -373,10 +375,10 @@ macro(gaudi_project project version)
+ #-- Set up the boost_python_version variable for the project
+ find_package(PythonInterp)
+ find_package(Boost)
+- if((Boost_VERSION GREATER 106700) OR (Boost_VERSION EQUAL 106700))
+- set(boost_python_version "${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}")
++ if((Boost_VERSION LESS 106700) OR (Boost_VERSION GREATER 1069000))
++ set(boost_python_version "")
+ else()
+- set(boost_python_version "")
++ set(boost_python_version "${Python_VERSION_MAJOR}${Python_VERSION_MINOR}")
+ endif()
+
+ #--- Allow installation on failed builds
+@@ -1620,9 +1622,24 @@ function(gaudi_resolve_link_libraries variable)
+ set(collected)
+ foreach(package ${ARGN})
+ # check if it is an actual library or a target first
++ if(NOT TARGET ${package})
++ if(package MATCHES "^Boost::(.*)$")
++ # special handling of Boost imported targets
++ find_package(Boost COMPONENTS ${CMAKE_MATCH_1} QUIET)
++ else()
++ # the target might be in a project namespace
++ foreach(_p IN LISTS used_gaudi_projects)
++ if(TARGET ${_p}::${package})
++ #message(STATUS "using ${_p}::${package} for ${package}")
++ set(package ${_p}::${package})
++ break()
++ endif()
++ endforeach()
++ endif()
++ endif()
+ if(TARGET ${package})
+ get_property(target_type TARGET ${package} PROPERTY TYPE)
+- if(NOT target_type MATCHES "(SHARED|STATIC)_LIBRARY")
++ if(NOT target_type MATCHES "(SHARED|STATIC|UNKNOWN)_LIBRARY")
+ message(FATAL_ERROR "${package} is a ${target_type}: you cannot link against it")
+ endif()
+ #message(STATUS "${package} is a TARGET")
+@@ -1670,6 +1687,19 @@ function(gaudi_resolve_link_libraries variable)
+ endforeach()
+ #message(STATUS "gaudi_resolve_link_libraries collected: ${collected}")
+ _gaudi_strip_build_type_libs(collected)
++ # resolve missing Boost::* targets, if needed
++ set(boost_components ${collected})
++ list(FILTER boost_components INCLUDE REGEX "^Boost::")
++ list(TRANSFORM boost_components REPLACE "^Boost::" "")
++ set(missing_components)
++ foreach(comp IN LISTS boost_components)
++ if(NOT TARGET Boost::${comp})
++ list(APPEND missing_components ${comp})
++ endif()
++ endforeach()
++ if(missing_components)
++ find_package(Boost COMPONENTS ${missing_components} QUIET)
++ endif()
+ #message(STATUS "gaudi_resolve_link_libraries output: ${collected}")
+ set(${variable} ${collected} PARENT_SCOPE)
+ endfunction()
+@@ -3277,6 +3307,14 @@ macro(gaudi_external_project_environment)
+ list(FIND used_gaudi_projects ${pack} gaudi_project_idx)
+ if((NOT pack STREQUAL GaudiProject) AND (gaudi_project_idx EQUAL -1))
+ message(STATUS " ${pack}")
++ if(pack STREQUAL Boost)
++ if(NOT TARGET Boost::headers)
++ # this is needed to get the non-cache variables for the packages
++ # but we do not need to call it if we do not use FindBoost.cmake (Boost >= 1.70)
++ find_package(${pack} QUIET)
++ endif()
++ endif()
++
+ if(NOT pack MATCHES "^Python(Interp|Libs)?$")
+ # this is needed to get the non-cache variables for the packages
+ find_package(${pack} QUIET)
+@@ -3325,6 +3363,17 @@ macro(gaudi_external_project_environment)
+ list(APPEND environment SET QT_XKB_CONFIG_ROOT "/usr/share/X11/xkb")
+ endif()
+ endif()
++ elseif(pack MATCHES "^boost_(.*)$")
++ # We are using BoostConfig.cmake (>=1.70) and not FindBoost.cmake
++ if(TARGET "Boost::${CMAKE_MATCH_1}")
++ set(tgt_name "Boost::${CMAKE_MATCH_1}")
++ get_property(target_type TARGET ${tgt_name} PROPERTY TYPE)
++ if(target_type MATCHES "(SHARED|UNKNOWN)_LIBRARY")
++ # FIXME: I'm not sure it's good to rely on the "_RELEASE" suffix
++ get_property(lib_path TARGET ${tgt_name} PROPERTY IMPORTED_LOCATION_RELEASE)
++ get_filename_component(${pack}_LIBRARY_DIR "${lib_path}" PATH)
++ endif()
++ endif()
+ endif()
+
+ list(APPEND binary_path ${${pack}_BINARY_PATH})
diff --git a/var/spack/repos/builtin/packages/gaudi/link_target_fixes32.patch b/var/spack/repos/builtin/packages/gaudi/link_target_fixes32.patch
new file mode 100644
index 0000000000..95339a0931
--- /dev/null
+++ b/var/spack/repos/builtin/packages/gaudi/link_target_fixes32.patch
@@ -0,0 +1,107 @@
+diff --git a/cmake/GaudiProjectConfig.cmake b/cmake/GaudiProjectConfig.cmake
+index 3da52a9c6..08c11c863 100644
+--- a/cmake/GaudiProjectConfig.cmake
++++ b/cmake/GaudiProjectConfig.cmake
+@@ -346,6 +346,8 @@ macro(gaudi_project project version)
+ # Make sure we select the version of Python provided by LCG (if we are building in that context)
+ if(Python_config_version)
+ set(Python_config_version ${Python_config_version} CACHE STRING "LCG version of Python")
++ # Prevent special LCG versions (like 2.7.9.p1) to confuse CMake
++ string(REGEX REPLACE "([0-9]+\\.[0-9]+\\.[0-9]+).*" "\\1" Python_config_version "${Python_config_version}")
+ find_package(PythonInterp ${Python_config_version} QUIET)
+ find_package(PythonLibs ${Python_config_version} QUIET)
+ if(CMAKE_VERSION VERSION_GREATER 3.12)
+@@ -363,10 +365,10 @@ macro(gaudi_project project version)
+ #-- Set up the boost_python_version variable for the project
+ find_package(PythonInterp)
+ find_package(Boost)
+- if((Boost_VERSION GREATER 106700) OR (Boost_VERSION EQUAL 106700))
+- set(boost_python_version "${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}")
++ if((Boost_VERSION LESS 106700) OR (Boost_VERSION GREATER 1069000))
++ set(boost_python_version "")
+ else()
+- set(boost_python_version "")
++ set(boost_python_version "${Python_VERSION_MAJOR}${Python_VERSION_MINOR}")
+ endif()
+
+ #--- Allow installation on failed builds
+@@ -1607,9 +1609,25 @@ function(gaudi_resolve_link_libraries variable)
+ set(collected)
+ foreach(package ${ARGN})
+ # check if it is an actual library or a target first
++ if(NOT TARGET ${package})
++ if(package MATCHES "^Boost::(.*)$")
++ # special handling of Boost imported targets
++ find_package(Boost COMPONENTS ${CMAKE_MATCH_1} QUIET)
++ else()
++ # the target might be in a project namespace
++ foreach(_p IN LISTS used_gaudi_projects)
++ if(TARGET ${_p}::${package})
++ #message(STATUS "using ${_p}::${package} for ${package}")
++ set(package ${_p}::${package})
++ break()
++ endif()
++ endforeach()
++ endif()
++ endif()
++
+ if(TARGET ${package})
+ get_property(target_type TARGET ${package} PROPERTY TYPE)
+- if(NOT target_type MATCHES "(SHARED|STATIC)_LIBRARY")
++ if(NOT target_type MATCHES "(SHARED|STATIC|UNKNOWN)_LIBRARY")
+ message(FATAL_ERROR "${package} is a ${target_type}: you cannot link against it")
+ endif()
+ #message(STATUS "${package} is a TARGET")
+@@ -1657,6 +1675,19 @@ function(gaudi_resolve_link_libraries variable)
+ endforeach()
+ #message(STATUS "gaudi_resolve_link_libraries collected: ${collected}")
+ _gaudi_strip_build_type_libs(collected)
++ # resolve missing Boost::* targets, if needed
++ set(boost_components ${collected})
++ list(FILTER boost_components INCLUDE REGEX "^Boost::")
++ list(TRANSFORM boost_components REPLACE "^Boost::" "")
++ set(missing_components)
++ foreach(comp IN LISTS boost_components)
++ if(NOT TARGET Boost::${comp})
++ list(APPEND missing_components ${comp})
++ endif()
++ endforeach()
++ if(missing_components)
++ find_package(Boost COMPONENTS ${missing_components} QUIET)
++ endif()
+ #message(STATUS "gaudi_resolve_link_libraries output: ${collected}")
+ set(${variable} ${collected} PARENT_SCOPE)
+ endfunction()
+@@ -3262,6 +3293,14 @@ macro(gaudi_external_project_environment)
+ list(FIND used_gaudi_projects ${pack} gaudi_project_idx)
+ if((NOT pack STREQUAL GaudiProject) AND (gaudi_project_idx EQUAL -1))
+ message(STATUS " ${pack}")
++ if(pack STREQUAL Boost)
++ if(NOT TARGET Boost::headers)
++ # this is needed to get the non-cache variables for the packages
++ # but we do not need to call it if we do not use FindBoost.cmake (Boost >= 1.70)
++ find_package(${pack} QUIET)
++ endif()
++ endif()
++
+ if(NOT pack MATCHES "^Python(Interp|Libs)?$")
+ # this is needed to get the non-cache variables for the packages
+ find_package(${pack} QUIET)
+@@ -3310,6 +3349,17 @@ macro(gaudi_external_project_environment)
+ list(APPEND environment SET QT_XKB_CONFIG_ROOT "/usr/share/X11/xkb")
+ endif()
+ endif()
++ elseif(pack MATCHES "^boost_(.*)$")
++ # We are using BoostConfig.cmake (>=1.70) and not FindBoost.cmake
++ if(TARGET "Boost::${CMAKE_MATCH_1}")
++ set(tgt_name "Boost::${CMAKE_MATCH_1}")
++ get_property(target_type TARGET ${tgt_name} PROPERTY TYPE)
++ if(target_type MATCHES "(SHARED|UNKNOWN)_LIBRARY")
++ # FIXME: I'm not sure it's good to rely on the "_RELEASE" suffix
++ get_property(lib_path TARGET ${tgt_name} PROPERTY IMPORTED_LOCATION_RELEASE)
++ get_filename_component(${pack}_LIBRARY_DIR "${lib_path}" PATH)
++ endif()
++ endif()
+ endif()
+
+ list(APPEND binary_path ${${pack}_BINARY_PATH})
diff --git a/var/spack/repos/builtin/packages/gaudi/package.py b/var/spack/repos/builtin/packages/gaudi/package.py
index 20f7c0f28b..beae99c3cd 100644
--- a/var/spack/repos/builtin/packages/gaudi/package.py
+++ b/var/spack/repos/builtin/packages/gaudi/package.py
@@ -11,41 +11,51 @@ class Gaudi(CMakePackage):
homepage = "http://gaudi.web.cern.ch/gaudi/"
git = "https://gitlab.cern.ch/gaudi/Gaudi.git"
+ url = "https://gitlab.cern.ch/gaudi/Gaudi/-/archive/v33r1/Gaudi-v33r1.tar.gz"
- version('develop', branch='master')
- version('30.5', commit='2c70e73ee5b543b26197b90dd59ea4e4d359d230')
+ version('master', branch='master')
+ # major cmake config overhaul already in use by some
+ version('develop', git='https://gitlab.cern.ch/clemenci/Gaudi.git', branch='cmake-modernisation')
+ version('33.1', sha256='7eb6b2af64aeb965228d4b6ea66c7f9f57f832f93d5b8ad55c9105235af5b042')
+ version('33.0', sha256='76a967c41f579acc432593d498875dd4dc1f8afd5061e692741a355a9cf233c8')
+ version('32.2', sha256='e9ef3eb57fd9ac7b9d5647e278a84b2e6263f29f0b14dbe1321667d44d969d2e')
version('31.0', commit='aeb156f0c40571b5753a9e1dab31e331491b2f3e')
+ version('30.5', commit='2c70e73ee5b543b26197b90dd59ea4e4d359d230')
+
+ maintainers = ['drbenmorgan', "vvolkl"]
- variant('tests', default=False,
- description='Prepare to run the test suite')
variant('optional', default=False,
- description='Build most optional components')
+ description='Build most optional components and tests')
variant('vtune', default=False,
description='Build with Intel VTune profiler support')
+ # only build subdirectory GaudiExamples when +optional
+ patch("build_testing.patch", when="@:33.1")
+ # fix for the new cmake config, should be merged in branch
+ patch('python2.patch', when="@develop")
+ # fixes for the cmake config which could not find newer boost versions
+ patch("link_target_fixes.patch", when="@33.0:33.1")
+ patch("link_target_fixes32.patch", when="@:32.2")
+
# These dependencies are needed for a minimal Gaudi build
depends_on('boost@1.67.0: +python')
depends_on('cmake', type='build')
+ depends_on('cppgsl')
depends_on('intel-tbb')
depends_on('libuuid')
- depends_on('python@:2.99.99')
- depends_on('py-xenv@develop_2018-12-20:')
+ # some bugs with python 3.8
+ depends_on('python@:3.7.99', when='@32.2:', type=('build', 'run'))
+ depends_on('python@:2.99.99', when='@:32.1', type=('build', 'run'))
+ depends_on('py-setuptools@:45.99.99', when='^python@:2.7.99', type='build')
+ depends_on('py-six', type=('build', 'run'))
+ depends_on('py-xenv@develop_2018-12-20:', type=('build', 'run'))
depends_on('range-v3')
depends_on('root +python +root7 +ssl +tbb +threads')
depends_on('zlib')
- # These dependencies are required by the Gaudi test suite
- depends_on('aida', when='+tests')
- depends_on('clhep', when='+tests')
- depends_on('cppunit', when='+tests')
- depends_on('gdb', when='+tests')
- depends_on('gperftools', when='+tests')
- depends_on('heppdt@:2.99.99', when='+tests')
- depends_on('py-networkx', when='+tests')
- depends_on('py-nose', when='+tests')
- depends_on('py-setuptools', when='+tests')
- depends_on('relax', when='+tests')
- depends_on('xerces-c', when='+tests')
+ # todo: this should be a test dependency only,
+ # should be fixed in the cmake-modernisation branch
+ depends_on('py-nose', when="@develop", type=('build', 'run'))
# Adding these dependencies triggers the build of most optional components
depends_on('aida', when='+optional')
@@ -54,11 +64,16 @@ class Gaudi(CMakePackage):
depends_on('cppunit', when='+optional')
depends_on('doxygen +graphviz', when='+optional')
depends_on('gperftools', when='+optional')
+ depends_on('gdb', when='+optional')
depends_on('gsl', when='+optional')
depends_on('heppdt@:2.99.99', when='+optional')
depends_on('jemalloc', when='+optional')
depends_on('libpng', when='+optional')
depends_on('libunwind', when='+optional')
+ depends_on('py-networkx@:2.2', when='+optional ^python@:2.7.99')
+ depends_on('py-networkx', when='+optional ^python@3.0.0:')
+ depends_on('py-setuptools', when='+optional')
+ depends_on('py-nose', when='+optional')
depends_on('relax', when='+optional')
depends_on('xerces-c', when='+optional')
# NOTE: pocl cannot be added as a minimal OpenCL implementation because
@@ -66,3 +81,33 @@ class Gaudi(CMakePackage):
# The Intel VTune dependency is taken aside because it requires a license
depends_on('intel-parallel-studio -mpi +vtune', when='+vtune')
+
+ def cmake_args(self):
+ args = [
+ self.define_from_variant("BUILD_TESTING", "optional"),
+ self.define_from_variant("GAUDI_USE_AIDA", "optional"),
+ self.define_from_variant("GAUDI_USE_XERCESC", "optional"),
+ self.define_from_variant("GAUDI_USE_CLHEP", "optional"),
+ self.define_from_variant("GAUDI_USE_HEPPDT", "optional"),
+ self.define_from_variant("GAUDI_USE_CPPUNIT", "optional"),
+ self.define_from_variant("GAUDI_USE_UNWIND", "optional"),
+ self.define_from_variant("GAUDI_USE_GPERFTOOLS", "optional"),
+ self.define_from_variant("GAUDI_USE_DOXYGEN", "optional"),
+ self.define_from_variant("GAUDI_USE_INTELAMPLIFIER", "optional"),
+ self.define_from_variant("GAUDI_USE_JEMALLOC", "optional"),
+ # this is not really used in spack builds, but needs to be set
+ "-DHOST_BINARY_TAG=x86_64-linux-gcc9-opt",
+ ]
+ return args
+
+ def setup_run_environment(self, env):
+ # environment as in Gaudi.xenv
+ env.prepend.path('PATH', self.prefix.scripts)
+ env.prepend.path('PYTHONPATH', self.prefix.python)
+ env.prepend.path('ROOT_INCLUDE_PATH', self.prefix.include)
+
+ def url_for_version(self, version):
+ major = str(version[0])
+ minor = str(version[1])
+ url = "https://gitlab.cern.ch/gaudi/Gaudi/-/archive/v{0}r{1}/Gaudi-v{0}r{1}.tar.gz".format(major, minor)
+ return url
diff --git a/var/spack/repos/builtin/packages/gaudi/python2.patch b/var/spack/repos/builtin/packages/gaudi/python2.patch
new file mode 100644
index 0000000000..8afcebc929
--- /dev/null
+++ b/var/spack/repos/builtin/packages/gaudi/python2.patch
@@ -0,0 +1,14 @@
+diff --git a/cmake/GaudiDependencies.cmake b/cmake/GaudiDependencies.cmake
+index 7fc224cef..0323f8e5c 100644
+--- a/cmake/GaudiDependencies.cmake
++++ b/cmake/GaudiDependencies.cmake
+@@ -97,7 +97,7 @@ foreach(component IN ITEMS system filesystem regex thread python unit_test_frame
+ endforeach()
+
+ set(Python_FIND_STRATEGY VERSION) # Find latest version available
+-find_package(Python 2.7.15 ${__quiet} COMPONENTS Interpreter Development)
++find_package(Python ${__quiet} COMPONENTS Interpreter Development)
+ set_package_properties(Python PROPERTIES TYPE REQUIRED)
+
+ find_package(ROOT 6.18 ${__quiet} CONFIG COMPONENTS Core RIO Hist Thread Matrix
+`
diff --git a/var/spack/repos/builtin/packages/podio/cpack.patch b/var/spack/repos/builtin/packages/podio/cpack.patch
new file mode 100644
index 0000000000..e685f9bc13
--- /dev/null
+++ b/var/spack/repos/builtin/packages/podio/cpack.patch
@@ -0,0 +1,11 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -86,7 +86,7 @@ include(cmake/podioMacros.cmake)
+ include(CTest)
+
+ #--- enable CPack --------------------------------------------------------------
+-include(cmake/podioCPack.cmake)
++#include(cmake/podioCPack.cmake)
+
+ #--- target for Doxygen documentation ------------------------------------------
+ if(CREATE_DOC)