From f480e3449eeb047e055af5bbfdf41eefd8de8d1a Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Sun, 15 Jan 2017 18:23:16 -0600 Subject: Added customization for make targets in 'build' and 'install' phases for CMakePackage (#2742) * Added customization for make targets in 'build' and 'install' phases for CMakePackage * Use rst in build system docs so that Sphinx generates nice API docs * Allow AutotoolsPackages to be built in a different directory * Flake8 * Fix missing import * Allow configure to be located in different directory * Update espressopp to use build targets * Flake8 * Sphinx fix, lists must be a new paragraph * Back out change that allowed a configure script in a different directory than build_directory * Add missing deps, build in parallel * Missing space for rst list --- .../repos/builtin/packages/espressopp/package.py | 21 ++++++++++++--------- var/spack/repos/builtin/packages/tcl/package.py | 14 +++++++------- var/spack/repos/builtin/packages/tk/package.py | 22 +++++++++++----------- var/spack/repos/builtin/packages/zlib/package.py | 13 ++++--------- 4 files changed, 34 insertions(+), 36 deletions(-) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/espressopp/package.py b/var/spack/repos/builtin/packages/espressopp/package.py index 21e1cc1317..2903a02f7d 100644 --- a/var/spack/repos/builtin/packages/espressopp/package.py +++ b/var/spack/repos/builtin/packages/espressopp/package.py @@ -36,7 +36,7 @@ class Espressopp(CMakePackage): url = "https://github.com/espressopp/espressopp/tarball/v1.9.4.1" version('develop', git='https://github.com/espressopp/espressopp.git', branch='master') - version('1.9.4.1', '0da74a6d4e1bfa6a2a24fca354245a4f') + version('1.9.4.1', '0da74a6d4e1bfa6a2a24fca354245a4f') version('1.9.4', 'f2a27993a83547ad014335006eea74ea') variant('debug', default=False, description='Build debug version') @@ -54,20 +54,23 @@ class Espressopp(CMakePackage): depends_on("fftw") depends_on("py-sphinx", when="+ug", type='build') depends_on("py-sphinx", when="+pdf", type='build') + depends_on('py-numpy', when="+ug", type='build') + depends_on('py-numpy', when="+pdf", type='build') + depends_on('py-matplotlib', when="+ug", type='build') + depends_on('py-matplotlib', when="+pdf", type='build') depends_on("texlive", when="+pdf", type='build') depends_on("doxygen", when="+dg", type='build') - def cmake_args(self): + def build_type(self): spec = self.spec - options = [] - options.extend(['-DEXTERNAL_MPI4PY=ON', '-DEXTERNAL_BOOST=ON']) if '+debug' in spec: - options.extend(['-DCMAKE_BUILD_TYPE:STRING=Debug']) + return 'Debug' else: - options.extend(['-DCMAKE_BUILD_TYPE:STRING=Release']) - - return options - + return 'Release' + + def cmake_args(self): + return ['-DEXTERNAL_MPI4PY=ON', '-DEXTERNAL_BOOST=ON'] + def build(self, spec, prefix): with working_dir(self.build_directory()): make() diff --git a/var/spack/repos/builtin/packages/tcl/package.py b/var/spack/repos/builtin/packages/tcl/package.py index 16d896acc6..d9b535305d 100644 --- a/var/spack/repos/builtin/packages/tcl/package.py +++ b/var/spack/repos/builtin/packages/tcl/package.py @@ -25,7 +25,7 @@ from spack import * -class Tcl(Package): +class Tcl(AutotoolsPackage): """Tcl (Tool Command Language) is a very powerful but easy to learn dynamic programming language, suitable for a very wide range of uses, including web and desktop applications, @@ -52,10 +52,10 @@ class Tcl(Package): env.set('TCL_LIBRARY', join_path(self.prefix.lib, 'tcl{0}'.format( self.spec.version.up_to(2)))) - def install(self, spec, prefix): - with working_dir('unix'): - configure("--prefix={0}".format(prefix)) - make() - make("install") - with working_dir(prefix.bin): + def build_directory(self): + return 'unix' + + @AutotoolsPackage.sanity_check('install') + def symlink_tclsh(self): + with working_dir(self.prefix.bin): symlink('tclsh{0}'.format(self.version.up_to(2)), 'tclsh') diff --git a/var/spack/repos/builtin/packages/tk/package.py b/var/spack/repos/builtin/packages/tk/package.py index 1abcd26a24..071db04e63 100644 --- a/var/spack/repos/builtin/packages/tk/package.py +++ b/var/spack/repos/builtin/packages/tk/package.py @@ -25,7 +25,7 @@ from spack import * -class Tk(Package): +class Tk(AutotoolsPackage): """Tk is a graphical user interface toolkit that takes developing desktop applications to a higher level than conventional approaches. Tk is the standard GUI not only for Tcl, but for @@ -46,15 +46,15 @@ class Tk(Package): base_url = "http://prdownloads.sourceforge.net/tcl" return "{0}/tk{1}-src.tar.gz".format(base_url, version) - def setup_environment(self, spack_env, env): + def setup_environment(self, spack_env, run_env): # When using Tkinter from within spack provided python+tk, python # will not be able to find Tcl/Tk unless TK_LIBRARY is set. - env.set('TK_LIBRARY', join_path(self.prefix.lib, 'tk{0}'.format( - self.spec.version.up_to(2)))) - - def install(self, spec, prefix): - with working_dir('unix'): - configure("--prefix={0}".format(prefix), - "--with-tcl={0}".format(spec['tcl'].prefix.lib)) - make() - make("install") + run_env.set('TK_LIBRARY', join_path(self.prefix.lib, 'tk{0}'.format( + self.spec.version.up_to(2)))) + + def build_directory(self): + return 'unix' + + def configure_args(self): + spec = self.spec + return ['--with-tcl={0}'.format(spec['tcl'].prefix.lib)] diff --git a/var/spack/repos/builtin/packages/zlib/package.py b/var/spack/repos/builtin/packages/zlib/package.py index a20f6ff802..ea758e0188 100644 --- a/var/spack/repos/builtin/packages/zlib/package.py +++ b/var/spack/repos/builtin/packages/zlib/package.py @@ -23,7 +23,6 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## from spack import * -from os import environ class Zlib(AutotoolsPackage): @@ -35,17 +34,13 @@ class Zlib(AutotoolsPackage): version('1.2.10', 'd9794246f853d15ce0fcbf79b9a3cf13') # author had this to say about 1.2.9.... - # Due to the bug fixes, any installations of 1.2.9 should be immediately + # Due to the bug fixes, any installations of 1.2.9 should be immediately # replaced with 1.2.10. version('1.2.8', '44d667c142d7cda120332623eab69f40') variant('pic', default=True, description='Produce position-independent code (for shared libs)') - def configure(self, spec, prefix): - - if '+pic' in spec: - environ['CFLAGS'] = self.compiler.pic_flag - - config_args = ['--prefix', prefix] - configure(*config_args) + def setup_environment(self, spack_env, run_env): + if '+pic' in self.spec: + spack_env.set('CFLAGS', self.compiler.pic_flag) -- cgit v1.2.3-60-g2f50