# -*- 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 99826 2012-11-18 11:54:44Z ryandesign@macports.org $

PortSystem          1.0
PortGroup           kde4 1.1
PortGroup           muniversal 1.0

name                kdevelop
version             4.4.1
categories          kde kde4
platforms           darwin
license             GPL-2+
maintainers         nicos openmaintainer

description         KDE development IDE
long_description    KDevelop is a free, open source IDE (Integrated \
                    Development Environment) for MS Windows, Mac OS X, \
                    Linux, Solaris and FreeBSD. It is a feature-full, \
                    plugin extensible IDE for C/C++ and other programming \
                    languages. It is based on KDevPlatform, and the KDE \
                    and Qt libraries and is under development since 1998.

homepage            http://www.kdevelop.org/
master_sites        kde:stable/kdevelop/${version}/src/

checksums           rmd160  e37a5f25711bb283b68e7a8d2a2f194c3176abcb \
                    sha256  7efac56e0390910247e8d3c4a80ce215a1dc4c75b0a1ecc5b594d8de35acde0c

use_bzip2           yes

depends_run-append  port:cmake

depends_lib-append  port:kdelibs4 \
                    port:kdevplatform \
                    port:kate \
                    port:oxygen-icons

#1. Avoid automatic use of valgrind unless specified in variant
#2. Avoid automatic use of okteta unless specified in variant
#3. Suppress general std=c++0x definition which crashes with pure C files
#4-5. Change use of std::list with QList which is recognized during build
patchfiles          patch-ConfigureChecks.diff \
                    patch-okteta.diff \
                    patch-Cxx.diff \
                    patch-declarationbuilder.diff \
                    patch-context.diff

if {![variant_isset docs]} {
    patchfiles-append   patch-CMakeLists.diff
}

variant valgrind description "Adds support for valgrind" {
    depends_lib-append  port:valgrind
    patchfiles-delete   patch-ConfigureChecks.diff
}

variant okteta description "Adds support for okteta and kdesdk" {
    depends_lib-append  port:kdesdk4
    patchfiles-delete   patch-okteta.diff
}    

#Using c++0x for Lion and higher in case of clang 64-bit
if {${configure.compiler} == "clang" && ${os.platform} == "darwin" && ${os.major} >= 11} {
    lappend merger_configure_args(x86_64)   -DCMAKE_CXX_FLAGS='-stdlib=libc++' -DHAVE_UNORDERED_MAP=1
    if {${build_arch} == "x86_64" && ![variant_isset universal]} {
        configure.args-append               -DCMAKE_CXX_FLAGS="-stdlib=libc++" -DHAVE_UNORDERED_MAP=1
    }
}

livecheck.url       http://kde.mirrors.hoobly.com/stable/${name}
livecheck.regex     "\(\\d+(?:\\.\\d+)*)\/"
