Page MenuHomeFreeBSD

WIP: Mk/Uses/cargo.mk: Add USES=rust and adapt to existing ports
AbandonedPublic

Authored by tobik on Apr 2 2021, 9:36 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Dec 25, 6:15 AM
Unknown Object (File)
Wed, Dec 25, 6:04 AM
Unknown Object (File)
Wed, Dec 25, 6:01 AM
Unknown Object (File)
Nov 1 2024, 4:27 AM
Unknown Object (File)
Oct 5 2024, 8:17 AM
Unknown Object (File)
Sep 18 2024, 9:18 AM
Unknown Object (File)
Sep 11 2024, 2:47 AM
Unknown Object (File)
Sep 9 2024, 2:03 PM
Subscribers

Details

Reviewers
None
Group Reviewers
gecko
rust
O5: Ports Framework(Owns No Changed Paths)
portmgr
Summary

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)

Diff Detail

Repository
rP FreeBSD ports repository
Lint
No Lint Coverage
Unit
No Test Coverage
Build Status
Buildable 38272
Build 35161: arc lint + arc unit

Event Timeline

tobik held this revision as a draft.
  • 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.