Skip to content

Commit d2a26a3

Browse files
committed
Fix building xmake using xmake on mingw
1 parent 4cdcaa4 commit d2a26a3

File tree

7 files changed

+13
-10
lines changed

7 files changed

+13
-10
lines changed

core/src/lua/xmake.lua

+2-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ target("lua")
2121

2222
-- add definitions
2323
add_defines("LUA_COMPAT_5_1", "LUA_COMPAT_5_2", "LUA_COMPAT_5_3", {public = true})
24-
if is_plat("windows") then
25-
-- it has been defined in luaconf.h
26-
--add_defines("LUA_USE_WINDOWS")
24+
if is_plat("mingw") then
25+
add_defines("LUA_USE_WINDOWS")
2726
elseif is_plat("macosx", "iphoneos") then
2827
add_defines("LUA_USE_MACOSX")
2928
else

core/src/xmake/io/stdfile.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ static tb_size_t xm_io_stdfile_isatty(tb_size_t type)
5656
tb_bool_t answer = tb_false;
5757
#if defined(TB_CONFIG_OS_WINDOWS)
5858
DWORD mode;
59-
HANDLE console_handle;
59+
HANDLE console_handle = tb_null;
6060
switch (type)
6161
{
6262
case XM_IO_FILE_TYPE_STDIN: console_handle = GetStdHandle(STD_INPUT_HANDLE); break;

core/src/xmake/process/openv.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
*/
3131
#include "prefix.h"
3232
#include "../io/prefix.h"
33-
#if defined(TB_CONFIG_OS_MACOSX) || defined(TB_CONFIG_OS_LINUX) || defined(TB_CONFIG_OS_BSD) || defined(TB_CONFIG_OS_HAIKU)
33+
#if defined(TB_CONFIG_OS_MACOSX) || defined(TB_CONFIG_OS_LINUX) || defined(TB_CONFIG_OS_BSD) || defined(TB_CONFIG_OS_HAIKU) || defined(__MINGW32__)
3434
# include <signal.h>
3535
#endif
3636

core/src/xmake/winos/ansi.c

-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ tb_int_t xm_winos_cp_info(lua_State* lua)
9696
// check
9797
tb_assert_and_check_return_val(lua, 0);
9898

99-
tb_int_t n = lua_gettop(lua);
10099
lua_Integer cp = luaL_checkinteger(lua, 1);
101100
luaL_argcheck(lua, cp >= 0 && cp < 65536, 1, "invalid code page");
102101
CPINFOEX cp_info;

core/src/xmake/winos/logical_drives.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,5 +81,5 @@ tb_int_t xm_winos_logical_drives(lua_State* lua)
8181
data = tb_null;
8282

8383
// ok
84-
return 1;
84+
return ok;
8585
}

core/src/xmake/xmake.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ target("xmake")
3838

3939
-- add the common source files
4040
add_files("**.c|winos/*.c")
41-
if is_plat("windows", "msys", "cygwin") then
41+
if is_plat("windows", "msys", "mingw", "cygwin") then
4242
add_files("winos/*.c")
4343
end
4444

core/xmake.lua

+7-2
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,20 @@ option_end()
6565
option("readline")
6666
set_description("Enable or disable readline library")
6767
add_links("readline")
68-
add_cincludes("readline/readline.h")
68+
add_cincludes("stdio.h", "readline/readline.h")
6969
add_cfuncs("readline")
7070
add_defines("XM_CONFIG_API_HAVE_READLINE")
7171
option_end()
7272

7373
-- the curses option
7474
option("curses")
7575
set_description("Enable or disable curses library")
76-
add_links("curses")
76+
if is_plat("mingw") then
77+
add_includedirs(path.join(get_config("mingw"), "include", "ncursesw"))
78+
add_links("ncursesw")
79+
else
80+
add_links("curses")
81+
end
7782
add_cincludes("curses.h")
7883
add_defines("XM_CONFIG_API_HAVE_CURSES")
7984
option_end()

0 commit comments

Comments
 (0)