easyblock = 'ConfigureMake'
name = 'NCO'
version = '5.0.1'

homepage = "https://github.com/nco/nco"
description = """The NCO toolkit manipulates and analyzes data stored in netCDF-accessible formats, 
including DAP, HDF4, and HDF5."""

toolchain = {'name': 'foss', 'version': '2021b'}

source_urls = ['https://github.com/nco/nco/archive/']
sources = ['%(version)s.tar.gz']
patches = ['NCO-%(version)s_fix_build_of_cxx_interface.patch']
checksums = [
    '37d11ffe582aa0ee89f77a7b9a176b41e41900e9ab709e780ec0caf52ad60c4b',  # 5.0.1.tar.gz
    'ea1bdaafd7b8bf8b84569634373868f2d8463d65bd9ec6f56143f4f7362f5c99',  # NCO-5.0.1_fix_build_of_cxx_interface.patch
]

builddependencies = [
    ('Bison', '3.7.6'),
    ('flex', '2.6.4'),
]

dependencies = [
    ('UDUNITS', '2.2.28'),
    ('expat', '2.4.1'),
    ('ANTLR', '2.7.7', '-Java-11'),
    ('libdap', '3.20.7'),
    ('GSL', '2.7'),
    ('netCDF', '4.8.0'),
    ('ESMF', '8.1.1'),  # ncremap needs ESMF_RegridWeightGen
]

sanity_check_paths = {
    'files': ['bin/nc%s' % x for x in ('ap2', 'atted', 'bo', 'diff', 'ea', 'ecat', 'es',
                                       'flint', 'ks', 'pdq', 'ra', 'rcat', 'rename', 'wa')] +
             ['lib/libnco.a', 'lib/libnco.%s' % SHLIB_EXT, 'lib/libnco_c++.a', 'lib/libnco_c++.%s' % SHLIB_EXT],
    'dirs': ['include'],
}

moduleclass = 'tools'
