summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 27c590e8e0acde8f810376521e7e5ed714de35bb (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
# Maintainer: Arne BrĂ¼cher <archlinux[at]arne-bruecher[dot]de>
# Contributor: Ewout van Mansom <ewout@vanmansom.name>

pkgname=amdfand-git
pkgver=1.0.12.r15.g2d20203
pkgrel=2
pkgdesc="AMDGPU fan speed management tool"
url="https://github.com/Eraden/amdgpud"
license=('MIT' 'Apache-2.0')
source=("amdfand::git+https://github.com/Eraden/amdgpud.git")
arch=('x86_64')
conflicts=('amdfand-bin' 'amdfand')
provides=('amdfand')
sha512sums=('SKIP')
makedepends=('git' 'cargo')
optdepends=('amdguid-glow' 'amdguid-wayland')

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

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

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

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

package() {
  cd "${pkgname%-git}"
  install -D -m 0755 -t "$pkgdir/usr/bin/" "target/release/${pkgname%-git}"
  install -D -m 0755 -t "$pkgdir/usr/lib/systemd/system" "services/amdfand.service"
}