Skip to content
This repository was archived by the owner on Jan 16, 2024. It is now read-only.

Commit c1d611a

Browse files
committed
Rebuild for tesseract 4.0.0
1 parent 4462d8a commit c1d611a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+1432
-2796
lines changed

PKGBUILD

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Maintainer: Alexey Pavlov <[email protected]>
2+
# Maintainer: Ray Donnelly <[email protected]>
3+
4+
_realname=tesseract-ocr
5+
pkgbase=mingw-w64-${_realname}
6+
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
7+
pkgver=4.0.0
8+
pkgrel=1
9+
pkgdesc="Tesseract OCR (mingw-w64)"
10+
arch=('any')
11+
url="https://github.com/tesseract-ocr/tesseract"
12+
license=("Apache License 2.0")
13+
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" "${MINGW_PACKAGE_PREFIX}-pkg-config")
14+
depends=(${MINGW_PACKAGE_PREFIX}-cairo
15+
# ${MINGW_PACKAGE_PREFIX}-icu
16+
${MINGW_PACKAGE_PREFIX}-leptonica
17+
# ${MINGW_PACKAGE_PREFIX}-pango
18+
${MINGW_PACKAGE_PREFIX}-zlib)
19+
options=('!libtool' 'strip')
20+
source=(${_realname}-${pkgver}.tar.gz::https://github.com/tesseract-ocr/tesseract/archive/${pkgver}.tar.gz
21+
https://github.com/tesseract-ocr/tessdata_fast/raw/master/osd.traineddata
22+
001-proper-include-thread.patch)
23+
sha256sums=('a1f5422ca49a32e5f35c54dee5112b11b99928fc9f4ee6695cdc6768d69f61dd'
24+
'9cf5d576fcc47564f11265841e5ca839001e7e6f38ff7f7aacf46d15a96b00ff'
25+
'0c8eec0552e9d3af93e84f594e71cfce0e996c630bddc6a0c2ca509f516696c9')
26+
27+
prepare() {
28+
cd "${srcdir}/tesseract-${pkgver}"
29+
patch -p1 -i ${srcdir}/001-proper-include-thread.patch
30+
./autogen.sh
31+
}
32+
33+
build() {
34+
[[ -d "${srcdir}/build-${MINGW_CHOST}" ]] && rm -rf "${srcdir}/build-${MINGW_CHOST}"
35+
mkdir "${srcdir}/build-${MINGW_CHOST}"
36+
cd "${srcdir}/build-${MINGW_CHOST}"
37+
local -a extra_config
38+
if check_option "debug" "y"; then
39+
extra_config+=( --enable-debug )
40+
fi
41+
42+
# Build with old toolchain:
43+
#export PKG_CONFIG="pkg-config --static"
44+
#export CC="/C/Rtools${MINGW_PREFIX/mingw/mingw_}/bin/gcc"
45+
#export CXX="/C/Rtools${MINGW_PREFIX/mingw/mingw_}/bin/g++"
46+
#export CPPFLAGS="-I${MINGW_PREFIX}/include"
47+
48+
# Hack for leptonica missing openjp2 from .pc file:
49+
LIBS="-L${MINGW_PREFIX}/lib -lopenjp2" \
50+
../tesseract-${pkgver}/configure \
51+
--build=${MINGW_CHOST} \
52+
--host=${MINGW_CHOST} \
53+
--target=${MINGW_CHOST} \
54+
--prefix=${MINGW_PREFIX} \
55+
--enable-static \
56+
--disable-shared \
57+
--disable-openmp \
58+
LIBLEPT_HEADERSDIR=${MINGW_PREFIX}/include \
59+
"${extra_config[@]}"
60+
61+
make
62+
#make training
63+
}
64+
65+
package() {
66+
cd "${srcdir}/build-${MINGW_CHOST}"
67+
make DESTDIR="${pkgdir}" install
68+
#make DESTDIR="${pkgdir}" training-install
69+
mkdir -p ${pkgdir}${MINGW_PREFIX}/share/tessdata
70+
install -Dm0644 ${srcdir}/osd.traineddata ${pkgdir}${MINGW_PREFIX}/share/tessdata/osd.traineddata
71+
}

include/leptonica/allheaders.h

Lines changed: 64 additions & 84 deletions
Large diffs are not rendered by default.

include/leptonica/arrayaccess.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
* parentheses, because parens require an evaluation and it is not
6262
* defined for SET macros. If SET_DATA_QBIT were defined as a
6363
* compound macro, in analogy to l_setDataQbit(), it requires
64-
* surrounding bracces:
64+
* surrounding braces:
6565
* #define SET_DATA_QBIT(pdata, n, val) \
6666
* {l_uint32 *_TEMP_WORD_PTR_; \
6767
* _TEMP_WORD_PTR_ = (l_uint32 *)(pdata) + ((n) >> 3); \

include/leptonica/environ.h

Lines changed: 53 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -97,37 +97,23 @@ typedef uintptr_t l_uintptr_t;
9797
* non-functioning stubs to be linked.
9898
*/
9999
#if !defined(HAVE_CONFIG_H) && !defined(ANDROID_BUILD) && !defined(OS_IOS)
100-
#define HAVE_LIBJPEG 1
101-
#define HAVE_LIBTIFF 1
102-
#define HAVE_LIBPNG 1
103-
#define HAVE_LIBZ 1
104-
#define HAVE_LIBGIF 0
105-
#define HAVE_LIBUNGIF 0
106-
#define HAVE_LIBWEBP 0
107-
#define HAVE_LIBJP2K 0
108-
109-
/* Leptonica supports both OpenJPEG 2.0 and 2.1. If you have a
110-
* version of openjpeg (HAVE_LIBJP2K) that is not 2.1, set the
111-
* path to the openjpeg.h header in angle brackets here. */
112-
#define LIBJP2K_HEADER <openjpeg-2.1/openjpeg.h>
100+
#define HAVE_LIBJPEG 1
101+
#define HAVE_LIBTIFF 1
102+
#define HAVE_LIBPNG 1
103+
#define HAVE_LIBZ 1
104+
#define HAVE_LIBGIF 0
105+
#define HAVE_LIBUNGIF 0
106+
#define HAVE_LIBWEBP 0
107+
#define HAVE_LIBJP2K 0
108+
109+
/*-------------------------------------------------------------------------*
110+
* Leptonica supports OpenJPEG 2.0+. If you have a version of openjpeg *
111+
* (HAVE_LIBJP2K == 1) that is >= 2.0, set the path to the openjpeg.h *
112+
* header in angle brackets here. *
113+
*-------------------------------------------------------------------------*/
114+
#define LIBJP2K_HEADER <openjpeg-2.3/openjpeg.h>
113115
#endif /* ! HAVE_CONFIG_H etc. */
114116

115-
/*
116-
* On linux systems, you can do I/O between Pix and memory. Specifically,
117-
* you can compress (write compressed data to memory from a Pix) and
118-
* uncompress (read from compressed data in memory to a Pix).
119-
* For jpeg, png, jp2k, gif, pnm and bmp, these use the non-posix GNU
120-
* functions fmemopen() and open_memstream(). These functions are not
121-
* available on other systems.
122-
* To use these functions in linux, you must define HAVE_FMEMOPEN to 1.
123-
* To use them on MacOS, which does not support these functions, set it to 0.
124-
*/
125-
#if !defined(HAVE_CONFIG_H) && !defined(ANDROID_BUILD) && !defined(OS_IOS) && \
126-
!defined(_WIN32)
127-
#define HAVE_FMEMOPEN 1
128-
#endif /* ! HAVE_CONFIG_H etc. */
129-
130-
131117
/*--------------------------------------------------------------------*
132118
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*
133119
* USER CONFIGURABLE *
@@ -148,6 +134,30 @@ typedef uintptr_t l_uintptr_t;
148134
#define USE_PSIO 1
149135

150136

137+
/*-------------------------------------------------------------------------*
138+
* On linux systems, you can do I/O between Pix and memory. Specifically,
139+
* you can compress (write compressed data to memory from a Pix) and
140+
* uncompress (read from compressed data in memory to a Pix).
141+
* For jpeg, png, jp2k, gif, pnm and bmp, these use the non-posix GNU
142+
* functions fmemopen() and open_memstream(). These functions are not
143+
* available on other systems.
144+
* To use these functions in linux, you must define HAVE_FMEMOPEN to 1.
145+
* To use them on MacOS, which does not support these functions, set it to 0.
146+
*-------------------------------------------------------------------------*/
147+
#if !defined(HAVE_CONFIG_H) && !defined(ANDROID_BUILD) && !defined(OS_IOS) && \
148+
!defined(_WIN32)
149+
#define HAVE_FMEMOPEN 1
150+
#endif /* ! HAVE_CONFIG_H etc. */
151+
152+
/*-------------------------------------------------------------------------*
153+
* fstatat() is defined by POSIX, but some systems do not support it. *
154+
* One example is older macOS systems (pre-10.10). *
155+
* Play it safe and set the default value to 0. *
156+
*-------------------------------------------------------------------------*/
157+
#if !defined(HAVE_CONFIG_H)
158+
#define HAVE_FSTATAT 0
159+
#endif /* ! HAVE_CONFIG_H */
160+
151161
/*--------------------------------------------------------------------*
152162
* It is desirable on Windows to have all temp files written to the same
153163
* subdirectory of the Windows <Temp> directory, because files under <Temp>
@@ -178,6 +188,20 @@ typedef unsigned long long l_uint64; /*!< unsigned 64-bit value */
178188
#endif /* COMPILER_MSVC */
179189

180190

191+
/*-------------------------------------------------------------------------*
192+
* For security, the library is distributed in a configuration that does *
193+
* not permit (1) forking with 'system', which is used for displaying *
194+
* images and generating gnuplots, and (2) writing files with specified *
195+
* compiled-in file names. All such writes are with functions such as *
196+
* pixWriteDebug() where the "Debug" is appended to the usual name. *
197+
* Whether the "Debug" version defaults to the standard version or is a *
198+
* no-op depends on the value of this global variable. The default value *
199+
* of LeptDebugOK is 0, and it is set in writefile.c. This value can be *
200+
* over-ridden, for development and debugging, by setLeptDebugOK(). *
201+
*-------------------------------------------------------------------------*/
202+
LEPT_DLL extern l_int32 LeptDebugOK; /* default is 0 */
203+
204+
181205
/*------------------------------------------------------------------------*
182206
* Standard macros *
183207
*------------------------------------------------------------------------*/
@@ -239,7 +263,6 @@ typedef unsigned long long l_uint64; /*!< unsigned 64-bit value */
239263
/*------------------------------------------------------------------------*
240264
* Simple search state variables *
241265
*------------------------------------------------------------------------*/
242-
243266
/*! Simple search state variables */
244267
enum {
245268
L_NOT_FOUND = 0,
@@ -250,7 +273,6 @@ enum {
250273
/*------------------------------------------------------------------------*
251274
* Path separator conversion *
252275
*------------------------------------------------------------------------*/
253-
254276
/*! Path separator conversion */
255277
enum {
256278
UNIX_PATH_SEPCHAR = 0,

include/leptonica/gplot.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ enum GPLOT_STYLE {
5252
GPLOT_DOTS = 4
5353
};
5454

55-
#define NUM_GPLOT_OUTPUTS 6
55+
#define NUM_GPLOT_OUTPUTS 5
5656
enum GPLOT_OUTPUT {
5757
GPLOT_NONE = 0,
5858
GPLOT_PNG = 1,
@@ -69,7 +69,6 @@ enum GPLOT_SCALING {
6969
};
7070

7171
extern const char *gplotstylenames[]; /*!< used in gnuplot cmd file */
72-
extern const char *gplotfilestyles[]; /*!< used in simple file input */
7372
extern const char *gplotfileoutputs[]; /*!< used in simple file input */
7473

7574
/*! Data structure for generating gnuplot files */

include/leptonica/imageio.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
/* --------------------------------------------------------------- *
7474
* Image file format types *
7575
* --------------------------------------------------------------- */
76-
/*
76+
/*
7777
* The IFF_DEFAULT flag is used to write the file out in the
7878
* same (input) file format that the pix was read from. If the pix
7979
* was not read from file, the input format field will be
@@ -151,7 +151,7 @@ enum {
151151
/* --------------------------------------------------------------- *
152152
* Compressed image data *
153153
* --------------------------------------------------------------- */
154-
/*
154+
/*
155155
* In use, either datacomp or data85 will be produced, depending
156156
* on whether the data needs to be ascii85 encoded. PostScript
157157
* requires ascii85 encoding; pdf does not.
@@ -200,7 +200,7 @@ enum {
200200
/* ------------------------------------------------------------------------- *
201201
* Intermediate pdf generation data *
202202
* ------------------------------------------------------------------------- */
203-
/*
203+
/*
204204
* This accumulates data for generating a pdf of a single page consisting
205205
* of an arbitrary number of images.
206206
*

0 commit comments

Comments
 (0)