summary refs log tree commit diff
path: root/pkgs/applications/video/avidemux/default.nix
blob: 991842ba0dc15f03d0c6f33ba6bb9f3bdb206668 (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
{ stdenv, lib, fetchurl, fetchpatch, cmake, pkgconfig, lndir
, zlib, gettext, libvdpau, libva, libXv, sqlite
, yasm, freetype, fontconfig, fribidi
, makeWrapper, libXext, libGLU, qttools, qtbase
, alsaLib
, 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
, withQT ? true
, withCLI ? true
, default ? "qt5"
, withPlugins ? true
}:

assert withQT -> qttools != null && qtbase != null;
assert default != "qt5" -> default == "cli";
assert !withQT -> default != "qt5";

stdenv.mkDerivation rec {
  name = "avidemux-${version}";
  version = "2.7.0";

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

  patches = [
    ./dynamic_install_dir.patch
    ./bootstrap_logging.patch
    # glibc 2.27 compat
    (fetchpatch {
      url = https://github.com/mean00/avidemux2/commit/afdd9c4b876d77a4974d3fa7d9f25caeffbdf13d.patch;
      sha256 = "0mf8vpfdqybziqsfyvxwcdm3zsmnp64293icinhvfpq9xp5b6vn6";
    })
  ];

  nativeBuildInputs = [ yasm cmake pkgconfig ];
  buildInputs = [
    zlib gettext libvdpau libva libXv sqlite fribidi fontconfig
    freetype alsaLib libXext libGLU makeWrapper
  ] ++ 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.optionals withQT [ qttools qtbase ]
    ++ lib.optional withVPX libvpx;

  buildCommand = ''
    unpackPhase
    cd "$sourceRoot"
    patchPhase

    export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${libXext}/lib"
    ${stdenv.shell} bootStrap.bash \
      --with-core \
      ${if withQT then "--with-qt" else "--without-qt"} \
      ${if withCLI then "--with-cli" else "--without-cli"} \
      ${if withPlugins then "--with-plugins" else "--without-plugins"}

    mkdir $out
    cp -R install/usr/* $out

    for i in $out/bin/*; do
      wrapProgram $i \
        --set ADM_ROOT_DIR $out \
        --prefix LD_LIBRARY_PATH ":" "${libXext}/lib"
    done
    ln -s "$out/bin/avidemux3_${default}" "$out/bin/avidemux"

    fixupPhase
  '';

  meta = with stdenv.lib; {
    homepage = http://fixounet.free.fr/avidemux/;
    description = "Free video editor designed for simple video editing tasks";
    maintainers = with maintainers; [ viric abbradar ma27 ];
    # "CPU not supported" errors on AArch64
    platforms = [ "i686-linux" "x86_64-linux" ];
    license = licenses.gpl2;
  };
}