[ruby/io-wait] Make the gem a noop on Rubies older than 2.6

Ref: https://github.com/mikel/mail/pull/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.

75fcb74c32
This commit is contained in:
Jean Boussier 2022-01-11 16:14:20 +01:00 committed by Nobuyoshi Nakada
parent 804dca7b0c
commit ddb9d60f7d
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6
2 changed files with 18 additions and 15 deletions

View file

@ -1,7 +1,10 @@
# frozen_string_literal: false
require 'mkmf'
target = "io/wait"
if RUBY_VERSION < "2.6"
File.write("Makefile", dummy_makefile($srcdir).join(""))
else
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
@ -18,3 +21,4 @@ else
create_makefile(target)
end
end
end

View file

@ -10,7 +10,6 @@ Gem::Specification.new do |spec|
spec.description = %q{Waits until IO is readable or writable without blocking.}
spec.homepage = "https://github.com/ruby/io-wait"
spec.licenses = ["Ruby", "BSD-2-Clause"]
spec.required_ruby_version = Gem::Requirement.new(">= 2.6.0")
spec.metadata["homepage_uri"] = spec.homepage
spec.metadata["source_code_uri"] = spec.homepage