diff options
author | Nobuyoshi Nakada <[email protected]> | 2022-12-19 22:43:51 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2022-12-20 17:40:19 +0900 |
commit | 031bc21abba4c2e9ce38bb49c456478073e6672a (patch) | |
tree | 1de6df8300e7af97a7bb8bb7fbeb8a81134539ae | |
parent | 0344283fd30f7e83529a7f4d33bc29886d01e29d (diff) |
expand-config.rb: search revision.h to extract release date
-rwxr-xr-x | tool/expand-config.rb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/tool/expand-config.rb b/tool/expand-config.rb index 928e7f91fe..ac0ffbfd41 100755 --- a/tool/expand-config.rb +++ b/tool/expand-config.rb @@ -7,7 +7,17 @@ config.sub!(/^(\s*)RUBY_VERSION\b.*(\sor\s*)$/, '\1true\2') rbconfig = Module.new {module_eval(config, conffile)}::RbConfig config = $expand ? rbconfig::CONFIG : rbconfig::MAKEFILE_CONFIG config["RUBY_RELEASE_DATE"] ||= - File.read(File.expand_path("../../version.h", __FILE__))[/^\s*#\s*define\s+RUBY_RELEASE_DATE\s+"(.*)"/, 1] + [ + ["revision.h"], + ["../../revision.h", __FILE__], + ["../../version.h", __FILE__], + ].find do |hdr, dir| + hdr = File.expand_path(hdr, dir) if dir + if date = File.read(hdr)[/^\s*#\s*define\s+RUBY_RELEASE_DATE(?:TIME)?\s+"([0-9-]*)/, 1] + break date + end +rescue +end while /\A(\w+)=(.*)/ =~ ARGV[0] config[$1] = $2 |