Skip to content

Conversation

@ioquatix
Copy link
Member

@ioquatix ioquatix commented Jul 27, 2025

On some platforms, no native extensions should be created. This is typical for JRuby. Due to limitations in the extension builder, it is typical to create a dummy makefile that does nothing:

https://github.com/search?q=File.write+Makefile+path%3A**%2Fextconf.rb&type=code

This seems like a bad pattern.

  • It's not intentional: we are faking the creation of a makefile for the sake of "build" and "clean".
  • It's inefficient: make is still invoked several times even when no build steps are required.
  • It's difficult: gems with native extensions for JRuby have to jump through hoops in order to work.
  • It clutters the output: creating unnecessary files and artifacts.
  • It's confusing: it suggests a native build occurred when it didn't and makes debugging build issues harder.

I think it would be preferable to just do:

# extconf.rb

return if build_not_required?

require "mkmf"

...

create_makefile

Make sure the following tasks are checked

@ioquatix ioquatix force-pushed the extconf-optional-makefile branch from 75d17a1 to 480d641 Compare July 27, 2025 23:24
ioquatix added a commit to socketry/io-event that referenced this pull request Jul 27, 2025
ioquatix added a commit to socketry/io-event that referenced this pull request Jul 27, 2025
@ioquatix ioquatix force-pushed the extconf-optional-makefile branch from 480d641 to 4450cdb Compare July 27, 2025 23:46
@headius
Copy link
Contributor

headius commented Jul 28, 2025

I'm +1 for this of course. May also help #3520?

@ioquatix
Copy link
Member Author

I don't really understand the full issue here, but in order to support #3520 we'd probably need to communicate the fact that no native extension was built back to the index that's tracking what gems are compatible with what, if any such index exists.

@eregon
Copy link
Member

eregon commented Jul 29, 2025

LGTM as well, seems convenient and cleaner than a dummy makefile.

Copy link
Contributor

@deivid-rodriguez deivid-rodriguez left a comment

Choose a reason for hiding this comment

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

Thank you!

More work will be needed for #3520, but this is a good change and everyone agreed with it over at #7372 and https://bugs.ruby-lang.org/issues/20152.

The implementation seems fine to me, too 👍.

I'll leave this opened for a couple more days in case additional reviewers show up, but I'm good with this!

@ioquatix ioquatix force-pushed the extconf-optional-makefile branch from 4450cdb to 0e92346 Compare August 7, 2025 14:02
@deivid-rodriguez
Copy link
Contributor

Let's do this, thanks so much @ioquatix!

@deivid-rodriguez deivid-rodriguez merged commit 44e36f5 into ruby:master Aug 11, 2025
73 checks passed
@ioquatix ioquatix deleted the extconf-optional-makefile branch August 11, 2025 10:07
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.

4 participants