Add support for the Rust programming language
v7 cover Add support for the Rust programming language
This series adds support for the Rust programming language by adding the following packages:
- rustc: a virtual package for the Rust compiler.
- rust-bin: provides a pre-built version of rustc.
- rust: builds rustc from source.
- cargo: builds Rust package manager from source.
Both providers are able to cross-compile code for ARM, MIPS, PowerPC and x86_64 architectures. Only the host variants are provided.
The rustc virtual package is inspired by the mysql one.
As the Rust compiler is written in Rust and uses Cargo, the Rust package manager, as build system, two additional packages are provided: rust-bootstrap and cargo-bootstrap.
v6 -> v7:
- add cargo 0.20.0
- bump rust to 1.19.0
- bump rust-bootstrap to 1.18.0
- bump cargo-bootstrap to 0.19.0
- bump rust-bin to 1.19.0
- fix mips64 target name in rustc
v5 -> v6:
- bump rust to 1.18.0
- bump rust-bootstrap to 1.17.0
- bump rust-bin to 1.18.0
v4 -> v5:
- add rustc virtual package
- add rust-bin, provider for rustc
- rework rust to be a provider for rustc
- rework some commit messages
v3 -> v4:
- bump rust to 1.16.0
- bump rust-bootstrap to 1.15.1
- add cargo-bootstrap
- use built-in target specifications
- drop external Python script to generate target specifications
- enable support for PowerPC
- expose host variant in menuconfig
v2 -> v3:
- bump rust to 1.10.0
- rework and bump rust-bootstrap to 1.9.0
- host-rust requires at least GCC 4.7 because of LLVM (suggested by R. Naour)
- rust requires a glibc-based cross-compiler
- rust requires GCC 5.x or above for Aarch64
v1 -> v2:
- bump rust to version 1.9.0.
- drop patch for bzip2 support in host-python.
- add package for jemalloc.
- add dependency on host being a x86 machine.
- add dependency on toolchain.
- use dedicated package to provide bootstrapping binary: rust-bootstrap.
- let ./configure find out host/build on its own.
- remove entry from configuration menu.
- clarify some comments.
Eric Le Bihan (10):
rustc: new virtual package
rust-bin: new package
rustc: expose host variant in menuconfig
rust-bootstrap: new package
cargo-bootstrap: new package
rust: new package
libssh2: add host variant
libhttpparser: add host variant
libcurl: add host variant
cargo: new package
DEVELOPERS | 5 ++ package/Config.in.host | 2 + package/cargo-bootstrap/cargo-bootstrap.hash | 3 + package/cargo-bootstrap/cargo-bootstrap.mk | 14 ++++ package/cargo/Config.in.host | 8 ++ package/cargo/cargo.hash | 4 + package/cargo/cargo.in | 2 + package/cargo/cargo.mk | 112 +++++++++++++++++++++++++++ package/cargo/config.in | 2 + package/libcurl/libcurl.mk | 3 + package/libhttpparser/libhttpparser.mk | 9 +++ package/libssh2/libssh2.mk | 6 ++ package/rust-bin/rust-bin.hash | 30 +++++++ package/rust-bin/rust-bin.mk | 41 ++++++++++ package/rust-bootstrap/rust-bootstrap.hash | 8 ++ package/rust-bootstrap/rust-bootstrap.mk | 27 +++++++ package/rust/rust.hash | 2 + package/rust/rust.mk | 78 +++++++++++++++++++ package/rustc/Config.in.host | 61 +++++++++++++++ package/rustc/rustc.mk | 25 ++++++ 20 files changed, 442 insertions(+) create mode 100644 package/cargo-bootstrap/cargo-bootstrap.hash create mode 100644 package/cargo-bootstrap/cargo-bootstrap.mk create mode 100644 package/cargo/Config.in.host create mode 100644 package/cargo/cargo.hash create mode 100644 package/cargo/cargo.in create mode 100644 package/cargo/cargo.mk create mode 100644 package/cargo/config.in create mode 100644 package/rust-bin/rust-bin.hash create mode 100644 package/rust-bin/rust-bin.mk create mode 100644 package/rust-bootstrap/rust-bootstrap.hash create mode 100644 package/rust-bootstrap/rust-bootstrap.mk create mode 100644 package/rust/rust.hash create mode 100644 package/rust/rust.mk create mode 100644 package/rustc/Config.in.host create mode 100644 package/rustc/rustc.mk
Signature · 1 line
2.9.4
PATCH v7 1/10 rustc: new virtual package
The compiler for the Rust programming language is called rustc.
There is only one reference implementation for it, based on LLVM, from the Rust project [1]. It can generate code for various architectures so it can be labeled as a cross-compiler. But, as for GCC, building it from source takes time.
So it would be sensible to have at least one package which provides it as a pre-built version, fetched from the upstream project. Later another package can be added, to build it from source code.
In addition to the compiler, the standard library for the host and/or the target should also be fetched/built.
So, add a virtual package named rustc to enable support for multiple providers.
Currently, only the host variant will be available to allow the user to cross-compile Rust programs for the target.
--- package/rustc/Config.in.host | 5 +++++ package/rustc/rustc.mk | 25 +++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 package/rustc/Config.in.host create mode 100644 package/rustc/rustc.mk
package/rustc/Config.in.host new file +5 -0
@@ -0,0 +1,5 @@ +config BR2_PACKAGE_HAS_HOST_RUSTC + bool + +config BR2_PACKAGE_PROVIDES_HOST_RUSTC + string
package/rustc/rustc.mk new file +25 -0
@@ -0,0 +1,25 @@ +################################################################################ +# +# rustc +# +################################################################################ + +RUST_TARGET_NAME := $(subst buildroot,unknown,$(GNU_TARGET_NAME)) + +ifeq ($(BR2_ARM_CPU_ARMV7A),y) +RUST_TARGET_NAME := $(subst arm-,armv7-,$(RUST_TARGET_NAME)) +endif + +ifeq ($(BR2_mips64)$(BR2_mips64el),y) +RUST_TARGET_NAME := $(subst -gnu,-gnuabi64,$(RUST_TARGET_NAME)) +endif + +ifeq ($(HOSTARCH),x86_64) +RUST_HOST_ARCH = x86_64 +else ifeq ($(HOSTARCH),x86) +RUST_HOST_ARCH = i686 +endif + +RUST_HOST_NAME = $(RUST_HOST_ARCH)-unknown-linux-gnu + +$(eval $(host-virtual-package))
Signature · 1 line
2.9.4
PATCH v7 1/10 rustc: new virtual package
Hi Eric,
Quoted 36 lines · Eric Le Bihan
The compiler for the Rust programming language is called rustc.
There is only one reference implementation for it, based on LLVM, from the Rust project [1]. It can generate code for various architectures so it can be labeled as a cross-compiler. But, as for GCC, building it from source takes time.
So it would be sensible to have at least one package which provides it as a pre-built version, fetched from the upstream project. Later another package can be added, to build it from source code.
In addition to the compiler, the standard library for the host and/or the target should also be fetched/built.
So, add a virtual package named rustc to enable support for multiple providers.
Currently, only the host variant will be available to allow the user to cross-compile Rust programs for the target.
Signed-off-by Eric Le Bihan <[email protected]>--- package/rustc/Config.in.host | 5 +++++ package/rustc/rustc.mk | 25 +++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 package/rustc/Config.in.host create mode 100644 package/rustc/rustc.mkpackage/rustc/Config.in.host new file +0
-0
package/rustc/Config.in.host line 5
Quoted 5 lines
package/rustc/Config.in.host new file +5
-0@@ -0,0 +1,5 @@ +config BR2_PACKAGE_HAS_HOST_RUSTC + bool + +config BR2_PACKAGE_PROVIDES_HOST_RUSTC + string
According to the manual about the virtual package a "depends on BR2_PACKAGE_HAS_SOMETHING_VIRTUAL" should be added here.
Quoted 21 lines
package/rustc/rustc.mk new file +15
-0@@ -0,0 +1,25 @@ +################################################################################ +# +# rustc +# +################################################################################ + +RUST_TARGET_NAME := $(subst buildroot,unknown,$(GNU_TARGET_NAME)) + +ifeq ($(BR2_ARM_CPU_ARMV7A),y) +RUST_TARGET_NAME := $(subst arm-,armv7-,$(RUST_TARGET_NAME)) +endif + +ifeq ($(BR2_mips64)$(BR2_mips64el),y) +RUST_TARGET_NAME := $(subst -gnu,-gnuabi64,$(RUST_TARGET_NAME)) +endif
package/rustc/rustc.mk line 25
Quoted 10 lines
package/rustc/rustc.mk new file +9
-0+ +ifeq ($(HOSTARCH),x86_64) +RUST_HOST_ARCH = x86_64 +else ifeq ($(HOSTARCH),x86) +RUST_HOST_ARCH = i686 +endif + +RUST_HOST_NAME = $(RUST_HOST_ARCH)-unknown-linux-gnu +$(eval $(host-virtual-package))
Considering this commit as adding a virtual package for the Rust compiler, I would expect only the last line to be present and RUST_TARGET_NAME and RUST_HOST_ARCH to be added later be a follow up patch of the series.
PATCH v7 1/10 rustc: new virtual package
In reply to Eric Le BihanOn 23-07-17 10:11, Eric Le Bihan wrote:
[snip]
Quoted 1 line
+RUST_TARGET_NAME := $(subst buildroot,unknown,$(GNU_TARGET_NAME))
GNU_TARGET_NAME is not exactly predictable - in particular, the buildroot bit
depends on (or may depend on) BR2_TOOLCHAIN_BUILDROOT_VENDOR. So instead, I'd build up RUST_TARGET_NAME explicitly as $(RUST_ARCH)-unknown-$(TARGET_OS)-$(LIBC)$(RUST_ABI)
As you can see, instead of redefining RUST_TARGET_NAME below, it's also better
to first define its components and then build it properly.
And finally, does rust work with TARGET_OS == uclinux, LIBC == uclibc/musl, ABI
== spe/gnueabi/eabihf ?
package/rustc/rustc.mk line 20
Quoted 13 lines
package/rustc/rustc.mk new file +13
-0+ +ifeq ($(BR2_ARM_CPU_ARMV7A),y) +RUST_TARGET_NAME := $(subst arm-,armv7-,$(RUST_TARGET_NAME)) +endif + +ifeq ($(BR2_mips64)$(BR2_mips64el),y) +RUST_TARGET_NAME := $(subst -gnu,-gnuabi64,$(RUST_TARGET_NAME)) +endif + +ifeq ($(HOSTARCH),x86_64) +RUST_HOST_ARCH = x86_64 +else ifeq ($(HOSTARCH),x86) +RUST_HOST_ARCH = i686
And in other cases? I guess Config.in somewhere should specify the constraints
on the host arch as well.
Also, this is better expressed as
ifeq ($(HOSTARCH),x86)RUST_HOST_ARCH = i686
elseRUST_HOST_ARCH = $(HOSTARCH)
endif
Regards,
Arnout
Quoted 5 lines
package/rustc/rustc.mk new file +5
-0+endif + +RUST_HOST_NAME = $(RUST_HOST_ARCH)-unknown-linux-gnu + +$(eval $(host-virtual-package))
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH v7 1/10 rustc: new virtual package
Hi!
Quoted 11 lines · Arnout Vandecappelle
On 23-07-17 10:11, Eric Le Bihan wrote:
[snip]Quoted 1 line
+RUST_TARGET_NAME := $(subst buildroot,unknown,$(GNU_TARGET_NAME))
GNU_TARGET_NAMEis not exactly predictable - in particular, the buildroot bit
depends on (or may depend on)BR2_TOOLCHAIN_BUILDROOT_VENDOR. So instead, I'd build upRUST_TARGET_NAMEexplicitly as $(RUST_ARCH)-unknown-$(TARGET_OS)-$(LIBC)$(RUST_ABI)
Quoted 5 lines
As you can see, instead of redefining
RUST_TARGET_NAMEbelow, it's also better
to first define its components and then build it properly.And finally, does rust work with
TARGET_OS== uclinux, LIBC == uclibc/musl, ABI
== spe/gnueabi/eabihf ?
This looks like a good solution. Rust supports musl, but not uclibc. I prefered to focus on glibc first. Then later, I'll add musl support.
Quoted 18 lines
Quoted 5 lines
package/rustc/rustc.mk new file +3
-0+ +ifeq ($(BR2_ARM_CPU_ARMV7A),y) +RUST_TARGET_NAME := $(subst arm-,armv7-,$(RUST_TARGET_NAME))package/rustc/rustc.mk line 20
Quoted 10 lines
package/rustc/rustc.mk new file +10
-0+endif + +ifeq ($(BR2_mips64)$(BR2_mips64el),y) +RUST_TARGET_NAME := $(subst -gnu,-gnuabi64,$(RUST_TARGET_NAME)) +endif + +ifeq ($(HOSTARCH),x86_64) +RUST_HOST_ARCH = x86_64 +else ifeq ($(HOSTARCH),x86) +RUST_HOST_ARCH = i686And in other cases? I guess Config.in somewhere should specify the constraints
on the host arch as well.
Rust provides rustc binaries for aarch64, arm, armv7, i686/x86, mips, mipsel, mips64, mips64el powerpc, powerpc64, powerpc64le.
I only handled the x86/x86_64, without thinking about users running Buildroot on these other architectures. I'll check this.
Anyway, the rust-bin patch modifies package/rustc/Config.in.host to add $(BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS) which sets:
depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86"
Quoted 7 lines
Also, this is better expressed as
ifeq ($(HOSTARCH),x86)
RUST_HOST_ARCH= i686
elseRUST_HOST_ARCH= $(HOSTARCH)
endif
OK.
Thanks for the review!
PATCH v7 2/10 rust-bin: new package
In reply to Eric Le BihanThis package provides a pre-built version of rustc, the compiler for the Rust programming language, fetched from the upstream project.
A pre-built version of the standard library for the host as well as one for the chosen target are also fetched and installed.
Only the host variant is provided to allow the user to cross-compile Rust programs and run them on the target.
The menuconfig entry for rustc is also updated to expose this provider.
--- DEVELOPERS | 1 + package/rust-bin/rust-bin.hash | 30 ++++++++++++++++++++++++++++++ package/rust-bin/rust-bin.mk | 41 +++++++++++++++++++++++++++++++++++++++++ package/rustc/Config.in.host | 41 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 113 insertions(+) create mode 100644 package/rust-bin/rust-bin.hash create mode 100644 package/rust-bin/rust-bin.mk
DEVELOPERS +1 -0
@@ -493,6 +493,7 @@ F: package/execline/ F: package/hicolor-icon-theme/ F: package/jemalloc/ F: package/ninja/ +F: package/rust-bin/ F: package/s6/ F: package/s6-dns/ F: package/s6-linux-init/
package/rust-bin/rust-bin.hash new file +30 -0
@@ -0,0 +1,30 @@ +# From https://static.rust-lang.org/dist/rustc-1.19.0-i686-unknown-linux-gnu.tar.xz.sha256 +sha256 458404eeac5439c7de35eb15b5922835401918935874672c07eb0f579a85fa40 rustc-1.19.0-i686-unknown-linux-gnu.tar.xz +# From https://static.rust-lang.org/dist/rustc-1.19.0-x86_64-unknown-linux-gnu.tar.xz.sha256 +sha256 023f1b63b77eab1e19e900ed6c15f144914bec82de96d644a20f428be1e565b1 rustc-1.19.0-x86_64-unknown-linux-gnu.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.19.0-aarch64-unknown-linux-gnu.tar.xz.sha256 +sha256 bcadc15e62aa1e919409fd61212d2cde1b63c065afa4f001b8a33300a06a67ab rust-std-1.19.0-aarch64-unknown-linux-gnu.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.19.0-arm-unknown-linux-gnueabi.tar.xz.sha256 +sha256 458af663cbd06262bcc1bd3eea741a1ccb3a0b794329542fc81e83891b7291b2 rust-std-1.19.0-arm-unknown-linux-gnueabi.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.19.0-arm-unknown-linux-gnueabihf.tar.xz.sha256 +sha256 6e845a4c2b87f3764c42fbad835fd7deb6a872bfbe5fecdc4412d7344064b07d rust-std-1.19.0-arm-unknown-linux-gnueabihf.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.19.0-armv7-unknown-linux-gnueabihf.tar.xz.sha256 +sha256 5f45d5e4f4b2cf2a91818c68d4fe463745c9133a6d85edb518b77f175eea2065 rust-std-1.19.0-armv7-unknown-linux-gnueabihf.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.19.0-i686-unknown-linux-gnu.tar.xz.sha256 +sha256 f5dffacc264fb82b605dc66180cd327628caadedd4dca0c2115652f1933c6d93 rust-std-1.19.0-i686-unknown-linux-gnu.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.19.0-mips-unknown-linux-gnu.tar.xz.sha256 +sha256 a74d1d91d28cb09d13b90451f59939ac01fcbb33eb3087e90b45eff76d5ab9ae rust-std-1.19.0-mips-unknown-linux-gnu.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.19.0-mips64-unknown-linux-gnuabi64.tar.xz.sha256 +sha256 eeb6d00d24ce9250219cb019cf08b64c2b629dec8e3e70546ddd103df5c8b9dc rust-std-1.19.0-mips64-unknown-linux-gnuabi64.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.19.0-mips64el-unknown-linux-gnuabi64.tar.xz.sha256 +sha256 745fc612c64bb43f26be5240333842280c6aacfd5acafe3c279ab9ac1da77a46 rust-std-1.19.0-mips64el-unknown-linux-gnuabi64.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.19.0-mipsel-unknown-linux-gnu.tar.xz.sha256 +sha256 fabb4d203019eefcca2200cf1d519de47a376e71cdca6faa527e94d86b66ecd6 rust-std-1.19.0-mipsel-unknown-linux-gnu.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.19.0-powerpc-unknown-linux-gnu.tar.xz.sha256 +sha256 0c0a6aad87c97b1777c43386c17a8a0dea4ebe774adcae563768cabb0a039bbf rust-std-1.19.0-powerpc-unknown-linux-gnu.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.19.0-powerpc64-unknown-linux-gnu.tar.xz.sha256 +sha256 ddb66ff250ebdaab4593634236dcefe707918a424f3f5d2650a3b8e726d8081d rust-std-1.19.0-powerpc64-unknown-linux-gnu.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.19.0-powerpc64le-unknown-linux-gnu.tar.xz.sha256 +sha256 5ca6c0943c883606c43c11d32c35382f019109544a7820d4279d479ce2393a3c rust-std-1.19.0-powerpc64le-unknown-linux-gnu.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.19.0-x86_64-unknown-linux-gnu.tar.xz.sha256 +sha256 da67633a1447656c4c9907776fc473b208737f4ed521727eb37a59177d1ae296 rust-std-1.19.0-x86_64-unknown-linux-gnu.tar.xz
package/rust-bin/rust-bin.mk new file +41 -0
41 lines not on this page · raw message
package/rustc/Config.in.host +41 -0
46 lines not on this page · raw message
Signature · 1 line
2.9.4
PATCH v7 2/10 rust-bin: new package
Quoted 5 lines · Eric Le Bihan
This package provides a pre-built version of rustc, the compiler for the Rust programming language, fetched from the upstream project.
A pre-built version of the standard library for the host as well as one for the chosen target are also fetched and installed.
As this series of patches adds support for fetching a pre-built compiler or build the compiler from source, we should allow this for the Rust standard library (std), too:
1) Rust allows to compile crates without using the std library [1]
2) The std library can be build from source, e.g. for non-supported targets by using a custom target configuration [2].
Quoted 115 lines
Only the host variant is provided to allow the user to cross-compile Rust programs and run them on the target.
The menuconfig entry for rustc is also updated to expose this provider.
Signed-off-by Eric Le Bihan <[email protected]>--- DEVELOPERS | 1 + package/rust-bin/rust-bin.hash | 30 ++++++++++++++++++++++++++++++ package/rust-bin/rust-bin.mk | 41 +++++++++++++++++++++++++++++++++++++++++ package/rustc/Config.in.host | 41 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 113 insertions(+) create mode 100644 package/rust-bin/rust-bin.hash create mode 100644 package/rust-bin/rust-bin.mkDEVELOPERS +1
-0@@ -493,6 +493,7 @@ F: package/execline/ F: package/hicolor-icon-theme/ F: package/jemalloc/ F: package/ninja/ +F: package/rust-bin/ F: package/s6/ F: package/s6-dns/ F: package/s6-linux-init/package/rust-bin/rust-bin.hash new file +30
-0@@ -0,0 +1,30 @@ +# From https://static.rust-lang.org/dist/rustc-1.19.0-i686-unknown-linux-gnu.tar.xz.sha256 +sha256 458404eeac5439c7de35eb15b5922835401918935874672c07eb0f579a85fa40 rustc-1.19.0-i686-unknown-linux-gnu.tar.xz +# From https://static.rust-lang.org/dist/rustc-1.19.0-x86_64-unknown-linux-gnu.tar.xz.sha256 +sha256 023f1b63b77eab1e19e900ed6c15f144914bec82de96d644a20f428be1e565b1 rustc-1.19.0-x86_64-unknown-linux-gnu.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.19.0-aarch64-unknown-linux-gnu.tar.xz.sha256 +sha256 bcadc15e62aa1e919409fd61212d2cde1b63c065afa4f001b8a33300a06a67ab rust-std-1.19.0-aarch64-unknown-linux-gnu.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.19.0-arm-unknown-linux-gnueabi.tar.xz.sha256 +sha256 458af663cbd06262bcc1bd3eea741a1ccb3a0b794329542fc81e83891b7291b2 rust-std-1.19.0-arm-unknown-linux-gnueabi.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.19.0-arm-unknown-linux-gnueabihf.tar.xz.sha256 +sha256 6e845a4c2b87f3764c42fbad835fd7deb6a872bfbe5fecdc4412d7344064b07d rust-std-1.19.0-arm-unknown-linux-gnueabihf.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.19.0-armv7-unknown-linux-gnueabihf.tar.xz.sha256 +sha256 5f45d5e4f4b2cf2a91818c68d4fe463745c9133a6d85edb518b77f175eea2065 rust-std-1.19.0-armv7-unknown-linux-gnueabihf.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.19.0-i686-unknown-linux-gnu.tar.xz.sha256 +sha256 f5dffacc264fb82b605dc66180cd327628caadedd4dca0c2115652f1933c6d93 rust-std-1.19.0-i686-unknown-linux-gnu.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.19.0-mips-unknown-linux-gnu.tar.xz.sha256 +sha256 a74d1d91d28cb09d13b90451f59939ac01fcbb33eb3087e90b45eff76d5ab9ae rust-std-1.19.0-mips-unknown-linux-gnu.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.19.0-mips64-unknown-linux-gnuabi64.tar.xz.sha256 +sha256 eeb6d00d24ce9250219cb019cf08b64c2b629dec8e3e70546ddd103df5c8b9dc rust-std-1.19.0-mips64-unknown-linux-gnuabi64.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.19.0-mips64el-unknown-linux-gnuabi64.tar.xz.sha256 +sha256 745fc612c64bb43f26be5240333842280c6aacfd5acafe3c279ab9ac1da77a46 rust-std-1.19.0-mips64el-unknown-linux-gnuabi64.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.19.0-mipsel-unknown-linux-gnu.tar.xz.sha256 +sha256 fabb4d203019eefcca2200cf1d519de47a376e71cdca6faa527e94d86b66ecd6 rust-std-1.19.0-mipsel-unknown-linux-gnu.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.19.0-powerpc-unknown-linux-gnu.tar.xz.sha256 +sha256 0c0a6aad87c97b1777c43386c17a8a0dea4ebe774adcae563768cabb0a039bbf rust-std-1.19.0-powerpc-unknown-linux-gnu.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.19.0-powerpc64-unknown-linux-gnu.tar.xz.sha256 +sha256 ddb66ff250ebdaab4593634236dcefe707918a424f3f5d2650a3b8e726d8081d rust-std-1.19.0-powerpc64-unknown-linux-gnu.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.19.0-powerpc64le-unknown-linux-gnu.tar.xz.sha256 +sha256 5ca6c0943c883606c43c11d32c35382f019109544a7820d4279d479ce2393a3c rust-std-1.19.0-powerpc64le-unknown-linux-gnu.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.19.0-x86_64-unknown-linux-gnu.tar.xz.sha256 +sha256 da67633a1447656c4c9907776fc473b208737f4ed521727eb37a59177d1ae296 rust-std-1.19.0-x86_64-unknown-linux-gnu.tar.xzpackage/rust-bin/rust-bin.mk new file +41
-0@@ -0,0 +1,41 @@ +################################################################################ +# +# rust-bin +# +################################################################################ + +RUST_BIN_VERSION = 1.19.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 + +HOST_RUST_BIN_PROVIDES = host-rustc + +HOST_RUST_BIN_SOURCE = rustc-$(RUST_BIN_VERSION)-$(RUST_HOST_NAME).tar.xz +HOST_RUST_BIN_LIBSTD_SOURCES = \ + rust-std-$(RUST_BIN_VERSION)-$(RUST_HOST_NAME).tar.xz \ + rust-std-$(RUST_BIN_VERSION)-$(RUST_TARGET_NAME).tar.xz + +HOST_RUST_BIN_EXTRA_DOWNLOADS = $(HOST_RUST_BIN_LIBSTD_SOURCES) + +define HOST_RUST_BIN_LIBSTD_EXTRACT + mkdir -p $(@D)/std + for file in $(addprefix $(DL_DIR)/,$(HOST_RUST_BIN_LIBSTD_SOURCES)); do \ + $(TAR) -C $(@D)/std -xJf $${file}; \ + done +endef + +HOST_RUST_BIN_POST_EXTRACT_HOOKS += HOST_RUST_BIN_LIBSTD_EXTRACT + +define HOST_RUST_BIN_INSTALL_CMDS + for exe in $$(find $(@D) -name install.sh -executable); do \ + $${exe} \ + --prefix=$(HOST_DIR) \ + --docdir=$(HOST_DIR)/share/doc/rust \ + --libdir=$(HOST_DIR)/lib \ + --mandir=$(HOST_DIR)/share/man \ + --disable-ldconfig; \ + done +endef + +$(eval $(host-generic-package))package/rustc/Config.in.host +0
-0
package/rustc/Config.in.host line 5
Quoted 5 lines
package/rustc/Config.in.host +5
-0@@ -1,5 +1,46 @@ +config BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS + bool + default y + depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" + depends on BR2_i386 || BR2_x86_64 \
^^
Nitpick, two spaces.
package/rustc/Config.in.host line 11
Quoted 6 lines
package/rustc/Config.in.host +6
-0+ || BR2_arm || BR2_aarch64 \ + || BR2_powerpc || BR2_powerpc64 \ + || BR2_mips || BR2_mipsel || BR2_mips64 || BR2_mips64el + depends on !BR2_ARM_CPU_ARMV4 && !BR2_ARM_CPU_ARMV5 + depends on !BR2_MIPS_NABI32 + depends on BR2_TOOLCHAIN_USES_GLIBC
At least for ARMv6 and ARMv7 pre-built libraries for the musl toolchain are available for download.
Quoted 5 lines
package/rustc/Config.in.host +5
-0+config BR2_PACKAGE_HOST_RUSTC + bool "host rustc" + depends on BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS + help + Select the desired provider for the Rust compiler.
package/rustc/Config.in.host line 27
Quoted 10 lines
package/rustc/Config.in.host +10
-0+ + http://www.rust-lang.org + +if BR2_PACKAGE_HOST_RUSTC + +choice + prompt "Rust compiler variant" + default BR2_PACKAGE_HOST_RUST_BIN + help + Choose a provider for the Rust compiler.
Better not use the word "provider" here. Maybe just "Select a Rust compiler"? Or change the text later into something more meaningful?
package/rustc/Config.in.host line 34
Quoted 6 lines
package/rustc/Config.in.host +6
-0+config BR2_PACKAGE_HOST_RUST_BIN + bool "host rust (pre-built)" + select BR2_PACKAGE_HAS_HOST_RUSTC + help + This package will install pre-built versions of the compiler + for the host and the Rust standard library for the target.
Maybe add a description that the libraries for the target are installed in the Buildroot host directory, too.
package/rustc/Config.in.host line 46
Quoted 11 lines
package/rustc/Config.in.host +6
-0+endchoice + config BR2_PACKAGE_HAS_HOST_RUSTC bool config BR2_PACKAGE_PROVIDES_HOST_RUSTC string + default "host-rust-bin" if BR2_PACKAGE_HOST_RUST_BIN + +endif +
[1] https://doc.rust-lang.org/book/first-edition/using-rust-without-the
-standard-library.html
[2] https://doc.rust-lang.org/1.1.0/rustc_back/target/index.html#using-
custom-targets
PATCH v7 2/10 rust-bin: new package
In reply to Eric Le BihanQuoted 122 lines · Eric Le Bihan
This package provides a pre-built version of rustc, the compiler for the Rust programming language, fetched from the upstream project.
A pre-built version of the standard library for the host as well as one for the chosen target are also fetched and installed.
Only the host variant is provided to allow the user to cross-compile Rust programs and run them on the target.
The menuconfig entry for rustc is also updated to expose this provider.
Signed-off-by Eric Le Bihan <[email protected]>--- DEVELOPERS | 1 + package/rust-bin/rust-bin.hash | 30 ++++++++++++++++++++++++++++++ package/rust-bin/rust-bin.mk | 41 +++++++++++++++++++++++++++++++++++++++++ package/rustc/Config.in.host | 41 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 113 insertions(+) create mode 100644 package/rust-bin/rust-bin.hash create mode 100644 package/rust-bin/rust-bin.mkDEVELOPERS +1
-0@@ -493,6 +493,7 @@ F: package/execline/ F: package/hicolor-icon-theme/ F: package/jemalloc/ F: package/ninja/ +F: package/rust-bin/ F: package/s6/ F: package/s6-dns/ F: package/s6-linux-init/package/rust-bin/rust-bin.hash new file +30
-0@@ -0,0 +1,30 @@ +# From https://static.rust-lang.org/dist/rustc-1.19.0-i686-unknown-linux-gnu.tar.xz.sha256 +sha256 458404eeac5439c7de35eb15b5922835401918935874672c07eb0f579a85fa40 rustc-1.19.0-i686-unknown-linux-gnu.tar.xz +# From https://static.rust-lang.org/dist/rustc-1.19.0-x86_64-unknown-linux-gnu.tar.xz.sha256 +sha256 023f1b63b77eab1e19e900ed6c15f144914bec82de96d644a20f428be1e565b1 rustc-1.19.0-x86_64-unknown-linux-gnu.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.19.0-aarch64-unknown-linux-gnu.tar.xz.sha256 +sha256 bcadc15e62aa1e919409fd61212d2cde1b63c065afa4f001b8a33300a06a67ab rust-std-1.19.0-aarch64-unknown-linux-gnu.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.19.0-arm-unknown-linux-gnueabi.tar.xz.sha256 +sha256 458af663cbd06262bcc1bd3eea741a1ccb3a0b794329542fc81e83891b7291b2 rust-std-1.19.0-arm-unknown-linux-gnueabi.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.19.0-arm-unknown-linux-gnueabihf.tar.xz.sha256 +sha256 6e845a4c2b87f3764c42fbad835fd7deb6a872bfbe5fecdc4412d7344064b07d rust-std-1.19.0-arm-unknown-linux-gnueabihf.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.19.0-armv7-unknown-linux-gnueabihf.tar.xz.sha256 +sha256 5f45d5e4f4b2cf2a91818c68d4fe463745c9133a6d85edb518b77f175eea2065 rust-std-1.19.0-armv7-unknown-linux-gnueabihf.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.19.0-i686-unknown-linux-gnu.tar.xz.sha256 +sha256 f5dffacc264fb82b605dc66180cd327628caadedd4dca0c2115652f1933c6d93 rust-std-1.19.0-i686-unknown-linux-gnu.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.19.0-mips-unknown-linux-gnu.tar.xz.sha256 +sha256 a74d1d91d28cb09d13b90451f59939ac01fcbb33eb3087e90b45eff76d5ab9ae rust-std-1.19.0-mips-unknown-linux-gnu.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.19.0-mips64-unknown-linux-gnuabi64.tar.xz.sha256 +sha256 eeb6d00d24ce9250219cb019cf08b64c2b629dec8e3e70546ddd103df5c8b9dc rust-std-1.19.0-mips64-unknown-linux-gnuabi64.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.19.0-mips64el-unknown-linux-gnuabi64.tar.xz.sha256 +sha256 745fc612c64bb43f26be5240333842280c6aacfd5acafe3c279ab9ac1da77a46 rust-std-1.19.0-mips64el-unknown-linux-gnuabi64.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.19.0-mipsel-unknown-linux-gnu.tar.xz.sha256 +sha256 fabb4d203019eefcca2200cf1d519de47a376e71cdca6faa527e94d86b66ecd6 rust-std-1.19.0-mipsel-unknown-linux-gnu.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.19.0-powerpc-unknown-linux-gnu.tar.xz.sha256 +sha256 0c0a6aad87c97b1777c43386c17a8a0dea4ebe774adcae563768cabb0a039bbf rust-std-1.19.0-powerpc-unknown-linux-gnu.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.19.0-powerpc64-unknown-linux-gnu.tar.xz.sha256 +sha256 ddb66ff250ebdaab4593634236dcefe707918a424f3f5d2650a3b8e726d8081d rust-std-1.19.0-powerpc64-unknown-linux-gnu.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.19.0-powerpc64le-unknown-linux-gnu.tar.xz.sha256 +sha256 5ca6c0943c883606c43c11d32c35382f019109544a7820d4279d479ce2393a3c rust-std-1.19.0-powerpc64le-unknown-linux-gnu.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.19.0-x86_64-unknown-linux-gnu.tar.xz.sha256 +sha256 da67633a1447656c4c9907776fc473b208737f4ed521727eb37a59177d1ae296 rust-std-1.19.0-x86_64-unknown-linux-gnu.tar.xzpackage/rust-bin/rust-bin.mk new file +41
-0@@ -0,0 +1,41 @@ +################################################################################ +# +# rust-bin +# +################################################################################ + +RUST_BIN_VERSION = 1.19.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 + +HOST_RUST_BIN_PROVIDES = host-rustc + +HOST_RUST_BIN_SOURCE = rustc-$(RUST_BIN_VERSION)-$(RUST_HOST_NAME).tar.xz +HOST_RUST_BIN_LIBSTD_SOURCES = \ + rust-std-$(RUST_BIN_VERSION)-$(RUST_HOST_NAME).tar.xz \ + rust-std-$(RUST_BIN_VERSION)-$(RUST_TARGET_NAME).tar.xz + +HOST_RUST_BIN_EXTRA_DOWNLOADS = $(HOST_RUST_BIN_LIBSTD_SOURCES) + +define HOST_RUST_BIN_LIBSTD_EXTRACT + mkdir -p $(@D)/std + for file in $(addprefix $(DL_DIR)/,$(HOST_RUST_BIN_LIBSTD_SOURCES)); do \ + $(TAR) -C $(@D)/std -xJf $${file}; \ + done +endef + +HOST_RUST_BIN_POST_EXTRACT_HOOKS += HOST_RUST_BIN_LIBSTD_EXTRACT + +define HOST_RUST_BIN_INSTALL_CMDS + for exe in $$(find $(@D) -name install.sh -executable); do \ + $${exe} \ + --prefix=$(HOST_DIR) \ + --docdir=$(HOST_DIR)/share/doc/rust \ + --libdir=$(HOST_DIR)/lib \ + --mandir=$(HOST_DIR)/share/man \ + --disable-ldconfig; \ + done +endef + +$(eval $(host-generic-package))package/rustc/Config.in.host +1
-0@@ -1,5 +1,46 @@ +config BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS
package/rustc/Config.in.host line 11
Quoted 10 lines
package/rustc/Config.in.host +10
-0+ bool + default y + depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" + depends on BR2_i386 || BR2_x86_64 \ + || BR2_arm || BR2_aarch64 \ + || BR2_powerpc || BR2_powerpc64 \ + || BR2_mips || BR2_mipsel || BR2_mips64 || BR2_mips64el + depends on !BR2_ARM_CPU_ARMV4 && !BR2_ARM_CPU_ARMV5 + depends on !BR2_MIPS_NABI32 + depends on BR2_TOOLCHAIN_USES_GLIBC
The dependency on the architecture is only true for the available pre- built std libraries. If we want to support custom targets or building without std, the architecture depends on the support in LLVM.
So, I really think it's best to untie rustc and std.
Best regards,
J?rg
PATCH v7 2/10 rust-bin: new package
In reply to Eric Le BihanOn 23-07-17 10:11, Eric Le Bihan wrote:
[snip]
package/rust-bin/rust-bin.mk line 31
Quoted 2 lines
package/rust-bin/rust-bin.mk new file +2
-0+define HOST_RUST_BIN_INSTALL_CMDS + for exe in $$(find $(@D) -name install.sh -executable); do \
I don't like this very much. Is this one install.sh per package that you
install here (i.e. rustc, host-rust-std and rust-std)? In that case, it will resolve itself when you split off rust-std in a separate package. Or is there really a bunch of install.sh scripts scattered around?
package/rust-bin/rust-bin.mk line 34
Quoted 3 lines
package/rust-bin/rust-bin.mk new file +3
-0+ $${exe} \ + --prefix=$(HOST_DIR) \ + --docdir=$(HOST_DIR)/share/doc/rust \
Would it be possible to avoid installing docs completely?
package/rust-bin/rust-bin.mk line 36
Quoted 2 lines
package/rust-bin/rust-bin.mk new file +2
-0+ --libdir=$(HOST_DIR)/lib \ + --mandir=$(HOST_DIR)/share/man \
Same here.
Quoted 11 lines
package/rust-bin/rust-bin.mk new file +5
-0+ --disable-ldconfig; \ + done +endef + +$(eval $(host-generic-package))package/rustc/Config.in.host +1
-0@@ -1,5 +1,46 @@ +config BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS
package/rustc/Config.in.host line 11
Quoted 10 lines
package/rustc/Config.in.host +10
-0+ bool + default y + depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" + depends on BR2_i386 || BR2_x86_64 \ + || BR2_arm || BR2_aarch64 \ + || BR2_powerpc || BR2_powerpc64 \ + || BR2_mips || BR2_mipsel || BR2_mips64 || BR2_mips64el + depends on !BR2_ARM_CPU_ARMV4 && !BR2_ARM_CPU_ARMV5 + depends on !BR2_MIPS_NABI32 + depends on BR2_TOOLCHAIN_USES_GLIBC
Ah, it depends on glibc... That voids my earlier questions about TARGET_OS,
LIBC and ABI support.
This entire piece should be kept together with the part in the first patch that
defines RUST_TARGET_NAME etc. Unlike Joerg, I kind of like this stuff to already be done in the patch that adds the virtual package, but either way works.
package/rustc/Config.in.host line 17
Quoted 6 lines
package/rustc/Config.in.host +6
-0+ +config BR2_PACKAGE_HOST_RUSTC + bool "host rustc" + depends on BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS + help + Select the desired provider for the Rust compiler.
This help text is not relevant, should rather be something like "Compiler for
the Rust language".
Quoted 7 lines
package/rustc/Config.in.host +7
-0+ + http://www.rust-lang.org + +if BR2_PACKAGE_HOST_RUSTC + +choice + prompt "Rust compiler variant"
package/rustc/Config.in.host line 34
Quoted 10 lines
package/rustc/Config.in.host +10
-0+ default BR2_PACKAGE_HOST_RUST_BIN + help + Choose a provider for the Rust compiler. + +config BR2_PACKAGE_HOST_RUST_BIN + bool "host rust (pre-built)" + select BR2_PACKAGE_HAS_HOST_RUSTC + help + This package will install pre-built versions of the compiler + for the host and the Rust standard library for the target.
When rust-std{,-bin} becomes a separate package, I do think that it should be a
hidden package, i.e. selected automatically when host-rust-bin is selected. So this help text is OK as it is even when rust-std-bin is a separate package.
Regards,
Arnout
Quoted 11 lines
package/rustc/Config.in.host +6
-0+ +endchoice + config BR2_PACKAGE_HAS_HOST_RUSTC bool config BR2_PACKAGE_PROVIDES_HOST_RUSTC string + default "host-rust-bin" if BR2_PACKAGE_HOST_RUST_BIN + +endif
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH v7 2/10 rust-bin: new package
Hi!
Quoted 11 lines · Arnout Vandecappelle
On 23-07-17 10:11, Eric Le Bihan wrote:
[snip]package/rust-bin/rust-bin.mk line 31
Quoted 2 lines
package/rust-bin/rust-bin.mk new file +2
-0+define HOST_RUST_BIN_INSTALL_CMDS + for exe in $$(find $(@D) -name install.sh -executable); do \I don't like this very much. Is this one
install.shper package that you
install here (i.e. rustc, host-rust-std and rust-std)? In that case, it will resolve itself when you split off rust-std in a separate package. Or is there really a bunch ofinstall.shscripts scattered around?
No, there are only three install.sh scripts, one for rustc, one for the host library and another for the target library:
- host-rust-bin-1.19.0/install.sh
- host-rust-bin-1.19.0/std/rust-std-1.19.0-x86_64-unknown-linux-gnu/install.sh
- host-rust-bin-1.19.0/std/rust-std-1.19.0-armv7-unknown-linux-gnueabihf/install.sh
I used a loop instead of defining $(HOST_RUST_BIN_INSTALL_{RUSTC,LIBSTD_HOST,LIBSTD_TARGET), which may have been more explicit. But with a rust-std-bin package, this would of course, disappear.
Quoted 10 lines
package/rust-bin/rust-bin.mk line 34
Quoted 3 lines
package/rust-bin/rust-bin.mk new file +3
-0+ $${exe} \ + --prefix=$(HOST_DIR) \ + --docdir=$(HOST_DIR)/share/doc/rust \Would it be possible to avoid installing docs completely?
package/rust-bin/rust-bin.mk line 36
Quoted 2 lines
package/rust-bin/rust-bin.mk new file +2
-0+ --libdir=$(HOST_DIR)/lib \ + --mandir=$(HOST_DIR)/share/man \Same here.
In fact, only --prefix=$(HOST_DIR) is usefull. The others can be removed.
Quoted 25 lines
Quoted 11 lines
package/rust-bin/rust-bin.mk new file +5
-0+ --disable-ldconfig; \ + done +endef + +$(eval $(host-generic-package))package/rustc/Config.in.host +1
-0@@ -1,5 +1,46 @@ +config BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTSpackage/rustc/Config.in.host line 11
Quoted 10 lines
package/rustc/Config.in.host +10
-0+ bool + default y + depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" + depends on BR2_i386 || BR2_x86_64 \ + || BR2_arm || BR2_aarch64 \ + || BR2_powerpc || BR2_powerpc64 \ + || BR2_mips || BR2_mipsel || BR2_mips64 || BR2_mips64el + depends on !BR2_ARM_CPU_ARMV4 && !BR2_ARM_CPU_ARMV5 + depends on !BR2_MIPS_NABI32 + depends on BR2_TOOLCHAIN_USES_GLIBCAh, it depends on glibc... That voids my earlier questions about
TARGET_OS,
LIBC and ABI support.
Quoted 3 lines
This entire piece should be kept together with the part in the first patch that
definesRUST_TARGET_NAMEetc. Unlike Joerg, I kind of like this stuff to already be done in the patch that adds the virtual package, but either way works.
OK. I'll move it to the patch declaring the virtual package.
Quoted 9 lines
package/rustc/Config.in.host line 17
Quoted 6 lines
package/rustc/Config.in.host +6
-0+ +config BR2_PACKAGE_HOST_RUSTC + bool "host rustc" + depends on BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS + help + Select the desired provider for the Rust compiler.This help text is not relevant, should rather be something like "Compiler for
the Rust language".
OK.
Quoted 13 lines
Quoted 13 lines
package/rustc/Config.in.host +13
-0+ + http://www.rust-lang.org + +if BR2_PACKAGE_HOST_RUSTC + +choice + prompt "Rust compiler variant" + default BR2_PACKAGE_HOST_RUST_BIN + help + Choose a provider for the Rust compiler. + +config BR2_PACKAGE_HOST_RUST_BIN + bool "host rust (pre-built)"
Quoted 8 lines
package/rustc/Config.in.host line 34
Quoted 4 lines
package/rustc/Config.in.host +4
-0+ select BR2_PACKAGE_HAS_HOST_RUSTC + help + This package will install pre-built versions of the compiler + for the host and the Rust standard library for the target.When rust-std{,-bin} becomes a separate package, I do think that it should be a
hidden package, i.e. selected automatically when host-rust-bin is selected. So this help text is OK as it is even when rust-std-bin is a separate package.
If the standard library is to be split from rust-bin, then rust-bin should be renamed to rustc-bin, as it will only install the binary version of the Rust compiler.
The new package rust-std-bin should install the host standard library as well as the target standard library (handling, of course, the case where $(HOSTARCH) == $(ARCH)).
Some things are not clear to me, though:
- should rust-std-bin be a hidden package, or would it benefit the user to allow selecting it via menuconfig?
- if rust-std-bin is a hidden package, then rustc-bin should select it, right?
- as the rust package builds rustc and the standard library, should another virtual package named rust-std be added, with two providers rust-std-bin and rust? If such a package existed, then host-cargo would depend on host-rustc and host-rust-std.
--
ELB
PATCH v7 3/10 rustc: expose host variant in menuconfig
In reply to Eric Le BihanNow that one provider is available for rustc, expose the host variant in menuconfig.
--- package/Config.in.host | 1 + 1 file changed, 1 insertion(+)
package/Config.in.host +1 -0
@@ -39,6 +39,7 @@ menu "Host utilities" source "package/qemu/Config.in.host" source "package/raspberrypi-usbboot/Config.in.host" source "package/rauc/Config.in.host" + source "package/rustc/Config.in.host" source "package/s6-rc/Config.in.host" source "package/sam-ba/Config.in.host" source "package/squashfs/Config.in.host"
Signature · 1 line
2.9.4
PATCH v7 3/10 rustc: expose host variant in menuconfig
Quoted 2 lines · Eric Le Bihan
Now that one provider is available for rustc, expose the host variant in menuconfig.
This doesn't need to be split up from the first patch that introduces the
virtual package: that patch doesn't introduce any visible Kconfig symbol so including is already doesn't hurt. And *not* including it is completely pointless.
Regards,
Arnout
Quoted 19 lines
Signed-off-by Eric Le Bihan <[email protected]>--- package/Config.in.host | 1 + 1 file changed, 1 insertion(+)package/Config.in.host +1
-0@@ -39,6 +39,7 @@ menu "Host utilities" source "package/qemu/Config.in.host" source "package/raspberrypi-usbboot/Config.in.host" source "package/rauc/Config.in.host" + source "package/rustc/Config.in.host" source "package/s6-rc/Config.in.host" source "package/sam-ba/Config.in.host" source "package/squashfs/Config.in.host"
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH v7 4/10 rust-bootstrap: new package
In reply to Eric Le BihanThis new package fetches a binary snapshot of the Rust compiler, suitable to bootstrap the host variant of the Rust compiler.
To bootstrap rustc version N, rustc N-1 is used.
--- DEVELOPERS | 1 + package/rust-bootstrap/rust-bootstrap.hash | 8 ++++++++ package/rust-bootstrap/rust-bootstrap.mk | 27 +++++++++++++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 package/rust-bootstrap/rust-bootstrap.hash create mode 100644 package/rust-bootstrap/rust-bootstrap.mk
DEVELOPERS +1 -0
@@ -494,6 +494,7 @@ F: package/hicolor-icon-theme/ F: package/jemalloc/ F: package/ninja/ F: package/rust-bin/ +F: package/rust-bootstrap/ F: package/s6/ F: package/s6-dns/ F: package/s6-linux-init/
package/rust-bootstrap/rust-bootstrap.hash new file +8 -0
@@ -0,0 +1,8 @@ +# From https://static.rust-lang.org/dist/rustc-1.18.0-i686-unknown-linux-gnu.tar.gz.sha256 +sha256 0cb9bb95373cee8ba26e8f517c46f8c58a29e22f2c7c08a4d152306c6ffc7115 rustc-1.18.0-i686-unknown-linux-gnu.tar.gz +# From https://static.rust-lang.org/dist/rustc-1.18.0-x86_64-unknown-linux-gnu.tar.gz.sha256 +sha256 f2a34e20166ccf6eda4de46a9efb02821df5c3f34667e2988284a8eaee408113 rustc-1.18.0-x86_64-unknown-linux-gnu.tar.gz +# From https://static.rust-lang.org/dist/rust-std-1.18.0-x86_64-unknown-linux-gnu.tar.gz.sha256 +sha256 4a66150781e224412ebd9dd6d643ad65ecc5668a7754e4a12e115be6ce7bf527 rust-std-1.18.0-x86_64-unknown-linux-gnu.tar.gz +# From https://static.rust-lang.org/dist/rust-std-1.18.0-i686-unknown-linux-gnu.tar.gz.sha256 +sha256 3b93c7b856b98f61ec0f640bc96373f4762484ab3340866902c8c96933bcf10b rust-std-1.18.0-i686-unknown-linux-gnu.tar.gz
package/rust-bootstrap/rust-bootstrap.mk new file +27 -0
@@ -0,0 +1,27 @@ +################################################################################ +# +# rust-bootstrap +# +################################################################################ + +RUST_BOOTSTRAP_VERSION = 1.18.0 +RUST_BOOTSTRAP_SITE = https://static.rust-lang.org/dist + +RUST_BOOTSTRAP_SOURCE = rustc-$(RUST_BOOTSTRAP_VERSION)-$(RUST_HOST_NAME).tar.gz +RUST_BOOTSTRAP_LICENSE = Apache-2.0 or MIT +RUST_BOOTSTRAP_LICENSE_FILES = LICENSE-APACHE LICENSE-MIT +RUST_BOOTSTRAP_LIBSTD_SOURCE= rust-std-$(RUST_BOOTSTRAP_VERSION)-$(RUST_HOST_NAME).tar.gz +RUST_BOOTSTRAP_LIBSTD_ROOT = rust-std-$(RUST_BOOTSTRAP_VERSION)-$(RUST_HOST_NAME)/rust-std-$(RUST_HOST_NAME) +RUST_BOOTSTRAP_EXTRA_DOWNLOADS = $(RUST_BOOTSTRAP_SITE)/$(RUST_BOOTSTRAP_LIBSTD_SOURCE) + +define RUST_BOOTSTRAP_LIBSTD_EXTRACT + $(call suitable-extractor,$(RUST_BOOTSTRAP_LIBSTD_SOURCE)) \ + $(DL_DIR)/$(RUST_BOOTSTRAP_LIBSTD_SOURCE) | \ + $(TAR) --strip-components=2 -C $(@D)/rustc $(TAR_OPTIONS) - \ + $(RUST_BOOTSTRAP_LIBSTD_ROOT)/lib +endef + +HOST_RUST_BOOTSTRAP_EXTRA_DOWNLOADS = $(RUST_BOOTSTRAP_EXTRA_DOWNLOADS) +HOST_RUST_BOOTSTRAP_POST_EXTRACT_HOOKS += RUST_BOOTSTRAP_LIBSTD_EXTRACT + +$(eval $(host-generic-package))
Signature · 1 line
2.9.4
PATCH v7 4/10 rust-bootstrap: new package
Quoted 4 lines · Eric Le Bihan
This new package fetches a binary snapshot of the Rust compiler, suitable to bootstrap the host variant of the Rust compiler.
To bootstrap rustc version N, rustc N-1 is used.
Is it really needed/useful to use N-1 to bootstrap with? From the user's
perspective, that's just another useless download, right?
In fact, this way rust-bootstrap can be eliminated entirely: host-rust-bin can
be used instead. It does complicate things a little bit, because in that case we should NOT depend on (target) rust-std-bin. So that means that host-rust-bin shouldn't depend on rust-std-bin, so that dependency should be added in some different way...
Regards,
Arnout
[snip]
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH v7 4/10 rust-bootstrap: new package
Hi!
Quoted 10 lines · Arnout Vandecappelle
Quoted 4 lines · Eric Le Bihan
This new package fetches a binary snapshot of the Rust compiler, suitable to bootstrap the host variant of the Rust compiler.
To bootstrap rustc version N, rustc N-1 is used.
Is it really needed/useful to use N-1 to bootstrap with? From the user's
perspective, that's just another useless download, right?
AFAIK, rust N should be able to compile N, so it seems logical to get rid of rust-bootstrap and use rustc-bin (with rust-std-bin) instead. I'll make some tests, though.
So, should host-rustc-bin provide $(BR2_PACKAGE_HOST_RUSTC_BIN_AS_BOOTSTRAP), which should disable traditional installation if set?
Quoted 5 lines
In fact, this way rust-bootstrap can be eliminated entirely: host-rust-bin can
be used instead. It does complicate things a little bit, because in that case we should NOT depend on (target) rust-std-bin. So that means that host-rust-bin shouldn't depend on rust-std-bin, so that dependency should be added in some different way...
It is true that, in that case, we only need the standard library for host from host-rust-std-bin. If it installs target and host versions of the library, we have a useless download.
--
ELB
PATCH v7 5/10 cargo-bootstrap: new package
In reply to Eric Le BihanThis new package fetches a binary snapshot of Cargo, suitable to bootstrap the host variants of the Rust compiler and Cargo, the package manager.
--- DEVELOPERS | 1 + package/cargo-bootstrap/cargo-bootstrap.hash | 3 +++ package/cargo-bootstrap/cargo-bootstrap.mk | 14 ++++++++++++++ 3 files changed, 18 insertions(+) create mode 100644 package/cargo-bootstrap/cargo-bootstrap.hash create mode 100644 package/cargo-bootstrap/cargo-bootstrap.mk
DEVELOPERS +1 -0
@@ -487,6 +487,7 @@ F: package/xxhash/ N: Eric Le Bihan <[email protected]> F: package/adwaita-icon-theme/ +F: package/cargo-bootstrap/ F: package/darkhttpd/ F: package/eudev/ F: package/execline/
package/cargo-bootstrap/cargo-bootstrap.hash new file +3 -0
@@ -0,0 +1,3 @@ +# Locally generated +sha256 24d5e01b09ba0fb15c4b7ef4f527aca874ce2e0cebc3850fdc2535ac7e25b205 cargo-0.19.0-x86_64-unknown-linux-gnu.tar.gz +sha256 30ffc32615626b746cbdd2c34d79b3de8ae9889ae56ab33feed9c3a1b9c170fc cargo-0.19.0-i686-unknown-linux-gnu.tar.gz
package/cargo-bootstrap/cargo-bootstrap.mk new file +14 -0
@@ -0,0 +1,14 @@ +################################################################################ +# +# cargo-bootstrap +# +################################################################################ + +CARGO_BOOTSTRAP_VERSION = 0.19.0 +CARGO_BOOTSTRAP_SITE = https://static.rust-lang.org/dist/2017-06-08 +CARGO_BOOTSTRAP_SOURCE = cargo-$(CARGO_BOOTSTRAP_VERSION)-$(RUST_HOST_NAME).tar.gz +CARGO_BOOTSTRAP_LICENSE = Apache-2.0 or MIT +CARGO_BOOTSTRAP_LICENSE_FILES = LICENSE-APACHE LICENSE-MIT +CARGO_BOOTSTRAP_STRIP_COMPONENTS = 1 + +$(eval $(host-generic-package))
Signature · 1 line
2.9.4
PATCH v7 6/10 rust: new package
In reply to Eric Le BihanThis new package provides rustc, the compiler for the Rust programming language, built from source.
Currently, only the host variant is built.
The Rust compiler uses LLVM as its backend: a copy of LLVM source code is provided and CMake is used to build it. It is possible to use a pre-built external copy. When LLVM/clang will be available in Buildroot, it would be possible to benefit from this feature and thus decrease build time.
LLVM is configured to generate code for x86, ARM, PowerPC and MIPS architectures.
The Rust compiler uses Cargo as its build system and is written in Rust. Therefore this package depends on cargo-bootstrap and rust-bootstrap.
The internal build process is as follows:
1. rustc-stage0, provided by rust-bootstrap, is used to build rustc-stage1.
2. rust-stage1 builds the final Rust compiler (rust-stage2) and the standard library for the host architecture.
3. the standard library for the target architecture is built.
The target architecture to support is given by the GNU/LLVM target triple. Rust supports some predefined targets [1]. As the build system expects the triple to be in the form of <arch>-unknown-<system> and Buildroot toolchain wrapper uses <arch>-buildroot-<system>, the package Makefile uses $(RUST_TARGET_NAME) defined in the rustc package and uses it instead of $(GNU_TARGET_NAME).
When compiling Rust code with this compiler, the generated program only depends on the target C library, as it is statically linked to the Rust standard library and any other code from Rust packages (a.k.a. "crates").
If the jemalloc package is selected, support for this memory allocator will be enabled in the target standard library.
The menuconfig entry for rustc is also updated to expose this provider.
[1] https://forge.rust-lang.org/platform-support.html
--- DEVELOPERS | 1 + package/rust/rust.hash | 2 ++ package/rust/rust.mk | 78 ++++++++++++++++++++++++++++++++++++++++++++ package/rustc/Config.in.host | 15 +++++++++ 4 files changed, 96 insertions(+) create mode 100644 package/rust/rust.hash create mode 100644 package/rust/rust.mk
DEVELOPERS +1 -0
@@ -496,6 +496,7 @@ F: package/jemalloc/ F: package/ninja/ F: package/rust-bin/ F: package/rust-bootstrap/ +F: package/rust/ F: package/s6/ F: package/s6-dns/ F: package/s6-linux-init/
package/rust/rust.hash new file +2 -0
@@ -0,0 +1,2 @@ +# Locally generated +sha256 392148ab52db6299c46df6f48f066b7bdf9a7af9775fb05571984ff500f7f9ad rustc-1.19.0-src.tar.xz
package/rust/rust.mk new file +78 -0
78 lines not on this page · raw message
package/rustc/Config.in.host +15 -0
@@ -26,6 +26,20 @@ choice help Choose a provider for the Rust compiler. +config BR2_PACKAGE_HOST_RUST + bool "host rust" + depends on BR2_HOST_GCC_AT_LEAST_4_7 # required by LLVM + # triggers ICE on trunc_int_for_mode, at explow.c:56 + depends on BR2_TOOLCHAIN_GCC_AT_LEAST_5 || !BR2_aarch64 + select BR2_PACKAGE_HAS_HOST_RUSTC + help + This package will build the compiler for the host as well as + a cross-compiled version of the Rust standard library for the + target. + +comment "host-rust needs a toolchain w/ gcc >= 5" + depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_5 && BR2_aarch64 + config BR2_PACKAGE_HOST_RUST_BIN bool "host rust (pre-built)" select BR2_PACKAGE_HAS_HOST_RUSTC
@@ -40,6 +54,7 @@ config BR2_PACKAGE_HAS_HOST_RUSTC config BR2_PACKAGE_PROVIDES_HOST_RUSTC string + default "host-rust" if BR2_PACKAGE_HOST_RUST default "host-rust-bin" if BR2_PACKAGE_HOST_RUST_BIN endif
Signature · 1 line
2.9.4
PATCH v7 6/10 rust: new package
Quoted 17 lines · Eric Le Bihan
This new package provides rustc, the compiler for the Rust programming language, built from source.
Currently, only the host variant is built.
The Rust compiler uses LLVM as its backend: a copy of LLVM source code is provided and CMake is used to build it. It is possible to use a pre-built external copy. When LLVM/clang will be available in Buildroot, it would be possible to benefit from this feature and thus decrease build time.
LLVM is configured to generate code for x86, ARM, PowerPC and MIPS architectures.
The Rust compiler uses Cargo as its build system and is written in Rust. Therefore this package depends on cargo-bootstrap and rust-bootstrap.
Quoted 6 lines
The internal build process is as follows:
1. rustc-stage0, provided by rust-bootstrap, is used to build rustc-stage1.
2. rust-stage1 builds the final Rust compiler (rust-stage2) and the standard library for the host architecture.
If rust-bootstrap is replaced by host-rustc-bin, then I think we could jump
directly to stage2, right?
Quoted 1 line
3. the standard library for the target architecture is built.
And the source of the standard library is included in rustc-src.tar.xz, right?
So adding a rust-std package doesn't make much sense, I guess, only rust-std-bin.
[snip]
package/rust/rust.mk line 37
Quoted 6 lines
package/rust/rust.mk new file +6
-0+define HOST_RUST_CONFIGURE_CMDS + (cd $(@D); \ + echo '[build]' > config.toml; \ + echo 'target = ["$(RUST_TARGET_NAME)"]' >> config.toml; \ + echo 'cargo = "$(HOST_CARGO_BOOTSTRAP_DIR)/cargo/bin/cargo"' >> config.toml; \ + echo 'rustc = "$(HOST_RUST_BOOTSTRAP_DIR)/rustc/bin/rustc"' >> config.toml; \
Is it really necessary to refer to the build directories? Can't we copy stuff
to HOST_DIR and use it from there?
package/rust/rust.mk line 38
Quoted 1 line
package/rust/rust.mk new file +1
-0+ echo 'python = "$(HOST_DIR)/bin/python2"' >> config.toml; \
The only reason to depend on host-python is because it needs python2 and not
python3, right? I think we should just add in dependencies.sh a check for python2 instead of just python, so we can avoid building host-python. Or does it need python2.7.x?
package/rust/rust.mk line 50
Quoted 12 lines
package/rust/rust.mk new file +12
-0+ echo 'submodules = false' >> config.toml; \ + echo 'vendor = true' >> config.toml; \ + echo 'compiler-docs = false' >> config.toml; \ + echo 'docs = false' >> config.toml; \ + echo 'verbose = $(HOST_RUST_VERBOSITY)' >> config.toml; \ + echo '[install]' >> config.toml; \ + echo 'prefix = "$(HOST_DIR)"' >> config.toml; \ + echo '[rust]' >> config.toml; \ + echo 'use-jemalloc = $(HOST_RUST_JEMALLOC_ENABLED)' >> config.toml; \ + echo '[target.$(RUST_TARGET_NAME)]' >> config.toml; \ + echo 'cc = "$(TARGET_CROSS)gcc"' >> config.toml; \ + echo 'cxx = "$(TARGET_CROSS)g++"' >> config.toml; \
Doesn't rust/llvm have a way to specify the target CPU? Target optimisation
options? Floating point?
package/rust/rust.mk line 52
Quoted 2 lines
package/rust/rust.mk new file +2
-0+ echo $(HOST_RUST_JEMALLOC_CONF) >> config.toml; \ + )
All these lines are quite ugly... Could be de-uglified a little bit by
putting a single redirect after the closing )
package/rust/rust.mk line 56
Quoted 4 lines
package/rust/rust.mk new file +4
-0+endef + +define HOST_RUST_BUILD_CMDS + (cd $(@D); $(HOST_MAKE_ENV) $(HOST_RUST_MAKE_ENV) python2 x.py \
^^^^^^^
Make that an explicit
$(HOST_DIR)/bin/python2
HOST_RUST_MAKE_ENV is never assigned to, right?
package/rust/rust.mk line 65
Quoted 9 lines
package/rust/rust.mk new file +9
-0+ build $(HOST_RUST_BUILD_OPTS)) +endef + +define HOST_RUST_INSTALL_LIBSTD_TARGET + (cd $(@D)/build/tmp/dist/rust-std-$(RUST_VERSION)-dev-$(RUST_TARGET_NAME); \ + ./install.sh \ + --prefix=$(HOST_DIR) \ + --docdir=$(HOST_DIR)/share/doc/rust \ + --libdir=$(HOST_DIR)/lib \
So both the host and the target stdlib will go here? What if the host is a
corei7 and target is atom?
package/rust/rust.mk line 75
Quoted 10 lines
package/rust/rust.mk new file +10
-0+ --mandir=$(HOST_DIR)/share/man \ + --disable-ldconfig) +endef + +define HOST_RUST_INSTALL_CMDS + (cd $(@D); $(HOST_MAKE_ENV) $(HOST_RUST_MAKE_ENV) python2 x.py \ + dist $(HOST_RUST_BUILD_OPTS)) + (cd $(@D); $(HOST_MAKE_ENV) $(HOST_RUST_MAKE_ENV) python2 x.py \ + install $(HOST_RUST_BUILD_OPTS)) + $(HOST_RUST_INSTALL_LIBSTD_TARGET)
So, "install" doesn't actually install it, it just puts stuff in
build/tmp/dist/... ? Isn't there a way to tell it to put stuff directly into HOST_DIR?
Quoted 14 lines
package/rust/rust.mk new file +3
-0+endef + +$(eval $(host-generic-package))package/rustc/Config.in.host +3
-0@@ -26,6 +26,20 @@ choice help Choose a provider for the Rust compiler. +config BR2_PACKAGE_HOST_RUST + bool "host rust" + depends on BR2_HOST_GCC_AT_LEAST_4_7 # required by LLVM
package/rustc/Config.in.host choice · line 41
Quoted 10 lines
package/rustc/Config.in.host +10
-0+ # triggers ICE on trunc_int_for_mode, at explow.c:56 + depends on BR2_TOOLCHAIN_GCC_AT_LEAST_5 || !BR2_aarch64 + select BR2_PACKAGE_HAS_HOST_RUSTC + help + This package will build the compiler for the host as well as + a cross-compiled version of the Rust standard library for the + target. + +comment "host-rust needs a toolchain w/ gcc >= 5" + depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_5 && BR2_aarch64
Split in two lines:
depends on BR2_aarch64
depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_5
Regards,
Arnout
Quoted 13 lines
package/rustc/Config.in.host +2
-0+ config BR2_PACKAGE_HOST_RUST_BIN bool "host rust (pre-built)" select BR2_PACKAGE_HAS_HOST_RUSTC@@ -40,6 +54,7 @@ config BR2_PACKAGE_HAS_HOST_RUSTC config BR2_PACKAGE_PROVIDES_HOST_RUSTC string + default "host-rust" if BR2_PACKAGE_HOST_RUST default "host-rust-bin" if BR2_PACKAGE_HOST_RUST_BIN endif
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH v7 6/10 rust: new package
Hi!
Quoted 22 lines · Arnout Vandecappelle
Quoted 19 lines · Eric Le Bihan
This new package provides rustc, the compiler for the Rust programming language, built from source.
Currently, only the host variant is built.
The Rust compiler uses LLVM as its backend: a copy of LLVM source code is provided and CMake is used to build it. It is possible to use a pre-built external copy. When LLVM/clang will be available in Buildroot, it would be possible to benefit from this feature and thus decrease build time.
LLVM is configured to generate code for x86, ARM, PowerPC and MIPS architectures.
The Rust compiler uses Cargo as its build system and is written in Rust. Therefore this package depends on cargo-bootstrap and rust-bootstrap.
The internal build process is as follows:
Quoted 7 lines
Quoted 4 lines
1. rustc-stage0, provided by rust-bootstrap, is used to build rustc-stage1.
2. rust-stage1 builds the final Rust compiler (rust-stage2) and the standard library for the host architecture.If rust-bootstrap is replaced by host-rustc-bin, then I think we could jump
directly to stage2, right?
AFAIK, I do not think so.
Quoted 3 lines
Quoted 1 line
3. the standard library for the target architecture is built.
And the source of the standard library is included in rustc-src.tar.xz, right?
Yes.
Quoted 1 line
So adding a rust-std package doesn't make much sense, I guess, only rust-std-bin.
As suggested previously, how about a rust-std virtual package? host-rust would provide host-rustc and host-rust-std.
Quoted 10 lines
[snip]
package/rust/rust.mk line 37
Quoted 6 lines
package/rust/rust.mk new file +6
-0+define HOST_RUST_CONFIGURE_CMDS + (cd $(@D); \ + echo '[build]' > config.toml; \ + echo 'target = ["$(RUST_TARGET_NAME)"]' >> config.toml; \ + echo 'cargo = "$(HOST_CARGO_BOOTSTRAP_DIR)/cargo/bin/cargo"' >> config.toml; \ + echo 'rustc = "$(HOST_RUST_BOOTSTRAP_DIR)/rustc/bin/rustc"' >> config.toml; \Is it really necessary to refer to the build directories? Can't we copy stuff
toHOST_DIRand use it from there?
IHMO, these bootstrap binaries are "disposable" and not worth ending up in $(HOST_DIR)/bin, hence the reference to the build directories. If they do land in $(HOST_DIR)/bin, then they should be renamed to {cargo,rustc}-bootstrap. Would it not confuse the user to have some many versions of rustc/cargo in $(HOST_DIR)/bin?
Quoted 6 lines
package/rust/rust.mk line 38
Quoted 1 line
package/rust/rust.mk new file +1
-0+ echo 'python = "$(HOST_DIR)/bin/python2"' >> config.toml; \The only reason to depend on host-python is because it needs python2 and not
python3, right? I think we should just add independencies.sha check for python2 instead of just python, so we can avoid building host-python. Or does it need python2.7.x?
The Python code looks compatible with Python 3.x. Needs some testing though.
Quoted 7 lines
Quoted 7 lines
package/rust/rust.mk new file +7
-0+ echo 'submodules = false' >> config.toml; \ + echo 'vendor = true' >> config.toml; \ + echo 'compiler-docs = false' >> config.toml; \ + echo 'docs = false' >> config.toml; \ + echo 'verbose = $(HOST_RUST_VERBOSITY)' >> config.toml; \ + echo '[install]' >> config.toml; \ + echo 'prefix = "$(HOST_DIR)"' >> config.toml; \
Quoted 8 lines
package/rust/rust.mk line 50
Quoted 5 lines
package/rust/rust.mk new file +5
-0+ echo '[rust]' >> config.toml; \ + echo 'use-jemalloc = $(HOST_RUST_JEMALLOC_ENABLED)' >> config.toml; \ + echo '[target.$(RUST_TARGET_NAME)]' >> config.toml; \ + echo 'cc = "$(TARGET_CROSS)gcc"' >> config.toml; \ + echo 'cxx = "$(TARGET_CROSS)g++"' >> config.toml; \Doesn't
rust/llvmhave a way to specify the target CPU? Target optimisation
options? Floating point?
I'll see if there are some options for this.
Quoted 5 lines
package/rust/rust.mk line 52
Quoted 2 lines
package/rust/rust.mk new file +2
-0+ echo $(HOST_RUST_JEMALLOC_CONF) >> config.toml; \ + )All these lines are quite ugly... Could be de-uglified a little bit by
putting a single redirect after the closing )
Will do!
Quoted 7 lines
package/rust/rust.mk line 56
Quoted 4 lines
package/rust/rust.mk new file +4
-0+endef + +define HOST_RUST_BUILD_CMDS + (cd $(@D); $(HOST_MAKE_ENV) $(HOST_RUST_MAKE_ENV) python2 x.py \^^^^^^^
Make that an explicit
$(HOST_DIR)/bin/python2
OK.
Quoted 1 line
HOST_RUST_MAKE_ENVis never assigned to, right?
Yes. It is useless. I will remove it.
Quoted 4 lines
Quoted 4 lines
package/rust/rust.mk new file +4
-0+ build $(HOST_RUST_BUILD_OPTS)) +endef + +define HOST_RUST_INSTALL_LIBSTD_TARGET
Quoted 8 lines
package/rust/rust.mk line 65
Quoted 5 lines
package/rust/rust.mk new file +5
-0+ (cd $(@D)/build/tmp/dist/rust-std-$(RUST_VERSION)-dev-$(RUST_TARGET_NAME); \ + ./install.sh \ + --prefix=$(HOST_DIR) \ + --docdir=$(HOST_DIR)/share/doc/rust \ + --libdir=$(HOST_DIR)/lib \So both the host and the target stdlib will go here? What if the host is a
corei7 and target is atom?
Yes, I should handle the case where $(HOSTARCH) == $(ARCH).
Quoted 6 lines
Quoted 6 lines
package/rust/rust.mk new file +6
-0+ --mandir=$(HOST_DIR)/share/man \ + --disable-ldconfig) +endef + +define HOST_RUST_INSTALL_CMDS + (cd $(@D); $(HOST_MAKE_ENV) $(HOST_RUST_MAKE_ENV) python2 x.py \
Quoted 8 lines
package/rust/rust.mk line 75
Quoted 4 lines
package/rust/rust.mk new file +4
-0+ dist $(HOST_RUST_BUILD_OPTS)) + (cd $(@D); $(HOST_MAKE_ENV) $(HOST_RUST_MAKE_ENV) python2 x.py \ + install $(HOST_RUST_BUILD_OPTS)) + $(HOST_RUST_INSTALL_LIBSTD_TARGET)So, "install" doesn't actually install it, it just puts stuff in
build/tmp/dist/... ? Isn't there a way to tell it to put stuff directly intoHOST_DIR?
The dist command generates the install.sh scripts that are called by the install command.
Quoted 27 lines
Quoted 14 lines
package/rust/rust.mk new file +3
-0+endef + +$(eval $(host-generic-package))package/rustc/Config.in.host +3
-0@@ -26,6 +26,20 @@ choice help Choose a provider for the Rust compiler. +config BR2_PACKAGE_HOST_RUST + bool "host rust" + depends on BR2_HOST_GCC_AT_LEAST_4_7 # required by LLVMpackage/rustc/Config.in.host choice · line 41
Quoted 10 lines
package/rustc/Config.in.host +10
-0+ # triggers ICE on trunc_int_for_mode, at explow.c:56 + depends on BR2_TOOLCHAIN_GCC_AT_LEAST_5 || !BR2_aarch64 + select BR2_PACKAGE_HAS_HOST_RUSTC + help + This package will build the compiler for the host as well as + a cross-compiled version of the Rust standard library for the + target. + +comment "host-rust needs a toolchain w/ gcc >= 5" + depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_5 && BR2_aarch64Split in two lines:
Quoted 2 lines
depends on
BR2_aarch64
depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_5
OK.
--
ELB
PATCH v7 7/10 libssh2: add host variant
In reply to Eric Le BihanAllow build of host variant of libssh2, which depends on host-openssl.
--- package/libssh2/libssh2.mk | 6 ++++++ 1 file changed, 6 insertions(+)
package/libssh2/libssh2.mk +6 -0
@@ -40,4 +40,10 @@ else LIBSSH2_CONF_OPTS += --without-libz endif +HOST_LIBSSH2_DEPENDENCIES += host-openssl +HOST_LIBSSH2_CONF_OPTS += --with-openssl \ + --with-libssl-prefix=$(HOST_DIR)/usr \ + --without-libgcrypt + $(eval $(autotools-package)) +$(eval $(host-autotools-package))
Signature · 1 line
2.9.4
PATCH v7 7/10 libssh2: add host variant
Hi Eric,
Quoted 12 lines · Eric Le Bihan
Allow build of host variant of libssh2, which depends on host-openssl.
Signed-off-by Eric Le Bihan <[email protected]>--- package/libssh2/libssh2.mk | 6 ++++++ 1 file changed, 6 insertions(+)package/libssh2/libssh2.mk +0
-0
package/libssh2/libssh2.mk else · line 46
Quoted 7 lines
package/libssh2/libssh2.mk +4
-0@@ -40,4 +40,10 @@ else LIBSSH2_CONF_OPTS += --without-libz endif +HOST_LIBSSH2_DEPENDENCIES += host-openssl +HOST_LIBSSH2_CONF_OPTS += --with-openssl \ + --with-libssl-prefix=$(HOST_DIR)/usr \ + --without-libgcrypt
You should probably also add --without-mbedtls.
baruch
Quoted 3 lines
package/libssh2/libssh2.mk +2
-0+ $(eval $(autotools-package)) +$(eval $(host-autotools-package))
Signature · 3 lines
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -PATCH v7 7/10 libssh2: add host variant
Quoted 18 lines · Baruch Siach
Hi Eric,
Quoted 15 lines · Eric Le Bihan
Allow build of host variant of libssh2, which depends on host-openssl.
Signed-off-by Eric Le Bihan <[email protected]>--- package/libssh2/libssh2.mk | 6 ++++++ 1 file changed, 6 insertions(+)package/libssh2/libssh2.mk +0
-0@@ -40,4 +40,10 @@ else LIBSSH2_CONF_OPTS += --without-libz endif
Quoted 2 lines
package/libssh2/libssh2.mk else · line 44
Quoted 2 lines
package/libssh2/libssh2.mk +2
-0+HOST_LIBSSH2_DEPENDENCIES += host-openssl +HOST_LIBSSH2_CONF_OPTS += --with-openssl \
If you use one line per option, leave the first one empty:
HOST_LIBSSH2_CONF_OPTS += \ --with-openssl \ ...
Quoted 4 lines
package/libssh2/libssh2.mk else · line 46
Quoted 2 lines
package/libssh2/libssh2.mk +2
-0+ --with-libssl-prefix=$(HOST_DIR)/usr \ + --without-libgcryptYou should probably also add --without-mbedtls.
And --without-libz --disable-examples-build
Regards,
Arnout
Quoted 7 lines
baruch
Quoted 3 lines
package/libssh2/libssh2.mk +2
-0+ $(eval $(autotools-package)) +$(eval $(host-autotools-package))
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH v7 8/10 libhttpparser: add host variant
In reply to Eric Le BihanAllow build of host variant of libhttpparser.
--- package/libhttpparser/libhttpparser.mk | 9 +++++++++ 1 file changed, 9 insertions(+)
package/libhttpparser/libhttpparser.mk +9 -0
@@ -23,4 +23,13 @@ define LIBHTTPPARSER_INSTALL_TARGET_CMDS $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) PREFIX=$(TARGET_DIR)/usr install endef +define HOST_LIBHTTPPARSER_BUILD_CMDS + $(MAKE) $(HOST_CONFIGURE_OPTS) -C $(@D) library package +endef + +define HOST_LIBHTTPPARSER_INSTALL_CMDS + $(MAKE) $(HOST_CONFIGURE_OPTS) -C $(@D) PREFIX=$(HOST_DIR)/usr install +endef + $(eval $(generic-package)) +$(eval $(host-generic-package))
Signature · 1 line
2.9.4
PATCH v7 8/10 libhttpparser: add host variant
Quoted 12 lines · Eric Le Bihan
Allow build of host variant of libhttpparser.
Signed-off-by Eric Le Bihan <[email protected]>--- package/libhttpparser/libhttpparser.mk | 9 +++++++++ 1 file changed, 9 insertions(+)package/libhttpparser/libhttpparser.mk +0
-0
package/libhttpparser/libhttpparser.mk define LIBHTTPPARSER_INSTALL_TARGET_CMDS · line 31
Quoted 9 lines
package/libhttpparser/libhttpparser.mk +6
-0@@ -23,4 +23,13 @@ define LIBHTTPPARSER_INSTALL_TARGET_CMDS $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) PREFIX=$(TARGET_DIR)/usr install endef +define HOST_LIBHTTPPARSER_BUILD_CMDS + $(MAKE) $(HOST_CONFIGURE_OPTS) -C $(@D) library package +endef + +define HOST_LIBHTTPPARSER_INSTALL_CMDS + $(MAKE) $(HOST_CONFIGURE_OPTS) -C $(@D) PREFIX=$(HOST_DIR)/usr install
/usr is gone.
Regards,
Arnout
Quoted 5 lines
package/libhttpparser/libhttpparser.mk +3
-0+endef + $(eval $(generic-package)) +$(eval $(host-generic-package))
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH v7 9/10 libcurl: add host variant
In reply to Eric Le Bihan--- package/libcurl/libcurl.mk | 3 +++ 1 file changed, 3 insertions(+)
package/libcurl/libcurl.mk +3 -0
@@ -82,4 +82,7 @@ endef LIBCURL_POST_INSTALL_TARGET_HOOKS += LIBCURL_TARGET_CLEANUP endif +HOST_LIBCURL_DEPENDENCIES = host-openssl + $(eval $(autotools-package)) +$(eval $(host-autotools-package))
Signature · 1 line
2.9.4
PATCH v7 9/10 libcurl: add host variant
Quoted 10 lines · Eric Le Bihan
Signed-off-by Eric Le Bihan <[email protected]>--- package/libcurl/libcurl.mk | 3 +++ 1 file changed, 3 insertions(+)package/libcurl/libcurl.mk +0
-0
package/libcurl/libcurl.mk endef · line 85
Quoted 4 lines
package/libcurl/libcurl.mk +1
-0@@ -82,4 +82,7 @@ endef LIBCURL_POST_INSTALL_TARGET_HOOKS += LIBCURL_TARGET_CLEANUP endif +HOST_LIBCURL_DEPENDENCIES = host-openssl
You also want HOST_LIBCURL_CONF_OPTS which disables as much as possible.
You probably also want LIBCURL_FIX_DOT_PC.
Regards,
Arnout
Quoted 4 lines
package/libcurl/libcurl.mk +2
-0+ $(eval $(autotools-package)) +$(eval $(host-autotools-package))
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH v7 10/10 cargo: new package
In reply to Eric Le BihanThis new package provides Cargo, the Rust official package manager. Cargo is written in Rust and uses Cargo as its build system. It also depends on other Rust packages.
Normally, a previously installed version of Cargo would be used to:
1. Fetch the dependencies.
2. Build the new version of Cargo, using the available Rust compiler.
But the fetching step prevents offline builds. So instead two features of Cargo are levelled: vendoring [1] and local registry.
First, a tarball of the build dependencies generated using cargo vendor is fetched along with Cargo source code.
Then, the build process is as follows:
1. The tarball of the build dependencies is uncompressed in a local registry.
2. A snapshot of Cargo, provided by cargo-bootstrap, builds the final version of Cargo.
3. A configuration file telling Cargo how to cross-compile programs for the target is generated and installed.
Currently, only the host variant is provided.
[1] https://github.com/alexcrichton/cargo-vendor
--- DEVELOPERS | 1 + package/Config.in.host | 1 + package/cargo/Config.in.host | 8 ++++ package/cargo/cargo.hash | 4 ++ package/cargo/cargo.in | 2 + package/cargo/cargo.mk | 112 +++++++++++++++++++++++++++++++++++++++++++ package/cargo/config.in | 2 + 7 files changed, 130 insertions(+) create mode 100644 package/cargo/Config.in.host create mode 100644 package/cargo/cargo.hash create mode 100644 package/cargo/cargo.in create mode 100644 package/cargo/cargo.mk create mode 100644 package/cargo/config.in
DEVELOPERS +1 -0
@@ -488,6 +488,7 @@ F: package/xxhash/ N: Eric Le Bihan <[email protected]> F: package/adwaita-icon-theme/ F: package/cargo-bootstrap/ +F: package/cargo/ F: package/darkhttpd/ F: package/eudev/ F: package/execline/
package/Config.in.host +1 -0
@@ -2,6 +2,7 @@ menu "Host utilities" source "package/aespipe/Config.in.host" source "package/android-tools/Config.in.host" + source "package/cargo/Config.in.host" source "package/cbootimage/Config.in.host" source "package/checkpolicy/Config.in.host" source "package/cramfs/Config.in.host"
package/cargo/Config.in.host new file +8 -0
@@ -0,0 +1,8 @@ +config BR2_PACKAGE_HOST_CARGO + bool "host cargo" + depends on BR2_PACKAGE_HAS_HOST_RUSTC + help + Cargo is the package manager for the Rust programming + language. + + https://crates.io/
package/cargo/cargo.hash new file +4 -0
@@ -0,0 +1,4 @@ +# Locally generated +sha256 f0e21d23cffd3510ba8a65e6a4d1010073afc0e573d9d92c23d22b868ca0bc42 cargo-0.20.0.tar.gz +sha512 0e44ff3fd9c74c595220ea9a53867457cafa797302d0591ddf5f8f02ad021273d012413b45398799700eea9ae471804412fde4525406c5eb5b6f4b69e93594ed cargo-0.20.0-vendor.tar.xz +sha256 dc7240d60a869fa24a68c8734fb7c810c27cca0a6dad52df6279865e4e8e7fae rust-installer-4f994850808a572e2cc8d43f968893c8e942e9bf.tar.gz
package/cargo/cargo.in new file +2 -0
@@ -0,0 +1,2 @@ +#!/bin/sh +LD_LIBRARY_PATH=@HOST_DIR@/lib exec $(dirname $0)/cargo.real "$@"
package/cargo/cargo.mk new file +112 -0
112 lines not on this page · raw message
package/cargo/config.in new file +2 -0
@@ -0,0 +1,2 @@ +[target. at RUST_TARGET_NAME@] +linker = "@CROSS_PREFIX at gcc"
Signature · 1 line
2.9.4
PATCH v7 10/10 cargo: new package
I didn't do a thorough review of this one...
Quoted 3 lines · Eric Le Bihan
This new package provides Cargo, the Rust official package manager. Cargo is written in Rust and uses Cargo as its build system. It also depends on other Rust packages.
Since we already have cargo-bootstrap anyway, could we do the same as for
rustc, and have a cargo-bin instead of cargo-bootstrap package that the user could select directly? Or is the binary version never going to be adequate for real use?
Quoted 20 lines
Normally, a previously installed version of Cargo would be used to:
1. Fetch the dependencies.
2. Build the new version of Cargo, using the available Rust compiler.But the fetching step prevents offline builds. So instead two features of Cargo are levelled: vendoring [1] and local registry.
First, a tarball of the build dependencies generated using
cargo vendoris fetched along with Cargo source code.Then, the build process is as follows:
1. The tarball of the build dependencies is uncompressed in a local registry.
2. A snapshot of Cargo, provided by cargo-bootstrap, builds the final version of Cargo.
3. A configuration file telling Cargo how to cross-compile programs for the target is generated and installed.
[snip]
package/cargo/cargo.mk line 13
Quoted 7 lines
package/cargo/cargo.mk new file +7
-0+CARGO_VERSION = 0.20.0 +CARGO_SITE = $(call github,rust-lang,cargo,$(CARGO_VERSION)) +CARGO_LICENSE = Apache-2.0 or MIT +CARGO_LICENSE_FILES = LICENSE-APACHE LICENSE-MIT + +CARGO_DEPS_SITE = http://pkgs.fedoraproject.org/repo/pkgs/cargo/$(CARGO_DEPS_SOURCE)/sha512/$(CARGO_DEPS_SHA512) +CARGO_DEPS_SHA512 = 0e44ff3fd9c74c595220ea9a53867457cafa797302d0591ddf5f8f02ad021273d012413b45398799700eea9ae471804412fde4525406c5eb5b6f4b69e93594ed
Swap these two lines.
It would also be good to explain what this is, and why it can't be a separate
package (but maybe it could be a separate package?), and why we fetch from Fedora instead of crates.io.
package/cargo/cargo.mk line 17
Quoted 4 lines
package/cargo/cargo.mk new file +4
-0+CARGO_DEPS_SOURCE = cargo-$(CARGO_VERSION)-vendor.tar.xz + +CARGO_INSTALLER_VERSION = 4f994850808a572e2cc8d43f968893c8e942e9bf +CARGO_INSTALLER_SITE = https://github.com/rust-lang/rust-installer/archive/$(CARGO_INSTALLER_VERSION)
github helper?
Quoted 50 lines
package/cargo/cargo.mk new file +50
-0+CARGO_INSTALLER_SOURCE = rust-installer-$(CARGO_INSTALLER_VERSION).tar.gz + +HOST_CARGO_EXTRA_DOWNLOADS = \ + $(CARGO_DEPS_SITE)/$(CARGO_DEPS_SOURCE) \ + $(CARGO_INSTALLER_SITE)/$(CARGO_INSTALLER_SOURCE) + +HOST_CARGO_DEPENDENCIES = \ + host-cmake \ + host-pkgconf \ + host-openssl \ + host-libhttpparser \ + host-libssh2 \ + host-libcurl \ + host-rustc \ + host-cargo-bootstrap + +HOST_CARGO_SNAP_BIN = $(HOST_CARGO_BOOTSTRAP_DIR)/cargo/bin/cargo +HOST_CARGO_HOME = $(HOST_DIR)/share/cargo + +define HOST_CARGO_EXTRACT_DEPS + @mkdir -p $(@D)/vendor + $(call suitable-extractor,$(CARGO_DEPS_SOURCE)) \ + $(DL_DIR)/$(CARGO_DEPS_SOURCE) | \ + $(TAR) --strip-components=1 -C $(@D)/vendor $(TAR_OPTIONS) - +endef + +HOST_CARGO_POST_EXTRACT_HOOKS += HOST_CARGO_EXTRACT_DEPS + +define HOST_CARGO_EXTRACT_INSTALLER + @mkdir -p $(@D)/src/rust-installer + $(call suitable-extractor,$(CARGO_INSTALLER_SOURCE)) \ + $(DL_DIR)/$(CARGO_INSTALLER_SOURCE) | \ + $(TAR) --strip-components=1 -C $(@D)/src/rust-installer $(TAR_OPTIONS) - +endef + +HOST_CARGO_POST_EXTRACT_HOOKS += HOST_CARGO_EXTRACT_INSTALLER + +define HOST_CARGO_SETUP_DEPS + mkdir -p $(@D)/.cargo + (cd $(@D)/.cargo; \ + echo "[source.crates-io]" > config; \ + echo "registry = 'https://github.com/rust-lang/crates.io-index'" >> config; \ + echo "replace-with = 'vendored-sources'" >> config; \ + echo >> config; \ + echo "[source.vendored-sources]" >> config; \ + echo "directory = '$(@D)/vendor'" >> config; \ + ) +endef + +HOST_CARGO_PRE_CONFIGURE_HOOKS += HOST_CARGO_SETUP_DEPS
package/cargo/cargo.mk line 77
Quoted 10 lines
package/cargo/cargo.mk new file +10
-0+ +HOST_CARGO_SNAP_OPTS = --release +HOST_CARGO_SNAP_OPTS += $(if $(VERBOSE),--verbose) + +HOST_CARGO_ENV = \ + PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 \ + PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 \ + PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \ + PKG_CONFIG_SYSROOT_DIR="/" \ + PKG_CONFIG_LIBDIR="$(HOST_DIR)/lib/pkgconfig:$(HOST_DIR)/share/pkgconfig" \
How does this differ from HOST_MAKE_ENV?
Quoted 21 lines
package/cargo/cargo.mk new file +21
-0+ CARGO_HOME=$(HOST_DIR)/share/cargo + +define HOST_CARGO_BUILD_CMDS + (cd $(@D); $(HOST_MAKE_ENV) $(HOST_CARGO_ENV) $(HOST_CARGO_SNAP_BIN) \ + build $(HOST_CARGO_SNAP_OPTS)) +endef + +define HOST_CARGO_INSTALL_CMDS + $(INSTALL) -d -m 0755 $(HOST_DIR)/bin + $(INSTALL) -m 0755 $(@D)/target/release/cargo $(HOST_DIR)/bin/cargo +endef + +define HOST_CARGO_INSTALL_CONF_FILE + $(INSTALL) -D package/cargo/config.in \ + $(HOST_DIR)/share/cargo/config + $(SED) 's/@RUST_TARGET_NAME@/$(RUST_TARGET_NAME)/' \ + $(HOST_DIR)/share/cargo/config + $(SED) 's/@CROSS_PREFIX@/$(notdir $(TARGET_CROSS))/' \ + $(HOST_DIR)/share/cargo/config +endef +
package/cargo/cargo.mk line 108
Quoted 10 lines
package/cargo/cargo.mk new file +10
-0+HOST_CARGO_POST_INSTALL_HOOKS += HOST_CARGO_INSTALL_CONF_FILE + +# No *RPATH tag is set in the Cargo binary, so provide a wrapper to find the +# shared libraries +define HOST_CARGO_INSTALL_WRAPPER + mv $(HOST_DIR)/bin/cargo $(HOST_DIR)/bin/cargo.real + $(INSTALL) -m 0755 package/cargo/cargo.in \ + $(HOST_DIR)/bin/cargo + $(SED) 's;@HOST_DIR@;$(HOST_DIR);g' $(HOST_DIR)/bin/cargo +endef
Where are the shared libs installed? How come that the cargo binary from
cargo-bootstrap doesn't need this hack? How come the -Wl,-rpath,$(HOST_DIR)/lib we pass in HOST_LDFLAGS doesn't work? Possibly you just forgot to pass HOST_LDFLAGS?
Regards,
Arnout
Quoted 13 lines
package/cargo/cargo.mk new file +4
-0+ +HOST_CARGO_POST_INSTALL_HOOKS += HOST_CARGO_INSTALL_WRAPPER + +$(eval $(host-generic-package))package/cargo/config.in new file +2
-0@@ -0,0 +1,2 @@ +[target. at RUST_TARGET_NAME@] +linker = "@CROSS_PREFIX at gcc"
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH v7 10/10 cargo: new package
Hi!
Quoted 11 lines · Arnout Vandecappelle
I didn't do a thorough review of this one...
Quoted 3 lines · Eric Le Bihan
This new package provides Cargo, the Rust official package manager. Cargo is written in Rust and uses Cargo as its build system. It also depends on other Rust packages.
Since we already have cargo-bootstrap anyway, could we do the same as for
rustc, and have a cargo-bin instead of cargo-bootstrap package that the user could select directly? Or is the binary version never going to be adequate for real use?
Previously, the cargo bootstrap binary was not hosted on rust-lang.org, and looked like being disposable. Now it is hosted along with rustc and rust-std. It is a bigger than a compiled version, as it is statically linked against libcurl and libssh2. So AFAIK, cargo-boostrap could be converted to cargo-bin.
Quoted 32 lines
Quoted 20 lines
Normally, a previously installed version of Cargo would be used to:
1. Fetch the dependencies.
2. Build the new version of Cargo, using the available Rust compiler.But the fetching step prevents offline builds. So instead two features of Cargo are levelled: vendoring [1] and local registry.
First, a tarball of the build dependencies generated using
cargo vendoris fetched along with Cargo source code.Then, the build process is as follows:
1. The tarball of the build dependencies is uncompressed in a local registry.
2. A snapshot of Cargo, provided by cargo-bootstrap, builds the final version of Cargo.
3. A configuration file telling Cargo how to cross-compile programs for the target is generated and installed.[snip]
package/cargo/cargo.mk line 13
Quoted 7 lines
package/cargo/cargo.mk new file +7
-0+CARGO_VERSION = 0.20.0 +CARGO_SITE = $(call github,rust-lang,cargo,$(CARGO_VERSION)) +CARGO_LICENSE = Apache-2.0 or MIT +CARGO_LICENSE_FILES = LICENSE-APACHE LICENSE-MIT + +CARGO_DEPS_SITE = http://pkgs.fedoraproject.org/repo/pkgs/cargo/$(CARGO_DEPS_SOURCE)/sha512/$(CARGO_DEPS_SHA512) +CARGO_DEPS_SHA512 = 0e44ff3fd9c74c595220ea9a53867457cafa797302d0591ddf5f8f02ad021273d012413b45398799700eea9ae471804412fde4525406c5eb5b6f4b69e93594edSwap these two lines.
Quoted 3 lines
It would also be good to explain what this is, and why it can't be a separate
package (but maybe it could be a separate package?), and why we fetch from Fedora instead of crates.io.
Cargo depends on 97 crates from crates.io. IMHO, adding so many packages to Buildroot to build a host tool is not very sensible.
In a previous (unpublished) version of my cargo patch, I used a post-download hook to fetch the dependencies from crates.io and fill the local crate registry. But this does not fit for offline builds.
The cargo vendor command has been added to allow offline builds of Rust programs. Debian and Fedora have chosen to use an archive of the cargo vendor output, so I jumped on that train.
Quoted 6 lines
package/cargo/cargo.mk line 17
Quoted 4 lines
package/cargo/cargo.mk new file +4
-0+CARGO_DEPS_SOURCE = cargo-$(CARGO_VERSION)-vendor.tar.xz + +CARGO_INSTALLER_VERSION = 4f994850808a572e2cc8d43f968893c8e942e9bf +CARGO_INSTALLER_SITE = https://github.com/rust-lang/rust-installer/archive/$(CARGO_INSTALLER_VERSION)github helper?
Of course!
Quoted 54 lines
Quoted 54 lines
package/cargo/cargo.mk new file +54
-0+CARGO_INSTALLER_SOURCE = rust-installer-$(CARGO_INSTALLER_VERSION).tar.gz + +HOST_CARGO_EXTRA_DOWNLOADS = \ + $(CARGO_DEPS_SITE)/$(CARGO_DEPS_SOURCE) \ + $(CARGO_INSTALLER_SITE)/$(CARGO_INSTALLER_SOURCE) + +HOST_CARGO_DEPENDENCIES = \ + host-cmake \ + host-pkgconf \ + host-openssl \ + host-libhttpparser \ + host-libssh2 \ + host-libcurl \ + host-rustc \ + host-cargo-bootstrap + +HOST_CARGO_SNAP_BIN = $(HOST_CARGO_BOOTSTRAP_DIR)/cargo/bin/cargo +HOST_CARGO_HOME = $(HOST_DIR)/share/cargo + +define HOST_CARGO_EXTRACT_DEPS + @mkdir -p $(@D)/vendor + $(call suitable-extractor,$(CARGO_DEPS_SOURCE)) \ + $(DL_DIR)/$(CARGO_DEPS_SOURCE) | \ + $(TAR) --strip-components=1 -C $(@D)/vendor $(TAR_OPTIONS) - +endef + +HOST_CARGO_POST_EXTRACT_HOOKS += HOST_CARGO_EXTRACT_DEPS + +define HOST_CARGO_EXTRACT_INSTALLER + @mkdir -p $(@D)/src/rust-installer + $(call suitable-extractor,$(CARGO_INSTALLER_SOURCE)) \ + $(DL_DIR)/$(CARGO_INSTALLER_SOURCE) | \ + $(TAR) --strip-components=1 -C $(@D)/src/rust-installer $(TAR_OPTIONS) - +endef + +HOST_CARGO_POST_EXTRACT_HOOKS += HOST_CARGO_EXTRACT_INSTALLER + +define HOST_CARGO_SETUP_DEPS + mkdir -p $(@D)/.cargo + (cd $(@D)/.cargo; \ + echo "[source.crates-io]" > config; \ + echo "registry = 'https://github.com/rust-lang/crates.io-index'" >> config; \ + echo "replace-with = 'vendored-sources'" >> config; \ + echo >> config; \ + echo "[source.vendored-sources]" >> config; \ + echo "directory = '$(@D)/vendor'" >> config; \ + ) +endef + +HOST_CARGO_PRE_CONFIGURE_HOOKS += HOST_CARGO_SETUP_DEPS + +HOST_CARGO_SNAP_OPTS = --release +HOST_CARGO_SNAP_OPTS += $(if $(VERBOSE),--verbose) +
Quoted 8 lines
package/cargo/cargo.mk line 77
Quoted 6 lines
package/cargo/cargo.mk new file +6
-0+HOST_CARGO_ENV = \ + PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 \ + PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 \ + PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \ + PKG_CONFIG_SYSROOT_DIR="/" \ + PKG_CONFIG_LIBDIR="$(HOST_DIR)/lib/pkgconfig:$(HOST_DIR)/share/pkgconfig" \How does this differ from
HOST_MAKE_ENV?
Yes. The PKG_CONFIG* variables are redundant and can be removed.
Quoted 27 lines
Quoted 27 lines
package/cargo/cargo.mk new file +27
-0+ CARGO_HOME=$(HOST_DIR)/share/cargo + +define HOST_CARGO_BUILD_CMDS + (cd $(@D); $(HOST_MAKE_ENV) $(HOST_CARGO_ENV) $(HOST_CARGO_SNAP_BIN) \ + build $(HOST_CARGO_SNAP_OPTS)) +endef + +define HOST_CARGO_INSTALL_CMDS + $(INSTALL) -d -m 0755 $(HOST_DIR)/bin + $(INSTALL) -m 0755 $(@D)/target/release/cargo $(HOST_DIR)/bin/cargo +endef + +define HOST_CARGO_INSTALL_CONF_FILE + $(INSTALL) -D package/cargo/config.in \ + $(HOST_DIR)/share/cargo/config + $(SED) 's/@RUST_TARGET_NAME@/$(RUST_TARGET_NAME)/' \ + $(HOST_DIR)/share/cargo/config + $(SED) 's/@CROSS_PREFIX@/$(notdir $(TARGET_CROSS))/' \ + $(HOST_DIR)/share/cargo/config +endef + +HOST_CARGO_POST_INSTALL_HOOKS += HOST_CARGO_INSTALL_CONF_FILE + +# No *RPATH tag is set in the Cargo binary, so provide a wrapper to find the +# shared libraries +define HOST_CARGO_INSTALL_WRAPPER + mv $(HOST_DIR)/bin/cargo $(HOST_DIR)/bin/cargo.real
Quoted 8 lines
package/cargo/cargo.mk line 108
Quoted 4 lines
package/cargo/cargo.mk new file +4
-0+ $(INSTALL) -m 0755 package/cargo/cargo.in \ + $(HOST_DIR)/bin/cargo + $(SED) 's;@HOST_DIR@;$(HOST_DIR);g' $(HOST_DIR)/bin/cargo +endefWhere are the shared libs installed? How come that the cargo binary from
cargo-bootstrap doesn't need this hack? How come the -Wl,-rpath,$(HOST_DIR)/lib we pass inHOST_LDFLAGSdoesn't work? Possibly you just forgot to passHOST_LDFLAGS?
Cargo will need the shared libs for libcurl and libssh2. The binary from cargo-bootstrap is statically linked.
The build system does not handle LDFLAGS, but adding the following line to $(HOST_CARGO_ENV) does the trick and thus allow removing the wrapper:
RUSTFLAGS="-Clink-arg=-Wl,-rpath,$(HOST_DIR)/lib"
--
ELB
v7 cover Add support for the Rust programming language
In reply to Eric Le BihanHi Eric,
Quoted 2 lines · Eric Le Bihan
This series adds support for the Rust programming language by adding the following packages:
I commented on all patches, and marked all as Changes Requested in patchwork.
Regards,
Arnout
Quoted 8 lines
- rustc: a virtual package for the Rust compiler.
- rust-bin: provides a pre-built version of rustc.
- rust: builds rustc from source.
- cargo: builds Rust package manager from source.Both providers are able to cross-compile code for ARM, MIPS, PowerPC and
x86_64architectures. Only the host variants are provided.
[snip]
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
v7 cover Add support for the Rust programming language
Quoted 6 lines · Arnout Vandecappelle
Quoted 2 lines · Eric Le Bihan
This series adds support for the Rust programming language by adding the following packages:
I commented on all patches, and marked all as Changes Requested in patchwork.
Thanks for the review!
Best regards,
--
ELB