1{ lib, stdenv, fetchurl, buildPythonPackage, python, dbus-python, sip_4, qt4, pkg-config, lndir, dbus, makeWrapper }:
2
3buildPythonPackage rec {
4 pname = "PyQt-x11-gpl";
5 version = "4.12.3";
6 format = "other";
7
8 src = fetchurl {
9 url = "mirror://sourceforge/pyqt/PyQt4_gpl_x11-${version}.tar.gz";
10 sha256 = "0wnlasg62rm5d39nq1yw4namcx2ivxgzl93r5f2vb9s0yaz5l3x0";
11 };
12
13 postPatch = ''
14 mkdir -p $out
15 lndir ${dbus-python} $out
16 rm -rf "$out/nix-support"
17
18 export PYTHONPATH=$PYTHONPATH:$out/lib/${python.libPrefix}/site-packages
19 ${lib.optionalString stdenv.isDarwin ''
20 export QMAKESPEC="unsupported/macx-clang-libc++" # macOS target after bootstrapping phase \
21 ''}
22
23 substituteInPlace configure.py \
24 --replace 'install_dir=pydbusmoddir' "install_dir='$out/lib/${python.libPrefix}/site-packages/dbus/mainloop'" \
25 ${lib.optionalString stdenv.isDarwin ''
26 --replace "qt_macx_spec = 'macx-g++'" "qt_macx_spec = 'unsupported/macx-clang-libc++'" # for bootstrapping phase \
27 ''}
28
29 chmod +x configure.py
30 sed -i '1i#!${python.interpreter}' configure.py
31 '';
32
33 configureScript = "./configure.py";
34 dontAddPrefix = true;
35 configureFlags = [
36 "--confirm-license"
37 "--bindir=${placeholder "out"}/bin"
38 "--destdir=${placeholder "out"}/${python.sitePackages}"
39 "--plugin-destdir=${placeholder "out"}/lib/qt4/plugins"
40 "--sipdir=${placeholder "out"}/share/sip/PyQt4"
41 "--dbus=${lib.getDev dbus-python}/include/dbus-1.0"
42 "--verbose"
43 ];
44
45 nativeBuildInputs = [ pkg-config lndir makeWrapper qt4 ];
46 buildInputs = [ qt4 dbus ];
47
48 propagatedBuildInputs = [ sip_4 ];
49
50 postInstall = ''
51 for i in $out/bin/*; do
52 wrapProgram $i --prefix PYTHONPATH : "$PYTHONPATH"
53 done
54 '';
55
56 enableParallelBuilding = true;
57
58 passthru = {
59 qt = qt4;
60 };
61
62 meta = with lib; {
63 description = "Python bindings for Qt";
64 license = "GPL";
65 homepage = "http://www.riverbankcomputing.co.uk";
66 maintainers = [ maintainers.sander ];
67 platforms = platforms.mesaPlatforms;
68 };
69}