From db1a142e8ab679b229c1786456dd32cc49198523 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Thu, 28 Feb 2019 16:03:36 +0000
Subject: nvidia-340xx-settings: initial inclusion

---
 abs/core/nvidia-340xx-settings/PKGBUILD            | 62 ++++++++++++++++++++++
 abs/core/nvidia-340xx-settings/libxnvctrl_so.patch | 56 +++++++++++++++++++
 2 files changed, 118 insertions(+)
 create mode 100644 abs/core/nvidia-340xx-settings/PKGBUILD
 create mode 100644 abs/core/nvidia-340xx-settings/libxnvctrl_so.patch

diff --git a/abs/core/nvidia-340xx-settings/PKGBUILD b/abs/core/nvidia-340xx-settings/PKGBUILD
new file mode 100644
index 0000000..ce1e91f
--- /dev/null
+++ b/abs/core/nvidia-340xx-settings/PKGBUILD
@@ -0,0 +1,62 @@
+# Maintainer: Sven-Hendrik Haase <svenstaro@gmail.com>
+
+pkgbase=nvidia-340xx-settings
+pkgname=('nvidia-340xx-settings' 'libxnvctrl-340xx')
+pkgver=340.107
+pkgrel=1
+pkgdesc='Tool for configuring the NVIDIA graphics driver, 340xx legacy branch'
+url='https://github.com/NVIDIA/nvidia-settings'
+arch=('x86_64')
+license=('GPL2')
+makedepends=('git' 'inetutils' 'gtk2' 'jansson' 'gtk3' 'libxv' 'libvdpau' 'nvidia-340xx-utils' 'libxext')
+options=('staticlibs')
+source=(nvidia-settings-${pkgver}.tar.gz::https://github.com/NVIDIA/nvidia-settings/archive/${pkgver}.tar.gz
+        libxnvctrl_so.patch)
+sha512sums=('5419aeac964345612d3933d2dd7249e8c18f9b1ce7fe8aa711d4ab54ba51505c3cf8caf24983fee7084ca8f2dc0be199236c99750038da12502bf91f83953899'
+            '4d39721610adc54d272b0bbb4e9cd5edd29c0c1250c2ccb6c19927703bb3bc95fd826ffb24f3134af3ba0428f6fb400afeb9e3e1cb9b33f1ce59ea64885e5ddf')
+
+prepare() {
+  export PREFIX=/usr
+  export NV_USE_BUNDLED_LIBJANSSON=0
+  cd nvidia-settings-${pkgver}
+  patch -p1 < "${srcdir}/libxnvctrl_so.patch"
+}
+
+build() {
+  cd nvidia-settings-${pkgver}
+  make
+  make -C src/libXNVCtrl
+}
+
+package_nvidia-340xx-settings() {
+  depends=('jansson' 'gtk3' 'libxv' 'libvdpau' 'nvidia-340xx-utils' 'libxnvctrl-340xx')
+  conflicts=('nvidia-settings')
+  provides=('nvidia-settings')
+
+  cd nvidia-settings-${pkgver}
+  make DESTDIR="${pkgdir}" install
+
+  install -D -m644 doc/nvidia-settings.desktop "${pkgdir}/usr/share/applications/nvidia-settings.desktop"
+  install -D -m644 doc/nvidia-settings.png "${pkgdir}/usr/share/pixmaps/nvidia-settings.png"
+  sed -e 's:__UTILS_PATH__:/usr/bin:' -e 's:__PIXMAP_PATH__:/usr/share/pixmaps:' -i "${pkgdir}/usr/share/applications/nvidia-settings.desktop"
+}
+
+package_libxnvctrl-340xx() {
+  depends=('libxext')
+  conflicts=('libxnvctrl')
+  provides=('libxnvctrl')
+  pkgdesc='NVIDIA NV-CONTROL X extension, 340xx legacy branch'
+
+  cd nvidia-settings-${pkgver}
+  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/core/nvidia-340xx-settings/libxnvctrl_so.patch b/abs/core/nvidia-340xx-settings/libxnvctrl_so.patch
new file mode 100644
index 0000000..b09ab01
--- /dev/null
+++ b/abs/core/nvidia-340xx-settings/libxnvctrl_so.patch
@@ -0,0 +1,56 @@
+diff -ru nvidia-settings-340.104/src/libXNVCtrl/Makefile nvidia-settings-340.104-patched/src/libXNVCtrl/Makefile
+--- nvidia-settings-340.104/src/libXNVCtrl/Makefile	2017-09-19 18:35:55.000000000 +0200
++++ nvidia-settings-340.104-patched/src/libXNVCtrl/Makefile	2018-06-09 08:12:48.643147441 +0200
+@@ -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))))
+ 
+Only in nvidia-settings-340.104-patched/src/libXNVCtrl: _out
+diff -ru nvidia-settings-340.104/src/Makefile nvidia-settings-340.104-patched/src/Makefile
+--- nvidia-settings-340.104/src/Makefile	2017-09-19 18:35:55.000000000 +0200
++++ nvidia-settings-340.104-patched/src/Makefile	2018-06-09 08:16:48.837588597 +0200
+@@ -84,6 +84,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
+@@ -203,9 +205,9 @@
+ 	$(MKDIR) $(BINDIR)
+ 	$(INSTALL) $(INSTALL_BIN_ARGS) $< $(BINDIR)/$(notdir $<)
+ 
+-$(NVIDIA_SETTINGS): $(OBJS) $(XNVCTRL_ARCHIVE)
++$(NVIDIA_SETTINGS): $(OBJS) $(XNVCTRL_LIB)
+ 	$(call quiet_cmd,LINK) $(CFLAGS) $(LDFLAGS) $(BIN_LDFLAGS) -o $@ $(OBJS) \
+-	    $(XNVCTRL_ARCHIVE) $(LIBS)
++	    $(XNVCTRL_LIB) $(LIBS)
+ 	$(call quiet_cmd,STRIP_CMD) $@
+ 
+ # define the rule to build each object file
+@@ -215,7 +217,7 @@
+ $(eval $(call DEFINE_STAMP_C_RULE, $(OBJS),$(NVIDIA_SETTINGS_PROGRAM_NAME)))
+ 
+ # define the rule to build $(XNVCTRL_ARCHIVE)
+-$(XNVCTRL_ARCHIVE): build-xnvctrl
++$(XNVCTRL_ARCHIVE) $(XNVCTRL_SHARED): build-xnvctrl
+ 
+ build-xnvctrl:
+ 	@$(MAKE) -C $(XNVCTRL_DIR) -f $(XNVCTRL_MAKEFILE)
+Only in nvidia-settings-340.104-patched/src: _out
-- 
cgit v0.12

