man: use man-db everywhere

man-db now works correctly on Darwin, so let’s make things more
consistent and use it there as well.
This commit is contained in:
Matthew Bauer 2019-08-03 10:05:24 -04:00
parent 3ffe0dce2b
commit 8879448cbe
4 changed files with 1 additions and 186 deletions

View file

@ -1,14 +0,0 @@
diff -ru -x '*~' man-1.6g-orig/src/man-config.c man-1.6g/src/man-config.c
--- man-1.6g-orig/src/man-config.c 2005-08-21 01:26:06.000000000 +0200
+++ man-1.6g/src/man-config.c 2012-03-06 11:11:28.159050524 +0100
@@ -214,8 +214,9 @@
const char *configuration_file = "[no configuration file]";
char *default_config_files[] = {
+ "/etc/man.conf",
CONFIG_FILE, /* compiled-in default */
- "/etc/man.conf", "/etc/man.config",
+ "/etc/man.config",
"/usr/lib/man.conf", "/usr/lib/man.config",
"/usr/share/misc/man.conf", "/usr/share/misc/man.config"
};

View file

@ -1,50 +0,0 @@
{ stdenv, fetchurl, groff, less }:
stdenv.mkDerivation rec {
name = "man-1.6g";
src = fetchurl {
url = "http://primates.ximian.com/~flucifredi/man/${name}.tar.gz";
sha256 = "17wmp2ahkhl72cvfzshmck22dnq2lbjg0678swihj270yk1vip6c";
};
buildInputs = [ groff less ];
preBuild = ''
makeFlagsArray=(bindir=$out/bin sbindir=$out/sbin libdir=$out/lib mandir=$out/share/man)
'';
patches = [
# Search in "share/man" relative to each path in $PATH (in addition to "man").
./share.patch
# Prefer /etc/man.conf over $out/lib/man.conf. Man only reads the
# first file that exists, so this is necessary to allow the
# builtin config to be overriden.
./conf.patch
];
preConfigure = ''
sed 's/^PREPATH=.*/PREPATH=$PATH/' -i configure
'';
postInstall =
''
# Use UTF-8 by default. Otherwise man won't know how to deal
# with certain characters.
substituteInPlace $out/lib/man.conf \
--replace "nroff -Tlatin1" "nroff" \
--replace "eqn -Tlatin1" "eqn -Tutf8"
# Work around a bug in substituteInPlace. It loses the final
# newline, and man requires every line in man.conf to be
# terminated by a newline.
echo >> $out/lib/man.conf
'';
meta = {
homepage = http://primates.ximian.com/~flucifredi/man/;
description = "Tool to read online Unix documentation";
platforms = stdenv.lib.platforms.unix;
};
}

View file

@ -1,116 +0,0 @@
diff -rc man-1.6f-orig/src/manpath.c man-1.6f/src/manpath.c
*** man-1.6f-orig/src/manpath.c 2006-08-03 23:18:33.000000000 +0200
--- man-1.6f/src/manpath.c 2008-02-07 15:31:43.000000000 +0100
***************
*** 109,121 ****
* or ../man or ../man1 or ../man8 subdirectories.
*/
static char *
! find_man_subdir (char *p) {
int len;
char *t, *sp;
len = strlen (p);
! t = my_malloc ((unsigned) len + 20);
memcpy (t, p, len);
strcpy (t + len, "/man");
--- 109,121 ----
* or ../man or ../man1 or ../man8 subdirectories.
*/
static char *
! find_man_subdir (char *p, char * maybe_share) {
int len;
char *t, *sp;
len = strlen (p);
! t = my_malloc ((unsigned) len + 30);
memcpy (t, p, len);
strcpy (t + len, "/man");
***************
*** 139,159 ****
}
/* look for the situation with packagedir/bin and packagedir/man */
! strcpy (t + len, "/man");
if (is_directory (t) == 1)
return t;
/* look for the situation with pkg/bin and pkg/man1 or pkg/man8 */
/* (looking for all man[1-9] would probably be a waste of stats) */
! strcpy (t + len, "/man1");
if (is_directory (t) == 1) {
t[len] = 0;
return t;
}
! strcpy (t + len, "/man8");
if (is_directory (t) == 1) {
t[len] = 0;
--- 139,159 ----
}
/* look for the situation with packagedir/bin and packagedir/man */
! sprintf (t + len, "%s/man", maybe_share);
if (is_directory (t) == 1)
return t;
/* look for the situation with pkg/bin and pkg/man1 or pkg/man8 */
/* (looking for all man[1-9] would probably be a waste of stats) */
! sprintf (t + len, "%s/man1", maybe_share);
if (is_directory (t) == 1) {
t[len] = 0;
return t;
}
! sprintf (t + len, "%s/man8", maybe_share);
if (is_directory (t) == 1) {
t[len] = 0;
***************
*** 341,347 ****
if (debug)
gripe (IS_NOT_IN_CONFIG);
! t = find_man_subdir (dir);
if (t != NULL) {
if (debug)
gripe (MAN_NEARBY);
--- 341,347 ----
if (debug)
gripe (IS_NOT_IN_CONFIG);
! t = find_man_subdir (dir, "");
if (t != NULL) {
if (debug)
gripe (MAN_NEARBY);
***************
*** 352,357 ****
--- 352,370 ----
if (debug)
gripe (NO_MAN_NEARBY);
}
+
+ t = find_man_subdir (dir, "/share");
+ if (t != NULL) {
+ if (debug)
+ gripe (MAN_NEARBY);
+
+ add_to_mandirlist (t, perrs);
+ free (t);
+ } else {
+ if (debug)
+ gripe (NO_MAN_NEARBY);
+ }
+
}
}

View file

@ -4581,12 +4581,7 @@ in
makefile2graph = callPackage ../development/tools/analysis/makefile2graph { };
# See https://github.com/NixOS/nixpkgs/issues/15849. I'm switching on isLinux because
# it looks like gnulib is broken on non-linux, so it seems likely that this would cause
# trouble on bsd and/or cygwin as well.
man = if stdenv.isLinux then man-db else man-old;
man-old = callPackage ../tools/misc/man { };
man = man-db;
man-db = callPackage ../tools/misc/man-db { };