From e2b79d1058609c1cd9f6d6198a0b9845962fb1ad Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Fri, 5 Dec 2014 19:27:50 +0000
Subject: graphviz: update to 2.38.0

---
 abs/extra/graphviz/PKGBUILD            | 77 ++++++++++++++++++++--------------
 abs/extra/graphviz/format-string.patch | 21 ++++++++++
 abs/extra/graphviz/install             | 12 ++++++
 3 files changed, 79 insertions(+), 31 deletions(-)
 create mode 100644 abs/extra/graphviz/format-string.patch
 create mode 100644 abs/extra/graphviz/install

diff --git a/abs/extra/graphviz/PKGBUILD b/abs/extra/graphviz/PKGBUILD
index f3de8b6..0ee8e34 100644
--- a/abs/extra/graphviz/PKGBUILD
+++ b/abs/extra/graphviz/PKGBUILD
@@ -1,42 +1,57 @@
-# $Id: PKGBUILD 94713 2010-10-10 10:06:04Z andyrtr $
-# Maintainer: kevin <kevin@archlinux.org>
+# $Id$
+# Maintainer: Gaetan Bisson <bisson@archlinux.org>
+# Contributor: kevin <kevin@archlinux.org>
 # Contributor: John Proctor <jproctor@prium.net>
 
 pkgname=graphviz
-pkgver=2.26.3
-pkgrel=2
-pkgdesc="Creates acircular graph images"
-arch=('i686' 'x86_64')
+pkgver=2.38.0
+pkgrel=3
+pkgdesc='Graph visualization software'
+url='http://www.graphviz.org/'
 license=('CPL')
-depends=('gd>=2.0.35' 'librsvg>=2.22.3' 'libxaw>=1.0.5' 'ghostscript>=9.00')
-url="http://www.graphviz.org/"
-options=('!libtool')
-source=(${url}/pub/${pkgname}/stable/SOURCES/${pkgname}-${pkgver}.tar.gz)
-install=graphviz.install
-md5sums=('6f45946fa622770c45609778c0a982ee')
+arch=('i686' 'x86_64')
+depends=('libltdl' 'gd' 'librsvg' 'libxaw' 'ghostscript' 'pango' 'gts')
+makedepends=('swig' 'mono' 'guile' 'lua51' 'ocaml' 'perl' 'php' 'python2' 'r' 'tk' 'qt4' 'gtk2')
+optdepends=('mono: sharp bindings'
+            'guile: guile bindings'
+            'lua51: lua bindings'
+            'ocaml: ocaml bindings'
+            'perl: perl bindings'
+            'php: php bindings'
+            'python2: python bindings'
+            'r: r bindings'
+            'tcl: tcl bindings'
+            'qt4: gvedit'
+            'gtk2: gtk output plugin')
+source=("${url}/pub/${pkgname}/stable/SOURCES/${pkgname}-${pkgver}.tar.gz"
+        'format-string.patch')
+sha1sums=('053c771278909160916ca5464a0a98ebf034c6ef'
+          '271d116bc022596a64b6ee061f3d2e50fa2e6025')
 
-build() {
-  cd "${srcdir}/${pkgname}-${pkgver}"
-  ./configure --prefix=/usr --without-gnomeui --docdir=/usr/share/doc/gvkp \
-    --disable-tcl --disable-sharp --disable-ruby --disable-python \
-    --disable-lua --disable-guile --disable-perl || return 1
+install=install
+
+prepare() {
+	cd "${srcdir}/${pkgname}-${pkgver}"
+	patch -p1 -i ../format-string.patch # FS#42983
+}
 
-#--bindir=/bindir --libdir=/libdir --includedir=/includedir --mandir=/mandir \
-#--infodir=/infodir \
-#--docdir=/docdir --htmldir=/htmldir --dvidir=/dvidir \
-#--pdfdir=/pdfdir --psdir=/psdir
+build() {
+	cd "${srcdir}/${pkgname}-${pkgver}"
+	export LIBPOSTFIX=/
+	export PYTHON=python2
+	export LUA=lua5.1
 
-  make || return 1
+	./configure --prefix=/usr
+	make
 }
-package() {
-  cd "${srcdir}/${pkgname}-${pkgver}"
-  make DESTDIR="${pkgdir}" install || return 1
 
-  #Fix a wrong file location for x86_64
-  rm -rf ${pkgdir}/usr/lib64
+package() {
+	cd "${srcdir}/${pkgname}-${pkgver}"
+	make DESTDIR="${pkgdir}" install
 
-  # Fix non-fhs doc files.
-  cd ${pkgdir}/usr/share
-  mkdir doc
-  mv graphviz/doc doc/graphviz
+	# Workaround symlink upgrade bug (fixed in pacman trunk)
+	# Also deduplicates the tcl libraries (upstream bug?)
+	# Might have been this commit: https://github.com/ellson/graphviz/commit/f11aead
+	rm -r "${pkgdir}/usr/lib/tcl8.6/graphviz"
+	ln -s ../graphviz/tcl "$pkgdir/usr/lib/tcl8.6/graphviz"
 }
diff --git a/abs/extra/graphviz/format-string.patch b/abs/extra/graphviz/format-string.patch
new file mode 100644
index 0000000..1cc5867
--- /dev/null
+++ b/abs/extra/graphviz/format-string.patch
@@ -0,0 +1,21 @@
+diff -Naur old/lib/cgraph/scan.l new/lib/cgraph/scan.l
+--- old/lib/cgraph/scan.l	2014-04-13 10:40:25.000000000 -1000
++++ new/lib/cgraph/scan.l	2014-12-02 08:54:21.285050735 -1000
+@@ -149,7 +149,7 @@
+ 	agxbput(&xb,buf);
+ 	agxbput(&xb,fname);
+ 	agxbput(&xb, " splits into two tokens\n");
+-	agerr(AGWARN,agxbuse(&xb));
++	agerr(AGWARN, "%s", agxbuse(&xb));
+ 
+ 	agxbfree(&xb);
+ 	return 1;
+@@ -225,7 +225,7 @@
+ 	agxbput (&xb, buf);
+ 	agxbput (&xb, yytext);
+ 	agxbput (&xb,"'\n");
+-	agerr(AGERR,agxbuse(&xb));
++	agerr(AGERR, "%s", agxbuse(&xb));
+ 	agxbfree(&xb);
+ }
+ /* must be here to see flex's macro defns */
diff --git a/abs/extra/graphviz/install b/abs/extra/graphviz/install
new file mode 100644
index 0000000..65fba52
--- /dev/null
+++ b/abs/extra/graphviz/install
@@ -0,0 +1,12 @@
+post_install() {
+	rm -f usr/lib/graphviz/config{,6}
+	usr/bin/dot -c
+}
+
+post_upgrade() {
+	post_install
+}
+
+pre_remove() {
+	rm -f usr/lib/graphviz/config{,6}
+}
-- 
cgit v0.12

