diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-01-12 03:43:57 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-01-12 03:43:57 +0000 |
commit | 8217bcfc4e1b13a7668539a4e22e661191498026 (patch) | |
tree | 563e2d0e8c0bb0858bf9b49612bb3cfafd53d9cf | |
parent | e780f475d5041ee660a7c0cfb7d341d1af3526c1 (diff) | |
download | ruby-8217bcfc4e1b13a7668539a4e22e661191498026.tar.gz ruby-8217bcfc4e1b13a7668539a4e22e661191498026.tar.xz ruby-8217bcfc4e1b13a7668539a4e22e661191498026.zip |
* instruby.rb (parse_args, install): added --strip option.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@21442 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 16 | ||||
-rwxr-xr-x | instruby.rb | 35 |
2 files changed, 37 insertions, 14 deletions
@@ -1,11 +1,6 @@ -Mon Jan 12 11:59:19 2009 Koichi Sasada <ko1@atdot.net> +Mon Jan 12 12:43:55 2009 Nobuyoshi Nakada <nobu@ruby-lang.org> - * 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 12:39:56 2009 Nobuyoshi Nakada <nobu@ruby-lang.org> + * instruby.rb (parse_args, install): added --strip option. * instruby.rb (install_recursive): skips the directory if matched to a no_install pattern ending with a file separator. @@ -15,6 +10,13 @@ Mon Jan 12 12:33:56 2009 Tanaka Akira <akr@fsij.org> * 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@atdot.net> + + * 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@atdot.net> * thread.c: fix comment (terminology: Global VM Lock). diff --git a/instruby.rb b/instruby.rb index 9af1fffb6..ae7ddd962 100755 --- a/instruby.rb +++ b/instruby.rb @@ -31,6 +31,7 @@ def parse_args(argv = ARGV) $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 @@ def parse_args(argv = ARGV) 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 @@ def install?(*types, &block) 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 @@ install?(:local, :arch, :bin, :'bin-arch') do 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 @@ if $extout 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 |