libgdiplus: fix build against giflib 5.*
This commit is contained in:
parent
e12695ba85
commit
8c5c4eab54
@ -10,11 +10,14 @@ stdenv.mkDerivation rec {
|
|||||||
sha256 = "0klnbly2q0yx5p0l5z8da9lhqsjj9xqj06kdw2v7rnms4z1vdpkd";
|
sha256 = "0klnbly2q0yx5p0l5z8da9lhqsjj9xqj06kdw2v7rnms4z1vdpkd";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
NIX_LDFLAGS = "-lgif";
|
||||||
|
|
||||||
patches =
|
patches =
|
||||||
[ (fetchurl {
|
[ (fetchurl {
|
||||||
url = "https://raw.github.com/MagicGroup/MagicSpecLib/master/libgdiplus/libgdiplus-2.10.1-libpng15.patch";
|
url = "https://raw.github.com/MagicGroup/MagicSpecLib/master/libgdiplus/libgdiplus-2.10.1-libpng15.patch";
|
||||||
sha256 = "130r0jm065pjvbz5dkx96w37vj1wqc8fakmi2znribs14g0bl65f";
|
sha256 = "130r0jm065pjvbz5dkx96w37vj1wqc8fakmi2znribs14g0bl65f";
|
||||||
})
|
})
|
||||||
|
./giflib.patch
|
||||||
];
|
];
|
||||||
|
|
||||||
patchFlags = "-p0";
|
patchFlags = "-p0";
|
||||||
|
117
pkgs/development/libraries/libgdiplus/giflib.patch
Normal file
117
pkgs/development/libraries/libgdiplus/giflib.patch
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
diff --git a/src/gifcodec.c b/src/gifcodec.c
|
||||||
|
index 8dee0eb..564beed 100644
|
||||||
|
--- src/gifcodec.c
|
||||||
|
+++ src/gifcodec.c
|
||||||
|
@@ -39,8 +39,10 @@ GUID gdip_gif_image_format_guid = {0xb96b3cb0U, 0x0728U, 0x11d3U, {0x9d, 0x7b, 0
|
||||||
|
|
||||||
|
#include "gifcodec.h"
|
||||||
|
|
||||||
|
+#if GIFLIB_MAJOR < 5
|
||||||
|
/* giflib declares this incorrectly as EgifOpen */
|
||||||
|
extern GifFileType *EGifOpen(void *userData, OutputFunc writeFunc);
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
/* Data structure used for callback */
|
||||||
|
typedef struct
|
||||||
|
@@ -105,7 +107,7 @@ gdip_gif_inputfunc (GifFileType *gif, GifByteType *data, int len)
|
||||||
|
*/
|
||||||
|
|
||||||
|
static int
|
||||||
|
-AddExtensionBlockMono(SavedImage *New, int Len, BYTE ExtData[])
|
||||||
|
+AddExtensionBlockMono(SavedImage *New, int Len, int func, BYTE ExtData[])
|
||||||
|
{
|
||||||
|
ExtensionBlock *ep;
|
||||||
|
|
||||||
|
@@ -129,7 +131,7 @@ AddExtensionBlockMono(SavedImage *New, int Len, BYTE ExtData[])
|
||||||
|
|
||||||
|
if (ExtData) {
|
||||||
|
memcpy(ep->Bytes, ExtData, Len);
|
||||||
|
- ep->Function = New->Function;
|
||||||
|
+ ep->Function = func;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (GIF_OK);
|
||||||
|
@@ -232,20 +234,20 @@ DGifSlurpMono(GifFileType * GifFile, SavedImage *TrailingExtensions)
|
||||||
|
}
|
||||||
|
|
||||||
|
case EXTENSION_RECORD_TYPE: {
|
||||||
|
- if (DGifGetExtension(GifFile, &temp_save.Function, &ExtData) == GIF_ERROR) {
|
||||||
|
+ int func;
|
||||||
|
+ if (DGifGetExtension(GifFile, &func, &ExtData) == GIF_ERROR) {
|
||||||
|
return (GIF_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
while (ExtData != NULL) {
|
||||||
|
/* Create an extension block with our data */
|
||||||
|
- if (AddExtensionBlockMono(&temp_save, ExtData[0], &ExtData[1]) == GIF_ERROR) {
|
||||||
|
+ if (AddExtensionBlockMono(&temp_save, func, ExtData[0], &ExtData[1]) == GIF_ERROR) {
|
||||||
|
return (GIF_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DGifGetExtensionNext(GifFile, &ExtData) == GIF_ERROR) {
|
||||||
|
return (GIF_ERROR);
|
||||||
|
}
|
||||||
|
- temp_save.Function = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
@@ -303,12 +305,19 @@ gdip_load_gif_image (void *stream, GpImage **image, BOOL from_file)
|
||||||
|
result = NULL;
|
||||||
|
loop_counter = FALSE;
|
||||||
|
|
||||||
|
+#if GIFLIB_MAJOR < 5
|
||||||
|
if (from_file) {
|
||||||
|
gif = DGifOpen(stream, &gdip_gif_fileinputfunc);
|
||||||
|
} else {
|
||||||
|
gif = DGifOpen (stream, &gdip_gif_inputfunc);
|
||||||
|
}
|
||||||
|
-
|
||||||
|
+#else
|
||||||
|
+ if (from_file)
|
||||||
|
+ gif = DGifOpen(stream, &gdip_gif_fileinputfunc, NULL);
|
||||||
|
+ else
|
||||||
|
+ gif = DGifOpen(stream, &gdip_gif_inputfunc, NULL);
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
if (gif == NULL) {
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
@@ -660,11 +669,22 @@ gdip_save_gif_image (void *stream, GpImage *image, BOOL from_file)
|
||||||
|
return InvalidParameter;
|
||||||
|
}
|
||||||
|
|
||||||
|
+#if GIFLIB_MAJOR < 5
|
||||||
|
if (from_file) {
|
||||||
|
fp = EGifOpenFileName (stream, 0);
|
||||||
|
} else {
|
||||||
|
fp = EGifOpen (stream, gdip_gif_outputfunc);
|
||||||
|
}
|
||||||
|
+#else
|
||||||
|
+ if (from_file)
|
||||||
|
+ fp = EGifOpenFileName (stream, 0, NULL);
|
||||||
|
+ else
|
||||||
|
+ fp = EGifOpen (stream, gdip_gif_outputfunc, NULL);
|
||||||
|
+#define MakeMapObject GifMakeMapObject
|
||||||
|
+#define FreeMapObject GifFreeMapObject
|
||||||
|
+#define QuantizeBuffer GifQuantizeBuffer
|
||||||
|
+#define BitSize GifBitSize
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
if (!fp) {
|
||||||
|
return FileNotFound;
|
||||||
|
@@ -848,8 +868,15 @@ gdip_save_gif_image (void *stream, GpImage *image, BOOL from_file)
|
||||||
|
Buffer[0] = 1;
|
||||||
|
Buffer[1] = ptr[0];
|
||||||
|
Buffer[2] = ptr[1];
|
||||||
|
+#if GIFLIB_MAJOR < 5
|
||||||
|
EGifPutExtensionFirst(fp, APPLICATION_EXT_FUNC_CODE, 11, "NETSCAPE2.0");
|
||||||
|
EGifPutExtensionLast(fp, APPLICATION_EXT_FUNC_CODE, 3, Buffer);
|
||||||
|
+#else
|
||||||
|
+ EGifPutExtensionLeader(fp, APPLICATION_EXT_FUNC_CODE);
|
||||||
|
+ EGifPutExtensionBlock(fp, 11, "NETSCAPE2.0");
|
||||||
|
+ EGifPutExtensionBlock(fp, 3, Buffer);
|
||||||
|
+ EGifPutExtensionTrailer(fp);
|
||||||
|
+#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user