From ac88a9fc7bad621054dc598b2419342dc8531d17 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ch=C3=AD-Thanh=20Christopher=20Nguy=E1=BB=85n?= Date: Sat, 17 Dec 2011 19:37:35 +0000 Subject: [PATCH] Add patch to fix building against libpng-1.5, bug #393141. Non-maintainer commit, ok'ed by tampakrap on IRC. Package-Manager: portage-2.2.0_alpha79/cvs/Linux x86_64 --- x11-libs/qt-gui/ChangeLog | 8 +- x11-libs/qt-gui/Manifest | 17 +- .../qt-gui/files/qt-gui-4.6-libpng-1.5.patch | 283 ++++++++++++++++++ x11-libs/qt-gui/qt-gui-4.6.3-r2.ebuild | 4 +- x11-libs/qt-gui/qt-gui-4.6.3.ebuild | 4 +- 5 files changed, 300 insertions(+), 16 deletions(-) create mode 100644 x11-libs/qt-gui/files/qt-gui-4.6-libpng-1.5.patch diff --git a/x11-libs/qt-gui/ChangeLog b/x11-libs/qt-gui/ChangeLog index 5b01cf5cdf5a..050b4c73be92 100644 --- a/x11-libs/qt-gui/ChangeLog +++ b/x11-libs/qt-gui/ChangeLog @@ -1,6 +1,12 @@ # ChangeLog for x11-libs/qt-gui # Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/x11-libs/qt-gui/ChangeLog,v 1.158 2011/12/03 20:26:41 grobian Exp $ +# $Header: /var/cvsroot/gentoo-x86/x11-libs/qt-gui/ChangeLog,v 1.159 2011/12/17 19:37:35 chithanh Exp $ + + 17 Dec 2011; Chí-Thanh Christopher Nguyễn + +files/qt-gui-4.6-libpng-1.5.patch, qt-gui-4.6.3.ebuild, + qt-gui-4.6.3-r2.ebuild: + Add patch to fix building against libpng-1.5, bug #393141. Non-maintainer + commit, ok'ed by tampakrap on IRC. 03 Dec 2011; Fabian Groffen qt-gui-4.7.4-r1.ebuild: Disable ssse3 on Darwin to fix compilation, thanks Paul, bug #367045 diff --git a/x11-libs/qt-gui/Manifest b/x11-libs/qt-gui/Manifest index 13e1fd0779a8..5c253160259a 100644 --- a/x11-libs/qt-gui/Manifest +++ b/x11-libs/qt-gui/Manifest @@ -1,6 +1,4 @@ ------BEGIN PGP SIGNED MESSAGE----- -Hash: SHA1 - +AUX qt-gui-4.6-libpng-1.5.patch 11322 RMD160 dba67fb2e79b96644e70715d6ffb28f3e676e884 SHA1 84c758d2fb76470b9282348a487e096dba33a92b SHA256 05c7a5aceeff1cc4c2bad065402025e6d4fead98c0eb0d786d15f65d7d1774a9 AUX qt-gui-4.7.3-cups.patch 3297 RMD160 fc99e57ccfa8db47a1df799186d6daedcbdf744d SHA1 d712b9b570101de5c996692551ba5a3ae4a410e9 SHA256 3ccfefb432015e4a4ea967b030c51b10dcdfb1f63445557908ddae5e75012d33 AUX qt-gui-4.7.4-fix-libreoffice-crash.patch 1958 RMD160 da10c0614e4ecb8f6f3c705d191503a42e174659 SHA1 652fc396b99846d1f2fe334c15f4cd4b8599806b SHA256 097021dfb6c25d8d8ca31a8a1bf70e35f9962113ce44791ad682fb54f4604844 DIST qt-everywhere-opensource-src-4.6.2.tar.gz 160601949 RMD160 5f3fea120f2dba274c4150b02162bba40b65a872 SHA1 977c10b88a2230e96868edc78a9e3789c0fcbf70 SHA256 176f51ddb06dce67ab4b2efc6b327dc21ed8f764c5d97acc15ff1f907c2affae @@ -9,17 +7,10 @@ DIST qt-everywhere-opensource-src-4.7.2.tar.gz 213663032 RMD160 de3d1c172c23c336 DIST qt-everywhere-opensource-src-4.7.4.tar.gz 220388303 RMD160 3e47b09663a89973b1c8628506c995dfc2a5387c SHA1 af9016aa924a577f7b06ffd28c9773b56d74c939 SHA256 97195ebce8a46f9929fb971d9ae58326d011c4d54425389e6e936514f540221e EBUILD qt-gui-4.6.2-r1.ebuild 5393 RMD160 ea873072a18b5e9f320dac0d5c74036bda34b058 SHA1 10af63288b9b4e44bbfae36d9204674f287c6ab5 SHA256 d50b6f78971d2d9b9f638ca3f8d36e04b6c76ab2c0ecbe8fc54f679f00580620 EBUILD qt-gui-4.6.2.ebuild 5299 RMD160 f957942dfae65dffe841074af5ecc1209098d1c4 SHA1 88b378000bd1b1c11cf9bbf872e31b67627ebed6 SHA256 16dae674a5f68af5746c00e36360209430256fa9d46573f298b2bcc59eddb154 -EBUILD qt-gui-4.6.3-r2.ebuild 5449 RMD160 6a70e48b4de30ce123aae5a7c7894572acc00844 SHA1 3d6a2538e89a6e783a6855f0db35c74620384ed2 SHA256 d6b41a13907801c59a18cfbb512f78daf24c6e2782595fbda32d26bc0aeaddb3 -EBUILD qt-gui-4.6.3.ebuild 5425 RMD160 5a00504271c422b716580984ef70db235c5cadeb SHA1 60020e6eb373af2b6286ede272f8b9f84c2912a4 SHA256 f06ec00a93c7c9126389ad00aed369ed1daf45564c7e02dd234e60fed3053c40 +EBUILD qt-gui-4.6.3-r2.ebuild 5507 RMD160 12202a5ad50432a891b3a86fe3aed2002cc39069 SHA1 ed926629a993781c960a6d7af54e5b37a2234556 SHA256 88c1aa6f81aff5867525707639bed06f79f27b9cb11ddb6354862da6f1fca636 +EBUILD qt-gui-4.6.3.ebuild 5483 RMD160 000cc1f41b04464e87fa72556484fb8bdbc17c8d SHA1 e3ff17f716fb8ca8d2b687b65d29cb4ad3ccbcab SHA256 2b2bfc833533b1ff33756aede685b1fc02b8ae25a9517098c9536bb12bc03e69 EBUILD qt-gui-4.7.2.ebuild 6350 RMD160 a47834c6bc9471eeb188fd26ca1394083b08225a SHA1 8e34ec70e3a1a10a7302171629f8754ea13eabdf SHA256 43e21b9cea2aac8d8ee82d46585168436bfad570e3e0695244eb300d41c02110 EBUILD qt-gui-4.7.4-r1.ebuild 6293 RMD160 f362ff67e757dc546f32d03138eb08614e505b93 SHA1 dacf03a20b59a9ca968bd65cda349e7a6d2bc9ae SHA256 de3b3f298d5973bd34936002849c7eb5c5c4e0a67b980688ef6c7f149624cbbf EBUILD qt-gui-4.7.4.ebuild 6169 RMD160 7f15d86f439a3dc4bc7a6e017208dbe41280405a SHA1 0bebd1b5ac74f414c5010398f416345503022057 SHA256 47714fd101a43dc994633a00bc5297d151b526efc080c6eff4304e6906188256 -MISC ChangeLog 23938 RMD160 085280edeea0ffebeff0aa35dce1f18eb495104b SHA1 577a73c4cd01f378b2cf79f571d2bb312c54dbd4 SHA256 d3ce2de902d08d759bfc204c88e9a87ef8283ba240311bd25bd57923fc32f8f0 +MISC ChangeLog 24207 RMD160 d8d1e2ba015ad2a0eca39e7add837cc9bbd57d47 SHA1 00187383341bca02ef0f068f8d670136df43180c SHA256 c413563b8e792cde72b1e3026187bd218cc5eba18c5931fbbb547fd0c1d91b92 MISC metadata.xml 1181 RMD160 74e177f4c687acb1df2637f28ac36cc80b4f224e SHA1 3ea8a8aba7d077d6a008b8360811f4e43538232b SHA256 49515885af0ad4b13d4f93911c0b8b84e25abcda3fdc8e5715b1aa956b18af15 ------BEGIN PGP SIGNATURE----- -Version: GnuPG v2.0.18 (Darwin) - -iEYEARECAAYFAk7ahgcACgkQX3X2B8XHTokMHgCgo+1Nc5HIQQhP4VFqg5jU8NOi -XCgAn1AuqNjiauAqI3LhLy69akYDzyBC -=Y9lw ------END PGP SIGNATURE----- diff --git a/x11-libs/qt-gui/files/qt-gui-4.6-libpng-1.5.patch b/x11-libs/qt-gui/files/qt-gui-4.6-libpng-1.5.patch new file mode 100644 index 000000000000..8c7f2fa908ed --- /dev/null +++ b/x11-libs/qt-gui/files/qt-gui-4.6-libpng-1.5.patch @@ -0,0 +1,283 @@ +From 8a81562af30435f82255830489dca691031a5408 Mon Sep 17 00:00:00 2001 +From: aavit +Date: Tue, 9 Feb 2010 10:32:04 +0100 +Subject: [PATCH] Use libpng API as recommended. Preparation for upgrade to libpng 1.4.0. + +The libpng doc advises against accessing the info_ptr structure +directly, and in 1.4.0 the members are flagged as deprecated, so such +access gives compilation warnings. This patch makes qpnghandler use +the recommended access functions instead. + +Reviewed-by: Trond +--- + src/gui/image/qpnghandler.cpp | 135 +++++++++++++++++++---------------------- + 1 files changed, 62 insertions(+), 73 deletions(-) + +diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp +index d5406cb..bba54b9 100644 +--- a/src/gui/image/qpnghandler.cpp ++++ b/src/gui/image/qpnghandler.cpp +@@ -50,8 +50,13 @@ + #include + #include + ++#ifdef QT_USE_BUNDLED_LIBPNG ++#include <../../3rdparty/libpng/png.h> ++#include <../../3rdparty/libpng/pngconf.h> ++#else + #include + #include ++#endif + + #ifdef Q_OS_WINCE + #define CALLBACK_CALL_TYPE __cdecl +@@ -162,11 +167,16 @@ void setup_qt(QImage& image, png_structp png_ptr, png_infop info_ptr, float scre + png_uint_32 height; + int bit_depth; + int color_type; ++ png_bytep trans_alpha = 0; ++ png_color_16p trans_color_p = 0; ++ int num_trans; ++ png_colorp palette = 0; ++ int num_palette; + png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, 0, 0, 0); + + if (color_type == PNG_COLOR_TYPE_GRAY) { + // Black & White or 8-bit grayscale +- if (bit_depth == 1 && info_ptr->channels == 1) { ++ if (bit_depth == 1 && png_get_channels(png_ptr, info_ptr) == 1) { + png_set_invert_mono(png_ptr); + png_read_update_info(png_ptr, info_ptr); + if (image.size() != QSize(width, height) || image.format() != QImage::Format_Mono) { +@@ -207,20 +217,16 @@ void setup_qt(QImage& image, png_structp png_ptr, png_infop info_ptr, float scre + int c = i*255/(ncols-1); + image.setColor(i, qRgba(c,c,c,0xff)); + } +- if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) { +-#if PNG_LIBPNG_VER_MAJOR < 1 || (PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR < 4) +- const int g = info_ptr->trans_values.gray; +-#else +- const int g = info_ptr->trans_color.gray; +-#endif ++ if (png_get_tRNS(png_ptr, info_ptr, &trans_alpha, &num_trans, &trans_color_p) && trans_color_p) { ++ const int g = trans_color_p->gray; + if (g < ncols) { + image.setColor(g, 0); + } + } + } + } else if (color_type == PNG_COLOR_TYPE_PALETTE +- && png_get_valid(png_ptr, info_ptr, PNG_INFO_PLTE) +- && info_ptr->num_palette <= 256) ++ && png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette) ++ && num_palette <= 256) + { + // 1-bit and 8-bit color + if (bit_depth != 1) +@@ -233,29 +239,26 @@ void setup_qt(QImage& image, png_structp png_ptr, png_infop info_ptr, float scre + if (image.isNull()) + return; + } +- image.setColorCount(info_ptr->num_palette); ++ png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette); ++ image.setColorCount(num_palette); + int i = 0; +- if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) { +- while (i < info_ptr->num_trans) { ++ if (png_get_tRNS(png_ptr, info_ptr, &trans_alpha, &num_trans, &trans_color_p) && trans_alpha) { ++ while (i < num_trans) { + image.setColor(i, qRgba( +- info_ptr->palette[i].red, +- info_ptr->palette[i].green, +- info_ptr->palette[i].blue, +-#if PNG_LIBPNG_VER_MAJOR < 1 || (PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR < 4) +- info_ptr->trans[i] +-#else +- info_ptr->trans_alpha[i] +-#endif ++ palette[i].red, ++ palette[i].green, ++ palette[i].blue, ++ trans_alpha[i] + ) + ); + i++; + } + } +- while (i < info_ptr->num_palette) { ++ while (i < num_palette) { + image.setColor(i, qRgba( +- info_ptr->palette[i].red, +- info_ptr->palette[i].green, +- info_ptr->palette[i].blue, ++ palette[i].red, ++ palette[i].green, ++ palette[i].blue, + 0xff + ) + ); +@@ -531,33 +534,36 @@ QImage::Format QPngHandlerPrivate::readImageFormat() + QImage::Format format = QImage::Format_Invalid; + png_uint_32 width, height; + int bit_depth, color_type; +- if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY) { ++ png_colorp palette; ++ int num_palette; ++ png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, 0, 0, 0); ++ if (color_type == PNG_COLOR_TYPE_GRAY) { + // Black & White or 8-bit grayscale +- if (info_ptr->bit_depth == 1 && info_ptr->channels == 1) { ++ if (bit_depth == 1 && png_get_channels(png_ptr, info_ptr) == 1) { + format = QImage::Format_Mono; +- } else if (info_ptr->bit_depth == 16 && png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) { ++ } else if (bit_depth == 16 && png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) { + format = QImage::Format_ARGB32; + } else { + format = QImage::Format_Indexed8; + } +- } else if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE +- && png_get_valid(png_ptr, info_ptr, PNG_INFO_PLTE) +- && info_ptr->num_palette <= 256) ++ } else if (color_type == PNG_COLOR_TYPE_PALETTE ++ && png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette) ++ && num_palette <= 256) + { + // 1-bit and 8-bit color +- if (info_ptr->bit_depth != 1) ++ if (bit_depth != 1) + png_set_packing(png_ptr); + png_read_update_info(png_ptr, info_ptr); + png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, 0, 0, 0); + format = bit_depth == 1 ? QImage::Format_Mono : QImage::Format_Indexed8; + } else { + // 32-bit +- if (info_ptr->bit_depth == 16) ++ if (bit_depth == 16) + png_set_strip_16(png_ptr); + + format = QImage::Format_ARGB32; + // Only add filler if no alpha, or we can get 5 channel data. +- if (!(info_ptr->color_type & PNG_COLOR_MASK_ALPHA) ++ if (!(color_type & PNG_COLOR_MASK_ALPHA) + && !png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) { + // We want 4 bytes, but it isn't an alpha channel + format = QImage::Format_RGB32; +@@ -648,7 +654,7 @@ static void set_text(const QImage &image, png_structp png_ptr, png_infop info_pt + text_ptr[i].text = qstrdup(value.constData()); + text_ptr[i].text_length = 0; + text_ptr[i].itxt_length = value.size(); +- text_ptr[i].lang = "UTF-8"; ++ text_ptr[i].lang = const_cast("UTF-8"); + text_ptr[i].lang_key = qstrdup(it.key().toUtf8().constData()); + #endif + ++i; +@@ -735,64 +741,51 @@ bool Q_INTERNAL_WIN_NO_THROW QPNGImageWriter::writeImage(const QImage& image_in, + png_set_compression_level(png_ptr, quality); + } + +- if (gamma != 0.0) { +- png_set_gAMA(png_ptr, info_ptr, 1.0/gamma); +- } +- + png_set_write_fn(png_ptr, (void*)this, qpiw_write_fn, qpiw_flush_fn); + +- info_ptr->channels = +- (image.depth() == 32) +- ? (image.format() == QImage::Format_RGB32 ? 3 : 4) +- : 1; +- + png_set_IHDR(png_ptr, info_ptr, image.width(), image.height(), + image.depth() == 1 ? 1 : 8 /* per channel */, + image.depth() == 32 + ? image.format() == QImage::Format_RGB32 + ? PNG_COLOR_TYPE_RGB + : PNG_COLOR_TYPE_RGB_ALPHA +- : PNG_COLOR_TYPE_PALETTE, 0, 0, 0); ++ : PNG_COLOR_TYPE_PALETTE, 0, 0, 0); // also sets #channels + ++ if (gamma != 0.0) { ++ png_set_gAMA(png_ptr, info_ptr, 1.0/gamma); ++ } + +- //png_set_sBIT(png_ptr, info_ptr, 8); +- info_ptr->sig_bit.red = 8; +- info_ptr->sig_bit.green = 8; +- info_ptr->sig_bit.blue = 8; ++ png_color_8 sig_bit; ++ sig_bit.red = 8; ++ sig_bit.green = 8; ++ sig_bit.blue = 8; ++ sig_bit.alpha = image.hasAlphaChannel() ? 8 : 0; ++ png_set_sBIT(png_ptr, info_ptr, &sig_bit); + + if (image.format() == QImage::Format_MonoLSB) + png_set_packswap(png_ptr); + +- png_colorp palette = 0; +- png_bytep copy_trans = 0; + if (image.colorCount()) { + // Paletted + int num_palette = image.colorCount(); +- palette = new png_color[num_palette]; +- png_set_PLTE(png_ptr, info_ptr, palette, num_palette); +- int* trans = new int[num_palette]; ++ png_color palette[num_palette]; ++ png_byte trans[num_palette]; + int num_trans = 0; + for (int i=0; ipalette[i].red = qRed(rgb); +- info_ptr->palette[i].green = qGreen(rgb); +- info_ptr->palette[i].blue = qBlue(rgb); +- trans[i] = rgb >> 24; ++ QRgb rgba=image.color(i); ++ palette[i].red = qRed(rgba); ++ palette[i].green = qGreen(rgba); ++ palette[i].blue = qBlue(rgba); ++ trans[i] = qAlpha(rgba); + if (trans[i] < 255) { + num_trans = i+1; + } + } ++ png_set_PLTE(png_ptr, info_ptr, palette, num_palette); ++ + if (num_trans) { +- copy_trans = new png_byte[num_trans]; +- for (int i=0; isig_bit.alpha = 8; + } + + // Swap ARGB to RGBA (normal PNG format) before saving on +@@ -868,11 +861,6 @@ bool Q_INTERNAL_WIN_NO_THROW QPNGImageWriter::writeImage(const QImage& image_in, + png_write_end(png_ptr, info_ptr); + frames_written++; + +- if (palette) +- delete [] palette; +- if (copy_trans) +- delete [] copy_trans; +- + png_destroy_write_struct(&png_ptr, &info_ptr); + + return true; +@@ -958,7 +946,8 @@ QVariant QPngHandler::option(ImageOption option) const + else if (option == Description) + return d->description; + else if (option == Size) +- return QSize(d->info_ptr->width, d->info_ptr->height); ++ return QSize(png_get_image_width(d->png_ptr, d->info_ptr), ++ png_get_image_height(d->png_ptr, d->info_ptr)); + else if (option == ImageFormat) + return d->readImageFormat(); + return 0; +-- +1.6.1 + diff --git a/x11-libs/qt-gui/qt-gui-4.6.3-r2.ebuild b/x11-libs/qt-gui/qt-gui-4.6.3-r2.ebuild index d223bb829cd4..4c3f36fc3fbd 100644 --- a/x11-libs/qt-gui/qt-gui-4.6.3-r2.ebuild +++ b/x11-libs/qt-gui/qt-gui-4.6.3-r2.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/x11-libs/qt-gui/qt-gui-4.6.3-r2.ebuild,v 1.5 2011/11/20 20:23:41 pesa Exp $ +# $Header: /var/cvsroot/gentoo-x86/x11-libs/qt-gui/qt-gui-4.6.3-r2.ebuild,v 1.6 2011/12/17 19:37:35 chithanh Exp $ EAPI="2" inherit confutils eutils qt4-build @@ -45,6 +45,8 @@ RDEPEND="${RDEPEND} " PDEPEND="qt3support? ( ~x11-libs/qt-qt3support-${PV}[aqua=,debug=] )" +PATCHES=( "${FILESDIR}/${PN}-4.6-libpng-1.5.patch" ) + pkg_setup() { if ! use qt3support; then ewarn "WARNING: if you need 'qtconfig', you _must_ enable qt3support." diff --git a/x11-libs/qt-gui/qt-gui-4.6.3.ebuild b/x11-libs/qt-gui/qt-gui-4.6.3.ebuild index 6cf8a3f0bde0..8ae24ee3e23e 100644 --- a/x11-libs/qt-gui/qt-gui-4.6.3.ebuild +++ b/x11-libs/qt-gui/qt-gui-4.6.3.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/x11-libs/qt-gui/qt-gui-4.6.3.ebuild,v 1.13 2011/11/20 20:23:41 pesa Exp $ +# $Header: /var/cvsroot/gentoo-x86/x11-libs/qt-gui/qt-gui-4.6.3.ebuild,v 1.14 2011/12/17 19:37:35 chithanh Exp $ EAPI="2" inherit confutils eutils qt4-build @@ -45,6 +45,8 @@ RDEPEND="${RDEPEND} " PDEPEND="qt3support? ( ~x11-libs/qt-qt3support-${PV}[aqua=,debug=] )" +PATCHES=( "${FILESDIR}/${PN}-4.6-libpng-1.5.patch" ) + pkg_setup() { if ! use qt3support; then ewarn "WARNING: if you need 'qtconfig', you _must_ enable qt3support." -- 2.26.2