mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* Makefile.in, common.in, instruby.rb, ext/extmk.rb, lib/mkmf.rb:
use instruby.rb to install extensions instead of ext/extmk.rb. * instruby.rb: store installed list into the file. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
efc605aead
commit
f06362a4f9
6 changed files with 287 additions and 122 deletions
19
ChangeLog
19
ChangeLog
|
@ -1,3 +1,10 @@
|
|||
Mon Jan 16 16:06:20 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* Makefile.in, common.in, instruby.rb, ext/extmk.rb, lib/mkmf.rb:
|
||||
use instruby.rb to install extensions instead of ext/extmk.rb.
|
||||
|
||||
* instruby.rb: store installed list into the file.
|
||||
|
||||
Sat Sep 16 11:03:49 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* array.c (ary_shared_first): should create embedded copies
|
||||
|
@ -11,10 +18,10 @@ Sat Sep 16 09:37:39 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
|
|||
Fri Sep 15 20:22:15 2006 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* ext/nkf/nkf-8/nkf.c: imported nkf 2.0.8 rev.110.
|
||||
* Fix: check_bom cuts \xfe\xff\xXX\xXX of UTF-32LE.
|
||||
* Add support --ic=UTF-32.
|
||||
* Fix: can't guess UTF-16 and UTF-32.
|
||||
* Fix: can't decode beyond BMP of UTF-16LE.
|
||||
* Fix: check_bom cuts \xfe\xff\xXX\xXX of UTF-32LE.
|
||||
* Add support --ic=UTF-32.
|
||||
* Fix: can't guess UTF-16 and UTF-32.
|
||||
* Fix: can't decode beyond BMP of UTF-16LE.
|
||||
|
||||
* ext/nkf/nkf.c (guess): Support UTF-32.
|
||||
|
||||
|
@ -86,9 +93,9 @@ Wed Sep 13 18:25:18 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
|
|||
[ruby-core:08804]
|
||||
|
||||
Wed Sep 13 16:43:36 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
|
||||
* string.c (rb_str_intern): prohibit interning tainted string.
|
||||
|
||||
|
||||
Wed Sep 13 01:14:02 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* lib/optparse.rb (OptionParser#getopts): works with pre-registered
|
||||
|
|
|
@ -86,6 +86,7 @@ ASFLAGS = @ASFLAGS@
|
|||
OBJEXT = @OBJEXT@
|
||||
MANTYPE = @MANTYPE@
|
||||
|
||||
INSTALLED_LIST= .installed.list
|
||||
#### End of variables
|
||||
|
||||
all:
|
||||
|
|
160
common.mk
160
common.mk
|
@ -62,10 +62,12 @@ OBJS = array.$(OBJEXT) \
|
|||
$(MISSING)
|
||||
|
||||
SCRIPT_ARGS = --dest-dir="$(DESTDIR)" \
|
||||
--extout="$(EXTOUT)" \
|
||||
--make="$(MAKE)" \
|
||||
--mflags="$(MFLAGS)" \
|
||||
--make-flags="$(MAKEFLAGS)"
|
||||
EXTMK_ARGS = $(SCRIPT_ARGS) --extout="$(EXTOUT)" --extension $(EXTS) --extstatic $(EXTSTATIC) --
|
||||
EXTMK_ARGS = $(SCRIPT_ARGS) --extension $(EXTS) --extstatic $(EXTSTATIC) --
|
||||
INSTRUBY_ARGS = $(SCRIPT_ARGS) --installed-list $(INSTALLED_LIST)
|
||||
|
||||
all: $(MKFILES) $(PREP) $(RBCONFIG) $(LIBRUBY)
|
||||
@$(MINIRUBY) $(srcdir)/ext/extmk.rb $(EXTMK_ARGS)
|
||||
|
@ -89,45 +91,143 @@ ruby.imp: $(OBJS)
|
|||
install: install-nodoc $(RDOCTARGET)
|
||||
install-all: install-nodoc install-doc
|
||||
|
||||
install-nodoc: install-local install-ext
|
||||
install-nodoc: pre-install-nodoc do-install-nodoc post-install-nodoc
|
||||
pre-install-nodoc:: pre-install-local pre-install-ext
|
||||
do-install-nodoc:
|
||||
$(MINIRUBY) $(srcdir)/instruby.rb $(INSTRUBY_ARGS) --mantype="$(MANTYPE)"
|
||||
post-install-nodoc:: post-install-local post-install-ext
|
||||
|
||||
install-local: pre-install-local do-install-local post-install-local
|
||||
pre-install-local:: pre-install-bin pre-install-lib pre-install-man
|
||||
do-install-local:
|
||||
$(MINIRUBY) $(srcdir)/instruby.rb $(INSTRUBY_ARGS) --install=local --mantype="$(MANTYPE)"
|
||||
post-install-local:: post-install-bin post-install-lib post-install-man
|
||||
|
||||
install-ext: pre-install-ext do-install-ext post-install-ext
|
||||
pre-install-ext:: pre-install-ext-arch pre-install-ext-comm
|
||||
do-install-ext:
|
||||
$(MINIRUBY) $(srcdir)/instruby.rb $(INSTRUBY_ARGS) --install=ext
|
||||
post-install-ext:: post-install-ext-arch post-install-ext-comm
|
||||
|
||||
do-install-local: $(RBCONFIG)
|
||||
$(MINIRUBY) $(srcdir)/instruby.rb $(SCRIPT_ARGS) --mantype="$(MANTYPE)"
|
||||
do-install-ext: $(RBCONFIG)
|
||||
$(MINIRUBY) $(srcdir)/ext/extmk.rb $(EXTMK_ARGS) install
|
||||
install-arch: pre-install-arch do-install-arch post-install-arch
|
||||
pre-install-arch:: pre-install-bin pre-install-ext-arch
|
||||
do-install-arch:
|
||||
$(MINIRUBY) $(srcdir)/instruby.rb $(INSTRUBY_ARGS) --install=bin --install=ext-arch
|
||||
post-install-arch:: post-install-bin post-install-ext-arch
|
||||
|
||||
install-bin: $(RBCONFIG)
|
||||
$(MINIRUBY) $(srcdir)/instruby.rb $(SCRIPT_ARGS) --install=bin
|
||||
install-lib: $(RBCONFIG)
|
||||
$(MINIRUBY) $(srcdir)/instruby.rb $(SCRIPT_ARGS) --install=lib
|
||||
install-man: $(RBCONFIG)
|
||||
$(MINIRUBY) $(srcdir)/instruby.rb $(SCRIPT_ARGS) --install=man --mantype="$(MANTYPE)"
|
||||
install-comm: pre-install-comm do-install-comm post-install-comm
|
||||
pre-install-comm:: pre-install-lib pre-install-ext-comm pre-install-man
|
||||
do-install-comm:
|
||||
$(MINIRUBY) $(srcdir)/instruby.rb $(INSTRUBY_ARGS) --install=lib --install=ext-comm --install=man
|
||||
post-install-comm:: post-install-lib post-install-ext-comm post-install-man
|
||||
|
||||
install-bin: pre-install-bin do-install-bin post-install-bin
|
||||
pre-install-bin:: install-prereq
|
||||
do-install-bin:
|
||||
$(MINIRUBY) $(srcdir)/instruby.rb $(INSTRUBY_ARGS) --install=bin
|
||||
post-install-bin::
|
||||
|
||||
install-lib: pre-install-lib do-install-lib post-install-lib
|
||||
pre-install-lib:: install-prereq
|
||||
do-install-lib:
|
||||
$(MINIRUBY) $(srcdir)/instruby.rb $(INSTRUBY_ARGS) --install=lib
|
||||
post-install-lib::
|
||||
|
||||
install-ext-comm: pre-install-ext-comm do-install-ext-comm post-install-ext-comm
|
||||
pre-install-ext-comm:: install-prereq
|
||||
do-install-ext-comm:
|
||||
$(MINIRUBY) $(srcdir)/instruby.rb $(INSTRUBY_ARGS) --install=ext-comm
|
||||
post-install-ext-comm::
|
||||
|
||||
install-ext-arch: pre-install-ext-arch do-install-ext-arch post-install-ext-arch
|
||||
pre-install-ext-arch:: install-prereq
|
||||
do-install-ext-arch:
|
||||
$(MINIRUBY) $(srcdir)/instruby.rb $(INSTRUBY_ARGS) --install=ext-arch
|
||||
post-install-ext-arch::
|
||||
|
||||
install-man: pre-install-man do-install-man post-install-man
|
||||
pre-install-man:: install-prereq
|
||||
do-install-man:
|
||||
$(MINIRUBY) $(srcdir)/instruby.rb $(INSTRUBY_ARGS) --install=man --mantype="$(MANTYPE)"
|
||||
post-install-man::
|
||||
|
||||
what-where: no-install
|
||||
no-install: no-install-nodoc $(RDOCTARGET)
|
||||
what-where-all: no-install-all
|
||||
no-install-all: no-install-nodoc
|
||||
|
||||
what-where-nodoc: no-install-nodoc
|
||||
no-install-nodoc: pre-no-install-nodoc dont-install-nodoc post-no-install-nodoc
|
||||
pre-no-install-nodoc:: pre-no-install-local pre-no-install-ext
|
||||
dont-install-nodoc:
|
||||
$(MINIRUBY) $(srcdir)/instruby.rb -n $(INSTRUBY_ARGS) --mantype="$(MANTYPE)"
|
||||
post-no-install-nodoc:: post-no-install-local post-no-install-ext
|
||||
|
||||
what-where-all no-install-all: no-install no-install-doc
|
||||
what-where no-install: no-install-local no-install-ext
|
||||
what-where-local: no-install-local
|
||||
no-install-local: $(RBCONFIG)
|
||||
$(MINIRUBY) $(srcdir)/instruby.rb -n $(SCRIPT_ARGS) --mantype="$(MANTYPE)"
|
||||
no-install-local: pre-no-install-local dont-install-local post-no-install-local
|
||||
pre-no-install-local:: pre-no-install-bin pre-no-install-lib pre-no-install-man
|
||||
dont-install-local:
|
||||
$(MINIRUBY) $(srcdir)/instruby.rb -n $(INSTRUBY_ARGS) --install=local --mantype="$(MANTYPE)"
|
||||
post-no-install-local:: post-no-install-bin post-no-install-lib post-no-install-man
|
||||
|
||||
what-where-ext: no-install-ext
|
||||
no-install-ext: $(RBCONFIG)
|
||||
$(MINIRUBY) $(srcdir)/ext/extmk.rb -n $(EXTMK_ARGS) install
|
||||
no-install-ext: pre-no-install-ext dont-install-ext post-no-install-ext
|
||||
pre-no-install-ext:: pre-no-install-ext-arch pre-no-install-ext-comm
|
||||
dont-install-ext:
|
||||
$(MINIRUBY) $(srcdir)/instruby.rb -n $(INSTRUBY_ARGS) --install=ext
|
||||
post-no-install-ext:: post-no-install-ext-arch post-no-install-ext-comm
|
||||
|
||||
install-doc: pre-install-doc do-install-doc post-install-doc
|
||||
do-install-doc: $(PROGRAM)
|
||||
@echo Generating RDoc documentation
|
||||
$(RUNRUBY) "$(srcdir)/bin/rdoc" --all --ri --op "$(RIDATADIR)" "$(srcdir)"
|
||||
what-where-arch: no-install-arch
|
||||
no-install-arch: pre-no-install-arch dont-install-arch post-no-install-arch
|
||||
pre-no-install-arch:: pre-no-install-bin pre-no-install-ext-arch
|
||||
dont-install-arch:
|
||||
$(MINIRUBY) $(srcdir)/instruby.rb -n $(INSTRUBY_ARGS) --install=bin --install=ext-arch
|
||||
post-no-install-arch:: post-no-install-lib post-no-install-man post-no-install-ext-arch
|
||||
|
||||
pre-install: pre-install-local pre-install-ext
|
||||
pre-install-local:: PHONY
|
||||
pre-install-ext:: PHONY
|
||||
pre-install-doc:: PHONY
|
||||
what-where-comm: no-install-comm
|
||||
no-install-comm: pre-no-install-comm dont-install-comm post-no-install-comm
|
||||
pre-no-install-comm:: pre-no-install-lib pre-no-install-ext-comm pre-no-install-man
|
||||
dont-install-comm:
|
||||
$(MINIRUBY) $(srcdir)/instruby.rb -n $(INSTRUBY_ARGS) --install=lib --install=ext-comm --install=man
|
||||
post-no-install-comm:: post-no-install-lib post-no-install-ext-comm post-no-install-man
|
||||
|
||||
post-install: post-install-local post-install-ext
|
||||
post-install-local:: PHONY
|
||||
post-install-ext:: PHONY
|
||||
post-install-doc:: PHONY
|
||||
what-where-bin: no-install-bin
|
||||
no-install-bin: pre-no-install-bin dont-install-bin post-no-install-bin
|
||||
pre-no-install-bin:: install-prereq
|
||||
dont-install-bin:
|
||||
$(MINIRUBY) $(srcdir)/instruby.rb -n $(INSTRUBY_ARGS) --install=bin
|
||||
post-no-install-bin::
|
||||
|
||||
what-where-lib: no-install-lib
|
||||
no-install-lib: pre-no-install-lib dont-install-lib post-no-install-lib
|
||||
pre-no-install-lib:: install-prereq
|
||||
dont-install-lib:
|
||||
$(MINIRUBY) $(srcdir)/instruby.rb -n $(INSTRUBY_ARGS) --install=lib
|
||||
post-no-install-lib::
|
||||
|
||||
what-where-ext-comm: no-install-ext-comm
|
||||
no-install-ext-comm: pre-no-install-ext-comm dont-install-ext-comm post-no-install-ext-comm
|
||||
pre-no-install-ext-comm:: install-prereq
|
||||
dont-install-ext-comm:
|
||||
$(MINIRUBY) $(srcdir)/instruby.rb -n $(INSTRUBY_ARGS) --install=ext-comm
|
||||
post-no-install-ext-comm::
|
||||
|
||||
what-where-ext-arch: no-install-ext-arch
|
||||
no-install-ext-arch: pre-no-install-ext-arch dont-install-ext-arch post-no-install-ext-arch
|
||||
pre-no-install-ext-arch:: install-prereq
|
||||
dont-install-ext-arch:
|
||||
$(MINIRUBY) $(srcdir)/instruby.rb -n $(INSTRUBY_ARGS) --install=ext-arch
|
||||
post-no-install-ext-arch::
|
||||
|
||||
what-where-man: no-install-man
|
||||
no-install-man: pre-no-install-man dont-install-man post-no-install-man
|
||||
pre-no-install-man:: install-prereq
|
||||
dont-install-man:
|
||||
$(MINIRUBY) $(srcdir)/instruby.rb -n $(INSTRUBY_ARGS) --install=man --mantype="$(MANTYPE)"
|
||||
post-no-install-man::
|
||||
|
||||
install-prereq:
|
||||
@exit > $(INSTALLED_LIST)
|
||||
|
||||
clean: clean-ext clean-local
|
||||
clean-local::
|
||||
|
|
10
ext/extmk.rb
10
ext/extmk.rb
|
@ -390,16 +390,8 @@ else
|
|||
end
|
||||
|
||||
if $extout
|
||||
RbConfig.expand(extout = "#{$extout}", RbConfig::CONFIG.merge("topdir"=>$topdir))
|
||||
if $install
|
||||
dest = RbConfig.expand($rubylibdir.dup)
|
||||
unless $destdir.empty?
|
||||
dest.sub!($dest_prefix_pattern, RbConfig.expand($destdir.dup))
|
||||
end
|
||||
FileUtils.cp_r(extout+"/.", dest, :remove_destination => true, :verbose => true, :noop => $dryrun)
|
||||
exit
|
||||
end
|
||||
unless $ignore
|
||||
RbConfig.expand(extout = "#{$extout}", RbConfig::CONFIG.merge("topdir"=>$topdir))
|
||||
FileUtils.mkpath(extout)
|
||||
end
|
||||
end
|
||||
|
|
197
instruby.rb
197
instruby.rb
|
@ -17,12 +17,16 @@ File.umask(0)
|
|||
def parse_args()
|
||||
$mantype = 'doc'
|
||||
$destdir = nil
|
||||
$extout = nil
|
||||
$make = 'make'
|
||||
$mflags = []
|
||||
$install = []
|
||||
$installed_list = nil
|
||||
$dryrun = false
|
||||
opt = OptionParser.new
|
||||
opt.on('-n') {$dryrun = true}
|
||||
opt.on('--dest-dir=DIR') {|dir| $destdir = dir}
|
||||
opt.on('--extout=DIR') {|dir| $extout = (dir unless dir.empty?)}
|
||||
opt.on('--make=COMMAND') {|make| $make = make}
|
||||
opt.on('--mantype=MAN') {|man| $mantype = man}
|
||||
opt.on('--make-flags=FLAGS', '--mflags', Shellwords) do |v|
|
||||
|
@ -31,7 +35,11 @@ def parse_args()
|
|||
end
|
||||
$mflags.concat(v)
|
||||
end
|
||||
opt.on('--install=TYPE', [:bin, :lib, :man]) {|ins| $install << ins}
|
||||
opt.on('-i', '--install=TYPE',
|
||||
[:local, :bin, :lib, :man, :ext, :"ext-arch", :"ext-comm"]) do |ins|
|
||||
$install << ins
|
||||
end
|
||||
opt.on('--installed-list [FILENAME]') {|name| $installed_list = name}
|
||||
opt.parse! rescue abort [$!.message, opt].join("\n")
|
||||
|
||||
$make, *rest = Shellwords.shellwords($make)
|
||||
|
@ -41,6 +49,10 @@ def parse_args()
|
|||
grep(/\A-(?!-).*#{'%s' % flag}/i) { return true }
|
||||
false
|
||||
end
|
||||
def $mflags.defined?(var)
|
||||
grep(/\A#{var}=(.*)/) {return $1}
|
||||
false
|
||||
end
|
||||
|
||||
if $mflags.set?(?n)
|
||||
$dryrun = true
|
||||
|
@ -48,9 +60,16 @@ def parse_args()
|
|||
$mflags << '-n' if $dryrun
|
||||
end
|
||||
|
||||
$mflags << "DESTDIR=#{$destdir}"
|
||||
$destdir ||= $mflags.defined?("DESTDIR")
|
||||
$extout ||= $mflags.defined?("EXTOUT")
|
||||
|
||||
$continue = $mflags.set?(?k)
|
||||
|
||||
if $installed_list ||= $mflags.defined?('INSTALLED_LIST')
|
||||
Config.expand($installed_list, Config::CONFIG)
|
||||
$installed_list = open($installed_list, "ab")
|
||||
$installed_list.sync = true
|
||||
end
|
||||
end
|
||||
|
||||
parse_args()
|
||||
|
@ -60,13 +79,22 @@ include FileUtils::NoWrite if $dryrun
|
|||
@fileutils_output = STDOUT
|
||||
@fileutils_label = ''
|
||||
|
||||
def install?(type)
|
||||
yield if $install.empty? or $install.include?(type)
|
||||
def install?(*types)
|
||||
yield if $install.empty? or !($install & types).empty?
|
||||
end
|
||||
|
||||
def install(src, dest, options = {})
|
||||
options[:preserve] = true
|
||||
super
|
||||
if $installed_list
|
||||
dest = File.join(dest, File.basename(src)) if $made_dirs[dest]
|
||||
$installed_list.puts dest
|
||||
end
|
||||
end
|
||||
|
||||
def ln_sf(src, dest)
|
||||
super
|
||||
$installed_list.puts dest if $installed_list
|
||||
end
|
||||
|
||||
$made_dirs = {}
|
||||
|
@ -108,7 +136,7 @@ arc = CONFIG["LIBRUBY_A"]
|
|||
|
||||
makedirs [bindir, libdir, rubylibdir, archlibdir, sitelibdir, sitearchlibdir]
|
||||
|
||||
install?(:bin) do
|
||||
install?(:local, :arch, :bin) do
|
||||
ruby_bin = File.join(bindir, ruby_install_name)
|
||||
|
||||
install ruby_install_name+exeext, ruby_bin+exeext, :mode => 0755
|
||||
|
@ -144,41 +172,72 @@ install?(:bin) do
|
|||
end
|
||||
end
|
||||
|
||||
if $extout
|
||||
RbConfig.expand(extout = "#$extout")
|
||||
if noinst = CONFIG["no_install_files"] and noinst.empty?
|
||||
noinst = nil
|
||||
end
|
||||
dest = rubylibdir
|
||||
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
|
||||
install?(:ext, :comm, :'ext-comm') do
|
||||
src = "#{extout}/common"
|
||||
subpath = src.size..-1
|
||||
Dir.glob("#{src}/**/*", ©)
|
||||
end
|
||||
end
|
||||
|
||||
Dir.chdir srcdir
|
||||
|
||||
install?(:lib) do
|
||||
ruby_shebang = File.join(CONFIG["bindir"], ruby_install_name)
|
||||
if File::ALT_SEPARATOR
|
||||
ruby_bin_dosish = ruby_shebang.tr(File::SEPARATOR, File::ALT_SEPARATOR)
|
||||
end
|
||||
for src in Dir["bin/*"]
|
||||
next unless File.file?(src)
|
||||
next if /\/[.#]|(\.(old|bak|orig|rej|diff|patch|core)|~|\/core)$/i =~ src
|
||||
install?(:local, :arch, :lib) do
|
||||
ruby_shebang = File.join(CONFIG["bindir"], ruby_install_name)
|
||||
if File::ALT_SEPARATOR
|
||||
ruby_bin_dosish = ruby_shebang.tr(File::SEPARATOR, File::ALT_SEPARATOR)
|
||||
end
|
||||
for src in Dir["bin/*"]
|
||||
next unless File.file?(src)
|
||||
next if /\/[.#]|(\.(old|bak|orig|rej|diff|patch|core)|~|\/core)$/i =~ src
|
||||
|
||||
name = ruby_install_name.sub(/ruby/, File.basename(src))
|
||||
dest = File.join(bindir, name)
|
||||
name = ruby_install_name.sub(/ruby/, File.basename(src))
|
||||
dest = File.join(bindir, name)
|
||||
|
||||
install src, dest, :mode => 0755
|
||||
install src, dest, :mode => 0755
|
||||
|
||||
next if $dryrun
|
||||
next if $dryrun
|
||||
|
||||
shebang = ''
|
||||
body = ''
|
||||
open(dest, "r+") { |f|
|
||||
shebang = f.gets
|
||||
body = f.read
|
||||
shebang = ''
|
||||
body = ''
|
||||
open(dest, "r+") { |f|
|
||||
shebang = f.gets
|
||||
body = f.read
|
||||
|
||||
if shebang.sub!(/^\#!.*?ruby\b/) {"#!" + ruby_shebang}
|
||||
f.rewind
|
||||
f.print shebang, body
|
||||
f.truncate(f.pos)
|
||||
end
|
||||
}
|
||||
if shebang.sub!(/^\#!.*?ruby\b/) {"#!" + ruby_shebang}
|
||||
f.rewind
|
||||
f.print shebang, body
|
||||
f.truncate(f.pos)
|
||||
end
|
||||
}
|
||||
|
||||
if ruby_bin_dosish
|
||||
batfile = File.join(CONFIG["bindir"], name + ".bat")
|
||||
open(with_destdir(batfile), "w") { |b|
|
||||
b.print <<EOH, shebang, body, <<EOF
|
||||
if ruby_bin_dosish
|
||||
batfile = File.join(CONFIG["bindir"], name + ".bat")
|
||||
open(with_destdir(batfile), "wb") { |b|
|
||||
b.print((<<EOH+shebang+body+<<EOF).gsub(/$/, "\r"))
|
||||
@echo off
|
||||
if not "%~d0" == "~d0" goto WinNT
|
||||
#{ruby_bin_dosish} -x "#{batfile}" %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
|
@ -190,55 +249,55 @@ EOH
|
|||
__END__
|
||||
:endofruby
|
||||
EOF
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
for f in Dir["lib/**/*{.rb,help-message}"]
|
||||
dir = File.dirname(f).sub!(/\Alib/, rubylibdir) || rubylibdir
|
||||
makedirs dir
|
||||
install f, dir, :mode => 0644
|
||||
end
|
||||
end
|
||||
|
||||
install?(:local, :arch, :bin) do
|
||||
for f in Dir["*.h"]
|
||||
install f, archlibdir, :mode => 0644
|
||||
end
|
||||
|
||||
if RUBY_PLATFORM =~ /mswin32|mingw|bccwin32/
|
||||
makedirs File.join(archlibdir, "win32")
|
||||
install "win32/win32.h", File.join(archlibdir, "win32"), :mode => 0644
|
||||
end
|
||||
end
|
||||
|
||||
for f in Dir["lib/**/*{.rb,help-message}"]
|
||||
dir = File.dirname(f).sub!(/\Alib/, rubylibdir) || rubylibdir
|
||||
makedirs dir
|
||||
install f, dir, :mode => 0644
|
||||
end
|
||||
end
|
||||
install?(:local, :comm, :man) do
|
||||
for mdoc in Dir["*.[1-9]"]
|
||||
next unless File.file?(mdoc) and open(mdoc){|fh| fh.read(1) == '.'}
|
||||
|
||||
install?(:bin) do
|
||||
for f in Dir["*.h"]
|
||||
install f, archlibdir, :mode => 0644
|
||||
end
|
||||
section = mdoc[-1,1]
|
||||
|
||||
if RUBY_PLATFORM =~ /mswin32|mingw|bccwin32/
|
||||
makedirs File.join(archlibdir, "win32")
|
||||
install "win32/win32.h", File.join(archlibdir, "win32"), :mode => 0644
|
||||
end
|
||||
end
|
||||
destdir = mandir + section
|
||||
destfile = File.join(destdir, mdoc.sub(/ruby/, ruby_install_name))
|
||||
|
||||
install?(:man) do
|
||||
for mdoc in Dir["*.[1-9]"]
|
||||
next unless File.file?(mdoc) and open(mdoc){|fh| fh.read(1) == '.'}
|
||||
makedirs destdir
|
||||
|
||||
section = mdoc[-1,1]
|
||||
if $mantype == "doc"
|
||||
install mdoc, destfile, :mode => 0644
|
||||
else
|
||||
require 'mdoc2man.rb'
|
||||
|
||||
destdir = mandir + section
|
||||
destfile = File.join(destdir, mdoc.sub(/ruby/, ruby_install_name))
|
||||
w = Tempfile.open(mdoc)
|
||||
|
||||
makedirs destdir
|
||||
open(mdoc) { |r|
|
||||
Mdoc2Man.mdoc2man(r, w)
|
||||
}
|
||||
|
||||
if $mantype == "doc"
|
||||
install mdoc, destfile, :mode => 0644
|
||||
else
|
||||
require 'mdoc2man.rb'
|
||||
w.close
|
||||
|
||||
w = Tempfile.open(mdoc)
|
||||
|
||||
open(mdoc) { |r|
|
||||
Mdoc2Man.mdoc2man(r, w)
|
||||
}
|
||||
|
||||
w.close
|
||||
|
||||
install w.path, destfile, :mode => 0644
|
||||
install w.path, destfile, :mode => 0644
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# vi:set sw=2:
|
||||
|
|
22
lib/mkmf.rb
22
lib/mkmf.rb
|
@ -83,8 +83,8 @@ INSTALL_DIRS = [
|
|||
def install_dirs(target_prefix = nil)
|
||||
if $extout
|
||||
dirs = [
|
||||
['RUBYCOMMONDIR', '$(extout)'],
|
||||
['RUBYLIBDIR', '$(extout)$(target_prefix)'],
|
||||
['RUBYCOMMONDIR', '$(extout)/common'],
|
||||
['RUBYLIBDIR', '$(RUBYCOMMONDIR)/$(target_prefix)'],
|
||||
['RUBYARCHDIR', '$(extout)/$(arch)$(target_prefix)'],
|
||||
['extout', "#$extout"],
|
||||
['extout_prefix', "#$extout_prefix"],
|
||||
|
@ -848,7 +848,7 @@ def find_executable0(bin, path = nil)
|
|||
ext = config_string('EXEEXT')
|
||||
if File.expand_path(bin) == bin
|
||||
return bin if File.executable?(bin)
|
||||
return file if ext and File.executable?(file = bin + ext)
|
||||
ext and File.executable?(file = bin + ext) and return file
|
||||
return nil
|
||||
end
|
||||
if path ||= ENV['PATH']
|
||||
|
@ -1207,7 +1207,7 @@ def create_makefile(target, srcprefix = nil)
|
|||
staticlib = target ? "$(TARGET).#$LIBEXT" : ""
|
||||
mfile = open("Makefile", "wb")
|
||||
mfile.print(*configuration(srcprefix))
|
||||
mfile.print %{
|
||||
mfile.print "
|
||||
libpath = #{$LIBPATH.join(" ")}
|
||||
LIBPATH = #{libpath}
|
||||
DEFFILE = #{deffile}
|
||||
|
@ -1226,18 +1226,18 @@ TARGET = #{target}
|
|||
DLLIB = #{dllib}
|
||||
EXTSTATIC = #{$static || ""}
|
||||
STATIC_LIB = #{staticlib unless $static.nil?}
|
||||
|
||||
}
|
||||
#{!$extout && defined?($installed_list) ? "INSTALLED_LIST = #{$installed_list}\n" : ""}
|
||||
"
|
||||
install_dirs.each {|*d| mfile.print("%-14s= %s\n" % d) if /^[[:upper:]]/ =~ d[0]}
|
||||
n = ($extout ? '$(RUBYARCHDIR)/' : '') + '$(TARGET).'
|
||||
mfile.print %{
|
||||
mfile.print "
|
||||
TARGET_SO = #{($extout ? '$(RUBYARCHDIR)/' : '')}$(DLLIB)
|
||||
CLEANLIBS = #{n}#{CONFIG['DLEXT']} #{n}il? #{n}tds #{n}map
|
||||
CLEANOBJS = *.#{$OBJEXT} *.#{$LIBEXT} *.s[ol] *.pdb *.exp *.bak
|
||||
|
||||
all: #{$extout ? "install" : target ? "$(DLLIB)" : "Makefile"}
|
||||
static: $(STATIC_LIB)#{$extout ? " install-rb" : ""}
|
||||
}
|
||||
"
|
||||
mfile.print CLEANINGS
|
||||
dirs = []
|
||||
mfile.print "install: install-so install-rb\n\n"
|
||||
|
@ -1259,6 +1259,9 @@ static: $(STATIC_LIB)#{$extout ? " install-rb" : ""}
|
|||
dir.gsub!(/(\$\{\w+)(\})/) {$1+sep+$2}
|
||||
end
|
||||
mfile.print "\t$(INSTALL_PROG) #{f} #{dir}\n"
|
||||
if defined?($installed_list)
|
||||
mfile.print "\t@echo #{dir}/#{File.basename(f)}>>$(INSTALLED_LIST)\n"
|
||||
end
|
||||
end
|
||||
end
|
||||
mfile.print("install-rb: pre-install-rb install-rb-default\n")
|
||||
|
@ -1286,6 +1289,9 @@ static: $(STATIC_LIB)#{$extout ? " install-rb" : ""}
|
|||
sep = ""
|
||||
end
|
||||
mfile.print("#{f} $(@D#{sep})\n")
|
||||
if defined?($installed_list) and !$extout
|
||||
mfile.print("\t@echo #{dest}>>$(INSTALLED_LIST)\n")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue