# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../tightvnc/tightvnc.conf
# Copyright (C) 2008 The OpenSDE Project
# Copyright (C) 2004 - 2006 The T2 SDE Project
#
# More information can be found in the files COPYING and README.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License. A copy of the
# GNU General Public License can be found in the file COPYING.
# --- SDE-COPYRIGHT-NOTE-END ---

if [ $prefix_auto = 1 ] ; then
	prefix="usr/X11"
	set_confopt
fi

# only build java if java is available
[ "$JAVA_HOME" ] || desc_SRC=

patch_vnc_server ()
{
	local x=${x//*_/}; x=${x//.tar.*/}
	var_append patchfiles ' ' "`ls $confdir/*.patch.$x 2>/dev/null`"
}
hook_add prepatch 3 "patch_vnc_server"

build_vnc_server ()
{
	if [ -d Xvnc ] ; then
		cd Xvnc
		./configure
		$MAKE
		cd ..
	fi
}
hook_add postmake 5 "build_vnc_server"

install_vnc_tight ()
{
	if [ -f vncserver ] ; then
		sed -e 's,/usr/local/vnc/classes,$root/$datadir/vnc/classes,' -i vncserver

		./vncinstall $root/$bindir $root/$mandir
		mkdir -p $root/$datadir/vnc/classes
		cp -av classes/* $root/$datadir/vnc/classes
	fi

	if [ -f index.vnc ] ; then
		cp -av *.class *.jar *.vnc $root/$datadir/vnc/classes
	fi
}
hook_add postmake 8 "install_vnc_tight"

makeinstopt=