Add support for building a stand-alone version of Xvnc from the Xorg 7.5 sources


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4023 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/unix/build-xorg b/unix/build-xorg
index 166fad7..71a68ff 100755
--- a/unix/build-xorg
+++ b/unix/build-xorg
@@ -1,7 +1,7 @@
 #!/bin/bash
 # -*- mode: shell-script; coding: UTF-8 -*-
 # 
-# Build Xvnc with Xorg 7.4
+# Build Xvnc with Xorg 7.4 or 7.5
 #
 
 set -e
@@ -33,7 +33,6 @@
     videoproto \
     compositeproto \
     xineramaproto \
-    fontcacheproto \
     libdrm \
     libXau \
     xtrans \
@@ -48,13 +47,14 @@
     libXfixes \
     libXdamage \
     libXi \
-    evieext \
     libxkbfile \
     libfontenc \
     libXfont \
     libpciaccess \
     pixman"
 
+modules74="fontcacheproto \
+    evieext"
 
 init()
 {
@@ -69,7 +69,13 @@
     popd
 
     pushd xserver
-    patch -p1 < $SRCDIR/unix/xserver15.patch
+
+    if [ "$XORG_VERSION" = "7.4" ]; then
+	patch -p1 < $SRCDIR/unix/xserver15.patch
+    else
+	patch -p1 < $SRCDIR/unix/xserver17.patch
+    fi
+
     popd
     popd
 
@@ -84,6 +90,7 @@
 update_modules()
 {
     if [ -d xorg ]; then rm -rf xorg; fi
+    if [ -d xorg.build ]; then rm -rf xorg.build; fi
     mkdir xorg
     pushd xorg
     $SRCDIR/unix/download-xorg-$XORG_VERSION
@@ -236,10 +243,11 @@
     shift
 done
 
-if [ "$XORG_VERSION" = "" -o "$MODE" = "" ]
-then
-    usage
-fi
+case "$XORG_VERSION" in
+    7.4)  modules=$modules" "$modules74  ;;
+    7.5)  ;;
+    *)    usage  ;;
+esac
 
 pushd $SRCDIR
 SRCDIR=`pwd`
@@ -255,7 +263,7 @@
 fi
 
 export ACLOCAL="aclocal -I ${PREFIX}/share/aclocal"
-export PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig"
+export PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig:${PREFIX}/share/pkgconfig"
 
 case "$MODE" in
     init)       init                 ;;
diff --git a/unix/download-xorg-7.5 b/unix/download-xorg-7.5
new file mode 100755
index 0000000..50e4cf5
--- /dev/null
+++ b/unix/download-xorg-7.5
@@ -0,0 +1,82 @@
+#!/usr/bin/env python
+# -*-mode: python; coding: UTF-8 -*-
+
+import os
+import glob
+
+#INDI = "http://ftp.sunet.se/pub/X11/ftp.x.org/individual"
+INDI = "http://ftp.x.org/pub/individual/"
+PROTO = INDI + "proto/"
+LIB = INDI + "lib/"
+SERVER = INDI + "xserver/"
+UTIL = INDI + "util/"
+DATA = INDI + "data/"
+APP = INDI + "app/"
+
+packages = {
+    "damageproto": PROTO + "damageproto-1.2.0.tar.bz2",
+    "fixesproto":  PROTO + "fixesproto-4.1.1.tar.bz2",
+    "resourceproto": PROTO + "resourceproto-1.1.0.tar.bz2",
+    "fontsproto": PROTO + "fontsproto-2.1.0.tar.bz2",
+    "bigreqsproto": PROTO + "bigreqsproto-1.1.0.tar.bz2",
+    "kbproto": PROTO + "kbproto-1.0.4.tar.bz2",
+    "inputproto": PROTO + "inputproto-2.0.tar.bz2",
+    "glproto": PROTO + "glproto-1.4.10.tar.bz2",
+    "xineramaproto": PROTO + "xineramaproto-1.2.tar.bz2",
+    "randrproto": PROTO + "randrproto-1.3.1.tar.bz2",
+    "scrnsaverproto": PROTO + "scrnsaverproto-1.2.0.tar.bz2",
+    "renderproto": PROTO + "renderproto-0.11.tar.bz2",
+    "xcmiscproto": PROTO + "xcmiscproto-1.2.0.tar.bz2",
+    "xextproto": PROTO + "xextproto-7.1.1.tar.bz2",
+    "xf86driproto": PROTO + "xf86driproto-2.1.0.tar.bz2",
+    "dri2proto": PROTO + "dri2proto-2.1.tar.bz2",
+    "compositeproto": PROTO + "compositeproto-0.4.1.tar.bz2",
+    "xf86vidmodeproto": PROTO + "xf86vidmodeproto-2.3.tar.bz2",
+    "videoproto": PROTO + "videoproto-2.3.0.tar.bz2",
+    "xproto": PROTO + "xproto-7.0.16.tar.bz2",
+
+    "libxkbfile": LIB + "libxkbfile-1.0.6.tar.bz2",
+    "libXxf86vm": LIB + "libXxf86vm-1.1.0.tar.bz2",
+    "libXext": LIB + "libXext-1.1.1.tar.bz2",
+    "libfontenc": LIB + "libfontenc-1.0.5.tar.bz2",
+    "libXau": LIB + "libXau-1.0.5.tar.bz2",
+    "libXfont": LIB + "libXfont-1.4.1.tar.bz2",
+    "libXfixes": LIB + "libXfixes-4.0.4.tar.bz2",
+    "libSM": LIB + "libSM-1.1.1.tar.bz2",
+    "libXi": LIB + "libXi-1.3.tar.bz2",
+    "libXmu": LIB + "libXmu-1.0.5.tar.bz2",
+    "libX11": LIB + "libX11-1.3.2.tar.bz2",
+    "libXdmcp": LIB + "libXdmcp-1.0.3.tar.bz2",
+    "xtrans": LIB + "xtrans-1.2.5.tar.bz2",
+    "libXt": LIB + "libXt-1.0.7.tar.bz2",
+    "libpciaccess": LIB + "libpciaccess-0.10.9.tar.bz2",
+    "libICE": LIB + "libICE-1.0.6.tar.bz2",
+    "pixman": LIB + "pixman-0.17.2.tar.bz2",
+    "libXdamage": LIB + "libXdamage-1.1.2.tar.bz2",
+
+    "util-macros": UTIL + "util-macros-1.3.0.tar.bz2",
+    "xorg-server": SERVER + "xorg-server-1.7.1.tar.bz2",
+
+    "libdrm": "http://dri.freedesktop.org/libdrm/libdrm-2.4.0.tar.bz2",
+    "Mesa": "http://downloads.sourceforge.net/mesa3d/MesaLib-7.2.tar.bz2",
+    "libpthread-stubs": "http://xcb.freedesktop.org/dist/libpthread-stubs-0.1.tar.bz2",
+    "freetype": "http://downloads.sourceforge.net/freetype/freetype-2.3.11.tar.bz2",
+    }
+
+
+
+def main():
+    dir = os.path.expanduser("~")+"/.tigervnc-xorg-7.5"
+    cwd = os.getcwd()
+    if not os.path.exists(dir):
+        os.mkdir(dir)
+    os.chdir(dir)
+
+    for pkg in packages.keys():
+        loc = packages[pkg]
+        fname = pkg + ".tar.bz2"
+        if not os.path.exists(fname):
+            assert 0 == os.spawnvp(os.P_WAIT, "wget", ["-N", "-c", "-O", fname, loc])
+
+    os.chdir(cwd)
+main()