diff options
-rw-r--r-- | var/spack/repos/builtin/packages/ncurses/package.py | 42 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/readline/package.py | 2 |
2 files changed, 40 insertions, 4 deletions
diff --git a/var/spack/repos/builtin/packages/ncurses/package.py b/var/spack/repos/builtin/packages/ncurses/package.py index 393eab54e0..b160effabc 100644 --- a/var/spack/repos/builtin/packages/ncurses/package.py +++ b/var/spack/repos/builtin/packages/ncurses/package.py @@ -156,11 +156,47 @@ class Ncurses(AutotoolsPackage, GNUMirrorPackage): h = os.path.basename(header) os.symlink(os.path.join('ncursesw', h), os.path.join(prefix.include, h)) + def query_parameter_options(self): + """Use query parameters passed to spec (e.g., "spec[ncurses:wide]") + to select wide, non-wide, or default/both.""" + query_parameters = self.spec.last_query.extra_parameters + return 'nowide' in query_parameters, 'wide' in query_parameters + + @property + def headers(self): + nowide, wide = self.query_parameter_options() + include = self.prefix.include + hdirs = [] + if not (nowide or wide): + # default (top-level, wide) + hdirs.append(include) + if nowide: + hdirs.append(include.ncurses) + if wide: + hdirs.append(include.ncursesw) + + headers = HeaderList([]) + for hdir in hdirs: + headers = headers + find_headers('*', root=hdir, recursive=False).headers + headers.directories = hdirs + return headers + @property def libs(self): - libraries = ['libncurses', 'libncursesw'] + nowide, wide = self.query_parameter_options() + if not (nowide or wide): + # default (both) + nowide = True + wide = True + libs = ['libncurses'] if '+termlib' in self.spec: - libraries += ['libtinfo', 'libtinfow'] - + libs.append('libtinfo') + wlibs = [lib + 'w' for lib in libs] + + libraries = [] + if nowide: + libraries.extend(libs) + if wide: + libraries.extend(wlibs) return find_libraries(libraries, root=self.prefix, recursive=True) diff --git a/var/spack/repos/builtin/packages/readline/package.py b/var/spack/repos/builtin/packages/readline/package.py index 3dc78c13a7..8bc8e8207e 100644 --- a/var/spack/repos/builtin/packages/readline/package.py +++ b/var/spack/repos/builtin/packages/readline/package.py @@ -29,7 +29,7 @@ class Readline(AutotoolsPackage, GNUMirrorPackage): patch('readline-6.3-upstream_fixes-1.patch', when='@6.3') def build(self, spec, prefix): - make('SHLIB_LIBS=' + spec['ncurses'].libs.ld_flags) + make('SHLIB_LIBS=' + spec['ncurses:wide'].libs.ld_flags) def patch(self): # Remove flags not recognized by the NVIDIA compiler |