summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@gmail.com>2016-04-17 01:14:34 -0400
committerTodd Gamblin <tgamblin@llnl.gov>2016-04-17 07:14:34 +0200
commit375de085e271f2926ef2381a2e22f40bd5541177 (patch)
treea87d193c2f71ec877623cdbec31756275347a8f5
parentfb4f361cd0a8f12c606013b382d7e4fa5706dbfb (diff)
downloadspack-375de085e271f2926ef2381a2e22f40bd5541177.tar.gz
spack-375de085e271f2926ef2381a2e22f40bd5541177.tar.bz2
spack-375de085e271f2926ef2381a2e22f40bd5541177.tar.xz
spack-375de085e271f2926ef2381a2e22f40bd5541177.zip
Make PAPI build on Darwin (#772)
* Make PAPI build on Darwin - don't use <malloc.h> - run install_name_tool * Use fix_darwin_install_name
-rw-r--r--var/spack/repos/builtin/packages/papi/package.py31
1 files changed, 22 insertions, 9 deletions
diff --git a/var/spack/repos/builtin/packages/papi/package.py b/var/spack/repos/builtin/packages/papi/package.py
index 53d69e28d9..74b3ea9ef9 100644
--- a/var/spack/repos/builtin/packages/papi/package.py
+++ b/var/spack/repos/builtin/packages/papi/package.py
@@ -1,5 +1,8 @@
from spack import *
+import glob
import os
+import sys
+from llnl.util.filesystem import fix_darwin_install_name
class Papi(Package):
"""PAPI provides the tool designer and application engineer with a
@@ -18,17 +21,27 @@ class Papi(Package):
version('5.3.0', '367961dd0ab426e5ae367c2713924ffb')
def install(self, spec, prefix):
- os.chdir("src/")
+ with working_dir("src"):
- configure_args=["--prefix=%s" % prefix]
+ 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=:')
+ # 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(*configure_args)
+ configure(*configure_args)
- make()
- make("install")
+ # 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)