nixpkgs/pkgs/applications/video/avidemux/default.nix
Maximilian Bosch f027e82e76 avidemux: rewrite derivation
This drastically reduces the complexity of the `avidemux` derivation
and adds QT5 support (see #33248).

Rather than invoking `cmake` over preconfigured hooks, it's much easier
to use the `bootStrap.bash` script provided by the developers to do the
installation tasks. Furthermore this script makes it way easier to
configure which parts of `avidemux` should be used (e.g. CLI-only) or
without the plugins.

In order to create a CLI-only instance you can simply override the
derivation:

```
avidemux.override {
  withQT = false;
}
```

It's possible to set the default executable as well (`avidemux` creates
a `avidemux_qt5` and `avidemux_cli` executable by default):

```
avidemux.override {
  default = "cli"; # default is `qt5`
}
```

The GTK support has been dropped entirely since it was originally broken
in our system and can't be built ATM. Other distros such as ArchLinux
don't support GTK anymore (see https://git.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/avidemux#n64)
2018-02-25 01:04:07 +03:00

86 lines
2.5 KiB
Nix

{ stdenv, lib, fetchurl, cmake, pkgconfig, lndir
, zlib, gettext, libvdpau, libva, libXv, sqlite
, yasm, freetype, fontconfig, fribidi
, makeWrapper, libXext, mesa_glu, 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 ];
nativeBuildInputs = [ yasm cmake pkgconfig ];
buildInputs = [
zlib gettext libvdpau libva libXv sqlite fribidi fontconfig
freetype alsaLib libXext mesa_glu 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 ];
platforms = platforms.linux;
license = licenses.gpl2;
};
}