Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ stdenv 2, lib 3, fetchFromGitHub 4, imagemagickBig 5, pkg-config 6, withXorg ? true 7, libX11 8, libv4l 9, qtbase 10, qtx11extras 11, wrapQtAppsHook 12, wrapGAppsHook 13, gtk3 14, xmlto 15, docbook_xsl 16, autoreconfHook 17, dbus 18, enableVideo ? stdenv.isLinux 19 # The implementation is buggy and produces an error like 20 # Name Error (Connection ":1.4380" is not allowed to own the service "org.linuxtv.Zbar" due to security policies in the configuration file) 21 # for every scanned code. 22 # see https://github.com/mchehab/zbar/issues/104 23, enableDbus ? false 24, libintl 25, libiconv 26, Foundation 27, bash 28, python3 29, argp-standalone 30}: 31 32stdenv.mkDerivation rec { 33 pname = "zbar"; 34 version = "0.23.92"; 35 36 outputs = [ "out" "lib" "dev" "doc" "man" ]; 37 38 src = fetchFromGitHub { 39 owner = "mchehab"; 40 repo = "zbar"; 41 rev = version; 42 sha256 = "sha256-VhVrngAX7pXZp+szqv95R6RGAJojp3svdbaRKigGb0w="; 43 }; 44 45 nativeBuildInputs = [ 46 pkg-config 47 xmlto 48 autoreconfHook 49 docbook_xsl 50 ] ++ lib.optionals enableVideo [ 51 wrapGAppsHook 52 wrapQtAppsHook 53 ]; 54 55 buildInputs = [ 56 imagemagickBig 57 libintl 58 ] ++ lib.optionals stdenv.isDarwin [ 59 libiconv 60 Foundation 61 ] ++ lib.optionals enableDbus [ 62 dbus 63 ] ++ lib.optionals withXorg [ 64 libX11 65 ] ++ lib.optionals enableVideo [ 66 libv4l 67 gtk3 68 qtbase 69 qtx11extras 70 ]; 71 72 nativeCheckInputs = [ 73 bash 74 python3 75 ]; 76 77 checkInputs = lib.optionals stdenv.isDarwin [ 78 argp-standalone 79 ]; 80 81 # Note: postConfigure instead of postPatch in order to include some 82 # autoconf-generated files. The template files for the autogen'd scripts are 83 # not chmod +x, so patchShebangs misses them. 84 postConfigure = '' 85 patchShebangs test 86 ''; 87 88 # Disable assertions which include -dev QtBase file paths. 89 env.NIX_CFLAGS_COMPILE = "-DQT_NO_DEBUG"; 90 91 configureFlags = [ 92 "--without-python" 93 ] ++ (if enableDbus then [ 94 "--with-dbusconfdir=${placeholder "out"}/share" 95 ] else [ 96 "--without-dbus" 97 ]) ++ (if enableVideo then [ 98 "--with-gtk=gtk3" 99 ] else [ 100 "--disable-video" 101 "--without-gtk" 102 "--without-qt" 103 ]); 104 105 doCheck = true; 106 107 preCheck = lib.optionalString stdenv.isDarwin '' 108 export NIX_LDFLAGS="$NIX_LDFLAGS -largp" 109 ''; 110 111 dontWrapQtApps = true; 112 dontWrapGApps = true; 113 114 postFixup = lib.optionalString enableVideo '' 115 wrapGApp "$out/bin/zbarcam-gtk" 116 wrapQtApp "$out/bin/zbarcam-qt" 117 ''; 118 119 enableParallelBuilding = true; 120 121 meta = with lib; { 122 description = "Bar code reader"; 123 longDescription = '' 124 ZBar is an open source software suite for reading bar codes from various 125 sources, such as video streams, image files and raw intensity sensors. It 126 supports many popular symbologies (types of bar codes) including 127 EAN-13/UPC-A, UPC-E, EAN-8, Code 128, Code 39, Interleaved 2 of 5 and QR 128 Code. 129 ''; 130 maintainers = with maintainers; [ delroth raskin ]; 131 platforms = platforms.unix; 132 license = licenses.lgpl21; 133 homepage = "https://github.com/mchehab/zbar"; 134 mainProgram = "zbarimg"; 135 }; 136}