Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at flake-libs 133 lines 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 [ 53 # 0008513: test_exiv2 fails with Exiv2 0.28 54 # https://bugs.gnunet.org/view.php?id=8513 55 (fetchpatch2 { 56 url = "https://sources.debian.org/data/main/libe/libextractor/1%3A1.13-4/debian/patches/exiv2-0.28.diff"; 57 hash = "sha256-Re5iwlSyEpWu3PcHibaRKSfmdyHSZGMOdMZ6svTofvs="; 58 }) 59 ] 60 ++ lib.optionals gstreamerSupport [ 61 62 # Libraries cannot be wrapped so we need to hardcode the plug-in paths. 63 (replaceVars ./gst-hardcode-plugins.patch { 64 load_gst_plugins = lib.concatMapStrings ( 65 plugin: ''gst_registry_scan_path(gst_registry_get(), "${lib.getLib plugin}/lib/gstreamer-1.0");'' 66 ) (gstPlugins gst_all_1); 67 }) 68 ]; 69 70 preConfigure = '' 71 echo "patching installation directory in \`extractor.c'..." 72 sed -i "src/main/extractor.c" \ 73 -e "s|pexe[[:blank:]]*=.*$|pexe = strdup(\"$out/lib/\");|g" 74 ''; 75 76 nativeBuildInputs = [ pkg-config ]; 77 78 buildInputs = 79 [ 80 libtool 81 gettext 82 zlib 83 bzip2 84 flac 85 libvorbis 86 exiv2 87 libgsf 88 ] 89 ++ lib.optionals rpmSupport [ rpm ] 90 ++ lib.optionals gstreamerSupport ([ gst_all_1.gstreamer ] ++ gstPlugins gst_all_1) 91 ++ lib.optionals gtkSupport [ 92 glib 93 gtk3 94 ] 95 ++ lib.optionals videoSupport [ libmpeg2 ]; 96 97 # Checks need to be run after "make install", otherwise plug-ins are not in 98 # the search path, etc. 99 doCheck = false; 100 doInstallCheck = !stdenv.hostPlatform.isDarwin; 101 installCheckPhase = "make check"; 102 103 meta = with lib; { 104 description = "Simple library for keyword extraction"; 105 mainProgram = "extract"; 106 107 longDescription = '' 108 GNU libextractor is a library used to extract meta-data from files 109 of arbitrary type. It is designed to use helper-libraries to perform 110 the actual extraction, and to be trivially extendable by linking 111 against external extractors for additional file types. 112 113 The goal is to provide developers of file-sharing networks or 114 WWW-indexing bots with a universal library to obtain simple keywords 115 to match against queries. libextractor contains a shell-command 116 extract that, similar to the well-known file command, can extract 117 meta-data from a file an print the results to stdout. 118 119 Currently, libextractor supports the following formats: HTML, PDF, 120 PS, OLE2 (DOC, XLS, PPT), OpenOffice (sxw), StarOffice (sdw), DVI, 121 MAN, FLAC, MP3 (ID3v1 and ID3v2), NSF(E) (NES music), SID (C64 122 music), OGG, WAV, EXIV2, JPEG, GIF, PNG, TIFF, DEB, RPM, TAR(.GZ), 123 ZIP, ELF, S3M (Scream Tracker 3), XM (eXtended Module), IT (Impulse 124 Tracker), FLV, REAL, RIFF (AVI), MPEG, QT and ASF. Also, various 125 additional MIME types are detected. 126 ''; 127 128 license = licenses.gpl3Plus; 129 130 maintainers = [ maintainers.jorsn ]; 131 platforms = platforms.unix; 132 }; 133}