about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2019-08-25 15:29:57 -0400
committerGitHub <noreply@github.com>2019-08-25 15:29:57 -0400
commitc45a990a5d772bd87e40f999f74b1c8faf9bd07b (patch)
tree65a1a1f9e45febea6f585033da0e20a17e0b0fdb
parentcceab5257fc3bca0113b042d7913a408bd5514ac (diff)
parent5f770d4070e17a31618b4aea0af404f0b40213ac (diff)
downloadnixlib-c45a990a5d772bd87e40f999f74b1c8faf9bd07b.tar
nixlib-c45a990a5d772bd87e40f999f74b1c8faf9bd07b.tar.gz
nixlib-c45a990a5d772bd87e40f999f74b1c8faf9bd07b.tar.bz2
nixlib-c45a990a5d772bd87e40f999f74b1c8faf9bd07b.tar.lz
nixlib-c45a990a5d772bd87e40f999f74b1c8faf9bd07b.tar.xz
nixlib-c45a990a5d772bd87e40f999f74b1c8faf9bd07b.tar.zst
nixlib-c45a990a5d772bd87e40f999f74b1c8faf9bd07b.zip
Merge pull request #65844 from matthewbauer/man-alias
man: use man-db everywhere
-rw-r--r--pkgs/tools/misc/man-db/default.nix34
-rw-r--r--pkgs/tools/misc/man/conf.patch14
-rw-r--r--pkgs/tools/misc/man/default.nix50
-rw-r--r--pkgs/tools/misc/man/share.patch116
-rw-r--r--pkgs/top-level/all-packages.nix7
5 files changed, 25 insertions, 196 deletions
diff --git a/pkgs/tools/misc/man-db/default.nix b/pkgs/tools/misc/man-db/default.nix
index ced4a156137d..df1a2daddb91 100644
--- a/pkgs/tools/misc/man-db/default.nix
+++ b/pkgs/tools/misc/man-db/default.nix
@@ -1,33 +1,47 @@
 { stdenv, fetchurl, pkgconfig, libpipeline, db, groff, libiconv, makeWrapper, buildPackages }:
 
 stdenv.mkDerivation rec {
-  name = "man-db-2.7.5";
+  name = "man-db-2.8.6.1";
 
   src = fetchurl {
     url = "mirror://savannah/man-db/${name}.tar.xz";
-    sha256 = "056a3il7agfazac12yggcg4gf412yq34k065im0cpfxbcw6xskaw";
+    sha256 = "0a1sh5gxa16k6irzf3q2lli8m204w9ik1xm62wjgf1mzknxs4xrc";
   };
 
   outputs = [ "out" "doc" ];
   outputMan = "out"; # users will want `man man` to work
 
-  nativeBuildInputs = [ pkgconfig makeWrapper groff ]
-    ++ stdenv.lib.optionals doCheck checkInputs;
+  nativeBuildInputs = [ pkgconfig makeWrapper groff ];
   buildInputs = [ libpipeline db groff ]; # (Yes, 'groff' is both native and build input)
   checkInputs = [ libiconv /* for 'iconv' binary */ ];
 
   postPatch = ''
-    substituteInPlace src/man_db.conf.in \
-      --replace "/usr/local/share" "/run/current-system/sw/share" \
-      --replace "/usr/share" "/run/current-system/sw/share"
+    # Remove all mandatory manpaths. Nixpkgs makes no requirements on
+    # these directories existing.
+    sed -i 's/^MANDATORY_MANPATH/# &/' src/man_db.conf.in
+
+    # Add Nixpkgs and NixOS-related manpaths
+    echo "MANPATH_MAP	/run/current-system/sw/bin		/run/current-system/sw/share/man" >> src/man_db.conf.in
+    echo "MANPATH_MAP	/run/wrappers/bin			/run/current-system/sw/share/man" >> src/man_db.conf.in
+    echo "MANPATH_MAP	/nix/var/nix/profiles/default/bin	/nix/var/nix/profiles/default/share/man" >> src/man_db.conf.in
+
+    # Add mandb locations for the above
+    echo "MANDB_MAP	/run/current-system/sw/share/man	/var/cache/man/nixos" >> src/man_db.conf.in
+    echo "MANDB_MAP	/nix/var/nix/profiles/default/share/man	/var/cache/man/nixpkgs" >> src/man_db.conf.in
   '';
 
   configureFlags = [
     "--disable-setuid"
+    "--disable-cache-owner"
     "--localstatedir=/var"
     # Don't try /etc/man_db.conf by default, so we avoid error messages.
-    "--with-config-file=\${out}/etc/man_db.conf"
-    "--with-systemdtmpfilesdir=\${out}/lib/tmpfiles.d"
+    "--with-config-file=${placeholder "out"}/etc/man_db.conf"
+    "--with-systemdtmpfilesdir=${placeholder "out"}/lib/tmpfiles.d"
+    "--with-systemdsystemunitdir=${placeholder "out"}/lib/systemd/system"
+  ] ++ stdenv.lib.optional stdenv.hostPlatform.isDarwin [
+    "ac_cv_func__set_invalid_parameter_handler=no"
+    "ac_cv_func_posix_fadvise=no"
+    "ac_cv_func_mempcpy=no"
   ];
 
   preConfigure = ''
@@ -57,7 +71,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  doCheck = !stdenv.hostPlatform.isMusl; /* iconv binary */
+  doCheck = !stdenv.hostPlatform.isMusl /* iconv binary */ && !stdenv.hostPlatform.isDarwin;
 
   meta = with stdenv.lib; {
     homepage = http://man-db.nongnu.org;
diff --git a/pkgs/tools/misc/man/conf.patch b/pkgs/tools/misc/man/conf.patch
deleted file mode 100644
index 43e8642fb34a..000000000000
--- a/pkgs/tools/misc/man/conf.patch
+++ /dev/null
@@ -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"
- };
diff --git a/pkgs/tools/misc/man/default.nix b/pkgs/tools/misc/man/default.nix
deleted file mode 100644
index 2f61a30714e2..000000000000
--- a/pkgs/tools/misc/man/default.nix
+++ /dev/null
@@ -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;
-  };
-}
diff --git a/pkgs/tools/misc/man/share.patch b/pkgs/tools/misc/man/share.patch
deleted file mode 100644
index 837786e28eba..000000000000
--- a/pkgs/tools/misc/man/share.patch
+++ /dev/null
@@ -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);
-+         }
-+ 
-      }
-  }
-  
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 6d50c263a3d5..676dda9b971e 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -4634,12 +4634,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 { };