summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2012-04-23 22:46:42 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-04-23 23:02:21 +0100
commit20e2761e1da1cb5dcd267e161f2a6b6a429e9f39 (patch)
treeb992866b21af00dd189d7092a2d3797b9c7d7aa5
parent4697911991caa2f2a21dd43f54e0c4404d722873 (diff)
downloadopenembedded-core-20e2761e1da1cb5dcd267e161f2a6b6a429e9f39.tar.gz
openembedded-core-20e2761e1da1cb5dcd267e161f2a6b6a429e9f39.tar.bz2
openembedded-core-20e2761e1da1cb5dcd267e161f2a6b6a429e9f39.zip
python: Fix various contamination issues leading to broken/missing c modules
The move of libcrypto to /lib instead of /usr/lib has broken the _hashlib module compilation. There were also a number of other failing modules which should have been building correctly. This turned out partly to be the /lib issue but also due to a number of native paths creeping into compiler commandlines. These changes add in /lib as part of the searh directory and remove a number of host contamination issues within setup.py. Post release we should really further go through this file and just delete large sections of it as its hard to be sure what strange paths python is injecting as search paths. This patch also fixes issues where re-execution of the compile task would corrupt the Makefile in various ways, again leading to puzzling paths within the configuration. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-devtools/python/python/01-use-proper-tools-for-cross-build.patch4
-rw-r--r--meta/recipes-devtools/python/python/setuptweaks.patch57
-rw-r--r--meta/recipes-devtools/python/python_2.7.2.bb22
3 files changed, 76 insertions, 7 deletions
diff --git a/meta/recipes-devtools/python/python/01-use-proper-tools-for-cross-build.patch b/meta/recipes-devtools/python/python/01-use-proper-tools-for-cross-build.patch
index 27afc030b2..691beada03 100644
--- a/meta/recipes-devtools/python/python/01-use-proper-tools-for-cross-build.patch
+++ b/meta/recipes-devtools/python/python/01-use-proper-tools-for-cross-build.patch
@@ -119,8 +119,8 @@ Index: Python-2.7.2/setup.py
# XXX Omitted modules: gl, pure, dl, SGI-specific modules
-+ lib_dirs = [ os.getenv( "STAGING_LIBDIR" ) ]
-+ inc_dirs = [ os.getenv( "STAGING_INCDIR" ) ]
++ lib_dirs = [ os.getenv("STAGING_LIBDIR"), os.getenv("STAGING_BASELIBDIR") ]
++ inc_dirs = [ os.getenv("STAGING_INCDIR") ]
+
#
# The following modules are all pretty straightforward, and compile
diff --git a/meta/recipes-devtools/python/python/setuptweaks.patch b/meta/recipes-devtools/python/python/setuptweaks.patch
new file mode 100644
index 0000000000..c34ef160d3
--- /dev/null
+++ b/meta/recipes-devtools/python/python/setuptweaks.patch
@@ -0,0 +1,57 @@
+This patch removes various ways native system options can pass into the python
+compilation and somehow break C modules.
+
+Upstream-Status: Configuration [OE Specific]
+
+RP 2012/04/23
+
+Index: Python-2.7.2/setup.py
+===================================================================
+--- Python-2.7.2.orig/setup.py 2012-04-23 20:03:47.295582553 +0000
++++ Python-2.7.2/setup.py 2012-04-23 20:03:15.000000000 +0000
+@@ -231,7 +231,13 @@
+ # compilers
+ if compiler is not None:
+ (ccshared,cflags) = sysconfig.get_config_vars('CCSHARED','CFLAGS')
+- args['compiler_so'] = compiler + ' ' + ccshared + ' ' + cflags
++ # Need to filter out -isysroot from the flags. Ideally should
++ # figure out target flags here.
++ flags = []
++ for f in cflags.split():
++ if not f.startswith("-isystem"):
++ flags.append(f)
++ args['compiler_so'] = compiler + ' ' + ccshared + ' ' + ' '.join(flags)
+ self.compiler.set_executables(**args)
+
+ build_ext.build_extensions(self)
+@@ -393,7 +399,6 @@
+ # into configure and stored in the Makefile (issue found on OS X 10.3).
+ for env_var, arg_name, dir_list in (
+ ('LDFLAGS', '-R', self.compiler.runtime_library_dirs),
+- ('LDFLAGS', '-L', self.compiler.library_dirs),
+ ('CPPFLAGS', '-I', self.compiler.include_dirs)):
+ env_val = sysconfig.get_config_var(env_var)
+ if env_val:
+@@ -419,16 +424,16 @@
+ for directory in reversed(options.dirs):
+ add_dir_to_list(dir_list, directory)
+
+- if os.path.normpath(sys.prefix) != '/usr' \
+- and not sysconfig.get_config_var('PYTHONFRAMEWORK'):
++# if os.path.normpath(sys.prefix) != '/usr' \
++# and not sysconfig.get_config_var('PYTHONFRAMEWORK'):
+ # OSX note: Don't add LIBDIR and INCLUDEDIR to building a framework
+ # (PYTHONFRAMEWORK is set) to avoid # linking problems when
+ # building a framework with different architectures than
+ # the one that is currently installed (issue #7473)
+- add_dir_to_list(self.compiler.library_dirs,
+- sysconfig.get_config_var("LIBDIR"))
+- add_dir_to_list(self.compiler.include_dirs,
+- sysconfig.get_config_var("INCLUDEDIR"))
++# add_dir_to_list(self.compiler.library_dirs,
++# sysconfig.get_config_var("LIBDIR"))
++# add_dir_to_list(self.compiler.include_dirs,
++# sysconfig.get_config_var("INCLUDEDIR"))
+
+ try:
+ have_unicode = unicode
diff --git a/meta/recipes-devtools/python/python_2.7.2.bb b/meta/recipes-devtools/python/python_2.7.2.bb
index 95e17a83d6..e067ba50fc 100644
--- a/meta/recipes-devtools/python/python_2.7.2.bb
+++ b/meta/recipes-devtools/python/python_2.7.2.bb
@@ -1,6 +1,6 @@
require python.inc
DEPENDS = "python-native bzip2 db gdbm openssl readline sqlite3 zlib"
-PR = "${INC_PR}.12"
+PR = "${INC_PR}.14"
DISTRO_SRC_URI ?= "file://sitecustomize.py"
DISTRO_SRC_URI_linuxstdbase = ""
@@ -21,6 +21,7 @@ SRC_URI += "\
file://host_include_contamination.patch \
file://sys_platform_is_now_always_linux2.patch \
file://fix_for_using_different_libdir.patch \
+ file://setuptweaks.patch \
"
S = "${WORKDIR}/Python-${PV}"
@@ -33,6 +34,7 @@ TARGET_CC_ARCH_append_armv6 = " -D__SOFTFP__"
TARGET_CC_ARCH_append_armv7a = " -D__SOFTFP__"
do_configure_prepend() {
+ rm -f ${S}/Makefile.orig
autoreconf -Wcross --verbose --install --force --exclude=autopoint Modules/_ctypes/libffi || bbnote "_ctypes failed to autoreconf"
}
@@ -65,10 +67,17 @@ do_compile() {
# remove any bogus LD_LIBRARY_PATH
sed -i -e s,RUNSHARED=.*,RUNSHARED=, Makefile
- install -m 0644 Makefile Makefile.orig
- sed -i -e 's,${includedir},${STAGING_INCDIR},' Makefile
- sed -i -e 's,${libdir},${STAGING_LIBDIR},' Makefile
- sed -i -e 's,LDFLAGS=,LDFLAGS=-L. -L${STAGING_LIBDIR},' Makefile
+ if [ ! -f Makefile.orig ]; then
+ install -m 0644 Makefile Makefile.orig
+ fi
+ sed -i -e 's,^LDFLAGS=.*,LDFLAGS=-L. -L${STAGING_LIBDIR},g' \
+ -e 's,libdir=${libdir},libdir=${STAGING_LIBDIR},g' \
+ -e 's,libexecdir=${libexecdir},libexecdir=${STAGING_DIR_HOST}${libexecdir},g' \
+ -e 's,^LIBDIR=.*,LIBDIR=${STAGING_LIBDIR},g' \
+ -e 's,includedir=${includedir},includedir=${STAGING_INCDIR},g' \
+ -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
@@ -79,6 +88,7 @@ do_compile() {
oe_runmake HOSTPGEN=${STAGING_BINDIR_NATIVE}/pgen \
HOSTPYTHON=${STAGING_BINDIR_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
@@ -89,6 +99,7 @@ do_compile() {
HOSTPYTHON=${STAGING_BINDIR_NATIVE}/python \
STAGING_LIBDIR=${STAGING_LIBDIR} \
STAGING_INCDIR=${STAGING_INCDIR} \
+ STAGING_BASELIBDIR=${STAGING_BASELIBDIR} \
BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \
OPT="${CFLAGS}"
}
@@ -105,6 +116,7 @@ do_install() {
CROSSPYTHONPATH=${STAGING_LIBDIR_NATIVE}/python${PYTHON_MAJMIN}/lib-dynload/ \
STAGING_LIBDIR=${STAGING_LIBDIR} \
STAGING_INCDIR=${STAGING_INCDIR} \
+ STAGING_BASELIBDIR=${STAGING_BASELIBDIR} \
BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \
DESTDIR=${D} LIBDIR=${libdir} install