Meson for patch authors

From PostgreSQL wiki
Jump to navigationJump to search

From PostgreSQL 16, the Meson build system will be supported. In most cases, patches submitted for inclusion in PostgreSQL will need to update the Meson configuration accordingly. This article (WIP) aims to provide an overview of necessary adjustments, particularly for anyone not yet familiar with Meson.

Meson documentation

The PostgreSQL Wiki Meson article provides a general overview.

PostgreSQL devel documentation: Building and Installation with Meson

Meson installation

See here for general installation details.

Note that Meson (and the ninja build tool) are somewhat bleeding edge, and the versions provided by some current distributions may not work correctly.

TAP tests

If a patch adds any TAP tests, these must be included in the relevant "meson.build" file, which should contain a section like this:

 'tap': {
   'tests': [
     't/001_basic.pl',
   ],
 },

E.g. to add a second test, change this section to

 'tap': {
   'tests': [
     't/001_basic.pl',
     't/002_advanced.pl',
   ],
 },

To verify any new entries are correctly recognised, it should be sufficient to (from the PostgreSQL source directory) execute the following:

 meson setup ~/devel/postgresql-builddir
 cd ~/devel/postgresql-builddir
 meson test --list

which will produce a list of all tests recognized by Meson.