From f3ec1d445d929dac6a001d3a1231985a198d16ae Mon Sep 17 00:00:00 2001 From: Julius-Plehn Date: Thu, 6 Aug 2020 16:02:40 +0200 Subject: [PATCH] New package: HDFView (#17707) * HDFView * adds support for version 3.1.1 --- .../repos/builtin/packages/hdf5/package.py | 3 ++ .../builtin/packages/hdfview/fix_build.patch | 12 +++++ .../repos/builtin/packages/hdfview/package.py | 49 +++++++++++++++++++ 3 files changed, 64 insertions(+) create mode 100644 var/spack/repos/builtin/packages/hdfview/fix_build.patch create mode 100644 var/spack/repos/builtin/packages/hdfview/package.py diff --git a/var/spack/repos/builtin/packages/hdf5/package.py b/var/spack/repos/builtin/packages/hdf5/package.py index c81ffb74dc..ba02bda8e0 100644 --- a/var/spack/repos/builtin/packages/hdf5/package.py +++ b/var/spack/repos/builtin/packages/hdf5/package.py @@ -57,6 +57,7 @@ class Hdf5(AutotoolsPackage): variant('hl', default=False, description='Enable the high-level library') variant('cxx', default=False, description='Enable C++ support') variant('fortran', default=False, description='Enable Fortran support') + variant('java', default=False, description='Enable Java support') variant('threadsafe', default=False, description='Enable thread-safe capabilities') @@ -78,6 +79,7 @@ class Hdf5(AutotoolsPackage): depends_on('m4', type='build', when='@develop') depends_on('mpi', when='+mpi') + depends_on('java', when='+java') # numactl does not currently build on darwin if sys.platform != 'darwin': depends_on('numactl', when='+mpi+fortran') @@ -237,6 +239,7 @@ def configure_args(self): extra_args += self.enable_or_disable('cxx') extra_args += self.enable_or_disable('hl') extra_args += self.enable_or_disable('fortran') + extra_args += self.enable_or_disable('java') api = self.spec.variants['api'].value if api != 'none': diff --git a/var/spack/repos/builtin/packages/hdfview/fix_build.patch b/var/spack/repos/builtin/packages/hdfview/fix_build.patch new file mode 100644 index 0000000000..d4e3ce7480 --- /dev/null +++ b/var/spack/repos/builtin/packages/hdfview/fix_build.patch @@ -0,0 +1,12 @@ +diff --git a/build.xml b/build_fixed.xml +index f0f2c3f..c486cbb 100644 +--- a/build.xml ++++ b/build_fixed.xml +@@ -943,7 +943,6 @@ + + + +- + + + diff --git a/var/spack/repos/builtin/packages/hdfview/package.py b/var/spack/repos/builtin/packages/hdfview/package.py new file mode 100644 index 0000000000..fd21cb9dca --- /dev/null +++ b/var/spack/repos/builtin/packages/hdfview/package.py @@ -0,0 +1,49 @@ +# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack import * +import os + + +class Hdfview(Package): + """HDFView is a visual tool written in Java for browsing + and editing HDF (HDF5 and HDF4) files.""" + + homepage = "https://www.hdfgroup.org/downloads/hdfview/" + url = "https://s3.amazonaws.com/hdf-wordpress-1/wp-content/uploads/manual/HDFView/hdfview-3.0.tar.gz" + + version('3.1.1', sha256='1cfd127ebb4c3b0ab1cfe54649a410fc7a1c2d73f45564697d3729f4aa6b0ba3', + url='https://support.hdfgroup.org/ftp/HDF5/releases/HDF-JAVA/hdfview-3.1.1/src/hdfview-3.1.1.tar.gz') + version('3.0', sha256='e2a16d3842d8947f3d4f154ee9f48a106c7f445914a9e626a53976d678a0e934') + + # unknown flag: --ignore-missing-deps + patch('fix_build.patch', when='@3.1.1') + + depends_on('ant', type='build') + depends_on('hdf5 +java') + depends_on('hdf +java -external-xdr +shared') + + def install(self, spec, prefix): + env['HDF5LIBS'] = spec['hdf5'].prefix + env['HDFLIBS'] = spec['hdf'].prefix + + ant = which('ant') + ant('-Dbuild.debug=false', 'deploy') + + dir_version = os.listdir('build/HDF_Group/HDFView/')[0] + path = 'build/HDF_Group/HDFView/{0}/'.format(dir_version) + hdfview = '{0}/{1}'.format(path, 'hdfview.sh') + + filter_file( + r'\$dir', + prefix, + hdfview + ) + + mkdirp(prefix.bin) + install(hdfview, prefix.bin.hdfview) + chmod = which('chmod') + chmod('+x', self.prefix.bin.hdfview) + install_tree(path, prefix)