Skip to content
Snippets Groups Projects
Commit c7c3fab7 authored by Alberto Chiusole's avatar Alberto Chiusole Committed by Peter Scheibel
Browse files

Add 'pic' variant to netcdf packages (#9605)

parent 91302f89
No related branches found
No related tags found
No related merge requests found
......@@ -8,12 +8,18 @@
class NetcdfCxx4(AutotoolsPackage):
"""C++ interface for NetCDF4"""
homepage = "http://www.unidata.ucar.edu/software/netcdf"
url = "https://www.github.com/unidata/netcdf-cxx4/tarball/v4.3.0"
version('4.3.0', '0dde8b9763eecdafbd69d076e687337e')
version('4.2.1', 'd019853802092cf686254aaba165fc81')
# Usually the configure automatically inserts the pic flags, but we can
# force its usage with this variant.
variant('pic', default=True,
description='Produce position-independent code (for shared libs)')
depends_on('netcdf')
depends_on('automake', type='build')
......@@ -22,8 +28,13 @@ class NetcdfCxx4(AutotoolsPackage):
force_autoreconf = True
def configure_args(self):
return ['CPPFLAGS=-I' + self.spec['netcdf'].prefix.include]
def flag_handler(self, name, flags):
if name == 'cflags' and '+pic' in self.spec:
flags.append(self.compiler.pic_flag)
elif name == 'cppflags':
flags.append('-I' + self.spec['netcdf'].prefix.include)
return (None, None, flags)
@property
def libs(self):
......
......@@ -15,14 +15,22 @@ class NetcdfFortran(AutotoolsPackage):
version('4.4.4', 'e855c789cd72e1b8bc1354366bf6ac72')
version('4.4.3', 'bfd4ae23a34635b273d3eb0d91cbde9e')
variant('pic', default=True,
description='Produce position-independent code (for shared libs)')
depends_on('netcdf')
# The default libtool.m4 is too old to handle NAG compiler properly:
# https://github.com/Unidata/netcdf-fortran/issues/94
patch('nag.patch', when='@:4.4.4%nag')
def configure_args(self):
return ['CPPFLAGS=-I' + self.spec['netcdf'].prefix.include]
def flag_handler(self, name, flags):
if name in ['cflags', 'fflags'] and '+pic' in self.spec:
flags.append(self.compiler.pic_flag)
elif name == 'cppflags':
flags.append('-I' + self.spec['netcdf'].prefix.include)
return (None, None, flags)
@property
def libs(self):
......
......@@ -24,9 +24,9 @@ class Netcdf(AutotoolsPackage):
homepage = "http://www.unidata.ucar.edu/software/netcdf"
url = "http://www.gfd-dennou.org/arch/netcdf/unidata-mirror/netcdf-4.3.3.tar.gz"
version('4.6.1', 'ee81c593efc8a6229d9bcb350b6d7849')
# Version 4.4.1.1 is having problems in tests
# https://github.com/Unidata/netcdf-c/issues/343
version('4.6.1', 'ee81c593efc8a6229d9bcb350b6d7849')
version('4.4.1.1', '503a2d6b6035d116ed53b1d80c811bda')
# netcdf@4.4.1 can crash on you (in real life and in tests). See:
# https://github.com/Unidata/netcdf-c/issues/282
......@@ -40,6 +40,8 @@ class Netcdf(AutotoolsPackage):
variant('parallel-netcdf', default=False,
description='Enable parallel I/O for classic files')
variant('hdf4', default=False, description='Enable HDF4 support')
variant('pic', default=True,
description='Produce position-independent code (for shared libs)')
variant('shared', default=True, description='Enable shared library')
variant('dap', default=False, description='Enable DAP support')
......@@ -155,7 +157,7 @@ def configure_args(self):
config_args += self.enable_or_disable('shared')
if '~shared' in self.spec:
if '~shared' in self.spec or '+pic' in self.spec:
# We don't have shared libraries but we still want it to be
# possible to use this library in shared builds
cflags.append(self.compiler.pic_flag)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment