From 536e266e58e6fda550e781d7a88317fdfe149cfa Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 9 Nov 2010 22:20:12 +0000 Subject: * cygwin/GNUmakefile.in (scriptbin): make executable file from scripts with stub. * ruby.c (load_file_internal): assume xflag for exe file as well as no-shebang file. * tool/rbinstall.rb: install script programs. * win32/mkexports.rb (Exports#initialize): alias ruby_sysinit for stub. * win32/stub.c: stub for scripts. [EXPERIMENTAL] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29738 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- tool/rbinstall.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'tool') diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb index eec790b3ee..908b586934 100755 --- a/tool/rbinstall.rb +++ b/tool/rbinstall.rb @@ -36,7 +36,9 @@ def parse_args(argv = ARGV) $dir_mode = nil $script_mode = nil $strip = false - $cmdtype = ('bat' if File::ALT_SEPARATOR == '\\') + $cmdtype = (if File::ALT_SEPARATOR == '\\' + File.exist?("rubystub.exe") ? 'exe' : 'bat' + end) mflags = [] opt = OptionParser.new opt.on('-n', '--dry-run') {$dryrun = true} @@ -405,6 +407,9 @@ install?(:local, :comm, :bin, :'bin-comm') do ruby_shebang = File.join(bindir, ruby_install_name) if File::ALT_SEPARATOR ruby_bin = ruby_shebang.tr(File::SEPARATOR, File::ALT_SEPARATOR) + if $cmdtype == 'exe' + stub = File.open("rubystub.exe", "rb") {|f| f.read} << "\n" rescue nil + end end if trans = CONFIG["program_transform_name"] exp = [] @@ -456,6 +461,8 @@ install?(:local, :comm, :bin, :'bin-comm') do cmd << ".#{$cmdtype}" if $cmdtype open_for_install(cmd, $script_mode) do case $cmdtype + when "exe" + stub + shebang + body when "bat" [<<-"EOH".gsub(/^\s+/, ''), shebang, body, "__END__\n:endofruby\n"].join.gsub(/$/, "\r") @echo off -- cgit v1.2.3