python: Resolve intermediate staging issues

Its bad practise to poke into the sysroot without knowledge of sstate.

This adds a patch to python allowing us to account for cross compiling
and allow it to find the Makefile/pyconfig.h files without needing them
in the sysroot for do_compile/do_install to complete.

Tested on two architectures and compared with buildhistory with no
significant delta.

(From OE-Core rev: 16da4f75a75dc8020803df9ea73a2a7ead88cc5a)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie
2012-11-14 14:31:24 +00:00
parent dadb3a7fa7
commit 89bc43e1b2
3 changed files with 59 additions and 22 deletions

View File

@@ -27,6 +27,7 @@ SRC_URI += "\
file://avoid_warning_for_sunos_specific_module.patch \
file://python-2.7.3-berkeley-db-5.3.patch \
file://python-2.7.3-remove-bsdb-rpath.patch \
file://builddir.patch \
"
S = "${WORKDIR}/Python-${PV}"
@@ -55,17 +56,6 @@ do_compile() {
sed -e 's,${STAGING_DIR_HOST},,g' -i *.py
cd -
#
# Copy config.h and an appropriate Makefile for distutils.sysconfig,
# which laters uses the information out of these to compile extensions
#
# The following part (until python compilation) should probably moved to an
# -initial recipe to handle staging better
#
install -d ${STAGING_INCDIR}/python${PYTHON_MAJMIN}/
install -d ${STAGING_LIBDIR}/python${PYTHON_MAJMIN}/config/
install -m 0644 pyconfig.h ${STAGING_INCDIR}/python${PYTHON_MAJMIN}/
# remove hardcoded ccache, see http://bugs.openembedded.net/show_bug.cgi?id=4144
sed -i -e s,ccache,'$(CCACHE)', Makefile
@@ -83,22 +73,12 @@ do_compile() {
-e 's,^INCLUDEDIR=.*,INCLUDE=${STAGING_INCDIR},g' \
-e 's,^CONFINCLUDEDIR=.*,CONFINCLUDE=${STAGING_INCDIR},g' \
Makefile
install -m 0644 Makefile ${STAGING_LIBDIR}/python${PYTHON_MAJMIN}/config/
# save copy of it now, because if we do it in do_install and
# then call do_install twice we get Makefile.orig == Makefile.sysroot
install -m 0644 Makefile Makefile.sysroot
export CROSS_COMPILE="${TARGET_PREFIX}"
oe_runmake HOSTPGEN=${STAGING_BINDIR_NATIVE}/python-native/pgen \
HOSTPYTHON=${STAGING_BINDIR_NATIVE}/python-native/python \
STAGING_LIBDIR=${STAGING_LIBDIR} \
STAGING_BASELIBDIR=${STAGING_BASELIBDIR} \
STAGING_INCDIR=${STAGING_INCDIR} \
BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \
OPT="${CFLAGS}" libpython${PYTHON_MAJMIN}.so
oe_libinstall -so libpython${PYTHON_MAJMIN} ${STAGING_LIBDIR}
export PYTHONBUILDDIR="${S}"
oe_runmake HOSTPGEN=${STAGING_BINDIR_NATIVE}/python-native/pgen \
HOSTPYTHON=${STAGING_BINDIR_NATIVE}/python-native/python \
@@ -115,6 +95,7 @@ do_install() {
install -m 0644 Makefile.orig Makefile
export CROSS_COMPILE="${TARGET_PREFIX}"
export PYTHONBUILDDIR="${S}"
oe_runmake HOSTPGEN=${STAGING_BINDIR_NATIVE}/python-native/pgen \
HOSTPYTHON=${STAGING_BINDIR_NATIVE}/python-native/python \