From 3b0fa1083e8c24bafe50af6e4386a83edddc4f26 Mon Sep 17 00:00:00 2001 From: Stephen Hines Date: Wed, 6 Feb 2013 16:19:30 -0800 Subject: [PATCH] Copy RS compatibility libraries to /system/lib/ for bundled builds. Bug: 8138884 Change-Id: I74fb0c5835974af3c6e34fcd2d9ebfc2e7b08b4d --- core/clear_vars.mk | 1 + core/java.mk | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/core/clear_vars.mk b/core/clear_vars.mk index 38c18f1e2..3c2a50580 100644 --- a/core/clear_vars.mk +++ b/core/clear_vars.mk @@ -112,6 +112,7 @@ LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE:= LOCAL_RENDERSCRIPT_CC:= LOCAL_RENDERSCRIPT_COMPATIBILITY:= LOCAL_RENDERSCRIPT_FLAGS:= +LOCAL_RENDERSCRIPT_SKIP_INSTALL:= LOCAL_RENDERSCRIPT_TARGET_API:= LOCAL_BUILD_HOST_DEX:= LOCAL_DEX_PREOPT:= # '',true,false,nostripping diff --git a/core/java.mk b/core/java.mk index 427a30ca1..4064f6ce0 100644 --- a/core/java.mk +++ b/core/java.mk @@ -139,6 +139,7 @@ renderscript_sources := $(filter %.rs %.fs,$(LOCAL_SRC_FILES)) # Because names of the java files from RenderScript are unknown until the # .rs file(s) are compiled, we have to depend on a timestamp file. RenderScript_file_stamp := +rs_compatibility_jni_libs := ifneq ($(renderscript_sources),) renderscript_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(renderscript_sources)) RenderScript_file_stamp := $(LOCAL_INTERMEDIATE_SOURCE_DIR)/RenderScript.stamp @@ -259,6 +260,29 @@ include $(BUILD_SYSTEM)/base_rules.mk java_alternative_checked_module := +# Install the RS compatibility libraries to /system/lib/ if necessary +ifdef rs_compatibility_jni_libs +installed_rs_compatibility_jni_libs := $(addprefix $(TARGET_OUT_SHARED_LIBRARIES)/,\ + $(notdir $(rs_compatibility_jni_libs))) +# Provide a way to skip sources included in multiple projects. +ifdef LOCAL_RENDERSCRIPT_SKIP_INSTALL +skip_install_rs_libs := $(patsubst %.rs,%.so, \ + $(addprefix $(TARGET_OUT_SHARED_LIBRARIES)/lib, \ + $(notdir $(LOCAL_RENDERSCRIPT_SKIP_INSTALL)))) +installed_rs_compatibility_jni_libs := \ + $(filter-out $(skip_install_rs_libs),$(installed_rs_compatibility_jni_libs)) +endif +ifneq (,$(strip $(installed_rs_compatibility_jni_libs))) +$(installed_rs_compatibility_jni_libs) : $(TARGET_OUT_SHARED_LIBRARIES)/lib%.so : \ + $(renderscript_intermediate)/lib%.so + @echo "Install RS compatibility library: $@" + $(hide) mkdir -p $(dir $@) && cp -f $< $@ + +# Install them only if the current module is installed. +$(LOCAL_INSTALLED_MODULE) : $(installed_rs_compatibility_jni_libs) +endif +endif + # We use intermediates.COMMON because the classes.jar/.dex files will be # common even if LOCAL_BUILT_MODULE isn't. # -- 2.11.0