#cargo #subcommand #archlinux #aur

app cargo-aur

Prepare Rust projects to be released on the Arch Linux User Repository

8 stable releases

1.3.0 Apr 5, 2021
1.2.0 Aug 24, 2020
1.0.3 Jul 18, 2020
1.0.2 Jun 22, 2020

#35 in Cargo plugins

Download history 8/week @ 2020-12-30 2/week @ 2021-01-06 1/week @ 2021-01-13 3/week @ 2021-01-20 17/week @ 2021-01-27 70/week @ 2021-02-03 120/week @ 2021-02-10 64/week @ 2021-02-17 22/week @ 2021-02-24 43/week @ 2021-03-03 12/week @ 2021-03-10 15/week @ 2021-03-17 35/week @ 2021-03-24 81/week @ 2021-03-31 40/week @ 2021-04-07

152 downloads per month

MIT license

9KB
174 lines

cargo-aur

Build AUR version

cargo-aur is a new subcommand for cargo that produces a release tarball and PKGBUILD file for a Rust project, so that it can be released on the Arch Linux User Repository (AUR).

No extra configuration is necessary. As long as your Cargo.toml has the usual fields, a PKGBUILD will be generated with all the necessary sections filled out.

Installation

Guess what? cargo-aur itself is on the AUR! Install it with an AUR-compatible package manager like aura:

sudo aura -A cargo-aur-bin

... or via cargo:

cargo install cargo-aur

Usage

Navigate to a Rust project, and run:

cargo aur

This will produce a foobar-1.2.3-x86_64.tar.gz tarball and a PKGBUILD.

If you wish, you can now run makepkg to ensure that your package actually builds.

> makepkg
==> Making package: cargo-aur-bin 1.0.0-1 (Wed 10 Jun 2020 08:23:46 PM PDT)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
... etc ...
==> Finished making: cargo-aur-bin 1.0.0-1 (Wed 10 Jun 2020 08:23:47 PM PDT)

Notice that the built package itself is postfixed with -bin, which follows the AUR standard.

At this point, it is up to you to:

  1. Create an official Release on Github/Gitlab, attaching the original binary tarball that cargo aur produced.
  2. Copy the PKGBUILD to a git repo that tracks releases of your package.
  3. Run makepkg --printsrcinfo > .SRCINFO.
  4. Commit both files and push to the AUR.

Some of these steps may be automated in cargo aur at a later date if there is sufficient demand.

Static Binaries

Run with --musl to produce a release binary that is statically linked via MUSL.

> cargo aur --musl
> cd target/x86_64-unknown-linux-musl/release/
> ldd <your-binary>
    not a dynamic executable

Dependencies

~1.1–1.8MB
~40K SLoC