Skip to contentSkip to conversation

package/rust: build and install cargo

PATCH New Patrick Havelange 2 participants 10 messages Jan 15, 2020 – Jan 20, 2020

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/9 package/rust: build and install cargo

From: Eric Le Bihan <[email protected]>

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.

---
 package/rust/config.in |  2 ++
 package/rust/rust.mk   | 25 ++++++++++++++++++++++++-
 2 files changed, 26 insertions(+), 1 deletion(-)
 create mode 100644 package/rust/config.in
package/rust/config.in new file +2 -0
new file mode 100644
index 0000000000..47fad026be
@@ -0,0 +1,2 @@
+[target. at RUSTC_TARGET_NAME@]
+linker = "@CROSS_PREFIX at gcc"
package/rust/rust.mk +24 -1
index 5d14fc6682..901995c203 100644
@@ -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))
Signature · 1 line
2.17.1
#1 lore raw

PATCH v2 2/9 package/cargo-bin: install if rust-bin selected

From: Eric Le Bihan <[email protected]>

If host-rust-bin, the pre-built Rust compiler, is selected as a rustc provider, then also install the pre-built cargo binary to be coherent.

Also install configuration file, reusing the one from rust package.

---
 package/cargo-bin/cargo-bin.mk | 7 +++++++
 1 file changed, 7 insertions(+)
package/cargo-bin/cargo-bin.mk +7 -0
index 3614f7a53d..4a3d52e43b 100644
@@ -10,4 +10,11 @@ CARGO_BIN_SOURCE = cargo-$(CARGO_BIN_VERSION)-$(RUSTC_HOST_NAME).tar.xz
 CARGO_BIN_LICENSE = Apache-2.0 or MIT
 CARGO_BIN_LICENSE_FILES = LICENSE-APACHE LICENSE-MIT
 
+ifeq ($(BR2_PACKAGE_HOST_RUST_BIN),y)
+define HOST_CARGO_BIN_INSTALL_CMDS
+       $(@D)/install.sh --prefix=$(HOST_DIR) --disable-ldconfig
+endef
+HOST_CARGO_BIN_POST_INSTALL_HOOKS += HOST_RUST_INSTALL_CARGO_CONFIG
+endif
+
 $(eval $(host-generic-package))
Signature · 1 line
2.17.1
#2 lore raw

PATCH v2 3/9 package/rust-bin: host variant depends on host-cargo-bin

In reply to Patrick Havelange

From: Eric Le Bihan <[email protected]>

Ensure installation of pre-built cargo binary by adding it to the dependency list of the host variant of the pre-built Rust compiler.

---
 package/rust-bin/rust-bin.mk | 1 +
 1 file changed, 1 insertion(+)
package/rust-bin/rust-bin.mk +1 -0
index a374215e20..bef3102450 100644
@@ -10,6 +10,7 @@ RUST_BIN_LICENSE = Apache-2.0 or MIT
 RUST_BIN_LICENSE_FILES = LICENSE-APACHE LICENSE-MIT
 
 HOST_RUST_BIN_PROVIDES = host-rustc
+HOST_RUST_BIN_DEPENDENCIES = host-cargo-bin
 
 HOST_RUST_BIN_SOURCE = rustc-$(RUST_BIN_VERSION)-$(RUSTC_HOST_NAME).tar.xz
 
Signature · 1 line
2.17.1
#3 lore raw

PATCH v2 4/9 package/rust: drop dependency on host-cargo-bin

In reply to Patrick Havelange

From: Eric Le Bihan <[email protected]>

As host-rust depends on host-rust-bin, which depends on host-cargo-bin, remove unneeded dependency.

---
 package/rust/rust.mk | 1 -
 1 file changed, 1 deletion(-)
package/rust/rust.mk +0 -1
index 901995c203..50ed08901c 100644
@@ -15,7 +15,6 @@ HOST_RUST_PROVIDES = host-rustc
 HOST_RUST_DEPENDENCIES = \
 	toolchain \
 	host-rust-bin \
-	host-cargo-bin \
 	host-openssl \
 	host-python \
 	$(BR2_CMAKE_HOST_DEPENDENCY)
Signature · 1 line
2.17.1
#4 lore raw

PATCH v2 5/9 package/ripgrep: depends on host-rustc

In reply to Patrick Havelange

From: Eric Le Bihan <[email protected]>

As all providers of rustc also install cargo, there is no need to depend on the standalone cargo package anymore. Instead add host-rustc to the dependency list.

---
Changes v1 -> v2:
- ripgrep/Config.in still needs to select HOST_RUSTC

---
 package/ripgrep/Config.in  | 2 +-
 package/ripgrep/ripgrep.mk | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
package/ripgrep/Config.in +1 -1
index 5446ad046c..0ea2902b34 100644
@@ -1,7 +1,7 @@
 config BR2_PACKAGE_RIPGREP
 	bool "ripgrep"
 	depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
-	select BR2_PACKAGE_HOST_CARGO
+	select BR2_PACKAGE_HOST_RUSTC
 	help
 	  ripgrep is a line-oriented search tool that
 	  recursively searches your current directory
package/ripgrep/ripgrep.mk +1 -1
index 0bb7017a96..832c076f26 100644
@@ -9,7 +9,7 @@ RIPGREP_SITE = $(call github,burntsushi,ripgrep,$(RIPGREP_VERSION))
 RIPGREP_LICENSE = MIT
 RIPGREP_LICENSE_FILES = LICENSE-MIT
 
-RIPGREP_DEPENDENCIES = host-cargo
+RIPGREP_DEPENDENCIES = host-rustc
 RIPGREP_CARGO_ENV = CARGO_HOME=$(HOST_DIR)/share/cargo
 RIPGREP_CARGO_MODE = $(if $(BR2_ENABLE_DEBUG),debug,release)
 
Signature · 1 line
2.17.1
#5 lore raw

PATCH v2 6/9 package/cargo: drop package

In reply to Patrick Havelange

From: Eric Le Bihan <[email protected]>

As no package depends on the standalone cargo package, it can be dropped.

---
Changes v1 -> v2:
- Also update DEVELOPERS file
- Also update tests/package/test_rust.py

---
 DEVELOPERS                                 |  1 -
 package/Config.in.host                     |  1 -
 package/cargo/Config.in.host               |  9 ---
 package/cargo/cargo.hash                   |  8 --
 package/cargo/cargo.mk                     | 91 ----------------------
 package/cargo/config.in                    |  2 -
 support/testing/tests/package/test_rust.py |  2 -
 7 files changed, 114 deletions(-)
 delete mode 100644 package/cargo/Config.in.host
 delete mode 100644 package/cargo/cargo.hash
 delete mode 100644 package/cargo/cargo.mk
 delete mode 100644 package/cargo/config.in
DEVELOPERS +0 -1
index 5652fc3555..aca4fd2506 100644
@@ -707,7 +707,6 @@ N:	Eric Le Bihan <[email protected]>
 F:	docs/manual/adding-packages-meson.txt
 F:	package/adwaita-icon-theme/
 F:	package/cargo-bin/
-F:	package/cargo/
 F:	package/darkhttpd/
 F:	package/eudev/
 F:	package/execline/
package/Config.in.host +0 -1
index 62e860d7c3..d69961e813 100644
@@ -3,7 +3,6 @@ menu "Host utilities"
 	source "package/aespipe/Config.in.host"
 	source "package/android-tools/Config.in.host"
 	source "package/btrfs-progs/Config.in.host"
-	source "package/cargo/Config.in.host"
 	source "package/cbootimage/Config.in.host"
 	source "package/checkpolicy/Config.in.host"
 	source "package/checksec/Config.in.host"
package/cargo/Config.in.host deleted +0 -9
deleted file mode 100644
index c33c6851f2..0000000000
@@ -1,9 +0,0 @@
-config BR2_PACKAGE_HOST_CARGO
-	bool "host cargo"
-	depends on BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS
-	select BR2_PACKAGE_HOST_RUSTC
-	help
-	  Cargo is the package manager for the Rust programming
-	  language.
-
-	  https://crates.io/
package/cargo/cargo.hash deleted +0 -8
deleted file mode 100644
index baa2cfbc33..0000000000
@@ -1,8 +0,0 @@
-# Locally generated
-sha256 1a4bae6910ca895157a1abe8225eb2b7e9b49ee1ee1e4e72fb81cb8e1446bff9  cargo-0.26.0.tar.gz
-sha256 dc7240d60a869fa24a68c8734fb7c810c27cca0a6dad52df6279865e4e8e7fae  rust-installer-4f994850808a572e2cc8d43f968893c8e942e9bf.tar.gz
-sha256 a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2  LICENSE-APACHE
-sha256 23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3  LICENSE-MIT
-sha256 8bd89f9222dc80292f4107347103b693ac66f3a083371f0629ccf42338abe880  LICENSE-THIRD-PARTY
-# From https://src.fedoraproject.org/repo/pkgs/cargo/cargo-0.26.0-vendor.tar.xz/sha512
-sha512 6ed2a1644c9b18fc24ddad5350d41b6c36cd5b62de4cf0b748a57b589f4f0ac12f91461989158d58d0892bf6fc2c1626cf574e7e2b9da4b0e35f72dfd88f9048  cargo-0.26.0-vendor.tar.xz
package/cargo/cargo.mk deleted +0 -91

91 lines not on this page · raw message

package/cargo/config.in deleted +0 -2
deleted file mode 100644
index 47fad026be..0000000000
@@ -1,2 +0,0 @@
-[target. at RUSTC_TARGET_NAME@]
-linker = "@CROSS_PREFIX at gcc"
support/testing/tests/package/test_rust.py +0 -2
index 9854c3692e..15bb93dd97 100644
@@ -73,7 +73,6 @@ class TestRustBin(TestRustBase):
         BR2_LINUX_KERNEL_INTREE_DTS_NAME="vexpress-v2p-ca9"
         BR2_TARGET_ROOTFS_CPIO=y
         # BR2_TARGET_ROOTFS_TAR is not set
-        BR2_PACKAGE_HOST_CARGO=y
         BR2_PACKAGE_HOST_RUSTC=y
         """
 
@@ -102,7 +101,6 @@ class TestRust(TestRustBase):
         BR2_LINUX_KERNEL_INTREE_DTS_NAME="vexpress-v2p-ca9"
         BR2_TARGET_ROOTFS_CPIO=y
         # BR2_TARGET_ROOTFS_TAR is not set
-        BR2_PACKAGE_HOST_CARGO=y
         BR2_PACKAGE_HOST_RUSTC=y
         BR2_PACKAGE_HOST_RUST=y
         """
Signature · 1 line
2.17.1
#6 lore raw

PATCH v2 7/9 docs/manual: cargo packages depend on host-rustc

In reply to Patrick Havelange

From: Eric Le Bihan <[email protected]>

As Cargo is either installed by host-rust or host-rust-bin, the Cargo-based packages should depend on host-rustc.

---
 docs/manual/adding-packages-cargo.txt | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
docs/manual/adding-packages-cargo.txt +5 -6
index b6029e1eed..b83f86e9e6 100644
@@ -18,11 +18,10 @@ The +Config.in+ file of Cargo-based package 'foo' should contain:
 01: config BR2_PACKAGE_FOO
 02: 	bool "foo"
 03: 	depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
-04: 	select BR2_PACKAGE_HOST_CARGO
-05: 	help
-06: 	  This is a comment that explains what foo is.
-07:
-08: 	  http://foosoftware.org/foo/
+04: 	help
+05: 	  This is a comment that explains what foo is.
+06:
+07: 	  http://foosoftware.org/foo/
 ---------------------------
 
 ==== Cargo-based package's +.mk+ file
@@ -44,7 +43,7 @@ package. Let's start with an example:
 10: FOO_LICENSE = GPL-3.0+
 11: FOO_LICENSE_FILES = COPYING
 12:
-13: FOO_DEPENDENCIES = host-cargo
+13: FOO_DEPENDENCIES = host-rustc
 14:
 15: FOO_CARGO_ENV = CARGO_HOME=$(HOST_DIR)/share/cargo
 16: FOO_CARGO_MODE = $(if $(BR2_ENABLE_DEBUG),debug,release)
Signature · 1 line
2.17.1
#7 lore raw

PATCH v2 8/9 package/rust: bump to 1.40

In reply to Patrick Havelange

- remove of the llvm workaround patch as it is integrated in this newer version.
- bump cargo-bin to 0.41 (corresponds to rust 1.40) and update licenses hashes.
- bump rust-bin to 1.40.

---
 package/cargo-bin/cargo-bin.hash              |  22 +-
 package/cargo-bin/cargo-bin.mk                |   2 +-
 package/rust-bin/rust-bin.hash                |  90 +++---
 package/rust-bin/rust-bin.mk                  |   2 +-
 ...esence-of-LLVM-library-in-stage0-lib.patch | 264 ------------------
 package/rust/rust.hash                        |   6 +-
 package/rust/rust.mk                          |   2 +-
 7 files changed, 62 insertions(+), 326 deletions(-)
 delete mode 100644 package/rust/0001-Workaround-presence-of-LLVM-library-in-stage0-lib.patch
package/cargo-bin/cargo-bin.hash +11 -11
index 0e9e9c5c61..22cad3c0ee 100644
@@ -1,13 +1,13 @@
-# From https://static.rust-lang.org/dist/cargo-0.33.0-i686-unknown-linux-gnu.tar.xz.sha256
-# Verified using https://static.rust-lang.org/dist/cargo-0.33.0-i686-unknown-linux-gnu.tar.xz.asc
-sha256 13acdb3c9f2505805ceed8a696f5f62ab8cd73e443cd43d6edd588aad88e1c32  cargo-0.33.0-i686-unknown-linux-gnu.tar.xz
-# From https://static.rust-lang.org/dist/cargo-0.33.0-powerpc64le-unknown-linux-gnu.tar.xz.sha256
-# Verified using https://static.rust-lang.org/dist/cargo-0.33.0-powerpc64le-unknown-linux-gnu.tar.xz.asc
-sha256 6628db22370f397676195555d768f0449a60f0a694bcac24611f4cd1cfc97cdc  cargo-0.33.0-powerpc64le-unknown-linux-gnu.tar.xz
-# From https://static.rust-lang.org/dist/cargo-0.33.0-x86_64-unknown-linux-gnu.tar.xz.sha256
-# Verified using https://static.rust-lang.org/dist/cargo-0.33.0-x86_64-unknown-linux-gnu.tar.xz.asc
-sha256 c2c31db68c4dcb50ad856a19e6f11489a0d4df1212f31bd068dfbb73c5425761  cargo-0.33.0-x86_64-unknown-linux-gnu.tar.xz
+# From https://static.rust-lang.org/dist/cargo-0.41.0-i686-unknown-linux-gnu.tar.xz.sha256
+# Verified using https://static.rust-lang.org/dist/cargo-0.41.0-i686-unknown-linux-gnu.tar.xz.asc
+sha256 c48bc132f4025ff39b1b6dc52aef9d406c3f926ce05fe92d943ceab7a5fd6058  cargo-0.41.0-i686-unknown-linux-gnu.tar.xz
+# From https://static.rust-lang.org/dist/cargo-0.41.0-powerpc64le-unknown-linux-gnu.tar.xz.sha256
+# Verified using https://static.rust-lang.org/dist/cargo-0.41.0-powerpc64le-unknown-linux-gnu.tar.xz.asc
+sha256 7705f21d938a72ba6f01818661b2dea29183209940a335f18d1761e1e03d3710  cargo-0.41.0-powerpc64le-unknown-linux-gnu.tar.xz
+# From https://static.rust-lang.org/dist/cargo-0.41.0-x86_64-unknown-linux-gnu.tar.xz.sha256
+# Verified using https://static.rust-lang.org/dist/cargo-0.41.0-x86_64-unknown-linux-gnu.tar.xz.asc
+sha256 9b6ae643fa240c5ecbc1dc390f4020b6a683f25bac6f7437ebd4b9d32a8d0b6c  cargo-0.41.0-x86_64-unknown-linux-gnu.tar.xz
 # Locally generated
-sha256 a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2  LICENSE-APACHE
+sha256 8ada45cd9f843acf64e4722ae262c622a2b3b3007c7310ef36ac1061a30f6adb  LICENSE-APACHE
 sha256 23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3  LICENSE-MIT
-sha256 8bd89f9222dc80292f4107347103b693ac66f3a083371f0629ccf42338abe880  LICENSE-THIRD-PARTY
+sha256 cbc759b1f17a2ac38fe3eb9e9563b1a08ba0f900611c49faaf68b46907b6d898  LICENSE-THIRD-PARTY
package/cargo-bin/cargo-bin.mk +1 -1
index 4a3d52e43b..09dd58e3df 100644
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-CARGO_BIN_VERSION = 0.33.0
+CARGO_BIN_VERSION = 0.41.0
 CARGO_BIN_SITE = https://static.rust-lang.org/dist
 CARGO_BIN_SOURCE = cargo-$(CARGO_BIN_VERSION)-$(RUSTC_HOST_NAME).tar.xz
 CARGO_BIN_LICENSE = Apache-2.0 or MIT
package/rust-bin/rust-bin.hash +45 -45

93 lines not on this page · raw message

package/rust-bin/rust-bin.mk +1 -1
index bef3102450..a5966768a4 100644
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-RUST_BIN_VERSION = 1.33.0
+RUST_BIN_VERSION = 1.40.0
 RUST_BIN_SITE = https://static.rust-lang.org/dist
 RUST_BIN_LICENSE = Apache-2.0 or MIT
 RUST_BIN_LICENSE_FILES = LICENSE-APACHE LICENSE-MIT
package/rust/0001-Workaround-presence-of-LLVM-library-in-stage0-lib.patch deleted +0 -264

264 lines not on this page · raw message

package/rust/rust.hash +3 -3
index 62e2e1855c..67c537f670 100644
@@ -1,6 +1,6 @@
-# From https://static.rust-lang.org/dist/rustc-1.33.0-src.tar.xz.sha256
-# Verified using https://static.rust-lang.org/dist/rustc-1.33.0-src.tar.xz.asc
-sha256 f4b1a72f1a29b23dcc9d7be5f60878f0434560513273906aa93dcd5c0de39b71  rustc-1.33.0-src.tar.xz
+# From https://static.rust-lang.org/dist/rustc-1.40.0-src.tar.xz.sha256
+# Verified using https://static.rust-lang.org/dist/rustc-1.40.0-src.tar.xz.asc
+sha256 6e2aa3a91697f4b225c6b394cbae6b97666f061dba491f666a5281698fe2aace  rustc-1.40.0-src.tar.xz
 # Locally generated
 sha256 a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2  LICENSE-APACHE
 sha256 23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3  LICENSE-MIT
package/rust/rust.mk +1 -1
index 50ed08901c..e5d0e2ee71 100644
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-RUST_VERSION = 1.33.0
+RUST_VERSION = 1.40.0
 RUST_SOURCE = rustc-$(RUST_VERSION)-src.tar.xz
 RUST_SITE = https://static.rust-lang.org/dist
 RUST_LICENSE = Apache-2.0 or MIT
Signature · 1 line
2.17.1
#8 lore raw

PATCH v2 9/9 package/cargo-bin: remove and use cargo-bin from rust-bin package

In reply to Patrick Havelange

Also added hashes for rust-bin powerpc64le.

---
 DEVELOPERS                       |  1 -
 package/cargo-bin/cargo-bin.hash | 13 -------------
 package/cargo-bin/cargo-bin.mk   | 20 --------------------
 package/rust-bin/rust-bin.hash   | 15 +++++++++------
 package/rust-bin/rust-bin.mk     | 28 ++++++++++++----------------
 package/rust/rust.mk             |  2 +-
 6 files changed, 22 insertions(+), 57 deletions(-)
 delete mode 100644 package/cargo-bin/cargo-bin.hash
 delete mode 100644 package/cargo-bin/cargo-bin.mk
DEVELOPERS +0 -1
index aca4fd2506..bd78e100f6 100644
@@ -706,7 +706,6 @@ F:	package/gstreamer1/gst1-plugins-bayer2rgb-neon/
 N:	Eric Le Bihan <[email protected]>
 F:	docs/manual/adding-packages-meson.txt
 F:	package/adwaita-icon-theme/
-F:	package/cargo-bin/
 F:	package/darkhttpd/
 F:	package/eudev/
 F:	package/execline/
package/cargo-bin/cargo-bin.hash deleted +0 -13
deleted file mode 100644
index 22cad3c0ee..0000000000
@@ -1,13 +0,0 @@
-# From https://static.rust-lang.org/dist/cargo-0.41.0-i686-unknown-linux-gnu.tar.xz.sha256
-# Verified using https://static.rust-lang.org/dist/cargo-0.41.0-i686-unknown-linux-gnu.tar.xz.asc
-sha256 c48bc132f4025ff39b1b6dc52aef9d406c3f926ce05fe92d943ceab7a5fd6058  cargo-0.41.0-i686-unknown-linux-gnu.tar.xz
-# From https://static.rust-lang.org/dist/cargo-0.41.0-powerpc64le-unknown-linux-gnu.tar.xz.sha256
-# Verified using https://static.rust-lang.org/dist/cargo-0.41.0-powerpc64le-unknown-linux-gnu.tar.xz.asc
-sha256 7705f21d938a72ba6f01818661b2dea29183209940a335f18d1761e1e03d3710  cargo-0.41.0-powerpc64le-unknown-linux-gnu.tar.xz
-# From https://static.rust-lang.org/dist/cargo-0.41.0-x86_64-unknown-linux-gnu.tar.xz.sha256
-# Verified using https://static.rust-lang.org/dist/cargo-0.41.0-x86_64-unknown-linux-gnu.tar.xz.asc
-sha256 9b6ae643fa240c5ecbc1dc390f4020b6a683f25bac6f7437ebd4b9d32a8d0b6c  cargo-0.41.0-x86_64-unknown-linux-gnu.tar.xz
-# Locally generated
-sha256 8ada45cd9f843acf64e4722ae262c622a2b3b3007c7310ef36ac1061a30f6adb  LICENSE-APACHE
-sha256 23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3  LICENSE-MIT
-sha256 cbc759b1f17a2ac38fe3eb9e9563b1a08ba0f900611c49faaf68b46907b6d898  LICENSE-THIRD-PARTY
package/cargo-bin/cargo-bin.mk deleted +0 -20
deleted file mode 100644
index 09dd58e3df..0000000000
@@ -1,20 +0,0 @@
-################################################################################
-#
-# cargo-bin
-#
-################################################################################
-
-CARGO_BIN_VERSION = 0.41.0
-CARGO_BIN_SITE = https://static.rust-lang.org/dist
-CARGO_BIN_SOURCE = cargo-$(CARGO_BIN_VERSION)-$(RUSTC_HOST_NAME).tar.xz
-CARGO_BIN_LICENSE = Apache-2.0 or MIT
-CARGO_BIN_LICENSE_FILES = LICENSE-APACHE LICENSE-MIT
-
-ifeq ($(BR2_PACKAGE_HOST_RUST_BIN),y)
-define HOST_CARGO_BIN_INSTALL_CMDS
-       $(@D)/install.sh --prefix=$(HOST_DIR) --disable-ldconfig
-endef
-HOST_CARGO_BIN_POST_INSTALL_HOOKS += HOST_RUST_INSTALL_CARGO_CONFIG
-endif
-
-$(eval $(host-generic-package))
package/rust-bin/rust-bin.hash +9 -6
index 12195f2911..1fdce9ad6f 100644
@@ -1,9 +1,12 @@
-# From https://static.rust-lang.org/dist/rustc-1.40.0-i686-unknown-linux-gnu.tar.xz.sha256
-# Verified using https://static.rust-lang.org/dist/rustc-1.40.0-i686-unknown-linux-gnu.tar.xz.asc
-sha256 257e4789043098a5e3b4fa85ea988019f37d640a10f83d39ada00fb23e057b8a  rustc-1.40.0-i686-unknown-linux-gnu.tar.xz
-# From https://static.rust-lang.org/dist/rustc-1.40.0-x86_64-unknown-linux-gnu.tar.xz.sha256
-# Verified using https://static.rust-lang.org/dist/rustc-1.40.0-x86_64-unknown-linux-gnu.tar.xz.asc
-sha256 b1c00618b7a98156e88b14682508a503284f85748eab23de749a20dcc8847111  rustc-1.40.0-x86_64-unknown-linux-gnu.tar.xz
+# From https://static.rust-lang.org/dist/rust-1.40.0-i686-unknown-linux-gnu.tar.xz.sha256
+# Verified using https://static.rust-lang.org/dist/rust-1.40.0-i686-unknown-linux-gnu.tar.xz.asc
+sha256 82454e1b60b2bc24779d9c949cc0e1da43f3e423dbfc6b45b5afddf65829fc9d  rust-1.40.0-i686-unknown-linux-gnu.tar.xz
+# From https://static.rust-lang.org/dist/rust-1.40.0-x86_64-unknown-linux-gnu.tar.xz.sha256
+# Verified using https://static.rust-lang.org/dist/rust-1.40.0-x86_64-unknown-linux-gnu.tar.xz.asc
+sha256 37492d6467bcea611b2c7388aed50b655524f81410e255142ef6cfb6cef1ec53  rust-1.40.0-x86_64-unknown-linux-gnu.tar.xz
+# From https://static.rust-lang.org/dist/rust-1.40.0-powerpc64le-unknown-linux-gnu.tar.xz.sha256
+# Verified using https://static.rust-lang.org/dist/rust-1.40.0-powerpc64le-unknown-linux-gnu.tar.xz.asc
+sha256 82454e1b60b2bc24779d9c949cc0e1da43f3e423dbfc6b45b5afddf65829fc9d  rust-1.40.0-powerpc64le-unknown-linux-gnu.tar.xz
 # From https://static.rust-lang.org/dist/rust-std-1.40.0-aarch64-unknown-linux-gnu.tar.xz.sha256
 # Verified using https://static.rust-lang.org/dist/rust-std-1.40.0-aarch64-unknown-linux-gnu.tar.xz.asc
 sha256 1abd1865e8339c2cac6992a11f6f98b66fa2b97f67acaddcf1992e39a7001bfc  rust-std-1.40.0-aarch64-unknown-linux-gnu.tar.xz
package/rust-bin/rust-bin.mk +12 -16
index a5966768a4..be8d623aa2 100644
@@ -10,18 +10,14 @@ RUST_BIN_LICENSE = Apache-2.0 or MIT
 RUST_BIN_LICENSE_FILES = LICENSE-APACHE LICENSE-MIT
 
 HOST_RUST_BIN_PROVIDES = host-rustc
-HOST_RUST_BIN_DEPENDENCIES = host-cargo-bin
 
-HOST_RUST_BIN_SOURCE = rustc-$(RUST_BIN_VERSION)-$(RUSTC_HOST_NAME).tar.xz
-
-HOST_RUST_BIN_EXTRA_DOWNLOADS = \
-	rust-std-$(RUST_BIN_VERSION)-$(RUSTC_HOST_NAME).tar.xz
+HOST_RUST_BIN_SOURCE = rust-$(RUST_BIN_VERSION)-$(RUSTC_HOST_NAME).tar.xz
 
 ifeq ($(BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS),y)
-HOST_RUST_BIN_EXTRA_DOWNLOADS += rust-std-$(RUST_BIN_VERSION)-$(RUSTC_TARGET_NAME).tar.xz
+HOST_RUST_BIN_EXTRA_DOWNLOADS = rust-std-$(RUST_BIN_VERSION)-$(RUSTC_TARGET_NAME).tar.xz
 endif
 
-HOST_RUST_BIN_LIBSTD_HOST_PREFIX = rust-std-$(RUST_BIN_VERSION)-$(RUSTC_HOST_NAME)/rust-std-$(RUSTC_HOST_NAME)
+HOST_RUST_BIN_LIBSTD_HOST_PREFIX = rust-std-$(RUSTC_HOST_NAME)
 
 define HOST_RUST_BIN_LIBSTD_EXTRACT
 	mkdir -p $(@D)/std
@@ -31,36 +27,36 @@ define HOST_RUST_BIN_LIBSTD_EXTRACT
 	)
 	mkdir -p $(@D)/rustc/lib/rustlib/$(RUSTC_HOST_NAME)/lib
 	cd $(@D)/rustc/lib/rustlib/$(RUSTC_HOST_NAME)/lib; \
-		ln -sf ../../../../../std/$(HOST_RUST_BIN_LIBSTD_HOST_PREFIX)/lib/rustlib/$(RUSTC_HOST_NAME)/lib/* .
+		ln -sf ../../../../../$(HOST_RUST_BIN_LIBSTD_HOST_PREFIX)/lib/rustlib/$(RUSTC_HOST_NAME)/lib/* .
 endef
 
 HOST_RUST_BIN_POST_EXTRACT_HOOKS += HOST_RUST_BIN_LIBSTD_EXTRACT
 
-HOST_RUST_BIN_INSTALL_OPTS = \
+HOST_RUST_BIN_INSTALL_COMMON_OPTS = \
 	--prefix=$(HOST_DIR) \
 	--disable-ldconfig
 
+HOST_RUST_BIN_INSTALL_OPTS = \
+	$(HOST_RUST_BIN_INSTALL_COMMON_OPTS) \
+	--components=rustc,cargo,rust-std-$(RUSTC_HOST_NAME)
+
 define HOST_RUST_BIN_INSTALL_RUSTC
 	(cd $(@D); \
 		./install.sh $(HOST_RUST_BIN_INSTALL_OPTS))
 endef
 
-define HOST_RUST_BIN_INSTALL_LIBSTD_HOST
-	(cd $(@D)/std/rust-std-$(RUST_BIN_VERSION)-$(RUSTC_HOST_NAME); \
-		./install.sh $(HOST_RUST_BIN_INSTALL_OPTS))
-endef
-
 ifeq ($(BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS),y)
 define HOST_RUST_BIN_INSTALL_LIBSTD_TARGET
 	(cd $(@D)/std/rust-std-$(RUST_BIN_VERSION)-$(RUSTC_TARGET_NAME); \
-		./install.sh $(HOST_RUST_BIN_INSTALL_OPTS))
+		./install.sh $(HOST_RUST_BIN_INSTALL_COMMON_OPTS))
 endef
 endif
 
 define HOST_RUST_BIN_INSTALL_CMDS
 	$(HOST_RUST_BIN_INSTALL_RUSTC)
-	$(HOST_RUST_BIN_INSTALL_LIBSTD_HOST)
 	$(HOST_RUST_BIN_INSTALL_LIBSTD_TARGET)
 endef
 
+HOST_RUST_BIN_POST_INSTALL_HOOKS += HOST_RUST_INSTALL_CARGO_CONFIG
+
 $(eval $(host-generic-package))
package/rust/rust.mk +1 -1
index e5d0e2ee71..a473b5e8af 100644
@@ -41,7 +41,7 @@ define HOST_RUST_CONFIGURE_CMDS
 	( \
 		echo '[build]'; \
 		echo 'target = ["$(RUSTC_TARGET_NAME)"]'; \
-		echo 'cargo = "$(HOST_CARGO_BIN_DIR)/cargo/bin/cargo"'; \
+		echo 'cargo = "$(HOST_RUST_BIN_DIR)/cargo/bin/cargo"'; \
 		echo 'rustc = "$(HOST_RUST_BIN_DIR)/rustc/bin/rustc"'; \
 		echo 'python = "$(HOST_DIR)/bin/python2"'; \
 		echo 'submodules = false'; \
Signature · 1 line
2.17.1
#9 lore raw

PATCH v2 1/9 package/rust: build and install cargo

In reply to Patrick Havelange

Patrick, All,

Quoted 11 lines · Patrick Havelange

From: Eric Le Bihan <[email protected]>

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.

Quoted 71 lines
---
 package/rust/config.in |  2 ++
 package/rust/rust.mk   | 25 ++++++++++++++++++++++++-
 2 files changed, 26 insertions(+), 1 deletion(-)
 create mode 100644 package/rust/config.in
package/rust/config.in new file +2 -0
new file mode 100644
index 0000000000..47fad026be
@@ -0,0 +1,2 @@
+[target. at RUSTC_TARGET_NAME@]
+linker = "@CROSS_PREFIX at gcc"
package/rust/rust.mk +24 -2
index 5d14fc6682..901995c203 100644
@@ -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

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

Signature · 19 lines
Sam Voss | Sr. Software Engineer | Commercial Avionics

COLLINS AEROSPACE

400 Collins Road NE, Cedar Rapids, Iowa 52498, USA

Tel: +1 319 263 4039

sam.voss at collins.com | collinsaerospace.com



CONFIDENTIALITY WARNING: This message may contain proprietary and/or
privileged information of Collins Aerospace and its affiliated
companies. If you are not the intended recipient, please 1) Do not
disclose, copy, distribute or use this message or its contents. 2)
Advise the sender by return email. 3) Delete all copies (including all
attachments) from your computer. Your cooperation is greatly
appreciated.