at master 4.0 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 fetchpatch2, 6 replaceVars, 7 libtool, 8 gettext, 9 zlib, 10 bzip2, 11 flac, 12 libvorbis, 13 exiv2, 14 libgsf, 15 pkg-config, 16 rpmSupport ? stdenv.hostPlatform.isLinux, 17 rpm, 18 gstreamerSupport ? true, 19 gst_all_1, 20 # ^ Needed e.g. for proper id3 and FLAC support. 21 # Set to `false` to decrease package closure size by about 87 MB (53%). 22 gstPlugins ? ( 23 gst: [ 24 gst.gst-plugins-base 25 gst.gst-plugins-good 26 ] 27 ), 28 # If an application needs additional gstreamer plugins it can also make them 29 # available by adding them to the environment variable 30 # GST_PLUGIN_SYSTEM_PATH_1_0, e.g. like this: 31 # postInstall = '' 32 # wrapProgram $out/bin/extract --prefix GST_PLUGIN_SYSTEM_PATH_1_0 : "$GST_PLUGIN_SYSTEM_PATH_1_0" 33 # ''; 34 # See also <https://nixos.org/nixpkgs/manual/#sec-language-gnome>. 35 gtkSupport ? true, 36 glib, 37 gtk3, 38 videoSupport ? true, 39 libmpeg2, 40}: 41 42stdenv.mkDerivation rec { 43 pname = "libextractor"; 44 version = "1.13"; 45 46 src = fetchurl { 47 url = "mirror://gnu/libextractor/${pname}-${version}.tar.gz"; 48 hash = "sha256-u48xLFHSAlciQ/ETxrYtghAwGrMMuu5gT5g32HjN91U="; 49 }; 50 51 patches = [ 52 # 0008513: test_exiv2 fails with Exiv2 0.28 53 # https://bugs.gnunet.org/view.php?id=8513 54 (fetchpatch2 { 55 url = "https://sources.debian.org/data/main/libe/libextractor/1%3A1.13-4/debian/patches/exiv2-0.28.diff"; 56 hash = "sha256-Re5iwlSyEpWu3PcHibaRKSfmdyHSZGMOdMZ6svTofvs="; 57 }) 58 ] 59 ++ lib.optionals gstreamerSupport [ 60 61 # Libraries cannot be wrapped so we need to hardcode the plug-in paths. 62 (replaceVars ./gst-hardcode-plugins.patch { 63 load_gst_plugins = lib.concatMapStrings ( 64 plugin: ''gst_registry_scan_path(gst_registry_get(), "${lib.getLib plugin}/lib/gstreamer-1.0");'' 65 ) (gstPlugins gst_all_1); 66 }) 67 ]; 68 69 preConfigure = '' 70 echo "patching installation directory in \`extractor.c'..." 71 sed -i "src/main/extractor.c" \ 72 -e "s|pexe[[:blank:]]*=.*$|pexe = strdup(\"$out/lib/\");|g" 73 ''; 74 75 nativeBuildInputs = [ pkg-config ]; 76 77 buildInputs = [ 78 libtool 79 gettext 80 zlib 81 bzip2 82 flac 83 libvorbis 84 exiv2 85 libgsf 86 ] 87 ++ lib.optionals rpmSupport [ rpm ] 88 ++ lib.optionals gstreamerSupport ([ gst_all_1.gstreamer ] ++ gstPlugins gst_all_1) 89 ++ lib.optionals gtkSupport [ 90 glib 91 gtk3 92 ] 93 ++ lib.optionals videoSupport [ libmpeg2 ]; 94 95 # Checks need to be run after "make install", otherwise plug-ins are not in 96 # the search path, etc. 97 doCheck = false; 98 doInstallCheck = !stdenv.hostPlatform.isDarwin; 99 installCheckPhase = "make check"; 100 101 meta = with lib; { 102 description = "Simple library for keyword extraction"; 103 mainProgram = "extract"; 104 105 longDescription = '' 106 GNU libextractor is a library used to extract meta-data from files 107 of arbitrary type. It is designed to use helper-libraries to perform 108 the actual extraction, and to be trivially extendable by linking 109 against external extractors for additional file types. 110 111 The goal is to provide developers of file-sharing networks or 112 WWW-indexing bots with a universal library to obtain simple keywords 113 to match against queries. libextractor contains a shell-command 114 extract that, similar to the well-known file command, can extract 115 meta-data from a file an print the results to stdout. 116 117 Currently, libextractor supports the following formats: HTML, PDF, 118 PS, OLE2 (DOC, XLS, PPT), OpenOffice (sxw), StarOffice (sdw), DVI, 119 MAN, FLAC, MP3 (ID3v1 and ID3v2), NSF(E) (NES music), SID (C64 120 music), OGG, WAV, EXIV2, JPEG, GIF, PNG, TIFF, DEB, RPM, TAR(.GZ), 121 ZIP, ELF, S3M (Scream Tracker 3), XM (eXtended Module), IT (Impulse 122 Tracker), FLV, REAL, RIFF (AVI), MPEG, QT and ASF. Also, various 123 additional MIME types are detected. 124 ''; 125 126 license = licenses.gpl3Plus; 127 128 maintainers = [ maintainers.jorsn ]; 129 platforms = platforms.unix; 130 }; 131}