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 = [
0 commit comments