1{ stdenv, fetchurl, fetchpatch, qmake, qttools, qtbase, poppler }:
2
3stdenv.mkDerivation rec {
4 version = "2.1.3";
5 name = "diffpdf-${version}";
6
7 src = fetchurl {
8 url = "http://www.qtrac.eu/${name}.tar.gz";
9 sha256 = "0cr468fi0d512jjj23r5flfzx957vibc9c25gwwhi0d773h2w566";
10 };
11
12 patches = [
13 (fetchpatch {
14 url = https://raw.githubusercontent.com/gentoo/gentoo/9b971631588ff46e7c2d501bc35cd0d9ce2d98e2/app-text/diffpdf/files/diffpdf-2.1.3-qt5.patch;
15 sha256 = "0sax8gcqcmzf74hmdr3rarqs4nsxmml9qmh6pqyjmgl3lypxhafg";
16 })
17 ./fix_path_poppler_qt5.patch
18 ];
19
20 nativeBuildInputs = [ qmake qttools ];
21 buildInputs = [ qtbase poppler ];
22
23 preConfigure = ''
24 substituteInPlace diffpdf.pro --replace @@NIX_POPPLER_QT5@@ ${poppler.dev}
25 lrelease diffpdf.pro
26 '';
27
28 installPhase = ''
29 mkdir -p $out/bin $out/share/man/man1
30
31 install -Dpm755 -D diffpdf $out/bin/diffpdf
32 install -Dpm644 -D diffpdf.1 $out/share/man/man1/diffpdf.1
33
34 install -dpm755 $out/share/doc/${name} $out/share/licenses/${name} $out/share/icons $out/share/pixmaps $out/share/applications
35 install -Dpm644 CHANGES README help.html $out/share/doc/${name}/
36 install -Dpm644 gpl-2.0.txt $out/share/licenses/${name}/
37 install -Dpm644 images/icon.png $out/share/icons/diffpdf.png
38 install -Dpm644 images/icon.png $out/share/pixmaps/diffpdf.png
39
40 cat > $out/share/applications/diffpdf.desktop <<EOF
41 [Desktop Entry]
42 Type=Application
43 Version=1.0
44 Name=diffpdf
45 Icon=diffpdf
46 Comment=PDF diffing tool
47 Exec=$out/bin/diffpdf
48 Terminal=false
49 EOF
50 '';
51
52 meta = {
53 homepage = http://www.qtrac.eu/diffpdfc.html;
54 description = "Tool for diffing pdf files visually or textually";
55 license = stdenv.lib.licenses.gpl2Plus;
56 maintainers = with stdenv.lib.maintainers; [ tstrobel ];
57 platforms = with stdenv.lib.platforms; linux;
58 inherit version;
59 };
60}