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