Makefile, skeleton: move the host skeleton logic to host-skeleton package
authorThomas Petazzoni <thomas.petazzoni@bootlin.com>
Sat, 24 Mar 2018 14:20:00 +0000 (15:20 +0100)
committerPeter Korsgaard <peter@korsgaard.com>
Sun, 25 Mar 2018 15:34:54 +0000 (17:34 +0200)
As part of the per-package SDK work, we want to avoid having logic
that installs files to the global HOST_DIR, and instead do it inside
packages. One thing that gets installed to the global HOST_DIR is the
minimal "skeleton" that we create in host:

 - the "usr" symbolic link for backward compatibility

 - the "lib" directory, and its lib64 or lib32 symbolic links

This commit moves this logic to a new host-skeleton package, and makes
all packages (except itself) depend on it.

While at it, use $(Q) instead of @ in the HOST_SKELETON_INSTALL_CMDS.

[Peter: drop host-patchelf reference in commit message]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Makefile
package/pkg-generic.mk
package/skeleton/skeleton.mk

index 1b34818fc8719c039aed8c088d1d63ce40911c40..33c87b5ebb52666588aec14611bccf7fa0e34aa9 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -560,7 +560,7 @@ endif
 
 .PHONY: dirs
 dirs: $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
-       $(HOST_DIR) $(HOST_DIR)/usr $(HOST_DIR)/lib $(BINARIES_DIR)
+       $(HOST_DIR) $(BINARIES_DIR)
 
 $(BUILD_DIR)/buildroot-config/auto.conf: $(BR2_CONFIG)
        $(MAKE1) $(EXTRAMAKEARGS) HOSTCC="$(HOSTCC_NOCCACHE)" HOSTCXX="$(HOSTCXX_NOCCACHE)" silentoldconfig
@@ -579,17 +579,6 @@ sdk: world
        $(INSTALL) -m 755 $(TOPDIR)/support/misc/relocate-sdk.sh $(HOST_DIR)/relocate-sdk.sh
        echo $(HOST_DIR) > $(HOST_DIR)/share/buildroot/sdk-location
 
-# Compatibility symlink in case a post-build script still uses $(HOST_DIR)/usr
-$(HOST_DIR)/usr: $(HOST_DIR)
-       @ln -snf . $@
-
-$(HOST_DIR)/lib: $(HOST_DIR)
-       @mkdir -p $@
-       @case $(HOSTARCH) in \
-               (*64) ln -snf lib $(@D)/lib64;; \
-               (*)   ln -snf lib $(@D)/lib32;; \
-       esac
-
 # Populating the staging with the base directories is handled by the skeleton package
 $(STAGING_DIR):
        @mkdir -p $(STAGING_DIR)
index 5edb4b0838f964f4d76f164c3d676ebb5a36212b..3cadb2859579595fb74d75dd671072ee75bd4d0b 100644 (file)
@@ -551,6 +551,10 @@ $(2)_DEPENDENCIES += toolchain
 endif
 endif
 
+ifneq ($(1),host-skeleton)
+$(2)_DEPENDENCIES += host-skeleton
+endif
+
 # Eliminate duplicates in dependencies
 $(2)_FINAL_DEPENDENCIES = $$(sort $$($(2)_DEPENDENCIES))
 $(2)_FINAL_PATCH_DEPENDENCIES = $$(sort $$($(2)_PATCH_DEPENDENCIES))
index d380f416497db4aafec11128aedd8c5a477f471f..efcf420d724333476b047c14824ed4564170dbb1 100644 (file)
 SKELETON_ADD_TOOLCHAIN_DEPENDENCY = NO
 SKELETON_ADD_SKELETON_DEPENDENCY = NO
 
+# We create a compatibility symlink in case a post-build script still
+# uses $(HOST_DIR)/usr
+define HOST_SKELETON_INSTALL_CMDS
+       $(Q)ln -snf . $(HOST_DIR)/usr
+       $(Q)mkdir -p $(HOST_DIR)/lib
+       $(Q)case $(HOSTARCH) in \
+               (*64) ln -snf lib $(HOST_DIR)/lib64;; \
+               (*)   ln -snf lib $(HOST_DIR)/lib32;; \
+       esac
+endef
+
 $(eval $(virtual-package))
+$(eval $(host-generic-package))