From af4b4f4841690a1fdcc586196b0341f521cc43e4 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Sat, 3 Jan 2015 02:08:48 +0000
Subject: nvidia-utils: update to 343.36

---
 abs/core/nvidia-utils/PKGBUILD             | 39 ++++++++++++++++++++----------
 abs/core/nvidia-utils/nvidia-utils.install | 14 +++++++++++
 2 files changed, 40 insertions(+), 13 deletions(-)
 create mode 100644 abs/core/nvidia-utils/nvidia-utils.install

diff --git a/abs/core/nvidia-utils/PKGBUILD b/abs/core/nvidia-utils/PKGBUILD
index a890901..93ad995 100644
--- a/abs/core/nvidia-utils/PKGBUILD
+++ b/abs/core/nvidia-utils/PKGBUILD
@@ -1,9 +1,10 @@
 # $Id$
+# Maintainer: Sven-Hendrik Haase <sh@lutzhaase.com>
 # Maintainer: Thomas Baechler <thomas@archlinux.org>
 # Contributor: James Rayner <iphitus@gmail.com>
 pkgbase=nvidia-utils
 pkgname=('nvidia-utils' 'nvidia-libgl' 'opencl-nvidia')
-pkgver=337.12
+pkgver=343.36
 pkgrel=1
 arch=('i686' 'x86_64')
 url="http://www.nvidia.com/"
@@ -11,31 +12,33 @@ license=('custom')
 options=('!strip')
 source=("ftp://download.nvidia.com/XFree86/Linux-x86/${pkgver}/NVIDIA-Linux-x86-${pkgver}.run"
         "ftp://download.nvidia.com/XFree86/Linux-x86_64/${pkgver}/NVIDIA-Linux-x86_64-${pkgver}-no-compat32.run")
-sha1sums=('a99cd207d55fabeda424441c3eac23867f843b33'
-          '265178244fd20dd9a4fff740d0a02c072efc1f18')
+sha1sums=('57646297165f4d73ef1ae17f72a9edcd1f27aa3b'
+          '81bafc058020b7bc473dd8669985d4cc8f41d5bb')
 
 [[ "$CARCH" = "i686" ]] && _pkg="NVIDIA-Linux-x86-${pkgver}"
 [[ "$CARCH" = "x86_64" ]] && _pkg="NVIDIA-Linux-x86_64-${pkgver}-no-compat32"
 
 create_links() {
     # create soname links
-    while read -d '' _lib; do
-        _soname="$(dirname "${_lib}")/$(LC_ALL=C readelf -d "${_lib}" | sed -nr 's/.*Library soname: \[(.*)\].*/\1/p')"
-        [[ -e "${_soname}" ]] || ln -s "$(basename "${_lib}")" "${_soname}"
-        [[ -e "${_soname/.[0-9]*/}" ]] || ln -s "$(basename "${_soname}")" "${_soname/.[0-9]*/}"
-    done < <(find "${pkgdir}" -type f -name '*.so*' -print0)
+    for _lib in $(find "${pkgdir}" -name '*.so*' | grep -v 'xorg/'); 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}"
+        [[ -e "${_base}" ]] || ln -s $(basename "${_soname}") "${_base}"
+    done
 }
 
-build() {
-    cd "${srcdir}"
+prepare() {
     sh "${_pkg}.run" --extract-only
+    cd "${_pkg}"
+    bsdtar -xf nvidia-persistenced-init.tar.bz2
 }
 
 package_opencl-nvidia() {
     pkgdesc="OpenCL implemention for NVIDIA"
     depends=('libcl' 'zlib')
     optdepends=('opencl-headers: headers necessary for OpenCL development')
-    cd "${srcdir}/${_pkg}"
+    cd "${_pkg}"
 
     # OpenCL
     install -D -m644 nvidia.icd "${pkgdir}/etc/OpenCL/vendors/nvidia.icd"
@@ -53,7 +56,7 @@ package_nvidia-libgl() {
     depends=('nvidia-utils')
     conflicts=('libgl')
     provides=('libgl')
-    cd "${srcdir}/${_pkg}"
+    cd "${_pkg}"
 
     mkdir -p "${pkgdir}/usr/lib/xorg/modules/extensions"
     ln -s "/usr/lib/nvidia/xorg/modules/extensions/libglx.so.${pkgver}" "${pkgdir}/usr/lib/xorg/modules/extensions/libglx.so.${pkgver}"
@@ -86,7 +89,8 @@ package_nvidia-utils() {
     optdepends=('gtk2: nvidia-settings'
                 'xorg-server-devel: nvidia-xconfig'
                 'opencl-nvidia: OpenCL support')
-    cd "${srcdir}/${_pkg}"
+    install="${pkgname}.install"
+    cd "${_pkg}"
 
     # X driver
     install -D -m755 nvidia_drv.so "${pkgdir}/usr/lib/xorg/modules/drivers/nvidia_drv.so"
@@ -146,11 +150,19 @@ package_nvidia-utils() {
 
     # nvidia-cuda-mps
     install -D -m755 nvidia-cuda-mps-server "${pkgdir}/usr/bin/nvidia-cuda-mps-server"
+    install -D -m755 nvidia-cuda-mps-control "${pkgdir}/usr/bin/nvidia-cuda-mps-control"
     install -D -m644 nvidia-cuda-mps-control.1.gz "${pkgdir}/usr/share/man/man1/nvidia-cuda-mps-control.1.gz"
 
     # nvidia-modprobe
     # This should be removed if nvidia fixed their uvm module!
     install -D -m4755 nvidia-modprobe "${pkgdir}/usr/bin/nvidia-modprobe"
+    install -D -m644 nvidia-modprobe.1.gz "${pkgdir}/usr/share/man/man1/nvidia-modprobe.1.gz"
+
+    # nvidia-persistenced
+    install -D -m755 nvidia-persistenced "${pkgdir}/usr/bin/nvidia-persistenced"
+    install -D -m644 nvidia-persistenced.1.gz "${pkgdir}/usr/share/man/man1/nvidia-persistenced.1.gz"
+    install -D -m644 nvidia-persistenced-init/systemd/nvidia-persistenced.service.template "${pkgdir}/usr/lib/systemd/system/nvidia-persistenced.service"
+    sed -i 's/__USER__/nvidia-persistenced/' "${pkgdir}/usr/lib/systemd/system/nvidia-persistenced.service"
 
     # application profiles
     install -D -m644 nvidia-application-profiles-${pkgver}-rc "${pkgdir}/usr/share/nvidia/nvidia-application-profiles-${pkgver}-rc"
@@ -160,6 +172,7 @@ package_nvidia-utils() {
     ln -s nvidia "${pkgdir}/usr/share/licenses/nvidia-utils"
     install -D -m644 README.txt "${pkgdir}/usr/share/doc/nvidia/README"
     install -D -m644 NVIDIA_Changelog "${pkgdir}/usr/share/doc/nvidia/NVIDIA_Changelog"
+    cp -r html "${pkgdir}/usr/share/doc/nvidia/"
     ln -s nvidia "${pkgdir}/usr/share/doc/nvidia-utils"
 
     create_links
diff --git a/abs/core/nvidia-utils/nvidia-utils.install b/abs/core/nvidia-utils/nvidia-utils.install
new file mode 100644
index 0000000..df17a32
--- /dev/null
+++ b/abs/core/nvidia-utils/nvidia-utils.install
@@ -0,0 +1,14 @@
+post_install() {
+  if ! getent group nvidia-persistenced >/dev/null; then
+    groupadd -g 143 nvidia-persistenced
+  fi
+  if ! getent passwd nvidia-persistenced >/dev/null; then
+    useradd -c 'NVIDIA Persistence Daemon' -u 143 -g nvidia-persistenced -d '/' -s /sbin/nologin nvidia-persistenced
+  fi
+}
+
+post_remove() {
+  if getent group nvidia-persistenced >/dev/null; then
+    userdel -f nvidia-persistenced
+  fi
+}
-- 
cgit v0.12

