summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-08-03 09:55:54 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-08-03 09:55:54 +0000
commit87be0f1222670c5543518ff2cd509e6ad671e3f5 (patch)
tree9804a710ecdeb07f85350b6551a3e65c9d527469 /ext
parent5222760bc4062f4ce0f8a2c46961fb4cb26682f1 (diff)
matz - add/remove files
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/configsub.rb32
-rw-r--r--ext/mswin32_extmk.rb41
2 files changed, 32 insertions, 41 deletions
diff --git a/ext/configsub.rb b/ext/configsub.rb
new file mode 100644
index 0000000..315cdaf
--- /dev/null
+++ b/ext/configsub.rb
@@ -0,0 +1,32 @@
+#!./miniruby -ps
+
+BEGIN {
+ CONFIG = {}
+
+ VERSION.scan(/(\d+)\.(\d+)\.(\d+)/) do
+ # overridden if config.status has version
+ CONFIG['MAJOR'] = $1
+ CONFIG['MINOR'] = $2
+ CONFIG['TEENY'] = $3
+ end
+
+ File.foreach($config || "config.status") do |$_|
+ next if /^#/
+ if /^s%@(\w+)@%(.*)%g/
+ name = $1
+ val = $2 || ""
+ next if /^(INSTALL|DEFS|configure_input|srcdir)$/ =~ name
+ val.gsub!(/\$\{([^{}]+)\}/) { "$(#{$1})" }
+ CONFIG[name] = val
+ end
+ end
+
+ CONFIG['top_srcdir'] = File.expand_path($srcdir || ".")
+ CONFIG['RUBY_INSTALL_NAME'] = $install_name if $install_name
+ CONFIG['RUBY_SO_NAME'] = $so_name if $so_name
+ $defout = open($output, 'w') if $output
+}
+
+gsub!(/@(\w+)@/) {CONFIG[$1] || $&}
+
+# vi:set sw=2:
diff --git a/ext/mswin32_extmk.rb b/ext/mswin32_extmk.rb
deleted file mode 100644
index c79284d..0000000
--- a/ext/mswin32_extmk.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-#!./miniruby
-
-def create_gsub_rb()
- f = open("mswin32_gsub.rb", "w")
- has_version = false
- f.print 'f = open("extmk.rb", "w")', "\n"
- f.print 'File.foreach "extmk.rb.in" do |$_|', "\n"
- File.foreach "../config.status" do |$_|
- next if /^#/
- if /^s%@(\w+)@%(.*)%g/
- name = $1
- val = $2 || ""
- next if name =~ /^(INSTALL|DEFS|configure_input|srcdir)$/
- val = ".." if name == "top_srcdir"
- val.gsub!(/\$\{([^{}]+)\}/) { "$(#{$1})" }
- f.print " gsub!(\"@#{name}@\", \"#{val}\")\n"
- has_version = true if name == "MAJOR"
- end
- end
-
- if not has_version
- VERSION.scan(/(\d+)\.(\d+)\.(\d+)/) {
- f.print " gsub!(\"@MAJOR@\", \"#{$1}\")\n"
- f.print " gsub!(\"@MINOR@\", \"#{$2}\")\n"
- f.print " gsub!(\"@TEENY@\", \"#{$3}\")\n"
- }
- end
- f.print ' f.print $_', "\n"
- f.print 'end', "\n"
- f.print 'f.close', "\n"
- f.close
-end
-
-begin
- create_gsub_rb()
- load "mswin32_gsub.rb"
-ensure
- File.unlink "mswin32_gsub.rb"
-end
-
-# vi:set sw=2: