# -*- 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 88567 2012-01-04 11:48:40Z phw@macports.org $

PortSystem          1.0

name                qwt-60
version             6.0.1
conflicts           qwt qwt52 qwt-devel
categories          graphics science
maintainers         phw 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     ace68558eab873e2da7e641179c4ef0c \
                    sha1    301cca0c49c7efc14363b42e082b09056178973e \
                    rmd160  54b815d131fd7e7c8bfd1a49fbf3bc7c0ccc9c7a
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+)+)\\/
