1import config.package 2 3class Configure(config.package.Package): 4 def __init__(self, framework): 5 config.package.Package.__init__(self, framework) 6 self.version = '1.24.11' 7 self.gitcommit = '35c63fc2475a54e00453311c5a87017fe5d0ae63' 8 self.download = ['git://https://github.com/PFLAREProject/PFLARE','https://github.com/PFLAREProject/PFLARE/archive/'+self.gitcommit+'.tar.gz'] 9 self.functions = ['PCRegister_PFLARE'] 10 self.includes = ['pflare.h'] 11 self.liblist = [['libpflare.a']] 12 self.complex = 0 13 self.precisions = ['double'] 14 self.linkedbypetsc = 0 15 self.builtafterpetsc = 1 16 return 17 18 def setupDependencies(self, framework): 19 config.package.Package.setupDependencies(self, framework) 20 self.sharedLibraries = framework.require('PETSc.options.sharedLibraries',self) 21 self.mpi = framework.require('config.packages.MPI',self) 22 self.blasLapack = framework.require('config.packages.BlasLapack',self) 23 self.parmetis = framework.require('config.packages.ParMETIS',self) 24 self.kokkos = framework.require('config.packages.kokkos',self) 25 self.kokkoskernels = framework.require('config.packages.kokkos-kernels',self) 26 self.scalartypes = framework.require('PETSc.options.scalarTypes',self) 27 self.deps = [self.mpi,self.blasLapack,self.parmetis] 28 self.odeps = [self.kokkos,self.kokkoskernels] 29 return 30 31 def Install(self): 32 import os 33 # Have to be built with shared libraries if using the PETSc configure 34 # For static builds you have to build PFLARE yourself from source 35 if not self.checkSharedLibrariesEnabled(): 36 raise RuntimeError('PFLARE built through the PETSc configure requires shared libraries') 37 38 # if installing prefix location then need to set new value for PETSC_DIR/PETSC_ARCH 39 if self.argDB['prefix'] and not 'package-prefix-hash' in self.argDB: 40 barg = ' PETSC_DIR='+os.path.abspath(os.path.expanduser(self.argDB['prefix']))+' PETSC_ARCH=""' 41 prefix = os.path.abspath(os.path.expanduser(self.argDB['prefix'])) 42 # We also have to add the original PETSc source dirs to C includes before the build 43 # No PETSC_ARCH in the source directory as we are in a prefix build 44 barg = barg + ' CFLAGS="-I${PETSC_DIR}/include ${CFLAGS}"' 45 barg = barg + ' CPPFLAGS="-I${PETSC_DIR}/include ${CPPFLAGS}"' 46 barg = barg + ' CXXFLAGS="-I${PETSC_DIR}/include ${CXXFLAGS}"' 47 else: 48 barg = 'PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH}' 49 checkarg = barg 50 prefix = os.path.join(self.petscdir.dir,self.arch) 51 barg = barg + ' PREFIX=' + prefix 52 checkarg = barg 53 54 self.include = [os.path.join(self.installDir,'include')] 55 self.lib = [os.path.join(self.installDir,'lib','libpflare.a')] 56 libdir = os.path.join(self.installDir, 'lib') 57 # Call make, make python (if petsc4py is enabled), then 58 # make install. After that create a symlink called libpetscpflare.so 59 # to ensure the PFLARE registration routine is called when PETSc loads 60 # the dynamic PFLARE library 61 post_cmds = [barg + ' ${OMAKE} ' + barg,] 62 if self.argDB['with-petsc4py']: 63 post_cmds.append(barg + ' ${OMAKE} ' + barg + ' python') 64 post_cmds.append(barg + ' ${OMAKE} ' + barg + ' install') 65 post_cmds.append('cd "{0}" && ln -sf libpflare.{1} libpetscpflare.so'.format(libdir, self.setCompilers.sharedLibraryExt)) 66 self.addPost(self.packageDir, post_cmds) 67 self.addMakeCheck(self.packageDir, '${OMAKE} ' + checkarg + ' check') 68 69 return self.installDir 70