diff --git a/pkgs/applications/video/mpv/darwin-sigtool-no-deep.patch b/pkgs/applications/video/mpv/darwin-sigtool-no-deep.patch new file mode 100644 index 0000000000000..74ab97db4e540 --- /dev/null +++ b/pkgs/applications/video/mpv/darwin-sigtool-no-deep.patch @@ -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'): diff --git a/pkgs/applications/video/mpv/default.nix b/pkgs/applications/video/mpv/default.nix index 3fc3b4eb1a8b8..01a875d667b7a 100644 --- a/pkgs/applications/video/mpv/default.nix +++ b/pkgs/applications/video/mpv/default.nix @@ -1,5 +1,5 @@ -{ config -, lib +{ lib +, config , stdenv , fetchFromGitHub , fetchpatch @@ -20,7 +20,7 @@ , libuchardet , libiconv , xcbuild -, sigtool +, rcodesign , waylandSupport ? stdenv.isLinux , wayland @@ -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: @@ -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', '')" + '' + # 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 = [ @@ -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"; @@ -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 ]; @@ -164,6 +172,7 @@ in stdenv'.mkDerivation (finalAttrs: { ffmpeg freetype libass + libplacebo libpthreadstubs libuchardet luaEnv @@ -192,7 +201,7 @@ 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 ] @@ -200,17 +209,12 @@ in stdenv'.mkDerivation (finalAttrs: { ++ 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 ''; @@ -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 @@ -250,7 +257,7 @@ in stdenv'.mkDerivation (finalAttrs: { ; }; - meta = with lib; { + meta = { homepage = "https://mpv.io"; description = "General-purpose media player, fork of MPlayer and mplayer2"; longDescription = '' @@ -258,9 +265,11 @@ in stdenv'.mkDerivation (finalAttrs: { 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; }; }) diff --git a/pkgs/applications/video/mpv/wrapper.nix b/pkgs/applications/video/mpv/wrapper.nix index a86c9671a4813..b427318121ef0 100644 --- a/pkgs/applications/video/mpv/wrapper.nix +++ b/pkgs/applications/video/mpv/wrapper.nix @@ -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 = { diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 39a0283ea49b0..bf71f07f15a9d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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 { };