なかだです。

At Wed, 13 Jun 2001 23:10:13 +0900,
U.Nakamura <usa / osb.att.ne.jp> wrote:
> # 他にも手元には幾つかありますが、これは別途 :-)

  .def 関係のパッチです。

* .def ファイルをコンパイルするディレクトリじゃなくてソースディ
  レクトリから探す
* 自動で作った .def ファイルを distclean で消す
* mswin でも .def ファイルを使う


Index: ext/extmk.rb.in =================================================================== RCS file: /cvs/ruby/src/ruby/ext/extmk.rb.in,v retrieving revision 1.48 diff -u -2 -p -r1.48 extmk.rb.in --- ext/extmk.rb.in 2001/06/09 07:41:44 1.48 +++ ext/extmk.rb.in 2001/06/13 23:57:59 @@ -385,21 +385,27 @@ def create_makefile(target) end + $srcdir = $top_srcdir + "/ext/" + $mdir + cleans = [""] defflag = '' - if RUBY_PLATFORM =~ /cygwin|mingw/ and not $static - if not File.exist? target + '.def' - open(target + '.def', 'wb') do |f| + if RUBY_PLATFORM =~ /cygwin|mingw|mswin/ and not $static + deffile = target + '.def' + if File.exist? File.join($srcdir, deffile) + deffile = '$(srcdir)/' + deffile + else + open(deffile, 'wb') do |f| f.print "EXPORTS\n", "Init_", target, "\n" end + cleans << deffile end - defflag = "--def=" + target + ".def" + defflag = "--def=" + deffile unless /mswin/ =~ RUBY_PLATFORM end if RUBY_PLATFORM =~ /mswin32/ - libpath = $LIBPATH.join(';') + $local_flags << " -def:" + deffile + libpath = $LIBPATH.collect {|d| File.extern_path(d)}.join(';') else $LIBPATH.each {|d| $DLDFLAGS << " -L" << d} end - $srcdir = $top_srcdir + "/ext/" + $mdir mfile = open("Makefile", "w") mfile.binmode if /mingw/ =~ RUBY_PLATFORM @@ -447,5 +453,5 @@ archdir = $(pkglibdir)/@arch@ if !$objs then $objs = [] - for f in Dir["#{$top_srcdir}/ext/#{$mdir}/*.{#{SRC_EXT.join(%q{,})}}"] + for f in Dir["#{$srcdir}/*.{#{SRC_EXT.join(%q{,})}}"] f = File.basename(f) f.sub!(/(#{SRC_EXT.join(%q{|})})$/, $OBJEXT) @@ -483,5 +489,5 @@ clean:; @$(RM) *.#{$OBJEXT} *.so *.sl * distclean: clean - @$(RM) Makefile extconf.h conftest.* + @$(RM) Makefile extconf.h conftest.*#{cleans.join(" ")} @$(RM) core ruby$(EXEEXT) *~ @@ -614,5 +620,5 @@ def extmake(target) if /mswin32/ =~ RUBY_PLATFORM $LIBEXT = "lib" - $local_flags = "-link /INCREMENTAL:no /EXPORT:Init_$(TARGET)" + $local_flags = "-link -incremental:no" end $LOCAL_LIBS = "" # to be assigned in extconf.rb Index: lib/mkmf.rb =================================================================== RCS file: /cvs/ruby/src/ruby/lib/mkmf.rb,v retrieving revision 1.56 diff -u -2 -p -r1.56 mkmf.rb --- lib/mkmf.rb 2001/06/12 05:23:56 1.56 +++ lib/mkmf.rb 2001/06/13 23:56:03 @@ -387,15 +387,22 @@ def create_makefile(target, srcdir = Fil $LIBPATH |= [CONFIG["libdir"]] + srcdir ||= '.' + cleans = [""] defflag = '' - if RUBY_PLATFORM =~ /cygwin|mingw/ - if not File.exist? target + '.def' - open(target + '.def', 'wb') do |f| + if RUBY_PLATFORM =~ /cygwin|mingw|mswin/ + deffile = target + '.def' + if File.exist? File.join(srcdir, deffile) + deffile = '$(srcdir)/' + deffile + else + open(deffile, 'wb') do |f| f.print "EXPORTS\n", "Init_", target, "\n" end + cleans << deffile end - defflag = "--def=" + target + ".def" + defflag = "--def=" + deffile unless /mswin/ =~ RUBY_PLATFORM end if RUBY_PLATFORM =~ /mswin32/ + $local_flags << " -def:" + deffile libpath = $LIBPATH.join(';') else @@ -406,5 +413,5 @@ def create_makefile(target, srcdir = Fil unless $objs then $objs = [] - for f in Dir[File.join(srcdir || ".", "*.{#{SRC_EXT.join(%q{,})}}")] + for f in Dir[File.join(srcdir, "*.{#{SRC_EXT.join(%q{,})}}")] f = File.basename(f) f.sub!(/(#{SRC_EXT.join(%q{|})})$/, $OBJEXT) @@ -425,5 +432,5 @@ SHELL = /bin/sh #### Start of system configuration section. #### -srcdir = #{srcdir || $srcdir} +srcdir = #{srcdir} topdir = #{$topdir} hdrdir = #{$hdrdir} @@ -480,5 +487,5 @@ clean:; @$(RM) *.#{$OBJEXT} *.so *.sl * distclean: clean - @$(RM) Makefile extconf.h conftest.* + @$(RM) Makefile extconf.h conftest.*#{cleans.join(" ")} @$(RM) core ruby$(EXEEXT) *~ @@ -589,5 +596,5 @@ $local_flags = "" case RUBY_PLATFORM when /mswin32/ - $local_flags = "-link /INCREMENTAL:no /EXPORT:Init_$(TARGET)" + $local_flags = "-link -incremental:no" end $LOCAL_LIBS = ""
-- --- 僕の前にBugはない。 --- 僕の後ろにBugはできる。 中田 伸悦