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

PortSystem          1.0
PortGroup           bitbucket 1.0

bitbucket.setup     Coin3D coin 3.1.3 Coin-
name                Coin
revision            8
license             BSD
description         cross platform C++ OpenGL scene graph library
long_description    Coin is a high-level 3D graphics library with a   \
                    C++ Application Programming Interface. Coin uses scene-graph data \
                    structures to render real-time graphics suitable for mostly all   \
                    kinds of scientific and engineering visualization applications.

conflicts           Coin-framework
categories          graphics devel
platforms           darwin
maintainers         nomaintainer

homepage            https://bitbucket.org/Coin3D/coin/wiki/Home

bitbucket.tarball_from downloads
distname            ${name}-${version}

checksums           rmd160  e57fd6a4876a06874429f9ad6b96f166f5609362 \
                    sha256  583478c581317862aa03a19f14c527c3888478a06284b9a46a0155fa5886d417

depends_lib-append  port:simage \
                    port:fontconfig \
                    port:freetype \
                    port:zlib \
                    port:bzip2

patchfiles          configure.patch \
                    for.patch \
                    clang-name-lookup.diff \
                    fix-weird-error.diff \
                    patch-include-Inventor-C-base-math-undefs.h.diff \
                    patch-Info.plist.in.diff \
                    add-static-cast.diff

configure.args-append \
                    --disable-debug \
                    --disable-symbols \
                    --disable-dependency-tracking \
                    --without-framework

post-build {
    reinplace -E {s|-arch [a-z0-9_]+||g} \
        ${worksrcpath}/Coin.pc \
        ${worksrcpath}/coin-default.cfg
}

if {${name} eq ${subport}} {

    variant manpages description {Include API documentation in manpages.} {
        depends_build-append    path:bin/doxygen:doxygen
        configure.args-append   --enable-man --mandir=${prefix}/share/man
        post-destroot {
            file rename ${destroot}${prefix}/share/man/man3/threads.3 \
                ${destroot}${prefix}/share/man/man3/threads-coin.3
            file rename ${destroot}${prefix}/share/man/man3/manips.3 \
                ${destroot}${prefix}/share/man/man3/manips-coin.3
        }
    }
}

subport Coin-framework {
    conflicts               Coin
    revision            6

    patchfiles-append       framework-prefix.patch
    configure.args-replace  --without-framework \
                            --with-framework-prefix=${frameworks_dir}
}

livecheck.type      regex
livecheck.url       https://bitbucket.org/Coin3D/coin/downloads/?tab=downloads
livecheck.regex     ${name}-(\[0-9.\]+)${extract.suffix}
