[v3,10/10] package/cargo-bin: remove and use cargo-bin from rust-bin package
diff mbox series

Message ID 20200207180829.165689-11-arnout@mind.be
State New
Headers show
Series
  • Merge rust and cargo
Related show

Commit Message

Arnout Vandecappelle Feb. 7, 2020, 6:08 p.m. UTC
From: Patrick Havelange <patrick.havelange@essensium.com>

Rust upstream distributes tarballs with separate rust and cargo
binaries, but also tarballs with everything together. The latter
contains a bit more than what we need, so the download is slightly
larger than separate cargo-bin and rust-bin. But it simplifies our life
if we do the same in rust-bin as in rust (i.e. get both rust and cargo).

Also added hashes for rust-bin powerpc64le, which was missing before.

Signed-off-by: Patrick Havelange <patrick.havelange@essensium.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
---
 DEVELOPERS                       |  1 -
 package/cargo-bin/cargo-bin.hash | 13 -------------
 package/cargo-bin/cargo-bin.mk   | 19 -------------------
 package/rust-bin/rust-bin.hash   | 15 +++++++++------
 package/rust-bin/rust-bin.mk     | 28 ++++++++++++----------------
 package/rust/rust.mk             |  2 +-
 6 files changed, 22 insertions(+), 56 deletions(-)
 delete mode 100644 package/cargo-bin/cargo-bin.hash
 delete mode 100644 package/cargo-bin/cargo-bin.mk

Comments

David PIERRET March 27, 2020, 11:08 a.m. UTC | #1
Hi,
Working on a new package using rust, this patch suite have resolved my
issue with rust version successfully.

Regards
David

On Fri, Feb 7, 2020 at 7:10 PM Arnout Vandecappelle (Essensium/Mind)
<arnout@mind.be> wrote:
>
> From: Patrick Havelange <patrick.havelange@essensium.com>
>
> Rust upstream distributes tarballs with separate rust and cargo
> binaries, but also tarballs with everything together. The latter
> contains a bit more than what we need, so the download is slightly
> larger than separate cargo-bin and rust-bin. But it simplifies our life
> if we do the same in rust-bin as in rust (i.e. get both rust and cargo).
>
> Also added hashes for rust-bin powerpc64le, which was missing before.
>
> Signed-off-by: Patrick Havelange <patrick.havelange@essensium.com>
> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Tested-by: David Pierret <david.pierret@smile.fr>
> ---
>  DEVELOPERS                       |  1 -
>  package/cargo-bin/cargo-bin.hash | 13 -------------
>  package/cargo-bin/cargo-bin.mk   | 19 -------------------
>  package/rust-bin/rust-bin.hash   | 15 +++++++++------
>  package/rust-bin/rust-bin.mk     | 28 ++++++++++++----------------
>  package/rust/rust.mk             |  2 +-
>  6 files changed, 22 insertions(+), 56 deletions(-)
>  delete mode 100644 package/cargo-bin/cargo-bin.hash
>  delete mode 100644 package/cargo-bin/cargo-bin.mk
>
> diff --git a/DEVELOPERS b/DEVELOPERS
> index e0f6e7278c..ace16c06e6 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -708,7 +708,6 @@ F:  package/gstreamer1/gst1-plugins-bayer2rgb-neon/
>  N:     Eric Le Bihan <eric.le.bihan.dev@free.fr>
>  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/
> diff --git a/package/cargo-bin/cargo-bin.hash b/package/cargo-bin/cargo-bin.hash
> deleted file mode 100644
> index 22cad3c0ee..0000000000
> --- a/package/cargo-bin/cargo-bin.hash
> +++ /dev/null
> @@ -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
> diff --git a/package/cargo-bin/cargo-bin.mk b/package/cargo-bin/cargo-bin.mk
> deleted file mode 100644
> index 246fdbf856..0000000000
> --- a/package/cargo-bin/cargo-bin.mk
> +++ /dev/null
> @@ -1,19 +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
> -endif
> -
> -$(eval $(host-generic-package))
> diff --git a/package/rust-bin/rust-bin.hash b/package/rust-bin/rust-bin.hash
> index 12195f2911..1fdce9ad6f 100644
> --- a/package/rust-bin/rust-bin.hash
> +++ b/package/rust-bin/rust-bin.hash
> @@ -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
> diff --git a/package/rust-bin/rust-bin.mk b/package/rust-bin/rust-bin.mk
> index a5966768a4..be8d623aa2 100644
> --- a/package/rust-bin/rust-bin.mk
> +++ b/package/rust-bin/rust-bin.mk
> @@ -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))
> diff --git a/package/rust/rust.mk b/package/rust/rust.mk
> index cc3cf1bd01..a81aa6dc2b 100644
> --- a/package/rust/rust.mk
> +++ b/package/rust/rust.mk
> @@ -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'; \
> --
> 2.24.1
>
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

Patch
diff mbox series

diff --git a/DEVELOPERS b/DEVELOPERS
index e0f6e7278c..ace16c06e6 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -708,7 +708,6 @@  F:	package/gstreamer1/gst1-plugins-bayer2rgb-neon/
 N:	Eric Le Bihan <eric.le.bihan.dev@free.fr>
 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/
diff --git a/package/cargo-bin/cargo-bin.hash b/package/cargo-bin/cargo-bin.hash
deleted file mode 100644
index 22cad3c0ee..0000000000
--- a/package/cargo-bin/cargo-bin.hash
+++ /dev/null
@@ -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
diff --git a/package/cargo-bin/cargo-bin.mk b/package/cargo-bin/cargo-bin.mk
deleted file mode 100644
index 246fdbf856..0000000000
--- a/package/cargo-bin/cargo-bin.mk
+++ /dev/null
@@ -1,19 +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
-endif
-
-$(eval $(host-generic-package))
diff --git a/package/rust-bin/rust-bin.hash b/package/rust-bin/rust-bin.hash
index 12195f2911..1fdce9ad6f 100644
--- a/package/rust-bin/rust-bin.hash
+++ b/package/rust-bin/rust-bin.hash
@@ -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
diff --git a/package/rust-bin/rust-bin.mk b/package/rust-bin/rust-bin.mk
index a5966768a4..be8d623aa2 100644
--- a/package/rust-bin/rust-bin.mk
+++ b/package/rust-bin/rust-bin.mk
@@ -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))
diff --git a/package/rust/rust.mk b/package/rust/rust.mk
index cc3cf1bd01..a81aa6dc2b 100644
--- a/package/rust/rust.mk
+++ b/package/rust/rust.mk
@@ -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'; \