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

name                mathmod

categories          math graphics
license             GPL-2
maintainers         {@barracuda156 gmail.com:vital.had} openmaintainer
homepage            https://www.facebook.com/parisolab

description         Mathematical modelling software
long_description    ${name} is a mathematical modelling software that \
                    visualizes and animates implicit and parametric surfaces.

if {${os.platform} ne "darwin" || ${os.major} > 11} {
    PortGroup       qmake5 1.0

    github.setup    parisolab mathmod 11.1
    revision        0
    checksums       rmd160  48a59ed6858a3c1543458be6ce4411746c5b0890 \
                    sha256  b9d4c550d09a8ad307df90ffbb6f89e81846c5ea93d3f3e2616207a76227421a \
                    size    7934535

    compiler.cxx_standard \
                    2011
} else {
    # See: https://github.com/parisolab/mathmod/issues/243
    PortGroup       qmake 1.0

    github.setup    parisolab mathmod 7.0
    revision        0
    checksums       rmd160  3cd5480896ae051b7e6ff489419611aaf35e8b89 \
                    sha256  5ae4d2536f1e1a2883c83b8aa2d77ab54795968aa0635133ba58ff916e7a8622 \
                    size    947569

    depends_lib-append \
                    port:qjson4

    patchfiles-append \
                    patch-jiso.h.diff \
                    patch-jpar.h.diff \
                    patch-parametersoptions.h.diff \
                    patch-ParisoMathObject.h.diff \
                    patch-drawingoptions.cpp.diff \
                    patch-parametersoptions.cpp.diff \
                    patch-ParisoMathObject.cpp.diff \
                    patch-drawingoptions.ui.diff \
                    patch-commun.cpp.diff \
                    patch-mathmodconfig.js.diff

    # Q_DECL_OVERRIDE is intended to be this way:
    configure.cppflags-append \
                    -I${prefix}/include/QJson4 \
                    -DQ_DECL_OVERRIDE=

    configure.ldflags-append \
                    -lQJson4
}

github.tarball_from archive

destroot {
    copy ${worksrcpath}/MathMod.app ${destroot}${applications_dir}/
}
