From 5e69125e51a88d87628c92c8308d1ee37c65d06b Mon Sep 17 00:00:00 2001 From: G-Ragghianti <33492707+G-Ragghianti@users.noreply.github.com> Date: Mon, 20 Apr 2020 17:54:44 -0400 Subject: Implemented +shared and +static_tools variants (#16105) --- var/spack/repos/builtin/packages/papi/package.py | 30 ++++++++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/papi/package.py b/var/spack/repos/builtin/packages/papi/package.py index 35dd4f9ba2..76a67f8e77 100644 --- a/var/spack/repos/builtin/packages/papi/package.py +++ b/var/spack/repos/builtin/packages/papi/package.py @@ -2,6 +2,7 @@ # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) + import glob import os import sys @@ -38,10 +39,20 @@ class Papi(AutotoolsPackage): variant('lmsensors', default=False, description='Enable lm_sensors support') variant('sde', default=False, description='Enable software defined events') + variant('shared', default=True, description='Build shared libraries') + # PAPI requires building static libraries, so there is no "static" variant + variant('static_tools', default=False, description='Statically link the PAPI tools') + # The PAPI configure option "--with-shlib-tools" is deprecated + # and therefore not implemented here + depends_on('lm-sensors', when='+lmsensors') conflicts('%gcc@8:', when='@5.3.0', msg='Requires GCC version less than 8.0') + # This is the only way to match exactly version 6.0.0 without also + # including version 6.0.0.1 due to spack version matching logic + conflicts('@5.9.99999:6.0.0.a', when='+static_tools', msg='Static tools cannot build on version 6.0.0') + # Does not build with newer versions of gcc, see # https://bitbucket.org/icl/papi/issues/46/cannot-compile-on-arch-linux patch('https://bitbucket.org/icl/papi/commits/53de184a162b8a7edff48fed01a15980664e15b1/raw', sha256='64c57b3ad4026255238cc495df6abfacc41de391a0af497c27d0ac819444a1f8', when='@5.4.0:5.6.99%gcc@8:') @@ -55,15 +66,24 @@ class Papi(AutotoolsPackage): setup_run_environment = setup_build_environment def configure_args(self): + spec = self.spec # PAPI uses MPI if MPI is present; since we don't require # an MPI package, we ensure that all attempts to use MPI # fail, so that PAPI does not get confused options = ['MPICC=:'] - # Build a list of activated variants (optional PAPI components) - variants = filter(lambda x: self.spec.variants[x].value is True, - self.spec.variants) - if variants: - options.append('--with-components={0}'.format(' '.join(variants))) + # Build a list of PAPI components + components = filter( + lambda x: spec.variants[x].value, + ['example', 'infiniband', 'powercap', 'rapl', 'lmsensors', 'sde']) + if components: + options.append('--with-components=' + ' '.join(components)) + + build_shared = 'yes' if '+shared' in spec else 'no' + options.append('--with-shared-lib=' + build_shared) + + if '+static_tools' in spec: + options.append('--with-static-tools') + return options @run_before('configure') -- cgit v1.2.3-70-g09d2