summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app-text/tesseract/files')
-rw-r--r--app-text/tesseract/files/tesseract-4.00.00_alpha-isnan.patch28
-rw-r--r--app-text/tesseract/files/tesseract-4.00.00_alpha-no_graphics.patch143
-rw-r--r--app-text/tesseract/files/tesseract-4.00.00_alpha-openmp.patch111
3 files changed, 282 insertions, 0 deletions
diff --git a/app-text/tesseract/files/tesseract-4.00.00_alpha-isnan.patch b/app-text/tesseract/files/tesseract-4.00.00_alpha-isnan.patch
new file mode 100644
index 000000000000..4ae4c8150a61
--- /dev/null
+++ b/app-text/tesseract/files/tesseract-4.00.00_alpha-isnan.patch
@@ -0,0 +1,28 @@
+From beb564df82204078563bcbde4e569caac2f7a2ac Mon Sep 17 00:00:00 2001
+From: Stefan Weil <sw@weilnetz.de>
+Date: Tue, 22 Nov 2016 11:31:01 +0100
+Subject: [PATCH] lstm: Fix compilation (undeclared 'isnan')
+
+gcc report:
+
+lstm/lstmrecognizer.cpp:608:47: error: 'isnan' was not declared in this scope
+ ASSERT_HOST(!isnan(output.f(t)[null_char_]));
+
+Signed-off-by: Stefan Weil <sw@weilnetz.de>
+---
+ lstm/lstmrecognizer.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lstm/lstmrecognizer.cpp b/lstm/lstmrecognizer.cpp
+index f648e16..babfe50 100644
+--- a/lstm/lstmrecognizer.cpp
++++ b/lstm/lstmrecognizer.cpp
+@@ -600,7 +600,7 @@ void LSTMRecognizer::LabelsViaThreshold(const NetworkIO& output,
+ ++t;
+ }
+ while (t < width) {
+- ASSERT_HOST(!isnan(output.f(t)[null_char_]));
++ ASSERT_HOST(!std::isnan(output.f(t)[null_char_]));
+ int label = output.BestLabel(t, null_char_, null_char_, NULL);
+ int char_start = t++;
+ while (t < width && !NullIsBest(output, null_thr, null_char_, t) &&
diff --git a/app-text/tesseract/files/tesseract-4.00.00_alpha-no_graphics.patch b/app-text/tesseract/files/tesseract-4.00.00_alpha-no_graphics.patch
new file mode 100644
index 000000000000..6707ff093644
--- /dev/null
+++ b/app-text/tesseract/files/tesseract-4.00.00_alpha-no_graphics.patch
@@ -0,0 +1,143 @@
+diff --git a/lstm/lstmrecognizer.cpp b/lstm/lstmrecognizer.cpp
+index 1d4f0f3..7192ba7 100644
+--- a/lstm/lstmrecognizer.cpp
++++ b/lstm/lstmrecognizer.cpp
+@@ -16,6 +16,11 @@
+ // limitations under the License.
+ ///////////////////////////////////////////////////////////////////////
+
++// Include automatically generated configuration file if running autoconf.
++#ifdef HAVE_CONFIG_H
++#include "config_auto.h"
++#endif
++
+ #include "lstmrecognizer.h"
+
+ #include "allheaders.h"
+diff --git a/lstm/lstmtrainer.cpp b/lstm/lstmtrainer.cpp
+index ab66702..fd3f247 100644
+--- a/lstm/lstmtrainer.cpp
++++ b/lstm/lstmtrainer.cpp
+@@ -16,6 +16,11 @@
+ // limitations under the License.
+ ///////////////////////////////////////////////////////////////////////
+
++// Include automatically generated configuration file if running autoconf.
++#ifdef HAVE_CONFIG_H
++#include "config_auto.h"
++#endif
++
+ #include "lstmtrainer.h"
+ #include <string>
+
+diff --git a/lstm/network.cpp b/lstm/network.cpp
+index 795d4a5..791848a 100644
+--- a/lstm/network.cpp
++++ b/lstm/network.cpp
+@@ -16,6 +16,11 @@
+ // limitations under the License.
+ ///////////////////////////////////////////////////////////////////////
+
++// Include automatically generated configuration file if running autoconf.
++#ifdef HAVE_CONFIG_H
++#include "config_auto.h"
++#endif
++
+ #include "network.h"
+
+ #include <stdlib.h>
+@@ -277,27 +282,31 @@ double Network::Random(double range) {
+ return randomizer_->SignedRand(range);
+ }
+
+-#ifndef GRAPHICS_DISABLED
+ // === Debug image display methods. ===
+ // Displays the image of the matrix to the forward window.
+ void Network::DisplayForward(const NetworkIO& matrix) {
++#ifndef GRAPHICS_DISABLED // do nothing if there's no graphics
+ Pix* image = matrix.ToPix();
+ ClearWindow(false, name_.string(), pixGetWidth(image),
+ pixGetHeight(image), &forward_win_);
+ DisplayImage(image, forward_win_);
+ forward_win_->Update();
++#endif // GRAPHICS_DISABLED
+ }
+
+ // Displays the image of the matrix to the backward window.
+ void Network::DisplayBackward(const NetworkIO& matrix) {
++#ifndef GRAPHICS_DISABLED // do nothing if there's no graphics
+ Pix* image = matrix.ToPix();
+ STRING window_name = name_ + "-back";
+ ClearWindow(false, window_name.string(), pixGetWidth(image),
+ pixGetHeight(image), &backward_win_);
+ DisplayImage(image, backward_win_);
+ backward_win_->Update();
++#endif // GRAPHICS_DISABLED
+ }
+
++#ifndef GRAPHICS_DISABLED
+ // Creates the window if needed, otherwise clears it.
+ void Network::ClearWindow(bool tess_coords, const char* window_name,
+ int width, int height, ScrollView** window) {
+diff --git a/viewer/svutil.cpp b/viewer/svutil.cpp
+index 34a2286..84a4b94 100644
+--- a/viewer/svutil.cpp
++++ b/viewer/svutil.cpp
+@@ -83,6 +83,27 @@ void SVMutex::Unlock() {
+ #endif
+ }
+
++// Create new thread.
++void SVSync::StartThread(void *(*func)(void*), void* arg) {
++#ifdef _WIN32
++ LPTHREAD_START_ROUTINE f = (LPTHREAD_START_ROUTINE) func;
++ DWORD threadid;
++ HANDLE newthread = CreateThread(
++ NULL, // default security attributes
++ 0, // use default stack size
++ f, // thread function
++ arg, // argument to thread function
++ 0, // use default creation flags
++ &threadid); // returns the thread identifier
++#else
++ pthread_t helper;
++ pthread_attr_t attr;
++ pthread_attr_init(&attr);
++ pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
++ pthread_create(&helper, &attr, func, arg);
++#endif
++}
++
+ #ifndef GRAPHICS_DISABLED
+
+ const int kMaxMsgSize = 4096;
+@@ -186,29 +207,6 @@ void SVSemaphore::Wait() {
+ #endif
+ }
+
+-
+-// Create new thread.
+-
+-void SVSync::StartThread(void *(*func)(void*), void* arg) {
+-#ifdef _WIN32
+- LPTHREAD_START_ROUTINE f = (LPTHREAD_START_ROUTINE) func;
+- DWORD threadid;
+- HANDLE newthread = CreateThread(
+- NULL, // default security attributes
+- 0, // use default stack size
+- f, // thread function
+- arg, // argument to thread function
+- 0, // use default creation flags
+- &threadid); // returns the thread identifier
+-#else
+- pthread_t helper;
+- pthread_attr_t attr;
+- pthread_attr_init(&attr);
+- pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+- pthread_create(&helper, &attr, func, arg);
+-#endif
+-}
+-
+ // Place a message in the message buffer (and flush it).
+ void SVNetwork::Send(const char* msg) {
+ mutex_send_->Lock();
diff --git a/app-text/tesseract/files/tesseract-4.00.00_alpha-openmp.patch b/app-text/tesseract/files/tesseract-4.00.00_alpha-openmp.patch
new file mode 100644
index 000000000000..d07fb58157fe
--- /dev/null
+++ b/app-text/tesseract/files/tesseract-4.00.00_alpha-openmp.patch
@@ -0,0 +1,111 @@
+Backport from upstream 6140be6a5575e9159e3678adf4ee9e673b3ff2cc
+
+diff -Naur tesseract-4.00.00alpha.orig/api/Makefile.am tesseract-4.00.00alpha/api/Makefile.am
+--- tesseract-4.00.00alpha.orig/api/Makefile.am 2016-11-08 00:38:07.000000000 +0100
++++ tesseract-4.00.00alpha/api/Makefile.am 2017-01-26 10:27:59.269712914 +0100
+@@ -88,9 +88,7 @@
+
+ tesseract_LDFLAGS = $(OPENCL_LDFLAGS)
+
+-if OPENMP
+ tesseract_LDADD += $(OPENMP_CFLAGS)
+-endif
+
+ if T_WIN
+ tesseract_LDADD += -lws2_32
+@@ -99,4 +97,3 @@
+ if ADD_RT
+ tesseract_LDADD += -lrt
+ endif
+-
+diff -Naur tesseract-4.00.00alpha.orig/ccmain/Makefile.am tesseract-4.00.00alpha/ccmain/Makefile.am
+--- tesseract-4.00.00alpha.orig/ccmain/Makefile.am 2016-11-08 00:38:07.000000000 +0100
++++ tesseract-4.00.00alpha/ccmain/Makefile.am 2017-01-26 10:27:59.269712914 +0100
+@@ -8,6 +8,7 @@
+ -I$(top_srcdir)/textord -I$(top_srcdir)/opencl
+
+ AM_CPPFLAGS += $(OPENCL_CPPFLAGS)
++AM_CPPFLAGS += $(OPENMP_CXXFLAGS)
+
+ if VISIBILITY
+ AM_CPPFLAGS += -DTESS_EXPORTS \
+diff -Naur tesseract-4.00.00alpha.orig/ccmain/par_control.cpp tesseract-4.00.00alpha/ccmain/par_control.cpp
+--- tesseract-4.00.00alpha.orig/ccmain/par_control.cpp 2016-11-08 00:38:07.000000000 +0100
++++ tesseract-4.00.00alpha/ccmain/par_control.cpp 2017-01-26 10:27:59.269712914 +0100
+@@ -18,9 +18,9 @@
+ ///////////////////////////////////////////////////////////////////////
+
+ #include "tesseractclass.h"
+-#ifdef OPENMP
++#ifdef _OPENMP
+ #include <omp.h>
+-#endif // OPENMP
++#endif // _OPENMP
+
+ namespace tesseract {
+
+@@ -53,7 +53,9 @@
+ }
+ // Pre-classify all the blobs.
+ if (tessedit_parallelize > 1) {
++#ifdef _OPENMP
+ #pragma omp parallel for num_threads(10)
++#endif // _OPENMP
+ for (int b = 0; b < blobs.size(); ++b) {
+ *blobs[b].choices =
+ blobs[b].tesseract->classify_blob(blobs[b].blob, "par", White, NULL);
+diff -Naur tesseract-4.00.00alpha.orig/configure.ac tesseract-4.00.00alpha/configure.ac
+--- tesseract-4.00.00alpha.orig/configure.ac 2016-11-08 00:38:07.000000000 +0100
++++ tesseract-4.00.00alpha/configure.ac 2017-01-26 10:28:45.636688839 +0100
+@@ -170,14 +170,7 @@
+ fi
+
+ # check whether to build OpenMP support
+-AM_CONDITIONAL([OPENMP], false)
+ AC_OPENMP
+-AS_IF([test "x$OPENMP_CFLAGS" != "x"],
+- [AM_CONDITIONAL([OPENMP], true)
+- AC_SUBST([AM_CPPFLAGS], ["$OPENMP_CXXFLAGS"])
+- AC_DEFINE([OPENMP], [], [Defined when compiled with OpenMP support])]
+-)
+-
+
+ # check whether to build opencl version
+ AC_MSG_CHECKING([--enable-opencl argument])
+diff -Naur tesseract-4.00.00alpha.orig/lstm/lstm.cpp tesseract-4.00.00alpha/lstm/lstm.cpp
+--- tesseract-4.00.00alpha.orig/lstm/lstm.cpp 2016-11-08 00:38:07.000000000 +0100
++++ tesseract-4.00.00alpha/lstm/lstm.cpp 2017-01-26 10:27:59.269712914 +0100
+@@ -18,7 +18,7 @@
+
+ #include "lstm.h"
+
+-#ifndef ANDROID_BUILD
++#ifdef _OPENMP
+ #include <omp.h>
+ #endif
+ #include <stdio.h>
+diff -Naur tesseract-4.00.00alpha.orig/lstm/Makefile.am tesseract-4.00.00alpha/lstm/Makefile.am
+--- tesseract-4.00.00alpha.orig/lstm/Makefile.am 2016-11-08 00:38:07.000000000 +0100
++++ tesseract-4.00.00alpha/lstm/Makefile.am 2017-01-26 10:27:59.269712914 +0100
+@@ -4,7 +4,7 @@
+ -I$(top_srcdir)/dict -I$(top_srcdir)/lstm
+ AUTOMAKE_OPTIONS = subdir-objects
+ SUBDIRS =
+-AM_CXXFLAGS = -fopenmp
++AM_CXXFLAGS = $(OPENMP_CXXFLAGS)
+
+ if !NO_TESSDATA_PREFIX
+ AM_CXXFLAGS += -DTESSDATA_PREFIX=@datadir@/
+diff -Naur tesseract-4.00.00alpha.orig/lstm/parallel.cpp tesseract-4.00.00alpha/lstm/parallel.cpp
+--- tesseract-4.00.00alpha.orig/lstm/parallel.cpp 2016-11-08 00:38:07.000000000 +0100
++++ tesseract-4.00.00alpha/lstm/parallel.cpp 2017-01-26 10:27:59.269712914 +0100
+@@ -18,7 +18,9 @@
+
+ #include "parallel.h"
+
++#ifdef _OPENMP
+ #include <omp.h>
++#endif
+
+ #include "functions.h" // For conditional undef of _OPENMP.
+ #include "networkscratch.h"