From d7ff4b8f342860942a03ebb9ede6ab24b6d2278d Mon Sep 17 00:00:00 2001
From: Jon Rood <jon.rood@nrel.gov>
Date: Fri, 16 Dec 2016 15:14:50 -0700
Subject: [PATCH] Updating Trilinos with superlu variant and fixing git branch
 version options. (#2604)

---
 .../builtin/packages/trilinos/package.py      | 26 ++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/var/spack/repos/builtin/packages/trilinos/package.py b/var/spack/repos/builtin/packages/trilinos/package.py
index beb1b38ba5..7558430953 100644
--- a/var/spack/repos/builtin/packages/trilinos/package.py
+++ b/var/spack/repos/builtin/packages/trilinos/package.py
@@ -45,7 +45,10 @@ class Trilinos(CMakePackage):
     homepage = "https://trilinos.org/"
     base_url = "https://github.com/trilinos/Trilinos/archive"
 
-    version('develop', git='https://github.com/trilinos/Trilinos.git', tag='master')
+    version('develop',
+            git='https://github.com/trilinos/Trilinos.git', tag='develop')
+    version('master',
+            git='https://github.com/trilinos/Trilinos.git', tag='master')
     version('12.10.1', '40f28628b63310f9bd17c26d9ebe32b1')
     version('12.8.1', '01c0026f1e2050842857db941060ecd5')
     version('12.6.4', 'c2ea7b5aa0d10bcabdb9b9a6e3bac3ea')
@@ -71,6 +74,8 @@ def url_for_version(self, version):
             description='Compile with support for MUMPS solvers')
     variant('superlu-dist', default=True,
             description='Compile with SuperluDist solvers')
+    variant('superlu', default=False,
+            description='Compile with SuperLU solvers')
     variant('hypre',        default=True,
             description='Compile with Hypre preconditioner')
     variant('hdf5',         default=True,  description='Compile with HDF5')
@@ -111,6 +116,7 @@ def url_for_version(self, version):
     depends_on('scalapack', when='+mumps')
     depends_on('superlu-dist@:4.3', when='@:12.6.1+superlu-dist')
     depends_on('superlu-dist', when='@12.6.2:+superlu-dist')
+    depends_on('superlu+fpic@4.3', when='+superlu')
     depends_on('hypre~internal-superlu', when='+hypre')
     depends_on('hdf5+mpi', when='+hdf5')
     depends_on('python', when='+python')
@@ -127,6 +133,10 @@ def variants_check(self):
             # working.
             raise RuntimeError('The superlu-dist variant can only be used' +
                                ' with Trilinos @12.0.1:')
+        if '+superlu-dist' in self.spec and '+superlu' in self.spec:
+            # Only choose one type of superlu
+            raise RuntimeError('The superlu-dist and superlu variant' +
+                               ' cannot be used together')
 
     def cmake_args(self):
         spec = self.spec
@@ -320,6 +330,20 @@ def cmake_args(self):
                 '-DTPL_ENABLE_SuperLUDist:BOOL=OFF',
             ])
 
+        # superlu:
+        if '+superlu' in spec:
+            options.extend([
+                '-DTPL_ENABLE_SuperLU:BOOL=ON',
+                '-DSuperLU_LIBRARY_DIRS=%s' %
+                spec['superlu'].prefix.lib,
+                '-DSuperLU_INCLUDE_DIRS=%s' %
+                spec['superlu'].prefix.include
+            ])
+        else:
+            options.extend([
+                '-DTPL_ENABLE_SuperLU:BOOL=OFF',
+            ])
+
         # python
         if '+python' in spec:
             options.extend([
-- 
GitLab