diff options
| author | ruki <[email protected]> | 2026-07-04 21:49:32 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-07-04 21:49:32 +0800 |
| commit | 15118bd08542be13f8abe9872903a084edd26deb (patch) | |
| tree | 3dcdef331ba4369e9e81e0ee85527c9244dd82bb | |
| parent | 83369f6bea88b1820329d2a2addbbf640aa792aa (diff) | |
| parent | f8f34b1872f2517554116cc5771f73719cf6fd8a (diff) | |
Merge pull request #7637 from luadebug/repro
Enforce static linkage of readline and curses for mingw platform support
| -rwxr-xr-x | core/xmake.sh | 22 |
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 |
