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