Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows: Use "ridk enable" like variable setup and add UCRT #197

Closed
wants to merge 2 commits into from

Conversation

larskanis
Copy link
Contributor

@larskanis larskanis commented Jul 2, 2021

This PR adds a "ridk enable" like setup of environment variables. "ridk enable" and "ridk exec" are the preferred ways to enable MSYS2 in RubyInstaller2. This not only sets the PATH but also several other variables that are required for pkgconf, autotools, etc.

"ridk enable" mimics the variable setup of MSYS2 "bash --login", but enables powershell and cmd.exe to run MSYS2 commands.

As a fallback, in case the RubyInstaller mechanism fails, the PATH is extended to use MSYS64 with MINGW or UCRT, but no other variables are set.

The PR installs gcc when running on Windows-UCRT, since there is no UCRT capable compiler preinstalled on github actions. That might be a temporary solution until @MSP-Greg finds another way to package gcc in a faster install solution.

A Github Action run on Windows looks like so: https://github.com/larskanis/ruby-pg/runs/2972095461?check_suite_focus=true#step:3:19

@larskanis larskanis changed the title Ucrt1 Windows: Use "ridk enable" like variable setup and add UCRT Jul 2, 2021
@MSP-Greg
Copy link
Collaborator

MSP-Greg commented Jul 2, 2021

until @MSP-Greg finds another way to package gcc in a faster install solution

I finished most of the work last night, and it is faster. Another repo builds a 7z file of the ucrt install, and using it considerably shortens the install time. I'll post a message in #194.

const parts = envvar.split("=", 2)
core.exportVariable(parts[0], parts[1])
})
} catch (ex) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should at minimum log the exception here to help debug if anything goes wrong.
I think more reliable would be to have no fallback, do we need this fallback?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, a message would be good.
I think the fallback is used on the ruby-loco mswin version. It doesn't ship the RubyInstaller::Runtime library. But both ruby-loco mingw and RubyInstaller have it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think best to have a if !mswin then and no catch

@eregon
Copy link
Member

eregon commented May 2, 2022

I think this has been superseded #224 which was merged, so I'll close.

@eregon eregon closed this May 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants