2000-09-01 07:31:05 +04:00
|
|
|
#!./miniruby
|
1999-01-20 07:59:39 +03:00
|
|
|
|
2000-09-01 07:31:05 +04:00
|
|
|
load "./rbconfig.rb"
|
1998-01-16 15:19:09 +03:00
|
|
|
include Config
|
|
|
|
|
2000-12-18 12:46:21 +03:00
|
|
|
File.umask(0)
|
2002-10-22 08:19:26 +04:00
|
|
|
|
|
|
|
while arg = ARGV.shift
|
|
|
|
case arg
|
|
|
|
when /^--/ # ignore
|
|
|
|
when /^-/
|
|
|
|
$dryrun = /n/ =~ arg
|
|
|
|
when /=/ # ignore
|
|
|
|
else
|
|
|
|
destdir ||= arg
|
|
|
|
break
|
|
|
|
end
|
|
|
|
end
|
|
|
|
destdir ||= ''
|
1999-01-20 07:59:39 +03:00
|
|
|
|
1998-01-16 15:19:09 +03:00
|
|
|
$:.unshift CONFIG["srcdir"]+"/lib"
|
2002-10-22 08:19:26 +04:00
|
|
|
require 'ftools'
|
1998-01-16 15:19:09 +03:00
|
|
|
|
2002-10-22 08:19:26 +04:00
|
|
|
class Installer < File; end
|
|
|
|
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
|
1998-01-16 15:19:09 +03:00
|
|
|
end
|
2000-02-17 10:11:22 +03:00
|
|
|
|
2002-10-22 08:19:26 +04:00
|
|
|
exeext = CONFIG["EXEEXT"]
|
|
|
|
|
1998-01-16 15:19:09 +03:00
|
|
|
ruby_install_name = CONFIG["ruby_install_name"]
|
2002-10-22 08:19:26 +04:00
|
|
|
rubyw_install_name = CONFIG["rubyw_install_name"]
|
2000-02-17 10:11:22 +03:00
|
|
|
|
2002-10-22 08:19:26 +04:00
|
|
|
version = CONFIG["ruby_version"]
|
1999-08-13 09:45:20 +04:00
|
|
|
bindir = destdir+CONFIG["bindir"]
|
|
|
|
libdir = destdir+CONFIG["libdir"]
|
2002-10-22 08:19:26 +04:00
|
|
|
rubylibdir = destdir+CONFIG["rubylibdir"]
|
|
|
|
archlibdir = destdir+CONFIG["archdir"]
|
|
|
|
sitelibdir = destdir+CONFIG["sitelibdir"]
|
|
|
|
sitearchlibdir = destdir+CONFIG["sitearchdir"]
|
1999-08-13 09:45:20 +04:00
|
|
|
mandir = destdir+CONFIG["mandir"] + "/man1"
|
2002-10-22 08:19:26 +04:00
|
|
|
dll = CONFIG["LIBRUBY_SO"]
|
|
|
|
lib = CONFIG["LIBRUBY"]
|
|
|
|
arc = CONFIG["LIBRUBY_A"]
|
|
|
|
|
|
|
|
Installer.makedirs bindir, libdir, rubylibdir, archlibdir, sitelibdir, sitearchlibdir, mandir, true
|
|
|
|
|
|
|
|
Installer.install ruby_install_name+exeext, bindir+"/"+ruby_install_name+exeext, 0755, true
|
|
|
|
if rubyw_install_name and !rubyw_install_name.empty?
|
|
|
|
Installer.install rubyw_install_name+exeext, bindir, 0755, true
|
1999-01-20 07:59:39 +03:00
|
|
|
end
|
2002-10-22 08:19:26 +04:00
|
|
|
Installer.install dll, bindir, 0755, true unless dll == lib
|
|
|
|
Installer.install lib, libdir, 0555, true unless lib == arc
|
|
|
|
Installer.install arc, archlibdir, 0644, true
|
|
|
|
Installer.install "config.h", archlibdir, 0644, true
|
|
|
|
Installer.install "rbconfig.rb", archlibdir, 0644, true
|
|
|
|
if CONFIG["ARCHFILE"]
|
|
|
|
for file in CONFIG["ARCHFILE"].split
|
|
|
|
Installer.install file, archlibdir, 0644, true
|
1999-01-20 07:59:39 +03:00
|
|
|
end
|
|
|
|
end
|
2002-10-22 08:19:26 +04:00
|
|
|
|
|
|
|
if dll == lib and dll != arc
|
1999-08-13 09:45:20 +04:00
|
|
|
for link in CONFIG["LIBRUBY_ALIASES"].split
|
2002-10-22 08:19:26 +04:00
|
|
|
Installer.makelink(dll, File.join(libdir, link), true)
|
1999-08-13 09:45:20 +04:00
|
|
|
end
|
|
|
|
end
|
2002-09-08 13:08:15 +04:00
|
|
|
|
1998-01-16 15:19:09 +03:00
|
|
|
Dir.chdir CONFIG["srcdir"]
|
1999-08-13 09:45:20 +04:00
|
|
|
|
2002-10-22 08:19:26 +04:00
|
|
|
Installer.install "sample/irb.rb", "#{bindir}/irb", 0755, true
|
2000-07-14 08:34:43 +04:00
|
|
|
|
2002-10-22 08:19:26 +04:00
|
|
|
Dir.glob("lib/*{.rb,help-message}") do |f|
|
|
|
|
dir = File.dirname(f).sub!(/\Alib/, rubylibdir) || rubylibdir
|
|
|
|
Installer.makedirs dir, true unless File.directory? dir
|
|
|
|
Installer.install f, dir, 0644, true
|
1999-01-20 07:59:39 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
for f in Dir["*.h"]
|
2002-10-22 08:19:26 +04:00
|
|
|
Installer.install f, archlibdir, 0644, true
|
1999-08-13 09:45:20 +04:00
|
|
|
end
|
2002-06-11 05:27:48 +04:00
|
|
|
if RUBY_PLATFORM =~ /mswin32|mingw|bccwin32/
|
2002-10-22 08:19:26 +04:00
|
|
|
Installer.makedirs archlibdir + "/win32", true
|
|
|
|
Installer.install "win32/win32.h", archlibdir + "/win32", 0644, true
|
1998-01-16 15:19:09 +03:00
|
|
|
end
|
1999-01-20 07:59:39 +03:00
|
|
|
|
2002-10-22 08:19:26 +04:00
|
|
|
Installer.makedirs mandir, true
|
|
|
|
Installer.install "ruby.1", mandir+"/"+ruby_install_name+".1", 0644, true
|
|
|
|
|
1998-01-16 15:19:09 +03:00
|
|
|
# vi:set sw=2:
|