2018-10-08 04:52:23 +08:00
|
|
|
# Copyright 2013-2018 Lawrence Livermore National Security, LLC and other
|
|
|
|
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
2016-05-12 12:22:25 +08:00
|
|
|
#
|
2018-10-08 04:52:23 +08:00
|
|
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
|
|
|
|
2016-03-01 11:59:28 +08:00
|
|
|
from spack import *
|
|
|
|
|
2016-06-22 22:52:17 +08:00
|
|
|
|
2017-01-08 10:07:00 +08:00
|
|
|
class NetcdfFortran(AutotoolsPackage):
|
2016-03-01 11:59:28 +08:00
|
|
|
"""Fortran interface for NetCDF4"""
|
|
|
|
|
2016-03-06 12:05:45 +08:00
|
|
|
homepage = "http://www.unidata.ucar.edu/software/netcdf"
|
2016-03-01 11:59:28 +08:00
|
|
|
url = "http://www.unidata.ucar.edu/downloads/netcdf/ftp/netcdf-fortran-4.4.3.tar.gz"
|
|
|
|
|
2016-06-22 22:52:17 +08:00
|
|
|
version('4.4.4', 'e855c789cd72e1b8bc1354366bf6ac72')
|
2016-03-01 11:59:28 +08:00
|
|
|
version('4.4.3', 'bfd4ae23a34635b273d3eb0d91cbde9e')
|
|
|
|
|
2018-11-13 13:54:11 +08:00
|
|
|
variant('pic', default=True,
|
|
|
|
description='Produce position-independent code (for shared libs)')
|
|
|
|
|
2016-03-01 11:59:28 +08:00
|
|
|
depends_on('netcdf')
|
2017-04-07 17:18:34 +08:00
|
|
|
|
2018-08-02 21:32:20 +08:00
|
|
|
# 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')
|
|
|
|
|
2018-11-13 13:54:11 +08:00
|
|
|
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)
|
2018-05-22 05:23:35 +08:00
|
|
|
|
2017-04-07 17:18:34 +08:00
|
|
|
@property
|
|
|
|
def libs(self):
|
|
|
|
libraries = ['libnetcdff']
|
|
|
|
|
|
|
|
# This package installs both shared and static libraries. Permit
|
|
|
|
# clients to query which one they want.
|
|
|
|
query_parameters = self.spec.last_query.extra_parameters
|
|
|
|
shared = 'shared' in query_parameters
|
|
|
|
|
|
|
|
return find_libraries(
|
2017-08-03 23:21:40 +08:00
|
|
|
libraries, root=self.prefix, shared=shared, recursive=True
|
2017-04-07 17:18:34 +08:00
|
|
|
)
|