bugfix: make texinfo build properly with gettext (#34312)

`texinfo` depends on `gettext`, and it builds a perl module that uses gettext via XS
module FFI. Unfortunately, the XS modules build asks perl to tell it what compiler to
use instead of respecting the one passed to configure.

Without this change, the build fails with this error:

```
parsetexi/api.c:33:10: fatal error: 'libintl.h' file not found
         ^~~~~~~~~~~
```

We need the gettext dependency and the spack wrappers to ensure XS builds properly.

- [x] Add needed `gettext` dependency to `texinfo`
- [x] Override XS compiler with `PERL_EXT_CC`

Co-authored-by: Paul Kuberry <pakuber@sandia.gov>
This commit is contained in:
Todd Gamblin 2022-12-28 15:20:53 -08:00 committed by GitHub
parent 5f8c706128
commit e28738a01e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,6 +34,7 @@ class Texinfo(AutotoolsPackage, GNUMirrorPackage):
version("5.0", sha256="2c579345a39a2a0bb4b8c28533f0b61356504a202da6a25d17d4d866af7f5803")
depends_on("perl")
depends_on("gettext")
# sanity check
sanity_check_is_file = [
@ -61,6 +62,12 @@ def build_targets(self):
targets.append("CFLAGS={}".format(self.compiler.c11_flag))
return targets
def setup_build_environment(self, env):
# texinfo builds Perl XS modules internally, and by default it overrides the
# CC that the top-level configure reports. This loses the Spack wrappers unless
# we set PERL_EXT_CC
env.set("PERL_EXT_CC", spack_cc)
@classmethod
def determine_version(cls, exe):
output = Executable(exe)("--version", output=str, error=str)