[imlib] Rebuild for libpng 1.5.x

Paul Howarth pghmcfc at fedoraproject.org
Sun Nov 6 19:05:01 UTC 2011


commit 195b3fe6a9e610da6da221a991530ea70000f10c
Author: Paul Howarth <paul at city-fan.org>
Date:   Sun Nov 6 19:02:39 2011 +0000

    Rebuild for libpng 1.5.x
    
    - add patch from gentoo for building with libpng 1.5.x
    - nobody else likes macros for commands

 imlib-1.9.15-libpng15.patch |  142 +++++++++++++++++++++++++++++++++++++++++++
 imlib.spec                  |   52 +++++++++-------
 2 files changed, 172 insertions(+), 22 deletions(-)
---
diff --git a/imlib-1.9.15-libpng15.patch b/imlib-1.9.15-libpng15.patch
new file mode 100644
index 0000000..7837cd4
--- /dev/null
+++ b/imlib-1.9.15-libpng15.patch
@@ -0,0 +1,142 @@
+--- gdk_imlib/io-png.c
++++ gdk_imlib/io-png.c
+@@ -40,13 +40,13 @@
+       return NULL;
+     }
+ 
+-  if (setjmp(png_ptr->jmpbuf))
++  if (setjmp(png_jmpbuf(png_ptr)))
+     {
+       png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
+       return NULL;
+     }
+ 
+-  if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
++  if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB_ALPHA)
+     {
+       png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
+       return NULL;
+@@ -275,13 +275,13 @@
+       return NULL;
+     }
+   
+-  if (setjmp(png_ptr->jmpbuf))
++  if (setjmp(png_jmpbuf(png_ptr)))
+     {
+       png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
+       return NULL;
+     }
+   
+-  if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
++  if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB_ALPHA)
+     {
+       png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
+       return NULL;
+@@ -301,6 +301,9 @@
+   /* Setup Translators */
+   if (color_type == PNG_COLOR_TYPE_PALETTE)
+     png_set_expand(png_ptr);
++  if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
++    png_set_expand(png_ptr);
++
+   png_set_strip_16(png_ptr);
+   png_set_packing(png_ptr);
+   if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
+@@ -440,13 +443,13 @@
+ 		return NULL;
+ 	}
+ 	
+-	if (setjmp(png_ptr->jmpbuf))
++	if (setjmp(png_jmpbuf(png_ptr)))
+ 	{
+ 		png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
+ 		return NULL;
+ 	}
+ 	
+-	if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
++	if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB_ALPHA)
+ 	{
+ 		png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
+ 		return NULL;
+@@ -635,7 +638,7 @@
+ 	      png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
+ 	      return 0;
+ 	    }
+-	  if (setjmp(png_ptr->jmpbuf))
++	  if (setjmp(png_jmpbuf(png_ptr)))
+ 	    {
+ 	      fclose(f);
+ 	      png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
+--- Imlib/load.c
++++ Imlib/load.c
+@@ -197,12 +197,12 @@
+       png_destroy_read_struct(&png_ptr, NULL, NULL);
+       return NULL;
+     }
+-  if (setjmp(png_ptr->jmpbuf))
++  if (setjmp(png_jmpbuf(png_ptr)))
+     {
+       png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
+       return NULL;
+     }
+-  if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
++  if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB_ALPHA)
+     {
+       png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
+       return NULL;
+@@ -260,7 +260,8 @@
+   png_read_image(png_ptr, lines);
+   png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
+   ptr = data;
+-  if (color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
++  if (color_type == PNG_COLOR_TYPE_GRAY
++      || color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
+     {
+       for (y = 0; y < *h; y++)
+ 	{
+@@ -285,6 +286,7 @@
+ 	    }
+ 	}
+     }
++#if 0
+   else if (color_type == PNG_COLOR_TYPE_GRAY)
+     {
+       for (y = 0; y < *h; y++)
+@@ -300,6 +302,7 @@
+ 	    }
+ 	}
+     }
++#endif
+   else
+     {
+       for (y = 0; y < *h; y++)
+--- Imlib/save.c
++++ Imlib/save.c
+@@ -342,7 +342,7 @@
+ 	      png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
+ 	      return 0;
+ 	    }
+-	  if (setjmp(png_ptr->jmpbuf))
++	  if (setjmp(png_jmpbuf(png_ptr)))
+ 	    {
+ 	      fclose(f);
+ 	      png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
+--- Imlib/utils.c
++++ Imlib/utils.c
+@@ -1981,14 +1981,13 @@
+       png_destroy_read_struct(&png_ptr, NULL, NULL);
+       return NULL;
+     }
+-  
+-  if (setjmp(png_ptr->jmpbuf))
++  if (setjmp(png_jmpbuf(png_ptr)))  
+     {
+       png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
+       return NULL;
+     }
+   
+-  if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
++  if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB_ALPHA)
+     {
+       png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
+       return NULL;
diff --git a/imlib.spec b/imlib.spec
index 6d7bd1d..32e1e37 100644
--- a/imlib.spec
+++ b/imlib.spec
@@ -1,7 +1,7 @@
 Summary:	An image loading and rendering library for X11R6
 Name:		imlib
 Version:	1.9.15
-Release:	15%{?dist}
+Release:	16%{?dist}
 Epoch:		1
 License:	LGPLv2+
 Group:		System Environment/Libraries
@@ -16,7 +16,8 @@ Patch6:		imlib-1.9.13-underquoted.patch
 Patch8:		imlib-1.9.15-lib-bloat.patch
 Patch9:		imlib-1.9.15-multilib-config.patch
 Patch10:	imlib-1.9.15-check-for-shm-pixmaps.patch
-BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 
+Patch11:	imlib-1.9.15-libpng15.patch
+BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(id -nu) 
 BuildRequires:	giflib-devel
 BuildRequires:	glib-devel%{?_isa}
 BuildRequires:	gtk+-devel%{?_isa}
@@ -51,7 +52,7 @@ Requires:	libtiff-devel%{?_isa}
 Requires:	libX11-devel%{?_isa}
 Requires:	libXt-devel%{?_isa}
 Requires:	zlib-devel
-# From Fedora 14, %{_datadir}/aclocal is included in the filesystem package
+# From Fedora 14, %%{_datadir}/aclocal is included in the filesystem package
 %if 0%{?fedora} < 14
 Requires:	%{_datadir}/aclocal
 %endif
@@ -96,48 +97,51 @@ rendering library for X11R6.
 ## before trying to use them (#357241)
 %patch10 -p1 -b .shmpixmaps
 
+## Patch from gentoo for building against libpng 1.5
+%patch11 -p0 -b .libpng15
+
 ## Local gmodule hack to support building with libpng rather than libpng10
-(cd gdk_imlib && %{__tar} zxf %{SOURCE2})
-%{__sed} -i -e	's/gmodule.h/gmodule-local.h/g;
+(cd gdk_imlib && tar zxf %{SOURCE2})
+sed -i -e	's/gmodule.h/gmodule-local.h/g;
 		 s/g_module/local_hack_g_module/g;
 		 s/GModule/LocalHackGModule/g;
 		 s/G_MODULE/LOCAL_HACK_G_MODULE/g' \
 	gdk_imlib/modules.c
-%{__sed} -i -e 's/-static//g' \
+sed -i -e 's/-static//g' \
 	gdk_imlib/local-hack-gmodule/Makefile
 
 ## Change soname to reflect new libpng
-%{__sed} -i -e 's/10:15:9/11:0:0/g' Imlib/Makefile*
+sed -i -e 's/10:15:9/11:0:0/g' Imlib/Makefile*
 
 %build
 %configure --disable-static
 
-## Remove -L%{_libdir} from imlib-config if present;
+## Remove -L%%{_libdir} from imlib-config if present;
 ## it's redundant and breaks multilib compatibility
-%{__sed} -i -e 's,-L%{_libdir} ,,g' imlib-config
+sed -i -e 's,-L%{_libdir} ,,g' imlib-config
 
 ## Kill bogus RPATHs
-%{__sed} -i 's|^sys_lib_dlsearch_path_spec="/lib /usr/lib|sys_lib_dlsearch_path_spec="/%{_lib} %{_libdir}|' libtool
+sed -i 's|^sys_lib_dlsearch_path_spec="/lib /usr/lib|sys_lib_dlsearch_path_spec="/%{_lib} %{_libdir}|' libtool
 
 ## Build local gmodule hack
-tagname=CC %{__make} -C gdk_imlib/local-hack-gmodule LIBTOOL=$(pwd)/libtool
-%{__cp} gdk_imlib/local-hack-gmodule/gmodule-local.h gdk_imlib/
+tagname=CC make -C gdk_imlib/local-hack-gmodule LIBTOOL=$(pwd)/libtool
+cp gdk_imlib/local-hack-gmodule/gmodule-local.h gdk_imlib/
 
 ## Avoid unnecessary library linkage in libgdk_imlib
-GX_LIBS=$(/usr/bin/gtk-config --libs | %{__sed} -e 's/-lgtk //; s/-lgmodule //; s/-lXi //')
+GX_LIBS=$(gtk-config --libs | sed -e 's/-lgtk //; s/-lgmodule //; s/-lXi //')
 
-## Note: build with %{?_smp_mflags} doesn't work reliably
-%{__make} GX_LIBS="${GX_LIBS}"
+## Note: parallel build doesn't work reliably
+make GX_LIBS="${GX_LIBS}"
 
 %install
-%{__rm} -rf %{buildroot}
-%{__make} install DESTDIR=%{buildroot} INSTALL="%{__install} -p"
+rm -rf %{buildroot}
+make install DESTDIR=%{buildroot} INSTALL="install -p"
 
 ## Don't package libtool archives
-%{__rm} -f %{buildroot}%{_libdir}/*.la
+rm -f %{buildroot}%{_libdir}/*.la
 
 %clean
-%{__rm} -rf %{buildroot}
+rm -rf %{buildroot}
 
 %post -p /sbin/ldconfig
 
@@ -178,13 +182,17 @@ GX_LIBS=$(/usr/bin/gtk-config --libs | %{__sed} -e 's/-lgtk //; s/-lgmodule //;
 %{_mandir}/man1/imlib-config.1*
 
 %changelog
+* Sun Nov  6 2011 Paul Howarth <paul at city-fan.org> 1:1.9.15-16
+- add patch from gentoo for building with libpng 1.5.x
+- nobody else likes macros for commands
+
 * Wed Feb 09 2011 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1:1.9.15-15
-- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
+- rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
 
 * Fri May 14 2010 Paul Howarth <paul at city-fan.org> 1:1.9.15-14
 - EL-6 builds don't need manual pkgconfig dependency
-- Fix up patches to avoid need for autotools during build
-- Comment patches
+- fix up patches to avoid need for autotools during build
+- comment patches
 
 * Thu Mar  4 2010 Paul Howarth <paul at city-fan.org> 1:1.9.15-13
 - drop %%{_datadir}/aclocal dependency from devel package from Fedora 14,


More information about the scm-commits mailing list