From: "U.Nakamura" Date: 2002-08-22T03:58:05+09:00 Subject: [ruby-dev:18060] Re: msvcrt こんにちは、なかむら(う)です。 At Aug.21,2002 16:44:22, wrote in '[ruby-dev:18055] Re: msvcrt' > RUBY_PLATFORMじゃなくてCONFIG["arch"]を参照してるようなスク > リプトがあると問題になりそうです。 どれくらいあるでしょうね。 実際には、みんなRUBY_PLATFORMを参照しているような気はします けど。 > > 定数の名前は特によさそうなアイデアがないので保留します。 > > とりあえずRUBY_ORIG_ARCHLIBにしてみました。 > > > あと、rbconfig.rbの中でどんな名前でi386-(mswin32|mingw32)を > > 残すか、も考える必要がありますね。 > > こっちもorig_archに。 特に問題ないと思います。 > > 1.6から1.8へ移行する人の場合はバージョン番号が違うから関係な > > いし、1.7を使ってる人は覚悟の上ということで。 > > Andyさんのinstallerがたぶん面倒なことになります。 > いつのまにか1.7.2も用意されているので。 > http://www.pragmaticprogrammer.com/ruby/downloads/ruby-install.html あ、これがありましたね。 Andyさんはともかく、ただ単にこれを使っている人には厳しいかも。 > それはそれとして実際に作ってみてwin32oleで試してみたら、 > i386-mingw32/rbconfig.rbの存在に騙されました。 > とりあえず古い環境のファイルを消すのも面倒なので、 > いつもと違うディレクトリにインストールしてwin32oleがちゃんと > makeできるか確認してみました。大丈夫そう。 わたなべさんのパッチを元に、同様の趣旨の変更をmswin32関連箇 所に加えてみたところ、それだけだとうまくいかなかったので、 * mkconfig.rbで、TOPDIRの文を変更 * ついでに、origarchdirとsiteorigarchdirをrbconfig.rbに出力 するよう変更 * さらについでに、インストール時にorigarchdirとsiteorigarchdir が作成されるようinstruby.rbを変更 としました。 これでwin32oleで試したところ、わたなべさんのmingw32版と同様 の結果を得ました。 こちらの変更を加えたパッチです([ruby-dev:18055]を含む)。 Index: Makefile.in =================================================================== RCS file: /home/cvs/ruby/Makefile.in,v retrieving revision 1.35 diff -u -1 -p -r1.35 Makefile.in --- Makefile.in 2002/05/14 06:22:25 1.35 +++ Makefile.in 2002/08/21 18:56:46 @@ -143,3 +143,3 @@ fake.rb: miniruby$(EXEEXT) remove_const :RUBY_VERSION; \ - RUBY_PLATFORM = "@arch@"; \ + RUBY_PLATFORM = "@orig_arch@"; \ RUBY_VERSION = "@MAJOR@.@MINOR@.@TEENY@"; \ Index: configure.in =================================================================== RCS file: /home/cvs/ruby/configure.in,v retrieving revision 1.133 diff -u -1 -p -r1.133 configure.in --- configure.in 2002/08/21 07:17:55 1.133 +++ configure.in 2002/08/21 18:56:46 @@ -1047,3 +1047,13 @@ case "$target_os" in cygwin*|mingw*) - RUBY_SO_NAME=$target_os-'$(RUBY_INSTALL_NAME)'${MAJOR}${MINOR} + case "$target_os" in + cygwin*) + RUBY_SO_NAME=$target_os-'$(RUBY_INSTALL_NAME)'${MAJOR}${MINOR} + AC_LIBOBJ([strftime]) + CCDLFLAGS=-DUSEIMPORTLIB ;; + mingw*) + RUBY_SO_NAME=msvcrt-'$(RUBY_INSTALL_NAME)'${MAJOR}${MINOR} + AC_LIBOBJ([win32]) + CFLAGS="-DNT -D__NO_ISOCEXT $CFLAGS" + CCDLFLAGS=-DIMPORT ;; + esac if test x"$enable_shared" = xyes; then @@ -1062,11 +1072,2 @@ case "$target_os" in SOLIBS='$(LIBS)' - case "$target_os" in - cygwin*) - AC_LIBOBJ([strftime]) - CCDLFLAGS=-DUSEIMPORTLIB ;; - mingw*) - AC_LIBOBJ([win32]) - CFLAGS="-DNT -D__NO_ISOCEXT $CFLAGS" - CCDLFLAGS=-DIMPORT ;; - esac ;; @@ -1128,2 +1129,3 @@ AC_DEFINE_UNQUOTED(RUBY_SITE_LIB2, "${RU AC_SUBST(arch)dnl +AC_SUBST(orig_arch)dnl AC_SUBST(sitedir)dnl @@ -1133,2 +1135,3 @@ AC_SUBST(configure_args)dnl + if test "$fat_binary" = yes ; then @@ -1146,2 +1149,12 @@ else fi + +orig_arch="${arch}" + +case "${target_os}" in + mingw*) + arch="i386-msvcrt" + AC_DEFINE_UNQUOTED(RUBY_ORIG_ARCHLIB, "${RUBY_LIB_PATH}/${orig_arch}") + AC_DEFINE_UNQUOTED(RUBY_SITE_ORIG_ARCHLIB, "${RUBY_SITE_LIB_PATH2}/${orig_arch}") + ;; +esac Index: instruby.rb =================================================================== RCS file: /home/cvs/ruby/instruby.rb,v retrieving revision 1.20 diff -u -1 -p -r1.20 instruby.rb --- instruby.rb 2002/06/11 01:27:46 1.20 +++ instruby.rb 2002/08/21 18:56:46 @@ -22,2 +22,3 @@ version = "/"+CONFIG["MAJOR"]+"."+CONFIG arch = "/"+CONFIG["arch"] +orig_arch = "/"+CONFIG["orig_arch"] if CONFIG.include?("orig_arch") @@ -27,4 +28,6 @@ rubylibdir = destdir+CONFIG["prefix"]+"/ archlibdir = rubylibdir+arch +origarchlibdir = rubylibdir+orig_arch if CONFIG.include?("orig_arch") sitelibdir = destdir+CONFIG["sitedir"]+version sitearchlibdir = sitelibdir+arch +siteorigarchlibdir = sitelibdir+orig_arch if CONFIG.include?("orig_arch") mandir = destdir+CONFIG["mandir"] + "/man1" @@ -63,4 +66,6 @@ File.makedirs rubylibdir, true File.makedirs archlibdir, true +File.makedirs origarchlibdir, true if CONFIG.include?("orig_arch") File.makedirs sitelibdir, true File.makedirs sitearchlibdir, true +File.makedirs siteorigarchlibdir, true if CONFIG.include?("orig_arch") Index: mkconfig.rb =================================================================== RCS file: /home/cvs/ruby/mkconfig.rb,v retrieving revision 1.22 diff -u -1 -p -r1.22 mkconfig.rb --- mkconfig.rb 2002/07/29 05:59:46 1.22 +++ mkconfig.rb 2002/08/21 18:56:46 @@ -30,2 +30,4 @@ has_srcdir = false has_version = false +has_orig_arch = false +arch = "" File.foreach "config.status" do |line| @@ -38,3 +40,3 @@ File.foreach "config.status" do |line| name = $1 - val = $2 || "" + val = $2 ? $2.strip.gsub(/\$\{?(\w+)\}?/) {"$(#{$1})"} : "" next if /^(INSTALL|DEFS|configure_input|srcdir|top_srcdir)$/ =~ name @@ -42,4 +44,3 @@ File.foreach "config.status" do |line| next if $so_name and /^RUBY_SO_NAME$/ =~ name - v = " CONFIG[\"" + name + "\"] = " + - val.strip.gsub(/\$\{?(\w+)\}?/) {"$(#{$1})"}.dump + "\n" + v = " CONFIG[\"" + name + "\"] = " + val.dump + "\n" if fast[name] @@ -50,2 +51,4 @@ File.foreach "config.status" do |line| has_version = true if name == "MAJOR" + has_orig_arch = true if name == "orig_arch" + arch = val if name == "arch" elsif /^(?:ac_given_)?srcdir=(.*)/ =~ line @@ -73,3 +76,7 @@ v_fast.collect! do |x| if /"prefix"/ === x - prefix = Regexp.quote('/lib/ruby/' + RUBY_VERSION.sub(/\.\d+$/, '') + '/' + RUBY_PLATFORM) + if has_orig_arch + prefix = Regexp.quote('/lib/ruby/' + RUBY_VERSION.sub(/\.\d+$/, '') + '/' + arch) + else + prefix = Regexp.quote('/lib/ruby/' + RUBY_VERSION.sub(/\.\d+$/, '') + '/' + RUBY_PLATFORM) + end puts " TOPDIR = File.dirname(__FILE__).sub!(%r'#{prefix}\\Z', '')" @@ -96,2 +103,4 @@ print <> $@ - @echo RUBY_SO_NAME = $(OS)-$$(RUBY_INSTALL_NAME)17>> $@ + @echo RUBY_SO_NAME = $(RT)-$$(RUBY_INSTALL_NAME)17>> $@ @echo prefix = /usr>> $@ それでは。 -- U.Nakamura