From af0f9fa26b02fd8c5808d89a3781d3777f8c0d1f Mon Sep 17 00:00:00 2001 From: Josef Kemetmüller Date: Thu, 15 Mar 2018 19:49:09 +0100 Subject: pythonPackages.tkinter: fix darwin build --- .../interpreters/python/cpython/2.7/default.nix | 2 + .../cpython/2.7/use-correct-tcl-tk-on-darwin.patch | 48 ++++++++++++++++++++++ .../interpreters/python/cpython/3.4/default.nix | 2 + .../cpython/3.4/use-correct-tcl-tk-on-darwin.patch | 48 ++++++++++++++++++++++ .../interpreters/python/cpython/3.5/default.nix | 2 + .../cpython/3.5/use-correct-tcl-tk-on-darwin.patch | 48 ++++++++++++++++++++++ .../interpreters/python/cpython/3.6/default.nix | 2 + .../cpython/3.6/use-correct-tcl-tk-on-darwin.patch | 48 ++++++++++++++++++++++ 8 files changed, 200 insertions(+) create mode 100644 pkgs/development/interpreters/python/cpython/2.7/use-correct-tcl-tk-on-darwin.patch create mode 100644 pkgs/development/interpreters/python/cpython/3.4/use-correct-tcl-tk-on-darwin.patch create mode 100644 pkgs/development/interpreters/python/cpython/3.5/use-correct-tcl-tk-on-darwin.patch create mode 100644 pkgs/development/interpreters/python/cpython/3.6/use-correct-tcl-tk-on-darwin.patch (limited to 'pkgs/development/interpreters/python') diff --git a/pkgs/development/interpreters/python/cpython/2.7/default.nix b/pkgs/development/interpreters/python/cpython/2.7/default.nix index 61f17a959bd9..a934d6c3bcf2 100644 --- a/pkgs/development/interpreters/python/cpython/2.7/default.nix +++ b/pkgs/development/interpreters/python/cpython/2.7/default.nix @@ -60,6 +60,8 @@ let ./properly-detect-curses.patch + ] ++ optionals (x11Support && stdenv.isDarwin) [ + ./use-correct-tcl-tk-on-darwin.patch ] ++ optionals stdenv.isLinux [ # Disable the use of ldconfig in ctypes.util.find_library (since diff --git a/pkgs/development/interpreters/python/cpython/2.7/use-correct-tcl-tk-on-darwin.patch b/pkgs/development/interpreters/python/cpython/2.7/use-correct-tcl-tk-on-darwin.patch new file mode 100644 index 000000000000..b73f62b97ec5 --- /dev/null +++ b/pkgs/development/interpreters/python/cpython/2.7/use-correct-tcl-tk-on-darwin.patch @@ -0,0 +1,48 @@ +diff --git a/setup.py b/setup.py +index 2779658..902d0eb 100644 +--- a/setup.py ++++ b/setup.py +@@ -1699,9 +1699,6 @@ class PyBuildExt(build_ext): + # Rather than complicate the code below, detecting and building + # AquaTk is a separate method. Only one Tkinter will be built on + # Darwin - either AquaTk, if it is found, or X11 based Tk. +- if (host_platform == 'darwin' and +- self.detect_tkinter_darwin(inc_dirs, lib_dirs)): +- return + + # Assume we haven't found any of the libraries or include files + # The versions with dots are used on Unix, and the versions without +@@ -1747,22 +1744,6 @@ class PyBuildExt(build_ext): + if dir not in include_dirs: + include_dirs.append(dir) + +- # Check for various platform-specific directories +- if host_platform == 'sunos5': +- include_dirs.append('/usr/openwin/include') +- added_lib_dirs.append('/usr/openwin/lib') +- elif os.path.exists('/usr/X11R6/include'): +- include_dirs.append('/usr/X11R6/include') +- added_lib_dirs.append('/usr/X11R6/lib64') +- added_lib_dirs.append('/usr/X11R6/lib') +- elif os.path.exists('/usr/X11R5/include'): +- include_dirs.append('/usr/X11R5/include') +- added_lib_dirs.append('/usr/X11R5/lib') +- else: +- # Assume default location for X11 +- include_dirs.append('/usr/X11/include') +- added_lib_dirs.append('/usr/X11/lib') +- + # If Cygwin, then verify that X is installed before proceeding + if host_platform == 'cygwin': + x11_inc = find_file('X11/Xlib.h', [], include_dirs) +@@ -1786,10 +1767,6 @@ class PyBuildExt(build_ext): + if host_platform in ['aix3', 'aix4']: + libs.append('ld') + +- # Finally, link with the X11 libraries (not appropriate on cygwin) +- if host_platform != "cygwin": +- libs.append('X11') +- + ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'], + define_macros=[('WITH_APPINIT', 1)] + defs, + include_dirs = include_dirs, diff --git a/pkgs/development/interpreters/python/cpython/3.4/default.nix b/pkgs/development/interpreters/python/cpython/3.4/default.nix index 4c0979ca0e3c..d4391d873af7 100644 --- a/pkgs/development/interpreters/python/cpython/3.4/default.nix +++ b/pkgs/development/interpreters/python/cpython/3.4/default.nix @@ -67,6 +67,8 @@ in stdenv.mkDerivation { patches = [ ./no-ldconfig.patch ./ld_library_path.patch + ] ++ optionals (x11Support && stdenv.isDarwin) [ + ./use-correct-tcl-tk-on-darwin.patch ]; postPatch = '' diff --git a/pkgs/development/interpreters/python/cpython/3.4/use-correct-tcl-tk-on-darwin.patch b/pkgs/development/interpreters/python/cpython/3.4/use-correct-tcl-tk-on-darwin.patch new file mode 100644 index 000000000000..b73f62b97ec5 --- /dev/null +++ b/pkgs/development/interpreters/python/cpython/3.4/use-correct-tcl-tk-on-darwin.patch @@ -0,0 +1,48 @@ +diff --git a/setup.py b/setup.py +index 2779658..902d0eb 100644 +--- a/setup.py ++++ b/setup.py +@@ -1699,9 +1699,6 @@ class PyBuildExt(build_ext): + # Rather than complicate the code below, detecting and building + # AquaTk is a separate method. Only one Tkinter will be built on + # Darwin - either AquaTk, if it is found, or X11 based Tk. +- if (host_platform == 'darwin' and +- self.detect_tkinter_darwin(inc_dirs, lib_dirs)): +- return + + # Assume we haven't found any of the libraries or include files + # The versions with dots are used on Unix, and the versions without +@@ -1747,22 +1744,6 @@ class PyBuildExt(build_ext): + if dir not in include_dirs: + include_dirs.append(dir) + +- # Check for various platform-specific directories +- if host_platform == 'sunos5': +- include_dirs.append('/usr/openwin/include') +- added_lib_dirs.append('/usr/openwin/lib') +- elif os.path.exists('/usr/X11R6/include'): +- include_dirs.append('/usr/X11R6/include') +- added_lib_dirs.append('/usr/X11R6/lib64') +- added_lib_dirs.append('/usr/X11R6/lib') +- elif os.path.exists('/usr/X11R5/include'): +- include_dirs.append('/usr/X11R5/include') +- added_lib_dirs.append('/usr/X11R5/lib') +- else: +- # Assume default location for X11 +- include_dirs.append('/usr/X11/include') +- added_lib_dirs.append('/usr/X11/lib') +- + # If Cygwin, then verify that X is installed before proceeding + if host_platform == 'cygwin': + x11_inc = find_file('X11/Xlib.h', [], include_dirs) +@@ -1786,10 +1767,6 @@ class PyBuildExt(build_ext): + if host_platform in ['aix3', 'aix4']: + libs.append('ld') + +- # Finally, link with the X11 libraries (not appropriate on cygwin) +- if host_platform != "cygwin": +- libs.append('X11') +- + ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'], + define_macros=[('WITH_APPINIT', 1)] + defs, + include_dirs = include_dirs, diff --git a/pkgs/development/interpreters/python/cpython/3.5/default.nix b/pkgs/development/interpreters/python/cpython/3.5/default.nix index a8519a76a232..4f9e79c1d5f0 100644 --- a/pkgs/development/interpreters/python/cpython/3.5/default.nix +++ b/pkgs/development/interpreters/python/cpython/3.5/default.nix @@ -67,6 +67,8 @@ in stdenv.mkDerivation { patches = [ ./no-ldconfig.patch ./ld_library_path.patch + ] ++ optionals (x11Support && stdenv.isDarwin) [ + ./use-correct-tcl-tk-on-darwin.patch ]; postPatch = '' diff --git a/pkgs/development/interpreters/python/cpython/3.5/use-correct-tcl-tk-on-darwin.patch b/pkgs/development/interpreters/python/cpython/3.5/use-correct-tcl-tk-on-darwin.patch new file mode 100644 index 000000000000..b73f62b97ec5 --- /dev/null +++ b/pkgs/development/interpreters/python/cpython/3.5/use-correct-tcl-tk-on-darwin.patch @@ -0,0 +1,48 @@ +diff --git a/setup.py b/setup.py +index 2779658..902d0eb 100644 +--- a/setup.py ++++ b/setup.py +@@ -1699,9 +1699,6 @@ class PyBuildExt(build_ext): + # Rather than complicate the code below, detecting and building + # AquaTk is a separate method. Only one Tkinter will be built on + # Darwin - either AquaTk, if it is found, or X11 based Tk. +- if (host_platform == 'darwin' and +- self.detect_tkinter_darwin(inc_dirs, lib_dirs)): +- return + + # Assume we haven't found any of the libraries or include files + # The versions with dots are used on Unix, and the versions without +@@ -1747,22 +1744,6 @@ class PyBuildExt(build_ext): + if dir not in include_dirs: + include_dirs.append(dir) + +- # Check for various platform-specific directories +- if host_platform == 'sunos5': +- include_dirs.append('/usr/openwin/include') +- added_lib_dirs.append('/usr/openwin/lib') +- elif os.path.exists('/usr/X11R6/include'): +- include_dirs.append('/usr/X11R6/include') +- added_lib_dirs.append('/usr/X11R6/lib64') +- added_lib_dirs.append('/usr/X11R6/lib') +- elif os.path.exists('/usr/X11R5/include'): +- include_dirs.append('/usr/X11R5/include') +- added_lib_dirs.append('/usr/X11R5/lib') +- else: +- # Assume default location for X11 +- include_dirs.append('/usr/X11/include') +- added_lib_dirs.append('/usr/X11/lib') +- + # If Cygwin, then verify that X is installed before proceeding + if host_platform == 'cygwin': + x11_inc = find_file('X11/Xlib.h', [], include_dirs) +@@ -1786,10 +1767,6 @@ class PyBuildExt(build_ext): + if host_platform in ['aix3', 'aix4']: + libs.append('ld') + +- # Finally, link with the X11 libraries (not appropriate on cygwin) +- if host_platform != "cygwin": +- libs.append('X11') +- + ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'], + define_macros=[('WITH_APPINIT', 1)] + defs, + include_dirs = include_dirs, diff --git a/pkgs/development/interpreters/python/cpython/3.6/default.nix b/pkgs/development/interpreters/python/cpython/3.6/default.nix index fb58d0871ecb..317a335b3448 100644 --- a/pkgs/development/interpreters/python/cpython/3.6/default.nix +++ b/pkgs/development/interpreters/python/cpython/3.6/default.nix @@ -69,6 +69,8 @@ in stdenv.mkDerivation { patches = [ ./no-ldconfig.patch + ] ++ optionals (x11Support && stdenv.isDarwin) [ + ./use-correct-tcl-tk-on-darwin.patch ]; postPatch = '' diff --git a/pkgs/development/interpreters/python/cpython/3.6/use-correct-tcl-tk-on-darwin.patch b/pkgs/development/interpreters/python/cpython/3.6/use-correct-tcl-tk-on-darwin.patch new file mode 100644 index 000000000000..b73f62b97ec5 --- /dev/null +++ b/pkgs/development/interpreters/python/cpython/3.6/use-correct-tcl-tk-on-darwin.patch @@ -0,0 +1,48 @@ +diff --git a/setup.py b/setup.py +index 2779658..902d0eb 100644 +--- a/setup.py ++++ b/setup.py +@@ -1699,9 +1699,6 @@ class PyBuildExt(build_ext): + # Rather than complicate the code below, detecting and building + # AquaTk is a separate method. Only one Tkinter will be built on + # Darwin - either AquaTk, if it is found, or X11 based Tk. +- if (host_platform == 'darwin' and +- self.detect_tkinter_darwin(inc_dirs, lib_dirs)): +- return + + # Assume we haven't found any of the libraries or include files + # The versions with dots are used on Unix, and the versions without +@@ -1747,22 +1744,6 @@ class PyBuildExt(build_ext): + if dir not in include_dirs: + include_dirs.append(dir) + +- # Check for various platform-specific directories +- if host_platform == 'sunos5': +- include_dirs.append('/usr/openwin/include') +- added_lib_dirs.append('/usr/openwin/lib') +- elif os.path.exists('/usr/X11R6/include'): +- include_dirs.append('/usr/X11R6/include') +- added_lib_dirs.append('/usr/X11R6/lib64') +- added_lib_dirs.append('/usr/X11R6/lib') +- elif os.path.exists('/usr/X11R5/include'): +- include_dirs.append('/usr/X11R5/include') +- added_lib_dirs.append('/usr/X11R5/lib') +- else: +- # Assume default location for X11 +- include_dirs.append('/usr/X11/include') +- added_lib_dirs.append('/usr/X11/lib') +- + # If Cygwin, then verify that X is installed before proceeding + if host_platform == 'cygwin': + x11_inc = find_file('X11/Xlib.h', [], include_dirs) +@@ -1786,10 +1767,6 @@ class PyBuildExt(build_ext): + if host_platform in ['aix3', 'aix4']: + libs.append('ld') + +- # Finally, link with the X11 libraries (not appropriate on cygwin) +- if host_platform != "cygwin": +- libs.append('X11') +- + ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'], + define_macros=[('WITH_APPINIT', 1)] + defs, + include_dirs = include_dirs, -- cgit 1.4.1