summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--var/spack/repos/builtin/packages/papi/package.py87
1 files changed, 44 insertions, 43 deletions
diff --git a/var/spack/repos/builtin/packages/papi/package.py b/var/spack/repos/builtin/packages/papi/package.py
index 7ec1217640..e8401e6944 100644
--- a/var/spack/repos/builtin/packages/papi/package.py
+++ b/var/spack/repos/builtin/packages/papi/package.py
@@ -10,7 +10,7 @@ import sys
from llnl.util.filesystem import fix_darwin_install_name
-class Papi(Package):
+class Papi(AutotoolsPackage):
"""PAPI provides the tool designer and application engineer with a
consistent interface and methodology for use of the performance
counter hardware found in most major microprocessors. PAPI
@@ -42,53 +42,54 @@ class Papi(Package):
depends_on('lm-sensors', when='+lmsensors')
+ conflicts('%gcc@8:', when='@5.3.0', msg='Requires GCC version less than 8.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:')
- def setup_build_environment(self, env):
- if '+lmsensors' in self.spec and self.version >= Version('6'):
- env.set('PAPI_LMSENSORS_ROOT', self.spec['lm-sensors'].prefix)
+ configure_directory = 'src'
- def setup_run_environment(self, env):
+ def setup_build_environment(self, env):
if '+lmsensors' in self.spec and self.version >= Version('6'):
env.set('PAPI_LMSENSORS_ROOT', self.spec['lm-sensors'].prefix)
- def install(self, spec, prefix):
- if '+lmsensors' in spec:
- if self.version < Version('6'):
- with working_dir("src/components/lmsensors"):
- configure_args = [
- "--with-sensors_incdir=%s/sensors" %
- spec['lm-sensors'].headers.directories[0],
- "--with-sensors_libdir=%s" %
- spec['lm-sensors'].libs.directories[0]]
- configure(*configure_args)
- with working_dir("src"):
-
- configure_args = ["--prefix=%s" % prefix]
-
- # 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
- configure_args.append('MPICC=:')
-
- configure_args.append(
- '--with-components={0}'.format(' '.join(
- filter(lambda x: spec.variants[x].value, spec.variants))))
-
- configure(*configure_args)
-
- # Don't use <malloc.h>
- for level in [".", "*", "*/*"]:
- files = glob.iglob(join_path(level, "*.[ch]"))
- filter_file(r"\<malloc\.h\>", "<stdlib.h>", *files)
-
- make()
- make("install")
-
- # The shared library is not installed correctly on Darwin
- if sys.platform == 'darwin':
- os.rename(join_path(prefix.lib, 'libpapi.so'),
- join_path(prefix.lib, 'libpapi.dylib'))
- fix_darwin_install_name(prefix.lib)
+ setup_run_environment = setup_build_environment
+
+ def configure_args(self):
+ # 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)))
+ return options
+
+ @run_before('configure')
+ def component_configure(self):
+ configure_script = Executable('./configure')
+ if '+lmsensors' in self.spec and self.version < Version('6'):
+ with working_dir("src/components/lmsensors"):
+ configure_script(
+ "--with-sensors_incdir=%s/sensors" %
+ self.spec['lm-sensors'].headers.directories[0],
+ "--with-sensors_libdir=%s" %
+ self.spec['lm-sensors'].libs.directories[0])
+
+ @run_before('build')
+ def fix_build(self):
+ # Don't use <malloc.h>
+ for level in [".", "*", "*/*"]:
+ files = glob.iglob(join_path(level, "*.[ch]"))
+ filter_file(r"\<malloc\.h\>", "<stdlib.h>", *files)
+
+ @run_after('install')
+ def fix_darwin_install(self):
+ # The shared library is not installed correctly on Darwin
+ if sys.platform == 'darwin':
+ os.rename(join_path(self.prefix.lib, 'libpapi.so'),
+ join_path(self.prefix.lib, 'libpapi.dylib'))
+ fix_darwin_install_name(self.prefix.lib)