Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 1 Dec 2024 00:59:36 GMT
From:      Jan Beich <jbeich@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: c3e06e3173c7 - main - lang/rust: fork 1.82 into a pinned port
Message-ID:  <202412010059.4B10xauF047953@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by jbeich:

URL: https://cgit.FreeBSD.org/ports/commit/?id=c3e06e3173c743aadf672eaa76f3a74f0eaee77c

commit c3e06e3173c743aadf672eaa76f3a74f0eaee77c
Author:     Jan Beich <jbeich@FreeBSD.org>
AuthorDate: 2024-11-30 14:14:16 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2024-12-01 00:52:16 +0000

    lang/rust: fork 1.82 into a pinned port
    
    A temporary workaround for games/veloren-weekly.
    
    PR:             283039
---
 games/veloren-weekly/Makefile                      |   4 +
 lang/Makefile                                      |   1 +
 lang/rust-nightly/Makefile                         |   2 +-
 lang/rust/Makefile                                 |   2 +-
 lang/rust182/Makefile                              | 290 ++++++++
 lang/rust182/distinfo                              |  51 ++
 ...iler_rustc__driver__impl_src_signal__handler.rs |  28 +
 ...compiler_rustc__target_src_spec_base_freebsd.rs |  11 +
 ...rget_src_spec_targets_i686__unknown__freebsd.rs |  13 +
 ...ompiler_rustc__target_src_abi_call_powerpc64.rs |  11 +
 ...get_src_spec_targets_armv6__unknown__freebsd.rs |  10 +
 ...get_src_spec_targets_armv7__unknown__freebsd.rs |  10 +
 .../patch-library_backtrace_src_backtrace_mod.rs   |  10 +
 ...-src_bootstrap_src_core_build__steps_install.rs |  17 +
 ...src_tools_cargo_src_cargo_sources_git_source.rs |  36 +
 lang/rust182/files/patch-vendor_cc.rs              | 119 ++++
 lang/rust182/files/patch-vendor_libc-0.2.155       | 745 +++++++++++++++++++++
 lang/rust182/files/patch-vendor_libc-0.2.157       | 745 +++++++++++++++++++++
 lang/rust182/files/patch-vendor_libc-0.2.158       | 745 +++++++++++++++++++++
 .../riscv64/patch-vendor_openssl-src_src_lib.rs    |  10 +
 ..._target_src_spec_riscv64gc__unknown__freebsd.rs |  21 +
 lang/rust182/pkg-descr                             |  12 +
 22 files changed, 2891 insertions(+), 2 deletions(-)

diff --git a/games/veloren-weekly/Makefile b/games/veloren-weekly/Makefile
index 7ba04a95f538..7d36278159de 100644
--- a/games/veloren-weekly/Makefile
+++ b/games/veloren-weekly/Makefile
@@ -48,6 +48,10 @@ CARGO_ENV+=		RUSTC_BOOTSTRAP=1
 # XXX https://github.com/rust-lang/cargo/issues/4101
 CARGO_INSTALL_PATH=	server-cli voxygen
 
+# https://github.com/yoanlcq/vek/issues/96
+CARGO_BUILDDEP=	no
+BUILD_DEPENDS+=	rust182>0:lang/rust182
+
 post-patch:
 # .git/ directory is missing, so don't abort if git binary is also missing
 	@${REINPLACE_CMD} -e 's/"git"/"${TRUE}"/' \
diff --git a/lang/Makefile b/lang/Makefile
index becbb9e60509..92e5891dd55e 100644
--- a/lang/Makefile
+++ b/lang/Makefile
@@ -336,6 +336,7 @@
     SUBDIR += rust
     SUBDIR += rust-bootstrap
     SUBDIR += rust-nightly
+    SUBDIR += rust182
     SUBDIR += rustpython
     SUBDIR += s7
     SUBDIR += sagittarius-scheme
diff --git a/lang/rust-nightly/Makefile b/lang/rust-nightly/Makefile
index 86c524050a07..cca7954eb698 100644
--- a/lang/rust-nightly/Makefile
+++ b/lang/rust-nightly/Makefile
@@ -8,7 +8,7 @@ DISTNAME=	rustc-nightly-src
 ONLY_FOR_ARCHS=	amd64
 ONLY_FOR_ARCHS_REASON=	upstream does not provide bootstraps for other architectures
 
-CONFLICTS_INSTALL=	rust
+CONFLICTS_INSTALL=	rust rust182
 
 MASTERDIR=	${.CURDIR}/../rust
 PATCHDIR=	${.CURDIR}/files
diff --git a/lang/rust/Makefile b/lang/rust/Makefile
index 9406b62a91ad..c32ef8f50f2a 100644
--- a/lang/rust/Makefile
+++ b/lang/rust/Makefile
@@ -38,7 +38,7 @@ MAKE_ENV=	DESTDIR=${STAGEDIR} \
 TEST_ENV=	${MAKE_ENV} \
 		ALLOW_NONZERO_RLIMIT_CORE=1
 
-CONFLICTS_INSTALL?=	rust-nightly
+CONFLICTS_INSTALL?=	rust-nightly rust182
 
 # rustc stashes intermediary files in TMPDIR (default /tmp) which
 # might cause issues for users that for some reason space limit
diff --git a/lang/rust182/Makefile b/lang/rust182/Makefile
new file mode 100644
index 000000000000..c221b46faacb
--- /dev/null
+++ b/lang/rust182/Makefile
@@ -0,0 +1,290 @@
+PORTNAME=	rust
+PORTVERSION=	1.82.0
+CATEGORIES=	lang
+MASTER_SITES=	https://static.rust-lang.org/dist/:src \
+		https://dev-static.rust-lang.org/dist/:src \
+		LOCAL/rust:bootstrap \
+		https://static.rust-lang.org/dist/:bootstrap
+DISTNAME?=	${PORTNAME}c-${PORTVERSION}-src
+DISTFILES?=	${NIGHTLY_DATE:D${NIGHTLY_DATE}/}${DISTNAME}${EXTRACT_SUFX}:src \
+		${_RUSTC_BOOTSTRAP}${EXTRACT_SUFX}:bootstrap \
+		${_RUST_STD_BOOTSTRAP}${EXTRACT_SUFX}:bootstrap \
+		${_CARGO_BOOTSTRAP}${EXTRACT_SUFX}:bootstrap
+DIST_SUBDIR?=	rust
+PKGNAMESUFFIX=	182
+
+MAINTAINER=	jbeich@FreeBSD.org
+COMMENT=	Language with a focus on memory safety and concurrency (deprecated 1.82.* series)
+WWW=		https://www.rust-lang.org/
+
+LICENSE=	APACHE20 MIT
+LICENSE_COMB=	dual
+LICENSE_FILE_APACHE20=	${WRKSRC}/LICENSE-APACHE
+LICENSE_FILE_MIT=	${WRKSRC}/LICENSE-MIT
+
+ONLY_FOR_ARCHS=	aarch64 amd64
+ONLY_FOR_ARCHS_REASON=	unused by games/veloren-weekly
+
+LIB_DEPENDS=	libcurl.so:ftp/curl
+
+USES=		cmake:indirect cpe ninja:build pkgconfig python:build ssl tar:xz
+
+CPE_VENDOR=	rust-lang
+
+MAKE_ENV=	DESTDIR=${STAGEDIR} \
+		LIBGIT2_NO_PKG_CONFIG=1 \
+		OPENSSL_DIR="${OPENSSLBASE}"
+TEST_ENV=	${MAKE_ENV} \
+		ALLOW_NONZERO_RLIMIT_CORE=1
+
+PORTSCOUT=	limit:^1\.82\.
+CONFLICTS_INSTALL=	rust rust-nightly
+
+# rustc stashes intermediary files in TMPDIR (default /tmp) which
+# might cause issues for users that for some reason space limit
+# their /tmp.  WRKDIR should have plenty of space.
+# ?= to allow users to still overwrite it in make.conf.
+TMPDIR?=	${WRKDIR}
+
+OPTIONS_DEFINE=		DOCS GDB LTO PORT_LLVM SOURCES WASM
+OPTIONS_DEFAULT=	SOURCES WASM
+OPTIONS_DEFINE_i386=	SSE2
+OPTIONS_DEFAULT_i386=	SSE2
+
+GDB_DESC=	Install ports gdb (necessary for debugging rust programs)
+PORT_LLVM_DESC=	Build against devel/llvm instead of bundled copy (experimental)
+SSE2_DESC=	Enable SSE2 instructions
+SOURCES_DESC=	Install source files
+WASM_DESC=	Build the WebAssembly target (wasm32-unknown-unknown)
+
+SSE2_EXTRA_PATCHES_OFF+=	${FILESDIR}/extra-patch-compiler_rustc__target_src_spec_targets_i686__unknown__freebsd.rs
+
+DOCS_VARS=		_RUST_BUILD_DOCS=true \
+			_COMPONENTS+="rust-docs-${_PACKAGE_VERS}-${_RUST_TARGET} rust-docs-json-${_PACKAGE_VERS}-${_RUST_TARGET}" \
+			_RUST_TOOLS+=rustdoc
+DOCS_VARS_OFF=		_RUST_BUILD_DOCS=false
+GDB_RUN_DEPENDS=	${LOCALBASE}/bin/gdb:devel/gdb
+PORT_LLVM_USES=		llvm:min=17,lib,noexport
+PORT_LLVM_MAKE_ENV=	RUSTFLAGS="-Lnative=${LOCALBASE}/lib"
+SOURCES_VARS=		_COMPONENTS+=rust-src-${_PACKAGE_VERS} \
+			_RUST_TOOLS+=src
+WASM_VARS=		_COMPONENTS+="rust-analysis-${_PACKAGE_VERS}-wasm32-unknown-unknown rust-std-${_PACKAGE_VERS}-wasm32-unknown-unknown" \
+			_RUST_TARGETS+=wasm32-unknown-unknown
+
+# See WRKSRC/src/stage0 for the date and version values
+BOOTSTRAPS_DATE?=		2024-09-05
+RUST_BOOTSTRAP_VERSION?=	1.81.0
+
+CARGO_VENDOR_DIR?=		${WRKSRC}/vendor
+
+# Rust's target arch string might be different from *BSD arch strings
+_RUST_ARCH_amd64=	x86_64
+_RUST_ARCH_i386=	i686
+_RUST_ARCH_riscv64=	riscv64gc
+_RUST_TARGET=		${_RUST_ARCH_${ARCH}:U${ARCH}}-unknown-${OPSYS:tl}
+_RUST_TARGETS=		${_RUST_TARGET}
+_RUST_TOOLS=		analysis cargo clippy rust-analyzer rustdoc rustfmt
+
+_RUSTC_BOOTSTRAP=	${BOOTSTRAPS_DATE_${ARCH}:U${BOOTSTRAPS_DATE}}/rustc-${RUST_BOOTSTRAP_VERSION_${ARCH}:U${RUST_BOOTSTRAP_VERSION}}-${_RUST_TARGET}
+_RUST_STD_BOOTSTRAP=	${BOOTSTRAPS_DATE_${ARCH}:U${BOOTSTRAPS_DATE}}/rust-std-${RUST_BOOTSTRAP_VERSION_${ARCH}:U${RUST_BOOTSTRAP_VERSION}}-${_RUST_TARGET}
+_CARGO_BOOTSTRAP=	${BOOTSTRAPS_DATE_${ARCH}:U${BOOTSTRAPS_DATE}}/cargo-${RUST_BOOTSTRAP_VERSION_${ARCH}:U${RUST_BOOTSTRAP_VERSION}}-${_RUST_TARGET}
+
+_PACKAGE_VERS=		${NIGHTLY_DATE:?nightly:${PORTVERSION}}
+_COMPONENTS+=		cargo-${_PACKAGE_VERS}-${_RUST_TARGET} \
+			clippy-${_PACKAGE_VERS}-${_RUST_TARGET} \
+			rustc-${_PACKAGE_VERS}-${_RUST_TARGET} \
+			rustfmt-${_PACKAGE_VERS}-${_RUST_TARGET} \
+			rust-analysis-${_PACKAGE_VERS}-${_RUST_TARGET} \
+			rust-std-${_PACKAGE_VERS}-${_RUST_TARGET}
+
+.include <bsd.port.pre.mk>
+
+.if ${OPSYS} != FreeBSD
+IGNORE=		is only for FreeBSD
+.endif
+
+.if ${ARCH} == powerpc
+LIB_DEPENDS+=	libatomic.so:lang/gcc${GCC_DEFAULT}
+MAKE_ENV+=	RUSTFLAGS="-L/usr/local/lib/gcc${GCC_DEFAULT}"
+.endif
+
+# rls doesn't build on rust nightly
+.if !defined(NIGHTLY_DATE)
+_RUST_TOOLS+=	rls
+_COMPONENTS+=	rls-${_PACKAGE_VERS}-${_RUST_TARGET}
+.endif
+
+.if ${ARCH} != powerpc64le
+MAKE_ENV+=	RUST_BACKTRACE=1
+.endif
+
+# per https://rust-lang.github.io/rustup/concepts/components.html
+# rustc-dev is only usefull on nightly
+.if defined(NIGHTLY_DATE)
+_COMPONENTS+=	rustc-dev-${_PACKAGE_VERS}-${_RUST_TARGET}
+.endif
+
+.if ${PORT_OPTIONS:MWASM} && ${PORT_OPTIONS:MDOCS}
+_COMPONENTS+=	rust-docs-${_PACKAGE_VERS}-wasm32-unknown-unknown rust-docs-json-${_PACKAGE_VERS}-wasm32-unknown-unknown
+.endif
+
+.if exists(${PATCHDIR}/${ARCH}${BOOTSTRAPS_SUFFIX})
+EXTRA_PATCHES+=	${PATCHDIR}/${ARCH}${BOOTSTRAPS_SUFFIX}
+.endif
+
+.ifdef QEMU_EMULATING
+IGNORE=	fails to build with qemu-user-static
+.endif
+
+.if make(makesum)
+DISTFILES:=	${DISTFILES:M*\:src} \
+		${ONLY_FOR_ARCHS:O:@_arch@${:!${MAKE} ARCH=${_arch} -V'DISTFILES:N*\:src'!}@}
+.endif
+
+post-patch:
+	@${REINPLACE_CMD} 's,gdb,${LOCALBASE}/bin/gdb,' ${WRKSRC}/src/etc/rust-gdb
+.if defined(NIGHTLY_DATE)
+	@${REINPLACE_CMD} 's/rustfmt/nothx/' ${WRKSRC}/src/stage0
+.endif
+# Disable vendor checksums
+	@${REINPLACE_CMD} 's,"files":{[^}]*},"files":{},' \
+		${CARGO_VENDOR_DIR}/*/.cargo-checksum.json
+
+post-patch-PORT_LLVM-on:
+# WASM target hardcodes bundled lld
+	@${REINPLACE_CMD} 's|"rust-lld"|"wasm-ld${LLVM_VERSION}"|' \
+		${WRKSRC}/compiler/rustc_target/src/spec/base/wasm.rs
+
+do-configure:
+# Check that the running kernel has COMPAT_FREEBSD11 required by lang/rust post-ino64
+	@${SETENV} CC="${CC}" OPSYS="${OPSYS}" OSVERSION="${OSVERSION}" WRKDIR="${WRKDIR}" \
+		${SH} ${SCRIPTSDIR}/rust-compat11-canary.sh
+.for _component in cargo rust-std rustc
+	@cd ${WRKDIR}/${_component}-*-${OPSYS:tl} && \
+		${SH} install.sh --prefix=${WRKDIR}/bootstrap --verbose
+.endfor
+	@${ECHO_CMD} '[build]' >> ${WRKSRC}/config.toml
+	@${ECHO_CMD} 'build-dir="${WRKDIR}/_build"' >> ${WRKSRC}/config.toml
+	@${ECHO_CMD} 'build-stage=2' >> ${WRKSRC}/config.toml
+	@${ECHO_CMD} 'doc-stage=2' >> ${WRKSRC}/config.toml
+	@${ECHO_CMD} 'test-stage=2' >> ${WRKSRC}/config.toml
+	@${ECHO_CMD} 'vendor=true' >> ${WRKSRC}/config.toml
+	@${ECHO_CMD} 'extended=true' >> ${WRKSRC}/config.toml
+	@${ECHO_CMD} 'python="${PYTHON_CMD}"' >> ${WRKSRC}/config.toml
+	@${ECHO_CMD} 'docs=${_RUST_BUILD_DOCS}' >> ${WRKSRC}/config.toml
+	@${ECHO_CMD} 'verbose=2' >> ${WRKSRC}/config.toml
+.if defined(NIGHTLY_DATE)
+	@${ECHO_CMD} 'profiler=true' >> ${WRKSRC}/config.toml
+.endif
+	@${ECHO_CMD} 'target=[${_RUST_TARGETS:@.target.@"${.target.}"@:ts,}]' >> ${WRKSRC}/config.toml
+	@${ECHO_CMD} 'cargo="${WRKDIR}/bootstrap/bin/cargo"' >> ${WRKSRC}/config.toml
+	@${ECHO_CMD} 'rustc="${WRKDIR}/bootstrap/bin/rustc"' >> ${WRKSRC}/config.toml
+	@${ECHO_CMD} 'tools=[${_RUST_TOOLS:@.tool.@"${.tool.}"@:ts,}]' >> ${WRKSRC}/config.toml
+	@${ECHO_CMD} '[install]' >> ${WRKSRC}/config.toml
+	@${ECHO_CMD} 'prefix="${PREFIX}"' >> ${WRKSRC}/config.toml
+	@${ECHO_CMD} 'sysconfdir="${PREFIX}/etc"' >> ${WRKSRC}/config.toml
+	@${ECHO_CMD} '[rust]' >> ${WRKSRC}/config.toml
+	@${ECHO_CMD} 'channel="stable"' >> ${WRKSRC}/config.toml
+	@${ECHO_CMD} 'default-linker="${CC}"' >> ${WRKSRC}/config.toml
+	@${ECHO_CMD} 'deny-warnings=false' >> ${WRKSRC}/config.toml
+	@${ECHO_CMD} 'verbose-tests=true' >> ${WRKSRC}/config.toml
+.if ${PORT_OPTIONS:MWASM} && !${PORT_OPTIONS:MPORT_LLVM}
+	@${ECHO_CMD} 'lld=true' >> ${WRKSRC}/config.toml
+.else
+	@${ECHO_CMD} 'lld=false' >> ${WRKSRC}/config.toml
+.endif
+.if ${PORT_OPTIONS:MLTO}
+	@${ECHO_CMD} 'lto="thin"' >> ${WRKSRC}/config.toml
+.endif
+	@${ECHO_CMD} 'remap-debuginfo=true' >> ${WRKSRC}/config.toml
+	@${ECHO_CMD} '[llvm]' >> ${WRKSRC}/config.toml
+.if defined(NIGHTLY_DATE)
+	@${ECHO_CMD} 'download-ci-llvm = false' >> ${WRKSRC}/config.toml
+.endif
+.if ${PORT_OPTIONS:MLTO}
+	@${ECHO_CMD} 'thin-lto=true' >> ${WRKSRC}/config.toml
+.endif
+.if defined(WITH_CCACHE_BUILD) && !defined(NO_CCACHE)
+	@${ECHO_CMD} 'ccache="${CCACHE_BIN}"' >> ${WRKSRC}/config.toml
+.else
+	@${ECHO_CMD} 'ccache=false' >> ${WRKSRC}/config.toml
+.endif
+	@${ECHO_CMD} 'ninja=true' >> ${WRKSRC}/config.toml
+.if ${ARCH} == powerpc
+# Rust doesn't call the system compiler with the full version of the target.
+# This makes powerpc miscompile due to the secure-plt ABI change.
+# Additionally, force using ld.bfd to work around a linking problem in rustc_mir
+	@${PRINTF} '#!/bin/sh\nexec ${CC} "$$@" --target=powerpc-unknown-freebsd13.2' > ${WRKDIR}/cc-wrapper
+	@${CHMOD} +x ${WRKDIR}/cc-wrapper
+	@${PRINTF} '#!/bin/sh\nexec ${CXX} "$$@" --target=powerpc-unknown-freebsd13.2' > ${WRKDIR}/cxx-wrapper
+	@${CHMOD} +x ${WRKDIR}/cxx-wrapper
+.endif
+.for _target in ${_RUST_TARGETS}
+	@${ECHO_CMD} '[target.${_target}]' >> ${WRKSRC}/config.toml
+	@${ECHO_CMD} 'ar="${AR}"' >> ${WRKSRC}/config.toml
+.if ${ARCH} == powerpc
+	@${ECHO_CMD} 'cc="${WRKDIR}/cc-wrapper"' >> ${WRKSRC}/config.toml
+	@${ECHO_CMD} 'cxx="${WRKDIR}/cxx-wrapper"' >> ${WRKSRC}/config.toml
+.else
+	@${ECHO_CMD} 'cc="${CC}"' >> ${WRKSRC}/config.toml
+	@${ECHO_CMD} 'cxx="${CXX}"' >> ${WRKSRC}/config.toml
+.endif
+	@${ECHO_CMD} 'linker="${CC}"' >> ${WRKSRC}/config.toml
+.if ${PORT_OPTIONS:MPORT_LLVM}
+	@${ECHO_CMD} 'llvm-config="${LOCALBASE}/bin/${LLVM_CONFIG}"' >> ${WRKSRC}/config.toml
+.endif
+.endfor
+	@${ECHO_CMD} '[dist]' >> ${WRKSRC}/config.toml
+	@${ECHO_CMD} 'src-tarball=false' >> ${WRKSRC}/config.toml
+
+do-build:
+	@cd ${WRKSRC} && \
+		${SETENV} ${MAKE_ENV} ${PYTHON_CMD} x.py dist --jobs=${MAKE_JOBS_NUMBER}
+
+do-install:
+	${RM} -r ${WRKDIR}/_extractdist
+.for _c in ${_COMPONENTS}
+	${MKDIR} ${WRKDIR}/_extractdist
+	${TAR} xf ${WRKDIR}/_build/dist/${_c}.tar.xz -C ${WRKDIR}/_extractdist
+	cd ${WRKDIR}/_extractdist/${_c} && \
+		${SH} install.sh \
+		--docdir="${STAGEDIR}${DOCSDIR}" \
+		--mandir="${STAGEDIR}${PREFIX}/share/man" \
+		--prefix="${STAGEDIR}${PREFIX}"
+	${RM} -r ${WRKDIR}/_extractdist
+.endfor
+
+# We autogenerate the plist file.  We do that, instead of the
+# regular pkg-plist, because several libraries have a computed
+# filename based on the absolute path of the source files.  As it
+# is user-specific, we cannot know their filename in advance.
+	@${RM}	${STAGEDIR}${DOCSDIR}/*.old \
+		${STAGEDIR}${PREFIX}/lib/rustlib/components \
+		${STAGEDIR}${PREFIX}/lib/rustlib/install.log \
+		${STAGEDIR}${PREFIX}/lib/rustlib/manifest-* \
+		${STAGEDIR}${PREFIX}/lib/rustlib/rust-installer-version \
+		${STAGEDIR}${PREFIX}/lib/rustlib/uninstall.sh
+	@${FIND} ${STAGEDIR}${PREFIX}/bin ${STAGEDIR}${PREFIX}/lib \
+		${STAGEDIR}${PREFIX}/libexec -exec ${FILE} -i {} + | \
+		${AWK} -F: '/executable|sharedlib/ { print $$1 }' | ${XARGS} ${STRIP_CMD}
+	@${FIND} ${STAGEDIR}${PREFIX} -not -type d | \
+		${SED} -E -e 's,^${STAGEDIR}${PREFIX}/,,' \
+			-e 's,(share/man/man[1-9]/.*\.[0-9]),\1.gz,' >> ${TMPPLIST}
+
+post-install-DOCS-on:
+# Ignore any left behind empty directories in case some docs fail
+# to build (failures are ignored due to deny-warnings=false).
+	@${FIND} ${STAGEDIR}${DOCSDIR}/html -empty -type d | \
+		${SED} 's,^${STAGEDIR},@comment @dir ,' >> ${TMPPLIST}
+
+post-install-SOURCES-on:
+# Silence stage-qa warnings by sanitizing permissions on sources
+	@${FIND} ${STAGEDIR}${PREFIX}/lib/rustlib/src -type f -exec ${CHMOD} \
+		${SHAREMODE} {} +
+
+# Note that make test does not work when rust is already installed.
+do-test:
+	@cd ${WRKSRC} && \
+		${SETENV} ${TEST_ENV} ${PYTHON_CMD} x.py test --jobs=${MAKE_JOBS_NUMBER}
+
+.include <bsd.port.post.mk>
diff --git a/lang/rust182/distinfo b/lang/rust182/distinfo
new file mode 100644
index 000000000000..ffbc0867d0ec
--- /dev/null
+++ b/lang/rust182/distinfo
@@ -0,0 +1,51 @@
+TIMESTAMP = 1731596358
+SHA256 (rust/rustc-1.82.0-src.tar.xz) = 1276a0bb8fa12288ba6fa96597d28b40e74c44257c051d3bc02c2b049bb38210
+SIZE (rust/rustc-1.82.0-src.tar.xz) = 219769328
+SHA256 (rust/2024-09-05/rustc-1.81.0-aarch64-unknown-freebsd.tar.xz) = 721beae8927fc82313d397ce8de7f11a298d3f966344943dae98605a4042758c
+SIZE (rust/2024-09-05/rustc-1.81.0-aarch64-unknown-freebsd.tar.xz) = 61258492
+SHA256 (rust/2024-09-05/rust-std-1.81.0-aarch64-unknown-freebsd.tar.xz) = 4d3a685ea57f94ab78d35da7bc8290a7a21eac70a6b23240d058ce9e5934af50
+SIZE (rust/2024-09-05/rust-std-1.81.0-aarch64-unknown-freebsd.tar.xz) = 26107012
+SHA256 (rust/2024-09-05/cargo-1.81.0-aarch64-unknown-freebsd.tar.xz) = a213e3470c9d4c4b867657be419c47db6f34047837b0fbcc4e18fa7add181dbf
+SIZE (rust/2024-09-05/cargo-1.81.0-aarch64-unknown-freebsd.tar.xz) = 9206832
+SHA256 (rust/2024-09-05/rustc-1.81.0-x86_64-unknown-freebsd.tar.xz) = a1875f80c608dc5e7cf431d782512b36753c7b8a8a7e68b2828542a1b15f4797
+SIZE (rust/2024-09-05/rustc-1.81.0-x86_64-unknown-freebsd.tar.xz) = 50002544
+SHA256 (rust/2024-09-05/rust-std-1.81.0-x86_64-unknown-freebsd.tar.xz) = dd34a1f363e4f36e8814520cd19cb41b8dea4991bf58effa28b68bed5309aa6f
+SIZE (rust/2024-09-05/rust-std-1.81.0-x86_64-unknown-freebsd.tar.xz) = 26944964
+SHA256 (rust/2024-09-05/cargo-1.81.0-x86_64-unknown-freebsd.tar.xz) = 0e2578c6d00860bcfcb7f7f55a85a162d98538c8c4ad856cfa0fe8cacf64a564
+SIZE (rust/2024-09-05/cargo-1.81.0-x86_64-unknown-freebsd.tar.xz) = 10321608
+SHA256 (rust/2024-09-05/rustc-1.81.0-armv7-unknown-freebsd.tar.xz) = c13982b87ae60cbe4fe6ddfa96cded7293c0d59011816e6f89cdfa4531964eea
+SIZE (rust/2024-09-05/rustc-1.81.0-armv7-unknown-freebsd.tar.xz) = 62941904
+SHA256 (rust/2024-09-05/rust-std-1.81.0-armv7-unknown-freebsd.tar.xz) = cadc589d89ca68fb81ad2913e60e89348a75bd228725f82faba2d4c961a2aca7
+SIZE (rust/2024-09-05/rust-std-1.81.0-armv7-unknown-freebsd.tar.xz) = 25949604
+SHA256 (rust/2024-09-05/cargo-1.81.0-armv7-unknown-freebsd.tar.xz) = efbd26868fef7fbca7da59591fdbacefa0f3ad5e263b9487d4fe07c93e0da588
+SIZE (rust/2024-09-05/cargo-1.81.0-armv7-unknown-freebsd.tar.xz) = 9313164
+SHA256 (rust/2024-09-05/rustc-1.81.0-i686-unknown-freebsd.tar.xz) = 5562e52a5d3bc7e6072838c0aa8e7e518fe2db74c0e3792204e1dc5306559b20
+SIZE (rust/2024-09-05/rustc-1.81.0-i686-unknown-freebsd.tar.xz) = 68846504
+SHA256 (rust/2024-09-05/rust-std-1.81.0-i686-unknown-freebsd.tar.xz) = 7f0422aa60f4df0fabc4a07708319b09f496833cc6c4111544710a683b0571b2
+SIZE (rust/2024-09-05/rust-std-1.81.0-i686-unknown-freebsd.tar.xz) = 26734268
+SHA256 (rust/2024-09-05/cargo-1.81.0-i686-unknown-freebsd.tar.xz) = 762a7d113f8c77ae8c50f07da840ccb917cb836b6fbd2427b09967e82189d50a
+SIZE (rust/2024-09-05/cargo-1.81.0-i686-unknown-freebsd.tar.xz) = 10756764
+SHA256 (rust/2024-09-05/rustc-1.81.0-powerpc-unknown-freebsd.tar.xz) = 801950501c837591740febb71f4ef70b461a665e6e899badd1dee7010b2b1757
+SIZE (rust/2024-09-05/rustc-1.81.0-powerpc-unknown-freebsd.tar.xz) = 65322316
+SHA256 (rust/2024-09-05/rust-std-1.81.0-powerpc-unknown-freebsd.tar.xz) = 3704d7d1c404698920373db1131a81eb3d5ec0c6b3dd4620c896144dddf3fe53
+SIZE (rust/2024-09-05/rust-std-1.81.0-powerpc-unknown-freebsd.tar.xz) = 24778908
+SHA256 (rust/2024-09-05/cargo-1.81.0-powerpc-unknown-freebsd.tar.xz) = 23f8b7c3195ba7626ac5c897707e36d5a5e701de79c950b3e58bd647e786faba
+SIZE (rust/2024-09-05/cargo-1.81.0-powerpc-unknown-freebsd.tar.xz) = 9923104
+SHA256 (rust/2024-09-05/rustc-1.81.0-powerpc64-unknown-freebsd.tar.xz) = 478d738a735eb0d1d6dddaee977c4ce0dc5168fcbd9dcadf67a6fc571cc8986a
+SIZE (rust/2024-09-05/rustc-1.81.0-powerpc64-unknown-freebsd.tar.xz) = 63419468
+SHA256 (rust/2024-09-05/rust-std-1.81.0-powerpc64-unknown-freebsd.tar.xz) = 451227b91ed09e7813ffba77b4e17f9b919b11ad373b0bc87a84eec64b7b9a01
+SIZE (rust/2024-09-05/rust-std-1.81.0-powerpc64-unknown-freebsd.tar.xz) = 24849284
+SHA256 (rust/2024-09-05/cargo-1.81.0-powerpc64-unknown-freebsd.tar.xz) = 92dae5616bb090c9ae99d0006fe7612d64773d145f574a091b90cc764287f4ac
+SIZE (rust/2024-09-05/cargo-1.81.0-powerpc64-unknown-freebsd.tar.xz) = 9533220
+SHA256 (rust/2024-09-05/rustc-1.81.0-powerpc64le-unknown-freebsd.tar.xz) = 5be810fe0ee72c734c8e00941f1c01a43506ef6063a3aa51e1e6dbb2fefb520b
+SIZE (rust/2024-09-05/rustc-1.81.0-powerpc64le-unknown-freebsd.tar.xz) = 65284584
+SHA256 (rust/2024-09-05/rust-std-1.81.0-powerpc64le-unknown-freebsd.tar.xz) = 247759fa4d96ec7c7ee88290700a4ef4c2799e8c8e66e7dafe81ca678d57e4f3
+SIZE (rust/2024-09-05/rust-std-1.81.0-powerpc64le-unknown-freebsd.tar.xz) = 24899100
+SHA256 (rust/2024-09-05/cargo-1.81.0-powerpc64le-unknown-freebsd.tar.xz) = 6e5141477f52caf26583e9d3263698ae427c89bec23b3af8b8e0d59f4e6b46ec
+SIZE (rust/2024-09-05/cargo-1.81.0-powerpc64le-unknown-freebsd.tar.xz) = 9825936
+SHA256 (rust/2024-09-05/rustc-1.81.0-riscv64gc-unknown-freebsd.tar.xz) = eec81507223597baa72979407ac0594506aed0d3c42299eb0b8fcc49f27d2251
+SIZE (rust/2024-09-05/rustc-1.81.0-riscv64gc-unknown-freebsd.tar.xz) = 72380112
+SHA256 (rust/2024-09-05/rust-std-1.81.0-riscv64gc-unknown-freebsd.tar.xz) = 160ebd04a8e49ab9b6b3cff4c0e913a433810557fd5ccdb8839ba4facfbdcc3a
+SIZE (rust/2024-09-05/rust-std-1.81.0-riscv64gc-unknown-freebsd.tar.xz) = 24745684
+SHA256 (rust/2024-09-05/cargo-1.81.0-riscv64gc-unknown-freebsd.tar.xz) = a42a1fe5cf41c0baf74e69e0d6f9baf3e592570b232bd2c0f752a56f3622a446
+SIZE (rust/2024-09-05/cargo-1.81.0-riscv64gc-unknown-freebsd.tar.xz) = 11996032
diff --git a/lang/rust182/files/armv7/patch-compiler_rustc__driver__impl_src_signal__handler.rs b/lang/rust182/files/armv7/patch-compiler_rustc__driver__impl_src_signal__handler.rs
new file mode 100644
index 000000000000..17585c99ce3d
--- /dev/null
+++ b/lang/rust182/files/armv7/patch-compiler_rustc__driver__impl_src_signal__handler.rs
@@ -0,0 +1,28 @@
+error[E0308]: mismatched types
+    --> compiler/rustc_driver_impl/src/signal_handler.rs:43:63
+     |
+43   |        let depth = libc::backtrace(STACK_TRACE.as_mut_ptr(), MAX_FRAMES as i32);
+     |                    ---------------                           ^^^^^^^^^^^^^^^^^ expected `usize`, found `i32`
+     |                    |
+     |                    arguments to this function are incorrect
+     |
+note: function defined here
+    --> /wrkdirs/usr/ports/lang/rust-bootstrap/work-armv7/rustc-1.78.0-src/vendor/libc/src/unix/bsd/freebsdlike/mod.rs:1861:12
+     |
+1861 |     pub fn backtrace(addrlist: *mut *mut ::c_void, len: ::size_t) -> ::size_t;
+     |            ^^^^^^^^^
+help: you can convert an `i32` to a `usize` and panic if the converted value doesn't fit
+     |
+43   |         let depth = libc::backtrace(STACK_TRACE.as_mut_ptr(), (MAX_FRAMES as i32).try_into().unwrap());
+
+--- compiler/rustc_driver_impl/src/signal_handler.rs.orig	2024-05-06 16:00:17 UTC
++++ compiler/rustc_driver_impl/src/signal_handler.rs
+@@ -40,7 +40,7 @@ extern "C" fn print_stack_trace(_: libc::c_int) {
+     static mut STACK_TRACE: [*mut libc::c_void; MAX_FRAMES] = [ptr::null_mut(); MAX_FRAMES];
+     let stack = unsafe {
+         // Collect return addresses
+-        let depth = libc::backtrace(STACK_TRACE.as_mut_ptr(), MAX_FRAMES as i32);
++        let depth = libc::backtrace(STACK_TRACE.as_mut_ptr(), (MAX_FRAMES as i32).try_into().unwrap());
+         if depth == 0 {
+             return;
+         }
diff --git a/lang/rust182/files/armv7/patch-compiler_rustc__target_src_spec_base_freebsd.rs b/lang/rust182/files/armv7/patch-compiler_rustc__target_src_spec_base_freebsd.rs
new file mode 100644
index 000000000000..6bbfec294be6
--- /dev/null
+++ b/lang/rust182/files/armv7/patch-compiler_rustc__target_src_spec_base_freebsd.rs
@@ -0,0 +1,11 @@
+--- compiler/rustc_target/src/spec/base/freebsd.rs.orig	2024-11-16 UTC
++++ compiler/rustc_target/src/spec/base/freebsd.rs
+@@ -9,7 +9,7 @@ pub fn opts() -> TargetOptions {
+         crt_static_respected: true,
+         position_independent_executables: true,
+         relro_level: RelroLevel::Full,
+-        has_thread_local: true,
++        has_thread_local: false,
+         abi_return_struct_as_int: true,
+         default_dwarf_version: 2,
+         ..Default::default()
diff --git a/lang/rust182/files/extra-patch-compiler_rustc__target_src_spec_targets_i686__unknown__freebsd.rs b/lang/rust182/files/extra-patch-compiler_rustc__target_src_spec_targets_i686__unknown__freebsd.rs
new file mode 100644
index 000000000000..45d479133343
--- /dev/null
+++ b/lang/rust182/files/extra-patch-compiler_rustc__target_src_spec_targets_i686__unknown__freebsd.rs
@@ -0,0 +1,13 @@
+i386 should be pentiumpro (no SSE2, no ...)
+
+--- compiler/rustc_target/src/spec/targets/i686_unknown_freebsd.rs.orig	2023-12-22 11:18:00 UTC
++++ compiler/rustc_target/src/spec/targets/i686_unknown_freebsd.rs
+@@ -2,7 +2,7 @@ pub fn target() -> Target {
+ 
+ pub fn target() -> Target {
+     let mut base = base::freebsd::opts();
+-    base.cpu = "pentium4".into();
++    base.cpu = "pentiumpro".into();
+     base.max_atomic_width = Some(64);
+     base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32", "-Wl,-znotext"]);
+     base.stack_probes = StackProbeType::X86;
diff --git a/lang/rust182/files/patch-compiler_rustc__target_src_abi_call_powerpc64.rs b/lang/rust182/files/patch-compiler_rustc__target_src_abi_call_powerpc64.rs
new file mode 100644
index 000000000000..814822d5b7c7
--- /dev/null
+++ b/lang/rust182/files/patch-compiler_rustc__target_src_abi_call_powerpc64.rs
@@ -0,0 +1,11 @@
+--- compiler/rustc_target/src/abi/call/powerpc64.rs.orig	2020-03-09 22:11:17 UTC
++++ compiler/rustc_target/src/abi/call/powerpc64.rs
+@@ -95,7 +95,7 @@ where
+         ELFv2
+     } else {
+         match cx.data_layout().endian {
+-            Endian::Big => ELFv1,
++            Endian::Big => ELFv2,
+             Endian::Little => ELFv2,
+         }
+     };
diff --git a/lang/rust182/files/patch-compiler_rustc__target_src_spec_targets_armv6__unknown__freebsd.rs b/lang/rust182/files/patch-compiler_rustc__target_src_spec_targets_armv6__unknown__freebsd.rs
new file mode 100644
index 000000000000..362f599f47f5
--- /dev/null
+++ b/lang/rust182/files/patch-compiler_rustc__target_src_spec_targets_armv6__unknown__freebsd.rs
@@ -0,0 +1,10 @@
+--- compiler/rustc_target/src/spec/targets/armv6_unknown_freebsd.rs.orig	2024-10-31 18:07:58.495590000 +0100
++++ compiler/rustc_target/src/spec/targets/armv6_unknown_freebsd.rs	2024-10-31 18:08:05.438220000 +0100
+@@ -14,7 +14,6 @@ pub fn target() -> Target {
+         arch: "arm".into(),
+         options: TargetOptions {
+             abi: "eabihf".into(),
+-            env: "gnu".into(),
+             features: "+v6,+vfp2,-d32".into(),
+             max_atomic_width: Some(64),
+             mcount: "\u{1}__gnu_mcount_nc".into(),
diff --git a/lang/rust182/files/patch-compiler_rustc__target_src_spec_targets_armv7__unknown__freebsd.rs b/lang/rust182/files/patch-compiler_rustc__target_src_spec_targets_armv7__unknown__freebsd.rs
new file mode 100644
index 000000000000..4ec4c69c94d4
--- /dev/null
+++ b/lang/rust182/files/patch-compiler_rustc__target_src_spec_targets_armv7__unknown__freebsd.rs
@@ -0,0 +1,10 @@
+--- compiler/rustc_target/src/spec/targets/armv7_unknown_freebsd.rs.orig	2024-10-31 18:07:51.199947000 +0100
++++ compiler/rustc_target/src/spec/targets/armv7_unknown_freebsd.rs	2024-10-31 18:08:14.463398000 +0100
+@@ -14,7 +14,6 @@ pub fn target() -> Target {
+         arch: "arm".into(),
+         options: TargetOptions {
+             abi: "eabihf".into(),
+-            env: "gnu".into(),
+             features: "+v7,+vfp3,-d32,+thumb2,-neon".into(),
+             max_atomic_width: Some(64),
+             mcount: "\u{1}__gnu_mcount_nc".into(),
diff --git a/lang/rust182/files/patch-library_backtrace_src_backtrace_mod.rs b/lang/rust182/files/patch-library_backtrace_src_backtrace_mod.rs
new file mode 100644
index 000000000000..f4f618ac6bf1
--- /dev/null
+++ b/lang/rust182/files/patch-library_backtrace_src_backtrace_mod.rs
@@ -0,0 +1,10 @@
+--- library/backtrace/src/backtrace/mod.rs.orig	2021-11-29 19:27:28 UTC
++++ library/backtrace/src/backtrace/mod.rs
+@@ -176,6 +176,7 @@ cfg_if::cfg_if! {
+                 unix,
+                 not(target_os = "emscripten"),
+                 not(all(target_os = "ios", target_arch = "arm")),
++                not(all(target_os = "freebsd", target_arch = "riscv64")),
+             ),
+             all(
+                 target_env = "sgx",
diff --git a/lang/rust182/files/patch-src_bootstrap_src_core_build__steps_install.rs b/lang/rust182/files/patch-src_bootstrap_src_core_build__steps_install.rs
new file mode 100644
index 000000000000..6d7f6d612496
--- /dev/null
+++ b/lang/rust182/files/patch-src_bootstrap_src_core_build__steps_install.rs
@@ -0,0 +1,17 @@
+Only install docs for the host target
+
+It otherwise wastes significant time (there are a lot of individual
+files) and stages host docs, wasm docs, which unstages the host
+docs first.
+
+--- src/bootstrap/src/core/build_steps/install.rs.orig	2022-05-01 20:28:31 UTC
++++ src/bootstrap/src/core/build_steps/install.rs
+@@ -138,7 +138,7 @@ macro_rules! install {
+ }
+ 
+ install!((self, builder, _config),
+-    Docs, path = "src/doc", _config.docs, only_hosts: false, {
++    Docs, path = "src/doc", _config.docs, only_hosts: true, {
+         let tarball = builder.ensure(dist::Docs { host: self.target }).expect("missing docs");
+         install_sh(builder, "docs", self.compiler.stage, Some(self.target), &tarball);
+     };
diff --git a/lang/rust182/files/patch-src_tools_cargo_src_cargo_sources_git_source.rs b/lang/rust182/files/patch-src_tools_cargo_src_cargo_sources_git_source.rs
new file mode 100644
index 000000000000..3add18d71b22
--- /dev/null
+++ b/lang/rust182/files/patch-src_tools_cargo_src_cargo_sources_git_source.rs
@@ -0,0 +1,36 @@
+We run cargo update during USES=cargo ports builds to update specific
+crates and patch Cargo.lock for us.  For normal crates this is based
+on what's available in the vendor dir.  For Git sources this pulls
+new changes from the net instead even if we replace the source with
+a static path in a patch section in the config file.  Add a hack
+to skip this.
+
+This is for experimentation to solve [1].  For this to maybe be
+useful for USES=cargo, the patch-in-config feature also needs to
+be stabilized first.  It will be available in Rust 1.56.
+
+[1] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=256581
+
+--- src/tools/cargo/src/cargo/sources/git/source.rs.orig	2021-10-04 20:59:57 UTC
++++ src/tools/cargo/src/cargo/sources/git/source.rs
+@@ -205,6 +205,9 @@ impl<'cfg> Source for GitSource<'cfg> {
+         kind: QueryKind,
+         f: &mut dyn FnMut(IndexSummary),
+     ) -> Poll<CargoResult<()>> {
++        if std::env::var("CARGO_FREEBSD_PORTS_SKIP_GIT_UPDATE").is_ok() {
++            return Poll::Ready(Ok(()));
++        }
+         if let Some(src) = self.path_source.as_mut() {
+             src.query(dep, kind, f)
+         } else {
+@@ -228,6 +231,10 @@ impl<'cfg> Source for GitSource<'cfg> {
+         if self.path_source.is_some() {
+             self.mark_used(None)?;
+             return Ok(());
++        }
++
++        if std::env::var("CARGO_FREEBSD_PORTS_SKIP_GIT_UPDATE").is_ok() {
++             return Ok(());
+         }
+ 
+         let git_fs = self.config.git_path();
diff --git a/lang/rust182/files/patch-vendor_cc.rs b/lang/rust182/files/patch-vendor_cc.rs
new file mode 100644
index 000000000000..cd36c492c22d
--- /dev/null
+++ b/lang/rust182/files/patch-vendor_cc.rs
@@ -0,0 +1,119 @@
+When the compiler has "clang" in its name the cc crate will pass
+an LLVM target triple to it.  Rust uses a triple that lacks the OS
+version and LLVM will default to FreeBSD 9 behavior, i.e., it will
+default to libstdc++ which is no longer available in newer releases.
+
+To avoid this issue assume we have a GNU compatible toolchain instead
+until LLVM can be updated to use libc++ by default.
+
+https://reviews.llvm.org/D77776
+
+--- vendor/cc-1.0.79/src/lib.rs.orig	2021-03-04 20:58:54 UTC
++++ vendor/cc-1.0.79/src/lib.rs
+@@ -2659,24 +2659,7 @@ impl Tool {
+     }
+ 
+     fn with_features(path: PathBuf, clang_driver: Option<&str>, cuda: bool) -> Self {
+-        // Try to detect family of the tool from its name, falling back to Gnu.
+-        let family = if let Some(fname) = path.file_name().and_then(|p| p.to_str()) {
+-            if fname.contains("clang-cl") {
+-                ToolFamily::Msvc { clang_cl: true }
+-            } else if fname.ends_with("cl") || fname == "cl.exe" {
+-                ToolFamily::Msvc { clang_cl: false }
+-            } else if fname.contains("clang") {
+-                match clang_driver {
+-                    Some("cl") => ToolFamily::Msvc { clang_cl: true },
+-                    _ => ToolFamily::Clang,
+-                }
+-            } else {
+-                ToolFamily::Gnu
+-            }
+-        } else {
+-            ToolFamily::Gnu
+-        };
+-
++        let family = ToolFamily::Gnu;
+         Tool {
+             path: path,
+             cc_wrapper_path: None,
+
+--- vendor/cc-1.0.97/src/tool.rs.orig	2024-05-09 18:20:47 UTC
++++ vendor/cc-1.0.97/src/tool.rs
+@@ -151,9 +151,7 @@ impl Tool {
+ 
+             match (clang, accepts_cl_style_flags, gcc) {
+                 (clang_cl, true, _) => Ok(ToolFamily::Msvc { clang_cl }),
+-                (true, false, _) => Ok(ToolFamily::Clang {
+-                    zig_cc: is_zig_cc(path, cargo_output),
+-                }),
++                (true, false, _) => Ok(ToolFamily::Gnu),
+                 (false, false, true) => Ok(ToolFamily::Gnu),
+                 (false, false, false) => {
+                     cargo_output.print_warning(&"Compiler family detection failed since it does not define `__clang__`, `__GNUC__` or `_MSC_VER`, fallback to treating it as GNU");
+--- vendor/cc-1.0.99/src/tool.rs.orig	2024-05-09 18:20:47 UTC
++++ vendor/cc-1.0.99/src/tool.rs
+@@ -151,9 +151,7 @@ impl Tool {
+ 
+             match (clang, accepts_cl_style_flags, gcc) {
+                 (clang_cl, true, _) => Ok(ToolFamily::Msvc { clang_cl }),
+-                (true, false, _) => Ok(ToolFamily::Clang {
+-                    zig_cc: is_zig_cc(path, cargo_output),
+-                }),
++                (true, false, _) => Ok(ToolFamily::Gnu),
+                 (false, false, true) => Ok(ToolFamily::Gnu),
+                 (false, false, false) => {
+                     cargo_output.print_warning(&"Compiler family detection failed since it does not define `__clang__`, `__GNUC__` or `_MSC_VER`, fallback to treating it as GNU");
+--- vendor/cc-1.0.105/src/tool.rs.orig	2024-05-09 18:20:47 UTC
++++ vendor/cc-1.0.105/src/tool.rs
+@@ -151,9 +151,7 @@ impl Tool {
+ 
+             match (clang, accepts_cl_style_flags, gcc) {
+                 (clang_cl, true, _) => Ok(ToolFamily::Msvc { clang_cl }),
+-                (true, false, _) => Ok(ToolFamily::Clang {
+-                    zig_cc: is_zig_cc(path, cargo_output),
+-                }),
++                (true, false, _) => Ok(ToolFamily::Gnu),
+                 (false, false, true) => Ok(ToolFamily::Gnu),
+                 (false, false, false) => {
+                     cargo_output.print_warning(&"Compiler family detection failed since it does not define `__clang__`, `__GNUC__` or `_MSC_VER`, fallback to treating it as GNU");
+--- vendor/cc-1.1.5/src/tool.rs.orig	2024-05-09 18:20:47 UTC
++++ vendor/cc-1.1.5/src/tool.rs
+@@ -151,9 +151,7 @@ impl Tool {
+ 
+             match (clang, accepts_cl_style_flags, gcc) {
+                 (clang_cl, true, _) => Ok(ToolFamily::Msvc { clang_cl }),
+-                (true, false, _) => Ok(ToolFamily::Clang {
+-                    zig_cc: is_zig_cc(path, cargo_output),
+-                }),
++                (true, false, _) => Ok(ToolFamily::Gnu),
+                 (false, false, true) => Ok(ToolFamily::Gnu),
+                 (false, false, false) => {
+                     cargo_output.print_warning(&"Compiler family detection failed since it does not define `__clang__`, `__GNUC__` or `_MSC_VER`, fallback to treating it as GNU");
+
+--- vendor/cc-1.1.6/src/tool.rs.orig	2024-05-09 18:20:47 UTC
++++ vendor/cc-1.1.6/src/tool.rs
+@@ -151,9 +151,7 @@ impl Tool {
+ 
+             match (clang, accepts_cl_style_flags, gcc) {
+                 (clang_cl, true, _) => Ok(ToolFamily::Msvc { clang_cl }),
+-                (true, false, _) => Ok(ToolFamily::Clang {
+-                    zig_cc: is_zig_cc(path, cargo_output),
+-                }),
++                (true, false, _) => Ok(ToolFamily::Gnu),
+                 (false, false, true) => Ok(ToolFamily::Gnu),
+                 (false, false, false) => {
+                     cargo_output.print_warning(&"Compiler family detection failed since it does not define `__clang__`, `__GNUC__` or `_MSC_VER`, fallback to treating it as GNU");
+
+--- vendor/cc-1.1.10/src/tool.rs.orig	2024-05-09 18:20:47 UTC
++++ vendor/cc-1.1.10/src/tool.rs
+@@ -151,9 +151,7 @@ impl Tool {
+ 
+             match (clang, accepts_cl_style_flags, gcc) {
+                 (clang_cl, true, _) => Ok(ToolFamily::Msvc { clang_cl }),
+-                (true, false, _) => Ok(ToolFamily::Clang {
+-                    zig_cc: is_zig_cc(path, cargo_output),
+-                }),
++                (true, false, _) => Ok(ToolFamily::Gnu),
+                 (false, false, true) => Ok(ToolFamily::Gnu),
+                 (false, false, false) => {
+                     cargo_output.print_warning(&"Compiler family detection failed since it does not define `__clang__`, `__GNUC__` or `_MSC_VER`, fallback to treating it as GNU");
diff --git a/lang/rust182/files/patch-vendor_libc-0.2.155 b/lang/rust182/files/patch-vendor_libc-0.2.155
new file mode 100644
index 000000000000..69c2a03f7062
--- /dev/null
+++ b/lang/rust182/files/patch-vendor_libc-0.2.155
@@ -0,0 +1,745 @@
+https://github.com/rust-lang/rust/issues/130677
+
+From 9049542fabce9eea669d1fe3d4d973931c9d7d23 Mon Sep 17 00:00:00 2001
+From: Alan Somers <asomers@gmail.com>
+Date: Mon, 23 Sep 2024 10:22:32 -0600
+Subject: [PATCH] Fix the definition of ino_t on 32-bit FreeBSD 12+
+
+Commit 7437d0a6f1 erroneously defined it as "ulong" instead of u64.
+Nobody noticed the mistake, probably because it was only tested on
+64-bit architectures, where those are equivalent.  But it's a problem
+now, after #3723 , which switched the standard library to a FreeBSD 12
+ABI.
+
+Issue https://github.com/rust-lang/rust/issues/130677
+---
+ src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs | 2 +-
+ src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs | 2 +-
+ src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs | 2 +-
+ src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs | 2 +-
+ src/unix/bsd/freebsdlike/freebsd/freebsd15/mod.rs | 2 +-
+ 5 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs
+index de34069eabdf2..68a8364194607 100644
+--- vendor/libc-0.2.155/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs
++++ vendor/libc-0.2.155/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs
+@@ -4,7 +4,7 @@
+ pub type nlink_t = u16;
+ // Type of `dev_t` changed from `u32` to `u64` in FreeBSD 12:
+ pub type dev_t = u32;
+-// Type of `ino_t` changed from `unsigned int` to `unsigned long` in FreeBSD 12:
++// Type of `ino_t` changed from `__uint32_t` to `__uint64_t` in FreeBSD 12:
+ pub type ino_t = u32;
+ 
+ s! {
+diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs
+index 10fcaa03a4ef6..197400ffb4e28 100644
+--- vendor/libc-0.2.155/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs
++++ vendor/libc-0.2.155/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs
+@@ -2,7 +2,7 @@
+ 
+ pub type nlink_t = u64;
+ pub type dev_t = u64;
+-pub type ino_t = ::c_ulong;
++pub type ino_t = u64;
+ pub type shmatt_t = ::c_uint;
+ 
+ s! {
+diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs
+index ec6bce2a03091..d3a77d03c48d0 100644
+--- vendor/libc-0.2.155/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs
++++ vendor/libc-0.2.155/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs
+@@ -2,7 +2,7 @@
+ 
+ pub type nlink_t = u64;
+ pub type dev_t = u64;
+-pub type ino_t = ::c_ulong;
++pub type ino_t = u64;
+ pub type shmatt_t = ::c_uint;
+ pub type kpaddr_t = u64;
+ pub type kssize_t = i64;
+diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs
+index 160a4baae481b..9d65317d29cb4 100644
+--- vendor/libc-0.2.155/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs
++++ vendor/libc-0.2.155/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs
+@@ -2,7 +2,7 @@
+ 
+ pub type nlink_t = u64;
+ pub type dev_t = u64;
+-pub type ino_t = ::c_ulong;
++pub type ino_t = u64;
+ pub type shmatt_t = ::c_uint;
+ pub type kpaddr_t = u64;
+ pub type kssize_t = i64;
+diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd15/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd15/mod.rs
+index d73215a68ec33..f76208400f324 100644
+--- vendor/libc-0.2.155/src/unix/bsd/freebsdlike/freebsd/freebsd15/mod.rs
++++ vendor/libc-0.2.155/src/unix/bsd/freebsdlike/freebsd/freebsd15/mod.rs
+@@ -2,7 +2,7 @@
+ 
+ pub type nlink_t = u64;
+ pub type dev_t = u64;
+-pub type ino_t = ::c_ulong;
++pub type ino_t = u64;
+ pub type shmatt_t = ::c_uint;
+ pub type kpaddr_t = u64;
+ pub type kssize_t = i64;
+
+
+From 8aca9c0126f3aa5a7dce1ad7fc016b4a0d6af70a Mon Sep 17 00:00:00 2001
+From: Alan Somers <asomers@gmail.com>
+Date: Mon, 23 Sep 2024 10:44:13 -0600
+Subject: [PATCH] Fix the definition of "struct stat" on 32-bit FreeBSD 12+
+
+The original definitions were never correct.  But nobody noticed because
+we don't do CI on 32-bit FreeBSD.  The problem is apparent now due to
+ #3723 , which caused the nightly toolchain to switch to a FreeBSD 12
+ABI.
+
+Fixes https://github.com/rust-lang/rust/issues/130677
+---
+ .../{freebsd12/b64.rs => freebsd11/b32.rs}    | 13 +++---
+ .../bsd/freebsdlike/freebsd/freebsd11/mod.rs  |  7 +--
+ .../bsd/freebsdlike/freebsd/freebsd12/mod.rs  | 43 +++++++++++++++----
+ .../bsd/freebsdlike/freebsd/freebsd13/b64.rs  | 34 ---------------
+ .../bsd/freebsdlike/freebsd/freebsd13/mod.rs  | 43 +++++++++++++++----
+ .../bsd/freebsdlike/freebsd/freebsd14/b64.rs  | 34 ---------------
+ .../bsd/freebsdlike/freebsd/freebsd14/mod.rs  | 43 +++++++++++++++----
+ .../bsd/freebsdlike/freebsd/freebsd15/b64.rs  | 34 ---------------
+ .../bsd/freebsdlike/freebsd/freebsd15/mod.rs  | 43 +++++++++++++++----
+ src/unix/bsd/freebsdlike/freebsd/x86.rs       | 25 -----------
+ 10 files changed, 146 insertions(+), 173 deletions(-)
+ rename src/unix/bsd/freebsdlike/freebsd/{freebsd12/b64.rs => freebsd11/b32.rs} (89%)
+ delete mode 100644 src/unix/bsd/freebsdlike/freebsd/freebsd13/b64.rs
+ delete mode 100644 src/unix/bsd/freebsdlike/freebsd/freebsd14/b64.rs
+ delete mode 100644 src/unix/bsd/freebsdlike/freebsd/freebsd15/b64.rs
+
+diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd12/b64.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd11/b32.rs
+similarity index 89%
+rename from src/unix/bsd/freebsdlike/freebsd/freebsd12/b64.rs
+rename to src/unix/bsd/freebsdlike/freebsd/freebsd11/b32.rs
+
+--- vendor/libc-0.2.155/src/unix/bsd/freebsdlike/freebsd/freebsd11/b32.rs.orig	2024-10-24 17:21:07.154172000 +0200
++++ vendor/libc-0.2.155/src/unix/bsd/freebsdlike/freebsd/freebsd11/b32.rs	2024-10-24 17:21:02.029962000 +0200
+@@ -0,0 +1,34 @@
++#[repr(C)]
++#[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))]
++pub struct stat {
++    pub st_dev: ::dev_t,
++    pub st_ino: ::ino_t,
++    pub st_nlink: ::nlink_t,
++    pub st_mode: ::mode_t,
++    st_padding0: i16,
++    pub st_uid: ::uid_t,
++    pub st_gid: ::gid_t,
++    st_padding1: i32,
++    pub st_rdev: ::dev_t,
++    pub st_atime: ::time_t,
++    pub st_atime_nsec: ::c_long,
++    pub st_mtime: ::time_t,
++    pub st_mtime_nsec: ::c_long,
++    pub st_ctime: ::time_t,
++    pub st_ctime_nsec: ::c_long,
++    pub st_birthtime: ::time_t,
++    pub st_birthtime_nsec: ::c_long,
++    pub st_size: ::off_t,
++    pub st_blocks: ::blkcnt_t,
++    pub st_blksize: ::blksize_t,
++    pub st_flags: ::fflags_t,
++    pub st_gen: u64,
++    pub st_spare: [u64; 10],
++}
++
++impl ::Copy for ::stat {}
++impl ::Clone for ::stat {
++    fn clone(&self) -> ::stat {
++        *self
++    }
++}
+
+
+index 80c6fa1684530..5c1156581fd61 100644
+--- vendor/libc-0.2.155/src/unix/bsd/freebsdlike/freebsd/freebsd12/b64.rs
++++ vendor/libc-0.2.155/src/unix/bsd/freebsdlike/freebsd/freebsd11/b32.rs
+@@ -3,12 +3,10 @@
+ pub struct stat {
+     pub st_dev: ::dev_t,
+     pub st_ino: ::ino_t,
+-    pub st_nlink: ::nlink_t,
+     pub st_mode: ::mode_t,
+-    st_padding0: i16,
++    pub st_nlink: ::nlink_t,
+     pub st_uid: ::uid_t,
+     pub st_gid: ::gid_t,
+-    st_padding1: i32,
+     pub st_rdev: ::dev_t,
+     pub st_atime: ::time_t,
+     pub st_atime_nsec: ::c_long,
+@@ -16,14 +14,15 @@ pub struct stat {
+     pub st_mtime_nsec: ::c_long,
+     pub st_ctime: ::time_t,
+     pub st_ctime_nsec: ::c_long,
+-    pub st_birthtime: ::time_t,
+-    pub st_birthtime_nsec: ::c_long,
+     pub st_size: ::off_t,
+     pub st_blocks: ::blkcnt_t,
+     pub st_blksize: ::blksize_t,
+     pub st_flags: ::fflags_t,
+-    pub st_gen: u64,
+-    pub st_spare: [u64; 10],
++    pub st_gen: u32,
++    pub st_lspare: i32,
++    pub st_birthtime: ::time_t,
++    pub st_birthtime_nsec: ::c_long,
++    __unused: [u8; 8],
+ }
+ 
+ impl ::Copy for ::stat {}
+diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs
+index 68a8364194607..e416ebf745841 100644
+--- vendor/libc-0.2.155/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs
++++ vendor/libc-0.2.155/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs
+@@ -479,10 +479,11 @@ extern "C" {
+ }
+ 
+ cfg_if! {
+-    if #[cfg(any(target_arch = "x86_64",
+-                 target_arch = "aarch64",
+-                 target_arch = "riscv64"))] {
*** 2099 LINES SKIPPED ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202412010059.4B10xauF047953>