Subject: [bug#34198] [PATCH 2/2] gnu: Add diffpdf.

From: Danny Milosavljevic <[email-masked]>
Date: Fri, 25 Jan 2019 17:48:02 +0100

* gnu/packages/pdf.scm (diffpdf): New variable.
---
 gnu/packages/pdf.scm | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/gnu/packages/pdf.scm b/gnu/packages/pdf.scm
index 956e25c6d..3b695f3a6 100644
--- a/gnu/packages/pdf.scm
+++ b/gnu/packages/pdf.scm
@@ -1130,3 +1130,46 @@ presentation.  The input files processed by pdfpc are PDF documents.")
 rendering of the file.  The rendering is done by creating outline curves
 through the Pango @code{ft2} backend.")
       (license license:lgpl2.0+))))
+
+(define-public diffpdf
+  (package
+    (name "diffpdf")
+    (version "2.1.3")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "http://www.qtrac.eu/diffpdf-" version ".tar.gz"))
+       (sha256
+        (base32
+         "0cr468fi0d512jjj23r5flfzx957vibc9c25gwwhi0d773h2w566"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch-paths
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* "diffpdf.pro"
+              (("-lpoppler-qt4")
+               (string-append "-L" (assoc-ref inputs "poppler-qt4")
+                              "/lib -lpoppler-qt4"))
+              (("/usr/local/include/poppler")
+               (string-append (assoc-ref inputs "poppler-qt4")
+                              "/include/poppler")))
+             #t))
+         (replace 'configure
+           (lambda _
+             (invoke "lrelease" "diffpdf.pro")
+             (invoke "qmake")))
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (out-bin (string-append out "/bin")))
+               (install-file "diffpdf" out-bin)
+               #t))))))
+    (inputs
+     `(("poppler-qt4" ,poppler-qt4) ; at least 0.20.1
+       ("qt-4" ,qt-4)))
+    (home-page "http://www.qtrac.eu/diffpdf-foss.html")
+    (synopsis "Compare two PDF files")
+    (description "This package provides a GUI tool to compare two PDF files.")
+    (license license:gpl2)))