diff --git a/meson.build b/meson.build
index ab8101d67b..69a411e8be 100644
--- a/meson.build
+++ b/meson.build
@@ -375,7 +375,7 @@ endif
 flex_wrapper = files('src/tools/pgflex')
 flex_cmd = [python, flex_wrapper,
   '--builddir', '@BUILD_ROOT@',
-  '--srcdir', '@SOURCE_ROOT@',
+  '--srcdir', meson.project_source_root(),
   '--privatedir', '@PRIVATE_DIR@',
   '--flex', flex, '--perl', perl,
   '-i', '@INPUT@', '-o', '@OUTPUT0@',
@@ -3125,7 +3125,7 @@ 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',
+  perl, '-I', meson.project_source_root() + '/src/tools',
   files('src/tools/gen_keywordlist.pl'),
   '--output', '@OUTDIR@', '@INPUT@']
 
diff --git a/src/bin/psql/meson.build b/src/bin/psql/meson.build
index f795ff2827..c1dc229bd0 100644
--- a/src/bin/psql/meson.build
+++ b/src/bin/psql/meson.build
@@ -39,7 +39,7 @@ sql_help = custom_target('psql_help',
   depfile: 'sql_help.dep',
   command: [
     perl, files('create_help.pl'),
-    '--docdir', '@SOURCE_ROOT@/doc/src/sgml/ref',
+    '--docdir', meson.project_source_root() + '/doc/src/sgml/ref',
     '--depfile', '@DEPFILE@',
     '--outdir', '@OUTDIR@',
     '--basename', 'sql_help',
diff --git a/src/common/unicode/meson.build b/src/common/unicode/meson.build
index c6a4715ccc..f979a8fde3 100644
--- a/src/common/unicode/meson.build
+++ b/src/common/unicode/meson.build
@@ -174,7 +174,7 @@ update_unicode = custom_target('update-unicode',
   depends: update_unicode_dep,
   output: ['dont-exist'],
   input: update_unicode_targets,
-  command: [cp, '@INPUT@', '@SOURCE_ROOT@/src/include/common/'],
+  command: [cp, '@INPUT@', meson.project_source_root() + '/src/include/common/'],
   build_by_default: false,
   build_always_stale: true,
 )
diff --git a/src/include/catalog/meson.build b/src/include/catalog/meson.build
index ec1cf467f6..9c0b118919 100644
--- a/src/include/catalog/meson.build
+++ b/src/include/catalog/meson.build
@@ -136,7 +136,7 @@ generated_catalog_headers = custom_target('generated_catalog_headers',
   command: [
     perl,
     files('../../backend/catalog/genbki.pl'),
-    '--include-path=@SOURCE_ROOT@/src/include',
+    '--include-path=' + meson.project_source_root() + '/src/include',
     '--set-version=' + pg_version_major.to_string(),
     '--output=@OUTDIR@', '@INPUT@'
   ],
diff --git a/src/include/utils/meson.build b/src/include/utils/meson.build
index 78c6b9b0a2..56a9ab7e07 100644
--- a/src/include/utils/meson.build
+++ b/src/include/utils/meson.build
@@ -62,7 +62,7 @@ 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@'],
+  command: [perl, '-I', meson.project_source_root() / 'src/backend/catalog/', files('../../backend/utils/Gen_fmgrtab.pl'), '--include-path=' + meson.project_source_root() + '/src/include', '--output=@OUTDIR@', '@INPUT@'],
   install: true,
   install_dir: [dir_include_server / 'utils', dir_include_server / 'utils', false],
 )
diff --git a/src/interfaces/ecpg/test/meson.build b/src/interfaces/ecpg/test/meson.build
index 4ccdf9d295..c12c58a99c 100644
--- a/src/interfaces/ecpg/test/meson.build
+++ b/src/interfaces/ecpg/test/meson.build
@@ -47,7 +47,7 @@ ecpg_preproc_test_command_start = [
   ecpg_exe,
   '--regression',
   '-I@CURRENT_SOURCE_DIR@',
-  '-I@SOURCE_ROOT@' + '/src/interfaces/ecpg/include/',
+  '-I' + meson.project_source_root() + '/src/interfaces/ecpg/include/',
 ]
 ecpg_preproc_test_command_end = [
   '-o', '@OUTPUT@', '@INPUT@'
