[gtk-osx] Python2 fixes for Xcode 7
- From: John Ralls <jralls src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-osx] Python2 fixes for Xcode 7
- Date: Thu, 18 Feb 2016 20:52:52 +0000 (UTC)
commit ebeb86906b2cb0bb24f9afd3c03dba386baa7033
Author: Christoph Reiter <reiter christoph gmail com>
Date: Wed Feb 17 16:42:58 2016 +0100
Python2 fixes for Xcode 7
Include patches from the python bug tracker:
1) https://bugs.python.org/issue25136 for fixing zlib/bz2 modules
when using Xcode 7.
2) https://bugs.python.org/issue11445 for fixing python.exe being
linked against the wrong lib on the first build
modulesets-stable/gtk-osx-python.modules | 2 +
modulesets-unstable/gtk-osx-python.modules | 2 +
modulesets/gtk-osx-python.modules | 2 +
patches/python2-linkflags.patch | 31 +++++++++++
patches/python2-xcode-stubs.patch | 79 ++++++++++++++++++++++++++++
5 files changed, 116 insertions(+), 0 deletions(-)
---
diff --git a/modulesets-stable/gtk-osx-python.modules b/modulesets-stable/gtk-osx-python.modules
index 2eadc5c..fd3a81c 100644
--- a/modulesets-stable/gtk-osx-python.modules
+++ b/modulesets-stable/gtk-osx-python.modules
@@ -73,6 +73,8 @@
<branch repo="python"
module="2.7.11/Python-2.7.11.tar.xz" version="2.7.11">
<patch file="http://git.gnome.org/browse/gtk-osx/plain/patches/python2-test_grammar.py-typo.patch"
strip="1"/>
+ <patch file="http://git.gnome.org/browse/gtk-osx/plain/patches/python2-xcode-stubs.patch" strip="1"/>
+ <patch file="http://git.gnome.org/browse/gtk-osx/plain/patches/python2-linkflags.patch" strip="1"/>"/>
</branch>
<dependencies>
<dep package="gettext-runtime"/>
diff --git a/modulesets-unstable/gtk-osx-python.modules b/modulesets-unstable/gtk-osx-python.modules
index 7601208..1fd5331 100644
--- a/modulesets-unstable/gtk-osx-python.modules
+++ b/modulesets-unstable/gtk-osx-python.modules
@@ -49,6 +49,8 @@
<branch repo="python"
module="2.7.11/Python-2.7.11.tar.xz" version="2.7.11">
<patch file="http://git.gnome.org/browse/gtk-osx/plain/patches/python2-test_grammar.py-typo.patch"
strip="1"/>
+ <patch file="http://git.gnome.org/browse/gtk-osx/plain/patches/python2-xcode-stubs.patch" strip="1"/>
+ <patch file="http://git.gnome.org/browse/gtk-osx/plain/patches/python2-linkflags.patch" strip="1"/>
</branch>
<dependencies>
<dep package="gettext-runtime"/>
diff --git a/modulesets/gtk-osx-python.modules b/modulesets/gtk-osx-python.modules
index 312ad8a..436b739 100644
--- a/modulesets/gtk-osx-python.modules
+++ b/modulesets/gtk-osx-python.modules
@@ -51,6 +51,8 @@
<branch repo="python"
module="2.7.11/Python-2.7.11.tar.xz" version="2.7.11">
<patch file="http://git.gnome.org/browse/gtk-osx/plain/patches/python2-test_grammar.py-typo.patch"
strip="1"/>
+ <patch file="http://git.gnome.org/browse/gtk-osx/plain/patches/python2-xcode-stubs.patch" strip="1"/>
+ <patch file="http://git.gnome.org/browse/gtk-osx/plain/patches/python2-linkflags.patch" strip="1"/>
</branch>
<dependencies>
<dep package="gettext-runtime"/>
diff --git a/patches/python2-linkflags.patch b/patches/python2-linkflags.patch
new file mode 100644
index 0000000..fca0126
--- /dev/null
+++ b/patches/python2-linkflags.patch
@@ -0,0 +1,31 @@
+Patch from https://bugs.python.org/issue11445 (minus whitespace changes)
+Fixes python.exe linking against the system libpython instead of the
+just built one (https://mail.gnome.org/archives/gtk-osx-devel-list/2014-December/msg00016.html)
+
+diff --git a/Makefile.pre.in b/Makefile.pre.in
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -505,9 +505,9 @@
+
+ # Build the interpreter
+ $(BUILDPYTHON): Modules/python.o $(LIBRARY) $(LDLIBRARY)
+- $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
++ $(LINKCC) $(LINKFORSHARED) -o $@ \
+ Modules/python.o \
+- $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
++ $(BLDLIBRARY) $(LDFLAGS) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
+
+ platform: $(BUILDPYTHON) pybuilddir.txt
+ $(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import sys ; from sysconfig import get_platform ; print
get_platform()+"-"+sys.version[0:3]' >platform
+diff --git a/configure.ac b/configure.ac
+--- a/configure.ac
++++ b/configure.ac
+@@ -1216,6 +1216,8 @@
+ export MACOSX_DEPLOYMENT_TARGET
+ EXPORT_MACOSX_DEPLOYMENT_TARGET=''
+
++ LDFLAGS="${LDFLAGS} -Wl,-search_paths_first"
++
+ if test "${enable_universalsdk}"; then
+ UNIVERSAL_ARCH_FLAGS=""
+ if test "$UNIVERSAL_ARCHS" = "32-bit" ; then
diff --git a/patches/python2-xcode-stubs.patch b/patches/python2-xcode-stubs.patch
new file mode 100644
index 0000000..b3fa90d
--- /dev/null
+++ b/patches/python2-xcode-stubs.patch
@@ -0,0 +1,79 @@
+Patch from https://bugs.python.org/issue25136. Fixes Python not finding
+zlib/bz2 on OS X 10.11 and Xcode 7
+
+From 613d602c7966d68947458e07e05728b5372c76b9 Mon Sep 17 00:00:00 2001
+From: "Tim D. Smith" <git tim-smith us>
+Date: Tue, 15 Sep 2015 20:48:29 -0700
+Subject: [PATCH] add distutils support for Xcode 7 .tbd library stubs
+
+---
+ Lib/distutils/ccompiler.py | 5 +++--
+ Lib/distutils/unixccompiler.py | 7 +++++++
+ 2 files changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/Lib/distutils/ccompiler.py b/Lib/distutils/ccompiler.py
+index c0c446f..62506a6 100644
+--- a/Lib/distutils/ccompiler.py
++++ b/Lib/distutils/ccompiler.py
+@@ -842,8 +842,9 @@ main (int argc, char **argv) {
+ def library_filename(self, libname, lib_type='static', # or 'shared'
+ strip_dir=0, output_dir=''):
+ assert output_dir is not None
+- if lib_type not in ("static", "shared", "dylib"):
+- raise ValueError, "'lib_type' must be \"static\", \"shared\" or \"dylib\""
++ if lib_type not in ("static", "shared", "dylib", "xcode_stub"):
++ raise ValueError, ("""'lib_type' must be "static", "shared", """
++ """"dylib", or "xcode_stub".""")
+ fmt = getattr(self, lib_type + "_lib_format")
+ ext = getattr(self, lib_type + "_lib_extension")
+
+diff --git a/Lib/distutils/unixccompiler.py b/Lib/distutils/unixccompiler.py
+index 2aa1cb1..83ec109 100644
+--- a/Lib/distutils/unixccompiler.py
++++ b/Lib/distutils/unixccompiler.py
+@@ -79,7 +79,9 @@ class UnixCCompiler(CCompiler):
+ static_lib_extension = ".a"
+ shared_lib_extension = ".so"
+ dylib_lib_extension = ".dylib"
++ xcode_stub_lib_extension = ".tbd"
+ static_lib_format = shared_lib_format = dylib_lib_format = "lib%s%s"
++ xcode_stub_lib_format = dylib_lib_format
+ if sys.platform == "cygwin":
+ exe_extension = ".exe"
+
+@@ -245,6 +247,7 @@ class UnixCCompiler(CCompiler):
+ def find_library_file(self, dirs, lib, debug=0):
+ shared_f = self.library_filename(lib, lib_type='shared')
+ dylib_f = self.library_filename(lib, lib_type='dylib')
++ xcode_stub_f = self.library_filename(lib, lib_type='xcode_stub')
+ static_f = self.library_filename(lib, lib_type='static')
+
+ if sys.platform == 'darwin':
+@@ -264,6 +267,7 @@ class UnixCCompiler(CCompiler):
+ shared = os.path.join(dir, shared_f)
+ dylib = os.path.join(dir, dylib_f)
+ static = os.path.join(dir, static_f)
++ xcode_stub = os.path.join(dir, xcode_stub_f)
+
+ if sys.platform == 'darwin' and (
+ dir.startswith('/System/') or (
+@@ -272,6 +276,7 @@ class UnixCCompiler(CCompiler):
+ shared = os.path.join(sysroot, dir[1:], shared_f)
+ dylib = os.path.join(sysroot, dir[1:], dylib_f)
+ static = os.path.join(sysroot, dir[1:], static_f)
++ xcode_stub = os.path.join(sysroot, dir[1:], xcode_stub_f)
+
+ # We're second-guessing the linker here, with not much hard
+ # data to go on: GCC seems to prefer the shared library, so I'm
+@@ -279,6 +284,8 @@ class UnixCCompiler(CCompiler):
+ # ignoring even GCC's "-static" option. So sue me.
+ if os.path.exists(dylib):
+ return dylib
++ elif os.path.exists(xcode_stub):
++ return xcode_stub
+ elif os.path.exists(shared):
+ return shared
+ elif os.path.exists(static):
+--
+2.5.2
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]