about summary refs log tree commit diff
path: root/pkgs/applications/editors/tecoc/default.nix
blob: f5ad8d947c7bd38ca121823aa04926f72e35b20f (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
{ stdenv
, lib
, fetchFromGitHub
, ncurses
}:

stdenv.mkDerivation rec {
  pname = "tecoc";
  version = "unstable-2020-11-03";

  src = fetchFromGitHub {
    owner = "blakemcbride";
    repo = "TECOC";
    rev = "79fcb6cfd6c5f9759f6ec46aeaf86d5806b13a0b";
    sha256 = "sha256-JooLvoh9CxLHLOXXxE7zA7R9yglr9BGUwX4nrw2/vIw=";
  };

  buildInputs = [ ncurses ];

  makefile = if stdenv.hostPlatform.isDarwin
             then "makefile.osx"
             else if stdenv.hostPlatform.isFreeBSD
             then "makefile.bsd"
             else if stdenv.hostPlatform.isOpenBSD
             then "makefile.bsd"
             else if stdenv.hostPlatform.isWindows
             then "makefile.win"
             else "makefile.linux"; # I think Linux is a safe default...

  makeFlags = [ "CC=${stdenv.cc}/bin/cc" "-C src/" ];

  preInstall = ''
    install -d $out/bin $out/share/doc/${pname}-${version} $out/lib/teco/macros
  '';

  installPhase = ''
    runHook preInstall
    install -m755 src/tecoc $out/bin
    install -m644 src/aaout.txt doc/* $out/share/doc/${pname}-${version}
    install -m644 lib/* lib2/* $out/lib/teco/macros
    runHook postInstall
  '';

  postInstall = ''
    (cd $out/bin
     ln -s tecoc Make
     ln -s tecoc mung
     ln -s tecoc teco
     ln -s tecoc Inspect )
  '';

  meta = with lib; {
    description = "A clone of the good old TECO editor";
    longDescription = ''
      For those who don't know: TECO is the acronym of Tape Editor and COrrector
      (because it was a paper tape edition tool in its debut days). Now the
      acronym follows after Text Editor and Corrector, or Text Editor
      Character-Oriented.

      TECO is a character-oriented text editor, originally developed by Dan
      Murphy at MIT circa 1962. It is also a Turing-complete imperative
      interpreted programming language for text manipulation, done via
      user-loaded sets of macros. In fact, the venerable Emacs was born as a set
      of Editor MACroS for TECO.

      TECOC is a portable C implementation of TECO-11.
    '';
    homepage = "https://github.com/blakemcbride/TECOC";
    license = {
      url = "https://github.com/blakemcbride/TECOC/tree/master/doc/readme-1st.txt";
    };
    maintainers = [ maintainers.AndersonTorres ];
    platforms = platforms.unix;
  };
}