forked from openkylin/platform_build
Add support for LOCAL_MODULE_SYMLINKS
Specifying LOCAL_MODULE_SYMLINKS will create symlinks to the installed module in the same directory. Change-Id: Idecb2b75f0c9999eb000eed9a79a989244ccf6c2
This commit is contained in:
parent
4ea20be28b
commit
744d33b381
|
@ -323,6 +323,9 @@ $(foreach c, $(my_path_components),\
|
|||
## Module installation rule
|
||||
###########################################################
|
||||
|
||||
my_init_rc_installed :=
|
||||
my_init_rc_pairs :=
|
||||
my_installed_symlinks :=
|
||||
ifndef LOCAL_UNINSTALLABLE_MODULE
|
||||
$(LOCAL_INSTALLED_MODULE): PRIVATE_POST_INSTALL_CMD := $(LOCAL_POST_INSTALL_CMD)
|
||||
$(LOCAL_INSTALLED_MODULE): $(LOCAL_BUILT_MODULE)
|
||||
|
@ -331,8 +334,6 @@ $(LOCAL_INSTALLED_MODULE): $(LOCAL_BUILT_MODULE)
|
|||
$(PRIVATE_POST_INSTALL_CMD)
|
||||
|
||||
# Rule to install the module's companion init.rc.
|
||||
my_init_rc_installed :=
|
||||
my_init_rc_pairs :=
|
||||
my_init_rc := $(LOCAL_INIT_RC_$(my_32_64_bit_suffix))
|
||||
ifneq ($(my_init_rc),)
|
||||
my_init_rc_pairs += $(LOCAL_PATH)/$(my_init_rc):$(TARGET_OUT$(partition_tag)_ETC)/init/$(notdir $(my_init_rc))
|
||||
|
@ -347,6 +348,12 @@ my_init_rc_installed := $(call copy-many-files,$(my_init_rc_pairs))
|
|||
|
||||
$(my_register_name) : $(my_init_rc_installed)
|
||||
endif # my_init_rc_pairs
|
||||
|
||||
# Rule to install the module's companion symlinks
|
||||
my_installed_symlinks := $(addprefix $(my_module_path)/,$(LOCAL_MODULE_SYMLINKS) $(LOCAL_MODULE_SYMLINKS_$(my_32_64_bit_suffix)))
|
||||
$(foreach symlink,$(my_installed_symlinks),\
|
||||
$(call symlink-file,$(LOCAL_INSTALLED_MODULE),$(my_installed_module_stem),$(symlink)))
|
||||
|
||||
endif # !LOCAL_UNINSTALLABLE_MODULE
|
||||
|
||||
###########################################################
|
||||
|
@ -395,7 +402,7 @@ ALL_MODULES.$(my_register_name).BUILT := \
|
|||
ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
|
||||
ALL_MODULES.$(my_register_name).INSTALLED := \
|
||||
$(strip $(ALL_MODULES.$(my_register_name).INSTALLED) \
|
||||
$(LOCAL_INSTALLED_MODULE) $(my_init_rc_installed))
|
||||
$(LOCAL_INSTALLED_MODULE) $(my_init_rc_installed) $(my_installed_symlinks))
|
||||
ALL_MODULES.$(my_register_name).BUILT_INSTALLED := \
|
||||
$(strip $(ALL_MODULES.$(my_register_name).BUILT_INSTALLED) \
|
||||
$(LOCAL_BUILT_MODULE):$(LOCAL_INSTALLED_MODULE) \
|
||||
|
|
|
@ -192,6 +192,7 @@ LOCAL_SANITIZE_RECOVER:=
|
|||
LOCAL_NOSANITIZE:=
|
||||
LOCAL_DBUS_PROXY_PREFIX:=
|
||||
LOCAL_INIT_RC:=
|
||||
LOCAL_MODULE_SYMLINKS:=
|
||||
LOCAL_MODULE_HOST_OS:=
|
||||
LOCAL_NOTICE_FILE:=
|
||||
# Used to replace the installed file of a presigned prebuilt apk in PDK fusion build,
|
||||
|
@ -355,6 +356,8 @@ LOCAL_CLANG_32:=
|
|||
LOCAL_CLANG_64:=
|
||||
LOCAL_INIT_RC_32:=
|
||||
LOCAL_INIT_RC_64:=
|
||||
LOCAL_MODULE_SYMLINKS_32:=
|
||||
LOCAL_MODULE_SYMLINKS_64:=
|
||||
LOCAL_JAVA_LANGUAGE_VERSION:=
|
||||
LOCAL_CTS_GTEST_LIST_EXECUTABLE:=
|
||||
|
||||
|
|
|
@ -2605,6 +2605,24 @@ $(foreach t,$(1),\
|
|||
$(hide) mkdir -p $(dir $(3)/$(s)); cp -Rf $(t) $(3)/$(s)$(newline))
|
||||
endef
|
||||
|
||||
# Define a rule to create a symlink to a file.
|
||||
# $(1): full path to source
|
||||
# $(2): source (may be relative)
|
||||
# $(3): full path to destination
|
||||
define symlink-file
|
||||
$(eval $(_symlink-file))
|
||||
endef
|
||||
|
||||
# Order-only dependency because make/ninja will follow the link when checking
|
||||
# the timestamp, so the file must exist
|
||||
define _symlink-file
|
||||
$(3): | $(1)
|
||||
@echo "Symlink: $$@ -> $(2)"
|
||||
@mkdir -p $(dir $$@)
|
||||
@rm -rf $$@
|
||||
$(hide) ln -sf $(2) $$@
|
||||
endef
|
||||
|
||||
###########################################################
|
||||
## Commands to call Proguard
|
||||
###########################################################
|
||||
|
|
|
@ -10,43 +10,37 @@
|
|||
# et al. since those variables make no sense in that context.
|
||||
ifneq ($(LOCAL_IS_HOST_MODULE),true)
|
||||
my_symlink := $(addprefix $(TARGET_OUT)/bin/, $(LOCAL_MODULE))
|
||||
my_src_binary_name :=
|
||||
ifeq ($(TARGET_IS_64_BIT),true)
|
||||
ifeq ($(TARGET_SUPPORTS_64_BIT_APPS)|$(TARGET_SUPPORTS_32_BIT_APPS),true|true)
|
||||
# We support both 32 and 64 bit apps, so we will have to
|
||||
# base our decision on whether the target prefers one or the
|
||||
# other.
|
||||
ifeq ($(TARGET_PREFER_32_BIT_APPS),true)
|
||||
$(my_symlink): PRIVATE_SRC_BINARY_NAME := $(LOCAL_MODULE_STEM_32)
|
||||
my_src_binary_name := $(LOCAL_MODULE_STEM_32)
|
||||
else
|
||||
$(my_symlink): PRIVATE_SRC_BINARY_NAME := $(LOCAL_MODULE_STEM_64)
|
||||
my_src_binary_name := $(LOCAL_MODULE_STEM_64)
|
||||
endif
|
||||
else ifeq ($(TARGET_SUPPORTS_64_BIT_APPS),true)
|
||||
# We support only 64 bit apps.
|
||||
$(my_symlink): PRIVATE_SRC_BINARY_NAME := $(LOCAL_MODULE_STEM_64)
|
||||
my_src_binary_name := $(LOCAL_MODULE_STEM_64)
|
||||
else
|
||||
# We support only 32 bit apps.
|
||||
$(my_symlink): PRIVATE_SRC_BINARY_NAME := $(LOCAL_MODULE_STEM_32)
|
||||
my_src_binary_name := $(LOCAL_MODULE_STEM_32)
|
||||
endif
|
||||
else
|
||||
$(my_symlink): PRIVATE_SRC_BINARY_NAME := $(LOCAL_MODULE_STEM_32)
|
||||
my_src_binary_name := $(LOCAL_MODULE_STEM_32)
|
||||
endif
|
||||
else
|
||||
my_symlink := $(addprefix $(HOST_OUT)/bin/, $(LOCAL_MODULE))
|
||||
ifneq ($(HOST_PREFER_32_BIT),true)
|
||||
$(my_symlink): PRIVATE_SRC_BINARY_NAME := $(LOCAL_MODULE_STEM_64)
|
||||
my_src_binary_name := $(LOCAL_MODULE_STEM_64)
|
||||
else
|
||||
$(my_symlink): PRIVATE_SRC_BINARY_NAME := $(LOCAL_MODULE_STEM_32)
|
||||
my_src_binary_name := $(LOCAL_MODULE_STEM_32)
|
||||
endif
|
||||
endif
|
||||
|
||||
# $(my_symlink) doesn't need to depend on $(PRIVATE_SRC_BINARY_NAME): we can generate symlink to nonexistent file.
|
||||
# If you add the dependency, make would compare the timestamp of a file against that of its symlink:
|
||||
# they are always equal, because make follows symlink.
|
||||
$(my_symlink):
|
||||
@echo "Symlink: $@ -> $(PRIVATE_SRC_BINARY_NAME)"
|
||||
@mkdir -p $(dir $@)
|
||||
@rm -rf $@
|
||||
$(hide) ln -sf $(PRIVATE_SRC_BINARY_NAME) $@
|
||||
$(call symlink-file,$(my_module_path)/$(my_src_binary_name),$(my_src_binary_name),$(my_symlink))
|
||||
|
||||
# We need this so that the installed files could be picked up based on the
|
||||
# local module name
|
||||
|
|
Loading…
Reference in New Issue