diff options
author | Nobuyoshi Nakada <[email protected]> | 2023-11-10 17:21:33 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2023-11-10 19:00:46 +0900 |
commit | f08400a07a966fba8d56c496669868f927781aba (patch) | |
tree | 2aabc3d5a19c84ad7ac22a3ea14e04bf1eea9ab4 /ext | |
parent | 5309e3c406b779f488c92bc88c02b751f596f09c (diff) |
[ruby/io-console] Define IO::ConsoleMode::VERSION from gemspec
https://github.com/ruby/io-console/commit/ebdbebf461
Diffstat (limited to 'ext')
-rw-r--r-- | ext/io/console/console.c | 1 | ||||
-rw-r--r-- | ext/io/console/extconf.rb | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/ext/io/console/console.c b/ext/io/console/console.c index f4257446c8..61b6e76327 100644 --- a/ext/io/console/console.c +++ b/ext/io/console/console.c @@ -1672,6 +1672,7 @@ InitVM_console(void) { /* :stopdoc: */ cConmode = rb_define_class_under(rb_cIO, "ConsoleMode", rb_cObject); + rb_define_const(cConmode, "VERSION", rb_str_new_cstr(STRINGIZE(IO_CONSOLE_VERSION))); rb_define_alloc_func(cConmode, conmode_alloc); rb_undef_method(cConmode, "initialize"); rb_define_method(cConmode, "initialize_copy", conmode_init_copy, 1); diff --git a/ext/io/console/extconf.rb b/ext/io/console/extconf.rb index a72403c7f9..aa0b6c6cfb 100644 --- a/ext/io/console/extconf.rb +++ b/ext/io/console/extconf.rb @@ -1,6 +1,11 @@ # frozen_string_literal: false require 'mkmf' +version = ["../../..", "."].find do |dir| + break File.read(File.join(__dir__, dir, "io-console.gemspec"))[/^_VERSION\s*=\s*"(.*?)"/, 1] +rescue +end + have_func("rb_io_path") have_func("rb_io_descriptor") have_func("rb_io_get_write_io") @@ -35,6 +40,7 @@ when true elsif have_func("rb_scheduler_timeout") # 3.0 have_func("rb_io_wait") end + $defs << "-D""IO_CONSOLE_VERSION=#{version}" create_makefile("io/console") {|conf| conf << "\n""VK_HEADER = #{vk_header}\n" } |