From b5cd7da1498492c8a8aa37efe2d225358ac74f6b Mon Sep 17 00:00:00 2001
From: Lyle Johnson <lyle@lylejohnson.name>
Date: Mon, 14 Sep 2009 16:00:16 -0500
Subject: [PATCH] Break out a separate setup method for MinGW builds

---
 ext/fox16/extconf.rb | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/ext/fox16/extconf.rb b/ext/fox16/extconf.rb
index 6317045..62dfbb9 100755
--- a/ext/fox16/extconf.rb
+++ b/ext/fox16/extconf.rb
@@ -95,6 +95,29 @@ def do_cygwin_setup
   end
 end
 
+def do_mingw_setup
+  extra_libs = %w{stdc++ glu32 opengl32 wsock32 comctl32 mpr gdi32 winspool}
+  extra_libs.each do |lib|
+    $libs = append_library($libs, lib)
+  end
+# have_header("sys/time.h")
+  have_header("signal.h")
+  if have_library("z", "deflate")
+    have_library("png", "png_create_read_struct")
+  end
+  have_library("jpeg", "jpeg_mem_init")
+  have_library("tiff", "TIFFSetErrorHandler")
+  $libs = append_library($libs, "FOX-1.6")
+  $CFLAGS = $CFLAGS + " -fpermissive -DWIN32 -Iinclude"
+  if is_fxscintilla_build?
+    FileUtils.move('scintilla_wrap.cpp.bak', 'scintilla_wrap.cpp') if FileTest.exist?('scintilla_wrap.cpp.bak')
+    $CFLAGS = $CFLAGS + " -DWITH_FXSCINTILLA -DHAVE_FOX_1_6"
+    $libs = append_library($libs, "fxscintilla")
+  else
+    FileUtils.move('scintilla_wrap.cpp', 'scintilla_wrap.cpp.bak') if FileTest.exist?('scintilla_wrap.cpp')
+  end
+end
+
 def do_mswin32_setup
   extra_libs = %w{glu32 opengl32 mpr wsock32 comctl32 winspool shell32 advapi32 shell32 gdi32 user32}
   extra_libs.each do |lib|
@@ -193,8 +216,10 @@ unless fxscintilla_support_suppressed?
 end
 
 # Platform-specific modifications
-if RUBY_PLATFORM =~ /cygwin/ || RUBY_PLATFORM =~ /mingw/
+if RUBY_PLATFORM =~ /cygwin/
   do_cygwin_setup
+elsif RUBY_PLATFORM =~ /mingw/
+  do_mingw_setup
 elsif RUBY_PLATFORM =~ /mswin32/
   do_mswin32_setup
 elsif RUBY_PLATFORM =~ /darwin/
-- 
GitLab