mrustc: init

This contains some extraordinarily ugly hacks for a set of even uglier
Makefiles.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
cat
2026-07-19 15:17:08 +09:00
parent a1b0a10fcf
commit 1ff440e936
5 changed files with 2233 additions and 0 deletions
+122
View File
@@ -0,0 +1,122 @@
package mrustc-source {
description = "patched mrustc source tree";
exclude = true;
version# = "0.12.0";
output = remoteGitHub {
suffix = "thepowersgang/mrustc";
tag = "v"+version;
checksum = "Db25OAKL_1yZIF6MlXOTHhrEJ-Pd-i-accVtt5rJollmpKm6B3bgS0xN7hoC1cVu";
};
chmod = true;
patches = [
"0001-do-not-download-rustc.patch",
"0002-Revert-HIR-Typecheck-Optimise-by-doing-multiple-chec.patch",
"0003-rustc-src-enable-rustix-use-libc-feature-revert-port.patch",
"remove-git-invocations.patch",
];
}
package mrustc {
description = "alternative rust compiler (re-implementation)";
website = "https://github.com/thepowersgang/mrustc";
anitya = 391250;
source = mrustc-source;
enterSource = true;
writable = true;
minimal = true;
exec = make {
inPlace = true;
skipConfigure = true;
make = [ "CXX='g++ -w'" ];
// test suite runs during rustc-bootstrap
skipCheck = true;
install = "install -vD bin/mrustc /work/system/bin/mrustc";
};
inputs = [
bash,
// mrustc requires buggy gcc behaviour
gcc,
];
runtime = [ gcc ];
}
package rustc-bootstrap-source {
description = "rustc source tree used by mrustc";
exclude = true;
version# = "1.90.0";
output = remoteTar {
url = "https://static.rust-lang.org/dist/rustc-"+version+"-src.tar.gz";
compress = gzip;
checksum = "kUjk5mOHRc7cTom0uJ5afFTkhFcXLYK8tJl_aqduffGSHc0TH_a-KKz6PI0nk_xK";
};
chmod = true;
}
package rustc-bootstrap {
description = "rust toolchain bootstrapped via mrustc";
exclude = true;
source = mrustc-source;
extra = [ rustc-bootstrap-source ];
enterSource = true;
writable = true;
exec = make {
inPlace = true;
skipConfigure = true;
preMake = `
export PARLEVEL=`+jobsE+`
export RUSTC_SOURCE='../extra/rustc-bootstrap-source'
export RUSTC_VERSION="$(cut -d ' ' -f 1 "$RUSTC_SOURCE/version")"
export MRUSTC_TARGET_VER="$(cut -d '.' -f 1,2 <<< "$RUSTC_VERSION")"
export OUTDIR_SUF="-$RUSTC_VERSION"
patch -d "$RUSTC_SOURCE" -p0 < "rustc-$RUSTC_VERSION-src.patch"
touch "$RUSTC_SOURCE/dl-version"
ln -s "$RUSTC_SOURCE" "rustc-$RUSTC_VERSION-src"
mkdir bin && ln -s /system/bin/mrustc bin/
`;
make = [
"-f",
"minicargo.mk",
"CC=gcc",
"CXX='g++ -w'",
"LIBS",
];
check = [
"CC=gcc",
"CXX='g++ -w'",
"test",
"local_tests",
];
install = `
export CC=gcc CXX=g++
OUTDIR="output-$RUSTC_VERSION"
make -f minicargo.mk "$OUTDIR/rustc"
make -f minicargo.mk "$OUTDIR/cargo"
make -C run_rustc
`;
};
inputs = [
bash,
patch,
cmake,
pkg-config,
perl,
python,
mrustc,
kernel-headers,
];
}