Hi, 
As  you may know, when we packaging rpms in Fedora, we try remove
sources bundle. 
I done with X11, removing src/VBox/Additions/x11/x11include and
src/VBox/Additions/x11/x11stubs
I don't want that you do that upstream, but I had to modify some source
vboxmouse.c, fakedri_drv.c and VBoxGuestR3LibRuntimeXF86.cpp
This VBoxGuestR3LibRuntimeXF86 have thing from old xfree86 4.3 ! which
may have about 10 years.
fakedri_drv.c also use many old sources and would be cool if I see some
improvements on that code.

Thanks,

You may use it, I give my permission. I though I had sign "Contributor's
Agreement". 
I give Oracle permission to use my contribution under licenses other
than the main VirtualBox license.
-- 
Sérgio M. B.
Build the X.Org driver only for the selected system X Server version.
Based on scripts by Michael Meskes <[email protected]>, Felix Geyer <[email protected]>
Author: Sérgio Basto <[email protected]>

--- ./Config.kmk	2012-03-13 13:14:01.000000000 +0000
+++ ./Config.kmk	2012-03-27 23:55:28.070630137 +0100
@@ -2003,15 +2003,7 @@ ifdef VBOX_WITH_CROGL
  endif
 
  if1of ($(KBUILD_TARGET), freebsd linux solaris)
- # VBOX_PATH_MESA_SOURCE = $(PATH_ROOT)/src/libs/mesa-7.2
-  VBOX_PATH_MESA_SOURCE = $(VBOX_PATH_X11_ROOT)/mesa-7.2
-  VBOX_MESA_INCS = \
-        $(VBOX_PATH_MESA_SOURCE) \
-        $(VBOX_PATH_MESA_SOURCE)/include \
-        $(VBOX_PATH_MESA_SOURCE)/src/mesa/ \
-        $(VBOX_PATH_MESA_SOURCE)/src/mesa/glapi \
-        $(VBOX_PATH_MESA_SOURCE)/src/mesa/main \
-        $(VBOX_PATH_MESA_SOURCE)/src/mesa/drivers/dri/common
+  VBOX_MESA_INCS = /usr/include/GL /usr/include/xorg /usr/include/pixman-1
  endif
 
  VBOX_DARWIN_OPENGL_INST     = obj/VBoxOGL/GL/
--- ./src/VBox/Additions/x11/vboxmouse/Makefile.kmk.xorg17	2012-08-03 13:28:42.000000000 +0100
+++ ./src/VBox/Additions/x11/vboxmouse/Makefile.kmk	2012-09-07 03:18:17.460463185 +0100
@@ -30,25 +30,12 @@ if1of ($(KBUILD_TARGET), linux)
  # This one has to be defined when building server code on systems where
  # unsigned long is 64bits
  vboxmouse_drv_DEFS.amd64 += _XSERVER64
- vboxmouse_drv_DEFS += \
-        _POSIX_C_SOURCE=199309L _POSIX_SOURCE _XOPEN_SOURCE \
-	_BSD_SOURCE _SVID_SOURCE _GNU_SOURCE SHAPE XINPUT XKB LBX XAPPGROUP \
-	XCSECURITY TOGCUP XF86BIGFONT DPMSExtension PIXPRIV PANORAMIX RENDER \
-	GCCUSESGAS AVOID_GLYPHBLT PIXPRIV SINGLEDEPTH XFreeXDGA XvExtension \
-	XFree86LOADER XFree86Server XF86VIDMODE XvMCExtension SMART_SCHEDULE \
-	BUILDDEBUG X_BYTE_ORDER=X_LITTLE_ENDIAN DNDEBUG FUNCPROTO=15 NARROWPROTO \
-	IN_MODULE XFree86Module PNP_MOUSE IN_XF86_MODULE
- vboxmouse_drv_INCS := \
-	$(VBOX_PATH_X11_XFREE_4_3)/include \
-	$(VBOX_PATH_X11_XFREE_4_3)/include/extensions \
-	$(VBOX_PATH_X11_XFREE_4_3)/include/X11 \
-	$(VBOX_PATH_X11_XFREE_4_3)/programs/Xserver/hw/xfree86 \
-	$(VBOX_PATH_X11_XFREE_4_3)/programs/Xserver/hw/xfree86/common \
-	$(VBOX_PATH_X11_XFREE_4_3)/programs/Xserver/hw/xfree86/os-support \
-	$(VBOX_PATH_X11_XFREE_4_3)/programs/Xserver/hw/xfree86/os-support/bus \
-	$(VBOX_PATH_X11_XFREE_4_3)/programs/Xserver/mi \
-	$(VBOX_PATH_X11_XFREE_4_3)/programs/Xserver/include \
-	$(PATH_SUB_CURRENT)
+vboxmouse_drv_DEFS += XFree86Server IN_MODULE XFree86Module XFree86LOADER XINPUT XORG_7X \
+	IN_XF86_MODULE DONT_DEFINE_WRAPPERS NO_ANSIC
+vboxmouse_drv_INCS := \
+   /usr/include/x11 \
+   /usr/include/xorg \
+   /usr/include/pixman-1
  vboxmouse_drv_SOURCES = \
 	vboxmouse.c
  # Any global symbols in the driver object files will be added to XFree86's
@@ -57,9 +44,18 @@ if1of ($(KBUILD_TARGET), linux)
  vboxmouse_drv_POST_CMDS = \
 	objcopy --keep-global-symbol vboxmouseModuleData $(out) $(out)-objcopy$$(NLTAB) \
 	$(MV) -f $(out)-objcopy $(out)
-endif
-
 
+DLLS += vboxmouse_drv_17
+vboxmouse_drv_17_TEMPLATE = VBOXGUESTR3XORGMOD
+vboxmouse_drv_17_DEFS = XFree86Server IN_MODULE XFree86Module XFree86LOADER XINPUT XORG_7X IN_XF86_MODULE \
+		DONT_DEFINE_WRAPPERS NO_ANSIC
+vboxmouse_drv_17_INCS := \
+   /usr/include/x11 \
+   /usr/include/xorg \
+   /usr/include/pixman-1
+vboxmouse_drv_17_SOURCES = \
+   vboxmouse.c 
+else
 #
 # vboxmouse_drv_70
 #
@@ -391,5 +387,7 @@ endif # neq ($(KBUILD_TARGET),linux)
 # endif # ! VBOX_ONLY_ADDITIONS
 endif # VBOX_WITH_TESTCASES
 
+endif # neq ($(KBUILD_TARGET),linux)
+
 include $(FILE_KBUILD_SUB_FOOTER)
 
--- ./src/VBox/Additions/x11/vboxmouse/vboxmouse.c.xorg17	2012-03-13 14:52:26.000000000 +0000
+++ ./src/VBox/Additions/x11/vboxmouse/vboxmouse.c	2012-09-23 00:33:57.939600191 +0100
@@ -52,13 +52,9 @@
 
 #include <xf86Module.h>
 
-#ifdef VBOX_GUESTR3XF86MOD
-# define _X_EXPORT
-#else
-# include <errno.h>
-# include <fcntl.h>
-# include <unistd.h>
-#endif
+#include <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
 
 #include "product-generated.h"
 
--- ./src/VBox/Additions/x11/vboxvideo/Makefile.kmk.xorg17	2012-05-30 11:39:29.000000000 +0100
+++ ./src/VBox/Additions/x11/vboxvideo/Makefile.kmk	2012-09-07 03:24:32.187238932 +0100
@@ -35,45 +35,35 @@ vboxvideo_drv_DEFS.x86 = __i386__
 # This one has to be defined when building server code on systems where
 # unsigned long is 64bits
 vboxvideo_drv_DEFS.amd64 += _XSERVER64
-vboxvideo_drv_DEFS = \
-	_POSIX_C_SOURCE=199309L _POSIX_SOURCE _XOPEN_SOURCE \
-	_BSD_SOURCE _SVID_SOURCE _GNU_SOURCE SHAPE XINPUT XKB LBX XAPPGROUP \
-	XCSECURITY TOGCUP XF86BIGFONT DPMSExtension PIXPRIV PANORAMIX RENDER \
-	GCCUSESGAS AVOID_GLYPHBLT PIXPRIV SINGLEDEPTH XFreeXDGA XvExtension \
-	XFree86LOADER XFree86Server XF86VIDMODE XvMCExtension SMART_SCHEDULE \
-	BUILDDEBUG X_BYTE_ORDER=X_LITTLE_ENDIAN DNDEBUG FUNCPROTO=15 NARROWPROTO \
-	IN_MODULE XFree86Module IN_XF86_MODULE IN_RT_STATIC
-vboxvideo_drv_DEFS += memset=xf86memset memcpy=xf86memcpy
+vboxvideo_drv_DEFS := XFree86Server IN_MODULE XFree86Module XFree86LOADER IN_XF86_MODULE XORG_7X RENDER=1 \
+   IN_RT_STATIC VBOXVIDEO_13 NO_ANSIC PCIACCESS VBOX_NO_LOW_COLOUR VBOX_DRI XSERVER_LIBPCIACCESS XORG_VERSION_CURRENT=101300000
 vboxvideo_drv_INCS = \
-	$(VBOX_PATH_X11_XFREE_4_3)/include \
-	$(VBOX_PATH_X11_XFREE_4_3)/include/X11 \
-	$(VBOX_PATH_X11_XFREE_4_3)/include/X11/extensions \
-	$(VBOX_PATH_X11_XFREE_4_3)/include/extensions \
-	$(VBOX_PATH_X11_XFREE_4_3)/include/fonts \
-	$(VBOX_PATH_X11_XFREE_4_3)/programs/Xserver/afb \
-	$(VBOX_PATH_X11_XFREE_4_3)/programs/Xserver/include \
-	$(VBOX_PATH_X11_XFREE_4_3)/programs/Xserver/fb \
-	$(VBOX_PATH_X11_XFREE_4_3)/programs/Xserver/hw/xfree86 \
-	$(VBOX_PATH_X11_XFREE_4_3)/programs/Xserver/hw/xfree86/common \
-	$(VBOX_PATH_X11_XFREE_4_3)/programs/Xserver/hw/xfree86/ddc \
-	$(VBOX_PATH_X11_XFREE_4_3)/programs/Xserver/hw/xfree86/int10 \
-	$(VBOX_PATH_X11_XFREE_4_3)/programs/Xserver/hw/xfree86/i2c \
-	$(VBOX_PATH_X11_XFREE_4_3)/programs/Xserver/hw/xfree86/os-support \
-	$(VBOX_PATH_X11_XFREE_4_3)/programs/Xserver/hw/xfree86/vbe \
-	$(VBOX_PATH_X11_XFREE_4_3)/programs/Xserver/hw/xfree86/os-support/bus \
-	$(VBOX_PATH_X11_XFREE_4_3)/programs/Xserver/hw/xfree86/rac \
-	$(VBOX_PATH_X11_XFREE_4_3)/programs/Xserver/hw/xfree86/ramdac \
-	$(VBOX_PATH_X11_XFREE_4_3)/programs/Xserver/hw/xfree86/shadowfb \
-	$(VBOX_PATH_X11_XFREE_4_3)/programs/Xserver/hw/xfree86/vgahw \
-	$(VBOX_PATH_X11_XFREE_4_3)/programs/Xserver/hw/xfree86/xf1bpp \
-	$(VBOX_PATH_X11_XFREE_4_3)/programs/Xserver/hw/xfree86/xf24_32bpp \
-	$(VBOX_PATH_X11_XFREE_4_3)/programs/Xserver/hw/xfree86/xf4bpp \
-	$(VBOX_PATH_X11_XFREE_4_3)/programs/Xserver/mfb \
-	$(VBOX_PATH_X11_XFREE_4_3)/programs/Xserver/mi \
-	$(VBOX_PATH_X11_XFREE_4_3)/programs/Xserver/miext/shadow \
-	$(VBOX_PATH_X11_XFREE_4_3)/programs/Xserver/render \
-	$(VBOX_PATH_X11_XFREE_4_3)/programs/Xserver/randr \
-	$(VBOX_PATH_X11_XFREE_4_3)/programs/Xserver/Xext
+   /usr/include/drm \
+   /usr/include/X11/dri \
+   /usr/include/pixman-1 \
+   /usr/share/xorg-x11-server-source \
+   /usr/share/xorg-x11-server-source/fb \
+   /usr/share/xorg-x11-server-source/hw/xfree86/common \
+   /usr/share/xorg-x11-server-source/hw/xfree86/ddc \
+   /usr/share/xorg-x11-server-source/hw/xfree86/dixmods/extmod \
+   /usr/share/xorg-x11-server-source/hw/xfree86/dri \
+   /usr/share/xorg-x11-server-source/hw/xfree86/i2c \
+   /usr/share/xorg-x11-server-source/hw/xfree86/int10 \
+   /usr/share/xorg-x11-server-source/hw/xfree86/modes \
+   /usr/share/xorg-x11-server-source/hw/xfree86/os-support \
+   /usr/share/xorg-x11-server-source/hw/xfree86/os-support/bus \
+   /usr/share/xorg-x11-server-source/hw/xfree86/ramdac \
+   /usr/share/xorg-x11-server-source/hw/xfree86/shadowfb \
+   /usr/share/xorg-x11-server-source/hw/xfree86/vbe \
+   /usr/share/xorg-x11-server-source/hw/xfree86/vgahw \
+   /usr/share/xorg-x11-server-source/hw/xquartz/xpr \
+   /usr/share/xorg-x11-server-source/include \
+   /usr/share/xorg-x11-server-source/mi \
+   /usr/share/xorg-x11-server-source/miext/damage \
+   /usr/share/xorg-x11-server-source/randr \
+   /usr/share/xorg-x11-server-source/Xext \
+   /usr/share/xorg-x11-server-source/render \
+   /usr/share/xorg-x11-server-source/hw/xfree86/parser
 vboxvideo_drv_INCS += $(PATH_ROOT)/src/VBox/Runtime/include
 vboxvideo_drv_SOURCES = \
 	pointer.c \
@@ -86,7 +76,7 @@ vboxvideo_drv_SOURCES = \
 	$(PATH_ROOT)/src/VBox/Additions/common/VBoxVideo/VBVABase.cpp \
 	$(PATH_ROOT)/src/VBox/GuestHost/HGSMI/HGSMICommon.cpp \
 	$(PATH_ROOT)/src/VBox/Runtime/common/alloc/heapsimple.cpp \
-	$(PATH_ROOT)/src/VBox/Runtime/common/alloc/heapoffset.cpp
+	$(PATH_ROOT)/src/VBox/Runtime/common/alloc/heapoffset.cpp edid.c vboxvideo_dri.c
  # Any global symbols in the driver object files will be added to XFree86's
  # symbol table, which can cause problems if we e.g. define a symbol in two
  # modules.
@@ -94,6 +84,44 @@ vboxvideo_drv_SOURCES = \
 	objcopy --keep-global-symbol vboxvideoModuleData $(out) $(out)-objcopy$$(NLTAB) \
 	$(MV) -f $(out)-objcopy $(out)
 
+DLLS += vboxvideo_drv_17
+vboxvideo_drv_17_TEMPLATE = VBOXGUESTR3XORGMOD
+vboxvideo_drv_17_CFLAGS += -Wno-conversion -Wno-unused-parameter $(VBOX_GCC_Wno-variadic-macros) # template?
+vboxvideo_drv_17_DEFS := XFree86Server IN_MODULE XFree86Module XFree86LOADER XORG_7X RENDER=1 \
+	IN_XF86_MODULE IN_RT_STATIC VBOXVIDEO_13 NO_ANSIC PCIACCESS VBOX_NO_LOW_COLOUR VBOX_DRI XSERVER_LIBPCIACCESS XORG_VERSION_CURRENT=101300000
+vboxvideo_drv_17_INCS = \
+	/usr/include/drm \
+	/usr/include/X11/dri \
+	/usr/include/pixman-1 \
+	/usr/share/xorg-x11-server-source \
+	/usr/share/xorg-x11-server-source/fb \
+	/usr/share/xorg-x11-server-source/hw/xfree86/common \
+	/usr/share/xorg-x11-server-source/hw/xfree86/ddc \
+	/usr/share/xorg-x11-server-source/hw/xfree86/dixmods/extmod \
+	/usr/share/xorg-x11-server-source/hw/xfree86/dri \
+	/usr/share/xorg-x11-server-source/hw/xfree86/i2c \
+	/usr/share/xorg-x11-server-source/hw/xfree86/int10 \
+	/usr/share/xorg-x11-server-source/hw/xfree86/modes \
+	/usr/share/xorg-x11-server-source/hw/xfree86/os-support \
+	/usr/share/xorg-x11-server-source/hw/xfree86/os-support/bus \
+	/usr/share/xorg-x11-server-source/hw/xfree86/ramdac \
+	/usr/share/xorg-x11-server-source/hw/xfree86/shadowfb \
+	/usr/share/xorg-x11-server-source/hw/xfree86/vbe \
+	/usr/share/xorg-x11-server-source/hw/xfree86/vgahw \
+	/usr/share/xorg-x11-server-source/hw/xquartz/xpr \
+	/usr/share/xorg-x11-server-source/include \
+	/usr/share/xorg-x11-server-source/mi \
+	/usr/share/xorg-x11-server-source/miext/damage \
+	/usr/share/xorg-x11-server-source/randr \
+	/usr/share/xorg-x11-server-source/Xext \
+	/usr/share/xorg-x11-server-source/render \
+	/usr/share/xorg-x11-server-source/hw/xfree86/parser
+vboxvideo_drv_17_INCS += $(PATH_ROOT)/src/VBox/Runtime/include
+vboxvideo_drv_17_SOURCES = $(vboxvideo_drv_SOURCES)
+
+ifdef NOT_FEDORA
+
+
 #
 # vboxvideo_drv_70
 #
@@ -505,4 +533,6 @@ $$(vboxvideo_drv_112_0_OUTDIR)/tstvboxvi
 # endif # ! VBOX_ONLY_ADDITIONS
 endif # VBOX_WITH_TESTCASES
 
+endif # NOT_FEDORA
+
 include $(FILE_KBUILD_SUB_FOOTER)
--- ./src/VBox/Additions/x11/vboxvideo/testcase/Makefile.kmk	2012-01-12 19:57:53.762613198 +0000
+++ ./src/VBox/Additions/x11/vboxvideo/testcase/Makefile.kmk	2012-01-12 20:01:17.296596446 +0000
@@ -36,11 +36,11 @@ endif # !VBOX_ONLY_SDK
 #
 tstSetModeXOrg_TEMPLATE = VBOXR3TSTEXE
 tstSetModeXOrg_CFLAGS += -std=c99
-tstSetModeXOrg_DEFS = $(filter-out IN_RT_STATIC,$(vboxvideo_drv_15_DEFS)) TESTCASE
+tstSetModeXOrg_DEFS = $(filter-out IN_RT_STATIC,$(vboxvideo_drv_17_DEFS)) TESTCASE
 tstSetModeXOrg_SOURCES  = \
 	tstSetModeXOrg.c \
 	../setmode.c
-tstSetModeXOrg_INCS = $(vboxvideo_drv_15_INCS)
+tstSetModeXOrg_INCS = $(vboxvideo_drv_17_INCS)
 
 
 # generate rules.
fakedri_drv.c,h:
Just compile with X11 system source and we may remove bundle X11 source code.

--- ./src/VBox/Additions/x11/Makefile.kmk.orig	2012-09-23 01:00:38.301286632 +0100
+++ ./src/VBox/Additions/x11/Makefile.kmk	2012-09-23 01:00:45.135370696 +0100
@@ -24,7 +24,6 @@ if1of ($(KBUILD_TARGET), freebsd linux n
  ifneq ($(KBUILD_TARGET), solaris)
   include $(PATH_SUB_CURRENT)/vboxmouse/Makefile.kmk
  endif
- include $(PATH_SUB_CURRENT)/x11stubs/Makefile.kmk
 endif
 
 include $(FILE_KBUILD_SUB_FOOTER)
--- ./src/VBox/Additions/common/crOpenGL/Makefile.kmk.mesa	2012-09-13 09:26:18.000000000 +0100
+++ ./src/VBox/Additions/common/crOpenGL/Makefile.kmk	2012-09-23 01:08:36.032101751 +0100
@@ -63,18 +63,12 @@ VBoxOGL_TEMPLATE       = VBOXCROGLR3GUES
 VBoxOGL_INCS           = .
 if1of ($(KBUILD_TARGET), linux solaris freebsd)
  VBoxOGL_INCS     += \
-	$(VBOX_PATH_X11_ROOT)/libXdamage-1.1 \
-	$(VBOX_PATH_X11_ROOT)/libXcomposite-0.4.0 \
-	$(VBOX_PATH_X11_ROOT)/libXext-1.3.1 \
-	$(VBOX_PATH_X11_ROOT)/libXfixes-4.0.3 \
-	$(VBOX_PATH_X11_ROOT)/damageproto-1.1.0 \
-	$(VBOX_PATH_X11_ROOT)/compositeproto-0.4 \
-	$(VBOX_PATH_X11_ROOT)/fixesproto-4.0 \
-	$(VBOX_PATH_X11_ROOT)/libx11-1.1.5-other \
-	$(VBOX_PATH_X11_ROOT)/xextproto-7.1.1 \
-	$(VBOX_PATH_X11_ROOT)/xproto-7.0.18 \
+	/usr/include/x11 \
+	/usr/include/xorg \
+	/usr/include/pixman-1 \
 	$(VBOX_MESA_INCS) \
-	$(PATH_ROOT)/src/VBox/Additions/x11/x11include/libdrm-2.4.13
+	/usr/include/drm \
+	/usr/include/libdrm
  VBoxOGL_DEFS     += VBOX_NO_NATIVEGL
 endif
 
@@ -203,11 +197,6 @@ VBoxOGL_LIBS = \
 	$(VBOX_LIB_OGL_CRUTIL) \
 	$(PATH_STAGE_LIB)/additions/VBoxOGLspuload$(VBOX_SUFF_LIB)
 if1of ($(KBUILD_TARGET), linux solaris freebsd)
- VBoxOGL_LIBS += \
- 	$(PATH_STAGE_LIB)/libXcomposite.so \
- 	$(PATH_STAGE_LIB)/libXdamage.so \
- 	$(PATH_STAGE_LIB)/libXfixes.so \
- 	$(PATH_STAGE_LIB)/libXext.so
  ifdef VBoxOGL_FAKEDRI
   VBoxOGL_LIBS += \
   	dl
--- ./src/VBox/Additions/common/crOpenGL/fakedri_drv.c.mesa	2012-09-13 09:26:18.000000000 +0100
+++ ./src/VBox/Additions/common/crOpenGL/fakedri_drv.c	2012-09-14 23:53:17.013381550 +0100
@@ -17,7 +17,15 @@
  */
 
 #define _GNU_SOURCE 1
+#define HAVE_STRNDUP 1
 
+#include <dlfcn.h>
+#include <elf.h>
+#include <unistd.h>
+#include <xf86.h>
+#include <xf86drm.h>
+#include <GL/gl.h>
+#include <GL/glext.h>
 #include "cr_error.h"
 #include "cr_gl.h"
 #include "cr_mem.h"
@@ -26,23 +34,6 @@
 #include "dri_glx.h"
 #include "iprt/mem.h"
 #include "iprt/err.h"
-#include <dlfcn.h>
-#include <elf.h>
-#include <unistd.h>
-/** X server message type definitions. */
-typedef enum {
-    X_PROBED,			/* Value was probed */
-    X_CONFIG,			/* Value was given in the config file */
-    X_DEFAULT,			/* Value is a default */
-    X_CMDLINE,			/* Value was given on the command line */
-    X_NOTICE,			/* Notice */
-    X_ERROR,			/* Error message */
-    X_WARNING,			/* Warning message */
-    X_INFO,			/* Informational message */
-    X_NONE,			/* No prefix */
-    X_NOT_IMPLEMENTED,		/* Not implemented */
-    X_UNKNOWN = -1		/* unknown -- this must always be last */
-} MessageType;
 
 #define VBOX_NO_MESA_PATCH_REPORTS
 
@@ -104,8 +108,53 @@ static const __DRIswrastExtension *gpSwD
 
 extern const __DRIextension * __driDriverExtensions[];
 
+//copy from /usr/share/xorg-x11-server-source/glx/dispatch.h
+#define SET_by_offset(disp, offset, fn) \
+    do { \
+        if ( (offset) < 0 ) { \
+            /* fprintf( stderr, "[%s:%u] SET_by_offset(%p, %d, %s)!\n", */ \
+            /*         __func__, __LINE__, disp, offset, # fn); */ \
+            /* abort(); */ \
+        } \
+        else { \
+            ( (_glapi_proc *) (disp) )[offset] = (_glapi_proc) fn; \
+        } \
+    } while(0)
+
+// copy from glx/glapi.c
+
+/**
+ * Search the table of static entrypoint functions for the named function
+ * and return the corresponding glprocs_table_t entry.
+ */
+static const glprocs_table_t * find_entry( const char * n )
+{
+   GLuint i;
+   for (i = 0; static_functions[i].Name_offset >= 0; i++) {
+      const char *testName = gl_string_table + static_functions[i].Name_offset;
+      if (strcmp(testName, n) == 0) {
+         return &static_functions[i];
+      }
+   }
+   return NULL;
+}
+
+/**
+ * Return dispatch table offset of the named static (built-in) function.
+ * Return -1 if function not found.
+ */
+static GLint
+get_static_proc_offset(const char *funcName)
+{
+   const glprocs_table_t * const f = find_entry( funcName );
+   if (f) {
+      return f->Offset;
+   }
+   return -1;
+}
+
 #define VBOX_SET_MESA_FUNC(table, name, func) \
-    if (_glapi_get_proc_offset(name)>=0) SET_by_offset(table, _glapi_get_proc_offset(name), func); \
+    if (get_static_proc_offset(name)>=0) SET_by_offset(table, get_static_proc_offset(name), func); \
     else crWarning("%s not found in mesa table", name)
 
 #define GLAPI_ENTRY(Func) VBOX_SET_MESA_FUNC(vbox_glapi_table, "gl"#Func, cr_gl##Func);
--- ./src/VBox/Additions/common/crOpenGL/fakedri_drv.h	2012-03-13 13:14:21.000000000 +0000
+++ ./src/VBox/Additions/common/crOpenGL/fakedri_drv.h	2012-03-27 23:14:15.058370962 +0100
@@ -20,13 +20,20 @@
 #ifndef ___CROPENGL_FAKEDRIDRV_H
 #define ___CROPENGL_FAKEDRIDRV_H
 
-#include "src/mesa/main/mtypes.h"
-#include "src/mesa/main/dd.h"
-#include "src/mesa/glapi/dispatch.h"
-#include "src/mesa/glapi/glapi.h"
-#include "src/mesa/glapi/glapitable.h"
-#include "src/mesa/glapi/glapioffsets.h"
-#include "src/mesa/drivers/dri/common/dri_util.h"
+//#include "/usr/share/xorg-x11-server-source/glx/glapi.h"
+typedef void (*_glapi_proc)(void); /* generic function pointer */
+
+extern GLuint
+_glapi_get_dispatch_table_size(void);
+
+extern struct _glapi_table *
+_glapi_get_dispatch(void);
+
+extern void
+_glapi_set_dispatch(struct _glapi_table *dispatch);
+
+//#include "/usr/share/xorg-x11-server-source/glx/glapioffsets.h"
+#include "/usr/share/xorg-x11-server-source/glx/glprocs.h"
 #include "GL/internal/dri_interface.h"
 
 #include "glx_proto.h"
VBoxGuestR3LibRuntimeXF86.cpp:
Inspired from http://opensource.apple.com/source/X11server/X11server-85/kdrive/xorg-server-1.6.0/hw/xfree86/dummylib/
xalloc.c and verrorf.c
Author: Sérgio Basto <[email protected]>

--- ./src/VBox/Additions/common/VBoxGuestLib/Makefile.kmk.xorg17	2012-08-03 13:28:42.000000000 +0100
+++ ./src/VBox/Additions/common/VBoxGuestLib/Makefile.kmk	2012-09-09 01:05:45.271905105 +0100
@@ -187,11 +187,9 @@ VBoxGuestR3LibXFree86_SOURCES  = \
 	VBoxGuestR3LibVideo.cpp \
 	VBoxGuestR3LibRuntimeXF86.cpp
 VBoxGuestR3LibXFree86_INCS     = \
-        $(VBOX_PATH_X11_XFREE_4_3)/programs/Xserver/hw/xfree86/common/ \
-        $(VBOX_PATH_X11_XFREE_4_3)/programs/Xserver/hw/xfree86/os-support \
-        $(VBOX_PATH_X11_XFREE_4_3)/programs/Xserver/include \
-        $(VBOX_PATH_X11_XFREE_4_3)/include \
-        $(VBOX_PATH_X11_XFREE_4_3)/exports/include/X11
+        /usr/share/xorg-x11-server-source/hw/xfree86/common/ \
+		/usr/share/xorg-x11-server-source/hw/xfree86/os-support \
+		/usr/share/xorg-x11-server-source/include 
 
 VBoxGuestR3LibRuntimeXF86.cpp_CXXFLAGS = -Wno-shadow
 
--- ./src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibRuntimeXF86.cpp.xorg17	2011-01-14 20:15:34.000000000 +0000
+++ ./src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibRuntimeXF86.cpp	2012-09-09 01:04:03.198818717 +0100
@@ -34,20 +34,55 @@
 #include <iprt/log.h>
 #include <iprt/mem.h>
 #include <iprt/string.h>
+#include <string.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <ctype.h>
 extern "C" {
 # define XFree86LOADER
-# include <xf86_ansic.h>
 # include <errno.h>
 # undef size_t
 }
 
+/** Provide an VErrorF function when used stand-alone. */
+void VErrorF(const char *format, va_list args)
+{
+    vfprintf(stderr, format, args); /* RATS: We assume the format string
+                                     * is trusted, since it is always
+                                     * from a log message in our code. */
+}
+
+/* When using this file as part of a stand-alone (i.e., non-X-Server
+ * program, then the ultimate output routines have to be defined.  */
+
+/** Provide an ErrorF function when used stand-alone. */
+void ErrorF(const char *format, ...)
+{
+    va_list args;
+
+    va_start(args, format);
+    vfprintf(stderr, format, args); /* RATS: We assume the format string
+                                     * is trusted, since it is always
+                                     * from a log message in our code. */
+    va_end(args);
+}
+
+void *xalloc(unsigned long n)
+{
+    if (!n)
+    n = 1;
+    return malloc(n);
+}
+
 /* This is risky as it restricts call to the ANSI format type specifiers. */
 RTDECL(size_t) RTStrPrintf(char *pszBuffer, size_t cchBuffer, const char *pszFormat, ...)
 {
     va_list args;
     int cbRet;
     va_start(args, pszFormat);
-    cbRet = xf86vsnprintf(pszBuffer, cchBuffer, pszFormat, args);
+    cbRet = vsnprintf(pszBuffer, cchBuffer, pszFormat, args);
     va_end(args);
     return cbRet >= 0 ? cbRet : 0;
 }
@@ -55,8 +90,8 @@ RTDECL(size_t) RTStrPrintf(char *pszBuff
 RTDECL(int) RTStrToUInt32Ex(const char *pszValue, char **ppszNext, unsigned uBase, uint32_t *pu32)
 {
     char *pszNext = NULL;
-    xf86errno = 0;
-    unsigned long ul = xf86strtoul(pszValue, &pszNext, uBase);
+    errno = 0;
+    unsigned long ul = strtoul(pszValue, &pszNext, uBase);
     if (ppszNext)
         *ppszNext = pszNext;
     if (RT_UNLIKELY(pszValue == pszNext))
@@ -65,11 +100,11 @@ RTDECL(int) RTStrToUInt32Ex(const char *
         ul = UINT32_MAX;
     if (pu32)
         *pu32 = (uint32_t) ul;
-    if (RT_UNLIKELY(xf86errno == EINVAL))
+    if (RT_UNLIKELY(errno == EINVAL))
         return VERR_INVALID_PARAMETER;
-    if (RT_UNLIKELY(xf86errno == ERANGE))
+    if (RT_UNLIKELY(errno == ERANGE))
         return VWRN_NUMBER_TOO_BIG;
-    if (RT_UNLIKELY(xf86errno))
+    if (RT_UNLIKELY(errno))
         /* RTErrConvertFromErrno() is not available */
         return VERR_UNRESOLVED_ERROR;
     if (RT_UNLIKELY(*pszValue == '-'))
@@ -77,7 +112,7 @@ RTDECL(int) RTStrToUInt32Ex(const char *
     if (RT_UNLIKELY(*pszNext))
     {
         while (*pszNext)
-            if (!xf86isspace(*pszNext))
+            if (!isspace(*pszNext))
                 return VWRN_TRAILING_CHARS;
         return VWRN_TRAILING_SPACES;
     }
@@ -135,6 +170,6 @@ RTDECL(void *)  RTMemTmpAllocTag(size_t
 
 RTDECL(void)    RTMemTmpFree(void *pv)
 {
-    xfree(pv);
+    free(pv);
 }
 
_______________________________________________
vbox-dev mailing list
[email protected]
https://www.virtualbox.org/mailman/listinfo/vbox-dev

Reply via email to