# $Id: Portfile 98883 2012-10-19 19:53:45Z raimue@macports.org $

PortSystem 1.0
PortGroup cmake 1.0

name            synergy-devel
set realname    synergy
conflicts       synergy
version         1.4.10
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:${realname}
distname        ${realname}-${version}-Source

checksums       rmd160  829fb9c59312df9698b0e97b9a028396fe9078df \
                sha256  06d5a2ceb4cf8808cdab22441897c7b54ec8b4bc8351ac116f9accf54c720fbe

patchfiles	patch-CArchFileUnix.cpp.diff \
                patch-uSynergyUnix.diff

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

post-patch {
    # Set default config path
    reinplace "s|@@SYSCONFDIR@@|${prefix}/etc/${realname}|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/${realname}
        xinstall -m 644 -W ${worksrcpath}/doc/ \
            synergy.conf.example \
            synergy.conf.example-advanced \
            synergy.conf.example-basic \
            ${destroot}${prefix}/etc/${realname}
}

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