nixpkgs/pkgs/applications/video/avidemux/default.nix
Maximilian Bosch d2f623d35e
avidemux: 2.7.0 -> 2.7.1
The current version of `avidemux` (v2.7.0) breaks on master (see
https://hydra.nixos.org/build/75993794), the 18.03 build remains fine
(https://hydra.nixos.org/build/75935027).

The following changes have been applied:

* `glibc` compat patch is obsolete as it landed in upstream.

* Fixed QT_PLUGIN_PATH for QT binaries to avoid errors because of
  missing plugins like this:

  ```
  qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in ""
  This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

  [1]    20081 abort      /nix/store/rjwxc6ih15zwvvy71ss8bvnh56ibfbmj-avidemux-2.7.1/bin/avidemux3_qt5
  ```
2018-06-19 11:45:47 +02:00

95 lines
2.9 KiB
Nix

{ stdenv, lib, fetchurl, 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.1";
src = fetchurl {
url = "mirror://sourceforge/avidemux/avidemux/${version}/avidemux_${version}.tar.gz";
sha256 = "15g9h791qbnmycabbbl7s2b3n3xpvygm88qrfk35g2cw6957ik9w";
};
patches = [
./dynamic_install_dir.patch
./bootstrap_logging.patch
];
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 = let
qtVersion = "5.${stdenv.lib.versions.minor qtbase.version}";
wrapProgram = f: "wrapProgram ${f} --set ADM_ROOT_DIR $out --prefix LD_LIBRARY_PATH : ${libXext}/lib";
in ''
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
${wrapProgram "$out/bin/avidemux3_cli"}
${stdenv.lib.optionalString withQT ''
${wrapProgram "$out/bin/avidemux3_qt5"} --prefix QT_PLUGIN_PATH : ${qtbase}/lib/qt-${qtVersion}/plugins
${wrapProgram "$out/bin/avidemux3_jobs_qt5"} --prefix QT_PLUGIN_PATH : ${qtbase}/lib/qt-${qtVersion}/plugins
''}
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;
};
}