From 814e960d379ec38ab32c161e4028fde66bab0dd9 Mon Sep 17 00:00:00 2001 From: Ross Burton Date: Fri, 24 Mar 2017 16:09:19 +0000 Subject: 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 Signed-off-by: Richard Purdie --- meta/recipes-support/boost/boost.inc | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) (limited to 'meta/recipes-support/boost/boost.inc') 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" PACKAGECONFIG[locale] = ",,icu" PACKAGECONFIG[graph_parallel] = ",,,boost-mpi mpich" PACKAGECONFIG[mpi] = ",,mpich" -PACKAGECONFIG[python] = ",,python python3" +PACKAGECONFIG[python] = ",,python3" BOOST_LIBS += "\ - ${@bb.utils.filter('PACKAGECONFIG', 'locale', d)} \ + ${@bb.utils.filter('PACKAGECONFIG', 'locale python', d)} \ ${@bb.utils.contains('PACKAGECONFIG', 'graph_parallel', 'graph_parallel mpi', \ bb.utils.filter('PACKAGECONFIG', 'mpi', d), d)} \ - ${@bb.utils.contains('PACKAGECONFIG', 'python', 'python python3', '', d)} \ " -inherit python-dir +inherit python3-dir PYTHON_ROOT = "${STAGING_DIR_HOST}/${prefix}" # Make a package for each library, plus -dev @@ -59,19 +58,12 @@ PACKAGES = "${PN}-dbg ${BOOST_PACKAGES}" python __anonymous () { packages = [] extras = [] - for lib in d.getVar('BOOST_LIBS').split( ): - # BJAM does not know '--with-python3' (only --with-python) - if lib != "python3": - extras.append("--with-%s" % lib) + for lib in d.getVar('BOOST_LIBS').split(): + extras.append("--with-%s" % lib) pkg = "boost-%s" % lib.replace("_", "-") packages.append(pkg) - if lib == "python": - # special: python*.so matches python3.so !! - if not d.getVar("FILES_%s" % pkg): - d.setVar("FILES_%s" % pkg, "${libdir}/libboost_%s.so.*" % lib) - else: - if not d.getVar("FILES_%s" % pkg): - d.setVar("FILES_%s" % pkg, "${libdir}/libboost_%s*.so.*" % lib) + if not d.getVar("FILES_%s" % pkg): + d.setVar("FILES_%s" % pkg, "${libdir}/libboost_%s*.so.*" % lib) d.setVar("BOOST_PACKAGES", " ".join(packages)) d.setVar("BJAM_EXTRA", " ".join(extras)) } @@ -186,15 +178,21 @@ do_configure() { # D2194:Fixing the failure of "error: duplicate initialization of gcc with the following parameters" during compilation. rm -f ${WORKDIR}/user-config.jam echo 'using gcc : 4.3.1 : ${CXX} : "${CFLAGS}" "${CXXFLAGS}" "${LDFLAGS}" ;' >> ${WORKDIR}/user-config.jam - echo "using python : ${PYTHON_BASEVERSION} : : ${STAGING_INCDIR}/python${PYTHON_BASEVERSION} ;" >> ${WORKDIR}/user-config.jam - echo "using python : 3.5 : : ${STAGING_INCDIR}/python3.5m ;" >> ${WORKDIR}/user-config.jam + + # If we want Python then we need to tell Boost *exactly* where to find it + if ${@bb.utils.contains('BOOST_LIBS', 'python', 'true', 'false', d)}; then + 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 + fi if ${@bb.utils.contains('BOOST_LIBS', 'mpi', 'true', 'false', d)}; then echo "using mpi : : mpi ;" >> ${WORKDIR}/user-config.jam fi - CC="${BUILD_CC}" CFLAGS="${BUILD_CFLAGS}" ./bootstrap.sh --with-bjam=bjam --with-toolset=gcc --with-python-root=${PYTHON_ROOT} - sed -i '/^using python/d' ${S}/project-config.jam + CC="${BUILD_CC}" CFLAGS="${BUILD_CFLAGS}" ./bootstrap.sh --with-bjam=bjam --with-toolset=gcc + + # Boost can't be trusted to find Python on it's own, so remove any mention + # of it from the boost configuration + sed -i '/using python/d' ${S}/project-config.jam } do_compile() { -- cgit v1.2.3-54-g00ecf