aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRamsay Jones <ramsay@ramsayjones.plus.com>2025-05-19 17:25:22 +0100
committerJunio C Hamano <gitster@pobox.com>2025-05-19 11:34:00 -0700
commit837f637cf51ee066e98ceefea76cc6e9c3277469 (patch)
tree056b8688605b12665310edcc4bf447afd5a5e213
parentmeson: correct path to system config/attribute files (diff)
downloadgit-837f637cf51ee066e98ceefea76cc6e9c3277469.tar.gz
git-837f637cf51ee066e98ceefea76cc6e9c3277469.zip
meson.build: correct setting of GIT_EXEC_PATH
For the non-'runtime prefix' case, the meson build sets the GIT_EXEC_PATH build variable to an absolute path equivalent to <prefix>/libexec/git-core. In comparison, the default make build sets it to a relative path equivalent to 'libexec/git-core'. Indeed, the make build requires the use of some means outside of the Makefile (eg. config.mak[.*] or the command-line) to set GIT_EXEC_PATH to anything other than 'libexec/git-core'. For example, the make invocation: $ make gitexecdir=/some/other/bin all install will build git with GIT_EXEC_PATH set to '/some/other/bin' and install the 'library' executables to that location. However, without setting the 'gitexecdir' make variable, irrespective of the 'runtime prefix' setting, the GIT_EXEC_PATH is always set to 'libexec/git-core'. The meson built-in 'libexecdir' option can be used to provide a similar configurability. The default value for the option is 'libexec'. Attempting to set the option to '' on the command-line, will reset it to the '.' string, presumably to ensure a relative path value. This commit allows the meson build, similar to the above, to configure the project like: $ meson setup --buildtype=debugoptimized -Dprefix=$HOME -Dpcre2=disabled \ -Dlibexecdir=/some/other/bin build so that the GIT_EXEC_PATH is set to '/some/other/bin'. Absent the -Dlibexecdir argument, the GIT_EXEC_PATH is set to 'libexec/git-core'. In order to correct the value of GIT_EXEC_PATH, default the value to the static string value 'libexec/git-core', and only override if the value of the 'libexecdir' option has a value different to 'libexec' or '.'. Also, like the Makefile, add a check for an absolute path when the runtime prefix option is true (and if so, error out). Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--meson.build12
1 files changed, 10 insertions, 2 deletions
diff --git a/meson.build b/meson.build
index 8e8f228a37..bd14bc15a1 100644
--- a/meson.build
+++ b/meson.build
@@ -1592,10 +1592,19 @@ else
error('Unsupported CSPRNG backend: ' + csprng_backend)
endif
+git_exec_path = 'libexec/git-core'
+libexec = get_option('libexecdir')
+if libexec != 'libexec' and libexec != '.'
+ git_exec_path = libexec
+endif
+
if get_option('runtime_prefix')
libgit_c_args += '-DRUNTIME_PREFIX'
build_options_config.set('RUNTIME_PREFIX', 'true')
- git_exec_path = get_option('libexecdir') / 'git-core'
+
+ if git_exec_path.startswith('/')
+ error('runtime_prefix requires a relative libexecdir not:', libexec)
+ endif
if compiler.has_header('mach-o/dyld.h')
libgit_c_args += '-DHAVE_NS_GET_EXECUTABLE_PATH'
@@ -1632,7 +1641,6 @@ if get_option('runtime_prefix')
endif
else
build_options_config.set('RUNTIME_PREFIX', 'false')
- git_exec_path = get_option('prefix') / get_option('libexecdir') / 'git-core'
endif
libgit_c_args += '-DGIT_EXEC_PATH="' + git_exec_path + '"'