about summary refs log tree commit diff
path: root/pkgs/development/python-modules/wxPython/4.1.nix
blob: f3a5ca9061b848f9a8c38b5e710ad6114227238e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
{ lib
, stdenv
, fetchPypi
, fetchpatch
, buildPythonPackage
, setuptools
, which
, pkg-config
, python
, isPy27
, doxygen
, cairo
, ncurses
, pango
, wxGTK
, gtk3
, AGL
, AudioToolbox
, AVFoundation
, AVKit
, Carbon
, Cocoa
, CoreFoundation
, CoreMedia
, IOKit
, Kernel
, OpenGL
, Security
, WebKit
, pillow
, numpy
, six
, libXinerama
, libSM
, libXxf86vm
, libXtst
, libGLU
, libGL
, xorgproto
, gst_all_1
, libglvnd
, mesa
, webkitgtk
, autoPatchelfHook
}:
let
  dynamic-linker = stdenv.cc.bintools.dynamicLinker;
in
buildPythonPackage rec {
  pname = "wxPython";
  version = "4.1.1";
  disabled = isPy27;
  format = "other";

  src = fetchPypi {
    inherit pname version;
    sha256 = "0a1mdhdkda64lnwm1dg0dlrf9rs4gkal3lra6hpqbwn718cf7r80";
  };

  # ld: framework not found System
  postPatch = ''
    for file in ext/wxWidgets/configure*; do
      substituteInPlace $file --replace "-framework System" ""
    done
  '';

  # https://github.com/NixOS/nixpkgs/issues/75759
  # https://github.com/wxWidgets/Phoenix/issues/1316
  doCheck = false;

  nativeBuildInputs = [
    which
    doxygen
    gtk3
    pkg-config
    setuptools
  ] ++ lib.optionals stdenv.isLinux [
    autoPatchelfHook
  ];

  buildInputs = [
    gtk3
    ncurses
  ] ++ lib.optionals stdenv.isLinux [
    libXinerama
    libSM
    libXxf86vm
    libXtst
    xorgproto
    gst_all_1.gstreamer
    gst_all_1.gst-plugins-base
    libGLU
    libGL
    libglvnd
    mesa
    webkitgtk
  ] ++ lib.optionals stdenv.isDarwin [
    AGL
    AudioToolbox
    AVFoundation
    AVKit
    Carbon
    Cocoa
    CoreFoundation
    CoreMedia
    IOKit
    Kernel
    OpenGL
    Security
    WebKit
  ];

  propagatedBuildInputs = [
    pillow
    numpy
    six
  ];

  DOXYGEN = "${doxygen}/bin/doxygen";

  preConfigure = lib.optionalString (!stdenv.isDarwin) ''
    substituteInPlace wx/lib/wxcairo/wx_pycairo.py \
      --replace '_dlls = dict()' '_dlls = {k: ctypes.CDLL(v) for k, v in [
        ("gdk",        "${gtk3}/lib/libgtk-x11-3.0.so"),
        ("pangocairo", "${pango.out}/lib/libpangocairo-1.0.so"),
        ("cairoLib = None", "cairoLib = ctypes.CDLL('${cairo}/lib/libcairo.so')"),
        ("appsvc",     None)
      ]}'
  '';

  buildPhase = ''
    ${python.pythonForBuild.interpreter} build.py -v build_wx dox etg --nodoc sip build_py
  '';

  installPhase = ''
    ${python.pythonForBuild.interpreter} setup.py install --skip-build --prefix=$out
    wrapPythonPrograms
  '';

  meta = with lib; {
    description = "Cross platform GUI toolkit for Python, Phoenix version";
    homepage = "http://wxpython.org/";
    license = licenses.wxWindows;
    maintainers = with maintainers; [ tfmoraes ];
    broken = true;
  };
}