archrelease: copy trunk to extra-x86_64
[arch-packages.git] / nvidia-utils / trunk / PKGBUILD
blobdafef6e41a6c56e72097487d10851a7576fa8657
1 # Maintainer: Sven-Hendrik Haase <svenstaro@gmail.com>
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=495.44
8 pkgrel=6
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             'bc9054e6028ba172906e6eb9a0b8f5cfc3ae74d57f3e95e0f9057879e3af07a4b19479e80d81e948872bc47bbd674f77f5f81d4debd2e2c3ce45058cd9211802')
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
40     sed -i "s/__VERSION_STRING/${pkgver}/" dkms.conf
41     sed -i 's/__JOBS/`nproc`/' dkms.conf
42     sed -i 's/__DKMS_MODULES//' dkms.conf
43     sed -i '$iBUILT_MODULE_NAME[0]="nvidia"\
44 DEST_MODULE_LOCATION[0]="/kernel/drivers/video"\
45 BUILT_MODULE_NAME[1]="nvidia-uvm"\
46 DEST_MODULE_LOCATION[1]="/kernel/drivers/video"\
47 BUILT_MODULE_NAME[2]="nvidia-modeset"\
48 DEST_MODULE_LOCATION[2]="/kernel/drivers/video"\
49 BUILT_MODULE_NAME[3]="nvidia-drm"\
50 DEST_MODULE_LOCATION[3]="/kernel/drivers/video"\
51 BUILT_MODULE_NAME[4]="nvidia-peermem"\
52 DEST_MODULE_LOCATION[4]="/kernel/drivers/video"' dkms.conf
54     # Gift for linux-rt guys
55     sed -i 's/NV_EXCLUDE_BUILD_MODULES/IGNORE_PREEMPT_RT_PRESENCE=1 NV_EXCLUDE_BUILD_MODULES/' dkms.conf
58 package_opencl-nvidia() {
59     pkgdesc="OpenCL implemention for NVIDIA"
60     depends=('zlib')
61     optdepends=('opencl-headers: headers necessary for OpenCL development')
62     provides=('opencl-driver')
63     cd "${_pkg}"
65     # OpenCL
66     install -Dm644 nvidia.icd "${pkgdir}/etc/OpenCL/vendors/nvidia.icd"
67     install -Dm755 "libnvidia-compiler.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-compiler.so.${pkgver}"
68     install -Dm755 "libnvidia-opencl.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-opencl.so.${pkgver}"
70     create_links
72     mkdir -p "${pkgdir}/usr/share/licenses"
73     ln -s nvidia-utils "${pkgdir}/usr/share/licenses/opencl-nvidia"
76 package_nvidia-dkms() {
77     pkgdesc="NVIDIA drivers - module sources"
78     depends=('dkms' "nvidia-utils=$pkgver" 'libglvnd')
79     provides=('NVIDIA-MODULE')
81     cd ${_pkg}
83     install -dm 755 "${pkgdir}"/usr/src
84     cp -dr --no-preserve='ownership' kernel "${pkgdir}/usr/src/nvidia-${pkgver}"
86     install -Dt "${pkgdir}/usr/share/licenses/${pkgname}" -m644 "${srcdir}/${_pkg}/LICENSE"
89 package_nvidia-utils() {
90     pkgdesc="NVIDIA drivers utilities"
91     depends=('xorg-server' 'libglvnd' 'egl-wayland')
92     optdepends=('nvidia-settings: configuration tool'
93                 'xorg-server-devel: nvidia-xconfig'
94                 'opencl-nvidia: OpenCL support')
95     conflicts=('nvidia-libgl')
96     provides=('vulkan-driver' 'opengl-driver' 'nvidia-libgl')
97     replaces=('nvidia-libgl')
98     install="${pkgname}.install"
100     cd "${_pkg}"
102     # Check http://us.download.nvidia.com/XFree86/Linux-x86_64/${pkgver}/README/installedcomponents.html
103     # for hints on what needs to be installed where.
105     # X driver
106     install -Dm755 nvidia_drv.so "${pkgdir}/usr/lib/xorg/modules/drivers/nvidia_drv.so"
108     # Wayland/GBM
109     install -Dm755 libnvidia-egl-gbm.so.1* -t "${pkgdir}/usr/lib/"
110     install -Dm644 15_nvidia_gbm.json "${pkgdir}/usr/share/egl/egl_external_platform.d/15_nvidia_gbm.json"
111     mkdir -p "${pkgdir}/usr/lib/gbm"
112     ln -sr "${pkgdir}/usr/lib/libnvidia-allocator.so.${pkgver}" "${pkgdir}/usr/lib/gbm/nvidia-drm_gbm.so"
114     # firmware
115     install -Dm644 firmware/gsp.bin "${pkgdir}/usr/lib/firmware/nvidia/${pkgver}/gsp.bin"
117     # GLX extension module for X
118     install -Dm755 "libglxserver_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/nvidia/xorg/libglxserver_nvidia.so.${pkgver}"
119     # Ensure that X finds glx
120     ln -s "libglxserver_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/nvidia/xorg/libglxserver_nvidia.so.1"
121     ln -s "libglxserver_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/nvidia/xorg/libglxserver_nvidia.so"
123     install -Dm755 "libGLX_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/libGLX_nvidia.so.${pkgver}"
125     # OpenGL libraries
126     install -Dm755 "libEGL_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/libEGL_nvidia.so.${pkgver}"
127     install -Dm755 "libGLESv1_CM_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/libGLESv1_CM_nvidia.so.${pkgver}"
128     install -Dm755 "libGLESv2_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/libGLESv2_nvidia.so.${pkgver}"
129     install -Dm644 "10_nvidia.json" "${pkgdir}/usr/share/glvnd/egl_vendor.d/10_nvidia.json"
131     # OpenGL core library
132     install -Dm755 "libnvidia-glcore.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-glcore.so.${pkgver}"
133     install -Dm755 "libnvidia-eglcore.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-eglcore.so.${pkgver}"
134     install -Dm755 "libnvidia-glsi.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-glsi.so.${pkgver}"
136     # misc
137     install -Dm755 "libnvidia-fbc.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-fbc.so.${pkgver}"
138     install -Dm755 "libnvidia-encode.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-encode.so.${pkgver}"
139     install -Dm755 "libnvidia-cfg.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-cfg.so.${pkgver}"
140     install -Dm755 "libnvidia-ml.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-ml.so.${pkgver}"
141     install -Dm755 "libnvidia-glvkspirv.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-glvkspirv.so.${pkgver}"
142     install -Dm755 "libnvidia-allocator.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-allocator.so.${pkgver}"
143     install -Dm755 "libnvidia-vulkan-producer.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-vulkan-producer.so.${pkgver}"
144     # Sigh libnvidia-vulkan-producer.so has no SONAME set so create_links doesn't catch it. NVIDIA please fix!
145     ln -s "libnvidia-vulkan-producer.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-vulkan-producer.so.1"
146     ln -s "libnvidia-vulkan-producer.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-vulkan-producer.so"
148     # Vulkan ICD
149     install -Dm644 "nvidia_icd.json" "${pkgdir}/usr/share/vulkan/icd.d/nvidia_icd.json"
150     install -Dm644 "nvidia_layers.json" "${pkgdir}/usr/share/vulkan/implicit_layer.d/nvidia_layers.json"
152     # VDPAU
153     install -Dm755 "libvdpau_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/vdpau/libvdpau_nvidia.so.${pkgver}"
155     # nvidia-tls library
156     install -Dm755 "libnvidia-tls.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-tls.so.${pkgver}"
158     # CUDA
159     install -Dm755 "libcuda.so.${pkgver}" "${pkgdir}/usr/lib/libcuda.so.${pkgver}"
160     install -Dm755 "libnvcuvid.so.${pkgver}" "${pkgdir}/usr/lib/libnvcuvid.so.${pkgver}"
162     # PTX JIT Compiler (Parallel Thread Execution (PTX) is a pseudo-assembly language for CUDA)
163     install -Dm755 "libnvidia-ptxjitcompiler.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-ptxjitcompiler.so.${pkgver}"
165     # raytracing
166     install -Dm755 "libnvoptix.so.${pkgver}" "${pkgdir}/usr/lib/libnvoptix.so.${pkgver}"
167     install -Dm755 "libnvidia-rtcore.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-rtcore.so.${pkgver}"
169     # NGX
170     install -Dm755 nvidia-ngx-updater "${pkgdir}/usr/bin/nvidia-ngx-updater"
171     install -Dm755 "libnvidia-ngx.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-ngx.so.${pkgver}"
172     install -Dm755 _nvngx.dll "${pkgdir}/usr/lib/nvidia/wine/_nvngx.dll"
173     install -Dm755 nvngx.dll "${pkgdir}/usr/lib/nvidia/wine/nvngx.dll"
175     # Optical flow
176     install -Dm755 "libnvidia-opticalflow.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-opticalflow.so.${pkgver}"
178     # DEBUG
179     install -Dm755 nvidia-debugdump "${pkgdir}/usr/bin/nvidia-debugdump"
181     # nvidia-xconfig
182     install -Dm755 nvidia-xconfig "${pkgdir}/usr/bin/nvidia-xconfig"
183     install -Dm644 nvidia-xconfig.1.gz "${pkgdir}/usr/share/man/man1/nvidia-xconfig.1.gz"
185     # nvidia-bug-report
186     install -Dm755 nvidia-bug-report.sh "${pkgdir}/usr/bin/nvidia-bug-report.sh"
188     # nvidia-smi
189     install -Dm755 nvidia-smi "${pkgdir}/usr/bin/nvidia-smi"
190     install -Dm644 nvidia-smi.1.gz "${pkgdir}/usr/share/man/man1/nvidia-smi.1.gz"
192     # nvidia-cuda-mps
193     install -Dm755 nvidia-cuda-mps-server "${pkgdir}/usr/bin/nvidia-cuda-mps-server"
194     install -Dm755 nvidia-cuda-mps-control "${pkgdir}/usr/bin/nvidia-cuda-mps-control"
195     install -Dm644 nvidia-cuda-mps-control.1.gz "${pkgdir}/usr/share/man/man1/nvidia-cuda-mps-control.1.gz"
197     # nvidia-modprobe
198     # This should be removed if nvidia fixed their uvm module!
199     install -Dm4755 nvidia-modprobe "${pkgdir}/usr/bin/nvidia-modprobe"
200     install -Dm644 nvidia-modprobe.1.gz "${pkgdir}/usr/share/man/man1/nvidia-modprobe.1.gz"
202     # nvidia-persistenced
203     install -Dm755 nvidia-persistenced "${pkgdir}/usr/bin/nvidia-persistenced"
204     install -Dm644 nvidia-persistenced.1.gz "${pkgdir}/usr/share/man/man1/nvidia-persistenced.1.gz"
205     install -Dm644 nvidia-persistenced-init/systemd/nvidia-persistenced.service.template "${pkgdir}/usr/lib/systemd/system/nvidia-persistenced.service"
206     sed -i 's/__USER__/nvidia-persistenced/' "${pkgdir}/usr/lib/systemd/system/nvidia-persistenced.service"
208     # application profiles
209     install -Dm644 nvidia-application-profiles-${pkgver}-rc "${pkgdir}/usr/share/nvidia/nvidia-application-profiles-${pkgver}-rc"
210     install -Dm644 nvidia-application-profiles-${pkgver}-key-documentation "${pkgdir}/usr/share/nvidia/nvidia-application-profiles-${pkgver}-key-documentation"
212     install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/nvidia-utils/LICENSE"
213     install -Dm644 README.txt "${pkgdir}/usr/share/doc/nvidia/README"
214     install -Dm644 NVIDIA_Changelog "${pkgdir}/usr/share/doc/nvidia/NVIDIA_Changelog"
215     cp -r html "${pkgdir}/usr/share/doc/nvidia/"
216     ln -s nvidia "${pkgdir}/usr/share/doc/nvidia-utils"
218     # new power management support
219     install -Dm644 systemd/system/nvidia-suspend.service "${pkgdir}/usr/lib/systemd/system/nvidia-suspend.service"
220     install -Dm644 systemd/system/nvidia-hibernate.service "${pkgdir}/usr/lib/systemd/system/nvidia-hibernate.service"
221     install -Dm644 systemd/system/nvidia-resume.service "${pkgdir}/usr/lib/systemd/system/nvidia-resume.service"
222     install -Dm755 systemd/system-sleep/nvidia "${pkgdir}/usr/lib/systemd/system-sleep/nvidia"
223     install -Dm755 systemd/nvidia-sleep.sh "${pkgdir}/usr/bin/nvidia-sleep.sh"
225     # distro specific files must be installed in /usr/share/X11/xorg.conf.d
226     install -Dm644 "${srcdir}/nvidia-drm-outputclass.conf" "${pkgdir}/usr/share/X11/xorg.conf.d/10-nvidia-drm-outputclass.conf"
228     install -Dm644 "${srcdir}/nvidia-utils.sysusers" "${pkgdir}/usr/lib/sysusers.d/$pkgname.conf"
230     install -Dm644 "${srcdir}/nvidia.rules" "$pkgdir"/usr/lib/udev/rules.d/60-nvidia.rules
232     echo "blacklist nouveau" | install -Dm644 /dev/stdin "${pkgdir}/usr/lib/modprobe.d/${pkgname}.conf"
233     echo "nvidia-uvm" | install -Dm644 /dev/stdin "${pkgdir}/usr/lib/modules-load.d/${pkgname}.conf"
235     create_links