# Contribution from IT4Innovations National Supercomputing Center, Czech Republic
# Jakub Kropacek, 2022

name = 'XCrySDen'
version = '1.6.2'

homepage = "http://www.xcrysden.org/"
description = """
XCrySDen is a crystalline and molecular structure visualisation program aiming
at display of isosurfaces and contours, which can be superimposed on
crystalline structures and interactively rotated and manipulated.
"""
docurls = "http://www.xcrysden.org/Documentation.html"

toolchain = {'name': 'foss', 'version': '2022a'}

source_urls = ["http://www.xcrysden.org/download/"]
sources = [SOURCELOWER_TAR_GZ]
patches = ['XCrySDen-1.6.2-no-bwidget-tcl-download.patch']
checksums = [
    '811736ee598bec1a5b427fd10e4e063a30dd7cadae96a43a50b36ce90a4f503f',  # xcrysden-1.6.2.tar.gz
    'e5f79c77116c6faf441d63f62bb3d22c5520163995b28e505d2168424a587bac',  # XCrySDen-1.6.2-no-bwidget-tcl-download.patch
]

dependencies = [
    ('Togl', '2.0'),
    ('Mesa', '22.0.3'),
    ('libGLU', '9.0.2'),
    ('bwidget', '1.9.15'),
]

# gcc fix by Jakob Schiotz, commit 7433b19bd05d1d511ee135a92b3ba845c89814d7
prebuildopts = "export LDLIB='-ldl -Wl,--allow-multiple-definition' &&"

sanity_check_commands = [
    'xcrysden --help',
    # requires DISPLAY
    #'xcrysden --xsf $EBROOTXCRYSDEN/share/%(namelower)s-%(version)s/examples/XSF_Files/GaAsH.xsf --print output.png \
    # && rm output.png',
]

moduleclass = 'vis'
