summaryrefslogtreecommitdiffstats
path: root/core/definitions.mk
diff options
context:
space:
mode:
authorYing Wang <wangying@google.com>2015-05-01 14:02:26 -0700
committerYing Wang <wangying@google.com>2015-06-01 19:19:45 -0700
commit1fb0152ff7bf24b565b44a57e51290f2a5430107 (patch)
treeb4fc6334c2e8d36ac8658b542c345e81b15da8b0 /core/definitions.mk
parent4fe7bfd373d99dedfd2e63135da5189478bb0138 (diff)
downloadbuild-1fb0152ff7bf24b565b44a57e51290f2a5430107.zip
build-1fb0152ff7bf24b565b44a57e51290f2a5430107.tar.gz
build-1fb0152ff7bf24b565b44a57e51290f2a5430107.tar.bz2
Don't extract jni from prebuilt apks.
- We don't need LOCAL_PAGE_ALIGN_JNI_SHARED_LIBRARIES now, for we always page-align jni shared libraries and store them umcompressed. - For prebuilt apks, we don't extract jni any more; Instead we always run uncompress-shared-libs on them. - For apks built from source, we still install the jni separately, because that way multiple apks can share the same jni and it saves space. With this change, for most prebuilt apks, we don't need to specify LOCAL_PREBUILT_JNI_LIBS ("@lib/<abi>/foo.so") any more, for the build system automatically replaces the embedded jni with uncompressed files; But if a prebuilt is a fat apk (i.e. containing jni not needed by the current product architecture), you still need LOCAL_PREBUILT_JNI_LIBS to specify what jni to keep. Otherwise all embedded jni will be replaced with uncompressed files, that wastes space. Bug: 8076853 Change-Id: Ic3666dc72bf17cd293787414dd185470b365f967
Diffstat (limited to 'core/definitions.mk')
-rw-r--r--core/definitions.mk22
1 files changed, 11 insertions, 11 deletions
diff --git a/core/definitions.mk b/core/definitions.mk
index 6e3aa2b..e6aa8ac 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -2029,8 +2029,7 @@ $(hide) mkdir -p $(addprefix $(dir $@)lib/,$(PRIVATE_JNI_SHARED_LIBRARIES_ABI))
$(foreach abi,$(PRIVATE_JNI_SHARED_LIBRARIES_ABI),\
$(call _add-jni-shared-libs-to-package-per-abi,$(abi),\
$(patsubst $(abi):%,%,$(filter $(abi):%,$(PRIVATE_JNI_SHARED_LIBRARIES)))))
-$(hide) (cd $(dir $@) && zip -r \
- $(if $(filter true, $(PRIVATE_PAGE_ALIGN_JNI_SHARED_LIBRARIES)),-0,) $(notdir $@) lib)
+$(hide) (cd $(dir $@) && zip -r -0 $(notdir $@) lib)
$(hide) rm -rf $(dir $@)lib
endef
@@ -2076,21 +2075,22 @@ endef
define align-package
$(hide) mv $@ $@.unaligned
$(hide) $(ZIPALIGN) \
- -f \
- $(if $(filter true, $(PRIVATE_PAGE_ALIGN_JNI_SHARED_LIBRARIES)),-p,) \
+ -f -p \
4 \
$@.unaligned $@.aligned
$(hide) mv $@.aligned $@
endef
+# Uncompress shared libraries embedded in an apk.
+#
define uncompress-shared-libs
-$(hide) rm -rf $(dir $@)/tmpworkdir
-$(hide) mv $@ $@.compressed
-$(hide) mkdir $(dir $@)/tmpworkdir
-$(hide) unzip $@.compressed 'lib/*.so' -d $(dir $@)/tmpworkdir
-$(hide) ( cd $(dir $@)/tmpworkdir && zip -D -r -0 ../$(notdir $@).compressed lib )
-$(hide) mv $@.compressed $@
-$(hide) rm -rf $(dir $@)/tmpworkdir
+$(hide) if unzip -l $@ $(PRIVATE_EMBEDDED_JNI_LIBS) >/dev/null ; then \
+ rm -rf $(dir $@)uncompressedlibs && mkdir $(dir $@)uncompressedlibs; \
+ unzip $@ $(PRIVATE_EMBEDDED_JNI_LIBS) -d $(dir $@)uncompressedlibs && \
+ zip -d $@ 'lib/*.so' && \
+ ( cd $(dir $@)uncompressedlibs && zip -D -r -0 ../$(notdir $@) lib ) && \
+ rm -rf $(dir $@)uncompressedlibs; \
+ fi
endef
define install-dex-debug