diff options
-rw-r--r-- | var/spack/repos/builtin/packages/hdf/package.py | 9 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/netcdf/netcdf-4.3.3-mpi.patch | 25 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/netcdf/package.py | 34 |
3 files changed, 35 insertions, 33 deletions
diff --git a/var/spack/repos/builtin/packages/hdf/package.py b/var/spack/repos/builtin/packages/hdf/package.py index 1ecb167183..ac6435f2a2 100644 --- a/var/spack/repos/builtin/packages/hdf/package.py +++ b/var/spack/repos/builtin/packages/hdf/package.py @@ -24,12 +24,13 @@ class Hdf(Package): def install(self, spec, prefix): config_args = [ + 'CFLAGS=-fPIC', '--prefix=%s' % prefix, - '--with-jpeg=%s' % spec['jpeg'].prefix, - '--with-zlib=%s' % spec['zlib'].prefix, - '--disable-netcdf', + '--with-jpeg=%s' % spec['jpeg'].prefix, + '--with-zlib=%s' % spec['zlib'].prefix, + '--disable-netcdf', # must be disabled to build NetCDF with HDF4 support '--enable-fortran', - '--disable-shared', + '--disable-shared', # fortran and shared libraries are not compatible '--enable-static', '--enable-production' ] diff --git a/var/spack/repos/builtin/packages/netcdf/netcdf-4.3.3-mpi.patch b/var/spack/repos/builtin/packages/netcdf/netcdf-4.3.3-mpi.patch deleted file mode 100644 index 46dda5fc9d..0000000000 --- a/var/spack/repos/builtin/packages/netcdf/netcdf-4.3.3-mpi.patch +++ /dev/null @@ -1,25 +0,0 @@ -diff -Nur netcdf-4.3.3/CMakeLists.txt netcdf-4.3.3.mpi/CMakeLists.txt ---- netcdf-4.3.3/CMakeLists.txt 2015-02-12 16:44:35.000000000 -0500 -+++ netcdf-4.3.3.mpi/CMakeLists.txt 2015-10-14 16:44:41.176300658 -0400 -@@ -753,6 +753,7 @@ - SET(USE_PARALLEL OFF CACHE BOOL "") - MESSAGE(STATUS "Cannot find HDF5 library built with parallel support. Disabling parallel build.") - ELSE() -+ FIND_PACKAGE(MPI REQUIRED) - SET(USE_PARALLEL ON CACHE BOOL "") - SET(STATUS_PARALLEL "ON") - ENDIF() -diff -Nur netcdf-4.3.3/liblib/CMakeLists.txt netcdf-4.3.3.mpi/liblib/CMakeLists.txt ---- netcdf-4.3.3/liblib/CMakeLists.txt 2015-02-12 16:44:35.000000000 -0500 -+++ netcdf-4.3.3.mpi/liblib/CMakeLists.txt 2015-10-14 16:44:57.757793634 -0400 -@@ -71,6 +71,10 @@ - SET(TLL_LIBS ${TLL_LIBS} ${CURL_LIBRARY}) - ENDIF() - -+IF(USE_PARALLEL) -+ SET(TLL_LIBS ${TLL_LIBS} ${MPI_C_LIBRARIES}) -+ENDIF() -+ - IF(USE_HDF4) - SET(TLL_LIBS ${TLL_LIBS} ${HDF4_LIBRARIES}) - ENDIF() diff --git a/var/spack/repos/builtin/packages/netcdf/package.py b/var/spack/repos/builtin/packages/netcdf/package.py index 93c4410146..3cd0b2ee7a 100644 --- a/var/spack/repos/builtin/packages/netcdf/package.py +++ b/var/spack/repos/builtin/packages/netcdf/package.py @@ -12,9 +12,7 @@ class Netcdf(Package): version('4.3.3', '5fbd0e108a54bd82cb5702a73f56d2ae') variant('fortran', default=False, description="Download and install NetCDF-Fortran") - variant('hdf4', default=False, description="Enable HDF4 support") - - patch('netcdf-4.3.3-mpi.patch') + variant('hdf4', default=False, description="Enable HDF4 support") # Dependencies: depends_on("curl") # required for DAP support @@ -23,7 +21,13 @@ class Netcdf(Package): depends_on("zlib") # required for NetCDF-4 support def install(self, spec, prefix): + # Environment variables + CPPFLAGS = [] + LDFLAGS = [] + LIBS = [] + config_args = [ + "--prefix=%s" % prefix, "--enable-fsync", "--enable-v2", "--enable-utilities", @@ -37,18 +41,40 @@ class Netcdf(Package): "--enable-dap" ] + CPPFLAGS.append("-I%s/include" % spec['hdf5'].prefix) + LDFLAGS.append( "-L%s/lib" % spec['hdf5'].prefix) + # HDF4 support + # As of NetCDF 4.1.3, "--with-hdf4=..." is no longer a valid option + # You must use the environment variables CPPFLAGS and LDFLAGS if '+hdf4' in spec: config_args.append("--enable-hdf4") + CPPFLAGS.append("-I%s/include" % spec['hdf'].prefix) + LDFLAGS.append( "-L%s/lib" % spec['hdf'].prefix) + LIBS.append( "-l%s" % "jpeg") + + if 'szip' in spec: + CPPFLAGS.append("-I%s/include" % spec['szip'].prefix) + LDFLAGS.append( "-L%s/lib" % spec['szip'].prefix) + LIBS.append( "-l%s" % "sz") # Fortran support # In version 4.2+, NetCDF-C and NetCDF-Fortran have split. # They can be installed separately, but this bootstrap procedure # should be able to install both at the same time. - # Note: this is a new experimental feature + # Note: this is a new experimental feature. if '+fortran' in spec: config_args.append("--enable-remote-fortran-bootstrap") + config_args.append('CPPFLAGS=%s' % ' '.join(CPPFLAGS)) + config_args.append('LDFLAGS=%s' % ' '.join(LDFLAGS)) + config_args.append('LIBS=%s' % ' '.join(LIBS)) + configure(*config_args) make() make("install") + + # After installing NetCDF-C, install NetCDF-Fortran + if '+fortran' in spec: + make("build-netcdf-fortran") + make("install-netcdf-fortran") |