@@ -1,54 +1,50 @@
1−{ stdenv, fetchurl, pkgconfig
2−, libjpeg
3−, alsaLib ? null
4−, libX11 ? null
5−, qt4 ? null # The default is set to qt4 in all-packages.nix
6−, qt5 ? null
1+{ stdenv, lib, fetchurl, pkgconfig, perl, makeQtWrapper
2+, libjpeg, udev
3+, withUtils ? true
4+, withGUI ? true, alsaLib, libX11, qtbase, mesa_glu
75}:
86
97# See libv4l in all-packages.nix for the libs only (overrides alsa, libX11 & QT)
108
11−assert qt4 != null -> qt5 == null;
12−assert qt5 != null -> qt4 == null;
13−
14−let
15− inherit (stdenv.lib) optional;
16−in
17−
189stdenv.mkDerivation rec {
19− name = "v4l-utils-1.10.1";
10+ name = "v4l-utils-${version}";
11+ version = "1.12.3";
2012
2113 src = fetchurl {
2214 url = "http://linuxtv.org/downloads/v4l-utils/${name}.tar.bz2";
23− sha256 = "1h1nhg5cmmzlbipak526nk4bm6d0yb217mll75f3rpg7kz1cqiv1";
15+ sha256 = "0vpl3jl0x441y7b5cn7zhdsyi954hp9h2p30jhnr1zkx1rpxsiss";
2416 };
2517
2618 outputs = [ "out" "dev" ];
2719
28− configureFlags = [
29− "--enable-libv4l"
30− ] ++ (if (alsaLib != null && libX11 != null && (qt4 != null || qt5 != null)) then [
31− "--with-udevdir=\${out}/lib/udev"
32− "--enable-v4l-utils"
33− "--enable-qv4l2"
34− ] else [
35− "--without-libudev"
36− "--without-udevdir"
37− "--disable-v4l-utils"
38− "--disable-qv4l2"
39− ]);
20+ configureFlags =
21+ if withUtils then [
22+ "--with-udevdir=\${out}/lib/udev"
23+ ] else [
24+ "--disable-v4l-utils"
25+ ];
4026
4127 postFixup = ''
4228 # Create symlink for V4l1 compatibility
4329 ln -s "$dev/include/libv4l1-videodev.h" "$dev/include/videodev.h"
4430 '';
4531
46− nativeBuildInputs = [ pkgconfig ];
32+ nativeBuildInputs = [ pkgconfig perl ] ++ lib.optional (withUtils && withGUI) makeQtWrapper;
4733
48− buildInputs = [ alsaLib libX11 qt4 qt5 ];
34+ buildInputs = [ udev ] ++ lib.optionals (withUtils && withGUI) [ alsaLib libX11 qtbase mesa_glu ];
4935
5036 propagatedBuildInputs = [ libjpeg ];
5137
38+ NIX_CFLAGS_COMPILE = lib.optional (withUtils && withGUI) "-std=c++11";
39+
40+ postPatch = ''
41+ patchShebangs .
42+ '';
43+
44+ postInstall = lib.optionalString (withUtils && withGUI) ''
45+ wrapQtProgram $out/bin/qv4l2
46+ '';
47+
5248 meta = with stdenv.lib; {
5349 description = "V4L utils and libv4l, provide common image formats regardless of the v4l device";
5450 homepage = http://linuxtv.org/projects.php;