From 10a3822728a6b84731696b0362bc63fd09dc0e2a Mon Sep 17 00:00:00 2001 From: mcourtois Date: Wed, 13 Apr 2022 18:45:47 +0200 Subject: mumps: install header files as compiled (#29940) Co-authored-by: Mathieu Courtois --- var/spack/repos/builtin/packages/mumps/package.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/mumps/package.py b/var/spack/repos/builtin/packages/mumps/package.py index 2b5d6a333e..83b25ba140 100644 --- a/var/spack/repos/builtin/packages/mumps/package.py +++ b/var/spack/repos/builtin/packages/mumps/package.py @@ -3,6 +3,7 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) +import glob import os import sys @@ -44,6 +45,8 @@ class Mumps(Package): description='Activate the compilation of cmumps and/or zmumps') variant('int64', default=False, description='Use int64_t/integer*8 as default index type') + variant("incfort", default=False, + description="Use explicit types size in fortran headers") variant('shared', default=True, description='Build shared libraries') variant('openmp', default=True, description='Compile MUMPS with OpenMP support') @@ -76,6 +79,20 @@ class Mumps(Package): conflicts('+blr_mt', when='~openmp', msg="You cannot use the blr_mt variant without openmp") + @when("+incfort") + def patch(self): + """Set the effective integer type used during compilation. + Usual usecase: building mumps with int and compiling a program that + includes these headers with '-fdefault-integer-8'. + """ + headers = glob.glob("include/*.h") + intsize = 8 if "+int64" in self.spec else 4 + filter_file("INTEGER *,", "INTEGER({0}),".format(intsize), *headers) + filter_file("INTEGER *::", "INTEGER({0}) ::".format(intsize), *headers) + for typ in ("REAL", "COMPLEX", "LOGICAL"): + filter_file("{0} *,".format(typ), "{0}(4),".format(typ), *headers) + filter_file("{0} *::".format(typ), "{0}(4) ::".format(typ), *headers) + def write_makefile_inc(self): # The makefile variables LIBBLAS, LSCOTCH, LMETIS, and SCALAP are only # used to link the examples, so if building '+shared' there is no need -- cgit v1.2.3-70-g09d2