From ea1031bad97b34d28991ea28d2e6bb84d58e941f Mon Sep 17 00:00:00 2001 From: Dominic Kempf Date: Thu, 14 May 2020 11:34:39 +0200 Subject: [PATCH] Go through variants and dependencies and remove unneeded ones Some of the variants/dependencies in the prototype were unneeded, I went through also with a keen eye on keeping the total number of variants a bit lower. I also added defaults that I consider useful. --- packages/dune/package.py | 127 +++++++++++++++++---------------------- 1 file changed, 55 insertions(+), 72 deletions(-) diff --git a/packages/dune/package.py b/packages/dune/package.py index 0dc6a40..9bcd065 100644 --- a/packages/dune/package.py +++ b/packages/dune/package.py @@ -28,12 +28,9 @@ class Dune(CMakePackage): """ DUNE, the Distributed and Unified Numerics Environment is a modular toolbox for solving partial differential equations (PDEs) with grid-based methods. """ - homepage = "https://www.dune-project.org" git = "https://gitlab.dune-project.org/core/dune-common.git" - python_components = [ 'dune' ] - # This defines a mapping of available versions of the dune Spack package # and the branch name in the Dune repositories this refers to. dune_versions_to_branch = { @@ -41,51 +38,47 @@ class Dune(CMakePackage): "2.7" : "releases/2.7", } - variant('2d', default=True, description='Build library for 2d') - variant('3d', default=True, description='Build library for 3d') - variant('alberta', default=False, description='Build with Alberta support') - variant('amiramesh', default=False, description='Build with AmiraMesh support') + # Variants for the general build process + variant('shared', default=True, description='Enables the build of shared libraries.') + + # Some variants for customization of Dune + variant('doc', default=False, description='Build and install documentation') + + # Variants for upstream dependencies variant('arpack', default=True, description='Build ARnoldi PACKage library support') - variant('blas', default=True, description='Build with BLAS support') - variant('doxygen', default=True, description='Create Doxygen documentation') - variant('extrautils', default=True, description='Enable compilation and installation of extra utilities from the src subdirectory') - variant('fempy', default=False, description='Support of dune-fempy module') + variant('blas', default=True, description='Build with BLAS support') variant('gmp', default=True, description='Build with GNU multi-precision library support') - variant('imagemagick', default=False, description='Imagemagick support') - variant('jupyter', default=False, description='Build with Jupyter support') variant('lapack', default=True, description='Build with LAPACK support') variant('metis', default=True, description='Build with METIS library support') - variant('mkl', default=True, description='Build with Math Kernel library support') - variant('tbb', default=True, description='Build with Threading Building Blocks library support') - variant('oldcategory', default=True, description='Enable/Disable the backwards compatibility of the category enum/method in dune-istl solvers, preconditioner, etc.') - variant('parmetis', default=True, description='Build with ParMETIS support') - variant('psurface', default=False, description='Build with Psurface support') + variant('parmetis', default=False, description='Build with ParMETIS support') variant('ptscotch', default=True, description='Build with PT-Scotch support') - variant('selector', default=True, description='Grid selector definition added to config.h') - variant('shared', default=True, description='Enables the build of shared libraries.') variant('sionlib', default=False, description='Build with SIONlib support') - variant('sphinx', default=True, description='Create Sphinx documentation') variant('suitesparse', default=True, description='Build SuiteSparse library support') - variant('superlu', default=True, description='Build Supernodal LU library support') - variant('threads', default=True, description='Activate pThread support') - variant('vc', default=True, description='Build C++ Vectorization library support') - variant('zlib', default=True, description='Build zlib library support') - variant('zoltan', default=True, description='Build with Zoltan support') + variant('superlu', default=False, description='Build Supernodal LU library support') + variant('tbb', default=False, description='Build with Intel TBB support') + variant('vc', default=False, description='Build C++ Vectorization library support') + variant('zlib', default=False, description='Build zlib library support') + variant('zoltan', default=False, description='Build with Zoltan support') + # Some variants that were here that are on my todo list + # variant('jupyter', default=False, description='Build with Jupyter support') + # Define one variant for each Dune module that we have. Only core modules + # are activated by default. variant('alugrid', default=False, description='Build with dune-alugrid module') - variant('corepy', default=False, description='Build with dune-corepy module') variant('functions', default=False, description='Build with dune-functions module') - variant('geometry', default=False, description='Build with dune-geometry module') - variant('grid', default=False, description='Build with dune-grid module') - variant('istl', default=False, description='Build with dune-istl module') - variant('localfunctions', default=False, description='Build with dune-localfunctions module') + variant('geometry', default=True, description='Build with dune-geometry module') + variant('grid', default=True, description='Build with dune-grid module') + variant('istl', default=True, description='Build with dune-istl module') + variant('localfunctions', default=True, description='Build with dune-localfunctions module') variant('python', default=False, description='Build with Python and dune-python') variant('spgrid', default=False, description='Build with dune-spgrid module') variant('typetree', default=False, description='Build with dune-typetree module') variant('uggrid', default=False, description='Build with dune-uggrid module') # Iterate over all available Dune versions and define resources for all Dune modules + # If a Dune module behaves differently for different versions (e.g. dune-python got + # merged into dune-common post-2.7), define the resource outside of this loop. for vers, branch in dune_versions_to_branch.items(): version(vers, branch=dune_versions_to_branch[vers]) @@ -124,13 +117,6 @@ class Dune(CMakePackage): when='@%s+functions' % vers, ) - resource( - name='dune-python', - git='https://gitlab.dune-project.org/staging/dune-python.git', - branch=branch, - when='@%s+python' % vers, - ) - resource( name='dune-typetree', git='https://gitlab.dune-project.org/staging/dune-typetree.git', @@ -152,7 +138,19 @@ class Dune(CMakePackage): when='@%s+uggrid' % vers, ) + resource( + name='dune-spgrid', + git='https://gitlab.dune-project.org/extensions/dune-spgrid.git', + branch=branch, + when='@%s+spgrid' % vers, + ) + resource( + name='dune-python', + git='https://gitlab.dune-project.org/staging/dune-python.git', + branch=branch, + when='@2.7+python', + ) # Dependencies between modules module_dependencies={"dune-common":[]} @@ -167,43 +165,35 @@ class Dune(CMakePackage): module_dependencies["dune-alugrid"]=["dune-grid","dune-geometry","dune-common"] extends('python') - #option - depends_on('gawk') + python_components = [ 'dune' ] + + # Specify upstream dependencies (often depending on variants) + depends_on('arpack-ng', when='+arpack') + depends_on('blas', when='+blas') depends_on('cmake@3.1:', type='build') - depends_on('mpi') - depends_on('blas', when='+blas') - depends_on('lapack', when='+lapack') - depends_on('doxygen', type='build', when='+doxygen') + depends_on('doxygen', type='build', when='+doc') + depends_on('gawk') depends_on('gmp', when='+gmp') + depends_on('imagemagick', type='build', when='+doc') depends_on('intel-tbb', when='+tbb') - depends_on('intel-mkl', when='+mkl') + depends_on('lapack', when='+lapack') + depends_on('metis', when='+metis') + depends_on('mpi') + depends_on('parmetis', when='+parmetis') + depends_on('pkg-config', type='build') depends_on('python@3.0:', type=('build', 'run'), when='+python') depends_on('py-setuptools', type='build') - depends_on('py-jupyter', type=('build', 'run'), when='+jupyter') depends_on('py-numpy', type=('build', 'run'), when='+python') depends_on('py-pip', type=('build', 'run'), when='+python') - depends_on('py-sphinx', type=('build', 'run'), when='+sphinx') - depends_on('vc', when='+vc') - depends_on('pkg-config', type='build') - depends_on('imagemagick', type='build', when='+imagemagick') - depends_on('metis', when='+metis') - depends_on('parmetis', when='+parmetis') - depends_on('arpack-ng', when='+arpack') + depends_on('py-sphinx', type=('build', 'run'), when='+doc') + depends_on('scotch+mpi', when='+ptscotch') + depends_on('sionlib', when='+sionlib') depends_on('suite-sparse', when='+suitesparse') depends_on('superlu', when='+superlu') - depends_on('alberta', when='+alberta') - depends_on('psurface', when='+psurface') - depends_on('amiramesh', when='+amiramesh') - depends_on('sionlib', when='+sionlib') + depends_on('vc', when='+vc') depends_on('zlib', when='+zlib') - depends_on('scotch+mpi', when='+ptscotch') depends_on('zoltan', when='+zoltan') - - def url_for_version(self, version): - url = "https://www.dune-project.org/download/{1}/dune-common-{1}.tar.gz" - return url.format(version.up_to(2), version) - def cmake_args(self): """Populate cmake arguments.""" spec = self.spec @@ -218,14 +208,10 @@ class Dune(CMakePackage): return variant_bool(feature, on='OFF', off='ON') cmake_args = [ -# '-DDUNE_BUILD_BOTH_LIBS=%s' % variant_bool('+shared'), '-DBUILD_SHARED_LIBS:BOOL=%s' % variant_bool('+shared'), - '-DDUNE_GRID_EXTRA_UTILS:BOOL=%s' % variant_bool('+extrautils'), - '-DDUNE_GRID_GRIDTYPE_SELECTOR:BOOL=%s' % variant_bool('+selector'), - '-DDUNE_ISTL_SUPPORT_OLD_CATEGORY=%s' % variant_bool('+oldcategory'), - '-DUSE_PTHREADS:BOOL=%s' % variant_bool('+threads'), + '-DDUNE_GRID_GRIDTYPE_SELECTOR:BOOL=ON', ] - #self.define_from_variant('DETECT_HDF5', 'hdf5'), + if '+python' in spec: cmake_args.append('-DDUNE_GRID_EXPERIMENTAL_GRID_EXTENSIONS:BOOL=TRUE') cmake_args.append('-DPYTHON_INSTALL_LOCATION:STRING="system"') @@ -261,9 +247,6 @@ class Dune(CMakePackage): return CMakePackage._get_needed_resources(self) def cmake(self, spec, prefix): - if self.stage.archive_file: - os.remove(self.stage.archive_file) - # Write an opts file for later use with open(join_path(self.stage.source_path, "..", "dune.opts"), "w") as optFile: optFile.write('CMAKE_FLAGS="')