injection_points: Re-enable permutation in isolation test "basic"
[pgsql.git] / src / makefiles / meson.build
blobd49b2079a441d56e876d84869d0a613a8775c2c6
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()] : [':']
11 working_strip = false
12 if strip_bin.found()
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'))
18     working_strip = true
19     strip_static_cmd = strip_cmd + ['--strip-unneeded']
20     strip_shared_cmd = strip_cmd + ['--strip-unneeded']
21   elif host_system == 'darwin'
22     working_strip = true
23     strip_static_cmd = strip_cmd + ['-x']
24     strip_shared_cmd = strip_cmd + ['-x']
25   endif
26 endif
28 if not working_strip
29   strip_cmd = [':']
30   strip_static_cmd = [':']
31   strip_shared_cmd = [':']
32 endif
35 pgxs_kv = {
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',
42   'vpath_build': 'yes',
43   'autodepend': cc.get_argument_syntax() == 'gcc' ? 'yes' : 'no',
45   'host_cpu': host_cpu,
46   'host': '@0@-@1@'.format(host_cpu, host_system),
47   'host_os': host_system,
48   'build_os': build_machine.system(),
49   'PORTNAME': portname,
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',
63   'DLSUFFIX': dlsuffix,
64   'EXEEXT': exesuffix,
66   'SUN_STUDIO_CC': 'no', # not supported so far
68   # want the chosen option, rather than the library
69   'with_ssl' : ssl_library,
70   'with_uuid': uuidopt,
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',
84   'LN_S': 'ln -s',
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',
89   'CC': var_cc,
90   'CPP': var_cpp,
91   'GCC': cc.get_argument_syntax() == 'gcc' ? 'yes' : 'no',
93   'CPPFLAGS': var_cppflags,
94   'CFLAGS': var_cflags,
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,
110   'LDFLAGS_EX_BE':
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),
121   'LIBS': var_libs,
124 if llvm.found()
125   pgxs_kv += {
126     'CLANG': clang.path(),
127     'CXX': ' '.join(cpp.cmd_array()),
128     'LLVM_BINPATH': llvm_binpath,
129   }
130 else
131   pgxs_kv += {
132     'CLANG': '',
133     'CXX': '',
134     'LLVM_BINPATH': '',
135   }
136 endif
138 pgxs_bins = {
139   'AR':
140     find_program(['ar'], native: true, required: false),
141   'AWK':
142     find_program(['gawk', 'mawk', 'nawk', 'awk'], native: true, required: false),
143   'BISON': bison,
144   'FLEX': flex,
145   'GZIP': gzip,
146   'LZ4': program_lz4,
147   'OPENSSL': openssl,
148   'PERL': perl,
149   'PROVE': prove,
150   'PYTHON': python,
151   'TAR': tar,
152   'ZSTD': program_zstd,
153   'DTRACE': dtrace,
156 pgxs_empty = [
157   'ICU_CFLAGS', # needs to be added, included by public server headers
159   # hard to see why we'd need either?
160   'ZIC',
161   'TCLSH',
163   # docs don't seem to be supported by pgxs
164   'XMLLINT',
165   'XSLTPROC',
166   'DBTOEPUB',
167   'FOP',
169   # supporting coverage for pgxs-in-meson build doesn't seem worth it
170   'GENHTML',
171   'LCOV',
172   'GCOV',
173   'MSGFMT_FLAGS',
175   # translation doesn't appear to be supported by pgxs
176   'MSGFMT',
177   'XGETTEXT',
178   'MSGMERGE',
179   'WANTED_LANGUAGES',
181   # Not needed because we don't build the server / PLs with the generated makefile
182   'LIBOBJS', 'PG_CRC32C_OBJS', 'TAS',
183   'PG_TEST_EXTRA',
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',
197   'UUID_LIBS',
199   'PTHREAD_CFLAGS', 'PTHREAD_LIBS',
201   'ICU_LIBS',
204 if host_system == 'windows' and cc.get_argument_syntax() != 'msvc'
205   pgxs_bins += {'WINDRES': windres}
206 else
207   pgxs_empty += 'WINDRES'
208 endif
210 pgxs_dirs = {
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'),
226 pgxs_deps = {
227   'bonjour': bonjour,
228   'bsd_auth': bsd_auth,
229   'gssapi': gssapi,
230   'icu': icu,
231   'ldap': ldap,
232   'libxml': libxml,
233   'libxslt': libxslt,
234   'llvm': llvm,
235   'lz4': lz4,
236   'nls': libintl,
237   'pam': pam,
238   'perl': perl_dep,
239   'python': python3_dep,
240   'readline': readline,
241   'selinux': selinux,
242   'systemd': systemd,
243   'tcl': tcl_dep,
244   'zlib': zlib,
245   'zstd': zstd,
249 pgxs_cdata = configuration_data(pgxs_kv)
251 foreach b, p : pgxs_bins
252   pgxs_cdata.set(b, p.found() ? p.path() : '')
253 endforeach
255 foreach pe : pgxs_empty
256   pgxs_cdata.set(pe, '')
257 endforeach
259 foreach d, p : pgxs_dirs
260   pgxs_cdata.set(d, p)
261 endforeach
263 foreach d, v : pgxs_deps
264   pgxs_cdata.set('with_@0@'.format(d), v.found() ? 'yes' : 'no')
265 endforeach