From 476286a4e92e999906423acc96bda91672a8f787 Mon Sep 17 00:00:00 2001 From: david22swan Date: Wed, 24 Apr 2024 13:59:05 +0100 Subject: [PATCH 1/2] (CAT-1789) Add Windows 11 platform definition Required for the PDK to support Windows 11 To start with I have imitated the settings used with the windows server 2019. --- configs/platforms/windows-11-x86_64.rb | 53 ++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 configs/platforms/windows-11-x86_64.rb diff --git a/configs/platforms/windows-11-x86_64.rb b/configs/platforms/windows-11-x86_64.rb new file mode 100644 index 000000000..d8e7f7019 --- /dev/null +++ b/configs/platforms/windows-11-x86_64.rb @@ -0,0 +1,53 @@ +platform "windows-11-x86_64" do |plat| + plat.vmpooler_template "win-11-ent-x86_64" + + plat.servicetype "windows" + visual_studio_version = '2017' + visual_studio_sdk_version = 'win8.1' + + # We need to ensure we install chocolatey prior to adding any nuget repos. Otherwise, everything will fall over + plat.add_build_repository "https://artifactory.delivery.puppetlabs.net/artifactory/generic/buildsources/windows/chocolatey/install-chocolatey-1.4.0.ps1" + plat.add_build_repository "https://artifactory.delivery.puppetlabs.net/artifactory/api/nuget/nuget" + + # C:\tools is likely added by mingw, however because we also want to use that + # dir for vsdevcmd.bat we create it for safety + plat.provision_with "mkdir C:/tools" + # We don't want to install any packages from the chocolatey repo by accident + plat.provision_with "C:/ProgramData/chocolatey/bin/choco.exe sources remove -name chocolatey" + + packages = [ + "cmake", + "pl-gdbm-#{self._platform.architecture}", + "pl-iconv-#{self._platform.architecture}", + "pl-libffi-#{self._platform.architecture}", + "pl-pdcurses-#{self._platform.architecture}", + "pl-toolchain-#{self._platform.architecture}", + "pl-zlib-#{self._platform.architecture}", + "mingw-w64 -version 5.2.0 -debug", + "Wix310 -version 3.10.2 -debug -x86" + ] + + packages.each do |name| + plat.provision_with("C:/ProgramData/chocolatey/bin/choco.exe install -y --no-progress #{name}") + end + # We use cache-location in the following install because msvc has several long paths + # if we do not update the cache location choco will fail because paths get too long + plat.provision_with "C:/ProgramData/chocolatey/bin/choco.exe install msvc.#{visual_studio_version}-#{visual_studio_sdk_version}.sdk.en-us -y --cache-location=\"C:\\msvc\" --no-progress" + # The following creates a batch file that will execute the vsdevcmd batch file located within visual studio. + # We create the following batch file under C:\tools\vsdevcmd.bat so we can avoid using both the %ProgramFiles(x86)% + # evironment var, as well as any spaces in the path when executing things with cygwin. This makes command execution + # through cygwin much easier. + # + # Note that the unruly \'s in the following string escape the following sequence to literal chars: "\" and then \"" + plat.provision_with "touch C:/tools/vsdevcmd.bat && echo \"\\\"%ProgramFiles(x86)%\\Microsoft Visual Studio\\#{visual_studio_version}\\BuildTools\\Common7\\Tools\\vsdevcmd\\\"\" >> C:/tools/vsdevcmd.bat" + + plat.install_build_dependencies_with "C:/ProgramData/chocolatey/bin/choco.exe install -y --no-progress" + + plat.make "/usr/bin/make" + plat.patch "TMP=/var/tmp /usr/bin/patch.exe --binary" + + plat.platform_triple "x86_64-w64-mingw32" + + plat.package_type "archive" + plat.output_dir "windows" +end From 67223c57ed629fa42cfce67e6586ecb4a4e2a744 Mon Sep 17 00:00:00 2001 From: david22swan Date: Wed, 24 Apr 2024 14:37:33 +0100 Subject: [PATCH 2/2] (CAT-1789) Restrict architecture to x64 Due to how windows images are created this seems to be required. --- configs/platforms/{windows-11-x86_64.rb => windows-11-x64.rb} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename configs/platforms/{windows-11-x86_64.rb => windows-11-x64.rb} (98%) diff --git a/configs/platforms/windows-11-x86_64.rb b/configs/platforms/windows-11-x64.rb similarity index 98% rename from configs/platforms/windows-11-x86_64.rb rename to configs/platforms/windows-11-x64.rb index d8e7f7019..fc5caf1d5 100644 --- a/configs/platforms/windows-11-x86_64.rb +++ b/configs/platforms/windows-11-x64.rb @@ -1,4 +1,4 @@ -platform "windows-11-x86_64" do |plat| +platform "windows-11-x64" do |plat| plat.vmpooler_template "win-11-ent-x86_64" plat.servicetype "windows"