jellyfin-mpv-shim: fix build on darwin (#439766)

This commit is contained in:
Aleksana
2025-11-17 09:10:03 +00:00
committed by GitHub
6 changed files with 230 additions and 13 deletions

View File

@@ -0,0 +1,65 @@
{
buildPythonPackage,
fetchFromGitHub,
setuptools,
darwin,
pyobjc-core,
pyobjc-framework-Cocoa,
lib,
}:
buildPythonPackage rec {
pname = "pyobjc-framework-Quartz";
version = "11.1";
pyproject = true;
src = fetchFromGitHub {
owner = "ronaldoussoren";
repo = "pyobjc";
tag = "v${version}";
hash = "sha256-2qPGJ/1hXf3k8AqVLr02fVIM9ziVG9NMrm3hN1de1Us=";
};
sourceRoot = "${src.name}/pyobjc-framework-Quartz";
build-system = [ setuptools ];
buildInputs = [ darwin.libffi ];
nativeBuildInputs = [
darwin.DarwinTools # sw_vers
];
# See https://github.com/ronaldoussoren/pyobjc/pull/641. Unfortunately, we
# cannot just pull that diff with fetchpatch due to https://discourse.nixos.org/t/how-to-apply-patches-with-sourceroot/59727.
postPatch = ''
substituteInPlace pyobjc_setup.py \
--replace-fail "-buildversion" "-buildVersion" \
--replace-fail "-productversion" "-productVersion" \
--replace-fail "/usr/bin/sw_vers" "sw_vers" \
--replace-fail "/usr/bin/xcrun" "xcrun"
'';
dependencies = [
pyobjc-core
pyobjc-framework-Cocoa
];
env.NIX_CFLAGS_COMPILE = toString [
"-I${darwin.libffi.dev}/include"
"-Wno-error=unused-command-line-argument"
];
pythonImportsCheck = [
"Quartz"
"PyObjCTools"
];
meta = {
description = "PyObjC wrappers for the Quartz frameworks on macOS";
homepage = "https://github.com/ronaldoussoren/pyobjc";
license = lib.licenses.mit;
platforms = lib.platforms.darwin;
maintainers = with lib.maintainers; [ xyenon ];
};
}

View File

@@ -0,0 +1,65 @@
{
buildPythonPackage,
fetchFromGitHub,
setuptools,
darwin,
pyobjc-core,
pyobjc-framework-Cocoa,
lib,
}:
buildPythonPackage rec {
pname = "pyobjc-framework-Security";
version = "11.1";
pyproject = true;
src = fetchFromGitHub {
owner = "ronaldoussoren";
repo = "pyobjc";
tag = "v${version}";
hash = "sha256-2qPGJ/1hXf3k8AqVLr02fVIM9ziVG9NMrm3hN1de1Us=";
};
sourceRoot = "${src.name}/pyobjc-framework-Security";
build-system = [ setuptools ];
buildInputs = [ darwin.libffi ];
nativeBuildInputs = [
darwin.DarwinTools # sw_vers
];
# See https://github.com/ronaldoussoren/pyobjc/pull/641. Unfortunately, we
# cannot just pull that diff with fetchpatch due to https://discourse.nixos.org/t/how-to-apply-patches-with-sourceroot/59727.
postPatch = ''
substituteInPlace pyobjc_setup.py \
--replace-fail "-buildversion" "-buildVersion" \
--replace-fail "-productversion" "-productVersion" \
--replace-fail "/usr/bin/sw_vers" "sw_vers" \
--replace-fail "/usr/bin/xcrun" "xcrun"
'';
dependencies = [
pyobjc-core
pyobjc-framework-Cocoa
];
env.NIX_CFLAGS_COMPILE = toString [
"-I${darwin.libffi.dev}/include"
"-Wno-error=unused-command-line-argument"
];
pythonImportsCheck = [
"Security"
"PyObjCTools"
];
meta = {
description = "PyObjC wrappers for the Security frameworks on macOS";
homepage = "https://github.com/ronaldoussoren/pyobjc";
license = lib.licenses.mit;
platforms = lib.platforms.darwin;
maintainers = with lib.maintainers; [ xyenon ];
};
}

View File

@@ -0,0 +1,66 @@
{
buildPythonPackage,
fetchFromGitHub,
setuptools,
darwin,
pyobjc-core,
pyobjc-framework-Cocoa,
lib,
}:
buildPythonPackage rec {
pname = "pyobjc-framework-WebKit";
version = "11.1";
pyproject = true;
src = fetchFromGitHub {
owner = "ronaldoussoren";
repo = "pyobjc";
tag = "v${version}";
hash = "sha256-2qPGJ/1hXf3k8AqVLr02fVIM9ziVG9NMrm3hN1de1Us=";
};
sourceRoot = "${src.name}/pyobjc-framework-WebKit";
build-system = [ setuptools ];
buildInputs = [ darwin.libffi ];
nativeBuildInputs = [
darwin.DarwinTools # sw_vers
];
# See https://github.com/ronaldoussoren/pyobjc/pull/641. Unfortunately, we
# cannot just pull that diff with fetchpatch due to https://discourse.nixos.org/t/how-to-apply-patches-with-sourceroot/59727.
postPatch = ''
substituteInPlace pyobjc_setup.py \
--replace-fail "-buildversion" "-buildVersion" \
--replace-fail "-productversion" "-productVersion" \
--replace-fail "/usr/bin/sw_vers" "sw_vers" \
--replace-fail "/usr/bin/xcrun" "xcrun"
'';
dependencies = [
pyobjc-core
pyobjc-framework-Cocoa
];
env.NIX_CFLAGS_COMPILE = toString [
"-I${darwin.libffi.dev}/include"
"-Wno-error=unused-command-line-argument"
];
pythonImportsCheck = [
"WebKit"
"JavaScriptCore"
"PyObjCTools"
];
meta = {
description = "PyObjC wrappers for the WebKit frameworks on macOS";
homepage = "https://github.com/ronaldoussoren/pyobjc";
license = lib.licenses.mit;
platforms = lib.platforms.darwin;
maintainers = with lib.maintainers; [ xyenon ];
};
}

View File

@@ -3,15 +3,17 @@
buildPythonPackage, buildPythonPackage,
fetchFromGitHub, fetchFromGitHub,
fetchpatch, fetchpatch,
pillow,
xlib,
six,
xvfb-run,
setuptools,
gobject-introspection, gobject-introspection,
setuptools,
pillow,
six,
pygobject3, pygobject3,
gtk3, gtk3,
stdenv,
xlib,
libayatana-appindicator, libayatana-appindicator,
pyobjc-framework-Quartz,
xvfb-run,
pytest, pytest,
}: }:
@@ -48,22 +50,22 @@ buildPythonPackage rec {
propagatedBuildInputs = [ propagatedBuildInputs = [
pillow pillow
xlib
six six
pygobject3 pygobject3
gtk3 gtk3
]
++ lib.optionals stdenv.hostPlatform.isLinux [
xlib
libayatana-appindicator libayatana-appindicator
]; ]
++ lib.optionals stdenv.isDarwin [ pyobjc-framework-Quartz ];
nativeCheckInputs = [ nativeCheckInputs = [ pytest ] ++ lib.optionals stdenv.hostPlatform.isLinux [ xvfb-run ];
pytest
xvfb-run
];
checkPhase = '' checkPhase = ''
runHook preCheck runHook preCheck
xvfb-run -s '-screen 0 800x600x24' pytest tests/menu_descriptor_tests.py ${lib.optionalString stdenv.hostPlatform.isLinux "xvfb-run -s '-screen 0 800x600x24' "}pytest tests/menu_descriptor_tests.py
runHook postCheck runHook postCheck
''; '';
@@ -75,7 +77,7 @@ buildPythonPackage rec {
gpl3Plus gpl3Plus
lgpl3Plus lgpl3Plus
]; ];
platforms = platforms.linux; platforms = platforms.all;
maintainers = with maintainers; [ jojosch ]; maintainers = with maintainers; [ jojosch ];
}; };
} }

View File

@@ -9,6 +9,12 @@
qtpy, qtpy,
six, six,
typing-extensions, typing-extensions,
stdenv,
pyobjc-core,
pyobjc-framework-Cocoa,
pyobjc-framework-Quartz,
pyobjc-framework-Security,
pyobjc-framework-WebKit,
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@@ -32,6 +38,13 @@ buildPythonPackage rec {
qtpy qtpy
six six
typing-extensions typing-extensions
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
pyobjc-core
pyobjc-framework-Cocoa
pyobjc-framework-Quartz
pyobjc-framework-Security
pyobjc-framework-WebKit
]; ];
pythonImportsCheck = [ "webview" ]; pythonImportsCheck = [ "webview" ];

View File

@@ -13838,6 +13838,12 @@ self: super: with self; {
pyobjc-framework-Cocoa = callPackage ../development/python-modules/pyobjc-framework-Cocoa { }; pyobjc-framework-Cocoa = callPackage ../development/python-modules/pyobjc-framework-Cocoa { };
pyobjc-framework-Quartz = callPackage ../development/python-modules/pyobjc-framework-Quartz { };
pyobjc-framework-Security = callPackage ../development/python-modules/pyobjc-framework-Security { };
pyobjc-framework-WebKit = callPackage ../development/python-modules/pyobjc-framework-WebKit { };
pyocd = callPackage ../development/python-modules/pyocd { }; pyocd = callPackage ../development/python-modules/pyocd { };
pyocd-pemicro = callPackage ../development/python-modules/pyocd-pemicro { }; pyocd-pemicro = callPackage ../development/python-modules/pyocd-pemicro { };