From d6db53209539190a3a33062da899fef3a6a8c51c Mon Sep 17 00:00:00 2001 From: Thilina Rathnayake Date: Fri, 8 Dec 2017 11:29:58 -0600 Subject: Update the Nekbone package (#6508) --- .../repos/builtin/packages/nekbone/package.py | 57 ++++++++++++++-------- 1 file changed, 36 insertions(+), 21 deletions(-) diff --git a/var/spack/repos/builtin/packages/nekbone/package.py b/var/spack/repos/builtin/packages/nekbone/package.py index 3d419b9156..4531012110 100644 --- a/var/spack/repos/builtin/packages/nekbone/package.py +++ b/var/spack/repos/builtin/packages/nekbone/package.py @@ -22,7 +22,6 @@ # License along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## - from spack import * @@ -33,32 +32,48 @@ class Nekbone(Package): the spectral element method.""" homepage = "https://github.com/Nek5000/Nekbone" - url = "https://github.com/Nek5000/Nekbone/tarball/v17.0" tags = ['proxy-app', 'ecp-proxy-app'] - version('17.0', 'cc339684547614a0725959e41839fec1') + version('17.0', 'cc339684547614a0725959e41839fec1', git='https://github.com/Nek5000/Nekbone.git') version('develop', git='https://github.com/Nek5000/Nekbone.git') - depends_on('mpi') + # Variants + variant('mpi', default=True, description='Build with MPI') - def install(self, spec, prefix): + # dependencies + depends_on('mpi', when='+mpi') + + @run_before('install') + def fortran_check(self): + if not self.compiler.fc: + msg = 'Nekbone can not be built without a Fortran compiler.' + raise RuntimeError(msg) - working_dirs = ['example1', 'example2', 'example3', 'nek_comm', - 'nek_delay', 'nek_mgrid'] + def install(self, spec, prefix): mkdir(prefix.bin) - for wdir in working_dirs: - with working_dir('test/' + wdir): - makenec = FileFilter('makenek') - makenec.filter('CC.*', 'CC=' + self.spec['mpi'].mpicc) - makenec.filter('FF77.*', 'FF77=' + self.spec['mpi'].mpif77) - makenek = Executable('./makenek') - path = join_path(prefix.bin, wdir) - makenek('ex1', '../../src') - mkdir(path) - install('nekbone', path) - install('nekpmpi', path) - install('data.rea', path) - install('SIZE', path) - install('README', path) + FC = self.compiler.fc + CC = self.compiler.cc + if '+mpi' in spec: + FC = spec['mpi'].mpif77 + CC = spec['mpi'].mpicc + + # Install Nekbone in prefix.bin + install_tree("../Nekbone", prefix.bin.Nekbone) + + # Install scripts in prefix.bin + nekpmpi = 'test/example1/nekpmpi' + makenek = 'test/example1/makenek' + + install(makenek, prefix.bin) + install(nekpmpi, prefix.bin) + + with working_dir(prefix.bin): + filter_file(r'^SOURCE_ROOT\s*=.*', 'SOURCE_ROOT=\"' + + prefix.bin.Nekbone + '/src\"', 'makenek') + filter_file(r'^CC\s*=.*', 'CC=\"' + CC + '\"', 'makenek') + filter_file(r'^F77\s*=.*', 'F77=\"' + FC + '\"', 'makenek') + + if '+mpi' not in spec: + filter_file(r'^#IFMPI=\"false\"', 'IFMPI=\"false\"', 'makenek') -- cgit v1.2.3-60-g2f50