easyblock = 'ConfigureMake'

name = 'CRPropa'
version = '2.0.3'

homepage = 'https://crpropa.desy.de'
description = """CRPropa is a publicly available code to study the propagation of ultra high energy nuclei up to iron
 on their voyage through an extra galactic environment."""

toolchain = {'name': 'ictce', 'version': '5.5.0'}

source_urls = ['https://github.com/CRPropa/CRPropa2/archive/']
sources = ['v%(version)s.tar.gz']

patches = ['CRPropa-%(version)s_no-docs.patch']

dependencies = [
    ('CLHEP', '2.1.3.1'),
    ('CFITSIO', '3.350'),
    ('ROOT', 'v5.34.13'),
    ('FFTW', '3.3.3'),
]
builddependencies = [('Doxygen', '1.8.5')]

configopts = '--with-clhep-path=$EBROOTCLHEP/bin'
configopts += '--with-cfitsio-include=$EBROOTCFITSIO/include --with-cfitsio-library=$EBROOTCFITSIO/lib '
configopts += '--with-root=$EBROOTROOT/lib'

# download and install the photo disintegration data package
prebuildopts = './GetPDCrossSections.sh && '

runtest = 'check'

sanity_check_paths = {
    'files': ["bin/CRPropa"],
    'dirs': ["lib", "share"],
}

moduleclass = 'phys'
