OSDN Git Service

am 366ac666: am 2b3b1409: am 6873be9e: am 5d2265cb: am ed5ea12b: am f09c7628: am...
[android-x86/build.git] / core / package.mk
index 3a8e43a..2012351 100644 (file)
@@ -151,6 +151,7 @@ ifneq (true,$(WITH_DEXPREOPT))
 LOCAL_DEX_PREOPT :=
 else
 ifeq (,$(TARGET_BUILD_APPS))
+ifeq (,$(LOCAL_APK_LIBRARIES))
 ifneq (,$(LOCAL_SRC_FILES))
 ifndef LOCAL_DEX_PREOPT
 LOCAL_DEX_PREOPT := true
@@ -158,6 +159,7 @@ endif
 endif
 endif
 endif
+endif
 ifeq (false,$(LOCAL_DEX_PREOPT))
 LOCAL_DEX_PREOPT :=
 endif
@@ -445,6 +447,29 @@ endif
 
 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)