Update for 'hdf5'. (#5790)
* Refactoring for 'hdf5'. * Remove 'unsupported' variant.
This commit is contained in:
parent
c7ac4e3774
commit
161dca6d5d
@ -55,13 +55,14 @@ class Hdf5(AutotoolsPackage):
|
|||||||
variant('shared', default=True,
|
variant('shared', default=True,
|
||||||
description='Builds a shared version of the library')
|
description='Builds a shared version of the library')
|
||||||
|
|
||||||
variant('cxx', default=True, description='Enable C++ support')
|
variant('hl', default=False, description='Enable the high-level library')
|
||||||
variant('fortran', default=True, description='Enable Fortran support')
|
variant('cxx', default=False, description='Enable C++ support')
|
||||||
|
variant('fortran', default=False, description='Enable Fortran support')
|
||||||
|
variant('threadsafe', default=False,
|
||||||
|
description='Enable thread-safe capabilities')
|
||||||
|
|
||||||
variant('mpi', default=True, description='Enable MPI support')
|
variant('mpi', default=True, description='Enable MPI support')
|
||||||
variant('szip', default=False, description='Enable szip support')
|
variant('szip', default=False, description='Enable szip support')
|
||||||
variant('threadsafe', default=False,
|
|
||||||
description='Enable thread-safe capabilities')
|
|
||||||
variant('pic', default=True,
|
variant('pic', default=True,
|
||||||
description='Produce position-independent code (for shared libs)')
|
description='Produce position-independent code (for shared libs)')
|
||||||
|
|
||||||
@ -72,11 +73,22 @@ class Hdf5(AutotoolsPackage):
|
|||||||
depends_on('szip', when='+szip')
|
depends_on('szip', when='+szip')
|
||||||
depends_on('zlib@1.1.2:')
|
depends_on('zlib@1.1.2:')
|
||||||
|
|
||||||
# According to ./configure --help thread-safe capabilities are:
|
# There are several officially unsupported combinations of the features:
|
||||||
# "Not compatible with the high-level library, Fortran, or C++ wrappers."
|
# 1. Thread safety is not guaranteed via high-level C-API but in some cases
|
||||||
# (taken from hdf5@1.10.0patch1)
|
# it works.
|
||||||
conflicts('+threadsafe', when='+cxx')
|
# conflicts('+threadsafe+hl')
|
||||||
conflicts('+threadsafe', when='+fortran')
|
|
||||||
|
# 2. Thread safety is not guaranteed via Fortran (CXX) API, but it's
|
||||||
|
# possible for a dependency tree to contain a package that uses Fortran
|
||||||
|
# (CXX) API in a single thread and another one that uses low-level C-API
|
||||||
|
# in multiple threads. To allow for such scenarios, we don't specify the
|
||||||
|
# following conflicts.
|
||||||
|
# conflicts('+threadsafe+cxx')
|
||||||
|
# conflicts('+threadsafe+fortran')
|
||||||
|
|
||||||
|
# 3. Parallel features are not supported via CXX API, but for the reasons
|
||||||
|
# described in #2 we allow for such combination.
|
||||||
|
# conflicts('+mpi+cxx')
|
||||||
|
|
||||||
def url_for_version(self, version):
|
def url_for_version(self, version):
|
||||||
url = "https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-{0}/hdf5-{1}/src/hdf5-{1}.tar.gz"
|
url = "https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-{0}/hdf5-{1}/src/hdf5-{1}.tar.gz"
|
||||||
@ -147,80 +159,71 @@ def libs(self):
|
|||||||
|
|
||||||
@run_before('configure')
|
@run_before('configure')
|
||||||
def fortran_check(self):
|
def fortran_check(self):
|
||||||
spec = self.spec
|
if '+fortran' in self.spec and not self.compiler.fc:
|
||||||
if '+fortran' in spec and not self.compiler.fc:
|
|
||||||
msg = 'cannot build a Fortran variant without a Fortran compiler'
|
msg = 'cannot build a Fortran variant without a Fortran compiler'
|
||||||
raise RuntimeError(msg)
|
raise RuntimeError(msg)
|
||||||
|
|
||||||
def configure_args(self):
|
def configure_args(self):
|
||||||
spec = self.spec
|
|
||||||
# Handle compilation after spec validation
|
|
||||||
extra_args = []
|
|
||||||
|
|
||||||
# Always enable this option. This does not actually enable any
|
# Always enable this option. This does not actually enable any
|
||||||
# features: it only *allows* the user to specify certain
|
# features: it only *allows* the user to specify certain
|
||||||
# combinations of other arguments. Enabling it just skips a
|
# combinations of other arguments. Enabling it just skips a
|
||||||
# sanity check in configure, so this doesn't merit a variant.
|
# sanity check in configure, so this doesn't merit a variant.
|
||||||
extra_args.append("--enable-unsupported")
|
extra_args = ['--enable-unsupported']
|
||||||
|
extra_args += self.enable_or_disable('threadsafe')
|
||||||
|
extra_args += self.enable_or_disable('cxx')
|
||||||
|
extra_args += self.enable_or_disable('hl')
|
||||||
|
extra_args += self.enable_or_disable('fortran')
|
||||||
|
|
||||||
if spec.satisfies('@1.10:'):
|
if '+szip' in self.spec:
|
||||||
if '+debug' in spec:
|
extra_args.append('--with-szlib=%s' % self.spec['szip'].prefix)
|
||||||
|
else:
|
||||||
|
extra_args.append('--without-szlib')
|
||||||
|
|
||||||
|
if self.spec.satisfies('@1.10:'):
|
||||||
|
if '+debug' in self.spec:
|
||||||
extra_args.append('--enable-build-mode=debug')
|
extra_args.append('--enable-build-mode=debug')
|
||||||
else:
|
else:
|
||||||
extra_args.append('--enable-build-mode=production')
|
extra_args.append('--enable-build-mode=production')
|
||||||
else:
|
else:
|
||||||
if '+debug' in spec:
|
if '+debug' in self.spec:
|
||||||
extra_args.append('--enable-debug=all')
|
extra_args.append('--enable-debug=all')
|
||||||
else:
|
else:
|
||||||
extra_args.append('--enable-production')
|
extra_args.append('--enable-production')
|
||||||
|
|
||||||
if '+shared' in spec:
|
# '--enable-fortran2003' no longer exists as of version 1.10.0
|
||||||
|
if '+fortran' in self.spec:
|
||||||
|
extra_args.append('--enable-fortran2003')
|
||||||
|
else:
|
||||||
|
extra_args.append('--disable-fortran2003')
|
||||||
|
|
||||||
|
if '+shared' in self.spec:
|
||||||
extra_args.append('--enable-shared')
|
extra_args.append('--enable-shared')
|
||||||
else:
|
else:
|
||||||
extra_args.append('--disable-shared')
|
extra_args.append('--disable-shared')
|
||||||
extra_args.append('--enable-static-exec')
|
extra_args.append('--enable-static-exec')
|
||||||
|
|
||||||
if '+cxx' in spec:
|
if '+pic' in self.spec:
|
||||||
extra_args.append('--enable-cxx')
|
extra_args += ['%s=%s' % (f, self.compiler.pic_flag)
|
||||||
|
for f in ['CFLAGS', 'CXXFLAGS', 'FCFLAGS']]
|
||||||
|
|
||||||
if '+fortran' in spec:
|
if '+mpi' in self.spec:
|
||||||
extra_args.append('--enable-fortran')
|
|
||||||
# '--enable-fortran2003' no longer exists as of version 1.10.0
|
|
||||||
if spec.satisfies('@:1.8.16'):
|
|
||||||
extra_args.append('--enable-fortran2003')
|
|
||||||
|
|
||||||
if '+pic' in spec:
|
|
||||||
extra_args.append('CFLAGS={0}'.format(self.compiler.pic_flag))
|
|
||||||
extra_args.append('CXXFLAGS={0}'.format(self.compiler.pic_flag))
|
|
||||||
extra_args.append('FCFLAGS={0}'.format(self.compiler.pic_flag))
|
|
||||||
|
|
||||||
if '+mpi' in spec:
|
|
||||||
# The HDF5 configure script warns if cxx and mpi are enabled
|
# The HDF5 configure script warns if cxx and mpi are enabled
|
||||||
# together. There doesn't seem to be a real reason for this, except
|
# together. There doesn't seem to be a real reason for this, except
|
||||||
# that parts of the MPI interface are not accessible via the C++
|
# that parts of the MPI interface are not accessible via the C++
|
||||||
# interface. Since they are still accessible via the C interface,
|
# interface. Since they are still accessible via the C interface,
|
||||||
# this is not actually a problem.
|
# this is not actually a problem.
|
||||||
extra_args.extend([
|
extra_args += ['--enable-parallel',
|
||||||
"--enable-parallel",
|
'CC=%s' % self.spec['mpi'].mpicc]
|
||||||
"CC=%s" % spec['mpi'].mpicc
|
|
||||||
])
|
|
||||||
|
|
||||||
if '+cxx' in spec:
|
if '+cxx' in self.spec:
|
||||||
extra_args.append("CXX=%s" % spec['mpi'].mpicxx)
|
extra_args.append('CXX=%s' % self.spec['mpi'].mpicxx)
|
||||||
|
|
||||||
if '+fortran' in spec:
|
if '+fortran' in self.spec:
|
||||||
extra_args.append("FC=%s" % spec['mpi'].mpifc)
|
extra_args.append('FC=%s' % self.spec['mpi'].mpifc)
|
||||||
|
|
||||||
if '+szip' in spec:
|
extra_args.append('--with-zlib=%s' % self.spec['zlib'].prefix)
|
||||||
extra_args.append("--with-szlib=%s" % spec['szip'].prefix)
|
|
||||||
|
|
||||||
if '+threadsafe' in spec:
|
return extra_args
|
||||||
extra_args.extend([
|
|
||||||
'--enable-threadsafe',
|
|
||||||
'--disable-hl',
|
|
||||||
])
|
|
||||||
|
|
||||||
return ["--with-zlib=%s" % spec['zlib'].prefix] + extra_args
|
|
||||||
|
|
||||||
@run_after('configure')
|
@run_after('configure')
|
||||||
def patch_postdeps(self):
|
def patch_postdeps(self):
|
||||||
|
@ -83,7 +83,7 @@ class Netcdf(AutotoolsPackage):
|
|||||||
|
|
||||||
# Required for NetCDF-4 support
|
# Required for NetCDF-4 support
|
||||||
depends_on("zlib@1.2.5:")
|
depends_on("zlib@1.2.5:")
|
||||||
depends_on('hdf5')
|
depends_on('hdf5+hl')
|
||||||
|
|
||||||
# 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
|
||||||
|
Loading…
Reference in New Issue
Block a user