openblas: derives from MakefilePackage (#2488)

* MakefilePackage: changed build_args and install_args for consistency with #2464
openblas: derives from MakefilePackage

* MakefilePackage: changed default edit behavior
This commit is contained in:
Massimiliano Culpo
2016-12-15 19:15:52 +01:00
committed by Todd Gamblin
parent f9ca5b9f27
commit 87c9b01033
3 changed files with 71 additions and 57 deletions

View File

@@ -25,6 +25,7 @@
import inspect
import llnl.util.tty as tty
from llnl.util.filesystem import working_dir
from spack.package import PackageBase
@@ -45,33 +46,26 @@ class MakefilePackage(PackageBase):
# build-system class we are using
build_system_class = 'MakefilePackage'
build_targets = []
install_targets = ['install']
def build_directory(self):
"""Directory where the main Makefile is located"""
return self.stage.source_path
def build_args(self):
"""List of arguments that should be passed to make at build time"""
return []
def install_args(self):
"""List of arguments that should be passed to make at install time"""
return []
def edit(self, spec, prefix):
"""This phase cannot be defaulted for obvious reasons..."""
raise NotImplementedError('\'edit\' function not implemented')
tty.msg('Using default implementation: skipping edit phase.')
def build(self, spec, prefix):
"""Default build phase : call make passing build_args"""
args = self.build_args()
with working_dir(self.build_directory()):
inspect.getmodule(self).make(*args)
inspect.getmodule(self).make(*self.build_targets)
def install(self, spec, prefix):
"""Default install phase : call make passing install_args"""
args = self.install_args() + ['install']
with working_dir(self.build_directory()):
inspect.getmodule(self).make(*args)
inspect.getmodule(self).make(*self.install_targets)
# Check that self.prefix is there after installation
PackageBase.sanity_check('install')(PackageBase.sanity_check_prefix)