summary refs log tree commit diff
path: root/pkgs/applications/video/mjpg-streamer/default.nix
blob: 7cacc4fcf05efb6449cb133f153446950367f779 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{stdenv, fetchsvn, pkgconfig, libjpeg, imagemagick, libv4l}:

stdenv.mkDerivation rec {
  rev = "182";
  name = "mjpg-streamer-${rev}";

  src = fetchsvn {
    url = https://mjpg-streamer.svn.sourceforge.net/svnroot/mjpg-streamer/mjpg-streamer;
    inherit rev;
    sha256 = "008k2wk6xagprbiwk8fvzbz4dd6i8kzrr9n62gj5i1zdv7zcb16q";
  };

  patchPhase = ''
    substituteInPlace Makefile "make -C plugins\/input_gspcav1" "# make -C plugins\/input_gspcav1"
    substituteInPlace Makefile "cp plugins\/input_gspcav1\/input_gspcav1.so" "# cp plugins\/input_gspcav1\/input_gspcav1.so"
  '';

  postFixup = ''
    patchelf --set-rpath "$(patchelf --print-rpath $out/bin/mjpg_streamer):$out/lib:$out/lib/plugins" $out/bin/mjpg_streamer
  '';

  makeFlags = "DESTDIR=$(out)";

  preInstall = ''
    mkdir -p $out/{bin,lib}
  '';

  buildInputs = [ pkgconfig libjpeg imagemagick libv4l ];
  
  meta = {
    homepage = http://sourceforge.net/projects/mjpg-streamer/;
    description = "MJPG-streamer takes JPGs from Linux-UVC compatible webcams, filesystem or other input plugins and streams them as M-JPEG via HTTP to webbrowsers, VLC and other software";
  };
}