~ruther/guix-local

285229d06ad81c17f674ea6d89a4f2dc4d626627 — Jonas Meeuws 4 months ago 0a9eb3f
gnu: utsushi: Update 0.65.0-2.b296671 and fix tests.

* gnu/packages/scanner.scm (utsushi): Update 0.65.0-2.b296671.
[version, source]: Bump commit to b296671703ea3317ae1621f8ae67f7086208369d,
revision to 2.
[arguments]
<tests?>: Remove (enable them).
<phases>
{patch-bootstrap-fail-on-error}: New phase, adds set -e to bootstrap.
{update-gettext-version}: New phase, change an automake version.
{fix-newer-sane-support}: New phase, uncomment an #error.
{patch-shell-paths}: New phase.
[inputs]: Add bash-minimal, gtkmm-2.
[native-inputs]: Add coreutils, tesseract-ocr and tesseract-ocr-tessdata-fast
for tests.
[description]: Note that tesseract is an optional dependency.

Change-Id: I2609a58773b417d5a4e54ba087f7eeee1e405140
Signed-off-by: Maxim Cournoyer <maxim@guixotic.coop>
1 files changed, 93 insertions(+), 51 deletions(-)

M gnu/packages/scanner.scm
M gnu/packages/scanner.scm => gnu/packages/scanner.scm +93 -51
@@ 25,6 25,8 @@
  #:use-module (gnu packages)
  #:use-module (gnu packages autotools)
  #:use-module (gnu packages avahi)
  #:use-module (gnu packages base)
  #:use-module (gnu packages bash)
  #:use-module (gnu packages boost)
  #:use-module (gnu packages compression)
  #:use-module (gnu packages freedesktop)


@@ 36,6 38,7 @@
  #:use-module (gnu packages imagemagick)
  #:use-module (gnu packages libusb)
  #:use-module (gnu packages linux)
  #:use-module (gnu packages ocr)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages python)
  #:use-module (gnu packages textutils)


@@ 44,10 47,9 @@
  #:use-module (guix build-system gnu)
  #:use-module (guix deprecation)
  #:use-module (guix download)
  #:use-module (guix git-download)
  #:use-module (guix gexp)
  #:use-module ((guix licenses)
                #:prefix license:)
  #:use-module (guix git-download)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (guix search-paths)
  #:use-module (guix utils))


@@ 254,61 256,101 @@ hand-held scanner, video- and still-cameras, frame-grabbers, etc.).  The
package contains the library and drivers.")))

(define-public utsushi
  (let ((commit "839d06a5a80b353cb604eb9f7d352a1648ab1fdf"))
  (let ((commit "b296671703ea3317ae1621f8ae67f7086208369d")
        (revision "2"))
    (package
      (name "utsushi")
      (version (git-version "0.65.0" "1" commit))
      (source (origin
                (method git-fetch)
                (uri (git-reference
                      (url "https://gitlab.com/utsushi/utsushi")
                      (commit commit)))
                (file-name (git-file-name name version))
                (sha256
                 (base32
                  "0i6ipqy61abbsmqqqy5sii0vlib146snvp975sgjmv4nzy9mwf24"))))
      (version (git-version "0.65.0" revision commit))
      (source
       (origin
         (method git-fetch)
         (uri (git-reference
                (url "https://gitlab.com/utsushi/utsushi")
                (commit commit)))
         (file-name (git-file-name name version))
         (sha256
          (base32 "0sa2im75ymrkhxhhm93g81vv02yjwg3wn9myrjzlrfl2xnwk3bzb"))))
      (build-system gnu-build-system)
      (arguments
       (list #:tests? #f
             #:configure-flags
             #~(list (string-append "--with-boost-libdir="
                                    #$(this-package-input "boost") "/lib")
                     "CXXFLAGS=-Wno-error")
             #:phases
             #~(modify-phases %standard-phases
                 (add-before 'bootstrap 'zap-unnecessary-git-dependency
                   (lambda _
                     (substitute* "configure.ac"
                       (("-m4_esyscmd_s\\(\\[git describe --always\\]\\)") ""))))
                 (add-after 'install 'install-udev-rules
                   (lambda* (#:key outputs #:allow-other-keys)
                     (mkdir-p (string-append #$output "/lib/udev/rules.d"))
                     (install-file "drivers/esci/utsushi-esci.rules"
                                   (string-append #$output
                                                  "/lib/udev/rules.d")))))))
      (inputs (list boost
                    eudev
                    sane
                    libusb
                    libjpeg-turbo
                    imagemagick
                    libtiff
                    zlib))
      (native-inputs (list util-linux
                           autoconf
                           autoconf-archive
                           automake
                           gettext-minimal
                           libtool
                           libxslt
                           pkg-config))
       (list
        #:configure-flags
        #~(list (string-append "--with-boost-libdir="
                               #$(this-package-input "boost") "/lib")
                "CXXFLAGS=-Wno-error")
        #:phases
        #~(modify-phases %standard-phases
            (add-after 'unpack 'patch-bootstrap-fail-on-error
              (lambda _
                (substitute* "bootstrap"
                  ;; Don't continue when errors occurred.
                  (("^usage") "set -e\n\nusage"))))
            (add-after 'unpack 'fix-escaped-comment-marker
              (lambda _
                (substitute* "drivers/esci/Makefile.am"
                  ;; Fixes a fatal warning: "escaping \# comment markers
                  ;; is not portable".
                  (("\\\\#") "\\x23"))))
            (add-after 'unpack 'zap-unnecessary-git-dependency
              (lambda _
                (substitute* "configure.ac"
                  (("-m4_esyscmd_s\\(\\[git describe --always\\]\\)")
                   ""))))
            (add-after 'unpack 'update-gettext-version
              (lambda _
                (substitute* "configure.ac"
                  (("AM_GNU_GETTEXT_VERSION\\(.*\\)")
                   (format #f "AM_GNU_GETTEXT_VERSION([~a])"
                           #$(package-version (this-package-native-input
                                               "gettext-minimal")))))))
            (add-after 'unpack 'fix-newer-sane-support
              (lambda _
                (substitute* "sane/version.hpp"
                  (("#error \"SANE.*violates.*versioning.*\"" all)
                   (string-append "//" all)))))
            (add-after 'unpack 'patch-shell-paths
              (lambda _
                (for-each (lambda (file)
                            (substitute* file
                              (("/bin/sh") (which "sh"))))
                          '("filters/shell-pipe.cpp"
                            "lib/run-time.cpp"
                            "utsushi/test/command-line.hpp"))))
            (add-after 'install 'install-udev-rules
              (lambda _
                (install-file "drivers/esci/utsushi-esci.rules"
                              (string-append #$output "/lib/udev/rules.d")))))))
      (inputs
       (list bash-minimal
             boost
             eudev
             gtkmm-2
             imagemagick
             libjpeg-turbo
             libtiff
             libusb
             sane
             zlib))
      (native-inputs
       (list autoconf
             autoconf-archive
             automake
             gettext-minimal
             libtool
             libxslt
             pkg-config
             util-linux
             ;; For tests.
             coreutils
             tesseract-ocr-tessdata-fast tesseract-ocr))    ; order matters
      (home-page "https://gitlab.com/utsushi/utsushi")
      (synopsis "Image scanning software for EPSON devices")
      (description
       "Utsushi is a set of applications for image scanning with
support for a number of EPSON scanners, including a compatibility driver to
interface with software built around the @acronym{SANE, Scanner Access Now Easy}
standard.")
       "Utsushi is a set of applications for image scanning with support for a
number of EPSON scanners, including a compatibility driver to interface with
software built around the @acronym{SANE, Scanner Access Now Easy} standard.

To enable auto-rotation functionality, install the @code{tesseract-ocr} and
@code{tesseract-ocr-tessdata-fast} packages.")
      (license license:gpl3+))))

(define-public scanbd