# $Id$

PortSystem      1.0
PortGroup       cmake 1.0

name            orocos-kdl
version         1.0.2
revision        2
set branch      [join [lrange [split ${version} .] 0 1] .]
categories      devel
maintainers     nomaintainer
description     Orocos Kinematics and Dynamics
license         LGPL-2.1

long_description \
    The Kinematics and Dynamics Library (KDL) develops an application \
    independent framework for modelling and computation of kinematic chains, \
    such as robots, biomechanical human models, computer-animated figures, \
    machine tools, etc. It provides class libraries for geometrical objects \
    (point, frame, line, ...), kinematic chains of various families (serial, \
    humanoid, parallel, mobile, ...), and their motion specification and \
    interpolation.

homepage        http://www.orocos.org/kdl
platforms       darwin
master_sites    http://people.mech.kuleuven.be/~rsmits/kdl/
distname        ${name}-${version}-src
use_bzip2       yes

checksums       md5     4f786fcf415d2db64681ad487c25f419 \
                sha1    dd06fe5bff8dfa1940fc80cd2b2f84ce25bea4e7 \
                rmd160  c98d51f8f2039d54acd4ef5fd95981b6f228c95f

worksrcdir      kdl-${version}

post-patch {
    reinplace {s/SIP_VERSION GREATER/SIP_VERSION STRGREATER/} \
        ${worksrcpath}/config/FindSIPandPython.cmake
}

depends_build-append \
    port:pkgconfig
depends_lib \
    port:eigen

configure.args-append \
    -DCMAKE_CXX_FLAGS=-I${prefix}/include/eigen2 \
    -DCMAKE_INSTALL_NAME_DIR=${prefix}/lib \
    -DEIGEN2_INCLUDE_DIR=${prefix}/include/eigen2 \
    -DOROCOS_INSTALL=${prefix} \
    -DOROCOS_PLUGIN=0 \
    -DOROCOS_TARGET=macosx

variant plugin description "Enable Orocos RTT plugin" {
    depends_lib-append  port:orocos-rtt \
                        port:boost
    configure.args-delete   -DOROCOS_PLUGIN=0
    configure.args-append   -DOROCOS_PLUGIN=1
}

variant python26 description "Enable Python 2.6 bindings" {
    post-patch {
        reinplace {s:\*\.sip:PyKDL/&:} \
            ${worksrcpath}/src/bindings/python/CMakeLists.txt
        reinplace {/#set/s:.*:INSTALL(FILES \${SIP_FILES} DESTINATION share/sip/PyKDL):} \
            ${worksrcpath}/src/bindings/python/CMakeLists.txt
    }

    depends_lib-append \
        port:py26-sip \
        port:python26

    configure.args-append \
        -DPYTHON_BINDINGS=1
}

livecheck.type  regex
livecheck.url   ${master_sites}
livecheck.regex ${name}-(\\d+(?:\\.\\d+)*)