summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/io/console/console.c4
-rw-r--r--ext/io/console/extconf.rb6
-rw-r--r--ext/io/console/io-console.gemspec10
3 files changed, 13 insertions, 7 deletions
diff --git a/ext/io/console/console.c b/ext/io/console/console.c
index 6fd8677a3c..0448a6cba8 100644
--- a/ext/io/console/console.c
+++ b/ext/io/console/console.c
@@ -2,6 +2,10 @@
/*
* console IO module
*/
+
+static const char *const
+IO_CONSOLE_VERSION = "0.7.2.dev.1";
+
#include "ruby.h"
#include "ruby/io.h"
#include "ruby/thread.h"
diff --git a/ext/io/console/extconf.rb b/ext/io/console/extconf.rb
index aa0b6c6cfb..a72403c7f9 100644
--- a/ext/io/console/extconf.rb
+++ b/ext/io/console/extconf.rb
@@ -1,11 +1,6 @@
# 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")
@@ -40,7 +35,6 @@ 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"
}
diff --git a/ext/io/console/io-console.gemspec b/ext/io/console/io-console.gemspec
index c5e713fef1..f9c1729cb7 100644
--- a/ext/io/console/io-console.gemspec
+++ b/ext/io/console/io-console.gemspec
@@ -1,5 +1,13 @@
# -*- ruby -*-
-_VERSION = "0.7.2.dev.1"
+_VERSION = ["", "ext/io/console/"].find do |dir|
+ begin
+ break File.open(File.join(__dir__, "#{dir}console.c")) {|f|
+ f.gets("\nIO_CONSOLE_VERSION ")
+ f.gets[/"(.+)"/, 1]
+ }
+ rescue Errno::ENOENT
+ end
+end
Gem::Specification.new do |s|
s.name = "io-console"