# -*- 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
# $Id: Portfile 126347 2014-10-08 14:48:31Z nicos@macports.org $

PortSystem          1.0
PortGroup           kde4   1.1

fetch.type          git
git.url             https://invent.kde.org/kde/kate
# git.branch          791ed223
git.branch          f17e4c99b64efca8afa42bc5

name                kate
version             4.14.3.23.gf17e4c99b
revision            2
categories          kde kde4
license             LGPL-2+
maintainers         nicos openmaintainer
description         Kate provides advanced editor components.
long_description    The Kate project develops two main products: KatePart, the advanced \
                    editor component which is used in numerous KDE applications requiring \
                    a text editing component, and Kate, a MDI text editor application. \
                    In addition, we provide KWrite, a simple SDI editor shell which allows \
                    the user to select his/her favourite editor component.
homepage            https://kate-editor.org
master_sites        kde:stable/${version}/src/
use_xz              yes
distname            kate-${version}

depends_lib-append  port:kdelibs4 \
                    path:share/icons/oxygen/index.theme:oxygen-icons \
                    port:qjson

# FIXME: crashes on launch: https://github.com/RJVB/macstrop/issues/141

# Avoids weird behaviour with Zoom on OS X (https://git.reviewboard.kde.org/r/120319/)
patchfiles          patch-Zoom.diff \
                    patch-no-pate.diff \
                    patch-open-docs-from-finder.diff
# part/view/kateviewhelpers.cpp:1706:27: error: call of overloaded 'abs(uint)' is ambiguous
patchfiles-append   patch-kateviewhelpers.diff

# Blacklist gcc42 and llvm-gcc-42 (does not build with gcc, ticket #37596)
# Also blacklist gcc40: kateviinputmodemanager.cpp: error: ambiguous overload for ‘operator+’ in ‘markerChar + ":"’
compiler.blacklist  *gcc-4.0 *gcc-4.2

configure.args-append \
                    -DCMAKE_DISABLE_FIND_PACKAGE_KActivities=ON

# variant pate description {Build the Pate Python 2.7 scripting plugin} {
#     depends_lib-append  port:py27-pykde4 port:py27-sip
#     patchfiles-delete   patch-no-pate.diff
# }

post-destroot {
    if {[file exists ${build.dir}/kate/app/kate_KDEINIT_SRCS.icns]
        && ![file exists ${destroot}${applications_dir}/KDE4/kate.app/Contents/Resources/kate_KDEINIT_SRCS.icns]} {
        # this really ought to be done by CMake, but I can't seem to get it to go all the way.
        xinstall -m 755 -d ${destroot}${applications_dir}/KDE4/kate.app/Contents/Resources
        xinstall -m 644 ${build.dir}/kate/app/kate_KDEINIT_SRCS.icns \
            ${destroot}${applications_dir}/KDE4/kate.app/Contents/Resources/kate_KDEINIT_SRCS.icns
    }
}

livecheck.type      none
