From 2de0053c08c3262eb3979ff7818f4ca505c72517 Mon Sep 17 00:00:00 2001 From: iarspider Date: Tue, 30 Jun 2020 04:35:25 +0200 Subject: New package: hepmcanalysis (#17296) * [WIP] Add hepmcanalysis package * Implement install() for hepmcanalysis * Flake-8 Co-authored-by: iarspider --- .../repos/builtin/packages/hepmcanalysis/lcg.patch | 58 ++++++++++++++++++++++ .../builtin/packages/hepmcanalysis/package.py | 47 ++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 var/spack/repos/builtin/packages/hepmcanalysis/lcg.patch create mode 100644 var/spack/repos/builtin/packages/hepmcanalysis/package.py (limited to 'var') diff --git a/var/spack/repos/builtin/packages/hepmcanalysis/lcg.patch b/var/spack/repos/builtin/packages/hepmcanalysis/lcg.patch new file mode 100644 index 0000000000..812372960c --- /dev/null +++ b/var/spack/repos/builtin/packages/hepmcanalysis/lcg.patch @@ -0,0 +1,58 @@ +--- spack-src/examples/hepmcreader/reader.cc.orig 2013-10-31 11:11:16.000000000 +0100 ++++ spack-src/examples/hepmcreader/reader.cc 2013-10-31 11:11:59.000000000 +0100 +@@ -172,7 +172,7 @@ + for (vector::const_iterator i(analysis.begin()); i != analysis.end(); ++i) { + (*i)->Finalize(f); + } +- ++f->Close(); + // clean up analysis modules and configuration + for (vector::const_iterator i(analysis.begin()); i != analysis.end(); ++i) { + delete (*i); +--- spack-src/Makefile.orig 2013-09-03 16:52:14.000000000 +0200 ++++ spack-src/Makefile 2013-09-03 16:54:04.000000000 +0200 +@@ -28,7 +28,7 @@ + @mkdir -p $(LIBDIR) + $(CXX) $(CXXFLAGS) $(INCLUDES) \ + -shared -o $(LIBDIR)/libHepMCAnalysis.so $(OBJECTS) \ +- $(HepMClib) $(HepPDTlib) $(FastJetlib) \ ++ $(HepMClib) $(HepPDTlib) $(FastJetlib) $(CLHEPlib) \ + $(ROOTGLIBS) $(LINK_LIBS) + + +--- spack-src/src/baseAnalysis.cc 2013-03-04 19:19:55.000000000 +0100 ++++ spack-src/src/baseAnalysis.cc 2014-10-03 07:36:47.000000000 +0200 +@@ -281,8 +281,8 @@ + double pe = (*p)->momentum().e(); + + // remove garbage +- if ( isnan( px ) || isnan( py ) || isnan( pz ) || isnan( pe ) || +- isinf( px ) || isinf( py ) || isinf( pz ) || isinf( pe ) ) { ++ if ( std::isnan( px ) || std::isnan( py ) || std::isnan( pz ) || std::isnan( pe ) || ++ std::isinf( px ) || std::isinf( py ) || std::isinf( pz ) || std::isinf( pe ) ) { + cout << "baseAnalysis: NaN (Not A Number) found in the event record! Particle will be skipped." << endl; + ++m_NanNum; + continue; +--- spack-src/config.mk.orig 2020-06-25 17:05:30.142357100 +0200 ++++ spack-src/config.mk 2020-06-25 17:06:24.219319861 +0200 +@@ -10,16 +10,16 @@ + # -I$(HepPDTdir)/include -I$(ROOTSYS)/include + INCLUDES = $(INCLUDEH) $(INCLUDEF) + +-ROOTGLIBS = `root-config --glibs` +-ROOTCFLAGS = `root-config --cflags` -Wno-long-long ++ROOTGLIBS = `$(ROOTSYS)/bin/root-config --glibs` ++ROOTCFLAGS = `$(ROOTSYS)/bin/root-config --cflags` -Wno-long-long + + #CLHEP = -L$(CLHEPdir)/lib -lCLHEP # causes problems in HepMCAnalysis_i interface! +-CLHEPlib = ++CLHEPlib = -L$(CLHEPdir)/lib -lCLHEP + + # common libraries + HepPDTlib = + #HepPDTlib = -L$(HepPDTdir)/lib -lHepPDT -lHepPID +-HepMClib = $(HepMCdir)/lib/libHepMC.so $(HepMCdir)/lib/libHepMCfio.a ++HepMClib = -L$(HepMCdir)/lib -lHepMC + #FastJetlib = -L$(FastJetdir)/lib -lfastjet -lSISConePlugin -lCDFConesPlugin -lsiscone -lsiscone_spherical + FastJetlib = -L$(FastJetdir)/lib -lfastjet -lfastjetplugins -lsiscone -lsiscone_spherical + diff --git a/var/spack/repos/builtin/packages/hepmcanalysis/package.py b/var/spack/repos/builtin/packages/hepmcanalysis/package.py new file mode 100644 index 0000000000..5f48eced86 --- /dev/null +++ b/var/spack/repos/builtin/packages/hepmcanalysis/package.py @@ -0,0 +1,47 @@ +# 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 Hepmcanalysis(MakefilePackage): + """The HepMCAnalysis Tool is a tool for generator + validation and comparisons.""" + + homepage = "https://hepmcanalysistool.desy.de/" + url = "https://hepmcanalysistool.desy.de/releases/HepMCAnalysis-00-03-04-13.tar.gz" + + version('3.4.13', sha256='be9937c6de493a5671258919493b0caa0cecca77853a2075f5cecce1071e0029') + + depends_on('hepmc') + depends_on('fastjet') + depends_on('root') + depends_on('clhep') + + variant('cxxstd', + default='11', + values=('11', '14', '17'), + multi=False, + description='Use the specified C++ standard when building.') + + patch('lcg.patch') + + def edit(self, spec, prefix): + filter_file(r"CXXFLAGS(.*)", r"CXXFLAGS\1 -std=c++" + + self.spec.variants['cxxstd'].value, "config.mk") + + def setup_build_environment(self, env): + env.set("HepMCdir", self.spec['hepmc'].prefix) + env.set("FastJetdir", self.spec['fastjet'].prefix) + env.set("CLHEPdir", self.spec['clhep'].prefix) + + def url_for_version(self, version): + parts = [int(x) for x in str(version).split('.')] + root = "https://hepmcanalysistool.desy.de/releases/HepMCAnalysis-00-" + return root + "{0:02d}-{1:02d}-{2:02d}.tar.gz".format(*parts) + + def install(self, spec, prefix): + install_tree('lib', prefix.lib) + install_tree('include', prefix.include) -- cgit v1.2.3-70-g09d2