summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlastair Tse <liquidx@gentoo.org>2006-07-11 14:55:41 +0000
committerAlastair Tse <liquidx@gentoo.org>2006-07-11 14:55:41 +0000
commitc9c300e0bb550cfff4d28303b1b4b7c30d443c87 (patch)
treeb20246f69a02d6b8e652a0d30bd8725d92cabbdb
parentsyncing personal repository into overlay (diff)
downloadliquidx-c9c300e0bb550cfff4d28303b1b4b7c30d443c87.tar.gz
liquidx-c9c300e0bb550cfff4d28303b1b4b7c30d443c87.tar.bz2
liquidx-c9c300e0bb550cfff4d28303b1b4b7c30d443c87.zip
Adding experimental ebuild for vnc 4.1.1 since I know the realvnc people. server does not build yet and the source is mirrored from my devspace until we figure out how to fetch the source from their annoying PHP script.
svn path=/; revision=4
-rw-r--r--net-misc/vnc/files/vnc-4.1/vnc-64bit.patch39
-rw-r--r--net-misc/vnc/files/vnc-4.1/vnc-build.patch21
-rw-r--r--net-misc/vnc/files/vnc-4.1/vnc-cookie.patch27
-rw-r--r--net-misc/vnc/files/vnc-4.1/vnc-def.patch12
-rw-r--r--net-misc/vnc/files/vnc-4.1/vnc-fPIC.patch89
-rw-r--r--net-misc/vnc/files/vnc-4.1/vnc-fontpath.patch14
-rw-r--r--net-misc/vnc/files/vnc-4.1/vnc-gcc4.patch11
-rw-r--r--net-misc/vnc/files/vnc-4.1/vnc-idle.patch11
-rw-r--r--net-misc/vnc/files/vnc-4.1/vnc-modular-xorg.patch203
-rw-r--r--net-misc/vnc/files/vnc-4.1/vnc-nohttpd.patch55
-rw-r--r--net-misc/vnc/files/vnc-4.1/vnc-restart.patch21
-rw-r--r--net-misc/vnc/files/vnc-4.1/vnc-s390.patch151
-rw-r--r--net-misc/vnc/files/vnc-4.1/vnc-select.patch10
-rw-r--r--net-misc/vnc/files/vnc-4.1/vnc-use-fb.patch246
-rw-r--r--net-misc/vnc/files/vnc-4.1/vnc-via.patch186
-rw-r--r--net-misc/vnc/files/vnc-4.1/vnc-viewer-reparent.patch115
-rw-r--r--net-misc/vnc/files/vnc-4.1/vnc-vncpasswd.patch22
-rw-r--r--net-misc/vnc/files/vnc-4.1/vnc-xclients.patch13
-rw-r--r--net-misc/vnc/vnc-4.1.1.ebuild124
19 files changed, 1370 insertions, 0 deletions
diff --git a/net-misc/vnc/files/vnc-4.1/vnc-64bit.patch b/net-misc/vnc/files/vnc-4.1/vnc-64bit.patch
new file mode 100644
index 0000000..34b2d6d
--- /dev/null
+++ b/net-misc/vnc/files/vnc-4.1/vnc-64bit.patch
@@ -0,0 +1,39 @@
+--- vnc-4_1_1-unixsrc/unix/xc/programs/Xserver/vnc/XserverDesktop.h.64bit 2005-03-11 15:08:41.000000000 +0000
++++ vnc-4_1_1-unixsrc/unix/xc/programs/Xserver/vnc/XserverDesktop.h 2005-12-06 14:31:11.000000000 +0000
+@@ -29,6 +29,8 @@
+ #include <rfb/VNCServerST.h>
+ #include <rdr/SubstitutingInStream.h>
+
++#include "xorg-server.h"
++
+ extern "C" {
+ #define class c_class;
+ #include <scrnintstr.h>
+--- vnc-4_1_1-unixsrc/unix/xc/programs/Xserver/vnc/Xvnc/xvnc.cc.64bit 2005-12-06 14:31:24.000000000 +0000
++++ vnc-4_1_1-unixsrc/unix/xc/programs/Xserver/vnc/Xvnc/xvnc.cc 2005-12-06 14:31:30.000000000 +0000
+@@ -973,25 +973,6 @@
+
+ } /* end InitOutput */
+
+-#ifdef DPMSExtension
+-extern "C" {
+-#if NeedFunctionPrototypes
+- void DPMSSet(CARD16 level)
+-#else
+- void DPMSSet(level)
+- CARD16 level;
+-#endif
+- {
+- return;
+- }
+-
+- Bool DPMSSupported()
+- {
+- return FALSE;
+- }
+-}
+-#endif
+-
+ /* this is just to get the server to link on AIX */
+ #ifdef AIXV3
+ int SelectWaitTime = 10000; /* usec */
diff --git a/net-misc/vnc/files/vnc-4.1/vnc-build.patch b/net-misc/vnc/files/vnc-4.1/vnc-build.patch
new file mode 100644
index 0000000..0f8eb41
--- /dev/null
+++ b/net-misc/vnc/files/vnc-4.1/vnc-build.patch
@@ -0,0 +1,21 @@
+reverted:
+--- vnc-4_1_1-unixsrc/unix/xc/programs/Xserver/vnc/Xvnc/Imakefile 2005-03-10 14:51:39.000000000 +0000
++++ vnc-4_1-unixsrc/unix/xc/programs/Xserver/vnc/Xvnc/Imakefile 2004-12-01 17:27:58.000000000 +0000
+@@ -48,7 +48,7 @@
+ * Make sure XINPUT, XF86VidTune, etc arent defined for the miinitext.o
+ * used by Xvnc
+ */
++EXT_DEFINES = ExtensionDefines -UXINPUT -UXF86VIDMODE -UXFreeXDGA -UXF86MISC
+-EXT_DEFINES = ExtensionDefines -UXF86VIDMODE -UXFreeXDGA -UXF86MISC
+ #endif
+
+
+@@ -70,7 +70,7 @@
+ SpecialCplusplusObjectRule(xvnc,$(ICONFIGFILES) xvnc,$(EXT_DEFINES) $(NO_OPERATOR_NAMES))
+
+ LinkSourceFile(miinitext.c,$(SERVERSRC)/mi)
++SpecialCObjectRule(miinitext,$(ICONFIGFILES),$(EXT_DEFINES) $(PAN_DEFINES) -DNO_HW_ONLY_EXTS -DNO_MODULE_EXTS $(EXT_MODULE_DEFINES) -UXFree86LOADER)
+-SpecialCObjectRule(miinitext,$(ICONFIGFILES),$(EXT_DEFINES) $(PAN_DEFINES) -DNO_MODULE_EXTS $(EXT_MODULE_DEFINES) -UXFree86LOADER)
+
+ /* InstallManPage(Xvfb,$(MANDIR)) */
+ DependTarget()
diff --git a/net-misc/vnc/files/vnc-4.1/vnc-cookie.patch b/net-misc/vnc/files/vnc-4.1/vnc-cookie.patch
new file mode 100644
index 0000000..d653f3a
--- /dev/null
+++ b/net-misc/vnc/files/vnc-4.1/vnc-cookie.patch
@@ -0,0 +1,27 @@
+--- vnc-4_1-unixsrc/unix/vncserver.cookie 2005-02-23 12:28:18.000000000 +0000
++++ vnc-4_1-unixsrc/unix/vncserver 2005-03-03 22:04:28.000000000 +0000
+@@ -116,18 +116,12 @@
+ $desktopLog = "$vncUserDir/$host:$displayNumber.log";
+ unlink($desktopLog);
+
+-# Make an X server cookie - use as the seed the sum of the current time, our
+-# PID and part of the encrypted form of the password. Ideally we'd use
+-# /dev/urandom, but that's only available on Linux.
+-
+-srand(time+$$+unpack("L",`cat $vncUserDir/passwd`));
+-$cookie = "";
+-for (1..16) {
+- $cookie .= sprintf("%02x", int(rand(256)) % 256);
+-}
+-
+-system("xauth -f $xauthorityFile add $host:$displayNumber . $cookie");
+-system("xauth -f $xauthorityFile add $host/unix:$displayNumber . $cookie");
++# Make an X server cookie - use mcookie
++$cookie = `/usr/bin/mcookie`;
++open (XAUTH, "|xauth -f $xauthorityFile source -");
++print XAUTH "add $host:$displayNumber . $cookie\n";
++print XAUTH "add $host/unix:$displayNumber . $cookie\n";
++close XAUTH;
+
+ if ($opt{'-name'}) {
+ $desktopName = $opt{'-name'};
diff --git a/net-misc/vnc/files/vnc-4.1/vnc-def.patch b/net-misc/vnc/files/vnc-4.1/vnc-def.patch
new file mode 100644
index 0000000..5c1c002
--- /dev/null
+++ b/net-misc/vnc/files/vnc-4.1/vnc-def.patch
@@ -0,0 +1,12 @@
+--- vnc-4_1-unixsrc/unix/xc/config/cf/vnc.def.in.def 2003-07-07 10:51:22.000000000 +0100
++++ vnc-4_1-unixsrc/unix/xc/config/cf/vnc.def.in 2004-05-27 13:24:02.489007854 +0100
+@@ -6,7 +6,8 @@
+ #define BuildNls NO
+ #define BuildXIE NO
+ #define BuildGlxExt NO
+-#define XnestServer NO
++#define XnestServer YES
++#define XF86Server NO
+ #define XprtServer NO
+
+ #ifdef SunArchitecture
diff --git a/net-misc/vnc/files/vnc-4.1/vnc-fPIC.patch b/net-misc/vnc/files/vnc-4.1/vnc-fPIC.patch
new file mode 100644
index 0000000..3ffb77d
--- /dev/null
+++ b/net-misc/vnc/files/vnc-4.1/vnc-fPIC.patch
@@ -0,0 +1,89 @@
+--- vnc-4_1-unixsrc/unix/xc/programs/Xserver/vnc/module/Imakefile.fPIC 2005-03-04 14:33:47.000000000 +0000
++++ vnc-4_1-unixsrc/unix/xc/programs/Xserver/vnc/module/Imakefile 2005-03-04 14:34:16.000000000 +0000
+@@ -21,7 +21,8 @@
+ LinkSourceFile(xf86vncModule.cc,..)
+ LinkSourceFile(XserverDesktop.cc,..)
+
+-ModuleObjectRule()
++.CCsuf.Osuf:
++ NormalSharedLibObjCplusplusCompile($(_NOOP_))
+ /*
+ LibraryModuleTarget(vnc,$(OBJS) $(VNCLIBS))
+ InstallLibraryModule(vnc,$(MODULEDIR),extensions)
+--- vnc-4_1-unixsrc/unix/xc/programs/Xserver/vnc/Imakefile.fPIC 2005-03-04 14:34:24.000000000 +0000
++++ vnc-4_1-unixsrc/unix/xc/programs/Xserver/vnc/Imakefile 2005-03-04 14:34:52.000000000 +0000
+@@ -36,8 +36,8 @@
+ NormalLintTarget($(SRCS))
+
+ NormalLibraryObjectRule()
+-NormalCplusplusObjectRule()
+-
++.CCsuf.Osuf:
++ NormalSharedLibObjCplusplusCompile($(_NOOP_))
+
+ MakeSubdirs($(SUBDIRS))
+ DependSubdirs($(SUBDIRS))
+--- vnc-4_1-unixsrc/unix/boilerplate.mk.fPIC 2005-03-04 14:35:03.000000000 +0000
++++ vnc-4_1-unixsrc/unix/boilerplate.mk 2005-03-04 14:35:23.000000000 +0000
+@@ -15,7 +15,7 @@
+ CFLAGS = @CFLAGS@ $(DIR_CFLAGS)
+ CCLD = $(CC)
+ CXX = @CXX@
+-CXXFLAGS = @CXXFLAGS@
++CXXFLAGS = @CXXFLAGS@ $(DIR_CXXFLAGS)
+ CXXLD = $(CXX)
+ CPPFLAGS = @CPPFLAGS@
+ DEFS = @DEFS@
+--- vnc-4_1-unixsrc/common/Xregion/Makefile.in.fPIC 2005-03-04 14:32:24.000000000 +0000
++++ vnc-4_1-unixsrc/common/Xregion/Makefile.in 2005-03-04 14:32:36.000000000 +0000
+@@ -12,4 +12,5 @@
+ $(AR) $(library) $(OBJS)
+ $(RANLIB) $(library)
+
++DIR_CFLAGS = -DPIC -fPIC
+ # followed by boilerplate.mk
+--- vnc-4_1-unixsrc/common/network/Makefile.in.fPIC 2005-03-04 14:32:44.000000000 +0000
++++ vnc-4_1-unixsrc/common/network/Makefile.in 2005-03-04 14:32:58.000000000 +0000
+@@ -14,4 +14,5 @@
+ $(AR) $(library) $(OBJS)
+ $(RANLIB) $(library)
+
++DIR_CXXFLAGS = -DPIC -fPIC
+ # followed by boilerplate.mk
+--- vnc-4_1-unixsrc/common/rdr/Makefile.in.fPIC 2005-03-04 14:33:05.000000000 +0000
++++ vnc-4_1-unixsrc/common/rdr/Makefile.in 2005-03-04 14:33:16.000000000 +0000
+@@ -16,4 +16,5 @@
+ $(AR) $(library) $(OBJS)
+ $(RANLIB) $(library)
+
++DIR_CXXFLAGS = -DPIC -fPIC
+ # followed by boilerplate.mk
+--- vnc-4_1-unixsrc/common/rfb/Makefile.in.fPIC 2005-03-04 14:33:20.000000000 +0000
++++ vnc-4_1-unixsrc/common/rfb/Makefile.in 2005-03-04 14:33:33.000000000 +0000
+@@ -65,4 +65,6 @@
+ $(AR) $(library) $(OBJS)
+ $(RANLIB) $(library)
+
++DIR_CFLAGS = -DPIC -fPIC
++DIR_CXXFLAGS = -DPIC -fPIC
+ # followed by boilerplate.mk
+--- vnc-4_1-unixsrc/common/Makefile.in.fPIC 2005-03-04 15:08:57.000000000 +0000
++++ vnc-4_1-unixsrc/common/Makefile.in 2005-03-04 15:09:25.000000000 +0000
+@@ -1,4 +1,6 @@
+
+ SUBDIRS = @ZLIB_DIR@ rdr network Xregion rfb
+
++DIR_CFLAGS = -DPIC -fPIC
++DIR_CXXFLAGS = -DPIC -fPIC
+ # followed by boilerplate.mk
+--- vnc-4_1-unixsrc/common/boilerplate.mk.fPIC 2005-03-04 15:09:32.000000000 +0000
++++ vnc-4_1-unixsrc/common/boilerplate.mk 2005-03-04 15:09:49.000000000 +0000
+@@ -15,7 +15,7 @@
+ CFLAGS = @CFLAGS@ $(DIR_CFLAGS)
+ CCLD = $(CC)
+ CXX = @CXX@
+-CXXFLAGS = @CXXFLAGS@
++CXXFLAGS = @CXXFLAGS@ $(DIR_CXXFLAGS)
+ CXXLD = $(CXX)
+ CPPFLAGS = @CPPFLAGS@
+ DEFS = @DEFS@
diff --git a/net-misc/vnc/files/vnc-4.1/vnc-fontpath.patch b/net-misc/vnc/files/vnc-4.1/vnc-fontpath.patch
new file mode 100644
index 0000000..312c2fc
--- /dev/null
+++ b/net-misc/vnc/files/vnc-4.1/vnc-fontpath.patch
@@ -0,0 +1,14 @@
+--- vnc-4_1_1-unixsrc/unix/xorg-server-1.0.0/configure.ac.fontpath 2005-12-21 11:14:58.000000000 +0000
++++ vnc-4_1_1-unixsrc/unix/xorg-server-1.0.0/configure.ac 2005-12-21 11:16:56.000000000 +0000
+@@ -339,9 +339,9 @@
+ AC_ARG_WITH(mesa-source, AS_HELP_STRING([--with-mesa-source=MESA_SOURCE], [Path to Mesa source tree]),
+ [ MESA_SOURCE="$withval" ],
+ [ MESA_SOURCE="" ])
+-AC_ARG_WITH(fontdir, AS_HELP_STRING([--with-fontdir=FONTDIR], [Path to top level dir where fonts are installed (default: ${libdir}/X11/fonts)]),
++AC_ARG_WITH(fontdir, AS_HELP_STRING([--with-fontdir=FONTDIR], [Path to top level dir where fonts are installed (default: ${datadir}/X11/fonts)]),
+ [ FONTDIR="$withval" ],
+- [ FONTDIR="${libdir}/X11/fonts" ])
++ [ FONTDIR="${datadir}/X11/fonts" ])
+ DEFAULT_FONT_PATH="${FONTDIR}/misc/,${FONTDIR}/TTF/,${FONTDIR}/OTF,${FONTDIR}/Type1/,${FONTDIR}/CID/,${FONTDIR}/100dpi/,${FONTDIR}/75dpi/"
+ AC_ARG_WITH(default-font-path, AS_HELP_STRING([--with-default-font-path=PATH], [Comma separated list of font dirs]),
+ [ FONTPATH="$withval" ],
diff --git a/net-misc/vnc/files/vnc-4.1/vnc-gcc4.patch b/net-misc/vnc/files/vnc-4.1/vnc-gcc4.patch
new file mode 100644
index 0000000..5228b8c
--- /dev/null
+++ b/net-misc/vnc/files/vnc-4.1/vnc-gcc4.patch
@@ -0,0 +1,11 @@
+--- vnc-4_1-unixsrc/unix/xc/programs/Xserver/vnc/vncExtInit.cc.gcc4 2005-03-04 13:52:03.000000000 +0000
++++ vnc-4_1-unixsrc/unix/xc/programs/Xserver/vnc/vncExtInit.cc 2005-03-04 13:52:24.000000000 +0000
+@@ -751,7 +751,7 @@
+ rep.timeout = qcTimeout;
+ rep.addrLen = qcTimeout ? strlen(qcAddress) : 0;
+ rep.userLen = qcTimeout ? strlen(qcUsername) : 0;
+- rep.opaqueId = (CARD32)queryConnectId;
++ rep.opaqueId = (CARD32)(long)queryConnectId;
+ rep.length = (rep.userLen + rep.addrLen + 3) >> 2;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
diff --git a/net-misc/vnc/files/vnc-4.1/vnc-idle.patch b/net-misc/vnc/files/vnc-4.1/vnc-idle.patch
new file mode 100644
index 0000000..411672f
--- /dev/null
+++ b/net-misc/vnc/files/vnc-4.1/vnc-idle.patch
@@ -0,0 +1,11 @@
+--- vnc-4_1-unixsrc/common/rfb/ServerCore.cxx.idle 2005-03-03 15:42:21.000000000 +0000
++++ vnc-4_1-unixsrc/common/rfb/ServerCore.cxx 2005-03-03 23:11:14.000000000 +0000
+@@ -29,7 +29,7 @@
+ ("IdleTimeout",
+ "The number of seconds after which an idle VNC connection will be dropped "
+ "(zero means no timeout)",
+- 3600, 0);
++ 0, 0);
+ rfb::IntParameter rfb::Server::clientWaitTimeMillis
+ ("ClientWaitTimeMillis",
+ "The number of milliseconds to wait for a client which is no longer "
diff --git a/net-misc/vnc/files/vnc-4.1/vnc-modular-xorg.patch b/net-misc/vnc/files/vnc-4.1/vnc-modular-xorg.patch
new file mode 100644
index 0000000..78cb11a
--- /dev/null
+++ b/net-misc/vnc/files/vnc-4.1/vnc-modular-xorg.patch
@@ -0,0 +1,203 @@
+--- vnc-4_1_1-unixsrc/unix/xorg-server-1.0.0/hw/vnc/Makefile.am 2005-11-25 16:07:03.000000000 +0000
++++ vnc-4_1_1-unixsrc/unix/xorg-server-1.0.0/hw/vnc/Makefile.am 2005-11-30 19:48:03.000000000 +0000
+@@ -0,0 +1,85 @@
++noinst_LTLIBRARIES = libvnccommon.la
++libvnccommon_la_SOURCES = \
++ RegionHelper.h \
++ vncExtInit.cc \
++ vncExtInit.h \
++ vncHooks.cc \
++ vncHooks.h \
++ XserverDesktop.cc \
++ XserverDesktop.h
++
++libvnccommon_la_CXXFLAGS = \
++ -DVENDOR_RELEASE="$(VENDOR_RELEASE)" \
++ -DVENDOR_STRING="\"$(VENDOR_STRING)\"" \
++ -DGC_HAS_COMPOSITE_CLIP \
++ -DVNC_USE_FB \
++ -I/usr/include/X11 \
++ -I../../../../common \
++ -I../../../vncconfig
++
++bin_PROGRAMS = Xvnc
++
++Xvnc_SOURCES = \
++ xvnc.cc \
++ $(top_srcdir)/Xext/dpmsstubs.c \
++ $(top_srcdir)/Xi/stubs.c \
++ $(top_srcdir)/mi/miinitext.c \
++ $(top_srcdir)/fb/fbcmap.c
++
++Xvnc_LDADD = $(XORG_CORE_LIBS) \
++ $(XORG_LIBS) \
++ $(XSERVER_LIBS) \
++ ../../fb/libfb.la \
++ ../../mi/libminimi.la \
++ ../../render/librender.la \
++ ../../xkb/libxkbstubs.la \
++ ../../dbe/libdbe.la \
++ ../../Xext/libXext.la \
++ ../../XTrap/libxtrap.la \
++ ../../record/librecord.la \
++ ../xfree86/os-support/libxorgos.la \
++ ../../os/libos.la \
++ ../xfree86/common/libcommon.a \
++ -lX11 \
++ libvnccommon.la \
++ ../../../../common/rfb/librfb.a \
++ ../../../../common/rdr/librdr.a \
++ ../../../../common/network/libnetwork.a \
++ ../../../../common/Xregion/libXregion.a
++
++Xvnc_CFLAGS = -DHAVE_DIX_CONFIG_H \
++ -DNO_HW_ONLY_EXTS \
++ -DNO_MODULE_EXTS \
++ -DXFree86Server -DVNCEXT
++
++Xvnc_CXXFLAGS = $(Xvnc_CFLAGS) \
++ -DVENDOR_RELEASE="$(VENDOR_RELEASE)" \
++ -DVENDOR_STRING="\"$(VENDOR_STRING)\"" \
++ -DVNC_USE_FB \
++ -I../../../../common \
++ -I../../../vncconfig \
++ -I../../mi \
++ -I ../../render \
++ -I/usr/include/X11
++
++libvnc_la_LTLIBRARIES = libvnc.la
++libvnc_la_LDFLAGS = -module -avoid-version
++libvnc_ladir = $(moduledir)/extensions
++libvnc_la_SOURCES = xf86vncModule.cc
++libvnc_la_LIBADD = \
++ libvnccommon.la \
++ ../../../../common/rfb/librfb.a \
++ ../../../../common/rdr/librdr.a \
++ ../../../../common/network/libnetwork.a \
++ ../../../../common/Xregion/libXregion.a
++libvnc_la_CXXFLAGS = \
++ -I../../../../common \
++ -I$(top_srcdir)/hw/xfree86/common \
++ -I$(top_srcdir)/hw/xfree86/os-support \
++ -I$(top_srcdir)/hw/xfree86/os-support/bus \
++ -DXFree86Module -DXFree86LOADER -DIN_MODULE
++
++AM_CXXFLAGS = $(CFLAGS) \
++ -DVENDOR_RELEASE="$(VENDOR_RELEASE)" \
++ -DVENDOR_STRING="\"$(VENDOR_STRING)\""
++
++# Man page
++include $(top_srcdir)/cpprules.in
+--- vnc-4_1_1-unixsrc/unix/xorg-server-1.0.0/hw/Makefile.am.vnc 2005-11-25 16:01:56.000000000 +0000
++++ vnc-4_1_1-unixsrc/unix/xorg-server-1.0.0/hw/Makefile.am 2005-11-25 16:02:41.000000000 +0000
+@@ -18,6 +18,8 @@
+ XWIN_SUBDIRS = xwin
+ endif
+
++XVNC_SUBDIRS = vnc
++
+ # need to add darwin support here
+
+ SUBDIRS = \
+@@ -25,6 +27,7 @@
+ $(XWIN_SUBDIRS) \
+ $(XVFB_SUBDIRS) \
+ $(XNEST_SUBDIRS) \
++ $(XVNC_SUBDIRS) \
+ $(DMX_SUBDIRS)
+
+ DIST_SUBDIRS = dmx xfree86 vfb xnest xwin darwin
+--- vnc-4_1_1-unixsrc/unix/xorg-server-1.0.0/configure.ac.modular-xorg 2005-11-28 08:16:21.000000000 +0000
++++ vnc-4_1_1-unixsrc/unix/xorg-server-1.0.0/configure.ac 2005-11-28 08:16:38.000000000 +0000
+@@ -1347,6 +1347,7 @@
+ hw/xnest/Makefile
+ hw/xwin/Makefile
+ hw/darwin/Makefile
++hw/vnc/Makefile
+ Xprint/Makefile
+ Xprint/doc/Makefile
+ Xprint/pcl/Makefile
+--- vnc-4_1_1-unixsrc/unix/xc/programs/Xserver/vnc/Xvnc/xvnc.cc 2005-11-29 12:52:42.000000000 +0000
++++ vnc-4_1_1-unixsrc/unix/xc/programs/Xserver/vnc/Xvnc/xvnc.cc 2005-11-29 15:31:54.000000000 +0000
+@@ -36,8 +36,6 @@
+ extern "C" {
+ #define class c_class
+ #define public c_public
+-#define xor c_xor
+-#define and c_and
+ #ifdef WIN32
+ #include <X11/Xwinsock.h>
+ #endif
+@@ -72,11 +70,8 @@
+ #include "inputstr.h"
+ #include "keysym.h"
+ extern int defaultColorVisualClass;
+- extern char buildtime[];
+ #undef class
+ #undef public
+-#undef xor
+-#undef and
+ #ifndef VNC_USE_FB
+ extern Bool cfb16ScreenInit(ScreenPtr, pointer, int, int, int, int, int);
+ extern Bool cfb32ScreenInit(ScreenPtr, pointer, int, int, int, int, int);
+@@ -221,7 +216,7 @@
+
+ void ddxUseMsg()
+ {
+- ErrorF("\nXvnc %s - built %s\n%s", XVNCVERSION, buildtime, XVNCCOPYRIGHT);
++ ErrorF("\nXvnc %s\n%s", XVNCVERSION, XVNCCOPYRIGHT);
+ ErrorF("Underlying X server release %d, %s\n\n", VENDOR_RELEASE,
+ VENDOR_STRING);
+ ErrorF("-screen scrn WxHxD set screen's width, height, depth\n");
+@@ -927,7 +922,7 @@
+
+ void InitOutput(ScreenInfo *screenInfo, int argc, char **argv)
+ {
+- ErrorF("\nXvnc %s - built %s\n%s", XVNCVERSION, buildtime, XVNCCOPYRIGHT);
++ ErrorF("\nXvnc %s\n%s", XVNCVERSION, XVNCCOPYRIGHT);
+ ErrorF("Underlying X server release %d, %s\n\n", VENDOR_RELEASE,
+ VENDOR_STRING);
+ wellKnownSocketsCreated = true;
+--- vnc-4_1_1-unixsrc/unix/vncinstall.modular-xorg 2005-11-29 16:26:20.000000000 +0000
++++ vnc-4_1_1-unixsrc/unix/vncinstall 2005-11-29 16:27:46.000000000 +0000
+@@ -56,7 +56,7 @@
+ fi
+ fi
+
+-for f in xc/programs/Xserver/Xvnc vncviewer/vncviewer vncpasswd/vncpasswd \
++for f in xorg-server-*/hw/vnc/Xvnc vncviewer/vncviewer vncpasswd/vncpasswd \
+ vncconfig/vncconfig vncserver x0vncserver/x0vncserver; do
+ if [ ! -f $f ]; then
+ echo "Couldn't find $f"
+@@ -85,7 +85,7 @@
+
+ done
+
+-vncModule=xc/programs/Xserver/vnc/module/vnc.so
+-if [ -f "$vncModule" -a -d "$moduledst" ]; then
++vncModule=xorg-server-*/hw/vnc/.libs/libvnc.so
++if [ -f $vncModule -a -d "$moduledst" ]; then
+ if cmp -s $vncModule $moduledst/`basename $vncModule`; then
+ echo "`basename $vncModule` hasn't changed"
+--- vnc-4_1_1-unixsrc/unix/xorg-server-1.0.0/mi/miinitext.c.modular-xorg 2005-12-01 11:45:11.000000000 +0000
++++ vnc-4_1_1-unixsrc/unix/xorg-server-1.0.0/mi/miinitext.c 2005-12-01 11:47:17.000000000 +0000
+@@ -284,6 +284,9 @@
+ #ifdef MITMISC
+ extern void MITMiscExtensionInit(INITARGS);
+ #endif
++#ifdef VNCEXT
++extern void vncExtensionInit(INITARGS);
++#endif
+ #ifdef XIDLE
+ extern void XIdleExtensionInit(INITARGS);
+ #endif
+@@ -567,6 +570,9 @@
+ #ifdef MITMISC
+ if (!noMITMiscExtension) MITMiscExtensionInit();
+ #endif
++#ifdef VNCEXT
++ vncExtensionInit();
++#endif
+ #ifdef XIDLE
+ if (!noXIdleExtension) XIdleExtensionInit();
+ #endif
diff --git a/net-misc/vnc/files/vnc-4.1/vnc-nohttpd.patch b/net-misc/vnc/files/vnc-4.1/vnc-nohttpd.patch
new file mode 100644
index 0000000..3bf9632
--- /dev/null
+++ b/net-misc/vnc/files/vnc-4.1/vnc-nohttpd.patch
@@ -0,0 +1,55 @@
+--- vnc-4_1_1-unixsrc/unix/vncserver.nohttpd 2005-08-08 15:51:09.000000000 +0100
++++ vnc-4_1_1-unixsrc/unix/vncserver 2005-08-11 12:13:59.000000000 +0100
+@@ -58,6 +58,7 @@
+ # Check command line options
+
+ &ParseOptions("-geometry",1,"-depth",1,"-pixelformat",1,"-name",1,"-kill",1,
++ "-nohttpd",0,
+ "-help",0,"-h",0,"--help",0);
+
+ &Usage() if ($opt{'-help'} || $opt{'-h'} || $opt{'--help'});
+@@ -78,6 +79,12 @@
+ if ($opt{'-pixelformat'}) {
+ $pixelformat = $opt{'-pixelformat'};
+ }
++if ($opt{'-nohttpd'}) {
++ $nohttpd = 1;
++ }
++else {
++ $nohttpd = 0;
++}
+
+ &CheckGeometryAndDepth();
+
+@@ -137,7 +144,7 @@
+
+ $cmd = "Xvnc :$displayNumber";
+ $cmd .= " -desktop " . &quotedString($desktopName);
+-$cmd .= " -httpd $vncJavaFiles" if ($vncJavaFiles);
++$cmd .= " -httpd $vncJavaFiles" if ($vncJavaFiles && ! $nohttpd);
+ $cmd .= " -auth $xauthorityFile";
+ $cmd .= " -geometry $geometry" if ($geometry);
+ $cmd .= " -depth $depth" if ($depth);
+@@ -413,7 +420,7 @@
+
+ sub Usage
+ {
+- die("\nusage: $prog [:<number>] [-name <desktop-name>] [-depth <depth>]\n".
++ die("\nusage: $prog [:<number>] [-nohttpd] [-name <desktop-name>] [-depth <depth>]\n".
+ " [-geometry <width>x<height>]\n".
+ " [-pixelformat rgbNNN|bgrNNN]\n".
+ " <Xvnc-options>...\n\n".
+--- vnc-4_1_1-unixsrc/unix/vncserver.man.nohttpd 2005-08-11 12:17:46.000000000 +0100
++++ vnc-4_1_1-unixsrc/unix/vncserver.man 2005-08-11 12:19:35.000000000 +0100
+@@ -77,6 +77,11 @@
+ must be 8 bits deep.
+
+ .TP
++.B \-nohttpd
++Do not instruct Xvnc to run a mini-httpd if the VNC Java applet is
++found.
++
++.TP
+ .B \-kill :\fIdisplay#\fP
+ This kills a VNC desktop previously started with vncserver. It does this by
+ killing the Xvnc process, whose process ID is stored in the file
diff --git a/net-misc/vnc/files/vnc-4.1/vnc-restart.patch b/net-misc/vnc/files/vnc-4.1/vnc-restart.patch
new file mode 100644
index 0000000..976cc59
--- /dev/null
+++ b/net-misc/vnc/files/vnc-4.1/vnc-restart.patch
@@ -0,0 +1,21 @@
+--- vnc-4_1-unixsrc/common/network/TcpSocket.cxx.restart 2005-03-04 09:02:21.000000000 +0000
++++ vnc-4_1-unixsrc/common/network/TcpSocket.cxx 2005-03-04 09:03:05.000000000 +0000
+@@ -140,10 +140,14 @@
+ }
+
+ // Attempt to connect to the remote host
+- if (connect(sock, (struct sockaddr *)&addr, sizeof(addr)) != 0) {
+- int e = errorNumber;
+- closesocket(sock);
+- throw SocketException("unable to connect to host", e);
++ for (;;) {
++ if (connect(sock, (struct sockaddr *)&addr, sizeof(addr)) != 0) {
++ int e = errorNumber;
++ if (e == EINTR)
++ continue;
++ closesocket(sock);
++ throw SocketException("unable to connect to host", e);
++ } else break;
+ }
+
+ // Disable Nagle's algorithm, to reduce latency
diff --git a/net-misc/vnc/files/vnc-4.1/vnc-s390.patch b/net-misc/vnc/files/vnc-4.1/vnc-s390.patch
new file mode 100644
index 0000000..1ec6563
--- /dev/null
+++ b/net-misc/vnc/files/vnc-4.1/vnc-s390.patch
@@ -0,0 +1,151 @@
+--- vnc-4_1_1-unixsrc/unix/xorg-server-1.0.0/hw/xfree86/os-support/linux/lnx_video.c.s390 2005-09-19 19:38:26.000000000 +0100
++++ vnc-4_1_1-unixsrc/unix/xorg-server-1.0.0/hw/xfree86/os-support/linux/lnx_video.c 2005-12-21 12:29:17.000000000 +0000
+@@ -64,7 +64,9 @@
+ #elif !defined(__powerpc__) && \
+ !defined(__mc68000__) && \
+ !defined(__sparc__) && \
+- !defined(__mips__)
++ !defined(__mips__) && \
++ !defined(__s390__) && \
++ !defined(__s390x__)
+
+ /*
+ * Due to conflicts with "compiler.h", don't rely on <sys/io.h> to declare
+@@ -569,7 +571,7 @@
+ #endif
+ }
+ close(fd);
+-#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__hppa__)
++#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__hppa__) && !defined(__s390__) && !defined(__s390x__)
+ if (ioperm(0, 1024, 1) || iopl(3)) {
+ if (errno == ENODEV)
+ ErrorF("xf86EnableIOPorts: no I/O ports found\n");
+@@ -596,7 +598,7 @@
+ #if defined(__powerpc__)
+ munmap(ioBase, 0x20000);
+ ioBase = NULL;
+-#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__hppa__)
++#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__hppa__) && !defined(__s390__) && !defined(__s390x__)
+ iopl(0);
+ ioperm(0, 1024, 0);
+ #endif
+@@ -615,12 +617,12 @@
+ Bool
+ xf86DisableInterrupts()
+ {
+-#if !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__) && !defined(__mips__) && !defined(__ia64__) && !defined(__sh__) && !defined(__hppa__)
++#if !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__) && !defined(__mips__) && !defined(__ia64__) && !defined(__sh__) && !defined(__hppa__) && !defined(__s390__) && !defined(__s390x__)
+ if (!ExtendedEnabled)
+ if (iopl(3) || ioperm(0, 1024, 1))
+ return (FALSE);
+ #endif
+-#if defined(__alpha__) || defined(__mc68000__) || defined(__powerpc__) || defined(__sparc__) || defined(__mips__) || defined(__arm__) || defined(__sh__) || defined(__ia64__) || defined(__hppa__)
++#if defined(__alpha__) || defined(__mc68000__) || defined(__powerpc__) || defined(__sparc__) || defined(__mips__) || defined(__arm__) || defined(__sh__) || defined(__ia64__) || defined(__hppa__) || defined(__s390__) || defined(__s390x__)
+ #else
+ # ifdef __GNUC__
+ # if defined(__ia64__)
+@@ -634,7 +636,7 @@
+ asm("cli");
+ # endif
+ #endif
+-#if !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__ia64__) && !defined(__hppa__)
++#if !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__ia64__) && !defined(__hppa__) && !defined(__s390__) && !defined(__s390x__)
+ if (!ExtendedEnabled) {
+ iopl(0);
+ ioperm(0, 1024, 0);
+@@ -647,12 +649,12 @@
+ void
+ xf86EnableInterrupts()
+ {
+-#if !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__) && !defined(__mips__) && !defined(__ia64__) && !defined(__sh__) && !defined(__hppa__)
++#if !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__) && !defined(__mips__) && !defined(__ia64__) && !defined(__sh__) && !defined(__hppa__) && !defined(__s390__) && !defined(__s390x__)
+ if (!ExtendedEnabled)
+ if (iopl(3) || ioperm(0, 1024, 1))
+ return;
+ #endif
+-#if defined(__alpha__) || defined(__mc68000__) || defined(__powerpc__) || defined(__sparc__) || defined(__mips__) || defined(__arm__) || defined(__sh__) || defined(__ia64__) || defined(__hppa__)
++#if defined(__alpha__) || defined(__mc68000__) || defined(__powerpc__) || defined(__sparc__) || defined(__mips__) || defined(__arm__) || defined(__sh__) || defined(__ia64__) || defined(__hppa__) || defined(__s390__) || defined(__s390x__)
+ #else
+ # ifdef __GNUC__
+ # if defined(__ia64__)
+@@ -666,7 +668,7 @@
+ asm("sti");
+ # endif
+ #endif
+-#if !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__ia64__) && !defined(__hppa__)
++#if !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__ia64__) && !defined(__hppa__) && !defined(__s390__) && !defined(__s390x__)
+ if (!ExtendedEnabled) {
+ iopl(0);
+ ioperm(0, 1024, 0);
+--- vnc-4_1_1-unixsrc/unix/xorg-server-1.0.0/hw/xfree86/os-support/misc/SlowBcopy.c.s390 2005-07-03 08:01:34.000000000 +0100
++++ vnc-4_1_1-unixsrc/unix/xorg-server-1.0.0/hw/xfree86/os-support/misc/SlowBcopy.c 2005-12-21 12:29:17.000000000 +0000
+@@ -36,7 +36,9 @@
+ #if !defined(__sparc__) && \
+ !defined(__powerpc__) && \
+ !defined(__mips__) && \
+- !defined(__ia64__)
++ !defined(__ia64__) && \
++ !defined(__s390__) && \
++ !defined(__s390x__)
+ outb(0x80, 0x00);
+ #endif
+ }
+--- vnc-4_1_1-unixsrc/unix/xorg-server-1.0.0/hw/xfree86/int10/Makefile.am.s390 2005-12-02 06:02:41.000000000 +0000
++++ vnc-4_1_1-unixsrc/unix/xorg-server-1.0.0/hw/xfree86/int10/Makefile.am 2005-12-21 12:29:46.000000000 +0000
+@@ -27,7 +27,8 @@
+ endif
+
+ if INT10_STUB
+-AM_CFLAGS = -D_PC -D_VM86_LINUX $(XORG_CFLAGS) $(EXTRA_CFLAGS)
++AM_CFLAGS = -D_PC -D_VM86_LINUX $(XORG_CFLAGS) $(EXTRA_CFLAGS) \
++ -I../common -I../os-support -I../os-support/bus
+ libint10_la_SOURCES = stub.c xf86int10module.c
+ endif
+
+--- vnc-4_1_1-unixsrc/unix/xorg-server-1.0.0/hw/xfree86/common/xf86Bus.c.s390 2005-07-03 09:53:42.000000000 +0100
++++ vnc-4_1_1-unixsrc/unix/xorg-server-1.0.0/hw/xfree86/common/xf86Bus.c 2005-12-21 12:29:17.000000000 +0000
+@@ -3078,7 +3078,7 @@
+ CheckGenericGA()
+ {
+ /* This needs to be changed for multiple domains */
+-#if !defined(__sparc__) && !defined(__powerpc__) && !defined(__mips__) && !defined(__ia64__)
++#if !defined(__sparc__) && !defined(__powerpc__) && !defined(__mips__) && !defined(__ia64__) && !defined(__s390__) && !defined(__s390x)
+ IOADDRESS GenericIOBase = VGAHW_GET_IOBASE();
+ CARD8 CurrentValue, TestValue;
+
+--- vnc-4_1_1-unixsrc/unix/xorg-server-1.0.0/hw/xfree86/common/xf86Helper.c.s390 2005-07-03 09:53:42.000000000 +0100
++++ vnc-4_1_1-unixsrc/unix/xorg-server-1.0.0/hw/xfree86/common/xf86Helper.c 2005-12-21 12:29:17.000000000 +0000
+@@ -2069,6 +2069,7 @@
+ void (*BlankScreen)(ScrnInfoPtr, Bool), IOADDRESS vertsyncreg,
+ int maskval, int knownclkindex, int knownclkvalue)
+ {
++#if !defined(__s390__) && !defined(__s390x__)
+ register int status = vertsyncreg;
+ unsigned long i, cnt, rcnt, sync;
+
+@@ -2162,6 +2163,7 @@
+
+ /* Restore registers that were written on */
+ (*ClockFunc)(pScrn, CLK_REG_RESTORE);
++#endif /* !defined(__s390__) && !defined(__s390x__) */
+ }
+
+ void
+--- vnc-4_1_1-unixsrc/unix/xorg-server-1.0.0/hw/xfree86/common/compiler.h.s390 2005-11-08 06:33:28.000000000 +0000
++++ vnc-4_1_1-unixsrc/unix/xorg-server-1.0.0/hw/xfree86/common/compiler.h 2005-12-21 12:29:17.000000000 +0000
+@@ -1355,6 +1355,15 @@
+ : "0" (_beg), "r" (_end), "r" (_flg)); \
+ } while (0)
+
++# elif defined(__s390__) || defined(__s390x__)
++
++#define inb(x) (0)
++#define inw(x) (0)
++#define inl(x) (0)
++#define outb(x,y) (0)
++#define outw(x,y) (0)
++#define outl(x,y) (0)
++
+ # else /* ix86 */
+
+ # define ldq_u(p) (*((unsigned long *)(p)))
diff --git a/net-misc/vnc/files/vnc-4.1/vnc-select.patch b/net-misc/vnc/files/vnc-4.1/vnc-select.patch
new file mode 100644
index 0000000..b888071
--- /dev/null
+++ b/net-misc/vnc/files/vnc-4.1/vnc-select.patch
@@ -0,0 +1,10 @@
+--- vnc-4_1_1-unixsrc/unix/x0vncserver/x0vncserver.cxx.select 2005-12-05 10:02:30.000000000 +0000
++++ vnc-4_1_1-unixsrc/unix/x0vncserver/x0vncserver.cxx 2005-12-05 10:02:32.000000000 +0000
+@@ -302,6 +302,7 @@
+ fd_set rfds;
+ std::list<Socket*> sockets;
+ std::list<Socket*>::iterator i;
++ tv.tv_usec = tv.tv_sec = 0;
+
+ // Process any incoming X events
+ TXWindow::handleXEvents(dpy);
diff --git a/net-misc/vnc/files/vnc-4.1/vnc-use-fb.patch b/net-misc/vnc/files/vnc-4.1/vnc-use-fb.patch
new file mode 100644
index 0000000..0eaa71f
--- /dev/null
+++ b/net-misc/vnc/files/vnc-4.1/vnc-use-fb.patch
@@ -0,0 +1,246 @@
+--- vnc-4_1-unixsrc/unix/xc/config/cf/vnc.def.use-fb 2005-02-28 12:59:09.000000000 +0000
++++ vnc-4_1-unixsrc/unix/xc/config/cf/vnc.def 2005-03-04 16:13:19.000000000 +0000
+@@ -1,35 +0,0 @@
+-#define BuildServersOnly YES
+-#define BuildFonts NO
+-#define BuildClients NO
+-#define BuildDocs NO
+-#define BuildPexExt NO
+-#define BuildNls NO
+-#define BuildXIE NO
+-#define BuildGlxExt NO
+-#define XnestServer NO
+-#define XprtServer NO
+-
+-#ifdef SunArchitecture
+-#define ProjectRoot /usr/openwin
+-#define HasGcc2 YES
+-#define BuildXKB NO
+-#endif
+-
+-#define HasFreetype2 NO
+-#define BuildVNCExt YES
+-#define VNCExtDefines -DVNCEXT
+-#define SiteExtensionDefines VNCExtDefines
+-#define SiteExtensionDirs vnc
+-
+-#define VncUnixDir $(TOP)/..
+-#define VncCommonDir VncUnixDir/../common
+-#define VncExtLibs VncCommonDir/rfb/librfb.a \
+- VncCommonDir/Xregion/libXregion.a \
+- VncCommonDir/network/libnetwork.a \
+- VncCommonDir/rdr/librdr.a
+-
+-#define SiteExtensionLibs vnc/LibraryTargetName(vnc) VncExtLibs
+-
+-#define ServerTarget(server,subdirs,objects,libs,syslibs) @@\
+-CCLINK = $(CXXENVSETUP) $(CXX) @@\
+-ServerTargetWithFlags(server,subdirs,objects,libs,syslibs,$(_NOOP_))
+--- /dev/null 2005-02-24 13:02:34.848875488 +0000
++++ vnc-4_1-unixsrc/unix/xc/config/cf/vnc.def.in 2005-03-04 16:13:19.000000000 +0000
+@@ -0,0 +1,37 @@
++#define BuildServersOnly YES
++#define BuildFonts NO
++#define BuildClients NO
++#define BuildDocs NO
++#define BuildPexExt NO
++#define BuildNls NO
++#define BuildXIE NO
++#define BuildGlxExt NO
++#define XnestServer NO
++#define XprtServer NO
++
++#ifdef SunArchitecture
++#define ProjectRoot /usr/openwin
++#define HasGcc2 YES
++#define BuildXKB NO
++#endif
++
++#define HasFreetype2 NO
++#define BuildVNCExt YES
++#define VNCExtDefines -DVNCEXT
++#define SiteExtensionDefines VNCExtDefines
++#define SiteExtensionDirs vnc
++
++#define VncUseFb @USE_FB@
++
++#define VncUnixDir $(TOP)/..
++#define VncCommonDir VncUnixDir/../common
++#define VncExtLibs VncCommonDir/rfb/librfb.a \
++ VncCommonDir/Xregion/libXregion.a \
++ VncCommonDir/network/libnetwork.a \
++ VncCommonDir/rdr/librdr.a
++
++#define SiteExtensionLibs vnc/LibraryTargetName(vnc) VncExtLibs
++
++#define ServerTarget(server,subdirs,objects,libs,syslibs) @@\
++CCLINK = $(CXXENVSETUP) $(CXX) @@\
++ServerTargetWithFlags(server,subdirs,objects,libs,syslibs,$(_NOOP_))
+--- vnc-4_1-unixsrc/unix/xc/programs/Xserver/vnc/Xvnc/Imakefile.use-fb 2004-12-01 17:27:58.000000000 +0000
++++ vnc-4_1-unixsrc/unix/xc/programs/Xserver/vnc/Xvnc/Imakefile 2005-03-04 16:13:19.000000000 +0000
+@@ -31,12 +31,19 @@
+ OBJS1 = os2_stubs.o
+ #endif
+
++#ifdef VncUseFb
++FB_DEFINES = -DVNC_USE_FB
++ FBINCLUDE = -I../../fb
++#else
++ FBINCLUDE = -I../../cfb
++#endif
++
+ SRCSA = xvnc.cc stubs.c $(SRCS1) miinitext.c $(SRCS2)
+
+ OBJSA = xvnc.o stubs.o $(OBJS1) miinitext.o $(OBJS2)
+
+-INCLUDES = -I. -I.. -I$(XBUILDINCDIR) -I$(FONTINCSRC) \
+- -I../../cfb -I../../mfb -I../../mi -I../../include -I../../os \
++INCLUDES = -I. -I.. -I$(XBUILDINCDIR) -I$(FONTINCSRC) $(FB_DEFINES) \
++ $(FBINCLUDE) -I../../mfb -I../../mi -I../../include -I../../os \
+ -I$(EXTINCSRC) -I$(XINCLUDESRC) -I$(SERVERSRC)/render $(VNCINCLUDE)
+
+ DEFINES = $(OS_DEFINES) $(SHMDEF) $(MMAPDEF) \
+--- vnc-4_1-unixsrc/unix/xc/programs/Xserver/vnc/Xvnc/xvnc.cc.use-fb 2005-02-28 12:59:09.000000000 +0000
++++ vnc-4_1-unixsrc/unix/xc/programs/Xserver/vnc/Xvnc/xvnc.cc 2005-03-04 16:13:19.000000000 +0000
+@@ -48,8 +48,12 @@
+ #include "X11/Xos.h"
+ #include "scrnintstr.h"
+ #include "servermd.h"
++#ifdef VNC_USE_FB
++#include "fb.h"
++#else
+ #define PSZ 8
+ #include "cfb.h"
++#endif
+ #include "mi.h"
+ #include "mibstore.h"
+ #include "colormapst.h"
+@@ -73,6 +77,7 @@
+ #undef public
+ #undef xor
+ #undef and
++#ifndef VNC_USE_FB
+ extern Bool cfb16ScreenInit(ScreenPtr, pointer, int, int, int, int, int);
+ extern Bool cfb32ScreenInit(ScreenPtr, pointer, int, int, int, int, int);
+ extern Bool cfb16CreateGC(GCPtr);
+@@ -83,6 +88,7 @@
+ unsigned long, char*);
+ extern void cfb32GetImage(DrawablePtr, int, int, int, int, unsigned int,
+ unsigned long, char*);
++#endif
+ }
+
+ #define XVNCVERSION "Free Edition 4.1"
+@@ -482,7 +488,7 @@
+ }
+ #endif
+
+-
++#ifndef VNC_USE_FB
+ static Bool vfbMultiDepthCreateGC(GCPtr pGC)
+ {
+ switch (vfbBitsPerPixel(pGC->depth))
+@@ -541,6 +547,7 @@
+ break;
+ }
+ }
++#endif
+
+ static ColormapPtr InstalledMaps[MAXSCREENS];
+
+@@ -811,6 +818,11 @@
+ defaultColorVisualClass
+ = (pvfb->bitsPerPixel > 8) ? TrueColor : PseudoColor;
+
++#ifdef VNC_USE_FB
++ if (!fbScreenInit(pScreen, pbits, pvfb->width, pvfb->height,
++ dpi, dpi, pvfb->paddedWidth, pvfb->bitsPerPixel))
++ return FALSE;
++#else
+ switch (pvfb->bitsPerPixel)
+ {
+ case 1:
+@@ -838,6 +850,7 @@
+ pScreen->CreateGC = vfbMultiDepthCreateGC;
+ pScreen->GetImage = vfbMultiDepthGetImage;
+ pScreen->GetSpans = vfbMultiDepthGetSpans;
++#endif
+
+ pScreen->InstallColormap = vfbInstallColormap;
+ pScreen->UninstallColormap = vfbUninstallColormap;
+@@ -883,6 +896,9 @@
+ }
+ }
+
++#ifdef VNC_USE_FB
++ ret = fbCreateDefColormap(pScreen);
++#else
+ if (pvfb->bitsPerPixel == 1)
+ {
+ ret = mfbCreateDefColormap(pScreen);
+@@ -891,6 +907,7 @@
+ {
+ ret = cfbCreateDefColormap(pScreen);
+ }
++#endif
+
+ miSetZeroLineBias(pScreen, pvfb->lineBias);
+
+--- vnc-4_1-unixsrc/unix/configure.in.use-fb 2005-01-11 16:37:17.000000000 +0000
++++ vnc-4_1-unixsrc/unix/configure.in 2005-03-04 16:13:19.000000000 +0000
+@@ -65,6 +65,18 @@
+ AC_SUBST(ZLIB_INCLUDE)
+ AC_SUBST(ZLIB_LIB)
+
++AC_ARG_WITH(fb,
++[ --with-fb use the new 'fb' framebuffer implementation])
++if test "$with_installed_zlib" = yes; then
++ echo "using 'fb' framebuffer"
++ USE_FB=YES
++else
++ echo "using 'mfb' and 'cfb' framebuffer"
++ USE_FB=NO
++fi
++
++AC_SUBST(USE_FB)
++
+ BOILERPLATE=boilerplate.mk
+
+ if (sh -c "make --version" 2>/dev/null | grep GNU 2>&1 >/dev/null); then
+@@ -79,4 +91,5 @@
+ vncviewer/Makefile:common.mk:vncviewer/Makefile.in:$BOILERPLATE \
+ vncconfig/Makefile:common.mk:vncconfig/Makefile.in:$BOILERPLATE \
+ vncpasswd/Makefile:common.mk:vncpasswd/Makefile.in:$BOILERPLATE \
++ xc/config/cf/vnc.def \
+ )
+--- vnc-4_1-unixsrc/unix/xc.patch.use-fb 2004-12-01 11:33:15.000000000 +0000
++++ vnc-4_1-unixsrc/unix/xc.patch 2005-03-04 16:19:31.000000000 +0000
+@@ -2,7 +2,7 @@
+ --- xc/programs/Xserver/Imakefile Fri Jun 6 11:14:39 2003
+ ***************
+ *** 409,412 ****
+---- 409,429 ----
++--- 409,435 ----
+ #endif
+ #endif /* XsunServer */
+ + XCOMM
+@@ -13,12 +13,18 @@
+ + CFB16DIR = cfb16
+ + CFB24DIR = cfb24
+ + CFB32DIR = cfb32
+++ FBDIR = fb
+ + XVNCDDXDIR = vnc/Xvnc
+++ #if VncUseFb
+++ XVNCDIRS = $(STDDIRS) $(FBDIR) $(XVNCDDXDIR) $(DEPDIRS)
+++ XVNCLIBS = PreFbLibs vnc/Xvnc/LibraryTargetName(xvnc) FbPostFbLibs
+++ #else
+ + XVNCDIRS = $(STDDIRS) $(MFBDIR) \
+ + $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR) \
+ + $(XVNCDDXDIR) $(DEPDIRS)
+-+ XVNCOBJS = $(XVNCDDXDIR)/stubs.o $(XVNCDDXDIR)/miinitext.o
+ + XVNCLIBS = PreFbLibs vnc/Xvnc/LibraryTargetName(xvnc) CFBLibs PostFbLibs
+++ #endif
+++ XVNCOBJS = $(XVNCDDXDIR)/stubs.o $(XVNCDDXDIR)/miinitext.o
+ + XVNCSYSLIBS = $(FONTLIBS) $(SYSLIBS)
+ + ServerTarget(Xvnc,$(XVNCDIRS),$(XVNCOBJS), \
+ + $(LIBCWRAPPER) $(XVNCLIBS) $(LOADABLEEXTS),$(XVNCSYSLIBS))
diff --git a/net-misc/vnc/files/vnc-4.1/vnc-via.patch b/net-misc/vnc/files/vnc-4.1/vnc-via.patch
new file mode 100644
index 0000000..6554427
--- /dev/null
+++ b/net-misc/vnc/files/vnc-4.1/vnc-via.patch
@@ -0,0 +1,186 @@
+--- vnc-4_1-unixsrc/unix/vncviewer/vncviewer.cxx.via 2005-03-03 23:20:33.000000000 +0000
++++ vnc-4_1-unixsrc/unix/vncviewer/vncviewer.cxx 2005-03-03 23:23:33.000000000 +0000
+@@ -41,6 +41,7 @@
+
+ using namespace network;
+ using namespace rfb;
++using namespace std;
+
+ IntParameter pointerEventInterval("PointerEventInterval",
+ "Time in milliseconds to rate-limit"
+@@ -95,6 +96,9 @@
+ StringParameter geometry("geometry", "X geometry specification", "");
+ StringParameter displayname("display", "The X display", "");
+
++/* Support for tunnelling */
++StringParameter via("via", "Gateway to tunnel via", "");
++
+ char aboutText[256];
+ char* programName;
+ extern char buildtime[];
+@@ -157,6 +161,61 @@
+ exit(1);
+ }
+
++/* Tunnelling support. */
++static void
++interpretViaParam (char **gatewayHost, char **remoteHost,
++ int *remotePort, char **vncServerName,
++ int localPort)
++{
++ const int SERVER_PORT_OFFSET = 5900;
++ char *pos = strchr (*vncServerName, ':');
++ if (pos == NULL)
++ *remotePort = SERVER_PORT_OFFSET;
++ else {
++ int portOffset = SERVER_PORT_OFFSET;
++ size_t len;
++ *pos++ = '\0';
++ len = strlen (pos);
++ if (*pos == ':') {
++ /* Two colons is an absolute port number, not an offset. */
++ pos++;
++ len--;
++ portOffset = 0;
++ }
++ if (!len || strspn (pos, "-0123456789") != len )
++ usage ();
++ *remotePort = atoi (pos) + portOffset;
++ }
++
++ if (**vncServerName != '\0')
++ *remoteHost = *vncServerName;
++
++ *gatewayHost = strDup (via.getValueStr ());
++ *vncServerName = new char[50];
++ sprintf (*vncServerName, "localhost::%d", localPort);
++}
++
++static void
++createTunnel (const char *gatewayHost, const char *remoteHost,
++ int remotePort, int localPort)
++{
++ char *cmd = getenv ("VNC_VIA_CMD");
++ char *percent;
++ char lport[10], rport[10];
++ sprintf (lport, "%d", localPort);
++ sprintf (rport, "%d", remotePort);
++ setenv ("G", gatewayHost, 1);
++ setenv ("H", remoteHost, 1);
++ setenv ("R", rport, 1);
++ setenv ("L", lport, 1);
++ if (!cmd)
++ cmd = "/usr/bin/ssh -f -L \"$L\":\"$H\":\"$R\" \"$G\" sleep 20";
++ /* Compatibility with TightVNC's method. */
++ while ((percent = strchr (cmd, '%')) != NULL)
++ *percent = '$';
++ system (cmd);
++}
++
+ int main(int argc, char** argv)
+ {
+ sprintf(aboutText, "VNC Viewer Free Edition 4.1 for X - built %s\n"
+@@ -190,8 +249,6 @@
+ usage();
+ }
+
+- if (vncServerName)
+- usage();
+ vncServerName = argv[i];
+ }
+
+@@ -207,6 +264,19 @@
+ vlog.error("Could not create .vnc directory: environment variable $HOME not set.");
+
+ try {
++ /* Tunnelling support. */
++ if (strlen (via.getValueStr ()) > 0) {
++ char *gatewayHost = "";
++ char *remoteHost = "localhost";
++ int localPort = findFreeTcpPort ();
++ int remotePort;
++ if (!vncServerName)
++ usage();
++ interpretViaParam (&gatewayHost, &remoteHost, &remotePort,
++ &vncServerName, localPort);
++ createTunnel (gatewayHost, remoteHost, remotePort, localPort);
++ }
++
+ Socket* sock = 0;
+
+ if (listenMode) {
+--- vnc-4_1-unixsrc/unix/vncviewer/vncviewer.man.via 2005-03-03 23:23:41.000000000 +0000
++++ vnc-4_1-unixsrc/unix/vncviewer/vncviewer.man 2005-03-03 23:24:18.000000000 +0000
+@@ -174,6 +174,23 @@
+ specified as an X11 keysym name (these can be obtained by removing the XK_
+ prefix from the entries in "/usr/include/X11/keysymdef.h"). Default is F8.
+
++.TP
++\fB\-via\fR \fIgateway\fR
++Automatically create encrypted TCP tunnel to the \fIgateway\fR machine
++before connection, connect to the \fIhost\fR through that tunnel
++(TightVNC\-specific). By default, this option invokes SSH local port
++forwarding, assuming that SSH client binary can be accessed as
++/usr/bin/ssh. Note that when using the \fB\-via\fR option, the host
++machine name should be specified as known to the gateway machine, e.g.
++"localhost" denotes the \fIgateway\fR, not the machine where vncviewer
++was launched. The environment variable \fIVNC_VIA_CMD\fR can override
++the default tunnel command of
++\fB/usr/bin/ssh\ -f\ -L\ "$L":"$H":"$R"\ "$G"\ sleep\ 20\fR. The tunnel
++command is executed with the environment variables \fIL\fR, \fIH\fR,
++\fIR\fR, and \fIG\fR taken the values of the local port number, the remote
++host, the port number on the remote host, and the gateway machine
++respectively.
++
+ .SH SEE ALSO
+ .BR Xvnc (1),
+ .BR vncpasswd (1),
+--- vnc-4_1-unixsrc/common/network/TcpSocket.cxx.via 2005-03-03 23:17:55.000000000 +0000
++++ vnc-4_1-unixsrc/common/network/TcpSocket.cxx 2005-03-03 23:19:49.000000000 +0000
+@@ -54,6 +54,29 @@
+
+ static rfb::LogWriter vlog("TcpSocket");
+
++/* Tunnelling support. */
++int network::findFreeTcpPort (void)
++{
++ int sock, port;
++ struct sockaddr_in addr;
++ memset(&addr, 0, sizeof(addr));
++ addr.sin_family = AF_INET;
++ addr.sin_addr.s_addr = INADDR_ANY;
++
++ if ((sock = socket (AF_INET, SOCK_STREAM, 0)) < 0)
++ throw SocketException ("unable to create socket", errorNumber);
++
++ for (port = TUNNEL_PORT_OFFSET + 99; port > TUNNEL_PORT_OFFSET; port--) {
++ addr.sin_port = htons ((unsigned short) port);
++ if (bind (sock, (struct sockaddr *)&addr, sizeof (addr)) == 0) {
++ close (sock);
++ return port;
++ }
++ }
++ throw SocketException ("no free port in range", 0);
++ return 0;
++}
++
+
+ // -=- Socket initialisation
+ static bool socketsInitialised = false;
+--- vnc-4_1-unixsrc/common/network/TcpSocket.h.via 2005-03-03 23:19:58.000000000 +0000
++++ vnc-4_1-unixsrc/common/network/TcpSocket.h 2005-03-03 23:20:21.000000000 +0000
+@@ -32,8 +32,14 @@
+
+ #include <list>
+
++/* Tunnelling support. */
++#define TUNNEL_PORT_OFFSET 5500
++
+ namespace network {
+
++ /* Tunnelling support. */
++ int findFreeTcpPort (void);
++
+ class TcpSocket : public Socket {
+ public:
+ TcpSocket(int sock, bool close=true);
diff --git a/net-misc/vnc/files/vnc-4.1/vnc-viewer-reparent.patch b/net-misc/vnc/files/vnc-4.1/vnc-viewer-reparent.patch
new file mode 100644
index 0000000..5c5ff23
--- /dev/null
+++ b/net-misc/vnc/files/vnc-4.1/vnc-viewer-reparent.patch
@@ -0,0 +1,115 @@
+--- vnc-4_1_1-unixsrc/unix/tx/TXWindow.h.viewer-reparent 2005-03-11 15:08:41.000000000 +0000
++++ vnc-4_1_1-unixsrc/unix/tx/TXWindow.h 2005-12-01 17:55:38.000000000 +0000
+@@ -183,6 +183,9 @@
+
+ Display* const dpy;
+
++ TXEventHandler* eventHandler;
++ long eventMask;
++
+ int xPad, yPad, bevel;
+
+ private:
+@@ -195,9 +198,7 @@
+ TXWindow* parent;
+ Window win_;
+ int width_, height_;
+- TXEventHandler* eventHandler;
+ TXDeleteWindowCallback* dwc;
+- long eventMask;
+ XSizeHints sizeHints;
+ std::map<Atom,Time> selectionOwnTime;
+ std::map<Atom,bool> selectionOwner_;
+--- vnc-4_1_1-unixsrc/unix/tx/TXViewport.cxx.viewer-reparent 2005-03-11 15:08:41.000000000 +0000
++++ vnc-4_1_1-unixsrc/unix/tx/TXViewport.cxx 2005-12-01 17:55:38.000000000 +0000
+@@ -43,6 +43,21 @@
+ delete vScrollbar;
+ }
+
++void TXViewport::reparent(long embed_window)
++{
++ XReparentWindow(dpy, win(), (Window)embed_window, 0, 0);
++ XSelectInput(dpy, embed_window, child->eventMask);
++ if (!eventHandler)
++ this->setEventHandler(this);
++}
++
++void TXViewport::handleEvent(TXWindow* w, XEvent* ev)
++{
++ if (child && child->eventHandler)
++ ((TXEventHandler *)child->eventHandler)->handleEvent(child, ev);
++}
++
++
+ void TXViewport::setChild(TXWindow* child_)
+ {
+ child = child_;
+--- vnc-4_1_1-unixsrc/unix/tx/TXViewport.h.viewer-reparent 2005-03-11 15:08:41.000000000 +0000
++++ vnc-4_1_1-unixsrc/unix/tx/TXViewport.h 2005-12-01 17:55:38.000000000 +0000
+@@ -32,8 +32,8 @@
+ #include "TXWindow.h"
+ #include "TXScrollbar.h"
+
+-class TXViewport : public TXWindow, public TXScrollbarCallback,
+- public rfb::Timer::Callback {
++class TXViewport : public TXWindow, public TXScrollbarCallback,
++ public TXEventHandler, public rfb::Timer::Callback {
+ public:
+ TXViewport(Display* dpy_, int width, int height, TXWindow* parent_=0);
+ virtual ~TXViewport();
+@@ -59,6 +59,12 @@
+ // normally.
+ bool bumpScrollEvent(XMotionEvent* ev);
+
++ // reparent the viewport into a new window
++ void reparent(long embed_window);
++
++ // event handler
++ void handleEvent(TXWindow* w, XEvent* ev);
++
+ private:
+ virtual void resizeNotify();
+ virtual void scrollbarPos(int x, int y, TXScrollbar* sb);
+--- vnc-4_1_1-unixsrc/unix/vncviewer/parameters.h.viewer-reparent 2005-03-11 15:08:41.000000000 +0000
++++ vnc-4_1_1-unixsrc/unix/vncviewer/parameters.h 2005-12-01 17:55:38.000000000 +0000
+@@ -37,6 +37,7 @@
+ extern rfb::BoolParameter sendPrimary;
+ extern rfb::BoolParameter fullScreen;
+ extern rfb::StringParameter geometry;
++extern rfb::StringParameter embedParent;
+
+ extern char aboutText[];
+ extern char* programName;
+--- vnc-4_1_1-unixsrc/unix/vncviewer/CConn.cxx.viewer-reparent 2005-03-11 15:08:41.000000000 +0000
++++ vnc-4_1_1-unixsrc/unix/vncviewer/CConn.cxx 2005-12-01 17:55:38.000000000 +0000
+@@ -586,10 +586,18 @@
+
+ void CConn::reconfigureViewport()
+ {
++ const char * par = embedParent.getValueStr();
+ viewport->setMaxSize(cp.width, cp.height);
+ if (fullScreen) {
+ viewport->resize(DisplayWidth(dpy,DefaultScreen(dpy)),
+ DisplayHeight(dpy,DefaultScreen(dpy)));
++ } else if (strlen(par) != 0) {
++ XWindowAttributes win_attr;
++ Window w = strtol(par, (char **)NULL, 0);
++
++ XGetWindowAttributes(dpy, w, &win_attr);
++ viewport->reparent(w);
++ viewport->resize(win_attr.width, win_attr.height);
+ } else {
+ int w = cp.width;
+ int h = cp.height;
+--- vnc-4_1_1-unixsrc/unix/vncviewer/vncviewer.cxx.viewer-reparent 2005-12-01 17:54:46.000000000 +0000
++++ vnc-4_1_1-unixsrc/unix/vncviewer/vncviewer.cxx 2005-12-01 17:55:38.000000000 +0000
+@@ -99,6 +99,9 @@
+ /* Support for tunnelling */
+ StringParameter via("via", "Gateway to tunnel via", "");
+
++/* Support for reparenting */
++StringParameter embedParent("Parent", "X Window to use as a parent", "");
++
+ char aboutText[256];
+ char* programName;
+ extern char buildtime[];
diff --git a/net-misc/vnc/files/vnc-4.1/vnc-vncpasswd.patch b/net-misc/vnc/files/vnc-4.1/vnc-vncpasswd.patch
new file mode 100644
index 0000000..ca94d59
--- /dev/null
+++ b/net-misc/vnc/files/vnc-4.1/vnc-vncpasswd.patch
@@ -0,0 +1,22 @@
+--- vnc-4_1_1-unixsrc/common/rfb/Password.cxx.vncpasswd 2005-06-27 15:08:30.000000000 +0100
++++ vnc-4_1_1-unixsrc/common/rfb/Password.cxx 2005-06-27 15:18:28.000000000 +0100
+@@ -38,6 +38,9 @@
+ PlainPasswd::PlainPasswd(char* pwd) : CharArray(pwd) {
+ }
+
++PlainPasswd::PlainPasswd(int len) : CharArray(len) {
++}
++
+ PlainPasswd::PlainPasswd(const ObfuscatedPasswd& obfPwd) : CharArray(9) {
+ if (obfPwd.length < 8)
+ throw rdr::Exception("bad obfuscated password length");
+--- vnc-4_1_1-unixsrc/common/rfb/Password.h.vncpasswd 2005-06-27 15:18:46.000000000 +0100
++++ vnc-4_1_1-unixsrc/common/rfb/Password.h 2005-06-27 15:18:56.000000000 +0100
+@@ -28,6 +28,7 @@
+ public:
+ PlainPasswd();
+ PlainPasswd(char* pwd);
++ PlainPasswd(int l);
+ PlainPasswd(const ObfuscatedPasswd& obfPwd);
+ ~PlainPasswd();
+ void replaceBuf(char* b);
diff --git a/net-misc/vnc/files/vnc-4.1/vnc-xclients.patch b/net-misc/vnc/files/vnc-4.1/vnc-xclients.patch
new file mode 100644
index 0000000..eff6ca3
--- /dev/null
+++ b/net-misc/vnc/files/vnc-4.1/vnc-xclients.patch
@@ -0,0 +1,13 @@
+--- vnc-4_1-unixsrc/unix/vncserver.xclients 2005-03-03 23:01:16.000000000 +0000
++++ vnc-4_1-unixsrc/unix/vncserver 2005-03-03 23:02:26.000000000 +0000
+@@ -42,6 +42,10 @@
+
+ $defaultXStartup
+ = ("#!/bin/sh\n\n".
++ "# Uncomment the following two lines for normal desktop:\n".
++ "# unset SESSION_MANAGER\n".
++ "# exec /etc/X11/xinit/xinitrc\n\n".
++ "[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup\n".
+ "[ -r \$HOME/.Xresources ] && xrdb \$HOME/.Xresources\n".
+ "xsetroot -solid grey\n".
+ "vncconfig -iconic &\n".
diff --git a/net-misc/vnc/vnc-4.1.1.ebuild b/net-misc/vnc/vnc-4.1.1.ebuild
new file mode 100644
index 0000000..dbf853e
--- /dev/null
+++ b/net-misc/vnc/vnc-4.1.1.ebuild
@@ -0,0 +1,124 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/vnc/vnc-4.0-r1.ebuild,v 1.16 2005/11/18 10:00:05 hansmi Exp $
+
+inherit eutils toolchain-funcs multilib
+
+# NOTE: realvnc.com has a convuloted PHP script to download which the emerge
+# fetch system does not support. So we mirror the files ourselves.
+
+X_VERSION="X11R6.8.2"
+
+MY_P="${P//./_}-unixsrc"
+DESCRIPTION="Remote desktop viewer display system"
+HOMEPAGE="http://www.realvnc.com/"
+SRC_URI="http://dev.gentoo.org/~liquidx/files/${P}.tar.gz
+ server? (
+ http://xorg.freedesktop.org/${X_VERSION}/src-single/${X_VERSION}-src.tar.bz2
+ )"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 ia64 ppc ppc64 sparc x86"
+IUSE="server"
+
+DEPEND="sys-libs/zlib
+ media-libs/freetype
+ x11-base/xorg-x11
+ !net-misc/tightvnc"
+
+S="${WORKDIR}/${MY_P}"
+
+src_unpack() {
+ unpack ${P}.tar.gz
+ if use server; then
+ cd ${S}/unix
+ unpack ${X_VERSION}-src.tar.bz2
+
+ # patches from Redhat
+ for patch in cookie gcc4 use-fb xclients build def select; do
+ epatch ${FILESDIR}/vnc-4.1/vnc-${patch}.patch
+ done
+
+ cd ${S}/unix/xc
+ #epatch ${FILESDIR}/vnc-4.1/vnc-fontpath.patch
+
+ #cd ${S}
+ #epatch ${FILESDIR}/xc.patch-cfbglblt8.patch
+ ##epatch ${FILESDIR}/xc.patch-eieio.patch
+ #epatch xc.patch
+
+ cd ${S}
+ cp -a unix/xc/programs/Xserver/vnc/Xvnc/xvnc.cc \
+ unix/xc/programs/Xserver/Xvnc.man \
+ unix/xc/programs/Xserver/vnc/*.{h,cc} \
+ unix/xorg-server-*/hw/vnc/
+ cp -a unix/xorg-server-*/{cfb/cfb.h,hw/vnc}
+ cp -a unix/xorg-server-*/{fb/fb.h,hw/vnc}
+ cp -a unix/xorg-server-*/{fb/fbrop.h,hw/vnc}
+ sed -i -e 's,xor,c_xor,' -e 's,and,c_and,' \
+ unix/xorg-server-*/hw/vnc/{cfb,fb,fbrop}.h
+
+ #HOSTCONF="${S}/unix/xc/config/cf/vnc.def"
+ #echo "#define CcCmd $(tc-getCC)" >> ${HOSTCONF}
+ #echo "#define FontDir /usr/share/fonts" >> ${HOSTCONF}
+ #echo "#define LibDir /usr/$(get_libdir)/X11" >> ${HOSTCONF}
+ #echo "#define UsrLibDir /usr/$(get_libdir)" >> ${HOSTCONF}
+ fi
+}
+
+src_compile() {
+ cd ${S}/unix
+ autoconf
+ econf --with-installed-zlib --with-fb || die
+ emake || die
+
+ if use server; then
+ cd ${S}/unix/xc
+ aclocal --force
+ automake
+ autoconf
+ econf --enable-xorg \
+ --disable-dependency-tracking \
+ --disable-xprint \
+ --disable-static \
+ --enable-composite \
+ --with-os-name="Gentoo Linux" \
+ --with-os-vendor="Gentoo" \
+ --disable-xorgcfg \
+ --disable-dmx \
+ --disable-lbx \
+ --enable-xdmcp \
+ --disable-xevie \
+ --disable-dri \
+ --with-int10=stub
+
+ make CDEBUGFLAGS="${CFLAGS}" CXXDEBUGFLAGS="${CXXFLAGS}" World FAST=1 || die
+ fi
+}
+
+src_install() {
+ cd ${S}/unix
+
+ dodir /usr/bin /usr/share/man/man1
+ use server && dodir /usr/$(get_libdir)/modules/extensions
+
+ ./vncinstall ${D}/usr/bin ${D}/usr/share/man ${D}/usr/$(get_libdir)/modules/extensions || die
+ dodoc LICENCE.TXT README
+
+ use server || (
+ rm -f ${D}usr/bin/vncserver
+ rm -f ${D}usr/bin/x0vncserver
+ rm -f ${D}usr/share/man/man1/vncpasswd.1.gz
+ rm -f ${D}usr/bin/vncpasswd
+ rm -f ${D}usr/share/man/man1/vncconfig.1.gz
+ rm -f ${D}usr/bin/vncconfig
+ rm -f ${D}usr/share/man/man1/vncserver.1.gz
+ rm -f ${D}usr/share/man/man1/x0vncserver.1.gz
+ )
+
+}
+
+pkg_postinst() {
+ ewarn "Note that the free VNC release is not designed for use on untrusted networks"
+}