db-move: moved seahorse from [testing] to [extra] (x86_64)
[arch-packages.git] / nvidia-utils / trunk / PKGBUILD
blob0fb7c32144eba8770e02f407bd9c1dc1cc651afe
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=530.41.03
8 pkgrel=1
9 arch=('x86_64')
10 url="http://www.nvidia.com/"
11 license=('custom')
12 options=('!strip')
13 makedepends=('patchelf')
14 _pkg="NVIDIA-Linux-x86_64-${pkgver}"
15 source=('nvidia-drm-outputclass.conf'
16         'nvidia-utils.sysusers'
17         'nvidia.rules'
18         "https://us.download.nvidia.com/XFree86/Linux-x86_64/${pkgver}/${_pkg}.run")
19 sha512sums=('de7116c09f282a27920a1382df84aa86f559e537664bb30689605177ce37dc5067748acf9afd66a3269a6e323461356592fdfc624c86523bf105ff8fe47d3770'
20             '4b3ad73f5076ba90fe0b3a2e712ac9cde76f469cd8070280f960c3ce7dc502d1927f525ae18d008075c8f08ea432f7be0a6c3a7a6b49c361126dcf42f97ec499'
21             'a0ceb0a6c240cf97b21a2e46c5c212250d3ee24fecef16aca3dffb04b8350c445b9f4398274abccdb745dd0ba5132a17942c9508ce165d4f97f41ece02b0b989'
22             '90068122824322884ec8f3e4be2fe7f76bf07ee1163baf6da15d09ba3ff886e5c5ef72016509eef9f4af9d85f154ebbe051d5fb3af5e867f1f67f03af8068100')
25 create_links() {
26     # create soname links
27     find "$pkgdir" -type f -name '*.so*' ! -path '*xorg/*' -print0 | while read -d $'\0' _lib; do
28         _soname=$(dirname "${_lib}")/$(readelf -d "${_lib}" | grep -Po 'SONAME.*: \[\K[^]]*' || true)
29         _base=$(echo ${_soname} | sed -r 's/(.*)\.so.*/\1.so/')
30         [[ -e "${_soname}" ]] || ln -s $(basename "${_lib}") "${_soname}"
31         [[ -e "${_base}" ]] || ln -s $(basename "${_soname}") "${_base}"
32     done
35 prepare() {
36     sh "${_pkg}.run" --extract-only
37     cd "${_pkg}"
38     bsdtar -xf nvidia-persistenced-init.tar.bz2
40     cd kernel
42     sed -i "s/__VERSION_STRING/${pkgver}/" dkms.conf
43     sed -i 's/__JOBS/`nproc`/' dkms.conf
44     sed -i 's/__DKMS_MODULES//' dkms.conf
45     sed -i '$iBUILT_MODULE_NAME[0]="nvidia"\
46 DEST_MODULE_LOCATION[0]="/kernel/drivers/video"\
47 BUILT_MODULE_NAME[1]="nvidia-uvm"\
48 DEST_MODULE_LOCATION[1]="/kernel/drivers/video"\
49 BUILT_MODULE_NAME[2]="nvidia-modeset"\
50 DEST_MODULE_LOCATION[2]="/kernel/drivers/video"\
51 BUILT_MODULE_NAME[3]="nvidia-drm"\
52 DEST_MODULE_LOCATION[3]="/kernel/drivers/video"\
53 BUILT_MODULE_NAME[4]="nvidia-peermem"\
54 DEST_MODULE_LOCATION[4]="/kernel/drivers/video"' dkms.conf
56     # Gift for linux-rt guys
57     sed -i 's/NV_EXCLUDE_BUILD_MODULES/IGNORE_PREEMPT_RT_PRESENCE=1 NV_EXCLUDE_BUILD_MODULES/' dkms.conf
60 package_opencl-nvidia() {
61     pkgdesc="OpenCL implemention for NVIDIA"
62     depends=('zlib')
63     optdepends=('opencl-headers: headers necessary for OpenCL development')
64     provides=('opencl-driver')
65     cd "${_pkg}"
67     # OpenCL
68     install -Dm644 nvidia.icd "${pkgdir}/etc/OpenCL/vendors/nvidia.icd"
69     install -Dm755 "libnvidia-compiler.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-compiler.so.${pkgver}"
70     install -Dm755 "libnvidia-opencl.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-opencl.so.${pkgver}"
72     create_links
74     mkdir -p "${pkgdir}/usr/share/licenses"
75     ln -s nvidia-utils "${pkgdir}/usr/share/licenses/opencl-nvidia"
78 package_nvidia-dkms() {
79     pkgdesc="NVIDIA drivers - module sources"
80     depends=('dkms' "nvidia-utils=$pkgver" 'libglvnd')
81     provides=('NVIDIA-MODULE' 'nvidia')
82     conflicts=('NVIDIA-MODULE' 'nvidia')
84     cd ${_pkg}
86     install -dm 755 "${pkgdir}"/usr/src
87     cp -dr --no-preserve='ownership' kernel "${pkgdir}/usr/src/nvidia-${pkgver}"
89     install -Dt "${pkgdir}/usr/share/licenses/${pkgname}" -m644 "${srcdir}/${_pkg}/LICENSE"
92 package_nvidia-utils() {
93     pkgdesc="NVIDIA drivers utilities"
94     depends=('xorg-server' 'libglvnd' 'egl-wayland')
95     optdepends=('nvidia-settings: configuration tool'
96                 'xorg-server-devel: nvidia-xconfig'
97                 'opencl-nvidia: OpenCL support')
98     conflicts=('nvidia-libgl')
99     provides=('vulkan-driver' 'opengl-driver' 'nvidia-libgl')
100     replaces=('nvidia-libgl')
101     install="${pkgname}.install"
103     cd "${_pkg}"
105     # Check http://us.download.nvidia.com/XFree86/Linux-x86_64/${pkgver}/README/installedcomponents.html
106     # for hints on what needs to be installed where.
108     # X driver
109     install -Dm755 nvidia_drv.so "${pkgdir}/usr/lib/xorg/modules/drivers/nvidia_drv.so"
111     # Wayland/GBM
112     install -Dm755 libnvidia-egl-gbm.so.1* -t "${pkgdir}/usr/lib/"
113     install -Dm644 15_nvidia_gbm.json "${pkgdir}/usr/share/egl/egl_external_platform.d/15_nvidia_gbm.json"
114     mkdir -p "${pkgdir}/usr/lib/gbm"
115     ln -sr "${pkgdir}/usr/lib/libnvidia-allocator.so.${pkgver}" "${pkgdir}/usr/lib/gbm/nvidia-drm_gbm.so"
117     # firmware
118     install -Dm644 -t "${pkgdir}/usr/lib/firmware/nvidia/${pkgver}/" firmware/*.bin
120     # GLX extension module for X
121     install -Dm755 "libglxserver_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/nvidia/xorg/libglxserver_nvidia.so.${pkgver}"
122     # Ensure that X finds glx
123     ln -s "libglxserver_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/nvidia/xorg/libglxserver_nvidia.so.1"
124     ln -s "libglxserver_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/nvidia/xorg/libglxserver_nvidia.so"
126     install -Dm755 "libGLX_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/libGLX_nvidia.so.${pkgver}"
128     # OpenGL libraries
129     install -Dm755 "libEGL_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/libEGL_nvidia.so.${pkgver}"
130     install -Dm755 "libGLESv1_CM_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/libGLESv1_CM_nvidia.so.${pkgver}"
131     install -Dm755 "libGLESv2_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/libGLESv2_nvidia.so.${pkgver}"
132     install -Dm644 "10_nvidia.json" "${pkgdir}/usr/share/glvnd/egl_vendor.d/10_nvidia.json"
134     # OpenGL core library
135     install -Dm755 "libnvidia-glcore.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-glcore.so.${pkgver}"
136     install -Dm755 "libnvidia-eglcore.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-eglcore.so.${pkgver}"
137     install -Dm755 "libnvidia-glsi.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-glsi.so.${pkgver}"
139     # misc
140     install -Dm755 "libnvidia-api.so.1" "${pkgdir}/usr/lib/libnvidia-api.so.1"
141     install -Dm755 "libnvidia-fbc.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-fbc.so.${pkgver}"
142     install -Dm755 "libnvidia-encode.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-encode.so.${pkgver}"
143     install -Dm755 "libnvidia-cfg.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-cfg.so.${pkgver}"
144     install -Dm755 "libnvidia-ml.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-ml.so.${pkgver}"
145     install -Dm755 "libnvidia-glvkspirv.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-glvkspirv.so.${pkgver}"
146     install -Dm755 "libnvidia-allocator.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-allocator.so.${pkgver}"
147     install -Dm755 "libnvidia-vulkan-producer.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-vulkan-producer.so.${pkgver}"
148     # Sigh libnvidia-vulkan-producer.so has no SONAME set so create_links doesn't catch it. NVIDIA please fix!
149     patchelf --set-soname "libnvidia-vulkan-producer.so.1" "${pkgdir}/usr/lib/libnvidia-vulkan-producer.so.${pkgver}"
151     # Vulkan ICD
152     install -Dm644 "nvidia_icd.json" "${pkgdir}/usr/share/vulkan/icd.d/nvidia_icd.json"
153     install -Dm644 "nvidia_layers.json" "${pkgdir}/usr/share/vulkan/implicit_layer.d/nvidia_layers.json"
155     # VDPAU
156     install -Dm755 "libvdpau_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/vdpau/libvdpau_nvidia.so.${pkgver}"
158     # nvidia-tls library
159     install -Dm755 "libnvidia-tls.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-tls.so.${pkgver}"
161     # CUDA
162     install -Dm755 "libcuda.so.${pkgver}" "${pkgdir}/usr/lib/libcuda.so.${pkgver}"
163     install -Dm755 "libnvcuvid.so.${pkgver}" "${pkgdir}/usr/lib/libnvcuvid.so.${pkgver}"
164     install -Dm755 "libcudadebugger.so.${pkgver}" "${pkgdir}/usr/lib/libcudadebugger.so.${pkgver}"
166     # NVVM Compiler library loaded by the CUDA driver to do JIT link-time-optimization
167     install -Dm644 "libnvidia-nvvm.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-nvvm.so.${pkgver}"
169     # PTX JIT Compiler (Parallel Thread Execution (PTX) is a pseudo-assembly language for CUDA)
170     install -Dm755 "libnvidia-ptxjitcompiler.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-ptxjitcompiler.so.${pkgver}"
172     # raytracing
173     install -Dm755 "libnvoptix.so.${pkgver}" "${pkgdir}/usr/lib/libnvoptix.so.${pkgver}"
174     install -Dm755 "libnvidia-rtcore.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-rtcore.so.${pkgver}"
176     # NGX
177     install -Dm755 nvidia-ngx-updater "${pkgdir}/usr/bin/nvidia-ngx-updater"
178     install -Dm755 "libnvidia-ngx.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-ngx.so.${pkgver}"
179     install -Dm755 _nvngx.dll "${pkgdir}/usr/lib/nvidia/wine/_nvngx.dll"
180     install -Dm755 nvngx.dll "${pkgdir}/usr/lib/nvidia/wine/nvngx.dll"
182     # Optical flow
183     install -Dm755 "libnvidia-opticalflow.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-opticalflow.so.${pkgver}"
185     # Debug
186     install -Dm755 nvidia-debugdump "${pkgdir}/usr/bin/nvidia-debugdump"
188     # nvidia-xconfig
189     install -Dm755 nvidia-xconfig "${pkgdir}/usr/bin/nvidia-xconfig"
190     install -Dm644 nvidia-xconfig.1.gz "${pkgdir}/usr/share/man/man1/nvidia-xconfig.1.gz"
192     # nvidia-bug-report
193     install -Dm755 nvidia-bug-report.sh "${pkgdir}/usr/bin/nvidia-bug-report.sh"
195     # nvidia-smi
196     install -Dm755 nvidia-smi "${pkgdir}/usr/bin/nvidia-smi"
197     install -Dm644 nvidia-smi.1.gz "${pkgdir}/usr/share/man/man1/nvidia-smi.1.gz"
199     # nvidia-cuda-mps
200     install -Dm755 nvidia-cuda-mps-server "${pkgdir}/usr/bin/nvidia-cuda-mps-server"
201     install -Dm755 nvidia-cuda-mps-control "${pkgdir}/usr/bin/nvidia-cuda-mps-control"
202     install -Dm644 nvidia-cuda-mps-control.1.gz "${pkgdir}/usr/share/man/man1/nvidia-cuda-mps-control.1.gz"
204     # nvidia-modprobe
205     # This should be removed if nvidia fixed their uvm module!
206     install -Dm4755 nvidia-modprobe "${pkgdir}/usr/bin/nvidia-modprobe"
207     install -Dm644 nvidia-modprobe.1.gz "${pkgdir}/usr/share/man/man1/nvidia-modprobe.1.gz"
209     # nvidia-persistenced
210     install -Dm755 nvidia-persistenced "${pkgdir}/usr/bin/nvidia-persistenced"
211     install -Dm644 nvidia-persistenced.1.gz "${pkgdir}/usr/share/man/man1/nvidia-persistenced.1.gz"
212     install -Dm644 nvidia-persistenced-init/systemd/nvidia-persistenced.service.template "${pkgdir}/usr/lib/systemd/system/nvidia-persistenced.service"
213     sed -i 's/__USER__/nvidia-persistenced/' "${pkgdir}/usr/lib/systemd/system/nvidia-persistenced.service"
215     # application profiles
216     install -Dm644 nvidia-application-profiles-${pkgver}-rc "${pkgdir}/usr/share/nvidia/nvidia-application-profiles-${pkgver}-rc"
217     install -Dm644 nvidia-application-profiles-${pkgver}-key-documentation "${pkgdir}/usr/share/nvidia/nvidia-application-profiles-${pkgver}-key-documentation"
219     install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/nvidia-utils/LICENSE"
220     install -Dm644 README.txt "${pkgdir}/usr/share/doc/nvidia/README"
221     install -Dm644 NVIDIA_Changelog "${pkgdir}/usr/share/doc/nvidia/NVIDIA_Changelog"
222     cp -r html "${pkgdir}/usr/share/doc/nvidia/"
223     ln -s nvidia "${pkgdir}/usr/share/doc/nvidia-utils"
225     # new power management support
226     install -Dm644 systemd/system/*.service -t "${pkgdir}/usr/lib/systemd/system"
227     install -Dm755 systemd/system-sleep/nvidia "${pkgdir}/usr/lib/systemd/system-sleep/nvidia"
228     install -Dm755 systemd/nvidia-sleep.sh "${pkgdir}/usr/bin/nvidia-sleep.sh"
229     install -Dm755 nvidia-powerd "${pkgdir}/usr/bin/nvidia-powerd"
230     install -Dm644 nvidia-dbus.conf "${pkgdir}"/usr/share/dbus-1/system.d/nvidia-dbus.conf
232     # distro specific files must be installed in /usr/share/X11/xorg.conf.d
233     install -Dm644 "${srcdir}/nvidia-drm-outputclass.conf" "${pkgdir}/usr/share/X11/xorg.conf.d/10-nvidia-drm-outputclass.conf"
235     install -Dm644 "${srcdir}/nvidia-utils.sysusers" "${pkgdir}/usr/lib/sysusers.d/$pkgname.conf"
237     install -Dm644 "${srcdir}/nvidia.rules" "$pkgdir"/usr/lib/udev/rules.d/60-nvidia.rules
239     echo "blacklist nouveau" | install -Dm644 /dev/stdin "${pkgdir}/usr/lib/modprobe.d/${pkgname}.conf"
240     echo "nvidia-uvm" | install -Dm644 /dev/stdin "${pkgdir}/usr/lib/modules-load.d/${pkgname}.conf"
242     create_links