mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Alejandro Vazquez <avazquez.dev@gmail.com>
To: ptxdist@pengutronix.de
Subject: Re: [ptxdist] [PATCH v2] cross-rustc: new package
Date: Thu, 12 Aug 2021 11:45:44 +0200	[thread overview]
Message-ID: <CAOTEMUTFtY_+5TxFf9Lom1pfbyErH6DnxDX1G1vDRjdDOwHAeg@mail.gmail.com> (raw)
In-Reply-To: <20210812094444.55483-1-avazquez.dev@gmail.com>

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, <avazquez.dev@gmail.com> escribió:
>
> From: Alejandro Vazquez <avazquez.dev@gmail.com>
>
> 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 <avazquez.dev@gmail.com>
> ---
> 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 <avazquez.dev@gmail.com>
> +#
> +# 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
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de

      reply	other threads:[~2021-08-12  9:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-12  9:44 avazquez.dev
2021-08-12  9:45 ` Alejandro Vazquez [this message]

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=CAOTEMUTFtY_+5TxFf9Lom1pfbyErH6DnxDX1G1vDRjdDOwHAeg@mail.gmail.com \
    --to=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