These rules still use the pre-built version but I have integrated the
other recommendations. I would be interested in some feedback.

I think these rules could be useful in case you don't want to use
latest OSELAS.Toolchain or if someone wants to use a specific
toolchain vendor.

The next step is to build the rust compiler and std libraries for the target.

El jue, 12 ago 2021 a las 11:44, <[email protected]> escribió:
>
> From: Alejandro Vazquez <[email protected]>
>
> cross-rustc: This package provides a pre-built version of rustc,
> cargo for the host and standard library for the host and target.
>
> Signed-off-by: Alejandro Vazquez <[email protected]>
> ---
> Changes since v1:
>  - merge the rules: host-rust and host-rust-std-target
>
>  rules/cross-rustc.in   |  18 +++++++
>  rules/cross-rustc.make | 114 +++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 132 insertions(+)
>  create mode 100644 rules/cross-rustc.in
>  create mode 100644 rules/cross-rustc.make
>
> diff --git a/rules/cross-rustc.in b/rules/cross-rustc.in
> new file mode 100644
> index 000000000..8f89b2370
> --- /dev/null
> +++ b/rules/cross-rustc.in
> @@ -0,0 +1,18 @@
> +## SECTION=crosstools
> +
> +menuconfig CROSS_RUSTC
> +       bool
> +       prompt "cross-rust (pre-built)"
> +       help
> +         This package will install pre-built versions of the compiler
> +         and Cargo for the host. And the Rust standard library for
> +         the host and target.
> +
> +if CROSS_RUSTC
> +
> +config CROSS_RUSTC_STD_TARGET_ARCH
> +       string
> +       default "armv7-unknown-linux-gnueabihf"
> +       prompt "Target Architecture"
> +
> +endif
> diff --git a/rules/cross-rustc.make b/rules/cross-rustc.make
> new file mode 100644
> index 000000000..da7ae3ff1
> --- /dev/null
> +++ b/rules/cross-rustc.make
> @@ -0,0 +1,114 @@
> +# -*-makefile-*-
> +#
> +# Copyright (C) 2021 by Alejandro Vazquez <[email protected]>
> +#
> +# For further information about the PTXdist project and license conditions
> +# see the README file.
> +#
> +
> +#
> +# We provide this package
> +#
> +PACKAGES-$(PTXCONF_CROSS_RUSTC) += cross-rustc
> +
> +#
> +# Paths and names
> +#
> +CROSS_RUSTC_VERSION       := 1.54.0
> +CROSS_RUSTC_MD5           := 12cfee7377dafd0583fe53d7ed5d45fb
> +CROSS_RUSTC               := rust-$(CROSS_RUSTC_VERSION)
> +CROSS_RUSTC_SUFFIX        := tar.xz
> +CROSS_RUSTC_NAME          := $(CROSS_RUSTC)-$(subst host,unknown,$(GNU_HOST))
> +CROSS_RUSTC_URL           := 
> https://static.rust-lang.org/dist/$(CROSS_RUSTC_NAME).$(CROSS_RUSTC_SUFFIX)
> +CROSS_RUSTC_DIR           := $(CROSS_BUILDDIR)/$(CROSS_RUSTC_NAME)
> +CROSS_RUSTC_SOURCE        := 
> $(SRCDIR)/$(CROSS_RUSTC_NAME).$(CROSS_RUSTC_SUFFIX)
> +CROSS_RUSTC_LICENSE       := Apache-2.0 AND MIT
> +CROSS_RUSTC_LICENSE_FILES := \
> +       file://COPYRIGHT;md5=93a95682d51b4cb0a633a97046940ef0 \
> +       file://LICENSE-APACHE;md5=22a53954e4e0ec258dfce4391e905dac \
> +       file://LICENSE-MIT;md5=b377b220f43d747efdec40d69fcaa69d
> +
> +CROSS_RUSTC_STD_TARGET_MD5                := 7721d6f1676cd637430a40bd38ec8874
> +CROSS_RUSTC_STD_TARGET_SUFFIX             := tar.xz
> +CROSS_RUSTC_STD_TARGET_SPEC               := $(call remove_quotes, 
> $(PTXCONF_CROSS_RUSTC_STD_TARGET_ARCH))
> +CROSS_RUSTC_STD_TARGET                    := 
> rust-std-$(CROSS_RUSTC_VERSION)-$(CROSS_RUSTC_STD_TARGET_SPEC)
> +CROSS_RUSTC_STD_TARGET_URL                := 
> https://static.rust-lang.org/dist/$(CROSS_RUSTC_STD_TARGET).$(CROSS_RUSTC_STD_TARGET_SUFFIX)
> +CROSS_RUSTC_STD_TARGET_DIR                := 
> $(CROSS_BUILDDIR)/$(CROSS_RUSTC_STD_TARGET)
> +CROSS_RUSTC_STD_TARGET_SOURCE             := 
> $(SRCDIR)/$(CROSS_RUSTC_STD_TARGET).$(CROSS_RUSTC_STD_TARGET_SUFFIX)
> +$(CROSS_RUSTC_STD_TARGET_SOURCE)          := CROSS_RUSTC_STD_TARGET
> +CROSS_RUSTC_SOURCES                       += $(CROSS_RUSTC_STD_TARGET_SOURCE)
> +
> +# 
> ----------------------------------------------------------------------------
> +# Extract
> +# 
> ----------------------------------------------------------------------------
> +
> +$(STATEDIR)/cross-rustc.extract:
> +       @$(call targetinfo)
> +       @$(call clean, $(CROSS_RUSTC_DIR))
> +       @$(call clean, $(CROSS_RUSTC_STD_TARGET_DIR))
> +       @$(call extract, CROSS_RUSTC)
> +       @$(call extract, CROSS_RUSTC_STD_TARGET)
> +       #@$(call patchin, CROSS_RUSTC)
> +       #@$(call patchin, CROSS_RUSTC_STD_TARGET)
> +       @$(call touch)
> +
> +# 
> ----------------------------------------------------------------------------
> +# Prepare
> +# 
> ----------------------------------------------------------------------------
> +
> +CROSS_RUSTC_DEVPKG     := NO
> +CROSS_RUSTC_CONF_TOOL  := NO
> +
> +CROSS_RUSTC_INSTALL_COMPONENTS = --components=rustc,cargo,rust-std-$(subst 
> host,unknown,$(GNU_HOST))
> +
> +CROSS_RUSTC_INSTALL_COMMON_OPTS = \
> +       --prefix=$(PTXDIST_SYSROOT_CROSS) \
> +       --without=rust-docs \
> +       --disable-ldconfig \
> +
> +CROSS_RUSTC_INSTALL_OPTS = \
> +       $(CROSS_RUSTC_INSTALL_COMMON_OPTS) \
> +       $(CROSS_RUSTC_INSTALL_COMPONENTS)
> +
> +CROSS_RUSTC_STD_TARGET_INSTALL_COMPONENTS = 
> --components=rust-std-$(CROSS_RUSTC_STD_TARGET_SPEC)
> +
> +CROSS_RUSTC_STD_TARGET_INSTALL_OPTS = \
> +       $(CROSS_RUSTC_INSTALL_COMMON_OPTS) \
> +       $(CROSS_RUSTC_STD_TARGET_INSTALL_COMPONENTS)
> +
> +# 
> ----------------------------------------------------------------------------
> +# Compile
> +# 
> ----------------------------------------------------------------------------
> +
> +$(STATEDIR)/cross-rustc.compile:
> +       @$(call targetinfo)
> +       @$(call touch)
> +
> +# 
> ----------------------------------------------------------------------------
> +# Install
> +# 
> ----------------------------------------------------------------------------
> +
> +$(STATEDIR)/cross-rustc.install.post:
> +       @$(call targetinfo)
> +
> +       @cd "$(CROSS_RUSTC_DIR)" && sh install.sh $(CROSS_RUSTC_INSTALL_OPTS)
> +
> +       @cd "$(CROSS_RUSTC_STD_TARGET_DIR)" && sh install.sh 
> $(CROSS_RUSTC_STD_TARGET_INSTALL_OPTS)
> +
> +       @$(call touch)
> +
> +# 
> ----------------------------------------------------------------------------
> +# Clean
> +# 
> ----------------------------------------------------------------------------
> +
> +$(STATEDIR)/cross-rustc.clean:
> +       @$(call targetinfo)
> +
> +
> +       @if [ -f $(PTXDIST_SYSROOT_CROSS)/lib/rustlib/uninstall.sh ]; then \
> +               sh $(PTXDIST_SYSROOT_CROSS)/lib/rustlib/uninstall.sh; \
> +       fi
> +
> +       @$(call clean_pkg, CROSS_RUSTC)
> +
> +# vim: syntax=make
> --
> 2.25.1
>

_______________________________________________
ptxdist mailing list
[email protected]
To unsubscribe, send a mail with subject "unsubscribe" to 
[email protected]

Reply via email to