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: 0.36.0 -> 0.37.0 #270691

Merged
merged 6 commits into from
Feb 11, 2024
Merged
Show file tree
Hide file tree
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
13 changes: 13 additions & 0 deletions pkgs/applications/video/mpv/darwin-sigtool-no-deep.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/TOOLS/osxbundle.py b/TOOLS/osxbundle.py
index 98699e478b..d02ecf610e 100755
--- a/TOOLS/osxbundle.py
+++ b/TOOLS/osxbundle.py
@@ -39,7 +39,7 @@ def apply_plist_template(plist_file, version):
print(line.rstrip().replace('${VERSION}', version))

def sign_bundle(binary_name):
- sh('codesign --force --deep -s - ' + bundle_path(binary_name))
+ sh('rcodesign sign ' + bundle_path(binary_name))

def bundle_version():
if os.path.exists('VERSION'):
89 changes: 49 additions & 40 deletions pkgs/applications/video/mpv/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{ config
, lib
{ lib
, config
, stdenv
, fetchFromGitHub
, fetchpatch
Expand All @@ -20,7 +20,7 @@
, libuchardet
, libiconv
, xcbuild
, sigtool
, rcodesign

, waylandSupport ? stdenv.isLinux
, wayland
Expand Down Expand Up @@ -82,7 +82,8 @@

let
inherit (darwin.apple_sdk_11_0.frameworks)
AVFoundation CoreFoundation CoreMedia Cocoa CoreAudio MediaPlayer Accelerate;
AVFoundation Accelerate Cocoa CoreAudio CoreFoundation CoreMedia
MediaPlayer VideoToolbox;
luaEnv = lua.withPackages (ps: with ps; [ luasocket ]);

overrideSDK = platform: version:
Expand All @@ -99,36 +100,40 @@ let
else stdenv;
in stdenv'.mkDerivation (finalAttrs: {
pname = "mpv";
version = "0.36.0";
version = "0.37.0";

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

src = fetchFromGitHub {
owner = "mpv-player";
repo = "mpv";
rev = "v${finalAttrs.version}";
hash = "sha256-82moFbWvfc1awXih0d0D+dHqYbIoGNZ77RmafQ80IOY=";
hash = "sha256-izAz9Iiam7tJAWIQkmn2cKOfoaog8oPKq4sOUtp1nvU=";
};

patches = [
# Revert "meson: use the new build_options method" to avoid a
# cycle between the out and dev outputs.
(fetchpatch {
url = "https://github.com/mpv-player/mpv/commit/3c1686488b48bd2760e9b19f42e7d3be1363d00a.patch";
hash = "sha256-eYXfX8Y08q4Bl41VHBpwbxYRMZgm/iziXeK6AOp8O6I=";
revert = true;
})
];

postPatch = ''
patchShebangs version.* ./TOOLS/
'';
patches = [ ./darwin-sigtool-no-deep.patch ];

NIX_LDFLAGS = lib.optionalString x11Support "-lX11 -lXext ";
postPatch = lib.concatStringsSep "\n" [
# Don't reference compile time dependencies or create a build outputs cycle
# between out and dev
''
substituteInPlace meson.build \
--replace-fail "conf_data.set_quoted('CONFIGURATION', configuration)" \
"conf_data.set_quoted('CONFIGURATION', '<ommited>')"
''
# A trick to patchShebang everything except mpv_identify.sh
''
pushd TOOLS
mv mpv_identify.sh mpv_identify
patchShebangs *.py *.sh
mv mpv_identify mpv_identify.sh
popd
''
];

# Ensure we reference 'lib' (not 'out') of Swift.
preConfigure = lib.optionalString swiftSupport ''
# Ensure we reference 'lib' (not 'out') of Swift.
export SWIFT_LIB_DYNAMIC=${lib.getLib swift.swift}/lib/swift/macosx
export SWIFT_LIB_DYNAMIC="${lib.getLib swift.swift}/lib/swift/macosx"
'';

mesonFlags = [
Expand All @@ -144,6 +149,9 @@ in stdenv'.mkDerivation (finalAttrs: {
# Disable whilst Swift isn't supported
(lib.mesonEnable "swift-build" swiftSupport)
(lib.mesonEnable "macos-cocoa-cb" swiftSupport)
] ++ lib.optionals stdenv.isDarwin [
# Toggle explicitly because it fails on darwin
(lib.mesonEnable "videotoolbox-pl" vulkanSupport)
];

mesonAutoFeatures = "auto";
Expand All @@ -155,7 +163,7 @@ in stdenv'.mkDerivation (finalAttrs: {
ninja
pkg-config
]
++ lib.optionals stdenv.isDarwin [ xcbuild.xcrun sigtool ]
++ lib.optionals stdenv.isDarwin [ xcbuild.xcrun rcodesign ]
++ lib.optionals swiftSupport [ swift ]
++ lib.optionals waylandSupport [ wayland-scanner ];

Expand All @@ -164,6 +172,7 @@ in stdenv'.mkDerivation (finalAttrs: {
ffmpeg
freetype
libass
libplacebo
libpthreadstubs
libuchardet
luaEnv
Expand Down Expand Up @@ -192,25 +201,20 @@ in stdenv'.mkDerivation (finalAttrs: {
++ lib.optionals vaapiSupport [ libva ]
++ lib.optionals vapoursynthSupport [ vapoursynth ]
++ lib.optionals vdpauSupport [ libvdpau ]
++ lib.optionals vulkanSupport [ libplacebo shaderc vulkan-headers vulkan-loader ]
++ lib.optionals vulkanSupport [ shaderc vulkan-headers vulkan-loader ]
++ lib.optionals waylandSupport [ wayland wayland-protocols libxkbcommon ]
++ lib.optionals x11Support [ libX11 libXext libGLU libGL libXxf86vm libXrandr libXpresent ]
++ lib.optionals xineramaSupport [ libXinerama ]
++ lib.optionals xvSupport [ libXv ]
++ lib.optionals zimgSupport [ zimg ]
++ lib.optionals stdenv.isLinux [ nv-codec-headers-11 ]
++ lib.optionals stdenv.isDarwin [ libiconv ]
++ lib.optionals stdenv.isDarwin [ CoreFoundation Cocoa CoreAudio MediaPlayer Accelerate ]
++ lib.optionals stdenv.isDarwin [ Accelerate CoreFoundation Cocoa CoreAudio MediaPlayer VideoToolbox ]
++ lib.optionals (stdenv.isDarwin && swiftSupport) [ AVFoundation CoreMedia ];

postBuild = lib.optionalString stdenv.isDarwin ''
pushd .. # Must be run from the source dir because it uses relative paths
python3 TOOLS/osxbundle.py -s build/mpv
# Swap binary and bundle symlink to sign bundle executable as symlinks cannot be signed
rm build/mpv.app/Contents/MacOS/mpv-bundle
mv build/mpv.app/Contents/MacOS/mpv build/mpv.app/Contents/MacOS/mpv-bundle
ln -s mpv-bundle build/mpv.app/Contents/MacOS/mpv
codesign --force --sign - build/mpv.app/Contents/MacOS/mpv-bundle
popd
'';

Expand All @@ -219,11 +223,14 @@ in stdenv'.mkDerivation (finalAttrs: {
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 $out/share/applications/mpv.desktop $out/share/applications/umpv.desktop
sed -i '/Icon=/ ! s/mpv/umpv/g; s/^Exec=.*/Exec=umpv %U/' $out/share/applications/umpv.desktop
printf "NoDisplay=true\n" >> $out/share/applications/umpv.desktop
pushd ../TOOLS
cp mpv_identify.sh umpv $out/bin/
popd
pushd $out/share/applications
sed -e '/Icon=/ ! s|mpv|umpv|g; s|^Exec=.*|Exec=umpv %U|' \
mpv.desktop > umpv.desktop
printf "NoDisplay=true\n" >> umpv.desktop
popd
'' + lib.optionalString stdenv.isDarwin ''
mkdir -p $out/Applications
cp -r mpv.app $out/Applications
Expand All @@ -250,17 +257,19 @@ in stdenv'.mkDerivation (finalAttrs: {
;
};

meta = with lib; {
meta = {
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.
'';
changelog = "https://github.com/mpv-player/mpv/releases/tag/v${finalAttrs.version}";
license = licenses.gpl2Plus;
license = lib.licenses.gpl2Plus;
mainProgram = "mpv";
maintainers = with maintainers; [ AndersonTorres fpletz globin ma27 tadeokondrak ];
platforms = platforms.unix;
maintainers = with lib.maintainers; [
AndersonTorres fpletz globin ma27 tadeokondrak
];
platforms = lib.platforms.unix;
};
})
2 changes: 1 addition & 1 deletion pkgs/applications/video/mpv/wrapper.nix
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ let
'' + lib.optionalString stdenv.isDarwin ''
# wrapProgram can't operate on symlinks
rm "$out/Applications/mpv.app/Contents/MacOS/mpv"
makeWrapper "${mpv}/Applications/mpv.app/Contents/MacOS/mpv-bundle" "$out/Applications/mpv.app/Contents/MacOS/mpv" ${mostMakeWrapperArgs}
makeWrapper "${mpv}/Applications/mpv.app/Contents/MacOS/mpv" "$out/Applications/mpv.app/Contents/MacOS/mpv" ${mostMakeWrapperArgs}
'';

meta = {
Expand Down
1 change: 0 additions & 1 deletion pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -33765,7 +33765,6 @@ with pkgs;
mpv-unwrapped = darwin.apple_sdk_11_0.callPackage ../applications/video/mpv {
stdenv = if stdenv.isDarwin then swiftPackages.stdenv else stdenv;
inherit lua;
inherit (darwin) sigtool;
};

shaka-packager = callPackage ../applications/video/shaka-packager { };
Expand Down
Loading