name = 'g2clib'
version = '1.6.0-patch'

homepage = 'http://www.nco.ncep.noaa.gov/pmb/codes/GRIB2/'
description = """Library contains GRIB2 encoder/decoder ('C' version)."""

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

source_urls = [homepage]
sources = ['%(name)s-%(version)s.tar']

dependencies = [
    ('JasPer', '1.900.1'),
    ('libpng', '1.6.32'),
]

buildopts = 'CFLAGS="$CFLAGS -DUSE_JPEG2000 -DUSE_PNG -D__64BIT__"'

skipsteps = ['install']

postinstallcmds = [
    "cd %(builddir)s/%(name)s-%(version)s && " +
    'rm -rf %(installdir)s && ' +
    'mkdir -p %(installdir)s/include && ' +
    'mkdir -p %(installdir)s/lib && ' +
    'cp *.h  %(installdir)s/include && ' +
    'cp libgrib2c.a %(installdir)s/lib && ' +
    "cd %(installdir)s/lib && " +
    'ln -s libgrib2c.a libg2c_v1.6.0.a'
]

# parallel build tends to fail
parallel = 1

moduleclass = 'data'
