init: pkgbuild with service file

This commit is contained in:
Virt 2025-05-22 11:22:21 +02:00
commit fb9fd24467
4 changed files with 77 additions and 0 deletions

15
.SRCINFO Normal file
View file

@ -0,0 +1,15 @@
pkgbase = watt
pkgdesc = Modern CPU frequency and power management utility for Linux
pkgver = 0.3.1
pkgrel = 1
url = https://github.com/NotAShelf/watt
arch = x86_64
arch = armv7h
license = MPL-2.0
makedepends = cargo
source = watt-0.3.1.tar.gz::https://github.com/NotAShelf/watt/archive/refs/tags/v0.3.1.tar.gz
source = watt.service
sha256sums = 406834dae5e4734987d5777e207b62cb4e89f7acc992a423215ee38e99d88191
sha256sums = SKIP
pkgname = watt

7
.gitignore vendored Normal file
View file

@ -0,0 +1,7 @@
*
!.gitignore
!PKGBUILD
!.SRCINFO
!watt.service

42
PKGBUILD Normal file
View file

@ -0,0 +1,42 @@
# Maintainer: Virt <virtinstance@gmail.com>
pkgname=watt
pkgver=0.3.1
pkgrel=1
pkgdesc='Modern CPU frequency and power management utility for Linux'
url='https://github.com/NotAShelf/watt'
license=('MPL-2.0')
makedepends=('cargo')
depends=()
arch=('x86_64' 'armv7h')
source=("$pkgname-$pkgver.tar.gz::$url/archive/refs/tags/v$pkgver.tar.gz" "$pkgname.service")
sha256sums=('406834dae5e4734987d5777e207b62cb4e89f7acc992a423215ee38e99d88191' 'SKIP')
prepare() {
cd "$pkgname-$pkgver"
export RUSTUP_TOOLCHAIN=stable
cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
}
build() {
cd "$pkgname-$pkgver"
export RUSTUP_TOOLCHAIN=stable
export CARGO_TARGET_DIR=target
cargo build --frozen --release --all-features
}
package() {
# install custom systemd service adapted from the nix module
install -Dm644 "$pkgname.service" "$pkgdir/usr/lib/systemd/system/$pkgname.service"
cd "$pkgname-$pkgver"
# TODO: revert this
install -Dm0755 "target/release/superfreq" "$pkgdir/usr/bin/$pkgname"
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

13
watt.service Normal file
View file

@ -0,0 +1,13 @@
[Unit]
Description=Modern CPU frequency and power management utility for Linux
Conflicts=auto-cpufreq.service power-profiles-daemon.service tlp.service cpupower-gui.service thermald.service
[Service]
ExecStart=/usr/bin/watt daemon --verbose
Restart=on-failure
RuntimeDirectory=watt
RuntimeDirectoryMode=0755
[Install]
WantedBy=multi-user.target