Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mpv-unwrapped: 0.34.1 -> 0.35.0 #200914

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 32 additions & 43 deletions pkgs/applications/video/mpv/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
, fetchFromGitHub
, addOpenGLRunpath
, docutils
, perl
, meson
, ninja
, pkg-config
, python3
, wafHook
, which
, ffmpeg
, freefont_ttf
, freetype
Expand Down Expand Up @@ -40,7 +39,7 @@

, vulkanSupport ? stdenv.isLinux
, libplacebo
, shaderc
, shaderc # instead of spirv-cross
, vulkan-headers
, vulkan-loader

Expand All @@ -55,11 +54,13 @@
, cacaSupport ? true, libcaca
, cmsSupport ? true, lcms2
, dvdnavSupport ? stdenv.isLinux, libdvdnav
, dvbinSupport ? stdenv.isLinux
, jackaudioSupport ? false, libjack2
, javascriptSupport ? true, mujs
, libpngSupport ? true, libpng
, openalSupport ? true, openalSoft
, pulseSupport ? config.pulseaudio or stdenv.isLinux, libpulseaudio
, pipewireSupport ? stdenv.isLinux, pipewire
, rubberbandSupport ? true, rubberband
, screenSaverSupport ? true, libXScrnSaver
, sdl2Support ? true, SDL2
Expand All @@ -75,62 +76,54 @@
, zimgSupport ? true, zimg
}:

with lib;

let
luaEnv = lua.withPackages (ps: with ps; [ luasocket ]);

in stdenv.mkDerivation rec {
pname = "mpv";
version = "0.34.1";
version = "0.35.0";

outputs = [ "out" "dev" "man" ];

src = fetchFromGitHub {
owner = "mpv-player";
repo = "mpv";
rev = "v${version}";
sha256 = "12qxwm1ww5vhjddl8yvj1xa0n1fi9z3lmzwhaiday2v59ca0qgsk";
sha256 = "sha256-U3NDSxlX4/WkoHFkOvpcwPMwfwTnSpCw0QI5yLMK08o=";
};

postPatch = ''
patchShebangs ./TOOLS/
patchShebangs version.* ./TOOLS/
'';

NIX_LDFLAGS = lib.optionalString x11Support "-lX11 -lXext "
+ lib.optionalString stdenv.isDarwin "-framework CoreFoundation";

# These flags are not supported and cause the build
# to fail, even when cross compilation itself works.
dontAddWafCrossFlags = true;

wafConfigureFlags = [
"--enable-libmpv-shared"
"--enable-manpage-build"
"--disable-libmpv-static"
"--disable-static-build"
"--disable-build-date" # Purity
(lib.enableFeature archiveSupport "libarchive")
(lib.enableFeature cddaSupport "cdda")
(lib.enableFeature dvdnavSupport "dvdnav")
(lib.enableFeature javascriptSupport "javascript")
(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")
] # Disable whilst Swift isn't supported
++ lib.optional (!swiftSupport) "--disable-macos-cocoa-cb";
mesonFlags = let
mesonFeatureFlag = feature: flag: "-D${feature}=${if flag then "enabled" else "disabled"}";
in [
"-Ddefault_library=shared"
"-Dlibmpv=true"
(mesonFeatureFlag "libarchive" archiveSupport)
(mesonFeatureFlag "manpage-build" true)
(mesonFeatureFlag "cdda" cddaSupport)
(mesonFeatureFlag "dvbin" dvbinSupport)
(mesonFeatureFlag "dvdnav" dvdnavSupport)
(mesonFeatureFlag "openal" openalSupport)
(mesonFeatureFlag "sdl2" sdl2Support)
# Disable whilst Swift isn't supported
(mesonFeatureFlag "macos-cocoa-cb" swiftSupport)
];

mesonAutoFeatures = "auto";

nativeBuildInputs = [
addOpenGLRunpath
docutils
perl
docutils # for rst2man
meson
ninja
pkg-config
python3
wafHook
which
] ++ lib.optionals swiftSupport [ swift ]
++ lib.optionals waylandSupport [ wayland-scanner ];

Expand All @@ -154,6 +147,7 @@ in stdenv.mkDerivation rec {
++ lib.optionals javascriptSupport [ mujs ]
++ lib.optionals libpngSupport [ libpng ]
++ lib.optionals openalSupport [ openalSoft ]
++ lib.optionals pipewireSupport [ pipewire ]
++ lib.optionals pulseSupport [ libpulseaudio ]
++ lib.optionals rubberbandSupport [ rubberband ]
++ lib.optionals screenSaverSupport [ libXScrnSaver ]
Expand All @@ -174,8 +168,6 @@ in stdenv.mkDerivation rec {
++ lib.optionals stdenv.isDarwin [ libiconv ]
++ lib.optionals stdenv.isDarwin [ CoreFoundation Cocoa CoreAudio MediaPlayer ];

enableParallelBuilding = true;

postBuild = lib.optionalString stdenv.isDarwin ''
python3 TOOLS/osxbundle.py -s build/mpv
'';
Expand All @@ -185,13 +177,10 @@ in stdenv.mkDerivation rec {
mkdir -p $out/share/mpv
ln -s ${freefont_ttf}/share/fonts/truetype/FreeSans.ttf $out/share/mpv/subfont.ttf

cp TOOLS/mpv_identify.sh $out/bin
cp TOOLS/umpv $out/bin
cp ../TOOLS/mpv_identify.sh $out/bin
cp ../TOOLS/umpv $out/bin
cp $out/share/applications/mpv.desktop $out/share/applications/umpv.desktop
sed -i '/Icon=/ ! s/mpv/umpv/g' $out/share/applications/umpv.desktop

substituteInPlace $out/lib/pkgconfig/mpv.pc \
--replace "$out/include" "$dev/include"
'' + lib.optionalString stdenv.isDarwin ''
mkdir -p $out/Applications
cp -r build/mpv.app $out/Applications
Expand Down Expand Up @@ -226,6 +215,6 @@ in stdenv.mkDerivation rec {
'';
license = licenses.gpl2Plus;
maintainers = with maintainers; [ AndersonTorres fpletz globin ma27 tadeokondrak ];
platforms = platforms.darwin ++ platforms.linux;
platforms = platforms.unix;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
platforms = platforms.unix;
platforms = platforms.unix;
broken = stdenv.isDarwin;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's acceptable to break such a widely-used package on Darwin.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If anyone can fix this, go ahead. For now this is our current place.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAICT, it's unnecessary though? WAF is still supported by upstream and meson was only just added in this release. Why do we need to switch right now?

Proper swift support for Darwin seems to be a prerequisite for MPV via meson and that is coming soon. Chances are it's being worked on as we speak.

We can delay the switch to meson until a later date. Remaining on WAF isn't the right way in the long run but we don't need to rush switching to meson either.

};
}