aboutsummaryrefslogtreecommitdiff
path: root/pkgs/muttprint/default.nix
blob: 0863a7b9ae7b8e7cf24a10b82a50886fbd3a5279 (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
{ stdenv, fetchurl, lib, psutils, dialog, texlive, makeWrapper, automake, autoconf, imagemagick, ghostscript, perl, perlPackages }:
stdenv.mkDerivation rec {
  name = "muttprint-${version}";
  version = "0.73";
  src = fetchurl {
    url = "http://downloads.sf.net/muttprint/${name}.tar.gz";
    sha256 = "1dny4niyibfgazwlzfcnb37jy6k140rs6baaj629z12rmahfdavw";
  };
  patches = [
    ./0.73-4.diff.gz
    ./regex.patch
    ./two_edge.patch
    ];
  preConfigure = ''
    aclocal
    automake --add-missing --copy
    autoconf
    '';
  preBuild = ''
    cd pics
    convert -flop BabyTuX.eps BabyTuX.eps
    for i in BabyTuX_color.eps BabyTuX.eps Debian_color.eps \
        Debian.eps Gentoo.eps Gentoo_color.eps ; do
      convert $i $(basename $i .eps).png
    done
    convert penguin.eps penguin.jpg
    cd ..
    '';
  postInstall = ''
    perlFlags=
    for i in $(IFS=:; echo $PERL5LIB); do
        perlFlags="$perlFlags -I$i"
    done

    sed -i "$out/bin/muttprint" -e "s|^#\!\(.*[ /]perl.*\)$|#\!\1$perlFlags|"
    sed -i "$out/bin/muttprint" -e "s|ENV{HOME}/.muttprintrc|ENV{XDG_CONFIG_HOME}/muttprint/muttprintrc|"

    wrapProgram $out/bin/muttprint \
      --prefix PATH : ${lib.makeBinPath [ psutils dialog
      (texlive.combine { inherit (texlive) scheme-basic utopia fancyvrb lastpage marvosym ucs cm-super; }) ]}
    '';
  buildInputs = [ makeWrapper automake autoconf imagemagick ghostscript perl ] ++
    (with perlPackages; [ TimeDate FileWhich TextIconv ]);
}