Skip to content

Commit e692727

Browse files
committed
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 <[email protected]> Author: Nazir Bilal Yavuz <[email protected]> Author: Peter Eisentraut <[email protected]> Reviewed-By: Peter Eisentraut <[email protected]> Discussion: https://postgr.es/m/[email protected]
1 parent fbb5f54 commit e692727

File tree

265 files changed

+10962
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

265 files changed

+10962
-0
lines changed

config/meson.build

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
install_data(
2+
'install-sh', 'missing',
3+
install_dir: dir_pgxs / 'config'
4+
)

configure

+6
Original file line numberDiff line numberDiff line change
@@ -20658,3 +20658,9 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
2065820658
$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
2065920659
fi
2066020660

20661+
20662+
# Ensure that any meson build directories would reconfigure and see that
20663+
# there's a conflicting in-tree build and can error out.
20664+
if test "$vpath_build"="no"; then
20665+
touch meson.build
20666+
fi

configure.ac

+6
Original file line numberDiff line numberDiff line change
@@ -2472,3 +2472,9 @@ AC_CONFIG_HEADERS([src/interfaces/ecpg/include/ecpg_config.h],
24722472
[echo >src/interfaces/ecpg/include/stamp-h])
24732473

24742474
AC_OUTPUT
2475+
2476+
# Ensure that any meson build directories would reconfigure and see that
2477+
# there's a conflicting in-tree build and can error out.
2478+
if test "$vpath_build"="no"; then
2479+
touch meson.build
2480+
fi

contrib/adminpack/meson.build

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
adminpack = shared_module('adminpack',
2+
['adminpack.c'],
3+
kwargs: contrib_mod_args,
4+
)
5+
contrib_targets += adminpack
6+
7+
install_data(
8+
'adminpack.control',
9+
'adminpack--1.0.sql',
10+
'adminpack--1.0--1.1.sql',
11+
'adminpack--1.1--2.0.sql',
12+
'adminpack--2.0--2.1.sql',
13+
kwargs: contrib_data_args,
14+
)
15+
16+
tests += {
17+
'name': 'adminpack',
18+
'sd': meson.current_source_dir(),
19+
'bd': meson.current_build_dir(),
20+
'regress': {
21+
'sql': ['adminpack'],
22+
},
23+
}

contrib/amcheck/meson.build

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
amcheck = shared_module('amcheck', [
2+
'verify_heapam.c',
3+
'verify_nbtree.c',
4+
],
5+
kwargs: contrib_mod_args,
6+
)
7+
contrib_targets += amcheck
8+
9+
install_data(
10+
'amcheck.control',
11+
'amcheck--1.0.sql',
12+
'amcheck--1.0--1.1.sql',
13+
'amcheck--1.1--1.2.sql',
14+
'amcheck--1.2--1.3.sql',
15+
kwargs: contrib_data_args,
16+
)
17+
18+
tests += {
19+
'name': 'amcheck',
20+
'sd': meson.current_source_dir(),
21+
'bd': meson.current_build_dir(),
22+
'regress': {
23+
'sql': [
24+
'check',
25+
'check_btree',
26+
'check_heap',
27+
],
28+
},
29+
'tap': {
30+
'tests': [
31+
't/001_verify_heapam.pl',
32+
't/002_cic.pl',
33+
't/003_cic_2pc.pl',
34+
],
35+
},
36+
}
37+

contrib/auth_delay/meson.build

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
autoinc = shared_module('auth_delay',
2+
['auth_delay.c'],
3+
kwargs: contrib_mod_args,
4+
)
5+
contrib_targets += autoinc

contrib/auto_explain/meson.build

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
auto_explain = shared_module('auto_explain',
2+
files('auto_explain.c'),
3+
kwargs: contrib_mod_args,
4+
)
5+
contrib_targets += auto_explain
6+
7+
tests += {
8+
'name': 'auto_explain',
9+
'sd': meson.current_source_dir(),
10+
'bd': meson.current_build_dir(),
11+
'tap': {
12+
'tests': [
13+
't/001_auto_explain.pl',
14+
],
15+
},
16+
}
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
basebackup_to_shell_sources = files(
2+
'basebackup_to_shell.c',
3+
)
4+
5+
basebackup_to_shell = shared_module('basebackup_to_shell',
6+
basebackup_to_shell_sources,
7+
kwargs: contrib_mod_args,
8+
)
9+
contrib_targets += basebackup_to_shell
10+
11+
tests += {
12+
'name': 'basebackup_to_shell',
13+
'sd': meson.current_source_dir(),
14+
'bd': meson.current_build_dir(),
15+
'tap': {
16+
'tests': [
17+
't/001_basic.pl',
18+
],
19+
'env': {'GZIP_PROGRAM': gzip.path(),
20+
'TAR': tar.path()},
21+
},
22+
}

contrib/basic_archive/meson.build

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
basic_archive_sources = files(
2+
'basic_archive.c',
3+
)
4+
5+
basic_archive = shared_module('basic_archive',
6+
basic_archive_sources,
7+
kwargs: contrib_mod_args,
8+
)
9+
contrib_targets += basic_archive
10+
11+
tests += {
12+
'name': 'basic_archive',
13+
'sd': meson.current_source_dir(),
14+
'bd': meson.current_build_dir(),
15+
'regress': {
16+
'sql': [
17+
'basic_archive',
18+
],
19+
'regress_args': [
20+
'--temp-config', files('basic_archive.conf'),
21+
],
22+
},
23+
}

contrib/bloom/meson.build

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
bloom_sources = files(
2+
'blcost.c',
3+
'blinsert.c',
4+
'blscan.c',
5+
'blutils.c',
6+
'blvacuum.c',
7+
'blvalidate.c',
8+
)
9+
10+
bloom = shared_module('bloom',
11+
bloom_sources,
12+
kwargs: contrib_mod_args,
13+
)
14+
contrib_targets += bloom
15+
16+
install_data(
17+
'bloom.control',
18+
'bloom--1.0.sql',
19+
kwargs: contrib_data_args,
20+
)
21+
22+
tests += {
23+
'name': 'bloom',
24+
'sd': meson.current_source_dir(),
25+
'bd': meson.current_build_dir(),
26+
'regress': {
27+
'sql': [
28+
'bloom',
29+
],
30+
},
31+
'tap': {
32+
'tests': [
33+
't/001_wal.pl',
34+
],
35+
},
36+
}

contrib/bool_plperl/meson.build

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
if not perl_dep.found()
2+
subdir_done()
3+
endif
4+
5+
bool_plperl_sources = files(
6+
'bool_plperl.c',
7+
)
8+
9+
bool_plperl = shared_module('bool_plperl',
10+
bool_plperl_sources,
11+
include_directories: [plperl_inc, include_directories('.')],
12+
kwargs: contrib_mod_args + {
13+
'dependencies': [perl_dep, contrib_mod_args['dependencies']],
14+
'install_rpath': ':'.join(mod_install_rpaths + ['@0@/CORE'.format(archlibexp)]),
15+
'build_rpath': '@0@/CORE'.format(archlibexp),
16+
},
17+
)
18+
contrib_targets += bool_plperl
19+
20+
install_data(
21+
'bool_plperl.control',
22+
'bool_plperl--1.0.sql',
23+
kwargs: contrib_data_args,
24+
)
25+
26+
install_data(
27+
'bool_plperlu.control',
28+
'bool_plperlu--1.0.sql',
29+
kwargs: contrib_data_args,
30+
)
31+
32+
tests += {
33+
'name': 'bool_plperl',
34+
'sd': meson.current_source_dir(),
35+
'bd': meson.current_build_dir(),
36+
'regress': {
37+
'sql': [
38+
'bool_plperl',
39+
'bool_plperlu',
40+
],
41+
},
42+
}

contrib/btree_gin/meson.build

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
btree_gin = shared_module('btree_gin',
2+
files('btree_gin.c'),
3+
kwargs: contrib_mod_args,
4+
)
5+
contrib_targets += btree_gin
6+
7+
install_data(
8+
'btree_gin.control',
9+
'btree_gin--1.0.sql',
10+
'btree_gin--1.0--1.1.sql',
11+
'btree_gin--1.1--1.2.sql',
12+
'btree_gin--1.2--1.3.sql',
13+
kwargs: contrib_data_args,
14+
)
15+
16+
tests += {
17+
'name': 'btree_gin',
18+
'sd': meson.current_source_dir(),
19+
'bd': meson.current_build_dir(),
20+
'regress': {
21+
'sql': [
22+
'install_btree_gin',
23+
'int2',
24+
'int4',
25+
'int8',
26+
'float4',
27+
'float8',
28+
'money',
29+
'oid',
30+
'timestamp',
31+
'timestamptz',
32+
'time',
33+
'timetz',
34+
'date',
35+
'interval',
36+
'macaddr',
37+
'macaddr8',
38+
'inet',
39+
'cidr',
40+
'text',
41+
'varchar',
42+
'char',
43+
'bytea',
44+
'bit',
45+
'varbit',
46+
'numeric',
47+
'enum',
48+
'uuid',
49+
'name',
50+
'bool',
51+
'bpchar',
52+
],
53+
},
54+
}

contrib/btree_gist/meson.build

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
btree_gist_sources = files(
2+
'btree_bit.c',
3+
'btree_bool.c',
4+
'btree_bytea.c',
5+
'btree_cash.c',
6+
'btree_date.c',
7+
'btree_enum.c',
8+
'btree_float4.c',
9+
'btree_float8.c',
10+
'btree_gist.c',
11+
'btree_inet.c',
12+
'btree_int2.c',
13+
'btree_int4.c',
14+
'btree_int8.c',
15+
'btree_interval.c',
16+
'btree_macaddr.c',
17+
'btree_macaddr8.c',
18+
'btree_numeric.c',
19+
'btree_oid.c',
20+
'btree_text.c',
21+
'btree_time.c',
22+
'btree_ts.c',
23+
'btree_utils_num.c',
24+
'btree_utils_var.c',
25+
'btree_uuid.c',
26+
)
27+
28+
btree_gist = shared_module('btree_gist',
29+
btree_gist_sources,
30+
kwargs: contrib_mod_args,
31+
)
32+
contrib_targets += btree_gist
33+
34+
install_data(
35+
'btree_gist.control',
36+
'btree_gist--1.0--1.1.sql',
37+
'btree_gist--1.1--1.2.sql',
38+
'btree_gist--1.2.sql',
39+
'btree_gist--1.2--1.3.sql',
40+
'btree_gist--1.3--1.4.sql',
41+
'btree_gist--1.4--1.5.sql',
42+
'btree_gist--1.5--1.6.sql',
43+
'btree_gist--1.6--1.7.sql',
44+
kwargs: contrib_data_args,
45+
)
46+
47+
tests += {
48+
'name': 'btree_gist',
49+
'sd': meson.current_source_dir(),
50+
'bd': meson.current_build_dir(),
51+
'regress': {
52+
'sql': [
53+
'init',
54+
'int2',
55+
'int4',
56+
'int8',
57+
'float4',
58+
'float8',
59+
'cash',
60+
'oid',
61+
'timestamp',
62+
'timestamptz',
63+
'time',
64+
'timetz',
65+
'date',
66+
'interval',
67+
'macaddr',
68+
'macaddr8',
69+
'inet',
70+
'cidr',
71+
'text',
72+
'varchar',
73+
'char',
74+
'bytea',
75+
'bit',
76+
'varbit',
77+
'numeric',
78+
'uuid',
79+
'not_equal',
80+
'enum',
81+
'bool',
82+
],
83+
},
84+
}

0 commit comments

Comments
 (0)