diff options
author | Ross Burton <ross.burton@intel.com> | 2017-03-24 16:09:19 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-03-27 08:15:06 +0100 |
commit | 814e960d379ec38ab32c161e4028fde66bab0dd9 (patch) | |
tree | b02e5d3a24dd78b37416b5496fde3c6481165107 /meta/recipes-support/boost/boost.inc | |
parent | d51913264f47dc8140fc3519963c0663807ae277 (diff) | |
download | poky-814e960d379ec38ab32c161e4028fde66bab0dd9.tar.gz |
boost: port boost-python to Python 3
As Python 3 is the default Python version, change Boost to build against Python
3 instead of Python 2 if enabled. It's not simple to support both, so this
means that support for building boost-python against Python 2 has been removed.
This involves backporting a number of patches upstream to fix Python 3 support,
and telling Boost precisely where to find the Python headers and libraries so
that it doesn't try to invoke the host Python to determine these values.
[ YOCTO #11104 ]
(From OE-Core rev: 0f5418eb0ce12811b16d2e3c28c28140a509f685)
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-support/boost/boost.inc')
-rw-r--r-- | meta/recipes-support/boost/boost.inc | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/meta/recipes-support/boost/boost.inc b/meta/recipes-support/boost/boost.inc index 87b6b884f2..dcadcbcc42 100644 --- a/meta/recipes-support/boost/boost.inc +++ b/meta/recipes-support/boost/boost.inc | |||
@@ -42,16 +42,15 @@ PACKAGECONFIG ??= "locale" | |||
42 | PACKAGECONFIG[locale] = ",,icu" | 42 | PACKAGECONFIG[locale] = ",,icu" |
43 | PACKAGECONFIG[graph_parallel] = ",,,boost-mpi mpich" | 43 | PACKAGECONFIG[graph_parallel] = ",,,boost-mpi mpich" |
44 | PACKAGECONFIG[mpi] = ",,mpich" | 44 | PACKAGECONFIG[mpi] = ",,mpich" |
45 | PACKAGECONFIG[python] = ",,python python3" | 45 | PACKAGECONFIG[python] = ",,python3" |
46 | 46 | ||
47 | BOOST_LIBS += "\ | 47 | BOOST_LIBS += "\ |
48 | ${@bb.utils.filter('PACKAGECONFIG', 'locale', d)} \ | 48 | ${@bb.utils.filter('PACKAGECONFIG', 'locale python', d)} \ |
49 | ${@bb.utils.contains('PACKAGECONFIG', 'graph_parallel', 'graph_parallel mpi', \ | 49 | ${@bb.utils.contains('PACKAGECONFIG', 'graph_parallel', 'graph_parallel mpi', \ |
50 | bb.utils.filter('PACKAGECONFIG', 'mpi', d), d)} \ | 50 | bb.utils.filter('PACKAGECONFIG', 'mpi', d), d)} \ |
51 | ${@bb.utils.contains('PACKAGECONFIG', 'python', 'python python3', '', d)} \ | ||
52 | " | 51 | " |
53 | 52 | ||
54 | inherit python-dir | 53 | inherit python3-dir |
55 | PYTHON_ROOT = "${STAGING_DIR_HOST}/${prefix}" | 54 | PYTHON_ROOT = "${STAGING_DIR_HOST}/${prefix}" |
56 | 55 | ||
57 | # Make a package for each library, plus -dev | 56 | # Make a package for each library, plus -dev |
@@ -59,19 +58,12 @@ PACKAGES = "${PN}-dbg ${BOOST_PACKAGES}" | |||
59 | python __anonymous () { | 58 | python __anonymous () { |
60 | packages = [] | 59 | packages = [] |
61 | extras = [] | 60 | extras = [] |
62 | for lib in d.getVar('BOOST_LIBS').split( ): | 61 | for lib in d.getVar('BOOST_LIBS').split(): |
63 | # BJAM does not know '--with-python3' (only --with-python) | 62 | extras.append("--with-%s" % lib) |
64 | if lib != "python3": | ||
65 | extras.append("--with-%s" % lib) | ||
66 | pkg = "boost-%s" % lib.replace("_", "-") | 63 | pkg = "boost-%s" % lib.replace("_", "-") |
67 | packages.append(pkg) | 64 | packages.append(pkg) |
68 | if lib == "python": | 65 | if not d.getVar("FILES_%s" % pkg): |
69 | # special: python*.so matches python3.so !! | 66 | d.setVar("FILES_%s" % pkg, "${libdir}/libboost_%s*.so.*" % lib) |
70 | if not d.getVar("FILES_%s" % pkg): | ||
71 | d.setVar("FILES_%s" % pkg, "${libdir}/libboost_%s.so.*" % lib) | ||
72 | else: | ||
73 | if not d.getVar("FILES_%s" % pkg): | ||
74 | d.setVar("FILES_%s" % pkg, "${libdir}/libboost_%s*.so.*" % lib) | ||
75 | d.setVar("BOOST_PACKAGES", " ".join(packages)) | 67 | d.setVar("BOOST_PACKAGES", " ".join(packages)) |
76 | d.setVar("BJAM_EXTRA", " ".join(extras)) | 68 | d.setVar("BJAM_EXTRA", " ".join(extras)) |
77 | } | 69 | } |
@@ -186,15 +178,21 @@ do_configure() { | |||
186 | # D2194:Fixing the failure of "error: duplicate initialization of gcc with the following parameters" during compilation. | 178 | # D2194:Fixing the failure of "error: duplicate initialization of gcc with the following parameters" during compilation. |
187 | rm -f ${WORKDIR}/user-config.jam | 179 | rm -f ${WORKDIR}/user-config.jam |
188 | echo 'using gcc : 4.3.1 : ${CXX} : <cflags>"${CFLAGS}" <cxxflags>"${CXXFLAGS}" <linkflags>"${LDFLAGS}" ;' >> ${WORKDIR}/user-config.jam | 180 | echo 'using gcc : 4.3.1 : ${CXX} : <cflags>"${CFLAGS}" <cxxflags>"${CXXFLAGS}" <linkflags>"${LDFLAGS}" ;' >> ${WORKDIR}/user-config.jam |
189 | echo "using python : ${PYTHON_BASEVERSION} : : ${STAGING_INCDIR}/python${PYTHON_BASEVERSION} ;" >> ${WORKDIR}/user-config.jam | 181 | |
190 | echo "using python : 3.5 : : ${STAGING_INCDIR}/python3.5m ;" >> ${WORKDIR}/user-config.jam | 182 | # If we want Python then we need to tell Boost *exactly* where to find it |
183 | if ${@bb.utils.contains('BOOST_LIBS', 'python', 'true', 'false', d)}; then | ||
184 | echo "using python : ${PYTHON_BASEVERSION} : ${STAGING_DIR_HOST}${bindir}/python3 : ${STAGING_DIR_HOST}${includedir}/${PYTHON_DIR}${PYTHON_ABI} : ${STAGING_DIR_HOST}${libdir}/${PYTHON_DIR} ;" >> ${WORKDIR}/user-config.jam | ||
185 | fi | ||
191 | 186 | ||
192 | if ${@bb.utils.contains('BOOST_LIBS', 'mpi', 'true', 'false', d)}; then | 187 | if ${@bb.utils.contains('BOOST_LIBS', 'mpi', 'true', 'false', d)}; then |
193 | echo "using mpi : : <find-shared-library>mpi ;" >> ${WORKDIR}/user-config.jam | 188 | echo "using mpi : : <find-shared-library>mpi ;" >> ${WORKDIR}/user-config.jam |
194 | fi | 189 | fi |
195 | 190 | ||
196 | CC="${BUILD_CC}" CFLAGS="${BUILD_CFLAGS}" ./bootstrap.sh --with-bjam=bjam --with-toolset=gcc --with-python-root=${PYTHON_ROOT} | 191 | CC="${BUILD_CC}" CFLAGS="${BUILD_CFLAGS}" ./bootstrap.sh --with-bjam=bjam --with-toolset=gcc |
197 | sed -i '/^using python/d' ${S}/project-config.jam | 192 | |
193 | # Boost can't be trusted to find Python on it's own, so remove any mention | ||
194 | # of it from the boost configuration | ||
195 | sed -i '/using python/d' ${S}/project-config.jam | ||
198 | } | 196 | } |
199 | 197 | ||
200 | do_compile() { | 198 | do_compile() { |