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:
@@ -0,0 +1,27 @@
|
|||||||
|
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
|
||||||
|
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
From 6e66feb3b6ae698c3d29211847c71c00f87fbf78 Mon Sep 17 00:00:00 2001
|
||||||
|
From: nobody <nobody@localhost>
|
||||||
|
Date: Sun, 19 Jul 2026 06:23:12 +0900
|
||||||
|
Subject: [PATCH 2/3] Revert "HIR Typecheck - Optimise by doing multiple checks
|
||||||
|
per pass"
|
||||||
|
|
||||||
|
This reverts commit 99d9bd0c788b0c72fc2f4fee6187a462ceb059f2.
|
||||||
|
---
|
||||||
|
src/hir_typeck/expr_cs.cpp | 71 ++++++++++++++++----------------------
|
||||||
|
1 file changed, 30 insertions(+), 41 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp
|
||||||
|
index 366cf78e..874d25cc 100644
|
||||||
|
--- a/src/hir_typeck/expr_cs.cpp
|
||||||
|
+++ b/src/hir_typeck/expr_cs.cpp
|
||||||
|
@@ -8001,47 +8001,36 @@ void Typecheck_Code_CS(const typeck::ModuleState& ms, t_args& args, const ::HIR:
|
||||||
|
for(unsigned int i = 0; i < context.possible_ivar_vals.size(); i ++ )
|
||||||
|
{
|
||||||
|
if( check_ivar_poss(context, i, context.possible_ivar_vals[i]) ) {
|
||||||
|
- // Look at all other ivar possibility sets, and disable processing if they depend on this ivar (prevents races)
|
||||||
|
- auto contains_ty = [&i](const HIR::TypeRef& t) {
|
||||||
|
- auto cb = [&](const HIR::TypeRef& t) {
|
||||||
|
- // TODO: Resolve ivars
|
||||||
|
- return TU_TEST1(t.data(), Infer, .index == i);
|
||||||
|
- };
|
||||||
|
- return visit_ty_with( t, cb );
|
||||||
|
- };
|
||||||
|
- auto disable_in = [&context](const HIR::TypeRef& t)->bool {
|
||||||
|
- auto cb = [&](const HIR::TypeRef& tr) {
|
||||||
|
- const auto& t = context.m_ivars.get_type(tr);
|
||||||
|
- if(const auto* te = t.data().opt_Infer()) {
|
||||||
|
- DEBUG("Disable IVar " << te->index);
|
||||||
|
- context.possible_ivar_vals[te->index].force_disable = true;
|
||||||
|
- }
|
||||||
|
- return false;
|
||||||
|
- };
|
||||||
|
- return visit_ty_with( t, cb );
|
||||||
|
- };
|
||||||
|
- for(const auto& r : context.link_assoc) {
|
||||||
|
- if( contains_ty(r.impl_ty) || contains_ty(r.left_ty) || ::std::any_of(r.params.m_types.begin(), r.params.m_types.end(), contains_ty) ) {
|
||||||
|
- disable_in(r.impl_ty);
|
||||||
|
- for(const auto& t : r.params.m_types) {
|
||||||
|
- disable_in(t);
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
- for(auto& e : context.possible_ivar_vals) {
|
||||||
|
- bool references_this = false;
|
||||||
|
- for(const auto& t : e.types_coerce_from) {
|
||||||
|
- references_this |= contains_ty(t.ty);
|
||||||
|
- }
|
||||||
|
- for(const auto& t : e.types_coerce_to) {
|
||||||
|
- references_this |= contains_ty(t.ty);
|
||||||
|
- }
|
||||||
|
- for(const auto& t : e.bounded) {
|
||||||
|
- references_this |= contains_ty(t);
|
||||||
|
- }
|
||||||
|
- if(references_this) {
|
||||||
|
- DEBUG("Block IVar " << (&e - context.possible_ivar_vals.data()));
|
||||||
|
- e.force_disable = true;
|
||||||
|
+ // HACK: For `gix v0.73.0`, but really a good idea: only set one ivar per pass.
|
||||||
|
+ // - Ideally, would determine if this ivar is used in any other rules, and prevent ivars mentioned in those rules
|
||||||
|
+ // from also being guessed.
|
||||||
|
+ break;
|
||||||
|
+ static Span sp;
|
||||||
|
+ //assert( context.possible_ivar_vals[i].has_rules() );
|
||||||
|
+ // Disable all metioned ivars in the possibilities
|
||||||
|
+ for(const auto& ty : context.possible_ivar_vals[i].types_coerce_to)
|
||||||
|
+ context.possible_equate_type_unknown(sp, ty.ty, Context::IvarUnknownType::From);
|
||||||
|
+ for(const auto& ty : context.possible_ivar_vals[i].types_coerce_from)
|
||||||
|
+ context.possible_equate_type_unknown(sp, ty.ty, Context::IvarUnknownType::To);
|
||||||
|
+
|
||||||
|
+ // Also disable inferrence (for this pass) for all ivars in affected bounds
|
||||||
|
+ if(false)
|
||||||
|
+ for(const auto& la : context.link_assoc)
|
||||||
|
+ {
|
||||||
|
+ bool found = false;
|
||||||
|
+ auto cb = [&](const auto& t) { return TU_TEST1(t.data(), Infer, .index == i); };
|
||||||
|
+ if( la.left_ty != ::HIR::TypeRef() )
|
||||||
|
+ found |= visit_ty_with( la.left_ty, cb );
|
||||||
|
+ found |= visit_ty_with( la.impl_ty, cb );
|
||||||
|
+ for(const auto& t : la.params.m_types)
|
||||||
|
+ found |= visit_ty_with( t, cb );
|
||||||
|
+ if( found )
|
||||||
|
+ {
|
||||||
|
+ if(la.left_ty != ::HIR::TypeRef())
|
||||||
|
+ context.possible_equate_type_unknown(sp, la.left_ty, Context::IvarUnknownType::From);
|
||||||
|
+ context.possible_equate_type_unknown(sp, la.impl_ty, Context::IvarUnknownType::From);
|
||||||
|
+ for(const auto& t : la.params.m_types)
|
||||||
|
+ context.possible_equate_type_unknown(sp, t, Context::IvarUnknownType::From);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.55.0
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,54 @@
|
|||||||
|
diff --git a/run_rustc/Makefile b/run_rustc/Makefile
|
||||||
|
index e78d8c51..cc9f785e 100644
|
||||||
|
--- a/run_rustc/Makefile
|
||||||
|
+++ b/run_rustc/Makefile
|
||||||
|
@@ -150,14 +150,23 @@ $(CARGO_HOME)config: Makefile
|
||||||
|
$Vecho "[source.vendored-sources]" >> $@
|
||||||
|
$Vecho "directory = \"$(abspath $(VENDOR_DIR))\"" >> $@
|
||||||
|
|
||||||
|
+self-contained:
|
||||||
|
+ mkdir -p $@
|
||||||
|
+ (set -o braceexpand && ln -s \
|
||||||
|
+ /system/lib/{'rcrt1.o','crti.o','crtn.o'} \
|
||||||
|
+ /system/lib/gcc/"$(ROSA_TRIPLE)"/"$(shell gcc -dumpfullversion)"/{'crtbeginS.o','crtendS.o'} \
|
||||||
|
+ /system/lib/"$(ROSA_TRIPLE)"/* \
|
||||||
|
+ $@)
|
||||||
|
+
|
||||||
|
# -------------------------------------
|
||||||
|
# Stage 1: Build standard library (using minicargo with rustc)
|
||||||
|
# - Can't use `cargo` because there isn't a rustc-compatible std yet
|
||||||
|
# - _could_ use it if mrustc accepted all the arguments rustc does (via the proxy)
|
||||||
|
# -------------------------------------
|
||||||
|
-$(LIBDIR_S)libstd.rlib: $(BINDIR_S)rustc $(MINICARGO) Makefile
|
||||||
|
+$(LIBDIR_S)libstd.rlib: self-contained $(BINDIR_S)rustc $(MINICARGO) Makefile
|
||||||
|
@echo "[MINICARGO] $(RUST_SRC_LIBS)std > $(LIBDIR_S)"
|
||||||
|
- mkdir -p $(LIBDIR_S)
|
||||||
|
+ @mkdir -p $(LIBDIR_S)
|
||||||
|
+ @ln -sf ../../../../../../self-contained $(LIBDIR_S)
|
||||||
|
ifneq ($(TARGETVER_LEAST_1_74),)
|
||||||
|
$V+STD_ENV_ARCH=$(RUSTC_ARCH) MRUSTC_PATH=$(abspath $(BINDIR_S)rustc) $(MINICARGO) --vendor-dir $(VENDOR_DIR) --script-overrides ../script-overrides/stable-$(RUSTC_VERSION)-$(PLATFORM)/ --output-dir $(LIBDIR_S) $(RUST_SRC_LIBS)sysroot
|
||||||
|
else
|
||||||
|
@@ -178,6 +187,7 @@ CARGO_OUTDIR_STAGE2_STD := $(OUTDIR)build-std2/$(RUSTC_TARGET)/release/
|
||||||
|
CARGO_ENV_STAGE2_STD := CARGO_TARGET_DIR=$(OUTDIR)build-std2 RUSTC=$(abspath rustc_proxy.sh) PROXY_RUSTC=$(abspath $(BINDIR_2)rustc) PROXY_MRUSTC=$(abspath $(BINDIR_S)rustc) $(CARGO_ENV)
|
||||||
|
$(LIBDIR_2)libtest.rlib: $(LIBDIR_S)libstd.rlib $(BINDIR_2)rustc $(BINDIR_S)rustc $(BINDIR_S)cargo $(CARGO_HOME)config Makefile
|
||||||
|
@mkdir -p $(LIBDIR_2)
|
||||||
|
+ @ln -sf ../../../../../../self-contained $(LIBDIR_2)
|
||||||
|
@echo [CARGO] $(RUST_SRC_LIBS)test/Cargo.toml '>' $(OUTDIR)build-std2
|
||||||
|
ifneq ($(TARGETVER_LEAST_1_74),)
|
||||||
|
$V$(CARGO_ENV_STAGE2_STD) $(BINDIR_S)cargo build $(CARGO_FLAGS) --manifest-path $(RUST_SRC_LIBS)sysroot/Cargo.toml --features panic-unwind
|
||||||
|
@@ -215,6 +225,7 @@ else
|
||||||
|
@echo "[CP] libraries and results ($@)"
|
||||||
|
endif
|
||||||
|
@mkdir -p $(LIBDIR)
|
||||||
|
+ @ln -sf ../../../../../../self-contained $(LIBDIR)
|
||||||
|
$Vcp $(LIBDIR_2)*.$(DYLIB_EXT) $(PREFIX)lib
|
||||||
|
$Vcp $(CARGO_OUTDIR_RUSTC)deps/*.rlib $(LIBDIR)
|
||||||
|
$Vcp $(CARGO_OUTDIR_RUSTC)deps/*.$(DYLIB_EXT) $(LIBDIR)
|
||||||
|
@@ -243,6 +254,7 @@ CARGO_OUTDIR_STAGE3_STD := $(OUTDIR)build-std/$(RUSTC_TARGET)/release/
|
||||||
|
CARGO_ENV_STAGE3_STD := CARGO_TARGET_DIR=$(OUTDIR)build-std RUSTC=$(abspath rustc_proxy.sh) PROXY_RUSTC=$(abspath $(BINDIR)rustc) PROXY_MRUSTC=$(abspath $(BINDIR_2)rustc) $(CARGO_ENV)
|
||||||
|
$(LIBDIR)libstd.rlib: $(BINDIR)rustc
|
||||||
|
@mkdir -p $(LIBDIR)
|
||||||
|
+ @ln -sf ../../../../../../self-contained $(LIBDIR)
|
||||||
|
@echo [CARGO] $(RUST_SRC_LIBS)test/Cargo.toml '>' $(OUTDIR)build-std2
|
||||||
|
ifneq ($(TARGETVER_LEAST_1_74),)
|
||||||
|
$V$(CARGO_ENV_STAGE3_STD) $(BINDIR_S)cargo build $(CARGO_FLAGS) --manifest-path $(RUST_SRC_LIBS)sysroot/Cargo.toml --features panic-unwind
|
||||||
@@ -0,0 +1,223 @@
|
|||||||
|
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 = "unpatched bootstrap rust toolchain source tree";
|
||||||
|
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-llvm {
|
||||||
|
description = "bootstrap rustc-standalone LLVM build";
|
||||||
|
exclude = true;
|
||||||
|
|
||||||
|
source = rustc-bootstrap-source;
|
||||||
|
exec = cmake {
|
||||||
|
append = [ "src", "llvm-project", "llvm" ];
|
||||||
|
|
||||||
|
// Reference $(RUSTCSRC)src/bootstrap/native.rs for these values
|
||||||
|
cache = {
|
||||||
|
"CMAKE_C_COMPILER": "gcc";
|
||||||
|
"CMAKE_C_FLAGS": "-w";
|
||||||
|
"CMAKE_CXX_COMPILER": "g++";
|
||||||
|
"CMAKE_CXX_FLAGS": "-w";
|
||||||
|
"LLVM_LINK_LLVM_DYLIB": "OFF";
|
||||||
|
"LLVM_TARGETS_TO_BUILD": "'X86;ARM;AArch64'";
|
||||||
|
"LLVM_ENABLE_ASSERTIONS": "OFF";
|
||||||
|
"LLVM_INCLUDE_EXAMPLES": "OFF";
|
||||||
|
"LLVM_INCLUDE_TESTS": "OFF";
|
||||||
|
"LLVM_INCLUDE_DOCS": "OFF";
|
||||||
|
"LLVM_INCLUDE_BENCHMARKS": "OFF";
|
||||||
|
"LLVM_ENABLE_ZLIB": "OFF";
|
||||||
|
"LLVM_ENABLE_TERMINFO": "OFF";
|
||||||
|
"LLVM_ENABLE_LIBEDIT": "OFF";
|
||||||
|
"WITH_POLLY": "OFF";
|
||||||
|
"LIBUNWIND_ENABLE_SHARED": "OFF";
|
||||||
|
};
|
||||||
|
skipTest = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
inputs = [
|
||||||
|
python-early,
|
||||||
|
|
||||||
|
gcc,
|
||||||
|
kernel-headers,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
package rustc-mrustc {
|
||||||
|
description = "initial rustc stage compiled by mrustc";
|
||||||
|
exclude = true;
|
||||||
|
|
||||||
|
source = rustc-bootstrap-source;
|
||||||
|
extra = [
|
||||||
|
mrustc-source,
|
||||||
|
rustc-bootstrap-llvm,
|
||||||
|
];
|
||||||
|
|
||||||
|
writable = true;
|
||||||
|
early = "cd ../extra/mrustc-source";
|
||||||
|
minimal = true;
|
||||||
|
|
||||||
|
exec = make {
|
||||||
|
inPlace = true;
|
||||||
|
skipConfigure = true;
|
||||||
|
preMake = `
|
||||||
|
LLVM='../rustc-bootstrap-llvm/system/bin/llvm-config'
|
||||||
|
RUSTC_SOURCE='../../rustc-mrustc'
|
||||||
|
|
||||||
|
export CC=gcc CXX=g++
|
||||||
|
export PARLEVEL=`+jobsE+`
|
||||||
|
export RUSTC_TARGET="$(uname -m)-unknown-linux-musl"
|
||||||
|
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/
|
||||||
|
ln -sf gcc /system/bin/cc
|
||||||
|
ln -sf g++ /system/bin/c++
|
||||||
|
`;
|
||||||
|
make = [
|
||||||
|
"-f",
|
||||||
|
"minicargo.mk",
|
||||||
|
"CXX='g++ -w'",
|
||||||
|
`LLVM_CONFIG="$LLVM"`,
|
||||||
|
"LIBS",
|
||||||
|
];
|
||||||
|
check = [
|
||||||
|
"CXX='g++ -w'",
|
||||||
|
// run this first to avoid intermittent failures
|
||||||
|
"local_tests",
|
||||||
|
];
|
||||||
|
|
||||||
|
install = `
|
||||||
|
make \
|
||||||
|
`+jobsFlagE+` \
|
||||||
|
`+loadFlagE+` \
|
||||||
|
CXX='g++ -w' \
|
||||||
|
test
|
||||||
|
|
||||||
|
OUTDIR="output-$RUSTC_VERSION"
|
||||||
|
make -f minicargo.mk LLVM_CONFIG="$LLVM" "$OUTDIR/rustc"
|
||||||
|
make -f minicargo.mk LLVM_CONFIG="$LLVM" "$OUTDIR/cargo"
|
||||||
|
mkdir -p /work/system/bin/
|
||||||
|
(set -o braceexpand && cp "$OUTDIR"/{rustc,cargo} bin/minicargo /work/system/bin/)
|
||||||
|
`;
|
||||||
|
};
|
||||||
|
|
||||||
|
inputs = [
|
||||||
|
bash,
|
||||||
|
perl,
|
||||||
|
patch,
|
||||||
|
mrustc,
|
||||||
|
llvm,
|
||||||
|
];
|
||||||
|
|
||||||
|
runtime = [ gcc, llvm, mrustc ];
|
||||||
|
}
|
||||||
|
|
||||||
|
package rustc-bootstrap {
|
||||||
|
description = "early rustc bootstrapped by rustc-mrustc";
|
||||||
|
exclude = true;
|
||||||
|
|
||||||
|
source = rustc-bootstrap-source;
|
||||||
|
extra = [ mrustc-source ];
|
||||||
|
files = {
|
||||||
|
"b00-link-self-contained.patch";
|
||||||
|
};
|
||||||
|
|
||||||
|
writable = true;
|
||||||
|
early = "cd ../extra/mrustc-source";
|
||||||
|
minimal = true;
|
||||||
|
|
||||||
|
exec = make {
|
||||||
|
inPlace = true;
|
||||||
|
skipConfigure = true;
|
||||||
|
preMake = `
|
||||||
|
RUSTC_SOURCE='../../rustc-bootstrap'
|
||||||
|
|
||||||
|
export RUSTC_TARGET="$(uname -m)-unknown-linux-musl"
|
||||||
|
export RUSTC_VERSION="$(cut -d ' ' -f 1 "$RUSTC_SOURCE/version")"
|
||||||
|
|
||||||
|
patch -d "$RUSTC_SOURCE" -p0 < "rustc-$RUSTC_VERSION-src.patch"
|
||||||
|
cat /usr/src/*.patch | patch -p1
|
||||||
|
|
||||||
|
ln -s "$RUSTC_SOURCE" "rustc-$RUSTC_VERSION-src"
|
||||||
|
mkdir bin "output-$RUSTC_VERSION"
|
||||||
|
(set -o braceexpand && \
|
||||||
|
ln -s /system/bin/{mrustc,minicargo} bin/ && \
|
||||||
|
ln -s /system/bin/{rustc,cargo} "output-$RUSTC_VERSION")
|
||||||
|
ln -sf gcc /system/bin/cc
|
||||||
|
ln -sf g++ /system/bin/c++
|
||||||
|
`;
|
||||||
|
make = [
|
||||||
|
"-C", "run_rustc",
|
||||||
|
"CC=gcc",
|
||||||
|
"PARLEVEL="+jobsE,
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
inputs = [
|
||||||
|
bash,
|
||||||
|
patch,
|
||||||
|
|
||||||
|
rustc-mrustc,
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -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)
|
||||||
|
|
||||||
Reference in New Issue
Block a user