| OLD | NEW |
| (Empty) |
| 1 diff --git a/Include/datetime.h b/Include/datetime.h | |
| 2 index c0e7ffd..b6d6036 100644 | |
| 3 --- a/Include/datetime.h | |
| 4 +++ b/Include/datetime.h | |
| 5 @@ -166,6 +166,8 @@ typedef struct { | |
| 6 | |
| 7 #ifdef Py_BUILD_CORE | |
| 8 | |
| 9 +#define PyDataTime_STATIC 1 | |
| 10 + | |
| 11 /* Macros for type checking when building the Python core. */ | |
| 12 #define PyDate_Check(op) PyObject_TypeCheck(op, &PyDateTime_DateType) | |
| 13 #define PyDate_CheckExact(op) (Py_TYPE(op) == &PyDateTime_DateType) | |
| 14 diff --git a/Lib/distutils/unixccompiler.py b/Lib/distutils/unixccompiler.py | |
| 15 index 2aa1cb1..40b0aff 100644 | |
| 16 --- a/Lib/distutils/unixccompiler.py | |
| 17 +++ b/Lib/distutils/unixccompiler.py | |
| 18 @@ -286,3 +286,42 @@ class UnixCCompiler(CCompiler): | |
| 19 | |
| 20 # Oops, didn't find it in *any* of 'dirs' | |
| 21 return None | |
| 22 + | |
| 23 +# Thanks to the GPAW project for this function. | |
| 24 +def _link_shared_object (self, | |
| 25 + objects, | |
| 26 + output_filename, | |
| 27 + output_dir=None, | |
| 28 + libraries=None, | |
| 29 + library_dirs=None, | |
| 30 + runtime_library_dirs=None, | |
| 31 + export_symbols=None, | |
| 32 + debug=0, | |
| 33 + extra_preargs=None, | |
| 34 + extra_postargs=None, | |
| 35 + build_temp=None, | |
| 36 + target_lang=None): | |
| 37 + | |
| 38 + if output_dir is None: | |
| 39 + (output_dir, output_filename) = os.path.split(output_filename) | |
| 40 + output_fullname = os.path.join(output_dir, output_filename) | |
| 41 + output_fullname = os.path.abspath(output_fullname) | |
| 42 + linkline = "%s %s" % (output_filename[:-2], output_fullname) | |
| 43 + for l in library_dirs: | |
| 44 + linkline += " -L" + l | |
| 45 + for l in libraries: | |
| 46 + linkline += " -l" + l | |
| 47 + old_fmt = self.static_lib_format | |
| 48 + self.static_lib_format = "%s%.0s" | |
| 49 + self.create_static_lib(objects, | |
| 50 + output_filename, | |
| 51 + output_dir, | |
| 52 + debug, | |
| 53 + target_lang) | |
| 54 + | |
| 55 + self.static_lib_format = old_fmt | |
| 56 + | |
| 57 +# Only override when the NACL_SDK_ROOT | |
| 58 +import os | |
| 59 +if os.environ.get("NACL_PORT_BUILD", None) in ["dest", "bootstrap"]: | |
| 60 + UnixCCompiler.link_shared_object = _link_shared_object | |
| 61 diff --git a/Makefile.pre.in b/Makefile.pre.in | |
| 62 index a70119a..3cb02a5 100644 | |
| 63 --- a/Makefile.pre.in | |
| 64 +++ b/Makefile.pre.in | |
| 65 @@ -597,14 +597,18 @@ Modules/pwdmodule.o: $(srcdir)/Modules/pwdmodule.c $(srcdi
r)/Modules/posixmodule | |
| 66 | |
| 67 $(GRAMMAR_H): $(GRAMMAR_INPUT) $(PGENSRCS) | |
| 68 @$(MKDIR_P) Include | |
| 69 +ifndef CROSS_COMPILE | |
| 70 $(MAKE) $(PGEN) | |
| 71 +endif | |
| 72 $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) | |
| 73 $(GRAMMAR_C): $(GRAMMAR_H) $(GRAMMAR_INPUT) $(PGENSRCS) | |
| 74 $(MAKE) $(GRAMMAR_H) | |
| 75 touch $(GRAMMAR_C) | |
| 76 | |
| 77 +ifndef CROSS_COMPILE | |
| 78 $(PGEN): $(PGENOBJS) | |
| 79 $(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN) | |
| 80 +endif | |
| 81 | |
| 82 Parser/grammar.o: $(srcdir)/Parser/grammar.c \ | |
| 83 $(srcdir)/Include/token.h \ | |
| 84 @@ -1009,6 +1013,7 @@ libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(src
dir)/Modules/xxmodule.c | |
| 85 $(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \ | |
| 86 $(DESTDIR)$(LIBDEST)/distutils/tests ; \ | |
| 87 fi | |
| 88 +ifndef CROSS_COMPILE | |
| 89 PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ | |
| 90 $(PYTHON_FOR_BUILD) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \ | |
| 91 -d $(LIBDEST) -f \ | |
| 92 @@ -1027,6 +1032,7 @@ libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(src
dir)/Modules/xxmodule.c | |
| 93 $(PYTHON_FOR_BUILD) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py
\ | |
| 94 -d $(LIBDEST)/site-packages -f \ | |
| 95 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages | |
| 96 +endif | |
| 97 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ | |
| 98 $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)
/lib2to3/Grammar.txt | |
| 99 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ | |
| 100 diff --git a/Modules/_ctypes/libffi/configure b/Modules/_ctypes/libffi/configure | |
| 101 index 8230830..1ab4dcb 100755 | |
| 102 --- a/Modules/_ctypes/libffi/configure | |
| 103 +++ b/Modules/_ctypes/libffi/configure | |
| 104 @@ -13393,7 +13393,7 @@ case "$host" in | |
| 105 TARGETDIR=x86 | |
| 106 if test $ac_cv_sizeof_size_t = 4; then | |
| 107 case "$host" in | |
| 108 - *-gnux32) | |
| 109 + *-gnux32 | *-nacl) | |
| 110 TARGET=X86_64 | |
| 111 ;; | |
| 112 *) | |
| 113 diff --git a/Modules/_ctypes/libffi/src/x86/ffi64.c b/Modules/_ctypes/libffi/src
/x86/ffi64.c | |
| 114 index 2014af2..cacf894 100644 | |
| 115 --- a/Modules/_ctypes/libffi/src/x86/ffi64.c | |
| 116 +++ b/Modules/_ctypes/libffi/src/x86/ffi64.c | |
| 117 @@ -202,10 +202,12 @@ classify_argument (ffi_type *type, enum x86_64_reg_class c
lasses[], | |
| 118 case FFI_TYPE_DOUBLE: | |
| 119 classes[0] = X86_64_SSEDF_CLASS; | |
| 120 return 1; | |
| 121 +#if FFI_TYPE_DOUBLE != FFI_TYPE_LONGDOUBLE | |
| 122 case FFI_TYPE_LONGDOUBLE: | |
| 123 classes[0] = X86_64_X87_CLASS; | |
| 124 classes[1] = X86_64_X87UP_CLASS; | |
| 125 return 2; | |
| 126 +#endif | |
| 127 case FFI_TYPE_STRUCT: | |
| 128 { | |
| 129 const int UNITS_PER_WORD = 8; | |
| 130 diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c | |
| 131 index e4885d1..8f27a5b 100644 | |
| 132 --- a/Modules/_testcapimodule.c | |
| 133 +++ b/Modules/_testcapimodule.c | |
| 134 @@ -1278,6 +1278,9 @@ static int test_run_counter = 0; | |
| 135 | |
| 136 static PyObject * | |
| 137 test_datetime_capi(PyObject *self, PyObject *args) { | |
| 138 +#ifdef PyDataTime_STATIC | |
| 139 + Py_RETURN_NONE; | |
| 140 +#else | |
| 141 if (PyDateTimeAPI) { | |
| 142 if (test_run_counter) { | |
| 143 /* Probably regrtest.py -R */ | |
| 144 @@ -1295,6 +1298,7 @@ test_datetime_capi(PyObject *self, PyObject *args) { | |
| 145 Py_RETURN_NONE; | |
| 146 else | |
| 147 return NULL; | |
| 148 +#endif | |
| 149 } | |
| 150 | |
| 151 | |
| 152 diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c | |
| 153 index cd4672c..9bacfad 100644 | |
| 154 --- a/Modules/posixmodule.c | |
| 155 +++ b/Modules/posixmodule.c | |
| 156 @@ -663,9 +663,13 @@ posix_error_with_unicode_filename(Py_UNICODE* name) | |
| 157 | |
| 158 | |
| 159 static PyObject * | |
| 160 -posix_error_with_allocated_filename(char* name) | |
| 161 +posix_error_with_allocated_filename(const char* func, char* name) | |
| 162 { | |
| 163 - PyObject *rc = PyErr_SetFromErrnoWithFilename(PyExc_OSError, name); | |
| 164 + PyObject *rc; | |
| 165 + if (errno == ENOSYS) | |
| 166 + rc = PyErr_SetFromErrnoWithFilename(PyExc_OSError, func); | |
| 167 + else | |
| 168 + rc = PyErr_SetFromErrnoWithFilename(PyExc_OSError, name); | |
| 169 PyMem_Free(name); | |
| 170 return rc; | |
| 171 } | |
| 172 @@ -826,7 +830,7 @@ posix_1str(PyObject *args, char *format, int (*func)(const c
har*)) | |
| 173 res = (*func)(path1); | |
| 174 Py_END_ALLOW_THREADS | |
| 175 if (res < 0) | |
| 176 - return posix_error_with_allocated_filename(path1); | |
| 177 + return posix_error_with_allocated_filename(format, path1); | |
| 178 PyMem_Free(path1); | |
| 179 Py_INCREF(Py_None); | |
| 180 return Py_None; | |
| 181 @@ -1859,7 +1863,7 @@ posix_chmod(PyObject *self, PyObject *args) | |
| 182 res = chmod(path, i); | |
| 183 Py_END_ALLOW_THREADS | |
| 184 if (res < 0) | |
| 185 - return posix_error_with_allocated_filename(path); | |
| 186 + return posix_error_with_allocated_filename("chmod", path); | |
| 187 PyMem_Free(path); | |
| 188 Py_INCREF(Py_None); | |
| 189 return Py_None; | |
| 190 @@ -1906,7 +1910,7 @@ posix_lchmod(PyObject *self, PyObject *args) | |
| 191 res = lchmod(path, i); | |
| 192 Py_END_ALLOW_THREADS | |
| 193 if (res < 0) | |
| 194 - return posix_error_with_allocated_filename(path); | |
| 195 + return posix_error_with_allocated_filename("lchmod", path); | |
| 196 PyMem_Free(path); | |
| 197 Py_RETURN_NONE; | |
| 198 } | |
| 199 @@ -1931,7 +1935,7 @@ posix_chflags(PyObject *self, PyObject *args) | |
| 200 res = chflags(path, flags); | |
| 201 Py_END_ALLOW_THREADS | |
| 202 if (res < 0) | |
| 203 - return posix_error_with_allocated_filename(path); | |
| 204 + return posix_error_with_allocated_filename("chflags", path); | |
| 205 PyMem_Free(path); | |
| 206 Py_INCREF(Py_None); | |
| 207 return Py_None; | |
| 208 @@ -1957,7 +1961,7 @@ posix_lchflags(PyObject *self, PyObject *args) | |
| 209 res = lchflags(path, flags); | |
| 210 Py_END_ALLOW_THREADS | |
| 211 if (res < 0) | |
| 212 - return posix_error_with_allocated_filename(path); | |
| 213 + return posix_error_with_allocated_filename("lchflags", path); | |
| 214 PyMem_Free(path); | |
| 215 Py_INCREF(Py_None); | |
| 216 return Py_None; | |
| 217 @@ -2028,7 +2032,7 @@ posix_chown(PyObject *self, PyObject *args) | |
| 218 res = chown(path, uid, gid); | |
| 219 Py_END_ALLOW_THREADS | |
| 220 if (res < 0) | |
| 221 - return posix_error_with_allocated_filename(path); | |
| 222 + return posix_error_with_allocated_filename("chown", path); | |
| 223 PyMem_Free(path); | |
| 224 Py_INCREF(Py_None); | |
| 225 return Py_None; | |
| 226 @@ -2083,7 +2087,7 @@ posix_lchown(PyObject *self, PyObject *args) | |
| 227 res = lchown(path, uid, gid); | |
| 228 Py_END_ALLOW_THREADS | |
| 229 if (res < 0) | |
| 230 - return posix_error_with_allocated_filename(path); | |
| 231 + return posix_error_with_allocated_filename("lchown", path); | |
| 232 PyMem_Free(path); | |
| 233 Py_INCREF(Py_None); | |
| 234 return Py_None; | |
| 235 @@ -2478,7 +2482,7 @@ posix_listdir(PyObject *self, PyObject *args) | |
| 236 dirp = opendir(name); | |
| 237 Py_END_ALLOW_THREADS | |
| 238 if (dirp == NULL) { | |
| 239 - return posix_error_with_allocated_filename(name); | |
| 240 + return posix_error_with_allocated_filename("listdir", name); | |
| 241 } | |
| 242 if ((d = PyList_New(0)) == NULL) { | |
| 243 Py_BEGIN_ALLOW_THREADS | |
| 244 @@ -2500,7 +2504,7 @@ posix_listdir(PyObject *self, PyObject *args) | |
| 245 closedir(dirp); | |
| 246 Py_END_ALLOW_THREADS | |
| 247 Py_DECREF(d); | |
| 248 - return posix_error_with_allocated_filename(name); | |
| 249 + return posix_error_with_allocated_filename("listdir", name); | |
| 250 } | |
| 251 } | |
| 252 if (ep->d_name[0] == '.' && | |
| 253 @@ -2660,7 +2664,7 @@ posix_mkdir(PyObject *self, PyObject *args) | |
| 254 #endif | |
| 255 Py_END_ALLOW_THREADS | |
| 256 if (res < 0) | |
| 257 - return posix_error_with_allocated_filename(path); | |
| 258 + return posix_error_with_allocated_filename("mkdir", path); | |
| 259 PyMem_Free(path); | |
| 260 Py_INCREF(Py_None); | |
| 261 return Py_None; | |
| 262 @@ -3059,7 +3063,7 @@ done: | |
| 263 #endif /* HAVE_UTIMES */ | |
| 264 } | |
| 265 if (res < 0) { | |
| 266 - return posix_error_with_allocated_filename(path); | |
| 267 + return posix_error_with_allocated_filename("utime", path); | |
| 268 } | |
| 269 PyMem_Free(path); | |
| 270 Py_INCREF(Py_None); | |
| 271 @@ -6316,7 +6320,7 @@ posix_readlink(PyObject *self, PyObject *args) | |
| 272 n = readlink(path, buf, (int) sizeof buf); | |
| 273 Py_END_ALLOW_THREADS | |
| 274 if (n < 0) | |
| 275 - return posix_error_with_allocated_filename(path); | |
| 276 + return posix_error_with_allocated_filename("readlink", path); | |
| 277 | |
| 278 PyMem_Free(path); | |
| 279 v = PyString_FromStringAndSize(buf, n); | |
| 280 @@ -6562,7 +6566,7 @@ posix_open(PyObject *self, PyObject *args) | |
| 281 PyErr_Clear(); | |
| 282 #endif | |
| 283 | |
| 284 - if (!PyArg_ParseTuple(args, "eti|i", | |
| 285 + if (!PyArg_ParseTuple(args, "eti|i:open", | |
| 286 Py_FileSystemDefaultEncoding, &file, | |
| 287 &flag, &mode)) | |
| 288 return NULL; | |
| 289 @@ -6571,7 +6575,7 @@ posix_open(PyObject *self, PyObject *args) | |
| 290 fd = open(file, flag, mode); | |
| 291 Py_END_ALLOW_THREADS | |
| 292 if (fd < 0) | |
| 293 - return posix_error_with_allocated_filename(file); | |
| 294 + return posix_error_with_allocated_filename("open", file); | |
| 295 PyMem_Free(file); | |
| 296 return PyInt_FromLong((long)fd); | |
| 297 } | |
| 298 diff --git a/Modules/pwdmodule.c b/Modules/pwdmodule.c | |
| 299 index c2907f6..faa3ad6 100644 | |
| 300 --- a/Modules/pwdmodule.c | |
| 301 +++ b/Modules/pwdmodule.c | |
| 302 @@ -94,6 +94,29 @@ mkpwent(struct passwd *p) | |
| 303 return v; | |
| 304 } | |
| 305 | |
| 306 +#ifdef __native_client__ | |
| 307 +// python relies on a working version of getpwuid(3) | |
| 308 +// which Native Client does not yet provide. | |
| 309 +// TODO(sbc): This should only really be needed when | |
| 310 +// building for the sel_ldr. It should be possible to | |
| 311 +// use the C-library version (which tries of open files | |
| 312 +// under /etc) when using nacl_io. | |
| 313 +static struct passwd *my_getpwuid(uid_t uid) | |
| 314 +{ | |
| 315 + static struct passwd dummy = { | |
| 316 + "nacl_user", | |
| 317 + "nacl_pass", | |
| 318 + 1, | |
| 319 + 1, | |
| 320 + "NaCl User", | |
| 321 + "/home/nacl_user", | |
| 322 + "/bin/sh", | |
| 323 + }; | |
| 324 + return &dummy; | |
| 325 +} | |
| 326 +#define getpwuid my_getpwuid | |
| 327 +#endif | |
| 328 + | |
| 329 PyDoc_STRVAR(pwd_getpwuid__doc__, | |
| 330 "getpwuid(uid) -> (pw_name,pw_passwd,pw_uid,\n\ | |
| 331 pw_gid,pw_gecos,pw_dir,pw_shell)\n\ | |
| 332 diff --git a/Modules/python.c b/Modules/python.c | |
| 333 index 2739b8b..5a5b753 100644 | |
| 334 --- a/Modules/python.c | |
| 335 +++ b/Modules/python.c | |
| 336 @@ -6,6 +6,19 @@ | |
| 337 #include <floatingpoint.h> | |
| 338 #endif | |
| 339 | |
| 340 +#ifdef __native_client__ | |
| 341 +#include <stdio.h> | |
| 342 +#include <sys/utsname.h> | |
| 343 + | |
| 344 +// Dummy implementation of uname. This is only needed for the sel_ldr | |
| 345 +// version of python. Otherwise it gets provided by nacl_io. | |
| 346 +int uname(struct utsname *buf) | |
| 347 +{ | |
| 348 + sprintf(buf->sysname, "NaCl"); | |
| 349 + return 0; | |
| 350 +} | |
| 351 +#endif | |
| 352 + | |
| 353 int | |
| 354 main(int argc, char **argv) | |
| 355 { | |
| 356 @@ -20,5 +33,9 @@ main(int argc, char **argv) | |
| 357 m = fpgetmask(); | |
| 358 fpsetmask(m & ~FP_X_OFL); | |
| 359 #endif | |
| 360 +#ifdef __native_client__ | |
| 361 + setvbuf(stdout, NULL, _IOLBF, 0); | |
| 362 + setvbuf(stdin, NULL, _IOLBF, 0); | |
| 363 +#endif | |
| 364 return Py_Main(argc, argv); | |
| 365 } | |
| 366 diff --git a/Modules/timemodule.c b/Modules/timemodule.c | |
| 367 index 12c43b0..b727afa 100644 | |
| 368 --- a/Modules/timemodule.c | |
| 369 +++ b/Modules/timemodule.c | |
| 370 @@ -34,6 +34,11 @@ extern int ftime(struct timeb *); | |
| 371 #endif /* MS_WINDOWS */ | |
| 372 #endif /* HAVE_FTIME */ | |
| 373 | |
| 374 +#if defined(__native_client__) && !defined(__GLIBC__) | |
| 375 +#define timezone _timezone | |
| 376 +#define daylight _daylight | |
| 377 +#endif | |
| 378 + | |
| 379 #if defined(__WATCOMC__) && !defined(__QNX__) | |
| 380 #include <i86.h> | |
| 381 #else | |
| 382 diff --git a/Python/dynload_shlib.c b/Python/dynload_shlib.c | |
| 383 index 17ebab1..93ea45d 100644 | |
| 384 --- a/Python/dynload_shlib.c | |
| 385 +++ b/Python/dynload_shlib.c | |
| 386 @@ -84,6 +84,11 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const
char *shortname, | |
| 387 PyOS_snprintf(funcname, sizeof(funcname), | |
| 388 LEAD_UNDERSCORE "init%.200s", shortname); | |
| 389 | |
| 390 + | |
| 391 +/* Native Client's fstat() imlemenation doesn't set st_dev | |
| 392 + * and st_ino correctly so disable the dlopen handle cache. | |
| 393 + * TODO(sbc): fix NaCl's fstat() */ | |
| 394 +#ifndef __native_client__ | |
| 395 if (fp != NULL) { | |
| 396 int i; | |
| 397 struct stat statb; | |
| 398 @@ -107,6 +112,7 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, cons
t char *shortname, | |
| 399 #endif | |
| 400 } | |
| 401 } | |
| 402 +#endif | |
| 403 | |
| 404 #if !(defined(PYOS_OS2) && defined(PYCC_GCC)) | |
| 405 dlopenflags = PyThreadState_GET()->interp->dlopenflags; | |
| 406 diff --git a/Python/getversion.c b/Python/getversion.c | |
| 407 index 7bd6efd..b4f6702 100644 | |
| 408 --- a/Python/getversion.c | |
| 409 +++ b/Python/getversion.c | |
| 410 @@ -8,8 +8,8 @@ | |
| 411 const char * | |
| 412 Py_GetVersion(void) | |
| 413 { | |
| 414 - static char version[250]; | |
| 415 - PyOS_snprintf(version, sizeof(version), "%.80s (%.80s) %.80s", | |
| 416 + static char version[270]; | |
| 417 + PyOS_snprintf(version, sizeof(version), "%.80s (%.80s) %.100s", | |
| 418 PY_VERSION, Py_GetBuildInfo(), Py_GetCompiler()); | |
| 419 return version; | |
| 420 } | |
| 421 diff --git a/Python/thread.c b/Python/thread.c | |
| 422 index dd333e8..33fec81 100644 | |
| 423 --- a/Python/thread.c | |
| 424 +++ b/Python/thread.c | |
| 425 @@ -14,9 +14,19 @@ | |
| 426 library (e.g. gnu pth in pthread emulation) */ | |
| 427 # ifdef HAVE_PTHREAD_H | |
| 428 # include <pthread.h> /* _POSIX_THREADS */ | |
| 429 +# if defined __native_client__ && !defined __GLIBC__ | |
| 430 + /* Under NaCl newlib neither pthread.h nor unistd.h defines _POSIX_THREADS
. | |
| 431 + However this file expects it to be defined if pthreads are present so w
e | |
| 432 + define it here after including pthread.h | |
| 433 + TODO(sbc): remove this hack once newlib is fixed: | |
| 434 + https://code.google.com/p/nativeclient/issues/detail?id=3551 | |
| 435 + */ | |
| 436 +# define _POSIX_THREADS | |
| 437 +# endif | |
| 438 # endif | |
| 439 #endif | |
| 440 | |
| 441 + | |
| 442 #ifndef DONT_HAVE_STDIO_H | |
| 443 #include <stdio.h> | |
| 444 #endif | |
| 445 diff --git a/configure b/configure | |
| 446 index 2e32be2..2140ece 100755 | |
| 447 --- a/configure | |
| 448 +++ b/configure | |
| 449 @@ -2861,19 +2861,27 @@ if test "$cross_compiling" = yes; then | |
| 450 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for python interpreter fo
r cross build" >&5 | |
| 451 $as_echo_n "checking for python interpreter for cross build... " >&6; } | |
| 452 if test -z "$PYTHON_FOR_BUILD"; then | |
| 453 - for interp in python$PACKAGE_VERSION python2 python; do | |
| 454 - which $interp >/dev/null 2>&1 || continue | |
| 455 - if $interp -c 'import sys;sys.exit(not (sys.version_info[:2] >= (2,7
) and sys.version_info[0] < 3))'; then | |
| 456 - break | |
| 457 - fi | |
| 458 - interp= | |
| 459 - done | |
| 460 + case "$host" in | |
| 461 + *-*-nacl*) | |
| 462 + interp=$(cd ../build-nacl-host && pwd)/python.exe | |
| 463 + if [ ! -f $interp ]; then interp=$(cd ../build-nacl-host && pwd)/pyt
hon; fi | |
| 464 + ;; | |
| 465 + *) | |
| 466 + for interp in python$PACKAGE_VERSION python2 python; do | |
| 467 + which $interp >/dev/null 2>&1 || continue | |
| 468 + if $interp -c 'import sys;sys.exit(not (sys.version_info@<:@:2@:
>@ >= (2,7) and sys.version_info@<:@0@:>@ < 3))'; then | |
| 469 + break | |
| 470 + fi | |
| 471 + interp= | |
| 472 + done | |
| 473 + ;; | |
| 474 + esac | |
| 475 if test x$interp = x; then | |
| 476 as_fn_error $? "python$PACKAGE_VERSION interpreter not found" "$LINE
NO" 5 | |
| 477 fi | |
| 478 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $interp" >&5 | |
| 479 $as_echo "$interp" >&6; } | |
| 480 - PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLAT
FORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo
$(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib:$(srcdir)/Lib/plat-$(MACHDEP
) '$interp | |
| 481 + PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLAT
FORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo
$(abs_builddir)/`cat pybuilddir.txt`:)$(abs_srcdir)/Lib:$(abs_srcdir)/Lib/plat-$
(MACHDEP) '$interp | |
| 482 fi | |
| 483 elif test "$cross_compiling" = maybe; then | |
| 484 as_fn_error $? "Cross compiling required --host=HOST-TUPLE and --build=ARCH
" "$LINENO" 5 | |
| 485 @@ -3177,6 +3185,9 @@ then | |
| 486 # `define_xopen_source' in the case statement below. For the | |
| 487 # current supported cross builds, this macro is not adjusted. | |
| 488 case "$host" in | |
| 489 + *-*-nacl*) | |
| 490 + ac_sys_system=NaCl | |
| 491 + ;; | |
| 492 *-*-linux*) | |
| 493 ac_sys_system=Linux | |
| 494 ;; | |
| 495 @@ -3226,6 +3237,15 @@ if test "$cross_compiling" = yes; then | |
| 496 _host_cpu=$host_cpu | |
| 497 esac | |
| 498 ;; | |
| 499 + *-*-nacl*) | |
| 500 + case "$host_cpu" in | |
| 501 + arm*) | |
| 502 + _host_cpu=arm | |
| 503 + ;; | |
| 504 + *) | |
| 505 + _host_cpu=$host_cpu | |
| 506 + esac | |
| 507 + ;; | |
| 508 *-*-cygwin*) | |
| 509 _host_cpu= | |
| 510 ;; | |
| 511 @@ -8235,7 +8255,7 @@ then | |
| 512 fi | |
| 513 fi | |
| 514 ;; | |
| 515 - Linux*|GNU*|QNX*) | |
| 516 + Linux*|GNU*|QNX*|NaCl*) | |
| 517 LDSHARED='$(CC) -shared' | |
| 518 LDCXXSHARED='$(CXX) -shared';; | |
| 519 BSD/OS*/4*) | |
| 520 @@ -8309,7 +8329,7 @@ then | |
| 521 then CCSHARED="-fPIC"; | |
| 522 else CCSHARED="+z"; | |
| 523 fi;; | |
| 524 - Linux*|GNU*) CCSHARED="-fPIC";; | |
| 525 + Linux*|GNU*|NaCl*) CCSHARED="-fPIC";; | |
| 526 BSD/OS*/4*) CCSHARED="-fpic";; | |
| 527 FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) CCSHARED="-fPIC";; | |
| 528 OpenUNIX*|UnixWare*) | |
| 529 @@ -8343,7 +8363,7 @@ then | |
| 530 LINKFORSHARED="-Wl,-E -Wl,+s";; | |
| 531 # LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";; | |
| 532 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";; | |
| 533 - Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";; | |
| 534 + Linux*|GNU*|NaCl*) LINKFORSHARED="-Xlinker -export-dynamic";; | |
| 535 # -u libsys_s pulls in all symbols in libsys | |
| 536 Darwin/*) | |
| 537 # -u _PyMac_Error is needed to pull in the mac toolbox glue, | |
| 538 diff --git a/configure.ac b/configure.ac | |
| 539 index ee7e5fc..eacd03d 100644 | |
| 540 --- a/configure.ac | |
| 541 +++ b/configure.ac | |
| 542 @@ -19,18 +19,25 @@ AC_SUBST(host) | |
| 543 if test "$cross_compiling" = yes; then | |
| 544 AC_MSG_CHECKING([for python interpreter for cross build]) | |
| 545 if test -z "$PYTHON_FOR_BUILD"; then | |
| 546 - for interp in python$PACKAGE_VERSION python2 python; do | |
| 547 - which $interp >/dev/null 2>&1 || continue | |
| 548 - if $interp -c 'import sys;sys.exit(not (sys.version_info@<:@:2@:>@ >
= (2,7) and sys.version_info@<:@0@:>@ < 3))'; then | |
| 549 - break | |
| 550 - fi | |
| 551 - interp= | |
| 552 - done | |
| 553 + case "$host" in | |
| 554 + *-*-nacl*) | |
| 555 + interp=$(cd ../build-nacl-host && pwd)/python | |
| 556 + ;; | |
| 557 + *) | |
| 558 + for interp in python$PACKAGE_VERSION python2 python; do | |
| 559 + which $interp >/dev/null 2>&1 || continue | |
| 560 + if $interp -c 'import sys;sys.exit(not (sys.version_info@<:@:2@:
>@ >= (2,7) and sys.version_info@<:@0@:>@ < 3))'; then | |
| 561 + break | |
| 562 + fi | |
| 563 + interp= | |
| 564 + done | |
| 565 + ;; | |
| 566 + esac | |
| 567 if test x$interp = x; then | |
| 568 AC_MSG_ERROR([python$PACKAGE_VERSION interpreter not found]) | |
| 569 fi | |
| 570 AC_MSG_RESULT($interp) | |
| 571 - PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLAT
FORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo
$(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib:$(srcdir)/Lib/plat-$(MACHDEP
) '$interp | |
| 572 + PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLAT
FORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo
$(abs_builddir)/`cat pybuilddir.txt`:)$(abs_srcdir)/Lib:$(abs_srcdir)/Lib/plat-$
(MACHDEP) '$interp | |
| 573 fi | |
| 574 elif test "$cross_compiling" = maybe; then | |
| 575 AC_MSG_ERROR([Cross compiling required --host=HOST-TUPLE and --build=ARCH]) | |
| 576 @@ -319,6 +326,9 @@ then | |
| 577 *-*-cygwin*) | |
| 578 ac_sys_system=Cygwin | |
| 579 ;; | |
| 580 + *-*-nacl*) | |
| 581 + ac_sys_system=NaCl | |
| 582 + ;; | |
| 583 *) | |
| 584 # for now, limit cross builds to known configurations | |
| 585 MACHDEP="unknown" | |
| 586 @@ -362,6 +372,15 @@ if test "$cross_compiling" = yes; then | |
| 587 _host_cpu=$host_cpu | |
| 588 esac | |
| 589 ;; | |
| 590 + *-*-nacl*) | |
| 591 + case "$host_cpu" in | |
| 592 + arm*) | |
| 593 + _host_cpu=arm | |
| 594 + ;; | |
| 595 + *) | |
| 596 + _host_cpu=$host_cpu | |
| 597 + esac | |
| 598 + ;; | |
| 599 *-*-cygwin*) | |
| 600 _host_cpu= | |
| 601 ;; | |
| 602 @@ -2017,7 +2036,7 @@ then | |
| 603 fi | |
| 604 fi | |
| 605 ;; | |
| 606 - Linux*|GNU*|QNX*) | |
| 607 + Linux*|GNU*|QNX*|NaCl*) | |
| 608 LDSHARED='$(CC) -shared' | |
| 609 LDCXXSHARED='$(CXX) -shared';; | |
| 610 BSD/OS*/4*) | |
| 611 @@ -2089,7 +2108,7 @@ then | |
| 612 then CCSHARED="-fPIC"; | |
| 613 else CCSHARED="+z"; | |
| 614 fi;; | |
| 615 - Linux*|GNU*) CCSHARED="-fPIC";; | |
| 616 + Linux*|GNU*|NaCl*) CCSHARED="-fPIC";; | |
| 617 BSD/OS*/4*) CCSHARED="-fpic";; | |
| 618 FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) CCSHARED="-fPIC";; | |
| 619 OpenUNIX*|UnixWare*) | |
| 620 @@ -2121,7 +2140,7 @@ then | |
| 621 LINKFORSHARED="-Wl,-E -Wl,+s";; | |
| 622 # LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";; | |
| 623 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";; | |
| 624 - Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";; | |
| 625 + Linux*|GNU*|NaCl*) LINKFORSHARED="-Xlinker -export-dynamic";; | |
| 626 # -u libsys_s pulls in all symbols in libsys | |
| 627 Darwin/*) | |
| 628 # -u _PyMac_Error is needed to pull in the mac toolbox glue, | |
| 629 diff --git a/setup.py b/setup.py | |
| 630 index 2b4119a..a3a70cc 100644 | |
| 631 --- a/setup.py | |
| 632 +++ b/setup.py | |
| 633 @@ -1404,7 +1404,9 @@ class PyBuildExt(build_ext): | |
| 634 version = line.split()[2] | |
| 635 break | |
| 636 if version >= version_req: | |
| 637 - if (self.compiler.find_library_file(lib_dirs, 'z')): | |
| 638 + # Unconditionally try to link zlib. | |
| 639 + # Changing the library path seems to provoke other issues. | |
| 640 + if True or (self.compiler.find_library_file(lib_dirs, 'z')): | |
| 641 if host_platform == "darwin": | |
| 642 zlib_extra_link_args = ('-Wl,-search_paths_first',) | |
| 643 else: | |
| OLD | NEW |