Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 136 lines 3.2 kB view raw
1{ 2 stdenv, 3 lib, 4 fetchurl, 5 glibc, 6 clang, 7 doxygen, 8 meson, 9 ninja, 10 pkg-config, 11 perl, 12 argp-standalone, 13 libjpeg, 14 json_c, 15 libbpf, 16 libelf, 17 udev, 18 udevCheckHook, 19 withUtils ? true, 20 withGUI ? true, 21 alsa-lib, 22 qt5compat, 23 qtbase, 24 libGLU, 25 wrapQtAppsHook, 26}: 27 28# See libv4l in all-packages.nix for the libs only (overrides alsa, QT) 29 30let 31 withQt = withUtils && withGUI; 32 33in 34# we need to use stdenv.mkDerivation in order not to pollute the libv4l’s closure with Qt 35stdenv.mkDerivation (finalAttrs: { 36 pname = "v4l-utils"; 37 version = "1.30.1"; 38 39 src = fetchurl { 40 url = "https://linuxtv.org/downloads/v4l-utils/v4l-utils-${finalAttrs.version}.tar.xz"; 41 hash = "sha256-wc9UnC7DzznrXse/FXMTSeYbJqIbXpY5IttCIzO64Zc="; 42 }; 43 44 patches = [ 45 # Has been submitted upstream, but can't fetchurl/fetchpatch 46 # because patch doesn't know how to decode quoted-printable. 47 # https://lore.kernel.org/all/4dgJekVdP7lLqOQ6JNW05sRHSkRmLLMMQnEn8NGUHPoHDn4SBkaGlHUW89vkJJu3IeFDAh3p6mlplTJJlWJx8V4rr62-hd83quCJ2sIuqoA=@protonmail.com/ 48 ./musl.patch 49 ]; 50 51 outputs = [ 52 "out" 53 ] 54 ++ lib.optional withUtils "lib" 55 ++ [ 56 "doc" 57 "dev" 58 ]; 59 60 mesonFlags = [ 61 (lib.mesonBool "v4l-utils" withUtils) 62 (lib.mesonEnable "gconv" stdenv.hostPlatform.isGnu) 63 (lib.mesonEnable "qv4l2" withQt) 64 (lib.mesonEnable "qvidcap" withQt) 65 (lib.mesonOption "udevdir" "${placeholder "out"}/lib/udev") 66 ] 67 ++ lib.optionals stdenv.hostPlatform.isGnu [ 68 (lib.mesonOption "gconvsysdir" "${glibc.out}/lib/gconv") 69 ]; 70 71 postFixup = '' 72 # Create symlink for V4l1 compatibility 73 ln -s "$dev/include/libv4l1-videodev.h" "$dev/include/videodev.h" 74 ''; 75 76 nativeBuildInputs = [ 77 clang 78 doxygen 79 meson 80 ninja 81 pkg-config 82 perl 83 udevCheckHook 84 ] 85 ++ lib.optional withQt wrapQtAppsHook; 86 87 buildInputs = [ 88 json_c 89 libbpf 90 libelf 91 udev 92 ] 93 ++ lib.optional (!stdenv.hostPlatform.isGnu) argp-standalone 94 ++ lib.optionals withQt [ 95 alsa-lib 96 qt5compat 97 qtbase 98 libGLU 99 ]; 100 101 hardeningDisable = [ "zerocallusedregs" ]; 102 103 propagatedBuildInputs = [ libjpeg ]; 104 105 # these two `substituteInPlace` have been sent upstream as patches 106 # https://lore.kernel.org/linux-media/867c4d2e-7871-4280-8c89-d4b654597f32@public-files.de/T/ 107 # they might fail and have to be removed once the patches get accepted 108 postPatch = '' 109 patchShebangs utils/ 110 substituteInPlace \ 111 lib/libdvbv5/meson.build \ 112 --replace-fail "install_dir: 'include/libdvbv5'" "install_dir: get_option('includedir') / 'libdvbv5'" 113 substituteInPlace \ 114 meson.build \ 115 --replace-fail "get_option('datadir') / 'locale'" "get_option('localedir')" 116 ''; 117 118 enableParallelBuilding = true; 119 120 doInstallCheck = true; 121 122 meta = with lib; { 123 description = "V4L utils and libv4l, provide common image formats regardless of the v4l device"; 124 homepage = "https://linuxtv.org/projects.php"; 125 changelog = "https://git.linuxtv.org/v4l-utils.git/plain/ChangeLog?h=v4l-utils-${finalAttrs.version}"; 126 license = with licenses; [ 127 lgpl21Plus 128 gpl2Plus 129 ]; 130 maintainers = with maintainers; [ 131 codyopel 132 yarny 133 ]; 134 platforms = platforms.linux; 135 }; 136})