blob: 4e0a99bba0f71d9838b6905f3b657d278c326976 (
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
|
# Maintainer: detiam <dehe_tian <at> outlook <dot> com>
# shellcheck disable=SC1090
pkgname=nvidia-patch
pkgver=560.35.03
pkgrel=1
pkgdesc="install or reinstall to apply and update nvidia-patch by keylase, unlock nvfbc and nvenc limit"
arch=('x86_64')
url="https://github.com/keylase/$pkgname"
license=('unknown')
provides=('nvidia-utils-nvlax')
replaces=('nvidia-utils-nvlax')
conflicts=('nvidia-utils-nvlax')
makedepends=('git')
source=("git+$url.git")
sha1sums=('SKIP')
encso=$(readlink -es /lib/libnvidia-encode.so)
fbcso=$(readlink -es /lib/libnvidia-fbc.so)
pkgver() {
encver=$(echo "$encso" | grep -oP '[0-9]..*[0-9]$')
fbcver=$(echo "$fbcso" | grep -oP '[0-9]..*[0-9]$')
if [ "$encver" == "$fbcver" ]; then
if [[ -z $force_nvutils_ver ]]; then
echo "$encver"
else
echo "$force_nvutils_ver"
fi
else
echo 'broken system!!!' >&2
exit 1
fi
}
package() {
depends=("nvidia-utils=$pkgver")
# libnvidia-encode.so
. <(sed -n '/.*patch_list=($/,/^)$/p' $pkgname/patch.sh)
# libnvidia-fbc.so
. <(sed -n '/.*patch_list=($/,/^)$/p' $pkgname/patch-fbc.sh | sed 's|patch_list|fbc_patch_list|')
[ -z "${patch_list[$pkgver]}" ] && error "Upstream haven't update !" && exit 2
[ -z "${fbc_patch_list[$pkgver]}" ] && error "Upstream haven't update !" && exit 2
mkdir -p "$pkgdir/usr/share/libalpm/hooks/"
cat <<- EOF > "$pkgdir/usr/share/libalpm/hooks/nvidia-patch.hook"
[Trigger]
Type = Package
Operation = Install
Operation = Upgrade
Target = ${depends[0]%=*}
Target = ${pkgname}
[Action]
Description = Patching Nvidia libraries...
When = PostTransaction
Exec = /usr/bin/sh -c "sed -i '${patch_list[$pkgver]}' '$encso' ; sed -i '${fbc_patch_list[$pkgver]}' '$fbcso'"
EOF
}
|