]> git.immae.eu Git - perso/Immae/Config/Nix.git/commitdiff
Add muttprint
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Sun, 10 Feb 2019 13:02:46 +0000 (14:02 +0100)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Sun, 10 Feb 2019 13:02:46 +0000 (14:02 +0100)
default.nix
patches/muttprint_0.73-4.diff.gz [new file with mode: 0644]
patches/muttprint_regex.patch [new file with mode: 0644]
patches/muttprint_two_edge.patch [new file with mode: 0644]

index 40cac812f6418bab10ea09cd5794d6ed3cb9bc7c..b36cfc8be68ebdf5a2c94a65e7fe61122311fafb 100644 (file)
@@ -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 (file)
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 (file)
index 0000000..e99c4a2
--- /dev/null
@@ -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 (<AUX>) {
+-              ($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 (file)
index 0000000..4a7290d
--- /dev/null
@@ -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");
+               }