unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#46377] [PATCH] gnu: tesseract-ocr: update to 4.1.1
@ 2021-02-08  6:32 Andy Tai
  2021-02-08  6:42 ` [bug#46376] " Andy Tai
       [not found] ` <handler.46377.B.161277624811801.ack@debbugs.gnu.org>
  0 siblings, 2 replies; 16+ messages in thread
From: Andy Tai @ 2021-02-08  6:32 UTC (permalink / raw)
  To: 46377

* gnu/packages/ocr.scm (tesseract-ocr): update to 4.1.1
---
 gnu/packages/ocr.scm | 38 +++++++++++++++++++++++++++++++-------
 1 file changed, 31 insertions(+), 7 deletions(-)

diff --git a/gnu/packages/ocr.scm b/gnu/packages/ocr.scm
index dc4930918a..7fc3929684 100644
--- a/gnu/packages/ocr.scm
+++ b/gnu/packages/ocr.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2016, 2020 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2019 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2019 Alex Vong <alexvong1995@gmail.com>
+;;; Copyright © 2021 Andy Tai <atai@atai.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -26,7 +27,12 @@
   #:use-module (guix git-download)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system python)
+  #:use-module (gnu packages autotools)
+  #:use-module (gnu packages check)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages gtk)
+  #:use-module (gnu packages icu4c)
+  #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
   #:use-module (gnu packages image))

@@ -52,25 +58,43 @@ it produces text in 8-bit or UTF-8 formats.")
     (license license:gpl3+)))

 (define-public tesseract-ocr
+  ;; some useful commits beyond last official stable release in release branch
+  (let ((commit "97079fa353557af6df86fd20b5d2e0dff5d8d5df"))
   (package
     (name "tesseract-ocr")
-    (version "3.04.01")
+    (version "4.1.1")
     (source
      (origin
        (method git-fetch)
        (uri (git-reference
               (url "https://github.com/tesseract-ocr/tesseract")
-              (commit version)))
-       (file-name (git-file-name name version))
+              (commit commit)
+              ;; Fetch git submodules otherwise typeshed is not fetched.
+              ;; Typeshed is a collection of Python sources type annotation
+              ;; (data) files.
+              (recursive? #t)))
+       (file-name (string-append name "-" version "-" commit "-checkout"))
        (sha256
-        (base32 "0h1x4z1h86n2gwknd0wck6gykkp99bmm02lg4a47a698g4az6ybv"))))
+        (base32 "0axwla82fpzp86lc553wp3hk0fz5dylw4as0jbf4hkqcyajlbzp4"))))
     (build-system gnu-build-system)
     (inputs
-     `(("leptonica" ,leptonica)))
+     `(  ("cairo" ,cairo)
+         ("icu" ,icu4c)
+         ("leptonica" ,leptonica)
+         ("pango" ,pango)))
+    (native-inputs
+     `(("autoconf" ,autoconf)
+       ("autoconf-archive" ,autoconf-archive)
+       ("automake" ,automake)
+       ("googletest" ,googletest)
+       ("libtool" ,libtool)
+       ("pkg-config" ,pkg-config)))
     (arguments
      '(#:configure-flags
        (let ((leptonica (assoc-ref %build-inputs "leptonica")))
-         (list (string-append "LIBLEPT_HEADERSDIR=" leptonica "/include")))))
+         (list (string-append "LIBLEPT_HEADERSDIR=" leptonica "/include")))
+       ;; some test, applybox_test fails to build
+       #:tests? #f))
     (home-page "https://github.com/tesseract-ocr/tesseract")
     (synopsis "Optical character recognition engine")
     (description
@@ -79,7 +103,7 @@ high accuracy.  It supports many languages, output
text formatting, hOCR
 positional information and page layout analysis.  Several image formats are
 supported through the Leptonica library.  It can also detect whether text is
 monospaced or proportional.")
-    (license license:asl2.0)))
+    (license license:asl2.0))))

 (define-public zinnia
   (let* ((commit "581faa8f6f15e4a7b21964be3a5ec36265c80e5b")
-- 
2.30.0




^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [bug#46376] [PATCH] gnu: tesseract-ocr: update to 4.1.1
  2021-02-08  6:32 [bug#46377] [PATCH] gnu: tesseract-ocr: update to 4.1.1 Andy Tai
@ 2021-02-08  6:42 ` Andy Tai
       [not found]   ` <handler.46376.B.161276666727875.ack@debbugs.gnu.org>
       [not found] ` <handler.46377.B.161277624811801.ack@debbugs.gnu.org>
  1 sibling, 1 reply; 16+ messages in thread
From: Andy Tai @ 2021-02-08  6:42 UTC (permalink / raw)
  To: 46376

* gnu/packages/ocr.scm (tesseract-ocr): update to 4.1.1
---
 gnu/packages/ocr.scm | 38 +++++++++++++++++++++++++++++++-------
 1 file changed, 31 insertions(+), 7 deletions(-)

diff --git a/gnu/packages/ocr.scm b/gnu/packages/ocr.scm
index dc4930918a..7fc3929684 100644
--- a/gnu/packages/ocr.scm
+++ b/gnu/packages/ocr.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2016, 2020 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2019 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2019 Alex Vong <alexvong1995@gmail.com>
+;;; Copyright © 2021 Andy Tai <atai@atai.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -26,7 +27,12 @@
   #:use-module (guix git-download)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system python)
+  #:use-module (gnu packages autotools)
+  #:use-module (gnu packages check)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages gtk)
+  #:use-module (gnu packages icu4c)
+  #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
   #:use-module (gnu packages image))

@@ -52,25 +58,43 @@ it produces text in 8-bit or UTF-8 formats.")
     (license license:gpl3+)))

 (define-public tesseract-ocr
+  ;; some useful commits beyond last official stable release in release branch
+  (let ((commit "97079fa353557af6df86fd20b5d2e0dff5d8d5df"))
   (package
     (name "tesseract-ocr")
-    (version "3.04.01")
+    (version "4.1.1")
     (source
      (origin
        (method git-fetch)
        (uri (git-reference
               (url "https://github.com/tesseract-ocr/tesseract")
-              (commit version)))
-       (file-name (git-file-name name version))
+              (commit commit)
+              ;; Fetch git submodules otherwise typeshed is not fetched.
+              ;; Typeshed is a collection of Python sources type annotation
+              ;; (data) files.
+              (recursive? #t)))
+       (file-name (string-append name "-" version "-" commit "-checkout"))
        (sha256
-        (base32 "0h1x4z1h86n2gwknd0wck6gykkp99bmm02lg4a47a698g4az6ybv"))))
+        (base32 "0axwla82fpzp86lc553wp3hk0fz5dylw4as0jbf4hkqcyajlbzp4"))))
     (build-system gnu-build-system)
     (inputs
-     `(("leptonica" ,leptonica)))
+     `(  ("cairo" ,cairo)
+         ("icu" ,icu4c)
+         ("leptonica" ,leptonica)
+         ("pango" ,pango)))
+    (native-inputs
+     `(("autoconf" ,autoconf)
+       ("autoconf-archive" ,autoconf-archive)
+       ("automake" ,automake)
+       ("googletest" ,googletest)
+       ("libtool" ,libtool)
+       ("pkg-config" ,pkg-config)))
     (arguments
      '(#:configure-flags
        (let ((leptonica (assoc-ref %build-inputs "leptonica")))
-         (list (string-append "LIBLEPT_HEADERSDIR=" leptonica "/include")))))
+         (list (string-append "LIBLEPT_HEADERSDIR=" leptonica "/include")))
+       ;; some test, applybox_test fails to build
+       #:tests? #f))
     (home-page "https://github.com/tesseract-ocr/tesseract")
     (synopsis "Optical character recognition engine")
     (description
@@ -79,7 +103,7 @@ high accuracy.  It supports many languages, output
text formatting, hOCR
 positional information and page layout analysis.  Several image formats are
 supported through the Leptonica library.  It can also detect whether text is
 monospaced or proportional.")
-    (license license:asl2.0)))
+    (license license:asl2.0))))

 (define-public zinnia
   (let* ((commit "581faa8f6f15e4a7b21964be3a5ec36265c80e5b")
--
2.30.0




^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [bug#46376] [PATCH] gnu: tesseract-ocr: update to 4.1.1)
       [not found]   ` <handler.46376.B.161276666727875.ack@debbugs.gnu.org>
@ 2021-02-08  6:51     ` Andy Tai
  2021-02-08 21:36       ` Jelle Licht
  0 siblings, 1 reply; 16+ messages in thread
From: Andy Tai @ 2021-02-08  6:51 UTC (permalink / raw)
  To: 46376

* gnu/packages/ocr.scm (tesseract-ocr): update to 4.1.1
---
 gnu/packages/ocr.scm | 36 +++++++++++++++++++++++++++++-------
 1 file changed, 29 insertions(+), 7 deletions(-)

diff --git a/gnu/packages/ocr.scm b/gnu/packages/ocr.scm
index dc4930918a..b666ec5aab 100644
--- a/gnu/packages/ocr.scm
+++ b/gnu/packages/ocr.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2016, 2020 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2019 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2019 Alex Vong <alexvong1995@gmail.com>
+;;; Copyright © 2021 Andy Tai <atai@atai.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -26,7 +27,12 @@
   #:use-module (guix git-download)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system python)
+  #:use-module (gnu packages autotools)
+  #:use-module (gnu packages check)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages gtk)
+  #:use-module (gnu packages icu4c)
+  #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
   #:use-module (gnu packages image))

@@ -52,25 +58,41 @@ it produces text in 8-bit or UTF-8 formats.")
     (license license:gpl3+)))

 (define-public tesseract-ocr
+  ;; some useful commits beyond last official stable release in release branch
+  (let ((commit "97079fa353557af6df86fd20b5d2e0dff5d8d5df"))
   (package
     (name "tesseract-ocr")
-    (version "3.04.01")
+    (version "4.1.1")
     (source
      (origin
        (method git-fetch)
        (uri (git-reference
               (url "https://github.com/tesseract-ocr/tesseract")
-              (commit version)))
-       (file-name (git-file-name name version))
+              (commit commit)
+              ;; Fetch git submodules
+              (recursive? #t)))
+       (file-name (string-append name "-" version "-" commit "-checkout"))
        (sha256
-        (base32 "0h1x4z1h86n2gwknd0wck6gykkp99bmm02lg4a47a698g4az6ybv"))))
+        (base32 "0axwla82fpzp86lc553wp3hk0fz5dylw4as0jbf4hkqcyajlbzp4"))))
     (build-system gnu-build-system)
     (inputs
-     `(("leptonica" ,leptonica)))
+     `(  ("cairo" ,cairo)
+         ("icu" ,icu4c)
+         ("leptonica" ,leptonica)
+         ("pango" ,pango)))
+    (native-inputs
+     `(("autoconf" ,autoconf)
+       ("autoconf-archive" ,autoconf-archive)
+       ("automake" ,automake)
+       ("googletest" ,googletest)
+       ("libtool" ,libtool)
+       ("pkg-config" ,pkg-config)))
     (arguments
      '(#:configure-flags
        (let ((leptonica (assoc-ref %build-inputs "leptonica")))
-         (list (string-append "LIBLEPT_HEADERSDIR=" leptonica "/include")))))
+         (list (string-append "LIBLEPT_HEADERSDIR=" leptonica "/include")))
+       ;; some test, applybox_test fails to build
+       #:tests? #f))
     (home-page "https://github.com/tesseract-ocr/tesseract")
     (synopsis "Optical character recognition engine")
     (description
@@ -79,7 +101,7 @@ high accuracy.  It supports many languages, output
text formatting, hOCR
 positional information and page layout analysis.  Several image formats are
 supported through the Leptonica library.  It can also detect whether text is
 monospaced or proportional.")
-    (license license:asl2.0)))
+    (license license:asl2.0))))

 (define-public zinnia
   (let* ((commit "581faa8f6f15e4a7b21964be3a5ec36265c80e5b")
-- 
2.30.0




^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [bug#46377] Acknowledgement ([PATCH] gnu: tesseract-ocr: update to 4.1.1)
       [not found] ` <handler.46377.B.161277624811801.ack@debbugs.gnu.org>
@ 2021-02-08 17:53   ` Andy Tai
  0 siblings, 0 replies; 16+ messages in thread
From: Andy Tai @ 2021-02-08 17:53 UTC (permalink / raw)
  To: 46377

Please close this.   This bug is duplicate of Bug 46376
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=46376




^ permalink raw reply	[flat|nested] 16+ messages in thread

* [bug#46376] [PATCH] gnu: tesseract-ocr: update to 4.1.1)
  2021-02-08  6:51     ` [bug#46376] [PATCH] gnu: tesseract-ocr: update to 4.1.1) Andy Tai
@ 2021-02-08 21:36       ` Jelle Licht
  2021-02-08 23:14         ` Andy Tai
  0 siblings, 1 reply; 16+ messages in thread
From: Jelle Licht @ 2021-02-08 21:36 UTC (permalink / raw)
  To: Andy Tai, 46376

Hello Andy,

Thanks for working on this package! I was not able to cleanly apply any
of the patches, but that problem might be on my end though.

Something did seem to go wrong though, as I notice three patches that do
the same (from a quick glance).

I have some nitpicks, some of them more serious than others;

Andy Tai <atai@atai.org> writes:

> * gnu/packages/ocr.scm (tesseract-ocr): update to 4.1.1
                                          ^ This is usually capitalised.
> [snip]
>  (define-public tesseract-ocr
> +  ;; some useful commits beyond last official stable release in release branch
> +  (let ((commit "97079fa353557af6df86fd20b5d2e0dff5d8d5df"))
>    (package
>      (name "tesseract-ocr")
> -    (version "3.04.01")
> +    (version "4.1.1")
                ^ Since we are not _actually_ using version 4.1.1, but a
                  later commit, you could use
                  `(git-version "4.1.1" revision commit)' here instead


>      (source
>       (origin
>         (method git-fetch)
>         (uri (git-reference
>                (url "https://github.com/tesseract-ocr/tesseract")
> -              (commit version)))
> -       (file-name (git-file-name name version))
> +              (commit commit)
> +              ;; Fetch git submodules
> +              (recursive? #t)))

Instead of stating what the code does, would you consider adding a
comment why this is needed?

> +       (file-name (string-append name "-" version "-" commit "-checkout"))
                     ^ You can use `(git-file-name name version)' here.

>         (sha256
> -        (base32 "0h1x4z1h86n2gwknd0wck6gykkp99bmm02lg4a47a698g4az6ybv"))))
> +        (base32 "0axwla82fpzp86lc553wp3hk0fz5dylw4as0jbf4hkqcyajlbzp4"))))
>      (build-system gnu-build-system)
>      (inputs
> -     `(("leptonica" ,leptonica)))
> +     `(  ("cairo" ,cairo)
> +         ("icu" ,icu4c)
> +         ("leptonica" ,leptonica)
> +         ("pango" ,pango)))
> +    (native-inputs
> +     `(("autoconf" ,autoconf)
> +       ("autoconf-archive" ,autoconf-archive)
> +       ("automake" ,automake)
> +       ("googletest" ,googletest)
> +       ("libtool" ,libtool)
> +       ("pkg-config" ,pkg-config)))
>      (arguments
>       '(#:configure-flags
>         (let ((leptonica (assoc-ref %build-inputs "leptonica")))
> -         (list (string-append "LIBLEPT_HEADERSDIR=" leptonica "/include")))))
> +         (list (string-append "LIBLEPT_HEADERSDIR=" leptonica "/include")))
> +       ;; some test, applybox_test fails to build
> +       #:tests? #f))
 2 nits: Is it possible to patch or disable only the failing tests?
 Is there a reason googletest is added if testing is subsequently disabled?

Thanks,
 - Jelle




^ permalink raw reply	[flat|nested] 16+ messages in thread

* [bug#46376] [PATCH] gnu: tesseract-ocr: update to 4.1.1)
  2021-02-08 21:36       ` Jelle Licht
@ 2021-02-08 23:14         ` Andy Tai
  2021-02-09 11:56           ` Jelle Licht
  0 siblings, 1 reply; 16+ messages in thread
From: Andy Tai @ 2021-02-08 23:14 UTC (permalink / raw)
  To: Jelle Licht; +Cc: 46376

[-- Attachment #1: Type: text/plain, Size: 3093 bytes --]

updated patch attached


On Mon, Feb 8, 2021 at 1:36 PM Jelle Licht <jlicht@posteo.net> wrote:
>
>
> > * gnu/packages/ocr.scm (tesseract-ocr): update to 4.1.1
>                                           ^ This is usually capitalised.

capitalized

> > [snip]
> >  (define-public tesseract-ocr
> > +  ;; some useful commits beyond last official stable release in release branch
> > +  (let ((commit "97079fa353557af6df86fd20b5d2e0dff5d8d5df"))
> >    (package
> >      (name "tesseract-ocr")
> > -    (version "3.04.01")
> > +    (version "4.1.1")
>                 ^ Since we are not _actually_ using version 4.1.1, but a
>                   later commit, you could use
>                   `(git-version "4.1.1" revision commit)' here instead

changed as suggested
>
> >      (source
> >       (origin
> >         (method git-fetch)
> >         (uri (git-reference
> >                (url "https://github.com/tesseract-ocr/tesseract")
> > -              (commit version)))
> > -       (file-name (git-file-name name version))
> > +              (commit commit)
> > +              ;; Fetch git submodules
> > +              (recursive? #t)))
>
> Instead of stating what the code does, would you consider adding a
> comment why this is needed?
>

commented as suggested

> > +       (file-name (string-append name "-" version "-" commit "-checkout"))
>                      ^ You can use `(git-file-name name version)' here.
>

changed as suggested

> >         (sha256
> > -        (base32 "0h1x4z1h86n2gwknd0wck6gykkp99bmm02lg4a47a698g4az6ybv"))))
> > +        (base32 "0axwla82fpzp86lc553wp3hk0fz5dylw4as0jbf4hkqcyajlbzp4"))))
> >      (build-system gnu-build-system)
> >      (inputs
> > -     `(("leptonica" ,leptonica)))
> > +     `(  ("cairo" ,cairo)
> > +         ("icu" ,icu4c)
> > +         ("leptonica" ,leptonica)
> > +         ("pango" ,pango)))
> > +    (native-inputs
> > +     `(("autoconf" ,autoconf)
> > +       ("autoconf-archive" ,autoconf-archive)
> > +       ("automake" ,automake)
> > +       ("googletest" ,googletest)
> > +       ("libtool" ,libtool)
> > +       ("pkg-config" ,pkg-config)))
> >      (arguments
> >       '(#:configure-flags
> >         (let ((leptonica (assoc-ref %build-inputs "leptonica")))
> > -         (list (string-append "LIBLEPT_HEADERSDIR=" leptonica "/include")))))
> > +         (list (string-append "LIBLEPT_HEADERSDIR=" leptonica "/include")))
> > +       ;; some test, applybox_test fails to build
> > +       #:tests? #f))
>  2 nits: Is it possible to patch or disable only the failing tests?

tests failing to build probably due to some issue with parallel
builds; did not dig into it as probably will take much time; will be
TODO if time allows)

>  Is there a reason googletest is added if testing is subsequently disabled?
>

removed

> Thanks,
>  - Jelle



--
Andy Tai, atai@atai.org, Skype: licheng.tai, Line: andy_tai, WeChat: andytai1010
Year 2021 民國110年
自動的精神力是信仰與覺悟
自動的行為力是勞動與技能

[-- Attachment #2: 0001-gnu-tesseract-ocr-Update-to-4.1.1.patch --]
[-- Type: text/x-patch, Size: 3521 bytes --]

From 7ab7fcbb95d933f6a7ba3e688131caa0435bdfdd Mon Sep 17 00:00:00 2001
From: Andy Tai <atai@atai.org>
Date: Sun, 7 Feb 2021 22:23:47 -0800
Subject: [PATCH] gnu: tesseract-ocr: Update to 4.1.1

* gnu/packages/ocr.scm (tesseract-ocr): Update to 4.1.1
---
 gnu/packages/ocr.scm | 34 ++++++++++++++++++++++++++++------
 1 file changed, 28 insertions(+), 6 deletions(-)

diff --git a/gnu/packages/ocr.scm b/gnu/packages/ocr.scm
index dc4930918a..0d357726b2 100644
--- a/gnu/packages/ocr.scm
+++ b/gnu/packages/ocr.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2016, 2020 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2019 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2019 Alex Vong <alexvong1995@gmail.com>
+;;; Copyright © 2021 Andy Tai <atai@atai.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -26,7 +27,12 @@
   #:use-module (guix git-download)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system python)
+  #:use-module (gnu packages autotools)
+  #:use-module (gnu packages check)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages gtk)
+  #:use-module (gnu packages icu4c)
+  #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
   #:use-module (gnu packages image))
 
@@ -52,25 +58,41 @@ it produces text in 8-bit or UTF-8 formats.")
     (license license:gpl3+)))
 
 (define-public tesseract-ocr
+  ;; some useful commits beyond last official stable release in release branch
+  (let ((commit "97079fa353557af6df86fd20b5d2e0dff5d8d5df")
+        (revision "1"))
   (package
     (name "tesseract-ocr")
-    (version "3.04.01")
+    (version (git-version "4.1.1" revision commit))
     (source
      (origin
        (method git-fetch)
        (uri (git-reference
               (url "https://github.com/tesseract-ocr/tesseract")
-              (commit version)))
+              (commit commit)
+              ;; source git repo with submodules; ensure they are fetched
+              (recursive? #t)))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "0h1x4z1h86n2gwknd0wck6gykkp99bmm02lg4a47a698g4az6ybv"))))
+        (base32 "0axwla82fpzp86lc553wp3hk0fz5dylw4as0jbf4hkqcyajlbzp4"))))
     (build-system gnu-build-system)
     (inputs
-     `(("leptonica" ,leptonica)))
+     `(  ("cairo" ,cairo)
+         ("icu" ,icu4c)
+         ("leptonica" ,leptonica)
+         ("pango" ,pango)))
+    (native-inputs
+     `(("autoconf" ,autoconf)
+       ("autoconf-archive" ,autoconf-archive)
+       ("automake" ,automake)
+       ("libtool" ,libtool)
+       ("pkg-config" ,pkg-config)))
     (arguments
      '(#:configure-flags
        (let ((leptonica (assoc-ref %build-inputs "leptonica")))
-         (list (string-append "LIBLEPT_HEADERSDIR=" leptonica "/include")))))
+         (list (string-append "LIBLEPT_HEADERSDIR=" leptonica "/include")))
+       ;; some test, applybox_test fails to build
+       #:tests? #f))
     (home-page "https://github.com/tesseract-ocr/tesseract")
     (synopsis "Optical character recognition engine")
     (description
@@ -79,7 +101,7 @@ high accuracy.  It supports many languages, output text formatting, hOCR
 positional information and page layout analysis.  Several image formats are
 supported through the Leptonica library.  It can also detect whether text is
 monospaced or proportional.")
-    (license license:asl2.0)))
+    (license license:asl2.0))))
 
 (define-public zinnia
   (let* ((commit "581faa8f6f15e4a7b21964be3a5ec36265c80e5b")
-- 
2.30.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [bug#46376] [PATCH] gnu: tesseract-ocr: update to 4.1.1)
  2021-02-08 23:14         ` Andy Tai
@ 2021-02-09 11:56           ` Jelle Licht
  2021-02-09 16:22             ` Andy Tai
  0 siblings, 1 reply; 16+ messages in thread
From: Jelle Licht @ 2021-02-09 11:56 UTC (permalink / raw)
  To: Andy Tai; +Cc: 46376

Hello Andy,

I have some additional questions about your updated patch.

Andy Tai <atai@atai.org> writes:

> updated patch attached
>> > -       (file-name (git-file-name name version))
>> > +              (commit commit)
>> > +              ;; Fetch git submodules
>> > +              (recursive? #t)))
>>
>> Instead of stating what the code does, would you consider adding a
>> comment why this is needed?
>>
>
> commented as suggested

I was unclear in my message: Of course there are some submodules that
are being fetched; why should we fetch them in the first place? From
a cursory glance, they seem required to do stuff such as running the
tests, which in this iteration of the patch are not being run.

FWIW, leaving out the `recursive? #t' still allows me to build
tesseract-ocr: could you try and see if it makes a difference in your
use of tesseract?

>> >      (inputs
>> > -     `(("leptonica" ,leptonica)))
>> > +     `(  ("cairo" ,cairo)
>> > +         ("icu" ,icu4c)
>> > +         ("leptonica" ,leptonica)
>> > +         ("pango" ,pango)))

I just built the package: no references are made to cairo, icu4c and
pango, and tesseract seems to build fine without them: is there a
specific reason why these were added to the inputs?

>> > +    (native-inputs
>> > +     `(("autoconf" ,autoconf)
>> > +       ("autoconf-archive" ,autoconf-archive)
>> > +       ("automake" ,automake)
>> > +       ("googletest" ,googletest)
>> > +       ("libtool" ,libtool)
>> > +       ("pkg-config" ,pkg-config)))
>> >      (arguments
>> >       '(#:configure-flags
>> >         (let ((leptonica (assoc-ref %build-inputs "leptonica")))
>> > -         (list (string-append "LIBLEPT_HEADERSDIR=" leptonica "/include")))))
>> > +         (list (string-append "LIBLEPT_HEADERSDIR=" leptonica "/include")))
>> > +       ;; some test, applybox_test fails to build
>> > +       #:tests? #f))
>>  2 nits: Is it possible to patch or disable only the failing tests?
>
> tests failing to build probably due to some issue with parallel
> builds; did not dig into it as probably will take much time; will be
> TODO if time allows)

I'll defer to someone with more experience with tesseract, as I have no
experience to speak of on whether this leads to us having a (subtly)
broken package.

Adding the following arguments might help to validate your assumption:
`#:make-flags (list "-j" "1")'.

Thanks,
 - Jelle




^ permalink raw reply	[flat|nested] 16+ messages in thread

* [bug#46376] [PATCH] gnu: tesseract-ocr: update to 4.1.1)
  2021-02-09 11:56           ` Jelle Licht
@ 2021-02-09 16:22             ` Andy Tai
  2021-02-09 22:43               ` Jelle Licht
  0 siblings, 1 reply; 16+ messages in thread
From: Andy Tai @ 2021-02-09 16:22 UTC (permalink / raw)
  To: Jelle Licht; +Cc: 46376

[-- Attachment #1: Type: text/plain, Size: 457 bytes --]

Hi, I updated the patch to only build in serial, with "-j 1"

and with this, everything, including tests, builds successfully.

Not sure if there is a way to specify only building the tests with "-j 1"

In any case, the updated patch is attached

Thanks

On Tue, Feb 9, 2021 at 3:56 AM Jelle Licht <jlicht@posteo.net> wrote:
>
> Adding the following arguments might help to validate your assumption:
> `#:make-flags (list "-j" "1")'.
>
> Thanks,
>  - Jelle

[-- Attachment #2: 0001-gnu-tesseract-ocr-Update-to-4.1.1.patch --]
[-- Type: text/x-patch, Size: 3461 bytes --]

From 5fde44f0d89660af23672ce16c640df7a9947fa2 Mon Sep 17 00:00:00 2001
From: Andy Tai <atai@atai.org>
Date: Tue, 9 Feb 2021 08:16:30 -0800
Subject: [PATCH] gnu: tesseract-ocr: Update to 4.1.1)

* gnu/packages/ocr.scm (tesseract-ocr): Update to 4.1.1
---
 gnu/packages/ocr.scm | 34 ++++++++++++++++++++++++++++------
 1 file changed, 28 insertions(+), 6 deletions(-)

diff --git a/gnu/packages/ocr.scm b/gnu/packages/ocr.scm
index dc4930918a..37b6771db5 100644
--- a/gnu/packages/ocr.scm
+++ b/gnu/packages/ocr.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2016, 2020 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2019 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2019 Alex Vong <alexvong1995@gmail.com>
+;;; Copyright © 2021 Andy Tai <atai@atai.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -26,7 +27,12 @@
   #:use-module (guix git-download)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system python)
+  #:use-module (gnu packages autotools)
+  #:use-module (gnu packages check)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages gtk)
+  #:use-module (gnu packages icu4c)
+  #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
   #:use-module (gnu packages image))
 
@@ -52,23 +58,39 @@ it produces text in 8-bit or UTF-8 formats.")
     (license license:gpl3+)))
 
 (define-public tesseract-ocr
+  ;; some useful commits beyond last official stable release in release branch
+  (let ((commit "97079fa353557af6df86fd20b5d2e0dff5d8d5df")
+        (revision "1"))
   (package
     (name "tesseract-ocr")
-    (version "3.04.01")
+    (version (git-version "4.1.1" revision commit))
     (source
      (origin
        (method git-fetch)
        (uri (git-reference
               (url "https://github.com/tesseract-ocr/tesseract")
-              (commit version)))
+              (commit commit)
+              ;; source git repo with submodules; ensure they are fetched
+              (recursive? #t)))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "0h1x4z1h86n2gwknd0wck6gykkp99bmm02lg4a47a698g4az6ybv"))))
+        (base32 "0axwla82fpzp86lc553wp3hk0fz5dylw4as0jbf4hkqcyajlbzp4"))))
     (build-system gnu-build-system)
     (inputs
-     `(("leptonica" ,leptonica)))
+     `(  ("cairo" ,cairo)
+         ("icu" ,icu4c)
+         ("leptonica" ,leptonica)
+         ("pango" ,pango)))
+    (native-inputs
+     `(("autoconf" ,autoconf)
+       ("autoconf-archive" ,autoconf-archive)
+       ("automake" ,automake)
+       ("googletest" ,googletest)
+       ("libtool" ,libtool)
+       ("pkg-config" ,pkg-config)))
     (arguments
-     '(#:configure-flags
+     '(#:make-flags (list "-j" "1") ;; some test, applybox_test fails to build if built in parallel
+       #:configure-flags
        (let ((leptonica (assoc-ref %build-inputs "leptonica")))
          (list (string-append "LIBLEPT_HEADERSDIR=" leptonica "/include")))))
     (home-page "https://github.com/tesseract-ocr/tesseract")
@@ -79,7 +101,7 @@ high accuracy.  It supports many languages, output text formatting, hOCR
 positional information and page layout analysis.  Several image formats are
 supported through the Leptonica library.  It can also detect whether text is
 monospaced or proportional.")
-    (license license:asl2.0)))
+    (license license:asl2.0))))
 
 (define-public zinnia
   (let* ((commit "581faa8f6f15e4a7b21964be3a5ec36265c80e5b")
-- 
2.30.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [bug#46376] [PATCH] gnu: tesseract-ocr: update to 4.1.1)
  2021-02-09 16:22             ` Andy Tai
@ 2021-02-09 22:43               ` Jelle Licht
  2021-02-09 22:53                 ` Andy Tai
  2021-02-10  7:52                 ` Andy Tai
  0 siblings, 2 replies; 16+ messages in thread
From: Jelle Licht @ 2021-02-09 22:43 UTC (permalink / raw)
  To: Andy Tai; +Cc: 46376

Hi Andy,

Andy Tai <atai@atai.org> writes:

> Hi, I updated the patch to only build in serial, with "-j 1"
>
> and with this, everything, including tests, builds successfully.

No such luck, for me at least. Are you certain you got it to build on
your end? Could you try with `--check`?

I've had to work out the following things:

- Patched out "<tesseract/baseapi.h>" and "<tesseract/helpers.h>" to
  refer to "baseapi.h" and "helpers.h" in "unittest/pagesegmode_test.cc".

- Make sure the check phase takes place after running "make training" in
  a phase.

I still ended up with several failing tests, courtesy of it running
unsupported instructions on my cpu (educated guess: avx etc). Nothing
comes easy, I guess.

Thanks,
 - Jelle




^ permalink raw reply	[flat|nested] 16+ messages in thread

* [bug#46376] [PATCH] gnu: tesseract-ocr: update to 4.1.1)
  2021-02-09 22:43               ` Jelle Licht
@ 2021-02-09 22:53                 ` Andy Tai
  2021-02-10  7:52                 ` Andy Tai
  1 sibling, 0 replies; 16+ messages in thread
From: Andy Tai @ 2021-02-09 22:53 UTC (permalink / raw)
  To: Jelle Licht; +Cc: 46376

Strange.  I did use --check to build,  And I need to make no changes
to the checked out sources.  So our environment seems to have
significant differences?

That under guix makes no sense.

On Tue, Feb 9, 2021 at 2:43 PM Jelle Licht <jlicht@posteo.net> wrote:
>
> Hi Andy,
>
> Andy Tai <atai@atai.org> writes:
>
> > Hi, I updated the patch to only build in serial, with "-j 1"
> >
> > and with this, everything, including tests, builds successfully.
>
> No such luck, for me at least. Are you certain you got it to build on
> your end? Could you try with `--check`?
>
> I've had to work out the following things:
>
> - Patched out "<tesseract/baseapi.h>" and "<tesseract/helpers.h>" to
>   refer to "baseapi.h" and "helpers.h" in "unittest/pagesegmode_test.cc".
>
> - Make sure the check phase takes place after running "make training" in
>   a phase.
>
> I still ended up with several failing tests, courtesy of it running
> unsupported instructions on my cpu (educated guess: avx etc). Nothing
> comes easy, I guess.
>
> Thanks,
>  - Jelle



-- 
Andy Tai, atai@atai.org, Skype: licheng.tai, Line: andy_tai, WeChat: andytai1010
Year 2021 民國110年
自動的精神力是信仰與覺悟
自動的行為力是勞動與技能




^ permalink raw reply	[flat|nested] 16+ messages in thread

* [bug#46376] [PATCH] gnu: tesseract-ocr: update to 4.1.1)
  2021-02-09 22:43               ` Jelle Licht
  2021-02-09 22:53                 ` Andy Tai
@ 2021-02-10  7:52                 ` Andy Tai
  2021-02-11  0:00                   ` Andy Tai
  1 sibling, 1 reply; 16+ messages in thread
From: Andy Tai @ 2021-02-10  7:52 UTC (permalink / raw)
  To: Jelle Licht; +Cc: 46376

[-- Attachment #1: Type: text/plain, Size: 1357 bytes --]

updated patch, now tests build in parallel... the build order has to
be explicitly set to make the training target built first

also added some other optional dependencies; built in a GuixSD VM to
ensure no dependency on non-Guix tools from host

test run is disabled for now

On Tue, Feb 9, 2021 at 2:43 PM Jelle Licht <jlicht@posteo.net> wrote:
>
> Hi Andy,
>
> Andy Tai <atai@atai.org> writes:
>
> > Hi, I updated the patch to only build in serial, with "-j 1"
> >
> > and with this, everything, including tests, builds successfully.
>
> No such luck, for me at least. Are you certain you got it to build on
> your end? Could you try with `--check`?
>
> I've had to work out the following things:
>
> - Patched out "<tesseract/baseapi.h>" and "<tesseract/helpers.h>" to
>   refer to "baseapi.h" and "helpers.h" in "unittest/pagesegmode_test.cc".
>
> - Make sure the check phase takes place after running "make training" in
>   a phase.
>
> I still ended up with several failing tests, courtesy of it running
> unsupported instructions on my cpu (educated guess: avx etc). Nothing
> comes easy, I guess.
>
> Thanks,
>  - Jelle



-- 
Andy Tai, atai@atai.org, Skype: licheng.tai, Line: andy_tai, WeChat: andytai1010
Year 2021 民國110年
自動的精神力是信仰與覺悟
自動的行為力是勞動與技能

[-- Attachment #2: 0001-gnu-tesseract-ocr-Update-to-4.1.1.patch --]
[-- Type: text/x-patch, Size: 4312 bytes --]

From d3287d74861824dc3a7e2b65e11cd33fa0a11b39 Mon Sep 17 00:00:00 2001
From: andy Tai <atai@atai.org>
Date: Tue, 9 Feb 2021 23:44:06 -0800
Subject: [PATCH] gnu: tesseract-ocr: Update to 4.1.1)

* gnu/packages/ocr.scm (tesseract-ocr): Update to 4.1.1
---
 gnu/packages/ocr.scm | 53 +++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 47 insertions(+), 6 deletions(-)

diff --git a/gnu/packages/ocr.scm b/gnu/packages/ocr.scm
index dc4930918a..1ea7a94085 100644
--- a/gnu/packages/ocr.scm
+++ b/gnu/packages/ocr.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2016, 2020 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2019 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2019 Alex Vong <alexvong1995@gmail.com>
+;;; Copyright © 2021 Andy Tai <atai@atai.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -26,8 +27,17 @@
   #:use-module (guix git-download)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system python)
+  #:use-module (gnu packages)
+  #:use-module (gnu packages autotools)
+  #:use-module (gnu packages backup)
+  #:use-module (gnu packages check)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages curl)
+  #:use-module (gnu packages gtk)
+  #:use-module (gnu packages icu4c)
+  #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages xml)
   #:use-module (gnu packages image))
 
 (define-public ocrad
@@ -52,25 +62,55 @@ it produces text in 8-bit or UTF-8 formats.")
     (license license:gpl3+)))
 
 (define-public tesseract-ocr
+  ;; some useful commits beyond last official stable release in release branch
+  (let ((commit "97079fa353557af6df86fd20b5d2e0dff5d8d5df")
+        (revision "1"))
   (package
     (name "tesseract-ocr")
-    (version "3.04.01")
+    (version (git-version "4.1.1" revision commit))
     (source
      (origin
        (method git-fetch)
        (uri (git-reference
               (url "https://github.com/tesseract-ocr/tesseract")
-              (commit version)))
+              (commit commit)
+              ;; source git repo with submodules; ensure they are fetched
+              (recursive? #t)))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "0h1x4z1h86n2gwknd0wck6gykkp99bmm02lg4a47a698g4az6ybv"))))
+        (base32 "0axwla82fpzp86lc553wp3hk0fz5dylw4as0jbf4hkqcyajlbzp4"))))
     (build-system gnu-build-system)
     (inputs
-     `(("leptonica" ,leptonica)))
+     `(  ("cairo" ,cairo)
+         ("icu" ,icu4c)
+         ("leptonica" ,leptonica)
+         ("pango" ,pango)))
+    (native-inputs
+     `(("autoconf" ,autoconf)
+       ("autoconf-archive" ,autoconf-archive)
+       ("automake" ,automake)
+       ("googletest" ,googletest)
+       ("libarchive" ,libarchive)
+       ("libcurl" ,curl)
+       ("libtool" ,libtool)
+       ("libtiff" ,libtiff)
+       ("pkg-config" ,pkg-config)
+       ("python" ,python-wrapper)
+       ("xsltproc" ,libxslt)))
     (arguments
      '(#:configure-flags
        (let ((leptonica (assoc-ref %build-inputs "leptonica")))
-         (list (string-append "LIBLEPT_HEADERSDIR=" leptonica "/include")))))
+         (list (string-append "LIBLEPT_HEADERSDIR=" leptonica "/include")))
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'check)
+         (add-before 'build 'build-training
+           (lambda _
+             (invoke "make" "training")))
+         (add-after 'install 'install-training
+           (lambda _
+             (invoke "make" "training-install")
+             #t)))))
     (home-page "https://github.com/tesseract-ocr/tesseract")
     (synopsis "Optical character recognition engine")
     (description
@@ -79,7 +119,7 @@ high accuracy.  It supports many languages, output text formatting, hOCR
 positional information and page layout analysis.  Several image formats are
 supported through the Leptonica library.  It can also detect whether text is
 monospaced or proportional.")
-    (license license:asl2.0)))
+    (license license:asl2.0))))
 
 (define-public zinnia
   (let* ((commit "581faa8f6f15e4a7b21964be3a5ec36265c80e5b")
@@ -151,3 +191,4 @@ that allows us to create any hand-written recognition systems with low-cost.")
              #t)))))
     (inputs
      `(("zinnia" ,zinnia)))))
+
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [bug#46376] [PATCH] gnu: tesseract-ocr: update to 4.1.1)
  2021-02-10  7:52                 ` Andy Tai
@ 2021-02-11  0:00                   ` Andy Tai
  2021-02-11 10:48                     ` Jelle Licht
  0 siblings, 1 reply; 16+ messages in thread
From: Andy Tai @ 2021-02-11  0:00 UTC (permalink / raw)
  To: Jelle Licht; +Cc: 46376

[-- Attachment #1: Type: text/plain, Size: 2010 bytes --]

updated patch:

unit tests run, with some failures due to illegal instruction and
others succeed, but these requires first manual downloading of the
training data; I am not sure how that can be done as part of Guix
package definition.  Help on that is much appreciated.  (details
commented in the patch)

On Tue, Feb 9, 2021 at 11:52 PM Andy Tai <atai@atai.org> wrote:
>
> updated patch, now tests build in parallel... the build order has to
> be explicitly set to make the training target built first
>
> also added some other optional dependencies; built in a GuixSD VM to
> ensure no dependency on non-Guix tools from host
>
> test run is disabled for now
>
> On Tue, Feb 9, 2021 at 2:43 PM Jelle Licht <jlicht@posteo.net> wrote:
> >
> > Hi Andy,
> >
> > Andy Tai <atai@atai.org> writes:
> >
> > > Hi, I updated the patch to only build in serial, with "-j 1"
> > >
> > > and with this, everything, including tests, builds successfully.
> >
> > No such luck, for me at least. Are you certain you got it to build on
> > your end? Could you try with `--check`?
> >
> > I've had to work out the following things:
> >
> > - Patched out "<tesseract/baseapi.h>" and "<tesseract/helpers.h>" to
> >   refer to "baseapi.h" and "helpers.h" in "unittest/pagesegmode_test.cc".
> >
> > - Make sure the check phase takes place after running "make training" in
> >   a phase.
> >
> > I still ended up with several failing tests, courtesy of it running
> > unsupported instructions on my cpu (educated guess: avx etc). Nothing
> > comes easy, I guess.
> >
> > Thanks,
> >  - Jelle
>
>
>
> --
> Andy Tai, atai@atai.org, Skype: licheng.tai, Line: andy_tai, WeChat: andytai1010
> Year 2021 民國110年
> 自動的精神力是信仰與覺悟
> 自動的行為力是勞動與技能



-- 
Andy Tai, atai@atai.org, Skype: licheng.tai, Line: andy_tai, WeChat: andytai1010
Year 2021 民國110年
自動的精神力是信仰與覺悟
自動的行為力是勞動與技能

[-- Attachment #2: 0001-gnu-tesseract-ocr-Update-to-4.1.1.patch --]
[-- Type: text/x-patch, Size: 6058 bytes --]

From ead97cb03c783bf6e941a93ca4f2a6c669451656 Mon Sep 17 00:00:00 2001
From: Andy Tai <atai@atai.org>
Date: Wed, 10 Feb 2021 15:56:48 -0800
Subject: [PATCH] gnu: tesseract-ocr: Update to 4.1.1)

* gnu/packages/ocr.scm (tesseract-ocr): Update to 4.1.1
---
 gnu/packages/ocr.scm | 85 ++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 79 insertions(+), 6 deletions(-)

diff --git a/gnu/packages/ocr.scm b/gnu/packages/ocr.scm
index dc4930918a..962492ebb2 100644
--- a/gnu/packages/ocr.scm
+++ b/gnu/packages/ocr.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2016, 2020 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2019 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2019 Alex Vong <alexvong1995@gmail.com>
+;;; Copyright © 2021 Andy Tai <atai@atai.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -26,8 +27,18 @@
   #:use-module (guix git-download)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system python)
+  #:use-module (gnu packages)
+  #:use-module (gnu packages autotools)
+  #:use-module (gnu packages backup)
+  #:use-module (gnu packages check)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages curl)
+  #:use-module (gnu packages gtk)
+  #:use-module (gnu packages icu4c)
+  #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages wget)
+  #:use-module (gnu packages xml)
   #:use-module (gnu packages image))
 
 (define-public ocrad
@@ -52,25 +63,87 @@ it produces text in 8-bit or UTF-8 formats.")
     (license license:gpl3+)))
 
 (define-public tesseract-ocr
+  ;; some useful commits beyond last official stable release in release branch
+  (let ((commit "97079fa353557af6df86fd20b5d2e0dff5d8d5df")
+        (revision "1"))
   (package
     (name "tesseract-ocr")
-    (version "3.04.01")
+    (version (git-version "4.1.1" revision commit))
     (source
      (origin
        (method git-fetch)
        (uri (git-reference
               (url "https://github.com/tesseract-ocr/tesseract")
-              (commit version)))
+              (commit commit)
+              ;; source git repo with submodules; ensure they are fetched
+              (recursive? #t)))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "0h1x4z1h86n2gwknd0wck6gykkp99bmm02lg4a47a698g4az6ybv"))))
+        (base32 "0axwla82fpzp86lc553wp3hk0fz5dylw4as0jbf4hkqcyajlbzp4"))))
     (build-system gnu-build-system)
     (inputs
-     `(("leptonica" ,leptonica)))
+     `(  ("cairo" ,cairo)
+         ("icu" ,icu4c)
+         ("leptonica" ,leptonica)
+         ("pango" ,pango)
+         ("wget" ,wget)  ;; for downloading training data to run unit tests
+         ))
+    (native-inputs
+     `(("autoconf" ,autoconf)
+       ("autoconf-archive" ,autoconf-archive)
+       ("automake" ,automake)
+       ("googletest" ,googletest)
+       ("libarchive" ,libarchive)
+       ("libcurl" ,curl)
+       ("libtool" ,libtool)
+       ("libtiff" ,libtiff)
+       ("pkg-config" ,pkg-config)
+       ("python" ,python-wrapper)
+       ("xsltproc" ,libxslt)))
     (arguments
      '(#:configure-flags
        (let ((leptonica (assoc-ref %build-inputs "leptonica")))
-         (list (string-append "LIBLEPT_HEADERSDIR=" leptonica "/include")))))
+         (list (string-append "LIBLEPT_HEADERSDIR=" leptonica "/include")))
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'configure 'disable-failing-tests-and-setup
+           (lambda _
+             ;; pagesegmode_test.cc fails to build, patch it
+             (substitute* "unittest/pagesegmode_test.cc"
+               (("<tesseract/baseapi.h>") "\"baseapi.h\""))
+             (substitute* "unittest/pagesegmode_test.cc"
+               (("<tesseract/helpers.h>") "\"helpers.h\""))
+             #t))
+         (add-before 'build 'build-training
+           (lambda _
+             (invoke "make" "-j" (number->string (parallel-job-count)) "training")))
+         (add-after 'install 'install-training
+           (lambda _
+             (invoke "make" "training-install")
+             #t))
+         (replace 'check
+           (lambda _
+             (status:exit-val (system* "make" "check")) ;;exit code ignored
+             #t))  ;; failed tests will not stop the whole instal process
+         (add-before 'check 'pre-check-setup
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let ((tessdata_prefix   "/tmp") ;; (tmpnam))
+                   (wget   (which "wget")))
+               ;;TESSDATA_PREFIX environment var shall be parent directory of tessdata directory
+               ;; note for now, to run tests successfully you need to manually download eng.traineddata
+               ;; to /tmp/tessdata first
+                 (if tessdata_prefix
+                   (let ((data_dir (string-append tessdata_prefix "/tessdata")))
+                     (setenv "TESSDATA_PREFIX" tessdata_prefix)
+                     (format #t  "TESSDATA_PREFIX data dir: ~a  " data_dir)
+                     (mkdir-p data_dir)  ; code below shows attempt to download; not working now
+                     ;;(with-directory-excursion data_dir
+                     ;;  (begin
+                     ;;    (invoke wget "-t" "5" "https://github.com/tesseract-ocr/tessdata/blob/master/eng.traineddata")
+                     ;;))
+                   )
+                   (format #t "No TESSDATA_PREFIX found "))
+             #t))))))
     (home-page "https://github.com/tesseract-ocr/tesseract")
     (synopsis "Optical character recognition engine")
     (description
@@ -79,7 +152,7 @@ high accuracy.  It supports many languages, output text formatting, hOCR
 positional information and page layout analysis.  Several image formats are
 supported through the Leptonica library.  It can also detect whether text is
 monospaced or proportional.")
-    (license license:asl2.0)))
+    (license license:asl2.0))))
 
 (define-public zinnia
   (let* ((commit "581faa8f6f15e4a7b21964be3a5ec36265c80e5b")
-- 
2.30.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [bug#46376] [PATCH] gnu: tesseract-ocr: update to 4.1.1)
  2021-02-11  0:00                   ` Andy Tai
@ 2021-02-11 10:48                     ` Jelle Licht
  2021-02-11 18:34                       ` Andy Tai
  0 siblings, 1 reply; 16+ messages in thread
From: Jelle Licht @ 2021-02-11 10:48 UTC (permalink / raw)
  To: Andy Tai; +Cc: 46376

Hey Andy,

Andy Tai <atai@atai.org> writes:

> updated patch:
>
> unit tests run, with some failures due to illegal instruction and
> others succeed, but these requires first manual downloading of the
> training data; I am not sure how that can be done as part of Guix
> package definition.  Help on that is much appreciated.  (details
> commented in the patch)

The illegal instruction stuff seems somehow problematic either way. The
training data seems to be generated via a not-really-trivial process, so
my guess is that to properly package this, we would really have to
generate the training data 'from source'. For now, it might make more
sense to have users "BYOTD" (bring your own training data) and leave it
out of the packaging story.

Andy, what would you think about dumbing down your patch so
tesseract-ocr simply doesn't run tests (or try to build them, for that
matter)? So sorry for sending you on this wild goose chase!

I'm willing to adjust and push such a change, unless someone has a
better idea.

Thanks,
 - Jelle




^ permalink raw reply	[flat|nested] 16+ messages in thread

* [bug#46376] [PATCH] gnu: tesseract-ocr: update to 4.1.1)
  2021-02-11 10:48                     ` Jelle Licht
@ 2021-02-11 18:34                       ` Andy Tai
  2021-02-13 14:34                         ` bug#46376: " Jelle Licht
  0 siblings, 1 reply; 16+ messages in thread
From: Andy Tai @ 2021-02-11 18:34 UTC (permalink / raw)
  To: Jelle Licht; +Cc: 46376

Hi, sure.  Since the tests are built, we can just skip running them by
deleting the check phase.   That would be minimal change from the
(otherwise working) patch, also with no trouble from the missing
training data.

On Thu, Feb 11, 2021 at 2:48 AM Jelle Licht <jlicht@posteo.net> wrote:
>
> Hey Andy,
>
> Andy Tai <atai@atai.org> writes:
>
> > updated patch:
> >
> > unit tests run, with some failures due to illegal instruction and
> > others succeed, but these requires first manual downloading of the
> > training data; I am not sure how that can be done as part of Guix
> > package definition.  Help on that is much appreciated.  (details
> > commented in the patch)
>
> The illegal instruction stuff seems somehow problematic either way. The
> training data seems to be generated via a not-really-trivial process, so
> my guess is that to properly package this, we would really have to
> generate the training data 'from source'. For now, it might make more
> sense to have users "BYOTD" (bring your own training data) and leave it
> out of the packaging story.
>
> Andy, what would you think about dumbing down your patch so
> tesseract-ocr simply doesn't run tests (or try to build them, for that
> matter)? So sorry for sending you on this wild goose chase!
>
> I'm willing to adjust and push such a change, unless someone has a
> better idea.
>
> Thanks,
>  - Jelle



-- 
Andy Tai, atai@atai.org, Skype: licheng.tai, Line: andy_tai, WeChat: andytai1010
Year 2021 民國110年
自動的精神力是信仰與覺悟
自動的行為力是勞動與技能




^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#46376: [PATCH] gnu: tesseract-ocr: update to 4.1.1)
  2021-02-11 18:34                       ` Andy Tai
@ 2021-02-13 14:34                         ` Jelle Licht
  2021-02-13 20:37                           ` [bug#46376] " Andy Tai
  0 siblings, 1 reply; 16+ messages in thread
From: Jelle Licht @ 2021-02-13 14:34 UTC (permalink / raw)
  To: Andy Tai; +Cc: 46376-done

Hey Andy,

Andy Tai <atai@atai.org> writes:

> Hi, sure.  Since the tests are built, we can just skip running them by
> deleting the check phase.   That would be minimal change from the
> (otherwise working) patch, also with no trouble from the missing
> training data.

I pushed a slightly modified version of your patch as 822cd628e6 to
master; Instead of building the tests for no reason, I reverted the
recursive git checkout and I removed dependencies that are not required
for building tesseract from a git checkout.

Additionally, the manpages are now generated and installed as well.

Thanks again,
 - Jelle




^ permalink raw reply	[flat|nested] 16+ messages in thread

* [bug#46376] [PATCH] gnu: tesseract-ocr: update to 4.1.1)
  2021-02-13 14:34                         ` bug#46376: " Jelle Licht
@ 2021-02-13 20:37                           ` Andy Tai
  0 siblings, 0 replies; 16+ messages in thread
From: Andy Tai @ 2021-02-13 20:37 UTC (permalink / raw)
  To: Jelle Licht; +Cc: 46376-done

[-- Attachment #1: Type: text/plain, Size: 945 bytes --]

Thanks!

On Sat, Feb 13, 2021 at 6:34 AM Jelle Licht <jlicht@posteo.net> wrote:

> Hey Andy,
>
> Andy Tai <atai@atai.org> writes:
>
> > Hi, sure.  Since the tests are built, we can just skip running them by
> > deleting the check phase.   That would be minimal change from the
> > (otherwise working) patch, also with no trouble from the missing
> > training data.
>
> I pushed a slightly modified version of your patch as 822cd628e6 to
> master; Instead of building the tests for no reason, I reverted the
> recursive git checkout and I removed dependencies that are not required
> for building tesseract from a git checkout.
>
> Additionally, the manpages are now generated and installed as well.
>
> Thanks again,
>  - Jelle
>


-- 
Andy Tai, atai@atai.org, Skype: licheng.tai, Line: andy_tai, WeChat:
andytai1010
Year 2021 民國110年
自動的精神力是信仰與覺悟
自動的行為力是勞動與技能

[-- Attachment #2: Type: text/html, Size: 1743 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2021-02-13 20:39 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-08  6:32 [bug#46377] [PATCH] gnu: tesseract-ocr: update to 4.1.1 Andy Tai
2021-02-08  6:42 ` [bug#46376] " Andy Tai
     [not found]   ` <handler.46376.B.161276666727875.ack@debbugs.gnu.org>
2021-02-08  6:51     ` [bug#46376] [PATCH] gnu: tesseract-ocr: update to 4.1.1) Andy Tai
2021-02-08 21:36       ` Jelle Licht
2021-02-08 23:14         ` Andy Tai
2021-02-09 11:56           ` Jelle Licht
2021-02-09 16:22             ` Andy Tai
2021-02-09 22:43               ` Jelle Licht
2021-02-09 22:53                 ` Andy Tai
2021-02-10  7:52                 ` Andy Tai
2021-02-11  0:00                   ` Andy Tai
2021-02-11 10:48                     ` Jelle Licht
2021-02-11 18:34                       ` Andy Tai
2021-02-13 14:34                         ` bug#46376: " Jelle Licht
2021-02-13 20:37                           ` [bug#46376] " Andy Tai
     [not found] ` <handler.46377.B.161277624811801.ack@debbugs.gnu.org>
2021-02-08 17:53   ` [bug#46377] Acknowledgement ([PATCH] " Andy Tai

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).