1{ lib, stdenv, fetchFromGitHub, fetchpatch, python, qmake,
2 qtwebengine, qtxmlpatterns,
3 qttools, unzip }:
4
5stdenv.mkDerivation rec {
6 pname = "python-qt";
7 version = "3.3.0";
8
9 src = fetchFromGitHub {
10 owner = "MeVisLab";
11 repo = "pythonqt";
12 rev = "v${version}";
13 hash = "sha256-zbQ6X4Q2/QChaw3GAz/aVBj2JjWEz52YuPuHbBz935k=";
14 };
15
16 patches = [
17 (fetchpatch {
18 name = "remove-unneeded-pydebug-include.patch";
19 url = "https://github.com/MeVisLab/pythonqt/commit/a93104dea4d9c79351276ec963e931ca617625ec.patch";
20 includes = [ "src/PythonQt.cpp" ];
21 hash = "sha256-Tc4+6dIdvrda/z3Nz1s9Xz+ZWJLV2BQh8i552UynSI0=";
22 })
23 ];
24
25 # https://github.com/CsoundQt/CsoundQt/blob/develop/BUILDING.md#pythonqt
26 postPatch = ''
27 substituteInPlace build/python.prf \
28 --replace "unix:PYTHON_VERSION=2.7" "unix:PYTHON_VERSION=${python.pythonVersion}"
29 '';
30
31 hardeningDisable = [ "all" ];
32
33 nativeBuildInputs = [ qmake qtwebengine qtxmlpatterns qttools unzip ];
34
35 buildInputs = [ python ];
36
37 qmakeFlags = [
38 "PythonQt.pro"
39 "PYTHON_DIR=${python}"
40 ];
41
42 dontWrapQtApps = true;
43
44 unpackCmd = "unzip $src";
45
46 installPhase = ''
47 mkdir -p $out/include/PythonQt
48 cp -r ./lib $out
49 cp -r ./src/* $out/include/PythonQt
50 cp -r ./build $out/include/PythonQt
51 cp -r ./extensions $out/include/PythonQt
52 '';
53
54 meta = with lib; {
55 description = "PythonQt is a dynamic Python binding for the Qt framework. It offers an easy way to embed the Python scripting language into your C++ Qt applications";
56 homepage = "https://pythonqt.sourceforge.net/";
57 license = licenses.lgpl21;
58 platforms = platforms.all;
59 maintainers = with maintainers; [ hlolli ];
60 };
61}