1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 ncurses,
6 unstableGitUpdater,
7}:
8
9stdenv.mkDerivation (finalAttrs: {
10 pname = "tecoc";
11 version = "0-unstable-2023-06-21";
12
13 src = fetchFromGitHub {
14 owner = "blakemcbride";
15 repo = "TECOC";
16 rev = "b4a96395a18c7e64ccaef0e25fdde3b7ef33ac4b";
17 hash = "sha256-KTOGsTtxJh2sneU2VoDNUHcL3m8zt+3rBZTDvK1n02A=";
18 };
19
20 buildInputs = [ ncurses ];
21
22 makefile =
23 if stdenv.hostPlatform.isDarwin then
24 "makefile.osx"
25 else if stdenv.hostPlatform.isFreeBSD then
26 "makefile.bsd"
27 else if stdenv.hostPlatform.isOpenBSD then
28 "makefile.bsd"
29 else if stdenv.hostPlatform.isWindows then
30 "makefile.win"
31 else
32 "makefile.linux"; # I think Linux is a safe default...
33
34 makeFlags = [
35 "CC=${stdenv.cc.targetPrefix}cc"
36 "-C src/"
37 ];
38
39 installPhase = ''
40 runHook preInstall
41
42 install -d $out/bin $out/share/doc/tecoc $out/lib/teco/macros
43 install -m755 src/tecoc $out/bin
44 install -m644 src/aaout.txt doc/* $out/share/doc/tecoc
45 install -m644 lib/* lib2/* $out/lib/teco/macros
46
47 runHook postInstall
48 '';
49
50 postFixup = ''
51 pushd $out/bin
52 ln -s tecoc Make
53 ln -s tecoc mung
54 ln -s tecoc teco
55 ln -s tecoc Inspect
56 popd
57 '';
58
59 passthru.updateScript = unstableGitUpdater {
60 url = finalAttrs.meta.homepage;
61 };
62
63 meta = {
64 homepage = "https://github.com/blakemcbride/TECOC";
65 description = "Clone of the good old TECO editor";
66 longDescription = ''
67 For those who don't know: TECO is the acronym of Tape Editor and COrrector
68 (because it was a paper tape edition tool in its debut days). Now the
69 acronym follows after Text Editor and Corrector, or Text Editor
70 Character-Oriented.
71
72 TECO is a character-oriented text editor, originally developed by Dan
73 Murphy at MIT circa 1962. It is also a Turing-complete imperative
74 interpreted programming language for text manipulation, done via
75 user-loaded sets of macros. In fact, the venerable Emacs was born as a set
76 of Editor MACroS for TECO.
77
78 TECOC is a portable C implementation of TECO-11.
79 '';
80 license = {
81 url = "https://github.com/blakemcbride/TECOC/blob/${finalAttrs.src.rev}/doc/readme-1st.txt";
82 };
83 maintainers = [ ];
84 platforms = lib.platforms.unix;
85 };
86})