KDE-4.10: Kopete: fix build against giflib5

This commit is contained in:
Evgeny Egorochkin 2013-12-08 12:04:02 +02:00
parent 4d33a94fae
commit c5005bfe11
2 changed files with 71 additions and 0 deletions

View File

@ -0,0 +1,70 @@
Index: b/kopete/protocols/wlm/wlmchatsession.cpp
===================================================================
--- a/kopete/protocols/wlm/wlmchatsession.cpp
+++ b/kopete/protocols/wlm/wlmchatsession.cpp
@@ -63,10 +63,14 @@
#include "wlmprotocol.h"
#include "wlmaccount.h"
#include "wlmchatsessioninkaction.h"
#ifdef HAVE_GIFLIB
#include <gif_lib.h>
+/* old giflib has no GIFLIB_MAJOR, define to avoid cpp warnings */
+#ifndef GIFLIB_MAJOR
+#define GIFLIB_MAJOR 4
+#endif
#endif
WlmChatSession::WlmChatSession (Kopete::Protocol * protocol,
const Kopete::Contact * user,
Kopete::ContactPtrList others,
@@ -465,15 +469,19 @@ WlmChatSession::slotInviteContact (Kopet
static void
printGifErrorMessage()
{
#ifdef HAVE_GIFLIB
#ifdef HAVE_GIF_ERROR_STRING // giflib 4.2.0+
+#if GIFLIB_MAJOR >= 5
+ fprintf(stderr, "GIF-LIB error (exact reporting not implemented)\n");
+#else
const char * errorString = GifErrorString();
if (errorString)
fprintf(stderr, "GIF-LIB error: %s\n", errorString);
else
fprintf(stderr, "GIF-LIB undefined error: %d\n", GifError());
+#endif
#else // older giflib versions, libungif
PrintGifError();
#endif // HAVE_GIF_ERROR_STRING
#endif // HAVE_GIFLIB
}
@@ -481,10 +489,14 @@ printGifErrorMessage()
/* stolen from kpaint write_to_gif() */
void
WlmChatSession::convertToGif( const QPixmap & ink, QString filename)
{
#ifdef HAVE_GIFLIB
+#if GIFLIB_MAJOR >= 5
+#define FreeMapObject GifFreeMapObject
+#define MakeMapObject GifMakeMapObject
+#endif
int i, status;
GifFileType *GifFile;
ColorMapObject *screenColourmap;
ColorMapObject *imageColourmap;
QImage img = ink.toImage().convertToFormat(QImage::Format_Indexed8);
@@ -523,11 +535,15 @@ WlmChatSession::convertToGif( const QPix
screenColourmap->Colors[i].Green= 0;
screenColourmap->Colors[i].Blue= 0;
}
}
+#if GIFLIB_MAJOR >= 5
+ GifFile= EGifOpenFileName(QFile::encodeName(filename).constData(), 0, NULL);
+#else
GifFile= EGifOpenFileName(QFile::encodeName(filename).constData(), 0);
+#endif
if (!GifFile) {
FreeMapObject(imageColourmap);
FreeMapObject(screenColourmap);
return;
}

View File

@ -20,6 +20,7 @@ kde {
cp -v ${./FindmsiLBC.cmake} kopete/cmake/modules/FindmsiLBC.cmake
patch -p1 < ${./kopete-4.10.4-kopete-linphonemediaengine.patch}
patch -p1 < ${./kopete-4.10.4-kopete-stun.patch}
patch -p1 < ${./kopete-giflib5.patch}
'';
cmakeFlags = [ "-DBUILD_skypebuttons=TRUE" ];