summarylogtreecommitdiffstats
path: root/PKGBUILD
diff options
context:
space:
mode:
authorJennifer Zhou2024-04-20 22:28:37 +0000
committerJennifer Zhou2024-04-20 23:23:17 +0000
commit7d47d6672dba245e62dde40200530e5d847472ae (patch)
treee83d4bc2cdfd6ee1a1f9eb96f0b0e9de7f2b48ee /PKGBUILD
downloadaur-7d47d6672dba245e62dde40200530e5d847472ae.tar.gz
initial
Diffstat (limited to 'PKGBUILD')
-rw-r--r--PKGBUILD75
1 files changed, 75 insertions, 0 deletions
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..0080648db068
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,75 @@
+# Maintainer : Jennifer Zhou <jennifer@jezh.me>
+# Contributor : Daniel Bermond <dbermond@archlinux.org>
+
+pkgbase=nvidia-open-tinygrad-git
+pkgname='nvidia-open-tinygrad-dkms-git'
+pkgver=550.76.r0.gea4c27fad
+pkgrel=1
+pkgdesc='NVIDIA open GPU kernel modules (tinygrad git version)'
+arch=('x86_64')
+url='https://github.com/tinygrad/open-gpu-kernel-modules'
+license=('MIT' 'GPL-2.0-only')
+makedepends=('git' 'linux-headers')
+options=('!buildflags' '!lto' '!strip')
+source=('git+https://github.com/NVIDIA/open-gpu-kernel-modules.git'
+ '100-nvidia-open-tinygrad.patch'
+ '110-nvidia-open-change-dkms-conf.patch'
+ '120-nvidia-open-linux-rt-gift.patch'
+ '130-nvidia-open-reproducible-build.patch'
+ '140-nvidia-open-gcc-sls.patch')
+sha256sums=('SKIP'
+ 'a4a599629c96b7b2f7cdd496fec8f406ea4a4ea5ab30663cae09856618801a63'
+ '009724e2e07b7be589ba455f225a9742d88a3a29383f2f220cb830ef4c8b7aea'
+ 'b0f62a78f749ff3a104197c12b6d885352adcf35fb5ecf00c4cd4c51b4195e45'
+ '15421d72aabc569c69762c77c7a37ad7be617f08e3c833318cecdeb5500e8ef4'
+ '71158935db9494bf8a18c34b29e2be19424ba09ce3017b9d9d7b6509f6090118')
+
+prepare() {
+ patch -d open-gpu-kernel-modules -Np1 -i "${srcdir}/100-nvidia-open-tinygrad.patch"
+ patch -d open-gpu-kernel-modules -Np1 -i "${srcdir}/110-nvidia-open-change-dkms-conf.patch"
+ patch -d open-gpu-kernel-modules -Np1 -i "${srcdir}/120-nvidia-open-linux-rt-gift.patch"
+ patch -d open-gpu-kernel-modules -Np1 -i "${srcdir}/130-nvidia-open-reproducible-build.patch"
+ patch -d open-gpu-kernel-modules -Np1 -i "${srcdir}/140-nvidia-open-gcc-sls.patch"
+
+ sed -i "s/__VERSION_STRING/${pkgver}/" open-gpu-kernel-modules/kernel-open/dkms.conf
+
+ [ -d dkms-src ] && rm -rf dkms-src
+ cp -af open-gpu-kernel-modules/kernel-open dkms-src
+}
+
+pkgver() {
+ git -C open-gpu-kernel-modules describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/^v//'
+}
+
+build() {
+ sed -i "s/__VERSION_STRING/${pkgver}/" {open-gpu-kernel-modules/kernel-open,dkms-src}/dkms.conf
+
+ local -x KERNEL_UNAME
+
+ # allow usage of custom kernel and building in a chroot
+ if [ -d "/usr/lib/modules/$(uname -r)" ]; then
+ KERNEL_UNAME="$(uname -r)"
+ else
+ KERNEL_UNAME="$(find /usr/lib/modules -mindepth 1 -maxdepth 1 -type d | sed -n 's|.*/||;1p')"
+ fi
+
+ unset -v SYSSRC
+ make -C open-gpu-kernel-modules modules
+}
+
+package() {
+ pkgdesc="$(sed 's/(\(git[[:space:]]version\)/(sources; \1/' <<<"$pkgdesc")"
+ depends=('dkms' 'libglvnd' "nvidia-utils>=$(sed 's/\.r.*//;s/\.[^\.]*$//' <<<"$pkgver")")
+ provides=("nvidia-open=${pkgver}" 'NVIDIA-MODULE')
+ conflicts=('nvidia-open' 'NVIDIA-MODULE')
+
+ install -D -m644 open-gpu-kernel-modules/src/nvidia/_out/Linux_x86_64/nv-kernel.o \
+ dkms-src/nvidia/nv-kernel.o_binary
+ install -D -m644 open-gpu-kernel-modules/src/nvidia-modeset/_out/Linux_x86_64/nv-modeset-kernel.o \
+ dkms-src/nvidia-modeset/nv-modeset-kernel.o_binary
+ install -d -m755 "${pkgdir}/usr/src"
+ cp -dr --no-preserve='ownership' dkms-src "${pkgdir}/usr/src/nvidia-${pkgver}"
+ install -D -m644 open-gpu-kernel-modules/COPYING "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
+
+ install -D -m644 <(printf '%s\n' 'options nvidia NVreg_OpenRmEnableUnsupportedGpus=1') "${pkgdir}/usr/lib/modprobe.d/nvidia-open.conf"
+}