diff --git a/36_libpng15.dpatch b/36_libpng15.dpatch new file mode 100644 index 0000000..fbeba17 --- /dev/null +++ b/36_libpng15.dpatch @@ -0,0 +1,84 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 36_libpng15.dpatch by Nobuhiro Iwamatsu +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Some changes to cooperate with libpng 1.5. + +@DPATCH@ +diff -urNad '--exclude=CVS' '--exclude=.svn' xfig~/f_readpng.c xfig/f_readpng.c +--- xfig~/f_readpng.c ++++ xfig/f_readpng.c +@@ -43,7 +43,7 @@ + char *ptr; + int num_palette; + png_colorp palette; +- png_color_16 background; ++ png_color_16 background, *image_background; + + /* make scale factor smaller for metric */ + float scale = (appres.INCHES ? +@@ -73,7 +73,7 @@ + } + + /* set long jump recovery here */ +- if (setjmp(png_ptr->jmpbuf)) { ++ if (setjmp(png_jmpbuf((png_ptr)))) { + /* if we get here there was a problem reading the file */ + png_destroy_read_struct(&png_ptr, &info_ptr, &end_info); + close_picfile(file,filetype); +@@ -90,14 +90,18 @@ + png_get_IHDR(png_ptr, info_ptr, &w, &h, &bit_depth, &color_type, + &interlace_type, &compression_type, &filter_type); + +- if (info_ptr->valid & PNG_INFO_gAMA) +- png_set_gamma(png_ptr, 2.2, info_ptr->gamma); +- else ++ if (png_get_valid(png_ptr, info_ptr, PNG_INFO_gAMA)) { ++ double gamma; ++ png_get_gAMA(png_ptr, info_ptr, &gamma); ++ png_set_gamma(png_ptr, 2.2, gamma); ++ } else { + png_set_gamma(png_ptr, 2.2, 0.45); ++ } + +- if (info_ptr->valid & PNG_INFO_bKGD) ++ if (png_get_valid(png_ptr, info_ptr, PNG_INFO_bKGD) && ++ png_get_bKGD(png_ptr, info_ptr, &image_background)) + /* set the background to the one supplied */ +- png_set_background(png_ptr, &info_ptr->background, ++ png_set_background(png_ptr, image_background, + PNG_BACKGROUND_GAMMA_FILE, 1, 1.0); + else { + /* blend the canvas background using the alpha channel */ +@@ -136,7 +140,11 @@ + + if (png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette)) { + png_get_hIST(png_ptr, info_ptr, &histogram); ++#ifdef PNG_READ_QUANTIZE_SUPPORTED ++ png_set_quantize(png_ptr, palette, num_palette, 256, histogram, 0); ++#else + png_set_dither(png_ptr, palette, num_palette, 256, histogram, 0); ++#endif + } + } + if (color_type == PNG_COLOR_TYPE_GRAY || color_type == PNG_COLOR_TYPE_GRAY_ALPHA) { +diff -urNad '--exclude=CVS' '--exclude=.svn' xfig~/f_wrpng.c xfig/f_wrpng.c +--- xfig~/f_wrpng.c ++++ xfig/f_wrpng.c +@@ -20,6 +20,7 @@ + #include "w_msgpanel.h" + #include "w_setup.h" + #include ++#include + + /* + * Write PNG file from rgb data +@@ -59,7 +60,7 @@ + } + + /* set long jump recovery here */ +- if (setjmp(png_ptr->jmpbuf)) { ++ if (setjmp(png_jmpbuf((png_ptr)))) { + /* if we get here there was a problem reading the file */ + png_destroy_write_struct(&png_ptr, &info_ptr); + return False; diff --git a/xfig.spec b/xfig.spec index bee68c2..a4c5a08 100644 --- a/xfig.spec +++ b/xfig.spec @@ -3,7 +3,7 @@ Summary: An X Window System tool for drawing basic vector graphics Name: xfig Version: 3.2.5 -Release: 28.b%{?dist} +Release: 29.b%{?dist} License: MIT Group: Applications/Multimedia URL: http://www.xfig.org/ @@ -21,6 +21,7 @@ Patch13: xfig-3.2.5-urwfonts.patch Patch19: xfig-3.2.5-debian.patch Patch20: xfig-3.2.5b-fix-eps-reading.patch Patch21: xfig-3.2.5b-fix-fig-buffer-overflow.patch +Patch22: 36_libpng15.dpatch BuildRequires: libjpeg-devel BuildRequires: libpng-devel @@ -37,8 +38,6 @@ BuildRequires: libXt-devel BuildRequires: Xaw3d-devel BuildRequires: desktop-file-utils -Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) - Requires: %{name}-common = %{version}-%{release} Provides: %{name}-executable = %{version}-%{release} # Xaw3d used to be the one in a subpackage, now the plain Xaw version is @@ -96,6 +95,7 @@ Files common to both the plain Xaw and the Xaw3d version of xfig. %patch19 -p1 %patch20 -p1 %patch21 +%patch22 -p1 -b .libpng iconv -f ISO-8859-1 -t UTF8 CHANGES > tmp; touch -r CHANGES tmp; mv tmp CHANGES rm Doc/html/images/sav1a0.tmp chmod -x `find -type f` @@ -149,10 +149,6 @@ desktop-file-install --vendor fedora \ rm %{buildroot}%{_prefix}/lib*/X11/app-defaults -%clean -rm -rf %{buildroot} - - %post common update-desktop-database &> /dev/null || : touch --no-create %{_datadir}/icons/hicolor || : @@ -188,6 +184,9 @@ fi %changelog +* Tue Feb 14 2012 Peter Robinson - 3.2.5-29.b +- Add patch from Debian for libpng 1.5 + * Sat Jan 14 2012 Fedora Release Engineering - 3.2.5-28.b - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild