summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorFederico Ficarelli <federico.ficarelli@gmail.com>2018-03-13 02:31:03 +0100
committerTodd Gamblin <tgamblin@llnl.gov>2018-03-13 10:31:03 +0900
commitb594f89d5e672c00a43e172666635bcb3a47eb33 (patch)
tree9948d1c8e0536652bff5968a4edfa1b259182009 /var
parentb4a9e37a98c1adbb0cf757523b267213aa6fce95 (diff)
downloadspack-b594f89d5e672c00a43e172666635bcb3a47eb33.tar.gz
spack-b594f89d5e672c00a43e172666635bcb3a47eb33.tar.bz2
spack-b594f89d5e672c00a43e172666635bcb3a47eb33.tar.xz
spack-b594f89d5e672c00a43e172666635bcb3a47eb33.zip
Treat tcl as extendable (#7410)
* Make tcl package extendable * Let tk extend tcl * Fix environment for Tcl extensions
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/tcl/package.py44
-rw-r--r--var/spack/repos/builtin/packages/tk/package.py4
2 files changed, 45 insertions, 3 deletions
diff --git a/var/spack/repos/builtin/packages/tcl/package.py b/var/spack/repos/builtin/packages/tcl/package.py
index 219c63e62b..0b30611435 100644
--- a/var/spack/repos/builtin/packages/tcl/package.py
+++ b/var/spack/repos/builtin/packages/tcl/package.py
@@ -22,6 +22,8 @@
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
+import os
+
from spack import *
@@ -42,6 +44,8 @@ class Tcl(AutotoolsPackage):
version('8.6.3', 'db382feca91754b7f93da16dc4cdad1f')
version('8.5.19', '0e6426a4ca9401825fbc6ecf3d89a326')
+ extendable = True
+
depends_on('zlib')
configure_directory = 'unix'
@@ -49,8 +53,7 @@ class Tcl(AutotoolsPackage):
def setup_environment(self, spack_env, run_env):
# When using Tkinter from within spack provided python+tk, python
# will not be able to find Tcl/Tk unless TCL_LIBRARY is set.
- run_env.set('TCL_LIBRARY', join_path(self.prefix.lib, 'tcl{0}'.format(
- self.spec.version.up_to(2))))
+ run_env.set('TCL_LIBRARY', join_path(self.prefix, self.tcl_lib_dir))
def install(self, spec, prefix):
with working_dir(self.build_directory):
@@ -63,3 +66,40 @@ class Tcl(AutotoolsPackage):
def symlink_tclsh(self):
with working_dir(self.prefix.bin):
symlink('tclsh{0}'.format(self.version.up_to(2)), 'tclsh')
+
+ # ========================================================================
+ # Set up environment to make install easy for tcl extensions.
+ # ========================================================================
+
+ @property
+ def tcl_lib_dir(self):
+ """The Tcl version-specific library directory where all extensions are
+ installed."""
+ return join_path('lib', 'tcl{0}'.format(self.version.up_to(2)))
+
+ def setup_dependent_environment(self, spack_env, run_env, dependent_spec):
+ """Set TCLLIBPATH to include the tcl-shipped directory for
+ extensions and any other tcl extension it depends on.
+ For further info see: https://wiki.tcl.tk/1787"""
+
+ # If we set TCLLIBPATH, we must also ensure that the corresponding
+ # tcl is found in the build environment. This to prevent cases
+ # where a system provided tcl is run against the standard libraries
+ # of a Spack built tcl. See issue #7128 that relates to python but
+ # it boils down to the same situation we have here.
+ spack_env.prepend_path('PATH', os.path.dirname(self.prefix.bin))
+
+ tcl_paths = [join_path(self.prefix, self.tcl_lib_dir)]
+
+ for d in dependent_spec.traverse(deptype=('build', 'run', 'test')):
+ if d.package.extends(self.spec):
+ tcl_paths.append(join_path(d.prefix, self.tcl_lib_dir))
+
+ tcllibpath = ':'.join(tcl_paths)
+ spack_env.set('TCLLIBPATH', tcllibpath)
+
+ # For run time environment set only the path for
+ # dependent_spec and prepend it to TCLLIBPATH
+ if dependent_spec.package.extends(self.spec):
+ run_env.prepend_path('TCLLIBPATH', join_path(
+ dependent_spec.prefix, self.tcl_lib_dir))
diff --git a/var/spack/repos/builtin/packages/tk/package.py b/var/spack/repos/builtin/packages/tk/package.py
index b03d07013a..1b3028622b 100644
--- a/var/spack/repos/builtin/packages/tk/package.py
+++ b/var/spack/repos/builtin/packages/tk/package.py
@@ -39,7 +39,9 @@ class Tk(AutotoolsPackage):
version('8.6.5', '11dbbd425c3e0201f20d6a51482ce6c4')
version('8.6.3', '85ca4dbf4dcc19777fd456f6ee5d0221')
- depends_on('tcl')
+ extends('tcl')
+
+ depends_on('tcl@8.6:')
depends_on('libx11')
configure_directory = 'unix'