git: 4b500674d509 - main - Uses/cargo: Allow using any Rust version if requested

From: Tobias Kortkamp <tobik_at_FreeBSD.org>
Date: Thu, 25 Aug 2022 21:35:25 UTC
The branch main has been updated by tobik:

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

commit 4b500674d50988b7ce3585914be27ef74fea3c1d
Author:     Tobias Kortkamp <tobik@FreeBSD.org>
AuthorDate: 2022-08-25 21:16:22 +0000
Commit:     Tobias Kortkamp <tobik@FreeBSD.org>
CommitDate: 2022-08-25 21:16:22 +0000

    Uses/cargo: Allow using any Rust version if requested
    
    Skip the Rust version check when CARGO_BUILDDEP=any-version
    
    The current version check is justified by USES=cargo making use
    of newer toolchain features that not all Cargo versions support
    and the fact that Rust binaries are statically linked against
    libstd (and others) which have been vulnerable in the past.
    We can enforce the use of the correct toolchain only with the
    version check. Together with revision bumps of all ports that
    have lang/rust as input we can ensure that they are kept "fresh"
    and relinked whenever lang/rust is updated.
    
    According to amdmi3@ skipping the check might be useful for build
    testing in some cases.
    
    Individual ports should not set CARGO_BUILDDEP=any-version. It
    can be set in make.conf or on the command line by users.
    
    PR:             265062
    Reported by:    amdmi3
---
 Mk/Uses/cargo.mk | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Mk/Uses/cargo.mk b/Mk/Uses/cargo.mk
index 55bedf30b1e9..5fa8e0e7e651 100644
--- a/Mk/Uses/cargo.mk
+++ b/Mk/Uses/cargo.mk
@@ -98,6 +98,8 @@ WRKSRC_crate_${_crate}=	${WRKDIR}/${_wrksrc}
 CARGO_BUILDDEP?=	yes
 .  if ${CARGO_BUILDDEP:tl} == "yes"
 BUILD_DEPENDS+=	${RUST_DEFAULT}>=1.63.0:lang/${RUST_DEFAULT}
+.  elif ${CARGO_BUILDDEP:tl} == "any-version"
+BUILD_DEPENDS+=	${RUST_DEFAULT}>=0:lang/${RUST_DEFAULT}
 .  endif
 
 # Location of toolchain (default to lang/rust's toolchain)