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

name                kde4-kile
version             2.1.3
revision            8
categories          tex kde kde4
platforms           darwin
license             GPL-2+
maintainers         nomaintainer

description         KDE Integrated LaTeX Environment
long_description    Kile is a user friendly TeX/LaTeX editor for the KDE \
                    desktop environment. KDE is available for many \
                    architectures such as PC, PowerPC (Mac for example) and \
                    SPARC.

homepage            http://kile.sourceforge.net/
master_sites        sourceforge:project/kile/stable/kile-${version}
distname            kile-${version}

checksums           rmd160  22105a1e9b48b62dca9c866918ddc6dda3c278e2 \
                    sha256  a063ec4fca1ba5a063ffdcdb538967af35ade01d71fa7db6ea691ba2cf88cea2

use_bzip2           yes

depends_lib-append  port:kdelibs4

depends_run-append  port:okular \
                    port:kate \
                    bin:convert:ImageMagick \
                    bin:gs:ghostscript \
                    bin:tex:texlive

patchfiles-append   patch-kilestdtools.cpp.diff \
                    patch-kilestdtools.rc.macports.diff \
                    patch-runTests.sh.macports.diff \
                    patch-editorkeysequencemanager.diff

post-patch {
    if {[variant_isset mactex]} {
        reinplace "s|@TEXPREFIX@|/Library/TeX/texbin|g" \
            ${worksrcpath}/src/data/kilestdtools.rc ${worksrcpath}/src/test/runTests.sh
    } else {
        reinplace "s|@TEXPREFIX@|${prefix}/bin|g" \
            ${worksrcpath}/src/data/kilestdtools.rc ${worksrcpath}/src/test/runTests.sh
    }
    reinplace "s|@APPLICATIONS_DIR@|${applications_dir}|g" \
        ${worksrcpath}/src/data/kilestdtools.rc ${worksrcpath}/src/test/runTests.sh
}

variant mactex description "change support of kile for MacTeX TeXLive" {
    notes-append "For the mactex variant to work, /Library/TeX/texbin must also be added to binpath in macports.conf"
}

build.asroot        yes

livecheck.type      sourceforge
livecheck.url       http://sourceforge.net/projects/kile/files/stable/
livecheck.regex     /kile-(\[0-9.\]+)${extract.suffix}
