# -*- 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                qwtplot3d
version             0.2.7
revision            3
categories          graphics science
platforms           darwin
maintainers         michaelld openmaintainer

description         Qt-based 3D-widgets
long_description    Feature-rich Qt / OpenGL-based C++ programming library, \
                    providing 3D-widgets for technical applications

homepage            http://${name}.sourceforge.net
master_sites        sourceforge:${name}
worksrcdir          ${name}
extract.suffix      .tgz

checksums           md5    2f14660152e2e26bfeaaeec479ed9f2b \
                    sha1   4463fafb8420a91825e165da7a296aaabd70abea \
                    rmd160 0f28462cb95ef6091d73642c8b26ece60d50bfb8
platforms           darwin

patchfiles          patch-qwtplot3d.pro.diff

# use any QWT version, but default to 5.2
depends_lib-append  path:lib/libqwt.dylib:qwt52

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
}

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

    # set arch type(s)
    reinplace "s/@ARCHES@/${qt_arch_types}/g" \
        ${worksrcpath}/qwtplot3d.pro
}

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" {}
