This patch is against the gallium-0.1 branch.

- linux-egl now only builds standalone EGL libs
- linux-dri still builds GL/GLX libs and the EGL on X lib(s).

Disclaimers:
- Only built/tested with i915.
- Have not verified if runtime with EGL on top of X is affected (shouldn't),
but linux-dri builds everything fine (both libGL and libEGL).
- egl test programs work. (sometimes needs a console switch for the render
target to be shown to screen)

Thoughts?

--Dima
From 657861bf207ccaa1bc4229faf2925c20463e376c Mon Sep 17 00:00:00 2001
From: Dima Zavin <[EMAIL PROTECTED]>
Date: Wed, 3 Sep 2008 16:10:19 -0700
Subject: egl: Add a make variable EGL_PLATFORM. EGL will still be built on top of
 X11 by default. Change the linux-egl build work on top of just drm (non-X).

---
 configs/default                          |    7 +++-
 configs/linux-dri                        |    2 +-
 configs/linux-egl                        |   42 ++++++++++--------------
 include/EGL/eglplatform.h                |   14 +++++++-
 progs/egl/Makefile                       |   24 ++++++++------
 src/egl/drivers/dri/egldri.c             |    4 ++
 src/egl/drivers/xdri/egl_xdri.c          |    2 -
 src/egl/main/Makefile                    |   51 +++++++++++++++++++++---------
 src/egl/main/egldriver.c                 |   21 +++++++-----
 src/egl/main/egllog.c                    |    2 +-
 src/egl/main/eglx.c                      |    2 +
 src/gallium/winsys/drm/Makefile.template |    2 +-
 src/gallium/winsys/egl_xlib/Makefile     |    4 --
 13 files changed, 106 insertions(+), 71 deletions(-)

diff --git a/configs/default b/configs/default
index 94582d8..bd85073 100644
--- a/configs/default
+++ b/configs/default
@@ -43,8 +43,9 @@ GL_LIB = GL
 GLU_LIB = GLU
 GLUT_LIB = glut
 GLW_LIB = GLw
 OSMESA_LIB = OSMesa
+EGL_LIB = EGL
 
 
 # Library names (actual file names)
 GL_LIB_NAME = lib$(GL_LIB).so
@@ -72,8 +73,11 @@ PROGRAM_DIRS = demos redbook samples glsl xdemos
 
 # EGL directories
 EGL_DRIVERS_DIRS = demo
 
+# EGL platform, x11 by default. Other possibilities: drm
+EGL_PLATFORM = x11
+
 # Gallium directories and 
 GALLIUM_AUXILIARY_DIRS = draw translate cso_cache pipebuffer tgsi sct rtasm util
 GALLIUM_AUXILIARIES = $(foreach DIR,$(GALLIUM_AUXILIARY_DIRS),$(TOP)/src/gallium/auxiliary/$(DIR)/lib$(DIR).a)
 GALLIUM_DRIVER_DIRS = softpipe i915simple i965simple failover
@@ -88,10 +92,9 @@ OSMESA_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GL_LIB)
 GLU_LIB_DEPS    = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm
 GLUT_LIB_DEPS   = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lX11 -lXmu -lXi -lm
 GLW_LIB_DEPS    = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lXt -lX11
 APP_LIB_DEPS    = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm
-
-
+EGL_APP_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(EGL_LIB) -l$(GL_LIB) -lm
 
 # Installation directories (for make install)
 INSTALL_DIR = /usr/local
 DRI_DRIVER_INSTALL_DIR = /usr/lib/dri
diff --git a/configs/linux-dri b/configs/linux-dri
index d441194..eaa7f82 100644
--- a/configs/linux-dri
+++ b/configs/linux-dri
@@ -22,9 +22,9 @@ ARCH_FLAGS ?=
 DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \
 	-D_BSD_SOURCE -D_GNU_SOURCE \
 	-DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER \
 	-DGLX_DIRECT_RENDERING -DGLX_INDIRECT_RENDERING \
-	-DHAVE_ALIAS -DHAVE_POSIX_MEMALIGN
+	-DHAVE_ALIAS -DHAVE_POSIX_MEMALIGN -D_EGL_PLATFORM_X=1
 
 X11_INCLUDES = -I/usr/X11R6/include
 
 CFLAGS = -Wall -Wmissing-prototypes -std=c99 -ffast-math \
diff --git a/configs/linux-egl b/configs/linux-egl
index e906806..6244854 100644
--- a/configs/linux-egl
+++ b/configs/linux-egl
@@ -1,10 +1,10 @@
 # -*-makefile-*-
-# Configuration for linux-dri: Linux DRI hardware drivers for XFree86 & others
+# Configuration for linux-egl: Linux DRI hardware drivers for EGL on DRM
 
 include $(TOP)/configs/default
 
-CONFIG_NAME = linux-dri
+CONFIG_NAME = linux-egl
 
 # Compiler and flags
 CC = gcc
 CXX = g++
@@ -12,54 +12,48 @@ CXX = g++
 #MKDEP = /usr/X11R6/bin/makedepend
 #MKDEP = gcc -M
 #MKDEP_OPTIONS = -MF depend
 
-OPT_FLAGS  = -O -g
+OPT_FLAGS  = -O2 -g
 PIC_FLAGS  = -fPIC
 
 # Add '-DGLX_USE_TLS' to ARCH_FLAGS to enable TLS support.
 ARCH_FLAGS ?=
 
+# We use EGL straight on top of DRM, no X11.
+EGL_PLATFORM = drm
+
 DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \
 	-D_BSD_SOURCE -D_GNU_SOURCE \
 	-DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER \
-	-DGLX_DIRECT_RENDERING -DGLX_INDIRECT_RENDERING \
-	-DHAVE_ALIAS -DHAVE_POSIX_MEMALIGN
-
-X11_INCLUDES = -I/usr/X11R6/include
+	-DHAVE_ALIAS -DHAVE_POSIX_MEMALIGN -D_EGL_PLATFORM_DRM=1
 
 CFLAGS = -Wall -Wmissing-prototypes -std=c99 -ffast-math \
 	$(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) $(ASM_FLAGS)
 
 CXXFLAGS = -Wall $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES)
 
-
-MESA_ASM_SOURCES = 
+MESA_ASM_SOURCES =
 
 # Library/program dependencies
-EXTRA_LIB_PATH=-L/usr/X11R6/lib
+EXTRA_LIB_PATH =
 
 LIBDRM_CFLAGS = $(shell pkg-config --cflags libdrm)
 LIBDRM_LIB = $(shell pkg-config --libs libdrm)
 DRI_LIB_DEPS  = $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl $(LIBDRM_LIB)
-GL_LIB_DEPS   = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \
-		-lm -lpthread -ldl \
-                $(LIBDRM_LIB)
+GL_LIB_DEPS   = $(EXTRA_LIB_PATH) -lm -lpthread -ldl $(LIBDRM_LIB)
 
+# Directories
+SRC_DIRS := egl gallium mesa gallium/winsys
 
-# This is now 0 by default since it seems to confuse the hell out of people
-# and generate a lot of extra noise on bugzilla.  If you need to build with
-# EGL, do 'make linux-dri USING_EGL=1'
-
-USING_EGL=0
+PROGRAM_DIRS := egl
 
-# Directories
-SRC_DIRS = gallium mesa gallium/winsys glu egl
-PROGRAM_DIRS = egl
+# EGL directories
+EGL_DRIVERS_DIRS = demo dri
 
-DRIVER_DIRS = dri
+DRIVER_DIRS =
 WINDOW_SYSTEM = dri
-GALLIUM_WINSYS_DIRS = egl_drm
+GALLIUM_WINSYS_DIRS = drm
 
 # gamma are missing because they have not been converted to use the new
 # interface.
-DRI_DIRS = intel 
+DRI_DIRS = intel
diff --git a/include/EGL/eglplatform.h b/include/EGL/eglplatform.h
index 02c3b94..3308526 100644
--- a/include/EGL/eglplatform.h
+++ b/include/EGL/eglplatform.h
@@ -69,20 +69,30 @@ typedef HBITMAP NativePixmapType;
 /** END Added for Windows **/
 
 #elif defined(__gnu_linux__)
 
-/** BEGIN Added for X (Mesa) **/
 #ifndef EGLAPI
 #define EGLAPI extern
 #endif
 
+#if defined(_EGL_PLATFORM_X)
+
+/** BEGIN Added for X (Mesa) **/
 #include <X11/Xlib.h>
 typedef Display *NativeDisplayType;
 typedef Window NativeWindowType;
 typedef Pixmap NativePixmapType;
 /** END Added for X (Mesa) **/
 
-#endif
+#else
+
+typedef void* NativeDisplayType;
+typedef void* NativeWindowType;
+typedef void* NativePixmapType;
+
+#endif /* ! _EGL_PLATFORM_X */
+
+#endif /* defined(__gnu_linux__) */
 
 /* EGL 1.2 types, renamed for consistency in EGL 1.3 */
 typedef NativeDisplayType EGLNativeDisplayType;
 typedef NativePixmapType EGLNativePixmapType;
diff --git a/progs/egl/Makefile b/progs/egl/Makefile
index 948d735..be6ed9d 100644
--- a/progs/egl/Makefile
+++ b/progs/egl/Makefile
@@ -14,11 +14,15 @@ PROGRAMS = \
 	demo3 \
 	egltri \
 	eglinfo \
 	eglgears \
-	peglgears \
+	peglgears
+
+ifeq ($(EGL_PLATFORM),x11)
+PROGRAMS += \
 	xeglgears \
 	xegl_tri
+endif
 
 
 .c.o:
 	$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
@@ -28,65 +32,65 @@ PROGRAMS = \
 default: $(PROGRAMS)
 
 
 demo1: demo1.o $(TOP)/$(LIB_DIR)/libEGL.so
-	$(CC) $(CFLAGS) demo1.o -L$(TOP)/$(LIB_DIR) -lEGL $(LIBDRM_LIB) -o $@
+	$(CC) $(CFLAGS) demo1.o -L$(TOP)/$(LIB_DIR) $(LIBDRM_LIB) $(EGL_APP_LIB_DEPS) -o $@
 
 demo1.o: demo1.c $(HEADERS)
 	$(CC) -c $(CFLAGS) -I$(TOP)/include demo1.c
 
 
 demo2: demo2.o $(TOP)/$(LIB_DIR)/libEGL.so
-	$(CC) $(CFLAGS) demo2.o -L$(TOP)/$(LIB_DIR) -lEGL $(LIBDRM_LIB) $(APP_LIB_DEPS) -o $@
+	$(CC) $(CFLAGS) demo2.o -L$(TOP)/$(LIB_DIR) $(LIBDRM_LIB) $(EGL_APP_LIB_DEPS) -o $@
 
 demo2.o: demo2.c $(HEADERS)
 	$(CC) -c $(CFLAGS) -I$(TOP)/include demo2.c
 
 
 demo3: demo3.o $(TOP)/$(LIB_DIR)/libEGL.so
-	$(CC) $(CFLAGS) demo3.o -L$(TOP)/$(LIB_DIR) -lEGL $(LIBDRM_LIB) $(APP_LIB_DEPS) -o $@
+	$(CC) $(CFLAGS) demo3.o -L$(TOP)/$(LIB_DIR) $(LIBDRM_LIB) $(EGL_APP_LIB_DEPS) -o $@
 
 demo3.o: demo3.c $(HEADERS)
 	$(CC) -c $(CFLAGS) -I$(TOP)/include demo3.c
 
 
 egltri: egltri.o $(TOP)/$(LIB_DIR)/libEGL.so
-	$(CC) $(CFLAGS) egltri.o -L$(TOP)/$(LIB_DIR) -lGL -lEGL $(LIBDRM_LIB) -o $@
+	$(CC) $(CFLAGS) egltri.o -L$(TOP)/$(LIB_DIR) $(LIBDRM_LIB) $(EGL_APP_LIB_DEPS) -o $@
 
 egltri.o: egltri.c $(HEADERS)
 	$(CC) -c $(CFLAGS) -I$(TOP)/include egltri.c
 
 
 eglinfo: eglinfo.o $(TOP)/$(LIB_DIR)/libEGL.so
-	$(CC) $(CFLAGS) eglinfo.o -L$(TOP)/$(LIB_DIR) -lGL -lEGL $(LIBDRM_LIB) -o $@
+	$(CC) $(CFLAGS) eglinfo.o -L$(TOP)/$(LIB_DIR) $(LIBDRM_LIB) $(EGL_APP_LIB_DEPS) -o $@
 
 eglinfo.o: eglinfo.c $(HEADERS)
 	$(CC) -c $(CFLAGS) -I$(TOP)/include eglinfo.c
 
 
 eglgears: eglgears.o $(TOP)/$(LIB_DIR)/libEGL.so
-	$(CC) $(CFLAGS) eglgears.o -L$(TOP)/$(LIB_DIR) -lEGL $(LIBDRM_LIB) $(APP_LIB_DEPS) -o $@
+	$(CC) $(CFLAGS) eglgears.o -L$(TOP)/$(LIB_DIR) $(LIBDRM_LIB) $(EGL_APP_LIB_DEPS) -o $@
 
 eglgears.o: eglgears.c $(HEADERS)
 	$(CC) -c $(CFLAGS) -I$(TOP)/include eglgears.c
 
 
 peglgears: peglgears.o $(TOP)/$(LIB_DIR)/libEGL.so
-	$(CC) $(CFLAGS) peglgears.o -L$(TOP)/$(LIB_DIR) -lEGL $(LIBDRM_LIB) $(APP_LIB_DEPS) -o $@
+	$(CC) $(CFLAGS) peglgears.o -L$(TOP)/$(LIB_DIR) $(LIBDRM_LIB) $(EGL_APP_LIB_DEPS) -o $@
 
 peglgears.o: peglgears.c $(HEADERS)
 	$(CC) -c $(CFLAGS) -I$(TOP)/include peglgears.c
 
 
 xeglgears: xeglgears.o $(TOP)/$(LIB_DIR)/libEGL.so
-	$(CC) $(CFLAGS) xeglgears.o -L$(TOP)/$(LIB_DIR) -lEGL $(LIBDRM_LIB) $(APP_LIB_DEPS) -o $@
+	$(CC) $(CFLAGS) xeglgears.o -L$(TOP)/$(LIB_DIR) $(LIBDRM_LIB) $(EGL_APP_LIB_DEPS) -lX11 -lXext -o $@
 
 xeglgears.o: xeglgears.c $(HEADERS)
 	$(CC) -c $(CFLAGS) -I$(TOP)/include xeglgears.c
 
 
 xegl_tri: xegl_tri.o $(TOP)/$(LIB_DIR)/libEGL.so
-	$(CC) $(CFLAGS) xegl_tri.o -L$(TOP)/$(LIB_DIR) -lEGL $(LIBDRM_LIB) $(APP_LIB_DEPS) -o $@
+	$(CC) $(CFLAGS) xegl_tri.o -L$(TOP)/$(LIB_DIR) $(LIBDRM_LIB) $(EGL_APP_LIB_DEPS) -lX11 -lXext -o $@
 
 xegl_tri.o: xegl_tri.c $(HEADERS)
 	$(CC) -c $(CFLAGS) -I$(TOP)/include xegl_tri.c
 
diff --git a/src/egl/drivers/dri/egldri.c b/src/egl/drivers/dri/egldri.c
index 57661cc..b8cd979 100644
--- a/src/egl/drivers/dri/egldri.c
+++ b/src/egl/drivers/dri/egldri.c
@@ -32,8 +32,12 @@
 #include "eglmode.h"
 
 #include "egldri.h"
 
+#ifndef None
+#define None 0L
+#endif
+
 const char *sysfs = "/sys/class";
 
 static const int empty_attribute_list[1] = { None };
 
diff --git a/src/egl/drivers/xdri/egl_xdri.c b/src/egl/drivers/xdri/egl_xdri.c
index bb38513..356e1f2 100644
--- a/src/egl/drivers/xdri/egl_xdri.c
+++ b/src/egl/drivers/xdri/egl_xdri.c
@@ -52,10 +52,8 @@
 #include "glxclient.h"
 #include "dri_util.h"
 #include "drm_sarea.h"
 
-#define _EGL_PLATFORM_X
-
 #include "eglconfig.h"
 #include "eglcontext.h"
 #include "egldisplay.h"
 #include "egldriver.h"
diff --git a/src/egl/main/Makefile b/src/egl/main/Makefile
index 96742bb..5721868 100644
--- a/src/egl/main/Makefile
+++ b/src/egl/main/Makefile
@@ -2,9 +2,8 @@
 
 TOP = ../../..
 include $(TOP)/configs/current
 
-
 INCLUDE_DIRS = -I$(TOP)/include -I$(TOP)/src/mesa/glapi
 
 HEADERS = \
 	eglconfig.h \
@@ -19,10 +18,9 @@ HEADERS = \
 	eglmisc.h \
 	eglmode.h \
 	eglscreen.h \
 	eglstring.h \
-	eglsurface.h \
-	eglx.h
+	eglsurface.h
 
 SOURCES = \
 	eglapi.c \
 	eglconfig.c \
@@ -36,48 +34,71 @@ SOURCES = \
 	eglmisc.c \
 	eglmode.c \
 	eglscreen.c \
 	eglstring.c \
-	eglsurface.c \
-	eglx.c
+	eglsurface.c
 
-OBJECTS = $(SOURCES:.c=.o)
+LOCAL_CFLAGS = -D_REENTRANT -UIN_DRI_DRIVER
+LIBS = -lpthread
 
+ifneq ($(EGL_PLATFORM),x11)
 
-# Undefined for now
-LOCAL_CFLAGS = -D_EGL_PLATFORM_X=1
+include $(TOP)/src/mesa/sources.mak
+MESA_GLAPI_ASM_SOURCES = $(addprefix $(TOP)/src/mesa/, $(GLAPI_ASM_SOURCES))
+MESA_GLAPI_SOURCES = $(addprefix $(TOP)/src/mesa/, $(GLAPI_SOURCES))
+MESA_GLAPI_OBJECTS = $(addprefix $(TOP)/src/mesa/, $(GLAPI_OBJECTS))
+EXTRA_DEPS = $(MESA_GLAPI_SOURCES) $(MESA_GLAPI_ASM_SOURCES)
 
-LIBS = -lX11
+else # EGL_PLATFORM = x11
 
+HEADERS += \
+	eglx.h
+SOURCES += \
+	eglx.c
+
+LIBS += -lX11
+endif # EGL_PLATFORM = x11
+
+OBJECTS = $(SOURCES:.c=.o)
 
 .c.o:
 	$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $(LOCAL_CFLAGS) $< -o $@
 
+.S.o:
+	$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $(LOCAL_CFLAGS)  $< -o $@
 
+default: depend egl_library gl_library
 
-default: depend library
+gl_library: $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME)
 
+# Build libGL that contains the glapi dispatch if we are not building for x11
+ifneq ($(EGL_PLATFORM),x11)
+$(TOP)/$(LIB_DIR)/$(GL_LIB_NAME):  $(MESA_GLAPI_OBJECTS) Makefile
+	$(TOP)/bin/mklib -o $(GL_LIB) -linker '$(CC)' \
+		-major 1 -minor 2 $(MKLIB_OPTIONS) \
+		-install $(TOP)/$(LIB_DIR) $(GL_LIB_DEPS) $(MESA_GLAPI_OBJECTS)
+endif # EGL_PLATFORM != x11
 
 # EGL Library
-library: $(TOP)/$(LIB_DIR)/libEGL.so
+egl_library: $(TOP)/$(LIB_DIR)/libEGL.so
 
 $(TOP)/$(LIB_DIR)/libEGL.so: $(OBJECTS)
 	$(TOP)/bin/mklib -o EGL -major 1 -minor 0 \
 		-install $(TOP)/$(LIB_DIR) -ldl $(OBJECTS) $(LIBS)
 
-
-
 clean:
+	-rm -f $(TOP)/$(LIB_DIR)/libEGL.so*
 	rm -f *.o *.so*
 	rm -f core.*
+	rm -f depend
 
 
-depend: $(SOURCES) $(HEADERS)
+depend: $(SOURCES) $(HEADERS) $(EXTRA_DEPS) Makefile
 	@ echo "running $(MKDEP)"
 	@ rm -f depend
 	@ touch depend
 	$(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) \
-		$(SOURCES) $(HEADERS) > /dev/null 2>/dev/null
+		$(SOURCES) $(EXTRA_DEPS) $(HEADERS) > /dev/null 2>/dev/null
 
 
 include depend
 # DO NOT DELETE
diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c
index 43b1f51..21b9f58 100644
--- a/src/egl/main/egldriver.c
+++ b/src/egl/main/egldriver.c
@@ -19,14 +19,17 @@
 #include "eglscreen.h"
 #include "eglstring.h"
 #include "eglsurface.h"
 
-#if defined(_EGL_PLATFORM_X)
-#include <dlfcn.h>
-#include "eglx.h"
-#elif defined(_EGL_PLATFORM_WINDOWS)
+#if defined(_EGL_PLATFORM_WINDOWS)
 /* Use static linking on Windows for now */
 #define WINDOWS_STATIC_LINK
+#else /* !_EGL_PLATFORM_WINDOWS */
+#include <dlfcn.h>
+#endif /* !_EGL_PLATFORM_WINDOWS */
+
+#if defined(_EGL_PLATFORM_X)
+#include "eglx.h"
 #endif
 
 /**
  * Wrappers for dlopen/dlclose()
@@ -59,9 +62,9 @@
       FreeLibrary(lib);
 #endif
    }
 
-#elif defined(_EGL_PLATFORM_X)
+#else /* !_EGL_PLATFORM_WINDOWS */
    static const char *DefaultDriverName = ":0";
    static const char *SysFS = "/sys/class";
 
    typedef void * lib_handle;
@@ -77,9 +80,9 @@
    {
       dlclose(lib);
    }
    
-#endif
+#endif /* !_EGL_PLATFORM_WINDOWS */
 
 /**
  * Given a card number, use sysfs to determine the DRI driver name.
  */
@@ -145,9 +148,9 @@ _eglChooseDriver(_EGLDisplay *dpy)
    const char *driverName = NULL;
 
    (void) DefaultDriverName;
 
-#if defined(_EGL_PLATFORM_X)
+#if !defined(_EGL_PLATFORM_WINDOWS)
    /* First, if the EGL_DRIVER env var is set, use that */
    driverName = getenv("EGL_DRIVER");
    if (driverName)
       return _eglstrdup(driverName);
@@ -233,9 +236,9 @@ _eglOpenDriver(_EGLDisplay *dpy, const char *driverName, const char *args)
       return NULL;
    }
    mainFunc = (_EGLMain_t) GetProcAddress(lib, "_eglMain");
 #endif
-#elif defined(_EGL_PLATFORM_X)
+#else /* !_EGL_PLATFORM_WINDOWS */
    /* XXX also prepend a directory path??? */
    sprintf(driverFilename, "%s.so", driverName);
    _eglLog(_EGL_DEBUG, "dlopen(%s)", driverFilename);
    lib = open_library(driverFilename);
@@ -393,9 +396,9 @@ _eglFindAPIs(void)
    const char *es1_libname = "libGLESv1_CM.dll";
    const char *es2_libname = "libGLESv2.dll";
    const char *gl_libname = "OpenGL32.dll";
    const char *vg_libname = "libOpenVG.dll";
-#elif defined(_EGL_PLATFORM_X)
+#else /* !_EGL_PLATFORM_WINDOWS */
    const char *es1_libname = "libGLESv1_CM.so";
    const char *es2_libname = "libGLESv2.so";
    const char *gl_libname = "libGL.so";
    const char *vg_libname = "libOpenVG.so";
diff --git a/src/egl/main/egllog.c b/src/egl/main/egllog.c
index 1d7a0a3..9dd7205 100644
--- a/src/egl/main/egllog.c
+++ b/src/egl/main/egllog.c
@@ -20,9 +20,9 @@ static EGLint ReportingLevel = -1;
 
 static void
 log_level_initialize(void)
 {
-#if defined(_EGL_PLATFORM_X)  
+#if !defined(_EGL_PLATFORM_WINDOWS)
    char *log_env = getenv("EGL_LOG_LEVEL");
 #else
    char *log_env = NULL;
 #endif
diff --git a/src/egl/main/eglx.c b/src/egl/main/eglx.c
index 1bba149..d8f63ca 100644
--- a/src/egl/main/eglx.c
+++ b/src/egl/main/eglx.c
@@ -35,9 +35,11 @@
 
 #include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
+#ifdef _EGL_PLATFORM_X
 #include <X11/Xlib.h>
+#endif
 
 #include "egldriver.h"
 #include "egllog.h"
 #include "eglstring.h"
diff --git a/src/gallium/winsys/drm/Makefile.template b/src/gallium/winsys/drm/Makefile.template
index 80e817b..abac933 100644
--- a/src/gallium/winsys/drm/Makefile.template
+++ b/src/gallium/winsys/drm/Makefile.template
@@ -85,9 +85,9 @@ default: depend symlinks $(LIBNAME) $(TOP)/$(LIB_DIR)/$(LIBNAME) $(LIBNAME_EGL)
 $(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(PIPE_DRIVERS) $(WINOBJ) Makefile $(TOP)/src/mesa/drivers/dri/Makefile.template
 	$(TOP)/bin/mklib -noprefix -o $@ \
 		$(OBJECTS) $(PIPE_DRIVERS) $(MESA_MODULES)  $(WINOBJ) $(DRI_LIB_DEPS)
 
-$(LIBNAME_EGL): $(WINSYS_OBJECTS) $(LIBS)
+$(LIBNAME_EGL): $(WINSYS_OBJECTS) $(OBJECTS) $(LIBS)
 	$(TOP)/bin/mklib -o $(LIBNAME_EGL) \
 		-linker "$(CC)" \
 		-noprefix \
 		$(OBJECTS) $(MKLIB_OPTIONS) $(WINSYS_OBJECTS) $(PIPE_DRIVERS) $(WINOBJ) $(DRI_LIB_DEPS) \
diff --git a/src/gallium/winsys/egl_xlib/Makefile b/src/gallium/winsys/egl_xlib/Makefile
index 76f1b56..4df0e1b 100644
--- a/src/gallium/winsys/egl_xlib/Makefile
+++ b/src/gallium/winsys/egl_xlib/Makefile
@@ -35,12 +35,8 @@ LIBS = \
 UNUSED_LIBS = \
 	$(TOP)/src/mesa/libglapi.a \
 	$(TOP)/src/mesa/libmesa.a \
 
-
-LOCAL_CFLAGS = -D_EGL_PLATFORM_X=1
-
-
 .c.o:
 	$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $(LOCAL_CFLAGS) $< -o $@
 
 
-- 
1.5.4.3

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to