Add version constraints to VTK patch (#3357)

This commit is contained in:
Adam J. Stewart 2017-03-17 09:19:44 -05:00 committed by GitHub
parent 19b3afebc9
commit 2c39f16d44

View File

@ -26,14 +26,15 @@
from spack import * from spack import *
class Vtk(Package): class Vtk(CMakePackage):
"""The Visualization Toolkit (VTK) is an open-source, freely """The Visualization Toolkit (VTK) is an open-source, freely
available software system for 3D computer graphics, image available software system for 3D computer graphics, image
processing and visualization. """ processing and visualization. """
homepage = "http://www.vtk.org" homepage = "http://www.vtk.org"
base_url = "http://www.vtk.org/files/release" url = "http://www.vtk.org/files/release/7.1/VTK-7.1.0.tar.gz"
version('7.1.0', 'a7e814c1db503d896af72458c2d0228f')
version('7.0.0', '5fe35312db5fb2341139b8e4955c367d') version('7.0.0', '5fe35312db5fb2341139b8e4955c367d')
version('6.3.0', '0231ca4840408e9dd60af48b314c5b6d') version('6.3.0', '0231ca4840408e9dd60af48b314c5b6d')
version('6.1.0', '25e4dfb3bad778722dcaec80cd5dab7d') version('6.1.0', '25e4dfb3bad778722dcaec80cd5dab7d')
@ -42,22 +43,19 @@ class Vtk(Package):
variant('opengl2', default=True, description='Build with OpenGL2 instead of OpenGL as rendering backend') variant('opengl2', default=True, description='Build with OpenGL2 instead of OpenGL as rendering backend')
variant('python', default=False, description='Build the python modules') variant('python', default=False, description='Build the python modules')
patch('gcc.patch') patch('gcc.patch', when='@6.1.0')
depends_on('cmake', type='build')
depends_on('qt') depends_on('qt')
extends('python', when='+python') extends('python', when='+python')
depends_on('python', when='+python')
def url_for_version(self, ver): def url_for_version(self, version):
return '{0}/{1}/VTK-{2}.tar.gz'.format(Vtk.base_url, ver.up_to(2), ver) url = "http://www.vtk.org/files/release/{0}/VTK-{1}.tar.gz"
return url.format(version.up_to(2), version)
def install(self, spec, prefix): def cmake_args(self):
def feature_to_bool(feature, on='ON', off='OFF'): spec = self.spec
return on if '+{0}'.format(feature) in spec else off
with working_dir('spack-build', create=True):
opengl_ver = 'OpenGL{0}'.format('2' if '+opengl2' in spec else '') opengl_ver = 'OpenGL{0}'.format('2' if '+opengl2' in spec else '')
qt_ver = spec['qt'].version.up_to(1) qt_ver = spec['qt'].version.up_to(1)
qt_bin = spec['qt'].prefix.bin qt_bin = spec['qt'].prefix.bin
@ -68,7 +66,8 @@ def feature_to_bool(feature, on='ON', off='OFF'):
'-DVTK_RENDERING_BACKEND:STRING={0}'.format(opengl_ver), '-DVTK_RENDERING_BACKEND:STRING={0}'.format(opengl_ver),
# Enable/Disable wrappers for Python. # Enable/Disable wrappers for Python.
'-DVTK_WRAP_PYTHON={0}'.format(feature_to_bool('python')), '-DVTK_WRAP_PYTHON={0}'.format(
'ON' if '+python' in spec else 'OFF'),
# Disable wrappers for other languages. # Disable wrappers for other languages.
'-DVTK_WRAP_JAVA=OFF', '-DVTK_WRAP_JAVA=OFF',
@ -94,6 +93,4 @@ def feature_to_bool(feature, on='ON', off='OFF'):
cmake_args.append('-DCMAKE_C_FLAGS=-DGLX_GLXEXT_LEGACY') cmake_args.append('-DCMAKE_C_FLAGS=-DGLX_GLXEXT_LEGACY')
cmake_args.append('-DCMAKE_CXX_FLAGS=-DGLX_GLXEXT_LEGACY') cmake_args.append('-DCMAKE_CXX_FLAGS=-DGLX_GLXEXT_LEGACY')
cmake('..', *cmake_args) return cmake_args
make()
make('install')