summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 569203206edeb17af1918335c10f6a4bbf0826db (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
58
59
60
61
62
63
64
65
66
67
68
# Maintainer: Callum Osmotherly <acheronfail@gmail.com>
pkgname=i3stat
pkgver=0.13.1
pkgrel=1
pkgdesc="A lightweight and batteries-included status_command for i3 and sway"
arch=('x86_64')
url="https://github.com/acheronfail/i3stat"
license=('GPL-3.0-only')
conflicts=('i3stat-bin' 'i3stat-git')
depends=('gcc-libs')
makedepends=('clang' 'dbus' 'dunst' 'libfaketime' 'libpulse' 'i3-wm' 'imagemagick' 'scrot' 'xorg-server-xvfb')
source=("$pkgname-$pkgver.tar.gz::https://static.crates.io/crates/$pkgname/$pkgname-${pkgver//_/-}.crate")
sha512sums=('97a3653cacbfe54d7bae1e6a0297da5585b2e676aa81ed45b1b7975730faf69f8fdb0716d4af7a18fee24275d645ba8f0de02e5c17f8f453b8b28175aa70dff8')

# this is effectively a no-op for standard usages of the PKGBUILD, but it exists for
# local testing of the PKGBUILD itself in the upstream repository (when the build version
# doesn't match the PKGBUILD because it hasn't been released yet)
prepare() {
  _dirname=$(bsdtar -tf "${source[0]%%::*}" | awk -F / '{print $1; exit}')
  mv "$_dirname" "_$pkgname-$pkgver"
}

build() {
  cd "_$pkgname-$pkgver"

  # builds all the crate's binaries
  cargo build --release --locked

  # the manpages are generated by the tests
  cargo test --release --locked manpage
}

check() {
  cd "_$pkgname-$pkgver"

  dbus-run-session -- env I3STAT_TEST=1 cargo test --release --locked
}

package() {
  cd "_$pkgname-$pkgver"

  install -Dm755 "target/release/i3stat"         "$pkgdir/usr/bin/i3stat"
  install -Dm755 "target/release/i3stat-ipc"     "$pkgdir/usr/bin/i3stat-ipc"
  install -Dm755 "target/release/i3stat-acpi"    "$pkgdir/usr/bin/i3stat-acpi"
  install -Dm755 "target/release/i3stat-signals" "$pkgdir/usr/bin/i3stat-signals"
  install -Dm755 "target/release/i3stat-sensors" "$pkgdir/usr/bin/i3stat-sensors"

  install -Dm644 "doc/i3stat.1"                 "$pkgdir/usr/share/man/man1/i3stat.1"
  install -Dm644 "doc/i3stat-acpi.1"            "$pkgdir/usr/share/man/man1/i3stat-acpi.1"
  install -Dm644 "doc/i3stat-ipc.1"             "$pkgdir/usr/share/man/man1/i3stat-ipc.1"
  install -Dm644 "doc/i3stat-ipc-click.1"       "$pkgdir/usr/share/man/man1/i3stat-ipc-click.1"
  install -Dm644 "doc/i3stat-ipc-custom.1"      "$pkgdir/usr/share/man/man1/i3stat-ipc-custom.1"
  install -Dm644 "doc/i3stat-ipc-get-bar.1"     "$pkgdir/usr/share/man/man1/i3stat-ipc-get-bar.1"
  install -Dm644 "doc/i3stat-ipc-get-config.1"  "$pkgdir/usr/share/man/man1/i3stat-ipc-get-config.1"
  install -Dm644 "doc/i3stat-ipc-get-theme.1"   "$pkgdir/usr/share/man/man1/i3stat-ipc-get-theme.1"
  install -Dm644 "doc/i3stat-ipc-info.1"        "$pkgdir/usr/share/man/man1/i3stat-ipc-info.1"
  install -Dm644 "doc/i3stat-ipc-refresh-all.1" "$pkgdir/usr/share/man/man1/i3stat-ipc-refresh-all.1"
  install -Dm644 "doc/i3stat-ipc-set-theme.1"   "$pkgdir/usr/share/man/man1/i3stat-ipc-set-theme.1"
  install -Dm644 "doc/i3stat-ipc-shutdown.1"    "$pkgdir/usr/share/man/man1/i3stat-ipc-shutdown.1"
  install -Dm644 "doc/i3stat-ipc-signal.1"      "$pkgdir/usr/share/man/man1/i3stat-ipc-signal.1"
  install -Dm644 "doc/i3stat-sensors.1"         "$pkgdir/usr/share/man/man1/i3stat-sensors.1"
  install -Dm644 "doc/i3stat-signals.1"         "$pkgdir/usr/share/man/man1/i3stat-signals.1"

  install -Dm644 "README.md"                   "$pkgdir/usr/share/doc/${pkgname}/README.md"
  install -Dm644 "sample_config.toml"          "$pkgdir/usr/share/doc/${pkgname}/sample_config.toml"
  install -Dm644 "sample_included_config.toml" "$pkgdir/usr/share/doc/${pkgname}/sample_included_config.toml"
  install -Dm644 "LICENSE"                     "$pkgdir/usr/share/licenses/${pkgname}/LICENSE"
}