Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

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)

authored by Maximilian Bosch and committed by Nikolay Amiantov f027e82e 247a7504

+82 -130
+26
pkgs/applications/video/avidemux/bootstrap_logging.patch
··· 1 + diff --git a/bootStrap.bash b/bootStrap.bash 2 + index 646a5e048..6429199ba 100644 3 + --- a/bootStrap.bash 4 + +++ b/bootStrap.bash 5 + @@ -4,6 +4,7 @@ 6 + # 7 + # By default we use qt5 now 8 + # 9 + +set -e # hard fail if something fails 10 + packages_ext="" 11 + rebuild=0 12 + do_core=1 13 + @@ -66,10 +67,10 @@ Process() 14 + fi 15 + cd $BUILDDIR 16 + cmake $COMPILER $PKG $FAKEROOT $QT_FLAVOR -DCMAKE_EDIT_COMMAND=vim $INSTALL_PREFIX $EXTRA $BUILD_QUIRKS $ASAN $DEBUG -G "$BUILDER" $SOURCEDIR || fail cmakeZ 17 + - make $PARAL >& /tmp/log$BUILDDIR || fail "make, result in /tmp/log$BUILDDIR" 18 + - if [ "x$PKG" != "x" ] ; then 19 + + make $PARAL 20 + + if [ "x$PKG" != "x" ] ; then 21 + $FAKEROOT_COMMAND make package DESTDIR=$FAKEROOT_DIR/tmp || fail package 22 + - fi 23 + + fi 24 + # we need the make install so that other packcges can be built against this one 25 + make install DESTDIR=$FAKEROOT_DIR 26 + }
+54 -102
pkgs/applications/video/avidemux/default.nix
··· 1 1 { stdenv, lib, fetchurl, cmake, pkgconfig, lndir 2 2 , zlib, gettext, libvdpau, libva, libXv, sqlite 3 - , yasm, freetype, fontconfig, fribidi, gtk3, qt4 3 + , yasm, freetype, fontconfig, fribidi 4 + , makeWrapper, libXext, mesa_glu, qttools, qtbase 4 5 , alsaLib 5 6 , withX265 ? true, x265 6 7 , withX264 ? true, x264 ··· 12 13 , withFAAD ? true, faad2 13 14 , withOpus ? true, libopus 14 15 , withVPX ? true, libvpx 16 + , withQT ? true 17 + , withCLI ? true 18 + , default ? "qt5" 19 + , withPlugins ? true 15 20 }: 16 21 17 - let 22 + assert withQT -> qttools != null && qtbase != null; 23 + assert default != "qt5" -> default == "cli"; 24 + assert !withQT -> default != "qt5"; 25 + 26 + stdenv.mkDerivation rec { 27 + name = "avidemux-${version}"; 18 28 version = "2.7.0"; 19 29 20 30 src = fetchurl { ··· 22 32 sha256 = "1bf4l9qwxq3smc1mx5pybydc742a4qqsk17z50j9550d9iwnn7gy"; 23 33 }; 24 34 25 - common = { 26 - inherit version src; 27 - 28 - patches = [ ./dynamic_install_dir.patch ]; 29 - 30 - enableParallelBuilding = false; 31 - 32 - nativeBuildInputs = [ cmake pkgconfig yasm ]; 33 - buildInputs = [ zlib gettext libvdpau libva libXv sqlite fribidi fontconfig freetype alsaLib ] 34 - ++ lib.optional withX264 x264 35 - ++ lib.optional withX265 x265 36 - ++ lib.optional withXvid xvidcore 37 - ++ lib.optional withLAME lame 38 - ++ lib.optional withFAAC faac 39 - ++ lib.optional withVorbis libvorbis 40 - ++ lib.optional withPulse libpulseaudio 41 - ++ lib.optional withFAAD faad2 42 - ++ lib.optional withOpus libopus 43 - ++ lib.optional withVPX libvpx 44 - ; 45 - 46 - meta = { 47 - homepage = http://fixounet.free.fr/avidemux/; 48 - description = "Free video editor designed for simple video editing tasks"; 49 - maintainers = with stdenv.lib.maintainers; [ viric abbradar ]; 50 - platforms = with stdenv.lib.platforms; linux; 51 - license = stdenv.lib.licenses.gpl2; 52 - }; 53 - }; 54 - 55 - core = stdenv.mkDerivation (common // { 56 - name = "avidemux-${version}"; 57 - 58 - preConfigure = '' 59 - cd avidemux_core 60 - ''; 61 - }); 62 - 63 - buildPlugin = args: stdenv.mkDerivation (common // { 64 - name = "avidemux-${args.pluginName}-${version}"; 65 - 66 - buildInputs = (args.buildInputs or []) ++ common.buildInputs ++ [ lndir ]; 67 - 68 - cmakeFlags = [ "-DPLUGIN_UI=${args.pluginUi}" ]; 69 - 70 - passthru.isUi = args.isUi or false; 71 - 72 - buildCommand = '' 73 - unpackPhase 74 - cd "$sourceRoot" 75 - patchPhase 76 - 77 - mkdir $out 78 - lndir ${core} $out 79 - 80 - export cmakeFlags="$cmakeFlags -DAVIDEMUX_SOURCE_DIR=$(pwd)" 81 - 82 - for i in ${toString (args.buildDirs or [])} avidemux_plugins; do 83 - ( cd "$i" 84 - cmakeConfigurePhase 85 - buildPhase 86 - installPhase 87 - ) 88 - done 35 + patches = [ ./dynamic_install_dir.patch ./bootstrap_logging.patch ]; 89 36 90 - fixupPhase 91 - ''; 37 + nativeBuildInputs = [ yasm cmake pkgconfig ]; 38 + buildInputs = [ 39 + zlib gettext libvdpau libva libXv sqlite fribidi fontconfig 40 + freetype alsaLib libXext mesa_glu makeWrapper 41 + ] ++ lib.optional withX264 x264 42 + ++ lib.optional withX265 x265 43 + ++ lib.optional withXvid xvidcore 44 + ++ lib.optional withLAME lame 45 + ++ lib.optional withFAAC faac 46 + ++ lib.optional withVorbis libvorbis 47 + ++ lib.optional withPulse libpulseaudio 48 + ++ lib.optional withFAAD faad2 49 + ++ lib.optional withOpus libopus 50 + ++ lib.optionals withQT [ qttools qtbase ] 51 + ++ lib.optional withVPX libvpx; 92 52 93 - meta = common.meta // args.meta or {}; 94 - }); 53 + buildCommand = '' 54 + unpackPhase 55 + cd "$sourceRoot" 56 + patchPhase 95 57 96 - in { 97 - avidemux_core = core; 98 - 99 - avidemux_cli = buildPlugin { 100 - pluginName = "cli"; 101 - pluginUi = "CLI"; 102 - isUi = true; 103 - buildDirs = [ "avidemux/cli" ]; 104 - }; 58 + export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${libXext}/lib" 59 + ${stdenv.shell} bootStrap.bash \ 60 + --with-core \ 61 + ${if withQT then "--with-qt" else "--without-qt"} \ 62 + ${if withCLI then "--with-cli" else "--without-cli"} \ 63 + ${if withPlugins then "--with-plugins" else "--without-plugins"} 105 64 106 - avidemux_qt4 = buildPlugin { 107 - pluginName = "qt4"; 108 - buildInputs = [ qt4 ]; 109 - pluginUi = "QT4"; 110 - isUi = true; 111 - buildDirs = [ "avidemux/qt4" ]; 112 - }; 65 + mkdir $out 66 + cp -R install/usr/* $out 113 67 114 - avidemux_gtk = buildPlugin { 115 - pluginName = "gtk"; 116 - buildInputs = [ gtk3 ]; 117 - pluginUi = "GTK"; 118 - isUi = true; 119 - buildDirs = [ "avidemux/gtk" ]; 120 - # Code seems unmaintained. 121 - meta.broken = true; 122 - }; 68 + for i in $out/bin/*; do 69 + wrapProgram $i \ 70 + --set ADM_ROOT_DIR $out \ 71 + --prefix LD_LIBRARY_PATH ":" "${libXext}/lib" 72 + done 73 + ln -s "$out/bin/avidemux3_${default}" "$out/bin/avidemux" 123 74 124 - avidemux_common = buildPlugin { 125 - pluginName = "common"; 126 - pluginUi = "COMMON"; 127 - }; 75 + fixupPhase 76 + ''; 128 77 129 - avidemux_settings = buildPlugin { 130 - pluginName = "settings"; 131 - pluginUi = "SETTINGS"; 78 + meta = with stdenv.lib; { 79 + homepage = http://fixounet.free.fr/avidemux/; 80 + description = "Free video editor designed for simple video editing tasks"; 81 + maintainers = with maintainers; [ viric abbradar ma27 ]; 82 + platforms = platforms.linux; 83 + license = licenses.gpl2; 132 84 }; 133 85 }
-24
pkgs/applications/video/avidemux/wrapper.nix
··· 1 - { symlinkJoin, avidemux_unwrapped, makeWrapper 2 - # GTK version is broken upstream, see https://bugzilla.redhat.com/show_bug.cgi?id=1244340 3 - , withUi ? "qt4" 4 - }: 5 - 6 - let ui = builtins.getAttr "avidemux_${withUi}" avidemux_unwrapped; in 7 - 8 - assert ui.isUi; 9 - 10 - symlinkJoin { 11 - name = "avidemux-${withUi}-${ui.version}"; 12 - 13 - paths = [ ui avidemux_unwrapped.avidemux_common avidemux_unwrapped.avidemux_settings ]; 14 - 15 - buildInputs = [ makeWrapper ]; 16 - 17 - postBuild = '' 18 - for i in $out/bin/*; do 19 - wrapProgram $i --set ADM_ROOT_DIR $out 20 - done 21 - ''; 22 - 23 - meta = ui.meta; 24 - }
+2 -4
pkgs/top-level/all-packages.nix
··· 14530 14530 14531 14531 autopanosiftc = callPackage ../applications/graphics/autopanosiftc { }; 14532 14532 14533 - avidemux_unwrapped = callPackage ../applications/video/avidemux { 14534 - libva = libva-full; # also wants libva-x11 14533 + avidemux = libsForQt5.callPackage ../applications/video/avidemux { 14534 + libva = libva-full; 14535 14535 }; 14536 - 14537 - avidemux = callPackage ../applications/video/avidemux/wrapper.nix { }; 14538 14536 14539 14537 avogadro = callPackage ../applications/science/chemistry/avogadro { 14540 14538 eigen = eigen2;