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 name = "wxPython-${version}"; 23 version = "3.0.2.0"; 24 25 disabled = isPy3k || isPyPy; 26 doCheck = false; 27 28 src = fetchurl { 29 url = "mirror://sourceforge/wxpython/wxPython-src-${version}.tar.bz2"; 30 sha256 = "0qfzx3sqx4mwxv99sfybhsij4b5pc03ricl73h4vhkzazgjjjhfm"; 31 }; 32 33 hardeningDisable = [ "format" ]; 34 35 propagatedBuildInputs = [ pkgconfig ] 36 ++ (lib.optional openglSupport pyopengl) 37 ++ (lib.optionals (!stdenv.isDarwin) [ wxGTK (wxGTK.gtk) libX11 ]) 38 ++ (lib.optionals stdenv.isDarwin [ wxmac darwin.apple_sdk.frameworks.Cocoa ]) 39 ; 40 preConfigure = '' 41 cd wxPython 42 # remove wxPython's darwin hack that interference with python-2.7-distutils-C++.patch 43 substituteInPlace config.py \ 44 --replace "distutils.unixccompiler.UnixCCompiler = MyUnixCCompiler" "" 45 # this check is supposed to only return false on older systems running non-framework python 46 substituteInPlace src/osx_cocoa/_core_wrap.cpp \ 47 --replace "return wxPyTestDisplayAvailable();" "return true;" 48 '' + lib.optionalString (!stdenv.isDarwin) '' 49 substituteInPlace wx/lib/wxcairo.py \ 50 --replace 'cairoLib = None' 'cairoLib = ctypes.CDLL("${cairo}/lib/libcairo.so")' 51 substituteInPlace wx/lib/wxcairo.py \ 52 --replace '_dlls = dict()' '_dlls = {k: ctypes.CDLL(v) for k, v in [ 53 ("gdk", "${wxGTK.gtk}/lib/libgtk-x11-2.0.so"), 54 ("pangocairo", "${pango.out}/lib/libpangocairo-1.0.so"), 55 ("appsvc", None) 56 ]}' 57 ''; 58 59 NIX_LDFLAGS = lib.optionalString (!stdenv.isDarwin) "-lX11 -lgdk-x11-2.0"; 60 61 buildPhase = ""; 62 63 installPhase = '' 64 ${python.interpreter} setup.py install WXPORT=${if stdenv.isDarwin then "osx_cocoa" else "gtk2"} NO_HEADERS=1 BUILD_GLCANVAS=${if openglSupport then "1" else "0"} UNICODE=1 --prefix=$out 65 wrapPythonPrograms 66 ''; 67 68 passthru = { inherit wxGTK openglSupport; }; 69}