archrelease: copy trunk to extra-x86_64
[arch-packages.git] / nvidia-utils / repos / testing-x86_64 / PKGBUILD
blob5590907cd2a9c75cfb0c1351c51b98b956dfa54f
1 # Maintainer: Sven-Hendrik Haase <svenstaro@archlinux.org>
2 # Maintainer: Thomas Baechler <thomas@archlinux.org>
3 # Contributor: James Rayner <iphitus@gmail.com>
5 pkgbase=nvidia-utils
6 pkgname=('nvidia-utils' 'opencl-nvidia' 'nvidia-dkms')
7 pkgver=510.68.02
8 pkgrel=1
9 arch=('x86_64')
10 url="http://www.nvidia.com/"
11 license=('custom')
12 options=('!strip')
13 _pkg="NVIDIA-Linux-x86_64-${pkgver}"
14 source=('nvidia-drm-outputclass.conf'
15         'nvidia-utils.sysusers'
16         'nvidia.rules'
17         "https://us.download.nvidia.com/XFree86/Linux-x86_64/${pkgver}/${_pkg}.run")
18 sha512sums=('de7116c09f282a27920a1382df84aa86f559e537664bb30689605177ce37dc5067748acf9afd66a3269a6e323461356592fdfc624c86523bf105ff8fe47d3770'
19             '4b3ad73f5076ba90fe0b3a2e712ac9cde76f469cd8070280f960c3ce7dc502d1927f525ae18d008075c8f08ea432f7be0a6c3a7a6b49c361126dcf42f97ec499'
20             'a0ceb0a6c240cf97b21a2e46c5c212250d3ee24fecef16aca3dffb04b8350c445b9f4398274abccdb745dd0ba5132a17942c9508ce165d4f97f41ece02b0b989'
21             'eb31ed729555075bcc307acc576cb6fdfdd7e397c9e47dd80fc2f55cac6902c3924b69bb91036e5ded1001e81d4b81082ba093dd63d6d97bc313fe78e510131b')
24 create_links() {
25     # create soname links
26     find "$pkgdir" -type f -name '*.so*' ! -path '*xorg/*' -print0 | while read -d $'\0' _lib; do
27         _soname=$(dirname "${_lib}")/$(readelf -d "${_lib}" | grep -Po 'SONAME.*: \[\K[^]]*' || true)
28         _base=$(echo ${_soname} | sed -r 's/(.*)\.so.*/\1.so/')
29         [[ -e "${_soname}" ]] || ln -s $(basename "${_lib}") "${_soname}"
30         [[ -e "${_base}" ]] || ln -s $(basename "${_soname}") "${_base}"
31     done
34 prepare() {
35     sh "${_pkg}.run" --extract-only
36     cd "${_pkg}"
37     bsdtar -xf nvidia-persistenced-init.tar.bz2
39     cd kernel
41     sed -i "s/__VERSION_STRING/${pkgver}/" dkms.conf
42     sed -i 's/__JOBS/`nproc`/' dkms.conf
43     sed -i 's/__DKMS_MODULES//' dkms.conf
44     sed -i '$iBUILT_MODULE_NAME[0]="nvidia"\
45 DEST_MODULE_LOCATION[0]="/kernel/drivers/video"\
46 BUILT_MODULE_NAME[1]="nvidia-uvm"\
47 DEST_MODULE_LOCATION[1]="/kernel/drivers/video"\
48 BUILT_MODULE_NAME[2]="nvidia-modeset"\
49 DEST_MODULE_LOCATION[2]="/kernel/drivers/video"\
50 BUILT_MODULE_NAME[3]="nvidia-drm"\
51 DEST_MODULE_LOCATION[3]="/kernel/drivers/video"\
52 BUILT_MODULE_NAME[4]="nvidia-peermem"\
53 DEST_MODULE_LOCATION[4]="/kernel/drivers/video"' dkms.conf
55     # Gift for linux-rt guys
56     sed -i 's/NV_EXCLUDE_BUILD_MODULES/IGNORE_PREEMPT_RT_PRESENCE=1 NV_EXCLUDE_BUILD_MODULES/' dkms.conf
59 package_opencl-nvidia() {
60     pkgdesc="OpenCL implemention for NVIDIA"
61     depends=('zlib')
62     optdepends=('opencl-headers: headers necessary for OpenCL development')
63     provides=('opencl-driver')
64     cd "${_pkg}"
66     # OpenCL
67     install -Dm644 nvidia.icd "${pkgdir}/etc/OpenCL/vendors/nvidia.icd"
68     install -Dm755 "libnvidia-compiler.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-compiler.so.${pkgver}"
69     install -Dm755 "libnvidia-opencl.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-opencl.so.${pkgver}"
71     create_links
73     mkdir -p "${pkgdir}/usr/share/licenses"
74     ln -s nvidia-utils "${pkgdir}/usr/share/licenses/opencl-nvidia"
77 package_nvidia-dkms() {
78     pkgdesc="NVIDIA drivers - module sources"
79     depends=('dkms' "nvidia-utils=$pkgver" 'libglvnd')
80     provides=('NVIDIA-MODULE')
82     cd ${_pkg}
84     install -dm 755 "${pkgdir}"/usr/src
85     cp -dr --no-preserve='ownership' kernel "${pkgdir}/usr/src/nvidia-${pkgver}"
87     install -Dt "${pkgdir}/usr/share/licenses/${pkgname}" -m644 "${srcdir}/${_pkg}/LICENSE"
90 package_nvidia-utils() {
91     pkgdesc="NVIDIA drivers utilities"
92     depends=('xorg-server' 'libglvnd' 'egl-wayland')
93     optdepends=('nvidia-settings: configuration tool'
94                 'xorg-server-devel: nvidia-xconfig'
95                 'opencl-nvidia: OpenCL support')
96     conflicts=('nvidia-libgl')
97     provides=('vulkan-driver' 'opengl-driver' 'nvidia-libgl')
98     replaces=('nvidia-libgl')
99     install="${pkgname}.install"
101     cd "${_pkg}"
103     # Check http://us.download.nvidia.com/XFree86/Linux-x86_64/${pkgver}/README/installedcomponents.html
104     # for hints on what needs to be installed where.
106     # X driver
107     install -Dm755 nvidia_drv.so "${pkgdir}/usr/lib/xorg/modules/drivers/nvidia_drv.so"
109     # Wayland/GBM
110     install -Dm755 libnvidia-egl-gbm.so.1* -t "${pkgdir}/usr/lib/"
111     install -Dm644 15_nvidia_gbm.json "${pkgdir}/usr/share/egl/egl_external_platform.d/15_nvidia_gbm.json"
112     mkdir -p "${pkgdir}/usr/lib/gbm"
113     ln -sr "${pkgdir}/usr/lib/libnvidia-allocator.so.${pkgver}" "${pkgdir}/usr/lib/gbm/nvidia-drm_gbm.so"
115     # firmware
116     install -Dm644 firmware/gsp.bin "${pkgdir}/usr/lib/firmware/nvidia/${pkgver}/gsp.bin"
118     # GLX extension module for X
119     install -Dm755 "libglxserver_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/nvidia/xorg/libglxserver_nvidia.so.${pkgver}"
120     # Ensure that X finds glx
121     ln -s "libglxserver_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/nvidia/xorg/libglxserver_nvidia.so.1"
122     ln -s "libglxserver_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/nvidia/xorg/libglxserver_nvidia.so"
124     install -Dm755 "libGLX_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/libGLX_nvidia.so.${pkgver}"
126     # OpenGL libraries
127     install -Dm755 "libEGL_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/libEGL_nvidia.so.${pkgver}"
128     install -Dm755 "libGLESv1_CM_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/libGLESv1_CM_nvidia.so.${pkgver}"
129     install -Dm755 "libGLESv2_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/libGLESv2_nvidia.so.${pkgver}"
130     install -Dm644 "10_nvidia.json" "${pkgdir}/usr/share/glvnd/egl_vendor.d/10_nvidia.json"
132     # OpenGL core library
133     install -Dm755 "libnvidia-glcore.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-glcore.so.${pkgver}"
134     install -Dm755 "libnvidia-eglcore.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-eglcore.so.${pkgver}"
135     install -Dm755 "libnvidia-glsi.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-glsi.so.${pkgver}"
137     # misc
138     install -Dm755 "libnvidia-fbc.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-fbc.so.${pkgver}"
139     install -Dm755 "libnvidia-encode.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-encode.so.${pkgver}"
140     install -Dm755 "libnvidia-cfg.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-cfg.so.${pkgver}"
141     install -Dm755 "libnvidia-ml.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-ml.so.${pkgver}"
142     install -Dm755 "libnvidia-glvkspirv.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-glvkspirv.so.${pkgver}"
143     install -Dm755 "libnvidia-allocator.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-allocator.so.${pkgver}"
144     install -Dm755 "libnvidia-vulkan-producer.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-vulkan-producer.so.${pkgver}"
145     # Sigh libnvidia-vulkan-producer.so has no SONAME set so create_links doesn't catch it. NVIDIA please fix!
146     ln -s "libnvidia-vulkan-producer.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-vulkan-producer.so.1"
147     ln -s "libnvidia-vulkan-producer.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-vulkan-producer.so"
149     # Vulkan ICD
150     install -Dm644 "nvidia_icd.json" "${pkgdir}/usr/share/vulkan/icd.d/nvidia_icd.json"
151     install -Dm644 "nvidia_layers.json" "${pkgdir}/usr/share/vulkan/implicit_layer.d/nvidia_layers.json"
153     # VDPAU
154     install -Dm755 "libvdpau_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/vdpau/libvdpau_nvidia.so.${pkgver}"
156     # nvidia-tls library
157     install -Dm755 "libnvidia-tls.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-tls.so.${pkgver}"
159     # CUDA
160     install -Dm755 "libcuda.so.${pkgver}" "${pkgdir}/usr/lib/libcuda.so.${pkgver}"
161     install -Dm755 "libnvcuvid.so.${pkgver}" "${pkgdir}/usr/lib/libnvcuvid.so.${pkgver}"
163     # PTX JIT Compiler (Parallel Thread Execution (PTX) is a pseudo-assembly language for CUDA)
164     install -Dm755 "libnvidia-ptxjitcompiler.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-ptxjitcompiler.so.${pkgver}"
166     # raytracing
167     install -Dm755 "libnvoptix.so.${pkgver}" "${pkgdir}/usr/lib/libnvoptix.so.${pkgver}"
168     install -Dm755 "libnvidia-rtcore.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-rtcore.so.${pkgver}"
170     # NGX
171     install -Dm755 nvidia-ngx-updater "${pkgdir}/usr/bin/nvidia-ngx-updater"
172     install -Dm755 "libnvidia-ngx.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-ngx.so.${pkgver}"
173     install -Dm755 _nvngx.dll "${pkgdir}/usr/lib/nvidia/wine/_nvngx.dll"
174     install -Dm755 nvngx.dll "${pkgdir}/usr/lib/nvidia/wine/nvngx.dll"
176     # Optical flow
177     install -Dm755 "libnvidia-opticalflow.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-opticalflow.so.${pkgver}"
179     # DEBUG
180     install -Dm755 nvidia-debugdump "${pkgdir}/usr/bin/nvidia-debugdump"
182     # nvidia-xconfig
183     install -Dm755 nvidia-xconfig "${pkgdir}/usr/bin/nvidia-xconfig"
184     install -Dm644 nvidia-xconfig.1.gz "${pkgdir}/usr/share/man/man1/nvidia-xconfig.1.gz"
186     # nvidia-bug-report
187     install -Dm755 nvidia-bug-report.sh "${pkgdir}/usr/bin/nvidia-bug-report.sh"
189     # nvidia-smi
190     install -Dm755 nvidia-smi "${pkgdir}/usr/bin/nvidia-smi"
191     install -Dm644 nvidia-smi.1.gz "${pkgdir}/usr/share/man/man1/nvidia-smi.1.gz"
193     # nvidia-cuda-mps
194     install -Dm755 nvidia-cuda-mps-server "${pkgdir}/usr/bin/nvidia-cuda-mps-server"
195     install -Dm755 nvidia-cuda-mps-control "${pkgdir}/usr/bin/nvidia-cuda-mps-control"
196     install -Dm644 nvidia-cuda-mps-control.1.gz "${pkgdir}/usr/share/man/man1/nvidia-cuda-mps-control.1.gz"
198     # nvidia-modprobe
199     # This should be removed if nvidia fixed their uvm module!
200     install -Dm4755 nvidia-modprobe "${pkgdir}/usr/bin/nvidia-modprobe"
201     install -Dm644 nvidia-modprobe.1.gz "${pkgdir}/usr/share/man/man1/nvidia-modprobe.1.gz"
203     # nvidia-persistenced
204     install -Dm755 nvidia-persistenced "${pkgdir}/usr/bin/nvidia-persistenced"
205     install -Dm644 nvidia-persistenced.1.gz "${pkgdir}/usr/share/man/man1/nvidia-persistenced.1.gz"
206     install -Dm644 nvidia-persistenced-init/systemd/nvidia-persistenced.service.template "${pkgdir}/usr/lib/systemd/system/nvidia-persistenced.service"
207     sed -i 's/__USER__/nvidia-persistenced/' "${pkgdir}/usr/lib/systemd/system/nvidia-persistenced.service"
209     # application profiles
210     install -Dm644 nvidia-application-profiles-${pkgver}-rc "${pkgdir}/usr/share/nvidia/nvidia-application-profiles-${pkgver}-rc"
211     install -Dm644 nvidia-application-profiles-${pkgver}-key-documentation "${pkgdir}/usr/share/nvidia/nvidia-application-profiles-${pkgver}-key-documentation"
213     install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/nvidia-utils/LICENSE"
214     install -Dm644 README.txt "${pkgdir}/usr/share/doc/nvidia/README"
215     install -Dm644 NVIDIA_Changelog "${pkgdir}/usr/share/doc/nvidia/NVIDIA_Changelog"
216     cp -r html "${pkgdir}/usr/share/doc/nvidia/"
217     ln -s nvidia "${pkgdir}/usr/share/doc/nvidia-utils"
219     # new power management support
220     install -Dm644 systemd/system/*.service -t "${pkgdir}/usr/lib/systemd/system"
221     install -Dm755 systemd/system-sleep/nvidia "${pkgdir}/usr/lib/systemd/system-sleep/nvidia"
222     install -Dm755 systemd/nvidia-sleep.sh "${pkgdir}/usr/bin/nvidia-sleep.sh"
223     install -Dm755 nvidia-powerd "${pkgdir}/usr/bin/nvidia-powerd"
224     install -Dm644 nvidia-dbus.conf "${pkgdir}"/usr/share/dbus-1/system.d/nvidia-dbus.conf
226     # distro specific files must be installed in /usr/share/X11/xorg.conf.d
227     install -Dm644 "${srcdir}/nvidia-drm-outputclass.conf" "${pkgdir}/usr/share/X11/xorg.conf.d/10-nvidia-drm-outputclass.conf"
229     install -Dm644 "${srcdir}/nvidia-utils.sysusers" "${pkgdir}/usr/lib/sysusers.d/$pkgname.conf"
231     install -Dm644 "${srcdir}/nvidia.rules" "$pkgdir"/usr/lib/udev/rules.d/60-nvidia.rules
233     echo "blacklist nouveau" | install -Dm644 /dev/stdin "${pkgdir}/usr/lib/modprobe.d/${pkgname}.conf"
234     echo "nvidia-uvm" | install -Dm644 /dev/stdin "${pkgdir}/usr/lib/modules-load.d/${pkgname}.conf"
236     create_links