11// 7z arguments
22// -aoa overwrite existing, -bd disable progress indicator
33
4+ // OpenSSL version detection is needed in installGCCTools and installJRubyTools
5+
46const fs = require ( 'fs' )
57const path = require ( 'path' )
68const cp = require ( 'child_process' )
@@ -80,7 +82,7 @@ export async function install(platform, engine, version) {
8082 // windows 2016 and 2019 need ucrt64 installed, 2022 and future images need
8183 // ucrt64 or mingw64 installed, depending on Ruby version
8284 if ( ( ( msys2Type === 'ucrt64' ) || ! hasMSYS2PreInstalled ) && common . floatVersion ( version ) >= 2.4 ) {
83- await installGCCTools ( msys2Type )
85+ await installGCCTools ( msys2Type , version )
8486 }
8587
8688 if ( version === 'mswin' ) {
@@ -97,14 +99,23 @@ export async function install(platform, engine, version) {
9799
98100// Actions windows-2022 image does not contain any mingw or ucrt build tools. Install tools for it,
99101// and also install ucrt tools on earlier versions, which have msys2 and mingw tools preinstalled.
100- async function installGCCTools ( type ) {
101- const downloadPath = await common . measure ( `Downloading ${ type } build tools` , async ( ) => {
102- let url = `${ msys2GCCReleaseURI } /msys2-gcc-pkgs/${ type } .7z`
102+ async function installGCCTools ( type , version ) {
103+ // 2022-Dec ruby/msys2-gcc-pkgs now uses a suffix to delineate different archive versions.
104+ // At present, the only use is to indicate the included OpenSSL version.
105+ // With no suffix, archives include OpenSSL 1.1.1, with a '-3.0' suffix, they include
106+ // OpenSSL 3.0.x.
107+ // Currently, OpenSSL 3 is used in Ruby 3.2 & 'head', both use a custom RubyInstaller2 package.
108+ let suffix = ''
109+ if ( ( version === 'head' ) || ( ! common . isHeadVersion ( version ) && common . floatVersion ( version ) >= 3.2 ) ) {
110+ suffix = '-3.0'
111+ }
112+ const downloadPath = await common . measure ( `Downloading ${ type } ${ suffix } build tools` , async ( ) => {
113+ let url = `${ msys2GCCReleaseURI } /msys2-gcc-pkgs/${ type } ${ suffix } .7z`
103114 console . log ( url )
104115 return await tc . downloadTool ( url )
105116 } )
106117
107- await common . measure ( `Extracting ${ type } build tools` , async ( ) =>
118+ await common . measure ( `Extracting ${ type } ${ suffix } build tools` , async ( ) =>
108119 exec . exec ( '7z' , [ 'x' , downloadPath , '-aoa' , '-bd' , `-o${ msys2BasePath } ` ] , { silent : true } ) )
109120}
110121
@@ -129,7 +140,8 @@ async function installMSYS2Tools() {
129140// windows-2022 and later images
130141export async function installJRubyTools ( ) {
131142 await installMSYS2Tools ( )
132- await installGCCTools ( 'mingw64' )
143+ // Will need to add OpenSSL version detection when JRuby uses OpenSSL 3.0 ?
144+ await installGCCTools ( 'mingw64' , '2.7' )
133145}
134146
135147// Install vcpkg files needed to build mswin Ruby
0 commit comments