Rust package guidelines

From ArchWiki
Jump to navigation Jump to search
Package creation guidelines

CLRCrossEclipseElectronFree PascalGNOMEGoHaskellJavaKDEKernelLispMinGWNode.jsNonfreeOCamlPerlPHPPythonRRubyRustVCSWebWine

This document covers standards and guidelines on writing PKGBUILDs for Rust.

General guidelines

Package naming

For Rust binaries use only the program name.

Note: The package name should be entirely lowercase.

Building

Building a Rust package.

 build() {
   cargo build --release --locked
 }

where:

  • --release tells cargo to compile a release build
  • --locked tells cargo to adhere the Cargo.lock file and prevent it from updating dependencies which is important for reproducible builds.

Check

Most Rust projects provide a simple way to run the testsuite.

 check() {
   cargo test --release --locked
 }

Package

Rust builds binaries in target/release and can simply be installed to /usr/bin.

Note: Some packages should install more files such as a man page.
 package() {
   install -Dm 755 target/release/${pkgname} -t "${pkgdir}/usr/bin"
 }