From c6d0ed89ad5653421f21cbf3b3d40fd9a1361828 Mon Sep 17 00:00:00 2001 From: Pacho Ramos Date: Sun, 9 Oct 2016 13:05:30 +0200 Subject: [PATCH] media-libs/imlib: Fix giflib-5.1 support (#538976), pkgconfig file (#499268), dependencies and bump eapi. Package-Manager: portage-2.3.1 --- .../imlib/files/imlib-1.9.15-asneeded.patch | 4 +- .../imlib-1.9.15-bpp16-CVE-2007-3568.patch | 4 +- .../imlib/files/imlib-1.9.15-giflib51-1.patch | 122 ++++++++++++++++++ .../imlib/files/imlib-1.9.15-giflib51-2.patch | 107 +++++++++++++++ .../imlib/files/imlib-1.9.15-libpng15.patch | 16 +-- .../imlib/files/imlib-1.9.15-linking.patch | 9 ++ media-libs/imlib/imlib-1.9.15-r5.ebuild | 73 +++++++++++ 7 files changed, 323 insertions(+), 12 deletions(-) create mode 100644 media-libs/imlib/files/imlib-1.9.15-giflib51-1.patch create mode 100644 media-libs/imlib/files/imlib-1.9.15-giflib51-2.patch create mode 100644 media-libs/imlib/files/imlib-1.9.15-linking.patch create mode 100644 media-libs/imlib/imlib-1.9.15-r5.ebuild diff --git a/media-libs/imlib/files/imlib-1.9.15-asneeded.patch b/media-libs/imlib/files/imlib-1.9.15-asneeded.patch index 3b7dd8a8bbca..d9ccde7bdfcd 100644 --- a/media-libs/imlib/files/imlib-1.9.15-asneeded.patch +++ b/media-libs/imlib/files/imlib-1.9.15-asneeded.patch @@ -4,8 +4,8 @@ an error... Adding include is necessary for gcc-4.3. ---- configure.in 2008-07-16 09:18:35 +0000 -+++ configure.in 2008-07-16 09:18:43 +0000 +--- a/configure.in 2008-07-16 09:18:35 +0000 ++++ b/configure.in 2008-07-16 09:18:43 +0000 @@ -61,6 +61,7 @@ AC_TRY_RUN([ #include diff --git a/media-libs/imlib/files/imlib-1.9.15-bpp16-CVE-2007-3568.patch b/media-libs/imlib/files/imlib-1.9.15-bpp16-CVE-2007-3568.patch index 94595ffdf55a..308f9abc044d 100644 --- a/media-libs/imlib/files/imlib-1.9.15-bpp16-CVE-2007-3568.patch +++ b/media-libs/imlib/files/imlib-1.9.15-bpp16-CVE-2007-3568.patch @@ -1,5 +1,5 @@ ---- Imlib/load.c.orig 2007-08-13 23:06:20.000000000 -0300 -+++ Imlib/load.c 2007-08-13 23:06:51.000000000 -0300 +--- a/Imlib/load.c.orig 2007-08-13 23:06:20.000000000 -0300 ++++ b/Imlib/load.c 2007-08-13 23:06:51.000000000 -0300 @@ -645,7 +645,7 @@ planes = (int)word; fread(&word, 2, 1, file); diff --git a/media-libs/imlib/files/imlib-1.9.15-giflib51-1.patch b/media-libs/imlib/files/imlib-1.9.15-giflib51-1.patch new file mode 100644 index 000000000000..d0e3ac7d8d2c --- /dev/null +++ b/media-libs/imlib/files/imlib-1.9.15-giflib51-1.patch @@ -0,0 +1,122 @@ +diff -Nru imlib-1.9.15.old/gdk_imlib/io-gif.c imlib-1.9.15/gdk_imlib/io-gif.c +--- imlib-1.9.15.old/gdk_imlib/io-gif.c 2014-05-28 13:54:48.860293627 +0100 ++++ imlib-1.9.15/gdk_imlib/io-gif.c 2014-05-28 13:58:29.992185729 +0100 +@@ -1,8 +1,10 @@ + #include + #include "gdk_imlib.h" + #include "gdk_imlib_private.h" ++#include + + #ifndef HAVE_LIBGIF ++/*------------------------*/ + unsigned char loader_gif (FILE *f, int *w, int *h, int *t) + { + return NULL; +@@ -43,14 +45,14 @@ + { + if (DGifGetRecordType(gif, &rec) == GIF_ERROR) + { +- PrintGifError(); ++ _PrintGifError(gif); + rec = TERMINATE_RECORD_TYPE; + } + if ((rec == IMAGE_DESC_RECORD_TYPE) && (!done)) + { + if (DGifGetImageDesc(gif) == GIF_ERROR) + { +- PrintGifError(); ++ _PrintGifError(gif); + rec = TERMINATE_RECORD_TYPE; + } + *w = gif->Image.Width; +diff -Nru imlib-1.9.15.old/gifutil.h imlib-1.9.15/gifutil.h +--- imlib-1.9.15.old/gifutil.h 1970-01-01 01:00:00.000000000 +0100 ++++ imlib-1.9.15/gifutil.h 2014-05-28 13:57:45.019424755 +0100 +@@ -0,0 +1,26 @@ ++#ifndef __GIFUTIL_H__ ++#define __GIFUTIL_H__ ++ ++static void ++_PrintGifError(GifFileType *gif) ++{ ++ /* GIFLIB_MAJOR is only defined in libgif >= 4.2.0 */ ++ /* libgif 4.2.0 has retired PrintGifError() and added GifErrorString() */ ++#if defined(GIFLIB_MAJOR) && defined(GIFLIB_MINOR) && \ ++ ((GIFLIB_MAJOR == 4 && GIFLIB_MINOR >= 2) || GIFLIB_MAJOR > 4) ++ /* Static string actually, hence the const char* cast */ ++ ++#if GIFLIB_MAJOR >= 5 ++ const char* gifliberr = (const char*) GifErrorString(gif->Error); ++#else ++ const char* gifliberr = (const char*) GifErrorString(); ++#endif ++ if (gifliberr == NULL) ++ gifliberr = "Unknown error"; ++ fprintf(stderr, "%s\n", gifliberr); ++#else ++ PrintGifError(); ++#endif ++} ++ ++#endif +diff -Nru imlib-1.9.15.old/Imlib/load.c imlib-1.9.15/Imlib/load.c +--- imlib-1.9.15.old/Imlib/load.c 2014-05-28 13:54:49.008295568 +0100 ++++ imlib-1.9.15/Imlib/load.c 2014-05-28 14:00:21.321983945 +0100 +@@ -3,6 +3,7 @@ + #include "Imlib.h" + #include "Imlib_private.h" + #include ++#include + + #define G_MAXINT ((int) 0x7fffffff) + +@@ -431,6 +432,8 @@ + #endif /* HAVE_LIBTIFF */ + + #ifdef HAVE_LIBGIF ++/*------------------------*/ ++/*------------------------*/ + unsigned char * + _LoadGIF(ImlibData * id, FILE *f, int *w, int *h, int *t) + { +@@ -454,22 +457,38 @@ + fd = fileno(f); + /* Apparently rewind(f) isn't sufficient */ + lseek(fd, (long) 0, 0); ++ ++#if GIFLIB_MAJOR >= 5 ++ int errCode = 0; ++ ++ gif = DGifOpenFileHandle(fd, &errCode); ++ if (!gif) ++ { ++ const char* gifliberr = (const char*) GifErrorString(errCode); ++ if (gifliberr == NULL) ++ gifliberr = "Unknown error"; ++ fprintf(stderr, "%s\n", gifliberr); ++ return NULL; ++ } ++#else + gif = DGifOpenFileHandle(fd); + + if (!gif) + return NULL; ++#endif ++ + do + { + if (DGifGetRecordType(gif, &rec) == GIF_ERROR) + { +- PrintGifError(); ++ _PrintGifError(gif); + rec = TERMINATE_RECORD_TYPE; + } + if ((rec == IMAGE_DESC_RECORD_TYPE) && (!done)) + { + if (DGifGetImageDesc(gif) == GIF_ERROR) + { +- PrintGifError(); ++ _PrintGifError(gif); + rec = TERMINATE_RECORD_TYPE; + } + *w = gif->Image.Width; diff --git a/media-libs/imlib/files/imlib-1.9.15-giflib51-2.patch b/media-libs/imlib/files/imlib-1.9.15-giflib51-2.patch new file mode 100644 index 000000000000..7911e7c7e40d --- /dev/null +++ b/media-libs/imlib/files/imlib-1.9.15-giflib51-2.patch @@ -0,0 +1,107 @@ +diff -Nru imlib-1.9.15.old/gifutil.h imlib-1.9.15/gifutil.h +--- imlib-1.9.15.old/gifutil.h 2015-02-03 00:53:09.742075193 +0000 ++++ imlib-1.9.15/gifutil.h 2015-02-05 19:24:09.848783163 +0000 +@@ -2,7 +2,7 @@ + #define __GIFUTIL_H__ + + static void +-_PrintGifError(GifFileType *gif) ++_PrintGifError(int errorCode) + { + /* GIFLIB_MAJOR is only defined in libgif >= 4.2.0 */ + /* libgif 4.2.0 has retired PrintGifError() and added GifErrorString() */ +@@ -11,7 +11,7 @@ + /* Static string actually, hence the const char* cast */ + + #if GIFLIB_MAJOR >= 5 +- const char* gifliberr = (const char*) GifErrorString(gif->Error); ++ const char* gifliberr = (const char*) GifErrorString(errorCode); + #else + const char* gifliberr = (const char*) GifErrorString(); + #endif +diff -Nru imlib-1.9.15.old/Imlib/load.c imlib-1.9.15/Imlib/load.c +--- imlib-1.9.15.old/Imlib/load.c 2015-02-03 00:53:09.742075193 +0000 ++++ imlib-1.9.15/Imlib/load.c 2015-02-05 19:30:12.847147998 +0000 +@@ -434,6 +434,19 @@ + #ifdef HAVE_LIBGIF + /*------------------------*/ + /*------------------------*/ ++void ++_CloseGIF(GifFileType *gif) ++{ ++#if GIFLIB_MAJOR > 5 || (GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1) ++ int errCode = 0; ++ ++ if (DGifCloseFile(gif, &errCode) != GIF_OK) ++ _PrintGifError(errCode); ++#else ++ DGifCloseFile(gif); ++#endif ++} ++ + unsigned char * + _LoadGIF(ImlibData * id, FILE *f, int *w, int *h, int *t) + { +@@ -464,10 +477,7 @@ + gif = DGifOpenFileHandle(fd, &errCode); + if (!gif) + { +- const char* gifliberr = (const char*) GifErrorString(errCode); +- if (gifliberr == NULL) +- gifliberr = "Unknown error"; +- fprintf(stderr, "%s\n", gifliberr); ++ _PrintGifError(errCode); + return NULL; + } + #else +@@ -481,14 +491,14 @@ + { + if (DGifGetRecordType(gif, &rec) == GIF_ERROR) + { +- _PrintGifError(gif); ++ _PrintGifError(gif->Error); + rec = TERMINATE_RECORD_TYPE; + } + if ((rec == IMAGE_DESC_RECORD_TYPE) && (!done)) + { + if (DGifGetImageDesc(gif) == GIF_ERROR) + { +- _PrintGifError(gif); ++ _PrintGifError(gif->Error); + rec = TERMINATE_RECORD_TYPE; + } + *w = gif->Image.Width; +@@ -500,13 +510,13 @@ + rows = malloc(*h * sizeof(GifRowType *)); + if (!rows) + { +- DGifCloseFile(gif); ++ _CloseGIF(gif); + return NULL; + } + data = _imlib_malloc_image(*w, *h); + if (!data) + { +- DGifCloseFile(gif); ++ _CloseGIF(gif); + free(rows); + return NULL; + } +@@ -517,7 +527,7 @@ + rows[i] = malloc(*w * sizeof(GifPixelType)); + if (!rows[i]) + { +- DGifCloseFile(gif); ++ _CloseGIF(gif); + for (i = 0; i < *h; i++) + if (rows[i]) + free(rows[i]); +@@ -606,7 +616,7 @@ + } + } + } +- DGifCloseFile(gif); ++ _CloseGIF(gif); + for (i = 0; i < *h; i++) + free(rows[i]); + free(rows); diff --git a/media-libs/imlib/files/imlib-1.9.15-libpng15.patch b/media-libs/imlib/files/imlib-1.9.15-libpng15.patch index 7837cd488cf2..353960897f1c 100644 --- a/media-libs/imlib/files/imlib-1.9.15-libpng15.patch +++ b/media-libs/imlib/files/imlib-1.9.15-libpng15.patch @@ -1,5 +1,5 @@ ---- gdk_imlib/io-png.c -+++ gdk_imlib/io-png.c +--- a/gdk_imlib/io-png.c ++++ b/gdk_imlib/io-png.c @@ -40,13 +40,13 @@ return NULL; } @@ -67,8 +67,8 @@ { fclose(f); png_destroy_write_struct(&png_ptr, (png_infopp) NULL); ---- Imlib/load.c -+++ Imlib/load.c +--- a/Imlib/load.c ++++ b/Imlib/load.c @@ -197,12 +197,12 @@ png_destroy_read_struct(&png_ptr, NULL, NULL); return NULL; @@ -110,8 +110,8 @@ else { for (y = 0; y < *h; y++) ---- Imlib/save.c -+++ Imlib/save.c +--- a/Imlib/save.c ++++ b/Imlib/save.c @@ -342,7 +342,7 @@ png_destroy_write_struct(&png_ptr, (png_infopp) NULL); return 0; @@ -121,8 +121,8 @@ { fclose(f); png_destroy_write_struct(&png_ptr, (png_infopp) NULL); ---- Imlib/utils.c -+++ Imlib/utils.c +--- a/Imlib/utils.c ++++ b/Imlib/utils.c @@ -1981,14 +1981,13 @@ png_destroy_read_struct(&png_ptr, NULL, NULL); return NULL; diff --git a/media-libs/imlib/files/imlib-1.9.15-linking.patch b/media-libs/imlib/files/imlib-1.9.15-linking.patch new file mode 100644 index 000000000000..a00b089f4126 --- /dev/null +++ b/media-libs/imlib/files/imlib-1.9.15-linking.patch @@ -0,0 +1,9 @@ +gentoo bug #499268 +--- a/Imlib/Makefile.am ++++ b/Imlib/Makefile.am +@@ -43,4 +43,4 @@ + + check_PROGRAMS = t-load + +-t_load_LDADD = libImlib.la ++t_load_LDADD = libImlib.la -lX11 diff --git a/media-libs/imlib/imlib-1.9.15-r5.ebuild b/media-libs/imlib/imlib-1.9.15-r5.ebuild new file mode 100644 index 000000000000..89c1968a35d5 --- /dev/null +++ b/media-libs/imlib/imlib-1.9.15-r5.ebuild @@ -0,0 +1,73 @@ +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=6 +inherit autotools multilib-minimal + +PVP=(${PV//[-\._]/ }) +DESCRIPTION="Image loading and rendering library" +HOMEPAGE="http://ftp.acc.umu.se/pub/GNOME/sources/imlib/1.9/" +SRC_URI="mirror://gnome/sources/${PN}/${PVP[0]}.${PVP[1]}/${P}.tar.bz2 + mirror://gentoo/gtk-1-for-imlib.m4.bz2" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc ~x86 ~x86-fbsd" +IUSE="doc static-libs" + +RDEPEND=" + >=media-libs/tiff-3.9.7-r1:0[${MULTILIB_USEDEP}] + >=media-libs/giflib-5.1:0=[${MULTILIB_USEDEP}] + >=media-libs/libpng-1.2.51:0=[${MULTILIB_USEDEP}] + >=virtual/jpeg-0-r2:0[${MULTILIB_USEDEP}] + >=x11-libs/libICE-1.0.8-r1[${MULTILIB_USEDEP}] + >=x11-libs/libSM-1.2.1-r1[${MULTILIB_USEDEP}] + >=x11-libs/libXext-1.3.2[${MULTILIB_USEDEP}] +" +DEPEND="${RDEPEND}" + +src_prepare() { + default + + # Fix aclocal underquoted definition warnings. + # Conditionalize gdk functions for bug 40453. + # Fix imlib-config for bug 3425. + eapply "${FILESDIR}"/${P}.patch + eapply "${FILESDIR}"/${PN}-security.patch #security #72681 + eapply "${FILESDIR}"/${P}-bpp16-CVE-2007-3568.patch # security #201887 + eapply "${FILESDIR}"/${P}-fix-rendering.patch #197489 + eapply "${FILESDIR}"/${P}-asneeded.patch #207638 + eapply "${FILESDIR}"/${P}-libpng15.patch #357167 + eapply "${FILESDIR}"/${P}-underlinking-test.patch #367645 + eapply "${FILESDIR}"/${P}-no-LDFLAGS-in-pc.patch + eapply "${FILESDIR}"/${P}-giflib51-{1,2}.patch #538976 + + mkdir m4 && cp "${WORKDIR}"/gtk-1-for-imlib.m4 m4 + + AT_M4DIR="m4" eautoreconf +} + +multilib_src_configure() { + ECONF_SOURCE="${S}" econf \ + --sysconfdir=/etc/imlib \ + $(use_enable static-libs static) \ + --disable-gdk \ + --disable-gtktest +} + +multilib_src_install() { + emake DESTDIR="${D}" install + # fix target=@gdk-target@ in pkgconfig, bug #499268 + sed -e '/^target=/d' \ + -i "${ED}"usr/$(get_libdir)/pkgconfig/imlib.pc || die +} + +multilib_src_install_all() { + einstalldocs + use doc && dohtml doc/* + + # Punt unused files + rm -f "${D}"/usr/lib*/pkgconfig/imlibgdk.pc + find "${D}" -name '*.la' -exec rm -f {} + || die +} -- 2.26.2