summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrei Gherzan <andrei@gherzan.ro>2012-04-05 23:54:21 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-04-26 10:05:16 +0100
commitfcb368f76716bd510e9492244a12b5c4a129aad5 (patch)
tree503fc5cbb162dafad4270fdfb371a6df714bc6c6
parent77a3de5ff0441da2366ae029e8427ea53ad79b79 (diff)
downloadpoky-fcb368f76716bd510e9492244a12b5c4a129aad5.tar.gz
python: Add patch for 64bit platform
This patch was added for 64bit host machines. In the compile process python is checking if platform is a 64bit platform using sys.maxint which is the host's value. The patch fixes this issue so that python would check if TARGET machine is 64bit not the HOST machine. In this way will have "dl" and "imageop" modules built if HOST machine is 64bit but the target machine is 32bit. [YOCTO #1937] (From OE-Core rev: 4993f50744882ee384cb8fb106ad209f0d887b3f) Signed-off-by: Andrei Gherzan <andrei@gherzan.ro> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-devtools/python/python/check-if-target-is-64b-not-host.patch57
-rw-r--r--meta/recipes-devtools/python/python_2.7.2.bb3
2 files changed, 59 insertions, 1 deletions
diff --git a/meta/recipes-devtools/python/python/check-if-target-is-64b-not-host.patch b/meta/recipes-devtools/python/python/check-if-target-is-64b-not-host.patch
new file mode 100644
index 0000000000..2b62db3826
--- /dev/null
+++ b/meta/recipes-devtools/python/python/check-if-target-is-64b-not-host.patch
@@ -0,0 +1,57 @@
1Author: Andrei Gherzan <andrei@gherzan.ro>
2Date: Sun Mar 25 02:02:27 2012 +0200
3
4This patch was added for 64bit host machines. In the compile process python
5is checking if platform is a 64bit platform using sys.maxint which is the host's
6value. The patch fixes this issue so that python would check if TARGET machine
7is 64bit not the HOST machine. In this way will have "dl" and "imageop" modules
8built if HOST machine is 64bit but the target machine is 32bit.
9
10Signed-off-by: Andrei Gherzan <andrei@gherzan.ro>
11
12Upstream-Status: Pending
13
14Index: Python-2.7.2/setup.py
15===================================================================
16--- Python-2.7.2.orig/setup.py 2012-03-25 01:10:41.540163187 +0200
17+++ Python-2.7.2/setup.py 2012-03-25 01:26:06.092539990 +0200
18@@ -23,6 +23,21 @@
19 # This global variable is used to hold the list of modules to be disabled.
20 disabled_module_list = []
21
22+def target_is_64bit_platform ():
23+ """
24+ In case of cross-compile, some modules are not build as setup checks if HOST
25+ is 64bit and not TARGET.
26+ As python was built for TARGET we can check this in pyconfig.h in this way:
27+ Sizeof LONG on a 32 bit platform is 4 bytes
28+ Sizeof LONG on a 64 bit platform is 8 bytes
29+ """
30+ pyconf = open("pyconfig.h").read()
31+ aux = re.search(r"#s*define\s+SIZEOF_LONG\s+8\s*", pyconf)
32+ if aux is not None:
33+ return True
34+ else:
35+ return False
36+
37 def add_dir_to_list(dirlist, dir):
38 """Add the directory 'dir' to the list 'dirlist' (at the front) if
39 1) 'dir' is not already in 'dirlist'
40@@ -628,7 +643,7 @@
41 exts.append( Extension('audioop', ['audioop.c']) )
42
43 # Disabled on 64-bit platforms
44- if sys.maxint != 9223372036854775807L:
45+ if not target_is_64bit_platform():
46 # Operations on images
47 exts.append( Extension('imageop', ['imageop.c']) )
48 else:
49@@ -1418,7 +1433,7 @@
50 missing.append('_codecs_%s' % loc)
51
52 # Dynamic loading module
53- if sys.maxint == 0x7fffffff:
54+ if not target_is_64bit_platform():
55 # This requires sizeof(int) == sizeof(long) == sizeof(char*)
56 dl_inc = find_file('dlfcn.h', [], inc_dirs)
57 if (dl_inc is not None) and (platform not in ['atheos']):
diff --git a/meta/recipes-devtools/python/python_2.7.2.bb b/meta/recipes-devtools/python/python_2.7.2.bb
index 9ba561b18b..bfe3ee02f8 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}.15" 3PR = "${INC_PR}.16"
4 4
5DISTRO_SRC_URI ?= "file://sitecustomize.py" 5DISTRO_SRC_URI ?= "file://sitecustomize.py"
6DISTRO_SRC_URI_linuxstdbase = "" 6DISTRO_SRC_URI_linuxstdbase = ""
@@ -22,6 +22,7 @@ SRC_URI += "\
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 file://setuptweaks.patch \
25 file://check-if-target-is-64b-not-host.patch \
25" 26"
26 27
27S = "${WORKDIR}/Python-${PV}" 28S = "${WORKDIR}/Python-${PV}"