1{ fetchurl, stdenv, libtool, gettext, zlib, bzip2, flac, libvorbis
2, exiv2, libgsf, rpm, pkgconfig
3, gtkSupport ? true, glib ? null, gtk3 ? null
4, videoSupport ? true, ffmpeg ? null, libmpeg2 ? null}:
5
6assert gtkSupport -> glib != null && gtk3 != null;
7assert videoSupport -> ffmpeg != null && libmpeg2 != null;
8
9stdenv.mkDerivation rec {
10 name = "libextractor-1.2";
11
12 src = fetchurl {
13 url = "mirror://gnu/libextractor/${name}.tar.gz";
14 sha256 = "1n7z6s5ils6xmf6b0z1xda41maxj94c1n6wlyyxmacs5lrkh2a96";
15 };
16
17 preConfigure =
18 '' echo "patching installation directory in \`extractor.c'..."
19 sed -i "src/main/extractor.c" \
20 -e "s|pexe[[:blank:]]*=.*$|pexe = strdup(\"$out/lib/\");|g"
21 '';
22
23 buildInputs =
24 [ libtool gettext zlib bzip2 flac libvorbis exiv2
25 libgsf rpm
26 pkgconfig
27 ] ++ stdenv.lib.optionals gtkSupport [ glib gtk3 ]
28 ++ stdenv.lib.optionals videoSupport [ ffmpeg libmpeg2 ];
29
30 configureFlags = "--disable-ltdl-install "
31 + "--with-ltdl-include=${libtool}/include "
32 + "--with-ltdl-lib=${libtool}/lib "
33 + "--enable-xpdf";
34
35 # Checks need to be run after "make install", otherwise plug-ins are not in
36 # the search path, etc.
37 # FIXME: Tests currently fail and the test framework appears to be deeply
38 # broken anyway.
39 doCheck = false;
40 #postInstall = "make check";
41
42 meta = {
43 description = "Simple library for keyword extraction";
44
45 longDescription =
46 '' GNU libextractor is a library used to extract meta-data from files
47 of arbitrary type. It is designed to use helper-libraries to perform
48 the actual extraction, and to be trivially extendable by linking
49 against external extractors for additional file types.
50
51 The goal is to provide developers of file-sharing networks or
52 WWW-indexing bots with a universal library to obtain simple keywords
53 to match against queries. libextractor contains a shell-command
54 extract that, similar to the well-known file command, can extract
55 meta-data from a file an print the results to stdout.
56
57 Currently, libextractor supports the following formats: HTML, PDF,
58 PS, OLE2 (DOC, XLS, PPT), OpenOffice (sxw), StarOffice (sdw), DVI,
59 MAN, FLAC, MP3 (ID3v1 and ID3v2), NSF(E) (NES music), SID (C64
60 music), OGG, WAV, EXIV2, JPEG, GIF, PNG, TIFF, DEB, RPM, TAR(.GZ),
61 ZIP, ELF, S3M (Scream Tracker 3), XM (eXtended Module), IT (Impulse
62 Tracker), FLV, REAL, RIFF (AVI), MPEG, QT and ASF. Also, various
63 additional MIME types are detected.
64 '';
65
66 license = stdenv.lib.licenses.gpl2Plus;
67
68 maintainers = [ ];
69 };
70}