[前][次][番号順一覧][スレッド一覧]

ruby-changes:6084

From: nobu <ko1@a...>
Date: Fri, 27 Jun 2008 12:29:34 +0900 (JST)
Subject: [ruby-changes:6084] Ruby:r17596 (trunk, ruby_1_8, mvm): * lib/un.rb (mkmf): new command to create makefile.

nobu	2008-06-27 12:29:00 +0900 (Fri, 27 Jun 2008)

  New Revision: 17596

  Modified files:
    branches/mvm/ChangeLog
    branches/mvm/lib/un.rb
    branches/ruby_1_8/ChangeLog
    branches/ruby_1_8/lib/un.rb
    trunk/ChangeLog
    trunk/lib/un.rb

  Log:
    * lib/un.rb (mkmf): new command to create makefile.


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/un.rb?r1=17596&r2=17595&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ChangeLog?r1=17596&r2=17595&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=17596&r2=17595&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/mvm/ChangeLog?r1=17596&r2=17595&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/lib/un.rb?r1=17596&r2=17595&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/mvm/lib/un.rb?r1=17596&r2=17595&diff_format=u

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 17595)
+++ ChangeLog	(revision 17596)
@@ -1,3 +1,7 @@
+Fri Jun 27 12:28:57 2008  Nobuyoshi Nakada  <nobu@r...>
+
+	* lib/un.rb (mkmf): new command to create makefile.
+
 Fri Jun 27 11:06:05 2008  Nobuyoshi Nakada  <nobu@r...>
 
 	* lib/un.rb (wait_writable): added help message.
Index: lib/un.rb
===================================================================
--- lib/un.rb	(revision 17595)
+++ lib/un.rb	(revision 17596)
@@ -20,6 +20,7 @@
 #   ruby -run -e chmod -- [OPTION] OCTAL-MODE FILE
 #   ruby -run -e touch -- [OPTION] FILE
 #   ruby -run -e wait_writable -- [OPTION] FILE
+#   ruby -run -e mkmf -- [OPTION] EXTNAME [OPTION]
 #   ruby -run -e help [COMMAND]
 
 require "fileutils"
@@ -30,30 +31,32 @@
   @fileutils_output = $stdout
 end
 
-def setup(options = "")
-  ARGV.map! do |x|
-    case x
-    when /^-/
-      x.delete "^-#{options}v"
-    when /[*?\[{]/
-      Dir[x]
-    else
-      x
-    end
-  end
-  ARGV.flatten!
-  ARGV.delete_if{|x| x == "-"}
+def setup(options = "", *long_options)
   opt_hash = {}
+  argv = []
   OptionParser.new do |o|
     options.scan(/.:?/) do |s|
+      opt_name = s.delete(":").intern
       o.on("-" + s.tr(":", " ")) do |val|
-        opt_hash[s.delete(":").intern] = val
+        opt_hash[opt_name] = val
       end
     end
+    long_options.each do |s|
+      opt_name = s[/\A(?:--)?([^\s=]+)/, 1].intern
+      o.on(s.sub(/\A(?!--)/, '--')) do |val|
+        opt_hash[opt_name] = val
+      end
+    end
     o.on("-v") do opt_hash[:verbose] = true end
-    o.parse!
+    o.order!(ARGV) do |x|
+      if /[*?\[{]/ =~ x
+        argv.concat(Dir[x])
+      else
+        argv << x
+      end
+    end
   end
-  yield ARGV, opt_hash
+  yield argv, opt_hash
 end
 
 ##
@@ -246,6 +249,38 @@
 end
 
 ##
+# Create makefile using mkmf.
+#
+#   ruby -run -e mkmf -- [OPTION] EXTNAME [OPTION]
+#
+#   -d ARGS	run dir_config
+#   -h ARGS	run have_header
+#   -l ARGS	run have_library
+#   -f ARGS	run have_func
+#   -v ARGS	run have_var
+#   -t ARGS	run have_type
+#   -m ARGS	run have_macro
+#   -c ARGS	run have_const
+#   --vendor	install to vendor_ruby
+#
+
+def mkmf
+  setup("d:h:l:f:v:t:m:c:", "vendor") do |argv, options|
+    require 'mkmf'
+    opt = options[:d] and opt.split(/:/).each {|n| dir_config(*n.split(/,/))}
+    opt = options[:h] and opt.split(/:/).each {|n| have_header(*n.split(/,/))}
+    opt = options[:l] and opt.split(/:/).each {|n| have_library(*n.split(/,/))}
+    opt = options[:f] and opt.split(/:/).each {|n| have_func(*n.split(/,/))}
+    opt = options[:v] and opt.split(/:/).each {|n| have_var(*n.split(/,/))}
+    opt = options[:t] and opt.split(/:/).each {|n| have_type(*n.split(/,/))}
+    opt = options[:m] and opt.split(/:/).each {|n| have_macro(*n.split(/,/))}
+    opt = options[:c] and opt.split(/:/).each {|n| have_const(*n.split(/,/))}
+    $configure_args["--vendor"] = true if options[:vendor]
+    create_makefile(*argv)
+  end
+end
+
+##
 # Display help message.
 #
 #   ruby -run -e help [COMMAND]
Index: ruby_1_8/ChangeLog
===================================================================
--- ruby_1_8/ChangeLog	(revision 17595)
+++ ruby_1_8/ChangeLog	(revision 17596)
@@ -1,3 +1,7 @@
+Fri Jun 27 12:28:57 2008  Nobuyoshi Nakada  <nobu@r...>
+
+	* lib/un.rb (mkmf): new command to create makefile.
+
 Fri Jun 27 00:34:50 2008  Nobuyoshi Nakada  <nobu@r...>
 
 	* common.mk (revision.h): split the temporary file.  [ruby-core:17407]
Index: ruby_1_8/lib/un.rb
===================================================================
--- ruby_1_8/lib/un.rb	(revision 17595)
+++ ruby_1_8/lib/un.rb	(revision 17596)
@@ -20,6 +20,7 @@
 #   ruby -run -e chmod -- [OPTION] OCTAL-MODE FILE
 #   ruby -run -e touch -- [OPTION] FILE
 #   ruby -run -e help [COMMAND]
+#   ruby -run -e mkmf -- [OPTION] EXTNAME [OPTION]
 
 require "fileutils"
 require "optparse"
@@ -29,30 +30,32 @@
   @fileutils_output = $stdout
 end
 
-def setup(options = "")
-  ARGV.map! do |x|
-    case x
-    when /^-/
-      x.delete "^-#{options}v"
-    when /[*?\[{]/
-      Dir[x]
-    else
-      x
-    end
-  end
-  ARGV.flatten!
-  ARGV.delete_if{|x| x == "-"}
+def setup(options = "", *long_options)
   opt_hash = {}
+  argv = []
   OptionParser.new do |o|
     options.scan(/.:?/) do |s|
+      opt_name = s.delete(":").intern
       o.on("-" + s.tr(":", " ")) do |val|
-        opt_hash[s.delete(":").intern] = val
+        opt_hash[opt_name] = val
       end
     end
+    long_options.each do |s|
+      opt_name = s[/\A(?:--)?([^\s=]+)/, 1].intern
+      o.on(s.sub(/\A(?!--)/, '--')) do |val|
+        opt_hash[opt_name] = val
+      end
+    end
     o.on("-v") do opt_hash[:verbose] = true end
-    o.parse!
+    o.order!(ARGV) do |x|
+      if /[*?\[{]/ =~ x
+        argv.concat(Dir[x])
+      else
+        argv << x
+      end
+    end
   end
-  yield ARGV, opt_hash
+  yield argv, opt_hash
 end
 
 ##
@@ -214,6 +217,38 @@
 end
 
 ##
+# Create makefile using mkmf.
+#
+#   ruby -run -e mkmf -- [OPTION] EXTNAME [OPTION]
+#
+#   -d ARGS	run dir_config
+#   -h ARGS	run have_header
+#   -l ARGS	run have_library
+#   -f ARGS	run have_func
+#   -v ARGS	run have_var
+#   -t ARGS	run have_type
+#   -m ARGS	run have_macro
+#   -c ARGS	run have_const
+#   --vendor	install to vendor_ruby
+#
+
+def mkmf
+  setup("d:h:l:f:v:t:m:c:", "vendor") do |argv, options|
+    require 'mkmf'
+    opt = options[:d] and opt.split(/:/).each {|n| dir_config(*n.split(/,/))}
+    opt = options[:h] and opt.split(/:/).each {|n| have_header(*n.split(/,/))}
+    opt = options[:l] and opt.split(/:/).each {|n| have_library(*n.split(/,/))}
+    opt = options[:f] and opt.split(/:/).each {|n| have_func(*n.split(/,/))}
+    opt = options[:v] and opt.split(/:/).each {|n| have_var(*n.split(/,/))}
+    opt = options[:t] and opt.split(/:/).each {|n| have_type(*n.split(/,/))}
+    opt = options[:m] and opt.split(/:/).each {|n| have_macro(*n.split(/,/))}
+    opt = options[:c] and opt.split(/:/).each {|n| have_const(*n.split(/,/))}
+    $configure_args["--vendor"] = true if options[:vendor]
+    create_makefile(*argv)
+  end
+end
+
+##
 # Display help message.
 #
 #   ruby -run -e help [COMMAND]
Index: mvm/ChangeLog
===================================================================
--- mvm/ChangeLog	(revision 17595)
+++ mvm/ChangeLog	(revision 17596)
@@ -1,3 +1,7 @@
+Fri Jun 27 12:28:57 2008  Nobuyoshi Nakada  <nobu@r...>
+
+	* lib/un.rb (mkmf): new command to create makefile.
+
 Fri Jun 27 11:06:05 2008  Nobuyoshi Nakada  <nobu@r...>
 
 	* lib/un.rb (wait_writable): added help message.
Index: mvm/lib/un.rb
===================================================================
--- mvm/lib/un.rb	(revision 17595)
+++ mvm/lib/un.rb	(revision 17596)
@@ -20,6 +20,7 @@
 #   ruby -run -e chmod -- [OPTION] OCTAL-MODE FILE
 #   ruby -run -e touch -- [OPTION] FILE
 #   ruby -run -e wait_writable -- [OPTION] FILE
+#   ruby -run -e mkmf -- [OPTION] EXTNAME [OPTION]
 #   ruby -run -e help [COMMAND]
 
 require "fileutils"
@@ -30,30 +31,32 @@
   @fileutils_output = $stdout
 end
 
-def setup(options = "")
-  ARGV.map! do |x|
-    case x
-    when /^-/
-      x.delete "^-#{options}v"
-    when /[*?\[{]/
-      Dir[x]
-    else
-      x
-    end
-  end
-  ARGV.flatten!
-  ARGV.delete_if{|x| x == "-"}
+def setup(options = "", *long_options)
   opt_hash = {}
+  argv = []
   OptionParser.new do |o|
     options.scan(/.:?/) do |s|
+      opt_name = s.delete(":").intern
       o.on("-" + s.tr(":", " ")) do |val|
-        opt_hash[s.delete(":").intern] = val
+        opt_hash[opt_name] = val
       end
     end
+    long_options.each do |s|
+      opt_name = s[/\A(?:--)?([^\s=]+)/, 1].intern
+      o.on(s.sub(/\A(?!--)/, '--')) do |val|
+        opt_hash[opt_name] = val
+      end
+    end
     o.on("-v") do opt_hash[:verbose] = true end
-    o.parse!
+    o.order!(ARGV) do |x|
+      if /[*?\[{]/ =~ x
+        argv.concat(Dir[x])
+      else
+        argv << x
+      end
+    end
   end
-  yield ARGV, opt_hash
+  yield argv, opt_hash
 end
 
 ##
@@ -246,6 +249,38 @@
 end
 
 ##
+# Create makefile using mkmf.
+#
+#   ruby -run -e mkmf -- [OPTION] EXTNAME [OPTION]
+#
+#   -d ARGS	run dir_config
+#   -h ARGS	run have_header
+#   -l ARGS	run have_library
+#   -f ARGS	run have_func
+#   -v ARGS	run have_var
+#   -t ARGS	run have_type
+#   -m ARGS	run have_macro
+#   -c ARGS	run have_const
+#   --vendor	install to vendor_ruby
+#
+
+def mkmf
+  setup("d:h:l:f:v:t:m:c:", "vendor") do |argv, options|
+    require 'mkmf'
+    opt = options[:d] and opt.split(/:/).each {|n| dir_config(*n.split(/,/))}
+    opt = options[:h] and opt.split(/:/).each {|n| have_header(*n.split(/,/))}
+    opt = options[:l] and opt.split(/:/).each {|n| have_library(*n.split(/,/))}
+    opt = options[:f] and opt.split(/:/).each {|n| have_func(*n.split(/,/))}
+    opt = options[:v] and opt.split(/:/).each {|n| have_var(*n.split(/,/))}
+    opt = options[:t] and opt.split(/:/).each {|n| have_type(*n.split(/,/))}
+    opt = options[:m] and opt.split(/:/).each {|n| have_macro(*n.split(/,/))}
+    opt = options[:c] and opt.split(/:/).each {|n| have_const(*n.split(/,/))}
+    $configure_args["--vendor"] = true if options[:vendor]
+    create_makefile(*argv)
+  end
+end
+
+##
 # Display help message.
 #
 #   ruby -run -e help [COMMAND]

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]