Files
packages/mrustc/0001-do-not-download-rustc.patch
cat ce971c7651 mrustc: init
This bootstraps rustc via the mrustc alternative compiler. The build
process is extraordinarily ugly because rustc maintainers cargo culted
target triple strings without understanding what they are, and
completely mishandles them. They also appear to lack fundamental system
understanding and assume musl can only be used for static linking. The
build process also fails to populate their so called self-contained
library directory, so it is manually put together here.

This setup uses the vendored LLVM for multiple reasons: the fact that
rustc maintainers manage to fuck up so badly they simultaneously pass
GCC-only and Clang-only flags when using an LLVM configured to use
libc++ instead of GNU slop, and the immense maintenance burden to keep
this up to date enough to use Rosa OS LLVM. For now, time and effort
saved from trying to mutilate this pile of garbage into working with a
proper LLVM build more than compensates for the wasted CPU time.

GCC libraries are included in the output because despite the utter
reluctance to do dynamic linking correctly on musl, it seems that rustc
is also incapable of passing the correct linker flags to produce static
executables, and the miserable mrustc Makefiles make it impossible to
specify custom linker flags. From my previous experience producing a
static virtiofsd build, it would require multiple arguments per library,
all of them in rustc's fucked up custom syntax, and I am not ready to
deal with that. To avoid contaminating future stages with gcc, this
package includes only libraries required at runtime.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-07-23 00:50:24 +09:00

28 lines
944 B
Diff

From 157772049aa7da13533026292cb4f67c1e8bf542 Mon Sep 17 00:00:00 2001
From: nobody <nobody@localhost>
Date: Sun, 19 Jul 2026 06:21:49 +0900
Subject: [PATCH 1/3] do not download rustc
The $(RUSTC_SRC_DL) file already exists, but for some reason Make wants
to rebuild this target when it has $(RUSTC_SRC_TARBALL) as a dependency.
---
minicargo.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/minicargo.mk b/minicargo.mk
index 5cd3489c..eb869a1b 100644
--- a/minicargo.mk
+++ b/minicargo.mk
@@ -233,7 +233,7 @@ $(RUSTC_SRC_DL): rustc-$(RUSTC_VERSION)-src/extracted rustc-$(RUSTC_VERSION)-src
# - libstd, libpanic_unwind, libtest and libgetopts
# - libproc_macro (mrustc)
ifeq ($(USE_MERGED_BUILD),1)
-$(RUSTCSRC)mrustc-stdlib/Cargo.toml: $(RUSTC_SRC_DL) minicargo.mk
+$(RUSTCSRC)mrustc-stdlib/Cargo.toml: minicargo.mk
@mkdir -p $(dir $@)
@echo "#![no_core]" > $(dir $@)/lib.rs
@echo "[package]" > $@
--
2.55.0