Skip to contentSkip to conversation

Remove /usr component from HOST_DIR

PATCH Superseded Arnout Vandecappelle (Essensium/Mind) 3 participants 30 messages Jul 4, 2017 – Jul 5, 2017 Kbuild

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover Remove /usr component from HOST_DIR

This series is the same as v2 (on which I forgot to add a version number) but extended with a few more patches that are not fragile. After this, there will be a series of patches doing automatic replacement - these I will send only when they are ready to be committed because they're pretty fragile to changes in the tree.

We currently use $(HOST_DIR)/usr as the prefix for host packages. That has a few disadvantages:

- There are some things installed in $(HOST_DIR)/etc and $(HOST_DIR)/sbin, which is inconsistent.

- To pack a buildroot-built toolchain into a tarball for use as an external toolchain, you have to pack output/host/usr instead of the more obvious output/host.

- Because of the above, the internal toolchain wrapper breaks which forces us to work around it (call the actual toolchain executable directly). This is OK for us, but when used in another build system, that's a problem.

- Paths are four characters longer.

This series replaces all occurences of 'host/usr' (in its various forms) with 'host', and updates relative paths accordingly.

To allow for a gradual change, host/usr is replaced with a symlink, so that everything keeps working. Except that it turns out that not everything keeps working when we do that: quite a few things need to be fixed. Therefore that patch is split up into three steps:

- First $(HOST_DIR)/usr/$(GNU_TARGET_NAME) is moved one level up. This can be done safely (tested with both internal and external toolchain and building a few packages). The usr bit is removed from STAGING_DIR in the same patch, though it could have been split off.

- Next, $(HOST_DIR)/usr/lib is moved one level up. This can only be done after the first step, otherwise the internal toolchain fails to find ar, ld, etc. Also, when we do this, check-host-rpath has to be adapted to take into account the new location of the shared libs. The check-host-rpath change could have been partly split off in a separate patch, but then we'd have to check for either lib or usr/lib, and afterwards check only for lib again.

- Then we can move the entire host/usr one level up. At the same time, the ../.. in the external toolchain and toolchain wrapper has to be changed. Doing /bin and /sbin in a separate step still turns out not to be possible, again because of the internal toolchain that doesn't find cc1 etc. And it anyway wouldn't help much, because the ../.. change has to be done in the same patch as moving the bin directory.

Next comes a long series of patches that clean things up. They are all mostly independent from each other, although sometimes there will be merge conflicts of course.

- The first three are things that were also covered by the automatic replacements, but required some additional fixups. So these are split up into patches that stand on their own. They are anyway also infrastructure changes so nicer to have in separate patches.

- Next we have two patches that fix the use of $(HOST_DIR)/usr/$(GNU_TARGET_NAME) in gcc and gdb. These could in fact come immediately after the move of that directory, but I thought it was nicer to keep all the cleanups together.

- Next come six patches that clean up the various infras.

After that will come the mechanical cleanups, and more patches to clean up remaining issues.

I've tested both internal and external toolchains, and a large number of host packages after these changes. That turned up one problem:
libsepol, which creates a symlink that is no longer valid after the move. Fortunately that could be fixed in an independent patch.

Arnout Vandecappelle (14):
Move $(HOST_DIR)/usr/$(GNU_TARGET_NAME) one level up. Move $(HOST_DIR)/usr/lib to $(HOST_DIR)/lib
Eliminate $(HOST_DIR)/usr
check-host-rpath: no longer check $(HOST_DIR)/usr/{bin,sbin}
Makefile: remove $(HOST_DIR)/usr from BR_PATH package/Makefile.in: remove $(HOST_DIR)/usr part from HOST_LDFLAGS
gdb: Remove /usr part from installation path of gdbserver
gcc-final: things are no longer installed in $(HOST_DIR)/usr
pkg-autotools: use $(HOST_DIR) instead of $(HOST_DIR)/usr as prefix
pkg-cmake: use $(HOST_DIR) instead of $(HOST_DIR)/usr as prefix
pkg-cmake: move configuration files out of $(HOST_DIR)/usr
pkg-cmake: programs are now installed in $(HOST_DIR)/bin
pkg-python: use $(HOST_DIR) instead of $(HOST_DIR)/usr as prefix
pkg-rebar: use $(HOST_DIR) instead of $(HOST_DIR)/usr as prefix

 Makefile                                               | 11 ++++++++---
 package/Makefile.in                                    |  4 ++--
 package/gcc/gcc-final/gcc-final.mk                     | 14 +++++++-------
 package/gdb/gdb.mk                                     |  2 +-
 package/pkg-autotools.mk                               |  2 +-
 package/pkg-cmake.mk                                   | 10 +++++-----
 package/pkg-python.mk                                  |  4 ++--
 package/pkg-rebar.mk                                   | 14 +++++++-------
 support/misc/toolchainfile.cmake.in                    |  6 +++---
 support/scripts/check-host-rpath                       |  8 +++++---
 toolchain/toolchain-external/pkg-toolchain-external.mk |  6 +++---
 toolchain/toolchain-wrapper.c                          |  2 +-
 toolchain/toolchain/toolchain.mk                       |  4 ++--
 13 files changed, 47 insertions(+), 40 deletions(-)
Signature · 1 line
2.13.2
#1 lore raw

PATCH v3 1/14 Move $(HOST_DIR)/usr/$(GNU_TARGET_NAME) one level up.

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.

---
 Makefile            | 2 ++
 package/Makefile.in | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)
Makefile +2 -0
index b37171fcf2..a0f9f62771 100644
@@ -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 \
package/Makefile.in +1 -1
index 8087bde999..6b88ac4feb 100644
@@ -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)
Signature · 1 line
2.13.2
#2 lore raw

PATCH v3 1/14 Move $(HOST_DIR)/usr/$(GNU_TARGET_NAME) one level up.

Hi Arnout,

Le 04/07/2017 ? 16:03, Arnout Vandecappelle (Essensium/Mind) a ?crit :

Quoted 15 lines

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.

Quoted 5 lines

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

Best regards,
Romain

Quoted 32 lines
---
 Makefile            | 2 ++
 package/Makefile.in | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)
Makefile +2 -0
index b37171fcf2..a0f9f62771 100644
@@ -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 \
package/Makefile.in +1 -1
index 8087bde999..6b88ac4feb 100644
@@ -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)
#3 lore raw

PATCH v3 2/14 Move $(HOST_DIR)/usr/lib to $(HOST_DIR)/lib

In reply to Arnout Vandecappelle (Essensium/Mind)

This is a step towards eliminating $(HOST_DIR)/usr. It allows us to convert all packages installing things into $(HOST_DIR)/usr/lib without affecting the rest.

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

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.

At the same time as creating this symlink, we also have to update the check-host-rpath to accept both $(HOST_DIR)/usr/lib and $(HOST_DIR)/lib, because depending on how the package derives the path, it may be different.

Since there are some dependency chains that involve $(STAGING_DIR), $(STAGING_DIR) may in fact be created before $(HOST_DIR). Since $(STAGING_DIR) is a subdirectory of $(HOST_DIR), it is possible that the newly added rule for $(HOST_DIR) never triggers. To make sure that the rule does trigger, add an order-only dependency from $(STAGING_DIR) to $(HOST_DIR).

---
v2: rebase on modifications of check-host-rpath with $ORIGIN.

---
 Makefile                         | 10 +++++++---
 support/scripts/check-host-rpath |  8 +++++---
 2 files changed, 12 insertions(+), 6 deletions(-)
Makefile +7 -3
index a0f9f62771..ac349a79e8 100644
@@ -237,7 +237,7 @@ LEGAL_REPORT = $(LEGAL_INFO_DIR)/README
 # dependencies anywhere else
 #
 ################################################################################
-$(BUILD_DIR) $(TARGET_DIR) $(HOST_DIR) $(BINARIES_DIR) $(LEGAL_INFO_DIR) $(REDIST_SOURCES_DIR_TARGET) $(REDIST_SOURCES_DIR_HOST):
+$(BUILD_DIR) $(TARGET_DIR) $(BINARIES_DIR) $(LEGAL_INFO_DIR) $(REDIST_SOURCES_DIR_TARGET) $(REDIST_SOURCES_DIR_HOST):
 	@mkdir -p $@
 
 BR2_CONFIG = $(CONFIG_DIR)/.config
@@ -552,11 +552,15 @@ prepare: $(BUILD_DIR)/buildroot-config/auto.conf
 .PHONY: world
 world: target-post-image
 
+# When creating HOST_DIR, also symlink usr/lib -> ../lib
+$(HOST_DIR):
+	@mkdir -p $@/usr $@/lib
+	@ln -snf ../lib $@/usr/lib
+
 # Populating the staging with the base directories is handled by the skeleton package
-$(STAGING_DIR):
+$(STAGING_DIR): | $(HOST_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 = \
support/scripts/check-host-rpath +5 -3
index 020c12379f..adabfdf53f 100755
@@ -1,7 +1,7 @@
 #!/usr/bin/env bash
 
-# This script scans $(HOST_DIR)/{bin,sbin} for all ELF files, and checks
-# they have an RPATH to $(HOST_DIR)/usr/lib if they need libraries from
+# This script scans $(HOST_DIR)/{,usr/}{bin,sbin} for all ELF files, and checks
+# they have an RPATH to $(HOST_DIR)/{,usr/}lib if they need libraries from
 # there.
 
 # Override the user's locale so we are sure we can parse the output of
@@ -40,7 +40,7 @@ elf_needs_rpath() {
     local lib
 
     while read lib; do
-        [ -e "${hostdir}/usr/lib/${lib}" ] && return 0
+        [ -e "${hostdir}/lib/${lib}" ] && return 0
     done < <( readelf -d "${file}"                                         \
               |sed -r -e '/^.* \(NEEDED\) .*Shared library: \[(.+)\]$/!d;' \
                      -e 's//\1/;'                                          \
@@ -58,6 +58,8 @@ check_elf_has_rpath() {
         for dir in ${rpath//:/ }; do
             # Remove duplicate and trailing '/' for proper match
             dir="$( sed -r -e 's:/+:/:g; s:/$::;' <<<"${dir}" )"
+            [ "${dir}" = "${hostdir}/lib" -o "${dir}" = "\$ORIGIN/../lib" ] && return 0
+            # For the time being, the rpath is allowed with both usr/lib and lib
             [ "${dir}" = "${hostdir}/usr/lib" -o "${dir}" = "\$ORIGIN/../../usr/lib" ] && return 0
         done
     done < <( readelf -d "${file}"                                              \
Signature · 1 line
2.13.2
#4 lore raw

PATCH v3 2/14 Move $(HOST_DIR)/usr/lib to $(HOST_DIR)/lib

Hi Arnout,

Le 04/07/2017 ? 16:03, Arnout Vandecappelle (Essensium/Mind) a ?crit :

Quoted 18 lines

This is a step towards eliminating $(HOST_DIR)/usr. It allows us to convert all packages installing things into $(HOST_DIR)/usr/lib without affecting the rest.

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

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.

At the same time as creating this symlink, we also have to update the check-host-rpath to accept both $(HOST_DIR)/usr/lib and $(HOST_DIR)/lib, because depending on how the package derives the path, it may be different.

Quoted 8 lines

Since there are some dependency chains that involve $(STAGING_DIR), $(STAGING_DIR) may in fact be created before $(HOST_DIR). Since $(STAGING_DIR) is a subdirectory of $(HOST_DIR), it is possible that the newly added rule for $(HOST_DIR) never triggers. To make sure that the rule does trigger, add an order-only dependency from $(STAGING_DIR) to $(HOST_DIR).

Best regards,
Romain

Quoted 71 lines

---
v2: rebase on modifications of check-host-rpath with $ORIGIN.

---
 Makefile                         | 10 +++++++---
 support/scripts/check-host-rpath |  8 +++++---
 2 files changed, 12 insertions(+), 6 deletions(-)
Makefile +7 -3
index a0f9f62771..ac349a79e8 100644
@@ -237,7 +237,7 @@ LEGAL_REPORT = $(LEGAL_INFO_DIR)/README
 # dependencies anywhere else
 #
 ################################################################################
-$(BUILD_DIR) $(TARGET_DIR) $(HOST_DIR) $(BINARIES_DIR) $(LEGAL_INFO_DIR) $(REDIST_SOURCES_DIR_TARGET) $(REDIST_SOURCES_DIR_HOST):
+$(BUILD_DIR) $(TARGET_DIR) $(BINARIES_DIR) $(LEGAL_INFO_DIR) $(REDIST_SOURCES_DIR_TARGET) $(REDIST_SOURCES_DIR_HOST):
 	@mkdir -p $@
 
 BR2_CONFIG = $(CONFIG_DIR)/.config
@@ -552,11 +552,15 @@ prepare: $(BUILD_DIR)/buildroot-config/auto.conf
 .PHONY: world
 world: target-post-image
 
+# When creating HOST_DIR, also symlink usr/lib -> ../lib
+$(HOST_DIR):
+	@mkdir -p $@/usr $@/lib
+	@ln -snf ../lib $@/usr/lib
+
 # Populating the staging with the base directories is handled by the skeleton package
-$(STAGING_DIR):
+$(STAGING_DIR): | $(HOST_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 = \
support/scripts/check-host-rpath +5 -3
index 020c12379f..adabfdf53f 100755
@@ -1,7 +1,7 @@
 #!/usr/bin/env bash
 
-# This script scans $(HOST_DIR)/{bin,sbin} for all ELF files, and checks
-# they have an RPATH to $(HOST_DIR)/usr/lib if they need libraries from
+# This script scans $(HOST_DIR)/{,usr/}{bin,sbin} for all ELF files, and checks
+# they have an RPATH to $(HOST_DIR)/{,usr/}lib if they need libraries from
 # there.
 
 # Override the user's locale so we are sure we can parse the output of
@@ -40,7 +40,7 @@ elf_needs_rpath() {
     local lib
 
     while read lib; do
-        [ -e "${hostdir}/usr/lib/${lib}" ] && return 0
+        [ -e "${hostdir}/lib/${lib}" ] && return 0
     done < <( readelf -d "${file}"                                         \
               |sed -r -e '/^.* \(NEEDED\) .*Shared library: \[(.+)\]$/!d;' \
                      -e 's//\1/;'                                          \
@@ -58,6 +58,8 @@ check_elf_has_rpath() {
         for dir in ${rpath//:/ }; do
             # Remove duplicate and trailing '/' for proper match
             dir="$( sed -r -e 's:/+:/:g; s:/$::;' <<<"${dir}" )"
+            [ "${dir}" = "${hostdir}/lib" -o "${dir}" = "\$ORIGIN/../lib" ] && return 0
+            # For the time being, the rpath is allowed with both usr/lib and lib
             [ "${dir}" = "${hostdir}/usr/lib" -o "${dir}" = "\$ORIGIN/../../usr/lib" ] && return 0
         done
     done < <( readelf -d "${file}"                                              \
#5 lore raw

PATCH v3 3/14 Eliminate $(HOST_DIR)/usr

In reply to Arnout Vandecappelle (Essensium/Mind)

We currently use $(HOST_DIR)/usr as the prefix for host packages. That has a few disadvantages:

- There are some things installed in $(HOST_DIR)/etc and $(HOST_DIR)/sbin, which is inconsistent.

- To pack a buildroot-built toolchain into a tarball for use as an external toolchain, you have to pack output/host/usr instead of the more obvious output/host.

- Because of the above, the internal toolchain wrapper breaks which forces us to work around it (call the actual toolchain executable directly). This is OK for us, but when used in another build system, that's a problem.

- Paths are four characters longer.

To allow us to gradually eliminate $(HOST_DIR)/usr while building packages, replace it with a symlink to .

The symlinks from $(HOST_DIR)/usr/$(GNU_TARGET_NAME) and $(HOST_DIR)/usr/lib that were added previously are removed again.

Note that the symlink creation will break when $(HOST_DIR)/usr 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.

At the same time as creating this symlink, we have to update the external toolchain wrapper and the external toolchain symlinks to go one directory less up. Indeed, $(HOST_DIR) is one level less up than it was before.

---
I intended to also move $(HOST_DIR)/usr/bin in a separate patch, but that turns out to break the internal toolchain: host-gcc-initial uses relative paths to find cc1 etc. and these will be broken.

---
 Makefile                                               | 7 +++----
 toolchain/toolchain-external/pkg-toolchain-external.mk | 6 +++---
 toolchain/toolchain-wrapper.c                          | 2 +-
 3 files changed, 7 insertions(+), 8 deletions(-)
Makefile +3 -4
index ac349a79e8..7453bfd193 100644
@@ -552,16 +552,15 @@ prepare: $(BUILD_DIR)/buildroot-config/auto.conf
 .PHONY: world
 world: target-post-image
 
-# When creating HOST_DIR, also symlink usr/lib -> ../lib
+# When creating HOST_DIR, also symlink usr -> .
 $(HOST_DIR):
-	@mkdir -p $@/usr $@/lib
-	@ln -snf ../lib $@/usr/lib
+	@mkdir -p $@
+	@ln -snf . $@/usr
 
 # Populating the staging with the base directories is handled by the skeleton package
 $(STAGING_DIR): | $(HOST_DIR)
 	@mkdir -p $(STAGING_DIR)
 	@ln -snf $(STAGING_DIR) $(BASE_DIR)/staging
-	@ln -snf ../$(GNU_TARGET_NAME) $(HOST_DIR)/usr/$(GNU_TARGET_NAME)
 
 RSYNC_VCS_EXCLUSIONS = \
 	--exclude .svn --exclude .git --exclude .hg --exclude .bzr \
toolchain/toolchain-external/pkg-toolchain-external.mk +3 -3
index 8460e37d09..adbd3fe67e 100644
@@ -250,18 +250,18 @@ define TOOLCHAIN_EXTERNAL_INSTALL_WRAPPER
 		base=$${i##*/}; \
 		case "$$base" in \
 		*-ar|*-ranlib|*-nm) \
-			ln -sf $$(echo $$i | sed 's%^$(HOST_DIR)%../..%') .; \
+			ln -sf $$(echo $$i | sed 's%^$(HOST_DIR)%..%') .; \
 			;; \
 		*cc|*cc-*|*++|*++-*|*cpp|*-gfortran) \
 			ln -sf toolchain-wrapper $$base; \
 			;; \
 		*gdb|*gdbtui) \
 			if test "$(BR2_PACKAGE_HOST_GDB)" != "y"; then \
-				ln -sf $$(echo $$i | sed 's%^$(HOST_DIR)%../..%') .; \
+				ln -sf $$(echo $$i | sed 's%^$(HOST_DIR)%..%') .; \
 			fi \
 			;; \
 		*) \
-			ln -sf $$(echo $$i | sed 's%^$(HOST_DIR)%../..%') .; \
+			ln -sf $$(echo $$i | sed 's%^$(HOST_DIR)%..%') .; \
 			;; \
 		esac; \
 	done
toolchain/toolchain-wrapper.c +1 -1
index 100aa181c6..3a4455ff82 100644
@@ -178,7 +178,7 @@ int main(int argc, char **argv)
 			perror(__FILE__ ": malloc");
 			return 2;
 		}
-		sprintf(relbasedir, "%s/../..", argv[0]);
+		sprintf(relbasedir, "%s/..", argv[0]);
 		absbasedir = realpath(relbasedir, NULL);
 	} else {
 		basename = progpath;
Signature · 1 line
2.13.2
#6 lore raw

PATCH v3 3/14 Eliminate $(HOST_DIR)/usr

Hi Arnout,

Le 04/07/2017 ? 16:03, Arnout Vandecappelle (Essensium/Mind) a ?crit :

Quoted 29 lines

We currently use $(HOST_DIR)/usr as the prefix for host packages. That has a few disadvantages:

- There are some things installed in $(HOST_DIR)/etc and $(HOST_DIR)/sbin, which is inconsistent.

- To pack a buildroot-built toolchain into a tarball for use as an external toolchain, you have to pack output/host/usr instead of the more obvious output/host.

- Because of the above, the internal toolchain wrapper breaks which forces us to work around it (call the actual toolchain executable directly). This is OK for us, but when used in another build system, that's a problem.

- Paths are four characters longer.

To allow us to gradually eliminate $(HOST_DIR)/usr while building packages, replace it with a symlink to .

The symlinks from $(HOST_DIR)/usr/$(GNU_TARGET_NAME) and $(HOST_DIR)/usr/lib that were added previously are removed again.

Note that the symlink creation will break when $(HOST_DIR)/usr 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.

Quoted 6 lines

At the same time as creating this symlink, we have to update the external toolchain wrapper and the external toolchain symlinks to go one directory less up. Indeed, $(HOST_DIR) is one level less up than it was before.

Best regards,
Romain

Quoted 74 lines

---
I intended to also move $(HOST_DIR)/usr/bin in a separate patch, but that turns out to break the internal toolchain: host-gcc-initial uses relative paths to find cc1 etc. and these will be broken.

---
 Makefile                                               | 7 +++----
 toolchain/toolchain-external/pkg-toolchain-external.mk | 6 +++---
 toolchain/toolchain-wrapper.c                          | 2 +-
 3 files changed, 7 insertions(+), 8 deletions(-)
Makefile +3 -4
index ac349a79e8..7453bfd193 100644
@@ -552,16 +552,15 @@ prepare: $(BUILD_DIR)/buildroot-config/auto.conf
 .PHONY: world
 world: target-post-image
 
-# When creating HOST_DIR, also symlink usr/lib -> ../lib
+# When creating HOST_DIR, also symlink usr -> .
 $(HOST_DIR):
-	@mkdir -p $@/usr $@/lib
-	@ln -snf ../lib $@/usr/lib
+	@mkdir -p $@
+	@ln -snf . $@/usr
 
 # Populating the staging with the base directories is handled by the skeleton package
 $(STAGING_DIR): | $(HOST_DIR)
 	@mkdir -p $(STAGING_DIR)
 	@ln -snf $(STAGING_DIR) $(BASE_DIR)/staging
-	@ln -snf ../$(GNU_TARGET_NAME) $(HOST_DIR)/usr/$(GNU_TARGET_NAME)
 
 RSYNC_VCS_EXCLUSIONS = \
 	--exclude .svn --exclude .git --exclude .hg --exclude .bzr \
toolchain/toolchain-external/pkg-toolchain-external.mk +3 -3
index 8460e37d09..adbd3fe67e 100644
@@ -250,18 +250,18 @@ define TOOLCHAIN_EXTERNAL_INSTALL_WRAPPER
 		base=$${i##*/}; \
 		case "$$base" in \
 		*-ar|*-ranlib|*-nm) \
-			ln -sf $$(echo $$i | sed 's%^$(HOST_DIR)%../..%') .; \
+			ln -sf $$(echo $$i | sed 's%^$(HOST_DIR)%..%') .; \
 			;; \
 		*cc|*cc-*|*++|*++-*|*cpp|*-gfortran) \
 			ln -sf toolchain-wrapper $$base; \
 			;; \
 		*gdb|*gdbtui) \
 			if test "$(BR2_PACKAGE_HOST_GDB)" != "y"; then \
-				ln -sf $$(echo $$i | sed 's%^$(HOST_DIR)%../..%') .; \
+				ln -sf $$(echo $$i | sed 's%^$(HOST_DIR)%..%') .; \
 			fi \
 			;; \
 		*) \
-			ln -sf $$(echo $$i | sed 's%^$(HOST_DIR)%../..%') .; \
+			ln -sf $$(echo $$i | sed 's%^$(HOST_DIR)%..%') .; \
 			;; \
 		esac; \
 	done
toolchain/toolchain-wrapper.c +1 -1
index 100aa181c6..3a4455ff82 100644
@@ -178,7 +178,7 @@ int main(int argc, char **argv)
 			perror(__FILE__ ": malloc");
 			return 2;
 		}
-		sprintf(relbasedir, "%s/../..", argv[0]);
+		sprintf(relbasedir, "%s/..", argv[0]);
 		absbasedir = realpath(relbasedir, NULL);
 	} else {
 		basename = progpath;
#7 lore raw

PATCH v3 4/14 check-host-rpath: no longer check $(HOST_DIR)/usr/{bin, sbin}

In reply to Arnout Vandecappelle (Essensium/Mind)

Since $(HOST_DIR)/usr/{bin,sbin} are now symlinks to $(HOST_DIR)/{bin,sbin}, it makes no sense to check them - they are already covered.

---
 support/scripts/check-host-rpath | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
support/scripts/check-host-rpath +2 -2
index adabfdf53f..2846d5eb51 100755
@@ -1,6 +1,6 @@
 #!/usr/bin/env bash
 
-# This script scans $(HOST_DIR)/{,usr/}{bin,sbin} for all ELF files, and checks
+# This script scans $(HOST_DIR)/{bin,sbin} for all ELF files, and checks
 # they have an RPATH to $(HOST_DIR)/{,usr/}lib if they need libraries from
 # there.
 
@@ -26,7 +26,7 @@ main() {
             printf "*** ERROR: package %s installs executables without proper RPATH:\n" "${pkg}"
         fi
         printf "***   %s\n" "${file}"
-    done < <( find "${hostdir}"/{,usr/}{bin,sbin} -type f -exec file {} + 2>/dev/null \
+    done < <( find "${hostdir}"/{bin,sbin} -type f -exec file {} + 2>/dev/null \
               |sed -r -e '/^([^:]+):.*\<ELF\>.*\<executable\>.*/!d'                \
                       -e 's//\1/'                                                  \
             )
Signature · 1 line
2.13.2
#8 lore raw

PATCH v3 4/14 check-host-rpath: no longer check $(HOST_DIR)/usr/{bin, sbin}

Hi Arnout,

Le 04/07/2017 ? 16:03, Arnout Vandecappelle (Essensium/Mind) a ?crit :

Quoted 5 lines

Since $(HOST_DIR)/usr/{bin,sbin} are now symlinks to $(HOST_DIR)/{bin,sbin}, it makes no sense to check them - they are already covered.

Best regards,
Romain

Quoted 26 lines
---
 support/scripts/check-host-rpath | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
support/scripts/check-host-rpath +2 -2
index adabfdf53f..2846d5eb51 100755
@@ -1,6 +1,6 @@
 #!/usr/bin/env bash
 
-# This script scans $(HOST_DIR)/{,usr/}{bin,sbin} for all ELF files, and checks
+# This script scans $(HOST_DIR)/{bin,sbin} for all ELF files, and checks
 # they have an RPATH to $(HOST_DIR)/{,usr/}lib if they need libraries from
 # there.
 
@@ -26,7 +26,7 @@ main() {
             printf "*** ERROR: package %s installs executables without proper RPATH:\n" "${pkg}"
         fi
         printf "***   %s\n" "${file}"
-    done < <( find "${hostdir}"/{,usr/}{bin,sbin} -type f -exec file {} + 2>/dev/null \
+    done < <( find "${hostdir}"/{bin,sbin} -type f -exec file {} + 2>/dev/null \
               |sed -r -e '/^([^:]+):.*\<ELF\>.*\<executable\>.*/!d'                \
                       -e 's//\1/'                                                  \
             )
#9 lore raw

PATCH v3 5/14 Makefile: remove $(HOST_DIR)/usr from BR_PATH

In reply to Arnout Vandecappelle (Essensium/Mind)

Now $(HOST_DIR)/usr is a symlink to $(HOST_DIR), it makes no sense to still have it in BR_PATH.

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index 7453bfd193..19d8b442a3 100644
@@ -440,7 +440,7 @@ TAR_OPTIONS = $(call qstrip,$(BR2_TAR_OPTIONS)) -xf
 HOST_DIR := $(call qstrip,$(BR2_HOST_DIR))
 
 # Quotes are needed for spaces and all in the original PATH content.
-BR_PATH = "$(HOST_DIR)/bin:$(HOST_DIR)/sbin:$(HOST_DIR)/usr/bin:$(HOST_DIR)/usr/sbin:$(PATH)"
+BR_PATH = "$(HOST_DIR)/bin:$(HOST_DIR)/sbin:$(PATH)"
 
 # Location of a file giving a big fat warning that output/target
 # should not be used as the root filesystem.
Signature · 1 line
2.13.2
#10 lore raw

PATCH v3 5/14 Makefile: remove $(HOST_DIR)/usr from BR_PATH

Hi Arnout,

Le 04/07/2017 ? 16:03, Arnout Vandecappelle (Essensium/Mind) a ?crit :

Quoted 4 lines

Now $(HOST_DIR)/usr is a symlink to $(HOST_DIR), it makes no sense to still have it in BR_PATH.

Best regards,
Romain

Quoted 18 lines
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index 7453bfd193..19d8b442a3 100644
@@ -440,7 +440,7 @@ TAR_OPTIONS = $(call qstrip,$(BR2_TAR_OPTIONS)) -xf
 HOST_DIR := $(call qstrip,$(BR2_HOST_DIR))
 
 # Quotes are needed for spaces and all in the original PATH content.
-BR_PATH = "$(HOST_DIR)/bin:$(HOST_DIR)/sbin:$(HOST_DIR)/usr/bin:$(HOST_DIR)/usr/sbin:$(PATH)"
+BR_PATH = "$(HOST_DIR)/bin:$(HOST_DIR)/sbin:$(PATH)"
 
 # Location of a file giving a big fat warning that output/target
 # should not be used as the root filesystem.
#11 lore raw

PATCH v3 6/14 package/Makefile.in: remove $(HOST_DIR)/usr part from HOST_LDFLAGS

In reply to Arnout Vandecappelle (Essensium/Mind)

Now $(HOST_DIR)/lib and $(HOST_DIR)/usr/lib are the same directory, it doesn't make sense to pass both to LDFLAGS.

Also use $(HOST_DIR)/lib instead of $(HOST_DIR)/usr/lib for the RPATH.

---
 package/Makefile.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/Makefile.in +1 -1
index 6b88ac4feb..25f1997fe6 100644
@@ -220,7 +220,7 @@ HOST_CPPFLAGS  = -I$(HOST_DIR)/usr/include
 HOST_CFLAGS   ?= -O2
 HOST_CFLAGS   += $(HOST_CPPFLAGS)
 HOST_CXXFLAGS += $(HOST_CFLAGS)
-HOST_LDFLAGS  += -L$(HOST_DIR)/lib -L$(HOST_DIR)/usr/lib -Wl,-rpath,$(HOST_DIR)/usr/lib
+HOST_LDFLAGS  += -L$(HOST_DIR)/lib -Wl,-rpath,$(HOST_DIR)/lib
 
 # host-intltool should be executed with the system perl, so we save
 # the path to the system perl, before a host-perl built by Buildroot
Signature · 1 line
2.13.2
#12 lore raw

PATCH v3 6/14 package/Makefile.in: remove $(HOST_DIR)/usr part from HOST_LDFLAGS

Hi Arnout,

Le 04/07/2017 ? 16:03, Arnout Vandecappelle (Essensium/Mind) a ?crit :

Quoted 6 lines

Now $(HOST_DIR)/lib and $(HOST_DIR)/usr/lib are the same directory, it doesn't make sense to pass both to LDFLAGS.

Also use $(HOST_DIR)/lib instead of $(HOST_DIR)/usr/lib for the RPATH.

Best regards,
Romain

Quoted 18 lines
---
 package/Makefile.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/Makefile.in +1 -1
index 6b88ac4feb..25f1997fe6 100644
@@ -220,7 +220,7 @@ HOST_CPPFLAGS  = -I$(HOST_DIR)/usr/include
 HOST_CFLAGS   ?= -O2
 HOST_CFLAGS   += $(HOST_CPPFLAGS)
 HOST_CXXFLAGS += $(HOST_CFLAGS)
-HOST_LDFLAGS  += -L$(HOST_DIR)/lib -L$(HOST_DIR)/usr/lib -Wl,-rpath,$(HOST_DIR)/usr/lib
+HOST_LDFLAGS  += -L$(HOST_DIR)/lib -Wl,-rpath,$(HOST_DIR)/lib
 
 # host-intltool should be executed with the system perl, so we save
 # the path to the system perl, before a host-perl built by Buildroot
#13 lore raw

PATCH v3 7/14 gdb: Remove /usr part from installation path of gdbserver

In reply to Arnout Vandecappelle (Essensium/Mind)
---
 package/gdb/gdb.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/gdb/gdb.mk +1 -1
index 7036b4cb0f..9a97cb77a7 100644
@@ -181,7 +181,7 @@ GDB_POST_INSTALL_TARGET_HOOKS += GDB_REMOVE_UNNEEDED_FILES
 # does.
 define GDB_SDK_INSTALL_GDBSERVER
 	$(INSTALL) -D -m 0755 $(TARGET_DIR)/usr/bin/gdbserver \
-		$(HOST_DIR)/usr/$(GNU_TARGET_NAME)/debug-root/usr/bin/gdbserver
+		$(HOST_DIR)/$(GNU_TARGET_NAME)/debug-root/usr/bin/gdbserver
 endef
 
 ifeq ($(BR2_PACKAGE_GDB_SERVER),y)
Signature · 1 line
2.13.2
#14 lore raw

PATCH v3 7/14 gdb: Remove /usr part from installation path of gdbserver

Hi Arnout,

Le 04/07/2017 ? 16:03, Arnout Vandecappelle (Essensium/Mind) a ?crit :

Quoted 1 line

There are two other $(HOST_DIR)/usr in gdb.mk but I guess it will be done in a follow up patch.

Best regards,
Romain

Quoted 18 lines
---
 package/gdb/gdb.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/gdb/gdb.mk +1 -1
index 7036b4cb0f..9a97cb77a7 100644
@@ -181,7 +181,7 @@ GDB_POST_INSTALL_TARGET_HOOKS += GDB_REMOVE_UNNEEDED_FILES
 # does.
 define GDB_SDK_INSTALL_GDBSERVER
 	$(INSTALL) -D -m 0755 $(TARGET_DIR)/usr/bin/gdbserver \
-		$(HOST_DIR)/usr/$(GNU_TARGET_NAME)/debug-root/usr/bin/gdbserver
+		$(HOST_DIR)/$(GNU_TARGET_NAME)/debug-root/usr/bin/gdbserver
 endef
 
 ifeq ($(BR2_PACKAGE_GDB_SERVER),y)
#15 lore raw

PATCH v3 8/14 gcc-final: things are no longer installed in $(HOST_DIR)/usr

In reply to Arnout Vandecappelle (Essensium/Mind)

Since things are no longer installed in $(HOST_DIR)/usr, the callers should also not refer to it.

---
 package/gcc/gcc-final/gcc-final.mk | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
package/gcc/gcc-final/gcc-final.mk +7 -7
index e8d2e18fe5..12f08c81a8 100644
@@ -59,18 +59,18 @@ GCC_FINAL_CROSS_LANGUAGES = $(subst $(space),$(comma),$(GCC_FINAL_CROSS_LANGUAGE
 HOST_GCC_FINAL_CONF_OPTS = \
 	$(HOST_GCC_COMMON_CONF_OPTS) \
 	--enable-languages=$(GCC_FINAL_CROSS_LANGUAGES) \
-	--with-build-time-tools=$(HOST_DIR)/usr/$(GNU_TARGET_NAME)/bin
+	--with-build-time-tools=$(HOST_DIR)/$(GNU_TARGET_NAME)/bin
 
-HOST_GCC_FINAL_GCC_LIB_DIR = $(HOST_DIR)/usr/$(GNU_TARGET_NAME)/lib*
+HOST_GCC_FINAL_GCC_LIB_DIR = $(HOST_DIR)/$(GNU_TARGET_NAME)/lib*
 # The kernel wants to use the -m4-nofpu option to make sure that it
 # doesn't use floating point operations.
 ifeq ($(BR2_sh4)$(BR2_sh4eb),y)
 HOST_GCC_FINAL_CONF_OPTS += "--with-multilib-list=m4,m4-nofpu"
-HOST_GCC_FINAL_GCC_LIB_DIR = $(HOST_DIR)/usr/$(GNU_TARGET_NAME)/lib/!m4*
+HOST_GCC_FINAL_GCC_LIB_DIR = $(HOST_DIR)/$(GNU_TARGET_NAME)/lib/!m4*
 endif
 ifeq ($(BR2_sh4a)$(BR2_sh4aeb),y)
 HOST_GCC_FINAL_CONF_OPTS += "--with-multilib-list=m4a,m4a-nofpu"
-HOST_GCC_FINAL_GCC_LIB_DIR = $(HOST_DIR)/usr/$(GNU_TARGET_NAME)/lib/!m4*
+HOST_GCC_FINAL_GCC_LIB_DIR = $(HOST_DIR)/$(GNU_TARGET_NAME)/lib/!m4*
 endif
 
 ifeq ($(BR2_bfin),y)
@@ -103,9 +103,9 @@ HOST_GCC_FINAL_MAKE_OPTS += $(HOST_GCC_COMMON_MAKE_OPTS)
 
 # Make sure we have 'cc'
 define HOST_GCC_FINAL_CREATE_CC_SYMLINKS
-	if [ ! -e $(HOST_DIR)/usr/bin/$(GNU_TARGET_NAME)-cc ]; then \
-		ln -f $(HOST_DIR)/usr/bin/$(GNU_TARGET_NAME)-gcc \
-			$(HOST_DIR)/usr/bin/$(GNU_TARGET_NAME)-cc; \
+	if [ ! -e $(HOST_DIR)/bin/$(GNU_TARGET_NAME)-cc ]; then \
+		ln -f $(HOST_DIR)/bin/$(GNU_TARGET_NAME)-gcc \
+			$(HOST_DIR)/bin/$(GNU_TARGET_NAME)-cc; \
 	fi
 endef
 
Signature · 1 line
2.13.2
#16 lore raw

PATCH v3 8/14 gcc-final: things are no longer installed in $(HOST_DIR)/usr

Hi Arnout,

Le 04/07/2017 ? 16:03, Arnout Vandecappelle (Essensium/Mind) a ?crit :

Quoted 4 lines

Since things are no longer installed in $(HOST_DIR)/usr, the callers should also not refer to it.

Same as for gdb, there are also other reference to $(HOST_DIR)/usr in gcc/gcc.mk and gcc/gcc-final/gcc-final.mk but as you explained privately, this patch is doing only s:$(HOST_DIR)/usr/$(GNU_TARGET_NAME):$(HOST_DIR)/$(GNU_TARGET_NAME):

Best regards,
Romain

Quoted 45 lines
---
 package/gcc/gcc-final/gcc-final.mk | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
package/gcc/gcc-final/gcc-final.mk +7 -7
index e8d2e18fe5..12f08c81a8 100644
@@ -59,18 +59,18 @@ GCC_FINAL_CROSS_LANGUAGES = $(subst $(space),$(comma),$(GCC_FINAL_CROSS_LANGUAGE
 HOST_GCC_FINAL_CONF_OPTS = \
 	$(HOST_GCC_COMMON_CONF_OPTS) \
 	--enable-languages=$(GCC_FINAL_CROSS_LANGUAGES) \
-	--with-build-time-tools=$(HOST_DIR)/usr/$(GNU_TARGET_NAME)/bin
+	--with-build-time-tools=$(HOST_DIR)/$(GNU_TARGET_NAME)/bin
 
-HOST_GCC_FINAL_GCC_LIB_DIR = $(HOST_DIR)/usr/$(GNU_TARGET_NAME)/lib*
+HOST_GCC_FINAL_GCC_LIB_DIR = $(HOST_DIR)/$(GNU_TARGET_NAME)/lib*
 # The kernel wants to use the -m4-nofpu option to make sure that it
 # doesn't use floating point operations.
 ifeq ($(BR2_sh4)$(BR2_sh4eb),y)
 HOST_GCC_FINAL_CONF_OPTS += "--with-multilib-list=m4,m4-nofpu"
-HOST_GCC_FINAL_GCC_LIB_DIR = $(HOST_DIR)/usr/$(GNU_TARGET_NAME)/lib/!m4*
+HOST_GCC_FINAL_GCC_LIB_DIR = $(HOST_DIR)/$(GNU_TARGET_NAME)/lib/!m4*
 endif
 ifeq ($(BR2_sh4a)$(BR2_sh4aeb),y)
 HOST_GCC_FINAL_CONF_OPTS += "--with-multilib-list=m4a,m4a-nofpu"
-HOST_GCC_FINAL_GCC_LIB_DIR = $(HOST_DIR)/usr/$(GNU_TARGET_NAME)/lib/!m4*
+HOST_GCC_FINAL_GCC_LIB_DIR = $(HOST_DIR)/$(GNU_TARGET_NAME)/lib/!m4*
 endif
 
 ifeq ($(BR2_bfin),y)
@@ -103,9 +103,9 @@ HOST_GCC_FINAL_MAKE_OPTS += $(HOST_GCC_COMMON_MAKE_OPTS)
 
 # Make sure we have 'cc'
 define HOST_GCC_FINAL_CREATE_CC_SYMLINKS
-	if [ ! -e $(HOST_DIR)/usr/bin/$(GNU_TARGET_NAME)-cc ]; then \
-		ln -f $(HOST_DIR)/usr/bin/$(GNU_TARGET_NAME)-gcc \
-			$(HOST_DIR)/usr/bin/$(GNU_TARGET_NAME)-cc; \
+	if [ ! -e $(HOST_DIR)/bin/$(GNU_TARGET_NAME)-cc ]; then \
+		ln -f $(HOST_DIR)/bin/$(GNU_TARGET_NAME)-gcc \
+			$(HOST_DIR)/bin/$(GNU_TARGET_NAME)-cc; \
 	fi
 endef
 
#17 lore raw

PATCH v3 9/14 pkg-autotools: use $(HOST_DIR) instead of $(HOST_DIR)/usr as prefix

In reply to Arnout Vandecappelle (Essensium/Mind)

Remove the redundant usr/ component of the HOST_DIR paths. Since a previous commit added a symlink from $(HOST_DIR)/usr to $(HOST_DIR), everything keeps on working.

Build-tested with a bunch of autotools packages.

---
 package/pkg-autotools.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/pkg-autotools.mk +1 -1
index e215382d06..03e25b3694 100644
@@ -220,7 +220,7 @@ define $(2)_CONFIGURE_CMDS
 	$$($$(PKG)_CONF_ENV) \
 	CONFIG_SITE=/dev/null \
 	./configure \
-		--prefix="$$(HOST_DIR)/usr" \
+		--prefix="$$(HOST_DIR)" \
 		--sysconfdir="$$(HOST_DIR)/etc" \
 		--localstatedir="$$(HOST_DIR)/var" \
 		--enable-shared --disable-static \
Signature · 1 line
2.13.2
#18 lore raw

PATCH v3 9/14 pkg-autotools: use $(HOST_DIR) instead of $(HOST_DIR)/usr as prefix

Hi Arnout,

Le 04/07/2017 ? 16:03, Arnout Vandecappelle (Essensium/Mind) a ?crit :

Quoted 7 lines

Remove the redundant usr/ component of the HOST_DIR paths. Since a previous commit added a symlink from $(HOST_DIR)/usr to $(HOST_DIR), everything keeps on working.

Build-tested with a bunch of autotools packages.

Best regards,
Romain

Quoted 18 lines
---
 package/pkg-autotools.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/pkg-autotools.mk +1 -1
index e215382d06..03e25b3694 100644
@@ -220,7 +220,7 @@ define $(2)_CONFIGURE_CMDS
 	$$($$(PKG)_CONF_ENV) \
 	CONFIG_SITE=/dev/null \
 	./configure \
-		--prefix="$$(HOST_DIR)/usr" \
+		--prefix="$$(HOST_DIR)" \
 		--sysconfdir="$$(HOST_DIR)/etc" \
 		--localstatedir="$$(HOST_DIR)/var" \
 		--enable-shared --disable-static \
#19 lore raw

PATCH v3 10/14 pkg-cmake: use $(HOST_DIR) instead of $(HOST_DIR)/usr as prefix

In reply to Arnout Vandecappelle (Essensium/Mind)

Remove the redundant usr/ component of the HOST_DIR paths. Since a previous commit added a symlink from $(HOST_DIR)/usr to $(HOST_DIR), everything keeps on working.

Build-tested with a bunch of cmake packages.

---
 package/pkg-cmake.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/pkg-cmake.mk +1 -1
index 0897430f70..0606d26ad7 100644
@@ -115,7 +115,7 @@ define $(2)_CONFIGURE_CMDS
 		-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM="BOTH" \
 		-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY="BOTH" \
 		-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE="BOTH" \
-		-DCMAKE_INSTALL_PREFIX="$$(HOST_DIR)/usr" \
+		-DCMAKE_INSTALL_PREFIX="$$(HOST_DIR)" \
 		-DCMAKE_C_FLAGS="$$(HOST_CFLAGS)" \
 		-DCMAKE_CXX_FLAGS="$$(HOST_CXXFLAGS)" \
 		-DCMAKE_EXE_LINKER_FLAGS="$$(HOST_LDFLAGS)" \
Signature · 1 line
2.13.2
#20 lore raw

PATCH v3 10/14 pkg-cmake: use $(HOST_DIR) instead of $(HOST_DIR)/usr as prefix

Hi Arnout,

Le 04/07/2017 ? 16:04, Arnout Vandecappelle (Essensium/Mind) a ?crit :

Quoted 7 lines

Remove the redundant usr/ component of the HOST_DIR paths. Since a previous commit added a symlink from $(HOST_DIR)/usr to $(HOST_DIR), everything keeps on working.

Build-tested with a bunch of cmake packages.

Best regards,
Romain

Quoted 18 lines
---
 package/pkg-cmake.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/pkg-cmake.mk +1 -1
index 0897430f70..0606d26ad7 100644
@@ -115,7 +115,7 @@ define $(2)_CONFIGURE_CMDS
 		-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM="BOTH" \
 		-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY="BOTH" \
 		-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE="BOTH" \
-		-DCMAKE_INSTALL_PREFIX="$$(HOST_DIR)/usr" \
+		-DCMAKE_INSTALL_PREFIX="$$(HOST_DIR)" \
 		-DCMAKE_C_FLAGS="$$(HOST_CFLAGS)" \
 		-DCMAKE_CXX_FLAGS="$$(HOST_CXXFLAGS)" \
 		-DCMAKE_EXE_LINKER_FLAGS="$$(HOST_LDFLAGS)" \
#21 lore raw

PATCH v3 11/14 pkg-cmake: move configuration files out of $(HOST_DIR)/usr

In reply to Arnout Vandecappelle (Essensium/Mind)

Move toolchainfile.cmake and Buildroot.cmake from $(HOST_DIR)/usr/share/buildroot to $(HOST_DIR)/share/buildroot.

Build-tested with a bunch of cmake packages.

---
 package/pkg-cmake.mk                | 8 ++++----
 support/misc/toolchainfile.cmake.in | 4 ++--
 toolchain/toolchain/toolchain.mk    | 4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)
package/pkg-cmake.mk +4 -4
index 0606d26ad7..1bb3652a13 100644
@@ -86,7 +86,7 @@ define $(2)_CONFIGURE_CMDS
 	rm -f CMakeCache.txt && \
 	PATH=$$(BR_PATH) \
 	$$($$(PKG)_CONF_ENV) $$(BR2_CMAKE) $$($$(PKG)_SRCDIR) \
-		-DCMAKE_TOOLCHAIN_FILE="$$(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake" \
+		-DCMAKE_TOOLCHAIN_FILE="$$(HOST_DIR)/share/buildroot/toolchainfile.cmake" \
 		-DCMAKE_INSTALL_PREFIX="/usr" \
 		-DCMAKE_COLOR_MAKEFILE=OFF \
 		-DBUILD_DOC=OFF \
@@ -234,10 +234,10 @@ CMAKE_SYSTEM_PROCESSOR = $(BR2_ARCH)
 endif
 
 # In order to allow the toolchain to be relocated, we calculate the HOST_DIR
-# based on the toolchainfile.cmake file's location: $(HOST_DIR)/usr/share/buildroot
+# based on the toolchainfile.cmake file's location: $(HOST_DIR)/share/buildroot
 # In all the other variables, HOST_DIR will be replaced by RELOCATED_HOST_DIR,
 # so we have to strip "$(HOST_DIR)/" from the paths that contain it.
-$(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake:
+$(HOST_DIR)/share/buildroot/toolchainfile.cmake:
 	@mkdir -p $(@D)
 	sed \
 		-e 's#@@STAGING_SUBDIR@@#$(call qstrip,$(STAGING_SUBDIR))#' \
@@ -254,5 +254,5 @@ $(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake:
 		$(TOPDIR)/support/misc/toolchainfile.cmake.in \
 		> $@
 
-$(HOST_DIR)/usr/share/buildroot/Platform/Buildroot.cmake:
+$(HOST_DIR)/share/buildroot/Platform/Buildroot.cmake:
 	$(Q)$(INSTALL) -D -m 0644 support/misc/Buildroot.cmake $(@)
support/misc/toolchainfile.cmake.in +2 -2
index c38800e598..c8c710bddd 100644
@@ -4,11 +4,11 @@
 #
 
 # In order to allow the toolchain to be relocated, we calculate the
-# HOST_DIR based on this file's location: $(HOST_DIR)/usr/share/buildroot
+# HOST_DIR based on this file's location: $(HOST_DIR)/share/buildroot
 # and store it in RELOCATED_HOST_DIR.
 # All the other variables that need to refer to HOST_DIR will use the
 # RELOCATED_HOST_DIR variable.
-string(REPLACE "/usr/share/buildroot" "" RELOCATED_HOST_DIR ${CMAKE_CURRENT_LIST_DIR})
+string(REPLACE "/share/buildroot" "" RELOCATED_HOST_DIR ${CMAKE_CURRENT_LIST_DIR})
 
 # Point cmake to the location where we have our custom modules,
 # so that it can find our custom platform description.
toolchain/toolchain/toolchain.mk +2 -2
index e15ceeb426..b55b0c712c 100644
@@ -39,5 +39,5 @@ endif
 
 $(eval $(virtual-package))
 
-toolchain: $(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake
-toolchain: $(HOST_DIR)/usr/share/buildroot/Platform/Buildroot.cmake
+toolchain: $(HOST_DIR)/share/buildroot/toolchainfile.cmake
+toolchain: $(HOST_DIR)/share/buildroot/Platform/Buildroot.cmake
Signature · 1 line
2.13.2
#22 lore raw

PATCH v3 11/14 pkg-cmake: move configuration files out of $(HOST_DIR)/usr

Hi Arnout,

Le 04/07/2017 ? 16:04, Arnout Vandecappelle (Essensium/Mind) a ?crit :

Quoted 6 lines

Move toolchainfile.cmake and Buildroot.cmake from $(HOST_DIR)/usr/share/buildroot to $(HOST_DIR)/share/buildroot.

Build-tested with a bunch of cmake packages.

Best regards,
Romain

Quoted 70 lines
---
 package/pkg-cmake.mk                | 8 ++++----
 support/misc/toolchainfile.cmake.in | 4 ++--
 toolchain/toolchain/toolchain.mk    | 4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)
package/pkg-cmake.mk +4 -4
index 0606d26ad7..1bb3652a13 100644
@@ -86,7 +86,7 @@ define $(2)_CONFIGURE_CMDS
 	rm -f CMakeCache.txt && \
 	PATH=$$(BR_PATH) \
 	$$($$(PKG)_CONF_ENV) $$(BR2_CMAKE) $$($$(PKG)_SRCDIR) \
-		-DCMAKE_TOOLCHAIN_FILE="$$(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake" \
+		-DCMAKE_TOOLCHAIN_FILE="$$(HOST_DIR)/share/buildroot/toolchainfile.cmake" \
 		-DCMAKE_INSTALL_PREFIX="/usr" \
 		-DCMAKE_COLOR_MAKEFILE=OFF \
 		-DBUILD_DOC=OFF \
@@ -234,10 +234,10 @@ CMAKE_SYSTEM_PROCESSOR = $(BR2_ARCH)
 endif
 
 # In order to allow the toolchain to be relocated, we calculate the HOST_DIR
-# based on the toolchainfile.cmake file's location: $(HOST_DIR)/usr/share/buildroot
+# based on the toolchainfile.cmake file's location: $(HOST_DIR)/share/buildroot
 # In all the other variables, HOST_DIR will be replaced by RELOCATED_HOST_DIR,
 # so we have to strip "$(HOST_DIR)/" from the paths that contain it.
-$(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake:
+$(HOST_DIR)/share/buildroot/toolchainfile.cmake:
 	@mkdir -p $(@D)
 	sed \
 		-e 's#@@STAGING_SUBDIR@@#$(call qstrip,$(STAGING_SUBDIR))#' \
@@ -254,5 +254,5 @@ $(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake:
 		$(TOPDIR)/support/misc/toolchainfile.cmake.in \
 		> $@
 
-$(HOST_DIR)/usr/share/buildroot/Platform/Buildroot.cmake:
+$(HOST_DIR)/share/buildroot/Platform/Buildroot.cmake:
 	$(Q)$(INSTALL) -D -m 0644 support/misc/Buildroot.cmake $(@)
support/misc/toolchainfile.cmake.in +2 -2
index c38800e598..c8c710bddd 100644
@@ -4,11 +4,11 @@
 #
 
 # In order to allow the toolchain to be relocated, we calculate the
-# HOST_DIR based on this file's location: $(HOST_DIR)/usr/share/buildroot
+# HOST_DIR based on this file's location: $(HOST_DIR)/share/buildroot
 # and store it in RELOCATED_HOST_DIR.
 # All the other variables that need to refer to HOST_DIR will use the
 # RELOCATED_HOST_DIR variable.
-string(REPLACE "/usr/share/buildroot" "" RELOCATED_HOST_DIR ${CMAKE_CURRENT_LIST_DIR})
+string(REPLACE "/share/buildroot" "" RELOCATED_HOST_DIR ${CMAKE_CURRENT_LIST_DIR})
 
 # Point cmake to the location where we have our custom modules,
 # so that it can find our custom platform description.
toolchain/toolchain/toolchain.mk +2 -2
index e15ceeb426..b55b0c712c 100644
@@ -39,5 +39,5 @@ endif
 
 $(eval $(virtual-package))
 
-toolchain: $(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake
-toolchain: $(HOST_DIR)/usr/share/buildroot/Platform/Buildroot.cmake
+toolchain: $(HOST_DIR)/share/buildroot/toolchainfile.cmake
+toolchain: $(HOST_DIR)/share/buildroot/Platform/Buildroot.cmake
#23 lore raw

PATCH v3 12/14 pkg-cmake: programs are now installed in $(HOST_DIR)/bin

In reply to Arnout Vandecappelle (Essensium/Mind)

Remove the redundant usr/ component of the HOST_DIR paths. Since a previous commit added a symlink from $(HOST_DIR)/usr to $(HOST_DIR), everything keeps on working.

---
 support/misc/toolchainfile.cmake.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
support/misc/toolchainfile.cmake.in +1 -1
index c8c710bddd..1f5d2371ed 100644
@@ -48,7 +48,7 @@ set(CMAKE_EXE_LINKER_FLAGS "@@TARGET_LDFLAGS@@" CACHE STRING "Buildroot LDFLAGS
 
 set(CMAKE_INSTALL_SO_NO_EXE 0)
 
-set(CMAKE_PROGRAM_PATH "${RELOCATED_HOST_DIR}/usr/bin")
+set(CMAKE_PROGRAM_PATH "${RELOCATED_HOST_DIR}/bin")
 set(CMAKE_SYSROOT "${RELOCATED_HOST_DIR}/@@STAGING_SUBDIR@@")
 set(CMAKE_FIND_ROOT_PATH "${RELOCATED_HOST_DIR}/@@STAGING_SUBDIR@@")
 set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
Signature · 1 line
2.13.2
#24 lore raw

PATCH v3 12/14 pkg-cmake: programs are now installed in $(HOST_DIR)/bin

Hi Arnout,

Le 04/07/2017 ? 16:04, Arnout Vandecappelle (Essensium/Mind) a ?crit :

Quoted 5 lines

Remove the redundant usr/ component of the HOST_DIR paths. Since a previous commit added a symlink from $(HOST_DIR)/usr to $(HOST_DIR), everything keeps on working.

Best regards,
Romain

Quoted 18 lines
---
 support/misc/toolchainfile.cmake.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
support/misc/toolchainfile.cmake.in +1 -1
index c8c710bddd..1f5d2371ed 100644
@@ -48,7 +48,7 @@ set(CMAKE_EXE_LINKER_FLAGS "@@TARGET_LDFLAGS@@" CACHE STRING "Buildroot LDFLAGS
 
 set(CMAKE_INSTALL_SO_NO_EXE 0)
 
-set(CMAKE_PROGRAM_PATH "${RELOCATED_HOST_DIR}/usr/bin")
+set(CMAKE_PROGRAM_PATH "${RELOCATED_HOST_DIR}/bin")
 set(CMAKE_SYSROOT "${RELOCATED_HOST_DIR}/@@STAGING_SUBDIR@@")
 set(CMAKE_FIND_ROOT_PATH "${RELOCATED_HOST_DIR}/@@STAGING_SUBDIR@@")
 set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
#25 lore raw

PATCH v3 13/14 pkg-python: use $(HOST_DIR) instead of $(HOST_DIR)/usr as prefix

In reply to Arnout Vandecappelle (Essensium/Mind)

Remove the redundant usr/ component of the HOST_DIR paths. Since a previous commit added a symlink from $(HOST_DIR)/usr to $(HOST_DIR), everything keeps on working.

Build-tested with a bunch of python packages.

---
 package/pkg-python.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
package/pkg-python.mk +2 -2
index 2418f5dfa4..6e411ab5c5 100644
@@ -53,7 +53,7 @@ HOST_PKG_PYTHON_DISTUTILS_ENV = \
 	PYTHONNOUSERSITE=1
 
 HOST_PKG_PYTHON_DISTUTILS_INSTALL_OPTS = \
-	--prefix=$(HOST_DIR)/usr
+	--prefix=$(HOST_DIR)
 
 # Target setuptools-based packages
 PKG_PYTHON_SETUPTOOLS_ENV = \
@@ -83,7 +83,7 @@ HOST_PKG_PYTHON_SETUPTOOLS_ENV = \
 	PYTHONNOUSERSITE=1
 
 HOST_PKG_PYTHON_SETUPTOOLS_INSTALL_OPTS = \
-	--prefix=$(HOST_DIR)/usr
+	--prefix=$(HOST_DIR)
 
 ################################################################################
 # inner-python-package -- defines how the configuration, compilation
Signature · 1 line
2.13.2
#26 lore raw

PATCH v3 13/14 pkg-python: use $(HOST_DIR) instead of $(HOST_DIR)/usr as prefix

Hi Arnout,

Le 04/07/2017 ? 16:04, Arnout Vandecappelle (Essensium/Mind) a ?crit :

Quoted 7 lines

Remove the redundant usr/ component of the HOST_DIR paths. Since a previous commit added a symlink from $(HOST_DIR)/usr to $(HOST_DIR), everything keeps on working.

Build-tested with a bunch of python packages.

Best regards,
Romain

Quoted 27 lines
---
 package/pkg-python.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
package/pkg-python.mk +2 -2
index 2418f5dfa4..6e411ab5c5 100644
@@ -53,7 +53,7 @@ HOST_PKG_PYTHON_DISTUTILS_ENV = \
 	PYTHONNOUSERSITE=1
 
 HOST_PKG_PYTHON_DISTUTILS_INSTALL_OPTS = \
-	--prefix=$(HOST_DIR)/usr
+	--prefix=$(HOST_DIR)
 
 # Target setuptools-based packages
 PKG_PYTHON_SETUPTOOLS_ENV = \
@@ -83,7 +83,7 @@ HOST_PKG_PYTHON_SETUPTOOLS_ENV = \
 	PYTHONNOUSERSITE=1
 
 HOST_PKG_PYTHON_SETUPTOOLS_INSTALL_OPTS = \
-	--prefix=$(HOST_DIR)/usr
+	--prefix=$(HOST_DIR)
 
 ################################################################################
 # inner-python-package -- defines how the configuration, compilation
#27 lore raw

PATCH v3 14/14 pkg-rebar: use $(HOST_DIR) instead of $(HOST_DIR)/usr as prefix

In reply to Arnout Vandecappelle (Essensium/Mind)

Remove the redundant usr/ component of the HOST_DIR paths. Since a previous commit added a symlink from $(HOST_DIR)/usr to $(HOST_DIR), everything keeps on working.

$(PKG)_ERLANG_LIBDIR is problematic because it is used both for host and staging/target. Therefore, the usr/ part is removed from it, and added the the callers instead.

---
v2: ERLANG_LIBDIR no longer starts with a /

---
 package/pkg-rebar.mk | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
package/pkg-rebar.mk +7 -7
index cc6b775ae5..e2b4a58681 100644
@@ -25,14 +25,14 @@
 # infrastructure tells rebar to NOT download dependencies during
 # the build stage.
 #
-REBAR_HOST_DEPS_DIR = $(HOST_DIR)/usr/share/rebar/deps
+REBAR_HOST_DEPS_DIR = $(HOST_DIR)/share/rebar/deps
 REBAR_TARGET_DEPS_DIR = $(STAGING_DIR)/usr/share/rebar/deps
 
 # Tell rebar where to find the dependencies
 #
 REBAR_HOST_DEPS_ENV = \
 	ERL_COMPILER_OPTIONS='{i, "$(REBAR_HOST_DEPS_DIR)"}' \
-	ERL_EI_LIBDIR=$(HOST_DIR)/usr/lib/erlang/lib/erl_interface-$(ERLANG_EI_VSN)/lib
+	ERL_EI_LIBDIR=$(HOST_DIR)/lib/erlang/lib/erl_interface-$(ERLANG_EI_VSN)/lib
 REBAR_TARGET_DEPS_ENV = \
 	ERL_COMPILER_OPTIONS='{i, "$(REBAR_TARGET_DEPS_DIR)"}' \
 	ERL_EI_LIBDIR=$(STAGING_DIR)/usr/lib/erlang/lib/erl_interface-$(ERLANG_EI_VSN)/lib
@@ -119,10 +119,10 @@ define inner-rebar-package
 $(2)_ERLANG_APP = $(subst -,_,$(patsubst erlang-%,%,$(patsubst host-%,%,$(1))))
 
 # Path where to store the package's libs, relative to either $(HOST_DIR)
-# for host packages, or $(STAGING_DIR) for target packages.
+# for host packages, or $(STAGING_DIR)/usr for target packages.
 #
 $(2)_ERLANG_LIBDIR = \
-	usr/lib/erlang/lib/$$($$(PKG)_ERLANG_APP)-$$($$(PKG)_VERSION)
+	lib/erlang/lib/$$($$(PKG)_ERLANG_APP)-$$($$(PKG)_VERSION)
 
 # If a host package, inherit <pkg>_USE_BUNDLED_REBAR from the target
 # package, if not explicitly defined. Otherwise, default to NO.
@@ -173,8 +173,8 @@ endif
 # package-related variables
 ifndef $(2)_INSTALL_STAGING_CMDS
 define $(2)_INSTALL_STAGING_CMDS
-	$$(call install-erlang-directories,$$(STAGING_DIR),include)
-	$$(call install-rebar-deps,$$(STAGING_DIR),TARGET)
+	$$(call install-erlang-directories,$$(STAGING_DIR)/usr,include)
+	$$(call install-rebar-deps,$$(STAGING_DIR)/usr,TARGET)
 endef
 endif
 
@@ -182,7 +182,7 @@ endif
 # package-related variables
 ifndef $(2)_INSTALL_TARGET_CMDS
 define $(2)_INSTALL_TARGET_CMDS
-	$$(call install-erlang-directories,$$(TARGET_DIR))
+	$$(call install-erlang-directories,$$(TARGET_DIR)/usr)
 endef
 endif
 
Signature · 1 line
2.13.2
#28 lore raw

PATCH v3 14/14 pkg-rebar: use $(HOST_DIR) instead of $(HOST_DIR)/usr as prefix

Hi Arnout,

Le 04/07/2017 ? 16:04, Arnout Vandecappelle (Essensium/Mind) a ?crit :

Quoted 10 lines

Remove the redundant usr/ component of the HOST_DIR paths. Since a previous commit added a symlink from $(HOST_DIR)/usr to $(HOST_DIR), everything keeps on working.

$(PKG)_ERLANG_LIBDIR is problematic because it is used both for host and staging/target. Therefore, the usr/ part is removed from it, and added the the callers instead.

Best regards,
Romain

Quoted 61 lines

---
v2: ERLANG_LIBDIR no longer starts with a /

---
 package/pkg-rebar.mk | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
package/pkg-rebar.mk +7 -7
index cc6b775ae5..e2b4a58681 100644
@@ -25,14 +25,14 @@
 # infrastructure tells rebar to NOT download dependencies during
 # the build stage.
 #
-REBAR_HOST_DEPS_DIR = $(HOST_DIR)/usr/share/rebar/deps
+REBAR_HOST_DEPS_DIR = $(HOST_DIR)/share/rebar/deps
 REBAR_TARGET_DEPS_DIR = $(STAGING_DIR)/usr/share/rebar/deps
 
 # Tell rebar where to find the dependencies
 #
 REBAR_HOST_DEPS_ENV = \
 	ERL_COMPILER_OPTIONS='{i, "$(REBAR_HOST_DEPS_DIR)"}' \
-	ERL_EI_LIBDIR=$(HOST_DIR)/usr/lib/erlang/lib/erl_interface-$(ERLANG_EI_VSN)/lib
+	ERL_EI_LIBDIR=$(HOST_DIR)/lib/erlang/lib/erl_interface-$(ERLANG_EI_VSN)/lib
 REBAR_TARGET_DEPS_ENV = \
 	ERL_COMPILER_OPTIONS='{i, "$(REBAR_TARGET_DEPS_DIR)"}' \
 	ERL_EI_LIBDIR=$(STAGING_DIR)/usr/lib/erlang/lib/erl_interface-$(ERLANG_EI_VSN)/lib
@@ -119,10 +119,10 @@ define inner-rebar-package
 $(2)_ERLANG_APP = $(subst -,_,$(patsubst erlang-%,%,$(patsubst host-%,%,$(1))))
 
 # Path where to store the package's libs, relative to either $(HOST_DIR)
-# for host packages, or $(STAGING_DIR) for target packages.
+# for host packages, or $(STAGING_DIR)/usr for target packages.
 #
 $(2)_ERLANG_LIBDIR = \
-	usr/lib/erlang/lib/$$($$(PKG)_ERLANG_APP)-$$($$(PKG)_VERSION)
+	lib/erlang/lib/$$($$(PKG)_ERLANG_APP)-$$($$(PKG)_VERSION)
 
 # If a host package, inherit <pkg>_USE_BUNDLED_REBAR from the target
 # package, if not explicitly defined. Otherwise, default to NO.
@@ -173,8 +173,8 @@ endif
 # package-related variables
 ifndef $(2)_INSTALL_STAGING_CMDS
 define $(2)_INSTALL_STAGING_CMDS
-	$$(call install-erlang-directories,$$(STAGING_DIR),include)
-	$$(call install-rebar-deps,$$(STAGING_DIR),TARGET)
+	$$(call install-erlang-directories,$$(STAGING_DIR)/usr,include)
+	$$(call install-rebar-deps,$$(STAGING_DIR)/usr,TARGET)
 endef
 endif
 
@@ -182,7 +182,7 @@ endif
 # package-related variables
 ifndef $(2)_INSTALL_TARGET_CMDS
 define $(2)_INSTALL_TARGET_CMDS
-	$$(call install-erlang-directories,$$(TARGET_DIR))
+	$$(call install-erlang-directories,$$(TARGET_DIR)/usr)
 endef
 endif
 
#29 lore raw

v3 cover Remove /usr component from HOST_DIR

In reply to Arnout Vandecappelle (Essensium/Mind)

Hello,

Quoted 7 lines · Arnout Vandecappelle (Essensium/Mind)

Arnout Vandecappelle (14):
Move $(HOST_DIR)/usr/$(GNU_TARGET_NAME) one level up. Move $(HOST_DIR)/usr/lib to $(HOST_DIR)/lib
Eliminate $(HOST_DIR)/usr
check-host-rpath: no longer check $(HOST_DIR)/usr/{bin,sbin}
Makefile: remove $(HOST_DIR)/usr from BR_PATH package/Makefile.in: remove $(HOST_DIR)/usr part from HOST_LDFLAGS

Quoted 8 lines

gdb: Remove /usr part from installation path of gdbserver
gcc-final: things are no longer installed in $(HOST_DIR)/usr
pkg-autotools: use $(HOST_DIR) instead of $(HOST_DIR)/usr as prefix
pkg-cmake: use $(HOST_DIR) instead of $(HOST_DIR)/usr as prefix
pkg-cmake: move configuration files out of $(HOST_DIR)/usr
pkg-cmake: programs are now installed in $(HOST_DIR)/bin
pkg-python: use $(HOST_DIR) instead of $(HOST_DIR)/usr as prefix
pkg-rebar: use $(HOST_DIR) instead of $(HOST_DIR)/usr as prefix

Series applied. Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com