From e23a1e954281b82bff30245921e7ab17610c1e0e Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Wed, 25 Apr 2018 20:32:31 +0000
Subject: nvidia-340xx & nvidia-340xx-utils: update to 340.106

---
 abs/core/nvidia-340xx-utils/PKGBUILD               | 24 ++++++++++--------
 .../nvidia-340xx-utils/nvidia-340xx-utils.install  |  3 ---
 .../nvidia-340xx-utils/nvidia-340xx-utils.sysusers |  1 +
 .../nvidia-340xx-utils/nvidia-drm-outputclass.conf |  1 +
 abs/core/nvidia-340xx/PKGBUILD                     | 16 ++++++------
 abs/core/nvidia-340xx/kernel-4.14.patch            | 29 ----------------------
 6 files changed, 22 insertions(+), 52 deletions(-)
 create mode 100644 abs/core/nvidia-340xx-utils/nvidia-340xx-utils.sysusers
 delete mode 100644 abs/core/nvidia-340xx/kernel-4.14.patch

diff --git a/abs/core/nvidia-340xx-utils/PKGBUILD b/abs/core/nvidia-340xx-utils/PKGBUILD
index 9d132f3..38a84fb 100644
--- a/abs/core/nvidia-340xx-utils/PKGBUILD
+++ b/abs/core/nvidia-340xx-utils/PKGBUILD
@@ -5,25 +5,25 @@
 
 pkgbase=nvidia-340xx-utils
 pkgname=('nvidia-340xx-utils' 'opencl-nvidia-340xx')
-pkgver=340.104
+pkgver=340.106
 pkgrel=1
 arch=('x86_64')
 url="http://www.nvidia.com/"
 license=('custom')
 options=('!strip')
-source=(nvidia-drm-outputclass.conf)
-source_i686=("http://us.download.nvidia.com/XFree86/Linux-x86/${pkgver}/NVIDIA-Linux-x86-${pkgver}.run")
-source_x86_64=("http://us.download.nvidia.com/XFree86/Linux-x86_64/${pkgver}/NVIDIA-Linux-x86_64-${pkgver}-no-compat32.run")
-sha512sums=('cfea06a816ac4a8b728b1ec728d667cdcca604abb038e8b5313b434021caad06a586856b8b3a6c79f8c925629360f5a051ca3de5ab46a42af76b9d0615d2bbbe')
-sha512sums_i686=('8dacd5345a5794e862f4106ab9e8e402defa7883dd176c243d019209b560fe955d7576a13936364c01c5a249f15df58208308c9378c12c3438784376e5fb806c')
-sha512sums_x86_64=('e962494561728af5a911354bfb3560e414464f7858f30f9654eac5ca56175bc8498d1eee93a18248c63e9eee7d84807ef924fe9f53239644d7085b0f3502bf8c')
+source=(nvidia-drm-outputclass.conf
+        "http://us.download.nvidia.com/XFree86/Linux-x86_64/${pkgver}/NVIDIA-Linux-x86_64-${pkgver}-no-compat32.run"
+        nvidia-340xx-utils.sysusers)
+sha512sums=('c49d246a519731bfab9d22afa5c2dd2d366db06d80182738b84881e93cd697c783f16ee04819275c05597bb063451a5d6102fbc562cd078d2a374533a23cea48'
+            'ea61d463148435b6c0d16203c06372e5dc93443607ece0709f789c5c08909a3ec51c1994df97b835bba58008cdc7fe588e403006eb00631482a2a9854a81ec0a'
+            '4b3ad73f5076ba90fe0b3a2e712ac9cde76f469cd8070280f960c3ce7dc502d1927f525ae18d008075c8f08ea432f7be0a6c3a7a6b49c361126dcf42f97ec499')
 
 [[ "$CARCH" = "i686" ]] && _pkg="NVIDIA-Linux-x86-${pkgver}"
 [[ "$CARCH" = "x86_64" ]] && _pkg="NVIDIA-Linux-x86_64-${pkgver}-no-compat32"
 
 create_links() {
     # create soname links
-    for _lib in $(find "${pkgdir}" -name '*.so*' | grep -v 'xorg/'); do
+    find "$pkgdir" -type f -name '*.so*' ! -path '*xorg/*' -print0 | while read -d $'\0' _lib; do
         _soname=$(dirname "${_lib}")/$(readelf -d "${_lib}" | grep -Po 'SONAME.*: \[\K[^]]*' || true)
         _base=$(echo ${_soname} | sed -r 's/(.*).so.*/\1.so/')
         [[ -e "${_soname}" ]] || ln -s $(basename "${_lib}") "${_soname}"
@@ -48,7 +48,7 @@ package_opencl-nvidia-340xx() {
     # OpenCL
     install -D -m644 nvidia.icd "${pkgdir}/etc/OpenCL/vendors/nvidia.icd"
     install -D -m755 "libnvidia-compiler.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-compiler.so.${pkgver}"
-    install -D -m755 "libnvidia-opencl.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-opencl.so.${pkgver}" 
+    install -D -m755 "libnvidia-opencl.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-opencl.so.${pkgver}"
 
     create_links
 
@@ -66,7 +66,7 @@ package_nvidia-340xx-utils() {
     provides=('libgl' 'libgles' 'libegl' 'nvidia-utils' 'nvidia-340xx-libgl')
     replaces=('nvidia-340xx-libgl')
     install="${pkgname}.install"
-    
+
     cd "${_pkg}"
 
     # X driver
@@ -87,7 +87,7 @@ package_nvidia-340xx-utils() {
     install -D -m755 "libnvidia-glcore.so.${pkgver}" "${pkgdir}/usr/lib/nvidia/libnvidia-glcore.so.${pkgver}"
     install -D -m755 "libnvidia-eglcore.so.${pkgver}" "${pkgdir}/usr/lib/nvidia/libnvidia-eglcore.so.${pkgver}"
     install -D -m755 "libnvidia-glsi.so.${pkgver}" "${pkgdir}/usr/lib/nvidia/libnvidia-glsi.so.${pkgver}"
-    
+
     # misc
     install -D -m755 "libnvidia-ifr.so.${pkgver}" "${pkgdir}/usr/lib/nvidia/libnvidia-ifr.so.${pkgver}"
     install -D -m755 "libnvidia-fbc.so.${pkgver}" "${pkgdir}/usr/lib/nvidia/libnvidia-fbc.so.${pkgver}"
@@ -160,5 +160,7 @@ package_nvidia-340xx-utils() {
     install -dm 755 "${pkgdir}"/etc/ld.so.conf.d
     echo -e '/usr/lib/nvidia/' > "${pkgdir}"/etc/ld.so.conf.d/00-nvidia.conf
 
+    install -Dm644 "${srcdir}/nvidia-340xx-utils.sysusers" "${pkgdir}/usr/lib/sysusers.d/$pkgname.conf"
+
     create_links
 }
diff --git a/abs/core/nvidia-340xx-utils/nvidia-340xx-utils.install b/abs/core/nvidia-340xx-utils/nvidia-340xx-utils.install
index 1955c64..47847c7 100644
--- a/abs/core/nvidia-340xx-utils/nvidia-340xx-utils.install
+++ b/abs/core/nvidia-340xx-utils/nvidia-340xx-utils.install
@@ -3,8 +3,5 @@ post_upgrade() {
 }
 
 post_install() {
-  getent group nvidia-persistenced &>/dev/null || groupadd -g 143 nvidia-persistenced
-  getent passwd nvidia-persistenced &>/dev/null || useradd -c 'NVIDIA Persistence Daemon' -u 143 -g nvidia-persistenced -d '/' -s /sbin/nologin nvidia-persistenced
-
   post_upgrade
 }
diff --git a/abs/core/nvidia-340xx-utils/nvidia-340xx-utils.sysusers b/abs/core/nvidia-340xx-utils/nvidia-340xx-utils.sysusers
new file mode 100644
index 0000000..71c0608
--- /dev/null
+++ b/abs/core/nvidia-340xx-utils/nvidia-340xx-utils.sysusers
@@ -0,0 +1 @@
+u nvidia-persistenced 143 'NVIDIA Persistence Daemon'
diff --git a/abs/core/nvidia-340xx-utils/nvidia-drm-outputclass.conf b/abs/core/nvidia-340xx-utils/nvidia-drm-outputclass.conf
index b6003d3..dd2936c 100644
--- a/abs/core/nvidia-340xx-utils/nvidia-drm-outputclass.conf
+++ b/abs/core/nvidia-340xx-utils/nvidia-drm-outputclass.conf
@@ -11,4 +11,5 @@ Section "OutputClass"
     Option "AllowEmptyInitialConfiguration"
     Option "PrimaryGPU" "yes"
     ModulePath "/usr/lib/nvidia/xorg"
+    ModulePath "/usr/lib/xorg/modules"
 EndSection
diff --git a/abs/core/nvidia-340xx/PKGBUILD b/abs/core/nvidia-340xx/PKGBUILD
index 4e5bcb4..9aa0933 100644
--- a/abs/core/nvidia-340xx/PKGBUILD
+++ b/abs/core/nvidia-340xx/PKGBUILD
@@ -4,9 +4,9 @@
 
 pkgbase=nvidia-340xx
 pkgname=(nvidia-340xx nvidia-340xx-dkms)
-pkgver=340.104
+pkgver=340.106
 _extramodules=extramodules-4.9-ARCH
-pkgrel=9
+pkgrel=10
 pkgdesc="NVIDIA drivers for linux, 340xx legacy branch"
 arch=('x86_64')
 url="http://www.nvidia.com/"
@@ -15,10 +15,9 @@ conflicts=('nvidia')
 license=('custom')
 options=('!strip')
 source=("http://us.download.nvidia.com/XFree86/Linux-x86_64/${pkgver}/NVIDIA-Linux-x86_64-${pkgver}-no-compat32.run"
-        'kernel-4.11.patch' 'kernel-4.14.patch')
-sha512sums=('e962494561728af5a911354bfb3560e414464f7858f30f9654eac5ca56175bc8498d1eee93a18248c63e9eee7d84807ef924fe9f53239644d7085b0f3502bf8c'
-            'c25d90499e1deb26129a67dd7e953be8c1e31c5770e2b8b64d03af54cf1afec1a52636e74900f8ac468692207ab8a3765a12edd581142c4d2cfd2d6e66ac7ac2'
-            'ccaa40e085d985ec4280003e36dd06e60958ed1408867379fd21a68a18d48aa4be311bf9ad1e804f7a7245c90be98e919d2ec30f45d290f1cdb19c866bdb8a8d')
+        'kernel-4.11.patch')
+sha512sums=('ea61d463148435b6c0d16203c06372e5dc93443607ece0709f789c5c08909a3ec51c1994df97b835bba58008cdc7fe588e403006eb00631482a2a9854a81ec0a'
+            'c25d90499e1deb26129a67dd7e953be8c1e31c5770e2b8b64d03af54cf1afec1a52636e74900f8ac468692207ab8a3765a12edd581142c4d2cfd2d6e66ac7ac2')
 
 _pkg="NVIDIA-Linux-x86_64-${pkgver}-no-compat32"
 
@@ -28,7 +27,6 @@ prepare() {
     # patches here
 
     patch -Np0 < "${srcdir}/kernel-4.11.patch"
-    patch -Np1 < "${srcdir}/kernel-4.14.patch"
 
     cp -a kernel kernel-dkms
 }
@@ -53,7 +51,7 @@ package_nvidia-340xx() {
     find "${pkgdir}" -name '*.ko' -exec gzip -n {} +
 
     echo "blacklist nouveau" |
-      install -Dm644 /dev/stdin "${pkgdir}/usr/lib/modprobe.d/nvidia.conf"
+        install -Dm644 /dev/stdin "${pkgdir}/usr/lib/modprobe.d/${pkgname}.conf"
 }
 
 package_nvidia-340xx-dkms() {
@@ -70,5 +68,5 @@ package_nvidia-340xx-dkms() {
     cat "${pkgdir}"/usr/src/nvidia-${pkgver}/uvm/dkms.conf.fragment >> "${pkgdir}"/usr/src/nvidia-${pkgver}/dkms.conf
 
     echo "blacklist nouveau" |
-      install -Dm644 /dev/stdin "${pkgdir}/usr/lib/modprobe.d/nvidia.conf"
+        install -Dm644 /dev/stdin "${pkgdir}/usr/lib/modprobe.d/${pkgname}.conf"
 }
diff --git a/abs/core/nvidia-340xx/kernel-4.14.patch b/abs/core/nvidia-340xx/kernel-4.14.patch
deleted file mode 100644
index a38adbd..0000000
--- a/abs/core/nvidia-340xx/kernel-4.14.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-diff -u -r NVIDIA-Linux-x86_64-340.104-no-compat32/kernel/nv-drm.c NVIDIA-Linux-x86_64-340.104-no-compat32-kernel4.14/kernel/nv-drm.c
---- NVIDIA-Linux-x86_64-340.104-no-compat32/kernel/nv-drm.c	2017-09-15 01:16:51.000000000 +0200
-+++ NVIDIA-Linux-x86_64-340.104-no-compat32-kernel4.14/kernel/nv-drm.c	2017-11-19 00:51:45.006654148 +0100
-@@ -173,8 +173,12 @@
- {
-     int ret = 0;
- #if defined(NV_DRM_AVAILABLE)
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
-+    ret = drm_legacy_pci_init(&nv_drm_driver, pci_driver);
-+#else
-     ret = drm_pci_init(&nv_drm_driver, pci_driver);
- #endif
-+#endif
-     return ret;
- }
- 
-@@ -183,8 +187,12 @@
- )
- {
- #if defined(NV_DRM_AVAILABLE)
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
-+    drm_legacy_pci_exit(&nv_drm_driver, pci_driver);
-+#else
-     drm_pci_exit(&nv_drm_driver, pci_driver);
- #endif
-+#endif
- }
- 
- RM_STATUS NV_API_CALL nv_alloc_os_descriptor_handle(
-- 
cgit v0.12

