From 72cabcf45492940724aa750d393761894e4120fa Mon Sep 17 00:00:00 2001
From: Nikolay Simakov <nikolays@buffalo.edu>
Date: Sun, 26 Sep 2021 04:59:06 -0400
Subject: enzo: build extra tools, add optimization variant (#25401)

* added inits and rings tools to be built
* added opt variant
---
 var/spack/repos/builtin/packages/enzo/package.py | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

(limited to 'var')

diff --git a/var/spack/repos/builtin/packages/enzo/package.py b/var/spack/repos/builtin/packages/enzo/package.py
index e242d0da12..4b0c49011d 100644
--- a/var/spack/repos/builtin/packages/enzo/package.py
+++ b/var/spack/repos/builtin/packages/enzo/package.py
@@ -21,6 +21,14 @@ class Enzo(MakefilePackage):
     depends_on('hdf5~mpi')
     depends_on('sse2neon', when='target=aarch64:')
 
+    variant(
+        'opt', default='high',
+        description='Optimization, some compilers do not ' +
+                    'produce stable code with high+ optimizations',
+        values=('warn', 'debug', 'cudadebug', 'high', 'aggressive'),
+        multi=False
+    )
+
     patch('for_aarch64.patch', when='target=aarch64:')
 
     # https://github.com/enzo-project/enzo-dev/pull/158
@@ -41,6 +49,7 @@ class Enzo(MakefilePackage):
 
         with working_dir('src/enzo'):
             copy('Make.mach.linux-gnu', 'Make.mach.spack')
+
             filter_file('^MACH_FILE.*',
                         'MACH_FILE = Make.mach.spack',
                         'Make.mach.spack')
@@ -57,12 +66,17 @@ class Enzo(MakefilePackage):
     def build(self, spec, prefix):
         with working_dir('src/enzo'):
             make('machine-spack')
-            make('opt-high')
+            make('opt-' + self.spec.variants['opt'].value)
             make('show-config')
             make()
+        with working_dir('src/inits'):
+            make()
+        with working_dir('src/ring'):
+            make()
 
     def install(self, spec, prefix):
         install_tree('bin', prefix.bin)
         install_tree('doc', prefix.doc)
         install_tree('input', prefix.input)
         install_tree('run', prefix.run)
+        install(join_path('src', 'ring', 'ring.exe'), join_path(prefix.bin, 'ring'))
-- 
cgit v1.2.3-70-g09d2