1{ lib
2, fetchurl
3, llvmPackages
4, python
5, cmake
6, autoPatchelfHook
7, stdenv
8, libxcrypt
9}:
10
11let
12 stdenv' = if stdenv.cc.isClang then stdenv else llvmPackages.stdenv;
13in
14stdenv'.mkDerivation rec {
15 pname = "shiboken6";
16 version = "6.5.2";
17
18 src = fetchurl {
19 # https://download.qt.io/official_releases/QtForPython/shiboken6/
20 url = "https://download.qt.io/official_releases/QtForPython/shiboken6/PySide6-${version}-src/pyside-setup-everywhere-src-${version}.tar.xz";
21 sha256 = "sha256-kNvx0U/NQcmKfL6kS4pJUeENC3mOFUdJdW5JRmVNG6g";
22 };
23
24 sourceRoot = "pyside-setup-everywhere-src-${version}/sources/${pname}";
25
26 patches = [
27 ./fix-include-qt-headers.patch
28 ];
29
30 nativeBuildInputs = [
31 cmake
32 python
33 ] ++ lib.optionals stdenv.isLinux [
34 autoPatchelfHook
35 ];
36
37 buildInputs = [
38 llvmPackages.llvm
39 llvmPackages.libclang
40 python.pkgs.qt6.qtbase
41 python.pkgs.ninja
42 python.pkgs.packaging
43 python.pkgs.setuptools
44 ];
45
46 cmakeFlags = [
47 "-DBUILD_TESTS=OFF"
48 ];
49
50 # Due to Shiboken.abi3.so being linked to libshiboken6.abi3.so.6.5 in the build tree,
51 # we need to remove the build tree reference from the RPATH and then add the correct
52 # directory to the RPATH. On Linux, the second part is handled by autoPatchelfHook.
53 # https://bugreports.qt.io/browse/PYSIDE-2233
54 preFixup = ''
55 echo "fixing RPATH of Shiboken.abi3.so"
56 '' + lib.optionalString stdenv.isDarwin ''
57 install_name_tool -change {@rpath,$out/lib}/libshiboken6.abi3.6.5.dylib $out/${python.sitePackages}/shiboken6/Shiboken.abi3.so
58 '' + lib.optionalString stdenv.isLinux ''
59 patchelf $out/${python.sitePackages}/shiboken6/Shiboken.abi3.so --shrink-rpath --allowed-rpath-prefixes ${builtins.storeDir}
60 '';
61
62 postInstall = ''
63 cd ../../..
64 ${python.pythonOnBuildForHost.interpreter} setup.py egg_info --build-type=shiboken6
65 cp -r shiboken6.egg-info $out/${python.sitePackages}/
66 '';
67
68 dontWrapQtApps = true;
69
70 meta = with lib; {
71 description = "Generator for the pyside6 Qt bindings";
72 license = with licenses; [ lgpl3Only gpl2Only gpl3Only ];
73 homepage = "https://wiki.qt.io/Qt_for_Python";
74 maintainers = with maintainers; [ gebner Enzime ];
75 platforms = platforms.all;
76 };
77}