avidemux: refactor again to fix build failures

+108 -90
+93 -80
pkgs/applications/video/avidemux/default.nix
··· 1 1 { stdenv, lib, fetchurl, cmake, pkgconfig, lndir 2 - , zlib, gettext, libvdpau, libva, libXv, sqlite, x265 3 - , yasm, fribidi, gtk3, qt4 2 + , zlib, gettext, libvdpau, libva, libXv, sqlite 3 + , yasm, freetype, fontconfig, fribidi, gtk3, qt4 4 + , withX265 ? true, x265 4 5 , withX264 ? true, x264 6 + , withXvid ? true, xvidcore 5 7 , withLAME ? true, lame 6 8 , withFAAC ? false, faac 7 9 , withVorbis ? true, libvorbis ··· 11 13 , withVPX ? true, libvpx 12 14 }: 13 15 14 - stdenv.mkDerivation rec { 15 - name = "avidemux-${version}"; 16 + let 16 17 version = "2.6.12"; 17 18 18 19 src = fetchurl { ··· 20 21 sha256 = "0nz52yih8sff53inndkh2dba759xjzsh4b8xjww419lcpk0qp6kn"; 21 22 }; 22 23 23 - nativeBuildInputs = [ cmake pkgconfig yasm lndir ]; 24 - buildInputs = [ zlib gettext libvdpau libva libXv sqlite x265 fribidi gtk3 qt4 ] 25 - ++ lib.optional withX264 x264 26 - ++ lib.optional withLAME lame 27 - ++ lib.optional withFAAC faac 28 - ++ lib.optional withVorbis libvorbis 29 - ++ lib.optional withPulse libpulseaudio 30 - ++ lib.optional withFAAD faad2 31 - ++ lib.optional withOpus libopus 32 - ++ lib.optional withVPX libvpx 33 - ; 24 + common = { 25 + inherit version src; 26 + 27 + patches = [ ./dynamic_install_dir.patch ]; 28 + 29 + enableParallelBuilding = false; 30 + 31 + nativeBuildInputs = [ cmake pkgconfig yasm ]; 32 + buildInputs = [ zlib gettext libvdpau libva libXv sqlite fribidi fontconfig freetype ] 33 + ++ lib.optional withX264 x264 34 + ++ lib.optional withX265 x265 35 + ++ lib.optional withXvid xvidcore 36 + ++ lib.optional withLAME lame 37 + ++ lib.optional withFAAC faac 38 + ++ lib.optional withVorbis libvorbis 39 + ++ lib.optional withPulse libpulseaudio 40 + ++ lib.optional withFAAD faad2 41 + ++ lib.optional withOpus libopus 42 + ++ lib.optional withVPX libvpx 43 + ; 44 + 45 + meta = { 46 + homepage = http://fixounet.free.fr/avidemux/; 47 + description = "Free video editor designed for simple video editing tasks"; 48 + maintainers = with stdenv.lib.maintainers; [ viric abbradar ]; 49 + platforms = with stdenv.lib.platforms; linux; 50 + license = stdenv.lib.licenses.gpl2; 51 + }; 52 + }; 34 53 35 - enableParallelBuilding = false; 54 + core = stdenv.mkDerivation (common // { 55 + name = "avidemux-${version}"; 36 56 37 - outputs = [ "out" "cli" "gtk" "qt4" ]; 57 + preConfigure = '' 58 + cd avidemux_core 59 + ''; 60 + }); 38 61 39 - patches = [ ./dynamic_install_dir.patch ]; 62 + buildPlugin = args: stdenv.mkDerivation (common // { 63 + name = "avidemux-${args.pluginName}-${version}"; 40 64 41 - buildCommand = '' 42 - unpackPhase 43 - cd "$sourceRoot" 44 - patchPhase 65 + buildInputs = (args.buildInputs or []) ++ common.buildInputs ++ [ lndir ]; 45 66 46 - export cmakeFlags="$cmakeFlags -DAVIDEMUX_SOURCE_DIR=$(pwd)" 67 + cmakeFlags = [ "-DPLUGIN_UI=${args.pluginUi}" ]; 47 68 48 - function buildOutput() { 49 - ( plugin_ui="$1" 50 - output_dir="$2" 51 - shift 2 52 - export cmakeFlags="$cmakeFlags -DPLUGIN_UI=$plugin_ui -DCMAKE_INSTALL_PREFIX=$output_dir" 53 - for i in "$@" avidemux_plugins; do 54 - ( cd "$i" 55 - cmakeConfigurePhase 56 - buildPhase 57 - installPhase 58 - ) 59 - done 60 - rm -rf avidemux_plugins/build 61 - ) 62 - } 69 + passthru.isUi = args.isUi or false; 63 70 64 - function buildUi() { 65 - plugin_ui="$1" 66 - output_dir="$2" 67 - shift 2 71 + buildCommand = '' 72 + unpackPhase 73 + cd "$sourceRoot" 74 + patchPhase 68 75 69 - # Hack to split builds properly 70 - mkdir -p $output_dir 71 - lndir $out $output_dir 72 - buildOutput $plugin_ui $output_dir "$@" 73 - } 76 + mkdir $out 77 + lndir ${core} $out 74 78 75 - function fixupUi() { 76 - output_dir="$1" 77 - shift 79 + export cmakeFlags="$cmakeFlags -DAVIDEMUX_SOURCE_DIR=$(pwd)" 78 80 79 - find $output_dir -lname $out\* -delete 80 - find $output_dir -type f | while read -r f; do 81 - rpath="$(patchelf --print-rpath $f 2>/dev/null)" || continue 82 - new_rpath="" 83 - IFS=':' read -ra old_rpath <<< "$rpath" 84 - for p in "''${old_rpath[@]}"; do 85 - new_rpath="$new_rpath:$p" 86 - if [[ $p = $output_dir* ]]; then 87 - new_rpath="$new_rpath:$out/''${p#$output_dir}" 88 - fi 89 - done 90 - patchelf --set-rpath "$new_rpath" $f 91 - patchelf --shrink-rpath $f 81 + for i in ${toString (args.buildDirs or [])} avidemux_plugins; do 82 + ( cd "$i" 83 + cmakeConfigurePhase 84 + buildPhase 85 + installPhase 86 + ) 92 87 done 93 - } 94 88 95 - buildOutput COMMON $out avidemux_core 96 - buildOutput SETTINGS $out 97 - buildUi CLI $cli avidemux/cli 98 - buildUi GTK $gtk avidemux/gtk 99 - buildUi QT4 $qt4 avidemux/qt4 89 + fixupPhase 90 + ''; 91 + }); 100 92 101 - fixupPhase 93 + in { 94 + avidemux_core = core; 95 + 96 + avidemux_cli = buildPlugin { 97 + pluginName = "cli"; 98 + pluginUi = "CLI"; 99 + isUi = true; 100 + buildDirs = [ "avidemux/cli" ]; 101 + }; 102 + 103 + avidemux_qt4 = buildPlugin { 104 + pluginName = "qt4"; 105 + buildInputs = [ qt4 ]; 106 + pluginUi = "QT4"; 107 + isUi = true; 108 + buildDirs = [ "avidemux/qt4" ]; 109 + }; 110 + 111 + avidemux_gtk = buildPlugin { 112 + pluginName = "gtk"; 113 + buildInputs = [ gtk3 ]; 114 + pluginUi = "GTK"; 115 + isUi = true; 116 + buildDirs = [ "avidemux/gtk" ]; 117 + }; 102 118 103 - fixupUi $cli 104 - fixupUi $gtk 105 - fixupUi $qt4 106 - ''; 119 + avidemux_common = buildPlugin { 120 + pluginName = "common"; 121 + pluginUi = "COMMON"; 122 + }; 107 123 108 - meta = { 109 - homepage = http://fixounet.free.fr/avidemux/; 110 - description = "Free video editor designed for simple video editing tasks"; 111 - maintainers = with stdenv.lib.maintainers; [ viric abbradar ]; 112 - platforms = with stdenv.lib.platforms; linux; 113 - license = stdenv.lib.licenses.gpl2; 124 + avidemux_settings = buildPlugin { 125 + pluginName = "settings"; 126 + pluginUi = "SETTINGS"; 114 127 }; 115 128 }
+11 -6
pkgs/applications/video/avidemux/wrapper.nix
··· 1 - { buildEnv, avidemux, makeWrapper 1 + { buildEnv, avidemux_unwrapped, makeWrapper 2 2 # GTK version is broken upstream, see https://bugzilla.redhat.com/show_bug.cgi?id=1244340 3 3 , withUi ? "qt4" 4 4 }: 5 5 6 - let 7 - ui = builtins.getAttr withUi avidemux; 6 + let ui = builtins.getAttr "avidemux_${withUi}" avidemux_unwrapped; in 7 + 8 + assert ui.isUi; 9 + 10 + buildEnv { 11 + name = "avidemux-${withUi}-" + ui.version; 8 12 9 - in buildEnv { 10 - name = "avidemux-${withUi}-" + avidemux.version; 13 + paths = [ ui avidemux_unwrapped.avidemux_common avidemux_unwrapped.avidemux_settings ]; 11 14 12 - paths = [ avidemux ui ]; 15 + ignoreCollisions = true; 13 16 14 17 buildInputs = [ makeWrapper ]; 15 18 ··· 26 29 wrapProgram $i --set ADM_ROOT_DIR $out 27 30 done 28 31 ''; 32 + 33 + meta = ui.meta; 29 34 }
+4 -4
pkgs/top-level/all-packages.nix
··· 11628 11628 11629 11629 autopanosiftc = callPackage ../applications/graphics/autopanosiftc { }; 11630 11630 11631 - avidemux_unwrapped = callPackage ../applications/video/avidemux { }; 11632 - 11633 - avidemux = callPackage ../applications/video/avidemux/wrapper.nix { 11634 - avidemux = avidemux_unwrapped; 11631 + avidemux_unwrapped = callPackage ../applications/video/avidemux { 11632 + libva = libva-full; # also wants libva-x11 11635 11633 }; 11634 + 11635 + avidemux = callPackage ../applications/video/avidemux/wrapper.nix { }; 11636 11636 11637 11637 avogadro = callPackage ../applications/science/chemistry/avogadro { 11638 11638 eigen = eigen2;