# -*- 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: Portfile 106631 2013-06-02 18:31:09Z ryandesign@macports.org $

PortSystem          1.0
PortGroup           active_variants 1.1

name                etsf_io
version             1.0.3
categories          science
platforms           darwin
license             LGPL-2.1
maintainers         gmail.com:dstrubbe
description         A library of F90 routines to read/write the ETSF_IO file format.
long_description    A library of F90 routines to read/write the common ETSF_IO file format developed by \
                    the European Theoretical Spectroscopy Facility (ETSF) for electronic-structure codes.
homepage            http://www.etsf.eu/resources/software/libraries_and_tools
master_sites        http://www.etsf.eu/system/files \
                    https://launchpad.net/etsf-io/+milestone/${version}

checksums           rmd160  df90acd34b0de104a07844ae2c9694edf27519c6 \
                    sha1    ab3c4cb22ea2fc2498b396f186f221edd2463fcc

depends_lib         port:netcdf-fortran

# https://trac.macports.org/ticket/39319
require_active_variants netcdf-fortran {} universal

configure.optflags  -O3

configure.args      --with-netcdf-module-path=${prefix}/include \
                    --with-netcdf-ldflags=-L${prefix}/lib

use_parallel_build  yes

# it is not clear how to set the netcdf-module-path appropriately for +universal
# it could be ${prefix}/mods32/include or ${prefix}/mods64/include instead of above
universal_variant   no

test.run            yes
test.cmd            make
test.target         check

variant gcc46 conflicts gcc47 description {Build with GCC 4.6} {
    configure.compiler  macports-gcc-4.6
    depends_lib-append  port:gcc46
    require_active_variants netcdf-fortran gcc46
}
variant gcc47 conflicts gcc46 description {Build with GCC 4.7} {
    configure.compiler  macports-gcc-4.7
    depends_lib-append  port:gcc47
    require_active_variants netcdf-fortran gcc47
}

if {![variant_isset gcc46]} {
    default_variants    +gcc47
}

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