about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/misc/tkman/default.nix
blob: c51c3564fef8a6a8d740dcdcd5a1eb02f19ac15d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
{ lib
, stdenv
, fetchzip
, fetchpatch
, makeWrapper
, makeDesktopItem
, copyDesktopItems
, tk
, groff
, rman
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "tkman";
  version = "2.2";

  src = fetchzip {
    url = "mirror://sourceforge/tkman/tkman-${finalAttrs.version}.tar.gz";
    hash = "sha256-S4ffz+7zmVy9+isz/8q+FV4wF5Rw2iL1ftY8RsJjRLs=";
  };

  nativeBuildInputs = [
    makeWrapper
    copyDesktopItems
  ];

  patches = [(fetchpatch {
    url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/app-text/tkman/files/tkman-CVE-2008-5137.diff";
    hash = "sha256-l97SY2/YnMgzHYKnVYCVJKV7oGLN1hXNpeHFlLVzTMA=";
  })];

  makeFlags = [
    "BINDIR=$(out)/bin"
    "WISH=${tk}/bin/wish"
    "rman=${rman}/bin/rman"
    # TODO package glimpse https://github.com/gvelez17/glimpse
    "glimpse=\"\""
  ];

  preBuild = ''
    makeFlagsArray+=(
      'manformat="${groff}/bin/groff -te -Tlatin1 -mandoc $$manx(longtmp) -"'
    )
  '';

  preInstall = ''
    mkdir -p $out/bin
  '';

  postInstall = ''
    wrapProgram $out/bin/tkman \
      --run 'export MANPATH="$(manpath)"'
    rm $out/bin/retkman # doesn't work
    install -Dm644 contrib/TkMan.gif $out/share/icons/hicolor/64x64/apps/tkman.gif
  '';

  desktopItems = [(makeDesktopItem {
    name = "tkman";
    desktopName = "TkMan";
    comment = "Graphical man page and info viewer";
    exec = "tkman %f";
    icon = "tkman";
    terminal = false;
    type = "Application";
    categories = [ "Utility" ];
  })];

  meta = with lib; {
    description = "Graphical, hypertext manual page and Texinfo browser for UNIX";
    mainProgram = "tkman";
    longDescription = ''
      TkMan is a graphical, hypertext manual page and Texinfo browser for UNIX.
      TkMan boasts hypertext links, unmatched online text formatting and display
      quality, (optional) outline view of man pages, high quality display and
      superior navigational interface to Texinfo documents, a novel information
      visualization mechanism called Notemarks, full text search among man pages
      and Texinfo, incremental and regular expression search within pages,
      regular expression search within Texinfo that shows all matches (not just
      the next), robustly attached yellow highlight annotations, a shortcut/hot
      list, lists of all pages in user configurable volumes, a comprehensive
      Preferences panel, and man page versioning support, among many other features.
    '';
    homepage = "https://tkman.sourceforge.net/index.html";
    license = licenses.artistic1;
    platforms = platforms.unix;
    maintainers = with maintainers; [ fgaz ];
  };
})