Repository: spack/spack

Issue:
tmux compilation fails, unable to resolve symbol from tinfo library
I'm getting a dusty CI script up and running again, it hasn't been built for ~5 months.  It includes tmux and byobo; and/but tmux fails to build.

The tmux build fails because the linker can't find a definition for `setupterm`.

That symbol is included in `libtinfo`, which is installed as part of `ncurses` when the `tinfo` variant is true (which is the default).  In "most" (data not shown) ncurses packages the tinfo functionality is packaged into a separate `libtinfo`, but apparently there are some that roll it into a unified `libncurses`.  *Our* `ncurses` packages produces a separate `libtinfo`.

The recipe for `tmux` includes:

```python
     def configure_args(self):
        return ['LIBTINFO_LIBS=-lncurses']
```

which was added ~3 years ago.

For our separate-`tinfo`-library setup, this is incorrect.  I'm unsure why it has worked in the past, perhaps people were picking up system libraries or something about tmux's requirements has changed.

In any case, changing this to:

```python
     def configure_args(self):
        return ['LIBTINFO_LIBS=-ltinfo']
```

allows tmux to compile on my CentOS 7 system.

PR to follow.

### Spack version
<!-- Add the output to the command below -->
```console
$ spack --version
0.14.0-88-ac4d0c3
```

### Steps to reproduce the issue

```console
$ spack install tmux # Fill in the exact spec you are using
... # and the relevant part of the error message
[...]
/home/ghartzell/tmp/spack-20200301/lib/spack/env/gcc/gcc -D_GNU_SOURCE -I/home/ghartzell/tmp/spack-20200301/opt/spack/linux-centos7-skylake_avx512/gcc-8.2.0/ncurses-6.1-73oof6l5rzikkjvwckaoocbzyg4bvsup/include   -I/home/ghartzell/tmp/spack-20200301/opt/spack/linux-centos7-skylake_avx512/gcc-8.2.0/libevent-2.1.8-hizpaklyihvnet4de2u52gvhr63gdun4/include    -std=gnu99 -O2      -o tmux alerts.o arguments.o attributes.o cfg.o client.o cmd-attach-session.o cmd-bind-key.o cmd-break-pane.o cmd-capture-pane.o cmd-choose-tree.o cmd-command-prompt.o cmd-confirm-before.o cmd-copy-mode.o cmd-detach-client.o cmd-display-menu.o cmd-display-message.o cmd-display-panes.o cmd-find-window.o cmd-find.o cmd-if-shell.o cmd-join-pane.o cmd-kill-pane.o cmd-kill-server.o cmd-kill-session.o cmd-kill-window.o cmd-list-buffers.o cmd-list-clients.o cmd-list-keys.o cmd-list-panes.o cmd-list-sessions.o cmd-list-windows.o cmd-load-buffer.o cmd-lock-server.o cmd-move-window.o cmd-new-session.o cmd-new-window.o cmd-parse.o cmd-paste-buffer.o cmd-pipe-pane.o cmd-queue.o cmd-refresh-client.o cmd-rename-session.o cmd-rename-window.o cmd-resize-pane.o cmd-resize-window.o cmd-respawn-pane.o cmd-respawn-window.o cmd-rotate-window.o cmd-run-shell.o cmd-save-buffer.o cmd-select-layout.o cmd-select-pane.o cmd-select-window.o cmd-send-keys.o cmd-set-buffer.o cmd-set-environment.o cmd-set-option.o cmd-show-environment.o cmd-show-messages.o cmd-show-options.o cmd-source-file.o cmd-split-window.o cmd-swap-pane.o cmd-swap-window.o cmd-switch-client.o cmd-unbind-key.o cmd-wait-for.o cmd.o colour.o control-notify.o control.o environ.o format.o format-draw.o grid-view.o grid.o input-keys.o input.o job.o key-bindings.o key-string.o layout-custom.o layout-set.o layout.o log.o menu.o mode-tree.o names.o notify.o options-table.o options.o paste.o proc.o regsub.o resize.o screen-redraw.o screen-write.o screen.o server-client.o server-fn.o server.o session.o spawn.o status.o style.o tmux.o tty-acs.o tty-keys.o tty-term.o tty.o utf8.o window-buffer.o window-client.o window-clock.o window-copy.o window-tree.o window.o xmalloc.o xterm-keys.o osdep-linux.o   compat/closefrom.o compat/explicit_bzero.o compat/fgetln.o compat/freezero.o compat/getdtablecount.o compat/getprogname.o compat/recallocarray.o compat/reallocarray.o compat/setproctitle.o compat/strlcat.o compat/strlcpy.o compat/strtonum.o compat/imsg.o compat/imsg-buffer.o compat/vis.o compat/unvis.o compat/getopt.o compat/fdforkpty.o -lutil  -lncurses -L/home/ghartzell/tmp/spack-20200301/opt/spack/linux-centos7-skylake_avx512/gcc-8.2.0/libevent-2.1.8-hizpaklyihvnet4de2u52gvhr63gdun4/lib -levent    -lresolv
/usr/bin/ld: tty-term.o: undefined reference to symbol 'setupterm'
/home/ghartzell/tmp/spack-20200301/opt/spack/linux-centos7-skylake_avx512/gcc-8.2.0/ncurses-6.1-73oof6l5rzikkjvwckaoocbzyg4bvsup/lib/libtinfo.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [tmux] Error 1
```
### Platform and user environment

```commandline
$ uname -a
Linux bifx1n03.bold.bio 3.10.0-957.1.3.el7.x86_64 #1 SMP Thu Nov 29 14:49:43 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
``` 
### Additional information


### General information

- [x] I have run `spack --version` and reported the version of Spack
- [x] I have searched the issues of this repo and believe this is not a duplicate



Discussion:

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/tmux/package.py b/var/spack/repos/builtin/packages/tmux/package.py
--- a/var/spack/repos/builtin/packages/tmux/package.py
+++ b/var/spack/repos/builtin/packages/tmux/package.py
@@ -29,13 +29,7 @@ class Tmux(AutotoolsPackage):
     version('2.1', sha256='31564e7bf4bcef2defb3cb34b9e596bd43a3937cad9e5438701a81a5a9af6176')
     version('1.9a', sha256='c5e3b22b901cf109b20dab54a4a651f0471abd1f79f6039d79b250d21c2733f5')
 
+    # used by configure to e.g. find libtinfo
+    depends_on('pkgconfig', type='build')
     depends_on('libevent')
     depends_on('ncurses')
-
-    def flag_handler(self, name, flags):
-        if name == 'cppflags':
-            flags.append(self.spec['ncurses'].headers.include_flags)
-        return (None, flags, None)
-
-    def configure_args(self):
-        return ['LIBTINFO_LIBS=-lncurses']


Test patch: