diff mbox

[v3,01/14] Move $(HOST_DIR)/usr/$(GNU_TARGET_NAME) one level up.

Message ID 20170704140404.4098-2-arnout@mind.be
State Accepted
Headers show

Commit Message

Arnout Vandecappelle July 4, 2017, 2:03 p.m. UTC
This is a step towards eliminating $(HOST_DIR)/usr. It allows us to
convert all packages installing things into
$(HOST_DIR)/usr/$(GNU_TARGET_NAME) (i.e., binutils and gcc) without
affecting the rest.

To allow compatibility with packages that still use $(HOST_DIR)/usr as
the prefix, create a symlink from usr/$(GNU_TARGET_NAME) to
../$(GNU_TARGET_NAME).

Note that the symlink creation will break when $(HOST_DIR)/usr/lib
already exists as a directory, i.e. when rebuilding in an existing
output directory. This is necessary: if we don't break it now, the
following commits (which remove the usr part from various variables)
_will_ break it.

Effectively, the usr/ part is removed from $(STAGING_SUBDIR) (and
therefore from $(STAGING_DIR)), so update the definition of that
variable right away.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
---
 Makefile            | 2 ++
 package/Makefile.in | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

Comments

Romain Naour July 4, 2017, 2:52 p.m. UTC | #1
Hi Arnout,

Le 04/07/2017 à 16:03, Arnout Vandecappelle (Essensium/Mind) a écrit :
> This is a step towards eliminating $(HOST_DIR)/usr. It allows us to
> convert all packages installing things into
> $(HOST_DIR)/usr/$(GNU_TARGET_NAME) (i.e., binutils and gcc) without
> affecting the rest.
> 
> To allow compatibility with packages that still use $(HOST_DIR)/usr as
> the prefix, create a symlink from usr/$(GNU_TARGET_NAME) to
> ../$(GNU_TARGET_NAME).
> 
> Note that the symlink creation will break when $(HOST_DIR)/usr/lib
> already exists as a directory, i.e. when rebuilding in an existing
> output directory. This is necessary: if we don't break it now, the
> following commits (which remove the usr part from various variables)
> _will_ break it.
> 
> Effectively, the usr/ part is removed from $(STAGING_SUBDIR) (and
> therefore from $(STAGING_DIR)), so update the definition of that
> variable right away.
> 
> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

Reviewed-by: Romain Naour <romain.naour@smile.fr>

Best regards,
Romain

> ---
>  Makefile            | 2 ++
>  package/Makefile.in | 2 +-
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/Makefile b/Makefile
> index b37171fcf2..a0f9f62771 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -556,6 +556,8 @@ world: target-post-image
>  $(STAGING_DIR):
>  	@mkdir -p $(STAGING_DIR)
>  	@ln -snf $(STAGING_DIR) $(BASE_DIR)/staging
> +	@mkdir -p $(HOST_DIR)/usr
> +	@ln -snf ../$(GNU_TARGET_NAME) $(HOST_DIR)/usr/$(GNU_TARGET_NAME)
>  
>  RSYNC_VCS_EXCLUSIONS = \
>  	--exclude .svn --exclude .git --exclude .hg --exclude .bzr \
> diff --git a/package/Makefile.in b/package/Makefile.in
> index 8087bde999..6b88ac4feb 100644
> --- a/package/Makefile.in
> +++ b/package/Makefile.in
> @@ -107,7 +107,7 @@ ifeq ($(BR2_arc)$(BR2_ARC_ATOMIC_EXT),yy)
>  TARGET_ABI += -matomic
>  endif
>  
> -STAGING_SUBDIR = usr/$(GNU_TARGET_NAME)/sysroot
> +STAGING_SUBDIR = $(GNU_TARGET_NAME)/sysroot
>  STAGING_DIR    = $(HOST_DIR)/$(STAGING_SUBDIR)
>  
>  ifeq ($(BR2_OPTIMIZE_0),y)
>
diff mbox

Patch

diff --git a/Makefile b/Makefile
index b37171fcf2..a0f9f62771 100644
--- a/Makefile
+++ b/Makefile
@@ -556,6 +556,8 @@  world: target-post-image
 $(STAGING_DIR):
 	@mkdir -p $(STAGING_DIR)
 	@ln -snf $(STAGING_DIR) $(BASE_DIR)/staging
+	@mkdir -p $(HOST_DIR)/usr
+	@ln -snf ../$(GNU_TARGET_NAME) $(HOST_DIR)/usr/$(GNU_TARGET_NAME)
 
 RSYNC_VCS_EXCLUSIONS = \
 	--exclude .svn --exclude .git --exclude .hg --exclude .bzr \
diff --git a/package/Makefile.in b/package/Makefile.in
index 8087bde999..6b88ac4feb 100644
--- a/package/Makefile.in
+++ b/package/Makefile.in
@@ -107,7 +107,7 @@  ifeq ($(BR2_arc)$(BR2_ARC_ATOMIC_EXT),yy)
 TARGET_ABI += -matomic
 endif
 
-STAGING_SUBDIR = usr/$(GNU_TARGET_NAME)/sysroot
+STAGING_SUBDIR = $(GNU_TARGET_NAME)/sysroot
 STAGING_DIR    = $(HOST_DIR)/$(STAGING_SUBDIR)
 
 ifeq ($(BR2_OPTIMIZE_0),y)