From 1c7d6584a7811b7785ae5c1e378f14b5ba0971cf Mon Sep 17 00:00:00 2001 From: takeshi_hoshina Date: Mon, 2 Nov 2020 11:07:33 +0900 Subject: basesystem-jj recipes --- .../python/check-if-target-is-64b-not-host.patch | 57 ++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 external/meta-python2/recipes-devtools/python/python/check-if-target-is-64b-not-host.patch (limited to 'external/meta-python2/recipes-devtools/python/python/check-if-target-is-64b-not-host.patch') diff --git a/external/meta-python2/recipes-devtools/python/python/check-if-target-is-64b-not-host.patch b/external/meta-python2/recipes-devtools/python/python/check-if-target-is-64b-not-host.patch new file mode 100644 index 00000000..e6d6c65b --- /dev/null +++ b/external/meta-python2/recipes-devtools/python/python/check-if-target-is-64b-not-host.patch @@ -0,0 +1,57 @@ +Author: Andrei Gherzan +Date: Sun Mar 25 02:02:27 2012 +0200 + +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. + +Signed-off-by: Andrei Gherzan + +Upstream-Status: Pending + +Index: Python-2.7.11/setup.py +=================================================================== +--- Python-2.7.11.orig/setup.py ++++ Python-2.7.11/setup.py +@@ -35,6 +35,21 @@ COMPILED_WITH_PYDEBUG = ('--with-pydebug + # This global variable is used to hold the list of modules to be disabled. + disabled_module_list = [] + ++def target_is_64bit_platform (): ++ """ ++ In case of cross-compile, some modules are not build as setup checks if HOST ++ is 64bit and not TARGET. ++ As python was built for TARGET we can check this in pyconfig.h in this way: ++ Sizeof LONG on a 32 bit platform is 4 bytes ++ Sizeof LONG on a 64 bit platform is 8 bytes ++ """ ++ pyconf = open("pyconfig.h").read() ++ aux = re.search(r"#s*define\s+SIZEOF_LONG\s+8\s*", pyconf) ++ if aux is not None: ++ return True ++ else: ++ return False ++ + def add_dir_to_list(dirlist, dir): + """Add the directory 'dir' to the list 'dirlist' (at the front) if + 1) 'dir' is not already in 'dirlist' +@@ -716,7 +731,7 @@ class PyBuildExt(build_ext): + exts.append( Extension('audioop', ['audioop.c']) ) + + # Disabled on 64-bit platforms +- if sys.maxsize != 9223372036854775807L: ++ if not target_is_64bit_platform(): + # Operations on images + exts.append( Extension('imageop', ['imageop.c']) ) + else: +@@ -1545,7 +1560,7 @@ class PyBuildExt(build_ext): + missing.append('_codecs_%s' % loc) + + # Dynamic loading module +- if sys.maxint == 0x7fffffff: ++ if not target_is_64bit_platform(): + # This requires sizeof(int) == sizeof(long) == sizeof(char*) + dl_inc = find_file('dlfcn.h', [], inc_dirs) + if (dl_inc is not None) and (host_platform not in ['atheos']): -- cgit 1.2.3-korg