Sneakerweb on the AUR
Since sneakerweb doesn't have an AUR package yet I thought I'd have a look at what it actually entails to create one, turns out for rust projects it isn't complicated. Here are some useful links that you should read to get up to speed.
- PKGBUILD: This describes the file format for all arch linux package definitions
- Arch package guidelines: General guidelines, ended up not being very relevant for rust projects with the template below
- Rust template: Turns out there is a template for rust projects that's really quite easy to fill in
- AUR submission guidelines: I didn't actually submit it to the AUR yet but then this will become relevant
With this in hand I initially made the mistake to download the binary file instead of the sources from the downloads page. I got too enthousiastic by the opportunity to use both $pkgver and
$arch. Having realized my mistake I switched to actually downloading the sources from codeberg and from there it basically worked in one try. The only problem is that there are not published checksums
of the source for the release tarballs that I can copy, so I generated it myself from the download I got. I'm guessing this probably happens with more projects and is fairly standard practice. But then it's on me to
ensure that the code I downloaded is the correct code. I also stole the release profile configuration from the ripgrep package, which fixed a warning about missing debug symbols.
# Maintainer: Peter Maatman (blackwolf12333@gmail.com)
pkgname=sneakerweb
pkgver=1.3.0
pkgrel=1
pkgdesc='A parallel web transported by physical media'
url='https://sneakerweb.org'
license=('Apache-2.0 OR MIT')
makedepends=('cargo')
depends=()
arch=('i686' 'x86_64')
source=("https://codeberg.org/worm-blossom/sneakerweb/archive/$pkgver.tar.gz")
sha512sums=('5bd145e21ead89ebd596ab6393ff589e5e332207559d7ec5e0fca310c0c77a07f8fd735e6cfe6a286fa312acb9e4de4f8fd6cb9bd43d462d9236e1b9bcb880f9')
# Use debug
export CARGO_PROFILE_RELEASE_DEBUG=2 CARGO_PROFILE_RELEASE_STRIP=false
# Use LTO
export CARGO_PROFILE_RELEASE_LTO=true CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1
prepare() {
cd "$pkgname"
export RUSTUP_TOOLCHAIN=stable
cargo fetch --locked --target host-tuple
}
build() {
cd "$pkgname"
export RUSTUP_TOOLCHAIN=stable
export CARGO_TARGET_DIR=target
cargo build --frozen --release --all-features
}
check() {
cd "$pkgname"
export RUSTUP_TOOLCHAIN=stable
cargo test --frozen --all-features
}
package() {
cd "$pkgname"
install -Dm0755 -t "$pkgdir/usr/bin/" "target/release/$pkgname"
}