diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2016-11-14 17:16:42 +0200 |
---|---|---|
committer | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2017-05-17 15:02:56 +0300 |
commit | 8c2657c8418184b3af62f81f8a15dfb37d95dea5 (patch) | |
tree | 030ea37e2d42949480460642c9688a801d9b8cd4 /meta/recipes-devtools/python/python3_3.5.2.bb | |
parent | 25a92206c4cc59a6fe7c24c17ed39f21b2612d2b (diff) | |
download | openembedded-core-contrib-8c2657c8418184b3af62f81f8a15dfb37d95dea5.tar.gz |
python3: add python3-profile-opt recipe
This patch adds a new recipe that builds a special version of python3 that
produces profile data used for optimization. The new recipe directly includes
the base python recipe so that they are build in as similar way as possible and
this hopefully decreases the recipe maintenance burden, too. Also, its files
clash with the "normal" python3 so they cannot be installed in an image at the
same time.
Normally, profile-guided-optimization in Python is done simply by doing "make
profile-opt" which first builds python with profile instrumentation enabled,
then runs a profile task to get the profile data, and last, re-builds python
with profile data guiding the optimization. However, in our cross-build
environment this gets a lot trickier. We need to split out the steps as
building is done on the build host but we need to run the second step (i.e. run
the profile task) on the target hardware. This patch enables the first step,
i.e. building python with profile instrumentation enabled
[YOCTO #9338]
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'meta/recipes-devtools/python/python3_3.5.2.bb')
-rw-r--r-- | meta/recipes-devtools/python/python3_3.5.2.bb | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/meta/recipes-devtools/python/python3_3.5.2.bb b/meta/recipes-devtools/python/python3_3.5.2.bb index 7f2bc7186f..97ecbab5e3 100644 --- a/meta/recipes-devtools/python/python3_3.5.2.bb +++ b/meta/recipes-devtools/python/python3_3.5.2.bb @@ -112,14 +112,10 @@ do_compile() { # then call do_install twice we get Makefile.orig == Makefile.sysroot install -m 0644 Makefile Makefile.sysroot - oe_runmake HOSTPGEN=${STAGING_BINDIR_NATIVE}/python3-native/pgen \ - HOSTPYTHON=${STAGING_BINDIR_NATIVE}/python3-native/python3 \ - STAGING_LIBDIR=${STAGING_LIBDIR} \ - STAGING_BASELIBDIR=${STAGING_BASELIBDIR} \ - STAGING_INCDIR=${STAGING_INCDIR} \ - LIB=${baselib} \ - ARCH=${TARGET_ARCH} \ - OPT="${CFLAGS}" libpython3.so + if [ "${PYTHON3_MAKE_TARGET}" = "build_all_generate_profile" ]; then + # This is only used in PGO profiling by python3-profile-opt package + export EXTRA_CFLAGS="-fprofile-dir=./python3-pgo-profiles/" + fi oe_runmake HOSTPGEN=${STAGING_BINDIR_NATIVE}/python3-native/pgen \ HOSTPYTHON=${STAGING_BINDIR_NATIVE}/python3-native/python3 \ @@ -128,7 +124,7 @@ do_compile() { STAGING_BASELIBDIR=${STAGING_BASELIBDIR} \ LIB=${baselib} \ ARCH=${TARGET_ARCH} \ - OPT="${CFLAGS}" + OPT="${CFLAGS}" ${PYTHON3_MAKE_TARGET} } do_install() { @@ -148,8 +144,14 @@ do_install() { STAGING_BASELIBDIR=${STAGING_BASELIBDIR} \ LIB=${baselib} \ ARCH=${TARGET_ARCH} \ - DESTDIR=${D} LIBDIR=${libdir} + DESTDIR=${D} LIBDIR=${libdir} ${PYTHON3_MAKE_TARGET} + if [ "${PYTHON3_MAKE_TARGET}" = "build_all_generate_profile" ]; then + # Need special make install if pgo generation is enabled + _PYTHON3_MAKE_INSTALL_TARGET="install_generate_profile" + else + _PYTHON3_MAKE_INSTALL_TARGET="install" + fi oe_runmake HOSTPGEN=${STAGING_BINDIR_NATIVE}/python3-native/pgen \ HOSTPYTHON=${STAGING_BINDIR_NATIVE}/python3-native/python3 \ STAGING_LIBDIR=${STAGING_LIBDIR} \ @@ -157,7 +159,7 @@ do_install() { STAGING_BASELIBDIR=${STAGING_BASELIBDIR} \ LIB=${baselib} \ ARCH=${TARGET_ARCH} \ - DESTDIR=${D} LIBDIR=${libdir} install + DESTDIR=${D} LIBDIR=${libdir} ${_PYTHON3_MAKE_INSTALL_TARGET} # avoid conflict with 2to3 from Python 2 rm -f ${D}/${bindir}/2to3 @@ -206,9 +208,9 @@ PACKAGES =+ "${PN}-pyvenv" FILES_${PN}-pyvenv += "${bindir}/pyvenv-${PYTHON_MAJMIN} ${bindir}/pyvenv" # package libpython3 -PACKAGES =+ "libpython3 libpython3-staticdev" -FILES_libpython3 = "${libdir}/libpython*.so.*" -FILES_libpython3-staticdev += "${libdir}/python${PYTHON_MAJMIN}/config-${PYTHON_BINABI}/libpython${PYTHON_BINABI}.a" +PACKAGES =+ "lib${BPN} lib${BPN}-staticdev" +FILES_lib${BPN} = "${libdir}/libpython*.so.*" +FILES_lib${BPN}-staticdev += "${libdir}/python${PYTHON_MAJMIN}/config-${PYTHON_BINABI}/libpython*.a" INSANE_SKIP_${PN}-dev += "dev-elf" # catch all the rest (unsorted) |