easyblock = 'ConfigureMake'

name = 'ATLAS'
version = '3.10.3'

homepage = 'http://math-atlas.sourceforge.net'
description = """ATLAS (Automatically Tuned Linear Algebra Software) is the application of
 the AEOS (Automated Empirical Optimization of Software) paradigm, with the present emphasis
 on the Basic Linear Algebra Subprograms (BLAS), a widely used, performance-critical, linear
 algebra kernel library."""

toolchain = {'name': 'GCC', 'version': '6.3.0-2.27'}
toolchainopts = {'pic': True}

local_lapackver = '3.6.1'
versionsuffix = '-LAPACK-%s' % local_lapackver

source_urls = [
    ('http://sourceforge.net/projects/math-atlas/files/Stable/%(version)s',
     'download'),
    'http://www.netlib.org/lapack/',
]
sources = [
    '%(namelower)s%(version)s.tar.bz2',
    'lapack-%s.tgz' % local_lapackver,
]

preconfigopts = 'export CXXFLAGS="-O3 -fPIC" && '
preconfigopts += 'export CFLAGS="-O3 -fPIC" && '
preconfigopts += 'mkdir build && '
preconfigopts += 'cd build && '
configure_cmd_prefix = '.'
configopts = "-Ss f77lib '-L$(EBROOTGCC)/lib64 -lgfortran' "
# salomon
#configopts += '-b 64  -D c -DPentiumCPS=2500 '
# anselm
configopts += '-b 64  -D c -DPentiumCPS=2300 '
configopts += '--with-netlib-lapack-tarfile=/apps/easybuild/sources/a/ATLAS/lapack-%s.tgz ' % local_lapackver
configopts += '-Fa alg -fPIC'
prebuildopts = 'cd build && '
preinstallopts = 'cd build && '
preinstallopts += 'make check && '
#preinstallopts += 'make ptcheck && '
preinstallopts += 'make time && '
postinstallcmds = [
    'cd build',
    'cp bin/ %(installdir)s/bin -R',
]

moduleclass = 'numlib'
