Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v4 1/9] Makefile, skeleton: move the host skeleton logic to host-skeleton package
Date: Sat, 24 Mar 2018 15:20:00 +0100	[thread overview]
Message-ID: <20180324142008.10375-2-thomas.petazzoni@bootlin.com> (raw)
In-Reply-To: <20180324142008.10375-1-thomas.petazzoni@bootlin.com>

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. We also make sure that this
host-skeleton package doesn't depend on host-patchelf, because
host-patchelf depends on host-skeleton.

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

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
Changes since v3:
 - Use $(Q) instead of @ in the HOST_SKELETON_INSTALL_CMDS
 - Add Reviewed-by from Yann
Changes since v2:
 - None
Changes since v1:
 - New patch
---
 Makefile                     | 13 +------------
 package/pkg-generic.mk       |  4 ++++
 package/skeleton/skeleton.mk | 12 ++++++++++++
 3 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/Makefile b/Makefile
index 1b34818fc8..33c87b5ebb 100644
--- 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)
diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk
index 5edb4b0838..3cadb28595 100644
--- a/package/pkg-generic.mk
+++ b/package/pkg-generic.mk
@@ -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))
diff --git a/package/skeleton/skeleton.mk b/package/skeleton/skeleton.mk
index d380f41649..efcf420d72 100644
--- a/package/skeleton/skeleton.mk
+++ b/package/skeleton/skeleton.mk
@@ -11,4 +11,16 @@
 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))
-- 
2.14.3

  reply	other threads:[~2018-03-24 14:20 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-24 14:19 [Buildroot] [PATCH v4 0/9] Preparation for per-package host/target directories Thomas Petazzoni
2018-03-24 14:20 ` Thomas Petazzoni [this message]
2018-03-24 15:28   ` [Buildroot] [PATCH v4 1/9] Makefile, skeleton: move the host skeleton logic to host-skeleton package Yann E. MORIN
2018-03-24 15:37     ` Thomas Petazzoni
2018-03-24 15:43       ` Yann E. MORIN
2018-03-25 13:00   ` Peter Korsgaard
2018-03-25 13:21     ` Yann E. MORIN
2018-03-25 15:34       ` Peter Korsgaard
2018-03-25 14:59     ` Thomas Petazzoni
2018-03-25 15:33       ` Peter Korsgaard
2018-03-25 15:36   ` Peter Korsgaard
2018-03-24 14:20 ` [Buildroot] [PATCH v4 2/9] pkg-cmake: install CMake files as part of a package Thomas Petazzoni
2018-03-25 15:37   ` Peter Korsgaard
2018-03-24 14:20 ` [Buildroot] [PATCH v4 3/9] package/pkg-generic: add the concept of extract dependency Thomas Petazzoni
2018-03-25  3:23   ` Matthew Weber
2018-03-25 15:40   ` Peter Korsgaard
2018-03-24 14:20 ` [Buildroot] [PATCH v4 4/9] package/pkg-generic: handle host-tar as an " Thomas Petazzoni
2018-03-25  3:23   ` Matthew Weber
2018-03-25 15:42   ` Peter Korsgaard
2018-03-24 14:20 ` [Buildroot] [PATCH v4 5/9] package/pkg-generic: handle host-xz " Thomas Petazzoni
2018-03-25 15:45   ` Peter Korsgaard
2018-03-24 14:20 ` [Buildroot] [PATCH v4 6/9] package/pkg-generic: handle host-lzip " Thomas Petazzoni
2018-03-25 15:48   ` Peter Korsgaard
2018-03-24 14:20 ` [Buildroot] [PATCH v4 7/9] package/pkg-generic: handle host-ccache as a regular dependency Thomas Petazzoni
2018-03-24 15:38   ` Yann E. MORIN
2018-03-25  3:23   ` Matthew Weber
2018-03-25 15:50   ` Peter Korsgaard
2018-03-24 14:20 ` [Buildroot] [PATCH v4 8/9] package/pkg-generic: handle host-fakedate " Thomas Petazzoni
2018-03-25 15:51   ` Peter Korsgaard
2018-03-24 14:20 ` [Buildroot] [PATCH v4 9/9] core: kill DEPENDENCIES_HOST_PREREQ Thomas Petazzoni
2018-03-25 15:53   ` Peter Korsgaard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180324142008.10375-2-thomas.petazzoni@bootlin.com \
    --to=thomas.petazzoni@bootlin.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox