From 3d882e549c30f46e9742f53060dfc12c65614d11 Mon Sep 17 00:00:00 2001 From: Andras Timar Date: Tue, 4 Apr 2023 10:36:23 +0200 Subject: python: build fix Change-Id: Ie94383632b8b90d3c6e4507484e11cc80acc72a2 --- RepositoryExternal.mk | 2 +- external/python3/UnpackedTarball_python3.mk | 2 - external/python3/macos-11.patch.0 | 58 --------- external/python3/python-3.8-msvc-sdk.patch.1 | 173 --------------------------- postprocess/CustomTarget_signing.mk | 8 +- pyuno/CustomTarget_python_shell.mk | 2 +- pyuno/CustomTarget_pyuno_pythonloader_ini.mk | 6 +- solenv/gbuild/platform/com_MSC_class.mk | 2 +- solenv/gbuild/platform/solaris.mk | 2 +- solenv/gbuild/platform/unxgcc.mk | 2 +- 10 files changed, 12 insertions(+), 245 deletions(-) delete mode 100644 external/python3/macos-11.patch.0 delete mode 100644 external/python3/python-3.8-msvc-sdk.patch.1 diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk index be8cde9442a9..6d61ef6eddc5 100644 --- a/RepositoryExternal.mk +++ b/RepositoryExternal.mk @@ -4014,7 +4014,7 @@ $(call gb_ExternalExecutable_add_dependencies,python,$(call gb_GeneratedPackage_ else -$(call gb_ExternalExecutable_set_internal,python,$(INSTROOT)/$(LIBO_BIN_FOLDER)/$(if $(filter WNT,$(OS)),python-core-3.7.7/bin/python.exe,python.bin)) +$(call gb_ExternalExecutable_set_internal,python,$(INSTROOT)/$(LIBO_BIN_FOLDER)/$(if $(filter WNT,$(OS)),python-core-$(PYTHON_VERSION)/bin/python.exe,python.bin)) $(call gb_ExternalExecutable_set_precommand,python,$(subst $$,$$$$,$(gb_Python_PRECOMMAND))) $(call gb_ExternalExecutable_add_dependencies,python,$(call gb_Package_get_target_for_build,python3)) diff --git a/external/python3/UnpackedTarball_python3.mk b/external/python3/UnpackedTarball_python3.mk index 26a6a419af79..94950537386c 100644 --- a/external/python3/UnpackedTarball_python3.mk +++ b/external/python3/UnpackedTarball_python3.mk @@ -18,13 +18,11 @@ $(eval $(call gb_UnpackedTarball_fix_end_of_line,python3,\ $(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 \ )) ifneq ($(filter DRAGONFLY FREEBSD LINUX NETBSD OPENBSD SOLARIS,$(OS)),) diff --git a/external/python3/macos-11.patch.0 b/external/python3/macos-11.patch.0 deleted file mode 100644 index 42b74f4b2f50..000000000000 --- a/external/python3/macos-11.patch.0 +++ /dev/null @@ -1,58 +0,0 @@ --*- Mode: diff -*- ---- Mac/Tools/pythonw.c -+++ Mac/Tools/pythonw.c -@@ -121,6 +121,8 @@ - cpu_types[0] = CPU_TYPE_POWERPC; - #elif defined(__i386__) - cpu_types[0] = CPU_TYPE_X86; -+#elif defined(__arm64__) -+ cpu_types[0] = CPU_TYPE_ARM64; - #else - # error "Unknown CPU" - #endif ---- setup.py -+++ setup.py -@@ -670,7 +670,10 @@ - add_dir_to_list(self.compiler.include_dirs, - sysconfig.get_config_var("INCLUDEDIR")) - -- system_lib_dirs = ['/lib64', '/usr/lib64', '/lib', '/usr/lib'] -+ if host_platform == 'darwin': -+ 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/_decimal/libmpdec/mpdecimal.h -+++ Modules/_decimal/libmpdec/mpdecimal.h -@@ -135,6 +135,9 @@ - #elif defined(__x86_64__) - #define CONFIG_64 - #define ASM -+ #elif defined(__arm64__) -+ #define CONFIG_64 -+ #define ANSI - #else - #error "unknown architecture for universal build." - #endif ---- Modules/_posixsubprocess.c -+++ Modules/_posixsubprocess.c -@@ -31,6 +31,8 @@ - # define SYS_getdents64 __NR_getdents64 - #endif - -+#include -+ - #if defined(__sun) && defined(__SVR4) - /* readdir64 is used to work around Solaris 9 bug 6395699. */ - # define readdir readdir64 -@@ -202,7 +202,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.8-msvc-sdk.patch.1 b/external/python3/python-3.8-msvc-sdk.patch.1 deleted file mode 100644 index fabdbb53ea63..000000000000 --- a/external/python3/python-3.8-msvc-sdk.patch.1 +++ /dev/null @@ -1,173 +0,0 @@ -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 - 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 - 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 - 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 - 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 - 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 - 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 - -+#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/postprocess/CustomTarget_signing.mk b/postprocess/CustomTarget_signing.mk index 46ed58db78fa..f675684a045a 100644 --- a/postprocess/CustomTarget_signing.mk +++ b/postprocess/CustomTarget_signing.mk @@ -48,10 +48,10 @@ ifneq ($(ENABLE_DBGUTIL),TRUE) $(INSTDIR)/program/soffice.bin \ $(INSTDIR)/program/unopkg.bin \ $(INSTDIR)/program/pyuno.pyd \ - $(INSTDIR)/$(LIBO_BIN_FOLDER)/python-core-3.7.7/bin/*.exe \ - $(INSTDIR)/$(LIBO_BIN_FOLDER)/python-core-3.7.7/lib/*.dll \ - $(INSTDIR)/$(LIBO_BIN_FOLDER)/python-core-3.7.7/lib/*.pyd \ - $(INSTDIR)/$(LIBO_BIN_FOLDER)/python-core-3.7.7/lib/distutils/command/*.exe \ + $(INSTDIR)/$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/bin/*.exe \ + $(INSTDIR)/$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/*.dll \ + $(INSTDIR)/$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/*.pyd \ + $(INSTDIR)/$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/distutils/command/*.exe \ $(INSTDIR)/program/shlxthdl/*.dll \ $(INSTDIR)/sdk/cli/*.dll \ $(INSTDIR)/sdk/bin/*.exe \ diff --git a/pyuno/CustomTarget_python_shell.mk b/pyuno/CustomTarget_python_shell.mk index b3cf6d734f4a..203258bf94e3 100644 --- a/pyuno/CustomTarget_python_shell.mk +++ b/pyuno/CustomTarget_python_shell.mk @@ -17,7 +17,7 @@ $(eval $(call gb_CustomTarget_register_targets,pyuno/python_shell,\ ifeq ($(OS),MACOSX) pyuno_PYTHON_SHELL_VERSION:=$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR) else -pyuno_PYTHON_SHELL_VERSION:=3.7.7 +pyuno_PYTHON_SHELL_VERSION:=$(PYTHON_VERSION) endif $(call gb_CustomTarget_get_workdir,pyuno/python_shell)/python.sh : \ diff --git a/pyuno/CustomTarget_pyuno_pythonloader_ini.mk b/pyuno/CustomTarget_pyuno_pythonloader_ini.mk index 3cafb980954b..3dfd4549c1ac 100644 --- a/pyuno/CustomTarget_pyuno_pythonloader_ini.mk +++ b/pyuno/CustomTarget_pyuno_pythonloader_ini.mk @@ -22,15 +22,15 @@ $(call gb_CustomTarget_get_workdir,pyuno/pythonloader_ini)/$(call gb_Helper_get_ printf 'PYUNO_LOADER_PYTHONHOME=%s\n' \ $(if $(filter MACOSX,$(OS)), \ '$$ORIGIN/../Frameworks/LibreOfficePython.framework', \ - '$$ORIGIN/python-core-3.7.7') &&) \ + '$$ORIGIN/python-core-$(PYTHON_VERSION)') &&) \ printf 'PYUNO_LOADER_PYTHONPATH=%s$$ORIGIN\n' \ $(if $(SYSTEM_PYTHON), \ '', \ $(if $(filter MACOSX,$(OS)), \ '$(foreach dir,/ /lib-dynload /lib-tk /site-packages,$(patsubst %/,%,$$ORIGIN/../Frameworks/LibreOfficePython.framework/Versions/Current/lib/python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)$(dir))) ', \ $(if $(filter WNT,$(OS)), \ - '$(foreach dir,/ /site-packages,$(patsubst %/,%,$$ORIGIN/python-core-3.7.7/lib$(dir))) ', \ - '$(foreach dir,/ /lib-dynload /lib-tk /site-packages,$(patsubst %/,%,$$ORIGIN/python-core-3.7.7/lib$(dir))) '))) \ + '$(foreach dir,/ /site-packages,$(patsubst %/,%,$$ORIGIN/python-core-$(PYTHON_VERSION)/lib$(dir))) ', \ + '$(foreach dir,/ /lib-dynload /lib-tk /site-packages,$(patsubst %/,%,$$ORIGIN/python-core-$(PYTHON_VERSION)/lib$(dir))) '))) \ ) > $@ # vim: set noet sw=4 ts=4: diff --git a/solenv/gbuild/platform/com_MSC_class.mk b/solenv/gbuild/platform/com_MSC_class.mk index 192af29de552..143847fb66f4 100644 --- a/solenv/gbuild/platform/com_MSC_class.mk +++ b/solenv/gbuild/platform/com_MSC_class.mk @@ -662,7 +662,7 @@ endef gb_UIMenubarTarget_UIMenubarTarget_platform := # Python -gb_Python_PRECOMMAND := PATH="$(shell cygpath -w $(INSTDIR)/program)" PYTHONHOME="$(INSTDIR)/program/python-core-3.7.7" PYTHONPATH="$${PYPATH:+$$PYPATH:}$(INSTDIR)/program/python-core-3.7.7/lib;$(INSTDIR)/program/python-core-3.7.7/lib/lib-dynload:$(INSTDIR)/program" +gb_Python_PRECOMMAND := PATH="$(shell cygpath -w $(INSTDIR)/program)" PYTHONHOME="$(INSTDIR)/program/python-core-$(PYTHON_VERSION)" PYTHONPATH="$${PYPATH:+$$PYPATH:}$(INSTDIR)/program/python-core-$(PYTHON_VERSION)/lib;$(INSTDIR)/program/python-core-$(PYTHON_VERSION)/lib/lib-dynload:$(INSTDIR)/program" gb_Python_INSTALLED_EXECUTABLE := $(INSTROOT)/$(LIBO_BIN_FOLDER)/python.exe gb_ICU_PRECOMMAND := PATH="$(shell cygpath -w $(WORKDIR_FOR_BUILD)/UnpackedTarball/icu/source/lib)" diff --git a/solenv/gbuild/platform/solaris.mk b/solenv/gbuild/platform/solaris.mk index fbbd439030cf..e386601996f2 100644 --- a/solenv/gbuild/platform/solaris.mk +++ b/solenv/gbuild/platform/solaris.mk @@ -350,7 +350,7 @@ endef gb_UIMenubarTarget_UIMenubarTarget_platform := # Python -gb_Python_PRECOMMAND := $(gb_Helper_set_ld_path) PYTHONHOME="$(INSTDIR)/program/python-core-3.7.7" PYTHONPATH="$${PYPATH:+$$PYPATH:}$(INSTDIR)/program/python-core-3.7.7/lib:$(INSTDIR)/program/python-core-3.7.7/lib/lib-dynload:$(INSTDIR)/program" +gb_Python_PRECOMMAND := $(gb_Helper_set_ld_path) PYTHONHOME="$(INSTDIR)/program/python-core-$(PYTHON_VERSION)" PYTHONPATH="$${PYPATH:+$$PYPATH:}$(INSTDIR)/program/python-core-$(PYTHON_VERSION)/lib:$(INSTDIR)/program/python-core-$(PYTHON_VERSION)/lib/lib-dynload:$(INSTDIR)/program" gb_Python_INSTALLED_EXECUTABLE := /bin/sh $(INSTROOT)/program/python # this is passed to gdb as executable when running tests gb_Python_INSTALLED_EXECUTABLE_GDB := $(INSTROOT)/program/python.bin diff --git a/solenv/gbuild/platform/unxgcc.mk b/solenv/gbuild/platform/unxgcc.mk index 8c0add6d7dd1..8854aab6c425 100644 --- a/solenv/gbuild/platform/unxgcc.mk +++ b/solenv/gbuild/platform/unxgcc.mk @@ -383,7 +383,7 @@ endef gb_UIMenubarTarget_UIMenubarTarget_platform := # Python -gb_Python_PRECOMMAND := $(gb_Helper_set_ld_path) PYTHONHOME="$(INSTDIR)/program/python-core-3.7.7" PYTHONPATH="$${PYPATH:+$$PYPATH:}$(INSTDIR)/program/python-core-3.7.7/lib:$(INSTDIR)/program/python-core-3.7.7/lib/lib-dynload" +gb_Python_PRECOMMAND := $(gb_Helper_set_ld_path) PYTHONHOME="$(INSTDIR)/program/python-core-$(PYTHON_VERSION)" PYTHONPATH="$${PYPATH:+$$PYPATH:}$(INSTDIR)/program/python-core-$(PYTHON_VERSION)/lib:$(INSTDIR)/program/python-core-$(PYTHON_VERSION)/lib/lib-dynload" gb_Python_INSTALLED_EXECUTABLE := /bin/sh $(INSTROOT)/program/python # this is passed to gdb as executable when running tests gb_Python_INSTALLED_EXECUTABLE_GDB := $(INSTROOT)/program/python.bin -- cgit v1.2.3