diff options
author | Arpit Nandwani <arpit.nandwani@gmail.com> | 2017-08-20 17:14:45 +0530 |
---|---|---|
committer | Jim Carroll <git@dempsy.net> | 2019-10-11 22:46:08 +0300 |
commit | cbda00a187070f196214ddf14fa27eb087fea11d (patch) | |
tree | 94cdd043e485de7f388aca77b2a8a3f1773e9294 /tools/depends/target/python3 | |
parent | 46743fefa0de25c146b54b2aaa23ca91148bc584 (diff) |
[depends] Updated Python3 Makefile and Patches
Diffstat (limited to 'tools/depends/target/python3')
-rw-r--r-- | tools/depends/target/python3/Makefile | 80 | ||||
-rw-r--r-- | tools/depends/target/python3/android-nl_langinfo.patch | 60 | ||||
-rw-r--r-- | tools/depends/target/python3/android.patch | 40 | ||||
-rw-r--r-- | tools/depends/target/python3/apple.patch | 33 | ||||
-rw-r--r-- | tools/depends/target/python3/crosscompile.patch | 120 | ||||
-rw-r--r-- | tools/depends/target/python3/darwin_embedded.patch | 288 | ||||
-rw-r--r-- | tools/depends/target/python3/fix-datetime.patch | 16 | ||||
-rw-r--r-- | tools/depends/target/python3/fix-ffi.patch | 51 | ||||
-rw-r--r-- | tools/depends/target/python3/modules.setup | 389 | ||||
-rw-r--r-- | tools/depends/target/python3/no-abort.patch | 22 | ||||
-rw-r--r-- | tools/depends/target/python3/setup.patch | 74 |
11 files changed, 1173 insertions, 0 deletions
diff --git a/tools/depends/target/python3/Makefile b/tools/depends/target/python3/Makefile new file mode 100644 index 0000000000..f6da6cb23f --- /dev/null +++ b/tools/depends/target/python3/Makefile @@ -0,0 +1,80 @@ +include ../../Makefile.include +DEPS= ../../Makefile.include Makefile apple.patch crosscompile.patch android.patch \ + fix-datetime.patch modules.setup darwin_embedded.patch android-nl_langinfo.patch + +# lib name, version +LIBNAME=Python +VERSION=3.7.4 +SOURCE=$(LIBNAME)-$(VERSION) +ARCHIVE=$(SOURCE).tar.xz + +ifeq ($(OS),osx) + HOSTPLATFORM=_PYTHON_HOST_PLATFORM="darwin" + LINK_ICONV=-framework CoreFoundation -liconv +endif +ifeq ($(OS),darwin_embedded) + HOSTPLATFORM=_PYTHON_HOST_PLATFORM="darwin" + LINK_ICONV=-framework CoreFoundation -liconv +endif + +# configuration settings +CONFIGURE=./configure --prefix=$(PREFIX) \ + --disable-shared \ + --without-ensurepip \ + --disable-framework --with-system-expat --with-system-ffi --without-pymalloc --enable-ipv6 + +LIBDYLIB=$(PLATFORM)/libpython3.7.a + +all: .installed-$(PLATFORM) + +$(TARBALLS_LOCATION)/$(ARCHIVE): + cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE) + +$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS) + rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM) + cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE) + cd $(PLATFORM); patch -p1 -i ../crosscompile.patch + cd $(PLATFORM); patch -p1 -i ../fix-datetime.patch + cd $(PLATFORM); patch -p1 -i ../android.patch + cd $(PLATFORM); patch -p1 -i ../fix-ffi.patch + cd $(PLATFORM); patch -p1 -i ../android-nl_langinfo.patch + cd $(PLATFORM); patch -p1 -i ../apple.patch +ifeq ($(OS),darwin_embedded) + cd $(PLATFORM); patch -p1 -i ../darwin_embedded.patch +endif + cp modules.setup $(PLATFORM)/Modules/Setup.dist + +#Add -liconv as needed, and add the _scproxy module for darwin +# disable locale altogether for Android +ifeq ($(OS),android) + cd $(PLATFORM); sed -ie 's|_locale _localemodule.c -lintl|#_locale _localemodule.c -lintl $(LINK_ICONV)|' Modules/Setup.dist +else + cd $(PLATFORM); sed -ie 's|_locale _localemodule.c -lintl|_locale _localemodule.c -lintl $(LINK_ICONV)|' Modules/Setup.dist +endif +ifeq ($(OS),osx) + echo "_scproxy \$$(srcdir)/Modules/_scproxy.c -framework SystemConfiguration -framework CoreFoundation" >> $(PLATFORM)/Modules/Setup.dist +endif + +ifeq ($(OS),android) + cd $(PLATFORM); sed -ie 's|-framework CoreFoundation||' configure.ac +endif + + cd $(PLATFORM); $(AUTORECONF) + cd $(PLATFORM); $(CONFIGURE) + +$(LIBDYLIB): $(PLATFORM) + $(MAKE) -C $(PLATFORM) $(HOSTPLATFORM) PYTHON_FOR_BUILD=$(NATIVEPREFIX)/bin/python3 NATIVE_PGEN=$(NATIVEPREFIX)/bin/pgen CROSS_COMPILE_TARGET=yes libpython3.7.a + touch $@ + +.installed-$(PLATFORM): $(LIBDYLIB) + $(MAKE) -C $(PLATFORM) $(HOSTPLATFORM) PYTHON_FOR_BUILD=$(NATIVEPREFIX)/bin/python3 NATIVE_PGEN=$(NATIVEPREFIX)/bin/pgen CROSS_COMPILE_TARGET=yes install + # find $(PREFIX)/lib/python3.7 -type f -name "*.py" -delete + find $(PREFIX)/lib/python3.7 -type f -name "*.pyc" -delete + touch $(LIBDYLIB) + touch $@ + +clean: + rm -rf $(PLATFORM) .installed-$(PLATFORM) + +distclean:: + rm -rf $(PLATFORM) .installed-$(PLATFORM) diff --git a/tools/depends/target/python3/android-nl_langinfo.patch b/tools/depends/target/python3/android-nl_langinfo.patch new file mode 100644 index 0000000000..c51581f06a --- /dev/null +++ b/tools/depends/target/python3/android-nl_langinfo.patch @@ -0,0 +1,60 @@ +--- a/Modules/_localemodule.c ++++ b/Modules/_localemodule.c +@@ -424,7 +424,7 @@ + } + #endif + +-#ifdef HAVE_LANGINFO_H ++#if defined(HAVE_LANGINFO_H) && defined(HAVE_NL_LANGINFO) + #define LANGINFO(X) {#X, X} + static struct langinfo_constant{ + char* name; +@@ -690,7 +690,7 @@ + #if defined(MS_WINDOWS) + {"_getdefaultlocale", (PyCFunction) PyLocale_getdefaultlocale, METH_NOARGS}, + #endif +-#ifdef HAVE_LANGINFO_H ++#if defined(HAVE_LANGINFO_H) && defined(HAVE_NL_LANGINFO) + {"nl_langinfo", (PyCFunction) PyLocale_nl_langinfo, + METH_VARARGS, nl_langinfo__doc__}, + #endif +@@ -730,7 +730,7 @@ + PyInit__locale(void) + { + PyObject *m; +-#ifdef HAVE_LANGINFO_H ++#if defined(HAVE_LANGINFO_H) && defined(HAVE_NL_LANGINFO) + int i; + #endif + +@@ -758,7 +758,7 @@ + } + PyModule_AddObject(m, "Error", Error); + +-#ifdef HAVE_LANGINFO_H ++#if defined(HAVE_LANGINFO_H) && defined(HAVE_NL_LANGINFO) + for (i = 0; langinfo_constants[i].name; i++) { + PyModule_AddIntConstant(m, langinfo_constants[i].name, + langinfo_constants[i].value); +--- a/Python/fileutils.c ++++ b/Python/fileutils.c +@@ -56,7 +56,7 @@ + has no console */ + if (cp != 0) + return PyUnicode_FromFormat("cp%u", (unsigned int)cp); +-#elif defined(CODESET) ++#elif defined(HAVE_NL_LANGINFO) && defined(CODESET) + { + char *codeset = nl_langinfo(CODESET); + if (codeset != NULL && codeset[0] != 0) +--- a/configure.ac ++++ b/configure.ac +@@ -3554,7 +3554,7 @@ + if_nameindex \ + initgroups kill killpg lchown lockf linkat lstat lutimes mmap \ + memrchr mbrtowc mkdirat mkfifo \ +- mkfifoat mknod mknodat mktime mremap nice openat pathconf pause pipe2 plock poll \ ++ mkfifoat mknod mknodat mktime mremap nice nl_langinfo openat pathconf pause pipe2 plock poll \ + posix_fallocate posix_fadvise posix_spawn pread preadv preadv2 \ + pthread_init pthread_kill putenv pwrite pwritev pwritev2 readlink readlinkat readv realpath renameat \ + sem_open sem_timedwait sem_getvalue sem_unlink sendfile setegid seteuid \ diff --git a/tools/depends/target/python3/android.patch b/tools/depends/target/python3/android.patch new file mode 100644 index 0000000000..3b95042565 --- /dev/null +++ b/tools/depends/target/python3/android.patch @@ -0,0 +1,40 @@ +--- a/Modules/pwdmodule.c ++++ b/Modules/pwdmodule.c +@@ -82,7 +82,7 @@ + #endif + PyStructSequence_SET_ITEM(v, setIndex++, _PyLong_FromUid(p->pw_uid)); + PyStructSequence_SET_ITEM(v, setIndex++, _PyLong_FromGid(p->pw_gid)); +-#if defined(HAVE_STRUCT_PASSWD_PW_GECOS) ++#if defined(HAVE_STRUCT_PASSWD_PW_GECOS) && !defined(__ANDROID__) + SETS(setIndex++, p->pw_gecos); + #else + SETS(setIndex++, ""); +--- a/Modules/termios.c ++++ b/Modules/termios.c +@@ -224,6 +224,7 @@ + Py_RETURN_NONE; + } + ++#if !defined(__ANDROID__) + PyDoc_STRVAR(termios_tcdrain__doc__, + "tcdrain(fd) -> None\n\ + \n\ +@@ -242,6 +243,7 @@ + + Py_RETURN_NONE; + } ++#endif + + PyDoc_STRVAR(termios_tcflush__doc__, + "tcflush(fd, queue) -> None\n\ +@@ -295,8 +297,10 @@ + METH_VARARGS, termios_tcsetattr__doc__}, + {"tcsendbreak", termios_tcsendbreak, + METH_VARARGS, termios_tcsendbreak__doc__}, ++ #if !defined(__ANDROID__) + {"tcdrain", termios_tcdrain, + METH_VARARGS, termios_tcdrain__doc__}, ++ #endif + {"tcflush", termios_tcflush, + METH_VARARGS, termios_tcflush__doc__}, + {"tcflow", termios_tcflow, diff --git a/tools/depends/target/python3/apple.patch b/tools/depends/target/python3/apple.patch new file mode 100644 index 0000000000..d87826f708 --- /dev/null +++ b/tools/depends/target/python3/apple.patch @@ -0,0 +1,33 @@ +--- a/Modules/posixmodule.c ++++ b/Modules/posixmodule.c +@@ -113,6 +113,9 @@ + #include <sys/xattr.h> + #endif + ++#if defined(__APPLE__) && defined(_POSIX_C_SOURCE) ++#undef _POSIX_C_SOURCE ++#endif + #if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__APPLE__) + #ifdef HAVE_SYS_SOCKET_H + #include <sys/socket.h> +--- a/configure.ac ++++ b/configure.ac +@@ -2826,11 +2826,17 @@ + # pthread (first!) on Linux + AC_SEARCH_LIBS(sem_init, pthread rt posix4) + ++OLD_LIBS=$LIBS ++if test $ac_sys_system = darwin ++then ++ LIBS="$LIBS -framework CoreFoundation" ++fi ++ + # check if we need libintl for locale functions + AC_CHECK_LIB(intl, textdomain, + [AC_DEFINE(WITH_LIBINTL, 1, + [Define to 1 if libintl is needed for locale functions.]) +- LIBS="-lintl $LIBS"]) ++ LIBS="-lintl $LIBS"], LIBS=$OLD_LIBS) + + # checks for system dependent C++ extensions support + case "$ac_sys_system" in diff --git a/tools/depends/target/python3/crosscompile.patch b/tools/depends/target/python3/crosscompile.patch new file mode 100644 index 0000000000..30668a8a7b --- /dev/null +++ b/tools/depends/target/python3/crosscompile.patch @@ -0,0 +1,120 @@ +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -38,7 +38,6 @@ + MAINCC= @MAINCC@ + LINKCC= @LINKCC@ + AR= @AR@ +-READELF= @READELF@ + SOABI= @SOABI@ + LDVERSION= @LDVERSION@ + GITVERSION= @GITVERSION@ +@@ -295,7 +294,7 @@ + ########################################################################## + # Parser + PGEN= Parser/pgen$(EXE) +- ++PGEN_FOR_BUILD=$(NATIVE_PGEN) + POBJS= \ + Parser/acceler.o \ + Parser/grammar1.o \ +@@ -622,7 +621,7 @@ + $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build"; \ + $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ + _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \ +- $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build ++ PYTHONXCPREFIX='$(DESTDIR)$(prefix)' $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build + + + # Build static library +@@ -1526,11 +1525,13 @@ + # Install the dynamically loadable modules + # This goes into $(exec_prefix) + sharedinstall: sharedmods ++ CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ + $(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \ ++ --skip-build \ + --prefix=$(prefix) \ +- --install-scripts=$(BINDIR) \ +- --install-platlib=$(DESTSHARED) \ +- --root=$(DESTDIR)/ ++ --install-scripts=$(DESTDIR)$(BINDIR) \ ++ --install-platlib=$(DESTDIR)$(DESTSHARED) \ ++ --root=/ + -rm $(DESTDIR)$(DESTSHARED)/_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH).py + -rm -r $(DESTDIR)$(DESTSHARED)/__pycache__ + +--- a/configure.ac ++++ b/configure.ac +@@ -379,10 +379,12 @@ + *-*-cygwin*) + ac_sys_system=Cygwin + ;; ++ *-*-darwin*) ++ ac_sys_system=darwin ++ ;; + *) + # for now, limit cross builds to known configurations + MACHDEP="unknown" +- AC_MSG_ERROR([cross build not supported for $host]) + esac + ac_sys_release= + else +@@ -423,10 +425,11 @@ + *-*-cygwin*) + _host_cpu= + ;; ++ *-*-darwin*) ++ ;; + *) + # for now, limit cross builds to known configurations + MACHDEP="unknown" +- AC_MSG_ERROR([cross build not supported for $host]) + esac + _PYTHON_HOST_PLATFORM="$MACHDEP${_host_cpu:+-$_host_cpu}" + fi +@@ -1200,16 +1203,6 @@ + ARFLAGS="rcs" + fi + +-AC_CHECK_TOOLS([READELF], [readelf], [:]) +-if test "$cross_compiling" = yes; then +- case "$READELF" in +- readelf|:) +- AC_MSG_ERROR([readelf for the host is required for cross builds]) +- ;; +- esac +-fi +-AC_SUBST(READELF) +- + + case $MACHDEP in + hp*|HP*) +--- a/setup.py ++++ b/setup.py +@@ -16,7 +16,7 @@ + from distutils.command.build_scripts import build_scripts + from distutils.spawn import find_executable + +-cross_compiling = "_PYTHON_HOST_PLATFORM" in os.environ ++cross_compiling = ("_PYTHON_HOST_PLATFORM" in os.environ) or ('CROSS_COMPILE_TARGET' in os.environ) + + # Set common compiler and linker flags derived from the Makefile, + # reserved for building the interpreter and the stdlib modules. +@@ -268,6 +268,7 @@ + + def build_extensions(self): + ++ return + # Detect which modules should be compiled + missing = self.detect_modules() + +@@ -477,6 +478,9 @@ + + # Don't try to load extensions for cross builds + if cross_compiling: ++ self.announce( ++ 'WARNING: skipping import check for cross-compiled: "%s"' % ++ ext.name) + return + + loader = importlib.machinery.ExtensionFileLoader(ext.name, ext_filename) diff --git a/tools/depends/target/python3/darwin_embedded.patch b/tools/depends/target/python3/darwin_embedded.patch new file mode 100644 index 0000000000..59fd5457c6 --- /dev/null +++ b/tools/depends/target/python3/darwin_embedded.patch @@ -0,0 +1,288 @@ +--- a/Lib/os.py ++++ b/Lib/os.py +@@ -602,6 +602,7 @@ + fullname = path.join(dir, file) + try: + exec_func(fullname, *argrest) ++ return + except (FileNotFoundError, NotADirectoryError) as e: + last_exc = e + except OSError as e: +--- a/Lib/platform.py ++++ b/Lib/platform.py +@@ -781,7 +781,7 @@ + + """ Interface to the system's uname command. + """ +- if sys.platform in ('dos', 'win32', 'win16'): ++ if sys.platform in ('dos', 'win32', 'win16', 'darwin'): + # XXX Others too ? + return default + try: +@@ -804,7 +804,7 @@ + default in case the command should fail. + + """ +- if sys.platform in ('dos', 'win32', 'win16'): ++ if sys.platform in ('dos', 'win32', 'win16', 'darwin'): + # XXX Others too ? + return default + target = _follow_symlinks(target) +--- a/Lib/subprocess.py ++++ b/Lib/subprocess.py +@@ -851,6 +851,7 @@ + if not self._child_created: + # We didn't get to successfully create a child process. + return ++ return + if self.returncode is None: + # Not reading subprocess exit status creates a zombie process which + # is only destroyed at the parent python process exit +@@ -1394,6 +1395,7 @@ + else: + args = list(args) + ++ shell = False + if shell: + # On Android the default shell is at '/system/bin/sh'. + unix_shell = ('/system/bin/sh' if +@@ -1452,6 +1454,7 @@ + errpipe_read, errpipe_write, + restore_signals, start_new_session, preexec_fn) + self._child_created = True ++ return + finally: + # be sure the FD is closed no matter what + os.close(errpipe_write) +@@ -1480,6 +1483,7 @@ + finally: + # be sure the FD is closed no matter what + os.close(errpipe_read) ++ return + + if errpipe_data: + try: +--- a/Lib/urllib/request.py ++++ b/Lib/urllib/request.py +@@ -2580,11 +2580,9 @@ + + + if sys.platform == 'darwin': +- from _scproxy import _get_proxy_settings, _get_proxies + + def proxy_bypass_macosx_sysconf(host): +- proxy_settings = _get_proxy_settings() +- return _proxy_bypass_macosx_sysconf(host, proxy_settings) ++ return False + + def getproxies_macosx_sysconf(): + """Return a dictionary of scheme -> proxy server URL mappings. +@@ -2592,7 +2590,7 @@ + This function uses the MacOSX framework SystemConfiguration + to fetch the proxy information. + """ +- return _get_proxies() ++ return {} + + + +@@ -2605,9 +2603,9 @@ + """ + proxies = getproxies_environment() + if proxies: +- return proxy_bypass_environment(host, proxies) ++ return False + else: +- return proxy_bypass_macosx_sysconf(host) ++ return False + + def getproxies(): + return getproxies_environment() or getproxies_macosx_sysconf() +--- a/Modules/_posixsubprocess.c ++++ b/Modules/_posixsubprocess.c +@@ -49,6 +49,9 @@ + + #define POSIX_CALL(call) do { if ((call) == -1) goto error; } while (0) + ++#if defined(__APPLE__) ++#include <TargetConditionals.h> ++#endif + + /* If gc was disabled, call gc.enable(). Return 0 on success. */ + static int +@@ -419,14 +422,14 @@ + goto error; + + /* Close parent's pipe ends. */ +- if (p2cwrite != -1) ++/* if (p2cwrite != -1) + POSIX_CALL(close(p2cwrite)); + if (c2pread != -1) + POSIX_CALL(close(c2pread)); + if (errread != -1) + POSIX_CALL(close(errread)); + POSIX_CALL(close(errpipe_read)); +- ++*/ + /* When duping fds, if there arises a situation where one of the fds is + either 0, 1 or 2, it is possible that it is overwritten (#12607). */ + if (c2pwrite == 0) { +@@ -471,6 +474,8 @@ + /* We no longer manually close p2cread, c2pwrite, and errwrite here as + * _close_open_fds takes care when it is not already non-inheritable. */ + ++ const char *currentDir = getcwd(NULL, 0); ++ + if (cwd) + POSIX_CALL(chdir(cwd)); + +@@ -496,13 +501,13 @@ + errno = 0; /* We don't want to report an OSError. */ + goto error; + } +- /* Py_DECREF(result); - We're about to exec so why bother? */ ++ Py_DECREF(result); /* - We're about to exec so why bother? */ + } + + /* close FDs after executing preexec_fn, which might open FDs */ + if (close_fds) { + /* TODO HP-UX could use pstat_getproc() if anyone cares about it. */ +- _close_open_fds(3, py_fds_to_keep); ++// _close_open_fds(3, py_fds_to_keep); + } + + /* This loop matches the Lib/os.py _execvpe()'s PATH search when */ +@@ -511,20 +516,34 @@ + for (i = 0; exec_array[i] != NULL; ++i) { + const char *executable = exec_array[i]; + if (envp) { ++#if defined(TARGET_OS_TV) ++ saved_errno = ENOTSUP; ++#elif defined(TARGET_OS_IOS) + execve(executable, argv, envp); ++ saved_errno = execve(executable, argv, envp); ++#endif ++ break; + } else { ++#if defined(TARGET_OS_TV) ++ saved_errno = ENOTSUP; ++#elif defined(TARGET_OS_IOS) + execv(executable, argv); ++ saved_errno = execv(executable, argv); ++#endif ++ break; + } + if (errno != ENOENT && errno != ENOTDIR && saved_errno == 0) { + saved_errno = errno; + } + } ++ if (saved_errno == 0) return; + /* Report the first exec error, not the last. */ + if (saved_errno) + errno = saved_errno; + + error: + saved_errno = errno; ++ chdir(currentDir); + /* Report the posix error to our parent process. */ + /* We ignore all write() return values as the total size of our writes is + less than PIPEBUF and we cannot do anything about an error anyways. +@@ -683,7 +702,8 @@ + need_after_fork = 1; + } + +- pid = fork(); ++ pid = -1; ++ errno = ENOTSUP; + if (pid == 0) { + /* Child process */ + /* +--- a/Modules/getpath.c ++++ b/Modules/getpath.c +@@ -593,8 +593,10 @@ + * will fail if a relative path was used. but in that case, + * absolutize() should help us out below + */ +- else if(0 == _NSGetExecutablePath(execpath, &nsexeclength) && +- execpath[0] == SEP) ++ char *iospath = Py_GETENV("PYTHONHOME"); ++ char *prog = Py_GETENV("PYTHONEXECUTABLE"); ++ sprintf(execpath, "%s/bin/%s", iospath, prog); ++ if (execpath[0] == SEP) + { + size_t len; + wchar_t *path = Py_DecodeLocale(execpath, &len); +--- a/Modules/posixmodule.c ++++ b/Modules/posixmodule.c +@@ -197,6 +197,20 @@ + #endif /* _MSC_VER */ + #endif /* ! __WATCOMC__ || __QNX__ */ + ++# undef HAVE_EXECV ++# undef HAVE_FORK ++# undef HAVE_FORK1 ++# undef HAVE_FORKPTY ++# undef HAVE_GETGROUPS ++# undef HAVE_SCHED_H ++# undef HAVE_SENDFILE ++# undef HAVE_SETPRIORITY ++# undef HAVE_SPAWNV ++# undef HAVE_SYSTEM ++# undef HAVE_WAIT ++# undef HAVE_WAIT3 ++# undef HAVE_WAIT4 ++# undef HAVE_WAITPID + + /*[clinic input] + # one of the few times we lie about this name! +@@ -475,6 +489,10 @@ + } + #endif + ++void PyOS_BeforeFork(void){} ++void PyOS_AfterFork_Parent(void){} ++void PyOS_AfterFork_Child(void){} ++ + /* Legacy wrapper */ + void + PyOS_AfterFork(void) +@@ -5040,6 +5058,8 @@ + #endif + _Py_END_SUPPRESS_IPH + ++ Py_RETURN_NONE; ++ + /* If we get here it's definitely an error */ + + free_string_array(argvlist, argc); +@@ -5116,6 +5136,12 @@ + #endif + _Py_END_SUPPRESS_IPH + ++ while (--envc >= 0) ++ PyMem_DEL(envlist[envc]); ++ PyMem_DEL(envlist); ++ // iOS: we return now ++ Py_RETURN_NONE; ++ + /* If we get here it's definitely an error */ + + posix_path_error(path); +@@ -5416,7 +5442,7 @@ + pid_t pid; + + PyOS_BeforeFork(); +- pid = fork1(); ++ pid = -1; + if (pid == 0) { + /* child: this clobbers and resets the import lock. */ + PyOS_AfterFork_Child(); +@@ -5447,7 +5473,7 @@ + pid_t pid; + + PyOS_BeforeFork(); +- pid = fork(); ++ pid = -1; + if (pid == 0) { + /* child: this clobbers and resets the import lock. */ + PyOS_AfterFork_Child(); diff --git a/tools/depends/target/python3/fix-datetime.patch b/tools/depends/target/python3/fix-datetime.patch new file mode 100644 index 0000000000..3dce1814d8 --- /dev/null +++ b/tools/depends/target/python3/fix-datetime.patch @@ -0,0 +1,16 @@ +--- a/Modules/_testcapimodule.c ++++ b/Modules/_testcapimodule.c +@@ -10,7 +10,13 @@ + #include "Python.h" + #include <float.h> + #include "structmember.h" ++#ifdef Py_BUILD_CORE ++#undef Py_BUILD_CORE + #include "datetime.h" ++#define Py_BUILD_CORE ++#else ++#include "datetime.h" ++#endif + #include "marshal.h" + #include <signal.h> + diff --git a/tools/depends/target/python3/fix-ffi.patch b/tools/depends/target/python3/fix-ffi.patch new file mode 100644 index 0000000000..17c43ec40d --- /dev/null +++ b/tools/depends/target/python3/fix-ffi.patch @@ -0,0 +1,51 @@ +--- a/Modules/_ctypes/cfield.c ++++ b/Modules/_ctypes/cfield.c +@@ -1634,6 +1634,7 @@ + */ + + /* align and size are bogus for void, but they must not be zero */ ++/* + ffi_type ffi_type_void = { 1, 1, FFI_TYPE_VOID }; + + ffi_type ffi_type_uint8 = { 1, 1, FFI_TYPE_UINT8 }; +@@ -1650,14 +1651,15 @@ + + ffi_type ffi_type_float = { sizeof(float), FLOAT_ALIGN, FFI_TYPE_FLOAT }; + ffi_type ffi_type_double = { sizeof(double), DOUBLE_ALIGN, FFI_TYPE_DOUBLE }; ++*/ + + #ifdef ffi_type_longdouble + #undef ffi_type_longdouble + #endif +- /* This is already defined on OSX */ ++ /* This is already defined on OSX + ffi_type ffi_type_longdouble = { sizeof(long double), LONGDOUBLE_ALIGN, + FFI_TYPE_LONGDOUBLE }; + + ffi_type ffi_type_pointer = { sizeof(void *), VOID_P_ALIGN, FFI_TYPE_POINTER }; +- ++ */ + /*---------------- EOF ----------------*/ +--- a/Modules/_ctypes/malloc_closure.c ++++ b/Modules/_ctypes/malloc_closure.c +@@ -89,6 +89,7 @@ + /******************************************************************/ + + /* put the item back into the free list */ ++/* + void ffi_closure_free(void *p) + { + ITEM *item = (ITEM *)p; +@@ -96,7 +97,6 @@ + free_list = item; + } + +-/* return one item from the free list, allocating more if needed */ + void *ffi_closure_alloc(size_t ignored, void** codeloc) + { + ITEM *item; +@@ -109,3 +109,4 @@ + *codeloc = (void *)item; + return (void *)item; + } ++*/ diff --git a/tools/depends/target/python3/modules.setup b/tools/depends/target/python3/modules.setup new file mode 100644 index 0000000000..f965baa4a1 --- /dev/null +++ b/tools/depends/target/python3/modules.setup @@ -0,0 +1,389 @@ +# -*- makefile -*- +# The file Setup is used by the makesetup script to construct the files +# Makefile and config.c, from Makefile.pre and config.c.in, +# respectively. The file Setup itself is initially copied from +# Setup.dist; once it exists it will not be overwritten, so you can edit +# Setup to your heart's content. Note that Makefile.pre is created +# from Makefile.pre.in by the toplevel configure script. + +# (VPATH notes: Setup and Makefile.pre are in the build directory, as +# are Makefile and config.c; the *.in and *.dist files are in the source +# directory.) + +# Each line in this file describes one or more optional modules. +# Modules configured here will not be compiled by the setup.py script, +# so the file can be used to override setup.py's behavior. +# Tag lines containing just the word "*static*", "*shared*" or "*disabled*" +# (without the quotes but with the stars) are used to tag the following module +# descriptions. Tag lines may alternate throughout this file. Modules are +# built statically when they are preceded by a "*static*" tag line or when +# there is no tag line between the start of the file and the module +# description. Modules are built as a shared library when they are preceded by +# a "*shared*" tag line. Modules are not built at all, not by the Makefile, +# nor by the setup.py script, when they are preceded by a "*disabled*" tag +# line. + +# Lines have the following structure: +# +# <module> ... [<sourcefile> ...] [<cpparg> ...] [<library> ...] +# +# <sourcefile> is anything ending in .c (.C, .cc, .c++ are C++ files) +# <cpparg> is anything starting with -I, -D, -U or -C +# <library> is anything ending in .a or beginning with -l or -L +# <module> is anything else but should be a valid Python +# identifier (letters, digits, underscores, beginning with non-digit) +# +# (As the makesetup script changes, it may recognize some other +# arguments as well, e.g. *.so and *.sl as libraries. See the big +# case statement in the makesetup script.) +# +# Lines can also have the form +# +# <name> = <value> +# +# which defines a Make variable definition inserted into Makefile.in +# +# The build process works like this: +# +# 1. Build all modules that are declared as static in Modules/Setup, +# combine them into libpythonxy.a, combine that into python. +# 2. Build all modules that are listed as shared in Modules/Setup. +# 3. Invoke setup.py. That builds all modules that +# a) are not builtin, and +# b) are not listed in Modules/Setup, and +# c) can be build on the target +# +# Therefore, modules declared to be shared will not be +# included in the config.c file, nor in the list of objects to be +# added to the library archive, and their linker options won't be +# added to the linker options. Rules to create their .o files and +# their shared libraries will still be added to the Makefile, and +# their names will be collected in the Make variable SHAREDMODS. This +# is used to build modules as shared libraries. (They can be +# installed using "make sharedinstall", which is implied by the +# toplevel "make install" target.) (For compatibility, +# *noconfig* has the same effect as *shared*.) +# +# In addition, *static* explicitly declares the following modules to +# be static. Lines containing "*static*" and "*shared*" may thus +# alternate throughout this file. + +# NOTE: As a standard policy, as many modules as can be supported by a +# platform should be present. The distribution comes with all modules +# enabled that are supported by most platforms and don't require you +# to ftp sources from elsewhere. +*static* + +# Some special rules to define PYTHONPATH. +# Edit the definitions below to indicate which options you are using. +# Don't add any whitespace or comments! + +# Directories where library files get installed. +# DESTLIB is for Python modules; MACHDESTLIB for shared libraries. +DESTLIB=$(LIBDEST) +MACHDESTLIB=$(BINLIBDEST) + +# NOTE: all the paths are now relative to the prefix that is computed +# at run time! + +# Standard path -- don't edit. +# No leading colon since this is the first entry. +# Empty since this is now just the runtime prefix. +DESTPATH= + +# Site specific path components -- should begin with : if non-empty +SITEPATH=:site-packages + +# Standard path components for test modules +TESTPATH= + +COREPYTHONPATH=$(DESTPATH)$(SITEPATH)$(TESTPATH) +PYTHONPATH=$(COREPYTHONPATH) + + +# The modules listed here can't be built as shared libraries for +# various reasons; therefore they are listed here instead of in the +# normal order. + +# This only contains the minimal set of modules required to run the +# setup.py script in the root of the Python source tree. + +posix -DPy_BUILD_CORE posixmodule.c # posix (UNIX) system calls +errno errnomodule.c # posix (UNIX) errno values +pwd pwdmodule.c # this is needed to find out the user's home dir + # if $HOME is not set +_sre _sre.c # Fredrik Lundh's new regular expressions +_codecs _codecsmodule.c # access to the builtin codecs and codec registry +_weakref _weakref.c # weak references +_functools -DPy_BUILD_CORE _functoolsmodule.c # Tools for working with functions and callable objects +_operator _operator.c # operator.add() and similar goodies +_collections _collectionsmodule.c # Container types +_abc _abc.c # Abstract base classes +itertools itertoolsmodule.c # Functions creating iterators for efficient looping +atexit atexitmodule.c # Register functions to be run at interpreter-shutdown +_signal -DPy_BUILD_CORE signalmodule.c +_stat _stat.c # stat.h interface +time -DPy_BUILD_CORE timemodule.c # -lm # time operations and variables +_thread -DPy_BUILD_CORE _threadmodule.c # low-level threading interface + +# access to ISO C locale support +_locale _localemodule.c -lintl + +# Standard I/O baseline +_io -DPy_BUILD_CORE -I$(srcdir)/Modules/_io _io/_iomodule.c _io/iobase.c _io/fileio.c _io/bytesio.c _io/bufferedio.c _io/textio.c _io/stringio.c + +# The zipimport module is always imported at startup. Having it as a +# builtin module avoids some bootstrapping problems and reduces overhead. +zipimport -DPy_BUILD_CORE zipimport.c + +# faulthandler module +faulthandler faulthandler.c + +# debug tool to trace memory blocks allocated by Python +_tracemalloc _tracemalloc.c hashtable.c + +# The rest of the modules listed in this file are all commented out by +# default. Usually they can be detected and built as dynamically +# loaded modules by the new setup.py script added in Python 2.1. If +# you're on a platform that doesn't support dynamic loading, want to +# compile modules statically into the Python binary, or need to +# specify some odd set of compiler switches, you can uncomment the +# appropriate lines below. + +# ====================================================================== + +# The Python symtable module depends on .h files that setup.py doesn't track +_symtable symtablemodule.c + +# Uncommenting the following line tells makesetup that all following +# modules are to be built as shared libraries (see above for more +# detail; also note that *static* or *disabled* cancels this effect): + +#*shared* + +# GNU readline. Unlike previous Python incarnations, GNU readline is +# now incorporated in an optional module, configured in the Setup file +# instead of by a configure script switch. You may have to insert a +# -L option pointing to the directory where libreadline.* lives, +# and you may have to change -ltermcap to -ltermlib or perhaps remove +# it, depending on your system -- see the GNU readline instructions. +# It's okay for this to be a shared library, too. + +#readline readline.c -lreadline -ltermcap + + +# Modules that should always be present (non UNIX dependent): + +array arraymodule.c # array objects +cmath cmathmodule.c _math.c # -lm # complex math library functions +math mathmodule.c _math.c # -lm # math library functions, e.g. sin() +_contextvars _contextvarsmodule.c # Context Variables +_struct _struct.c # binary structure packing/unpacking +_weakref _weakref.c # basic weak reference support +_testcapi _testcapimodule.c # Python C API test module +_random _randommodule.c # Random number generator +_elementtree -I$(srcdir)/Modules/expat -DHAVE_EXPAT_CONFIG_H -DUSE_PYEXPAT_CAPI _elementtree.c # elementtree accelerator +_pickle _pickle.c # pickle accelerator +_datetime _datetimemodule.c # datetime accelerator +_bisect _bisectmodule.c # Bisection algorithms +_heapq _heapqmodule.c # Heap queue algorithm +_asyncio _asynciomodule.c # Fast asyncio Future + +unicodedata unicodedata.c # static Unicode character database + + +# Modules with some UNIX dependencies -- on by default: +# (If you have a really backward UNIX, select and socket may not be +# supported...) + +fcntl fcntlmodule.c # fcntl(2) and ioctl(2) +#spwd spwdmodule.c # spwd(3) +#grp grpmodule.c # grp(3) +select selectmodule.c # select(2); not on ancient System V + +# Memory-mapped files (also works on Win32). +mmap mmapmodule.c + +# CSV file helper +_csv _csv.c + +# Socket module helper for socket(2) +_socket socketmodule.c + +# Socket module helper for SSL support; you must comment out the other +# socket line above, and possibly edit the SSL variable: +SSLDEFINES='-DUSE_SSL' +_ssl _ssl.c \ + $(SSLDEFINES) -I$(prefix)/include -I$(prefix)/include/openssl \ + -L$(prefix)/lib -lssl -lcrypto + +_hashlib _hashopenssl.c \ + $(SSLDEFINES) -I$(prefix)/include -I$(prefix)/include/openssl \ + -L$(prefix)/lib -lssl -lcrypto + +# The crypt module is now disabled by default because it breaks builds +# on many systems (where -lcrypt is needed), e.g. Linux (I believe). + +#_crypt _cryptmodule.c # -lcrypt # crypt(3); needs -lcrypt on some systems + + +# Some more UNIX dependent modules -- off by default, since these +# are not supported by all UNIX systems: + +#nis nismodule.c -lnsl # Sun yellow pages -- not everywhere +termios termios.c # Steen Lumholt's termios module +resource resource.c # Jeremy Hylton's rlimit interface + +_posixsubprocess _posixsubprocess.c # POSIX subprocess module helper + +# Multimedia modules -- off by default. +# These don't work for 64-bit platforms!!! +# #993173 says audioop works on 64-bit platforms, though. +# These represent audio samples or images as strings: + +#audioop audioop.c # Operations on audio samples + + +# Note that the _md5 and _sha modules are normally only built if the +# system does not have the OpenSSL libs containing an optimized version. + +# The _md5 module implements the RSA Data Security, Inc. MD5 +# Message-Digest Algorithm, described in RFC 1321. + +_md5 md5module.c + + +# The _sha module implements the SHA checksum algorithms. +# (NIST's Secure Hash Algorithms.) +_sha1 sha1module.c +_sha256 sha256module.c +_sha512 sha512module.c +_sha3 _sha3/sha3module.c + +# _blake module +_blake2 _blake2/blake2module.c _blake2/blake2b_impl.c _blake2/blake2s_impl.c + +# The _tkinter module. +# +# The command for _tkinter is long and site specific. Please +# uncomment and/or edit those parts as indicated. If you don't have a +# specific extension (e.g. Tix or BLT), leave the corresponding line +# commented out. (Leave the trailing backslashes in! If you +# experience strange errors, you may want to join all uncommented +# lines and remove the backslashes -- the backslash interpretation is +# done by the shell's "read" command and it may not be implemented on +# every system. + +# *** Always uncomment this (leave the leading underscore in!): +# _tkinter _tkinter.c tkappinit.c -DWITH_APPINIT \ +# *** Uncomment and edit to reflect where your Tcl/Tk libraries are: +# -L/usr/local/lib \ +# *** Uncomment and edit to reflect where your Tcl/Tk headers are: +# -I/usr/local/include \ +# *** Uncomment and edit to reflect where your X11 header files are: +# -I/usr/X11R6/include \ +# *** Or uncomment this for Solaris: +# -I/usr/openwin/include \ +# *** Uncomment and edit for Tix extension only: +# -DWITH_TIX -ltix8.1.8.2 \ +# *** Uncomment and edit for BLT extension only: +# -DWITH_BLT -I/usr/local/blt/blt8.0-unoff/include -lBLT8.0 \ +# *** Uncomment and edit for PIL (TkImaging) extension only: +# (See http://www.pythonware.com/products/pil/ for more info) +# -DWITH_PIL -I../Extensions/Imaging/libImaging tkImaging.c \ +# *** Uncomment and edit for TOGL extension only: +# -DWITH_TOGL togl.c \ +# *** Uncomment and edit to reflect your Tcl/Tk versions: +# -ltk8.2 -ltcl8.2 \ +# *** Uncomment and edit to reflect where your X11 libraries are: +# -L/usr/X11R6/lib \ +# *** Or uncomment this for Solaris: +# -L/usr/openwin/lib \ +# *** Uncomment these for TOGL extension only: +# -lGL -lGLU -lXext -lXmu \ +# *** Uncomment for AIX: +# -lld \ +# *** Always uncomment this; X11 libraries to link with: +# -lX11 + +# Lance Ellinghaus's syslog module +#syslog syslogmodule.c # syslog daemon interface + + +# Curses support, requiring the System V version of curses, often +# provided by the ncurses library. e.g. on Linux, link with -lncurses +# instead of -lcurses). + +#_curses _cursesmodule.c -lcurses -ltermcap +# Wrapper for the panel library that's part of ncurses and SYSV curses. +#_curses_panel _curses_panel.c -lpanel -lncurses + + +# Modules that provide persistent dictionary-like semantics. You will +# probably want to arrange for at least one of them to be available on +# your machine, though none are defined by default because of library +# dependencies. The Python module dbm/__init__.py provides an +# implementation independent wrapper for these; dbm/dumb.py provides +# similar functionality (but slower of course) implemented in Python. + +#_dbm _dbmmodule.c # dbm(3) may require -lndbm or similar + +# Anthony Baxter's gdbm module. GNU dbm(3) will require -lgdbm: + +#_gdbm _gdbmmodule.c -I/usr/local/include -L/usr/local/lib -lgdbm + + +# Helper module for various ascii-encoders +binascii binascii.c + +# Fred Drake's interface to the Python parser +parser parsermodule.c + + +# Andrew Kuchling's zlib module. +# This require zlib 1.1.3 (or later). +# See http://www.gzip.org/zlib/ +zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz + +# Interface to the Expat XML parser +# More information on Expat can be found at www.libexpat.org. +# +pyexpat pyexpat.c -I$(prefix)/include -L$(prefix)/lib -lexpat -DHAVE_EXPAT_CONFIG_H -DUSE_PYEXPAT_CAPI + +# Hye-Shik Chang's CJKCodecs + +# multibytecodec is required for all the other CJK codec modules +_multibytecodec cjkcodecs/multibytecodec.c + +_codecs_cn cjkcodecs/_codecs_cn.c +_codecs_hk cjkcodecs/_codecs_hk.c +_codecs_iso2022 cjkcodecs/_codecs_iso2022.c +_codecs_jp cjkcodecs/_codecs_jp.c +_codecs_kr cjkcodecs/_codecs_kr.c +_codecs_tw cjkcodecs/_codecs_tw.c + +# Example -- included for reference only: +# xx xxmodule.c + +# Another example -- the 'xxsubtype' module shows C-level subtyping in action +xxsubtype xxsubtype.c + +SQLITEDEFINES='-DMODULE_NAME="sqlite3"' +_sqlite3 _sqlite/connection.c \ + _sqlite/cursor.c _sqlite/microprotocols.c _sqlite/prepare_protocol.c \ + _sqlite/row.c _sqlite/statement.c _sqlite/module.c _sqlite/util.c _sqlite/cache.c \ + -I$(prefix)/include -L$(prefix)/lib -lsqlite3 $(SQLITEDEFINES) + +_ctypes _ctypes/callbacks.c _ctypes/callproc.c _ctypes/cfield.c _ctypes/_ctypes.c \ + _ctypes/malloc_closure.c _ctypes/stgdict.c \ + -I$(prefix)/include/ffi -L$(prefix)/lib -lffi + +_queue _queuemodule.c + +# Uncommenting the following line tells makesetup that all following modules +# are not built (see above for more detail). +# +#*disabled* +# +#_sqlite3 _tkinter _curses pyexpat +#_codecs_jp _codecs_kr _codecs_tw unicodedata diff --git a/tools/depends/target/python3/no-abort.patch b/tools/depends/target/python3/no-abort.patch new file mode 100644 index 0000000000..e509c2d1e7 --- /dev/null +++ b/tools/depends/target/python3/no-abort.patch @@ -0,0 +1,22 @@ +--- a/Modules/posixmodule.c ++++ b/Modules/posixmodule.c +@@ -10365,7 +10365,7 @@ + os_abort_impl(PyObject *module) + /*[clinic end generated code: output=dcf52586dad2467c input=cf2c7d98bc504047]*/ + { +- abort(); ++ // abort(); + /*NOTREACHED*/ + Py_FatalError("abort() called from Python code didn't abort!"); + return NULL; +--- a/Python/pythonrun.c ++++ b/Python/pythonrun.c +@@ -1697,7 +1697,7 @@ + DebugBreak(); + #endif + #endif /* MS_WINDOWS */ +- abort(); ++ // abort(); + } + + /* Clean up and exit */ diff --git a/tools/depends/target/python3/setup.patch b/tools/depends/target/python3/setup.patch new file mode 100644 index 0000000000..64968d413e --- /dev/null +++ b/tools/depends/target/python3/setup.patch @@ -0,0 +1,74 @@ +--- a/Modules/makesetup ++++ b/Modules/makesetup +@@ -212,6 +212,7 @@ + objs="$objs $obj" + case $src in + glmodule.c) ;; ++ # _*io.c) src='$(srcdir)/'"$srcdir/_io/$(echo $src| tr -d "_")";; + /*) ;; + \$*) ;; + *) src='$(srcdir)/'"$srcdir/$src";; +--- a/setup.py ++++ b/setup.py +@@ -337,6 +337,9 @@ + self.announce('WARNING: skipping import check for Cygwin-based "%s"' + % ext.name) + return ++ #if os.environ.get('CROSS_COMPILE_TARGET') == 'yes': ++ # return ++ + ext_filename = os.path.join( + self.build_lib, + self.get_ext_filename(self.get_ext_fullname(ext.name))) +@@ -351,27 +354,30 @@ + try: + imp.load_dynamic(ext.name, ext_filename) + except ImportError, why: +- self.failed.append(ext.name) +- self.announce('*** WARNING: renaming "%s" since importing it' +- ' failed: %s' % (ext.name, why), level=3) +- assert not self.inplace +- basename, tail = os.path.splitext(ext_filename) +- newname = basename + "_failed" + tail +- if os.path.exists(newname): +- os.remove(newname) +- os.rename(ext_filename, newname) +- +- # XXX -- This relies on a Vile HACK in +- # distutils.command.build_ext.build_extension(). The +- # _built_objects attribute is stored there strictly for +- # use here. +- # If there is a failure, _built_objects may not be there, +- # so catch the AttributeError and move on. +- try: +- for filename in self._built_objects: +- os.remove(filename) +- except AttributeError: +- self.announce('unable to remove files (ignored)') ++ if os.environ.get('CROSS_COMPILE_TARGET') != "yes": ++ self.failed.append(ext.name) ++ self.announce('*** WARNING: renaming "%s" since importing it' ++ ' failed: %s' % (ext.name, why), level=3) ++ assert not self.inplace ++ basename, tail = os.path.splitext(ext_filename) ++ newname = basename + "_failed" + tail ++ if os.path.exists(newname): ++ os.remove(newname) ++ os.rename(ext_filename, newname) ++ ++ # XXX -- This relies on a Vile HACK in ++ # distutils.command.build_ext.build_extension(). The ++ # _built_objects attribute is stored there strictly for ++ # use here. ++ # If there is a failure, _built_objects may not be there, ++ # so catch the AttributeError and move on. ++ try: ++ for filename in self._built_objects: ++ os.remove(filename) ++ except AttributeError: ++ self.announce('unable to remove files (ignored)') ++ else: ++ self.announce('WARNING: "%s" failed importing, ignored because we are cross-compiling' % ext.name) + except: + exc_type, why, tb = sys.exc_info() + self.announce('*** WARNING: importing extension "%s" ' |