1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-10-20 20:09:11 +00:00

Allow building with either giflib 4.2 or 5.0

This commit is contained in:
Antoine Brodin 2014-12-26 16:48:58 +00:00
parent 8fa27a8450
commit 6266dd56ce
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=375632

View File

@ -1,6 +1,6 @@
--- ./eqn2img.c.orig 2013-03-07 15:44:58.000000000 +0100
+++ ./eqn2img.c 2013-03-07 15:47:58.000000000 +0100
@@ -367,7 +367,7 @@
--- eqn2img.c.orig 2013-01-27 04:17:45 UTC
+++ eqn2img.c
@@ -367,7 +367,7 @@ png_bytepp png_read(char *filename, int
info_ptr = png_create_info_struct(png_ptr);
assert(info_ptr);
@ -9,7 +9,7 @@
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
fclose(fp);
return NULL;
@@ -580,7 +580,7 @@
@@ -580,7 +580,7 @@ int png_write(png_bytepp image, char *im
assert(info_ptr);
/* error handling, libpng longjmps here on any error */
@ -18,7 +18,39 @@
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
fclose(fp);
return -1;
@@ -715,7 +715,7 @@
@@ -623,19 +623,31 @@ int gif_write(png_bytepp image, char *im
};
if(img_name) {
+#if GIFLIB_MAJOR >= 5
+ fp = EGifOpenFileName(img_name, 0, NULL);
+#else
fp = EGifOpenFileName(img_name, 0);
+#endif
if(!fp)
return -1;
}
else
+#if GIFLIB_MAJOR >= 5
+ fp = EGifOpenFileHandle(STDOUT_FILENO, NULL);
+#else
fp = EGifOpenFileHandle(STDOUT_FILENO);
+#endif
for(i=0; i<256; i++) {
pal[i].Red = (i*background.red + (255-i)*foreground.red)/255;
pal[i].Green = (i*background.green + (255-i)*foreground.green)/255;
pal[i].Blue = (i*background.blue + (255-i)*foreground.blue)/255;
}
+#if GIFLIB_MAJOR >= 5
+ color_map = GifMakeMapObject(256, pal);
+#else
color_map = MakeMapObject(256, pal);
+#endif
/* EGifSetGifVersion("89a"); this causes segfault (but is really required for transparency, I think) */
EGifPutScreenDesc(fp, width, height, 256, 255, color_map);
@@ -715,7 +727,7 @@ int to_ps(char *basename, int verbose) {
fprintf(stderr, " -> ps");
cmd = NEW(char, 2*strlen(basename) + 46);