From fdf6e7ebb6592b07a5d4df1f98d3fff9c96c9b09 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Mon, 5 Oct 2015 23:47:57 +0000
Subject: nvidia-304xx & nvidia-304xx-utils: update to 304.128

---
 abs/core/nvidia-304xx-utils/PKGBUILD            | 13 +++---
 abs/core/nvidia-304xx/PKGBUILD                  | 58 +++++++++++++++----------
 abs/core/nvidia-304xx/nvidia-304xx-dkms.install | 30 +++++++++++++
 abs/core/nvidia-304xx/nvidia-304xx.install      | 13 ++++++
 abs/core/nvidia-304xx/nvidia.install            | 15 -------
 5 files changed, 84 insertions(+), 45 deletions(-)
 create mode 100644 abs/core/nvidia-304xx/nvidia-304xx-dkms.install
 create mode 100644 abs/core/nvidia-304xx/nvidia-304xx.install
 delete mode 100644 abs/core/nvidia-304xx/nvidia.install

diff --git a/abs/core/nvidia-304xx-utils/PKGBUILD b/abs/core/nvidia-304xx-utils/PKGBUILD
index 95a9c50..e6196b7 100644
--- a/abs/core/nvidia-304xx-utils/PKGBUILD
+++ b/abs/core/nvidia-304xx-utils/PKGBUILD
@@ -1,27 +1,27 @@
 # $Id$
-# Maintainer: Felix Yan <felixonmars@gmail.com>
+# Maintainer: Felix Yan <felixonmars@archlinux.org>
 # Contributor: Andreas Radke <andyrtr@archlinux.org>
 
 pkgbase=nvidia-304xx-utils
 pkgname=('nvidia-304xx-utils' 'nvidia-304xx-libgl' 'opencl-nvidia-304xx')
-pkgver=304.125
+pkgver=304.128
 pkgrel=1
 arch=('i686' 'x86_64')
 url="http://www.nvidia.com/"
 license=('custom')
 makedepends=('zlib')
 options=('!strip')
+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_i686=('9822b61872ae28751cd5c41714048612f7ddf0fd9f02e6340598150afbea43dddeba88482a8c88bcf893b015d14b2a2cf5157ed60583da57fdfe183ecb620c90')
+sha512sums_x86_64=('fa7a81edaba92561314b4874635e639607cf2f9bcde10609764528a35bb2d4a6916c7ea2be2cdcb9e2abf5ac7455f54287ff7218f3e57acc67bdeae18a208db2')
 
 if [ "$CARCH" = "i686" ]; then
   _arch='x86'
   _pkg="NVIDIA-Linux-${_arch}-${pkgver}"
-  source=("http://us.download.nvidia.com/XFree86/Linux-${_arch}/${pkgver}/${_pkg}.run")
-  md5sums=('bc3b0ac291fa998d5109a6f7e94fb2d4')
 elif [ "$CARCH" = "x86_64" ]; then
   _arch='x86_64'
   _pkg="NVIDIA-Linux-${_arch}-${pkgver}-no-compat32"
-  source=("http://us.download.nvidia.com/XFree86/Linux-${_arch}/${pkgver}/${_pkg}.run")
-  md5sums=('291d41ccdbcc08f752a38f9e0a7eeea0')
 fi
 
 create_links() {
@@ -160,4 +160,3 @@ package_nvidia-304xx-utils() {
 
   create_links
 }
-md5sums=('291d41ccdbcc08f752a38f9e0a7eeea0')
diff --git a/abs/core/nvidia-304xx/PKGBUILD b/abs/core/nvidia-304xx/PKGBUILD
index 1ef54d9..909491a 100644
--- a/abs/core/nvidia-304xx/PKGBUILD
+++ b/abs/core/nvidia-304xx/PKGBUILD
@@ -2,34 +2,26 @@
 # Maintainer: Felix Yan <felixonmars@archlinux.org>
 # Contributor: Thomas Baechler <thomas@archlinux.org>
 
-pkgname=nvidia-304xx
-pkgver=304.125
+pkgbase=nvidia-304xx
+pkgname=(nvidia-304xx nvidia-304xx-dkms)
+pkgver=304.128
 _extramodules=extramodules-3.18-ARCH
-pkgrel=9
-pkgdesc="NVIDIA drivers for linux, 304xx legacy branch"
+pkgrel=3
 arch=('i686' 'x86_64')
 url="http://www.nvidia.com/"
-depends=('linux>=3.18' 'linux<3.19' 'nvidia-304xx-libgl' "nvidia-304xx-utils=${pkgver}")
-makedepends=('linux-headers>=3.18' 'linux-headers<3.19')
+makedepends=('nvidia-304xx-libgl' "nvidia-304xx-utils=${pkgver}" 'linux' 'linux-headers>=3.18' 'linux-headers<3.19')
 conflicts=('nvidia')
 license=('custom')
-install=nvidia.install
 options=(!strip)
+source=("http://us.download.nvidia.com/XFree86/Linux-x86/${pkgver}/NVIDIA-Linux-x86-${pkgver}.run"
+        "http://us.download.nvidia.com/XFree86/Linux-x86_64/${pkgver}/NVIDIA-Linux-x86_64-${pkgver}-no-compat32.run"
+        'nv-drm.patch')
+sha512sums=('9822b61872ae28751cd5c41714048612f7ddf0fd9f02e6340598150afbea43dddeba88482a8c88bcf893b015d14b2a2cf5157ed60583da57fdfe183ecb620c90'
+            'fa7a81edaba92561314b4874635e639607cf2f9bcde10609764528a35bb2d4a6916c7ea2be2cdcb9e2abf5ac7455f54287ff7218f3e57acc67bdeae18a208db2'
+            'aaa36ef7179acdc86850381de145a3aebab22273cd3c702a9d1343dc3415192c74a35da692312555f36193c5d46a1771ce07ea9508113cb9d0698873064aa19f')
 
-if [ "$CARCH" = "i686" ]; then
-    _arch='x86'
-    _pkg="NVIDIA-Linux-${_arch}-${pkgver}"
-    source=("http://us.download.nvidia.com/XFree86/Linux-${_arch}/${pkgver}/${_pkg}.run")
-    md5sums=('bc3b0ac291fa998d5109a6f7e94fb2d4')
-elif [ "$CARCH" = "x86_64" ]; then
-    _arch='x86_64'
-    _pkg="NVIDIA-Linux-${_arch}-${pkgver}-no-compat32"
-    source=("http://us.download.nvidia.com/XFree86/Linux-${_arch}/${pkgver}/${_pkg}.run")
-    md5sums=('291d41ccdbcc08f752a38f9e0a7eeea0')
-fi
-
-source+=('nv-drm.patch')
-md5sums+=('79671a27131da619a33eb02ed0c2c031')
+[[ "$CARCH" = "i686" ]] && _pkg="NVIDIA-Linux-x86-${pkgver}"
+[[ "$CARCH" = "x86_64" ]] && _pkg="NVIDIA-Linux-x86_64-${pkgver}-no-compat32"
 
 prepare() {
     cd "${srcdir}"
@@ -45,13 +37,33 @@ build() {
     make SYSSRC=/usr/lib/modules/"${_kernver}/build" module
 }
 
-package() {
+package_nvidia-304xx() {
+    pkgdesc="NVIDIA drivers for linux, 304xx legacy branch"
+    depends=('linux>=3.18' 'linux<3.19' 'libgl' "nvidia-304xx-utils=${pkgver}")
+	conflicts+=('nvidia-304xx-dkms')
+    install=nvidia-304xx.install
+
     install -D -m644 "${srcdir}/${_pkg}/kernel/nvidia.ko" \
         "${pkgdir}/usr/lib/modules/${_extramodules}/nvidia.ko"
     install -d -m755 "${pkgdir}/usr/lib/modprobe.d"
     echo "blacklist nouveau" >> "${pkgdir}/usr/lib/modprobe.d/nvidia.conf"
-    sed -i -e "s/EXTRAMODULES='.*'/EXTRAMODULES='${_extramodules}'/" "${startdir}/nvidia.install"
+    sed -i -e "s/EXTRAMODULES='.*'/EXTRAMODULES='${_extramodules}'/" "${startdir}/${pkgname}.install"
     gzip "${pkgdir}/usr/lib/modules/${_extramodules}/nvidia.ko"
 
     # the license file is part of nvidia-304xx-utils - the module depends on it, so we don't ship it another time.
 }
+
+package_nvidia-304xx-dkms() {
+    pkgdesc="NVIDIA driver sources for linux, 304xx legacy branch"
+    depends=('dkms' "nvidia-304xx-utils=$pkgver")
+    optdepends=('linux-headers: Build the module for Arch kernel'
+                'linux-lts-headers: Build the module for LTS Arch kernel')
+	conflicts+=('nvidia-304xx')
+    install=nvidia-304xx-dkms.install
+
+    cd ${_pkg}
+	make -C kernel clean
+    install -dm 755 "${pkgdir}"/usr/{lib/modprobe.d,src}
+    cp -dr --no-preserve='ownership' kernel "${pkgdir}"/usr/src/nvidia-${pkgver}
+    echo 'blacklist nouveau' > "${pkgdir}"/usr/lib/modprobe.d/nvidia.conf
+}
diff --git a/abs/core/nvidia-304xx/nvidia-304xx-dkms.install b/abs/core/nvidia-304xx/nvidia-304xx-dkms.install
new file mode 100644
index 0000000..3d9b74d
--- /dev/null
+++ b/abs/core/nvidia-304xx/nvidia-304xx-dkms.install
@@ -0,0 +1,30 @@
+#/bin/sh
+
+# arg 1:  the new package version
+post_install() {
+  dkms add nvidia/${1%-*}
+  cat << EOF
+==> To build and install your modules run: dkms install nvidia/${1%-*}
+==> To do this automatically at startup run: systemctl enable dkms.service
+EOF
+}
+
+# arg 1:  the new package version
+# arg 2:  the old package version
+pre_upgrade() {
+  pre_remove "$2"
+}
+
+# arg 1:  the new package version
+# arg 2:  the old package version
+post_upgrade() {
+  post_install "$1"
+}
+
+# arg 1:  the old package version
+pre_remove() {
+  # Remove modules using dkms
+  [ -n "${1%-*}" ] && dkms remove nvidia/${1%-*} --all &>/dev/null || true
+}
+
+# vim:set ts=2 sw=2 ft=sh et:
diff --git a/abs/core/nvidia-304xx/nvidia-304xx.install b/abs/core/nvidia-304xx/nvidia-304xx.install
new file mode 100644
index 0000000..6d90420
--- /dev/null
+++ b/abs/core/nvidia-304xx/nvidia-304xx.install
@@ -0,0 +1,13 @@
+post_install() {
+    EXTRAMODULES='extramodules-3.18-ARCH'
+    depmod $(cat /usr/lib/modules/$EXTRAMODULES/version)
+    echo 'In order to use nvidia module, reboot the system.'
+}
+
+post_upgrade() {
+    post_install
+}
+
+post_remove() {
+    post_install
+}
diff --git a/abs/core/nvidia-304xx/nvidia.install b/abs/core/nvidia-304xx/nvidia.install
deleted file mode 100644
index a83edad..0000000
--- a/abs/core/nvidia-304xx/nvidia.install
+++ /dev/null
@@ -1,15 +0,0 @@
-post_install() {
-    EXTRAMODULES='extramodules-3.18-ARCH'
-    depmod $(cat /usr/lib/modules/$EXTRAMODULES/version)
-    echo 'In order to use nvidia module, reboot the system.'
-}
-
-post_upgrade() {
-    EXTRAMODULES='extramodules-3.18-ARCH'
-    depmod $(cat /usr/lib/modules/$EXTRAMODULES/version)
-}
-
-post_remove() {
-    EXTRAMODULES='extramodules-3.18-ARCH'
-    depmod $(cat /usr/lib/modules/$EXTRAMODULES/version)
-}
-- 
cgit v0.12