db-move: moved xdg-desktop-portal-gnome from [testing] to [extra] (x86_64)
[arch-packages.git] / nvidia-open / trunk / PKGBUILD
blob1773c552c7d4a2aecf92bf1bcb21142803cc002f
1 # Maintainer: Sven-Hendrik Haase <svenstaro@archlinux.org>
2 pkgbase=nvidia-open
3 pkgname=(nvidia-open nvidia-open-dkms)
4 pkgver=530.41.03
5 pkgrel=9
6 pkgdesc="NVIDIA open kernel modules"
7 arch=('x86_64')
8 url="https://github.com/NVIDIA/open-gpu-kernel-modules"
9 depends=("nvidia-utils=${pkgver}" 'libglvnd')
10 makedepends=('linux-headers')
11 license=('GPL')
12 options=('!lto' '!buildflags')
13 source=("$pkgname-$pkgver.tar.gz::https://github.com/NVIDIA/open-gpu-kernel-modules/archive/refs/tags/${pkgver}.tar.gz"
14         nvidia-open-gcc-ibt-sls.patch)
15 sha512sums=('159f913ec6c46ec29f8b9ba7858965f7f4ff34cf5ea5fdf2e48a59b2145a1e113330f574148213a98b475113db920ecde4d5059a31a251c204ee838c662e854e'
16             '263c4c5e75ef8cb8ca2641c022dfaf8bd9222fadf68ed15120b0ae7dd9cc901a04ce2e55625d513a0995759c9d82dfbdc4c33d4751159124915d7404b1400e34')
18 prepare() {
19   cd open-gpu-kernel-modules-${pkgver}
21   # Fix for https://bugs.archlinux.org/task/74886
22   patch -Np1 --no-backup-if-mismatch -i "$srcdir"/nvidia-open-gcc-ibt-sls.patch
24   # Attempt to make this reproducible
25   sed -i "s/^HOSTNAME.*/HOSTNAME = echo archlinux"/ utils.mk
26   sed -i "s/^WHOAMI.*/WHOAMI = echo archlinux-builder"/ utils.mk
27   sed -i "s/^DATE.*/DATE = date -r version.mk"/ utils.mk
29   sed -i "s/__VERSION_STRING/${pkgver}/" kernel-open/dkms.conf
30   sed -i 's/__JOBS/`nproc`/' kernel-open/dkms.conf
31   sed -i 's/__EXCLUDE_MODULES//' kernel-open/dkms.conf
32   sed -i 's/__DKMS_MODULES//' kernel-open/dkms.conf
33   sed -i '$i\
34 BUILT_MODULE_NAME[0]="nvidia"\
35 BUILT_MODULE_LOCATION[0]="kernel-open"\
36 DEST_MODULE_LOCATION[0]="/kernel/drivers/video"\
37 BUILT_MODULE_NAME[1]="nvidia-uvm"\
38 BUILT_MODULE_LOCATION[1]="kernel-open"\
39 DEST_MODULE_LOCATION[1]="/kernel/drivers/video"\
40 BUILT_MODULE_NAME[2]="nvidia-modeset"\
41 BUILT_MODULE_LOCATION[2]="kernel-open"\
42 DEST_MODULE_LOCATION[2]="/kernel/drivers/video"\
43 BUILT_MODULE_NAME[3]="nvidia-drm"\
44 BUILT_MODULE_LOCATION[3]="kernel-open"\
45 DEST_MODULE_LOCATION[3]="/kernel/drivers/video"\
46 BUILT_MODULE_NAME[4]="nvidia-peermem"\
47 BUILT_MODULE_LOCATION[4]="kernel-open"\
48 DEST_MODULE_LOCATION[4]="/kernel/drivers/video"' kernel-open/dkms.conf
50   # Clean version for later copying for DKMS
51   cp -r ../open-gpu-kernel-modules-${pkgver} "$srcdir"/open-gpu-kernel-modules-dkms
54 build() {
55   cd open-gpu-kernel-modules-${pkgver}
56   make SYSSRC="/usr/src/linux"
59 package_nvidia-open() {
60   depends+=('linux')
61   conflicts=('NVIDIA-MODULE')
62   provides=('NVIDIA-MODULE')
64   cd open-gpu-kernel-modules-${pkgver}
65   _extradir="/usr/lib/modules/$(</usr/src/linux/version)/extramodules"
66   install -Dt "${pkgdir}${_extradir}" -m644 kernel-open/*.ko
67   find "${pkgdir}" -name '*.ko' -exec strip --strip-debug {} +
68   find "${pkgdir}" -name '*.ko' -exec xz {} +
70   # Force module to load even on unsupported GPUs
71   mkdir -p "$pkgdir"/usr/lib/modprobe.d
72   echo "options nvidia NVreg_OpenRmEnableUnsupportedGpus=1" > "$pkgdir"/usr/lib/modprobe.d/nvidia-open.conf
74   install -Dm644 COPYING "$pkgdir"/usr/share/licenses/$pkgname
77 package_nvidia-open-dkms() {
78   depends+=('dkms')
79   conflicts=('nvidia-open' 'NVIDIA-MODULE')
80   provides=('nvidia-open' 'NVIDIA-MODULE')
82   install -dm 755 "${pkgdir}"/usr/src
83   # cp -dr --no-preserve='ownership' kernel-open "${pkgdir}/usr/src/nvidia-$pkgver"
84   cp -dr --no-preserve='ownership' open-gpu-kernel-modules-dkms "${pkgdir}/usr/src/nvidia-$pkgver"
85   mv "${pkgdir}/usr/src/nvidia-$pkgver/kernel-open/dkms.conf" "${pkgdir}/usr/src/nvidia-$pkgver/dkms.conf"
87   # Force module to load even on unsupported GPUs
88   mkdir -p "$pkgdir"/usr/lib/modprobe.d
89   echo "options nvidia NVreg_OpenRmEnableUnsupportedGpus=1" > "$pkgdir"/usr/lib/modprobe.d/nvidia-open.conf
91   install -Dm644 open-gpu-kernel-modules-${pkgver}/COPYING "$pkgdir"/usr/share/licenses/$pkgname
94 # vim:set sw=2 et: