Unverified Commit 52af1de7 authored by K900's avatar K900 Committed by GitHub
Browse files

Merge pull request #270421 from NixOS/backport-265987-to-release-23.11

[Backport release-23.11] python3Packages.{shiboken6,pyside6}: 6.5.2 -> 6.6.0
parents f9e16041 e72cda9f
Loading
Loading
Loading
Loading
+1 −12
Original line number Diff line number Diff line
{ lib
, stdenv
, fetchpatch2
, cmake
, ninja
, python
, moveBuildTree
, shiboken6
, libxcrypt
}:

stdenv.mkDerivation rec {
@@ -14,16 +12,7 @@ stdenv.mkDerivation rec {

  inherit (shiboken6) version src;

  sourceRoot = "pyside-setup-everywhere-src-${version}/sources/${pname}";

  patches = [
    # Needed to build against qt 6.5.3, until pyside 6.5.3 is released
    (fetchpatch2 {
      url = "https://code.qt.io/cgit/pyside/pyside-setup.git/patch/sources/pyside6?id=63ef7628091c8827e3d0d688220d3ae165587eb2";
      hash = "sha256-TN1xdBkrzZhNontShMC1SKyJK6a8fOk/Di3zX3kv5+I=";
      stripLen = 2;
    })
  ];
  sourceRoot = "pyside-setup-everywhere-src-${lib.removeSuffix ".0" version}/sources/${pname}";

  # 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.
+20 −7
Original line number Diff line number Diff line
{ lib
, fetchurl
, fetchpatch
, llvmPackages
, python
, cmake
, autoPatchelfHook
, stdenv
, libxcrypt
}:

let
@@ -13,23 +13,30 @@ let
in
stdenv'.mkDerivation rec {
  pname = "shiboken6";
  version = "6.5.2";
  version = "6.6.0";

  src = fetchurl {
    # https://download.qt.io/official_releases/QtForPython/shiboken6/
    url = "https://download.qt.io/official_releases/QtForPython/shiboken6/PySide6-${version}-src/pyside-setup-everywhere-src-${version}.tar.xz";
    sha256 = "sha256-kNvx0U/NQcmKfL6kS4pJUeENC3mOFUdJdW5JRmVNG6g";
    sha256 = "sha256-LdAC24hRqHFzNU84qoxuxC0P8frJnqQisp4t/OUtFjg=";
  };

  sourceRoot = "pyside-setup-everywhere-src-${version}/sources/${pname}";
  sourceRoot = "pyside-setup-everywhere-src-${lib.removeSuffix ".0" version}/sources/${pname}";

  patches = [
    ./fix-include-qt-headers.patch
    # TODO: remove after bumping above 6.6.0
    (fetchpatch {
      name = "shiboken6-improve-api-extractor-argument-parsing.patch";
      url = "https://code.qt.io/cgit/pyside/pyside-setup.git/patch/?id=6abde77c3df60ccac25089660df5797de7f6e68c";
      hash = "sha256-uctp5rjY16X37BYzsZzg9AAgM2hwNVkcNxT1bCobb0I=";
      stripLen = 2;
    })
  ];

  nativeBuildInputs = [
    cmake
    python
    (python.pythonOnBuildForHost.withPackages (ps: [ ps.setuptools ]))
  ] ++ lib.optionals stdenv.isLinux [
    autoPatchelfHook
  ];
@@ -47,14 +54,20 @@ stdenv'.mkDerivation rec {
    "-DBUILD_TESTS=OFF"
  ];

  # Due to Shiboken.abi3.so being linked to libshiboken6.abi3.so.6.5 in the build tree,
  # We intentionally use single quotes around `${BASH}` since it expands from a CMake
  # variable available in this file.
  postPatch = ''
    substituteInPlace cmake/ShibokenHelpers.cmake --replace '#!/bin/bash' '#!''${BASH}'
  '';

  # Due to Shiboken.abi3.so being linked to libshiboken6.abi3.so.6.6 in the build tree,
  # we need to remove the build tree reference from the RPATH and then add the correct
  # directory to the RPATH. On Linux, the second part is handled by autoPatchelfHook.
  # https://bugreports.qt.io/browse/PYSIDE-2233
  preFixup = ''
    echo "fixing RPATH of Shiboken.abi3.so"
  '' + lib.optionalString stdenv.isDarwin ''
    install_name_tool -change {@rpath,$out/lib}/libshiboken6.abi3.6.5.dylib $out/${python.sitePackages}/shiboken6/Shiboken.abi3.so
    install_name_tool -change {@rpath,$out/lib}/libshiboken6.abi3.6.6.dylib $out/${python.sitePackages}/shiboken6/Shiboken.abi3.so
  '' + lib.optionalString stdenv.isLinux ''
    patchelf $out/${python.sitePackages}/shiboken6/Shiboken.abi3.so --shrink-rpath --allowed-rpath-prefixes ${builtins.storeDir}
  '';