mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* common.mk (install-doc): reverted.
* instruby.rb: stores file name list without destdir prefix. * lib/rdoc/generators/ri_generator.rb: do not chdir twice. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10955 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
cd5cfab0e7
commit
8114a2edb0
4 changed files with 121 additions and 68 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
Sun Sep 17 17:42:13 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* common.mk (install-doc): reverted.
|
||||||
|
|
||||||
|
* instruby.rb: stores file name list without destdir prefix.
|
||||||
|
|
||||||
|
* lib/rdoc/generators/ri_generator.rb: do not chdir twice.
|
||||||
|
|
||||||
Sun Sep 17 10:42:10 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Sun Sep 17 10:42:10 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* numeric.c (fix_mul): fixed typo. fixed: [ruby-core:08885]
|
* numeric.c (fix_mul): fixed typo. fixed: [ruby-core:08885]
|
||||||
|
|
13
common.mk
13
common.mk
|
@ -8,6 +8,7 @@ STATIC_RUBY = static-ruby
|
||||||
|
|
||||||
EXTCONF = extconf.rb
|
EXTCONF = extconf.rb
|
||||||
RBCONFIG = ./.rbconfig.time
|
RBCONFIG = ./.rbconfig.time
|
||||||
|
RDOCOUT = $(EXTOUT)/rdoc
|
||||||
|
|
||||||
DMYEXT = dmyext.$(OBJEXT)
|
DMYEXT = dmyext.$(OBJEXT)
|
||||||
MAINOBJ = main.$(OBJEXT)
|
MAINOBJ = main.$(OBJEXT)
|
||||||
|
@ -226,6 +227,18 @@ dont-install-man:
|
||||||
$(MINIRUBY) $(srcdir)/instruby.rb -n $(INSTRUBY_ARGS) --install=man --mantype="$(MANTYPE)"
|
$(MINIRUBY) $(srcdir)/instruby.rb -n $(INSTRUBY_ARGS) --install=man --mantype="$(MANTYPE)"
|
||||||
post-no-install-man::
|
post-no-install-man::
|
||||||
|
|
||||||
|
install-doc: rdoc pre-install-doc do-install-doc post-install-doc
|
||||||
|
do-install-doc: $(PROGRAM)
|
||||||
|
$(RUNRUBY) -run -e cp -- -p -r -v "$(RDOCOUT)" "$(RIDATADIR)"
|
||||||
|
|
||||||
|
rdoc: $(PROGRAM) PHONY
|
||||||
|
@echo Generating RDoc documentation
|
||||||
|
$(RUNRUBY) "$(srcdir)/bin/rdoc" --all --ri --op "$(RDOCOUT)" "$(srcdir)"
|
||||||
|
|
||||||
|
pre-install-doc:: PHONY
|
||||||
|
|
||||||
|
post-install-doc:: PHONY
|
||||||
|
|
||||||
install-prereq:
|
install-prereq:
|
||||||
@exit > $(INSTALLED_LIST)
|
@exit > $(INSTALLED_LIST)
|
||||||
|
|
||||||
|
|
164
instruby.rb
164
instruby.rb
|
@ -23,6 +23,7 @@ def parse_args()
|
||||||
$install = []
|
$install = []
|
||||||
$installed_list = nil
|
$installed_list = nil
|
||||||
$dryrun = false
|
$dryrun = false
|
||||||
|
$rdocdir = nil
|
||||||
opt = OptionParser.new
|
opt = OptionParser.new
|
||||||
opt.on('-n') {$dryrun = true}
|
opt.on('-n') {$dryrun = true}
|
||||||
opt.on('--dest-dir=DIR') {|dir| $destdir = dir}
|
opt.on('--dest-dir=DIR') {|dir| $destdir = dir}
|
||||||
|
@ -40,6 +41,8 @@ def parse_args()
|
||||||
$install << ins
|
$install << ins
|
||||||
end
|
end
|
||||||
opt.on('--installed-list [FILENAME]') {|name| $installed_list = name}
|
opt.on('--installed-list [FILENAME]') {|name| $installed_list = name}
|
||||||
|
opt.on('--rdoc-output') {|dir| $rdocdir = dir}
|
||||||
|
|
||||||
opt.parse! rescue abort [$!.message, opt].join("\n")
|
opt.parse! rescue abort [$!.message, opt].join("\n")
|
||||||
|
|
||||||
$make, *rest = Shellwords.shellwords($make)
|
$make, *rest = Shellwords.shellwords($make)
|
||||||
|
@ -61,7 +64,9 @@ def parse_args()
|
||||||
end
|
end
|
||||||
|
|
||||||
$destdir ||= $mflags.defined?("DESTDIR")
|
$destdir ||= $mflags.defined?("DESTDIR")
|
||||||
$extout ||= $mflags.defined?("EXTOUT")
|
if $extout ||= $mflags.defined?("EXTOUT")
|
||||||
|
Config.expand($extout)
|
||||||
|
end
|
||||||
|
|
||||||
$continue = $mflags.set?(?k)
|
$continue = $mflags.set?(?k)
|
||||||
|
|
||||||
|
@ -70,6 +75,8 @@ def parse_args()
|
||||||
$installed_list = open($installed_list, "ab")
|
$installed_list = open($installed_list, "ab")
|
||||||
$installed_list.sync = true
|
$installed_list.sync = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
$rdocdir ||= $mflags.defined?('RDOCOUT')
|
||||||
end
|
end
|
||||||
|
|
||||||
parse_args()
|
parse_args()
|
||||||
|
@ -79,13 +86,17 @@ include FileUtils::NoWrite if $dryrun
|
||||||
@fileutils_output = STDOUT
|
@fileutils_output = STDOUT
|
||||||
@fileutils_label = ''
|
@fileutils_label = ''
|
||||||
|
|
||||||
def install?(*types)
|
$install_procs = Hash.new {[]}
|
||||||
yield if $install.empty? or !($install & types).empty?
|
def install?(*types, &block)
|
||||||
|
$install_procs[:all] <<= block
|
||||||
|
types.each do |type|
|
||||||
|
$install_procs[type] <<= block
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def install(src, dest, options = {})
|
def install(src, dest, options = {})
|
||||||
options[:preserve] = true
|
options[:preserve] = true
|
||||||
super
|
super(src, with_destdir(dest), options)
|
||||||
if $installed_list
|
if $installed_list
|
||||||
dest = File.join(dest, File.basename(src)) if $made_dirs[dest]
|
dest = File.join(dest, File.basename(src)) if $made_dirs[dest]
|
||||||
$installed_list.puts dest
|
$installed_list.puts dest
|
||||||
|
@ -93,22 +104,45 @@ def install(src, dest, options = {})
|
||||||
end
|
end
|
||||||
|
|
||||||
def ln_sf(src, dest)
|
def ln_sf(src, dest)
|
||||||
super
|
super(src, with_destdir(dest))
|
||||||
$installed_list.puts dest if $installed_list
|
$installed_list.puts dest if $installed_list
|
||||||
end
|
end
|
||||||
|
|
||||||
$made_dirs = {}
|
$made_dirs = {}
|
||||||
def makedirs(dirs)
|
def makedirs(dirs)
|
||||||
dirs = fu_list(dirs)
|
dirs = fu_list(dirs)
|
||||||
dirs.reject! do |dir|
|
dirs.collect! do |dir|
|
||||||
$made_dirs.fetch(dir) do
|
realdir = with_destdir(dir)
|
||||||
|
realdir unless $made_dirs.fetch(dir) do
|
||||||
$made_dirs[dir] = true
|
$made_dirs[dir] = true
|
||||||
File.directory?(dir)
|
File.directory?(realdir)
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
end.compact!
|
||||||
super(dirs, :mode => 0755, :verbose => true) unless dirs.empty?
|
super(dirs, :mode => 0755, :verbose => true) unless dirs.empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def install_recursive(src, dest, options = {})
|
||||||
|
noinst = options.delete(:no_install)
|
||||||
|
subpath = src.size..-1
|
||||||
|
Dir.glob("#{src}/**/*", File::FNM_DOTMATCH) do |src|
|
||||||
|
next if /\A\.{1,2}\z/ =~ (base = File.basename(src))
|
||||||
|
next if noinst and File.fnmatch?(noinst, File.basename(src))
|
||||||
|
d = dest + src[subpath]
|
||||||
|
if File.directory?(src)
|
||||||
|
makedirs(d)
|
||||||
|
else
|
||||||
|
install src, d
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def open_for_install(path, mode, &block)
|
||||||
|
unless $dryrun
|
||||||
|
open(with_destdir(path), mode, &block)
|
||||||
|
end
|
||||||
|
$installed_list.puts path if /^w/ =~ mode and $installed_list
|
||||||
|
end
|
||||||
|
|
||||||
def with_destdir(dir)
|
def with_destdir(dir)
|
||||||
return dir if !$destdir or $destdir.empty?
|
return dir if !$destdir or $destdir.empty?
|
||||||
dir = dir.sub(/\A\w:/, '') if File::PATH_SEPARATOR == ';'
|
dir = dir.sub(/\A\w:/, '') if File::PATH_SEPARATOR == ';'
|
||||||
|
@ -121,39 +155,28 @@ ruby_install_name = CONFIG["ruby_install_name"]
|
||||||
rubyw_install_name = CONFIG["rubyw_install_name"]
|
rubyw_install_name = CONFIG["rubyw_install_name"]
|
||||||
|
|
||||||
version = CONFIG["ruby_version"]
|
version = CONFIG["ruby_version"]
|
||||||
bindir = with_destdir(CONFIG["bindir"])
|
bindir = CONFIG["bindir"]
|
||||||
libdir = with_destdir(CONFIG["libdir"])
|
libdir = CONFIG["libdir"]
|
||||||
rubylibdir = with_destdir(CONFIG["rubylibdir"])
|
rubylibdir = CONFIG["rubylibdir"]
|
||||||
archlibdir = with_destdir(CONFIG["archdir"])
|
archlibdir = CONFIG["archdir"]
|
||||||
sitelibdir = with_destdir(CONFIG["sitelibdir"])
|
sitelibdir = CONFIG["sitelibdir"]
|
||||||
sitearchlibdir = with_destdir(CONFIG["sitearchdir"])
|
sitearchlibdir = CONFIG["sitearchdir"]
|
||||||
mandir = with_destdir(File.join(CONFIG["mandir"], "man"))
|
mandir = File.join(CONFIG["mandir"], "man")
|
||||||
configure_args = Shellwords.shellwords(CONFIG["configure_args"])
|
configure_args = Shellwords.shellwords(CONFIG["configure_args"])
|
||||||
enable_shared = CONFIG["ENABLE_SHARED"] == 'yes'
|
enable_shared = CONFIG["ENABLE_SHARED"] == 'yes'
|
||||||
dll = CONFIG["LIBRUBY_SO"]
|
dll = CONFIG["LIBRUBY_SO"]
|
||||||
lib = CONFIG["LIBRUBY"]
|
lib = CONFIG["LIBRUBY"]
|
||||||
arc = CONFIG["LIBRUBY_A"]
|
arc = CONFIG["LIBRUBY_A"]
|
||||||
|
|
||||||
makedirs [bindir, libdir, rubylibdir, archlibdir, sitelibdir, sitearchlibdir]
|
|
||||||
|
|
||||||
install?(:local, :arch, :bin) do
|
install?(:local, :arch, :bin) do
|
||||||
ruby_bin = File.join(bindir, ruby_install_name)
|
makedirs [bindir, libdir, archlibdir]
|
||||||
|
|
||||||
install ruby_install_name+exeext, ruby_bin+exeext, :mode => 0755
|
install ruby_install_name+exeext, bindir, :mode => 0755
|
||||||
if File.exist?(ruby_install_name+exeext+".manifest")
|
|
||||||
install ruby_install_name+exeext+".manifest", bindir, :mode => 0644
|
|
||||||
end
|
|
||||||
if rubyw_install_name and !rubyw_install_name.empty?
|
if rubyw_install_name and !rubyw_install_name.empty?
|
||||||
install rubyw_install_name+exeext, bindir, :mode => 0755
|
install rubyw_install_name+exeext, bindir, :mode => 0755
|
||||||
if File.exist?(rubyw_install_name+exeext+".manifest")
|
|
||||||
install rubyw_install_name+exeext+".manifest", bindir, :mode => 0644
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
if enable_shared and dll != lib
|
if enable_shared and dll != lib
|
||||||
install dll, bindir, :mode => 0755
|
install dll, bindir, :mode => 0755
|
||||||
if File.exist?(dll+".manifest")
|
|
||||||
install dll+".manifest", bindir, :mode => 0644
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
install lib, libdir, :mode => 0755 unless lib == arc
|
install lib, libdir, :mode => 0755 unless lib == arc
|
||||||
install arc, libdir, :mode => 0644
|
install arc, libdir, :mode => 0644
|
||||||
|
@ -173,40 +196,34 @@ install?(:local, :arch, :bin) do
|
||||||
end
|
end
|
||||||
|
|
||||||
if $extout
|
if $extout
|
||||||
RbConfig.expand(extout = "#$extout")
|
extout = "#$extout"
|
||||||
|
install?(:ext, :arch, :'ext-arch') do
|
||||||
|
makedirs [archlibdir, sitearchlibdir]
|
||||||
if noinst = CONFIG["no_install_files"] and noinst.empty?
|
if noinst = CONFIG["no_install_files"] and noinst.empty?
|
||||||
noinst = nil
|
noinst = nil
|
||||||
end
|
end
|
||||||
dest = rubylibdir
|
install_recursive("#{extout}/#{CONFIG['arch']}", archlibdir, :no_install => noinst)
|
||||||
subpath = nil
|
|
||||||
copy = proc do |s|
|
|
||||||
d = dest + s[subpath]
|
|
||||||
if File.directory?(s)
|
|
||||||
makedirs(d)
|
|
||||||
else
|
|
||||||
install s, d
|
|
||||||
end
|
|
||||||
end
|
|
||||||
install?(:ext, :arch, :'ext-arch') do
|
|
||||||
subpath = extout.size..-1
|
|
||||||
Dir.glob("#{extout}/#{CONFIG['arch']}/**/*", File::FNM_DOTMATCH) do |src|
|
|
||||||
unless /\A\.{1,2}\z/ =~ (base = File.basename(src)) or
|
|
||||||
(noinst and File.fnmatch?(noinst, File.basename(src)))
|
|
||||||
copy[src]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
install?(:ext, :comm, :'ext-comm') do
|
install?(:ext, :comm, :'ext-comm') do
|
||||||
src = "#{extout}/common"
|
makedirs [rubylibdir, sitelibdir]
|
||||||
subpath = src.size..-1
|
install_recursive("#{extout}/common", rubylibdir)
|
||||||
Dir.glob("#{src}/**/*", ©)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Dir.chdir srcdir
|
install?(:rdoc) do
|
||||||
|
if $rdocdir
|
||||||
|
ridatadir = File.join(Config['datadir'], 'ri/$(MAJOR).$(MINOR)/system')
|
||||||
|
Config.expand(ridatadir)
|
||||||
|
makedirs [ridatadir]
|
||||||
|
install_recursive($rdocdir, ridatadir)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
install?(:local, :arch, :lib) do
|
install?(:local, :comm, :bin) do
|
||||||
ruby_shebang = File.join(CONFIG["bindir"], ruby_install_name)
|
Dir.chdir srcdir
|
||||||
|
makedirs [bindir, rubylibdir]
|
||||||
|
|
||||||
|
ruby_shebang = File.join(bindir, ruby_install_name)
|
||||||
if File::ALT_SEPARATOR
|
if File::ALT_SEPARATOR
|
||||||
ruby_bin_dosish = ruby_shebang.tr(File::SEPARATOR, File::ALT_SEPARATOR)
|
ruby_bin_dosish = ruby_shebang.tr(File::SEPARATOR, File::ALT_SEPARATOR)
|
||||||
end
|
end
|
||||||
|
@ -223,7 +240,7 @@ install?(:local, :arch, :lib) do
|
||||||
|
|
||||||
shebang = ''
|
shebang = ''
|
||||||
body = ''
|
body = ''
|
||||||
open(dest, "r+") { |f|
|
open_for_install(dest, "r+") { |f|
|
||||||
shebang = f.gets
|
shebang = f.gets
|
||||||
body = f.read
|
body = f.read
|
||||||
|
|
||||||
|
@ -235,16 +252,16 @@ install?(:local, :arch, :lib) do
|
||||||
}
|
}
|
||||||
|
|
||||||
if ruby_bin_dosish
|
if ruby_bin_dosish
|
||||||
batfile = File.join(CONFIG["bindir"], name + ".bat")
|
batfile = File.join(bindir, name + ".bat")
|
||||||
open(with_destdir(batfile), "wb") { |b|
|
open_for_install(batfile, "wb") {|b|
|
||||||
b.print((<<EOH+shebang+body+<<EOF).gsub(/$/, "\r"))
|
b.print((<<EOH+shebang+body.chomp+<<EOF).gsub(/^\s+/, '').gsub(/^$/, "\r"))
|
||||||
@echo off
|
@echo off
|
||||||
if not "%~d0" == "~d0" goto WinNT
|
@if not "%~d0" == "~d0" goto WinNT
|
||||||
#{ruby_bin_dosish} -x "#{batfile}" %1 %2 %3 %4 %5 %6 %7 %8 %9
|
#{ruby_bin_dosish} -x "#{batfile}" %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||||
goto endofruby
|
@goto endofruby
|
||||||
:WinNT
|
:WinNT
|
||||||
"%~dp0#{ruby_install_name}" -x "%~f0" %*
|
"%~dp0#{ruby_install_name}" -x "%~f0" %*
|
||||||
goto endofruby
|
@goto endofruby
|
||||||
EOH
|
EOH
|
||||||
__END__
|
__END__
|
||||||
:endofruby
|
:endofruby
|
||||||
|
@ -261,23 +278,25 @@ EOF
|
||||||
end
|
end
|
||||||
|
|
||||||
install?(:local, :arch, :bin) do
|
install?(:local, :arch, :bin) do
|
||||||
|
Dir.chdir(srcdir)
|
||||||
|
makedirs [archlibdir]
|
||||||
for f in Dir["*.h"]
|
for f in Dir["*.h"]
|
||||||
install f, archlibdir, :mode => 0644
|
install f, archlibdir, :mode => 0644
|
||||||
end
|
end
|
||||||
|
|
||||||
if RUBY_PLATFORM =~ /mswin32|mingw|bccwin32/
|
if RUBY_PLATFORM =~ /mswin32|mingw|bccwin32/
|
||||||
makedirs File.join(archlibdir, "win32")
|
win32libdir = File.join(archlibdir, "win32")
|
||||||
install "win32/win32.h", File.join(archlibdir, "win32"), :mode => 0644
|
makedirs win32libdir
|
||||||
|
install "win32/win32.h", win32libdir, :mode => 0644
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
install?(:local, :comm, :man) do
|
install?(:local, :comm, :man) do
|
||||||
|
Dir.chdir(srcdir)
|
||||||
for mdoc in Dir["*.[1-9]"]
|
for mdoc in Dir["*.[1-9]"]
|
||||||
next unless File.file?(mdoc) and open(mdoc){|fh| fh.read(1) == '.'}
|
next unless File.file?(mdoc) and open(mdoc){|fh| fh.read(1) == '.'}
|
||||||
|
|
||||||
section = mdoc[-1,1]
|
destdir = mandir + mdoc[/(\d+)$/]
|
||||||
|
|
||||||
destdir = mandir + section
|
|
||||||
destfile = File.join(destdir, mdoc.sub(/ruby/, ruby_install_name))
|
destfile = File.join(destdir, mdoc.sub(/ruby/, ruby_install_name))
|
||||||
|
|
||||||
makedirs destdir
|
makedirs destdir
|
||||||
|
@ -300,4 +319,17 @@ install?(:local, :comm, :man) do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
$install.concat ARGV.collect {|n| n.intern}
|
||||||
|
$install << :local << :ext if $install.empty?
|
||||||
|
$install.each do |inst|
|
||||||
|
$install_procs[inst].each do |block|
|
||||||
|
dir = Dir.pwd
|
||||||
|
begin
|
||||||
|
block.call
|
||||||
|
ensure
|
||||||
|
Dir.chdir(dir)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# vi:set sw=2:
|
# vi:set sw=2:
|
||||||
|
|
|
@ -69,7 +69,7 @@ module Generators
|
||||||
|
|
||||||
def initialize(options) #:not-new:
|
def initialize(options) #:not-new:
|
||||||
@options = options
|
@options = options
|
||||||
@ri_writer = RI::RiWriter.new(options.op_dir)
|
@ri_writer = RI::RiWriter.new(".")
|
||||||
@markup = SM::SimpleMarkup.new
|
@markup = SM::SimpleMarkup.new
|
||||||
@to_flow = SM::ToFlow.new
|
@to_flow = SM::ToFlow.new
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue