[98836] trunk/dports/graphics/xaos

jmr at macports.org jmr at macports.org
Thu Oct 18 02:46:23 PDT 2012


Revision: 98836
          http://trac.macports.org//changeset/98836
Author:   jmr at macports.org
Date:     2012-10-18 02:46:23 -0700 (Thu, 18 Oct 2012)
Log Message:
-----------
xaos: fix build with libpng 1.5 (#35996)

Modified Paths:
--------------
    trunk/dports/graphics/xaos/Portfile

Added Paths:
-----------
    trunk/dports/graphics/xaos/files/png.c-r523.diff

Modified: trunk/dports/graphics/xaos/Portfile
===================================================================
--- trunk/dports/graphics/xaos/Portfile	2012-10-18 09:32:34 UTC (rev 98835)
+++ trunk/dports/graphics/xaos/Portfile	2012-10-18 09:46:23 UTC (rev 98836)
@@ -37,7 +37,8 @@
                         port:gsl
 
 # Fix "make: `install' is up to date" on case-insensitive filesystems.
-patchfiles              patch-Makefile.in.diff
+# Also apply upstream r523 to fix build with libpng 1.5.
+patchfiles              patch-Makefile.in.diff png.c-r523.diff
 
 configure.cflags-append -I${prefix}/include
 configure.args          --with-long-double=yes \

Added: trunk/dports/graphics/xaos/files/png.c-r523.diff
===================================================================
--- trunk/dports/graphics/xaos/files/png.c-r523.diff	                        (rev 0)
+++ trunk/dports/graphics/xaos/files/png.c-r523.diff	2012-10-18 09:46:23 UTC (rev 98836)
@@ -0,0 +1,117 @@
+--- src/util/png.c	2011/06/26 21:08:52	522
++++ src/util/png.c	2011/10/30 23:20:18	523
+@@ -2,6 +2,7 @@
+ #ifndef _plan9_
+ #include <aconfig.h>
+ #ifdef USE_PNG
++#include <zlib.h>
+ #include <png.h>
+ #endif
+ #include <stdlib.h>
+@@ -35,6 +36,7 @@
+     png_structp png_ptr;
+     png_infop info_ptr;
+     png_color palette[256];
++    png_color_8 sig_bit;
+     volatile unsigned short a = 255;
+     volatile unsigned char *b = (volatile unsigned char *) &a;
+ #ifdef _undefined_
+@@ -64,12 +66,14 @@
+ 	png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
+ 	return "No memory to create png info structure";
+     }
+-    if (setjmp(png_ptr->jmpbuf)) {
++    if (setjmp(png_jmpbuf(png_ptr))) {
+ 	png_destroy_write_struct(&png_ptr, &info_ptr);
+ 	fclose(file);
+ 	return strerror(errno);
+     }
+     png_init_io(png_ptr, file);
++
++#ifdef _undefined_
+     png_set_filter(png_ptr, 0,
+ 		   PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_PAETH |
+ 		   PNG_FILTER_UP | PNG_FILTER_AVG);
+@@ -82,58 +86,54 @@
+     png_set_compression_strategy(png_ptr, Z_DEFAULT_STRATEGY);
+     png_set_compression_window_bits(png_ptr, 15);
+     png_set_compression_method(png_ptr, 8);
+-
+-    info_ptr->width = image->width;
+-    info_ptr->height = image->height;
+-    /*info_ptr->gamma=1.0; */
+-    info_ptr->gamma = 0.5;
+-    info_ptr->valid |= PNG_INFO_gAMA | PNG_INFO_pHYs;
+-    info_ptr->x_pixels_per_unit = (png_uint_32) (100 / image->pixelwidth);
+-    info_ptr->y_pixels_per_unit = (png_uint_32) (100 / image->pixelheight);
+-
++#endif
+ 
+     switch (image->palette->type) {
+     case C256:
+ 	{
+ 	    int i;
+-	    info_ptr->color_type = PNG_COLOR_TYPE_PALETTE;
+-	    info_ptr->bit_depth = image->bytesperpixel * 8;
+-	    info_ptr->palette = palette;
+-	    info_ptr->valid |= PNG_INFO_PLTE;
+-	    for (i = 0; i < image->palette->end; i++)
+-		info_ptr->palette[i].red = image->palette->rgb[i][0],
+-		    info_ptr->palette[i].green = image->palette->rgb[i][1],
+-		    info_ptr->palette[i].blue = image->palette->rgb[i][2],
+-		    info_ptr->num_palette = image->palette->end;
++            png_set_IHDR(png_ptr, info_ptr, image->width, image->height, 
++                    image->bytesperpixel * 8, PNG_COLOR_TYPE_PALETTE, 
++                    PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, 
++                    PNG_FILTER_TYPE_DEFAULT);
++	    for (i = 0; i < image->palette->end; i++) {
++		palette[i].red = image->palette->rgb[i][0];
++	        palette[i].green = image->palette->rgb[i][1];
++		palette[i].blue = image->palette->rgb[i][2];
++            }
++            png_set_PLTE(png_ptr, info_ptr, palette, image->palette->end);
+ 	}
+ 	break;
+     case SMALLITER:
+     case LARGEITER:
+     case GRAYSCALE:
+-	info_ptr->color_type = PNG_COLOR_TYPE_GRAY;
+-	info_ptr->bit_depth = image->bytesperpixel * 8;
++        png_set_IHDR(png_ptr, info_ptr, image->width, image->height, 
++                image->bytesperpixel * 8, PNG_COLOR_TYPE_GRAY, 
++                PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, 
++                PNG_FILTER_TYPE_DEFAULT);
+ 	break;
+     case TRUECOLOR:
+     case TRUECOLOR24:
+     case TRUECOLOR16:
+-	info_ptr->color_type = PNG_COLOR_TYPE_RGB;
+-	info_ptr->bit_depth = 8;
+-	info_ptr->sig_bit.red = 8 - image->palette->info.truec.rprec;
+-	info_ptr->sig_bit.green = 8 - image->palette->info.truec.gprec;
+-	info_ptr->sig_bit.blue = 8 - image->palette->info.truec.bprec;
++        png_set_IHDR(png_ptr, info_ptr, image->width, image->height, 
++                8, PNG_COLOR_TYPE_RGB, 
++                PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, 
++                PNG_FILTER_TYPE_DEFAULT);
++	sig_bit.red = 8 - image->palette->info.truec.rprec;
++	sig_bit.green = 8 - image->palette->info.truec.gprec;
++	sig_bit.blue = 8 - image->palette->info.truec.bprec;
++        png_set_sBIT(png_ptr, info_ptr, &sig_bit);
+ 	break;
+     }
+-    info_ptr->interlace_type = 0;
+ #ifdef _undefined_
+     png_set_text(png_ptr, info_ptr, comments,
+ 		 sizeof(comments) / sizeof(png_text));
+ #endif
+-
+     png_write_info(png_ptr, info_ptr);
+     /*png_set_filler(png_ptr,0,PNG_FILLER_AFTER); */
+     png_set_packing(png_ptr);
+     if (image->palette->type & (TRUECOLOR | TRUECOLOR24 | TRUECOLOR16))
+-	png_set_shift(png_ptr, &(info_ptr->sig_bit));
++	png_set_shift(png_ptr, &sig_bit);
+     if (*b == 255)
+ 	png_set_swap(png_ptr);
+     png_set_bgr(png_ptr);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20121018/6b6f9c18/attachment-0001.html>


More information about the macports-changes mailing list