Skip to content

Commit b6ef77c

Browse files
committed
root: Update package to spack v0.17.2
1 parent e0c7f3d commit b6ef77c

File tree

1 file changed

+131
-19
lines changed

1 file changed

+131
-19
lines changed

packages/root/package.py

Lines changed: 131 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
55

66

7+
import sys
8+
79
from spack import *
810
from spack.util.environment import is_system_path
9-
import sys
1011

1112

1213
class Root(CMakePackage):
@@ -16,6 +17,8 @@ class Root(CMakePackage):
1617
url = "https://root.cern/download/root_v6.16.00.source.tar.gz"
1718
git = "https://github.com/root-project/root.git"
1819

20+
executables = ['^root$', '^root-config$']
21+
1922
tags = ['hep']
2023

2124
maintainers = ['chissg', 'HadrienG2', 'drbenmorgan', 'vvolkl']
@@ -28,6 +31,9 @@ class Root(CMakePackage):
2831
# Development version (when more recent than production).
2932

3033
# Production version
34+
version('6.26.02', sha256='7ba96772271a726079506c5bf629c3ceb21bf0682567ed6145be30606d7cd9bb')
35+
version('6.24.06', sha256='907f69f4baca1e4f30eeb4979598ca7599b6aa803ca046e80e25b6bbaa0ef522')
36+
version('6.24.02', sha256='0507e1095e279ccc7240f651d25966024325179fa85a1259b694b56723ad7c1c')
3137
version('6.24.00', sha256='9da30548a289211c3122d47dacb07e85d35e61067fac2be6c5a5ff7bda979989')
3238
version('6.22.08', sha256='6f061ff6ef8f5ec218a12c4c9ea92665eea116b16e1cd4df4f96f00c078a2f6f')
3339
version('6.22.06', sha256='c4688784a7e946cd10b311040b6cf0b2f75125a7520e04d1af0b746505911b57')
@@ -72,7 +78,7 @@ class Root(CMakePackage):
7278
# Some ROOT versions did not honor the option to avoid building an
7379
# internal version of unuran, _cf_
7480
# https://github.com/root-project/ROOT/commit/3e60764f133218b6938e5aa4986de760e8f058d9.
75-
patch('honor-unuran-switch.patch', level=1, when='@6.08.06:6.13.99')
81+
patch('honor-unuran-switch.patch', level=1, when='@6.08.06:6.13')
7682
# 6.16.00 fails to handle particular build option combinations, _cf_
7783
# https://github.com/root-project/ROOT/commit/e0ae0483985d90a71a6cabd10d3622dfd1c15611.
7884
patch('root7-webgui.patch', level=1, when='@6.16.00')
@@ -93,6 +99,8 @@ class Root(CMakePackage):
9399
description='Enable Aqua interface')
94100
variant('davix', default=True,
95101
description='Compile with external Davix')
102+
variant('dcache', default=False,
103+
description='Enable support for dCache')
96104
variant('emacs', default=False,
97105
description='Enable Emacs support')
98106
variant('examples', default=True,
@@ -130,6 +138,8 @@ class Root(CMakePackage):
130138
variant('mysql', default=False)
131139
variant('opengl', default=True,
132140
description='Enable OpenGL support')
141+
variant('oracle', default=False,
142+
description='Enable support for Oracle databases')
133143
variant('postgres', default=False,
134144
description='Enable postgres support')
135145
variant('pythia6', default=False,
@@ -170,6 +180,8 @@ class Root(CMakePackage):
170180
description='Enable Vc for adding new types for SIMD programming')
171181
variant('vdt', default=True,
172182
description='Enable set of fast and vectorisable math functions')
183+
variant('veccore', default=False,
184+
description='Enable support for VecCore SIMD abstraction library')
173185
variant('vmc', default=False,
174186
description='Enable the Virtual Monte Carlo interface')
175187
variant('x', default=True,
@@ -189,7 +201,7 @@ class Root(CMakePackage):
189201

190202
# ###################### Dependencies ######################
191203

192-
depends_on('[email protected]:', type='build', when='@:6.16.99')
204+
depends_on('[email protected]:', type='build', when='@:6.16')
193205
depends_on('[email protected]:', type='build', when='@6.18.00:')
194206
depends_on('pkgconfig', type='build')
195207

@@ -224,7 +236,7 @@ class Root(CMakePackage):
224236
depends_on('gl2ps', when="+x+opengl")
225237

226238
# Qt4
227-
depends_on('qt@:4.999', when='+qt4')
239+
depends_on('qt@:4', when='+qt4')
228240

229241
# Python
230242
depends_on('[email protected]:', when='+python', type=('build', 'run'))
@@ -237,6 +249,7 @@ class Root(CMakePackage):
237249

238250
# Optional dependencies
239251
depends_on('davix @0.7.1:', when='+davix')
252+
depends_on('dcap', when='+dcache')
240253
depends_on('cfitsio', when='+fits')
241254
depends_on('fftw', when='+fftw')
242255
depends_on('graphviz', when='+graphviz')
@@ -245,6 +258,7 @@ class Root(CMakePackage):
245258
depends_on('mysql-client', when='+mysql')
246259
depends_on('openssl', when='+ssl')
247260
depends_on('openssl', when='+davix') # Also with davix
261+
depends_on('[email protected]', when='+oracle @:6.24.01')
248262
depends_on('postgresql', when='+postgres')
249263
depends_on('pythia6+root', when='+pythia6')
250264
depends_on('pythia8', when='+pythia8')
@@ -264,9 +278,10 @@ class Root(CMakePackage):
264278
depends_on('unuran', when='+unuran')
265279
depends_on('vc', when='+vc')
266280
depends_on('vdt', when='+vdt')
281+
depends_on('veccore', when='+veccore')
267282
depends_on('libxml2', when='+xml')
268283
depends_on('xrootd', when='+xrootd')
269-
depends_on('xrootd@:4.99.99', when='@:6.22.03 +xrootd')
284+
depends_on('xrootd@:4', when='@:6.22.03 +xrootd')
270285

271286
# ###################### Conflicts ######################
272287

@@ -275,14 +290,14 @@ class Root(CMakePackage):
275290
conflicts('%intel')
276291

277292
# ROOT <6.08 was incompatible with the GCC 5+ ABI
278-
conflicts('%[email protected]:', when='@:6.07.99')
293+
conflicts('%[email protected]:', when='@:6.07')
279294

280295
# The version of Clang featured in ROOT <6.12 fails to build with
281296
# GCC 9.2.1, which we can safely extrapolate to the GCC 9 series.
282-
conflicts('%[email protected]:', when='@:6.11.99')
297+
conflicts('%[email protected]:', when='@:6.11')
283298

284299
# ROOT <6.14 was incompatible with Python 3.7+
285-
conflicts('^[email protected]:', when='@:6.13.99 +python')
300+
conflicts('^[email protected]:', when='@:6.13 +python')
286301

287302
# See README.md
288303
conflicts('+http',
@@ -299,6 +314,98 @@ class Root(CMakePackage):
299314
conflicts('+' + pkg, when='@6.18.00:',
300315
msg='Obsolete option +{0} selected.'.format(pkg))
301316

317+
@classmethod
318+
def filter_detected_exes(cls, prefix, exes_in_prefix):
319+
result = []
320+
for exe in exes_in_prefix:
321+
# no need to check the root executable itself
322+
# we can get all information from root-config
323+
if exe.endswith('root'):
324+
continue
325+
result.append(exe)
326+
return result
327+
328+
@classmethod
329+
def determine_version(cls, exe):
330+
output = Executable(exe)('--version', output=str, error=str)
331+
# turn the output of root-config --version
332+
# (something like 6.22/06)
333+
# into the format used in this recipe (6.22.06)
334+
return output.strip().replace('/', '.')
335+
336+
@classmethod
337+
def determine_variants(cls, exes, version_str):
338+
v = [] # list of determined variants
339+
# there is a fairly direct mapping between build options ( which
340+
# root-config helpfully outputs) and variants
341+
output = Executable(exes[0])('--features', output=str, error=str)
342+
f = set(output.strip().split()) # features as reported by root-config
343+
# only multivalued variant: cxxstd
344+
if "cxx11" in f:
345+
v.append("cxxstd=11")
346+
elif "cxx14" in f:
347+
v.append("cxxstd=14")
348+
elif "cxx17" in f:
349+
v.append("cxxstd=17")
350+
351+
# helper function: check if featurename is in features, and if it is,
352+
# append variantname to variants. featurename may be a list/tuple, in
353+
# which case the variant is only added if all of them are present
354+
def _add_variant(variants, features, featurename, variantname):
355+
if isinstance(featurename, str):
356+
if featurename in features:
357+
variants.append('%s' % variantname)
358+
else:
359+
variants.append('~%s' % variantname[1:])
360+
else:
361+
if set(featurename).issubset(features):
362+
variants.append('%s' % variantname)
363+
else:
364+
variants.append('~%s' % variantname[1:])
365+
366+
_add_variant(v, f, 'cocoa', '+aqua')
367+
_add_variant(v, f, 'davix', '+davix')
368+
_add_variant(v, f, 'dcache', '+dcache')
369+
_add_variant(v, f, 'fftw3', '+fftw')
370+
_add_variant(v, f, 'fitsio', '+fits')
371+
_add_variant(v, f, ('ftgl', 'opengl'), '+opengl')
372+
_add_variant(v, f, 'gdml', '+gdml')
373+
_add_variant(v, f, 'mathmore', '+math')
374+
_add_variant(v, f, 'gviz', '+graphviz')
375+
_add_variant(v, f, 'http', '+http')
376+
_add_variant(v, f, ('imt', 'tbb'), '+tbb')
377+
_add_variant(v, f, 'jemalloc', '+jemalloc')
378+
_add_variant(v, f, 'memstat', '+memstat')
379+
_add_variant(v, f, ('minuit', 'minuit2'), '+minuit')
380+
_add_variant(v, f, 'mlp', '+mlp')
381+
_add_variant(v, f, 'mysql', '+mysql')
382+
_add_variant(v, f, 'oracle', '+oracle')
383+
_add_variant(v, f, 'pgsql', '+postgres')
384+
_add_variant(v, f, 'pythia6', '+pythia6')
385+
_add_variant(v, f, 'pythia8', '+pythia8')
386+
_add_variant(v, f, 'pyroot', '+python')
387+
_add_variant(v, f, ('qt', 'qtgsi'), '+qt4')
388+
_add_variant(v, f, 'r', '+r')
389+
_add_variant(v, f, 'roofit', '+roofit')
390+
_add_variant(v, f, ('root7', 'webui'), '+root7')
391+
_add_variant(v, f, 'rpath', '+rpath')
392+
_add_variant(v, f, 'shadowpw', '+shadow')
393+
_add_variant(v, f, 'spectrum', '+spectrum')
394+
_add_variant(v, f, 'sqlite', '+sqlite')
395+
_add_variant(v, f, 'ssl', '+ssl')
396+
_add_variant(v, f, 'table', '+table')
397+
_add_variant(v, f, 'thread', '+threads')
398+
_add_variant(v, f, 'tmva', '+tmva')
399+
_add_variant(v, f, 'unuran', '+unuran')
400+
_add_variant(v, f, 'vc', '+vc')
401+
_add_variant(v, f, 'vdt', '+vdt')
402+
_add_variant(v, f, 'veccore', '+veccore')
403+
_add_variant(v, f, 'vmc', '+vmc')
404+
_add_variant(v, f, ('x11', 'xft'), '+x')
405+
_add_variant(v, f, 'xml', '+xml')
406+
_add_variant(v, f, 'xrootd', '+xrootd')
407+
return " ".join(v)
408+
302409
@run_before('cmake')
303410
def patch_cmake(self):
304411
if self.spec.target == 'x86':
@@ -335,13 +442,16 @@ def cmake_args(self):
335442
define('shared', True),
336443
define('soversion', True),
337444
define('testing', self.run_tests),
338-
define_from_variant('thread', 'threads')
445+
define_from_variant('thread', 'threads'),
446+
# The following option makes sure that Cling will call the compiler
447+
# it was compiled with at run time; see #17488, #18078 and #23886
448+
define('CLING_CXX_PATH', self.compiler.cxx),
339449
]
340450

341451
# Options related to ROOT's ability to download and build its own
342452
# dependencies. Per Spack convention, this should generally be avoided.
343453
options += [
344-
define('builtin_afterimage', True),
454+
define_from_variant('builtin_afterimage', 'x'),
345455
define('builtin_cfitsio', False),
346456
define('builtin_davix', False),
347457
define('builtin_fftw3', False),
@@ -351,9 +461,9 @@ def cmake_args(self):
351461
define('builtin_glew', False),
352462
define('builtin_gsl', False),
353463
define('builtin_llvm', True),
354-
define('builtin_lz4', self.spec.satisfies('@6.12.02:6.12.99')),
464+
define('builtin_lz4', self.spec.satisfies('@6.12.02:6.12')),
355465
define('builtin_lzma', False),
356-
define('builtin_nlohmannjson', True),
466+
define('builtin_nlohmannjson', False),
357467
define('builtin_openssl', False),
358468
define('builtin_pcre', False),
359469
define('builtin_tbb', False),
@@ -362,7 +472,7 @@ def cmake_args(self):
362472
define('builtin_vdt', False),
363473
define('builtin_veccore', False),
364474
define('builtin_xrootd', False),
365-
define('builtin_xxhash', self.spec.satisfies('@6.12.02:6.12.99')),
475+
define('builtin_xxhash', self.spec.satisfies('@6.12.02:6.12')),
366476
define('builtin_zlib', False)
367477
]
368478

@@ -382,7 +492,7 @@ def cmake_args(self):
382492
define_from_variant('cocoa', 'aqua'),
383493
define('dataframe', True),
384494
define_from_variant('davix'),
385-
define('dcache', False),
495+
define_from_variant('dcache'),
386496
define_from_variant('fftw3', 'fftw'),
387497
define_from_variant('fitsio', 'fits'),
388498
define_from_variant('ftgl', 'opengl'),
@@ -411,7 +521,7 @@ def cmake_args(self):
411521
define_from_variant('mysql'),
412522
define('odbc', False),
413523
define_from_variant('opengl'),
414-
define('oracle', False),
524+
define_from_variant('oracle'),
415525
define_from_variant('pgsql', 'postgres'),
416526
define_from_variant('pythia6'),
417527
define_from_variant('pythia8'),
@@ -435,7 +545,7 @@ def cmake_args(self):
435545
define_from_variant('unuran'),
436546
define_from_variant('vc'),
437547
define_from_variant('vdt'),
438-
define('veccore', False),
548+
define_from_variant('veccore'),
439549
define_from_variant('vmc'),
440550
define_from_variant('webui', 'root7'), # requires root7
441551
define_from_variant('x11', 'x'),
@@ -445,7 +555,7 @@ def cmake_args(self):
445555
]
446556

447557
# Some special features
448-
if self.spec.satisfies('@6.20:'):
558+
if self.spec.satisfies('@6.20.02:'):
449559
options.append(define_from_variant('pyroot', 'python'))
450560
else:
451561
options.append(define_from_variant('python'))
@@ -504,10 +614,10 @@ def add_include_path(dep_name):
504614
env.append_path('SPACK_INCLUDE_DIRS', include_path)
505615

506616
# With that done, let's go fixing those deps
507-
if spec.satisfies('@:6.12.99'):
617+
if spec.satisfies('@:6.12'):
508618
add_include_path('zlib')
509619
if '+x' in spec:
510-
if spec.satisfies('@:6.08.99') or spec.satisfies('@6.22:'):
620+
if spec.satisfies('@:6.08') or spec.satisfies('@6.22:'):
511621
add_include_path('xextproto')
512622
add_include_path('fontconfig')
513623
add_include_path('libx11')
@@ -527,6 +637,7 @@ def setup_dependent_build_environment(self, env, dependent_spec):
527637
env.prepend_path('PYTHONPATH', self.prefix.lib)
528638
env.prepend_path('PATH', self.prefix.bin)
529639
env.append_path('CMAKE_MODULE_PATH', self.prefix.cmake)
640+
env.prepend_path('ROOT_INCLUDE_PATH', dependent_spec.prefix.include)
530641
if "+rpath" not in self.spec:
531642
env.prepend_path('LD_LIBRARY_PATH', self.prefix.lib)
532643

@@ -535,5 +646,6 @@ def setup_dependent_run_environment(self, env, dependent_spec):
535646
env.set('ROOT_VERSION', 'v{0}'.format(self.version.up_to(1)))
536647
env.prepend_path('PYTHONPATH', self.prefix.lib)
537648
env.prepend_path('PATH', self.prefix.bin)
649+
env.prepend_path('ROOT_INCLUDE_PATH', dependent_spec.prefix.include)
538650
if "+rpath" not in self.spec:
539651
env.prepend_path('LD_LIBRARY_PATH', self.prefix.lib)

0 commit comments

Comments
 (0)