mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-16 19:50:19 +01:00
graphics/meh: Patched to build with giflib-5.1.
Signed-off-by: David Spencer <baildon.research@googlemail.com> Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
parent
5d9bed09d4
commit
015f5aa75b
2 changed files with 84 additions and 0 deletions
81
graphics/meh/meh-giflib.patch
Normal file
81
graphics/meh/meh-giflib.patch
Normal file
|
@ -0,0 +1,81 @@
|
|||
diff -u -r meh-0.3/src/gif.c meh-0.3-git/src/gif.c
|
||||
--- meh-0.3/src/gif.c 2010-01-04 17:45:01.000000000 +0000
|
||||
+++ meh-0.3-git/src/gif.c 2015-08-27 16:11:39.082286073 +0100
|
||||
@@ -32,7 +32,11 @@
|
||||
/* HACK HACK HACK */
|
||||
rewind(f);
|
||||
lseek(fileno(f), 0L, SEEK_SET);
|
||||
+#if defined(GIFLIB_MAJOR) && GIFLIB_MAJOR >= 5
|
||||
+ if(!(gif = DGifOpenFileHandle(fileno(f), NULL))){
|
||||
+#else
|
||||
if(!(gif = DGifOpenFileHandle(fileno(f)))){
|
||||
+#endif
|
||||
/* HACK AND HOPE */
|
||||
rewind(f);
|
||||
lseek(fileno(f), 0L, SEEK_SET);
|
||||
@@ -55,11 +59,10 @@
|
||||
struct gif_t *g = (struct gif_t *)img;
|
||||
GifColorType *colormap;
|
||||
SavedImage *s;
|
||||
+ int ret;
|
||||
|
||||
- if(DGifSlurp(g->gif) == GIF_ERROR){
|
||||
- PrintGifError();
|
||||
- return 1;
|
||||
- }
|
||||
+ if((ret = DGifSlurp(g->gif)) != GIF_OK)
|
||||
+ goto error;
|
||||
|
||||
s = &g->gif->SavedImages[0];
|
||||
|
||||
@@ -67,10 +70,8 @@
|
||||
colormap = s->ImageDesc.ColorMap->Colors;
|
||||
else if(g->gif->SColorMap)
|
||||
colormap = g->gif->SColorMap->Colors;
|
||||
- else{
|
||||
- PrintGifError();
|
||||
- return 1;
|
||||
- }
|
||||
+ else
|
||||
+ goto error;
|
||||
|
||||
for(i = 0; i < img->bufwidth * img->bufheight; i++){
|
||||
unsigned char idx = s->RasterBits[i];
|
||||
@@ -82,11 +83,37 @@
|
||||
img->state |= LOADED | SLOWLOADED;
|
||||
|
||||
return 0;
|
||||
+error:
|
||||
+#if defined(GIFLIB_MAJOR) && GIFLIB_MAJOR >= 5
|
||||
+ fprintf(stderr, "GIFLIB: %s\n", GifErrorString(ret));
|
||||
+#elif defined(GIFLIB_MAJOR) && defined(GIFLIB_MINOR) && ((GIFLIB_MAJOR == 4 && GIFLIB_MINOR >= 2) || GIFLIB_MAJOR > 4)
|
||||
+ fprintf(stderr, "GIFLIB: %s\n", GifErrorString());
|
||||
+#else
|
||||
+ PrintGifError();
|
||||
+#endif
|
||||
+ return 1;
|
||||
}
|
||||
|
||||
void gif_close(struct image *img){
|
||||
struct gif_t *g = (struct gif_t *)img;
|
||||
+#if defined(GIFLIB_MAJOR) && defined(GIFLIB_MINOR) && (GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1)
|
||||
+ int ret;
|
||||
+#endif
|
||||
+
|
||||
+#if defined(GIFLIB_MAJOR) && defined(GIFLIB_MINOR) && (GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1)
|
||||
+ DGifCloseFile(g->gif,&ret);
|
||||
+ if(ret != GIF_OK) {
|
||||
+#if defined(GIFLIB_MAJOR) && GIFLIB_MAJOR >= 5
|
||||
+ fprintf(stderr, "GIFLIB: %s\n", GifErrorString(ret));
|
||||
+#elif defined(GIFLIB_MAJOR) && defined(GIFLIB_MINOR) && ((GIFLIB_MAJOR == 4 && GIFLIB_MINOR >= 2) || GIFLIB_MAJOR > 4)
|
||||
+ fprintf(stderr, "GIFLIB: %s\n", GifErrorString());
|
||||
+#else
|
||||
+ PrintGifError();
|
||||
+#endif
|
||||
+ }
|
||||
+#else
|
||||
DGifCloseFile(g->gif);
|
||||
+#endif
|
||||
fclose(g->f);
|
||||
}
|
||||
|
|
@ -67,6 +67,9 @@ find -L . \
|
|||
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
|
||||
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
|
||||
|
||||
# Fixes for giflib-5.1 from https://github.com/jhawthorn/meh
|
||||
patch -p1 < $CWD/meh-giflib.patch
|
||||
|
||||
CFLAGS="$SLKCFLAGS" make
|
||||
install -D -m 755 meh $PKG/usr/bin/meh
|
||||
|
||||
|
|
Loading…
Reference in a new issue