From 8646ab97dc37c0606b19057686bf3d610f9c15ee Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Fri, 10 Feb 2017 14:05:21 +0100 Subject: Remove MinGW support In OOo times, there'd originally been efforts to allow building on Windows with MinGW. Later, in LO times, this has been shifted to an attempt of cross- compiling for Windows on Linux. That attempt can be considered abandoned, and the relevant code rotting. Due to this heritage, there are now three kinds of MinGW-specific code in LO: * Code from the original OOo native Windows effort that is no longer relevant for the LO cross-compilation effort, but has never been removed properly. * Code from the original OOo native Windows effort that is re-purposed for the LO cross-compilation effort. * Code that has been added specifially for the LO cross-compilation effort. All three kinds of code are removed. (An unrelated, remaining use of MinGW is for --enable-build-unowinreg, utilizing --with-mingw-cross-compiler, MINGWCXX, and MINGWSTRIP.) Change-Id: I49daad8669b4cbe49fa923050c4a4a6ff7dda568 Reviewed-on: https://gerrit.libreoffice.org/34127 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- pyuno/CustomTarget_pyuno_pythonloader_ini.mk | 2 +- pyuno/CustomTarget_zipcore.mk | 34 --------------------- pyuno/GeneratedPackage_python-core.mk | 20 ------------- pyuno/Module_pyuno.mk | 15 ---------- pyuno/Package_zipcore.mk | 18 ----------- pyuno/zipcore/python.cxx | 45 ++-------------------------- 6 files changed, 3 insertions(+), 131 deletions(-) delete mode 100644 pyuno/CustomTarget_zipcore.mk delete mode 100644 pyuno/GeneratedPackage_python-core.mk delete mode 100644 pyuno/Package_zipcore.mk (limited to 'pyuno') diff --git a/pyuno/CustomTarget_pyuno_pythonloader_ini.mk b/pyuno/CustomTarget_pyuno_pythonloader_ini.mk index 51cb35f3d981..3dfd4549c1ac 100644 --- a/pyuno/CustomTarget_pyuno_pythonloader_ini.mk +++ b/pyuno/CustomTarget_pyuno_pythonloader_ini.mk @@ -28,7 +28,7 @@ $(call gb_CustomTarget_get_workdir,pyuno/pythonloader_ini)/$(call gb_Helper_get_ '', \ $(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 WNTMSC,$(OS)$(COM)), \ + $(if $(filter WNT,$(OS)), \ '$(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))) '))) \ ) > $@ diff --git a/pyuno/CustomTarget_zipcore.mk b/pyuno/CustomTarget_zipcore.mk deleted file mode 100644 index 42b37a831b04..000000000000 --- a/pyuno/CustomTarget_zipcore.mk +++ /dev/null @@ -1,34 +0,0 @@ -# -*- 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_CustomTarget_CustomTarget,pyuno/zipcore)) - -# system python (only mingw) -ifneq ($(SYSTEM_PYTHON),) -# mingw: MINGW_SYSROOT is defined in configure -ifeq ($(OS)$(COM),WNTGCC) -pyuno_PYTHON_LIB_DIR=$(MINGW_SYSROOT)/lib/python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR) -endif -else -$(error SHOULD NOT GET HERE) -endif - -pyuno_PYTHON_ARCHIVE_NAME:=python-core-$(PYTHON_VERSION).zip - -$(call gb_CustomTarget_get_target,pyuno/zipcore) : \ - $(call gb_CustomTarget_get_workdir,pyuno/zipcore)/$(pyuno_PYTHON_ARCHIVE_NAME) - -# create zip archive -$(call gb_CustomTarget_get_workdir,pyuno/zipcore)/$(pyuno_PYTHON_ARCHIVE_NAME) \ - : $(call gb_ExternalPackage_get_target,python3) \ - | $(call gb_CustomTarget_get_workdir,pyuno/zipcore)/.dir - $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),ZIP,1) - cd $(pyuno_PYTHON_LIB_DIR) && zip -q $@ $(shell cd $(pyuno_PYTHON_LIB_DIR) && $(FIND) . -type f | grep -v "\.pyc" | grep -v "\.py~" | grep -v .orig | grep -v _failed) - -# vim: set noet sw=4 ts=4: diff --git a/pyuno/GeneratedPackage_python-core.mk b/pyuno/GeneratedPackage_python-core.mk deleted file mode 100644 index ec6123ed3921..000000000000 --- a/pyuno/GeneratedPackage_python-core.mk +++ /dev/null @@ -1,20 +0,0 @@ -# -*- 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,python-core,$(MINGW_SYSROOT)/lib)) - -# NOTE: The original code excluded *.pyc, *.py~, *.orig and *_failed . I -# assume it was just a size optimization. If their presence actually -# causes a problem, an extension of GeneratedPackage is is left as an -# exercise for the poor misguided person who wants to cross-compile -# with mingw and system python and actually use the results for -# something. -$(eval $(call gb_GeneratedPackage_add_dir,python-core,$(INSTDIR)/program/python-core-$(PYTHON_VERSION)/lib,python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR))) - -# vim: set noet sw=4 ts=4: diff --git a/pyuno/Module_pyuno.mk b/pyuno/Module_pyuno.mk index 9d38455c69f2..fb38a50119da 100644 --- a/pyuno/Module_pyuno.mk +++ b/pyuno/Module_pyuno.mk @@ -26,12 +26,7 @@ $(eval $(call gb_Module_add_targets,pyuno,\ )) endif -# # Windows: only --enable-python=internal possible -# mingw: both cases possible: internal && system -# that why it makes sense to handle the next 3 targets -# with SYSTEM_PYTHON=TRUE and SYSTEM_PYTHON= - # python-core: pyuno/python.exe on Windows ifeq ($(OS),WNT) $(eval $(call gb_Module_add_targets,pyuno,\ @@ -49,16 +44,6 @@ $(eval $(call gb_Module_add_targets,pyuno,\ )) endif -else # SYSTEM_PYTHON - -# these two targets have to be executed only with system-python on mingw -# FIXME remove this -ifeq ($(OS)$(COM),WNTGCC) -$(eval $(call gb_Module_add_targets,pyuno,\ - GeneratedPackage_python-core \ -)) -endif - endif # SYSTEM_PYTHON ifneq ($(OS),MACOSX) diff --git a/pyuno/Package_zipcore.mk b/pyuno/Package_zipcore.mk deleted file mode 100644 index c3302910165c..000000000000 --- a/pyuno/Package_zipcore.mk +++ /dev/null @@ -1,18 +0,0 @@ -# -*- 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_Package_Package,python_zipcore,$(call gb_CustomTarget_get_workdir,pyuno/zipcore))) - -$(error FIXME do not deliver this stuff to OUTDIR) - -pyuno_PYTHON_ARCHIVE_NAME:=python-core-$(PYTHON_VERSION).zip - -$(eval $(call gb_Package_add_file,python_zipcore,bin/$(pyuno_PYTHON_ARCHIVE_NAME),$(pyuno_PYTHON_ARCHIVE_NAME))) - -# vim: set noet sw=4 ts=4: diff --git a/pyuno/zipcore/python.cxx b/pyuno/zipcore/python.cxx index b67b17f28f4f..c128938cbc8f 100644 --- a/pyuno/zipcore/python.cxx +++ b/pyuno/zipcore/python.cxx @@ -24,13 +24,9 @@ #include #define WIN32_LEAN_AND_MEAN -#if defined _MSC_VER #pragma warning(push, 1) -#endif #include -#if defined _MSC_VER #pragma warning(pop) -#endif #include "tools/pathutils.hxx" @@ -69,11 +65,7 @@ wchar_t * encode(wchar_t * buffer, wchar_t const * text) { return buffer; } -#ifdef __MINGW32__ -int main(int argc, char ** argv, char **) { -#else int wmain(int argc, wchar_t ** argv, wchar_t **) { -#endif wchar_t path[MAX_PATH]; DWORD n = GetModuleFileNameW(nullptr, path, MAX_PATH); if (n == 0 || n >= MAX_PATH) { @@ -111,15 +103,6 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) { if (pythonpath3End == nullptr) { exit(EXIT_FAILURE); } -#ifdef __MINGW32__ - wchar_t pythonpath4[MAX_PATH]; - wchar_t * pythonpath4End = tools::buildPath( - pythonpath4, path, pathEnd, - MY_STRING(L"\\python-core-" PYTHON_VERSION_STRING L"\\lib\\lib-dynload")); - if (pythonpath4End == NULL) { - exit(EXIT_FAILURE); - } -#endif wchar_t pythonhome[MAX_PATH]; wchar_t * pythonhomeEnd = tools::buildPath( pythonhome, path, pathEnd, MY_STRING(L"\\python-core-" PYTHON_VERSION_STRING)); @@ -138,27 +121,14 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) { // 4 * len: each char preceded by backslash, each trailing backslash // doubled for (int i = 1; i < argc; ++i) { -#ifdef __MINGW32__ - clSize += MY_LENGTH(L" \"") + 4 * strlen(argv[i]) + -#else - clSize += MY_LENGTH(L" \"") + 4 * wcslen(argv[i]) + -#endif - MY_LENGTH(L"\""); //TODO: overflow + clSize += MY_LENGTH(L" \"") + 4 * wcslen(argv[i]) + MY_LENGTH(L"\""); + //TODO: overflow } wchar_t * cl = new wchar_t[clSize]; wchar_t * cp = encode(cl, pythonhome); for (int i = 1; i < argc; ++i) { *cp++ = L' '; -#ifdef __MINGW32__ - int nNeededWStrBuffSize = MultiByteToWideChar(CP_ACP, 0, argv[i], -1, NULL, 0); - WCHAR *buff = new WCHAR[nNeededWStrBuffSize+1]; - MultiByteToWideChar(CP_ACP, 0, argv[i], -1, buff, nNeededWStrBuffSize); - buff[nNeededWStrBuffSize] = 0; - cp = encode(cp, buff); - delete [] buff; -#else cp = encode(cp, argv[i]); -#endif } *cp = L'\0'; n = GetEnvironmentVariableW(L"PATH", nullptr, 0); @@ -201,16 +171,6 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) { exit(EXIT_FAILURE); } } -#ifdef __MINGW32__ - len = (pathEnd - path) + MY_LENGTH(L";") + (pythonpath2End - pythonpath2) + - MY_LENGTH(L";") + (pythonpath4End - pythonpath4) + - MY_LENGTH(L";") + (pythonpath3End - pythonpath3) + - (n == 0 ? 0 : MY_LENGTH(L";") + (n - 1)) + 1; //TODO: overflow - value = new wchar_t[len]; - _snwprintf( - value, len, L"%s;%s;%s;%s%s%s", path, pythonpath2, pythonpath4, - pythonpath3, n == 0 ? L"" : L";", orig); -#else len = (pathEnd - path) + MY_LENGTH(L";") + (pythonpath2End - pythonpath2) + MY_LENGTH(L";") + (pythonpath3End - pythonpath3) + (n == 0 ? 0 : MY_LENGTH(L";") + (n - 1)) + 1; //TODO: overflow @@ -218,7 +178,6 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) { _snwprintf( value, len, L"%s;%s;%s%s%s", path, pythonpath2, pythonpath3, n == 0 ? L"" : L";", orig); -#endif if (!SetEnvironmentVariableW(L"PYTHONPATH", value)) { exit(EXIT_FAILURE); } -- cgit