* [Buildroot] [Patch v7 01/10] rustc: new virtual package
2017-07-23 8:11 [Buildroot] [Patch v7 00/10] Add support for the Rust programming language Eric Le Bihan
@ 2017-07-23 8:11 ` Eric Le Bihan
2017-07-23 13:14 ` Jörg Krause
2017-08-10 22:34 ` Arnout Vandecappelle
2017-07-23 8:11 ` [Buildroot] [Patch v7 02/10] rust-bin: new package Eric Le Bihan
` (9 subsequent siblings)
10 siblings, 2 replies; 31+ messages in thread
From: Eric Le Bihan @ 2017-07-23 8:11 UTC (permalink / raw)
To: buildroot
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.
[1] http://rust-lang.org
Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
---
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
diff --git a/package/rustc/Config.in.host b/package/rustc/Config.in.host
new file mode 100644
index 0000000..fef78a7
--- /dev/null
+++ b/package/rustc/Config.in.host
@@ -0,0 +1,5 @@
+config BR2_PACKAGE_HAS_HOST_RUSTC
+ bool
+
+config BR2_PACKAGE_PROVIDES_HOST_RUSTC
+ string
diff --git a/package/rustc/rustc.mk b/package/rustc/rustc.mk
new file mode 100644
index 0000000..9bbe29f
--- /dev/null
+++ b/package/rustc/rustc.mk
@@ -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))
--
2.9.4
^ permalink raw reply related [flat|nested] 31+ messages in thread* [Buildroot] [Patch v7 01/10] rustc: new virtual package
2017-07-23 8:11 ` [Buildroot] [Patch v7 01/10] rustc: new virtual package Eric Le Bihan
@ 2017-07-23 13:14 ` Jörg Krause
2017-08-10 22:34 ` Arnout Vandecappelle
1 sibling, 0 replies; 31+ messages in thread
From: Jörg Krause @ 2017-07-23 13:14 UTC (permalink / raw)
To: buildroot
Hi Eric,
On Sun, 2017-07-23 at 10:11 +0200, Eric Le Bihan wrote:
> 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.
>
> [1] http://rust-lang.org
>
> Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
> ---
> 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
>
> diff --git a/package/rustc/Config.in.host b/package/rustc/Config.in.host
> new file mode 100644
> index 0000000..fef78a7
> --- /dev/null
> +++ b/package/rustc/Config.in.host
> @@ -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.
> diff --git a/package/rustc/rustc.mk b/package/rustc/rustc.mk
> new file mode 100644
> index 0000000..9bbe29f
> --- /dev/null
> +++ b/package/rustc/rustc.mk
> @@ -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))
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.
^ permalink raw reply [flat|nested] 31+ messages in thread
* [Buildroot] [Patch v7 01/10] rustc: new virtual package
2017-07-23 8:11 ` [Buildroot] [Patch v7 01/10] rustc: new virtual package Eric Le Bihan
2017-07-23 13:14 ` Jörg Krause
@ 2017-08-10 22:34 ` Arnout Vandecappelle
2017-09-07 17:02 ` Eric Le Bihan
1 sibling, 1 reply; 31+ messages in thread
From: Arnout Vandecappelle @ 2017-08-10 22:34 UTC (permalink / raw)
To: buildroot
On 23-07-17 10:11, Eric Le Bihan wrote:
[snip]
> +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 ?
> +
> +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
else
RUST_HOST_ARCH = $(HOSTARCH)
endif
Regards,
Arnout
> +endif
> +
> +RUST_HOST_NAME = $(RUST_HOST_ARCH)-unknown-linux-gnu
> +
> +$(eval $(host-virtual-package))
--
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
^ permalink raw reply [flat|nested] 31+ messages in thread
* [Buildroot] [Patch v7 01/10] rustc: new virtual package
2017-08-10 22:34 ` Arnout Vandecappelle
@ 2017-09-07 17:02 ` Eric Le Bihan
0 siblings, 0 replies; 31+ messages in thread
From: Eric Le Bihan @ 2017-09-07 17:02 UTC (permalink / raw)
To: buildroot
Hi!
On 17-08-11 00:34:43, Arnout Vandecappelle wrote:
>
>
> On 23-07-17 10:11, Eric Le Bihan wrote:
> [snip]
> > +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 ?
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.
>
>
> > +
> > +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.
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"
> Also, this is better expressed as
>
> ifeq ($(HOSTARCH),x86)
> RUST_HOST_ARCH = i686
> else
> RUST_HOST_ARCH = $(HOSTARCH)
> endif
OK.
Thanks for the review!
^ permalink raw reply [flat|nested] 31+ messages in thread
* [Buildroot] [Patch v7 02/10] rust-bin: new package
2017-07-23 8:11 [Buildroot] [Patch v7 00/10] Add support for the Rust programming language Eric Le Bihan
2017-07-23 8:11 ` [Buildroot] [Patch v7 01/10] rustc: new virtual package Eric Le Bihan
@ 2017-07-23 8:11 ` Eric Le Bihan
2017-07-23 13:44 ` Jörg Krause
` (2 more replies)
2017-07-23 8:11 ` [Buildroot] [Patch v7 03/10] rustc: expose host variant in menuconfig Eric Le Bihan
` (8 subsequent siblings)
10 siblings, 3 replies; 31+ messages in thread
From: Eric Le Bihan @ 2017-07-23 8:11 UTC (permalink / raw)
To: buildroot
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 <eric.le.bihan.dev@free.fr>
---
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
diff --git a/DEVELOPERS b/DEVELOPERS
index 0c22ffc..312b176 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -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/
diff --git a/package/rust-bin/rust-bin.hash b/package/rust-bin/rust-bin.hash
new file mode 100644
index 0000000..538f376
--- /dev/null
+++ b/package/rust-bin/rust-bin.hash
@@ -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
diff --git a/package/rust-bin/rust-bin.mk b/package/rust-bin/rust-bin.mk
new file mode 100644
index 0000000..900cc69
--- /dev/null
+++ b/package/rust-bin/rust-bin.mk
@@ -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))
diff --git a/package/rustc/Config.in.host b/package/rustc/Config.in.host
index fef78a7..7f2c276 100644
--- a/package/rustc/Config.in.host
+++ b/package/rustc/Config.in.host
@@ -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 \
+ || 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
+
+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.
+
+ 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)"
+ 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.
+
+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
+
--
2.9.4
^ permalink raw reply related [flat|nested] 31+ messages in thread* [Buildroot] [Patch v7 02/10] rust-bin: new package
2017-07-23 8:11 ` [Buildroot] [Patch v7 02/10] rust-bin: new package Eric Le Bihan
@ 2017-07-23 13:44 ` Jörg Krause
2017-07-23 14:00 ` Jörg Krause
2017-08-10 23:08 ` Arnout Vandecappelle
2 siblings, 0 replies; 31+ messages in thread
From: Jörg Krause @ 2017-07-23 13:44 UTC (permalink / raw)
To: buildroot
On Sun, 2017-07-23 at 10:11 +0200, Eric Le Bihan wrote:
> 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].
> 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 <eric.le.bihan.dev@free.fr>
> ---
> 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
>
> diff --git a/DEVELOPERS b/DEVELOPERS
> index 0c22ffc..312b176 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -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/
> diff --git a/package/rust-bin/rust-bin.hash b/package/rust-bin/rust-bin.hash
> new file mode 100644
> index 0000000..538f376
> --- /dev/null
> +++ b/package/rust-bin/rust-bin.hash
> @@ -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
> diff --git a/package/rust-bin/rust-bin.mk b/package/rust-bin/rust-bin.mk
> new file mode 100644
> index 0000000..900cc69
> --- /dev/null
> +++ b/package/rust-bin/rust-bin.mk
> @@ -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))
> diff --git a/package/rustc/Config.in.host b/package/rustc/Config.in.host
> index fef78a7..7f2c276 100644
> --- a/package/rustc/Config.in.host
> +++ b/package/rustc/Config.in.host
> @@ -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.
> + || 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.
> +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.
> +
> + 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?
> +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.
> +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
^ permalink raw reply [flat|nested] 31+ messages in thread* [Buildroot] [Patch v7 02/10] rust-bin: new package
2017-07-23 8:11 ` [Buildroot] [Patch v7 02/10] rust-bin: new package Eric Le Bihan
2017-07-23 13:44 ` Jörg Krause
@ 2017-07-23 14:00 ` Jörg Krause
2017-08-10 23:08 ` Arnout Vandecappelle
2 siblings, 0 replies; 31+ messages in thread
From: Jörg Krause @ 2017-07-23 14:00 UTC (permalink / raw)
To: buildroot
On Sun, 2017-07-23 at 10:11 +0200, Eric Le Bihan wrote:
> 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 <eric.le.bihan.dev@free.fr>
> ---
> 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
>
> diff --git a/DEVELOPERS b/DEVELOPERS
> index 0c22ffc..312b176 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -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/
> diff --git a/package/rust-bin/rust-bin.hash b/package/rust-bin/rust-bin.hash
> new file mode 100644
> index 0000000..538f376
> --- /dev/null
> +++ b/package/rust-bin/rust-bin.hash
> @@ -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
> diff --git a/package/rust-bin/rust-bin.mk b/package/rust-bin/rust-bin.mk
> new file mode 100644
> index 0000000..900cc69
> --- /dev/null
> +++ b/package/rust-bin/rust-bin.mk
> @@ -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))
> diff --git a/package/rustc/Config.in.host b/package/rustc/Config.in.host
> index fef78a7..7f2c276 100644
> --- a/package/rustc/Config.in.host
> +++ b/package/rustc/Config.in.host
> @@ -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 \
> + || 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
^ permalink raw reply [flat|nested] 31+ messages in thread* [Buildroot] [Patch v7 02/10] rust-bin: new package
2017-07-23 8:11 ` [Buildroot] [Patch v7 02/10] rust-bin: new package Eric Le Bihan
2017-07-23 13:44 ` Jörg Krause
2017-07-23 14:00 ` Jörg Krause
@ 2017-08-10 23:08 ` Arnout Vandecappelle
2017-09-07 18:13 ` Eric Le Bihan
2 siblings, 1 reply; 31+ messages in thread
From: Arnout Vandecappelle @ 2017-08-10 23:08 UTC (permalink / raw)
To: buildroot
On 23-07-17 10:11, Eric Le Bihan wrote:
[snip]
> +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?
> + $${exe} \
> + --prefix=$(HOST_DIR) \
> + --docdir=$(HOST_DIR)/share/doc/rust \
Would it be possible to avoid installing docs completely?
> + --libdir=$(HOST_DIR)/lib \
> + --mandir=$(HOST_DIR)/share/man \
Same here.
> + --disable-ldconfig; \
> + done
> +endef
> +
> +$(eval $(host-generic-package))
> diff --git a/package/rustc/Config.in.host b/package/rustc/Config.in.host
> index fef78a7..7f2c276 100644
> --- a/package/rustc/Config.in.host
> +++ b/package/rustc/Config.in.host
> @@ -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 \
> + || 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.
> +
> +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".
> +
> + 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)"
> + 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
> +
> +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
--
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
^ permalink raw reply [flat|nested] 31+ messages in thread* [Buildroot] [Patch v7 02/10] rust-bin: new package
2017-08-10 23:08 ` Arnout Vandecappelle
@ 2017-09-07 18:13 ` Eric Le Bihan
0 siblings, 0 replies; 31+ messages in thread
From: Eric Le Bihan @ 2017-09-07 18:13 UTC (permalink / raw)
To: buildroot
Hi!
On 17-08-11 01:08:01, Arnout Vandecappelle wrote:
>
>
> On 23-07-17 10:11, Eric Le Bihan wrote:
> [snip]
> > +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?
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.
> > + $${exe} \
> > + --prefix=$(HOST_DIR) \
> > + --docdir=$(HOST_DIR)/share/doc/rust \
>
> Would it be possible to avoid installing docs completely?
>
> > + --libdir=$(HOST_DIR)/lib \
> > + --mandir=$(HOST_DIR)/share/man \
>
> Same here.
In fact, only --prefix=$(HOST_DIR) is usefull. The others can be removed.
> > + --disable-ldconfig; \
> > + done
> > +endef
> > +
> > +$(eval $(host-generic-package))
> > diff --git a/package/rustc/Config.in.host b/package/rustc/Config.in.host
> > index fef78a7..7f2c276 100644
> > --- a/package/rustc/Config.in.host
> > +++ b/package/rustc/Config.in.host
> > @@ -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 \
> > + || 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.
OK. I'll move it to the patch declaring the virtual package.
> > +
> > +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.
> > +
> > + 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)"
> > + 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
^ permalink raw reply [flat|nested] 31+ messages in thread
* [Buildroot] [Patch v7 03/10] rustc: expose host variant in menuconfig
2017-07-23 8:11 [Buildroot] [Patch v7 00/10] Add support for the Rust programming language Eric Le Bihan
2017-07-23 8:11 ` [Buildroot] [Patch v7 01/10] rustc: new virtual package Eric Le Bihan
2017-07-23 8:11 ` [Buildroot] [Patch v7 02/10] rust-bin: new package Eric Le Bihan
@ 2017-07-23 8:11 ` Eric Le Bihan
2017-08-10 23:09 ` Arnout Vandecappelle
2017-07-23 8:12 ` [Buildroot] [Patch v7 04/10] rust-bootstrap: new package Eric Le Bihan
` (7 subsequent siblings)
10 siblings, 1 reply; 31+ messages in thread
From: Eric Le Bihan @ 2017-07-23 8:11 UTC (permalink / raw)
To: buildroot
Now that one provider is available for rustc, expose the host variant in
menuconfig.
Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
---
package/Config.in.host | 1 +
1 file changed, 1 insertion(+)
diff --git a/package/Config.in.host b/package/Config.in.host
index c5a852b..ab24081 100644
--- a/package/Config.in.host
+++ b/package/Config.in.host
@@ -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"
--
2.9.4
^ permalink raw reply related [flat|nested] 31+ messages in thread* [Buildroot] [Patch v7 03/10] rustc: expose host variant in menuconfig
2017-07-23 8:11 ` [Buildroot] [Patch v7 03/10] rustc: expose host variant in menuconfig Eric Le Bihan
@ 2017-08-10 23:09 ` Arnout Vandecappelle
0 siblings, 0 replies; 31+ messages in thread
From: Arnout Vandecappelle @ 2017-08-10 23:09 UTC (permalink / raw)
To: buildroot
On 23-07-17 10:11, Eric Le Bihan wrote:
> 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
>
> Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
> ---
> package/Config.in.host | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/package/Config.in.host b/package/Config.in.host
> index c5a852b..ab24081 100644
> --- a/package/Config.in.host
> +++ b/package/Config.in.host
> @@ -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"
>
--
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
^ permalink raw reply [flat|nested] 31+ messages in thread
* [Buildroot] [Patch v7 04/10] rust-bootstrap: new package
2017-07-23 8:11 [Buildroot] [Patch v7 00/10] Add support for the Rust programming language Eric Le Bihan
` (2 preceding siblings ...)
2017-07-23 8:11 ` [Buildroot] [Patch v7 03/10] rustc: expose host variant in menuconfig Eric Le Bihan
@ 2017-07-23 8:12 ` Eric Le Bihan
2017-08-10 23:13 ` Arnout Vandecappelle
2017-07-23 8:12 ` [Buildroot] [Patch v7 05/10] cargo-bootstrap: " Eric Le Bihan
` (6 subsequent siblings)
10 siblings, 1 reply; 31+ messages in thread
From: Eric Le Bihan @ 2017-07-23 8:12 UTC (permalink / raw)
To: buildroot
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.
Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
---
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
diff --git a/DEVELOPERS b/DEVELOPERS
index 312b176..208c98d 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -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/
diff --git a/package/rust-bootstrap/rust-bootstrap.hash b/package/rust-bootstrap/rust-bootstrap.hash
new file mode 100644
index 0000000..7095220
--- /dev/null
+++ b/package/rust-bootstrap/rust-bootstrap.hash
@@ -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
diff --git a/package/rust-bootstrap/rust-bootstrap.mk b/package/rust-bootstrap/rust-bootstrap.mk
new file mode 100644
index 0000000..04d3fc6
--- /dev/null
+++ b/package/rust-bootstrap/rust-bootstrap.mk
@@ -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))
--
2.9.4
^ permalink raw reply related [flat|nested] 31+ messages in thread* [Buildroot] [Patch v7 04/10] rust-bootstrap: new package
2017-07-23 8:12 ` [Buildroot] [Patch v7 04/10] rust-bootstrap: new package Eric Le Bihan
@ 2017-08-10 23:13 ` Arnout Vandecappelle
2017-09-07 19:33 ` Eric Le Bihan
0 siblings, 1 reply; 31+ messages in thread
From: Arnout Vandecappelle @ 2017-08-10 23:13 UTC (permalink / raw)
To: buildroot
On 23-07-17 10:12, Eric Le Bihan wrote:
> 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]
--
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
^ permalink raw reply [flat|nested] 31+ messages in thread
* [Buildroot] [Patch v7 04/10] rust-bootstrap: new package
2017-08-10 23:13 ` Arnout Vandecappelle
@ 2017-09-07 19:33 ` Eric Le Bihan
0 siblings, 0 replies; 31+ messages in thread
From: Eric Le Bihan @ 2017-09-07 19:33 UTC (permalink / raw)
To: buildroot
Hi!
On 17-08-11 01:13:38, Arnout Vandecappelle wrote:
>
>
> On 23-07-17 10:12, Eric Le Bihan wrote:
> > 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?
> 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
^ permalink raw reply [flat|nested] 31+ messages in thread
* [Buildroot] [Patch v7 05/10] cargo-bootstrap: new package
2017-07-23 8:11 [Buildroot] [Patch v7 00/10] Add support for the Rust programming language Eric Le Bihan
` (3 preceding siblings ...)
2017-07-23 8:12 ` [Buildroot] [Patch v7 04/10] rust-bootstrap: new package Eric Le Bihan
@ 2017-07-23 8:12 ` Eric Le Bihan
2017-07-23 8:12 ` [Buildroot] [Patch v7 06/10] rust: " Eric Le Bihan
` (5 subsequent siblings)
10 siblings, 0 replies; 31+ messages in thread
From: Eric Le Bihan @ 2017-07-23 8:12 UTC (permalink / raw)
To: buildroot
This new package fetches a binary snapshot of Cargo, suitable to
bootstrap the host variants of the Rust compiler and Cargo, the package
manager.
Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
---
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
diff --git a/DEVELOPERS b/DEVELOPERS
index 208c98d..ca0657f 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -487,6 +487,7 @@ F: package/xxhash/
N: Eric Le Bihan <eric.le.bihan.dev@free.fr>
F: package/adwaita-icon-theme/
+F: package/cargo-bootstrap/
F: package/darkhttpd/
F: package/eudev/
F: package/execline/
diff --git a/package/cargo-bootstrap/cargo-bootstrap.hash b/package/cargo-bootstrap/cargo-bootstrap.hash
new file mode 100644
index 0000000..28551aa
--- /dev/null
+++ b/package/cargo-bootstrap/cargo-bootstrap.hash
@@ -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
diff --git a/package/cargo-bootstrap/cargo-bootstrap.mk b/package/cargo-bootstrap/cargo-bootstrap.mk
new file mode 100644
index 0000000..6814d78
--- /dev/null
+++ b/package/cargo-bootstrap/cargo-bootstrap.mk
@@ -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))
--
2.9.4
^ permalink raw reply related [flat|nested] 31+ messages in thread* [Buildroot] [Patch v7 06/10] rust: new package
2017-07-23 8:11 [Buildroot] [Patch v7 00/10] Add support for the Rust programming language Eric Le Bihan
` (4 preceding siblings ...)
2017-07-23 8:12 ` [Buildroot] [Patch v7 05/10] cargo-bootstrap: " Eric Le Bihan
@ 2017-07-23 8:12 ` Eric Le Bihan
2017-08-10 23:38 ` Arnout Vandecappelle
2017-07-23 8:12 ` [Buildroot] [Patch v7 07/10] libssh2: add host variant Eric Le Bihan
` (4 subsequent siblings)
10 siblings, 1 reply; 31+ messages in thread
From: Eric Le Bihan @ 2017-07-23 8:12 UTC (permalink / raw)
To: buildroot
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:
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
Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
---
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
diff --git a/DEVELOPERS b/DEVELOPERS
index ca0657f..008a569 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -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/
diff --git a/package/rust/rust.hash b/package/rust/rust.hash
new file mode 100644
index 0000000..d75b7b7
--- /dev/null
+++ b/package/rust/rust.hash
@@ -0,0 +1,2 @@
+# Locally generated
+sha256 392148ab52db6299c46df6f48f066b7bdf9a7af9775fb05571984ff500f7f9ad rustc-1.19.0-src.tar.xz
diff --git a/package/rust/rust.mk b/package/rust/rust.mk
new file mode 100644
index 0000000..fb83b72
--- /dev/null
+++ b/package/rust/rust.mk
@@ -0,0 +1,78 @@
+################################################################################
+#
+# rust
+#
+################################################################################
+
+RUST_VERSION = 1.19.0
+RUST_SOURCE = rustc-$(RUST_VERSION)-src.tar.xz
+RUST_SITE = https://static.rust-lang.org/dist
+RUST_LICENSE = Apache-2.0 or MIT
+RUST_LICENSE_FILES = LICENSE-APACHE LICENSE-MIT
+
+HOST_RUST_PROVIDES = host-rustc
+
+HOST_RUST_DEPENDENCIES = \
+ toolchain \
+ host-rust-bootstrap \
+ host-cargo-bootstrap \
+ host-python \
+ host-cmake
+
+ifeq ($(BR2_PACKAGE_JEMALLOC),y)
+HOST_RUST_DEPENDENCIES += jemalloc
+HOST_RUST_JEMALLOC_ENABLED = true
+HOST_RUST_JEMALLOC_CONF = 'jemalloc = "$(STAGING_DIR)/usr/lib/libjemalloc_pic.a"'
+else
+HOST_RUST_JEMALLOC_ENABLED = false
+endif
+
+HOST_RUST_VERBOSITY = $(if $(VERBOSE),2,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; \
+ echo 'python = "$(HOST_DIR)/bin/python2"' >> config.toml; \
+ 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; \
+ echo $(HOST_RUST_JEMALLOC_CONF) >> config.toml; \
+ )
+endef
+
+define HOST_RUST_BUILD_CMDS
+ (cd $(@D); $(HOST_MAKE_ENV) $(HOST_RUST_MAKE_ENV) python2 x.py \
+ 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 \
+ --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)
+endef
+
+$(eval $(host-generic-package))
diff --git a/package/rustc/Config.in.host b/package/rustc/Config.in.host
index 7f2c276..30bab8f 100644
--- a/package/rustc/Config.in.host
+++ b/package/rustc/Config.in.host
@@ -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
--
2.9.4
^ permalink raw reply related [flat|nested] 31+ messages in thread* [Buildroot] [Patch v7 06/10] rust: new package
2017-07-23 8:12 ` [Buildroot] [Patch v7 06/10] rust: " Eric Le Bihan
@ 2017-08-10 23:38 ` Arnout Vandecappelle
2017-09-07 19:58 ` Eric Le Bihan
0 siblings, 1 reply; 31+ messages in thread
From: Arnout Vandecappelle @ 2017-08-10 23:38 UTC (permalink / raw)
To: buildroot
On 23-07-17 10:12, Eric Le Bihan wrote:
> 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:
>
> 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?
> 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]
> +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?
> + 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?
> + 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?
> + 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 )
> +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?
> + 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?
> + --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?
> +endef
> +
> +$(eval $(host-generic-package))
> diff --git a/package/rustc/Config.in.host b/package/rustc/Config.in.host
> index 7f2c276..30bab8f 100644
> --- a/package/rustc/Config.in.host
> +++ b/package/rustc/Config.in.host
> @@ -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
Split in two lines:
depends on BR2_aarch64
depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_5
Regards,
Arnout
> +
> 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
>
--
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
^ permalink raw reply [flat|nested] 31+ messages in thread* [Buildroot] [Patch v7 06/10] rust: new package
2017-08-10 23:38 ` Arnout Vandecappelle
@ 2017-09-07 19:58 ` Eric Le Bihan
0 siblings, 0 replies; 31+ messages in thread
From: Eric Le Bihan @ 2017-09-07 19:58 UTC (permalink / raw)
To: buildroot
Hi!
On 17-08-11 01:38:08, Arnout Vandecappelle wrote:
>
>
> On 23-07-17 10:12, Eric Le Bihan wrote:
> > 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:
> >
> > 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.
> > 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.
> 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.
> [snip]
> > +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?
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?
> > + 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?
The Python code looks compatible with Python 3.x. Needs some testing
though.
> > + 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?
I'll see if there are some options for this.
> > + 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!
> > +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.
> HOST_RUST_MAKE_ENV is never assigned to, right?
Yes. It is useless. I will remove it.
> > + 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?
Yes, I should handle the case where $(HOSTARCH) == $(ARCH).
> > + --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?
The `dist` command generates the install.sh scripts that are called by
the `install` command.
> > +endef
> > +
> > +$(eval $(host-generic-package))
> > diff --git a/package/rustc/Config.in.host b/package/rustc/Config.in.host
> > index 7f2c276..30bab8f 100644
> > --- a/package/rustc/Config.in.host
> > +++ b/package/rustc/Config.in.host
> > @@ -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
>
> Split in two lines:
>
> depends on BR2_aarch64
> depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_5
OK.
--
ELB
^ permalink raw reply [flat|nested] 31+ messages in thread
* [Buildroot] [Patch v7 07/10] libssh2: add host variant
2017-07-23 8:11 [Buildroot] [Patch v7 00/10] Add support for the Rust programming language Eric Le Bihan
` (5 preceding siblings ...)
2017-07-23 8:12 ` [Buildroot] [Patch v7 06/10] rust: " Eric Le Bihan
@ 2017-07-23 8:12 ` Eric Le Bihan
2017-07-23 8:19 ` Baruch Siach
2017-07-23 8:12 ` [Buildroot] [Patch v7 08/10] libhttpparser: " Eric Le Bihan
` (3 subsequent siblings)
10 siblings, 1 reply; 31+ messages in thread
From: Eric Le Bihan @ 2017-07-23 8:12 UTC (permalink / raw)
To: buildroot
Allow build of host variant of libssh2, which depends on host-openssl.
Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
---
package/libssh2/libssh2.mk | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/package/libssh2/libssh2.mk b/package/libssh2/libssh2.mk
index 338f5b4..64c59bc 100644
--- a/package/libssh2/libssh2.mk
+++ b/package/libssh2/libssh2.mk
@@ -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))
--
2.9.4
^ permalink raw reply related [flat|nested] 31+ messages in thread* [Buildroot] [Patch v7 07/10] libssh2: add host variant
2017-07-23 8:12 ` [Buildroot] [Patch v7 07/10] libssh2: add host variant Eric Le Bihan
@ 2017-07-23 8:19 ` Baruch Siach
2017-08-10 23:40 ` Arnout Vandecappelle
0 siblings, 1 reply; 31+ messages in thread
From: Baruch Siach @ 2017-07-23 8:19 UTC (permalink / raw)
To: buildroot
Hi Eric,
On Sun, Jul 23, 2017 at 10:12:03AM +0200, Eric Le Bihan wrote:
> Allow build of host variant of libssh2, which depends on host-openssl.
>
> Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
> ---
> package/libssh2/libssh2.mk | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/package/libssh2/libssh2.mk b/package/libssh2/libssh2.mk
> index 338f5b4..64c59bc 100644
> --- a/package/libssh2/libssh2.mk
> +++ b/package/libssh2/libssh2.mk
> @@ -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
> +
> $(eval $(autotools-package))
> +$(eval $(host-autotools-package))
--
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 -
^ permalink raw reply [flat|nested] 31+ messages in thread* [Buildroot] [Patch v7 07/10] libssh2: add host variant
2017-07-23 8:19 ` Baruch Siach
@ 2017-08-10 23:40 ` Arnout Vandecappelle
0 siblings, 0 replies; 31+ messages in thread
From: Arnout Vandecappelle @ 2017-08-10 23:40 UTC (permalink / raw)
To: buildroot
On 23-07-17 10:19, Baruch Siach wrote:
> Hi Eric,
>
> On Sun, Jul 23, 2017 at 10:12:03AM +0200, Eric Le Bihan wrote:
>> Allow build of host variant of libssh2, which depends on host-openssl.
>>
>> Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
>> ---
>> package/libssh2/libssh2.mk | 6 ++++++
>> 1 file changed, 6 insertions(+)
>>
>> diff --git a/package/libssh2/libssh2.mk b/package/libssh2/libssh2.mk
>> index 338f5b4..64c59bc 100644
>> --- a/package/libssh2/libssh2.mk
>> +++ b/package/libssh2/libssh2.mk
>> @@ -40,4 +40,10 @@ else
>> LIBSSH2_CONF_OPTS += --without-libz
>> endif
>>
>> +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 \
...
>> + --with-libssl-prefix=$(HOST_DIR)/usr \
>> + --without-libgcrypt
>
> You should probably also add --without-mbedtls.
And --without-libz --disable-examples-build
Regards,
Arnout
>
> baruch
>
>> +
>> $(eval $(autotools-package))
>> +$(eval $(host-autotools-package))
>
--
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
^ permalink raw reply [flat|nested] 31+ messages in thread
* [Buildroot] [Patch v7 08/10] libhttpparser: add host variant
2017-07-23 8:11 [Buildroot] [Patch v7 00/10] Add support for the Rust programming language Eric Le Bihan
` (6 preceding siblings ...)
2017-07-23 8:12 ` [Buildroot] [Patch v7 07/10] libssh2: add host variant Eric Le Bihan
@ 2017-07-23 8:12 ` Eric Le Bihan
2017-08-10 23:41 ` Arnout Vandecappelle
2017-07-23 8:12 ` [Buildroot] [Patch v7 09/10] libcurl: " Eric Le Bihan
` (2 subsequent siblings)
10 siblings, 1 reply; 31+ messages in thread
From: Eric Le Bihan @ 2017-07-23 8:12 UTC (permalink / raw)
To: buildroot
Allow build of host variant of libhttpparser.
Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
---
package/libhttpparser/libhttpparser.mk | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/package/libhttpparser/libhttpparser.mk b/package/libhttpparser/libhttpparser.mk
index 015efc0..475dfde 100644
--- a/package/libhttpparser/libhttpparser.mk
+++ b/package/libhttpparser/libhttpparser.mk
@@ -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))
--
2.9.4
^ permalink raw reply related [flat|nested] 31+ messages in thread* [Buildroot] [Patch v7 08/10] libhttpparser: add host variant
2017-07-23 8:12 ` [Buildroot] [Patch v7 08/10] libhttpparser: " Eric Le Bihan
@ 2017-08-10 23:41 ` Arnout Vandecappelle
0 siblings, 0 replies; 31+ messages in thread
From: Arnout Vandecappelle @ 2017-08-10 23:41 UTC (permalink / raw)
To: buildroot
On 23-07-17 10:12, Eric Le Bihan wrote:
> Allow build of host variant of libhttpparser.
>
> Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
> ---
> package/libhttpparser/libhttpparser.mk | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/package/libhttpparser/libhttpparser.mk b/package/libhttpparser/libhttpparser.mk
> index 015efc0..475dfde 100644
> --- a/package/libhttpparser/libhttpparser.mk
> +++ b/package/libhttpparser/libhttpparser.mk
> @@ -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
> +endef
> +
> $(eval $(generic-package))
> +$(eval $(host-generic-package))
>
--
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
^ permalink raw reply [flat|nested] 31+ messages in thread
* [Buildroot] [Patch v7 09/10] libcurl: add host variant
2017-07-23 8:11 [Buildroot] [Patch v7 00/10] Add support for the Rust programming language Eric Le Bihan
` (7 preceding siblings ...)
2017-07-23 8:12 ` [Buildroot] [Patch v7 08/10] libhttpparser: " Eric Le Bihan
@ 2017-07-23 8:12 ` Eric Le Bihan
2017-08-10 23:45 ` Arnout Vandecappelle
2017-07-23 8:12 ` [Buildroot] [Patch v7 10/10] cargo: new package Eric Le Bihan
2017-08-10 23:59 ` [Buildroot] [Patch v7 00/10] Add support for the Rust programming language Arnout Vandecappelle
10 siblings, 1 reply; 31+ messages in thread
From: Eric Le Bihan @ 2017-07-23 8:12 UTC (permalink / raw)
To: buildroot
Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
---
package/libcurl/libcurl.mk | 3 +++
1 file changed, 3 insertions(+)
diff --git a/package/libcurl/libcurl.mk b/package/libcurl/libcurl.mk
index 6848449..0e216ca 100644
--- a/package/libcurl/libcurl.mk
+++ b/package/libcurl/libcurl.mk
@@ -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))
--
2.9.4
^ permalink raw reply related [flat|nested] 31+ messages in thread* [Buildroot] [Patch v7 09/10] libcurl: add host variant
2017-07-23 8:12 ` [Buildroot] [Patch v7 09/10] libcurl: " Eric Le Bihan
@ 2017-08-10 23:45 ` Arnout Vandecappelle
0 siblings, 0 replies; 31+ messages in thread
From: Arnout Vandecappelle @ 2017-08-10 23:45 UTC (permalink / raw)
To: buildroot
On 23-07-17 10:12, Eric Le Bihan wrote:
> Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
> ---
> package/libcurl/libcurl.mk | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/package/libcurl/libcurl.mk b/package/libcurl/libcurl.mk
> index 6848449..0e216ca 100644
> --- a/package/libcurl/libcurl.mk
> +++ b/package/libcurl/libcurl.mk
> @@ -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
> +
> $(eval $(autotools-package))
> +$(eval $(host-autotools-package))
>
--
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
^ permalink raw reply [flat|nested] 31+ messages in thread
* [Buildroot] [Patch v7 10/10] cargo: new package
2017-07-23 8:11 [Buildroot] [Patch v7 00/10] Add support for the Rust programming language Eric Le Bihan
` (8 preceding siblings ...)
2017-07-23 8:12 ` [Buildroot] [Patch v7 09/10] libcurl: " Eric Le Bihan
@ 2017-07-23 8:12 ` Eric Le Bihan
2017-08-10 23:58 ` Arnout Vandecappelle
2017-08-10 23:59 ` [Buildroot] [Patch v7 00/10] Add support for the Rust programming language Arnout Vandecappelle
10 siblings, 1 reply; 31+ messages in thread
From: Eric Le Bihan @ 2017-07-23 8:12 UTC (permalink / raw)
To: buildroot
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.
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
Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
---
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
diff --git a/DEVELOPERS b/DEVELOPERS
index 008a569..2463a31 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -488,6 +488,7 @@ F: package/xxhash/
N: Eric Le Bihan <eric.le.bihan.dev@free.fr>
F: package/adwaita-icon-theme/
F: package/cargo-bootstrap/
+F: package/cargo/
F: package/darkhttpd/
F: package/eudev/
F: package/execline/
diff --git a/package/Config.in.host b/package/Config.in.host
index ab24081..cd7ed65 100644
--- a/package/Config.in.host
+++ b/package/Config.in.host
@@ -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"
diff --git a/package/cargo/Config.in.host b/package/cargo/Config.in.host
new file mode 100644
index 0000000..0f1ca30
--- /dev/null
+++ b/package/cargo/Config.in.host
@@ -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/
diff --git a/package/cargo/cargo.hash b/package/cargo/cargo.hash
new file mode 100644
index 0000000..83648d7
--- /dev/null
+++ b/package/cargo/cargo.hash
@@ -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
diff --git a/package/cargo/cargo.in b/package/cargo/cargo.in
new file mode 100644
index 0000000..be26abf
--- /dev/null
+++ b/package/cargo/cargo.in
@@ -0,0 +1,2 @@
+#!/bin/sh
+LD_LIBRARY_PATH=@HOST_DIR@/lib exec $(dirname $0)/cargo.real "$@"
diff --git a/package/cargo/cargo.mk b/package/cargo/cargo.mk
new file mode 100644
index 0000000..270a766
--- /dev/null
+++ b/package/cargo/cargo.mk
@@ -0,0 +1,112 @@
+################################################################################
+#
+# cargo
+#
+################################################################################
+
+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
+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)
+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)
+
+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" \
+ 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
+ $(INSTALL) -m 0755 package/cargo/cargo.in \
+ $(HOST_DIR)/bin/cargo
+ $(SED) 's;@HOST_DIR@;$(HOST_DIR);g' $(HOST_DIR)/bin/cargo
+endef
+
+HOST_CARGO_POST_INSTALL_HOOKS += HOST_CARGO_INSTALL_WRAPPER
+
+$(eval $(host-generic-package))
diff --git a/package/cargo/config.in b/package/cargo/config.in
new file mode 100644
index 0000000..cc048c7
--- /dev/null
+++ b/package/cargo/config.in
@@ -0,0 +1,2 @@
+[target. at RUST_TARGET_NAME@]
+linker = "@CROSS_PREFIX at gcc"
--
2.9.4
^ permalink raw reply related [flat|nested] 31+ messages in thread* [Buildroot] [Patch v7 10/10] cargo: new package
2017-07-23 8:12 ` [Buildroot] [Patch v7 10/10] cargo: new package Eric Le Bihan
@ 2017-08-10 23:58 ` Arnout Vandecappelle
2017-09-07 20:20 ` Eric Le Bihan
0 siblings, 1 reply; 31+ messages in thread
From: Arnout Vandecappelle @ 2017-08-10 23:58 UTC (permalink / raw)
To: buildroot
I didn't do a thorough review of this one...
On 23-07-17 10:12, Eric Le Bihan wrote:
> 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?
>
> 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.
[snip]
> +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.
> +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?
> +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)
> +
> +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?
> + 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
> + $(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
> +
> +HOST_CARGO_POST_INSTALL_HOOKS += HOST_CARGO_INSTALL_WRAPPER
> +
> +$(eval $(host-generic-package))
> diff --git a/package/cargo/config.in b/package/cargo/config.in
> new file mode 100644
> index 0000000..cc048c7
> --- /dev/null
> +++ b/package/cargo/config.in
> @@ -0,0 +1,2 @@
> +[target. at RUST_TARGET_NAME@]
> +linker = "@CROSS_PREFIX at gcc"
>
--
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
^ permalink raw reply [flat|nested] 31+ messages in thread
* [Buildroot] [Patch v7 10/10] cargo: new package
2017-08-10 23:58 ` Arnout Vandecappelle
@ 2017-09-07 20:20 ` Eric Le Bihan
0 siblings, 0 replies; 31+ messages in thread
From: Eric Le Bihan @ 2017-09-07 20:20 UTC (permalink / raw)
To: buildroot
Hi!
On 17-08-11 01:58:34, Arnout Vandecappelle wrote:
> I didn't do a thorough review of this one...
>
> On 23-07-17 10:12, Eric Le Bihan wrote:
> > 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.
> >
> > 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.
>
> [snip]
> > +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.
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.
> > +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!
> > +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)
> > +
> > +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.
> > + 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
> > + $(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?
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
^ permalink raw reply [flat|nested] 31+ messages in thread
* [Buildroot] [Patch v7 00/10] Add support for the Rust programming language
2017-07-23 8:11 [Buildroot] [Patch v7 00/10] Add support for the Rust programming language Eric Le Bihan
` (9 preceding siblings ...)
2017-07-23 8:12 ` [Buildroot] [Patch v7 10/10] cargo: new package Eric Le Bihan
@ 2017-08-10 23:59 ` Arnout Vandecappelle
2017-09-07 20:22 ` Eric Le Bihan
10 siblings, 1 reply; 31+ messages in thread
From: Arnout Vandecappelle @ 2017-08-10 23:59 UTC (permalink / raw)
To: buildroot
Hi Eric,
On 23-07-17 10:11, Eric Le Bihan wrote:
> 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
>
> - 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.
[snip]
--
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
^ permalink raw reply [flat|nested] 31+ messages in thread