summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorSergey Kosukhin <sergey.kosukhin@mpimet.mpg.de>2020-10-19 23:12:09 +0200
committerGitHub <noreply@github.com>2020-10-19 16:12:09 -0500
commit75bfdc73351ae02a4a95de305a7af6d58287c7ab (patch)
tree8e3301681d3c997f42ebed1f3c010d3573b3be9b /var
parentc31e96dcd741996e98f830e60b96de964dbe54dc (diff)
downloadspack-75bfdc73351ae02a4a95de305a7af6d58287c7ab.tar.gz
spack-75bfdc73351ae02a4a95de305a7af6d58287c7ab.tar.bz2
spack-75bfdc73351ae02a4a95de305a7af6d58287c7ab.tar.xz
spack-75bfdc73351ae02a4a95de305a7af6d58287c7ab.zip
netcdf-fortran: support for Cray compiler (#18971)
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/netcdf-fortran/package.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/netcdf-fortran/package.py b/var/spack/repos/builtin/packages/netcdf-fortran/package.py
index cd6ed11146..1178de8d57 100644
--- a/var/spack/repos/builtin/packages/netcdf-fortran/package.py
+++ b/var/spack/repos/builtin/packages/netcdf-fortran/package.py
@@ -4,6 +4,9 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
+import os
+import glob
+from shutil import copyfile, Error
class NetcdfFortran(AutotoolsPackage):
@@ -69,6 +72,14 @@ class NetcdfFortran(AutotoolsPackage):
if self.spec.satisfies('%gcc@10:'):
# https://github.com/Unidata/netcdf-fortran/issues/212
flags.append('-fallow-argument-mismatch')
+ elif self.compiler.name == 'cce':
+ # Cray compiler generates module files with uppercase names by
+ # default, which is not handled by the makefiles of
+ # NetCDF-Fortran:
+ # https://github.com/Unidata/netcdf-fortran/pull/221.
+ # The following flag forces the compiler to produce module
+ # files with lowercase names.
+ flags.append('-ef')
elif name == 'ldflags':
# We need to specify LDFLAGS to get correct dependency_libs
# in libnetcdff.la, so packages that use libtool for linking
@@ -129,3 +140,28 @@ class NetcdfFortran(AutotoolsPackage):
def check(self):
with working_dir(self.build_directory):
make('check', parallel=False)
+
+ @run_after('install')
+ def cray_module_filenames(self):
+ # Cray compiler searches for module files with uppercase names by
+ # default and with lowercase names when the '-ef' flag is specified.
+ # To avoid warning messages when compiler user applications in both
+ # cases, we create copies of all '*.mod' files in the prefix/include
+ # with names in upper- and lowercase.
+ if self.spec.compiler.name != 'cce':
+ return
+
+ with working_dir(self.spec.prefix.include):
+ for f in glob.glob('*.mod'):
+ name, ext = os.path.splitext(f)
+ try:
+ # Create a copy with uppercase name:
+ copyfile(f, name.upper() + ext)
+ except Error:
+ # Assume that the exception tells us that the file with
+ # uppercase name already exists. Try to create a file with
+ # lowercase name then:
+ try:
+ copyfile(f, name.lower() + ext)
+ except Error:
+ pass