gnu: aspell: 'dict-dir' set to ~/.guix-profile/lib/aspell or $ASPELL_DICT_DIR.

See <https://bugs.gnu.org/25836> for background.

* gnu/packages/patches/aspell-default-dict-dir.patch: New file.
* gnu/packages/aspell.scm (aspell)[source](patches): New field.
[native-search-paths]: New field.
* gnu/local.mk (dist_patch_DATA): Add it.
This commit is contained in:
Ludovic Courtès 2017-05-17 16:10:48 +02:00
parent be62e2224a
commit 6d35b1c99c
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
3 changed files with 36 additions and 3 deletions

View file

@ -501,6 +501,7 @@ dist_patch_DATA = \
%D%/packages/patches/antiword-CVE-2014-8123.patch \ %D%/packages/patches/antiword-CVE-2014-8123.patch \
%D%/packages/patches/apr-skip-getservbyname-test.patch \ %D%/packages/patches/apr-skip-getservbyname-test.patch \
%D%/packages/patches/artanis-fix-Makefile.in.patch \ %D%/packages/patches/artanis-fix-Makefile.in.patch \
%D%/packages/patches/aspell-default-dict-dir.patch \
%D%/packages/patches/ath9k-htc-firmware-binutils.patch \ %D%/packages/patches/ath9k-htc-firmware-binutils.patch \
%D%/packages/patches/ath9k-htc-firmware-gcc.patch \ %D%/packages/patches/ath9k-htc-firmware-gcc.patch \
%D%/packages/patches/ath9k-htc-firmware-objcopy.patch \ %D%/packages/patches/ath9k-htc-firmware-objcopy.patch \

View file

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2013, 2014, 2015, 2017 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2015, 2016 Alex Kost <alezost@gmail.com> ;;; Copyright © 2015, 2016 Alex Kost <alezost@gmail.com>
;;; Copyright © 2016 John Darrington <jmd@gnu.org> ;;; Copyright © 2016 John Darrington <jmd@gnu.org>
;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il> ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
@ -26,6 +26,7 @@ (define-module (gnu packages aspell)
#:use-module (guix download) #:use-module (guix download)
#:use-module (guix build-system gnu) #:use-module (guix build-system gnu)
#:use-module (guix licenses) #:use-module (guix licenses)
#:use-module (gnu packages)
#:use-module (gnu packages perl) #:use-module (gnu packages perl)
#:use-module (gnu packages base)) #:use-module (gnu packages base))
@ -40,7 +41,8 @@ (define-public aspell
version ".tar.gz")) version ".tar.gz"))
(sha256 (sha256
(base32 (base32
"1qgn5psfyhbrnap275xjfrzppf5a83fb67gpql0kfqv37al869gm")))) "1qgn5psfyhbrnap275xjfrzppf5a83fb67gpql0kfqv37al869gm"))
(patches (search-patches "aspell-default-dict-dir.patch"))))
(build-system gnu-build-system) (build-system gnu-build-system)
(arguments (arguments
`(#:phases `(#:phases
@ -53,6 +55,15 @@ (define-public aspell
'("ASPELL_CONF" "" = '("ASPELL_CONF" "" =
("${ASPELL_CONF:-\"dict-dir ${GUIX_PROFILE:-$HOME/.guix-profile}/lib/aspell\"}"))))))))) ("${ASPELL_CONF:-\"dict-dir ${GUIX_PROFILE:-$HOME/.guix-profile}/lib/aspell\"}")))))))))
(inputs `(("perl" ,perl))) (inputs `(("perl" ,perl)))
(native-search-paths
;; This is a Guix-specific environment variable that takes a single
;; entry, not an actual search path.
(list (search-path-specification
(variable "ASPELL_DICT_DIR")
(separator #f)
(files '("lib/aspell")))))
(home-page "http://aspell.net/") (home-page "http://aspell.net/")
(synopsis "Spell checker") (synopsis "Spell checker")
(description (description
@ -66,7 +77,8 @@ (define-public aspell
;;; Dictionaries. ;;; Dictionaries.
;;; ;;;
;;; Use 'export ASPELL_CONF="dict-dir $HOME/.guix-profile/lib/aspell"' to use ;;; Use 'export ASPELL_CONF="dict-dir $HOME/.guix-profile/lib/aspell"' to use
;;; them. ;;; them, or set the Guix-specific 'ASPELL_DICT_DIR', or just do nothing (as
;;; long as 'HOME' is set, that's fine!).
;;; ;;;
(define* (aspell-dictionary dict-name full-name (define* (aspell-dictionary dict-name full-name

View file

@ -0,0 +1,20 @@
This patch changes the default value of 'dict-dir' to correspond
to ~/.guix-profile/lib/aspell rather than $prefix/lib/aspell-X.Y.
This is not strictly necessary for the 'aspell' program itself since
one can simply set "ASPELL_CONF=dict-dir $HOME/.guix-profile/lib/aspell".
However it is necessary for applications that use libaspell since
'ASPELL_CONF' is not honored in this case. See <https://bugs.gnu.org/25836>.
--- a/common/config.cpp
+++ b/common/config.cpp
@@ -1349,6 +1349,9 @@ namespace acommon {
# define REPL ".aspell.<lang>.prepl"
#endif
+#undef DICT_DIR
+#define DICT_DIR "<$ASPELL_DICT_DIR|home-dir/.guix-profile/lib/aspell>"
+
static const KeyInfo config_keys[] = {
// the description should be under 50 chars
{"actual-dict-dir", KeyInfoString, "<dict-dir^master>", 0}