# -*- 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           compilers 1.0

name                etsf_io
version             1.0.4
revision            4
categories          science
platforms           darwin
license             LGPL-2.1
maintainers         {dstrubbe @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  25d311b2952714639f315ae26dd1c25c84b9c0f0 \
                    sha1    8b7c7af083946e03f76b68af69c046d3b127494a

compilers.choose    fc
compilers.setup     require_fortran

depends_lib         port:netcdf-fortran

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

configure.optflags  -O3

configure.args      --with-netcdf-incs=-I${prefix}/include \
                    --with-netcdf-libs="-L${prefix}/lib -lnetcdf -lnetcdff"

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
# Warning: a few tests will fail with g95.

compilers.enforce_fortran netcdf-fortran

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