diff --git a/build_detect_platform b/build_detect_platform
index bb76c4f..ab9524a 100755
--- a/build_detect_platform
+++ b/build_detect_platform
@@ -147,6 +147,17 @@ case "$TARGET_OS" in
         PLATFORM_SHARED_CFLAGS=
         PLATFORM_SHARED_VERSIONED=
         ;;
+    MINGW*)
+        PLATFORM=OS_WINDOWS
+        COMMON_FLAGS="$MEMCMP_FLAG -DOS_WINDOWS -D_REENTRANT -DLEVELDB_PLATFORM_WINDOWS -DWINVER=0x0500 -D__USE_MINGW_ANSI_STDIO=1"
+        PLATFORM_LDFLAGS=
+        PLATFORM_SHARED_CFLAGS=
+        PLATFORM_SOURCES=util/env_win.cc
+        PORT_FILE=port/port_win.cc
+        PLATFORM_LIBS="-lshlwapi"
+        CROSS_COMPILE=true
+        PLATFORM_SHARED_EXT=dll
+        ;;
     *)
         echo "Unknown platform!" >&2
         exit 1

diff --git a/build_detect_platform b/build_detect_platform
index bb76c4f..fb42a0b 100755
--- a/build_detect_platform
+++ b/build_detect_platform
@@ -147,6 +147,17 @@ case "$TARGET_OS" in
         PLATFORM_SHARED_CFLAGS=
         PLATFORM_SHARED_VERSIONED=
         ;;
+    MINGW*)
+        PLATFORM=OS_WINDOWS
+        COMMON_FLAGS="$MEMCMP_FLAG -DOS_WINDOWS -D_REENTRANT -DLEVELDB_PLATFORM_WINDOWS -DWINVER=0x0500 -D__USE_MINGW_ANSI_STDIO=1"
+        PLATFORM_LDFLAGS="-static -static-libgcc -static-libstdc++"
+        PLATFORM_SHARED_CFLAGS=
+        PLATFORM_SOURCES=util/env_win.cc
+        PORT_FILE=port/port_win.cc
+        PLATFORM_LIBS="-lshlwapi"
+        CROSS_COMPILE=true
+        PLATFORM_SHARED_EXT=dll
+        ;;
     *)
         echo "Unknown platform!" >&2
         exit 1

Fix dependencies for Windows library
Fix dependencies for Windows library
