Bug 246365 - shells/fish: does not build against devel/ncurses despite USES=ncurses
Summary: shells/fish: does not build against devel/ncurses despite USES=ncurses
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Many People
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2020-05-11 01:09 UTC by Dustin Boyd
Modified: 2020-05-24 20:58 UTC (History)
3 users (show)

See Also:
fernape: maintainer-feedback? (asomers)


Attachments
Patch to enable shells/fish to build against devel/ncurses (620 bytes, patch)
2020-05-11 01:09 UTC, Dustin Boyd
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dustin Boyd 2020-05-11 01:09:55 UTC
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
tmux

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.
Comment 1 Dustin Boyd 2020-05-11 06:06:48 UTC
(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'.
Comment 2 Alan Somers freebsd_committer 2020-05-17 02:05:01 UTC
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?
Comment 3 Dustin Boyd 2020-05-17 23:34:22 UTC
(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.
Comment 4 Alan Somers freebsd_committer 2020-05-17 23:47:07 UTC
(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?
Comment 5 Dustin Boyd 2020-05-18 04:19:01 UTC
(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.
Comment 6 commit-hook freebsd_committer 2020-05-24 20:57:56 UTC
A commit references this bug:

Author: asomers
Date: Sun May 24 20:57:47 UTC 2020
New revision: 536422
URL: https://svnweb.freebsd.org/changeset/ports/536422

Log:
  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.

  PR:		246365
  Submitted by:	Dustin Boyd <memreflect@pm.me>

Changes:
  head/shells/fish/Makefile
Comment 7 Alan Somers freebsd_committer 2020-05-24 20:58:29 UTC
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.