easyblock = "CMakeMake"

name = "GMT"
version = "5.4.1"

homepage = 'http://gmt.soest.hawaii.edu/'
description = """GMT is an open source collection of about 80 command-line tools for manipulating
 geographic and Cartesian data sets (including filtering, trend fitting, gridding, projecting,
 etc.) and producing PostScript illustrations ranging from simple x-y plots via contour maps
 to artificially illuminated surfaces and 3D perspective views; the GMT supplements add another
 40 more specialized and discipline-specific tools. """

toolchain = {'name': 'intel', 'version': '2017a'}

gshhg_ver = '2.3.6'
dcw_ver = '1.1.2'
sources = [
    'gmt-%(version)s-src.tar.xz',
    # coastlines, rivers, and political boundaries
    'gshhg-gmt-%s.tar.gz' % gshhg_ver,
    # country polygons
    'dcw-gmt-%s.tar.gz' % dcw_ver,
]

# 'http://gmt.soest.hawaii.edu/files/download?name=' needs flash enabled browser
source_urls = [
    'ftp://ftp.soest.hawaii.edu/gmt',
    'ftp://ftp.soest.hawaii.edu/gmt/legacy',
    'ftp://ftp.soest.hawaii.edu/gshhg',
    'ftp://ftp.soest.hawaii.edu/gshhg/legacy',
    'ftp://ftp.soest.hawaii.edu/dcw',
    'ftp://ftp.soest.hawaii.edu/dcw/legacy',
]

patches = ['GMT-5.1.2_netCDF.patch']

builddependencies = [('CMake', '3.8.1')]

dependencies = [
    ('PCRE', '8.40'),
    ('GDAL', '2.1.3', '-Python-2.7.13'),
    ('FFTW', '3.3.6'),
    ('netCDF', '4.4.1.1'),
    ('Ghostscript', '9.21'),
    ('cURL', '7.53.1'),
    ('zlib', '1.2.11'),
]

configopts = '-DCOPY_GSHHG=TRUE -DGSHHG_ROOT=%%(builddir)s/gshhg-gmt-%s ' % gshhg_ver
configopts += '-DCOPY_DCW=TRUE -DDCW_ROOT=%%(builddir)s/dcw-gmt-%s ' % dcw_ver

separate_build_dir = True

sanity_check_paths = {
    'files': ['bin/gmt', 'bin/isogmt'],
    'dirs': []
}

modextrapaths = {'GMTHOME': ''}

moduleclass = 'geo'
