OLD | NEW |
(Empty) | |
| 1 diff --git a/Include/datetime.h b/Include/datetime.h |
| 2 index 47abe5c..4884e79 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..e90c38f 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 9d55550..09e7a69 100644 |
| 63 --- a/Makefile.pre.in |
| 64 +++ b/Makefile.pre.in |
| 65 @@ -592,14 +592,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 @@ -1000,6 +1004,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 @@ -1018,6 +1023,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 b0386f0..a5c77b4 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 65ade9f..1a971dc 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 @@ -6286,7 +6290,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 @@ -6532,7 +6536,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 @@ -6541,7 +6545,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 dc0dfd0..d45f7b0 100755 |
| 447 --- a/configure |
| 448 +++ b/configure |
| 449 @@ -2853,19 +2853,26 @@ 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 |
| 463 + ;; |
| 464 + *) |
| 465 + for interp in python$PACKAGE_VERSION python2 python; do |
| 466 + which $interp >/dev/null 2>&1 || continue |
| 467 + if $interp -c 'import sys;sys.exit(not (sys.version_info@<:@:2@:
>@ >= (2,7) and sys.version_info@<:@0@:>@ < 3))'; then |
| 468 + break |
| 469 + fi |
| 470 + interp= |
| 471 + done |
| 472 + ;; |
| 473 + esac |
| 474 if test x$interp = x; then |
| 475 as_fn_error $? "python$PACKAGE_VERSION interpreter not found" "$LINE
NO" 5 |
| 476 fi |
| 477 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $interp" >&5 |
| 478 $as_echo "$interp" >&6; } |
| 479 - 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 |
| 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`:)$(abs_srcdir)/Lib:$(abs_srcdir)/Lib/plat-$
(MACHDEP) '$interp |
| 481 fi |
| 482 elif test "$cross_compiling" = maybe; then |
| 483 as_fn_error $? "Cross compiling required --host=HOST-TUPLE and --build=ARCH
" "$LINENO" 5 |
| 484 @@ -3168,6 +3175,9 @@ then |
| 485 # `define_xopen_source' in the case statement below. For the |
| 486 # current supported cross builds, this macro is not adjusted. |
| 487 case "$host" in |
| 488 + *-*-nacl*) |
| 489 + ac_sys_system=NaCl |
| 490 + ;; |
| 491 *-*-linux*) |
| 492 ac_sys_system=Linux |
| 493 ;; |
| 494 @@ -3217,6 +3227,15 @@ if test "$cross_compiling" = yes; then |
| 495 _host_cpu=$host_cpu |
| 496 esac |
| 497 ;; |
| 498 + *-*-nacl*) |
| 499 + case "$host_cpu" in |
| 500 + arm*) |
| 501 + _host_cpu=arm |
| 502 + ;; |
| 503 + *) |
| 504 + _host_cpu=$host_cpu |
| 505 + esac |
| 506 + ;; |
| 507 *-*-cygwin*) |
| 508 _host_cpu= |
| 509 ;; |
| 510 @@ -8246,7 +8265,7 @@ then |
| 511 fi |
| 512 fi |
| 513 ;; |
| 514 - Linux*|GNU*|QNX*) |
| 515 + Linux*|GNU*|QNX*|NaCl*) |
| 516 LDSHARED='$(CC) -shared' |
| 517 LDCXXSHARED='$(CXX) -shared';; |
| 518 BSD/OS*/4*) |
| 519 @@ -8320,7 +8339,7 @@ then |
| 520 then CCSHARED="-fPIC"; |
| 521 else CCSHARED="+z"; |
| 522 fi;; |
| 523 - Linux*|GNU*) CCSHARED="-fPIC";; |
| 524 + Linux*|GNU*|NaCl*) CCSHARED="-fPIC";; |
| 525 BSD/OS*/4*) CCSHARED="-fpic";; |
| 526 FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) CCSHARED="-fPIC";; |
| 527 OpenUNIX*|UnixWare*) |
| 528 @@ -8354,7 +8373,7 @@ then |
| 529 LINKFORSHARED="-Wl,-E -Wl,+s";; |
| 530 # LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";; |
| 531 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";; |
| 532 - Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";; |
| 533 + Linux*|GNU*|NaCl*) LINKFORSHARED="-Xlinker -export-dynamic";; |
| 534 # -u libsys_s pulls in all symbols in libsys |
| 535 Darwin/*) |
| 536 # -u _PyMac_Error is needed to pull in the mac toolbox glue, |
| 537 diff --git a/configure.ac b/configure.ac |
| 538 index 30f5bf4..4a8f64c 100644 |
| 539 --- a/configure.ac |
| 540 +++ b/configure.ac |
| 541 @@ -19,18 +19,25 @@ AC_SUBST(host) |
| 542 if test "$cross_compiling" = yes; then |
| 543 AC_MSG_CHECKING([for python interpreter for cross build]) |
| 544 if test -z "$PYTHON_FOR_BUILD"; then |
| 545 - for interp in python$PACKAGE_VERSION python2 python; do |
| 546 - which $interp >/dev/null 2>&1 || continue |
| 547 - if $interp -c 'import sys;sys.exit(not (sys.version_info@<:@:2@:>@ >
= (2,7) and sys.version_info@<:@0@:>@ < 3))'; then |
| 548 - break |
| 549 - fi |
| 550 - interp= |
| 551 - done |
| 552 + case "$host" in |
| 553 + *-*-nacl*) |
| 554 + interp=$(cd ../build-nacl-host && pwd)/python |
| 555 + ;; |
| 556 + *) |
| 557 + for interp in python$PACKAGE_VERSION python2 python; do |
| 558 + which $interp >/dev/null 2>&1 || continue |
| 559 + if $interp -c 'import sys;sys.exit(not (sys.version_info@<:@:2@:
>@ >= (2,7) and sys.version_info@<:@0@:>@ < 3))'; then |
| 560 + break |
| 561 + fi |
| 562 + interp= |
| 563 + done |
| 564 + ;; |
| 565 + esac |
| 566 if test x$interp = x; then |
| 567 AC_MSG_ERROR([python$PACKAGE_VERSION interpreter not found]) |
| 568 fi |
| 569 AC_MSG_RESULT($interp) |
| 570 - 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 |
| 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`:)$(abs_srcdir)/Lib:$(abs_srcdir)/Lib/plat-$
(MACHDEP) '$interp |
| 572 fi |
| 573 elif test "$cross_compiling" = maybe; then |
| 574 AC_MSG_ERROR([Cross compiling required --host=HOST-TUPLE and --build=ARCH]) |
| 575 @@ -318,6 +325,9 @@ then |
| 576 *-*-cygwin*) |
| 577 ac_sys_system=Cygwin |
| 578 ;; |
| 579 + *-*-nacl*) |
| 580 + ac_sys_system=NaCl |
| 581 + ;; |
| 582 *) |
| 583 # for now, limit cross builds to known configurations |
| 584 MACHDEP="unknown" |
| 585 @@ -361,6 +371,15 @@ if test "$cross_compiling" = yes; then |
| 586 _host_cpu=$host_cpu |
| 587 esac |
| 588 ;; |
| 589 + *-*-nacl*) |
| 590 + case "$host_cpu" in |
| 591 + arm*) |
| 592 + _host_cpu=arm |
| 593 + ;; |
| 594 + *) |
| 595 + _host_cpu=$host_cpu |
| 596 + esac |
| 597 + ;; |
| 598 *-*-cygwin*) |
| 599 _host_cpu= |
| 600 ;; |
| 601 @@ -2024,7 +2043,7 @@ then |
| 602 fi |
| 603 fi |
| 604 ;; |
| 605 - Linux*|GNU*|QNX*) |
| 606 + Linux*|GNU*|QNX*|NaCl*) |
| 607 LDSHARED='$(CC) -shared' |
| 608 LDCXXSHARED='$(CXX) -shared';; |
| 609 BSD/OS*/4*) |
| 610 @@ -2096,7 +2115,7 @@ then |
| 611 then CCSHARED="-fPIC"; |
| 612 else CCSHARED="+z"; |
| 613 fi;; |
| 614 - Linux*|GNU*) CCSHARED="-fPIC";; |
| 615 + Linux*|GNU*|NaCl*) CCSHARED="-fPIC";; |
| 616 BSD/OS*/4*) CCSHARED="-fpic";; |
| 617 FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) CCSHARED="-fPIC";; |
| 618 OpenUNIX*|UnixWare*) |
| 619 @@ -2128,7 +2147,7 @@ then |
| 620 LINKFORSHARED="-Wl,-E -Wl,+s";; |
| 621 # LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";; |
| 622 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";; |
| 623 - Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";; |
| 624 + Linux*|GNU*|NaCl*) LINKFORSHARED="-Xlinker -export-dynamic";; |
| 625 # -u libsys_s pulls in all symbols in libsys |
| 626 Darwin/*) |
| 627 # -u _PyMac_Error is needed to pull in the mac toolbox glue, |
OLD | NEW |