git: f99a708957bd - main - Mk/Uses/cargo.mk: Remove cross-compilation options for Rust-based ports

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Wed, 23 Oct 2024 03:11:30 UTC
The branch main has been updated by yuri:

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

commit f99a708957bdb6dbd26af0a561d00589337e0c6e
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2024-10-23 03:00:55 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2024-10-23 03:11:24 +0000

    Mk/Uses/cargo.mk: Remove cross-compilation options for Rust-based ports
    
    Reasons:
    * Port build shouldn't use cross-compilation mode
      because it buids for the same architecture.
    * RUSTFLAGS isn't passed to the build of all or some Rust ports
      in the cross-compilation mode.
    
    Essential changes:
    * Remove the CARGO_BUILD_TARGET make variable.
    * Remove CARGO_BUILD_TARGET and CARGO_TARGET_* from CARGO_ENV.
    * Update many ports that used CARGO_BUILD_TARGET.
    * Build paths now don't include the architecture triplet part.
    
    Immadiate benefits:
    * Unbreak build on architectures like i386 that sometimes require
      special RUSTFLAGS that were not effective in the cross-compilation
      mode.
    
    Ports that really need cross-compilation for some reason should
    enable it on case-by-case basis. Example: net-p2p/cncli
    (Not sure why does net-p2p/cncli actually need it, but it only
    builds with these options.)
    
    PR:             280305
    Approved by:    rust@FreeBSD.org (maintainer's timeout; 98 days)
---
 Mk/Uses/cargo.mk                            |  5 -----
 audio/amberol/Makefile                      |  1 -
 audio/gnome-metronome/Makefile              |  1 -
 audio/gnome-podcasts/Makefile               |  1 -
 audio/mousai/Makefile                       |  1 -
 audio/shortwave/Makefile                    |  1 -
 databases/greptimedb/Makefile               |  2 +-
 databases/redisjson/Makefile                |  2 +-
 deskutils/health/Makefile                   |  1 -
 deskutils/rwpspread/Makefile                |  6 +++---
 deskutils/solanum/Makefile                  |  1 -
 devel/evcxr-jupyter/Makefile                |  4 ++--
 devel/jetbrains-restarter/Makefile          |  2 +-
 devel/jujutsu/Makefile                      |  2 +-
 devel/libdatadog/Makefile                   | 11 ++++++-----
 devel/libdatadog/pkg-plist                  |  3 +++
 devel/librashader/Makefile                  |  4 ++--
 devel/libwasmtime/Makefile                  |  4 ++--
 devel/nextest/Makefile                      |  2 +-
 devel/pijul/Makefile                        |  2 +-
 devel/ruff/Makefile                         | 12 +++++-------
 devel/rustc-demangle/Makefile               |  4 ++--
 devel/rye/Makefile                          |  2 +-
 devel/signal-fts5-extension/Makefile        |  2 +-
 devel/spr/Makefile                          |  2 +-
 devel/tabby/Makefile                        |  2 +-
 devel/uv/Makefile                           |  2 +-
 devel/xtensa-esp-elf/Makefile               |  2 +-
 editors/parinfer-rust/Makefile              |  2 +-
 finance/hyperswitch/Makefile                |  2 +-
 games/veloren-weekly/Makefile               |  2 +-
 graphics/librsvg2-rust/Makefile             |  6 ------
 graphics/ocrs/Makefile                      |  2 +-
 graphics/oxipng/Makefile                    |  2 +-
 graphics/resvg-capi/Makefile                |  4 ++--
 japanese/sudachi/Makefile                   |  2 +-
 lang/cairo/Makefile                         |  2 +-
 lang/inko/Makefile                          |  4 ++--
 lang/numbat/Makefile                        |  2 +-
 lang/prql/Makefile                          |  2 +-
 lang/starlark-rust/Makefile                 |  2 +-
 math/fend/Makefile                          |  2 +-
 misc/py-pyqir/Makefile                      |  2 +-
 misc/quary/Makefile                         |  2 +-
 multimedia/helvum/Makefile                  |  1 -
 multimedia/kooha/Makefile                   |  1 -
 multimedia/ringrtc/Makefile                 |  2 +-
 multimedia/video-trimmer/Makefile           |  1 -
 multimedia/wl-screenrec/Makefile            |  2 +-
 net-im/fractal/files/patch-scripts_cargo.sh |  4 ++--
 net-im/libsignal-client/Makefile            |  2 +-
 net-im/zkgroup/Makefile                     |  2 +-
 net-mgmt/gping/Makefile                     |  2 +-
 net-p2p/cncli/Makefile                      |  5 +++++
 net/narrowlink/Makefile                     |  2 +-
 net/ntpd-rs/Makefile                        |  2 +-
 net/quiche/Makefile                         | 10 +++++-----
 net/trippy/Makefile                         |  2 +-
 ports-mgmt/sccache-overlay/Makefile         |  4 ++--
 security/arti/Makefile                      |  2 +-
 security/authenticator/Makefile             |  1 -
 security/pam_rssh/Makefile                  |  2 +-
 security/rage-encryption/Makefile           |  2 +-
 security/rpm-sequoia/Makefile               |  2 +-
 security/solana/Makefile                    |  2 +-
 shells/atuin/Makefile                       |  2 +-
 sysutils/bkt/Makefile                       |  2 +-
 sysutils/fd/Makefile                        |  4 ++--
 sysutils/rust-coreutils/Makefile            | 24 ++++++++++++------------
 sysutils/systeroid/Makefile                 |  2 +-
 textproc/jql/Makefile                       |  2 +-
 textproc/tokay/Makefile                     |  2 +-
 textproc/typst/Makefile                     |  2 +-
 www/deno-dom/Makefile                       |  2 +-
 www/deno/Makefile                           |  2 +-
 www/varnish-libvmod-fileserver/Makefile     |  2 +-
 x11/clipcat/Makefile                        |  2 +-
 x11/rio/Makefile                            |  2 +-
 x11/shotman/Makefile                        |  2 +-
 x11/squeekboard/files/patch-cargo__build.py |  2 +-
 x11/swww/Makefile                           |  2 +-
 x11/xdg-desktop-portal-luminous/Makefile    |  2 +-
 82 files changed, 110 insertions(+), 125 deletions(-)

diff --git a/Mk/Uses/cargo.mk b/Mk/Uses/cargo.mk
index 7949ac473e5d..8a7e2539896f 100644
--- a/Mk/Uses/cargo.mk
+++ b/Mk/Uses/cargo.mk
@@ -110,9 +110,6 @@ RUSTDOC?=	${LOCALBASE}/bin/rustdoc
 # Location of the cargo output directory.
 CARGO_TARGET_DIR?=	${WRKDIR}/target
 
-# Default target platform (affects some RUSTFLAGS if passed)
-CARGO_BUILD_TARGET?=	${_CARGO_RUST_ARCH_${ARCH}:U${ARCH}}-unknown-${OPSYS:tl}
-
 _CARGO_RUST_ARCH_amd64=		x86_64
 _CARGO_RUST_ARCH_i386=		i686
 _CARGO_RUST_ARCH_riscv64=	riscv64gc
@@ -128,9 +125,7 @@ _CARGO_RUST_ARCH_riscv64=	riscv64gc
 CARGO_ENV+= \
 	CARGO_HOME=${WRKDIR}/cargo-home \
 	CARGO_BUILD_JOBS=${MAKE_JOBS_NUMBER} \
-	CARGO_BUILD_TARGET=${CARGO_BUILD_TARGET} \
 	CARGO_TARGET_DIR=${CARGO_TARGET_DIR} \
-	CARGO_TARGET_${CARGO_BUILD_TARGET:S/-/_/g:tu}_LINKER="${CC}" \
 	RUSTC=${RUSTC} \
 	RUSTDOC=${RUSTDOC} \
 	RUSTFLAGS="${RUSTFLAGS} ${LDFLAGS:C/.+/-C link-arg=&/}"
diff --git a/audio/amberol/Makefile b/audio/amberol/Makefile
index 3fe419372425..fdd7b4676151 100644
--- a/audio/amberol/Makefile
+++ b/audio/amberol/Makefile
@@ -32,7 +32,6 @@ post-patch:
 # Make each cargo subcommand very verbose
 # Add explicit <triple> subdir for --target from USES=cargo
 	@${REINPLACE_CMD} -e "/cargo_options =/s/ '--/&verbose', &verbose', &/" \
-		-e "/cp/s,'src',& / '${CARGO_BUILD_TARGET}'," \
 		${WRKSRC}/src/meson.build
 
 .include <bsd.port.mk>
diff --git a/audio/gnome-metronome/Makefile b/audio/gnome-metronome/Makefile
index e9eee6322dd2..422f02e387d5 100644
--- a/audio/gnome-metronome/Makefile
+++ b/audio/gnome-metronome/Makefile
@@ -31,7 +31,6 @@ post-patch:
 # Make each cargo subcommand very verbose
 # Add explicit <triple> subdir for --target from USES=cargo
 	@${REINPLACE_CMD} -e "/cargo_options =/s/ '--/&verbose', &verbose', &/" \
-		-e "/cp/s,'src',& / '${CARGO_BUILD_TARGET}'," \
 		${WRKSRC}/src/meson.build
 
 .include <bsd.port.mk>
diff --git a/audio/gnome-podcasts/Makefile b/audio/gnome-podcasts/Makefile
index a9520c1b7cc0..64bdbe99b673 100644
--- a/audio/gnome-podcasts/Makefile
+++ b/audio/gnome-podcasts/Makefile
@@ -39,7 +39,6 @@ post-patch:
 # Make each cargo subcommand very verbose
 # Add explicit <triple> subdir for --target from USES=cargo
 	@${REINPLACE_CMD} -e "/cargo_options =/s/ '--/&verbose', &verbose', &/" \
-		-e "/cp/s,'${PORTNAME}-gtk' / 'src',& / '${CARGO_BUILD_TARGET}'," \
 		${WRKSRC}/${PORTNAME}-gtk/src/meson.build
 
 .include <bsd.port.mk>
diff --git a/audio/mousai/Makefile b/audio/mousai/Makefile
index f1e799bb3560..5701aa06da7b 100644
--- a/audio/mousai/Makefile
+++ b/audio/mousai/Makefile
@@ -33,7 +33,6 @@ post-patch:
 # Make each cargo subcommand very verbose
 # Add explicit <triple> subdir for --target from USES=cargo
 	@${REINPLACE_CMD} -e "/cargo_options =/s/ '--/&verbose', &verbose', &/" \
-		-e "/cp/s,'src',& / '${CARGO_BUILD_TARGET}'," \
 		${WRKSRC}/src/meson.build
 
 .include <bsd.port.mk>
diff --git a/audio/shortwave/Makefile b/audio/shortwave/Makefile
index b358b2c850df..124c80609834 100644
--- a/audio/shortwave/Makefile
+++ b/audio/shortwave/Makefile
@@ -41,7 +41,6 @@ post-patch:
 # Make each cargo subcommand very verbose
 # Add explicit <triple> subdir for --target from USES=cargo
 	@${REINPLACE_CMD} -e "/cargo_options =/s/ '--/&verbose', &verbose', &/" \
-		-e "/cp/s,'target',& / '${CARGO_BUILD_TARGET}'," \
 		${WRKSRC}/src/meson.build
 
 .include <bsd.port.mk>
diff --git a/databases/greptimedb/Makefile b/databases/greptimedb/Makefile
index 86c6471722e9..c394692555d7 100644
--- a/databases/greptimedb/Makefile
+++ b/databases/greptimedb/Makefile
@@ -983,7 +983,7 @@ do-install:
 	# binaries (workaround for error: found a virtual manifest at `xx` instead of a package manifest)
 .for p in ${PROGS}
 	${INSTALL_PROGRAM} \
-		${WRKDIR}/target/*/release/${p} \
+		${WRKDIR}/target/release/${p} \
 		${STAGEDIR}${PREFIX}/bin
 .endfor
 	# config files
diff --git a/databases/redisjson/Makefile b/databases/redisjson/Makefile
index 5a027372b244..09133cc0d686 100644
--- a/databases/redisjson/Makefile
+++ b/databases/redisjson/Makefile
@@ -115,6 +115,6 @@ CARGO_CRATES=	addr2line-0.17.0 \
 PLIST_FILES=	lib/librejson.so
 
 do-install:
-	${INSTALL_LIB} ${CARGO_TARGET_DIR}/${CARGO_BUILD_TARGET}/*/librejson.so ${STAGEDIR}${PREFIX}/lib
+	${INSTALL_LIB} ${CARGO_TARGET_DIR}/*/librejson.so ${STAGEDIR}${PREFIX}/lib
 
 .include <bsd.port.mk>
diff --git a/deskutils/health/Makefile b/deskutils/health/Makefile
index d9aaf91eb5b0..d601b18b7288 100644
--- a/deskutils/health/Makefile
+++ b/deskutils/health/Makefile
@@ -37,7 +37,6 @@ post-patch:
 # Make each cargo subcommand very verbose
 # Add explicit <triple> subdir for --target from USES=cargo
 	@${REINPLACE_CMD} -e "/cargo_options =/s/ '--/&verbose', &verbose', &/" \
-		-e "/cp/s,'src',& / '${CARGO_BUILD_TARGET}'," \
 		${WRKSRC}/src/meson.build
 
 .include <bsd.port.mk>
diff --git a/deskutils/rwpspread/Makefile b/deskutils/rwpspread/Makefile
index f9a9a5e70e8b..240d293cd8ce 100644
--- a/deskutils/rwpspread/Makefile
+++ b/deskutils/rwpspread/Makefile
@@ -200,8 +200,8 @@ post-install:
 		${STAGEDIR}${PREFIX}/share/bash-completion/completions \
 		${STAGEDIR}${PREFIX}/share/fish/vendor_completions.d \
 		${STAGEDIR}${PREFIX}/share/zsh/site-functions
-	${INSTALL_DATA} ${WRKDIR}/target/*-freebsd/release/completions/${PORTNAME}.bash ${STAGEDIR}${PREFIX}/share/bash-completion/completions/${PORTNAME}
-	${INSTALL_DATA} ${WRKDIR}/target/*-freebsd/release/completions/${PORTNAME}.fish ${STAGEDIR}${PREFIX}/share/fish/vendor_completions.d
-	${INSTALL_DATA} ${WRKDIR}/target/*-freebsd/release/completions/_${PORTNAME} ${STAGEDIR}${PREFIX}/share/zsh/site-functions
+	${INSTALL_DATA} ${WRKDIR}/target/release/completions/${PORTNAME}.bash ${STAGEDIR}${PREFIX}/share/bash-completion/completions/${PORTNAME}
+	${INSTALL_DATA} ${WRKDIR}/target/release/completions/${PORTNAME}.fish ${STAGEDIR}${PREFIX}/share/fish/vendor_completions.d
+	${INSTALL_DATA} ${WRKDIR}/target/release/completions/_${PORTNAME} ${STAGEDIR}${PREFIX}/share/zsh/site-functions
 
 .include <bsd.port.mk>
diff --git a/deskutils/solanum/Makefile b/deskutils/solanum/Makefile
index d03889d1aa8e..fc46e6b5fedc 100644
--- a/deskutils/solanum/Makefile
+++ b/deskutils/solanum/Makefile
@@ -31,7 +31,6 @@ post-patch:
 # Make each cargo subcommand very verbose
 # Add explicit <triple> subdir for --target from USES=cargo
 	@${REINPLACE_CMD} -e "/cargo_options =/s/ '--/&verbose', &verbose', &/" \
-		-e "/cp/s,'src',& / '${CARGO_BUILD_TARGET}'," \
 		${WRKSRC}/src/meson.build
 
 .include <bsd.port.mk>
diff --git a/devel/evcxr-jupyter/Makefile b/devel/evcxr-jupyter/Makefile
index 23a50f682978..9d634fd9afb7 100644
--- a/devel/evcxr-jupyter/Makefile
+++ b/devel/evcxr-jupyter/Makefile
@@ -311,7 +311,7 @@ LDFLAGS+=	-L/usr/local/lib/gcc${GCC_DEFAULT} -latomic
 .endif
 
 do-install:
-	${INSTALL_PROGRAM} ${WRKDIR}/target/*-unknown-freebsd/release/evcxr ${STAGEDIR}${PREFIX}/bin
-	${INSTALL_PROGRAM} ${WRKDIR}/target/*-unknown-freebsd/release/evcxr_jupyter ${STAGEDIR}${PREFIX}/bin
+	${INSTALL_PROGRAM} ${WRKDIR}/target/release/evcxr ${STAGEDIR}${PREFIX}/bin
+	${INSTALL_PROGRAM} ${WRKDIR}/target/release/evcxr_jupyter ${STAGEDIR}${PREFIX}/bin
 
 .include <bsd.port.mk>
diff --git a/devel/jetbrains-restarter/Makefile b/devel/jetbrains-restarter/Makefile
index d08140176986..9f1e7b89f961 100644
--- a/devel/jetbrains-restarter/Makefile
+++ b/devel/jetbrains-restarter/Makefile
@@ -27,7 +27,7 @@ PLIST_FILES=	share/jetbrains/${PORTNAME}/restarter
 do-install:
 	${MKDIR} ${STAGEDIR}${DATADIR}
 	${INSTALL_PROGRAM} \
-		${CARGO_TARGET_DIR}/${CARGO_BUILD_TARGET}/*/restarter \
+		${CARGO_TARGET_DIR}/*/restarter \
 		${STAGEDIR}${DATADIR}
 
 post-install:
diff --git a/devel/jujutsu/Makefile b/devel/jujutsu/Makefile
index 7b70d2a1f621..b49c2f5d28c5 100644
--- a/devel/jujutsu/Makefile
+++ b/devel/jujutsu/Makefile
@@ -23,7 +23,7 @@ GH_PROJECT=	jj
 PLIST_FILES=	bin/jj
 
 do-install:
-		${INSTALL_PROGRAM} ${WRKDIR}/target/*-unknown-freebsd/release/jj \
+		${INSTALL_PROGRAM} ${WRKDIR}/target/release/jj \
 			${STAGEDIR}${PREFIX}/bin/
 
 .include <bsd.port.mk>
diff --git a/devel/libdatadog/Makefile b/devel/libdatadog/Makefile
index 1bce186a20ab..eccec0606a48 100644
--- a/devel/libdatadog/Makefile
+++ b/devel/libdatadog/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	libdatadog
 PORTVERSION=	12.0.0
+PORTREVISION=	1
 DISTVERSIONPREFIX=	v
 CATEGORIES=	devel
 
@@ -31,15 +32,15 @@ post-patch:
 	@${SED} -i '' -e '/get_cpu/ s|unsigned long|uint64_t|; /get_proc_total/ s|unsigned long|uint64_t|' ${WRKSRC}/cargo-crates/sys-info-0.9.1/c/*.[ch]
 
 post-build:
-	@${CARGO_TARGET_DIR}/${CARGO_BUILD_TARGET}/release/dedup_headers \
+	@${CARGO_TARGET_DIR}/release/dedup_headers \
 		${CARGO_TARGET_DIR}/include/datadog/common.h \
 		${CARGO_TARGET_DIR}/include/datadog/crashtracker.h \
 		${CARGO_TARGET_DIR}/include/datadog/profiling.h \
 		${CARGO_TARGET_DIR}/include/datadog/telemetry.h \
 		${CARGO_TARGET_DIR}/include/datadog/data-pipeline.h
-	@${CC} -I ${CARGO_TARGET_DIR}/include/ -L ${CARGO_TARGET_DIR}/${CARGO_BUILD_TARGET}/release/ -ldatadog_profiling_ffi \
+	@${CC} -I ${CARGO_TARGET_DIR}/include/ -L ${CARGO_TARGET_DIR}/release/ -ldatadog_profiling_ffi \
 		${WRKSRC}/crashtracker/libdatadog-crashtracking-receiver.c -o ${WRKSRC}/libdatadog-crashtracking-receiver
-	@${MV} ${CARGO_TARGET_DIR}/${CARGO_BUILD_TARGET}/release/libtest_spawn_from_lib.so ${CARGO_TARGET_DIR}/${CARGO_BUILD_TARGET}/release/libtest_spawn_from_lib.so.skip
+	@${MV} ${CARGO_TARGET_DIR}/release/libtest_spawn_from_lib.so ${CARGO_TARGET_DIR}/release/libtest_spawn_from_lib.so.skip
 
 do-install:
 	${MKDIR} ${STAGEDIR}${PREFIX}/include/datadog/
@@ -48,8 +49,8 @@ do-install:
 	${INSTALL_PROGRAM} ${WRKSRC}/libdatadog-crashtracking-receiver ${STAGEDIR}${PREFIX}/bin/
 	${INSTALL_DATA} ${CARGO_TARGET_DIR}/include/datadog/*.h ${STAGEDIR}${PREFIX}/include/datadog/
 	${INSTALL_DATA} ${WRKSRC}/*.cmake ${STAGEDIR}${PREFIX}/lib/cmake/libdatadog/
-	${INSTALL_DATA} ${CARGO_TARGET_DIR}/${CARGO_BUILD_TARGET}/release/*.a ${STAGEDIR}${PREFIX}/lib/
-	${INSTALL_LIB} ${CARGO_TARGET_DIR}/${CARGO_BUILD_TARGET}/release/*.so ${STAGEDIR}${PREFIX}/lib/
+	${INSTALL_DATA} ${CARGO_TARGET_DIR}/release/*.a ${STAGEDIR}${PREFIX}/lib/
+	${INSTALL_LIB} ${CARGO_TARGET_DIR}/release/*.so ${STAGEDIR}${PREFIX}/lib/
 	${INSTALL_DATA} ${WRKSRC}/datadog_profiling*.pc ${STAGEDIR}${PREFIX}/libdata/pkgconfig/
 
 .include <bsd.port.mk>
diff --git a/devel/libdatadog/pkg-plist b/devel/libdatadog/pkg-plist
index 6892c609bc7b..fa2f7347bfb8 100644
--- a/devel/libdatadog/pkg-plist
+++ b/devel/libdatadog/pkg-plist
@@ -9,12 +9,15 @@ lib/cmake/libdatadog/DataPipelineConfig.cmake
 lib/cmake/libdatadog/DatadogConfig.cmake
 lib/libdata_pipeline_ffi.a
 lib/libdata_pipeline_ffi.so
+lib/libdatadog_ipc_macros.so
 lib/libdatadog_profiling_ffi.a
 lib/libdatadog_profiling_ffi.so
 lib/libdatadog_sidecar_ffi.a
 lib/libdatadog_sidecar_ffi.so
+lib/libdatadog_sidecar_macros.so
 lib/libddtelemetry_ffi.a
 lib/libddtelemetry_ffi.so
+lib/libtarpc_plugins.so
 libdata/pkgconfig/datadog_profiling-static.pc
 libdata/pkgconfig/datadog_profiling.pc
 libdata/pkgconfig/datadog_profiling_with_rpath.pc
diff --git a/devel/librashader/Makefile b/devel/librashader/Makefile
index 33bb81afe2e5..0b4df79c3170 100644
--- a/devel/librashader/Makefile
+++ b/devel/librashader/Makefile
@@ -34,7 +34,7 @@ DEBUG_VARS_OFF=	_PROFILE=release
 # grep '#define LIBRASHADER_CURRENT_ABI' ${WRKSRC}/include/librashader.h | cut -d' ' -f3
 _ABI=		1
 
-_OUT=		${CARGO_TARGET_DIR}/${CARGO_BUILD_TARGET}/${_PROFILE}
+_OUT=		${CARGO_TARGET_DIR}/${_PROFILE}
 
 post-patch:
 	${REINPLACE_CMD} 's|/usr/local|${PREFIX}|g' \
@@ -42,7 +42,7 @@ post-patch:
 
 do-build:
 	${CARGO_CARGO_RUN} run -p librashader-build-script -- --profile \
-		${_PROFILE} --target ${CARGO_BUILD_TARGET} --stable
+		${_PROFILE} --stable
 	patchelf --set-soname librashader.so.${_ABI} ${_OUT}/librashader.so
 
 do-install:
diff --git a/devel/libwasmtime/Makefile b/devel/libwasmtime/Makefile
index 8e4d7b4e1963..9ee399b7d27e 100644
--- a/devel/libwasmtime/Makefile
+++ b/devel/libwasmtime/Makefile
@@ -447,7 +447,7 @@ do-install:
 	${INSTALL_DATA} ${WRKSRC}/crates/c-api/include/wasm.h ${STAGEDIR}${PREFIX}/include
 	(cd ${WRKSRC}/crates/c-api/include && ${COPYTREE_SHARE} . ${STAGEDIR}${PREFIX}/include)
 	${RM} ${STAGEDIR}${PREFIX}/include/wasmtime/conf.h.in
-	${INSTALL_LIB} ${WRKDIR}/target/*-unknown-freebsd/release/libwasmtime.a ${STAGEDIR}${PREFIX}/lib
-	${INSTALL_LIB} ${WRKDIR}/target/*-unknown-freebsd/release/libwasmtime.so ${STAGEDIR}${PREFIX}/lib
+	${INSTALL_LIB} ${WRKDIR}/target/release/libwasmtime.a ${STAGEDIR}${PREFIX}/lib
+	${INSTALL_LIB} ${WRKDIR}/target/release/libwasmtime.so ${STAGEDIR}${PREFIX}/lib
 
 .include <bsd.port.mk>
diff --git a/devel/nextest/Makefile b/devel/nextest/Makefile
index a6575055b3e4..43f29311c183 100644
--- a/devel/nextest/Makefile
+++ b/devel/nextest/Makefile
@@ -416,7 +416,7 @@ do-install:
 	# workaround for error: found a virtual manifest at `xx` instead of a package manifest
 .for p in ${PROGS}
 	${INSTALL_PROGRAM} \
-		${WRKDIR}/target/*/release/${p} \
+		${WRKDIR}/target/release/${p} \
 		${STAGEDIR}${PREFIX}/bin
 .endfor
 
diff --git a/devel/pijul/Makefile b/devel/pijul/Makefile
index 59597b441a6d..4fe13bf7ad37 100644
--- a/devel/pijul/Makefile
+++ b/devel/pijul/Makefile
@@ -448,6 +448,6 @@ post-patch:
 	${MV} ${WRKSRC}/cargo-crates/pijul-1.0.0-beta.9/* ${WRKSRC}/
 
 do-install:
-	${INSTALL_SCRIPT} ${CARGO_TARGET_DIR}/${CARGO_BUILD_TARGET}/*/pijul ${STAGEDIR}${PREFIX}/bin/pijul
+	${INSTALL_SCRIPT} ${CARGO_TARGET_DIR}/*/pijul ${STAGEDIR}${PREFIX}/bin/pijul
 
 .include <bsd.port.mk>
diff --git a/devel/ruff/Makefile b/devel/ruff/Makefile
index 2452600fdb3a..6a59a10f5c8c 100644
--- a/devel/ruff/Makefile
+++ b/devel/ruff/Makefile
@@ -9,8 +9,6 @@ WWW=		https://github.com/charliermarsh/ruff
 LICENSE=	MIT
 LICENSE_FILE=	${WRKSRC}/LICENSE
 
-BROKEN_i386=	compilation fails: evaluation of constant value failed, see https://github.com/briansmith/ring/issues/2006
-
 BUILD_DEPENDS=	gmake:devel/gmake
 LIB_DEPENDS=	libzstd.so:archivers/zstd
 
@@ -38,17 +36,17 @@ do-install:
 	# workaround for error: found a virtual manifest at `xx` instead of a package manifest
 .for p in ${PROGS}
 	${INSTALL_PROGRAM} \
-		${WRKDIR}/target/*/release/${p} \
+		${WRKDIR}/target/release/${p} \
 		${STAGEDIR}${PREFIX}/bin
 .endfor
 	# generate shell completions
 	${MKDIR} ${STAGEDIR}${PREFIX}/share/bash-completion/completions
-	${WRKDIR}/target/*/release/${PORTNAME} generate-shell-completion bash > ${STAGEDIR}${PREFIX}/share/bash-completion/completions/${PORTNAME}
+	${WRKDIR}/target/release/${PORTNAME} generate-shell-completion bash > ${STAGEDIR}${PREFIX}/share/bash-completion/completions/${PORTNAME}
 	${MKDIR} ${STAGEDIR}${PREFIX}/share/elvish/lib
-	${WRKDIR}/target/*/release/${PORTNAME} generate-shell-completion elvish > ${STAGEDIR}${PREFIX}/share/elvish/lib/${PORTNAME}.elv
+	${WRKDIR}/target/release/${PORTNAME} generate-shell-completion elvish > ${STAGEDIR}${PREFIX}/share/elvish/lib/${PORTNAME}.elv
 	${MKDIR} ${STAGEDIR}${PREFIX}/share/fish/vendor_completions.d
-	${WRKDIR}/target/*/release/${PORTNAME} generate-shell-completion fish > ${STAGEDIR}${PREFIX}/share/fish/vendor_completions.d/${PORTNAME}.fish
+	${WRKDIR}/target/release/${PORTNAME} generate-shell-completion fish > ${STAGEDIR}${PREFIX}/share/fish/vendor_completions.d/${PORTNAME}.fish
 	${MKDIR} ${STAGEDIR}${PREFIX}/share/zsh/site-functions
-	${WRKDIR}/target/*/release/${PORTNAME} generate-shell-completion zsh > ${STAGEDIR}${PREFIX}/share/zsh/site-functions/_${PORTNAME}
+	${WRKDIR}/target/release/${PORTNAME} generate-shell-completion zsh > ${STAGEDIR}${PREFIX}/share/zsh/site-functions/_${PORTNAME}
 
 .include <bsd.port.mk>
diff --git a/devel/rustc-demangle/Makefile b/devel/rustc-demangle/Makefile
index d1754152210f..10fed8b0a33f 100644
--- a/devel/rustc-demangle/Makefile
+++ b/devel/rustc-demangle/Makefile
@@ -35,7 +35,7 @@ PLIST_FILES=	include/rustc_demangle.h \
 
 do-install:
 	${INSTALL_DATA} ${WRKSRC}/../../crates/capi/include/rustc_demangle.h ${STAGEDIR}${PREFIX}/include
-	${INSTALL_DATA} ${WRKDIR}/target/*-freebsd/release/librustc_demangle.a ${STAGEDIR}${PREFIX}/lib
-	${INSTALL_LIB} ${WRKDIR}/target/*-freebsd/release/librustc_demangle.so ${STAGEDIR}${PREFIX}/lib
+	${INSTALL_DATA} ${WRKDIR}/target/release/librustc_demangle.a ${STAGEDIR}${PREFIX}/lib
+	${INSTALL_LIB} ${WRKDIR}/target/release/librustc_demangle.so ${STAGEDIR}${PREFIX}/lib
 
 .include <bsd.port.mk>
diff --git a/devel/rye/Makefile b/devel/rye/Makefile
index 99618ca7c1e6..ed7a799e6772 100644
--- a/devel/rye/Makefile
+++ b/devel/rye/Makefile
@@ -328,7 +328,7 @@ PLIST_FILES=	bin/${PORTNAME}
 do-install:
 	# binaries (workaround for error: found a virtual manifest at `xx` instead of a package manifest)
 	${INSTALL_PROGRAM} \
-		${WRKDIR}/target/*/release/${PORTNAME} \
+		${WRKDIR}/target/release/${PORTNAME} \
 		${STAGEDIR}${PREFIX}/bin
 
 .include <bsd.port.mk>
diff --git a/devel/signal-fts5-extension/Makefile b/devel/signal-fts5-extension/Makefile
index e143c3bb8b08..739bb83817a4 100644
--- a/devel/signal-fts5-extension/Makefile
+++ b/devel/signal-fts5-extension/Makefile
@@ -89,6 +89,6 @@ CARGO_CRATES=	atty-0.2.14 \
 PLIST_FILES=	lib/libsignal_tokenizer.a
 
 do-install:
-	${INSTALL_DATA} ${CARGO_TARGET_DIR}/${CARGO_BUILD_TARGET}/*/libsignal_tokenizer.a ${STAGEDIR}${LOCALBASE}/lib/
+	${INSTALL_DATA} ${CARGO_TARGET_DIR}/*/libsignal_tokenizer.a ${STAGEDIR}${LOCALBASE}/lib/
 
 .include <bsd.port.mk>
diff --git a/devel/spr/Makefile b/devel/spr/Makefile
index b16ad96c9d9d..29545106e36b 100644
--- a/devel/spr/Makefile
+++ b/devel/spr/Makefile
@@ -259,7 +259,7 @@ PLIST_FILES=	bin/${PORTNAME}
 do-install:
 	# workaround for error: found a virtual manifest at `xx` instead of a package manifest
 	${INSTALL_PROGRAM} \
-		${WRKDIR}/target/*/release/${PORTNAME} \
+		${WRKDIR}/target/release/${PORTNAME} \
 		${STAGEDIR}${PREFIX}/bin/${PORTNAME}
 
 .include <bsd.port.mk>
diff --git a/devel/tabby/Makefile b/devel/tabby/Makefile
index e18e034717a4..6c6711a91727 100644
--- a/devel/tabby/Makefile
+++ b/devel/tabby/Makefile
@@ -640,7 +640,7 @@ PLIST_FILES=	bin/${PORTNAME}
 do-install:
 	# binaries (workaround for error: found a virtual manifest at `xx` instead of a package manifest)
 	${INSTALL_PROGRAM} \
-		${WRKDIR}/target/*/release/${PORTNAME} \
+		${WRKDIR}/target/release/${PORTNAME} \
 		${STAGEDIR}${PREFIX}/bin
 
 .include <bsd.port.mk>
diff --git a/devel/uv/Makefile b/devel/uv/Makefile
index 1f6bf5808196..c3080a694167 100644
--- a/devel/uv/Makefile
+++ b/devel/uv/Makefile
@@ -37,7 +37,7 @@ do-install:
 # workaround for error: found a virtual manifest at `xx` instead of a package manifest
 .for p in ${PROGS}
 	${INSTALL_PROGRAM} \
-		${WRKDIR}/target/*/release/${p} \
+		${WRKDIR}/target/release/${p} \
 		${STAGEDIR}${PREFIX}/bin
 .endfor
 
diff --git a/devel/xtensa-esp-elf/Makefile b/devel/xtensa-esp-elf/Makefile
index a34b7a88edaa..81a3e5ecdca0 100644
--- a/devel/xtensa-esp-elf/Makefile
+++ b/devel/xtensa-esp-elf/Makefile
@@ -163,7 +163,7 @@ do-install:
 	    ${XARGS} ${CHMOD} +x
 
 	# xtensa-toolchian-wrapper
-	${INSTALL_PROGRAM} ${WRKSRC2}/target/*-unknown-freebsd/release/xtensa-toolchian-wrapper \
+	${INSTALL_PROGRAM} ${WRKSRC2}/target/release/xtensa-toolchian-wrapper \
 	    ${STAGEDIR}${PREFIX}/${PKGBASE}/bin
 .for chip in ${XTENSA_CHIPS}
 .for wrap in ${XTENSA_WRAPPED}
diff --git a/editors/parinfer-rust/Makefile b/editors/parinfer-rust/Makefile
index de7b70a7ccbc..7104c23883ef 100644
--- a/editors/parinfer-rust/Makefile
+++ b/editors/parinfer-rust/Makefile
@@ -108,7 +108,7 @@ PLIST_FILES=	bin/parinfer-rust \
 		share/vim/vimfiles/plugin/parinfer.vim
 
 post-install:
-	${INSTALL_LIB} ${CARGO_TARGET_DIR}/${CARGO_BUILD_TARGET}/*/libparinfer_rust.so \
+	${INSTALL_LIB} ${CARGO_TARGET_DIR}/*/libparinfer_rust.so \
 		${STAGEDIR}${PREFIX}/lib
 	@${MKDIR} ${STAGEDIR}${PREFIX}/share/kak/rc/extra \
 		${STAGEDIR}${PREFIX}/share/vim/vimfiles/doc \
diff --git a/finance/hyperswitch/Makefile b/finance/hyperswitch/Makefile
index 861b8069c006..71cb5a52eaed 100644
--- a/finance/hyperswitch/Makefile
+++ b/finance/hyperswitch/Makefile
@@ -747,7 +747,7 @@ do-install:
 	# binaries (workaround for error: found a virtual manifest at `xx` instead of a package manifest)
 .for p in ${PROGS}
 	${INSTALL_PROGRAM} \
-		${WRKDIR}/target/*/release/${p} \
+		${WRKDIR}/target/release/${p} \
 		${STAGEDIR}${PREFIX}/bin
 .endfor
 
diff --git a/games/veloren-weekly/Makefile b/games/veloren-weekly/Makefile
index 901fd85302ef..e815d028a832 100644
--- a/games/veloren-weekly/Makefile
+++ b/games/veloren-weekly/Makefile
@@ -65,7 +65,7 @@ post-patch:
 do-install:
 # XXX [workspace.dependencies] breaks rebuild in subdirs
 .for f in ${CARGO_INSTALL_PATH}
-	${INSTALL_PROGRAM} ${CARGO_TARGET_DIR}/*/*/${PORTNAME}-$f \
+	${INSTALL_PROGRAM} ${CARGO_TARGET_DIR}/*/${PORTNAME}-$f \
 		${STAGEDIR}${PREFIX}/bin
 .endfor
 
diff --git a/graphics/librsvg2-rust/Makefile b/graphics/librsvg2-rust/Makefile
index 7ff301caf4fb..2a17f9ce74e9 100644
--- a/graphics/librsvg2-rust/Makefile
+++ b/graphics/librsvg2-rust/Makefile
@@ -32,7 +32,6 @@ CONFIGURE_ARGS=	--disable-Bsymbolic \
 		--enable-vala
 CONFIGURE_ENV=	${CARGO_ENV}
 MAKE_ENV=	${CARGO_ENV}
-CARGO_ENV=	RUST_TARGET=${CARGO_BUILD_TARGET}
 CARGO_BUILD=	no
 CARGO_INSTALL=	no
 CARGO_TEST=	no
@@ -48,9 +47,4 @@ DOCS_CONFIGURE_ENABLE=	gtk-doc
 
 TESTING_UNSAFE=	ld: error: undefined symbol: pthread_condattr_init
 
-post-patch:
-# Add explicit <triple> subdir for --target from USES=cargo
-	@${REINPLACE_CMD} 's/test "x$$cross_compiling" = "xyes"/true/' \
-		${WRKSRC}/configure
-
 .include <bsd.port.mk>
diff --git a/graphics/ocrs/Makefile b/graphics/ocrs/Makefile
index a34be844d27d..e082d7720ca3 100644
--- a/graphics/ocrs/Makefile
+++ b/graphics/ocrs/Makefile
@@ -126,7 +126,7 @@ PLIST_FILES=	bin/${PORTNAME}
 do-install:
 	# binaries (workaround for error: found a virtual manifest at `xx` instead of a package manifest)
 	${INSTALL_PROGRAM} \
-		${WRKDIR}/target/*/release/${PORTNAME} \
+		${WRKDIR}/target/release/${PORTNAME} \
 		${STAGEDIR}${PREFIX}/bin
 
 .include <bsd.port.mk>
diff --git a/graphics/oxipng/Makefile b/graphics/oxipng/Makefile
index b3dca333003a..a04f43028263 100644
--- a/graphics/oxipng/Makefile
+++ b/graphics/oxipng/Makefile
@@ -18,7 +18,7 @@ PLIST_FILES=	bin/${PORTNAME} \
 		share/man/man1/${PORTNAME}.1.gz
 
 post-install:
-	${INSTALL_MAN} ${CARGO_TARGET_DIR}/${CARGO_BUILD_TARGET}/*/assets/*.1 \
+	${INSTALL_MAN} ${CARGO_TARGET_DIR}/*/assets/*.1 \
 		${STAGEDIR}${PREFIX}/share/man/man1
 
 .include <bsd.port.mk>
diff --git a/graphics/resvg-capi/Makefile b/graphics/resvg-capi/Makefile
index b9b9b639c7b4..3a261bbb5373 100644
--- a/graphics/resvg-capi/Makefile
+++ b/graphics/resvg-capi/Makefile
@@ -86,7 +86,7 @@ do-install:
 	${INSTALL_DATA} ${WRKSRC}/resvg.h ${STAGEDIR}${PREFIX}/include
 	${INSTALL_DATA} ${WRKSRC}/ResvgQt.h ${STAGEDIR}${PREFIX}/include
 	cd ${WRKDIR}/target && \
-		${INSTALL_LIB} */release/libresvg.so ${STAGEDIR}${PREFIX}/lib && \
-		${INSTALL_DATA} */release/libresvg.a ${STAGEDIR}${PREFIX}/lib
+		${INSTALL_LIB} release/libresvg.so ${STAGEDIR}${PREFIX}/lib && \
+		${INSTALL_DATA} release/libresvg.a ${STAGEDIR}${PREFIX}/lib
 
 .include <bsd.port.mk>
diff --git a/japanese/sudachi/Makefile b/japanese/sudachi/Makefile
index 9c404b3e656d..8f0a87ef3809 100644
--- a/japanese/sudachi/Makefile
+++ b/japanese/sudachi/Makefile
@@ -175,7 +175,7 @@ post-patch:
 do-install:
 	# install binaries (workaround for error: found a virtual manifest at `xx` instead of a package manifest)
 	${INSTALL_PROGRAM} \
-		${WRKDIR}/target/*/release/${PORTNAME} \
+		${WRKDIR}/target/release/${PORTNAME} \
 		${STAGEDIR}${PREFIX}/bin
 	# install the resources directory
 	@cd ${WRKSRC} && \
diff --git a/lang/cairo/Makefile b/lang/cairo/Makefile
index 0fa63e821b3d..7235110f8d42 100644
--- a/lang/cairo/Makefile
+++ b/lang/cairo/Makefile
@@ -447,7 +447,7 @@ PLIST_FILES=	bin/cairo-compile bin/cairo-format bin/cairo-language-server bin/ca
 do-install: # workaround for error: found a virtual manifest at `/usr/ports/lang/cairo/work/cairo-2.0.1/Cargo.toml` instead of a package manifest
 	# executables
 .for e in ${PLIST_FILES:S/bin\///}
-	${INSTALL_PROGRAM} ${WRKDIR}/target/*-freebsd/release/${e} ${STAGEDIR}${PREFIX}/bin
+	${INSTALL_PROGRAM} ${WRKDIR}/target/release/${e} ${STAGEDIR}${PREFIX}/bin
 .endfor
 	# corelib
 	${MKDIR} ${STAGEDIR}${PREFIX}/lib/cairo-lang
diff --git a/lang/inko/Makefile b/lang/inko/Makefile
index 6ed3ae2c1627..34117646ecbb 100644
--- a/lang/inko/Makefile
+++ b/lang/inko/Makefile
@@ -127,10 +127,10 @@ CARGO_CRATES=	addr2line-0.21.0 \
 
 do-install:
 	# executable
-	${INSTALL_PROGRAM} ${WRKDIR}/target/*-freebsd/release/inko ${STAGEDIR}${PREFIX}/bin/${PORTNAME}
+	${INSTALL_PROGRAM} ${WRKDIR}/target/release/inko ${STAGEDIR}${PREFIX}/bin/${PORTNAME}
 	# runtime library
 	${MKDIR} ${STAGEDIR}${PREFIX}/lib/inko/runtime
-	${INSTALL_DATA} ${WRKDIR}/target/*-freebsd/release/libinko.a ${STAGEDIR}${PREFIX}/lib/inko/runtime
+	${INSTALL_DATA} ${WRKDIR}/target/release/libinko.a ${STAGEDIR}${PREFIX}/lib/inko/runtime
 	# standard library
 	cd ${WRKSRC}/std/src && ${COPYTREE_SHARE} std ${STAGEDIR}${PREFIX}/lib/inko
 
diff --git a/lang/numbat/Makefile b/lang/numbat/Makefile
index 9c92420391d5..d9c01483c3b9 100644
--- a/lang/numbat/Makefile
+++ b/lang/numbat/Makefile
@@ -284,7 +284,7 @@ PLIST_FILES=	bin/${PORTNAME}
 do-install:
 	# workaround for error: found a virtual manifest at `xx` instead of a package manifest
 	${INSTALL_PROGRAM} \
-		${WRKDIR}/target/*/release/${PORTNAME} \
+		${WRKDIR}/target/release/${PORTNAME} \
 		${STAGEDIR}${PREFIX}/bin/${PORTNAME}
 
 .include <bsd.port.mk>
diff --git a/lang/prql/Makefile b/lang/prql/Makefile
index fde328db7156..57dcdff35ed6 100644
--- a/lang/prql/Makefile
+++ b/lang/prql/Makefile
@@ -508,7 +508,7 @@ PLIST_FILES=	bin/prqlc
 do-install:
 	# workaround for error: found a virtual manifest at `xx` instead of a package manifest
 	${INSTALL_PROGRAM} \
-		${WRKDIR}/target/*/release/prqlc \
+		${WRKDIR}/target/release/prqlc \
 		${STAGEDIR}${PREFIX}/bin/prqlc
 
 .include <bsd.port.mk>
diff --git a/lang/starlark-rust/Makefile b/lang/starlark-rust/Makefile
index cd1afff2d081..d25d07b8c9a7 100644
--- a/lang/starlark-rust/Makefile
+++ b/lang/starlark-rust/Makefile
@@ -248,7 +248,7 @@ PLIST_FILES=	bin/starlark
 do-install:
 	# binaries (workaround for error: found a virtual manifest at `xx` instead of a package manifest)
 	${INSTALL_PROGRAM} \
-		${WRKDIR}/target/*/release/starlark \
+		${WRKDIR}/target/release/starlark \
 		${STAGEDIR}${PREFIX}/bin
 
 .include <bsd.port.mk>
diff --git a/math/fend/Makefile b/math/fend/Makefile
index b4c2e4a2c83b..5b2697fadaf4 100644
--- a/math/fend/Makefile
+++ b/math/fend/Makefile
@@ -122,7 +122,7 @@ PLIST_FILES=	bin/${PORTNAME}
 do-install:
 	# workaround for error: found a virtual manifest at `xx` instead of a package manifest
 	${INSTALL_PROGRAM} \
-		${WRKDIR}/target/*/release/${PORTNAME} \
+		${WRKDIR}/target/release/${PORTNAME} \
 		${STAGEDIR}${PREFIX}/bin/${PORTNAME}
 
 .include <bsd.port.mk>
diff --git a/misc/py-pyqir/Makefile b/misc/py-pyqir/Makefile
index 74a2a91b348a..a299ad2d5639 100644
--- a/misc/py-pyqir/Makefile
+++ b/misc/py-pyqir/Makefile
@@ -94,7 +94,7 @@ TEST_ENV=	${MAKE_ENV} PYTHONPATH=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
 
 do-install:
 	${MKDIR} ${STAGEDIR}${PYTHON_SITELIBDIR}/${PORTNAME}
-	${INSTALL_LIB} ${WRKDIR}/target/*-unknown-freebsd/release/libpyqir.so ${STAGEDIR}${PYTHON_SITELIBDIR}/${PORTNAME}/_native.abi3.so
+	${INSTALL_LIB} ${WRKDIR}/target/release/libpyqir.so ${STAGEDIR}${PYTHON_SITELIBDIR}/${PORTNAME}/_native.abi3.so
 	${INSTALL_DATA} ${WRKSRC}/pyqir/pyqir/*.py ${STAGEDIR}${PYTHON_SITELIBDIR}/${PORTNAME}
 
 .include <bsd.port.mk>
diff --git a/misc/quary/Makefile b/misc/quary/Makefile
index a116489354a8..ce73f72fb42a 100644
--- a/misc/quary/Makefile
+++ b/misc/quary/Makefile
@@ -534,7 +534,7 @@ LDFLAGS+=	-L/usr/local/lib/gcc${GCC_DEFAULT} -latomic
 
 do-install:
 	${INSTALL_PROGRAM} \
-		${WRKDIR}/target/*/release/${PORTNAME} \
+		${WRKDIR}/target/release/${PORTNAME} \
 		${STAGEDIR}${PREFIX}/bin
 
 .include <bsd.port.mk>
diff --git a/multimedia/helvum/Makefile b/multimedia/helvum/Makefile
index 181ee15f38b8..3f8805395371 100644
--- a/multimedia/helvum/Makefile
+++ b/multimedia/helvum/Makefile
@@ -37,7 +37,6 @@ post-patch:
 # Make each cargo subcommand very verbose
 # Add explicit <triple> subdir for --target from USES=cargo
 	@${REINPLACE_CMD} -e "/cargo_options =/s/ '--/&verbose', &verbose', &/" \
-		-e "/cp/s,'src',& / '${CARGO_BUILD_TARGET}'," \
 		${WRKSRC}/src/meson.build
 
 .include <bsd.port.mk>
diff --git a/multimedia/kooha/Makefile b/multimedia/kooha/Makefile
index 35ab270b8d47..c0de79e8f570 100644
--- a/multimedia/kooha/Makefile
+++ b/multimedia/kooha/Makefile
@@ -32,7 +32,6 @@ post-patch:
 # Make each cargo subcommand very verbose
 # Add explicit <triple> subdir for --target from USES=cargo
 	@${REINPLACE_CMD} -e "/cargo_options =/s/ '--/&verbose', &verbose', &/" \
-		-e "/cp/s,'src',& / '${CARGO_BUILD_TARGET}'," \
 		${WRKSRC}/src/meson.build
 
 .include <bsd.port.mk>
diff --git a/multimedia/ringrtc/Makefile b/multimedia/ringrtc/Makefile
index 53e519abb8e6..2b11cb3147d2 100644
--- a/multimedia/ringrtc/Makefile
+++ b/multimedia/ringrtc/Makefile
@@ -171,7 +171,7 @@ pre-build:
 # it's not intended to be used outside of signal-desktop, put that in
 # /usr/local/share/ringrtc instead?
 do-install:
-	${INSTALL_LIB} ${CARGO_TARGET_DIR}/${CARGO_BUILD_TARGET}/release/libringrtc.so \
+	${INSTALL_LIB} ${CARGO_TARGET_DIR}/release/libringrtc.so \
 		${STAGEDIR}${PREFIX}/lib/
 
 .include <bsd.port.mk>
diff --git a/multimedia/video-trimmer/Makefile b/multimedia/video-trimmer/Makefile
index a298a3e12938..899639da41cf 100644
--- a/multimedia/video-trimmer/Makefile
+++ b/multimedia/video-trimmer/Makefile
@@ -30,7 +30,6 @@ post-patch:
 # Make each cargo subcommand very verbose
 # Add explicit <triple> subdir for --target from USES=cargo
 	@${REINPLACE_CMD} -e '/cargo/s/ --/&verbose&verbose&/' \
-		-Ee '/cp/s,/(release|debug)/,/${CARGO_BUILD_TARGET}&,' \
 		${WRKSRC}/build-aux/cargo.sh
 
 .include <bsd.port.mk>
diff --git a/multimedia/wl-screenrec/Makefile b/multimedia/wl-screenrec/Makefile
index 8b8605782eb6..36a8b387df87 100644
--- a/multimedia/wl-screenrec/Makefile
+++ b/multimedia/wl-screenrec/Makefile
@@ -29,7 +29,7 @@ post-patch:
 post-install:
 .for _shell in bash fish zsh
 	@${ECHO_MSG} "Generating ${STAGEDIR}${PREFIX}/${PLIST_FILES:M*${_shell}*}"
-	${CARGO_TARGET_DIR}/${CARGO_BUILD_TARGET}/*/${PORTNAME} \
+	${CARGO_TARGET_DIR}/*/${PORTNAME} \
 		--generate-completions ${_shell} \
 		>${STAGEDIR}${PREFIX}/${PLIST_FILES:M*${_shell}*}
 .endfor
diff --git a/net-im/fractal/files/patch-scripts_cargo.sh b/net-im/fractal/files/patch-scripts_cargo.sh
index a602980a268f..6baeeb352406 100644
--- a/net-im/fractal/files/patch-scripts_cargo.sh
+++ b/net-im/fractal/files/patch-scripts_cargo.sh
@@ -12,9 +12,9 @@
  then
      echo "DEBUG MODE"
 -    cargo build --manifest-path $1/Cargo.toml -p fractal-gtk && cp "$CARGO_TARGET_DIR"/debug/fractal-gtk "$OUTPUT"
-+    cargo build --manifest-path $1/Cargo.toml -p fractal-gtk && cp "$CARGO_TARGET_DIR"/"$CARGO_BUILD_TARGET"/debug/fractal-gtk "$OUTPUT"
++    cargo build --manifest-path $1/Cargo.toml -p fractal-gtk && cp "$CARGO_TARGET_DIR"/debug/fractal-gtk "$OUTPUT"
  else
      echo "RELEASE MODE"
 -    cargo build --manifest-path $1/Cargo.toml --release -p fractal-gtk && cp "$CARGO_TARGET_DIR"/release/fractal-gtk "$OUTPUT"
-+    cargo build --manifest-path $1/Cargo.toml --release -p fractal-gtk && cp "$CARGO_TARGET_DIR"/"$CARGO_BUILD_TARGET"/release/fractal-gtk "$OUTPUT"
++    cargo build --manifest-path $1/Cargo.toml --release -p fractal-gtk && cp "$CARGO_TARGET_DIR"/release/fractal-gtk "$OUTPUT"
  fi
diff --git a/net-im/libsignal-client/Makefile b/net-im/libsignal-client/Makefile
index b35cb44da581..cf8e349222e2 100644
--- a/net-im/libsignal-client/Makefile
+++ b/net-im/libsignal-client/Makefile
@@ -247,7 +247,7 @@ MAKE_ENV=		CARGO_PROFILE_RELEASE_LTO=thin \
 PLIST_FILES=		lib/libsignal_jni.so
 
 do-install:
-	${INSTALL_LIB} ${CARGO_TARGET_DIR}/${CARGO_BUILD_TARGET}/*/libsignal_jni.so \
+	${INSTALL_LIB} ${CARGO_TARGET_DIR}/*/libsignal_jni.so \
 		${STAGEDIR}${PREFIX}/lib/
 
 .include <bsd.port.mk>
diff --git a/net-im/zkgroup/Makefile b/net-im/zkgroup/Makefile
index ec8a48cf6da7..77bf7c6a0a3e 100644
--- a/net-im/zkgroup/Makefile
+++ b/net-im/zkgroup/Makefile
@@ -135,7 +135,7 @@ CARGO_CRATES=	aead-0.4.1 \
 PLIST_FILES=	lib/lib${PORTNAME}.so
 
 do-install:
-	${INSTALL_LIB} ${CARGO_TARGET_DIR}/${CARGO_BUILD_TARGET}/*/lib${PORTNAME}.so \
+	${INSTALL_LIB} ${CARGO_TARGET_DIR}/*/lib${PORTNAME}.so \
 		${STAGEDIR}${PREFIX}/lib/
 
 .include <bsd.port.mk>
diff --git a/net-mgmt/gping/Makefile b/net-mgmt/gping/Makefile
index 79912a7852d7..ef0e744efb65 100644
--- a/net-mgmt/gping/Makefile
+++ b/net-mgmt/gping/Makefile
@@ -19,7 +19,7 @@ PLIST_FILES=	bin/gping \
 		share/man/man1/gping.1.gz
 
 do-install:
-	${INSTALL_PROGRAM} ${WRKDIR}/target/*/release/${PORTNAME} \
+	${INSTALL_PROGRAM} ${WRKDIR}/target/release/${PORTNAME} \
 		${STAGEDIR}${PREFIX}/bin
 	${INSTALL_MAN} ${WRKSRC}/gping.1 ${STAGEDIR}${PREFIX}/share/man/man1
 
diff --git a/net-p2p/cncli/Makefile b/net-p2p/cncli/Makefile
index 164564f99ba4..6f8c7a88715f 100644
--- a/net-p2p/cncli/Makefile
+++ b/net-p2p/cncli/Makefile
@@ -27,6 +27,11 @@ CARGO_ENV=	SODIUM_LIB_DIR=${LIBS_PREFIX}${PREFIX}/lib SODIUM_INCLUDE_DIR=${LIBS_
 
 PLIST_FILES=	bin/cncli
 
+CARGO_BUILD_TARGET=	${_CARGO_RUST_ARCH_${ARCH}:U${ARCH}}-unknown-${OPSYS:tl}
+CARGO_ENV+= \
+		CARGO_BUILD_TARGET=${CARGO_BUILD_TARGET} \
+		CARGO_TARGET_${CARGO_BUILD_TARGET:S/-/_/g:tu}_LINKER="${CC}"
+
 pre-build:
 		cd ${WRKSRC_sodium} && ./autogen.sh
 		cd ${WRKSRC_sodium} && ./configure --prefix=${PREFIX} --with-pthreads --disable-shared
diff --git a/net/narrowlink/Makefile b/net/narrowlink/Makefile
index cb2ea8967f38..b96555724eca 100644
--- a/net/narrowlink/Makefile
+++ b/net/narrowlink/Makefile
@@ -335,7 +335,7 @@ do-install:
 	# workaround for error: found a virtual manifest at `xx` instead of a package manifest
 .for prog in ${PROGRAMS}
 	${INSTALL_PROGRAM} \
-		${WRKDIR}/target/*/release/${prog} \
+		${WRKDIR}/target/release/${prog} \
 		${STAGEDIR}${PREFIX}/bin
 .endfor
 	# install config files
diff --git a/net/ntpd-rs/Makefile b/net/ntpd-rs/Makefile
index 4b5c9d9e4a15..3a8464564d6c 100644
--- a/net/ntpd-rs/Makefile
+++ b/net/ntpd-rs/Makefile
@@ -30,7 +30,7 @@ post-patch:
 
 do-install:
 .for f in ${BINFILES}
-	${INSTALL_PROGRAM} ${CARGO_TARGET_DIR}/${CARGO_BUILD_TARGET}/*/${f} ${STAGEDIR}${LOCALBASE}/bin
+	${INSTALL_PROGRAM} ${CARGO_TARGET_DIR}/*/${f} ${STAGEDIR}${LOCALBASE}/bin
 .endfor
 	${MKDIR} ${STAGEDIR}${ETCDIR}
 	${INSTALL_DATA} ${WRKSRC}/ntp.server.toml ${STAGEDIR}${ETCDIR}/ntp.server.toml.sample
diff --git a/net/quiche/Makefile b/net/quiche/Makefile
index bf965f32a70d..de76e373ab66 100644
--- a/net/quiche/Makefile
+++ b/net/quiche/Makefile
@@ -47,13 +47,13 @@ post-patch:
 # install quiche apps and libquiche
 do-install:
 	${INSTALL_DATA} ${WRKSRC}/quiche/include/quiche.h ${STAGEDIR}${PREFIX}/include
-	${INSTALL_DATA} ${CARGO_TARGET_DIR}/${CARGO_BUILD_TARGET}/*/quiche.pc ${STAGEDIR}${PREFIX}/libdata/pkgconfig
-	${INSTALL_LIB} ${CARGO_TARGET_DIR}/${CARGO_BUILD_TARGET}/*/libquiche.so ${STAGEDIR}${PREFIX}/lib/libquiche.so.${DISTVERSION}
+	${INSTALL_DATA} ${CARGO_TARGET_DIR}/*/quiche.pc ${STAGEDIR}${PREFIX}/libdata/pkgconfig
+	${INSTALL_LIB} ${CARGO_TARGET_DIR}/*/libquiche.so ${STAGEDIR}${PREFIX}/lib/libquiche.so.${DISTVERSION}
 	${RLN} ${STAGEDIR}${PREFIX}/lib/libquiche.so.${DISTVERSION} ${STAGEDIR}${PREFIX}/lib/libquiche.so.${MAJOR_VER}
 	${RLN} ${STAGEDIR}${PREFIX}/lib/libquiche.so.${DISTVERSION} ${STAGEDIR}${PREFIX}/lib/libquiche.so
-	${INSTALL_LIB} ${CARGO_TARGET_DIR}/${CARGO_BUILD_TARGET}/*/libquiche.a ${STAGEDIR}${PREFIX}/lib
-	${INSTALL_PROGRAM} ${CARGO_TARGET_DIR}/${CARGO_BUILD_TARGET}/*/quiche-server ${STAGEDIR}${PREFIX}/bin
-	${INSTALL_PROGRAM} ${CARGO_TARGET_DIR}/${CARGO_BUILD_TARGET}/*/quiche-client ${STAGEDIR}${PREFIX}/bin
+	${INSTALL_LIB} ${CARGO_TARGET_DIR}/*/libquiche.a ${STAGEDIR}${PREFIX}/lib
+	${INSTALL_PROGRAM} ${CARGO_TARGET_DIR}/*/quiche-server ${STAGEDIR}${PREFIX}/bin
+	${INSTALL_PROGRAM} ${CARGO_TARGET_DIR}/*/quiche-client ${STAGEDIR}${PREFIX}/bin
 
 do-install-DOCS-on:
 	@${MKDIR} ${STAGEDIR}${DOCSDIR}
diff --git a/net/trippy/Makefile b/net/trippy/Makefile
index 30d31a878752..93dd4a67bae4 100644
--- a/net/trippy/Makefile
+++ b/net/trippy/Makefile
@@ -32,7 +32,7 @@ SUID_PLIST_FILES_OFF=	"@(,,0100) bin/trip"
 
 post-build-MANPAGES-on:
 	help2man -s 1 -Nn "${COMMENT}" \
-		${CARGO_TARGET_DIR}/${CARGO_BUILD_TARGET}/*/trip \
+		${CARGO_TARGET_DIR}/*/trip \
 		-o ${WRKSRC}/trip.1
 
 post-install-MANPAGES-on:
diff --git a/ports-mgmt/sccache-overlay/Makefile b/ports-mgmt/sccache-overlay/Makefile
index f38ca944a7dd..b3ddbc5d39f2 100644
--- a/ports-mgmt/sccache-overlay/Makefile
+++ b/ports-mgmt/sccache-overlay/Makefile
@@ -398,8 +398,8 @@ CARGO_CRATES=	addr2line-0.14.1 \
 		zstd-sys-1.4.19+zstd.1.4.8
 CARGO_FEATURES=	--no-default-features
 QA_ENV=		IGNORE_QA_proxydeps=1
-LDFLAGS+=	-Wl,-rpath=\$$ORIGIN/../lib \
-		-Wl,-dynamic-linker,/tmp/sccache-overlay/ld-elf.so.1
*** 331 LINES SKIPPED ***