From d2e61b41f50ef1688dac98f6c48dd44c80ac5c6e Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 3 Mar 2017 09:27:27 +0000 Subject: zlib for mingw * ext/zlib/extconf.rb: fix building zlib for mingw, and for cross-compiling. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/zlib/extconf.rb | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'ext/zlib') diff --git a/ext/zlib/extconf.rb b/ext/zlib/extconf.rb index d3aa1b23c2..fd2f168522 100644 --- a/ext/zlib/extconf.rb +++ b/ext/zlib/extconf.rb @@ -27,13 +27,34 @@ else ] $INCFLAGS << " -I$(ZSRC)" if $mswin or $mingw - $libs = append_library($libs, "zdll") dll = "zlib1.dll" $extso << dll $cleanfiles << "$(topdir)/#{dll}" << "$(ZIMPLIB)" - zmk = "\t$(MAKE) -f $(ZSRC)/win32/Makefile.#{$nmake ? 'msc' : 'gcc'} TOP=$(ZSRC)" + zmk = "\t$(MAKE) -f $(ZMKFILE) TOP=$(ZSRC)" + if $nmake + zmkfile = "$(ZSRC)/win32/Makefile.msc" + m = "#{zsrc}/win32/Makefile.msc" + else + zmkfile = "$(ZSRC)/win32/Makefile.gcc" + m = "#{zsrc}/win32/Makefile.gcc" + zmk += " PREFIX=" + zmk << CONFIG['CC'][/(.*-)gcc([^\/]*)\z/, 1] + zmk << " CC=$(CC)" if $2 + end + m = File.read(m) + zimplib = m[/^IMPLIB[ \t]*=[ \t]*(\S+)/, 1] + $LOCAL_LIBS << " " << zimplib + unless $nmake or /^TOP[ \t]/ =~ m + m.gsub!(/win32\/zlib\.def/, '$(TOP)/\&') + m.gsub!(/^(\t.*[ \t])(\S+\.rc)/, '\1-I$(