Message ID | 20180204180749.29942-2-eric.le.bihan.dev@free.fr |
---|---|
State | Accepted |
Commit | 40e6e08d0b1a241ae4175952d4b2a22fdde5a48d |
Headers | show |
Series | Add support for the Rust programming language | expand |
Hello, +Peter, Arnout, Ricardo in Cc. On Sun, 4 Feb 2018 19:07:40 +0100, Eric Le Bihan wrote: > diff --git a/package/rustc/rustc.mk b/package/rustc/rustc.mk > new file mode 100644 > index 0000000000..7a951c0cfd > --- /dev/null > +++ b/package/rustc/rustc.mk > @@ -0,0 +1,20 @@ > +################################################################################ > +# > +# rustc > +# > +################################################################################ > + > +RUSTC_ARCH = $(call qstrip,$(BR2_PACKAGE_HOST_RUSTC_ARCH)) > +RUSTC_ABI = $(call qstrip,$(BR2_PACKAGE_HOST_RUSTC_ABI)) > + > +RUST_TARGET_NAME = $(RUSTC_ARCH)-unknown-linux-gnu$(RUSTC_ABI) > + > +ifeq ($(HOSTARCH),x86) > +RUSTC_HOST_ARCH = i686 > +else > +RUSTC_HOST_ARCH = $(HOSTARCH) > +endif > + > +RUST_HOST_NAME = $(RUSTC_HOST_ARCH)-unknown-linux-gnu check-package is not happy with RUST_TARGET_NAME and RUST_HOST_NAME because they don't have a RUSTC_ prefix, even though they are defined in rustc.mk: ./package/rustc/rustc.mk:10: possible typo: RUST_TARGET_NAME -> *RUSTC* ./package/rustc/rustc.mk:18: possible typo: RUST_HOST_NAME -> *RUSTC* Would renaming them to RUSTC_TARGET_NAME and RUSTC_HOST_NAME make sense ? Or do we need to keep RUST_TARGET_NAME/RUST_HOST_NAME and add an exception in check-package ? Thanks for your feedback, Thomas
On 2018-02-08 23:52, Thomas Petazzoni wrote: > Hello, > > +Peter, Arnout, Ricardo in Cc. > > On Sun, 4 Feb 2018 19:07:40 +0100, Eric Le Bihan wrote: > > > diff --git a/package/rustc/rustc.mk b/package/rustc/rustc.mk > > new file mode 100644 > > index 0000000000..7a951c0cfd > > --- /dev/null > > +++ b/package/rustc/rustc.mk > > @@ -0,0 +1,20 @@ > > +################################################################################ > > +# > > +# rustc > > +# > > +################################################################################ > > + > > +RUSTC_ARCH = $(call qstrip,$(BR2_PACKAGE_HOST_RUSTC_ARCH)) > > +RUSTC_ABI = $(call qstrip,$(BR2_PACKAGE_HOST_RUSTC_ABI)) > > + > > +RUST_TARGET_NAME = $(RUSTC_ARCH)-unknown-linux-gnu$(RUSTC_ABI) > > + > > +ifeq ($(HOSTARCH),x86) > > +RUSTC_HOST_ARCH = i686 > > +else > > +RUSTC_HOST_ARCH = $(HOSTARCH) > > +endif > > + > > +RUST_HOST_NAME = $(RUSTC_HOST_ARCH)-unknown-linux-gnu > > check-package is not happy with RUST_TARGET_NAME and RUST_HOST_NAME > because they don't have a RUSTC_ prefix, even though they are defined > in rustc.mk: > > ./package/rustc/rustc.mk:10: possible typo: RUST_TARGET_NAME -> *RUSTC* > ./package/rustc/rustc.mk:18: possible typo: RUST_HOST_NAME -> *RUSTC* > > Would renaming them to RUSTC_TARGET_NAME and RUSTC_HOST_NAME make > sense ? Or do we need to keep RUST_TARGET_NAME/RUST_HOST_NAME and add > an exception in check-package ? I do not see any problems using RUSTC_{HOST,TARGET}_NAME: it still caries the same information as RUST_{HOST,TARGET}_NAME. Regards, -- ELB
Hello, On Fri, 9 Feb 2018 09:49:06 +0100, Eric Le Bihan wrote: > > check-package is not happy with RUST_TARGET_NAME and RUST_HOST_NAME > > because they don't have a RUSTC_ prefix, even though they are defined > > in rustc.mk: > > > > ./package/rustc/rustc.mk:10: possible typo: RUST_TARGET_NAME -> *RUSTC* > > ./package/rustc/rustc.mk:18: possible typo: RUST_HOST_NAME -> *RUSTC* > > > > Would renaming them to RUSTC_TARGET_NAME and RUSTC_HOST_NAME make > > sense ? Or do we need to keep RUST_TARGET_NAME/RUST_HOST_NAME and add > > an exception in check-package ? > > I do not see any problems using RUSTC_{HOST,TARGET}_NAME: it still caries > the same information as RUST_{HOST,TARGET}_NAME. Question is: are these host and target names "Rust" related, or "Rust compiler" related. If they are Rust related, the current RUST_ prefix makes more sense. If they are specific to the Rust compiler, then RUSTC_ would make more sense. If it isn't clear, then we can use RUSTC_ to avoid the problem :-) If you are happy with RUSTC_, could you submit a patch against "master" that does the renaming ? Thanks! Thomas
On 2018-02-09 09:56, Thomas Petazzoni wrote: > Hello, > > On Fri, 9 Feb 2018 09:49:06 +0100, Eric Le Bihan wrote: > > > > check-package is not happy with RUST_TARGET_NAME and RUST_HOST_NAME > > > because they don't have a RUSTC_ prefix, even though they are defined > > > in rustc.mk: > > > > > > ./package/rustc/rustc.mk:10: possible typo: RUST_TARGET_NAME -> *RUSTC* > > > ./package/rustc/rustc.mk:18: possible typo: RUST_HOST_NAME -> *RUSTC* > > > > > > Would renaming them to RUSTC_TARGET_NAME and RUSTC_HOST_NAME make > > > sense ? Or do we need to keep RUST_TARGET_NAME/RUST_HOST_NAME and add > > > an exception in check-package ? > > > > I do not see any problems using RUSTC_{HOST,TARGET}_NAME: it still caries > > the same information as RUST_{HOST,TARGET}_NAME. > > Question is: are these host and target names "Rust" related, or "Rust > compiler" related. If they are Rust related, the current RUST_ prefix > makes more sense. If they are specific to the Rust compiler, then > RUSTC_ would make more sense. If it isn't clear, then we can use RUSTC_ > to avoid the problem :-) As RUSTC_{HOST,TARGET}_NAME is passed to the Rust compiler by the --target option, it is "Rust compiler" related. So the renaming makes sense. > If you are happy with RUSTC_, could you submit a patch against "master" > that does the renaming ? Should I provide a global patch or a series of patches, one for each affected package? Regards, -- ELB
diff --git a/package/Config.in.host b/package/Config.in.host index dd6415bba5..2f20dd0e48 100644 --- a/package/Config.in.host +++ b/package/Config.in.host @@ -46,6 +46,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" diff --git a/package/rustc/Config.in.host b/package/rustc/Config.in.host new file mode 100644 index 0000000000..a49f635d65 --- /dev/null +++ b/package/rustc/Config.in.host @@ -0,0 +1,31 @@ +config BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS + bool + depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" + # The pre-built Rust standard library is only available for the + # following architectures/ABIs, and is built against glibc. + default y if BR2_i386 + default y if BR2_x86_64 + default y if BR2_aarch64 + default y if BR2_arm && !BR2_ARM_CPU_ARMV4 && !BR2_ARM_CPU_ARMV5 + default y if BR2_powerpc || BR2_powerpc64 + default y if (BR2_mips || BR2_mipsel) && !BR2_MIPS_CPU_MIPS32R6 + default y if (BR2_mips64 || BR2_mips64el) && !BR2_MIPS_CPU_MIPS64R6 \ + && BR2_MIPS_NABI64 + depends on BR2_TOOLCHAIN_USES_GLIBC + +config BR2_PACKAGE_HOST_RUSTC_ARCH + string + default "armv7" if BR2_ARM_CPU_ARMV7A + default BR2_ARCH if !BR2_ARM_CPU_ARMV7A + +config BR2_PACKAGE_HOST_RUSTC_ABI + string + default "eabi" if BR2_ARM_EABI + default "eabihf" if BR2_ARM_EABIHF + default "abi64" if BR2_MIPS_NABI64 + +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 0000000000..7a951c0cfd --- /dev/null +++ b/package/rustc/rustc.mk @@ -0,0 +1,20 @@ +################################################################################ +# +# rustc +# +################################################################################ + +RUSTC_ARCH = $(call qstrip,$(BR2_PACKAGE_HOST_RUSTC_ARCH)) +RUSTC_ABI = $(call qstrip,$(BR2_PACKAGE_HOST_RUSTC_ABI)) + +RUST_TARGET_NAME = $(RUSTC_ARCH)-unknown-linux-gnu$(RUSTC_ABI) + +ifeq ($(HOSTARCH),x86) +RUSTC_HOST_ARCH = i686 +else +RUSTC_HOST_ARCH = $(HOSTARCH) +endif + +RUST_HOST_NAME = $(RUSTC_HOST_ARCH)-unknown-linux-gnu + +$(eval $(host-virtual-package))
The compiler for the Rust programming language is called rustc. There is only one reference implementation for it, based on LLVM, from the Rust project [1]. It can generate code for various architectures so it can be labeled as a cross-compiler. But, as for GCC, building it from source takes time. So it would be sensible to have at least one package which provides it as a pre-built version, fetched from the upstream project. Later another package can be added, to build it from source code. In addition to the compiler, the standard library for the host and/or the target should also be fetched/built. So, add a virtual package named rustc to enable support for multiple providers. Currently, only the host variant will be available to allow the user to cross-compile Rust programs for the target. [1] http://rust-lang.org Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr> --- package/Config.in.host | 1 + package/rustc/Config.in.host | 31 +++++++++++++++++++++++++++++++ package/rustc/rustc.mk | 20 ++++++++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 package/rustc/Config.in.host create mode 100644 package/rustc/rustc.mk