From f7ae4ba2fd32b939353f06c9f39d7dcdbd229601 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Sat, 20 Dec 2014 16:02:59 +0000
Subject: libgdiplus: update to 3.8

---
 abs/extra/libgdiplus/PKGBUILD                      |  37 ++---
 abs/extra/libgdiplus/gdiplus-png14.patch           |  20 ---
 .../libgdiplus/libgdiplus-2.10.9-freetype25.patch  |  26 ++++
 .../libgdiplus-2.10.9-giflib-5.1.0.patch           |  30 ++++
 abs/extra/libgdiplus/libgdiplus-2.10.9-gold.patch  |  16 +++
 abs/extra/libgdiplus/libgdiplus0-giflib5.patch     | 153 +++++++++++++++++++++
 6 files changed, 246 insertions(+), 36 deletions(-)
 delete mode 100644 abs/extra/libgdiplus/gdiplus-png14.patch
 create mode 100644 abs/extra/libgdiplus/libgdiplus-2.10.9-freetype25.patch
 create mode 100644 abs/extra/libgdiplus/libgdiplus-2.10.9-giflib-5.1.0.patch
 create mode 100644 abs/extra/libgdiplus/libgdiplus-2.10.9-gold.patch
 create mode 100644 abs/extra/libgdiplus/libgdiplus0-giflib5.patch

diff --git a/abs/extra/libgdiplus/PKGBUILD b/abs/extra/libgdiplus/PKGBUILD
index 84e3f45..59b451f 100644
--- a/abs/extra/libgdiplus/PKGBUILD
+++ b/abs/extra/libgdiplus/PKGBUILD
@@ -1,29 +1,34 @@
-# $Id: PKGBUILD 148818 2012-02-05 11:51:42Z ibiru $
+# $Id$
 # Maintainer: Daniel Isenmann <daniel@archlinux.org>
 
 pkgname=libgdiplus
-pkgver=2.10
-pkgrel=2
+pkgver=3.8
+pkgrel=1
 pkgdesc="An Open Source Implementation of the GDI+ API"
 arch=(i686 x86_64)
 license=('MPL' 'LGPL')
 url="http://www.mono-project.com"
-depends=('libtiff>=3.9.2-2' 'cairo>=1.8.10' 'giflib' 'glib2>=2.24.0' 'libexif')
-makedepends=('pkgconfig')
-options=('!libtool')
-source=(http://download.mono-project.com/sources/${pkgname}/${pkgname}-${pkgver}.tar.bz2 libpng15.patch)
-md5sums=('451966e8f637e3a1f02d1d30f900255d'
-         'a2d143676bbaceeb88b4c34069e93986')
+depends=('libtiff' 'cairo' 'giflib' 'glib2' 'libexif')
+source=(http://download.mono-project.com/sources/${pkgname}/${pkgname}-${pkgver}.tar.gz
+	libgdiplus0-giflib5.patch)
+md5sums=('e75440257b006d7fc2c39e9c56022c4e'
+         'a2db6fbb81b1367b3d45eaff674c00a5')
+
+prepare() {
+  cd ${pkgname}-${pkgver}
+  patch -Np1 -i ../libgdiplus0-giflib5.patch
+
+  sed -i -e 's/-L\${libjpeg_prefix}\/lib -ljpeg/-ljpeg/' configure
+}
 
 build() {
-  cd "${srcdir}/${pkgname}-${pkgver}"
-  patch -p0 <../libpng15.patch
-  ./configure --prefix=/usr --with-cairo=system || return 1
-  
-  make || return 1
+  cd ${pkgname}-${pkgver}
+  ./configure --prefix=/usr --with-cairo=system
+
+  make
 }
 
 package() {
-  cd "${srcdir}/${pkgname}-${pkgver}"
-  make DESTDIR="${pkgdir}" install || return 1
+  cd ${pkgname}-${pkgver}
+  make DESTDIR="${pkgdir}" install
 }
diff --git a/abs/extra/libgdiplus/gdiplus-png14.patch b/abs/extra/libgdiplus/gdiplus-png14.patch
deleted file mode 100644
index d132608..0000000
--- a/abs/extra/libgdiplus/gdiplus-png14.patch
+++ /dev/null
@@ -1,20 +0,0 @@
---- src/pngcodec.c.orig	2010-01-16 23:47:17.000000000 +0100
-+++ src/pngcodec.c	2010-01-16 23:49:49.000000000 +0100
-@@ -352,7 +352,7 @@
- 						info_ptr->palette[i].blue,
- 						info_ptr->palette[i].green,
- 						info_ptr->palette[i].red,
--						info_ptr->trans[i]); /* alpha */
-+						info_ptr->trans_alpha[i]); /* alpha */
- 			}
- 		}
- 
-@@ -418,7 +418,7 @@
- 		}
- 
- 		if ((color_type == PNG_COLOR_TYPE_GRAY) && (bit_depth < 8)) {
--			png_set_gray_1_2_4_to_8(png_ptr);
-+			png_set_expand_gray_1_2_4_to_8(png_ptr);
- 		}
- 
- 		if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) {
diff --git a/abs/extra/libgdiplus/libgdiplus-2.10.9-freetype25.patch b/abs/extra/libgdiplus/libgdiplus-2.10.9-freetype25.patch
new file mode 100644
index 0000000..bd359f4
--- /dev/null
+++ b/abs/extra/libgdiplus/libgdiplus-2.10.9-freetype25.patch
@@ -0,0 +1,26 @@
+commit 180c02e0f2a2016eba8520b456ca929e9dcf03db
+Author: Jo Shields <directhex@apebox.org>
+Date:   Mon Dec 16 09:24:57 2013 +0000
+
+    Use FreeType macros for tttables.h inclusion
+    
+    As of FreeType 2.1.6 (November 2003), using #include to include Freetype libraries directly is not supported.
+    
+    This has come to a head, as in FreeType 2.5.0, the location of headers has been moved around, breaking building of libgdiplus.
+    
+    This slight change uses the "official" way to include the required header file, without breaking building on older versions of the library.
+
+diff --git a/src/gdiplus-private.h b/src/gdiplus-private.h
+index 59edf9e..dfccc02 100644
+--- a/src/gdiplus-private.h
++++ b/src/gdiplus-private.h
+@@ -30,7 +30,8 @@
+ #include <stdio.h>
+ #include <math.h>
+ #include <glib.h>
+-#include <freetype/tttables.h>
++#include <ft2build.h>
++#include FT_TRUETYPE_TABLES_H
+ #include <pthread.h>
+ #include <unistd.h>
+ 
diff --git a/abs/extra/libgdiplus/libgdiplus-2.10.9-giflib-5.1.0.patch b/abs/extra/libgdiplus/libgdiplus-2.10.9-giflib-5.1.0.patch
new file mode 100644
index 0000000..39d3c7a
--- /dev/null
+++ b/abs/extra/libgdiplus/libgdiplus-2.10.9-giflib-5.1.0.patch
@@ -0,0 +1,30 @@
+diff -rupN a/src/gifcodec.c b/src/gifcodec.c
+--- a/src/gifcodec.c	2011-12-02 18:23:12.000000000 +0100
++++ b/src/gifcodec.c	2014-06-01 13:20:17.027203704 +0200
+@@ -581,7 +581,7 @@ gdip_load_gif_image (void *stream, GpIma
+ 	}
+ 
+ 	FreeExtensionMono(&global_extensions);
+-	DGifCloseFile (gif);
++	DGifCloseFile (gif, NULL);
+ 
+ 	*image = result;
+ 	return Ok;
+@@ -597,7 +597,7 @@ error:
+ 
+ 	if (gif != NULL) {
+ 		FreeExtensionMono (&global_extensions);
+-		DGifCloseFile (gif);
++		DGifCloseFile (gif, NULL);
+ 	}
+ 
+ 	*image = NULL;
+@@ -923,7 +923,7 @@ gdip_save_gif_image (void *stream, GpIma
+ 		}
+ 	}
+ 
+-	EGifCloseFile (fp);	
++	EGifCloseFile (fp, NULL);	
+ 	
+ 	return Ok;
+ 
diff --git a/abs/extra/libgdiplus/libgdiplus-2.10.9-gold.patch b/abs/extra/libgdiplus/libgdiplus-2.10.9-gold.patch
new file mode 100644
index 0000000..379ae94
--- /dev/null
+++ b/abs/extra/libgdiplus/libgdiplus-2.10.9-gold.patch
@@ -0,0 +1,16 @@
+ tests/Makefile.in |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/tests/Makefile.in b/tests/Makefile.in
+index 97f5f4e..c02ca25 100644
+--- a/tests/Makefile.in
++++ b/tests/Makefile.in
+@@ -228,7 +228,7 @@ DEPS = \
+ 	$(top_builddir)/src/libgdiplus.la
+ 
+ LDADDS = \
+-	$(top_builddir)/src/libgdiplus.la
++	$(top_builddir)/src/libgdiplus.la -lX11 -lglib-2.0
+ 
+ testgdi_DEPENDENCIES = $(TEST_DEPS)
+ testgdi_LDADD = $(LDADDS)
diff --git a/abs/extra/libgdiplus/libgdiplus0-giflib5.patch b/abs/extra/libgdiplus/libgdiplus0-giflib5.patch
new file mode 100644
index 0000000..0f48e08
--- /dev/null
+++ b/abs/extra/libgdiplus/libgdiplus0-giflib5.patch
@@ -0,0 +1,153 @@
+---
+ src/gifcodec.c |   50 +++++++++++++++++++++++++++++++++++++++++---------
+ 1 file changed, 41 insertions(+), 9 deletions(-)
+
+Index: libgdiplus-2.10.9/src/gifcodec.c
+===================================================================
+--- libgdiplus-2.10.9.orig/src/gifcodec.c
++++ libgdiplus-2.10.9/src/gifcodec.c
+@@ -39,8 +39,15 @@ GUID gdip_gif_image_format_guid = {0xb96
+ 
+ #include "gifcodec.h"
+ 
++#if !defined(GIFLIB_MAJOR) || GIFLIB_MAJOR < 5
+ /* giflib declares this incorrectly as EgifOpen */
+ extern GifFileType *EGifOpen(void *userData, OutputFunc writeFunc);
++#endif
++#if !defined(GIFLIB_MAJOR) || !(GIFLIB_MAJOR > 5 || \
++    (GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1))
++#	define DGifCloseFile(a, b) DGifCloseFile(a)
++#	define EGifCloseFile(a, b) EGifCloseFile(a)
++#endif
+ 
+ /* Data structure used for callback */
+ typedef struct
+@@ -105,7 +112,7 @@ gdip_gif_inputfunc (GifFileType *gif, Gi
+ */
+ 
+ static int
+-AddExtensionBlockMono(SavedImage *New, int Len, BYTE ExtData[])
++AddExtensionBlockMono(SavedImage *New, int Len, int func, BYTE ExtData[])
+ {
+ 	ExtensionBlock	*ep;
+ 
+@@ -129,7 +136,7 @@ AddExtensionBlockMono(SavedImage *New, i
+ 
+ 	if (ExtData) {
+ 		memcpy(ep->Bytes, ExtData, Len);
+-		ep->Function = New->Function;
++		ep->Function = func;
+ 	}
+ 
+ 	return (GIF_OK);
+@@ -232,20 +239,20 @@ DGifSlurpMono(GifFileType * GifFile, Sav
+ 			}
+ 
+ 			case EXTENSION_RECORD_TYPE: {
+-				if (DGifGetExtension(GifFile, &temp_save.Function, &ExtData) == GIF_ERROR) {
++				int func;
++				if (DGifGetExtension(GifFile, &func, &ExtData) == GIF_ERROR) {
+ 					return (GIF_ERROR);
+ 				}
+ 
+ 				while (ExtData != NULL) {
+ 					/* Create an extension block with our data */
+-					if (AddExtensionBlockMono(&temp_save, ExtData[0], &ExtData[1]) == GIF_ERROR) {
++					if (AddExtensionBlockMono(&temp_save, func, ExtData[0], &ExtData[1]) == GIF_ERROR) {
+ 						return (GIF_ERROR);
+ 					}
+ 
+ 					if (DGifGetExtensionNext(GifFile, &ExtData) == GIF_ERROR) {
+ 						return (GIF_ERROR);
+ 					}
+-					temp_save.Function = 0;
+ 				}
+ 				break;
+ 			}
+@@ -303,12 +310,19 @@ gdip_load_gif_image (void *stream, GpIma
+ 	result = NULL;
+ 	loop_counter = FALSE;
+ 
++#if GIFLIB_MAJOR < 5
+ 	if (from_file) {
+ 		gif = DGifOpen(stream, &gdip_gif_fileinputfunc);
+ 	} else {
+ 		gif = DGifOpen (stream, &gdip_gif_inputfunc);
+ 	}
+-	
++#else
++	if (from_file)
++		gif = DGifOpen(stream, &gdip_gif_fileinputfunc, NULL);
++	else
++		gif = DGifOpen(stream, &gdip_gif_inputfunc, NULL);
++#endif
++
+ 	if (gif == NULL) {
+ 		goto error;
+ 	}
+@@ -581,7 +595,7 @@ gdip_load_gif_image (void *stream, GpIma
+ 	}
+ 
+ 	FreeExtensionMono(&global_extensions);
+-	DGifCloseFile (gif);
++	DGifCloseFile (gif, NULL);
+ 
+ 	*image = result;
+ 	return Ok;
+@@ -597,7 +611,7 @@ error:
+ 
+ 	if (gif != NULL) {
+ 		FreeExtensionMono (&global_extensions);
+-		DGifCloseFile (gif);
++		DGifCloseFile (gif, NULL);
+ 	}
+ 
+ 	*image = NULL;
+@@ -660,11 +674,22 @@ gdip_save_gif_image (void *stream, GpIma
+ 		return InvalidParameter;
+ 	}
+ 
++#if GIFLIB_MAJOR < 5
+ 	if (from_file) {
+ 		fp = EGifOpenFileName (stream, 0);
+ 	} else {
+ 		fp = EGifOpen (stream, gdip_gif_outputfunc);
+ 	}
++#else
++	if (from_file)
++		fp = EGifOpenFileName (stream, 0, NULL);
++	else
++		fp = EGifOpen (stream, gdip_gif_outputfunc, NULL);
++#define MakeMapObject  GifMakeMapObject
++#define FreeMapObject  GifFreeMapObject
++#define QuantizeBuffer GifQuantizeBuffer
++#define BitSize        GifBitSize
++#endif
+ 		
+ 	if (!fp) {
+ 		return FileNotFound;
+@@ -848,8 +873,15 @@ gdip_save_gif_image (void *stream, GpIma
+ 						Buffer[0] = 1;
+ 						Buffer[1] = ptr[0];
+ 						Buffer[2] = ptr[1];
++#if GIFLIB_MAJOR < 5
+ 						EGifPutExtensionFirst(fp, APPLICATION_EXT_FUNC_CODE, 11, "NETSCAPE2.0");
+ 						EGifPutExtensionLast(fp, APPLICATION_EXT_FUNC_CODE, 3, Buffer);
++#else
++						EGifPutExtensionLeader(fp, APPLICATION_EXT_FUNC_CODE);
++						EGifPutExtensionBlock(fp, 11, "NETSCAPE2.0");
++						EGifPutExtensionBlock(fp, 3, Buffer);
++						EGifPutExtensionTrailer(fp);
++#endif
+ 					}
+ 				}
+ 
+@@ -923,7 +955,7 @@ gdip_save_gif_image (void *stream, GpIma
+ 		}
+ 	}
+ 
+-	EGifCloseFile (fp);	
++	EGifCloseFile (fp, NULL);
+ 	
+ 	return Ok;
+ 
-- 
cgit v0.12

