about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/video/mjpegtools/default.nix
blob: f231d6ed184da5d7aa2e745420026e22b73aff33 (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
35
36
37
38
39
40
41
42
43
44
45
46
{ stdenv, lib, fetchurl, gtk2, libdv, libjpeg, libpng, libX11, pkg-config, SDL, SDL_gfx
, withMinimal ? true
}:

# TODO:
# - make dependencies optional
# - libpng-apng as alternative to libpng?
# - libXxf86dga support? checking for XF86DGAQueryExtension in -lXxf86dga... no

stdenv.mkDerivation rec {
  pname = "mjpegtools";
  version = "2.2.1";

  src = fetchurl {
    url = "mirror://sourceforge/mjpeg/mjpegtools-${version}.tar.gz";
    sha256 = "sha256-sYBTbX2ZYLBeACOhl7ANyxAJKaSaq3HRnVX0obIQ9Jo=";
  };

  # Clang 16 defaults to C++17. `std::auto_ptr` has been removed from C++17, and the
  # `register` type class specifier is no longer allowed.
  patches = [ ./c++-17-fixes.patch ];

  hardeningDisable = [ "format" ];

  nativeBuildInputs = [ pkg-config ];
  buildInputs = [ libdv libjpeg libpng ]
              ++ lib.optionals (!withMinimal) [ gtk2 libX11 SDL SDL_gfx ];

  env.NIX_CFLAGS_COMPILE = lib.optionalString (!withMinimal) "-I${lib.getDev SDL}/include/SDL";

  postPatch = ''
    sed -i -e '/ARCHFLAGS=/s:=.*:=:' configure
  '';

  enableParallelBuilding = true;

  outputs = [ "out" "lib" ];

  meta = with lib; {
    description = "A suite of programs for processing MPEG or MJPEG video";
    homepage = "http://mjpeg.sourceforge.net/";
    license = licenses.gpl2Plus;
    platforms = platforms.unix;
    maintainers = with maintainers; [ abbradar ];
  };
}