From 3b0311a1e484a4f731d1cc6448dc6804410ecb3c Mon Sep 17 00:00:00 2001
From: Dhanannjay Deo <dhanannjay.deo@kitware.com>
Date: Thu, 31 Mar 2016 10:30:32 -0400
Subject: [PATCH] Add variant opengl2, which is ON by default

Needed for visit which depends on vtk@6.1.0~opengl2
---
 var/spack/repos/builtin/packages/vtk/package.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/var/spack/repos/builtin/packages/vtk/package.py b/var/spack/repos/builtin/packages/vtk/package.py
index b29d52d0f0..24382af406 100644
--- a/var/spack/repos/builtin/packages/vtk/package.py
+++ b/var/spack/repos/builtin/packages/vtk/package.py
@@ -15,7 +15,15 @@ class Vtk(Package):
 
     depends_on("qt")
 
+    # VTK7 defaults to OpenGL2 rendering backend
+    variant('opengl2', default=True, description='Build with OpenGL instead of OpenGL2 as rendering backend')
+
     def install(self, spec, prefix):
+        def feature_to_bool(feature, on='ON', off='OFF'):
+            if feature in spec:
+                return on
+            return off
+
         with working_dir('spack-build', create=True):
             cmake_args = [
                 "..",
@@ -43,6 +51,8 @@ def install(self, spec, prefix):
                 cmake_args.append("-DCMAKE_C_FLAGS=-DGLX_GLXEXT_LEGACY")
                 cmake_args.append("-DCMAKE_CXX_FLAGS=-DGLX_GLXEXT_LEGACY")
 
+            cmake_args.append('-DVTK_RENDERING_BACKEND:STRING=%s' % feature_to_bool('+opengl2', 'OpenGL2', 'OpenGL'))
+
             cmake(*cmake_args)
             make()
             make("install")
-- 
GitLab