Add tooling to generate PKGBUILD after cargo publish
This commit is contained in:
parent
87f8dd79a1
commit
fbfa3d770c
2 changed files with 52 additions and 0 deletions
33
PKGBUILD.in
Normal file
33
PKGBUILD.in
Normal file
|
@ -0,0 +1,33 @@
|
|||
# Maintainer: Gergő Sályi <salyigergo94@gmail.com>
|
||||
pkgname=multibg-sway
|
||||
pkgver=@pkgver@
|
||||
pkgrel=1
|
||||
pkgdesc='Set a different wallpaper for the background of each Sway workspace'
|
||||
arch=('x86_64' 'i686' 'pentium4' 'armv7h' 'aarch64')
|
||||
url="https://github.com/gergo-salyi/multibg-sway"
|
||||
license=('MIT' 'Apache')
|
||||
depends=('gcc-libs' 'glibc')
|
||||
makedepends=('cargo')
|
||||
optdepends=('sway: window manager to set the wallpapers with')
|
||||
source=("$pkgname-$pkgver.tar.gz::https://static.crates.io/crates/$pkgname/$pkgname-$pkgver.crate")
|
||||
sha256sums=('@sha256sum@')
|
||||
|
||||
prepare() {
|
||||
cd "$pkgname-$pkgver"
|
||||
export RUSTUP_TOOLCHAIN=stable
|
||||
cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
|
||||
}
|
||||
|
||||
build() {
|
||||
cd "$pkgname-$pkgver"
|
||||
export RUSTUP_TOOLCHAIN=stable
|
||||
export CARGO_TARGET_DIR=target
|
||||
cargo build --frozen --release
|
||||
}
|
||||
|
||||
package() {
|
||||
cd "$pkgname-$pkgver"
|
||||
install -Dm0755 -t "$pkgdir/usr/bin/" "target/release/$pkgname"
|
||||
install -Dm644 "README.md" "$pkgdir/usr/share/doc/${pkgname}/README.md"
|
||||
install -Dm644 "LICENSE-MIT" "$pkgdir/usr/share/licenses/${pkgname}/LICENSE-MIT"
|
||||
}
|
19
scripts/pkgbuild.sh
Executable file
19
scripts/pkgbuild.sh
Executable file
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
if [[ "$(head -2 Cargo.toml)" != '[package]
|
||||
name = "multibg-sway"' ]]; then
|
||||
echo 'Not in crate root'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
version=$(cargo pkgid | cut -d '#' -f2)
|
||||
crate="target/package/multibg-sway-$version.crate"
|
||||
sum=$(sha256sum "$crate" | cut -d ' ' -f1)
|
||||
|
||||
if [[ PKGBUILD -nt "$crate" ]]; then
|
||||
echo 'Nothing to do'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sed -e "s/@pkgver@/$version/" -e "s/@sha256sum@/$sum/" < PKGBUILD.in > PKGBUILD
|
Loading…
Add table
Reference in a new issue