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