forked from ruby/io-wait
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make the gem a noop on Rubies older than 2.6
Ref: mikel/mail#1439 Some gems depend on io-wait, but still support older rubies, so they have to chose between droping support or not listing io-wait. But io-wait could act a a noop on older rubies.
- Loading branch information
Showing
6 changed files
with
60 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,4 @@ | |
*.dll | ||
*.so | ||
ChangeLog | ||
Gemfile.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,24 @@ | ||
# frozen_string_literal: false | ||
require 'mkmf' | ||
target = "io/wait" | ||
|
||
have_func("rb_io_wait") | ||
unless macro_defined?("DOSISH", "#include <ruby.h>") | ||
have_header(ioctl_h = "sys/ioctl.h") or ioctl_h = nil | ||
fionread = %w[sys/ioctl.h sys/filio.h sys/socket.h].find do |h| | ||
have_macro("FIONREAD", [h, ioctl_h].compact) | ||
end | ||
if fionread | ||
$defs << "-DFIONREAD_HEADER=\"<#{fionread}>\"" | ||
create_makefile(target) | ||
end | ||
if RUBY_VERSION < "2.6" | ||
File.write("Makefile", dummy_makefile($srcdir).join("")) | ||
else | ||
if have_func("rb_w32_ioctlsocket", "ruby.h") | ||
have_func("rb_w32_is_socket", "ruby.h") | ||
create_makefile(target) | ||
target = "io/wait" | ||
have_func("rb_io_wait") | ||
unless macro_defined?("DOSISH", "#include <ruby.h>") | ||
have_header(ioctl_h = "sys/ioctl.h") or ioctl_h = nil | ||
fionread = %w[sys/ioctl.h sys/filio.h sys/socket.h].find do |h| | ||
have_macro("FIONREAD", [h, ioctl_h].compact) | ||
end | ||
if fionread | ||
$defs << "-DFIONREAD_HEADER=\"<#{fionread}>\"" | ||
create_makefile(target) | ||
end | ||
else | ||
if have_func("rb_w32_ioctlsocket", "ruby.h") | ||
have_func("rb_w32_is_socket", "ruby.h") | ||
create_makefile(target) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters