--- Begin Message ---
Subject: |
[PATCH] gnu: yelp: Provide dependencies to display "man:" URIs. |
Date: |
Mon, 4 Sep 2023 22:58:55 +0200 |
Previously a command like the following one would fail to display the
expected man page:
guix shell yelp coreutils man-db -C \
--expose=/tmp/.X11-unix --expose=/run/user \
--expose=/var/run/dbus --expose=/etc/machine-id \
-E ^DISPLAY -- yelp man:ls
* gnu/packages/gnome.scm (yelp)[arguments]: New field.
[inputs]: Add 'man-db' and its "groff-minimal" input.
Reported-by: Luis Felipe <sirgazil@zoho.com>
---
gnu/packages/gnome.scm | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
Hi!
Initially I wanted to fix support for URLs like “info:coreutils”,
which Luis also reported on the Fediverse as being broken. However,
after much debugging I got lost in a maze of callbacks and threads
and opaque objects and eventually gave up. Someone™ should take
another look.
For the record, this is how I went on my debugging journey:
guix shell yelp coreutils man-db info-reader \
--with-debug-info=yelp gdb --pure -E ^DISPLAY -- \
gdb --args /bin/sh yelp info:coreutils
Ludo’.
diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 3b80692e90..894d77d7ba 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -7336,6 +7336,31 @@ (define-public yelp
(base32
"0h9vf4fx056imjf8ibmn03wg1c3hniipy1nsm2jqi62lp1m19c95"))))
(build-system glib-or-gtk-build-system)
+ (arguments
+ (list #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'set-man-file-name
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ ;; Create a wrapper for 'man' that knows where to find
+ ;; 'groff' and 'gunzip'.
+ (define libexecdir
+ (string-append #$output "/libexec/yelp"))
+ (define wrapper
+ (string-append libexecdir "/man"))
+
+ (mkdir-p libexecdir)
+ (symlink (search-input-file inputs "bin/man") wrapper)
+ (wrap-program wrapper
+ `("PATH" ":" =
+ ,(map (lambda (program)
+ (dirname (search-input-file inputs program)))
+ '("bin/groff" "bin/gunzip"))))
+
+ ;; Have Yelp use that 'man' wrapper instead of searching
+ ;; for 'man' in $PATH.
+ (substitute* "libyelp/yelp-man-parser.c"
+ (("\"man\"")
+ (string-append "\"" wrapper "\""))))))))
(native-inputs
(list `(,glib "bin") ; for glib-genmarshal, etc.
intltool
@@ -7347,6 +7372,8 @@ (define-public yelp
(list gsettings-desktop-schemas
libhandy
libxslt
+ man-db ;for URIs like "man:ls"
+ (lookup-package-input man-db "groff-minimal") ;ditto
sqlite
webkitgtk
yelp-xsl))
base-commit: 1af35bbb25b122cafddfd2f69b644d46c4beff85
--
2.41.0
--- End Message ---