summaryrefslogtreecommitdiffstats
path: root/external/python3
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--external/python3/ExternalPackage_python3.mk892
-rw-r--r--external/python3/ExternalProject_python3.mk213
-rw-r--r--external/python3/GeneratedPackage_python3.mk18
-rw-r--r--external/python3/Makefile7
-rw-r--r--external/python3/Module_python3.mk22
-rw-r--r--external/python3/README1
-rw-r--r--external/python3/UnpackedTarball_python3.mk52
-rw-r--r--external/python3/darwin.patch.010
-rw-r--r--external/python3/i100492-freebsd.patch.135
-rw-r--r--external/python3/internal-zlib.patch.055
-rw-r--r--external/python3/macos-11.patch.034
-rw-r--r--external/python3/python-3.3.0-darwin.patch.165
-rw-r--r--external/python3/python-3.3.3-disable-obmalloc.patch.021
-rw-r--r--external/python3/python-3.3.3-elf-rpath.patch.125
-rw-r--r--external/python3/python-3.5.4-msvc-disable.patch.158
-rw-r--r--external/python3/python-3.5.tweak.strip.soabi.patch12
-rw-r--r--external/python3/python-3.7.6-msvc-ssl.patch.125
-rw-r--r--external/python3/python-3.8-msvc-sdk.patch.1173
-rw-r--r--external/python3/tsan.patch.010
-rw-r--r--external/python3/ubsan.patch.043
20 files changed, 1771 insertions, 0 deletions
diff --git a/external/python3/ExternalPackage_python3.mk b/external/python3/ExternalPackage_python3.mk
new file mode 100644
index 000000000..9987ab138
--- /dev/null
+++ b/external/python3/ExternalPackage_python3.mk
@@ -0,0 +1,892 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_ExternalPackage_ExternalPackage,python3,python3))
+
+$(eval $(call gb_ExternalPackage_use_external_project,python3,python3))
+
+ifeq ($(OS),WNT)
+ifeq ($(CPUNAME),X86_64)
+python_arch_subdir=amd64/
+else ifeq ($(CPUNAME),AARCH64)
+python_arch_subdir=arm64/
+else
+python_arch_subdir=win32/
+endif
+
+$(eval $(call gb_ExternalPackage_add_file,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/bin/python.exe,PCbuild/$(python_arch_subdir)python$(if $(MSVC_USE_DEBUG_RUNTIME),_d).exe))
+$(eval $(call gb_ExternalPackage_add_file,python3,$(LIBO_BIN_FOLDER)/python$(PYTHON_VERSION_MAJOR)$(PYTHON_VERSION_MINOR)$(if $(MSVC_USE_DEBUG_RUNTIME),_d).dll,PCbuild/$(python_arch_subdir)python$(PYTHON_VERSION_MAJOR)$(PYTHON_VERSION_MINOR)$(if $(MSVC_USE_DEBUG_RUNTIME),_d).dll))
+ifeq ($(MSVC_USE_DEBUG_RUNTIME),)
+$(eval $(call gb_ExternalPackage_add_file,python3,$(LIBO_BIN_FOLDER)/python$(PYTHON_VERSION_MAJOR).dll,PCbuild/$(python_arch_subdir)python$(PYTHON_VERSION_MAJOR).dll))
+endif
+python3_EXTENSION_MODULES= \
+ PCbuild/$(python_arch_subdir)_asyncio$(if $(MSVC_USE_DEBUG_RUNTIME),_d).pyd \
+ PCbuild/$(python_arch_subdir)_ctypes$(if $(MSVC_USE_DEBUG_RUNTIME),_d).pyd \
+ PCbuild/$(python_arch_subdir)_decimal$(if $(MSVC_USE_DEBUG_RUNTIME),_d).pyd \
+ PCbuild/$(python_arch_subdir)_elementtree$(if $(MSVC_USE_DEBUG_RUNTIME),_d).pyd \
+ PCbuild/$(python_arch_subdir)_msi$(if $(MSVC_USE_DEBUG_RUNTIME),_d).pyd \
+ PCbuild/$(python_arch_subdir)_multiprocessing$(if $(MSVC_USE_DEBUG_RUNTIME),_d).pyd \
+ PCbuild/$(python_arch_subdir)_overlapped$(if $(MSVC_USE_DEBUG_RUNTIME),_d).pyd \
+ PCbuild/$(python_arch_subdir)_queue$(if $(MSVC_USE_DEBUG_RUNTIME),_d).pyd \
+ PCbuild/$(python_arch_subdir)_socket$(if $(MSVC_USE_DEBUG_RUNTIME),_d).pyd \
+ PCbuild/$(python_arch_subdir)_ssl$(if $(MSVC_USE_DEBUG_RUNTIME),_d).pyd \
+ PCbuild/$(python_arch_subdir)pyexpat$(if $(MSVC_USE_DEBUG_RUNTIME),_d).pyd \
+ PCbuild/$(python_arch_subdir)select$(if $(MSVC_USE_DEBUG_RUNTIME),_d).pyd \
+ PCbuild/$(python_arch_subdir)unicodedata$(if $(MSVC_USE_DEBUG_RUNTIME),_d).pyd \
+ PCbuild/$(python_arch_subdir)winsound$(if $(MSVC_USE_DEBUG_RUNTIME),_d).pyd \
+
+$(eval $(call gb_ExternalPackage_add_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib,\
+ $(python3_EXTENSION_MODULES) \
+))
+else
+$(eval $(call gb_ExternalPackage_add_file,python3,$(LIBO_BIN_FOLDER)/python.bin,python))
+$(eval $(call gb_ExternalPackage_add_file,python3,$(LIBO_BIN_FOLDER)/libpython$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)$(if $(ENABLE_DBGUTIL),d).so,libpython$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)$(if $(ENABLE_DBGUTIL),d).so))
+$(eval $(call gb_ExternalPackage_add_file,python3,$(LIBO_BIN_FOLDER)/libpython$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)$(if $(ENABLE_DBGUTIL),d).so.1.0,libpython$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)$(if $(ENABLE_DBGUTIL),d).so))
+$(eval $(call gb_ExternalPackage_add_file,python3,$(LIBO_BIN_FOLDER)/python.bin-gdb.py,Tools/gdb/libpython.py))
+
+# Unfortunately the python build system does not allow to explicitly enable or
+# disable these, it just tries to build them and then prints which did not
+# build successfully without stopping; that's why ExternalProject_python3 explicitly checks for the
+# existence of all the files on the python3_EXTENSION_MODULES list at the end of the build.
+# Obviously this list should not contain stuff with external dependencies
+# that may not be available on baseline systems.
+
+ifneq ($(OS),AIX)
+python3_EXTENSION_MODULE_SUFFIX=cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)$(if $(ENABLE_DBGUTIL),d)
+python3_EXTENSION_MODULES= \
+ LO_lib/array.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/_asyncio.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/audioop.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/binascii.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/_bisect.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/_blake2.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/cmath.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/_codecs_cn.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/_codecs_hk.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/_codecs_iso2022.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/_codecs_jp.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/_codecs_kr.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/_codecs_tw.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/_contextvars.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/_crypt.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/_csv.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/_ctypes.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/_datetime.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/_decimal.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/_elementtree.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/fcntl.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/grp.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ $(if $(ENABLE_OPENSSL), \
+ LO_lib/_hashlib.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ ) \
+ LO_lib/_heapq.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/_json.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/_lsprof.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/math.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/_md5.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/mmap.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/_multibytecodec.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/_multiprocessing.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/_opcode.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/ossaudiodev.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/parser.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/_pickle.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/_posixshmem.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/_posixsubprocess.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/pyexpat.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/_queue.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/_random.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/resource.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/select.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/_sha1.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/_sha256.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/_sha3.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/_sha512.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/_socket.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/spwd.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ $(if $(ENABLE_OPENSSL), \
+ LO_lib/_ssl.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ ) \
+ LO_lib/_statistics.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/_struct.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/syslog.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/termios.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/unicodedata.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ $(if $(ENABLE_DBGUTIL),, \
+ LO_lib/xxlimited.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ )\
+ LO_lib/_xxsubinterpreters.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/_xxtestfuzz.$(python3_EXTENSION_MODULE_SUFFIX).so \
+ LO_lib/zlib.$(python3_EXTENSION_MODULE_SUFFIX).so \
+
+$(eval $(call gb_ExternalPackage_add_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/lib-dynload,\
+ $(python3_EXTENSION_MODULES) \
+))
+endif
+endif
+
+# headers are not delivered, but used from unpacked dir Include/
+# (+ toplevel for pyconfig.h)
+
+ifeq ($(OS),LINUX)
+python3_MACHDEP=linux
+else
+ifeq ($(OS),MACOSX)
+python3_MACHDEP=darwin
+endif
+endif
+
+# that one is generated...
+# note: python configure overrides config.guess with something that doesn't
+# put -pc in its linux platform triplets, so filter that...
+ifneq ($(OS),WNT)
+ifeq ($(CPUNAME),ARM)
+$(eval $(call gb_ExternalPackage_add_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib,\
+ LO_lib/_sysconfigdata_$(if $(ENABLE_DBGUTIL),d)_$(python3_MACHDEP)_$(subst i686,i386,$(subst v7l-unknown,,$(HOST_PLATFORM))).py \
+))
+else
+$(eval $(call gb_ExternalPackage_add_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib,\
+ LO_lib/_sysconfigdata_$(if $(ENABLE_DBGUTIL),d)_$(python3_MACHDEP)_$(subst i686,i386,$(subst -pc,,$(HOST_PLATFORM))).py \
+))
+endif
+endif
+
+
+# packages not shipped:
+# dbm, sqlite3 - need some database stuff
+# curses - need curses to build the C module
+# idlelib, tkinter, turtledemo - need Tk to build the C module
+# test - probably unnecessary? was explicitly removed #i116738#
+# venv - why would we need virtual environments
+#
+# These lists are now sorted with "LC_COLLATE=C sort", by using
+# find Lib/ -name "*.py" | sort | sed -e 's/^/\t/' -e 's/$/ \\/'
+#
+
+$(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib,\
+ LICENSE \
+ Lib/__future__.py \
+ Lib/__phello__.foo.py \
+ Lib/_bootlocale.py \
+ Lib/_collections_abc.py \
+ Lib/_compat_pickle.py \
+ Lib/_compression.py \
+ Lib/_dummy_thread.py \
+ Lib/_markupbase.py \
+ Lib/_osx_support.py \
+ Lib/_py_abc.py \
+ Lib/_pydecimal.py \
+ Lib/_pyio.py \
+ Lib/_sitebuiltins.py \
+ Lib/_strptime.py \
+ Lib/_threading_local.py \
+ Lib/_weakrefset.py \
+ Lib/abc.py \
+ Lib/aifc.py \
+ Lib/antigravity.py \
+ Lib/argparse.py \
+ Lib/ast.py \
+ Lib/asynchat.py \
+ Lib/asyncore.py \
+ Lib/base64.py \
+ Lib/bdb.py \
+ Lib/binhex.py \
+ Lib/bisect.py \
+ Lib/bz2.py \
+ Lib/cProfile.py \
+ Lib/calendar.py \
+ Lib/cgi.py \
+ Lib/cgitb.py \
+ Lib/chunk.py \
+ Lib/cmd.py \
+ Lib/code.py \
+ Lib/codecs.py \
+ Lib/codeop.py \
+ Lib/colorsys.py \
+ Lib/compileall.py \
+ Lib/configparser.py \
+ Lib/contextlib.py \
+ Lib/contextvars.py \
+ Lib/copy.py \
+ Lib/copyreg.py \
+ Lib/crypt.py \
+ Lib/csv.py \
+ Lib/dataclasses.py \
+ Lib/datetime.py \
+ Lib/decimal.py \
+ Lib/difflib.py \
+ Lib/dis.py \
+ Lib/doctest.py \
+ Lib/dummy_threading.py \
+ Lib/enum.py \
+ Lib/filecmp.py \
+ Lib/fileinput.py \
+ Lib/fnmatch.py \
+ Lib/formatter.py \
+ Lib/fractions.py \
+ Lib/ftplib.py \
+ Lib/functools.py \
+ Lib/genericpath.py \
+ Lib/getopt.py \
+ Lib/getpass.py \
+ Lib/gettext.py \
+ Lib/glob.py \
+ Lib/gzip.py \
+ Lib/hashlib.py \
+ Lib/heapq.py \
+ Lib/hmac.py \
+ Lib/imaplib.py \
+ Lib/imghdr.py \
+ Lib/imp.py \
+ Lib/inspect.py \
+ Lib/io.py \
+ Lib/ipaddress.py \
+ Lib/keyword.py \
+ Lib/linecache.py \
+ Lib/locale.py \
+ Lib/lzma.py \
+ Lib/mailbox.py \
+ Lib/mailcap.py \
+ Lib/mimetypes.py \
+ Lib/modulefinder.py \
+ Lib/netrc.py \
+ Lib/nntplib.py \
+ Lib/ntpath.py \
+ Lib/nturl2path.py \
+ Lib/numbers.py \
+ Lib/opcode.py \
+ Lib/operator.py \
+ Lib/optparse.py \
+ Lib/os.py \
+ Lib/pathlib.py \
+ Lib/pdb.py \
+ Lib/pickle.py \
+ Lib/pickletools.py \
+ Lib/pipes.py \
+ Lib/pkgutil.py \
+ Lib/platform.py \
+ Lib/plistlib.py \
+ Lib/poplib.py \
+ Lib/posixpath.py \
+ Lib/pprint.py \
+ Lib/profile.py \
+ Lib/pstats.py \
+ Lib/pty.py \
+ Lib/py_compile.py \
+ Lib/pyclbr.py \
+ Lib/pydoc.py \
+ Lib/queue.py \
+ Lib/quopri.py \
+ Lib/random.py \
+ Lib/re.py \
+ Lib/reprlib.py \
+ Lib/rlcompleter.py \
+ Lib/runpy.py \
+ Lib/sched.py \
+ Lib/secrets.py \
+ Lib/selectors.py \
+ Lib/shelve.py \
+ Lib/shlex.py \
+ Lib/shutil.py \
+ Lib/signal.py \
+ Lib/site.py \
+ Lib/smtpd.py \
+ Lib/smtplib.py \
+ Lib/sndhdr.py \
+ Lib/socket.py \
+ Lib/socketserver.py \
+ Lib/sre_compile.py \
+ Lib/sre_constants.py \
+ Lib/sre_parse.py \
+ Lib/ssl.py \
+ Lib/stat.py \
+ Lib/statistics.py \
+ Lib/string.py \
+ Lib/stringprep.py \
+ Lib/struct.py \
+ Lib/subprocess.py \
+ Lib/sunau.py \
+ Lib/symbol.py \
+ Lib/symtable.py \
+ Lib/sysconfig.py \
+ Lib/tabnanny.py \
+ Lib/tarfile.py \
+ Lib/telnetlib.py \
+ Lib/tempfile.py \
+ Lib/textwrap.py \
+ Lib/this.py \
+ Lib/threading.py \
+ Lib/timeit.py \
+ Lib/token.py \
+ Lib/tokenize.py \
+ Lib/trace.py \
+ Lib/traceback.py \
+ Lib/tracemalloc.py \
+ Lib/tty.py \
+ Lib/turtle.py \
+ Lib/types.py \
+ Lib/typing.py \
+ Lib/uu.py \
+ Lib/uuid.py \
+ Lib/warnings.py \
+ Lib/wave.py \
+ Lib/weakref.py \
+ Lib/webbrowser.py \
+ Lib/xdrlib.py \
+ Lib/zipapp.py \
+ Lib/zipfile.py \
+ Lib/zipimport.py \
+))
+
+$(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/asyncio,\
+ Lib/asyncio/__init__.py \
+ Lib/asyncio/__main__.py \
+ Lib/asyncio/base_events.py \
+ Lib/asyncio/base_futures.py \
+ Lib/asyncio/base_subprocess.py \
+ Lib/asyncio/base_tasks.py \
+ Lib/asyncio/constants.py \
+ Lib/asyncio/coroutines.py \
+ Lib/asyncio/events.py \
+ Lib/asyncio/exceptions.py \
+ Lib/asyncio/format_helpers.py \
+ Lib/asyncio/futures.py \
+ Lib/asyncio/locks.py \
+ Lib/asyncio/log.py \
+ Lib/asyncio/proactor_events.py \
+ Lib/asyncio/protocols.py \
+ Lib/asyncio/queues.py \
+ Lib/asyncio/runners.py \
+ Lib/asyncio/selector_events.py \
+ Lib/asyncio/sslproto.py \
+ Lib/asyncio/staggered.py \
+ Lib/asyncio/streams.py \
+ Lib/asyncio/subprocess.py \
+ Lib/asyncio/tasks.py \
+ Lib/asyncio/transports.py \
+ Lib/asyncio/trsock.py \
+ Lib/asyncio/unix_events.py \
+ Lib/asyncio/windows_events.py \
+ Lib/asyncio/windows_utils.py \
+))
+
+$(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/collections,\
+ Lib/collections/__init__.py \
+ Lib/collections/abc.py \
+))
+
+$(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/concurrent,\
+ Lib/concurrent/__init__.py \
+))
+
+$(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/concurrent/futures,\
+ Lib/concurrent/futures/__init__.py \
+ Lib/concurrent/futures/_base.py \
+ Lib/concurrent/futures/process.py \
+ Lib/concurrent/futures/thread.py \
+))
+
+$(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/ctypes,\
+ Lib/ctypes/__init__.py \
+ Lib/ctypes/_aix.py \
+ Lib/ctypes/_endian.py \
+ Lib/ctypes/util.py \
+ Lib/ctypes/wintypes.py \
+))
+
+$(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/ctypes/macholib,\
+ Lib/ctypes/macholib/README.ctypes \
+ Lib/ctypes/macholib/fetch_macholib \
+ Lib/ctypes/macholib/fetch_macholib.bat \
+ Lib/ctypes/macholib/__init__.py \
+ Lib/ctypes/macholib/dyld.py \
+ Lib/ctypes/macholib/dylib.py \
+ Lib/ctypes/macholib/framework.py \
+))
+
+$(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/distutils,\
+ Lib/distutils/README \
+ Lib/distutils/__init__.py \
+ Lib/distutils/_msvccompiler.py \
+ Lib/distutils/archive_util.py \
+ Lib/distutils/bcppcompiler.py \
+ Lib/distutils/ccompiler.py \
+ Lib/distutils/cmd.py \
+ Lib/distutils/config.py \
+ Lib/distutils/core.py \
+ Lib/distutils/cygwinccompiler.py \
+ Lib/distutils/debug.py \
+ Lib/distutils/dep_util.py \
+ Lib/distutils/dir_util.py \
+ Lib/distutils/dist.py \
+ Lib/distutils/errors.py \
+ Lib/distutils/extension.py \
+ Lib/distutils/fancy_getopt.py \
+ Lib/distutils/file_util.py \
+ Lib/distutils/filelist.py \
+ Lib/distutils/log.py \
+ Lib/distutils/msvc9compiler.py \
+ Lib/distutils/msvccompiler.py \
+ Lib/distutils/spawn.py \
+ Lib/distutils/sysconfig.py \
+ Lib/distutils/text_file.py \
+ Lib/distutils/unixccompiler.py \
+ Lib/distutils/util.py \
+ Lib/distutils/version.py \
+ Lib/distutils/versionpredicate.py \
+))
+
+$(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/distutils/command,\
+ Lib/distutils/command/__init__.py \
+ Lib/distutils/command/bdist.py \
+ Lib/distutils/command/bdist_dumb.py \
+ Lib/distutils/command/bdist_msi.py \
+ Lib/distutils/command/bdist_rpm.py \
+ Lib/distutils/command/bdist_wininst.py \
+ Lib/distutils/command/build.py \
+ Lib/distutils/command/build_clib.py \
+ Lib/distutils/command/build_ext.py \
+ Lib/distutils/command/build_py.py \
+ Lib/distutils/command/build_scripts.py \
+ Lib/distutils/command/check.py \
+ Lib/distutils/command/clean.py \
+ Lib/distutils/command/command_template \
+ Lib/distutils/command/config.py \
+ Lib/distutils/command/install.py \
+ Lib/distutils/command/install_data.py \
+ Lib/distutils/command/install_egg_info.py \
+ Lib/distutils/command/install_headers.py \
+ Lib/distutils/command/install_lib.py \
+ Lib/distutils/command/install_scripts.py \
+ Lib/distutils/command/register.py \
+ Lib/distutils/command/sdist.py \
+ Lib/distutils/command/upload.py \
+ Lib/distutils/command/wininst-10.0.exe \
+ Lib/distutils/command/wininst-10.0-amd64.exe \
+ Lib/distutils/command/wininst-14.0.exe \
+ Lib/distutils/command/wininst-14.0-amd64.exe \
+ Lib/distutils/command/wininst-6.0.exe \
+ Lib/distutils/command/wininst-7.1.exe \
+ Lib/distutils/command/wininst-8.0.exe \
+ Lib/distutils/command/wininst-9.0.exe \
+ Lib/distutils/command/wininst-9.0-amd64.exe \
+))
+
+$(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/email,\
+ Lib/email/__init__.py \
+ Lib/email/_encoded_words.py \
+ Lib/email/_header_value_parser.py \
+ Lib/email/_parseaddr.py \
+ Lib/email/_policybase.py \
+ Lib/email/architecture.rst \
+ Lib/email/base64mime.py \
+ Lib/email/charset.py \
+ Lib/email/contentmanager.py \
+ Lib/email/encoders.py \
+ Lib/email/errors.py \
+ Lib/email/feedparser.py \
+ Lib/email/generator.py \
+ Lib/email/header.py \
+ Lib/email/headerregistry.py \
+ Lib/email/iterators.py \
+ Lib/email/message.py \
+ Lib/email/parser.py \
+ Lib/email/policy.py \
+ Lib/email/quoprimime.py \
+ Lib/email/utils.py \
+))
+
+$(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/email/mime,\
+ Lib/email/mime/__init__.py \
+ Lib/email/mime/application.py \
+ Lib/email/mime/audio.py \
+ Lib/email/mime/base.py \
+ Lib/email/mime/image.py \
+ Lib/email/mime/message.py \
+ Lib/email/mime/multipart.py \
+ Lib/email/mime/nonmultipart.py \
+ Lib/email/mime/text.py \
+))
+
+$(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/encodings,\
+ Lib/encodings/__init__.py \
+ Lib/encodings/aliases.py \
+ Lib/encodings/ascii.py \
+ Lib/encodings/base64_codec.py \
+ Lib/encodings/big5.py \
+ Lib/encodings/big5hkscs.py \
+ Lib/encodings/bz2_codec.py \
+ Lib/encodings/charmap.py \
+ Lib/encodings/cp037.py \
+ Lib/encodings/cp1006.py \
+ Lib/encodings/cp1026.py \
+ Lib/encodings/cp1125.py \
+ Lib/encodings/cp1140.py \
+ Lib/encodings/cp1250.py \
+ Lib/encodings/cp1251.py \
+ Lib/encodings/cp1252.py \
+ Lib/encodings/cp1253.py \
+ Lib/encodings/cp1254.py \
+ Lib/encodings/cp1255.py \
+ Lib/encodings/cp1256.py \
+ Lib/encodings/cp1257.py \
+ Lib/encodings/cp1258.py \
+ Lib/encodings/cp273.py \
+ Lib/encodings/cp424.py \
+ Lib/encodings/cp437.py \
+ Lib/encodings/cp500.py \
+ Lib/encodings/cp720.py \
+ Lib/encodings/cp737.py \
+ Lib/encodings/cp775.py \
+ Lib/encodings/cp850.py \
+ Lib/encodings/cp852.py \
+ Lib/encodings/cp855.py \
+ Lib/encodings/cp856.py \
+ Lib/encodings/cp857.py \
+ Lib/encodings/cp858.py \
+ Lib/encodings/cp860.py \
+ Lib/encodings/cp861.py \
+ Lib/encodings/cp862.py \
+ Lib/encodings/cp863.py \
+ Lib/encodings/cp864.py \
+ Lib/encodings/cp865.py \
+ Lib/encodings/cp866.py \
+ Lib/encodings/cp869.py \
+ Lib/encodings/cp874.py \
+ Lib/encodings/cp875.py \
+ Lib/encodings/cp932.py \
+ Lib/encodings/cp949.py \
+ Lib/encodings/cp950.py \
+ Lib/encodings/euc_jis_2004.py \
+ Lib/encodings/euc_jisx0213.py \
+ Lib/encodings/euc_jp.py \
+ Lib/encodings/euc_kr.py \
+ Lib/encodings/gb18030.py \
+ Lib/encodings/gb2312.py \
+ Lib/encodings/gbk.py \
+ Lib/encodings/hex_codec.py \
+ Lib/encodings/hp_roman8.py \
+ Lib/encodings/hz.py \
+ Lib/encodings/idna.py \
+ Lib/encodings/iso2022_jp.py \
+ Lib/encodings/iso2022_jp_1.py \
+ Lib/encodings/iso2022_jp_2.py \
+ Lib/encodings/iso2022_jp_2004.py \
+ Lib/encodings/iso2022_jp_3.py \
+ Lib/encodings/iso2022_jp_ext.py \
+ Lib/encodings/iso2022_kr.py \
+ Lib/encodings/iso8859_1.py \
+ Lib/encodings/iso8859_10.py \
+ Lib/encodings/iso8859_11.py \
+ Lib/encodings/iso8859_13.py \
+ Lib/encodings/iso8859_14.py \
+ Lib/encodings/iso8859_15.py \
+ Lib/encodings/iso8859_16.py \
+ Lib/encodings/iso8859_2.py \
+ Lib/encodings/iso8859_3.py \
+ Lib/encodings/iso8859_4.py \
+ Lib/encodings/iso8859_5.py \
+ Lib/encodings/iso8859_6.py \
+ Lib/encodings/iso8859_7.py \
+ Lib/encodings/iso8859_8.py \
+ Lib/encodings/iso8859_9.py \
+ Lib/encodings/johab.py \
+ Lib/encodings/koi8_r.py \
+ Lib/encodings/koi8_t.py \
+ Lib/encodings/koi8_u.py \
+ Lib/encodings/kz1048.py \
+ Lib/encodings/latin_1.py \
+ Lib/encodings/mac_arabic.py \
+ Lib/encodings/mac_centeuro.py \
+ Lib/encodings/mac_croatian.py \
+ Lib/encodings/mac_cyrillic.py \
+ Lib/encodings/mac_farsi.py \
+ Lib/encodings/mac_greek.py \
+ Lib/encodings/mac_iceland.py \
+ Lib/encodings/mac_latin2.py \
+ Lib/encodings/mac_roman.py \
+ Lib/encodings/mac_romanian.py \
+ Lib/encodings/mac_turkish.py \
+ Lib/encodings/mbcs.py \
+ Lib/encodings/oem.py \
+ Lib/encodings/palmos.py \
+ Lib/encodings/ptcp154.py \
+ Lib/encodings/punycode.py \
+ Lib/encodings/quopri_codec.py \
+ Lib/encodings/raw_unicode_escape.py \
+ Lib/encodings/rot_13.py \
+ Lib/encodings/shift_jis.py \
+ Lib/encodings/shift_jis_2004.py \
+ Lib/encodings/shift_jisx0213.py \
+ Lib/encodings/tis_620.py \
+ Lib/encodings/undefined.py \
+ Lib/encodings/unicode_escape.py \
+ Lib/encodings/utf_16.py \
+ Lib/encodings/utf_16_be.py \
+ Lib/encodings/utf_16_le.py \
+ Lib/encodings/utf_32.py \
+ Lib/encodings/utf_32_be.py \
+ Lib/encodings/utf_32_le.py \
+ Lib/encodings/utf_7.py \
+ Lib/encodings/utf_8.py \
+ Lib/encodings/utf_8_sig.py \
+ Lib/encodings/uu_codec.py \
+ Lib/encodings/zlib_codec.py \
+))
+
+$(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/html,\
+ Lib/html/__init__.py \
+ Lib/html/entities.py \
+ Lib/html/parser.py \
+))
+
+$(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/http,\
+ Lib/http/__init__.py \
+ Lib/http/client.py \
+ Lib/http/cookiejar.py \
+ Lib/http/cookies.py \
+ Lib/http/server.py \
+))
+
+$(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/importlib,\
+ Lib/importlib/__init__.py \
+ Lib/importlib/_bootstrap.py \
+ Lib/importlib/_bootstrap_external.py \
+ Lib/importlib/abc.py \
+ Lib/importlib/machinery.py \
+ Lib/importlib/metadata.py \
+ Lib/importlib/resources.py \
+ Lib/importlib/util.py \
+))
+
+$(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/json,\
+ Lib/json/__init__.py \
+ Lib/json/decoder.py \
+ Lib/json/encoder.py \
+ Lib/json/scanner.py \
+ Lib/json/tool.py \
+))
+
+$(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/lib2to3,\
+ Lib/lib2to3/__init__.py \
+ Lib/lib2to3/__main__.py \
+ Lib/lib2to3/Grammar.txt \
+ Lib/lib2to3/PatternGrammar.txt \
+ Lib/lib2to3/btm_matcher.py \
+ Lib/lib2to3/btm_utils.py \
+ Lib/lib2to3/fixer_base.py \
+ Lib/lib2to3/fixer_util.py \
+ Lib/lib2to3/main.py \
+ Lib/lib2to3/patcomp.py \
+ Lib/lib2to3/pygram.py \
+ Lib/lib2to3/pytree.py \
+ Lib/lib2to3/refactor.py \
+))
+
+$(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/lib2to3/fixes,\
+ Lib/lib2to3/fixes/__init__.py \
+ Lib/lib2to3/fixes/fix_apply.py \
+ Lib/lib2to3/fixes/fix_asserts.py \
+ Lib/lib2to3/fixes/fix_basestring.py \
+ Lib/lib2to3/fixes/fix_buffer.py \
+ Lib/lib2to3/fixes/fix_dict.py \
+ Lib/lib2to3/fixes/fix_except.py \
+ Lib/lib2to3/fixes/fix_exec.py \
+ Lib/lib2to3/fixes/fix_execfile.py \
+ Lib/lib2to3/fixes/fix_exitfunc.py \
+ Lib/lib2to3/fixes/fix_filter.py \
+ Lib/lib2to3/fixes/fix_funcattrs.py \
+ Lib/lib2to3/fixes/fix_future.py \
+ Lib/lib2to3/fixes/fix_getcwdu.py \
+ Lib/lib2to3/fixes/fix_has_key.py \
+ Lib/lib2to3/fixes/fix_idioms.py \
+ Lib/lib2to3/fixes/fix_import.py \
+ Lib/lib2to3/fixes/fix_imports.py \
+ Lib/lib2to3/fixes/fix_imports2.py \
+ Lib/lib2to3/fixes/fix_input.py \
+ Lib/lib2to3/fixes/fix_intern.py \
+ Lib/lib2to3/fixes/fix_isinstance.py \
+ Lib/lib2to3/fixes/fix_itertools.py \
+ Lib/lib2to3/fixes/fix_itertools_imports.py \
+ Lib/lib2to3/fixes/fix_long.py \
+ Lib/lib2to3/fixes/fix_map.py \
+ Lib/lib2to3/fixes/fix_metaclass.py \
+ Lib/lib2to3/fixes/fix_methodattrs.py \
+ Lib/lib2to3/fixes/fix_ne.py \
+ Lib/lib2to3/fixes/fix_next.py \
+ Lib/lib2to3/fixes/fix_nonzero.py \
+ Lib/lib2to3/fixes/fix_numliterals.py \
+ Lib/lib2to3/fixes/fix_operator.py \
+ Lib/lib2to3/fixes/fix_paren.py \
+ Lib/lib2to3/fixes/fix_print.py \
+ Lib/lib2to3/fixes/fix_raise.py \
+ Lib/lib2to3/fixes/fix_raw_input.py \
+ Lib/lib2to3/fixes/fix_reduce.py \
+ Lib/lib2to3/fixes/fix_reload.py \
+ Lib/lib2to3/fixes/fix_renames.py \
+ Lib/lib2to3/fixes/fix_repr.py \
+ Lib/lib2to3/fixes/fix_set_literal.py \
+ Lib/lib2to3/fixes/fix_standarderror.py \
+ Lib/lib2to3/fixes/fix_sys_exc.py \
+ Lib/lib2to3/fixes/fix_throw.py \
+ Lib/lib2to3/fixes/fix_tuple_params.py \
+ Lib/lib2to3/fixes/fix_types.py \
+ Lib/lib2to3/fixes/fix_unicode.py \
+ Lib/lib2to3/fixes/fix_urllib.py \
+ Lib/lib2to3/fixes/fix_ws_comma.py \
+ Lib/lib2to3/fixes/fix_xrange.py \
+ Lib/lib2to3/fixes/fix_xreadlines.py \
+ Lib/lib2to3/fixes/fix_zip.py \
+))
+
+$(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/pgen2,\
+ Lib/lib2to3/pgen2/__init__.py \
+ Lib/lib2to3/pgen2/conv.py \
+ Lib/lib2to3/pgen2/driver.py \
+ Lib/lib2to3/pgen2/grammar.py \
+ Lib/lib2to3/pgen2/literals.py \
+ Lib/lib2to3/pgen2/parse.py \
+ Lib/lib2to3/pgen2/pgen.py \
+ Lib/lib2to3/pgen2/token.py \
+ Lib/lib2to3/pgen2/tokenize.py \
+))
+
+$(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/logging,\
+ Lib/logging/__init__.py \
+ Lib/logging/config.py \
+ Lib/logging/handlers.py \
+))
+
+ifeq (WNT,$(OS))
+$(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/msilib,\
+ Lib/msilib/__init__.py \
+ Lib/msilib/schema.py \
+ Lib/msilib/sequence.py \
+ Lib/msilib/text.py \
+))
+endif
+
+$(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/multiprocessing,\
+ Lib/multiprocessing/__init__.py \
+ Lib/multiprocessing/connection.py \
+ Lib/multiprocessing/context.py \
+ Lib/multiprocessing/dummy/__init__.py \
+ Lib/multiprocessing/dummy/connection.py \
+ Lib/multiprocessing/forkserver.py \
+ Lib/multiprocessing/heap.py \
+ Lib/multiprocessing/managers.py \
+ Lib/multiprocessing/pool.py \
+ Lib/multiprocessing/popen_fork.py \
+ Lib/multiprocessing/popen_forkserver.py \
+ Lib/multiprocessing/popen_spawn_posix.py \
+ Lib/multiprocessing/popen_spawn_win32.py \
+ Lib/multiprocessing/process.py \
+ Lib/multiprocessing/queues.py \
+ Lib/multiprocessing/reduction.py \
+ Lib/multiprocessing/resource_sharer.py \
+ Lib/multiprocessing/resource_tracker.py \
+ Lib/multiprocessing/shared_memory.py \
+ Lib/multiprocessing/sharedctypes.py \
+ Lib/multiprocessing/spawn.py \
+ Lib/multiprocessing/synchronize.py \
+ Lib/multiprocessing/util.py \
+))
+
+$(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/multiprocessing/dummy,\
+ Lib/multiprocessing/dummy/__init__.py \
+ Lib/multiprocessing/dummy/connection.py \
+))
+
+$(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/pydoc_data,\
+ Lib/pydoc_data/__init__.py \
+ Lib/pydoc_data/_pydoc.css \
+ Lib/pydoc_data/topics.py \
+))
+
+$(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/unittest,\
+ Lib/unittest/__init__.py \
+ Lib/unittest/__main__.py \
+ Lib/unittest/async_case.py \
+ Lib/unittest/case.py \
+ Lib/unittest/loader.py \
+ Lib/unittest/main.py \
+ Lib/unittest/mock.py \
+ Lib/unittest/result.py \
+ Lib/unittest/runner.py \
+ Lib/unittest/signals.py \
+ Lib/unittest/suite.py \
+ Lib/unittest/util.py \
+))
+
+$(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/urllib,\
+ Lib/urllib/__init__.py \
+ Lib/urllib/error.py \
+ Lib/urllib/parse.py \
+ Lib/urllib/request.py \
+ Lib/urllib/response.py \
+ Lib/urllib/robotparser.py \
+))
+
+$(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/wsgiref,\
+ Lib/wsgiref/__init__.py \
+ Lib/wsgiref/handlers.py \
+ Lib/wsgiref/headers.py \
+ Lib/wsgiref/simple_server.py \
+ Lib/wsgiref/util.py \
+ Lib/wsgiref/validate.py \
+))
+
+$(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/xml,\
+ Lib/xml/__init__.py \
+))
+
+$(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/xml/dom,\
+ Lib/xml/dom/__init__.py \
+ Lib/xml/dom/domreg.py \
+ Lib/xml/dom/expatbuilder.py \
+ Lib/xml/dom/minicompat.py \
+ Lib/xml/dom/minidom.py \
+ Lib/xml/dom/NodeFilter.py \
+ Lib/xml/dom/pulldom.py \
+ Lib/xml/dom/xmlbuilder.py \
+))
+
+$(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/xml/etree,\
+ Lib/xml/etree/__init__.py \
+ Lib/xml/etree/cElementTree.py \
+ Lib/xml/etree/ElementInclude.py \
+ Lib/xml/etree/ElementPath.py \
+ Lib/xml/etree/ElementTree.py \
+))
+
+$(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/xml/parsers,\
+ Lib/xml/parsers/__init__.py \
+ Lib/xml/parsers/expat.py \
+))
+
+$(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/xml/sax,\
+ Lib/xml/sax/__init__.py \
+ Lib/xml/sax/_exceptions.py \
+ Lib/xml/sax/expatreader.py \
+ Lib/xml/sax/handler.py \
+ Lib/xml/sax/saxutils.py \
+ Lib/xml/sax/xmlreader.py \
+))
+
+$(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/xmlrpc,\
+ Lib/xmlrpc/__init__.py \
+ Lib/xmlrpc/client.py \
+ Lib/xmlrpc/server.py \
+))
+
+$(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/site-packages,\
+ Lib/site-packages/README.txt \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/python3/ExternalProject_python3.mk b/external/python3/ExternalProject_python3.mk
new file mode 100644
index 000000000..faa8e9738
--- /dev/null
+++ b/external/python3/ExternalProject_python3.mk
@@ -0,0 +1,213 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t; fill-column: 100 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_ExternalProject_ExternalProject,python3))
+
+$(eval $(call gb_ExternalProject_use_externals,python3,\
+ expat \
+ $(if $(filter WNT LINUX,$(OS)),libffi) \
+ openssl \
+ zlib \
+))
+
+$(eval $(call gb_ExternalProject_register_targets,python3,\
+ build \
+ $(if $(filter MACOSX,$(OS)),\
+ fixscripts \
+ fixinstallnames \
+ executables \
+ removeunnecessarystuff \
+ ) \
+))
+
+ifeq ($(OS),WNT)
+
+# TODO: using Debug configuration and related mangling of pyconfig.h
+
+# at least for MSVC 2008 it is necessary to clear MAKEFLAGS because
+# nmake is invoked
+$(call gb_ExternalProject_get_state_target,python3,build) :
+ $(call gb_Trace_StartRange,python3,EXTERNAL)
+ $(call gb_ExternalProject_run,build,\
+ MAKEFLAGS= MSBuild.exe pcbuild.sln /t:Build $(gb_MSBUILD_CONFIG_AND_PLATFORM) \
+ /p:opensslIncludeDir=$(call gb_UnpackedTarball_get_dir,openssl)/include \
+ /p:opensslOutDir=$(call gb_UnpackedTarball_get_dir,openssl) \
+ /p:zlibDir=$(call gb_UnpackedTarball_get_dir,zlib) \
+ /p:libffiOutDir=$(call gb_UnpackedTarball_get_dir,libffi)/$(HOST_PLATFORM)/.libs \
+ /p:libffiIncludeDir=$(call gb_UnpackedTarball_get_dir,libffi)/$(HOST_PLATFORM)/include \
+ /maxcpucount \
+ /p:PlatformToolset=$(VCTOOLSET) /p:VisualStudioVersion=$(VCVER) /ToolsVersion:Current \
+ $(if $(filter 10,$(WINDOWS_SDK_VERSION)),/p:WindowsTargetPlatformVersion=$(UCRTVERSION)) \
+ $(foreach i,$(python3_EXTENSION_MODULES), \
+ && { test -e ../$i || { printf 'Error: missing %s\n' $i; false; } }) \
+ ,PCBuild)
+ $(call gb_Trace_EndRange,python3,EXTERNAL)
+
+else
+
+# --with-system-expat: this should find the one in the workdir (or system)
+
+# OPENSSL_INCLUDES OPENSSL_LDFLAGS OPENSSL_LIBS cannot be set via commandline!
+# use --with-openssl instead, which requires include/ and lib/ subdirs.
+
+# libffi is not all that stable, with 3 different SONAMEs currently, so we
+# have to bundle it; --without-system-ffi does not work any more on Linux.
+# Unfortuantely (as of 3.7) pkg-config is used to locate libffi so we do some
+# hacks to find the libffi.pc in workdir by overriding PKG_CONFIG_LIBDIR.
+# Also, pkg-config is only used to find the headers, the libdir needs to be
+# passed extra.
+
+# create a symlink "LO_lib" because the .so are in a directory with platform
+# specific name like build/lib.linux-x86_64-3.3
+
+python3_cflags = $(ZLIB_CFLAGS)
+ifneq (,$(ENABLE_VALGRIND))
+ python3_cflags += $(VALGRIND_CFLAGS)
+endif
+
+# This happens to override the -O3 in the default OPT set in
+# workdir/UnpackedTarball/python3/configure.ac while keeping the other content of that OPT intact:
+ifeq ($(ENABLE_OPTIMIZED),)
+python3_cflags += $(gb_COMPILERNOOPTFLAGS)
+endif
+
+$(call gb_ExternalProject_get_state_target,python3,build) :
+ $(call gb_Trace_StartRange,python3,EXTERNAL)
+ $(call gb_ExternalProject_run,build,\
+ $(if $(filter MACOSX,$(OS)), \
+ $(if $(filter 10.8 10.9 10.10 10.11,$(MACOSX_DEPLOYMENT_TARGET)), \
+ ac_cv_func_getentropy=no \
+ ac_cv_func_clock_gettime=no \
+ ) \
+ ) \
+ $(gb_RUN_CONFIGURE) ./configure \
+ $(gb_CONFIGURE_PLATFORMS) \
+ $(if $(ENABLE_VALGRIND),--with-valgrind) \
+ $(if $(ENABLE_DBGUTIL),--with-pydebug) \
+ --prefix=/python-inst \
+ --with-system-expat \
+ $(if $(filter AIX,$(OS)), \
+ --disable-ipv6 --with-threads OPT="-g0 -fwrapv -O3 -Wall") \
+ $(if $(filter MACOSX,$(OS)), \
+ $(if $(filter INTEL,$(CPUNAME)),--enable-universalsdk=$(MACOSX_SDK_PATH) \
+ --with-universal-archs=intel \
+ ) \
+ --enable-framework=/@__________________________________________________OOO --with-framework-name=LibreOfficePython, \
+ --enable-shared \
+ ) \
+ $(if $(ENABLE_OPENSSL),$(if $(SYSTEM_OPENSSL),,\
+ --with-openssl=$(call gb_UnpackedTarball_get_dir,openssl) \
+ ) ) \
+ $(if $(filter LINUX,$(OS)), \
+ PKG_CONFIG_LIBDIR="$(call gb_UnpackedTarball_get_dir,libffi)/$(HOST_PLATFORM)$${PKG_CONFIG_LIBDIR:+:$$PKG_CONFIG_LIBDIR}" \
+ ) \
+ CC="$(strip $(CC) \
+ $(if $(SYSTEM_EXPAT),,-I$(call gb_UnpackedTarball_get_dir,expat)/lib) \
+ $(if $(SYSBASE), -I$(SYSBASE)/usr/include) \
+ )" \
+ $(if $(python3_cflags),CFLAGS='$(python3_cflags)') \
+ $(if $(filter -fsanitize=%,$(CC)),LINKCC="$(CXX) -pthread") \
+ LDFLAGS="$(strip $(LDFLAGS) \
+ $(if $(filter LINUX,$(OS)),-L$(call gb_UnpackedTarball_get_dir,libffi)/$(HOST_PLATFORM)/.libs) \
+ $(if $(SYSTEM_EXPAT),,-L$(gb_StaticLibrary_WORKDIR)) \
+ $(if $(SYSTEM_ZLIB),,-L$(gb_StaticLibrary_WORKDIR)) \
+ $(if $(SYSBASE), -L$(SYSBASE)/usr/lib) \
+ $(gb_LTOFLAGS) \
+ )" \
+ && MAKEFLAGS= $(MAKE) \
+ $(if $(filter MACOSX,$(OS)),DESTDIR=$(EXTERNAL_WORKDIR)/python-inst install) \
+ $(if $(SYSTEM_ZLIB),,ZLIB_INCDIR=$(WORKDIR)/UnpackedTarball/zlib) \
+ && ln -s build/lib.* LO_lib \
+ $(foreach i,$(python3_EXTENSION_MODULES), \
+ && { test -e $i || { printf 'Error: missing %s\n' $i; false; } }) \
+ )
+ $(call gb_Trace_EndRange,python3,EXTERNAL)
+
+endif
+
+# If you want to run Python's own unit tests, add this to the chain of commands above:
+# && MAKEFLAGS= $(MAKE) \
+# $(if $(filter MACOSX,$(OS)),DESTDIR=$(EXTERNAL_WORKDIR)/python-inst) \
+# $(if $(SYSTEM_ZLIB),,ZLIB_INCDIR=$(WORKDIR)/UnpackedTarball/zlib) \
+# test \
+
+ifeq ($(OS),MACOSX)
+
+python3_fw_prefix=$(call gb_UnpackedTarball_get_dir,python3)/python-inst/@__________________________________________________OOO/LibreOfficePython.framework
+
+# rule to allow relocating the whole framework, removing reference to buildinstallation directory
+# also scripts are not allowed to be signed as executables (with extended attributes), but need to
+# be treated as data/put into Resources folder, see also
+# https://developer.apple.com/library/archive/technotes/tn2206/_index.html
+$(call gb_ExternalProject_get_state_target,python3,fixscripts) : $(call gb_ExternalProject_get_state_target,python3,build)
+ $(call gb_Output_announce,python3 - remove reference to installroot from scripts,build,CUS,5)
+ $(COMMAND_ECHO)cd $(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/bin/ && \
+ for file in \
+ 2to3-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR) \
+ easy_install-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR) \
+ idle$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR) \
+ pip$(PYTHON_VERSION_MAJOR) \
+ pip$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR) \
+ pydoc$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR) \
+ python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)-config \
+ ; do { rm "$$file" && $(gb_AWK) '\
+ BEGIN {print "#!/usr/bin/env bash\n\
+origpath=$$(pwd)\n\
+bindir=$$(cd $$(dirname \"$$0\") ; pwd)\n\
+cd \"$$origpath\"\n\
+\"$$bindir/../Resources/Python.app/Contents/MacOS/LibreOfficePython\" - $$@ <<EOF"} \
+ FNR==1{next} \
+ {print} \
+ END {print "EOF"}' > "../Resources/$$file" ; } < "$$file" && \
+ chmod +x "../Resources/$$file" && ln -s "../Resources/$$file" ; done
+ touch $@
+
+$(call gb_ExternalProject_get_state_target,python3,fixinstallnames) : $(call gb_ExternalProject_get_state_target,python3,build) \
+ | $(call gb_ExternalProject_get_state_target,python3,removeunnecessarystuff)
+ $(INSTALL_NAME_TOOL) -change \
+ $(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/LibreOfficePython \
+ @executable_path/../../../../LibreOfficePython \
+ $(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/Resources/Python.app/Contents/MacOS/LibreOfficePython
+ for file in $(shell $(FIND) $(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/lib/python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/lib-dynload -name "*.so") ; do \
+ $(INSTALL_NAME_TOOL) -change \
+ $(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/LibreOfficePython \
+ @loader_path/../../../LibreOfficePython $$file ; done
+ touch $@
+
+$(call gb_ExternalProject_get_state_target,python3,executables) : $(call gb_ExternalProject_get_state_target,python3,build)
+ cd $(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/bin ; \
+ $(INSTALL_NAME_TOOL) -change \
+ $(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/LibreOfficePython \
+ @executable_path/../LibreOfficePython python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)
+ touch $@
+
+# Remove modules (both Python and binary bits) of questionable usefulness that we don't ship on
+# other platforms either. See the "packages not shipped" comment in ExternalPackage_python3.mk.
+
+$(call gb_ExternalProject_get_state_target,python3,removeunnecessarystuff) : $(call gb_ExternalProject_get_state_target,python3,build)
+ $(call gb_Output_announce,python3 - remove the stuff we don't need to ship,build,CUS,5)
+ rm -r $(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/lib/python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/dbm
+ rm -r $(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/lib/python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/sqlite3
+ rm -r $(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/lib/python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/curses
+ rm -r $(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/lib/python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/idlelib
+ rm -r $(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/lib/python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/tkinter
+ rm -r $(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/lib/python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/turtledemo
+ rm -r $(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/lib/python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/test
+ rm -r $(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/lib/python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/venv
+ # Then the binary libraries
+ rm $(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/lib/python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/lib-dynload/_dbm.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)*.so
+ rm $(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/lib/python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/lib-dynload/_sqlite3.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)*.so
+ rm $(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/lib/python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/lib-dynload/_curses.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)*.so
+ rm $(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/lib/python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/lib-dynload/_curses_panel.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)*.so
+ rm $(python3_fw_prefix)/Versions/$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/lib/python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)/lib-dynload/_test*.cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)*.so
+ touch $@
+
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/python3/GeneratedPackage_python3.mk b/external/python3/GeneratedPackage_python3.mk
new file mode 100644
index 000000000..ffde38be5
--- /dev/null
+++ b/external/python3/GeneratedPackage_python3.mk
@@ -0,0 +1,18 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_GeneratedPackage_GeneratedPackage,python3,$(call gb_UnpackedTarball_get_dir,python3)/python-inst/@__________________________________________________OOO))
+
+$(eval $(call gb_GeneratedPackage_use_unpacked,python3,python3))
+
+$(eval $(call gb_GeneratedPackage_use_external_project,python3,python3))
+
+$(eval $(call gb_GeneratedPackage_add_dir,python3,$(INSTROOT)/Frameworks/LibreOfficePython.framework,LibreOfficePython.framework))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/python3/Makefile b/external/python3/Makefile
new file mode 100644
index 000000000..e4968cf85
--- /dev/null
+++ b/external/python3/Makefile
@@ -0,0 +1,7 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+
+module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
+
+include $(module_directory)/../../solenv/gbuild/partial_build.mk
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/python3/Module_python3.mk b/external/python3/Module_python3.mk
new file mode 100644
index 000000000..5ef1deb21
--- /dev/null
+++ b/external/python3/Module_python3.mk
@@ -0,0 +1,22 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_Module_Module,python3))
+
+ifneq ($(DISABLE_PYTHON),TRUE)
+
+$(eval $(call gb_Module_add_targets,python3,\
+ UnpackedTarball_python3 \
+ ExternalProject_python3 \
+ $(if $(filter MACOSX,$(OS)),GeneratedPackage_python3,ExternalPackage_python3) \
+))
+
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/python3/README b/external/python3/README
new file mode 100644
index 000000000..edde023af
--- /dev/null
+++ b/external/python3/README
@@ -0,0 +1 @@
+CPython implementation of Python 3 from http://www.python.org
diff --git a/external/python3/UnpackedTarball_python3.mk b/external/python3/UnpackedTarball_python3.mk
new file mode 100644
index 000000000..06c64d7d5
--- /dev/null
+++ b/external/python3/UnpackedTarball_python3.mk
@@ -0,0 +1,52 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_UnpackedTarball_UnpackedTarball,python3))
+
+$(eval $(call gb_UnpackedTarball_set_tarball,python3,$(PYTHON_TARBALL),,python3))
+
+$(eval $(call gb_UnpackedTarball_fix_end_of_line,python3,\
+ PCbuild/pcbuild.sln \
+))
+
+# For the configure part of external/python3/darwin.patch.0, see
+# <https://bugs.python.org/issue44065> "'configure: error: internal configure error for the platform
+# triplet' on macOS with Clang supporting --print-multiarch:"
+$(eval $(call gb_UnpackedTarball_add_patches,python3,\
+ external/python3/i100492-freebsd.patch.1 \
+ external/python3/python-3.3.0-darwin.patch.1 \
+ external/python3/python-3.8-msvc-sdk.patch.1 \
+ external/python3/python-3.7.6-msvc-ssl.patch.1 \
+ external/python3/python-3.5.4-msvc-disable.patch.1 \
+ external/python3/ubsan.patch.0 \
+ external/python3/python-3.5.tweak.strip.soabi.patch \
+ external/python3/darwin.patch.0 \
+ external/python3/macos-11.patch.0 \
+ external/python3/tsan.patch.0 \
+))
+
+ifneq ($(filter DRAGONFLY FREEBSD LINUX NETBSD OPENBSD SOLARIS,$(OS)),)
+$(eval $(call gb_UnpackedTarball_add_patches,python3,\
+ external/python3/python-3.3.3-elf-rpath.patch.1 \
+))
+endif
+
+ifneq ($(ENABLE_RUNTIME_OPTIMIZATIONS),TRUE)
+$(eval $(call gb_UnpackedTarball_add_patches,python3,\
+ external/python3/python-3.3.3-disable-obmalloc.patch.0 \
+))
+endif
+
+ifneq ($(SYSTEM_ZLIB),TRUE)
+$(eval $(call gb_UnpackedTarball_add_patches,python3, \
+ external/python3/internal-zlib.patch.0 \
+))
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/python3/darwin.patch.0 b/external/python3/darwin.patch.0
new file mode 100644
index 000000000..139cdc978
--- /dev/null
+++ b/external/python3/darwin.patch.0
@@ -0,0 +1,10 @@
+--- Modules/_ctypes/libffi_osx/x86/darwin64.S
++++ Modules/_ctypes/libffi_osx/x86/darwin64.S
+@@ -29,7 +29,6 @@
+ #include <fficonfig.h>
+ #include <ffi.h>
+
+- .file "darwin64.S"
+ .text
+
+ /* ffi_call_unix64 (void *args, unsigned long bytes, unsigned flags,
diff --git a/external/python3/i100492-freebsd.patch.1 b/external/python3/i100492-freebsd.patch.1
new file mode 100644
index 000000000..b2ca1ee71
--- /dev/null
+++ b/external/python3/i100492-freebsd.patch.1
@@ -0,0 +1,35 @@
+FreeBSD porting fixes, patch by maho@openoffice.org
+
+--- Python-3.3.0/Python/thread_pthread.h 2012-11-28 09:00:41.097955124 +0000
++++ Python-3.3.0/Python/thread_pthread.h 2012-11-28 09:01:13.018329351 +0000
+@@ -238,6 +238,9 @@
+ {
+ pthread_t th;
+ int status;
++#ifdef __FreeBSD__
++ sigset_t set, oset;
++#endif
+ #if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED)
+ pthread_attr_t attrs;
+ #endif
+@@ -277,6 +280,10 @@
+ callback->func = func;
+ callback->arg = arg;
+
++#ifdef __FreeBSD__
++ sigfillset(&set);
++ SET_THREAD_SIGMASK(SIG_BLOCK, &set, &oset);
++#endif
+ status = pthread_create(&th,
+ #if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED)
+ &attrs,
+@@ -285,6 +292,9 @@
+ #endif
+ pythread_wrapper, callback);
+
++#ifdef __FreeBSD__
++ SET_THREAD_SIGMASK(SIG_SETMASK, &oset, NULL);
++#endif
+ #if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED)
+ pthread_attr_destroy(&attrs);
+ #endif
diff --git a/external/python3/internal-zlib.patch.0 b/external/python3/internal-zlib.patch.0
new file mode 100644
index 000000000..27bb737db
--- /dev/null
+++ b/external/python3/internal-zlib.patch.0
@@ -0,0 +1,55 @@
+--- configure
++++ configure
+@@ -11607,13 +11607,13 @@
+ ;;
+ esac
+
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inflateCopy in -lz" >&5
+-$as_echo_n "checking for inflateCopy in -lz... " >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inflateCopy in -lzlib" >&5
++$as_echo_n "checking for inflateCopy in -lzlib... " >&6; }
+ if ${ac_cv_lib_z_inflateCopy+:} false; then :
+ $as_echo_n "(cached) " >&6
+ else
+ ac_check_lib_save_LIBS=$LIBS
+-LIBS="-lz $LIBS"
++LIBS="-lzlib $LIBS"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h. */
+
+--- setup.py
++++ setup.py
+@@ -1483,7 +1483,7 @@
+ #
+ # You can upgrade zlib to version 1.1.4 yourself by going to
+ # http://www.gzip.org/zlib/
+- zlib_inc = find_file('zlib.h', [], self.inc_dirs)
++ zlib_inc = [os.environ.get('ZLIB_INCDIR')]
+ have_zlib = False
+ if zlib_inc is not None:
+ zlib_h = zlib_inc[0] + '/zlib.h'
+@@ -1500,13 +1500,13 @@
+ version = line.split()[2]
+ break
+ if version >= version_req:
+- if (self.compiler.find_library_file(self.lib_dirs, 'z')):
++ if (self.compiler.find_library_file(self.lib_dirs, 'zlib')):
+ if MACOS:
+ zlib_extra_link_args = ('-Wl,-search_paths_first',)
+ else:
+ zlib_extra_link_args = ()
+ self.add(Extension('zlib', ['zlibmodule.c'],
+- libraries=['z'],
++ libraries=['zlib'],
+ extra_link_args=zlib_extra_link_args))
+ have_zlib = True
+ else:
+@@ -1520,7 +1520,7 @@
+ # crc32 if we have it. Otherwise binascii uses its own.
+ if have_zlib:
+ extra_compile_args = ['-DUSE_ZLIB_CRC32']
+- libraries = ['z']
++ libraries = ['zlib']
+ extra_link_args = zlib_extra_link_args
+ else:
+ extra_compile_args = []
diff --git a/external/python3/macos-11.patch.0 b/external/python3/macos-11.patch.0
new file mode 100644
index 000000000..2c8b419bb
--- /dev/null
+++ b/external/python3/macos-11.patch.0
@@ -0,0 +1,34 @@
+--- setup.py
++++ setup.py
+@@ -655,7 +655,10 @@
+ add_dir_to_list(self.compiler.include_dirs,
+ sysconfig.get_config_var("INCLUDEDIR"))
+
+- system_lib_dirs = ['/lib64', '/usr/lib64', '/lib', '/usr/lib']
++ if MACOS:
++ system_lib_dirs = ['/usr/lib', macosx_sdk_root()+'/usr/lib']
++ else:
++ system_lib_dirs = ['/lib64', '/usr/lib64', '/lib', '/usr/lib']
+ system_include_dirs = ['/usr/include']
+ # lib_dirs and inc_dirs are used to search for files;
+ # if a file is found in one of those directories, it can
+--- Modules/_posixsubprocess.c
++++ Modules/_posixsubprocess.c
+@@ -30,6 +30,8 @@
+ # define SYS_getdents64 __NR_getdents64
+ #endif
+
++#include <limits.h>
++
+ #if defined(__sun) && defined(__SVR4)
+ /* readdir64 is used to work around Solaris 9 bug 6395699. */
+ # define readdir readdir64
+@@ -201,7 +203,7 @@
+ #endif
+ #ifdef _SC_OPEN_MAX
+ local_max_fd = sysconf(_SC_OPEN_MAX);
+- if (local_max_fd == -1)
++ if (local_max_fd == -1 || local_max_fd == LONG_MAX)
+ #endif
+ local_max_fd = 256; /* Matches legacy Lib/subprocess.py behavior. */
+ return local_max_fd;
diff --git a/external/python3/python-3.3.0-darwin.patch.1 b/external/python3/python-3.3.0-darwin.patch.1
new file mode 100644
index 000000000..39d3c9180
--- /dev/null
+++ b/external/python3/python-3.3.0-darwin.patch.1
@@ -0,0 +1,65 @@
+-*- Mode: diff -*-
+
+LO needs to build both against MacOSX SDK and not produce universal binaries.
+
+diff -ru python3.orig/configure python3/configure
+--- python3.orig/configure 2015-07-26 17:36:11.808497783 +0200
++++ python3/configure 2015-07-26 17:38:49.016508337 +0200
+@@ -7385,7 +7385,20 @@
+ then
+ case "$UNIVERSAL_ARCHS" in
+ 32-bit)
+- UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
++ # LO does not use Universal Binaries (but the only way to set a SDK
++ # here implies that, so de-universalize here...)
++ case `/usr/bin/arch` in
++ i386)
++ UNIVERSAL_ARCH_FLAGS="-arch i386"
++ ;;
++ ppc)
++ UNIVERSAL_ARCH_FLAGS=""
++ ;;
++ *)
++ as_fn_error $? "Unexpected output of 'arch' on OSX" "$LINENO" 5
++ ;;
++ esac
++
+ LIPO_32BIT_FLAGS=""
+ ARCH_RUN_32BIT=""
+ ;;
+diff -ru python3.orig/Mac/Makefile.in python3/Mac/Makefile.in
+--- python3.orig/Mac/Makefile.in 2015-07-05 18:50:07.000000000 +0200
++++ python3/Mac/Makefile.in 2015-07-26 17:40:14.860514100 +0200
+@@ -44,7 +44,7 @@
+ INSTALL_SCRIPT= @INSTALL_SCRIPT@
+ INSTALL_DATA=@INSTALL_DATA@
+ LN=@LN@
+-STRIPFLAG=-s
++STRIPFLAG=
+ CPMAC=CpMac
+
+ APPTEMPLATE=$(srcdir)/Resources/app
+diff -ru python3.orig/Mac/Resources/app/Info.plist.in python3/Mac/Resources/app/Info.plist.in
+--- python3.orig/Mac/Resources/app/Info.plist.in 2015-07-05 18:50:07.000000000 +0200
++++ python3/Mac/Resources/app/Info.plist.in 2015-07-26 17:42:00.974521224 +0200
+@@ -18,7 +18,7 @@
+ </dict>
+ </array>
+ <key>CFBundleExecutable</key>
+- <string>Python</string>
++ <string>LibreOfficePython</string>
+ <key>CFBundleGetInfoString</key>
+ <string>%version%, (c) 2001-2020 Python Software Foundation.</string>
+ <key>CFBundleHelpBookFolder</key>
+diff -ru python3.orig/Mac/Resources/framework/Info.plist.in python3/Mac/Resources/framework/Info.plist.in
+--- python3.orig/Mac/Resources/framework/Info.plist.in 2015-07-05 18:50:07.000000000 +0200
++++ python3/Mac/Resources/framework/Info.plist.in 2015-07-26 17:41:15.996518204 +0200
+@@ -5,7 +5,7 @@
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleExecutable</key>
+- <string>Python</string>
++ <string>@PYTHONFRAMEWORK@</string>
+ <key>CFBundleGetInfoString</key>
+ <string>Python Runtime and Library</string>
+ <key>CFBundleIdentifier</key>
diff --git a/external/python3/python-3.3.3-disable-obmalloc.patch.0 b/external/python3/python-3.3.3-disable-obmalloc.patch.0
new file mode 100644
index 000000000..c4a1dea61
--- /dev/null
+++ b/external/python3/python-3.3.3-disable-obmalloc.patch.0
@@ -0,0 +1,21 @@
+--- Objects/obmalloc.c
++++ Objects/obmalloc.c
+@@ -712,8 +712,8 @@
+
+ #ifdef WITH_PYMALLOC
+
++#define WITH_VALGRIND
+ #ifdef WITH_VALGRIND
+-#include <valgrind/valgrind.h>
+
+ /* If we're using GCC, use __builtin_expect() to reduce overhead of
+ the valgrind checks */
+@@ -1430,7 +1430,7 @@
+
+ #ifdef WITH_VALGRIND
+ if (UNLIKELY(running_on_valgrind == -1)) {
+- running_on_valgrind = RUNNING_ON_VALGRIND;
++ running_on_valgrind = 1;
+ }
+ if (UNLIKELY(running_on_valgrind)) {
+ return NULL;
diff --git a/external/python3/python-3.3.3-elf-rpath.patch.1 b/external/python3/python-3.3.3-elf-rpath.patch.1
new file mode 100644
index 000000000..a408858f5
--- /dev/null
+++ b/external/python3/python-3.3.3-elf-rpath.patch.1
@@ -0,0 +1,25 @@
+set RPATH (only to be used on ELF platforms)
+
+(currently nothing in LO actually links libpython3.so)
+
+diff -ru python3.orig/Makefile.pre.in python3/Makefile.pre.in
+--- python3.orig/Makefile.pre.in 2015-07-26 20:29:07.126194320 +0200
++++ python3/Makefile.pre.in 2015-07-26 20:37:21.814227530 +0200
+@@ -566,7 +566,7 @@
+
+ # Build the interpreter
+ $(BUILDPYTHON): Programs/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY)
+- $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS)
++ $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) -Wl,-rpath,\$$ORIGIN
+
+ platform: $(BUILDPYTHON) pybuilddir.txt
+ $(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import sys ; from sysconfig import get_platform ; print("%s-%d.%d" % (get_platform(), *sys.version_info[:2]))' >platform
+@@ -628,7 +628,7 @@
+ fi
+
+ libpython3.so: libpython$(LDVERSION).so
+- $(BLDSHARED) $(NO_AS_NEEDED) -o $@ -Wl,-h$@ $^
++ $(BLDSHARED) $(NO_AS_NEEDED) -o $@ -Wl,-h$@ $^ -Wl,-rpath,\$$ORIGIN
+
+ libpython$(LDVERSION).dylib: $(LIBRARY_OBJS)
+ $(CC) -dynamiclib -Wl,-single_module $(PY_CORE_LDFLAGS) -undefined dynamic_lookup -Wl,-install_name,$(prefix)/lib/libpython$(LDVERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(DTRACE_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \
diff --git a/external/python3/python-3.5.4-msvc-disable.patch.1 b/external/python3/python-3.5.4-msvc-disable.patch.1
new file mode 100644
index 000000000..d5b4e3f62
--- /dev/null
+++ b/external/python3/python-3.5.4-msvc-disable.patch.1
@@ -0,0 +1,58 @@
+Disable some stuff LO does not need, especially stuff with external dependencies
+
+diff -ru python3.orig/PCbuild/pcbuild.sln python3/PCbuild/pcbuild.sln
+--- python3.orig/PCbuild/pcbuild.sln 2017-08-10 00:04:44.359879894 +0200
++++ python3/PCbuild/pcbuild.sln 2017-08-10 00:13:51.179873748 +0200
+@@ -15,8 +15,6 @@
+ EndProject
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pythoncore", "pythoncore.vcxproj", "{CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}"
+ EndProject
+-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pythonw", "pythonw.vcxproj", "{F4229CC3-873C-49AE-9729-DD308ED4CD4A}"
+-EndProject
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "winsound", "winsound.vcxproj", "{28B5D777-DDF2-4B6B-B34F-31D938813856}"
+ EndProject
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_decimal", "_decimal.vcxproj", "{0E9791DB-593A-465F-98BC-681011311617}"
+@@ -31,34 +29,20 @@
+ EndProject
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_socket", "_socket.vcxproj", "{86937F53-C189-40EF-8CE8-8759D8E7D480}"
+ EndProject
+-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_sqlite3", "_sqlite3.vcxproj", "{13CECB97-4119-4316-9D42-8534019A5A44}"
+-EndProject
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_ssl", "_ssl.vcxproj", "{C6E20F84-3247-4AD6-B051-B073268F73BA}"
+ EndProject
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_testcapi", "_testcapi.vcxproj", "{6901D91C-6E48-4BB7-9FEC-700C8131DF1D}"
+ EndProject
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_testinternalcapi", "_testinternalcapi.vcxproj", "{900342D7-516A-4469-B1AD-59A66E49A25F}"
+ EndProject
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_testimportmultiple", "_testimportmultiple.vcxproj", "{36D0C52C-DF4E-45D0-8BC7-E294C3ABC781}"
+ EndProject
+-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_tkinter", "_tkinter.vcxproj", "{4946ECAC-2E69-4BF8-A90A-F5136F5094DF}"
+-EndProject
+-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_bz2", "_bz2.vcxproj", "{73FCD2BD-F133-46B7-8EC1-144CD82A59D5}"
+-EndProject
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "select", "select.vcxproj", "{18CAE28C-B454-46C1-87A0-493D91D97F03}"
+ EndProject
+-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_lzma", "_lzma.vcxproj", "{F9D71780-F393-11E0-BE50-0800200C9A66}"
+-EndProject
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unicodedata", "unicodedata.vcxproj", "{ECC7CEAC-A5E5-458E-BB9E-2413CC847881}"
+ EndProject
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pyexpat", "pyexpat.vcxproj", "{D06B6426-4762-44CC-8BAD-D79052507F2F}"
+ EndProject
+-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bdist_wininst", "..\PC\bdist_wininst\bdist_wininst.vcxproj", "{EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}"
+-EndProject
+-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_hashlib", "_hashlib.vcxproj", "{447F05A8-F581-4CAC-A466-5AC7936E207E}"
+-EndProject
+-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sqlite3", "sqlite3.vcxproj", "{A1A295E5-463C-437F-81CA-1F32367685DA}"
+-EndProject
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_multiprocessing", "_multiprocessing.vcxproj", "{9E48B300-37D1-11DD-8C41-005056C00008}"
+ EndProject
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "python3dll", "python3dll.vcxproj", "{885D4898-D08D-4091-9C40-C700CFE3FC5A}"
+@@ -93,8 +77,6 @@
+ EndProject
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_queue", "_queue.vcxproj", "{78D80A15-BD8C-44E2-B49E-1F05B0A0A687}"
+ EndProject
+-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblzma", "liblzma.vcxproj", "{12728250-16EC-4DC6-94D7-E21DD88947F8}"
+-EndProject
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "python_uwp", "python_uwp.vcxproj", "{9DE9E23D-C8D4-4817-92A9-920A8B1FE5FF}"
+ EndProject
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "venvlauncher", "venvlauncher.vcxproj", "{494BAC80-A60C-43A9-99E7-ACB691CE2C4D}"
diff --git a/external/python3/python-3.5.tweak.strip.soabi.patch b/external/python3/python-3.5.tweak.strip.soabi.patch
new file mode 100644
index 000000000..4c2bb2bb9
--- /dev/null
+++ b/external/python3/python-3.5.tweak.strip.soabi.patch
@@ -0,0 +1,12 @@
+diff -ru python3.orig/configure python3/configure
+--- misc/python3.orig/configure 2015-07-26 21:14:31.127377193 +0200
++++ misc/python3/configure 2015-07-26 21:21:34.975405648 +0200
+@@ -15229,7 +15229,7 @@
+ $as_echo "$ABIFLAGS" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking SOABI" >&5
+ $as_echo_n "checking SOABI... " >&6; }
+-SOABI='cpython-'`echo $VERSION | tr -d .`${ABIFLAGS}${PLATFORM_TRIPLET:+-$PLATFORM_TRIPLET}
++SOABI='cpython-'`echo $VERSION$ABIFLAGS`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SOABI" >&5
+ $as_echo "$SOABI" >&6; }
+
diff --git a/external/python3/python-3.7.6-msvc-ssl.patch.1 b/external/python3/python-3.7.6-msvc-ssl.patch.1
new file mode 100644
index 000000000..17cc440f2
--- /dev/null
+++ b/external/python3/python-3.7.6-msvc-ssl.patch.1
@@ -0,0 +1,25 @@
+No use for applink.c OPENSSL_Applink, everything is compiled with the same MSVC
+
+--- python3/PCbuild/_ssl.vcxproj.orig2 2019-12-23 15:54:19.254298900 +0100
++++ python3/PCbuild/_ssl.vcxproj 2019-12-23 15:54:24.693251200 +0100
+@@ -99,9 +99,6 @@
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="..\Modules\_ssl.c" />
+- <ClCompile Include="$(opensslIncludeDir)\applink.c">
+- <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;$(PreprocessorDefinitions)</PreprocessorDefinitions>
+- </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="..\PC\python_nt.rc" />
+--- python3/PCbuild/openssl.props.orig 2019-12-23 16:20:34.588135900 +0100
++++ python3/PCbuild/openssl.props 2019-12-23 16:20:51.074001300 +0100
+@@ -6,8 +6,6 @@
+ </ItemDefinitionGroup>
+ <PropertyGroup>
+ <_DLLSuffix>-1_1</_DLLSuffix>
+- <_DLLSuffix Condition="$(Platform) == 'ARM'">$(_DLLSuffix)-arm</_DLLSuffix>
+- <_DLLSuffix Condition="$(Platform) == 'ARM64'">$(_DLLSuffix)-arm64</_DLLSuffix>
+ </PropertyGroup>
+ <ItemGroup>
+ <_SSLDLL Include="$(opensslOutDir)\libcrypto$(_DLLSuffix).dll" />
diff --git a/external/python3/python-3.8-msvc-sdk.patch.1 b/external/python3/python-3.8-msvc-sdk.patch.1
new file mode 100644
index 000000000..fabdbb53e
--- /dev/null
+++ b/external/python3/python-3.8-msvc-sdk.patch.1
@@ -0,0 +1,173 @@
+diff --git a/PC/pylauncher.rc b/PC/pylauncher.rc
+index 92987af713..d21f9b6e9d 100644
+--- a/PC/pylauncher.rc
++++ b/PC/pylauncher.rc
+@@ -4,7 +4,6 @@
+
+ // Include the manifest file that indicates we support all
+ // current versions of Windows.
+-#include <winuser.h>
+ 1 RT_MANIFEST "python.manifest"
+
+ #if defined(PY_ICON)
+diff --git a/PC/pyshellext.rc b/PC/pyshellext.rc
+index e5924a42da..fc607e9784 100644
+--- a/PC/pyshellext.rc
++++ b/PC/pyshellext.rc
+@@ -4,7 +4,6 @@
+
+ // Include the manifest file that indicates we support all
+ // current versions of Windows.
+-#include <winuser.h>
+ 1 RT_MANIFEST "python.manifest"
+
+ /////////////////////////////////////////////////////////////////////////////
+diff --git a/PC/python_exe.rc b/PC/python_exe.rc
+index ae0b029b80..5eba89962b 100644
+--- a/PC/python_exe.rc
++++ b/PC/python_exe.rc
+@@ -4,7 +4,6 @@
+
+ // Include the manifest file that indicates we support all
+ // current versions of Windows.
+-#include <winuser.h>
+ 1 RT_MANIFEST "python.manifest"
+
+ 1 ICON DISCARDABLE "icons\python.ico"
+diff --git a/PC/python_nt.rc b/PC/python_nt.rc
+index fac6105d8a..33cee42cb7 100644
+--- a/PC/python_nt.rc
++++ b/PC/python_nt.rc
+@@ -4,7 +4,6 @@
+
+ // Include the manifest file that indicates we support all
+ // current versions of Windows.
+-#include <winuser.h>
+ 2 RT_MANIFEST "python.manifest"
+
+ // String Tables
+diff --git a/PC/pythonw_exe.rc b/PC/pythonw_exe.rc
+index 88bf3592e1..562652be18 100644
+--- a/PC/pythonw_exe.rc
++++ b/PC/pythonw_exe.rc
+@@ -4,7 +4,6 @@
+
+ // Include the manifest file that indicates we support all
+ // current versions of Windows.
+-#include <winuser.h>
+ 1 RT_MANIFEST "python.manifest"
+
+ 1 ICON DISCARDABLE "icons\pythonw.ico"
+diff --git a/PC/sqlite3.rc b/PC/sqlite3.rc
+index 84bd87d9d5..d2c18f8add 100644
+--- a/PC/sqlite3.rc
++++ b/PC/sqlite3.rc
+@@ -4,7 +4,6 @@
+
+ // Include the manifest file that indicates we support all
+ // current versions of Windows.
+-#include <winuser.h>
+ 2 RT_MANIFEST "python.manifest"
+
+ /////////////////////////////////////////////////////////////////////////////
+diff --git a/PC/pylauncher.rc b/PC/pylauncher.rc
+index d21f9b6e9d..ff7e71e0fd 100644
+--- a/PC/pylauncher.rc
++++ b/PC/pylauncher.rc
+@@ -2,6 +2,11 @@
+
+ #include "python_ver_rc.h"
+
++#ifndef RT_MANIFEST
++// bpo-45220: Cannot reliably #include RT_MANIFEST from
++// anywhere, so we hardcode it
++#define RT_MANIFEST 24
++#endif
+ // Include the manifest file that indicates we support all
+ // current versions of Windows.
+ 1 RT_MANIFEST "python.manifest"
+diff --git a/PC/pyshellext.rc b/PC/pyshellext.rc
+index fc607e9784..af797ce95d 100644
+--- a/PC/pyshellext.rc
++++ b/PC/pyshellext.rc
+@@ -2,6 +2,12 @@
+
+ #include "python_ver_rc.h"
+
++#ifndef RT_MANIFEST
++// bpo-45220: Cannot reliably #include RT_MANIFEST from
++// anywhere, so we hardcode it
++#define RT_MANIFEST 24
++#endif
++
+ // Include the manifest file that indicates we support all
+ // current versions of Windows.
+ 1 RT_MANIFEST "python.manifest"
+diff --git a/PC/python_exe.rc b/PC/python_exe.rc
+index 5eba89962b..c3d3bff019 100644
+--- a/PC/python_exe.rc
++++ b/PC/python_exe.rc
+@@ -2,6 +2,12 @@
+
+ #include "python_ver_rc.h"
+
++#ifndef RT_MANIFEST
++// bpo-45220: Cannot reliably #include RT_MANIFEST from
++// anywhere, so we hardcode it
++#define RT_MANIFEST 24
++#endif
++
+ // Include the manifest file that indicates we support all
+ // current versions of Windows.
+ 1 RT_MANIFEST "python.manifest"
+diff --git a/PC/python_nt.rc b/PC/python_nt.rc
+index 33cee42cb7..539362cdc2 100644
+--- a/PC/python_nt.rc
++++ b/PC/python_nt.rc
+@@ -2,6 +2,12 @@
+
+ #include "python_ver_rc.h"
+
++#ifndef RT_MANIFEST
++// bpo-45220: Cannot reliably #include RT_MANIFEST from
++// anywhere, so we hardcode it
++#define RT_MANIFEST 24
++#endif
++
+ // Include the manifest file that indicates we support all
+ // current versions of Windows.
+ 2 RT_MANIFEST "python.manifest"
+diff --git a/PC/pythonw_exe.rc b/PC/pythonw_exe.rc
+index 562652be18..38570b74fa 100644
+--- a/PC/pythonw_exe.rc
++++ b/PC/pythonw_exe.rc
+@@ -2,6 +2,12 @@
+
+ #include "python_ver_rc.h"
+
++#ifndef RT_MANIFEST
++// bpo-45220: Cannot reliably #include RT_MANIFEST from
++// anywhere, so we hardcode it
++#define RT_MANIFEST 24
++#endif
++
+ // Include the manifest file that indicates we support all
+ // current versions of Windows.
+ 1 RT_MANIFEST "python.manifest"
+diff --git a/PC/sqlite3.rc b/PC/sqlite3.rc
+index d2c18f8add..9ae2aa0f6f 100644
+--- a/PC/sqlite3.rc
++++ b/PC/sqlite3.rc
+@@ -2,6 +2,12 @@
+
+ #include <winver.h>
+
++#ifndef RT_MANIFEST
++// bpo-45220: Cannot reliably #include RT_MANIFEST from
++// anywhere, so we hardcode it
++#define RT_MANIFEST 24
++#endif
++
+ // Include the manifest file that indicates we support all
+ // current versions of Windows.
+ 2 RT_MANIFEST "python.manifest"
diff --git a/external/python3/tsan.patch.0 b/external/python3/tsan.patch.0
new file mode 100644
index 000000000..d599ec046
--- /dev/null
+++ b/external/python3/tsan.patch.0
@@ -0,0 +1,10 @@
+--- Python/ceval_gil.h
++++ Python/ceval_gil.h
+@@ -135,6 +135,7 @@
+
+ static void recreate_gil(struct _gil_runtime_state *gil)
+ {
++ _Py_ANNOTATE_RWLOCK_RELEASED(&gil->locked, 1);
+ _Py_ANNOTATE_RWLOCK_DESTROY(&gil->locked);
+ /* XXX should we destroy the old OS resources here? */
+ create_gil(gil);
diff --git a/external/python3/ubsan.patch.0 b/external/python3/ubsan.patch.0
new file mode 100644
index 000000000..d44fbe055
--- /dev/null
+++ b/external/python3/ubsan.patch.0
@@ -0,0 +1,43 @@
+--- Modules/_ctypes/libffi_osx/x86/x86-ffi64.c
++++ Modules/_ctypes/libffi_osx/x86/x86-ffi64.c
+@@ -599,9 +599,15 @@
+ tramp = (volatile unsigned short*)&closure->tramp[0];
+
+ tramp[0] = 0xbb49; /* mov <code>, %r11 */
+- *(void* volatile*)&tramp[1] = ffi_closure_unix64;
++ tramp[1] = (unsigned short) ffi_closure_unix64;
++ tramp[2] = (unsigned short) (((unsigned long)ffi_closure_unix64) >> 16);
++ tramp[3] = (unsigned short) (((unsigned long)ffi_closure_unix64) >> 32);
++ tramp[4] = (unsigned short) (((unsigned long)ffi_closure_unix64) >> 48);
+ tramp[5] = 0xba49; /* mov <data>, %r10 */
+- *(void* volatile*)&tramp[6] = closure;
++ tramp[6] = (unsigned short) closure;
++ tramp[7] = (unsigned short) (((unsigned long)closure) >> 16);
++ tramp[8] = (unsigned short) (((unsigned long)closure) >> 32);
++ tramp[9] = (unsigned short) (((unsigned long)closure) >> 48);
+
+ /* Set the carry bit if the function uses any sse registers.
+ This is clc or stc, together with the first byte of the jmp. */
+--- Modules/posixmodule.c
++++ Modules/posixmodule.c
+@@ -13998,6 +13998,9 @@
+ };
+
+ static int
++#if defined __clang__
++__attribute__((no_sanitize("shift-base"))) // MFD_HUGE_16GB in /usr/include/linux/memfd.h
++#endif
+ all_ins(PyObject *m)
+ {
+ #ifdef F_OK
+--- Objects/listobject.c
++++ Objects/listobject.c
+@@ -554,7 +554,7 @@
+ dest[i] = v;
+ }
+ src = b->ob_item;
+- dest = np->ob_item + Py_SIZE(a);
++ dest = Py_SIZE(a) == 0 ? np->ob_item : np->ob_item + Py_SIZE(a);
+ for (i = 0; i < Py_SIZE(b); i++) {
+ PyObject *v = src[i];
+ Py_INCREF(v);