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