summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/initdb/meson.build30
-rw-r--r--src/bin/initdb/po/meson.build1
-rw-r--r--src/bin/meson.build20
-rw-r--r--src/bin/pg_amcheck/meson.build27
-rw-r--r--src/bin/pg_amcheck/po/meson.build1
-rw-r--r--src/bin/pg_archivecleanup/meson.build19
-rw-r--r--src/bin/pg_archivecleanup/po/meson.build1
-rw-r--r--src/bin/pg_basebackup/meson.build61
-rw-r--r--src/bin/pg_basebackup/po/meson.build1
-rw-r--r--src/bin/pg_checksums/meson.build21
-rw-r--r--src/bin/pg_checksums/po/meson.build1
-rw-r--r--src/bin/pg_config/meson.build19
-rw-r--r--src/bin/pg_config/po/meson.build1
-rw-r--r--src/bin/pg_controldata/meson.build19
-rw-r--r--src/bin/pg_controldata/po/meson.build1
-rw-r--r--src/bin/pg_ctl/meson.build22
-rw-r--r--src/bin/pg_ctl/po/meson.build1
-rw-r--r--src/bin/pg_dump/meson.build75
-rw-r--r--src/bin/pg_dump/po/meson.build1
-rw-r--r--src/bin/pg_resetwal/meson.build20
-rw-r--r--src/bin/pg_resetwal/po/meson.build1
-rw-r--r--src/bin/pg_rewind/meson.build42
-rw-r--r--src/bin/pg_rewind/po/meson.build1
-rw-r--r--src/bin/pg_test_fsync/meson.build21
-rw-r--r--src/bin/pg_test_fsync/po/meson.build1
-rw-r--r--src/bin/pg_test_timing/meson.build19
-rw-r--r--src/bin/pg_test_timing/po/meson.build1
-rw-r--r--src/bin/pg_upgrade/meson.build40
-rw-r--r--src/bin/pg_upgrade/po/meson.build1
-rw-r--r--src/bin/pg_verifybackup/meson.build33
-rw-r--r--src/bin/pg_verifybackup/po/meson.build1
-rw-r--r--src/bin/pg_waldump/meson.build30
-rw-r--r--src/bin/pg_waldump/po/meson.build1
-rw-r--r--src/bin/pgbench/meson.build38
-rw-r--r--src/bin/pgevent/meson.build24
-rw-r--r--src/bin/psql/meson.build67
-rw-r--r--src/bin/psql/po/meson.build1
-rw-r--r--src/bin/scripts/meson.build51
-rw-r--r--src/bin/scripts/po/meson.build1
39 files changed, 716 insertions, 0 deletions
diff --git a/src/bin/initdb/meson.build b/src/bin/initdb/meson.build
new file mode 100644
index 00000000000..9f213274d2f
--- /dev/null
+++ b/src/bin/initdb/meson.build
@@ -0,0 +1,30 @@
+initdb_sources = files(
+ 'findtimezone.c',
+ 'initdb.c'
+)
+
+initdb_sources += timezone_localtime_source
+
+#fixme: reimplement libpq_pgport logic
+
+initdb = executable('initdb',
+ initdb_sources,
+ include_directories: [timezone_inc],
+ dependencies: [frontend_code, libpq, icu, icu_i18n],
+ kwargs: default_bin_args,
+)
+bin_targets += initdb
+
+tests += {
+ 'name': 'initdb',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'env': {'with_icu': icu.found() ? 'yes' : 'no'},
+ 'tests': [
+ 't/001_initdb.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/initdb/po/meson.build b/src/bin/initdb/po/meson.build
new file mode 100644
index 00000000000..8b8a9fd2ce1
--- /dev/null
+++ b/src/bin/initdb/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('initdb-' + pg_version_major.to_string())
diff --git a/src/bin/meson.build b/src/bin/meson.build
new file mode 100644
index 00000000000..5fd5a9d2f98
--- /dev/null
+++ b/src/bin/meson.build
@@ -0,0 +1,20 @@
+subdir('initdb')
+subdir('pg_amcheck')
+subdir('pg_archivecleanup')
+subdir('pg_basebackup')
+subdir('pg_checksums')
+subdir('pg_config')
+subdir('pg_controldata')
+subdir('pg_ctl')
+subdir('pg_dump')
+subdir('pg_resetwal')
+subdir('pg_rewind')
+subdir('pg_test_fsync')
+subdir('pg_test_timing')
+subdir('pg_upgrade')
+subdir('pg_verifybackup')
+subdir('pg_waldump')
+subdir('pgbench')
+subdir('pgevent')
+subdir('psql')
+subdir('scripts')
diff --git a/src/bin/pg_amcheck/meson.build b/src/bin/pg_amcheck/meson.build
new file mode 100644
index 00000000000..8e197eba5f3
--- /dev/null
+++ b/src/bin/pg_amcheck/meson.build
@@ -0,0 +1,27 @@
+pg_amcheck_sources = files(
+ 'pg_amcheck.c'
+)
+
+pg_amcheck = executable('pg_amcheck',
+ pg_amcheck_sources,
+ dependencies: [frontend_code, libpq],
+ kwargs: default_bin_args,
+)
+bin_targets += pg_amcheck
+
+tests += {
+ 'name': 'pg_amcheck',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_basic.pl',
+ 't/002_nonesuch.pl',
+ 't/003_check.pl',
+ 't/004_verify_heapam.pl',
+ 't/005_opclass_damage.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/pg_amcheck/po/meson.build b/src/bin/pg_amcheck/po/meson.build
new file mode 100644
index 00000000000..b255f552c94
--- /dev/null
+++ b/src/bin/pg_amcheck/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pg_amcheck-' + pg_version_major.to_string())
diff --git a/src/bin/pg_archivecleanup/meson.build b/src/bin/pg_archivecleanup/meson.build
new file mode 100644
index 00000000000..87a0d980c4f
--- /dev/null
+++ b/src/bin/pg_archivecleanup/meson.build
@@ -0,0 +1,19 @@
+pg_archivecleanup = executable('pg_archivecleanup',
+ ['pg_archivecleanup.c'],
+ dependencies: [frontend_code],
+ kwargs: default_bin_args,
+)
+bin_targets += pg_archivecleanup
+
+tests += {
+ 'name': 'pg_archivecleanup',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/010_pg_archivecleanup.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/pg_archivecleanup/po/meson.build b/src/bin/pg_archivecleanup/po/meson.build
new file mode 100644
index 00000000000..37935fcabc4
--- /dev/null
+++ b/src/bin/pg_archivecleanup/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pg_archivecleanup-' + pg_version_major.to_string())
diff --git a/src/bin/pg_basebackup/meson.build b/src/bin/pg_basebackup/meson.build
new file mode 100644
index 00000000000..d26fed9cd8a
--- /dev/null
+++ b/src/bin/pg_basebackup/meson.build
@@ -0,0 +1,61 @@
+common_sources = files(
+ 'bbstreamer_file.c',
+ 'bbstreamer_gzip.c',
+ 'bbstreamer_inject.c',
+ 'bbstreamer_lz4.c',
+ 'bbstreamer_tar.c',
+ 'bbstreamer_zstd.c',
+ 'receivelog.c',
+ 'streamutil.c',
+ 'walmethods.c',
+)
+
+pg_basebackup_deps = [frontend_code, libpq, lz4, zlib, zstd]
+pg_basebackup_common = static_library('libpg_basebackup_common',
+ common_sources,
+ dependencies: pg_basebackup_deps,
+ kwargs: internal_lib_args,
+)
+
+pg_basebackup = executable('pg_basebackup',
+ 'pg_basebackup.c',
+ link_with: [pg_basebackup_common],
+ dependencies: pg_basebackup_deps,
+ kwargs: default_bin_args,
+)
+bin_targets += pg_basebackup
+
+pg_receivewal = executable('pg_receivewal',
+ 'pg_receivewal.c',
+ link_with: [pg_basebackup_common],
+ dependencies: pg_basebackup_deps,
+ kwargs: default_bin_args,
+)
+bin_targets += pg_receivewal
+
+pg_recvlogical = executable('pg_recvlogical',
+ 'pg_recvlogical.c',
+ link_with: [pg_basebackup_common],
+ dependencies: pg_basebackup_deps,
+ kwargs: default_bin_args,
+)
+bin_targets += pg_recvlogical
+
+tests += {
+ 'name': 'pg_basebackup',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'env': {'GZIP_PROGRAM': gzip.path(),
+ 'TAR': tar.path(),
+ 'LZ4': program_lz4.found() ? program_lz4.path() : '',
+ 'ZSTD': program_zstd.found() ? program_zstd.path() : ''},
+ 'tests': [
+ 't/010_pg_basebackup.pl',
+ 't/020_pg_receivewal.pl',
+ 't/030_pg_recvlogical.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/pg_basebackup/po/meson.build b/src/bin/pg_basebackup/po/meson.build
new file mode 100644
index 00000000000..cab021153fe
--- /dev/null
+++ b/src/bin/pg_basebackup/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pg_basebackup-' + pg_version_major.to_string())
diff --git a/src/bin/pg_checksums/meson.build b/src/bin/pg_checksums/meson.build
new file mode 100644
index 00000000000..ee1f367bac3
--- /dev/null
+++ b/src/bin/pg_checksums/meson.build
@@ -0,0 +1,21 @@
+pg_checksums = executable('pg_checksums',
+ ['pg_checksums.c'],
+ include_directories: [timezone_inc],
+ dependencies: [frontend_code],
+ kwargs: default_bin_args,
+)
+bin_targets += pg_checksums
+
+tests += {
+ 'name': 'pg_checksums',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_basic.pl',
+ 't/002_actions.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/pg_checksums/po/meson.build b/src/bin/pg_checksums/po/meson.build
new file mode 100644
index 00000000000..2c47c2338f6
--- /dev/null
+++ b/src/bin/pg_checksums/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pg_checksums-' + pg_version_major.to_string())
diff --git a/src/bin/pg_config/meson.build b/src/bin/pg_config/meson.build
new file mode 100644
index 00000000000..0ecbf2f9d28
--- /dev/null
+++ b/src/bin/pg_config/meson.build
@@ -0,0 +1,19 @@
+pg_config = executable('pg_config',
+ ['pg_config.c'],
+ dependencies: [frontend_code],
+ kwargs: default_bin_args,
+)
+bin_targets += pg_config
+
+tests += {
+ 'name': 'pg_config',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_pg_config.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/pg_config/po/meson.build b/src/bin/pg_config/po/meson.build
new file mode 100644
index 00000000000..b6fb6db9213
--- /dev/null
+++ b/src/bin/pg_config/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pg_config-' + pg_version_major.to_string())
diff --git a/src/bin/pg_controldata/meson.build b/src/bin/pg_controldata/meson.build
new file mode 100644
index 00000000000..557e672beb7
--- /dev/null
+++ b/src/bin/pg_controldata/meson.build
@@ -0,0 +1,19 @@
+pg_controldata = executable('pg_controldata',
+ ['pg_controldata.c'],
+ dependencies: [frontend_code],
+ kwargs: default_bin_args,
+)
+bin_targets += pg_controldata
+
+tests += {
+ 'name': 'pg_controldata',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_pg_controldata.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/pg_controldata/po/meson.build b/src/bin/pg_controldata/po/meson.build
new file mode 100644
index 00000000000..31b486d002c
--- /dev/null
+++ b/src/bin/pg_controldata/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pg_controldata-' + pg_version_major.to_string())
diff --git a/src/bin/pg_ctl/meson.build b/src/bin/pg_ctl/meson.build
new file mode 100644
index 00000000000..6812e73e329
--- /dev/null
+++ b/src/bin/pg_ctl/meson.build
@@ -0,0 +1,22 @@
+pg_ctl = executable('pg_ctl',
+ ['pg_ctl.c'],
+ dependencies: [frontend_code, libpq],
+ kwargs: default_bin_args,
+)
+bin_targets += pg_ctl
+
+tests += {
+ 'name': 'pg_ctl',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_start_stop.pl',
+ 't/002_status.pl',
+ 't/003_promote.pl',
+ 't/004_logrotate.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/pg_ctl/po/meson.build b/src/bin/pg_ctl/po/meson.build
new file mode 100644
index 00000000000..947b5108423
--- /dev/null
+++ b/src/bin/pg_ctl/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pg_ctl-' + pg_version_major.to_string())
diff --git a/src/bin/pg_dump/meson.build b/src/bin/pg_dump/meson.build
new file mode 100644
index 00000000000..785ec094dbd
--- /dev/null
+++ b/src/bin/pg_dump/meson.build
@@ -0,0 +1,75 @@
+pg_dump_common_sources = files(
+ 'compress_io.c',
+ 'dumputils.c',
+ 'parallel.c',
+ 'pg_backup_archiver.c',
+ 'pg_backup_custom.c',
+ 'pg_backup_db.c',
+ 'pg_backup_directory.c',
+ 'pg_backup_null.c',
+ 'pg_backup_tar.c',
+ 'pg_backup_utils.c',
+)
+
+pg_dump_common = static_library('libpgdump_common',
+ pg_dump_common_sources,
+ dependencies: [frontend_code, libpq, zlib],
+ kwargs: internal_lib_args,
+)
+
+
+pg_dump_sources = files(
+ 'common.c',
+ 'pg_dump.c',
+ 'pg_dump_sort.c',
+)
+
+pg_dump = executable('pg_dump',
+ pg_dump_sources,
+ link_with: [pg_dump_common],
+ dependencies: [frontend_code, libpq, zlib],
+ kwargs: default_bin_args,
+)
+bin_targets += pg_dump
+
+
+pg_dumpall_sources = files(
+ 'pg_dumpall.c',
+)
+
+pg_dumpall = executable('pg_dumpall',
+ pg_dumpall_sources,
+ link_with: [pg_dump_common],
+ dependencies: [frontend_code, libpq, zlib],
+ kwargs: default_bin_args,
+)
+bin_targets += pg_dumpall
+
+
+pg_restore_sources = files(
+ 'pg_restore.c',
+)
+
+pg_restore = executable('pg_restore',
+ pg_restore_sources,
+ link_with: [pg_dump_common],
+ dependencies: [frontend_code, libpq, zlib],
+ kwargs: default_bin_args,
+)
+bin_targets += pg_restore
+
+tests += {
+ 'name': 'pg_dump',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_basic.pl',
+ 't/002_pg_dump.pl',
+ 't/003_pg_dump_with_server.pl',
+ 't/010_dump_connstr.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/pg_dump/po/meson.build b/src/bin/pg_dump/po/meson.build
new file mode 100644
index 00000000000..82e5e537ff4
--- /dev/null
+++ b/src/bin/pg_dump/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pg_dump-' + pg_version_major.to_string())
diff --git a/src/bin/pg_resetwal/meson.build b/src/bin/pg_resetwal/meson.build
new file mode 100644
index 00000000000..7c5de134ac0
--- /dev/null
+++ b/src/bin/pg_resetwal/meson.build
@@ -0,0 +1,20 @@
+pg_resetwal = executable('pg_resetwal',
+ files('pg_resetwal.c'),
+ dependencies: [frontend_code],
+ kwargs: default_bin_args,
+)
+bin_targets += pg_resetwal
+
+tests += {
+ 'name': 'pg_resetwal',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_basic.pl',
+ 't/002_corrupted.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/pg_resetwal/po/meson.build b/src/bin/pg_resetwal/po/meson.build
new file mode 100644
index 00000000000..d130d3b775f
--- /dev/null
+++ b/src/bin/pg_resetwal/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pg_resetwal-' + pg_version_major.to_string())
diff --git a/src/bin/pg_rewind/meson.build b/src/bin/pg_rewind/meson.build
new file mode 100644
index 00000000000..d8ec9e482d5
--- /dev/null
+++ b/src/bin/pg_rewind/meson.build
@@ -0,0 +1,42 @@
+pg_rewind_sources = files(
+ 'datapagemap.c',
+ 'file_ops.c',
+ 'filemap.c',
+ 'libpq_source.c',
+ 'local_source.c',
+ 'parsexlog.c',
+ 'pg_rewind.c',
+ 'timeline.c',
+)
+
+pg_rewind_sources += xlogreader_sources
+
+pg_rewind = executable('pg_rewind',
+ pg_rewind_sources,
+ dependencies: [frontend_code, libpq, lz4, zstd],
+ c_args: ['-DFRONTEND'], # needed for xlogreader et al
+ kwargs: default_bin_args,
+)
+bin_targets += pg_rewind
+
+
+tests += {
+ 'name': 'pg_rewind',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_basic.pl',
+ 't/002_databases.pl',
+ 't/003_extrafiles.pl',
+ 't/004_pg_xlog_symlink.pl',
+ 't/005_same_timeline.pl',
+ 't/006_options.pl',
+ 't/007_standby_source.pl',
+ 't/008_min_recovery_point.pl',
+ 't/009_growing_files.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/pg_rewind/po/meson.build b/src/bin/pg_rewind/po/meson.build
new file mode 100644
index 00000000000..a105600b348
--- /dev/null
+++ b/src/bin/pg_rewind/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pg_rewind-' + pg_version_major.to_string())
diff --git a/src/bin/pg_test_fsync/meson.build b/src/bin/pg_test_fsync/meson.build
new file mode 100644
index 00000000000..2c01831e11f
--- /dev/null
+++ b/src/bin/pg_test_fsync/meson.build
@@ -0,0 +1,21 @@
+test_fsync_sources = files('pg_test_fsync.c')
+
+pg_test_fsync = executable('pg_test_fsync',
+ test_fsync_sources,
+ dependencies: [frontend_code],
+ kwargs: default_bin_args,
+)
+bin_targets += pg_test_fsync
+
+tests += {
+ 'name': 'pg_test_fsync',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_basic.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/pg_test_fsync/po/meson.build b/src/bin/pg_test_fsync/po/meson.build
new file mode 100644
index 00000000000..2ee1125282d
--- /dev/null
+++ b/src/bin/pg_test_fsync/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pg_test_fsync-' + pg_version_major.to_string())
diff --git a/src/bin/pg_test_timing/meson.build b/src/bin/pg_test_timing/meson.build
new file mode 100644
index 00000000000..0a3068f1657
--- /dev/null
+++ b/src/bin/pg_test_timing/meson.build
@@ -0,0 +1,19 @@
+pg_test_timing = executable('pg_test_timing',
+ ['pg_test_timing.c'],
+ dependencies: [frontend_code],
+ kwargs: default_bin_args,
+)
+bin_targets += pg_test_timing
+
+tests += {
+ 'name': 'pg_test_timing',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_basic.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/pg_test_timing/po/meson.build b/src/bin/pg_test_timing/po/meson.build
new file mode 100644
index 00000000000..cda8615165b
--- /dev/null
+++ b/src/bin/pg_test_timing/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pg_test_timing-' + pg_version_major.to_string())
diff --git a/src/bin/pg_upgrade/meson.build b/src/bin/pg_upgrade/meson.build
new file mode 100644
index 00000000000..02f030e0ccf
--- /dev/null
+++ b/src/bin/pg_upgrade/meson.build
@@ -0,0 +1,40 @@
+pg_upgrade_sources = files(
+ 'check.c',
+ 'controldata.c',
+ 'dump.c',
+ 'exec.c',
+ 'file.c',
+ 'function.c',
+ 'info.c',
+ 'option.c',
+ 'parallel.c',
+ 'pg_upgrade.c',
+ 'relfilenumber.c',
+ 'server.c',
+ 'tablespace.c',
+ 'util.c',
+ 'version.c',
+)
+
+pg_upgrade = executable('pg_upgrade',
+ pg_upgrade_sources,
+ dependencies: [frontend_code, libpq],
+ kwargs: default_bin_args,
+)
+bin_targets += pg_upgrade
+
+
+tests += {
+ 'name': 'pg_upgrade',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_basic.pl',
+ 't/002_pg_upgrade.pl',
+ ],
+ 'test_kwargs': {'priority': 40}, # pg_upgrade tests are slow
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/pg_upgrade/po/meson.build b/src/bin/pg_upgrade/po/meson.build
new file mode 100644
index 00000000000..39301cbede8
--- /dev/null
+++ b/src/bin/pg_upgrade/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pg_upgrade-' + pg_version_major.to_string())
diff --git a/src/bin/pg_verifybackup/meson.build b/src/bin/pg_verifybackup/meson.build
new file mode 100644
index 00000000000..4c3b2bb5f97
--- /dev/null
+++ b/src/bin/pg_verifybackup/meson.build
@@ -0,0 +1,33 @@
+pg_verifybackup_sources = files(
+ 'parse_manifest.c',
+ 'pg_verifybackup.c'
+)
+
+pg_verifybackup = executable('pg_verifybackup',
+ pg_verifybackup_sources,
+ dependencies: [frontend_code, libpq],
+ kwargs: default_bin_args,
+)
+bin_targets += pg_verifybackup
+
+tests += {
+ 'name': 'pg_verifybackup',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_basic.pl',
+ 't/002_algorithm.pl',
+ 't/003_corruption.pl',
+ 't/004_options.pl',
+ 't/005_bad_manifest.pl',
+ 't/006_encoding.pl',
+ 't/007_wal.pl',
+ 't/008_untar.pl',
+ 't/009_extract.pl',
+ 't/010_client_untar.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/pg_verifybackup/po/meson.build b/src/bin/pg_verifybackup/po/meson.build
new file mode 100644
index 00000000000..b583f1958ba
--- /dev/null
+++ b/src/bin/pg_verifybackup/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pg_verifybackup-' + pg_version_major.to_string())
diff --git a/src/bin/pg_waldump/meson.build b/src/bin/pg_waldump/meson.build
new file mode 100644
index 00000000000..95872652ffd
--- /dev/null
+++ b/src/bin/pg_waldump/meson.build
@@ -0,0 +1,30 @@
+pg_waldump_sources = files(
+ 'compat.c',
+ 'pg_waldump.c',
+ 'rmgrdesc.c',
+)
+
+pg_waldump_sources += rmgr_desc_sources
+pg_waldump_sources += xlogreader_sources
+pg_waldump_sources += files('../../backend/access/transam/xlogstats.c')
+
+pg_waldump = executable('pg_waldump',
+ pg_waldump_sources,
+ dependencies: [frontend_code, lz4, zstd],
+ c_args: ['-DFRONTEND'], # needed for xlogreader et al
+ kwargs: default_bin_args,
+)
+bin_targets += pg_waldump
+
+tests += {
+ 'name': 'pg_waldump',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_basic.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/pg_waldump/po/meson.build b/src/bin/pg_waldump/po/meson.build
new file mode 100644
index 00000000000..f335aa4b360
--- /dev/null
+++ b/src/bin/pg_waldump/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pg_waldump-' + pg_version_major.to_string())
diff --git a/src/bin/pgbench/meson.build b/src/bin/pgbench/meson.build
new file mode 100644
index 00000000000..6564e54029c
--- /dev/null
+++ b/src/bin/pgbench/meson.build
@@ -0,0 +1,38 @@
+pgbench_sources = files(
+ 'pgbench.c',
+)
+
+exprscan = custom_target('exprscan',
+ input: 'exprscan.l',
+ output: 'exprscan.c',
+ command: flex_cmd,
+)
+generated_sources += exprscan
+pgbench_sources += exprscan
+
+exprparse = custom_target('exprparse',
+ input: 'exprparse.y',
+ kwargs: bison_kw,
+)
+generated_sources += exprparse.to_list()
+pgbench_sources += exprparse
+
+pgbench = executable('pgbench',
+ pgbench_sources,
+ dependencies: [frontend_code, libpq, thread_dep],
+ include_directories: include_directories('.'),
+ kwargs: default_bin_args,
+)
+bin_targets += pgbench
+
+tests += {
+ 'name': 'pgbench',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_pgbench_with_server.pl',
+ 't/002_pgbench_no_server.pl',
+ ],
+ },
+}
diff --git a/src/bin/pgevent/meson.build b/src/bin/pgevent/meson.build
new file mode 100644
index 00000000000..7a468879fd2
--- /dev/null
+++ b/src/bin/pgevent/meson.build
@@ -0,0 +1,24 @@
+if host_system != 'windows'
+ subdir_done()
+endif
+
+pgevent_sources = files(
+ 'pgevent.c',
+)
+
+# FIXME: copied from Mkvcbuild.pm, but I don't think that's the right approach
+pgevent_link_args = []
+if cc.get_id() == 'msvc'
+ pgevent_link_args += '/ignore:4104'
+endif
+
+pgevent = shared_library('pgevent',
+ pgevent_sources,
+ dependencies: [frontend_code],
+ link_args: pgevent_link_args,
+ vs_module_defs: 'pgevent.def',
+ kwargs: default_lib_args + {
+ 'name_prefix': '',
+ },
+)
+bin_targets += pgevent
diff --git a/src/bin/psql/meson.build b/src/bin/psql/meson.build
new file mode 100644
index 00000000000..ea850c8fdf5
--- /dev/null
+++ b/src/bin/psql/meson.build
@@ -0,0 +1,67 @@
+psql_sources = files(
+ 'command.c',
+ 'common.c',
+ 'copy.c',
+ 'crosstabview.c',
+ 'describe.c',
+ 'help.c',
+ 'input.c',
+ 'large_obj.c',
+ 'mainloop.c',
+ 'prompt.c',
+ 'startup.c',
+ 'stringutils.c',
+ 'tab-complete.c',
+ 'variables.c',
+)
+
+psqlscanslash = custom_target('psqlscanslash',
+ input: 'psqlscanslash.l',
+ output: 'psqlscanslash.c',
+ command: [flex_cmd, '--no-backup', '--fix-warnings', '--', '-Cfe', '-p', '-p'])
+generated_sources += psqlscanslash
+psql_sources += psqlscanslash
+bin_targets += psqlscanslash
+
+sql_help = custom_target('psql_help',
+ output: ['sql_help.c', 'sql_help.h'],
+ depfile: 'sql_help.dep',
+ command: [
+ perl, files('create_help.pl'),
+ '--docdir', '@SOURCE_ROOT@/doc/src/sgml/ref',
+ '--depfile', '@DEPFILE@',
+ '--outdir', '@OUTDIR@',
+ '--basename', 'sql_help',
+ ],
+)
+generated_sources += sql_help.to_list()
+psql_sources += sql_help
+bin_targets += sql_help
+
+psql = executable('psql',
+ psql_sources,
+ include_directories: include_directories('.'),
+ dependencies: [frontend_code, libpq, readline],
+ kwargs: default_bin_args,
+)
+bin_targets += psql
+
+install_data('psqlrc.sample',
+ install_dir: dir_data,
+)
+
+tests += {
+ 'name': 'psql',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'env': {'with_readline': readline.found() ? 'yes' : 'no'},
+ 'tests': [
+ 't/001_basic.pl',
+ 't/010_tab_completion.pl',
+ 't/020_cancel.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/psql/po/meson.build b/src/bin/psql/po/meson.build
new file mode 100644
index 00000000000..45fe425298d
--- /dev/null
+++ b/src/bin/psql/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('psql-' + pg_version_major.to_string())
diff --git a/src/bin/scripts/meson.build b/src/bin/scripts/meson.build
new file mode 100644
index 00000000000..eaf250c7f73
--- /dev/null
+++ b/src/bin/scripts/meson.build
@@ -0,0 +1,51 @@
+scripts_common = static_library('libscripts_common',
+ files('common.c'),
+ dependencies: [frontend_code, libpq],
+ kwargs: internal_lib_args,
+)
+
+binaries = [
+ 'createdb',
+ 'dropdb',
+ 'createuser',
+ 'dropuser',
+ 'clusterdb',
+ 'vacuumdb',
+ 'reindexdb',
+ 'pg_isready',
+]
+
+foreach binary : binaries
+ binary = executable(binary,
+ files(binary + '.c'),
+ link_with: [scripts_common],
+ dependencies: [frontend_code, libpq],
+ kwargs: default_bin_args,
+ )
+ bin_targets += binary
+endforeach
+
+tests += {
+ 'name': 'scripts',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/010_clusterdb.pl',
+ 't/011_clusterdb_all.pl',
+ 't/020_createdb.pl',
+ 't/040_createuser.pl',
+ 't/050_dropdb.pl',
+ 't/070_dropuser.pl',
+ 't/080_pg_isready.pl',
+ 't/090_reindexdb.pl',
+ 't/091_reindexdb_all.pl',
+ 't/100_vacuumdb.pl',
+ 't/101_vacuumdb_all.pl',
+ 't/102_vacuumdb_stages.pl',
+ 't/200_connstr.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/scripts/po/meson.build b/src/bin/scripts/po/meson.build
new file mode 100644
index 00000000000..3c531459c2d
--- /dev/null
+++ b/src/bin/scripts/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pgscripts-' + pg_version_major.to_string())