diff options
-rw-r--r-- | media-libs/sdl-image/ChangeLog | 8 | ||||
-rw-r--r-- | media-libs/sdl-image/Manifest | 5 | ||||
-rw-r--r-- | media-libs/sdl-image/files/sdl-image-1.2.10-libpng15.patch | 160 | ||||
-rw-r--r-- | media-libs/sdl-image/sdl-image-1.2.10-r1.ebuild | 11 |
4 files changed, 177 insertions, 7 deletions
diff --git a/media-libs/sdl-image/ChangeLog b/media-libs/sdl-image/ChangeLog index f1250f9ec5e9..d304114fab9f 100644 --- a/media-libs/sdl-image/ChangeLog +++ b/media-libs/sdl-image/ChangeLog @@ -1,6 +1,10 @@ # ChangeLog for media-libs/sdl-image -# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/media-libs/sdl-image/ChangeLog,v 1.75 2010/07/27 02:34:57 mr_bones_ Exp $ +# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/media-libs/sdl-image/ChangeLog,v 1.76 2011/03/25 11:24:15 tupone Exp $ + + 25 Mar 2011; Alfredo Tupone <tupone@gentoo.org> + sdl-image-1.2.10-r1.ebuild, +files/sdl-image-1.2.10-libpng15.patch: + Build with media-libs/libpng-1.5 Bug #354675 by Rafał Mużyło 27 Jul 2010; Michael Sterrett <mr_bones_@gentoo.org> sdl-image-1.2.10-r1.ebuild: diff --git a/media-libs/sdl-image/Manifest b/media-libs/sdl-image/Manifest index f538be927dff..9a913ce79120 100644 --- a/media-libs/sdl-image/Manifest +++ b/media-libs/sdl-image/Manifest @@ -1,4 +1,5 @@ +AUX sdl-image-1.2.10-libpng15.patch 5619 RMD160 40e1562efeb131ff41e879ecfe96bcc6f337e473 SHA1 a6eca524b22ec34cdcdc3798bbdda6522df29649 SHA256 7d0ad86394effded7e332105e677c00f17cd69a7ce35d74dfee9f814cc15b1eb DIST SDL_image-1.2.10.tar.gz 1332906 RMD160 8133f7f8d488b1c3f69ad80a941289b4508d2901 SHA1 6bae71fdfd795c3dbf39f6c7c0cf8b212914ef97 SHA256 75e05d1e95f6277b44797157d9e25a908ba8d08a393216ffb019b0d74de11876 -EBUILD sdl-image-1.2.10-r1.ebuild 1436 RMD160 fa79513d999ec6468cb66e985aefb8b16509f384 SHA1 b34ab279a38e3e899d9fbe935eaecd182882cb56 SHA256 9beb6aad531be6dec2094a81dc2de325bb7d38107ec8e219a9e42c30ad4318d8 -MISC ChangeLog 9484 RMD160 c2940c07c8bba56d839b2f60812766fd6eec1615 SHA1 da4784907080ff4bccb770c8feedd41c3c06fe2c SHA256 e7d3c553a952f324f91b3c3ff8b99ce23e71524baa80901133e6d183055467b2 +EBUILD sdl-image-1.2.10-r1.ebuild 1514 RMD160 a19319a0b3a4f539492eabca687df7b0f02a6792 SHA1 9828d5dc5f25830c5277f819d7a48ebc2c77ee01 SHA256 b072ade8144ae2619332e46290387c9f19af38a63f8c434d31bee62cda6ac09c +MISC ChangeLog 9668 RMD160 504d3cad3dfc50fbd723bebfe73581fbae3d9389 SHA1 504dc3c891f4bf838d52e56cb72b306c79e117b8 SHA256 ed65c7477e64a349cd69f742eb2571820f02379e07d1ffbdf57edc0254c47214 MISC metadata.xml 158 RMD160 cbd9984bb6b426c8c9cee5022fe0a26261612fea SHA1 be5251fa1dacef5c41b74761bb1c8c54fb633b9e SHA256 1423a4fdd4a79b1728a2056d9e300f7e1074253095d82726218d9e9b953888a3 diff --git a/media-libs/sdl-image/files/sdl-image-1.2.10-libpng15.patch b/media-libs/sdl-image/files/sdl-image-1.2.10-libpng15.patch new file mode 100644 index 000000000000..78b0a92ea03e --- /dev/null +++ b/media-libs/sdl-image/files/sdl-image-1.2.10-libpng15.patch @@ -0,0 +1,160 @@ +--- IMG_png.c ++++ IMG_png.c +@@ -71,6 +71,10 @@ + #endif + #include <png.h> + ++/* Check for the older version of libpng */ ++#if (PNG_LIBPNG_VER_MAJOR == 1) && (PNG_LIBPNG_VER_MINOR < 4) ++#define LIBPNG_VERSION_12 ++#endif + + static struct { + int loaded; +@@ -80,6 +84,8 @@ + void (*png_destroy_read_struct) (png_structpp png_ptr_ptr, png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr); + png_uint_32 (*png_get_IHDR) (png_structp png_ptr, png_infop info_ptr, png_uint_32 *width, png_uint_32 *height, int *bit_depth, int *color_type, int *interlace_method, int *compression_method, int *filter_method); + png_voidp (*png_get_io_ptr) (png_structp png_ptr); ++ png_byte (*png_get_channels) (png_structp png_ptr, png_infop info_ptr); ++ png_uint_32 (*png_get_PLTE) (png_structp png_ptr, png_infop info_ptr, png_colorp *palette, int *num_palette); + png_uint_32 (*png_get_tRNS) (png_structp png_ptr, png_infop info_ptr, png_bytep *trans, int *num_trans, png_color_16p *trans_values); + png_uint_32 (*png_get_valid) (png_structp png_ptr, png_infop info_ptr, png_uint_32 flag); + void (*png_read_image) (png_structp png_ptr, png_bytepp image); +@@ -91,6 +97,9 @@ + void (*png_set_read_fn) (png_structp png_ptr, png_voidp io_ptr, png_rw_ptr read_data_fn); + void (*png_set_strip_16) (png_structp png_ptr); + int (*png_sig_cmp) (png_bytep sig, png_size_t start, png_size_t num_to_check); ++#ifndef LIBPNG_VERSION_12 ++ jmp_buf* (*png_set_longjmp_fn) (png_structp, png_longjmp_ptr, size_t); ++#endif + } lib; + + #ifdef LOAD_PNG_DYNAMIC +@@ -129,6 +138,13 @@ + SDL_UnloadObject(lib.handle); + return -1; + } ++ lib.png_get_channels = ++ (png_byte (*) (png_structp, png_infop)) ++ SDL_LoadFunction(lib.handle, "png_get_channels"); ++ if ( lib.png_get_channels == NULL ) { ++ SDL_UnloadObject(lib.handle); ++ return -1; ++ } + lib.png_get_io_ptr = + (png_voidp (*) (png_structp)) + SDL_LoadFunction(lib.handle, "png_get_io_ptr"); +@@ -136,6 +152,13 @@ + SDL_UnloadObject(lib.handle); + return -1; + } ++ lib.png_get_PLTE = ++ (png_uint_32 (*) (png_structp, png_infop, png_colorp *, int *)) ++ SDL_LoadFunction(lib.handle, "png_get_PLTE"); ++ if ( lib.png_get_PLTE == NULL ) { ++ SDL_UnloadObject(lib.handle); ++ return -1; ++ } + lib.png_get_tRNS = + (png_uint_32 (*) (png_structp, png_infop, png_bytep *, int *, png_color_16p *)) + SDL_LoadFunction(lib.handle, "png_get_tRNS"); +@@ -213,6 +236,15 @@ + SDL_UnloadObject(lib.handle); + return -1; + } ++#ifndef LIBPNG_VERSION_12 ++ lib.png_set_longjmp_fn = ++ (jmp_buf * (*) (png_structp, png_longjmp_ptr, size_t)) ++ SDL_LoadFunction(lib.handle, "png_set_longjmp_fn"); ++ if ( lib.png_set_longjmp_fn == NULL ) { ++ SDL_UnloadObject(lib.handle); ++ return -1; ++ } ++#endif + } + ++lib.loaded; + +@@ -236,7 +268,9 @@ + lib.png_create_read_struct = png_create_read_struct; + lib.png_destroy_read_struct = png_destroy_read_struct; + lib.png_get_IHDR = png_get_IHDR; ++ lib.png_get_channels = png_get_channels; + lib.png_get_io_ptr = png_get_io_ptr; ++ lib.png_get_PLTE = png_get_PLTE; + lib.png_get_tRNS = png_get_tRNS; + lib.png_get_valid = png_get_valid; + lib.png_read_image = png_read_image; +@@ -248,6 +282,9 @@ + lib.png_set_read_fn = png_set_read_fn; + lib.png_set_strip_16 = png_set_strip_16; + lib.png_sig_cmp = png_sig_cmp; ++#ifndef LIBPNG_VERSION_12 ++ lib.png_set_longjmp_fn = png_set_longjmp_fn; ++#endif + } + ++lib.loaded; + +@@ -347,7 +384,12 @@ + * the normal method of doing things with libpng). REQUIRED unless you + * set up your own error handlers in png_create_read_struct() earlier. + */ +- if ( setjmp(png_ptr->jmpbuf) ) { ++#ifndef LIBPNG_VERSION_12 ++ if ( setjmp(*lib.png_set_longjmp_fn(png_ptr, longjmp, sizeof (jmp_buf))) ) ++#else ++ if ( setjmp(png_ptr->jmpbuf) ) ++#endif ++ { + error = "Error reading the PNG file."; + goto done; + } +@@ -416,9 +458,9 @@ + Rmask = 0x000000FF; + Gmask = 0x0000FF00; + Bmask = 0x00FF0000; +- Amask = (info_ptr->channels == 4) ? 0xFF000000 : 0; ++ Amask = (lib.png_get_channels(png_ptr, info_ptr) == 4) ? 0xFF000000 : 0; + } else { +- int s = (info_ptr->channels == 4) ? 0 : 8; ++ int s = (lib.png_get_channels(png_ptr, info_ptr) == 4) ? 0 : 8; + Rmask = 0xFF000000 >> s; + Gmask = 0x00FF0000 >> s; + Bmask = 0x0000FF00 >> s; +@@ -426,7 +468,7 @@ + } + } + surface = SDL_AllocSurface(SDL_SWSURFACE, width, height, +- bit_depth*info_ptr->channels, Rmask,Gmask,Bmask,Amask); ++ bit_depth*lib.png_get_channels(png_ptr, info_ptr), Rmask,Gmask,Bmask,Amask); + if ( surface == NULL ) { + error = "Out of memory"; + goto done; +@@ -467,6 +509,9 @@ + /* Load the palette, if any */ + palette = surface->format->palette; + if ( palette ) { ++ int png_num_palette; ++ png_colorp png_palette; ++ lib.png_get_PLTE(png_ptr, info_ptr, &png_palette, &png_num_palette); + if(color_type == PNG_COLOR_TYPE_GRAY) { + palette->ncolors = 256; + for(i = 0; i < 256; i++) { +@@ -474,12 +519,12 @@ + palette->colors[i].g = i; + palette->colors[i].b = i; + } +- } else if (info_ptr->num_palette > 0 ) { +- palette->ncolors = info_ptr->num_palette; +- for( i=0; i<info_ptr->num_palette; ++i ) { +- palette->colors[i].b = info_ptr->palette[i].blue; +- palette->colors[i].g = info_ptr->palette[i].green; +- palette->colors[i].r = info_ptr->palette[i].red; ++ } else if (png_num_palette > 0 ) { ++ palette->ncolors = png_num_palette; ++ for( i=0; i<png_num_palette; ++i ) { ++ palette->colors[i].b = png_palette[i].blue; ++ palette->colors[i].g = png_palette[i].green; ++ palette->colors[i].r = png_palette[i].red; + } + } + } diff --git a/media-libs/sdl-image/sdl-image-1.2.10-r1.ebuild b/media-libs/sdl-image/sdl-image-1.2.10-r1.ebuild index 2466c8febb13..44f41aeedf19 100644 --- a/media-libs/sdl-image/sdl-image-1.2.10-r1.ebuild +++ b/media-libs/sdl-image/sdl-image-1.2.10-r1.ebuild @@ -1,8 +1,10 @@ -# 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-libs/sdl-image/sdl-image-1.2.10-r1.ebuild,v 1.11 2010/07/27 02:34:57 mr_bones_ Exp $ - +# $Header: /var/cvsroot/gentoo-x86/media-libs/sdl-image/sdl-image-1.2.10-r1.ebuild,v 1.12 2011/03/25 11:24:15 tupone Exp $ EAPI=2 + +inherit base + MY_P="${P/sdl-/SDL_}" DESCRIPTION="image file loading library" HOMEPAGE="http://www.libsdl.org/projects/SDL_image/" @@ -18,9 +20,12 @@ DEPEND="sys-libs/zlib png? ( >=media-libs/libpng-1.4 ) jpeg? ( virtual/jpeg ) tiff? ( media-libs/tiff )" +RDEPEND="${DEPEND}" S=${WORKDIR}/${MY_P} +PATCHES=( "${FILESDIR}"/${P}-libpng15.patch ) + src_configure() { econf \ --disable-jpg-shared \ |