Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ fetchurl 2, lib 3, stdenv 4, darwin 5, openglSupport ? true 6, libX11 7, wxGTK 8, wxmac 9, pkgconfig 10, buildPythonPackage 11, pyopengl 12, isPy3k 13, isPyPy 14, python 15, cairo 16, pango 17}: 18 19assert wxGTK.unicode; 20 21buildPythonPackage rec { 22 pname = "wxPython"; 23 version = "3.0.2.0"; 24 name = pname + "-" + version; 25 26 disabled = isPy3k || isPyPy; 27 doCheck = false; 28 29 src = fetchurl { 30 url = "mirror://sourceforge/wxpython/wxPython-src-${version}.tar.bz2"; 31 sha256 = "0qfzx3sqx4mwxv99sfybhsij4b5pc03ricl73h4vhkzazgjjjhfm"; 32 }; 33 34 hardeningDisable = [ "format" ]; 35 36 nativeBuildInputs = [ pkgconfig ] 37 ++ (lib.optionals (!stdenv.isDarwin) [ wxGTK libX11 ]) 38 ++ (lib.optionals stdenv.isDarwin [ wxmac darwin.apple_sdk.frameworks.Cocoa ]); 39 40 buildInputs = [ ] 41 ++ (lib.optionals (!stdenv.isDarwin) [ (wxGTK.gtk) ]) 42 ++ (lib.optional openglSupport pyopengl); 43 44 preConfigure = '' 45 cd wxPython 46 # remove wxPython's darwin hack that interference with python-2.7-distutils-C++.patch 47 substituteInPlace config.py \ 48 --replace "distutils.unixccompiler.UnixCCompiler = MyUnixCCompiler" "" 49 # set the WXPREFIX to $out instead of the storepath of wxwidgets 50 substituteInPlace config.py \ 51 --replace "WXPREFIX = getWxConfigValue('--prefix')" "WXPREFIX = '$out'" 52 # this check is supposed to only return false on older systems running non-framework python 53 substituteInPlace src/osx_cocoa/_core_wrap.cpp \ 54 --replace "return wxPyTestDisplayAvailable();" "return true;" 55 '' + lib.optionalString (!stdenv.isDarwin) '' 56 substituteInPlace wx/lib/wxcairo.py \ 57 --replace 'cairoLib = None' 'cairoLib = ctypes.CDLL("${cairo}/lib/libcairo.so")' 58 substituteInPlace wx/lib/wxcairo.py \ 59 --replace '_dlls = dict()' '_dlls = {k: ctypes.CDLL(v) for k, v in [ 60 ("gdk", "${wxGTK.gtk}/lib/libgtk-x11-2.0.so"), 61 ("pangocairo", "${pango.out}/lib/libpangocairo-1.0.so"), 62 ("appsvc", None) 63 ]}' 64 ''; 65 66 buildPhase = ""; 67 68 installPhase = '' 69 ${python.interpreter} setup.py install WXPORT=${if stdenv.isDarwin then "osx_cocoa" else "gtk2"} NO_HEADERS=0 BUILD_GLCANVAS=${if openglSupport then "1" else "0"} UNICODE=1 --prefix=$out 70 wrapPythonPrograms 71 ''; 72 73 passthru = { inherit wxGTK openglSupport; }; 74}