# $Id: Portfile 56602 2009-08-30 18:41:30Z jmr@macports.org $

PortSystem 1.0

name			synergy
set sf_proj		synergy2
version			1.3.1
categories		sysutils
platforms		darwin
maintainers		gmail.com:ascarter
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.
master_sites	sourceforge
master_sites.mirror_subdir	${sf_proj}

checksums		md5 a6e09d6b71cb217f23069980060abf27

configure.args	--sysconfdir=${prefix}/etc/${name}
patchfiles		patch-CArchFileUnix.cpp.diff patch-configure.diff

post-patch {
	reinplace "s|__SYSCONFDIR|${prefix}/etc/${name}|g" ${worksrcpath}/lib/arch/CArchFileUnix.cpp
}

variant server {
	startupitem.create	yes
	startupitem.name	Synergy
	startupitem.start	"${prefix}/bin/synergys --daemon &"
	startupitem.stop	"/usr/bin/killall synergys"
}

post-destroot {
	xinstall -m 755 -d ${destroot}${prefix}/etc/${name}
	xinstall -m 644 -c ${worksrcpath}/examples/synergy.conf \
		${destroot}${prefix}/etc/${name}/synergy.conf.sample
}

livecheck.name	${sf_proj}
livecheck.regex	<title>Sources (.*) released.*</title>

# Force 32-bit, all kinds of Carbon cruft in here. (#20908)
if {$build_arch == "x86_64"} {
    configure.build_arch i386
} elseif {$build_arch == "ppc64"} {
    configure.build_arch ppc
}
