From 3229cda8b498a06d720e54d8b0d197ff0d28ce10 Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Tue, 7 Aug 2012 15:00:06 -0500
Subject: libwmf .2.8.4

---
 abs/extra/libwmf/PKGBUILD                          | 40 ++++++++++++++++++++++
 abs/extra/libwmf/libwmf-0.2.8.4-libpng-1.5.patch   | 12 +++++++
 abs/extra/libwmf/libwmf-0.2.8.4-useafterfree.patch | 10 ++++++
 abs/extra/libwmf/libwmf.install                    | 13 +++++++
 4 files changed, 75 insertions(+)
 create mode 100644 abs/extra/libwmf/PKGBUILD
 create mode 100644 abs/extra/libwmf/libwmf-0.2.8.4-libpng-1.5.patch
 create mode 100644 abs/extra/libwmf/libwmf-0.2.8.4-useafterfree.patch
 create mode 100644 abs/extra/libwmf/libwmf.install

diff --git a/abs/extra/libwmf/PKGBUILD b/abs/extra/libwmf/PKGBUILD
new file mode 100644
index 0000000..e6ac70a
--- /dev/null
+++ b/abs/extra/libwmf/PKGBUILD
@@ -0,0 +1,40 @@
+# $Id: PKGBUILD 148846 2012-02-05 11:52:43Z ibiru $
+# Maintainer: Eric Bélanger <eric@archlinux.org>
+
+pkgname=libwmf
+pkgver=0.2.8.4
+pkgrel=9
+pkgdesc="A library for reading vector images in Microsoft's native Windows Metafile Format (WMF)"
+arch=('i686' 'x86_64')
+url="http://wvware.sourceforge.net/libwmf.html"
+license=('LGPL')
+depends=('libpng' 'libx11' 'libjpeg' 'gsfonts')
+makedepends=('gtk2' 'libxt')
+optdepends=('gdk-pixbuf2: for pixbuf loader')
+options=('!libtool' '!docs' '!emptydirs')
+install=libwmf.install
+source=(http://downloads.sourceforge.net/sourceforge/wvware/${pkgname}-${pkgver}.tar.gz
+	libwmf-0.2.8.4-libpng-1.5.patch libwmf-0.2.8.4-useafterfree.patch)
+sha1sums=('822ab3bd0f5e8f39ad732f2774a8e9f18fc91e89'
+          '42aa4c2a82e4e14044c875a7f439baea732a355a'
+          'ea6d28880840e86c96f9079bfd591da54dcffa5c')
+
+build() {
+  cd "${srcdir}/${pkgname}-${pkgver}"
+  patch -p1 -i "${srcdir}/libwmf-0.2.8.4-libpng-1.5.patch"
+  patch -p1 -i "${srcdir}/libwmf-0.2.8.4-useafterfree.patch"
+  ./configure --prefix=/usr \
+              --with-gsfontdir=/usr/share/fonts/Type1 \
+	      --with-fontdir=/usr/share/fonts/Type1 \
+	      --with-gsfontmap=/usr/share/ghostscript/8.15/lib/Fontmap.GS
+  make
+}
+
+package() {
+  cd "${srcdir}/${pkgname}-${pkgver}"
+  make DESTDIR="${pkgdir}" install
+  #Remove fonts, these are in gsfonts
+  rm -rf "${pkgdir}/usr/share/fonts"
+  #Remove static GTK loader, can't use it anyways
+  rm -f "${pkgdir}"/usr/lib/gtk-2.0/*/loaders/io-wmf.a
+}
diff --git a/abs/extra/libwmf/libwmf-0.2.8.4-libpng-1.5.patch b/abs/extra/libwmf/libwmf-0.2.8.4-libpng-1.5.patch
new file mode 100644
index 0000000..3528c74
--- /dev/null
+++ b/abs/extra/libwmf/libwmf-0.2.8.4-libpng-1.5.patch
@@ -0,0 +1,12 @@
+diff -urN libwmf-0.2.8.4.old/src/ipa/ipa/bmp.h libwmf-0.2.8.4/src/ipa/ipa/bmp.h
+--- libwmf-0.2.8.4.old/src/ipa/ipa/bmp.h	2011-05-23 19:14:23.000000000 +0200
++++ libwmf-0.2.8.4/src/ipa/ipa/bmp.h	2011-05-23 19:15:11.000000000 +0200
+@@ -66,7 +66,7 @@
+ 		return;
+ 	}
+ 
+-	if (setjmp (png_ptr->jmpbuf))
++	if (setjmp(png_jmpbuf(png_ptr)))
+ 	{	WMF_DEBUG (API,"Failed to write bitmap as PNG! (setjmp failed)");
+ 		png_destroy_write_struct (&png_ptr,&info_ptr);
+ 		wmf_free (API,buffer);
diff --git a/abs/extra/libwmf/libwmf-0.2.8.4-useafterfree.patch b/abs/extra/libwmf/libwmf-0.2.8.4-useafterfree.patch
new file mode 100644
index 0000000..328c541
--- /dev/null
+++ b/abs/extra/libwmf/libwmf-0.2.8.4-useafterfree.patch
@@ -0,0 +1,10 @@
+--- libwmf-0.2.8.4/src/extra/gd/gd_clip.c.CVE-2009-1364-im-clip-list	2009-04-24 04:06:44.000000000 -0400
++++ libwmf-0.2.8.4/src/extra/gd/gd_clip.c	2009-04-24 04:08:30.000000000 -0400
+@@ -70,6 +70,7 @@ void gdClipSetAdd(gdImagePtr im,gdClipRe
+ 	{	more = gdRealloc (im->clip->list,(im->clip->max + 8) * sizeof (gdClipRectangle));
+ 		if (more == 0) return;
+ 		im->clip->max += 8;
++                im->clip->list = more;
+ 	}
+ 	im->clip->list[im->clip->count] = (*rect);
+ 	im->clip->count++;
diff --git a/abs/extra/libwmf/libwmf.install b/abs/extra/libwmf/libwmf.install
new file mode 100644
index 0000000..9c99a90
--- /dev/null
+++ b/abs/extra/libwmf/libwmf.install
@@ -0,0 +1,13 @@
+post_install() {
+  if [ -x usr/bin/gdk-pixbuf-query-loaders ]; then
+    gdk-pixbuf-query-loaders > etc/gtk-2.0/gdk-pixbuf.loaders
+  fi
+}
+
+post_upgrade() {
+  post_install $1
+}
+
+post_remove() {
+  post_install $1
+}
-- 
cgit v0.12

