# -*- 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

PortSystem          1.0

name                qwtplot3d
version             0.2.7
revision            5
categories          graphics science
# mostly zlib license, but gl2ps is LGPL
license             LGPL
platforms           darwin
maintainers         {michaelld @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 \
                    patch-include_qwt3d_openglhelper.h.diff

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           qmake 1.0
    qt4.debug_variant   no
}

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.pre_args-append INSTALLBASE="${prefix}"

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

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