]> git.pld-linux.org Git - packages/python3.git/blob - python3-lib64.patch
- fixes for x32 arch
[packages/python3.git] / python3-lib64.patch
1 --- Python-3.3.1/configure.ac.orig      2013-04-18 16:31:07.244030129 +0200
2 +++ Python-3.3.1/configure.ac   2013-04-18 17:30:31.800622500 +0200
3 @@ -769,6 +768,45 @@
4  MULTIARCH=$($CC --print-multiarch 2>/dev/null)
5  AC_SUBST(MULTIARCH)
6  
7 +AC_SUBST(ARCH)
8 +AC_MSG_CHECKING(ARCH)
9 +ARCH=`uname -m`
10 +case $ARCH in
11 +i?86) ARCH=i386;;
12 +esac
13 +AC_MSG_RESULT($ARCH)
14 +
15 +AC_SUBST(LIB)
16 +AC_MSG_CHECKING(LIB)
17 +case $ac_sys_system in
18 +Linux*)
19 +  # Test if the compiler is 64bit
20 +  echo 'int i;' > conftest.$ac_ext
21 +  python_cv_cc_64bit_output=no
22 +  if AC_TRY_EVAL(ac_compile); then
23 +    case `/usr/bin/file conftest.$ac_objext` in
24 +    *"ELF 64"*)
25 +      python_cv_cc_64bit_output=yes
26 +      ;;
27 +    esac
28 +  fi
29 +  rm -rf conftest*
30 +  ;;
31 +esac
32 +
33 +case $ARCH:$python_cv_cc_64bit_output in
34 +powerpc64:yes | s390x:yes | sparc64:yes | x86_64:yes)
35 +  LIB="lib64"
36 +  ;;
37 +x86_64:no)
38 +  LIB="libx32"
39 +  ;;
40 +*:*)
41 +  LIB="lib"
42 +  ;;
43 +esac
44 +AC_MSG_RESULT($LIB)
45 +
46  
47  AC_SUBST(LIBRARY)
48  AC_MSG_CHECKING(LIBRARY)
49 --- Python-3.2.1.orig/Include/pythonrun.h       2011-07-09 07:58:46.000000000 +0100
50 +++ Python-3.2.1/Include/pythonrun.h    2011-07-12 22:20:12.000000000 +0100
51 @@ -175,6 +175,8 @@
52  /* In their own files */
53  PyAPI_FUNC(const char *) Py_GetVersion(void);
54  PyAPI_FUNC(const char *) Py_GetPlatform(void);
55 +PyAPI_FUNC(const char *) Py_GetArch(void);
56 +PyAPI_FUNC(const char *) Py_GetLib(void);
57  PyAPI_FUNC(const char *) Py_GetCopyright(void);
58  PyAPI_FUNC(const char *) Py_GetCompiler(void);
59  PyAPI_FUNC(const char *) Py_GetBuildInfo(void);
60 --- Python-3.2.1.orig/Lib/distutils/command/install.py  2011-07-09 07:58:46.000000000 +0100
61 +++ Python-3.2.1/Lib/distutils/command/install.py       2011-07-12 22:20:12.000000000 +0100
62 @@ -19,6 +19,8 @@ from site import USER_BASE
63  from site import USER_SITE
64  HAS_USER_SITE = True
65  
66 +libname = sys.lib
67 +
68  WINDOWS_SCHEME = {
69      'purelib': '$base/Lib/site-packages',
70      'platlib': '$base/Lib/site-packages',
71 @@ -47,14 +49,14 @@
72  INSTALL_SCHEMES = {
73      'unix_prefix': {
74          'purelib': '$base/lib/python$py_version_short/site-packages',
75 -        'platlib': '$platbase/lib/python$py_version_short/site-packages',
76 +        'platlib': '$platbase/'+libname+'/python$py_version_short/site-packages',
77          'headers': '$base/include/python$py_version_short$abiflags/$dist_name',
78          'scripts': '$base/bin',
79          'data'   : '$base',
80          },
81      'unix_home': {
82          'purelib': '$base/lib/python',
83 -        'platlib': '$base/lib/python',
84 +        'platlib': '$base/'+libname+'/python',
85          'headers': '$base/include/python/$dist_name',
86          'scripts': '$base/bin',
87          'data'   : '$base',
88 --- Python-3.2.1.orig/Lib/distutils/sysconfig.py        2011-07-09 07:58:47.000000000 +0100
89 +++ Python-3.2.1/Lib/distutils/sysconfig.py     2011-07-12 22:20:12.000000000 +0100
90 @@ -124,8 +124,12 @@
91          prefix = plat_specific and EXEC_PREFIX or PREFIX
92  
93      if os.name == "posix":
94 +        if plat_specific:
95 +            lib = sys.lib
96 +        else:
97 +            lib = 'lib'
98          libpython = os.path.join(prefix,
99 -                                 "lib", "python" + get_python_version())
100 +                                 lib, "python" + get_python_version())
101          if standard_lib:
102              return libpython
103          else:
104 --- Python-3.2.1.orig/Lib/distutils/tests/test_install.py       2011-07-09 07:58:47.000000000 +0100
105 +++ Python-3.2.1/Lib/distutils/tests/test_install.py    2011-07-12 22:20:12.000000000 +0100
106 @@ -49,8 +49,9 @@
107              self.assertEqual(got, expected)
108  
109          libdir = os.path.join(destination, "lib", "python")
110 +        platlibdir =  os.path.join(destination, sys.lib, "python")
111          check_path(cmd.install_lib, libdir)
112 -        check_path(cmd.install_platlib, libdir)
113 +        check_path(cmd.install_platlib, platlibdir)
114          check_path(cmd.install_purelib, libdir)
115          check_path(cmd.install_headers,
116                     os.path.join(destination, "include", "python", "foopkg"))
117 --- Python-3.2.1.orig/Lib/site.py       2011-07-09 07:58:49.000000000 +0100
118 +++ Python-3.2.1/Lib/site.py    2011-07-12 22:20:12.000000000 +0100
119 @@ -304,13 +304,16 @@ def getsitepackages(prefixes=None):
120          seen.add(prefix)
121  
122          if os.sep == '/':
123 -            sitepackages.append(os.path.join(prefix, "lib",
124 +            sitepackages.append(os.path.join(prefix, sys.lib,
125                                          "python" + sys.version[:3],
126                                          "site-packages"))
127 -            sitepackages.append(os.path.join(prefix, "lib", "site-python"))
128 +            sitepackages.append(os.path.join(prefix, sys.lib, "site-python"))
129 +            if sys.lib != 'lib':
130 +                sitepackages.append(os.path.join(prefix, "lib", "python" + sys.version[:3], "site-packages"))
131 +                sitepackages.append(os.path.join(prefix, "lib", "site-python"))
132          else:
133              sitepackages.append(prefix)
134 -            sitepackages.append(os.path.join(prefix, "lib", "site-packages"))
135 +            sitepackages.append(os.path.join(prefix, sys.lib, "site-packages"))
136          if sys.platform == "darwin":
137              # for framework builds *only* we add the standard Apple
138              # locations.
139 --- Python-3.2.1.orig/Lib/sysconfig.py  2011-07-09 07:58:49.000000000 +0100
140 +++ Python-3.2.1/Lib/sysconfig.py       2011-07-12 22:20:12.000000000 +0100
141 @@ -21,10 +21,10 @@
142  
143  _INSTALL_SCHEMES = {
144      'posix_prefix': {
145 -        'stdlib': '{installed_base}/lib/python{py_version_short}',
146 -        'platstdlib': '{platbase}/lib/python{py_version_short}',
147 +        'stdlib': '{installed_base}/' + sys.lib + '/python{py_version_short}',
148 +        'platstdlib': '{platbase}/' + sys.lib + '/python{py_version_short}',
149          'purelib': '{base}/lib/python{py_version_short}/site-packages',
150 -        'platlib': '{platbase}/lib/python{py_version_short}/site-packages',
151 +        'platlib': '{platbase}/' + sys.lib + '/python{py_version_short}/site-packages',
152          'include':
153              '{installed_base}/include/python{py_version_short}{abiflags}',
154          'platinclude':
155 @@ -33,10 +33,10 @@
156          'data': '{base}',
157          },
158      'posix_home': {
159 -        'stdlib': '{installed_base}/lib/python',
160 -        'platstdlib': '{base}/lib/python',
161 +        'stdlib': '{installed_base}/' + sys.lib + '/python',
162 +        'platstdlib': '{base}/' + sys.lib + '/python',
163          'purelib': '{base}/lib/python',
164 -        'platlib': '{base}/lib/python',
165 +        'platlib': '{base}/' + sys.lib + '/python',
166          'include': '{installed_base}/include/python',
167          'platinclude': '{installed_base}/include/python',
168          'scripts': '{base}/bin',
169 --- Python-3.2.1.orig/Makefile.pre.in   2011-07-09 07:58:52.000000000 +0100
170 +++ Python-3.2.1/Makefile.pre.in        2011-07-12 22:20:12.000000000 +0100
171 @@ -90,6 +90,8 @@
172  
173  # Machine-dependent subdirectories
174  MACHDEP=       @MACHDEP@
175 +LIB=           @LIB@
176 +ARCH=          @ARCH@
177  
178  # Install prefix for architecture-independent files
179  prefix=                @prefix@
180 @@ -106,7 +108,7 @@
181  MANDIR=                @mandir@
182  INCLUDEDIR=    @includedir@
183  CONFINCLUDEDIR=        $(exec_prefix)/include
184 -SCRIPTDIR=     $(prefix)/lib
185 +SCRIPTDIR=     $(prefix)/$(LIB)
186  ABIFLAGS=      @ABIFLAGS@
187  
188  # Detailed destination directories
189 @@ -611,7 +613,7 @@
190  Python/compile.o Python/symtable.o Python/ast.o: $(GRAMMAR_H) $(AST_H)
191  
192  Python/getplatform.o: $(srcdir)/Python/getplatform.c
193 -               $(CC) -c $(PY_CORE_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
194 +               $(CC) -c $(PY_CORE_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -DARCH='"$(ARCH)"' -DLIB='"$(LIB)"' -o $@ $(srcdir)/Python/getplatform.c
195  
196  Python/importdl.o: $(srcdir)/Python/importdl.c
197                 $(CC) -c $(PY_CORE_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
198 --- Python-3.2.1.orig/Modules/getpath.c 2011-07-09 07:58:54.000000000 +0100
199 +++ Python-3.2.1/Modules/getpath.c      2011-07-12 22:21:48.000000000 +0100
200 @@ -121,9 +121,21 @@
201  #define EXEC_PREFIX PREFIX
202  #endif
203  
204 +#ifndef LIB_PYTHON
205 +#if defined(__x86_64__) || (defined(__sparc__) && defined(__arch64__)) || defined(__powerpc64__) || defined(__s390x__)
206 +#if defined(__ILP32__)
207 +#define LIB_PYTHON "libx32/python"
208 +#else
209 +#define LIB_PYTHON "lib64/python"
210 +#endif
211 +#else
212 +#define LIB_PYTHON "lib/python"
213 +#endif
214 +#endif
215 +
216  #ifndef PYTHONPATH
217 -#define PYTHONPATH PREFIX "/lib/python" VERSION ":" \
218 -              EXEC_PREFIX "/lib/python" VERSION "/lib-dynload"
219 +#define PYTHONPATH PREFIX "/" LIB_PYTHON VERSION ":" \
220 +              EXEC_PREFIX "/" LIB_PYTHON VERSION "/lib-dynload:"
221  #endif
222  
223  #ifndef LANDMARK
224 @@ -502,7 +502,7 @@ calculate_path(void)
225      _pythonpath = _Py_char2wchar(PYTHONPATH, NULL);
226      _prefix = _Py_char2wchar(PREFIX, NULL);
227      _exec_prefix = _Py_char2wchar(EXEC_PREFIX, NULL);
228 -    lib_python = _Py_char2wchar("lib/python" VERSION, NULL);
229 +    lib_python = _Py_char2wchar(LIB_PYTHON VERSION, NULL);
230  
231      if (!_pythonpath || !_prefix || !_exec_prefix || !lib_python) {
232          Py_FatalError(
233 --- Python-3.2.1.orig/Python/getplatform.c      2011-07-09 07:58:56.000000000 +0100
234 +++ Python-3.2.1/Python/getplatform.c   2011-07-12 22:20:12.000000000 +0100
235 @@ -10,3 +10,23 @@
236  {
237         return PLATFORM;
238  }
239 +
240 +#ifndef ARCH
241 +#define ARCH "unknown"
242 +#endif
243 +
244 +const char *
245 +Py_GetArch(void)
246 +{
247 +       return ARCH;
248 +}
249 +
250 +#ifndef LIB
251 +#define LIB "lib"
252 +#endif
253 +
254 +const char *
255 +Py_GetLib(void)
256 +{
257 +       return LIB;
258 +}
259 --- Python-3.2.1.orig/Python/sysmodule.c        2011-07-09 07:58:56.000000000 +0100
260 +++ Python-3.2.1/Python/sysmodule.c     2011-07-12 22:20:12.000000000 +0100
261 @@ -1560,6 +1560,10 @@
262                          PyUnicode_FromString(Py_GetCopyright()));
263      SET_SYS_FROM_STRING("platform",
264                          PyUnicode_FromString(Py_GetPlatform()));
265 +    SET_SYS_FROM_STRING("arch",
266 +                        PyUnicode_FromString(Py_GetArch()));
267 +    SET_SYS_FROM_STRING("lib",
268 +                        PyUnicode_FromString(Py_GetLib()));
269      SET_SYS_FROM_STRING("executable",
270                          PyUnicode_FromWideChar(
271                                 Py_GetProgramFullPath(), -1));
272 --- Python-3.2.1.orig/setup.py  2011-07-09 07:58:56.000000000 +0100
273 +++ Python-3.2.1/setup.py       2011-07-12 22:20:12.000000000 +0100
274 @@ -516,8 +516,7 @@
275          # be assumed that no additional -I,-L directives are needed.
276          if not cross_compiling:
277              lib_dirs = self.compiler.library_dirs + [
278 -                '/lib64', '/usr/lib64',
279 -                '/lib', '/usr/lib',
280 +                '/' + sys.lib, '/usr/' + sys.lib
281                  ]
282              inc_dirs = self.compiler.include_dirs + ['/usr/include']
283          exts = []
284 @@ -643,11 +643,11 @@
285              elif curses_library:
286                  readline_libs.append(curses_library)
287              elif self.compiler.find_library_file(lib_dirs +
288 -                                                     ['/usr/lib/termcap'],
289 +                                                     ['/usr/' + sys.lib + '/termcap'],
290                                                       'termcap'):
291                  readline_libs.append('termcap')
292              exts.append( Extension('readline', ['readline.c'],
293 -                                   library_dirs=['/usr/lib/termcap'],
294 +                                   library_dirs=['/usr/' + sys.lib + '/termcap'],
295                                     extra_link_args=readline_extra_link_args,
296                                     libraries=readline_libs) )
297          else:
This page took 0.170337 seconds and 3 git commands to generate.