Generally try to remove some cruft from the tree by making some
relatively simple tweaks.
- Add USES=rust that handles Rust toolchain selection and general build environment management. Also provides a common place to bump the minimum Rust version when we update lang/rust
- USES=rust tries to disable vendor checksums for every crate under ${WRKDIR} to ease create patches
- Replace CARGO_{BUILD,CONFIGURE,INSTALL,TEST} with USES=cargo args
- Replace CARGO_CARGO_BIN with just CARGO provided by USES=rust
- Hook the build/install targets before pre-build/pre-install since some ports need the do-build from other parts of the framework, e.g., devel/py-maturin from USES=python
- Add CARGO_PROFILE support but leave it commented since --profile is not stable yet. In the future it will be possible to select the build profile to use
- Clean up wrong CARGO_TARGET_DIR usage in the tree. Many ports do not take WITH_DEBUG builds into account and have broken install targets. The simplest solution is to just use a glob instead of hardcoding the build profile
- Clean up ports that do not bother to use CARGO_TARGET_DIR in general
- Support builds with multiple CARGO_CARGOTOML per net/quiche
- Accept directories for CARGO_CARGOTOML and CARGO_CARGOLOCK; also allow them to be relative to WRKSRC. This reduces pointless noise (the manifest names where only ever Cargo.toml or Cargo.lock so far)
- Do not enforce the opt-level for the release profile. The default opt-level is 3 which is fine
- Ports should manipulate MAKE_ENV not CARGO_ENV
- USES=rust:nightly for when some application needs nightly features. This just sets RUSTC_BOOTSTRAP=1 to avoid depending on lang/rust-nightly. That is bad but it is worse when ports start depending on lang/rust-nightly directly (amd64 only and it might break randomly)
- TODO: Allow main distfile to be fetched from crates.io too
- TODO: Replace wrong .tar.gz extension for crates with the more appropriate .crate (not sure how to do it without a lot of churn in distinfo)