From: Peter Eisentraut Date: Wed, 18 Mar 2026 10:09:14 +0000 (+0100) Subject: meson: Add {perl|python}_includespec to generated Makefile.global X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=720c9b504ec6934e93d7304e789c445dc1c09f31;p=thirdparty%2Fpostgresql.git 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 Discussion: https://www.postgresql.org/message-id/flat/CAMSWrt-PoQt4sHryWrB1ViuGBJF_PpbjoSGrWR2Ry47bHNLDqg%40mail.gmail.com --- diff --git a/meson.build b/meson.build index 46bd6b1468a..43894f050e8 100644 --- a/meson.build +++ b/meson.build @@ -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 diff --git a/src/makefiles/meson.build b/src/makefiles/meson.build index 77f7a729cc2..2401025d1cd 100644 --- a/src/makefiles/meson.build +++ b/src/makefiles/meson.build @@ -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.