meson: fix installation when -Dlibexexdir is set

commit 837f637cf5 ("meson.build: correct setting of GIT_EXEC_PATH", 2025-05-19) corrected the GIT_EXEC_PATH build setting, but then forgot to update the installation path for the library executables. This causes a regression when attempting to execute commands, after installing to a non-standard location (reported here[1]): $ meson -Dprefix=/tmp/git -Dlibexecdir=libexec-different build $ meson install $ /tmp/git/bin/git --exec-path /tmp/git/libexec-different $ /tmp/git/bin/git daemon git: 'daemon' is not a git command. See 'git --help' In order to fix the issue, use the 'git_exec_path' variable (calculated while processing -Dlibexecdir) as the 'install_dir' field during the installation of the library executables. [1]: <66fd343a-1351-4350-83eb-c797e47b7693@gmail.com> Reported-by: irecca.kun@gmail.com Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ramsay Jones committed Jul 16, 2025 at 00:32 UTC 586919c3b2b76f11d22e2ce571cb95b8e4bfbd2a
1 file changed +21 -21
meson.build
+21 -21
@@ -1744,7 +1744,7 @@ git_builtin = executable('git',
1744 sources: builtin_sources + 'git.c',
1745 dependencies: [libgit_commonmain],
1746 install: true,
1747 - install_dir: get_option('libexecdir') / 'git-core',
1747 + install_dir: git_exec_path,
1748 )
1749 bin_wrappers += git_builtin
1750
@@ -1752,35 +1752,35 @@ test_dependencies += executable('git-daemon',
1752 sources: 'daemon.c',
1753 dependencies: [libgit_commonmain],
1754 install: true,
1755 - install_dir: get_option('libexecdir') / 'git-core',
1755 + install_dir: git_exec_path,
1756 )
1757
1758 test_dependencies += executable('git-sh-i18n--envsubst',
1759 sources: 'sh-i18n--envsubst.c',
1760 dependencies: [libgit_commonmain],
1761 install: true,
1762 - install_dir: get_option('libexecdir') / 'git-core',
1762 + install_dir: git_exec_path,
1763 )
1764
1765 bin_wrappers += executable('git-shell',
1766 sources: 'shell.c',
1767 dependencies: [libgit_commonmain],
1768 install: true,
1769 - install_dir: get_option('libexecdir') / 'git-core',
1769 + install_dir: git_exec_path,
1770 )
1771
1772 test_dependencies += executable('git-http-backend',
1773 sources: 'http-backend.c',
1774 dependencies: [libgit_commonmain],
1775 install: true,
1776 - install_dir: get_option('libexecdir') / 'git-core',
1776 + install_dir: git_exec_path,
1777 )
1778
1779 bin_wrappers += executable('scalar',
1780 sources: 'scalar.c',
1781 dependencies: [libgit_commonmain],
1782 install: true,
1783 - install_dir: get_option('libexecdir') / 'git-core',
1783 + install_dir: git_exec_path,
1784 )
1785
1786 if curl.found()
@@ -1796,14 +1796,14 @@ if curl.found()
1796 sources: 'remote-curl.c',
1797 dependencies: [libgit_curl],
1798 install: true,
1799 - install_dir: get_option('libexecdir') / 'git-core',
1799 + install_dir: git_exec_path,
1800 )
1801
1802 test_dependencies += executable('git-http-fetch',
1803 sources: 'http-fetch.c',
1804 dependencies: [libgit_curl],
1805 install: true,
1806 - install_dir: get_option('libexecdir') / 'git-core',
1806 + install_dir: git_exec_path,
1807 )
1808
1809 if expat.found()
@@ -1811,7 +1811,7 @@ if curl.found()
1811 sources: 'http-push.c',
1812 dependencies: [libgit_curl],
1813 install: true,
1814 - install_dir: get_option('libexecdir') / 'git-core',
1814 + install_dir: git_exec_path,
1815 )
1816 endif
1817
@@ -1822,7 +1822,7 @@ if curl.found()
1822 )
1823
1824 install_symlink(alias + executable_suffix,
1825 - install_dir: get_option('libexecdir') / 'git-core',
1825 + install_dir: git_exec_path,
1826 pointing_to: 'git-remote-http',
1827 )
1828 endforeach
@@ -1832,7 +1832,7 @@ test_dependencies += executable('git-imap-send',
1832 sources: 'imap-send.c',
1833 dependencies: [ use_curl_for_imap_send ? libgit_curl : libgit_commonmain ],
1834 install: true,
1835 - install_dir: get_option('libexecdir') / 'git-core',
1835 + install_dir: git_exec_path,
1836 )
1837
1838 foreach alias : [ 'git-receive-pack', 'git-upload-archive', 'git-upload-pack' ]
@@ -1842,7 +1842,7 @@ foreach alias : [ 'git-receive-pack', 'git-upload-archive', 'git-upload-pack' ]
1842 )
1843
1844 install_symlink(alias + executable_suffix,
1845 - install_dir: get_option('libexecdir') / 'git-core',
1845 + install_dir: git_exec_path,
1846 pointing_to: 'git',
1847 )
1848 endforeach
@@ -1856,9 +1856,9 @@ foreach symlink : [
1856 'scalar',
1857 ]
1858 if meson.version().version_compare('>=1.3.0')
1859 - pointing_to = fs.relative_to(get_option('libexecdir') / 'git-core' / symlink, get_option('bindir'))
1859 + pointing_to = fs.relative_to(git_exec_path / symlink, get_option('bindir'))
1860 else
1861 - pointing_to = '../libexec/git-core' / symlink
1861 + pointing_to = '..' / git_exec_path / symlink
1862 endif
1863
1864 install_symlink(symlink,
@@ -1898,7 +1898,7 @@ foreach script : scripts_sh
1898 meson.project_build_root() / 'GIT-BUILD-OPTIONS',
1899 ],
1900 install: true,
1901 - install_dir: get_option('libexecdir') / 'git-core',
1901 + install_dir: git_exec_path,
1902 )
1903 endforeach
1904
@@ -1931,7 +1931,7 @@ if perl_features_enabled
1931 input: perl_header_template,
1932 output: 'GIT-PERL-HEADER',
1933 configuration: {
1934 - 'GITEXECDIR_REL': get_option('libexecdir') / 'git-core',
1934 + 'GITEXECDIR_REL': git_exec_path,
1935 'PERLLIBDIR_REL': perllibdir,
1936 'LOCALEDIR_REL': get_option('datadir') / 'locale',
1937 'INSTLIBDIR': perllibdir,
@@ -1955,7 +1955,7 @@ if perl_features_enabled
1955 output: fs.stem(script),
1956 command: generate_perl_command,
1957 install: true,
1958 - install_dir: get_option('libexecdir') / 'git-core',
1958 + install_dir: git_exec_path,
1959 depends: [git_version_file],
1960 )
1961 test_dependencies += generated_script
@@ -1964,9 +1964,9 @@ if perl_features_enabled
1964 bin_wrappers += generated_script
1965
1966 if meson.version().version_compare('>=1.3.0')
1967 - pointing_to = fs.relative_to(get_option('libexecdir') / 'git-core' / fs.stem(script), get_option('bindir'))
1967 + pointing_to = fs.relative_to(git_exec_path / fs.stem(script), get_option('bindir'))
1968 else
1969 - pointing_to = '../libexec/git-core' / fs.stem(script)
1969 + pointing_to = '..' / git_exec_path / fs.stem(script)
1970 endif
1971
1972 install_symlink(fs.stem(script),
@@ -1996,7 +1996,7 @@ if python.found()
1996 '@OUTPUT@',
1997 ],
1998 install: true,
1999 - install_dir: get_option('libexecdir') / 'git-core',
1999 + install_dir: git_exec_path,
2000 )
2001 test_dependencies += generated_python
2002 endforeach
@@ -2030,7 +2030,7 @@ mergetools = [
2030 ]
2031
2032 foreach mergetool : mergetools
2033 - install_data(mergetool, install_dir: get_option('libexecdir') / 'git-core' / 'mergetools')
2033 + install_data(mergetool, install_dir: git_exec_path / 'mergetools')
2034 endforeach
2035
2036 if intl.found()