summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/python/python3
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2015-01-18 19:10:32 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-01-23 11:36:27 +0000
commitb2f8367dff8a2db49b9296bd27a2e94a3619884d (patch)
tree4a95853b17d9acecfa59d27b2b35122f47267f8a /meta/recipes-devtools/python/python3
parent3873efd33c60010a096391b821ef9004755da1d5 (diff)
downloadast2050-yocto-poky-b2f8367dff8a2db49b9296bd27a2e94a3619884d.zip
ast2050-yocto-poky-b2f8367dff8a2db49b9296bd27a2e94a3619884d.tar.gz
python3: fix for cross compiling
Fixed: * python3 has introduced _PYTHON_PROJECT_BASE which is used for separate B and S, but it doesn't work when compile Modules, the target python3 runs python3-native's sysconfig to get srcdir which is the native's, there would be errors when native's srcdir has been removed, add _PYTHON_PROJECT_SRC to fix the problem. * Check cross_compiling when get FLAGS (From OE-Core rev: c33639963491f00f55b80299922895fe68b0637d) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/python/python3')
-rw-r--r--meta/recipes-devtools/python/python3/setup.py-check-cross_compiling-when-get-FLAGS.patch50
-rw-r--r--meta/recipes-devtools/python/python3/sysconfig.py-add-_PYTHON_PROJECT_SRC.patch54
2 files changed, 104 insertions, 0 deletions
diff --git a/meta/recipes-devtools/python/python3/setup.py-check-cross_compiling-when-get-FLAGS.patch b/meta/recipes-devtools/python/python3/setup.py-check-cross_compiling-when-get-FLAGS.patch
new file mode 100644
index 0000000..fc2e12d
--- /dev/null
+++ b/meta/recipes-devtools/python/python3/setup.py-check-cross_compiling-when-get-FLAGS.patch
@@ -0,0 +1,50 @@
+From 8dad810f3a3d073f09ad72e1a3ee0a895eab2ca1 Mon Sep 17 00:00:00 2001
+From: Robert Yang <liezhi.yang@windriver.com>
+Date: Sun, 18 Jan 2015 19:05:36 -0800
+Subject: [PATCH] setup.py:check cross_compiling when get FLAGS
+
+Fixed when compile target pythnon3:
+gcc -isystem/path/to/sysroots/x86_64-linux/usr/include \
+ -L=/path/to/sysroots/x86_64-linux/usr/lib
+
+This is incorrect, the native sysroot should not be used by target
+python3.
+
+Upstream-Status: Pending
+
+Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
+---
+ setup.py | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/setup.py b/setup.py
+index e8339cd..83fd31f 100644
+--- a/setup.py
++++ b/setup.py
+@@ -238,7 +238,10 @@ class PyBuildExt(build_ext):
+ # unfortunately, distutils doesn't let us provide separate C and C++
+ # compilers
+ if compiler is not None:
+- (ccshared,cflags) = sysconfig.get_config_vars('CCSHARED','CFLAGS')
++ if cross_compiling:
++ (ccshared,cflags) = (os.environ.get('CCSHARED') or '', os.environ.get('CFLAGS') or '')
++ else:
++ (ccshared,cflags) = sysconfig.get_config_vars('CCSHARED','CFLAGS')
+ args['compiler_so'] = compiler + ' ' + ccshared + ' ' + cflags
+ self.compiler.set_executables(**args)
+
+@@ -457,7 +460,10 @@ class PyBuildExt(build_ext):
+ ('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 cross_compiling:
++ env_val = os.environ.get(env_var)
++ else:
++ env_val = sysconfig.get_config_var(env_var)
+ if env_val:
+ # To prevent optparse from raising an exception about any
+ # options in env_val that it doesn't know about we strip out
+--
+1.7.9.5
+
diff --git a/meta/recipes-devtools/python/python3/sysconfig.py-add-_PYTHON_PROJECT_SRC.patch b/meta/recipes-devtools/python/python3/sysconfig.py-add-_PYTHON_PROJECT_SRC.patch
new file mode 100644
index 0000000..de07643
--- /dev/null
+++ b/meta/recipes-devtools/python/python3/sysconfig.py-add-_PYTHON_PROJECT_SRC.patch
@@ -0,0 +1,54 @@
+From fc93b3cc23b4f9698ae92a42986dbb02b6f19588 Mon Sep 17 00:00:00 2001
+From: Robert Yang <liezhi.yang@windriver.com>
+Date: Sun, 18 Jan 2015 06:29:50 -0800
+Subject: [PATCH] sysconfig.py: add _PYTHON_PROJECT_SRC
+
+python3 has introduced _PYTHON_PROJECT_BASE which is used for separate B
+and S, but it doesn't work when compile Modules, the target python3 runs
+python3-native's sysconfig to get srcdir which is the native's, there
+would be errors when native's srcdir has been removed, add
+_PYTHON_PROJECT_SRC to fix the problem.
+
+Upstream-Status: Pending
+
+Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
+---
+ Lib/distutils/sysconfig.py | 5 ++++-
+ Lib/sysconfig.py | 5 ++++-
+ 2 files changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
+index a545ab9..74317d1 100644
+--- a/Lib/distutils/sysconfig.py
++++ b/Lib/distutils/sysconfig.py
+@@ -554,7 +554,10 @@ def get_config_vars(*args):
+ _config_vars['exec_prefix'] = EXEC_PREFIX
+
+ # Always convert srcdir to an absolute path
+- srcdir = _config_vars.get('srcdir', project_base)
++ if "_PYTHON_PROJECT_SRC" in os.environ:
++ srcdir = os.path.abspath(os.environ["_PYTHON_PROJECT_SRC"])
++ else:
++ srcdir = _config_vars.get('srcdir', project_base)
+ if os.name == 'posix':
+ if python_build:
+ # If srcdir is a relative path (typically '.' or '..')
+diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py
+index 7287f11..cc92998 100644
+--- a/Lib/sysconfig.py
++++ b/Lib/sysconfig.py
+@@ -562,7 +562,10 @@ def get_config_vars(*args):
+ _CONFIG_VARS['userbase'] = _getuserbase()
+
+ # Always convert srcdir to an absolute path
+- srcdir = _CONFIG_VARS.get('srcdir', _PROJECT_BASE)
++ if "_PYTHON_PROJECT_SRC" in os.environ:
++ srcdir = os.path.abspath(os.environ["_PYTHON_PROJECT_SRC"])
++ else:
++ srcdir = _CONFIG_VARS.get('srcdir', _PROJECT_BASE)
+ if os.name == 'posix':
+ if _PYTHON_BUILD:
+ # If srcdir is a relative path (typically '.' or '..')
+--
+1.7.9.5
+
OpenPOWER on IntegriCloud