# -*- 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                kdiff3
version             0.9.98
revision            5
categories          devel
maintainers         nomaintainer
license             GPL-2
description         ${name} is a file comparing and merging tool.
long_description    ${name} compares two or three input files and shows \
                    the differences line by line and character by character. \
                    It provides an automatic merge facility and an integrated \
                    editor for comfortable solving of merge conflicts. \
                    ${name} allows recursive directory comparison and merging \
                    as well.

homepage            https://kdiff3.sourceforge.net
master_sites        sourceforge:project/kdiff3/kdiff3/${version}

checksums           rmd160  17fc05df3fd8f052e2010834ba8efe2481e4f434 \
                    sha256  802c1ababa02b403a5dca15955c01592997116a24909745016931537210fd668 \
                    size    1762715

variant kde description {Build the KDE version} {}

if {[variant_isset kde]} {
    PortGroup               kde4 1.1

    depends_lib-append      port:kdelibs4
    post-destroot {
        ln -s ${applications_dir}/KDE4/${name}.app/Contents/MacOS/kdiff3 ${destroot}${prefix}/bin
    }
} else {
    if {${os.platform} eq "darwin" && ${os.major} < 12} {
        PortGroup           qmake 1.0
        PortGroup           xcodeversion 1.0

        qt4.debug_variant   no
        minimum_xcodeversions {9 3.1}
    } else {
        PortGroup           qmake5 1.0

        qt5.debug_variant   no
    }

    # Naming here is inconsequential:
    set worksrcpath         ${worksrcpath}/src-QT4

    patchfiles-append       patch-src-QT4-kdiff3.pro.diff

    post-patch {
        reinplace "s|@PREFIX@|${prefix}|g" ${worksrcpath}/kdiff3.pro
    }

    variant debug description \
    {Build both release and debug library} {}

    if {[variant_isset debug]} {
        configure.args-append CONFIG+=\"debug_and_release build_all\"
    } else {
        configure.args-append CONFIG+=\"release\"
    }
}

livecheck.type      regex
livecheck.regex     "Current version: (\\d+(?:\\.\\d+)*)"
