summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYu Ke <ke.yu@intel.com>2011-07-11 15:23:17 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-07-12 15:00:47 +0100
commit98d7597182b502f5d30549eb50cbf390d6dde417 (patch)
tree33e5f76ef89a28833725fa43ee8f05fa006e94da
parent58ad25bc4309529d8be97de1d60e1a9279cc1d9f (diff)
downloadpoky-98d7597182b502f5d30549eb50cbf390d6dde417.tar.gz
python: fix for libdir=/usr/lib64 case
python has several place hard code "lib" which breaks build when libdir=/usr/lib64. SUSE has a patch to fix this issue. So this patch add the SUSE patch to address this issue (From OE-Core rev: c97ab268d6a7092a89c8b0051924a2acc2d86d9c) Signed-off-by: Yu Ke <ke.yu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-devtools/python/python/multilib.patch250
-rw-r--r--meta/recipes-devtools/python/python_2.6.6.bb3
2 files changed, 252 insertions, 1 deletions
diff --git a/meta/recipes-devtools/python/python/multilib.patch b/meta/recipes-devtools/python/python/multilib.patch
new file mode 100644
index 0000000000..e8689e4386
--- /dev/null
+++ b/meta/recipes-devtools/python/python/multilib.patch
@@ -0,0 +1,250 @@
1commit 248279e54467a8cd5cde98fc124d1d1384703513
2Author: Yu Ke <ke.yu@intel.com>
3Date: Tue Jun 28 21:21:29 2011 +0800
4
5 SUSE patch for the lib64 issue
6
7 see detail in http://bugs.python.org/issue1294959
8
9 also rebased a bit for Yocto python 2.6.6
10
11 Picked-by: Yu Ke <ke.yu@intel.com>
12
13Index: Python-2.6.6/Include/pythonrun.h
14===================================================================
15--- Python-2.6.6.orig/Include/pythonrun.h
16+++ Python-2.6.6/Include/pythonrun.h
17@@ -108,6 +108,7 @@ PyAPI_FUNC(char *) Py_GetPath(void);
18 /* In their own files */
19 PyAPI_FUNC(const char *) Py_GetVersion(void);
20 PyAPI_FUNC(const char *) Py_GetPlatform(void);
21+PyAPI_FUNC(const char *) Py_GetLib(void);
22 PyAPI_FUNC(const char *) Py_GetCopyright(void);
23 PyAPI_FUNC(const char *) Py_GetCompiler(void);
24 PyAPI_FUNC(const char *) Py_GetBuildInfo(void);
25Index: Python-2.6.6/Lib/distutils/command/install.py
26===================================================================
27--- Python-2.6.6.orig/Lib/distutils/command/install.py
28+++ Python-2.6.6/Lib/distutils/command/install.py
29@@ -22,6 +22,8 @@ from site import USER_BASE
30 from site import USER_SITE
31
32
33+libname = sys.lib
34+
35 if sys.version < "2.2":
36 WINDOWS_SCHEME = {
37 'purelib': '$base',
38@@ -42,7 +44,7 @@ else:
39 INSTALL_SCHEMES = {
40 'unix_prefix': {
41 'purelib': '$base/lib/python$py_version_short/site-packages',
42- 'platlib': '$platbase/lib/python$py_version_short/site-packages',
43+ 'platlib': '$platbase/'+libname+'/python$py_version_short/site-packages',
44 'headers': '$base/include/python$py_version_short/$dist_name',
45 'scripts': '$base/bin',
46 'data' : '$base',
47Index: Python-2.6.6/Lib/distutils/sysconfig.py
48===================================================================
49--- Python-2.6.6.orig/Lib/distutils/sysconfig.py
50+++ Python-2.6.6/Lib/distutils/sysconfig.py
51@@ -119,8 +119,11 @@ def get_python_lib(plat_specific=0, stan
52 prefix = plat_specific and EXEC_PREFIX or PREFIX
53
54 if os.name == "posix":
55- libpython = os.path.join(prefix,
56- "lib", "python" + get_python_version())
57+ if plat_specific or standard_lib:
58+ lib = sys.lib
59+ else:
60+ lib = "lib"
61+ libpython = os.path.join(prefix, lib, "python" + get_python_version())
62 if standard_lib:
63 return libpython
64 else:
65Index: Python-2.6.6/Lib/pydoc.py
66===================================================================
67--- Python-2.6.6.orig/Lib/pydoc.py
68+++ Python-2.6.6/Lib/pydoc.py
69@@ -349,7 +349,7 @@ class Doc:
70
71 docloc = os.environ.get("PYTHONDOCS",
72 "http://docs.python.org/library")
73- basedir = os.path.join(sys.exec_prefix, "lib",
74+ basedir = os.path.join(sys.exec_prefix, sys.lib,
75 "python"+sys.version[0:3])
76 if (isinstance(object, type(os)) and
77 (object.__name__ in ('errno', 'exceptions', 'gc', 'imp',
78Index: Python-2.6.6/Lib/site.py
79===================================================================
80--- Python-2.6.6.orig/Lib/site.py
81+++ Python-2.6.6/Lib/site.py
82@@ -265,13 +265,19 @@ def addsitepackages(known_paths):
83 if sys.platform in ('os2emx', 'riscos'):
84 sitedirs.append(os.path.join(prefix, "Lib", "site-packages"))
85 elif os.sep == '/':
86- sitedirs.append(os.path.join(prefix, "lib",
87+ sitedirs.append(os.path.join(prefix, sys.lib,
88 "python" + sys.version[:3],
89 "site-packages"))
90- sitedirs.append(os.path.join(prefix, "lib", "site-python"))
91+ if sys.lib != "lib":
92+ sitedirs.append(os.path.join(prefix, "lib",
93+ "python" + sys.version[:3],
94+ "site-packages"))
95+ sitedirs.append(os.path.join(prefix, sys.lib, "site-python"))
96+ if sys.lib != "lib":
97+ sitedirs.append(os.path.join(prefix, "lib", "site-python"))
98 else:
99 sitedirs.append(prefix)
100- sitedirs.append(os.path.join(prefix, "lib", "site-packages"))
101+ sitedirs.append(os.path.join(prefix, sys.lib, "site-packages"))
102
103 if sys.platform == "darwin":
104 # for framework builds *only* we add the standard Apple
105Index: Python-2.6.6/Lib/test/test_dl.py
106===================================================================
107--- Python-2.6.6.orig/Lib/test/test_dl.py
108+++ Python-2.6.6/Lib/test/test_dl.py
109@@ -4,10 +4,11 @@
110 """
111 from test.test_support import verbose,TestSkipped, import_module
112 dl = import_module('dl', deprecated=True)
113+import sys
114
115 sharedlibs = [
116- ('/usr/lib/libc.so', 'getpid'),
117- ('/lib/libc.so.6', 'getpid'),
118+ ('/usr/'+sys.lib+'/libc.so', 'getpid'),
119+ ('/'+sys.lib+'/libc.so.6', 'getpid'),
120 ('/usr/bin/cygwin1.dll', 'getpid'),
121 ('/usr/lib/libc.dylib', 'getpid'),
122 ]
123Index: Python-2.6.6/Lib/trace.py
124===================================================================
125--- Python-2.6.6.orig/Lib/trace.py
126+++ Python-2.6.6/Lib/trace.py
127@@ -759,10 +759,10 @@ def main(argv=None):
128 # should I also call expanduser? (after all, could use $HOME)
129
130 s = s.replace("$prefix",
131- os.path.join(sys.prefix, "lib",
132+ os.path.join(sys.prefix, sys.lib,
133 "python" + sys.version[:3]))
134 s = s.replace("$exec_prefix",
135- os.path.join(sys.exec_prefix, "lib",
136+ os.path.join(sys.exec_prefix, sys.lib,
137 "python" + sys.version[:3]))
138 s = os.path.normpath(s)
139 ignore_dirs.append(s)
140Index: Python-2.6.6/Makefile.pre.in
141===================================================================
142--- Python-2.6.6.orig/Makefile.pre.in
143+++ Python-2.6.6/Makefile.pre.in
144@@ -75,6 +75,7 @@ PY_CFLAGS= $(CFLAGS) $(CPPFLAGS) $(CFLAG
145
146 # Machine-dependent subdirectories
147 MACHDEP= @MACHDEP@
148+LIB= @LIB@
149
150 # Install prefix for architecture-independent files
151 prefix= @prefix@
152@@ -91,7 +92,7 @@ LIBDIR= @libdir@
153 MANDIR= @mandir@
154 INCLUDEDIR= @includedir@
155 CONFINCLUDEDIR= $(exec_prefix)/include
156-SCRIPTDIR= $(prefix)/lib
157+SCRIPTDIR= $(prefix)/@LIB@
158
159 # Detailed destination directories
160 BINLIBDEST= $(LIBDIR)/python$(VERSION)
161@@ -509,6 +510,7 @@ Modules/getpath.o: $(srcdir)/Modules/get
162 -DEXEC_PREFIX='"$(exec_prefix)"' \
163 -DVERSION='"$(VERSION)"' \
164 -DVPATH='"$(VPATH)"' \
165+ -DLIB='"$(LIB)"' \
166 -o $@ $(srcdir)/Modules/getpath.c
167
168 Modules/python.o: $(srcdir)/Modules/python.c
169@@ -540,7 +542,7 @@ $(AST_C): $(AST_ASDL) $(ASDLGEN_FILES)
170 Python/compile.o Python/symtable.o: $(GRAMMAR_H) $(AST_H)
171
172 Python/getplatform.o: $(srcdir)/Python/getplatform.c
173- $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
174+ $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -DLIB='"$(LIB)"' -o $@ $(srcdir)/Python/getplatform.c
175
176 Python/importdl.o: $(srcdir)/Python/importdl.c
177 $(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
178Index: Python-2.6.6/Modules/getpath.c
179===================================================================
180--- Python-2.6.6.orig/Modules/getpath.c
181+++ Python-2.6.6/Modules/getpath.c
182@@ -116,9 +116,11 @@
183 #define EXEC_PREFIX PREFIX
184 #endif
185
186+#define LIB_PYTHON LIB "/python" VERSION
187+
188 #ifndef PYTHONPATH
189-#define PYTHONPATH PREFIX "/lib/python" VERSION ":" \
190- EXEC_PREFIX "/lib/python" VERSION "/lib-dynload"
191+#define PYTHONPATH PREFIX "/" LIB_PYTHON ":" \
192+ EXEC_PREFIX "/" LIB_PYTHON "/lib-dynload"
193 #endif
194
195 #ifndef LANDMARK
196@@ -129,7 +131,7 @@ static char prefix[MAXPATHLEN+1];
197 static char exec_prefix[MAXPATHLEN+1];
198 static char progpath[MAXPATHLEN+1];
199 static char *module_search_path = NULL;
200-static char lib_python[] = "lib/python" VERSION;
201+static char lib_python[] = LIB_PYTHON;
202
203 static void
204 reduce(char *dir)
205Index: Python-2.6.6/Python/getplatform.c
206===================================================================
207--- Python-2.6.6.orig/Python/getplatform.c
208+++ Python-2.6.6/Python/getplatform.c
209@@ -10,3 +10,13 @@ Py_GetPlatform(void)
210 {
211 return PLATFORM;
212 }
213+
214+#ifndef LIB
215+#define LIB "lib"
216+#endif
217+
218+const char *
219+Py_GetLib(void)
220+{
221+ return LIB;
222+}
223Index: Python-2.6.6/Python/sysmodule.c
224===================================================================
225--- Python-2.6.6.orig/Python/sysmodule.c
226+++ Python-2.6.6/Python/sysmodule.c
227@@ -1379,6 +1379,8 @@ _PySys_Init(void)
228 PyString_FromString(Py_GetCopyright()));
229 SET_SYS_FROM_STRING("platform",
230 PyString_FromString(Py_GetPlatform()));
231+ SET_SYS_FROM_STRING("lib",
232+ PyString_FromString(Py_GetLib()));
233 SET_SYS_FROM_STRING("executable",
234 PyString_FromString(Py_GetProgramFullPath()));
235 SET_SYS_FROM_STRING("prefix",
236Index: Python-2.6.6/configure.in
237===================================================================
238--- Python-2.6.6.orig/configure.in
239+++ Python-2.6.6/configure.in
240@@ -613,6 +613,10 @@ SunOS*)
241 ;;
242 esac
243
244+AC_SUBST(LIB)
245+AC_MSG_CHECKING(LIB)
246+LIB=`basename ${LIBDIR}`
247+AC_MSG_RESULT($LIB)
248
249 AC_SUBST(LIBRARY)
250 AC_MSG_CHECKING(LIBRARY)
diff --git a/meta/recipes-devtools/python/python_2.6.6.bb b/meta/recipes-devtools/python/python_2.6.6.bb
index 418457cd50..b324eb9129 100644
--- a/meta/recipes-devtools/python/python_2.6.6.bb
+++ b/meta/recipes-devtools/python/python_2.6.6.bb
@@ -1,7 +1,7 @@
1require python.inc 1require python.inc
2DEPENDS = "python-native db gdbm openssl readline sqlite3 zlib" 2DEPENDS = "python-native db gdbm openssl readline sqlite3 zlib"
3DEPENDS_sharprom = "python-native db readline zlib gdbm openssl" 3DEPENDS_sharprom = "python-native db readline zlib gdbm openssl"
4PR = "${INC_PR}.6" 4PR = "${INC_PR}.7"
5LIC_FILES_CHKSUM = "file://LICENSE;md5=38fdd546420fab09ac6bd3d8a1c83eb6" 5LIC_FILES_CHKSUM = "file://LICENSE;md5=38fdd546420fab09ac6bd3d8a1c83eb6"
6 6
7DISTRO_SRC_URI ?= "file://sitecustomize.py" 7DISTRO_SRC_URI ?= "file://sitecustomize.py"
@@ -17,6 +17,7 @@ SRC_URI = "\
17 file://06-avoid_usr_lib_termcap_path_in_linking.patch \ 17 file://06-avoid_usr_lib_termcap_path_in_linking.patch \
18 file://99-ignore-optimization-flag.patch \ 18 file://99-ignore-optimization-flag.patch \
19 ${DISTRO_SRC_URI} \ 19 ${DISTRO_SRC_URI} \
20 file://multilib.patch \
20" 21"
21 22
22SRC_URI[md5sum] = "cf4e6881bb84a7ce6089e4a307f71f14" 23SRC_URI[md5sum] = "cf4e6881bb84a7ce6089e4a307f71f14"