# -*- 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 73117 2010-11-04 12:55:52Z michaelld@macports.org $

PortSystem          1.0

name                qwt
version             5.1.2
revision            2
conflicts           qwt52 qwt-devel
categories          graphics science
maintainers         michaelld openmaintainer
description         Qt Widgets for Technical Applications, version 5.1
long_description    \
    The Qwt 5.1 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 5.1 contains source incompatible changes versus 5.2. \
    See qwt52 for that port.
homepage            http://qwt.sourceforge.net
master_sites        sourceforge:qwt
distname            qwt-${version}
use_bzip2           yes
checksums           md5 cb26a36f020d7c038e207b03b7d79bc5 \
                    sha1 2fc04b78c438635a78e41a22fea6f9e016f7ca17 \
                    rmd160 a5a94aa3870a631f9605e6370c4d04fb1c79347e
platforms           darwin

patchfiles          patch-qwtconfig.pri.diff

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

    # set arch type
    reinplace "s/@ARCHES@/${qt_arch_types}/" \
        ${worksrcpath}/qwtconfig.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" {}
