LinuxCommandLibrary

cargo-deb

Build Debian packages from Rust projects

TLDR

Create Debian package

$ cargo deb
copy
Build and install locally
$ cargo deb --install
copy
Specify output location
$ cargo deb --output [path/to/package.deb]
copy
Build for specific target
$ cargo deb --target [x86_64-unknown-linux-gnu]
copy
Set package revision
$ cargo deb --deb-revision [2]
copy
Build without default features
$ cargo deb --no-default-features
copy
Verbose output
$ cargo deb --verbose
copy

SYNOPSIS

cargo deb [options]

DESCRIPTION

cargo deb creates binary Debian packages (.deb) from Cargo projects automatically. Uses Cargo.toml metadata and optional [package.metadata.deb] configuration.
Output placed in target/debian/<name><version>-<revision><arch>.deb

PARAMETERS

--install

Build and install package immediately
-o, --output path
Custom output file path
--target triple
Build for specified target
--deb-revision rev
Set Debian package revision
--no-build
Skip cargo build step
--no-strip
Don't strip debug symbols
--separate-debug-symbols
Create separate debug package
--fast
Skip some optimizations for faster build
--variant name
Use variant-specific configuration
-v, --verbose
Verbose output

CONFIGURATION

Add to Cargo.toml:

$ [package.metadata.deb]
maintainer = "Name <email>"
depends = "$auto"
section = "utility"
priority = "optional"
assets = [
    ["target/release/bin", "usr/bin/", "755"],
]
copy

INSTALLATION

$ cargo install cargo-deb
copy
Requires Rust 1.76+. Optional: dpkg, dpkg-dev, liblzma-dev.

CAVEATS

Automatically uses Cargo fields for name, version, license, description. The $auto depends value auto-detects library dependencies on Debian systems.

SEE ALSO

cargo(1), dpkg(1), dpkg-deb(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community