1{
2 lib,
3 stdenv,
4 fetchurl,
5 pkg-config,
6 zlib,
7 pcre,
8 xorg,
9 libjpeg,
10 libtiff,
11 libpng,
12 gtk2,
13 libpaper,
14 makeWrapper,
15 ghostscript,
16}:
17
18stdenv.mkDerivation rec {
19 pname = "ted";
20 version = "2.23";
21
22 src = fetchurl {
23 url = "http://ftp.nluug.nl/pub/editors/${pname}/${pname}-${version}.src.tar.gz";
24 sha256 = "0v1ipynyjklb3chd1vq26a21sjjg66sir57gi2kkrbwnpk195a9z";
25 };
26
27 preConfigure = ''
28 mkdir pkgconfig-append
29 pushd pkgconfig-append
30
31 # ted looks for libtiff, not libtiff-4 in its pkg-config invokations
32 cp ${libtiff.dev}/lib/pkgconfig/libtiff-4.pc libtiff.pc
33
34 # ted needs a libpaper pkg-config file
35 cat > libpaper.pc << EOF
36 prefix=${libpaper}
37 libdir=${libpaper}/lib
38 includedir=${libpaper}/include
39 exec_prefix=\''${prefix}
40
41 Name: libpaper
42 Version: ${libpaper.version}
43 Description: ${libpaper.meta.description}
44 Libs: -L\''${libdir} -lpaper
45 Cflags: -I\''${includedir}
46 EOF
47
48 export PKG_CONFIG_PATH="$PWD:$PKG_CONFIG_PATH"
49
50 popd
51 '';
52
53 makeFlags = [
54 "CONFIGURE_OPTIONS=--with-GTK"
55 "CONFIGURE_OPTIONS+=--prefix=$(out)"
56 "compile.shared"
57 ];
58
59 installPhase = ''
60 runHook preInstall
61
62 make tedPackage/makefile
63 pushd tedPackage
64 substituteInPlace makefile --replace /usr ""
65 make PKGDESTDIR=$out datadir
66 popd
67
68 pushd $out/share/Ted/examples
69 for f in rtf2*.sh
70 do
71 makeWrapper "$PWD/$f" "$out/bin/$f" --prefix PATH : $out/bin:${lib.makeBinPath [ ghostscript ]}
72 done
73 popd
74
75 cp -v Ted/Ted $out/bin
76
77 runHook postInstall
78 '';
79
80 nativeBuildInputs = [
81 pkg-config
82 makeWrapper
83 ];
84 buildInputs = [
85 zlib
86 pcre
87 xorg.libX11
88 xorg.libICE
89 xorg.libSM
90 xorg.libXpm
91 libjpeg
92 libtiff
93 libpng
94 gtk2
95 libpaper
96 ];
97
98 meta = with lib; {
99 description = "Easy rich text processor";
100 longDescription = ''
101 Ted is a text processor running under X Windows on Unix/Linux systems.
102 Ted was developed as a standard easy light weight word processor, having
103 the role of Wordpad on MS-Windows. Since then, Ted has evolved to a real
104 word processor. It still has the same easy appearance and the same speed
105 as the original. The possibility to type a letter, a note or a report
106 with a simple light weight program on a Unix/Linux machine is clearly
107 missing. Ted was made to make it possible to edit rich text documents on
108 Unix/Linux in a wysiwyg way. RTF files from Ted are fully compatible with
109 MS-Word. Additionally, Ted also is an RTF to PostScript and an RTF to
110 Acrobat PDF converter.
111 '';
112 homepage = "https://nllgg.nl/Ted/";
113 license = licenses.gpl2Only;
114 platforms = platforms.all;
115 broken = stdenv.hostPlatform.isDarwin;
116 maintainers = with maintainers; [ obadz ];
117 };
118}