Skip to content

Commit 4ce183c

Browse files
committed
mpv: enable swift support
1 parent 60377b2 commit 4ce183c

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

pkgs/applications/video/mpv/default.nix

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
, sdl2Support ? true, SDL2
6666
, sixelSupport ? false, libsixel
6767
, speexSupport ? true, speex
68-
, swiftSupport ? false, swift
68+
, swiftSupport ? stdenv.isDarwin, swift, xcbuild
6969
, theoraSupport ? true, libtheora
7070
, vaapiSupport ? stdenv.isLinux, libva
7171
, vapoursynthSupport ? false, vapoursynth
@@ -100,6 +100,11 @@ in stdenv.mkDerivation rec {
100100
NIX_LDFLAGS = lib.optionalString x11Support "-lX11 -lXext "
101101
+ lib.optionalString stdenv.isDarwin "-framework CoreFoundation";
102102

103+
preConfigure = lib.optionalString swiftSupport ''
104+
# Ensure we reference 'lib' (not 'out') of Swift.
105+
export SWIFT_LIB_DYNAMIC=${swift.swift.lib}/lib/swift/macosx
106+
'';
107+
103108
# These flags are not supported and cause the build
104109
# to fail, even when cross compilation itself works.
105110
dontAddWafCrossFlags = true;
@@ -120,8 +125,7 @@ in stdenv.mkDerivation rec {
120125
(lib.enableFeature vaapiSupport "vaapi")
121126
(lib.enableFeature waylandSupport "wayland")
122127
(lib.enableFeature stdenv.isLinux "dvbin")
123-
] # Disable whilst Swift isn't supported
124-
++ lib.optional (!swiftSupport) "--disable-macos-cocoa-cb";
128+
] ++ lib.optional (!swiftSupport) "--disable-macos-cocoa-cb";
125129

126130
nativeBuildInputs = [
127131
addOpenGLRunpath
@@ -131,7 +135,7 @@ in stdenv.mkDerivation rec {
131135
python3
132136
wafHook
133137
which
134-
] ++ lib.optionals swiftSupport [ swift ]
138+
] ++ lib.optionals swiftSupport [ swift xcbuild.xcrun ]
135139
++ lib.optionals waylandSupport [ wayland-scanner ];
136140

137141
buildInputs = [

pkgs/os-specific/darwin/apple-sdk-11.0/frameworks.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{ frameworks, libs, libobjc, libnetwork }: with frameworks; with libs;
22
{
33
AGL = { inherit Carbon OpenGL; };
4-
AVFoundation = { inherit ApplicationServices AVFCapture AVFCore CoreGraphics simd UniformTypeIdentifiers; };
4+
AVFoundation = { inherit ApplicationServices AVFCapture AVFCore CoreGraphics CoreMedia simd UniformTypeIdentifiers; };
55
AVKit = {};
66
Accelerate = { inherit CoreWLAN IOBluetooth; };
77
Accessibility = {};
@@ -112,7 +112,7 @@
112112
MapKit = {};
113113
MediaAccessibility = { inherit CoreGraphics CoreText QuartzCore; };
114114
MediaLibrary = {};
115-
MediaPlayer = {};
115+
MediaPlayer = { inherit AVFoundation; };
116116
MediaToolbox = { inherit AudioToolbox AudioUnit CoreMedia; };
117117
Message = {};
118118
Metal = {};

0 commit comments

Comments
 (0)