--- QScintilla-gpl-2.8.4/Python/configure.py.orig	2014-12-16 11:14:41.265000000 +0300
+++ QScintilla-gpl-2.8.4/Python/configure.py	2014-12-16 13:01:42.418000000 +0300
@@ -31,6 +31,7 @@
 import os
 import optparse
 import sys
+from sysconfig import _POSIX_BUILD
 
 
 ###############################################################################
@@ -187,6 +189,9 @@
         else:
             target_configuration.qsci_sip_dir = target_configuration.pyqt_sip_dir
 
+        if "MSYSTEM" in os.environ:
+            target_configuration.qsci_sip_dir = os.popen(' '.join(['cygpath', '--unix', target_configuration.qsci_sip_dir])).readline().strip()
+
         if options.qsci_no_sip_files:
             target_configuration.qsci_sip_dir = ''
 
@@ -645,7 +657,7 @@
         self.module_dir = sysconfig.get_python_lib(plat_specific=1)
         self.debug = hasattr(sys, 'gettotalrefcount')
 
-        if sys.platform == 'win32':
+        if sys.platform == 'win32' and not _POSIX_BUILD:
             try:
                 # Python v3.3 and later.
                 base_prefix = sys.base_prefix
@@ -666,6 +678,12 @@
             self.data_dir = sys.prefix + '/share'
             self.lib_dir = sys.prefix + '/lib'
 
+        if _POSIX_BUILD and "MSYSTEM" in os.environ:
+            self.inc_dir = os.popen(' '.join(['cygpath', '--unix', self.inc_dir])).readline().strip()
+            self.module_dir = os.popen(' '.join(['cygpath', '--unix', self.module_dir])).readline().strip()
+            self.data_dir = os.popen(' '.join(['cygpath', '--unix', self.data_dir])).readline().strip()
+            self.lib_dir = os.popen(' '.join(['cygpath', '--unix', self.lib_dir])).readline().strip()
+
 
 class _TargetQtConfiguration:
     """ A container for the target Qt configuration. """
@@ -717,6 +735,18 @@
         self.py_sip_dir = os.path.join(py_config.data_dir, 'sip')
         self.sip_inc_dir = py_config.venv_inc_dir
 
+        # Get the details of the Python interpreter library.
+        py_major = self.py_version >> 16
+        py_minor = (self.py_version >> 8) & 0x0ff
+        if sys.platform == 'win32' and not _POSIX_BUILD:
+            pylib_lib = 'python%d%d' % (py_major, py_minor)
+            pylib_dir = self.py_lib_dir
+        else:
+            abi = getattr(sys, 'abiflags', '')
+            pylib_lib = 'python%d.%d%s' % (py_major, py_minor, abi)
+
+        self.py_pylib_lib = pylib_lib
+
         # Remaining values.
         self.debug = False
         self.pyqt_sip_flags = None
@@ -811,6 +841,8 @@
         self.py_venv_inc_dir = self.py_inc_dir
         self.py_pylib_dir = parser.get(section, 'py_pylib_dir',
                 self.py_pylib_dir)
+        self.py_pylib_lib = parser.get(section, 'py_pylib_lib',
+                self.py_pylib_lib)
 
         self.sip_inc_dir = self.py_venv_inc_dir
 
@@ -944,7 +976,9 @@
         # On Windows for Qt versions prior to v5.9.0 we need to be explicit
         # about the qmake spec.
         if self.qt_version < 0x050900 and self.py_platform == 'win32':
-            if self.py_version >= 0x030500:
+            if _POSIX_BUILD:
+                self.qmake_spec = "win32-g++"
+            elif self.py_version >= 0x030500:
                 self.qmake_spec = 'win32-msvc2015'
             elif self.py_version >= 0x030300:
                 self.qmake_spec = 'win32-msvc2010'
@@ -977,6 +1011,11 @@
         self.qt_inc_dir = qt_config.QT_INSTALL_HEADERS
         self.qt_lib_dir = qt_config.QT_INSTALL_LIBS
 
+        if "MSYSTEM" in os.environ:
+            self.api_dir = os.popen(' '.join(['cygpath', '--unix', self.api_dir])).readline().strip()
+            self.qt_inc_dir = os.popen(' '.join(['cygpath', '--unix', self.qt_inc_dir])).readline().strip()
+            self.qt_lib_dir = os.popen(' '.join(['cygpath', '--unix', self.qt_lib_dir])).readline().strip()
+
         if self.sysroot == '':
             self.sysroot = getattr(qt_config, 'QT_SYSROOT', '')
 
@@ -1465,7 +1504,7 @@
     PY_MODULE = %s.pyd
     PY_MODULE_SRC = $(DESTDIR_TARGET)
 
-    LIBS += -L%s
+    LIBS += -L%s -l%s
 } else {
     PY_MODULE = %s.so
 
@@ -1488,7 +1527,7 @@
 
 target.CONFIG = no_check_exist
 target.files = $$PY_MODULE
-''' % (mname, quote(target_config.py_pylib_dir), mname))
+''' % (mname, quote(target_config.py_pylib_dir), quote(target_config.py_pylib_lib), mname))
 
     pro.write('''
 target.path = %s
@@ -1622,6 +1661,8 @@
     to run.  verbose is set if the output is to be displayed.
     """
 
+    if "MSYSTEM" in os.environ:
+        cmd = 'sh.exe -c "%s"' % cmd.replace("\\", "/")
     if verbose:
         sys.stdout.write(cmd + "\n")
 
