Repository: spack/spack

Issue:
Installation issue: libtermkey
### Steps to reproduce the issue

```console
$ spack install neovim
```

### Information on your system

* **Spack:** 0.16.3-4806-532ba03d60
* **Python:** 3.8.2
* **Platform:** darwin-bigsur-m1
* **Concretizer:** clingo

### Additional information

```
==> Installing libtermkey-0.18-aualqbcme2zew3wmvvnguk4ssvesiw6e
==> No binary for libtermkey-0.18-aualqbcme2zew3wmvvnguk4ssvesiw6e found: installing from source
==> Using cached archive: /Users/certik/repos/spack/var/spack/cache/_source-cache/archive/23/239746de41c845af52bb3c14055558f743292dd6c24ac26c2d6567a5a6093926.tar.gz
==> No patches needed for libtermkey
==> libtermkey: Executing phase: 'install'
==> Error: ProcessError: Command exited with status 2:
    'make' '-j8'

4 errors found in build log:
     9     glibtool --quiet --mode=compile --tag=CC /Users/certik/repos/spack/l
           ib/spack/env/clang/clang -Wall -std=c99 -o driver-ti.lo -c driver-ti
           .c
     10    glibtool --quiet --mode=compile --tag=CC /Users/certik/repos/spack/l
           ib/spack/env/clang/clang -Wall -std=c99 -o demo.lo -c demo.c
     11    glibtool --quiet --mode=compile --tag=CC /Users/certik/repos/spack/l
           ib/spack/env/clang/clang -Wall -std=c99 -o demo-async.lo -c demo-asy
           nc.c
     12    glibtool --quiet --mode=link --tag=CC /Users/certik/repos/spack/lib/
           spack/env/clang/clang -rpath /usr/local/lib -version-info 13:0:12 -l
           ncurses -o libtermkey.la termkey.lo driver-csi.lo driver-ti.lo
     13    glibtool --quiet --mode=link --tag=CC /Users/certik/repos/spack/lib/
           spack/env/clang/clang -o demo libtermkey.la demo.lo
     14    glibtool --quiet --mode=link --tag=CC /Users/certik/repos/spack/lib/
           spack/env/clang/clang -o demo-async libtermkey.la demo-async.lo
  >> 15    Undefined symbols for architecture arm64:
     16      "_cur_term", referenced from:
     17          _load_terminfo in libtermkey.a(driver-ti.o)
     18      "_setupterm", referenced from:
     19          _load_terminfo in libtermkey.a(driver-ti.o)
     20      "_strfnames", referenced from:
     21          _load_terminfo in libtermkey.a(driver-ti.o)
     22      "_strnames", referenced from:
     23          _load_terminfo in libtermkey.a(driver-ti.o)
     24      "_tigetstr", referenced from:
     25          _load_terminfo in libtermkey.a(driver-ti.o)
     26    ld: symbol(s) not found for architecture arm64
  >> 27    clang: error: linker command failed with exit code 1 (use -v to see 
           invocation)
     28    make: *** [Makefile:74: demo] Error 1
     29    make: *** Waiting for unfinished jobs....
  >> 30    Undefined symbols for architecture arm64:
     31      "_cur_term", referenced from:
     32          _load_terminfo in libtermkey.a(driver-ti.o)
     33      "_setupterm", referenced from:
     34          _load_terminfo in libtermkey.a(driver-ti.o)
     35      "_strfnames", referenced from:
     36          _load_terminfo in libtermkey.a(driver-ti.o)
     37      "_strnames", referenced from:
     38          _load_terminfo in libtermkey.a(driver-ti.o)
     39      "_tigetstr", referenced from:
     40          _load_terminfo in libtermkey.a(driver-ti.o)
     41    ld: symbol(s) not found for architecture arm64
  >> 42    clang: error: linker command failed with exit code 1 (use -v to see 
           invocation)
     43    make: *** [Makefile:77: demo-async] Error 1

See build log for details:
  /var/folders/43/nspmtcpj5r589x58n_spl6jm000fsc/T/certik/spack-stage/spack-stage-libtermkey-0.18-aualqbcme2zew3wmvvnguk4ssvesiw6e/spack-build-out.txt

```

### General information

- [X] I have run `spack debug report` and reported the version of Spack/Python/Platform
- [X] I have run `spack maintainers <name-of-the-package>` and **@mentioned** any maintainers
- [X] I have uploaded the build log and environment files
- [X] I have searched the issues of this repo and believe this is not a duplicate


Discussion:
I can confirm this is still the same error on Apple M1 Max.

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/libtermkey/package.py b/var/spack/repos/builtin/packages/libtermkey/package.py
--- a/var/spack/repos/builtin/packages/libtermkey/package.py
+++ b/var/spack/repos/builtin/packages/libtermkey/package.py
@@ -11,6 +11,7 @@ class Libtermkey(Package):
     homepage = "http://www.leonerd.org.uk/code/libtermkey/"
     url      = "http://www.leonerd.org.uk/code/libtermkey/libtermkey-0.18.tar.gz"
 
+    version('0.22', sha256='6945bd3c4aaa83da83d80a045c5563da4edd7d0374c62c0d35aec09eb3014600')
     version('0.18', sha256='239746de41c845af52bb3c14055558f743292dd6c24ac26c2d6567a5a6093926')
     version('0.17', sha256='68949364ed5eaad857b3dea10071cde74b00b9f236dfbb702169f246c3cef389')
     version('0.16', sha256='6c8136efa5d0b3277014a5d4519ea81190079c82656b7db1655a1bd147326a70')
@@ -19,6 +20,7 @@ class Libtermkey(Package):
 
     depends_on('libtool', type='build')
     depends_on('ncurses')
+    depends_on('pkgconfig')
 
     def install(self, spec, prefix):
         make()


Test patch: