summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 2d060c91df9fbc2fbf888e4455519bf6c9bb975b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Maintainer: e-tho <@e-tho:matrix.org>
pkgname=pwmenu-git
pkgver=0.3.0.r0.g3111309
pkgrel=1
pkgdesc="Launcher-driven audio manager for Linux"
arch=('x86_64' 'aarch64')
url="https://github.com/e-tho/${pkgname%-git}"
license=('GPL-3.0-or-later')
depends=('pipewire' 'gcc-libs')
makedepends=('git' 'cargo' 'clang' 'llvm' 'libpipewire')
optdepends=(
  'dmenu: launcher for options navigation via stdin'
  'rofi: launcher for options navigation via stdin'
  'fuzzel: launcher for options navigation via stdin'
  'walker: launcher for options navigation via stdin'
  'nerd-fonts: for font-based icons (default mode)'
)
provides=(${pkgname%-git}=${pkgver})
conflicts=(${pkgname%-git}-bin ${pkgname%-git})
options=('!debug' '!strip')
source=(${pkgname%-git}::git+$url.git)
sha256sums=('SKIP')

pkgver() {
  cd ${pkgname%-git}
  git describe --long --tags --abbrev=7 | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/^v//' 2>/dev/null || echo "0.3.0.r$(git rev-list --count HEAD).g$(git rev-parse --short HEAD)"
}

prepare() {
  cd ${pkgname%-git}
  export RUSTUP_TOOLCHAIN=stable
  cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
}

build() {
  cd "${pkgname%-git}"
  export CARGO_HOME="$srcdir/cargo"
  export CARGO_TARGET_DIR="target"
  export RUSTFLAGS="--remap-path-prefix=${srcdir}=/"

  # Force clang for libspa-sys compatibility
  export CC=clang
  export AR=ar
  export LIBCLANG_PATH="$(llvm-config --libdir)"

  [[ -n ${_sccache} ]] && export RUSTC_WRAPPER=sccache

  cargo build --release --locked
}

package() {
  cd ${srcdir}/${pkgname%-git}
  install -Dm755 "target/release/${pkgname%-git}" "$pkgdir/usr/bin/${pkgname%-git}"
  install -Dm644 LICENSE.md "$pkgdir/usr/share/licenses/${pkgname%-git}/LICENSE.md"
}