Don't use prefix.lib in tcl/tk/glib/etc (#19761)

This commit is contained in:
Adam J. Stewart 2020-11-14 05:42:51 -06:00 committed by GitHub
parent cd7c2fca02
commit 168dd6d03a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 79 additions and 84 deletions

View File

@ -155,7 +155,7 @@ def install_test(self):
'test_cblas_dgemm.output') 'test_cblas_dgemm.output')
include_flags = ["-I%s" % self.spec.prefix.include] include_flags = ["-I%s" % self.spec.prefix.include]
link_flags = self.libs.ld_flags.split() link_flags = self.spec['atlas'].libs.ld_flags.split()
output = compile_c_and_execute(source_file, include_flags, link_flags) output = compile_c_and_execute(source_file, include_flags, link_flags)
compare_output_file(output, blessed_file) compare_output_file(output, blessed_file)

View File

@ -3,8 +3,6 @@
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os.path
class EnvironmentModules(Package): class EnvironmentModules(Package):
"""The Environment Modules package provides for the dynamic """The Environment Modules package provides for the dynamic
@ -51,21 +49,13 @@ class EnvironmentModules(Package):
def install(self, spec, prefix): def install(self, spec, prefix):
tcl = spec['tcl'] tcl = spec['tcl']
# Determine where we can find tclConfig.sh
for tcl_lib_dir in [tcl.prefix.lib, tcl.prefix.lib64]:
tcl_config_file = os.path.join(tcl_lib_dir, 'tclConfig.sh')
if os.path.exists(tcl_config_file):
break
else:
raise InstallError('Failed to locate tclConfig.sh')
config_args = [ config_args = [
"--prefix=" + prefix, "--prefix=" + prefix,
"--without-tclx", "--without-tclx",
"--with-tclx-ver=0.0", "--with-tclx-ver=0.0",
# It looks for tclConfig.sh # It looks for tclConfig.sh
"--with-tcl=" + tcl_lib_dir, "--with-tcl=" + tcl.libs.directories[0],
"--with-tcl-ver={0}.{1}".format(*tcl.version.version[0:2]), "--with-tcl-ver={0}".format(tcl.version.up_to(2)),
'--disable-versioning', '--disable-versioning',
'--datarootdir=' + prefix.share '--datarootdir=' + prefix.share
] ]

View File

@ -24,6 +24,9 @@ class Expect(AutotoolsPackage):
depends_on('libtool', type='build') depends_on('libtool', type='build')
depends_on('m4', type='build') depends_on('m4', type='build')
# https://github.com/spack/spack/issues/19767
conflicts('%apple-clang@12:')
force_autoreconf = True force_autoreconf = True
patch('expect_detect_tcl_private_header_os_x_mountain_lion.patch', when='@5.45') patch('expect_detect_tcl_private_header_os_x_mountain_lion.patch', when='@5.45')
@ -37,8 +40,8 @@ def configure_args(self):
'--enable-threads', '--enable-threads',
'--enable-shared', '--enable-shared',
'--enable-64bit', '--enable-64bit',
'--with-tcl={0}'.format(spec['tcl'].prefix.lib), '--with-tcl={0}'.format(spec['tcl'].libs.directories[0]),
'--with-tclinclude={0}'.format(spec['tcl'].prefix.include), '--with-tclinclude={0}'.format(spec['tcl'].headers.directories[0]),
] ]
return args return args

View File

@ -83,6 +83,10 @@ def url_for_version(self, version):
url = 'http://ftp.gnome.org/pub/gnome/sources/glib' url = 'http://ftp.gnome.org/pub/gnome/sources/glib'
return url + '/%s/glib-%s.tar.xz' % (version.up_to(2), version) return url + '/%s/glib-%s.tar.xz' % (version.up_to(2), version)
@property
def libs(self):
return find_libraries(['libglib*'], root=self.prefix, recursive=True)
def meson_args(self): def meson_args(self):
args = ['-Dgettext=external'] args = ['-Dgettext=external']
if self.spec.satisfies('@2.63.5:'): if self.spec.satisfies('@2.63.5:'):
@ -256,6 +260,8 @@ def gettext_libdir(self):
if spec.satisfies('@2:2.99'): if spec.satisfies('@2:2.99'):
pattern = 'Libs:' pattern = 'Libs:'
repl = 'Libs: -L{0} -Wl,-rpath={0} '.format( repl = 'Libs: -L{0} -Wl,-rpath={0} '.format(
spec['gettext'].prefix.lib) spec['gettext'].libs.directories[0])
myfile = join_path(self.prefix.lib.pkgconfig, 'glib-2.0.pc') myfile = join_path(
self.spec['glib'].libs.directories[0],
'pkgconfig', 'glib-2.0.pc')
filter_file(pattern, repl, myfile, backup=False) filter_file(pattern, repl, myfile, backup=False)

View File

@ -77,20 +77,22 @@ def cmake_args(self):
# as is done for the tclsh executable # as is done for the tclsh executable
args += [ args += [
'-DTCL_INCLUDE_PATH={0}/include'.format( '-DTCL_INCLUDE_PATH={0}/include'.format(
self.spec['tcl'].prefix.include self.spec['tcl'].headers.directories[0]
), ),
'-DTCL_LIBRARY={0}'.format( '-DTCL_LIBRARY={0}'.format(
LibraryList(find_libraries( LibraryList(find_libraries(
'libtcl*', 'libtcl*',
self.spec['tcl'].prefix.lib, self.spec['tcl'].prefix,
shared=True, shared=True,
recursive=True,
)), )),
), ),
'-DTCL_STUB_LIBRARY={0}'.format( '-DTCL_STUB_LIBRARY={0}'.format(
LibraryList(find_libraries( LibraryList(find_libraries(
'libtclstub*', 'libtclstub*',
self.spec['tcl'].prefix.lib, self.spec['tcl'].prefix,
shared=False, shared=False,
recursive=True,
)), )),
) )
] ]

View File

@ -914,7 +914,8 @@ def easy_install_file(self):
return join_path(self.site_packages_dir, "easy-install.pth") return join_path(self.site_packages_dir, "easy-install.pth")
def setup_run_environment(self, env): def setup_run_environment(self, env):
env.prepend_path('CPATH', os.pathsep.join(self.headers.directories)) env.prepend_path('CPATH', os.pathsep.join(
self.spec['python'].headers.directories))
def setup_dependent_build_environment(self, env, dependent_spec): def setup_dependent_build_environment(self, env, dependent_spec):
"""Set PYTHONPATH to include the site-packages directory for the """Set PYTHONPATH to include the site-packages directory for the

View File

@ -21,6 +21,7 @@ class R(AutotoolsPackage):
extendable = True extendable = True
version('4.0.3', sha256='09983a8a78d5fb6bc45d27b1c55f9ba5265f78fa54a55c13ae691f87c5bb9e0d')
version('4.0.2', sha256='d3bceab364da0876625e4097808b42512395fdf41292f4915ab1fd257c1bbe75') version('4.0.2', sha256='d3bceab364da0876625e4097808b42512395fdf41292f4915ab1fd257c1bbe75')
version('4.0.1', sha256='95fe24a4d8d8f8f888460c8f5fe4311cec656e7a1722d233218bc03861bc6f32') version('4.0.1', sha256='95fe24a4d8d8f8f888460c8f5fe4311cec656e7a1722d233218bc03861bc6f32')
version('4.0.0', sha256='06beb0291b569978484eb0dcb5d2339665ec745737bdfb4e873e7a5a75492940') version('4.0.0', sha256='06beb0291b569978484eb0dcb5d2339665ec745737bdfb4e873e7a5a75492940')
@ -126,10 +127,8 @@ def configure_args(self):
spec = self.spec spec = self.spec
prefix = self.prefix prefix = self.prefix
tcl_config_path = join_path(spec['tcl'].prefix.lib, 'tclConfig.sh') tcl_config_path = join_path(
if not os.path.exists(tcl_config_path): spec['tcl'].libs.directories[0], 'tclConfig.sh')
tcl_config_path = join_path(spec['tcl'].prefix,
'lib64', 'tclConfig.sh')
config_args = [ config_args = [
'--libdir={0}'.format(join_path(prefix, 'rlib')), '--libdir={0}'.format(join_path(prefix, 'rlib')),
@ -142,10 +141,8 @@ def configure_args(self):
'R', 'lib')), 'R', 'lib')),
] ]
if '^tk' in spec: if '^tk' in spec:
tk_config_path = join_path(spec['tk'].prefix.lib, 'tkConfig.sh') tk_config_path = join_path(
if not os.path.exists(tk_config_path): spec['tk'].libs.directories[0], 'tkConfig.sh')
tk_config_path = join_path(spec['tk'].prefix,
'lib64', 'tkConfig.sh')
config_args.append('--with-tk-config={0}'.format(tk_config_path)) config_args.append('--with-tk-config={0}'.format(tk_config_path))
if '+external-lapack' in spec: if '+external-lapack' in spec:

View File

@ -22,6 +22,6 @@ def configure_args(self):
args = [ args = [
'--enable-shared', '--enable-shared',
'--enable-threads', '--enable-threads',
'--with-tcl=' + self.spec['tcl'].tcl_lib_dir, '--with-tcl=' + self.spec['tcl'].libs.directories[0],
] ]
return args return args

View File

@ -26,14 +26,17 @@ class TclTclxml(AutotoolsPackage):
depends_on('libxml2') depends_on('libxml2')
depends_on('libxslt') depends_on('libxslt')
# Results in C99 build error
conflicts('%apple-clang@12:')
def configure_args(self): def configure_args(self):
return [ return [
'--exec-prefix={0}'.format( '--exec-prefix={0}'.format(
self.prefix), self.prefix),
'--with-tcl={0}/lib'.format( '--with-tcl={0}'.format(
self.spec['tcl'].prefix), self.spec['tcl'].libs.directories[0]),
'--with-xml2-config={0}/bin/xml2-config'.format( '--with-xml2-config={0}'.format(
self.spec['libxml2'].prefix), self.spec['libxml2'].prefix.bin.join('xml2-config')),
'--with-xslt-config={0}/bin/xslt-config'.format( '--with-xslt-config={0}'.format(
self.spec['libxslt'].prefix), self.spec['libxslt'].prefix.bin.join('xslt-config')),
] ]

View File

@ -6,7 +6,6 @@
import os import os
from spack.util.environment import is_system_path from spack.util.environment import is_system_path
from spack import *
class Tcl(AutotoolsPackage, SourceforgePackage): class Tcl(AutotoolsPackage, SourceforgePackage):
@ -56,7 +55,8 @@ def install(self, spec, prefix):
# Replace stage dir -> installed src dir in tclConfig # Replace stage dir -> installed src dir in tclConfig
filter_file( filter_file(
stage_src, installed_src, stage_src, installed_src,
join_path(self.spec.prefix, 'lib', 'tclConfig.sh')) join_path(self.spec['tcl'].libs.directories[0],
'tclConfig.sh'))
# Don't install binaries in src/ tree # Don't install binaries in src/ tree
with working_dir(join_path(installed_src, self.configure_directory)): with working_dir(join_path(installed_src, self.configure_directory)):
@ -85,45 +85,35 @@ def command(self):
""" """
return Executable(os.path.realpath(self.prefix.bin.tclsh)) return Executable(os.path.realpath(self.prefix.bin.tclsh))
@property
def tcl_lib_dir(self):
"""The Tcl version-specific library directory where all extensions are
installed."""
return 'lib'
@property
def tcl_builtin_lib_dir(self):
"""The Tcl version-specific library directory where all builtin
extensions are installed."""
return join_path(self.tcl_lib_dir,
'tcl{0}'.format(self.version.up_to(2)))
def setup_run_environment(self, env): def setup_run_environment(self, env):
# When using Tkinter from within spack provided python+tkinter, python # When using Tkinter from within spack provided python+tkinter, python
# will not be able to find Tcl/Tk unless TCL_LIBRARY is set. # will not be able to find Tcl/Tk unless TCL_LIBRARY is set.
env.set('TCL_LIBRARY', join_path(self.prefix, self.tcl_lib_dir)) env.set('TCL_LIBRARY', self.spec['tcl'].libs.directories[0])
def setup_dependent_build_environment(self, env, dependent_spec): def setup_dependent_build_environment(self, env, dependent_spec):
"""Set TCLLIBPATH to include the tcl-shipped directory for """Set TCLLIBPATH to include the tcl-shipped directory for
extensions and any other tcl extension it depends on. extensions and any other tcl extension it depends on.
For further info see: https://wiki.tcl.tk/1787""" For further info see: https://wiki.tcl.tk/1787"""
env.set('TCL_LIBRARY', join_path(self.prefix, self.tcl_lib_dir)) env.set('TCL_LIBRARY', self.spec['tcl'].libs.directories[0])
# If we set TCLLIBPATH, we must also ensure that the corresponding # If we set TCLLIBPATH, we must also ensure that the corresponding
# tcl is found in the build environment. This to prevent cases # tcl is found in the build environment. This to prevent cases
# where a system provided tcl is run against the standard libraries # where a system provided tcl is run against the standard libraries
# of a Spack built tcl. See issue #7128 that relates to python but # of a Spack built tcl. See issue #7128 that relates to python but
# it boils down to the same situation we have here. # it boils down to the same situation we have here.
path = os.path.dirname(self.command.path) if not is_system_path(self.prefix.bin):
if not is_system_path(path): env.prepend_path('PATH', self.prefix.bin)
env.prepend_path('PATH', path)
tcl_paths = [join_path(self.prefix, self.tcl_builtin_lib_dir)] tcl_paths = [join_path(self.spec['tcl'].libs.directories[0],
'tcl{0}'.format(self.version.up_to(2)))]
for d in dependent_spec.traverse(deptype=('build', 'run', 'test')): for d in dependent_spec.traverse(deptype=('build', 'run', 'test')):
if d.package.extends(self.spec): if d.package.extends(self.spec):
tcl_paths.append(join_path(d.prefix, self.tcl_lib_dir)) # Tcl libraries may be installed in lib or lib64, see #19546
for lib in ['lib', 'lib64']:
tcl_paths.append(join_path(
d.prefix, lib, 'tcl{0}'.format(self.version.up_to(2))))
# WARNING: paths in $TCLLIBPATH must be *space* separated, # WARNING: paths in $TCLLIBPATH must be *space* separated,
# its value is meant to be a Tcl list, *not* an env list # its value is meant to be a Tcl list, *not* an env list
@ -141,6 +131,9 @@ def setup_dependent_run_environment(self, env, dependent_spec):
# For run time environment set only the path for # For run time environment set only the path for
# dependent_spec and prepend it to TCLLIBPATH # dependent_spec and prepend it to TCLLIBPATH
if dependent_spec.package.extends(self.spec): if dependent_spec.package.extends(self.spec):
dependent_tcllibpath = join_path(dependent_spec.prefix, # Tcl libraries may be installed in lib or lib64, see #19546
self.tcl_lib_dir) for lib in ['lib', 'lib64']:
env.prepend_path('TCLLIBPATH', dependent_tcllibpath, separator=' ') tcllibpath = join_path(
self.prefix, lib, 'tcl{0}'.format(self.version.up_to(2)))
if os.path.exists(tcllibpath):
env.prepend_path('TCLLIBPATH', tcllibpath, separator=' ')

View File

@ -20,13 +20,14 @@ class Tix(AutotoolsPackage):
def configure_args(self): def configure_args(self):
spec = self.spec spec = self.spec
config_args = ['--with-tcl={0}'.format(spec['tcl'].prefix.lib), args = [
'--with-tk={0}'.format(spec['tk'].prefix.lib), '--with-tcl={0}'.format(spec['tcl'].libs.directories[0]),
'--exec-prefix={0}'.format(spec.prefix)] '--with-tk={0}'.format(spec['tk'].libs.directories[0]),
return config_args '--exec-prefix={0}'.format(self.prefix),
]
return args
def install(self, spec, prefix): @property
make('install') def libs(self):
with working_dir(self.prefix.lib): return find_libraries(['libTix{0}'.format(self.version)],
symlink('Tix{0}/libTix{0}.{1}'.format(self.version, dso_suffix), root=self.prefix, recursive=True)
'libtix.{0}'.format(dso_suffix))

View File

@ -17,10 +17,11 @@ class Tk(AutotoolsPackage, SourceforgePackage):
homepage = "http://www.tcl.tk" homepage = "http://www.tcl.tk"
sourceforge_mirror_path = "tcl/tk8.6.5-src.tar.gz" sourceforge_mirror_path = "tcl/tk8.6.5-src.tar.gz"
version('8.6.8', sha256='49e7bca08dde95195a27f594f7c850b088be357a7c7096e44e1158c7a5fd7b33') version('8.6.10', sha256='63df418a859d0a463347f95ded5cd88a3dd3aaa1ceecaeee362194bc30f3e386')
version('8.6.6', sha256='d62c371a71b4744ed830e3c21d27968c31dba74dd2c45f36b9b071e6d88eb19d') version('8.6.8', sha256='49e7bca08dde95195a27f594f7c850b088be357a7c7096e44e1158c7a5fd7b33')
version('8.6.5', sha256='fbbd93541b4cd467841208643b4014c4543a54c3597586727f0ab128220d7946') version('8.6.6', sha256='d62c371a71b4744ed830e3c21d27968c31dba74dd2c45f36b9b071e6d88eb19d')
version('8.6.3', sha256='ba15d56ac27d8c0a7b1a983915a47e0f635199b9473cf6e10fbce1fc73fd8333') version('8.6.5', sha256='fbbd93541b4cd467841208643b4014c4543a54c3597586727f0ab128220d7946')
version('8.6.3', sha256='ba15d56ac27d8c0a7b1a983915a47e0f635199b9473cf6e10fbce1fc73fd8333')
version('8.5.19', sha256='407af1de167477d598bd6166d84459a3bdccc2fb349360706154e646a9620ffa') version('8.5.19', sha256='407af1de167477d598bd6166d84459a3bdccc2fb349360706154e646a9620ffa')
variant('xft', default=True, variant('xft', default=True,
@ -53,7 +54,7 @@ def install(self, spec, prefix):
# Replace stage dir -> installed src dir in tkConfig # Replace stage dir -> installed src dir in tkConfig
filter_file( filter_file(
stage_src, installed_src, stage_src, installed_src,
join_path(self.spec.prefix, 'lib', 'tkConfig.sh')) join_path(self.spec['tk'].libs.directories[0], 'tkConfig.sh'))
@property @property
def libs(self): def libs(self):
@ -63,19 +64,17 @@ def libs(self):
def setup_run_environment(self, env): def setup_run_environment(self, env):
# When using Tkinter from within spack provided python+tkinter, python # When using Tkinter from within spack provided python+tkinter, python
# will not be able to find Tcl/Tk unless TK_LIBRARY is set. # will not be able to find Tcl/Tk unless TK_LIBRARY is set.
env.set('TK_LIBRARY', join_path(self.prefix.lib, 'tk{0}'.format( env.set('TK_LIBRARY', self.spec['tk'].libs.directories[0])
self.spec.version.up_to(2))))
def setup_dependent_build_environment(self, env, dependent_spec): def setup_dependent_build_environment(self, env, dependent_spec):
env.set('TK_LIBRARY', join_path(self.prefix.lib, 'tk{0}'.format( env.set('TK_LIBRARY', self.spec['tk'].libs.directories[0])
self.spec.version.up_to(2))))
def configure_args(self): def configure_args(self):
spec = self.spec spec = self.spec
config_args = [ config_args = [
'--with-tcl={0}'.format(spec['tcl'].prefix.lib), '--with-tcl={0}'.format(spec['tcl'].libs.directories[0]),
'--x-includes={0}'.format(spec['libx11'].prefix.include), '--x-includes={0}'.format(spec['libx11'].headers.directories[0]),
'--x-libraries={0}'.format(spec['libx11'].prefix.lib) '--x-libraries={0}'.format(spec['libx11'].libs.directories[0])
] ]
config_args += self.enable_or_disable('xft') config_args += self.enable_or_disable('xft')
config_args += self.enable_or_disable('xss') config_args += self.enable_or_disable('xss')

View File

@ -21,8 +21,8 @@ class Wordnet(AutotoolsPackage):
def configure_args(self): def configure_args(self):
args = [] args = []
args.append('--with-tk=%s' % self.spec['tk'].prefix.lib) args.append('--with-tk=%s' % self.spec['tk'].libs.directories[0])
args.append('--with-tcl=%s' % self.spec['tcl'].prefix.lib) args.append('--with-tcl=%s' % self.spec['tcl'].libs.directories[0])
if self.spec.satisfies('^tcl@8.6:'): if self.spec.satisfies('^tcl@8.6:'):
args.append('CPPFLAGS=-DUSE_INTERP_RESULT') args.append('CPPFLAGS=-DUSE_INTERP_RESULT')