about summary refs log tree commit diff
path: root/nixpkgs/pkgs/misc/drivers/utsushi/patches/absolute_path_for_tesseract.patch
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/misc/drivers/utsushi/patches/absolute_path_for_tesseract.patch')
-rw-r--r--nixpkgs/pkgs/misc/drivers/utsushi/patches/absolute_path_for_tesseract.patch56
1 files changed, 56 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/misc/drivers/utsushi/patches/absolute_path_for_tesseract.patch b/nixpkgs/pkgs/misc/drivers/utsushi/patches/absolute_path_for_tesseract.patch
new file mode 100644
index 000000000000..d4d444979210
--- /dev/null
+++ b/nixpkgs/pkgs/misc/drivers/utsushi/patches/absolute_path_for_tesseract.patch
@@ -0,0 +1,56 @@
+Index: utsushi-0.57.0/filters/reorient.cpp
+===================================================================
+--- utsushi-0.57.0.orig/filters/reorient.cpp
++++ utsushi-0.57.0/filters/reorient.cpp
+@@ -96,8 +96,8 @@ chomp (char *str)
+ bool
+ tesseract_version_before_(const char *cutoff)
+ {
+-  FILE *fp = popen ("tesseract --version 2>&1"
+-                    "| awk '/^tesseract/{ print $2 }'", "r");
++  FILE *fp = popen (TESSERACT " --version 2>&1"
++                    "| " AWK " '/^tesseract/{ print $2 }'", "r");
+   int errc = errno;
+ 
+   if (fp)
+@@ -126,7 +126,7 @@ tesseract_version_before_(const char *cu
+ bool
+ have_tesseract_language_pack_(const char *lang)
+ {
+-  std::string cmd("tesseract --list-langs 2>&1"
++  std::string cmd(TESSERACT " --list-langs 2>&1"
+                   "| sed -n '/^");
+   cmd += lang;
+   cmd += "$/p'";
+@@ -291,7 +291,7 @@ reorient::reorient ()
+ 
+   if (found)
+     {
+-      if (have_tesseract_())  engine_ = "tesseract";
++      if (have_tesseract_())  engine_ = TESSERACT;
+       if (have_ocr_engine_()) engine_ = abs_path_name;
+     }
+   freeze_options ();   // initializes option tracking member variables
+Index: utsushi-0.57.0/configure.ac
+===================================================================
+--- utsushi-0.57.0.orig/configure.ac
++++ utsushi-0.57.0/configure.ac
+@@ -196,6 +196,8 @@ AC_DEFINE([HAVE_IMAGE_MAGICK_PP],
+   [0], [Define to 1 if ImageMagick's C++ API is usable])
+ AC_DEFINE([MAGICK_CONVERT],
+   [], [Define to an appropriate command-line invocation for convert])
++AC_DEFINE([TESSERACT],
++  [], [Define to an appropriate command-line invocation for tesseract])
+ AC_DEFINE([WITH_INCLUDED_BOOST],
+   [0], [Define to 1 if using the included Boost sources])
+ 
+@@ -419,6 +421,9 @@ AS_IF([test xno != "x$with_magick"],
+ AC_DEFINE_UNQUOTED([MAGICK_CONVERT], ["$MAGICK_CONVERT"])
+ AM_CONDITIONAL([have_magick], [test x != "x$HAVE_MAGICK"])
+ 
++AC_PATH_PROG([TESSERACT], [tesseract], [tesseract])
++AC_DEFINE_UNQUOTED([TESSERACT], ["$TESSERACT"])
++
+ AS_IF([test xno != "x$with_gtkmm"],
+   [PKG_CHECK_MODULES([LIBGTKMM], [gtkmm-2.4 >= 2.20],
+      [AC_DEFINE([HAVE_LIBGTKMM], [1])],