From: Ismaƫl Bouya Date: Sun, 10 Feb 2019 13:02:46 +0000 (+0100) Subject: Add muttprint X-Git-Tag: nur_publish~252 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=3b96c7ee3570583c298cf89c22934467da24aa0c;hp=e01535ee6ea3d756528aab1b4ca454a2002daf9c;p=perso%2FImmae%2FConfig%2FNix.git Add muttprint --- diff --git a/default.nix b/default.nix index 40cac81..b36cfc8 100644 --- a/default.nix +++ b/default.nix @@ -281,6 +281,49 @@ let buildInputs = [ ruby ]; }); + mypkgs.muttprint = stdenv.mkDerivation rec { + name = "muttprint-${version}"; + version = "0.73"; + src = fetchurl { + url = "http://downloads.sf.net/muttprint/${name}.tar.gz"; + sha256 = "1dny4niyibfgazwlzfcnb37jy6k140rs6baaj629z12rmahfdavw"; + }; + patches = [ + ./patches/muttprint_0.73-4.diff.gz + ./patches/muttprint_regex.patch + ./patches/muttprint_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|" + + 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 ]); + }; + # https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh # https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks in diff --git a/patches/muttprint_0.73-4.diff.gz b/patches/muttprint_0.73-4.diff.gz new file mode 100644 index 0000000..c4f3cef Binary files /dev/null and b/patches/muttprint_0.73-4.diff.gz differ diff --git a/patches/muttprint_regex.patch b/patches/muttprint_regex.patch new file mode 100644 index 0000000..e99c4a2 --- /dev/null +++ b/patches/muttprint_regex.patch @@ -0,0 +1,11 @@ +--- a/muttprint 2015-07-21 11:18:04.219578426 +1200 ++++ b/muttprint 2015-07-21 11:18:53.906243779 +1200 +@@ -1635,7 +1635,7 @@ + open (AUX, "$auxfile") or fatalError "Could not open $auxfile:\n$!"; + + while () { +- ($numberOfPages) = /\\newlabel{LastPage}{{}{(\d+)}}/; ++ ($numberOfPages) = /\\newlabel\{LastPage}\{\{}\{(\d+)}}/; + } + + close AUX or fatalError "Could not close $auxfile:\n$!"; diff --git a/patches/muttprint_two_edge.patch b/patches/muttprint_two_edge.patch new file mode 100644 index 0000000..4a7290d --- /dev/null +++ b/patches/muttprint_two_edge.patch @@ -0,0 +1,19 @@ +--- a/muttprint 2016-05-05 13:48:50.515950744 +1200 ++++ b/muttprint 2016-05-05 13:52:10.722623902 +1200 +@@ -643,14 +643,14 @@ + if ($Config{PAPERSAVE} eq "on") { + if ($useCups) { + $Config{PRINT_COMMAND} =~ +- s/\$CUPS_OPTIONS/ -o sides=two-sided-long-edge \$CUPS_OPTIONS/; ++ s/\$CUPS_OPTIONS/ -o sides=two-sided-short-edge \$CUPS_OPTIONS/; + } else { # no cups + modifyPS("landscape"); + } + } else { # no papersave + if ($useCups) { + $Config{PRINT_COMMAND} =~ +- s/\$CUPS_OPTIONS/ -o sides=two-sided-short-edge \$CUPS_OPTIONS/; ++ s/\$CUPS_OPTIONS/ -o sides=two-sided-long-edge \$CUPS_OPTIONS/; + } else { # no cups + modifyPS("portrait"); + }