easyblock = 'ConfigureMake'

name = 'HDF'
version = '4.2.15'

homepage = 'https://www.hdfgroup.org/products/hdf4/'

description = """
 HDF (also known as HDF4) is a library and multi-object file format for
 storing and managing data between machines.
"""

toolchain = {'name': 'GCCcore', 'version': '10.2.0'}
toolchainopts = {'pic': True}

source_urls = ['http://www.hdfgroup.org/ftp/HDF/releases/HDF%(version)s/src/']
sources = [SOURCELOWER_TAR_GZ]
checksums = ['dbeeef525af7c2d01539906c28953f0fdab7dba603d1bc1ec4a5af60d002c459']

builddependencies = [
    ('binutils', '2.35'),
    ('Bison', '3.7.1'),
    ('flex', '2.6.4'),
]

dependencies = [
    ('libjpeg-turbo', '2.0.5'),
    ('Szip', '2.1.1'),
    ('zlib', '1.2.11'),
    ('libtirpc', '1.2.6'),
]

preconfigopts = "LIBS='-ltirpc' "
configopts = '--with-szlib=$EBROOTSZIP '
configopts += '--includedir=%(installdir)s/include/%(namelower)s '
buildopts = 'FFLAGS="$FFLAGS -fallow-argument-mismatch -I../src" '

modextrapaths = {'CPATH': 'include/hdf'}

sanity_check_paths = {
    'files': ['bin/h4cc', 'bin/ncdump', 'lib/libdf.a', 'lib/libhdf4.settings', 'lib/libmfhdf.a'],
    'dirs': ['include/hdf'],
}

sanity_check_commands = [
    "h4cc --help",
    "ncdump -V",
]

moduleclass = 'data'
