diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-05-15 07:58:28 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-05-15 07:58:28 +0000 |
commit | b38e3f953c6e105ea214237e215c93a123a24738 (patch) | |
tree | dda676c4d601da2c66d08bfb215f94d4c880ab60 /tool/shvar_to_cpp.rb | |
parent | 57531305bcafdf37f91a48684d49fd2718ec5ca3 (diff) | |
download | ruby-b38e3f953c6e105ea214237e215c93a123a24738.tar.gz |
configure.in: shvar_to_cpp in ruby
* configure.in: save configured load path values into verconf.in.
* common.mk (verconf.h): create from verconf.in with shvar_to_cpp.rb.
* tool/shvar_to_cpp.rb: turn shell variables into C macros.
[Bug #7959]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool/shvar_to_cpp.rb')
-rwxr-xr-x | tool/shvar_to_cpp.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tool/shvar_to_cpp.rb b/tool/shvar_to_cpp.rb new file mode 100755 index 0000000000..79764e9743 --- /dev/null +++ b/tool/shvar_to_cpp.rb @@ -0,0 +1,25 @@ +#!/usr/bin/ruby + +require './rbconfig' +C = RbConfig::MAKEFILE_CONFIG.dup +C["ruby_version"] = '"RUBY_LIB_VERSION"' +C["arch"] = '"arch"' +C["sitearch"] = '"arch"' +C["vendorarchdir"] = '"RUBY_VENDOR_ARCH_LIB"' +C["sitearchdir"] = '"RUBY_SITE_ARCH_LIB"' +C["vendorlibdir"] = '"RUBY_VENDOR_LIB2"' +C["sitelibdir"] = '"RUBY_SITE_LIB2"' +C["vendordir"] = '"RUBY_VENDOR_LIB"' +C["sitedir"] = '"RUBY_SITE_LIB"' +C["rubylibdir"] = '"RUBY_LIB"' +C["rubylibprefix"] = '"RUBY_LIB_PREFIX"' +C["rubyarchprefix"] = '"RUBY_ARCH_PREFIX_FOR(arch)"' +C["rubysitearchprefix"] = '"RUBY_SITEARCH_PREFIX_FOR(arch)"' +C["exec_prefix"] = '"RUBY_EXEC_PREFIX"' + +verconf = File.read(ARGV[0]) +verconf.gsub!(/^(#define\s+\S+\s+)(.*)/) { + $1 + RbConfig.expand($2, C).gsub(/^""(?!$)|(.)""$/, '\1') +} + +puts verconf |