# -*- 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                   cmake      1.1
PortGroup                   mpi        1.0
PortGroup                   muniversal 1.1

name                        cgnslib
github.setup                CGNS CGNS 4.4.0 v
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from         tarball
revision                    2
categories                  science
maintainers                 {mcalhoun @MarcusCalhoun-Lopez} openmaintainer
license                     zlib

description                 Computational fluid dynamics data container.
long_description            The CFD General Notation System (CGNS) provides a general, portable, \
                            and extensible standard for the storage and retrieval of computational \
                            fluid dynamics (CFD) analysis data. It consists of a collection of \
                            conventions, and free and open software implementing those conventions. \
                            It is self-descriptive, machine-independent, well-documented, and \
                            administered by an international steering committee.

homepage                    https://cgns.github.io

checksums                   rmd160  72f18104966897d947da9f7f54f655c371234efa \
                            sha256  d1c9a771680f832cf9940cbee1cdd60b929ba6b74df610cbf85bcd1d93fd1f85 \
                            size    1979921

mpi.setup

# see https://trac.macports.org/ticket/60192
configure.args-append       -DCGNS_BUILD_SHARED=ON

depends_lib-append          port:hdf5
mpi.enforce_variant         hdf5
configure.args-append       -DCGNS_ENABLE_HDF5=ON

# cgnslib assumes hdf5's API is the same as its version
# currently, hdf5 defaults to an older API
# see https://github.com/macports/macports-ports/blob/85a89b73647c04453103dd17a28b190f98e13f40/science/hdf5/Portfile#L61
# see https://github.com/CGNS/CGNS/blob/6649d34d78dd375e75566175b79d3d139a8e1d41/src/adfh/ADFH.c#L371
configure.cppflags-append   -DH5O_info_t_vers=2

if {[fortran_variant_isset]} {
    configure.args-append   -DCGNS_ENABLE_FORTRAN=ON
} else {
    configure.args-append   -DCGNS_ENABLE_FORTRAN=OFF
}

variant tests description {Enable tests} {
    test.run                yes
    configure.args-append   -DCGNS_ENABLE_TESTS=ON
}

# do not find, e.g, 3.4.0-rc1
github.livecheck.regex      {([0-9.]+)}
