summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: dddb934eaaa9c22d3d97a3d71356c9ebd5917fe7 (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
# Maintainer: Mario Oenning <mo-son at mailbox dot org>
# Author: Leonardo Gates

_pkgbase=ryzen_smu
pkgname=ryzen_smu-dkms-git
pkgver=162.e61177d
pkgrel=1
pkgdesc="A Linux kernel driver that exposes access to the SMU (System Management Unit) for certain AMD Ryzen Processors"
arch=('x86_64')
url="https://gitlab.com/leogx9r/ryzen_smu"
license=('GPL2')
depends=('dkms')
makedepends=('git')
provides=('ryzen_smu' 'ryzen_smu-dkms')
conflicts=('ryzen_smu' 'ryzen_smu-dkms')
install=$_pkgbase.install

source=("$_pkgbase::git+$url.git"
        "dkms.conf"
        "$_pkgbase.conf"
        "rembrandt_phoenix_pm.patch")

sha256sums=('SKIP'
            '0ced27963dac8e270221574d0c2b686bbbb012e3af8741188800f9cb6b7d8e63'
            'a48f5c846ca5fd8f185f1317c8001c97f59ac432392d53b581802c7761b9360f'
            '5dc79846385ff0fe8a67cc4145d272dfc82fd311d1a5eec7f591204cb97b2a24')

pkgver() {
  cd "$srcdir/$_pkgbase"
  printf "%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
  cd "$srcdir/$_pkgbase"
  
  # Add Rembrandt and Phoenix PM table support
  # https://gitlab.com/leogx9r/ryzen_smu/-/merge_requests/12#b9c3a4741719467e41acac27f3d11fea3a6c02ff
  patch -Np1 -i "$srcdir"/rembrandt_phoenix_pm.patch

  rm -rf scripts/ pics/ README.md
}

build() {
  cd "$srcdir/$_pkgbase"
  make -C userspace
}

package() {
  cd "$srcdir/$_pkgbase"

  install -d "${pkgdir}"/usr/src/${_pkgbase}-${pkgver}/
  cp ${srcdir}/${_pkgbase}/{LICENSE,Makefile,dkms.conf,drv.c,smu.c,smu.h} "${pkgdir}"/usr/src/${_pkgbase}-${pkgver}/

  install -Dm644 ${srcdir}/dkms.conf "${pkgdir}"/usr/src/${_pkgbase}-${pkgver}/dkms.conf

  sed -e "s/@_PKGBASE@/${_pkgbase}/" \
    -e "s/@PKGVER@/${pkgver}/" \
    -i "${pkgdir}"/usr/src/${_pkgbase}-${pkgver}/dkms.conf

  install -Dm644 ${srcdir}/${_pkgbase}.conf "${pkgdir}"/usr/lib/depmod.d/${_pkgbase}.conf
  
  install -Dm700 ${srcdir}/${_pkgbase}/userspace/monitor_cpu "${pkgdir}"/usr/bin/monitor_cpu
}