* instruby.rb: check only `-' option, and use fileutils instead of

ftools.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3224 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2002-12-26 18:01:34 +00:00
parent 2c5e792dd2
commit 888b9a9739
2 changed files with 35 additions and 57 deletions

View File

@ -1,3 +1,8 @@
Fri Dec 27 02:56:58 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* instruby.rb: check only `-' option, and use fileutils instead of
ftools.
Fri Dec 27 02:45:17 2002 Wakou Aoyama <wakou@ruby-lang.org> Fri Dec 27 02:45:17 2002 Wakou Aoyama <wakou@ruby-lang.org>
* lib/net/telnet.rb: Telnet#print not add "\n". * lib/net/telnet.rb: Telnet#print not add "\n".

View File

@ -3,56 +3,30 @@
load "./rbconfig.rb" load "./rbconfig.rb"
include Config include Config
$:.unshift File.join(CONFIG["srcdir"], "lib")
require 'fileutils'
require 'shellwords'
File.umask(0) File.umask(0)
while arg = ARGV.shift while arg = ARGV.shift
case arg case arg
when /^--/ # ignore when /^--make-flags=(.*)/
Shellwords.shellwords($1).grep(/^-[^-]*n/) {break $dryrun = true}
when "-n"
$dryrun = true
when /^-/ when /^-/
$dryrun = /n/ =~ arg
when /=/ # ignore
else else
destdir ||= arg destdir ||= arg
break
end end
end end
destdir ||= '' destdir ||= ''
$:.unshift File.join(CONFIG["srcdir"], "lib") include FileUtils::Verbose
require 'ftools' include FileUtils::NoWrite if $dryrun
require 'shellwords' @fileutils_output = STDOUT
@fileutils_label = ''
class Installer < File; end alias makelink ln_sf
class << Installer
if $dryrun
def makedirs(*dirs)
String === dirs.last or dirs.pop
for dir in dirs
File.directory?(dir) or print "mkdir -p #{dir}\n"
end
end
def install(file, dir, mode = nil, verbose = false)
to = catname(file, dir)
unless FileTest.exist? to and cmp file, to
print "install#{' -m %#o'%mode if mode} #{file} #{dir}\n"
end
end
def makelink(orig, link, verbose = false)
unless File.symlink?(link) and File.readlink(link) == orig
print "ln -sf #{orig} #{link}\n"
end
end
else
require "ftools"
def makelink(orig, link, verbose = false)
if exist? link
delete link
end
symlink orig, link
print "link #{orig} -> #{link}\n"
end
end
end
exeext = CONFIG["EXEEXT"] exeext = CONFIG["EXEEXT"]
@ -73,26 +47,26 @@ dll = CONFIG["LIBRUBY_SO"]
lib = CONFIG["LIBRUBY"] lib = CONFIG["LIBRUBY"]
arc = CONFIG["LIBRUBY_A"] arc = CONFIG["LIBRUBY_A"]
Installer.makedirs bindir, libdir, rubylibdir, archlibdir, sitelibdir, sitearchlibdir, mandir, true makedirs bindir, libdir, rubylibdir, archlibdir, sitelibdir, sitearchlibdir, mandir
Installer.install ruby_install_name+exeext, File.join(bindir, ruby_install_name+exeext), 0755, true install ruby_install_name+exeext, File.join(bindir, ruby_install_name+exeext), 0755
if rubyw_install_name and !rubyw_install_name.empty? if rubyw_install_name and !rubyw_install_name.empty?
Installer.install rubyw_install_name+exeext, bindir, 0755, true install rubyw_install_name+exeext, bindir, 0755
end end
Installer.install dll, bindir, 0755, true if enable_shared and dll != lib install dll, bindir, 0755 if enable_shared and dll != lib
Installer.install lib, libdir, 0555, true unless lib == arc install lib, libdir, 0555 unless lib == arc
Installer.install arc, libdir, 0644, true install arc, libdir, 0644
Installer.install "config.h", archlibdir, 0644, true install "config.h", archlibdir, 0644
Installer.install "rbconfig.rb", archlibdir, 0644, true install "rbconfig.rb", archlibdir, 0644
if CONFIG["ARCHFILE"] if CONFIG["ARCHFILE"]
for file in CONFIG["ARCHFILE"].split for file in CONFIG["ARCHFILE"].split
Installer.install file, archlibdir, 0644, true install file, archlibdir, 0644
end end
end end
if dll == lib and dll != arc if dll == lib and dll != arc
for link in CONFIG["LIBRUBY_ALIASES"].split for link in CONFIG["LIBRUBY_ALIASES"].split
Installer.makelink(dll, File.join(libdir, link), true) makelink(dll, File.join(libdir, link))
end end
end end
@ -105,7 +79,7 @@ for src in Dir["bin/*"]
name = ruby_install_name.sub(/ruby/, File.basename(src)) name = ruby_install_name.sub(/ruby/, File.basename(src))
dest = File.join(bindir, name) dest = File.join(bindir, name)
Installer.install src, dest, 0755, true install src, dest, 0755
open(dest, "r+") { |f| open(dest, "r+") { |f|
shebang = f.gets.sub(/ruby/, ruby_install_name) shebang = f.gets.sub(/ruby/, ruby_install_name)
@ -137,19 +111,18 @@ end
Dir.glob("lib/**/*{.rb,help-message}") do |f| Dir.glob("lib/**/*{.rb,help-message}") do |f|
dir = File.dirname(f).sub!(/\Alib/, rubylibdir) || rubylibdir dir = File.dirname(f).sub!(/\Alib/, rubylibdir) || rubylibdir
Installer.makedirs dir, true unless File.directory? dir makedirs dir unless File.directory? dir
Installer.install f, dir, 0644, true install f, dir, 0644
end end
for f in Dir["*.h"] for f in Dir["*.h"]
Installer.install f, archlibdir, 0644, true install f, archlibdir, 0644
end end
if RUBY_PLATFORM =~ /mswin32|mingw|bccwin32/ if RUBY_PLATFORM =~ /mswin32|mingw|bccwin32/
Installer.makedirs File.join(archlibdir, "win32"), true makedirs File.join(archlibdir, "win32")
Installer.install "win32/win32.h", File.join(archlibdir, "win32"), 0644, true install "win32/win32.h", File.join(archlibdir, "win32"), 0644
end end
Installer.makedirs mandir, true install "ruby.1", File.join(mandir, ruby_install_name+".1"), 0644
Installer.install "ruby.1", File.join(mandir, ruby_install_name+".1"), 0644, true
# vi:set sw=2: # vi:set sw=2: