2021-11-03 17:39:01 +00:00
|
|
|
{ config
|
|
|
|
, lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, fetchpatch
|
|
|
|
, addOpenGLRunpath
|
|
|
|
, docutils
|
|
|
|
, perl
|
|
|
|
, pkg-config
|
|
|
|
, python3
|
|
|
|
, wafHook
|
|
|
|
, which
|
|
|
|
, ffmpeg
|
|
|
|
, freefont_ttf
|
|
|
|
, freetype
|
|
|
|
, libass
|
|
|
|
, libpthreadstubs
|
|
|
|
, nv-codec-headers
|
|
|
|
, lua
|
|
|
|
, libuchardet
|
2021-11-11 14:08:25 +00:00
|
|
|
, libiconv
|
2020-02-07 21:09:23 +00:00
|
|
|
, CoreFoundation, Cocoa, CoreAudio, MediaPlayer
|
2016-08-27 05:36:40 +01:00
|
|
|
|
2019-02-03 15:33:13 +00:00
|
|
|
, waylandSupport ? stdenv.isLinux
|
2021-11-11 14:08:25 +00:00
|
|
|
, wayland
|
|
|
|
, wayland-protocols
|
|
|
|
, libxkbcommon
|
2016-08-27 05:36:40 +01:00
|
|
|
|
2018-09-04 17:44:01 +01:00
|
|
|
, x11Support ? stdenv.isLinux
|
2021-11-11 14:08:25 +00:00
|
|
|
, libGLU, libGL
|
|
|
|
, libX11
|
|
|
|
, libXext
|
|
|
|
, libXxf86vm
|
|
|
|
, libXrandr
|
2018-09-04 17:44:01 +01:00
|
|
|
|
2018-09-04 17:46:31 +01:00
|
|
|
, cddaSupport ? false
|
2021-11-11 14:08:25 +00:00
|
|
|
, libcdio
|
|
|
|
, libcdio-paranoia
|
2018-09-04 17:46:31 +01:00
|
|
|
|
2019-01-19 00:04:27 +00:00
|
|
|
, vulkanSupport ? stdenv.isLinux
|
2021-11-11 14:08:25 +00:00
|
|
|
, libplacebo
|
|
|
|
, shaderc
|
|
|
|
, vulkan-headers
|
|
|
|
, vulkan-loader
|
2019-10-25 16:52:58 +01:00
|
|
|
|
|
|
|
, drmSupport ? stdenv.isLinux
|
2021-11-11 14:08:25 +00:00
|
|
|
, libdrm
|
|
|
|
, mesa
|
|
|
|
|
|
|
|
, alsaSupport ? stdenv.isLinux, alsa-lib
|
|
|
|
, archiveSupport ? true, libarchive
|
|
|
|
, bluraySupport ? true, libbluray
|
|
|
|
, bs2bSupport ? true, libbs2b
|
|
|
|
, cacaSupport ? true, libcaca
|
|
|
|
, cmsSupport ? true, lcms2
|
|
|
|
, dvdnavSupport ? stdenv.isLinux, libdvdnav
|
|
|
|
, jackaudioSupport ? false, libjack2
|
2022-03-13 22:35:37 +00:00
|
|
|
, javascriptSupport ? true, mujs
|
2021-11-11 14:08:25 +00:00
|
|
|
, libpngSupport ? true, libpng
|
|
|
|
, openalSupport ? true, openalSoft
|
|
|
|
, pulseSupport ? config.pulseaudio or stdenv.isLinux, libpulseaudio
|
|
|
|
, rubberbandSupport ? stdenv.isLinux, rubberband
|
|
|
|
, screenSaverSupport ? true, libXScrnSaver
|
|
|
|
, sdl2Support ? true, SDL2
|
|
|
|
, sixelSupport ? false, libsixel
|
|
|
|
, speexSupport ? true, speex
|
|
|
|
, swiftSupport ? false, swift
|
|
|
|
, theoraSupport ? true, libtheora
|
|
|
|
, vaapiSupport ? stdenv.isLinux, libva
|
|
|
|
, vapoursynthSupport ? false, vapoursynth
|
|
|
|
, vdpauSupport ? true, libvdpau
|
|
|
|
, xineramaSupport ? stdenv.isLinux, libXinerama
|
|
|
|
, xvSupport ? stdenv.isLinux, libXv
|
|
|
|
, zimgSupport ? true, zimg
|
2014-09-27 21:18:42 +01:00
|
|
|
}:
|
2013-12-09 01:25:32 +00:00
|
|
|
|
2021-01-15 05:42:41 +00:00
|
|
|
with lib;
|
2013-12-09 01:25:32 +00:00
|
|
|
|
2016-08-27 05:36:40 +01:00
|
|
|
let
|
2019-10-25 16:52:58 +01:00
|
|
|
luaEnv = lua.withPackages (ps: with ps; [ luasocket ]);
|
2019-02-05 15:00:19 +00:00
|
|
|
|
2016-08-27 05:36:40 +01:00
|
|
|
in stdenv.mkDerivation rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "mpv";
|
2022-01-03 22:53:56 +00:00
|
|
|
version = "0.34.1";
|
2013-12-09 01:25:32 +00:00
|
|
|
|
2021-11-03 17:39:01 +00:00
|
|
|
outputs = [ "out" "dev" "man" ];
|
2021-08-22 21:49:20 +01:00
|
|
|
|
2016-08-24 23:47:13 +01:00
|
|
|
src = fetchFromGitHub {
|
2021-11-03 17:39:01 +00:00
|
|
|
owner = "mpv-player";
|
|
|
|
repo = "mpv";
|
|
|
|
rev = "v${version}";
|
2022-01-03 22:53:56 +00:00
|
|
|
sha256 = "12qxwm1ww5vhjddl8yvj1xa0n1fi9z3lmzwhaiday2v59ca0qgsk";
|
2013-12-09 01:25:32 +00:00
|
|
|
};
|
|
|
|
|
2017-12-18 16:43:24 +00:00
|
|
|
postPatch = ''
|
2015-05-28 14:30:36 +01:00
|
|
|
patchShebangs ./TOOLS/
|
|
|
|
'';
|
2021-11-11 14:08:25 +00:00
|
|
|
|
2021-11-03 17:39:01 +00:00
|
|
|
NIX_LDFLAGS = lib.optionalString x11Support "-lX11 -lXext "
|
2021-11-11 14:08:25 +00:00
|
|
|
+ lib.optionalString stdenv.isDarwin "-framework CoreFoundation";
|
2015-05-28 14:30:36 +01:00
|
|
|
|
2020-02-02 19:06:35 +00:00
|
|
|
wafConfigureFlags = [
|
2015-05-28 14:30:36 +01:00
|
|
|
"--enable-libmpv-shared"
|
2016-08-27 05:36:40 +01:00
|
|
|
"--enable-manpage-build"
|
2015-05-28 14:30:36 +01:00
|
|
|
"--disable-libmpv-static"
|
|
|
|
"--disable-static-build"
|
|
|
|
"--disable-build-date" # Purity
|
2021-11-03 17:39:01 +00:00
|
|
|
(lib.enableFeature archiveSupport "libarchive")
|
|
|
|
(lib.enableFeature cddaSupport "cdda")
|
|
|
|
(lib.enableFeature dvdnavSupport "dvdnav")
|
2022-03-13 22:35:37 +00:00
|
|
|
(lib.enableFeature javascriptSupport "javascript")
|
2021-11-03 17:39:01 +00:00
|
|
|
(lib.enableFeature openalSupport "openal")
|
|
|
|
(lib.enableFeature sdl2Support "sdl2")
|
|
|
|
(lib.enableFeature sixelSupport "sixel")
|
|
|
|
(lib.enableFeature vaapiSupport "vaapi")
|
|
|
|
(lib.enableFeature waylandSupport "wayland")
|
|
|
|
(lib.enableFeature stdenv.isLinux "dvbin")
|
2020-02-06 13:15:35 +00:00
|
|
|
] # Disable whilst Swift isn't supported
|
2021-01-15 05:42:41 +00:00
|
|
|
++ lib.optional (!swiftSupport) "--disable-macos-cocoa-cb";
|
2015-05-28 14:30:36 +01:00
|
|
|
|
2018-02-27 16:27:46 +00:00
|
|
|
nativeBuildInputs = [
|
2021-11-03 17:39:01 +00:00
|
|
|
addOpenGLRunpath
|
|
|
|
docutils
|
|
|
|
perl
|
|
|
|
pkg-config
|
|
|
|
python3
|
|
|
|
wafHook
|
|
|
|
which
|
|
|
|
] ++ lib.optionals swiftSupport [ swift ];
|
2015-05-28 14:30:36 +01:00
|
|
|
|
|
|
|
buildInputs = [
|
2021-11-03 17:39:01 +00:00
|
|
|
ffmpeg
|
|
|
|
freetype
|
|
|
|
libass
|
|
|
|
libpthreadstubs
|
|
|
|
libuchardet
|
|
|
|
luaEnv
|
|
|
|
] ++ lib.optionals alsaSupport [ alsa-lib ]
|
|
|
|
++ lib.optionals archiveSupport [ libarchive ]
|
|
|
|
++ lib.optionals bluraySupport [ libbluray ]
|
|
|
|
++ lib.optionals bs2bSupport [ libbs2b ]
|
|
|
|
++ lib.optionals cacaSupport [ libcaca ]
|
|
|
|
++ lib.optionals cddaSupport [ libcdio libcdio-paranoia ]
|
|
|
|
++ lib.optionals cmsSupport [ lcms2 ]
|
|
|
|
++ lib.optionals drmSupport [ libdrm mesa ]
|
|
|
|
++ lib.optionals dvdnavSupport [ libdvdnav libdvdnav.libdvdread ]
|
|
|
|
++ lib.optionals jackaudioSupport [ libjack2 ]
|
2022-03-13 22:35:37 +00:00
|
|
|
++ lib.optionals javascriptSupport [ mujs ]
|
2021-11-03 17:39:01 +00:00
|
|
|
++ lib.optionals libpngSupport [ libpng ]
|
|
|
|
++ lib.optionals openalSupport [ openalSoft ]
|
|
|
|
++ lib.optionals pulseSupport [ libpulseaudio ]
|
|
|
|
++ lib.optionals rubberbandSupport [ rubberband ]
|
|
|
|
++ lib.optionals screenSaverSupport [ libXScrnSaver ]
|
|
|
|
++ lib.optionals sdl2Support [ SDL2 ]
|
|
|
|
++ lib.optionals sixelSupport [ libsixel ]
|
|
|
|
++ lib.optionals speexSupport [ speex ]
|
|
|
|
++ lib.optionals theoraSupport [ libtheora ]
|
|
|
|
++ lib.optionals vaapiSupport [ libva ]
|
|
|
|
++ lib.optionals vapoursynthSupport [ vapoursynth ]
|
|
|
|
++ lib.optionals vdpauSupport [ libvdpau ]
|
|
|
|
++ lib.optionals vulkanSupport [ libplacebo shaderc vulkan-headers vulkan-loader ]
|
|
|
|
++ lib.optionals waylandSupport [ wayland wayland-protocols libxkbcommon ]
|
|
|
|
++ lib.optionals x11Support [ libX11 libXext libGLU libGL libXxf86vm libXrandr ]
|
|
|
|
++ lib.optionals xineramaSupport [ libXinerama ]
|
|
|
|
++ lib.optionals xvSupport [ libXv ]
|
|
|
|
++ lib.optionals zimgSupport [ zimg ]
|
|
|
|
++ lib.optionals stdenv.isLinux [ nv-codec-headers ]
|
|
|
|
++ lib.optionals stdenv.isDarwin [ libiconv ]
|
|
|
|
++ lib.optionals stdenv.isDarwin [ CoreFoundation Cocoa CoreAudio MediaPlayer ];
|
2013-12-09 01:25:32 +00:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2021-11-03 17:39:01 +00:00
|
|
|
postBuild = lib.optionalString stdenv.isDarwin ''
|
2018-07-16 14:04:10 +01:00
|
|
|
python3 TOOLS/osxbundle.py -s build/mpv
|
2013-12-09 01:25:32 +00:00
|
|
|
'';
|
|
|
|
|
2020-02-02 19:06:35 +00:00
|
|
|
postInstall = ''
|
2018-07-16 14:04:10 +01:00
|
|
|
# Use a standard font
|
|
|
|
mkdir -p $out/share/mpv
|
|
|
|
ln -s ${freefont_ttf}/share/fonts/truetype/FreeSans.ttf $out/share/mpv/subfont.ttf
|
2016-11-23 03:52:07 +00:00
|
|
|
|
2020-09-22 03:29:09 +01:00
|
|
|
cp TOOLS/mpv_identify.sh $out/bin
|
2016-11-23 03:52:07 +00:00
|
|
|
cp TOOLS/umpv $out/bin
|
2020-12-08 00:30:12 +00:00
|
|
|
cp $out/share/applications/mpv.desktop $out/share/applications/umpv.desktop
|
|
|
|
sed -i '/Icon=/ ! s/mpv/umpv/g' $out/share/applications/umpv.desktop
|
2021-08-22 21:49:20 +01:00
|
|
|
|
|
|
|
substituteInPlace $out/lib/pkgconfig/mpv.pc \
|
|
|
|
--replace "$out/include" "$dev/include"
|
2021-11-03 17:39:01 +00:00
|
|
|
'' + lib.optionalString stdenv.isDarwin ''
|
2018-07-16 14:04:10 +01:00
|
|
|
mkdir -p $out/Applications
|
|
|
|
cp -r build/mpv.app $out/Applications
|
2015-05-28 14:30:36 +01:00
|
|
|
'';
|
|
|
|
|
2019-08-30 20:54:08 +01:00
|
|
|
# Set RUNPATH so that libcuda in /run/opengl-driver(-32)/lib can be found.
|
|
|
|
# See the explanation in addOpenGLRunpath.
|
2021-11-03 17:39:01 +00:00
|
|
|
postFixup = lib.optionalString stdenv.isLinux ''
|
2020-05-22 18:27:38 +01:00
|
|
|
addOpenGLRunpath $out/bin/mpv
|
2019-08-30 20:54:08 +01:00
|
|
|
'';
|
|
|
|
|
2021-11-03 17:39:01 +00:00
|
|
|
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
|
|
|
|
;
|
2013-12-09 01:25:32 +00:00
|
|
|
};
|
2021-11-11 14:08:25 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://mpv.io";
|
|
|
|
description = "General-purpose media player, fork of MPlayer and mplayer2";
|
|
|
|
longDescription = ''
|
|
|
|
mpv is a free and open-source general-purpose video player, based on the
|
|
|
|
MPlayer and mplayer2 projects, with great improvements above both.
|
|
|
|
'';
|
|
|
|
license = licenses.gpl2Plus;
|
|
|
|
maintainers = with maintainers; [ AndersonTorres fpletz globin ma27 tadeokondrak ];
|
|
|
|
platforms = platforms.darwin ++ platforms.linux;
|
|
|
|
};
|
2013-12-09 01:25:32 +00:00
|
|
|
}
|