aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/nixpkgs/pkgs/tools/typesetting/ted/default.nix
blob: 6d7ef3348613bdd6fa6400742f46fa0a446150f6 (plain)
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
{ stdenv, fetchurl, pkgconfig, zlib, pcre, xorg, libjpeg, libtiff, libpng, gtk2, libpaper, makeWrapper, ghostscript }:

stdenv.mkDerivation rec {
  pname = "ted";
  version = "2.23";

  src = fetchurl {
    url = "http://ftp.nluug.nl/pub/editors/${pname}/${pname}-${version}.src.tar.gz";
    sha256 = "0v1ipynyjklb3chd1vq26a21sjjg66sir57gi2kkrbwnpk195a9z";
  };

  preConfigure = ''
    mkdir pkgconfig-append
    pushd pkgconfig-append

    # ted looks for libtiff, not libtiff-4 in its pkg-config invokations
    cp ${libtiff.dev}/lib/pkgconfig/libtiff-4.pc libtiff.pc

    # ted needs a libpaper pkg-config file
    cat > libpaper.pc << EOF
    prefix=${libpaper}
    libdir=${libpaper}/lib
    includedir=${libpaper}/include
    exec_prefix=\''${prefix}

    Name: libpaper
    Version: ${libpaper.version}
    Description: ${libpaper.meta.description}
    Libs: -L\''${libdir} -lpaper
    Cflags: -I\''${includedir}
    EOF

    export PKG_CONFIG_PATH="$PWD:$PKG_CONFIG_PATH"

    popd
  '';

  makeFlags = [ "CONFIGURE_OPTIONS=--with-GTK" "CONFIGURE_OPTIONS+=--prefix=$(out)" "compile.shared" ];

  installPhase = ''
    runHook preInstall

    make tedPackage/makefile
    pushd tedPackage
    substituteInPlace makefile --replace /usr ""
    make PKGDESTDIR=$out datadir
    popd

    pushd $out/share/Ted/examples
    for f in rtf2*.sh
    do
        makeWrapper "$PWD/$f" "$out/bin/$f" --prefix PATH : $out/bin:${stdenv.lib.makeBinPath [ ghostscript ]}
    done
    popd

    cp -v Ted/Ted $out/bin

    runHook postInstall
  '';

  buildInputs = [ pkgconfig zlib pcre xorg.xlibsWrapper xorg.libXpm libjpeg libtiff libpng gtk2 libpaper makeWrapper ];

  meta = with stdenv.lib; {
    description = "An easy rich text processor";
    longDescription = ''
      Ted is a text processor running under X Windows on Unix/Linux systems.
      Ted was developed as a standard easy light weight word processor, having
      the role of Wordpad on MS-Windows. Since then, Ted has evolved to a real
      word processor. It still has the same easy appearance and the same speed
      as the original. The possibility to type a letter, a note or a report
      with a simple light weight program on a Unix/Linux machine is clearly
      missing. Ted was made to make it possible to edit rich text documents on
      Unix/Linux in a wysiwyg way. RTF files from Ted are fully compatible with
      MS-Word. Additionally, Ted also is an RTF to PostScript and an RTF to
      Acrobat PDF converter.
    '';
    homepage    = "https://nllgg.nl/Ted/";
    license     = licenses.gpl2;
    platforms   = platforms.all;
    broken      = stdenv.isDarwin;
    maintainers = with maintainers; [ obadz ];
  };
}