--- findimagedupes-2.18.orig/Makefile.PL
+++ findimagedupes-2.18/Makefile.PL
@@ -0,0 +1,6 @@
+use Inline::MakeMaker;
+WriteInlineMakefile(
+    'NAME'		=> 'findimagedupes::C',
+    'VERSION_FROM' => 'C.pm',
+    'EXE_FILES' => [ 'findimagedupes' ],
+);
--- findimagedupes-2.18.orig/C.pm
+++ findimagedupes-2.18/C.pm
@@ -0,0 +1,116 @@
+package findimagedupes::C;
+
+use Inline
+        C => 'DATA',
+        NAME => 'findimagedupes::C',
+        VERSION => '0.01',
+;
+
+our $VERSION = '0.01';
+1;
+
+__DATA__
+
+__C__
+
+/* efficient bit-comparison */
+
+#include <stdint.h>
+#include <string.h>
+
+#define LOOKUP_SIZE 65536
+#define FP_CHUNKS 16
+
+typedef uint16_t FP[FP_CHUNKS];
+
+unsigned int simplecountbits (unsigned int i) {
+	unsigned int val = i, res = 0;
+
+	while (val) {
+		res += (val&1);
+		val >>= 1;
+	}
+	return(res);
+}
+
+void diffbits (SV* oldfiles, SV* newfiles, unsigned int threshold, unsigned limit) {
+	FP *the_data, *a, *b;
+	unsigned int lookup[LOOKUP_SIZE];
+	unsigned int i, j, k, m, bits, old, new;
+	HV *oldhash;
+	HE *oldhash_entry;
+	HV *newhash;
+	HE *newhash_entry;
+	unsigned int numkeys = 0;
+	SV *sv_val;
+	Inline_Stack_Vars;
+
+	if ((threshold<0) || (threshold>256)) {
+		croak("ridiculous threshold specified");
+	}
+
+	/* pack fingerprints into C array */
+	/* partly lifted from Inline::C-Cookbook */
+
+	if (! SvROK(newfiles)) {
+		croak("newfiles is not a reference");
+	}
+	newhash = (HV *)SvRV(newfiles);
+	new = hv_iterinit(newhash);
+
+	if (! SvROK(oldfiles)) {
+		croak("oldfiles is not a reference");
+	}
+	oldhash = (HV *)SvRV(oldfiles);
+	old = hv_iterinit(oldhash);
+
+	numkeys = new+old;
+	if (numkeys<2) {
+		/* minor optimization: return without doing anything */
+		/* malloc(0) could be bad... */
+		Inline_Stack_Void;
+	}
+	the_data = (FP *)malloc(numkeys*sizeof(FP));
+	if (!the_data) {
+		croak("malloc failed");
+	}
+
+	for (i = 0; i<new; i++) {
+		newhash_entry = hv_iternext(newhash);
+		sv_val = hv_iterval(newhash, newhash_entry);
+		memcpy(the_data+i, SvPV(sv_val, PL_na), sizeof(FP));
+	}
+	for (i = new; i<numkeys; i++) {
+		oldhash_entry = hv_iternext(oldhash);
+		sv_val = hv_iterval(oldhash, oldhash_entry);
+		memcpy(the_data+i, SvPV(sv_val, PL_na), sizeof(FP));
+	}
+
+	/* initialise lookup table */
+	/* XXX: fast enough? could optimise more or compile-in a static table */
+	for (i=0; i<LOOKUP_SIZE; i++) {
+		lookup[i] = simplecountbits(i);
+	}
+
+	/* look for matches */
+	Inline_Stack_Reset;
+	for (a=the_data, i=0, m=(limit>0 ? new : numkeys-1); i<m; a++, i++) {
+		for (b=a+1, j=i+1; j<numkeys; b++, j++) {
+			for (bits=0, k=0; k<FP_CHUNKS; k++) {
+				bits += lookup[(*a)[k]^(*b)[k]];
+				if (bits > threshold) goto abortmatch;
+			}
+			/* if (bits <= threshold) */ {
+				Inline_Stack_Push(sv_2mortal(newSViv(i)));
+				Inline_Stack_Push(sv_2mortal(newSViv(j)));
+				Inline_Stack_Push(sv_2mortal(newSViv(bits)));
+			}
+abortmatch:;
+		}
+	}
+	Inline_Stack_Done;
+
+	/* clean up */
+	free(the_data);
+}
+
--- findimagedupes-2.18.orig/findimagedupes
+++ findimagedupes-2.18/findimagedupes
@@ -34,10 +34,8 @@
 use MIME::Base64;
 use Pod::Usage;
 
-use Inline
-	C => 'DATA',
-	NAME => 'findimagedupes',
-	DIRECTORY => '/usr/local/lib/findimagedupes';
+use lib "/usr/lib/findimagedupes/lib";
+use findimagedupes::C;
 
 # ----------------------------------------------------------------------
 #
@@ -511,7 +509,7 @@
 }
 
 sub finddupes {
-	my @matches = diffbits(\%fpcache, \%filelist, $threshold, $add);
+	my @matches = findimagedupes::C::diffbits(\%fpcache, \%filelist, $threshold, $add);
 
 	my (%set, %ptr, %val);
 
@@ -990,106 +988,3 @@
 
 =cut
 
-__C__
-
-/* efficient bit-comparison */
-
-#include <stdint.h>
-#include <string.h>
-
-#define LOOKUP_SIZE 65536
-#define FP_CHUNKS 16
-
-typedef uint16_t FP[FP_CHUNKS];
-
-unsigned int simplecountbits (unsigned int i) {
-	unsigned int val = i, res = 0;
-
-	while (val) {
-		res += (val&1);
-		val >>= 1;
-	}
-	return(res);
-}
-
-void diffbits (SV* oldfiles, SV* newfiles, unsigned int threshold, unsigned limit) {
-	FP *the_data, *a, *b;
-	unsigned int lookup[LOOKUP_SIZE];
-	unsigned int i, j, k, m, bits, old, new;
-	HV *oldhash;
-	HE *oldhash_entry;
-	HV *newhash;
-	HE *newhash_entry;
-	unsigned int numkeys = 0;
-	SV *sv_val;
-	Inline_Stack_Vars;
-
-	if ((threshold<0) || (threshold>256)) {
-		croak("ridiculous threshold specified");
-	}
-
-	/* pack fingerprints into C array */
-	/* partly lifted from Inline::C-Cookbook */
-
-	if (! SvROK(newfiles)) {
-		croak("newfiles is not a reference");
-	}
-	newhash = (HV *)SvRV(newfiles);
-	new = hv_iterinit(newhash);
-
-	if (! SvROK(oldfiles)) {
-		croak("oldfiles is not a reference");
-	}
-	oldhash = (HV *)SvRV(oldfiles);
-	old = hv_iterinit(oldhash);
-
-	numkeys = new+old;
-	if (numkeys<2) {
-		/* minor optimization: return without doing anything */
-		/* malloc(0) could be bad... */
-		Inline_Stack_Void;
-	}
-	the_data = (FP *)malloc(numkeys*sizeof(FP));
-	if (!the_data) {
-		croak("malloc failed");
-	}
-
-	for (i = 0; i<new; i++) {
-		newhash_entry = hv_iternext(newhash);
-		sv_val = hv_iterval(newhash, newhash_entry);
-		memcpy(the_data+i, SvPV(sv_val, PL_na), sizeof(FP));
-	}
-	for (i = new; i<numkeys; i++) {
-		oldhash_entry = hv_iternext(oldhash);
-		sv_val = hv_iterval(oldhash, oldhash_entry);
-		memcpy(the_data+i, SvPV(sv_val, PL_na), sizeof(FP));
-	}
-
-	/* initialise lookup table */
-	/* XXX: fast enough? could optimise more or compile-in a static table */
-	for (i=0; i<LOOKUP_SIZE; i++) {
-		lookup[i] = simplecountbits(i);
-	}
-
-	/* look for matches */
-	Inline_Stack_Reset;
-	for (a=the_data, i=0, m=(limit>0 ? new : numkeys-1); i<m; a++, i++) {
-		for (b=a+1, j=i+1; j<numkeys; b++, j++) {
-			for (bits=0, k=0; k<FP_CHUNKS; k++) {
-				bits += lookup[(*a)[k]^(*b)[k]];
-				if (bits > threshold) goto abortmatch;
-			}
-			/* if (bits <= threshold) */ {
-				Inline_Stack_Push(sv_2mortal(newSViv(i)));
-				Inline_Stack_Push(sv_2mortal(newSViv(j)));
-				Inline_Stack_Push(sv_2mortal(newSViv(bits)));
-			}
-abortmatch:;
-		}
-	}
-	Inline_Stack_Done;
-
-	/* clean up */
-	free(the_data);
-}
-
--- findimagedupes-2.18.orig/debian/docs
+++ findimagedupes-2.18/debian/docs
@@ -0,0 +1,2 @@
+README
+history
--- findimagedupes-2.18.orig/debian/watch
+++ findimagedupes-2.18/debian/watch
@@ -0,0 +1,3 @@
+version=3
+
+http://www.jhnc.org/findimagedupes/findimagedupes-(.*).tar.gz
--- findimagedupes-2.18.orig/debian/compat
+++ findimagedupes-2.18/debian/compat
@@ -0,0 +1 @@
+5
--- findimagedupes-2.18.orig/debian/copyright
+++ findimagedupes-2.18/debian/copyright
@@ -0,0 +1,31 @@
+Format-Specification: http://wiki.debian.org/Proposals/CopyrightFormat
+Debianized-By: Dr. Guenter Bechly <gbechly@debian.org>, 
+ Andreas Tille <tille@debian.org>
+Debianized-Date: Sat, 27 Jan 2001 20:12:24 +0100
+Original-Source-Location: http://www.jhnc.org/findimagedupes/
+Upstream-Author: Jonathan H N Chin <code@jhnc.org>
+X-Former-Source-Location: 
+ Former versions of the code that inspired the rewrite can be downloaded from
+ http://www.kudla.org/raindog/perl/findimagedupes-0.1.3.tar.gz
+ and http://www.kudla.org/raindog/perl/finddupes.cpp
+Upstream Author: Jonathan H N Chin <code@jhnc.org>
+
+Files: *
+Copyright: Copyright © 2006-2008 Jonathan H N Chin <code@jhnc.org>
+License: GPL-3+
+ This program is free software; you may redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+X-Comment: On Debian systems, the complete text of the GNU General
+ Public License can be found in `/usr/share/common-licenses/GPL'.
+
+On Debian systems, the complete text of the GNU General Public
+Licence can be found in /usr/share/common-licenses/GPL file.
+
+Files: debian/*
+Copyright: Copyright © 2001  Dr. Guenter Bechly <gbechly@debian.org>
+           Copyright © 2001  Beiad Ian Q. Dalton <idalton@ferret.dyndns.org>
+           Copyright © 2005-2008  Andreas Tille <tille@debian.org>
+           Copyright © 2008  Manuel Prinz <debian@pinguinkiste.de>
+License: GPL-3+
--- findimagedupes-2.18.orig/debian/changelog
+++ findimagedupes-2.18/debian/changelog
@@ -0,0 +1,258 @@
+findimagedupes (2.18-4.4.201403231403) ucs4-0-0-0; urgency=low
+
+  * UCS auto build. No patches were applied to the original source package
+
+ -- Univention builddaemon <buildd@univention.de>  Sun, 23 Mar 2014 14:03:52 +0100
+
+findimagedupes (2.18-4) unstable; urgency=low
+
+  [ Niko Tyni ]
+  * Use Inline::MakeMaker to keep the C parts working across
+    binary compatible Perl upgrades. (Closes: #549447)
+  * Build-Depend on cdbs (>= 0.4.57) to make sure 'make install'
+    uses DESTDIR and not PREFIX (which doesn't work with the way
+    we set the private library installation path through LIB).
+  * Rework the installation instructions removal a bit so that
+    'debian/rules clean' undoes the effects.
+
+  [ Manuel Prinz ]
+  * Bumped Standards-Version to 3.8.3. No changes needed.
+  * Added versioned Build-Depends on debhelper.
+
+ -- Manuel Prinz <manuel@debian.org>  Mon, 26 Oct 2009 21:56:03 +0100
+
+findimagedupes (2.18-3) unstable; urgency=low
+
+  * Corrected path in DIRECTORY config option. Closes: #532318.
+
+ -- Manuel Prinz <manuel@debian.org>  Mon, 08 Jun 2009 16:44:31 +0200
+
+findimagedupes (2.18-2) unstable; urgency=low
+
+  * Removed installation instructions from manpage. Closes: #531145.
+  * Bumped Standards-Version to 3.8.1. No changes needed.
+
+ -- Manuel Prinz <manuel@debian.org>  Wed, 03 Jun 2009 00:50:20 +0200
+
+findimagedupes (2.18-1) unstable; urgency=low
+
+  [ Andreas Tille ]
+  * debian/copyright: Use <code@jhnc.org> as upstream copyright
+    holders address and also use Jonathan H N Chin as author because
+    he has taken over upstream maintenance
+
+ -- Manuel Prinz <manuel@debian.org>  Fri, 19 Dec 2008 09:06:01 +0100
+
+findimagedupes (2.17-1) unstable; urgency=low
+
+  * New Upstream Version
+
+ -- Manuel Prinz <manuel@debian.org>  Wed, 17 Dec 2008 13:23:43 +0100
+
+findimagedupes (2.14-1) unstable; urgency=low
+
+  [ Manuel Prinz ]
+  * Replaced the patch file by a sed call in debian/rules
+  * Installing upstream changelog
+  * Fixed lintian warnings about too long lines in debian/copyright
+  * Changed my email address in Uploaders field
+  * Fixed debhelper-but-no-misc-depends lintian warning by adding
+    ${misc:Depends} to the Depends field of the binary package
+
+  [ Andreas Tille ]
+  * New upstream version  (Closes: #507956)
+  * debian/control: Remove explicit versions on build depends
+
+ -- Manuel Prinz <manuel@debian.org>  Tue, 09 Dec 2008 18:53:42 +0100
+
+findimagedupes (2.11-2) unstable; urgency=low
+
+  [ Andreas Tille ]
+  * Added perlapi dependency. Thanks to Manuel Prinz <debian@pinguinkiste.de>
+    and Niko Tyni <ntyni@debian.org> for the hints. (Closes: #488148)
+ 
+  [ Manuel Prinz ]
+  * debian/control:
+    - Added myself to Uploaders
+    - Changed Vcs-* fields to point to Git repository
+
+ -- Manuel Prinz <debian@pinguinkiste.de>  Wed, 02 Jul 2008 22:31:20 +0200
+
+findimagedupes (2.11-1) unstable; urgency=low
+
+  * New upstream version
+  * Standards-Version: 3.8.0 (no changes necessary)
+
+ -- Andreas Tille <tille@debian.org>  Mon, 16 Jun 2008 09:19:19 +0200
+
+findimagedupes (2.7-3) unstable; urgency=low
+
+  * Group maintenance by Debian Science Team
+  * Vcs fields
+  * Package recompiled to work with new perl version
+    Closes: #479731
+  * Machine readable debian/copyright
+  * Added versioned Depends perl (>= 5.10.0) because the version
+    compiled under sid does not work with perl 5.8 any more
+
+ -- Andreas Tille <tille@debian.org>  Thu, 29 May 2008 08:26:37 +0200
+
+findimagedupes (2.7-2) unstable; urgency=low
+
+  * Fix missing shared library dependency by adding
+    Depends: ${shlibs:Depends}
+  * Move Homepage from description to tags
+
+ -- Andreas Tille <tille@debian.org>  Thu, 17 Jan 2008 22:21:07 +0100
+
+findimagedupes (2.7-1) unstable; urgency=low
+
+  * New upstream version
+    Closes: #454132
+  * Added watch file
+  * Create man page via pod2man
+  * Do not auto create debian/control
+  * Standards-Version: 3.7.3 (no changes needed)
+  * Depends libgraphics-magick-perl instead of perlmagick
+
+ -- Andreas Tille <tille@debian.org>  Fri, 07 Dec 2007 21:24:07 +0100
+
+findimagedupes (0.2-2) unstable; urgency=low
+
+  * We need every single Depency also in Build-Depends because
+    the program is called at build time.  So perlmagick was
+    added to Build-Depends
+    Closes: #388719
+
+ -- Andreas Tille <tille@debian.org>  Fri, 22 Sep 2006 10:51:05 +0200
+
+findimagedupes (0.2-1) unstable; urgency=low
+
+  * New upstream version
+    Closes: #388124, #388139
+    Quoting from the annoncement this version closes the following bugs
+    Closes: #86994:
+        Hopefully now even harder to tickle imagemagick weaknesses.
+    Closes: #86996:
+        I haven't implemented Dupes:: lines output so this is a non-issue.
+        My --program/--script options escape names with Perl's quotemeta()
+    Closes: #87010:
+        1) This version explicitly and deliberately does not do recursion.
+        2) This version can read a file-list from stdin.
+    Closes: #87013:
+        Integrated in new --program/--script options, which use this
+        algorithm to merge pairs of matches into sets before output.
+    Closes: #87017:
+        Integrated in new --add option.
+    Closes: #87024:
+        Pure Perl comparison replaced by new integrated C function.
+        Still O(n^2) but massive speedup from squishing the constant factor.
+        Should be able to compare 100k files in around 10 minutes.
+        Runtime is now dominated by the time it takes to do fingerprinting.
+    Closes: #113871:
+        "It works for me." (tm)
+  * Standards-Version: 3.7.2 (No changes needed)
+  * Switched to cdbs
+  * debian/copyright: New upstream author. License now GPL or
+    Artistic (like Perl)
+
+ -- Andreas Tille <tille@debian.org>  Mon, 18 Sep 2006 22:41:53 +0200
+
+findimagedupes (0.1.3-7) unstable; urgency=low
+
+  * Patch from Joerg Ostertag <joerg@ostertag.name> containing the
+    following modifications:
+    - more error handling
+    - fixed one of the status bars (The others are still broken)
+    - added -update feature
+
+ -- Andreas Tille <tille@debian.org>  Sat, 29 Oct 2005 09:50:12 +0200
+
+findimagedupes (0.1.3-6) unstable; urgency=low
+
+  * New maintainer
+    Closes: #218699
+  * Standards-Version: 3.6.2 (no changes)
+  * dh_installmanpages -> dh_installman
+  * README.Debian
+  * Added C++ version of comparison routine to examples and made a
+    hint in README.Debian what to do
+  * Added homepage to long description
+  * Applied patch from  Jonathan H N Chin <jhnc%stone@newton.cam.ac.uk>
+    (Thanks to Jonathan)
+    Closes: #86994
+  * Provided example script to enhance finding images which appear three
+    times or more. Thanks to Jonathan H N Chin again.
+    Closes: #87013
+  * Closing old bugs which can not be reproduced any more:
+    Closes: #113871 (newer ImageMagic libs seem to work)
+
+ -- Andreas Tille <tille@debian.org>  Tue, 14 Jun 2005 15:22:51 +0200
+
+findimagedupes (0.1.3-5) unstable; urgency=low
+
+  * Uploading with maintainer set to QA group
+  * debian/copyright: de-dh_make-boilerplated
+
+ -- Andrew Pollock <apollock@debian.org>  Sun, 23 May 2004 20:20:24 +1000
+
+findimagedupes (0.1.3-4.1) unstable; urgency=low
+
+  * NMU
+  * Fixed invalid Perl dependency, closes: #112987. Thanks to Brendan O'Dea.
+  * Fixed ImageMagick API, closes: #167097. Thanks to Matthias Urlichs.
+  * Changed Build-Depends to Build-Depends-Indep.
+
+ -- Martin A. Godisch <godisch@debian.org>  Sun, 27 Jul 2003 18:48:04 +0000
+
+findimagedupes (0.1.3-4) unstable; urgency=medium
+
+  * Updated to work with changes in perlmagick. This should work with both
+    old and new behaviour.
+
+ -- Beiad Ian Q. Dalton <idalton@ferret.dyndns.org>  Mon,  3 Sep 2001 07:31:35 -0700
+
+findimagedupes (0.1.3-3) unstable; urgency=low
+
+  * New maintainer upload  (closes: #100222)
+
+ -- Beiad Ian Q. Dalton <idalton@ferret.dyndns.org>  Sun, 10 Jun 2001 12:08:11 -0700
+
+findimagedupes (0.1.3-2) unstable; urgency=low
+
+  * Corrected typo in copyright file. 
+
+ -- Dr. Guenter Bechly <gbechly@debian.org>  Thu, 29 Mar 2001 11:43:08 +0200
+
+findimagedupes (0.1.3-1) unstable; urgency=low
+
+  * New upstream release; closes #84619
+  * Updated manpage.
+  * Removed the patch.diff and README.Debian, because the patch is included
+    in the new upstream release.
+  * Changed the rights for the COPYING and Readme-findimagedupes files.
+  * Added second upstream email address in copyright file.
+
+ -- Dr. Guenter Bechly <gbechly@debian.org>  Mon, 12 Feb 2001 19:52:16 +0100
+
+findimagedupes (0.1.2-3) unstable; urgency=low
+
+  * Applied a patch from Max Stekelenburg <m.stekelenburg@chello.nl> that
+    fixes the creation of empty databases. This patch is included as file
+    patch.diff.
+
+ -- Dr. Guenter Bechly <gbechly@debian.org>  Fri,  2 Feb 2001 21:05:30 +0100
+
+findimagedupes (0.1.2-2) unstable; urgency=low
+
+  * Changed Architecture from any to all in control; closes: #84109.
+
+ -- Dr. Guenter Bechly <gbechly@debian.org>  Fri,  2 Feb 2001 12:46:59 +0100
+
+findimagedupes (0.1.2-1) unstable; urgency=low
+
+  * Initial Release, closes: #83782.
+  * Wrote a manpage for Debian.
+
+ -- Dr. Guenter Bechly <gbechly@debian.org>  Sat, 27 Jan 2001 20:12:24 +0100
+
--- findimagedupes-2.18.orig/debian/control
+++ findimagedupes-2.18/debian/control
@@ -0,0 +1,22 @@
+Source: findimagedupes
+Section: graphics
+Priority: optional
+Maintainer: Debian Science Maintainers <debian-science-maintainers@lists.alioth.debian.org>
+DM-Upload-Allowed: yes
+Uploaders: Andreas Tille <tille@debian.org>, Manuel Prinz <manuel@debian.org>
+Build-Depends: cdbs (>= 0.4.57), debhelper (>= 5), libfile-mimeinfo-perl, libgraphics-magick-perl,
+ libinline-perl
+Standards-Version: 3.8.3
+Vcs-Browser: http://git.debian.org/?p=debian-science/packages/findimagedupes.git
+Vcs-Git: git://git.debian.org/git/debian-science/packages/findimagedupes.git
+Homepage: http://www.jhnc.org/findimagedupes/
+
+Package: findimagedupes
+Architecture: any
+Depends: ${perl:Depends}, ${shlibs:Depends}, ${misc:Depends}, libgraphics-magick-perl, libfile-mimeinfo-perl, libinline-perl
+Description: Finds visually similar or duplicate images
+ findimagedupes is a commandline utility which performs a rough
+ "visual diff" to two images. This allows you to compare two
+ images or a whole tree of images and determine if any are
+ similar or identical. On common image types, findimagedupes
+ seems to be around 98% accurate.
--- findimagedupes-2.18.orig/debian/rules
+++ findimagedupes-2.18/debian/rules
@@ -0,0 +1,26 @@
+#!/usr/bin/make -f
+# debian/rules for findimagedupes using cdbs
+# Andreas Tille <tille@debian.org>, GPL
+
+pkg:=findimagedupes
+
+include /usr/share/cdbs/1/rules/debhelper.mk
+include /usr/share/cdbs/1/class/perlmodule.mk
+
+DEB_DH_PERL_ARGS := usr/lib/findimagedupes/lib
+DEB_MAKEMAKER_USER_FLAGS := LIB=/usr/lib/findimagedupes/lib
+
+build/findimagedupes::
+
+	# Bug #531145: Removing installation instructions from the manpage, as
+	# they are useless if the package is installed. Upstream has no other
+	# documentation, so this section will stay in upstream's version.
+	if grep -q '^=head1 INSTALLATION' $(pkg); then \
+        sed -i.pristine '/^=head1 INSTALLATION/,/^=head1 /{/^=head1 OPTIONS/p;d;}' \
+		$(pkg); fi
+	# Upstream has now updated README himself in version 2.18
+	# It might be reasonable to create the README this way anyway
+	# pod2text findimagedupes > ./tmp/README
+
+clean::
+	[ ! -f findimagedupes.pristine ] || mv findimagedupes.pristine findimagedupes
