Skip to content

Commit da7d99a

Browse files
authored
bpo-46567: Add Tcl/Tk build for Windows ARM64 (pythonGH-31574)
1 parent 424ecab commit da7d99a

16 files changed

+63
-24
lines changed

.azure-pipelines/tcltk-build.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ jobs:
6060
& "$(msbuild)" PCbuild\tix.vcxproj "@msbuild.rsp" /p:Platform=x64 /p:tcltkDir="$(OutDir)\amd64"
6161
displayName: 'Build for amd64'
6262
63+
- powershell: |
64+
& "$(msbuild)" PCbuild\tcl.vcxproj "@msbuild.rsp" /p:Platform=ARM64 /p:tcltkDir="$(OutDir)\arm64"
65+
& "$(msbuild)" PCbuild\tk.vcxproj "@msbuild.rsp" /p:Platform=ARM64 /p:tcltkDir="$(OutDir)\arm64"
66+
& "$(msbuild)" PCbuild\tix.vcxproj "@msbuild.rsp" /p:Platform=ARM64 /p:tcltkDir="$(OutDir)\arm64"
67+
displayName: 'Build for arm64'
68+
6369
- publish: '$(OutDir)'
6470
artifact: 'tcltk'
6571
displayName: 'Publishing tcltk'

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,13 @@ steps:
7171
artifactName: tcltk_lib_amd64
7272
targetPath: $(Build.BinariesDirectory)\tcltk_lib_amd64
7373

74+
- task: DownloadPipelineArtifact@1
75+
displayName: 'Download artifact: tcltk_lib_arm64'
76+
condition: and(succeeded(), eq(variables['PublishARM64'], 'true'))
77+
inputs:
78+
artifactName: tcltk_lib_arm64
79+
targetPath: $(Build.BinariesDirectory)\tcltk_lib_arm64
80+
7481
- powershell: |
7582
copy $(Build.BinariesDirectory)\amd64\Activate.ps1 Lib\venv\scripts\common\Activate.ps1 -Force
7683
displayName: 'Copy signed files into sources'
@@ -107,7 +114,6 @@ steps:
107114
PYTHONHOME: $(Build.SourcesDirectory)
108115
TclTkLibraryDir: $(Build.BinariesDirectory)\tcltk_lib_win32
109116
BuildForRelease: true
110-
SuppressMinGWLib: true
111117
112118
- script: |
113119
%MSBUILD% Tools\msi\bundle\releaselocal.wixproj /t:Rebuild /p:RebuildAll=true
@@ -120,7 +126,6 @@ steps:
120126
PYTHONHOME: $(Build.SourcesDirectory)
121127
TclTkLibraryDir: $(Build.BinariesDirectory)\tcltk_lib_amd64
122128
BuildForRelease: true
123-
SuppressMinGWLib: true
124129
125130
- script: |
126131
%MSBUILD% Tools\msi\bundle\releaselocal.wixproj /t:Rebuild /p:RebuildAll=true
@@ -132,8 +137,8 @@ steps:
132137
PYTHON: $(Build.BinariesDirectory)\win32\python.exe
133138
PythonForBuild: $(Build.BinariesDirectory)\win32\python.exe
134139
PYTHONHOME: $(Build.SourcesDirectory)
140+
TclTkLibraryDir: $(Build.BinariesDirectory)\tcltk_lib_arm64
135141
BuildForRelease: true
136-
SuppressMinGWLib: true
137142
138143
- task: CopyFiles@2
139144
displayName: 'Assemble artifact: msi (win32)'

.azure-pipelines/windows-release/stage-build.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,13 @@ jobs:
166166
platform: x64
167167
msbuildArguments: /t:CopyTclTkLib /p:OutDir="$(Build.ArtifactStagingDirectory)\tcl_amd64"
168168

169+
- task: MSBuild@1
170+
displayName: 'Copy Tcl/Tk lib for publish'
171+
inputs:
172+
solution: PCbuild\tcltk.props
173+
platform: ARM64
174+
msbuildArguments: /t:CopyTclTkLib /p:OutDir="$(Build.ArtifactStagingDirectory)\tcl_arm64"
175+
169176
- task: PublishPipelineArtifact@0
170177
displayName: 'Publish artifact: tcltk_lib_win32'
171178
inputs:
@@ -177,3 +184,9 @@ jobs:
177184
inputs:
178185
targetPath: '$(Build.ArtifactStagingDirectory)\tcl_amd64'
179186
artifactName: tcltk_lib_amd64
187+
188+
- task: PublishPipelineArtifact@0
189+
displayName: 'Publish artifact: tcltk_lib_arm64'
190+
inputs:
191+
targetPath: '$(Build.ArtifactStagingDirectory)\tcl_arm64'
192+
artifactName: tcltk_lib_arm64

.azure-pipelines/windows-release/stage-layout-full.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ jobs:
2626
HostArch: amd64
2727
Python: $(Build.BinariesDirectory)\bin_amd64\python.exe
2828
PYTHONHOME: $(Build.SourcesDirectory)
29+
TclLibrary: $(Build.BinariesDirectory)\tcltk_lib\tcl8
2930

3031
steps:
3132
- template: ./checkout.yml

.azure-pipelines/windows-release/stage-layout-msix.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ jobs:
2525
HostArch: amd64
2626
Python: $(Build.BinariesDirectory)\bin_amd64\python.exe
2727
PYTHONHOME: $(Build.SourcesDirectory)
28+
TclLibrary: $(Build.BinariesDirectory)\tcltk_lib\tcl8
2829

2930
steps:
3031
- template: ./checkout.yml
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Adds Tcl and Tk support for Windows ARM64. This also adds IDLE to the
2+
installation.

PCbuild/get_externals.bat

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ set libraries=%libraries% bzip2-1.0.6
5555
if NOT "%IncludeLibffiSrc%"=="false" set libraries=%libraries% libffi-3.4.2
5656
if NOT "%IncludeSSLSrc%"=="false" set libraries=%libraries% openssl-1.1.1m
5757
set libraries=%libraries% sqlite-3.37.2.0
58-
if NOT "%IncludeTkinterSrc%"=="false" set libraries=%libraries% tcl-core-8.6.12.0
59-
if NOT "%IncludeTkinterSrc%"=="false" set libraries=%libraries% tk-8.6.12.0
58+
if NOT "%IncludeTkinterSrc%"=="false" set libraries=%libraries% tcl-core-8.6.12.1
59+
if NOT "%IncludeTkinterSrc%"=="false" set libraries=%libraries% tk-8.6.12.1
6060
if NOT "%IncludeTkinterSrc%"=="false" set libraries=%libraries% tix-8.4.3.6
6161
set libraries=%libraries% xz-5.2.2
6262
set libraries=%libraries% zlib-1.2.11
@@ -78,7 +78,7 @@ echo.Fetching external binaries...
7878
set binaries=
7979
if NOT "%IncludeLibffi%"=="false" set binaries=%binaries% libffi-3.4.2
8080
if NOT "%IncludeSSL%"=="false" set binaries=%binaries% openssl-bin-1.1.1m
81-
if NOT "%IncludeTkinter%"=="false" set binaries=%binaries% tcltk-8.6.12.0
81+
if NOT "%IncludeTkinter%"=="false" set binaries=%binaries% tcltk-8.6.12.1
8282
if NOT "%IncludeSSLSrc%"=="false" set binaries=%binaries% nasm-2.11.06
8383

8484
for %%b in (%binaries%) do (

PCbuild/pcbuild.proj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
<!-- _ssl will build _socket as well, which may cause conflicts in parallel builds -->
7474
<ExtensionModules Include="_socket" Condition="!$(IncludeSSL) or !$(IncludeExternals)" />
7575
<ExternalModules Include="_ssl;_hashlib" Condition="$(IncludeSSL)" />
76-
<ExternalModules Include="_tkinter" Condition="$(IncludeTkinter) and $(Platform) != 'ARM' and $(Platform) != 'ARM64'" />
76+
<ExternalModules Include="_tkinter" Condition="$(IncludeTkinter)" />
7777
<ExtensionModules Include="@(ExternalModules->'%(Identity)')" Condition="$(IncludeExternals)" />
7878
<Projects Include="@(ExtensionModules->'%(Identity).vcxproj')" Condition="$(IncludeExtensions)" />
7979
<!-- Test modules -->

PCbuild/prepare_tcltk.bat

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,7 @@ call "%PCBUILD%\get_externals.bat" --tkinter-src %ORG_SETTING%
5353
%MSBUILD% "%PCBUILD%\tcl.vcxproj" /p:Configuration=Release /p:Platform=x64
5454
%MSBUILD% "%PCBUILD%\tk.vcxproj" /p:Configuration=Release /p:Platform=x64
5555
%MSBUILD% "%PCBUILD%\tix.vcxproj" /p:Configuration=Release /p:Platform=x64
56+
57+
%MSBUILD% "%PCBUILD%\tcl.vcxproj" /p:Configuration=Release /p:Platform=ARM64
58+
%MSBUILD% "%PCBUILD%\tk.vcxproj" /p:Configuration=Release /p:Platform=ARM64
59+
%MSBUILD% "%PCBUILD%\tix.vcxproj" /p:Configuration=Release /p:Platform=ARM64

PCbuild/tcl.vcxproj

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
<Configuration>Release</Configuration>
3434
<Platform>x64</Platform>
3535
</ProjectConfiguration>
36+
<ProjectConfiguration Include="Release|ARM64">
37+
<Configuration>Release</Configuration>
38+
<Platform>ARM64</Platform>
39+
</ProjectConfiguration>
3640
</ItemGroup>
3741
<PropertyGroup Label="Globals">
3842
<ProjectGuid>{B5FD6F1D-129E-4BFF-9340-03606FAC7283}</ProjectGuid>
@@ -59,8 +63,8 @@
5963
<NMakeBuildCommandLine>setlocal
6064
set VCINSTALLDIR=$(VCInstallDir)
6165
cd /D "$(tclDir)win"
62-
nmake -f makefile.vc MACHINE=$(TclMachine) OPTS=$(TclOpts) $(TclDirs) $(DebugFlags) $(WarningsFlags) core shell dlls
63-
nmake -f makefile.vc MACHINE=$(TclMachine) OPTS=$(TclOpts) $(TclDirs) $(DebugFlags) $(WarningsFlags) install-binaries install-libraries
66+
nmake -f makefile.vc MACHINE=$(TclMachine) OPTS=$(TclOpts) $(TclDirs) $(DebugFlags) $(WarningsFlags) TCLSH_NATIVE="$(tclWin32Exe)" core shell dlls
67+
nmake -f makefile.vc MACHINE=$(TclMachine) OPTS=$(TclOpts) $(TclDirs) $(DebugFlags) $(WarningsFlags) TCLSH_NATIVE="$(tclWin32Exe)" install-binaries install-libraries
6468
copy /Y ..\license.terms "$(OutDir)\tcllicense.terms"
6569
</NMakeBuildCommandLine>
6670
</PropertyGroup>

PCbuild/tcltk.props

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<TclMajorVersion>8</TclMajorVersion>
66
<TclMinorVersion>6</TclMinorVersion>
77
<TclPatchLevel>12</TclPatchLevel>
8-
<TclRevision>0</TclRevision>
8+
<TclRevision>1</TclRevision>
99
<TkMajorVersion>$(TclMajorVersion)</TkMajorVersion>
1010
<TkMinorVersion>$(TclMinorVersion)</TkMinorVersion>
1111
<TkPatchLevel>$(TclPatchLevel)</TkPatchLevel>
@@ -18,6 +18,9 @@
1818
<tkDir>$(ExternalsDir)tk-$(TkMajorVersion).$(TkMinorVersion).$(TkPatchLevel).$(TkRevision)\</tkDir>
1919
<tixDir>$(ExternalsDir)tix-$(TixMajorVersion).$(TixMinorVersion).$(TixPatchLevel).$(TixRevision)\</tixDir>
2020
<tcltkDir>$(ExternalsDir)tcltk-$(TclMajorVersion).$(TclMinorVersion).$(TclPatchLevel).$(TclRevision)\$(ArchName)\</tcltkDir>
21+
<tclWin32Exe Condition="$(Platform) == 'Win32'">$(tcltkDir)\bin\tclsh$(TclMajorVersion)$(TclMinorVersion)t.exe</tclWin32Exe>
22+
<tclWin32Exe Condition="$(Platform) != 'Win32'">$(tcltkDir)\..\win32\bin\tclsh$(TclMajorVersion)$(TclMinorVersion)t.exe</tclWin32Exe>
23+
2124
<!--<TclDebugExt Condition="'$(Configuration)' == 'Debug'">g</TclDebugExt>-->
2225
<tclDLLName>tcl$(TclMajorVersion)$(TclMinorVersion)t$(TclDebugExt).dll</tclDLLName>
2326
<tclLibName>tcl$(TclMajorVersion)$(TclMinorVersion)t$(TclDebugExt).lib</tclLibName>

PCbuild/tix.vcxproj

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
<Configuration>Release</Configuration>
3434
<Platform>x64</Platform>
3535
</ProjectConfiguration>
36+
<ProjectConfiguration Include="Release|ARM64">
37+
<Configuration>Release</Configuration>
38+
<Platform>ARM64</Platform>
39+
</ProjectConfiguration>
3640
</ItemGroup>
3741
<PropertyGroup Label="Globals">
3842
<ProjectGuid>{C5A3E7FB-9695-4B2E-960B-1D9F43F1E555}</ProjectGuid>
@@ -53,7 +57,7 @@
5357
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
5458

5559
<PropertyGroup>
56-
<TixDirs>BUILDDIRTOP="$(BuildDirTop)" TCL_DIR="$(tclDir.TrimEnd(`\`))" TK_DIR="$(tkDir.TrimEnd(`\`))" INSTALL_DIR="$(OutDir.TrimEnd(`\`))"</TixDirs>
60+
<TixDirs>BUILDDIRTOP="$(BuildDirTop)" TCL_DIR="$(tclDir.TrimEnd(`\`))" TK_DIR="$(tkDir.TrimEnd(`\`))" INSTALL_DIR="$(OutDir.TrimEnd(`\`))" TCLSH_EXE="$(tclWin32Exe)"</TixDirs>
5761
<DebugFlags Condition="'$(Configuration)' == 'Debug'">DEBUG=1 NODEBUG=0 TCL_DBGX=g TK_DBGX=g</DebugFlags>
5862
<DebugFlags Condition="'$(Configuration)' != 'Debug'">DEBUG=0 NODEBUG=1</DebugFlags>
5963
<CFlags>-c -W3 -nologo -MD -wd4028 -wd4090 -wd4244 -wd4267 -wd4312</CFlags>

PCbuild/tk.vcxproj

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@
3232
<ProjectConfiguration Include="Release|x64">
3333
<Configuration>Release</Configuration>
3434
<Platform>x64</Platform>
35+
</ProjectConfiguration>
36+
<ProjectConfiguration Include="Release|ARM64">
37+
<Configuration>Release</Configuration>
38+
<Platform>ARM64</Platform>
3539
</ProjectConfiguration>
3640
</ItemGroup>
3741
<PropertyGroup Label="Globals">
@@ -60,8 +64,8 @@
6064
<NMakeBuildCommandLine>setlocal
6165
set VCINSTALLDIR=$(VCInstallDir)
6266
cd /D "$(tkDir)win"
63-
nmake /nologo -f makefile.vc RC=rc MACHINE=$(TclMachine) OPTS=$(TkOpts) $(TkDirs) $(DebugFlags) $(WarningsFlags) all
64-
nmake /nologo -f makefile.vc RC=rc MACHINE=$(TclMachine) OPTS=$(TkOpts) $(TkDirs) $(DebugFlags) $(WarningsFlags) install-binaries install-libraries
67+
nmake /nologo -f makefile.vc RC=rc MACHINE=$(TclMachine) OPTS=$(TkOpts) $(TkDirs) $(DebugFlags) $(WarningsFlags) TCLSH_NATIVE="$(tclWin32Exe)" all
68+
nmake /nologo -f makefile.vc RC=rc MACHINE=$(TclMachine) OPTS=$(TkOpts) $(TkDirs) $(DebugFlags) $(WarningsFlags) TCLSH_NATIVE="$(tclWin32Exe)" install-binaries install-libraries
6569
copy /Y ..\license.terms "$(OutDir)\tklicense.terms"
6670
</NMakeBuildCommandLine>
6771
</PropertyGroup>

Tools/msi/bundle/Default.ARM64.xsl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,11 @@
1313
<xsl:template match="*[local-name()='String' and @Id='InstallButtonNote']">
1414
<String Id="InstallButtonNote">[TargetDir]
1515

16-
Includes pip and documentation
16+
Includes IDLE, pip and documentation
1717
Creates shortcuts but no file associations</String>
1818
</xsl:template>
1919

2020
<xsl:template match="*[local-name()='String' and @Id='Include_launcherHelp']">
2121
<String Id="Include_launcherHelp">(The 'py' launcher is currently unavailable on ARM64.)</String>
2222
</xsl:template>
23-
<xsl:template match="*[local-name()='String' and @Id='Include_tcltkHelpLabel']">
24-
<String Id="Include_tcltkHelpLabel">(tcl/tk and IDLE are currently unavailable on ARM64.)</String>
25-
</xsl:template>
2623
</xsl:stylesheet>

Tools/msi/bundle/bundle.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
<Package Include="..\path\path*.wixproj" />
7070
<Package Include="..\appendpath\appendpath*.wixproj" />
7171
<Package Include="..\pip\pip*.wixproj" />
72-
<Package Include="..\tcltk\tcltk*.wixproj" Condition="$(Platform) != 'ARM64'" />
72+
<Package Include="..\tcltk\tcltk*.wixproj" />
7373
<Package Include="..\test\test*.wixproj" />
7474
<Package Include="..\tools\tools*.wixproj" />
7575
<Package Include="..\ucrt\ucrt*.wixproj" Condition="$(Platform) != 'ARM64'" />

Tools/msi/bundle/bundle.wxs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,7 @@
7777
<Variable Name="Include_test" Value="1" bal:Overridable="yes" />
7878
<Variable Name="Include_doc" Value="1" bal:Overridable="yes" />
7979
<Variable Name="Include_tools" Value="1" bal:Overridable="yes" />
80-
<?if $(var.Platform)~="ARM64" ?>
81-
<Variable Name="Include_tcltk" Value="0" />
82-
<Variable Name="Include_tcltkState" Value="disable" />
83-
<?else ?>
8480
<Variable Name="Include_tcltk" Value="1" bal:Overridable="yes" />
85-
<?endif ?>
8681
<Variable Name="Include_pip" Value="1" bal:Overridable="yes" />
8782
<?if $(var.Platform)~="ARM64" ?>
8883
<Variable Name="Include_launcher" Value="0" bal:Overridable="yes" />
@@ -122,8 +117,8 @@
122117
<PackageGroupRef Id="test" />
123118
<PackageGroupRef Id="doc" />
124119
<PackageGroupRef Id="tools" />
125-
<?if $(var.Platform)!="ARM64" ?>
126120
<PackageGroupRef Id="tcltk" />
121+
<?if $(var.Platform)!="ARM64" ?>
127122
<PackageGroupRef Id="launcher" />
128123
<?endif ?>
129124
<PackageGroupRef Id="pip" />

0 commit comments

Comments
 (0)