]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
meson: Add {perl|python}_includespec to generated Makefile.global
authorPeter Eisentraut <peter@eisentraut.org>
Wed, 18 Mar 2026 10:09:14 +0000 (11:09 +0100)
committerPeter Eisentraut <peter@eisentraut.org>
Wed, 18 Mar 2026 10:09:14 +0000 (11:09 +0100)
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

meson.build
src/makefiles/meson.build

index 46bd6b1468a2070d6d1ef62b0b3e01005a0217c0..43894f050e8998fbe556104372af3dcdd27e6074 100644 (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
 
 
index 77f7a729cc20ef69ecf324f3c7042695b113794d..2401025d1cd6f1e3d6bcb29d29ab9f9078b89ccc 100644 (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.