summaryrefslogtreecommitdiff
path: root/core/src/xmake
diff options
context:
space:
mode:
authortqfx <[email protected]>2024-05-24 22:39:12 +0800
committertqfx <[email protected]>2024-05-26 21:45:46 +0800
commit1d6f7c99f8c7992e2eb7cd99bb7eb6aa309bb314 (patch)
tree2fa78116390103b9b80e3b80adeab13b19eefd8f /core/src/xmake
parent4cdcaa4772957ab2672d2618ca11e1dcce0e71c2 (diff)
Fix building xmake using xmake on mingw
Diffstat (limited to 'core/src/xmake')
-rw-r--r--core/src/xmake/curses/curses.c6
-rw-r--r--core/src/xmake/io/stdfile.c2
-rw-r--r--core/src/xmake/process/openv.c2
-rw-r--r--core/src/xmake/winos/ansi.c1
-rw-r--r--core/src/xmake/winos/logical_drives.c5
-rw-r--r--core/src/xmake/xmake.lua2
6 files changed, 8 insertions, 10 deletions
diff --git a/core/src/xmake/curses/curses.c b/core/src/xmake/curses/curses.c
index 29577658a..2ff4cb77e 100644
--- a/core/src/xmake/curses/curses.c
+++ b/core/src/xmake/curses/curses.c
@@ -36,7 +36,11 @@
# undef MOUSE_MOVED
#endif
#define NCURSES_MOUSE_VERSION 2
-#include <curses.h>
+#ifdef TB_COMPILER_IS_MINGW
+# include <ncursesw/curses.h>
+#else
+# include <curses.h>
+#endif
#if defined(NCURSES_VERSION)
# include <locale.h>
#endif
diff --git a/core/src/xmake/io/stdfile.c b/core/src/xmake/io/stdfile.c
index 13edbfc79..5f94126fa 100644
--- a/core/src/xmake/io/stdfile.c
+++ b/core/src/xmake/io/stdfile.c
@@ -56,7 +56,7 @@ static tb_size_t xm_io_stdfile_isatty(tb_size_t type)
tb_bool_t answer = tb_false;
#if defined(TB_CONFIG_OS_WINDOWS)
DWORD mode;
- HANDLE console_handle;
+ HANDLE console_handle = tb_null;
switch (type)
{
case XM_IO_FILE_TYPE_STDIN: console_handle = GetStdHandle(STD_INPUT_HANDLE); break;
diff --git a/core/src/xmake/process/openv.c b/core/src/xmake/process/openv.c
index 21add6d55..5903dab27 100644
--- a/core/src/xmake/process/openv.c
+++ b/core/src/xmake/process/openv.c
@@ -30,7 +30,7 @@
*/
#include "prefix.h"
#include "../io/prefix.h"
-#if defined(TB_CONFIG_OS_MACOSX) || defined(TB_CONFIG_OS_LINUX) || defined(TB_CONFIG_OS_BSD) || defined(TB_CONFIG_OS_HAIKU)
+#if defined(TB_CONFIG_OS_MACOSX) || defined(TB_CONFIG_OS_LINUX) || defined(TB_CONFIG_OS_BSD) || defined(TB_CONFIG_OS_HAIKU) || defined(TB_COMPILER_IS_MINGW)
# include <signal.h>
#endif
diff --git a/core/src/xmake/winos/ansi.c b/core/src/xmake/winos/ansi.c
index ee86d13ea..7caad7797 100644
--- a/core/src/xmake/winos/ansi.c
+++ b/core/src/xmake/winos/ansi.c
@@ -96,7 +96,6 @@ tb_int_t xm_winos_cp_info(lua_State* lua)
// check
tb_assert_and_check_return_val(lua, 0);
- tb_int_t n = lua_gettop(lua);
lua_Integer cp = luaL_checkinteger(lua, 1);
luaL_argcheck(lua, cp >= 0 && cp < 65536, 1, "invalid code page");
CPINFOEX cp_info;
diff --git a/core/src/xmake/winos/logical_drives.c b/core/src/xmake/winos/logical_drives.c
index fe62edd04..14fa72fac 100644
--- a/core/src/xmake/winos/logical_drives.c
+++ b/core/src/xmake/winos/logical_drives.c
@@ -41,7 +41,6 @@ tb_int_t xm_winos_logical_drives(lua_State* lua)
lua_newtable(lua);
// get logical drives
- tb_bool_t ok = tb_false;
tb_char_t* data = tb_null;
do
{
@@ -70,10 +69,6 @@ tb_int_t xm_winos_logical_drives(lua_State* lua)
// next drive
p += tb_strlen(p) + 1;
}
-
- // ok
- ok = tb_true;
-
} while (0);
// exit data
diff --git a/core/src/xmake/xmake.lua b/core/src/xmake/xmake.lua
index 15702c808..af0bfd877 100644
--- a/core/src/xmake/xmake.lua
+++ b/core/src/xmake/xmake.lua
@@ -38,7 +38,7 @@ target("xmake")
-- add the common source files
add_files("**.c|winos/*.c")
- if is_plat("windows", "msys", "cygwin") then
+ if is_plat("windows", "msys", "mingw", "cygwin") then
add_files("winos/*.c")
end