summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: c7a6fa522393151801d8434f5e94104cd85f79a3 (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
56
57
# Maintainer: garionion <garionion@entr0py.de>
# contributor: yochananmarqos (thank you very much)

pkgname=psst-git
pkgver=r417.f1300bf
pkgrel=3
pkgdesc="Fast and multi-platform Spotify client with native GUI"
arch=("x86_64")
options=(!lto)
url="https://github.com/jpochyla/psst"
license=('MIT')
depends=('gtk3' 'openssl' 'alsa-lib')
makedepends=('cargo' 'git')
provides=("${pkgname%-git}")
conflicts=("${pkgname%-git}")
source=('git+https://github.com/jpochyla/psst.git')
sha256sums=('SKIP')

pkgver() {
  cd "$srcdir/${pkgname%-git}"
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
  cd "$srcdir/${pkgname%-git}"
  export RUSTUP_TOOLCHAIN=stable
  cargo fetch --locked --target "$CARCH-unknown-linux-gnu"

  # Add missing entries to desktop file
  sed -i "$ a Icon=${pkgname%-git}" ".pkg/${pkgname%-git}.desktop"
  sed -i '$ a StartupWMClass=Psst-gui' ".pkg/${pkgname%-git}.desktop"
}

build() {
  cd "$srcdir/${pkgname%-git}"
  export RUSTUP_TOOLCHAIN=stable
  export CARGO_TARGET_DIR=target
  cargo build --frozen --release
}

check() {
  cd "$srcdir/${pkgname%-git}"
  export RUSTUP_TOOLCHAIN=stable
  cargo test --frozen
}

package() {
  cd "$srcdir/${pkgname%-git}"
  install -Dm755 "target/release/${pkgname%-git}"{-cli,-gui} -t "$pkgdir/usr/bin"
  install -Dm644 ".pkg/${pkgname%-git}.desktop" -t "$pkgdir/usr/share/applications"
  install -Dm644 LICENSE.md -t "$pkgdir/usr/share/licenses/$pkgname"
  for iconsize in 32 64 128 256 512; do
    install -Dm644 "${pkgname%-git}-gui/assets/logo_${iconsize}.png" \
      "$pkgdir/usr/share/icons/hicolor/${iconsize}x${iconsize}/apps/${pkgname%-git}.png"
  done
  install -Dm644 LICENSE.md -t "$pkgdir/usr/share/licenses/${pkgname%-git}"
}