# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 106608 2013-06-01 00:29:16Z devans@macports.org $

PortSystem              1.0

name                    OpenSceneGraph
conflicts               OpenSceneGraph-devel
version                 3.0.1
revision                4
maintainers             nomaintainer
license                 wxWidgets-3
platforms               darwin
categories              graphics
homepage                http://www.openscenegraph.org/
master_sites            ${homepage}downloads/stable_releases/${name}-${version}/source

use_zip                 yes

description             high-performance 3D graphics toolkit

long_description        ${name} is a high-performance 3D graphics toolkit \
                        useful in fields such as visual simulation, games, \
                        virtual reality, scientific visualization and modelling

checksums               rmd160  54b315c318b7ade2bcc65703cea5f41377e93a71 \
                        sha256  0c1103574b0a5a27c7d68d43454f1bf9c0cea114a583c42637bc8eb47b1d8296

patchfiles              patch-CMakeLists.txt.diff \
                        patch-src-osgViewer-DarwinUtils.mm.diff \
                        patch-include-osg-Math.diff

depends_build           port:cmake \
                        port:pkgconfig

depends_lib             port:freetype \
                        port:jasper \
                        port:zlib \
                        port:gdal \
                        port:curl \
                        port:poppler \
                        port:librsvg \
                        port:giflib \
                        port:tiff \
                        port:qt4-mac

# error: cannot initialize a parameter of type 'void *' with an lvalue of type 'const void *const'
compiler.blacklist      clang

configure.cmd           cmake
configure.pre_args      -DCMAKE_INSTALL_PREFIX=${prefix}
configure.args          -DCMAKE_BUILD_TYPE=Release \
                        -DCMAKE_INSTALL_NAME_DIR=${prefix}/lib \
                        -DOSG_WINDOWING_SYSTEM=Cocoa \
                        -DDESIRED_QT_VERSION=4

platform darwin {
    if {${os.major} < 9} {
        configure.args-append -DDEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT=ON
    }
}

universal_variant       no
# patch-CMakeLists.txt.diff removes the built-in universal support. We need a
# MacPorts-controlled universal build, but this universal variant is untested.
#variant universal {
#    configure.args-append   -DCMAKE_OSX_ARCHITECTURES="${configure.universal_archs}" \
#                            -DCMAKE_CXX_FLAGS="${configure.universal_cxxflags}"
#}

livecheck.type          regex
livecheck.url           ${homepage}downloads/stable_releases/
livecheck.regex         ${name}-(\\d+(?:\\.\\d+)*)
