3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #214944 from azuwis/mpv

mpv: enable swift support
This commit is contained in:
Atemu 2023-03-06 17:45:31 +01:00 committed by GitHub
commit 1cd0291434
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View file

@ -66,7 +66,7 @@
, sdl2Support ? true, SDL2 , sdl2Support ? true, SDL2
, sixelSupport ? false, libsixel , sixelSupport ? false, libsixel
, speexSupport ? true, speex , speexSupport ? true, speex
, swiftSupport ? false, swift , swiftSupport ? stdenv.isDarwin && stdenv.isAarch64, swift
, theoraSupport ? true, libtheora , theoraSupport ? true, libtheora
, vaapiSupport ? stdenv.isLinux, libva , vaapiSupport ? stdenv.isLinux, libva
, vapoursynthSupport ? false, vapoursynth , vapoursynthSupport ? false, vapoursynth
@ -78,7 +78,7 @@
}: }:
let let
inherit (darwin.apple_sdk.frameworks) CoreFoundation Cocoa CoreAudio MediaPlayer; inherit (darwin.apple_sdk_11_0.frameworks) AVFoundation CoreFoundation CoreMedia Cocoa CoreAudio MediaPlayer;
luaEnv = lua.withPackages (ps: with ps; [ luasocket ]); luaEnv = lua.withPackages (ps: with ps; [ luasocket ]);
in stdenv.mkDerivation (self: { in stdenv.mkDerivation (self: {
pname = "mpv"; pname = "mpv";
@ -99,6 +99,11 @@ in stdenv.mkDerivation (self: {
NIX_LDFLAGS = lib.optionalString x11Support "-lX11 -lXext "; 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 = [ mesonFlags = [
(lib.mesonOption "default_library" "shared") (lib.mesonOption "default_library" "shared")
(lib.mesonBool "libmpv" true) (lib.mesonBool "libmpv" true)
@ -167,7 +172,8 @@ in stdenv.mkDerivation (self: {
++ lib.optionals zimgSupport [ zimg ] ++ lib.optionals zimgSupport [ zimg ]
++ lib.optionals stdenv.isLinux [ nv-codec-headers ] ++ lib.optionals stdenv.isLinux [ nv-codec-headers ]
++ lib.optionals stdenv.isDarwin [ libiconv ] ++ 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 '' postBuild = lib.optionalString stdenv.isDarwin ''
pushd .. # Must be run from the source dir because it uses relative paths pushd .. # Must be run from the source dir because it uses relative paths

View file

@ -31767,7 +31767,7 @@ with pkgs;
libdvdnav = libdvdnav_4_2_1; libdvdnav = libdvdnav_4_2_1;
} // (config.mplayer or {})); } // (config.mplayer or {}));
mpv-unwrapped = callPackage ../applications/video/mpv { mpv-unwrapped = darwin.apple_sdk_11_0.callPackage ../applications/video/mpv {
inherit lua; inherit lua;
}; };