kahip: update build system to cmake for v3.11, retain scons for older versions (#25645)

* kahip: update to cmake for v3.11, retain scons for older versions

* kahip: update build system to cmake for v3.11, retain SCons for older versions

* address PR comments and add maintainer

* address PR comments - correct version to 2.10, add deprecated and url, and remove scons version
This commit is contained in:
Matthew Archer 2021-10-11 16:20:43 +01:00 committed by GitHub
parent 79aba5942a
commit e034930775
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,7 +9,7 @@
from spack import *
class Kahip(SConsPackage):
class Kahip(CMakePackage):
"""KaHIP - Karlsruhe High Quality Partitioning - is a family of graph
partitioning programs. It includes KaFFPa (Karlsruhe Fast Flow
Partitioner), which is a multilevel graph partitioning algorithm,
@ -23,12 +23,15 @@ class Kahip(SConsPackage):
"""
homepage = 'http://algo2.iti.kit.edu/documents/kahip/index.html'
url = 'https://algo2.iti.kit.edu/schulz/software_releases/KaHIP_2.00.tar.gz'
git = 'https://github.com/schulzchristian/KaHIP.git'
url = 'https://github.com/KaHIP/KaHIP/archive/v3.11.tar.gz'
git = 'https://github.com/KaHIP/KaHIP.git'
maintainers = ["ma595"]
version('develop', branch='master')
version('2.00', sha256='1cc9e5b12fea559288d377e8b8b701af1b2b707de8e550d0bda18b36be29d21d')
version('3.11', sha256='347575d48c306b92ab6e47c13fa570e1af1e210255f470e6aa12c2509a8c13e3')
version('2.00', sha256='1cc9e5b12fea559288d377e8b8b701af1b2b707de8e550d0bda18b36be29d21d', url='https://algo2.iti.kit.edu/schulz/software_releases/KaHIP_2.00.tar.gz', deprecated=True)
depends_on('scons', type='build', when='@2:2.10')
depends_on('argtable')
depends_on('mpi') # Note: upstream package only tested on openmpi
@ -39,11 +42,13 @@ class Kahip(SConsPackage):
# statement to a function)
# Split into 2 patch files:
# *) first file patches Sconstruct files present in all versions (from
# 2.00 to 2.11)
# 2.00 to 2.10)
# *) second is for files only present in 2.00
patch('fix-sconstruct-for-py3.patch', when='@2: ^python@3:')
patch('fix-sconstruct-for-py3.patch', when='@2:2.10 ^python@3:')
patch('fix-sconstruct-for-py3-v2.00.patch', when='@2.00 ^python@3:')
# 'when' decorators to override new CMake build approach (old build was SConstruct).
@when("@:2.10")
def patch(self):
"""Internal compile.sh scripts hardcode number of cores to build with.
Filter these out so Spack can control it."""
@ -57,11 +62,17 @@ def patch(self):
for f in files:
filter_file('NCORES=.*', 'NCORES={0}'.format(make_jobs), f)
@when("@:2.10")
def cmake(self, spac, prefix):
pass
@when("@:2.10")
def build(self, spec, prefix):
"""Build using the KaHIP compile.sh script. Uses scons internally."""
builder = Executable('./compile.sh')
builder()
@when("@:2.10")
def install(self, spec, prefix):
"""Install under the prefix"""
# Ugly: all files land under 'deploy' and we need to disentangle them