From 4d002bf124e87b7e6cee9e064627256f176e40e5 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Sun, 23 Jul 2023 17:24:44 -0400 Subject: [PATCH 1/2] mpv: use the Swift stdenv on Darwin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes an issue where headers from the stdenv’s clang are being used by Swift’s clang. That does not cause issues when the stdenv on Darwin uses clang 11, but the build will fail on aarch64-darwin with a stdenv that uses clang 16 (due to changes in `arm_neon.h` that are not compatible with clang 15). --- pkgs/top-level/all-packages.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 078253a87721..11fea5bad900 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -33515,6 +33515,7 @@ with pkgs; } // (config.mplayer or {})); mpv-unwrapped = darwin.apple_sdk_11_0.callPackage ../applications/video/mpv { + stdenv = if stdenv.isDarwin then swiftPackages.stdenv else stdenv; inherit lua; }; From 1b26b41be720177dc335117ad59ab115db3db010 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Tue, 25 Jul 2023 17:58:02 -0400 Subject: [PATCH 2/2] mpv: enable Swift support on x86_64-darwin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Swift support doesn’t seem to work with back-deployed dylibs, so set the deployment target to 10.15 to force Swift to link against the system Swift libraries. The change to use the Swift stdenv fixes the errors reported in #214944. --- pkgs/applications/video/mpv/default.nix | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/video/mpv/default.nix b/pkgs/applications/video/mpv/default.nix index 70aaa32526e7..b93d7d6606c4 100644 --- a/pkgs/applications/video/mpv/default.nix +++ b/pkgs/applications/video/mpv/default.nix @@ -67,7 +67,7 @@ , sdl2Support ? true, SDL2 , sixelSupport ? false, libsixel , speexSupport ? true, speex -, swiftSupport ? stdenv.isDarwin && stdenv.isAarch64, swift +, swiftSupport ? stdenv.isDarwin, swift , theoraSupport ? true, libtheora , vaapiSupport ? x11Support || waylandSupport, libva , vapoursynthSupport ? false, vapoursynth @@ -82,7 +82,20 @@ let inherit (darwin.apple_sdk_11_0.frameworks) AVFoundation CoreFoundation CoreMedia Cocoa CoreAudio MediaPlayer Accelerate; luaEnv = lua.withPackages (ps: with ps; [ luasocket ]); -in stdenv.mkDerivation (finalAttrs: { + + overrideSDK = platform: version: + platform // lib.optionalAttrs (platform ? darwinMinVersion) { + darwinMinVersion = version; + }; + + stdenv' = if swiftSupport && stdenv.isDarwin && stdenv.isx86_64 + then stdenv.override (old: { + buildPlatform = overrideSDK old.buildPlatform "10.15"; + hostPlatform = overrideSDK old.hostPlatform "10.15"; + targetPlatform = overrideSDK old.targetPlatform "10.15"; + }) + else stdenv; +in stdenv'.mkDerivation (finalAttrs: { pname = "mpv"; version = "0.35.1";