CRAN requires packages to build offline – no network access during R CMD INSTALL. miniextendr vendors all Rust dependencies into inst/vendor.tar.xz for self-contained builds.

🔗Quick Reference

# CRAN release prep:
just vendor            # 1. Create inst/vendor.tar.xz
just configure-cran    # 2. Configure in prepare-cran mode
just r-cmd-build       # 3. Build tarball
just r-cmd-check       # 4. Check the built tarball

🔗Build Contexts

The configure script resolves one of four contexts:

ContextWhenBehavior
dev-monorepoInside the miniextendr repoUses [patch] paths, no vendoring
dev-detachedStandalone, no vendor artifactsUses git/network deps
vendored-installVendor artifacts presentOffline build from vendored sources
prepare-cranPREPARE_CRAN=trueExplicit CRAN release prep

🔗How Vendoring Works

  1. cargo-revendor vendors all crate dependencies (workspace + crates.io)
  2. Dependencies are stripped (tests, benches, examples removed)
  3. Cargo.toml files are frozen to resolve from vendor/ only
  4. Everything is compressed into inst/vendor.tar.xz
  5. During ./configure, the tarball is unpacked and cargo is configured for offline builds

🔗cargo-revendor

A standalone cargo subcommand (excluded from the miniextendr workspace) that replaces cargo vendor with CRAN-specific behavior:

  • Strips test/bench directories and dev-dependencies
  • Freezes Cargo.toml to use vendored sources only
  • Uses cargo package to resolve workspace inheritance
  • Sets COPYFILE_DISABLE=1 on macOS to prevent xattr metadata

🔗Scaffolding New Packages

The minirextendr R package scaffolds new miniextendr projects with vendoring built in:

library(minirextendr)
create_miniextendr_package("mypackage")

The generated configure.ac auto-detects the build context and handles vendoring transparently.