diff options
author | Patrick Gartung <gartung@fnal.gov> | 2020-08-01 18:02:39 -0500 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2020-08-02 13:51:14 -0700 |
commit | f29dd48101b1669b861a0410f60e2ab44dfd54db (patch) | |
tree | f16d2f00a744ce5414fd83a5bc9f97ee000dde70 /var | |
parent | ef3338a49bf4303230d08558a2b6bb8a4ae05dd8 (diff) | |
download | spack-f29dd48101b1669b861a0410f60e2ab44dfd54db.tar.gz spack-f29dd48101b1669b861a0410f60e2ab44dfd54db.tar.bz2 spack-f29dd48101b1669b861a0410f60e2ab44dfd54db.tar.xz spack-f29dd48101b1669b861a0410f60e2ab44dfd54db.zip |
Add bindist tests for macOS.
Diffstat (limited to 'var')
3 files changed, 96 insertions, 37 deletions
diff --git a/var/spack/repos/builtin.mock/packages/corge/package.py b/var/spack/repos/builtin.mock/packages/corge/package.py index 48f9ac8e6e..3bd8b34e47 100644 --- a/var/spack/repos/builtin.mock/packages/corge/package.py +++ b/var/spack/repos/builtin.mock/packages/corge/package.py @@ -6,6 +6,7 @@ from spack import * import os +import sys class Corge(Package): @@ -101,7 +102,6 @@ main(int argc, char* argv[]) return 0; } ''' - mkdirp(prefix.lib64) mkdirp('%s/corge' % prefix.include) mkdirp('%s/corge' % self.stage.source_path) with open('%s/corge_version.h' % self.stage.source_path, 'w') as f: @@ -113,6 +113,8 @@ main(int argc, char* argv[]) with open('%s/corge/corgegator.cc' % self.stage.source_path, 'w') as f: f.write(corgegator_cc) gpp = which('/usr/bin/g++') + if sys.platform == 'darwin': + gpp = which('/usr/bin/clang++') gpp('-Dcorge_EXPORTS', '-I%s' % self.stage.source_path, '-I%s' % spec['quux'].prefix.include, @@ -127,22 +129,42 @@ main(int argc, char* argv[]) '-O2', '-g', '-DNDEBUG', '-fPIC', '-o', 'corgegator.cc.o', '-c', 'corge/corgegator.cc') - gpp('-fPIC', '-O2', '-g', '-DNDEBUG', '-shared', - '-Wl,-soname,libcorge.so', '-o', 'libcorge.so', 'corge.cc.o', - '-Wl,-rpath,%s:%s::::' % - (spec['quux'].prefix.lib64, spec['garply'].prefix.lib64), - '%s/libquux.so' % spec['quux'].prefix.lib64, - '%s/libgarply.so' % spec['garply'].prefix.lib64) - gpp('-O2', '-g', '-DNDEBUG', '-rdynamic', - 'corgegator.cc.o', '-o', 'corgegator', - '-Wl,-rpath,%s:%s:%s:::' % (prefix.lib64, - spec['quux'].prefix.lib64, - spec['garply'].prefix.lib64), - 'libcorge.so', - '%s/libquux.so' % spec['quux'].prefix.lib64, - '%s/libgarply.so' % spec['garply'].prefix.lib64) + if sys.platform == 'darwin': + gpp('-fPIC', '-O2', '-g', '-DNDEBUG', '-dynamiclib', + '-install_name', '@rpath/libcorge.dylib', + '-o', 'libcorge.dylib', 'corge.cc.o', + '-Wl,-rpath,%s' % spec['quux'].prefix.lib64, + '-Wl,-rpath,%s' % spec['garply'].prefix.lib64, + '%s/libquux.dylib' % spec['quux'].prefix.lib64, + '%s/libgarply.dylib' % spec['garply'].prefix.lib64) + gpp('-O2', '-g', '-DNDEBUG', '-rdynamic', + 'corgegator.cc.o', '-o', 'corgegator', + '-Wl,-rpath,%s' % prefix.lib64, + '-Wl,-rpath,%s' % spec['quux'].prefix.lib64, + '-Wl,-rpath,%s' % spec['garply'].prefix.lib64, + 'libcorge.dylib', + '%s/libquux.dylib' % spec['quux'].prefix.lib64, + '%s/libgarply.dylib' % spec['garply'].prefix.lib64) + mkdirp(prefix.lib64) + copy('libcorge.dylib', '%s/libcorge.dylib' % prefix.lib64) + else: + gpp('-fPIC', '-O2', '-g', '-DNDEBUG', '-shared', + '-Wl,-soname,libcorge.so', '-o', 'libcorge.so', 'corge.cc.o', + '-Wl,-rpath,%s:%s::::' % + (spec['quux'].prefix.lib64, spec['garply'].prefix.lib64), + '%s/libquux.so' % spec['quux'].prefix.lib64, + '%s/libgarply.so' % spec['garply'].prefix.lib64) + gpp('-O2', '-g', '-DNDEBUG', '-rdynamic', + 'corgegator.cc.o', '-o', 'corgegator', + '-Wl,-rpath,%s' % prefix.lib64, + '-Wl,-rpath,%s' % spec['quux'].prefix.lib64, + '-Wl,-rpath,%s' % spec['garply'].prefix.lib64, + 'libcorge.so', + '%s/libquux.so' % spec['quux'].prefix.lib64, + '%s/libgarply.so' % spec['garply'].prefix.lib64) + mkdirp(prefix.lib64) + copy('libcorge.so', '%s/libcorge.so' % prefix.lib64) copy('corgegator', '%s/corgegator' % prefix.lib64) - copy('libcorge.so', '%s/libcorge.so' % prefix.lib64) copy('%s/corge/corge.h' % self.stage.source_path, '%s/corge/corge.h' % prefix.include) mkdirp(prefix.bin) diff --git a/var/spack/repos/builtin.mock/packages/garply/package.py b/var/spack/repos/builtin.mock/packages/garply/package.py index 8fa0778287..289e172c91 100644 --- a/var/spack/repos/builtin.mock/packages/garply/package.py +++ b/var/spack/repos/builtin.mock/packages/garply/package.py @@ -6,6 +6,7 @@ from spack import * import os +import sys class Garply(Package): @@ -73,7 +74,6 @@ main() garply_version_h = '''const int garply_version_major = %s; const int garply_version_minor = %s; ''' - mkdirp(prefix.lib64) mkdirp('%s/garply' % prefix.include) mkdirp('%s/garply' % self.stage.source_path) with open('%s/garply_version.h' % self.stage.source_path, 'w') as f: @@ -86,6 +86,8 @@ const int garply_version_minor = %s; self.stage.source_path, 'w') as f: f.write(garplinator_cc) gpp = which('/usr/bin/g++') + if sys.platform == 'darwin': + gpp = which('/usr/bin/clang++') gpp('-Dgarply_EXPORTS', '-I%s' % self.stage.source_path, '-O2', '-g', '-DNDEBUG', '-fPIC', @@ -96,13 +98,28 @@ const int garply_version_minor = %s; '-O2', '-g', '-DNDEBUG', '-fPIC', '-o', 'garplinator.cc.o', '-c', '%s/garply/garplinator.cc' % self.stage.source_path) - gpp('-fPIC', '-O2', '-g', '-DNDEBUG', '-shared', - '-Wl,-soname,libgarply.so', '-o', 'libgarply.so', 'garply.cc.o') - gpp('-O2', '-g', '-DNDEBUG', '-rdynamic', - 'garplinator.cc.o', '-o', 'garplinator', - '-Wl,-rpath,%s' % prefix.lib64, - 'libgarply.so') - copy('libgarply.so', '%s/libgarply.so' % prefix.lib64) + if sys.platform == 'darwin': + gpp('-fPIC', '-O2', '-g', '-DNDEBUG', '-dynamiclib', + '-Wl,-headerpad_max_install_names', '-o', 'libgarply.dylib', + '-install_name', '@rpath/libgarply.dylib', + 'garply.cc.o') + gpp('-O2', '-g', '-DNDEBUG', '-Wl,-search_paths_first', + '-Wl,-headerpad_max_install_names', + 'garplinator.cc.o', '-o', 'garplinator', + '-Wl,-rpath,%s' % prefix.lib64, + 'libgarply.dylib') + mkdirp(prefix.lib64) + copy('libgarply.dylib', '%s/libgarply.dylib' % prefix.lib64) + else: + gpp('-fPIC', '-O2', '-g', '-DNDEBUG', '-shared', + '-Wl,-soname,libgarply.so', + '-o', 'libgarply.so', 'garply.cc.o') + gpp('-O2', '-g', '-DNDEBUG', '-rdynamic', + 'garplinator.cc.o', '-o', 'garplinator', + '-Wl,-rpath,%s' % prefix.lib64, + 'libgarply.so') + mkdirp(prefix.lib64) + copy('libgarply.so', '%s/libgarply.so' % prefix.lib64) copy('garplinator', '%s/garplinator' % prefix.lib64) copy('%s/garply/garply.h' % self.stage.source_path, '%s/garply/garply.h' % prefix.include) diff --git a/var/spack/repos/builtin.mock/packages/quux/package.py b/var/spack/repos/builtin.mock/packages/quux/package.py index 6db243f154..80508d3b55 100644 --- a/var/spack/repos/builtin.mock/packages/quux/package.py +++ b/var/spack/repos/builtin.mock/packages/quux/package.py @@ -6,6 +6,7 @@ from spack import * import os +import sys class Quux(Package): @@ -87,7 +88,6 @@ main() quux_version_h = '''const int quux_version_major = %s; const int quux_version_minor = %s; ''' - mkdirp(prefix.lib64) mkdirp('%s/quux' % prefix.include) with open('%s/quux_version.h' % self.stage.source_path, 'w') as f: f.write(quux_version_h % (self.version[0], self.version[1:])) @@ -98,6 +98,8 @@ const int quux_version_minor = %s; with open('%s/quux/quuxifier.cc' % self.stage.source_path, 'w') as f: f.write(quuxifier_cc) gpp = which('/usr/bin/g++') + if sys.platform == 'darwin': + gpp = which('/usr/bin/clang++') gpp('-Dquux_EXPORTS', '-I%s' % self.stage.source_path, '-I%s' % spec['garply'].prefix.include, @@ -110,18 +112,36 @@ const int quux_version_minor = %s; '-O2', '-g', '-DNDEBUG', '-fPIC', '-o', 'quuxifier.cc.o', '-c', 'quux/quuxifier.cc') - gpp('-fPIC', '-O2', '-g', '-DNDEBUG', '-shared', - '-Wl,-soname,libquux.so', '-o', 'libquux.so', 'quux.cc.o', - '-Wl,-rpath,%s:%s::::' % (prefix.lib64, - spec['garply'].prefix.lib64), - '%s/libgarply.so' % spec['garply'].prefix.lib64) - gpp('-O2', '-g', '-DNDEBUG', '-rdynamic', - 'quuxifier.cc.o', '-o', 'quuxifier', - '-Wl,-rpath,%s:%s::::' % (prefix.lib64, - spec['garply'].prefix.lib64), - 'libquux.so', - '%s/libgarply.so' % spec['garply'].prefix.lib64) - copy('libquux.so', '%s/libquux.so' % prefix.lib64) + if sys.platform == 'darwin': + gpp('-fPIC', '-O2', '-g', '-DNDEBUG', + '-dynamiclib', '-Wl,-headerpad_max_install_names', + '-o', 'libquux.dylib', + '-install_name', '@rpath/libcorge.dylib', + 'quux.cc.o', '-Wl,-rpath,%s' % prefix.lib64, + '-Wl,-rpath,%s' % spec['garply'].prefix.lib64, + '%s/libgarply.dylib' % spec['garply'].prefix.lib64) + gpp('-O2', '-g', '-DNDEBUG', + 'quuxifier.cc.o', '-o', 'quuxifier', + '-Wl,-rpath,%s' % prefix.lib64, + '-Wl,-rpath,%s' % spec['garply'].prefix.lib64, + 'libquux.dylib', + '%s/libgarply.dylib' % spec['garply'].prefix.lib64) + mkdirp(prefix.lib64) + copy('libquux.dylib', '%s/libquux.dylib' % prefix.lib64) + else: + gpp('-fPIC', '-O2', '-g', '-DNDEBUG', '-shared', + '-Wl,-soname,libquux.so', '-o', 'libquux.so', 'quux.cc.o', + '-Wl,-rpath,%s:%s::::' % (prefix.lib64, + spec['garply'].prefix.lib64), + '%s/libgarply.so' % spec['garply'].prefix.lib64) + gpp('-O2', '-g', '-DNDEBUG', '-rdynamic', + 'quuxifier.cc.o', '-o', 'quuxifier', + '-Wl,-rpath,%s:%s::::' % (prefix.lib64, + spec['garply'].prefix.lib64), + 'libquux.so', + '%s/libgarply.so' % spec['garply'].prefix.lib64) + mkdirp(prefix.lib64) + copy('libquux.so', '%s/libquux.so' % prefix.lib64) copy('quuxifier', '%s/quuxifier' % prefix.lib64) copy('%s/quux/quux.h' % self.stage.source_path, '%s/quux/quux.h' % prefix.include) |