All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 1/5] package/Makefile.in: add HOST_BIN_CROSS
Date: Tue,  4 Feb 2020 15:24:52 +0100	[thread overview]
Message-ID: <20200204142456.1537358-2-arnout@mind.be> (raw)
In-Reply-To: <20200204142456.1537358-1-arnout@mind.be>

Many packages make use of configuration scripts to find various paths
(includes, libraries, etc.). In the best case, pkg-config is used, but
there are dozen of other scripts as well. These scripts have to be
configured or called differently depending on whether we're doing cross
compilation (i.e. building a target package) or native compilation (i.e.
host compilation). Currently, we use various ways to make sure the
correct configure script with the correct settings is used - mostly by
passing environment variables in the configuration step.

To create more convergence and simplify our understanding of what is
going on, let's make a separate directory for cross-compilation
configuration scripts. This is particularly useful for meson, because
meson makes an explicit difference between native and cross compilation,
with a full configuration file for both.

Define HOST_BIN_CROSS as a subdirectory of
$(HOST_DIR)/$(GNU_TARGET_NAME). This makes it easy for the wrapper
script to use a relative path to ../sysroot to find STAGING_DIR, which
makes them relocatable. Note that we can't use
$(HOST_DIR)/$(GNU_TARGET_NAME)/bin, because for an internal toolchain,
gcc and binutils install the cross-executables there without target
prefix. Putting that directory in PATH makes it impossible to do native
compilation at all, because gcc will call 'as' and 'ld' from PATH, i.e.
the cross-tools instead of the native tools.

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

diff --git a/package/Makefile.in b/package/Makefile.in
index 285e2837ef..c82e30069e 100644
--- a/package/Makefile.in
+++ b/package/Makefile.in
@@ -230,6 +230,9 @@ HOST_CFLAGS   += $(HOST_CPPFLAGS)
 HOST_CXXFLAGS += $(HOST_CFLAGS)
 HOST_LDFLAGS  += -L$(HOST_DIR)/lib -Wl,-rpath,$(HOST_DIR)/lib
 
+# Location of scripts/wrappers for cross-compilation
+HOST_BIN_CROSS = $(HOST_DIR)/$(GNU_TARGET_NAME)/cross-bin
+
 # 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
 # might get installed into $(HOST_DIR)/bin and therefore appears
@@ -241,7 +244,7 @@ export PERL=$(shell which perl)
 # finds this perl module by exporting the proper value for PERL5LIB.
 export PERL5LIB=$(HOST_DIR)/lib/perl
 
-TARGET_MAKE_ENV = PATH=$(BR_PATH)
+TARGET_MAKE_ENV = PATH=$(HOST_BIN_CROSS):$(BR_PATH)
 
 TARGET_CONFIGURE_OPTS = \
 	$(TARGET_MAKE_ENV) \
-- 
2.24.1

  reply	other threads:[~2020-02-04 14:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-04 14:24 [Buildroot] [PATCH 0/5] [RFC] Introduce cross-bin directory Arnout Vandecappelle
2020-02-04 14:24 ` Arnout Vandecappelle [this message]
2020-02-04 14:24 ` [Buildroot] [PATCH 2/5] package/python3: install wrapper in HOST_BIN_CROSS Arnout Vandecappelle
2020-02-04 14:24 ` [Buildroot] [PATCH 3/5] package/python: " Arnout Vandecappelle
2020-02-04 14:24 ` [Buildroot] [PATCH 4/5] package/pkg-python: rely on python " Arnout Vandecappelle
2020-02-04 14:24 ` [Buildroot] [PATCH 5/5] package/pkg-meson: use TARGET_MAKE_ENV in configure Arnout Vandecappelle
2020-02-04 15:15 ` [Buildroot] [PATCH 0/5] [RFC] Introduce cross-bin directory Arnout Vandecappelle
2021-05-26 18:45   ` Arnout Vandecappelle

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=20200204142456.1537358-2-arnout@mind.be \
    --to=arnout@mind.be \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

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

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