easyblock = 'ConfigureMake'

name = 'RELION'
version = '1.4'
versionsuffix = '-single'

homepage = 'http://www2.mrc-lmb.cam.ac.uk/relion/index.php/Main_Page'
description = """RELION (for REgularised LIkelihood OptimisatioN, pronounce rely-on) is a stand-alone computer
 program that employs an empirical Bayesian approach to refinement of (multiple) 3D reconstructions or 2D class
 averages in electron cryo-microscopy (cryo-EM)."""

toolchain = {'name': 'intel', 'version': '2016b'}
toolchainopts = {'opt': True}

source_urls = ['http://www2.mrc-lmb.cam.ac.uk/groups/scheres/1sep15/']
sources = [SOURCELOWER_TAR_BZ2]

patches = ['RELION-%(version)s_fltk-config.patch']

dependencies = [
    ('X11', '20160819'),
    ('FFTW', '3.3.5'),
    ('FLTK', '1.3.3'),
]

# RELION expects FLTK to be in external/fltk-1.3.0 and we have to add fltk libraries
configopts = '--enable-mpi --enable-float ' 
configopts += 'LIBS="-lfltk -lXcursor -lXfixes -lXext -lXft -lfontconfig -lXinerama -lpthread -lX11" '
configopts += '&& ln -s $EBROOTFLTK/include external/fltk-1.3.0 '
# users expect the maingui binary to be called relion
installopts = " && cp %(installdir)s/bin/relion_maingui %(installdir)s/bin/%(namelower)s "

moduleclass = 'bio'
