about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/phash
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/phash')
-rw-r--r--nixpkgs/pkgs/development/libraries/phash/default.nix37
1 files changed, 37 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/phash/default.nix b/nixpkgs/pkgs/development/libraries/phash/default.nix
new file mode 100644
index 000000000000..250089c30b1c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/phash/default.nix
@@ -0,0 +1,37 @@
+{ lib, stdenv, fetchFromGitHub, pkg-config, cimg, imagemagick }:
+
+stdenv.mkDerivation rec {
+  pname = "pHash";
+  version = "0.9.4";
+
+  buildInputs = [ cimg ];
+
+  # CImg.h calls to external binary `convert` from the `imagemagick` package
+  # at runtime
+  propagatedBuildInputs = [ imagemagick ];
+
+  nativeBuildInputs = [ pkg-config ];
+
+  configureFlags = ["--enable-video-hash=no" "--enable-audio-hash=no"];
+  postInstall = ''
+    cp ${cimg}/include/CImg.h $out/include/
+  '';
+
+  src = fetchFromGitHub {
+    owner = "clearscene";
+    repo = "pHash";
+    rev = version;
+    sha256 = "0y4gknfkns5sssfaj0snyx29752my20xmxajg6xggijx0myabbv0";
+  };
+
+  meta = with lib; {
+    inherit version;
+    description = "Compute the perceptual hash of an image";
+    license = licenses.gpl3;
+    maintainers = [maintainers.imalsogreg];
+    platforms = platforms.all;
+    homepage = "http://www.phash.org";
+    downloadPage = "https://github.com/clearscene/pHash";
+    updateWalker = true;
+  };
+}