Page MenuHomeFreeBSD

WIP: Mk/Uses/ Add USES=rust and adapt to existing ports
Needs ReviewPublic

Authored by tobik on Apr 2 2021, 9:36 AM.


Group Reviewers
O5: Ports Framework(Owns No Changed Paths)

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_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 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)

Diff Detail

rP FreeBSD ports repository
No Linters Available
No Unit Test Coverage
Build Status
Buildable 38268
Build 35157: arc lint + arc unit

Event Timeline

  • Unbreak textproc/bat
  • Remove CARGO_BUILD_JOBS from USES=cargo (USES=rust sets it already)
tobik published this revision for review.Apr 2 2021, 9:45 AM
  • Use the right lock file in cargo-crates
  • Revert the CARGO_USE_GIT* changes

I have some ideas how to maybe make it better but it should be a
separate change. In the meantime it is better if the ports that
need it stay tagged.