1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 setuptools,
6 fetchPypi,
7 substituteAll,
8
9 # build
10 autoPatchelfHook,
11 attrdict,
12 doxygen,
13 pkg-config,
14 python,
15 sip,
16 which,
17 buildPackages,
18
19 # runtime
20 cairo,
21 gst_all_1,
22 gtk3,
23 libGL,
24 libGLU,
25 libSM,
26 libXinerama,
27 libXtst,
28 libXxf86vm,
29 libglvnd,
30 mesa,
31 pango,
32 SDL,
33 webkitgtk_4_0,
34 wxGTK,
35 xorgproto,
36
37 # propagates
38 numpy,
39 pillow,
40 six,
41}:
42
43buildPythonPackage rec {
44 pname = "wxpython";
45 version = "4.2.2";
46 format = "other";
47
48 src = fetchPypi {
49 pname = "wxPython";
50 inherit version;
51 hash = "sha256-XbywZQ9n/cLFlleVolX/qj17CfsUmqjaLQ2apE444ro=";
52 };
53
54 patches = [
55 (substituteAll {
56 src = ./4.2-ctypes.patch;
57 libgdk = "${gtk3.out}/lib/libgdk-3.so";
58 libpangocairo = "${pango}/lib/libpangocairo-1.0.so";
59 libcairo = "${cairo}/lib/libcairo.so";
60 })
61 ./0001-add-missing-bool-c.patch # Add missing bool.c from old source
62 ];
63
64 # https://github.com/wxWidgets/Phoenix/issues/2575
65 postPatch = ''
66 ln -s ${lib.getExe buildPackages.waf} bin/waf
67 substituteInPlace build.py \
68 --replace-fail "distutils.dep_util" "setuptools.modified"
69 '';
70
71 nativeBuildInputs = [
72 attrdict
73 pkg-config
74 setuptools
75 SDL
76 sip
77 which
78 wxGTK
79 ] ++ lib.optionals stdenv.hostPlatform.isLinux [ autoPatchelfHook ];
80
81 buildInputs =
82 [
83 wxGTK
84 SDL
85 ]
86 ++ lib.optionals stdenv.hostPlatform.isLinux [
87 gst_all_1.gst-plugins-base
88 gst_all_1.gstreamer
89 libGL
90 libGLU
91 libSM
92 libXinerama
93 libXtst
94 libXxf86vm
95 libglvnd
96 mesa
97 webkitgtk_4_0
98 xorgproto
99 ];
100
101 propagatedBuildInputs = [
102 numpy
103 pillow
104 six
105 ];
106
107 buildPhase = ''
108 runHook preBuild
109
110 export DOXYGEN=${doxygen}/bin/doxygen
111 export PATH="${wxGTK}/bin:$PATH"
112 export SDL_CONFIG="${SDL.dev}/bin/sdl-config"
113 export WAF=$PWD/bin/waf
114
115 ${python.pythonOnBuildForHost.interpreter} build.py -v --use_syswx dox etg sip --nodoc build_py
116
117 runHook postBuild
118 '';
119
120 installPhase = ''
121 runHook preInstall
122
123 ${python.pythonOnBuildForHost.interpreter} setup.py install --skip-build --prefix=$out
124 wrapPythonPrograms
125
126 runHook postInstall
127 '';
128
129 checkPhase = ''
130 runHook preCheck
131
132 ${python.interpreter} build.py -v test
133
134 runHook postCheck
135 '';
136
137 meta = with lib; {
138 changelog = "https://github.com/wxWidgets/Phoenix/blob/wxPython-${version}/CHANGES.rst";
139 description = "Cross platform GUI toolkit for Python, Phoenix version";
140 homepage = "http://wxpython.org/";
141 license = licenses.wxWindows;
142 maintainers = with maintainers; [ hexa ];
143 };
144}