mpv: fix build on darwin

This commit is contained in:
Winter
2024-09-30 17:48:38 -04:00
parent fe370c252d
commit c5b0b6d29c
2 changed files with 26 additions and 0 deletions
@@ -0,0 +1,19 @@
diff --git a/osdep/mac/input_helper.swift b/osdep/mac/input_helper.swift
index 0acec6bd40..0ec5837864 100644
--- a/osdep/mac/input_helper.swift
+++ b/osdep/mac/input_helper.swift
@@ -18,6 +18,14 @@
import Cocoa
import Carbon.HIToolbox
+extension NSCondition {
+ fileprivate func withLock<T>(_ body: () throws -> T) rethrows -> T {
+ self.lock()
+ defer { self.unlock() }
+ return try body()
+ }
+}
+
class InputHelper: NSObject {
var option: OptionHelper?
var lock = NSCondition()
+7
View File
@@ -151,6 +151,11 @@ stdenv'.mkDerivation (finalAttrs: {
hash = "sha256-BOGh+QBTO7hrHohh+RqjSF8eHQH8jVBPjG/k4eyFaaM=";
};
patches = [
# Fix build with Darwin SDK 11
./0001-fix-darwin-build.patch
];
postPatch = lib.concatStringsSep "\n" [
# Don't reference compile time dependencies or create a build outputs cycle
# between out and dev
@@ -308,6 +313,8 @@ stdenv'.mkDerivation (finalAttrs: {
pushd ../TOOLS
cp mpv_identify.sh umpv $out/bin/
popd
''
+ lib.optionalString stdenv.hostPlatform.isLinux ''
pushd $out/share/applications
sed -e '/Icon=/ ! s|mpv|umpv|g; s|^Exec=.*|Exec=umpv %U|' \