From a6eb3e5c272aca67674b79f60829bfcf6cb24180 Mon Sep 17 00:00:00 2001 From: Marcelo Juchem Date: Thu, 22 Aug 2024 13:47:21 -0500 Subject: [PATCH] fix ncurses linking issues The build configuration for `mruby` assumes only the `ncurses` library needs to be linked because `tinfo` is implicitly pulled in. In environments where ncurses is available only as a static library, `tinfo` needs to be linked explicitly (needed for functions like `tputs`. This patch fixes that by linking `tinfo` if available. It also fixes the build for environments where only the `ncursesw` version of the library (including wide character support) is present, while still giving preference to the `ncurses` version (without wide character support). --- mrbgems/mruby-bin-mirb/mrbgem.rake | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mrbgems/mruby-bin-mirb/mrbgem.rake b/mrbgems/mruby-bin-mirb/mrbgem.rake index c31ac7ae9..9da98b8b0 100644 --- a/mrbgems/mruby-bin-mirb/mrbgem.rake +++ b/mrbgems/mruby-bin-mirb/mrbgem.rake @@ -33,6 +33,14 @@ MRuby::Gem::Specification.new('mruby-bin-mirb') do |spec| end if spec.build.cc.search_header_path 'curses.h' spec.linker.libraries << 'ncurses' + if spec.build.cc.search_header_path 'term.h' + spec.linker.libraries << 'tinfo' + end + elsif spec.build.cc.search_header_path 'ncursesw/curses.h' + spec.linker.libraries << 'ncursesw' + if spec.build.cc.search_header_path 'ncursesw/term.h' + spec.linker.libraries << 'tinfow' + end end end elsif spec.build.cc.search_header_path 'edit/readline/readline.h'