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