meson: Add {perl|python}_includespec to generated Makefile.global

This is meant to help enable headerscheck under meson, but can also be
useful in general, for example for third-party extension that might
use these values.

Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/CAMSWrt-PoQt4sHryWrB1ViuGBJF_PpbjoSGrWR2Ry47bHNLDqg%40mail.gmail.com
This commit is contained in:
Peter Eisentraut 2026-03-18 11:09:14 +01:00
parent 905e44152a
commit 720c9b504e
2 changed files with 14 additions and 2 deletions

View file

@ -1274,6 +1274,7 @@ endif
perlopt = get_option('plperl')
perl_dep = not_found_dep
perl_includespec = ''
perlversion = ''
if not perlopt.disabled()
perl_may_work = true
@ -1298,6 +1299,7 @@ if not perlopt.disabled()
useshrplib = run_command(perl_conf_cmd, 'useshrplib', check: true).stdout()
perl_inc_dir = '@0@/CORE'.format(archlibexp)
perl_includespec = '-I@0@'.format(perl_inc_dir)
if perlversion.version_compare('< 5.14')
perl_may_work = false
@ -1316,6 +1318,7 @@ if not perlopt.disabled()
if not fs.is_file('@0@/perl.h'.format(perl_inc_dir)) and \
fs.is_file('@0@@1@/perl.h'.format(pg_sysroot, perl_inc_dir))
perl_ccflags = ['-iwithsysroot', perl_inc_dir]
perl_includespec = '-iwithsysroot @0@/CORE'.format(archlibexp)
endif
# check compiler finds header
@ -1420,6 +1423,7 @@ endif
pyopt = get_option('plpython')
python3_dep = not_found_dep
python_includespec = ''
if not pyopt.disabled()
pm = import('python')
python3_inst = pm.find_installation(python.full_path(), required: pyopt)
@ -1449,6 +1453,11 @@ if not pyopt.disabled()
python3_dep = not_found_dep
endif
endif
if python3_dep.found()
command = [python, '-c', 'import sysconfig; print("-I" + sysconfig.get_config_var("INCLUDEPY"))']
python_includespec = run_command(command, check: true).stdout().strip()
endif
endif

View file

@ -77,6 +77,9 @@ pgxs_kv = {
'STRIP_STATIC_LIB': ' '.join(strip_static_cmd),
'STRIP_SHARED_LIB': ' '.join(strip_shared_cmd),
'perl_includespec': perl_includespec,
'python_includespec': python_includespec,
# these seem to be standard these days
'MKDIR_P': 'mkdir -p',
'LN_S': 'ln -s',
@ -183,8 +186,8 @@ pgxs_empty = [
'PG_TEST_EXTRA',
'DTRACEFLAGS', # only server has dtrace probes
'perl_archlibexp', 'perl_embed_ccflags', 'perl_embed_ldflags', 'perl_includespec', 'perl_privlibexp',
'python_additional_libs', 'python_includespec', 'python_libdir', 'python_libspec', 'python_majorversion', 'python_version',
'perl_archlibexp', 'perl_embed_ccflags', 'perl_embed_ldflags', 'perl_privlibexp',
'python_additional_libs', 'python_libdir', 'python_libspec', 'python_majorversion', 'python_version',
# possible that some of these are referenced explicitly in pgxs makefiles?
# For now not worth it.