Enable building a compatible version of Xvnc that doesn't depend on shared libraries in xorg.build/lib


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@3938 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/unix/build-xorg-7.4 b/unix/build-xorg-7.4
index 3460f8e..2170604 100755
--- a/unix/build-xorg-7.4
+++ b/unix/build-xorg-7.4
@@ -7,12 +7,12 @@
 set -e
 
 if [ "$PREFIX" = "" ]; then
-	PREFIX=`pwd`/xorg.build
+    PREFIX=`pwd`/xorg.build
 fi
 export ACLOCAL="aclocal -I ${PREFIX}/share/aclocal"
 export PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig"
 MAKE="make"
-CFGFLAGS=
+STATIC=0
 
 modules="dri2proto \
     libpthread-stubs \
@@ -55,7 +55,6 @@
     libfontenc \
     libXfont \
     libpciaccess \
-    xkbcomp \
     pixman"
 
 
@@ -92,6 +91,7 @@
         tar jxf ~/.tigervnc-build/${module}.tar.bz2
     done
     tar jxf ~/.tigervnc-build/Mesa.tar.bz2
+    tar jxf ~/.tigervnc-build/freetype.tar.bz2
     tar jxf ~/.tigervnc-build/xorg-server.tar.bz2
     cp -r xorg-server-1.*/* ../xserver
     popd
@@ -100,12 +100,15 @@
 
 build ()
 {
-
     # Build VNC
     echo "*** Building VNC ***"
     cd ..
+    VNCCFGFLAGS=
+    if [ $STATIC = 1 ]; then
+        VNCCFGFLAGS=--with-included-zlib
+    fi
     make distclean || true
-    ./configure ${1+"$@"} --prefix=${PREFIX}
+    ./configure ${1+"$@"} ${VNCCFGFLAGS} --prefix=${PREFIX}
     make
     cd unix
 
@@ -124,6 +127,9 @@
         if [ "${module}" = "libSM" ]; then
             extraoptions="${extraoptions} --without-libuuid"
         fi
+        if [ $STATIC = 1 ]; then
+            extraoptions="${extraoptions} --enable-static --disable-shared"
+        fi
         ./configure ${1+"$@"} --prefix="${PREFIX}" ${extraoptions}
         echo ======================
         echo building ${module}
@@ -140,22 +146,46 @@
     # build mesa
     echo "*** Building Mesa ***"
     pushd Mesa-*
-    ./configure ${1+"$@"} --prefix=${PREFIX} --with-driver=dri --disable-glut --without-demos
+    MESACFGFLAGS='--with-driver=xlib --disable-glut --without-demos'
+    if [ $STATIC = 1 ]; then
+        MESACFGFLAGS=${MESACFGFLAGS}' --enable-static --disable-shared'
+    fi
+    ./configure ${1+"$@"} --prefix=${PREFIX} ${MESACFGFLAGS}
     if [ $? -ne 0 ]; then
 	echo "Failed to configure Mesa."
 	exit
     fi
     ($MAKE)
     make install
+    cd src/mesa/drivers/dri/
+    make install
     popd
 
+    # build freetype
+    if [ $STATIC = 1 ]; then
+        echo "*** Building freetype ***"
+        pushd freetype-*
+        ./configure ${1+"$@"} --prefix=${PREFIX} --enable-static --disable-shared
+        if [ $? -ne 0 ]; then
+	    echo "Failed to configure freetype."
+	    exit
+        fi
+        ($MAKE)
+        make install
+        popd
+    fi
+
     popd
 
     # build xserver
     echo "*** Building xserver ***"
     cd xserver
     autoreconf -fiv
-    ./configure ${1+"$@"} --prefix=${PREFIX} --disable-xinerama --disable-xvfb --disable-xnest --disable-xorg
+    XORGCFGFLAGS='--disable-xinerama --disable-xvfb --disable-xnest --disable-xorg'
+    if [ $STATIC = 1 ]; then
+        XORGCFGFLAGS="${XORGCFGFLAGS} --disable-shared --enable-static"
+    fi
+    ./configure ${1+"$@"} --prefix=${PREFIX} ${XORGCFGFLAGS}
     if [ $? -ne 0 ]; then
 	echo "Failed to configure X server."
 	exit
@@ -168,16 +198,29 @@
 case "$1" in
     init)
 	shift
+	if [ "$1" = "-static" ]; then
+	    STATIC=1
+	    shift
+	fi
 	init ${1+"$@"}
 	;;
     build)
 	shift
+	if [ "$1" = "-static" ]; then
+	    STATIC=1
+	    shift
+	fi
 	build ${1+"$@"}
 	;;
     update)
+	shift
+	if [ "$1" = "-static" ]; then
+	    STATIC=1
+	    shift
+	fi
 	update_modules
 	;;
     *)
-	echo "Usage: $0 init | build | update [additional configure flags]"
+	echo "Usage: $0 init | build | update [-static] [additional configure flags]"
 	exit 3
 esac
diff --git a/unix/download-xorg b/unix/download-xorg
index bb5dfb5..db2b8d2 100755
--- a/unix/download-xorg
+++ b/unix/download-xorg
@@ -60,10 +60,10 @@
     "util-macros": UTIL + "util-macros-1.1.6.tar.bz2",
     "xorg-server": SERVER + "xorg-server-1.5.3.tar.bz2",
     "xkeyboard-config": DATA + "xkeyboard-config-1.4.tar.bz2",
-    "xkbcomp": APP + "xkbcomp-1.0.5.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",
+    "freetype": "http://downloads.sourceforge.net/freetype/freetype-2.3.11.tar.bz2",
     "libxcb": "http://xcb.freedesktop.org/dist/libxcb-1.1.91.tar.bz2",
     "libpthread-stubs": "http://xcb.freedesktop.org/dist/libpthread-stubs-0.1.tar.bz2",
     "xcb-proto": "http://xcb.freedesktop.org/dist/xcb-proto-1.2.tar.bz2",