summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKelly (KT) Thompson <KineticTheory@users.noreply.github.com>2018-01-05 12:45:21 -0700
committerAdam J. Stewart <ajstewart426@gmail.com>2018-01-05 13:45:21 -0600
commit322b016230629c2e97f7d3457f72b13ad3e885b3 (patch)
tree041f20ee5edd7e3712440d66bcad358fc2345d31
parentd4e4755ec9792d409e2df3dfd6ee92cd106e3e31 (diff)
downloadspack-322b016230629c2e97f7d3457f72b13ad3e885b3.tar.gz
spack-322b016230629c2e97f7d3457f72b13ad3e885b3.tar.bz2
spack-322b016230629c2e97f7d3457f72b13ad3e885b3.tar.xz
spack-322b016230629c2e97f7d3457f72b13ad3e885b3.zip
Provide build_type variant for Metis. (#6808)
* Provide build_type variant for Metis. + Ideally, we would make Metis a CMakePackage, but `metis@:5` doesn't use CMake. + For now, provide a `build_type=` variant similar what is found in CMakePackage. + There is a potential for duplicate specification of `CMAKE_BUILD_TYPE` if both variants `+debug` and `build_type=` are specified. I am looking for advice on how this can be resolved. * Update metis recipe in response to flake8 and user comments. + Wrap comment lines that used more than 80 columns. + Change `+debug` variant to avoid potential for multiple `-DCMAKE_BUID_TYPE=` arguments provided to cmake. Specifying this variant no longer appends this configure option. However, if `+debug` is specified, require `build_type=Debug` to maintain expected behavior. * For metis, remove +debug variant; use build_type= instead. + Update recipe for metis@4 to extract `build_type=` values and set `OPTFLAGS` accordingly. + For metis@5:, the behavior from the previously supported variant `+debug` can be obtained with the options `+gdb build_type=Debug` * Conflicts added for metis@4 when build_type != Release|Debug. * Use spack function conflicts instead of 'raise InstallError'.
-rw-r--r--var/spack/repos/builtin/packages/metis/package.py33
1 files changed, 22 insertions, 11 deletions
diff --git a/var/spack/repos/builtin/packages/metis/package.py b/var/spack/repos/builtin/packages/metis/package.py
index 20e601fbd8..30f457da6b 100644
--- a/var/spack/repos/builtin/packages/metis/package.py
+++ b/var/spack/repos/builtin/packages/metis/package.py
@@ -45,12 +45,25 @@ class Metis(Package):
version('4.0.3', 'd3848b454532ef18dc83e4fb160d1e10')
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.')
-
+ variant('gdb', default=False, description='Enables gdb support (version 5+).')
variant('int64', default=False, description='Sets the bit width of METIS\'s index type to 64.')
variant('real64', default=False, description='Sets the bit width of METIS\'s real type to 64.')
+ # For Metis version 5:, the build system is CMake, provide the
+ # `build_type` variant.
+ variant('build_type', default='Release',
+ description='The build type for the installation (only Debug or'
+ ' Release allowed for version 4).',
+ values=('Debug', 'Release', 'RelWithDebInfo', 'MinSizeRel'))
+
+ # Prior to version 5, the (non-cmake) build system only knows about
+ # 'build_type=Debug|Release'.
+ conflicts('@:4.999', when='build_type=RelWithDebInfo')
+ conflicts('@:4.999', when='build_type=MinSizeRel')
+ conflicts('@:4.999', when='+gdb')
+ conflicts('@:4.999', when='+int64')
+ conflicts('@:4.999', when='+real64')
+
depends_on('cmake@2.8:', when='@5:', type='build')
patch('install_gklib_defs_rename.patch', when='@5:')
@@ -87,12 +100,8 @@ class Metis(Package):
@when('@:4')
def install(self, spec, prefix):
# Process library spec and options
- if any('+{0}'.format(v) in spec for v in ['gdb', 'int64', 'real64']):
- raise InstallError('METIS@:4 does not support the following '
- 'variants: gdb, int64, real64.')
-
options = ['COPTIONS={0}'.format(self.compiler.pic_flag)]
- if '+debug' in spec:
+ if spec.variants['build_type'].value == 'Debug':
options.append('OPTFLAGS=-g -O0')
make(*options)
@@ -185,6 +194,11 @@ class Metis(Package):
options.append('-DGKLIB_PATH:PATH=%s/GKlib' % source_directory)
options.append('-DCMAKE_INSTALL_NAME_DIR:PATH=%s/lib' % prefix)
+ # Normally this is available via the 'CMakePackage' object, but metis
+ # IS-A 'Package' (not a 'CMakePackage') to support non-cmake metis@:5.
+ build_type = spec.variants['build_type'].value
+ options.extend(['-DCMAKE_BUILD_TYPE:STRING={0}'.format(build_type)])
+
if '+shared' in spec:
options.append('-DSHARED:BOOL=ON')
else:
@@ -196,9 +210,6 @@ class Metis(Package):
rpath_options.append(o)
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')