mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-09-24 04:59:14 -07:00
dev-lang/mrustc: add 0.11.2; live
Signed-off-by: Matt Jolly <kangie@gentoo.org>
This commit is contained in:
2
dev-lang/mrustc/Manifest
Normal file
2
dev-lang/mrustc/Manifest
Normal file
@@ -0,0 +1,2 @@
|
||||
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
|
||||
23
dev-lang/mrustc/files/mrustc-0.10.1-git-be-gone.patch
Normal file
23
dev-lang/mrustc/files/mrustc-0.10.1-git-be-gone.patch
Normal file
@@ -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
|
||||
222
dev-lang/mrustc/files/mrustc-0.11.0-RUSTC_SRC_PROVIDED.patch
Normal file
222
dev-lang/mrustc/files/mrustc-0.11.0-RUSTC_SRC_PROVIDED.patch
Normal file
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
28
dev-lang/mrustc/files/mrustc-0.11.2-dont-strip-bins.patch
Normal file
28
dev-lang/mrustc/files/mrustc-0.11.2-dont-strip-bins.patch
Normal file
@@ -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
|
||||
|
||||
28
dev-lang/mrustc/files/mrustc-0.11.2-gcc15.patch
Normal file
28
dev-lang/mrustc/files/mrustc-0.11.2-gcc15.patch
Normal file
@@ -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
|
||||
|
||||
19
dev-lang/mrustc/metadata.xml
Normal file
19
dev-lang/mrustc/metadata.xml
Normal file
@@ -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>
|
||||
108
dev-lang/mrustc/mrustc-0.11.2.ebuild
Normal file
108
dev-lang/mrustc/mrustc-0.11.2.ebuild
Normal file
@@ -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
|
||||
}
|
||||
105
dev-lang/mrustc/mrustc-9999.ebuild
Normal file
105
dev-lang/mrustc/mrustc-9999.ebuild
Normal file
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user