Repository: spack/spack

Issue:
Installation issue: lua
### Steps to reproduce the issue

```console
$ spack install lua@5.3.5%gcc@8.3.0+shared
...
==> Error: ProcessError: Command exited with status 2:
    'make' '-j4' 'INSTALL_TOP=/home/joe/spack/opt/spack/linux-debian10-haswell/gcc-8.3.0/lua-5.3.5-4wo4eijeii2m4mkthvrtbiiponlqjo3s' 'MYLDFLAGS=-L/home/joe/spack/opt/spack/linux-debian10-haswell/gcc-8.3.0/readline-8.0-attqxu4bt7rbke4bqhlbedsn5pux3xeu/lib -L/usr/lib' 'MYLIBS=-lncursesw -ltinfow' 'CC=/home/joe/spack/lib/spack/env/gcc/gcc -std=gnu99 -fPIC' 'linux'

4 errors found in build log:
     41    /home/joe/spack/lib/spack/env/gcc/gcc -std=gnu99 -fPIC -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX    -c -o luac.o luac.c
     42    ar rcu liblua.a lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o lundump.o lvm.o lzio.o lauxlib.o lb
           aselib.o lbitlib.o lcorolib.o ldblib.o liolib.o lmathlib.o loslib.o lstrlib.o ltablib.o lutf8lib.o loadlib.o linit.o
     43    ar: `u' modifier ignored since `D' is the default (see `U')
     44    ranlib liblua.a
     45    /home/joe/spack/lib/spack/env/gcc/gcc -std=gnu99 -fPIC -o lua  -L/home/joe/spack/opt/spack/linux-debian10-haswell/gcc-8.3.0/readline-8.0-attqxu4bt7rbke4bqhlbedsn5pux3xeu/lib -L/usr/lib lua.o 
           liblua.a -lm -Wl,-E -ldl -lreadline -lncursesw -ltinfow
     46    /home/joe/spack/lib/spack/env/gcc/gcc -std=gnu99 -fPIC -o luac  -L/home/joe/spack/opt/spack/linux-debian10-haswell/gcc-8.3.0/readline-8.0-attqxu4bt7rbke4bqhlbedsn5pux3xeu/lib -L/usr/lib luac.
           o liblua.a -lm -Wl,-E -ldl -lreadline -lncursesw -ltinfow
  >> 47    /usr/bin/ld: cannot find -ltinfow
  >> 48    collect2: error: ld returned 1 exit status
  >> 49    /usr/bin/ld: cannot find -ltinfow
     50    make[2]: *** [Makefile:66: luac] Error 1
     51    make[2]: *** Waiting for unfinished jobs....
  >> 52    collect2: error: ld returned 1 exit status
     53    make[2]: *** [Makefile:63: lua] Error 1
     54    make[2]: Leaving directory '/tmp/joe/spack-stage/spack-stage-lua-5.3.5-4wo4eijeii2m4mkthvrtbiiponlqjo3s/spack-src/src'
     55    make[1]: *** [Makefile:110: linux] Error 2
     56    make[1]: Leaving directory '/tmp/joe/spack-stage/spack-stage-lua-5.3.5-4wo4eijeii2m4mkthvrtbiiponlqjo3s/spack-src/src'
     57    make: *** [Makefile:55: linux] Error 2
```

### Information on your system

```
$ spack debug report
* **Spack:** 0.16.0-1202-94a9e511cb
* **Python:** 3.7.3
* **Platform:** linux-debian10-haswell
* **Concretizer:** original
```

<!-- If you have any relevant configuration detail (custom `packages.yaml` or `modules.yaml`, etc.) you can add that here as well. -->

### Additional information

spack-build-out.txt and spack-build-env.txt cannot be found in the stage directory

No maintainers found for lua

Mannually editing line 57 of the lua package so that
```
MYLIBS=-lncurses -ltinfo
```
results in a working build.

### General information

<!-- These boxes can be checked by replacing [ ] with [x] or by clicking them after submitting the issue. -->
- [ 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
- [ ] 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 ran into this too.  Thanks for the fix, @schoonovernumerics 

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/lua/package.py b/var/spack/repos/builtin/packages/lua/package.py
--- a/var/spack/repos/builtin/packages/lua/package.py
+++ b/var/spack/repos/builtin/packages/lua/package.py
@@ -63,10 +63,10 @@ def install(self, spec, prefix):
         else:
             target = 'linux'
         make('INSTALL_TOP=%s' % prefix,
-             'MYLDFLAGS=-L%s -L%s' % (
-                 spec['readline'].prefix.lib,
-                 spec['ncurses'].prefix.lib),
-             'MYLIBS=-lncursesw -ltinfow',
+             'MYLDFLAGS=' + ' '.join((
+                 spec['readline'].libs.search_flags,
+                 spec['ncurses'].libs.search_flags)),
+             'MYLIBS=%s' % spec['ncurses'].libs.link_flags,
              'CC=%s -std=gnu99 %s' % (spack_cc,
                                       self.compiler.cc_pic_flag),
              target)


Test patch: