gnu: apertium: Update to 3.9.12

* gnu/packages/dictionaries.scm(apertium): Update to 3.9.12
  Also make the apertium script use store paths.

Change-Id: Ic147f3219bc5bfcc0a907a5cbf06ac476de8b3f8
Signed-off-by: Ekaitz Zarraga <ekaitz@elenq.tech>
This commit is contained in:
gnuphilic 2025-10-10 01:39:12 +03:00 committed by Ekaitz Zarraga
parent 9540d41a45
commit b34c008144
No known key found for this signature in database
GPG key ID: FDB952BD3F7356D6

View file

@ -494,20 +494,20 @@ word (e.g. cats) into its lemma \"cat\" and the grammatical information
(define-public apertium
(package
(name "apertium")
(version "3.5.2")
(version "3.9.12")
(source
(origin
(method url-fetch)
(uri (string-append
"https://github.com/apertium/apertium/releases/download/v"
version "/apertium-" version ".tar.gz"))
(sha256
(base32
"0lrx58ipx2kzh1pd3xm1viz05dqyrq38jbnj9dnk92c9ckkwkp4h"))
(file-name (string-append name "-" version ".tar.gz"))))
(origin
(method git-fetch)
(file-name (git-file-name name version))
(uri
(git-reference
(url "https://github.com/apertium/apertium")
(commit (string-append "v" version))))
(sha256 (base32 "1wkb8dqcamk42y67plj77n8d27g5qlsnpkgxnkvm0wv2pr35gmzw"))))
(build-system gnu-build-system)
(inputs
(list libxml2 libxslt lttoolbox pcre))
(list libxml2 libxslt lttoolbox pcre icu4c utfcpp-2 zip unzip
(libc-utf8-locales-for-target)));; tests require UTF-8
(native-inputs
`(("apertium-get"
,(origin
@ -518,10 +518,15 @@ word (e.g. cats) into its lemma \"cat\" and the grammatical information
(sha256
(base32
"0kgp68azvds7yjwfz57z8sa5094fyk5yr0qxzblrw7bisrrihnav"))))
("autoconf" ,autoconf)
("automake" ,automake)
("libtool" ,libtool)
("flex" ,flex)
("pkg-config" ,pkg-config)
;; python is only required for running the test suite
("python" ,python)))
;; Only required for running the test suite:
("python" ,python)
("python-lxml" ,python-lxml)
("libzip" ,libzip)))
(arguments
`(#:phases
(modify-phases %standard-phases
@ -531,8 +536,34 @@ word (e.g. cats) into its lemma \"cat\" and the grammatical information
(add-after 'unpack 'unpack-apertium-get
(lambda* (#:key inputs #:allow-other-keys)
(copy-recursively (assoc-ref inputs "apertium-get")
"apertium/apertium-get")
#t)))))
"apertium/apertium-get")))
(add-after 'unpack 'reconf
(lambda _
(invoke "autoreconf" "-vfi")))
(add-after 'unpack 'fix-paths
(lambda* (#:key inputs outputs #:allow-other-keys)
(substitute* "apertium/Makefile.am"
(("xmllint") (search-input-file inputs "/bin/xmllint")))
(substitute* "apertium/apertium-header.sh"
(("locale -a")
(string-append (search-input-file inputs "/bin/locale") " -a"))
;; 'locale -a' does not report properly in guix;
;; a `guix shell -C glibc glibc-locales - locale -a`
;; will still only list C and POSIX
;; alternatively we could replace the `locale -a` invocations
;; with something along the lines of `{ locale -a ; echo $LC_ALL }`
;; or `{ locale -a; locale | grep LC_CTYPE | cut -d= -f2 | tr -d '"' }.`
(("^locale_utf8\n$")
"# locale_utf8 # disabled by guix \n" )
;; replace in everywhere but the shebang
(("bash([^\n])" _ suffix)
(string-append (search-input-file inputs "/bin/bash") suffix))
(("\\b(grep|head|cat|rm|unzip|zip|gawk|awk|find|xmllint|lt-tmxproc)\\b" _ program)
(search-input-file inputs (format #f "/bin/~a" program))))))
;; We want the shebang to be patched so that the invocation during
;; tests does not need /usr/bin/env
(add-after 'build 'patch-apertium-shebang
(lambda _ (patch-shebang "apertium/apertium"))))))
(home-page "https://www.apertium.org/")
(synopsis "Rule based machine translation system")
(description "Apertium is a rule based machine translation system