From: leahneukirchen <leahneukirchen@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: [PR PATCH] New package: rust-cross-1.77.1
Date: Wed, 24 Apr 2024 15:52:29 +0200 [thread overview]
Message-ID: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-50016@inbox.vuxu.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 1123 bytes --]
There is a new pull request by leahneukirchen against master on the void-packages repository
https://github.com/leahneukirchen/void-packages rust-cross
https://github.com/void-linux/void-packages/pull/50016
New package: rust-cross-1.77.1
This package adds core libraries for rust to cross-compile to
* 'thumbv6m-none-eabi', for Raspberry Pi Pico
* 'riscv32imc-unknown-none-elf', for ESP-C3
* 'riscv32imac-unknown-none-elf', for ESP-C6
* 'wasm32-unknown-unknown', for WASM
These targets cannot be build in the main template because they conflict with `docs = true`.
Having this package avoids needing to use `rustup` to develop for these platforms.
More target suggestions are welcome. Each target adds ~40MB of data.
Open questions:
* Package name
* Should this be a split package?
Once the `-Z build-std` (https://github.com/rust-lang/wg-cargo-std-aware) cargo feature becomes available in stable, this package is redundant.
#### Testing the changes
- I tested the changes in this PR: **briefly**
A patch file from https://github.com/void-linux/void-packages/pull/50016.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-rust-cross-50016.patch --]
[-- Type: text/x-diff, Size: 4606 bytes --]
From dffc33c0a78286c201436ac1f96119075d52ed8e Mon Sep 17 00:00:00 2001
From: Leah Neukirchen <leah@vuxu.org>
Date: Wed, 24 Apr 2024 15:45:50 +0200
Subject: [PATCH] New package: rust-cross-1.77.1
---
srcpkgs/rust-cross/files | 1 +
srcpkgs/rust-cross/patches | 1 +
srcpkgs/rust-cross/template | 99 +++++++++++++++++++++++++++++++++++++
srcpkgs/rust-cross/update | 2 +
srcpkgs/rust/template | 1 +
5 files changed, 104 insertions(+)
create mode 120000 srcpkgs/rust-cross/files
create mode 120000 srcpkgs/rust-cross/patches
create mode 100644 srcpkgs/rust-cross/template
create mode 100644 srcpkgs/rust-cross/update
diff --git a/srcpkgs/rust-cross/files b/srcpkgs/rust-cross/files
new file mode 120000
index 00000000000000..b3b24547ab1d88
--- /dev/null
+++ b/srcpkgs/rust-cross/files
@@ -0,0 +1 @@
+../rust/files
\ No newline at end of file
diff --git a/srcpkgs/rust-cross/patches b/srcpkgs/rust-cross/patches
new file mode 120000
index 00000000000000..64eb6b97150039
--- /dev/null
+++ b/srcpkgs/rust-cross/patches
@@ -0,0 +1 @@
+../rust/patches
\ No newline at end of file
diff --git a/srcpkgs/rust-cross/template b/srcpkgs/rust-cross/template
new file mode 100644
index 00000000000000..02b907ee2f50e9
--- /dev/null
+++ b/srcpkgs/rust-cross/template
@@ -0,0 +1,99 @@
+# Template file for 'rust-cross'
+#
+# Permission to use rust and cargo trademark is granted.
+# See: https://github.com/rust-lang/core-team/issues/4
+#
+# Update in lockstep with rust!
+# Thanks to @seppel3210@chaos.social for helping me figure this out.
+pkgname=rust-cross
+version=1.77.1
+revision=1
+hostmakedepends="cargo cmake curl llvm17-devel ninja pkg-config python3 rust tar"
+makedepends="llvm17-devel"
+depends="rust"
+short_desc="Rust no_std targets for cross-compilation"
+maintainer="Leah Neukirchen <leah@vuxu.org>"
+license="MIT, Apache-2.0"
+homepage="https://www.rust-lang.org/"
+distfiles="https://static.rust-lang.org/dist/rustc-${version}-src.tar.gz"
+checksum=ee106e4c569f52dba3b5b282b105820f86bd8f6b3d09c06b8dce82fb1bb3a4a1
+lib32disabled=yes
+make_check=no # CBA for now
+python_version=3 # needed for python files in rust-src
+nocross=yes # for now
+nostrip=yes # cross-archs
+
+# we need this because cargo verifies checksums of all files in vendor
+# crates when it builds and gives us no way to override or update the
+# file sanely... so just clear out the file list
+_clear_vendor_checksums() {
+ sed -i 's/\("files":{\)[^}]*/\1/' vendor/$1/.cargo-checksum.json
+}
+
+post_patch() {
+ rm -rf src/llvm-project
+
+ # clear out all the checksum nonsense of patched vendor crates
+ _clear_vendor_checksums libc
+ _clear_vendor_checksums typenum
+ _clear_vendor_checksums cc
+ _clear_vendor_checksums taarget-lexicon
+
+ _clear_vendor_checksums tikv-jemallocator
+}
+
+do_configure() {
+ cat >config.toml <<EOF
+profile = 'dist'
+[llvm]
+link-shared = true
+[build]
+target = [
+ 'thumbv6m-none-eabi',
+ 'riscv32imc-unknown-none-elf',
+ 'riscv32imac-unknown-none-elf',
+ 'wasm32-unknown-unknown'
+]
+cargo = '/usr/bin/cargo'
+rustc = '/usr/bin/rustc'
+docs = false
+submodules = false
+locked-deps = true
+vendor = true
+full-bootstrap = false
+optimized-compiler-builtins = false
+local-rebuild = true
+[install]
+prefix = '/usr'
+[rust]
+codegen-units = 1
+codegen-units-std = 1
+parallel-compiler = false
+channel = 'stable'
+description = 'Void Linux'
+rpath = false
+llvm-libunwind = 'no'
+[target.x86_64-unknown-linux-gnu]
+llvm-config = '/usr/bin/llvm-config'
+[target."*"]
+cc = "clang"
+ar = "llvm-ar"
+ranlib = "llvm-ranlib"
+EOF
+}
+
+do_build() {
+ export RUST_BACKTRACE=1
+ export CARGO_HOME="$wrksrc/.cargo"
+ # prevent sysroot from leaking in
+ export RUSTFLAGS=""
+
+ python3 x.py dist rust-std --stage 0 --jobs $XBPS_MAKEJOBS
+}
+
+do_install() {
+ vmkdir usr
+ for f in build/dist/rust-std-${version}-*.tar.gz; do
+ tar xf $f -C "$DESTDIR/usr/lib" --strip-components=3 --exclude=manifest.in
+ done
+}
diff --git a/srcpkgs/rust-cross/update b/srcpkgs/rust-cross/update
new file mode 100644
index 00000000000000..51448b21d082f7
--- /dev/null
+++ b/srcpkgs/rust-cross/update
@@ -0,0 +1,2 @@
+site="https://github.com/rust-lang/rust/tags"
+pattern='/archive/refs/tags/\K[\d\.]+(?=\.tar\.gz")'
diff --git a/srcpkgs/rust/template b/srcpkgs/rust/template
index 21e11623638676..f59903fa0f4c69 100644
--- a/srcpkgs/rust/template
+++ b/srcpkgs/rust/template
@@ -6,6 +6,7 @@
#
# Always make sure custom distfiles used for bootstrap are
# uploaded to https://repo-default.voidlinux.org/distfiles/
+# Don't forget to also bump 'rust-cross'.
#
pkgname=rust
version=1.77.1
next reply other threads:[~2024-04-24 13:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-24 13:52 leahneukirchen [this message]
2024-04-24 15:21 ` [PR PATCH] [Updated] " leahneukirchen
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=gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-50016@inbox.vuxu.org \
--to=leahneukirchen@users.noreply.github.com \
--cc=ml@inbox.vuxu.org \
/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;
as well as URLs for NNTP newsgroup(s).