# $Id: Portfile,v 1.2 2005/08/11 21:33:43 rshaw Exp $
PortSystem 1.0

name			tightvnc
version			1.2.9
categories		x11 vnc
maintainers		darwinports@opendarwin.org
description		Enhanced version of VNC
long_description	This is an enhanced version of VNC, called TightVNC, \
					which includes a lot of  new features, improvements, \
					optimizations and bugfixes over the original VNC \
					version.  Note that TightVNC is still free, \
					cross-platform and compatible with the standard VNC. \
					Many users agree that TightVNC is the most advanced \
					free remote desktop  package.
homepage		http://www.tightvnc.com/
master_sites	sourceforge:vnc-tight
distname		${name}-${version}_unixsrc
extract.suffix	.tar.bz2
use_bzip2		yes
checksums		md5 f804b26c098625e3a2675a0aa7709e31
platforms		darwin

depends_lib		lib:libX11.6:XFree86 \
				lib:libjpeg.62:jpeg \
				lib:libz.1:zlib
depends_run		bin:perl:perl5.8

worksrcdir		vnc_unixsrc

patchfiles		patch-Xvnc \
				patch-vncviewer \
				patch-vncserver
post-patch {
	cd ${worksrcpath}
	reinplace "s|@PREFIX@|${prefix}|g" \
		Xvnc/config/cf/vnclibs.def \
		vncserver \
		vncviewer/Imakefile
	if {[catch {set perl [binaryInPath "perl"]}] == 0} {
		reinplace "s|@PERL@|${perl}|g" vncserver
	}
}

variant no_server {
	depends_run-delete	bin:perl:perl5.8

	patchfiles-append	patch-no_server
}

use_xmkmf		yes

build.target	World

post-build {
	system "cd '${worksrcpath}/Xvnc' && ./configure"
	system "cd '${worksrcpath}/Xvnc' && make World"
}

destroot.cmd	./vncinstall
destroot.target	${destroot}${prefix}/bin ${destroot}${prefix}/share/man 
destroot.destdir
post-destroot {
	xinstall -d -m 0755 ${destroot}${prefix}/share/vnc/classes
	foreach f [glob ${worksrcpath}/classes/*] {
		xinstall -m 0644 $f ${destroot}${prefix}/share/vnc/classes
	}
}

