mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-24 06:59:07 +08:00
[python3] Build interpreter (#14891)
This commit is contained in:
parent
e1417916bc
commit
bdb225bc68
@ -25,8 +25,10 @@ IF the port supports the install target use vcpkg_install_make() instead of vcpk
|
||||
Specifies the Makefile as a relative path from the root of the sources passed to `vcpkg_configure_make()`
|
||||
|
||||
### BUILD_TARGET
|
||||
The target passed to the make build command (`./make <target>`). If not specified, the 'all' target will
|
||||
be passed.
|
||||
The target passed to the make build command (`./make <target>`). Defaults to 'all'.
|
||||
|
||||
### INSTALL_TARGET
|
||||
The target passed to the make build command (`./make <target>`) if `ENABLE_INSTALL` is used. Defaults to 'install'.
|
||||
|
||||
### DISABLE_PARALLEL
|
||||
The underlying buildsystem will be instructed to not parallelize
|
||||
|
@ -1,16 +1,16 @@
|
||||
From dffd6c572fb60f955bf3d98a87e5739163ab8f3f Mon Sep 17 00:00:00 2001
|
||||
From 4bd06273a9ed63f17966f113dc61a6051bad8b86 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/2] static library
|
||||
Subject: [PATCH 1/6] static library
|
||||
|
||||
builds the pythoncore as a static library instead of a DLL
|
||||
---
|
||||
PC/pyconfig.h | 6 ++++++
|
||||
PC/pyconfig.h | 7 +++++++
|
||||
PCbuild/pythoncore.vcxproj | 16 ++++++++++++++--
|
||||
2 files changed, 20 insertions(+), 2 deletions(-)
|
||||
2 files changed, 21 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/PC/pyconfig.h b/PC/pyconfig.h
|
||||
index 02216b5068..d359c884e2 100644
|
||||
index 02216b5068..7e0ba881a5 100644
|
||||
--- a/PC/pyconfig.h
|
||||
+++ b/PC/pyconfig.h
|
||||
@@ -252,6 +252,7 @@ typedef int pid_t;
|
||||
@ -21,7 +21,7 @@ index 02216b5068..d359c884e2 100644
|
||||
#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 */
|
||||
@@ -277,6 +278,11 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
|
||||
@@ -277,6 +278,12 @@ 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 */
|
||||
@ -30,6 +30,7 @@ index 02216b5068..d359c884e2 100644
|
||||
+# pragma comment(lib, "version.lib")
|
||||
+# pragma comment(lib, "shlwapi.lib")
|
||||
+# pragma comment(lib, "ws2_32.lib")
|
||||
+# pragma comment(lib, "pathcch.lib")
|
||||
#endif /* MS_COREDLL */
|
||||
|
||||
#if defined(MS_WIN64)
|
||||
|
@ -1,28 +0,0 @@
|
||||
From 28fe1e90fc4d34381553b7faf2f4c331bcaef669 Mon Sep 17 00:00:00 2001
|
||||
From: Adam Johnson <AdamJohnso@gmail.com>
|
||||
Date: Thu, 28 May 2020 17:36:31 -0400
|
||||
Subject: [PATCH 2/2] static crt
|
||||
|
||||
changes crt linkage of pythoncore to static.
|
||||
---
|
||||
PCbuild/pythoncore.vcxproj | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj
|
||||
index dbe236829a..1a4ddb5cea 100644
|
||||
--- a/PCbuild/pythoncore.vcxproj
|
||||
+++ b/PCbuild/pythoncore.vcxproj
|
||||
@@ -104,6 +104,10 @@
|
||||
<AdditionalIncludeDirectories Condition="$(IncludeExternals)">$(zlibDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_USRDLL;Py_BUILD_CORE;Py_BUILD_CORE_BUILTIN;MS_DLL_ID="$(SysWinVer)";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="$(IncludeExternals)">_Py_HAVE_ZLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
+ <RuntimeLibrary Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">MultiThreadedDebug</RuntimeLibrary>
|
||||
+ <RuntimeLibrary Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">MultiThreadedDebug</RuntimeLibrary>
|
||||
+ <RuntimeLibrary Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MultiThreaded</RuntimeLibrary>
|
||||
+ <RuntimeLibrary Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MultiThreaded</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>version.lib;shlwapi.lib;ws2_32.lib;pathcch.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
--
|
||||
2.28.0.windows.1
|
||||
|
39
ports/python3/0002-use-vcpkg-zlib.patch
Normal file
39
ports/python3/0002-use-vcpkg-zlib.patch
Normal file
@ -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
|
||||
@@ -507,8 +507,10 @@
|
||||
<ClCompile Include="..\Python\thread.c" />
|
||||
<ClCompile Include="..\Python\traceback.c" />
|
||||
</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" />
|
||||
@@ -556,7 +558,7 @@
|
||||
<Target Name="_WarnAboutToolset" BeforeTargets="PrepareForBuild" Condition="$(PlatformToolset) != 'v140' and $(PlatformToolset) != 'v141' and $(PlatformToolset) != 'v142'">
|
||||
<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
|
||||
|
117
ports/python3/0003-devendor-external-dependencies.patch
Normal file
117
ports/python3/0003-devendor-external-dependencies.patch
Normal file
@ -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;HAVE_EXPAT_H;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
|
||||
|
26
ports/python3/0004-dont-copy-vcruntime.patch
Normal file
26
ports/python3/0004-dont-copy-vcruntime.patch
Normal file
@ -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
|
||||
|
60
ports/python3/0005-only-build-required-projects.patch
Normal file
60
ports/python3/0005-only-build-required-projects.patch
Normal file
@ -0,0 +1,60 @@
|
||||
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
|
||||
@@ -45,21 +45,21 @@
|
||||
<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" />
|
||||
+ <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" />
|
||||
<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) and $(Platform) != 'ARM' and $(Platform) != 'ARM64'" />
|
||||
<ExtensionModules Include="@(ExternalModules->'%(Identity)')" Condition="$(IncludeExternals)" />
|
||||
<Projects Include="@(ExtensionModules->'%(Identity).vcxproj')" Condition="$(IncludeExtensions)" />
|
||||
--
|
||||
2.28.0.windows.1
|
||||
|
39
ports/python3/0006-fix-duplicate-symbols.patch
Normal file
39
ports/python3/0006-fix-duplicate-symbols.patch
Normal file
@ -0,0 +1,39 @@
|
||||
From 62e082c1eba79d46ba8ab4b7a556a57a2253d555 Mon Sep 17 00:00:00 2001
|
||||
From: Adam Johnson <AdamJohnso@gmail.com>
|
||||
Date: Fri, 11 Sep 2020 12:35:36 -0400
|
||||
Subject: [PATCH 6/6] fix duplicate symbols
|
||||
|
||||
---
|
||||
Modules/_winapi.c | 2 +-
|
||||
Modules/overlapped.c | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/Modules/_winapi.c b/Modules/_winapi.c
|
||||
index e1672c4785..27148094d2 100644
|
||||
--- a/Modules/_winapi.c
|
||||
+++ b/Modules/_winapi.c
|
||||
@@ -304,7 +304,7 @@ static PyMemberDef overlapped_members[] = {
|
||||
{NULL}
|
||||
};
|
||||
|
||||
-PyTypeObject OverlappedType = {
|
||||
+static PyTypeObject OverlappedType = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
/* tp_name */ "_winapi.Overlapped",
|
||||
/* tp_basicsize */ sizeof(OverlappedObject),
|
||||
diff --git a/Modules/overlapped.c b/Modules/overlapped.c
|
||||
index cd7869fa8a..319ea0a4b7 100644
|
||||
--- a/Modules/overlapped.c
|
||||
+++ b/Modules/overlapped.c
|
||||
@@ -1756,7 +1756,7 @@ static PyGetSetDef Overlapped_getsets[] = {
|
||||
{NULL},
|
||||
};
|
||||
|
||||
-PyTypeObject OverlappedType = {
|
||||
+static PyTypeObject OverlappedType = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
/* tp_name */ "_overlapped.Overlapped",
|
||||
/* tp_basicsize */ sizeof(OverlappedObject),
|
||||
--
|
||||
2.28.0.windows.1
|
||||
|
@ -1,8 +0,0 @@
|
||||
Source: python3
|
||||
Version: 3.9.0
|
||||
Homepage: https://github.com/python/cpython
|
||||
Description: The Python programming language as an embeddable library
|
||||
Build-Depends: libffi, openssl, zlib (!uwp&!windows)
|
||||
|
||||
Feature: enable-shared
|
||||
Description: Build shared libraries in addition to static ones built by default
|
14
ports/python3/openssl.props.in
Normal file
14
ports/python3/openssl.props.in
Normal file
@ -0,0 +1,14 @@
|
||||
<?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>
|
||||
</ItemDefinitionGroup>
|
||||
</Project>
|
@ -8,17 +8,19 @@ set(PYTHON_VERSION_MINOR 9)
|
||||
set(PYTHON_VERSION_PATCH 0)
|
||||
set(PYTHON_VERSION ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.${PYTHON_VERSION_PATCH})
|
||||
|
||||
if(VCPKG_TARGET_IS_WINDOWS)
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
|
||||
list(APPEND PATCHES ${CMAKE_CURRENT_LIST_DIR}/0001-static-library.patch)
|
||||
endif()
|
||||
if (VCPKG_CRT_LINKAGE STREQUAL static)
|
||||
list(APPEND PATCHES ${CMAKE_CURRENT_LIST_DIR}/0002-static-crt.patch)
|
||||
endif()
|
||||
set(PATCHES
|
||||
0002-use-vcpkg-zlib.patch
|
||||
0003-devendor-external-dependencies.patch
|
||||
0004-dont-copy-vcruntime.patch
|
||||
0005-only-build-required-projects.patch
|
||||
0006-fix-duplicate-symbols.patch
|
||||
)
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
||||
list(PREPEND PATCHES 0001-static-library.patch)
|
||||
endif()
|
||||
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH TEMP_SOURCE_PATH
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO python/cpython
|
||||
REF v${PYTHON_VERSION}
|
||||
SHA512 39d304cae181674c4872c63768c0e5aeace2c92eb6d5ea550428d65c8571bc60922b3a3d484b51c46b466aadb7e27500559cafec13a489b48613bbb3fe6a5a5d
|
||||
@ -26,228 +28,154 @@ vcpkg_from_github(
|
||||
PATCHES ${PATCHES}
|
||||
)
|
||||
|
||||
if("enable-shared" IN_LIST FEATURES)
|
||||
set(_ENABLED_SHARED --enable-shared)
|
||||
if(VCPKG_TARGET_IS_LINUX)
|
||||
message(WARNING"Feature enable-shared requires libffi-devel from the system package manager, please install it on Ubuntu system via sudo apt-get install libffi-dev.")
|
||||
if(VCPKG_TARGET_IS_WINDOWS OR VCPKG_TARGET_IS_UWP)
|
||||
# Due to the way Python handles C extension modules on Windows, a static python core cannot
|
||||
# load extension modules.
|
||||
string(COMPARE EQUAL ${VCPKG_LIBRARY_LINKAGE} "dynamic" PYTHON_ALLOW_EXTENSIONS)
|
||||
if(PYTHON_ALLOW_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 PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH)
|
||||
find_library(EXPAT_DEBUG NAMES libexpatd libexpatdMD 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)
|
||||
find_library(LZMA_DEBUG NAMES lzmad PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH)
|
||||
find_library(SQLITE_RELEASE NAMES sqlite3 PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH)
|
||||
find_library(SQLITE_DEBUG NAMES sqlite3 PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH)
|
||||
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)
|
||||
else()
|
||||
message(STATUS "WARNING: Static builds of Python will not have C extension modules 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)
|
||||
|
||||
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' />"
|
||||
)
|
||||
|
||||
if(PYTHON_ALLOW_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()
|
||||
|
||||
# _freeze_importlib.exe is run as part of the build process, so make sure the required dynamic libs are available.
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
||||
vcpkg_add_to_path("${CURRENT_INSTALLED_DIR}/bin")
|
||||
endif()
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
||||
vcpkg_add_to_path("${CURRENT_INSTALLED_DIR}/debug/bin")
|
||||
endif()
|
||||
|
||||
vcpkg_install_msbuild(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PROJECT_SUBPATH "PCbuild/pcbuild.proj"
|
||||
OPTIONS ${OPTIONS}
|
||||
LICENSE_SUBPATH "LICENSE"
|
||||
SKIP_CLEAN
|
||||
)
|
||||
|
||||
# The extension modules must be placed in the DLLs directory, so we can't use vcpkg_copy_tools()
|
||||
if(PYTHON_ALLOW_EXTENSIONS)
|
||||
file(GLOB_RECURSE PYTHON_EXTENSIONS "${CURRENT_BUILDTREES_DIR}/*.pyd")
|
||||
list(FILTER PYTHON_EXTENSIONS EXCLUDE REGEX [[.*_d\.pyd]])
|
||||
file(COPY ${PYTHON_EXTENSIONS} 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")
|
||||
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})
|
||||
|
||||
if(PYTHON_ALLOW_EXTENSIONS)
|
||||
message(STATUS "Bootstrapping pip")
|
||||
vcpkg_execute_required_process(COMMAND python -m ensurepip
|
||||
WORKING_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/${PORT}"
|
||||
LOGNAME "ensurepip-${TARGET_TRIPLET}"
|
||||
)
|
||||
endif()
|
||||
|
||||
vcpkg_clean_msbuild()
|
||||
else()
|
||||
unset(_ENABLED_SHARED)
|
||||
endif()
|
||||
|
||||
if (VCPKG_TARGET_IS_WINDOWS)
|
||||
if(DEFINED _ENABLED_SHARED)
|
||||
message(WARNING "enable-shared requested, by Windows build already produce a shared library by default")
|
||||
endif()
|
||||
set(SOURCE_PATH "${TEMP_SOURCE_PATH}-Lib-Win")
|
||||
file(REMOVE_RECURSE ${SOURCE_PATH})
|
||||
file(RENAME "${TEMP_SOURCE_PATH}" ${SOURCE_PATH})
|
||||
|
||||
if (VCPKG_TARGET_ARCHITECTURE MATCHES "x86")
|
||||
set(BUILD_ARCH "Win32")
|
||||
set(OUT_DIR "win32")
|
||||
elseif (VCPKG_TARGET_ARCHITECTURE MATCHES "x64")
|
||||
set(BUILD_ARCH "x64")
|
||||
set(OUT_DIR "amd64")
|
||||
else()
|
||||
message(FATAL_ERROR "Unsupported architecture: ${VCPKG_TARGET_ARCHITECTURE}")
|
||||
endif()
|
||||
|
||||
vcpkg_build_msbuild(
|
||||
PROJECT_PATH ${SOURCE_PATH}/PCBuild/pythoncore.vcxproj
|
||||
PLATFORM ${BUILD_ARCH})
|
||||
|
||||
file(INSTALL
|
||||
"${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(INSTALL
|
||||
"${SOURCE_PATH}/Lib"
|
||||
DESTINATION
|
||||
"${CURRENT_PACKAGES_DIR}/share/python${PYTHON_VERSION_MAJOR}"
|
||||
)
|
||||
file(INSTALL
|
||||
"${SOURCE_PATH}/PCBuild/${OUT_DIR}/python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}.lib"
|
||||
DESTINATION
|
||||
"${CURRENT_PACKAGES_DIR}/lib"
|
||||
)
|
||||
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
||||
file(INSTALL "${SOURCE_PATH}/PCBuild/${OUT_DIR}/python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}_d.lib" DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
|
||||
endif()
|
||||
|
||||
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
|
||||
file(INSTALL "${SOURCE_PATH}/PCBuild/${OUT_DIR}/python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}.dll" DESTINATION ${CURRENT_PACKAGES_DIR}/bin)
|
||||
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
||||
file(INSTALL "${SOURCE_PATH}/PCBuild/${OUT_DIR}/python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}_d.dll" DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
||||
vcpkg_copy_pdbs()
|
||||
endif()
|
||||
# Handle copyright
|
||||
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/python${PYTHON_VERSION_MAJOR} RENAME copyright)
|
||||
|
||||
elseif (VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_OSX)
|
||||
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
||||
set(SOURCE_PATH_DEBUG "${TEMP_SOURCE_PATH}-${TARGET_TRIPLET}-debug")
|
||||
endif()
|
||||
|
||||
set(SOURCE_PATH_RELEASE "${TEMP_SOURCE_PATH}-${TARGET_TRIPLET}-release")
|
||||
file(REMOVE_RECURSE ${SOURCE_PATH_RELEASE})
|
||||
file(GLOB FILES ${TEMP_SOURCE_PATH}/*)
|
||||
file(COPY ${FILES} DESTINATION ${SOURCE_PATH_RELEASE})
|
||||
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
||||
file(REMOVE_RECURSE ${SOURCE_PATH_DEBUG})
|
||||
file(RENAME "${TEMP_SOURCE_PATH}" ${SOURCE_PATH_DEBUG})
|
||||
endif()
|
||||
|
||||
find_program(MAKE make)
|
||||
if (NOT MAKE)
|
||||
message(FATAL_ERROR "MAKE not found")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
||||
################
|
||||
# Release build
|
||||
################
|
||||
message(STATUS "Configuring ${TARGET_TRIPLET}-rel")
|
||||
set(OUT_PATH_RELEASE ${SOURCE_PATH_RELEASE}/../../make-build-${TARGET_TRIPLET}-release)
|
||||
file(MAKE_DIRECTORY ${OUT_PATH_RELEASE})
|
||||
|
||||
if(VCPKG_TARGET_IS_OSX)
|
||||
vcpkg_execute_build_process(
|
||||
COMMAND
|
||||
"${SOURCE_PATH_RELEASE}/configure"
|
||||
${_ENABLED_SHARED}
|
||||
--prefix=${OUT_PATH_RELEASE}
|
||||
--with-openssl=${CURRENT_INSTALLED_DIR}
|
||||
"CPPFLAGS=-I${CURRENT_INSTALLED_DIR}/include -framework CoreFoundation" "LDFLAGS=-L${CURRENT_INSTALLED_DIR}/lib" "LIBS=-liconv"
|
||||
WORKING_DIRECTORY ${SOURCE_PATH_RELEASE}
|
||||
LOGNAME config-${TARGET_TRIPLET}-rel
|
||||
)
|
||||
else()
|
||||
vcpkg_execute_build_process(
|
||||
COMMAND
|
||||
"${SOURCE_PATH_RELEASE}/configure"
|
||||
${_ENABLED_SHARED}
|
||||
--prefix=${OUT_PATH_RELEASE}
|
||||
--with-openssl=${CURRENT_INSTALLED_DIR}
|
||||
"CPPFLAGS=-I${CURRENT_INSTALLED_DIR}/include" "LDFLAGS=-L${CURRENT_INSTALLED_DIR}/lib"
|
||||
WORKING_DIRECTORY ${SOURCE_PATH_RELEASE}
|
||||
LOGNAME config-${TARGET_TRIPLET}-rel
|
||||
)
|
||||
endif()
|
||||
|
||||
message(STATUS "Building ${TARGET_TRIPLET}-rel")
|
||||
|
||||
vcpkg_execute_build_process(
|
||||
COMMAND make install -j ${VCPKG_CONCURRENCY}
|
||||
NO_PARALLEL_COMMAND make install
|
||||
WORKING_DIRECTORY ${SOURCE_PATH_RELEASE}
|
||||
LOGNAME make-build-${TARGET_TRIPLET}-release
|
||||
)
|
||||
|
||||
message(STATUS "Installing ${TARGET_TRIPLET}-rel headers...")
|
||||
file(INSTALL "${OUT_PATH_RELEASE}/include/"
|
||||
DESTINATION ${CURRENT_PACKAGES_DIR}/include
|
||||
FILES_MATCHING PATTERN *.h
|
||||
)
|
||||
|
||||
message(STATUS "Installing ${TARGET_TRIPLET}-rel lib files...")
|
||||
file(GLOB PY_LIBS
|
||||
${OUT_PATH_RELEASE}/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/*)
|
||||
file(INSTALL ${PY_LIBS} DESTINATION ${CURRENT_PACKAGES_DIR}/share/python${PYTHON_VERSION_MAJOR}/Lib
|
||||
PATTERN "*.pyc" EXCLUDE
|
||||
PATTERN "*__pycache__*" EXCLUDE
|
||||
)
|
||||
|
||||
message(STATUS "Installing ${TARGET_TRIPLET}-rel share files...")
|
||||
file(GLOB PKGCFG ${OUT_PATH_RELEASE}/lib/pkgconfig/*)
|
||||
file(INSTALL ${PKGCFG} DESTINATION ${CURRENT_PACKAGES_DIR}/share/python${PYTHON_VERSION_MAJOR}
|
||||
PATTERN "*.pyc" EXCLUDE
|
||||
PATTERN "*__pycache__*" EXCLUDE
|
||||
)
|
||||
|
||||
message(STATUS "Installing ${TARGET_TRIPLET}-rel Python library files...")
|
||||
file(GLOB LIBS
|
||||
${OUT_PATH_RELEASE}/lib/libpython${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.*)
|
||||
if (NOT LIBS)
|
||||
file(GLOB LIBS ${OUT_PATH_RELEASE}/lib64/*)
|
||||
endif()
|
||||
file(INSTALL ${LIBS} DESTINATION ${CURRENT_PACKAGES_DIR}/lib
|
||||
PATTERN "*.pyc" EXCLUDE
|
||||
PATTERN "*__pycache__*" EXCLUDE
|
||||
)
|
||||
|
||||
message(STATUS "Installing ${TARGET_TRIPLET}-rel done")
|
||||
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
||||
################
|
||||
# Debug build
|
||||
################
|
||||
message(STATUS "Configuring ${TARGET_TRIPLET}-dbg")
|
||||
set(OUT_PATH_DEBUG ${SOURCE_PATH_DEBUG}/../../make-build-${TARGET_TRIPLET}-debug)
|
||||
file(MAKE_DIRECTORY ${OUT_PATH_DEBUG})
|
||||
|
||||
if(VCPKG_TARGET_IS_OSX)
|
||||
vcpkg_execute_build_process(
|
||||
COMMAND
|
||||
"${SOURCE_PATH_DEBUG}/configure"
|
||||
--with-pydebug
|
||||
${_ENABLED_SHARED}
|
||||
--prefix=${OUT_PATH_DEBUG}
|
||||
--with-openssl=${CURRENT_INSTALLED_DIR}/debug
|
||||
"CPPFLAGS=-I${CURRENT_INSTALLED_DIR}/include -framework CoreFoundation" "LDFLAGS=-L${CURRENT_INSTALLED_DIR}/debug/lib" "LIBS=-liconv"
|
||||
WORKING_DIRECTORY ${SOURCE_PATH_DEBUG}
|
||||
LOGNAME config-${TARGET_TRIPLET}-debug
|
||||
)
|
||||
else()
|
||||
vcpkg_execute_build_process(
|
||||
COMMAND
|
||||
"${SOURCE_PATH_DEBUG}/configure"
|
||||
--with-pydebug
|
||||
${_ENABLED_SHARED}
|
||||
--prefix=${OUT_PATH_DEBUG}
|
||||
--with-openssl=${CURRENT_INSTALLED_DIR}/debug
|
||||
"CPPFLAGS=-I${CURRENT_INSTALLED_DIR}/include" "LDFLAGS=-L${CURRENT_INSTALLED_DIR}/debug/lib"
|
||||
WORKING_DIRECTORY ${SOURCE_PATH_DEBUG}
|
||||
LOGNAME config-${TARGET_TRIPLET}-debug
|
||||
)
|
||||
endif()
|
||||
|
||||
message(STATUS "Building ${TARGET_TRIPLET}-dbg")
|
||||
vcpkg_execute_build_process(
|
||||
COMMAND make install -j ${VCPKG_CONCURRENCY}
|
||||
NO_PARALLEL_COMMAND make install
|
||||
WORKING_DIRECTORY ${SOURCE_PATH_DEBUG}
|
||||
LOGNAME make-build-${TARGET_TRIPLET}-debug
|
||||
)
|
||||
|
||||
message(STATUS "Installing ${TARGET_TRIPLET}-dbg Python library files...")
|
||||
file(GLOB LIBS
|
||||
${OUT_PATH_DEBUG}/lib/libpython${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}d.*)
|
||||
if (NOT LIBS)
|
||||
file(GLOB LIBS
|
||||
${OUT_PATH_DEBUG}/lib64/*)
|
||||
endif()
|
||||
file(INSTALL ${LIBS} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib
|
||||
PATTERN "*.pyc" EXCLUDE
|
||||
PATTERN "*__pycache__*" EXCLUDE
|
||||
)
|
||||
|
||||
message(STATUS "Installing ${TARGET_TRIPLET}-dbg done")
|
||||
|
||||
endif()
|
||||
# Handle copyright
|
||||
file(INSTALL ${SOURCE_PATH_RELEASE}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/python${PYTHON_VERSION_MAJOR} RENAME copyright)
|
||||
|
||||
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()
|
||||
|
||||
vcpkg_configure_make(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
OPTIONS ${OPTIONS}
|
||||
OPTIONS_DEBUG "--with-pydebug"
|
||||
)
|
||||
vcpkg_install_make(ADD_BIN_TO_PATH INSTALL_TARGET altinstall)
|
||||
|
||||
file(COPY "${CURRENT_PACKAGES_DIR}/bin/" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin")
|
||||
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")
|
||||
|
||||
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME "copyright")
|
||||
endif()
|
||||
|
35
ports/python3/python_vcpkg.props.in
Normal file
35
ports/python3/python_vcpkg.props.in
Normal file
@ -0,0 +1,35 @@
|
||||
<?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>
|
||||
${CURRENT_INSTALLED_DIR}/include;%(AdditionalIncludeDirectories)
|
||||
</AdditionalIncludeDirectories>
|
||||
|
||||
<RuntimeLibrary Condition="'${VCPKG_CRT_LINKAGE}|$(Configuration)' == 'static|Debug'">MultiThreadedDebug</RuntimeLibrary>
|
||||
<RuntimeLibrary Condition="'${VCPKG_CRT_LINKAGE}|$(Configuration)' == 'static|Release'">MultiThreaded</RuntimeLibrary>
|
||||
<RuntimeLibrary Condition="'${VCPKG_CRT_LINKAGE}|$(Configuration)' == 'dynamic|Debug'">MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<RuntimeLibrary Condition="'${VCPKG_CRT_LINKAGE}|$(Configuration)' == 'dynamic|Release'">MultiThreadedDLL</RuntimeLibrary>
|
||||
</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>
|
||||
</ItemDefinitionGroup>
|
||||
</Project>
|
32
ports/python3/vcpkg.json
Normal file
32
ports/python3/vcpkg.json
Normal file
@ -0,0 +1,32 @@
|
||||
{
|
||||
"name": "python3",
|
||||
"version-string": "3.9.0",
|
||||
"port-version": 1,
|
||||
"description": "The Python programming language",
|
||||
"homepage": "https://github.com/python/cpython",
|
||||
"supports": "!(arm | uwp)",
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "bzip2",
|
||||
"platform": "!(windows & static)"
|
||||
},
|
||||
"expat",
|
||||
{
|
||||
"name": "libffi",
|
||||
"platform": "!(windows & static)"
|
||||
},
|
||||
{
|
||||
"name": "liblzma",
|
||||
"platform": "!(windows & static)"
|
||||
},
|
||||
{
|
||||
"name": "openssl",
|
||||
"platform": "!(windows & static)"
|
||||
},
|
||||
{
|
||||
"name": "sqlite3",
|
||||
"platform": "!(windows & static)"
|
||||
},
|
||||
"zlib"
|
||||
]
|
||||
}
|
@ -1204,9 +1204,6 @@ python2:arm-uwp=fail
|
||||
python2:x64-linux=fail
|
||||
python2:x64-osx=fail
|
||||
python2:x64-uwp=fail
|
||||
python3:arm64-windows=fail
|
||||
python3:arm-uwp=fail
|
||||
python3:x64-uwp=fail
|
||||
qhull:x64-uwp=fail
|
||||
qhull:arm-uwp=fail
|
||||
qpid-proton:arm-uwp=fail
|
||||
|
@ -26,8 +26,10 @@ IF the port supports the install target use vcpkg_install_make() instead of vcpk
|
||||
Specifies the Makefile as a relative path from the root of the sources passed to `vcpkg_configure_make()`
|
||||
|
||||
### BUILD_TARGET
|
||||
The target passed to the make build command (`./make <target>`). If not specified, the 'all' target will
|
||||
be passed.
|
||||
The target passed to the make build command (`./make <target>`). Defaults to 'all'.
|
||||
|
||||
### INSTALL_TARGET
|
||||
The target passed to the make build command (`./make <target>`) if `ENABLE_INSTALL` is used. Defaults to 'install'.
|
||||
|
||||
### DISABLE_PARALLEL
|
||||
The underlying buildsystem will be instructed to not parallelize
|
||||
@ -56,7 +58,7 @@ function(vcpkg_build_make)
|
||||
include("${_VCPKG_CMAKE_VARS_FILE}")
|
||||
|
||||
# parse parameters such that semicolons in options arguments to COMMAND don't get erased
|
||||
cmake_parse_arguments(PARSE_ARGV 0 _bc "ADD_BIN_TO_PATH;ENABLE_INSTALL;DISABLE_PARALLEL" "LOGFILE_ROOT;BUILD_TARGET;SUBPATH;MAKEFILE" "")
|
||||
cmake_parse_arguments(PARSE_ARGV 0 _bc "ADD_BIN_TO_PATH;ENABLE_INSTALL;DISABLE_PARALLEL" "LOGFILE_ROOT;BUILD_TARGET;SUBPATH;MAKEFILE;INSTALL_TARGET" "")
|
||||
|
||||
if(NOT _bc_LOGFILE_ROOT)
|
||||
set(_bc_LOGFILE_ROOT "build")
|
||||
@ -70,6 +72,10 @@ function(vcpkg_build_make)
|
||||
set(_bc_MAKEFILE Makefile)
|
||||
endif()
|
||||
|
||||
if(NOT _bc_INSTALL_TARGET)
|
||||
set(_bc_INSTALL_TARGET "install")
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
set(_VCPKG_PREFIX ${CURRENT_PACKAGES_DIR})
|
||||
set(_VCPKG_INSTALLED ${CURRENT_INSTALLED_DIR})
|
||||
@ -93,7 +99,7 @@ function(vcpkg_build_make)
|
||||
string(REPLACE " " "\\\ " _VCPKG_PACKAGE_PREFIX ${CURRENT_PACKAGES_DIR})
|
||||
# Don't know why '/cygdrive' is suddenly a requirement here. (at least for x264)
|
||||
string(REGEX REPLACE "([a-zA-Z]):/" "/cygdrive/\\1/" _VCPKG_PACKAGE_PREFIX "${_VCPKG_PACKAGE_PREFIX}")
|
||||
set(INSTALL_OPTS -j ${VCPKG_CONCURRENCY} --trace -f ${_bc_MAKEFILE} install DESTDIR=${_VCPKG_PACKAGE_PREFIX})
|
||||
set(INSTALL_OPTS -j ${VCPKG_CONCURRENCY} --trace -f ${_bc_MAKEFILE} ${_bc_INSTALL_TARGET} DESTDIR=${_VCPKG_PACKAGE_PREFIX})
|
||||
#TODO: optimize for install-data (release) and install-exec (release/debug)
|
||||
else()
|
||||
# Compiler requriements
|
||||
@ -106,7 +112,7 @@ function(vcpkg_build_make)
|
||||
# Set make command and install command
|
||||
set(MAKE_OPTS ${_bc_MAKE_OPTIONS} V=1 -j ${VCPKG_CONCURRENCY} -f ${_bc_MAKEFILE} ${_bc_BUILD_TARGET})
|
||||
set(NO_PARALLEL_MAKE_OPTS ${_bc_MAKE_OPTIONS} V=1 -j 1 -f ${_bc_MAKEFILE} ${_bc_BUILD_TARGET})
|
||||
set(INSTALL_OPTS -j ${VCPKG_CONCURRENCY} -f ${_bc_MAKEFILE} install DESTDIR=${CURRENT_PACKAGES_DIR})
|
||||
set(INSTALL_OPTS -j ${VCPKG_CONCURRENCY} -f ${_bc_MAKEFILE} ${_bc_INSTALL_TARGET} DESTDIR=${CURRENT_PACKAGES_DIR})
|
||||
endif()
|
||||
|
||||
# Since includes are buildtype independent those are setup by vcpkg_configure_make
|
||||
|
@ -26,7 +26,7 @@ function(vcpkg_copy_tool_dependencies TOOL_DIR)
|
||||
message(FATAL_ERROR "Could not find PowerShell Core; please open an issue to report this.")
|
||||
endif()
|
||||
macro(search_for_dependencies PATH_TO_SEARCH)
|
||||
file(GLOB TOOLS "${TOOL_DIR}/*.exe" "${TOOL_DIR}/*.dll")
|
||||
file(GLOB TOOLS "${TOOL_DIR}/*.exe" "${TOOL_DIR}/*.dll" "${TOOL_DIR}/*.pyd")
|
||||
foreach(TOOL IN LISTS TOOLS)
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND "${PWSH_EXE}" -noprofile -executionpolicy Bypass -nologo
|
||||
|
Loading…
Reference in New Issue
Block a user