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

Message ID 20190125164802.17853-2-dannym@scratchpost.org
State Accepted
Headers show
Series Add diffpdf. | expand

Checks

Context Check Description
cbaines/applying patch success Successfully applied
cbaines/applying patch success Successfully applied

Commit Message

Danny Milosavljevic Jan. 25, 2019, 4:48 p.m. UTC
* gnu/packages/pdf.scm (diffpdf): New variable.
---
 gnu/packages/pdf.scm | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

Comments

Ricardo Wurmus Jan. 29, 2019, 5:08 p.m. UTC | #1
Hi Danny,

> * gnu/packages/pdf.scm (diffpdf): New variable.
[…]
> +    (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"))

Is this really necessary?  Shouldn’t it be enough to have this directory
on LIBRARY_PATH at build time?

> +    (inputs
> +     `(("poppler-qt4" ,poppler-qt4) ; at least 0.20.1
> +       ("qt-4" ,qt-4)))

I was hoping we could get rid of Qt 4 in the near future, because it
doesn’t get security fixes.  Is there no Qt 5 variant?

> +    (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)))

Looks like GPLv2 or later.

--
Ricardo
Danny Milosavljevic Jan. 29, 2019, 8:12 p.m. UTC | #2
Hi Ricardo,

On Tue, 29 Jan 2019 18:08:45 +0100
Ricardo Wurmus <rekado@elephly.net> wrote:

> I was hoping we could get rid of Qt 4 in the near future, because it
> doesn’t get security fixes.  Is there no Qt 5 variant?

No.  The company seems to write proprietary Windows solutions now.

Kudos to them for keeping the FOSS version on their homepage anyway.

> Looks like GPLv2 or later.

Thanks for the review!

Patch

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)))