[Mesa-dev] [PATCH 2/6] android: fix the building rules for Android 5.0
Chih-Wei Huang
cwhuang at android-x86.org
Fri Apr 3 14:01:22 PDT 2015
Android 5.0 allows modules to generate source into $OUT/gen, which will
then be copied into $OUT/obj and $OUT/obj_$(TARGET_2ND_ARCH) as necessary.
Modules will need to change calls to local-intermediates-dir into
local-generated-sources-dir.
The patch changes local-intermediates-dir into local-generated-sources-dir.
If the Android version is less than 5.0, fallback to local-intermediates-dir.
The patch also fixes the 64-bit building issue of Android 5.0.
Signed-off-by: Chih-Wei Huang <cwhuang at linux.org.tw>
---
Android.mk | 7 +++++++
src/egl/drivers/dri2/Android.mk | 8 +++++++-
src/egl/main/Android.mk | 4 ++++
src/gallium/auxiliary/Android.mk | 2 +-
src/gallium/auxiliary/os/os_mman.h | 2 +-
src/glsl/Android.gen.mk | 3 +--
src/mapi/Android.mk | 2 +-
src/mesa/Android.gen.mk | 2 +-
src/mesa/drivers/dri/Android.mk | 1 -
src/mesa/drivers/dri/common/Android.mk | 3 +--
src/mesa/drivers/dri/i915/Android.mk | 5 ++++-
src/mesa/drivers/dri/i965/Android.mk | 5 ++++-
src/mesa/program/Android.mk | 3 +--
src/util/Android.mk | 4 ++--
14 files changed, 35 insertions(+), 16 deletions(-)
diff --git a/Android.mk b/Android.mk
index 87ed464..b19419b 100644
--- a/Android.mk
+++ b/Android.mk
@@ -34,6 +34,13 @@ MESA_TOP := $(call my-dir)
MESA_ANDROID_MAJOR_VERSION := $(word 1, $(subst ., , $(PLATFORM_VERSION)))
MESA_ANDROID_MINOR_VERSION := $(word 2, $(subst ., , $(PLATFORM_VERSION)))
MESA_ANDROID_VERSION := $(MESA_ANDROID_MAJOR_VERSION).$(MESA_ANDROID_MINOR_VERSION)
+ifeq ($(filter 1 2 3 4,$(MESA_ANDROID_MAJOR_VERSION)),)
+MESA_LOLLIPOP_BUILD := true
+else
+define local-generated-sources-dir
+$(call local-intermediates-dir)
+endef
+endif
MESA_COMMON_MK := $(MESA_TOP)/Android.common.mk
MESA_PYTHON2 := python
diff --git a/src/egl/drivers/dri2/Android.mk b/src/egl/drivers/dri2/Android.mk
index d48506a..5931ce8 100644
--- a/src/egl/drivers/dri2/Android.mk
+++ b/src/egl/drivers/dri2/Android.mk
@@ -32,10 +32,16 @@ LOCAL_SRC_FILES := \
platform_android.c
LOCAL_CFLAGS := \
- -DDEFAULT_DRIVER_DIR=\"/system/lib/dri\" \
-DHAVE_SHARED_GLAPI \
-DHAVE_ANDROID_PLATFORM
+ifeq ($(MESA_LOLLIPOP_BUILD),true)
+LOCAL_CFLAGS_x86 := -DDEFAULT_DRIVER_DIR=\"/system/lib/dri\"
+LOCAL_CFLAGS_x86_64 := -DDEFAULT_DRIVER_DIR=\"/system/lib64/dri\"
+else
+LOCAL_CFLAGS += -DDEFAULT_DRIVER_DIR=\"/system/lib/dri\"
+endif
+
LOCAL_C_INCLUDES := \
$(MESA_TOP)/src/mapi \
$(MESA_TOP)/src/egl/main \
diff --git a/src/egl/main/Android.mk b/src/egl/main/Android.mk
index 4d0cc57..12b66d0 100644
--- a/src/egl/main/Android.mk
+++ b/src/egl/main/Android.mk
@@ -154,7 +154,11 @@ LOCAL_STATIC_LIBRARIES := \
libmesa_loader
LOCAL_MODULE := libGLES_mesa
+ifeq ($(MESA_LOLLIPOP_BUILD),true)
+LOCAL_MODULE_RELATIVE_PATH := egl
+else
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/egl
+endif
include $(MESA_COMMON_MK)
include $(BUILD_SHARED_LIBRARY)
diff --git a/src/gallium/auxiliary/Android.mk b/src/gallium/auxiliary/Android.mk
index c7b2634..96a2125 100644
--- a/src/gallium/auxiliary/Android.mk
+++ b/src/gallium/auxiliary/Android.mk
@@ -39,7 +39,7 @@ LOCAL_MODULE := libmesa_gallium
# generate sources
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
-intermediates := $(call local-intermediates-dir)
+intermediates := $(call local-generated-sources-dir)
LOCAL_GENERATED_SOURCES := $(addprefix $(intermediates)/, $(GENERATED_SOURCES))
$(LOCAL_GENERATED_SOURCES): PRIVATE_PYTHON := $(MESA_PYTHON2)
diff --git a/src/gallium/auxiliary/os/os_mman.h b/src/gallium/auxiliary/os/os_mman.h
index 3fc8c43..e892610 100644
--- a/src/gallium/auxiliary/os/os_mman.h
+++ b/src/gallium/auxiliary/os/os_mman.h
@@ -54,7 +54,7 @@ extern "C" {
#endif
-#if defined(PIPE_OS_ANDROID)
+#if defined(PIPE_OS_ANDROID) && !defined(__LP64__)
extern void *__mmap2(void *, size_t, int, int, int, size_t);
diff --git a/src/glsl/Android.gen.mk b/src/glsl/Android.gen.mk
index 35d79f2..5591f9d 100644
--- a/src/glsl/Android.gen.mk
+++ b/src/glsl/Android.gen.mk
@@ -27,7 +27,7 @@ ifeq ($(LOCAL_MODULE_CLASS),)
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
endif
-intermediates := $(call local-intermediates-dir)
+intermediates := $(call local-generated-sources-dir)
sources := \
glsl_lexer.cpp \
@@ -43,7 +43,6 @@ sources := \
LOCAL_SRC_FILES := $(filter-out $(sources), $(LOCAL_SRC_FILES))
LOCAL_C_INCLUDES += \
- $(intermediates) \
$(intermediates)/glcpp \
$(intermediates)/nir \
$(MESA_TOP)/src/glsl/glcpp \
diff --git a/src/mapi/Android.mk b/src/mapi/Android.mk
index f104378..4445218 100644
--- a/src/mapi/Android.mk
+++ b/src/mapi/Android.mk
@@ -53,7 +53,7 @@ LOCAL_C_INCLUDES := \
LOCAL_MODULE := libglapi
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
-intermediates := $(call local-intermediates-dir)
+intermediates := $(call local-generated-sources-dir)
abi_header := $(intermediates)/$(abi_header)
LOCAL_GENERATED_SOURCES := $(abi_header)
diff --git a/src/mesa/Android.gen.mk b/src/mesa/Android.gen.mk
index cc6b223..27656cd 100644
--- a/src/mesa/Android.gen.mk
+++ b/src/mesa/Android.gen.mk
@@ -27,7 +27,7 @@ ifeq ($(LOCAL_MODULE_CLASS),)
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
endif
-intermediates := $(call local-intermediates-dir)
+intermediates := $(call local-generated-sources-dir)
# This is the list of auto-generated files: sources and headers
sources := \
diff --git a/src/mesa/drivers/dri/Android.mk b/src/mesa/drivers/dri/Android.mk
index 764cd5a..09ce55a 100644
--- a/src/mesa/drivers/dri/Android.mk
+++ b/src/mesa/drivers/dri/Android.mk
@@ -29,7 +29,6 @@ include $(LOCAL_PATH)/common/Makefile.sources
# Variables common to all DRI drivers
MESA_DRI_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/dri
-MESA_DRI_MODULE_UNSTRIPPED_PATH := $(TARGET_OUT_SHARED_LIBRARIES_UNSTRIPPED)/dri
MESA_DRI_CFLAGS := \
-DHAVE_ANDROID_PLATFORM
diff --git a/src/mesa/drivers/dri/common/Android.mk b/src/mesa/drivers/dri/common/Android.mk
index 03ea564..458e4e9 100644
--- a/src/mesa/drivers/dri/common/Android.mk
+++ b/src/mesa/drivers/dri/common/Android.mk
@@ -34,10 +34,9 @@ include $(LOCAL_PATH)/Makefile.sources
LOCAL_MODULE := libmesa_dri_common
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
-intermediates := $(call local-intermediates-dir)
+intermediates := $(call local-generated-sources-dir)
LOCAL_C_INCLUDES := \
- $(intermediates) \
$(MESA_DRI_C_INCLUDES)
# swrast only
diff --git a/src/mesa/drivers/dri/i915/Android.mk b/src/mesa/drivers/dri/i915/Android.mk
index 277d59b..56f91e7 100644
--- a/src/mesa/drivers/dri/i915/Android.mk
+++ b/src/mesa/drivers/dri/i915/Android.mk
@@ -26,8 +26,11 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := i915_dri
+ifeq ($(MESA_LOLLIPOP_BUILD),true)
+LOCAL_MODULE_RELATIVE_PATH := $(notdir $(MESA_DRI_MODULE_PATH))
+else
LOCAL_MODULE_PATH := $(MESA_DRI_MODULE_PATH)
-LOCAL_UNSTRIPPED_PATH := $(MESA_DRI_MODULE_UNSTRIPPED_PATH)
+endif
# Import variables i915_FILES.
include $(LOCAL_PATH)/Makefile.sources
diff --git a/src/mesa/drivers/dri/i965/Android.mk b/src/mesa/drivers/dri/i965/Android.mk
index d592cca..706cb9c 100644
--- a/src/mesa/drivers/dri/i965/Android.mk
+++ b/src/mesa/drivers/dri/i965/Android.mk
@@ -26,8 +26,11 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := i965_dri
+ifeq ($(MESA_LOLLIPOP_BUILD),true)
+LOCAL_MODULE_RELATIVE_PATH := $(notdir $(MESA_DRI_MODULE_PATH))
+else
LOCAL_MODULE_PATH := $(MESA_DRI_MODULE_PATH)
-LOCAL_UNSTRIPPED_PATH := $(MESA_DRI_MODULE_UNSTRIPPED_PATH)
+endif
# Import variables i965_FILES.
include $(LOCAL_PATH)/Makefile.sources
diff --git a/src/mesa/program/Android.mk b/src/mesa/program/Android.mk
index af16e77..9a6f962 100644
--- a/src/mesa/program/Android.mk
+++ b/src/mesa/program/Android.mk
@@ -46,7 +46,7 @@ LOCAL_MODULE := libmesa_program
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
LOCAL_STATIC_LIBRARIES := libmesa_glsl
-intermediates := $(call local-intermediates-dir)
+intermediates := $(call local-generated-sources-dir)
# TODO(chadv): In Makefile.sources, move these vars to a different list so we can
# remove this kludge.
@@ -72,7 +72,6 @@ $(intermediates)/program/lex.yy.c: $(LOCAL_PATH)/program_lexer.l
$(local-l-to-c)
LOCAL_C_INCLUDES := \
- $(intermediates) \
$(MESA_TOP)/src/mapi \
$(MESA_TOP)/src/mesa \
$(MESA_TOP)/src/glsl \
diff --git a/src/util/Android.mk b/src/util/Android.mk
index e6530ea..a39185a 100644
--- a/src/util/Android.mk
+++ b/src/util/Android.mk
@@ -45,7 +45,7 @@ LOCAL_MODULE := libmesa_util
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
-intermediates := $(call local-intermediates-dir)
+intermediates := $(call local-generated-sources-dir)
LOCAL_GENERATED_SOURCES := $(addprefix $(intermediates)/,$(MESA_UTIL_GENERATED_FILES))
$(LOCAL_GENERATED_SOURCES): PRIVATE_PYTHON := $(MESA_PYTHON2)
@@ -80,7 +80,7 @@ LOCAL_MODULE := libmesa_util
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
-intermediates := $(call local-intermediates-dir)
+intermediates := $(call local-generated-sources-dir)
LOCAL_GENERATED_SOURCES := $(addprefix $(intermediates)/,$(MESA_UTIL_GENERATED_FILES))
$(LOCAL_GENERATED_SOURCES): PRIVATE_PYTHON := $(MESA_PYTHON2)
--
1.9.1
More information about the mesa-dev
mailing list