summaryrefslogtreecommitdiffstats
path: root/core/definitions.mk
diff options
context:
space:
mode:
authorYing Wang <wangying@google.com>2015-07-15 18:33:24 -0700
committerYing Wang <wangying@google.com>2015-07-15 18:34:20 -0700
commit1f8964d388265672b3fefc904c6cd61b0de70fc9 (patch)
tree5deb9ef3f09e3bcb8f44cb549ce9657ecb893eaa /core/definitions.mk
parent6b74f21a4d3ff7ed7bb8463210263e9ecb27830a (diff)
downloadbuild-1f8964d388265672b3fefc904c6cd61b0de70fc9.zip
build-1f8964d388265672b3fefc904c6cd61b0de70fc9.tar.gz
build-1f8964d388265672b3fefc904c6cd61b0de70fc9.tar.bz2
Don't uncompress/page-align the jni libraries in apps_only build.
Don't uncompress/page-align the jni libraries in apps_only build, because the apk may be run on older platforms that don't support loading jni directly from apk. When prebuilt apks are installed to platform build, the build system will automatically uncompress/page-align the prebuit apks in M and downstream, so no need to uncompress/page-align in the apps_only build either. Bug: 22491084 Change-Id: I67e977b2592800ae467450592069843b4e5fc466
Diffstat (limited to 'core/definitions.mk')
-rw-r--r--core/definitions.mk15
1 files changed, 13 insertions, 2 deletions
diff --git a/core/definitions.mk b/core/definitions.mk
index fcd5c1a..78b0a39 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -2026,13 +2026,23 @@ $(hide) cp $(2) $(dir $@)lib/$(1)
endef
+# For apps_only build, don't uncompress/page-align the jni libraries,
+# because the apk may be run on older platforms that don't support loading jni directly from apk.
+ifdef TARGET_BUILD_APPS
+JNI_COMPRESS_FLAGS :=
+ZIPALIGN_PAGE_ALIGN_FLAGS :=
+else
+JNI_COMPRESS_FLAGS := -0
+ZIPALIGN_PAGE_ALIGN_FLAGS := -p
+endif
+
define add-jni-shared-libs-to-package
$(hide) rm -rf $(dir $@)lib
$(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 -0 $(notdir $@) lib)
+$(hide) (cd $(dir $@) && zip -r $(JNI_COMPRESS_FLAGS) $(notdir $@) lib)
$(hide) rm -rf $(dir $@)lib
endef
@@ -2078,7 +2088,8 @@ endef
define align-package
$(hide) mv $@ $@.unaligned
$(hide) $(ZIPALIGN) \
- -f -p \
+ -f \
+ $(ZIPALIGN_PAGE_ALIGN_FLAGS) \
4 \
$@.unaligned $@.aligned
$(hide) mv $@.aligned $@