gnu: Add perceptualdiff.

Message ID 20160724034325.16952-1-me@tobias.gr
State New
Headers

Commit Message

Tobias Geerinckx-Rice July 24, 2016, 3:43 a.m. UTC
  * gnu/packages/image.scm (perceptualdiff): New variable.
---
 gnu/packages/image.scm | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
  

Comments

Ludovic Courtès July 24, 2016, 9:32 p.m. UTC | #1
Tobias Geerinckx-Rice <me@tobias.gr> skribis:

> * gnu/packages/image.scm (perceptualdiff): New variable.

LGTM, thanks!

Ludo'.
  
Leo Famulari July 24, 2016, 9:44 p.m. UTC | #2
On Sun, Jul 24, 2016 at 05:43:25AM +0200, Tobias Geerinckx-Rice wrote:
> * gnu/packages/image.scm (perceptualdiff): New variable.

LGTM

> +    (arguments
> +     '(#:phases (modify-phases %standard-phases
> +                  (add-after 'unpack 'fix-tests
> +                    ;; cmake-build-system uses a build/ directory outside
> +                    ;; of the source tree, one level higher than expected
> +                    (lambda _
> +                      (substitute* "test/run_tests.bash"
> +                        (("../build") "../../build")))))))

Do you think this is a bug that should be reported?
  
Tobias Geerinckx-Rice July 24, 2016, 9:56 p.m. UTC | #3
Leo!

On 2016-07-24 23:44, Leo Famulari wrote:
>> +                    ;; cmake-build-system uses a build/ directory 
>> outside
>> +                    ;; of the source tree, one level higher than 
>> expected
> 
> Do you think this is a bug that should be reported?

Oh, I don't know. I assumed it was an artefact from Guix build 
environment set-up, and that building out-of-tree was considered weird 
or something. Never used cmake.

Should the script use some cmake environment variable instead?

Kind regards,

T G-R
  
Leo Famulari July 24, 2016, 10:21 p.m. UTC | #4
On Sun, Jul 24, 2016 at 11:56:05PM +0200, Tobias Geerinckx-Rice wrote:
> Leo!
> 
> On 2016-07-24 23:44, Leo Famulari wrote:
> > > +                    ;; cmake-build-system uses a build/ directory
> > > outside
> > > +                    ;; of the source tree, one level higher than
> > > expected
> > 
> > Do you think this is a bug that should be reported?
> 
> Oh, I don't know. I assumed it was an artefact from Guix build environment
> set-up, and that building out-of-tree was considered weird or something.
> Never used cmake.

Maybe you're right. Unlike the gnu-build-sytem, the cmake-build-system
seems to create a 'build/' directory adjacent to the unpacked source
code.

It's not a big deal one way or the other.
  
Vincent Legoll July 25, 2016, 10:49 a.m. UTC | #5
Hello,

> Maybe you're right. Unlike the gnu-build-sytem, the cmake-build-system
> seems to create a 'build/' directory adjacent to the unpacked source
> code.

Yes, I think in cmake's land, the recommended way is to build in a directory
outside of the source code , generally at the same level than the source tree
which can be made read-only...
  
Leo Famulari July 25, 2016, 3:10 p.m. UTC | #6
On Mon, Jul 25, 2016 at 12:49:56PM +0200, Vincent Legoll wrote:
> Hello,
> 
> > Maybe you're right. Unlike the gnu-build-sytem, the cmake-build-system
> > seems to create a 'build/' directory adjacent to the unpacked source
> > code.
> 
> Yes, I think in cmake's land, the recommended way is to build in a directory
> outside of the source code , generally at the same level than the source tree
> which can be made read-only...

Thanks for the clarification, Vincent.

I think the package is ready :)
  

Patch

diff --git a/gnu/packages/image.scm b/gnu/packages/image.scm
index 188d142..7d72492 100644
--- a/gnu/packages/image.scm
+++ b/gnu/packages/image.scm
@@ -8,6 +8,7 @@ 
 ;;; Copyright © 2014 John Darrington <jmd@gnu.org>
 ;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2016 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -801,3 +802,34 @@  the programmer.")
     ;; test/extra/ contains musl-libm, 
     ;; which is MIT/expat licensed, but only used for tests
     (license (license:fsf-free "file://COPYING")))) ;WTFPL version 2
+
+(define-public perceptualdiff
+  (package
+    (name "perceptualdiff")
+    (version "1.3")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://github.com/myint/perceptualdiff/archive/v"
+                           version ".tar.gz"))
+       (file-name (string-append name "-" version ".tar.gz"))
+        (sha256
+         (base32
+          "0zl6xmp971fffg7fzcz2fbgxg5x2w7l8qa65c008i4kbkc9016ps"))))
+    (build-system cmake-build-system)
+    (inputs `(("freeimage" ,freeimage)))
+    (arguments
+     '(#:phases (modify-phases %standard-phases
+                  (add-after 'unpack 'fix-tests
+                    ;; cmake-build-system uses a build/ directory outside
+                    ;; of the source tree, one level higher than expected
+                    (lambda _
+                      (substitute* "test/run_tests.bash"
+                        (("../build") "../../build")))))))
+    (home-page "https://github.com/myint/perceptualdiff")
+    (synopsis "Perceptual image comparison utility")
+    (description "PerceptualDiff visually compares two images to determine
+whether they look alike.  It uses a computational model of the human visual
+system to detect similarities.  This allows it too see beyond irrelevant
+differences in file encoding, image quality, and other small variations.")
+    (license license:gpl2+)))