meson: Add initial version of meson based build system

Autoconf is showing its age, fewer and fewer contributors know how to wrangle
it. Recursive make has a lot of hard to resolve dependency issues and slow
incremental rebuilds. Our home-grown MSVC build system is hard to maintain for
developers not using Windows and runs tests serially. While these and other
issues could individually be addressed with incremental improvements, together
they seem best addressed by moving to a more modern build system.

After evaluating different build system choices, we chose to use meson, to a
good degree based on the adoption by other open source projects.

We decided that it's more realistic to commit a relatively early version of
the new build system and mature it in tree.

This commit adds an initial version of a meson based build system. It supports
building postgres on at least AIX, FreeBSD, Linux, macOS, NetBSD, OpenBSD,
Solaris and Windows (however only gcc is supported on aix, solaris). For
Windows/MSVC postgres can now be built with ninja (faster, particularly for
incremental builds) and msbuild (supporting the visual studio GUI, but
building slower).

Several aspects (e.g. Windows rc file generation, PGXS compatibility, LLVM
bitcode generation, documentation adjustments) are done in subsequent commits
requiring further review. Other aspects (e.g. not installing test-only
extensions) are not yet addressed.

When building on Windows with msbuild, builds are slower when using a visual
studio version older than 2019, because those versions do not support
MultiToolTask, required by meson for intra-target parallelism.

The plan is to remove the MSVC specific build system in src/tools/msvc soon
after reaching feature parity. However, we're not planning to remove the
autoconf/make build system in the near future. Likely we're going to keep at
least the parts required for PGXS to keep working around until all supported
versions build with meson.

Some initial help for postgres developers is at
https://wiki.postgresql.org/wiki/Meson

With contributions from Thomas Munro, John Naylor, Stone Tickle and others.

Author: Andres Freund <andres@anarazel.de>
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
Author: Peter Eisentraut <peter@eisentraut.org>
Reviewed-By: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Discussion: https://postgr.es/m/20211012083721.hvixq4pnh2pixr3j@alap3.anarazel.de
This commit is contained in:
Andres Freund 2022-09-21 21:53:12 -07:00
parent fbb5f54b67
commit e6927270cd
265 changed files with 10962 additions and 0 deletions

4
config/meson.build Normal file
View File

@ -0,0 +1,4 @@
install_data(
'install-sh', 'missing',
install_dir: dir_pgxs / 'config'
)

6
configure vendored
View File

@ -20658,3 +20658,9 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
fi
# Ensure that any meson build directories would reconfigure and see that
# there's a conflicting in-tree build and can error out.
if test "$vpath_build"="no"; then
touch meson.build
fi

View File

@ -2472,3 +2472,9 @@ AC_CONFIG_HEADERS([src/interfaces/ecpg/include/ecpg_config.h],
[echo >src/interfaces/ecpg/include/stamp-h])
AC_OUTPUT
# Ensure that any meson build directories would reconfigure and see that
# there's a conflicting in-tree build and can error out.
if test "$vpath_build"="no"; then
touch meson.build
fi

View File

@ -0,0 +1,23 @@
adminpack = shared_module('adminpack',
['adminpack.c'],
kwargs: contrib_mod_args,
)
contrib_targets += adminpack
install_data(
'adminpack.control',
'adminpack--1.0.sql',
'adminpack--1.0--1.1.sql',
'adminpack--1.1--2.0.sql',
'adminpack--2.0--2.1.sql',
kwargs: contrib_data_args,
)
tests += {
'name': 'adminpack',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': ['adminpack'],
},
}

View File

@ -0,0 +1,37 @@
amcheck = shared_module('amcheck', [
'verify_heapam.c',
'verify_nbtree.c',
],
kwargs: contrib_mod_args,
)
contrib_targets += amcheck
install_data(
'amcheck.control',
'amcheck--1.0.sql',
'amcheck--1.0--1.1.sql',
'amcheck--1.1--1.2.sql',
'amcheck--1.2--1.3.sql',
kwargs: contrib_data_args,
)
tests += {
'name': 'amcheck',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': [
'check',
'check_btree',
'check_heap',
],
},
'tap': {
'tests': [
't/001_verify_heapam.pl',
't/002_cic.pl',
't/003_cic_2pc.pl',
],
},
}

View File

@ -0,0 +1,5 @@
autoinc = shared_module('auth_delay',
['auth_delay.c'],
kwargs: contrib_mod_args,
)
contrib_targets += autoinc

View File

@ -0,0 +1,16 @@
auto_explain = shared_module('auto_explain',
files('auto_explain.c'),
kwargs: contrib_mod_args,
)
contrib_targets += auto_explain
tests += {
'name': 'auto_explain',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'tap': {
'tests': [
't/001_auto_explain.pl',
],
},
}

View File

@ -0,0 +1,22 @@
basebackup_to_shell_sources = files(
'basebackup_to_shell.c',
)
basebackup_to_shell = shared_module('basebackup_to_shell',
basebackup_to_shell_sources,
kwargs: contrib_mod_args,
)
contrib_targets += basebackup_to_shell
tests += {
'name': 'basebackup_to_shell',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'tap': {
'tests': [
't/001_basic.pl',
],
'env': {'GZIP_PROGRAM': gzip.path(),
'TAR': tar.path()},
},
}

View File

@ -0,0 +1,23 @@
basic_archive_sources = files(
'basic_archive.c',
)
basic_archive = shared_module('basic_archive',
basic_archive_sources,
kwargs: contrib_mod_args,
)
contrib_targets += basic_archive
tests += {
'name': 'basic_archive',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': [
'basic_archive',
],
'regress_args': [
'--temp-config', files('basic_archive.conf'),
],
},
}

36
contrib/bloom/meson.build Normal file
View File

@ -0,0 +1,36 @@
bloom_sources = files(
'blcost.c',
'blinsert.c',
'blscan.c',
'blutils.c',
'blvacuum.c',
'blvalidate.c',
)
bloom = shared_module('bloom',
bloom_sources,
kwargs: contrib_mod_args,
)
contrib_targets += bloom
install_data(
'bloom.control',
'bloom--1.0.sql',
kwargs: contrib_data_args,
)
tests += {
'name': 'bloom',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': [
'bloom',
],
},
'tap': {
'tests': [
't/001_wal.pl',
],
},
}

View File

@ -0,0 +1,42 @@
if not perl_dep.found()
subdir_done()
endif
bool_plperl_sources = files(
'bool_plperl.c',
)
bool_plperl = shared_module('bool_plperl',
bool_plperl_sources,
include_directories: [plperl_inc, include_directories('.')],
kwargs: contrib_mod_args + {
'dependencies': [perl_dep, contrib_mod_args['dependencies']],
'install_rpath': ':'.join(mod_install_rpaths + ['@0@/CORE'.format(archlibexp)]),
'build_rpath': '@0@/CORE'.format(archlibexp),
},
)
contrib_targets += bool_plperl
install_data(
'bool_plperl.control',
'bool_plperl--1.0.sql',
kwargs: contrib_data_args,
)
install_data(
'bool_plperlu.control',
'bool_plperlu--1.0.sql',
kwargs: contrib_data_args,
)
tests += {
'name': 'bool_plperl',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': [
'bool_plperl',
'bool_plperlu',
],
},
}

View File

@ -0,0 +1,54 @@
btree_gin = shared_module('btree_gin',
files('btree_gin.c'),
kwargs: contrib_mod_args,
)
contrib_targets += btree_gin
install_data(
'btree_gin.control',
'btree_gin--1.0.sql',
'btree_gin--1.0--1.1.sql',
'btree_gin--1.1--1.2.sql',
'btree_gin--1.2--1.3.sql',
kwargs: contrib_data_args,
)
tests += {
'name': 'btree_gin',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': [
'install_btree_gin',
'int2',
'int4',
'int8',
'float4',
'float8',
'money',
'oid',
'timestamp',
'timestamptz',
'time',
'timetz',
'date',
'interval',
'macaddr',
'macaddr8',
'inet',
'cidr',
'text',
'varchar',
'char',
'bytea',
'bit',
'varbit',
'numeric',
'enum',
'uuid',
'name',
'bool',
'bpchar',
],
},
}

View File

@ -0,0 +1,84 @@
btree_gist_sources = files(
'btree_bit.c',
'btree_bool.c',
'btree_bytea.c',
'btree_cash.c',
'btree_date.c',
'btree_enum.c',
'btree_float4.c',
'btree_float8.c',
'btree_gist.c',
'btree_inet.c',
'btree_int2.c',
'btree_int4.c',
'btree_int8.c',
'btree_interval.c',
'btree_macaddr.c',
'btree_macaddr8.c',
'btree_numeric.c',
'btree_oid.c',
'btree_text.c',
'btree_time.c',
'btree_ts.c',
'btree_utils_num.c',
'btree_utils_var.c',
'btree_uuid.c',
)
btree_gist = shared_module('btree_gist',
btree_gist_sources,
kwargs: contrib_mod_args,
)
contrib_targets += btree_gist
install_data(
'btree_gist.control',
'btree_gist--1.0--1.1.sql',
'btree_gist--1.1--1.2.sql',
'btree_gist--1.2.sql',
'btree_gist--1.2--1.3.sql',
'btree_gist--1.3--1.4.sql',
'btree_gist--1.4--1.5.sql',
'btree_gist--1.5--1.6.sql',
'btree_gist--1.6--1.7.sql',
kwargs: contrib_data_args,
)
tests += {
'name': 'btree_gist',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': [
'init',
'int2',
'int4',
'int8',
'float4',
'float8',
'cash',
'oid',
'timestamp',
'timestamptz',
'time',
'timetz',
'date',
'interval',
'macaddr',
'macaddr8',
'inet',
'cidr',
'text',
'varchar',
'char',
'bytea',
'bit',
'varbit',
'numeric',
'uuid',
'not_equal',
'enum',
'bool',
],
},
}

View File

@ -0,0 +1,34 @@
citext_sources = files(
'citext.c',
)
citext = shared_module('citext',
citext_sources,
kwargs: contrib_mod_args,
)
contrib_targets += citext
install_data(
'citext.control',
'citext--1.0--1.1.sql',
'citext--1.1--1.2.sql',
'citext--1.2--1.3.sql',
'citext--1.3--1.4.sql',
'citext--1.4.sql',
'citext--1.4--1.5.sql',
'citext--1.5--1.6.sql',
kwargs: contrib_data_args,
)
tests += {
'name': 'citext',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': [
'create_index_acl',
'citext',
'citext_utf8',
],
},
}

53
contrib/cube/meson.build Normal file
View File

@ -0,0 +1,53 @@
cube_sources = files(
'cube.c',
)
cube_scan = custom_target('cubescan',
input: 'cubescan.l',
output: 'cubescan.c',
command: flex_cmd,
)
generated_sources += cube_scan
cube_sources += cube_scan
cube_parse = custom_target('cubeparse',
input: 'cubeparse.y',
kwargs: bison_kw,
)
generated_sources += cube_parse.to_list()
cube_sources += cube_parse
cube = shared_module('cube',
cube_sources,
include_directories: include_directories('.'),
kwargs: contrib_mod_args,
)
contrib_targets += cube
install_data(
'cube.control',
'cube--1.0--1.1.sql',
'cube--1.1--1.2.sql',
'cube--1.2.sql',
'cube--1.2--1.3.sql',
'cube--1.3--1.4.sql',
'cube--1.4--1.5.sql',
kwargs: contrib_data_args,
)
install_headers(
'cubedata.h',
install_dir: dir_include_extension / 'cube',
)
tests += {
'name': 'cube',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': [
'cube',
'cube_sci',
],
},
}

View File

@ -0,0 +1,31 @@
dblink_sources = files(
'dblink.c',
)
dblink = shared_module('dblink',
dblink_sources,
kwargs: contrib_mod_args + {
'dependencies': contrib_mod_args['dependencies'] + [libpq],
},
)
contrib_targets += dblink
install_data(
'dblink.control',
'dblink--1.0--1.1.sql',
'dblink--1.1--1.2.sql',
'dblink--1.2.sql',
kwargs: contrib_data_args,
)
tests += {
'name': 'dblink',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': [
'dblink',
],
'regress_args': ['--dlpath', meson.build_root() / 'src/test/regress'],
},
}

View File

@ -0,0 +1,22 @@
dict_int = shared_module('dict_int',
files('dict_int.c'),
kwargs: contrib_mod_args,
)
contrib_targets += dict_int
install_data(
'dict_int.control',
'dict_int--1.0.sql',
kwargs: contrib_data_args,
)
tests += {
'name': 'dict_int',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': [
'dict_int',
],
},
}

View File

@ -0,0 +1,29 @@
dict_xsyn = shared_module('dict_xsyn',
files('dict_xsyn.c'),
kwargs: contrib_mod_args,
)
contrib_targets += dict_xsyn
install_data(
'dict_xsyn.control',
'dict_xsyn--1.0.sql',
kwargs: contrib_data_args,
)
install_data(
'xsyn_sample.rules',
kwargs: contrib_data_args + {
'install_dir': dir_data / 'tsearch_data'
}
)
tests += {
'name': 'dict_xsyn',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': [
'dict_xsyn',
],
},
}

View File

@ -0,0 +1,23 @@
earthdistance = shared_module('earthdistance',
files('earthdistance.c'),
kwargs: contrib_mod_args,
)
contrib_targets += earthdistance
install_data(
'earthdistance.control',
'earthdistance--1.0--1.1.sql',
'earthdistance--1.1.sql',
kwargs: contrib_data_args,
)
tests += {
'name': 'earthdistance',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': [
'earthdistance',
],
},
}

View File

@ -0,0 +1,22 @@
file_fdw = shared_module('file_fdw',
files('file_fdw.c'),
kwargs: contrib_mod_args,
)
contrib_targets += file_fdw
install_data(
'file_fdw.control',
'file_fdw--1.0.sql',
kwargs: contrib_data_args,
)
tests += {
'name': 'file_fdw',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': [
'file_fdw',
],
},
}

View File

@ -0,0 +1,26 @@
fuzzystrmatch = shared_module('fuzzystrmatch',
files(
'fuzzystrmatch.c',
'dmetaphone.c'
),
kwargs: contrib_mod_args,
)
contrib_targets += fuzzystrmatch
install_data(
'fuzzystrmatch.control',
'fuzzystrmatch--1.0--1.1.sql',
'fuzzystrmatch--1.1.sql',
kwargs: contrib_data_args,
)
tests += {
'name': 'fuzzystrmatch',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': [
'fuzzystrmatch',
],
},
}

View File

@ -0,0 +1,44 @@
# .. so that includes of hstore/hstore.h work
hstore_inc = include_directories('.', '../')
hstore = shared_module('hstore',
files(
'hstore_compat.c',
'hstore_gin.c',
'hstore_gist.c',
'hstore_io.c',
'hstore_op.c',
'hstore_subs.c',
),
kwargs: contrib_mod_args,
)
contrib_targets += hstore
install_data(
'hstore.control',
'hstore--1.1--1.2.sql',
'hstore--1.2--1.3.sql',
'hstore--1.3--1.4.sql',
'hstore--1.4.sql',
'hstore--1.4--1.5.sql',
'hstore--1.5--1.6.sql',
'hstore--1.6--1.7.sql',
'hstore--1.7--1.8.sql',
kwargs: contrib_data_args,
)
install_headers(
'hstore.h',
install_dir: dir_include_extension / 'hstore',
)
tests += {
'name': 'hstore',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': [
'hstore',
],
},
}

View File

@ -0,0 +1,43 @@
if not perl_dep.found()
subdir_done()
endif
hstore_plperl_sources = files(
'hstore_plperl.c',
)
hstore_plperl = shared_module('hstore_plperl',
hstore_plperl_sources,
include_directories: [plperl_inc, hstore_inc],
kwargs: contrib_mod_args + {
'dependencies': [perl_dep, contrib_mod_args['dependencies']],
'install_rpath': ':'.join(mod_install_rpaths + ['@0@/CORE'.format(archlibexp)]),
'build_rpath': '@0@/CORE'.format(archlibexp),
},
)
contrib_targets += hstore_plperl
install_data(
'hstore_plperl.control',
'hstore_plperl--1.0.sql',
kwargs: contrib_data_args,
)
install_data(
'hstore_plperlu.control',
'hstore_plperlu--1.0.sql',
kwargs: contrib_data_args,
)
tests += {
'name': 'hstore_plperl',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': [
'hstore_plperl',
'hstore_plperlu',
'create_transform',
],
},
}

View File

@ -0,0 +1,37 @@
if not python3_dep.found()
subdir_done()
endif
hstore_plpython_sources = files(
'hstore_plpython.c',
)
hstore_plpython = shared_module('hstore_plpython3',
hstore_plpython_sources,
include_directories: [plpython_inc, hstore_inc, ],
c_args: ['-DPLPYTHON_LIBNAME="plpython3"'],
kwargs: contrib_mod_args + {
'dependencies': [python3_dep, contrib_mod_args['dependencies']],
},
)
contrib_targets += hstore_plpython
install_data(
'hstore_plpython3u--1.0.sql',
'hstore_plpython3u.control',
kwargs: contrib_data_args,
)
hstore_plpython_regress = [
'hstore_plpython'
]
tests += {
'name': 'hstore_plpython',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': hstore_plpython_regress,
'regress_args': ['--load-extension=hstore'],
},
}

View File

@ -0,0 +1,6 @@
install_data(
'intagg.control',
'intagg--1.0--1.1.sql',
'intagg--1.1.sql',
kwargs: contrib_data_args,
)

View File

@ -0,0 +1,37 @@
intarray_sources = files(
'_int_bool.c',
'_int_gin.c',
'_int_gist.c',
'_int_op.c',
'_int_selfuncs.c',
'_int_tool.c',
'_intbig_gist.c',
)
intarray = shared_module('_int',
intarray_sources,
kwargs: contrib_mod_args,
)
contrib_targets += intarray
install_data(
'intarray.control',
'intarray--1.0--1.1.sql',
'intarray--1.1--1.2.sql',
'intarray--1.2.sql',
'intarray--1.2--1.3.sql',
'intarray--1.3--1.4.sql',
'intarray--1.4--1.5.sql',
kwargs: contrib_data_args,
)
tests += {
'name': 'intarray',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': [
'_int',
],
},
}

33
contrib/isn/meson.build Normal file
View File

@ -0,0 +1,33 @@
isn_sources = files(
'isn.c',
)
isn = shared_module('isn',
isn_sources,
kwargs: contrib_mod_args,
)
contrib_targets += isn
install_data(
'isn.control',
'isn--1.0--1.1.sql',
'isn--1.1--1.2.sql',
'isn--1.1.sql',
kwargs: contrib_data_args,
)
install_headers(
'isn.h',
install_dir: dir_include_extension / 'isn',
)
tests += {
'name': 'isn',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': [
'isn',
],
},
}

View File

@ -0,0 +1,43 @@
if not perl_dep.found()
subdir_done()
endif
jsonb_plperl_sources = files(
'jsonb_plperl.c',
)
jsonb_plperl = shared_module('jsonb_plperl',
jsonb_plperl_sources,
include_directories: [plperl_inc],
kwargs: contrib_mod_args + {
'dependencies': [perl_dep, contrib_mod_args['dependencies']],
'install_rpath': ':'.join(mod_install_rpaths + ['@0@/CORE'.format(archlibexp)]),
'build_rpath': '@0@/CORE'.format(archlibexp),
},
)
contrib_targets += jsonb_plperl
install_data(
'jsonb_plperl.control',
'jsonb_plperl--1.0.sql',
kwargs: contrib_data_args,
)
install_data(
'jsonb_plperlu.control',
'jsonb_plperlu--1.0.sql',
kwargs: contrib_data_args,
)
tests += {
'name': 'jsonb_plperl',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': [
'jsonb_plperl',
'jsonb_plperlu',
],
},
}

View File

@ -0,0 +1,36 @@
if not python3_dep.found()
subdir_done()
endif
jsonb_plpython_sources = files(
'jsonb_plpython.c',
)
jsonb_plpython = shared_module('jsonb_plpython3',
jsonb_plpython_sources,
include_directories: [plpython_inc],
c_args: ['-DPLPYTHON_LIBNAME="plpython3"'],
kwargs: contrib_mod_args + {
'dependencies': [python3_dep, contrib_mod_args['dependencies']],
},
)
contrib_targets += jsonb_plpython
install_data(
'jsonb_plpython3u.control',
'jsonb_plpython3u--1.0.sql',
kwargs: contrib_data_args,
)
jsonb_plpython_regress = [
'jsonb_plpython'
]
tests += {
'name': 'jsonb_plpython',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': jsonb_plpython_regress,
},
}

27
contrib/lo/meson.build Normal file
View File

@ -0,0 +1,27 @@
lo_sources = files(
'lo.c',
)
lo = shared_module('lo',
lo_sources,
kwargs: contrib_mod_args,
)
contrib_targets += lo
install_data(
'lo.control',
'lo--1.0--1.1.sql',
'lo--1.1.sql',
kwargs: contrib_data_args,
)
tests += {
'name': 'lo',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': [
'lo',
],
},
}

44
contrib/ltree/meson.build Normal file
View File

@ -0,0 +1,44 @@
ltree_sources = files(
'_ltree_gist.c',
'_ltree_op.c',
'crc32.c',
'lquery_op.c',
'ltree_gist.c',
'ltree_io.c',
'ltree_op.c',
'ltxtquery_io.c',
'ltxtquery_op.c',
)
# .. so that includes of ltree/ltree.h work
ltree_inc = include_directories('.', '../')
ltree = shared_module('ltree',
ltree_sources,
kwargs: contrib_mod_args,
)
contrib_targets += ltree
install_data(
'ltree.control',
'ltree--1.0--1.1.sql',
'ltree--1.1--1.2.sql',
'ltree--1.1.sql',
kwargs: contrib_data_args,
)
install_headers(
'ltree.h',
install_dir: dir_include_extension / 'ltree',
)
tests += {
'name': 'ltree',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': [
'ltree',
],
},
}

View File

@ -0,0 +1,37 @@
if not python3_dep.found()
subdir_done()
endif
ltree_plpython_sources = files(
'ltree_plpython.c',
)
ltree_plpython = shared_module('ltree_plpython3',
ltree_plpython_sources,
include_directories: [plpython_inc, ltree_inc],
c_args: ['-DPLPYTHON_LIBNAME="plpython3"'],
kwargs: contrib_mod_args + {
'dependencies': [python3_dep, contrib_mod_args['dependencies']],
},
)
contrib_targets += ltree_plpython
install_data(
'ltree_plpython3u--1.0.sql',
'ltree_plpython3u.control',
kwargs: contrib_data_args,
)
ltree_plpython_regress = [
'ltree_plpython'
]
tests += {
'name': 'ltree_plpython',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': ltree_plpython_regress,
'regress_args': ['--load-extension=ltree'],
},
}

66
contrib/meson.build Normal file
View File

@ -0,0 +1,66 @@
contrib_mod_args = pg_mod_args
contrib_data_dir = dir_data_extension
contrib_data_args = {
'install_dir': contrib_data_dir,
}
subdir('adminpack')
subdir('amcheck')
subdir('auth_delay')
subdir('auto_explain')
subdir('basic_archive')
subdir('bloom')
subdir('basebackup_to_shell')
subdir('bool_plperl')
subdir('btree_gin')
subdir('btree_gist')
subdir('citext')
subdir('cube')
subdir('dblink')
subdir('dict_int')
subdir('dict_xsyn')
subdir('earthdistance')
subdir('file_fdw')
subdir('fuzzystrmatch')
subdir('hstore')
subdir('hstore_plperl')
subdir('hstore_plpython')
subdir('intagg')
subdir('intarray')
subdir('isn')
subdir('jsonb_plperl')
subdir('jsonb_plpython')
subdir('lo')
subdir('ltree')
subdir('ltree_plpython')
subdir('oid2name')
subdir('old_snapshot')
subdir('pageinspect')
subdir('passwordcheck')
subdir('pg_buffercache')
subdir('pgcrypto')
subdir('pg_freespacemap')
subdir('pg_prewarm')
subdir('pgrowlocks')
subdir('pg_stat_statements')
subdir('pgstattuple')
subdir('pg_surgery')
subdir('pg_trgm')
subdir('pg_visibility')
subdir('pg_walinspect')
subdir('postgres_fdw')
subdir('seg')
subdir('sepgsql')
subdir('spi')
subdir('sslinfo')
# start-scripts doesn't contain build products
subdir('tablefunc')
subdir('tcn')
subdir('test_decoding')
subdir('tsm_system_rows')
subdir('tsm_system_time')
subdir('unaccent')
subdir('uuid-ossp')
subdir('vacuumlo')
subdir('xml2')

View File

@ -0,0 +1,17 @@
oid2name = executable('oid2name',
['oid2name.c'],
dependencies: [frontend_code, libpq],
kwargs: default_bin_args,
)
contrib_targets += oid2name
tests += {
'name': 'oid2name',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'tap': {
'tests': [
't/001_basic.pl',
],
},
}

View File

@ -0,0 +1,15 @@
old_snapshot_sources = files(
'time_mapping.c',
)
old_snapshot = shared_module('old_snapshot',
old_snapshot_sources,
kwargs: contrib_mod_args,
)
contrib_targets += old_snapshot
install_data(
'old_snapshot.control',
'old_snapshot--1.0.sql',
kwargs: contrib_data_args,
)

View File

@ -0,0 +1,50 @@
pageinspect_sources = files(
'brinfuncs.c',
'btreefuncs.c',
'fsmfuncs.c',
'ginfuncs.c',
'gistfuncs.c',
'hashfuncs.c',
'heapfuncs.c',
'rawpage.c',
)
pageinspect = shared_module('pageinspect',
pageinspect_sources,
kwargs: contrib_mod_args,
)
contrib_targets += pageinspect
install_data(
'pageinspect--1.0--1.1.sql',
'pageinspect--1.1--1.2.sql',
'pageinspect--1.2--1.3.sql',
'pageinspect--1.3--1.4.sql',
'pageinspect--1.4--1.5.sql',
'pageinspect--1.5--1.6.sql',
'pageinspect--1.5.sql',
'pageinspect--1.6--1.7.sql',
'pageinspect--1.7--1.8.sql',
'pageinspect--1.8--1.9.sql',
'pageinspect--1.9--1.10.sql',
'pageinspect.control',
kwargs: contrib_data_args,
)
tests += {
'name': 'pageinspect',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': [
'page',
'btree',
'brin',
'gin',
'gist',
'hash',
'checksum',
'oldextversions',
],
},
}

View File

@ -0,0 +1,30 @@
passwordcheck_sources = files(
'passwordcheck.c',
)
passwordcheck_c_args = []
passwordcheck_deps = []
# uncomment the following two lines to enable cracklib support
# passwordcheck_c_args += ['-DUSE_CRACKLIB', '-DCRACKLIB_DICTPATH="/usr/lib/cracklib_dict"']
# passwordcheck_deps += [cc.find_library('crack')]
passwordcheck = shared_module('passwordcheck',
passwordcheck_sources,
c_args: passwordcheck_c_args,
kwargs: contrib_mod_args + {
'dependencies': contrib_mod_args.get('dependencies') + passwordcheck_deps,
}
)
contrib_targets += passwordcheck
tests += {
'name': 'passwordcheck',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': [
'passwordcheck',
],
},
}

View File

@ -0,0 +1,27 @@
pg_buffercache = shared_module('pg_buffercache',
files(
'pg_buffercache_pages.c',
),
kwargs: contrib_mod_args,
)
contrib_targets += pg_buffercache
install_data(
'pg_buffercache--1.0--1.1.sql',
'pg_buffercache--1.1--1.2.sql',
'pg_buffercache--1.2--1.3.sql',
'pg_buffercache--1.2.sql',
'pg_buffercache.control',
kwargs: contrib_data_args,
)
tests += {
'name': 'pg_buffercache',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': [
'pg_buffercache',
],
},
}

View File

@ -0,0 +1,29 @@
pg_freespacemap = shared_module('pg_freespacemap',
files(
'pg_freespacemap.c',
),
kwargs: contrib_mod_args,
)
contrib_targets += pg_freespacemap
install_data(
'pg_freespacemap--1.0--1.1.sql',
'pg_freespacemap--1.1--1.2.sql',
'pg_freespacemap--1.1.sql',
'pg_freespacemap.control',
kwargs: contrib_data_args,
)
tests += {
'name': 'pg_freespacemap',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': [
'pg_freespacemap',
],
'regress_args': [
'--temp-config', files('pg_freespacemap.conf')
],
},
}

View File

@ -0,0 +1,27 @@
pg_prewarm = shared_module('pg_prewarm',
files(
'autoprewarm.c',
'pg_prewarm.c',
),
kwargs: contrib_mod_args,
)
contrib_targets += pg_prewarm
install_data(
'pg_prewarm--1.0--1.1.sql',
'pg_prewarm--1.1--1.2.sql',
'pg_prewarm--1.1.sql',
'pg_prewarm.control',
kwargs: contrib_data_args,
)
tests += {
'name': 'pg_prewarm',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'tap': {
'tests': [
't/001_basic.pl',
],
},
}

View File

@ -0,0 +1,35 @@
pg_stat_statements = shared_module('pg_stat_statements',
files('pg_stat_statements.c'),
kwargs: contrib_mod_args + {
'dependencies': contrib_mod_args['dependencies'],
},
)
contrib_targets += pg_stat_statements
install_data(
'pg_stat_statements.control',
'pg_stat_statements--1.4.sql',
'pg_stat_statements--1.9--1.10.sql',
'pg_stat_statements--1.8--1.9.sql',
'pg_stat_statements--1.7--1.8.sql',
'pg_stat_statements--1.6--1.7.sql',
'pg_stat_statements--1.5--1.6.sql',
'pg_stat_statements--1.4--1.5.sql',
'pg_stat_statements--1.3--1.4.sql',
'pg_stat_statements--1.2--1.3.sql',
'pg_stat_statements--1.1--1.2.sql',
'pg_stat_statements--1.0--1.1.sql',
kwargs: contrib_data_args,
)
tests += {
'name': 'pg_stat_statements',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': [
'pg_stat_statements',
],
'regress_args': ['--temp-config', files('pg_stat_statements.conf')],
},
}

View File

@ -0,0 +1,25 @@
pg_surgery = shared_module('pg_surgery',
files(
'heap_surgery.c',
),
kwargs: contrib_mod_args,
)
contrib_targets += pg_surgery
install_data(
'pg_surgery--1.0.sql',
'pg_surgery.control',
kwargs: contrib_data_args,
)
tests += {
'name': 'pg_surgery',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': [
'heap_surgery',
],
},
}

View File

@ -0,0 +1,35 @@
pg_trgm = shared_module('pg_trgm',
files(
'trgm_gin.c',
'trgm_gist.c',
'trgm_op.c',
'trgm_regexp.c',
),
kwargs: contrib_mod_args,
)
contrib_targets += pg_trgm
install_data(
'pg_trgm--1.0--1.1.sql',
'pg_trgm--1.1--1.2.sql',
'pg_trgm--1.2--1.3.sql',
'pg_trgm--1.3--1.4.sql',
'pg_trgm--1.3.sql',
'pg_trgm--1.4--1.5.sql',
'pg_trgm--1.5--1.6.sql',
'pg_trgm.control',
kwargs: contrib_data_args,
)
tests += {
'name': 'pg_trgm',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': [
'pg_trgm',
'pg_word_trgm',
'pg_strict_word_trgm',
],
},
}

View File

@ -0,0 +1,26 @@
pg_visibility = shared_module('pg_visibility',
files(
'pg_visibility.c',
),
kwargs: contrib_mod_args,
)
contrib_targets += pg_visibility
install_data(
'pg_visibility--1.0--1.1.sql',
'pg_visibility--1.1--1.2.sql',
'pg_visibility--1.1.sql',
'pg_visibility.control',
kwargs: contrib_data_args,
)
tests += {
'name': 'pg_visibility',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': [
'pg_visibility',
],
},
}

View File

@ -0,0 +1,27 @@
pg_walinspect_sources = files('pg_walinspect.c')
pg_walinspect = shared_module('pg_walinspect',
pg_walinspect_sources,
kwargs: contrib_mod_args + {
'dependencies': contrib_mod_args['dependencies'],
},
)
contrib_targets += pg_walinspect
install_data(
'pg_walinspect.control',
'pg_walinspect--1.0.sql',
kwargs: contrib_data_args,
)
tests += {
'name': 'pg_walinspect',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': [
'pg_walinspect',
],
'regress_args': ['--temp-config', files('walinspect.conf')],
},
}

View File

@ -0,0 +1,100 @@
if not ssl.found()
subdir_done()
endif
pgcrypto_sources = files(
'crypt-blowfish.c',
'crypt-des.c',
'crypt-gensalt.c',
'crypt-md5.c',
'mbuf.c',
'pgcrypto.c',
'pgp-armor.c',
'pgp-cfb.c',
'pgp-compress.c',
'pgp-decrypt.c',
'pgp-encrypt.c',
'pgp-info.c',
'pgp-mpi.c',
'pgp-pgsql.c',
'pgp-pubdec.c',
'pgp-pubenc.c',
'pgp-pubkey.c',
'pgp-s2k.c',
'pgp.c',
'px-crypt.c',
'px-hmac.c',
'px.c',
)
pgcrypto_regress = [
'init',
'md5',
'sha1',
'hmac-md5',
'hmac-sha1',
'blowfish',
'rijndael',
'sha2',
'des',
'3des',
'cast5',
'crypt-des',
'crypt-md5',
'crypt-blowfish',
'crypt-xdes',
'pgp-armor',
'pgp-decrypt',
'pgp-encrypt',
'pgp-pubkey-decrypt',
'pgp-pubkey-encrypt',
'pgp-info',
]
pgcrypto_openssl_sources = files(
'openssl.c',
'pgp-mpi-openssl.c',
)
pgcrypto_deps = []
pgcrypto_link_with = []
pgcrypto_deps += ssl
pgcrypto_sources += pgcrypto_openssl_sources
if zlib.found()
pgcrypto_deps += zlib
pgcrypto_regress += 'pgp-compression'
else
pgcrypto_regress += 'pgp-zlib-DISABLED'
endif
pgcrypto = shared_module('pgcrypto',
pgcrypto_sources,
link_with: pgcrypto_link_with,
kwargs: contrib_mod_args + {
'dependencies': [pgcrypto_deps, contrib_mod_args['dependencies']]
},
)
contrib_targets += pgcrypto
install_data(
'pgcrypto--1.0--1.1.sql',
'pgcrypto--1.1--1.2.sql',
'pgcrypto--1.2--1.3.sql',
'pgcrypto--1.3.sql',
'pgcrypto.control',
kwargs: contrib_data_args,
)
tests += {
'name': 'pgcrypto',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': [
pgcrypto_regress,
],
},
}

View File

@ -0,0 +1,27 @@
pgrowlocks = shared_module('pgrowlocks',
files(
'pgrowlocks.c',
),
kwargs: contrib_mod_args,
)
contrib_targets += pgrowlocks
install_data(
'pgrowlocks--1.0--1.1.sql',
'pgrowlocks--1.1--1.2.sql',
'pgrowlocks--1.2.sql',
'pgrowlocks.control',
kwargs: contrib_data_args,
)
tests += {
'name': 'pgrowlocks',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'isolation': {
'specs': [
'pgrowlocks',
],
'regress_args': ['--load-extension=pgrowlocks'],
},
}

View File

@ -0,0 +1,31 @@
pgstattuple = shared_module('pgstattuple',
files(
'pgstatapprox.c',
'pgstatindex.c',
'pgstattuple.c',
),
kwargs: contrib_mod_args,
)
contrib_targets += pgstattuple
install_data(
'pgstattuple--1.0--1.1.sql',
'pgstattuple--1.1--1.2.sql',
'pgstattuple--1.2--1.3.sql',
'pgstattuple--1.3--1.4.sql',
'pgstattuple--1.4--1.5.sql',
'pgstattuple--1.4.sql',
'pgstattuple.control',
kwargs: contrib_data_args,
)
tests += {
'name': 'pgstattuple',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': [
'pgstattuple',
],
},
}

View File

@ -0,0 +1,34 @@
postgres_fdw_sources = files(
'connection.c',
'deparse.c',
'option.c',
'postgres_fdw.c',
'shippable.c',
)
postgres_fdw = shared_module('postgres_fdw',
postgres_fdw_sources,
kwargs: contrib_mod_args + {
'dependencies': contrib_mod_args['dependencies'] + [libpq],
},
)
contrib_targets += postgres_fdw
install_data(
'postgres_fdw.control',
'postgres_fdw--1.0.sql',
'postgres_fdw--1.0--1.1.sql',
kwargs: contrib_data_args,
)
tests += {
'name': 'postgres_fdw',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': [
'postgres_fdw',
],
'regress_args': ['--dlpath', meson.build_root() / 'src/test/regress'],
},
}

51
contrib/seg/meson.build Normal file
View File

@ -0,0 +1,51 @@
seg_sources = files(
'seg.c',
)
seg_scan = custom_target('segscan',
input: 'segscan.l',
output: 'segscan.c',
command: flex_cmd,
)
generated_sources += seg_scan
seg_sources += seg_scan
seg_parse = custom_target('segparse',
input: 'segparse.y',
kwargs: bison_kw,
)
generated_sources += seg_parse.to_list()
seg_sources += seg_parse
seg = shared_module('seg',
seg_sources,
include_directories: include_directories('.'),
kwargs: contrib_mod_args,
)
contrib_targets += seg
install_data(
'seg.control',
'seg--1.0--1.1.sql',
'seg--1.1--1.2.sql',
'seg--1.1.sql',
'seg--1.2--1.3.sql',
'seg--1.3--1.4.sql',
kwargs: contrib_data_args,
)
install_headers(
'segdata.h',
install_dir: dir_include_extension / 'seg',
)
tests += {
'name': 'seg',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': [
'seg',
],
},
}

View File

@ -0,0 +1,34 @@
if not selinux.found()
subdir_done()
endif
sepgsql_sources = files(
'database.c',
'dml.c',
'hooks.c',
'label.c',
'proc.c',
'relation.c',
'schema.c',
'selinux.c',
'uavc.c',
)
sepgsql = shared_module('sepgsql',
sepgsql_sources,
kwargs: contrib_mod_args + {
'dependencies': [selinux, contrib_mod_args['dependencies']],
}
)
contrib_targets += sepgsql
custom_target('sepgsql.sql',
input: 'sepgsql.sql.in',
output: 'sepgsql.sql',
command: [sed, '-e', 's,MODULE_PATHNAME,$libdir/sepgsql,g', '@INPUT@'],
capture: true,
install: true,
install_dir: contrib_data_args['install_dir'],
)
# TODO: implement sepgsql tests

50
contrib/spi/meson.build Normal file
View File

@ -0,0 +1,50 @@
autoinc = shared_module('autoinc',
['autoinc.c'],
kwargs: contrib_mod_args,
)
contrib_targets += autoinc
install_data('autoinc.control', 'autoinc--1.0.sql',
kwargs: contrib_data_args,
)
insert_username = shared_module('insert_username',
['insert_username.c'],
kwargs: contrib_mod_args,
)
contrib_targets += insert_username
install_data(
'insert_username.control',
'insert_username--1.0.sql',
kwargs: contrib_data_args,
)
moddatetime = shared_module('moddatetime',
['moddatetime.c'],
kwargs: contrib_mod_args,
)
contrib_targets += moddatetime
install_data(
'moddatetime.control',
'moddatetime--1.0.sql',
kwargs: contrib_data_args,
)
# this is needed for the regression tests;
# comment out if you want a quieter refint package for other uses
refint_cflags = ['-DREFINT_VERBOSE']
refint = shared_module('refint',
['refint.c'],
c_args: refint_cflags,
kwargs: contrib_mod_args,
)
contrib_targets += refint
install_data('refint.control', 'refint--1.0.sql',
kwargs: contrib_data_args,
)

View File

@ -0,0 +1,21 @@
if not ssl.found()
subdir_done()
endif
sslinfo = shared_module('sslinfo',
files(
'sslinfo.c',
),
kwargs: contrib_mod_args + {
'dependencies': [ssl, contrib_mod_args['dependencies']],
}
)
contrib_targets += sslinfo
install_data(
'sslinfo--1.0--1.1.sql',
'sslinfo--1.1--1.2.sql',
'sslinfo--1.2.sql',
'sslinfo.control',
kwargs: contrib_data_args,
)

View File

@ -0,0 +1,24 @@
tablefunc = shared_module('tablefunc',
files(
'tablefunc.c',
),
kwargs: contrib_mod_args,
)
contrib_targets += tablefunc
install_data(
'tablefunc--1.0.sql',
'tablefunc.control',
kwargs: contrib_data_args,
)
tests += {
'name': 'tablefunc',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': [
'tablefunc',
],
},
}

25
contrib/tcn/meson.build Normal file
View File

@ -0,0 +1,25 @@
tcn = shared_module('tcn',
files(
'tcn.c',
),
kwargs: contrib_mod_args,
)
contrib_targets += tcn
install_data(
'tcn--1.0.sql',
'tcn.control',
kwargs: contrib_data_args,
)
tests += {
'name': 'tcn',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'isolation': {
'specs': [
'tcn',
],
'regress_args': ['--load-extension=tcn'],
},
}

View File

@ -0,0 +1,63 @@
test_decoding_sources = files(
'test_decoding.c',
)
test_decoding = shared_module('test_decoding',
test_decoding_sources,
kwargs: contrib_mod_args,
)
contrib_targets += test_decoding
tests += {
'name': 'test_decoding',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': [
'ddl',
'xact',
'rewrite',
'toast',
'permissions',
'decoding_in_xact',
'decoding_into_rel',
'binary',
'prepared',
'replorigin',
'time',
'messages',
'spill',
'slot',
'truncate',
'stream',
'stats',
'twophase',
'twophase_stream',
],
'regress_args': [
'--temp-config', files('logical.conf'),
],
},
'isolation': {
'specs': [
'mxact',
'delayed_startup',
'ondisk_startup',
'concurrent_ddl_dml',
'oldest_xmin',
'snapshot_transfer',
'subxact_without_top',
'concurrent_stream',
'twophase_snapshot',
'slot_creation_error',
],
'regress_args': [
'--temp-config', files('logical.conf'),
],
},
'tap': {
'tests': [
't/001_repl_stats.pl',
],
},
}

View File

@ -0,0 +1,24 @@
tsm_system_rows = shared_module('tsm_system_rows',
files(
'tsm_system_rows.c',
),
kwargs: contrib_mod_args,
)
contrib_targets += tsm_system_rows
install_data(
'tsm_system_rows--1.0.sql',
'tsm_system_rows.control',
kwargs: contrib_data_args,
)
tests += {
'name': 'tsm_system_rows',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': [
'tsm_system_rows',
],
},
}

View File

@ -0,0 +1,24 @@
tsm_system_time = shared_module('tsm_system_time',
files(
'tsm_system_time.c',
),
kwargs: contrib_mod_args,
)
contrib_targets += tsm_system_time
install_data(
'tsm_system_time--1.0.sql',
'tsm_system_time.control',
kwargs: contrib_data_args,
)
tests += {
'name': 'tsm_system_time',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': [
'tsm_system_time',
],
},
}

View File

@ -0,0 +1,32 @@
unaccent = shared_module('unaccent',
files(
'unaccent.c',
),
kwargs: contrib_mod_args,
)
contrib_targets += unaccent
install_data(
'unaccent--1.0--1.1.sql',
'unaccent--1.1.sql',
'unaccent.control',
kwargs: contrib_data_args,
)
install_data(
'unaccent.rules',
install_dir: dir_data / 'tsearch_data'
)
# XXX: Implement downlo
tests += {
'name': 'unaccent',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': [
'unaccent',
],
'regress_args': ['--encoding=UTF8'],
},
}

View File

@ -0,0 +1,31 @@
if not uuid.found()
subdir_done()
endif
uuid_ossp = shared_module('uuid-ossp',
files(
'uuid-ossp.c',
),
kwargs: contrib_mod_args + {
'dependencies': [uuid, contrib_mod_args['dependencies']],
},
)
contrib_targets += uuid_ossp
install_data(
'uuid-ossp--1.0--1.1.sql',
'uuid-ossp--1.1.sql',
'uuid-ossp.control',
kwargs: contrib_data_args,
)
tests += {
'name': 'uuid-ossp',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': [
'uuid_ossp',
],
},
}

View File

@ -0,0 +1,17 @@
vacuumlo = executable('vacuumlo',
['vacuumlo.c'],
dependencies: [frontend_code, libpq],
kwargs: default_bin_args,
)
contrib_targets += vacuumlo
tests += {
'name': 'vacuumlo',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'tap': {
'tests': [
't/001_basic.pl',
],
},
}

32
contrib/xml2/meson.build Normal file
View File

@ -0,0 +1,32 @@
if not libxml.found()
subdir_done()
endif
xml2 = shared_module('pgxml',
files(
'xpath.c',
'xslt_proc.c',
),
kwargs: contrib_mod_args + {
'dependencies': [libxml, libxslt, contrib_mod_args['dependencies']],
},
)
contrib_targets += xml2
install_data(
'xml2--1.0--1.1.sql',
'xml2--1.1.sql',
'xml2.control',
kwargs: contrib_data_args,
)
tests += {
'name': 'xml2',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': [
'xml2',
],
},
}

254
doc/src/sgml/meson.build Normal file
View File

@ -0,0 +1,254 @@
docs = []
alldocs = []
doc_generated = []
xmllint = find_program(get_option('XMLLINT'), native: true, required: false)
version_sgml = configure_file(
input: 'version.sgml.in',
output: 'version.sgml',
configuration: cdata,
)
configure_files += version_sgml
doc_generated += custom_target('features-supported.sgml',
input: files(
'../../../src/backend/catalog/sql_feature_packages.txt',
'../../../src/backend/catalog/sql_features.txt',
),
output: 'features-supported.sgml',
command: [perl, files('mk_feature_tables.pl'), 'YES', '@INPUT@'],
build_by_default: false,
install: false,
capture: true,
)
doc_generated += custom_target('features-unsupported.sgml',
input: files(
'../../../src/backend/catalog/sql_feature_packages.txt',
'../../../src/backend/catalog/sql_features.txt',
),
output: 'features-unsupported.sgml',
command: [perl, files('mk_feature_tables.pl'), 'NO', '@INPUT@'],
build_by_default: false,
install: false,
capture: true,
)
doc_generated += custom_target('errcodes-table.sgml',
input: files(
'../../../src/backend/utils/errcodes.txt'),
output: 'errcodes-table.sgml',
command: [perl, files('generate-errcodes-table.pl'), '@INPUT@'],
build_by_default: false,
install: false,
capture: true,
)
# FIXME: this actually has further inputs, adding depfile support to
# generate-keywords-table.pl is probably the best way to address that
# robustly.
doc_generated += custom_target('keywords-table.sgml',
input: files(
'../../../src/include/parser/kwlist.h'),
output: 'keywords-table.sgml',
command: [perl, files('generate-keywords-table.pl'), '@CURRENT_SOURCE_DIR@'],
build_by_default: false,
install: false,
capture: true,
)
# For everything else we need at least xmllint
if not xmllint.found()
subdir_done()
endif
pandoc = find_program('pandoc', native: true, required: false)
xsltproc = find_program(get_option('XSLTPROC'), native: true, required: false)
fop = find_program('fop', native: true, required: false)
# Run validation only once, common to all subsequent targets. While
# we're at it, also resolve all entities (that is, copy all included
# files into one big file). This helps tools that don't understand
# vpath builds (such as dbtoepub).
postgres_full_xml = custom_target('postgres-full.xml',
input: 'postgres.sgml',
output: 'postgres-full.xml',
command: [xmllint, '--noent', '--valid', '--path', '@OUTDIR@', '-o', '@OUTPUT@', '@INPUT@'],
depends: doc_generated,
build_by_default: false,
)
docs += postgres_full_xml
alldocs += postgres_full_xml
#
# Full documentation as html, text
#
if xsltproc.found()
xsltproc_flags = [
'--stringparam', 'pg.version', pg_version,
'--param', 'website.stylesheet', '1'
]
# FIXME: Should use a wrapper around xsltproc --load-trace to compute a
# depfile
html = custom_target('html',
input: ['stylesheet.xsl', postgres_full_xml],
output: 'html',
depends: doc_generated,
command: [xsltproc, '-o', '@OUTDIR@/', xsltproc_flags, '@INPUT@'],
build_by_default: false,
)
alldocs += html
# build multi-page html docs as part of docs target
docs += html
html_help = custom_target('html_help',
input: ['stylesheet-hh.xsl', postgres_full_xml],
output: 'htmlhelp',
depends: doc_generated,
command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTDIR@/', xsltproc_flags, '@INPUT@'],
build_by_default: false,
)
alldocs += html_help
# single-page HTML
postgres_html = custom_target('postgres.html',
input: ['stylesheet-html-nochunk.xsl', postgres_full_xml],
output: 'postgres.html',
depends: doc_generated,
command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTPUT@', xsltproc_flags, '@INPUT@'],
build_by_default: false,
)
alldocs += postgres_html
# single-page text
if pandoc.found()
postgres_txt = custom_target('postgres.txt',
input: [postgres_html],
output: 'postgres.txt',
depends: doc_generated,
command: [pandoc, '-t', 'plain', '-o', '@OUTPUT@', '@INPUT@'],
build_by_default: false,
)
alldocs += postgres_txt
endif
endif
#
# INSTALL in html, text
#
if xsltproc.found()
install_xml = custom_target('INSTALL.xml',
input: ['standalone-profile.xsl', 'standalone-install.xml'],
output: 'INSTALL.xml',
depends: doc_generated + [postgres_full_xml],
command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTPUT@', xsltproc_flags, '--xinclude', '@INPUT@'],
build_by_default: false,
)
install_html = custom_target('INSTALL.html',
input: ['stylesheet-text.xsl', install_xml],
output: 'INSTALL.html',
command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTPUT@', xsltproc_flags, '@INPUT@'],
build_by_default: false,
)
alldocs += install_html
if pandoc.found()
# XXX: Makefile does an iconv translit here, but unclear why?
install = custom_target('INSTALL',
input: [install_html],
output: 'INSTALL',
command: [pandoc, '-t', 'plain', '-o', '@OUTPUT@', '@INPUT@'],
build_by_default: false,
)
alldocs += install
endif
endif
#
# Man pages
#
if xsltproc.found()
# FIXME: implement / consider sqlmansectnum logic
man = custom_target('man',
input: ['stylesheet-man.xsl', postgres_full_xml],
output: ['man1', 'man3', 'man7'],
depends: doc_generated,
command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTDIR@/', xsltproc_flags, '@INPUT@'],
build_by_default: false,
)
# build by default as part of docs target
docs += man
endif
#
# Full documentation as PDF
#
if fop.found() and xsltproc.found()
xsltproc_fo_flags = xsltproc_flags + ['--stringparam', 'img.src.path', meson.current_source_dir() + '/']
foreach format, detail: {'A4': 'A4', 'US': 'USletter'}
postgres_x_fo_f = 'postgres-@0@.fo'.format(format)
postgres_x_pdf_f = 'postgres-@0@.pdf'.format(format)
postgres_x_fo = custom_target(postgres_x_fo_f,
input: ['stylesheet-fo.xsl', postgres_full_xml],
output: [postgres_x_fo_f],
depends: doc_generated,
command: [xsltproc, '--path', '@OUTDIR@/', xsltproc_fo_flags,
'--stringparam', 'paper.type', detail,
'-o', '@OUTPUT@', '@INPUT@'],
build_by_default: false,
)
postgres_x_pdf = custom_target(postgres_x_pdf_f,
input: [postgres_x_fo],
output: [postgres_x_pdf_f],
command: [fop, '-fo', '@INPUT@', '-pdf', '@OUTPUT@'],
build_by_default: false,
)
alldocs += postgres_x_pdf
endforeach
endif
#
# epub
#
# This was previously implemented using dbtoepub - but that doesn't seem to
# support running in build != source directory (i.e. VPATH builds already
# weren't supported).
if pandoc.found() and xsltproc.found()
postgres_epub = custom_target('postgres.epub',
input: postgres_full_xml,
output: 'postgres.epub',
command: [pandoc, '-f', 'docbook', '-t', 'epub', '-o', '@OUTPUT@', '--resource-path=@CURRENT_SOURCE_DIR@',
'@INPUT@'],
build_by_default: false,
)
alldocs += postgres_epub
endif
if docs.length() == 0
run_target('docs', command: [missing, 'xsltproc'])
else
alias_target('docs', docs)
endif
if alldocs.length() == 0
run_target('alldocs', command: [missing, 'xsltproc'])
else
alias_target('alldocs', alldocs)
endif

View File

@ -0,0 +1,2 @@
<!ENTITY version @PG_VERSION@>
<!ENTITY majorversion @PG_MAJORVERSION@>

3025
meson.build Normal file

File diff suppressed because it is too large Load Diff

185
meson_options.txt Normal file
View File

@ -0,0 +1,185 @@
# Data layout influencing options
option('blocksize', type : 'combo',
choices : ['1', '2', '4', '8', '16', '32'],
value : '8',
description: 'set relation block size in kB')
option('wal_blocksize', type : 'combo',
choices: ['1', '2', '4', '8', '16', '32', '64'],
value: '8',
description : '''WAL block size, in kilobytes''')
option('segsize', type : 'integer', value : 1,
description : '''Segment size, in gigabytes''')
# Miscellaneous options
option('krb_srvnam', type : 'string', value : 'postgres',
description : '''Default Kerberos service principal for GSSAPI''')
option('system_tzdata', type: 'string', value: '',
description: 'use system time zone data in specified directory')
# Defaults
option('pgport', type : 'integer', value : 5432,
min: 1, max: 65535,
description : '''Default port number for server and clients''')
# Developer options
option('cassert', type : 'boolean', value: false,
description: 'enable assertion checks (for debugging)')
option('tap_tests', type : 'feature', value : 'auto',
description : 'Whether to enable tap tests')
option('PG_TEST_EXTRA', type : 'string', value: '',
description: 'Enable selected extra tests')
option('atomics', type : 'boolean', value: true,
description: 'whether to use atomic operations')
option('spinlocks', type : 'boolean', value: true,
description: 'whether to use spinlocks')
# Compilation options
option('extra_include_dirs', type : 'array', value: [],
description: 'non-default directories to be searched for headers')
option('extra_lib_dirs', type : 'array', value: [],
description: 'non-default directories to be searched for libs')
option('extra_version', type : 'string', value: '',
description: 'append STRING to the PostgreSQL version number')
option('darwin_sysroot', type : 'string', value: '',
description: 'select a non-default sysroot path')
# External dependencies
option('bonjour', type : 'feature', value: 'auto',
description: 'build with Bonjour support')
option('bsd_auth', type : 'feature', value: 'auto',
description: 'build with BSD Authentication support')
option('dtrace', type : 'feature', value: 'disabled',
description: 'DTrace support')
option('gssapi', type : 'feature', value: 'auto',
description: 'GSSAPI support')
option('icu', type : 'feature', value: 'auto',
description: 'ICU support')
option('ldap', type : 'feature', value: 'auto',
description: 'LDAP support')
option('libedit_preferred', type : 'boolean', value: false,
description: 'Prefer BSD Libedit over GNU Readline')
option('libxml', type : 'feature', value: 'auto',
description: 'XML support')
option('libxslt', type : 'feature', value: 'auto',
description: 'XSLT support in contrib/xml2')
option('llvm', type : 'feature', value: 'disabled',
description: 'whether to use llvm')
option('lz4', type : 'feature', value: 'auto',
description: 'LZ4 support')
option('nls', type: 'feature', value: 'auto',
description: 'native language support')
option('pam', type : 'feature', value: 'auto',
description: 'build with PAM support')
option('plperl', type : 'feature', value: 'auto',
description: 'build Perl modules (PL/Perl)')
option('plpython', type : 'feature', value: 'auto',
description: 'build Python modules (PL/Python)')
option('pltcl', type : 'feature', value: 'auto',
description: 'build with TCL support')
option('tcl_version', type : 'string', value : 'tcl',
description: 'specify TCL version')
option('readline', type : 'feature', value : 'auto',
description: 'use GNU Readline or BSD Libedit for editing')
option('selinux', type : 'feature', value : 'disabled',
description: 'build with SELinux support')
option('ssl', type : 'combo', choices : ['none', 'openssl'],
value : 'none',
description: 'use LIB for SSL/TLS support (openssl)')
option('systemd', type : 'feature', value: 'auto',
description: 'build with systemd support')
option('uuid', type : 'combo', choices : ['none', 'bsd', 'e2fs', 'ossp'],
value : 'none',
description: 'build contrib/uuid-ossp using LIB')
option('zlib', type : 'feature', value: 'auto',
description: 'whether to use zlib')
option('zstd', type : 'feature', value: 'auto',
description: 'whether to use zstd')
# Programs
option('BISON', type : 'array', value: ['bison', 'win_bison'],
description: 'path to bison binary')
option('DTRACE', type : 'string', value: 'dtrace',
description: 'path to dtrace binary')
option('FLEX', type : 'array', value: ['flex', 'win_flex'],
description: 'path to flex binary')
option('GZIP', type : 'string', value: 'gzip',
description: 'path to gzip binary')
option('LZ4', type : 'string', value: 'lz4',
description: 'path to lz4 binary')
option('PERL', type : 'string', value: 'perl',
description: 'path to perl binary')
option('PROVE', type : 'string', value: 'prove',
description: 'path to prove binary')
option('PYTHON', type : 'array', value: ['python3', 'python'],
description: 'path to python binary')
option('SED', type : 'string', value: 'gsed',
description: 'path to sed binary')
option('TAR', type : 'string', value: 'tar',
description: 'path to tar binary')
option('XMLLINT', type : 'string', value: 'xmllint',
description: 'path to xmllint binary')
option('XSLTPROC', type : 'string', value: 'xsltproc',
description: 'path to xsltproc binary')
option('ZSTD', type : 'string', value: 'zstd',
description: 'path to zstd binary')
option('ZIC', type : 'string', value: 'zic',
description: 'path to zic binary, when cross-compiling')

View File

@ -0,0 +1,12 @@
backend_sources += files(
'brin.c',
'brin_bloom.c',
'brin_inclusion.c',
'brin_minmax.c',
'brin_minmax_multi.c',
'brin_pageops.c',
'brin_revmap.c',
'brin_tuple.c',
'brin_validate.c',
'brin_xlog.c',
)

View File

@ -0,0 +1,18 @@
backend_sources += files(
'attmap.c',
'bufmask.c',
'detoast.c',
'heaptuple.c',
'indextuple.c',
'printsimple.c',
'printtup.c',
'relation.c',
'reloptions.c',
'scankey.c',
'session.c',
'syncscan.c',
'toast_compression.c',
'toast_internals.c',
'tupconvert.c',
'tupdesc.c',
)

View File

@ -0,0 +1,17 @@
backend_sources += files(
'ginarrayproc.c',
'ginbtree.c',
'ginbulk.c',
'gindatapage.c',
'ginentrypage.c',
'ginfast.c',
'ginget.c',
'gininsert.c',
'ginlogic.c',
'ginpostinglist.c',
'ginscan.c',
'ginutil.c',
'ginvacuum.c',
'ginvalidate.c',
'ginxlog.c',
)

View File

@ -0,0 +1,13 @@
backend_sources += files(
'gist.c',
'gistbuild.c',
'gistbuildbuffers.c',
'gistget.c',
'gistproc.c',
'gistscan.c',
'gistsplit.c',
'gistutil.c',
'gistvacuum.c',
'gistvalidate.c',
'gistxlog.c',
)

View File

@ -0,0 +1,12 @@
backend_sources += files(
'hash.c',
'hash_xlog.c',
'hashfunc.c',
'hashinsert.c',
'hashovfl.c',
'hashpage.c',
'hashsearch.c',
'hashsort.c',
'hashutil.c',
'hashvalidate.c',
)

View File

@ -0,0 +1,11 @@
backend_sources += files(
'heapam.c',
'heapam_handler.c',
'heapam_visibility.c',
'heaptoast.c',
'hio.c',
'pruneheap.c',
'rewriteheap.c',
'vacuumlazy.c',
'visibilitymap.c',
)

View File

@ -0,0 +1,6 @@
backend_sources += files(
'amapi.c',
'amvalidate.c',
'genam.c',
'indexam.c',
)

View File

@ -0,0 +1,13 @@
subdir('brin')
subdir('common')
subdir('gin')
subdir('gist')
subdir('hash')
subdir('heap')
subdir('index')
subdir('nbtree')
subdir('rmgrdesc')
subdir('spgist')
subdir('table')
subdir('tablesample')
subdir('transam')

View File

@ -0,0 +1,13 @@
backend_sources += files(
'nbtcompare.c',
'nbtdedup.c',
'nbtinsert.c',
'nbtpage.c',
'nbtree.c',
'nbtsearch.c',
'nbtsort.c',
'nbtsplitloc.c',
'nbtutils.c',
'nbtvalidate.c',
'nbtxlog.c',
)

View File

@ -0,0 +1,26 @@
# used by frontend programs like pg_waldump
rmgr_desc_sources = files(
'brindesc.c',
'clogdesc.c',
'committsdesc.c',
'dbasedesc.c',
'genericdesc.c',
'gindesc.c',
'gistdesc.c',
'hashdesc.c',
'heapdesc.c',
'logicalmsgdesc.c',
'mxactdesc.c',
'nbtdesc.c',
'relmapdesc.c',
'replorigindesc.c',
'seqdesc.c',
'smgrdesc.c',
'spgdesc.c',
'standbydesc.c',
'tblspcdesc.c',
'xactdesc.c',
'xlogdesc.c',
)
backend_sources += rmgr_desc_sources

View File

@ -0,0 +1,13 @@
backend_sources += files(
'spgdoinsert.c',
'spginsert.c',
'spgkdtreeproc.c',
'spgproc.c',
'spgquadtreeproc.c',
'spgscan.c',
'spgtextproc.c',
'spgutils.c',
'spgvacuum.c',
'spgvalidate.c',
'spgxlog.c',
)

View File

@ -0,0 +1,6 @@
backend_sources += files(
'table.c',
'tableam.c',
'tableamapi.c',
'toast_helper.c',
)

View File

@ -0,0 +1,5 @@
backend_sources += files(
'bernoulli.c',
'system.c',
'tablesample.c',
)

View File

@ -0,0 +1,31 @@
backend_sources += files(
'clog.c',
'commit_ts.c',
'generic_xlog.c',
'multixact.c',
'parallel.c',
'rmgr.c',
'slru.c',
'subtrans.c',
'timeline.c',
'transam.c',
'twophase.c',
'twophase_rmgr.c',
'varsup.c',
'xact.c',
'xlog.c',
'xlogarchive.c',
'xlogfuncs.c',
'xloginsert.c',
'xlogprefetcher.c',
'xlogrecovery.c',
'xlogstats.c',
'xlogutils.c',
)
# used by frontend programs to build a frontend xlogreader
xlogreader_sources = files(
'xlogreader.c',
)
backend_sources += xlogreader_sources

View File

@ -0,0 +1,13 @@
backend_sources += files(
'backup_manifest.c',
'basebackup.c',
'basebackup_copy.c',
'basebackup_gzip.c',
'basebackup_lz4.c',
'basebackup_progress.c',
'basebackup_server.c',
'basebackup_sink.c',
'basebackup_target.c',
'basebackup_throttle.c',
'basebackup_zstd.c',
)

View File

@ -0,0 +1,28 @@
backend_sources += files(
'bootstrap.c')
# see ../parser/meson.build
boot_parser_sources = []
bootscanner = custom_target('bootscanner',
input: 'bootscanner.l',
output: 'bootscanner.c',
command: flex_cmd,
)
generated_sources += bootscanner
boot_parser_sources += bootscanner
bootparse = custom_target('bootparse',
input: 'bootparse.y',
kwargs: bison_kw,
)
generated_sources += bootparse.to_list()
boot_parser_sources += bootparse
boot_parser = static_library('boot_parser',
boot_parser_sources,
dependencies: [backend_code],
include_directories: include_directories('.'),
kwargs: internal_lib_args,
)
backend_link_with += boot_parser

View File

@ -0,0 +1,44 @@
backend_sources += files(
'aclchk.c',
'catalog.c',
'dependency.c',
'heap.c',
'index.c',
'indexing.c',
'namespace.c',
'objectaccess.c',
'objectaddress.c',
'partition.c',
'pg_aggregate.c',
'pg_attrdef.c',
'pg_cast.c',
'pg_class.c',
'pg_collation.c',
'pg_constraint.c',
'pg_conversion.c',
'pg_db_role_setting.c',
'pg_depend.c',
'pg_enum.c',
'pg_inherits.c',
'pg_largeobject.c',
'pg_namespace.c',
'pg_operator.c',
'pg_parameter_acl.c',
'pg_proc.c',
'pg_publication.c',
'pg_range.c',
'pg_shdepend.c',
'pg_subscription.c',
'pg_type.c',
'storage.c',
'toasting.c',
)
install_data(
'information_schema.sql',
'sql_features.txt',
'system_functions.sql',
'system_views.sql',
install_dir: dir_data,
)

View File

@ -0,0 +1,51 @@
backend_sources += files(
'aggregatecmds.c',
'alter.c',
'amcmds.c',
'analyze.c',
'async.c',
'cluster.c',
'collationcmds.c',
'comment.c',
'constraint.c',
'conversioncmds.c',
'copy.c',
'copyfrom.c',
'copyfromparse.c',
'copyto.c',
'createas.c',
'dbcommands.c',
'define.c',
'discard.c',
'dropcmds.c',
'event_trigger.c',
'explain.c',
'extension.c',
'foreigncmds.c',
'functioncmds.c',
'indexcmds.c',
'lockcmds.c',
'matview.c',
'opclasscmds.c',
'operatorcmds.c',
'policy.c',
'portalcmds.c',
'prepare.c',
'proclang.c',
'publicationcmds.c',
'schemacmds.c',
'seclabel.c',
'sequence.c',
'statscmds.c',
'subscriptioncmds.c',
'tablecmds.c',
'tablespace.c',
'trigger.c',
'tsearchcmds.c',
'typecmds.c',
'user.c',
'vacuum.c',
'vacuumparallel.c',
'variable.c',
'view.c',
)

View File

@ -0,0 +1,67 @@
backend_sources += files(
'execAmi.c',
'execAsync.c',
'execCurrent.c',
'execExpr.c',
'execExprInterp.c',
'execGrouping.c',
'execIndexing.c',
'execJunk.c',
'execMain.c',
'execParallel.c',
'execPartition.c',
'execProcnode.c',
'execReplication.c',
'execSRF.c',
'execScan.c',
'execTuples.c',
'execUtils.c',
'functions.c',
'instrument.c',
'nodeAgg.c',
'nodeAppend.c',
'nodeBitmapAnd.c',
'nodeBitmapHeapscan.c',
'nodeBitmapIndexscan.c',
'nodeBitmapOr.c',
'nodeCtescan.c',
'nodeCustom.c',
'nodeForeignscan.c',
'nodeFunctionscan.c',
'nodeGather.c',
'nodeGatherMerge.c',
'nodeGroup.c',
'nodeHash.c',
'nodeHashjoin.c',
'nodeIncrementalSort.c',
'nodeIndexonlyscan.c',
'nodeIndexscan.c',
'nodeLimit.c',
'nodeLockRows.c',
'nodeMaterial.c',
'nodeMemoize.c',
'nodeMergeAppend.c',
'nodeMergejoin.c',
'nodeModifyTable.c',
'nodeNamedtuplestorescan.c',
'nodeNestloop.c',
'nodeProjectSet.c',
'nodeRecursiveunion.c',
'nodeResult.c',
'nodeSamplescan.c',
'nodeSeqscan.c',
'nodeSetOp.c',
'nodeSort.c',
'nodeSubplan.c',
'nodeSubqueryscan.c',
'nodeTableFuncscan.c',
'nodeTidrangescan.c',
'nodeTidscan.c',
'nodeUnique.c',
'nodeValuesscan.c',
'nodeWindowAgg.c',
'nodeWorktablescan.c',
'spi.c',
'tqueue.c',
'tstoreReceiver.c',
)

View File

@ -0,0 +1,3 @@
backend_sources += files(
'foreign.c'
)

View File

@ -0,0 +1,73 @@
if not llvm.found()
subdir_done()
endif
# Build LLVM JIT backend module
llvmjit_sources = []
# Infrastructure
llvmjit_sources += files(
'llvmjit.c',
'llvmjit_error.cpp',
'llvmjit_inline.cpp',
'llvmjit_wrap.cpp',
)
# Code generation
llvmjit_sources += files(
'llvmjit_deform.c',
'llvmjit_expr.c',
)
llvmjit = shared_module('llvmjit',
llvmjit_sources,
kwargs: pg_mod_args + {
'dependencies': pg_mod_args['dependencies'] + [llvm],
}
)
backend_targets += llvmjit
# Define a few bits and pieces used here and elsewhere to generate bitcode
llvm_irgen_args = [
'-c', '-o', '@OUTPUT@', '@INPUT@',
'-flto=thin', '-emit-llvm',
'-MD', '-MQ', '@OUTPUT@', '-MF', '@DEPFILE@',
'-O2',
'-Wno-ignored-attributes',
'-Wno-empty-body',
]
if ccache.found()
llvm_irgen_command = ccache
llvm_irgen_args = [clang.path()] + llvm_irgen_args
else
llvm_irgen_command = clang
endif
# XXX: Need to determine proper version of the function cflags for clang
bitcode_cflags = ['-fno-strict-aliasing', '-fwrapv']
bitcode_cflags += cppflags
# XXX: Worth improving on the logic to find directories here
bitcode_cflags += '-I@BUILD_ROOT@/src/include'
bitcode_cflags += '-I@BUILD_ROOT@/src/backend/utils/misc'
bitcode_cflags += '-I@SOURCE_ROOT@/src/include'
# Note this is intentionally not installed to bitcodedir, as it's not for
# inlining
llvmjit_types = custom_target('llvmjit_types.bc',
command: [llvm_irgen_command] + llvm_irgen_args + bitcode_cflags,
input: 'llvmjit_types.c',
output: 'llvmjit_types.bc',
depends: [postgres],
install: true,
install_dir: dir_lib_pkg,
depfile: '@BASENAME@.c.bc.d',
)
backend_targets += llvmjit_types

View File

@ -0,0 +1,3 @@
backend_sources += files(
'jit.c'
)

View File

@ -0,0 +1,12 @@
backend_sources += files(
'binaryheap.c',
'bipartite_match.c',
'bloomfilter.c',
'dshash.c',
'hyperloglog.c',
'ilist.c',
'integerset.c',
'knapsack.c',
'pairingheap.c',
'rbtree.c',
)

View File

@ -0,0 +1,32 @@
backend_sources += files(
'auth-sasl.c',
'auth-scram.c',
'auth.c',
'be-fsstubs.c',
'be-secure-common.c',
'be-secure.c',
'crypt.c',
'hba.c',
'ifaddr.c',
'pqcomm.c',
'pqformat.c',
'pqmq.c',
'pqsignal.c',
)
if ssl.found()
backend_sources += files('be-secure-openssl.c')
endif
if gssapi.found()
backend_sources += files(
'be-secure-gssapi.c',
'be-gssapi-common.c'
)
endif
install_data(
'pg_hba.conf.sample',
'pg_ident.conf.sample',
install_dir: dir_data,
)

View File

@ -0,0 +1,2 @@
main_file = files('main.c')
backend_sources += main_file

190
src/backend/meson.build Normal file
View File

@ -0,0 +1,190 @@
backend_build_deps = [backend_code]
backend_sources = []
backend_link_with = [pgport_srv, common_srv]
generated_backend_sources = []
subdir('access')
subdir('backup')
subdir('bootstrap')
subdir('catalog')
subdir('commands')
subdir('executor')
subdir('foreign')
subdir('jit')
subdir('lib')
subdir('libpq')
subdir('main')
subdir('nodes')
subdir('optimizer')
subdir('parser')
subdir('partitioning')
subdir('port')
subdir('postmaster')
subdir('regex')
subdir('replication')
subdir('rewrite')
subdir('statistics')
subdir('storage')
subdir('tcop')
subdir('tsearch')
subdir('utils')
subdir('po', if_found: libintl)
backend_link_args = []
backend_link_depends = []
# On windows when compiling with msvc we need to make postgres export all its
# symbols so that extension libraries can use them. For that we need to scan
# the constituting objects and generate a file specifying all the functions as
# exported (variables need an "import" declaration in the header, hence
# PGDLLEXPORT, but functions work without that, due to import libraries
# basically being trampolines).
#
# For dtrace probes we need to invoke dtrace on all input files, before
# linking the final executable (see more below).
#
#
# On meson there's currently no easy way to do this that I found. So we build
# a static library with all the input objects, run our script to generate
# exports, and build the final executable using that static library
#
# We could do that only if either dtrace or msvc is in use, but it seems
# easier to just always do so.
#
# Can't name the static library 'postgres', because msbuild ends up with a
# conflict for the .pdb file otherwise.
postgres_lib = static_library('postgres_lib',
backend_sources + timezone_sources + generated_backend_sources,
link_whole: backend_link_with,
dependencies: backend_build_deps,
kwargs: internal_lib_args,
)
if cc.get_id() == 'msvc'
postgres_def = custom_target('postgres.def',
command: [perl, files('../tools/msvc/gendef.pl'),
'--arch', host_cpu,
'--tempdir', '@PRIVATE_DIR@',
'--deffile', '@OUTPUT@',
'@INPUT@'],
input: [postgres_lib, common_srv, pgport_srv],
output: 'postgres.def',
depends: [postgres_lib, common_srv, pgport_srv],
install: false,
build_by_default: false,
)
backend_link_args += '/DEF:@0@'.format(postgres_def.full_path())
backend_link_depends += postgres_def
elif host_system == 'aix'
# The '.' argument leads mkldexport.sh to emit "#! .", which refers to the
# main executable, allowing extension libraries to resolve their undefined
# symbols to symbols in the postgres binary.
postgres_imp = custom_target('postgres.imp',
command: [files('port/aix/mkldexport.sh'), '@INPUT@', '.'],
input: postgres_lib,
output: 'postgres.imp',
capture: true,
install: true,
install_dir: dir_lib,
build_by_default: false,
)
backend_link_args += '-Wl,-bE:@0@'.format(postgres_imp.full_path())
backend_link_depends += postgres_imp
endif
backend_input = []
backend_objs = [postgres_lib.extract_all_objects(recursive: false)]
# As of 1/2010:
# The probes.o file is necessary for dtrace support on Solaris, and on recent
# versions of systemtap. (Older systemtap releases just produce an empty
# file, but that's okay.) However, macOS's dtrace doesn't use it and doesn't
# even recognize the -G option. So, build probes.o except on macOS.
# This might need adjustment as other platforms add dtrace support.
#
# On at least linux we don't actually need to pass in all the objects, but
# at least on FreeBSD and Solaris we have to.
#
# XXX: The reason we don't use the objects for generated sources is that
# hits a meson bug. Luckily we don't don't have probes in generated
# sources...
if dtrace.found() and host_system != 'darwin'
backend_input += custom_target(
'probes.o',
input: ['utils/probes.d', postgres_lib.extract_objects(backend_sources, timezone_sources)],
output: 'probes.o',
command: [dtrace, '-C', '-G', '-o', '@OUTPUT@', '-s', '@INPUT@'],
install: false,
)
endif
postgres = executable('postgres',
backend_input,
objects: backend_objs,
link_args: backend_link_args,
link_with: backend_link_with,
link_depends: backend_link_depends,
export_dynamic: true,
implib: true,
dependencies: backend_build_deps,
kwargs: default_bin_args,
)
backend_targets += postgres
pg_mod_c_args = cflags_mod
pg_mod_cpp_args = cxxflags_mod
pg_mod_link_args = ldflags_sl + ldflags_mod
pg_mod_link_depend = []
# A few platforms like MacOS and Windows link shared modules against postgres,
# or a [import] library derived from it. Set up the link flags for that.
if mod_link_args_fmt.length() > 0
# To avoid unnecessary build-time dependencies on other operating systems,
# only the dependency when it when necessary.
pg_mod_link_depend += postgres
name = mod_link_with_name.format('postgres')
link_with_uninst = meson.current_build_dir() / name
link_with_inst = '${@0@}/@1@'.format(mod_link_with_dir, name)
foreach el : mod_link_args_fmt
pg_mod_link_args += el.format(link_with_uninst)
endforeach
endif
# Note there's intentionally no dependency on pgport/common here - we want the
# symbols from the main binary for extension modules, rather than the
# extension linking separately to pgport/common.
backend_mod_code = declare_dependency(
compile_args: pg_mod_c_args,
include_directories: postgres_inc,
link_args: pg_mod_link_args,
sources: generated_headers + generated_backend_headers,
dependencies: backend_mod_deps,
)
pg_mod_args = default_mod_args + {
'dependencies': [backend_mod_code],
'cpp_args': pg_mod_cpp_args,
'link_depends': pg_mod_link_depend,
}
# Shared modules that, on some system, link against the server binary. Only
# enter these after we defined the server build.
subdir('jit/llvm')
subdir('replication/libpqwalreceiver')
subdir('replication/pgoutput')
subdir('snowball')
subdir('utils/mb/conversion_procs')

View File

@ -0,0 +1,29 @@
backend_sources += files(
'bitmapset.c',
'extensible.c',
'list.c',
'makefuncs.c',
'nodeFuncs.c',
'nodes.c',
'params.c',
'print.c',
'read.c',
'tidbitmap.c',
'value.c',
)
# these include .c files generated in ../../include/nodes, seems nicer to not
# add that as an include path for the whole backend
nodefunc_sources = files(
'copyfuncs.c',
'equalfuncs.c',
'outfuncs.c',
'readfuncs.c',
)
nodefuncs = static_library('nodefuncs',
nodefunc_sources,
dependencies: [backend_code],
include_directories: include_directories('../../include/nodes'),
kwargs: internal_lib_args,
)
backend_link_with += nodefuncs

View File

@ -0,0 +1,17 @@
backend_sources += files(
'geqo_copy.c',
'geqo_cx.c',
'geqo_erx.c',
'geqo_eval.c',
'geqo_main.c',
'geqo_misc.c',
'geqo_mutation.c',
'geqo_ox1.c',
'geqo_ox2.c',
'geqo_pmx.c',
'geqo_pool.c',
'geqo_px.c',
'geqo_random.c',
'geqo_recombination.c',
'geqo_selection.c',
)

View File

@ -0,0 +1,5 @@
subdir('geqo')
subdir('path')
subdir('plan')
subdir('prep')
subdir('util')

View File

@ -0,0 +1,11 @@
backend_sources += files(
'allpaths.c',
'clausesel.c',
'costsize.c',
'equivclass.c',
'indxpath.c',
'joinpath.c',
'joinrels.c',
'pathkeys.c',
'tidpath.c',
)

View File

@ -0,0 +1,10 @@
backend_sources += files(
'analyzejoins.c',
'createplan.c',
'initsplan.c',
'planagg.c',
'planmain.c',
'planner.c',
'setrefs.c',
'subselect.c',
)

View File

@ -0,0 +1,7 @@
backend_sources += files(
'prepagg.c',
'prepjointree.c',
'prepqual.c',
'preptlist.c',
'prepunion.c',
)

View File

@ -0,0 +1,16 @@
backend_sources += files(
'appendinfo.c',
'clauses.c',
'inherit.c',
'joininfo.c',
'orclauses.c',
'paramassign.c',
'pathnode.c',
'placeholder.c',
'plancat.c',
'predtest.c',
'relnode.c',
'restrictinfo.c',
'tlist.c',
'var.c',
)

View File

@ -0,0 +1,48 @@
backend_sources += files(
'analyze.c',
'parse_agg.c',
'parse_clause.c',
'parse_coerce.c',
'parse_collate.c',
'parse_cte.c',
'parse_enr.c',
'parse_expr.c',
'parse_func.c',
'parse_merge.c',
'parse_node.c',
'parse_oper.c',
'parse_param.c',
'parse_relation.c',
'parse_target.c',
'parse_type.c',
'parse_utilcmd.c',
'scansup.c',
)
# Build a small utility static lib for the parser. The generation of the
# parser is slow, and building this separately avoids other parts of the
# backend having to wait till gram.h is generated.
parser_sources = files('parser.c')
backend_scanner = custom_target('scan',
input: 'scan.l',
output: 'scan.c',
command: [flex_cmd, '--no-backup', '--fix-warnings', '--', '-CF', '-p', '-p'],
)
generated_sources += backend_scanner
parser_sources += backend_scanner
backend_parser = custom_target('gram',
input: 'gram.y',
kwargs: bison_kw,
)
generated_sources += backend_parser.to_list()
parser_sources += backend_parser
parser = static_library('parser',
parser_sources,
dependencies: [backend_code],
include_directories: include_directories('.'),
kwargs: internal_lib_args,
)
backend_link_with += parser

Some files were not shown because too many files have changed in this diff Show More