aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/python3
diff options
context:
space:
mode:
authorEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
committerEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
commit54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch)
treed915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/python3
move to own git serverHEADmaster
Diffstat (limited to 'vcpkg/ports/python3')
-rw-r--r--vcpkg/ports/python3/0001-only-build-required-projects.patch57
-rw-r--r--vcpkg/ports/python3/0002-static-library.patch106
-rw-r--r--vcpkg/ports/python3/0003-use-vcpkg-zlib.patch39
-rw-r--r--vcpkg/ports/python3/0004-devendor-external-dependencies.patch117
-rw-r--r--vcpkg/ports/python3/0005-dont-copy-vcruntime.patch26
-rw-r--r--vcpkg/ports/python3/0007-workaround-windows-11-sdk-rc-compiler-error.patch30
-rw-r--r--vcpkg/ports/python3/0008-python.pc.patch34
-rw-r--r--vcpkg/ports/python3/0010-dont-skip-rpath.patch31
-rw-r--r--vcpkg/ports/python3/0012-force-disable-modules.patch13
-rw-r--r--vcpkg/ports/python3/0015-dont-use-WINDOWS-def.patch9
-rw-r--r--vcpkg/ports/python3/0016-fix-win-cross.patch34
-rw-r--r--vcpkg/ports/python3/0016-undup-ffi-symbols.patch14
-rw-r--r--vcpkg/ports/python3/0017-fix-win.patch34
-rw-r--r--vcpkg/ports/python3/0018-fix-sysconfig-include.patch15
-rw-r--r--vcpkg/ports/python3/0019-fix-ssl-linkage.patch22
-rw-r--r--vcpkg/ports/python3/0020-Py_NO_LINK_LIB.patch13
-rw-r--r--vcpkg/ports/python3/openssl.props.in23
-rw-r--r--vcpkg/ports/python3/portfile.cmake401
-rw-r--r--vcpkg/ports/python3/python_vcpkg.props.in52
-rw-r--r--vcpkg/ports/python3/usage4
-rw-r--r--vcpkg/ports/python3/usage.unix9
-rw-r--r--vcpkg/ports/python3/usage.win8
-rw-r--r--vcpkg/ports/python3/vcpkg-cmake-wrapper.cmake169
-rw-r--r--vcpkg/ports/python3/vcpkg-port-config.cmake15
-rw-r--r--vcpkg/ports/python3/vcpkg.json104
25 files changed, 1379 insertions, 0 deletions
diff --git a/vcpkg/ports/python3/0001-only-build-required-projects.patch b/vcpkg/ports/python3/0001-only-build-required-projects.patch
new file mode 100644
index 0000000..d5f2647
--- /dev/null
+++ b/vcpkg/ports/python3/0001-only-build-required-projects.patch
@@ -0,0 +1,57 @@
+From 6492277e39dbe7dd77d32fdc9ae4b989213ef3c6 Mon Sep 17 00:00:00 2001
+From: Adam Johnson <AdamJohnso@gmail.com>
+Date: Wed, 9 Sep 2020 20:15:58 -0400
+Subject: [PATCH 5/6] only build required projects
+
+strips out tests and unsupported externals (eg tkinter).
+---
+ PCbuild/_ssl.vcxproj | 2 +-
+ PCbuild/pcbuild.proj | 14 +++++++-------
+ 2 files changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/PCbuild/_ssl.vcxproj b/PCbuild/_ssl.vcxproj
+index 4dffa202b7..e661cb6fb6 100644
+--- a/PCbuild/_ssl.vcxproj
++++ b/PCbuild/_ssl.vcxproj
+@@ -111,7 +111,7 @@
+ <Project>{cf7ac3d1-e2df-41d2-bea6-1e2556cdea26}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+- <ProjectReference Include="_socket.vcxproj">
++ <ProjectReference Condition="false" Include="_socket.vcxproj">
+ <Project>{86937f53-c189-40ef-8ce8-8759d8e7d480}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+diff --git a/PCbuild/pcbuild.proj b/PCbuild/pcbuild.proj
+index 4d416c589e..ede9868a8f 100644
+--- a/PCbuild/pcbuild.proj
++++ b/PCbuild/pcbuild.proj
+@@ -60,17 +60,17 @@
+ <!-- python3.dll -->
+ <Projects Include="python3dll.vcxproj" />
+ <!-- py[w].exe -->
+- <Projects Include="pylauncher.vcxproj;pywlauncher.vcxproj" />
++ <Projects Include="pylauncher.vcxproj;pywlauncher.vcxproj" Condition="false" />
+ <!-- pyshellext.dll -->
+- <Projects Include="pyshellext.vcxproj" />
++ <Projects Include="pyshellext.vcxproj" Condition="false" />
+ <!-- Extension modules -->
+ <ExtensionModules Include="_asyncio;_zoneinfo;_decimal;_elementtree;_msi;_multiprocessing;_overlapped;pyexpat;_queue;select;unicodedata;winsound;_uuid;_wmi" />
+ <ExtensionModules Include="_ctypes" Condition="$(IncludeCTypes)" />
+ <!-- Extension modules that require external sources -->
+ <ExternalModules Include="_bz2;_lzma;_sqlite3" />
+ <!-- venv launchers -->
+- <Projects Include="venvlauncher.vcxproj;venvwlauncher.vcxproj" />
+- <!-- _ssl will build _socket as well, which may cause conflicts in parallel builds -->
+- <ExtensionModules Include="_socket" Condition="!$(IncludeSSL) or !$(IncludeExternals)" />
+- <ExternalModules Include="_ssl;_hashlib" Condition="$(IncludeSSL)" />
++ <Projects Include="venvlauncher.vcxproj;venvwlauncher.vcxproj" Condition="false" />
++ <!-- _ssl will NOT build _socket as well -->
++ <ExtensionModules Include="_socket" Condition="true" />
++ <ExternalModules Include="_ssl;_hashlib" Condition="true" />
+ <ExternalModules Include="_tkinter" Condition="$(IncludeTkinter)" />
+ <ExtensionModules Include="@(ExternalModules->'%(Identity)')" Condition="$(IncludeExternals)" />
+ <Projects Include="@(ExtensionModules->'%(Identity).vcxproj')" Condition="$(IncludeExtensions)" />
+--
+2.28.0.windows.1
+
diff --git a/vcpkg/ports/python3/0002-static-library.patch b/vcpkg/ports/python3/0002-static-library.patch
new file mode 100644
index 0000000..015cdc5
--- /dev/null
+++ b/vcpkg/ports/python3/0002-static-library.patch
@@ -0,0 +1,106 @@
+From 14d91e4f4a9377f47cc4cc33faeeb7c82f64b176 Mon Sep 17 00:00:00 2001
+From: Adam Johnson <AdamJohnso@gmail.com>
+Date: Thu, 28 May 2020 17:25:21 -0400
+Subject: [PATCH 1/7] static library
+
+builds the pythoncore as a static library instead of a DLL
+---
+ PC/pyconfig.h | 9 +++++++++
+ PCbuild/pythoncore.vcxproj | 4 ++--
+ 2 files changed, 11 insertions(+), 2 deletions(-)
+
+diff --git a/PC/pyconfig.h b/PC/pyconfig.h
+index d7d3cf081e..34269f0b75 100644
+--- a/PC/pyconfig.h
++++ b/PC/pyconfig.h
+@@ -251,6 +251,9 @@ typedef int pid_t;
+
+ /* For Windows the Python core is in a DLL by default. Test
+ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
++#ifndef Py_NO_ENABLE_SHARED
++#define Py_NO_ENABLE_SHARED
++#endif
+ #if !defined(MS_NO_COREDLL) && !defined(Py_NO_ENABLE_SHARED)
+ # define Py_ENABLE_SHARED 1 /* standard symbol for shared library */
+ # define MS_COREDLL /* deprecated old symbol */
+@@ -276,6 +277,15 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
+ # endif /* _DEBUG */
+ # endif /* _MSC_VER */
+ # endif /* Py_BUILD_CORE */
++#else
++ /* So MSVC users need not specify the .lib file in their own config */
++# pragma comment(lib, "version.lib")
++# pragma comment(lib, "shlwapi.lib")
++# pragma comment(lib, "ws2_32.lib")
++# pragma comment(lib, "bcrypt.lib")
++# if Py_WINVER > 0x0601
++# pragma comment(lib, "pathcch.lib")
++# endif /* Py_WINVER */
+ #endif /* MS_COREDLL */
+
+ #ifdef MS_WIN64
+diff --git a/PCbuild/pcbuild.proj b/PCbuild/pcbuild.proj
+index 70c336a9d3..ba797e8afd 100644
+--- a/PCbuild/pcbuild.proj
++++ b/PCbuild/pcbuild.proj
+@@ -45,7 +45,7 @@
+ <BuildInParallel>false</BuildInParallel>
+ </Projects>
+ <!-- python3.dll -->
+- <Projects Include="python3dll.vcxproj" />
++ <Projects Include="python3dll.vcxproj" Condition="false" />
+ <!-- py[w].exe -->
+ <Projects Include="pylauncher.vcxproj;pywlauncher.vcxproj" Condition="false" />
+ <!-- pyshellext.dll -->
+diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj
+index 2625d0293d..2f8bdaa931 100644
+--- a/PCbuild/pythoncore.vcxproj
++++ b/PCbuild/pythoncore.vcxproj
+@@ -73,7 +73,7 @@
+ <Import Project="python.props" />
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Label="Configuration">
+- <ConfigurationType>DynamicLibrary</ConfigurationType>
++ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+@@ -102,7 +102,7 @@
+ <AdditionalOptions>/Zm200 %(AdditionalOptions)</AdditionalOptions>
+ <AdditionalIncludeDirectories>$(PySourcePath)Modules\_hacl\include;$(PySourcePath)Modules\_hacl\internal;$(PySourcePath)Python;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories Condition="$(IncludeExternals)">$(zlibDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+- <PreprocessorDefinitions>_USRDLL;Py_BUILD_CORE;Py_BUILD_CORE_BUILTIN;Py_ENABLE_SHARED;MS_DLL_ID="$(SysWinVer)";%(PreprocessorDefinitions)</PreprocessorDefinitions>
++ <PreprocessorDefinitions>_USRDLL;Py_BUILD_CORE;Py_BUILD_CORE_BUILTIN;MS_DLL_ID="$(SysWinVer)";%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions Condition="$(IncludeExternals)">_Py_HAVE_ZLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
+diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj
+index 2625d0293d..2f8bdaa931 100644
+--- a/PCbuild/_freeze_module.vcxproj
++++ b/PCbuild/_freeze_module.vcxproj
+@@ -88,7 +88,7 @@
+ <PropertyGroup Label="UserMacros" />
+ <ItemDefinitionGroup>
+ <ClCompile>
+- <PreprocessorDefinitions>Py_NO_ENABLE_SHARED;Py_BUILD_CORE;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
++ <PreprocessorDefinitions>Py_NO_ENABLE_SHARED;Py_BUILD_CORE;_CONSOLE;MS_DLL_ID="$(SysWinVer)";%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Optimization>Disabled</Optimization>
+ <WholeProgramOptimization>false</WholeProgramOptimization>
+ </ClCompile>
+diff --git a/Python/sysmodule.c b/Python/sysmodule.c
+index ac49f7867a..f3583345ff 100644
+--- a/Python/sysmodule.c
++++ b/Python/sysmodule.c
+@@ -2804,6 +2804,9 @@ _PySys_InitCore(PyThreadState *tstate, PyObject *sysdict
+ #ifdef MS_COREDLL
+ SET_SYS("dllhandle", PyLong_FromVoidPtr(PyWin_DLLhModule));
+ SET_SYS_FROM_STRING("winver", PyWin_DLLVersionString);
++#elif defined(MS_WINDOWS)
++ SET_SYS("dllhandle", PyLong_FromVoidPtr(NULL));
++ SET_SYS_FROM_STRING("winver", MS_DLL_ID);
+ #endif
+ #ifdef ABIFLAGS
+ SET_SYS_FROM_STRING("abiflags", ABIFLAGS);
+--
+2.28.0.windows.1
+
diff --git a/vcpkg/ports/python3/0003-use-vcpkg-zlib.patch b/vcpkg/ports/python3/0003-use-vcpkg-zlib.patch
new file mode 100644
index 0000000..af0b4fa
--- /dev/null
+++ b/vcpkg/ports/python3/0003-use-vcpkg-zlib.patch
@@ -0,0 +1,39 @@
+From 196555707236f4387875749f66620fb519166963 Mon Sep 17 00:00:00 2001
+From: Adam Johnson <AdamJohnso@gmail.com>
+Date: Wed, 9 Sep 2020 15:20:36 -0400
+Subject: [PATCH 2/6] use vcpkg zlib
+
+building without zlib is not a supported configuration, per the warning
+messages.
+---
+ PCbuild/pythoncore.vcxproj | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj
+index dbe236829a..5f30a35eb3 100644
+--- a/PCbuild/pythoncore.vcxproj
++++ b/PCbuild/pythoncore.vcxproj
+@@ -540,8 +540,10 @@
+ <ClCompile Include="..\Python\deepfreeze\deepfreeze.c" />
+ <!-- END deepfreeze -->
+ </ItemGroup>
+- <ItemGroup Condition="$(IncludeExternals)">
++ <ItemGroup>
+ <ClCompile Include="..\Modules\zlibmodule.c" />
++ </ItemGroup>
++ <ItemGroup Condition="false">
+ <ClCompile Include="$(zlibDir)\adler32.c" />
+ <ClCompile Include="$(zlibDir)\compress.c" />
+ <ClCompile Include="$(zlibDir)\crc32.c" />
+@@ -593,7 +595,7 @@
+ <Target Name="_WarnAboutToolset" BeforeTargets="PrepareForBuild" Condition="$(PlatformToolset) != 'v140' and $(PlatformToolset) != 'v141' and $(PlatformToolset) != 'v142' and $(PlatformToolset) != 'v143'">
+ <Warning Text="Toolset $(PlatformToolset) is not used for official builds. Your build may have errors or incompatibilities." />
+ </Target>
+- <Target Name="_WarnAboutZlib" BeforeTargets="PrepareForBuild" Condition="!$(IncludeExternals)">
++ <Target Name="_WarnAboutZlib" BeforeTargets="PrepareForBuild" Condition="false">
+ <Warning Text="Not including zlib is not a supported configuration." />
+ </Target>
+
+--
+2.28.0.windows.1
+
diff --git a/vcpkg/ports/python3/0004-devendor-external-dependencies.patch b/vcpkg/ports/python3/0004-devendor-external-dependencies.patch
new file mode 100644
index 0000000..ad31c1e
--- /dev/null
+++ b/vcpkg/ports/python3/0004-devendor-external-dependencies.patch
@@ -0,0 +1,117 @@
+From 6c5c3793cbc6ba2a1d0d623a2bdaa9c2125be516 Mon Sep 17 00:00:00 2001
+From: Adam Johnson <AdamJohnso@gmail.com>
+Date: Wed, 9 Sep 2020 15:24:38 -0400
+Subject: [PATCH 3/6] devendor external dependencies
+
+externally fetched libraries may cause linker errors resulting from
+duplicate symbols in downstream projects.
+---
+ PCbuild/_bz2.vcxproj | 4 +++-
+ PCbuild/_lzma.vcxproj | 5 ++---
+ PCbuild/_sqlite3.vcxproj | 2 +-
+ PCbuild/_ssl.vcxproj | 2 +-
+ PCbuild/pyexpat.vcxproj | 6 ++++--
+ 5 files changed, 11 insertions(+), 8 deletions(-)
+
+diff --git a/PCbuild/_bz2.vcxproj b/PCbuild/_bz2.vcxproj
+index 3fe95fbf83..6b12e8818e 100644
+--- a/PCbuild/_bz2.vcxproj
++++ b/PCbuild/_bz2.vcxproj
+@@ -101,6 +101,8 @@
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="..\Modules\_bz2module.c" />
++ </ItemGroup>
++ <ItemGroup Condition="false">
+ <ClCompile Include="$(bz2Dir)\blocksort.c" />
+ <ClCompile Include="$(bz2Dir)\bzlib.c" />
+ <ClCompile Include="$(bz2Dir)\compress.c" />
+@@ -109,7 +111,7 @@
+ <ClCompile Include="$(bz2Dir)\huffman.c" />
+ <ClCompile Include="$(bz2Dir)\randtable.c" />
+ </ItemGroup>
+- <ItemGroup>
++ <ItemGroup Condition="false">
+ <ClInclude Include="$(bz2Dir)\bzlib.h" />
+ <ClInclude Include="$(bz2Dir)\bzlib_private.h" />
+ </ItemGroup>
+diff --git a/PCbuild/_lzma.vcxproj b/PCbuild/_lzma.vcxproj
+index fe076a6fc5..70cc61dd95 100644
+--- a/PCbuild/_lzma.vcxproj
++++ b/PCbuild/_lzma.vcxproj
+@@ -94,10 +94,9 @@
+ <ItemDefinitionGroup>
+ <ClCompile>
+ <AdditionalIncludeDirectories>$(lzmaDir)src/liblzma/api;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+- <PreprocessorDefinitions>WIN32;_FILE_OFFSET_BITS=64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;LZMA_API_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
++ <PreprocessorDefinitions>WIN32;_FILE_OFFSET_BITS=64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
+- <AdditionalDependencies>$(OutDir)liblzma$(PyDebugExt).lib;%(AdditionalDependencies)</AdditionalDependencies>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+@@ -111,7 +110,7 @@
+ <Project>{cf7ac3d1-e2df-41d2-bea6-1e2556cdea26}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+- <ProjectReference Include="liblzma.vcxproj">
++ <ProjectReference Condition="false" Include="liblzma.vcxproj">
+ <Project>{12728250-16eC-4dc6-94d7-e21dd88947f8}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+diff --git a/PCbuild/_sqlite3.vcxproj b/PCbuild/_sqlite3.vcxproj
+index 7e0062692b..6fb3279a20 100644
+--- a/PCbuild/_sqlite3.vcxproj
++++ b/PCbuild/_sqlite3.vcxproj
+@@ -127,7 +127,7 @@
+ <Project>{cf7ac3d1-e2df-41d2-bea6-1e2556cdea26}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+- <ProjectReference Include="sqlite3.vcxproj">
++ <ProjectReference Condition="false" Include="sqlite3.vcxproj">
+ <Project>{a1a295e5-463c-437f-81ca-1f32367685da}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+diff --git a/PCbuild/_ssl.vcxproj b/PCbuild/_ssl.vcxproj
+index 4907f49b66..4dffa202b7 100644
+--- a/PCbuild/_ssl.vcxproj
++++ b/PCbuild/_ssl.vcxproj
+@@ -99,7 +99,7 @@
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="..\Modules\_ssl.c" />
+- <ClCompile Include="$(opensslIncludeDir)\applink.c">
++ <ClCompile Condition="false" Include="$(opensslIncludeDir)\applink.c">
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;$(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ </ItemGroup>
+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 @@
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <ItemDefinitionGroup>
+- <ClCompile>
++ <ClCompile Condition="false">
+ <AdditionalIncludeDirectories>$(PySourcePath)Modules\expat;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;PYEXPAT_EXPORTS;XML_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ </ItemDefinitionGroup>
+- <ItemGroup>
++ <ItemGroup Condition="false">
+ <ClInclude Include="..\Modules\expat\xmlrole.h" />
+ <ClInclude Include="..\Modules\expat\xmltok.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\Modules\pyexpat.c" />
++ </ItemGroup>
++ <ItemGroup Condition="false">
+ <ClCompile Include="..\Modules\expat\xmlparse.c" />
+ <ClCompile Include="..\Modules\expat\xmlrole.c" />
+ <ClCompile Include="..\Modules\expat\xmltok.c" />
+--
+2.28.0.windows.1
+
diff --git a/vcpkg/ports/python3/0005-dont-copy-vcruntime.patch b/vcpkg/ports/python3/0005-dont-copy-vcruntime.patch
new file mode 100644
index 0000000..174c27e
--- /dev/null
+++ b/vcpkg/ports/python3/0005-dont-copy-vcruntime.patch
@@ -0,0 +1,26 @@
+From 8086c67fa7ada1888a7808cbdc6fe74b62abe5b1 Mon Sep 17 00:00:00 2001
+From: Adam Johnson <AdamJohnso@gmail.com>
+Date: Wed, 9 Sep 2020 16:12:49 -0400
+Subject: [PATCH 4/6] dont copy vcruntime
+
+VCRUNTIME140.dll should not be redistributed, ever.
+---
+ PCbuild/pythoncore.vcxproj | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj
+index 5f30a35eb3..3cf21ba39c 100644
+--- a/PCbuild/pythoncore.vcxproj
++++ b/PCbuild/pythoncore.vcxproj
+@@ -565,7 +565,7 @@
+ <Target Name="_CopyVCRuntime" AfterTargets="Build" Inputs="@(VCRuntimeDLL)" Outputs="$(OutDir)%(Filename)%(Extension)" DependsOnTargets="FindVCRuntime">
+ <!-- bpo-38597: When we switch to another VCRuntime DLL, include vcruntime140.dll as well -->
+ <Warning Text="A copy of vcruntime140.dll is also required" Condition="!$(VCToolsRedistVersion.StartsWith(`14.`))" />
+- <Copy SourceFiles="%(VCRuntimeDLL.FullPath)" DestinationFolder="$(OutDir)" />
++ <Copy Condition="false" SourceFiles="%(VCRuntimeDLL.FullPath)" DestinationFolder="$(OutDir)" />
+ </Target>
+ <Target Name="_CleanVCRuntime" AfterTargets="Clean">
+ <Delete Files="@(VCRuntimeDLL->'$(OutDir)%(Filename)%(Extension)')" />
+--
+2.28.0.windows.1
+
diff --git a/vcpkg/ports/python3/0007-workaround-windows-11-sdk-rc-compiler-error.patch b/vcpkg/ports/python3/0007-workaround-windows-11-sdk-rc-compiler-error.patch
new file mode 100644
index 0000000..e5f8237
--- /dev/null
+++ b/vcpkg/ports/python3/0007-workaround-windows-11-sdk-rc-compiler-error.patch
@@ -0,0 +1,30 @@
+From 0a72b7061ed79c5d6d37b41a5b1610e32fb371a4 Mon Sep 17 00:00:00 2001
+From: Adam Johnson <AdamJohnso@gmail.com>
+Date: Wed, 22 Sep 2021 21:04:21 -0400
+Subject: [PATCH] workaround windows 11 sdk rc compiler error
+
+winnt.h was changed to error if the `SYSTEM_CACHE_ALIGNMENT` cannot be
+determined. when the RC compiler is invoked, this seems to fail where
+previous SDKs silently set the ARM value.
+---
+ PC/python_ver_rc.h | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/PC/python_ver_rc.h b/PC/python_ver_rc.h
+index 90fc6ba1a1..e313a5138e 100644
+--- a/PC/python_ver_rc.h
++++ b/PC/python_ver_rc.h
+@@ -1,3 +1,10 @@
++// Temporarily workaround bug in Windows SDK 10.0.22000.0 winnt.h
++#ifdef RC_INVOKED
++# ifndef SYSTEM_CACHE_ALIGNMENT_SIZE
++# define SYSTEM_CACHE_ALIGNMENT_SIZE 64
++# endif
++#endif
++
+ // Resource script for Python core DLL.
+ // Currently only holds version information.
+ //
+--
+2.33.0.windows.1
+
diff --git a/vcpkg/ports/python3/0008-python.pc.patch b/vcpkg/ports/python3/0008-python.pc.patch
new file mode 100644
index 0000000..cb2394d
--- /dev/null
+++ b/vcpkg/ports/python3/0008-python.pc.patch
@@ -0,0 +1,34 @@
+From 3c43def510e7c4c115fbe3938db8e4fe9bc2e311 Mon Sep 17 00:00:00 2001
+From: Max Khon <fjoe@samodelkin.net>
+Date: Tue, 8 Feb 2022 12:58:30 +0700
+Subject: [PATCH 08/11] python.pc
+
+Fix pkgconfig for debug Linux builds (#22529)
+---
+ Misc/python-embed.pc.in | 2 +-
+ Misc/python.pc.in | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/Misc/python-embed.pc.in b/Misc/python-embed.pc.in
+index 2be9df8143..92142dfe68 100644
+--- a/Misc/python-embed.pc.in
++++ b/Misc/python-embed.pc.in
+@@ -10,4 +10,4 @@ Requires:
+ Version: @VERSION@
+ Libs.private: @LIBS@
+ Libs: -L${libdir} -lpython@VERSION@@ABIFLAGS@
+-Cflags: -I${includedir}/python@VERSION@@ABIFLAGS@
++Cflags: -I${includedir}/python@VERSION@
+diff --git a/Misc/python.pc.in b/Misc/python.pc.in
+index 87e04decc2..0349dc81ba 100644
+--- a/Misc/python.pc.in
++++ b/Misc/python.pc.in
+@@ -10,4 +10,4 @@ Requires:
+ Version: @VERSION@
+ Libs.private: @LIBS@
+ Libs: -L${libdir} @LIBPYTHON@
+-Cflags: -I${includedir}/python@VERSION@@ABIFLAGS@
++Cflags: -I${includedir}/python@VERSION@
+--
+2.37.3.windows.1
+
diff --git a/vcpkg/ports/python3/0010-dont-skip-rpath.patch b/vcpkg/ports/python3/0010-dont-skip-rpath.patch
new file mode 100644
index 0000000..610f4a5
--- /dev/null
+++ b/vcpkg/ports/python3/0010-dont-skip-rpath.patch
@@ -0,0 +1,31 @@
+From f7439eae9b2f8d91b6689efbf01292a044f3a3fe Mon Sep 17 00:00:00 2001
+From: Osyotr <Osyotr@users.noreply.github.com>
+Date: Thu, 4 Aug 2022 23:49:06 +0300
+Subject: [PATCH 10/11] dont skip rpath
+
+---
+ configure.ac | 6 ++++++
+ 1 file changed, 6 insertions(+), 0 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 61b3266..4c2cfb4 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -49,6 +49,14 @@ [$1]
+ [RESTORE_ENV]
+ )dnl
+
++if test "$ac_sys_system" != "Darwin"; then
++AS_VAR_IF([GNULD], [yes], [
++ LDFLAGS="$LDFLAGS -Wl,--enable-new-dtags,-rpath,$vcpkg_rpath"
++], [
++ LDFLAGS="$LDFLAGS -Wl,-rpath,$vcpkg_rpath"
++])
++fi
++
+ dnl PY_CHECK_FUNC(FUNCTION, [INCLUDES], [AC_DEFINE-VAR])
+ AC_DEFUN([PY_CHECK_FUNC],
+ [ AS_VAR_PUSHDEF([py_var], [ac_cv_func_$1])
+--
+2.37.3.windows.1
+
diff --git a/vcpkg/ports/python3/0012-force-disable-modules.patch b/vcpkg/ports/python3/0012-force-disable-modules.patch
new file mode 100644
index 0000000..f97f19e
--- /dev/null
+++ b/vcpkg/ports/python3/0012-force-disable-modules.patch
@@ -0,0 +1,13 @@
+diff --git a/Modules/Setup b/Modules/Setup
+index 87c6a152f8..7ad53f5b4f 100644
+--- a/Modules/Setup
++++ b/Modules/Setup
+@@ -375,3 +375,8 @@ xxsubtype xxsubtype.c
+ #
+ # _sqlite3 _tkinter _curses pyexpat
+ # _codecs_jp _codecs_kr _codecs_tw unicodedata
++
++*disabled*
++_curses
++_curses_panel
++_tkinter
diff --git a/vcpkg/ports/python3/0015-dont-use-WINDOWS-def.patch b/vcpkg/ports/python3/0015-dont-use-WINDOWS-def.patch
new file mode 100644
index 0000000..f06f6e9
--- /dev/null
+++ b/vcpkg/ports/python3/0015-dont-use-WINDOWS-def.patch
@@ -0,0 +1,9 @@
+--- a/PC/launcher.c
++++ b/PC/launcher.c
+@@ -1,3 +1,6 @@
++#if defined(_CONSOLE)
++#undef _WINDOWS
++#endif
+ /*
+ * Copyright (C) 2011-2013 Vinay Sajip.
+ * Licensed to PSF under a contributor agreement.
diff --git a/vcpkg/ports/python3/0016-fix-win-cross.patch b/vcpkg/ports/python3/0016-fix-win-cross.patch
new file mode 100644
index 0000000..fdbdf82
--- /dev/null
+++ b/vcpkg/ports/python3/0016-fix-win-cross.patch
@@ -0,0 +1,34 @@
+diff --git a/PCbuild/_freeze_module.vcxproj b/PCbuild/_freeze_module.vcxproj
+index 7d3423251f..7f607742fe 100644
+--- a/PCbuild/_freeze_module.vcxproj
++++ b/PCbuild/_freeze_module.vcxproj
+@@ -366,7 +366,7 @@
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+ <Target Name="_RebuildGetPath" AfterTargets="_RebuildFrozen" Condition="$(Configuration) != 'PGUpdate'">
+- <Exec Command='"$(TargetPath)" "%(GetPath.ModName)" "%(GetPath.FullPath)" "%(GetPath.IntFile)"' />
++ <Exec Command='"_freeze_module.exe" "%(GetPath.ModName)" "%(GetPath.FullPath)" "%(GetPath.IntFile)"' />
+
+ <Copy SourceFiles="%(GetPath.IntFile)"
+ DestinationFiles="%(GetPath.OutFile)"
+@@ -378,7 +378,7 @@
+ Condition="'@(_UpdatedGetPath)' != ''" Importance="high" />
+ </Target>
+ <Target Name="_RebuildFrozen" AfterTargets="AfterBuild" Condition="$(Configuration) != 'PGUpdate'">
+- <Exec Command='"$(TargetPath)" "%(None.ModName)" "%(None.FullPath)" "%(None.IntFile)"' />
++ <Exec Command='"_freeze_module.exe" "%(None.ModName)" "%(None.FullPath)" "%(None.IntFile)"' />
+
+ <Copy SourceFiles="%(None.IntFile)"
+ DestinationFiles="%(None.OutFile)"
+diff --git a/PCbuild/pcbuild.proj b/PCbuild/pcbuild.proj
+index c49a8533ad..b1cdf7c8d7 100644
+--- a/PCbuild/pcbuild.proj
++++ b/PCbuild/pcbuild.proj
+@@ -14,6 +14,6 @@
+ <ItemDefinitionGroup>
+ <FreezeProjects>
+- <Platform>$(PreferredToolArchitecture)</Platform>
++ <Platform>$(Platform)</Platform>
+ <Configuration>$(Configuration)</Configuration>
+ <Configuration Condition="$(Configuration) == 'PGInstrument'">Release</Configuration>
+ <Properties></Properties>
diff --git a/vcpkg/ports/python3/0016-undup-ffi-symbols.patch b/vcpkg/ports/python3/0016-undup-ffi-symbols.patch
new file mode 100644
index 0000000..7faec9f
--- /dev/null
+++ b/vcpkg/ports/python3/0016-undup-ffi-symbols.patch
@@ -0,0 +1,14 @@
+diff --git a/Modules/_ctypes/malloc_closure.c b/Modules/_ctypes/malloc_closure.c
+index 788bae6a9..3938f79db 100644
+--- a/Modules/_ctypes/malloc_closure.c
++++ b/Modules/_ctypes/malloc_closure.c
+@@ -11,6 +11,9 @@
+ #endif
+ #include "ctypes.h"
+
++#undef Py_ffi_closure_alloc
++#undef Py_ffi_closure_free
++
+ /* BLOCKSIZE can be adjusted. Larger blocksize will take a larger memory
+ overhead, but allocate less blocks from the system. It may be that some
+ systems have a limit of how many mmap'd blocks can be open.
diff --git a/vcpkg/ports/python3/0017-fix-win.patch b/vcpkg/ports/python3/0017-fix-win.patch
new file mode 100644
index 0000000..9d3fb3e
--- /dev/null
+++ b/vcpkg/ports/python3/0017-fix-win.patch
@@ -0,0 +1,34 @@
+diff --git a/PCbuild/_freeze_module.vcxproj b/PCbuild/_freeze_module.vcxproj
+index 7d3423251f..7f607742fe 100644
+--- a/PCbuild/_freeze_module.vcxproj
++++ b/PCbuild/_freeze_module.vcxproj
+@@ -366,7 +366,7 @@
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+ <Target Name="_RebuildGetPath" AfterTargets="_RebuildFrozen" Condition="$(Configuration) != 'PGUpdate'">
+- <Exec Command='"$(TargetPath)" "%(GetPath.ModName)" "%(GetPath.FullPath)" "%(GetPath.IntFile)"' />
++ <Exec Command='"$(OutDir)$(TargetName)$(TargetExt)" "%(GetPath.ModName)" "%(GetPath.FullPath)" "%(GetPath.IntFile)"' />
+
+ <Copy SourceFiles="%(GetPath.IntFile)"
+ DestinationFiles="%(GetPath.OutFile)"
+@@ -378,7 +378,7 @@
+ Condition="'@(_UpdatedGetPath)' != ''" Importance="high" />
+ </Target>
+ <Target Name="_RebuildFrozen" AfterTargets="AfterBuild" Condition="$(Configuration) != 'PGUpdate'">
+- <Exec Command='"$(TargetPath)" "%(None.ModName)" "%(None.FullPath)" "%(None.IntFile)"' />
++ <Exec Command='"$(OutDir)$(TargetName)$(TargetExt)" "%(None.ModName)" "%(None.FullPath)" "%(None.IntFile)"' />
+
+ <Copy SourceFiles="%(None.IntFile)"
+ DestinationFiles="%(None.OutFile)"
+diff --git a/PCbuild/pcbuild.proj b/PCbuild/pcbuild.proj
+index c49a8533ad..b1cdf7c8d7 100644
+--- a/PCbuild/pcbuild.proj
++++ b/PCbuild/pcbuild.proj
+@@ -14,6 +14,6 @@
+ <ItemDefinitionGroup>
+ <FreezeProjects>
+- <Platform>$(PreferredToolArchitecture)</Platform>
++ <Platform>$(Platform)</Platform>
+ <Configuration>$(Configuration)</Configuration>
+ <Configuration Condition="$(Configuration) == 'PGInstrument'">Release</Configuration>
+ <Properties></Properties>
diff --git a/vcpkg/ports/python3/0018-fix-sysconfig-include.patch b/vcpkg/ports/python3/0018-fix-sysconfig-include.patch
new file mode 100644
index 0000000..1efdb5a
--- /dev/null
+++ b/vcpkg/ports/python3/0018-fix-sysconfig-include.patch
@@ -0,0 +1,15 @@
+diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py
+index ebe371182..e351df7da 100644
+--- a/Lib/sysconfig.py
++++ b/Lib/sysconfig.py
+@@ -51,8 +51,8 @@
+ 'platstdlib': '{base}/Lib',
+ 'purelib': '{base}/Lib/site-packages',
+ 'platlib': '{base}/Lib/site-packages',
+- 'include': '{installed_base}/Include',
+- 'platinclude': '{installed_base}/Include',
++ 'include': '{installed_base}/../../include/python{py_version_short}{abiflags}',
++ 'platinclude': '{installed_base}/../../include/python{py_version_short}{abiflags}',
+ 'scripts': '{base}/Scripts',
+ 'data': '{base}',
+ },
diff --git a/vcpkg/ports/python3/0019-fix-ssl-linkage.patch b/vcpkg/ports/python3/0019-fix-ssl-linkage.patch
new file mode 100644
index 0000000..3b6f922
--- /dev/null
+++ b/vcpkg/ports/python3/0019-fix-ssl-linkage.patch
@@ -0,0 +1,22 @@
+diff --git a/configure.ac b/configure.ac
+index ef899b881d..9ed1836608 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -6712,7 +6712,7 @@ done
+
+ # check if OpenSSL libraries work as expected
+ WITH_SAVE_ENV([
+- LIBS="$LIBS $OPENSSL_LIBS"
++ LIBS="$OPENSSL_LIBS $LIBS"
+ CFLAGS="$CFLAGS $OPENSSL_INCLUDES"
+ LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS $OPENSSL_LDFLAGS_RPATH"
+
+@@ -6737,7 +6737,7 @@ WITH_SAVE_ENV([
+ ])
+
+ WITH_SAVE_ENV([
+- LIBS="$LIBS $LIBCRYPTO_LIBS"
++ LIBS="$LIBCRYPTO_LIBS $LIBS"
+ CFLAGS="$CFLAGS $OPENSSL_INCLUDES"
+ LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS $OPENSSL_LDFLAGS_RPATH"
+
diff --git a/vcpkg/ports/python3/0020-Py_NO_LINK_LIB.patch b/vcpkg/ports/python3/0020-Py_NO_LINK_LIB.patch
new file mode 100644
index 0000000..233cf23
--- /dev/null
+++ b/vcpkg/ports/python3/0020-Py_NO_LINK_LIB.patch
@@ -0,0 +1,13 @@
+diff --git a/PC/pyconfig.h b/PC/pyconfig.h
+index f4f57c5d270028..9e70303868e5de 100644
+--- a/PC/pyconfig.h
++++ b/PC/pyconfig.h
+@@ -302,7 +302,7 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
+ #ifdef MS_COREDLL
+ # if !defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_BUILTIN)
+ /* not building the core - must be an ext */
+-# if defined(_MSC_VER)
++# if defined(_MSC_VER) && !defined(Py_NO_LINK_LIB)
+ /* So MSVC users need not specify the .lib
+ file in their Makefile (other compilers are
+ generally taken care of by distutils.) */
diff --git a/vcpkg/ports/python3/openssl.props.in b/vcpkg/ports/python3/openssl.props.in
new file mode 100644
index 0000000..697185c
--- /dev/null
+++ b/vcpkg/ports/python3/openssl.props.in
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemDefinitionGroup>
+ <Link>
+ <AdditionalDependencies>Crypt32.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies Condition="'$(Configuration)|$(IncludeExternals)'=='Release|true'">
+ ${CRYPTO_RELEASE};${SSL_RELEASE};%(AdditionalDependencies)
+ </AdditionalDependencies>
+ <AdditionalDependencies Condition="'$(Configuration)|$(IncludeExternals)'=='Debug|true'">
+ ${CRYPTO_DEBUG};${SSL_DEBUG};%(AdditionalDependencies)
+ </AdditionalDependencies>
+ </Link>
+ <Lib>
+ <AdditionalDependencies>Crypt32.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies Condition="'$(Configuration)|$(IncludeExternals)'=='Release|true'">
+ ${CRYPTO_RELEASE};${SSL_RELEASE};%(AdditionalDependencies)
+ </AdditionalDependencies>
+ <AdditionalDependencies Condition="'$(Configuration)|$(IncludeExternals)'=='Debug|true'">
+ ${CRYPTO_DEBUG};${SSL_DEBUG};%(AdditionalDependencies)
+ </AdditionalDependencies>
+ </Lib>
+ </ItemDefinitionGroup>
+</Project>
diff --git a/vcpkg/ports/python3/portfile.cmake b/vcpkg/ports/python3/portfile.cmake
new file mode 100644
index 0000000..b34fda3
--- /dev/null
+++ b/vcpkg/ports/python3/portfile.cmake
@@ -0,0 +1,401 @@
+if(VCPKG_TARGET_IS_ANDROID)
+ vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY)
+endif()
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic" AND VCPKG_CRT_LINKAGE STREQUAL "static")
+ message(STATUS "Warning: Dynamic library with static CRT is not supported. Building static library.")
+ set(VCPKG_LIBRARY_LINKAGE static)
+endif()
+
+if("extensions" IN_LIST FEATURES)
+ if(VCPKG_TARGET_IS_WINDOWS)
+ vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY)
+ endif()
+ set(PYTHON_HAS_EXTENSIONS ON)
+else()
+ set(PYTHON_HAS_EXTENSIONS OFF)
+endif()
+
+string(REGEX MATCH "^([0-9]+)\\.([0-9]+)\\.([0-9]+)" PYTHON_VERSION "${VERSION}")
+set(PYTHON_VERSION_MAJOR "${CMAKE_MATCH_1}")
+set(PYTHON_VERSION_MINOR "${CMAKE_MATCH_2}")
+set(PYTHON_VERSION_PATCH "${CMAKE_MATCH_3}")
+
+set(PATCHES
+ 0001-only-build-required-projects.patch
+ 0003-use-vcpkg-zlib.patch
+ 0004-devendor-external-dependencies.patch
+ 0005-dont-copy-vcruntime.patch
+ 0008-python.pc.patch
+ 0010-dont-skip-rpath.patch
+ 0012-force-disable-modules.patch
+ 0015-dont-use-WINDOWS-def.patch
+ 0016-undup-ffi-symbols.patch # Required for lld-link.
+ 0018-fix-sysconfig-include.patch
+ 0019-fix-ssl-linkage.patch
+ 0020-Py_NO_LINK_LIB.patch # Remove in 3.14 https://github.com/python/cpython/pull/19740
+)
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
+ list(APPEND PATCHES 0002-static-library.patch)
+endif()
+
+if(VCPKG_TARGET_IS_WINDOWS)
+ string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" PYTHON_ALLOW_EXTENSIONS)
+ if(PYTHON_HAS_EXTENSIONS AND NOT PYTHON_ALLOW_EXTENSIONS)
+ # This should never be reached due to vcpkg_check_linkage above
+ message(FATAL_ERROR "Cannot build python extensions! Python extensions on windows can only be built if python is a dynamic library!")
+ endif()
+ # The Windows 11 SDK has a problem that causes it to error on the resource files, so we patch that.
+ vcpkg_get_windows_sdk(WINSDK_VERSION)
+ if("${WINSDK_VERSION}" VERSION_GREATER_EQUAL "10.0.22000")
+ list(APPEND PATCHES "0007-workaround-windows-11-sdk-rc-compiler-error.patch")
+ endif()
+ if(VCPKG_CROSSCOMPILING)
+ list(APPEND PATCHES "0016-fix-win-cross.patch")
+ else()
+ list(APPEND PATCHES "0017-fix-win.patch")
+ endif()
+endif()
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO python/cpython
+ REF v${VERSION}
+ SHA512 0ca83685fe00d374857ce544eb10037f284a702b14f4cd5c22402b9fbeb557d6d4d23722eae3adbcff1208bf780a50c71146d8d5e3e8a65b84f50bcc5b6968c3
+ HEAD_REF master
+ PATCHES ${PATCHES}
+)
+
+vcpkg_replace_string("${SOURCE_PATH}/Makefile.pre.in" "$(INSTALL) -d -m $(DIRMODE)" "$(MKDIR_P)")
+
+function(make_python_pkgconfig)
+ cmake_parse_arguments(PARSE_ARGV 0 arg "" "FILE;INSTALL_ROOT;EXEC_PREFIX;INCLUDEDIR;ABIFLAGS" "")
+
+ set(prefix "${CURRENT_PACKAGES_DIR}")
+ set(libdir [[${prefix}/lib]])
+ set(exec_prefix ${arg_EXEC_PREFIX})
+ set(includedir ${arg_INCLUDEDIR})
+ set(VERSION "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
+ set(ABIFLAGS ${arg_ABIFLAGS})
+
+ string(REPLACE "python" "python-${VERSION}" out_file ${arg_FILE})
+ set(out_full_path "${arg_INSTALL_ROOT}/lib/pkgconfig/${out_file}")
+ configure_file("${SOURCE_PATH}/Misc/${arg_FILE}.in" ${out_full_path} @ONLY)
+
+ file(READ ${out_full_path} pkgconfig_file)
+ string(REPLACE "-lpython${VERSION}" "-lpython${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}" pkgconfig_file "${pkgconfig_file}")
+ file(WRITE ${out_full_path} "${pkgconfig_file}")
+endfunction()
+
+if(VCPKG_TARGET_IS_WINDOWS)
+ # Due to the way Python handles C extension modules on Windows, a static python core cannot
+ # load extension modules.
+ if(PYTHON_HAS_EXTENSIONS)
+ find_library(BZ2_RELEASE NAMES bz2 PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH)
+ find_library(BZ2_DEBUG NAMES 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 libexpatMD libexpatMT PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH)
+ find_library(EXPAT_DEBUG NAMES libexpatd libexpatdMD libexpatdMT PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH)
+ find_library(FFI_RELEASE NAMES ffi PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH)
+ find_library(FFI_DEBUG NAMES ffi PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH)
+ find_library(LZMA_RELEASE NAMES lzma PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH)
+ find_library(LZMA_DEBUG NAMES lzma PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH)
+ x_vcpkg_pkgconfig_get_modules(PREFIX PC_SQLITE3 MODULES sqlite3 LIBRARIES USE_MSVC_SYNTAX_ON_WINDOWS)
+ separate_arguments(SQLITE3_LIBRARIES_DEBUG UNIX_COMMAND "${PC_SQLITE3_LIBRARIES_DEBUG}")
+ separate_arguments(SQLITE3_LIBRARIES_RELEASE UNIX_COMMAND "${PC_SQLITE3_LIBRARIES_RELEASE}")
+ find_library(SSL_RELEASE NAMES libssl PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH)
+ find_library(SSL_DEBUG NAMES libssl PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH)
+ list(APPEND add_libs_rel "${BZ2_RELEASE};${EXPAT_RELEASE};${FFI_RELEASE};${LZMA_RELEASE};${SQLITE3_LIBRARIES_RELEASE}")
+ list(APPEND add_libs_dbg "${BZ2_DEBUG};${EXPAT_DEBUG};${FFI_DEBUG};${LZMA_DEBUG};${SQLITE3_LIBRARIES_DEBUG}")
+ else()
+ message(STATUS "WARNING: Extensions have been disabled. No C extension modules will be available.")
+ endif()
+ find_library(ZLIB_RELEASE NAMES zlib PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH)
+ find_library(ZLIB_DEBUG NAMES zlib zlibd PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH)
+ list(APPEND add_libs_rel "${ZLIB_RELEASE}")
+ list(APPEND add_libs_dbg "${ZLIB_DEBUG}")
+
+ configure_file("${SOURCE_PATH}/PC/pyconfig.h" "${SOURCE_PATH}/PC/pyconfig.h")
+ configure_file("${CMAKE_CURRENT_LIST_DIR}/python_vcpkg.props.in" "${SOURCE_PATH}/PCbuild/python_vcpkg.props")
+ configure_file("${CMAKE_CURRENT_LIST_DIR}/openssl.props.in" "${SOURCE_PATH}/PCbuild/openssl.props")
+ file(WRITE "${SOURCE_PATH}/PCbuild/libffi.props"
+ "<?xml version='1.0' encoding='utf-8'?>"
+ "<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003' />"
+ )
+
+ list(APPEND VCPKG_CMAKE_CONFIGURE_OPTIONS "-DVCPKG_SET_CHARSET_FLAG=OFF")
+ if(PYTHON_HAS_EXTENSIONS)
+ set(OPTIONS
+ "/p:IncludeExtensions=true"
+ "/p:IncludeExternals=true"
+ "/p:IncludeCTypes=true"
+ "/p:IncludeSSL=true"
+ "/p:IncludeTkinter=false"
+ "/p:IncludeTests=false"
+ "/p:ForceImportBeforeCppTargets=${SOURCE_PATH}/PCbuild/python_vcpkg.props"
+ )
+ else()
+ set(OPTIONS
+ "/p:IncludeExtensions=false"
+ "/p:IncludeExternals=false"
+ "/p:IncludeTests=false"
+ "/p:ForceImportBeforeCppTargets=${SOURCE_PATH}/PCbuild/python_vcpkg.props"
+ )
+ endif()
+ if(VCPKG_TARGET_IS_UWP)
+ list(APPEND OPTIONS "/p:IncludeUwp=true")
+ else()
+ list(APPEND OPTIONS "/p:IncludeUwp=false")
+ endif()
+ if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
+ list(APPEND OPTIONS "/p:_VcpkgPythonLinkage=DynamicLibrary")
+ else()
+ list(APPEND OPTIONS "/p:_VcpkgPythonLinkage=StaticLibrary")
+ endif()
+
+ vcpkg_find_acquire_program(PYTHON3)
+ get_filename_component(PYTHON3_DIR "${PYTHON3}" DIRECTORY)
+ set(ENV{PythonForBuild} "${PYTHON3_DIR}/python.exe") # PythonForBuild is what's used on windows, despite the readme
+
+ if(VCPKG_CROSSCOMPILING)
+ vcpkg_add_to_path("${CURRENT_HOST_INSTALLED_DIR}/manual-tools/${PORT}")
+ endif()
+
+ vcpkg_msbuild_install(
+ SOURCE_PATH "${SOURCE_PATH}"
+ PROJECT_SUBPATH "PCbuild/pcbuild.proj"
+ ADD_BIN_TO_PATH
+ OPTIONS ${OPTIONS}
+ ADDITIONAL_LIBS_RELEASE ${add_libs_rel}
+ ADDITIONAL_LIBS_DEBUG ${add_libs_dbg}
+ )
+
+ if(NOT VCPKG_CROSSCOMPILING)
+ file(GLOB_RECURSE freeze_module "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/PCbuild/**/_freeze_module.exe")
+ file(COPY "${freeze_module}" DESTINATION "${CURRENT_PACKAGES_DIR}/manual-tools/${PORT}")
+ vcpkg_copy_tool_dependencies("${CURRENT_PACKAGES_DIR}/manual-tools/${PORT}")
+ endif()
+
+ # The extension modules must be placed in the DLLs directory, so we can't use vcpkg_copy_tools()
+ if(PYTHON_HAS_EXTENSIONS)
+ file(GLOB_RECURSE PYTHON_EXTENSIONS_RELEASE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/*.pyd")
+ file(COPY ${PYTHON_EXTENSIONS_RELEASE} DESTINATION "${CURRENT_PACKAGES_DIR}/bin")
+ file(COPY ${PYTHON_EXTENSIONS_RELEASE} DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}/DLLs")
+ vcpkg_copy_tool_dependencies("${CURRENT_PACKAGES_DIR}/tools/${PORT}/DLLs")
+ file(REMOVE "${CURRENT_PACKAGES_DIR}/tools/${PORT}/DLLs/python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}.dll")
+
+ file(GLOB_RECURSE PYTHON_EXTENSIONS_DEBUG "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/*.pyd")
+ file(COPY ${PYTHON_EXTENSIONS_DEBUG} DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin")
+ endif()
+
+ file(COPY "${SOURCE_PATH}/Include/" "${SOURCE_PATH}/PC/pyconfig.h"
+ DESTINATION "${CURRENT_PACKAGES_DIR}/include/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}"
+ FILES_MATCHING PATTERN *.h
+ )
+ file(COPY "${SOURCE_PATH}/Lib" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
+
+ # Remove any extension libraries and other unversioned binaries that could conflict with the python2 port.
+ # You don't need to link against these anyway.
+ file(GLOB PYTHON_LIBS
+ "${CURRENT_PACKAGES_DIR}/lib/*.lib"
+ "${CURRENT_PACKAGES_DIR}/debug/lib/*.lib"
+ )
+ list(FILTER PYTHON_LIBS EXCLUDE REGEX [[python[0-9]*(_d)?\.lib$]])
+ file(GLOB PYTHON_INSTALLERS "${CURRENT_PACKAGES_DIR}/tools/${PORT}/wininst-*.exe")
+ file(REMOVE ${PYTHON_LIBS} ${PYTHON_INSTALLERS})
+
+ # pkg-config files
+ if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
+ make_python_pkgconfig(FILE python.pc INSTALL_ROOT ${CURRENT_PACKAGES_DIR}
+ EXEC_PREFIX "\${prefix}/tools/${PORT}" INCLUDEDIR [[${prefix}/include]] ABIFLAGS "")
+ make_python_pkgconfig(FILE python-embed.pc INSTALL_ROOT ${CURRENT_PACKAGES_DIR}
+ EXEC_PREFIX "\${prefix}/tools/${PORT}" INCLUDEDIR [[${prefix}/include]] ABIFLAGS "")
+ endif()
+
+ if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
+ make_python_pkgconfig(FILE python.pc INSTALL_ROOT "${CURRENT_PACKAGES_DIR}/debug"
+ EXEC_PREFIX "\${prefix}/../tools/${PORT}" INCLUDEDIR [[${prefix}/../include]] ABIFLAGS "_d")
+ make_python_pkgconfig(FILE python-embed.pc INSTALL_ROOT "${CURRENT_PACKAGES_DIR}/debug"
+ EXEC_PREFIX "\${prefix}/../tools/${PORT}" INCLUDEDIR [[${prefix}/../include]] ABIFLAGS "_d")
+ endif()
+
+ vcpkg_fixup_pkgconfig()
+
+ # Remove static library belonging to executable
+ if (VCPKG_LIBRARY_LINKAGE STREQUAL "static")
+ if (EXISTS "${CURRENT_PACKAGES_DIR}/lib/python.lib")
+ file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/lib/manual-link")
+ file(RENAME "${CURRENT_PACKAGES_DIR}/lib/python.lib"
+ "${CURRENT_PACKAGES_DIR}/lib/manual-link/python.lib")
+ endif()
+ if (EXISTS "${CURRENT_PACKAGES_DIR}/debug/lib/python_d.lib")
+ file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/lib/manual-link")
+ file(RENAME "${CURRENT_PACKAGES_DIR}/debug/lib/python_d.lib"
+ "${CURRENT_PACKAGES_DIR}/debug/lib/manual-link/python_d.lib")
+ endif()
+ endif()
+else()
+ # The Python Stable ABI, `libpython3.so` is not produced by the upstream build system with --with-pydebug option
+ if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic" AND NOT VCPKG_BUILD_TYPE)
+ set(VCPKG_POLICY_MISMATCHED_NUMBER_OF_BINARIES enabled)
+ endif()
+
+ set(OPTIONS
+ "--with-openssl=${CURRENT_INSTALLED_DIR}"
+ "--without-ensurepip"
+ "--with-suffix="
+ "--with-system-expat"
+ "--disable-test-modules"
+ )
+ if(VCPKG_TARGET_IS_OSX OR VCPKG_TARGET_IS_BSD)
+ list(APPEND OPTIONS "LIBS=-liconv -lintl")
+ endif()
+
+ if("readline" IN_LIST FEATURES)
+ list(APPEND OPTIONS "--with-readline")
+ else()
+ list(APPEND OPTIONS "--without-readline")
+ endif()
+
+ if(VCPKG_TARGET_IS_ANDROID)
+ list(APPEND OPTIONS "--without-static-libpython" )
+ list(APPEND VCPKG_CMAKE_CONFIGURE_OPTIONS "-DANDROID_NO_UNDEFINED=OFF")
+ if(VCPKG_CROSSCOMPILING)
+ # Cannot not run target executables during configure
+ if(NOT PYTHON3_BUGGY_GETADDRINFO)
+ list(APPEND OPTIONS "ac_cv_buggy_getaddrinfo=no")
+ endif()
+ if(NOT PYTHON3_NO_PTMX)
+ list(APPEND OPTIONS "ac_cv_file__dev_ptmx=yes" "ac_cv_file__dev_ptc=no")
+ endif()
+ endif()
+ endif()
+
+ # The version of the build Python must match the version of the cross compiled host Python.
+ # https://docs.python.org/3/using/configure.html#cross-compiling-options
+ if(VCPKG_CROSSCOMPILING)
+ set(_python_for_build "${CURRENT_HOST_INSTALLED_DIR}/tools/python3/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
+ list(APPEND OPTIONS "--with-build-python=${_python_for_build}")
+ endif()
+
+ vcpkg_make_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ AUTORECONF
+ OPTIONS
+ ${OPTIONS}
+ OPTIONS_DEBUG
+ "--with-pydebug"
+ "vcpkg_rpath=${CURRENT_INSTALLED_DIR}/debug/lib"
+ OPTIONS_RELEASE
+ "vcpkg_rpath=${CURRENT_INSTALLED_DIR}/lib"
+ )
+ vcpkg_make_install(TARGETS altinstall)
+
+ file(COPY "${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin/" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
+
+ # Makefiles, c files, __pycache__, and other junk.
+ file(GLOB PYTHON_LIB_DIRS LIST_DIRECTORIES true
+ "${CURRENT_PACKAGES_DIR}/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/*"
+ "${CURRENT_PACKAGES_DIR}/debug/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/*")
+ list(FILTER PYTHON_LIB_DIRS INCLUDE REGEX [[config-[0-9].*.*]])
+ file(REMOVE_RECURSE ${PYTHON_LIB_DIRS})
+
+ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin")
+ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin")
+ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
+ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}d")
+ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/${PORT}/man1")
+ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin")
+ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug")
+
+ vcpkg_fixup_pkgconfig()
+
+ # Perform some post-build checks on modules
+ file(GLOB python_libs_dynload_debug LIST_DIRECTORIES false "${CURRENT_PACKAGES_DIR}/debug/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/lib-dynload/*.so*")
+ file(GLOB python_libs_dynload_release LIST_DIRECTORIES false "${CURRENT_PACKAGES_DIR}/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/lib-dynload/*.so*")
+ set(python_libs_dynload_failed_debug ${python_libs_dynload_debug})
+ set(python_libs_dynload_failed_release ${python_libs_dynload_release})
+ list(FILTER python_libs_dynload_failed_debug INCLUDE REGEX ".*_failed\.so.*")
+ list(FILTER python_libs_dynload_failed_release INCLUDE REGEX ".*_failed\.so.*")
+ if(python_libs_dynload_failed_debug OR python_libs_dynload_failed_release)
+ list(JOIN python_libs_dynload_failed_debug "\n" python_libs_dynload_failed_debug_str)
+ list(JOIN python_libs_dynload_failed_release "\n" python_libs_dynload_failed_release_str)
+ message(FATAL_ERROR "There should be no modules with \"_failed\" suffix:\n${python_libs_dynload_failed_debug_str}\n${python_libs_dynload_failed_release_str}")
+ endif()
+ if(NOT VCPKG_BUILD_TYPE)
+ list(LENGTH python_libs_dynload_release python_libs_dynload_release_length)
+ list(LENGTH python_libs_dynload_debug python_libs_dynload_debug_length)
+ if(NOT python_libs_dynload_release_length STREQUAL python_libs_dynload_debug_length)
+ message(FATAL_ERROR "Mismatched number of modules: ${python_libs_dynload_debug_length} in debug, ${python_libs_dynload_release_length} in release")
+ endif()
+ endif()
+endif()
+
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
+
+file(READ "${CMAKE_CURRENT_LIST_DIR}/usage" usage)
+if(VCPKG_TARGET_IS_WINDOWS)
+ if(PYTHON_HAS_EXTENSIONS)
+ file(READ "${CMAKE_CURRENT_LIST_DIR}/usage.win" usage_extra)
+ else()
+ set(usage_extra "")
+ endif()
+else()
+ file(READ "${CMAKE_CURRENT_LIST_DIR}/usage.unix" usage_extra)
+endif()
+string(REPLACE "@PYTHON_VERSION_MINOR@" "${PYTHON_VERSION_MINOR}" usage_extra "${usage_extra}")
+file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage" "${usage}\n${usage_extra}")
+
+function(_generate_finder)
+ cmake_parse_arguments(PythonFinder "NO_OVERRIDE;SUPPORTS_ARTIFACTS_PREFIX" "DIRECTORY;PREFIX" "" ${ARGN})
+ configure_file(
+ "${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake"
+ "${CURRENT_PACKAGES_DIR}/share/${PythonFinder_DIRECTORY}/vcpkg-cmake-wrapper.cmake"
+ @ONLY
+ )
+endfunction()
+
+message(STATUS "Installing cmake wrappers")
+_generate_finder(DIRECTORY "python" PREFIX "Python" SUPPORTS_ARTIFACTS_PREFIX)
+_generate_finder(DIRECTORY "python3" PREFIX "Python3" SUPPORTS_ARTIFACTS_PREFIX)
+_generate_finder(DIRECTORY "pythoninterp" PREFIX "PYTHON" NO_OVERRIDE)
+
+if (NOT VCPKG_TARGET_IS_WINDOWS)
+ function(replace_dirs_in_config_file python_config_file)
+ vcpkg_replace_string("${python_config_file}" "${CURRENT_INSTALLED_DIR}" "' + _base + '")
+ vcpkg_replace_string("${python_config_file}" "${CURRENT_HOST_INSTALLED_DIR}" "' + _base + '/../${HOST_TRIPLET}" IGNORE_UNCHANGED)
+ vcpkg_replace_string("${python_config_file}" "${CURRENT_PACKAGES_DIR}" "' + _base + '")
+ vcpkg_replace_string("${python_config_file}" "${CURRENT_BUILDTREES_DIR}" "not/existing")
+ endfunction()
+
+ if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
+ file(GLOB python_config_files "${CURRENT_PACKAGES_DIR}/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/_sysconfigdata*")
+ list(POP_FRONT python_config_files python_config_file)
+ vcpkg_replace_string("${python_config_file}" "# system configuration generated and used by the sysconfig module" "# system configuration generated and used by the sysconfig module\nimport os\n_base = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))\n")
+ replace_dirs_in_config_file("${python_config_file}")
+ endif()
+
+ if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
+ file(GLOB python_config_files "${CURRENT_PACKAGES_DIR}/debug/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/_sysconfigdata*")
+ list(POP_FRONT python_config_files python_config_file)
+ vcpkg_replace_string("${python_config_file}" "# system configuration generated and used by the sysconfig module" "# system configuration generated and used by the sysconfig module\nimport os\n_base = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))\n")
+ replace_dirs_in_config_file("${python_config_file}")
+ endif()
+endif()
+
+if(NOT VCPKG_TARGET_IS_WINDOWS)
+ file(COPY_FILE "${CURRENT_PACKAGES_DIR}/tools/python3/python3.${PYTHON_VERSION_MINOR}" "${CURRENT_PACKAGES_DIR}/tools/python3/python3")
+endif()
+
+configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-port-config.cmake" "${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-port-config.cmake" @ONLY)
+
+# For testing
+block()
+ include("${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-port-config.cmake")
+ set(CURRENT_HOST_INSTALLED_DIR "${CURRENT_PACKAGES_DIR}")
+ set(CURRENT_INSTALLED_DIR "${CURRENT_PACKAGES_DIR}")
+ vcpkg_get_vcpkg_installed_python(VCPKG_PYTHON3)
+endblock()
diff --git a/vcpkg/ports/python3/python_vcpkg.props.in b/vcpkg/ports/python3/python_vcpkg.props.in
new file mode 100644
index 0000000..a64a17d
--- /dev/null
+++ b/vcpkg/ports/python3/python_vcpkg.props.in
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemDefinitionGroup>
+ <CLCompile>
+ <!-- Use vcpkg ports instead of vendored externals -->
+ <PreprocessorDefinitions>_Py_HAVE_ZLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions Condition="${VCPKG_LIBRARY_LINKAGE} == 'static'">XML_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>
+ %(AdditionalIncludeDirectories);${CURRENT_INSTALLED_DIR}/include
+ </AdditionalIncludeDirectories>
+ </CLCompile>
+ <Link>
+ <!-- Required Libs -->
+ <AdditionalDependencies Condition="'$(Configuration)'=='Release'">
+ ${ZLIB_RELEASE};%(AdditionalDependencies)
+ </AdditionalDependencies>
+ <AdditionalDependencies Condition="'$(Configuration)'=='Debug'">
+ ${ZLIB_DEBUG};%(AdditionalDependencies)
+ </AdditionalDependencies>
+
+ <!-- Extension modules -->
+ <AdditionalDependencies Condition="'$(Configuration)|$(IncludeExtensions)' == 'Release|true'">
+ ${BZ2_RELEASE};${EXPAT_RELEASE};${FFI_RELEASE};${LZMA_RELEASE};${SQLITE_RELEASE};%(AdditionalDependencies)
+ </AdditionalDependencies>
+ <AdditionalDependencies Condition="'$(Configuration)|$(IncludeExtensions)' == 'Debug|true'">
+ ${BZ2_DEBUG};${EXPAT_DEBUG};${FFI_DEBUG};${LZMA_DEBUG};${SQLITE_DEBUG};%(AdditionalDependencies)
+ </AdditionalDependencies>
+ </Link>
+
+ <Lib>
+ <!-- Required to prevent linker errors on Visual Studio 2017 with static CRT -->
+ <TargetMachine Condition="'${VCPKG_TARGET_ARCHITECTURE}'=='x86'">MachineX86</TargetMachine>
+ <TargetMachine Condition="'${VCPKG_TARGET_ARCHITECTURE}'=='x64'">MachineX64</TargetMachine>
+ <TargetMachine Condition="'${VCPKG_TARGET_ARCHITECTURE}'=='arm'">MachineARM</TargetMachine>
+ <!-- Required Libs -->
+ <AdditionalDependencies Condition="'$(Configuration)'=='Release'">
+ ${ZLIB_RELEASE};%(AdditionalDependencies)
+ </AdditionalDependencies>
+ <AdditionalDependencies Condition="'$(Configuration)'=='Debug'">
+ ${ZLIB_DEBUG};%(AdditionalDependencies)
+ </AdditionalDependencies>
+
+ <!-- Extension modules -->
+ <AdditionalDependencies Condition="'$(Configuration)|$(IncludeExtensions)' == 'Release|true'">
+ ${BZ2_RELEASE};${EXPAT_RELEASE};${FFI_RELEASE};${LZMA_RELEASE};${SQLITE_RELEASE};%(AdditionalDependencies)
+ </AdditionalDependencies>
+ <AdditionalDependencies Condition="'$(Configuration)|$(IncludeExtensions)' == 'Debug|true'">
+ ${BZ2_DEBUG};${EXPAT_DEBUG};${FFI_DEBUG};${LZMA_DEBUG};${SQLITE_DEBUG};%(AdditionalDependencies)
+ </AdditionalDependencies>
+ </Lib>
+ </ItemDefinitionGroup>
+</Project>
diff --git a/vcpkg/ports/python3/usage b/vcpkg/ports/python3/usage
new file mode 100644
index 0000000..e177b11
--- /dev/null
+++ b/vcpkg/ports/python3/usage
@@ -0,0 +1,4 @@
+The package python3 is compatible with built-in CMake targets:
+
+ find_package(Python3 COMPONENTS Development REQUIRED)
+ target_link_libraries(main PRIVATE Python3::Python)
diff --git a/vcpkg/ports/python3/usage.unix b/vcpkg/ports/python3/usage.unix
new file mode 100644
index 0000000..fc2a575
--- /dev/null
+++ b/vcpkg/ports/python3/usage.unix
@@ -0,0 +1,9 @@
+The package python3 provides a python interpreter that supports virtual environments:
+
+ $ tools/python3/python3.@PYTHON_VERSION_MINOR@ -m venv /path/to/venv
+ $ export VIRTUAL_ENV=/path/to/venv
+ $ export PATH=/path/to/venv/bin:$PATH
+ $ export -n PYTHONHOME
+ $ unset PYTHONHOME
+
+ See https://docs.python.org/3/library/venv.html for more details.
diff --git a/vcpkg/ports/python3/usage.win b/vcpkg/ports/python3/usage.win
new file mode 100644
index 0000000..dcbb717
--- /dev/null
+++ b/vcpkg/ports/python3/usage.win
@@ -0,0 +1,8 @@
+The package python3 provides a python interpreter that supports virtual environments:
+
+ >tools\python3\python.exe -m venv c:\path\to\venv
+ >set VIRTUAL_ENV=c:\path\to\venv
+ >set PATH=c:\path\to\venv\bin;%PATH%
+ >set PYTHONHOME=
+
+ See https://docs.python.org/3/library/venv.html for more details.
diff --git a/vcpkg/ports/python3/vcpkg-cmake-wrapper.cmake b/vcpkg/ports/python3/vcpkg-cmake-wrapper.cmake
new file mode 100644
index 0000000..f5ed6b7
--- /dev/null
+++ b/vcpkg/ports/python3/vcpkg-cmake-wrapper.cmake
@@ -0,0 +1,169 @@
+# For very old ports whose upstream do not properly set the minimum CMake version.
+cmake_policy(SET CMP0012 NEW)
+cmake_policy(SET CMP0057 NEW)
+
+# This prevents the port's python.exe from overriding the Python fetched by
+# vcpkg_find_acquire_program(PYTHON3) and prevents the vcpkg toolchain from
+# stomping on FindPython's default functionality.
+list(REMOVE_ITEM CMAKE_PROGRAM_PATH "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools/python3")
+if(@PythonFinder_NO_OVERRIDE@)
+ _find_package(${ARGS})
+ return()
+endif()
+
+# CMake 4.0+ introduced Python_ARTIFACTS_PREFIX to add a suffix (yes, a suffix)
+# to the results of find_package(Python), so we need to handle that here.
+set(_PythonFinder_PREFIX "@PythonFinder_PREFIX@")
+if(@PythonFinder_SUPPORTS_ARTIFACTS_PREFIX@ AND CMAKE_VERSION VERSION_GREATER_EQUAL 4.0)
+ string(APPEND _PythonFinder_PREFIX "${@PythonFinder_PREFIX@_ARTIFACTS_PREFIX}")
+endif()
+
+# CMake's FindPython's separation of concerns is very muddy. We only want to force vcpkg's Python
+# if the consumer is using the development component. What we don't want to do is break detection
+# of the system Python, which may have certain packages the user expects. But - if the user is
+# embedding Python or using both the development and interpreter components, then we need the
+# interpreter matching vcpkg's Python libraries. Note that the "Development" component implies
+# both "Development.Module" and "Development.Embed".
+# The android toolchain links with --no-undefined. So modules must be linked with Python libs.
+if("Development" IN_LIST ARGS OR "Development.Embed" IN_LIST ARGS)
+ set(_PythonFinder_WantInterp TRUE)
+ set(_PythonFinder_WantLibs TRUE)
+elseif("Development.Module" IN_LIST ARGS OR "Development.SABIModule" IN_LIST ARGS)
+ if("Interpreter" IN_LIST ARGS)
+ set(_PythonFinder_WantInterp TRUE)
+ endif()
+ set(_PythonFinder_WantLibs TRUE)
+ if(ANDROID)
+ list(APPEND ARGS COMPONENTS Development.Embed)
+ endif()
+endif()
+
+if(_PythonFinder_WantLibs)
+ find_path(
+ _${_PythonFinder_PREFIX}_INCLUDE_DIR
+ NAMES "Python.h"
+ PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include"
+ PATH_SUFFIXES "python@PYTHON_VERSION_MAJOR@.@PYTHON_VERSION_MINOR@"
+ NO_DEFAULT_PATH
+ )
+
+ # Don't set the public facing hint or the finder will be unable to detect the debug library.
+ # Internally, it uses the same value with an underscore prepended.
+ find_library(
+ _${_PythonFinder_PREFIX}_LIBRARY_RELEASE
+ NAMES
+ "python@PYTHON_VERSION_MAJOR@@PYTHON_VERSION_MINOR@"
+ "python@PYTHON_VERSION_MAJOR@.@PYTHON_VERSION_MINOR@"
+ PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib"
+ NO_DEFAULT_PATH
+ )
+ find_library(
+ _${_PythonFinder_PREFIX}_LIBRARY_DEBUG
+ NAMES
+ "python@PYTHON_VERSION_MAJOR@@PYTHON_VERSION_MINOR@_d"
+ "python@PYTHON_VERSION_MAJOR@.@PYTHON_VERSION_MINOR@d"
+ PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib"
+ NO_DEFAULT_PATH
+ )
+
+ if(_PythonFinder_WantInterp)
+ find_program(
+ ${_PythonFinder_PREFIX}_EXECUTABLE
+ NAMES "python" "python@PYTHON_VERSION_MAJOR@.@PYTHON_VERSION_MINOR@"
+ PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools/python3"
+ NO_DEFAULT_PATH
+ )
+ endif()
+
+ # These are duplicated as normal variables to nullify FindPython's checksum verifications.
+ set(_${_PythonFinder_PREFIX}_INCLUDE_DIR "${_${_PythonFinder_PREFIX}_INCLUDE_DIR}")
+ set(_${_PythonFinder_PREFIX}_LIBRARY_RELEASE "${_${_PythonFinder_PREFIX}_LIBRARY_RELEASE}")
+ set(_${_PythonFinder_PREFIX}_LIBRARY_DEBUG "${_${_PythonFinder_PREFIX}_LIBRARY_DEBUG}")
+
+ _find_package(${ARGS})
+
+ get_directory_property(_${_PythonFinder_PREFIX}_IMPORTED_TARGETS IMPORTED_TARGETS)
+ if(ANDROID AND ${_PythonFinder_PREFIX}::Module IN_LIST _${_PythonFinder_PREFIX}_IMPORTED_TARGETS)
+ set_property(TARGET ${_PythonFinder_PREFIX}::Module APPEND PROPERTY INTERFACE_LINK_LIBRARIES $<LINK_ONLY:${_PythonFinder_PREFIX}::Python>)
+ endif()
+ unset(_${_PythonFinder_PREFIX}_IMPORTED_TARGETS)
+
+ if(@VCPKG_LIBRARY_LINKAGE@ STREQUAL "static")
+ # Python for Windows embeds the zlib module into the core, so we have to link against it.
+ # This is a separate extension module on Unix-like platforms.
+ if(WIN32)
+ find_package(ZLIB)
+ if(TARGET ${_PythonFinder_PREFIX}::Python)
+ set_property(TARGET ${_PythonFinder_PREFIX}::Python APPEND PROPERTY INTERFACE_LINK_LIBRARIES ZLIB::ZLIB)
+ endif()
+ if(TARGET ${_PythonFinder_PREFIX}::Module)
+ set_property(TARGET ${_PythonFinder_PREFIX}::Module APPEND PROPERTY INTERFACE_LINK_LIBRARIES ZLIB::ZLIB)
+ endif()
+ if(DEFINED ${_PythonFinder_PREFIX}_LIBRARIES)
+ list(APPEND ${_PythonFinder_PREFIX}_LIBRARIES ${ZLIB_LIBRARIES})
+ endif()
+ endif()
+
+ if(UNIX AND NOT APPLE)
+ if(TARGET ${_PythonFinder_PREFIX}::Python)
+ set_property(TARGET ${_PythonFinder_PREFIX}::Python APPEND PROPERTY INTERFACE_LINK_LIBRARIES m)
+ endif()
+ if(TARGET ${_PythonFinder_PREFIX}::Module)
+ set_property(TARGET ${_PythonFinder_PREFIX}::Module APPEND PROPERTY INTERFACE_LINK_LIBRARIES m)
+ endif()
+ if(DEFINED ${_PythonFinder_PREFIX}_LIBRARIES)
+ list(APPEND ${_PythonFinder_PREFIX}_LIBRARIES m)
+ endif()
+ endif()
+
+ if(APPLE)
+ find_package(Iconv)
+ find_package(Intl)
+ if(TARGET ${_PythonFinder_PREFIX}::Python)
+ get_target_property(_PYTHON_INTERFACE_LIBS ${_PythonFinder_PREFIX}::Python INTERFACE_LINK_LIBRARIES)
+ if(NOT _PYTHON_INTERFACE_LIBS)
+ set(_PYTHON_INTERFACE_LIBS "")
+ endif()
+ list(REMOVE_ITEM _PYTHON_INTERFACE_LIBS "-liconv" "-lintl")
+ list(APPEND _PYTHON_INTERFACE_LIBS
+ Iconv::Iconv
+ "$<IF:$<CONFIG:Debug>,${Intl_LIBRARY_DEBUG},${Intl_LIBRARY_RELEASE}>"
+ )
+ set_property(TARGET ${_PythonFinder_PREFIX}::Python PROPERTY INTERFACE_LINK_LIBRARIES ${_PYTHON_INTERFACE_LIBS})
+ unset(_PYTHON_INTERFACE_LIBS)
+ endif()
+ if(TARGET ${_PythonFinder_PREFIX}::Module)
+ get_target_property(_PYTHON_INTERFACE_LIBS ${_PythonFinder_PREFIX}::Module INTERFACE_LINK_LIBRARIES)
+ if(NOT _PYTHON_INTERFACE_LIBS)
+ set(_PYTHON_INTERFACE_LIBS "")
+ endif()
+ list(REMOVE_ITEM _PYTHON_INTERFACE_LIBS "-liconv" "-lintl")
+ list(APPEND _PYTHON_INTERFACE_LIBS
+ Iconv::Iconv
+ "$<IF:$<CONFIG:Debug>,${Intl_LIBRARY_DEBUG},${Intl_LIBRARY_RELEASE}>"
+ )
+ set_property(TARGET ${_PythonFinder_PREFIX}::Module PROPERTY INTERFACE_LINK_LIBRARIES ${_PYTHON_INTERFACE_LIBS})
+ unset(_PYTHON_INTERFACE_LIBS)
+ endif()
+ if(DEFINED ${_PythonFinder_PREFIX}_LIBRARIES)
+ list(APPEND ${_PythonFinder_PREFIX}_LIBRARIES "-framework CoreFoundation" ${Iconv_LIBRARIES} ${Intl_LIBRARIES})
+ endif()
+ endif()
+ endif()
+else()
+ _find_package(${ARGS})
+endif()
+
+if(TARGET ${_PythonFinder_PREFIX}::Python)
+ target_compile_definitions(${_PythonFinder_PREFIX}::Python INTERFACE "Py_NO_LINK_LIB")
+endif()
+if(TARGET ${_PythonFinder_PREFIX}::Module)
+ target_compile_definitions(${_PythonFinder_PREFIX}::Module INTERFACE "Py_NO_LINK_LIB")
+endif()
+if(TARGET ${_PythonFinder_PREFIX}::SABIModule)
+ target_compile_definitions(${_PythonFinder_PREFIX}::SABIModule INTERFACE "Py_NO_LINK_LIB")
+endif()
+
+unset(_PythonFinder_PREFIX)
+unset(_PythonFinder_WantInterp)
+unset(_PythonFinder_WantLibs)
diff --git a/vcpkg/ports/python3/vcpkg-port-config.cmake b/vcpkg/ports/python3/vcpkg-port-config.cmake
new file mode 100644
index 0000000..d3d16f3
--- /dev/null
+++ b/vcpkg/ports/python3/vcpkg-port-config.cmake
@@ -0,0 +1,15 @@
+include_guard(GLOBAL)
+set(PYTHON3_VERSION "@VERSION@")
+set(PYTHON3_VERSION_MAJOR "@PYTHON_VERSION_MAJOR@")
+set(PYTHON3_VERSION_MINOR "@PYTHON_VERSION_MINOR@")
+set(PYTHON3_INCLUDE "include/python${PYTHON3_VERSION_MAJOR}.${PYTHON3_VERSION_MINOR}")
+set(PYTHON3_HAS_EXTENSIONS "@PYTHON_HAS_EXTENSIONS@")
+set(site_base "")
+if(VCPKG_TARGET_IS_WINDOWS)
+ set(site_base "tools/python${PYTHON3_VERSION_MAJOR}/Lib")
+else()
+ set(site_base "lib/python${PYTHON3_VERSION_MAJOR}.${PYTHON3_VERSION_MINOR}")
+endif()
+set(PYTHON3_SITE "${site_base}/site-packages")
+
+include("${CURRENT_HOST_INSTALLED_DIR}/share/vcpkg-get-python/vcpkg-port-config.cmake")
diff --git a/vcpkg/ports/python3/vcpkg.json b/vcpkg/ports/python3/vcpkg.json
new file mode 100644
index 0000000..9e0d549
--- /dev/null
+++ b/vcpkg/ports/python3/vcpkg.json
@@ -0,0 +1,104 @@
+{
+ "name": "python3",
+ "version": "3.12.9",
+ "port-version": 7,
+ "description": "The Python programming language",
+ "homepage": "https://github.com/python/cpython",
+ "license": "Python-2.0",
+ "supports": "!uwp & !mingw",
+ "dependencies": [
+ {
+ "name": "gettext-libintl",
+ "platform": "!windows"
+ },
+ {
+ "name": "libiconv",
+ "platform": "!windows"
+ },
+ {
+ "name": "libuuid",
+ "platform": "!osx & !windows"
+ },
+ {
+ "name": "python3",
+ "host": true,
+ "default-features": false
+ },
+ {
+ "name": "python3",
+ "features": [
+ "extensions"
+ ],
+ "platform": "!windows"
+ },
+ {
+ "name": "vcpkg-get-python",
+ "host": true
+ },
+ {
+ "name": "vcpkg-make",
+ "host": true,
+ "platform": "!windows"
+ },
+ {
+ "name": "vcpkg-msbuild",
+ "host": true,
+ "platform": "windows"
+ },
+ "zlib"
+ ],
+ "default-features": [
+ {
+ "name": "extensions",
+ "platform": "!(staticcrt & windows)"
+ }
+ ],
+ "features": {
+ "extensions": {
+ "description": "Allow the build and usage of python extensions. On windows this requires python to be a dynamic library!",
+ "supports": "!(staticcrt & windows)",
+ "dependencies": [
+ {
+ "name": "bzip2",
+ "default-features": false
+ },
+ {
+ "name": "expat",
+ "default-features": false
+ },
+ {
+ "name": "libffi",
+ "default-features": false
+ },
+ {
+ "name": "liblzma",
+ "default-features": false
+ },
+ {
+ "name": "ncurses",
+ "platform": "!windows | mingw"
+ },
+ {
+ "name": "openssl",
+ "default-features": false
+ },
+ {
+ "name": "sqlite3",
+ "default-features": false
+ },
+ {
+ "name": "vcpkg-pkgconfig-get-modules",
+ "host": true,
+ "platform": "windows & !mingw"
+ }
+ ]
+ },
+ "readline": {
+ "description": "Build with readline.",
+ "supports": "!windows",
+ "dependencies": [
+ "readline"
+ ]
+ }
+ }
+}