1 Building and Releasing
Anagnostakis Ioannis edited this page 2026-06-25 03:12:30 +03:00

Building and Releasing

This page is for packaging slacker for a distribution so the build stays reproducible for the life of the target Slackware, regardless of what crates.io does later.


What actually breaks (and what doesn't)

Your own code never breaks on its own — Rust guarantees backwards compatibility, so a newer rustc builds old code fine. The danger is one thing only: the open version ranges in Cargo.toml (regex = "1", clap = "4", …) mean "take whatever is newest." One day a newer crate either raises its minimum rustc or changes its API, and a build that pulls "the newest" fails.

The fix is three things together:

%%{init: {'theme':'base','themeVariables':{'primaryColor':'#161b22','primaryBorderColor':'#1f6feb','primaryTextColor':'#e6edf3','lineColor':'#6e7781','fontFamily':'monospace'}}}%%
flowchart LR
  A["pin<br/>Cargo.lock committed"]:::blue --> B["vendor<br/>cargo vendor"]:::green
  B --> C["declare<br/>rust-version"]:::grey
  classDef grey fill:#0d1117,stroke:#6e7781,color:#8b949e;
  classDef blue fill:#0d1117,stroke:#1f6feb,color:#e6edf3;
  classDef green fill:#0d1117,stroke:#2ea043,color:#e6edf3;

The effective MSRV is 1.85.1

slacker's crate is edition 2021, but a transitive dependency — clap_lex (pulled in by clap) — is written in edition 2024, which only stabilised in Rust 1.85. So the effective MSRV is 1.85.1. Current Slackware ships 1.96, which covers it. Find the exact number on your box with cargo msrv find (requires rustup).


Freeze procedure

Run this when you finalise a release against the target Slackware's rustc.

  1. Target toolchain — confirm you're building with the rustc the target ships:
    rustc --version
    
  2. Build and test cleanly with your real Cargo.toml:
    cargo build --release && cargo test
    
    For the freshest compatible set, cargo update then re-test.
  3. Declare the MSRV in [package]:
    rust-version = "1.85.1"
    
    This activates the MSRV-aware resolver, so a future cargo update refuses a crate that exceeds the floor.
  4. Lock and verify:
    cargo build --release --locked
    git add -f Cargo.lock        # slacker is a binary — commit the lock
    
  5. Vendor the sources:
    cargo vendor vendor/
    
    Save the printed block into .cargo/config.toml:
    [source.crates-io]
    replace-with = "vendored-sources"
    [source.vendored-sources]
    directory = "vendor"
    
  6. Confirm it builds offline:
    cargo build --release --offline --locked
    
  7. Package two tarballs tied to the git tag: the source (+ Cargo.lock + .cargo/config.toml) and the vendor/ directory.
  8. SlackBuild unpacks both side by side and builds with no network:
    cargo build --release --offline --locked
    

Tips and pitfalls

  • Don't vendor OpenSSL with its vendored feature — link the system OpenSSL so Slackware's security updates reach slacker automatically.
  • The danger is one-way: only newer crates threaten you, never a newer rustc. Lock + vendor → builds with the same or newer toolchain indefinitely.
  • Unfreezing is deliberate: cargo updatecargo vendor again → re-test → bump slacker's version.
  • One snapshot per release: tie Cargo.lock and vendor/ to each git tag.
  • The frozen Cargo.toml you ship is your own, on the target's rustc — never a Cargo.toml tweaked for an older rustc.

In one line

Find the minimum rustc with rustup + cargo msrv, declare it in rust-version, commit Cargo.lock, and distribute vendored dependencies — and slacker builds reproducibly for as long as the target Slackware lives.