OSDN Git Service

Copy RS compatibility libraries to /system/lib/ for bundled builds.
authorStephen Hines <srhines@google.com>
Thu, 7 Feb 2013 00:19:30 +0000 (16:19 -0800)
committerStephen Hines <srhines@google.com>
Thu, 7 Feb 2013 04:16:22 +0000 (20:16 -0800)
Bug: 8138884
Change-Id: I74fb0c5835974af3c6e34fcd2d9ebfc2e7b08b4d

core/clear_vars.mk
core/java.mk

index 38c18f1..3c2a505 100644 (file)
@@ -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
index 427a30c..4064f6c 100644 (file)
@@ -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.
 #