meson: Add dependencies to perl modules to various script invocations
authorAndres Freund <[email protected]>
Sat, 10 Jun 2023 03:12:16 +0000 (20:12 -0700)
committerAndres Freund <[email protected]>
Sat, 10 Jun 2023 03:12:16 +0000 (20:12 -0700)
Eventually it is likely worth trying to deal with this in a more expansive
way, by generating dependency files generated within the scripts. But it's not
entirely obvious how to do that in perl and is work more suitable for 17
anyway.

Reported-by: Dagfinn Ilmari MannsÃ¥ker <[email protected]>
Reviewed-by: Tristan Partin <[email protected]>
Discussion: https://postgr.es/m/[email protected]

meson.build
src/common/meson.build
src/common/unicode/meson.build
src/include/catalog/meson.build
src/include/nodes/meson.build
src/include/utils/meson.build
src/interfaces/ecpg/preproc/meson.build
src/pl/plpgsql/src/meson.build

index 16b2e866462a26a6c9d282b7887b711c6a25604e..82f2782673ec48880122638d9edfd584f5b1c7fe 100644 (file)
@@ -2681,6 +2681,20 @@ gen_export_kwargs = {
 
 
 
+###
+### Helpers for custom targets used across the tree
+###
+
+catalog_pm = files('src/backend/catalog/Catalog.pm')
+perfect_hash_pm = files('src/tools/PerfectHash.pm')
+gen_kwlist_deps = [perfect_hash_pm]
+gen_kwlist_cmd = [
+  perl, '-I', '@SOURCE_ROOT@/src/tools',
+  files('src/tools/gen_keywordlist.pl'),
+  '--output', '@OUTDIR@', '@INPUT@']
+
+
+
 ###
 ### windows resources related stuff
 ###
index 41bd58ebdf19a5c4df3940f30340ed0dde0f2c61..9efc80ac024ce23133a236337ab09e9c122d3219 100644 (file)
@@ -54,8 +54,8 @@ endif
 common_kwlist = custom_target('kwlist',
   input: files('../include/parser/kwlist.h'),
   output: 'kwlist_d.h',
-  command: [perl, '-I', '@SOURCE_ROOT@/src/tools', files('../tools/gen_keywordlist.pl'),
-      '--extern', '--output', '@OUTDIR@', '@INPUT@'])
+  depend_files: gen_kwlist_deps,
+  command: [gen_kwlist_cmd, '--extern'])
 generated_sources += common_kwlist
 common_sources += common_kwlist
 
index 1ffece1550a66cf171ade12edff932e9cefb2504..9033c4a3dcf82575ef4e23ca043c9574b591ec23 100644 (file)
@@ -28,6 +28,7 @@ update_unicode_targets += \
   custom_target('unicode_norm_table.h',
     input: [unicode_data['UnicodeData.txt'], unicode_data['CompositionExclusions.txt']],
     output: ['unicode_norm_table.h', 'unicode_norm_hashfunc.h'],
+    depend_files: perfect_hash_pm,
     command: [
       perl, files('generate-unicode_norm_table.pl'),
       '--outdir', '@OUTDIR@', '@INPUT@'],
@@ -38,6 +39,7 @@ update_unicode_targets += \
   custom_target('unicode_nonspacing_table.h',
     input: [unicode_data['UnicodeData.txt']],
     output: ['unicode_nonspacing_table.h'],
+    depend_files: perfect_hash_pm,
     command: [perl, files('generate-unicode_nonspacing_table.pl'), '@INPUT@'],
     build_by_default: false,
     capture: true,
@@ -56,6 +58,7 @@ update_unicode_targets += \
   custom_target('unicode_normprops_table.h',
     input: [unicode_data['DerivedNormalizationProps.txt']],
     output: ['unicode_normprops_table.h'],
+    depend_files: perfect_hash_pm,
     command: [perl, files('generate-unicode_normprops_table.pl'), '@INPUT@'],
     build_by_default: false,
     capture: true,
index 3179be09d3db2785281256a9b05888966c98005e..c3fd05d0279aa2ddd40ed7b2f3ae4f377ae168cc 100644 (file)
@@ -111,7 +111,7 @@ generated_catalog_headers = custom_target('generated_catalog_headers',
   output: output_files,
   install_dir: output_install,
   input: input,
-  depend_files: bki_data_f,
+  depend_files: bki_data_f + catalog_pm,
   build_by_default: true,
   install: true,
   command: [
index 9a8e85c4a5e0c4d27cc1eb2e49e4f36e93e4b02a..626dc696d51f15bfafc19f273aba2ffc850cb4ce 100644 (file)
@@ -50,6 +50,7 @@ node_support_install = [
 generated_nodes = custom_target('nodetags.h',
   input: node_support_input,
   output: node_support_output,
+  depend_files: catalog_pm,
   command: [
     perl, files('../../backend/nodes/gen_node_support.pl'),
     '-o', '@OUTDIR@',
index 2fed1e3f8e907982bd3eb48fe715be3cfcd48391..c212c4091f790fa6dd59708531c9e2c1f84f2a8c 100644 (file)
@@ -44,6 +44,7 @@ fmgrtab_output = ['fmgroids.h', 'fmgrprotos.h', 'fmgrtab.c']
 fmgrtab_target = custom_target('fmgrtab',
   input: '../catalog/pg_proc.dat',
   output : fmgrtab_output,
+  depend_files: catalog_pm,
   command: [perl, '-I', '@SOURCE_ROOT@/src/backend/catalog/', files('../../backend/utils/Gen_fmgrtab.pl'), '--include-path=@SOURCE_ROOT@/src/include', '--output=@OUTDIR@', '@INPUT@'],
   install: true,
   install_dir: [dir_include_server / 'utils', dir_include_server / 'utils', false],
index 08d772d2614e714fbe5abe6fcccec6a3be5efc0b..eef8f1864feef06b94c6c24e05409c7cdb296d56 100644 (file)
@@ -69,14 +69,8 @@ c_kwlist = custom_target('c_kwlist_d.h',
   input: ['c_kwlist.h'],
   output: ['c_kwlist_d.h'],
   depends: check_rules,
-  command: [
-    perl,
-    '-I', '@SOURCE_ROOT@/src/tools',
-    '@SOURCE_ROOT@/src/tools/gen_keywordlist.pl',
-    '--output', '@OUTDIR@',
-    '--varname', 'ScanCKeywords',
-    '--no-case-fold', '@INPUT0@',
-  ],
+  depend_files: gen_kwlist_deps,
+  command: [gen_kwlist_cmd, '--varname', 'ScanCKeywords', '--no-case-fold'],
 )
 generated_sources += c_kwlist
 ecpg_sources += c_kwlist
@@ -84,13 +78,8 @@ ecpg_sources += c_kwlist
 ecpg_kwlist = custom_target('ecpg_kwlist_d.h',
   input: ['ecpg_kwlist.h'],
   output: ['ecpg_kwlist_d.h'],
-  command: [
-    perl, '-I',
-    '@SOURCE_ROOT@/src/tools',
-    '@SOURCE_ROOT@/src/tools/gen_keywordlist.pl',
-    '--output', '@OUTDIR@',
-    '--varname', 'ScanECPGKeywords', '@INPUT0@',
-  ]
+  depend_files: gen_kwlist_deps,
+  command: [gen_kwlist_cmd, '--varname', 'ScanECPGKeywords'],
 )
 generated_sources += ecpg_kwlist
 ecpg_sources += ecpg_kwlist
index e185a87024c2a34c28c8f69626edb5dd2c5d42bc..85e7293b37444677699c790437103d19655c6af3 100644 (file)
@@ -25,11 +25,11 @@ pl_errcodes = custom_target('plerrcodes',
 generated_sources += pl_errcodes
 plpgsql_sources += pl_errcodes
 
-gen_keywordlist = files('../../../../src/tools/gen_keywordlist.pl')
 pl_reserved = custom_target('pl_reserved_kwlist',
   input: ['pl_reserved_kwlist.h'],
   output: ['pl_reserved_kwlist_d.h'],
-  command: [perl, '-I', '@SOURCE_ROOT@/src/tools', gen_keywordlist, '--output', '@OUTDIR@', '--varname', 'ReservedPLKeywords', '@INPUT@']
+  depend_files: gen_kwlist_deps,
+  command: [gen_kwlist_cmd, '--varname', 'ReservedPLKeywords'],
 )
 generated_sources += pl_reserved
 plpgsql_sources += pl_reserved
@@ -37,7 +37,8 @@ plpgsql_sources += pl_reserved
 pl_unreserved = custom_target('pl_unreserved_kwlist',
   input: ['pl_unreserved_kwlist.h'],
   output: ['pl_unreserved_kwlist_d.h'],
-  command: [perl, '-I', '@SOURCE_ROOT@/src/tools', gen_keywordlist, '--output', '@OUTDIR@', '--varname', 'UnreservedPLKeywords', '@INPUT@']
+  depend_files: gen_kwlist_deps,
+  command: [gen_kwlist_cmd, '--varname', 'UnreservedPLKeywords'],
 )
 generated_sources += pl_unreserved
 plpgsql_sources += pl_unreserved