Rust package guidelines
Jump to navigation
Jump to search
Package creation guidelines
32-bit – CLR – Cross – Eclipse – Electron – Free Pascal – GNOME – Go – Haskell – Java – KDE – Kernel – Lisp – MinGW – Node.js – Nonfree – OCaml – Perl – PHP – Python – R – Ruby – Rust – VCS – Web – Wine
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 theCargo.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
.
package() { install -Dm 755 target/release/${pkgname} -t "${pkgdir}/usr/bin" }
Some packages should install more files such as a man page, so in that case it would be better to use cargo
:
package() { cargo install --root "${pkgdir}"/usr --root "${srcdir}/${pkgname}-${pkgver}" }