blob: 1fa27c210dbce3785cb437633c36c31b6278b92b [file] [log] [blame]
Brad Bishop316dfdd2018-06-25 12:45:53 -04001From 1e2cea8945bc2183fbe1a012dcd633a352125952 Mon Sep 17 00:00:00 2001
2From: Martin Jansa <Martin.Jansa@gmail.com>
3Date: Tue, 24 Apr 2012 18:45:14 +0200
4Subject: [PATCH] SConstruct: prefix includepy with sysroot and drop sysroot
5 from python_lib_dir
6
7* without PYTHONPATH, distutil's sysconfig returns INCLUDEPY without sysroot prefix
8 and with PYTHONPATH from OE it's pointing to native python dir
9
10 $ export PYTHONPATH=/OE/shr-core/tmp-eglibc/sysroots/om-gta02/usr/lib/python2.7/
11 $ python
12 Python 2.7.2 (default, Apr 18 2012, 09:19:59)
13 [GCC 4.6.2] on linux2
14 Type "help", "copyright", "credits" or "license" for more information.
15 >>> from distutils import sysconfig
16 >>> sysconfig.get_config_vars('INCLUDEPY')
17 ['/OE/shr-core/tmp-eglibc/sysroots/x86_64-linux/usr/include/python2.7']
18 >>>
19 $ unset PYTHONPATH
20 $ python
21 Python 2.7.2 (default, Apr 18 2012, 09:19:59)
22 [GCC 4.6.2] on linux2
23 Type "help", "copyright", "credits" or "license" for more information.
24 >>> from distutils import sysconfig
25 >>> sysconfig.get_config_vars('INCLUDEPY')
26 ['/python2.7']
27 >>> import sysconfig
28 >>> sysconfig.get_config_vars('INCLUDEPY')
29 ['/OE/shr-core/tmp-eglibc/sysroots/x86_64-linux/usr/include/python2.7']
30* python_lib_dir = python_lib_dir.replace(env['sysroot'], '')
31 returns path to target sysroot
32
33Upstream-Status: Inappropriate [embedded specific]
34
35Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
36Signed-off-by: Peter A. Bigot <pab@pabigot.com>
37---
38 SConstruct | 9 +++++++++
39 1 file changed, 9 insertions(+)
40
41diff --git a/SConstruct b/SConstruct
42index 3318bb48..e1c4f963 100644
43--- a/SConstruct
44+++ b/SConstruct
45@@ -934,7 +934,7 @@ else:
46
47 # Set up configuration for target Python
48
49-PYTHON_LIBDIR_CALL = 'sysconfig.get_python_lib()'
50+PYTHON_LIBDIR_CALL = 'sysconfig.get_python_lib(plat_specific=1)'
51
52 PYTHON_CONFIG_NAMES = ['CC', 'CXX', 'OPT', 'BASECFLAGS',
53 'CCSHARED', 'LDSHARED', 'SO', 'INCLUDEPY', 'LDFLAGS']
54@@ -1364,7 +1364,7 @@ else:
55 LINK=ldshared,
56 SHLIBPREFIX="",
57 SHLIBSUFFIX=python_config['SO'],
58- CPPPATH=[python_config['INCLUDEPY']],
59+ CPPPATH=[os.path.normpath("%s/%s/%s/%s" % (env['sysroot'], env['prefix'], env['includedir'], python_config['INCLUDEPY']))] if env['sysroot'] else [python_config['INCLUDEPY']],
60 CPPFLAGS=python_config['OPT'],
61 CFLAGS=python_config['BASECFLAGS'],
62 CXXFLAGS=python_config['BASECFLAGS'])
63@@ -1662,12 +1662,15 @@ if ((not env['debug'] and not env['profiling'] and not env['nostrip']
64 if not env['python']:
65 python_install = []
66 else:
67+ python_libdir = python_libdir.replace(env['sysroot'], '')
68 python_module_dir = python_libdir + os.sep + 'gps'
69 python_extensions_install = python_env.Install(DESTDIR + python_module_dir,
70 python_built_extensions)
71 if ((not env['debug'] and not env['profiling']
72 and not env['nostrip'] and not sys.platform.startswith('darwin'))):
73 python_env.AddPostAction(python_extensions_install, '$STRIP $TARGET')
74+ env.AddPostAction(python_extensions_install, '$CHRPATH -r "%s" "$TARGET"' \
75+ % (python_libdir, ))
76
77 python_modules_install = python_env.Install(DESTDIR + python_module_dir,
78 python_modules)
79--
802.1.0
81