# -*- 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
PortGroup           boost  1.0

fetch.type          git
git.url             https://invent.kde.org/unmaintained/kde-workspace.git
git.branch          b904af16

name                kde4-workspace
version             4.14.4.20150324
revision            6
set plasmaversion   4.11.17
categories          kde kde4
maintainers         {gmail.com:rjvbertin @RJVB}
license             GPL-2+ LGPL-2.1+
description         KDE Workspace
long_description    Brings certain aspects of Linux/X11 KDE workspaces ("Plasma") to OS X, \
                    notably the System Settings application and the Oxygen style.\
                    KDE ${version} has Plasma ${plasmaversion}
platforms           darwin
homepage            https://www.kde.org/workspaces/
master_sites        kde:stable/${version}/src/
use_xz              yes

patchfiles          patch-CMakeLists-for-OSX.patch \
                    patch-libs-CMakeLists.patch \
                    patch-kcontrol.patch \
                    systemsettings-correct-menuplacement.patch

boost.depends_type  build

depends_build-append port:freetype \
                    path:lib/pkgconfig/libusb-1.0.pc:libusb

depends_lib-append  port:kdelibs4 \
                    port:kdepimlibs4 \
                    port:kactivities \
                    port:nepomuk-core \
                    port:libqalculate \
                    port:qjson \
                    port:qimageblitz

configure.args-append  -DBUILD_webkit:BOOL=ON

configure.args-delete -DCMAKE_BUILD_TYPE=Release
configure.args-append -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo -DCMAKE_STRIP:FILEPATH=/bin/echo

variant oxygen description {Build the Oxygen theme} {
    patchfiles-append     no-oxygen-theme.patch
}

default_variants    +oxygen

# maintainer convience: let the build go as far as possible to collect as
# many errors as possible (if any) in a single pass.
build.post_args-append \
                    -k

if {${os.major} >= 18} {
    # 10.14 "Mojave" seems to get confused about symbol visibility in this port, so turn
    # off selective visibility and make all symbols public.
    post-extract {
        xinstall -m 755 ${filespath}/FindKDE4Internal.cmake ${worksrcpath}/cmake/modules/
        reinplace "s|@PREFIX@|${prefix}|g" ${worksrcpath}/cmake/modules/FindKDE4Internal.cmake
    }
}

post-destroot {
    ln -s ${applications_dir}/KDE4/plasma-windowed.app/Contents/MacOS/plasma-windowed ${destroot}${prefix}/bin/plasma-windowed
}

livecheck.type      none
#livecheck.url       ${kde4.mirror}
#livecheck.regex     (\\d+(\\.\\d+)+)
