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