From 9339c1291d73ada1a85b994cb076a9a0bf3c8110 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristian=20H=C3=B8gsberg?= Date: Fri, 5 Mar 2010 19:01:43 -0500 Subject: [PATCH] gles: Build libGLESv1_CM.so and libGLESv2.so from glapi files --- configs/autoconf.in | 8 ++++++ configure.ac | 16 +++++++++++ src/gles/Makefile | 70 +++++++++++++++++++++++++++++++++++++++++++++ src/mesa/Makefile | 24 ++++++++++++++++ 4 files changed, 118 insertions(+) create mode 100644 src/gles/Makefile diff --git a/configs/autoconf.in b/configs/autoconf.in index c89441b2518..afd51a370bb 100644 --- a/configs/autoconf.in +++ b/configs/autoconf.in @@ -50,6 +50,8 @@ GLU_LIB = GLU GLUT_LIB = glut GLW_LIB = GLw OSMESA_LIB = @OSMESA_LIB@ +GLESv1_CM_LIB = GLESv1_CM +GLESv2_LIB = GLESv2 # Library names (actual file names) GL_LIB_NAME = @GL_LIB_NAME@ @@ -58,6 +60,8 @@ GLUT_LIB_NAME = @GLUT_LIB_NAME@ GLW_LIB_NAME = @GLW_LIB_NAME@ OSMESA_LIB_NAME = @OSMESA_LIB_NAME@ EGL_LIB_NAME = @EGL_LIB_NAME@ +GLESv1_CM_LIB_NAME = @GLESv1_CM_LIB_NAME@ +GLESv2_LIB_NAME = @GLESv2_LIB_NAME@ # Globs used to install the lib and all symlinks GL_LIB_GLOB = @GL_LIB_GLOB@ @@ -66,6 +70,8 @@ GLUT_LIB_GLOB = @GLUT_LIB_GLOB@ GLW_LIB_GLOB = @GLW_LIB_GLOB@ OSMESA_LIB_GLOB = @OSMESA_LIB_GLOB@ EGL_LIB_GLOB = @EGL_LIB_GLOB@ +GLESv1_CM_LIB_GLOB = @GLESv1_CM_LIB_GLOB@ +GLESv2_LIB_GLOB = @GLESv2_LIB_GLOB@ # Directories to build LIB_DIR = @LIB_DIR@ @@ -107,6 +113,8 @@ GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @GLUT_MESA_DEPS@ \ GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @GLW_MESA_DEPS@ \ $(EXTRA_LIB_PATH) @GLW_LIB_DEPS@ APP_LIB_DEPS = $(EXTRA_LIB_PATH) @APP_LIB_DEPS@ +GLESv1_CM_LIB_DEPS = $(EXTRA_LIB_PATH) @GLESv1_LIB_DEPS@ +GLESv2_LIB_DEPS = $(EXTRA_LIB_PATH) @GLESv2_LIB_DEPS@ # DRI dependencies DRI_LIB_DEPS = $(EXTRA_LIB_PATH) @DRI_LIB_DEPS@ diff --git a/configure.ac b/configure.ac index abb655135f5..05cf6f82eb5 100644 --- a/configure.ac +++ b/configure.ac @@ -279,6 +279,8 @@ 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} +GLESv1_CM_LIB_NAME='lib$(GLESv1_CM_LIB).'${LIB_EXTENSION} +GLESv2_LIB_NAME='lib$(GLESv2_LIB).'${LIB_EXTENSION} GL_LIB_GLOB='lib$(GL_LIB).*'${LIB_EXTENSION}'*' GLU_LIB_GLOB='lib$(GLU_LIB).*'${LIB_EXTENSION}'*' @@ -286,6 +288,8 @@ 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}'*' +GLESv1_CM_LIB_GLOB='lib$(GLESv1_CM_LIB).*'${LIB_EXTENSION}'*' +GLESv2_LIB_GLOB='lib$(GLESv2_LIB).*'${LIB_EXTENSION}'*' AC_SUBST([GL_LIB_NAME]) AC_SUBST([GLU_LIB_NAME]) @@ -293,6 +297,8 @@ AC_SUBST([GLUT_LIB_NAME]) AC_SUBST([GLW_LIB_NAME]) AC_SUBST([OSMESA_LIB_NAME]) AC_SUBST([EGL_LIB_NAME]) +AC_SUBST([GLESv1_CM_LIB_NAME]) +AC_SUBST([GLESv2_LIB_NAME]) AC_SUBST([GL_LIB_GLOB]) AC_SUBST([GLU_LIB_GLOB]) @@ -300,6 +306,8 @@ AC_SUBST([GLUT_LIB_GLOB]) AC_SUBST([GLW_LIB_GLOB]) AC_SUBST([OSMESA_LIB_GLOB]) AC_SUBST([EGL_LIB_GLOB]) +AC_SUBST([GLESv1_CM_LIB_GLOB]) +AC_SUBST([GLESv2_LIB_GLOB]) dnl dnl Arch/platform-specific settings @@ -653,6 +661,9 @@ dri) # need DRM libs, -lpthread, etc. GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS" GL_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS" + GLESv1_CM_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS" + GLESv2_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS" + ;; osmesa) # No libGL for osmesa @@ -664,6 +675,8 @@ AC_SUBST([GL_PC_REQ_PRIV]) AC_SUBST([GL_PC_LIB_PRIV]) AC_SUBST([GL_PC_CFLAGS]) AC_SUBST([DRI_PC_REQ_PRIV]) +AC_SUBST([GLESv1_LIB_DEPS]) +AC_SUBST([GLESv2_LIB_DEPS]) dnl dnl More X11 setup @@ -740,6 +753,9 @@ fi if test "x$enable_gles2" = xyes; then API_DEFINES="$API_DEFINES -DFEATURE_ES2=1" fi +if test "x$enable_gles1" = xyes -o "x$enable_gles2"; then + SRC_DIRS="$SRC_DIRS gles" +fi AC_SUBST([API_DEFINES]) dnl If $with_dri_drivers is yes, directories will be added through diff --git a/src/gles/Makefile b/src/gles/Makefile new file mode 100644 index 00000000000..5fbd90b98fa --- /dev/null +++ b/src/gles/Makefile @@ -0,0 +1,70 @@ +TOP = ../.. +MESA = $(TOP)/src/mesa +include $(TOP)/configs/current +include $(MESA)/sources.mak + +GLESv1_CM_ASM := $(addprefix $(MESA)/es/glapi/glapi-es1/,$(GLAPI_ASM_SOURCES)) +GLESv2_ASM := $(addprefix $(MESA)/es/glapi/glapi-es2/,$(GLAPI_ASM_SOURCES)) +API_SOURCES := $(addprefix $(MESA)/,$(GLAPI_SOURCES)) + +$(TOP)/$(LIB_DIR)/$(GLESv1_CM_LIB_NAME) : PREFIX = es1 +$(TOP)/$(LIB_DIR)/$(GLESv1_CM_LIB_NAME) : NAME = GLESv1_CM + +$(TOP)/$(LIB_DIR)/$(GLESv2_LIB_NAME) : PREFIX = es2 +$(TOP)/$(LIB_DIR)/$(GLESv2_LIB_NAME) : NAME = GLESv2 + +INCLUDES = -I$(MESA)/es/glapi/glapi-$(PREFIX) -I$(MESA) + +OBJECTS = \ + $(notdir $(GLAPI_ASM_SOURCES:%.S=%.o)) \ + $(notdir $(GLAPI_SOURCES:%.c=%.o)) + +GLESv1_CM_OBJECTS = $(addprefix es1-,$(OBJECTS)) +GLESv2_OBJECTS = $(addprefix es2-,$(OBJECTS)) + +es1-%.o: $(dir $(GLESv1_CM_ASM))%.S + $(CC) -c $(CFLAGS) $(INCLUDES) -o $@ $< +es1-%.o: $(MESA)/glapi/%.c + $(CC) -c $(CFLAGS) $(INCLUDES) -o $@ $< + +es2-%.o: $(dir $(GLESv2_ASM))%.S + $(CC) -c $(CFLAGS) $(INCLUDES) -o $@ $< +es2-%.o: $(MESA)/glapi/%.c + $(CC) -c $(CFLAGS) $(INCLUDES) -o $@ $< + +default: depend \ + $(TOP)/$(LIB_DIR)/$(GLESv1_CM_LIB_NAME) \ + $(TOP)/$(LIB_DIR)/$(GLESv2_LIB_NAME) + +$(TOP)/$(LIB_DIR)/$(GLESv1_CM_LIB_NAME) : $(GLESv1_CM_OBJECTS) +$(TOP)/$(LIB_DIR)/$(GLESv2_LIB_NAME) : $(GLESv2_OBJECTS) + +$(TOP)/$(LIB_DIR)/$(GLESv1_CM_LIB_NAME) \ +$(TOP)/$(LIB_DIR)/$(GLESv2_LIB_NAME) : Makefile + $(MKLIB) -o $($(NAME)_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \ + -major 1 -minor 2 $(MKLIB_OPTIONS) \ + -install $(TOP)/$(LIB_DIR) -id \ + $(INSTALL_LIB_DIR)/lib$($(NAME)_LIB).1.dylib \ + $($(NAME)_LIB_DEPS) $($(NAME)_OBJECTS) + +depend: Makefile + rm -f depend + touch depend + $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(API_SOURCES) \ + $(ES1_API_ASM) $(ES2_API_ASM) + +# Emacs tags +tags: + etags `find . -name \*.[ch]` `find $(TOP)/include` + +install: $(TOP)/$(LIB_DIR)/$(GLESv1_CM_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLESv2_LIB_NAME) + $(MAKE) -C $(TOP)/src/mesa install-es2 install-es1 + +# Remove .o and backup files +clean: + -rm -f $(TOP)/$(LIB_DIR)/$(GLESv1_CM_LIB_GLOB) + -rm -f $(TOP)/$(LIB_DIR)/$(GLESv2_LIB_GLOB) + -rm -f *.o *~ + -rm -f depend depend.bak + +-include depend diff --git a/src/mesa/Makefile b/src/mesa/Makefile index 44e091f2407..c0500630173 100644 --- a/src/mesa/Makefile +++ b/src/mesa/Makefile @@ -146,6 +146,30 @@ install-libgl: default gl.pc install-headers $(DESTDIR)$(INSTALL_LIB_DIR) $(INSTALL) -m 644 gl.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig +install-headers-es1: + $(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/GLES + $(INSTALL) -m 644 $(TOP)/include/GLES/*.h \ + $(DESTDIR)$(INSTALL_INC_DIR)/GLES + +install-es1: default glesv1_cm.pc install-headers-es1 + $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR) + $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig + $(MINSTALL) $(TOP)/$(LIB_DIR)/$(GLESv1_CM_LIB_GLOB) \ + $(DESTDIR)$(INSTALL_LIB_DIR) + $(INSTALL) -m 644 glesv1_cm.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig + +install-headers-es2: + $(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/GLES2 + $(INSTALL) -m 644 $(TOP)/include/GLES2/*.h \ + $(DESTDIR)$(INSTALL_INC_DIR)/GLES2 + +install-es2: default glesv2.pc install-headers-es2 + $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR) + $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig + $(MINSTALL) $(TOP)/$(LIB_DIR)/$(GLESv2_LIB_GLOB) \ + $(DESTDIR)$(INSTALL_LIB_DIR) + $(INSTALL) -m 644 glesv2.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig + install-osmesa: default osmesa.pc $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR) $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig -- 2.30.2