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