about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYury G. Kudryashov <urkud.urkud@gmail.com>2008-02-10 17:40:54 +0000
committerYury G. Kudryashov <urkud.urkud@gmail.com>2008-02-10 17:40:54 +0000
commiteddff7a74a99da2a46f7f5d6210c2db6d3c3f9e2 (patch)
tree0913cd8612d119b04226c1ca6284cc927331010d
parent38fc3e625998e8eafc1133c0a8ff3a4f954bef68 (diff)
downloadnixlib-eddff7a74a99da2a46f7f5d6210c2db6d3c3f9e2.tar
nixlib-eddff7a74a99da2a46f7f5d6210c2db6d3c3f9e2.tar.gz
nixlib-eddff7a74a99da2a46f7f5d6210c2db6d3c3f9e2.tar.bz2
nixlib-eddff7a74a99da2a46f7f5d6210c2db6d3c3f9e2.tar.lz
nixlib-eddff7a74a99da2a46f7f5d6210c2db6d3c3f9e2.tar.xz
nixlib-eddff7a74a99da2a46f7f5d6210c2db6d3c3f9e2.tar.zst
nixlib-eddff7a74a99da2a46f7f5d6210c2db6d3c3f9e2.zip
* A more pure man implementation.
svn path=/nixpkgs/branches/stdenv-updates/; revision=10602
-rw-r--r--pkgs/tools/misc/man/default.nix26
-rw-r--r--pkgs/tools/misc/man/share.patch116
-rw-r--r--pkgs/top-level/all-packages.nix4
3 files changed, 146 insertions, 0 deletions
diff --git a/pkgs/tools/misc/man/default.nix b/pkgs/tools/misc/man/default.nix
new file mode 100644
index 000000000000..490aa4606abb
--- /dev/null
+++ b/pkgs/tools/misc/man/default.nix
@@ -0,0 +1,26 @@
+{stdenv, fetchurl, groff, less}:
+ 
+stdenv.mkDerivation {
+  name = "man-1.6f";
+  
+  src = fetchurl {
+    url = http://primates.ximian.com/~flucifredi/man/man-1.6f.tar.gz;
+    sha256 = "0v2z6ywhy8kd2fa3ywkqayhjdivbaqn6qvhx93a1ldw135z8q84z";
+  };
+  
+  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
+  ];
+
+  meta = {
+    homepage = http://primates.ximian.com/~flucifredi/man/;
+    description = "Tool to read online Unix documentation";
+  };
+}
diff --git a/pkgs/tools/misc/man/share.patch b/pkgs/tools/misc/man/share.patch
new file mode 100644
index 000000000000..837786e28eba
--- /dev/null
+++ b/pkgs/tools/misc/man/share.patch
@@ -0,0 +1,116 @@
+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 f759ce901e94..2329c49b2387 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -627,6 +627,10 @@ rec {
     inherit fetchurl stdenv;
   };
 
+  man = import ../tools/misc/man {
+     inherit fetchurl stdenv groff less;
+  };
+
   man_db = import ../tools/misc/man-db {
      inherit fetchurl stdenv db4 groff;
   };