diff --git a/ChangeLog b/ChangeLog index 1dcf7a17b0..18651571b3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed Jan 7 17:13:38 2009 Nobuyoshi Nakada + + * instruby.rb (gem), lib/rubygems/defaults.rb (Gem.default_dir): + use version invariant configuration. + Tue Jan 6 19:09:51 2009 Nobuyoshi Nakada * cont.c (cont_restore_0): streamlined to ensure O(1) time. based on diff --git a/common.mk b/common.mk index 6550b1236c..2c673ee506 100644 --- a/common.mk +++ b/common.mk @@ -102,6 +102,7 @@ SCRIPT_ARGS = --dest-dir="$(DESTDIR)" \ --make-flags="$(MAKEFLAGS)" EXTMK_ARGS = $(SCRIPT_ARGS) --extension $(EXTS) --extstatic $(EXTSTATIC) \ --make-flags="MINIRUBY='$(MINIRUBY)'" -- +INSTRUBY = $(MINIRUBY) $(srcdir)/instruby.rb INSTRUBY_ARGS = $(SCRIPT_ARGS) \ --data-mode=$(INSTALL_DATA_MODE) \ --prog-mode=$(INSTALL_PROG_MODE) \ @@ -166,72 +167,72 @@ install-all: install-nodoc install-doc install-capi install-nodoc: pre-install-nodoc do-install-nodoc post-install-nodoc pre-install-nodoc:: pre-install-local pre-install-ext do-install-nodoc: $(PREP) - $(MINIRUBY) $(srcdir)/instruby.rb --make="$(MAKE)" $(INSTRUBY_ARGS) --mantype="$(MANTYPE)" + $(INSTRUBY) --make="$(MAKE)" $(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: $(PREP) - $(MINIRUBY) $(srcdir)/instruby.rb --make="$(MAKE)" $(INSTRUBY_ARGS) --install=local --mantype="$(MANTYPE)" + $(INSTRUBY) --make="$(MAKE)" $(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: $(PREP) - $(MINIRUBY) $(srcdir)/instruby.rb --make="$(MAKE)" $(INSTRUBY_ARGS) --install=ext + $(INSTRUBY) --make="$(MAKE)" $(INSTRUBY_ARGS) --install=ext post-install-ext:: post-install-ext-arch post-install-ext-comm install-arch: pre-install-arch do-install-arch post-install-arch pre-install-arch:: pre-install-bin pre-install-ext-arch do-install-arch: $(PREP) - $(MINIRUBY) $(srcdir)/instruby.rb --make="$(MAKE)" $(INSTRUBY_ARGS) --install=bin --install=ext-arch + $(INSTRUBY) --make="$(MAKE)" $(INSTRUBY_ARGS) --install=bin --install=ext-arch post-install-arch:: post-install-bin post-install-ext-arch 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: $(PREP) - $(MINIRUBY) $(srcdir)/instruby.rb --make="$(MAKE)" $(INSTRUBY_ARGS) --install=lib --install=ext-comm --install=man + $(INSTRUBY) --make="$(MAKE)" $(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: $(PREP) - $(MINIRUBY) $(srcdir)/instruby.rb --make="$(MAKE)" $(INSTRUBY_ARGS) --install=bin + $(INSTRUBY) --make="$(MAKE)" $(INSTRUBY_ARGS) --install=bin post-install-bin:: @$(NULLCMD) install-lib: pre-install-lib do-install-lib post-install-lib pre-install-lib:: install-prereq do-install-lib: $(PREP) - $(MINIRUBY) $(srcdir)/instruby.rb --make="$(MAKE)" $(INSTRUBY_ARGS) --install=lib + $(INSTRUBY) --make="$(MAKE)" $(INSTRUBY_ARGS) --install=lib post-install-lib:: @$(NULLCMD) 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: $(PREP) - $(MINIRUBY) $(srcdir)/instruby.rb --make="$(MAKE)" $(INSTRUBY_ARGS) --install=ext-comm + $(INSTRUBY) --make="$(MAKE)" $(INSTRUBY_ARGS) --install=ext-comm post-install-ext-comm:: @$(NULLCMD) 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: $(PREP) - $(MINIRUBY) $(srcdir)/instruby.rb --make="$(MAKE)" $(INSTRUBY_ARGS) --install=ext-arch + $(INSTRUBY) --make="$(MAKE)" $(INSTRUBY_ARGS) --install=ext-arch post-install-ext-arch:: @$(NULLCMD) install-man: pre-install-man do-install-man post-install-man pre-install-man:: install-prereq do-install-man: $(PREP) - $(MINIRUBY) $(srcdir)/instruby.rb --make="$(MAKE)" $(INSTRUBY_ARGS) --install=man --mantype="$(MANTYPE)" + $(INSTRUBY) --make="$(MAKE)" $(INSTRUBY_ARGS) --install=man --mantype="$(MANTYPE)" post-install-man:: @$(NULLCMD) install-capi: capi pre-install-capi do-install-capi post-install-capi pre-install-capi:: install-prereq do-install-capi: $(PREP) - $(MINIRUBY) $(srcdir)/instruby.rb --make="$(MAKE)" $(INSTRUBY_ARGS) --install=capi + $(INSTRUBY) --make="$(MAKE)" $(INSTRUBY_ARGS) --install=capi post-install-capi:: @$(NULLCMD) @@ -244,42 +245,42 @@ 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: $(PREP) - $(MINIRUBY) $(srcdir)/instruby.rb -n --make="$(MAKE)" $(INSTRUBY_ARGS) --mantype="$(MANTYPE)" + $(INSTRUBY) -n --make="$(MAKE)" $(INSTRUBY_ARGS) --mantype="$(MANTYPE)" post-no-install-nodoc:: post-no-install-local post-no-install-ext what-where-local: no-install-local 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: $(PREP) - $(MINIRUBY) $(srcdir)/instruby.rb -n --make="$(MAKE)" $(INSTRUBY_ARGS) --install=local --mantype="$(MANTYPE)" + $(INSTRUBY) -n --make="$(MAKE)" $(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: 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: $(PREP) - $(MINIRUBY) $(srcdir)/instruby.rb -n --make="$(MAKE)" $(INSTRUBY_ARGS) --install=ext + $(INSTRUBY) -n --make="$(MAKE)" $(INSTRUBY_ARGS) --install=ext post-no-install-ext:: post-no-install-ext-arch post-no-install-ext-comm 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: $(PREP) - $(MINIRUBY) $(srcdir)/instruby.rb -n --make="$(MAKE)" $(INSTRUBY_ARGS) --install=bin --install=ext-arch + $(INSTRUBY) -n --make="$(MAKE)" $(INSTRUBY_ARGS) --install=bin --install=ext-arch post-no-install-arch:: post-no-install-lib post-no-install-man post-no-install-ext-arch 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: $(PREP) - $(MINIRUBY) $(srcdir)/instruby.rb -n --make="$(MAKE)" $(INSTRUBY_ARGS) --install=lib --install=ext-comm --install=man + $(INSTRUBY) -n --make="$(MAKE)" $(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 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: $(PREP) - $(MINIRUBY) $(srcdir)/instruby.rb -n --make="$(MAKE)" $(INSTRUBY_ARGS) --install=bin + $(INSTRUBY) -n --make="$(MAKE)" $(INSTRUBY_ARGS) --install=bin post-no-install-bin:: @$(NULLCMD) @@ -287,7 +288,7 @@ 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: $(PREP) - $(MINIRUBY) $(srcdir)/instruby.rb -n --make="$(MAKE)" $(INSTRUBY_ARGS) --install=lib + $(INSTRUBY) -n --make="$(MAKE)" $(INSTRUBY_ARGS) --install=lib post-no-install-lib:: @$(NULLCMD) @@ -295,7 +296,7 @@ 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: $(PREP) - $(MINIRUBY) $(srcdir)/instruby.rb -n --make="$(MAKE)" $(INSTRUBY_ARGS) --install=ext-comm + $(INSTRUBY) -n --make="$(MAKE)" $(INSTRUBY_ARGS) --install=ext-comm post-no-install-ext-comm:: @$(NULLCMD) @@ -303,7 +304,7 @@ 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: $(PREP) - $(MINIRUBY) $(srcdir)/instruby.rb -n --make="$(MAKE)" $(INSTRUBY_ARGS) --install=ext-arch + $(INSTRUBY) -n --make="$(MAKE)" $(INSTRUBY_ARGS) --install=ext-arch post-no-install-ext-arch:: @$(NULLCMD) @@ -311,14 +312,14 @@ 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: $(PREP) - $(MINIRUBY) $(srcdir)/instruby.rb -n --make="$(MAKE)" $(INSTRUBY_ARGS) --install=man --mantype="$(MANTYPE)" + $(INSTRUBY) -n --make="$(MAKE)" $(INSTRUBY_ARGS) --install=man --mantype="$(MANTYPE)" post-no-install-man:: @$(NULLCMD) install-doc: rdoc pre-install-doc do-install-doc post-install-doc pre-install-doc:: install-prereq do-install-doc: $(PROGRAM) - $(MINIRUBY) $(srcdir)/instruby.rb --make="$(MAKE)" $(INSTRUBY_ARGS) --install=rdoc --rdoc-output="$(RDOCOUT)" + $(INSTRUBY) --make="$(MAKE)" $(INSTRUBY_ARGS) --install=rdoc --rdoc-output="$(RDOCOUT)" post-install-doc:: @$(NULLCMD) @@ -330,7 +331,7 @@ what-where-doc: no-install-doc no-install-doc: pre-no-install-doc dont-install-doc post-no-install-doc pre-no-install-doc:: install-prereq dont-install-doc:: $(PREP) - $(MINIRUBY) $(srcdir)/instruby.rb -n --make="$(MAKE)" $(INSTRUBY_ARGS) --install=rdoc --rdoc-output="$(RDOCOUT)" + $(INSTRUBY) -n --make="$(MAKE)" $(INSTRUBY_ARGS) --install=rdoc --rdoc-output="$(RDOCOUT)" post-no-install-doc:: @$(NULLCMD) diff --git a/instruby.rb b/instruby.rb index ea9ef2a582..ff7de147cf 100755 --- a/instruby.rb +++ b/instruby.rb @@ -5,13 +5,14 @@ include RbConfig $".unshift File.expand_path("./rbconfig.rb") srcdir = File.dirname(__FILE__) -$:.unshift File.expand_path("lib", srcdir) +unless defined?(CROSS_COMPILING) and CROSS_COMPILING + $:.replace([File.expand_path("lib", srcdir), Dir.pwd]) +end require 'fileutils' require 'shellwords' require 'optparse' require 'optparse/shellwords' require 'tempfile' -require 'rdoc/ri/paths' STDOUT.sync = true File.umask(0) @@ -394,17 +395,13 @@ install?(:local, :comm, :man) do if $mantype == "doc" install mdoc, destfile, :mode => $data_mode else - require "../tool/mdoc2man.rb" - - w = Tempfile.open(mdoc) - - open(mdoc) { |r| - Mdoc2Man.mdoc2man(r, w) - } - - w.close + require File.join(srcdir, "tool/mdoc2man.rb") + Tempfile.open(mdoc) do |w| + open(mdoc) {|r| Mdoc2Man.mdoc2man(r, w)} + end install w.path, destfile, :mode => $data_mode + w.close! end end end @@ -412,7 +409,7 @@ end install?(:local, :comm, :gem) do puts "creating default gem directories" - gpath = Gem.default_dir + gpath = CONFIG["sitelibdir"].sub(%r'/site_ruby/(?=[^/]+)', '/gems/') makedirs Gem::DIRECTORIES.collect {|dir| File.join(gpath, dir)} end diff --git a/lib/rubygems/defaults.rb b/lib/rubygems/defaults.rb index 7884fad83d..995b81e1b2 100644 --- a/lib/rubygems/defaults.rb +++ b/lib/rubygems/defaults.rb @@ -20,12 +20,8 @@ module Gem if defined? RUBY_FRAMEWORK_VERSION then File.join File.dirname(ConfigMap[:sitedir]), 'Gems', ConfigMap[:ruby_version] - elsif RUBY_VERSION > '1.9' then - File.join(ConfigMap[:libdir], ConfigMap[:ruby_install_name], 'gems', - ConfigMap[:ruby_version]) else - File.join(ConfigMap[:libdir], ruby_engine, 'gems', - ConfigMap[:ruby_version]) + ConfigMap[:sitelibdir].sub(%r'/site_ruby/(?=[^/]+)', '/gems/') end end