diff options
Diffstat (limited to 'pkgs/applications/video/mpv/default.nix')
-rw-r--r-- | pkgs/applications/video/mpv/default.nix | 41 |
1 files changed, 17 insertions, 24 deletions
diff --git a/pkgs/applications/video/mpv/default.nix b/pkgs/applications/video/mpv/default.nix index 8bb5d5aca1f4..9cb39d681401 100644 --- a/pkgs/applications/video/mpv/default.nix +++ b/pkgs/applications/video/mpv/default.nix @@ -1,4 +1,4 @@ -{ config, stdenv, fetchurl, fetchFromGitHub, makeWrapper, fetchpatch +{ config, stdenv, fetchurl, fetchFromGitHub, fetchpatch , addOpenGLRunpath, docutils, perl, pkgconfig, python3, wafHook, which , ffmpeg_4, freefont_ttf, freetype, libass, libpthreadstubs, mujs , nv-codec-headers, lua, libuchardet, libiconv ? null @@ -50,7 +50,6 @@ , vdpauSupport ? true, libvdpau ? null , xineramaSupport ? stdenv.isLinux, libXinerama ? null , xvSupport ? stdenv.isLinux, libXv ? null -, youtubeSupport ? true, youtube-dl ? null , zimgSupport ? true, zimg ? null , archiveSupport ? true, libarchive ? null , jackaudioSupport ? false, libjack2 ? null @@ -91,7 +90,6 @@ assert waylandSupport -> all available [ wayland wayland-protocols libxkbcom assert x11Support -> all available [ libGLU libGL libX11 libXext libXxf86vm libXrandr ]; assert xineramaSupport -> x11Support && available libXinerama; assert xvSupport -> x11Support && available libXv; -assert youtubeSupport -> available youtube-dl; assert zimgSupport -> available zimg; let @@ -112,6 +110,20 @@ in stdenv.mkDerivation rec { patchShebangs ./TOOLS/ ''; + passthru = { + inherit + # The wrapper consults luaEnv and lua.version + luaEnv + lua + # In the wrapper, we want to reference vapoursynth which has the + # `python3` passthru attribute (which has the `sitePrefix` + # attribute). This way we'll be sure that in the wrapper we'll + # use the same python3.sitePrefix used to build vapoursynth. + vapoursynthSupport + vapoursynth + ; + }; + NIX_LDFLAGS = optionalString x11Support "-lX11 -lXext " + optionalString stdenv.isDarwin "-framework CoreFoundation"; @@ -135,7 +147,7 @@ in stdenv.mkDerivation rec { ++ stdenv.lib.optional (!swiftSupport) "--disable-macos-cocoa-cb"; nativeBuildInputs = [ - addOpenGLRunpath docutils makeWrapper perl pkgconfig python3 wafHook which + addOpenGLRunpath docutils perl pkgconfig python3 wafHook which ] ++ optional swiftSupport swift; @@ -164,7 +176,6 @@ in stdenv.mkDerivation rec { ++ optional vdpauSupport libvdpau ++ optional xineramaSupport libXinerama ++ optional xvSupport libXv - ++ optional youtubeSupport youtube-dl ++ optional zimgSupport zimg ++ optional stdenv.isDarwin libiconv ++ optional stdenv.isLinux nv-codec-headers @@ -182,17 +193,6 @@ in stdenv.mkDerivation rec { python3 TOOLS/osxbundle.py -s build/mpv ''; - # Ensure youtube-dl is available in $PATH for mpv - wrapperFlags = - ''--prefix LUA_CPATH ';' "${luaEnv}/lib/lua/${lua.luaversion}/?.so" \'' + - ''--prefix LUA_PATH ';' "${luaEnv}/share/lua/${lua.luaversion}/?.lua" \'' + - ''--prefix PATH : "${luaEnv}/bin" \'' - + optionalString youtubeSupport '' - --prefix PATH : "${youtube-dl}/bin" \ - '' + optionalString vapoursynthSupport '' - --prefix PYTHONPATH : "${vapoursynth}/lib/${python3.libPrefix}/site-packages:$PYTHONPATH" - ''; - patches = stdenv.lib.optionals stdenv.isDarwin [ # Fix cocoa backend. Remove with the next release (fetchpatch { @@ -205,24 +205,17 @@ in stdenv.mkDerivation rec { # Use a standard font mkdir -p $out/share/mpv ln -s ${freefont_ttf}/share/fonts/truetype/FreeSans.ttf $out/share/mpv/subfont.ttf - wrapProgram "$out/bin/mpv" \ - ${wrapperFlags} cp TOOLS/umpv $out/bin - wrapProgram $out/bin/umpv \ - --set MPV "$out/bin/mpv" - '' + optionalString stdenv.isDarwin '' mkdir -p $out/Applications cp -r build/mpv.app $out/Applications - wrapProgram "$out/Applications/mpv.app/Contents/MacOS/mpv" \ - ${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 + addOpenGLRunpath $out/bin/mpv ''; meta = with stdenv.lib; { |