diff options
author | Andrei Gherzan <andrei@gherzan.ro> | 2012-04-05 23:54:21 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-04-26 10:05:16 +0100 |
commit | fcb368f76716bd510e9492244a12b5c4a129aad5 (patch) | |
tree | 503fc5cbb162dafad4270fdfb371a6df714bc6c6 /meta/recipes-devtools/python | |
parent | 77a3de5ff0441da2366ae029e8427ea53ad79b79 (diff) | |
download | poky-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>
Diffstat (limited to 'meta/recipes-devtools/python')
-rw-r--r-- | meta/recipes-devtools/python/python/check-if-target-is-64b-not-host.patch | 57 | ||||
-rw-r--r-- | meta/recipes-devtools/python/python_2.7.2.bb | 3 |
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 @@ | |||
1 | Author: Andrei Gherzan <andrei@gherzan.ro> | ||
2 | Date: Sun Mar 25 02:02:27 2012 +0200 | ||
3 | |||
4 | This patch was added for 64bit host machines. In the compile process python | ||
5 | is checking if platform is a 64bit platform using sys.maxint which is the host's | ||
6 | value. The patch fixes this issue so that python would check if TARGET machine | ||
7 | is 64bit not the HOST machine. In this way will have "dl" and "imageop" modules | ||
8 | built if HOST machine is 64bit but the target machine is 32bit. | ||
9 | |||
10 | Signed-off-by: Andrei Gherzan <andrei@gherzan.ro> | ||
11 | |||
12 | Upstream-Status: Pending | ||
13 | |||
14 | Index: 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 @@ | |||
1 | require python.inc | 1 | require python.inc |
2 | DEPENDS = "python-native bzip2 db gdbm openssl readline sqlite3 zlib" | 2 | DEPENDS = "python-native bzip2 db gdbm openssl readline sqlite3 zlib" |
3 | PR = "${INC_PR}.15" | 3 | PR = "${INC_PR}.16" |
4 | 4 | ||
5 | DISTRO_SRC_URI ?= "file://sitecustomize.py" | 5 | DISTRO_SRC_URI ?= "file://sitecustomize.py" |
6 | DISTRO_SRC_URI_linuxstdbase = "" | 6 | DISTRO_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 | ||
27 | S = "${WORKDIR}/Python-${PV}" | 28 | S = "${WORKDIR}/Python-${PV}" |