# Install jni libraries for one arch. # Input variables: # my_2nd_arch_prefix: indicate if this is for TARGET_2ND_ARCH. # my_embed_jni: indicate if we want to embed the jni libs in the apk. # my_prebuilt_jni_libs # my_installed_module_stem (from configure_module_stem.mk) # partition_tag (from base_rules.mk) # partition_lib_pairs # my_prebuilt_src_file (from prebuilt_internal.mk) # # Output variables: # my_jni_shared_libraries, my_jni_shared_libraries_abi, if we are going to embed the libraries into the apk; # my_embedded_prebuilt_jni_libs, prebuilt jni libs embedded in prebuilt apk. #
my_sdk_variant = $(1) ifneq (,$(and $(my_embed_jni),$(LOCAL_SDK_VERSION))) # Soong produces $(lib).so in $(lib).sdk_intermediates so that the library # has the correct name for embedding in an APK. Append .sdk to the name # of the intermediates directory, but not the .so name.
my_sdk_variant = $(call use_soong_sdk_libraries,$(1)) endif
ifdef my_embed_jni # App explicitly requires the prebuilt NDK stl shared libraies. # The NDK stl shared libraries should never go to the system image. ifeq ($(LOCAL_NDK_STL_VARIANT),c++_shared)
ifndef LOCAL_SDK_VERSION
$(error LOCAL_SDK_VERSION must be defined with LOCAL_NDK_STL_VARIANT, \
LOCAL_PACKAGE_NAME=$(LOCAL_PACKAGE_NAME)) endif
my_libcxx_arch := $($(LOCAL_2ND_ARCH_VAR_PREFIX)PREBUILT_LIBCXX_ARCH_DIR)
my_jni_shared_libraries += \
$(LLVM_PREBUILTS_BASE)/$(BUILD_OS)-x86/$(LLVM_PREBUILTS_VERSION)/android_libc++/ndk/$(my_libcxx_arch)/lib/libc++_shared.so endif
# 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),)
my_jni_shared_libraries_abi := $(TARGET_$(my_2nd_arch_prefix)CPU_ABI) else
my_jni_shared_libraries_abi := $(LOCAL_JNI_SHARED_LIBRARIES_ABI) endif
elseifneq ($(my_jni_shared_libraries),) # not my_embed_jni
# The jni libaries will be installed to the system.img.
my_jni_filenames := $(notdir $(my_jni_shared_libraries)) # Make sure the JNI libraries get installed
my_shared_library_path := $(call get_non_asan_path,\
$($(my_2nd_arch_prefix)TARGET_OUT$(partition_tag)_SHARED_LIBRARIES))
# Create symlink in the app specific lib path # Skip creating this symlink when running the second part of a target sanitization build. ifeq ($(filter address,$(SANITIZE_TARGET)),)
my_symlink_target_dir := $(patsubst $(PRODUCT_OUT)%,%,\
$(my_shared_library_path))
ifdef partition_lib_pairs # Support cross-partition jni lib dependency for bp modules # API domain check is done in Soong
$(foreach pl_pair,$(partition_lib_pairs),\
$(eval lib_name := $(call word-colon, 1, $(pl_pair)))\
$(eval lib_partition := $(call word-colon, 2, $(pl_pair)))\
$(eval shared_library_path := $(call get_non_asan_path,\
$($(my_2nd_arch_prefix)TARGET_OUT$(lib_partition)_SHARED_LIBRARIES)))\
$(call symlink-file,\
$(shared_library_path)/$(lib_name).so,\
$(my_symlink_target_dir)/$(lib_name).so,\
$(my_app_lib_path)/$(lib_name).so)\
$(eval $$(LOCAL_INSTALLED_MODULE) : $$(my_app_lib_path)/$$(lib_name).so)\
$(eval ALL_MODULES.$(my_register_name).INSTALLED += $$(my_app_lib_path)/$$(lib_name).so))
# Clear jni_shared_libraries to not embed it into the apk.
my_jni_shared_libraries := endif# my_embed_jni
ifdef my_prebuilt_jni_libs # Files like @lib/<abi>/libfoo.so (path inside the apk) are JNI libs embedded prebuilt apk; # Files like path/to/libfoo.so (path relative to LOCAL_PATH) are prebuilts in the source tree.
my_embedded_prebuilt_jni_libs := $(patsubst @%,%, \
$(filter @%, $(my_prebuilt_jni_libs)))
# prebuilt JNI exsiting as separate source files.
my_prebuilt_jni_libs := $(addprefix $(LOCAL_PATH)/, \
$(filter-out @%, $(my_prebuilt_jni_libs)))
ifdef my_prebuilt_jni_libs
ifdef my_embed_jni # Embed my_prebuilt_jni_libs to the apk
my_jni_shared_libraries += $(my_prebuilt_jni_libs) else# not my_embed_jni # Install my_prebuilt_jni_libs as separate files.
$(foreach lib, $(my_prebuilt_jni_libs), \
$(eval $(callcopy-one-file, $(lib), $(my_app_lib_path)/$(notdir $(lib)))))
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.