meson: add install-{quiet, world} targets
authorAndres Freund <[email protected]>
Fri, 24 Mar 2023 04:20:18 +0000 (21:20 -0700)
committerAndres Freund <[email protected]>
Fri, 24 Mar 2023 04:20:18 +0000 (21:20 -0700)
To define our own install target, we need dependencies on the i18n targets,
which we did not collect so far.

Discussion: https://postgr.es/m/3fc3bb9b-f7f8-d442-35c1-ec82280c564a@enterprisedb.com

28 files changed:
meson.build
src/backend/po/meson.build
src/bin/initdb/po/meson.build
src/bin/pg_amcheck/po/meson.build
src/bin/pg_archivecleanup/po/meson.build
src/bin/pg_basebackup/po/meson.build
src/bin/pg_checksums/po/meson.build
src/bin/pg_config/po/meson.build
src/bin/pg_controldata/po/meson.build
src/bin/pg_ctl/po/meson.build
src/bin/pg_dump/po/meson.build
src/bin/pg_resetwal/po/meson.build
src/bin/pg_rewind/po/meson.build
src/bin/pg_test_fsync/po/meson.build
src/bin/pg_test_timing/po/meson.build
src/bin/pg_upgrade/po/meson.build
src/bin/pg_verifybackup/po/meson.build
src/bin/pg_waldump/po/meson.build
src/bin/psql/po/meson.build
src/bin/scripts/po/meson.build
src/interfaces/ecpg/ecpglib/po/meson.build
src/interfaces/ecpg/preproc/po/meson.build
src/interfaces/libpq/po/meson.build
src/interfaces/libpq/test/meson.build
src/pl/plperl/po/meson.build
src/pl/plpgsql/src/po/meson.build
src/pl/plpython/po/meson.build
src/pl/tcl/po/meson.build

index 33dd5b43ed55c2c9ef1d9a4357d7bb2c179aaec2..09f619b12fdc04361b077f1c611bc471efe9c09e 100644 (file)
@@ -2543,6 +2543,7 @@ bin_targets = []
 pl_targets = []
 contrib_targets = []
 testprep_targets = []
+nls_targets = []
 
 
 # Define the tests to distribute them to the correct test styles later
@@ -2846,21 +2847,6 @@ generated_sources_ac += {'': ['GNUmakefile']}
 testprep_targets += test_install_libs
 
 
-# command to install files used for tests, which aren't installed by default
-install_test_files_args = [
-  install_files,
-  '--prefix', dir_prefix,
-  '--install', contrib_data_dir, test_install_data,
-  '--install', dir_lib_pkg, test_install_libs,
-]
-
-# Target installing files required for installcheck of various modules
-run_target('install-test-files',
-  command: [python] + install_test_files_args,
-  depends: testprep_targets,
-)
-
-
 # If there are any files in the source directory that we also generate in the
 # build directory, they might get preferred over the newly generated files,
 # e.g. because of a #include "file", which always will search in the current
@@ -2915,6 +2901,64 @@ endif
 
 
 
+###############################################################
+# Install targets
+###############################################################
+
+
+# We want to define additional install targets beyond what meson provides. For
+# that we need to define targets depending on nearly everything. We collected
+# the results of i18n.gettext() invocations into nls_targets, that also
+# includes maintainer targets though. Collect the ones we want as a dependency.
+#
+# i18n.gettext() doesn't return the dependencies before 0.60 - but the gettext
+# generation happens during install, so that's not a real issue.
+nls_mo_targets = []
+if libintl.found() and meson.version().version_compare('>=0.60')
+  # use range() to avoid the flattening of the list that forech() would do
+  foreach off : range(0, nls_targets.length())
+    # i18n.gettext() list containing 1) list of built .mo files 2) maintainer
+    # -pot target 3) maintainer -pot target
+    nls_mo_targets += nls_targets[off][0]
+  endforeach
+  alias_target('nls', nls_mo_targets)
+endif
+
+
+all_built = [
+  backend_targets,
+  bin_targets,
+  libpq_st,
+  pl_targets,
+  contrib_targets,
+  nls_mo_targets,
+  testprep_targets,
+  ecpg_targets,
+]
+
+# Meson's default install target is quite verbose. Provide one that is quiet.
+install_quiet = custom_target('install-quiet',
+  output: 'install-quiet',
+  build_always_stale: true,
+  build_by_default: false,
+  command: meson_args + ['install', '--quiet', '--no-rebuild'],
+  depends: all_built,
+)
+
+# Target to install files used for tests, which aren't installed by default
+install_test_files_args = [
+  install_files,
+  '--prefix', dir_prefix,
+  '--install', contrib_data_dir, test_install_data,
+  '--install', dir_lib_pkg, test_install_libs,
+]
+run_target('install-test-files',
+  command: [python] + install_test_files_args,
+  depends: testprep_targets,
+)
+
+
+
 ###############################################################
 # Test prep
 ###############################################################
@@ -3185,6 +3229,7 @@ if meson.version().version_compare('>=0.57')
 endif
 
 
+
 ###############################################################
 # Pseudo targets
 ###############################################################
@@ -3194,6 +3239,7 @@ alias_target('bin', bin_targets + [libpq_st])
 alias_target('pl', pl_targets)
 alias_target('contrib', contrib_targets)
 alias_target('testprep', testprep_targets)
+alias_target('install-world', install_quiet, installdocs)
 
 
 
index 772399b0bd8085ac983981bf30e144c5d94b2bd4..b3cb083eb2c70689db830d28e33615824a2648fc 100644 (file)
@@ -1,3 +1,3 @@
 # Copyright (c) 2022-2023, PostgreSQL Global Development Group
 
-i18n.gettext('postgres-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('postgres-' + pg_version_major.to_string())]
index 6506c5264ee40f6bc7b79620d5e568d687812abf..ad193984175b9428b6170e61eee78508efcc9dcb 100644 (file)
@@ -1,3 +1,3 @@
 # Copyright (c) 2022-2023, PostgreSQL Global Development Group
 
-i18n.gettext('initdb-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('initdb-' + pg_version_major.to_string())]
index 9cb62eaaae26094b903e9a52e5dab2305813e9d5..618de4f44581862909dc657d7c8e3acb09f2e94a 100644 (file)
@@ -1,3 +1,3 @@
 # Copyright (c) 2022-2023, PostgreSQL Global Development Group
 
-i18n.gettext('pg_amcheck-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('pg_amcheck-' + pg_version_major.to_string())]
index 79957fa2b98129f8f124fc0712c0de749913c8b8..c6f33edcad1281706ef5dfa749277eb72b078b5f 100644 (file)
@@ -1,3 +1,3 @@
 # Copyright (c) 2022-2023, PostgreSQL Global Development Group
 
-i18n.gettext('pg_archivecleanup-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('pg_archivecleanup-' + pg_version_major.to_string())]
index 437f7e0606faf6104bd3f84ce2e48738b06f408d..2a39f5ffeba4746dffc4276565e074f64a8c74ac 100644 (file)
@@ -1,3 +1,3 @@
 # Copyright (c) 2022-2023, PostgreSQL Global Development Group
 
-i18n.gettext('pg_basebackup-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('pg_basebackup-' + pg_version_major.to_string())]
index 273f55d9012d40dec5e822eb6be0fe69a267a470..97b20f263cf0a77569803ee2092ee96fce23c863 100644 (file)
@@ -1,3 +1,3 @@
 # Copyright (c) 2022-2023, PostgreSQL Global Development Group
 
-i18n.gettext('pg_checksums-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('pg_checksums-' + pg_version_major.to_string())]
index 7e4629ffc4e6544fda51cc73afee1e7ffa48761c..f515af816ea6aecfd85d460d75bf668006e83ab3 100644 (file)
@@ -1,3 +1,3 @@
 # Copyright (c) 2022-2023, PostgreSQL Global Development Group
 
-i18n.gettext('pg_config-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('pg_config-' + pg_version_major.to_string())]
index 73a77568b6fd8c3981f14fe0c4c6eb183e03386b..685f1c167a7594679490c5cc38bd9774b26aadaf 100644 (file)
@@ -1,3 +1,3 @@
 # Copyright (c) 2022-2023, PostgreSQL Global Development Group
 
-i18n.gettext('pg_controldata-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('pg_controldata-' + pg_version_major.to_string())]
index da7710090e0db0cbdd7d3b7fe750ff91051b4f50..3d35f7ad2112b2246a5bb127d68a1e36307971ba 100644 (file)
@@ -1,3 +1,3 @@
 # Copyright (c) 2022-2023, PostgreSQL Global Development Group
 
-i18n.gettext('pg_ctl-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('pg_ctl-' + pg_version_major.to_string())]
index 3b627711d73b6303fdff3394a4b2397aad69db94..cc9d36801194273616cd5c296b7397e8ac2fe5c4 100644 (file)
@@ -1,3 +1,3 @@
 # Copyright (c) 2022-2023, PostgreSQL Global Development Group
 
-i18n.gettext('pg_dump-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('pg_dump-' + pg_version_major.to_string())]
index c82c6a4263fbe599a0ff796454a49a332a63f385..fa75d28752685e9ab24129500b33b86dac73ebd2 100644 (file)
@@ -1,3 +1,3 @@
 # Copyright (c) 2022-2023, PostgreSQL Global Development Group
 
-i18n.gettext('pg_resetwal-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('pg_resetwal-' + pg_version_major.to_string())]
index b0ccd16bbb9e1079e26d01e0f8cec19540e9f21d..bffe7debea907b8fff7796715fe5fd8c5a40e840 100644 (file)
@@ -1,3 +1,3 @@
 # Copyright (c) 2022-2023, PostgreSQL Global Development Group
 
-i18n.gettext('pg_rewind-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('pg_rewind-' + pg_version_major.to_string())]
index b25a6d0f826ecbe02196e124005a4e8b7ec3dc02..46d0ac587e2f1ff3effb92b9b972290cd0a96b06 100644 (file)
@@ -1,3 +1,3 @@
 # Copyright (c) 2022-2023, PostgreSQL Global Development Group
 
-i18n.gettext('pg_test_fsync-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('pg_test_fsync-' + pg_version_major.to_string())]
index 918225a1cf5b6a60976fda95f2614887585a0736..7bc84d5c7ff7d5be2b619128be131b2061dc9761 100644 (file)
@@ -1,3 +1,3 @@
 # Copyright (c) 2022-2023, PostgreSQL Global Development Group
 
-i18n.gettext('pg_test_timing-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('pg_test_timing-' + pg_version_major.to_string())]
index b4ba67b1c5e0136f45d06bb2ced0a66e07f253d8..8531c3b31ef56f761512d2668ee102be946e7cc8 100644 (file)
@@ -1,3 +1,3 @@
 # Copyright (c) 2022-2023, PostgreSQL Global Development Group
 
-i18n.gettext('pg_upgrade-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('pg_upgrade-' + pg_version_major.to_string())]
index 092b8a95f31e01d2026113811c13ebcdcbd2f226..181cf640e71a285eaa7f45c2ecd52d461fbe69f6 100644 (file)
@@ -1,3 +1,3 @@
 # Copyright (c) 2022-2023, PostgreSQL Global Development Group
 
-i18n.gettext('pg_verifybackup-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('pg_verifybackup-' + pg_version_major.to_string())]
index 076dbcafb42d485d8116367bbcc5ddbecf42b74a..c4188032d7104ebd467bd696cdbec3eb176c37f4 100644 (file)
@@ -1,3 +1,3 @@
 # Copyright (c) 2022-2023, PostgreSQL Global Development Group
 
-i18n.gettext('pg_waldump-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('pg_waldump-' + pg_version_major.to_string())]
index da257154d4c5619567098f72a945a0383e6869aa..103ed93a78980a57e0c14ea096f48f5db42326b0 100644 (file)
@@ -1,3 +1,3 @@
 # Copyright (c) 2022-2023, PostgreSQL Global Development Group
 
-i18n.gettext('psql-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('psql-' + pg_version_major.to_string())]
index a28ec9ed049419abc9e92d3953abe3268eb98f43..00a9f208acf889f221df2187528799e41ad43c7e 100644 (file)
@@ -1,3 +1,3 @@
 # Copyright (c) 2022-2023, PostgreSQL Global Development Group
 
-i18n.gettext('pgscripts-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('pgscripts-' + pg_version_major.to_string())]
index 95e748d9fa5fcea399b5bde11b6c92a6bc50a2d1..39fcc93bfcc42d94e81586691d66dd07a4c6d0c1 100644 (file)
@@ -1,3 +1,3 @@
 # Copyright (c) 2022-2023, PostgreSQL Global Development Group
 
-i18n.gettext('ecpglib' + '6' + '-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('ecpglib' + '6' + '-' + pg_version_major.to_string())]
index 1b2ff1165471e9243f629d2b48e461b3dc6aca55..43f825b88bb0c1f1b05b43c6417fe4a4a49899be 100644 (file)
@@ -1,3 +1,3 @@
 # Copyright (c) 2022-2023, PostgreSQL Global Development Group
 
-i18n.gettext('ecpg-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('ecpg-' + pg_version_major.to_string())]
index 5489b23b795074938e4b1ab33cbb691ec6497b1e..a7a1df87ae3b4e5b0883cf65936a370f00b69d3b 100644 (file)
@@ -1,3 +1,3 @@
 # Copyright (c) 2022-2023, PostgreSQL Global Development Group
 
-i18n.gettext('libpq' + '5' + '-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('libpq' + '5' + '-' + pg_version_major.to_string())]
index b2a4b06fd23acc7a06f0454f2e395ee7a5aaeb02..d56b63e11867cf2a8cb5e8340f7cdd929eb1bb56 100644 (file)
@@ -10,7 +10,7 @@ if host_system == 'windows'
     '--FILEDESC', 'libpq test program',])
 endif
 
-executable('libpq_uri_regress',
+testprep_targets += executable('libpq_uri_regress',
   libpq_uri_regress_sources,
   dependencies: [frontend_code, libpq],
   kwargs: default_bin_args + {
@@ -29,7 +29,7 @@ if host_system == 'windows'
     '--FILEDESC', 'libpq test program',])
 endif
 
-executable('libpq_testclient',
+testprep_targets += executable('libpq_testclient',
   libpq_testclient_sources,
   dependencies: [frontend_code, libpq],
   kwargs: default_bin_args + {
index 2c3cd190cd94133a953a559ac676cf0cacf92ad8..f1c8e7d00a1ee35684434e5c3a76d412ce5d11fd 100644 (file)
@@ -1,3 +1,3 @@
 # Copyright (c) 2022-2023, PostgreSQL Global Development Group
 
-i18n.gettext('plperl-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('plperl-' + pg_version_major.to_string())]
index 1fa97d6ab50f9c5ca87b012c73225e83dabdc783..aad875948b638ec370b1e1c73a39356f0da5752a 100644 (file)
@@ -1,3 +1,3 @@
 # Copyright (c) 2022-2023, PostgreSQL Global Development Group
 
-i18n.gettext('plpgsql-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('plpgsql-' + pg_version_major.to_string())]
index e5457069b47a1ada7d80f17b3890c19c4c6c1c64..ddaa1913b84c90d4a7e2f512a0fc493e589ea697 100644 (file)
@@ -1,3 +1,3 @@
 # Copyright (c) 2022-2023, PostgreSQL Global Development Group
 
-i18n.gettext('plpython-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('plpython-' + pg_version_major.to_string())]
index 3e7d3287f84a7709a2be39f9eaa866c60018e7bc..9e5c8e95f1500bd6985fbf682aff65cd1c20374f 100644 (file)
@@ -1,3 +1,3 @@
 # Copyright (c) 2022-2023, PostgreSQL Global Development Group
 
-i18n.gettext('pltcl-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('pltcl-' + pg_version_major.to_string())]