[libglpng] Fix building with libpng-1.5
Hans de Goede
jwrdegoede at fedoraproject.org
Tue Dec 6 21:39:53 UTC 2011
commit e0707c80910f9cf8d57ea984e9ac41a9fca6d643
Author: Hans de Goede <hdegoede at redhat.com>
Date: Tue Dec 6 22:40:54 2011 +0100
Fix building with libpng-1.5
libglpng-1.45-libpng15.patch | 48 ++++++++++++++++++++++++++++++++++++++++++
libglpng.spec | 15 +++++-------
2 files changed, 54 insertions(+), 9 deletions(-)
---
diff --git a/libglpng-1.45-libpng15.patch b/libglpng-1.45-libpng15.patch
new file mode 100644
index 0000000..9308633
--- /dev/null
+++ b/libglpng-1.45-libpng15.patch
@@ -0,0 +1,48 @@
+diff -up libglpng-1.45.orig/include/GL/glpng.h~ libglpng-1.45.orig/include/GL/glpng.h
+--- libglpng-1.45.orig/include/GL/glpng.h~ 2011-12-06 22:14:59.000000000 +0100
++++ libglpng-1.45.orig/include/GL/glpng.h 2011-12-06 22:15:48.900673919 +0100
+@@ -57,7 +57,7 @@ extern "C" {
+ #define PNG_SIMPLEMIPMAP PNG_SIMPLEMIPMAPS
+
+ /* Transparency parameters */
+-#define PNG_CALLBACK -3 /* Call the callback function to generate alpha */
++#define PNG_CALLBACK_FUNC -3 /* Call the callback function to generate alpha */
+ #define PNG_ALPHA -2 /* Use alpha channel in PNG file, if there is one */
+ #define PNG_SOLID -1 /* No transparency */
+ #define PNG_STENCIL 0 /* Sets alpha to 0 for r=g=b=0, 1 otherwise */
+diff -up libglpng-1.45.orig/src/glpng.c~ libglpng-1.45.orig/src/glpng.c
+--- libglpng-1.45.orig/src/glpng.c~ 2011-12-06 19:38:53.000000000 +0100
++++ libglpng-1.45.orig/src/glpng.c 2011-12-06 22:13:34.501354149 +0100
+@@ -282,7 +282,11 @@ int APIENTRY pngLoadRawF(FILE *fp, pngRa
+ if (!endinfo) return 0;
+
+ // DH: added following lines
++#if PNG_LIBPNG_VER >= 10400
++ if (setjmp(png_jmpbuf(png)))
++#else
+ if (setjmp(png->jmpbuf))
++#endif
+ {
+ error:
+ png_destroy_read_struct(&png, &info, &endinfo);
+@@ -402,7 +406,11 @@ int APIENTRY pngLoadF(FILE *fp, int mipm
+ if (!endinfo) return 0;
+
+ // DH: added following lines
++#if PNG_LIBPNG_VER >= 10400
++ if (setjmp(png_jmpbuf(png)))
++#else
+ if (setjmp(png->jmpbuf))
++#endif
+ {
+ error:
+ png_destroy_read_struct(&png, &info, &endinfo);
+@@ -603,7 +611,7 @@ error:
+ #define ALPHA *q
+
+ switch (trans) {
+- case PNG_CALLBACK:
++ case PNG_CALLBACK_FUNC:
+ FORSTART
+ ALPHA = AlphaCallback((unsigned char) r, (unsigned char) g, (unsigned char) b);
+ FOREND
diff --git a/libglpng.spec b/libglpng.spec
index 72d8abd..6b2dfa0 100644
--- a/libglpng.spec
+++ b/libglpng.spec
@@ -1,6 +1,6 @@
Name: libglpng
Version: 1.45
-Release: 5%{?dist}
+Release: 6%{?dist}
Summary: Toolkit for loading PNG images as OpenGL textures
Group: System Environment/Libraries
License: MIT
@@ -12,7 +12,7 @@ Source1: libglpng-1.45-makefile
# Debian patch, couple of small fixes.
Patch0: libglpng-1.45-debian.patch
Patch1: libglpng-1.45-CVE-2010-1519.patch
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+Patch2: libglpng-1.45-libpng15.patch
BuildRequires: libpng-devel libGL-devel
%description
@@ -34,6 +34,7 @@ developing applications that use %{name}.
%setup -q -n %{name}-%{version}.orig
%patch0 -p1
%patch1 -p1
+%patch2 -p1
cp %{SOURCE1} Makefile
@@ -42,31 +43,27 @@ make %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS -fPIC -Iinclude" libglpng.so.1.45
%install
-rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT%{_prefix} LIB=%{_lib}
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
-%defattr(-,root,root,-)
%doc glpng.htm
%{_libdir}/%{name}.so.*
%files devel
-%defattr(-,root,root,-)
%{_includedir}/GL
%{_libdir}/%{name}.so
%changelog
+* Tue Dec 06 2011 Hans de Goede <hdegoede at redhat.com> - 1.45-6
+- Fix building with libpng-1.5
+
* Tue Dec 06 2011 Adam Jackson <ajax at redhat.com> - 1.45-5
- Rebuild for new libpng
More information about the scm-commits
mailing list