# -*- 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
# $Id$

PortSystem          1.0
PortGroup compilers 1.0

name                splash
version             2.5.1
revision            2
categories          science graphics
platforms           darwin
maintainers         monash.edu:daniel.price
description         Smoothed Particle Hydrodynamics visualisation tool
long_description    SPLASH is a tool for visualisation of (mainly astrophysical) \
                    Smoothed Particle Hydrodynamics simulations

homepage            http://users.monash.edu.au/~dprice/splash
master_sites        ${homepage}/releases/
license             GPL-2+

worksrcdir          ${name}

checksums           rmd160  5c87a5394c53b0f1b9a0e89170bc8ea8a7ed77b3 \
                    sha256  57d9eb6c8ff411ffc19e6be976debed2fd1bc1dcbe52cb42c30f5e05f6d37918

default_variants    +giza

use_configure       no

compilers.setup     require_fortran -dragonegg -g95 -gcc44 -clang -llvm

build.cmd           make
build.args          SYSTEM=gfortran CC=${configure.cc} FC=${configure.fc}

destroot.args       PREFIX=${prefix}
use_parallel_build  no

variant giza description {use giza as the backend graphics library} conflicts pgplot {
   depends_lib-append      path:lib/pkgconfig/cairo.pc:cairo \
                           port:xorg-libX11
   build.args-append       X11DIR=${prefix} X11LIBS='-L${prefix}/lib -lX11'
}

variant pgplot description {use PGPLOT as the backend graphics library} conflicts giza {
   depends_lib-append      port:pgplot
   build.env-append        PGPLOT_DIR=${prefix}/lib \
                           PGPLOT_DEV=/xw
   build.args-append       BACKEND=pgplot
}

build.args-append   FC="${configure.fc}" \
                    CC="${configure.cc}"

pre-build {
    build.args-append CC=${configure.cc} FC=${configure.fc}
}

variant hdf5 description {compiles data reads that depend on HDF5} {
   build.args-append       gadgethdf5 amuse_hdf5 HDF5ROOT=${prefix}
   depends_lib-append      port:hdf5
}

variant h5part description {compiles H5Part data read} {
   build.args-append       h5part HDF5ROOT=${prefix} H5PART_DIR=${prefix} H5PART_LIBS="-L${prefix}/lib -lH5Part"
   depends_lib-append      port:H5Part
}

variant read_extraformats1 description {compiles additional data reads: foulkes, mbatesph, oilonwater, rsph, urban (f/b/o/r/usplash)} conflicts read_extraformats2 {
   build.args-append       foulkes mbatesph oilonwater rsph urban
}

variant read_extraformats2 description {compiles additional data reads: Bauswein, UCLA, vanaverbeke data read (bsplash, usplash, vsplash)} conflicts read_extraformats1 {
   build.args-append       bauswein ucla vanaverbeke
}