Merge pull request #67790 from ivan/mpv-ffmpeg-runpath

mpv, ffmpeg: use addOpenGLRunpath to fix CUDA-accelerated playback
This commit is contained in:
Peter Simons 2019-09-16 20:10:18 +02:00 committed by GitHub
commit 409ff06407
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 8 deletions

View File

@ -1,6 +1,6 @@
{ config, stdenv, fetchurl, fetchFromGitHub, makeWrapper { config, stdenv, fetchurl, fetchFromGitHub, makeWrapper
, docutils, perl, pkgconfig, python3, which, ffmpeg_4 , addOpenGLRunpath, docutils, perl, pkgconfig, python3, which
, freefont_ttf, freetype, libass, libpthreadstubs, mujs , ffmpeg_4, freefont_ttf, freetype, libass, libpthreadstubs, mujs
, nv-codec-headers, lua, libuchardet, libiconv ? null, darwin , nv-codec-headers, lua, libuchardet, libiconv ? null, darwin
, waylandSupport ? stdenv.isLinux , waylandSupport ? stdenv.isLinux
@ -135,8 +135,7 @@ in stdenv.mkDerivation rec {
''; '';
nativeBuildInputs = [ nativeBuildInputs = [
docutils makeWrapper perl addOpenGLRunpath docutils makeWrapper perl pkgconfig python3 which
pkgconfig python3 which
]; ];
buildInputs = [ buildInputs = [
@ -214,11 +213,17 @@ in stdenv.mkDerivation rec {
${wrapperFlags} ${wrapperFlags}
''; '';
# Set RUNPATH so that libcuda in /run/opengl-driver(-32)/lib can be found.
# See the explanation in addOpenGLRunpath.
postFixup = optionalString stdenv.isLinux ''
addOpenGLRunpath $out/bin/.mpv-wrapped
'';
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "A media player that supports many video formats (MPlayer and mplayer2 fork)"; description = "A media player that supports many video formats (MPlayer and mplayer2 fork)";
homepage = https://mpv.io; homepage = https://mpv.io;
license = licenses.gpl2Plus; license = licenses.gpl2Plus;
maintainers = with maintainers; [ AndersonTorres fuuzetsu fpletz globin ]; maintainers = with maintainers; [ AndersonTorres fuuzetsu fpletz globin ivan ];
platforms = platforms.darwin ++ platforms.linux; platforms = platforms.darwin ++ platforms.linux;
longDescription = '' longDescription = ''

View File

@ -1,4 +1,4 @@
{ stdenv, fetchurl, pkgconfig, perl, texinfo, yasm { stdenv, fetchurl, pkgconfig, addOpenGLRunpath, perl, texinfo, yasm
, alsaLib, bzip2, fontconfig, freetype, gnutls, libiconv, lame, libass, libogg , alsaLib, bzip2, fontconfig, freetype, gnutls, libiconv, lame, libass, libogg
, libssh, libtheora, libva, libdrm, libvorbis, libvpx, lzma, libpulseaudio, soxr , libssh, libtheora, libva, libdrm, libvorbis, libvpx, lzma, libpulseaudio, soxr
, x264, x265, xvidcore, zlib, libopus, speex, nv-codec-headers, dav1d , x264, x265, xvidcore, zlib, libopus, speex, nv-codec-headers, dav1d
@ -42,7 +42,7 @@
let let
inherit (stdenv) isDarwin isFreeBSD isLinux isAarch32; inherit (stdenv) isDarwin isFreeBSD isLinux isAarch32;
inherit (stdenv.lib) optional optionals enableFeature; inherit (stdenv.lib) optional optionals optionalString enableFeature;
cmpVer = builtins.compareVersions; cmpVer = builtins.compareVersions;
reqMin = requiredVersion: (cmpVer requiredVersion branch != 1); reqMin = requiredVersion: (cmpVer requiredVersion branch != 1);
@ -157,7 +157,7 @@ stdenv.mkDerivation rec {
"--enable-cross-compile" "--enable-cross-compile"
] ++ optional stdenv.cc.isClang "--cc=clang"; ] ++ optional stdenv.cc.isClang "--cc=clang";
nativeBuildInputs = [ perl pkgconfig texinfo yasm ]; nativeBuildInputs = [ addOpenGLRunpath perl pkgconfig texinfo yasm ];
buildInputs = [ buildInputs = [
bzip2 fontconfig freetype gnutls libiconv lame libass libogg libssh libtheora bzip2 fontconfig freetype gnutls libiconv lame libass libogg libssh libtheora
@ -186,6 +186,10 @@ stdenv.mkDerivation rec {
substituteInPlace $pc \ substituteInPlace $pc \
--replace "includedir=$out" "includedir=''${!outputInclude}" --replace "includedir=$out" "includedir=''${!outputInclude}"
done done
'' + optionalString stdenv.isLinux ''
# Set RUNPATH so that libnvcuvid in /run/opengl-driver(-32)/lib can be found.
# See the explanation in addOpenGLRunpath.
addOpenGLRunpath $out/lib/libavcodec.so*
''; '';
installFlags = [ "install-man" ]; installFlags = [ "install-man" ];