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
|
|
|
|
|
2002-12-26 13:01:34 -05:00
|
|
|
$:.unshift File.join(CONFIG["srcdir"], "lib")
|
|
|
|
require 'fileutils'
|
|
|
|
require 'shellwords'
|
2002-12-27 11:28:10 -05:00
|
|
|
require 'getopts'
|
2002-12-26 13:01:34 -05:00
|
|
|
|
2000-12-18 04:46:21 -05:00
|
|
|
File.umask(0)
|
2002-10-22 00:19:26 -04:00
|
|
|
|
2002-12-27 11:28:10 -05:00
|
|
|
getopts("n", "make:", "make-flags:")
|
|
|
|
$dryrun = $OPT["n"]
|
|
|
|
Shellwords.shellwords($OPT["make-flags"] || "").grep(/^-[^-]*n/) do
|
|
|
|
break $dryrun = true
|
2002-10-22 00:19:26 -04:00
|
|
|
end
|
2002-12-28 05:32:05 -05:00
|
|
|
ARGV.delete_if{|x|x[0] == ?-}
|
2002-12-27 11:28:10 -05:00
|
|
|
destdir = ARGV[0] || ''
|
1999-01-19 23:59:39 -05:00
|
|
|
|
2002-12-26 13:01:34 -05:00
|
|
|
include FileUtils::Verbose
|
|
|
|
include FileUtils::NoWrite if $dryrun
|
|
|
|
@fileutils_output = STDOUT
|
|
|
|
@fileutils_label = ''
|
|
|
|
alias makelink ln_sf
|
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"]
|
2002-11-18 12:26:03 -05:00
|
|
|
mandir = File.join(destdir+CONFIG["mandir"], "man1")
|
2002-10-23 13:40:36 -04:00
|
|
|
configure_args = Shellwords.shellwords(CONFIG["configure_args"])
|
2002-11-04 06:06:03 -05:00
|
|
|
enable_shared = CONFIG["ENABLE_SHARED"] == 'yes'
|
2002-10-22 00:19:26 -04:00
|
|
|
dll = CONFIG["LIBRUBY_SO"]
|
|
|
|
lib = CONFIG["LIBRUBY"]
|
|
|
|
arc = CONFIG["LIBRUBY_A"]
|
|
|
|
|
2002-12-26 23:23:52 -05:00
|
|
|
makedirs [bindir, libdir, rubylibdir, archlibdir, sitelibdir, sitearchlibdir, mandir]
|
2002-10-22 00:19:26 -04:00
|
|
|
|
2002-12-26 13:01:34 -05:00
|
|
|
install ruby_install_name+exeext, File.join(bindir, ruby_install_name+exeext), 0755
|
2002-10-22 00:19:26 -04:00
|
|
|
if rubyw_install_name and !rubyw_install_name.empty?
|
2002-12-26 13:01:34 -05:00
|
|
|
install rubyw_install_name+exeext, bindir, 0755
|
1999-01-19 23:59:39 -05:00
|
|
|
end
|
2002-12-26 13:01:34 -05:00
|
|
|
install dll, bindir, 0755 if enable_shared and dll != lib
|
|
|
|
install lib, libdir, 0555 unless lib == arc
|
|
|
|
install arc, libdir, 0644
|
|
|
|
install "config.h", archlibdir, 0644
|
|
|
|
install "rbconfig.rb", archlibdir, 0644
|
2002-10-22 00:19:26 -04:00
|
|
|
if CONFIG["ARCHFILE"]
|
|
|
|
for file in CONFIG["ARCHFILE"].split
|
2002-12-26 13:01:34 -05:00
|
|
|
install file, archlibdir, 0644
|
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-12-26 13:01:34 -05:00
|
|
|
makelink(dll, File.join(libdir, link))
|
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-11-18 12:26:03 -05:00
|
|
|
for src in Dir["bin/*"]
|
|
|
|
next unless File.file?(src)
|
2002-11-18 15:16:54 -05:00
|
|
|
next if /\/[.#]|(\.(old|bak|orig|rej|diff|patch|core)|~|\/core)$/i =~ src
|
2002-11-18 11:57:36 -05:00
|
|
|
|
2002-11-18 12:26:03 -05:00
|
|
|
name = ruby_install_name.sub(/ruby/, File.basename(src))
|
|
|
|
dest = File.join(bindir, name)
|
2002-11-18 11:57:36 -05:00
|
|
|
|
2002-12-26 13:01:34 -05:00
|
|
|
install src, dest, 0755
|
2002-11-18 12:26:03 -05:00
|
|
|
|
|
|
|
open(dest, "r+") { |f|
|
2002-11-22 05:22:29 -05:00
|
|
|
shebang = f.gets.sub(/ruby/, ruby_install_name)
|
|
|
|
body = f.read
|
2002-11-18 12:26:03 -05:00
|
|
|
|
|
|
|
f.rewind
|
2002-11-22 05:22:29 -05:00
|
|
|
f.print shebang, body
|
2002-11-18 12:26:03 -05:00
|
|
|
f.truncate(f.pos)
|
2002-11-22 05:22:29 -05:00
|
|
|
f.close
|
|
|
|
|
|
|
|
if RUBY_PLATFORM =~ /mswin32|mingw|bccwin32/
|
|
|
|
open(dest + ".bat", "w") { |b|
|
|
|
|
b.print <<EOH, shebang, body, <<EOF
|
|
|
|
@echo off
|
|
|
|
if "%OS%" == "Windows_NT" goto WinNT
|
|
|
|
ruby -Sx "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
|
|
|
|
goto endofruby
|
|
|
|
:WinNT
|
|
|
|
ruby -Sx "%~nx0" %*
|
|
|
|
goto endofruby
|
|
|
|
EOH
|
|
|
|
__END__
|
|
|
|
:endofruby
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
end
|
2002-11-18 15:09:46 -05:00
|
|
|
} unless $dryrun
|
2002-11-18 11:57:36 -05:00
|
|
|
end
|
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
|
2002-12-26 13:01:34 -05:00
|
|
|
makedirs dir unless File.directory? dir
|
|
|
|
install f, dir, 0644
|
1999-01-19 23:59:39 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
for f in Dir["*.h"]
|
2002-12-26 13:01:34 -05:00
|
|
|
install f, archlibdir, 0644
|
1999-08-13 01:45:20 -04:00
|
|
|
end
|
2002-06-10 21:27:48 -04:00
|
|
|
if RUBY_PLATFORM =~ /mswin32|mingw|bccwin32/
|
2002-12-26 13:01:34 -05:00
|
|
|
makedirs File.join(archlibdir, "win32")
|
|
|
|
install "win32/win32.h", File.join(archlibdir, "win32"), 0644
|
1998-01-16 07:19:09 -05:00
|
|
|
end
|
1999-01-19 23:59:39 -05:00
|
|
|
|
2002-12-26 13:01:34 -05:00
|
|
|
install "ruby.1", File.join(mandir, ruby_install_name+".1"), 0644
|
2002-10-22 00:19:26 -04:00
|
|
|
|
1998-01-16 07:19:09 -05:00
|
|
|
# vi:set sw=2:
|