- updated to 2.10.9

- fix FTBFS (#1089734, #1037161)
epel9
Dan Horák 11 years ago
parent 7de20ce6cc
commit 89a80fb47b

1
.gitignore vendored

@ -1,3 +1,4 @@
libgdiplus-2.6.7.tar.bz2
/libgdiplus-2.8.tar.bz2
/libgdiplus-2.10.tar.bz2
/libgdiplus-2.10.9.tar.bz2

@ -1,164 +0,0 @@
$NetBSD: patch-aa,v 1.8 2011/01/21 10:21:51 wiz Exp $
Fix build with png-1.5.
--- src/pngcodec.c.orig 2010-11-03 16:52:54.000000000 +0000
+++ src/pngcodec.c
@@ -116,10 +116,15 @@ gdip_load_png_properties (png_structp pn
bitmap_data->dpi_horz = png_get_x_pixels_per_inch(png_ptr, info_ptr);
bitmap_data->dpi_vert = png_get_y_pixels_per_inch(png_ptr, info_ptr);
#elif defined(PNG_pHYs_SUPPORTED)
- if ((info_ptr->valid & PNG_INFO_pHYs) && (info_ptr->phys_unit_type == PNG_RESOLUTION_METER)) {
- bitmap_data->image_flags |= ImageFlagsHasRealDPI;
- bitmap_data->dpi_horz = info_ptr->x_pixels_per_unit * 0.0254;
- bitmap_data->dpi_vert = info_ptr->y_pixels_per_unit * 0.0254;
+ if (png_get_valid (png_ptr, info_ptr, PNG_INFO_pHYs)) {
+ png_uint_32 res_x, res_y;
+ int unit_type;
+ png_get_pHYs (png_ptr, info_ptr, &res_x, &res_y, &unit_type);
+ if (unit_type == PNG_RESOLUTION_METER) {
+ bitmap_data->image_flags |= ImageFlagsHasRealDPI;
+ bitmap_data->dpi_horz = res_x * 0.0254;
+ bitmap_data->dpi_vert = res_y * 0.0254;
+ }
}
#endif
/* default to screen resolution (if nothing was provided or available) */
@@ -130,7 +135,7 @@ gdip_load_png_properties (png_structp pn
#if defined(PNG_iCCP_SUPPORTED)
{
png_charp name;
- png_charp profile;
+ png_bytep profile;
png_uint_32 proflen;
int compression_type;
@@ -292,6 +297,11 @@ gdip_load_png_image_from_file_or_stream
ImageFlags colourspace_flag;
int i;
int j;
+ png_colorp png_palette;
+ int png_num_palette;
+ png_bytep trans_alpha;
+ int num_trans;
+ png_color_16p trans_color;
width = png_get_image_width (png_ptr, info_ptr);
height = png_get_image_height (png_ptr, info_ptr);
@@ -309,6 +319,8 @@ gdip_load_png_image_from_file_or_stream
}
/* Copy palette. */
+ png_get_PLTE (png_ptr, info_ptr, &png_palette, &png_num_palette);
+
num_colours = 1 << bit_depth;
if (png_get_color_type (png_ptr, info_ptr) == PNG_COLOR_TYPE_GRAY) {
@@ -321,8 +333,8 @@ gdip_load_png_image_from_file_or_stream
colourspace_flag = ImageFlagsColorSpaceRGB;
palette_entries = num_colours;
- if (palette_entries > info_ptr->num_palette) {
- palette_entries = info_ptr->num_palette;
+ if (palette_entries > png_num_palette) {
+ palette_entries = png_num_palette;
}
palette = GdipAlloc (sizeof(ColorPalette) + (num_colours - 1) * sizeof(ARGB));
@@ -331,29 +343,30 @@ gdip_load_png_image_from_file_or_stream
for (i=0; i < palette_entries; i++) {
set_pixel_bgra (&palette->Entries[i], 0,
- info_ptr->palette[i].blue,
- info_ptr->palette[i].green,
- info_ptr->palette[i].red,
+ png_palette[i].blue,
+ png_palette[i].green,
+ png_palette[i].red,
0xFF); /* alpha */
}
}
+ png_get_tRNS (png_ptr, info_ptr, &trans_alpha, &num_trans, &trans_color);
/* Make sure transparency is respected. */
- if (info_ptr->num_trans > 0) {
+ if (num_trans > 0) {
palette->Flags |= PaletteFlagsHasAlpha;
colourspace_flag |= ImageFlagsHasAlpha;
- if (info_ptr->num_trans > info_ptr->num_palette) {
- info_ptr->num_trans = info_ptr->num_palette;
+ if (num_trans > png_num_palette) {
+ num_trans = png_num_palette;
}
- for (i=0; i < info_ptr->num_trans; i++) {
+ for (i=0; i < num_trans; i++) {
set_pixel_bgra(&palette->Entries[i], 0,
- info_ptr->palette[i].blue,
- info_ptr->palette[i].green,
- info_ptr->palette[i].red,
+ png_palette[i].blue,
+ png_palette[i].green,
+ png_palette[i].red,
#if PNG_LIBPNG_VER > 10399
- info_ptr->trans_alpha [i]); /* alpha */
+ trans_alpha [i]); /* alpha */
#else
info_ptr->trans[i]); /* alpha */
#endif
@@ -398,6 +411,8 @@ gdip_load_png_image_from_file_or_stream
BYTE bit_depth;
int stride;
int interlace;
+ png_colorp png_palette;
+ int png_num_palette;
png_bytep *row_pointers;
BYTE *rawptr;
int i, j;
@@ -490,32 +505,33 @@ gdip_load_png_image_from_file_or_stream
png_byte palette = 0;
png_byte pix = *rowp++;
+ png_get_PLTE (png_ptr, info_ptr, &png_palette, &png_num_palette);
palette = (pix >> 6) & 0x03;
set_pixel_bgra (rawptr, 0,
- info_ptr->palette[palette].blue,
- info_ptr->palette[palette].green,
- info_ptr->palette[palette].red,
+ png_palette[palette].blue,
+ png_palette[palette].green,
+ png_palette[palette].red,
0xFF); /* alpha */
palette = (pix >> 4) & 0x03;
set_pixel_bgra (rawptr, 4,
- info_ptr->palette[palette].blue,
- info_ptr->palette[palette].green,
- info_ptr->palette[palette].red,
+ png_palette[palette].blue,
+ png_palette[palette].green,
+ png_palette[palette].red,
0xFF); /* alpha */
palette = (pix >> 2) & 0x03;
set_pixel_bgra (rawptr, 8,
- info_ptr->palette[palette].blue,
- info_ptr->palette[palette].green,
- info_ptr->palette[palette].red,
+ png_palette[palette].blue,
+ png_palette[palette].green,
+ png_palette[palette].red,
0xFF); /* alpha */
palette = pix & 0x03;
set_pixel_bgra (rawptr, 12,
- info_ptr->palette[palette].blue,
- info_ptr->palette[palette].green,
- info_ptr->palette[palette].red,
+ png_palette[palette].blue,
+ png_palette[palette].green,
+ png_palette[palette].red,
0xFF); /* alpha */
rawptr += 16;
}

@ -0,0 +1,21 @@
diff -up libgdiplus-2.10.9/src/Makefile.am.format libgdiplus-2.10.9/src/Makefile.am
--- libgdiplus-2.10.9/src/Makefile.am.format 2014-04-25 09:24:12.000000000 +0200
+++ libgdiplus-2.10.9/src/Makefile.am 2014-04-25 09:24:21.000000000 +0200
@@ -119,4 +119,4 @@ libgdiplus_la_SOURCES = \
libgdiplus_la_LIBADD = $(GDIPLUS_LIBS)
-INCLUDES = $(GDIPLUS_CFLAGS) -Wall -Wno-unused -Wno-format
+INCLUDES = $(GDIPLUS_CFLAGS) -Wall -Wno-unused
diff -up libgdiplus-2.10.9/src/Makefile.in.format libgdiplus-2.10.9/src/Makefile.in
--- libgdiplus-2.10.9/src/Makefile.in.format 2014-04-25 09:24:16.000000000 +0200
+++ libgdiplus-2.10.9/src/Makefile.in 2014-04-25 09:24:34.000000000 +0200
@@ -361,7 +361,7 @@ libgdiplus_la_SOURCES = \
wmfcodec.h
libgdiplus_la_LIBADD = $(GDIPLUS_LIBS)
-INCLUDES = $(GDIPLUS_CFLAGS) -Wall -Wno-unused -Wno-format
+INCLUDES = $(GDIPLUS_CFLAGS) -Wall -Wno-unused
all: all-am
.SUFFIXES:

@ -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>

@ -0,0 +1,236 @@
From 4b15e34ee859916e5d7eeb7ca4d80e3d3d93ddb5 Mon Sep 17 00:00:00 2001
From: Mike Buland <mike@xagasoft.com>
Date: Tue, 9 Jul 2013 23:38:41 +0200
Subject: [PATCH 1/3] Removed usage of the opaque png info_ptr struct.
The info_ptr structure should not be used, this has been in the png
documentation since at least July 2000.
Hopefully this mantains the same functionality, but in a way that will
compile with the newest versions of libpng.
---
src/pngcodec.c | 90 ++++++++++++++++++++++++++++++++++------------------------
1 file changed, 53 insertions(+), 37 deletions(-)
diff --git a/src/pngcodec.c b/src/pngcodec.c
index 15c608a..ce38d67 100644
--- a/src/pngcodec.c
+++ b/src/pngcodec.c
@@ -116,10 +116,16 @@ gdip_load_png_properties (png_structp png_ptr, png_infop info_ptr, png_infop end
bitmap_data->dpi_horz = png_get_x_pixels_per_inch(png_ptr, info_ptr);
bitmap_data->dpi_vert = png_get_y_pixels_per_inch(png_ptr, info_ptr);
#elif defined(PNG_pHYs_SUPPORTED)
- if ((info_ptr->valid & PNG_INFO_pHYs) && (info_ptr->phys_unit_type == PNG_RESOLUTION_METER)) {
- bitmap_data->image_flags |= ImageFlagsHasRealDPI;
- bitmap_data->dpi_horz = info_ptr->x_pixels_per_unit * 0.0254;
- bitmap_data->dpi_vert = info_ptr->y_pixels_per_unit * 0.0254;
+ {
+ int unit_type;
+ png_uint_32 res_x;
+ png_uint_32 res_y;
+ png_get_pHYs( png_ptr, info_ptr, &res_x, &res_y, &unit_type );
+ if (unit_type == PNG_RESOLUTION_METER) {
+ bitmap_data->image_flags |= ImageFlagsHasRealDPI;
+ bitmap_data->dpi_horz = res_x * 0.0254;
+ bitmap_data->dpi_vert = res_y * 0.0254;
+ }
}
#endif
/* default to screen resolution (if nothing was provided or available) */
@@ -130,11 +136,11 @@ gdip_load_png_properties (png_structp png_ptr, png_infop info_ptr, png_infop end
#if defined(PNG_iCCP_SUPPORTED)
{
png_charp name;
- png_charp profile;
+ png_bytepp profile;
png_uint_32 proflen;
int compression_type;
- if (png_get_iCCP(png_ptr, info_ptr, &name, &compression_type, &profile, &proflen)) {
+ if (png_get_iCCP(png_ptr, info_ptr, &name, &compression_type, profile, &proflen)) {
gdip_bitmapdata_property_add_ASCII(bitmap_data, PropertyTagICCProfileDescriptor, (BYTE*)name);
gdip_bitmapdata_property_add_byte(bitmap_data, PropertyTagICCProfile, (BYTE)compression_type);
}
@@ -243,6 +249,8 @@ gdip_load_png_image_from_file_or_stream (FILE *fp, GetBytesDelegate getBytesFunc
int bit_depth;
int channels;
BYTE color_type;
+ int num_palette;
+ png_colorp png_palette;
png_ptr = png_create_read_struct (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
@@ -320,9 +328,10 @@ gdip_load_png_image_from_file_or_stream (FILE *fp, GetBytesDelegate getBytesFunc
/* Copy the palette data into the GDI+ structure. */
colourspace_flag = ImageFlagsColorSpaceRGB;
+ png_get_PLTE( png_ptr, info_ptr, &png_palette, &num_palette );
palette_entries = num_colours;
- if (palette_entries > info_ptr->num_palette) {
- palette_entries = info_ptr->num_palette;
+ if (palette_entries > num_palette) {
+ palette_entries = num_palette;
}
palette = GdipAlloc (sizeof(ColorPalette) + (num_colours - 1) * sizeof(ARGB));
@@ -331,32 +340,39 @@ gdip_load_png_image_from_file_or_stream (FILE *fp, GetBytesDelegate getBytesFunc
for (i=0; i < palette_entries; i++) {
set_pixel_bgra (&palette->Entries[i], 0,
- info_ptr->palette[i].blue,
- info_ptr->palette[i].green,
- info_ptr->palette[i].red,
+ png_palette[i].blue,
+ png_palette[i].green,
+ png_palette[i].red,
0xFF); /* alpha */
}
}
- /* Make sure transparency is respected. */
- if (info_ptr->num_trans > 0) {
- palette->Flags |= PaletteFlagsHasAlpha;
- colourspace_flag |= ImageFlagsHasAlpha;
+ {
+ png_bytep trans_alpha;
+ int num_trans;
+ png_color_16p trans_color;
- if (info_ptr->num_trans > info_ptr->num_palette) {
- info_ptr->num_trans = info_ptr->num_palette;
- }
+ /* Make sure transparency is respected. */
+ png_get_tRNS( png_ptr, info_ptr, &trans_alpha, &num_trans, &trans_color );
+ if (num_trans > 0) {
+ palette->Flags |= PaletteFlagsHasAlpha;
+ colourspace_flag |= ImageFlagsHasAlpha;
+
+ if (num_trans > num_palette) {
+ num_trans = num_palette;
+ }
- for (i=0; i < info_ptr->num_trans; i++) {
- set_pixel_bgra(&palette->Entries[i], 0,
- info_ptr->palette[i].blue,
- info_ptr->palette[i].green,
- info_ptr->palette[i].red,
+ for (i=0; i < num_trans; i++) {
+ set_pixel_bgra(&palette->Entries[i], 0,
+ png_palette[i].blue,
+ png_palette[i].green,
+ png_palette[i].red,
#if PNG_LIBPNG_VER > 10399
- info_ptr->trans_alpha [i]); /* alpha */
+ trans_alpha [i]); /* alpha */
#else
- info_ptr->trans[i]); /* alpha */
+ trans[i]); /* alpha */
#endif
+ }
}
}
@@ -486,30 +502,30 @@ gdip_load_png_image_from_file_or_stream (FILE *fp, GetBytesDelegate getBytesFunc
palette = (pix >> 6) & 0x03;
set_pixel_bgra (rawptr, 0,
- info_ptr->palette[palette].blue,
- info_ptr->palette[palette].green,
- info_ptr->palette[palette].red,
+ png_palette[palette].blue,
+ png_palette[palette].green,
+ png_palette[palette].red,
0xFF); /* alpha */
palette = (pix >> 4) & 0x03;
set_pixel_bgra (rawptr, 4,
- info_ptr->palette[palette].blue,
- info_ptr->palette[palette].green,
- info_ptr->palette[palette].red,
+ png_palette[palette].blue,
+ png_palette[palette].green,
+ png_palette[palette].red,
0xFF); /* alpha */
palette = (pix >> 2) & 0x03;
set_pixel_bgra (rawptr, 8,
- info_ptr->palette[palette].blue,
- info_ptr->palette[palette].green,
- info_ptr->palette[palette].red,
+ png_palette[palette].blue,
+ png_palette[palette].green,
+ png_palette[palette].red,
0xFF); /* alpha */
palette = pix & 0x03;
set_pixel_bgra (rawptr, 12,
- info_ptr->palette[palette].blue,
- info_ptr->palette[palette].green,
- info_ptr->palette[palette].red,
+ png_palette[palette].blue,
+ png_palette[palette].green,
+ png_palette[palette].red,
0xFF); /* alpha */
rawptr += 16;
}
--
1.9.0
From 87c953a4adf21fb8e1264144b4ac309819ab16e7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9s=20G=2E=20Aragoneses?= <knocte@gmail.com>
Date: Tue, 9 Jul 2013 23:44:30 +0200
Subject: [PATCH 2/3] Fix previous commit so that it doesn't break the build
with libpng v12.0
---
src/pngcodec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/pngcodec.c b/src/pngcodec.c
index ce38d67..cf48152 100644
--- a/src/pngcodec.c
+++ b/src/pngcodec.c
@@ -370,7 +370,7 @@ gdip_load_png_image_from_file_or_stream (FILE *fp, GetBytesDelegate getBytesFunc
#if PNG_LIBPNG_VER > 10399
trans_alpha [i]); /* alpha */
#else
- trans[i]); /* alpha */
+ info_ptr->trans[i]); /* alpha */
#endif
}
}
--
1.9.0
From 2766e9574a7437b5b52c9e778abe83420729dba0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9s=20G=2E=20Aragoneses?= <knocte@gmail.com>
Date: Tue, 9 Jul 2013 23:48:07 +0200
Subject: [PATCH 3/3] Use png_bytep instead of png_bytepp for the iCCP profile
As suggested by Andrew Ruder in https://github.com/mono/libgdiplus/pull/3
to avoid storing the profile pointer in an undefined memory location.
---
src/pngcodec.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/pngcodec.c b/src/pngcodec.c
index cf48152..25c9baf 100644
--- a/src/pngcodec.c
+++ b/src/pngcodec.c
@@ -136,11 +136,11 @@ gdip_load_png_properties (png_structp png_ptr, png_infop info_ptr, png_infop end
#if defined(PNG_iCCP_SUPPORTED)
{
png_charp name;
- png_bytepp profile;
+ png_bytep profile;
png_uint_32 proflen;
int compression_type;
- if (png_get_iCCP(png_ptr, info_ptr, &name, &compression_type, profile, &proflen)) {
+ if (png_get_iCCP(png_ptr, info_ptr, &name, &compression_type, &profile, &proflen)) {
gdip_bitmapdata_property_add_ASCII(bitmap_data, PropertyTagICCProfileDescriptor, (BYTE*)name);
gdip_bitmapdata_property_add_byte(bitmap_data, PropertyTagICCProfile, (BYTE)compression_type);
}
--
1.9.0

@ -0,0 +1,23 @@
diff -up libgdiplus-2.10.9/tests/Makefile.am.tests libgdiplus-2.10.9/tests/Makefile.am
--- libgdiplus-2.10.9/tests/Makefile.am.tests 2011-12-02 18:23:12.000000000 +0100
+++ libgdiplus-2.10.9/tests/Makefile.am 2014-04-25 10:21:47.615549531 +0200
@@ -1,5 +1,7 @@
## Makefile.am for libgdiplus/tests
+LIBS = $(GDIPLUS_LIBS)
+
INCLUDES = \
-I$(top_srcdir) \
-I$(top_builddir)/src \
diff -up libgdiplus-2.10.9/tests/Makefile.in.tests libgdiplus-2.10.9/tests/Makefile.in
--- libgdiplus-2.10.9/tests/Makefile.in.tests 2014-04-25 10:15:23.083033896 +0200
+++ libgdiplus-2.10.9/tests/Makefile.in 2014-04-25 10:26:27.089551635 +0200
@@ -127,7 +127,7 @@ LDFLAGS = @LDFLAGS@
LIBEXIF_CFLAGS = @LIBEXIF_CFLAGS@
LIBEXIF_LIBS = @LIBEXIF_LIBS@
LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
+LIBS = @GDIPLUS_LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@

@ -1,15 +1,22 @@
Name: libgdiplus
Version: 2.10
Release: 11%{?dist}
Version: 2.10.9
Release: 1%{?dist}
Summary: An Open Source implementation of the GDI+ API
Group: System Environment/Libraries
License: MIT
URL: http://www.mono-project.com/Main_Page
Source0: http://ftp.novell.com/pub/mono/sources/%{name}/%{name}-%{version}.tar.bz2
Source0: http://download.mono-project.com/sources/%{name}/%{name}-%{version}.tar.bz2
# Patch for linking against libpng 1.5 (BZ #843330)
# http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/dev-dotnet/libgdiplus/files/libgdiplus-2.10.1-libpng15.patch
Patch0: libgdiplus-2.10-libpng15.patch
# https://github.com/mono/libgdiplus/commit/506df13e6e1c9915c248305e47f0b67549732566
Patch0: libgdiplus-2.10.9-libpng15.patch
# Fix build with Freetype 2.5
# https://github.com/mono/libgdiplus/commit/180c02e0f2a2016eba8520b456ca929e9dcf03db
Patch1: libgdiplus-2.10.9-freetype25.patch
# drop -Wno-format so the default -Werror=format-security works
Patch2: libgdiplus-2.10.9-format.patch
# https://github.com/mono/libgdiplus/commit/1fa831c7440f1985d2b730211bbf8a059c10a63b
Patch3: libgdiplus-2.10.9-tests.patch
BuildRequires: freetype-devel glib2-devel libjpeg-devel libtiff-devel
BuildRequires: libpng-devel fontconfig-devel
BuildRequires: cairo-devel giflib-devel libexif-devel
@ -29,7 +36,10 @@ Development files for libgdiplus
%prep
%setup -q
%patch0 -p0 -b .libpng
%patch0 -p1 -b .libpng15
%patch1 -p1 -b .freetype25
%patch2 -p1 -b .format
%patch3 -p1 -b .tests
%build
%configure --disable-static
@ -44,16 +54,18 @@ find %{buildroot} -name '*.la' -exec rm -f {} ';'
%postun -p /sbin/ldconfig
%files
%defattr(-,root,root,-)
%doc COPYING NEWS README TODO AUTHORS ChangeLog
%{_libdir}/lib*.so.*
%files devel
%defattr(-,root,root,-)
%{_libdir}/pkgconfig/*
%{_libdir}/lib*.so
%changelog
* Fri Apr 25 2014 Dan Horák <dan[at]danny.cz> - 2.10.9-1
- updated to 2.10.9
- fix FTBFS (#1089734, #1037161)
* Mon Nov 25 2013 Björn Esser <bjoern.esser@gmail.com> - 2.10-11
- rebuilt for giflib-5.0.5 on rawhide
- removed BuildRequires: libungif-devel, since the package passed away

@ -1 +1 @@
451966e8f637e3a1f02d1d30f900255d libgdiplus-2.10.tar.bz2
b4615c14584b5d73cbb9757c28887654 libgdiplus-2.10.9.tar.bz2

Loading…
Cancel
Save