forked from openkylin/platform_build
Merge changes from topic "vndk-no-vendor-variant"
* changes: Add support for no-vendor-variant VNDK Add module-target-built-files function
This commit is contained in:
commit
30dda1da5e
|
@ -776,6 +776,10 @@ ALL_MODULES.$(my_register_name).CHECKED := \
|
|||
$(ALL_MODULES.$(my_register_name).CHECKED) $(my_checked_module)
|
||||
ALL_MODULES.$(my_register_name).BUILT := \
|
||||
$(ALL_MODULES.$(my_register_name).BUILT) $(LOCAL_BUILT_MODULE)
|
||||
ifndef LOCAL_IS_HOST_MODULE
|
||||
ALL_MODULES.$(my_register_name).TARGET_BUILT := \
|
||||
$(ALL_MODULES.$(my_register_name).TARGET_BUILT) $(LOCAL_BUILT_MODULE)
|
||||
endif
|
||||
ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
|
||||
ALL_MODULES.$(my_register_name).INSTALLED := \
|
||||
$(strip $(ALL_MODULES.$(my_register_name).INSTALLED) \
|
||||
|
|
|
@ -1214,17 +1214,17 @@ else ifdef LOCAL_USE_VNDK
|
|||
# with vendor_available: false
|
||||
my_link_type := native:vendor
|
||||
my_warn_types :=
|
||||
my_allowed_types := native:vendor native:vndk
|
||||
my_allowed_types := native:vendor native:vndk native:platform_vndk
|
||||
endif
|
||||
else ifneq ($(filter $(TARGET_RECOVERY_OUT)/%,$(call get_non_asan_path,$(LOCAL_MODULE_PATH))),)
|
||||
my_link_type := native:recovery
|
||||
my_warn_types :=
|
||||
# TODO(b/113303515) remove native:platform and my_allowed_ndk_types
|
||||
my_allowed_types := native:recovery native:platform $(my_allowed_ndk_types)
|
||||
my_allowed_types := native:recovery native:platform native:platform_vndk $(my_allowed_ndk_types)
|
||||
else
|
||||
my_link_type := native:platform
|
||||
my_warn_types := $(my_warn_ndk_types)
|
||||
my_allowed_types := $(my_allowed_ndk_types) native:platform
|
||||
my_allowed_types := $(my_allowed_ndk_types) native:platform native:platform_vndk
|
||||
endif
|
||||
|
||||
my_link_deps := $(addprefix STATIC_LIBRARIES:,$(my_whole_static_libraries) $(my_static_libraries))
|
||||
|
|
|
@ -296,6 +296,7 @@ LOCAL_USE_VNDK:=
|
|||
LOCAL_USES_LIBRARIES:=
|
||||
LOCAL_VENDOR_MODULE:=
|
||||
LOCAL_VINTF_FRAGMENTS:=
|
||||
LOCAL_VNDK_DEPEND_ON_CORE_VARIANT:=
|
||||
LOCAL_VTSC_FLAGS:=
|
||||
LOCAL_VTS_INCLUDES:=
|
||||
LOCAL_VTS_MODE:=
|
||||
|
|
|
@ -649,6 +649,18 @@ define module-installed-files
|
|||
$(foreach module,$(1),$(ALL_MODULES.$(module).INSTALLED))
|
||||
endef
|
||||
|
||||
###########################################################
|
||||
## Convert a list of short modules names (e.g., "framework", "Browser")
|
||||
## into the list of files that are built *for the target* for those modules.
|
||||
## NOTE: this won't return reliable results until after all
|
||||
## sub-makefiles have been included.
|
||||
## $(1): target list
|
||||
###########################################################
|
||||
|
||||
define module-target-built-files
|
||||
$(foreach module,$(1),$(ALL_MODULES.$(module).TARGET_BUILT))
|
||||
endef
|
||||
|
||||
###########################################################
|
||||
## Convert a list of short modules names (e.g., "framework", "Browser")
|
||||
## into the list of files that should be used when linking
|
||||
|
@ -3386,3 +3398,19 @@ $(KATI_obsolete_var \
|
|||
initialize-package-file \
|
||||
add-jni-shared-libs-to-package,\
|
||||
These functions have been removed)
|
||||
|
||||
###########################################################
|
||||
## Verify the variants of a VNDK library are identical
|
||||
##
|
||||
## $(1): Path to the core variant shared library file.
|
||||
## $(2): Path to the vendor variant shared library file.
|
||||
## $(3): TOOLS_PREFIX
|
||||
###########################################################
|
||||
LIBRARY_IDENTITY_CHECK_SCRIPT := build/make/tools/check_identical_lib.sh
|
||||
define verify-vndk-libs-identical
|
||||
@echo "Checking VNDK vendor variant: $(2)"
|
||||
$(hide) CLANG_BIN="$(LLVM_PREBUILTS_PATH)" \
|
||||
CROSS_COMPILE="$(strip $(3))" \
|
||||
XZ="$(XZ)" \
|
||||
$(LIBRARY_IDENTITY_CHECK_SCRIPT) $(SOONG_STRIP_PATH) $(1) $(2)
|
||||
endef
|
||||
|
|
|
@ -67,6 +67,7 @@ endif
|
|||
ALL_MODULES += $(dpi_apk_name)
|
||||
ALL_MODULES.$(dpi_apk_name).CLASS := APPS
|
||||
ALL_MODULES.$(dpi_apk_name).BUILT := $(built_dpi_apk)
|
||||
ALL_MODULES.$(dpi_apk_name).TARGET_BUILT := $(built_dpi_apk)
|
||||
PACKAGES := $(PACKAGES) $(dpi_apk_name)
|
||||
PACKAGES.$(dpi_apk_name).PRIVATE_KEY := $(private_key)
|
||||
PACKAGES.$(dpi_apk_name).CERTIFICATE := $(certificate)
|
||||
|
|
|
@ -113,12 +113,12 @@ my_link_type := app:sdk
|
|||
my_warn_types := native:platform $(my_warn_ndk_types)
|
||||
my_allowed_types := $(my_allowed_ndk_types)
|
||||
ifneq (,$(filter true,$(LOCAL_VENDOR_MODULE) $(LOCAL_ODM_MODULE) $(LOCAL_PROPRIETARY_MODULE)))
|
||||
my_allowed_types += native:vendor native:vndk
|
||||
my_allowed_types += native:vendor native:vndk native:platform_vndk
|
||||
endif
|
||||
else
|
||||
my_link_type := app:platform
|
||||
my_warn_types := $(my_warn_ndk_types)
|
||||
my_allowed_types := $(my_allowed_ndk_types) native:platform native:vendor native:vndk native:vndk_private
|
||||
my_allowed_types := $(my_allowed_ndk_types) native:platform native:vendor native:vndk native:vndk_private native:platform_vndk
|
||||
endif
|
||||
|
||||
my_link_deps := $(addprefix SHARED_LIBRARIES:,$(LOCAL_JNI_SHARED_LIBRARIES))
|
||||
|
|
|
@ -501,6 +501,10 @@ ifndef subdir_makefiles_total
|
|||
subdir_makefiles_total := $(words init post finish)
|
||||
endif
|
||||
|
||||
droid_targets: no_vendor_variant_vndk_check
|
||||
.PHONY: no_vendor_variant_vndk_check
|
||||
no_vendor_variant_vndk_check:
|
||||
|
||||
$(info [$(call inc_and_print,subdir_makefiles_inc)/$(subdir_makefiles_total)] finishing build rules ...)
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
|
|
|
@ -86,11 +86,13 @@ ifneq ($(filter STATIC_LIBRARIES SHARED_LIBRARIES HEADER_LIBRARIES,$(LOCAL_MODUL
|
|||
endif
|
||||
|
||||
ifdef LOCAL_USE_VNDK
|
||||
name_without_suffix := $(patsubst %.vendor,%,$(LOCAL_MODULE))
|
||||
ifneq ($(name_without_suffix),$(LOCAL_MODULE)
|
||||
SPLIT_VENDOR.$(LOCAL_MODULE_CLASS).$(name_without_suffix) := 1
|
||||
ifneq ($(LOCAL_VNDK_DEPEND_ON_CORE_VARIANT),true)
|
||||
name_without_suffix := $(patsubst %.vendor,%,$(LOCAL_MODULE))
|
||||
ifneq ($(name_without_suffix),$(LOCAL_MODULE)
|
||||
SPLIT_VENDOR.$(LOCAL_MODULE_CLASS).$(name_without_suffix) := 1
|
||||
endif
|
||||
name_without_suffix :=
|
||||
endif
|
||||
name_without_suffix :=
|
||||
endif
|
||||
|
||||
# Check prebuilt ELF binaries.
|
||||
|
@ -113,27 +115,52 @@ ifdef LOCAL_INSTALLED_MODULE
|
|||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(LOCAL_VNDK_DEPEND_ON_CORE_VARIANT),true)
|
||||
# Add $(LOCAL_BUILT_MODULE) as a dependency to no_vendor_variant_vndk_check so
|
||||
# that the vendor variant will be built and checked against the core variant.
|
||||
no_vendor_variant_vndk_check: $(LOCAL_BUILT_MODULE)
|
||||
|
||||
my_core_register_name := $(subst .vendor,,$(my_register_name))
|
||||
my_core_variant_files := $(call module-target-built-files,$(my_core_register_name))
|
||||
my_core_shared_lib := $(sort $(filter %.so,$(my_core_variant_files)))
|
||||
$(LOCAL_BUILT_MODULE): PRIVATE_CORE_VARIANT := $(my_core_shared_lib)
|
||||
|
||||
# The built vendor variant library needs to depend on the built core variant
|
||||
# so that we can perform identity check against the core variant.
|
||||
$(LOCAL_BUILT_MODULE): $(my_core_shared_lib)
|
||||
endif
|
||||
|
||||
ifeq ($(LOCAL_VNDK_DEPEND_ON_CORE_VARIANT),true)
|
||||
$(LOCAL_BUILT_MODULE): $(LOCAL_PREBUILT_MODULE_FILE) $(LIBRARY_IDENTITY_CHECK_SCRIPT)
|
||||
$(call verify-vndk-libs-identical,\
|
||||
$(PRIVATE_CORE_VARIANT),\
|
||||
$<,\
|
||||
$($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)TOOLS_PREFIX))
|
||||
$(copy-file-to-target)
|
||||
else
|
||||
$(LOCAL_BUILT_MODULE): $(LOCAL_PREBUILT_MODULE_FILE)
|
||||
$(transform-prebuilt-to-target)
|
||||
endif
|
||||
ifneq ($(filter EXECUTABLES NATIVE_TESTS,$(LOCAL_MODULE_CLASS)),)
|
||||
$(hide) chmod +x $@
|
||||
endif
|
||||
|
||||
ifndef LOCAL_IS_HOST_MODULE
|
||||
ifdef LOCAL_SOONG_UNSTRIPPED_BINARY
|
||||
my_symbol_path := $(if $(LOCAL_SOONG_SYMBOL_PATH),$(LOCAL_SOONG_SYMBOL_PATH),$(my_module_path))
|
||||
# Store a copy with symbols for symbolic debugging
|
||||
my_unstripped_path := $(TARGET_OUT_UNSTRIPPED)/$(patsubst $(PRODUCT_OUT)/%,%,$(my_symbol_path))
|
||||
# drop /root as /root is mounted as /
|
||||
my_unstripped_path := $(patsubst $(TARGET_OUT_UNSTRIPPED)/root/%,$(TARGET_OUT_UNSTRIPPED)/%, $(my_unstripped_path))
|
||||
symbolic_output := $(my_unstripped_path)/$(my_installed_module_stem)
|
||||
$(eval $(call copy-one-file,$(LOCAL_SOONG_UNSTRIPPED_BINARY),$(symbolic_output)))
|
||||
$(call add-dependency,$(LOCAL_BUILT_MODULE),$(symbolic_output))
|
||||
ifneq ($(LOCAL_VNDK_DEPEND_ON_CORE_VARIANT),true)
|
||||
my_symbol_path := $(if $(LOCAL_SOONG_SYMBOL_PATH),$(LOCAL_SOONG_SYMBOL_PATH),$(my_module_path))
|
||||
# Store a copy with symbols for symbolic debugging
|
||||
my_unstripped_path := $(TARGET_OUT_UNSTRIPPED)/$(patsubst $(PRODUCT_OUT)/%,%,$(my_symbol_path))
|
||||
# drop /root as /root is mounted as /
|
||||
my_unstripped_path := $(patsubst $(TARGET_OUT_UNSTRIPPED)/root/%,$(TARGET_OUT_UNSTRIPPED)/%, $(my_unstripped_path))
|
||||
symbolic_output := $(my_unstripped_path)/$(my_installed_module_stem)
|
||||
$(eval $(call copy-one-file,$(LOCAL_SOONG_UNSTRIPPED_BINARY),$(symbolic_output)))
|
||||
$(call add-dependency,$(LOCAL_BUILT_MODULE),$(symbolic_output))
|
||||
|
||||
ifeq ($(BREAKPAD_GENERATE_SYMBOLS),true)
|
||||
my_breakpad_path := $(TARGET_OUT_BREAKPAD)/$(patsubst $(PRODUCT_OUT)/%,%,$(my_symbol_path))
|
||||
breakpad_output := $(my_breakpad_path)/$(my_installed_module_stem).sym
|
||||
$(breakpad_output) : $(LOCAL_SOONG_UNSTRIPPED_BINARY) | $(BREAKPAD_DUMP_SYMS) $(PRIVATE_READELF)
|
||||
ifeq ($(BREAKPAD_GENERATE_SYMBOLS),true)
|
||||
my_breakpad_path := $(TARGET_OUT_BREAKPAD)/$(patsubst $(PRODUCT_OUT)/%,%,$(my_symbol_path))
|
||||
breakpad_output := $(my_breakpad_path)/$(my_installed_module_stem).sym
|
||||
$(breakpad_output) : $(LOCAL_SOONG_UNSTRIPPED_BINARY) | $(BREAKPAD_DUMP_SYMS) $(PRIVATE_READELF)
|
||||
@echo "target breakpad: $(PRIVATE_MODULE) ($@)"
|
||||
@mkdir -p $(dir $@)
|
||||
$(hide) if $(PRIVATE_READELF) -S $< > /dev/null 2>&1 ; then \
|
||||
|
@ -142,7 +169,8 @@ ifndef LOCAL_IS_HOST_MODULE
|
|||
echo "skipped for non-elf file."; \
|
||||
touch $@; \
|
||||
fi
|
||||
$(call add-dependency,$(LOCAL_BUILT_MODULE),$(breakpad_output))
|
||||
$(call add-dependency,$(LOCAL_BUILT_MODULE),$(breakpad_output))
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
|
|
@ -115,6 +115,8 @@ $(call add_json_list, ModulesLoadedByPrivilegedModules, $(PRODUCT_LOADED_BY_PRI
|
|||
|
||||
$(call add_json_list, BootJars, $(PRODUCT_BOOT_JARS))
|
||||
|
||||
$(call add_json_bool, VndkUseCoreVariant, $(TARGET_VNDK_USE_CORE_VARIANT))
|
||||
|
||||
$(call add_json_bool, Product_is_iot, $(filter true,$(PRODUCT_IOT)))
|
||||
|
||||
$(call add_json_bool, Treble_linker_namespaces, $(filter true,$(PRODUCT_TREBLE_LINKER_NAMESPACES)))
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
STRIP_PATH="${1}"
|
||||
CORE="${2}"
|
||||
VENDOR="${3}"
|
||||
|
||||
stripped_core="${CORE}.vndk_lib_check.stripped"
|
||||
stripped_vendor="${VENDOR}.vndk_lib_check.stripped"
|
||||
|
||||
function cleanup() {
|
||||
rm -f ${stripped_core} ${stripped_vendor}
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
function strip_lib() {
|
||||
${STRIP_PATH} \
|
||||
-i ${1} \
|
||||
-o ${2} \
|
||||
-d /dev/null \
|
||||
--remove-build-id
|
||||
}
|
||||
|
||||
strip_lib ${CORE} ${stripped_core}
|
||||
strip_lib ${VENDOR} ${stripped_vendor}
|
||||
if ! cmp -s ${stripped_core} ${stripped_vendor}; then
|
||||
echo "VNDK library not in vndkMustUseVendorVariantList but has different core and vendor variant: $(basename ${CORE})"
|
||||
echo "If the two variants need to have different runtime behavior, consider using libvndksupport."
|
||||
exit 1
|
||||
fi
|
Loading…
Reference in New Issue