summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaikari <[email protected]>2026-07-04 00:07:34 +0300
committerSaikari <[email protected]>2026-07-04 00:07:34 +0300
commitf8f34b1872f2517554116cc5771f73719cf6fd8a (patch)
treef665fb64fd553ac5cfc24689f258ab93ec93d06a
parent06741e43d5f4a6af4fe99f0899b1cd9beb495d48 (diff)
Enhance readline and curses options for mingw platform support
-rwxr-xr-xcore/xmake.sh22
1 files changed, 20 insertions, 2 deletions
diff --git a/core/xmake.sh b/core/xmake.sh
index 850c37aa3..31c5f8aea 100755
--- a/core/xmake.sh
+++ b/core/xmake.sh
@@ -43,12 +43,26 @@ option "external" "Always use external dependencies" false
# the readline option
option "readline"
- add_links "readline"
add_cincludes "stdio.h" "readline/readline.h"
add_cfuncs "readline"
+ before_check "option_find_readline"
add_defines "XM_CONFIG_API_HAVE_READLINE"
option_end
+option_find_readline() {
+ option "readline"
+ if is_plat "mingw"; then
+ local termlib="-ltermcap"
+ if pkg-config --exists ncursesw 2>/dev/null; then
+ termlib="-lncursesw"
+ fi
+ add_ldflags "-Wl,-Bstatic" "-lreadline" "${termlib}" "-lpthread" "-Wl,-Bdynamic"
+ else
+ add_links "readline"
+ fi
+ option_end
+}
+
# the curses option
option "curses"
add_cfuncs "initscr"
@@ -68,7 +82,11 @@ option_find_curses() {
local ncurses_ldflags=""
ncurses_ldflags=$(pkg-config --libs ${ncurses} 2>/dev/null)
option "curses"
- if test_nz "${ncurses_ldflags}"; then
+ if is_plat "mingw"; then
+ add_defines "NCURSES_STATIC"
+ add_cflags `pkg-config --cflags ${ncurses} 2>/dev/null`
+ add_ldflags "-Wl,-Bstatic" "-lncursesw" "-lpthread" "-Wl,-Bdynamic"
+ elif test_nz "${ncurses_ldflags}"; then
add_cflags `pkg-config --cflags ${ncurses} 2>/dev/null`
add_ldflags "${ncurses_ldflags}"
else