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
15
ChangeLog
15
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>
|
Sat Sep 16 11:03:49 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* array.c (ary_shared_first): should create embedded copies
|
* 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>
|
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.
|
* ext/nkf/nkf-8/nkf.c: imported nkf 2.0.8 rev.110.
|
||||||
* Fix: check_bom cuts \xfe\xff\xXX\xXX of UTF-32LE.
|
* Fix: check_bom cuts \xfe\xff\xXX\xXX of UTF-32LE.
|
||||||
* Add support --ic=UTF-32.
|
* Add support --ic=UTF-32.
|
||||||
* Fix: can't guess UTF-16 and UTF-32.
|
* Fix: can't guess UTF-16 and UTF-32.
|
||||||
* Fix: can't decode beyond BMP of UTF-16LE.
|
* Fix: can't decode beyond BMP of UTF-16LE.
|
||||||
|
|
||||||
* ext/nkf/nkf.c (guess): Support UTF-32.
|
* ext/nkf/nkf.c (guess): Support UTF-32.
|
||||||
|
|
||||||
|
|
|
@ -86,6 +86,7 @@ ASFLAGS = @ASFLAGS@
|
||||||
OBJEXT = @OBJEXT@
|
OBJEXT = @OBJEXT@
|
||||||
MANTYPE = @MANTYPE@
|
MANTYPE = @MANTYPE@
|
||||||
|
|
||||||
|
INSTALLED_LIST= .installed.list
|
||||||
#### End of variables
|
#### End of variables
|
||||||
|
|
||||||
all:
|
all:
|
||||||
|
|
160
common.mk
160
common.mk
|
@ -62,10 +62,12 @@ OBJS = array.$(OBJEXT) \
|
||||||
$(MISSING)
|
$(MISSING)
|
||||||
|
|
||||||
SCRIPT_ARGS = --dest-dir="$(DESTDIR)" \
|
SCRIPT_ARGS = --dest-dir="$(DESTDIR)" \
|
||||||
|
--extout="$(EXTOUT)" \
|
||||||
--make="$(MAKE)" \
|
--make="$(MAKE)" \
|
||||||
--mflags="$(MFLAGS)" \
|
--mflags="$(MFLAGS)" \
|
||||||
--make-flags="$(MAKEFLAGS)"
|
--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)
|
all: $(MKFILES) $(PREP) $(RBCONFIG) $(LIBRUBY)
|
||||||
@$(MINIRUBY) $(srcdir)/ext/extmk.rb $(EXTMK_ARGS)
|
@$(MINIRUBY) $(srcdir)/ext/extmk.rb $(EXTMK_ARGS)
|
||||||
|
@ -89,45 +91,143 @@ ruby.imp: $(OBJS)
|
||||||
install: install-nodoc $(RDOCTARGET)
|
install: install-nodoc $(RDOCTARGET)
|
||||||
install-all: install-nodoc install-doc
|
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
|
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
|
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)
|
install-arch: pre-install-arch do-install-arch post-install-arch
|
||||||
$(MINIRUBY) $(srcdir)/instruby.rb $(SCRIPT_ARGS) --mantype="$(MANTYPE)"
|
pre-install-arch:: pre-install-bin pre-install-ext-arch
|
||||||
do-install-ext: $(RBCONFIG)
|
do-install-arch:
|
||||||
$(MINIRUBY) $(srcdir)/ext/extmk.rb $(EXTMK_ARGS) install
|
$(MINIRUBY) $(srcdir)/instruby.rb $(INSTRUBY_ARGS) --install=bin --install=ext-arch
|
||||||
|
post-install-arch:: post-install-bin post-install-ext-arch
|
||||||
|
|
||||||
install-bin: $(RBCONFIG)
|
install-comm: pre-install-comm do-install-comm post-install-comm
|
||||||
$(MINIRUBY) $(srcdir)/instruby.rb $(SCRIPT_ARGS) --install=bin
|
pre-install-comm:: pre-install-lib pre-install-ext-comm pre-install-man
|
||||||
install-lib: $(RBCONFIG)
|
do-install-comm:
|
||||||
$(MINIRUBY) $(srcdir)/instruby.rb $(SCRIPT_ARGS) --install=lib
|
$(MINIRUBY) $(srcdir)/instruby.rb $(INSTRUBY_ARGS) --install=lib --install=ext-comm --install=man
|
||||||
install-man: $(RBCONFIG)
|
post-install-comm:: post-install-lib post-install-ext-comm post-install-man
|
||||||
$(MINIRUBY) $(srcdir)/instruby.rb $(SCRIPT_ARGS) --install=man --mantype="$(MANTYPE)"
|
|
||||||
|
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
|
what-where-local: no-install-local
|
||||||
no-install-local: $(RBCONFIG)
|
no-install-local: pre-no-install-local dont-install-local post-no-install-local
|
||||||
$(MINIRUBY) $(srcdir)/instruby.rb -n $(SCRIPT_ARGS) --mantype="$(MANTYPE)"
|
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
|
what-where-ext: no-install-ext
|
||||||
no-install-ext: $(RBCONFIG)
|
no-install-ext: pre-no-install-ext dont-install-ext post-no-install-ext
|
||||||
$(MINIRUBY) $(srcdir)/ext/extmk.rb -n $(EXTMK_ARGS) install
|
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
|
what-where-arch: no-install-arch
|
||||||
do-install-doc: $(PROGRAM)
|
no-install-arch: pre-no-install-arch dont-install-arch post-no-install-arch
|
||||||
@echo Generating RDoc documentation
|
pre-no-install-arch:: pre-no-install-bin pre-no-install-ext-arch
|
||||||
$(RUNRUBY) "$(srcdir)/bin/rdoc" --all --ri --op "$(RIDATADIR)" "$(srcdir)"
|
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
|
what-where-comm: no-install-comm
|
||||||
pre-install-local:: PHONY
|
no-install-comm: pre-no-install-comm dont-install-comm post-no-install-comm
|
||||||
pre-install-ext:: PHONY
|
pre-no-install-comm:: pre-no-install-lib pre-no-install-ext-comm pre-no-install-man
|
||||||
pre-install-doc:: PHONY
|
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
|
what-where-bin: no-install-bin
|
||||||
post-install-local:: PHONY
|
no-install-bin: pre-no-install-bin dont-install-bin post-no-install-bin
|
||||||
post-install-ext:: PHONY
|
pre-no-install-bin:: install-prereq
|
||||||
post-install-doc:: PHONY
|
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: clean-ext clean-local
|
||||||
clean-local::
|
clean-local::
|
||||||
|
|
10
ext/extmk.rb
10
ext/extmk.rb
|
@ -390,16 +390,8 @@ else
|
||||||
end
|
end
|
||||||
|
|
||||||
if $extout
|
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
|
unless $ignore
|
||||||
|
RbConfig.expand(extout = "#{$extout}", RbConfig::CONFIG.merge("topdir"=>$topdir))
|
||||||
FileUtils.mkpath(extout)
|
FileUtils.mkpath(extout)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
197
instruby.rb
197
instruby.rb
|
@ -17,12 +17,16 @@ File.umask(0)
|
||||||
def parse_args()
|
def parse_args()
|
||||||
$mantype = 'doc'
|
$mantype = 'doc'
|
||||||
$destdir = nil
|
$destdir = nil
|
||||||
|
$extout = nil
|
||||||
$make = 'make'
|
$make = 'make'
|
||||||
$mflags = []
|
$mflags = []
|
||||||
$install = []
|
$install = []
|
||||||
|
$installed_list = nil
|
||||||
|
$dryrun = false
|
||||||
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}
|
||||||
|
opt.on('--extout=DIR') {|dir| $extout = (dir unless dir.empty?)}
|
||||||
opt.on('--make=COMMAND') {|make| $make = make}
|
opt.on('--make=COMMAND') {|make| $make = make}
|
||||||
opt.on('--mantype=MAN') {|man| $mantype = man}
|
opt.on('--mantype=MAN') {|man| $mantype = man}
|
||||||
opt.on('--make-flags=FLAGS', '--mflags', Shellwords) do |v|
|
opt.on('--make-flags=FLAGS', '--mflags', Shellwords) do |v|
|
||||||
|
@ -31,7 +35,11 @@ def parse_args()
|
||||||
end
|
end
|
||||||
$mflags.concat(v)
|
$mflags.concat(v)
|
||||||
end
|
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")
|
opt.parse! rescue abort [$!.message, opt].join("\n")
|
||||||
|
|
||||||
$make, *rest = Shellwords.shellwords($make)
|
$make, *rest = Shellwords.shellwords($make)
|
||||||
|
@ -41,6 +49,10 @@ def parse_args()
|
||||||
grep(/\A-(?!-).*#{'%s' % flag}/i) { return true }
|
grep(/\A-(?!-).*#{'%s' % flag}/i) { return true }
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
def $mflags.defined?(var)
|
||||||
|
grep(/\A#{var}=(.*)/) {return $1}
|
||||||
|
false
|
||||||
|
end
|
||||||
|
|
||||||
if $mflags.set?(?n)
|
if $mflags.set?(?n)
|
||||||
$dryrun = true
|
$dryrun = true
|
||||||
|
@ -48,9 +60,16 @@ def parse_args()
|
||||||
$mflags << '-n' if $dryrun
|
$mflags << '-n' if $dryrun
|
||||||
end
|
end
|
||||||
|
|
||||||
$mflags << "DESTDIR=#{$destdir}"
|
$destdir ||= $mflags.defined?("DESTDIR")
|
||||||
|
$extout ||= $mflags.defined?("EXTOUT")
|
||||||
|
|
||||||
$continue = $mflags.set?(?k)
|
$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
|
end
|
||||||
|
|
||||||
parse_args()
|
parse_args()
|
||||||
|
@ -60,13 +79,22 @@ include FileUtils::NoWrite if $dryrun
|
||||||
@fileutils_output = STDOUT
|
@fileutils_output = STDOUT
|
||||||
@fileutils_label = ''
|
@fileutils_label = ''
|
||||||
|
|
||||||
def install?(type)
|
def install?(*types)
|
||||||
yield if $install.empty? or $install.include?(type)
|
yield if $install.empty? or !($install & types).empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
def install(src, dest, options = {})
|
def install(src, dest, options = {})
|
||||||
options[:preserve] = true
|
options[:preserve] = true
|
||||||
super
|
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
|
end
|
||||||
|
|
||||||
$made_dirs = {}
|
$made_dirs = {}
|
||||||
|
@ -108,7 +136,7 @@ arc = CONFIG["LIBRUBY_A"]
|
||||||
|
|
||||||
makedirs [bindir, libdir, rubylibdir, archlibdir, sitelibdir, sitearchlibdir]
|
makedirs [bindir, libdir, rubylibdir, archlibdir, sitelibdir, sitearchlibdir]
|
||||||
|
|
||||||
install?(:bin) do
|
install?(:local, :arch, :bin) do
|
||||||
ruby_bin = File.join(bindir, ruby_install_name)
|
ruby_bin = File.join(bindir, ruby_install_name)
|
||||||
|
|
||||||
install ruby_install_name+exeext, ruby_bin+exeext, :mode => 0755
|
install ruby_install_name+exeext, ruby_bin+exeext, :mode => 0755
|
||||||
|
@ -144,41 +172,72 @@ install?(:bin) do
|
||||||
end
|
end
|
||||||
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
|
Dir.chdir srcdir
|
||||||
|
|
||||||
install?(:lib) do
|
install?(:local, :arch, :lib) do
|
||||||
ruby_shebang = File.join(CONFIG["bindir"], ruby_install_name)
|
ruby_shebang = File.join(CONFIG["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
|
||||||
for src in Dir["bin/*"]
|
for src in Dir["bin/*"]
|
||||||
next unless File.file?(src)
|
next unless File.file?(src)
|
||||||
next if /\/[.#]|(\.(old|bak|orig|rej|diff|patch|core)|~|\/core)$/i =~ src
|
next if /\/[.#]|(\.(old|bak|orig|rej|diff|patch|core)|~|\/core)$/i =~ src
|
||||||
|
|
||||||
name = ruby_install_name.sub(/ruby/, File.basename(src))
|
name = ruby_install_name.sub(/ruby/, File.basename(src))
|
||||||
dest = File.join(bindir, name)
|
dest = File.join(bindir, name)
|
||||||
|
|
||||||
install src, dest, :mode => 0755
|
install src, dest, :mode => 0755
|
||||||
|
|
||||||
next if $dryrun
|
next if $dryrun
|
||||||
|
|
||||||
shebang = ''
|
shebang = ''
|
||||||
body = ''
|
body = ''
|
||||||
open(dest, "r+") { |f|
|
open(dest, "r+") { |f|
|
||||||
shebang = f.gets
|
shebang = f.gets
|
||||||
body = f.read
|
body = f.read
|
||||||
|
|
||||||
if shebang.sub!(/^\#!.*?ruby\b/) {"#!" + ruby_shebang}
|
if shebang.sub!(/^\#!.*?ruby\b/) {"#!" + ruby_shebang}
|
||||||
f.rewind
|
f.rewind
|
||||||
f.print shebang, body
|
f.print shebang, body
|
||||||
f.truncate(f.pos)
|
f.truncate(f.pos)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
if ruby_bin_dosish
|
if ruby_bin_dosish
|
||||||
batfile = File.join(CONFIG["bindir"], name + ".bat")
|
batfile = File.join(CONFIG["bindir"], name + ".bat")
|
||||||
open(with_destdir(batfile), "w") { |b|
|
open(with_destdir(batfile), "wb") { |b|
|
||||||
b.print <<EOH, shebang, body, <<EOF
|
b.print((<<EOH+shebang+body+<<EOF).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
|
||||||
|
@ -190,55 +249,55 @@ EOH
|
||||||
__END__
|
__END__
|
||||||
:endofruby
|
:endofruby
|
||||||
EOF
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
for f in Dir["lib/**/*{.rb,help-message}"]
|
install?(:local, :comm, :man) do
|
||||||
dir = File.dirname(f).sub!(/\Alib/, rubylibdir) || rubylibdir
|
for mdoc in Dir["*.[1-9]"]
|
||||||
makedirs dir
|
next unless File.file?(mdoc) and open(mdoc){|fh| fh.read(1) == '.'}
|
||||||
install f, dir, :mode => 0644
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
install?(:bin) do
|
section = mdoc[-1,1]
|
||||||
for f in Dir["*.h"]
|
|
||||||
install f, archlibdir, :mode => 0644
|
|
||||||
end
|
|
||||||
|
|
||||||
if RUBY_PLATFORM =~ /mswin32|mingw|bccwin32/
|
destdir = mandir + section
|
||||||
makedirs File.join(archlibdir, "win32")
|
destfile = File.join(destdir, mdoc.sub(/ruby/, ruby_install_name))
|
||||||
install "win32/win32.h", File.join(archlibdir, "win32"), :mode => 0644
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
install?(:man) do
|
makedirs destdir
|
||||||
for mdoc in Dir["*.[1-9]"]
|
|
||||||
next unless File.file?(mdoc) and open(mdoc){|fh| fh.read(1) == '.'}
|
|
||||||
|
|
||||||
section = mdoc[-1,1]
|
if $mantype == "doc"
|
||||||
|
install mdoc, destfile, :mode => 0644
|
||||||
|
else
|
||||||
|
require 'mdoc2man.rb'
|
||||||
|
|
||||||
destdir = mandir + section
|
w = Tempfile.open(mdoc)
|
||||||
destfile = File.join(destdir, mdoc.sub(/ruby/, ruby_install_name))
|
|
||||||
|
|
||||||
makedirs destdir
|
open(mdoc) { |r|
|
||||||
|
Mdoc2Man.mdoc2man(r, w)
|
||||||
|
}
|
||||||
|
|
||||||
if $mantype == "doc"
|
w.close
|
||||||
install mdoc, destfile, :mode => 0644
|
|
||||||
else
|
|
||||||
require 'mdoc2man.rb'
|
|
||||||
|
|
||||||
w = Tempfile.open(mdoc)
|
install w.path, destfile, :mode => 0644
|
||||||
|
end
|
||||||
open(mdoc) { |r|
|
|
||||||
Mdoc2Man.mdoc2man(r, w)
|
|
||||||
}
|
|
||||||
|
|
||||||
w.close
|
|
||||||
|
|
||||||
install w.path, destfile, :mode => 0644
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
# vi:set sw=2:
|
# vi:set sw=2:
|
||||||
|
|
22
lib/mkmf.rb
22
lib/mkmf.rb
|
@ -83,8 +83,8 @@ INSTALL_DIRS = [
|
||||||
def install_dirs(target_prefix = nil)
|
def install_dirs(target_prefix = nil)
|
||||||
if $extout
|
if $extout
|
||||||
dirs = [
|
dirs = [
|
||||||
['RUBYCOMMONDIR', '$(extout)'],
|
['RUBYCOMMONDIR', '$(extout)/common'],
|
||||||
['RUBYLIBDIR', '$(extout)$(target_prefix)'],
|
['RUBYLIBDIR', '$(RUBYCOMMONDIR)/$(target_prefix)'],
|
||||||
['RUBYARCHDIR', '$(extout)/$(arch)$(target_prefix)'],
|
['RUBYARCHDIR', '$(extout)/$(arch)$(target_prefix)'],
|
||||||
['extout', "#$extout"],
|
['extout', "#$extout"],
|
||||||
['extout_prefix', "#$extout_prefix"],
|
['extout_prefix', "#$extout_prefix"],
|
||||||
|
@ -848,7 +848,7 @@ def find_executable0(bin, path = nil)
|
||||||
ext = config_string('EXEEXT')
|
ext = config_string('EXEEXT')
|
||||||
if File.expand_path(bin) == bin
|
if File.expand_path(bin) == bin
|
||||||
return bin if File.executable?(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
|
return nil
|
||||||
end
|
end
|
||||||
if path ||= ENV['PATH']
|
if path ||= ENV['PATH']
|
||||||
|
@ -1207,7 +1207,7 @@ def create_makefile(target, srcprefix = nil)
|
||||||
staticlib = target ? "$(TARGET).#$LIBEXT" : ""
|
staticlib = target ? "$(TARGET).#$LIBEXT" : ""
|
||||||
mfile = open("Makefile", "wb")
|
mfile = open("Makefile", "wb")
|
||||||
mfile.print(*configuration(srcprefix))
|
mfile.print(*configuration(srcprefix))
|
||||||
mfile.print %{
|
mfile.print "
|
||||||
libpath = #{$LIBPATH.join(" ")}
|
libpath = #{$LIBPATH.join(" ")}
|
||||||
LIBPATH = #{libpath}
|
LIBPATH = #{libpath}
|
||||||
DEFFILE = #{deffile}
|
DEFFILE = #{deffile}
|
||||||
|
@ -1226,18 +1226,18 @@ TARGET = #{target}
|
||||||
DLLIB = #{dllib}
|
DLLIB = #{dllib}
|
||||||
EXTSTATIC = #{$static || ""}
|
EXTSTATIC = #{$static || ""}
|
||||||
STATIC_LIB = #{staticlib unless $static.nil?}
|
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]}
|
install_dirs.each {|*d| mfile.print("%-14s= %s\n" % d) if /^[[:upper:]]/ =~ d[0]}
|
||||||
n = ($extout ? '$(RUBYARCHDIR)/' : '') + '$(TARGET).'
|
n = ($extout ? '$(RUBYARCHDIR)/' : '') + '$(TARGET).'
|
||||||
mfile.print %{
|
mfile.print "
|
||||||
TARGET_SO = #{($extout ? '$(RUBYARCHDIR)/' : '')}$(DLLIB)
|
TARGET_SO = #{($extout ? '$(RUBYARCHDIR)/' : '')}$(DLLIB)
|
||||||
CLEANLIBS = #{n}#{CONFIG['DLEXT']} #{n}il? #{n}tds #{n}map
|
CLEANLIBS = #{n}#{CONFIG['DLEXT']} #{n}il? #{n}tds #{n}map
|
||||||
CLEANOBJS = *.#{$OBJEXT} *.#{$LIBEXT} *.s[ol] *.pdb *.exp *.bak
|
CLEANOBJS = *.#{$OBJEXT} *.#{$LIBEXT} *.s[ol] *.pdb *.exp *.bak
|
||||||
|
|
||||||
all: #{$extout ? "install" : target ? "$(DLLIB)" : "Makefile"}
|
all: #{$extout ? "install" : target ? "$(DLLIB)" : "Makefile"}
|
||||||
static: $(STATIC_LIB)#{$extout ? " install-rb" : ""}
|
static: $(STATIC_LIB)#{$extout ? " install-rb" : ""}
|
||||||
}
|
"
|
||||||
mfile.print CLEANINGS
|
mfile.print CLEANINGS
|
||||||
dirs = []
|
dirs = []
|
||||||
mfile.print "install: install-so install-rb\n\n"
|
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}
|
dir.gsub!(/(\$\{\w+)(\})/) {$1+sep+$2}
|
||||||
end
|
end
|
||||||
mfile.print "\t$(INSTALL_PROG) #{f} #{dir}\n"
|
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
|
||||||
end
|
end
|
||||||
mfile.print("install-rb: pre-install-rb install-rb-default\n")
|
mfile.print("install-rb: pre-install-rb install-rb-default\n")
|
||||||
|
@ -1286,6 +1289,9 @@ static: $(STATIC_LIB)#{$extout ? " install-rb" : ""}
|
||||||
sep = ""
|
sep = ""
|
||||||
end
|
end
|
||||||
mfile.print("#{f} $(@D#{sep})\n")
|
mfile.print("#{f} $(@D#{sep})\n")
|
||||||
|
if defined?($installed_list) and !$extout
|
||||||
|
mfile.print("\t@echo #{dest}>>$(INSTALLED_LIST)\n")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue