[前][次][番号順一覧][スレッド一覧]

ruby-changes:45693

From: nobu <ko1@a...>
Date: Fri, 3 Mar 2017 18:27:33 +0900 (JST)
Subject: [ruby-changes:45693] nobu:r57766 (trunk): zlib for mingw

nobu	2017-03-03 18:27:27 +0900 (Fri, 03 Mar 2017)

  New Revision: 57766

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57766

  Log:
    zlib for mingw
    
    * ext/zlib/extconf.rb: fix building zlib for mingw, and for
      cross-compiling.

  Modified files:
    trunk/ext/zlib/extconf.rb
Index: ext/zlib/extconf.rb
===================================================================
--- ext/zlib/extconf.rb	(revision 57765)
+++ ext/zlib/extconf.rb	(revision 57766)
@@ -27,13 +27,34 @@ else https://github.com/ruby/ruby/blob/trunk/ext/zlib/extconf.rb#L27
     ]
     $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",

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]