ncurses: adding external support. (#18609)
* ncurses: adding external support. * Update var/spack/repos/builtin/packages/ncurses/package.py Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com> * Update var/spack/repos/builtin/packages/ncurses/package.py Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com> * Update var/spack/repos/builtin/packages/ncurses/package.py Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com> * Fixing includes. Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
This commit is contained in:
parent
8ad2cc2acf
commit
afb0883762
@ -4,9 +4,8 @@
|
|||||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|
||||||
from spack import *
|
from spack import *
|
||||||
from glob import glob
|
import glob
|
||||||
from os.path import exists, join
|
import os
|
||||||
from os import makedirs
|
|
||||||
|
|
||||||
|
|
||||||
class Ncurses(AutotoolsPackage, GNUMirrorPackage):
|
class Ncurses(AutotoolsPackage, GNUMirrorPackage):
|
||||||
@ -20,6 +19,8 @@ class Ncurses(AutotoolsPackage, GNUMirrorPackage):
|
|||||||
# URL must remain http:// so Spack can bootstrap curl
|
# URL must remain http:// so Spack can bootstrap curl
|
||||||
gnu_mirror_path = "ncurses/ncurses-6.1.tar.gz"
|
gnu_mirror_path = "ncurses/ncurses-6.1.tar.gz"
|
||||||
|
|
||||||
|
executables = [r'^ncursesw?\d*-config$']
|
||||||
|
|
||||||
version('6.2', sha256='30306e0c76e0f9f1f0de987cf1c82a5c21e1ce6568b9227f7da5b71cbea86c9d')
|
version('6.2', sha256='30306e0c76e0f9f1f0de987cf1c82a5c21e1ce6568b9227f7da5b71cbea86c9d')
|
||||||
version('6.1', sha256='aa057eeeb4a14d470101eff4597d5833dcef5965331be3528c08d99cebaa0d17')
|
version('6.1', sha256='aa057eeeb4a14d470101eff4597d5833dcef5965331be3528c08d99cebaa0d17')
|
||||||
version('6.0', sha256='f551c24b30ce8bfb6e96d9f59b42fbea30fa3a6123384172f9e7284bcf647260')
|
version('6.0', sha256='f551c24b30ce8bfb6e96d9f59b42fbea30fa3a6123384172f9e7284bcf647260')
|
||||||
@ -36,6 +37,37 @@ class Ncurses(AutotoolsPackage, GNUMirrorPackage):
|
|||||||
patch('patch_gcc_5.txt', when='@6.0%gcc@5.0:')
|
patch('patch_gcc_5.txt', when='@6.0%gcc@5.0:')
|
||||||
patch('sed_pgi.patch', when='@:6.0')
|
patch('sed_pgi.patch', when='@:6.0')
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def determine_version(cls, exe):
|
||||||
|
return Executable(exe)('--version', output=str, error=str).rstrip()
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def determine_variants(cls, exes, version):
|
||||||
|
results = []
|
||||||
|
for exe in exes:
|
||||||
|
variants = ''
|
||||||
|
output = Executable(exe)('--libs', output=str, error=str)
|
||||||
|
|
||||||
|
if '-ltinfo' in output:
|
||||||
|
variants += "+termlib"
|
||||||
|
|
||||||
|
output = Executable(exe)('--terminfo-dirs', output=str, error=str)
|
||||||
|
usingSymlinks = False
|
||||||
|
for termDir in output.split(':'):
|
||||||
|
for top, dirs, files in os.walk(termDir):
|
||||||
|
for filename in files:
|
||||||
|
if os.path.islink(os.path.join(top, filename)):
|
||||||
|
usingSymlinks = True
|
||||||
|
break
|
||||||
|
if usingSymlinks:
|
||||||
|
break
|
||||||
|
if usingSymlinks:
|
||||||
|
break
|
||||||
|
if usingSymlinks:
|
||||||
|
variants += '+symlinks'
|
||||||
|
results.append(variants)
|
||||||
|
return results
|
||||||
|
|
||||||
def setup_build_environment(self, env):
|
def setup_build_environment(self, env):
|
||||||
env.unset('TERMINFO')
|
env.unset('TERMINFO')
|
||||||
|
|
||||||
@ -99,11 +131,11 @@ def install(self, spec, prefix):
|
|||||||
make('install')
|
make('install')
|
||||||
|
|
||||||
# fix for packages like hstr that use "#include <ncurses/ncurses.h>"
|
# fix for packages like hstr that use "#include <ncurses/ncurses.h>"
|
||||||
headers = glob(join(prefix.include, '*'))
|
headers = glob.glob(os.path.join(prefix.include, '*'))
|
||||||
for p_dir in ['ncurses', 'ncursesw']:
|
for p_dir in ['ncurses', 'ncursesw']:
|
||||||
path = join(prefix.include, p_dir)
|
path = os.path.join(prefix.include, p_dir)
|
||||||
if not exists(path):
|
if not os.path.exists(path):
|
||||||
makedirs(path)
|
os.makedirs(path)
|
||||||
for header in headers:
|
for header in headers:
|
||||||
install(header, path)
|
install(header, path)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user