From be068038048808c206e20b2a4d4ee41e0345f9d9 Mon Sep 17 00:00:00 2001 From: vvolkl Date: Sat, 25 Jul 2020 00:25:57 +0200 Subject: [PATCH] WHIZARD (package): add LCIO dependency, Openloops support (#17658) * WHIZARD: add versions 2.8.4 and 2.8.3 * New package: LCIO * WHIZARD: add optional dependency on LCIO * WHIZARD: add optional dependency on Openloops * WHIZARD: allow building with either hepmc or hepmc3 dependencies * Openloops: set process_lib_dir in configure * Openloops: fix reference to variant --- .../repos/builtin/packages/lcio/package.py | 72 +++++++++++++++++++ .../builtin/packages/openloops/package.py | 3 +- .../repos/builtin/packages/whizard/package.py | 41 ++++++++--- 3 files changed, 107 insertions(+), 9 deletions(-) create mode 100644 var/spack/repos/builtin/packages/lcio/package.py diff --git a/var/spack/repos/builtin/packages/lcio/package.py b/var/spack/repos/builtin/packages/lcio/package.py new file mode 100644 index 0000000000..c6ca4f6a95 --- /dev/null +++ b/var/spack/repos/builtin/packages/lcio/package.py @@ -0,0 +1,72 @@ +# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + + +from spack import * + + +class Lcio(CMakePackage): + """HEP Library for Linear Collider Input/Output""" + + homepage = "http://lcio.desy.de" + git = "https://github.com/iLCSoft/LCIO.git" + url = "https://github.com/iLCSoft/LCIO/archive/v02-13-03.tar.gz" + + maintainers = ['gaede', 'vvolkl'] + + version('master', branch='master') + version('2.13.3', sha256='35aaa7989be33574a7c44ea7e6d7780ab26ef8bd4aa29d495f3831a3cd269304') + version('2.13.2', sha256='9f153ba13e56ee16795378f9192678d40df1faca51d00aaa8fb80547bfecb8d8') + + variant('cxxstd', + default='17', + values=('11', '14', '17'), + multi=False, + description='Use the specified C++ standard when building.') + variant("jar", default=False, + description="Turn on to build/install lcio.jar") + variant("rootdict", default=True, + description="Turn on to build/install ROOT dictionary.") + variant("examples", default=False, + description="Turn on to build LCIO examples") + + depends_on('root@6.04:', when="+rootdict") + depends_on('openjdk', when="+jar") + # build error with +termlib, to be investigated + depends_on('ncurses~termlib', when="+examples") + depends_on('readline', when="+examples") + + def cmake_args(self): + args = [ + self.define('CMAKE_CXX_STANDARD', + self.spec.variants['cxxstd'].value), + self.define('BUILD_TESTING', self.run_tests), + self.define_from_variant("BUILD_LCIO_EXAMPLES", 'examples'), + self.define_from_variant("BUILD_ROOTDICT", 'rootdict'), + self.define_from_variant("INSTALL_JAR", 'jar'), + ] + return args + + def url_for_version(self, version): + base_url = self.url.rsplit('/', 1)[0] + major = str(version[0]).zfill(2) + minor = str(version[1]).zfill(2) + # handle the different cases for the patch version: + # first case, no patch version is given in spack, i.e 0.1 + if len(version) == 2: + url = base_url + "/v%s-%s.tar.gz" % (major, minor) + # a patch version is specified in spack, i.e. 0.1.x ... + elif len(version) == 3: + patch = str(version[2]).zfill(2) + # ... but it is zero, and not part of the ilc release url + if version[2] == 0: + url = base_url + "/v%s-%s.tar.gz" % (major, minor) + # ... if it is non-zero, it is part of the release url + else: + url = base_url + "/v%s-%s-%s.tar.gz" % (major, minor, patch) + else: + print('Error - Wrong version format provided') + return + return url diff --git a/var/spack/repos/builtin/packages/openloops/package.py b/var/spack/repos/builtin/packages/openloops/package.py index 884910beb3..9a1081c2b6 100644 --- a/var/spack/repos/builtin/packages/openloops/package.py +++ b/var/spack/repos/builtin/packages/openloops/package.py @@ -89,6 +89,7 @@ def configure(self, spec, prefix): f.write('[OpenLoops]\n') f.write('import_env={0}\n'.format(spack_env)) f.write('num_jobs = {0}\n'.format(njobs)) + f.write('process_lib_dir = {0}\n'.format(self.spec.prefix.proclib)) f.write('cc = {0}\n'.format(env['SPACK_CC'])) f.write('cxx = {0}\n'.format(env['SPACK_CXX'])) f.write('fortran_compiler = {0}\n'.format(env['SPACK_FC'])) @@ -110,7 +111,7 @@ def build(self, spec, prefix): def build_processes(self, spec, prefix): ol = Executable('./openloops') processes = self.spec.variants['processes'].value - if 'compile_extra' in self.spec: + if '+compile_extra' in self.spec: ce = 'compile_extra=1' else: ce = '' diff --git a/var/spack/repos/builtin/packages/whizard/package.py b/var/spack/repos/builtin/packages/whizard/package.py index 1ad8e07568..1fcb556d86 100644 --- a/var/spack/repos/builtin/packages/whizard/package.py +++ b/var/spack/repos/builtin/packages/whizard/package.py @@ -12,19 +12,26 @@ class Whizard(AutotoolsPackage): and simulated event samples.""" homepage = "whizard.hepforge.org" - url = "https://whizard.hepforge.org/downloads/?f=whizard-2.8.2.tar.gz" + url = "https://whizard.hepforge.org/downloads/?f=whizard-2.8.3.tar.gz" git = "https://gitlab.tp.nt.uni-siegen.de/whizard/public.git" maintainers = ['vvolkl'] version('master', branch="master") version('3.0.0_alpha', sha256='4636e5a10350bb67ccc98cd105bc891ea04f3393c2420f81be3d21240be20009') - version('2.8.2', sha256='32c9be342d01b3fc6f947fddce74bf2d81ece37fb39bca1f37778fb0c07e2568', prefered=True) + version('2.8.4', sha256='49893f077484470934a9d6e1545bbda7d398076568bceda00880d58132f26432', preferred=True) + version('2.8.3', sha256='96a9046682d4b992b477eb96d561c3db789207e1049b60c9bd140db40eb1e5d7') + version('2.8.2', sha256='32c9be342d01b3fc6f947fddce74bf2d81ece37fb39bca1f37778fb0c07e2568') version('2.8.1', sha256='0c759ce0598e25f38e04659f745c5963d238c4b5c12209f16449b6c0bc6dc64e') version('2.8.0', sha256='3b5175eafa879d1baca20237d18fb2b18bee89631e73ada499de9c082d009696') - variant('hepmc', default=True, - description="builds with hepmc") + variant( + 'hepmc', + default='3', + description='builds with hepmc 2/3', + values=('off', '2', '3'), + multi=False + ) variant('pythia8', default=True, description="builds with pythia8") @@ -41,15 +48,23 @@ class Whizard(AutotoolsPackage): variant('openmp', default=False, description="builds with openmp") + variant('openloops', default=False, + description="builds with openloops") + variant('latex', default=False, description="data visualization with latex") depends_on('ocaml', type='build', when="@3:") depends_on('ocaml@:4.8.2', type='build', when="@:2.99.99") - depends_on('hepmc', when="+hepmc") + depends_on('hepmc', when="hepmc=2") + depends_on('hepmc3', when="hepmc=3") + depends_on('lcio', when="+lcio") depends_on('pythia8', when="+pythia8") depends_on('lhapdf', when="+lhapdf") depends_on('fastjet', when="+fastjet") + depends_on('openloops@2.0.0: +compile_extra num_jobs=1 ' + 'processes=eett,eevvjj,ppllj,tbw', + when="+openloops") depends_on('texlive', when="+latex") depends_on('zlib') @@ -66,21 +81,31 @@ def setup_build_environment(self, env): def configure_args(self): spec = self.spec args = [ - '--enable-hepmc=%s' % ("yes" if "+hepmc" in spec else "no"), + '--enable-hepmc=%s' % ("no" if "hepmc=off" in spec else "yes"), '--enable-fastjet=%s' % ("yes" if "+fastjet" in spec else "no"), '--enable-pythia8=%s' % ("yes" if "+pythia8" in spec else "no"), '--enable-lcio=%s' % ("yes" if "+lcio" in spec else "no"), '--enable-lhapdf=%s' % ("yes" if "+lhapdf" in spec else "no"), - # todo: openloops + '--enable-openloops=%s' % ("yes" if "+openloops" in spec + else "no"), + '--with-openloops=%s' % spec['openloops'].prefix, # todo: hoppet # todo: recola # todo: looptools # todo: gosam # todo: pythia6 ] + + if "+lcio" in spec: + args.append('--with-lcio=%s' % spec['lcio'].prefix) + + if "hepmc=3" in spec: + args.append('--with-hepmc=%s' % spec['hepmc3'].prefix) + if "hepmc=2" in spec: + args.append('--with-hepmc=%s' % spec['hepmc'].prefix) + if "+openmp" not in spec: args.append('--disable-openmp') - return args def url_for_version(self, version):