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

ruby-changes:9901

From: nobu <ko1@a...>
Date: Mon, 12 Jan 2009 12:44:15 +0900 (JST)
Subject: [ruby-changes:9901] Ruby:r21442 (trunk): * instruby.rb (parse_args, install): added --strip option.

nobu	2009-01-12 12:43:57 +0900 (Mon, 12 Jan 2009)

  New Revision: 21442

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=21442

  Log:
    * instruby.rb (parse_args, install): added --strip option.

  Modified files:
    trunk/ChangeLog
    trunk/instruby.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 21441)
+++ ChangeLog	(revision 21442)
@@ -1,12 +1,7 @@
-Mon Jan 12 11:59:19 2009  Koichi Sasada  <ko1@a...>
+Mon Jan 12 12:43:55 2009  Nobuyoshi Nakada  <nobu@r...>
 
-	* gc.c (ruby_xmalloc, ruby_xrealloc, ruby_xfree):
-	  enable to use them without GVL.
-	  if GC is invoked, acquire GVL during GC.
-	  if NoMemoryError is raised, acquire GVL and raise it.
+	* instruby.rb (parse_args, install): added --strip option.
 
-Mon Jan 12 12:39:56 2009  Nobuyoshi Nakada  <nobu@r...>
-
 	* instruby.rb (install_recursive): skips the directory if matched
 	  to a no_install pattern ending with a file separator.
 
@@ -15,6 +10,13 @@
 	* ext/socket/mkconstants.rb: don't use bytesize because 1.9 dependent.
 	  [ruby-core:21266]
 
+Mon Jan 12 11:59:19 2009  Koichi Sasada  <ko1@a...>
+
+	* gc.c (ruby_xmalloc, ruby_xrealloc, ruby_xfree):
+	  enable to use them without GVL.
+	  if GC is invoked, acquire GVL during GC.
+	  if NoMemoryError is raised, acquire GVL and raise it.
+
 Mon Jan 12 10:39:19 2009  Koichi Sasada  <ko1@a...>
 
 	* thread.c: fix comment (terminology: Global VM Lock).
Index: instruby.rb
===================================================================
--- instruby.rb	(revision 21441)
+++ instruby.rb	(revision 21442)
@@ -31,6 +31,7 @@
   $prog_mode = 0755
   $dir_mode = nil
   $script_mode = nil
+  $strip = false
   $cmdtype = ('bat' if File::ALT_SEPARATOR == '\\')
   mflags = []
   opt = OptionParser.new
@@ -64,6 +65,7 @@
   opt.on('--installed-list [FILENAME]') {|name| $installed_list = name}
   opt.on('--rdoc-output [DIR]') {|dir| $rdocdir = dir}
   opt.on('--cmd-type=TYPE', %w[bat cmd plain]) {|cmd| $cmdtype = (cmd unless cmd == 'plain')}
+  opt.on('--[no-]strip') {|strip| $strip = strip}
 
   opt.order!(argv) do |v|
     case v
@@ -131,9 +133,28 @@
   end
 end
 
+def strip_file(file)
+  if !defined?($strip_command) and (cmd = CONFIG["STRIP"])
+    case cmd
+    when "", "true", ":" then return
+    else $strip_command = Shellwords.shellwords(cmd)
+    end
+  elsif !$strip_command
+    return
+  end
+  system(*($strip_command + [file]))
+end
+
 def install(src, dest, options = {})
+  options = options.clone
+  strip = options.delete(:strip)
   options[:preserve] = true
-  super(src, with_destdir(dest), options)
+  d = with_destdir(dest)
+  super(src, d, options)
+  if strip and cmd = 
+    d = File.join(d, File.basename(src)) if $made_dirs[dest]
+    strip_file(d)
+  end
   if $installed_list
     dest = File.join(dest, File.basename(src)) if $made_dirs[dest]
     $installed_list.puts dest
@@ -268,17 +289,17 @@
 
   makedirs [bindir, libdir, archlibdir]
 
-  install ruby_install_name+exeext, bindir, :mode => $prog_mode
+  install ruby_install_name+exeext, bindir, :mode => $prog_mode, :strip => $strip
   if rubyw_install_name and !rubyw_install_name.empty?
-    install rubyw_install_name+exeext, bindir, :mode => $prog_mode
+    install rubyw_install_name+exeext, bindir, :mode => $prog_mode, :strip => $strip
   end
   if File.exist? goruby_install_name+exeext
-    install goruby_install_name+exeext, bindir, :mode => $prog_mode
+    install goruby_install_name+exeext, bindir, :mode => $prog_mode, :strip => $strip
   end
   if enable_shared and dll != lib
-    install dll, bindir, :mode => $prog_mode
+    install dll, bindir, :mode => $prog_mode, :strip => $strip
   end
-  install lib, libdir, :mode => $prog_mode unless lib == arc
+  install lib, libdir, :mode => $prog_mode, :strip => $strip unless lib == arc
   install arc, libdir, :mode => $data_mode
   install "rbconfig.rb", archlibdir, :mode => $data_mode
   if CONFIG["ARCHFILE"]
@@ -300,7 +321,7 @@
     puts "installing extension objects"
     makedirs [archlibdir, sitearchlibdir, vendorarchlibdir, archhdrdir]
     noinst = %w[-*] | (CONFIG["no_install_files"] || "").split
-    install_recursive("#{extout}/#{CONFIG['arch']}", archlibdir, :no_install => noinst, :mode => $prog_mode)
+    install_recursive("#{extout}/#{CONFIG['arch']}", archlibdir, :no_install => noinst, :mode => $prog_mode, :strip => $strip)
     install_recursive("#{extout}/include/#{CONFIG['arch']}", archhdrdir, :glob => "*.h", :mode => $data_mode)
   end
   install?(:ext, :comm, :'ext-comm') do

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

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