commit:     866dfcae6b4f3ae8d4af7ac5f687e24ee10589d1
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 17 02:14:11 2016 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Sun Jan 17 02:14:11 2016 +0000
URL:        https://gitweb.gentoo.org/proj/emacs-tools.git/commit/?id=866dfcae

Fix compilation of Emacs 23.4 with giflib-5.

 emacs/23.4/26_all_giflib-5.patch | 150 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 150 insertions(+)

diff --git a/emacs/23.4/26_all_giflib-5.patch b/emacs/23.4/26_all_giflib-5.patch
new file mode 100644
index 0000000..b3b4ed0
--- /dev/null
+++ b/emacs/23.4/26_all_giflib-5.patch
@@ -0,0 +1,150 @@
+Fix compilation with giflib-5.
+Backported from Emacs 24, comprises parts of the following commits:
+
+commit be316ede5fffb724852ee225489e70778d240bb0
+Author: Paul Eggert <egg...@cs.ucla.edu>
+Date:   Tue Jan 7 13:14:32 2014 -0800
+
+    Fix misdisplay of interlaced GIFs with libgif5.
+
+commit f3606ef766bcec86789316a05949f1e67a51e7c1
+Author: Barry Fishman <barry_fish...@acm.org>
+Date:   Wed Oct 9 20:37:44 2013 -0400
+
+    Handle giflib 5 changes (tiny change)
+
+--- emacs-23.4-orig/configure.in
++++ emacs-23.4/configure.in
+@@ -2226,8 +2226,9 @@
+ if test "${HAVE_X11}" = "yes" && test "${with_gif}" != "no"; then
+   AC_CHECK_HEADER(gif_lib.h,
+ # EGifPutExtensionLast only exists from version libungif-4.1.0b1.
+-# Earlier versions can crash Emacs.
+-    [AC_CHECK_LIB(gif, EGifPutExtensionLast, HAVE_GIF=yes, try_libungif=yes)])
++# Earlier versions can crash Emacs, but version 5.0 removes 
EGifPutExtensionLast.
++    [AC_CHECK_LIB(gif, GifMakeMapObject, HAVE_GIF=yes,
++        [AC_CHECK_LIB(gif, EGifPutExtensionLast, HAVE_GIF=yes, 
try_libungif=yes)])])
+ 
+   if test "$HAVE_GIF" = yes; then
+       ac_gif_lib_name="-lgif"
+--- emacs-23.4-orig/src/image.c
++++ emacs-23.4/src/image.c
+@@ -7244,6 +7244,13 @@
+ 
+ #endif /* HAVE_NTGUI */
+ 
++/* Giflib before 5.0 didn't define these macros.  */
++#ifndef GIFLIB_MAJOR
++#define GIFLIB_MAJOR 0
++#endif
++#ifndef GIFLIB_MINOR
++#define GIFLIB_MINOR 0
++#endif
+ 
+ #ifdef HAVE_NTGUI
+ 
+@@ -7350,7 +7357,11 @@
+       }
+ 
+       /* Open the GIF file.  */
++#if GIFLIB_MAJOR < 5
+       gif = fn_DGifOpenFileName (SDATA (file));
++#else
++      gif = fn_DGifOpenFileName (SDATA (file), NULL);
++#endif
+       if (gif == NULL)
+       {
+         image_error ("Cannot open `%s'", file, Qnil);
+@@ -7366,7 +7377,11 @@
+       memsrc.len = SBYTES (specified_data);
+       memsrc.index = 0;
+ 
++#if GIFLIB_MAJOR < 5
+       gif = fn_DGifOpen (&memsrc, gif_read_from_memory);
++#else
++      gif = fn_DGifOpen (&memsrc, gif_read_from_memory, NULL);
++#endif
+       if (!gif)
+       {
+         image_error ("Cannot open memory source `%s'", img->spec, Qnil);
+@@ -7379,7 +7394,11 @@
+   if (!check_image_size (f, gif->SWidth, gif->SHeight))
+     {
+       image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil);
++#if GIFLIB_MAJOR < 5 || (GIFLIB_MAJOR == 5 && GIFLIB_MINOR == 0)
+       fn_DGifCloseFile (gif);
++#else
++      fn_DGifCloseFile (gif, NULL);
++#endif
+       UNGCPRO;
+       return 0;
+     }
+@@ -7389,7 +7408,11 @@
+   if (rc == GIF_ERROR)
+     {
+       image_error ("Error reading `%s'", img->spec, Qnil);
++#if GIFLIB_MAJOR < 5 || (GIFLIB_MAJOR == 5 && GIFLIB_MINOR == 0)
+       fn_DGifCloseFile (gif);
++#else
++      fn_DGifCloseFile (gif, NULL);
++#endif
+       UNGCPRO;
+       return 0;
+     }
+@@ -7400,7 +7423,11 @@
+     {
+       image_error ("Invalid image number `%s' in image `%s'",
+                  image, img->spec);
++#if GIFLIB_MAJOR < 5 || (GIFLIB_MAJOR == 5 && GIFLIB_MINOR == 0)
+       fn_DGifCloseFile (gif);
++#else
++      fn_DGifCloseFile (gif, NULL);
++#endif
+       UNGCPRO;
+       return 0;
+     }
+@@ -7422,7 +7449,11 @@
+   if (!check_image_size (f, width, height))
+     {
+       image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil);
++#if GIFLIB_MAJOR < 5 || (GIFLIB_MAJOR == 5 && GIFLIB_MINOR == 0)
+       fn_DGifCloseFile (gif);
++#else
++      fn_DGifCloseFile (gif, NULL);
++#endif
+       UNGCPRO;
+       return 0;
+     }
+@@ -7430,7 +7461,11 @@
+   /* Create the X image and pixmap.  */
+   if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap))
+     {
++#if GIFLIB_MAJOR < 5 || (GIFLIB_MAJOR == 5 && GIFLIB_MINOR == 0)
+       fn_DGifCloseFile (gif);
++#else
++      fn_DGifCloseFile (gif, NULL);
++#endif
+       UNGCPRO;
+       return 0;
+     }
+@@ -7482,7 +7517,7 @@
+      problems with bytes >= 0x80.  */
+   raster = (unsigned char *) gif->SavedImages[ino].RasterBits;
+ 
+-  if (gif->SavedImages[ino].ImageDesc.Interlace)
++  if (GIFLIB_MAJOR < 5 && gif->SavedImages[ino].ImageDesc.Interlace)
+     {
+       int pass;
+       int row = interlace_start[0];
+@@ -7537,7 +7572,11 @@
+                               Fcons (make_number (gif->ImageCount),
+                                      img->data.lisp_val));
+ 
++#if GIFLIB_MAJOR < 5 || (GIFLIB_MAJOR == 5 && GIFLIB_MINOR == 0)
+   fn_DGifCloseFile (gif);
++#else
++  fn_DGifCloseFile (gif, NULL);
++#endif
+ 
+   /* Maybe fill in the background field while we have ximg handy. */
+   if (NILP (image_spec_value (img->spec, QCbackground, NULL)))

Reply via email to