NetCDF: fix constraints. (#16719)
This commit is contained in:
parent
dc5176fbae
commit
9fdb945383
2 changed files with 19 additions and 40 deletions
|
@ -97,26 +97,15 @@ def url_for_version(self, version):
|
||||||
|
|
||||||
# High-level API of HDF5 1.8.9 or later is required for netCDF-4 support:
|
# High-level API of HDF5 1.8.9 or later is required for netCDF-4 support:
|
||||||
# http://www.unidata.ucar.edu/software/netcdf/docs/getting_and_building_netcdf.html
|
# http://www.unidata.ucar.edu/software/netcdf/docs/getting_and_building_netcdf.html
|
||||||
depends_on('hdf5@1.8.9:+hl~mpi', when='~mpi')
|
depends_on('hdf5@1.8.9:+hl')
|
||||||
depends_on('hdf5@1.8.9:+hl+mpi', when='+mpi')
|
|
||||||
|
|
||||||
# Starting version 4.4.0, it became possible to disable parallel I/O even
|
# Starting version 4.4.0, it became possible to disable parallel I/O even
|
||||||
# if HDF5 supports it. For previous versions of the library we need
|
# if HDF5 supports it. For previous versions of the library we need
|
||||||
# HDF5 without mpi support to disable parallel I/O.
|
# HDF5 without mpi support to disable parallel I/O:
|
||||||
# The following doesn't work if hdf5+mpi by default and netcdf-c~mpi is
|
depends_on('hdf5~mpi', when='@:4.3~mpi')
|
||||||
# specified in packages.yaml
|
|
||||||
# depends_on('hdf5~mpi', when='@:4.3~mpi')
|
|
||||||
# Thus, we have to introduce a conflict
|
|
||||||
conflicts('~mpi', when='@:4.3^hdf5+mpi',
|
|
||||||
msg='netcdf-c@:4.3~mpi requires hdf5~mpi')
|
|
||||||
|
|
||||||
# We need HDF5 with mpi support to enable parallel I/O.
|
# We need HDF5 with mpi support to enable parallel I/O.
|
||||||
# The following doesn't work if hdf5~mpi by default and netcdf-c+mpi is
|
depends_on('hdf5+mpi', when='+mpi')
|
||||||
# specified in packages.yaml
|
|
||||||
# depends_on('hdf5+mpi', when='+mpi')
|
|
||||||
# Thus, we have to introduce a conflict
|
|
||||||
conflicts('+mpi', when='^hdf5~mpi',
|
|
||||||
msg='netcdf-c+mpi requires hdf5+mpi')
|
|
||||||
|
|
||||||
# NetCDF 4.4.0 and prior have compatibility issues with HDF5 1.10 and later
|
# NetCDF 4.4.0 and prior have compatibility issues with HDF5 1.10 and later
|
||||||
# https://github.com/Unidata/netcdf-c/issues/250
|
# https://github.com/Unidata/netcdf-c/issues/250
|
||||||
|
|
|
@ -22,19 +22,12 @@ class NetcdfFortran(AutotoolsPackage):
|
||||||
version('4.4.4', sha256='b2d395175f8d283e68c8be516e231a96b191ade67ad0caafaf7fa01b1e6b5d75')
|
version('4.4.4', sha256='b2d395175f8d283e68c8be516e231a96b191ade67ad0caafaf7fa01b1e6b5d75')
|
||||||
version('4.4.3', sha256='330373aa163d5931e475b5e83da5c1ad041e855185f24e6a8b85d73b48d6cda9')
|
version('4.4.3', sha256='330373aa163d5931e475b5e83da5c1ad041e855185f24e6a8b85d73b48d6cda9')
|
||||||
|
|
||||||
variant('mpi', default=True,
|
|
||||||
description='Enable parallel I/O for netcdf-4')
|
|
||||||
variant('pic', default=True,
|
variant('pic', default=True,
|
||||||
description='Produce position-independent code (for shared libs)')
|
description='Produce position-independent code (for shared libs)')
|
||||||
variant('shared', default=True, description='Enable shared library')
|
variant('shared', default=True, description='Enable shared library')
|
||||||
variant('doc', default=False, description='Enable building docs')
|
variant('doc', default=False, description='Enable building docs')
|
||||||
|
|
||||||
# We need to build with MPI wrappers if parallel I/O features is enabled:
|
depends_on('netcdf-c')
|
||||||
# https://www.unidata.ucar.edu/software/netcdf/docs/building_netcdf_fortran.html
|
|
||||||
depends_on('mpi', when='+mpi')
|
|
||||||
|
|
||||||
depends_on('netcdf-c~mpi~parallel-netcdf', when='~mpi')
|
|
||||||
depends_on('netcdf-c+mpi', when='+mpi')
|
|
||||||
depends_on('doxygen', when='+doc', type='build')
|
depends_on('doxygen', when='+doc', type='build')
|
||||||
|
|
||||||
# The default libtool.m4 is too old to handle NAG compiler properly:
|
# The default libtool.m4 is too old to handle NAG compiler properly:
|
||||||
|
@ -66,17 +59,15 @@ class NetcdfFortran(AutotoolsPackage):
|
||||||
def flag_handler(self, name, flags):
|
def flag_handler(self, name, flags):
|
||||||
config_flags = None
|
config_flags = None
|
||||||
|
|
||||||
if '+pic' in self.spec:
|
if name == 'cflags':
|
||||||
# Unlike NetCDF-C, we add PIC flag only when +pic. Adding the
|
if '+pic' in self.spec:
|
||||||
# flags also when ~shared would make it impossible to build a
|
flags.append(self.compiler.cc_pic_flag)
|
||||||
# static-only version of the library with NAG.
|
elif name == 'fflags':
|
||||||
if name == 'cflags':
|
if '+pic' in self.spec:
|
||||||
config_flags = [self.compiler.cc_pic_flag]
|
flags.append(self.compiler.f77_pic_flag)
|
||||||
elif name == 'fflags':
|
if self.spec.satisfies('%gcc@10:'):
|
||||||
config_flags = [self.compiler.f77_pic_flag]
|
# https://github.com/Unidata/netcdf-fortran/issues/212
|
||||||
|
flags.append('-fallow-argument-mismatch')
|
||||||
if name == 'cppflags':
|
|
||||||
config_flags = [self.spec['netcdf-c'].headers.cpp_flags]
|
|
||||||
elif name == 'ldflags':
|
elif name == 'ldflags':
|
||||||
# We need to specify LDFLAGS to get correct dependency_libs
|
# We need to specify LDFLAGS to get correct dependency_libs
|
||||||
# in libnetcdff.la, so packages that use libtool for linking
|
# in libnetcdff.la, so packages that use libtool for linking
|
||||||
|
@ -84,11 +75,6 @@ def flag_handler(self, name, flags):
|
||||||
# building takes place outside of Spack environment, i.e.
|
# building takes place outside of Spack environment, i.e.
|
||||||
# without Spack's compiler wrappers.
|
# without Spack's compiler wrappers.
|
||||||
config_flags = [self.spec['netcdf-c'].libs.search_flags]
|
config_flags = [self.spec['netcdf-c'].libs.search_flags]
|
||||||
elif name == 'fflags' and self.spec.satisfies('%gcc@10:'):
|
|
||||||
# https://github.com/Unidata/netcdf-fortran/issues/212
|
|
||||||
if config_flags is None:
|
|
||||||
config_flags = []
|
|
||||||
config_flags.append('-fallow-argument-mismatch')
|
|
||||||
|
|
||||||
return flags, None, config_flags
|
return flags, None, config_flags
|
||||||
|
|
||||||
|
@ -122,7 +108,11 @@ def configure_args(self):
|
||||||
config_args = self.enable_or_disable('shared')
|
config_args = self.enable_or_disable('shared')
|
||||||
config_args.append('--enable-static')
|
config_args.append('--enable-static')
|
||||||
|
|
||||||
if '+mpi' in self.spec:
|
# We need to build with MPI wrappers if either of the parallel I/O
|
||||||
|
# features is enabled in netcdf-c:
|
||||||
|
# https://www.unidata.ucar.edu/software/netcdf/docs/building_netcdf_fortran.html
|
||||||
|
netcdf_c_spec = self.spec['netcdf-c']
|
||||||
|
if '+mpi' in netcdf_c_spec or '+parallel-netcdf' in netcdf_c_spec:
|
||||||
config_args.append('CC=%s' % self.spec['mpi'].mpicc)
|
config_args.append('CC=%s' % self.spec['mpi'].mpicc)
|
||||||
config_args.append('FC=%s' % self.spec['mpi'].mpifc)
|
config_args.append('FC=%s' % self.spec['mpi'].mpifc)
|
||||||
config_args.append('F77=%s' % self.spec['mpi'].mpif77)
|
config_args.append('F77=%s' % self.spec['mpi'].mpif77)
|
||||||
|
|
Loading…
Reference in a new issue