1{ lib, stdenv, fetchurl, makeWrapper, perl, perlPackages, installShellFiles }:
2
3stdenv.mkDerivation rec {
4 pname = "findimagedupes";
5 version = "2.20.1";
6
7 # fetching this from GitHub does not contain the correct version number
8 src = fetchurl {
9 url = "http://www.jhnc.org/findimagedupes/findimagedupes-${version}.tar.gz";
10 sha256 = "sha256-VYqSnOD/Ntr0RnktJ/R0t+Z8+NRExA2mAHT2unPt9/o=";
11 };
12
13 # Work around the "unpacker appears to have produced no directories"
14 setSourceRoot = "sourceRoot=$(pwd)";
15
16 nativeBuildInputs = [ makeWrapper installShellFiles ];
17
18 buildInputs = [ perl ] ++ (with perlPackages; [
19 DBFile
20 FileMimeInfo
21 FileBaseDir
22 #GraphicsMagick
23 ImageMagick
24 Inline
25 InlineC
26 ParseRecDescent
27 ]);
28
29 # use /tmp as a storage
30 # replace GraphicsMagick with ImageMagick, because perl bindings are not yet available
31 postPatch = ''
32 substituteInPlace findimagedupes \
33 --replace "DIRECTORY => '/usr/local/lib/findimagedupes';" "DIRECTORY => '/tmp';" \
34 --replace "Graphics::Magick" "Image::Magick"
35 '';
36
37 buildPhase = "
38 runHook preBuild
39 ${perl}/bin/pod2man findimagedupes > findimagedupes.1
40 runHook postBuild
41 ";
42
43 installPhase = ''
44 runHook preInstall
45 install -D -m 755 findimagedupes $out/bin/findimagedupes
46 installManPage findimagedupes.1
47 runHook postInstall
48 '';
49
50 postFixup = ''
51 wrapProgram "$out/bin/findimagedupes" \
52 --prefix PERL5LIB : "${with perlPackages; makePerlPath [
53 DBFile
54 FileMimeInfo
55 FileBaseDir
56 #GraphicsMagick
57 ImageMagick
58 Inline
59 InlineC
60 ParseRecDescent
61 ]}"
62 '';
63
64 meta = with lib; {
65 homepage = "http://www.jhnc.org/findimagedupes/";
66 description = "Finds visually similar or duplicate images";
67 license = licenses.gpl3;
68 maintainers = with maintainers; [ stunkymonkey ];
69 };
70}