Merge "Preserve symlinks in the Soong prebuilt install steps for host binaries and shared libs."
This commit is contained in:
commit
a24c0fe655
|
@ -516,7 +516,11 @@ ifneq ($(LOCAL_INSTALLED_MODULE),$(my_default_test_module))
|
||||||
$(LOCAL_INSTALLED_MODULE): PRIVATE_POST_INSTALL_CMD := $(LOCAL_POST_INSTALL_CMD)
|
$(LOCAL_INSTALLED_MODULE): PRIVATE_POST_INSTALL_CMD := $(LOCAL_POST_INSTALL_CMD)
|
||||||
$(LOCAL_INSTALLED_MODULE): $(LOCAL_BUILT_MODULE)
|
$(LOCAL_INSTALLED_MODULE): $(LOCAL_BUILT_MODULE)
|
||||||
@echo "Install: $@"
|
@echo "Install: $@"
|
||||||
|
ifeq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK))
|
||||||
|
$(copy-file-or-link-to-new-target)
|
||||||
|
else
|
||||||
$(copy-file-to-new-target)
|
$(copy-file-to-new-target)
|
||||||
|
endif
|
||||||
$(PRIVATE_POST_INSTALL_CMD)
|
$(PRIVATE_POST_INSTALL_CMD)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -2554,6 +2554,18 @@ $(hide) rm -f $@
|
||||||
$(hide) cp $< $@
|
$(hide) cp $< $@
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
# The same as copy-file-to-new-target, but preserve symlinks. Symlinks are
|
||||||
|
# converted to absolute to not break.
|
||||||
|
define copy-file-or-link-to-new-target
|
||||||
|
@mkdir -p $(dir $@)
|
||||||
|
$(hide) rm -f $@
|
||||||
|
$(hide) if [ -h $< ]; then \
|
||||||
|
ln -s $$(realpath $<) $@; \
|
||||||
|
else \
|
||||||
|
cp $< $@; \
|
||||||
|
fi
|
||||||
|
endef
|
||||||
|
|
||||||
# Copy a prebuilt file to a target location.
|
# Copy a prebuilt file to a target location.
|
||||||
define transform-prebuilt-to-target
|
define transform-prebuilt-to-target
|
||||||
@echo "$($(PRIVATE_PREFIX)DISPLAY) Prebuilt: $(PRIVATE_MODULE) ($@)"
|
@echo "$($(PRIVATE_PREFIX)DISPLAY) Prebuilt: $(PRIVATE_MODULE) ($@)"
|
||||||
|
@ -2566,6 +2578,13 @@ define transform-prebuilt-to-target-strip-comments
|
||||||
$(copy-file-to-target-strip-comments)
|
$(copy-file-to-target-strip-comments)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
# Copy a prebuilt file to a target location, but preserve symlinks rather than
|
||||||
|
# dereference them.
|
||||||
|
define copy-or-link-prebuilt-to-target
|
||||||
|
@echo "$($(PRIVATE_PREFIX)DISPLAY) Prebuilt: $(PRIVATE_MODULE) ($@)"
|
||||||
|
$(copy-file-or-link-to-new-target)
|
||||||
|
endef
|
||||||
|
|
||||||
# Copy a list of files/directories to target location, with sub dir structure preserved.
|
# Copy a list of files/directories to target location, with sub dir structure preserved.
|
||||||
# For example $(HOST_OUT_EXECUTABLES)/aapt -> $(staging)/bin/aapt .
|
# For example $(HOST_OUT_EXECUTABLES)/aapt -> $(staging)/bin/aapt .
|
||||||
# $(1): the source list of files/directories.
|
# $(1): the source list of files/directories.
|
||||||
|
|
|
@ -142,8 +142,16 @@ ifeq ($(my_check_same_vndk_variants),true)
|
||||||
$(LOCAL_BUILT_MODULE): $(same_vndk_variants_stamp)
|
$(LOCAL_BUILT_MODULE): $(same_vndk_variants_stamp)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Use copy-or-link-prebuilt-to-target for host executables and shared libraries,
|
||||||
|
# to preserve symlinks to the source trees. They can then run directly from the
|
||||||
|
# prebuilt directories where the linker can load their dependencies using
|
||||||
|
# relative RUNPATHs.
|
||||||
$(LOCAL_BUILT_MODULE): $(LOCAL_PREBUILT_MODULE_FILE)
|
$(LOCAL_BUILT_MODULE): $(LOCAL_PREBUILT_MODULE_FILE)
|
||||||
|
ifeq ($(LOCAL_IS_HOST_MODULE) $(if $(filter EXECUTABLES SHARED_LIBRARIES NATIVE_TESTS,$(LOCAL_MODULE_CLASS)),true,),true true)
|
||||||
|
$(copy-or-link-prebuilt-to-target)
|
||||||
|
else
|
||||||
$(transform-prebuilt-to-target)
|
$(transform-prebuilt-to-target)
|
||||||
|
endif
|
||||||
ifneq ($(filter EXECUTABLES NATIVE_TESTS,$(LOCAL_MODULE_CLASS)),)
|
ifneq ($(filter EXECUTABLES NATIVE_TESTS,$(LOCAL_MODULE_CLASS)),)
|
||||||
$(hide) chmod +x $@
|
$(hide) chmod +x $@
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -57,7 +57,11 @@ ifdef LOCAL_INSTALLED_MODULE
|
||||||
endif
|
endif
|
||||||
|
|
||||||
$(LOCAL_BUILT_MODULE): $(LOCAL_PREBUILT_MODULE_FILE)
|
$(LOCAL_BUILT_MODULE): $(LOCAL_PREBUILT_MODULE_FILE)
|
||||||
|
ifeq ($(LOCAL_IS_HOST_MODULE) $(if $(filter EXECUTABLES SHARED_LIBRARIES NATIVE_TESTS,$(LOCAL_MODULE_CLASS)),true,),true true)
|
||||||
|
$(copy-or-link-prebuilt-to-target)
|
||||||
|
else
|
||||||
$(transform-prebuilt-to-target)
|
$(transform-prebuilt-to-target)
|
||||||
|
endif
|
||||||
ifneq ($(filter EXECUTABLES NATIVE_TESTS,$(LOCAL_MODULE_CLASS)),)
|
ifneq ($(filter EXECUTABLES NATIVE_TESTS,$(LOCAL_MODULE_CLASS)),)
|
||||||
$(hide) chmod +x $@
|
$(hide) chmod +x $@
|
||||||
endif
|
endif
|
||||||
|
|
Loading…
Reference in New Issue