From d4c1ee05345e1e185ac15a3cd3552d9bb0d61bc3 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Mon, 21 Dec 2009 11:13:18 +0800 Subject: [PATCH] egl: Clean up the Makefile rules. This allows libEGL to be built as a static library and removes libX11 from the dependencies. Signed-off-by: Chia-I Wu --- configs/autoconf.in | 3 +++ configs/default | 5 ++++- configure.ac | 18 ++++++++++-------- src/egl/main/Makefile | 25 ++++++++++++++----------- 4 files changed, 31 insertions(+), 20 deletions(-) diff --git a/configs/autoconf.in b/configs/autoconf.in index f63618ebea2..49c009052b6 100644 --- a/configs/autoconf.in +++ b/configs/autoconf.in @@ -54,6 +54,7 @@ GLU_LIB_NAME = @GLU_LIB_NAME@ GLUT_LIB_NAME = @GLUT_LIB_NAME@ GLW_LIB_NAME = @GLW_LIB_NAME@ OSMESA_LIB_NAME = @OSMESA_LIB_NAME@ +EGL_LIB_NAME = @EGL_LIB_NAME@ # Globs used to install the lib and all symlinks GL_LIB_GLOB = @GL_LIB_GLOB@ @@ -61,12 +62,14 @@ GLU_LIB_GLOB = @GLU_LIB_GLOB@ GLUT_LIB_GLOB = @GLUT_LIB_GLOB@ GLW_LIB_GLOB = @GLW_LIB_GLOB@ OSMESA_LIB_GLOB = @OSMESA_LIB_GLOB@ +EGL_LIB_GLOB = @EGL_LIB_GLOB@ # Directories to build LIB_DIR = @LIB_DIR@ SRC_DIRS = @SRC_DIRS@ GLU_DIRS = @GLU_DIRS@ DRIVER_DIRS = @DRIVER_DIRS@ +EGL_DRIVERS_DIRS = @EGL_DRIVERS_DIRS@ GALLIUM_DIRS = @GALLIUM_DIRS@ GALLIUM_DRIVERS_DIRS = @GALLIUM_DRIVERS_DIRS@ GALLIUM_WINSYS_DIRS = @GALLIUM_WINSYS_DIRS@ diff --git a/configs/default b/configs/default index 94beca4fa67..f5a4bc195f3 100644 --- a/configs/default +++ b/configs/default @@ -55,6 +55,7 @@ GLUT_LIB = glut GLEW_LIB = GLEW GLW_LIB = GLw OSMESA_LIB = OSMesa +EGL_LIB = EGL # Library names (actual file names) @@ -64,6 +65,7 @@ GLUT_LIB_NAME = lib$(GLUT_LIB).so GLEW_LIB_NAME = lib$(GLEW_LIB).a GLW_LIB_NAME = lib$(GLW_LIB).so OSMESA_LIB_NAME = lib$(OSMESA_LIB).so +EGL_LIB_NAME = lib$(EGL_LIB).so # globs used to install the lib and all symlinks GL_LIB_GLOB = $(GL_LIB_NAME)* @@ -71,6 +73,7 @@ GLU_LIB_GLOB = $(GLU_LIB_NAME)* GLUT_LIB_GLOB = $(GLUT_LIB_NAME)* GLW_LIB_GLOB = $(GLW_LIB_NAME)* OSMESA_LIB_GLOB = $(OSMESA_LIB_NAME)* +EGL_LIB_GLOB = $(EGL_LIB_NAME)* # Optional assembly language optimization files for libGL MESA_ASM_SOURCES = @@ -89,7 +92,7 @@ DRIVER_DIRS = x11 osmesa # Which subdirs under $(TOP)/progs/ to enter: PROGRAM_DIRS = demos redbook samples glsl objviewer xdemos -# EGL directories +# EGL drivers to build EGL_DRIVERS_DIRS = demo # Gallium directories and diff --git a/configure.ac b/configure.ac index d8af5ea9ef9..43069de1ea0 100644 --- a/configure.ac +++ b/configure.ac @@ -243,24 +243,28 @@ GLU_LIB_NAME='lib$(GLU_LIB).'${LIB_EXTENSION} GLUT_LIB_NAME='lib$(GLUT_LIB).'${LIB_EXTENSION} GLW_LIB_NAME='lib$(GLW_LIB).'${LIB_EXTENSION} OSMESA_LIB_NAME='lib$(OSMESA_LIB).'${LIB_EXTENSION} +EGL_LIB_NAME='lib$(EGL_LIB).'${LIB_EXTENSION} GL_LIB_GLOB='lib$(GL_LIB).*'${LIB_EXTENSION}'*' GLU_LIB_GLOB='lib$(GLU_LIB).*'${LIB_EXTENSION}'*' GLUT_LIB_GLOB='lib$(GLUT_LIB).*'${LIB_EXTENSION}'*' GLW_LIB_GLOB='lib$(GLW_LIB).*'${LIB_EXTENSION}'*' OSMESA_LIB_GLOB='lib$(OSMESA_LIB).*'${LIB_EXTENSION}'*' +EGL_LIB_GLOB='lib$(EGL_LIB).*'${LIB_EXTENSION}'*' AC_SUBST([GL_LIB_NAME]) AC_SUBST([GLU_LIB_NAME]) AC_SUBST([GLUT_LIB_NAME]) AC_SUBST([GLW_LIB_NAME]) AC_SUBST([OSMESA_LIB_NAME]) +AC_SUBST([EGL_LIB_NAME]) AC_SUBST([GL_LIB_GLOB]) AC_SUBST([GLU_LIB_GLOB]) AC_SUBST([GLUT_LIB_GLOB]) AC_SUBST([GLW_LIB_GLOB]) AC_SUBST([OSMESA_LIB_GLOB]) +AC_SUBST([EGL_LIB_GLOB]) dnl dnl Arch/platform-specific settings @@ -900,17 +904,15 @@ AC_ARG_ENABLE([egl], [enable_egl=yes]) if test "x$enable_egl" = xyes; then SRC_DIRS="$SRC_DIRS egl" - - if test "$x11_pkgconfig" = yes; then - PKG_CHECK_MODULES([EGL], [x11]) - EGL_LIB_DEPS="$EGL_LIBS" - else - # should check these... - EGL_LIB_DEPS="$X_LIBS -lX11" + EGL_LIB_DEPS="$DLOPEN_LIBS -lpthread" + EGL_DRIVERS_DIRS="" + if test "$enable_static" != yes && test "$mesa_driver" != osmesa; then + # build egl_glx when libGL is built + EGL_DRIVERS_DIRS="glx" fi - EGL_LIB_DEPS="$EGL_LIB_DEPS $DLOPEN_LIBS" fi AC_SUBST([EGL_LIB_DEPS]) +AC_SUBST([EGL_DRIVERS_DIRS]) dnl dnl GLU configuration diff --git a/src/egl/main/Makefile b/src/egl/main/Makefile index c951b070f1f..ec326a845df 100644 --- a/src/egl/main/Makefile +++ b/src/egl/main/Makefile @@ -4,7 +4,10 @@ TOP = ../../.. include $(TOP)/configs/current -INCLUDE_DIRS = -I$(TOP)/include -I$(TOP)/src/mesa/glapi $(X11_INCLUDES) +EGL_MAJOR = 1 +EGL_MINOR = 0 + +INCLUDE_DIRS = -I$(TOP)/include HEADERS = \ eglcompiler.h \ @@ -43,7 +46,7 @@ SOURCES = \ OBJECTS = $(SOURCES:.c=.o) -# Undefined for now +# use dl*() to load drivers LOCAL_CFLAGS = -D_EGL_PLATFORM_X=1 @@ -56,21 +59,21 @@ default: depend library # EGL Library -library: $(TOP)/$(LIB_DIR)/libEGL.so +library: $(TOP)/$(LIB_DIR)/$(EGL_LIB_NAME) -$(TOP)/$(LIB_DIR)/libEGL.so: $(OBJECTS) - $(MKLIB) -o EGL -linker '$(CC)' -ldflags '$(LDFLAGS)' \ - -major 1 -minor 0 \ - -install $(TOP)/$(LIB_DIR) \ +$(TOP)/$(LIB_DIR)/$(EGL_LIB_NAME): $(OBJECTS) + $(MKLIB) -o $(EGL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \ + -major $(EGL_MAJOR) -minor $(EGL_MINOR) \ + -install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \ $(EGL_LIB_DEPS) $(OBJECTS) install: default $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR) - $(MINSTALL) $(TOP)/$(LIB_DIR)/libEGL.so* $(DESTDIR)$(INSTALL_LIB_DIR) + $(MINSTALL) $(TOP)/$(LIB_DIR)/$(EGL_LIB_GLOB) \ + $(DESTDIR)$(INSTALL_LIB_DIR) clean: - -rm -f *.o *.so* - -rm -f core.* + -rm -f *.o -rm -f depend depend.bak @@ -82,5 +85,5 @@ depend: $(SOURCES) $(HEADERS) $(SOURCES) $(HEADERS) > /dev/null 2>/dev/null -include depend +-include depend # DO NOT DELETE -- 2.30.2