# $Id: Portfile 66204 2010-04-07 08:21:36Z ryandesign@macports.org $

PortSystem              1.0

name                    OpenSceneGraph
version                 2.8.3
set inconvenient_version    [strsed ${version} {/\.0$//}]
maintainers             ryandesign openmaintainer
license                 OpenSceneGraph-0.0 wxWindows-3 LGPL-2.1
platforms               darwin
categories              graphics
homepage                http://www.openscenegraph.org/
master_sites            ${homepage}downloads/stable_releases/${name}-${inconvenient_version}/source
use_zip                 yes
use_parallel_build      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               md5     dc43b9161555c4eab7f5a678dd4e01ab \
                        sha1    90502e4cbd47aac1689cc39d25ab62bbe0bba9fc \
                        rmd160  40a4988f4aefff7dbb6aab5225204ae41c945277

post-extract {
    # DOS to UNIX line endings
    reinplace "s|\r||g" ${worksrcpath}/CMakeLists.txt
}

patchfiles              patch-CMakeLists.txt.diff

depends_build           port:cmake

depends_lib             port:freetype \
                        port:gdal

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

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.version       ${inconvenient_version}
livecheck.type          regex
livecheck.url           ${homepage}downloads/stable_releases/
livecheck.regex         ${name}-(\[0-9.\]+)/
