FooBarWidget / rubyenterpriseedition

Ruby Enterprise Edition based on MRI 1.8.6

This URL has Read+Write access

rubyenterpriseedition / mkconfig.rb
8884ab5e » matz 2000-08-03 matz - nakada win32 patch 1 #!./miniruby -s
986c389e » matz 1998-01-16 Initial revision 2
4e44bd01 » eban 2003-07-27 * mkconfig.rb: initialize g... 3 # avoid warnings with -d.
4 $install_name ||= nil
5 $so_name ||= nil
6
8775c5ab » nobu 2005-02-06 * mkconfig.rb: no longer em... 7 srcdir = File.dirname(__FILE__)
8 $:.replace [srcdir+"/lib", "."]
9
10 require "fileutils"
93a2b973 » nobu 2002-10-26 * fixed generator script name. 11 mkconfig = File.basename($0)
986c389e » matz 1998-01-16 Initial revision 12
13 rbconfig_rb = ARGV[0] || 'rbconfig.rb'
8775c5ab » nobu 2005-02-06 * mkconfig.rb: no longer em... 14 unless File.directory?(dir = File.dirname(rbconfig_rb))
15 FileUtils.makedirs(dir, :verbose => true)
16 end
986c389e » matz 1998-01-16 Initial revision 17
5484fc75 » eban 2001-05-30 * mkconfig.rb, ext/configsu... 18 version = RUBY_VERSION
64cf9365 » nobu 2005-11-10 * Makefile.in (OUTFLAG): ke... 19 def (config = "").write(arg)
20 concat(arg.to_s)
21 end
22 $stdout = config
986c389e » matz 1998-01-16 Initial revision 23
8884ab5e » matz 2000-08-03 matz - nakada win32 patch 24 fast = {'prefix'=>TRUE, 'ruby_install_name'=>TRUE, 'INSTALL'=>TRUE, 'EXEEXT'=>TRUE}
986c389e » matz 1998-01-16 Initial revision 25 print %[
93a2b973 » nobu 2002-10-26 * fixed generator script name. 26 # This file was created by #{mkconfig} when ruby was built. Any
27 # changes made to this file will be lost the next time ruby is built.
28
986c389e » matz 1998-01-16 Initial revision 29 module Config
5484fc75 » eban 2001-05-30 * mkconfig.rb, ext/configsu... 30 RUBY_VERSION == "#{version}" or
31 raise "ruby lib version (#{version}) doesn't match executable version (\#{RUBY_VERSION})"
4ade86d8 » nobu 2002-10-26 * moved a blank line. 32
986c389e » matz 1998-01-16 Initial revision 33 ]
34
35 v_fast = []
36 v_others = []
9ac4aa09 » nobu 2006-05-24 * mkconfig.rb: merge multip... 37 vars = {}
07bb9f21 » matz 1999-08-12 1.4.0 38 has_version = false
90f8f745 » nobu 2007-01-29 * mkconfig.rb: autoconf 2.6... 39 continued_name = nil
40 continued_line = nil
31b9d287 » matz 2000-12-27 changes from personal modif... 41 File.foreach "config.status" do |line|
42 next if /^#/ =~ line
90f8f745 » nobu 2007-01-29 * mkconfig.rb: autoconf 2.6... 43 name = nil
44 case line
45 when /^s([%,])@(\w+)@\1(?:\|\#_!!_\#\|)?(.*)\1/
976ac4d7 » nobu 2006-06-25 * Makefile.in, mkconfig.rb:... 46 name = $2
47 val = $3.gsub(/\\(?=,)/, '')
90f8f745 » nobu 2007-01-29 * mkconfig.rb: autoconf 2.6... 48 when /^S\["(\w+)"\]\s*=\s*"(.*)"\s*(\\)?$/
49 name = $1
50 val = $2
51 if $3
52 continued_line = []
53 continued_line << val
54 continued_name = name
55 next
56 end
57 when /^"(.+)"\s*(\\)?$/
58 if continued_line
59 continued_line << $1
60 unless $2
61 val = continued_line.join("")
62 name = continued_name
63 continued_line = nil
64 end
65 end
66 when /^(?:ac_given_)?INSTALL=(.*)/
67 v_fast << " CONFIG[\"INSTALL\"] = " + $1 + "\n"
68 end
69
70 if name
9cf8093a » shyouhei 2008-06-07 merge revision(s) 13695: 71 next if /^(?:ac_.*|configure_input|(?:top_)?srcdir|\w+OBJS)$/ =~ name
0c4a0dc9 » nobu 2005-04-15 * configure.in (RUBY_PROG_I... 72 next if /^\$\(ac_\w+\)$/ =~ val
73 next if /^\$\{ac_\w+\}$/ =~ val
74 next if /^\$ac_\w+$/ =~ val
31b9d287 » matz 2000-12-27 changes from personal modif... 75 next if $install_name and /^RUBY_INSTALL_NAME$/ =~ name
76 next if $so_name and /^RUBY_SO_NAME$/ =~ name
976ac4d7 » nobu 2006-06-25 * Makefile.in, mkconfig.rb:... 77 if /^program_transform_name$/ =~ name and /^s(\\?.)(.*)\1$/ =~ val
78 next if $install_name
79 sep = %r"#{Regexp.quote($1)}"
80 ptn = $2.sub(/\$\$/, '$').split(sep, 2)
81 name = "ruby_install_name"
82 val = "ruby".sub(/#{ptn[0]}/, ptn[1])
83 end
90f8f745 » nobu 2007-01-29 * mkconfig.rb: autoconf 2.6... 84 val.gsub!(/ +(?!-)/, "=") if name == "configure_args" && /mswin32/ =~ RUBY_PLATFORM
976ac4d7 » nobu 2006-06-25 * Makefile.in, mkconfig.rb:... 85 val = val.gsub(/\$(?:\$|\{?(\w+)\}?)/) {$1 ? "$(#{$1})" : $&}.dump
86 if /^prefix$/ =~ name
87 val = "(TOPDIR || DESTDIR + #{val})"
88 end
89 v = " CONFIG[\"#{name}\"] #{vars[name] ? '<< "\n"' : '='} #{val}\n"
9ac4aa09 » nobu 2006-05-24 * mkconfig.rb: merge multip... 90 vars[name] = true
986c389e » matz 1998-01-16 Initial revision 91 if fast[name]
92 v_fast << v
93 else
94 v_others << v
95 end
07bb9f21 » matz 1999-08-12 1.4.0 96 has_version = true if name == "MAJOR"
986c389e » matz 1998-01-16 Initial revision 97 end
98 # break if /^CEOF/
99 end
100
0243b2c1 » nobu 2002-10-21 * configure.in (XCFLAGS): C... 101 drive = File::PATH_SEPARATOR == ';'
102
0c4a0dc9 » nobu 2005-04-15 * configure.in (RUBY_PROG_I... 103 prefix = '/lib/ruby/' + RUBY_VERSION.sub(/\.\d+$/, '') + '/' + RUBY_PLATFORM
104 print " TOPDIR = File.dirname(__FILE__).chomp!(#{prefix.dump})\n"
0243b2c1 » nobu 2002-10-21 * configure.in (XCFLAGS): C... 105 print " DESTDIR = ", (drive ? "TOPDIR && TOPDIR[/\\A[a-z]:/i] || " : ""), "'' unless defined? DESTDIR\n"
106 print " CONFIG = {}\n"
107 print " CONFIG[\"DESTDIR\"] = DESTDIR\n"
108
109 unless has_version
5484fc75 » eban 2001-05-30 * mkconfig.rb, ext/configsu... 110 RUBY_VERSION.scan(/(\d+)\.(\d+)\.(\d+)/) {
07bb9f21 » matz 1999-08-12 1.4.0 111 print " CONFIG[\"MAJOR\"] = \"" + $1 + "\"\n"
112 print " CONFIG[\"MINOR\"] = \"" + $2 + "\"\n"
113 print " CONFIG[\"TEENY\"] = \"" + $3 + "\"\n"
114 }
c2f8d063 » knu 2007-02-28 * mkconfig.rb (patchlevel):... 115 patchlevel = IO.foreach(File.join(srcdir, "version.h")) {|l|
116 m = /^\s*#\s*define\s+RUBY_PATCHLEVEL\s+(\d+)/.match(l) and break m[1]
117 }
118 print " CONFIG[\"PATCHLEVEL\"] = \"#{patchlevel}\"\n"
07bb9f21 » matz 1999-08-12 1.4.0 119 end
120
0243b2c1 » nobu 2002-10-21 * configure.in (XCFLAGS): C... 121 dest = drive ? /= \"(?!\$[\(\{])(?:[a-z]:)?/i : /= \"(?!\$[\(\{])/
122 v_others.collect! do |x|
80d5af6a » akr 2003-04-09 * regex.c (re_compile_patte... 123 if /^\s*CONFIG\["(?!abs_|old)[a-z]+(?:_prefix|dir)"\]/ === x
0243b2c1 » nobu 2002-10-21 * configure.in (XCFLAGS): C... 124 x.sub(dest, '= "$(DESTDIR)')
85c11656 » eban 2000-06-18 2000-06-19 125 else
126 x
127 end
128 end
129
8884ab5e » matz 2000-08-03 matz - nakada win32 patch 130 if $install_name
131 v_fast << " CONFIG[\"ruby_install_name\"] = \"" + $install_name + "\"\n"
132 v_fast << " CONFIG[\"RUBY_INSTALL_NAME\"] = \"" + $install_name + "\"\n"
133 end
134 if $so_name
135 v_fast << " CONFIG[\"RUBY_SO_NAME\"] = \"" + $so_name + "\"\n"
136 end
137
90f8f745 » nobu 2007-01-29 * mkconfig.rb: autoconf 2.6... 138 print(*v_fast)
139 print(*v_others)
07bb9f21 » matz 1999-08-12 1.4.0 140 print <<EOS
d7d4acb1 » matz 2001-05-07 * parse.y (arg): "||=" shou... 141 CONFIG["ruby_version"] = "$(MAJOR).$(MINOR)"
142 CONFIG["rubylibdir"] = "$(libdir)/ruby/$(ruby_version)"
143 CONFIG["archdir"] = "$(rubylibdir)/$(arch)"
144 CONFIG["sitelibdir"] = "$(sitedir)/$(ruby_version)"
4fc6c3f7 » eban 2002-08-23 * configure.in: RUBY_SO_NAM... 145 CONFIG["sitearchdir"] = "$(sitelibdir)/$(sitearch)"
8775c5ab » nobu 2005-02-06 * mkconfig.rb: no longer em... 146 CONFIG["topdir"] = File.dirname(__FILE__)
7e740395 » eban 2000-07-31 eban 147 MAKEFILE_CONFIG = {}
148 CONFIG.each{|k,v| MAKEFILE_CONFIG[k] = v.dup}
0243b2c1 » nobu 2002-10-21 * configure.in (XCFLAGS): C... 149 def Config::expand(val, config = CONFIG)
150 val.gsub!(/\\$\\$|\\$\\(([^()]+)\\)|\\$\\{([^{}]+)\\}/) do |var|
151 if !(v = $1 || $2)
152 '$'
64cf9365 » nobu 2005-11-10 * Makefile.in (OUTFLAG): ke... 153 elsif key = config[v = v[/\\A[^:]+(?=(?::(.*?)=(.*))?\\z)/]]
154 pat, sub = $1, $2
0243b2c1 » nobu 2002-10-21 * configure.in (XCFLAGS): C... 155 config[v] = false
0c4a0dc9 » nobu 2005-04-15 * configure.in (RUBY_PROG_I... 156 Config::expand(key, config)
0243b2c1 » nobu 2002-10-21 * configure.in (XCFLAGS): C... 157 config[v] = key
64cf9365 » nobu 2005-11-10 * Makefile.in (OUTFLAG): ke... 158 key = key.gsub(/\#{Regexp.quote(pat)}(?=\\s|\\z)/n) {sub} if pat
159 key
7e740395 » eban 2000-07-31 eban 160 else
161 var
162 end
163 end
164 val
165 end
166 CONFIG.each_value do |val|
167 Config::expand(val)
168 end
07bb9f21 » matz 1999-08-12 1.4.0 169 end
5a11e9b2 » akr 2006-02-20 * mkconfig.rb: alias RbConf... 170 RbConfig = Config # compatibility for ruby-1.9
84071071 » eban 2002-12-31 * Makefile.in, {win32,bcc32... 171 CROSS_COMPILING = nil unless defined? CROSS_COMPILING
07bb9f21 » matz 1999-08-12 1.4.0 172 EOS
64cf9365 » nobu 2005-11-10 * Makefile.in (OUTFLAG): ke... 173
174 $stdout = STDOUT
175 mode = IO::RDWR|IO::CREAT
176 mode |= IO::BINARY if defined?(IO::BINARY)
177 open(rbconfig_rb, mode) do |f|
178 if $timestamp and f.stat.size == config.size and f.read == config
179 puts "#{rbconfig_rb} unchanged"
180 else
181 puts "#{rbconfig_rb} updated"
182 f.rewind
183 f.truncate(0)
184 f.print(config)
185 end
8775c5ab » nobu 2005-02-06 * mkconfig.rb: no longer em... 186 end
187 if String === $timestamp
188 FileUtils.touch($timestamp)
189 end
07bb9f21 » matz 1999-08-12 1.4.0 190
986c389e » matz 1998-01-16 Initial revision 191 # vi:set sw=2: