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

name                gmtl
version             0.6.1
revision            1
checksums           rmd160  19ca8c25cf54b1650272f7a387f5f8b8c5c3140c \
                    sha256  f7d8e6958d96a326cb732a9d3692a3ff3fd7df240eb1d0921a7c5c77e37fc434 \
                    size    339777

categories          math
platforms           any
supported_archs     noarch
maintainers         {iastate.edu:mccdo @mccdo}
# LGPL-2.1+ modified by an addendum
license             Copyleft GPLConflict

description         a lightweight math library
long_description    The math library used by vrjuggler. It is \
                    implemented with c++ templates.
homepage            http://ggt.sourceforge.net/
master_sites        sourceforge:project/ggt/Generic%20Math%20Template%20Library/${version}

depends_build       port:scons

# gmtl-config uses python and flagpoll.
# Use same python version as flagpoll to limit number of pythons installed.
set python_version  2.7
depends_run-append  port:flagpoll \
                    port:python[string map [list . {}] ${python_version}]

patchfiles          gmtl.pc.patch \
                    gmtl-config.patch \
                    SConstruct-clang.patch \
                    SConstruct-no-archive.patch \
                    SConstruct-python.patch \
                    SConstruct-scons.patch

post-patch {
    reinplace "s|@PYTHON_BIN@|${prefix}/bin/python${python_version}|g" ${worksrcpath}/gmtl-config
}

use_configure       no

build.cmd           ${prefix}/bin/scons
build.target
build.args          prefix=${prefix} \
                    BoostPythonDir=/var/empty \
                    CppUnitDir=/var/empty

destroot.destdir    prefix=${destroot}${prefix}

post-destroot {
    reinplace -W ${destroot}${prefix} "s|${destroot}||g" \
        lib/pkgconfig/gmtl.pc \
        share/flagpoll/gmtl-${version}-noarch.fpc

    set docdir ${prefix}/share/doc/${subport}
    xinstall -d ${destroot}${docdir}
    xinstall -m 0644 -W ${worksrcpath} \
        AUTHORS \
        LICENSE \
        LICENSE.addendum \
        README \
        ${destroot}${docdir}
}
