# -*- 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 120232 2014-05-20 00:40:31Z nicos@macports.org $

PortSystem          1.0
PortGroup           kde4   1.1

name                kdepimlibs4
version             4.12.5
categories          kde kde4
maintainers         nicos
license             GPL-2+ LGPL-2+ BSD
description         KDE4 core PIM libraries
long_description    Core libraries necessary for Personal Information Management (PIM) in KDE4
platforms           darwin
homepage            http://www.kde.org
master_sites        kde:stable/${version}/src/
use_xz              yes
distname            kdepimlibs-${version}

checksums           rmd160  e691e17ea0d62d95844b32ab260f251e5502f677 \
                    sha256  c6749903bcf46df07e419c02c42c6a8a32f29778de190a83c7f3ad0b7b335f22

#The only binaries linking to openssl (through QtNetwork) are libkimap.dylib
#and libmailtransport.dylib, which are purely LPGL, thus not conflicting with
#openssl license, apart from plugins in kioslaves
license_noconflict  openssl

depends_lib-append  port:kdelibs4 \
                    port:akonadi \
                    port:nepomuk-core \
                    port:boost \
                    port:libical \
                    port:openldap \
                    port:prison \
                    port:gpgme

#Suppress build of kioslaves which conflict with openssl
patchfiles-append   patch-CMakeLists.diff

configure.args-append   -DMAILTRANSPORT_INPROCESS_SMTP=Off

pre-activate {
    if {[file exists ${applications_dir}/KDE4/akonadi2xml.app/Contents/Info.plist]
        && ![catch {set vers [lindex [registry_active kdepim4-runtime] 0]}] 
        && [rpm-vercomp [lindex $vers 1] 4.12.0] < 0} {
            registry_deactivate_composite kdepim4-runtime "" [list ports_nodepcheck 1] 
    }
}

subport kdepimlibs4-kioslaves {

#kioslaves components conflict with openssl license
license_noconflict-delete   openssl

#The main kdepimlibs4 is required for linking with other libraries
depends_lib-append      port:kdepimlibs4

#Builds only kioslaves components
patchfiles-delete   patch-CMakeLists.diff
patchfiles-append   patch-CMakeLists-kioslaves.diff

#Suppresses files already installed by kdepimlibs4 main port
post-destroot {
    delete ${destroot}${prefix}/lib/cmake/KdepimLibs/KdepimLibsConfig.cmake \
           ${destroot}${prefix}/lib/cmake/KdepimLibs/KdepimLibsConfigVersion.cmake \
           ${destroot}${prefix}/share/apps/cmake/modules/KDEPimLibsDependencies.cmake \
           ${destroot}${prefix}/share/mime/packages/kdepimlibs-mime.xml
}
}

livecheck.url       http://kde.mirrors.hoobly.com/stable/
livecheck.regex     (\\d+(\\.\\d+)+)
