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

Add --target-rbconfig option to gem install and gem update commands #7628

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

kateinoigakukun
Copy link
Contributor

@kateinoigakukun kateinoigakukun commented May 4, 2024

What was the end-user or developer problem that led to this PR?

Today, CRuby runs on many platforms. But not all platforms are capable of running build tools (e.g. WebAssembly/WASI), so cross-target compilation against extensions libraries is essential for those platforms.

Currently, there is no way to cross-compile extension libraries in gems at install-time.

What is your fix for the problem, implemented in this PR?

This patch adds --target-rbconfig option to specify the rbconfig.rb file for the deployment target platform. It basically pass through it to mkmf. The underlying --target-rbconfig support in mkmf has been introduced recently https://bugs.ruby-lang.org/issues/20345

At the moment, this option is only available when the following requirements are met:

  • extconf.rb-based extensions
  • requires mkmf in the latest master branch.

But we can relax the first requirement for Cargo builder by adding a support in rb-sys later.

$ GEM_HOME=/tmp/gems-wasm32-wasi gem install nokogiri --target-rbconfig path/to/wasm32-wasi/rbconfig.rb

Make sure the following tasks are checked

@kateinoigakukun kateinoigakukun force-pushed the pr-64aa3cae6563de7b71b8cebbd2453e65e4f40278 branch 3 times, most recently from 57df8bd to 97fa3ff Compare May 4, 2024 23:22
@kateinoigakukun kateinoigakukun marked this pull request as ready for review May 5, 2024 05:10
@hsbt hsbt self-assigned this May 7, 2024
@kateinoigakukun kateinoigakukun force-pushed the pr-64aa3cae6563de7b71b8cebbd2453e65e4f40278 branch 5 times, most recently from 394788b to 7868c67 Compare May 17, 2024 07:47
…ands

This patch adds `--target-rbconfig` option to specify the rbconfig.rb file
for the deployment target platform. This is useful when cross-compiling
gems. At the moment, this option is only available for `extconf.rb`-based
extensions.
@kateinoigakukun kateinoigakukun force-pushed the pr-64aa3cae6563de7b71b8cebbd2453e65e4f40278 branch from 7868c67 to 86a8474 Compare May 17, 2024 07:52
@kateinoigakukun kateinoigakukun force-pushed the pr-64aa3cae6563de7b71b8cebbd2453e65e4f40278 branch from 86a8474 to 132178c Compare May 19, 2024 00:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants