summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorMilton Woods <miltonjwoods@gmail.com>2018-01-03 12:43:55 +1100
committerAdam J. Stewart <ajstewart426@gmail.com>2018-01-02 19:43:55 -0600
commit6922ea588962bc1bbcdcdc93ae44e630553e29af (patch)
tree9198c04402044758530b172b3d0d5312d2b29d2c /var
parente1e24ff80e9ff9b21fdbf6f594a55a984fabf243 (diff)
downloadspack-6922ea588962bc1bbcdcdc93ae44e630553e29af.tar.gz
spack-6922ea588962bc1bbcdcdc93ae44e630553e29af.tar.bz2
spack-6922ea588962bc1bbcdcdc93ae44e630553e29af.tar.xz
spack-6922ea588962bc1bbcdcdc93ae44e630553e29af.zip
Esmf fixes for Cray, OSX and mpich (#6768)
* esmf: put .mod files in the spack compiler search path * esmf: allow building with Cray mpi * esmf: create run-path dependent libraries on osx * esmf: link fortran interface libraries when building with mpich
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/esmf/darwin_dylib_install_name.patch18
-rw-r--r--var/spack/repos/builtin/packages/esmf/package.py16
2 files changed, 31 insertions, 3 deletions
diff --git a/var/spack/repos/builtin/packages/esmf/darwin_dylib_install_name.patch b/var/spack/repos/builtin/packages/esmf/darwin_dylib_install_name.patch
new file mode 100644
index 0000000000..0f363b378c
--- /dev/null
+++ b/var/spack/repos/builtin/packages/esmf/darwin_dylib_install_name.patch
@@ -0,0 +1,18 @@
+--- a/build/common.mk 2017-11-25 17:16:31.000000000 +1100
++++ b/build/common.mk 2017-11-25 17:26:20.000000000 +1100
+@@ -3415,11 +3415,11 @@
+ mkdir tmp_$$NEXTLIB ;\
+ cd tmp_$$NEXTLIB ;\
+ $(ESMF_AREXTRACT) ../$$NEXTLIB.a ;\
+- echo $(ESMF_SL_LIBLINKER) $(ESMF_SL_LIBOPTS) -o $(ESMF_LDIR)/$$NEXTLIB.$(ESMF_SL_SUFFIX) *.o $(ESMF_SL_LIBLIBS) ;\
+- $(ESMF_SL_LIBLINKER) $(ESMF_SL_LIBOPTS) -o $(ESMF_LDIR)/$$NEXTLIB.$(ESMF_SL_SUFFIX) *.o $(ESMF_SL_LIBLIBS) ;\
++ echo $(ESMF_SL_LIBLINKER) $(ESMF_SL_LIBOPTS) -Wl,-install_name -Wl,@rpath/$$NEXTLIB.$(ESMF_SL_SUFFIX) -o $(ESMF_LDIR)/$$NEXTLIB.$(ESMF_SL_SUFFIX) *.o $(ESMF_SL_LIBLIBS) ;\
++ $(ESMF_SL_LIBLINKER) $(ESMF_SL_LIBOPTS) -Wl,-install_name -Wl,@rpath/$$NEXTLIB.$(ESMF_SL_SUFFIX) -o $(ESMF_LDIR)/$$NEXTLIB.$(ESMF_SL_SUFFIX) *.o $(ESMF_SL_LIBLIBS) ;\
+ echo Converting $$NEXTLIB.a to $$NEXTLIB\_fullylinked.$(ESMF_SL_SUFFIX) ;\
+- echo $(ESMF_SL_LIBLINKER) $(ESMF_SL_LIBOPTS) -o $(ESMF_LDIR)/$$NEXTLIB\_fullylinked.$(ESMF_SL_SUFFIX) *.o $(ESMF_CXXLINKOPTS) $(ESMF_CXXLINKPATHS) $(ESMF_CXXLINKRPATHS) $(ESMF_CXXLINKLIBS) ;\
+- $(ESMF_SL_LIBLINKER) $(ESMF_SL_LIBOPTS) -o $(ESMF_LDIR)/$$NEXTLIB\_fullylinked.$(ESMF_SL_SUFFIX) *.o $(ESMF_CXXLINKOPTS) $(ESMF_CXXLINKPATHS) $(ESMF_CXXLINKRPATHS) $(ESMF_CXXLINKLIBS) ;\
++ echo $(ESMF_SL_LIBLINKER) $(ESMF_SL_LIBOPTS) -Wl,-install_name -Wl,@rpath/$$NEXTLIB\_fullylinked.$(ESMF_SL_SUFFIX) -o $(ESMF_LDIR)/$$NEXTLIB\_fullylinked.$(ESMF_SL_SUFFIX) *.o $(ESMF_CXXLINKOPTS) $(ESMF_CXXLINKPATHS) $(ESMF_CXXLINKRPATHS) $(ESMF_CXXLINKLIBS) ;\
++ $(ESMF_SL_LIBLINKER) $(ESMF_SL_LIBOPTS) -Wl,-install_name -Wl,@rpath/$$NEXTLIB\_fullylinked.$(ESMF_SL_SUFFIX) -o $(ESMF_LDIR)/$$NEXTLIB\_fullylinked.$(ESMF_SL_SUFFIX) *.o $(ESMF_CXXLINKOPTS) $(ESMF_CXXLINKPATHS) $(ESMF_CXXLINKRPATHS) $(ESMF_CXXLINKLIBS) ;\
+ cd .. ;\
+ $(ESMF_RM) -r tmp_$$NEXTLIB ;\
+ fi ;\
diff --git a/var/spack/repos/builtin/packages/esmf/package.py b/var/spack/repos/builtin/packages/esmf/package.py
index 394e316751..cabe108dd9 100644
--- a/var/spack/repos/builtin/packages/esmf/package.py
+++ b/var/spack/repos/builtin/packages/esmf/package.py
@@ -69,6 +69,10 @@ class Esmf(MakefilePackage):
# https://sourceforge.net/p/esmf/esmf/ci/34de0ccf556ba75d35c9687dae5d9f666a1b2a18/
patch('mvapich2.patch', when='@:7.0.99')
+ # Allow different directories for creation and
+ # installation of dynamic libraries on OSX:
+ patch('darwin_dylib_install_name.patch', when='platform=darwin')
+
# Make script from mvapich2.patch executable
@run_before('build')
@when('@:7.0.99')
@@ -104,7 +108,7 @@ class Esmf(MakefilePackage):
# bin/binO/Linux.gfortran.64.default.default
os.environ['ESMF_INSTALL_BINDIR'] = 'bin'
os.environ['ESMF_INSTALL_LIBDIR'] = 'lib'
- os.environ['ESMF_INSTALL_MODDIR'] = 'mod'
+ os.environ['ESMF_INSTALL_MODDIR'] = 'include'
############
# Compiler #
@@ -149,11 +153,17 @@ class Esmf(MakefilePackage):
# ESMF_COMM must be set to indicate which MPI implementation
# is used to build the ESMF library.
if '+mpi' in spec:
- if '^mvapich2' in spec:
+ if 'platform=cray' in self.spec:
+ os.environ['ESMF_COMM'] = 'mpi'
+ elif '^mvapich2' in spec:
os.environ['ESMF_COMM'] = 'mvapich2'
elif '^mpich' in spec:
- # FIXME: mpich or mpich2?
+ # esmf@7.0.1 does not include configs for mpich3,
+ # so we start with the configs for mpich2:
os.environ['ESMF_COMM'] = 'mpich2'
+ # The mpich 3 series split apart the Fortran and C bindings,
+ # so we link the Fortran libraries when building C programs:
+ os.environ['ESMF_CXXLINKLIBS'] = '-lmpifort'
elif '^openmpi' in spec:
os.environ['ESMF_COMM'] = 'openmpi'
elif '^intel-parallel-studio+mpi' in spec: