summaryrefslogtreecommitdiff
path: root/dev-lang/mrustc
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2025-01-20 06:42:03 +0000
committerV3n3RiX <venerix@koprulu.sector>2025-01-20 06:42:03 +0000
commitcd57012a0ef40d302cf7d5a92dd2f3dfae285d2f (patch)
tree901ae45158f35951dbc249ac7e62a2a5b78da25c /dev-lang/mrustc
parentb2ec252cbc0a7476fb6892f96130c8cdc35591ac (diff)
gentoo auto-resync : 20:01:2025 - 06:42:03
Diffstat (limited to 'dev-lang/mrustc')
-rw-r--r--dev-lang/mrustc/Manifest10
-rw-r--r--dev-lang/mrustc/files/mrustc-0.10.1-git-be-gone.patch23
-rw-r--r--dev-lang/mrustc/files/mrustc-0.11.0-RUSTC_SRC_PROVIDED.patch222
-rw-r--r--dev-lang/mrustc/files/mrustc-0.11.0-default-to-rust-1_74.patch19
-rw-r--r--dev-lang/mrustc/files/mrustc-0.11.2-dont-strip-bins.patch28
-rw-r--r--dev-lang/mrustc/files/mrustc-0.11.2-gcc15.patch28
-rw-r--r--dev-lang/mrustc/metadata.xml19
-rw-r--r--dev-lang/mrustc/mrustc-0.11.2.ebuild108
-rw-r--r--dev-lang/mrustc/mrustc-9999.ebuild105
9 files changed, 562 insertions, 0 deletions
diff --git a/dev-lang/mrustc/Manifest b/dev-lang/mrustc/Manifest
new file mode 100644
index 000000000000..b583dbdd89c7
--- /dev/null
+++ b/dev-lang/mrustc/Manifest
@@ -0,0 +1,10 @@
+AUX mrustc-0.10.1-git-be-gone.patch 1223 BLAKE2B 35cdec27655b39ba80fc73766b2c1d883abe0fa2ea8744312c3d093b184e42e10a2bfdec7e9d6ea11d550e9cf9b75b36a63a6cc869c5084f7af1db8c062ef8b1 SHA512 5e5fcb0fdff5a412ac0c06e4709312041bb2d47155f0de195821c47aae3fb98a9d0c9a22189a2940e77b6eb6188a79e8d92feecd3e9dccecadb4761885e8293a
+AUX mrustc-0.11.0-RUSTC_SRC_PROVIDED.patch 12164 BLAKE2B 213e8eceefaab33d99fdcf6bf6f391971b5c5ffefa76402840d593b850d4a1c5cae1660e81de426333e817633063aa164ec73b4dfe43f63cc39dbc456e3bba8c SHA512 6dbda716d24e86ff35760a338669b6a8f5729224d1a57d33e030b0dc4c4c1886c1976100d38eeef31b24aae9fba337f789b5f82f2401eab9e8ac156c3964fa50
+AUX mrustc-0.11.0-default-to-rust-1_74.patch 419 BLAKE2B c727c94edef6cca8b719f1c1246a24834cc1b3bf44015094ddfc24f2174075a437ceb14b70612ab04d9db4c0e009f43e2fd458702e89752f4ae8e6578c992430 SHA512 9dfa01ae8958f9c07b8830639dfd43b2cd3efb51097dd010d4241d0e0c0a56d8405ff1a362e8ab61364cb0c9372221c741392f96ce3dc37427a6a5091a9eaa3b
+AUX mrustc-0.11.2-dont-strip-bins.patch 818 BLAKE2B 0da4dc48da58b9e3cb58594c4fb0392d8c3cc04a2b0f38bd28fc8a9468bffd888774f183ddadfe8290039363d1a1247171768d711af555444bcbf62e01356b26 SHA512 1024e384a8ef231017fe1b2407e1bf38b5af009a77b9bd04ec7d449922d45b6eecef1678b70931fe350b7ed95020429e959ef11971b9ccb99eaf1d72dd766ad7
+AUX mrustc-0.11.2-gcc15.patch 577 BLAKE2B b65dfa58abe5fe660f2c895425d311c8cd2951d40fbd2ee013f0022859a710c69a24a2e612dc994fae0e6e189e337205455ca89bd84722517e2d7feffb94e660 SHA512 cf08e0a12f96724e42f578c485701507bcabc5eb0d10f78c0bceeda46f40fc93d6b12ac56622c4147e959ca002ec2e1f30e7060355a5d3e4f6a2b430aae6a370
+DIST mrustc-0.11.2.tar.gz 1364024 BLAKE2B e68178d952b3afef526f99dda24def646ebefbf661200e7b57a7ea054c511075a1455e6456f3fbb0e4c1042660f716f92bcee990054dbe7c1ebc4185ce0e3899 SHA512 9a39249c38eee109c4f60af051df89aa5ab1e3408761d67d3ee8ae05cded03b9e4fd36b554a470e35c77d214bf02d39f172ab04fdcb8b03fac068d8af268ebf5
+DIST rustc-1.74.1-src.tar.xz 155968724 BLAKE2B e05f2379ac94b286f85791a138e1928e5b5b5a7749f0981d82c40c2a12860f55bf96bb2f0e924e35a0f8b2447b13052d38adea909aaa3199105787bb5a4861b3 SHA512 14c7e7ed2f38ab60299d8c7d41d78f042b6b57ef822d577b5138e60bdde31cf141eccd4332a25bc5da3d58eb5313d63c1448b5dfe9e11b8055bb8ea133a9038d
+EBUILD mrustc-0.11.2.ebuild 3410 BLAKE2B 673b73aef3d9b51e7db11c51acb9ef14c1fc5c913f13352f1607d77f4499d3bc956e8dee9b377f7bf66390eca71153a558e9274343aac0a0a915d3566cfd2353 SHA512 0702489c7065e229aae6fc9e8b7a351519d3d7f60334c3ec6ebef6e3c1c0f25603b373094fc0d0a2e69f92db30d3a9c232901411e600ff04aa9b4e8395a2d4d1
+EBUILD mrustc-9999.ebuild 3274 BLAKE2B 5de926a9c79d70550daf554b94245e5aa4cedc5f747941fc1f52dfee8166ff247a55c510010909ce81c7cdad3cb7e7cf5975b03cbf39107fec3011ce2da16fc6 SHA512 ce9fd58a0f9a3e40927fdcc048cc9afc131de6ec06f783b2a6381914e30a3a7e6b0662e8105d6facc9a54e2e4c75c9d0c4891c896de4f04cbb9bf11740a67c3c
+MISC metadata.xml 638 BLAKE2B f15f072927ead8d1219d81b0d0ed5aaae2eeae47b5ec5e4f2858b44da869d8ed6fa8d6c1284ab65010d26800d46a8c2e77a73caeea282129cd4503b2e7190a24 SHA512 5fb75bdae1886e7cf28d856aec25c3fa37661db24d5d7c487e238a2b671fefb43f03e40209cf0f559b2cf0bd22d6ffaa0f917d27cab976422883405b18a9da81
diff --git a/dev-lang/mrustc/files/mrustc-0.10.1-git-be-gone.patch b/dev-lang/mrustc/files/mrustc-0.10.1-git-be-gone.patch
new file mode 100644
index 000000000000..3323b4c88b4c
--- /dev/null
+++ b/dev-lang/mrustc/files/mrustc-0.10.1-git-be-gone.patch
@@ -0,0 +1,23 @@
+From 0615d38df2c47fa7dc3f64ca54fd35e70e75ee59 Mon Sep 17 00:00:00 2001
+From: Matt Jolly <kangie@gentoo.org>
+Date: Thu, 5 Dec 2024 17:18:29 +1000
+Subject: [PATCH] git-be-gone
+
+--- a/Makefile
++++ b/Makefile
+@@ -178,7 +178,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 date -uR)\"" -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=\"gentoo\" -D VERSION_GIT_BRANCH=\"gentoo\" -D VERSION_GIT_SHORTHASH=\"gentoo\" -D VERSION_BUILDTIME="\"$(shell date -uR)\"" -D VERSION_GIT_ISDIRTY="0"
+
+ src/main.cpp: $(PCHS:%=src/%.gch)
+
+@@ -192,4 +192,3 @@ bin/common_lib.a:
+ -include $(OBJ:%=%.dep)
+
+ # vim: noexpandtab ts=4
+-
+--
+2.47.0
diff --git a/dev-lang/mrustc/files/mrustc-0.11.0-RUSTC_SRC_PROVIDED.patch b/dev-lang/mrustc/files/mrustc-0.11.0-RUSTC_SRC_PROVIDED.patch
new file mode 100644
index 000000000000..c72f4ae40950
--- /dev/null
+++ b/dev-lang/mrustc/files/mrustc-0.11.0-RUSTC_SRC_PROVIDED.patch
@@ -0,0 +1,222 @@
+From 3881d541d0934bd35f26ef7b74672e755061efef Mon Sep 17 00:00:00 2001
+From: Matt Jolly <kangie@gentoo.org>
+Date: Mon, 9 Dec 2024 13:05:44 +1000
+Subject: [PATCH] Add `RUSTC_SRC_PROVIDED` for sandboxed installs
+
+Allows package managers to provide an extracted rustc
+source to patch and build against. This effictively no-ops
+the fetch and unpack steps of minicargo.mk entirely, and
+adds some sanity checks to ensure that `RUSTCSRC` comes
+from the environment and contains a `Cargo.toml`.
+
+we also add a `/` after every `$(RUSTCSRC)` path fragment
+just in case the path from the environment does not have one.
+
+Signed-off-by: Matt Jolly <kangie@gentoo.org>
+--- a/minicargo.mk
++++ b/minicargo.mk
+@@ -16,6 +16,9 @@ endif
+ RUSTC_VERSION_DEF := $(shell cat rust-version)
+ RUSTC_VERSION ?= $(RUSTC_VERSION_DEF)
+
++# Distros may want to sandbox the build and provide the source themselves
++RUSTC_SRC_PROVIDED := 0
++
+ # OUTDIR_SUF : Output directory suffix
+ ifeq ($(RUSTC_VERSION),$(RUSTC_VERSION_DEF))
+ OUTDIR_SUF_DEF :=
+@@ -91,18 +94,26 @@ else
+ RUSTC_OUT_BIN := rustc_main
+ endif
+
+-ifeq ($(RUSTC_CHANNEL),nightly)
+- RUSTCSRC := rustc-nightly-src/
++ifeq ($(RUSTC_SRC_PROVIDED),0)
++ ifeq ($(RUSTC_CHANNEL),nightly)
++ RUSTCSRC := rustc-nightly-src
++ else
++ RUSTCSRC := rustc-$(RUSTC_VERSION)-src
++ endif
+ else
+- RUSTCSRC := rustc-$(RUSTC_VERSION)-src/
++ # Strip trailing slash from rustcsrc if present
++ RUSTCSRC := $(RUSTCSRC:/=)
++ ifeq ($(wildcard $(RUSTCSRC)/Cargo.toml),)
++ $(error "RUSTCSRC is not set to a valid directory: $(RUSTCSRC)/")
++ endif
+ endif
+ RUSTC_SRC_DL := $(RUSTCSRC)/dl-version
+ ifeq ($(RUSTC_VERSION),1.19.0)
+- VENDOR_DIR := $(RUSTCSRC)src/vendor
++ VENDOR_DIR := $(RUSTCSRC)/src/vendor
+ else ifeq ($(RUSTC_VERSION),1.29.0)
+- VENDOR_DIR := $(RUSTCSRC)src/vendor
++ VENDOR_DIR := $(RUSTCSRC)/src/vendor
+ else
+- VENDOR_DIR := $(RUSTCSRC)vendor
++ VENDOR_DIR := $(RUSTCSRC)/vendor
+ MINICARGO_FLAGS += --manifest-overrides rustc-$(RUSTC_VERSION)-overrides.toml
+ endif
+ ifeq ($(RUSTC_VERSION),1.54.0)
+@@ -132,12 +143,12 @@ ifeq ($(RUSTC_VERSION),1.74.0)
+ SRCDIR_RUSTC_DRIVER := compiler/rustc_driver
+ endif
+
+-SRCDIR_RUST_TESTS := $(RUSTCSRC)src/test/
++SRCDIR_RUST_TESTS := $(RUSTCSRC)/src/test/
+ ifeq ($(RUSTC_VERSION),1.74.0)
+-SRCDIR_RUST_TESTS := $(RUSTCSRC)tests/
++SRCDIR_RUST_TESTS := $(RUSTCSRC)/tests/
+ endif
+
+-LLVM_CONFIG := $(RUSTCSRC)build/bin/llvm-config
++LLVM_CONFIG := $(RUSTCSRC)/build/bin/llvm-config
+ ifeq ($(shell uname -s || echo not),Darwin)
+ # /usr/bin/uname because uname might call coreutils
+ # which can make the arm64 uname called when
+@@ -205,6 +216,7 @@ bin/testrunner$(EXESUF):
+ # rustc (with std/cargo) source download
+ #
+ RUSTC_SRC_TARBALL := rustc-$(RUSTC_VERSION)-src.tar.gz
++ifeq ($(RUSTC_SRC_PROVIDED),0)
+ $(RUSTC_SRC_TARBALL):
+ @echo [CURL] $@
+ @rm -f $@
+@@ -212,15 +224,23 @@ $(RUSTC_SRC_TARBALL):
+ rustc-$(RUSTC_VERSION)-src/extracted: $(RUSTC_SRC_TARBALL)
+ tar -xf $(RUSTC_SRC_TARBALL)
+ touch $@
+-$(RUSTC_SRC_DL): rustc-$(RUSTC_VERSION)-src/extracted rustc-$(RUSTC_VERSION)-src.patch
+- cd $(RUSTCSRC) && patch -p0 < ../rustc-$(RUSTC_VERSION)-src.patch;
++else
++$(RUSTC_SRC_TARBALL):
++ @echo "RUSTC_SRC_PROVIDED is set, no need to fetch source"
++rustc-$(RUSTC_VERSION)-src/extracted: $(RUSTC_SRC_TARBALL)
++ touch $(RUSTCSRC)/extracted
++endif
++
++$(RUSTC_SRC_DL): $(RUSTC_SRC_TARBALL) rustc-$(RUSTC_VERSION)-src/extracted rustc-$(RUSTC_VERSION)-src.patch
++ PATCH_FILE=$(abspath rustc-$(RUSTC_VERSION)-src.patch); \
++ cd $(RUSTCSRC) && patch -p0 < $$PATCH_FILE;
+ touch $@
+
+ # Standard library crates
+ # - 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: $(RUSTC_SRC_DL) minicargo.mk
+ @mkdir -p $(dir $@)
+ @echo "#![no_core]" > $(dir $@)/lib.rs
+ @echo "[package]" > $@
+@@ -232,23 +252,23 @@ $(RUSTCSRC)mrustc-stdlib/Cargo.toml: $(RUSTC_SRC_DL) minicargo.mk
+ @echo "std = { path = \"../$(RUST_LIB_PREFIX)std\" }" >> $@
+ @echo "panic_unwind = { path = \"../$(RUST_LIB_PREFIX)panic_unwind\" }" >> $@
+ @echo "test = { path = \"../$(RUST_LIB_PREFIX)test\" }" >> $@
+-LIBS: $(RUSTCSRC)mrustc-stdlib/Cargo.toml $(MRUSTC) $(MINICARGO)
+- +$(MINICARGO) --vendor-dir $(VENDOR_DIR) --script-overrides $(OVERRIDE_DIR) --output-dir $(OUTDIR) $(MINICARGO_FLAGS) $(RUSTCSRC)mrustc-stdlib/
++LIBS: $(RUSTCSRC)/mrustc-stdlib/Cargo.toml $(MRUSTC) $(MINICARGO)
++ +$(MINICARGO) --vendor-dir $(VENDOR_DIR) --script-overrides $(OVERRIDE_DIR) --output-dir $(OUTDIR) $(MINICARGO_FLAGS) $(RUSTCSRC)/mrustc-stdlib/
+ +$(MINICARGO) --output-dir $(OUTDIR) $(MINICARGO_FLAGS) lib/libproc_macro
+ else
+ LIBS: $(MRUSTC) $(MINICARGO) $(RUSTC_SRC_DL)
+- +$(MINICARGO) --vendor-dir $(VENDOR_DIR) --script-overrides $(OVERRIDE_DIR) --output-dir $(OUTDIR) $(MINICARGO_FLAGS) $(RUSTCSRC)$(RUST_LIB_PREFIX)std
+- +$(MINICARGO) --vendor-dir $(VENDOR_DIR) --script-overrides $(OVERRIDE_DIR) --output-dir $(OUTDIR) $(MINICARGO_FLAGS) $(RUSTCSRC)$(RUST_LIB_PREFIX)panic_unwind
+- +$(MINICARGO) --vendor-dir $(VENDOR_DIR) --script-overrides $(OVERRIDE_DIR) --output-dir $(OUTDIR) $(MINICARGO_FLAGS) $(RUSTCSRC)$(RUST_LIB_PREFIX)test
++ +$(MINICARGO) --vendor-dir $(VENDOR_DIR) --script-overrides $(OVERRIDE_DIR) --output-dir $(OUTDIR) $(MINICARGO_FLAGS) $(RUSTCSRC)/$(RUST_LIB_PREFIX)std
++ +$(MINICARGO) --vendor-dir $(VENDOR_DIR) --script-overrides $(OVERRIDE_DIR) --output-dir $(OUTDIR) $(MINICARGO_FLAGS) $(RUSTCSRC)/$(RUST_LIB_PREFIX)panic_unwind
++ +$(MINICARGO) --vendor-dir $(VENDOR_DIR) --script-overrides $(OVERRIDE_DIR) --output-dir $(OUTDIR) $(MINICARGO_FLAGS) $(RUSTCSRC)/$(RUST_LIB_PREFIX)test
+ +$(MINICARGO) --output-dir $(OUTDIR) $(MINICARGO_FLAGS) lib/libproc_macro
+ endif
+
+ # Dynamically linked version of the standard library
+ $(OUTDIR)test/libtest.so: $(RUSTC_SRC_DL)
+ mkdir -p $(dir $@)
+- +MINICARGO_DYLIB=1 $(MINICARGO) $(RUSTCSRC)$(RUST_LIB_PREFIX)std --vendor-dir $(VENDOR_DIR) --script-overrides $(OVERRIDE_DIR) --output-dir $(dir $@) $(MINICARGO_FLAGS)
+- +MINICARGO_DYLIB=1 $(MINICARGO) $(RUSTCSRC)$(RUST_LIB_PREFIX)panic_unwind --vendor-dir $(VENDOR_DIR) --script-overrides $(OVERRIDE_DIR) --output-dir $(dir $@) $(MINICARGO_FLAGS)
+- +MINICARGO_DYLIB=1 $(MINICARGO) $(RUSTCSRC)$(RUST_LIB_PREFIX)test --vendor-dir $(VENDOR_DIR) --output-dir $(dir $@) $(MINICARGO_FLAGS)
++ +MINICARGO_DYLIB=1 $(MINICARGO) $(RUSTCSRC)/$(RUST_LIB_PREFIX)std --vendor-dir $(VENDOR_DIR) --script-overrides $(OVERRIDE_DIR) --output-dir $(dir $@) $(MINICARGO_FLAGS)
++ +MINICARGO_DYLIB=1 $(MINICARGO) $(RUSTCSRC)/$(RUST_LIB_PREFIX)panic_unwind --vendor-dir $(VENDOR_DIR) --script-overrides $(OVERRIDE_DIR) --output-dir $(dir $@) $(MINICARGO_FLAGS)
++ +MINICARGO_DYLIB=1 $(MINICARGO) $(RUSTCSRC)/$(RUST_LIB_PREFIX)test --vendor-dir $(VENDOR_DIR) --output-dir $(dir $@) $(MINICARGO_FLAGS)
+ test -e $@
+
+ RUSTC_ENV_VARS := CFG_COMPILER_HOST_TRIPLE=$(RUSTC_TARGET)
+@@ -264,17 +284,17 @@ RUSTC_ENV_VARS += RUSTC_INSTALL_BINDIR=bin
+
+ $(OUTDIR)rustc: $(MRUSTC) $(MINICARGO) LIBS $(LLVM_CONFIG)
+ mkdir -p $(OUTDIR)rustc-build
+- +$(RUSTC_ENV_VARS) $(MINICARGO) $(RUSTCSRC)$(SRCDIR_RUSTC) --vendor-dir $(VENDOR_DIR) --output-dir $(OUTDIR)rustc-build -L $(OUTDIR) $(MINICARGO_FLAGS) $(MINICARGO_FLAGS_$@)
++ +$(RUSTC_ENV_VARS) $(MINICARGO) $(RUSTCSRC)/$(SRCDIR_RUSTC) --vendor-dir $(VENDOR_DIR) --output-dir $(OUTDIR)rustc-build -L $(OUTDIR) $(MINICARGO_FLAGS) $(MINICARGO_FLAGS_$@)
+ test -e $@ -a ! $(OUTDIR)rustc-build/$(RUSTC_OUT_BIN) -nt $@ || cp $(OUTDIR)rustc-build/$(RUSTC_OUT_BIN) $@
+ $(OUTDIR)rustc-build/librustc_driver.rlib: $(MRUSTC) $(MINICARGO) LIBS
+ mkdir -p $(OUTDIR)rustc-build
+- +$(RUSTC_ENV_VARS) $(MINICARGO) $(RUSTCSRC)$(SRCDIR_RUSTC_DRIVER) --vendor-dir $(VENDOR_DIR) --output-dir $(OUTDIR)rustc-build -L $(OUTDIR) $(MINICARGO_FLAGS) $(MINICARGO_FLAGS_$(OUTDIR)rustc)
++ +$(RUSTC_ENV_VARS) $(MINICARGO) $(RUSTCSRC)/$(SRCDIR_RUSTC_DRIVER) --vendor-dir $(VENDOR_DIR) --output-dir $(OUTDIR)rustc-build -L $(OUTDIR) $(MINICARGO_FLAGS) $(MINICARGO_FLAGS_$(OUTDIR)rustc)
+ $(OUTDIR)cargo: $(MRUSTC) LIBS
+ mkdir -p $(OUTDIR)cargo-build
+- +$(CARGO_ENV_VARS) $(MINICARGO) $(RUSTCSRC)src/tools/cargo --vendor-dir $(VENDOR_DIR) --output-dir $(OUTDIR)cargo-build -L $(OUTDIR) $(MINICARGO_FLAGS) $(MINICARGO_FLAGS_$@)
++ +$(CARGO_ENV_VARS) $(MINICARGO) $(RUSTCSRC)/src/tools/cargo --vendor-dir $(VENDOR_DIR) --output-dir $(OUTDIR)cargo-build -L $(OUTDIR) $(MINICARGO_FLAGS) $(MINICARGO_FLAGS_$@)
+ test -e $@ -a ! $(OUTDIR)cargo-build/cargo -nt $@ || cp $(OUTDIR)cargo-build/cargo $@
+
+-# Reference $(RUSTCSRC)src/bootstrap/native.rs for these values
++# Reference $(RUSTCSRC)/src/bootstrap/native.rs for these values
+ LLVM_CMAKE_OPTS := LLVM_TARGET_ARCH=$(firstword $(subst -, ,$(RUSTC_TARGET))) LLVM_DEFAULT_TARGET_TRIPLE=$(RUSTC_TARGET)
+ LLVM_CMAKE_OPTS += LLVM_TARGETS_TO_BUILD="$(LLVM_TARGETS)"
+ LLVM_CMAKE_OPTS += LLVM_ENABLE_ASSERTIONS=OFF
+@@ -286,22 +306,22 @@ LLVM_CMAKE_OPTS += CMAKE_BUILD_TYPE=Release
+ LLVM_CMAKE_OPTS += $(LLVM_CMAKE_OPTS_EXTRA)
+
+
+-$(RUSTCSRC)build/bin/llvm-config: $(RUSTCSRC)build/Makefile
+- $Vcd $(RUSTCSRC)build && $(MAKE) -j $(PARLEVEL)
++$(RUSTCSRC)/build/bin/llvm-config: $(RUSTCSRC)/build/Makefile
++ $Vcd $(RUSTCSRC)/build && $(MAKE) -j $(PARLEVEL)
+
+-$(RUSTCSRC)build/Makefile: $(RUSTCSRC)$(LLVM_DIR)/CMakeLists.txt
+- @mkdir -p $(RUSTCSRC)build
+- $Vcd $(RUSTCSRC)build && cmake $(addprefix -D , $(LLVM_CMAKE_OPTS)) ../$(LLVM_DIR)
++$(RUSTCSRC)/build/Makefile: $(RUSTCSRC)/$(LLVM_DIR)/CMakeLists.txt
++ @mkdir -p $(RUSTCSRC)/build
++ $Vcd $(RUSTCSRC)/build && cmake $(addprefix -D , $(LLVM_CMAKE_OPTS)) ../$(LLVM_DIR)
+
+ #
+ # Developement-only targets
+ #
+ $(OUTDIR)libcore.rlib: $(MRUSTC) $(MINICARGO)
+- $(MINICARGO) $(RUSTCSRC)src/libcore --script-overrides $(OVERRIDE_DIR) --output-dir $(OUTDIR) $(MINICARGO_FLAGS)
++ $(MINICARGO) $(RUSTCSRC)/src/libcore --script-overrides $(OVERRIDE_DIR) --output-dir $(OUTDIR) $(MINICARGO_FLAGS)
+ $(OUTDIR)liballoc.rlib: $(MRUSTC) $(MINICARGO)
+- $(MINICARGO) $(RUSTCSRC)src/liballoc --vendor-dir $(VENDOR_DIR) --script-overrides $(OVERRIDE_DIR) --output-dir $(OUTDIR) $(MINICARGO_FLAGS)
++ $(MINICARGO) $(RUSTCSRC)/src/liballoc --vendor-dir $(VENDOR_DIR) --script-overrides $(OVERRIDE_DIR) --output-dir $(OUTDIR) $(MINICARGO_FLAGS)
+ $(OUTDIR)rustc-build/librustdoc.rlib: $(MRUSTC) LIBS
+- $(MINICARGO) $(RUSTCSRC)src/librustdoc --vendor-dir $(VENDOR_DIR) --output-dir $(dir $@) -L $(OUTDIR) $(MINICARGO_FLAGS)
++ $(MINICARGO) $(RUSTCSRC)/src/librustdoc --vendor-dir $(VENDOR_DIR) --output-dir $(dir $@) -L $(OUTDIR) $(MINICARGO_FLAGS)
+ #$(OUTDIR)cargo-build/libserde-1_0_6.rlib: $(MRUSTC) LIBS
+ # $(MINICARGO) $(VENDOR_DIR)/serde --vendor-dir $(VENDOR_DIR) --output-dir $(dir $@) -L $(OUTDIR) $(MINICARGO_FLAGS)
+ $(OUTDIR)cargo-build/libgit2-0_6_6.rlib: $(MRUSTC) LIBS
+@@ -349,9 +369,9 @@ $(OUTDIR)test/librust_test_helpers.a: $(OUTDIR)test/rust_test_helpers.o
+ @mkdir -p $(dir $@)
+ ar cur $@ $<
+ ifeq ($(RUSTC_VERSION),1.19.0)
+-RUST_TEST_HELPERS_C := $(RUSTCSRC)src/rt/rust_test_helpers.c
++RUST_TEST_HELPERS_C := $(RUSTCSRC)/src/rt/rust_test_helpers.c
+ else
+-RUST_TEST_HELPERS_C := $(RUSTCSRC)src/test/auxiliary/rust_test_helpers.c
++RUST_TEST_HELPERS_C := $(RUSTCSRC)/src/test/auxiliary/rust_test_helpers.c
+ endif
+ output$(OUTDIR_SUF)/test/rust_test_helpers.o: $(RUST_TEST_HELPERS_C)
+ @mkdir -p $(dir $@)
+@@ -424,8 +444,8 @@ RUNTIME_ARGS_$(OUTDIR)stdtest/collectionstests += --skip ::vec::overaligned_allo
+ #ENV_$(OUTDIR)stdtest/rustc-test :=
+ #ENV_$(OUTDIR)stdtest/rustc-test += CFG_COMPILER_HOST_TRIPLE=$(RUSTC_TARGET)
+
+-$(OUTDIR)stdtest/%-test: $(RUSTCSRC)src/lib%/lib.rs LIBS
+- +MRUSTC_LIBDIR=$(abspath $(OUTDIR)) $(MINICARGO) --test $(RUSTCSRC)src/lib$* --vendor-dir $(VENDOR_DIR) --output-dir $(dir $@) -L $(OUTDIR)
++$(OUTDIR)stdtest/%-test: $(RUSTCSRC)/src/lib%/lib.rs LIBS
++ +MRUSTC_LIBDIR=$(abspath $(OUTDIR)) $(MINICARGO) --test $(RUSTCSRC)/src/lib$* --vendor-dir $(VENDOR_DIR) --output-dir $(dir $@) -L $(OUTDIR)
+ $(OUTDIR)stdtest/collectionstests: $(OUTDIR)stdtest/alloc-test
+ test -e $@
+ $(OUTDIR)collectionstest_out.txt: $(OUTDIR)%
+--
+2.47.1
+
diff --git a/dev-lang/mrustc/files/mrustc-0.11.0-default-to-rust-1_74.patch b/dev-lang/mrustc/files/mrustc-0.11.0-default-to-rust-1_74.patch
new file mode 100644
index 000000000000..ed459819b301
--- /dev/null
+++ b/dev-lang/mrustc/files/mrustc-0.11.0-default-to-rust-1_74.patch
@@ -0,0 +1,19 @@
+From f422e43cc314e4cfda059ddb63d31973c9e8b5b7 Mon Sep 17 00:00:00 2001
+From: Matt Jolly <kangie@gentoo.org>
+Date: Tue, 17 Dec 2024 17:55:59 +1000
+Subject: [PATCH] default to Rust 1_74
+
+--- a/src/main.cpp
++++ b/src/main.cpp
+@@ -39,7 +39,7 @@
+ # undef max
+ #endif
+
+-TargetVersion gTargetVersion = TargetVersion::Rustc1_29;
++TargetVersion gTargetVersion = TargetVersion::Rustc1_74;
+
+ struct ProgramParams
+ {
+--
+2.47.1
+
diff --git a/dev-lang/mrustc/files/mrustc-0.11.2-dont-strip-bins.patch b/dev-lang/mrustc/files/mrustc-0.11.2-dont-strip-bins.patch
new file mode 100644
index 000000000000..23eb40dbeeba
--- /dev/null
+++ b/dev-lang/mrustc/files/mrustc-0.11.2-dont-strip-bins.patch
@@ -0,0 +1,28 @@
+From e14e4e2e49d32827729bf41e08db1902fdf26911 Mon Sep 17 00:00:00 2001
+From: Matt Jolly <kangie@gentoo.org>
+Date: Fri, 17 Jan 2025 10:39:02 +1000
+Subject: [PATCH] don't strip bins
+
+--- a/Makefile
++++ b/Makefile
+@@ -176,7 +176,6 @@ else
+ $V$(CXX) -o $@ $(LINKFLAGS) $(OBJDIR)main.o -Wl,--whole-archive bin/mrustc.a -Wl,--no-whole-archive bin/common_lib.a $(LIBS)
+ $(OBJCOPY) --only-keep-debug $(BIN) $(BIN).debug
+ $(OBJCOPY) --add-gnu-debuglink=$(BIN).debug $(BIN)
+- $(STRIP) $(BIN)
+ endif
+
+ $(OBJDIR)%.o: src/%.cpp
+--- a/tools/minicargo/Makefile
++++ b/tools/minicargo/Makefile
+@@ -46,7 +46,6 @@ else ifeq ($(shell uname -s || echo not),Darwin)
+ else
+ $(OBJCOPY) --only-keep-debug $(BIN) $(BIN).debug
+ $(OBJCOPY) --add-gnu-debuglink=$(BIN).debug $(BIN)
+- $(STRIP) $(BIN)
+ endif
+
+ $(OBJDIR)%.o: %.cpp
+--
+2.48.0
+
diff --git a/dev-lang/mrustc/files/mrustc-0.11.2-gcc15.patch b/dev-lang/mrustc/files/mrustc-0.11.2-gcc15.patch
new file mode 100644
index 000000000000..fd2e8f307872
--- /dev/null
+++ b/dev-lang/mrustc/files/mrustc-0.11.2-gcc15.patch
@@ -0,0 +1,28 @@
+From 3df8e7e14485c7f11da4d90dac02aa061f5e1f1a Mon Sep 17 00:00:00 2001
+From: Matt Jolly <kangie@gentoo.org>
+Date: Sun, 19 Jan 2025 14:07:47 +1000
+Subject: [PATCH] gcc15 includes
+
+--- a/src/common.hpp
++++ b/src/common.hpp
+@@ -13,6 +13,7 @@
+ #include <map>
+ #include <set>
+ #include <cassert>
++#include <cstdint>
+ #include <sstream>
+ #include <memory>
+
+--- a/tools/minicargo/build.cpp
++++ b/tools/minicargo/build.cpp
+@@ -20,6 +20,7 @@
+ #include <fstream>
+ #include <cassert>
+
++#include <cstdint>
+ #include <unordered_map>
+ #include <algorithm> // sort/find_if
+
+--
+2.48.0
+
diff --git a/dev-lang/mrustc/metadata.xml b/dev-lang/mrustc/metadata.xml
new file mode 100644
index 000000000000..814630c987d4
--- /dev/null
+++ b/dev-lang/mrustc/metadata.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>Kangie@gentoo.org</email>
+ <name>Matt Jolly</name>
+ <description>Primary maintainer</description>
+ </maintainer>
+ <maintainer type="project">
+ <email>rust@gentoo.org</email>
+ <name>Gentoo Rust Project</name>
+ </maintainer>
+ <longdescription>
+ A "simple" rust compiler written in C++ that is able to bootstrap a "recent" rustc.
+ </longdescription>
+ <upstream>
+ <remote-id type="github">thepowersgang/mrustc</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/dev-lang/mrustc/mrustc-0.11.2.ebuild b/dev-lang/mrustc/mrustc-0.11.2.ebuild
new file mode 100644
index 000000000000..da872f594ddc
--- /dev/null
+++ b/dev-lang/mrustc/mrustc-0.11.2.ebuild
@@ -0,0 +1,108 @@
+# Copyright 2024-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit edo multiprocessing rust-toolchain toolchain-funcs
+
+# The makefile needs to know the version of rust to build
+RUST_VERSION=1.74.1
+# We need to pretend to be this version of Rust for mrustc build and outputs
+MRUSTC_RUST_VER=1.74.0
+
+DESCRIPTION="Mutabah's Rust Compiler"
+HOMEPAGE="https://github.com/thepowersgang/mrustc"
+
+if [[ ${PV} == *"9999"* ]]; then
+ inherit git-r3
+ EGIT_REPO_URI="https://github.com/thepowersgang/mrustc.git"
+else
+ SRC_URI="https://github.com/thepowersgang/mrustc/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
+ https://static.rust-lang.org/dist/rustc-${RUST_VERSION}-src.tar.xz
+ "
+ KEYWORDS="~amd64"
+fi
+
+LICENSE="MIT"
+SLOT="0"
+
+DEPEND="sys-libs/zlib"
+# mrustc transpiles Rust to C, and currently the C code it generates doesn't currently work with clang
+RDEPEND="
+ ${DEPEND}
+ sys-devel/gcc:*
+"
+BDEPEND="sys-devel/gcc:*"
+
+PATCHES=(
+ "${FILESDIR}/${PN}-0.11.2-gcc15.patch"
+ "${FILESDIR}/${PN}-0.11.2-dont-strip-bins.patch"
+ "${FILESDIR}/${PN}-0.11.0-default-to-rust-1_74.patch"
+ "${FILESDIR}/${PN}-0.11.0-RUSTC_SRC_PROVIDED.patch"
+ "${FILESDIR}/${PN}-0.10.1-git-be-gone.patch"
+)
+
+QA_FLAGS_IGNORED="
+ usr/lib/rust/${P}/bin/mrustc
+ usr/lib/rust/${P}/bin/minicargo
+ usr/lib/rust/${P}/lib/rustlib/$(rust_abi)/lib/*.rlib
+"
+
+pkg_setup() {
+ if [[ ${MERGE_TYPE} != binary ]] && ! tc-is-gcc; then
+ die "mrustc needs to be built using GCC."
+ fi
+}
+
+src_configure() {
+ :
+}
+
+src_compile() {
+ export PARLEVEL=$(makeopts_jobs)
+ export RUSTC_VERSION=${MRUSTC_RUST_VER} # Pretend that we're using upstream-supported Rust
+ export MRUSTC_TARGET_VER=${RUSTC_VERSION%.*}
+ export RUSTCSRC="${WORKDIR}/rustc-${RUST_VERSION}-src"
+ export RUSTC_SRC_PROVIDED=1
+ export V='' # echo build commands in makefiles (minicargo still writes commands to file)
+ # build mrustc & minicargo then use them to build the standard library
+ # emake -f minicargo.mk will do everything including a full bootstrap
+ emake all
+ emake -C tools/minicargo/
+ # It's not much, but it's enough to do a 'hello world' at least... and build dev-lang/rust!
+ emake -e -f minicargo.mk LIBS
+}
+
+src_test() {
+ # The main makefile test targets just do this, cut out the middleman
+ emake -e -f minicargo.mk local_tests
+ # build and run 'hello world' (this is called using 'test' in the makefile, but we can do it manually)
+ edo "${S}"/bin/mrustc -L "${S}"/output-${MRUSTC_RUST_VER}/ \
+ -g "${S}/../rustc-${RUST_VERSION}-src/tests/ui/hello_world/main.rs" -o "${T}"/hello
+ "${T}"/hello || die "Failed to run hello_world built with mrustc"
+}
+
+src_install() {
+ # If we're installing into /usr/lib/rust we may as well be consistent
+ into /usr/lib/rust/${P}
+ dobin bin/mrustc
+ dobin bin/minicargo
+ local lib patch
+ local libs=( "${S}"/output-*/*.rlib* )
+ insinto "/usr/lib/rust/${P}/lib/rustlib/$(rust_abi)/lib"
+ # If we ever want to support mrustc stdlib for multiple rusts we'll need to
+ # do something more clever here.
+ for lib in "${libs[@]}"; do
+ # We only want .rlib{,.hir,o}
+ if [[ ${lib} != *.c && ${lib} != *.d && ${lib} != *.txt ]]; then
+ doins "${lib}"
+ fi
+ done
+ # For convenience, install files required to build various rusts
+ insinto /usr/share/${P}
+ doins -r "${S}/script-overrides/"
+ insinto /usr/share/${P}/patches
+ for patch in "${S}"/rustc-*.patch "${S}"/rustc-*-overrides.toml; do
+ doins "${patch}"
+ done
+}
diff --git a/dev-lang/mrustc/mrustc-9999.ebuild b/dev-lang/mrustc/mrustc-9999.ebuild
new file mode 100644
index 000000000000..2d39a52cbcb6
--- /dev/null
+++ b/dev-lang/mrustc/mrustc-9999.ebuild
@@ -0,0 +1,105 @@
+# Copyright 2024-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit edo multiprocessing rust-toolchain toolchain-funcs
+
+# The makefile needs to know the version of rust to build
+RUST_VERSION=1.74.1
+# We need to pretend to be this version of Rust for mrustc build and outputs
+MRUSTC_RUST_VER=1.74.0
+
+DESCRIPTION="Mutabah's Rust Compiler"
+HOMEPAGE="https://github.com/thepowersgang/mrustc"
+
+if [[ ${PV} == *"9999"* ]]; then
+ inherit git-r3
+ EGIT_REPO_URI="https://github.com/thepowersgang/mrustc.git"
+else
+ SRC_URI="https://github.com/thepowersgang/mrustc/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
+ https://static.rust-lang.org/dist/rustc-${RUST_VERSION}-src.tar.xz
+ "
+ KEYWORDS="~amd64"
+fi
+
+LICENSE="MIT"
+SLOT="0"
+
+DEPEND="sys-libs/zlib"
+# mrustc transpiles Rust to C, and currently the C code it generates doesn't currently work with clang
+RDEPEND="
+ ${DEPEND}
+ sys-devel/gcc:*
+"
+BDEPEND="sys-devel/gcc:*"
+
+PATCHES=(
+ "${FILESDIR}/${PN}-0.11.0-default-to-rust-1_74.patch"
+ "${FILESDIR}/${PN}-0.11.0-RUSTC_SRC_PROVIDED.patch"
+)
+
+QA_FLAGS_IGNORED="
+ usr/lib/rust/${P}/bin/mrustc
+ usr/lib/rust/${P}/bin/minicargo
+ usr/lib/rust/${P}/lib/rustlib/$(rust_abi)/lib/*.rlib
+"
+
+pkg_setup() {
+ if [[ ${MERGE_TYPE} != binary ]] && ! tc-is-gcc; then
+ die "mrustc needs to be built using GCC."
+ fi
+}
+
+src_configure() {
+ :
+}
+
+src_compile() {
+ export PARLEVEL=$(makeopts_jobs)
+ export RUSTC_VERSION=${MRUSTC_RUST_VER} # Pretend that we're using upstream-supported Rust
+ export MRUSTC_TARGET_VER=${RUSTC_VERSION%.*}
+ export RUSTCSRC="${WORKDIR}/rustc-${RUST_VERSION}-src"
+ export RUSTC_SRC_PROVIDED=1
+ export V='' # echo build commands in makefiles (minicargo still writes commands to file)
+ # build mrustc & minicargo then use them to build the standard library
+ # emake -f minicargo.mk will do everything including a full bootstrap
+ emake all
+ emake -C tools/minicargo/
+ # It's not much, but it's enough to do a 'hello world' at least... and build dev-lang/rust!
+ emake -e -f minicargo.mk LIBS
+}
+
+src_test() {
+ # The main makefile test targets just do this, cut out the middleman
+ emake -e -f minicargo.mk local_tests
+ # build and run 'hello world' (this is called using 'test' in the makefile, but we can do it manually)
+ edo "${S}"/bin/mrustc -L "${S}"/output-${MRUSTC_RUST_VER}/ \
+ -g "${S}/../rustc-${RUST_VERSION}-src/tests/ui/hello_world/main.rs" -o "${T}"/hello
+ "${T}"/hello || die "Failed to run hello_world built with mrustc"
+}
+
+src_install() {
+ # If we're installing into /usr/lib/rust we may as well be consistent
+ into /usr/lib/rust/${P}
+ dobin bin/mrustc
+ dobin bin/minicargo
+ local lib patch
+ local libs=( "${S}"/output-*/*.rlib* )
+ insinto "/usr/lib/rust/${P}/lib/rustlib/$(rust_abi)/lib"
+ # If we ever want to support mrustc stdlib for multiple rusts we'll need to
+ # do something more clever here.
+ for lib in "${libs[@]}"; do
+ # We only want .rlib{,.hir,o}
+ if [[ ${lib} != *.c && ${lib} != *.d && ${lib} != *.txt ]]; then
+ doins "${lib}"
+ fi
+ done
+ # For convenience, install files required to build various rusts
+ insinto /usr/share/${P}
+ doins -r "${S}/script-overrides/"
+ insinto /usr/share/${P}/patches
+ for patch in "${S}"/rustc-*.patch "${S}"/rustc-*-overrides.toml; do
+ doins "${patch}"
+ done
+}