Fix and upgrade leptonica recipe

"giflib6.patch" is from the Arch Linux project.
This commit is contained in:
noryb009
2014-01-02 03:41:16 +00:00
parent 6e8da3976c
commit b5ae282787
4 changed files with 428 additions and 34 deletions

View File

@@ -0,0 +1,56 @@
diff -wbBur leptonica-1.69/src/gifio.c leptonica-1.69/src/gifio.c
--- leptonica-1.69/src/gifio.c 2012-01-22 22:29:15.000000000 +0400
+++ leptonica-1.69/src/gifio.c 2013-07-30 18:27:19.269137200 +0400
@@ -100,7 +100,7 @@
_lseek(fd, 0, SEEK_SET);
#endif /* _MSC_VER */
- if ((gif = DGifOpenFileHandle(fd)) == NULL)
+ if ((gif = DGifOpenFileHandle(fd, NULL)) == NULL)
return (PIX *)ERROR_PTR("invalid file or file not found",
procName, NULL);
@@ -316,7 +316,7 @@
}
/* Save the cmap colors in a gif_cmap */
- if ((gif_cmap = MakeMapObject(gif_ncolor, NULL)) == NULL) {
+ if ((gif_cmap = GifMakeMapObject(gif_ncolor, NULL)) == NULL) {
pixDestroy(&pixd);
return ERROR_INT("failed to create GIF color map", procName, 1);
}
@@ -325,7 +325,7 @@
if (ncolor > 0) {
if (pixcmapGetColor(cmap, i, &rval, &gval, &bval) != 0) {
pixDestroy(&pixd);
- FreeMapObject(gif_cmap);
+ GifFreeMapObject(gif_cmap);
return ERROR_INT("failed to get color from color map",
procName, 1);
}
@@ -337,9 +337,9 @@
}
/* Get the gif file handle */
- if ((gif = EGifOpenFileHandle(fd)) == NULL) {
+ if ((gif = EGifOpenFileHandle(fd, NULL)) == NULL) {
pixDestroy(&pixd);
- FreeMapObject(gif_cmap);
+ GifFreeMapObject(gif_cmap);
return ERROR_INT("failed to create GIF image handle", procName, 1);
}
@@ -347,11 +347,11 @@
if (EGifPutScreenDesc(gif, w, h, gif_cmap->BitsPerPixel, 0, gif_cmap)
!= GIF_OK) {
pixDestroy(&pixd);
- FreeMapObject(gif_cmap);
+ GifFreeMapObject(gif_cmap);
EGifCloseFile(gif);
return ERROR_INT("failed to write screen description", procName, 1);
}
- FreeMapObject(gif_cmap); /* not needed after this point */
+ GifFreeMapObject(gif_cmap); /* not needed after this point */
if (EGifPutImageDesc(gif, 0, 0, w, h, FALSE, NULL) != GIF_OK) {
pixDestroy(&pixd);

View File

@@ -0,0 +1,56 @@
From 0b6499e1a9868539583d776f2c0c6251b38a02e6 Mon Sep 17 00:00:00 2001
From: Luke <noryb009@gmail.com>
Date: Thu, 26 Dec 2013 01:39:15 +0000
Subject: [PATCH] Fix building on Haiku
---
configure.ac | 2 +-
src/sarray.c | 5 ++++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index fb5ca0c..88b52c9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,7 @@
AC_PREREQ([2.50])
AC_INIT([leptonica], [1.69], [dan.bloomberg@gmail.com])
AC_CONFIG_AUX_DIR([config])
-AM_CONFIG_HEADER([config_auto.h:config/config.h.in])
+AC_CONFIG_HEADERS([config_auto.h:config/config.h.in])
AC_CONFIG_SRCDIR([src/adaptmap.c])
AC_CONFIG_MACRO_DIR([m4])
diff --git a/src/sarray.c b/src/sarray.c
index c21bf3b..b212bf8 100644
--- a/src/sarray.c
+++ b/src/sarray.c
@@ -131,6 +131,7 @@
#include <string.h>
#ifndef _WIN32
#include <dirent.h> /* unix only */
+#include <sys/stat.h>
#endif /* ! _WIN32 */
#include "allheaders.h"
@@ -1831,6 +1832,7 @@ l_int32 len;
SARRAY *safiles;
DIR *pdir;
struct dirent *pdirentry;
+struct stat s;
PROCNAME("getFilenamesInDirectory");
@@ -1847,7 +1849,8 @@ struct dirent *pdirentry;
* define _BSD_SOURCE in the CC command, because the DT_DIR
* flag is non-standard. */
#if !defined(__SOLARIS__)
- if (pdirentry->d_type == DT_DIR)
+ stat(pdirentry->d_name, &s);
+ if(S_ISDIR(s.st_mode))
continue;
#endif
--
1.8.3.4