# -*- 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           python 1.0
PortGroup           github 1.0

# When updating to the latest version, change the py*-cython-compat
# dependency to py*-cython and remove PYTHONPATH below.
github.setup        CoolProp CoolProp 6.4.3 v
github.tarball_from archive
name                py-coolprop
revision            1
license             MIT

checksums           rmd160  d4b2af6f609fdce11621caf6cddce304fdbbdb78 \
                    sha256  c981b26e7f9ae602599f527df73c7b62129b5d7104037a641f1b012397767b01 \
                    size    8021549

python.versions     310 311

maintainers         {juliensalort.org:mp @jsalort} openmaintainer
categories-append   science

description         Open-source thermodynamic and transport properties database
long_description    CoolProp implements: Pure and pseudo-pure fluid equations \
                    of state and transport properties for 122 components, \
                    mixture properties using high-accuracy Helmholtz energy \
                    formulations, correlations of properties of incompressible \
                    fluids and brines, computationally efficient tabular \
                    interpolation, highest accuracy psychrometric routines, \
                    user-friendly interface around the full capabilities of NIST \
                    REFPROP, fast IAPWS-IF97 (Industrial Formulation) for \
                    Water/Steam, and Cubic equations of state (SRK, PR).
homepage            http://www.coolprop.org


if {${name} ne ${subport}} {
    depends_build-append \
        path:bin/cmake:cmake \
        port:py${python.version}-cython-compat

    # This version is not compatible with Cython 3.
    set compat_path [string replace ${python.pkgd} 0 [string length ${python.prefix}]-1 ${prefix}/lib/py${python.version}-cython-compat]
    build.env-append    PYTHONPATH=${compat_path}

    depends_lib-append \
        port:libfmt4 \
        port:coolprop-if97 \
        port:coolprop-refprop-headers \
        port:rapidjson-devel \
        path:share/pkgconfig/eigen3.pc:eigen3 \
        port:msgpack-cpp \
        port:boost176

    build.env-append "CPPFLAGS=-I${prefix}/include/libfmt4 -I${prefix}/include/eigen3 -I${prefix}/libexec/boost/1.76/include"
    destroot.env-append "CPPFLAGS=-I${prefix}/include/libfmt4 -I${prefix}/include/eigen3 -I${prefix}/libexec/boost/1.76/include"

    patchfiles      patch-psy.diff patch-gui.diff patch-setup.diff patch-IF97.diff patch-rapidjson.diff patch-CoolPropFluid.diff patch-CPstrings.diff patch-REFPROPMixtureBackend.diff patch-HumidAirProp.diff

    build.dir       ${worksrcpath}/wrappers/Python
}
