diff options
Diffstat (limited to 'var/spack/repos')
5 files changed, 181 insertions, 25 deletions
diff --git a/var/spack/repos/builtin/packages/grib-api/cmake_install_rpath.patch b/var/spack/repos/builtin/packages/grib-api/cmake_install_rpath.patch new file mode 100644 index 0000000000..7e2b250883 --- /dev/null +++ b/var/spack/repos/builtin/packages/grib-api/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/grib-api/disable_numpy.patch b/var/spack/repos/builtin/packages/grib-api/disable_numpy.patch new file mode 100644 index 0000000000..c056388da8 --- /dev/null +++ b/var/spack/repos/builtin/packages/grib-api/disable_numpy.patch @@ -0,0 +1,12 @@ +--- a/python/CMakeLists.txt ++++ b/python/CMakeLists.txt +@@ -6,7 +6,8 @@ if( HAVE_PYTHON ) + #endif() + + # check for Numpy +- find_package( NumPy ) ++ # find_package( NumPy ) ++ set(NUMPY_FOUND FALSE) + + ############################################################################### + # swig python interface diff --git a/var/spack/repos/builtin/packages/grib-api/enable_only_jasper.patch b/var/spack/repos/builtin/packages/grib-api/enable_only_jasper.patch new file mode 100644 index 0000000000..06e9790f59 --- /dev/null +++ b/var/spack/repos/builtin/packages/grib-api/enable_only_jasper.patch @@ -0,0 +1,34 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -106,18 +106,7 @@ 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 GRIB_API_TPLS Jasper ) +@@ -125,12 +114,6 @@ if( ENABLE_JPG ) + set( HAVE_LIBJASPER 1 ) + endif() + +- if( OPENJPEG_FOUND ) +- list( APPEND GRIB_API_TPLS OpenJPEG ) +- set( HAVE_JPEG 1 ) +- set( HAVE_LIBOPENJPEG 1 ) +- endif() +- + endif() + + diff --git a/var/spack/repos/builtin/packages/grib-api/enable_only_openjpeg.patch b/var/spack/repos/builtin/packages/grib-api/enable_only_openjpeg.patch new file mode 100644 index 0000000000..a440477029 --- /dev/null +++ b/var/spack/repos/builtin/packages/grib-api/enable_only_openjpeg.patch @@ -0,0 +1,28 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -106,25 +106,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 GRIB_API_TPLS Jasper ) +- set( HAVE_JPEG 1 ) +- set( HAVE_LIBJASPER 1 ) +- endif() +- + if( OPENJPEG_FOUND ) + list( APPEND GRIB_API_TPLS OpenJPEG ) + set( HAVE_JPEG 1 ) diff --git a/var/spack/repos/builtin/packages/grib-api/package.py b/var/spack/repos/builtin/packages/grib-api/package.py index 5da851c1ba..3e23a7e4fd 100644 --- a/var/spack/repos/builtin/packages/grib-api/package.py +++ b/var/spack/repos/builtin/packages/grib-api/package.py @@ -30,51 +30,122 @@ class GribApi(CMakePackage): C, FORTRAN and Python programs developed for encoding and decoding WMO FM-92 GRIB edition 1 and edition 2 messages.""" - homepage = "https://software.ecmwf.int/wiki/display/GRIB/Home" - url = "https://software.ecmwf.int/wiki/download/attachments/3473437/grib_api-1.17.0-Source.tar.gz" + homepage = 'https://software.ecmwf.int/wiki/display/GRIB/Home' + url = 'https://software.ecmwf.int/wiki/download/attachments/3473437/grib_api-1.17.0-Source.tar.gz?api=v2' + list_url = 'https://software.ecmwf.int/wiki/display/GRIB/Releases' + maintainers = ['skosukhin'] + + version('1.24.0', 'dcc549069cdeeaa1959732c36ab3136f') version('1.21.0', 'eb64c5eb72e6e90841237cba9d644016') version('1.17.0', 'bca7114d2c3100501a08190a146818d2') version('1.16.0', '8c7fdee03344e4379d400ae20976a460') - variant('netcdf', default=False, description='Enable netcdf encoding/decoding using netcdf library') - variant('jpeg', default=True, description='Enable jpeg 2000 for grib 2 decoding/encoding') - variant('png', default=False, description='Enable png for decoding/encoding') + variant('netcdf', default=False, + description='Enable netcdf encoding/decoding using netcdf library') + variant('jp2k', default='openjpeg', values=('openjpeg', 'jasper', 'none'), + description='Specify JPEG2000 decoding/encoding backend') + variant('png', default=False, + description='Enable png for decoding/encoding') + variant('aec', default=False, + description='Enable Adaptive Entropy Coding for decoding/encoding') + variant('pthreads', default=False, + description='Enable POSIX threads') + variant('openmp', default=False, + description='Enable OpenMP threads') + variant('python', default=False, + description='Enable the Python interface') + variant('numpy', default=False, + description='Enable numpy support in the Python interface') + 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')) - depends_on('libpng', when='+png') + # 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('jasper', when='+jpeg') - depends_on('cmake@2.8.11:', type='build') + depends_on('openjpeg@1.5.0:1.5.999', when='jp2k=openjpeg') + depends_on('jasper', when='jp2k=jasper') + depends_on('libpng', when='+png') + depends_on('libaec', when='+aec') + depends_on('python@2.5:2.999', when='+python', + type=('build', 'link', 'run')) + depends_on('py-numpy', when='+python+numpy', type=('build', 'run')) + extends('python', when='+python') - def cmake_args(self): - spec = self.spec - args = ['-DBUILD_SHARED_LIBS=BOTH'] + conflicts('+openmp', when='+pthreads', + msg='Cannot enable both POSIX threads and OMP') + conflicts('+numpy', when='~python', + msg='Numpy variant is valid only when the Python interface is ' + 'enabled') + + # 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') + + # Disable NumPy even if it's available. + patch('disable_numpy.patch', when='+python~numpy') + + # 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!') - # We will add python support later. - args.append('-DENABLE_PYTHON=OFF') + def cmake_args(self): + var_opt_list = [('+pthreads', 'GRIB_THREADS'), + ('+openmp', 'GRIB_OMP_THREADS'), + ('+python', 'PYTHON'), + ('+fortran', 'FORTRAN'), + ('+examples', 'EXAMPLES'), + ('+test', 'TESTS')] - # Disable FORTRAN interface if we don't have it. - if (self.compiler.f77 is None) or (self.compiler.fc is None): - args.append('-DENABLE_FORTRAN=OFF') + args = ['-DENABLE_%s=%s' % (opt, 'ON' if var in self.spec else 'OFF') + for var, opt in var_opt_list] - if '+netcdf' in spec: - args.append('-DENABLE_NETCDF=ON') - args.append('-DNETCDF_PATH=%s' % spec['netcdf'].prefix) + 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 '+jpeg' in spec: - args.append('-DENABLE_JPG=ON') - args.append('-DJASPER_PATH=%s' % spec['jasper'].prefix) - else: + if self.spec.variants['jp2k'].value == 'none': args.append('-DENABLE_JPG=OFF') + else: + args.append('-DENABLE_JPG=ON') - if '+png' in spec: - args.append('-DENABLE_PNG=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 |