berkeleygw: update FCPP flags for gcc (#42848)

Compilation with the old flags fails on PowerPC (power8le) due to syntax
errors in the output from the preprocessor. Compilation with the
extended set of flags works both on PowerPC and x86_64.

The correct set of flags was suggested from the berkeleygw developers:
https://groups.google.com/a/berkeleygw.org/g/help/c/ewi3RZgOyeE/m/jSIoe45PAgAJ

Uses spack-provided compiler prefix to call cpp when compiling berkeleygw with gcc.
This commit is contained in:
Martin Lang 2024-03-20 18:55:54 +01:00 committed by GitHub
parent 8d9d721f07
commit 9802649716
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -232,7 +232,11 @@ def build(self, spec, prefix):
f90_flags += " -fallow-argument-mismatch"
buildopts.append("COMPFLAG=-DGNU")
buildopts.append("MOD_OPT=-J ")
buildopts.append("FCPP=cpp -C -nostdinc")
# std c11 prevents problems with linebreaks and fortran comments
# containing // (which is interpreted as C++ style comment)
buildopts.append(
"FCPP=%s -C -nostdinc -std=c11" % join_path(self.compiler.prefix, "bin", "cpp")
)
if "+mpi" in spec:
buildopts.append("F90free=%s %s" % (spec["mpi"].mpifc, f90_flags))
buildopts.append("C_COMP=%s %s" % (spec["mpi"].mpicc, c_flags))