# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           github 1.0
PortGroup           compilers 1.0

github.setup        golosio xrmc 6.7.0
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
revision            0
checksums           rmd160  bd85bc8b346489a7554d4ddee5ce2273d1f61225 \
                    sha256  03d4cbcb33c7fb59bd9397ad58524687ef7b05bd62dd67fc0b36497ba47d8ccf \
                    size    16154287

categories          science
maintainers         nomaintainer
license             GPL-3+

description         A Monte Carlo program for the accurate simulation of X-ray imaging and \
                    spectroscopy experiments in heterogeneous samples

long_description    XRMC is a Monte Carlo program for the accurate simulation \
                    of X-ray imaging and spectroscopy experiments in heterogeneous \
                    samples. The use of the Monte Carlo method makes the code \
                    suitable for the detailed simulation of complex experiments \
                    on generic samples. Variance reduction techniques are used \
                    to reduce the computational time considerably compared to \
                    general-purpose Monte Carlo programs. The program is written in \
                    C++ and has been tested on Linux, Mac OS X and MS Windows platforms.

homepage            ${github.homepage}/wiki
master_sites        http://lvserver.ugent.be/xrmc/files

depends_build       port:pkgconfig

depends_lib         port:xraylib

configure.args      --disable-xmi-msim --disable-openmp

test.run            yes
test.target         check

# gcc,clang38,clang37,clang36,clang34 fail test cylind_shell. llvm,dragonegg33,dragonegg34 are ok. So, be careful with variants!
# It is good to offer them since the default clang on Yosemite works but default on other OSX versions might not.
compilers.choose    cc cxx
compilers.setup     

variant openmp description {Build with OpenMP} {
    # COLLAPSE is a new clause that has been added in OpenMP 3.0, which is supported only in GCC 4.4 and later
    # so gcc 4.2 will give errors like this:
    # detector.cpp:187: error: expected '#pragma omp' clause before 'collapse'
    # detector.cpp:279: error: expected '#pragma omp' clause before 'collapse'
    # llvm-gcc-4.2 is fine though because the configure script correctly detects that OpenMP is not supported; same for default clang
    compiler.openmp_version 3.0
    configure.args-delete  --disable-openmp
    configure.args-append  --enable-openmp
}

default_variants-append +openmp

livecheck.type      regex
livecheck.url       [lindex ${master_sites} 0]
livecheck.regex     ${name}-(\[0-9.\]+)${extract.suffix}

# FIXME: somehow the main Makefile.am contains these inappropriate lines:
# DISTCHECK_CONFIGURE_FLAGS = CXX=g++-mp-4.9 CC=gcc-mp-4.9
