Gentoo Archives: gentoo-commits

From: Jeroen Roovers <jer@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: x11-drivers/nvidia-drivers/
Date: Thu, 23 Aug 2018 17:03:04
Message-Id: 1535043601.f8e116201562ba673dd28912f79b8263f83af268.jer@gentoo
1 commit: f8e116201562ba673dd28912f79b8263f83af268
2 Author: Jeroen Roovers <jer <AT> gentoo <DOT> org>
3 AuthorDate: Thu Aug 23 17:00:01 2018 +0000
4 Commit: Jeroen Roovers <jer <AT> gentoo <DOT> org>
5 CommitDate: Thu Aug 23 17:00:01 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f8e11620
7
8 x11-drivers/nvidia-drivers: Version 396.54.
9
10 Package-Manager: Portage-2.3.48, Repoman-2.3.10
11
12 x11-drivers/nvidia-drivers/Manifest | 3 +
13 .../nvidia-drivers/nvidia-drivers-396.54.ebuild | 581 +++++++++++++++++++++
14 2 files changed, 584 insertions(+)
15
16 diff --git a/x11-drivers/nvidia-drivers/Manifest b/x11-drivers/nvidia-drivers/Manifest
17 index ff10de8859a..d2ef90f8da7 100644
18 --- a/x11-drivers/nvidia-drivers/Manifest
19 +++ b/x11-drivers/nvidia-drivers/Manifest
20 @@ -19,6 +19,7 @@ DIST NVIDIA-FreeBSD-x86_64-390.77.tar.gz 63638514 BLAKE2B 8a63f1c93cb24400ce099f
21 DIST NVIDIA-FreeBSD-x86_64-396.24.tar.gz 60839222 BLAKE2B 4baa266d945525a8f43d69e14df1b045d5a2e7212eb3a92208f8efb454642e657ea3cf00a9e625ef5efa9f54c8a9e2f87ef4847696368de13b88a0721364d9af SHA512 28c456cfc9f779bed84d671e104f2ea68940053aed2dc7964390e84ec553a9062be6b5108a78f123c129c25548a7b3027060da67417c64f857b23c95ae9f908b
22 DIST NVIDIA-FreeBSD-x86_64-396.45.tar.gz 60850050 BLAKE2B 1bc8e761fbe38637ee17f996ec74f63c4e9da7cea6d38029fe2fcad5cd85da73e10773e019e2744d522aefecee2d6a8d3852db6ad5b9e1e746bc36ccdb4b7c9c SHA512 76955be8e86645376856bdbda7339601b88067e6b4d39b768ec86586eced7e77a437eb990bcf0fa77b3671968b00df91b53be53e1cdcd45d3e0c6a96ab5f1d77
23 DIST NVIDIA-FreeBSD-x86_64-396.51.tar.gz 60903199 BLAKE2B adaf32bce51a11a15f71dfb3fb66a203237a6e153437cd4c95bd5d9d7d694b9b959d7e599d9481e3201eff243655e2d3e39cbea72bf40d9c40448d4b55cf22ed SHA512 903af39b5d8681d80f0016db4fe7a4b84cc2c1325c295be6c44b95aa98006d395f46b9d26ca5f08aea8998ca62f1c51eb4b1c0c2b3d082943d35c4bb437a57ef
24 +DIST NVIDIA-FreeBSD-x86_64-396.54.tar.gz 60938322 BLAKE2B a23488b625a15703b0c40bc6871314b05d117d489f64a6f7c70ac3c934b02028b9623be10f0369c98c7d3b5e018e1eb6f1d2cde9d9e1b90be5065f06f6a646dd SHA512 52df85364bfd45a23394078855859ce85de996f7990bb96ba63eb33e516c3cf8e72c4391af9817213f735286f2cf6444bc8ed00312365f12ae17373cfbdc3fc7
25 DIST NVIDIA-Linux-armv7l-gnueabihf-375.82.run 26650801 BLAKE2B 31446667065c56b48f6a3e737afe29a4517459d3462138136bffe383bc6fe514d6e80b49c391c27edc96b8abc3da3dd4d6ee3f3dca17f3c9a0f1cdf0e72cf099 SHA512 28554f1c24fe63c9257c0de3e84e4e739a45bf1c20ec7a53bc2c1b69b4e2355675061491ef5b03f3ae489cf623e553cfa68442f5536f137837327036d1c53d63
26 DIST NVIDIA-Linux-armv7l-gnueabihf-378.13.run 26514235 BLAKE2B 2b3c540704496a290be7ae3f1ff378487c75af2298c12488da8b3a1814446e5df02a1ed99afd8ee7fc459d950aab472155359eae0bf56ac83389711d70638152 SHA512 253786a821df85fa926ae842114321b3c70502f887ea7c2b6790dfe3836039ee5d390e6722ca8785904ec6487e465916923d3042dc6191b3b4522c3161b80cb0
27 DIST NVIDIA-Linux-armv7l-gnueabihf-381.22.run 26815484 BLAKE2B e5f0241b07d1e54edea2025dd30061d1018c68cc2c7136c507eb894bbad5be3d0724494e2b9f33d1f8f60da4904999bbb964e6f2e78d045d7cd86bcd46b7f6d0 SHA512 934cda37c7aed26243b5b661122e1c060de5b4df890aaf2295b6650dddea37cb4f0e3f0bebddb00b5d687b66ab5e028a203195c4d4ad3379593babda42febe77
28 @@ -47,6 +48,7 @@ DIST NVIDIA-Linux-x86_64-390.77.run 82722543 BLAKE2B 46bc7b365b4a8bd2d9444ccccec
29 DIST NVIDIA-Linux-x86_64-396.24.run 86545234 BLAKE2B be297b4585275362608cb5119c9f7f77bcf7895bd1320603cb5f8034ee5f1dfa6d0150e58d4a11dd4656b50476d6cb6a372c18db54d33fdd685250ceb0793d3f SHA512 dfe837804d01e903cdf980353add0227362771cd252e4a7d8aff99fc489e5535edfda51ed1a20b9d60e23f1a9e7312f23309c59c67ff0a09a9b9214e52f09077
30 DIST NVIDIA-Linux-x86_64-396.45.run 87016131 BLAKE2B 988392f69fc4f1f60acd03bee50245d836976728c81bbd21e5542b13e0bd93589a2bf8482d544e868f294e32de65b62c13512e465ec25afaae1ae405ae4beb3c SHA512 243253ebc83e4bc5116223ecaa29e55786a611484d9a0fba302f9f87961576bbd7f367422635725173662f013e27ef88a09f7282c9fe9912f9fe4665bdf06822
31 DIST NVIDIA-Linux-x86_64-396.51.run 86541408 BLAKE2B 2cc41d2f6fe73a49c322828a9001383d8a23890a6d1d18593b649e18b77d2424fe588fdfbfd71fce6819a4620c4ba21d8e8ce7f2a8aa8411961099d40cf54edd SHA512 961c1a5b27a0f6cb54e387133a8d4038ddda0df39e70e84a637d8d64eaeb4ec937e37d6a737179d72750785614d20ade5e99f0668e3d53fef2cfa70241de4fe3
32 +DIST NVIDIA-Linux-x86_64-396.54.run 86946680 BLAKE2B 9b3ab39c9d09c663238d0fac6346c24feea6ecc44b0ecaf3de871522697685c1c474ec4cc83f3bab0a2bcfecc7c77acea0e6bfee6e8ca8e6883bd338fd6da8a2 SHA512 17139abe99d4f32ec87379ee57af2cc0fec7d24605b2be7e3cd6609d9fcdf871e3c1cb7414b3544e14eb32d2213fec7ac45b3261f27c8d6565d510ccb14a1247
33 DIST nvidia-settings-304.137.tar.bz2 1481361 BLAKE2B cf52a55a34eeb03a685a683487af6a198ba467dd8ba9983cc75624a37a226373cd931d98e8448b7b8ed430c54be2118c7b240ed2a9100b19bec5e832e2f6cdad SHA512 676d1f70c9a78ee234f5f1a283412430a386fa604de211afba02806a45906c5e246a002989b724d74752178d28c92a268de1c98d4c87876797d991253f16b0cc
34 DIST nvidia-settings-340.107.tar.bz2 1549413 BLAKE2B 127442ee2c35ceec47ab4f103bdd2d0278c621fcb9be47051111f6f8728ef5699bdc95fe33a3812a807c38c4868b04c2176e2ed218a422171d2a88ac0c00de96 SHA512 593e7e83aa350a3a7beaaa32aca8660d7e203f6f2e460a6e6eabcdc092087f9917ee4e6d141e37ad4e3b0a1b9908c085e4a71d2f579e481a03bbd1c6f75ca776
35 DIST nvidia-settings-375.82.tar.gz 2114647 BLAKE2B 26413fde8397e748fae362984039286c53a7fe104228452f3188b5e77b084ff4bf00131e77359ff5e92dfc325680c1f662950175cf806403d2a524ba86158f51 SHA512 7a374be56c8be52767d73a048029d9e55dc2abcf2f6a97eb4931544c927c85a1103a206be9e8d1ffcef36fec2caf2416f33699ad4d51e7dca17e4e844c37a595
36 @@ -59,3 +61,4 @@ DIST nvidia-settings-390.77.tar.bz2 1109358 BLAKE2B ee59fff5a679301b0e1f24fce3a1
37 DIST nvidia-settings-396.24.tar.bz2 1115673 BLAKE2B 5b0bd156505e99a5b788fc61458c902cc1760d999b18c8c6309986d8c315eabc65cb2fea9ef6a823acbe57c4a11bf67938575afffb36fea91320416fe40a7507 SHA512 841470a324bb09683fcd863474f987a525a38213432be3bf4288a48671c674692f44642d260f3d2d0710e485e323153f867d0bda4cfa9b11d0e3c61a36370353
38 DIST nvidia-settings-396.45.tar.bz2 1116216 BLAKE2B 85769b7e3152bf2ff029083d5e1cf695751fa713b9db858d77f344f19266b545e8f70a07dcb3b017dd6ab901e25df6acd15a1e584bc65efec1a3d24cdd56cfca SHA512 2ec1c1e2ba79a95c1199724c476b8433ea34b7c88acfabf9b49484073d8b0251a7f466bfe71f501772915ea77fdc34b4bc539fc62e8844a06c28af7570fe0bee
39 DIST nvidia-settings-396.51.tar.bz2 1116520 BLAKE2B e7362bf71d0c7e595a17e398aacfe53ad845e1d29db6792e0d4e7769663c9eba1267c95c8a629473f7419d05ab48c02ff198bebee11db8a3d9de1ed4444c4124 SHA512 139fde3ab704562db5d7247b0ccd578260baf2650de24d6844a02439d6847681181681fb6bf84fc962434597259887b735b1cb2e596ab5112924d70ba4c6fc6f
40 +DIST nvidia-settings-396.54.tar.bz2 1116371 BLAKE2B 114b88f393b0909c8d84a56a280854e258d0e7e7ce800ee58547ef68b4989f22a3bbb380795472b8222493a988dc9308fc20ef03c81589448b518a12285cf204 SHA512 23dc3c61bef71200b3e8185940dd52a50dae7ca7f2b8a68fa96eaa937aabc87ded5d5f73081af51d1e7af2b78b0ec10ab80d28dadbcf10a046c32ec14db1d83c
41
42 diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-396.54.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-396.54.ebuild
43 new file mode 100644
44 index 00000000000..8fc4f36564d
45 --- /dev/null
46 +++ b/x11-drivers/nvidia-drivers/nvidia-drivers-396.54.ebuild
47 @@ -0,0 +1,581 @@
48 +# Copyright 1999-2018 Gentoo Foundation
49 +# Distributed under the terms of the GNU General Public License v2
50 +
51 +EAPI=6
52 +inherit eutils flag-o-matic linux-info linux-mod multilib-minimal nvidia-driver \
53 + portability toolchain-funcs unpacker user udev
54 +
55 +DESCRIPTION="NVIDIA Accelerated Graphics Driver"
56 +HOMEPAGE="http://www.nvidia.com/ http://www.nvidia.com/Download/Find.aspx"
57 +
58 +AMD64_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86_64-${PV}"
59 +AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
60 +ARM_NV_PACKAGE="NVIDIA-Linux-armv7l-gnueabihf-${PV}"
61 +
62 +NV_URI="http://us.download.nvidia.com/XFree86/"
63 +SRC_URI="
64 + amd64-fbsd? ( ${NV_URI}FreeBSD-x86_64/${PV}/${AMD64_FBSD_NV_PACKAGE}.tar.gz )
65 + amd64? ( ${NV_URI}Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
66 + tools? (
67 + https://download.nvidia.com/XFree86/nvidia-settings/nvidia-settings-${PV}.tar.bz2
68 + )
69 +"
70 +
71 +LICENSE="GPL-2 NVIDIA-r2"
72 +SLOT="0/${PV%.*}"
73 +KEYWORDS="-* ~amd64 ~amd64-fbsd"
74 +RESTRICT="bindist mirror"
75 +EMULTILIB_PKG="true"
76 +
77 +IUSE="acpi compat +driver gtk3 kernel_FreeBSD kernel_linux +kms multilib pax_kernel static-libs +tools uvm wayland +X"
78 +REQUIRED_USE="
79 + tools? ( X )
80 + static-libs? ( tools )
81 +"
82 +
83 +COMMON="
84 + app-eselect/eselect-opencl
85 + kernel_linux? ( >=sys-libs/glibc-2.6.1 )
86 + tools? (
87 + dev-libs/atk
88 + dev-libs/glib:2
89 + dev-libs/jansson
90 + gtk3? (
91 + x11-libs/gtk+:3
92 + )
93 + x11-libs/cairo
94 + x11-libs/gdk-pixbuf[X]
95 + x11-libs/gtk+:2
96 + x11-libs/libX11
97 + x11-libs/libXext
98 + x11-libs/libXrandr
99 + x11-libs/libXv
100 + x11-libs/libXxf86vm
101 + x11-libs/pango[X]
102 + )
103 + X? (
104 + >=app-eselect/eselect-opengl-1.0.9
105 + app-misc/pax-utils
106 + )
107 +"
108 +DEPEND="
109 + ${COMMON}
110 + kernel_linux? ( virtual/linux-sources )
111 + tools? ( sys-apps/dbus )
112 +"
113 +RDEPEND="
114 + ${COMMON}
115 + acpi? ( sys-power/acpid )
116 + tools? ( !media-video/nvidia-settings )
117 + wayland? ( dev-libs/wayland[${MULTILIB_USEDEP}] )
118 + X? (
119 + <x11-base/xorg-server-1.20.99:=
120 + >=x11-libs/libX11-1.6.2[${MULTILIB_USEDEP}]
121 + >=x11-libs/libXext-1.3.2[${MULTILIB_USEDEP}]
122 + >=x11-libs/libvdpau-1.0[${MULTILIB_USEDEP}]
123 + sys-libs/zlib[${MULTILIB_USEDEP}]
124 + )
125 +"
126 +QA_PREBUILT="opt/* usr/lib*"
127 +S=${WORKDIR}/
128 +
129 +nvidia_drivers_versions_check() {
130 + if use amd64 && has_multilib_profile && \
131 + [ "${DEFAULT_ABI}" != "amd64" ]; then
132 + eerror "This ebuild doesn't currently support changing your default ABI"
133 + die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
134 + fi
135 +
136 + if use kernel_linux && kernel_is ge 4 19; then
137 + ewarn "Gentoo supports kernels which are supported by NVIDIA"
138 + ewarn "which are limited to the following kernels:"
139 + ewarn "<sys-kernel/gentoo-sources-4.19"
140 + ewarn "<sys-kernel/vanilla-sources-4.19"
141 + ewarn ""
142 + ewarn "You are free to utilize epatch_user to provide whatever"
143 + ewarn "support you feel is appropriate, but will not receive"
144 + ewarn "support as a result of those changes."
145 + ewarn ""
146 + ewarn "Do not file a bug report about this."
147 + ewarn ""
148 + fi
149 +
150 + # Since Nvidia ships many different series of drivers, we need to give the user
151 + # some kind of guidance as to what version they should install. This tries
152 + # to point the user in the right direction but can't be perfect. check
153 + # nvidia-driver.eclass
154 + nvidia-driver-check-warning
155 +
156 + # Kernel features/options to check for
157 + CONFIG_CHECK="~ZONE_DMA ~MTRR ~SYSVIPC ~!LOCKDEP"
158 +
159 + # Now do the above checks
160 + use kernel_linux && check_extra_config
161 +}
162 +
163 +pkg_pretend() {
164 + nvidia_drivers_versions_check
165 +}
166 +
167 +pkg_setup() {
168 + nvidia_drivers_versions_check
169 +
170 + # try to turn off distcc and ccache for people that have a problem with it
171 + export DISTCC_DISABLE=1
172 + export CCACHE_DISABLE=1
173 +
174 + if use driver && use kernel_linux; then
175 + MODULE_NAMES="nvidia(video:${S}/kernel)"
176 + use uvm && MODULE_NAMES+=" nvidia-uvm(video:${S}/kernel)"
177 + use kms && MODULE_NAMES+=" nvidia-modeset(video:${S}/kernel) nvidia-drm(video:${S}/kernel)"
178 +
179 + # This needs to run after MODULE_NAMES (so that the eclass checks
180 + # whether the kernel supports loadable modules) but before BUILD_PARAMS
181 + # is set (so that KV_DIR is populated).
182 + linux-mod_pkg_setup
183 +
184 + BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
185 + SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC) NV_VERBOSE=1"
186 +
187 + # linux-mod_src_compile calls set_arch_to_kernel, which
188 + # sets the ARCH to x86 but NVIDIA's wrapping Makefile
189 + # expects x86_64 or i386 and then converts it to x86
190 + # later on in the build process
191 + BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')"
192 + fi
193 +
194 + if use kernel_linux && kernel_is lt 2 6 9; then
195 + eerror "You must build this against 2.6.9 or higher kernels."
196 + fi
197 +
198 + # set variables to where files are in the package structure
199 + if use kernel_FreeBSD; then
200 + use amd64-fbsd && S="${WORKDIR}/${AMD64_FBSD_NV_PACKAGE}"
201 + NV_DOC="${S}/doc"
202 + NV_OBJ="${S}/obj"
203 + NV_SRC="${S}/src"
204 + NV_MAN="${S}/x11/man"
205 + NV_X11="${S}/obj"
206 + NV_SOVER=1
207 + elif use kernel_linux; then
208 + NV_DOC="${S}"
209 + NV_OBJ="${S}"
210 + NV_SRC="${S}/kernel"
211 + NV_MAN="${S}"
212 + NV_X11="${S}"
213 + NV_SOVER=${PV}
214 + else
215 + die "Could not determine proper NVIDIA package"
216 + fi
217 +}
218 +
219 +src_prepare() {
220 + if use pax_kernel; then
221 + ewarn "Using PAX patches is not supported. You will be asked to"
222 + ewarn "use a standard kernel should you have issues. Should you"
223 + ewarn "need support with these patches, contact the PaX team."
224 + eapply "${FILESDIR}"/${PN}-375.20-pax.patch
225 + fi
226 +
227 + local man_file
228 + for man_file in "${NV_MAN}"/*1.gz; do
229 + gunzip $man_file || die
230 + done
231 +
232 + if use tools; then
233 + cp "${FILESDIR}"/nvidia-settings-linker.patch "${WORKDIR}" || die
234 + sed -i \
235 + -e "s:@PV@:${PV}:g" \
236 + "${WORKDIR}"/nvidia-settings-linker.patch || die
237 + eapply "${WORKDIR}"/nvidia-settings-linker.patch
238 + fi
239 +
240 + default
241 +
242 + if ! [ -f nvidia_icd.json ]; then
243 + cp nvidia_icd.json.template nvidia_icd.json || die
244 + sed -i -e 's:__NV_VK_ICD__:libGLX_nvidia.so.0:g' nvidia_icd.json || die
245 + fi
246 +}
247 +
248 +src_compile() {
249 + # This is already the default on Linux, as there's no toplevel Makefile, but
250 + # on FreeBSD there's one and triggers the kernel module build, as we install
251 + # it by itself, pass this.
252 +
253 + cd "${NV_SRC}"
254 + if use kernel_FreeBSD; then
255 + MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
256 + LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
257 + elif use driver && use kernel_linux; then
258 + MAKEOPTS=-j1 linux-mod_src_compile
259 + fi
260 +
261 + if use tools; then
262 + emake -C "${S}"/nvidia-settings-${PV}/src \
263 + AR="$(tc-getAR)" \
264 + CC="$(tc-getCC)" \
265 + DO_STRIP= \
266 + LD="$(tc-getCC)" \
267 + LIBDIR="$(get_libdir)" \
268 + NVLD="$(tc-getLD)" \
269 + NV_VERBOSE=1 \
270 + RANLIB="$(tc-getRANLIB)" \
271 + build-xnvctrl
272 +
273 + emake -C "${S}"/nvidia-settings-${PV}/src \
274 + CC="$(tc-getCC)" \
275 + DO_STRIP= \
276 + GTK3_AVAILABLE=$(usex gtk3 1 0) \
277 + LD="$(tc-getCC)" \
278 + LIBDIR="$(get_libdir)" \
279 + NVLD="$(tc-getLD)" \
280 + NVML_ENABLED=0 \
281 + NV_USE_BUNDLED_LIBJANSSON=0 \
282 + NV_VERBOSE=1
283 + fi
284 +}
285 +
286 +# Install nvidia library:
287 +# the first parameter is the library to install
288 +# the second parameter is the provided soversion
289 +# the third parameter is the target directory if it is not /usr/lib
290 +donvidia() {
291 + # Full path to library
292 + nv_LIB="${1}"
293 +
294 + # SOVER to use
295 + nv_SOVER="$(scanelf -qF'%S#F' ${nv_LIB})"
296 +
297 + # Where to install
298 + nv_DEST="${2}"
299 +
300 + # Get just the library name
301 + nv_LIBNAME=$(basename "${nv_LIB}")
302 +
303 + if [[ "${nv_DEST}" ]]; then
304 + exeinto ${nv_DEST}
305 + action="doexe"
306 + else
307 + nv_DEST="/usr/$(get_libdir)"
308 + action="dolib.so"
309 + fi
310 +
311 + # Install the library
312 + ${action} ${nv_LIB} || die "failed to install ${nv_LIBNAME}"
313 +
314 + # If the library has a SONAME and SONAME does not match the library name,
315 + # then we need to create a symlink
316 + if [[ ${nv_SOVER} ]] && ! [[ "${nv_SOVER}" = "${nv_LIBNAME}" ]]; then
317 + dosym ${nv_LIBNAME} ${nv_DEST}/${nv_SOVER} \
318 + || die "failed to create ${nv_DEST}/${nv_SOVER} symlink"
319 + fi
320 +
321 + dosym ${nv_LIBNAME} ${nv_DEST}/${nv_LIBNAME/.so*/.so} \
322 + || die "failed to create ${nv_LIBNAME/.so*/.so} symlink"
323 +}
324 +
325 +src_install() {
326 + if use driver && use kernel_linux; then
327 + linux-mod_src_install
328 +
329 + # Add the aliases
330 + # This file is tweaked with the appropriate video group in
331 + # pkg_preinst, see bug #491414
332 + insinto /etc/modprobe.d
333 + newins "${FILESDIR}"/nvidia-169.07 nvidia.conf
334 + doins "${FILESDIR}"/nvidia-rmmod.conf
335 +
336 + # Ensures that our device nodes are created when not using X
337 + exeinto "$(get_udevdir)"
338 + newexe "${FILESDIR}"/nvidia-udev.sh-r1 nvidia-udev.sh
339 + udev_newrules "${FILESDIR}"/nvidia.udev-rule 99-nvidia.rules
340 + elif use kernel_FreeBSD; then
341 + if use x86-fbsd; then
342 + insinto /boot/modules
343 + doins "${S}/src/nvidia.kld"
344 + fi
345 +
346 + exeinto /boot/modules
347 + doexe "${S}/src/nvidia.ko"
348 + fi
349 +
350 + # NVIDIA kernel <-> userspace driver config lib
351 + donvidia ${NV_OBJ}/libnvidia-cfg.so.${NV_SOVER}
352 +
353 + # NVIDIA framebuffer capture library
354 + donvidia ${NV_OBJ}/libnvidia-fbc.so.${NV_SOVER}
355 +
356 + # NVIDIA video encode/decode <-> CUDA
357 + if use kernel_linux; then
358 + donvidia ${NV_OBJ}/libnvcuvid.so.${NV_SOVER}
359 + donvidia ${NV_OBJ}/libnvidia-encode.so.${NV_SOVER}
360 + fi
361 +
362 + if use X; then
363 + # Xorg DDX driver
364 + insinto /usr/$(get_libdir)/xorg/modules/drivers
365 + doins ${NV_X11}/nvidia_drv.so
366 +
367 + # Xorg GLX driver
368 + donvidia ${NV_X11}/libglx.so.${NV_SOVER} \
369 + /usr/$(get_libdir)/opengl/nvidia/extensions
370 +
371 + # Xorg nvidia.conf
372 + if has_version '>=x11-base/xorg-server-1.16'; then
373 + insinto /usr/share/X11/xorg.conf.d
374 + newins {,50-}nvidia-drm-outputclass.conf
375 + fi
376 +
377 + insinto /usr/share/glvnd/egl_vendor.d
378 + doins ${NV_X11}/10_nvidia.json
379 + fi
380 +
381 + if use wayland; then
382 + insinto /usr/share/egl/egl_external_platform.d
383 + doins ${NV_X11}/10_nvidia_wayland.json
384 + fi
385 +
386 + # OpenCL ICD for NVIDIA
387 + if use kernel_linux; then
388 + insinto /etc/OpenCL/vendors
389 + doins ${NV_OBJ}/nvidia.icd
390 + fi
391 +
392 + # Documentation
393 + if use kernel_FreeBSD; then
394 + dodoc "${NV_DOC}/README"
395 + use X && doman "${NV_MAN}"/nvidia-xconfig.1
396 + use tools && doman "${NV_MAN}"/nvidia-settings.1
397 + else
398 + # Docs
399 + newdoc "${NV_DOC}/README.txt" README
400 + dodoc "${NV_DOC}/NVIDIA_Changelog"
401 + doman "${NV_MAN}"/nvidia-smi.1
402 + use X && doman "${NV_MAN}"/nvidia-xconfig.1
403 + use tools && doman "${NV_MAN}"/nvidia-settings.1
404 + doman "${NV_MAN}"/nvidia-cuda-mps-control.1
405 + fi
406 +
407 + docinto html
408 + dodoc -r ${NV_DOC}/html/*
409 +
410 + # Helper Apps
411 + exeinto /opt/bin/
412 +
413 + if use X; then
414 + doexe ${NV_OBJ}/nvidia-xconfig
415 +
416 + insinto /etc/vulkan/icd.d
417 + doins nvidia_icd.json
418 + fi
419 +
420 + if use kernel_linux; then
421 + doexe ${NV_OBJ}/nvidia-cuda-mps-control
422 + doexe ${NV_OBJ}/nvidia-cuda-mps-server
423 + doexe ${NV_OBJ}/nvidia-debugdump
424 + doexe ${NV_OBJ}/nvidia-persistenced
425 + doexe ${NV_OBJ}/nvidia-smi
426 +
427 + # install nvidia-modprobe setuid and symlink in /usr/bin (bug #505092)
428 + doexe ${NV_OBJ}/nvidia-modprobe
429 + fowners root:video /opt/bin/nvidia-modprobe
430 + fperms 4710 /opt/bin/nvidia-modprobe
431 + dosym /{opt,usr}/bin/nvidia-modprobe
432 +
433 + doman nvidia-cuda-mps-control.1
434 + doman nvidia-modprobe.1
435 + doman nvidia-persistenced.1
436 + newinitd "${FILESDIR}/nvidia-smi.init" nvidia-smi
437 + newconfd "${FILESDIR}/nvidia-persistenced.conf" nvidia-persistenced
438 + newinitd "${FILESDIR}/nvidia-persistenced.init" nvidia-persistenced
439 + fi
440 +
441 + if use tools; then
442 + emake -C "${S}"/nvidia-settings-${PV}/src/ \
443 + DESTDIR="${D}" \
444 + GTK3_AVAILABLE=$(usex gtk3 1 0) \
445 + LIBDIR="${D}/usr/$(get_libdir)" \
446 + NV_USE_BUNDLED_LIBJANSSON=0 \
447 + NV_VERBOSE=1 \
448 + PREFIX=/usr \
449 + DO_STRIP= \
450 + install
451 +
452 + if use static-libs; then
453 + dolib.a "${S}"/nvidia-settings-${PV}/src/libXNVCtrl/libXNVCtrl.a
454 +
455 + insinto /usr/include/NVCtrl
456 + doins "${S}"/nvidia-settings-${PV}/src/libXNVCtrl/*.h
457 + fi
458 +
459 + insinto /usr/share/nvidia/
460 + doins nvidia-application-profiles-${PV}-key-documentation
461 +
462 + insinto /etc/nvidia
463 + newins \
464 + nvidia-application-profiles-${PV}-rc nvidia-application-profiles-rc
465 +
466 + # There is no icon in the FreeBSD tarball.
467 + use kernel_FreeBSD || \
468 + doicon ${NV_OBJ}/nvidia-settings.png
469 +
470 + domenu "${FILESDIR}"/nvidia-settings.desktop
471 +
472 + exeinto /etc/X11/xinit/xinitrc.d
473 + newexe "${FILESDIR}"/95-nvidia-settings-r1 95-nvidia-settings
474 + fi
475 +
476 + dobin ${NV_OBJ}/nvidia-bug-report.sh
477 +
478 + if has_multilib_profile && use multilib; then
479 + local OABI=${ABI}
480 + for ABI in $(get_install_abis); do
481 + src_install-libs
482 + done
483 + ABI=${OABI}
484 + unset OABI
485 + else
486 + src_install-libs
487 + fi
488 +
489 + is_final_abi || die "failed to iterate through all ABIs"
490 +
491 + readme.gentoo_create_doc
492 +}
493 +
494 +src_install-libs() {
495 + local inslibdir=$(get_libdir)
496 + local GL_ROOT="/usr/$(get_libdir)/opengl/nvidia/lib"
497 + local CL_ROOT="/usr/$(get_libdir)/OpenCL/vendors/nvidia"
498 + local nv_libdir="${NV_OBJ}"
499 +
500 + if use kernel_linux && has_multilib_profile && [[ ${ABI} == "x86" ]]; then
501 + nv_libdir="${NV_OBJ}"/32
502 + fi
503 +
504 + if use X; then
505 + NV_GLX_LIBRARIES=(
506 + "libEGL.so.$(usex compat ${NV_SOVER} 1.1.0) ${GL_ROOT}"
507 + "libEGL_nvidia.so.${NV_SOVER} ${GL_ROOT}"
508 + "libGL.so.$(usex compat ${NV_SOVER} 1.7.0) ${GL_ROOT}"
509 + "libGLESv1_CM.so.1.2.0 ${GL_ROOT}"
510 + "libGLESv1_CM_nvidia.so.${NV_SOVER} ${GL_ROOT}"
511 + "libGLESv2.so.2.1.0 ${GL_ROOT}"
512 + "libGLESv2_nvidia.so.${NV_SOVER} ${GL_ROOT}"
513 + "libGLX.so.0 ${GL_ROOT}"
514 + "libGLX_nvidia.so.${NV_SOVER} ${GL_ROOT}"
515 + "libGLdispatch.so.0 ${GL_ROOT}"
516 + "libOpenCL.so.1.0.0 ${CL_ROOT}"
517 + "libOpenGL.so.0 ${GL_ROOT}"
518 + "libcuda.so.${NV_SOVER}"
519 + "libnvcuvid.so.${NV_SOVER}"
520 + "libnvidia-compiler.so.${NV_SOVER}"
521 + "libnvidia-eglcore.so.${NV_SOVER}"
522 + "libnvidia-encode.so.${NV_SOVER}"
523 + "libnvidia-fatbinaryloader.so.${NV_SOVER}"
524 + "libnvidia-fbc.so.${NV_SOVER}"
525 + "libnvidia-glcore.so.${NV_SOVER}"
526 + "libnvidia-glsi.so.${NV_SOVER}"
527 + "libnvidia-glvkspirv.so.${NV_SOVER}"
528 + "libnvidia-ifr.so.${NV_SOVER}"
529 + "libnvidia-opencl.so.${NV_SOVER}"
530 + "libnvidia-ptxjitcompiler.so.${NV_SOVER}"
531 + "libvdpau_nvidia.so.${NV_SOVER}"
532 + )
533 +
534 + if use wayland && has_multilib_profile && [[ ${ABI} == "amd64" ]];
535 + then
536 + NV_GLX_LIBRARIES+=(
537 + "libnvidia-egl-wayland.so.1.0.3"
538 + )
539 + fi
540 +
541 + if use kernel_linux && has_multilib_profile && [[ ${ABI} == "amd64" ]];
542 + then
543 + NV_GLX_LIBRARIES+=(
544 + "libnvidia-wfb.so.${NV_SOVER}"
545 + )
546 + fi
547 +
548 + if use kernel_FreeBSD; then
549 + NV_GLX_LIBRARIES+=(
550 + "libnvidia-tls.so.${NV_SOVER}"
551 + )
552 + fi
553 +
554 + if use kernel_linux; then
555 + NV_GLX_LIBRARIES+=(
556 + "libnvidia-ml.so.${NV_SOVER}"
557 + "tls/libnvidia-tls.so.${NV_SOVER}"
558 + )
559 + fi
560 +
561 + for NV_LIB in "${NV_GLX_LIBRARIES[@]}"; do
562 + donvidia "${nv_libdir}"/${NV_LIB}
563 + done
564 + fi
565 +}
566 +
567 +pkg_preinst() {
568 + if use driver && use kernel_linux; then
569 + linux-mod_pkg_preinst
570 +
571 + local videogroup="$(egetent group video | cut -d ':' -f 3)"
572 + if [ -z "${videogroup}" ]; then
573 + eerror "Failed to determine the video group gid"
574 + die "Failed to determine the video group gid"
575 + else
576 + sed -i \
577 + -e "s:PACKAGE:${PF}:g" \
578 + -e "s:VIDEOGID:${videogroup}:" \
579 + "${D}"/etc/modprobe.d/nvidia.conf || die
580 + fi
581 + fi
582 +
583 + # Clean the dynamic libGL stuff's home to ensure
584 + # we dont have stale libs floating around
585 + if [ -d "${ROOT}"/usr/lib/opengl/nvidia ]; then
586 + rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
587 + fi
588 + # Make sure we nuke the old nvidia-glx's env.d file
589 + if [ -e "${ROOT}"/etc/env.d/09nvidia ]; then
590 + rm -f "${ROOT}"/etc/env.d/09nvidia
591 + fi
592 +}
593 +
594 +pkg_postinst() {
595 + use driver && use kernel_linux && linux-mod_pkg_postinst
596 +
597 + # Switch to the nvidia implementation
598 + use X && "${ROOT}"/usr/bin/eselect opengl set --use-old nvidia
599 + "${ROOT}"/usr/bin/eselect opencl set --use-old nvidia
600 +
601 + readme.gentoo_print_elog
602 +
603 + if ! use X; then
604 + elog "You have elected to not install the X.org driver. Along with"
605 + elog "this the OpenGL libraries and VDPAU libraries were not"
606 + elog "installed. Additionally, once the driver is loaded your card"
607 + elog "and fan will run at max speed which may not be desirable."
608 + elog "Use the 'nvidia-smi' init script to have your card and fan"
609 + elog "speed scale appropriately."
610 + elog
611 + fi
612 + if ! use tools; then
613 + elog "USE=tools controls whether the nvidia-settings application"
614 + elog "is installed. If you would like to use it, enable that"
615 + elog "flag and re-emerge this ebuild. Optionally you can install"
616 + elog "media-video/nvidia-settings"
617 + elog
618 + fi
619 +}
620 +
621 +pkg_prerm() {
622 + use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
623 +}
624 +
625 +pkg_postrm() {
626 + use driver && use kernel_linux && linux-mod_pkg_postrm
627 + use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
628 +}