Unverified Commit 1b26b41b authored by Randy Eckenrode's avatar Randy Eckenrode
Browse files

mpv: enable Swift support on x86_64-darwin

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.
parent 4d002bf1
Loading
Loading
Loading
Loading
+15 −2
Original line number Diff line number Diff line
@@ -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";