[gtk-osx] Fix py2cairo-python2.6 linking



commit 51f4c95241a3838537f46d5ba3fc602f45424d1f
Author: Philip Chimento <philip chimento gmail com>
Date:   Wed Apr 15 23:26:31 2015 -0700

    Fix py2cairo-python2.6 linking
    
    When building a Python native module, the Waf build system will override
    your CFLAGS with whatever CFLAGS Python thinks you need. If you don't
    build Python from jhbuild, you're using the system Python which is a
    multi-arch binary, and so Waf will force your pycairo module to be
    multi-arch as well. That doesn't work when linking against Cairo which is
    not multi-arch.
    
    This works around Waf adding -arch flags to the command line and allows
    our gtk-osx-build -arch flag to take precedence.

 modulesets-stable/gtk-osx-python.modules           |    9 +++---
 modulesets/gtk-osx-python.modules                  |    5 +++-
 patches/patch status                               |    5 +++
 patches/py2cairo-changelog.patch                   |    5 ---
 ...py2cairo-python2.6-Dont-try-to-guess-arch.patch |   28 ++++++++++++++++++++
 5 files changed, 41 insertions(+), 11 deletions(-)
---
diff --git a/modulesets-stable/gtk-osx-python.modules b/modulesets-stable/gtk-osx-python.modules
index 02ac403..86cf85f 100644
--- a/modulesets-stable/gtk-osx-python.modules
+++ b/modulesets-stable/gtk-osx-python.modules
@@ -123,13 +123,12 @@
   </autotools>
 
 <!-- Cairographics have changed the name to py2cairo for python 2 holdouts. -->
-<!-- Needs ChangeLog to autoreconf -->
-  <autotools id="pycairo-python2.6" autogen-sh="autoreconf"
-            supports-non-srcdir-builds="no">
+  <waf id="pycairo-python2.6">
     <branch module="py2cairo-1.10.0.tar.bz2" repo="cairographics.org"
             version="1.10.0"
            hash="sha1:2efa8dfafbd6b8e492adaab07231556fec52d6eb">
-      <patch file="http://git.gnome.org/browse/gtk-osx/plain/patches/py2cairo-changelog.patch"; strip="1"/>
+      <patch 
file="http://git.gnome.org/browse/gtk-osx/plain/patches/py2cairo-python2.6-Dont-try-to-guess-arch.patch";
+             strip="1"/>
     </branch>
     <dependencies>
       <dep package="cairo"/>
@@ -138,7 +137,7 @@
       <dep package="python"/>
       <dep package="meta-gtk-osx-core"/>
     </after>
-  </autotools>
+  </waf>
 
 <!-- Pycairo-python3 for those who've made the leap. -->
   <waf id="pycairo-python3" autogen-sh="configure" python-command="python3">
diff --git a/modulesets/gtk-osx-python.modules b/modulesets/gtk-osx-python.modules
index 7e3a8b1..30f712a 100644
--- a/modulesets/gtk-osx-python.modules
+++ b/modulesets/gtk-osx-python.modules
@@ -99,7 +99,10 @@
   <waf id="pycairo-python2.6">
     <branch module="py2cairo-1.10.0.tar.bz2" repo="cairographics"
             version="1.10.0"
-           hash="sha1:2efa8dfafbd6b8e492adaab07231556fec52d6eb"/>
+            hash="sha1:2efa8dfafbd6b8e492adaab07231556fec52d6eb">
+      <patch 
file="http://git.gnome.org/browse/gtk-osx/plain/patches/py2cairo-python2.6-Dont-try-to-guess-arch.patch";
+             strip="1"/>
+    </branch>
     <dependencies>
       <dep package="cairo"/>
     </dependencies>
diff --git a/patches/patch status b/patches/patch status
index 69c7c9d..4f9229e 100644
--- a/patches/patch status      
+++ b/patches/patch status      
@@ -73,3 +73,8 @@ gstreamer:      gstreamer-fix-includes-in-gst-datetime.patch
                 gstreamer-680428-Fix-flex-version-check.patch
                 gstreamer-706462-Make-grammar-y-work-with-Bison-3.patch
                 All fixed on 0.10 branch, only needed for modulesets-stable.
+
+py2cairo-python2.6: py2cairo-python2.6-Dont-try-to-guess-arch.patch
+               Needed to work around broken behaviour in waf.
+               Not sure if this will ever be fixed.
+               https://code.google.com/p/waf/issues/detail?id=1505
diff --git a/patches/py2cairo-python2.6-Dont-try-to-guess-arch.patch 
b/patches/py2cairo-python2.6-Dont-try-to-guess-arch.patch
new file mode 100644
index 0000000..e885f3f
--- /dev/null
+++ b/patches/py2cairo-python2.6-Dont-try-to-guess-arch.patch
@@ -0,0 +1,28 @@
+--- a/src/wscript      2015-04-12 20:24:07.000000000 -0700
++++ b/src/wscript      2015-04-12 20:37:47.000000000 -0700
+@@ -18,7 +18,7 @@
+     )
+ 
+   # C extension module
+-  ctx(
++  shlibctx = ctx(
+     features     = 'c cshlib pyext',
+     source       = ['cairomodule.c',
+                     'context.c',
+@@ -34,6 +34,16 @@
+     install_path = pycairoLibDir,
+     )
+ 
++  # Remove all -arch flags; apparently we know better than waf what architecture
++  # we should be building for
++  for var in ['CFLAGS_PYEMBED', 'CFLAGS_PYEXT', 'CXXFLAGS_PYEMBED',
++    'CXXFLAGS_PYEXT', 'LINKFLAGS_PYEMBED', 'LINKFLAGS_PYEXT']:
++    newvar = []
++    for ix, arg in enumerate(shlibctx.env[var]):
++      if '-arch' not in (arg, shlibctx.env[var][ix - 1]):
++        newvar.append(arg)
++    shlibctx.env[var] = newvar
++
+   # C API
+   ctx.install_files(os.path.join(ctx.env['PREFIX'], 'include', 'pycairo'),
+                     'pycairo.h')


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]