nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib, python2Packages, fetchurl, xpdf }:
2
3python2Packages.buildPythonApplication rec {
4 pname = "pdfdiff";
5 version = "0.92";
6
7 src = fetchurl {
8 url = "https://www.cs.ox.ac.uk/people/cas.cremers/downloads/software/pdfdiff.py";
9 sha256 = "0zxwjjbklz87wkbhkmsvhc7xmv5php7m2a9vm6ydhmhlxsybf836";
10 };
11
12 buildInputs = [ python2Packages.wrapPython ];
13
14 dontConfigure = true;
15 dontBuild = true;
16 doCheck = false;
17
18 unpackPhase = "cp $src pdfdiff.py";
19
20 postPatch = ''
21 sed -i -r 's|pdftotextProgram = "pdftotext"|pdftotextProgram = "${xpdf}/bin/pdftotext"|' pdfdiff.py
22 sed -i -r 's|progName = "pdfdiff.py"|progName = "pdfdiff"|' pdfdiff.py
23 '';
24
25 installPhase = ''
26 mkdir -p $out/bin
27 cp pdfdiff.py $out/bin/pdfdiff
28 chmod +x $out/bin/pdfdiff
29
30 substituteInPlace $out/bin/pdfdiff --replace "#!/usr/bin/python" "#!${python2Packages.python.interpreter}"
31 '';
32
33 meta = with lib; {
34 homepage = "http://www.cs.ox.ac.uk/people/cas.cremers/misc/pdfdiff.html";
35 description = "Tool to view the difference between two PDF or PS files";
36 license = licenses.gpl2Plus;
37 platforms = platforms.linux;
38 };
39}