summaryrefslogtreecommitdiff
path: root/src/include/meson.build
blob: 33c0a5562c60ae36948d48ad08ca25441783a037 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# Copyright (c) 2022-2023, PostgreSQL Global Development Group

pg_config_ext = configure_file(
  input: 'pg_config_ext.h.meson',
  output: 'pg_config_ext.h',
  configuration: cdata,
  install: true,
  install_dir: dir_include,
)
configure_files += pg_config_ext

pg_config_os = configure_file(
  output: 'pg_config_os.h',
  input: files('port/@0@.h'.format(portname)),
  install: true,
  install_dir: dir_include,
  copy: true,
)
configure_files += pg_config_os

pg_config = configure_file(
  output: 'pg_config.h',
  install: true,
  install_dir: dir_include,
  configuration: cdata,
)
configure_files += pg_config


config_paths_data = configuration_data()
config_paths_data.set_quoted('PGBINDIR', dir_prefix / dir_bin)
config_paths_data.set_quoted('PGSHAREDIR', dir_prefix / dir_data)
config_paths_data.set_quoted('SYSCONFDIR', dir_prefix / dir_sysconf)
config_paths_data.set_quoted('INCLUDEDIR', dir_prefix / dir_include)
config_paths_data.set_quoted('PKGINCLUDEDIR', dir_prefix / dir_include_pkg)
config_paths_data.set_quoted('INCLUDEDIRSERVER', dir_prefix / dir_include_server)
config_paths_data.set_quoted('LIBDIR', dir_prefix / dir_lib)
config_paths_data.set_quoted('PKGLIBDIR', dir_prefix / dir_lib_pkg)
config_paths_data.set_quoted('LOCALEDIR', dir_prefix / dir_locale)
config_paths_data.set_quoted('DOCDIR', dir_prefix / dir_doc)
config_paths_data.set_quoted('HTMLDIR', dir_prefix / dir_doc_html)
config_paths_data.set_quoted('MANDIR', dir_prefix / dir_man)


var_cc = ' '.join(cc.cmd_array())
var_cpp = ' '.join(cc.cmd_array() + ['-E'])
var_cflags = ' '.join(cflags + cflags_warn + get_option('c_args'))
if llvm.found()
  var_cxxflags = ' '.join(cxxflags + cxxflags_warn + get_option('cpp_args'))
else
  var_cxxflags = ''
endif
var_cppflags = ' '.join(cppflags)
var_cflags_sl = ' '.join(cc.get_supported_arguments('-fPIC'))
# explicitly add -Wl,--as-needed, normally added by meson, but we want it for
# PGXS compatibility
var_ldflags = ' '.join(
  ldflags
  + cc.get_supported_link_arguments('-Wl,--as-needed')
  + get_option('c_link_args')
)
var_ldflags_sl = ''.join(ldflags_sl)
var_ldflags_ex = '' # FIXME
# FIXME - some extensions might directly use symbols from one of libs. If
# that symbol isn't used by postgres, and statically linked, it'll cause an
# undefined symbol at runtime. And obviously it'll cause problems for
# executables, although those are probably less common.
var_libs = ''


pg_config_paths = configure_file(
  output: 'pg_config_paths.h',
  configuration: config_paths_data,
  install: false,
)
configure_files += pg_config_paths

install_headers(
  'pg_config_manual.h',
  'postgres_ext.h',
)

install_headers(
  'libpq/libpq-fs.h',
  install_dir: dir_include / 'libpq',
)

install_headers(
  'c.h',
  'port.h',
  'postgres_fe.h',
  install_dir: dir_include_internal
)

install_headers(
  'libpq/pqcomm.h',
  install_dir: dir_include_internal / 'libpq',
)

install_headers(
  'c.h',
  'fmgr.h',
  'funcapi.h',
  'getopt_long.h',
  'miscadmin.h',
  'pg_config_manual.h',
  'pg_getopt.h',
  'pg_trace.h',
  'pgstat.h',
  'pgtar.h',
  'pgtime.h',
  'port.h',
  'postgres.h',
  'postgres_ext.h',
  'postgres_fe.h',
  'varatt.h',
  'windowapi.h',
  pg_config_ext,
  pg_config_os,
  pg_config,
  install_dir: dir_include_server,
)

subdir('catalog')
subdir('nodes')
subdir('pch')
subdir('storage')
subdir('utils')

header_subdirs = [
  'access',
  'archive',
  'catalog',
  'bootstrap',
  'commands',
  'common',
  'datatype',
  'executor',
  'fe_utils',
  'foreign',
  'jit',
  'lib',
  'libpq',
  'mb',
  'nodes',
  'optimizer',
  'parser',
  'partitioning',
  'postmaster',
  'regex',
  'replication',
  'rewrite',
  'statistics',
  'storage',
  'tcop',
  'snowball',
  'tsearch',
  'utils',
  'port',
  'portability',
]

# XXX: installing headers this way has the danger of installing editor files
# etc, unfortunately install_subdir() doesn't allow including / excluding by
# pattern currently.
foreach d : header_subdirs
  if d == 'catalog'
    continue
  endif
  install_subdir(d, install_dir: dir_include_server,
                 exclude_files: ['.gitignore', 'meson.build'])
endforeach

install_subdir('catalog',
  install_dir: dir_include_server,
  exclude_files: [
    '.gitignore',
    'Makefile',
    'duplicate_oids',
    'meson.build',
    'reformat_dat_file.pl',
    'renumber_oids.pl',
    'unused_oids',
  ] + bki_data,
)

# autoconf generates the file there, ensure we get a conflict
generated_sources_ac += {'src/include': ['stamp-h', 'stamp-ext-h']}