ed-precompiled_io-console 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.document +5 -0
- data/BSDL +22 -0
- data/COPYING +56 -0
- data/README.md +46 -0
- data/ext/io/console/console.c +1969 -0
- data/ext/io/console/extconf.rb +61 -0
- data/ext/io/console/win32_vk.inc +1390 -0
- data/lib/io/console/size.rb +23 -0
- data/lib/io/console.rb +2 -0
- metadata +52 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# frozen_string_literal: false
|
|
2
|
+
require 'mkmf'
|
|
3
|
+
|
|
4
|
+
# `--target-rbconfig` compatibility for Ruby 3.3 or earlier
|
|
5
|
+
# See https://bugs.ruby-lang.org/issues/20345
|
|
6
|
+
MakeMakefile::RbConfig ||= ::RbConfig
|
|
7
|
+
|
|
8
|
+
have_func("rb_syserr_fail_str(0, Qnil)") or
|
|
9
|
+
have_func("rb_syserr_new_str(0, Qnil)") or
|
|
10
|
+
abort
|
|
11
|
+
|
|
12
|
+
have_func("rb_interned_str_cstr")
|
|
13
|
+
have_func("rb_io_path", "ruby/io.h")
|
|
14
|
+
have_func("rb_io_descriptor", "ruby/io.h")
|
|
15
|
+
have_func("rb_io_get_write_io", "ruby/io.h")
|
|
16
|
+
have_func("rb_io_closed_p", "ruby/io.h")
|
|
17
|
+
have_func("rb_io_open_descriptor", "ruby/io.h")
|
|
18
|
+
have_func("rb_ractor_local_storage_value_newkey")
|
|
19
|
+
|
|
20
|
+
is_wasi = /wasi/ =~ MakeMakefile::RbConfig::CONFIG["platform"]
|
|
21
|
+
# `ok` can be `true`, `false`, or `nil`:
|
|
22
|
+
# * `true` : Required headers and functions available, proceed regular build.
|
|
23
|
+
# * `false`: Required headers or functions not available, abort build.
|
|
24
|
+
# * `nil` : Unsupported compilation target, generate dummy Makefile.
|
|
25
|
+
#
|
|
26
|
+
# Skip building io/console on WASI, as it does not support termios.h.
|
|
27
|
+
ok = true if (RUBY_ENGINE == "ruby" && !is_wasi) || RUBY_ENGINE == "truffleruby"
|
|
28
|
+
hdr = nil
|
|
29
|
+
case
|
|
30
|
+
when macro_defined?("_WIN32", "")
|
|
31
|
+
# rb_w32_map_errno: 1.8.7
|
|
32
|
+
vk_header = File.exist?("#$srcdir/win32_vk.list") ? "chksum" : "inc"
|
|
33
|
+
vk_header = "#{'{$(srcdir)}' if $nmake == ?m}win32_vk.#{vk_header}"
|
|
34
|
+
when hdr = %w"termios.h termio.h".find {|h| have_header(h)}
|
|
35
|
+
have_func("cfmakeraw", hdr)
|
|
36
|
+
when have_header(hdr = "sgtty.h")
|
|
37
|
+
%w"stty gtty".each {|f| have_func(f, hdr)}
|
|
38
|
+
else
|
|
39
|
+
ok = false
|
|
40
|
+
end if ok
|
|
41
|
+
case ok
|
|
42
|
+
when true
|
|
43
|
+
have_header("sys/ioctl.h") if hdr
|
|
44
|
+
# rb_check_hash_type: 1.9.3
|
|
45
|
+
# rb_io_get_write_io: 1.9.1
|
|
46
|
+
# rb_cloexec_open: 2.0.0
|
|
47
|
+
# rb_funcallv: 2.1.0
|
|
48
|
+
# RARRAY_CONST_PTR: 2.1.0
|
|
49
|
+
# rb_sym2str: 2.2.0
|
|
50
|
+
if have_macro("HAVE_RUBY_FIBER_SCHEDULER_H")
|
|
51
|
+
$defs << "-D""HAVE_RB_IO_WAIT=1"
|
|
52
|
+
elsif have_func("rb_scheduler_timeout") # 3.0
|
|
53
|
+
have_func("rb_io_wait")
|
|
54
|
+
end
|
|
55
|
+
have_func("ttyname_r") or have_func("ttyname")
|
|
56
|
+
create_makefile("io/console") {|conf|
|
|
57
|
+
conf << "\n""VK_HEADER = #{vk_header}\n"
|
|
58
|
+
}
|
|
59
|
+
when nil
|
|
60
|
+
File.write("Makefile", dummy_makefile($srcdir).join(""))
|
|
61
|
+
end
|