1{ lib, stdenv, fetchFromGitHub, pkg-config, cimg, imagemagick }:
2
3stdenv.mkDerivation rec {
4 pname = "pHash";
5 version = "0.9.6";
6
7 buildInputs = [ cimg ];
8
9 # CImg.h calls to external binary `convert` from the `imagemagick` package
10 # at runtime
11 propagatedBuildInputs = [ imagemagick ];
12
13 nativeBuildInputs = [ pkg-config ];
14
15 configureFlags = ["--enable-video-hash=no" "--enable-audio-hash=no"];
16 postInstall = ''
17 cp ${cimg}/include/CImg.h $out/include/
18 '';
19
20 src = fetchFromGitHub {
21 owner = "clearscene";
22 repo = "pHash";
23 rev = version;
24 sha256 = "sha256-frISiZ89ei7XfI5F2nJJehfQZsk0Mlb4n91q/AiZ2vA=";
25 };
26
27 meta = with lib; {
28 description = "Compute the perceptual hash of an image";
29 license = licenses.gpl3;
30 maintainers = [maintainers.imalsogreg];
31 platforms = platforms.all;
32 homepage = "http://www.phash.org";
33 downloadPage = "https://github.com/clearscene/pHash";
34 };
35}