pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
mrust-*: updates to get mrust-rustc (and -mrustc) closer to working seamlessly
Module Name: pkgsrc-wip
Committed By: Dave Berger <pkgsrc-mrust%web5by5.com@localhost>
Pushed By: dave
Date: Sat Apr 12 16:51:28 2025 -0400
Changeset: 5b9feb4c123ffad1d76aea703c6a3e832870e4f5
Modified Files:
mrust-libs/Makefile
mrust-mrustc/distinfo
mrust-rustc/Makefile
mrust-rustc/PLIST
mrust-rustc/distinfo
mrust-rustclibs/Makefile
mrust-rustclibs/PLIST
Added Files:
mrust-mrustc/patches/patch-src_main.cpp
mrust-rustc/patches/patch-.._rustc-1.54.0-src_library_std_src_sys_unix_thread.rs
Log Message:
mrust-*: updates to get mrust-rustc (and -mrustc) closer to working seamlessly
- mrust-mrustc: default to rust-1.54 persona (instead of 1.29)
- mrust-rustc: amend guard page handling to support NetBSD semantics--
mildly improves stability of mrust- builds in NetBSD 9 (and later?)
- in mrust-rustc directory hierarchy: position real executable, named
"rustc", where it can find needed ../lib/rustlib/ resources via
rustc's natural mechanism ("look in the ../lib/ dir parallel to the
../bin/ dir, or whatever it's named, in which my binary-executable
resides");
- add /usr/pkg/bin/mrust-rustc as a symlink to above "rustc"
- TODO: also add "../lib/rustlib/<triple>/lib -> ../../.." symlink
- mrust-rustclibs: include overlooked but fundamental "proc_macro"
crate (another step closer to 'mrust-rustc Just Works')
The above changes were from well over a year ago, went all this time
without being committed, and were NetBSD 9 based; so they may be
badly outdated relative to recent conditions in pkgsrc, NetBSD, etc.:
Aug 18 09:58:52 2022 EDT: mrust-rustc/patches/patch-.._rustc-1.54.0-src_library_std_src_sys_unix_thread.rs
Mar 31 02:40:11 2023 EDT: mrust-rustclibs/PLIST
Apr 22 21:02:31 2023 EDT: mrust-mrustc/patches/patch-src_main.cpp
Apr 22 21:14:14 2023 EDT: mrust-mrustc/distinfo
Apr 22 22:06:46 2023 EDT: mrust-rustc/PLIST
Apr 23 13:03:32 2023 EDT: mrust-rustc/distinfo
Oct 6 16:42:13 2023 EDT: mrust-rustclibs/Makefile
Oct 6 16:42:13 2023 EDT: mrust-rustc/Makefile
Oct 6 16:42:13 2023 EDT: mrust-libs/Makefile
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=5b9feb4c123ffad1d76aea703c6a3e832870e4f5
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
mrust-libs/Makefile | 2 +-
mrust-mrustc/distinfo | 1 +
mrust-mrustc/patches/patch-src_main.cpp | 13 +++++++
mrust-rustc/Makefile | 26 +++++++++----
mrust-rustc/PLIST | 1 +
mrust-rustc/distinfo | 1 +
...c-1.54.0-src_library_std_src_sys_unix_thread.rs | 43 ++++++++++++++++++++++
mrust-rustclibs/Makefile | 2 +-
mrust-rustclibs/PLIST | 1 +
9 files changed, 81 insertions(+), 9 deletions(-)
diffs:
diff --git a/mrust-libs/Makefile b/mrust-libs/Makefile
index d18881609d..888ef32044 100644
--- a/mrust-libs/Makefile
+++ b/mrust-libs/Makefile
@@ -9,7 +9,7 @@ DISTFILES= ${DEFAULT_DISTFILES} ${RUSTSRC_DIST}
MRUST_DISTDIR= ${DISTDIR}/${DIST_SUBDIR}
RUSTSRC_LINK= ${DISTDIR}/${DIST_SUBDIR}/${RUSTSRC_DIST}
BUILD_TARGET= LIBS
-TEST_TARGET= mrustc_tests
+TEST_TARGET= test
##TEST_TARGET2= rust_tests-libs
TEST_MAKE_FLAGS= -o bin/mrustc -o LIBS
MAKE_FILE= minicargo.mk
diff --git a/mrust-mrustc/distinfo b/mrust-mrustc/distinfo
index 4f1d7895a9..0b1d91cb10 100644
--- a/mrust-mrustc/distinfo
+++ b/mrust-mrustc/distinfo
@@ -4,3 +4,4 @@ SHA512 (mrustc/998dc164309d7d707e5c1c38dd61c0b95169cbcf-998dc164309d7d707e5c1c38
Size (mrustc/998dc164309d7d707e5c1c38dd61c0b95169cbcf-998dc164309d7d707e5c1c38dd61c0b95169cbcf.zip) = 1454068 bytes
SHA1 (patch-Makefile) = 3ff1523b9475f4e5667c3a5c17026afef9ce2f90
SHA1 (patch-src_hir__conv_constant__evaluation.cpp) = dae575bff16aa41aba4bfd80474b7b2054fadf84
+SHA1 (patch-src_main.cpp) = 1bf2a1f391ec15d39c5e56ce7eed42fbd47dc40a
diff --git a/mrust-mrustc/patches/patch-src_main.cpp b/mrust-mrustc/patches/patch-src_main.cpp
new file mode 100644
index 0000000000..acc4dcb932
--- /dev/null
+++ b/mrust-mrustc/patches/patch-src_main.cpp
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- src/main.cpp.orig 2022-08-14 04:09:16.000000000 +0000
++++ src/main.cpp
+@@ -37,7 +37,7 @@
+ # include <DbgHelp.h>
+ #endif
+
+-TargetVersion gTargetVersion = TargetVersion::Rustc1_29;
++TargetVersion gTargetVersion = TargetVersion::Rustc1_54;
+
+ struct ProgramParams
+ {
diff --git a/mrust-rustc/Makefile b/mrust-rustc/Makefile
index f00c92395f..1e40c50a96 100644
--- a/mrust-rustc/Makefile
+++ b/mrust-rustc/Makefile
@@ -30,6 +30,7 @@ UNLIMIT_RESOURCES= stacksize # DLBFLAG: stacksize doesn't need to
USE_TOOLS+= gmake
USE_LANGUAGES+= c c++14
+MRUST_LIB= ${PREFIX}/lib/mrust
RUSTBIN= mrust-rustc
@@ -75,12 +76,12 @@ pre-build:
${LN} -s "${PREFIX}/bin/$$ff" "${WRKSRC}/bin"; \
${TOUCH} -hr "${PREFIX}/bin/$$ff" "${WRKSRC}/bin/$$ff"; \
done
- ( cd ${PREFIX}/lib/mrust/; \
- for ff in *; do \
+ ( cd ${MRUST_LIB}/; \
+ for ff in *.rlib*; do \
[ -e "${WRKSRC}/${MR_OUTDIR}$$ff" ] || \
- ${LN} -s "${PREFIX}/lib/mrust/$$ff" \
+ ${LN} -s "${MRUST_LIB}/$$ff" \
"${WRKSRC}/${MR_OUTDIR}"; \
- ${TOUCH} -hr "${PREFIX}/lib/mrust/$$ff" \
+ ${TOUCH} -hr "${MRUST_LIB}/$$ff" \
"${WRKSRC}/${MR_OUTDIR}/$$ff"; \
done; )
cd ${WRKSRC} && ${PKGSRC_SETENV} ${MAKE_ENV} \
@@ -100,13 +101,24 @@ pre-test:
# [DLBFLAG:] Lacks support for MS Windows style ".EXE" suffixes.
##
do-install:
+ ${PKGSRC_SETENV} ${INSTALL_ENV} \
+ ${INSTALL_LIB_DIR} ${DESTDIR}${MRUST_LIB}/rustc;
+ ${PKGSRC_SETENV} ${INSTALL_ENV} \
+ ${INSTALL_PROGRAM_DIR} ${DESTDIR}${MRUST_LIB}/rustc/bin;
${PKGSRC_SETENV} ${INSTALL_ENV} \
${INSTALL_PROGRAM_DIR} ${DESTDIR}${PREFIX}/bin;
( cd ${WRKSRC}/${MR_OUTDIR} && \
- ${LN} rustc-build/rustc_main ${RUSTBIN} && \
+ { [ -e rustc ] || ${LN} rustc-build/rustc_main rustc; } && \
${PKGSRC_SETENV} ${INSTALL_ENV} \
- ${INSTALL_PROGRAM} ${RUSTBIN} \
- ${DESTDIR}${PREFIX}/bin )
+ ${INSTALL_PROGRAM} rustc \
+ ${DESTDIR}${MRUST_LIB}/rustc/bin )
+ ${LN} -s ${MRUST_LIB}/rustc/bin/rustc ${DESTDIR}${PREFIX}/bin/${RUSTBIN}
+
+## ( cd ${WRKSRC}/${MR_OUTDIR} && \
+## ${LN} rustc-build/rustc_main ${RUSTBIN} && \
+## ${PKGSRC_SETENV} ${INSTALL_ENV} \
+## ${INSTALL_PROGRAM} ${RUSTBIN} \
+## ${DESTDIR}${PREFIX}/bin )
TOOL_DEPENDS+= mrust-mrustc>=${SNAPSTAMP}:../../wip/mrust-mrustc
diff --git a/mrust-rustc/PLIST b/mrust-rustc/PLIST
index bc24f3fbb6..f52f32e122 100644
--- a/mrust-rustc/PLIST
+++ b/mrust-rustc/PLIST
@@ -1,2 +1,3 @@
@comment $NetBSD$
bin/mrust-rustc
+lib/mrust/rustc/bin/rustc
diff --git a/mrust-rustc/distinfo b/mrust-rustc/distinfo
index 5a67c35393..c6e86ee196 100644
--- a/mrust-rustc/distinfo
+++ b/mrust-rustc/distinfo
@@ -5,4 +5,5 @@ Size (mrustc/998dc164309d7d707e5c1c38dd61c0b95169cbcf-998dc164309d7d707e5c1c38dd
SHA512 (mrustc/rustc-1.54.0-src.tar.gz) = f6a1d925e233ef40351193e5507d74b1aed13ce516679558c246e6b6955a6ef393d7e61e6c51a0c5696a7e40a9dcee026bea938b954f5ea5394854cc3ca67f90
Size (mrustc/rustc-1.54.0-src.tar.gz) = 170480637 bytes
+SHA1 (patch-.._rustc-1.54.0-src_library_std_src_sys_unix_thread.rs) = 56f21806645071eebccfdbc0fdfdbfc071f59e9e
SHA1 (patch-minicargo.mk) = ced7229e639261a080379a2155a298798f1b2945
diff --git a/mrust-rustc/patches/patch-.._rustc-1.54.0-src_library_std_src_sys_unix_thread.rs b/mrust-rustc/patches/patch-.._rustc-1.54.0-src_library_std_src_sys_unix_thread.rs
new file mode 100644
index 0000000000..84663ada52
--- /dev/null
+++ b/mrust-rustc/patches/patch-.._rustc-1.54.0-src_library_std_src_sys_unix_thread.rs
@@ -0,0 +1,43 @@
+$NetBSD$
+
+--- ../rustc-1.54.0-src/library/std/src/sys/unix/thread.rs.orig 2021-07-26 14:43:02.000000000 +0000
++++ ../rustc-1.54.0-src/library/std/src/sys/unix/thread.rs
+@@ -357,6 +357,21 @@ pub mod guard {
+ const GUARD_PAGES: usize = 1;
+ let guard = guardaddr..guardaddr + GUARD_PAGES * page_size;
+ Some(guard)
++ } else if cfg!(target_os = "netbsd") {
++ // [The following should be reviewed/confirmed, -DLB]:
++ // Using the default else clause below, sporadic guard page
++ // errors were occurring during builds of rustc & cargo with
++ // mrustc on NetBSD; however, NetBSD has a kernel-based
++ // guard area mechanism too. Therefore, try relying on that
++ // instead of the default mmap/mprotect solution; but note:
++ // if userland code changes the stack address, the NetBSD
++ // kernel-based guard mechanism is deactivated (see
++ // pthread_attr_getstack(3)) and the userland code must
++ // manage a guard area itself. Fortunately, the stack
++ // appears to be unchanged by this version of thread.rs
++ let stackaddr = get_stack_start_aligned()?;
++ let stackaddr = stackaddr as usize;
++ Some(stackaddr - page_size..stackaddr)
+ } else {
+ // Reallocate the last page of the stack.
+ // This ensures SIGBUS will be raised on
+@@ -376,11 +391,16 @@ pub mod guard {
+ 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: {}", io::Error::last_os_error());
+ }
+
+ 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: {}", io::Error::last_os_error());
+ }
+
diff --git a/mrust-rustclibs/Makefile b/mrust-rustclibs/Makefile
index f5b87cb088..4ae21dfd2a 100644
--- a/mrust-rustclibs/Makefile
+++ b/mrust-rustclibs/Makefile
@@ -100,7 +100,7 @@ pre-build:
do-build:
( cd ${WRKSRC}/run_rustc; \
- for targ in std panic_unwind; do \
+ for targ in std panic_unwind proc_macro; do \
MRUSTC_PATH=${RUSTC_S} minicargo -j ${MAKE_JOBS:U1} \
--vendor-dir ${RUSTC_SRC_VEND} \
--script-overrides ${MR_OVERRIDES} \
diff --git a/mrust-rustclibs/PLIST b/mrust-rustclibs/PLIST
index 28da3e5a75..cca2397775 100644
--- a/mrust-rustclibs/PLIST
+++ b/mrust-rustclibs/PLIST
@@ -8,6 +8,7 @@ lib/mrust/rustc/libhashbrown-0_11_0_H328.rlib
lib/mrust/rustc/liblibc-0_2_95_H19.rlib
lib/mrust/rustc/libpanic_abort.rlib
lib/mrust/rustc/libpanic_unwind.rlib
+lib/mrust/rustc/libproc_macro.rlib
lib/mrust/rustc/librustc_demangle-0_1_19_H3.rlib
lib/mrust/rustc/librustc_std_workspace_alloc-1_99_0.rlib
lib/mrust/rustc/librustc_std_workspace_core-1_99_0.rlib
Home |
Main Index |
Thread Index |
Old Index