From eb66aca9aed6582c2efe6877cc9dac24016d282d Mon Sep 17 00:00:00 2001
From: "Kelly (KT) Thompson" <KineticTheory@users.noreply.github.com>
Date: Mon, 8 Jan 2018 08:18:42 -0700
Subject: [PATCH] Upgrade recipe for parmetis to be a CMakePackage (#6807)

* Upgrade recipe for parmetis to be a CMakePackage

+ Eliminate `install` method (use the one from CMakePackage).
+ Move configure options to new method `cmake_args`
+ Move special install instructions for DarwinOS to a `run_after` method.

* Fix run_after section; Remove variant +debug.
---
 .../builtin/packages/parmetis/package.py      | 26 +++++++------------
 1 file changed, 10 insertions(+), 16 deletions(-)

diff --git a/var/spack/repos/builtin/packages/parmetis/package.py b/var/spack/repos/builtin/packages/parmetis/package.py
index 927a7715e6..dacd218f99 100644
--- a/var/spack/repos/builtin/packages/parmetis/package.py
+++ b/var/spack/repos/builtin/packages/parmetis/package.py
@@ -27,7 +27,7 @@
 import sys
 
 
-class Parmetis(Package):
+class Parmetis(CMakePackage):
     """ParMETIS is an MPI-based parallel library that implements a variety of
        algorithms for partitioning unstructured graphs, meshes, and for
        computing fill-reducing orderings of sparse matrices."""
@@ -40,7 +40,6 @@ class Parmetis(Package):
     version('4.0.2', '0912a953da5bb9b5e5e10542298ffdce')
 
     variant('shared', default=True, description='Enables the build of shared libraries.')
-    variant('debug', default=False, description='Builds the library in debug mode.')
     variant('gdb', default=False, description='Enables gdb support.')
 
     depends_on('cmake@2.8:', type='build')
@@ -61,11 +60,10 @@ def url_for_version(self, version):
         url += '/parmetis-{0}.tar.gz'.format(version)
         return url
 
-    def install(self, spec, prefix):
-        source_directory = self.stage.source_path
-        build_directory = join_path(source_directory, 'build')
+    def cmake_args(self):
+        spec = self.spec
 
-        options = std_cmake_args[:]
+        options = []
         options.extend([
             '-DGKLIB_PATH:PATH=%s/GKlib' % spec['metis'].prefix.include,
             '-DMETIS_PATH:PATH=%s' % spec['metis'].prefix,
@@ -87,17 +85,13 @@ def install(self, spec, prefix):
             for o in rpath_options:
                 options.remove(o)
 
-        if '+debug' in spec:
-            options.extend(['-DDEBUG:BOOL=ON',
-                            '-DCMAKE_BUILD_TYPE:STRING=Debug'])
         if '+gdb' in spec:
             options.append('-DGDB:BOOL=ON')
 
-        with working_dir(build_directory, create=True):
-            cmake(source_directory, *options)
-            make()
-            make('install')
+        return options
 
-            # The shared library is not installed correctly on Darwin; fix this
-            if (sys.platform == 'darwin') and ('+shared' in spec):
-                fix_darwin_install_name(prefix.lib)
+    @run_after('install')
+    def darwin_fix(self):
+        # The shared library is not installed correctly on Darwin; fix this
+        if (sys.platform == 'darwin') and ('+shared' in self.spec):
+            fix_darwin_install_name(prefix.lib)
-- 
GitLab