Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [Patch v5 0/7] Add support for the Rust programming language
@ 2017-04-22 17:38 Eric Le Bihan
  2017-04-22 17:38 ` [Buildroot] [Patch v5 1/7] pkg-virtual: fix host dependencies handling Eric Le Bihan
                   ` (7 more replies)
  0 siblings, 8 replies; 10+ messages in thread
From: Eric Le Bihan @ 2017-04-22 17:38 UTC (permalink / raw)
  To: buildroot

This series adds support for the Rust programming language by adding the
following packages:

 - rustc: a virtual package for the Rust compiler.
 - rust-bin: provides a pre-built version of rustc.
 - rust: builds rustc from source.

Both providers are able to cross-compile code for ARM, MIPS, PowerPC and
x86_64 architectures. Only the host variants are provided.

The rustc virtual package is inspired by the mysql one.

As the Rust compiler is written in Rust and uses Cargo, the Rust package
manager, as build system, two additional packages are provided: rust-bootstrap
and cargo-bootstrap.

v4 -> v5:

 - add rustc virtual package
 - add rust-bin, provider for rustc
 - rework rust to be a provider for rustc
 - rework some commit messages

v3 -> v4:

 - bump rust to 1.16.0
 - bump rust-bootstrap to 1.15.1
 - add cargo-bootstrap
 - use built-in target specifications
 - drop external Python script to generate target specifications
 - enable support for PowerPC
 - expose host variant in menuconfig

v2 -> v3:

 - bump rust to 1.10.0
 - rework and bump rust-bootstrap to 1.9.0
 - host-rust requires at least GCC 4.7 because of LLVM (suggested by R. Naour)
 - rust requires a glibc-based cross-compiler
 - rust requires GCC 5.x or above for Aarch64

v1 -> v2:

 - bump rust to version 1.9.0.
 - drop patch for bzip2 support in host-python.
 - add package for jemalloc.
 - add dependency on host being a x86 machine.
 - add dependency on toolchain.
 - use dedicated package to provide bootstrapping binary: rust-bootstrap.
 - let ./configure find out host/build on its own.
 - remove entry from configuration menu.
 - clarify some comments.
Eric Le Bihan (7):
  pkg-virtual: fix host dependencies handling
  rustc: new virtual package
  rust-bin: new package
  rustc: expose host variant in menuconfig
  rust-bootstrap: new package
  cargo-bootstrap: new package
  rust: new package

 DEVELOPERS                                   |  4 ++
 package/Config.in.host                       |  1 +
 package/cargo-bootstrap/cargo-bootstrap.hash |  3 ++
 package/cargo-bootstrap/cargo-bootstrap.mk   | 14 +++++
 package/pkg-virtual.mk                       |  4 ++
 package/rust-bin/rust-bin.hash               | 30 +++++++++++
 package/rust-bin/rust-bin.mk                 | 41 +++++++++++++++
 package/rust-bootstrap/rust-bootstrap.hash   |  5 ++
 package/rust-bootstrap/rust-bootstrap.mk     | 27 ++++++++++
 package/rust/rust.hash                       |  2 +
 package/rust/rust.mk                         | 77 ++++++++++++++++++++++++++++
 package/rustc/Config.in.host                 | 61 ++++++++++++++++++++++
 package/rustc/rustc.mk                       | 21 ++++++++
 13 files changed, 290 insertions(+)
 create mode 100644 package/cargo-bootstrap/cargo-bootstrap.hash
 create mode 100644 package/cargo-bootstrap/cargo-bootstrap.mk
 create mode 100644 package/rust-bin/rust-bin.hash
 create mode 100644 package/rust-bin/rust-bin.mk
 create mode 100644 package/rust-bootstrap/rust-bootstrap.hash
 create mode 100644 package/rust-bootstrap/rust-bootstrap.mk
 create mode 100644 package/rust/rust.hash
 create mode 100644 package/rust/rust.mk
 create mode 100644 package/rustc/Config.in.host
 create mode 100644 package/rustc/rustc.mk

-- 
2.9.3

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Buildroot] [Patch v5 1/7] pkg-virtual: fix host dependencies handling
  2017-04-22 17:38 [Buildroot] [Patch v5 0/7] Add support for the Rust programming language Eric Le Bihan
@ 2017-04-22 17:38 ` Eric Le Bihan
  2017-05-01  8:58   ` Yann E. MORIN
  2017-04-22 17:38 ` [Buildroot] [Patch v5 2/7] rustc: new virtual package Eric Le Bihan
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 10+ messages in thread
From: Eric Le Bihan @ 2017-04-22 17:38 UTC (permalink / raw)
  To: buildroot

If $(BR2_PACKAGE_HAS_HOST_FOO) is defined, then the pkg-virtual
infrastructure will check if $(BR2_PACKAGE_PROVIDES_HOST_FOO) is not
empty.

But later, $(BR2_PACKAGE_HOST_FOO_DEPENDENCIES) will be set from
$(BR2_PACKAGE_PROVIDES_FOO), ignoring $(BR2_PACKAGE_PROVIDES_HOST_FOO).

So fix this discrepancy by setting $(BR2_PACKAGE_HOST_FOO_DEPENDENCIES)
from $(BR2_PACKAGE_PROVIDES_FOO) only if $(BR2_PACKAGE_PROVIDES_HOST_FOO)
is empty.

Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
---
 package/pkg-virtual.mk | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/package/pkg-virtual.mk b/package/pkg-virtual.mk
index 2e83e07..b8878ad 100644
--- a/package/pkg-virtual.mk
+++ b/package/pkg-virtual.mk
@@ -49,7 +49,11 @@ $(2)_IS_VIRTUAL = YES
 ifeq ($(4),target)
 $(2)_DEPENDENCIES += $$(call qstrip,$$(BR2_PACKAGE_PROVIDES_$(2)))
 else
+ifeq ($$(call qstrip,$$(BR2_PACKAGE_PROVIDES_$(2))),)
 $(2)_DEPENDENCIES += host-$$(call qstrip,$$(BR2_PACKAGE_PROVIDES_$(3)))
+else
+$(2)_DEPENDENCIES += $$(call qstrip,$$(BR2_PACKAGE_PROVIDES_$(2)))
+endif
 endif
 
 # Call the generic package infrastructure to generate the necessary
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Buildroot] [Patch v5 2/7] rustc: new virtual package
  2017-04-22 17:38 [Buildroot] [Patch v5 0/7] Add support for the Rust programming language Eric Le Bihan
  2017-04-22 17:38 ` [Buildroot] [Patch v5 1/7] pkg-virtual: fix host dependencies handling Eric Le Bihan
@ 2017-04-22 17:38 ` Eric Le Bihan
  2017-04-22 17:38 ` [Buildroot] [Patch v5 3/7] rust-bin: new package Eric Le Bihan
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Eric Le Bihan @ 2017-04-22 17:38 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       | 21 +++++++++++++++++++++
 2 files changed, 26 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..fc743fa
--- /dev/null
+++ b/package/rustc/rustc.mk
@@ -0,0 +1,21 @@
+################################################################################
+#
+# 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 ($(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.3

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Buildroot] [Patch v5 3/7] rust-bin: new package
  2017-04-22 17:38 [Buildroot] [Patch v5 0/7] Add support for the Rust programming language Eric Le Bihan
  2017-04-22 17:38 ` [Buildroot] [Patch v5 1/7] pkg-virtual: fix host dependencies handling Eric Le Bihan
  2017-04-22 17:38 ` [Buildroot] [Patch v5 2/7] rustc: new virtual package Eric Le Bihan
@ 2017-04-22 17:38 ` Eric Le Bihan
  2017-04-22 17:38 ` [Buildroot] [Patch v5 4/7] rustc: expose host variant in menuconfig Eric Le Bihan
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Eric Le Bihan @ 2017-04-22 17:38 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 123a8f9..b352042 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -451,6 +451,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..42988f8
--- /dev/null
+++ b/package/rust-bin/rust-bin.hash
@@ -0,0 +1,30 @@
+# From https://static.rust-lang.org/dist/rustc-1.16.0-i686-unknown-linux-gnu.tar.gz.sha256
+sha256 f8e0f96c17d8345be7818035e9bcae8e809a1b13635fe9a322df4a82d6dd1275  rustc-1.16.0-i686-unknown-linux-gnu.tar.gz
+# From https://static.rust-lang.org/dist/rustc-1.16.0-x86_64-unknown-linux-gnu.tar.gz.sha256
+sha256 b1dc3f754eeaf03891a3bd398c8c5024404c0078a334e5d8795e9dc419d147b3  rustc-1.16.0-x86_64-unknown-linux-gnu.tar.gz
+# From https://static.rust-lang.org/dist/rust-std-1.16.0-aarch64-unknown-linux-gnu.tar.gz.sha256
+sha256 dafe92282dd5ca67f95c5b8cc2a729b2f8cb04d6e30c6d790819a27f0119d8ca  rust-std-1.16.0-aarch64-unknown-linux-gnu.tar.gz
+# From https://static.rust-lang.org/dist/rust-std-1.16.0-arm-unknown-linux-gnueabi.tar.gz.sha256
+sha256 b220d8c0fd1a5039b91181fd083e96c9b48c71fb5892e98ec99e60e4ac4bb29d  rust-std-1.16.0-arm-unknown-linux-gnueabi.tar.gz
+# From https://static.rust-lang.org/dist/rust-std-1.16.0-arm-unknown-linux-gnueabihf.tar.gz.sha256
+sha256 bc7846a432d672995bf7ef349a79ee422a003b808579996fe0a30f335dce16f4  rust-std-1.16.0-arm-unknown-linux-gnueabihf.tar.gz
+# From https://static.rust-lang.org/dist/rust-std-1.16.0-armv7-unknown-linux-gnueabihf.tar.gz.sha256
+sha256 dd6869bf2d2f31711d327ac9a5e42667a65b3fa9476e36a4c6418cb1cc5109fb  rust-std-1.16.0-armv7-unknown-linux-gnueabihf.tar.gz
+# From https://static.rust-lang.org/dist/rust-std-1.16.0-i686-unknown-linux-gnu.tar.gz.sha256
+sha256 5a74e3661f4b300bf73353389acab097f3e07813b0f3073007830a549656054a  rust-std-1.16.0-i686-unknown-linux-gnu.tar.gz
+# From https://static.rust-lang.org/dist/rust-std-1.16.0-mips-unknown-linux-gnu.tar.gz.sha256
+sha256 0d2f91ce61e261e11f44732ea3bdf04c2dd498f441b89b3ab1cf0eebc6d0b8cb  rust-std-1.16.0-mips-unknown-linux-gnu.tar.gz
+# From https://static.rust-lang.org/dist/rust-std-1.16.0-mips64-unknown-linux-gnuabi64.tar.gz.sha256
+sha256 2c0cca2d97f79b4027c9ff0ebde611fae527b2c6ce1accddd6b4b3936a4c8a8c  rust-std-1.16.0-mips64-unknown-linux-gnuabi64.tar.gz
+# From https://static.rust-lang.org/dist/rust-std-1.16.0-mips64el-unknown-linux-gnuabi64.tar.gz.sha256
+sha256 5396748787b81e2d136bcd3ed8a86ca1b0b77b469e0065d14002815000fb6c42  rust-std-1.16.0-mips64el-unknown-linux-gnuabi64.tar.gz
+# From https://static.rust-lang.org/dist/rust-std-1.16.0-mipsel-unknown-linux-gnu.tar.gz.sha256
+sha256 deeade93a16fa3c2258fb11ca2cbc31fa22e721c89f5db7457ac233351efe073  rust-std-1.16.0-mipsel-unknown-linux-gnu.tar.gz
+# From https://static.rust-lang.org/dist/rust-std-1.16.0-powerpc-unknown-linux-gnu.tar.gz.sha256
+sha256 a8faf140202c3ad35fd335b32c4b0ce14aad0ef5b9485b9a542b1bb8aa495a7a  rust-std-1.16.0-powerpc-unknown-linux-gnu.tar.gz
+# From https://static.rust-lang.org/dist/rust-std-1.16.0-powerpc64-unknown-linux-gnu.tar.gz.sha256
+sha256 b8d1e47adaef06a05fb021071e4dca1469422056352ad77a74be2a5a3a95099e  rust-std-1.16.0-powerpc64-unknown-linux-gnu.tar.gz
+# From https://static.rust-lang.org/dist/rust-std-1.16.0-powerpc64le-unknown-linux-gnu.tar.gz.sha256
+sha256 0cd7f99ef3e620865781bd13a89a1de3dc46593f9de6927d52c47f8d44a31d26  rust-std-1.16.0-powerpc64le-unknown-linux-gnu.tar.gz
+# From https://static.rust-lang.org/dist/rust-std-1.16.0-x86_64-unknown-linux-gnu.tar.gz.sha256
+sha256 cbd43de2ab819d3332ce309046f3b5d715c1b47877a237791b99c96b1fe0d555  rust-std-1.16.0-x86_64-unknown-linux-gnu.tar.gz
diff --git a/package/rust-bin/rust-bin.mk b/package/rust-bin/rust-bin.mk
new file mode 100644
index 0000000..8310c40
--- /dev/null
+++ b/package/rust-bin/rust-bin.mk
@@ -0,0 +1,41 @@
+################################################################################
+#
+# rust-bin
+#
+################################################################################
+
+RUST_BIN_VERSION = 1.16.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.gz
+HOST_RUST_BIN_LIBSTD_SOURCES = \
+	rust-std-$(RUST_BIN_VERSION)-$(RUST_HOST_NAME).tar.gz \
+	rust-std-$(RUST_BIN_VERSION)-$(RUST_TARGET_NAME).tar.gz
+
+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 -xzf $${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)/usr \
+			--docdir=$(HOST_DIR)/usr/share/doc/rust \
+			--libdir=$(HOST_DIR)/usr/lib \
+			--mandir=$(HOST_DIR)/usr/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.3

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Buildroot] [Patch v5 4/7] rustc: expose host variant in menuconfig
  2017-04-22 17:38 [Buildroot] [Patch v5 0/7] Add support for the Rust programming language Eric Le Bihan
                   ` (2 preceding siblings ...)
  2017-04-22 17:38 ` [Buildroot] [Patch v5 3/7] rust-bin: new package Eric Le Bihan
@ 2017-04-22 17:38 ` Eric Le Bihan
  2017-04-22 17:38 ` [Buildroot] [Patch v5 5/7] rust-bootstrap: new package Eric Le Bihan
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Eric Le Bihan @ 2017-04-22 17:38 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 38f919a..49fcdb0 100644
--- a/package/Config.in.host
+++ b/package/Config.in.host
@@ -39,6 +39,7 @@ menu "Host utilities"
 	source "package/python-lxml/Config.in.host"
 	source "package/qemu/Config.in.host"
 	source "package/raspberrypi-usbboot/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.3

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Buildroot] [Patch v5 5/7] rust-bootstrap: new package
  2017-04-22 17:38 [Buildroot] [Patch v5 0/7] Add support for the Rust programming language Eric Le Bihan
                   ` (3 preceding siblings ...)
  2017-04-22 17:38 ` [Buildroot] [Patch v5 4/7] rustc: expose host variant in menuconfig Eric Le Bihan
@ 2017-04-22 17:38 ` Eric Le Bihan
  2017-04-22 17:38 ` [Buildroot] [Patch v5 6/7] cargo-bootstrap: " Eric Le Bihan
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Eric Le Bihan @ 2017-04-22 17:38 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 |  5 +++++
 package/rust-bootstrap/rust-bootstrap.mk   | 27 +++++++++++++++++++++++++++
 3 files changed, 33 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 b352042..f707f2d 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -452,6 +452,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..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..a49ac25
--- /dev/null
+++ b/package/rust-bootstrap/rust-bootstrap.mk
@@ -0,0 +1,27 @@
+################################################################################
+#
+# rust-bootstrap
+#
+################################################################################
+
+RUST_BOOTSTRAP_VERSION = 1.15.1
+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.3

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Buildroot] [Patch v5 6/7] cargo-bootstrap: new package
  2017-04-22 17:38 [Buildroot] [Patch v5 0/7] Add support for the Rust programming language Eric Le Bihan
                   ` (4 preceding siblings ...)
  2017-04-22 17:38 ` [Buildroot] [Patch v5 5/7] rust-bootstrap: new package Eric Le Bihan
@ 2017-04-22 17:38 ` Eric Le Bihan
  2017-04-22 17:38 ` [Buildroot] [Patch v5 7/7] rust: " Eric Le Bihan
  2017-04-24 18:27 ` [Buildroot] [Patch v5 0/7] Add support for the Rust programming language Jörg Krause
  7 siblings, 0 replies; 10+ messages in thread
From: Eric Le Bihan @ 2017-04-22 17:38 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.

Note that, contrary to rust-bootstrap which fetches version N-1 of the
rustc binary, this package fetches a nightly version of the cargo
binary, as upstream does not provide binaries for stable releases.

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 f707f2d..b323efd 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -445,6 +445,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..b193c6f
--- /dev/null
+++ b/package/cargo-bootstrap/cargo-bootstrap.hash
@@ -0,0 +1,3 @@
+# Locally generated
+sha256 0655713cacab054e8e5a33e742081eebec8531a8c77d28a4294e6496123e8ab1  cargo-nightly-x86_64-unknown-linux-gnu.tar.gz
+sha256 f20adfdcd6fb61c1252034e998998ec349c8a6b05c0320e47a539b0f6d1c76fa  cargo-nightly-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..8a11e6e
--- /dev/null
+++ b/package/cargo-bootstrap/cargo-bootstrap.mk
@@ -0,0 +1,14 @@
+################################################################################
+#
+# cargo-bootstrap
+#
+################################################################################
+
+CARGO_BOOTSTRAP_VERSION = 6e0c18cccc8b0c06fba8a8d76486f81a792fb420
+CARGO_BOOTSTRAP_SITE = https://s3.amazonaws.com/rust-lang-ci/cargo-builds/$(CARGO_BOOTSTRAP_VERSION)
+CARGO_BOOTSTRAP_SOURCE = cargo-nightly-$(HOSTARCH)-unknown-linux-gnu.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.3

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Buildroot] [Patch v5 7/7] rust: new package
  2017-04-22 17:38 [Buildroot] [Patch v5 0/7] Add support for the Rust programming language Eric Le Bihan
                   ` (5 preceding siblings ...)
  2017-04-22 17:38 ` [Buildroot] [Patch v5 6/7] cargo-bootstrap: " Eric Le Bihan
@ 2017-04-22 17:38 ` Eric Le Bihan
  2017-04-24 18:27 ` [Buildroot] [Patch v5 0/7] Add support for the Rust programming language Jörg Krause
  7 siblings, 0 replies; 10+ messages in thread
From: Eric Le Bihan @ 2017-04-22 17:38 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         | 77 ++++++++++++++++++++++++++++++++++++++++++++
 package/rustc/Config.in.host | 15 +++++++++
 4 files changed, 95 insertions(+)
 create mode 100644 package/rust/rust.hash
 create mode 100644 package/rust/rust.mk

diff --git a/DEVELOPERS b/DEVELOPERS
index b323efd..57af5ed 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -454,6 +454,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..3b04dfd
--- /dev/null
+++ b/package/rust/rust.hash
@@ -0,0 +1,2 @@
+# Locally calculated
+sha256 f966b31eb1cd9bd2df817c391a338eeb5b9253ae0a19bf8a11960c560f96e8b4  rustc-1.16.0-src.tar.gz
diff --git a/package/rust/rust.mk b/package/rust/rust.mk
new file mode 100644
index 0000000..540e9ff
--- /dev/null
+++ b/package/rust/rust.mk
@@ -0,0 +1,77 @@
+################################################################################
+#
+# rust
+#
+################################################################################
+
+RUST_VERSION = 1.16.0
+RUST_SOURCE = rustc-$(RUST_VERSION)-src.tar.gz
+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_BUILD_OPTS = $(if $(VERBOSE),--verbose)
+
+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)/usr/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 '[install]' >> config.toml; \
+		echo 'prefix = "$(HOST_DIR)/usr"' >> 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)/usr \
+			--docdir=$(HOST_DIR)/usr/share/doc/rust \
+			--libdir=$(HOST_DIR)/usr/lib \
+			--mandir=$(HOST_DIR)/usr/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 \
+		dist --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.3

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Buildroot] [Patch v5 0/7] Add support for the Rust programming language
  2017-04-22 17:38 [Buildroot] [Patch v5 0/7] Add support for the Rust programming language Eric Le Bihan
                   ` (6 preceding siblings ...)
  2017-04-22 17:38 ` [Buildroot] [Patch v5 7/7] rust: " Eric Le Bihan
@ 2017-04-24 18:27 ` Jörg Krause
  7 siblings, 0 replies; 10+ messages in thread
From: Jörg Krause @ 2017-04-24 18:27 UTC (permalink / raw)
  To: buildroot

Hi Eric,

On Sat, 2017-04-22 at 19:38 +0200, Eric Le Bihan wrote:
> This series adds support for the Rust programming language by adding the
> following packages:
> 
>  - rustc: a virtual package for the Rust compiler.
>  - rust-bin: provides a pre-built version of rustc.
>  - rust: builds rustc from source.
> 
> Both providers are able to cross-compile code for ARM, MIPS, PowerPC and
> x86_64 architectures. Only the host variants are provided.
> 
> The rustc virtual package is inspired by the mysql one.
> 
> As the Rust compiler is written in Rust and uses Cargo, the Rust package
> manager, as build system, two additional packages are provided: rust-bootstrap
> and cargo-bootstrap.

Many thanks for the work! I'll look into it, when I've some spare time.

J?rg

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Buildroot] [Patch v5 1/7] pkg-virtual: fix host dependencies handling
  2017-04-22 17:38 ` [Buildroot] [Patch v5 1/7] pkg-virtual: fix host dependencies handling Eric Le Bihan
@ 2017-05-01  8:58   ` Yann E. MORIN
  0 siblings, 0 replies; 10+ messages in thread
From: Yann E. MORIN @ 2017-05-01  8:58 UTC (permalink / raw)
  To: buildroot

Eric, All,

On 2017-04-22 19:38 +0200, Eric Le Bihan spake thusly:
> If $(BR2_PACKAGE_HAS_HOST_FOO) is defined, then the pkg-virtual
> infrastructure will check if $(BR2_PACKAGE_PROVIDES_HOST_FOO) is not
> empty.
> 
> But later, $(BR2_PACKAGE_HOST_FOO_DEPENDENCIES) will be set from
> $(BR2_PACKAGE_PROVIDES_FOO), ignoring $(BR2_PACKAGE_PROVIDES_HOST_FOO).
> 
> So fix this discrepancy by setting $(BR2_PACKAGE_HOST_FOO_DEPENDENCIES)
> from $(BR2_PACKAGE_PROVIDES_FOO) only if $(BR2_PACKAGE_PROVIDES_HOST_FOO)
> is empty.
> 
> Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>

Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Regards,
Yann E. MORIN.

> ---
>  package/pkg-virtual.mk | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/package/pkg-virtual.mk b/package/pkg-virtual.mk
> index 2e83e07..b8878ad 100644
> --- a/package/pkg-virtual.mk
> +++ b/package/pkg-virtual.mk
> @@ -49,7 +49,11 @@ $(2)_IS_VIRTUAL = YES
>  ifeq ($(4),target)
>  $(2)_DEPENDENCIES += $$(call qstrip,$$(BR2_PACKAGE_PROVIDES_$(2)))
>  else
> +ifeq ($$(call qstrip,$$(BR2_PACKAGE_PROVIDES_$(2))),)
>  $(2)_DEPENDENCIES += host-$$(call qstrip,$$(BR2_PACKAGE_PROVIDES_$(3)))
> +else
> +$(2)_DEPENDENCIES += $$(call qstrip,$$(BR2_PACKAGE_PROVIDES_$(2)))
> +endif
>  endif
>  
>  # Call the generic package infrastructure to generate the necessary
> -- 
> 2.9.3
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-05-01  8:58 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-22 17:38 [Buildroot] [Patch v5 0/7] Add support for the Rust programming language Eric Le Bihan
2017-04-22 17:38 ` [Buildroot] [Patch v5 1/7] pkg-virtual: fix host dependencies handling Eric Le Bihan
2017-05-01  8:58   ` Yann E. MORIN
2017-04-22 17:38 ` [Buildroot] [Patch v5 2/7] rustc: new virtual package Eric Le Bihan
2017-04-22 17:38 ` [Buildroot] [Patch v5 3/7] rust-bin: new package Eric Le Bihan
2017-04-22 17:38 ` [Buildroot] [Patch v5 4/7] rustc: expose host variant in menuconfig Eric Le Bihan
2017-04-22 17:38 ` [Buildroot] [Patch v5 5/7] rust-bootstrap: new package Eric Le Bihan
2017-04-22 17:38 ` [Buildroot] [Patch v5 6/7] cargo-bootstrap: " Eric Le Bihan
2017-04-22 17:38 ` [Buildroot] [Patch v5 7/7] rust: " Eric Le Bihan
2017-04-24 18:27 ` [Buildroot] [Patch v5 0/7] Add support for the Rust programming language Jörg Krause

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox