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

name                EqualX
version             0.7.1
revision            1

homepage            https://equalx.sourceforge.io
master_sites        sourceforge:project/equalx/${name}-0.7/
distname            equalx-${version}

checksums           rmd160  03f05c0c0e067e5ebc6dd7a11033c5f077da660b \
                    sha256  7f62e580206bc0e8e83a39bf4161bf6a6b0cd268507d5e1ad0781eeba1191f8b \
                    size    275318

if {${os.platform} eq "darwin" && ${os.major} < 11} {
    PortGroup       qmake 1.0

    notes "
    If upon launch ${name} does not recognize location of external binaries it needs,\
    please go to Settings:Advanced and click Restore Defaults.
    "
} else {
    PortGroup       qmake5 1.0

}

categories          tex science
license             GPL-3
maintainers         {@barracuda156 gmail.com:vital.had} openmaintainer

description         ${name} Equation Editor
long_description    ${name} is just a graphical interface to latex and a bunch of conversion programs \
                    for aiding you write equations faster in latex and export them to other applications.

depends_lib-append  port:exempi
depends_run-append  port:ghostscript \
                    port:poppler \
                    port:texlive-latex

patchfiles-append   patch-defines.h.diff patch-DialogPreferences.cpp.diff \
                    patch-equalx.pro.diff patch-MainWindow.cpp.diff

post-patch {
    reinplace "s,@PREFIX@,${prefix},g" ${worksrcpath}/equalx.pro ${worksrcpath}/include/defines.h
}

destroot {
    copy ${worksrcpath}/equalx.app ${destroot}${applications_dir}
    set resdir ${prefix}/share/equalx/resources
    xinstall -d ${destroot}${resdir}
    copy ${worksrcpath}/resources/symbols ${destroot}${resdir}
    xinstall -m 0644 -W ${worksrcpath} LICENSE README ${destroot}${prefix}/share/equalx
}
