From f8fb13e64caf482f06137f93f16d9147440d2d90 Mon Sep 17 00:00:00 2001 From: Michael Hoang Date: Mon, 16 Jul 2018 23:04:10 +1000 Subject: mpv: build and install macOS App Bundle --- pkgs/applications/video/mpv/default.nix | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) (limited to 'pkgs/applications/video') diff --git a/pkgs/applications/video/mpv/default.nix b/pkgs/applications/video/mpv/default.nix index 55ab1b95489..c384455d672 100644 --- a/pkgs/applications/video/mpv/default.nix +++ b/pkgs/applications/video/mpv/default.nix @@ -171,9 +171,12 @@ in stdenv.mkDerivation rec { buildPhase = '' python3 ${waf} build + '' + optionalString stdenv.isDarwin '' + python3 TOOLS/osxbundle.py -s build/mpv ''; - installPhase = + # Ensure youtube-dl is available in $PATH for mpv + wrapperFlags = let getPath = type : "${luasocket}/lib/lua/${lua.luaversion}/?.${type};" + "${luasocket}/share/lua/${lua.luaversion}/?.${type}"; @@ -181,24 +184,32 @@ in stdenv.mkDerivation rec { luaCPath = getPath "so"; in '' - python3 ${waf} install - - # Use a standard font - mkdir -p $out/share/mpv - ln -s ${freefont_ttf}/share/fonts/truetype/FreeSans.ttf $out/share/mpv/subfont.ttf - # Ensure youtube-dl is available in $PATH for MPV - wrapProgram $out/bin/mpv \ --prefix LUA_PATH : "${luaPath}" \ --prefix LUA_CPATH : "${luaCPath}" \ '' + optionalString youtubeSupport '' --prefix PATH : "${youtube-dl}/bin" \ '' + optionalString vapoursynthSupport '' --prefix PYTHONPATH : "${vapoursynth}/lib/${python3.libPrefix}/site-packages:$PYTHONPATH" - '' + '' + ''; + + installPhase = '' + python3 ${waf} install + + # 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} ''; meta = with stdenv.lib; { -- cgit 1.4.1