Skip to content

Commit

Permalink
Windows - updates for using OpenSSL 3 in Ruby 3.2 & head
Browse files Browse the repository at this point in the history
  • Loading branch information
MSP-Greg authored and eregon committed Dec 30, 2022
1 parent 8a6667e commit fe42d0e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 12 deletions.
24 changes: 18 additions & 6 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 18 additions & 6 deletions windows.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// 7z arguments
// -aoa overwrite existing, -bd disable progress indicator

// OpenSSL version detection is needed in installGCCTools and installJRubyTools

const fs = require('fs')
const path = require('path')
const cp = require('child_process')
Expand Down Expand Up @@ -80,7 +82,7 @@ export async function install(platform, engine, version) {
// windows 2016 and 2019 need ucrt64 installed, 2022 and future images need
// ucrt64 or mingw64 installed, depending on Ruby version
if (((msys2Type === 'ucrt64') || !hasMSYS2PreInstalled) && common.floatVersion(version) >= 2.4) {
await installGCCTools(msys2Type)
await installGCCTools(msys2Type, version)
}

if (version === 'mswin') {
Expand All @@ -97,14 +99,23 @@ export async function install(platform, engine, version) {

// Actions windows-2022 image does not contain any mingw or ucrt build tools. Install tools for it,
// and also install ucrt tools on earlier versions, which have msys2 and mingw tools preinstalled.
async function installGCCTools(type) {
const downloadPath = await common.measure(`Downloading ${type} build tools`, async () => {
let url = `${msys2GCCReleaseURI}/msys2-gcc-pkgs/${type}.7z`
async function installGCCTools(type, version) {
// 2022-Dec ruby/msys2-gcc-pkgs now uses a suffix to delineate different archive versions.
// At present, the only use is to indicate the included OpenSSL version.
// With no suffix, archives include OpenSSL 1.1.1, with a '-3.0' suffix, they include
// OpenSSL 3.0.x.
// Currently, OpenSSL 3 is used in Ruby 3.2 & 'head', both use a custom RubyInstaller2 package.
let suffix = ''
if ((version === 'head') || (!common.isHeadVersion(version) && common.floatVersion(version) >= 3.2)) {
suffix = '-3.0'
}
const downloadPath = await common.measure(`Downloading ${type}${suffix} build tools`, async () => {
let url = `${msys2GCCReleaseURI}/msys2-gcc-pkgs/${type}${suffix}.7z`
console.log(url)
return await tc.downloadTool(url)
})

await common.measure(`Extracting ${type} build tools`, async () =>
await common.measure(`Extracting ${type}${suffix} build tools`, async () =>
exec.exec('7z', ['x', downloadPath, '-aoa', '-bd', `-o${msys2BasePath}`], { silent: true }))
}

Expand All @@ -129,7 +140,8 @@ async function installMSYS2Tools() {
// windows-2022 and later images
export async function installJRubyTools() {
await installMSYS2Tools()
await installGCCTools('mingw64')
// Will need to add OpenSSL version detection when JRuby uses OpenSSL 3.0 ?
await installGCCTools('mingw64', '2.7')
}

// Install vcpkg files needed to build mswin Ruby
Expand Down

0 comments on commit fe42d0e

Please sign in to comment.