7172112 X builds need to add a layer of parfait on top
authorAlan Coopersmith <Alan.Coopersmith@Oracle.COM>
Fri, 01 Jun 2012 15:11:02 -0700
changeset 1296 9f021f447b92
parent 1295 0d6f24cf4163
child 1297 f43201b13719
7172112 X builds need to add a layer of parfait on top
buildit
open-src/common/Makefile.inc
open-src/common/Makefile.init
open-src/common/Makefile.options.oracle.com
open-src/common/X-parfait.conf
open-src/lib/libdrm/Makefile
open-src/lib/libdrm/no-tests.patch
open-src/lib/libdrm/solaris-drm-port.patch
open-src/util/build-tools/xmake
open-src/util/imake/Makefile
open-src/xserver/Makefile.inc
open-src/xserver/xvnc/Makefile
open-src/xserver/xvnc/solaris-port.patch
--- a/buildit	Wed May 30 13:19:01 2012 -0700
+++ b/buildit	Fri Jun 01 15:11:02 2012 -0700
@@ -5,7 +5,7 @@
 #
 ###########################################################################
 #
-# Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -69,6 +69,18 @@
 # Send all further output & errors to the log file
 exec > log/buildit-XW 2>&1
 
+START="$(perl -e 'print time')"
+
+XMAKE="$(pwd)/open-src/util/build-tools/xmake ${VERBOSE_FLAGS} -k"
+
+${XMAKE} setup || fatal_error "make setup failed: cannot build"
+
+# Extract variables from makefiles via make and set them in the shell
+get_make_var() {
+    typeset -n var=$1
+    eval "$(${XMAKE} -s -C open-src/util/util-macros print_make_vars VARS=$1)"
+}
+
 # Find hg id and export it so set-elf-comments.pl doesn't have to re-run
 # for every module built
 hg_id() {
@@ -80,18 +92,21 @@
 }
 export XBUILD_HG_ID="$(hg_id)"
 
-START="$(perl -e 'print time')"
-
 print "------------------------------------------------------------------------------"
 print "Building gate at hg id: ${XBUILD_HG_ID}"
 print -n "Start time: " ; date
 print -n "Building on: " ; uname -a
-print "Using these compilers: "
-whence cc gcc
+print "Using these tools: "
 # Make sure Sun C compiler is at least version 5.10 (Studio 12 Update 1)
+whence cc
 cc -V 2>&1 | perl -n -e 'if (($_ =~ m| C (\d+).(\d+)|)) { \
     print $_ ; print "*** Compiler too old!\n" if ( ($1 != 5) || ($2 < 10) ) }'
-gcc -v
+# Log paths & versions of tools which use gnu standard --version flag
+get_make_var GCC
+for tool in parfait ${GCC} gmake autoconf automake libtool ; do
+    printf "%-22s\t" "$(whence ${tool}):"
+    ${tool} --version | head -1
+done
 
 # Exported to stop Sun compilers from reporting home on each usage
 export SUNW_NO_UPDATE_NOTIFY='true'
@@ -103,22 +118,10 @@
 
 MACH="$(uname -p)"
 
-# Remove old proto area & package area to clean after moving to new locations
-if [ "${MACH}" = "i386" ]; then
-    /bin/rm -rf proto-i386-svr4
-else
-    /bin/rm -rf proto-sun4-svr4
-fi
-/bin/rm -rf proto-packages
-
 # Clean new proto areas for this architecture
 /bin/rm -rf "proto/root_${MACH}" "proto/metadata_${MACH}" \
     "proto/pkg_${MACH}" "proto/tools_${MACH}"
 
-XMAKE="$(pwd)/open-src/util/build-tools/xmake ${VERBOSE_FLAGS} -k"
-
-${XMAKE} setup || fatal_error "make setup failed: cannot build"
-
 cd open-src
 # Run as two steps to avoid race between cleaning & rebuilding when
 # using parallel make
@@ -127,8 +130,17 @@
 ${XMAKE} check_rtime > ../log/check-rtime 2>&1 &
 cd ..
 
+get_make_var USE_PARFAIT
+if [[ "${USE_PARFAIT}" == "yes" ]] ; then
+    get_make_var DMAKE_MAX_JOBS
+    /bin/rm -rf log/parfait
+    parfait -e all -c open-src/common/X-parfait.conf -z "$(pwd)" \
+        -j "${DMAKE_MAX_JOBS:-100%}" -r "${XBUILD_HG_ID}" \
+        -o log/parfait.txt -g log/parfait open-src > log/parfait.out 2>&1 &
+fi
+
 # Set DISTRO_NAME based on open-src/common/Makefile.options
-eval "$(cd open-src/util/util-macros ; make print_make_vars VARS=DISTRO_NAME)"
+get_make_var DISTRO_NAME
 
 print "\nFinished building the X Window System Consolidation for" \
     "${DISTRO_NAME:-OpenSolaris}.\n"
@@ -140,6 +152,13 @@
 
 wait
 
+if [[ "${USE_PARFAIT}" == "yes" ]] ; then
+    print -n "\nParfait issues: "
+    wc -l < log/parfait/bugstatus.db
+    print "Parfait results:"
+    print " file:///net/$(hostname)$(pwd)/log/parfait/index.html"
+fi
+
 print -n "\ncheck-rtime errors: "
 grep -c '^====' log/check-rtime
 
--- a/open-src/common/Makefile.inc	Wed May 30 13:19:01 2012 -0700
+++ b/open-src/common/Makefile.inc	Fri Jun 01 15:11:02 2012 -0700
@@ -521,7 +521,7 @@
 
 # Set USE_DEFAULT_CONFIG_ENV=no in a Makefile to not use this default
 # autoconfig environment
-DEFAULT_CONFIG_ENV  = CC="$(CC)" CXX="$(CXX)"
+DEFAULT_CONFIG_ENV  = CC="$(CC)" CXX="$(CXX)" AR="$(AR)"
 DEFAULT_CONFIG_ENV += LD="$(CC) $(ARCH_FLAGS) $(LDFLAGS)"
 DEFAULT_CONFIG_ENV += CFLAGS="$(MODTYPE_CFLAGS) $(MODULE_CFLAGS)" 
 DEFAULT_CONFIG_ENV += CXXFLAGS="$(MODTYPE_CXXFLAGS) $(MODULE_CXXFLAGS)"
@@ -553,6 +553,7 @@
 	if [[ "$(DELIBTOOLIZE)" = "yes" ]] ; then \
 	    $(PERL) $(TOP)/open-src/common/delibtoolize.pl $(DELIBTOOLIZE_FLAGS) . ; \
 	fi
+	-rm -f $(SOURCE_DIR)/a.out.bc
 
 default_configure: $(AUTOCONF_TARGET)
 
@@ -564,18 +565,20 @@
 # MKDIRPROG - Workaround parallel build race condition
 #		in older upstream packaged install-sh
 
-BUILD_ENV = LD_OPTIONS='$(LD_OPTIONS)' \
-	PROTODIR='$(PROTODIR)' \
-	MAKE='$(MODULE_MAKE)' \
-	MKDIRPROG='mkdir -p' \
-	PYTHONPATH="$(PYTHON_PATH)" \
-	$(MODTYPE_BUILD_ENV) $(MODULE_BUILD_ENV)
+BUILD_ENV  = LD_OPTIONS='$(LD_OPTIONS)'
+BUILD_ENV += PROTODIR='$(PROTODIR)'
+BUILD_ENV += MAKE='$(MODULE_MAKE)'
+BUILD_ENV += MKDIRPROG='mkdir -p'
+BUILD_ENV += PYTHONPATH="$(PYTHON_PATH)"
+$(WITH_PARFAIT) BUILD_ENV += PARFAIT_NATIVEGCC="$(GCC)"
+$(WITH_PARFAIT) BUILD_ENV += PARFAIT_NATIVEGXX="$(GXX)"
+BUILD_ENV += $(MODTYPE_BUILD_ENV) $(MODULE_BUILD_ENV)
 
 DEFAULT_BUILD_MAKEFLAGS=$(MODTYPE_MAKEFLAGS) $(MODULE_MAKEFLAGS) \
 	$(MODTYPE_BUILD_MAKEFLAGS) $(MODULE_BUILD_MAKEFLAGS)
 
 # Dependencies for make build step
-BUILD_DEPS = $(SOURCE_TARGETS) $(CONFIGURE_TARGETS) $(MODTYPE_BUILD_DEPS) $(MODULE_BUILD_DEPS) $(MODULE_MAKE)
+BUILD_DEPS = $(SOURCE_TARGETS) $(CONFIGURE_TARGETS) $(MODTYPE_BUILD_DEPS) $(MODULE_BUILD_DEPS)
 
 DEFAULT_BUILD_COMMAND = cd @DIR@ ; \
 	$(BUILD_ENV) $(MODULE_MAKE) $(MAKEFLAGS) $(DEFAULT_BUILD_MAKEFLAGS)
@@ -741,14 +744,6 @@
 
 ### Other tools/dependencies needed to build
 
-# Some modules (such as FreeType 2) require GNU make
-$(GNUMAKE):
-	@print -n "Building with GNU make from $$(whence gmake): "
-	@$(GNUMAKE) --version
-
-$(MAKE):
-	@print "Building with make from $$(whence $(MAKE))"
-
 # Some modules use lndir to merge in sources from Sun specific directories
 $(LNDIR):
 	(cd $(TOP)/open-src/util/lndir && $(MAKE) $(MAKEFLAGS) install)
@@ -932,3 +927,9 @@
 	fi
 
 install_metadata: $(METADATA_TARGETS)
+
+### Parfait scans
+
+parfait:
+	parfait -e all -c "$(TOP)/open-src/common/X-parfait.conf" -z "$(TOP)" \
+		-j "$${DMAKE_MAX_JOBS:-100%}" . || true
--- a/open-src/common/Makefile.init	Wed May 30 13:19:01 2012 -0700
+++ b/open-src/common/Makefile.init	Fri Jun 01 15:11:02 2012 -0700
@@ -152,9 +152,30 @@
 ARCH_LIB_FLAGS_sparc_gcc 	= -mno-app-regs
 ARCH_LIB_FLAGS_i386_gcc 	= 
 
+## Parfait wrappers
+CC_suncc_parfait	= parfait-cc
+CXX_suncc_parfait	= parfait-CC
+CC_gcc_parfait		= parfait-gcc
+CXX_gcc_parfait		= parfait-g++
+AR_parfait		= parfait-ar
+AS_parfait		= parfait-as
+
+# If USE_PARFAIT is yes, use _parfait variants
+PARFAIT_1 =	$(USE_PARFAIT:no=)
+PARFAIT_2 =	$(PARFAIT_1:yes=$(POUND_SIGN))
+$(PARFAIT_2)	WITH_PARFAIT=$(POUND_SIGN)
+$(WITH_PARFAIT)	WITHOUT_PARFAIT=$(POUND_SIGN)
+
+$(WITH_PARFAIT)		CHOSEN_COMPILER=$(MODULE_COMPILER)_parfait
+$(WITHOUT_PARFAIT)	CHOSEN_COMPILER=$(MODULE_COMPILER)
+$(WITH_PARFAIT)		AR=$(AR_parfait)
+$(WITHOUT_PARFAIT)	AR=/usr/bin/ar
+$(WITH_PARFAIT)		AS=$(AS_parfait)
+$(WITHOUT_PARFAIT)	AS=/usr/bin/as
+
 ## Set common variables based on above rules
-CC			= $(CC_$(MODULE_COMPILER))
-CXX			= $(CXX_$(MODULE_COMPILER))
+CC			= $(CC_$(CHOSEN_COMPILER))
+CXX			= $(CXX_$(CHOSEN_COMPILER))
 CFLAGS			= $(CFLAGS_$(MODULE_COMPILER)) $(ARCH_FLAGS)
 CXXFLAGS		= $(CXXFLAGS_$(MODULE_COMPILER)) $(ARCH_FLAGS)
 ARCH32_FLAGS		= $(ARCH32_FLAGS_$(MACH)_$(MODULE_COMPILER))
--- a/open-src/common/Makefile.options.oracle.com	Wed May 30 13:19:01 2012 -0700
+++ b/open-src/common/Makefile.options.oracle.com	Fri Jun 01 15:11:02 2012 -0700
@@ -1,6 +1,6 @@
-# X build options for Oracle Solaris
+# X build options for Oracle Solaris -*- Makefile -*-
 #
-# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -59,3 +59,8 @@
 
 # Reference repository for pkglint to check against
 PKGLINT_REFERENCE_REPO = http://ipkg.us.oracle.com/solaris11/dev/
+
+# Enable parfait static analysis of code by default
+DEFAULT_PARFAIT_1 =	$(USE_PARFAIT:yes=)
+DEFAULT_PARFAIT_2 =	$(DEFAULT_PARFAIT_1:no=$(POUND_SIGN))
+$(DEFAULT_PARFAIT_2)	USE_PARFAIT = yes
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/common/X-parfait.conf	Fri Jun 01 15:11:02 2012 -0700
@@ -0,0 +1,531 @@
+/*
+ * Solaris X consolidation configuration for Parfait static analysis
+ * This file provides additional information about functions that Parfait
+ * can use to make more accurate analysis.
+ */
+
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+include 'std.conf';
+
+/* Local copy until added to parfait's std.conf (Bug 14121100) */
+asprintf(p,const fmt,args...) : printf(fmt,args), noescape {
+    if (result >= 0) {
+        *p == new(result);
+    }
+}
+vasprintf(p,const fmt,va) : noescape {
+    if (result >= 0) {
+        *p == new(result);
+    }
+}
+
+/* Local copy until added to parfait's std.conf (Bug 14121213) */
+strndup(const s, n) : noescape {
+    if ( result != 0 ) {
+        result == new(undefined);
+        strlen(result) == PRE ( strlen(s) < n ? strlen(s) : n);
+    }
+}
+
+/* Define custom bug types for common precondition assertions */
+bugtype "null-pointer-deref-call-X"(ptr) : "null-pointer-deref" {
+   name="Null Pointer Dereference in X function";
+   priority="error";
+   enabled="true";
+   message="Null pointer dereference in call to ", callee_name(), ". Pointer ", name(ptr), " may be dereferenced";
+}
+
+/*************************************************************************
+ * Client side functions
+ */
+
+/** libX11 **/
+bugtype "X-resource-leak"(xid) {
+    name="X Resource Leak";
+    priority="error";
+    enabled="true";
+    message="Leaked X Resource ", name(xid);
+}
+
+resource <x-resource> {
+    name="X Resource";
+    "X-resource-leak"(resource): noleak(resource);
+    resource == 0 => !isa(resource);
+}
+
+/* Listed pretty much in same order as <X11/Xlib.h> */
+
+/* Todo: XLoadQueryFont...XNewModifiermap */
+
+XCreateImage(const display, v, dp, f, o, data, w, h, bp, bpl) {
+    "null-pointer-deref-call-X"(display) : display != 0;
+    if (result != 0) {
+        result == new(undefined);
+    }
+}
+XDestroyImage(p) { /* actually in <X11/Xutil.h> */
+    "null-pointer-deref-call-X"(p) : p != 0;
+    delete(p);
+}
+/* Todo: XInitImage, XGetImage, XGetSubImage */
+
+XOpenDisplay(const d) {
+    if (result != 0) {
+        result == new(undefined);
+    }
+}
+
+XFetchBuffer(d, n, b) {
+    "null-pointer-deref-call-X"(d) : d != 0;
+    if (result != 0) {
+        *n == size(result);
+        result == new(*n);
+    }
+}
+XFetchBytes(d, n) : XFetchBuffer(d, n, 0);
+
+XGetAtomName(d, a) {
+    "null-pointer-deref-call-X"(d) : d != 0;
+    if (result != 0) {
+        result == new(undefined);
+    }
+}
+/* Todo: XGetAtomNames, XGetDefault, XDisplayName, XKeysymToString,
+   XInternAtom, XInternAtoms */
+
+XCopyColormapAndFree(d, c) : noescape {
+    "null-pointer-deref-call-X"(d) : d != 0;
+    result != 0;
+    init<x-resource>(result);
+}
+XCreateColormap(d, w, v, a) : noescape {
+    "null-pointer-deref-call-X"(d) : d != 0;
+    result != 0;
+    init<x-resource>(result);
+}
+XCreatePixmapCursor(d, s, m, fg, bg, x, y) : noescape {
+    "null-pointer-deref-call-X"(d) : d != 0;
+    result != 0;
+    init<x-resource>(result);
+}
+XCreateGlyphCursor(d, sf, mf, sc, mc, fg, bg) : noescape {
+    "null-pointer-deref-call-X"(d) : d != 0;
+    result != 0;
+    init<x-resource>(result);
+}
+XCreateFontCursor(d, s) : noescape {
+    "null-pointer-deref-call-X"(d) : d != 0;
+    result != 0;
+    init<x-resource>(result);
+}
+XLoadFont(d, c) : noescape {
+    "null-pointer-deref-call-X"(d) : d != 0;
+    result != 0;
+    init<x-resource>(result);
+}
+
+XCreateGC(d, dr, vm, v) : noescape {
+    "null-pointer-deref-call-X"(d) : d != 0;
+    if (result != 0) {
+        result == new(112); /* sizeof(struct _XGC) */
+    }
+}
+/* Todo: XGContextFromGC, XFlushGC */
+
+XCreatePixmap(d, dr, w, h, dp) {
+    "null-pointer-deref-call-X"(d) : d != 0;
+    result != 0;
+    init<x-resource>(result);
+}
+XCreateBitmapFromData(d, dr, dt, w, h) {
+    "null-pointer-deref-call-X"(d) : d != 0;
+    result != 0;
+    init<x-resource>(result);
+}
+XCreatePixmapFromBitmapData(d, dr, dt, w, h, fg, bg, dp) {
+    "null-pointer-deref-call-X"(d) : d != 0;
+    result != 0;
+    init<x-resource>(result);
+}
+XCreateSimpleWindow(d,p,x,y,w,h,bw,b,bg) {
+    "null-pointer-deref-call-X"(d) : d != 0;
+    result != 0;
+    init<x-resource>(result);
+}
+/* Todo: XGetSelectionOwner */
+XCreateWindow(d,p,x,y,w,h,bw,dp,c,v,vm,a) {
+    "null-pointer-deref-call-X"(d) : d != 0;
+    result != 0;
+    init<x-resource>(result);
+}
+/* Todo: XListInstalledColormaps, XListFonts, XListFontsWithInfo, XGetFontPath */
+
+XListExtensions(d, n) : noescape {
+    "null-pointer-deref-call-X"(d) : d != 0;
+    if (result != 0) {
+        result == new(undefined); /* n * char* + extension strings */
+    }
+}
+XListProperties(d, w, n) : noescape {
+    "null-pointer-deref-call-X"(d) : d != 0;
+    if (result != 0) {
+        result == new(n * 4); 
+    }
+}
+XListHosts(d, n, s) : noescape {
+    "null-pointer-deref-call-X"(d) : d != 0;
+    if (result != 0) {
+        result == new(undefined); /* n * char* + extension strings */
+    }
+}
+
+XKeycodeToKeysym(d, k, i) : noescape {
+    "null-pointer-deref-call-X"(d) : d != 0;
+}
+XLookupKeysym(e, i) : noescape {
+    "null-pointer-deref-call-X"(e) : e != 0;
+}   
+XGetKeyboardMapping(d, fk, kc, ks) : noescape {
+    "null-pointer-deref-call-X"(d) : d != 0;
+    if (result != 0) {
+        result == new(kc * ks);
+    }
+}
+XStringToKeysym(s) : noescape {
+    "null-pointer-deref-call-X"(s) : s != 0;
+}
+XMaxRequestSize(d) : noescape {
+    "null-pointer-deref-call-X"(d) : d != 0;
+}
+XExtendedMaxRequestSize(d) : XMaxRequestSize(d);
+XScreenResourceString(d) : XMaxRequestSize(d);
+XDisplayMotionBufferSize(d) : XMaxRequestSize(d);
+XVisualIdFromVisual(v) : noescape {
+    /* Todo: visual resource id? */
+    "null-pointer-deref-call-X"(v) : v != 0;
+}
+
+XLockDisplay(d) : XMaxRequestSize(d);
+XUnlockDisplay(d) : XMaxRequestSize(d);
+
+XAddExtension(d) {
+    "null-pointer-deref-call-X"(d) : d != 0;
+    if (result != 0) {
+        result == new(128);
+    }
+}
+XInitExtension(d, n) : XAddExtension(d);
+XFindOnExtensionList(s, n) {
+    "null-pointer-deref-call-X"(s) : s != 0;
+}
+
+/* these are routines for which there are also macros */
+XDefaultRootWindow(d) : noescape {
+    "null-pointer-deref-call-X"(d) : d != 0;
+}
+XRootWindow(d, n) : XDefaultRootWindow(d);
+XRootWindowOfScreen(s) : XDefaultRootWindow(s);
+XDefaultVisual(d, n) : XDefaultRootWindow(d);
+XDefaultVisualOfScreen(s) : XDefaultRootWindow(s);
+XDefaultGC(d, n) : XDefaultRootWindow(d);
+XDefaultGCOfScreen(s) : XDefaultRootWindow(s);
+XBlackPixel(d, n) : XDefaultRootWindow(d);
+XWhitePixel(d, n) : XDefaultRootWindow(d);
+XBlackPixelOfScreen(s) : XDefaultRootWindow(s);
+XWhitePixelOfScreen(s) : XDefaultRootWindow(s);
+XNextRequest(d) : XDefaultRootWindow(d);
+XLastKnownRequestProcessed(d) : XDefaultRootWindow(d);
+XServerVendor(d) : XDefaultRootWindow(d);
+XDisplayString(d) : XDefaultRootWindow(d);
+
+XDefaultColormap(d, n) : noescape {
+    /* Todo: colormap resource id? */
+    "null-pointer-deref-call-X"(d) : d != 0;
+}
+XDefaultColormapOfScreen(s) : XDefaultColormap(s, 0);
+
+XDisplayOfScreen(s) : XDefaultRootWindow(s);
+XScreenOfDisplay(d, n) : XDefaultRootWindow(d);
+XDefaultScreenOfDisplay(d) : XDefaultRootWindow(d);
+XEventMaskOfScreen(s) : XDefaultRootWindow(s);
+XScreenNumberOfScreen(s) : XDefaultRootWindow(s);
+
+/* Todo: XSetErrorHandler, XSetIOErrorHandler */
+
+XListPixmapFormats(d, c) : noescape {
+    "null-pointer-deref-call-X"(d) : d != 0;
+    "null-pointer-deref-call-X"(c) : c != 0;
+    if (result != 0) {
+        result == new(c * 12);  /* sizeof(XPixmapFormatValues) */
+    }    
+}
+XListDepths(d, s, c) : noescape {
+    "null-pointer-deref-call-X"(d) : d != 0;
+    "null-pointer-deref-call-X"(c) : c != 0;
+    if (result != 0) {
+        result == new(c * 4);  /* sizeof(int) */
+    }    
+}
+/* Todo: ICCCM routines - XReconfigureWMWindow...XSetWMColormapWindows,
+   XSetTransientForHint */
+XFreeStringList(l) : free(l);
+
+XActivateScreenSaver(d) : noescape {
+    "null-pointer-deref-call-X"(d) : d != 0;
+}
+XAddHost(d, h) : noescape {
+    "null-pointer-deref-call-X"(d) : d != 0;
+    "null-pointer-deref-call-X"(h) : h != 0;
+}
+XAddHosts(d, h, n) : noescape {
+    "null-pointer-deref-call-X"(d) : d != 0;
+    "null-pointer-deref-call-X"(h) : h != 0;
+}
+/* Todo: XAddToExtensionList...XClearWindow */
+XCloseDisplay(d) {
+    "null-pointer-deref-call-X"(d) : d != 0;
+    delete(d);
+}
+/* Todo: XConfigureWindow...XDeleteProperty */
+XDestroyWindow(d, w) {
+    "null-pointer-deref-call-X"(d) : d != 0;
+    destroy<x-resource>(w);
+}
+XDestroySubwindows(d, w) : XDestroyWindow(d, w); /* Todo: subwindows? */
+/* Todo: XDoesBackingStore...XDisplayHeightMM */
+XDisplayKeycodes(d, min, max) : noescape {
+    "null-pointer-deref-call-X"(d) : d != 0;
+    min >= 8;
+    max <= 255;
+}
+/* Todo: XDisplayPlanes...XEventsQueued */
+XFetchName(d, w, name) : noescape {
+    "null-pointer-deref-call-X"(d) : d != 0;
+    if (name != 0) {
+       name == new(undefined);
+    }
+}
+/* Todo: XFillArcs...XForceScreenSaver */
+XFree(p) : free(p);
+XFreeColormap(d, c) : noescape {
+    "null-pointer-deref-call-X"(d) : d != 0;
+    destroy<x-resource>(c);
+}
+/* Todo: XFreeColors */
+XFreeCursor(d, c) : noescape {
+    "null-pointer-deref-call-X"(d) : d != 0;
+    destroy<x-resource>(c);
+}
+XFreeExtensionList(l) : free(l);
+XFreeFont(d, f) : noescape {
+    "null-pointer-deref-call-X"(d) : d != 0;
+    destroy<x-resource>(f);
+}
+/* Todo: XFreeFontInfo */
+XFreeFontNames(l) : free(l);
+XFreeFontPath(l) : free(l);
+XFreeGC(d, gc) : noescape {
+    "null-pointer-deref-call-X"(d) : d != 0;
+    destroy<x-resource>(gc);
+}
+XFreeModifierMap(m) : free(m);
+XFreePixmap(d, p) : noescape {
+    "null-pointer-deref-call-X"(d) : d != 0;
+    destroy<x-resource>(p);
+}
+/* Todo: XGeometry...XGetGeometry */
+XGetIconName(d, w, name) : XFetchName(d, w, name);
+/* Todo: XGetInputFocus...XGetTransientForHint */
+XGetWindowProperty(d, w, p, lo, ll, del, rt, at, af, n, bar, prop) : noescape {
+    "null-pointer-deref-call-X"(d) : d != 0;
+    if (prop != 0) {
+       prop == new(undefined);
+    }
+}
+/* Todo: XGetWindowAttributes...XQueryColors */
+XQueryExtension(d, n, op, ev, er) : noescape {
+    "null-pointer-deref-call-X"(d) : d != 0;
+    if (result != 0) {
+       op >= 128;
+       op <= 255;
+    }
+}
+/* Todo: XQueryKeymap...XQueryTextExtents16 */
+XQueryTree(d, w, r, p, c, nc) : noescape {
+    "null-pointer-deref-call-X"(d) : d != 0;
+    "null-pointer-deref-call-X"(c) : c != 0;
+    if (result != 0) {
+       c == new(nc * 4);
+    }
+}
+/* Todo: XRaiseWindow...XRemoveFromSaveSet */
+XRemoveHost(d, h) : XAddHost(d, h);
+XRemoveHosts(d, h, n) : XAddHosts(d, h, n);
+/* Todo: XReparentWindow...XFreeEventData */
+
+/* Allocation functions from <X11/Xutil.h> */
+XAllocClassHint() : malloc(size(result));
+XAllocIconSize() : malloc(size(result));
+XAllocSizeHints() : malloc(size(result));
+XAllocStandardColormap() : malloc(size(result));
+XAllocWMHints() : malloc(size(result));
+
+/** libXt
+ * Functions from Xt's Alloc.c - like libc ones, except exit on failure,
+ * instead of return NULL
+ */
+XtAsprintf(p,const fmt,args...) : printf(fmt,args), noescape {
+    *p == new(result);
+}
+
+XtMalloc(s) {
+    result == new(s);
+}
+
+XtRealloc(p,s) {
+    delete(p);
+    result == new(s);
+}
+
+XtCalloc(n,s) {
+    result == new(n*s);
+}
+
+XtFree(p) : free(p);
+
+/*************************************************************************
+ * Server side functions
+ */
+
+/* include/misc.h: byte swapping */
+          /* XXX - does not work! */
+bugtype "wrong-size-swap"(ptr,funcsize) {
+    name="Wrong size Xserver swap function used";
+    priority="error";
+    enabled="true";
+    message="Wrong size swap function used: ", callee_name(), " expects ", funcsize, "-byte variable, got ", size(ptr),"-byte ", name(ptr), " instead.";
+}
+
+swap_uint32(x) : noescape {
+    "wrong-size-swap"(x,4): size(*x) == 4;
+}
+swap_uint16(x) : noescape {
+    "wrong-size-swap"(x,2): size(*x) == 4;
+}
+SwapLongs(x,count) : noescape {
+    "wrong-size-swap"(x,4): size(x) == 4;
+}
+SwapShorts(x,count) : noescape {
+    "wrong-size-swap"(x,2): size(x) == 4;
+}
+
+/* dix/pixmap.c */
+AllocatePixmap(const pScreen, pixDataSize) : noescape {
+    if (result != 0) {
+        result == new(pixDataSize);
+    }
+}
+FreePixmap(p) : free(p);
+
+/* dix/region.c */
+RegionCreate(const rect, s) {
+    result == new(12); /* sizeof struct pixman_region16 */
+}
+RegionDestroy(p) : free(p);
+
+/* fb/fbpixmap.c */
+fbCreatePixmapBpp(const pS, w, h, d, b, ht) {
+    if (result != 0) {
+        result == new(w*h);
+    }
+}
+fbCreatePixmap(const pS, w, h, d, ht) : fbCreatePixmapBpp(pS, w, h, d, d, ht);
+fbDestroyPixmap(p) : FreePixmap(p);
+                 
+/* os/log.c: logging functions */
+LogWrite(verb, const fmt, args...) : printf(fmt, args), noescape;
+LogMessageVerb(type, verb, const fmt, args...) : printf(fmt, args), noescape;
+LogMessage(type, const fmt, args...) : printf(fmt, args), noescape;
+FatalError(const fmt, args...) : printf(fmt, args), noescape, exit;
+ErrorF(const fmt, args...) : printf(fmt, args), noescape;
+AbortServer(): exit;
+
+/* os/utils.c: allocation & other helpers */
+Xalloc(s) : malloc(s);
+XNFalloc(s) {
+    result == new(s);
+}
+Xcalloc(s) : calloc(1,s);
+XNFcalloc(s) : XNFalloc(s);
+Xrealloc(p, s) : realloc(p, s);
+XNFrealloc(p, s) : realloc(p, s);
+Xfree(p) : free(p);
+Xstrdup(const s) : noescape {
+    if ( s == 0 ) {
+        result == 0;
+    } else {
+        if( result != 0 ) {
+            result == new(strlen(s)+1);
+            strlen(result) == strlen(s);
+        }
+    }
+}
+XNFstrdup(const s) : noescape {
+    if ( s == 0 ) {
+        result == 0;
+    } else {
+        result == new(strlen(s)+1);
+        strlen(result) == strlen(s);
+    }
+}
+OsAbort() : abort();
+Fopen(f, m) : fopen(f, m);
+Fclose(p) : fclose(p);
+          
+/* os/xprintf.c: allocating printf wrappers/variants */
+Xvasprintf(p, fmt, va) : vasprintf(p, fmt, va);
+Xasprintf(p, fmt, args...) : asprintf(p, fmt, args);
+XNFvasprintf(p, fmt, va) : noescape {
+    *p == new(result);
+}
+XNFasprintf(p, fmt, args...) : noescape, printf(fmt, args) {
+    *p == new(result);
+}
+Xvprintf(fmt, va) : noescape {
+    if (result != 0) {
+        result == new(undefined);
+    }
+}
+Xprintf(fmt, args...) : noescape, printf(fmt, args) {
+    if (result != 0) {
+        result == new(undefined);
+    }
+}
+XNFvprintf(fmt, va) : noescape {
+    result == new(undefined);
+}
+XNFprintf(fmt, args...) : noescape, printf(fmt, args) {
+    result == new(undefined);
+}
--- a/open-src/lib/libdrm/Makefile	Wed May 30 13:19:01 2012 -0700
+++ b/open-src/lib/libdrm/Makefile	Fri Jun 01 15:11:02 2012 -0700
@@ -48,8 +48,14 @@
 GIT_URL_SET=yes
 
 # Patches to apply to source after unpacking, in order
-SOURCE_PATCHES = \
-	solaris-drm-port.patch atomic.patch
+SOURCE_PATCHES += solaris-drm-port.patch,-p1
+SOURCE_PATCHES += atomic.patch
+
+# Can't build tests with parfait yet, due to parfait-ld error:
+# llvm-ld: error: Cannot link file '../../libkms/libkms.so.1.bc: 
+#    Linking globals named 'drmSetServerInfo': symbol multiply defined!
+$(WITH_PARFAIT) SOURCE_PATCHES += no-tests.patch,-p1
+$(WITH_PARFAIT) AUTORECONF = yes
 
 # Need to use GNU Make to build
 MODULE_MAKE=$(GNUMAKE)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/lib/libdrm/no-tests.patch	Fri Jun 01 15:11:02 2012 -0700
@@ -0,0 +1,15 @@
+Disable build of tests subdirectory, needed when using parfait
+
+diff --git a/Makefile.am b/Makefile.am
+index a4d07f4..bfebfa2 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -41,7 +41,7 @@ if HAVE_RADEON
+ RADEON_SUBDIR = radeon
+ endif
+ 
+-SUBDIRS = . $(LIBKMS_SUBDIR) $(INTEL_SUBDIR) $(NOUVEAU_SUBDIR) $(RADEON_SUBDIR) tests include
++SUBDIRS = . $(LIBKMS_SUBDIR) $(INTEL_SUBDIR) $(NOUVEAU_SUBDIR) $(RADEON_SUBDIR) include
+ 
+ libdrm_la_LTLIBRARIES = libdrm.la
+ libdrm_ladir = $(libdir)
--- a/open-src/lib/libdrm/solaris-drm-port.patch	Wed May 30 13:19:01 2012 -0700
+++ b/open-src/lib/libdrm/solaris-drm-port.patch	Fri Jun 01 15:11:02 2012 -0700
@@ -25,9 +25,10 @@
 # or other dealings in this Software without prior written authorization
 # of the copyright holder.
 
-diff -urp -x '*~' -x '*.orig' include/drm/drm.h include/drm/drm.h
---- include/drm/drm.h	2010-06-06 18:11:46.000000000 -0700
-+++ include/drm/drm.h	2011-01-24 19:15:45.548418714 -0800
+diff --git a/include/drm/drm.h b/include/drm/drm.h
+index 8adb9d5..f9bedd0 100644
+--- a/include/drm/drm.h
++++ b/include/drm/drm.h
 @@ -54,10 +54,39 @@ typedef int32_t  __s32;
  typedef uint32_t __u32;
  typedef int64_t  __s64;
@@ -115,17 +116,18 @@
  	unsigned long agp_start; /**<
  				  * Start address of where the AGP buffers are
  				  * in the AGP aperture
-@@ -375,6 +409,7 @@ struct drm_buf_map {
- 	int count;		/**< Length of the buffer list */
+@@ -379,6 +413,7 @@ struct drm_buf_map {
  	void *virtual;		/**< Mmap'd area in user-virtual */
+ #endif
  	struct drm_buf_pub *list;	/**< Buffer information */
 +	int fd;
  };
  
  /**
-diff -urp -x '*~' -x '*.orig' include/drm/i915_drm.h include/drm/i915_drm.h
---- include/drm/i915_drm.h	2010-06-07 16:33:16.000000000 -0700
-+++ include/drm/i915_drm.h	2011-01-24 19:15:45.548058832 -0800
+diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
+index af3ce17..96d391d 100644
+--- a/include/drm/i915_drm.h
++++ b/include/drm/i915_drm.h
 @@ -75,6 +75,7 @@ typedef struct _drm_i915_sarea {
  	int pf_current_page;	/* which buffer is being displayed? */
  	int perf_boxes;		/* performance boxes to be displayed */
@@ -143,51 +145,10 @@
  	/* fill out some space for old userspace triple buffer */
  	drm_handle_t unused_handle;
  	__u32 unused1, unused2, unused3;
-diff -urp -x '*~' -x '*.orig' libkms/intel.c libkms/intel.c
---- libkms/intel.c	2010-06-06 18:11:46.000000000 -0700
-+++ libkms/intel.c	2011-01-24 19:15:45.549160465 -0800
-@@ -37,6 +37,7 @@
- 
- #include <sys/mman.h>
- #include <sys/ioctl.h>
-+#include <unistd.h>
- #include "xf86drm.h"
- 
- #include "i915_drm.h"
-@@ -190,6 +191,30 @@ intel_bo_unmap(struct kms_bo *_bo)
- 	return 0;
- }
- 
-+int
-+drmIoctl(int fd, unsigned long request, void *arg)
-+{
-+    int ret;
-+
-+    do {
-+        ret = ioctl(fd, request, arg);
-+    } while (ret == -1 && (errno == EINTR || errno == EAGAIN));
-+    return ret;
-+}
-+
-+int drmCommandWriteRead(int fd, unsigned long drmCommandIndex, void *data,
-+                        unsigned long size)
-+{
-+    unsigned long request;
-+
-+    request = DRM_IOC( DRM_IOC_READ|DRM_IOC_WRITE, DRM_IOCTL_BASE,
-+        DRM_COMMAND_BASE + drmCommandIndex, size);
-+
-+    if (drmIoctl(fd, request, data))
-+        return -errno;
-+    return 0;
-+}
-+
- static int
- intel_bo_destroy(struct kms_bo *_bo)
- {
-diff -urp -x '*~' -x '*.orig' libkms/linux.c libkms/linux.c
---- libkms/linux.c	2010-06-06 18:11:46.000000000 -0700
-+++ libkms/linux.c	2011-01-24 19:15:45.548957995 -0800
+diff --git a/libkms/linux.c b/libkms/linux.c
+index fc4f205..5d66fc7 100644
+--- a/libkms/linux.c
++++ b/libkms/linux.c
 @@ -39,6 +39,7 @@
  #include <unistd.h>
  
@@ -196,10 +157,24 @@
  
  #include "internal.h"
  
-diff -urp -x '*~' -x '*.orig' xf86drm.h xf86drm.h
---- xf86drm.h	2010-06-06 18:11:46.000000000 -0700
-+++ xf86drm.h	2011-01-24 19:15:45.547758484 -0800
-@@ -451,6 +451,17 @@ do {	register unsigned int __old __asm("
+diff --git a/xf86drm.c b/xf86drm.c
+index 6ea068f..67e29a0 100644
+--- a/xf86drm.c
++++ b/xf86drm.c
+@@ -984,7 +984,7 @@ int drmRmMap(int fd, drm_handle_t handle)
+ {
+     drm_map_t map;
+ 
+-    map.handle = (void *)(uintptr_t)handle;
++    map.handle = (drm_handle_t)(uintptr_t)handle;
+ 
+     if(drmIoctl(fd, DRM_IOCTL_RM_MAP, &map))
+ 	return -errno;
+diff --git a/xf86drm.h b/xf86drm.h
+index 76eb94e..6a14120 100644
+--- a/xf86drm.h
++++ b/xf86drm.h
+@@ -458,6 +458,17 @@ do {	register unsigned int __old __asm("o0");		\
  #endif /* architecture */
  #endif /* __GNUC__ >= 2 */
  
@@ -217,10 +192,11 @@
  #ifndef DRM_CAS
  #define DRM_CAS(lock,old,new,ret) do { ret=1; } while (0) /* FAST LOCK FAILS */
  #endif
-diff -urp -x '*~' -x '*.orig' xf86drmMode.c xf86drmMode.c
---- xf86drmMode.c	2010-06-06 18:11:45.000000000 -0700
-+++ xf86drmMode.c	2011-01-24 19:15:45.548770835 -0800
-@@ -708,7 +708,9 @@ int drmCheckModesettingSupported(const c
+diff --git a/xf86drmMode.c b/xf86drmMode.c
+index c809c44..715f23a 100644
+--- a/xf86drmMode.c
++++ b/xf86drmMode.c
+@@ -737,7 +737,9 @@ int drmCheckModesettingSupported(const char *busid)
  	if (found)
  		return 0;
  #endif
@@ -230,15 +206,4 @@
 +	return 0;
  
  }
-
---- xf86drm.c	Mon Dec  5 12:57:15 2011
-+++ xf86drm.c	Mon Dec  5 13:03:00 2011
-@@ -984,7 +984,7 @@
- {
-     drm_map_t map;
  
--    map.handle = (void *)(uintptr_t)handle;
-+    map.handle = (drm_handle_t)(uintptr_t)handle;
- 
-     if(drmIoctl(fd, DRM_IOCTL_RM_MAP, &map))
- 	return -errno;
--- a/open-src/util/build-tools/xmake	Wed May 30 13:19:01 2012 -0700
+++ b/open-src/util/build-tools/xmake	Fri Jun 01 15:11:02 2012 -0700
@@ -1,7 +1,7 @@
 #! /usr/perl5/bin/perl -w
 
 #
-# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -32,10 +32,37 @@
 use English qw( -nomatchvars );
 use POSIX qw(uname);
 
+my @pass_args;   # arguments to pass on to the make we call
 my $verbose = 0;
-if ((scalar(@ARGV) > 0) && ($ARGV[0] eq '-v')) {
-  shift @ARGV;
-  $verbose = 1;
+my $silent = 0;
+my $max_jobs;
+
+for (my $i = 0; $i <= $#ARGV; $i++ ) {
+  if ($ARGV[$i] eq '-s') {
+    $silent = 1;
+    $verbose = 0;
+    goto pass_to_make;
+  }
+  elsif ($ARGV[$i] eq '-v') {
+    $verbose = 1;
+    next;
+  }
+
+  if ($i < $#ARGV) { # more than one arg left
+    if ($ARGV[$i] eq '-j') {
+      $max_jobs = $ARGV[++$i];
+      next;
+    }
+    if ($ARGV[$i] eq '-C') {
+      chdir($ARGV[++$i])
+          or die "$0: Can't chdir $ARGV[$i]: $OS_ERROR";
+      next;
+    }
+  }
+
+ pass_to_make:
+  # not used, pass to make command
+  push @pass_args, $ARGV[$i];
 }
 
 my @makeargs = ();
@@ -94,16 +121,6 @@
   setenv_default('DMAKE_MODE', 'parallel');
   setenv_default('DMAKE_OUTPUT_MODE', 'TXT2');
 
-  my $max_jobs;
-
-  foreach my $i ( 0..($#ARGV - 1) ) {
-    if ($ARGV[$i] eq '-j') {
-      $max_jobs = $ARGV[$i+1];
-      $ARGV[$i] = '';
-      $ARGV[$i+1] = '';
-    }
-  }
-
   if (!defined($max_jobs) && exists $ENV{'DMAKE_MAX_JOBS'}) {
     $max_jobs = $ENV{'DMAKE_MAX_JOBS'};
   }
@@ -160,12 +177,14 @@
 
 # if in top two levels, just run make
 if ($osdepth >= ($#dirtree - 2)) {
-  print join(' ', $make_cmd, @makeargs, @ARGV), "\n";
-  exec_verbose($make_cmd, @makeargs, @ARGV);
+  if ($silent == 0) {
+    print join(' ', $make_cmd, @makeargs, @pass_args), "\n";
+  }
+  exec_verbose($make_cmd, @makeargs, @pass_args);
 }
 
 my $subdir_target = 'build-in-subdir';
-for my $f (@ARGV) {
+for my $f (@pass_args) {
   if ($f =~ m{^install}ms) {
     $subdir_target = 'install-in-subdir';
   }
@@ -175,11 +194,13 @@
 my $moduledir = File::Spec->catdir( @dirtree[0..($osdepth+2)] );
 
 push @makeargs, $subdir_target, qq{subdir='$startdir'};
-if (scalar(@ARGV) > 0) {
-  push @makeargs, join(q{ }, q{subdir_cmd=}, @ARGV);
+if (scalar(@pass_args) > 0) {
+  push @makeargs, join(q{ }, q{subdir_cmd=}, @pass_args);
 }
 
-print join(' ', "(cd $moduledir ;\\\n", $make_cmd, @makeargs), ")\n";
+if ($silent == 0) {
+  print join(' ', "(cd $moduledir ;\\\n", $make_cmd, @makeargs), ")\n";
+}
 chdir $moduledir
   or die "$0: Can't chdir $moduledir: $OS_ERROR";
 exec_verbose($make_cmd, @makeargs);
--- a/open-src/util/imake/Makefile	Wed May 30 13:19:01 2012 -0700
+++ b/open-src/util/imake/Makefile	Fri Jun 01 15:11:02 2012 -0700
@@ -54,6 +54,9 @@
 # Compatibility links from /usr/X11/bin to /usr/bin
 MODULE_X11_BINCOMPAT_LINKS = imake xmkmf mkdirhier
 
+# Workaround Parfait 0.5.0.1 bug 14139420
+MODULE_BUILD_ENV += PARFAIT_CLANG=0
+
 ### Include common rulesets
 include ../Makefile.inc
 
--- a/open-src/xserver/Makefile.inc	Wed May 30 13:19:01 2012 -0700
+++ b/open-src/xserver/Makefile.inc	Fri Jun 01 15:11:02 2012 -0700
@@ -1,6 +1,6 @@
 # -*- Makefile -*- rules common to all xserver build trees
 #
-# Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -67,6 +67,9 @@
 	--with-default-xkb-model=pc105 \
 	$(ADDITIONAL_CONFIG_OPTS)
 
+# Xorg's unit tests don't build correctly with parfait yet
+$(WITH_PARFAIT) XSERVER_CONFIG_OPTS_COMMON += --disable-unit-tests
+
 XSERVER_CONFIG_OPTS_sparc=$(XSERVER_CONFIG_OPTS_COMMON)
 XSERVER_CONFIG_OPTS_i386=$(XSERVER_CONFIG_OPTS_COMMON)
 XSERVER_CONFIG_OPTS=$(XSERVER_CONFIG_OPTS_$(MACH))
--- a/open-src/xserver/xvnc/Makefile	Wed May 30 13:19:01 2012 -0700
+++ b/open-src/xserver/xvnc/Makefile	Fri Jun 01 15:11:02 2012 -0700
@@ -185,6 +185,9 @@
 # The X server unit tests currently depend on the Xorg ddx being built
 XVNC_CONFIG_OPTS += --disable-unit-tests
 
+# Workaround libtool dropping -R paths
+MODULE_LDFLAGS += -Wl,-R,$(X11_SERVERLIBS_DIR)$(ARCHLIBSUBDIR)
+
 MODULE_CPPFLAGS = \
 	-D_XOPEN_SOURCE=500 -D__EXTENSIONS__ \
 	-D__extension__=\"\" \
--- a/open-src/xserver/xvnc/solaris-port.patch	Wed May 30 13:19:01 2012 -0700
+++ b/open-src/xserver/xvnc/solaris-port.patch	Fri Jun 01 15:11:02 2012 -0700
@@ -62,7 +62,7 @@
         "xsetroot -solid grey\n".
         "xterm -geometry 80x24+10+10 -ls -title \"\$VNCDESKTOP Desktop\" &\n".
 diff --git a/unix/xserver/hw/vnc/Makefile.am b/unix/xserver/hw/vnc/Makefile.am
-index 80e93e5..33e2d50 100644
+index 8c49429..50b03e5 100644
 --- a/unix/xserver/hw/vnc/Makefile.am
 +++ b/unix/xserver/hw/vnc/Makefile.am
 @@ -17,7 +17,7 @@ libvnccommon_la_SOURCES = $(HDRS) vncExtInit.cc vncHooks.cc XserverDesktop.cc \
@@ -74,7 +74,7 @@
  
  bin_PROGRAMS = Xvnc
  
-@@ -33,10 +33,17 @@ Xvnc_CPPFLAGS = $(XVNC_CPPFLAGS) -DTIGERVNC -DNO_HW_ONLY_EXTS -DNO_MODULE_EXTS \
+@@ -33,13 +33,21 @@ Xvnc_CPPFLAGS = $(XVNC_CPPFLAGS) -DTIGERVNC -DNO_HW_ONLY_EXTS -DNO_MODULE_EXTS \
  	-UHAVE_CONFIG_H \
  	-DXFree86Server -DVENDOR_RELEASE="$(VENDOR_RELEASE)" \
  	-DVENDOR_STRING="\"$(VENDOR_STRING)\"" -I$(TIGERVNC_SRCDIR)/common \
@@ -94,7 +94,11 @@
  
  Xvnc_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
  
-@@ -49,7 +56,7 @@ libvnc_la_CPPFLAGS = $(XVNC_CPPFLAGS) -I$(TIGERVNC_SRCDIR)/common -UHAVE_CONFIG_
++if XORG
+ libvnc_la_LTLIBRARIES = libvnc.la
+ libvnc_ladir = $(moduledir)/extensions
+ 
+@@ -49,11 +57,12 @@ libvnc_la_CPPFLAGS = $(XVNC_CPPFLAGS) -I$(TIGERVNC_SRCDIR)/common -UHAVE_CONFIG_
  	-I$(top_srcdir)/hw/xfree86/common \
  	-I$(top_srcdir)/hw/xfree86/os-support \
  	-I$(top_srcdir)/hw/xfree86/os-support/bus \
@@ -103,7 +107,12 @@
  
  libvnc_la_LDFLAGS = -module -avoid-version
  
-@@ -63,8 +70,8 @@ BUILT_SOURCES = $(nodist_Xvnc_SOURCES)
+ libvnc_la_LIBADD = libvnccommon.la $(COMMON_LIBS)
++endif
+ 
+ EXTRA_DIST = Xvnc.man
+ 
+@@ -63,8 +72,8 @@ BUILT_SOURCES = $(nodist_Xvnc_SOURCES)
  fb.h: $(top_srcdir)/fb/fb.h
  	cat $(top_srcdir)/fb/fb.h | sed -e 's,and,c_and,g' -e 's,xor,c_xor,g' > $(srcdir)/fb.h