nixpkgs/pkgs/applications/video/avidemux/default.nix

116 lines
3.1 KiB
Nix
Raw Normal View History

2016-03-26 09:44:26 +01:00
{ stdenv, lib, fetchurl, cmake, pkgconfig, lndir
, zlib, gettext, libvdpau, libva, libXv, sqlite, x265
, yasm, fribidi, gtk3, qt4
, withX264 ? true, x264
, withLAME ? true, lame
, withFAAC ? false, faac
2016-03-26 09:44:26 +01:00
, withVorbis ? true, libvorbis
, withPulse ? true, libpulseaudio
, withFAAD ? true, faad2
, withOpus ? true, libopus
, withVPX ? true, libvpx
}:
2016-03-26 09:44:26 +01:00
stdenv.mkDerivation rec {
name = "avidemux-${version}";
version = "2.6.12";
2014-04-09 11:06:46 +02:00
src = fetchurl {
2016-03-26 09:44:26 +01:00
url = "mirror://sourceforge/avidemux/avidemux/${version}/avidemux_${version}.tar.gz";
sha256 = "0nz52yih8sff53inndkh2dba759xjzsh4b8xjww419lcpk0qp6kn";
};
2014-04-09 11:06:46 +02:00
2016-03-26 09:44:26 +01:00
nativeBuildInputs = [ cmake pkgconfig yasm lndir ];
buildInputs = [ zlib gettext libvdpau libva libXv sqlite x265 fribidi gtk3 qt4 ]
++ lib.optional withX264 x264
++ 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
;
enableParallelBuilding = false;
outputs = [ "out" "cli" "gtk" "qt4" ];
patches = [ ./dynamic_install_dir.patch ];
buildCommand = ''
unpackPhase
cd "$sourceRoot"
patchPhase
export cmakeFlags="$cmakeFlags -DAVIDEMUX_SOURCE_DIR=$(pwd)"
function buildOutput() {
( plugin_ui="$1"
output_dir="$2"
shift 2
export cmakeFlags="$cmakeFlags -DPLUGIN_UI=$plugin_ui -DCMAKE_INSTALL_PREFIX=$output_dir"
for i in "$@" avidemux_plugins; do
( cd "$i"
cmakeConfigurePhase
buildPhase
installPhase
)
done
rm -rf avidemux_plugins/build
)
}
function buildUi() {
plugin_ui="$1"
output_dir="$2"
shift 2
# Hack to split builds properly
mkdir -p $output_dir
lndir $out $output_dir
buildOutput $plugin_ui $output_dir "$@"
}
function fixupUi() {
output_dir="$1"
shift
2016-03-26 09:44:26 +01:00
find $output_dir -lname $out\* -delete
find $output_dir -type f | while read -r f; do
rpath="$(patchelf --print-rpath $f 2>/dev/null)" || continue
new_rpath=""
IFS=':' read -ra old_rpath <<< "$rpath"
for p in "''${old_rpath[@]}"; do
new_rpath="$new_rpath:$p"
if [[ $p = $output_dir* ]]; then
new_rpath="$new_rpath:$out/''${p#$output_dir}"
fi
done
patchelf --set-rpath "$new_rpath" $f
patchelf --shrink-rpath $f
done
}
2016-03-26 09:44:26 +01:00
buildOutput COMMON $out avidemux_core
buildOutput SETTINGS $out
buildUi CLI $cli avidemux/cli
buildUi GTK $gtk avidemux/gtk
buildUi QT4 $qt4 avidemux/qt4
2016-03-26 09:44:26 +01:00
fixupPhase
2016-03-26 09:44:26 +01:00
fixupUi $cli
fixupUi $gtk
fixupUi $qt4
'';
2014-04-09 11:06:46 +02:00
meta = {
homepage = http://fixounet.free.fr/avidemux/;
description = "Free video editor designed for simple video editing tasks";
2016-03-26 09:44:26 +01:00
maintainers = with stdenv.lib.maintainers; [ viric abbradar ];
platforms = with stdenv.lib.platforms; linux;
2016-03-26 09:44:26 +01:00
license = stdenv.lib.licenses.gpl2;
};
}