unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: David Thompson <dthompson2@worcester.edu>
To: Mark H Weaver <mhw@netris.org>
Cc: guix-devel@gnu.org
Subject: Re: [PATCH 2/3] gnu: Add man-db
Date: Tue, 08 Apr 2014 07:46:24 -0400	[thread overview]
Message-ID: <87fvlo82nj.fsf@labrys.i-did-not-set--mail-host-address--so-tickle-me> (raw)
In-Reply-To: <87d2gssi4h.fsf@yeeloong.lan>

[-- Attachment #1: Type: text/plain, Size: 2506 bytes --]

Mark H Weaver <mhw@netris.org> writes:

> David Thompson <dthompson2@worcester.edu> writes:
>
>>> Why is 'lynx' an input?  I remember you mentioning on IRC that if PAGER
>>> is not set, it launched a web browser by default.  I wonder: if you
>>> included 'less' and not 'lynx', would it use 'less' by default
>>> instead?
>>
>> My system seems to be doing weird things and insisting on w3m for some
>> reason.
>
> That might be because the '.bash_profile' file I showed you set PAGER to
> w3m.  I found that if I unset PAGER, this man-db uses 'less' by default,
> which I think is sensible.

Can't believe I didn't notice the PAGER variable there.  I was staring
right at it.

>
>> +    (propagated-inputs
>> +     `(("groff" ,groff)
>> +       ("less" ,less)))
>
> Instead of making these propagated inputs, how about arranging for
> man-db to invoke the programs directly from the store?  There are a
> number of ./configure options that should probably be specified with
> absolute pathnames:
>
>   --with-pager
>   --with-nroff
>   --with-eqn
>   --with-neqn
>   --with-tbl
>   --with-refer
>   --with-pic
>   --with-gzip
>   --with-bzip2
>   --with-xz
>
> You could pass add these to the #:configure-flags.  The goal should be
> for 'man' to work properly without having to look up any of its
> dependent programs from $PATH and with PAGER unset.
>
> From the #:configure-flags code, %build-inputs can be looked up for the
> input paths.  So you could do something like (untested):
>
> --8<---------------cut here---------------start------------->8---
>   `(#:configure-flags
>     (let ((groff (assoc-ref %build-inputs "groff"))
>           (less  (assoc-ref %build-inputs "less"))
>           (gzip  (assoc-ref %build-inputs "gzip"))
>           ...)
>       (append (list (string-append "--with-pager=" less "/bin/less")
>                     (string-append "--with-gzip=" gzip "/bin/gzip")
>                     ...)
>               (map (lambda (prog)
>                      (string-append "--with-" prog "=" groff "/bin/" prog))
>                    '("nroff" "eqn" "neqn" "tbl" "refer" "pic")))))
> --8<---------------cut here---------------end--------------->8---
>
>      Thanks!
>        Mark

Wow, this worked perfectly.  Now man uses less by default even when I
have no PAGER variable set and less is uninstalled.  The same thing goes
for groff, gzip, etc.

I've attached the updated patch.  Thanks for your help.  This is the
most complicated package I've tried to write so far.

- Dave


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-gnu-Add-man-db.patch --]
[-- Type: text/x-diff, Size: 3780 bytes --]

From a0269a3830dfc2dd9cc6b8402a571a7efd90e717 Mon Sep 17 00:00:00 2001
From: David Thompson <dthompson@member.fsf.org>
Date: Sun, 6 Apr 2014 20:25:01 -0400
Subject: [PATCH 2/3] gnu: Add man-db.

* gnu/packages.man.scm (man-db): New variable.
---
 gnu/packages/man.scm | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 68 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/man.scm b/gnu/packages/man.scm
index e68b1f2..5457037 100644
--- a/gnu/packages/man.scm
+++ b/gnu/packages/man.scm
@@ -20,7 +20,13 @@
   #:use-module (guix licenses)
   #:use-module (guix download)
   #:use-module (guix packages)
-  #:use-module (guix build-system gnu))
+  #:use-module (guix build-system gnu)
+  #:use-module (gnu packages flex)
+  #:use-module (gnu packages gdbm)
+  #:use-module (gnu packages groff)
+  #:use-module (gnu packages less)
+  #:use-module (gnu packages lynx)
+  #:use-module (gnu packages pkg-config))
 
 (define-public libpipeline
   (package
@@ -41,3 +47,64 @@
      "libpipeline is a C library for manipulating pipelines of subprocesses in
 a flexible and convenient way.")
     (license gpl3+)))
+
+(define-public man-db
+  (package
+    (name "man-db")
+    (version "2.6.6")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "http://download.savannah.gnu.org/releases/man-db/man-db-"
+                    version ".tar.xz"))
+              (sha256
+               (base32
+                "1hv6byj6sg6cp3jyf08gbmdm4pwhvd5hzmb94xl0w7prin6hzabx"))))
+    (build-system gnu-build-system)
+    (arguments
+     '(#:phases
+       (alist-cons-after
+        'patch-source-shebangs 'patch-test-shebangs
+        (lambda* (#:key outputs #:allow-other-keys)
+          ;; Patch shebangs in test scripts.
+          (let ((out (assoc-ref outputs "out")))
+            (for-each (lambda (file)
+                        (substitute* file
+                          (("#! /bin/sh")
+                           (string-append "#!" (which "sh")))))
+                      (remove file-is-directory?
+                              (find-files "src/tests" ".*")))))
+        %standard-phases)
+       #:configure-flags
+       (let ((groff (assoc-ref %build-inputs "groff"))
+             (less  (assoc-ref %build-inputs "less"))
+             (gzip  (assoc-ref %build-inputs "gzip"))
+             (bzip2  (assoc-ref %build-inputs "bzip2"))
+             (xz  (assoc-ref %build-inputs "xz")))
+         ;; Invoke groff, less, gzip, bzip2, and xz directly from the store.
+         (append (list "--disable-setuid" ;; Disable setuid man user.
+                       (string-append "--with-pager=" less "/bin/less")
+                       (string-append "--with-gzip=" gzip "/bin/gzip")
+                       (string-append "--with-bzip2=" bzip2 "/bin/gzip")
+                       (string-append "--with-xz=" xz "/bin/xz"))
+                 (map (lambda (prog)
+                        (string-append "--with-" prog "=" groff "/bin/" prog))
+                      '("nroff" "eqn" "neqn" "tbl" "refer" "pic"))))
+       #:modules ((guix build gnu-build-system)
+                  (guix build utils)
+                  (srfi srfi-1))))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)))
+    (inputs
+     `(("flex" ,flex)
+       ("gdbm" ,gdbm)
+       ("groff" ,groff)
+       ("less" ,less)
+       ("libpipeline" ,libpipeline)))
+    (home-page "http://man-db.nongnu.org/")
+    (synopsis "Standard Unix documentation system")
+    (description
+     "Man-db is an implementation of the standard Unix documentation system
+accessed using the man command.  It uses a Berkeley DB database in place of
+the traditional flat-text whatis databases.")
+    (license gpl2+)))
-- 
1.8.4


  reply	other threads:[~2014-04-08 11:46 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-07  0:43 [PATCH 0/3] Add man-db and libpipeline David Thompson
2014-04-07  0:43 ` [PATCH 1/3] gnu: Add libpipeline David Thompson
2014-04-07  0:44   ` [PATCH 2/3] gnu: Add man-db David Thompson
2014-04-07  0:45     ` [PATCH 3/3] gnu: Move help2man package to (gnu packages man) module David Thompson
2014-04-07  7:47       ` Ludovic Courtès
2014-04-07  5:12     ` [PATCH 2/3] gnu: Add man-db Mark H Weaver
     [not found]       ` <87txa59xvw.fsf@labrys.i-did-not-set--mail-host-address--so-tickle-me>
2014-04-08  1:51         ` Mark H Weaver
2014-04-08 11:46           ` David Thompson [this message]
2014-04-08 12:12             ` Ludovic Courtès
2014-04-08 12:40               ` Thompson, David
2014-04-08 22:02               ` David Thompson
2014-04-08 22:55                 ` Nikita Karetnikov
2014-04-07  7:46   ` [PATCH 1/3] gnu: Add libpipeline Ludovic Courtès
2014-04-09  0:52 ` [PATCH 0/3] Add man-db and libpipeline David Thompson
2014-04-09  9:32   ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fvlo82nj.fsf@labrys.i-did-not-set--mail-host-address--so-tickle-me \
    --to=dthompson2@worcester.edu \
    --cc=guix-devel@gnu.org \
    --cc=mhw@netris.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).