# $Id: Portfile 91515 2012-04-03 23:46:39Z ryandesign@macports.org $

PortSystem 1.0
PortGroup cmake 1.0

name            synergy
version         1.3.8
revision        1
categories      sysutils
license         GPL-2
platforms       darwin
maintainers     nomaintainer
description     A client/server for sharing a single mouse and keyboard
long_description \
    Synergy lets you easily share a single mouse and keyboard \
    between multiple computers with different operating systems \
    without special hardware. It is intended for users with \
    multiple computers on their desk since each system uses its \
    own display.
homepage        http://synergy-foss.org
master_sites    googlecode
distname        ${name}-${version}-Source

checksums       sha1    82e80b22c6746e573d047aa4a1ad7b71c28cf7d3 \
                rmd160  3b02faec3b5e5dbea1853e6decd92e4cf6eca419

# Force 32-bit, all kinds of Carbon cruft in here. (#20908)
supported_archs i386 ppc

patchfiles	patch-CArchFileUnix.cpp.diff

# See http://synergy-foss.org/pm/issues/57
patchfiles-append patch-bug57-keypress.diff \
                  patch-bug57-modifiers.diff

# See http://synergy-foss.org/tracker/issues/2962
patchfiles-append patch-bug2962-clipboard.diff

post-patch {
    # Set default config path
    reinplace "s|@@SYSCONFDIR@@|${prefix}/etc/${name}|g" ${worksrcpath}/src/lib/arch/CArchFileUnix.cpp

    # Fix build architectures
    reinplace "s:CMAKE_OSX_ARCHITECTURES \"ppc;i386\":CMAKE_OSX_ARCHITECTURES \"[join [get_canonical_archs] ;]\":" ${worksrcpath}/CMakeLists.txt
}

destroot {
        xinstall -d ${destroot}${prefix}/bin
        xinstall -m 755 ${worksrcpath}/bin/synergyc ${destroot}${prefix}/bin
        xinstall -m 755 ${worksrcpath}/bin/synergys ${destroot}${prefix}/bin
        xinstall -m 644 ${worksrcpath}/doc/synergyc.man ${destroot}${prefix}/share/man/man1/synergyc.1
        xinstall -m 644 ${worksrcpath}/doc/synergys.man ${destroot}${prefix}/share/man/man1/synergys.1
        xinstall -d ${destroot}${prefix}/etc/${name}
        xinstall -m 644 -W ${worksrcpath}/doc/ \
            synergy.conf.example \
            synergy.conf.example-advanced \
            synergy.conf.example-basic \
            ${destroot}${prefix}/etc/${name}
}

startupitem.create      yes
startupitem.executable  ${prefix}/bin/synergys --no-daemon
