Merge "DO NOT MERGE. Fix build by removing old file." into jb-mr2-dev
diff --git a/core/binary.mk b/core/binary.mk
index dd68fee..d70edbb 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -66,32 +66,6 @@
endif
endif
-# Logging used to be part of libcutils (target) and libutils (sim);
-# hack modules that use those other libs to also include liblog.
-# All of this complexity is to make sure that liblog only appears
-# once, and appears just before libcutils or libutils on the link
-# line.
-# TODO: remove this hack and change all modules to use liblog
-# when necessary.
-define insert-liblog
- $(if $(filter liblog,$(1)),$(1), \
- $(if $(filter libcutils,$(1)), \
- $(patsubst libcutils,liblog libcutils,$(1)) \
- , \
- $(patsubst libutils,liblog libutils,$(1)) \
- ) \
- )
-endef
-ifneq (,$(filter libcutils libutils,$(LOCAL_SHARED_LIBRARIES)))
- LOCAL_SHARED_LIBRARIES := $(call insert-liblog,$(LOCAL_SHARED_LIBRARIES))
-endif
-ifneq (,$(filter libcutils libutils,$(LOCAL_STATIC_LIBRARIES)))
- LOCAL_STATIC_LIBRARIES := $(call insert-liblog,$(LOCAL_STATIC_LIBRARIES))
-endif
-ifneq (,$(filter libcutils libutils,$(LOCAL_WHOLE_STATIC_LIBRARIES)))
- LOCAL_WHOLE_STATIC_LIBRARIES := $(call insert-liblog,$(LOCAL_WHOLE_STATIC_LIBRARIES))
-endif
-
ifdef LOCAL_SDK_VERSION
# Get the list of INSTALLED libraries as module names.
# We cannot compute the full path of the LOCAL_SHARED_LIBRARIES for
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index 81a9493..8d84814 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -135,6 +135,7 @@
LOCAL_ADDITIONAL_CERTIFICATES:=
LOCAL_PREBUILT_MODULE_FILE:=
LOCAL_POST_INSTALL_CMD:=
+LOCAL_DIST_BUNDLED_BINARIES:=
# Trim MAKEFILE_LIST so that $(call my-dir) doesn't need to
# iterate over thousands of entries every time.
diff --git a/core/package.mk b/core/package.mk
index 25af8da..2012351 100644
--- a/core/package.mk
+++ b/core/package.mk
@@ -447,6 +447,29 @@
PACKAGES := $(PACKAGES) $(LOCAL_PACKAGE_NAME)
+# Dist the files that can be bundled in system.img.
+# They include the jni shared libraries and the apk with jni libraries stripped.
+ifeq ($(LOCAL_DIST_BUNDLED_BINARIES),true)
+ifneq ($(filter $(LOCAL_PACKAGE_NAME),$(TARGET_BUILD_APPS)),)
+ifneq ($(strip $(jni_shared_libraries)),)
+dist_subdir := bundled_$(LOCAL_PACKAGE_NAME)
+$(foreach f, $(jni_shared_libraries), \
+ $(call dist-for-goals, apps_only, $(f):$(dist_subdir)/$(notdir $(f))))
+
+apk_jni_stripped := $(intermediates)/jni_stripped/package.apk
+$(apk_jni_stripped): PRIVATE_JNI_SHARED_LIBRARIES := $(notdir $(jni_shared_libraries))
+$(apk_jni_stripped) : $(LOCAL_BUILT_MODULE) | $(ZIPALIGN)
+ @rm -rf $(dir $@) && mkdir -p $(dir $@)
+ $(hide) cp $< $@
+ $(hide) zip -d $@ $(foreach f,$(PRIVATE_JNI_SHARED_LIBRARIES),\*/$(f))
+ $(call align-package)
+
+$(call dist-for-goals, apps_only, $(apk_jni_stripped):$(dist_subdir)/$(LOCAL_PACKAGE_NAME).apk)
+
+endif # jni_shared_libraries
+endif # apps_only build
+endif # LOCAL_DIST_BUNDLED_BINARIES
+
# Lint phony targets
.PHONY: lint-$(LOCAL_PACKAGE_NAME)
lint-$(LOCAL_PACKAGE_NAME): PRIVATE_PATH := $(LOCAL_PATH)