From cdaa981847b4dbce97de26b677fb24faa1b4cc57 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sun, 18 Sep 2011 01:37:04 +0000 Subject: [PATCH] Fix building with libpng-1.5+ #380127#4 by Ian Stakenvicius. Package-Manager: portage-2.2.0_alpha58/cvs/Linux x86_64 --- media-tv/xbmc/ChangeLog | 6 +- media-tv/xbmc/Manifest | 12 +- media-tv/xbmc/files/xbmc-10.1-headers.patch | 10 + .../xbmc/files/xbmc-10.1-libpng-1.5.patch | 596 ++++++++++++++++++ media-tv/xbmc/xbmc-10.1.ebuild | 4 +- 5 files changed, 621 insertions(+), 7 deletions(-) create mode 100644 media-tv/xbmc/files/xbmc-10.1-headers.patch create mode 100644 media-tv/xbmc/files/xbmc-10.1-libpng-1.5.patch diff --git a/media-tv/xbmc/ChangeLog b/media-tv/xbmc/ChangeLog index d9b1c0a86601..a22f5c33fc3e 100644 --- a/media-tv/xbmc/ChangeLog +++ b/media-tv/xbmc/ChangeLog @@ -1,6 +1,10 @@ # ChangeLog for media-tv/xbmc # Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/media-tv/xbmc/ChangeLog,v 1.96 2011/08/28 22:29:15 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/media-tv/xbmc/ChangeLog,v 1.97 2011/09/18 01:37:04 vapier Exp $ + + 18 Sep 2011; Mike Frysinger xbmc-10.1.ebuild, + +files/xbmc-10.1-headers.patch, +files/xbmc-10.1-libpng-1.5.patch: + Fix building with libpng-1.5+ #380127#4 by Ian Stakenvicius. 28 Aug 2011; Mike Frysinger xbmc-9999.ebuild: Upstream xbmc now needs libplist #380785 by Michael Kirkland. diff --git a/media-tv/xbmc/Manifest b/media-tv/xbmc/Manifest index 5dfd27b4ffab..010ffbf44015 100644 --- a/media-tv/xbmc/Manifest +++ b/media-tv/xbmc/Manifest @@ -3,15 +3,17 @@ Hash: SHA256 AUX xbmc-10.0-python-2.7.patch 30308 RMD160 15f01d93b0db903eadb5deb94d5092b0a4b68de4 SHA1 4f6da8045b575a80fd7d556c5b1f2fbbe2bc2da4 SHA256 8f6b2a0a962ad250fc317542d0fa180585d3c9e630ca98f99299b6f750555085 AUX xbmc-10.1-gcc-4.6.patch 4295 RMD160 4aee4c91f9d2f9e947d37cd39f2700fc0eaec353 SHA1 5ae755b20e06560aaf1508b80c1f7661ef36802f SHA256 cef1154bc3352b215bfece1a749d901d43ec7aa0c6d050921ae8745c553e84c9 +AUX xbmc-10.1-headers.patch 294 RMD160 74536be4a5e3b939c6360bbc715f30e08226af46 SHA1 2435642148ec291d10bded3036592a6104f5ff03 SHA256 8b8e86cf7edef227e8267c52d60545b753eea11261f078131ee30f9eac8bb002 +AUX xbmc-10.1-libpng-1.5.patch 19253 RMD160 1488504816e668fceb1c3f762738864ea81fa940 SHA1 06e90834bc665eabc3f4e587d551b93af87c1ba5 SHA256 1a0985b91ee9862a538a43689d005dc88d49bf5a70d917896fb69ee416369ff7 DIST xbmc-10.1.tar.gz 130187822 RMD160 a4ddb06b396b8ae437bf30bea5b44396b54ebc5b SHA1 7a9f4e2c18a23d687ecfc744f2e051e4f88ef01a SHA256 3403195b7eb1d076523f2394793b7f050df00743892b031f6fea86b998559d8a -EBUILD xbmc-10.1.ebuild 5356 RMD160 0bbe977f545ad8c6ac47da7b53f048be25265ebd SHA1 d8ff78aeadb2213f4b13ab71979a7bab5358a86e SHA256 602109362193abc50852383ee9745235cf95c858dda7ca49a5abaafabe2b64ee +EBUILD xbmc-10.1.ebuild 5463 RMD160 571dac42271ecd8bbd48ff3b384110e2fe73a13c SHA1 a878f814b6ce4a166a763382baf5c4ee7be33899 SHA256 b840faf7b9a81148474c2584985f85592756217bd839259c23481519c2f82fba EBUILD xbmc-9999.ebuild 4948 RMD160 2ccd20e9e81ef0f32903e50b700fc1203031945d SHA1 dc4217359ca26cfd1ba58b8f437c37ee3178804c SHA256 9692e2c48e4d16e470d70cfc409b505056bb65870d5269263b301eb578141a53 -MISC ChangeLog 15266 RMD160 578426c1aa2052e8efe54d18e2fa314c40ac2b9b SHA1 2df8ca5f5817effefebcd43e3e7788ce61b9b64d SHA256 f005217a2af036ee1efc17be714419355d2e51ac1f3cd56bd837bc162a10c292 +MISC ChangeLog 15467 RMD160 4ca68ff0d88de897b0ccb779be1f0c9c6c5440bd SHA1 c04bfccd4034290fbfa61f7a15c3d56c8b5b11b3 SHA256 3738cfc660efdfe3c6a0ac983d4f221857325e912cf7f0ca92c2ee0c058846c2 MISC metadata.xml 646 RMD160 e94131de5980a6f435c16f40ae772938d0844db1 SHA1 b1ef02535947638e70e01bb6fa91915f28e2795b SHA256 9bbbd6928abe328028892131aeb27b4ad3db7822236209e0110aa31dca7554b8 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (GNU/Linux) -iF4EAREIAAYFAk5awTMACgkQaC/OocHi7JbFzgD/aZVdsMwanoDwJwa1NNV8b3A6 -BiIF2YQeP7+CTIgWfkcA/35h1s5OtdCUgWRnJ9uRzgFlFF1ELqU4NSFusf64eH71 -=vkGY +iF4EAREIAAYFAk51S0gACgkQaC/OocHi7JZ/xAD/TlmAn7N71mDsYrcbgMTxoWrb +sKCEdg/h8n7ngRdHOkoA+wVMnYq0elXx8HXm0qWxy20H91CpWoJF1PSyCsVVet4b +=sP4g -----END PGP SIGNATURE----- diff --git a/media-tv/xbmc/files/xbmc-10.1-headers.patch b/media-tv/xbmc/files/xbmc-10.1-headers.patch new file mode 100644 index 000000000000..8c23db86529a --- /dev/null +++ b/media-tv/xbmc/files/xbmc-10.1-headers.patch @@ -0,0 +1,10 @@ +--- a/tools/TexturePacker/XBTFWriter.cpp ++++ b/tools/TexturePacker/XBTFWriter.cpp +@@ -28,6 +28,7 @@ + #include "EndianSwap.h" + #define __STDC_FORMAT_MACROS + #include ++#include /* for unlink() prototype */ + + #define TEMP_FILE "temp.xbt" + #define TEMP_SIZE (10*1024*1024) diff --git a/media-tv/xbmc/files/xbmc-10.1-libpng-1.5.patch b/media-tv/xbmc/files/xbmc-10.1-libpng-1.5.patch new file mode 100644 index 000000000000..4d9922758ad1 --- /dev/null +++ b/media-tv/xbmc/files/xbmc-10.1-libpng-1.5.patch @@ -0,0 +1,596 @@ +fix building with newer libpng. patch by Ian Stakenvicius. + +https://bugs.gentoo.org/380127 + +--- a/xbmc/lib/cximage-6.0/CxImage/ximapng.h ++++ b/xbmc/lib/cximage-6.0/CxImage/ximapng.h +@@ -69,8 +69,13 @@ + + static void PNGAPI user_error_fn(png_structp png_ptr,png_const_charp error_msg) + { ++#if PNG_LIBPNG_VER > 10399 ++ strncpy((char*)png_get_error_ptr(png_ptr),error_msg,255); ++ longjmp(png_jmpbuf(png_ptr), 1); ++#else + strncpy((char*)png_ptr->error_ptr,error_msg,255); + longjmp(png_ptr->jmpbuf, 1); ++#endif + } + }; + +--- a/xbmc/lib/cximage-6.0/CxImage/ximapng.cpp ++++ b/xbmc/lib/cximage-6.0/CxImage/ximapng.cpp +@@ -15,7 +15,11 @@ + void CxImagePNG::ima_png_error(png_struct *png_ptr, char *message) + { + strcpy(info.szLastError,message); ++#if PNG_LIBPNG_VER > 10399 ++ longjmp(png_jmpbuf(png_ptr), 1); ++#else + longjmp(png_ptr->jmpbuf, 1); ++#endif + } + //////////////////////////////////////////////////////////////////////////////// + #if CXIMAGE_SUPPORT_DECODE +@@ -62,7 +66,11 @@ + /* Set error handling if you are using the setjmp/longjmp method (this is + * the normal method of doing things with libpng). REQUIRED unless you + * set up your own error handlers in the png_create_read_struct() earlier. */ ++#if PNG_LIBPNG_VER > 10399 ++ if (setjmp(png_jmpbuf(png_ptr))) { ++#else + if (setjmp(png_ptr->jmpbuf)) { ++#endif + /* Free all of the memory associated with the png_ptr and info_ptr */ + delete [] row_pointers; + png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL); +@@ -70,16 +78,35 @@ + /* read the file information */ + png_read_info(png_ptr, info_ptr); + ++ png_uint_32 _width,_height; ++ int _bit_depth,_color_type,_interlace_type,_compression_type,_filter_type; ++#if PNG_LIBPNG_VER > 10399 ++ png_get_IHDR(png_ptr,info_ptr,&_width,&_height,&_bit_depth,&_color_type, ++ &_interlace_type,&_compression_type,&_filter_type); ++#else ++ _width=info_ptr->width; ++ _height=info_ptr->height; ++ _bit_depth=info_ptr->bit_depth; ++ _color_type=info_ptr->color_type; ++ _interlace_type=info_ptr->interlace_type; ++ _compression_type=info_ptr->compression_type; ++ _filter_type=info_ptr->filter_type; ++#endif ++ + if (info.nEscape == -1){ +- head.biWidth = info_ptr->width; +- head.biHeight= info_ptr->height; ++ head.biWidth = _width; ++ head.biHeight= _height; + info.dwType = CXIMAGE_FORMAT_PNG; ++#if PNG_LIBPNG_VER > 10399 ++ longjmp(png_jmpbuf(png_ptr), 1); ++#else + longjmp(png_ptr->jmpbuf, 1); ++#endif + } + + /* calculate new number of channels */ + int channels=0; +- switch(info_ptr->color_type){ ++ switch(_color_type){ + case PNG_COLOR_TYPE_GRAY: + case PNG_COLOR_TYPE_PALETTE: + channels = 1; +@@ -101,71 +128,108 @@ + break; + default: + strcpy(info.szLastError,"unknown PNG color type"); ++#if PNG_LIBPNG_VER > 10399 ++ longjmp(png_jmpbuf(png_ptr), 1); ++#else + longjmp(png_ptr->jmpbuf, 1); ++#endif + } + + //find the right pixel depth used for cximage ++#if PNG_LIBPNG_VER > 10399 ++ int pixel_depth = _bit_depth * png_get_channels(png_ptr,info_ptr); ++#else + int pixel_depth = info_ptr->pixel_depth; ++#endif + if (channels == 1 && pixel_depth>8) pixel_depth=8; + if (channels == 2) pixel_depth=8; + if (channels >= 3) pixel_depth=24; + +- if (!Create(info_ptr->width, info_ptr->height, pixel_depth, CXIMAGE_FORMAT_PNG)){ ++ if (!Create(_width, _height, pixel_depth, CXIMAGE_FORMAT_PNG)){ ++#if PNG_LIBPNG_VER > 10399 ++ longjmp(png_jmpbuf(png_ptr), 1); ++#else + longjmp(png_ptr->jmpbuf, 1); ++#endif + } + + /* get metrics */ +- switch (info_ptr->phys_unit_type) ++ png_uint_32 _x_pixels_per_unit,_y_pixels_per_unit; ++ int _phys_unit_type; ++#if PNG_LIBPNG_VER > 10399 ++ png_get_pHYs(png_ptr,info_ptr,&_x_pixels_per_unit,&_y_pixels_per_unit,&_phys_unit_type); ++#else ++ _x_pixels_per_unit=info_ptr->x_pixels_per_unit; ++ _y_pixels_per_unit=info_ptr->y_pixels_per_unit; ++ _phys_unit_type=info_ptr->phys_unit_type; ++#endif ++ switch (_phys_unit_type) + { + case PNG_RESOLUTION_UNKNOWN: +- SetXDPI(info_ptr->x_pixels_per_unit); +- SetYDPI(info_ptr->y_pixels_per_unit); ++ SetXDPI(_x_pixels_per_unit); ++ SetYDPI(_y_pixels_per_unit); + break; + case PNG_RESOLUTION_METER: +- SetXDPI((long)floor(info_ptr->x_pixels_per_unit * 254.0 / 10000.0 + 0.5)); +- SetYDPI((long)floor(info_ptr->y_pixels_per_unit * 254.0 / 10000.0 + 0.5)); ++ SetXDPI((long)floor(_x_pixels_per_unit * 254.0 / 10000.0 + 0.5)); ++ SetYDPI((long)floor(_y_pixels_per_unit * 254.0 / 10000.0 + 0.5)); + break; + } + +- if (info_ptr->num_palette>0){ +- SetPalette((rgb_color*)info_ptr->palette,info_ptr->num_palette); +- SetClrImportant(info_ptr->num_palette); +- } else if (info_ptr->bit_depth ==2) { // needed for 2 bpp grayscale PNGs ++ int _num_palette; ++ png_colorp _palette; ++#if PNG_LIBPNG_VER > 10399 ++ png_get_PLTE(png_ptr,info_ptr,&_palette,&_num_palette); ++#else ++ _num_palette=info_ptr->num_palette; ++ _palette=info_ptr->palette; ++#endif ++ if (_num_palette>0){ ++ SetPalette((rgb_color*)_palette,_num_palette); ++ SetClrImportant(_num_palette); ++ } else if (_bit_depth ==2) { // needed for 2 bpp grayscale PNGs + SetPaletteColor(0,0,0,0); + SetPaletteColor(1,85,85,85); + SetPaletteColor(2,170,170,170); + SetPaletteColor(3,255,255,255); + } else SetGrayPalette(); // needed for grayscale PNGs + +- int nshift = max(0,(info_ptr->bit_depth>>3)-1)<<3; ++ int nshift = max(0,(_bit_depth>>3)-1)<<3; + +- if (info_ptr->num_trans!=0){ //palette transparency +- if (info_ptr->num_trans==1){ +- if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE){ ++ png_bytep _trans_alpha; ++ int _num_trans; ++ png_color_16p _trans_color; ++#if PNG_LIBPNG_VER > 10399 ++ png_get_tRNS(png_ptr,info_ptr,&_trans_alpha,&_num_trans,&_trans_color); ++#else ++ _num_trans=info_ptr->num_trans; ++#endif ++ if (_num_trans!=0){ //palette transparency ++ if (_num_trans==1){ ++ if (_color_type == PNG_COLOR_TYPE_PALETTE){ + #if PNG_LIBPNG_VER > 10399 +- info.nBkgndIndex = info_ptr->trans_color.index; ++ info.nBkgndIndex = _trans_color->index; + #else + info.nBkgndIndex = info_ptr->trans_values.index; + #endif + } else{ + #if PNG_LIBPNG_VER > 10399 +- info.nBkgndIndex = info_ptr->trans_color.gray>>nshift; ++ info.nBkgndIndex = _trans_color->gray>>nshift; + #else + info.nBkgndIndex = info_ptr->trans_values.gray>>nshift; + #endif + } + } +- if (info_ptr->num_trans>1){ ++ if (_num_trans>1){ + RGBQUAD* pal=GetPalette(); + if (pal){ + DWORD ip; +- for (ip=0;ipnum_trans);ip++) ++ for (ip=0;ip 10399 +- pal[ip].rgbReserved=info_ptr->trans_alpha[ip]; ++ pal[ip].rgbReserved=_trans_alpha[ip]; + #else + pal[ip].rgbReserved=info_ptr->trans[ip]; + #endif +- for (ip=info_ptr->num_trans;ip 10399 +- info.nBkgndColor.rgbRed = (BYTE)(info_ptr->trans_color.red>>nshift); +- info.nBkgndColor.rgbGreen = (BYTE)(info_ptr->trans_color.green>>nshift); +- info.nBkgndColor.rgbBlue = (BYTE)(info_ptr->trans_color.blue>>nshift); ++ /* seems unnecessary to call again, but the conditional must be important so... */ ++ if (png_get_tRNS(png_ptr,info_ptr,&_trans_alpha,&_num_trans,&_trans_color)){ ++#if PNG_LIBPNG_VER > 10399 ++ info.nBkgndColor.rgbRed = (BYTE)(_trans_color->red>>nshift); ++ info.nBkgndColor.rgbGreen = (BYTE)(_trans_color->green>>nshift); ++ info.nBkgndColor.rgbBlue = (BYTE)(_trans_color->blue>>nshift); + #else + info.nBkgndColor.rgbRed = (BYTE)(info_ptr->trans_values.red>>nshift); + info.nBkgndColor.rgbGreen = (BYTE)(info_ptr->trans_values.green>>nshift); +@@ -202,15 +264,24 @@ + } + + // - flip the RGB pixels to BGR (or RGBA to BGRA) +- if (info_ptr->color_type & PNG_COLOR_MASK_COLOR){ ++ if (_color_type & PNG_COLOR_MASK_COLOR){ + png_set_bgr(png_ptr); + } + + // - handle cancel +- if (info.nEscape) longjmp(png_ptr->jmpbuf, 1); ++ if (info.nEscape) ++#if PNG_LIBPNG_VER > 10399 ++ longjmp(png_jmpbuf(png_ptr), 1); ++#else ++ longjmp(png_ptr->jmpbuf, 1); ++#endif + + // row_bytes is the width x number of channels x (bit-depth / 8) ++#if PNG_LIBPNG_VER > 10399 ++ row_pointers = new BYTE[png_get_rowbytes(png_ptr,info_ptr) + 8]; ++#else + row_pointers = new BYTE[info_ptr->rowbytes + 8]; ++#endif + + // turn on interlace handling + int number_passes = png_set_interlace_handling(png_ptr); +@@ -221,8 +292,12 @@ + SetCodecOption(0); + } + +- int chan_offset = info_ptr->bit_depth >> 3; ++ int chan_offset = _bit_depth >> 3; ++#if PNG_LIBPNG_VER > 10399 ++ int pixel_offset = (_bit_depth * png_get_channels(png_ptr,info_ptr)) >> 3; ++#else + int pixel_offset = info_ptr->pixel_depth >> 3; ++#endif + + for (int pass=0; pass < number_passes; pass++) { + iter.Upset(); +@@ -230,7 +305,12 @@ + do { + + // - handle cancel +- if (info.nEscape) longjmp(png_ptr->jmpbuf, 1); ++ if (info.nEscape) ++#if PNG_LIBPNG_VER > 10399 ++ longjmp(png_jmpbuf(png_ptr), 1); ++#else ++ longjmp(png_ptr->jmpbuf, 1); ++#endif + + #if CXIMAGE_SUPPORT_ALPHA // + if (AlphaIsValid()) { +@@ -241,7 +321,7 @@ + BYTE* prow= iter.GetRow(ay); + + //recover data from previous scan +- if (info_ptr->interlace_type && pass>0 && pass!=7){ ++ if (_interlace_type && pass>0 && pass!=7){ + for(ax=0;axinterlace_type && pass>0){ ++ if (_interlace_type && pass>0){ ++#if PNG_LIBPNG_VER > 10399 ++ iter.GetRow(row_pointers, png_get_rowbytes(png_ptr,info_ptr)); ++#else + iter.GetRow(row_pointers, info_ptr->rowbytes); ++#endif + //re-expand buffer for images with bit depth > 8 +- if (info_ptr->bit_depth > 8){ ++ if (_bit_depth > 8){ + for(long ax=(head.biWidth*channels-1);ax>=0;ax--) + row_pointers[ax*chan_offset] = row_pointers[ax]; + } +@@ -291,15 +375,19 @@ + png_read_row(png_ptr, row_pointers, NULL); + + //shrink 16 bit depth images down to 8 bits +- if (info_ptr->bit_depth > 8){ ++ if (_bit_depth > 8){ + for(long ax=0;ax<(head.biWidth*channels);ax++) + row_pointers[ax] = row_pointers[ax*chan_offset]; + } + + //copy the pixels ++#if PNG_LIBPNG_VER > 10399 ++ iter.SetRow(row_pointers, png_get_rowbytes(png_ptr,info_ptr)); ++#else + iter.SetRow(row_pointers, info_ptr->rowbytes); ++#endif + // expand 2 bpp images only in the last pass +- if (info_ptr->bit_depth==2 && pass==(number_passes-1)) ++ if (_bit_depth==2 && pass==(number_passes-1)) + expand2to4bpp(iter.GetRow()); + + //go on +@@ -361,9 +449,13 @@ + /* Set error handling. REQUIRED if you aren't supplying your own + * error hadnling functions in the png_create_write_struct() call. + */ ++#if PNG_LIBPNG_VER > 10399 ++ if (setjmp(png_jmpbuf(png_ptr))){ ++#else + if (setjmp(png_ptr->jmpbuf)){ + /* If we get here, we had a problem reading the file */ + if (info_ptr->palette) free(info_ptr->palette); ++#endif + png_destroy_write_struct(&png_ptr, (png_infopp)&info_ptr); + cx_throw("Error saving PNG file"); + } +@@ -372,9 +464,23 @@ + //png_init_io(png_ptr, hFile); + + // use custom I/O functions +- png_set_write_fn(png_ptr,hFile,/*(png_rw_ptr)*/user_write_data,/*(png_flush_ptr)*/user_flush_data); ++ png_set_write_fn(png_ptr,hFile,/*(png_rw_ptr)*/user_write_data,/*(png_flush_ptr)*/user_flush_data); + + /* set the file information here */ ++#if PNG_LIBPNG_VER > 10399 ++ /* use variables to hold the values so it isnt necessary to png_get them later */ ++ png_uint_32 _width,_height; ++ int _bit_depth,_color_type,_interlace_type,_compression_type,_filter_type; ++ png_byte _channels,_pixel_depth; ++ ++ _width = GetWidth(); ++ _height = GetHeight(); ++ _pixel_depth = (BYTE)GetBpp(); ++ _channels = (GetBpp()>8) ? (BYTE)3: (BYTE)1; ++ _bit_depth = (BYTE)(GetBpp()/_channels); ++ _compression_type = PNG_COMPRESSION_TYPE_DEFAULT; ++ _filter_type = PNG_FILTER_TYPE_DEFAULT; ++#else + info_ptr->width = GetWidth(); + info_ptr->height = GetHeight(); + info_ptr->pixel_depth = (BYTE)GetBpp(); +@@ -382,13 +488,22 @@ + info_ptr->bit_depth = (BYTE)(GetBpp()/info_ptr->channels); + info_ptr->compression_type = info_ptr->filter_type = 0; + info_ptr->valid = 0; ++#endif + + switch(GetCodecOption(CXIMAGE_FORMAT_PNG)){ + case 1: ++#if PNG_LIBPNG_VER > 10399 ++ _interlace_type = PNG_INTERLACE_ADAM7; ++#else + info_ptr->interlace_type = PNG_INTERLACE_ADAM7; ++#endif + break; + default: ++#if PNG_LIBPNG_VER > 10399 ++ _interlace_type = PNG_INTERLACE_NONE; ++#else + info_ptr->interlace_type = PNG_INTERLACE_NONE; ++#endif + } + + /* set compression level */ +@@ -398,22 +513,47 @@ + + if (GetNumColors()){ + if (bGrayScale){ ++#if PNG_LIBPNG_VER > 10399 ++ _color_type = PNG_COLOR_TYPE_GRAY; ++#else + info_ptr->color_type = PNG_COLOR_TYPE_GRAY; ++#endif + } else { ++#if PNG_LIBPNG_VER > 10399 ++ _color_type = PNG_COLOR_TYPE_PALETTE; ++#else + info_ptr->color_type = PNG_COLOR_TYPE_PALETTE; ++#endif + } + } else { ++#if PNG_LIBPNG_VER > 10399 ++ _color_type = PNG_COLOR_TYPE_RGB; ++#else + info_ptr->color_type = PNG_COLOR_TYPE_RGB; ++#endif + } + #if CXIMAGE_SUPPORT_ALPHA + if (AlphaIsValid()){ ++#if PNG_LIBPNG_VER > 10399 ++ _color_type |= PNG_COLOR_MASK_ALPHA; ++ _channels++; ++ _bit_depth = 8; ++ _pixel_depth += 8; ++#else + info_ptr->color_type |= PNG_COLOR_MASK_ALPHA; + info_ptr->channels++; + info_ptr->bit_depth = 8; + info_ptr->pixel_depth += 8; ++#endif + } + #endif + ++#if PNG_LIBPNG_VER > 10399 ++ /* set the header here, since we're done modifying these values */ ++ png_set_IHDR(png_ptr,info_ptr,_width,_height,_bit_depth,_color_type,_interlace_type, ++ _compression_type,_filter_type); ++#endif ++ + /* set background */ + png_color_16 image_background={ 0, 255, 255, 255, 0 }; + RGBQUAD tc = GetTransColor(); +@@ -427,22 +567,24 @@ + /* set metrics */ + png_set_pHYs(png_ptr, info_ptr, head.biXPelsPerMeter, head.biYPelsPerMeter, PNG_RESOLUTION_METER); + ++#if PNG_LIBPNG_VER <= 10399 + png_set_IHDR(png_ptr, info_ptr, info_ptr->width, info_ptr->height, info_ptr->bit_depth, + info_ptr->color_type, info_ptr->interlace_type, + PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); ++#endif + + // simple transparency + if (info.nBkgndIndex >= 0){ +- info_ptr->num_trans = 1; +- info_ptr->valid |= PNG_INFO_tRNS; + #if PNG_LIBPNG_VER > 10399 +- info_ptr->trans_alpha = trans; +- info_ptr->trans_color.index = (BYTE)info.nBkgndIndex; +- info_ptr->trans_color.red = tc.rgbRed; +- info_ptr->trans_color.green = tc.rgbGreen; +- info_ptr->trans_color.blue = tc.rgbBlue; +- info_ptr->trans_color.gray = info_ptr->trans_color.index; ++ png_color_16 _trans_color; ++ _trans_color.index = (BYTE)info.nBkgndIndex; ++ _trans_color.red = tc.rgbRed; ++ _trans_color.green = tc.rgbGreen; ++ _trans_color.blue = tc.rgbBlue; ++ _trans_color.gray = _trans_color.index; + #else ++ info_ptr->num_trans = 1; ++ info_ptr->valid |= PNG_INFO_tRNS; + info_ptr->trans = trans; + info_ptr->trans_values.index = (BYTE)info.nBkgndIndex; + info_ptr->trans_values.red = tc.rgbRed; +@@ -454,34 +596,53 @@ + // the transparency indexes start from 0 for non grayscale palette + if (!bGrayScale && head.biClrUsed && info.nBkgndIndex) + SwapIndex(0,(BYTE)info.nBkgndIndex); ++ ++#if PNG_LIBPNG_VER > 10399 ++ png_set_tRNS(png_ptr,info_ptr,(png_bytep)trans,1,&_trans_color); ++#endif + } + + /* set the palette if there is one */ ++#if PNG_LIBPNG_VER > 10399 ++ png_colorp _palette; ++#endif + if (GetPalette()){ ++#if PNG_LIBPNG_VER <= 10399 + if (!bGrayScale){ + info_ptr->valid |= PNG_INFO_PLTE; + } ++#endif + + int nc = GetClrImportant(); + if (nc==0) nc = GetNumColors(); + ++ // copy the palette colors ++#if PNG_LIBPNG_VER > 10399 ++ _palette = new png_color[nc]; ++#else ++ info_ptr->palette = new png_color[nc]; ++ info_ptr->num_palette = (png_uint_16) nc; ++#endif ++ for (int i=0; i 10399 ++ GetPaletteColor(i, &_palette[i].red, &_palette[i].green, &_palette[i].blue); ++ ++ png_set_PLTE(png_ptr,info_ptr,_palette,nc); ++#else ++ GetPaletteColor(i, &info_ptr->palette[i].red, &info_ptr->palette[i].green, &info_ptr->palette[i].blue); ++#endif ++ + if (info.bAlphaPaletteEnabled){ + for(WORD ip=0; ipnum_trans = (WORD)nc; +- info_ptr->valid |= PNG_INFO_tRNS; + #if PNG_LIBPNG_VER > 10399 +- info_ptr->trans_alpha = trans; ++ png_set_tRNS(png_ptr,info_ptr,(png_bytep)trans,nc,NULL); + #else ++ info_ptr->num_trans = (WORD)nc; ++ info_ptr->valid |= PNG_INFO_tRNS; + info_ptr->trans = trans; + #endif + } +- +- // copy the palette colors +- info_ptr->palette = new png_color[nc]; +- info_ptr->num_palette = (png_uint_16) nc; +- for (int i=0; ipalette[i].red, &info_ptr->palette[i].green, &info_ptr->palette[i].blue); + } + + #if CXIMAGE_SUPPORT_ALPHA // +@@ -495,8 +656,12 @@ + } } } + #endif // CXIMAGE_SUPPORT_ALPHA // + ++#if PNG_LIBPNG_VER > 10399 ++ int row_size = max(info.dwEffWidth, (_width * _channels * _bit_depth / 8)); ++#else + int row_size = max(info.dwEffWidth, info_ptr->width*info_ptr->channels*(info_ptr->bit_depth/8)); + info_ptr->rowbytes = row_size; ++#endif + BYTE *row_pointers = new BYTE[row_size]; + + /* write the file information */ +@@ -514,7 +679,11 @@ + if (AlphaIsValid()){ + for (long ax=head.biWidth-1; ax>=0;ax--){ + c = BlindGetPixelColor(ax,ay); ++#if PNG_LIBPNG_VER > 10399 ++ int px = ax * _channels; ++#else + int px = ax * info_ptr->channels; ++#endif + if (!bGrayScale){ + row_pointers[px++]=c.rgbRed; + row_pointers[px++]=c.rgbGreen; +@@ -529,7 +698,11 @@ + #endif //CXIMAGE_SUPPORT_ALPHA // + { + iter.GetRow(row_pointers, row_size); ++#if PNG_LIBPNG_VER > 10399 ++ if (_color_type == PNG_COLOR_TYPE_RGB) //HACK BY OP ++#else + if (info_ptr->color_type == PNG_COLOR_TYPE_RGB) //HACK BY OP ++#endif + RGBtoBGR(row_pointers, row_size); + png_write_row(png_ptr, row_pointers); + } +@@ -546,9 +719,14 @@ + png_write_end(png_ptr, info_ptr); + + /* if you malloced the palette, free it here */ ++#if PNG_LIBPNG_VER > 10399 ++ if (_palette){ ++ delete [] (_palette); ++#else + if (info_ptr->palette){ + delete [] (info_ptr->palette); + info_ptr->palette = NULL; ++#endif + } + + /* clean up after the write, and free any memory allocated */ diff --git a/media-tv/xbmc/xbmc-10.1.ebuild b/media-tv/xbmc/xbmc-10.1.ebuild index bb44d70a2eea..907c85cdc137 100644 --- a/media-tv/xbmc/xbmc-10.1.ebuild +++ b/media-tv/xbmc/xbmc-10.1.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/media-tv/xbmc/xbmc-10.1.ebuild,v 1.6 2011/08/11 02:43:55 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/media-tv/xbmc/xbmc-10.1.ebuild,v 1.7 2011/09/18 01:37:04 vapier Exp $ EAPI="2" @@ -112,6 +112,8 @@ src_unpack() { src_prepare() { epatch "${FILESDIR}"/${PN}-10.0-python-2.7.patch #350098 epatch "${FILESDIR}"/${PN}-10.1-gcc-4.6.patch #367261 + epatch "${FILESDIR}"/${P}-libpng-1.5.patch #380127 + epatch "${FILESDIR}"/${PN}-10.1-headers.patch #380127 # some dirs ship generated autotools, some dont local d -- 2.26.2