From 6175ca03be6d0d51359f9017123708987d0f5eb7 Mon Sep 17 00:00:00 2001 From: shyouhei Date: Wed, 15 Aug 2007 23:23:39 +0000 Subject: add tag v1_8_5_91 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/tags/v1_8_5_91@13046 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ruby_1_8_5/mkconfig.rb | 164 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 164 insertions(+) create mode 100644 ruby_1_8_5/mkconfig.rb (limited to 'ruby_1_8_5/mkconfig.rb') diff --git a/ruby_1_8_5/mkconfig.rb b/ruby_1_8_5/mkconfig.rb new file mode 100644 index 0000000000..1f075b0b30 --- /dev/null +++ b/ruby_1_8_5/mkconfig.rb @@ -0,0 +1,164 @@ +#!./miniruby -s + +# avoid warnings with -d. +$install_name ||= nil +$so_name ||= nil + +srcdir = File.dirname(__FILE__) +$:.replace [srcdir+"/lib", "."] + +require "fileutils" +mkconfig = File.basename($0) + +rbconfig_rb = ARGV[0] || 'rbconfig.rb' +unless File.directory?(dir = File.dirname(rbconfig_rb)) + FileUtils.makedirs(dir, :verbose => true) +end + +version = RUBY_VERSION +def (config = "").write(arg) + concat(arg.to_s) +end +$stdout = config + +fast = {'prefix'=>TRUE, 'ruby_install_name'=>TRUE, 'INSTALL'=>TRUE, 'EXEEXT'=>TRUE} +print %[ +# This file was created by #{mkconfig} when ruby was built. Any +# changes made to this file will be lost the next time ruby is built. + +module Config + RUBY_VERSION == "#{version}" or + raise "ruby lib version (#{version}) doesn't match executable version (\#{RUBY_VERSION})" + +] + +v_fast = [] +v_others = [] +vars = {} +has_version = false +File.foreach "config.status" do |line| + next if /^#/ =~ line + if /^s([%,])@(\w+)@\1(?:\|\#_!!_\#\|)?(.*)\1/ =~ line + name = $2 + val = $3.gsub(/\\(?=,)/, '') + next if /^(?:ac_.*|DEFS|configure_input)$/ =~ name + next if /^\$\(ac_\w+\)$/ =~ val + next if /^\$\{ac_\w+\}$/ =~ val + next if /^\$ac_\w+$/ =~ val + next if $install_name and /^RUBY_INSTALL_NAME$/ =~ name + next if $so_name and /^RUBY_SO_NAME$/ =~ name + if /^program_transform_name$/ =~ name and /^s(\\?.)(.*)\1$/ =~ val + next if $install_name + sep = %r"#{Regexp.quote($1)}" + ptn = $2.sub(/\$\$/, '$').split(sep, 2) + name = "ruby_install_name" + val = "ruby".sub(/#{ptn[0]}/, ptn[1]) + end + val = val.gsub(/\$(?:\$|\{?(\w+)\}?)/) {$1 ? "$(#{$1})" : $&}.dump + if /^prefix$/ =~ name + val = "(TOPDIR || DESTDIR + #{val})" + end + v = " CONFIG[\"#{name}\"] #{vars[name] ? '<< "\n"' : '='} #{val}\n" + vars[name] = true + if fast[name] + v_fast << v + else + v_others << v + end + has_version = true if name == "MAJOR" + elsif /^(?:ac_given_)?INSTALL=(.*)/ =~ line + v_fast << " CONFIG[\"INSTALL\"] = " + $1 + "\n" + end +# break if /^CEOF/ +end + +drive = File::PATH_SEPARATOR == ';' + +prefix = '/lib/ruby/' + RUBY_VERSION.sub(/\.\d+$/, '') + '/' + RUBY_PLATFORM +print " TOPDIR = File.dirname(__FILE__).chomp!(#{prefix.dump})\n" +print " DESTDIR = ", (drive ? "TOPDIR && TOPDIR[/\\A[a-z]:/i] || " : ""), "'' unless defined? DESTDIR\n" +print " CONFIG = {}\n" +print " CONFIG[\"DESTDIR\"] = DESTDIR\n" + +unless has_version + RUBY_VERSION.scan(/(\d+)\.(\d+)\.(\d+)/) { + print " CONFIG[\"MAJOR\"] = \"" + $1 + "\"\n" + print " CONFIG[\"MINOR\"] = \"" + $2 + "\"\n" + print " CONFIG[\"TEENY\"] = \"" + $3 + "\"\n" + } + 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" +end + +dest = drive ? /= \"(?!\$[\(\{])(?:[a-z]:)?/i : /= \"(?!\$[\(\{])/ +v_others.collect! do |x| + if /^\s*CONFIG\["(?!abs_|old)[a-z]+(?:_prefix|dir)"\]/ === x + x.sub(dest, '= "$(DESTDIR)') + else + x + end +end + +if $install_name + v_fast << " CONFIG[\"ruby_install_name\"] = \"" + $install_name + "\"\n" + v_fast << " CONFIG[\"RUBY_INSTALL_NAME\"] = \"" + $install_name + "\"\n" +end +if $so_name + v_fast << " CONFIG[\"RUBY_SO_NAME\"] = \"" + $so_name + "\"\n" +end + +print v_fast, v_others +print <