[Mesa-dev] [PATCH 3/3] glapi: Build libmesa_glapi on Android

Chad Versace chad at chad-versace.us
Mon Aug 15 23:14:56 PDT 2011


The libmesa_glapi.so on Android is analogous to the libglapi.so on Linux.
libmesa_glapi uses the shared glapi.

The libname is libmesa_glapi, rather than libglapi, due to conventions of
the Android build system. Names of intermediate libraries should be
prefixed by the project name in order to prevent naming collisions in the
build tree. (For an example, grep for `libc_` in bionic's Makefiles).

Note: This is in preparation for porting i965 to Android.
CC: Chia-I Wu <olv at lunarg.com>,
Signed-off-by: Chad Versace <chad at chad-versace.us>
---
 Android.mk                       |    2 +
 src/Android.mk                   |    1 +
 src/mapi/Android.mk              |    1 +
 src/mapi/shared-glapi/Android.mk |   95 ++++++++++++++++++++++++++++++++++++++
 4 files changed, 99 insertions(+), 0 deletions(-)
 create mode 100644 src/Android.mk
 create mode 100644 src/mapi/Android.mk
 create mode 100644 src/mapi/shared-glapi/Android.mk

diff --git a/Android.mk b/Android.mk
index a52cae5..3900c7e 100644
--- a/Android.mk
+++ b/Android.mk
@@ -60,4 +60,6 @@ MESA_COMMON_CPPFLAGS := \
 MESA_PYTHON2 := python2
 MESA_PYTHON_FLAGS := -OO -tt
 
+include $(call all-subdir-makefiles)
+
 endif # !TARGET_SIMULATOR
diff --git a/src/Android.mk b/src/Android.mk
new file mode 100644
index 0000000..5053e7d
--- /dev/null
+++ b/src/Android.mk
@@ -0,0 +1 @@
+include $(call all-subdir-makefiles)
diff --git a/src/mapi/Android.mk b/src/mapi/Android.mk
new file mode 100644
index 0000000..5053e7d
--- /dev/null
+++ b/src/mapi/Android.mk
@@ -0,0 +1 @@
+include $(call all-subdir-makefiles)
diff --git a/src/mapi/shared-glapi/Android.mk b/src/mapi/shared-glapi/Android.mk
new file mode 100644
index 0000000..94fbddd
--- /dev/null
+++ b/src/mapi/shared-glapi/Android.mk
@@ -0,0 +1,95 @@
+#
+# Copyright © 2011 Intel Corporation
+#
+# 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.
+#
+# Authors:
+#     Chad Versace <chad at chad-versace.us>
+#
+
+LOCAL_PATH := $(call my-dir)
+
+# ----------------------------------------------------------------------------
+#  Build libmesa_glapi
+# ----------------------------------------------------------------------------
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libmesa_glapi
+LOCAL_MODULE_CLASS := SHARED_LIBRARIES
+LOCAL_MODULE_TAGS := optional
+
+intermediates := $(call local-intermediates-dir)
+
+# ----------------------------------------------
+# Define MAPI_GLAPI_SOURCES
+# ----------------------------------------------
+
+include $(MESA_TOP)/src/mapi/mapi/sources.mak
+MAPI_GLAPI_SOURCES := $(addprefix ../mapi/, $(MAPI_GLAPI_SOURCES))
+
+
+# ----------------------------------------------
+# Generate header MESA_SHARED_GLAPI_H
+# ----------------------------------------------
+
+MESA_SHARED_GLAPI_H := $(intermediates)/glapi_mapi_tmp.h
+
+$(MESA_SHARED_GLAPI_H): PRIVATE_APIXML := $(MESA_TOP)/src/mapi/glapi/gen/gl_and_es_API.xml
+$(MESA_SHARED_GLAPI_H): PRIVATE_XML_SOURCES := $(wildcard $(MESA_TOP)/src/mapi/glapi/gen/*.xml)
+$(MESA_SHARED_GLAPI_H): PRIVATE_SCRIPT := $(MESA_TOP)/src/mapi/mapi/mapi_abi.py
+$(MESA_SHARED_GLAPI_H): PRIVATE_PY_SCRIPTS :=  $(wildcard $(MESA_TOP)/src/mapi/glapi/gen/*.py)
+
+$(MESA_SHARED_GLAPI_H): PRIVATE_DEPS := \
+	$(PRIVATE_XML_SOURCES) \
+	$(PRIVATE_PY_SCRIPTS)
+
+$(MESA_SHARED_GLAPI_H): PRIVATE_CUSTOM_TOOL := \
+	$(MESA_PYTHON2) $(MESA_PYTHON2_FLAGS) $(PRIVATE_SCRIPT) \
+	-o $(MESA_SHARED_GLAPI_H) \
+	--printer shared-glapi \
+	--mode lib \
+	$(PRIVATE_APIXML)
+
+$(MESA_SHARED_GLAPI_H): $(PRIVATE_DEPS)
+	$(call transform-generated-source)
+
+
+# ----------------------------------------------
+
+LOCAL_CFLAGS := \
+	-DMAPI_MODE_GLAPI \
+	-DMAPI_ABI_HEADER=\"glapi_mapi_tmp.h\"
+
+LOCAL_CPPFLAGS := \
+	LOCAL_C_FLAGS
+
+LOCAL_C_INCLUDES := \
+	$(intermediates) \
+	$(MESA_TOP)/src/mapi
+
+LOCAL_SRC_FILES := \
+	$(MAPI_GLAPI_SOURCES)
+
+LOCAL_GENERATED_SOURCES := \
+	$(MESA_SHARED_GLAPI_H)
+
+include $(MESA_LOCAL_VARS)
+include $(BUILD_SHARED_LIBRARY)
-- 
1.7.6



More information about the mesa-dev mailing list