gnu: sane-backends-minimal: Don't use unstable tarball.

* gnu/packages/scanner.scm (sane-backends-minimal)[source]: Use
GIT-FETCH and GIT-FILE-NAME.
[arguments]:
[native-inputs]: Add autoconf, autoconf-archive, automake,
gettext-minimal, libtool, and python-wrapper.
[arguments]: Add ‘zap-unnecessary-git-dependency’,
‘build-pixma_sane_options.c’, and ‘make-reproducible’ phases.
This commit is contained in:
Tobias Geerinckx-Rice 2021-02-15 14:49:49 +01:00
parent 641fc7c13c
commit 902d76c839
No known key found for this signature in database
GPG key ID: 0DB0FF884F556D79

View file

@ -22,12 +22,15 @@
(define-module (gnu packages scanner) (define-module (gnu packages scanner)
#:use-module (gnu packages) #:use-module (gnu packages)
#:use-module (gnu packages autotools)
#:use-module (gnu packages freedesktop) #:use-module (gnu packages freedesktop)
#:use-module (gnu packages gettext)
#:use-module (gnu packages ghostscript) #:use-module (gnu packages ghostscript)
#:use-module (gnu packages gtk) #:use-module (gnu packages gtk)
#:use-module (gnu packages image) #:use-module (gnu packages image)
#:use-module (gnu packages libusb) #:use-module (gnu packages libusb)
#:use-module (gnu packages pkg-config) #:use-module (gnu packages pkg-config)
#:use-module (gnu packages python)
#:use-module (gnu packages xml) #:use-module (gnu packages xml)
#:use-module (guix build-system gnu) #:use-module (guix build-system gnu)
#:use-module (guix download) #:use-module (guix download)
@ -42,13 +45,13 @@ (define-public sane-backends-minimal
(name "sane-backends-minimal") (name "sane-backends-minimal")
(version "1.0.31") (version "1.0.31")
(source (origin (source (origin
(method url-fetch) (method git-fetch)
(uri (string-append (uri (git-reference
"https://gitlab.com/sane-project/backends/uploads/" (url "https://gitlab.com/sane-project/backends")
"8bf1cae2e1803aefab9e5331550e5d5d/" (commit version)))
"sane-backends-" version ".tar.gz")) (file-name (git-file-name name version))
(sha256 (sha256
(base32 "1am5w92zyybs26wx4brgmky6dzpd8n34jyfrfx3qbvcqngy10fsa")) (base32 "161hh2zcs2fh6vxxgavf3m0xbm1gbxkasp10p8964pkzxax8rwqp"))
(modules '((guix build utils))) (modules '((guix build utils)))
(snippet (snippet
;; Generated HTML files and udev rules normally embed a ;; Generated HTML files and udev rules normally embed a
@ -60,12 +63,24 @@ (define-public sane-backends-minimal
#t)))) #t))))
(build-system gnu-build-system) (build-system gnu-build-system)
(native-inputs (native-inputs
`(("pkg-config" ,pkg-config))) `(("autoconf" ,autoconf)
("autoconf-archive" ,autoconf-archive)
("automake" ,automake)
("gettext" ,gettext-minimal)
("libtool" ,libtool)
("pkg-config" ,pkg-config)
;; For scripts/pixma_gen_options.py.
("python" ,python-wrapper)))
(inputs (inputs
`(("libusb" ,libusb))) `(("libusb" ,libusb)))
(arguments (arguments
`(#:phases `(#:phases
(modify-phases %standard-phases (modify-phases %standard-phases
(add-before 'bootstrap 'zap-unnecessary-git-dependency
(lambda _
(substitute* "configure.ac"
(("git describe --dirty")
(string-append "echo " ,version)))))
(add-before 'configure 'disable-backends (add-before 'configure 'disable-backends
(lambda _ (lambda _
(setenv "BACKENDS" " ") (setenv "BACKENDS" " ")
@ -74,7 +89,7 @@ (define-public sane-backends-minimal
(substitute* "testsuite/Makefile.in" (substitute* "testsuite/Makefile.in"
((" backend ") " ")) ((" backend ") " "))
#t)) #t))
(add-after 'unpack 'disable-failing-tests (add-before 'configure 'disable-failing-tests
(lambda _ (lambda _
;; Disable unmaintained tests that that fail with errors resembling: ;; Disable unmaintained tests that that fail with errors resembling:
;; ;;
@ -96,6 +111,11 @@ (define-public sane-backends-minimal
(substitute* "testsuite/sanei/Makefile.in" (substitute* "testsuite/sanei/Makefile.in"
(("sanei_usb_test\\$\\(EXEEXT\\) ") "")) (("sanei_usb_test\\$\\(EXEEXT\\) ") ""))
#t)) #t))
(add-before 'build 'build-pixma_sane_options.c
;; "No rule to make target '../backend/pixma/pixma_sane_options.c',
;; needed by 'sane-backends.pot-update'."
(lambda _
(invoke "make" "-C" "backend" "pixma/pixma_sane_options.c")))
(add-after 'install 'install-udev-rules (add-after 'install 'install-udev-rules
(lambda* (#:key outputs #:allow-other-keys) (lambda* (#:key outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out"))) (let ((out (assoc-ref outputs "out")))
@ -104,7 +124,18 @@ (define-public sane-backends-minimal
(string-append out (string-append out
"/lib/udev/rules.d/" "/lib/udev/rules.d/"
"60-libsane.rules")) "60-libsane.rules"))
#t)))))) #t)))
(add-after 'install 'make-reproducible
;; XXX Work around an old bug <https://issues.guix.gnu.org/26247>.
;; Then work around "Throw to key `decoding-error' ..." by using sed.
(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(locale (string-append out "/share/locale")))
(with-directory-excursion locale
(for-each (lambda (file)
(invoke "sed" "-i" "/^PO-Revision-Date:/d" file))
(list "en@boldquot/LC_MESSAGES/sane-backends.mo"
"en@quot/LC_MESSAGES/sane-backends.mo")))))))))
(home-page "http://www.sane-project.org") (home-page "http://www.sane-project.org")
(synopsis (synopsis
"Raster image scanner library and drivers, without scanner support") "Raster image scanner library and drivers, without scanner support")
@ -114,9 +145,9 @@ (define-public sane-backends-minimal
package contains the library, but no drivers.") package contains the library, but no drivers.")
(license licence:gpl2+))) ; plus linking exception (license licence:gpl2+))) ; plus linking exception
;; This variant links in the hpaio backend, provided by hplip, which adds ;; This variant links in the hpaio backend provided by hplip, which adds
;; support for HP scanners whose backends are not maintained by ;; support for HP scanners whose backends are not maintained by the SANE
;; 'sane-backends'. It also builds all of those backends. ;; project, and builds all of those backends.
(define-public sane-backends (define-public sane-backends
(package (package
(inherit sane-backends-minimal) (inherit sane-backends-minimal)