[106405] trunk/dports/devel/boost

mmoll at macports.org mmoll at macports.org
Fri May 24 16:18:12 PDT 2013


Revision: 106405
          https://trac.macports.org/changeset/106405
Author:   mmoll at macports.org
Date:     2013-05-24 16:18:12 -0700 (Fri, 24 May 2013)
Log Message:
-----------
devel/boost: add patch that fixes conflict between openmpi and python3X variants. closes #39193

Modified Paths:
--------------
    trunk/dports/devel/boost/Portfile

Added Paths:
-----------
    trunk/dports/devel/boost/files/patch-boost-python3.diff

Modified: trunk/dports/devel/boost/Portfile
===================================================================
--- trunk/dports/devel/boost/Portfile	2013-05-24 23:15:48 UTC (rev 106404)
+++ trunk/dports/devel/boost/Portfile	2013-05-24 23:18:12 UTC (rev 106405)
@@ -171,10 +171,12 @@
     set v [string index ${s} 0].[string index ${s} 1]
     set i [lsearch -exact ${pythons_ports} ${p}]
     set c [lreplace ${pythons_ports} ${i} ${i}]
-    # python 3k conflicts with openmpi (https://svn.boost.org/trac/boost/ticket/4657)
-    if { ${s} > 30 } { set o "openmpi" } else { set o "" }
+    # patch for boost.python from
+    # https://raw.github.com/archlinuxarm/PKGBUILDs/master/extra/boost/boost-1.53.0-python3.patch
+    # see also https://svn.boost.org/trac/boost/ticket/4657)
+    if { ${s} > 30 } { set bppatch "patch-boost-python3.diff" } else { set bppatch "" }
     eval [subst {
-        variant ${p} description "Build Boost.Python for Python ${v}" conflicts ${c} ${o} debug {
+        variant ${p} description "Build Boost.Python for Python ${v}" conflicts ${c} debug {
 
             # There is a conflict with python and debug support, so we should really change the 'variant' line above
             # to end with "conflicts ${c} debug" above. However, we leave it enabled for those who want to try it.
@@ -185,7 +187,7 @@
             configure.args-delete   --without-libraries=python
             configure.args-append   --with-python=${prefix}/bin/python${v}
 
-            patchfiles-append   patch-tools-build-v2-tools-python.jam.diff \
+            patchfiles-append   ${bppatch} patch-tools-build-v2-tools-python.jam.diff \
                                 patch-tools-build-v2-tools-python-2.jam.diff
 
             post-patch {
@@ -225,8 +227,7 @@
 
 variant openmpi conflicts debug description {Build Boost.MPI} {
 
-    # There is a conflict with python and debug support, so we should really change the 'variant' line above
-    # to end with "conflicts debug" above. However, we leave it enabled for those who want to try it.
+    # There is a conflict with debug support.
     # The issue has been reported to both the MacPorts team and the boost team, as per:
     # <http://trac.macports.org/ticket/23667> and <https://svn.boost.org/trac/boost/ticket/4461>
 

Added: trunk/dports/devel/boost/files/patch-boost-python3.diff
===================================================================
--- trunk/dports/devel/boost/files/patch-boost-python3.diff	                        (rev 0)
+++ trunk/dports/devel/boost/files/patch-boost-python3.diff	2013-05-24 23:18:12 UTC (rev 106405)
@@ -0,0 +1,96 @@
+diff -Naur libs/mpi/src/python/datatypes.cpp libs/mpi/src/python/datatypes.cpp
+--- libs/mpi/src/python/datatypes.cpp	2007-11-25 13:38:02.000000000 -0500
++++ libs/mpi/src/python/datatypes.cpp	2013-03-11 20:59:57.171732691 -0400
+@@ -13,6 +13,10 @@
+ #include <boost/mpi/python/serialize.hpp>
+ #include <boost/mpi.hpp>
+ 
++#if PY_MAJOR_VERSION >= 3
++#define PyInt_Type PyLong_Type
++#endif
++
+ namespace boost { namespace mpi { namespace python {
+ 
+ void export_datatypes()
+diff -Naur libs/mpi/src/python/py_environment.cpp libs/mpi/src/python/py_environment.cpp
+--- libs/mpi/src/python/py_environment.cpp	2007-11-25 13:38:02.000000000 -0500
++++ libs/mpi/src/python/py_environment.cpp	2013-03-11 21:02:12.961737401 -0400
+@@ -11,6 +11,9 @@
+  *  This file reflects the Boost.MPI "environment" class into Python
+  *  methods at module level.
+  */
++
++#include <locale>
++#include <string>
+ #include <boost/python.hpp>
+ #include <boost/mpi.hpp>
+ 
+@@ -50,11 +53,65 @@
+ 
+   // If anything changed, convert C-style argc/argv into Python argv
+   if (mpi_argv != my_argv)
++  {
++#if PY_MAJOR_VERSION >= 3
++    // Code stolen from py3k/Modules/python.c.
++
++    wchar_t **argv_copy = (wchar_t **)PyMem_Malloc(sizeof(wchar_t*)*mpi_argc);
++    /* We need a second copies, as Python might modify the first one. */
++    wchar_t **argv_copy2 = (wchar_t **)PyMem_Malloc(sizeof(wchar_t*)*mpi_argc);
++
++    if (!argv_copy || !argv_copy2) {
++      fprintf(stderr, "out of memory\n");
++      return false;
++    }
++
++    std::locale mylocale;
++    mbstate_t mystate;
++
++    const std::codecvt<char, wchar_t, mbstate_t>& myfacet =
++      std::use_facet<std::codecvt<char, wchar_t, mbstate_t> >(mylocale);
++
++    for (int i = 0; i < mpi_argc; i++) 
++    {
++      size_t length = strlen(mpi_argv[i]);
++
++      wchar_t *dest = (wchar_t *) PyMem_Malloc(sizeof(wchar_t) * (length + 1));
++
++      const char *from_next;
++      wchar_t *to_next;
++
++      std::codecvt<wchar_t,char,mbstate_t>::result myresult = 
++        myfacet.out(mystate,
++            mpi_argv[i], mpi_argv[i] + length + 1, from_next,
++            dest, dest+length+1, to_next);
++
++      if (myresult != std::codecvt<wchar_t,char,mbstate_t>::ok )
++      {
++        fprintf(stderr, "failure translating argv\n");
++        return 1;
++      }
++
++      argv_copy2[i] = argv_copy[i] = dest;
++      if (!argv_copy[i])
++          return false;
++    }
++
++    PySys_SetArgv(mpi_argc, argv_copy);
++
++    for (int i = 0; i < mpi_argc; i++) {
++        PyMem_Free(argv_copy2[i]);
++    }
++    PyMem_Free(argv_copy);
++    PyMem_Free(argv_copy2);
++#else
+     PySys_SetArgv(mpi_argc, mpi_argv);
++#endif
++  }
+ 
+-  for (int arg = 0; arg < my_argc; ++arg)
+-    free(my_argv[arg]);
+-  delete [] my_argv;
++  for (int arg = 0; arg < mpi_argc; ++arg)
++    free(mpi_argv[arg]);
++  delete [] mpi_argv;
+ 
+   return true;
+ }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20130524/54345f6b/attachment.html>


More information about the macports-changes mailing list