mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Michael Olbrich <m.olbrich@pengutronix.de>
To: avazquez.dev@gmail.com
Cc: ptxdist@pengutronix.de
Subject: Re: [ptxdist] [PATCH] rust: new package
Date: Wed, 4 Aug 2021 09:41:15 +0200	[thread overview]
Message-ID: <20210804074115.GC2534932@pengutronix.de> (raw)
In-Reply-To: <20210730174156.187572-1-avazquez.dev@gmail.com>

On Fri, Jul 30, 2021 at 07:41:56PM +0200, avazquez.dev@gmail.com wrote:
> From: Alejandro Vazquez <avazquez.dev@gmail.com>
> 
> - host-rust: This package provides a pre-built version of rustc,
> cargo and standard library for the host.
> - host-rust-std-target: A pre-built version of the standard library for
> the target.

No. The compiler should be built not just downloaded.

Please take a look at the latest OSELAS.Toolchain. It contains a rust
compiler and std libraries for the target. I've done very little testing
with that so far and I would be interested in some feedback. Especially if
something isn't working.

Also, I'm pretty sure that there are some hidden downloads in there for
cargo and maybe the host std library. So if you keep those rules locally,
you should add that to the downloads. This way, they will be cached with
the rest of the source. Take a look at what I did for the toolchain.

Michael

> Signed-off-by: Alejandro Vazquez <avazquez.dev@gmail.com>
> ---
>  rules/host-rust-std-target.in   | 18 ++++++++
>  rules/host-rust-std-target.make | 81 +++++++++++++++++++++++++++++++++
>  rules/host-rust.in              |  8 ++++
>  rules/host-rust.make            | 80 ++++++++++++++++++++++++++++++++
>  4 files changed, 187 insertions(+)
>  create mode 100644 rules/host-rust-std-target.in
>  create mode 100644 rules/host-rust-std-target.make
>  create mode 100644 rules/host-rust.in
>  create mode 100644 rules/host-rust.make
> 
> diff --git a/rules/host-rust-std-target.in b/rules/host-rust-std-target.in
> new file mode 100644
> index 000000000..ed47f8c89
> --- /dev/null
> +++ b/rules/host-rust-std-target.in
> @@ -0,0 +1,18 @@
> +## SECTION=hosttools
> +
> +menuconfig HOST_RUST_STD_TARGET
> +	bool
> +	select HOST_RUST
> +	prompt "host-rust-std-target (pre-built)"
> +	help
> +	  This package will install pre-built versions of
> +	  the Rust standard library for the target.
> +
> +if HOST_RUST_STD_TARGET
> +
> +config HOST_RUST_STD_TARGET_ARCH
> +	string
> +	default "armv7-unknown-linux-gnueabihf"
> +	prompt "Target Architecture"
> +
> +endif
> diff --git a/rules/host-rust-std-target.make b/rules/host-rust-std-target.make
> new file mode 100644
> index 000000000..f41c2caa1
> --- /dev/null
> +++ b/rules/host-rust-std-target.make
> @@ -0,0 +1,81 @@
> +# -*-makefile-*-
> +#
> +# Copyright (C) 2021 by Alejandro Vazquez <avazquez.dev@gmail.com>
> +#
> +# For further information about the PTXdist project and license conditions
> +# see the README file.
> +#
> +
> +#
> +# We provide this package
> +#
> +PACKAGES-$(PTXCONF_HOST_RUST_STD_TARGET) += host-rust-std-target
> +
> +#
> +# Paths and names
> +#
> +HOST_RUST_STD_TARGET_VERSION		:= 1.53.0
> +HOST_RUST_STD_TARGET_MD5		:= 6eeb959f5a9294adc8220e79502b00df
> +HOST_RUST_STD_TARGET_SUFFIX		:= tar.xz
> +HOST_RUST_STD_TARGET_SPEC		:= $(call remove_quotes, $(PTXCONF_HOST_RUST_STD_TARGET_ARCH))
> +HOST_RUST_STD_TARGET			:= rust-std-$(HOST_RUST_STD_TARGET_VERSION)
> +HOST_RUST_STD_TARGET_NAME 		:= $(HOST_RUST_STD_TARGET)-$(HOST_RUST_STD_TARGET_SPEC)
> +HOST_RUST_STD_TARGET_URL		:= https://static.rust-lang.org/dist/$(HOST_RUST_STD_TARGET_NAME).$(HOST_RUST_STD_TARGET_SUFFIX)
> +HOST_RUST_STD_TARGET_DIR		:= $(HOST_BUILDDIR)/$(HOST_RUST_STD_TARGET)
> +HOST_RUST_STD_TARGET_SOURCE		:= $(SRCDIR)/$(HOST_RUST_STD_TARGET_NAME).$(HOST_RUST_STD_TARGET_SUFFIX)
> +HOST_RUST_STD_TARGET_LICENSE		:= Apache-2.0 AND MIT
> +HOST_RUST_STD_TARGET_LICENSE_FILES 	:= \
> +	file://COPYRIGHT;md5=93a95682d51b4cb0a633a97046940ef0 \
> +	file://LICENSE-APACHE;md5=22a53954e4e0ec258dfce4391e905dac \
> +	file://LICENSE-MIT;md5=b377b220f43d747efdec40d69fcaa69d
> +
> +# ----------------------------------------------------------------------------
> +# Prepare
> +# ----------------------------------------------------------------------------
> +
> +HOST_RUST_STD_TARGET_DEVPKG	:= NO
> +HOST_RUST_STD_TARGET_CONF_TOOL	:= NO
> +
> +HOST_RUST_STD_TARGET_INSTALL_COMPONENTS = --components=rust-std-$(HOST_RUST_STD_TARGET_SPEC)
> +
> +HOST_RUST_STD_TARGET_INSTALL_OPTS = \
> +	--prefix=$(PTXDIST_SYSROOT_HOST) \
> +	--without=rust-docs \
> +	--disable-ldconfig \
> +	$(HOST_RUST_STD_TARGET_INSTALL_COMPONENTS)
> +
> +# ----------------------------------------------------------------------------
> +# Compile
> +# ----------------------------------------------------------------------------
> +
> +$(STATEDIR)/host-rust-std-target.compile:
> +	@$(call targetinfo)
> +	@$(call touch)
> +
> +# ----------------------------------------------------------------------------
> +# Install
> +# ----------------------------------------------------------------------------
> +
> +$(STATEDIR)/host-rust-std-target.install.post:
> +	@$(call targetinfo)
> +
> +	@cd "$(HOST_RUST_STD_TARGET_DIR)" && sh install.sh $(HOST_RUST_STD_TARGET_INSTALL_OPTS)
> +	@cd "$(PTXDIST_SYSROOT_HOST)/lib/rustlib/" && mv uninstall.sh uninstall-target.sh
> +
> +	@$(call world/install, HOST_RUST_STD_TARGET)
> +	@$(call touch)
> +
> +# ----------------------------------------------------------------------------
> +# Clean
> +# ----------------------------------------------------------------------------
> +
> +$(STATEDIR)/host-rust-std-target.clean:
> +	@$(call targetinfo)
> +
> +	sh $(PTXDIST_SYSROOT_HOST)/lib/rustlib/uninstall-host.sh \
> +	--uninstall \
> +	--prefix=$(PTXDIST_SYSROOT_HOST) \
> +	$(HOST_RUST_STD_TARGET_INSTALL_COMPONENTS)
> +	@$(call clean_pkg, HOST_RUST_STD_TARGET)
> +
> +# vim: syntax=make
> diff --git a/rules/host-rust.in b/rules/host-rust.in
> new file mode 100644
> index 000000000..4f73dae6c
> --- /dev/null
> +++ b/rules/host-rust.in
> @@ -0,0 +1,8 @@
> +## SECTION=hosttools
> +
> +config HOST_RUST
> +	tristate
> +	prompt "host-rust (pre-built)"
> +	help
> +	  This package will install pre-built versions of the compiler
> +	  and the Rust standard library for the host.
> diff --git a/rules/host-rust.make b/rules/host-rust.make
> new file mode 100644
> index 000000000..e750a1352
> --- /dev/null
> +++ b/rules/host-rust.make
> @@ -0,0 +1,80 @@
> +# -*-makefile-*-
> +#
> +# Copyright (C) 2021 by Alejandro Vazquez <avazquez.dev@gmail.com>
> +#
> +# For further information about the PTXdist project and license conditions
> +# see the README file.
> +#
> +
> +#
> +# We provide this package
> +#
> +PACKAGES-$(PTXCONF_HOST_RUST) += host-rust
> +
> +#
> +# Paths and names
> +#
> +HOST_RUST_VERSION	:= 1.53.0
> +HOST_RUST_MD5		:= 3f2ea3d908dac317d6006a117463f18e
> +HOST_RUST		:= rust-$(HOST_RUST_VERSION)
> +HOST_RUST_SUFFIX	:= tar.xz
> +HOST_RUST_NAME 		:= $(HOST_RUST)-$(subst host,unknown,$(GNU_HOST))
> +HOST_RUST_URL		:= https://static.rust-lang.org/dist/$(HOST_RUST_NAME).$(HOST_RUST_SUFFIX)
> +HOST_RUST_DIR		:= $(HOST_BUILDDIR)/$(HOST_RUST_NAME)
> +HOST_RUST_SOURCE	:= $(SRCDIR)/$(HOST_RUST_NAME).$(HOST_RUST_SUFFIX)
> +HOST_RUST_LICENSE	:= Apache-2.0 AND MIT
> +HOST_RUST_LICENSE_FILES := \
> +	file://COPYRIGHT;md5=93a95682d51b4cb0a633a97046940ef0 \
> +	file://LICENSE-APACHE;md5=22a53954e4e0ec258dfce4391e905dac \
> +	file://LICENSE-MIT;md5=b377b220f43d747efdec40d69fcaa69d
> +
> +# ----------------------------------------------------------------------------
> +# Prepare
> +# ----------------------------------------------------------------------------
> +
> +HOST_RUST_DEVPKG	:= NO
> +HOST_RUST_CONF_TOOL	:= NO
> +
> +HOST_RUST_INSTALL_COMPONENTS = --components=rustc,cargo,rust-std-$(subst host,unknown,$(GNU_HOST))
> +
> +HOST_RUST_INSTALL_OPTS = \
> +	--prefix=$(PTXDIST_SYSROOT_HOST) \
> +	--without=rust-docs \
> +	--disable-ldconfig \
> +	$(HOST_RUST_INSTALL_COMPONENTS)
> +
> +# ----------------------------------------------------------------------------
> +# Compile
> +# ----------------------------------------------------------------------------
> +
> +$(STATEDIR)/host-rust.compile:
> +	@$(call targetinfo)
> +	@$(call touch)
> +
> +# ----------------------------------------------------------------------------
> +# Install
> +# ----------------------------------------------------------------------------
> +
> +$(STATEDIR)/host-rust.install.post:
> +	@$(call targetinfo)
> +
> +	@cd "$(HOST_RUST_DIR)" && sh install.sh $(HOST_RUST_INSTALL_OPTS)
> +	@cd "$(PTXDIST_SYSROOT_HOST)/lib/rustlib/" && mv uninstall.sh uninstall-host.sh
> +
> +	@$(call touch)
> +
> +# ----------------------------------------------------------------------------
> +# Clean
> +# ----------------------------------------------------------------------------
> +
> +$(STATEDIR)/host-rust.clean:
> +	@$(call targetinfo)
> +
> +	sh $(PTXDIST_SYSROOT_HOST)/lib/rustlib/uninstall-host.sh \
> +	--uninstall \
> +	--prefix=$(PTXDIST_SYSROOT_HOST) \
> +	$(HOST_RUST_INSTALL_COMPONENTS)
> +
> +	@$(call clean_pkg, HOST_RUST)
> +
> +# vim: syntax=make
> -- 
> 2.25.1
> 
> 
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de
> To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


  reply	other threads:[~2021-08-04  7:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-30 17:41 avazquez.dev
2021-08-04  7:41 ` Michael Olbrich [this message]
     [not found]   ` <CABDcavYVmcMDrUCbQhgLxCb_gd+++bFBLxAP6R2OWoJskem08Q@mail.gmail.com>
2021-08-04 10:16     ` Michael Olbrich
     [not found]       ` <CABDcavb0S0nsxKtD+s_szYjTMNQh_oBb2jBxCmh0DZKF09J2Ug@mail.gmail.com>
2021-08-04 18:18         ` Alex Vazquez
     [not found]   ` <CABDcavZo_PM0VkcoT63s_HuTky=_pNOXe5Pnhgv+ztbRP1okhA@mail.gmail.com>
2021-08-06  6:25     ` Michael Olbrich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210804074115.GC2534932@pengutronix.de \
    --to=m.olbrich@pengutronix.de \
    --cc=avazquez.dev@gmail.com \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox