diff options
author | Nikolay Amiantov <ab@fmap.me> | 2016-04-13 18:15:36 +0300 |
---|---|---|
committer | Nikolay Amiantov <ab@fmap.me> | 2016-04-14 00:31:16 +0300 |
commit | 76281d5dec8f76f5b9c46a22e279bb64f6c75ffa (patch) | |
tree | 34f6980a502d3e3f684d6c4d34cc67a8b70fd94f /pkgs/applications/video | |
parent | 0420a532e9ac71d9e7f6107acf4fac8eaa4d14fe (diff) | |
download | nixpkgs-76281d5dec8f76f5b9c46a22e279bb64f6c75ffa.tar nixpkgs-76281d5dec8f76f5b9c46a22e279bb64f6c75ffa.tar.gz nixpkgs-76281d5dec8f76f5b9c46a22e279bb64f6c75ffa.tar.bz2 nixpkgs-76281d5dec8f76f5b9c46a22e279bb64f6c75ffa.tar.lz nixpkgs-76281d5dec8f76f5b9c46a22e279bb64f6c75ffa.tar.xz nixpkgs-76281d5dec8f76f5b9c46a22e279bb64f6c75ffa.tar.zst nixpkgs-76281d5dec8f76f5b9c46a22e279bb64f6c75ffa.zip |
avidemux: refactor again to fix build failures
Diffstat (limited to 'pkgs/applications/video')
-rw-r--r-- | pkgs/applications/video/avidemux/default.nix | 201 | ||||
-rw-r--r-- | pkgs/applications/video/avidemux/wrapper.nix | 17 |
2 files changed, 118 insertions, 100 deletions
diff --git a/pkgs/applications/video/avidemux/default.nix b/pkgs/applications/video/avidemux/default.nix index 177f3d1b20c..96017a7ba19 100644 --- a/pkgs/applications/video/avidemux/default.nix +++ b/pkgs/applications/video/avidemux/default.nix @@ -1,7 +1,9 @@ { stdenv, lib, fetchurl, cmake, pkgconfig, lndir -, zlib, gettext, libvdpau, libva, libXv, sqlite, x265 -, yasm, fribidi, gtk3, qt4 +, 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 @@ -11,8 +13,7 @@ , withVPX ? true, libvpx }: -stdenv.mkDerivation rec { - name = "avidemux-${version}"; +let version = "2.6.12"; src = fetchurl { @@ -20,96 +21,108 @@ stdenv.mkDerivation rec { sha256 = "0nz52yih8sff53inndkh2dba759xjzsh4b8xjww419lcpk0qp6kn"; }; - 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 - - 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 + 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 - } - - buildOutput COMMON $out avidemux_core - buildOutput SETTINGS $out - buildUi CLI $cli avidemux/cli - buildUi GTK $gtk avidemux/gtk - buildUi QT4 $qt4 avidemux/qt4 - - fixupPhase - - fixupUi $cli - fixupUi $gtk - fixupUi $qt4 - ''; - - 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; + + 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"; }; } diff --git a/pkgs/applications/video/avidemux/wrapper.nix b/pkgs/applications/video/avidemux/wrapper.nix index ad41f56d39d..1d1c66cb9fe 100644 --- a/pkgs/applications/video/avidemux/wrapper.nix +++ b/pkgs/applications/video/avidemux/wrapper.nix @@ -1,15 +1,18 @@ -{ buildEnv, avidemux, makeWrapper +{ buildEnv, avidemux_unwrapped, makeWrapper # GTK version is broken upstream, see https://bugzilla.redhat.com/show_bug.cgi?id=1244340 , withUi ? "qt4" }: -let - ui = builtins.getAttr withUi avidemux; +let ui = builtins.getAttr "avidemux_${withUi}" avidemux_unwrapped; in -in buildEnv { - name = "avidemux-${withUi}-" + avidemux.version; +assert ui.isUi; - paths = [ avidemux ui ]; +buildEnv { + name = "avidemux-${withUi}-" + ui.version; + + paths = [ ui avidemux_unwrapped.avidemux_common avidemux_unwrapped.avidemux_settings ]; + + ignoreCollisions = true; buildInputs = [ makeWrapper ]; @@ -26,4 +29,6 @@ in buildEnv { wrapProgram $i --set ADM_ROOT_DIR $out done ''; + + meta = ui.meta; } |