Fix building with libpng15 wrt #378467 by _AxS_ from Freenode
authorSamuli Suominen <ssuominen@gentoo.org>
Thu, 15 Sep 2011 23:19:01 +0000 (23:19 +0000)
committerSamuli Suominen <ssuominen@gentoo.org>
Thu, 15 Sep 2011 23:19:01 +0000 (23:19 +0000)
Package-Manager: portage-2.2.0_alpha55/cvs/Linux x86_64

media-gfx/metapixel/ChangeLog
media-gfx/metapixel/Manifest
media-gfx/metapixel/files/metapixel-1.0.2-libpng15.patch [new file with mode: 0644]
media-gfx/metapixel/metapixel-1.0.2.ebuild

index d2d41fbf961ec14f211e58cfaf1c46186e8df30c..75e533c53bdad8d228f3b4191926f8f1922fbe0b 100644 (file)
@@ -1,6 +1,10 @@
 # ChangeLog for media-gfx/metapixel
-# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/media-gfx/metapixel/ChangeLog,v 1.4 2010/11/08 22:56:03 maekke Exp $
+# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/media-gfx/metapixel/ChangeLog,v 1.5 2011/09/15 23:19:01 ssuominen Exp $
+
+  15 Sep 2011; Samuli Suominen <ssuominen@gentoo.org> metapixel-1.0.2.ebuild,
+  +files/metapixel-1.0.2-libpng15.patch:
+  Fix building with libpng15 wrt #378467 by _AxS_ from Freenode
 
   08 Nov 2010; Markus Meier <maekke@gentoo.org> metapixel-1.0.2.ebuild:
   change jpeg dep to virtual/jpeg
index 213a71b00dbd64c4a65692a4476713d214294638..1eb4bcb86f8e7969550a0f38405a359e19929afd 100644 (file)
@@ -1,14 +1,15 @@
 -----BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA1
+Hash: SHA256
 
+AUX metapixel-1.0.2-libpng15.patch 4391 RMD160 40098309892c412e7f173450fab61d248bd0c9db SHA1 ddfc361f88c9735de29380cf574db91bc1818529 SHA256 a63fb384b27be35214b8bc83095b52912177d3f379b36e6414e8d5352d4cf954
 DIST metapixel-1.0.2.tar.gz 63197 RMD160 7343c66e925e5b55cfe63624be18159717b1295e SHA1 f917aec91430b1bdbcc7b3dea29cb93f15a04c77 SHA256 8d77810978da397c070b9b4e228ae6204e9f5c524518ad1a4fcab9462171f55b
-EBUILD metapixel-1.0.2.ebuild 928 RMD160 1d40c694816351da79ded0c7cf32b8317139be5e SHA1 deb38f8b9766c4fbc7cdd259916c3e52d676d0eb SHA256 32406955ffafb879831604bbcec929c3edc91d0cf32dd32a12e12e91f8d4c386
-MISC ChangeLog 685 RMD160 348a5acf905b0b4f3a6a01abc1a91b291b372021 SHA1 3e84274dc17f6cc5abb8aed0ef71f73e203ad4c8 SHA256 3cb9de625f6989470659905185a2fbccf7f8d84c127b9fa2136ba3fb44dee2ec
+EBUILD metapixel-1.0.2.ebuild 969 RMD160 f240937abb3f28762cf175515bf983382f8fc012 SHA1 be7f5ac3accbd8bacfae4875aa6581bc0fb857ce SHA256 6291c524efc5cd6303099e95a9a2a4bab195c13b7d5088e6b28a607ad601fa02
+MISC ChangeLog 872 RMD160 a7c1cee9facb8cb259f0235d8fef831194dc648c SHA1 43ca44e764860cbbf54fef0aab4b667b42751b4c SHA256 e55fc699bfad682919db4055cf82bedea3e2dd747cea7ca7a5279e4ac86734fc
 MISC metadata.xml 161 RMD160 60f70b15d67f0e6aafc59833b2f0a30e30b51765 SHA1 1c35398222ef7ed670c31965e42cca77fe4b1da6 SHA256 e8daadc5e27e3ef1148993b5b48d96e93bc36d798a1f416693f7f8c84be427e1
 -----BEGIN PGP SIGNATURE-----
-Version: GnuPG v2.0.16 (GNU/Linux)
+Version: GnuPG v2.0.18 (GNU/Linux)
 
-iEYEARECAAYFAkzYgEEACgkQkKaRLQcq0GIvGwCgmBlBrs9FUWkcvxu8wk8Z0DdH
-5R8An3LyzWE4dD1C82Ny7OHXHy6G9FyP
-=oM/I
+iF4EAREIAAYFAk5yiB0ACgkQXkR9YqOcLPE1ywEAhr3L/h5GhqcRNnONKXhBg8JN
+kIQAY1L6JHa1UbnXoJMA/0PoC7hkWpoUODTlAF4wJykeKF1Z6gyDNTNgV7tOWmki
+=F0tb
 -----END PGP SIGNATURE-----
diff --git a/media-gfx/metapixel/files/metapixel-1.0.2-libpng15.patch b/media-gfx/metapixel/files/metapixel-1.0.2-libpng15.patch
new file mode 100644 (file)
index 0000000..988437d
--- /dev/null
@@ -0,0 +1,141 @@
+--- rwimg/rwpng.c
++++ rwimg/rwpng.c
+@@ -42,6 +42,7 @@
+ open_png_file_reading (const char *filename, int *width, int *height)
+ {
+     png_data_t *data = (png_data_t*)malloc(sizeof(png_data_t));
++    int _bit_depth,_color_type,_interlace_type,_compression,_filter;
+     assert(data != 0);
+@@ -57,19 +58,20 @@
+     data->end_info = png_create_info_struct(data->png_ptr);
+     assert(data->end_info != 0);
+-    if (setjmp(data->png_ptr->jmpbuf))
++    if (setjmp(png_jmpbuf(data->png_ptr)))
+       assert(0);
+     png_init_io(data->png_ptr, data->file);
+     png_read_info(data->png_ptr, data->info_ptr);
+-    *width = data->info_ptr->width;
+-    *height = data->info_ptr->height;
+-
+-    assert(data->info_ptr->bit_depth == 8 || data->info_ptr->bit_depth == 16);
+-    assert(data->info_ptr->color_type == PNG_COLOR_TYPE_RGB || data->info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA);
+-    assert(data->info_ptr->interlace_type == PNG_INTERLACE_NONE);
++    png_get_IHDR(data->png_ptr,data->info_ptr,
++        (png_uint_32 *)width,(png_uint_32 *)height,
++        &_bit_depth,&_color_type,&_interlace_type,&_compression,&_filter);
++
++    assert(_bit_depth == 8 || _bit_depth == 16);
++    assert(_color_type == PNG_COLOR_TYPE_RGB || _color_type == PNG_COLOR_TYPE_RGB_ALPHA);
++    assert(_interlace_type == PNG_INTERLACE_NONE);
+     data->have_read = 0;
+@@ -83,30 +85,36 @@
+     int i;
+     int bps, spp;
+     unsigned char *row;
++    png_uint_32 _width,_height;
++    int _bit_depth,_color_type,_interlace_type,_compression,_filter;
+-    if (setjmp(data->png_ptr->jmpbuf))
++    if (setjmp(png_jmpbuf(data->png_ptr)))
+       assert(0);
+-    if (data->info_ptr->color_type == PNG_COLOR_TYPE_RGB)
++    png_get_IHDR(data->png_ptr,data->info_ptr,
++        &_width,&_height,&_bit_depth,&_color_type,&_interlace_type,
++        &_compression,&_filter);
++
++    if (_color_type == PNG_COLOR_TYPE_RGB)
+       spp = 3;
+     else
+       spp = 4;
+-    if (data->info_ptr->bit_depth == 16)
++    if (_bit_depth == 16)
+       bps = 2;
+     else
+       bps = 1;
+-    row = (unsigned char*)malloc(data->info_ptr->width * spp * bps);
++    row = (unsigned char*)malloc(_width * spp * bps);
+     for (i = 0; i < num_lines; ++i)
+     {
+       int j, channel;
+       png_read_row(data->png_ptr, (png_bytep)row, 0);
+-      for (j = 0; j < data->info_ptr->width; ++j)
++      for (j = 0; j < _width; ++j)
+           for (channel = 0; channel < 3; ++channel)
+-              lines[i * data->info_ptr->width * 3 + j * 3 + channel] = row[j * spp * bps + channel * bps];
++              lines[i * _width * 3 + j * 3 + channel] = row[j * spp * bps + channel * bps];
+     }
+     free(row);
+@@ -119,7 +127,7 @@
+ {
+     png_data_t *data = (png_data_t*)_data;
+-    if (setjmp(data->png_ptr->jmpbuf))
++    if (setjmp(png_jmpbuf(data->png_ptr)))
+       assert(0);
+     if (data->have_read)
+@@ -148,7 +156,7 @@
+     data->info_ptr = png_create_info_struct(data->png_ptr);
+     assert(data->info_ptr != 0);
+-    if (setjmp(data->png_ptr->jmpbuf))
++    if (setjmp(png_jmpbuf(data->png_ptr)))
+       assert(0);
+     if (pixel_stride == 4)
+@@ -156,18 +164,14 @@
+     png_init_io(data->png_ptr, data->file);
+-    data->info_ptr->width = width;
+-    data->info_ptr->height = height;
+-    data->info_ptr->valid = 0;
++    png_set_IHDR(data->png_ptr,data->info_ptr,width,height,
++        8,PNG_COLOR_TYPE_RGB,PNG_INTERLACE_NONE,
++        PNG_COMPRESSION_TYPE_DEFAULT,PNG_FILTER_TYPE_DEFAULT);
++    /* setting these to 0 so just skipping ...
+     data->info_ptr->rowbytes = width * 3;
+     data->info_ptr->palette = 0;
+     data->info_ptr->num_palette = 0;
+-    data->info_ptr->num_trans = 0;
+-    data->info_ptr->bit_depth = 8;
+-    data->info_ptr->color_type = PNG_COLOR_TYPE_RGB;
+-    data->info_ptr->compression_type = PNG_COMPRESSION_TYPE_DEFAULT;
+-    data->info_ptr->filter_type = PNG_FILTER_TYPE_DEFAULT;
+-    data->info_ptr->interlace_type = PNG_INTERLACE_NONE;
++    data->info_ptr->num_trans = 0; */
+     png_write_info(data->png_ptr, data->info_ptr);
+@@ -182,7 +186,7 @@
+     png_data_t *data = (png_data_t*)_data;
+     int i;
+-    if (setjmp(data->png_ptr->jmpbuf))
++    if (setjmp(png_jmpbuf(data->png_ptr)))
+       assert(0);
+     for (i = 0; i < num_lines; ++i)
+@@ -194,7 +198,7 @@
+ {
+     png_data_t *data = (png_data_t*)_data;
+-    if (setjmp(data->png_ptr->jmpbuf))
++    if (setjmp(png_jmpbuf(data->png_ptr)))
+       assert(0);
+     png_write_end(data->png_ptr, data->info_ptr);
index c6c8ff762df61a3f5c3c69d190ad6597ac7f77ab..66ffeff99b882754cdf5fc084047fe92b45d4969 100644 (file)
@@ -1,8 +1,9 @@
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/media-gfx/metapixel/metapixel-1.0.2.ebuild,v 1.4 2010/11/08 22:56:03 maekke Exp $
+# $Header: /var/cvsroot/gentoo-x86/media-gfx/metapixel/metapixel-1.0.2.ebuild,v 1.5 2011/09/15 23:19:01 ssuominen Exp $
 
-inherit toolchain-funcs
+EAPI=4
+inherit eutils toolchain-funcs
 
 DESCRIPTION="a program for generating photomosaics"
 HOMEPAGE="http://www.complang.tuwien.ac.at/schani/metapixel"
@@ -15,20 +16,19 @@ IUSE=""
 
 RDEPEND="dev-lang/perl
        media-libs/giflib
-       media-libs/libpng
+       >=media-libs/libpng-1.4
        virtual/jpeg"
 DEPEND="${RDEPEND}"
 
-src_unpack() {
-       unpack ${A}
-       cd "${S}"
-       sed -i -e "s:/usr/X11R6:/usr:g" Makefile
-       sed -i -e "s:ar:$(tc-getAR):" rwimg/Makefile
+src_prepare() {
+       epatch "${FILESDIR}"/${P}-libpng15.patch
+
+       sed -i -e 's:/usr/X11R6:/usr:g' Makefile || die
+       sed -i -e 's:ar:$(AR):' rwimg/Makefile || die
 }
 
 src_compile() {
-       emake CC="$(tc-getCC)" OPTIMIZE="${CFLAGS}" \
-               LDOPTS="${LDFLAGS}" || die "emake failed."
+       emake AR="$(tc-getAR)" CC="$(tc-getCC)" OPTIMIZE="${CFLAGS}" LDOPTS="${LDFLAGS}"
 }
 
 src_install() {