easyblock = 'ConfigureMake'

name = 'PaStiX'
version = '5.2.2.22'

homepage = 'http://pastix.gforge.inria.fr/'
description = """PaStiX (Parallel Sparse matriX package) is a scientific library that provides a high performance
 parallel solver for very large sparse linear systems based on direct methods."""

toolchain = {'name': 'intel', 'version': '2015b'}
toolchainopts = {'pic': True}

source_urls = ['https://gforge.inria.fr/frs/download.php/file/35070/']
sources = ['%(namelower)s_%(version)s.tar.bz2']
checksums = ['85127ecdfaeed39e850c996b78573d94']

dependencies = [
    ('hwloc', '1.11.2', '', ('GNU', '4.9.3-2.25')),
    ('SCOTCH', '6.0.4'),
]

skipsteps = ['configure']

start_dir = 'src'

prebuildopts = "cp -a config/LINUX-INTEL.in config.in && "
buildopts = 'BLASLIB="-L$BLAS_LIB_DIR $LIBBLAS" HWLOC_HOME=$EBROOTHWLOC SCOTCH_HOME=$EBROOTSCOTCH '
# take control over compiler flags
buildopts += 'CCFOPT="$CFLAGS" '
# fix value for $MPCXXPROG, default uses 'mpic++' which is incorrect
buildopts += 'MPCXXPROG="$MPICXX -cxx=$CXX -Wall" '

runtest = "examples && ./example/bin/simple -lap 100"

installopts = "PREFIX=%(installdir)s"

sanity_check_paths = {
    'files': ['bin/pastix-conf', 'lib/libmatrix_driver.a', 'lib/libpastix.a', 'lib/libpastix_murge.a'],
    'dirs': ['include'],
}

moduleclass = 'math'
