package : added EditableMakefile

Modifications :
- added EditableMakefile to PackageBase subclasses
- astyle modified as an example
- preliminary hook to stop at a certain phase of install
This commit is contained in:
alalazo
2016-07-11 10:08:19 +02:00
parent 8f75d34331
commit a43c63f149
7 changed files with 78 additions and 48 deletions

View File

@@ -25,28 +25,24 @@
from spack import *
class Astyle(Package):
class Astyle(EditableMakefile):
"""
A Free, Fast, and Small Automatic Formatter for C, C++, C++/CLI,
Objective-C, C#, and Java Source Code.
"""
homepage = "http://astyle.sourceforge.net/"
url = "http://downloads.sourceforge.net/project/astyle/astyle/astyle%202.04/astyle_2.04_linux.tar.gz"
url = "http://downloads.sourceforge.net/project/astyle/astyle/astyle%202.04/astyle_2.04_linux.tar.gz"
version('2.04', '30b1193a758b0909d06e7ee8dd9627f6')
def install(self, spec, prefix):
parallel = False
with working_dir('src'):
# we need to edit the makefile in place to set compiler:
make_file = join_path(self.stage.source_path,
'build', 'gcc', 'Makefile')
filter_file(r'^CXX\s*=.*', 'CXX=%s' % spack_cxx, make_file)
def wdir(self):
return join_path(self.stage.source_path, 'build', self.compiler.name)
make('-f',
make_file,
parallel=False)
def edit(self, spec, prefix):
makefile = join_path(self.wdir(), 'Makefile')
filter_file(r'^CXX\s*=.*', 'CXX=%s' % spack_cxx, makefile)
mkdirp(self.prefix.bin)
install(join_path(self.stage.source_path, 'src', 'bin', 'astyle'),
self.prefix.bin)
def install_args(self):
return ['prefix={0}'.format(prefix)]