| diff --git a/Include/datetime.h b/Include/datetime.h |
| --- a/Include/datetime.h |
| +++ b/Include/datetime.h |
| @@ -166,6 +166,8 @@ typedef struct { |
| |
| #ifdef Py_BUILD_CORE |
| |
| +#define PyDataTime_STATIC 1 |
| + |
| /* Macros for type checking when building the Python core. */ |
| #define PyDate_Check(op) PyObject_TypeCheck(op, &PyDateTime_DateType) |
| #define PyDate_CheckExact(op) (Py_TYPE(op) == &PyDateTime_DateType) |
| diff --git a/Lib/platform.py b/Lib/platform.py |
| --- a/Lib/platform.py |
| +++ b/Lib/platform.py |
| @@ -1001,7 +1001,7 @@ def _syscmd_uname(option,default=''): |
| |
| """ Interface to the system's uname command. |
| """ |
| - if sys.platform in ('dos','win32','win16','os2'): |
| + if sys.platform in ('dos','win32','win16','os2','nacl'): |
| # XXX Others too ? |
| return default |
| try: |
| diff --git a/Lib/subprocess.py b/Lib/subprocess.py |
| --- a/Lib/subprocess.py |
| +++ b/Lib/subprocess.py |
| @@ -388,6 +388,7 @@ except that: |
| |
| import sys |
| mswindows = (sys.platform == "win32") |
| +nacl = (sys.platform == "nacl") |
| |
| import os |
| import types |
| @@ -1198,7 +1199,10 @@ class Popen(object): |
| args = list(args) |
| |
| if shell: |
| - args = ["/bin/sh", "-c"] + args |
| + if nacl: |
| + args = ["bash", "-c"] + args |
| + else: |
| + args = ["/bin/sh", "-c"] + args |
| if executable: |
| args[0] = executable |
| |
| @@ -1209,6 +1213,15 @@ class Popen(object): |
| os.close(fd) |
| to_close.remove(fd) |
| |
| + # TODO(bradnelson,sbc): Add support for pipes. |
| + if nacl: |
| + if env is None: |
| + self.pid = os.spawnv(os.P_NOWAIT, executable, args) |
| + else: |
| + self.pid = os.spawnve(os.P_NOWAIT, executable, args, env) |
| + self._child_created = True |
| + return |
| + |
| # For transferring possible exec failure from child to parent |
| # The first char specifies the exception type: 0 means |
| # OSError, 1 means some other error. |
| diff --git a/Makefile.pre.in b/Makefile.pre.in |
| --- a/Makefile.pre.in |
| +++ b/Makefile.pre.in |
| @@ -597,14 +597,18 @@ Modules/pwdmodule.o: $(srcdir)/Modules/pwdmodule.c $(srcdir)/Modules/posixmodule |
| |
| $(GRAMMAR_H): $(GRAMMAR_INPUT) $(PGENSRCS) |
| @$(MKDIR_P) Include |
| +ifndef CROSS_COMPILE |
| $(MAKE) $(PGEN) |
| +endif |
| $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) |
| $(GRAMMAR_C): $(GRAMMAR_H) $(GRAMMAR_INPUT) $(PGENSRCS) |
| $(MAKE) $(GRAMMAR_H) |
| touch $(GRAMMAR_C) |
| |
| +ifndef CROSS_COMPILE |
| $(PGEN): $(PGENOBJS) |
| $(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN) |
| +endif |
| |
| Parser/grammar.o: $(srcdir)/Parser/grammar.c \ |
| $(srcdir)/Include/token.h \ |
| @@ -1009,6 +1013,7 @@ libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c |
| $(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \ |
| $(DESTDIR)$(LIBDEST)/distutils/tests ; \ |
| fi |
| +ifndef CROSS_COMPILE |
| PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ |
| $(PYTHON_FOR_BUILD) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \ |
| -d $(LIBDEST) -f \ |
| @@ -1027,6 +1032,7 @@ libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c |
| $(PYTHON_FOR_BUILD) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \ |
| -d $(LIBDEST)/site-packages -f \ |
| -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages |
| +endif |
| -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ |
| $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt |
| -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ |
| diff --git a/Modules/_ctypes/libffi/configure b/Modules/_ctypes/libffi/configure |
| --- a/Modules/_ctypes/libffi/configure |
| +++ b/Modules/_ctypes/libffi/configure |
| @@ -13393,7 +13393,7 @@ case "$host" in |
| TARGETDIR=x86 |
| if test $ac_cv_sizeof_size_t = 4; then |
| case "$host" in |
| - *-gnux32) |
| + *-gnux32 | *-nacl) |
| TARGET=X86_64 |
| ;; |
| *) |
| diff --git a/Modules/_ctypes/libffi/src/x86/ffi64.c b/Modules/_ctypes/libffi/src/x86/ffi64.c |
| --- a/Modules/_ctypes/libffi/src/x86/ffi64.c |
| +++ b/Modules/_ctypes/libffi/src/x86/ffi64.c |
| @@ -202,10 +202,12 @@ classify_argument (ffi_type *type, enum x86_64_reg_class classes[], |
| case FFI_TYPE_DOUBLE: |
| classes[0] = X86_64_SSEDF_CLASS; |
| return 1; |
| +#if FFI_TYPE_DOUBLE != FFI_TYPE_LONGDOUBLE |
| case FFI_TYPE_LONGDOUBLE: |
| classes[0] = X86_64_X87_CLASS; |
| classes[1] = X86_64_X87UP_CLASS; |
| return 2; |
| +#endif |
| case FFI_TYPE_STRUCT: |
| { |
| const int UNITS_PER_WORD = 8; |
| diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c |
| --- a/Modules/_testcapimodule.c |
| +++ b/Modules/_testcapimodule.c |
| @@ -1278,6 +1278,9 @@ static int test_run_counter = 0; |
| |
| static PyObject * |
| test_datetime_capi(PyObject *self, PyObject *args) { |
| +#ifdef PyDataTime_STATIC |
| + Py_RETURN_NONE; |
| +#else |
| if (PyDateTimeAPI) { |
| if (test_run_counter) { |
| /* Probably regrtest.py -R */ |
| @@ -1295,6 +1298,7 @@ test_datetime_capi(PyObject *self, PyObject *args) { |
| Py_RETURN_NONE; |
| else |
| return NULL; |
| +#endif |
| } |
| |
| |
| diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c |
| --- a/Modules/posixmodule.c |
| +++ b/Modules/posixmodule.c |
| @@ -216,6 +216,13 @@ extern int lstat(const char *, struct stat *); |
| |
| #endif /* !_MSC_VER */ |
| |
| +#if defined(__native_client__) |
| +#include <spawn.h> |
| +#if !defined(HAVE_SPAWNV) |
| +#define HAVE_SPAWNV 1 |
| +#endif /* !defined(HAVE_SPAWNV) */ |
| +#endif /* defined(__native_client__) */ |
| + |
| #ifdef HAVE_UTIME_H |
| #include <utime.h> |
| #endif /* HAVE_UTIME_H */ |
| @@ -663,9 +670,13 @@ posix_error_with_unicode_filename(Py_UNICODE* name) |
| |
| |
| static PyObject * |
| -posix_error_with_allocated_filename(char* name) |
| +posix_error_with_allocated_filename(const char* func, char* name) |
| { |
| - PyObject *rc = PyErr_SetFromErrnoWithFilename(PyExc_OSError, name); |
| + PyObject *rc; |
| + if (errno == ENOSYS) |
| + rc = PyErr_SetFromErrnoWithFilename(PyExc_OSError, func); |
| + else |
| + rc = PyErr_SetFromErrnoWithFilename(PyExc_OSError, name); |
| PyMem_Free(name); |
| return rc; |
| } |
| @@ -826,7 +837,7 @@ posix_1str(PyObject *args, char *format, int (*func)(const char*)) |
| res = (*func)(path1); |
| Py_END_ALLOW_THREADS |
| if (res < 0) |
| - return posix_error_with_allocated_filename(path1); |
| + return posix_error_with_allocated_filename(format, path1); |
| PyMem_Free(path1); |
| Py_INCREF(Py_None); |
| return Py_None; |
| @@ -1859,7 +1870,7 @@ posix_chmod(PyObject *self, PyObject *args) |
| res = chmod(path, i); |
| Py_END_ALLOW_THREADS |
| if (res < 0) |
| - return posix_error_with_allocated_filename(path); |
| + return posix_error_with_allocated_filename("chmod", path); |
| PyMem_Free(path); |
| Py_INCREF(Py_None); |
| return Py_None; |
| @@ -1906,7 +1917,7 @@ posix_lchmod(PyObject *self, PyObject *args) |
| res = lchmod(path, i); |
| Py_END_ALLOW_THREADS |
| if (res < 0) |
| - return posix_error_with_allocated_filename(path); |
| + return posix_error_with_allocated_filename("lchmod", path); |
| PyMem_Free(path); |
| Py_RETURN_NONE; |
| } |
| @@ -1931,7 +1942,7 @@ posix_chflags(PyObject *self, PyObject *args) |
| res = chflags(path, flags); |
| Py_END_ALLOW_THREADS |
| if (res < 0) |
| - return posix_error_with_allocated_filename(path); |
| + return posix_error_with_allocated_filename("chflags", path); |
| PyMem_Free(path); |
| Py_INCREF(Py_None); |
| return Py_None; |
| @@ -1957,7 +1968,7 @@ posix_lchflags(PyObject *self, PyObject *args) |
| res = lchflags(path, flags); |
| Py_END_ALLOW_THREADS |
| if (res < 0) |
| - return posix_error_with_allocated_filename(path); |
| + return posix_error_with_allocated_filename("lchflags", path); |
| PyMem_Free(path); |
| Py_INCREF(Py_None); |
| return Py_None; |
| @@ -2028,7 +2039,7 @@ posix_chown(PyObject *self, PyObject *args) |
| res = chown(path, uid, gid); |
| Py_END_ALLOW_THREADS |
| if (res < 0) |
| - return posix_error_with_allocated_filename(path); |
| + return posix_error_with_allocated_filename("chown", path); |
| PyMem_Free(path); |
| Py_INCREF(Py_None); |
| return Py_None; |
| @@ -2083,7 +2094,7 @@ posix_lchown(PyObject *self, PyObject *args) |
| res = lchown(path, uid, gid); |
| Py_END_ALLOW_THREADS |
| if (res < 0) |
| - return posix_error_with_allocated_filename(path); |
| + return posix_error_with_allocated_filename("lchown", path); |
| PyMem_Free(path); |
| Py_INCREF(Py_None); |
| return Py_None; |
| @@ -2478,7 +2489,7 @@ posix_listdir(PyObject *self, PyObject *args) |
| dirp = opendir(name); |
| Py_END_ALLOW_THREADS |
| if (dirp == NULL) { |
| - return posix_error_with_allocated_filename(name); |
| + return posix_error_with_allocated_filename("listdir", name); |
| } |
| if ((d = PyList_New(0)) == NULL) { |
| Py_BEGIN_ALLOW_THREADS |
| @@ -2500,7 +2511,7 @@ posix_listdir(PyObject *self, PyObject *args) |
| closedir(dirp); |
| Py_END_ALLOW_THREADS |
| Py_DECREF(d); |
| - return posix_error_with_allocated_filename(name); |
| + return posix_error_with_allocated_filename("listdir", name); |
| } |
| } |
| if (ep->d_name[0] == '.' && |
| @@ -2660,7 +2671,7 @@ posix_mkdir(PyObject *self, PyObject *args) |
| #endif |
| Py_END_ALLOW_THREADS |
| if (res < 0) |
| - return posix_error_with_allocated_filename(path); |
| + return posix_error_with_allocated_filename("mkdir", path); |
| PyMem_Free(path); |
| Py_INCREF(Py_None); |
| return Py_None; |
| @@ -3059,7 +3070,7 @@ done: |
| #endif /* HAVE_UTIMES */ |
| } |
| if (res < 0) { |
| - return posix_error_with_allocated_filename(path); |
| + return posix_error_with_allocated_filename("utime", path); |
| } |
| PyMem_Free(path); |
| Py_INCREF(Py_None); |
| @@ -3376,7 +3387,7 @@ posix_spawnv(PyObject *self, PyObject *args) |
| } |
| argvlist[argc] = NULL; |
| |
| -#if defined(PYOS_OS2) && defined(PYCC_GCC) |
| +#if (defined(PYOS_OS2) && defined(PYCC_GCC)) || defined(__native_client__) |
| Py_BEGIN_ALLOW_THREADS |
| spawnval = spawnv(mode, path, argvlist); |
| Py_END_ALLOW_THREADS |
| @@ -3521,7 +3532,7 @@ posix_spawnve(PyObject *self, PyObject *args) |
| } |
| envlist[envc] = 0; |
| |
| -#if defined(PYOS_OS2) && defined(PYCC_GCC) |
| +#if (defined(PYOS_OS2) && defined(PYCC_GCC)) || defined(__native_client__) |
| Py_BEGIN_ALLOW_THREADS |
| spawnval = spawnve(mode, path, argvlist, envlist); |
| Py_END_ALLOW_THREADS |
| @@ -6316,7 +6327,7 @@ posix_readlink(PyObject *self, PyObject *args) |
| n = readlink(path, buf, (int) sizeof buf); |
| Py_END_ALLOW_THREADS |
| if (n < 0) |
| - return posix_error_with_allocated_filename(path); |
| + return posix_error_with_allocated_filename("readlink", path); |
| |
| PyMem_Free(path); |
| v = PyString_FromStringAndSize(buf, n); |
| @@ -6562,7 +6573,7 @@ posix_open(PyObject *self, PyObject *args) |
| PyErr_Clear(); |
| #endif |
| |
| - if (!PyArg_ParseTuple(args, "eti|i", |
| + if (!PyArg_ParseTuple(args, "eti|i:open", |
| Py_FileSystemDefaultEncoding, &file, |
| &flag, &mode)) |
| return NULL; |
| @@ -6571,7 +6582,7 @@ posix_open(PyObject *self, PyObject *args) |
| fd = open(file, flag, mode); |
| Py_END_ALLOW_THREADS |
| if (fd < 0) |
| - return posix_error_with_allocated_filename(file); |
| + return posix_error_with_allocated_filename("open", file); |
| PyMem_Free(file); |
| return PyInt_FromLong((long)fd); |
| } |
| @@ -9376,6 +9387,11 @@ all_ins(PyObject *d) |
| if (ins(d, "P_TILDE", (long)P_TILDE)) return -1; |
| if (ins(d, "P_UNRELATED", (long)P_UNRELATED)) return -1; |
| if (ins(d, "P_DEBUGDESC", (long)P_DEBUGDESC)) return -1; |
| +#elif defined(__native_client__) |
| + if (ins(d, "P_WAIT", (long)P_WAIT)) return -1; |
| + if (ins(d, "P_NOWAIT", (long)P_NOWAIT)) return -1; |
| + if (ins(d, "P_OVERLAY", (long)P_OVERLAY)) return -1; |
| + if (ins(d, "P_NOWAITO", (long)P_NOWAITO)) return -1; |
| #else |
| if (ins(d, "P_WAIT", (long)_P_WAIT)) return -1; |
| if (ins(d, "P_NOWAIT", (long)_P_NOWAIT)) return -1; |
| diff --git a/Modules/pwdmodule.c b/Modules/pwdmodule.c |
| --- a/Modules/pwdmodule.c |
| +++ b/Modules/pwdmodule.c |
| @@ -94,6 +94,29 @@ mkpwent(struct passwd *p) |
| return v; |
| } |
| |
| +#ifdef __native_client__ |
| +// python relies on a working version of getpwuid(3) |
| +// which Native Client does not yet provide. |
| +// TODO(sbc): This should only really be needed when |
| +// building for the sel_ldr. It should be possible to |
| +// use the C-library version (which tries of open files |
| +// under /etc) when using nacl_io. |
| +static struct passwd *my_getpwuid(uid_t uid) |
| +{ |
| + static struct passwd dummy = { |
| + "nacl_user", |
| + "nacl_pass", |
| + 1, |
| + 1, |
| + "NaCl User", |
| + "/home/nacl_user", |
| + "/bin/sh", |
| + }; |
| + return &dummy; |
| +} |
| +#define getpwuid my_getpwuid |
| +#endif |
| + |
| PyDoc_STRVAR(pwd_getpwuid__doc__, |
| "getpwuid(uid) -> (pw_name,pw_passwd,pw_uid,\n\ |
| pw_gid,pw_gecos,pw_dir,pw_shell)\n\ |
| diff --git a/Modules/python.c b/Modules/python.c |
| --- a/Modules/python.c |
| +++ b/Modules/python.c |
| @@ -6,6 +6,35 @@ |
| #include <floatingpoint.h> |
| #endif |
| |
| +#ifdef __native_client__ |
| +#include <stdio.h> |
| +#include <sys/utsname.h> |
| + |
| +// Stubs for functions implemented through PPAPI. |
| +int spawnv(int mode, const char* path, char *const argv[]) { |
| + return 0; |
| +} |
| + |
| +int spawnve(int mode, const char* path, |
| + char *const argv[], char *const envp[]) { |
| + return 0; |
| +} |
| + |
| +// Dummy implementation of uname. This is only needed for the sel_ldr |
| +// version of python. Otherwise it gets provided by nacl_io. |
| +int uname(struct utsname *buf) |
| +{ |
| + sprintf(buf->sysname, "NaCl"); |
| + return 0; |
| +} |
| +#endif |
| + |
| +// Dummy implementation of nacl_spawn_vfork_exit, otherwise provided |
| +// by nacl_spawn. |
| +void nacl_spawn_vfork_exit(int status) { |
| + _exit(status); |
| +} |
| + |
| int |
| main(int argc, char **argv) |
| { |
| @@ -20,5 +49,9 @@ main(int argc, char **argv) |
| m = fpgetmask(); |
| fpsetmask(m & ~FP_X_OFL); |
| #endif |
| +#ifdef __native_client__ |
| + setvbuf(stdout, NULL, _IOLBF, 0); |
| + setvbuf(stdin, NULL, _IOLBF, 0); |
| +#endif |
| return Py_Main(argc, argv); |
| } |
| diff --git a/Modules/readline.c b/Modules/readline.c |
| --- a/Modules/readline.c |
| +++ b/Modules/readline.c |
| @@ -950,7 +950,12 @@ setup_readline(void) |
| /* Wrapper around GNU readline that handles signals differently. */ |
| |
| |
| -#if defined(HAVE_RL_CALLBACK) && defined(HAVE_SELECT) |
| +/* |
| + * Don't use the select()-based readline under Native Client. While select() |
| + * is available and compile and link time it will fail at runtime under sel_ldr |
| + * since there is no IRT/syscall implemenation of select(). |
| + */ |
| +#if defined(HAVE_RL_CALLBACK) && defined(HAVE_SELECT) && !defined(__native_client__) |
| |
| static char *completed_input_string; |
| static void |
| diff --git a/Modules/timemodule.c b/Modules/timemodule.c |
| --- a/Modules/timemodule.c |
| +++ b/Modules/timemodule.c |
| @@ -34,6 +34,11 @@ extern int ftime(struct timeb *); |
| #endif /* MS_WINDOWS */ |
| #endif /* HAVE_FTIME */ |
| |
| +#if defined(__native_client__) && !defined(__GLIBC__) |
| +#define timezone _timezone |
| +#define daylight _daylight |
| +#endif |
| + |
| #if defined(__WATCOMC__) && !defined(__QNX__) |
| #include <i86.h> |
| #else |
| diff --git a/Python/dynload_shlib.c b/Python/dynload_shlib.c |
| --- a/Python/dynload_shlib.c |
| +++ b/Python/dynload_shlib.c |
| @@ -84,6 +84,11 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname, |
| PyOS_snprintf(funcname, sizeof(funcname), |
| LEAD_UNDERSCORE "init%.200s", shortname); |
| |
| + |
| +/* Native Client's fstat() imlemenation doesn't set st_dev |
| + * and st_ino correctly so disable the dlopen handle cache. |
| + * TODO(sbc): fix NaCl's fstat() */ |
| +#ifndef __native_client__ |
| if (fp != NULL) { |
| int i; |
| struct stat statb; |
| @@ -107,6 +112,7 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname, |
| #endif |
| } |
| } |
| +#endif |
| |
| #if !(defined(PYOS_OS2) && defined(PYCC_GCC)) |
| dlopenflags = PyThreadState_GET()->interp->dlopenflags; |
| diff --git a/Python/getversion.c b/Python/getversion.c |
| --- a/Python/getversion.c |
| +++ b/Python/getversion.c |
| @@ -8,8 +8,8 @@ |
| const char * |
| Py_GetVersion(void) |
| { |
| - static char version[250]; |
| - PyOS_snprintf(version, sizeof(version), "%.80s (%.80s) %.80s", |
| + static char version[270]; |
| + PyOS_snprintf(version, sizeof(version), "%.80s (%.80s) %.100s", |
| PY_VERSION, Py_GetBuildInfo(), Py_GetCompiler()); |
| return version; |
| } |
| diff --git a/configure b/configure |
| --- a/configure |
| +++ b/configure |
| @@ -2861,19 +2861,27 @@ if test "$cross_compiling" = yes; then |
| { $as_echo "$as_me:${as_lineno-$LINENO}: checking for python interpreter for cross build" >&5 |
| $as_echo_n "checking for python interpreter for cross build... " >&6; } |
| if test -z "$PYTHON_FOR_BUILD"; then |
| - for interp in python$PACKAGE_VERSION python2 python; do |
| - which $interp >/dev/null 2>&1 || continue |
| - if $interp -c 'import sys;sys.exit(not (sys.version_info[:2] >= (2,7) and sys.version_info[0] < 3))'; then |
| - break |
| - fi |
| - interp= |
| - done |
| + case "$host" in |
| + *-*-nacl*) |
| + interp=$(cd ../../python-host/build_host && pwd)/python.exe |
| + if [ ! -f $interp ]; then interp=$(cd ../../python-host/build_host && pwd)/python; fi |
| + ;; |
| + *) |
| + for interp in python$PACKAGE_VERSION python2 python; do |
| + which $interp >/dev/null 2>&1 || continue |
| + if $interp -c 'import sys;sys.exit(not (sys.version_info@<:@:2@:>@ >= (2,7) and sys.version_info@<:@0@:>@ < 3))'; then |
| + break |
| + fi |
| + interp= |
| + done |
| + ;; |
| + esac |
| if test x$interp = x; then |
| as_fn_error $? "python$PACKAGE_VERSION interpreter not found" "$LINENO" 5 |
| fi |
| { $as_echo "$as_me:${as_lineno-$LINENO}: result: $interp" >&5 |
| $as_echo "$interp" >&6; } |
| - PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib:$(srcdir)/Lib/plat-$(MACHDEP) '$interp |
| + PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(abs_srcdir)/Lib:$(abs_srcdir)/Lib/plat-$(MACHDEP) '$interp |
| fi |
| elif test "$cross_compiling" = maybe; then |
| as_fn_error $? "Cross compiling required --host=HOST-TUPLE and --build=ARCH" "$LINENO" 5 |
| @@ -3177,6 +3185,9 @@ then |
| # `define_xopen_source' in the case statement below. For the |
| # current supported cross builds, this macro is not adjusted. |
| case "$host" in |
| + *-*-nacl*) |
| + ac_sys_system=NaCl |
| + ;; |
| *-*-linux*) |
| ac_sys_system=Linux |
| ;; |
| @@ -3226,6 +3237,15 @@ if test "$cross_compiling" = yes; then |
| _host_cpu=$host_cpu |
| esac |
| ;; |
| + *-*-nacl*) |
| + case "$host_cpu" in |
| + arm*) |
| + _host_cpu=arm |
| + ;; |
| + *) |
| + _host_cpu=$host_cpu |
| + esac |
| + ;; |
| *-*-cygwin*) |
| _host_cpu= |
| ;; |
| @@ -5146,7 +5166,11 @@ if test -d casesensitivetestdir |
| then |
| { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 |
| $as_echo "yes" >&6; } |
| - BUILDEXEEXT=.exe |
| + if [ -z $EXEEXT ]; then |
| + BUILDEXEEXT=.exe |
| + else |
| + BUILDEXEEXT=$EXEEXT |
| + fi |
| else |
| { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 |
| $as_echo "no" >&6; } |
| @@ -8235,7 +8259,7 @@ then |
| fi |
| fi |
| ;; |
| - Linux*|GNU*|QNX*) |
| + Linux*|GNU*|QNX*|NaCl*) |
| LDSHARED='$(CC) -shared' |
| LDCXXSHARED='$(CXX) -shared';; |
| BSD/OS*/4*) |
| @@ -8309,7 +8333,7 @@ then |
| then CCSHARED="-fPIC"; |
| else CCSHARED="+z"; |
| fi;; |
| - Linux*|GNU*) CCSHARED="-fPIC";; |
| + Linux*|GNU*|NaCl*) CCSHARED="-fPIC";; |
| BSD/OS*/4*) CCSHARED="-fpic";; |
| FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) CCSHARED="-fPIC";; |
| OpenUNIX*|UnixWare*) |
| @@ -8343,7 +8367,7 @@ then |
| LINKFORSHARED="-Wl,-E -Wl,+s";; |
| # LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";; |
| BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";; |
| - Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";; |
| + Linux*|GNU*|NaCl*) LINKFORSHARED="-Xlinker -export-dynamic";; |
| # -u libsys_s pulls in all symbols in libsys |
| Darwin/*) |
| # -u _PyMac_Error is needed to pull in the mac toolbox glue, |
| diff --git a/configure.ac b/configure.ac |
| --- a/configure.ac |
| +++ b/configure.ac |
| @@ -19,18 +19,25 @@ AC_SUBST(host) |
| if test "$cross_compiling" = yes; then |
| AC_MSG_CHECKING([for python interpreter for cross build]) |
| if test -z "$PYTHON_FOR_BUILD"; then |
| - for interp in python$PACKAGE_VERSION python2 python; do |
| - which $interp >/dev/null 2>&1 || continue |
| - if $interp -c 'import sys;sys.exit(not (sys.version_info@<:@:2@:>@ >= (2,7) and sys.version_info@<:@0@:>@ < 3))'; then |
| - break |
| - fi |
| - interp= |
| - done |
| + case "$host" in |
| + *-*-nacl*) |
| + interp=$(cd ../../python-host/build_host && pwd)/python |
| + ;; |
| + *) |
| + for interp in python$PACKAGE_VERSION python2 python; do |
| + which $interp >/dev/null 2>&1 || continue |
| + if $interp -c 'import sys;sys.exit(not (sys.version_info@<:@:2@:>@ >= (2,7) and sys.version_info@<:@0@:>@ < 3))'; then |
| + break |
| + fi |
| + interp= |
| + done |
| + ;; |
| + esac |
| if test x$interp = x; then |
| AC_MSG_ERROR([python$PACKAGE_VERSION interpreter not found]) |
| fi |
| AC_MSG_RESULT($interp) |
| - PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib:$(srcdir)/Lib/plat-$(MACHDEP) '$interp |
| + PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(abs_srcdir)/Lib:$(abs_srcdir)/Lib/plat-$(MACHDEP) '$interp |
| fi |
| elif test "$cross_compiling" = maybe; then |
| AC_MSG_ERROR([Cross compiling required --host=HOST-TUPLE and --build=ARCH]) |
| @@ -319,6 +326,9 @@ then |
| *-*-cygwin*) |
| ac_sys_system=Cygwin |
| ;; |
| + *-*-nacl*) |
| + ac_sys_system=NaCl |
| + ;; |
| *) |
| # for now, limit cross builds to known configurations |
| MACHDEP="unknown" |
| @@ -362,6 +372,15 @@ if test "$cross_compiling" = yes; then |
| _host_cpu=$host_cpu |
| esac |
| ;; |
| + *-*-nacl*) |
| + case "$host_cpu" in |
| + arm*) |
| + _host_cpu=arm |
| + ;; |
| + *) |
| + _host_cpu=$host_cpu |
| + esac |
| + ;; |
| *-*-cygwin*) |
| _host_cpu= |
| ;; |
| @@ -2017,7 +2036,7 @@ then |
| fi |
| fi |
| ;; |
| - Linux*|GNU*|QNX*) |
| + Linux*|GNU*|QNX*|NaCl*) |
| LDSHARED='$(CC) -shared' |
| LDCXXSHARED='$(CXX) -shared';; |
| BSD/OS*/4*) |
| @@ -2089,7 +2108,7 @@ then |
| then CCSHARED="-fPIC"; |
| else CCSHARED="+z"; |
| fi;; |
| - Linux*|GNU*) CCSHARED="-fPIC";; |
| + Linux*|GNU*|NaCl*) CCSHARED="-fPIC";; |
| BSD/OS*/4*) CCSHARED="-fpic";; |
| FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) CCSHARED="-fPIC";; |
| OpenUNIX*|UnixWare*) |
| @@ -2121,7 +2140,7 @@ then |
| LINKFORSHARED="-Wl,-E -Wl,+s";; |
| # LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";; |
| BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";; |
| - Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";; |
| + Linux*|GNU*|NaCl*) LINKFORSHARED="-Xlinker -export-dynamic";; |
| # -u libsys_s pulls in all symbols in libsys |
| Darwin/*) |
| # -u _PyMac_Error is needed to pull in the mac toolbox glue, |