Created attachment 214369 [details]
Patch to enable shells/fish to build against devel/ncurses
shells/fish is built using CMake and requires the FindCurses module. Unless CURSES_NEED_NCURSES=TRUE, shells/fish will always be built against ncurses from base, even when devel/ncurses is already installed. I've attached a Makefile patch that enables shells/fish to respect the intended behavior of USES=ncurses.
A symptom of the problem is when a terminal multiplexer such as sysutils/tmux is built against devel/ncurses, which provides terminfo support and allows a TERM value not found in any termcap by default, but shells/fish is linked against ncurses from base, which doesn't know about terminfo:
fish: The terminal database could not be opened.
fish: using dumb terminal settings.
user@host ~> echo $TERM
Based on the behavior of the FindCurses module in this package, the issue may also occur for any other port with USES=ncurses built using CMake that has not worked around this issue.
(In reply to Dustin Boyd from comment #0)
Apologies for the incorrect warning message. I was using csh at the time, which displayed that message. The correct message for fish:
<W> fish: Could not set up terminal.
<W> fish: TERM environment variable set to 'tmux'.
<W> fish: Check that this terminal type is supported on this system.
<W> fish: Using fallback terminal type 'ansi'.
Forgive me, but I'm missing something. How is a user supposed to select at build time which version of ncurses to use? Is it just a matter of installing devel/ncurses, or is there something he can set in /etc/make.conf?
(In reply to Alan Somers from comment #2)
USES=ncurses with no arguments is intended to automatically build against devel/ncurses if it is already installed, else it uses ncurses from the base system. Without the patch, the base system's ncurses library will always be used as if USES=ncurses:base had been specified. If this is the intended behavior, USES=ncurses:base should be specified rather than USES=ncurses.
(In reply to Dustin Boyd from comment #3)
That makes sense when building by hand. But how does one signal to Poudriere to install devel/ncurses before building a port like Fish?
(In reply to Alan Somers from comment #4)
My original patch merely preserved the behavior of the existing Makefile-based ports infrastructure. Getting things to link properly when building with Poudriere is a separate matter since it builds everything separately. If there was a way to use DEFAULT_VERSIONS with ncurses, that would be a solution that works for all ports, not just shells/fish, and it would work whether Poudriere, Portmaster, Synth, or a manual 'make clean install' was used.
A possible workaround for shells/fish would be to provide an option to build against the libs from the base system (USES=ncurses:base) or the libs from the devel/ncurses port (USES=ncurses:port). This is probably the correct option if one views USES=ncurses as a convenience. Of course, if devel/ncurses is required, CURSES_NEED_NCURSES=TRUE would still be necessary for CMake to build against the libs provided by devel/ncurses, which is the real problem here.
A commit references this bug:
Date: Sun May 24 20:57:47 UTC 2020
New revision: 536422
shells/fish: link against devel/ncurses if it's installed at build time
shells/fish is built using CMake and requires the FindCurses module. Unless
CURSES_NEED_NCURSES=TRUE, shells/fish will always be built against ncurses
from base, even when devel/ncurses is already installed.
This change has no effect for packages built from Poudriere, which will not
install devel/ncurses when building fish.
Submitted by: Dustin Boyd <email@example.com>
Ok, I'm committing it. This is a weird change because it doesn't affect the binary packages. But there are still plenty of people who build ports by hand.