summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: dd4a946efafb3ceb427a0a548af4a70afbb95d34 (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
# Maintainer: willemw <willemw12@gmail.com>
# Contributor: Jonas Frei <freijon@gmail.com>

pkgname=ncmpvc-git
pkgver=0.0.1.r26.35bab73
pkgrel=3
pkgdesc='Ncurses IPC client for mpv, written in Rust'
arch=(x86_64)
url=https://gitlab.com/mpv-ipc/ncmpvc
license=(MIT)
depends=(mpv)
makedepends=(cargo git)
provides=("${pkgname%-git}")
conflicts=("${pkgname%-git}")
install=$pkgname.install
source=("$pkgname::git+$url.git")
sha256sums=('SKIP')

pkgver() {
  cd $pkgname
  printf "%s.r%s.%s" "$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml)" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

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

  sed -i 's/fn error(&self, &str);/fn error(\&self, msg: \&str);/' src/main.rs
  sed -i 's/macro_rules! println_stderr(/#[allow(unused_macros)]\n&/' src/macros.rs
}

build() {
  export RUSTUP_TOOLCHAIN=stable CARGO_TARGET_DIR=target
  cd $pkgname
  cargo build --frozen --release --all-features
}

check() {
  export RUSTUP_TOOLCHAIN=stable
  cd $pkgname
  cargo test --frozen --all-features
}

package() {
  install -Dm755 "$pkgname/target/release/${pkgname%-git}" -t "$pkgdir/usr/bin"
  install -Dm644 $pkgname/res/logo.png "$pkgdir/usr/share/pixmaps/${pkgname%-git}.png"
}