# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; truncate-lines: t -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4
# $Id: Portfile 74451 2010-12-18 01:24:52Z ryandesign@macports.org $

PortSystem          1.0

name                qwt-devel
version             6.0.0-rc3
conflicts           qwt qwt52
categories          graphics science
maintainers         michaelld openmaintainer
description         Qt Widgets for Technical Applications, version 6.0
long_description    \
    The Qwt 6.0 library contains GUI Components and utility classes \
    which are primarily useful for programs with a technical \
    background. Beside a 2D plot widget it provides scales, sliders, \
    dials, compasses, thermometers, wheels and knobs to control \
    or display values, arrays, or ranges of type double. \
    Version 6.0 contains source incompatible changes versus 5.1. \
    See qwt for that port.
homepage            http://qwt.sourceforge.net
master_sites        sourceforge:qwt
distname            qwt-${version}
use_bzip2           yes
use_parallel_build  no
checksums           md5     00372e5c149ccd2bc7a31791320fd7ea \
                    sha1    6052dcd0756947685ac7e465f25642c804c6973d \
                    rmd160  68b9779e6837e09e99783d7a3b3d42740c737c85

platforms           darwin

patchfiles          patch-qwtconfig.pri.diff \
                    patch-qwtbuild.pri.diff

post-patch {
    # setup for debug, if selected
    if {[variant_isset debug]} {
        reinplace "/CONFIG/s@release@debug_and_release build_all@" \
            ${worksrcpath}/qwtbuild.pri
    }

    # set arch type
    reinplace "s/@ARCHES@/${qt_arch_types}/" \
        ${worksrcpath}/qwtbuild.pri

    # setup for examples, if selected
    if {![variant_isset examples]} {
        reinplace "s@QwtExamples@@" \
            ${worksrcpath}/qwtconfig.pri
    }
}

variant qt3 conflicts qt4 description {Use qt3-mac} {}

variant qt4 conflicts qt3 description {Use qt4-mac} {}

# move setting of 'qt_qmake_cmd' outside variants, since 'if'
# statements are processed in-order while variants are processed after
# everything else.
set qt_qmake_cmd ""
if {[variant_isset qt3]} {
    depends_lib-append  port:qt3-mac
    set qt_qmake_cmd    ${prefix}/libexec/qt3-mac/bin/qmake
} else {
    # when variant 'qt3' is not set, use qt4 whether by default or via
    # the user's variant choice
    if {![variant_isset qt4]} {
        default_variants    +qt4
    }
    PortGroup           qt4 1.0
}

configure.cmd       ${qt_qmake_cmd}
configure.pre_args  INSTALLBASE="${prefix}"

# qmake does not handle these flags flags
configure.universal_args-delete --disable-dependency-tracking
configure.args-delete           --disable-dependency-tracking

# allow ccache, if specified by the user
pre-build {
    if {[tbool configure.ccache]} {
        build.post_args "CCACHE=ccache"
    }
}

universal_variant   yes

variant debug description "Build release and debug versions" {}

variant examples description "Build examples" {}

livecheck.url           http://sourceforge.net/api/file/index/project-id/13693/mtime/desc/rss?path=%2Fqwt
livecheck.regex         \\/qwt\\/(\\d+(\\.\\d+)+)\\/
