summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 5df7f74f8dc574f7513852c16a88a5d0cf50968c (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
# Maintainer: Tony Lambiris <tony@criticalstack.com>

pkgname=system76-power-git
pkgver=r199.9641eaf
pkgrel=1
pkgdesc="System76 Power Management"
arch=('any')
url="https://github.com/pop-os/system76-power"
license=('GPL')
install=system76-power-git.install
conflicts=("system76-power")
provides=("system76-power")
makedepends=('git' 'rust')
depends=('dbus' 'systemd' 'system76-dkms')
source=("${pkgname}::git+https://github.com/pop-os/system76-power.git"
        "graphics.patch")
sha256sums=('SKIP'
            'c44423e11bbe3f045203ef5b836f64151728aec0762d798295a1787092fecf1b')

pkgver() {
    cd ${pkgname}

	printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
    cd ${pkgname}

    patch --no-backup-if-mismatch -Np1 -i ${srcdir}/graphics.patch

    # Fix-up location paths
    find . -type f -exec sed -i -re "s|/usr/lib/system76-driver/|/usr/lib/system76-driver-git/|g" "{}" \;
}

build() {
    cd ${pkgname}

    # Build and install base package
    cargo build --release
}

package() {
    # Install daemons
    install -Dm755 ${srcdir}/${pkgname}/target/release/system76-power ${pkgdir}/usr/bin/system76-power

    # Install systemd unit files
    install -Dm644 ${srcdir}/${pkgname}/debian/system76-power.service ${pkgdir}/usr/lib/systemd/system/system76-power.service

    # Install scripts and configuration
    install -Dm755 ${srcdir}/${pkgname}/data/system76-power.conf ${pkgdir}/usr/share/dbus-1/system.d/system76-power.conf
}