All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2 1/9] package/rust: build and install cargo
@ 2020-01-15 13:26 Patrick Havelange
  2020-01-15 13:26 ` [Buildroot] [PATCH v2 2/9] package/cargo-bin: install if rust-bin selected Patrick Havelange
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Patrick Havelange @ 2020-01-15 13:26 UTC (permalink / raw)
  To: buildroot

From: Eric Le Bihan <eric.le.bihan.dev@free.fr>

Cargo source code is not provided anymore as a separate tarball but is
now built along with the Rust compiler.

So update rust host variant to build Cargo and install the
cross-compilation configuration file.

Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
Signed-off-by: Patrick Havelange <patrick.havelange@essensium.com>
---
 package/rust/config.in |  2 ++
 package/rust/rust.mk   | 25 ++++++++++++++++++++++++-
 2 files changed, 26 insertions(+), 1 deletion(-)
 create mode 100644 package/rust/config.in

diff --git a/package/rust/config.in b/package/rust/config.in
new file mode 100644
index 0000000000..47fad026be
--- /dev/null
+++ b/package/rust/config.in
@@ -0,0 +1,2 @@
+[target. at RUSTC_TARGET_NAME@]
+linker = "@CROSS_PREFIX at gcc"
diff --git a/package/rust/rust.mk b/package/rust/rust.mk
index 5d14fc6682..901995c203 100644
--- a/package/rust/rust.mk
+++ b/package/rust/rust.mk
@@ -47,11 +47,14 @@ define HOST_RUST_CONFIGURE_CMDS
 		echo 'python = "$(HOST_DIR)/bin/python2"'; \
 		echo 'submodules = false'; \
 		echo 'vendor = true'; \
+		echo 'extended = true'; \
+		echo 'tools = ["cargo"]'; \
 		echo 'compiler-docs = false'; \
 		echo 'docs = false'; \
 		echo 'verbose = $(HOST_RUST_VERBOSITY)'; \
 		echo '[install]'; \
 		echo 'prefix = "$(HOST_DIR)"'; \
+		echo 'sysconfdir = "$(HOST_DIR)/etc"'; \
 		echo '[rust]'; \
 		echo 'channel = "stable"'; \
 		echo '[target.$(RUSTC_TARGET_NAME)]'; \
@@ -64,9 +67,29 @@ define HOST_RUST_BUILD_CMDS
 	cd $(@D); $(HOST_MAKE_ENV) $(HOST_DIR)/bin/python2 x.py build
 endef
 
-define HOST_RUST_INSTALL_CMDS
+define HOST_RUST_INSTALL_RUST_BIN
 	cd $(@D); $(HOST_MAKE_ENV) $(HOST_DIR)/bin/python2 x.py dist
 	cd $(@D); $(HOST_MAKE_ENV) $(HOST_DIR)/bin/python2 x.py install
 endef
 
+define HOST_RUST_INSTALL_CARGO_BIN
+	find $(@D)/build/tmp/dist -maxdepth 2 -wholename '*cargo*/install.sh' \
+		-exec {} --prefix=$(HOST_DIR) --disable-ldconfig \;
+endef
+
+define HOST_RUST_INSTALL_CARGO_CONFIG
+	$(INSTALL) -D package/rust/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
+
+define HOST_RUST_INSTALL_CMDS
+	$(HOST_RUST_INSTALL_RUST_BIN)
+	$(HOST_RUST_INSTALL_CARGO_BIN)
+	$(HOST_RUST_INSTALL_CARGO_CONFIG)
+endef
+
 $(eval $(host-generic-package))
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-01-20 15:51 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-15 13:26 [Buildroot] [PATCH v2 1/9] package/rust: build and install cargo Patrick Havelange
2020-01-15 13:26 ` [Buildroot] [PATCH v2 2/9] package/cargo-bin: install if rust-bin selected Patrick Havelange
2020-01-15 13:26 ` [Buildroot] [PATCH v2 3/9] package/rust-bin: host variant depends on host-cargo-bin Patrick Havelange
2020-01-15 13:26 ` [Buildroot] [PATCH v2 4/9] package/rust: drop dependency " Patrick Havelange
2020-01-15 13:26 ` [Buildroot] [PATCH v2 5/9] package/ripgrep: depends on host-rustc Patrick Havelange
2020-01-15 13:26 ` [Buildroot] [PATCH v2 6/9] package/cargo: drop package Patrick Havelange
2020-01-15 13:26 ` [Buildroot] [PATCH v2 7/9] docs/manual: cargo packages depend on host-rustc Patrick Havelange
2020-01-15 13:26 ` [Buildroot] [PATCH v2 8/9] package/rust: bump to 1.40 Patrick Havelange
2020-01-15 13:26 ` [Buildroot] [PATCH v2 9/9] package/cargo-bin: remove and use cargo-bin from rust-bin package Patrick Havelange
2020-01-20 15:51 ` [Buildroot] [PATCH v2 1/9] package/rust: build and install cargo Sam Voss

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.