Skip to content
lazybrarPublic

About

Generate a pacman PKGBUILD for a Rust project

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

cratepkg

Generate a pacman PKGBUILD for a Rust binary project, so you can install and remove it with pacman. Zero dependencies, written in Rust. cratepkg never installs anything itself.

Install

git clone https://github.com/lazybrar/cratepkg && cd cratepkg/pkg
makepkg -si

Use

In any Rust project (or pass its path):

cratepkg init             # writes pkg/PKGBUILD from Cargo.toml
cd pkg && makepkg -si     # build and install with pacman
cratepkg build            # or: only build the package (makepkg -f), print the pacman -U line

Options for init: --force (overwrite), --pkgname NAME (default: crate name, lowercased), --no-check (no check() running cargo test).

What it generates

  • pkg/PKGBUILD (+ pkg/.gitignore), so makepkg's src/ never clashes with the project's src/.
  • Name, version, description, license (SPDX), url (repository or homepage) from Cargo.toml, including values inherited from [workspace.package].
  • Every binary target (src/main.rs, src/bin/*, [[bin]], honouring autobins = false), plus README* and LICENSE*/COPYING*.
  • !debug, depends=('gcc-libs' 'glibc'), makedepends=('cargo'), arch=('x86_64' 'aarch64').
  • With a Cargo.lock: prepare() fetches with --locked, and build/test use --frozen.
  • Extra files: everything under pkg/overlay/ is copied into the package as is, e.g. pkg/overlay/usr/lib/systemd/system/foo.service or sysusers.d/tmpfiles.d entries.

The package builds from the local project tree, not from a downloaded tarball.

Limits

  • Binary crates only; library-only crates are rejected.
  • The workspace root itself can't be packaged; run it on a member crate's path.
  • Reads Cargo.toml with a small purpose-built parser: multi-line strings for the fields it reads are rejected with an error rather than guessed.
  • Packages are named after the crate; check for name clashes in the Arch repos/AUR and use --pkgname if needed.

License

GPL-2.0-or-later. See LICENSE.

About

Generate a pacman PKGBUILD for a Rust project

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages