Skip to content

Commit bd262d0

Browse files
pks-tgitster
authored andcommitted
meson: fix exec path with enabled runtime prefix
When the runtime prefix option is enabled, Git is built such that it knows to locate its binaries relative to the directory a binary is being executed from. This requires us to figure out relative paths, which is handled in `system_prefix()` by trying to strip a couple of well-known paths. One of these paths, GIT_EXEC_PATH, is expected to be absolute when runtime prefixes are enabled, but relative otherwise. And while our Makefile gets this correctly, in Meson we always wire up the absolute path, which may result in us not being able to find binaries. Fix this by conditionally injecting the paths depending on whether or not the `runtime_prefix` option is enabled. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 72f1ddf commit bd262d0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

meson.build

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,6 @@ libgit_c_args = [
691691
'-DETC_GITATTRIBUTES="' + get_option('gitattributes') + '"',
692692
'-DETC_GITCONFIG="' + get_option('gitconfig') + '"',
693693
'-DFALLBACK_RUNTIME_PREFIX="' + get_option('prefix') + '"',
694-
'-DGIT_EXEC_PATH="' + get_option('prefix') / get_option('libexecdir') / 'git-core"',
695694
'-DGIT_HOST_CPU="' + host_machine.cpu_family() + '"',
696695
'-DGIT_HTML_PATH="' + get_option('datadir') / 'doc/git-doc"',
697696
'-DGIT_INFO_PATH="' + get_option('infodir') + '"',
@@ -1466,6 +1465,7 @@ endif
14661465
if get_option('runtime_prefix')
14671466
libgit_c_args += '-DRUNTIME_PREFIX'
14681467
build_options_config.set('RUNTIME_PREFIX', 'true')
1468+
git_exec_path = get_option('libexecdir') / 'git-core'
14691469

14701470
if compiler.has_header('mach-o/dyld.h')
14711471
libgit_c_args += '-DHAVE_NS_GET_EXECUTABLE_PATH'
@@ -1502,7 +1502,9 @@ if get_option('runtime_prefix')
15021502
endif
15031503
else
15041504
build_options_config.set('RUNTIME_PREFIX', 'false')
1505+
git_exec_path = get_option('prefix') / get_option('libexecdir') / 'git-core'
15051506
endif
1507+
libgit_c_args += '-DGIT_EXEC_PATH="' + git_exec_path + '"'
15061508

15071509
git_version_file = custom_target(
15081510
command: [

0 commit comments

Comments
 (0)