[tucnak2] libpng fixes.

Jon Ciesla limb at fedoraproject.org
Wed Aug 1 15:39:37 UTC 2012


commit dea6c4c185d5e04c7e5e2fde392fc3a496eb2437
Author: Jon Ciesla <limburgher at gmail.com>
Date:   Wed Aug 1 10:39:28 2012 -0500

    libpng fixes.

 tucnak2-libpng15.patch |  169 ++++++++++++++++++++++++++++++++++++++++++++++++
 tucnak2.spec           |    7 ++-
 2 files changed, 175 insertions(+), 1 deletions(-)
---
diff --git a/tucnak2-libpng15.patch b/tucnak2-libpng15.patch
new file mode 100644
index 0000000..953896b
--- /dev/null
+++ b/tucnak2-libpng15.patch
@@ -0,0 +1,169 @@
+diff -Naur tucnak2-2.31.orig/configure tucnak2-2.31/configure
+--- tucnak2-2.31.orig/configure	2010-01-01 15:22:31.000000000 -0500
++++ tucnak2-2.31/configure	2012-07-26 18:34:21.013036806 -0400
+@@ -5711,12 +5711,12 @@
+         pkg_cv_LIBPNG_CFLAGS="$LIBPNG_CFLAGS"
+     else
+         if test -n "$PKG_CONFIG" && \
+-    { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libpng12 > 1.2.0\"") >&5
+-  ($PKG_CONFIG --exists --print-errors "libpng12 > 1.2.0") 2>&5
++    { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libpng > 1.2.0\"") >&5
++  ($PKG_CONFIG --exists --print-errors "libpng > 1.2.0") 2>&5
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   (exit $ac_status); }; then
+-  pkg_cv_LIBPNG_CFLAGS=`$PKG_CONFIG --cflags "libpng12 > 1.2.0" 2>/dev/null`
++  pkg_cv_LIBPNG_CFLAGS=`$PKG_CONFIG --cflags "libpng > 1.2.0" 2>/dev/null`
+ else
+   pkg_failed=yes
+ fi
+@@ -5729,12 +5729,12 @@
+         pkg_cv_LIBPNG_LIBS="$LIBPNG_LIBS"
+     else
+         if test -n "$PKG_CONFIG" && \
+-    { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libpng12 > 1.2.0\"") >&5
+-  ($PKG_CONFIG --exists --print-errors "libpng12 > 1.2.0") 2>&5
++    { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libpng > 1.2.0\"") >&5
++  ($PKG_CONFIG --exists --print-errors "libpng > 1.2.0") 2>&5
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   (exit $ac_status); }; then
+-  pkg_cv_LIBPNG_LIBS=`$PKG_CONFIG --libs "libpng12 > 1.2.0" 2>/dev/null`
++  pkg_cv_LIBPNG_LIBS=`$PKG_CONFIG --libs "libpng > 1.2.0" 2>/dev/null`
+ else
+   pkg_failed=yes
+ fi
+@@ -5753,9 +5753,9 @@
+         _pkg_short_errors_supported=no
+ fi
+         if test $_pkg_short_errors_supported = yes; then
+-	        LIBPNG_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "libpng12 > 1.2.0"`
++	        LIBPNG_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "libpng > 1.2.0"`
+         else
+-	        LIBPNG_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libpng12 > 1.2.0"`
++	        LIBPNG_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libpng > 1.2.0"`
+         fi
+ 	# Put the nasty error message in config.log where it belongs
+ 	echo "$LIBPNG_PKG_ERRORS" >&5
+@@ -5777,7 +5777,7 @@
+ #define HAVE_LIBPNG
+ _ACEOF
+ 
+-              tucnak_libpng_ver=`$PKG_CONFIG --modversion 'libpng12 > 1.2.0'`
++              tucnak_libpng_ver=`$PKG_CONFIG --modversion 'libpng > 1.2.0'`
+ fi
+ fi
+ 
+diff -Naur tucnak2-2.31.orig/configure.in tucnak2-2.31/configure.in
+--- tucnak2-2.31.orig/configure.in	2010-01-01 15:21:52.000000000 -0500
++++ tucnak2-2.31/configure.in	2012-07-26 18:33:01.088534579 -0400
+@@ -151,9 +151,9 @@
+ if test "x$with_png" != "xno"; then
+ # check for libpng
+ tucnak_libpng_ver=""
+-PKG_CHECK_MODULES(LIBPNG, libpng12 > 1.2.0,
++PKG_CHECK_MODULES(LIBPNG, libpng > 1.2.0,
+             [ AC_DEFINE([HAVE_LIBPNG], [], [libpng]) 
+-              tucnak_libpng_ver=`$PKG_CONFIG --modversion 'libpng12 > 1.2.0'` ], 
++              tucnak_libpng_ver=`$PKG_CONFIG --modversion 'libpng > 1.2.0'` ], 
+             [ tucnak_olibs="$tucnak_olibs libpng"
+               tucnak_odebs="$tucnak_odebs libpng-dev"])
+ fi
+diff -Naur tucnak2-2.31.orig/src/gfx_png.c tucnak2-2.31/src/gfx_png.c
+--- tucnak2-2.31.orig/src/gfx_png.c	2009-09-28 12:58:40.000000000 -0400
++++ tucnak2-2.31/src/gfx_png.c	2012-07-26 18:42:44.263216141 -0400
+@@ -55,12 +55,13 @@
+ 	    
+     png_init_io(png_ptr, fi);
+ 
+-    info_ptr->width = surf->w;
+-    info_ptr->height = surf->h;
+-    info_ptr->bit_depth = 8;
+-    info_ptr->color_type = PNG_COLOR_TYPE_RGB;
+-    info_ptr->interlace_type = 1;
+-    info_ptr->valid = 0;
++    png_set_IHDR(png_ptr, info_ptr,
++		 surf->w, surf->h,
++		 8,
++		 PNG_COLOR_TYPE_RGB,
++		 PNG_INTERLACE_ADAM7,
++		 PNG_COMPRESSION_TYPE_DEFAULT,
++		 PNG_FILTER_TYPE_DEFAULT);
+ 
+     /* Set headers */
+ 
+diff -Naur tucnak2-2.31.orig/src/img_png.c tucnak2-2.31/src/img_png.c
+--- tucnak2-2.31.orig/src/img_png.c	2009-09-28 12:58:40.000000000 -0400
++++ tucnak2-2.31/src/img_png.c	2012-07-26 18:31:11.931639101 -0400
+@@ -104,7 +104,7 @@
+ 	png_structp png_ptr;
+ 	png_infop info_ptr;
+ 	png_uint_32 width, height;
+-	int bit_depth, color_type, interlace_type;
++	int bit_depth, color_type, interlace_type, channels;
+ 	Uint32 Rmask;
+ 	Uint32 Gmask;
+ 	Uint32 Bmask;
+@@ -142,7 +142,7 @@
+ 	 * the normal method of doing things with libpng).  REQUIRED unless you
+ 	 * set up your own error handlers in png_create_read_struct() earlier.
+ 	 */
+-	if ( setjmp(png_ptr->jmpbuf) ) {
++	if ( setjmp(png_jmpbuf(png_ptr)) ) {
+ 		IMG_SetError("Error reading the PNG file.");
+ 		goto done;
+ 	}
+@@ -154,6 +154,7 @@
+ 	png_read_info(png_ptr, info_ptr);
+ 	png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth,
+ 			&color_type, &interlace_type, NULL, NULL);
++	channels = png_get_channels(png_ptr, info_ptr);
+ 
+ 	/* tell libpng to strip 16 bit/color files down to 8 bits/color */
+ 	png_set_strip_16(png_ptr) ;
+@@ -211,9 +212,9 @@
+ 			Rmask = 0x000000FF;
+ 			Gmask = 0x0000FF00;
+ 			Bmask = 0x00FF0000;
+-			Amask = (info_ptr->channels == 4) ? 0xFF000000 : 0;
++			Amask = (channels == 4) ? 0xFF000000 : 0;
+ 		} else {
+-		        int s = (info_ptr->channels == 4) ? 0 : 8;
++		        int s = (channels == 4) ? 0 : 8;
+ 			Rmask = 0xFF000000 >> s;
+ 			Gmask = 0x00FF0000 >> s;
+ 			Bmask = 0x0000FF00 >> s;
+@@ -221,7 +222,7 @@
+ 		}
+ 	}
+ 	surface = SDL_AllocSurface(SDL_SWSURFACE, width, height,
+-			bit_depth*info_ptr->channels, Rmask,Gmask,Bmask,Amask);
++			bit_depth*channels, Rmask,Gmask,Bmask,Amask);
+ 	if ( surface == NULL ) {
+ 		IMG_SetError("Out of memory");
+ 		goto done;
+@@ -271,12 +272,18 @@
+ 		    palette->colors[i].g = i;
+ 		    palette->colors[i].b = i;
+ 		}
+-	    } else if (info_ptr->num_palette > 0 ) {
+-		palette->ncolors = info_ptr->num_palette; 
+-		for( i=0; i<info_ptr->num_palette; ++i ) {
+-		    palette->colors[i].b = info_ptr->palette[i].blue;
+-		    palette->colors[i].g = info_ptr->palette[i].green;
+-		    palette->colors[i].r = info_ptr->palette[i].red;
++	    } else if (color_type == PNG_COLOR_TYPE_PALETTE) {
++		png_colorp png_palette;
++		int num_palette;
++
++		if (png_get_PLTE(png_ptr, info_ptr,
++				 &png_palette, &num_palette)) {
++		    palette->ncolors = num_palette; 
++		    for( i=0; i<num_palette; ++i ) {
++			palette->colors[i].b = png_palette[i].blue;
++			palette->colors[i].g = png_palette[i].green;
++			palette->colors[i].r = png_palette[i].red;
++		    }
+ 		}
+ 	    }
+ 	}
diff --git a/tucnak2.spec b/tucnak2.spec
index 16af507..21c4d9b 100644
--- a/tucnak2.spec
+++ b/tucnak2.spec
@@ -1,6 +1,6 @@
 Name:           tucnak2
 Version:        2.31
-Release:        5%{?dist}
+Release:        6%{?dist}
 Summary:        VHF contest logging program
 
 Group:          Applications/Communications
@@ -9,6 +9,7 @@ URL:            http://tucnak.nagano.cz/wiki/Main_Page
 Source0:        http://tucnak.nagano.cz/%{name}-%{version}.tar.gz
 Patch0:         tucnak2-2.31-soundwrapper.patch
 Patch1:         tucnak2-2.25-sharedconf.patch
+Patch2:         tucnak2-libpng15.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildRequires:  SDL-devel, glib2-devel, libpng-devel, libsndfile-devel
@@ -26,6 +27,7 @@ much more.
 %setup -q
 %patch0 -p1 -b .soundwrapper
 %patch1 -p1 -b .sharedconf
+%patch2 -p1 -b .libpng15
 sed -i -e "s/Encoding=UTF-8//g" -e "s/Categories=HamRadio/Categories=Network;HamRadio;/g" share/applications/%{name}.desktop
 
 #all files must be UTF-8
@@ -76,6 +78,9 @@ rm -rf $RPM_BUILD_ROOT
 
 
 %changelog
+* Wed Aug 01 2012 Jon Ciesla <limburgher at gmail.com> - 2.31-6
+- Tom Lane's libpng fixes, BZ 843658.
+
 * Sun Jul 22 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2.31-5
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
 


More information about the scm-commits mailing list