easyblock = 'ConfigureMake'

name = 'Octave'
version = '4.2.1'
versionsuffix = '-without-X11'

homepage = 'http://www.gnu.org/software/octave/'
description = """GNU Octave is a high-level interpreted language, primarily intended for numerical local_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.53.1', '', True),
    ('FLTK', '1.3.4', '', True),
    ('zlib', '1.2.11', '', True),
    ('Qt5', '5.8.0', '', ('GCC', '6.3.0-2.27')),
    ('HDF5', '1.8.18', '-serial'),
    ('FFTW', '3.3.6'),
]

configopts = 'MOC=$EBROOTQT5/bin/moc '
configopts += 'UIC=$EBROOTQT5/bin/uic '
configopts += 'RCC=$EBROOTQT5/bin/rcc '
configopts += 'LRELEASE=$EBROOTQT5/bin/lrelease '
configopts += '--with-blas="$LIBBLAS" --with-lapack="$LIBLAPACK" --disable-docs '
configopts += '--without-opengl --without-qhull '
# correct for both GCC and Intel local_compilers
configopts += '--enable-fortran-calling-convention=gfortran'

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

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

moduleclass = 'math'
