summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Kosukhin <skosukhin@gmail.com>2017-10-25 13:48:55 +0200
committerTodd Gamblin <tgamblin@llnl.gov>2017-10-25 13:48:55 +0200
commitce8a698b48a0c5f4b096167fd5a1e398f6ee4ad6 (patch)
treed5f8e85715e7f20b147d6d425fe4a422a5f46cc5
parent5d3a774587bef551553a731d4f9dcfeefdb70ed3 (diff)
downloadspack-ce8a698b48a0c5f4b096167fd5a1e398f6ee4ad6.tar.gz
spack-ce8a698b48a0c5f4b096167fd5a1e398f6ee4ad6.tar.bz2
spack-ce8a698b48a0c5f4b096167fd5a1e398f6ee4ad6.tar.xz
spack-ce8a698b48a0c5f4b096167fd5a1e398f6ee4ad6.zip
Update for 'eccodes'. (#5899)
-rw-r--r--var/spack/repos/builtin/packages/eccodes/enable_only_jasper.patch26
-rw-r--r--var/spack/repos/builtin/packages/eccodes/enable_only_openjpeg.patch32
-rw-r--r--var/spack/repos/builtin/packages/eccodes/package.py64
3 files changed, 102 insertions, 20 deletions
diff --git a/var/spack/repos/builtin/packages/eccodes/enable_only_jasper.patch b/var/spack/repos/builtin/packages/eccodes/enable_only_jasper.patch
new file mode 100644
index 0000000000..9f7dc22ac5
--- /dev/null
+++ b/var/spack/repos/builtin/packages/eccodes/enable_only_jasper.patch
@@ -0,0 +1,26 @@
+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
+
+- find_package( OpenJPEG )
+-
+ if( JASPER_FOUND )
+ list( APPEND ECCODES_TPLS Jasper )
+ set( HAVE_JPEG 1 )
+@@ -172,12 +170,6 @@ if( ENABLE_JPG )
+ string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" JASPER_VERSION_MAJOR "${JASPER_VERSION_STRING}")
+ endif()
+
+- if( OPENJPEG_FOUND )
+- list( APPEND ECCODES_TPLS OpenJPEG )
+- set( HAVE_JPEG 1 )
+- set( HAVE_LIBOPENJPEG 1 )
+- endif()
+-
+ 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
new file mode 100644
index 0000000000..7bf8b7b59f
--- /dev/null
+++ b/var/spack/repos/builtin/packages/eccodes/enable_only_openjpeg.patch
@@ -0,0 +1,32 @@
+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 )
+
+ 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 )
+- set( HAVE_LIBJASPER 1 )
+- # Extract Jasper's major version number to enable conditional code. See ECC-396
+- string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" JASPER_VERSION_MAJOR "${JASPER_VERSION_STRING}")
+- endif()
+-
+ if( OPENJPEG_FOUND )
+ list( APPEND ECCODES_TPLS OpenJPEG )
+ set( HAVE_JPEG 1 )
diff --git a/var/spack/repos/builtin/packages/eccodes/package.py b/var/spack/repos/builtin/packages/eccodes/package.py
index 157bbb92d7..abca6dbc4a 100644
--- a/var/spack/repos/builtin/packages/eccodes/package.py
+++ b/var/spack/repos/builtin/packages/eccodes/package.py
@@ -34,37 +34,61 @@ class Eccodes(CMakePackage):
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"
+ version('2.5.0', '5a7e92c58418d855082fa573efd352aa')
version('2.2.0', 'b27e6f0a3eea5b92dac37372e4c45a62')
- variant('netcdf', default=True,
- description="Support GRIB to NetCDF conversion")
- variant('jpeg', default=True,
- description="Support JPEG2000 encoding/decoding")
- variant('png', default=True,
- description="Support PNG encoding/decoding")
- variant('python', default=False,
- description="Build the eccodes Python interface")
+ variant('netcdf', default=False,
+ description='Enable GRIB to NetCDF conversion tool')
+ variant('jp2k', default='openjpeg', values=('openjpeg', 'jasper', 'none'),
+ description='Specify JPEG2000 decoding/encoding backend')
+ variant('png', default=False,
+ description='Enable PNG support for decoding/encoding')
+ variant('aec', default=False,
+ description='Enable Adaptive Entropy Coding for decoding/encoding')
variant('pthreads', default=False,
- description="Enable POSIX threads")
+ description='Enable POSIX threads')
variant('openmp', default=False,
- description="Enable OpenMP threads")
+ description='Enable OpenMP threads')
variant('memfs', default=False,
- description="Memory based access to definitions/samples")
+ 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('build_type', default='RelWithDebInfo',
description='The build type to build',
values=('Debug', 'Release', 'RelWithDebInfo', 'Production'))
depends_on('netcdf', when='+netcdf')
- depends_on('openjpeg', when='+jpeg')
+ depends_on('openjpeg', when='jp2k=openjpeg')
+ depends_on('jasper', when='jp2k=jasper')
depends_on('libpng', when='+png')
- depends_on('py-numpy', when='+python')
+ depends_on('libaec', when='+aec')
+ depends_on('python@:2', when='+python')
+ depends_on('py-numpy', when='+python', type=('build', 'run'))
extends('python', when='+python')
+ conflicts('+openmp', when='+pthreads',
+ msg='Cannot enable both POSIX threads and OMP')
+
+ # The following enforces linking against the specified JPEG2000 backend.
+ patch('enable_only_openjpeg.patch', when='jp2k=openjpeg')
+ patch('enable_only_jasper.patch', when='jp2k=jasper')
+
def cmake_args(self):
- variants = ['+netcdf', '+jpeg', '+png', '+python',
- '+pthreads', '+openmp', '+memfs']
- options = ['NETCDF', 'JPG', 'PNG', 'PYTHON',
- 'ECCODES_THREADS', 'ECCODES_OMP_THREADS', 'MEMFS']
- return map(lambda variant, option: "-DENABLE_%s=%s" %
- (option, 'YES' if variant in self.spec else 'NO'),
- variants, options)
+ variants = ['+netcdf', '+png', '+aec', '+pthreads',
+ '+openmp', '+memfs', '+python', '+fortran']
+ options = ['NETCDF', 'PNG', 'AEC', 'ECCODES_THREADS',
+ 'ECCODES_OMP_THREADS', 'MEMFS', 'PYTHON', 'FORTRAN']
+
+ args = map(lambda var, opt:
+ "-DENABLE_%s=%s" %
+ (opt, 'ON' if var in self.spec else 'OFF'),
+ variants,
+ options)
+
+ if self.spec.variants['jp2k'].value == 'none':
+ args.append('-DENABLE_JPG=OFF')
+ else:
+ args.append('-DENABLE_JPG=ON')
+
+ return args