From: Kouhei Sutou Date: 2008-02-24T20:48:47+09:00 Subject: [ruby-dev:33926] --host=i586-mingw32msvc 須藤です。 --host=i586-mingw32msvcでconfigureしてmsvcrc-ruby190.dllをク ロスコンパイルでビルドするためのパッチです。以下が成功するよ うになります。 % ./configure --host=i586-mingw32msvc % make msvcrt-ruby190.dll クロスコンパイルをしているとき、.rbの中からsystemやpopenなど して外部プロセスを起動するとターゲットホスト上の環境で実行さ れてしまうのでうまくないです。 # ext/extmk.rbも中でsystemしないようにするとext/以下もクロス # コンパイルできるかも。 Index: cygwin/GNUmakefile.in =================================================================== --- cygwin/GNUmakefile.in (revision 15591) +++ cygwin/GNUmakefile.in (working copy) @@ -60,15 +60,24 @@ GNUmakefile: $(srcdir)/cygwin/GNUmakefile.in -ifeq (@target_os@,mingw32) +ifneq ($(findstring mingw32,@target_os@),) $(OBJS) $(MAINOBJ): win32.h $(LIBRUBY_SO): $(RUBYDEF) +ifeq (@target_os@,mingw32) $(RUBYDEF): $(LIBRUBY_A) $(PREP) $(RBCONFIG) $(MINIRUBY) $(srcdir)/win32/mkexports.rb -output=$@ $(LIBRUBY_A) +else +$(RUBYDEF): $(LIBRUBY_A) $(PREP) $(RBCONFIG) + $(NM) --extern --defined $(LIBRUBY_A) | \ + $(MINIRUBY) $(srcdir)/win32/mkexports.rb -output=$@ endif +clean-local:: + @$(RM) $(RUBYDEF) +endif + ifeq (@target_os@,cygwin) cygwin-$(RUBY_INSTALL_NAME)$(MAJOR)$(MINOR)$(TEENY).dll: $(LIBRUBY_A) @NM@ --extern --defined $(LIBRUBY_A) | \ Index: win32/mkexports.rb =================================================================== --- win32/mkexports.rb (revision 15591) +++ win32/mkexports.rb (working copy) @@ -112,6 +112,18 @@ end end +class Exports::MinGW32MSVC < Exports + def each_export(objs) + ARGF.each {|l| yield $1 if / [[:upper:]] _(.*)$/ =~ l} + yield "strcasecmp", "_stricmp" + yield "strncasecmp", "_strnicmp" + end + + def symbols() + @syms.select {|k, v| v}.sort.collect {|k, v| "#{k}=#{v}"} + end +end + class Exports::Mingw < Exports def self.nm @@nm ||= RbConfig::CONFIG["NM"]