summary refs log tree commit diff
path: root/pkgs/applications/video/avidemux/default.nix
blob: 6b20ce8870d72be3c9dbbebcb23638122967f5ce (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
{ stdenv, lib, fetchurl, cmake, pkgconfig, lndir
, zlib, gettext, libvdpau, libva, libXv, sqlite
, yasm, freetype, fontconfig, fribidi, gtk3, qt4
, withX265 ? true, x265
, withX264 ? true, x264
, withXvid ? true, xvidcore
, withLAME ? true, lame
, withFAAC ? false, faac
, withVorbis ? true, libvorbis
, withPulse ? true, libpulseaudio
, withFAAD ? true, faad2
, withOpus ? true, libopus
, withVPX ? true, libvpx
}:

let
  version = "2.6.12";

  src = fetchurl {
    url = "mirror://sourceforge/avidemux/avidemux/${version}/avidemux_${version}.tar.gz";
    sha256 = "0nz52yih8sff53inndkh2dba759xjzsh4b8xjww419lcpk0qp6kn";
  };

  common = {
    inherit version src;

    patches = [ ./dynamic_install_dir.patch ];

    enableParallelBuilding = false;

    nativeBuildInputs = [ cmake pkgconfig yasm ];
    buildInputs = [ zlib gettext libvdpau libva libXv sqlite fribidi fontconfig freetype ]
                  ++ lib.optional withX264 x264
                  ++ lib.optional withX265 x265
                  ++ lib.optional withXvid xvidcore
                  ++ lib.optional withLAME lame
                  ++ lib.optional withFAAC faac
                  ++ lib.optional withVorbis libvorbis
                  ++ lib.optional withPulse libpulseaudio
                  ++ lib.optional withFAAD faad2
                  ++ lib.optional withOpus libopus
                  ++ lib.optional withVPX libvpx
                  ;

    meta = {
      homepage = "http://fixounet.free.fr/avidemux/";
      description = "Free video editor designed for simple video editing tasks";
      maintainers = with stdenv.lib.maintainers; [ viric abbradar ];
      platforms = with stdenv.lib.platforms; linux;
      license = stdenv.lib.licenses.gpl2;
    };
  };

  core = stdenv.mkDerivation (common // {
    name = "avidemux-${version}";

    preConfigure = ''
      cd avidemux_core
    '';
  });

  buildPlugin = args: stdenv.mkDerivation (common // {
    name = "avidemux-${args.pluginName}-${version}";

    buildInputs = (args.buildInputs or []) ++ common.buildInputs ++ [ lndir ];

    cmakeFlags = [ "-DPLUGIN_UI=${args.pluginUi}" ];

    passthru.isUi = args.isUi or false;

    buildCommand = ''
      unpackPhase
      cd "$sourceRoot"
      patchPhase

      mkdir $out
      lndir ${core} $out

      export cmakeFlags="$cmakeFlags -DAVIDEMUX_SOURCE_DIR=$(pwd)"

      for i in ${toString (args.buildDirs or [])} avidemux_plugins; do
        ( cd "$i"
          cmakeConfigurePhase
          buildPhase
          installPhase
        )
      done

      fixupPhase
    '';
  });

in {
  avidemux_core = core;

  avidemux_cli = buildPlugin {
    pluginName = "cli";
    pluginUi = "CLI";
    isUi = true;
    buildDirs = [ "avidemux/cli" ];
  };

  avidemux_qt4 = buildPlugin {
    pluginName = "qt4";
    buildInputs = [ qt4 ];
    pluginUi = "QT4";
    isUi = true;
    buildDirs = [ "avidemux/qt4" ];
  };

  avidemux_gtk = buildPlugin {
    pluginName = "gtk";
    buildInputs = [ gtk3 ];
    pluginUi = "GTK";
    isUi = true;
    buildDirs = [ "avidemux/gtk" ];
  };

  avidemux_common = buildPlugin {
    pluginName = "common";
    pluginUi = "COMMON";
  };

  avidemux_settings = buildPlugin {
    pluginName = "settings";
    pluginUi = "SETTINGS";
  };
}