easyblock = 'ConfigureMake'

name = 'Octave'
version = '4.2.1'
versionsuffix = '-mic'

homepage = 'http://www.gnu.org/software/octave/'
description = """GNU Octave is a high-level interpreted language, primarily intended for numerical computations."""

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

source_urls = [GNU_SOURCE]
sources = [SOURCELOWER_TAR_GZ]

patches = ['%(name)s-%(version)s_intel.patch']

builddependencies = [
    ('Bison', '3.0.4', '', True),
    ('flex', '2.6.4', '', True),
    ('Autotools', '20150215', '', True),
    ('libtool', '2.4.6', '', True),
    ('gperf', '3.0.4'),
]

dependencies = [
    ('PCRE', '8.40', '', True),
    ('ncurses', '6.0', '', True),
    ('libreadline', '7.0', '', True),
    ('arpack-ng', '3.5.0'),
    ('cURL', '7.56.1', '', True),
    ('FLTK', '1.3.4', '', True),
    ('GLPK', '4.61'),
    ('GL2PS', '1.4.0'),
    ('Java', '1.8.0_121', '', True),
    ('zlib', '1.2.11', '', True),
    ('Qhull', '2015.2', '', True),
    ('Qt5', '5.8.0', '', ('GCC', '6.3.0-2.27')),
    ('HDF5', '1.8.18', '-serial'),
    ('qrupdate', '1.1.2'),
    ('SuiteSparse', '4.5.5', '-METIS-5.1.0'),
]

configopts = ' CC="icc -mmic" MOC=$EBROOTQT5/bin/moc '
configopts += 'UIC=$EBROOTQT5/bin/uic '
configopts += 'RCC=$EBROOTQT5/bin/rcc '
configopts += 'LRELEASE=$EBROOTQT5/bin/lrelease '
# correct for both GCC and Intel compilers
configopts += '--enable-fortran-calling-convention=gfortran'

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

sanity_check_commands = [('octave', '--eval "1+2"')]

moduleclass = 'math'