* [Buildroot] [PATCH 0/8] Remove /usr component from HOST_DIR
@ 2017-07-03 12:44 Arnout Vandecappelle
2017-07-03 12:44 ` [Buildroot] [PATCH 1/8] pkg-rebar: remove redundant / in front of $($(PKG)_ERLANG_LIBDIR) Arnout Vandecappelle
` (8 more replies)
0 siblings, 9 replies; 12+ messages in thread
From: Arnout Vandecappelle @ 2017-07-03 12:44 UTC (permalink / raw)
To: buildroot
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.
I've tested both internal and external toolchains, and a large number
of host packages after these changes, including the target packages
that depend on them. 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. So after this series
(and at any point in between) everything seems to work fine still.
This is only the first part of the cleanup. It still needs to be
followed by about 45 patches to remove the /usr part from all packages.
I'm waiting with rebasing and posting that part because it is very
fragile w.r.t. merge conflicts.
I also noticed a small issue in pkg-rebar, so I added an additional
patch in the very beginning of the series that fixes it. It's totally
independent of the rest, however.
Regards,
Arnout
-----------------------------------------------------------------------------
Arnout Vandecappelle (8):
pkg-rebar: remove redundant / in front of $($(PKG)_ERLANG_LIBDIR)
libsepol: rework host installation
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
Makefile | 11 ++++++++---
package/Makefile.in | 4 ++--
package/libsepol/libsepol.mk | 13 ++++++++-----
package/pkg-rebar.mk | 6 +++---
support/scripts/check-host-rpath | 8 +++++---
toolchain/toolchain-external/pkg-toolchain-external.mk | 6 +++---
toolchain/toolchain-wrapper.c | 2 +-
7 files changed, 30 insertions(+), 20 deletions(-)
--
2.13.2
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Buildroot] [PATCH 1/8] pkg-rebar: remove redundant / in front of $($(PKG)_ERLANG_LIBDIR)
2017-07-03 12:44 [Buildroot] [PATCH 0/8] Remove /usr component from HOST_DIR Arnout Vandecappelle
@ 2017-07-03 12:44 ` Arnout Vandecappelle
2017-07-04 6:38 ` Thomas Petazzoni
2017-07-03 12:44 ` [Buildroot] [PATCH 2/8] libsepol: rework host installation Arnout Vandecappelle
` (7 subsequent siblings)
8 siblings, 1 reply; 12+ messages in thread
From: Arnout Vandecappelle @ 2017-07-03 12:44 UTC (permalink / raw)
To: buildroot
Sometimes $(1)/$($(PKG)_ERLANG_LIBDIR) is used, sometimes
$(1)$($(PKG)_ERLANG_LIBDIR). Make this consistent, with /. Therefore,
remove the leading / from $($(PKG)_ERLANG_LIBDIR).
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
---
v2: keep the /, remove it from $($(PKG)_ERLANG_LIBDIR)
---
package/pkg-rebar.mk | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/package/pkg-rebar.mk b/package/pkg-rebar.mk
index 7605a64ade..cc6b775ae5 100644
--- a/package/pkg-rebar.mk
+++ b/package/pkg-rebar.mk
@@ -44,7 +44,7 @@ REBAR_TARGET_DEPS_ENV = \
# Install an Erlang application from $(@D).
#
# i.e., define a recipe that installs the "bin ebin priv $(2)" directories
-# from $(@D) to $(1)$($(PKG)_ERLANG_LIBDIR).
+# from $(@D) to $(1)/$($(PKG)_ERLANG_LIBDIR).
#
# argument 1 should typically be $(HOST_DIR), $(TARGET_DIR),
# or $(STAGING_DIR).
@@ -59,7 +59,7 @@ define install-erlang-directories
$(INSTALL) -d $(1)/$($(PKG)_ERLANG_LIBDIR)
for dir in bin ebin priv $(2); do \
if test -d $(@D)/$$dir; then \
- cp -r $(@D)/$$dir $(1)$($(PKG)_ERLANG_LIBDIR); \
+ cp -r $(@D)/$$dir $(1)/$($(PKG)_ERLANG_LIBDIR); \
fi; \
done
endef
@@ -122,7 +122,7 @@ $(2)_ERLANG_APP = $(subst -,_,$(patsubst erlang-%,%,$(patsubst host-%,%,$(1))))
# for host packages, or $(STAGING_DIR) for target packages.
#
$(2)_ERLANG_LIBDIR = \
- /usr/lib/erlang/lib/$$($$(PKG)_ERLANG_APP)-$$($$(PKG)_VERSION)
+ usr/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.
--
2.13.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Buildroot] [PATCH 2/8] libsepol: rework host installation
2017-07-03 12:44 [Buildroot] [PATCH 0/8] Remove /usr component from HOST_DIR Arnout Vandecappelle
2017-07-03 12:44 ` [Buildroot] [PATCH 1/8] pkg-rebar: remove redundant / in front of $($(PKG)_ERLANG_LIBDIR) Arnout Vandecappelle
@ 2017-07-03 12:44 ` Arnout Vandecappelle
2017-07-04 6:45 ` Thomas Petazzoni
2017-07-03 12:44 ` [Buildroot] [PATCH 3/8] Move $(HOST_DIR)/usr/$(GNU_TARGET_NAME) one level up Arnout Vandecappelle
` (6 subsequent siblings)
8 siblings, 1 reply; 12+ messages in thread
From: Arnout Vandecappelle @ 2017-07-03 12:44 UTC (permalink / raw)
To: buildroot
libsepol has a pretty peculiar interpretation of DESTDIR and PREFIX.
PREFIX is not consistently used: some installation paths are forced to
$(DESTDIR)/usr/... . Also, the shared lib symlink is forced to ../../lib
(i.e. assumes it's installed under /usr). For these reasons, the host
build and install commands are a bit unusual: they use DESTDIR instead
of PREFIX, DESTDIR points to $(HOST_DIR) without /usr, and some
additional fixup is needed to correct the installation directory of
libsepol.so.1 and the symlink to it.
This can be simplified quite a lot by passing both DESTDIR and PREFIX,
and including the /usr part in both. The symlink still has to be fixed,
but that's much simpler.
Note that a side effect is that the man pages are now installed under
$(HOST_DIR)/usr/usr/man. While not very nice, we don't really care
about man pages. In addition, this will resolve itself when we later
move $(HOST_DIR)/usr to $(HOST_DIR).
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
---
It's a bit counter-intuitive to have a patch that adds /usr in a series
that is meant to remove it, but this is the simplest way to have a
bisectable series...
---
package/libsepol/libsepol.mk | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/package/libsepol/libsepol.mk b/package/libsepol/libsepol.mk
index 9bdac1e0da..d360bfbcb1 100644
--- a/package/libsepol/libsepol.mk
+++ b/package/libsepol/libsepol.mk
@@ -33,15 +33,18 @@ define LIBSEPOL_INSTALL_TARGET_CMDS
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) install $(LIBSEPOL_MAKE_FLAGS) DESTDIR=$(TARGET_DIR)
endef
+HOST_LIBSEPOL_MAKE_ENV = \
+ $(HOST_MAKE_ENV) \
+ DESTDIR=$(HOST_DIR)/usr \
+ PREFIX=$(HOST_DIR)/usr
+
define HOST_LIBSEPOL_BUILD_CMDS
- $(HOST_MAKE_ENV) $(MAKE) -C $(@D) $(HOST_CONFIGURE_OPTS) DESTDIR=$(HOST_DIR)
+ $(HOST_LIBSEPOL_MAKE_ENV) $(MAKE) -C $(@D) $(HOST_CONFIGURE_OPTS)
endef
define HOST_LIBSEPOL_INSTALL_CMDS
- $(HOST_MAKE_ENV) $(MAKE) -C $(@D) install $(HOST_CONFIGURE_OPTS) DESTDIR=$(HOST_DIR)
- mv $(HOST_DIR)/lib/libsepol.so.1 $(HOST_DIR)/usr/lib
- (cd $(HOST_DIR)/usr/lib; rm -f libsepol.so; ln -s libsepol.so.1 libsepol.so)
- -rmdir $(HOST_DIR)/lib
+ $(HOST_LIBSEPOL_MAKE_ENV) $(MAKE) -C $(@D) install $(HOST_CONFIGURE_OPTS)
+ ln -sf libsepol.so.1 $(HOST_DIR)/usr/lib/libsepol.so
endef
$(eval $(generic-package))
--
2.13.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Buildroot] [PATCH 3/8] Move $(HOST_DIR)/usr/$(GNU_TARGET_NAME) one level up.
2017-07-03 12:44 [Buildroot] [PATCH 0/8] Remove /usr component from HOST_DIR Arnout Vandecappelle
2017-07-03 12:44 ` [Buildroot] [PATCH 1/8] pkg-rebar: remove redundant / in front of $($(PKG)_ERLANG_LIBDIR) Arnout Vandecappelle
2017-07-03 12:44 ` [Buildroot] [PATCH 2/8] libsepol: rework host installation Arnout Vandecappelle
@ 2017-07-03 12:44 ` Arnout Vandecappelle
2017-07-03 12:44 ` [Buildroot] [PATCH 4/8] Move $(HOST_DIR)/usr/lib to $(HOST_DIR)/lib Arnout Vandecappelle
` (5 subsequent siblings)
8 siblings, 0 replies; 12+ messages in thread
From: Arnout Vandecappelle @ 2017-07-03 12:44 UTC (permalink / raw)
To: buildroot
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(-)
diff --git a/Makefile b/Makefile
index 36231fa9d6..fb252f2eb1 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)
--
2.13.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Buildroot] [PATCH 4/8] Move $(HOST_DIR)/usr/lib to $(HOST_DIR)/lib
2017-07-03 12:44 [Buildroot] [PATCH 0/8] Remove /usr component from HOST_DIR Arnout Vandecappelle
` (2 preceding siblings ...)
2017-07-03 12:44 ` [Buildroot] [PATCH 3/8] Move $(HOST_DIR)/usr/$(GNU_TARGET_NAME) one level up Arnout Vandecappelle
@ 2017-07-03 12:44 ` Arnout Vandecappelle
2017-07-03 12:44 ` [Buildroot] [PATCH 5/8] Eliminate $(HOST_DIR)/usr Arnout Vandecappelle
` (4 subsequent siblings)
8 siblings, 0 replies; 12+ messages in thread
From: Arnout Vandecappelle @ 2017-07-03 12:44 UTC (permalink / raw)
To: buildroot
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).
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
---
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(-)
diff --git a/Makefile b/Makefile
index fb252f2eb1..dee90b531c 100644
--- a/Makefile
+++ b/Makefile
@@ -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 = \
diff --git a/support/scripts/check-host-rpath b/support/scripts/check-host-rpath
index 020c12379f..adabfdf53f 100755
--- a/support/scripts/check-host-rpath
+++ b/support/scripts/check-host-rpath
@@ -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}" \
--
2.13.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Buildroot] [PATCH 5/8] Eliminate $(HOST_DIR)/usr
2017-07-03 12:44 [Buildroot] [PATCH 0/8] Remove /usr component from HOST_DIR Arnout Vandecappelle
` (3 preceding siblings ...)
2017-07-03 12:44 ` [Buildroot] [PATCH 4/8] Move $(HOST_DIR)/usr/lib to $(HOST_DIR)/lib Arnout Vandecappelle
@ 2017-07-03 12:44 ` Arnout Vandecappelle
2017-07-03 12:45 ` [Buildroot] [PATCH 6/8] check-host-rpath: no longer check $(HOST_DIR)/usr/{bin, sbin} Arnout Vandecappelle
` (3 subsequent siblings)
8 siblings, 0 replies; 12+ messages in thread
From: Arnout Vandecappelle @ 2017-07-03 12:44 UTC (permalink / raw)
To: buildroot
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.
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
---
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(-)
diff --git a/Makefile b/Makefile
index dee90b531c..c728364ab6 100644
--- a/Makefile
+++ b/Makefile
@@ -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 \
diff --git a/toolchain/toolchain-external/pkg-toolchain-external.mk b/toolchain/toolchain-external/pkg-toolchain-external.mk
index 8460e37d09..adbd3fe67e 100644
--- a/toolchain/toolchain-external/pkg-toolchain-external.mk
+++ b/toolchain/toolchain-external/pkg-toolchain-external.mk
@@ -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
diff --git a/toolchain/toolchain-wrapper.c b/toolchain/toolchain-wrapper.c
index 100aa181c6..3a4455ff82 100644
--- a/toolchain/toolchain-wrapper.c
+++ b/toolchain/toolchain-wrapper.c
@@ -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;
--
2.13.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Buildroot] [PATCH 6/8] check-host-rpath: no longer check $(HOST_DIR)/usr/{bin, sbin}
2017-07-03 12:44 [Buildroot] [PATCH 0/8] Remove /usr component from HOST_DIR Arnout Vandecappelle
` (4 preceding siblings ...)
2017-07-03 12:44 ` [Buildroot] [PATCH 5/8] Eliminate $(HOST_DIR)/usr Arnout Vandecappelle
@ 2017-07-03 12:45 ` Arnout Vandecappelle
2017-07-03 12:45 ` [Buildroot] [PATCH 7/8] Makefile: remove $(HOST_DIR)/usr from BR_PATH Arnout Vandecappelle
` (2 subsequent siblings)
8 siblings, 0 replies; 12+ messages in thread
From: Arnout Vandecappelle @ 2017-07-03 12:45 UTC (permalink / raw)
To: buildroot
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.
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
---
support/scripts/check-host-rpath | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/support/scripts/check-host-rpath b/support/scripts/check-host-rpath
index adabfdf53f..2846d5eb51 100755
--- a/support/scripts/check-host-rpath
+++ b/support/scripts/check-host-rpath
@@ -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/' \
)
--
2.13.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Buildroot] [PATCH 7/8] Makefile: remove $(HOST_DIR)/usr from BR_PATH
2017-07-03 12:44 [Buildroot] [PATCH 0/8] Remove /usr component from HOST_DIR Arnout Vandecappelle
` (5 preceding siblings ...)
2017-07-03 12:45 ` [Buildroot] [PATCH 6/8] check-host-rpath: no longer check $(HOST_DIR)/usr/{bin, sbin} Arnout Vandecappelle
@ 2017-07-03 12:45 ` Arnout Vandecappelle
2017-07-03 12:45 ` [Buildroot] [PATCH 8/8] package/Makefile.in: remove $(HOST_DIR)/usr part from HOST_LDFLAGS Arnout Vandecappelle
2017-07-03 19:01 ` [Buildroot] [PATCH 0/8] Remove /usr component from HOST_DIR Samuel Martin
8 siblings, 0 replies; 12+ messages in thread
From: Arnout Vandecappelle @ 2017-07-03 12:45 UTC (permalink / raw)
To: buildroot
Now $(HOST_DIR)/usr is a symlink to $(HOST_DIR), it makes no sense to
still have it in BR_PATH.
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index c728364ab6..257caca21b 100644
--- a/Makefile
+++ b/Makefile
@@ -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.
--
2.13.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Buildroot] [PATCH 8/8] package/Makefile.in: remove $(HOST_DIR)/usr part from HOST_LDFLAGS
2017-07-03 12:44 [Buildroot] [PATCH 0/8] Remove /usr component from HOST_DIR Arnout Vandecappelle
` (6 preceding siblings ...)
2017-07-03 12:45 ` [Buildroot] [PATCH 7/8] Makefile: remove $(HOST_DIR)/usr from BR_PATH Arnout Vandecappelle
@ 2017-07-03 12:45 ` Arnout Vandecappelle
2017-07-03 19:01 ` [Buildroot] [PATCH 0/8] Remove /usr component from HOST_DIR Samuel Martin
8 siblings, 0 replies; 12+ messages in thread
From: Arnout Vandecappelle @ 2017-07-03 12:45 UTC (permalink / raw)
To: buildroot
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.
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
---
package/Makefile.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package/Makefile.in b/package/Makefile.in
index 6b88ac4feb..25f1997fe6 100644
--- a/package/Makefile.in
+++ b/package/Makefile.in
@@ -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
--
2.13.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Buildroot] [PATCH 0/8] Remove /usr component from HOST_DIR
2017-07-03 12:44 [Buildroot] [PATCH 0/8] Remove /usr component from HOST_DIR Arnout Vandecappelle
` (7 preceding siblings ...)
2017-07-03 12:45 ` [Buildroot] [PATCH 8/8] package/Makefile.in: remove $(HOST_DIR)/usr part from HOST_LDFLAGS Arnout Vandecappelle
@ 2017-07-03 19:01 ` Samuel Martin
8 siblings, 0 replies; 12+ messages in thread
From: Samuel Martin @ 2017-07-03 19:01 UTC (permalink / raw)
To: buildroot
Arnout, all,
On Mon, Jul 3, 2017 at 2:44 PM, Arnout Vandecappelle (Essensium/Mind)
<arnout@mind.be> wrote:
> We currently use $(HOST_DIR)/usr as the prefix for host packages. That
> has a few disadvantages:
[...]
For the whole series:
Reviewed-by: Samuel Martin <s.martin49@gmail.com>
Regards,
--
Samuel
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Buildroot] [PATCH 1/8] pkg-rebar: remove redundant / in front of $($(PKG)_ERLANG_LIBDIR)
2017-07-03 12:44 ` [Buildroot] [PATCH 1/8] pkg-rebar: remove redundant / in front of $($(PKG)_ERLANG_LIBDIR) Arnout Vandecappelle
@ 2017-07-04 6:38 ` Thomas Petazzoni
0 siblings, 0 replies; 12+ messages in thread
From: Thomas Petazzoni @ 2017-07-04 6:38 UTC (permalink / raw)
To: buildroot
Hello,
On Mon, 3 Jul 2017 14:44:55 +0200, Arnout Vandecappelle
(Essensium/Mind) wrote:
> Sometimes $(1)/$($(PKG)_ERLANG_LIBDIR) is used, sometimes
> $(1)$($(PKG)_ERLANG_LIBDIR). Make this consistent, with /. Therefore,
> remove the leading / from $($(PKG)_ERLANG_LIBDIR).
>
> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
> ---
> v2: keep the /, remove it from $($(PKG)_ERLANG_LIBDIR)
> ---
> package/pkg-rebar.mk | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
Applied to master, thanks.
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Buildroot] [PATCH 2/8] libsepol: rework host installation
2017-07-03 12:44 ` [Buildroot] [PATCH 2/8] libsepol: rework host installation Arnout Vandecappelle
@ 2017-07-04 6:45 ` Thomas Petazzoni
0 siblings, 0 replies; 12+ messages in thread
From: Thomas Petazzoni @ 2017-07-04 6:45 UTC (permalink / raw)
To: buildroot
Hello,
On Mon, 3 Jul 2017 14:44:56 +0200, Arnout Vandecappelle
(Essensium/Mind) wrote:
> libsepol has a pretty peculiar interpretation of DESTDIR and PREFIX.
> PREFIX is not consistently used: some installation paths are forced to
> $(DESTDIR)/usr/... . Also, the shared lib symlink is forced to ../../lib
> (i.e. assumes it's installed under /usr). For these reasons, the host
> build and install commands are a bit unusual: they use DESTDIR instead
> of PREFIX, DESTDIR points to $(HOST_DIR) without /usr, and some
> additional fixup is needed to correct the installation directory of
> libsepol.so.1 and the symlink to it.
>
> This can be simplified quite a lot by passing both DESTDIR and PREFIX,
> and including the /usr part in both. The symlink still has to be fixed,
> but that's much simpler.
>
> Note that a side effect is that the man pages are now installed under
> $(HOST_DIR)/usr/usr/man. While not very nice, we don't really care
> about man pages. In addition, this will resolve itself when we later
> move $(HOST_DIR)/usr to $(HOST_DIR).
>
> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
> ---
> It's a bit counter-intuitive to have a patch that adds /usr in a series
> that is meant to remove it, but this is the simplest way to have a
> bisectable series...
> ---
> package/libsepol/libsepol.mk | 13 ++++++++-----
> 1 file changed, 8 insertions(+), 5 deletions(-)
Applied to master, thanks.
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2017-07-04 6:45 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-03 12:44 [Buildroot] [PATCH 0/8] Remove /usr component from HOST_DIR Arnout Vandecappelle
2017-07-03 12:44 ` [Buildroot] [PATCH 1/8] pkg-rebar: remove redundant / in front of $($(PKG)_ERLANG_LIBDIR) Arnout Vandecappelle
2017-07-04 6:38 ` Thomas Petazzoni
2017-07-03 12:44 ` [Buildroot] [PATCH 2/8] libsepol: rework host installation Arnout Vandecappelle
2017-07-04 6:45 ` Thomas Petazzoni
2017-07-03 12:44 ` [Buildroot] [PATCH 3/8] Move $(HOST_DIR)/usr/$(GNU_TARGET_NAME) one level up Arnout Vandecappelle
2017-07-03 12:44 ` [Buildroot] [PATCH 4/8] Move $(HOST_DIR)/usr/lib to $(HOST_DIR)/lib Arnout Vandecappelle
2017-07-03 12:44 ` [Buildroot] [PATCH 5/8] Eliminate $(HOST_DIR)/usr Arnout Vandecappelle
2017-07-03 12:45 ` [Buildroot] [PATCH 6/8] check-host-rpath: no longer check $(HOST_DIR)/usr/{bin, sbin} Arnout Vandecappelle
2017-07-03 12:45 ` [Buildroot] [PATCH 7/8] Makefile: remove $(HOST_DIR)/usr from BR_PATH Arnout Vandecappelle
2017-07-03 12:45 ` [Buildroot] [PATCH 8/8] package/Makefile.in: remove $(HOST_DIR)/usr part from HOST_LDFLAGS Arnout Vandecappelle
2017-07-03 19:01 ` [Buildroot] [PATCH 0/8] Remove /usr component from HOST_DIR Samuel Martin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox