1 # Copyright (c) 2022-2025, PostgreSQL Global Development Group
3 ### Compute pgxs_data, used in src/meson.build to generate Makefile.global
4 ### etc, that's complete enough for PGXS to work.
7 # Emulation of PGAC_CHECK_STRIP
8 strip_bin = find_program(get_option('STRIP'), required: false, native: true)
9 strip_cmd = strip_bin.found() ? [strip_bin.path()] : [':']
13 strip_version = run_command(strip_bin, '-V', check: false)
15 if strip_version.returncode() == 0 and (
16 strip_version.stdout().contains('GNU strip') or
17 strip_version.stderr().contains('GNU strip'))
19 strip_static_cmd = strip_cmd + ['--strip-unneeded']
20 strip_shared_cmd = strip_cmd + ['--strip-unneeded']
21 elif host_system == 'darwin'
23 strip_static_cmd = strip_cmd + ['-x']
24 strip_shared_cmd = strip_cmd + ['-x']
30 strip_static_cmd = [':']
31 strip_shared_cmd = [':']
36 'PACKAGE_URL': pg_url,
37 'PACKAGE_VERSION': pg_version,
38 'PG_MAJORVERSION': pg_version_major,
39 'PG_VERSION_NUM': pg_version_num,
40 'configure_input': 'meson',
43 'autodepend': cc.get_argument_syntax() == 'gcc' ? 'yes' : 'no',
46 'host': '@0@-@1@'.format(host_cpu, host_system),
47 'host_os': host_system,
48 'build_os': build_machine.system(),
50 'PG_SYSROOT': pg_sysroot,
52 'abs_top_builddir': meson.build_root(),
53 'abs_top_srcdir': meson.source_root(),
55 'enable_rpath': get_option('rpath') ? 'yes' : 'no',
56 'enable_nls': libintl.found() ? 'yes' : 'no',
57 'enable_injection_points': get_option('injection_points') ? 'yes' : 'no',
58 'enable_tap_tests': tap_tests_enabled ? 'yes' : 'no',
59 'enable_debug': get_option('debug') ? 'yes' : 'no',
60 'enable_coverage': 'no',
61 'enable_dtrace': dtrace.found() ? 'yes' : 'no',
66 'SUN_STUDIO_CC': 'no', # not supported so far
68 # want the chosen option, rather than the library
69 'with_ssl' : ssl_library,
72 'default_port': get_option('pgport'),
73 'with_system_tzdata': get_option('system_tzdata'),
75 'with_krb_srvnam': get_option('krb_srvnam'),
76 'krb_srvtab': krb_srvtab,
78 'STRIP': ' '.join(strip_cmd),
79 'STRIP_STATIC_LIB': ' '.join(strip_static_cmd),
80 'STRIP_SHARED_LIB': ' '.join(strip_shared_cmd),
82 # these seem to be standard these days
83 'MKDIR_P': 'mkdir -p',
85 # Just always use the install_sh fallback that autoconf uses. Unlikely to
86 # matter performance-wise for extensions. If it turns out to do, we can
87 'install_bin': '$(SHELL) $(top_srcdir)/config/install-sh -c',
91 'GCC': cc.get_argument_syntax() == 'gcc' ? 'yes' : 'no',
93 'CPPFLAGS': var_cppflags,
95 'CXXFLAGS': var_cxxflags,
96 'CFLAGS_SL': var_cflags_sl,
97 'CFLAGS_SL_MODULE': ' '.join(cflags_mod),
98 'CXXFLAGS_SL_MODULE': ' '.join(cxxflags_mod),
99 'PERMIT_DECLARATION_AFTER_STATEMENT':
100 ' '.join(cflags_no_decl_after_statement),
101 'PERMIT_MISSING_VARIABLE_DECLARATIONS':
102 ' '.join(cflags_no_missing_var_decls),
104 'CFLAGS_CRC': ' '.join(cflags_crc),
105 'CFLAGS_UNROLL_LOOPS': ' '.join(unroll_loops_cflags),
106 'CFLAGS_VECTORIZE': ' '.join(vectorize_cflags),
108 'LDFLAGS': var_ldflags,
109 'LDFLAGS_EX': var_ldflags_ex,
111 ' '.join(cc.get_supported_link_arguments('-Wl,--export-dynamic')),
112 'LDFLAGS_SL': var_ldflags_sl,
114 # TODO: requires bitcode generation to be implemented for meson
115 'BITCODE_CFLAGS': '',
116 'BITCODE_CXXFLAGS': '',
118 'BISONFLAGS': ' '.join(bison_flags),
119 'FLEXFLAGS': ' '.join(flex_flags),
126 'CLANG': clang.path(),
127 'CXX': ' '.join(cpp.cmd_array()),
128 'LLVM_BINPATH': llvm_binpath,
140 find_program(['ar'], native: true, required: false),
142 find_program(['gawk', 'mawk', 'nawk', 'awk'], native: true, required: false),
152 'ZSTD': program_zstd,
157 'ICU_CFLAGS', # needs to be added, included by public server headers
159 # hard to see why we'd need either?
163 # docs don't seem to be supported by pgxs
169 # supporting coverage for pgxs-in-meson build doesn't seem worth it
175 # translation doesn't appear to be supported by pgxs
181 # Not needed because we don't build the server / PLs with the generated makefile
182 'LIBOBJS', 'PG_CRC32C_OBJS', 'TAS',
184 'DTRACEFLAGS', # only server has dtrace probes
186 'perl_archlibexp', 'perl_embed_ccflags', 'perl_embed_ldflags', 'perl_includespec', 'perl_privlibexp',
187 'python_additional_libs', 'python_includespec', 'python_libdir', 'python_libspec', 'python_majorversion', 'python_version',
189 # possible that some of these are referenced explicitly in pgxs makefiles?
190 # For now not worth it.
191 'TCL_INCLUDE_SPEC', 'TCL_LIBS', 'TCL_LIB_SPEC', 'TCL_SHARED_BUILD',
193 'LLVM_CFLAGS', 'LLVM_CPPFLAGS', 'LLVM_CXXFLAGS', 'LLVM_LIBS',
195 'LDAP_LIBS_BE', 'LDAP_LIBS_FE',
199 'PTHREAD_CFLAGS', 'PTHREAD_LIBS',
204 if host_system == 'windows' and cc.get_argument_syntax() != 'msvc'
205 pgxs_bins += {'WINDRES': windres}
207 pgxs_empty += 'WINDRES'
211 'prefix': get_option('prefix'),
213 'bindir': '${exec_prefix}' / get_option('bindir'),
214 'datarootdir': '${prefix}' / get_option('datadir'),
215 'datadir': '${datarootdir}',
216 'docdir': '${prefix}' / dir_doc,
217 'exec_prefix': '${prefix}',
218 'htmldir': '${docdir}',
219 'includedir': '${prefix}' / get_option('includedir'),
220 'libdir': '${exec_prefix}' / get_option('libdir'),
221 'localedir': '${prefix}' / get_option('localedir'),
222 'mandir': '${prefix}' / get_option('mandir'),
223 'sysconfdir': '${prefix}' / get_option('sysconfdir'),
228 'bsd_auth': bsd_auth,
239 'python': python3_dep,
240 'readline': readline,
249 pgxs_cdata = configuration_data(pgxs_kv)
251 foreach b, p : pgxs_bins
252 pgxs_cdata.set(b, p.found() ? p.path() : '')
255 foreach pe : pgxs_empty
256 pgxs_cdata.set(pe, '')
259 foreach d, p : pgxs_dirs
263 foreach d, v : pgxs_deps
264 pgxs_cdata.set('with_@0@'.format(d), v.found() ? 'yes' : 'no')