summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.mailmap1
-rw-r--r--var/spack/repos/builtin/packages/eccodes/cmake_install_rpath.patch11
-rw-r--r--var/spack/repos/builtin/packages/eccodes/enable_only_jasper.patch24
-rw-r--r--var/spack/repos/builtin/packages/eccodes/enable_only_openjpeg.patch2
-rw-r--r--var/spack/repos/builtin/packages/eccodes/package.py81
5 files changed, 97 insertions, 22 deletions
diff --git a/.mailmap b/.mailmap
index 41575ebb1f..f6f781e891 100644
--- a/.mailmap
+++ b/.mailmap
@@ -49,6 +49,7 @@ Robert D. French <frenchrd@ornl.gov> Robert D. French
Robert D. French <frenchrd@ornl.gov> Robert.French <frenchrd@ornl.gov>
Robert D. French <frenchrd@ornl.gov> robertdfrench <frenchrd@ornl.gov>
Saravan Pantham <saravan.pantham@gmail.com> Saravan Pantham <pantham1@surface86.llnl.gov>
+Sergey Kosukhin <sergey.kosukhin@mpimet.mpg.de> Sergey Kosukhin <skosukhin@gmail.com>
Stephen Herbein <sherbein@udel.edu> Stephen Herbein <stephen272@gmail.com>
Todd Gamblin <tgamblin@llnl.gov> George Todd Gamblin <gamblin2@llnl.gov>
Todd Gamblin <tgamblin@llnl.gov> Todd Gamblin <gamblin2@llnl.gov>
diff --git a/var/spack/repos/builtin/packages/eccodes/cmake_install_rpath.patch b/var/spack/repos/builtin/packages/eccodes/cmake_install_rpath.patch
new file mode 100644
index 0000000000..7e2b250883
--- /dev/null
+++ b/var/spack/repos/builtin/packages/eccodes/cmake_install_rpath.patch
@@ -0,0 +1,11 @@
+--- a/cmake/ecbuild_append_to_rpath.cmake
++++ b/cmake/ecbuild_append_to_rpath.cmake
+@@ -31,7 +31,7 @@ function( _path_append var path )
+ else()
+ list( FIND ${var} ${path} _found )
+ if( _found EQUAL "-1" )
+- set( ${var} "${${var}}:${path}" PARENT_SCOPE )
++ set( ${var} "${${var}};${path}" PARENT_SCOPE )
+ endif()
+ endif()
+ endfunction()
diff --git a/var/spack/repos/builtin/packages/eccodes/enable_only_jasper.patch b/var/spack/repos/builtin/packages/eccodes/enable_only_jasper.patch
index 9f7dc22ac5..ad09c75199 100644
--- a/var/spack/repos/builtin/packages/eccodes/enable_only_jasper.patch
+++ b/var/spack/repos/builtin/packages/eccodes/enable_only_jasper.patch
@@ -1,17 +1,25 @@
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index bf4d78b..ea2f3e9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
-@@ -162,8 +162,6 @@ if( ENABLE_JPG )
- set(CMAKE_PREFIX_PATH ${_CMAKE_PREFIX_PATH}) # Restore CMAKE_PREFIX_PATH
- set(CMAKE_WARN_DEPRECATED ON) # Remove suppression
+@@ -151,18 +151,7 @@ set( HAVE_LIBOPENJPEG 0 )
-- find_package( OpenJPEG )
+ if( ENABLE_JPG )
+
+- # Note: This is a deprecated feature but we need it to find Jasper at ECMWF.
+- # ecbuild_add_extra_search_paths modifies CMAKE_PREFIX_PATH
+- # which can affect future package discovery if not undone by the caller.
+- # The current CMAKE_PREFIX_PATH is backed up as _CMAKE_PREFIX_PATH
+- #
+- set(CMAKE_WARN_DEPRECATED OFF) # Suppress deprecation message
+- ecbuild_add_extra_search_paths( jasper )
+ find_package( Jasper )
+- set(CMAKE_PREFIX_PATH ${_CMAKE_PREFIX_PATH}) # Restore CMAKE_PREFIX_PATH
+- set(CMAKE_WARN_DEPRECATED ON) # Remove suppression
-
+- find_package( OpenJPEG )
+
if( JASPER_FOUND )
list( APPEND ECCODES_TPLS Jasper )
- set( HAVE_JPEG 1 )
-@@ -172,12 +170,6 @@ if( ENABLE_JPG )
+@@ -172,12 +161,6 @@ if( ENABLE_JPG )
string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" JASPER_VERSION_MAJOR "${JASPER_VERSION_STRING}")
endif()
diff --git a/var/spack/repos/builtin/packages/eccodes/enable_only_openjpeg.patch b/var/spack/repos/builtin/packages/eccodes/enable_only_openjpeg.patch
index 7bf8b7b59f..29a6dff454 100644
--- a/var/spack/repos/builtin/packages/eccodes/enable_only_openjpeg.patch
+++ b/var/spack/repos/builtin/packages/eccodes/enable_only_openjpeg.patch
@@ -1,5 +1,3 @@
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index bf4d78b..3ae50ba 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -151,27 +151,8 @@ set( HAVE_LIBOPENJPEG 0 )
diff --git a/var/spack/repos/builtin/packages/eccodes/package.py b/var/spack/repos/builtin/packages/eccodes/package.py
index 0f1e127aed..ca86024f13 100644
--- a/var/spack/repos/builtin/packages/eccodes/package.py
+++ b/var/spack/repos/builtin/packages/eccodes/package.py
@@ -30,9 +30,11 @@ class Eccodes(CMakePackage):
"""ecCodes is a package developed by ECMWF for processing meteorological
data in GRIB (1/2), BUFR (3/4) and GTS header formats."""
- homepage = "https://software.ecmwf.int/wiki/display/ECC/ecCodes+Home"
- url = "https://software.ecmwf.int/wiki/download/attachments/45757960/eccodes-2.2.0-Source.tar.gz?api=v2"
- list_url = "https://software.ecmwf.int/wiki/display/ECC/Releases"
+ homepage = 'https://software.ecmwf.int/wiki/display/ECC/ecCodes+Home'
+ url = 'https://software.ecmwf.int/wiki/download/attachments/45757960/eccodes-2.2.0-Source.tar.gz?api=v2'
+ list_url = 'https://software.ecmwf.int/wiki/display/ECC/Releases'
+
+ maintainers = ['skosukhin']
version('2.5.0', '5a7e92c58418d855082fa573efd352aa')
version('2.2.0', 'b27e6f0a3eea5b92dac37372e4c45a62')
@@ -53,17 +55,28 @@ class Eccodes(CMakePackage):
description='Enable memory based access to definitions/samples')
variant('python', default=False,
description='Enable the Python interface')
- variant('fortran', default=True, description='Enable the Fortran support')
+ variant('fortran', default=False, description='Enable the Fortran support')
+ variant('examples', default=True,
+ description='Build the examples (part of the full test suite)')
+ variant('test', default=True, description='Enable the tests')
variant('build_type', default='RelWithDebInfo',
description='The build type to build',
values=('Debug', 'Release', 'RelWithDebInfo', 'Production'))
+ # The building script tries to find an optional package valgrind when
+ # tests are enabled but the testing scripts don't use it.
+ # depends_on('valgrind', type='test', when='+test')
+
depends_on('netcdf', when='+netcdf')
- depends_on('openjpeg', when='jp2k=openjpeg')
+ depends_on('openjpeg@1.5.0:1.5.999,2.1.0:2.1.999', when='jp2k=openjpeg')
depends_on('jasper', when='jp2k=jasper')
depends_on('libpng', when='+png')
depends_on('libaec', when='+aec')
- depends_on('python@:2', when='+python')
+ # Can be built with Python2 or Python3.
+ depends_on('python', when='+memfs', type='build')
+ # The interface works only for Python2.
+ depends_on('python@2.6:2.999', when='+python',
+ type=('build', 'link', 'run'))
depends_on('py-numpy', when='+python', type=('build', 'run'))
extends('python', when='+python')
@@ -74,18 +87,62 @@ class Eccodes(CMakePackage):
patch('enable_only_openjpeg.patch', when='jp2k=openjpeg')
patch('enable_only_jasper.patch', when='jp2k=jasper')
+ # CMAKE_INSTALL_RPATH must be a semicolon-separated list.
+ patch('cmake_install_rpath.patch')
+
+ @run_before('cmake')
+ def check_fortran(self):
+ if '+fortran' in self.spec and self.compiler.fc is None:
+ raise InstallError(
+ 'Fortran interface requires a Fortran compiler!')
+
def cmake_args(self):
- variants = ['+netcdf', '+png', '+aec', '+pthreads',
- '+openmp', '+memfs', '+python', '+fortran']
- options = ['NETCDF', 'PNG', 'AEC', 'ECCODES_THREADS',
- 'ECCODES_OMP_THREADS', 'MEMFS', 'PYTHON', 'FORTRAN']
+ var_opt_list = [('+pthreads', 'ECCODES_THREADS'),
+ ('+openmp', 'ECCODES_OMP_THREADS'),
+ ('+memfs', 'MEMFS'),
+ ('+python', 'PYTHON'),
+ ('+fortran', 'FORTRAN'),
+ ('+examples', 'EXAMPLES'),
+ ('+test', 'TESTS'),
+ ('+test', 'EXTRA_TESTS')]
+
+ args = ['-DENABLE_%s=%s' % (opt, 'ON' if var in self.spec else 'OFF')
+ for var, opt in var_opt_list]
- args = ["-DENABLE_%s=%s" % (opt, 'ON' if var in self.spec else 'OFF')
- for var, opt in zip(variants, options)]
+ if '+netcdf' in self.spec:
+ args.extend(['-DENABLE_NETCDF=ON',
+ # Prevent overriding by environment variable
+ # HDF5_ROOT.
+ '-DHDF5_ROOT=' + self.spec['hdf5'].prefix,
+ # Prevent possible overriding by environment variables
+ # NETCDF_ROOT, NETCDF_DIR, and NETCDF_PATH.
+ '-DNETCDF_PATH=' + self.spec['netcdf'].prefix])
+ else:
+ args.append('-DENABLE_NETCDF=OFF')
if self.spec.variants['jp2k'].value == 'none':
args.append('-DENABLE_JPG=OFF')
else:
args.append('-DENABLE_JPG=ON')
+ if self.spec.variants['jp2k'].value == 'openjpeg':
+ args.append('-DOPENJPEG_PATH=' + self.spec['openjpeg'].prefix)
+
+ if '+png' in self.spec:
+ args.extend(['-DENABLE_PNG=ON',
+ '-DZLIB_ROOT=' + self.spec['zlib'].prefix])
+ else:
+ args.append('-DENABLE_PNG=OFF')
+
+ if '+aec' in self.spec:
+ args.extend(['-DENABLE_AEC=ON',
+ # Prevent overriding by environment variables
+ # AEC_DIR and AEC_PATH.
+ '-DAEC_DIR=' + self.spec['libaec'].prefix])
+ else:
+ args.append('-DENABLE_AEC=OFF')
+
+ if '^python' in self.spec:
+ args.append('-DPYTHON_EXECUTABLE:FILEPATH=' + python.path)
+
return args