pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

1st release to wip of DLB's pkgsrc attempt of Mutabah's Rust Compiler. [Currently for rust 1.39, only]



Module Name:	pkgsrc-wip
Committed By:	Dave Berger <pkgsrc-mrust%web5by5.com@localhost>
Pushed By:	dave
Date:		Mon Jan 10 16:47:33 2022 -0500
Changeset:	88a4f61a399ee145bf5edf4ce140acff741f68a0

Added Files:
	mrust-cargo/DESCR
	mrust-cargo/Makefile
	mrust-cargo/PLIST
	mrust-cargo/distinfo
	mrust-cargo/patches/patch-Makefile
	mrust-cargo/patches/patch-minicargo.mk
	mrust-libs/DESCR
	mrust-libs/Makefile
	mrust-libs/PLIST
	mrust-libs/distinfo
	mrust-libs/patches/patch-.._rustc-1.39.0-src_src_libstd_sys_unix_thread.rs
	mrust-libs/patches/patch-Makefile
	mrust-libs/patches/patch-minicargo.mk
	mrust-libs/patches/patch-script-overrides_stable-1.39.0-linux_build__std.txt
	mrust-libs/patches/patch-tools_testrunner_main.cpp
	mrust-minicargo/DESCR
	mrust-minicargo/Makefile
	mrust-minicargo/PLIST
	mrust-minicargo/distinfo
	mrust-minicargo/patches/patch-tools_minicargo_build.cpp
	mrust-mrustc/DESCR
	mrust-mrustc/Makefile
	mrust-mrustc/PLIST
	mrust-mrustc/distinfo
	mrust-mrustc/patches/patch-Makefile
	mrust-mrustc/patches/patch-src_hir__conv_constant__evaluation.cpp
	mrust-rustc/DESCR
	mrust-rustc/Makefile
	mrust-rustc/PLIST
	mrust-rustc/distinfo
	mrust-rustc/patches/patch-Makefile
	mrust-rustc/patches/patch-minicargo.mk
	mrust-rustc/patches/patch-rustc-1.39.0-src.patch
	mrust-rustc/patches/patch-script-overrides_stable-1.39.0-linux_build__std.txt
	mrust/DESCR
	mrust/Makefile.common

Log Message:
1st release to wip of DLB's pkgsrc attempt of Mutabah's Rust
Compiler.  [Currently for rust 1.39, only]

Builds are not seamless yet (sometimes requiring repeated
invocations, e.g., of "make update", to get past sporadic
"guard page"--and other possibly memory related--compile-time
errors); and in addition, the packages need to be better tuned for
pkgsrc correctness by a knowledgeable pkgsrc developer.

For example, a big win for troubleshooting might be to separate
out the relatively reliable llvm build stage into its own sub-
package if that's possible; so as to avoid always doing a very
expensive rebuild of that phase when it isn't actually necessary.

Also, there's probably NetBSD bias in the patches & packages; and
it may be possible to improve this to benefit other platforms.

Moreover, these were constructed and tested under a private copy
of pkgsrc, in .../lang , so they may immediately fail and need to
be re-configured for .../wip

That said, with adequate RAM [~12G], swap [~10G], storage [~35G]
and determination, these can successfully complete all the way
through the packaging & installation (on a NetBSD 9/amd64 system)
of rustc & cargo binaries--built from rustc sources, but using the
compiled-from-C++-source mrustc toolchain only (i.e., no rustc
binaries downloaded during the bootstrap).

Invocation of the resulting exe's with --help or --version args
currently works (and the exe's SHOULD also pass ~99% of the rustc
test suite... but I haven't re-run the suite lately).

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=88a4f61a399ee145bf5edf4ce140acff741f68a0

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 mrust-cargo/DESCR                                  |  22 ++++
 mrust-cargo/Makefile                               |  85 +++++++++++++
 mrust-cargo/PLIST                                  |   2 +
 mrust-cargo/distinfo                               |  12 ++
 mrust-cargo/patches/patch-Makefile                 |  19 +++
 mrust-cargo/patches/patch-minicargo.mk             |  12 ++
 mrust-libs/DESCR                                   |  23 ++++
 mrust-libs/Makefile                                |  81 ++++++++++++
 mrust-libs/PLIST                                   |  75 +++++++++++
 mrust-libs/distinfo                                |  15 +++
 ..._rustc-1.39.0-src_src_libstd_sys_unix_thread.rs |  29 +++++
 mrust-libs/patches/patch-Makefile                  |  27 ++++
 mrust-libs/patches/patch-minicargo.mk              |  12 ++
 ...pt-overrides_stable-1.39.0-linux_build__std.txt |   9 ++
 mrust-libs/patches/patch-tools_testrunner_main.cpp |  12 ++
 mrust-minicargo/DESCR                              |  24 ++++
 mrust-minicargo/Makefile                           |  40 ++++++
 mrust-minicargo/PLIST                              |   2 +
 mrust-minicargo/distinfo                           |   7 ++
 .../patches/patch-tools_minicargo_build.cpp        |  25 ++++
 mrust-mrustc/DESCR                                 |  17 +++
 mrust-mrustc/Makefile                              | 139 +++++++++++++++++++++
 mrust-mrustc/PLIST                                 |   2 +
 mrust-mrustc/distinfo                              |   8 ++
 mrust-mrustc/patches/patch-Makefile                |  32 +++++
 .../patch-src_hir__conv_constant__evaluation.cpp   |  17 +++
 mrust-rustc/DESCR                                  |  22 ++++
 mrust-rustc/Makefile                               |  88 +++++++++++++
 mrust-rustc/PLIST                                  |   2 +
 mrust-rustc/distinfo                               |  14 +++
 mrust-rustc/patches/patch-Makefile                 |  19 +++
 mrust-rustc/patches/patch-minicargo.mk             |  12 ++
 mrust-rustc/patches/patch-rustc-1.39.0-src.patch   |  59 +++++++++
 ...pt-overrides_stable-1.39.0-linux_build__std.txt |   9 ++
 mrust/DESCR                                        |  23 ++++
 mrust/Makefile.common                              | 114 +++++++++++++++++
 36 files changed, 1110 insertions(+)

diffs:
diff --git a/mrust-cargo/DESCR b/mrust-cargo/DESCR
new file mode 100644
index 0000000000..bd933a2ee4
--- /dev/null
+++ b/mrust-cargo/DESCR
@@ -0,0 +1,22 @@
+Mutabah's Rust Compiler
+
+  _In-progress_ alternative rust compiler. Capable of building a
+  fully-working copy of rustc, but not suitable for everyday use
+  (due to terrible error messages).
+
+This project is a "simple" rust compiler written in C++ that is
+able to bootstrap a "recent" rustc, but may eventually become a
+full separate re-implementation.
+
+`mrustc`'s primary goal is bootstrapping `rustc`, and as such it
+tends to assume that the code it's compiling is valid (and any
+errors in the generated code are mrustc bugs). Code generation is
+done by emitting a high-level assembly (currently very ugly C, but
+LLVM/cretone/GIMPLE/... could work) and getting an external tool
+(i.e. `gcc`) to do the heavy-lifting of optimising and machine code
+generation.
+
+=====
+
+This is the mrust cargo package.  It's a build of the stock cargo--
+from rustc's own source code--but using the mrustc toolchain.
diff --git a/mrust-cargo/Makefile b/mrust-cargo/Makefile
new file mode 100644
index 0000000000..2b73abae99
--- /dev/null
+++ b/mrust-cargo/Makefile
@@ -0,0 +1,85 @@
+# $NetBSD: Makefile,v 1.1 2021/10/12 08:50:00 dlb Exp $
+
+.include "../../lang/mrust/Makefile.common"
+
+PKGNAME=	mrust-cargo-${SNAPSTAMP}
+COMMENT=	Cargo--built from rustc src, using mrustc toolchain
+BUILD_TARGET=	${MR_OUTDIR}cargo
+DISTFILES=	${DEFAULT_DISTFILES} ${RUSTSRC_DIST}
+MAKE_FILE=	minicargo.mk
+MAKE_ENV+=	LD_RUN_PATH=${PREFIX}/lib
+MAKE_ENV+=	LIBGIT2_SYS_USE_PKG_CONFIG=1
+MAKE_ENV+=	OPENSSL_DIR=${SSLBASE:Q}
+MAKE_ENV+=	RUSTC_TARGET=${MACHINE_ARCH}-unknown-${OPSYS:tl}
+
+##MAKE_JOBS_SAFE=	no		# DLBFLAG: this may be needed
+##UNLIMIT_RESOURCES=	stacksize	# DLBFLAG: stacksize doesn't need to
+					# be unlimited, but does seem to
+					# need to be higher than the default.
+					# The value that worked for me was
+					# 14m--but that probably could be
+					# tuned (or, simply use this UNLIMIT
+					# feature...?).
+
+USE_TOOLS+=		gmake
+USE_LANGUAGES+=		c c++14
+
+CARGOBIN=		mrust-cargo
+
+
+#* (no options yet) *#.include "options.mk"
+
+
+# "put" (link?) mrustc & minicargo binaries and libraries into
+# directories where minicargo.mk will look for them.
+# Could buildlink3 help with this?  (Probably not without changing
+# upstream Makefile[s]?)
+pre-build:
+	for dd in "${WRKSRC}/bin" "${WRKSRC}/${MR_OUTDIR}"; do		\
+		[ -e "$${dd}" ] || ${MKDIR} "$${dd}";			\
+	done
+	for ff in mrustc minicargo; do					\
+	    [ -e "${WRKSRC}/bin/$${ff}" ] ||				\
+		${LN} -s ${PREFIX}/bin/$${ff} "${WRKSRC}/bin";		\
+	done
+	( cd ${PREFIX}/lib/mrust/;					\
+	    for ff in *; do						\
+		[ -e "${WRKSRC}/${MR_OUTDIR}$$ff" ] ||			\
+		    ${LN} -s "${PREFIX}/lib/mrust/$$ff"			\
+			"${WRKSRC}/${MR_OUTDIR}";			\
+	    done; )
+	cd ${WRKSRC} && ${PKGSRC_SETENV} ${MAKE_ENV} \
+		${MAKE_PROGRAM} ${MAKE_FLAGS} ${BUILD_MAKE_FLAGS} RUSTCSRC
+
+
+pre-test:
+	( cd ${WRKSRC} &&						\
+	    ${PKGSRC_SETENV} ${TEST_ENV} 				\
+		${MAKE_PROGRAM} ${MAKE_FLAGS} ${TEST_MAKE_FLAGS}	\
+			${TEST_TARGET2} )
+
+
+####
+# The source Makefile doesn't have an "install:" target.
+# Use a simplistic workaround here.
+# [DLBFLAG:] Lacks support for MS Windows style ".EXE" suffixes.
+##
+do-install:
+	${PKGSRC_SETENV} ${INSTALL_ENV}					\
+	    ${INSTALL_PROGRAM_DIR} ${DESTDIR}${PREFIX}/bin;
+	( cd ${WRKSRC}/${MR_OUTDIR} &&					\
+	    ${LN} cargo-build/cargo ${CARGOBIN} &&			\
+		${PKGSRC_SETENV} ${INSTALL_ENV}                         \
+		    ${INSTALL_PROGRAM} ${CARGOBIN}			\
+			${DESTDIR}${PREFIX}/bin )
+
+
+BUILD_DEPENDS+=		mrust-mrustc>=${SNAPSTAMP}:../../lang/mrust-mrustc
+BUILD_DEPENDS+=		mrust-libs>=${SNAPSTAMP}:../../lang/mrust-libs
+##BUILD_DEPENDS+=	cmake>=3.18.2:../../devel/cmake
+
+
+##.include "../../devel/libatomic/buildlink3.mk"
+.include "../../security/openssl/buildlink3.mk"
+.include "../../mk/dlopen.buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/mrust-cargo/PLIST b/mrust-cargo/PLIST
new file mode 100644
index 0000000000..a70f178270
--- /dev/null
+++ b/mrust-cargo/PLIST
@@ -0,0 +1,2 @@
+@comment $NetBSD$
+bin/mrust-cargo
diff --git a/mrust-cargo/distinfo b/mrust-cargo/distinfo
new file mode 100644
index 0000000000..c31d0c7644
--- /dev/null
+++ b/mrust-cargo/distinfo
@@ -0,0 +1,12 @@
+$NetBSD$
+
+SHA1 (mrustc/0e5ffbf19d4331ec96c2231866a81429b90b2dbe-0e5ffbf19d4331ec96c2231866a81429b90b2dbe.zip) = 3c2e1bff891239cc0431b3e6928112ebb7b36793
+RMD160 (mrustc/0e5ffbf19d4331ec96c2231866a81429b90b2dbe-0e5ffbf19d4331ec96c2231866a81429b90b2dbe.zip) = c99362354c652e037622c84b8076ea3bfc4e1ec8
+SHA512 (mrustc/0e5ffbf19d4331ec96c2231866a81429b90b2dbe-0e5ffbf19d4331ec96c2231866a81429b90b2dbe.zip) = 8af5c92102f9964c8f68ff469f0d1197e9b84fcf07d9efa8805011766ce256ddef794c2d08a3a85c7cd0234c9235ca5fe0b18372a71fa984d36e2e765d379037
+Size (mrustc/0e5ffbf19d4331ec96c2231866a81429b90b2dbe-0e5ffbf19d4331ec96c2231866a81429b90b2dbe.zip) = 1354302 bytes
+SHA1 (mrustc/rustc-1.39.0-src.tar.gz) = 82ef6f3b88b8d5e3bfa2fab67bbacf5d6f6ba6bb
+RMD160 (mrustc/rustc-1.39.0-src.tar.gz) = d5b04b87fc336e3be7d592f70de0363aa66622aa
+SHA512 (mrustc/rustc-1.39.0-src.tar.gz) = 77be74410b9f7a2e9f78f7a9860964e122ab9518553acc2cc80d5abeecf3302e9b3ed1fd29e022cccff1f9ff4a568b4015c0d3ac0a524f06e38e9cb360a3341e
+Size (mrustc/rustc-1.39.0-src.tar.gz) = 152803201 bytes
+SHA1 (patch-Makefile) = 4cec2c6cc36210bf5ca77f2ae6bbfa23396769e7
+SHA1 (patch-minicargo.mk) = a13fa4b05e443871b8d25aa7f008069f5dd2f91d
diff --git a/mrust-cargo/patches/patch-Makefile b/mrust-cargo/patches/patch-Makefile
new file mode 100644
index 0000000000..68a07ca3a3
--- /dev/null
+++ b/mrust-cargo/patches/patch-Makefile
@@ -0,0 +1,19 @@
+$NetBSD$
+
+--- Makefile.orig	2021-09-12 00:15:52.000000000 +0000
++++ Makefile
+@@ -213,9 +213,12 @@ $(RUSTC_SRC_TARBALL): $(RUSTC_SRC_DES)
+ 	@echo [CURL] $@
+ 	@rm -f $@
+ 	@curl -sS https://static.rust-lang.org/dist/$@ -o $@
+-$(RUSTC_SRC_DL): $(RUSTC_SRC_TARBALL) rustc-$(RUSTC_VERSION)-src.patch
+-	tar -xf $(RUSTC_SRC_TARBALL)
++##$(RUSTC_SRC_DL): $(RUSTC_SRC_TARBALL) rustc-$(RUSTC_VERSION)-src.patch
++$(RUSTC_SRC_DL): rustc-$(RUSTC_VERSION)-src.patch
++	@###tar -xf $(RUSTC_SRC_TARBALL)
++	@mv ../$(RUSTCSRC) ./
+ 	cd $(RUSTCSRC) && patch -p0 < ../rustc-$(RUSTC_VERSION)-src.patch;
++	find $(RUSTCSRC) -name '*.[oa]' -print0 | xargs -0 rm
+ 	cat $(RUSTC_SRC_DES) > $(RUSTC_SRC_DL)
+ endif
+ 
diff --git a/mrust-cargo/patches/patch-minicargo.mk b/mrust-cargo/patches/patch-minicargo.mk
new file mode 100644
index 0000000000..51856ffe46
--- /dev/null
+++ b/mrust-cargo/patches/patch-minicargo.mk
@@ -0,0 +1,12 @@
+$NetBSD$
+
+--- minicargo.mk.orig	2021-09-12 00:15:52.000000000 +0000
++++ minicargo.mk
+@@ -56,7 +56,6 @@ RUSTC_TARGET ?= x86_64-unknown-linux-gnu
+ LLVM_TARGETS ?= X86;ARM;AArch64#;Mips;PowerPC;SystemZ;JSBackend;MSP430;Sparc;NVPTX
+ OVERRIDE_DIR := script-overrides/$(RUSTC_CHANNEL)-$(RUSTC_VERSION)$(OVERRIDE_SUFFIX)/
+ 
+-.PHONY: bin/mrustc bin/minicargo
+ .PHONY: $(OUTDIR)libstd.rlib $(OUTDIR)libtest.rlib $(OUTDIR)libpanic_unwind.rlib $(OUTDIR)libproc_macro.rlib
+ .PHONY: $(OUTDIR)rustc $(OUTDIR)cargo
+ 
diff --git a/mrust-libs/DESCR b/mrust-libs/DESCR
new file mode 100644
index 0000000000..a5d09f3ddf
--- /dev/null
+++ b/mrust-libs/DESCR
@@ -0,0 +1,23 @@
+Mutabah's Rust Compiler
+
+  _In-progress_ alternative rust compiler. Capable of building a
+  fully-working copy of rustc, but not suitable for everyday use
+  (due to terrible error messages).
+
+This project is a "simple" rust compiler written in C++ that is
+able to bootstrap a "recent" rustc, but may eventually become a
+full separate re-implementation.
+
+`mrustc`'s primary goal is bootstrapping `rustc`, and as such it
+tends to assume that the code it's compiling is valid (and any
+errors in the generated code are mrustc bugs). Code generation is
+done by emitting a high-level assembly (currently very ugly C, but
+LLVM/cretone/GIMPLE/... could work) and getting an external tool
+(i.e. `gcc`) to do the heavy-lifting of optimising and machine code
+generation.
+
+=====
+
+This is the mrust libs package.  It contains the mrust libs
+necessary to build executables using mrustc -- including real
+rustc & cargo.
diff --git a/mrust-libs/Makefile b/mrust-libs/Makefile
new file mode 100644
index 0000000000..11095cb9dc
--- /dev/null
+++ b/mrust-libs/Makefile
@@ -0,0 +1,81 @@
+# $NetBSD: Makefile,v 1.1 2021/10/12 08:50:00 dlb Exp $
+
+.include "../../lang/mrust/Makefile.common"
+
+PKGNAME=	mrust-libs-${SNAPSTAMP}
+COMMENT=	Rustc libraries & crates built using mrustc toolchain
+
+DISTFILES=		${DEFAULT_DISTFILES} ${RUSTSRC_DIST}
+BUILD_TARGET=		LIBS
+TEST_TARGET=		mrustc_tests
+##TEST_TARGET2=		rust_tests-libs
+TEST_MAKE_FLAGS=	-o bin/mrustc -o LIBS
+MAKE_FILE=		minicargo.mk
+MAKE_ENV+=		LD_RUN_PATH=${PREFIX}/lib
+MAKE_ENV+=		RUSTC_TARGET=${MACHINE_ARCH}-unknown-${OPSYS:tl}
+##BUILD_MAKE_FLAGS+=	MINICARGO_FLAGS="-L ${PREFIX}/lib/"
+
+##MAKE_JOBS_SAFE=	no		# DLBFLAG: this may be needed
+
+##UNLIMIT_RESOURCES=	stacksize	# DLBFLAG: stacksize doesn't need to
+					# be unlimited, but does seem to
+					# need to be higher than the default.
+					# The value that worked for me was
+					# 14m--but that probably could be
+					# tuned (or, simply use this UNLIMIT
+					# feature...?).
+
+USE_TOOLS+=		gmake
+USE_LANGUAGES+=		c c++14
+
+
+#* (no options yet) *#.include "options.mk"
+
+
+#
+# "put" (link?) mrustc & minicargo binaries and libraries into
+# directories where minicargo.mk will look for them.
+# Could buildlink3 help with this?  (Probably not without changing
+# upstream Makefile[s]?)
+#
+# Extract & patch rustc src into the mrustc staging area
+#
+pre-build:
+	[ -e "${WRKSRC}/bin" ] || ${MKDIR} ${WRKSRC}/bin
+	for ff in mrustc minicargo; do					\
+	    [ -e "${WRKSRC}/bin/$${ff}" ] ||				\
+		${LN} -s ${PREFIX}/bin/$${ff} "${WRKSRC}/bin";		\
+	done
+	( cd ${WRKSRC} && ${PKGSRC_SETENV} ${MAKE_ENV} ${MAKE_PROGRAM}  \
+		${MAKE_FLAGS} ${BUILD_MAKE_FLAGS} RUSTCSRC )
+
+
+do-test:
+	( cd ${WRKSRC} &&						\
+	    ${PKGSRC_SETENV} ${TEST_ENV} 				\
+		${MAKE_PROGRAM} ${MAKE_FLAGS} ${TEST_MAKE_FLAGS}	\
+			${TEST_TARGET} )
+
+
+####
+# The source Makefile doesn't have an "install:" target.
+# Use a simplistic workaround here.
+# [DLBFLAG:] Lacks support for MS Windows STYLE ".EXE" suffixes.
+##
+do-install:
+	${PKGSRC_SETENV} ${INSTALL_ENV}					\
+	    ${INSTALL_LIB_DIR} ${DESTDIR}${PREFIX}/lib/mrust
+	( cd ${WRKSRC}/${MR_OUTDIR} &&					\
+	    for ff in lib*.rlib lib*.rlib.[ho]* *build build*.txt; do	\
+	        ${PKGSRC_SETENV} ${INSTALL_ENV}                         \
+		    ${INSTALL_LIB} $$ff					\
+			${DESTDIR}${PREFIX}/lib/mrust;			\
+	    done )
+
+
+BUILD_DEPENDS+=	mrust-mrustc>=${SNAPSTAMP}:../../lang/mrust-mrustc
+BUILD_DEPENDS+=	mrust-minicargo>=${SNAPSTAMP}:../../lang/mrust-minicargo
+
+.include "../../devel/libatomic/buildlink3.mk"
+.include "../../mk/dlopen.buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/mrust-libs/PLIST b/mrust-libs/PLIST
new file mode 100644
index 0000000000..41be7ebd17
--- /dev/null
+++ b/mrust-libs/PLIST
@@ -0,0 +1,75 @@
+@comment $NetBSD$
+lib/mrust/build_compiler_builtins.txt
+lib/mrust/build_libc.txt
+lib/mrust/build_std.txt
+lib/mrust/build_unwind.txt
+lib/mrust/compiler_builtins_build
+lib/mrust/liballoc.rlib
+lib/mrust/liballoc.rlib.hir
+lib/mrust/liballoc.rlib.o
+lib/mrust/libbacktrace-0_3_37_H4004.rlib
+lib/mrust/libbacktrace-0_3_37_H4004.rlib.hir
+lib/mrust/libbacktrace-0_3_37_H4004.rlib.o
+lib/mrust/libc_build
+lib/mrust/libcc-1_0_35.rlib
+lib/mrust/libcc-1_0_35.rlib.hir
+lib/mrust/libcc-1_0_35.rlib.o
+lib/mrust/libcfg_if-0_1_8.rlib
+lib/mrust/libcfg_if-0_1_8.rlib.hir
+lib/mrust/libcfg_if-0_1_8.rlib.o
+lib/mrust/libcfg_if-0_1_8_H3.rlib
+lib/mrust/libcfg_if-0_1_8_H3.rlib.hir
+lib/mrust/libcfg_if-0_1_8_H3.rlib.o
+lib/mrust/libcompiler_builtins-0_1_18_H22.rlib
+lib/mrust/libcompiler_builtins-0_1_18_H22.rlib.hir
+lib/mrust/libcompiler_builtins-0_1_18_H22.rlib.o
+lib/mrust/libcore.rlib
+lib/mrust/libcore.rlib.hir
+lib/mrust/libcore.rlib.o
+lib/mrust/libgetopts-0_2_21_H1.rlib
+lib/mrust/libgetopts-0_2_21_H1.rlib.hir
+lib/mrust/libgetopts-0_2_21_H1.rlib.o
+lib/mrust/libhashbrown-0_5_0_Hb.rlib
+lib/mrust/libhashbrown-0_5_0_Hb.rlib.hir
+lib/mrust/libhashbrown-0_5_0_Hb.rlib.o
+lib/mrust/liblibc-0_2_62_Hd.rlib
+lib/mrust/liblibc-0_2_62_Hd.rlib.hir
+lib/mrust/liblibc-0_2_62_Hd.rlib.o
+lib/mrust/libpanic_abort.rlib
+lib/mrust/libpanic_abort.rlib.hir
+lib/mrust/libpanic_abort.rlib.o
+lib/mrust/libpanic_unwind.rlib
+lib/mrust/libpanic_unwind.rlib.hir
+lib/mrust/libpanic_unwind.rlib.o
+lib/mrust/libproc_macro.rlib
+lib/mrust/libproc_macro.rlib.hir
+lib/mrust/libproc_macro.rlib.o
+lib/mrust/librustc_demangle-0_1_16_H3.rlib
+lib/mrust/librustc_demangle-0_1_16_H3.rlib.hir
+lib/mrust/librustc_demangle-0_1_16_H3.rlib.o
+lib/mrust/librustc_std_workspace_alloc-1_99_0.rlib
+lib/mrust/librustc_std_workspace_alloc-1_99_0.rlib.hir
+lib/mrust/librustc_std_workspace_alloc-1_99_0.rlib.o
+lib/mrust/librustc_std_workspace_core-1_99_0.rlib
+lib/mrust/librustc_std_workspace_core-1_99_0.rlib.hir
+lib/mrust/librustc_std_workspace_core-1_99_0.rlib.o
+lib/mrust/librustc_std_workspace_std-1_99_0.rlib
+lib/mrust/librustc_std_workspace_std-1_99_0.rlib.hir
+lib/mrust/librustc_std_workspace_std-1_99_0.rlib.o
+lib/mrust/libstd.rlib
+lib/mrust/libstd.rlib.hir
+lib/mrust/libstd.rlib.o
+lib/mrust/libterm.rlib
+lib/mrust/libterm.rlib.hir
+lib/mrust/libterm.rlib.o
+lib/mrust/libtest.rlib
+lib/mrust/libtest.rlib.hir
+lib/mrust/libtest.rlib.o
+lib/mrust/libunicode_width-0_1_6_Ha.rlib
+lib/mrust/libunicode_width-0_1_6_Ha.rlib.hir
+lib/mrust/libunicode_width-0_1_6_Ha.rlib.o
+lib/mrust/libunwind.rlib
+lib/mrust/libunwind.rlib.hir
+lib/mrust/libunwind.rlib.o
+lib/mrust/std_build
+lib/mrust/unwind_build
diff --git a/mrust-libs/distinfo b/mrust-libs/distinfo
new file mode 100644
index 0000000000..b45a5e3ede
--- /dev/null
+++ b/mrust-libs/distinfo
@@ -0,0 +1,15 @@
+$NetBSD$
+
+SHA1 (mrustc/0e5ffbf19d4331ec96c2231866a81429b90b2dbe-0e5ffbf19d4331ec96c2231866a81429b90b2dbe.zip) = 3c2e1bff891239cc0431b3e6928112ebb7b36793
+RMD160 (mrustc/0e5ffbf19d4331ec96c2231866a81429b90b2dbe-0e5ffbf19d4331ec96c2231866a81429b90b2dbe.zip) = c99362354c652e037622c84b8076ea3bfc4e1ec8
+SHA512 (mrustc/0e5ffbf19d4331ec96c2231866a81429b90b2dbe-0e5ffbf19d4331ec96c2231866a81429b90b2dbe.zip) = 8af5c92102f9964c8f68ff469f0d1197e9b84fcf07d9efa8805011766ce256ddef794c2d08a3a85c7cd0234c9235ca5fe0b18372a71fa984d36e2e765d379037
+Size (mrustc/0e5ffbf19d4331ec96c2231866a81429b90b2dbe-0e5ffbf19d4331ec96c2231866a81429b90b2dbe.zip) = 1354302 bytes
+SHA1 (mrustc/rustc-1.39.0-src.tar.gz) = 82ef6f3b88b8d5e3bfa2fab67bbacf5d6f6ba6bb
+RMD160 (mrustc/rustc-1.39.0-src.tar.gz) = d5b04b87fc336e3be7d592f70de0363aa66622aa
+SHA512 (mrustc/rustc-1.39.0-src.tar.gz) = 77be74410b9f7a2e9f78f7a9860964e122ab9518553acc2cc80d5abeecf3302e9b3ed1fd29e022cccff1f9ff4a568b4015c0d3ac0a524f06e38e9cb360a3341e
+Size (mrustc/rustc-1.39.0-src.tar.gz) = 152803201 bytes
+SHA1 (patch-.._rustc-1.39.0-src_src_libstd_sys_unix_thread.rs) = 37e12f1cc16a21d940b4cbe5ccfa0baec69d366e
+SHA1 (patch-Makefile) = 3326e1e1f9dbe83f7b3147ee073c3c821d4ce939
+SHA1 (patch-minicargo.mk) = a13fa4b05e443871b8d25aa7f008069f5dd2f91d
+SHA1 (patch-script-overrides_stable-1.39.0-linux_build__std.txt) = 728fce6fbbd81db342bdc1eb0f6ac57abf45f8b7
+SHA1 (patch-tools_testrunner_main.cpp) = 9444715ce7b1e496178c4c82375a8181f652d089
diff --git a/mrust-libs/patches/patch-.._rustc-1.39.0-src_src_libstd_sys_unix_thread.rs b/mrust-libs/patches/patch-.._rustc-1.39.0-src_src_libstd_sys_unix_thread.rs
new file mode 100644
index 0000000000..0ee7061987
--- /dev/null
+++ b/mrust-libs/patches/patch-.._rustc-1.39.0-src_src_libstd_sys_unix_thread.rs
@@ -0,0 +1,29 @@
+$NetBSD$
+
+--- ../rustc-1.39.0-src/src/libstd/sys/unix/thread.rs.orig	2019-11-04 15:45:21.000000000 +0000
++++ ../rustc-1.39.0-src/src/libstd/sys/unix/thread.rs
+@@ -330,14 +330,19 @@ pub mod guard {
+             // than the initial mmap() used, so we mmap() here with
+             // read/write permissions and only then mprotect() it to
+             // no permissions at all. See issue #50313.
+-            let result = mmap(stackaddr, PAGE_SIZE, PROT_READ | PROT_WRITE,
+-                              MAP_PRIVATE | MAP_ANON | MAP_FIXED, -1, 0);
+-            if result != stackaddr || result == MAP_FAILED {
+-                panic!("failed to allocate a guard page");
+-            }
++//          let result = mmap(stackaddr, PAGE_SIZE, PROT_READ | PROT_WRITE,
++//                            MAP_PRIVATE | MAP_ANON | MAP_FIXED, -1, 0);
++//          if result != stackaddr || result == MAP_FAILED {
++//              println!( "stackaddr = {}", stackaddr as u64 );
++//              println!( "mmap() -> result {}", result as u64 );
++//              println!( "mmap() -> ERRNO {}", os::errno() as u64 );
++//              panic!("failed to allocate a guard page");
++//          }
+ 
+             let result = mprotect(stackaddr, PAGE_SIZE, PROT_NONE);
+             if result != 0 {
++                println!( "stackaddr = {}", stackaddr as u64 );
++                println!( "mprotect() -> ERRNO {}", os::errno() as u64 );
+                 panic!("failed to protect the guard page");
+             }
+ 
diff --git a/mrust-libs/patches/patch-Makefile b/mrust-libs/patches/patch-Makefile
new file mode 100644
index 0000000000..5ec8d1e8a0
--- /dev/null
+++ b/mrust-libs/patches/patch-Makefile
@@ -0,0 +1,27 @@
+$NetBSD$
+
+--- Makefile.orig	2021-09-12 00:15:52.000000000 +0000
++++ Makefile
+@@ -213,15 +213,19 @@ $(RUSTC_SRC_TARBALL): $(RUSTC_SRC_DES)
+ 	@echo [CURL] $@
+ 	@rm -f $@
+ 	@curl -sS https://static.rust-lang.org/dist/$@ -o $@
+-$(RUSTC_SRC_DL): $(RUSTC_SRC_TARBALL) rustc-$(RUSTC_VERSION)-src.patch
+-	tar -xf $(RUSTC_SRC_TARBALL)
++##$(RUSTC_SRC_DL): $(RUSTC_SRC_TARBALL) rustc-$(RUSTC_VERSION)-src.patch
++$(RUSTC_SRC_DL): rustc-$(RUSTC_VERSION)-src.patch
++	@###tar -xf $(RUSTC_SRC_TARBALL)
++	@mv ../$(RUSTCSRC) ./
+ 	cd $(RUSTCSRC) && patch -p0 < ../rustc-$(RUSTC_VERSION)-src.patch;
++	find $(RUSTCSRC) -name '*.[oa]' -print0 | xargs -0 rm
+ 	cat $(RUSTC_SRC_DES) > $(RUSTC_SRC_DL)
+ endif
+ 
+ 
+ # MRUSTC-specific tests
+-.PHONY: local_tests
++.PHONY: local_tests mrustc_tests
++mrustc_tests: test local_tests
+ local_tests: $(TEST_DEPS)
+ 	@$(MAKE) -C tools/testrunner
+ 	@mkdir -p output$(OUTDIR_SUF)/local_tests
diff --git a/mrust-libs/patches/patch-minicargo.mk b/mrust-libs/patches/patch-minicargo.mk
new file mode 100644
index 0000000000..51856ffe46
--- /dev/null
+++ b/mrust-libs/patches/patch-minicargo.mk
@@ -0,0 +1,12 @@
+$NetBSD$
+
+--- minicargo.mk.orig	2021-09-12 00:15:52.000000000 +0000
++++ minicargo.mk
+@@ -56,7 +56,6 @@ RUSTC_TARGET ?= x86_64-unknown-linux-gnu
+ LLVM_TARGETS ?= X86;ARM;AArch64#;Mips;PowerPC;SystemZ;JSBackend;MSP430;Sparc;NVPTX
+ OVERRIDE_DIR := script-overrides/$(RUSTC_CHANNEL)-$(RUSTC_VERSION)$(OVERRIDE_SUFFIX)/
+ 
+-.PHONY: bin/mrustc bin/minicargo
+ .PHONY: $(OUTDIR)libstd.rlib $(OUTDIR)libtest.rlib $(OUTDIR)libpanic_unwind.rlib $(OUTDIR)libproc_macro.rlib
+ .PHONY: $(OUTDIR)rustc $(OUTDIR)cargo
+ 
diff --git a/mrust-libs/patches/patch-script-overrides_stable-1.39.0-linux_build__std.txt b/mrust-libs/patches/patch-script-overrides_stable-1.39.0-linux_build__std.txt
new file mode 100644
index 0000000000..cf44e8fa2e
--- /dev/null
+++ b/mrust-libs/patches/patch-script-overrides_stable-1.39.0-linux_build__std.txt
@@ -0,0 +1,9 @@
+$NetBSD$
+
+--- script-overrides/stable-1.39.0-linux/build_std.txt.orig	2021-09-12 00:15:52.000000000 +0000
++++ script-overrides/stable-1.39.0-linux/build_std.txt
+@@ -1,4 +1,3 @@
+-cargo:rustc-link-lib=dl
+ cargo:rustc-link-lib=rt
+ cargo:rustc-link-lib=pthread
+ 
diff --git a/mrust-libs/patches/patch-tools_testrunner_main.cpp b/mrust-libs/patches/patch-tools_testrunner_main.cpp
new file mode 100644
index 0000000000..610b37efac
--- /dev/null
+++ b/mrust-libs/patches/patch-tools_testrunner_main.cpp
@@ -0,0 +1,12 @@
+$NetBSD$
+
+--- tools/testrunner/main.cpp.orig	2021-09-12 00:15:52.000000000 +0000
++++ tools/testrunner/main.cpp
+@@ -14,6 +14,7 @@
+ #include <vector>
+ #include <fstream>
+ #include <cctype>   // std::isblank
++#include <csignal>
+ #include "../common/debug.h"
+ #include "../common/path.h"
+ #ifdef _WIN32
diff --git a/mrust-minicargo/DESCR b/mrust-minicargo/DESCR
new file mode 100644
index 0000000000..3328f099f6
--- /dev/null
+++ b/mrust-minicargo/DESCR
@@ -0,0 +1,24 @@
+Mutabah's Rust Compiler
+
+  _In-progress_ alternative rust compiler. Capable of building a
+  fully-working copy of rustc, but not suitable for everyday use
+  (due to terrible error messages).
+
+This project is a "simple" rust compiler written in C++ that is
+able to bootstrap a "recent" rustc, but may eventually become a
+full separate re-implementation.
+
+`mrustc`'s primary goal is bootstrapping `rustc`, and as such it
+tends to assume that the code it's compiling is valid (and any
+errors in the generated code are mrustc bugs). Code generation is
+done by emitting a high-level assembly (currently very ugly C, but
+LLVM/cretone/GIMPLE/... could work) and getting an external tool
+(i.e. `gcc`) to do the heavy-lifting of optimising and machine code
+generation.
+
+=====
+
+This is the minicargo utility.  It's designed to have a sufficient
+subset of the functionality of--and level of compatibility with--
+rust's own cargo that it can be used in its place for building
+rustc & cargo from their own source code.
diff --git a/mrust-minicargo/Makefile b/mrust-minicargo/Makefile
new file mode 100644
index 0000000000..eb44e2bef0
--- /dev/null
+++ b/mrust-minicargo/Makefile
@@ -0,0 +1,40 @@
+# $NetBSD: Makefile,v 1.1 2021/10/12 08:50:00 dlb Exp $
+
+.include "../../lang/mrust/Makefile.common"
+
+PKGNAME=	mrust-minicargo-${SNAPSTAMP}
+COMMENT=	Cargo workalike from the mrustc tool suite
+
+BUILD_DIRS=	tools/minicargo
+
+##MAKE_JOBS_SAFE=	no		# DLBFLAG: this may be needed
+
+##UNLIMIT_RESOURCES=	stacksize	# DLBFLAG: stacksize doesn't need to
+					# be unlimited, but does seem to
+					# need to be higher than the default.
+					# The value that worked for me was
+					# 14m--but that probably could be
+					# tuned (or, simply use this UNLIMIT
+					# feature...?).
+
+USE_TOOLS+=		gmake
+USE_LANGUAGES+=		c++14
+
+
+#* (no options yet) *#.include "options.mk"
+
+
+####
+# The source Makefile doesn't have an "install:" target.
+# Use a simplistic workaround here.
+# [DLBFLAG:] Lacks support for MS Windoes style ".exe" suffixes.
+##
+do-install:
+	cd ${WRKSRC} && {                                               \
+	    ${PKGSRC_SETENV} ${INSTALL_ENV}                             \
+		${INSTALL_PROGRAM_DIR} ${DESTDIR}${PREFIX}/bin;         \
+	    ${PKGSRC_SETENV} ${INSTALL_ENV}                             \
+		${INSTALL} bin/minicargo ${DESTDIR}${PREFIX}/bin; }
+
+
+.include "../../mk/bsd.pkg.mk"
diff --git a/mrust-minicargo/PLIST b/mrust-minicargo/PLIST
new file mode 100644
index 0000000000..0aa6ec8641
--- /dev/null
+++ b/mrust-minicargo/PLIST
@@ -0,0 +1,2 @@
+@comment $NetBSD$
+bin/minicargo
diff --git a/mrust-minicargo/distinfo b/mrust-minicargo/distinfo
new file mode 100644
index 0000000000..b0ddca5a85
--- /dev/null
+++ b/mrust-minicargo/distinfo
@@ -0,0 +1,7 @@
+$NetBSD$
+
+SHA1 (mrustc/0e5ffbf19d4331ec96c2231866a81429b90b2dbe-0e5ffbf19d4331ec96c2231866a81429b90b2dbe.zip) = 3c2e1bff891239cc0431b3e6928112ebb7b36793
+RMD160 (mrustc/0e5ffbf19d4331ec96c2231866a81429b90b2dbe-0e5ffbf19d4331ec96c2231866a81429b90b2dbe.zip) = c99362354c652e037622c84b8076ea3bfc4e1ec8
+SHA512 (mrustc/0e5ffbf19d4331ec96c2231866a81429b90b2dbe-0e5ffbf19d4331ec96c2231866a81429b90b2dbe.zip) = 8af5c92102f9964c8f68ff469f0d1197e9b84fcf07d9efa8805011766ce256ddef794c2d08a3a85c7cd0234c9235ca5fe0b18372a71fa984d36e2e765d379037
+Size (mrustc/0e5ffbf19d4331ec96c2231866a81429b90b2dbe-0e5ffbf19d4331ec96c2231866a81429b90b2dbe.zip) = 1354302 bytes
+SHA1 (patch-tools_minicargo_build.cpp) = 3b28768fbdab9310aa3c4805ee6f02a7bbe216a4
diff --git a/mrust-minicargo/patches/patch-tools_minicargo_build.cpp b/mrust-minicargo/patches/patch-tools_minicargo_build.cpp
new file mode 100644
index 0000000000..76f2bbe018
--- /dev/null
+++ b/mrust-minicargo/patches/patch-tools_minicargo_build.cpp
@@ -0,0 +1,25 @@
+$NetBSD$
+
+--- tools/minicargo/build.cpp.orig	2021-09-12 00:15:52.000000000 +0000
++++ tools/minicargo/build.cpp
+@@ -48,7 +48,7 @@ extern int _putenv_s(const char*, const 
+ #ifdef __APPLE__
+ # include <mach-o/dyld.h>
+ #endif
+-#if defined(__FreeBSD__) || defined(__DragonFly__) || (defined(__NetBSD__) && defined(KERN_PROC_PATHNAME)) // NetBSD 8.0+
++#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__)
+ # include <sys/sysctl.h>
+ #endif
+ 
+@@ -1266,7 +1266,11 @@ const helpers::path& get_mrustc_path()
+         else
+             // TODO: Buffer too small
+ # elif defined(__FreeBSD__) || defined(__DragonFly__) || (defined(__NetBSD__) && defined(KERN_PROC_PATHNAME)) // NetBSD 8.0+
++#  if defined(__NetBSD__)
++        int mib[4] = { CTL_KERN, KERN_PROC_ARGS, -1, KERN_PROC_PATHNAME };
++#  else
+         int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 };
++#  endif
+         size_t s = sizeof(buf);
+         if ( sysctl(mib, 4, buf, &s, NULL, 0) == 0 )
+         {
diff --git a/mrust-mrustc/DESCR b/mrust-mrustc/DESCR
new file mode 100644
index 0000000000..3aab19d5e6
--- /dev/null
+++ b/mrust-mrustc/DESCR
@@ -0,0 +1,17 @@
+Mutabah's Rust Compiler
+
+  _In-progress_ alternative rust compiler. Capable of building a
+  fully-working copy of rustc, but not suitable for everyday use
+  (due to terrible error messages).
+
+This project is a "simple" rust compiler written in C++ that is
+able to bootstrap a "recent" rustc, but may eventually become a
+full separate re-implementation.
+
+`mrustc`'s primary goal is bootstrapping `rustc`, and as such it
+tends to assume that the code it's compiling is valid (and any
+errors in the generated code are mrustc bugs). Code generation is
+done by emitting a high-level assembly (currently very ugly C, but
+LLVM/cretone/GIMPLE/... could work) and getting an external tool
+(i.e. `gcc`) to do the heavy-lifting of optimising and machine code
+generation.
diff --git a/mrust-mrustc/Makefile b/mrust-mrustc/Makefile
new file mode 100644
index 0000000000..be12a59198
--- /dev/null
+++ b/mrust-mrustc/Makefile
@@ -0,0 +1,139 @@
+# $NetBSD: Makefile,v 1.1 2021/10/12 08:50:00 dlb Exp $
+
+.include "../../lang/mrust/Makefile.common"
+
+PKGNAME=	mrust-mrustc-${SNAPSTAMP}
+COMMENT=	Mutabah's Rust Compiler--the compiler itself
+
+#CONFIGURE_ENV+=	disable_x11=yes
+
+##TEST_PROGRAM=		local_tests
+##MAKE_JOBS_SAFE=	no		# DLBFLAG: this may be needed
+##UNLIMIT_RESOURCES=	stacksize	# DLBFLAG: stacksize doesn't need to
+					# be unlimited, but does seem to
+					# need to be higher than the default.
+					# The value that worked for me was
+					# 14m--but that probably could be
+					# tuned (or, simply use this UNLIMIT
+					# feature...?).
+
+
+##USE_TOOLS+=		bash gmake
+USE_TOOLS+=		gmake
+USE_LANGUAGES+=		c++14
+
+#USE_GCC_RUNTIME=	yes		# DLBFLAG: will this be needed?
+
+BUILD_MAKE_FLAGS=	GIT_L_HASH=${GITHUB_TAG}
+BUILD_MAKE_FLAGS+=	GIT_S_HASH=${GITHUB_TAG:C/^(.......).*$/\1/W}
+
+
+#* (no options yet) *#.include "options.mk"
+
+
+do-install:
+	cd ${WRKSRC} && {                                               \
+	    ${PKGSRC_SETENV} ${INSTALL_ENV}                             \
+		${INSTALL_PROGRAM_DIR} ${DESTDIR}${PREFIX}/bin;         \
+	    ${PKGSRC_SETENV} ${INSTALL_ENV}                             \
+		${INSTALL} bin/mrustc ${DESTDIR}${PREFIX}/bin; }
+
+
+##### ###
+##### ### PLIST components
+##### ###
+#####
+##### # Stub libraries for functions missing from base system.
+##### .if !empty(MACHINE_PLATFORM:MDarwin-*-powerpc) || \
+#####     !empty(MACHINE_PLATFORM:MDarwin-9.*-i386) || \
+#####     !empty(MACHINE_PLATFORM:MDarwin-1[0-9].*) || \
+#####     ${OPSYS} == "DragonFly" || ${OPSYS} == "NetBSD" || \
+#####     ${OPSYS} == "FreeBSD" || ${OPSYS} == "SunOS" || \
+#####     ${OPSYS} == "Linux"
+##### PLIST.ocaml-stub=	yes
+##### .endif
+#####
+##### # Optional components built only on certain platforms.
+##### .if (${MACHINE_ARCH} == "i386") || (${MACHINE_ARCH} == "powerpc") || \
+#####     !empty(MACHINE_ARCH:M*arm*) || (${MACHINE_ARCH} == "aarch64") || \
+#####     (${MACHINE_ARCH} == "x86_64")
+##### BUILD_TARGET+=		opt opt.opt
+##### TEST_PROGRAM+=		ocamltest.opt
+##### PLIST.ocaml-opt=	yes
+##### .  if empty(MACHINE_PLATFORM:MDarwin-*-powerpc) && \
+#####       empty(MACHINE_PLATFORM:MSunOS-*-i386) && \
+#####       (${MACHINE_ARCH} != "aarch64")
+##### PLIST.ocaml-prof=	yes
+##### .  endif
+##### .endif
+#####
+##### # XXX This conditional is not complete.  It should match the
+##### # conditional in ocaml-x.y.z/configure.
+##### .if (${MACHINE_ARCH} == "i386") || (${MACHINE_ARCH} == "x86_64") || \
+#####     (${MACHINE_ARCH} == "aarch64") || (${MACHINE_ARCH} == "powerpc") || \
+#####     !empty(MACHINE_ARCH:Mearm*)
+##### .  if !empty(MACHINE_PLATFORM:MLinux-*-*) || \
+#####       !empty(MACHINE_PLATFORM:MFreeBSD-*-*) || \
+#####       !empty(MACHINE_PLATFORM:MDragonFly-*-*) || \
+#####       !empty(MACHINE_PLATFORM:MNetBSD-*-*) || \
+#####       !empty(MACHINE_PLATFORM:MDarwin-*-*) || \
+#####       !empty(MACHINE_PLATFORM:MSunOS-*-*)
+##### PLIST.ocaml-nat=	yes
+##### .  endif
+##### .endif
+#####
+##### # Spacetime profiling is only available for native code on 64-bit targets.
+##### .if (${MACHINE_ARCH} == "x86_64") || (${MACHINE_ARCH} == "aarch64")
+##### PLIST.ocaml-spacetime=	yes
+##### .endif
+#####
+##### # clock_gettime(2), required by POSIX, is necessary for the
+##### # instrumented_runtime feature.
+##### # It is missing on macOS before 10.12.
+##### .if ${OPSYS} != "Darwin" || ${OS_VERSION:R:R} >= 16
+##### PLIST.instrumented_runtime=	yes
+##### .endif
+#####
+##### # This is needed because ${WRKSRC}/build/partial-install.sh uses
+##### # $PWD as part of its script.  However, with /bin/sh on SunOS
+##### # (cd work/foo-1.0 && echo $PWD) will show that the value of PWD is
+##### # set before the cd takes place and is then passed down.  So the end
+##### # result is when ./build/partial-install.sh is called, PWD is set
+##### # to /usr/pkgsrc/devel/ocaml instead of ${WRKSRC}.  /bin/ksh, which
+##### # is what ${SH} is on SunOS, doesn't exhibit this behaviour.
+##### .if ${OPSYS} == "SunOS"
+##### INSTALL_MAKE_FLAGS+=	SHELL=${SH:Q}
+##### .endif
+
+#INSTALLATION_DIRS=	${PKGMANDIR}/man1
+
+##### OPSYSVARS+=		EXTRA_RT_LIBS
+##### EXTRA_RT_LIBS.NetBSD=	-lcurses
+##### EXTRA_RT_LIBS.*=
+
+##### PRINT_PLIST_AWK+=	{ gsub(/lib\/ocaml\/${PKGMANDIR:S|/|\\/|}/, "lib/ocaml/$${PKGMANDIR}"); }
+
+#####do-test:
+#####	cd ${WRKSRC} && ${MAKE_PROGRAM} ${TEST_PROGRAM}
+#####	cd ${WRKSRC}/testsuite && ${MAKE_PROGRAM} all
+
+##### .if ${OPSYS} == "Darwin"
+##### .PHONY: fix-darwin-install-name
+##### post-install: fix-darwin-install-name
+##### fix-darwin-install-name:
+##### 	for f in ${DESTDIR}${PREFIX}/lib/ocaml/*.so \
+##### 		${DESTDIR}${PREFIX}/lib/ocaml/stublibs/*.so; do \
+##### 		install_name_tool -id `${ECHO} $$f | ${SED} -e 's,${DESTDIR},,g'` $$f; \
+##### 	done
+##### .endif
+
+#post-install:
+#	set -e ; cd ${DESTDIR}${PREFIX}/lib/ocaml/${PKGMANDIR}/man1;	\
+#	for m in *; do							\
+#	  ln -sf ${PREFIX}/lib/ocaml/${PKGMANDIR}/man1/$$m		\
+#		${DESTDIR}${PREFIX}/${PKGMANDIR}/man1/$$m;		\
+#	done
+
+##.include "../../mk/dlopen.buildlink3.mk"
+##### .include "../../mk/termcap.buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/mrust-mrustc/PLIST b/mrust-mrustc/PLIST
new file mode 100644
index 0000000000..706fa420d6
--- /dev/null
+++ b/mrust-mrustc/PLIST
@@ -0,0 +1,2 @@
+@comment $NetBSD$
+bin/mrustc
diff --git a/mrust-mrustc/distinfo b/mrust-mrustc/distinfo
new file mode 100644
index 0000000000..101810f755
--- /dev/null
+++ b/mrust-mrustc/distinfo
@@ -0,0 +1,8 @@
+$NetBSD$
+
+SHA1 (mrustc/0e5ffbf19d4331ec96c2231866a81429b90b2dbe-0e5ffbf19d4331ec96c2231866a81429b90b2dbe.zip) = 3c2e1bff891239cc0431b3e6928112ebb7b36793
+RMD160 (mrustc/0e5ffbf19d4331ec96c2231866a81429b90b2dbe-0e5ffbf19d4331ec96c2231866a81429b90b2dbe.zip) = c99362354c652e037622c84b8076ea3bfc4e1ec8
+SHA512 (mrustc/0e5ffbf19d4331ec96c2231866a81429b90b2dbe-0e5ffbf19d4331ec96c2231866a81429b90b2dbe.zip) = 8af5c92102f9964c8f68ff469f0d1197e9b84fcf07d9efa8805011766ce256ddef794c2d08a3a85c7cd0234c9235ca5fe0b18372a71fa984d36e2e765d379037
+Size (mrustc/0e5ffbf19d4331ec96c2231866a81429b90b2dbe-0e5ffbf19d4331ec96c2231866a81429b90b2dbe.zip) = 1354302 bytes
+SHA1 (patch-Makefile) = 5b2fa73e1fec373cbce1c6669c1b69e6a8f810b7
+SHA1 (patch-src_hir__conv_constant__evaluation.cpp) = 9fc26a65b34d3d9b88b838bd7b0a65b85aae0d1a
diff --git a/mrust-mrustc/patches/patch-Makefile b/mrust-mrustc/patches/patch-Makefile
new file mode 100644
index 0000000000..9408486cda
--- /dev/null
+++ b/mrust-mrustc/patches/patch-Makefile
@@ -0,0 +1,32 @@
+$NetBSD$
+
+--- Makefile.orig	2021-09-12 00:15:52.000000000 +0000
++++ Makefile
+@@ -45,10 +45,8 @@ CXXFLAGS += $(CXXFLAGS_EXTRA)
+ CPPFLAGS := -I src/include/ -I src/
+ CPPFLAGS += -I tools/common/
+ 
+-CXXFLAGS += -Wno-pessimizing-move
+ CXXFLAGS += -Wno-misleading-indentation
+ #CXXFLAGS += -Wno-unused-private-field
+-CXXFLAGS += -Wno-unknown-warning-option
+ 
+ CXXFLAGS += -Werror=return-type
+ 
+@@ -216,6 +214,7 @@ $(RUSTC_SRC_TARBALL): $(RUSTC_SRC_DES)
+ $(RUSTC_SRC_DL): $(RUSTC_SRC_TARBALL) rustc-$(RUSTC_VERSION)-src.patch
+ 	tar -xf $(RUSTC_SRC_TARBALL)
+ 	cd $(RUSTCSRC) && patch -p0 < ../rustc-$(RUSTC_VERSION)-src.patch;
++	find $(RUSTCSRC) -name '*.[oa]' -print0 | xargs -0 rm
+ 	cat $(RUSTC_SRC_DES) > $(RUSTC_SRC_DL)
+ endif
+ 
+@@ -310,7 +309,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)\" -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)\" -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=\"$(GIT_L_HASH)\" -D VERSION_GIT_BRANCH="\"(branch n/a)"\" -D VERSION_GIT_SHORTHASH=\"$(GIT_S_HASH)\" -D VERSION_BUILDTIME="\"$(shell date -u +"%a, %d %b %Y %X %z")\"" -D VERSION_GIT_ISDIRTY="\"(not available)"\"
+ 
+ src/main.cpp: $(PCHS:%=src/%.gch)
+ 
diff --git a/mrust-mrustc/patches/patch-src_hir__conv_constant__evaluation.cpp b/mrust-mrustc/patches/patch-src_hir__conv_constant__evaluation.cpp
new file mode 100644
index 0000000000..139e1755ee
--- /dev/null
+++ b/mrust-mrustc/patches/patch-src_hir__conv_constant__evaluation.cpp
@@ -0,0 +1,17 @@
+$NetBSD$
+
+--- src/hir_conv/constant_evaluation.cpp.orig	2021-09-12 00:15:52.000000000 +0000
++++ src/hir_conv/constant_evaluation.cpp
+@@ -21,6 +21,12 @@
+ #include <trans/monomorphise.hpp>   // For handling monomorph of MIR in provided associated constants
+ #include <trans/codegen.hpp>    // For encoding as part of transmute
+ 
++#if defined(__NetBSD__)
++#    undef bswap16
++#    undef bswap32
++#    undef bswap64
++#endif
++
+ namespace {
+     struct Defer {};
+ 
diff --git a/mrust-rustc/DESCR b/mrust-rustc/DESCR
new file mode 100644
index 0000000000..468ef37261
--- /dev/null
+++ b/mrust-rustc/DESCR
@@ -0,0 +1,22 @@
+Mutabah's Rust Compiler
+
+  _In-progress_ alternative rust compiler. Capable of building a
+  fully-working copy of rustc, but not suitable for everyday use
+  (due to terrible error messages).
+
+This project is a "simple" rust compiler written in C++ that is
+able to bootstrap a "recent" rustc, but may eventually become a
+full separate re-implementation.
+
+`mrustc`'s primary goal is bootstrapping `rustc`, and as such it
+tends to assume that the code it's compiling is valid (and any
+errors in the generated code are mrustc bugs). Code generation is
+done by emitting a high-level assembly (currently very ugly C, but
+LLVM/cretone/GIMPLE/... could work) and getting an external tool
+(i.e. `gcc`) to do the heavy-lifting of optimising and machine code
+generation.
+
+=====
+
+This is the mrust rustc package.  It builds rustc from rustc's own
+source code using mrustc, minicargo.
diff --git a/mrust-rustc/Makefile b/mrust-rustc/Makefile
new file mode 100644
index 0000000000..b7893f62d3
--- /dev/null
+++ b/mrust-rustc/Makefile
@@ -0,0 +1,88 @@
+# $NetBSD: Makefile,v 1.1 2021/10/12 08:50:00 dlb Exp $
+
+.include "../../lang/mrust/Makefile.common"
+
+PKGNAME=	mrust-rustc-${SNAPSTAMP}
+COMMENT=	Rustc--built from rustc src, using mrustc toolchain
+
+BUILD_TARGET=		${MR_OUTDIR}rustc
+DISTFILES=		${DEFAULT_DISTFILES} ${RUSTSRC_DIST}
+##TEST_TARGET=		rust_tests-libs
+##TEST_MAKE_FLAGS=	-o bin/mrustc -o LIBS
+MAKE_FILE=		minicargo.mk
+MAKE_ENV+=		LD_RUN_PATH=${PREFIX}/lib
+MAKE_ENV+=		RUSTC_INSTALL_BINDIR=bin
+MAKE_ENV+=		RUSTC_TARGET=${MACHINE_ARCH}-unknown-${OPSYS:tl}
+##BUILD_MAKE_FLAGS+=	MINICARGO_FLAGS:="-L ${PREFIX}/lib/"
+
+##MAKE_JOBS_SAFE=	no		# DLBFLAG: this may be needed
+UNLIMIT_RESOURCES=	stacksize	# DLBFLAG: stacksize doesn't need to
+					# be unlimited, but does seem to
+					# need to be higher than the default.
+					# The value that worked for me was
+					# 14m--but that probably could be
+					# tuned (or, simply use this UNLIMIT
+					# feature...?).
+
+USE_TOOLS+=		gmake
+USE_LANGUAGES+=		c c++14
+
+RUSTBIN=		mrust-rustc
+
+
+#* (no options yet) *#.include "options.mk"
+
+
+# "put" (link?) mrustc & minicargo binaries and libraries into
+# directories where minicargo.mk will look for them.
+# Could buildlink3 help with this?  (Probably not without changing
+# upstream Makefile[s]?)
+pre-build:
+	for dd in "${WRKSRC}/bin" "${WRKSRC}/${MR_OUTDIR}"; do		\
+		[ -e "$${dd}" ] || ${MKDIR} "$${dd}";			\
+	done
+	for ff in mrustc minicargo; do					\
+	    [ -e "${WRKSRC}/bin/$${ff}" ] ||				\
+		${LN} -s ${PREFIX}/bin/$${ff} "${WRKSRC}/bin";		\
+	done
+	( cd ${PREFIX}/lib/mrust/;					\
+	    for ff in *; do						\
+		[ -e "${WRKSRC}/${MR_OUTDIR}$$ff" ] ||			\
+		    ${LN} -s "${PREFIX}/lib/mrust/$$ff"			\
+			"${WRKSRC}/${MR_OUTDIR}";			\
+	    done; )
+	cd ${WRKSRC} && ${PKGSRC_SETENV} ${MAKE_ENV} \
+		${MAKE_PROGRAM} ${MAKE_FLAGS} ${BUILD_MAKE_FLAGS} RUSTCSRC
+
+
+pre-test:
+	( cd ${WRKSRC} &&						\
+	    ${PKGSRC_SETENV} ${TEST_ENV} 				\
+		${MAKE_PROGRAM} ${MAKE_FLAGS} ${TEST_MAKE_FLAGS}	\
+			${TEST_TARGET2} )
+
+
+####
+# The source Makefile doesn't have an "install:" target.
+# Use a simplistic workaround here.
+# [DLBFLAG:] Lacks support for MS Windows style ".EXE" suffixes.
+##
+do-install:
+	${PKGSRC_SETENV} ${INSTALL_ENV}					\
+	    ${INSTALL_PROGRAM_DIR} ${DESTDIR}${PREFIX}/bin;
+	( cd ${WRKSRC}/${MR_OUTDIR} &&					\
+	    ${LN} rustc-build/rustc_binary ${RUSTBIN} &&		\
+		${PKGSRC_SETENV} ${INSTALL_ENV}                         \
+		    ${INSTALL_PROGRAM} ${RUSTBIN}			\
+			${DESTDIR}${PREFIX}/bin )
+
+
+BUILD_DEPENDS+=	mrust-mrustc>=${SNAPSTAMP}:../../lang/mrust-mrustc
+BUILD_DEPENDS+=	mrust-minicargo>=${SNAPSTAMP}:../../lang/mrust-minicargo
+BUILD_DEPENDS+=	mrust-libs>=${SNAPSTAMP}:../../lang/mrust-libs
+BUILD_DEPENDS+=	cmake>=3.18.2:../../devel/cmake
+
+
+.include "../../devel/libatomic/buildlink3.mk"
+.include "../../mk/dlopen.buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/mrust-rustc/PLIST b/mrust-rustc/PLIST
new file mode 100644
index 0000000000..bc24f3fbb6
--- /dev/null
+++ b/mrust-rustc/PLIST
@@ -0,0 +1,2 @@
+@comment $NetBSD$
+bin/mrust-rustc
diff --git a/mrust-rustc/distinfo b/mrust-rustc/distinfo
new file mode 100644
index 0000000000..0af464c8ae
--- /dev/null
+++ b/mrust-rustc/distinfo
@@ -0,0 +1,14 @@
+$NetBSD$
+
+SHA1 (mrustc/0e5ffbf19d4331ec96c2231866a81429b90b2dbe-0e5ffbf19d4331ec96c2231866a81429b90b2dbe.zip) = 3c2e1bff891239cc0431b3e6928112ebb7b36793
+RMD160 (mrustc/0e5ffbf19d4331ec96c2231866a81429b90b2dbe-0e5ffbf19d4331ec96c2231866a81429b90b2dbe.zip) = c99362354c652e037622c84b8076ea3bfc4e1ec8
+SHA512 (mrustc/0e5ffbf19d4331ec96c2231866a81429b90b2dbe-0e5ffbf19d4331ec96c2231866a81429b90b2dbe.zip) = 8af5c92102f9964c8f68ff469f0d1197e9b84fcf07d9efa8805011766ce256ddef794c2d08a3a85c7cd0234c9235ca5fe0b18372a71fa984d36e2e765d379037
+Size (mrustc/0e5ffbf19d4331ec96c2231866a81429b90b2dbe-0e5ffbf19d4331ec96c2231866a81429b90b2dbe.zip) = 1354302 bytes
+SHA1 (mrustc/rustc-1.39.0-src.tar.gz) = 82ef6f3b88b8d5e3bfa2fab67bbacf5d6f6ba6bb
+RMD160 (mrustc/rustc-1.39.0-src.tar.gz) = d5b04b87fc336e3be7d592f70de0363aa66622aa
+SHA512 (mrustc/rustc-1.39.0-src.tar.gz) = 77be74410b9f7a2e9f78f7a9860964e122ab9518553acc2cc80d5abeecf3302e9b3ed1fd29e022cccff1f9ff4a568b4015c0d3ac0a524f06e38e9cb360a3341e
+Size (mrustc/rustc-1.39.0-src.tar.gz) = 152803201 bytes
+SHA1 (patch-Makefile) = 4cec2c6cc36210bf5ca77f2ae6bbfa23396769e7
+SHA1 (patch-minicargo.mk) = a13fa4b05e443871b8d25aa7f008069f5dd2f91d
+SHA1 (patch-rustc-1.39.0-src.patch) = fa225534ccf3881ba8ad1e08c79b0b3a6a7b3a5d
+SHA1 (patch-script-overrides_stable-1.39.0-linux_build__std.txt) = 728fce6fbbd81db342bdc1eb0f6ac57abf45f8b7
diff --git a/mrust-rustc/patches/patch-Makefile b/mrust-rustc/patches/patch-Makefile
new file mode 100644
index 0000000000..68a07ca3a3
--- /dev/null
+++ b/mrust-rustc/patches/patch-Makefile
@@ -0,0 +1,19 @@
+$NetBSD$
+
+--- Makefile.orig	2021-09-12 00:15:52.000000000 +0000
++++ Makefile
+@@ -213,9 +213,12 @@ $(RUSTC_SRC_TARBALL): $(RUSTC_SRC_DES)
+ 	@echo [CURL] $@
+ 	@rm -f $@
+ 	@curl -sS https://static.rust-lang.org/dist/$@ -o $@
+-$(RUSTC_SRC_DL): $(RUSTC_SRC_TARBALL) rustc-$(RUSTC_VERSION)-src.patch
+-	tar -xf $(RUSTC_SRC_TARBALL)
++##$(RUSTC_SRC_DL): $(RUSTC_SRC_TARBALL) rustc-$(RUSTC_VERSION)-src.patch
++$(RUSTC_SRC_DL): rustc-$(RUSTC_VERSION)-src.patch
++	@###tar -xf $(RUSTC_SRC_TARBALL)
++	@mv ../$(RUSTCSRC) ./
+ 	cd $(RUSTCSRC) && patch -p0 < ../rustc-$(RUSTC_VERSION)-src.patch;
++	find $(RUSTCSRC) -name '*.[oa]' -print0 | xargs -0 rm
+ 	cat $(RUSTC_SRC_DES) > $(RUSTC_SRC_DL)
+ endif
+ 
diff --git a/mrust-rustc/patches/patch-minicargo.mk b/mrust-rustc/patches/patch-minicargo.mk
new file mode 100644
index 0000000000..51856ffe46
--- /dev/null
+++ b/mrust-rustc/patches/patch-minicargo.mk
@@ -0,0 +1,12 @@
+$NetBSD$
+
+--- minicargo.mk.orig	2021-09-12 00:15:52.000000000 +0000
++++ minicargo.mk
+@@ -56,7 +56,6 @@ RUSTC_TARGET ?= x86_64-unknown-linux-gnu
+ LLVM_TARGETS ?= X86;ARM;AArch64#;Mips;PowerPC;SystemZ;JSBackend;MSP430;Sparc;NVPTX
+ OVERRIDE_DIR := script-overrides/$(RUSTC_CHANNEL)-$(RUSTC_VERSION)$(OVERRIDE_SUFFIX)/
+ 
+-.PHONY: bin/mrustc bin/minicargo
+ .PHONY: $(OUTDIR)libstd.rlib $(OUTDIR)libtest.rlib $(OUTDIR)libpanic_unwind.rlib $(OUTDIR)libproc_macro.rlib
+ .PHONY: $(OUTDIR)rustc $(OUTDIR)cargo
+ 
diff --git a/mrust-rustc/patches/patch-rustc-1.39.0-src.patch b/mrust-rustc/patches/patch-rustc-1.39.0-src.patch
new file mode 100644
index 0000000000..d7ecbe5cfb
--- /dev/null
+++ b/mrust-rustc/patches/patch-rustc-1.39.0-src.patch
@@ -0,0 +1,59 @@
+$NetBSD$
+
+--- rustc-1.39.0-src.patch.orig	2021-09-12 00:15:52.000000000 +0000
++++ rustc-1.39.0-src.patch
+@@ -95,3 +95,54 @@ index da9d9d5bfdc0..3d47471f0ef0 100644
+ #+//#[cfg(target_arch = "x86_64")]
+ #+//static_assert_size!(Const<'_>, 40);
+ 
++##########
++####
++# DLB's additions
++####
++--- ./src/librustc/hir/mod.rs.orig	2019-11-04 10:45:21.000000000 -0500
+++++ ./src/librustc/hir/mod.rs	2021-09-19 05:57:02.354311624 -0400
++@@ -1413,7 +1413,7 @@
++ 
++ // `Expr` is used a lot. Make sure it doesn't unintentionally get bigger.
++ #[cfg(target_arch = "x86_64")]
++-static_assert_size!(Expr, 72);
+++//DLB commented//static_assert_size!(Expr, 72);
++ 
++ impl Expr {
++     pub fn precedence(&self) -> ExprPrecedence {
++--- ./src/librustc/ty/sty.rs.orig	2019-11-04 10:45:21.000000000 -0500
+++++ ./src/librustc/ty/sty.rs	2021-09-19 05:53:20.696595361 -0400
++@@ -2256,7 +2256,7 @@
++ }
++ 
++ #[cfg(target_arch = "x86_64")]
++-static_assert_size!(Const<'_>, 40);
+++//DLB commented out//static_assert_size!(Const<'_>, 40);
++ 
++ impl<'tcx> Const<'tcx> {
++     #[inline]
++--- ./src/librustc/mir/interpret/value.rs.orig	2019-11-04 10:45:21.000000000 -0500
+++++ ./src/librustc/mir/interpret/value.rs	2021-09-19 06:01:16.436347256 -0400
++@@ -107,7 +107,7 @@
++ }
++ 
++ #[cfg(target_arch = "x86_64")]
++-static_assert_size!(Scalar, 24);
+++//DLB commented//static_assert_size!(Scalar, 24);
++ 
++ impl<Tag: fmt::Debug, Id: fmt::Debug> fmt::Debug for Scalar<Tag, Id> {
++     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
++--- ./src/libsyntax/ast.rs.orig	2019-11-04 10:45:21.000000000 -0500
+++++ ./src/libsyntax/ast.rs	2021-09-19 05:42:10.925002154 -0400
++@@ -984,7 +984,7 @@
++ 
++ // `Expr` is used a lot. Make sure it doesn't unintentionally get bigger.
++ #[cfg(target_arch = "x86_64")]
++-static_assert_size!(Expr, 96);
+++//DLB commented// static_assert_size!(Expr, 96);
++ 
++ impl Expr {
++     /// Returns `true` if this expression would be valid somewhere that expects a value;
++
++
++##########
diff --git a/mrust-rustc/patches/patch-script-overrides_stable-1.39.0-linux_build__std.txt b/mrust-rustc/patches/patch-script-overrides_stable-1.39.0-linux_build__std.txt
new file mode 100644
index 0000000000..cf44e8fa2e
--- /dev/null
+++ b/mrust-rustc/patches/patch-script-overrides_stable-1.39.0-linux_build__std.txt
@@ -0,0 +1,9 @@
+$NetBSD$
+
+--- script-overrides/stable-1.39.0-linux/build_std.txt.orig	2021-09-12 00:15:52.000000000 +0000
++++ script-overrides/stable-1.39.0-linux/build_std.txt
+@@ -1,4 +1,3 @@
+-cargo:rustc-link-lib=dl
+ cargo:rustc-link-lib=rt
+ cargo:rustc-link-lib=pthread
+ 
diff --git a/mrust/DESCR b/mrust/DESCR
new file mode 100644
index 0000000000..f50509f8d8
--- /dev/null
+++ b/mrust/DESCR
@@ -0,0 +1,23 @@
+Mutabah's Rust Compiler
+
+  _In-progress_ alternative rust compiler. Capable of building a
+  fully-working copy of rustc, but not suitable for everyday use
+  (due to terrible error messages).
+
+This project is a "simple" rust compiler written in C++ that is
+able to bootstrap a "recent" rustc, but may eventually become a
+full separate re-implementation.
+
+`mrustc`'s primary goal is bootstrapping `rustc`, and as such it
+tends to assume that the code it's compiling is valid (and any
+errors in the generated code are mrustc bugs). Code generation is
+done by emitting a high-level assembly (currently very ugly C, but
+LLVM/cretone/GIMPLE/... could work) and getting an external tool
+(i.e. `gcc`) to do the heavy-lifting of optimising and machine code
+generation.
+
+=====
+
+This is a meta-package that pulls in the mrustc pieces (TBD, but
+possibly mrust-mrustc, mrust-minicargo, mrust-libs, mrust-rustc &
+mrust-cargo)
diff --git a/mrust/Makefile.common b/mrust/Makefile.common
new file mode 100644
index 0000000000..2d641e874e
--- /dev/null
+++ b/mrust/Makefile.common
@@ -0,0 +1,114 @@
+# $NetBSD: Makefile.common,v 1.1 2021/12/04 08:08:43 xxxx Exp $
+# used by lang/mrust-mrustc/Makefile
+# used by lang/mrust-minicargo/Makefile
+# used by lang/mrust-libs/Makefile
+# used by lang/mrust-rustc/Makefile
+# used by lang/mrust-cargo/Makefile
+# used by (etc)
+
+GITHUB_PROJECT=	mrustc
+GITHUB_TAG=	0e5ffbf19d4331ec96c2231866a81429b90b2dbe
+DISTNAME=	0e5ffbf19d4331ec96c2231866a81429b90b2dbe
+SNAPSTAMP=	20210912a
+PKGNAME=	mrust-${SNAPSTAMP}
+CATEGORIES=	lang
+MASTER_SITES=	${MASTER_SITE_GITHUB:=thepowersgang/}
+#MASTER_SITES=	https://github.com/thepowersgang/mrustc/archive/0e5ffbf19d4331ec96c2231866a81429b90b2dbe.zip
+EXTRACT_SUFX=	.zip
+DIST_SUBDIR=	${GITHUB_PROJECT}
+
+#MAINTAINER=	pkgsrc-users%NetBSD.org@localhost
+MAINTAINER=	pkgsrc-mrust%web5by5.com@localhost
+#HOMEPAGE=	https://github.com/thepowersgang/mrustc/
+HOMEPAGE=	https://github.com/thepowersgang/mrustc\#readme
+COMMENT=	Mutabah's Rust Compiler--rustc bootstrapper implemented in C++
+LICENSE=	mit
+
+
+USE_LANGUAGES+=		c++14
+USE_TOOLS+=		gmake
+###GNU_CONFIGURE=		yes
+#CONFIGURE_ENV+=	BDB_LIBS=${BDB_LINK:Q}
+#CONFIGURE_ARGS+=	-prefix ${PREFIX}
+#CONFIGURE_ARGS+=	-with-pthread
+#CONFIGURE_ARGS+=	-host ${MACHINE_GNU_PLATFORM:Q}
+#CONFIGURE_ARGS+=	--without-x
+#CPPFLAGS+=		-DDB_DBM_HSEARCH
+
+RUSTVER=		1.39.0
+
+RUSTSRC_DIST=		rustc-${RUSTVER}-src.tar.gz
+SITES.${RUSTRSRC_DIST}=	https://static.rust-lang.org/dist/
+
+MR_OUTDIR=		output-${RUSTVER}/
+
+BUILD_MAKE_FLAGS=	PARLEVEL:=${MAKE_JOBS}
+MAKE_ENV+=		MRUSTC_TARGET_VER=1.39
+MAKE_ENV+=		OUTDIR_SUF=-${RUSTVER}
+MAKE_ENV+=		RUSTC_VERSION=${RUSTVER}
+
+##
+# FIXME [-DLB, 28dec2021]:
+#   On NetBSD 9.x/amd64, setting RUSTC_TARGET results in a
+#   "... panicked at 'failed to allocate a guard page', ..." error
+#   during the build of rustc (via mrust tools), whereas leaving it
+#   unset** results in a successful build; but does it do so at the
+#   peril of leaving behind hidden, platform-specific errors, or
+#   even just a result that's not well optimized for the platform?
+#
+#   Therefore: leave it unset for now, but assistance is requested
+#   from someone knowledgeable to identify what's going on (e.g,.
+#   could this have anything to do with, e.g., a PaX mitigation?).
+#
+#  ** (in which case it defaults to a -linux suffix)
+#
+#MAKE_ENV+=		RUSTC_TARGET=${MACHINE_ARCH}-unknown-${OPSYS:tl}
+##
+
+#DISTINFO_FILE=	${.CURDIR}/../../lang/ocaml/distinfo
+#PATCHDIR=	${.CURDIR}/../../lang/ocaml/patches
+
+.include "../../mk/bsd.prefs.mk"
+
+###.if ${OPSYS} == "Linux"
+###INSTALL_UNSTRIPPED=	yes
+###.endif
+
+#.if ${OPSYS} == "Darwin"
+#CONFIGURE_ENV+=	CC="${CC} -arch ${MACHINE_ARCH} ${CFLAGS}"
+#CONFIGURE_ENV+=	ASPP="${CC} -arch ${MACHINE_ARCH} -c"
+#CONFIGURE_ENV+=	AS="as -arch ${MACHINE_ARCH}"
+#.else
+#CONFIGURE_ENV+=	CC="${CC} ${CFLAGS}"
+#.endif
+
+###.include "../../mk/bdb.buildlink3.mk"
+
+#BDB_LINK=	${BDB_LIBS}
+#.if empty(BDBBASE:M/usr)
+#BDB_LINK+=	-L${BDBBASE}/lib ${COMPILER_RPATH_FLAG}${BDBBASE}/lib
+#.endif
+
+SUBST_CLASSES+=			atomic-pathfix
+SUBST_STAGE.atomic-pathfix=	pre-configure
+SUBST_MESSAGE.atomic-pathfix=	Configuring default path for libatomic.so
+SUBST_FILES.atomic-pathfix=	src/trans/target.cpp
+SUBST_SED.atomic-pathfix=	-e '/define.*BACKEND_C_OPTS_GNU/s|"atomic"|"atomic", "-L", "${PREFIX}/lib"|'
+
+post-patch:
+	@(cd ${WRKSRC};							\
+	    ${MV} rust-version rust-version.dist;			\
+	    ${ECHO} ${RUSTVER} > rust-version;				\
+	    ${TOUCH} -t 200101010101 rust-version)
+
+#post-extract: cp-gnu-config
+
+#.PHONY: cp-gnu-config
+#cp-gnu-config:
+#	${CP} ${PKGSRCDIR}/mk/gnu-config/config.guess ${WRKSRC}/config/gnu/
+#	${CP} ${PKGSRCDIR}/mk/gnu-config/config.sub ${WRKSRC}/config/gnu/
+
+##.include "../../mk/atomic64.mk"	# DLBFLAG: will this be needed?
+###.include "../../mk/pthread.buildlink3.mk"
+
+# url2pkg-marker (please do not remove this line.)


Home | Main Index | Thread Index | Old Index