pkgsrc-WIP-changes archive

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

rust-beta: follow main changes



Module Name:	pkgsrc-wip
Committed By:	pin <voidpin%protonmail.com@localhost>
Pushed By:	pin
Date:		Fri Jul 3 07:28:41 2026 +0200
Changeset:	de534430d1793e19f077c642092af40df78995c0

Modified Files:
	rust-beta/options.mk

Log Message:
rust-beta: follow main changes

Note this packages needs to be updated to the current beta iteration.
I'll do this soon but, I'm currently AFK.

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

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

diffstat:
 rust-beta/options.mk | 89 ++++++++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 83 insertions(+), 6 deletions(-)

diffs:
diff --git a/rust-beta/options.mk b/rust-beta/options.mk
index 8f2b9af1fe..ffdaf7b19a 100644
--- a/rust-beta/options.mk
+++ b/rust-beta/options.mk
@@ -1,22 +1,69 @@
-# $NetBSD$
+# $NetBSD: options.mk,v 1.55 2026/06/30 15:13:10 adam Exp $
 
 PKG_OPTIONS_VAR=	PKG_OPTIONS.rust
-PKG_SUPPORTED_OPTIONS+=	rust-cargo-static rust-docs
+PKG_SUPPORTED_OPTIONS+=	rust-cargo-static rust-docs rust-system-libgit2
 
 .include "../../mk/bsd.fast.prefs.mk"
 
-# The bundled LLVM is the supported choice; the external LLVM option is also
-# available.
+# The bundled LLVM current has issues building on SunOS.
+.if ${OPSYS} != "SunOS"
 PKG_SUPPORTED_OPTIONS+=		rust-internal-llvm
-.if !empty(HAVE_LLVM)
+# There may be compatibility issues with the base LLVM on e.g. NetBSD.
+.  if !empty(HAVE_LLVM)
+PKG_SUGGESTED_OPTIONS+=		rust-internal-llvm
+.  endif
+.endif
+
+# If cross-building, always use the internal LLVM
+.if !empty(TARGET)
 PKG_SUGGESTED_OPTIONS+=		rust-internal-llvm
 .endif
 
 PKG_OPTIONS_LEGACY_OPTS+=	rust-llvm:rust-internal-llvm
 
+# Bundle OpenSSL and curl into the cargo binary when producing
+# bootstraps on NetBSD.
+.if ${OPSYS} == "NetBSD" && ${BUILD_TARGET} == "dist"
+PKG_SUGGESTED_OPTIONS+=	rust-cargo-static
+.endif
+
 .include "../../mk/bsd.options.mk"
 
+# NetBSD/sparc64 when using the internal LLVM needs
+# to not use gcc 10.4 or 10.5 (as found in 10.0_BETA or 10.0), ref.
+# https://github.com/rust-lang/rust/issues/117231
+# (however, gcc from 9.x produces a working LLVM, go figure).
+.if ${MACHINE_PLATFORM:MNetBSD-10.*-sparc64}
+.  if !empty(PKG_OPTIONS:Mrust-internal-llvm)
+# Require GCC 12 (from pkgsrc) to correctly build the embedded LLVM (18.x).
+GCC_REQD+=	12
+.  endif
+.endif
+
+# Apparently, using pkgsrc LLVM 19.x does not work on
+# NetBSD/x86_64 9.x and NetBSD/i386 9.x unless rust is built
+# with a newer gcc than the platform-included 7.5.0.  Ref.
+# https://gnats.netbsd.org/59435 and
+# https://mail-index.netbsd.org/pkgsrc-users/2025/05/20/msg041603.html
+# and following discussion.
+.if empty(PKG_OPTIONS:Mrust-internal-llvm)
+.  if ${MACHINE_PLATFORM:MNetBSD-9.*-x86_64} || \
+      ${MACHINE_PLATFORM:MNetBSD-9.*-i386}
+GCC_REQD+=	10
+.  endif
+.endif
+
+# Fix for problem seen during rust-installer run w/rust 1.84.1 on macppc,
+# "of course" experienced near the end of the build process:
+# assertion "memcmp(mf_ptr(mf) - 1, mf_ptr(mf) - matches[i].dist - 2, matches[i].len) == 0" failed: file "xz-5.2/src/liblzma/lz/lz_encoder_mf.c", line 40, function "lzma_mf_find"
+# The above is seen with both in-tree gcc (10.5.0) and gcc12 from pkgsrc.
+.if ${MACHINE_PLATFORM:MNetBSD-*-powerpc}
+GCC_REQD+=	14
+.endif
+
+#
 # Use the internal copy of LLVM or the external one?
+#
 .if empty(PKG_OPTIONS:Mrust-internal-llvm)
 .include "../../lang/libunwind/buildlink3.mk"
 .include "../../lang/llvm/buildlink3.mk"
@@ -29,8 +76,26 @@ CONFIGURE_ARGS+=	--llvm-root=${BUILDLINK_PREFIX.llvm}
 CONFIGURE_ARGS+=	--set rust.lld=false
 .endif
 
-# Link cargo statically against "native" libraries
+#
+# Use the external libgit2.
+#
+.if !empty(PKG_OPTIONS:Mrust-system-libgit2)
+.include "../../devel/libgit2/buildlink3.mk"
+CONFIGURE_ENV+=		LIBGIT2_NO_VENDOR=1
+.endif
+
+# Rust bumps into NetBSD's limit of 256 TLS keys per process, at least
+# on aarch64 with "fatal runtime error: out of TLS keys, aborting"
+# (for some incomprehensible reason this isn't triggered on NetBSD/amd64 10.1)
+.if ${MACHINE_PLATFORM:MNetBSD-*-aarch64*}
+# So try to bump that per-process limit:
+MAKE_ENV+=		PTHREAD_KEYS_MAX=512
+.endif
+
+#
+# Link cargo statically against "native" libraries.
 # (openssl and curl specifically).
+#
 .if !empty(PKG_OPTIONS:Mrust-cargo-static)
 CONFIGURE_ARGS+=	--enable-cargo-native-static
 .else
@@ -40,7 +105,19 @@ BUILDLINK_API_DEPENDS.curl+= 	curl>=7.67.0
 .include "../../security/openssl/buildlink3.mk"
 .endif
 
+# Work around https://github.com/rust-lang/rust/issues/148497
+# where the linking of rust-analyzer fails because it's now too big
+# for 24-bit word-based PC-relative relocation offsets.
+# Apply on or for powerpc:
+.if ${MACHINE_PLATFORM:MNetBSD-*-powerpc} || \
+    (!empty(TARGET) && ${TARGET:Mpowerpc-*})
+CONFIGURE_ARGS+=	--tools="cargo,clippy,rustdoc,rustfmt,analysis,src,wasm-component-ld"
+# rust-analyzer dropped from list
+.endif
+
+#
 # Install documentation.
+#
 .if !empty(PKG_OPTIONS:Mrust-docs)
 CONFIGURE_ARGS+=	--enable-docs
 .else


Home | Main Index | Thread Index | Old Index