From 436e58ccf28628768b74d7306ab1b1756a9dbf98 Mon Sep 17 00:00:00 2001
From: Karel Tuma <kat@lua.cz>
Date: Tue, 23 Feb 2016 19:02:47 +0100
Subject: Implement MSYS2 support

---
 src/luarocks/cfg.lua | 28 +++++++++++++++++++++++++---
 1 file changed, 25 insertions(+), 3 deletions(-)

diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua
index e41b632c..2924e435 100644
--- a/src/luarocks/cfg.lua
+++ b/src/luarocks/cfg.lua
@@ -113,6 +113,10 @@ elseif system == "SunOS" then
 elseif system and system:match("^CYGWIN") then
    cfg.platforms.unix = true
    cfg.platforms.cygwin = true
+elseif system and system:match("^MSYS") then
+   cfg.platforms.unix = true
+   cfg.platforms.msys = true
+   cfg.platforms.cygwin = true
 elseif system and system:match("^Windows") then
    cfg.platforms.windows = true
    cfg.platforms.win32 = true
@@ -137,10 +141,11 @@ local platform_order = {
    linux = 7,
    macosx = 8,
    cygwin = 9,
+   msys = 10,
    -- Windows
-   win32 = 10,
-   mingw32 = 11,
-   windows = 12 }
+   win32 = 11,
+   mingw32 = 12,
+   windows = 13 }
 
 
 -- Path configuration:
@@ -518,6 +523,23 @@ if cfg.platforms.cygwin then
    defaults.variables.LIBFLAG = "-shared"
 end
 
+if cfg.platforms.msys then
+   -- msys is basically cygwin made out of mingw, meaning the subsytem is unixish
+   -- enough, yet we can freely mix with native win32
+   defaults.external_deps_patterns = {
+      bin = { "?.exe", "?.bat", "?" },
+      lib = { "lib?.so", "lib?.so.*", "lib?.dll.a", "?.dll.a",
+              "lib?.a", "lib?.dll", "?.dll", "?.lib" },
+      include = { "?.h" }
+   }
+   defaults.runtime_external_deps_patterns = {
+      bin = { "?.exe", "?.bat" },
+      lib = { "lib?.so", "?.dll", "lib?.dll" },
+      include = { "?.h" }
+   }
+end
+
+
 if cfg.platforms.bsd then
    defaults.variables.MAKE = "gmake"
    defaults.variables.STATFLAG = "-f '%OLp'"
-- 
cgit v1.2.3-55-g6feb