From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?ISO-8859-1?Q?J=F6rg?= Krause Date: Sun, 23 Jul 2017 15:14:24 +0200 Subject: [Buildroot] [Patch v7 01/10] rustc: new virtual package In-Reply-To: <20170723081206.7774-2-eric.le.bihan.dev@free.fr> References: <20170723081206.7774-1-eric.le.bihan.dev@free.fr> <20170723081206.7774-2-eric.le.bihan.dev@free.fr> Message-ID: <1500815664.2333.5.camel@embedded.rocks> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: buildroot@busybox.net 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 > --- > 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.