diff mbox

[v4,1/3] rust-bootstrap: new package

Message ID 20170402194651.28684-2-eric.le.bihan.dev@free.fr
State Changes Requested
Headers show

Commit Message

Eric Le Bihan April 2, 2017, 7:46 p.m. UTC
This new package fetches a binary snapshot of the Rust compiler,
suitable for the host, in order to bootstrap the Rust compiler.

Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
---
 DEVELOPERS                                 |  1 +
 package/rust-bootstrap/rust-bootstrap.hash |  5 ++++
 package/rust-bootstrap/rust-bootstrap.mk   | 37 ++++++++++++++++++++++++++++++
 3 files changed, 43 insertions(+)
 create mode 100644 package/rust-bootstrap/rust-bootstrap.hash
 create mode 100644 package/rust-bootstrap/rust-bootstrap.mk

Comments

Jörg Krause April 7, 2017, 7:03 a.m. UTC | #1
On Sun, 2017-04-02 at 21:46 +0200, Eric Le Bihan wrote:
> This new package fetches a binary snapshot of the Rust compiler,
> suitable for the host, in order to bootstrap the Rust compiler.
> 
> Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
> ---
>  DEVELOPERS                                 |  1 +
>  package/rust-bootstrap/rust-bootstrap.hash |  5 ++++
>  package/rust-bootstrap/rust-bootstrap.mk   | 37
> ++++++++++++++++++++++++++++++
>  3 files changed, 43 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 c89468b..863d5aa 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -448,6 +448,7 @@ F:	package/execline/
>  F:	package/hicolor-icon-theme/
>  F:	package/jemalloc/
>  F:	package/ninja/
> +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..b418ea0
> --- /dev/null
> +++ b/package/rust-bootstrap/rust-bootstrap.hash
> @@ -0,0 +1,5 @@
> +# Locally calculated
> +sha256
> a833304f99071600c72ecd868c1c7bd5ce49d1102332637a8eb7adb942f349ab  rus
> tc-1.15.1-i686-unknown-linux-gnu.tar.gz
> +sha256
> 33ff44672b731fc71145974ce84194a1a9bafe6da3a74fd1e7543f12467f8894  rus
> tc-1.15.1-x86_64-unknown-linux-gnu.tar.gz
> +sha256
> eff452a54b208a83b35432f226cb7de046d27b5e43edfc31d71ff340af686db0  rus
> t-std-1.15.1-i686-unknown-linux-gnu.tar.gz
> +sha256
> 69b251b478e284dfcaefc1153183f26f41d504ae213a81224f2101d8dbd52bb0  rus
> t-std-1.15.1-x86_64-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..1098423
> --- /dev/null
> +++ b/package/rust-bootstrap/rust-bootstrap.mk
> @@ -0,0 +1,37 @@
> +####################################################################
> ############
> +#
> +# rust-bootstrap
> +#
> +####################################################################
> ############
> +
> +RUST_BOOTSTRAP_VERSION = 1.15.1
> +RUST_BOOTSTRAP_DATE = 2017-02-09
> +RUST_BOOTSTRAP_TRIPLE = $(RUST_BOOTSTRAP_ARCH)-unknown-linux-gnu
> +RUST_BOOTSTRAP_LABEL = $(RUST_BOOTSTRAP_VERSION)-
> $(RUST_BOOTSTRAP_TRIPLE)
> +
> +ifeq ($(HOSTARCH),x86_64)
> +RUST_BOOTSTRAP_ARCH = x86_64
> +else ifeq ($(HOSTARCH),x86)
> +RUST_BOOTSTRAP_ARCH = i686
> +endif

Is there any necessity to limit the bootstrap compiler to those host
archs only?

> +RUST_BOOTSTRAP_SITE = https://static.rust-
> lang.org/dist/$(RUST_BOOTSTRAP_DATE)

Why use a date and not https://static.rust-lang.org/dist solely. Since
I can fetch https://static.rust-lang.org/dist/rust-1.15.1-x86_64-unknow
n-linux-gnu.tar.gz.

> +RUST_BOOTSTRAP_SOURCE = rustc-$(RUST_BOOTSTRAP_LABEL).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_LABEL).tar.gz
> +RUST_BOOTSTRAP_LIBSTD_ROOT = rust-std-$(RUST_BOOTSTRAP_LABEL)/rust-
> std-$(RUST_BOOTSTRAP_TRIPLE)

Why not make a seperate package?

> +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))

Jörg
Thomas Petazzoni April 7, 2017, 8:26 a.m. UTC | #2
Hello,

On Fri, 07 Apr 2017 09:03:34 +0200, Jörg Krause wrote:
> On Sun, 2017-04-02 at 21:46 +0200, Eric Le Bihan wrote:
> > This new package fetches a binary snapshot of the Rust compiler,
> > suitable for the host, in order to bootstrap the Rust compiler.
> > 
> > Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
> > ---
> >  DEVELOPERS                                 |  1 +
> >  package/rust-bootstrap/rust-bootstrap.hash |  5 ++++
> >  package/rust-bootstrap/rust-bootstrap.mk   | 37
> > ++++++++++++++++++++++++++++++
> >  3 files changed, 43 insertions(+)

It would be nice if you could fix your e-mail client to not rewrap the
text you are replying to :)

> > +ifeq ($(HOSTARCH),x86_64)
> > +RUST_BOOTSTRAP_ARCH = x86_64
> > +else ifeq ($(HOSTARCH),x86)
> > +RUST_BOOTSTRAP_ARCH = i686
> > +endif  
> 
> Is there any necessity to limit the bootstrap compiler to those host
> archs only?

The bootstrap compiler is provided as a binary only thing,
pre-compiled. So it works only on the architectures it was compiled
for. At least, that's why I remember from previous series on this topic.

> > +RUST_BOOTSTRAP_SOURCE = rustc-$(RUST_BOOTSTRAP_LABEL).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_LABEL).tar.gz
> > +RUST_BOOTSTRAP_LIBSTD_ROOT = rust-std-$(RUST_BOOTSTRAP_LABEL)/rust-
> > std-$(RUST_BOOTSTRAP_TRIPLE)  
> 
> Why not make a seperate package?

It apparently needs to be extracted within the bootstrap compiler tree,
i.e in $(@D)/rustc, I guess that's why. But Eric can give more details
here.

Thomas
Jörg Krause April 7, 2017, 8:54 a.m. UTC | #3
Hi,

On Fri, 2017-04-07 at 10:26 +0200, Thomas Petazzoni wrote:
> Hello,
> 
> On Fri, 07 Apr 2017 09:03:34 +0200, Jörg Krause wrote:
> > On Sun, 2017-04-02 at 21:46 +0200, Eric Le Bihan wrote:
> > > This new package fetches a binary snapshot of the Rust compiler,
> > > suitable for the host, in order to bootstrap the Rust compiler.
> > > 
> > > Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
> > > ---
> > >  DEVELOPERS                                 |  1 +
> > >  package/rust-bootstrap/rust-bootstrap.hash |  5 ++++
> > >  package/rust-bootstrap/rust-bootstrap.mk   | 37
> > > ++++++++++++++++++++++++++++++
> > >  3 files changed, 43 insertions(+)
> 
> It would be nice if you could fix your e-mail client to not rewrap the
> text you are replying to :)

Naughty mail client. Told him not do such bad things anymore :-)

> > > +ifeq ($(HOSTARCH),x86_64)
> > > +RUST_BOOTSTRAP_ARCH = x86_64
> > > +else ifeq ($(HOSTARCH),x86)
> > > +RUST_BOOTSTRAP_ARCH = i686
> > > +endif  
> > 
> > Is there any necessity to limit the bootstrap compiler to those host
> > archs only?
> 
> The bootstrap compiler is provided as a binary only thing,
> pre-compiled. So it works only on the architectures it was compiled
> for. At least, that's why I remember from previous series on this topic.

But, if I am running Buildroot on a PowerPC it should be able to fetch
and run the binary for PowerPC, right?

> > > +RUST_BOOTSTRAP_SOURCE = rustc-$(RUST_BOOTSTRAP_LABEL).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_LABEL).tar.gz
> > > +RUST_BOOTSTRAP_LIBSTD_ROOT = rust-std-$(RUST_BOOTSTRAP_LABEL)/rust-
> > > std-$(RUST_BOOTSTRAP_TRIPLE)  
> > 
> > Why not make a seperate package?
> 
> It apparently needs to be extracted within the bootstrap compiler tree,
> i.e in $(@D)/rustc, I guess that's why. But Eric can give more details
> here.

Maybe the path to the rust libraries could be added to LD_LIBRARY_PATH?

Jörg
Thomas Petazzoni April 7, 2017, 9:03 a.m. UTC | #4
Hello,

On Fri, 07 Apr 2017 10:54:04 +0200, Jörg Krause wrote:

> > > Is there any necessity to limit the bootstrap compiler to those host
> > > archs only?  
> > 
> > The bootstrap compiler is provided as a binary only thing,
> > pre-compiled. So it works only on the architectures it was compiled
> > for. At least, that's why I remember from previous series on this topic.  
> 
> But, if I am running Buildroot on a PowerPC it should be able to fetch
> and run the binary for PowerPC, right?

If there's no prebuilt Rust compiler for PowerPC, then no, it will
simply not be possible.

We have already lots of things in Buildroot that depend on x86 or
x86-64. Check all packages/options that use BR2_HOSTARCH.

So, it's fine for Rust to also require a x86/x86-64 machine, as long as
the proper BR2_HOSTARCH dependency is present in the Config.in.

Best regards,

Thomas
Jörg Krause April 7, 2017, 9:22 a.m. UTC | #5
On Fri, 2017-04-07 at 11:03 +0200, Thomas Petazzoni wrote:
> Hello,
> 
> On Fri, 07 Apr 2017 10:54:04 +0200, Jörg Krause wrote:
> 
> > > > Is there any necessity to limit the bootstrap compiler to those host
> > > > archs only?  
> > > 
> > > The bootstrap compiler is provided as a binary only thing,
> > > pre-compiled. So it works only on the architectures it was compiled
> > > for. At least, that's why I remember from previous series on this topic.  
> > 
> > But, if I am running Buildroot on a PowerPC it should be able to fetch
> > and run the binary for PowerPC, right?
> 
> If there's no prebuilt Rust compiler for PowerPC, then no, it will
> simply not be possible.

Fetching and extracting the PowerPC release tarball [1]:

[joerg@nzxt rust-1.16.0-powerpc64-unknown-linux-gnu]$ file
rustc/bin/rustc 
rustc/bin/rustc: ELF 64-bit MSB shared object, 64-bit PowerPC or cisco
7500, version 1 (SYSV), dynamically linked, interpreter
/lib64/ld64.so.1, for GNU/Linux 3.2.0,
BuildID[sha1]=39357ec02406358be73f28d80dabfdd9e9816de9, not stripped,
with debug_info

> We have already lots of things in Buildroot that depend on x86 or
> x86-64. Check all packages/options that use BR2_HOSTARCH.
> 
> So, it's fine for Rust to also require a x86/x86-64 machine, as long as
> the proper BR2_HOSTARCH dependency is present in the Config.in.

As I am running x64 it is fine for me, too. Just wondered why to limit
the hosts archs if there are binaries available.

[1] https://static.rust-lang.org/dist/rust-1.16.0-powerpc64-unknown-lin
ux-gnu.tar.gz

Jörg
Thomas Petazzoni April 7, 2017, 10:26 a.m. UTC | #6
Hello,

On Fri, 07 Apr 2017 11:22:01 +0200, Jörg Krause wrote:

> As I am running x64 it is fine for me, too. Just wondered why to limit
> the hosts archs if there are binaries available.

I guess simply because Eric could only test those host architectures.

Thomas
Eric Le Bihan April 8, 2017, 9:23 a.m. UTC | #7
Hi!

On 17-04-07 09:03:34, Jörg Krause wrote:
> On Sun, 2017-04-02 at 21:46 +0200, Eric Le Bihan wrote:
> > This new package fetches a binary snapshot of the Rust compiler,
> > suitable for the host, in order to bootstrap the Rust compiler.
> >
> > Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
> > ---
> >  DEVELOPERS                                 |  1 +
> >  package/rust-bootstrap/rust-bootstrap.hash |  5 ++++
> >  package/rust-bootstrap/rust-bootstrap.mk   | 37
> > ++++++++++++++++++++++++++++++
> >  3 files changed, 43 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 c89468b..863d5aa 100644
> > --- a/DEVELOPERS
> > +++ b/DEVELOPERS
> > @@ -448,6 +448,7 @@ F:	package/execline/
> >  F:	package/hicolor-icon-theme/
> >  F:	package/jemalloc/
> >  F:	package/ninja/
> > +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..b418ea0
> > --- /dev/null
> > +++ b/package/rust-bootstrap/rust-bootstrap.hash
> > @@ -0,0 +1,5 @@
> > +# Locally calculated
> > +sha256
> > a833304f99071600c72ecd868c1c7bd5ce49d1102332637a8eb7adb942f349ab  rus
> > tc-1.15.1-i686-unknown-linux-gnu.tar.gz
> > +sha256
> > 33ff44672b731fc71145974ce84194a1a9bafe6da3a74fd1e7543f12467f8894  rus
> > tc-1.15.1-x86_64-unknown-linux-gnu.tar.gz
> > +sha256
> > eff452a54b208a83b35432f226cb7de046d27b5e43edfc31d71ff340af686db0  rus
> > t-std-1.15.1-i686-unknown-linux-gnu.tar.gz
> > +sha256
> > 69b251b478e284dfcaefc1153183f26f41d504ae213a81224f2101d8dbd52bb0  rus
> > t-std-1.15.1-x86_64-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..1098423
> > --- /dev/null
> > +++ b/package/rust-bootstrap/rust-bootstrap.mk
> > @@ -0,0 +1,37 @@
> > +####################################################################
> > ############
> > +#
> > +# rust-bootstrap
> > +#
> > +####################################################################
> > ############
> > +
> > +RUST_BOOTSTRAP_VERSION = 1.15.1
> > +RUST_BOOTSTRAP_DATE = 2017-02-09
> > +RUST_BOOTSTRAP_TRIPLE = $(RUST_BOOTSTRAP_ARCH)-unknown-linux-gnu
> > +RUST_BOOTSTRAP_LABEL = $(RUST_BOOTSTRAP_VERSION)-
> > $(RUST_BOOTSTRAP_TRIPLE)
> > +
> > +ifeq ($(HOSTARCH),x86_64)
> > +RUST_BOOTSTRAP_ARCH = x86_64
> > +else ifeq ($(HOSTARCH),x86)
> > +RUST_BOOTSTRAP_ARCH = i686
> > +endif
>
> Is there any necessity to limit the bootstrap compiler to those host
> archs only?

I've limited the bootstrap compiler to i686 and x86_64 as these
architectures are listed as tier 1 of the Rust platform support [1].

PowerPC is in tier 2. If some Buildroot users are using pre-2005 Macs,
I can add it.

[1] https://forge.rust-lang.org/platform-support.html
>
> > +RUST_BOOTSTRAP_SITE = https://static.rust-
> > lang.org/dist/$(RUST_BOOTSTRAP_DATE)
>
> Why use a date and not https://static.rust-lang.org/dist solely. Since
> I can fetch https://static.rust-lang.org/dist/rust-1.15.1-x86_64-unknow
> n-linux-gnu.tar.gz.

Good catch! This part is a leftover from the early versions of this
patch series when Rust compiler version N could not be bootstrapped from
version N-1 but an obscure nightly one. I'll change this.

>
> > +RUST_BOOTSTRAP_SOURCE = rustc-$(RUST_BOOTSTRAP_LABEL).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_LABEL).tar.gz
> > +RUST_BOOTSTRAP_LIBSTD_ROOT = rust-std-$(RUST_BOOTSTRAP_LABEL)/rust-
> > std-$(RUST_BOOTSTRAP_TRIPLE)
>
> Why not make a seperate package?

I though about making it a separate package to clarify the Makefile, but
the library on its own is useless, so why expose it? This is just an
internal build dependency, like perl-cross in package/perl/perl.mk.

> > +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))
>
> Jörg

--
ELB
diff mbox

Patch

diff --git a/DEVELOPERS b/DEVELOPERS
index c89468b..863d5aa 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -448,6 +448,7 @@  F:	package/execline/
 F:	package/hicolor-icon-theme/
 F:	package/jemalloc/
 F:	package/ninja/
+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..b418ea0
--- /dev/null
+++ b/package/rust-bootstrap/rust-bootstrap.hash
@@ -0,0 +1,5 @@ 
+# Locally calculated
+sha256 a833304f99071600c72ecd868c1c7bd5ce49d1102332637a8eb7adb942f349ab  rustc-1.15.1-i686-unknown-linux-gnu.tar.gz
+sha256 33ff44672b731fc71145974ce84194a1a9bafe6da3a74fd1e7543f12467f8894  rustc-1.15.1-x86_64-unknown-linux-gnu.tar.gz
+sha256 eff452a54b208a83b35432f226cb7de046d27b5e43edfc31d71ff340af686db0  rust-std-1.15.1-i686-unknown-linux-gnu.tar.gz
+sha256 69b251b478e284dfcaefc1153183f26f41d504ae213a81224f2101d8dbd52bb0  rust-std-1.15.1-x86_64-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..1098423
--- /dev/null
+++ b/package/rust-bootstrap/rust-bootstrap.mk
@@ -0,0 +1,37 @@ 
+################################################################################
+#
+# rust-bootstrap
+#
+################################################################################
+
+RUST_BOOTSTRAP_VERSION = 1.15.1
+RUST_BOOTSTRAP_DATE = 2017-02-09
+RUST_BOOTSTRAP_TRIPLE = $(RUST_BOOTSTRAP_ARCH)-unknown-linux-gnu
+RUST_BOOTSTRAP_LABEL = $(RUST_BOOTSTRAP_VERSION)-$(RUST_BOOTSTRAP_TRIPLE)
+
+ifeq ($(HOSTARCH),x86_64)
+RUST_BOOTSTRAP_ARCH = x86_64
+else ifeq ($(HOSTARCH),x86)
+RUST_BOOTSTRAP_ARCH = i686
+endif
+
+RUST_BOOTSTRAP_SITE = https://static.rust-lang.org/dist/$(RUST_BOOTSTRAP_DATE)
+
+RUST_BOOTSTRAP_SOURCE = rustc-$(RUST_BOOTSTRAP_LABEL).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_LABEL).tar.gz
+RUST_BOOTSTRAP_LIBSTD_ROOT = rust-std-$(RUST_BOOTSTRAP_LABEL)/rust-std-$(RUST_BOOTSTRAP_TRIPLE)
+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))