From 150fefa6b1d6f4d6aa73258abe65af169fb7a5e5 Mon Sep 17 00:00:00 2001
From: Cecil Hugh Watson <knoppmyth@gmail.com>
Date: Sat, 4 Sep 2010 23:03:36 -0700
Subject: xorg-server:Bumped/Updated for LinHES 7.

---
 abs/core-testing/xorg-server/10-evdev.conf         |  39 +++
 abs/core-testing/xorg-server/10-quirks.conf        |  10 +
 abs/core-testing/xorg-server/PKGBUILD              | 133 +++++-----
 abs/core-testing/xorg-server/xorg-server.install   |  29 +--
 .../xorg-server/xserver-1.7.1-gamma-kdm-fix.patch  |  34 +++
 .../xorg-server/xserver-1.7.1-libcrypto.patch      |  32 +++
 abs/core-testing/xorg-server/xvfb-run              | 180 +++++++++++++
 abs/core-testing/xorg-server/xvfb-run.1            | 282 +++++++++++++++++++++
 8 files changed, 640 insertions(+), 99 deletions(-)
 create mode 100644 abs/core-testing/xorg-server/10-evdev.conf
 create mode 100644 abs/core-testing/xorg-server/10-quirks.conf
 create mode 100644 abs/core-testing/xorg-server/xserver-1.7.1-gamma-kdm-fix.patch
 create mode 100644 abs/core-testing/xorg-server/xserver-1.7.1-libcrypto.patch
 create mode 100644 abs/core-testing/xorg-server/xvfb-run
 create mode 100644 abs/core-testing/xorg-server/xvfb-run.1

diff --git a/abs/core-testing/xorg-server/10-evdev.conf b/abs/core-testing/xorg-server/10-evdev.conf
new file mode 100644
index 0000000..877aa4a
--- /dev/null
+++ b/abs/core-testing/xorg-server/10-evdev.conf
@@ -0,0 +1,39 @@
+# Catchall classes for input devices
+# We don't simply match on any device since that also adds accelerometers
+# and other devices that we don't really want to use. The list below
+# matches everything but joysticks.
+
+Section "InputClass"
+        Identifier "evdev pointer catchall"
+        MatchIsPointer "on"
+        MatchDevicePath "/dev/input/event*"
+        Driver "evdev"
+EndSection
+
+Section "InputClass"
+        Identifier "evdev keyboard catchall"
+        MatchIsKeyboard "on"
+        MatchDevicePath "/dev/input/event*"
+        Driver "evdev"
+EndSection
+
+Section "InputClass"
+        Identifier "evdev touchpad catchall"
+        MatchIsTouchpad "on"
+        MatchDevicePath "/dev/input/event*"
+        Driver "evdev"
+EndSection
+
+Section "InputClass"
+        Identifier "evdev tablet catchall"
+        MatchIsTablet "on"
+        MatchDevicePath "/dev/input/event*"
+        Driver "evdev"
+EndSection
+
+Section "InputClass"
+        Identifier "evdev touchscreen catchall"
+        MatchIsTouchscreen "on"
+        MatchDevicePath "/dev/input/event*"
+        Driver "evdev"
+EndSection
diff --git a/abs/core-testing/xorg-server/10-quirks.conf b/abs/core-testing/xorg-server/10-quirks.conf
new file mode 100644
index 0000000..7afad22
--- /dev/null
+++ b/abs/core-testing/xorg-server/10-quirks.conf
@@ -0,0 +1,10 @@
+# Collection of quirks and blacklist/whitelists for specific devices.
+
+
+# Accelerometer device, posts data through ABS_X/ABS_Y, making X unusable
+# http://bugs.freedesktop.org/show_bug.cgi?id=22442 
+Section "InputClass"
+        Identifier "ThinkPad HDAPS accelerometer blacklist"
+        MatchProduct "ThinkPad HDAPS accelerometer data"
+        Option "Ignore" "on"
+EndSection
diff --git a/abs/core-testing/xorg-server/PKGBUILD b/abs/core-testing/xorg-server/PKGBUILD
index 51f75f8..ae28da3 100644
--- a/abs/core-testing/xorg-server/PKGBUILD
+++ b/abs/core-testing/xorg-server/PKGBUILD
@@ -1,105 +1,88 @@
-# $Id: PKGBUILD 21903 2008-12-17 20:32:54Z jgc $
-# Maintainer: Alexander Baldeck <kth5@archlinux.org>
-# Contributor: Jan de Groot <jgc@archlinux.org>
+# $Id: PKGBUILD 83339 2010-06-21 12:03:15Z jgc $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
 
 pkgname=xorg-server
-pkgver=1.5.3
-pkgrel=5
+pkgver=1.8.1.902
+pkgrel=1
 pkgdesc="X.Org X servers"
 arch=('i686' 'x86_64')
 license=('custom')
 url="http://xorg.freedesktop.org"
-depends=('libx11>=1.1.5' 'libxkbui>=1.0.2' 'libgl' 'libxfont>=1.3.3' 'openssl>=0.9.8h' 'libxxf86misc>=1.0.1' 'libpciaccess>=0.10.5' 'libxv>=1.0.4' 'libxaw>=1.0.4' 'pixman>=0.11.10' 'hal>=0.5.11' 'xcursor-themes' 'xkeyboard-config>=1.3' 'xorg-server-utils' 'xorg-utils' 'xorg-fonts-misc' 'xbitmaps' 'libdrm>=2.3.1' 'diffutils' 'xf86-input-evdev')
-makedepends=('glproto>=1.4.9' 'xf86driproto>=2.0.4' 'mesa>=7.2' 'randrproto>=1.2.2' 'renderproto>=0.9.3' 'scrnsaverproto>=1.1.0' 'fontsproto>=2.0.2' 'videoproto>=2.2.2' 'compositeproto>=0.4' 'trapproto>=3.4.3' 'resourceproto>=1.0.2' 'xineramaproto>=1.1.2' 'evieext>=1.0.2' 'libxkbfile>=1.0.5' 'libxmu>=1.0.4' 'libxpm>=3.5.7' 'libxxf86dga>=1.0.2' 'inputproto>=1.4.4' 'xcmiscproto>=1.1.2' 'bigreqsproto' 'libdrm=2.3.1' 'xtrans')
+depends=('libgl' 'libxfont>=1.4.1' 'libgcrypt>=1.4.5' 'udev>=151' 'libpciaccess>=0.10.9' 'libxv>=1.0.5' 'pixman>=0.18.0' 'xcursor-themes>=1.0.2' 'xkeyboard-config>=1.8' 'xorg-server-utils' 'xorg-fonts-misc' 'xbitmaps' 'diffutils' 'xf86-input-evdev>=2.3.2-2' 'inputproto>=2.0')
+makedepends=('libx11>=1.3.3' 'mesa>=7.8.2' 'xf86driproto>=2.1.0' 'xtrans>=1.2.5' 'libxkbfile>=1.0.6' 'randrproto>=1.3.1' 'renderproto>=0.11' 'xcmiscproto>=1.2.0' 'bigreqsproto>=1.1.0' 'resourceproto>=1.1.0' 'videoproto>=2.3.0' 'compositeproto>=0.4.1' 'scrnsaverproto>=1.2.0' 'xf86dgaproto>=2.1' 'libgl>=7.8.2' 'glproto>=1.4.11' 'xorg-util-macros>=1.6.1' 'xineramaproto>=1.2' 'recordproto')
+conflicts=('catalyst-utils<=9.2' 'xf86-input-calcomp' 'xf86-input-citron' 'xf86-input-digitaledge' 'xf86-input-dmc' 'xf86-input-dynapro' 'xf86-input-elo2300'
+	'xf86-input-jamstudio' 'xf86-input-magellan' 'xf86-input-magictouch' 'xf86-input-microtouch' 'xf86-input-palmax' 'xf86-input-spaceorb' 'xf86-input-summa' 'xf86-input-tek4957' 'xf86-input-ur98' 'xf86-video-vga' 'xf86-video-intel-legacy' 'nvidia-96xx-utils<96.43.14' 'nvidia-173xx-utils<173.14.21')
 options=('!libtool')
 provides=('x-server')
 groups=('xorg')
 install=xorg-server.install
+backup=('etc/X11/xorg.conf.d/10-evdev.conf' 'etc/X11/xorg.conf.d/10-quirks.conf')
 source=(${url}/releases/individual/xserver/${pkgname}-${pkgver}.tar.bz2
-	xserver-1.5-branch-4970d.patch
-	001_fedora_extramodes.patch
-	xorg-redhat-die-ugly-pattern-die-die-die.patch
-	xserver-1.5.0-force-SwitchCoreKeyboard-for-evdev.patch
-	xserver-1.5.3-AEI-on-by-default.patch)
-md5sums=('308971036e25250e7fe3cccfd5a120f8'
-         '61f9bb524501247dce647b218ad14347'
-         '033427f2b406cba8dd6103ff374e7156'
+        xorg-redhat-die-ugly-pattern-die-die-die.patch
+        xvfb-run
+        xvfb-run.1
+        10-evdev.conf
+        10-quirks.conf)
+md5sums=('8a851466d13e4ee527cc782308532119'
          '1a336eb22e27cbf443ec5a2ecddfa93c'
-         '7b03ba9b75d795e4f7fdfaa550d97159'
-         '63d1d61d217005db7c23c4a98fc3e7eb')
+         '52fd3effd80d7bc6c1660d4ecf23d31c'
+         '376c70308715cd2643f7bff936d9934b'
+         'e930e153d69968a795fe4e2ef5d9a5dc'
+         'd4f7dfc6be4ef4e2c6dd7632a9d88abe')
 
 build() {
   cd "${srcdir}/${pkgname}-${pkgver}"
-  # Upstream commits from server-1.5 branch
-  patch -Np1 -i "${srcdir}/xserver-1.5-branch-4970d.patch" || return 1
-
-  # extramodes
-  patch -Np1 -i "${srcdir}/001_fedora_extramodes.patch" || return 1
 
   # Get rid of the ugly pattern
-  patch -Np3 -i "${srcdir}/xorg-redhat-die-ugly-pattern-die-die-die.patch" || return 1
-
-  # Patch from Fedora to fix FS#12248
-  patch -Np1 -i "${srcdir}/xserver-1.5.0-force-SwitchCoreKeyboard-for-evdev.patch" || return 1
-
-  # Upstream patch to fix evdev issues with >=2.1.0
-  patch -Np1 -i "${srcdir}/xserver-1.5.3-AEI-on-by-default.patch" || return 1
+  patch -Np3 -i "${srcdir}/xorg-redhat-die-ugly-pattern-die-die-die.patch"
 
-  # Fix dbus config path
-  sed -i -e 's/\$(sysconfdir)/\/etc/' config/Makefile.*  || return 1
+  sed -i -e 's/\$(prefix)\/etc/\/etc/g' config/Makefile.*
 
+  autoreconf
   ./configure --prefix=/usr \
-              --enable-ipv6 \
-              --enable-dri \
-              --disable-dmx \
-              --enable-xvfb \
-              --enable-xnest \
-              --enable-composite \
-              --enable-xcsecurity \
-              --enable-xorg \
-              --enable-xtrap \
-              --enable-xevie \
-	      --enable-xephyr \
-              --enable-glx-tls \
-              --enable-xorgcfg \
-	      --enable-kdrive \
-              --enable-install-setuid \
-              --enable-config-hal \
-	      --enable-config-dbus \
-	      --disable-xfbdev \
-	      --disable-xfake \
-	      --disable-xsdl \
-	      --disable-kdrive-vesa \
-	      --disable-dri2 \
-              --disable-xprint \
-              --disable-static \
-              --sysconfdir=/etc/X11 \
-              --localstatedir=/var \
-              --with-default-font-path=/usr/share/fonts/misc,/usr/share/fonts/100dpi:unscaled,/usr/share/fonts/75dpi:unscaled,/usr/share/fonts/TTF,/usr/share/fonts/Type1 \
-              --with-xkb-path=/usr/share/X11/xkb \
-              --with-xkb-output=/var/lib/xkb \
-              --with-dri-driver-path=/usr/lib/xorg/modules/dri --enable-null-root-cursor  || return 1
+      --enable-ipv6 \
+      --enable-dri \
+      --disable-dmx \
+      --enable-xvfb \
+      --enable-xnest \
+      --enable-composite \
+      --enable-xcsecurity \
+      --enable-xorg \
+      --enable-xephyr \
+      --enable-glx-tls \
+      --enable-kdrive \
+      --enable-install-setuid \
+      --enable-config-udev \
+      --disable-config-dbus \
+      --enable-record \
+      --disable-xfbdev \
+      --disable-xfake \
+      --disable-static \
+      --sysconfdir=/etc/X11 \
+      --localstatedir=/var \
+      --with-xkb-path=/usr/share/X11/xkb \
+      --with-xkb-output=/var/lib/xkb \
+      --with-dri-driver-path=/usr/lib/xorg/modules/dri
 
-  make || return 1
-  make DESTDIR="${pkgdir}" install || return 1
+  make
+  make DESTDIR="${pkgdir}" install
 
-  rm -rf "${pkgdir}/var/log" || return 1
+  install -m755 "${srcdir}/xvfb-run" "${pkgdir}/usr/bin/"
+  install -m644 "${srcdir}/xvfb-run.1" "${pkgdir}/usr/share/man/man1/"
 
-  install -m755 -d "${pkgdir}/etc/X11" || return 1
-  install -m755 -d "${pkgdir}/var/lib/xkb" || return 1
+  rm -rf "${pkgdir}/var/log"
 
-  # No longer needed, but as nvidia-utils mangles these files,
-  # keep them like this so they can be restored
-  mv "${pkgdir}/usr/lib/xorg/modules/libwfb.so" \
-     "${pkgdir}/usr/lib/xorg/modules/libwfb.so.1.4" || return 1
+  install -m755 -d "${pkgdir}/var/lib/xkb"
+
+  # Install sane config files in /etc. I don't see the need for config files in /usr/share here, users will edit them anyways.
+  install -m755 -d "${pkgdir}/etc/X11/xorg.conf.d"
+  install -m644 "${srcdir}/10-evdev.conf" "${srcdir}/10-quirks.conf" "${pkgdir}/etc/X11/xorg.conf.d/"
+  rm -rf "${pkgdir}/usr/share/X11"
 
   # Needed for non-mesa drivers, libgl will restore it
   mv "${pkgdir}/usr/lib/xorg/modules/extensions/libglx.so" \
-     "${pkgdir}/usr/lib/xorg/modules/extensions/libglx.xorg" || return 1
-
-  mv "${pkgdir}/usr/lib/xorg/modules/extensions/libdri.so" \
-     "${pkgdir}/usr/lib/xorg/modules/extensions/libdri.xorg" || return 1
+     "${pkgdir}/usr/lib/xorg/modules/extensions/libglx.xorg"
 
   install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
-  install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/" || return 1
+  install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
 }
diff --git a/abs/core-testing/xorg-server/xorg-server.install b/abs/core-testing/xorg-server/xorg-server.install
index c67438d..89cfec0 100644
--- a/abs/core-testing/xorg-server/xorg-server.install
+++ b/abs/core-testing/xorg-server/xorg-server.install
@@ -1,33 +1,14 @@
 post_install() {
-  rm -f usr/lib/xorg/modules/libwfb.so
-  ln -sf libwfb.so.1.4 usr/lib/xorg/modules/libwfb.so
+cat << _EOF
 
-  cmp usr/lib/xorg/modules/extensions/libdri.so usr/lib/xorg/modules/extensions/libglx.xorg >/dev/null 2>&1 && rm -f usr/lib/xorg/modules/extensions/libdri.so
-
-  # If the symlink is dead or non-existent, remove it and make a new one
-  if [ ! -e usr/lib/xorg/modules/extensions/libdri.so ]; then
-    rm -f usr/lib/xorg/modules/extensions/libdri.so
-    ln -sf libdri.xorg usr/lib/xorg/modules/extensions/libdri.so
-  fi
-}
-
-post_upgrade() {
-  if [ "`vercmp $2 1.4.99.906`" -lt 0 ]; then
-    cat << _EOF
-
-  Input device handling has changed in xorg-server 1.5.
+  Input device handling has changed since xorg-server 1.5.
   Please read http://wiki.archlinux.org/index.php/Xorg_input_hotplugging.
 
 _EOF
-  fi
-  post_install
 }
 
-post_remove() {
-  rm -f /usr/lib/xorg/modules/libwfb.so
-
-  # If the symlink is dead, remove it
-  if [ ! -e usr/lib/xorg/modules/extensions/libdri.so ]; then
-    rm -f usr/lib/xorg/modules/extensions/libdri.so
+post_upgrade() {
+  if [ "`vercmp $2 1.4.99.906`" -lt 0 ]; then
+    post_install
   fi
 }
diff --git a/abs/core-testing/xorg-server/xserver-1.7.1-gamma-kdm-fix.patch b/abs/core-testing/xorg-server/xserver-1.7.1-gamma-kdm-fix.patch
new file mode 100644
index 0000000..c62837e
--- /dev/null
+++ b/abs/core-testing/xorg-server/xserver-1.7.1-gamma-kdm-fix.patch
@@ -0,0 +1,34 @@
+From acc64ce5be7383c09e88a23aab06ebc2403f2ca3 Mon Sep 17 00:00:00 2001
+From: Bill Nottingham <notting@redhat.com>
+Date: Fri, 6 Nov 2009 10:32:27 +1000
+Subject: [PATCH] fix KDM gamma issue on vt switch
+
+---
+ hw/xfree86/modes/xf86RandR12.c |    4 ++++
+ 1 files changed, 4 insertions(+), 0 deletions(-)
+
+diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
+index 6ea9d26..ece12b9 100644
+--- a/hw/xfree86/modes/xf86RandR12.c
++++ b/hw/xfree86/modes/xf86RandR12.c
+@@ -1761,6 +1761,7 @@ xf86RandR12Init12 (ScreenPtr pScreen)
+     ScrnInfoPtr		pScrn = xf86Screens[pScreen->myNum];
+     rrScrPrivPtr	rp = rrGetScrPriv(pScreen);
+     XF86RandRInfoPtr	randrp  = XF86RANDRINFO(pScreen);
++    int i;
+ 
+     rp->rrGetInfo = xf86RandR12GetInfo12;
+     rp->rrScreenSetSize = xf86RandR12ScreenSetSize;
+@@ -1790,6 +1791,9 @@ xf86RandR12Init12 (ScreenPtr pScreen)
+      */
+     if (!xf86RandR12SetInfo12 (pScreen))
+ 	return FALSE;
++    for (i = 0; i < rp->numCrtcs; i++) {
++	xf86RandR12CrtcGetGamma(pScreen, rp->crtcs[i]);
++    }
+     return TRUE;
+ }
+ 
+-- 
+1.6.5.1
+
diff --git a/abs/core-testing/xorg-server/xserver-1.7.1-libcrypto.patch b/abs/core-testing/xorg-server/xserver-1.7.1-libcrypto.patch
new file mode 100644
index 0000000..ea33ea9
--- /dev/null
+++ b/abs/core-testing/xorg-server/xserver-1.7.1-libcrypto.patch
@@ -0,0 +1,32 @@
+From 8875112f5c57ec5d575e717c5638fbc919145efb Mon Sep 17 00:00:00 2001
+From: Adam Jackson <ajax@redhat.com>
+Date: Mon, 16 Nov 2009 18:01:26 -0500
+Subject: [PATCH] configure: Only link against libcrypto
+
+openssl.pc will link you against libssl, which we don't need, and which
+brings in another seven libraries we also don't need.  This is still
+bogus, we're really only trying to get a SHA1 routine, we could link it
+statically and be even better off.
+---
+ configure.ac |    6 ------
+ 1 files changed, 0 insertions(+), 6 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index f69f97e..254d33d 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1297,14 +1297,8 @@ if test "x$SHA1_LIB" = "x" ; then
+ fi
+ 
+ if test "x$SHA1_LIB" = "x" ; then
+-  PKG_CHECK_EXISTS([OPENSSL], [openssl], [HAVE_OPENSSL_PKC=yes],
+-                    [HAVE_OPENSSL_PKC=no])
+-  if test "x$HAVE_OPENSSL_PKC" = xyes; then
+-    REQUIRED_LIBS="$REQUIRED_LIBS openssl"
+-  else
+     AC_CHECK_LIB([crypto], [SHA1_Init], [SHA1_LIB="-lcrypto"],
+                  [AC_MSG_ERROR([OpenSSL must be installed in order to build the X server.])])
+-  fi
+ fi
+ 
+ PKG_CHECK_MODULES([XSERVERCFLAGS], [$REQUIRED_MODULES $REQUIRED_LIBS])
diff --git a/abs/core-testing/xorg-server/xvfb-run b/abs/core-testing/xorg-server/xvfb-run
new file mode 100644
index 0000000..4c2f4e0
--- /dev/null
+++ b/abs/core-testing/xorg-server/xvfb-run
@@ -0,0 +1,180 @@
+#!/bin/sh
+
+# $Id: xvfb-run 2027 2004-11-16 14:54:16Z branden $
+
+# This script starts an instance of Xvfb, the "fake" X server, runs a command
+# with that server available, and kills the X server when done.  The return
+# value of the command becomes the return value of this script.
+#
+# If anyone is using this to build a Debian package, make sure the package
+# Build-Depends on xvfb, xbase-clients, and xfonts-base.
+
+set -e
+
+PROGNAME=xvfb-run
+SERVERNUM=99
+AUTHFILE=
+ERRORFILE=/dev/null
+STARTWAIT=3
+XVFBARGS="-screen 0 640x480x8"
+LISTENTCP="-nolisten tcp"
+XAUTHPROTO=.
+
+# Query the terminal to establish a default number of columns to use for
+# displaying messages to the user.  This is used only as a fallback in the event
+# the COLUMNS variable is not set.  ($COLUMNS can react to SIGWINCH while the
+# script is running, and this cannot, only being calculated once.)
+DEFCOLUMNS=$(stty size 2>/dev/null | awk '{print $2}') || true
+if ! expr "$DEFCOLUMNS" : "[[:digit:]]\+$" >/dev/null 2>&1; then
+    DEFCOLUMNS=80
+fi
+
+# Display a message, wrapping lines at the terminal width.
+message () {
+    echo "$PROGNAME: $*" | fmt -t -w ${COLUMNS:-$DEFCOLUMNS}
+}
+
+# Display an error message.
+error () {
+    message "error: $*" >&2
+}
+
+# Display a usage message.
+usage () {
+    if [ -n "$*" ]; then
+        message "usage error: $*"
+    fi
+    cat <<EOF
+Usage: $PROGNAME [OPTION ...] COMMAND
+Run COMMAND (usually an X client) in a virtual X server environment.
+Options:
+-a        --auto-servernum          try to get a free server number, starting at
+                                    --server-num
+-e FILE   --error-file=FILE         file used to store xauth errors and Xvfb
+                                    output (default: $ERRORFILE)
+-f FILE   --auth-file=FILE          file used to store auth cookie
+                                    (default: ./.Xauthority)
+-h        --help                    display this usage message and exit
+-n NUM    --server-num=NUM          server number to use (default: $SERVERNUM)
+-l        --listen-tcp              enable TCP port listening in the X server
+-p PROTO  --xauth-protocol=PROTO    X authority protocol name to use
+                                    (default: xauth command's default)
+-s ARGS   --server-args=ARGS        arguments (other than server number and
+                                    "-nolisten tcp") to pass to the Xvfb server
+                                    (default: "$XVFBARGS")
+-w DELAY  --wait=DELAY              delay in seconds to wait for Xvfb to start
+                                    before running COMMAND (default: $STARTWAIT)
+EOF
+}
+
+# Find a free server number by looking at .X*-lock files in /tmp.
+find_free_servernum() {
+    # Sadly, the "local" keyword is not POSIX.  Leave the next line commented in
+    # the hope Debian Policy eventually changes to allow it in /bin/sh scripts
+    # anyway.
+    #local i
+
+    i=$SERVERNUM
+    while [ -f /tmp/.X$i-lock ]; do
+        i=$(($i + 1))
+    done
+    echo $i
+}
+
+# Clean up files
+clean_up() {
+    if [ -e "$AUTHFILE" ]; then
+        XAUTHORITY=$AUTHFILE xauth remove ":$SERVERNUM" >>"$ERRORFILE" 2>&1
+    fi
+    if [ -n "$XVFB_RUN_TMPDIR" ]; then
+        if ! rm -r "$XVFB_RUN_TMPDIR"; then
+            error "problem while cleaning up temporary directory"
+            exit 5
+        fi
+    fi
+}
+
+# Parse the command line.
+ARGS=$(getopt --options +ae:f:hn:lp:s:w: \
+       --long auto-servernum,error-file:,auth-file:,help,server-num:,listen-tcp,xauth-protocol:,server-args:,wait: \
+       --name "$PROGNAME" -- "$@")
+GETOPT_STATUS=$?
+
+if [ $GETOPT_STATUS -ne 0 ]; then
+    error "internal error; getopt exited with status $GETOPT_STATUS"
+    exit 6
+fi
+
+eval set -- "$ARGS"
+
+while :; do
+    case "$1" in
+        -a|--auto-servernum) SERVERNUM=$(find_free_servernum) ;;
+        -e|--error-file) ERRORFILE="$2"; shift ;;
+        -f|--auth-file) AUTHFILE="$2"; shift ;;
+        -h|--help) SHOWHELP="yes" ;;
+        -n|--server-num) SERVERNUM="$2"; shift ;;
+        -l|--listen-tcp) LISTENTCP="" ;;
+        -p|--xauth-protocol) XAUTHPROTO="$2"; shift ;;
+        -s|--server-args) XVFBARGS="$2"; shift ;;
+        -w|--wait) STARTWAIT="$2"; shift ;;
+        --) shift; break ;;
+        *) error "internal error; getopt permitted \"$1\" unexpectedly"
+           exit 6
+           ;;
+    esac
+    shift
+done
+
+if [ "$SHOWHELP" ]; then
+    usage
+    exit 0
+fi
+
+if [ -z "$*" ]; then
+    usage "need a command to run" >&2
+    exit 2
+fi
+
+if ! which xauth >/dev/null; then
+    error "xauth command not found"
+    exit 3
+fi
+
+# tidy up after ourselves
+trap clean_up EXIT
+
+# If the user did not specify an X authorization file to use, set up a temporary
+# directory to house one.
+if [ -z "$AUTHFILE" ]; then
+    XVFB_RUN_TMPDIR="$(mktemp -d -t $PROGNAME.XXXXXX)"
+    AUTHFILE="$XVFB_RUN_TMPDIR/Xauthority"
+fi
+
+# Start Xvfb.
+MCOOKIE=$(mcookie)
+XAUTHORITY=$AUTHFILE xauth source - << EOF >>"$ERRORFILE" 2>&1
+add :$SERVERNUM $XAUTHPROTO $MCOOKIE
+EOF
+XAUTHORITY=$AUTHFILE Xvfb ":$SERVERNUM" $XVFBARGS $LISTENTCP >>"$ERRORFILE" \
+  2>&1 &
+XVFBPID=$!
+sleep "$STARTWAIT"
+if ! kill -0 $XVFBPID 2>/dev/null; then
+  echo "Xvfb failed to start" >&2
+  exit 1
+fi
+
+# Start the command and save its exit status.
+set +e
+DISPLAY=:$SERVERNUM XAUTHORITY=$AUTHFILE "$@" 2>&1
+RETVAL=$?
+set -e
+
+# Kill Xvfb now that the command has exited.
+kill $XVFBPID
+
+# Return the executed command's exit status.
+exit $RETVAL
+
+# vim:set ai et sts=4 sw=4 tw=80:
diff --git a/abs/core-testing/xorg-server/xvfb-run.1 b/abs/core-testing/xorg-server/xvfb-run.1
new file mode 100644
index 0000000..137d3a1
--- /dev/null
+++ b/abs/core-testing/xorg-server/xvfb-run.1
@@ -0,0 +1,282 @@
+.\" $Id: xvfb-run.1 2138 2005-01-17 23:40:27Z branden $
+.\"
+.\" Copyright 1998-2004 Branden Robinson <branden@debian.org>.
+.\"
+.\" This is free software; you may redistribute it and/or modify
+.\" it under the terms of the GNU General Public License as
+.\" published by the Free Software Foundation; either version 2,
+.\" or (at your option) any later version.
+.\"
+.\" This is distributed in the hope that it will be useful, but
+.\" WITHOUT ANY WARRANTY; without even the implied warranty of
+.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+.\" GNU General Public License for more details.
+.\"
+.\" You should have received a copy of the GNU General Public License with
+.\" the Debian operating system, in /usr/share/common-licenses/GPL;  if
+.\" not, write to the Free Software Foundation, Inc., 59 Temple Place,
+.\" Suite 330, Boston, MA 02111-1307 USA
+.\"
+.\" We need the URL macro from groff's www macro package, but also want
+.\" things to work all right for people who don't have it.  So we define
+.\" our own URL macro and let the www macro package override it if it's
+.\" available.
+.de URL
+\\$2 \(laURL: \\$1 \(ra\\$3
+..
+.if \n[.g] .mso www.tmac
+.TH xvfb\-run 1 "2004\-11\-12" "Debian Project"
+.SH NAME
+xvfb\-run \- run specified X client or command in a virtual X server environment
+.SH SYNOPSIS
+.B xvfb\-run
+[
+.I options
+]
+.I command
+.SH DESCRIPTION
+.B xvfb\-run
+is a wrapper for the
+.BR Xvfb (1x)
+command which simplifies the task of running commands (typically an X
+client, or a script containing a list of clients to be run) within a virtual
+X server environment.
+.PP
+.B xvfb\-run
+sets up an X authority file (or uses an existing user\-specified one),
+writes a cookie to it (see
+.BR xauth (1x))
+and then starts the
+.B Xvfb
+X server as a background process.
+The process ID of
+.B Xvfb
+is stored for later use.
+The specified
+.I command
+is then run using the X display corresponding to the
+.B Xvfb
+server
+just started and the X authority file created earlier.
+.PP
+When the
+.I command
+exits, its status is saved, the
+.B Xvfb
+server is killed (using the process ID stored earlier), the X authority
+cookie removed, and the authority file deleted (if the user did not specify
+one to use).
+.B xvfb\-run
+then exits with the exit status of
+.IR command .
+.PP
+.B xvfb\-run
+requires the
+.B xauth
+command to function.
+.SH OPTIONS
+.TP
+.B \-a\fR,\fB \-\-auto\-servernum
+Try to get a free server number, starting at 99, or the argument to
+.BR \-\-server\-num .
+.TP
+.BI \-e\  file \fR,\fB\ \-\-error\-file= file
+Store output from
+.B xauth
+and
+.B Xvfb
+in
+.IR file .
+The default is
+.IR /dev/null .
+.TP
+.BI \-f\  file \fR,\fB\ \-\-auth\-file= file
+Store X authentication data in
+.IR file .
+By default, a temporary directory called
+.IR xvfb\-run. PID
+(where PID is the process ID of
+.B xvfb\-run
+itself) is created in the directory specified by the environment variable
+.B TMPDIR
+(or
+.I /tmp
+if that variable is null or unset), and the
+.BR tempfile (1)
+command is used to create a file in that temporary directory called
+.IR Xauthority .
+.TP
+.B \-h\fR,\fB \-\-help
+Display a usage message and exit.
+.TP
+.BI \-n\  servernumber \fR,\fB\ \-\-server\-num= servernumber
+Use
+.I servernumber
+as the server number (but see the
+.B \-a\fR,\fB \-\-auto\-servernum
+option above).
+The default is 99.
+.TP
+.B \-l\fR,\fB \-\-listen\-tcp
+Enable TCP port listening in the X server.
+For security reasons (to avoid denial\-of\-service attacks or exploits),
+TCP port listening is disabled by default.
+.TP
+.BI \-p\  protocolname \fR,\fB\ \-\-xauth\-protocol= protocolname
+Use
+.I protocolname
+as the X authority protocol to use.
+The default is \(oq.\(cq, which
+.B xauth
+interprets as its own default protocol, which is MIT\-MAGIC\-COOKIE\-1.
+.TP
+.BI \-s\  arguments \fR,\fB\ \-\-server\-args= arguments
+Pass
+.I arguments
+to the
+.B Xvfb
+server.
+Be careful to quote any whitespace characters that may occur within
+.I arguments
+to prevent them from regarded as separators for
+.BR xvfb\-run 's
+own arguments.
+Also, note that specification of \(oq\-nolisten tcp\(cq in
+.I arguments
+may override the function of
+.BR xvfb\-run 's
+own
+.B \-l\fR,\fB \-\-listen\-tcp
+option, and that specification of the server number (e.g., \(oq:1\(cq) may
+be ignored because of the way the X server parses its argument list.
+Use the
+.B xvfb\-run
+option
+.BI \-n\  servernumber \fR,\fB\ \-\-server\-num= servernumber
+to achieve the latter function.
+The default is \(oq\-screen 0 640x480x8\(cq.
+.TP
+.BI \-w\  delay \fR,\fB\ \-\-wait= delay
+Wait
+.I delay
+seconds after launching
+.B Xvfb
+before attempting to start the specified command.
+The default is 3.
+.SH ENVIRONMENT
+.TP
+.B COLUMNS
+indicates the width of the terminal device in character cells.
+This value is used for formatting diagnostic messages.
+If not set, the terminal is queried using
+.BR stty (1)
+to determine its width.
+If that fails, a value of \(oq80\(cq is assumed.
+.TP
+.B TMPDIR
+specifies the directory in which to place
+.BR xvfb\-run 's
+temporary directory for storage of the X authority file; only used if the
+.B \-f
+or
+.B \-\-auth\-file
+options are not specified.
+.SH "OUTPUT FILES"
+.PP
+Unless the
+.B \-f
+or
+.B \-\-auth\-file
+options are specified, a temporary
+directory and file within it are created (and deleted) to store the X
+authority cookies used by the
+.B Xvfb
+server and client(s) run under it.
+See
+.BR tempfile (1).
+If \-f or \-\-auth\-file are used, then the specified X authority file is
+only written to, not created or deleted (though
+.B xauth
+creates an authority file itself if told to use use that does not already
+exist).
+.PP
+An error file with a user\-specified name is also created if the
+.B \-e
+or
+.B \-\-error\-file
+options are specifed; see above.
+.SH "EXIT STATUS"
+.B xvfb\-run
+uses its exit status as well as output to standard error to communicate
+diagnostics.
+The exit status of \(oq1\(cq is not used, and should be interpreted as failure
+of the specified command.
+.TP
+0
+.B xvfb\-run
+only uses this exit status if the
+.B \-h\fR,\fB \-\-help
+option is given.
+In all other situations, this may be interpreted as success of the specified
+command.
+.TP
+2
+No command to run was specified.
+.TP
+3
+The
+.B xauth
+command is not available.
+.TP
+4
+The temporary directory that was going to be used already exists; since
+.B xvfb\-run
+produces a uniquely named directory, this may indicate an attempt by another
+process on the system to exploit a temporary file race condition.
+.TP
+5
+A problem was encountered while cleaning up the temporary directory.
+.TP
+6
+A problem was encountered while using
+.BR getopt (1)
+to parse the command\-line arguments.
+.SH EXAMPLES
+.TP
+.B xvfb\-run \-\-auto\-servernum \-\-server\-num=1 xlogo
+runs the
+.BR xlogo (1x)
+demonstration client inside the
+.B Xvfb
+X server on the first available server number greater than or equal to 1.
+.TP
+.B xvfb\-run \-\-server\-args="\-screen 0 1024x768x24" ico \-faces
+runs the
+.BR ico (1x)
+demonstration client (and passes it the
+.B \-faces
+argument) inside the
+.B Xvfb
+X server, configured with a root window of 1024 by 768 pixels and a color
+depth of 24 bits.
+.PP
+Note that the demo X clients used in the above examples will not exit on
+their own, so they will have to be killed before
+.B xvfb\-run
+will exit.
+.SH BUGS
+See
+.URL "http://bugs.debian.org/xvfb" "the Debian Bug Tracking System" .
+If you wish to report a bug in
+.BR xvfb\-run ,
+please use the 
+.BR reportbug (1)
+command.
+.SH AUTHOR
+.B xfvb\-run
+was written by Branden Robinson and Jeff Licquia with sponsorship from
+Progeny Linux Systems.
+.SH "SEE ALSO"
+.BR Xvfb (1x),
+.BR xauth (1x)
+.\" vim:set et tw=80:
-- 
cgit v0.12

