diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-03-03 09:27:27 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-03-03 09:27:27 +0000 |
commit | d2e61b41f50ef1688dac98f6c48dd44c80ac5c6e (patch) | |
tree | 0ca641ea1346d25c9d9f5475773a59692da8b362 /ext/zlib/extconf.rb | |
parent | bf5b0c4956ec89904fcbc952b1145a5190e5cc11 (diff) |
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
Diffstat (limited to 'ext/zlib/extconf.rb')
-rw-r--r-- | ext/zlib/extconf.rb | 27 |
1 files changed, 24 insertions, 3 deletions
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$(<D) $<') + m = "TOP = .\n""VPATH=$(TOP)\n" + m + zmkfile = File.basename(zmkfile) + File.rename(zmkfile, zmkfile+".orig") if File.exist?(zmkfile) + File.write(zmkfile, m) + end addconf.push( - "ZIMPLIB = zdll.lib\n", + "ZMKFILE = #{zmkfile}\n", + "ZIMPLIB = #{zimplib}\n", "$(TARGET_SO): $(ZIMPLIB)\n", "$(ZIMPLIB):\n", "#{zmk} $@\n", |