summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/python/python3/python-3.3-multilib.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/python/python3/python-3.3-multilib.patch')
-rw-r--r--meta/recipes-devtools/python/python3/python-3.3-multilib.patch336
1 files changed, 336 insertions, 0 deletions
diff --git a/meta/recipes-devtools/python/python3/python-3.3-multilib.patch b/meta/recipes-devtools/python/python3/python-3.3-multilib.patch
new file mode 100644
index 0000000000..7d66a0e00d
--- /dev/null
+++ b/meta/recipes-devtools/python/python3/python-3.3-multilib.patch
@@ -0,0 +1,336 @@
1get the sys.lib from python itself and do not use hardcoded value of 'lib'
2
3-Khem
4
5Upstream-Status: Pending
6
7Index: Python-3.3.2/Include/pythonrun.h
8===================================================================
9--- Python-3.3.2.orig/Include/pythonrun.h 2013-05-15 09:32:54.000000000 -0700
10+++ Python-3.3.2/Include/pythonrun.h 2013-07-27 16:19:54.099877246 -0700
11@@ -181,6 +181,8 @@
12 /* In their own files */
13 PyAPI_FUNC(const char *) Py_GetVersion(void);
14 PyAPI_FUNC(const char *) Py_GetPlatform(void);
15+PyAPI_FUNC(const char *) Py_GetArch(void);
16+PyAPI_FUNC(const char *) Py_GetLib(void);
17 PyAPI_FUNC(const char *) Py_GetCopyright(void);
18 PyAPI_FUNC(const char *) Py_GetCompiler(void);
19 PyAPI_FUNC(const char *) Py_GetBuildInfo(void);
20Index: Python-3.3.2/Lib/distutils/command/install.py
21===================================================================
22--- Python-3.3.2.orig/Lib/distutils/command/install.py 2013-05-15 09:32:54.000000000 -0700
23+++ Python-3.3.2/Lib/distutils/command/install.py 2013-07-27 16:19:54.099877246 -0700
24@@ -25,6 +25,8 @@
25 from site import USER_SITE
26 HAS_USER_SITE = True
27
28+libname = sys.lib
29+
30 if sys.version < "2.2":
31 WINDOWS_SCHEME = {
32 'purelib': '$base',
33@@ -45,7 +47,7 @@
34 INSTALL_SCHEMES = {
35 'unix_prefix': {
36 'purelib': '$base/lib/python$py_version_short/site-packages',
37- 'platlib': '$platbase/lib/python$py_version_short/site-packages',
38+ 'platlib': '$platbase/'+libname+'/python$py_version_short/site-packages',
39 'headers': '$base/include/python$py_version_short$abiflags/$dist_name',
40 'scripts': '$base/bin',
41 'data' : '$base',
42Index: Python-3.3.2/Lib/pydoc.py
43===================================================================
44--- Python-3.3.2.orig/Lib/pydoc.py 2013-05-15 09:32:55.000000000 -0700
45+++ Python-3.3.2/Lib/pydoc.py 2013-07-27 16:19:54.103877246 -0700
46@@ -372,7 +372,7 @@
47
48 docloc = os.environ.get("PYTHONDOCS", self.PYTHONDOCS)
49
50- basedir = os.path.join(sys.base_exec_prefix, "lib",
51+ basedir = os.path.join(sys.base_exec_prefix, sys.lib,
52 "python%d.%d" % sys.version_info[:2])
53 if (isinstance(object, type(os)) and
54 (object.__name__ in ('errno', 'exceptions', 'gc', 'imp',
55Index: Python-3.3.2/Lib/site.py
56===================================================================
57--- Python-3.3.2.orig/Lib/site.py 2013-05-15 09:32:55.000000000 -0700
58+++ Python-3.3.2/Lib/site.py 2013-07-27 16:19:54.103877246 -0700
59@@ -303,13 +303,19 @@
60 if sys.platform in ('os2emx', 'riscos'):
61 sitepackages.append(os.path.join(prefix, "Lib", "site-packages"))
62 elif os.sep == '/':
63- sitepackages.append(os.path.join(prefix, "lib",
64+ sitepackages.append(os.path.join(prefix, sys.lib,
65 "python" + sys.version[:3],
66 "site-packages"))
67- sitepackages.append(os.path.join(prefix, "lib", "site-python"))
68+ if sys.lib != "lib":
69+ sitepackages.append(os.path.join(prefix, "lib",
70+ "python" + sys.version[:3],
71+ "site-packages"))
72+ sitepackages.append(os.path.join(prefix, sys.lib, "site-python"))
73+ if sys.lib != "lib":
74+ sitepackages.append(os.path.join(prefix, "lib", "site-python"))
75 else:
76 sitepackages.append(prefix)
77- sitepackages.append(os.path.join(prefix, "lib", "site-packages"))
78+ sitepackages.append(os.path.join(prefix, sys.lib, "site-packages"))
79 if sys.platform == "darwin":
80 # for framework builds *only* we add the standard Apple
81 # locations.
82Index: Python-3.3.2/Lib/trace.py
83===================================================================
84--- Python-3.3.2.orig/Lib/trace.py 2013-05-15 09:32:56.000000000 -0700
85+++ Python-3.3.2/Lib/trace.py 2013-07-27 16:19:54.103877246 -0700
86@@ -751,10 +751,10 @@
87 # should I also call expanduser? (after all, could use $HOME)
88
89 s = s.replace("$prefix",
90- os.path.join(sys.base_prefix, "lib",
91+ os.path.join(sys.base_prefix, sys.lib,
92 "python" + sys.version[:3]))
93 s = s.replace("$exec_prefix",
94- os.path.join(sys.base_exec_prefix, "lib",
95+ os.path.join(sys.base_exec_prefix, sys.lib,
96 "python" + sys.version[:3]))
97 s = os.path.normpath(s)
98 ignore_dirs.append(s)
99Index: Python-3.3.2/Makefile.pre.in
100===================================================================
101--- Python-3.3.2.orig/Makefile.pre.in 2013-07-27 16:19:16.000000000 -0700
102+++ Python-3.3.2/Makefile.pre.in 2013-07-27 16:19:54.103877246 -0700
103@@ -96,6 +96,8 @@
104
105 # Machine-dependent subdirectories
106 MACHDEP= @MACHDEP@
107+LIB= @LIB@
108+ARCH= @ARCH@
109
110 # Multiarch directory (may be empty)
111 MULTIARCH= @MULTIARCH@
112@@ -115,7 +117,7 @@
113 MANDIR= @mandir@
114 INCLUDEDIR= @includedir@
115 CONFINCLUDEDIR= $(exec_prefix)/include
116-SCRIPTDIR= $(prefix)/lib
117+SCRIPTDIR= @libdir@
118 ABIFLAGS= @ABIFLAGS@
119
120 # Detailed destination directories
121@@ -635,6 +637,7 @@
122 -DEXEC_PREFIX='"$(exec_prefix)"' \
123 -DVERSION='"$(VERSION)"' \
124 -DVPATH='"$(VPATH)"' \
125+ -DARCH='"$(ARCH)"' -DLIB='"$(LIB)"' \
126 -o $@ $(srcdir)/Modules/getpath.c
127
128 Modules/python.o: $(srcdir)/Modules/python.c
129@@ -701,7 +704,7 @@
130 Python/compile.o Python/symtable.o Python/ast.o: $(GRAMMAR_H) $(AST_H)
131
132 Python/getplatform.o: $(srcdir)/Python/getplatform.c
133- $(CC) -c $(PY_CORE_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
134+ $(CC) -c $(PY_CORE_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -DARCH='"$(ARCH)"' -DLIB='"$(LIB)"' -o $@ $(srcdir)/Python/getplatform.c
135
136 Python/importdl.o: $(srcdir)/Python/importdl.c
137 $(CC) -c $(PY_CORE_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
138Index: Python-3.3.2/Modules/getpath.c
139===================================================================
140--- Python-3.3.2.orig/Modules/getpath.c 2013-05-15 09:32:59.000000000 -0700
141+++ Python-3.3.2/Modules/getpath.c 2013-07-27 16:19:54.107877246 -0700
142@@ -121,9 +121,11 @@
143 #define EXEC_PREFIX PREFIX
144 #endif
145
146+#define LIB_PYTHON LIB "/python" VERSION
147+
148 #ifndef PYTHONPATH
149-#define PYTHONPATH PREFIX "/lib/python" VERSION ":" \
150- EXEC_PREFIX "/lib/python" VERSION "/lib-dynload"
151+#define PYTHONPATH PREFIX "/" LIB_PYTHON ":" \
152+ EXEC_PREFIX "/" LIB_PYTHON "/lib-dynload"
153 #endif
154
155 #ifndef LANDMARK
156@@ -135,7 +137,7 @@
157 static wchar_t progpath[MAXPATHLEN+1];
158 static wchar_t *module_search_path = NULL;
159 static int module_search_path_malloced = 0;
160-static wchar_t *lib_python = L"lib/python" VERSION;
161+static wchar_t *lib_python = L"" LIB_PYTHON;
162
163 static void
164 reduce(wchar_t *dir)
165Index: Python-3.3.2/Python/getplatform.c
166===================================================================
167--- Python-3.3.2.orig/Python/getplatform.c 2013-05-15 09:33:00.000000000 -0700
168+++ Python-3.3.2/Python/getplatform.c 2013-07-27 16:19:54.107877246 -0700
169@@ -10,3 +10,23 @@
170 {
171 return PLATFORM;
172 }
173+
174+#ifndef ARCH
175+#define ARCH "unknown"
176+#endif
177+
178+const char *
179+Py_GetArch(void)
180+{
181+ return ARCH;
182+}
183+
184+#ifndef LIB
185+#define LIB "lib"
186+#endif
187+
188+const char *
189+Py_GetLib(void)
190+{
191+ return LIB;
192+}
193Index: Python-3.3.2/Python/sysmodule.c
194===================================================================
195--- Python-3.3.2.orig/Python/sysmodule.c 2013-05-15 09:33:00.000000000 -0700
196+++ Python-3.3.2/Python/sysmodule.c 2013-07-27 16:19:54.107877246 -0700
197@@ -1612,6 +1612,10 @@
198 PyUnicode_FromString(Py_GetCopyright()));
199 SET_SYS_FROM_STRING("platform",
200 PyUnicode_FromString(Py_GetPlatform()));
201+ SET_SYS_FROM_STRING("arch",
202+ PyUnicode_FromString(Py_GetArch()));
203+ SET_SYS_FROM_STRING("lib",
204+ PyUnicode_FromString(Py_GetLib()));
205 SET_SYS_FROM_STRING("executable",
206 PyUnicode_FromWideChar(
207 Py_GetProgramFullPath(), -1));
208Index: Python-3.3.2/setup.py
209===================================================================
210--- Python-3.3.2.orig/setup.py 2013-07-27 16:19:17.000000000 -0700
211+++ Python-3.3.2/setup.py 2013-07-27 16:19:54.107877246 -0700
212@@ -439,7 +439,7 @@
213 # directories (i.e. '.' and 'Include') must be first. See issue
214 # 10520.
215 if not cross_compiling:
216- add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
217+ add_dir_to_list(self.compiler.library_dirs, os.path.join('/usr/local', sys.lib))
218 add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
219 # only change this for cross builds for 3.3, issues on Mageia
220 if cross_compiling:
221@@ -497,8 +497,7 @@
222 # be assumed that no additional -I,-L directives are needed.
223 if not cross_compiling:
224 lib_dirs = self.compiler.library_dirs + [
225- '/lib64', '/usr/lib64',
226- '/lib', '/usr/lib',
227+ '/' + sys.lib, '/usr/' + sys.lib,
228 ]
229 inc_dirs = self.compiler.include_dirs + ['/usr/include']
230 else:
231@@ -675,11 +674,11 @@
232 elif curses_library:
233 readline_libs.append(curses_library)
234 elif self.compiler.find_library_file(lib_dirs +
235- ['/usr/lib/termcap'],
236+ ['/usr/'+sys.lib+'/termcap'],
237 'termcap'):
238 readline_libs.append('termcap')
239 exts.append( Extension('readline', ['readline.c'],
240- library_dirs=['/usr/lib/termcap'],
241+ library_dirs=['/usr/'+sys.lib+'/termcap'],
242 extra_link_args=readline_extra_link_args,
243 libraries=readline_libs) )
244 else:
245Index: Python-3.3.2/Lib/sysconfig.py
246===================================================================
247--- Python-3.3.2.orig/Lib/sysconfig.py 2013-05-15 09:32:55.000000000 -0700
248+++ Python-3.3.2/Lib/sysconfig.py 2013-07-27 16:19:54.111877246 -0700
249@@ -21,10 +21,10 @@
250
251 _INSTALL_SCHEMES = {
252 'posix_prefix': {
253- 'stdlib': '{installed_base}/lib/python{py_version_short}',
254- 'platstdlib': '{platbase}/lib/python{py_version_short}',
255+ 'stdlib': '{installed_base}/'+sys.lib+'/python{py_version_short}',
256+ 'platstdlib': '{platbase}/'+sys.lib+'/python{py_version_short}',
257 'purelib': '{base}/lib/python{py_version_short}/site-packages',
258- 'platlib': '{platbase}/lib/python{py_version_short}/site-packages',
259+ 'platlib': '{platbase}/'+sys.lib+'/python{py_version_short}/site-packages',
260 'include':
261 '{installed_base}/include/python{py_version_short}{abiflags}',
262 'platinclude':
263@@ -33,10 +33,10 @@
264 'data': '{base}',
265 },
266 'posix_home': {
267- 'stdlib': '{installed_base}/lib/python',
268- 'platstdlib': '{base}/lib/python',
269+ 'stdlib': '{installed_base}/'+sys.lib+'/python',
270+ 'platstdlib': '{base}/'+sys.lib+'/python',
271 'purelib': '{base}/lib/python',
272- 'platlib': '{base}/lib/python',
273+ 'platlib': '{base}/'+sys.lib+'/python',
274 'include': '{installed_base}/include/python',
275 'platinclude': '{installed_base}/include/python',
276 'scripts': '{base}/bin',
277@@ -81,10 +81,10 @@
278 'data': '{userbase}',
279 },
280 'posix_user': {
281- 'stdlib': '{userbase}/lib/python{py_version_short}',
282- 'platstdlib': '{userbase}/lib/python{py_version_short}',
283+ 'stdlib': '{userbase}/'+sys.lib+'/python{py_version_short}',
284+ 'platstdlib': '{userbase}/'+sys.lib+'/python{py_version_short}',
285 'purelib': '{userbase}/lib/python{py_version_short}/site-packages',
286- 'platlib': '{userbase}/lib/python{py_version_short}/site-packages',
287+ 'platlib': '{userbase}/'+sys.lib+'/python{py_version_short}/site-packages',
288 'include': '{userbase}/include/python{py_version_short}',
289 'scripts': '{userbase}/bin',
290 'data': '{userbase}',
291Index: Python-3.3.2/configure.ac
292===================================================================
293--- Python-3.3.2.orig/configure.ac 2013-05-15 09:33:00.000000000 -0700
294+++ Python-3.3.2/configure.ac 2013-07-27 16:19:54.111877246 -0700
295@@ -769,6 +769,41 @@
296 MULTIARCH=$($CC --print-multiarch 2>/dev/null)
297 AC_SUBST(MULTIARCH)
298
299+AC_SUBST(ARCH)
300+AC_MSG_CHECKING(ARCH)
301+ARCH=`uname -m`
302+case $ARCH in
303+i?86) ARCH=i386;;
304+esac
305+AC_MSG_RESULT($ARCH)
306+
307+AC_SUBST(LIB)
308+AC_MSG_CHECKING(LIB)
309+case $ac_sys_system in
310+Linux*)
311+ # Test if the compiler is 64bit
312+ echo 'int i;' > conftest.$ac_ext
313+ python_cv_cc_64bit_output=no
314+ if AC_TRY_EVAL(ac_compile); then
315+ case `/usr/bin/file conftest.$ac_objext` in
316+ *"ELF 64"*)
317+ python_cv_cc_64bit_output=yes
318+ ;;
319+ esac
320+ fi
321+ rm -rf conftest*
322+ ;;
323+esac
324+
325+case $ARCH:$python_cv_cc_64bit_output in
326+ppc64:yes | powerpc64:yes | s390x:yes | sparc64:yes | x86_64:yes)
327+ LIB="lib64"
328+ ;;
329+*:*)
330+ LIB="lib"
331+ ;;
332+esac
333+AC_MSG_RESULT($LIB)
334
335 AC_SUBST(LIBRARY)
336 AC_MSG_CHECKING(LIBRARY)