From e5ffb6df0f41d327c391de4b21cea29a865ed7c8 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 24 Mar 2009 22:44:17 +0000 Subject: [PATCH] * mkconfig.rb (MAJOR, MINOR, TEENY): reads from version.h always. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23066 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ mkconfig.rb | 26 +++++++++----------------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index f36b23199e..d1a0976b71 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Wed Mar 25 07:44:13 2009 Nobuyoshi Nakada + + * mkconfig.rb (MAJOR, MINOR, TEENY): reads from version.h always. + Tue Mar 24 19:23:44 2009 Nobuyoshi Nakada * configure.in (RUBY_CHECK_SIZEOF): need to include $4. diff --git a/mkconfig.rb b/mkconfig.rb index fb608137e5..1a3b6cebcf 100755 --- a/mkconfig.rb +++ b/mkconfig.rb @@ -37,8 +37,6 @@ module RbConfig v_fast = [] v_others = [] vars = {} -has_version = false -has_patchlevel = false continued_name = nil continued_line = nil File.foreach "config.status" do |line| @@ -97,10 +95,6 @@ File.foreach "config.status" do |line| v_others << v end case name - when "MAJOR" - has_version = true - when "PATCHLEVEL" - has_patchlevel = true when "ruby_version" version = val[/\A"(.*)"\z/, 1] end @@ -116,18 +110,16 @@ print " DESTDIR = ", (drive ? "TOPDIR && TOPDIR[/\\A[a-z]:/i] || " : ""), "'' u print " CONFIG = {}\n" print " CONFIG[\"DESTDIR\"] = DESTDIR\n" -unless has_version - version.scan(/(\d+)\.(\d+)(?:\.(\d+))?/) { - print " CONFIG[\"MAJOR\"] = \"" + $1 + "\"\n" - print " CONFIG[\"MINOR\"] = \"" + $2 + "\"\n" - print " CONFIG[\"TEENY\"] = \"" + $3 + "\"\n" - } +versions = {} +IO.foreach(File.join(srcdir, "version.h")) do |l| + m = /^\s*#\s*define\s+RUBY_(VERSION_(MAJOR|MINOR|TEENY)|PATCHLEVEL)\s+(-?\d+)/.match(l) + if m + versions[m[2]||m[1]] = m[3] + break if versions.size == 4 + end end -unless has_patchlevel - patchlevel = IO.foreach(File.join(srcdir, "version.h")) {|l| - m = /^\s*#\s*define\s+RUBY_PATCHLEVEL\s+(-?\d+)/.match(l) and break m[1] - } - print " CONFIG[\"PATCHLEVEL\"] = \"#{patchlevel}\"\n" +%w[MAJOR MINOR TEENY PATCHLEVEL].each do |v| + print " CONFIG[#{v.dump}] = #{versions[v].dump}\n" end dest = drive ? /= \"(?!\$[\(\{])(?:[a-z]:)?/i : /= \"(?!\$[\(\{])/