summaryrefslogtreecommitdiffstats
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:04:43 +0100
commit3639c6a19b2ba8f492e682595e5ac235ec9817ea (patch)
tree5b4fe8cc9ef4377efd38ade04e2d231a3be3fc60
parent1ee9588a9e0c020543600933937cc72c5dc62a38 (diff)
downloadpoky-3639c6a19b2ba8f492e682595e5ac235ec9817ea.tar.gz
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. (From OE-Core rev: 20e2761e1da1cb5dcd267e161f2a6b6a429e9f39) 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
119 119
120 # XXX Omitted modules: gl, pure, dl, SGI-specific modules 120 # XXX Omitted modules: gl, pure, dl, SGI-specific modules
121 121
122+ lib_dirs = [ os.getenv( "STAGING_LIBDIR" ) ] 122+ lib_dirs = [ os.getenv("STAGING_LIBDIR"), os.getenv("STAGING_BASELIBDIR") ]
123+ inc_dirs = [ os.getenv( "STAGING_INCDIR" ) ] 123+ inc_dirs = [ os.getenv("STAGING_INCDIR") ]
124+ 124+
125 # 125 #
126 # The following modules are all pretty straightforward, and compile 126 # 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 @@
1This patch removes various ways native system options can pass into the python
2compilation and somehow break C modules.
3
4Upstream-Status: Configuration [OE Specific]
5
6RP 2012/04/23
7
8Index: Python-2.7.2/setup.py
9===================================================================
10--- Python-2.7.2.orig/setup.py 2012-04-23 20:03:47.295582553 +0000
11+++ Python-2.7.2/setup.py 2012-04-23 20:03:15.000000000 +0000
12@@ -231,7 +231,13 @@
13 # compilers
14 if compiler is not None:
15 (ccshared,cflags) = sysconfig.get_config_vars('CCSHARED','CFLAGS')
16- args['compiler_so'] = compiler + ' ' + ccshared + ' ' + cflags
17+ # Need to filter out -isysroot from the flags. Ideally should
18+ # figure out target flags here.
19+ flags = []
20+ for f in cflags.split():
21+ if not f.startswith("-isystem"):
22+ flags.append(f)
23+ args['compiler_so'] = compiler + ' ' + ccshared + ' ' + ' '.join(flags)
24 self.compiler.set_executables(**args)
25
26 build_ext.build_extensions(self)
27@@ -393,7 +399,6 @@
28 # into configure and stored in the Makefile (issue found on OS X 10.3).
29 for env_var, arg_name, dir_list in (
30 ('LDFLAGS', '-R', self.compiler.runtime_library_dirs),
31- ('LDFLAGS', '-L', self.compiler.library_dirs),
32 ('CPPFLAGS', '-I', self.compiler.include_dirs)):
33 env_val = sysconfig.get_config_var(env_var)
34 if env_val:
35@@ -419,16 +424,16 @@
36 for directory in reversed(options.dirs):
37 add_dir_to_list(dir_list, directory)
38
39- if os.path.normpath(sys.prefix) != '/usr' \
40- and not sysconfig.get_config_var('PYTHONFRAMEWORK'):
41+# if os.path.normpath(sys.prefix) != '/usr' \
42+# and not sysconfig.get_config_var('PYTHONFRAMEWORK'):
43 # OSX note: Don't add LIBDIR and INCLUDEDIR to building a framework
44 # (PYTHONFRAMEWORK is set) to avoid # linking problems when
45 # building a framework with different architectures than
46 # the one that is currently installed (issue #7473)
47- add_dir_to_list(self.compiler.library_dirs,
48- sysconfig.get_config_var("LIBDIR"))
49- add_dir_to_list(self.compiler.include_dirs,
50- sysconfig.get_config_var("INCLUDEDIR"))
51+# add_dir_to_list(self.compiler.library_dirs,
52+# sysconfig.get_config_var("LIBDIR"))
53+# add_dir_to_list(self.compiler.include_dirs,
54+# sysconfig.get_config_var("INCLUDEDIR"))
55
56 try:
57 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 @@
1require python.inc 1require python.inc
2DEPENDS = "python-native bzip2 db gdbm openssl readline sqlite3 zlib" 2DEPENDS = "python-native bzip2 db gdbm openssl readline sqlite3 zlib"
3PR = "${INC_PR}.12" 3PR = "${INC_PR}.14"
4 4
5DISTRO_SRC_URI ?= "file://sitecustomize.py" 5DISTRO_SRC_URI ?= "file://sitecustomize.py"
6DISTRO_SRC_URI_linuxstdbase = "" 6DISTRO_SRC_URI_linuxstdbase = ""
@@ -21,6 +21,7 @@ SRC_URI += "\
21 file://host_include_contamination.patch \ 21 file://host_include_contamination.patch \
22 file://sys_platform_is_now_always_linux2.patch \ 22 file://sys_platform_is_now_always_linux2.patch \
23 file://fix_for_using_different_libdir.patch \ 23 file://fix_for_using_different_libdir.patch \
24 file://setuptweaks.patch \
24" 25"
25 26
26S = "${WORKDIR}/Python-${PV}" 27S = "${WORKDIR}/Python-${PV}"
@@ -33,6 +34,7 @@ TARGET_CC_ARCH_append_armv6 = " -D__SOFTFP__"
33TARGET_CC_ARCH_append_armv7a = " -D__SOFTFP__" 34TARGET_CC_ARCH_append_armv7a = " -D__SOFTFP__"
34 35
35do_configure_prepend() { 36do_configure_prepend() {
37 rm -f ${S}/Makefile.orig
36 autoreconf -Wcross --verbose --install --force --exclude=autopoint Modules/_ctypes/libffi || bbnote "_ctypes failed to autoreconf" 38 autoreconf -Wcross --verbose --install --force --exclude=autopoint Modules/_ctypes/libffi || bbnote "_ctypes failed to autoreconf"
37} 39}
38 40
@@ -65,10 +67,17 @@ do_compile() {
65 # remove any bogus LD_LIBRARY_PATH 67 # remove any bogus LD_LIBRARY_PATH
66 sed -i -e s,RUNSHARED=.*,RUNSHARED=, Makefile 68 sed -i -e s,RUNSHARED=.*,RUNSHARED=, Makefile
67 69
68 install -m 0644 Makefile Makefile.orig 70 if [ ! -f Makefile.orig ]; then
69 sed -i -e 's,${includedir},${STAGING_INCDIR},' Makefile 71 install -m 0644 Makefile Makefile.orig
70 sed -i -e 's,${libdir},${STAGING_LIBDIR},' Makefile 72 fi
71 sed -i -e 's,LDFLAGS=,LDFLAGS=-L. -L${STAGING_LIBDIR},' Makefile 73 sed -i -e 's,^LDFLAGS=.*,LDFLAGS=-L. -L${STAGING_LIBDIR},g' \
74 -e 's,libdir=${libdir},libdir=${STAGING_LIBDIR},g' \
75 -e 's,libexecdir=${libexecdir},libexecdir=${STAGING_DIR_HOST}${libexecdir},g' \
76 -e 's,^LIBDIR=.*,LIBDIR=${STAGING_LIBDIR},g' \
77 -e 's,includedir=${includedir},includedir=${STAGING_INCDIR},g' \
78 -e 's,^INCLUDEDIR=.*,INCLUDE=${STAGING_INCDIR},g' \
79 -e 's,^CONFINCLUDEDIR=.*,CONFINCLUDE=${STAGING_INCDIR},g' \
80 Makefile
72 install -m 0644 Makefile ${STAGING_LIBDIR}/python${PYTHON_MAJMIN}/config/ 81 install -m 0644 Makefile ${STAGING_LIBDIR}/python${PYTHON_MAJMIN}/config/
73 # save copy of it now, because if we do it in do_install and 82 # save copy of it now, because if we do it in do_install and
74 # then call do_install twice we get Makefile.orig == Makefile.sysroot 83 # then call do_install twice we get Makefile.orig == Makefile.sysroot
@@ -79,6 +88,7 @@ do_compile() {
79 oe_runmake HOSTPGEN=${STAGING_BINDIR_NATIVE}/pgen \ 88 oe_runmake HOSTPGEN=${STAGING_BINDIR_NATIVE}/pgen \
80 HOSTPYTHON=${STAGING_BINDIR_NATIVE}/python \ 89 HOSTPYTHON=${STAGING_BINDIR_NATIVE}/python \
81 STAGING_LIBDIR=${STAGING_LIBDIR} \ 90 STAGING_LIBDIR=${STAGING_LIBDIR} \
91 STAGING_BASELIBDIR=${STAGING_BASELIBDIR} \
82 STAGING_INCDIR=${STAGING_INCDIR} \ 92 STAGING_INCDIR=${STAGING_INCDIR} \
83 BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \ 93 BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \
84 OPT="${CFLAGS}" libpython${PYTHON_MAJMIN}.so 94 OPT="${CFLAGS}" libpython${PYTHON_MAJMIN}.so
@@ -89,6 +99,7 @@ do_compile() {
89 HOSTPYTHON=${STAGING_BINDIR_NATIVE}/python \ 99 HOSTPYTHON=${STAGING_BINDIR_NATIVE}/python \
90 STAGING_LIBDIR=${STAGING_LIBDIR} \ 100 STAGING_LIBDIR=${STAGING_LIBDIR} \
91 STAGING_INCDIR=${STAGING_INCDIR} \ 101 STAGING_INCDIR=${STAGING_INCDIR} \
102 STAGING_BASELIBDIR=${STAGING_BASELIBDIR} \
92 BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \ 103 BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \
93 OPT="${CFLAGS}" 104 OPT="${CFLAGS}"
94} 105}
@@ -105,6 +116,7 @@ do_install() {
105 CROSSPYTHONPATH=${STAGING_LIBDIR_NATIVE}/python${PYTHON_MAJMIN}/lib-dynload/ \ 116 CROSSPYTHONPATH=${STAGING_LIBDIR_NATIVE}/python${PYTHON_MAJMIN}/lib-dynload/ \
106 STAGING_LIBDIR=${STAGING_LIBDIR} \ 117 STAGING_LIBDIR=${STAGING_LIBDIR} \
107 STAGING_INCDIR=${STAGING_INCDIR} \ 118 STAGING_INCDIR=${STAGING_INCDIR} \
119 STAGING_BASELIBDIR=${STAGING_BASELIBDIR} \
108 BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \ 120 BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \
109 DESTDIR=${D} LIBDIR=${libdir} install 121 DESTDIR=${D} LIBDIR=${libdir} install
110 122