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 v3 01/10] package/rustc: install cargo config as toolchain post-install hook
Date: Fri,  7 Feb 2020 19:08:20 +0100	[thread overview]
Message-ID: <20200207180829.165689-2-arnout@mind.be> (raw)
In-Reply-To: <20200207180829.165689-1-arnout@mind.be>

The cargo config file is much like the cmake and meson configuration
files, something that tells the cargo build system how the
cross-toolchain is configured. It can be used not only with our own
host-cargo package, but also with a pre-installed cargo.

Therefore, install the cargo config file as a toolchain post-install
hook, just like we do for cmake and meson. However, we don't have a
pkg-cargo infrastructure (yet) so we can't put it there. The cargo
package itself will be removed soon, so that's not appropriate either.
Therefore, put it in the rustc package - any cargo package will need
rustc.

Remove the config handling from the cargo package.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
---
 package/cargo/cargo.mk                             |  6 ------
 package/{cargo/config.in => rustc/cargo-config.in} |  0
 package/rustc/rustc.mk                             | 12 ++++++++++++
 3 files changed, 12 insertions(+), 6 deletions(-)
 rename package/{cargo/config.in => rustc/cargo-config.in} (100%)

diff --git a/package/cargo/cargo.mk b/package/cargo/cargo.mk
index a387281b4c..3f6646d027 100644
--- a/package/cargo/cargo.mk
+++ b/package/cargo/cargo.mk
@@ -80,12 +80,6 @@ endef
 
 define HOST_CARGO_INSTALL_CMDS
 	$(INSTALL) -D -m 0755 $(@D)/target/release/cargo $(HOST_DIR)/bin/cargo
-	$(INSTALL) -D package/cargo/config.in \
-		$(HOST_DIR)/share/cargo/config
-	$(SED) 's/@RUSTC_TARGET_NAME@/$(RUSTC_TARGET_NAME)/' \
-		$(HOST_DIR)/share/cargo/config
-	$(SED) 's/@CROSS_PREFIX@/$(notdir $(TARGET_CROSS))/' \
-		$(HOST_DIR)/share/cargo/config
 endef
 
 $(eval $(host-generic-package))
diff --git a/package/cargo/config.in b/package/rustc/cargo-config.in
similarity index 100%
rename from package/cargo/config.in
rename to package/rustc/cargo-config.in
diff --git a/package/rustc/rustc.mk b/package/rustc/rustc.mk
index 6eea9b4fc5..35ffc36106 100644
--- a/package/rustc/rustc.mk
+++ b/package/rustc/rustc.mk
@@ -20,3 +20,15 @@ endif
 RUSTC_HOST_NAME = $(RUSTC_HOST_ARCH)-unknown-linux-gnu
 
 $(eval $(host-virtual-package))
+
+ifeq ($(BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS),y)
+define RUSTC_INSTALL_CARGO_CONFIG
+	mkdir -p $(HOST_DIR)/share/cargo
+	sed -e 's/@RUSTC_TARGET_NAME@/$(RUSTC_TARGET_NAME)/' \
+		-e 's/@CROSS_PREFIX@/$(notdir $(TARGET_CROSS))/' \
+		package/rustc/cargo-config.in \
+		> $(HOST_DIR)/share/cargo/config
+endef
+# check-package disable TypoInPackageVariable - TOOLCHAIN intended
+TOOLCHAIN_POST_INSTALL_STAGING_HOOKS += RUSTC_INSTALL_CARGO_CONFIG
+endif
-- 
2.24.1

  reply	other threads:[~2020-02-07 18:08 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-07 18:08 [Buildroot] [PATCH v3 00/10] Merge rust and cargo Arnout Vandecappelle
2020-02-07 18:08 ` Arnout Vandecappelle [this message]
2020-03-27 10:42   ` [Buildroot] [PATCH v3 01/10] package/rustc: install cargo config as toolchain post-install hook David PIERRET
2020-05-18 10:51   ` Patrick Havelange
2020-07-27 11:49   ` Thomas Petazzoni
2020-02-07 18:08 ` [Buildroot] [PATCH v3 02/10] package/rust: build and install cargo Arnout Vandecappelle
2020-02-09 10:21   ` Yann E. MORIN
2020-02-09 16:37     ` Arnout Vandecappelle
2020-03-27 10:44       ` David PIERRET
2020-04-29 13:15   ` Romain Naour
2020-07-27 11:49   ` Thomas Petazzoni
2020-02-07 18:08 ` [Buildroot] [PATCH v3 03/10] package/cargo-bin: install if rust-bin selected Arnout Vandecappelle
2020-03-27 10:47   ` David PIERRET
2020-02-07 18:08 ` [Buildroot] [PATCH v3 04/10] package/rust-bin: host variant depends on host-cargo-bin Arnout Vandecappelle
2020-03-27 10:50   ` David PIERRET
2020-02-07 18:08 ` [Buildroot] [PATCH v3 05/10] package/rust: drop dependency " Arnout Vandecappelle
2020-03-27 10:51   ` David PIERRET
2020-02-07 18:08 ` [Buildroot] [PATCH v3 06/10] package/ripgrep: depends on host-rustc Arnout Vandecappelle
2020-03-27 10:53   ` David PIERRET
2020-02-07 18:08 ` [Buildroot] [PATCH v3 07/10] package/cargo: drop package Arnout Vandecappelle
2020-03-27 10:56   ` David PIERRET
2020-02-07 18:08 ` [Buildroot] [PATCH v3 08/10] docs/manual: cargo packages depend on host-rustc Arnout Vandecappelle
2020-03-27 10:57   ` David PIERRET
2020-02-07 18:08 ` [Buildroot] [PATCH v3 09/10] package/rust: bump to 1.40 Arnout Vandecappelle
2020-03-27 11:02   ` David PIERRET
2020-02-07 18:08 ` [Buildroot] [PATCH v3 10/10] package/cargo-bin: remove and use cargo-bin from rust-bin package Arnout Vandecappelle
2020-03-27 11:08   ` David PIERRET
2020-07-27 11:51   ` Thomas Petazzoni
2020-02-07 21:19 ` [Buildroot] [PATCH v3 00/10] Merge rust and cargo Matthew Weber
2020-07-27 11:48 ` Thomas Petazzoni

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=20200207180829.165689-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.