Merge pull request #329238 from gador/pyside6-darwin
python312Packages.pyside6: allow optional dependencies for darwin
This commit is contained in:
@@ -2,45 +2,25 @@
|
|||||||
lib,
|
lib,
|
||||||
stdenv,
|
stdenv,
|
||||||
cmake,
|
cmake,
|
||||||
|
cups,
|
||||||
ninja,
|
ninja,
|
||||||
python,
|
python,
|
||||||
|
pythonImportsCheckHook,
|
||||||
moveBuildTree,
|
moveBuildTree,
|
||||||
shiboken6,
|
shiboken6,
|
||||||
|
llvmPackages,
|
||||||
|
symlinkJoin,
|
||||||
|
libGL,
|
||||||
|
darwin,
|
||||||
}:
|
}:
|
||||||
|
let
|
||||||
stdenv.mkDerivation (finalAttrs: {
|
packages = with python.pkgs.qt6; [
|
||||||
pname = "pyside6";
|
|
||||||
|
|
||||||
inherit (shiboken6) version src;
|
|
||||||
|
|
||||||
sourceRoot = "pyside-setup-everywhere-src-${finalAttrs.version}/sources/pyside6";
|
|
||||||
|
|
||||||
# FIXME: cmake/Macros/PySideModules.cmake supposes that all Qt frameworks on macOS
|
|
||||||
# reside in the same directory as QtCore.framework, which is not true for Nix.
|
|
||||||
postPatch = lib.optionalString stdenv.isLinux ''
|
|
||||||
# Don't ignore optional Qt modules
|
|
||||||
substituteInPlace cmake/PySideHelpers.cmake \
|
|
||||||
--replace-fail \
|
|
||||||
'string(FIND "''${_module_dir}" "''${_core_abs_dir}" found_basepath)' \
|
|
||||||
'set (found_basepath 0)'
|
|
||||||
'';
|
|
||||||
|
|
||||||
nativeBuildInputs = [
|
|
||||||
cmake
|
|
||||||
ninja
|
|
||||||
python
|
|
||||||
] ++ lib.optionals stdenv.isDarwin [ moveBuildTree ];
|
|
||||||
|
|
||||||
buildInputs =
|
|
||||||
with python.pkgs.qt6;
|
|
||||||
[
|
|
||||||
# required
|
# required
|
||||||
qtbase
|
|
||||||
python.pkgs.ninja
|
python.pkgs.ninja
|
||||||
python.pkgs.packaging
|
python.pkgs.packaging
|
||||||
python.pkgs.setuptools
|
python.pkgs.setuptools
|
||||||
]
|
qtbase
|
||||||
++ lib.optionals stdenv.isLinux [
|
|
||||||
# optional
|
# optional
|
||||||
qt3d
|
qt3d
|
||||||
qtcharts
|
qtcharts
|
||||||
@@ -56,10 +36,77 @@ stdenv.mkDerivation (finalAttrs: {
|
|||||||
qtsensors
|
qtsensors
|
||||||
qtspeech
|
qtspeech
|
||||||
qtsvg
|
qtsvg
|
||||||
qttools
|
|
||||||
qtwebchannel
|
qtwebchannel
|
||||||
qtwebengine
|
|
||||||
qtwebsockets
|
qtwebsockets
|
||||||
|
qtpositioning
|
||||||
|
qtlocation
|
||||||
|
qtshadertools
|
||||||
|
qtserialport
|
||||||
|
qtserialbus
|
||||||
|
qtgraphs
|
||||||
|
qttools
|
||||||
|
];
|
||||||
|
qt_linked = symlinkJoin {
|
||||||
|
name = "qt_linked";
|
||||||
|
paths = packages;
|
||||||
|
};
|
||||||
|
in
|
||||||
|
|
||||||
|
stdenv.mkDerivation (finalAttrs: {
|
||||||
|
pname = "pyside6";
|
||||||
|
|
||||||
|
inherit (shiboken6) version src;
|
||||||
|
|
||||||
|
sourceRoot = "pyside-setup-everywhere-src-${finalAttrs.version}/sources/pyside6";
|
||||||
|
|
||||||
|
# cmake/Macros/PySideModules.cmake supposes that all Qt frameworks on macOS
|
||||||
|
# reside in the same directory as QtCore.framework, which is not true for Nix.
|
||||||
|
# We therefore symLink all required and optional Qt modules in one directory tree ("qt_linked").
|
||||||
|
# Also we remove "Designer" from darwin build, due to linking failure
|
||||||
|
postPatch =
|
||||||
|
''
|
||||||
|
# Don't ignore optional Qt modules
|
||||||
|
substituteInPlace cmake/PySideHelpers.cmake \
|
||||||
|
--replace-fail \
|
||||||
|
'string(FIND "''${_module_dir}" "''${_core_abs_dir}" found_basepath)' \
|
||||||
|
'set (found_basepath 0)'
|
||||||
|
''
|
||||||
|
+ lib.optionalString stdenv.isDarwin ''
|
||||||
|
substituteInPlace cmake/PySideHelpers.cmake \
|
||||||
|
--replace-fail \
|
||||||
|
"Designer" ""
|
||||||
|
'';
|
||||||
|
|
||||||
|
# "Couldn't find libclang.dylib You will likely need to add it manually to PATH to ensure the build succeeds."
|
||||||
|
env = lib.optionalAttrs stdenv.isDarwin { LLVM_INSTALL_DIR = "${llvmPackages.libclang.lib}/lib"; };
|
||||||
|
|
||||||
|
nativeBuildInputs = [
|
||||||
|
cmake
|
||||||
|
ninja
|
||||||
|
python
|
||||||
|
pythonImportsCheckHook
|
||||||
|
] ++ lib.optionals stdenv.isDarwin [ moveBuildTree ];
|
||||||
|
|
||||||
|
buildInputs =
|
||||||
|
if stdenv.isLinux then
|
||||||
|
# qtwebengine fails under darwin
|
||||||
|
# see https://github.com/NixOS/nixpkgs/pull/312987
|
||||||
|
packages ++ [ python.pkgs.qt6.qtwebengine ]
|
||||||
|
else
|
||||||
|
with darwin.apple_sdk_11_0.frameworks;
|
||||||
|
[
|
||||||
|
qt_linked
|
||||||
|
libGL
|
||||||
|
cups
|
||||||
|
# frameworks
|
||||||
|
IOKit
|
||||||
|
DiskArbitration
|
||||||
|
CoreBluetooth
|
||||||
|
EventKit
|
||||||
|
AVFoundation
|
||||||
|
Contacts
|
||||||
|
AGL
|
||||||
|
AppKit
|
||||||
];
|
];
|
||||||
|
|
||||||
propagatedBuildInputs = [ shiboken6 ];
|
propagatedBuildInputs = [ shiboken6 ];
|
||||||
@@ -74,6 +121,8 @@ stdenv.mkDerivation (finalAttrs: {
|
|||||||
cp -r PySide6.egg-info $out/${python.sitePackages}/
|
cp -r PySide6.egg-info $out/${python.sitePackages}/
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
pythonImportsCheck = [ "PySide6" ];
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
description = "Python bindings for Qt";
|
description = "Python bindings for Qt";
|
||||||
license = with lib.licenses; [
|
license = with lib.licenses; [
|
||||||
|
|||||||
Reference in New Issue
Block a user