Merge "Include config files to VNDK snapshot"

am: 2e42c54028

Change-Id: I8bd9c608258475747ec173eb4a3c2d91d460591a
This commit is contained in:
Jae Shin 2017-11-30 11:08:38 +00:00 committed by android-build-merger
commit 6e11749f59

View file

@ -24,72 +24,135 @@ ifeq ($(BOARD_VNDK_VERSION),current)
# Args:
# $(1): if not empty, evaluates for TARGET_2ND_ARCH
define clang-ubsan-vndk-core
$(eval prefix := $(if $(1),2ND_,))
$(addsuffix .vendor,$($(addprefix $(prefix),UBSAN_RUNTIME_LIBRARY)))
$(strip \
$(eval prefix := $(if $(1),2ND_,)) \
$(addsuffix .vendor,$($(addprefix $(prefix),UBSAN_RUNTIME_LIBRARY))) \
)
endef
# Returns list of file paths of the intermediate objs
#
# Args:
# $(1): list of lib names without '.so' suffix (e.g., libX.vendor)
# $(2): if not empty, evaluates for TARGET_2ND_ARCH
# $(1): list of obj names (e.g., libfoo.vendor, ld.config.txt, ...)
# $(2): target class (e.g., SHARED_LIBRARIES, STATIC_LIBRARIES, ETC)
# $(3): if not empty, evaluates for TARGET_2ND_ARCH
define paths-of-intermediates
$(strip \
$(foreach lib,$(1), \
$(call append-path,$(call intermediates-dir-for,SHARED_LIBRARIES,$(lib),,,$(2)),$(lib).so)))
$(strip \
$(foreach obj,$(1), \
$(eval file_name := $(if $(filter SHARED_LIBRARIES,$(2)),$(patsubst %.so,%,$(obj)).so,$(obj))) \
$(eval dir := $(call intermediates-dir-for,$(2),$(obj),,,$(3))) \
$(call append-path,$(dir),$(file_name)) \
) \
)
endef
vndk_core_libs := $(addsuffix .vendor,$(filter-out libclang_rt.ubsan%,$(VNDK_CORE_LIBRARIES)))
vndk_sp_libs := $(addsuffix .vendor,$(VNDK_SAMEPROCESS_LIBRARIES))
vndk_snapshot_dependencies := \
$(vndk_core_libs) \
$(vndk_sp_libs)
# If in the future libclang_rt.ubsan* is removed from the VNDK-core list,
# need to update the related logic in this file.
ifeq (,$(filter libclang_rt.ubsan%,$(VNDK_CORE_LIBRARIES)))
$(error libclang_rt.ubsan* is no longer a VNDK-core library.)
$(warning libclang_rt.ubsan* is no longer a VNDK-core library. Please update this file.)
vndk_core_libs := $(addsuffix .vendor,$(VNDK_CORE_LIBRARIES))
else
vndk_core_libs := $(addsuffix .vendor,$(filter-out libclang_rt.ubsan%,$(VNDK_CORE_LIBRARIES)))
# for TARGET_ARCH
vndk_core_libs += $(call clang-ubsan-vndk-core)
# TODO(b/69834489): Package additional arch variants
# ifdef TARGET_2ND_ARCH
# vndk_core_libs += $(call clang-ubsan-vndk-core,true)
# endif
endif
# for TARGET_ARCH
clang_ubsan_vndk_core_$(TARGET_ARCH) := $(call clang-ubsan-vndk-core)
vndk_snapshot_dependencies += \
$(clang_ubsan_vndk_core_$(TARGET_ARCH))
vndk_sp_libs := $(addsuffix .vendor,$(VNDK_SAMEPROCESS_LIBRARIES))
vndk_private_libs := $(addsuffix .vendor,$(VNDK_PRIVATE_LIBRARIES))
ifdef TARGET_2ND_ARCH
clang_ubsan_vndk_core_$(TARGET_2ND_ARCH) := $(call clang-ubsan-vndk-core,true)
vndk_snapshot_dependencies += \
$(clang_ubsan_vndk_core_$(TARGET_2ND_ARCH))
endif
vndk_snapshot_libs := \
$(vndk_core_libs) \
$(vndk_sp_libs)
vndk_prebuilt_txts := \
ld.config.txt \
vndksp.libraries.txt \
llndk.libraries.txt
vndk_snapshot_top := $(call intermediates-dir-for,PACKAGING,vndk-snapshot)
vndk_snapshot_out := $(vndk_snapshot_top)/vndk-snapshot
vndk_snapshot_configs_out := $(vndk_snapshot_top)/configs
#######################################
# vndkcore.libraries.txt
vndkcore.libraries.txt := $(vndk_snapshot_configs_out)/vndkcore.libraries.txt
$(vndkcore.libraries.txt): $(vndk_core_libs)
@echo 'Generating: $@'
@rm -f $@
@mkdir -p $(dir $@)
$(hide) echo -n > $@
$(hide) $(foreach lib,$^,echo $(patsubst %.vendor,%,$(lib)).so >> $@;)
#######################################
# vndkprivate.libraries.txt
vndkprivate.libraries.txt := $(vndk_snapshot_configs_out)/vndkprivate.libraries.txt
$(vndkprivate.libraries.txt): $(vndk_private_libs)
@echo 'Generating: $@'
@rm -f $@
@mkdir -p $(dir $@)
$(hide) echo -n > $@
$(hide) $(foreach lib,$^,echo $(patsubst %.vendor,%,$(lib)).so >> $@;)
vndk_snapshot_configs := \
$(vndkcore.libraries.txt) \
$(vndkprivate.libraries.txt)
#######################################
# vndk_snapshot_zip
vndk_snapshot_arch := $(vndk_snapshot_out)/arch-$(TARGET_ARCH)-$(TARGET_ARCH_VARIANT)
vndk_snapshot_zip := $(PRODUCT_OUT)/android-vndk-$(TARGET_ARCH).zip
vndk_snapshot_out := $(call intermediates-dir-for,PACKAGING,vndk-snapshot)
$(vndk_snapshot_zip): PRIVATE_VNDK_SNAPSHOT_OUT := $(vndk_snapshot_out)
$(vndk_snapshot_zip): PRIVATE_VNDK_CORE_OUT_$(TARGET_ARCH) := \
$(vndk_snapshot_out)/arch-$(TARGET_ARCH)/shared/vndk-core
$(vndk_snapshot_zip): PRIVATE_VNDK_CORE_INTERMEDIATES_$(TARGET_ARCH) := \
$(call paths-of-intermediates,$(vndk_core_libs) $(clang_ubsan_vndk_core_$(TARGET_ARCH)))
$(vndk_snapshot_zip): PRIVATE_VNDK_SP_OUT_$(TARGET_ARCH) := \
$(vndk_snapshot_out)/arch-$(TARGET_ARCH)/shared/vndk-sp
$(vndk_snapshot_zip): PRIVATE_VNDK_SP_INTERMEDIATES_$(TARGET_ARCH) := \
$(call paths-of-intermediates,$(vndk_sp_libs))
$(vndk_snapshot_zip): PRIVATE_VNDK_CORE_OUT := $(vndk_snapshot_arch)/shared/vndk-core
$(vndk_snapshot_zip): PRIVATE_VNDK_CORE_INTERMEDIATES := \
$(call paths-of-intermediates,$(vndk_core_libs),SHARED_LIBRARIES)
ifdef TARGET_2ND_ARCH
$(vndk_snapshot_zip): PRIVATE_VNDK_CORE_OUT_$(TARGET_2ND_ARCH) := \
$(vndk_snapshot_out)/arch-$(TARGET_2ND_ARCH)/shared/vndk-core
$(vndk_snapshot_zip): PRIVATE_VNDK_CORE_INTERMEDIATES_$(TARGET_2ND_ARCH) := \
$(call paths-of-intermediates,$(vndk_core_libs) $(clang_ubsan_vndk_core_$(TARGET_2ND_ARCH)),true)
$(vndk_snapshot_zip): PRIVATE_VNDK_SP_OUT_$(TARGET_2ND_ARCH) := \
$(vndk_snapshot_out)/arch-$(TARGET_2ND_ARCH)/shared/vndk-sp
$(vndk_snapshot_zip): PRIVATE_VNDK_SP_INTERMEDIATES_$(TARGET_2ND_ARCH) := \
$(call paths-of-intermediates,$(vndk_sp_libs),true)
endif
$(vndk_snapshot_zip): PRIVATE_VNDK_SP_OUT := $(vndk_snapshot_arch)/shared/vndk-sp
$(vndk_snapshot_zip): PRIVATE_VNDK_SP_INTERMEDIATES := \
$(call paths-of-intermediates,$(vndk_sp_libs),SHARED_LIBRARIES)
$(vndk_snapshot_zip): PRIVATE_CONFIGS_OUT := $(vndk_snapshot_arch)/configs
$(vndk_snapshot_zip): PRIVATE_CONFIGS_INTERMEDIATES := \
$(call paths-of-intermediates,$(vndk_prebuilt_txts),ETC) \
$(vndk_snapshot_configs)
# TODO(b/69834489): Package additional arch variants
# ifdef TARGET_2ND_ARCH
# vndk_snapshot_arch_2ND := $(vndk_snapshot_out)/arch-$(TARGET_2ND_ARCH)-$(TARGET_2ND_ARCH_VARIANT)
# $(vndk_snapshot_zip): PRIVATE_VNDK_CORE_OUT_2ND := $(vndk_snapshot_arch_2ND)/shared/vndk-core
# $(vndk_snapshot_zip): PRIVATE_VNDK_CORE_INTERMEDIATES_2ND := \
# $(call paths-of-intermediates,$(vndk_core_libs),SHARED_LIBRARIES,true)
# $(vndk_snapshot_zip): PRIVATE_VNDK_SP_OUT_2ND := $(vndk_snapshot_arch_2ND)/shared/vndk-sp
# $(vndk_snapshot_zip): PRIVATE_VNDK_SP_INTERMEDIATES_2ND := \
# $(call paths-of-intermediates,$(vndk_sp_libs),SHARED_LIBRARIES,true)
# endif
# Args
# $(1): destination directory
# $(2): list of libs to copy
# $(2): list of files to copy
$(vndk_snapshot_zip): private-copy-vndk-intermediates = \
@mkdir -p $(1); \
$(foreach lib,$(2),cp -p $(lib) $(call append-path,$(1),$(subst .vendor,,$(notdir $(lib))));)
$(if $(2),$(strip \
@mkdir -p $(1); \
$(foreach file,$(2), \
if [ -e $(file) ]; then \
cp -p $(file) $(call append-path,$(1),$(subst .vendor,,$(notdir $(file)))); \
fi; \
) \
))
vndk_snapshot_dependencies := \
$(vndk_snapshot_libs) \
$(vndk_prebuilt_txts) \
$(vndk_snapshot_configs)
$(vndk_snapshot_zip): $(vndk_snapshot_dependencies) $(SOONG_ZIP)
@echo 'Generating VNDK snapshot: $@'
@ -97,16 +160,19 @@ $(vndk_snapshot_zip): $(vndk_snapshot_dependencies) $(SOONG_ZIP)
@rm -rf $(PRIVATE_VNDK_SNAPSHOT_OUT)
@mkdir -p $(PRIVATE_VNDK_SNAPSHOT_OUT)
$(call private-copy-vndk-intermediates, \
$(PRIVATE_VNDK_CORE_OUT_$(TARGET_ARCH)),$(PRIVATE_VNDK_CORE_INTERMEDIATES_$(TARGET_ARCH)))
$(PRIVATE_VNDK_CORE_OUT),$(PRIVATE_VNDK_CORE_INTERMEDIATES))
$(call private-copy-vndk-intermediates, \
$(PRIVATE_VNDK_SP_OUT_$(TARGET_ARCH)),$(PRIVATE_VNDK_SP_INTERMEDIATES_$(TARGET_ARCH)))
ifdef TARGET_2ND_ARCH
$(PRIVATE_VNDK_SP_OUT),$(PRIVATE_VNDK_SP_INTERMEDIATES))
$(call private-copy-vndk-intermediates, \
$(PRIVATE_VNDK_CORE_OUT_$(TARGET_2ND_ARCH)),$(PRIVATE_VNDK_CORE_INTERMEDIATES_$(TARGET_2ND_ARCH)))
$(call private-copy-vndk-intermediates, \
$(PRIVATE_VNDK_SP_OUT_$(TARGET_2ND_ARCH)),$(PRIVATE_VNDK_SP_INTERMEDIATES_$(TARGET_2ND_ARCH)))
endif
$(hide) $(SOONG_ZIP) -o $@ -P vndk-snapshot -C $(PRIVATE_VNDK_SNAPSHOT_OUT) \
$(PRIVATE_CONFIGS_OUT),$(PRIVATE_CONFIGS_INTERMEDIATES))
# TODO(b/69834489): Package additional arch variants
# ifdef TARGET_2ND_ARCH
# $(call private-copy-vndk-intermediates, \
# $(PRIVATE_VNDK_CORE_OUT_2ND),$(PRIVATE_VNDK_CORE_INTERMEDIATES_2ND))
# $(call private-copy-vndk-intermediates, \
# $(PRIVATE_VNDK_SP_OUT_2ND),$(PRIVATE_VNDK_SP_INTERMEDIATES_2ND))
# endif
$(hide) $(SOONG_ZIP) -o $@ -P android-vndk-snapshot -C $(PRIVATE_VNDK_SNAPSHOT_OUT) \
-D $(PRIVATE_VNDK_SNAPSHOT_OUT)
.PHONY: vndk
@ -114,6 +180,24 @@ vndk: $(vndk_snapshot_zip)
$(call dist-for-goals, vndk, $(vndk_snapshot_zip))
# clear global vars
clang-ubsan-vndk-core :=
paths-of-intermediates :=
vndk_core_libs :=
vndk_sp_libs :=
vndk_snapshot_libs :=
vndk_prebuilt_txts :=
vndk_snapshot_configs :=
vndk_snapshot_top :=
vndk_snapshot_out :=
vndk_snapshot_configs_out :=
vndk_snapshot_arch :=
vndk_snapshot_dependencies :=
# TODO(b/69834489): Package additional arch variants
# ifdef TARGET_2ND_ARCH
# vndk_snapshot_arch_2ND :=
# endif
else # BOARD_VNDK_VERSION is NOT set to 'current'
.PHONY: vndk