Rust: drop cargo package
cover Rust: drop cargo package
Hi!
The source code for Cargo, the build and package manager for Rust, is now shipped along with the compiler and standard library.
So there can not be a standalone package for Cargo anymore.
This series does the following:
- update host-rust to build and install Cargo.
- install host-cargo-bin if host-rust-bin is selected instead of host-rust.
- update dependencies for package(s) using Cargo.
- remove cargo packaging.
- update the packaging documentation.
[1] http://lists.busybox.net/pipermail/buildroot/2019-October/264437.html
Eric Le Bihan (7):
package/rust: build and install cargo package/cargo-bin: install if rust-bin selected package/rust-bin: host variant depends on host-cargo-bin package/rust: drop dependency on host-cargo-bin package/ripgrep: depends on host-rustc package/cargo: drop package
docs/manual: cargo packages depend on host-rustc
docs/manual/adding-packages-cargo.txt | 11 ++--
package/Config.in.host | 1 -
package/cargo-bin/cargo-bin.mk | 7 +++
package/cargo/Config.in.host | 9 ---
package/cargo/cargo.hash | 8 ---
package/cargo/cargo.mk | 91 ---------------------------
package/ripgrep/Config.in | 1 -
package/ripgrep/ripgrep.mk | 2 +-
package/rust-bin/rust-bin.mk | 1 +
package/{cargo => rust}/config.in | 0
package/rust/rust.mk | 26 +++++++-
11 files changed, 38 insertions(+), 119 deletions(-)
delete mode 100644 package/cargo/Config.in.host
delete mode 100644 package/cargo/cargo.hash
delete mode 100644 package/cargo/cargo.mk
rename package/{cargo => rust}/config.in (100%)--
2.21.0
RFC PATCH 1/7 package/rust: build and install cargo
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
@@ -0,0 +1,2 @@ +[target. at RUSTC_TARGET_NAME@] +linker = "@CROSS_PREFIX at gcc"
package/rust/rust.mk +24 -1
@@ -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.21.0
RFC PATCH 2/7 package/cargo-bin: install if rust-bin selected
In reply to Eric Le BihanIf 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
@@ -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.21.0
RFC PATCH 3/7 package/rust-bin: host variant depends on host-cargo-bin
In reply to Eric Le BihanEnsure 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
@@ -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.21.0
RFC PATCH 4/7 package/rust: drop dependency on host-cargo-bin
In reply to Eric Le BihanAs 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
@@ -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.21.0
RFC PATCH 5/7 package/ripgrep: depends on host-rustc
In reply to Eric Le BihanAs 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.
--- package/ripgrep/Config.in | 1 - package/ripgrep/ripgrep.mk | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-)
package/ripgrep/Config.in +0 -1
@@ -1,7 +1,6 @@ config BR2_PACKAGE_RIPGREP bool "ripgrep" depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS - select BR2_PACKAGE_HOST_CARGO help ripgrep is a line-oriented search tool that recursively searches your current directory
package/ripgrep/ripgrep.mk +1 -1
@@ -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.21.0
RFC PATCH 6/7 package/cargo: drop package
In reply to Eric Le BihanAs no package depends on the standalone cargo package, it can be dropped.
--- 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 - 5 files changed, 111 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
package/Config.in.host +0 -1
@@ -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
@@ -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
@@ -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
@@ -1,2 +0,0 @@ -[target. at RUSTC_TARGET_NAME@] -linker = "@CROSS_PREFIX at gcc"
Signature · 1 line
2.21.0
RFC PATCH 7/7 docs/manual: cargo packages depend on host-rustc
In reply to Eric Le BihanAs 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
@@ -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.21.0