# Maintainer: Lucien Cartier-Tilet <lucien@phundrak.com>
pkgname=pumo-system-info
pkgver=0.1.0.r0.gff90c66
pkgrel=1
pkgdesc="A tiny power manager written in Rust"
arch=('i686' 'x86_64' 'arm' 'armv6h' 'armv7h' 'aarch64')
url="https://labs.phundrak.com/phundrak/pumopm"
license=('GPL3')
depends=()
makedepends=('rustup' 'git')
options=('strip' 'zipman')
source=("$pkgname::git+https://labs.phundrak.com/phundrak/pumo-system-info.git")
sha512sums=('SKIP')

pkgver() {
  cd "$pkgname"
  git describe --tags --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {
  cd "$pkgname"
  if command -v rustup >/dev/null 2>&1; then
    RUSTFLAGS="-C target-cpu=native" rustup run stable cargo build --release
  elif rustc --version | grep -q stable; then
    RUSTFLAGS="-C target-cpu=native" cargo build --release
  else
    cargo build --release
  fi
}

package() {
  cd "$pkgname"
  install -Dm755 "target/release/${pkgname}" "$pkgdir/usr/bin/${pkgname}"
  install -Dm644 "LICENSE" "$pkgdir/usr/share/licenses/${pkgname}/LICENSE"
  install -Dm644 "${pkgname}.1" "$pkgdir/usr/share/man/man1/${pkgname}.1"
}

# vim:set ts=2 sw=2 et:
