From 2906e6acd2955c000cf28185f29eaeed5d4c978c Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Tue, 11 Oct 2016 20:43:20 +0000
Subject: nvidia-settings: update to 370.28

---
 abs/extra/nvidia-settings/PKGBUILD            | 46 ++++++++++++++----
 abs/extra/nvidia-settings/libxnvctrl_so.patch | 67 +++++++++++++++++++++++++++
 2 files changed, 103 insertions(+), 10 deletions(-)
 create mode 100644 abs/extra/nvidia-settings/libxnvctrl_so.patch

diff --git a/abs/extra/nvidia-settings/PKGBUILD b/abs/extra/nvidia-settings/PKGBUILD
index 2330008..28ee5c4 100644
--- a/abs/extra/nvidia-settings/PKGBUILD
+++ b/abs/extra/nvidia-settings/PKGBUILD
@@ -1,30 +1,38 @@
-# $Id$
 # Maintainer: Felix Yan <felixonmars@archlinux.org>
+# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
 
-pkgname=nvidia-settings
-pkgver=364.19
+pkgbase=nvidia-settings
+pkgname=('nvidia-settings' 'libxnvctrl')
+pkgver=370.28
 pkgrel=1
 pkgdesc="Tool for configuring the NVIDIA graphics driver"
 arch=('i686' 'x86_64')
 url="https://github.com/NVIDIA/nvidia-settings"
 license=('GPL2')
-depends=('jansson' 'gtk3' 'libxv' 'libvdpau' 'nvidia-utils')
-makedepends=('git' 'inetutils' 'gtk2')
-source=("git+https://github.com/NVIDIA/nvidia-settings#tag=$pkgver")
-sha1sums=('SKIP')
+makedepends=('git' 'inetutils' 'gtk2' 'jansson' 'gtk3' 'libxv' 'libvdpau' 'nvidia-utils' 'libxext')
+options=('staticlibs')
+source=("git+https://github.com/NVIDIA/nvidia-settings#tag=$pkgver"
+        libxnvctrl_so.patch)
+sha1sums=('SKIP'
+          '16619a01e92e565c79ad344be87ad11244ac1762')
 
 prepare() {
   export PREFIX=/usr
   export NV_USE_BUNDLED_LIBJANSSON=0
+  cd ${pkgbase}
+  patch -p1 < "${srcdir}/libxnvctrl_so.patch"
 }
 
 build() {
-  cd ${pkgname}
+  cd ${pkgbase}
   make
+  make -C src/libXNVCtrl
 }
 
-package() {
-  cd ${pkgname}
+package_nvidia-settings() {
+  depends=('jansson' 'gtk3' 'libxv' 'libvdpau' 'nvidia-utils' 'libxnvctrl')
+
+  cd ${pkgbase}
   make DESTDIR="${pkgdir}" install
 
   install -D -m644 doc/nvidia-settings.desktop "${pkgdir}/usr/share/applications/nvidia-settings.desktop"
@@ -33,3 +41,21 @@ package() {
 
   rm "$pkgdir/usr/lib/libnvidia-gtk2.so.$pkgver"
 }
+
+package_libxnvctrl() {
+  depends=('libxext')
+  pkgdesc='NVIDIA NV-CONTROL X extension'
+
+  cd ${pkgbase}
+  install -Dm 644 doc/{NV-CONTROL-API.txt,FRAMELOCK.txt} -t "${pkgdir}/usr/share/doc/${pkgname}"
+  install -Dm 644 samples/{Makefile,README,*.c,*.h,*.mk} -t "${pkgdir}/usr/share/doc/${pkgname}/samples"
+
+  cd src/libXNVCtrl
+  install -Dm 644 *.h -t "${pkgdir}/usr/include/NVCtrl"
+  install -Dm 644 libXNVCtrl.a -t "${pkgdir}/usr/lib"
+  install -Dm 755 libXNVCtrl.so.0.0.0 -t "${pkgdir}/usr/lib"
+  ln -s libXNVCtrl.so.0.0.0 "${pkgdir}/usr/lib/libXNVCtrl.so.0"
+  ln -s libXNVCtrl.so.0 "${pkgdir}/usr/lib/libXNVCtrl.so"
+}
+
+# vim: ts=2 sw=2 et:
diff --git a/abs/extra/nvidia-settings/libxnvctrl_so.patch b/abs/extra/nvidia-settings/libxnvctrl_so.patch
new file mode 100644
index 0000000..78cebea
--- /dev/null
+++ b/abs/extra/nvidia-settings/libxnvctrl_so.patch
@@ -0,0 +1,67 @@
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -106,6 +106,8 @@
+ XNVCTRL_DIR             ?= libXNVCtrl
+ XNVCTRL_MAKEFILE        ?= Makefile
+ XNVCTRL_ARCHIVE         ?= $(XNVCTRL_DIR)/libXNVCtrl.a
++XNVCTRL_SHARED          ?= $(XNVCTRL_DIR)/libXNVCtrl.so.0
++XNVCTRL_LIB             ?= $(XNVCTRL_SHARED)
+ XCONFIG_PARSER_DIR      ?= XF86Config-parser
+ COMMON_UTILS_DIR        ?= common-utils
+ COMMON_UNIX_DIR         ?= common-unix
+@@ -280,15 +282,18 @@
+ 	$(MKDIR) $(BINDIR)
+ 	$(INSTALL) $(INSTALL_BIN_ARGS) $< $(BINDIR)/$(notdir $<)
+ 
++$(XNVCTRL_ARCHIVE) $(XNVCTRL_SHARED):
++	$(MAKE) -C $(XNVCTRL_DIR)
++
+ $(eval $(call DEBUG_INFO_RULES, $(NVIDIA_SETTINGS)))
+-$(NVIDIA_SETTINGS).unstripped: $(OBJS) $(XNVCTRL_ARCHIVE)
++$(NVIDIA_SETTINGS).unstripped: $(OBJS) $(XNVCTRL_LIB)
+ 	$(call quiet_cmd,LINK) $(CFLAGS) $(LDFLAGS) $(BIN_LDFLAGS) \
+-	    -rdynamic -o $@ $(OBJS) $(XNVCTRL_ARCHIVE) $(LIBS)
++	    -rdynamic -o $@ $(OBJS) $(XNVCTRL_LIB) $(LIBS)
+ 
+ $(eval $(call DEBUG_INFO_RULES, $(GTK2LIB)))
+ $(GTK2LIB).unstripped: $(GTK2_OBJS) $(XCP_OBJS) $(VERSION_MK)
+ 	$(call quiet_cmd,LINK) -shared $(CFLAGS) $(LDFLAGS) $(BIN_LDFLAGS) \
+-	    $(XNVCTRL_ARCHIVE) $(LIBS) $(GTK2_LIBS) \
++	    $(XNVCTRL_LIB) $(LIBS) $(GTK2_LIBS) \
+ 	    -Wl,--unresolved-symbols=ignore-all -o $@ \
+ 	    -Wl,-soname -Wl,$(GTK2LIB_SONAME) \
+ 	    $(GTK2_OBJS) $(XCP_OBJS)
+@@ -297,7 +302,7 @@
+ $(eval $(call DEBUG_INFO_RULES, $(GTK3LIB)))
+ $(GTK3LIB).unstripped: $(GTK3_OBJS) $(XCP_OBJS) $(VERSION_MK)
+ 	$(call quiet_cmd,LINK) -shared $(CFLAGS) $(LDFLAGS)  $(BIN_LDFLAGS) \
+-	    $(XNVCTRL_ARCHIVE) $(LIBS) $(GTK3_LIBS) \
++	    $(XNVCTRL_LIB) $(LIBS) $(GTK3_LIBS) \
+ 	    -Wl,--unresolved-symbols=ignore-all -o $@ \
+ 	    -Wl,-soname -Wl,$(GTK3LIB_SONAME) \
+ 	    $(GTK3_OBJS) $(XCP_OBJS)
+--- a/src/libXNVCtrl/Makefile
++++ b/src/libXNVCtrl/Makefile
+@@ -55,10 +55,17 @@
+ .PHONY: clean
+ 
+ all: $(LIBXNVCTRL)
++all: libXNVCtrl.so
+ 
+ $(LIBXNVCTRL) : $(OBJS)
+ 	$(AR) ru $@ $(OBJS)
+ 
++libXNVCtrl.so: $(OBJS)
++	$(RM) $@ $@.*
++	$(CC) -shared -Wl,-soname=$@.0 -o $@.0.0.0 $(LDFLAGS) $^ -lXext -lX11
++	ln -s $@.0.0.0 $@.0
++	ln -s $@.0 $@
++
+ # define the rule to build each object file
+ $(foreach src,$(SRC),$(eval $(call DEFINE_OBJECT_RULE,TARGET,$(src))))
+ 
+@@ -68,3 +75,4 @@
+ clean:
+ 	rm -rf $(LIBXNVCTRL) *~ $(STAMP_C) \
+ 		$(OUTPUTDIR)/*.o $(OUTPUTDIR)/*.d
++	rm -f libXNVCtrl.so libXNVCtrl.so.*
-- 
cgit v0.12