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

name                    ois
version                 1.3
revision                1
categories              devel
platforms               darwin
maintainers             nomaintainer
license                 zlib

description             An Object Oriented Input System (OIS)

long_description        Object Oriented Input System (OIS) is meant \
                        to be a cross platform, simple solution for \
                        using all kinds of Input Devices (Keyboards, \
                        Mice, Joysticks, etc) and feedback devices \
                        (e.g. force feedback). Written in C++ using \
                        Object Oriented Design pattern. \
                        NOTE: \
                        This version includes Cocoa 64-bit patches \
                        based on a submission by David Rogers \
                        (masterfalcon) to the OIS trac system. \
                        These patches are required to use OIS + Ogre \
                        in a 64-bit Mac OS environment.

homepage                http://sourceforge.net/projects/wgois/
master_sites            sourceforge:wgois/Source%20Release/${version}

# Accommodate the funny version convention ois underscore v number dash number
distname                ${name}_v[strsed ${version} {g/[.]/-/}]
# However the extracted directory is ois dash v number dash number
worksrcdir              ${name}-v[strsed ${version} {g/[.]/-/}]

checksums               md5     9697fead17eac6025151cd2e1fca1518 \
                        sha1    860f366f87e5103109e72724ce096ce8559c2d3d

patchfiles              patch-Mac_XCode-2_2_OIS_xcodeproj_project.pbxproj.diff \
                        patch-demos_OISConsole.cpp.diff \
                        patch-includes_mac_CocoaHelpers.h.diff \
                        patch-includes_mac_CocoaInputManager.h.diff \
                        patch-includes_mac_CocoaJoyStick.h.diff \
                        patch-includes_mac_CocoaKeyboard.h.diff \
                        patch-includes_mac_CocoaMouse.h.diff \
                        patch-includes_mac_MacHelpers.h.diff \
                        patch-src_OISInputManager.cpp.diff \
                        patch-src_mac_CocoaInputManager.mm.diff \
                        patch-src_mac_CocoaJoystick.mm.diff \
                        patch-src_mac_CocoaKeyboard.mm.diff \
                        patch-src_mac_CocoaMouse.mm.diff \
                        patch-src_mac_MacHIDManager.cpp.diff \
                        patch-src_mac_MacHelpers.cpp.diff \
                        patch-src_mac_MacInputManager.cpp.diff \
                        patch-src_mac_MacKeyboard.cpp.diff \
                        patch-src_mac_MacMouse.cpp.diff

xcode.project           Mac/XCode-2.2/OIS.xcodeproj

destroot {
    delete ${worksrcpath}/includes/Makefile.am
    set include_subdir OIS
    copy ${worksrcpath}/includes ${destroot}${prefix}/include/${include_subdir}
    xinstall -m 644 ${worksrcpath}/Mac/XCode-2.2/build/Release/libOIS.a \
        ${destroot}${prefix}/lib
    
    set pc ${destroot}${prefix}/lib/pkgconfig/OIS.pc
    xinstall -m 644 ${worksrcpath}/OIS.pc.in ${pc}
    reinplace "s|@prefix@|${prefix}|g" ${pc}
    reinplace "s|@exec_prefix@|\${prefix}|g" ${pc}
    reinplace "s|@libdir@|\${exec_prefix}/lib|g" ${pc}
    reinplace "s|@includedir@|\${prefix}/include|g" ${pc}
    reinplace "s|@VERSION@|${version}|g" ${pc}
    reinplace "s|@PACKAGE@|${include_subdir}|g" ${pc}
}
