# -*- 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                libfreespace
version             0.4
set branch          [join [lrange [split [strsed ${version} {g/[^0-9.].*//}] .] 0 1] .]
categories          devel

description         library for developing applications using Hillcrest Labs Freespace Devices
long_description \
    The libfreespace library enables rapid development of applications for \
    Hillcrest Labs Freespace® devices. libfreespace provides access to extended \
    information beyond mouse, keyboard and consumer page functionality through \
    calibrated acceleration, rotational velocity measurements and \
    calibrated sensor orientation.

homepage            http://libfreespace.hillcrestlabs.com/

platforms           darwin
license             LGPL-2.1
maintainers         nomaintainer

master_sites        http://launchpad.net/libfreespace/${branch}/${version}/+download/
checksums           md5 96a081e3b7fe2337344b8adc61259eb4 \
                    sha1 5b5d676bf00c3a30eee927496d1d0de65ce6fa7a \
                    rmd160 9fdb099c66f814c3e7f4101f6b61d602cb0ad60d

depends_lib         path:lib/pkgconfig/libusb-1.0.pc:libusb

destroot.violate_mtree  yes

post-destroot {
    # Install Codeless .kext to prevent the OS X HID driver from trying to control the freespace interface
    xinstall -d ${destroot}/System/Library/Extensions
    file copy ${worksrcpath}/osx/FreespaceDeviceDriver.kext ${destroot}/System/Library/Extensions
    file attributes ${destroot}/System/Library/Extensions/FreespaceDeviceDriver.kext -owner root -group wheel -permissions rwxr-xr-x
}

post-activate {
    # Force the KEXT cache to rebuild.
    touch /System/Library/Extensions
}
