2014-04-18 04:38:04 +08:00
|
|
|
# Decides how to install the jni libraries needed by an apk.
|
|
|
|
# Input variables:
|
2014-06-25 11:01:52 +08:00
|
|
|
# my_module_multilib, LOCAL_2ND_ARCH_VAR_PREFIX (from package.mk or prebuilt.mk)
|
2014-04-18 04:38:04 +08:00
|
|
|
# rs_compatibility_jni_libs (from java.mk)
|
|
|
|
# my_module_path (from base_rules.mk)
|
|
|
|
# partition_tag (from base_rules.mk)
|
2014-04-19 11:13:41 +08:00
|
|
|
# my_prebuilt_src_file (from prebuilt_internal.mk)
|
2014-04-18 04:38:04 +08:00
|
|
|
#
|
|
|
|
# Output variables:
|
2014-06-25 11:01:52 +08:00
|
|
|
# jni_shared_libraries, jni_shared_libraries_abi, jni_shared_libraries_with_abis if we are going to embed the libraries into the apk;
|
2015-05-02 05:02:26 +08:00
|
|
|
# embedded_prebuilt_jni_libs, prebuilt jni libs embedded in prebuilt apk.
|
2014-04-18 04:38:04 +08:00
|
|
|
#
|
|
|
|
|
|
|
|
my_embed_jni :=
|
|
|
|
ifneq ($(TARGET_BUILD_APPS),)
|
2019-03-21 22:51:35 +08:00
|
|
|
my_embed_jni := true
|
2014-04-18 04:38:04 +08:00
|
|
|
endif
|
|
|
|
ifneq ($(filter tests samples, $(LOCAL_MODULE_TAGS)),)
|
2019-03-21 22:51:35 +08:00
|
|
|
my_embed_jni := true
|
2014-04-18 04:38:04 +08:00
|
|
|
endif
|
2018-08-29 20:42:09 +08:00
|
|
|
|
|
|
|
# If the APK is not installed in one of the following partitions, force its libraries
|
|
|
|
# to be embedded inside the APK instead of installed to /<partition>/lib[64]/.
|
|
|
|
supported_partition_patterns := \
|
|
|
|
$(TARGET_OUT)/% \
|
|
|
|
$(TARGET_OUT_VENDOR)/% \
|
|
|
|
$(TARGET_OUT_OEM)/% \
|
|
|
|
$(TARGET_OUT_PRODUCT)/% \
|
2019-06-25 14:58:13 +08:00
|
|
|
$(TARGET_OUT_SYSTEM_EXT)/% \
|
2018-08-29 20:42:09 +08:00
|
|
|
|
|
|
|
ifeq ($(filter $(supported_partition_patterns),$(my_module_path)),)
|
2019-03-21 22:51:35 +08:00
|
|
|
my_embed_jni := true
|
2014-04-18 04:38:04 +08:00
|
|
|
endif
|
2018-08-29 20:42:09 +08:00
|
|
|
|
2017-08-07 19:31:17 +08:00
|
|
|
# If we're installing this APP as a compressed module, we include all JNI libraries
|
|
|
|
# in the compressed artifact, rather than as separate files on the partition in question.
|
|
|
|
ifdef LOCAL_COMPRESSED_MODULE
|
2019-03-21 22:51:35 +08:00
|
|
|
my_embed_jni := true
|
2017-08-07 19:31:17 +08:00
|
|
|
endif
|
2014-04-18 04:38:04 +08:00
|
|
|
|
2014-06-25 11:01:52 +08:00
|
|
|
jni_shared_libraries :=
|
|
|
|
jni_shared_libraries_abis :=
|
|
|
|
# jni_shared_libraries_with_abis is a list of <abi>:<path-to-the-built-jni-lib>
|
|
|
|
jni_shared_libraries_with_abis :=
|
2015-05-02 05:02:26 +08:00
|
|
|
embedded_prebuilt_jni_libs :=
|
2014-04-19 11:13:41 +08:00
|
|
|
|
2014-06-25 11:01:52 +08:00
|
|
|
#######################################
|
|
|
|
# For TARGET_ARCH
|
|
|
|
my_2nd_arch_prefix :=
|
|
|
|
my_add_jni :=
|
|
|
|
# The module is built for TARGET_ARCH
|
|
|
|
ifeq ($(my_2nd_arch_prefix),$(LOCAL_2ND_ARCH_VAR_PREFIX))
|
2019-03-21 22:51:35 +08:00
|
|
|
my_add_jni := true
|
2014-04-18 04:38:04 +08:00
|
|
|
endif
|
2014-06-25 11:01:52 +08:00
|
|
|
# Or it explicitly requires both
|
|
|
|
ifeq ($(my_module_multilib),both)
|
2019-03-21 22:51:35 +08:00
|
|
|
my_add_jni := true
|
2014-04-18 04:38:04 +08:00
|
|
|
endif
|
2014-06-25 11:01:52 +08:00
|
|
|
ifeq ($(my_add_jni),true)
|
2019-03-21 22:51:35 +08:00
|
|
|
my_prebuilt_jni_libs := $(LOCAL_PREBUILT_JNI_LIBS_$(TARGET_ARCH))
|
|
|
|
ifndef my_prebuilt_jni_libs
|
|
|
|
my_prebuilt_jni_libs := $(LOCAL_PREBUILT_JNI_LIBS)
|
|
|
|
endif
|
|
|
|
include $(BUILD_SYSTEM)/install_jni_libs_internal.mk
|
|
|
|
jni_shared_libraries += $(my_jni_shared_libraries)
|
|
|
|
jni_shared_libraries_abis += $(my_jni_shared_libraries_abi)
|
|
|
|
jni_shared_libraries_with_abis += $(addprefix $(my_jni_shared_libraries_abi):,\
|
|
|
|
$(my_jni_shared_libraries))
|
|
|
|
embedded_prebuilt_jni_libs += $(my_embedded_prebuilt_jni_libs)
|
2014-04-18 04:38:04 +08:00
|
|
|
|
2019-03-21 22:51:35 +08:00
|
|
|
# Include RS dynamically-generated libraries as well
|
|
|
|
# TODO: Add multilib support once RS supports generating multilib libraries.
|
|
|
|
jni_shared_libraries += $(rs_compatibility_jni_libs)
|
|
|
|
jni_shared_libraries_with_abis += $(addprefix $(my_jni_shared_libraries_abi):,\
|
|
|
|
$(rs_compatibility_jni_libs))
|
2014-06-25 11:01:52 +08:00
|
|
|
endif # my_add_jni
|
2014-04-18 04:38:04 +08:00
|
|
|
|
2014-06-25 11:01:52 +08:00
|
|
|
#######################################
|
|
|
|
# For TARGET_2ND_ARCH
|
|
|
|
ifdef TARGET_2ND_ARCH
|
2019-03-21 22:51:35 +08:00
|
|
|
my_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
|
|
|
|
my_add_jni :=
|
|
|
|
# The module is built for TARGET_2ND_ARCH
|
|
|
|
ifeq ($(my_2nd_arch_prefix),$(LOCAL_2ND_ARCH_VAR_PREFIX))
|
|
|
|
my_add_jni := true
|
|
|
|
endif
|
|
|
|
# Or it explicitly requires both
|
|
|
|
ifeq ($(my_module_multilib),both)
|
|
|
|
my_add_jni := true
|
|
|
|
endif
|
|
|
|
ifeq ($(my_add_jni),true)
|
|
|
|
my_prebuilt_jni_libs := $(LOCAL_PREBUILT_JNI_LIBS_$(TARGET_2ND_ARCH))
|
|
|
|
ifndef my_prebuilt_jni_libs
|
|
|
|
my_prebuilt_jni_libs := $(LOCAL_PREBUILT_JNI_LIBS)
|
|
|
|
endif
|
|
|
|
include $(BUILD_SYSTEM)/install_jni_libs_internal.mk
|
|
|
|
jni_shared_libraries += $(my_jni_shared_libraries)
|
|
|
|
jni_shared_libraries_abis += $(my_jni_shared_libraries_abi)
|
|
|
|
jni_shared_libraries_with_abis += $(addprefix $(my_jni_shared_libraries_abi):,\
|
|
|
|
$(my_jni_shared_libraries))
|
|
|
|
embedded_prebuilt_jni_libs += $(my_embedded_prebuilt_jni_libs)
|
|
|
|
endif # my_add_jni
|
2014-06-25 11:01:52 +08:00
|
|
|
endif # TARGET_2ND_ARCH
|
2014-04-19 11:13:41 +08:00
|
|
|
|
2014-06-25 11:01:52 +08:00
|
|
|
jni_shared_libraries := $(strip $(jni_shared_libraries))
|
|
|
|
jni_shared_libraries_abis := $(sort $(jni_shared_libraries_abis))
|
|
|
|
jni_shared_libraries_with_abis := $(strip $(jni_shared_libraries_with_abis))
|
2015-05-02 05:02:26 +08:00
|
|
|
embedded_prebuilt_jni_libs := $(strip $(embedded_prebuilt_jni_libs))
|