# -*- coding: utf-8; mode: tcl; tab-width: 4; truncate-lines: t; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4
# $Id$

PortSystem          1.0
PortGroup           kde4   1.0

name                kdelibs4
version             4.4.5
revision            2
categories          kde kde4
maintainers         snc sharky
description         KDE4 core libraries
long_description    Core libraries for KDE4 applications to function
platforms           darwin
homepage            http://www.kde.org
master_sites        kde:stable/${version}/src/
use_bzip2           yes
distname            kdelibs-${version}
checksums           sha1    73e37abee48536b85782d1a17f1b282313b16c4d \
                    rmd160  533a627116524d5365ba45f5eb17c972426f59c1

depends_build-append port:flex port:gmake

depends_lib-append  \
                    port:bzip2 port:zlib \
                    port:soprano port:cyrus-sasl2 \
                    port:strigi port:gettext \
                    port:pcre port:shared-mime-info \
                    lib:libgif:giflib port:tiff \
                    port:jpeg port:libpng \
                    port:jasper port:openexr \
                    port:expat port:libart_lgpl \
                    port:libidn port:libiconv \
                    path:lib/pkgconfig/glib-2.0.pc:glib2 \
                    port:openssl port:enchant \
                    port:aspell port:aspell-dict-en \
                    port:attica port:liblzma \
                    port:avahi \
                    port:shared-desktop-ontologies

conflicts           kdelibs3

patchfiles          add-bundles-to-path.patch \
                    default-kde4-xdg-menu-prefix.patch \
                    fix-bundle-icons.patch \
                    workaround-kdeinit4-crash.patch \
                    patch-cmake-modules-FindKDE4-Internal.cmake.diff

patch.dir           ${workpath}/${distname}
patch.pre_args      -p1


configure.args-append   ../${distname} \
                        -DWITH_ENCHANT=ON \
                        -DWITH_Soprano=ON \
                        -DWITH_Avahi=ON \
                        -DKDE_DEFAULT_HOME=Library/Preferences/KDE \
                        -DWITH_HSPELL:BOOL=OFF \
                        -DPHONON_INCLUDE_DIR=${prefix}/libexec/qt4-mac/lib/phonon.framework/ \
                        -DLIBXSLT_INCLUDE_DIR=${prefix}/include/ \
                        -DLIBXSLT_LIBRARIES=${prefix}/lib/libxslt.dylib \
                        -DLIBEXSLT_LIBRARIES=${prefix}/lib/libexslt.dylib \
                        -DWITH_FAM=OFF

if { [file exists ${destroot}${prefix}/lib/kde4/kspell_aspell.so] } {
    notes "
Only the English dictionary has been installed.
You will need to install extra dictionaries to
get support for spell checking other languages.
The command 'port search aspell-dict' will show
you the currently available dictionary options.
"
}

variant no_avahi description {Disables KDE applications' access to multicast DNS/DNS-SD service discovery} {
    depends_lib-delete  port:avahi
    configure.args-delete   -DWITH_Avahi=ON
    configure.args-append   -DWITH_Avahi=OFF
}

variant no_shared_desktop_ontologies description {Remove ontologies necessary for the Nepomuk semantic desktop} {
    depends_lib-delete  port:shared-desktop-ontologies
    patchfiles-append   patch-disable-shared-desktop-ontologies.diff
}

variant no_xz description {Remove the ability to read and write xz compressed data files} {
    depends_lib-delete  port:liblzma
    patchfiles-append   patch-disable-liblzma.diff
}

universal_variant   no

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