8000 bpo-33125: Enables building traditional installer for Windows ARM64 (… · python/cpython@45faf15 · GitHub
[go: up one dir, main page]

Skip to content

Commit 45faf15

Browse files
authored
bpo-33125: Enables building traditional installer for Windows ARM64 (GH-30885)
Also makes a few general improvements to the build process and removes some dead code.
1 parent db77bcd commit 45faf15

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+334
-127
lines changed

.azure-pipelines/windows-release.yml

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ parameters:
3434
displayName: "Signature description"
3535
type: string
3636
default: 'Built: $(Build.BuildNumber)'
37+
- name: DoARM64
38+
displayName: "Publish ARM64 build"
39+
type: boolean
40+
default: true
3741
- name: DoPGO
3842
displayName: "Run PGO"
3943
type: boolean
@@ -64,25 +68,26 @@ parameters:
6468
default: '0'
6569

6670
variables:
67-
__RealSigningCertificate: 'Python Software Foundation'
68-
${{ if ne(parameters.GitRemote, '(Other)') }}:
69-
GitRemote: ${{ parameters.GitRemote }}
70-
${{ else }}:
71-
GitRemote: ${{ parameters.GitRemote_Other }}
72-
SourceTag: ${{ parameters.SourceTag }}
73-
DoPGO: ${{ parameters.DoPGO }}
74-
${{ if ne(parameters.SigningCertificate, 'Unsigned') }}:
75-
SigningCertificate: ${{ parameters.SigningCertificate }}
76-
SigningDescription: ${{ parameters.SigningDescription }}
77-
DoLayout: ${{ parameters.DoLayout }}
78-
DoMSIX: ${{ parameters.DoMSIX }}
79-
DoNuget: ${{ parameters.DoNuget }}
80-
DoEmbed: ${{ parameters.DoEmbed }}
81-
DoMSI: ${{ parameters.DoMSI }}
82-
DoPublish: ${{ parameters.DoPublish }}
71+
__RealSigningCertificate: 'Python Software Foundation'
72+
${{ if ne(parameters.GitRemote, '(Other)') }}:
73+
GitRemote: ${{ parameters.GitRemote }}
74+
${{ else }}:
75+
GitRemote: ${{ parameters.GitRemote_Other }}
76+
SourceTag: ${{ parameters.SourceTag }}
77+
DoPGO: ${{ parameters.DoPGO }}
78+
${{ if ne(parameters.SigningCertificate, 'Unsigned') }}:
79+
SigningCertificate: ${{ parameters.SigningCertificate }}
80+
SigningDescription: ${{ parameters.SigningDescription }}
81+
DoLayout: ${{ parameters.DoLayout }}
82+
DoMSIX: ${{ parameters.DoMSIX }}
83+
DoNuget: ${{ parameters.DoNuget }}
84+
DoEmbed: ${{ parameters.DoEmbed }}
85+
DoMSI: ${{ parameters.DoMSI }}
86+
DoPublish: ${{ parameters.DoPublish }}
87+
PublishARM64: ${{ parameters.DoARM64 }}
8388
# QUEUE TIME VARIABLES
84-
# PyDotOrgUsername: ''
85-
# PyDotOrgServer: ''
89+
# PyDotOrgUsername: ''
90+
# PyDotOrgServer: ''
8691

8792
trigger: none
8893
pr: none

.azure-pipelines/windows-release/msi-steps.yml

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,20 @@ steps:
4545
artifactName: bin_amd64_d
4646
targetPath: $(Build.BinariesDirectory)\amd64
4747

48+
- task: DownloadPipelineArtifact@1
49+
displayName: 'Download artifact: bin_arm64'
50+
condition: and(succeeded(), eq(variables['PublishARM64'], 'true'))
51+
inputs:
52+
artifactName: bin_arm64
53+
targetPath: $(Build.BinariesDirectory)\arm64
54+
55+
- task: DownloadPipelineArtifact@1
56+
displayName: 'Download artifact: bin_arm64_d'
57+
condition: and(succeeded(), eq(variables['PublishARM64'], 'true'))
58+
inputs:
59+
artifactName: bin_arm64_d
60+
targetPath: $(Build.BinariesDirectory)\arm64
61+
4862
- task: DownloadPipelineArtifact@1
4963
displayName: 'Download artifact: tcltk_lib_win32'
5064
inputs:
@@ -84,32 +98,45 @@ steps:
8498
8599
- script: |
86100
%MSBUILD% Tools\msi\bundle\releaselocal.wixproj /t:Rebuild /p:RebuildAll=true
87-
%MSBUILD% Tools\msi\bundle\releaseweb.wixproj /t:Rebuild /p:RebuildAll=false
88101
displayName: 'Build win32 installer'
89102
env:
90103
Platform: x86
91104
Py_OutDir: $(Build.BinariesDirectory)
92105
PYTHON: $(Build.BinariesDirectory)\win32\python.exe
106+
PythonForBuild: $(Build.BinariesDirectory)\win32\python.exe
93107
PYTHONHOME: $(Build.SourcesDirectory)
94108
TclTkLibraryDir: $(Build.BinariesDirectory)\tcltk_lib_win32
95109
BuildForRelease: true
96110
SuppressMinGWLib: true
97111
98112
- script: |
99113
%MSBUILD% Tools\msi\bundle\releaselocal.wixproj /t:Rebuild /p:RebuildAll=true
100-
%MSBUILD% Tools\msi\bundle\releaseweb.wixproj /t:Rebuild /p:RebuildAll=false
101114
displayName: 'Build amd64 installer'
102115
env:
103116
Platform: x64
104117
Py_OutDir: $(Build.BinariesDirectory)
105118
PYTHON: $(Build.BinariesDirectory)\amd64\python.exe
119+
PythonForBuild: $(Build.BinariesDirectory)\amd64\python.exe
106120
PYTHONHOME: $(Build.SourcesDirectory)
107121
TclTkLibraryDir: $(Build.BinariesDirectory)\tcltk_lib_amd64
108122
BuildForRelease: true
109123
SuppressMinGWLib: true
110124
125+
- script: |
126+
%MSBUILD% Tools\msi\bundle\releaselocal.wixproj /t:Rebuild /p:RebuildAll=true
127+
displayName: 'Build arm64 installer'
128+
condition: and(succeeded(), eq(variables['PublishARM64'], 'true'))
129+
env:
130+
Platform: ARM64
131+
Py_OutDir: $(Build.BinariesDirectory)
132+
PYTHON: $(Build.BinariesDirectory)\win32\python.exe
133+
PythonForBuild: $(Build.BinariesDirectory)\win32\python.exe
134+
PYTHONHOME: $(Build.SourcesDirectory)
135+
BuildForRelease: true
136+
SuppressMinGWLib: true
137+
111138
- task: CopyFiles@2
112-
displayName: 'Assemble artifact: msi (1/2)'
139+
displayName: 'Assemble artifact: msi (win32)'
113140
inputs:
114141
sourceFolder: $(Build.BinariesDirectory)\win32\en-us
115142
targetFolder: $(Build.ArtifactStagingDirectory)\msi\win32
@@ -119,7 +146,7 @@ steps:
119146
*.exe
120147
121148
- task: CopyFiles@2
122-
displayName: 'Assemble artifact: msi (2/2)'
149+
displayName: 'Assemble artifact: msi (amd64)'
123150
inputs:
124151
sourceFolder: $(Build.BinariesDirectory)\amd64\en-us
125152
targetFolder: $(Build.ArtifactStagingDirectory)\msi\amd64
@@ -128,6 +155,17 @@ steps:
128155
*.cab
129156
*.exe
130157
158+
- task: CopyFiles@2
159+
displayName: 'Assemble artifact: msi (arm64)'
160+
condition: and(succeeded(), eq(variables['PublishARM64'], 'true'))
161+
inputs:
162+
sourceFolder: $(Build.BinariesDirectory)\arm64\en-us
163+
targetFolder: $(Build.ArtifactStagingDirectory)\msi\arm64
164+
contents: |
165+
*.msi
166+
*.cab
167+
*.exe
168+
131169
- task: PublishPipelineArtifact@0
132170
displayName: 'Publish MSI'
133171
inputs:

.azure-pipelines/windows-release/stage-publish-nugetorg.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ jobs:
3636

3737

3838
- powershell: 'gci pythonarm*.nupkg | %{ Write-Host "Not publishing: $($_.Name)"; gi $_ } | del'
39-
displayName: 'Prevent publishing ARM/ARM64 packages'
39+
displayName: 'Prevent publishing ARM64 packages'
4040
workingDirectory: '$(Build.BinariesDirectory)\nuget'
41-
condition: and(succeeded(), not(variables['PublishArmPackages']))
41+
condition: and(succeeded(), eq(variables['PublishARM64'], 'true'))
4242

4343
- task: NuGetCommand@2
4444
displayName: Push packages

.azure-pipelines/windows-release/stage-publish-pythonorg.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,11 @@ jobs:
7777
downloadPath: $(Build.BinariesDirectory)
7878

7979

80+
# Note that ARM64 MSIs are skipped at build when this option is specified
8081
- powershell: 'gci *embed-arm*.zip | %{ Write-Host "Not publishing: $($_.Name)"; gi $_ } | del'
81-
displayName: 'Prevent publishing ARM/ARM64 packages'
82+
displayName: 'Prevent publishing ARM64 packages'
8283
workingDirectory: '$(Build.BinariesDirectory)\embed'
83-
condition: and(succeeded(), not(variables['PublishArmPackages']))
84+
condition: and(succeeded(), eq(variables['PublishARM64'], 'true'))
8485

8586

8687
- template: ./gpg-sign.yml

.azure-pipelines/windows-release/stage-test-msi.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@ jobs:
1111
strategy:
1212
matrix:
1313
win32_User:
14-
ExeMatch: 'python-[\dabrc.]+-webinstall\.exe'
10000
14+
ExeMatch: 'python-[\dabrc.]+\.exe'
1515
Logs: $(Build.ArtifactStagingDirectory)\logs\win32_User
1616
InstallAllUsers: 0
1717
win32_Machine:
18-
ExeMatch: 'python-[\dabrc.]+-webinstall\.exe'
18+
ExeMatch: 'python-[\dabrc.]+\.exe'
1919
Logs: $(Build.ArtifactStagingDirectory)\logs\win32_Machine
2020
InstallAllUsers: 1
2121
amd64_User:
22-
ExeMatch: 'python-[\dabrc.]+-amd64-webinstall\.exe'
22+
ExeMatch: 'python-[\dabrc.]+-amd64\.exe'
2323
Logs: $(Build.ArtifactStagingDirectory)\logs\amd64_User
2424
InstallAllUsers: 0
2525
amd64_Machine:
26-
ExeMatch: 'python-[\dabrc.]+-amd64-webinstall\.exe'
26+
ExeMatch: 'python-[\dabrc.]+-amd64\.exe'
2727
Logs: $(Build.ArtifactStagingDirectory)\logs\amd64_Machine
2828
InstallAllUsers: 1
2929

.github/workflows/build_msi.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,11 @@ jobs:
3737
- uses: actions/checkout@v2
3838
- name: Build CPython installer
3939
run: .\Tools\msi\build.bat -x64
40+
41+
build_win_arm64:
42+
name: 'Windows (ARM64) Installer'
43+
runs-on: windows-latest
44+
steps:
45+
- uses: actions/checkout@v2
46+
- name: Build CPython installer
47+
run: .\Tools\msi\build.bat -arm64
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
The traditional EXE/MSI based installer for Windows is now available for
2+
ARM64

PCbuild/openssl.props

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,22 @@
1313
<_DLLSuffix>-1_1</_DLLSuffix>
1414
<_DLLSuffix Condition="$(Platform) == 'ARM'">$(_DLLSuffix)-arm</_DLLSuffix>
1515
<_DLLSuffix Condition="$(Platform) == 'ARM64'">$(_DLLSuffix)-arm64</_DLLSuffix>
16+
<OpenSSLDLLSuffix>$(_DLLSuffix)</OpenSSLDLLSuffix>
1617
</PropertyGroup>
1718
<ItemGroup>
1819
<_SSLDLL Include="$(opensslOutDir)\libcrypto$(_DLLSuffix).dll" />
1920
<_SSLDLL Include="$(opensslOutDir)\libcrypto$(_DLLSuffix).pdb" />
2021
<_SSLDLL Include="$(opensslOutDir)\libssl$(_DLLSuffix).dll" />
2122
<_SSLDLL Include="$(opensslOutDir)\libssl$(_DLLSuffix).pdb" />
2223
</ItemGroup>
23-
<Target Name="_CopySSLDLL" Inputs="@(_SSLDLL)" Outputs="@(_SSLDLL->'$(OutDir)%(Filename)%(Extension)')" AfterTargets="Build">
24+
<Target Name="_CopySSLDLL"
25+
Inputs="@(_SSLDLL)"
26+
Outputs="@(_SSLDLL->'$(OutDir)%(Filename)%(Extension)')"
27+
Condition="$(SkipCopySSLDLL) == ''"
28+
AfterTargets="Build">
2429
<Copy SourceFiles="@(_SSLDLL)" DestinationFolder="$(OutDir)" />
2530
</Target>
26-
<Target Name="_CleanSSLDLL" BeforeTargets="Clean">
31+
<Target Name="_CleanSSLDLL" Condition="$(SkipCopySSLDLL) == ''" BeforeTargets="Clean">
2732
<Delete Files="@(_SSLDLL->'$(OutDir)%(Filename)%(Extension)')" TreatErrorsAsWarnings="true" />
2833
</Target>
2934
</Project>

PCbuild/tcltk.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
<tcltkLib>$(tcltkDir)lib\tcl$(TclMajorVersion)$(TclMinorVersion)t$(TclDebugExt).lib;$(tcltkDir)lib\tk$(TkMajorVersion)$(TkMinorVersion)t$(TclDebugExt).lib</tcltkLib>
3030
<TclMachine>IX86</TclMachine>
3131
<TclMachine Condition="'$(Platform)' == 'x64'">AMD64</TclMachine>
32+
<TclMachine Condition="'$(Platform)' == 'ARM64'">ARM64</TclMachine>
3233
<TclVersions>TCL_MAJOR_VERSION=$(TclMajorVersion) TCL_MINOR_VERSION=$(TclMinorVersion) TCL_PATCH_LEVEL=$(TclPatchLevel)</TclVersions>
3334
<TclShortVersions>TCL_MAJOR=$(TclMajorVersion) TCL_MINOR=$(TclMinorVersion) TCL_PATCH=$(TclPatchLevel)</TclShortVersions>
3435
<TkVersions>TK_MAJOR_VERSION=$(TkMajorVersion) TK_MINOR_VERSION=$(TkMinorVersion) TK_PATCH_LEVEL=$(TkPatchLevel)</TkVersions>

Tools/msi/appendpath/appendpath.wxs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
33
<Product Id="*" Language="!(loc.LCID)" Name="!(loc.Title)" Version="$(var.Version)" Manufacturer="!(loc.Manufacturer)" UpgradeCode="$(var.UpgradeCode)">
4-
<Package InstallerVersion="300" Compressed="yes" InstallScope="perUser" Platform="$(var.Platform)" />
4+
<Package InstallerVersion="500" Compressed="yes" InstallScope="perUser" />
55

66
<PropertyRef Id="UpgradeTable" />
77
<PropertyRef Id="REGISTRYKEY" />

Tools/msi/build.bat

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ set PCBUILD=%D%..\..\PCbuild\
55

66
set BUILDX86=
77
set BUILDX64=
8+
set BUILDARM64=
89
set BUILDDOC=
910
set BUILDTEST=
1011
set BUILDPACK=
@@ -14,22 +15,23 @@ set REBUILD=
1415
if "%~1" EQU "-h" goto Help
1516
if "%~1" EQU "-x86" (set BUILDX86=1) && shift && goto CheckOpts
1617
if "%~1" EQU "-x64" (set BUILDX64=1) && shift && goto CheckOpts
18+
if "%~1" EQU "-arm64" (set BUILDARM64=1) & 17AE & shift && goto CheckOpts
1719
if "%~1" EQU "--doc" (set BUILDDOC=1) && shift && goto CheckOpts
1820
if "%~1" EQU "--no-test-marker" (set BUILDTEST=) && shift && goto CheckOpts
1921
if "%~1" EQU "--test-marker" (set BUILDTEST=--test-marker) && shift && goto CheckOpts
2022
if "%~1" EQU "--pack" (set BUILDPACK=1) && shift && goto CheckOpts
2123
if "%~1" EQU "-r" (set REBUILD=-r) && shift && goto CheckOpts
2224

23-
if not defined BUILDX86 if not defined BUILDX64 (set BUILDX86=1) && (set BUILDX64=1)
25+
if not defined BUILDX86 if not defined BUILDX64 if not defined BUILDARM64 (set BUILDX86=1) && (set BUILDX64=1)
2426

2527
call "%D%get_externals.bat"
2628
call "%PCBUILD%find_msbuild.bat" %MSBUILD%
2729
if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & exit /b 2)
2830

2931
if defined BUILDX86 (
30-
call "%PCBUILD%build.bat" -d -e %REBUILD% %BUILDTEST%
32+
call "%PCBUILD%build.bat" -p Win32 -d -e %REBUILD% %BUILDTEST%
3133
if errorlevel 1 goto :eof
32-
call "%PCBUILD%build.bat" -e %REBUILD% %BUILDTEST%
34+
call "%PCBUILD%build.bat" -p Win32 -e %REBUILD% %BUILDTEST%
3335
if errorlevel 1 goto :eof
3436
)
3537
if defined BUILDX64 (
@@ -38,6 +40,12 @@ if defined BUILDX64 (
3840
call "%PCBUILD%build.bat" -p x64 -e %REBUILD% %BUILDTEST%
3941
if errorlevel 1 goto :eof
4042
)
43+
if defined BUILDARM64 (
44+
call "%PCBUILD%build.bat" -p ARM64 -d -e %REBUILD% %BUILDTEST%
45+
if errorlevel 1 goto :eof
46+
call "%PCBUILD%build.bat" -p ARM64 -e %REBUILD% %BUILDTEST%
47+
if errorlevel 1 goto :eof
48+
)
4149

4250
if defined BUILDDOC (
4351
call "%PCBUILD%..\Doc\make.bat" htmlhelp
@@ -59,21 +67,26 @@ if defined REBUILD (
5967
)
6068

6169
if defined BUILDX86 (
62-
%MSBUILD% %BUILD_CMD%
70+
%MSBUILD% /p:Platform=x86 %BUILD_CMD%
6371
if errorlevel 1 goto :eof
6472
)
6573
if defined BUILDX64 (
6674
%MSBUILD% /p:Platform=x64 %BUILD_CMD%
6775
if errorlevel 1 goto :eof
6876
)
77+
if defined BUILDARM64 (
78+
%MSBUILD% /p:Platform=ARM64 %BUILD_CMD%
79+
if errorlevel 1 goto :eof
80+
)
6981

7082
exit /B 0
7183

7284
:Help
73-
echo build.bat [-x86] [-x64] [--doc] [-h] [--test-marker] [--pack] [-r]
85+
echo build.bat [-x86] [-x64] [-arm64] [--doc] [-h] [--test-marker] [--pack] [-r]
7486
echo.
7587
echo -x86 Build x86 installers
7688
echo -x64 Build x64 installers
89+
echo -ARM64 Build ARM64 installers
7790
echo --doc Build CHM documentation
7891
echo --test-marker Build with test markers
7992
echo --no-test-marker Build without test markers (default)

0 commit comments

Comments
 (0)
0