@@ -18,9 +18,9 @@ const msys2BasePath = 'C:\\msys64'
1818// needed for 2.0-2.3, and mswin, cert file used by Git for Windows
1919const certFile = 'C:\\Program Files\\Git\\mingw64\\ssl\\cert.pem'
2020
21- // location & path for old RubyInstaller DevKit (MSYS ), Ruby 2.0-2.3
22- const msys = `${ drive } :\\DevKit64`
23- const msysPathEntries = [ `${ msys } \\mingw\\x86_64-w64-mingw32\\bin` , `${ msys } \\mingw\\bin` , `${ msys } \\bin` ]
21+ // location & path for old RubyInstaller DevKit (MSYS1 ), Ruby 2.0-2.3
22+ const msys1 = `${ drive } :\\DevKit64`
23+ const msysPathEntries = [ `${ msys1 } \\mingw\\x86_64-w64-mingw32\\bin` , `${ msys1 } \\mingw\\bin` , `${ msys1 } \\bin` ]
2424
2525const virtualEnv = common . getVirtualEnvironmentName ( )
2626
@@ -62,7 +62,7 @@ export async function install(platform, engine, version) {
6262 await downloadAndExtract ( engine , version , url , base , rubyPrefix ) ;
6363 }
6464
65- const winMSYS2Type = common . setupPath ( [ `${ rubyPrefix } \\bin` , ...toolchainPaths ] )
65+ const msys2Type = common . setupPath ( [ `${ rubyPrefix } \\bin` , ...toolchainPaths ] )
6666
6767 // install msys2 tools for all Ruby versions, only install mingw or ucrt for Rubies >= 2.4
6868
@@ -72,9 +72,8 @@ export async function install(platform, engine, version) {
7272
7373 // windows 2016 and 2019 need ucrt64 installed, 2022 and future images need
7474 // ucrt64 or mingw64 installed, depending on Ruby version
75- if ( ( ( winMSYS2Type === 'ucrt64' ) || ! hasMSYS2PreInstalled ) &&
76- ( common . floatVersion ( version ) >= 2.4 ) ) {
77- await installGCCTools ( winMSYS2Type )
75+ if ( ( ( msys2Type === 'ucrt64' ) || ! hasMSYS2PreInstalled ) && common . floatVersion ( version ) >= 2.4 ) {
76+ await installGCCTools ( msys2Type )
7877 }
7978
8079 const ridk = `${ rubyPrefix } \\bin\\ridk.cmd`
@@ -148,28 +147,29 @@ async function downloadAndExtract(engine, version, url, base, rubyPrefix) {
148147async function setupMingw ( version ) {
149148 core . exportVariable ( 'MAKE' , 'make.exe' )
150149
151- // rename these to avoid confusion when Ruby is using OpenSSL 1.0.2
152- // most current extconf files look for 1.1.x dll files first, which is the
153- // version of the renamed files
154- if ( common . floatVersion ( version ) <= 2.4 ) { renameSystem32Dlls ( ) }
150+ // rename these to avoid confusion when Ruby is using OpenSSL 1.0.2.
151+ // most current extconf files look for 1.1.x dll files first, which is the version of the renamed files
152+ if ( common . floatVersion ( version ) <= 2.4 ) {
153+ renameSystem32Dlls ( )
154+ }
155155
156156 if ( common . floatVersion ( version ) <= 2.3 ) {
157157 core . exportVariable ( 'SSL_CERT_FILE' , certFile )
158- await common . measure ( 'Installing MSYS ' , async ( ) => installMSYS ( version ) )
158+ await common . measure ( 'Installing MSYS1 ' , async ( ) => installMSYS1 ( version ) )
159159 return msysPathEntries
160160 } else {
161161 return [ ]
162162 }
163163}
164164
165- // Ruby 2.0, 2.1, 2.2 and 2.3
166- async function installMSYS ( version ) {
165+ // Ruby 2.0- 2.3
166+ async function installMSYS1 ( version ) {
167167 const url = 'https://github.com/oneclick/rubyinstaller/releases/download/devkit-4.7.2/DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe'
168168 const downloadPath = await tc . downloadTool ( url )
169- await exec . exec ( '7z' , [ 'x' , downloadPath , `-o${ msys } ` ] , { silent : true } )
169+ await exec . exec ( '7z' , [ 'x' , downloadPath , `-o${ msys1 } ` ] , { silent : true } )
170170
171171 // below are set in the old devkit.rb file ?
172- core . exportVariable ( 'RI_DEVKIT' , msys )
172+ core . exportVariable ( 'RI_DEVKIT' , msys1 )
173173 core . exportVariable ( 'CC' , 'gcc' )
174174 core . exportVariable ( 'CXX' , 'g++' )
175175 core . exportVariable ( 'CPP' , 'cpp' )
@@ -238,27 +238,24 @@ export function addVCVARSEnv() {
238238 return newPathEntries
239239}
240240
241- // ssl files cause issues with non RI2 Rubies (<2.4) and ruby/ruby's CI from
242- // build folder due to dll resolution
241+ // ssl files cause issues with non RI2 Rubies (<2.4) and ruby/ruby's CI from build folder due to dll resolution
243242function renameSystem32Dlls ( ) {
244243 const sys32 = 'C:\\Windows\\System32\\'
245- const badFiles = [ 'libcrypto-1_1-x64.dll' , 'libssl-1_1-x64.dll' ]
246- badFiles . forEach ( ( bad ) => {
247- let fn = `${ sys32 } ${ bad } `
248- if ( fs . existsSync ( fn ) ) { fs . renameSync ( fn , `${ fn } _` ) }
249- } )
244+ const badFiles = [ `${ sys32 } libcrypto-1_1-x64.dll` , `${ sys32 } libssl-1_1-x64.dll` ]
245+ const existing = badFiles . map ( ( dll ) => fs . existsSync ( dll ) )
246+ console . log ( `Renaming ${ existing . join ( ' and ' ) } to avoid dll resolution conflicts on Ruby <= 2.4` )
247+ existing . forEach ( dll => fs . renameSync ( dll , `${ dll } _` ) )
250248}
251249
252250// Sets MSYS2 ENV variables set from running `ridk enable`
253- //
254251function addRidkEnv ( ridk ) {
255252 let newEnv = new Map ( )
256253 let cmd = `cmd.exe /c "${ ridk } enable && set"`
257254 let newSet = cp . execSync ( cmd ) . toString ( ) . trim ( ) . split ( / \r ? \n / )
258255 newSet = newSet . filter ( line => / ^ \S + = \S + / . test ( line ) )
259256 newSet . forEach ( s => {
260- let [ k , v ] = common . partition ( s , '=' )
261- newEnv . set ( k , v )
257+ let [ k , v ] = common . partition ( s , '=' )
258+ newEnv . set ( k , v )
262259 } )
263260
264261 for ( let [ k , v ] of newEnv ) {
0 commit comments