-DEV_ERROR+= "CARGO_CRATES=${libc} may be unstable on aarch64 or not build on armv6, armv7, powerpc64. Consider updating to the latest version \(higher than 0.2.49\)."
-. endif
-.undef _libc_VER
-.endfor
-
-.if ${CARGO_CRATES:Mlibgit2-sys-[0-9]*}
+.if ${_CARGO_CRATES:Mlibgit2-sys}
# Use the system's libgit2 instead of building the bundled version
CARGO_ENV+= LIBGIT2_SYS_USE_PKG_CONFIG=1
.endif
-.if ${CARGO_CRATES:Mlibssh2-sys-[0-9]*}
+.if ${_CARGO_CRATES:Mlibssh2-sys}
# Use the system's libssh2 instead of building the bundled version
CARGO_ENV+= LIBSSH2_SYS_USE_PKG_CONFIG=1
.endif
-.if ${CARGO_CRATES:Monig_sys-[0-9]*}
+.if ${_CARGO_CRATES:Monig_sys}
# onig_sys always prefers the system library but will try to link
# statically with it. Since devel/oniguruma doesn't provide a static
# library it'll link to libonig.so instead. Strictly speaking setting
-DEV_WARNING+= "CARGO_CRATES=openssl-0.10.3 or older do not support OpenSSL 1.1.1. Consider updating to the latest version."
-. endif
-. endif
-.undef _openssl_VER
-.endif
-
-.if ${CARGO_CRATES:Mopenssl-src-[0-9]*}
+.if ${_CARGO_CRATES:Mopenssl-src}
DEV_WARNING+= "Please make sure this port uses the system OpenSSL and consider removing CARGO_CRATES=${CARGO_CRATES:Mopenssl-src-[0-9]*} (a vendored copy of OpenSSL) from the build, e.g., by patching Cargo.toml appropriately."
.endif
-.if ${CARGO_CRATES:Mopenssl-sys-[0-9]*}
+.if ${_CARGO_CRATES:Mopenssl-sys}
# Make sure that openssl-sys can find the correct version of OpenSSL
CARGO_ENV+= OPENSSL_LIB_DIR=${OPENSSLLIB} \
OPENSSL_INCLUDE_DIR=${OPENSSLINC}
.endif
-.if ${CARGO_CRATES:Mpkg-config-[0-9]*}
+.if ${_CARGO_CRATES:Mpkg-config}
.include "${USESDIR}/pkgconfig.mk"
.endif
+.for _index _crate _name _version in ${_CARGO_CRATES}
+# Split up semantic version and try to sanitize it by removing
+# pre-release identifier (-) or build metadata (+)
+. if ${_version:S/./ /:S/./ /:C/[-+].*//:_:[#]} == 3
+DEV_ERROR+= "CARGO_CRATES=${_crate} may be unstable on aarch64 or not build on armv6, armv7, powerpc64. Consider updating to the latest version \(higher than 0.2.49\)."