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>
This commit is contained in:
cat
2026-07-23 00:50:24 +09:00
parent a1b0a10fcf
commit ce971c7651
6 changed files with 2388 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
diff --git a/Makefile b/Makefile
index bb8e64a4..6bc951a7 100644
--- a/Makefile
+++ b/Makefile
@@ -188,7 +188,7 @@ $(OBJDIR)%.o: src/%.cpp
$(OBJDIR)version.o: $(OBJDIR)%.o: src/%.cpp $(filter-out $(OBJDIR)version.o,$(OBJ)) Makefile
@+mkdir -p $(dir $@)
@echo [CXX] -o $@
- $V$(CXX) -o $@ -c $< $(CXXFLAGS) $(CPPFLAGS) -MMD -MP -MF $@.dep -D VERSION_GIT_FULLHASH=\"$(shell git show --pretty=%H -s --no-show-signature)\" -D VERSION_GIT_BRANCH="\"$(shell git symbolic-ref -q --short HEAD || git describe --tags --exact-match)\"" -D VERSION_GIT_SHORTHASH=\"$(shell git show -s --pretty=%h --no-show-signature)\" -D VERSION_BUILDTIME="\"$(shell env LC_TIME=C date -u +"%a, %e %b %Y %T +0000")\"" -D VERSION_GIT_ISDIRTY=$(shell git diff-index --quiet HEAD; echo $$?)
+ $V$(CXX) -o $@ -c $< $(CXXFLAGS) $(CPPFLAGS) -MMD -MP -MF $@.dep -D VERSION_GIT_FULLHASH=\"unknown\" -D VERSION_GIT_BRANCH="\"v0.12.0\"" -D VERSION_GIT_SHORTHASH=\"unknown\" -D VERSION_BUILDTIME="\"Nya, 0 Jan -1 25:71:99 +2928\"" -D VERSION_GIT_ISDIRTY=0
src/main.cpp: $(PCHS:%=src/%.gch)