From f0a6216eebb3a6693b111e2927e10f520f6c479a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phan=20Kochen?= Date: Thu, 8 Sep 2022 14:40:45 +0200 Subject: [PATCH 1/3] mpv: enable swift support --- pkgs/applications/video/mpv/default.nix | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/video/mpv/default.nix b/pkgs/applications/video/mpv/default.nix index 28e0d1d469a0..59f7729b38a9 100644 --- a/pkgs/applications/video/mpv/default.nix +++ b/pkgs/applications/video/mpv/default.nix @@ -66,7 +66,7 @@ , sdl2Support ? true, SDL2 , sixelSupport ? false, libsixel , speexSupport ? true, speex -, swiftSupport ? false, swift +, swiftSupport ? stdenv.isDarwin, swift , theoraSupport ? true, libtheora , vaapiSupport ? stdenv.isLinux, libva , vapoursynthSupport ? false, vapoursynth @@ -78,7 +78,7 @@ }: let - inherit (darwin.apple_sdk.frameworks) CoreFoundation Cocoa CoreAudio MediaPlayer; + inherit (darwin.apple_sdk.frameworks) AVFoundation CoreFoundation CoreMedia Cocoa CoreAudio MediaPlayer; luaEnv = lua.withPackages (ps: with ps; [ luasocket ]); in stdenv.mkDerivation (self: { pname = "mpv"; @@ -99,6 +99,11 @@ in stdenv.mkDerivation (self: { NIX_LDFLAGS = lib.optionalString x11Support "-lX11 -lXext "; + preConfigure = lib.optionalString swiftSupport '' + # Ensure we reference 'lib' (not 'out') of Swift. + export SWIFT_LIB_DYNAMIC=${lib.getLib swift.swift}/lib/swift/macosx + ''; + mesonFlags = [ (lib.mesonOption "default_library" "shared") (lib.mesonBool "libmpv" true) @@ -167,7 +172,8 @@ in stdenv.mkDerivation (self: { ++ lib.optionals zimgSupport [ zimg ] ++ lib.optionals stdenv.isLinux [ nv-codec-headers ] ++ lib.optionals stdenv.isDarwin [ libiconv ] - ++ lib.optionals stdenv.isDarwin [ CoreFoundation Cocoa CoreAudio MediaPlayer ]; + ++ lib.optionals stdenv.isDarwin [ CoreFoundation Cocoa CoreAudio MediaPlayer ] + ++ 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 From 5b8e896dbadd36fecc96dc77216517599c260ca7 Mon Sep 17 00:00:00 2001 From: Zhong Jianxin Date: Tue, 7 Feb 2023 00:21:48 +0800 Subject: [PATCH 2/3] mpv: Switch to apple_sdk_11_0 for darwin --- pkgs/applications/video/mpv/default.nix | 2 +- pkgs/top-level/all-packages.nix | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/video/mpv/default.nix b/pkgs/applications/video/mpv/default.nix index 59f7729b38a9..61680daf051e 100644 --- a/pkgs/applications/video/mpv/default.nix +++ b/pkgs/applications/video/mpv/default.nix @@ -78,7 +78,7 @@ }: let - inherit (darwin.apple_sdk.frameworks) AVFoundation CoreFoundation CoreMedia Cocoa CoreAudio MediaPlayer; + inherit (darwin.apple_sdk_11_0.frameworks) AVFoundation CoreFoundation CoreMedia Cocoa CoreAudio MediaPlayer; luaEnv = lua.withPackages (ps: with ps; [ luasocket ]); in stdenv.mkDerivation (self: { pname = "mpv"; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index d3fd46c92d9d..64097e8fd150 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -31402,7 +31402,7 @@ with pkgs; libdvdnav = libdvdnav_4_2_1; } // (config.mplayer or {})); - mpv-unwrapped = callPackage ../applications/video/mpv { + mpv-unwrapped = darwin.apple_sdk_11_0.callPackage ../applications/video/mpv { inherit lua; }; From 8a28ae851dee5306de51352300fceb692bd9c389 Mon Sep 17 00:00:00 2001 From: Zhong Jianxin Date: Tue, 28 Feb 2023 11:14:00 +0800 Subject: [PATCH 3/3] mpv: Only enable swift support on aarch64-darwin This commit should be reverted after [x86_64-darwin build failure][1] is fixed [1]: https://logs.nix.ci/?key=nixos/nixpkgs.214944&attempt_id=76802592-760c-47e1-9141-4465b7c78f4c --- pkgs/applications/video/mpv/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/applications/video/mpv/default.nix b/pkgs/applications/video/mpv/default.nix index 61680daf051e..0fa8486e15b0 100644 --- a/pkgs/applications/video/mpv/default.nix +++ b/pkgs/applications/video/mpv/default.nix @@ -66,7 +66,7 @@ , sdl2Support ? true, SDL2 , sixelSupport ? false, libsixel , speexSupport ? true, speex -, swiftSupport ? stdenv.isDarwin, swift +, swiftSupport ? stdenv.isDarwin && stdenv.isAarch64, swift , theoraSupport ? true, libtheora , vaapiSupport ? stdenv.isLinux, libva , vapoursynthSupport ? false, vapoursynth