Commit a0ab29b9 authored by Jack Palevich's avatar Jack Palevich
Browse files

Add LOCAL_JNI_SHARED_LIBRARIES_ABI build variable.

LOCAL_JNI_SHARED_LIBRARIES_ABI allows individual APKs to specify
specify the path where JNI shared libraries are stored in the APK. This
is useful if you want to build an APK that supports a generic version of
an ABI (e.g. armeabi) from a device configuration where
TARGET_CPU_ABI is set to a more specific version of an ABI (e.g.
armeabi-v7a.)

Note that specifying the LOCAL_JNI_SHARED_LIBRARIES_ABI does not
affect how the local JNI shared libraries are built. It just controls
where the local JNI shared libraries are placed within the APK.

Defaults to TARGET_CPU_ABI.

Change-Id: I1cbb293e0c953688945fc147c7fc367421cf860b
parent 840182d8
......@@ -79,6 +79,7 @@ LOCAL_COMPRESS_MODULE_SYMBOLS:=
LOCAL_STRIP_MODULE:=
LOCAL_POST_PROCESS_COMMAND:=true
LOCAL_JNI_SHARED_LIBRARIES:=
LOCAL_JNI_SHARED_LIBRARIES_ABI:=
LOCAL_JAR_MANIFEST:=
LOCAL_INSTRUMENTATION_FOR:=
LOCAL_INSTRUMENTATION_FOR_PACKAGE_NAME:=
......
......@@ -1408,8 +1408,8 @@ endef
define add-jni-shared-libs-to-package
$(hide) rm -rf $(dir $@)lib
$(hide) mkdir -p $(dir $@)lib/$(TARGET_CPU_ABI)
$(hide) cp $(PRIVATE_JNI_SHARED_LIBRARIES) $(dir $@)lib/$(TARGET_CPU_ABI)
$(hide) mkdir -p $(dir $@)lib/$(PRIVATE_JNI_SHARED_LIBRARIES_ABI)
$(hide) cp $(PRIVATE_JNI_SHARED_LIBRARIES) $(dir $@)lib/$(PRIVATE_JNI_SHARED_LIBRARIES_ABI)
$(hide) (cd $(dir $@) && zip -r $(notdir $@) lib)
$(hide) rm -rf $(dir $@)lib
endef
......
......@@ -278,6 +278,16 @@ jni_shared_libraries := \
$(addsuffix $(so_suffix), \
$(LOCAL_JNI_SHARED_LIBRARIES)))
# Set the abi directory used by the local JNI shared libraries.
# (Doesn't change how the local shared libraries are compiled, just
# sets where they are stored in the apk.)
ifeq ($(LOCAL_JNI_SHARED_LIBRARIES_ABI),)
jni_shared_libraries_abi := $(TARGET_CPU_ABI)
else
jni_shared_libraries_abi := $(LOCAL_JNI_SHARED_LIBRARIES_ABI)
endif
# Pick a key to sign the package with. If this package hasn't specified
# an explicit certificate, use the default.
# Secure release builds will have their packages signed after the fact,
......@@ -311,6 +321,7 @@ PACKAGES.$(LOCAL_PACKAGE_NAME).CERTIFICATE := $(certificate)
# Define the rule to build the actual package.
$(LOCAL_BUILT_MODULE): $(AAPT) | $(ZIPALIGN)
$(LOCAL_BUILT_MODULE): PRIVATE_JNI_SHARED_LIBRARIES := $(jni_shared_libraries)
$(LOCAL_BUILT_MODULE): PRIVATE_JNI_SHARED_LIBRARIES_ABI := $(jni_shared_libraries_abi)
ifneq ($(TARGET_BUILD_APPS),)
# Include all resources for unbundled apps.
$(LOCAL_BUILT_MODULE): PRODUCT_AAPT_CONFIG :=
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment