commit:     4c1429c6ab888e6276a2c4d75602d76d12bcb168
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Sun Sep  2 14:19:15 2018 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Sun Sep  2 14:19:15 2018 +0000
URL:        https://gitweb.gentoo.org/repo/proj/emacs.git/commit/?id=4c1429c6

app-editors/emacs: Fix support for >=media-gfx/imagemagick-7.

Package-Manager: Portage-2.3.48, Repoman-2.3.10

 .../{emacs-24.3-r7.ebuild => emacs-24.3-r8.ebuild} |   3 +-
 .../emacs/files/emacs-24.3-imagemagick-7.patch     | 102 +++++++++++++++++++++
 2 files changed, 104 insertions(+), 1 deletion(-)

diff --git a/app-editors/emacs/emacs-24.3-r7.ebuild 
b/app-editors/emacs/emacs-24.3-r8.ebuild
similarity index 99%
rename from app-editors/emacs/emacs-24.3-r7.ebuild
rename to app-editors/emacs/emacs-24.3-r8.ebuild
index ed89687..e0b48c1 100644
--- a/app-editors/emacs/emacs-24.3-r7.ebuild
+++ b/app-editors/emacs/emacs-24.3-r8.ebuild
@@ -117,7 +117,8 @@ src_prepare() {
                ../patch-24.5/08_all_enriched-mode.patch \
                "${FILESDIR}"/${P}-jpeg-version.patch \
                "${FILESDIR}"/${P}-giflib-5.patch \
-               "${FILESDIR}"/${P}-data-start.patch
+               "${FILESDIR}"/${P}-data-start.patch \
+               "${FILESDIR}"/${P}-imagemagick-7.patch
        eapply_user
 
        # Fix filename reference in redirected man page

diff --git a/app-editors/emacs/files/emacs-24.3-imagemagick-7.patch 
b/app-editors/emacs/files/emacs-24.3-imagemagick-7.patch
new file mode 100644
index 0000000..6c6d6ba
--- /dev/null
+++ b/app-editors/emacs/files/emacs-24.3-imagemagick-7.patch
@@ -0,0 +1,102 @@
+Support ImageMagick version 7.
+https://bugs.gentoo.org/665058
+https://debbugs.gnu.org/25967
+
+This backports and consolidates the following commits from upstream git:
+
+commit 3cc42bb60099c32f64e57d2ee33c8321adba7942
+Author: Glenn Morris <[email protected]>
+Date:   Thu Aug 30 13:56:08 2018 -0400
+
+    * configure.ac: Fix goofs in my recent ImageMagick change.
+
+commit 42ed35c68b7c199aa797e655fdc3547c5c3087d2
+Author: Paul Eggert <[email protected]>
+Date:   Thu Aug 30 10:03:43 2018 -0700
+
+    Pacify -Wdouble-promotion in ImageMagick code
+
+commit bf1b147b55e1328efca6e40181e79dd9a369895d
+Author: Glenn Morris <[email protected]>
+Date:   Mon Aug 27 22:03:25 2018 -0400
+
+    * configure.ac, src/image.c: Tweak previous ImageMagick change.
+
+commit 5729486951e6a60db55ea17ee3bac9baf8b54f6a
+Author: Karl Otness <[email protected]>
+Date:   Mon Aug 27 21:57:44 2018 -0400
+
+    Support ImageMagick version 7 (bug#25967)
+
+commit 686b520ff9ae25f9fa293a92e65b9331e192d142
+Author: Andreas Schwab <[email protected]>
+Date:   Sun Jul 10 20:18:44 2016 +0200
+
+    Fix memory leak in imagemagick-types
+
+--- emacs-24.3-orig/configure.ac
++++ emacs-24.3/configure.ac
+@@ -1846,11 +1846,14 @@
+ HAVE_IMAGEMAGICK=no
+ if test "${HAVE_X11}" = "yes"; then
+   if test "${with_imagemagick}" != "no"; then
+-    ## 6.2.8 is the earliest version known to work, but earlier versions
+-    ## might work - let us know if you find one.
+-    ## 6.0.7 does not work.  See bug#7955.
+-    IMAGEMAGICK_MODULE="Wand >= 6.2.8"
+-    PKG_CHECK_MODULES(IMAGEMAGICK, $IMAGEMAGICK_MODULE, HAVE_IMAGEMAGICK=yes, 
:)
++    PKG_CHECK_MODULES(IMAGEMAGICK, MagickWand >= 7, HAVE_IMAGEMAGICK=yes, :)
++    if test $HAVE_IMAGEMAGICK = yes; then
++       AC_DEFINE([HAVE_IMAGEMAGICK7], 1, [Define to 1 if using ImageMagick7.])
++    else
++       ## 6.3.5 is the earliest version known to work; see Bug#17339.
++       ## 6.8.2 makes Emacs crash; see Bug#13867.
++       PKG_CHECK_MODULES(IMAGEMAGICK, Wand >= 6.3.5 Wand != 6.8.2, 
HAVE_IMAGEMAGICK=yes, :)
++    fi
+     AC_SUBST(IMAGEMAGICK_CFLAGS)
+     AC_SUBST(IMAGEMAGICK_LIBS)
+ 
+--- emacs-24.3-orig/src/image.c
++++ emacs-24.3/src/image.c
+@@ -7620,11 +7620,20 @@
+ /* The GIF library also defines DrawRectangle, but its never used in Emacs.
+    Therefore rename the function so it doesn't collide with ImageMagick.  */
+ #define DrawRectangle DrawRectangleGif
+-#include <wand/MagickWand.h>
++
++#ifdef HAVE_IMAGEMAGICK7
++# include <MagickWand/MagickWand.h>
++# include <MagickCore/version.h>
++/* ImageMagick 7 compatibility definitions.  */
++# define PixelSetMagickColor PixelSetPixelColor
++typedef PixelInfo MagickPixelPacket;
++#else
++# include <wand/MagickWand.h>
++# include <magick/version.h>
++#endif
+ 
+ /* ImageMagick 6.5.3 through 6.6.5 hid PixelGetMagickColor for some reason.
+    Emacs seems to work fine with the hidden version, so unhide it.  */
+-#include <magick/version.h>
+ #if 0x653 <= MagickLibVersion && MagickLibVersion <= 0x665
+ extern WandExport void PixelGetMagickColor (const PixelWand *,
+                                           MagickPixelPacket *);
+@@ -8053,14 +8062,14 @@
+ {
+   Lisp_Object typelist = Qnil;
+   size_t numf = 0;
+-  ExceptionInfo ex;
++  ExceptionInfo *ex;
+   char **imtypes;
+   size_t i;
+   Lisp_Object Qimagemagicktype;
+ 
+-  GetExceptionInfo(&ex);
+-  imtypes = GetMagickList ("*", &numf, &ex);
+-  DestroyExceptionInfo(&ex);
++  ex = AcquireExceptionInfo ();
++  imtypes = GetMagickList ("*", &numf, ex);
++  DestroyExceptionInfo (ex);
+ 
+   for (i = 0; i < numf; i++)
+     {

Reply via email to