diff options
author | Robin Gloster <mail@glob.in> | 2016-03-30 09:01:20 +0000 |
---|---|---|
committer | Robin Gloster <mail@glob.in> | 2016-03-30 09:01:20 +0000 |
commit | a4e65c363964d8931e4defd4ac9bc54a06384317 (patch) | |
tree | 32248f4db87e7d2b7a95d96ee8e328f7c1dcc68d /pkgs/applications/video | |
parent | 9c3518bd6dc27cfe955d465c1cf51519dd1d917e (diff) | |
parent | 070b123d4b0b15801861e2e37c554190bc61d48b (diff) | |
download | nixlib-a4e65c363964d8931e4defd4ac9bc54a06384317.tar nixlib-a4e65c363964d8931e4defd4ac9bc54a06384317.tar.gz nixlib-a4e65c363964d8931e4defd4ac9bc54a06384317.tar.bz2 nixlib-a4e65c363964d8931e4defd4ac9bc54a06384317.tar.lz nixlib-a4e65c363964d8931e4defd4ac9bc54a06384317.tar.xz nixlib-a4e65c363964d8931e4defd4ac9bc54a06384317.tar.zst nixlib-a4e65c363964d8931e4defd4ac9bc54a06384317.zip |
Merge remote-tracking branch 'upstream/master' into hardened-stdenv
Diffstat (limited to 'pkgs/applications/video')
-rw-r--r-- | pkgs/applications/video/avidemux/default.nix | 127 | ||||
-rw-r--r-- | pkgs/applications/video/avidemux/dynamic_install_dir.patch | 12 | ||||
-rw-r--r-- | pkgs/applications/video/avidemux/wrapper.nix | 29 |
3 files changed, 139 insertions, 29 deletions
diff --git a/pkgs/applications/video/avidemux/default.nix b/pkgs/applications/video/avidemux/default.nix index 485d8c54eb36..177f3d1b20c9 100644 --- a/pkgs/applications/video/avidemux/default.nix +++ b/pkgs/applications/video/avidemux/default.nix @@ -1,46 +1,115 @@ -{stdenv, fetchurl, cmake, pkgconfig, libxml2, qt4, gtk, gettext, SDL, -libXv, pixman, libpthreadstubs, libXau, libXdmcp, libxslt, x264, -alsaLib, lame, faad2, libvorbis, yasm, libvpx, xvidcore, libva, -faac ? null, faacSupport ? false }: +{ 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 +, withVorbis ? true, libvorbis +, withPulse ? true, libpulseaudio +, withFAAD ? true, faad2 +, withOpus ? true, libopus +, withVPX ? true, libvpx +}: -assert stdenv ? glibc; -assert faacSupport -> faac != null; - -stdenv.mkDerivation { - name = "avidemux-2.5.6"; +stdenv.mkDerivation rec { + name = "avidemux-${version}"; + version = "2.6.12"; src = fetchurl { - url = mirror://sourceforge/avidemux/avidemux_2.5.6.tar.gz; - sha256 = "12wvxz0n2g85f079d8mdkkp2zm279d34m9v7qgcqndh48cn7znnn"; + url = "mirror://sourceforge/avidemux/avidemux/${version}/avidemux_${version}.tar.gz"; + sha256 = "0nz52yih8sff53inndkh2dba759xjzsh4b8xjww419lcpk0qp6kn"; }; - buildInputs = [ cmake pkgconfig libxml2 qt4 gtk gettext SDL libXv - pixman libpthreadstubs libXau libXdmcp libxslt x264 alsaLib - lame faad2 libvorbis yasm libvpx xvidcore libva - ] ++ stdenv.lib.optional faacSupport faac; + 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 - cmakeFlags = "-DPTHREAD_INCLUDE_DIR=${stdenv.glibc}/include" + - " -DGETTEXT_INCLUDE_DIR=${gettext}/include" + - " -DSDL_INCLUDE_DIR=${SDL}/include/SDL"; + 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 + } - NIX_LDFLAGS="-lpthread"; + buildOutput COMMON $out avidemux_core + buildOutput SETTINGS $out + buildUi CLI $cli avidemux/cli + buildUi GTK $gtk avidemux/gtk + buildUi QT4 $qt4 avidemux/qt4 - postInstall = '' - cd $NIX_BUILD_TOP/$sourceRoot - mkdir build_plugins - cd build_plugins - cmake $cmakeFlags -DAVIDEMUX_INSTALL_PREFIX=$out \ - -DAVIDEMUX_SOURCE_DIR=$NIX_BUILD_TOP/$sourceRoot \ - -DAVIDEMUX_CORECONFIG_DIR=$NIX_BUILD_TOP/$sourceRoot/build/config ../plugins + fixupPhase - make - make install + 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]; + maintainers = with stdenv.lib.maintainers; [ viric abbradar ]; platforms = with stdenv.lib.platforms; linux; + license = stdenv.lib.licenses.gpl2; }; } diff --git a/pkgs/applications/video/avidemux/dynamic_install_dir.patch b/pkgs/applications/video/avidemux/dynamic_install_dir.patch new file mode 100644 index 000000000000..f2f963e51694 --- /dev/null +++ b/pkgs/applications/video/avidemux/dynamic_install_dir.patch @@ -0,0 +1,12 @@ +diff -ru3 avidemux_2.6.12.old/avidemux_core/ADM_core/src/ADM_fileio.cpp avidemux_2.6.12/avidemux_core/ADM_core/src/ADM_fileio.cpp +--- avidemux_2.6.12.old/avidemux_core/ADM_core/src/ADM_fileio.cpp 2016-03-25 15:26:00.368213627 +0300 ++++ avidemux_2.6.12/avidemux_core/ADM_core/src/ADM_fileio.cpp 2016-03-26 02:32:56.163550537 +0300 +@@ -393,7 +393,7 @@ + + return ADM_getRelativePath(buffer, base1, base2, base3); + #else +- return ADM_getRelativePath(ADM_INSTALL_DIR, base1, base2, base3); ++ return ADM_getRelativePath(getenv("ADM_ROOT_DIR"), base1, base2, base3); + #endif + } + diff --git a/pkgs/applications/video/avidemux/wrapper.nix b/pkgs/applications/video/avidemux/wrapper.nix new file mode 100644 index 000000000000..ad41f56d39d2 --- /dev/null +++ b/pkgs/applications/video/avidemux/wrapper.nix @@ -0,0 +1,29 @@ +{ buildEnv, avidemux, makeWrapper +# GTK version is broken upstream, see https://bugzilla.redhat.com/show_bug.cgi?id=1244340 +, withUi ? "qt4" +}: + +let + ui = builtins.getAttr withUi avidemux; + +in buildEnv { + name = "avidemux-${withUi}-" + avidemux.version; + + paths = [ avidemux ui ]; + + buildInputs = [ makeWrapper ]; + + postBuild = '' + # TODO: This could be avoided if buildEnv could be forced to create all directories + if [ -L $out/bin ]; then + rm $out/bin + mkdir $out/bin + for i in ${ui}/bin/*; do + ln -s $i $out/bin + done + fi + for i in $out/bin/*; do + wrapProgram $i --set ADM_ROOT_DIR $out + done + ''; +} |