diff --git a/ports/python3/0001-static-library.patch b/ports/python3/0001-static-library.patch index 0552c33ce74fd5..cd819f93f4e92f 100644 --- a/ports/python3/0001-static-library.patch +++ b/ports/python3/0001-static-library.patch @@ -1,7 +1,7 @@ From 79ec7506399bc3846bb0631827e3880f5468e507 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Sun, 13 Sep 2020 21:33:33 -0400 -Subject: [PATCH 1/7] Static library +Subject: [PATCH 1/8] Static library diff --git a/PC/pyconfig.h b/PC/pyconfig.h diff --git a/ports/python3/0002-always-use-vcpkg-zlib.patch b/ports/python3/0002-always-use-vcpkg-zlib.patch index 190a8d44c93534..3d9ea6e5ba61a2 100644 --- a/ports/python3/0002-always-use-vcpkg-zlib.patch +++ b/ports/python3/0002-always-use-vcpkg-zlib.patch @@ -1,7 +1,7 @@ From 175b0e8c0d5d4ba1da3d9313a0208c8b814792f0 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Wed, 9 Sep 2020 15:20:36 -0400 -Subject: [PATCH 2/7] Always use vcpkg zlib +Subject: [PATCH 2/8] Always use vcpkg zlib Building without zlib is not a supported configuration, per the warning messages. diff --git a/ports/python3/0003-remove-external-dependencies.patch b/ports/python3/0003-remove-external-dependencies.patch index 4747824de0af21..9f51c647e4b38b 100644 --- a/ports/python3/0003-remove-external-dependencies.patch +++ b/ports/python3/0003-remove-external-dependencies.patch @@ -1,7 +1,7 @@ From d69746248f01a3eca82f441e789279e9d0acaf08 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Wed, 9 Sep 2020 15:24:38 -0400 -Subject: [PATCH 3/7] Remove external dependencies +Subject: [PATCH 3/8] Remove external dependencies The externally fetched libraries may cause linker errors resulting from duplicate symbols in downstream projects. diff --git a/ports/python3/0004-don-t-copy-vcruntime.patch b/ports/python3/0004-don-t-copy-vcruntime.patch index c9630fa524fbe4..0a09b8d787a3fc 100644 --- a/ports/python3/0004-don-t-copy-vcruntime.patch +++ b/ports/python3/0004-don-t-copy-vcruntime.patch @@ -1,7 +1,7 @@ From 04b72da23e00abb1a5ff02aa5b0cb54576d45051 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Wed, 9 Sep 2020 16:12:49 -0400 -Subject: [PATCH 4/7] Don't copy vcruntime +Subject: [PATCH 4/8] Don't copy vcruntime VCRUNTIME140.dll should not be redistributed, ever. diff --git a/ports/python3/0005-only-build-required-projects.patch b/ports/python3/0005-only-build-required-projects.patch index bfffb7e135cb6e..4c7cdb42bf2e32 100644 --- a/ports/python3/0005-only-build-required-projects.patch +++ b/ports/python3/0005-only-build-required-projects.patch @@ -1,7 +1,7 @@ From dfb70394a19e657f2700fa31b784b0ea538b2a70 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Wed, 9 Sep 2020 20:15:58 -0400 -Subject: [PATCH 5/7] Only build required projects +Subject: [PATCH 5/8] Only build required projects Strips out tests and unsupported externals (eg tkinter). diff --git a/ports/python3/0006-fix-duplicate-symbols.patch b/ports/python3/0006-fix-duplicate-symbols.patch index 4edf1236af970c..437f877c51aa5f 100644 --- a/ports/python3/0006-fix-duplicate-symbols.patch +++ b/ports/python3/0006-fix-duplicate-symbols.patch @@ -1,7 +1,7 @@ From 4d698284921b48b963caa26a352ef414f36f36d4 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Fri, 11 Sep 2020 12:35:36 -0400 -Subject: [PATCH 6/7] fix duplicate symbols +Subject: [PATCH 6/8] fix duplicate symbols diff --git a/Modules/_winapi.c b/Modules/_winapi.c diff --git a/ports/python3/0007-disable-static-PYD-loading.patch b/ports/python3/0007-disable-static-PYD-loading.patch index c3a8ac2a96168b..35d7aae19fd5a2 100644 --- a/ports/python3/0007-disable-static-PYD-loading.patch +++ b/ports/python3/0007-disable-static-PYD-loading.patch @@ -1,7 +1,7 @@ From eaf5d60b5de65f8d1f8f32535cd2e42da3115f00 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Sun, 13 Sep 2020 19:38:30 -0400 -Subject: [PATCH 7/7] Disable static PYD loading +Subject: [PATCH 7/8] Disable static PYD loading Loading shared *.pyd extensions with a static python on Windows crashes the interpreter. Don't do that. diff --git a/ports/python3/0008-always-use-vcpkg-expat.patch b/ports/python3/0008-always-use-vcpkg-expat.patch new file mode 100644 index 00000000000000..46816468f8b36f --- /dev/null +++ b/ports/python3/0008-always-use-vcpkg-expat.patch @@ -0,0 +1,37 @@ +From 0fb7abf948c0c6157a49126c90ef661ef59cd11f Mon Sep 17 00:00:00 2001 +From: Adam Johnson +Date: Wed, 16 Sep 2020 16:48:38 -0400 +Subject: [PATCH 8/8] Always use vcpkg expat + +The vendored expat library causes errors when building the port on +x86-windows after the expat port has been built. + +diff --git a/PCbuild/pyexpat.vcxproj b/PCbuild/pyexpat.vcxproj +index b2d9f5d57d..4efb826a05 100644 +--- a/PCbuild/pyexpat.vcxproj ++++ b/PCbuild/pyexpat.vcxproj +@@ -89,17 +89,19 @@ + + + +- ++ + $(PySourcePath)Modules\expat;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;PYEXPAT_EXPORTS;HAVE_EXPAT_H;XML_STATIC;%(PreprocessorDefinitions) + + +- ++ + + + + + ++ ++ + + + +-- +2.28.0.windows.1 + diff --git a/ports/python3/portfile.cmake b/ports/python3/portfile.cmake index 20692d449c1450..7dc92d19c8f47e 100644 --- a/ports/python3/portfile.cmake +++ b/ports/python3/portfile.cmake @@ -16,6 +16,7 @@ set(PATCHES 0005-only-build-required-projects.patch 0006-fix-duplicate-symbols.patch 0007-disable-static-PYD-loading.patch + 0008-always-use-vcpkg-expat.patch ) vcpkg_from_github( @@ -40,6 +41,8 @@ if(VCPKG_TARGET_IS_WINDOWS OR VCPKG_TARGET_IS_UWP) find_library(BZ2_DEBUG NAMES bz2 bz2d PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH) find_library(CRYPTO_RELEASE NAMES libcrypto PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH) find_library(CRYPTO_DEBUG NAMES libcrypto PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH) + find_library(EXPAT_RELEASE NAMES libexpat PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH) + find_library(EXPAT_DEBUG NAMES libexpat libexpatd PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH) find_library(FFI_RELEASE NAMES libffi PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH) find_library(FFI_DEBUG NAMES libffi PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH) find_library(LZMA_RELEASE NAMES lzma PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH) @@ -140,7 +143,12 @@ if(VCPKG_TARGET_IS_WINDOWS OR VCPKG_TARGET_IS_UWP) vcpkg_clean_msbuild() else() - set(OPTIONS "--with-openssl=${CURRENT_INSTALLED_DIR}" "--with-ensurepip" [[--with-suffix=""]]) + set(OPTIONS + "--with-openssl=${CURRENT_INSTALLED_DIR}" + "--with-ensurepip" + [[--with-suffix=""]] + "--with-system-expat" + ) if(VCPKG_TARGET_IS_OSX) list(APPEND OPTIONS "LIBS=-liconv -lintl") endif() diff --git a/ports/python3/python_vcpkg.props.in b/ports/python3/python_vcpkg.props.in index e5e5c392f12b54..efad43bbd20bfa 100644 --- a/ports/python3/python_vcpkg.props.in +++ b/ports/python3/python_vcpkg.props.in @@ -4,6 +4,7 @@ _Py_HAVE_ZLIB;%(PreprocessorDefinitions) + XML_STATIC;%(PreprocessorDefinitions) ${CURRENT_INSTALLED_DIR}/include;%(AdditionalIncludeDirectories) @@ -24,10 +25,10 @@ - ${BZ2_RELEASE};${FFI_RELEASE};${LZMA_RELEASE};${SQLITE_RELEASE};%(AdditionalDependencies) + ${BZ2_RELEASE};${EXPAT_RELEASE};${FFI_RELEASE};${LZMA_RELEASE};${SQLITE_RELEASE};%(AdditionalDependencies) - ${BZ2_DEBUG};${FFI_DEBUG};${LZMA_DEBUG};${SQLITE_DEBUG};%(AdditionalDependencies) + ${BZ2_DEBUG};${EXPAT_DEBUG};${FFI_DEBUG};${LZMA_DEBUG};${SQLITE_DEBUG};%(AdditionalDependencies) diff --git a/ports/python3/vcpkg.json b/ports/python3/vcpkg.json index e802b1fd3670ac..56a6f1c418fbc8 100644 --- a/ports/python3/vcpkg.json +++ b/ports/python3/vcpkg.json @@ -9,6 +9,7 @@ "name": "bzip2", "platform": "!(windows & static)" }, + "expat", { "name": "gettext", "platform": "!(windows | uwp)"