summary refs log tree commit diff
path: root/pkgs/development/python-modules/wxPython
diff options
context:
space:
mode:
authorDmitry Kalinkin <dmitry.kalinkin@gmail.com>2017-02-14 20:26:17 -0500
committerDmitry Kalinkin <dmitry.kalinkin@gmail.com>2017-02-16 18:48:08 -0500
commitc2a573365422f200e7d99823f29ba5ffec338579 (patch)
tree2328ae13f87c254c5b9a5198c985e1dad8c13e65 /pkgs/development/python-modules/wxPython
parentc34a52bf5da351a13211a87ebc1a7a32ef2af6ba (diff)
downloadnixlib-c2a573365422f200e7d99823f29ba5ffec338579.tar
nixlib-c2a573365422f200e7d99823f29ba5ffec338579.tar.gz
nixlib-c2a573365422f200e7d99823f29ba5ffec338579.tar.bz2
nixlib-c2a573365422f200e7d99823f29ba5ffec338579.tar.lz
nixlib-c2a573365422f200e7d99823f29ba5ffec338579.tar.xz
nixlib-c2a573365422f200e7d99823f29ba5ffec338579.tar.zst
nixlib-c2a573365422f200e7d99823f29ba5ffec338579.zip
wxPython: fix on darwin
Diffstat (limited to 'pkgs/development/python-modules/wxPython')
-rw-r--r--pkgs/development/python-modules/wxPython/3.0.nix23
1 files changed, 19 insertions, 4 deletions
diff --git a/pkgs/development/python-modules/wxPython/3.0.nix b/pkgs/development/python-modules/wxPython/3.0.nix
index 8dc99955af31..defdc920d6e5 100644
--- a/pkgs/development/python-modules/wxPython/3.0.nix
+++ b/pkgs/development/python-modules/wxPython/3.0.nix
@@ -1,8 +1,11 @@
 { fetchurl
 , lib
+, stdenv
+, darwin
 , openglSupport ? true
 , libX11
 , wxGTK
+, wxmac
 , pkgconfig
 , buildPythonPackage
 , pyopengl
@@ -27,15 +30,27 @@ buildPythonPackage rec {
 
   hardeningDisable = [ "format" ];
 
-  propagatedBuildInputs = [ pkgconfig wxGTK (wxGTK.gtk) libX11 ]  ++ lib.optional openglSupport pyopengl;
-  preConfigure = "cd wxPython";
+  propagatedBuildInputs = [ pkgconfig ]
+    ++ (lib.optional openglSupport pyopengl)
+    ++ (lib.optionals (!stdenv.isDarwin) [ wxGTK (wxGTK.gtk) libX11 ])
+    ++ (lib.optionals stdenv.isDarwin [ wxmac darwin.apple_sdk.frameworks.Cocoa ])
+    ;
+  preConfigure = ''
+    cd wxPython
+    # remove wxPython's darwin hack that interference with python-2.7-distutils-C++.patch
+    substituteInPlace config.py \
+      --replace "distutils.unixccompiler.UnixCCompiler = MyUnixCCompiler" ""
+    # this check is supposed to only return false on older systems running non-framework python
+    substituteInPlace src/osx_cocoa/_core_wrap.cpp \
+      --replace "return wxPyTestDisplayAvailable();" "return true;"
+  '';
 
-  NIX_LDFLAGS = "-lX11 -lgdk-x11-2.0";
+  NIX_LDFLAGS = lib.optionalString (!stdenv.isDarwin) "-lX11 -lgdk-x11-2.0";
 
   buildPhase = "";
 
   installPhase = ''
-    ${python.interpreter} setup.py install WXPORT=gtk2 NO_HEADERS=1 BUILD_GLCANVAS=${if openglSupport then "1" else "0"} UNICODE=1 --prefix=$out
+    ${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
     wrapPythonPrograms
   '';