doc: Fix descriptions related to the handling of non-ASCII characters
[pgsql.git] / src / makefiles / meson.build
blobbe946f7b38bff4563dd56b024000f3dba7457850
1 # Copyright (c) 2022-2023, 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_tap_tests': tap_tests_enabled ? 'yes' : 'no',
58   'enable_debug': get_option('debug') ? 'yes' : 'no',
59   'enable_coverage': 'no',
60   'enable_dtrace': dtrace.found() ? 'yes' : 'no',
62   'DLSUFFIX': dlsuffix,
63   'EXEEXT': exesuffix,
65   'SUN_STUDIO_CC': 'no', # not supported so far
67   # want the chosen option, rather than the library
68   'with_ssl' : ssl_library,
69   'with_uuid': uuidopt,
71   'default_port': get_option('pgport'),
72   'with_system_tzdata': get_option('system_tzdata'),
74   'with_krb_srvnam': get_option('krb_srvnam'),
75   'krb_srvtab': krb_srvtab,
77   'STRIP': ' '.join(strip_cmd),
78   'STRIP_STATIC_LIB': ' '.join(strip_static_cmd),
79   'STRIP_SHARED_LIB': ' '.join(strip_shared_cmd),
81   # these seem to be standard these days
82   'MKDIR_P': 'mkdir -p',
83   'LN_S': 'ln -s',
84   # Just always use the install_sh fallback that autoconf uses. Unlikely to
85   # matter performance-wise for extensions. If it turns out to do, we can
86   'install_bin': '$(SHELL) $(top_srcdir)/config/install-sh -c',
88   'CC': var_cc,
89   'CPP': var_cpp,
90   'GCC': cc.get_argument_syntax() == 'gcc' ? 'yes' : 'no',
92   'CPPFLAGS': var_cppflags,
93   'CFLAGS': var_cflags,
94   'CXXFLAGS': var_cxxflags,
95   'CFLAGS_SL': var_cflags_sl,
96   'CFLAGS_SL_MODULE': ' '.join(cflags_mod),
97   'CXXFLAGS_SL_MODULE': ' '.join(cxxflags_mod),
98   'PERMIT_DECLARATION_AFTER_STATEMENT':
99     ' '.join(cflags_no_decl_after_statement),
101   'CFLAGS_CRC': ' '.join(cflags_crc),
102   'CFLAGS_UNROLL_LOOPS': ' '.join(unroll_loops_cflags),
103   'CFLAGS_VECTORIZE': ' '.join(vectorize_cflags),
105   'LDFLAGS': var_ldflags,
106   'LDFLAGS_EX': var_ldflags_ex,
107   'LDFLAGS_EX_BE':
108     ' '.join(cc.get_supported_link_arguments('-Wl,--export-dynamic')),
109   'LDFLAGS_SL': var_ldflags_sl,
111   # TODO: requires bitcode generation to be implemented for meson
112   'BITCODE_CFLAGS': '',
113   'BITCODE_CXXFLAGS': '',
115   'BISONFLAGS': ' '.join(bison_flags),
116   'FLEXFLAGS': ' '.join(flex_flags),
118   'LIBS': var_libs,
121 if llvm.found()
122   pgxs_kv += {
123     'CLANG': clang.path(),
124     'CXX': ' '.join(cpp.cmd_array()),
125     'LLVM_BINPATH': llvm_binpath,
126   }
127 else
128   pgxs_kv += {
129     'CLANG': '',
130     'CXX': '',
131     'LLVM_BINPATH': '',
132   }
133 endif
135 pgxs_bins = {
136   'AR':
137     find_program(['ar'], native: true, required: false),
138   'AWK':
139     find_program(['gawk', 'mawk', 'nawk', 'awk'], native: true, required: false),
140   'BISON': bison,
141   'FLEX': flex,
142   'GZIP': gzip,
143   'LZ4': program_lz4,
144   'OPENSSL': openssl,
145   'PERL': perl,
146   'PROVE': prove,
147   'PYTHON': python,
148   'TAR': tar,
149   'ZSTD': program_zstd,
150   'DTRACE': dtrace,
153 pgxs_empty = [
154   'ICU_CFLAGS', # needs to be added, included by public server headers
156   # hard to see why we'd need either?
157   'ZIC',
158   'TCLSH',
160   # docs don't seem to be supported by pgxs
161   'XMLLINT',
162   'XSLTPROC',
163   'DBTOEPUB',
164   'FOP',
166   # supporting coverage for pgxs-in-meson build doesn't seem worth it
167   'GENHTML',
168   'LCOV',
169   'GCOV',
170   'MSGFMT_FLAGS',
172   # translation doesn't appear to be supported by pgxs
173   'MSGFMT',
174   'XGETTEXT',
175   'MSGMERGE',
176   'WANTED_LANGUAGES',
178   # Not needed because we don't build the server / PLs with the generated makefile
179   'LIBOBJS', 'PG_CRC32C_OBJS', 'TAS',
180   'DTRACEFLAGS', # only server has dtrace probes
182   'perl_archlibexp', 'perl_embed_ccflags', 'perl_embed_ldflags', 'perl_includespec', 'perl_privlibexp',
183   'python_additional_libs', 'python_includespec', 'python_libdir', 'python_libspec', 'python_majorversion', 'python_version',
185   # possible that some of these are referenced explicitly in pgxs makefiles?
186   # For now not worth it.
187   'TCL_INCLUDE_SPEC', 'TCL_LIBS', 'TCL_LIB_SPEC', 'TCL_SHARED_BUILD',
189   'LLVM_CFLAGS', 'LLVM_CPPFLAGS', 'LLVM_CXXFLAGS', 'LLVM_LIBS',
191   'LDAP_LIBS_BE', 'LDAP_LIBS_FE',
193   'UUID_LIBS',
195   'PTHREAD_CFLAGS', 'PTHREAD_LIBS',
197   'ICU_LIBS',
200 if host_system == 'windows' and cc.get_argument_syntax() != 'msvc'
201   pgxs_bins += {'WINDRES': windres}
202 else
203   pgxs_empty += 'WINDRES'
204 endif
206 pgxs_dirs = {
207   'prefix': get_option('prefix'),
209   'bindir': '${exec_prefix}' / get_option('bindir'),
210   'datarootdir': '${prefix}' / get_option('datadir'),
211   'datadir': '${datarootdir}',
212   'docdir': '${prefix}' / dir_doc,
213   'exec_prefix': '${prefix}',
214   'htmldir': '${docdir}',
215   'includedir': '${prefix}' / get_option('includedir'),
216   'libdir': '${exec_prefix}' / get_option('libdir'),
217   'localedir': '${prefix}' / get_option('localedir'),
218   'mandir': '${prefix}' / get_option('mandir'),
219   'sysconfdir': '${prefix}' / get_option('sysconfdir'),
222 pgxs_deps = {
223   'bonjour': bonjour,
224   'bsd_auth': bsd_auth,
225   'gssapi': gssapi,
226   'icu': icu,
227   'ldap': ldap,
228   'libxml': libxml,
229   'libxslt': libxslt,
230   'llvm': llvm,
231   'lz4': lz4,
232   'nls': libintl,
233   'pam': pam,
234   'perl': perl_dep,
235   'python': python3_dep,
236   'readline': readline,
237   'selinux': selinux,
238   'systemd': systemd,
239   'tcl': tcl_dep,
240   'zlib': zlib,
241   'zstd': zstd,
245 pgxs_cdata = configuration_data(pgxs_kv)
247 foreach b, p : pgxs_bins
248   pgxs_cdata.set(b, p.found() ? p.path() : '')
249 endforeach
251 foreach pe : pgxs_empty
252   pgxs_cdata.set(pe, '')
253 endforeach
255 foreach d, p : pgxs_dirs
256   pgxs_cdata.set(d, p)
257 endforeach
259 foreach d, v : pgxs_deps
260   pgxs_cdata.set('with_@0@'.format(d), v.found() ? 'yes' : 'no')
261 endforeach