summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorDylan Simon <dylan@dylex.net>2022-04-20 03:44:34 -0400
committerGitHub <noreply@github.com>2022-04-20 09:44:34 +0200
commit7aa1fef5064aa3882ec1d91ab008201e155b77dd (patch)
treeaad0adc5f36733efd6f8fa694a11da8cb752e742 /var
parent2d94624d0ab083f7c1d0b4c3b12ecf7e744206e7 (diff)
downloadspack-7aa1fef5064aa3882ec1d91ab008201e155b77dd.tar.gz
spack-7aa1fef5064aa3882ec1d91ab008201e155b77dd.tar.bz2
spack-7aa1fef5064aa3882ec1d91ab008201e155b77dd.tar.xz
spack-7aa1fef5064aa3882ec1d91ab008201e155b77dd.zip
ncurses: add query parameters to select wide/nowide; readline: use wide only (#30144)
* ncurses: add wide, nowide headers, libs query parameter options * readline: only link with libncursesw Needed for python to detect proper ncurses library #27369
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/ncurses/package.py42
-rw-r--r--var/spack/repos/builtin/packages/readline/package.py2
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