{"thread":{"id":"63006","subject":"[PATCH v3 01/13] meson: fix exec path with enabled runtime prefix","startedAt":"2025-02-26T08:22:24Z","lastAt":"2025-02-26T08:22:35Z","messageCount":14,"participants":["Patrick Steinhardt"],"isPatch":true,"patchVersion":3,"patchTotal":13},"messages":[{"id":"513057","messageId":"20250226-b4-pks-meson-improvements-v3-1-60c77cf673ae@pks.im","threadId":"63006","inReplyTo":"20250226-b4-pks-meson-improvements-v3-0-60c77cf673ae@pks.im","subject":"[PATCH v3 01/13] meson: fix exec path with enabled runtime prefix","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-02-26T08:22:11Z","receivedAt":"2025-02-26T08:22:24Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"When the runtime prefix option is enabled, Git is built such that it\nknows to locate its binaries relative to the directory a binary is being\nexecuted from. This requires us to figure out relative paths, which is\nhandled in `system_prefix()` by trying to strip a couple of well-known\npaths.\n\nOne of these paths, GIT_EXEC_PATH, is expected to be absolute when\nruntime prefixes are enabled, but relative otherwise. And while our\nMakefile gets this correctly, in Meson we always wire up the absolute\npath, which may result in us not being able to find binaries.\n\nFix this by conditionally injecting the paths depending on whether or\nnot the `runtime_prefix` option is enabled.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n meson.build | 4 +++-\n 1 file changed, 3 insertions(+), 1 deletion(-)\n\ndiff --git a/meson.build b/meson.build\nindex dbc1dab605e..1f83dc58c24 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -691,7 +691,6 @@ libgit_c_args = [\n   '-DETC_GITATTRIBUTES=\"' + get_option('gitattributes') + '\"',\n   '-DETC_GITCONFIG=\"' + get_option('gitconfig') + '\"',\n   '-DFALLBACK_RUNTIME_PREFIX=\"' + get_option('prefix') + '\"',\n-  '-DGIT_EXEC_PATH=\"' + get_option('prefix') / get_option('libexecdir') / 'git-core\"',\n   '-DGIT_HOST_CPU=\"' + host_machine.cpu_family() + '\"',\n   '-DGIT_HTML_PATH=\"' + get_option('datadir') / 'doc/git-doc\"',\n   '-DGIT_INFO_PATH=\"' + get_option('infodir') + '\"',\n@@ -1466,6 +1465,7 @@ endif\n if get_option('runtime_prefix')\n   libgit_c_args += '-DRUNTIME_PREFIX'\n   build_options_config.set('RUNTIME_PREFIX', 'true')\n+  git_exec_path = get_option('libexecdir') / 'git-core'\n \n   if compiler.has_header('mach-o/dyld.h')\n     libgit_c_args += '-DHAVE_NS_GET_EXECUTABLE_PATH'\n@@ -1502,7 +1502,9 @@ if get_option('runtime_prefix')\n   endif\n else\n   build_options_config.set('RUNTIME_PREFIX', 'false')\n+  git_exec_path = get_option('prefix') / get_option('libexecdir') / 'git-core'\n endif\n+libgit_c_args += '-DGIT_EXEC_PATH=\"' + git_exec_path + '\"'\n \n git_version_file = custom_target(\n   command: [\n\n-- \n2.48.1.741.g8a9f3a5cdc.dirty\n\n"},{"id":"513058","messageId":"20250226-b4-pks-meson-improvements-v3-0-60c77cf673ae@pks.im","threadId":"63006","inReplyTo":"20250129-b4-pks-meson-improvements-v1-0-ab709f0be12c@pks.im","subject":"[PATCH v3 00/13] meson: cleanups, improvements, smallish fixes","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-02-26T08:22:10Z","receivedAt":"2025-02-26T08:22:24Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"Hi,\n\nthis patch series contains a mostly-random set of smallish improvements,\nsimplifications and fixes to the Meson build instructions.\n\nChanges in v2:\n  - Redo the two commits regarding PATH handling. We now only prepend\n    system-specific paths to PATH and handle the `-Dsane_tool_path`\n    option the same.\n  - Continue to propagate libcurl include directories into libgit, as we\n    need it for \"help.c\" to resolve LIBCURL_VERSION. Reorder the patch\n    to minimize the required changes.\n  - Fix a commit message typo.\n  - Include another commit that fixes the OpenSSL fallback on Windows.\n  - Include another commit to fix linker errors due to out-of-memory\n    situations on Windows with GitLab CI.\n  - Link to v1: https://lore.kernel.org/r/20250129-b4-pks-meson-improvements-v1-0-ab709f0be12c@pks.im\n\nChanges in v3:\n  - Fix missing linker arguments for a couple of aliased executables on\n    Windows with MSVC.\n  - Link to v2: https://lore.kernel.org/r/20250130-b4-pks-meson-improvements-v2-0-2f05581ffb44@pks.im\n\nI've kicked off an extra pipeline at [1] to verify that this version\nworks on next and doesn't break anything.\n\nThanks!\n\nPatrick\n\n[1]: https://github.com/git/git/pull/1898\n\n---\nPatrick Steinhardt (13):\n      meson: fix exec path with enabled runtime prefix\n      meson: fix OpenSSL fallback when not explicitly required\n      meson: inline the static 'git' library\n      meson: simplify use of the common-main library\n      meson: introduce `libgit_curl` dependency\n      meson: stop linking libcurl into all executables\n      meson: drop separate version library\n      meson: improve PATH handling\n      meson: improve handling of `sane_tool_path` option\n      meson: prevent finding sed(1) in a loop\n      meson: fix overwritten `git` variable\n      meson: consistently use custom program paths to resolve programs\n      gitlab-ci: restrict maximum number of link jobs on Windows\n\n .gitlab-ci.yml                  |   2 +-\n Documentation/howto/meson.build |   2 +-\n Documentation/meson.build       |  13 ++--\n meson.build                     | 156 +++++++++++++++++++---------------------\n meson_options.txt               |   4 +-\n oss-fuzz/meson.build            |   2 +-\n t/helper/meson.build            |   4 +-\n t/meson.build                   |   4 +-\n 8 files changed, 89 insertions(+), 98 deletions(-)\n\nRange-diff versus v2:\n\n 1:  94730a8bdb4 =  1:  fd7097ab8bd meson: fix exec path with enabled runtime prefix\n 2:  97710a79d0f =  2:  ff8d4cd70c6 meson: fix OpenSSL fallback when not explicitly required\n 3:  66a8c6f24d0 =  3:  238a45c8bb0 meson: inline the static 'git' library\n 4:  f717119b1a0 !  4:  1bd9f892310 meson: simplify use of the common-main library\n    @@ Commit message\n         instead of creating a static library, we now instead compile the common\n         set of files into each executable separately.\n     \n    -    This change surfaces an issue when linking aliases for git-remote-http:\n    -    we extract all objects from `git-remote-http` et al and then link them\n    -    into the new executable. As such, these objects would already contain\n    -    a `main()` function. But now that we also compile \"common-main.c\" into\n    -    these aliased executables we see a linker error due to `main()` being\n    -    defined twice. We fix this by only linking against `libgit.a`.\n    -\n         Signed-off-by: Patrick Steinhardt <ps@pks.im>\n     \n      ## meson.build ##\n    @@ meson.build: if host_machine.system() == 'windows'\n        endif\n      endif\n     -common_main_library = static_library('common-main',\n    -+\n    -+libgit_commonmain = declare_dependency(\n    -   sources: common_main_sources,\n    +-  sources: common_main_sources,\n     -  c_args: libgit_c_args,\n     -  dependencies: libgit_dependencies,\n     -  include_directories: libgit_include_directories,\n     -)\n     -common_main = declare_dependency(\n     -  link_with: common_main_library,\n    ++\n    ++libgit_commonmain = declare_dependency(\n    ++  link_with: static_library('common-main',\n    ++    sources: common_main_sources,\n    ++    dependencies: [ libgit ],\n    ++  ),\n        link_args: common_main_link_args,\n     +  dependencies: [ libgit ],\n      )\n    @@ meson.build: if get_option('curl').enabled()\n          test_dependencies += executable(alias,\n            objects: git_remote_http.extract_all_objects(recursive: false),\n     -      dependencies: [libgit, common_main],\n    -+      dependencies: [libgit],\n    ++      dependencies: [libgit_commonmain],\n          )\n      \n          install_symlink(alias + executable_suffix,\n    @@ meson.build: test_dependencies += executable('git-imap-send',\n        bin_wrappers += executable(alias,\n          objects: git.extract_all_objects(recursive: false),\n     -    dependencies: [libgit, common_main],\n    -+    dependencies: [libgit],\n    ++    dependencies: [libgit_commonmain],\n        )\n      \n        install_symlink(alias + executable_suffix,\n 5:  1b61303b130 !  5:  024f4297f5e meson: introduce `libgit_curl` dependency\n    @@ meson.build: if get_option('curl').enabled()\n        foreach alias : [ 'git-remote-https', 'git-remote-ftp', 'git-remote-ftps' ]\n          test_dependencies += executable(alias,\n     -      objects: git_remote_http.extract_all_objects(recursive: false),\n    --      dependencies: [libgit],\n    +-      dependencies: [libgit_commonmain],\n     +      sources: 'remote-curl.c',\n     +      dependencies: [libgit_curl],\n          )\n 6:  70dc5edc05c =  6:  7fa4957e256 meson: stop linking libcurl into all executables\n 7:  7fe6d1d4e74 =  7:  b24c4e06deb meson: drop separate version library\n 8:  1d0597eb7cf =  8:  8ca171f9694 meson: improve PATH handling\n 9:  9219ab697a7 =  9:  beedc776a7b meson: improve handling of `sane_tool_path` option\n10:  7e3e0bb409f = 10:  018f549375f meson: prevent finding sed(1) in a loop\n11:  c1243c17dbe ! 11:  3da8f4f105d meson: fix overwritten `git` variable\n    @@ meson.build: test_dependencies += executable('git-imap-send',\n        bin_wrappers += executable(alias,\n     -    objects: git.extract_all_objects(recursive: false),\n     +    objects: git_builtin.extract_all_objects(recursive: false),\n    -     dependencies: [libgit],\n    +     dependencies: [libgit_commonmain],\n        )\n      \n12:  f06585cd99e = 12:  b2febf1acac meson: consistently use custom program paths to resolve programs\n13:  02f0ffdd362 = 13:  f5bb92726dc gitlab-ci: restrict maximum number of link jobs on Windows\n\n---\nbase-commit: 6dd4e543f2219290db9faa61b30f7f30a34e4b50\nchange-id: 20250121-b4-pks-meson-improvements-3e575363e91c\n\n"},{"id":"513059","messageId":"20250226-b4-pks-meson-improvements-v3-3-60c77cf673ae@pks.im","threadId":"63006","inReplyTo":"20250226-b4-pks-meson-improvements-v3-0-60c77cf673ae@pks.im","subject":"[PATCH v3 03/13] meson: inline the static 'git' library","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-02-26T08:22:13Z","receivedAt":"2025-02-26T08:22:25Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"When setting up `libgit.a` we first create the static library itself,\nand then declare it as part of a dependency such that compile arguments,\ninclude directories and transitive dependencies get propagated to the\nusers of that library. As such, the static library isn't expected to be\nused by anything but the declared dependency.\n\nInline the static library so that we don't even use a separate variable\nfor it. This avoids any kind of confusion that may arise and clarifies\nhow the library is supposed to be used.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n meson.build | 16 +++++++---------\n 1 file changed, 7 insertions(+), 9 deletions(-)\n\ndiff --git a/meson.build b/meson.build\nindex 83ed55c75c6..a124101a73a 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -1555,17 +1555,15 @@ libgit_version_library = static_library('git-version',\n   include_directories: libgit_include_directories,\n )\n \n-libgit_library = static_library('git',\n-  sources: libgit_sources,\n-  c_args: libgit_c_args,\n-  link_with: libgit_version_library,\n-  dependencies: libgit_dependencies,\n-  include_directories: libgit_include_directories,\n-)\n-\n libgit = declare_dependency(\n+  link_with: static_library('git',\n+    sources: libgit_sources,\n+    c_args: libgit_c_args,\n+    link_with: libgit_version_library,\n+    dependencies: libgit_dependencies,\n+    include_directories: libgit_include_directories,\n+  ),\n   compile_args: libgit_c_args,\n-  link_with: libgit_library,\n   dependencies: libgit_dependencies,\n   include_directories: libgit_include_directories,\n )\n\n-- \n2.48.1.741.g8a9f3a5cdc.dirty\n\n"},{"id":"513062","messageId":"20250226-b4-pks-meson-improvements-v3-2-60c77cf673ae@pks.im","threadId":"63006","inReplyTo":"20250226-b4-pks-meson-improvements-v3-0-60c77cf673ae@pks.im","subject":"[PATCH v3 02/13] meson: fix OpenSSL fallback when not explicitly required","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-02-26T08:22:12Z","receivedAt":"2025-02-26T08:22:25Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"When OpenSSL isn't provided by the system we know to fall back to the\nsubproject wrapper. This is especially helpful on Windows systems, where\nyou typically don't have OpenSSL available, in order to reduce the\nnumber of required dependencies.\n\nThe fallback is broken though when the OpenSSL backend is set to 'auto'\nas we end up calling `dependency('openssl', required: false)` in that\ncase, which implicitly disables falling back to the wrapper.\n\nFix the issue by re-allowing the fallback in case either OpenSSL is\nrequired or in case the backend is set to 'auto'. While at it, fix\nreporting of the backend in case the user asked us to pick no HTTPS\nbackend at all.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n meson.build | 7 ++++++-\n 1 file changed, 6 insertions(+), 1 deletion(-)\n\ndiff --git a/meson.build b/meson.build\nindex 1f83dc58c24..83ed55c75c6 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -1352,7 +1352,11 @@ if https_backend == 'auto' and security_framework.found()\n endif\n \n openssl_required = 'openssl' in [csprng_backend, https_backend, sha1_backend, sha1_unsafe_backend, sha256_backend]\n-openssl = dependency('openssl', required: openssl_required, default_options: ['default_library=static'])\n+openssl = dependency('openssl',\n+  required: openssl_required,\n+  allow_fallback: openssl_required or https_backend == 'auto',\n+  default_options: ['default_library=static'],\n+)\n if https_backend == 'auto' and openssl.found()\n   https_backend = 'openssl'\n endif\n@@ -1366,6 +1370,7 @@ elif https_backend == 'openssl'\n else\n   # We either couldn't find any dependencies with 'auto' or the user requested\n   # 'none'. Both cases are benign.\n+  https_backend = 'none'\n endif\n \n if https_backend != 'openssl'\n\n-- \n2.48.1.741.g8a9f3a5cdc.dirty\n\n"},{"id":"513060","messageId":"20250226-b4-pks-meson-improvements-v3-4-60c77cf673ae@pks.im","threadId":"63006","inReplyTo":"20250226-b4-pks-meson-improvements-v3-0-60c77cf673ae@pks.im","subject":"[PATCH v3 04/13] meson: simplify use of the common-main library","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-02-26T08:22:14Z","receivedAt":"2025-02-26T08:22:27Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"The \"common-main.c\" file is used by multiple executables. In order to\nmake it easy to set it up we have created a separate library that these\nexecutables can link against. All of these executables also want to link\nagainst `libgit.a` though, which makes it necessary to specify both of\nthese as dependencies for every executable.\n\nSimplify this a bit by declaring the library as a source dependency:\ninstead of creating a static library, we now instead compile the common\nset of files into each executable separately.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n meson.build          | 39 +++++++++++++++++++--------------------\n oss-fuzz/meson.build |  2 +-\n t/helper/meson.build |  4 ++--\n t/meson.build        |  4 ++--\n 4 files changed, 24 insertions(+), 25 deletions(-)\n\ndiff --git a/meson.build b/meson.build\nindex a124101a73a..7236c163374 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -1604,15 +1604,14 @@ if host_machine.system() == 'windows'\n     error('Unsupported compiler ' + compiler.get_id())\n   endif\n endif\n-common_main_library = static_library('common-main',\n-  sources: common_main_sources,\n-  c_args: libgit_c_args,\n-  dependencies: libgit_dependencies,\n-  include_directories: libgit_include_directories,\n-)\n-common_main = declare_dependency(\n-  link_with: common_main_library,\n+\n+libgit_commonmain = declare_dependency(\n+  link_with: static_library('common-main',\n+    sources: common_main_sources,\n+    dependencies: [ libgit ],\n+  ),\n   link_args: common_main_link_args,\n+  dependencies: [ libgit ],\n )\n \n bin_wrappers = [ ]\n@@ -1620,7 +1619,7 @@ test_dependencies = [ ]\n \n git = executable('git',\n   sources: builtin_sources + 'git.c',\n-  dependencies: [libgit, common_main],\n+  dependencies: [libgit_commonmain],\n   install: true,\n   install_dir: get_option('libexecdir') / 'git-core',\n )\n@@ -1628,35 +1627,35 @@ bin_wrappers += git\n \n test_dependencies += executable('git-daemon',\n   sources: 'daemon.c',\n-  dependencies: [libgit, common_main],\n+  dependencies: [libgit_commonmain],\n   install: true,\n   install_dir: get_option('libexecdir') / 'git-core',\n )\n \n test_dependencies += executable('git-sh-i18n--envsubst',\n   sources: 'sh-i18n--envsubst.c',\n-  dependencies: [libgit, common_main],\n+  dependencies: [libgit_commonmain],\n   install: true,\n   install_dir: get_option('libexecdir') / 'git-core',\n )\n \n bin_wrappers += executable('git-shell',\n   sources: 'shell.c',\n-  dependencies: [libgit, common_main],\n+  dependencies: [libgit_commonmain],\n   install: true,\n   install_dir: get_option('libexecdir') / 'git-core',\n )\n \n test_dependencies += executable('git-http-backend',\n   sources: 'http-backend.c',\n-  dependencies: [libgit, common_main],\n+  dependencies: [libgit_commonmain],\n   install: true,\n   install_dir: get_option('libexecdir') / 'git-core',\n )\n \n bin_wrappers += executable('scalar',\n   sources: 'scalar.c',\n-  dependencies: [libgit, common_main],\n+  dependencies: [libgit_commonmain],\n   install: true,\n   install_dir: get_option('libexecdir') / 'git-core',\n )\n@@ -1669,7 +1668,7 @@ if get_option('curl').enabled()\n \n   git_remote_http = executable('git-remote-http',\n     sources: curl_sources + 'remote-curl.c',\n-    dependencies: [libgit, common_main],\n+    dependencies: [libgit_commonmain],\n     install: true,\n     install_dir: get_option('libexecdir') / 'git-core',\n   )\n@@ -1677,7 +1676,7 @@ if get_option('curl').enabled()\n \n   test_dependencies += executable('git-http-fetch',\n     sources: curl_sources + 'http-fetch.c',\n-    dependencies: [libgit, common_main],\n+    dependencies: [libgit_commonmain],\n     install: true,\n     install_dir: get_option('libexecdir') / 'git-core',\n   )\n@@ -1685,7 +1684,7 @@ if get_option('curl').enabled()\n   if expat.found()\n     test_dependencies += executable('git-http-push',\n       sources: curl_sources + 'http-push.c',\n-      dependencies: [libgit, common_main],\n+      dependencies: [libgit_commonmain],\n       install: true,\n       install_dir: get_option('libexecdir') / 'git-core',\n     )\n@@ -1694,7 +1693,7 @@ if get_option('curl').enabled()\n   foreach alias : [ 'git-remote-https', 'git-remote-ftp', 'git-remote-ftps' ]\n     test_dependencies += executable(alias,\n       objects: git_remote_http.extract_all_objects(recursive: false),\n-      dependencies: [libgit, common_main],\n+      dependencies: [libgit_commonmain],\n     )\n \n     install_symlink(alias + executable_suffix,\n@@ -1711,7 +1710,7 @@ endif\n \n test_dependencies += executable('git-imap-send',\n   sources: imap_send_sources,\n-  dependencies: [libgit, common_main],\n+  dependencies: [libgit_commonmain],\n   install: true,\n   install_dir: get_option('libexecdir') / 'git-core',\n )\n@@ -1719,7 +1718,7 @@ test_dependencies += executable('git-imap-send',\n foreach alias : [ 'git-receive-pack', 'git-upload-archive', 'git-upload-pack' ]\n   bin_wrappers += executable(alias,\n     objects: git.extract_all_objects(recursive: false),\n-    dependencies: [libgit, common_main],\n+    dependencies: [libgit_commonmain],\n   )\n \n   install_symlink(alias + executable_suffix,\ndiff --git a/oss-fuzz/meson.build b/oss-fuzz/meson.build\nindex ed796655016..878afd8426f 100644\n--- a/oss-fuzz/meson.build\n+++ b/oss-fuzz/meson.build\n@@ -15,6 +15,6 @@ foreach fuzz_program : fuzz_programs\n       'dummy-cmd-main.c',\n       fuzz_program,\n     ],\n-    dependencies: [libgit, common_main],\n+    dependencies: [libgit_commonmain],\n   )\n endforeach\ndiff --git a/t/helper/meson.build b/t/helper/meson.build\nindex f502d1aaa36..ae01b3fc45d 100644\n--- a/t/helper/meson.build\n+++ b/t/helper/meson.build\n@@ -79,14 +79,14 @@ test_tool_sources = [\n \n test_tool = executable('test-tool',\n   sources: test_tool_sources,\n-  dependencies: [libgit, common_main],\n+  dependencies: [libgit_commonmain],\n )\n bin_wrappers += test_tool\n test_dependencies += test_tool\n \n test_fake_ssh = executable('test-fake-ssh',\n   sources: 'test-fake-ssh.c',\n-  dependencies: [libgit, common_main],\n+  dependencies: [libgit_commonmain],\n )\n bin_wrappers += test_fake_ssh\n test_dependencies += test_fake_ssh\ndiff --git a/t/meson.build b/t/meson.build\nindex 35f25ca4a1d..dae50601fec 100644\n--- a/t/meson.build\n+++ b/t/meson.build\n@@ -39,7 +39,7 @@ clar_sources += custom_target(\n \n clar_unit_tests = executable('unit-tests',\n   sources: clar_sources + clar_test_suites,\n-  dependencies: [libgit, common_main],\n+  dependencies: [libgit_commonmain],\n )\n test('unit-tests', clar_unit_tests)\n \n@@ -72,7 +72,7 @@ foreach unit_test_program : unit_test_programs\n       'unit-tests/lib-reftable.c',\n       unit_test_program,\n     ],\n-    dependencies: [libgit, common_main],\n+    dependencies: [libgit_commonmain],\n   )\n   test(unit_test_name, unit_test,\n     workdir: meson.current_source_dir(),\n\n-- \n2.48.1.741.g8a9f3a5cdc.dirty\n\n"},{"id":"513061","messageId":"20250226-b4-pks-meson-improvements-v3-5-60c77cf673ae@pks.im","threadId":"63006","inReplyTo":"20250226-b4-pks-meson-improvements-v3-0-60c77cf673ae@pks.im","subject":"[PATCH v3 05/13] meson: introduce `libgit_curl` dependency","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-02-26T08:22:15Z","receivedAt":"2025-02-26T08:22:27Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"We've got a set of common source files that we use for those executables\nthat link against libcurl. The setup is somewhat repetitive though.\nSimplify it by declaring a `libgit_curl` dependency that bundles all of\nit together.\n\nNote that we don't include curl itself as a dependency. This is because\nwe already pull it in transitively via the libgit dependency, which is\nunfortunate because libgit itself shouldn't actually link against curl\nin the first place. This will get fixed in the next commit.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n meson.build | 39 ++++++++++++++++++---------------------\n 1 file changed, 18 insertions(+), 21 deletions(-)\n\ndiff --git a/meson.build b/meson.build\nindex 7236c163374..e58462ac4fe 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -1661,30 +1661,32 @@ bin_wrappers += executable('scalar',\n )\n \n if get_option('curl').enabled()\n-  curl_sources = [\n-    'http.c',\n-    'http-walker.c',\n-  ]\n-\n-  git_remote_http = executable('git-remote-http',\n-    sources: curl_sources + 'remote-curl.c',\n+  libgit_curl = declare_dependency(\n+    sources: [\n+      'http.c',\n+      'http-walker.c',\n+    ],\n     dependencies: [libgit_commonmain],\n+  )\n+\n+  test_dependencies += executable('git-remote-http',\n+    sources: 'remote-curl.c',\n+    dependencies: [libgit_curl],\n     install: true,\n     install_dir: get_option('libexecdir') / 'git-core',\n   )\n-  test_dependencies += git_remote_http\n \n   test_dependencies += executable('git-http-fetch',\n-    sources: curl_sources + 'http-fetch.c',\n-    dependencies: [libgit_commonmain],\n+    sources: 'http-fetch.c',\n+    dependencies: [libgit_curl],\n     install: true,\n     install_dir: get_option('libexecdir') / 'git-core',\n   )\n \n   if expat.found()\n     test_dependencies += executable('git-http-push',\n-      sources: curl_sources + 'http-push.c',\n-      dependencies: [libgit_commonmain],\n+      sources: 'http-push.c',\n+      dependencies: [libgit_curl],\n       install: true,\n       install_dir: get_option('libexecdir') / 'git-core',\n     )\n@@ -1692,8 +1694,8 @@ if get_option('curl').enabled()\n \n   foreach alias : [ 'git-remote-https', 'git-remote-ftp', 'git-remote-ftps' ]\n     test_dependencies += executable(alias,\n-      objects: git_remote_http.extract_all_objects(recursive: false),\n-      dependencies: [libgit_commonmain],\n+      sources: 'remote-curl.c',\n+      dependencies: [libgit_curl],\n     )\n \n     install_symlink(alias + executable_suffix,\n@@ -1703,14 +1705,9 @@ if get_option('curl').enabled()\n   endforeach\n endif\n \n-imap_send_sources = ['imap-send.c']\n-if use_curl_for_imap_send\n-  imap_send_sources += curl_sources\n-endif\n-\n test_dependencies += executable('git-imap-send',\n-  sources: imap_send_sources,\n-  dependencies: [libgit_commonmain],\n+  sources: 'imap-send.c',\n+  dependencies: [ use_curl_for_imap_send ? libgit_curl : libgit_commonmain ],\n   install: true,\n   install_dir: get_option('libexecdir') / 'git-core',\n )\n\n-- \n2.48.1.741.g8a9f3a5cdc.dirty\n\n"},{"id":"513063","messageId":"20250226-b4-pks-meson-improvements-v3-6-60c77cf673ae@pks.im","threadId":"63006","inReplyTo":"20250226-b4-pks-meson-improvements-v3-0-60c77cf673ae@pks.im","subject":"[PATCH v3 06/13] meson: stop linking libcurl into all executables","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-02-26T08:22:16Z","receivedAt":"2025-02-26T08:22:28Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"We set up libcurl via the `libgit_dependencies` variable, which gets\npropagated into every user of the `libgit` dependency. This is not\nnecessary though, as most of our executables aren't even supposed to\nlink against libcurl.\n\nFix this by only propagating include directories as a libgit dependency\nand propagating the full curl dependency via `libgit_curl`.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n meson.build | 6 ++++--\n 1 file changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/meson.build b/meson.build\nindex e58462ac4fe..39d15ee6cb8 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -927,7 +927,9 @@ if curl.found()\n     use_curl_for_imap_send = true\n   endif\n \n-  libgit_dependencies += curl\n+  # Most executables don't have to link against libcurl, but we still need its\n+  # include directories so that we can resolve LIBCURL_VERSION in \"help.c\".\n+  libgit_dependencies += curl.partial_dependency(includes: true)\n   libgit_c_args += '-DCURL_DISABLE_TYPECHECK'\n   build_options_config.set('NO_CURL', '')\n else\n@@ -1666,7 +1668,7 @@ if get_option('curl').enabled()\n       'http.c',\n       'http-walker.c',\n     ],\n-    dependencies: [libgit_commonmain],\n+    dependencies: [libgit_commonmain, curl],\n   )\n \n   test_dependencies += executable('git-remote-http',\n\n-- \n2.48.1.741.g8a9f3a5cdc.dirty\n\n"},{"id":"513065","messageId":"20250226-b4-pks-meson-improvements-v3-7-60c77cf673ae@pks.im","threadId":"63006","inReplyTo":"20250226-b4-pks-meson-improvements-v3-0-60c77cf673ae@pks.im","subject":"[PATCH v3 07/13] meson: drop separate version library","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-02-26T08:22:17Z","receivedAt":"2025-02-26T08:22:28Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"When building `libgit.a` we link it against a `libgit_version.a` library\nthat contains the version information that we inject at build time. The\nintent of this is to avoid rebuilding all of `libgit.a` whenever the\nversion changes. But that wouldn't happen in the first place, as we know\nto just rebuild the files that depend on the generated \"version-def.h\"\nfile.\n\nThis is an artifact of an earlier version of the Meson build infra that\ndidn't ultimately land. We didn't yet have \"version-def.h\", and instead\ninjected the version via preprocessor directives. And here we would have\nrebuilt all of `libgit.a` indeed in case the version changes, because\nthe preprocessor directive applied to all files.\n\nStop building the separate library and instead add \"version-def.h\" to\nthe list of source files directly.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n meson.build | 21 +++++----------------\n 1 file changed, 5 insertions(+), 16 deletions(-)\n\ndiff --git a/meson.build b/meson.build\nindex 39d15ee6cb8..c8df19804ae 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -478,6 +478,7 @@ libgit_sources = [\n   'userdiff.c',\n   'utf8.c',\n   'varint.c',\n+  'version.c',\n   'versioncmp.c',\n   'walker.c',\n   'wildmatch.c',\n@@ -1542,26 +1543,14 @@ version_def_h = custom_target(\n   depends: [git_version_file],\n   env: version_gen_environment,\n )\n-\n-# Build a separate library for \"version.c\" so that we do not have to rebuild\n-# everything when the current Git commit changes.\n-libgit_version_library = static_library('git-version',\n-  sources: [\n-    'version.c',\n-    version_def_h,\n-  ],\n-  c_args: libgit_c_args + [\n-    '-DGIT_VERSION_H=\"' + version_def_h.full_path() + '\"',\n-  ],\n-  dependencies: libgit_dependencies,\n-  include_directories: libgit_include_directories,\n-)\n+libgit_sources += version_def_h\n \n libgit = declare_dependency(\n   link_with: static_library('git',\n     sources: libgit_sources,\n-    c_args: libgit_c_args,\n-    link_with: libgit_version_library,\n+    c_args: libgit_c_args + [\n+      '-DGIT_VERSION_H=\"' + version_def_h.full_path() + '\"',\n+    ],\n     dependencies: libgit_dependencies,\n     include_directories: libgit_include_directories,\n   ),\n\n-- \n2.48.1.741.g8a9f3a5cdc.dirty\n\n"},{"id":"513064","messageId":"20250226-b4-pks-meson-improvements-v3-8-60c77cf673ae@pks.im","threadId":"63006","inReplyTo":"20250226-b4-pks-meson-improvements-v3-0-60c77cf673ae@pks.im","subject":"[PATCH v3 08/13] meson: improve PATH handling","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-02-26T08:22:18Z","receivedAt":"2025-02-26T08:22:29Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"When locating programs required for the build we give some special\ntreatment to Windows systems so that we know to also look up tools\nprovided by a Git for Windows installation. This ensures that the build\ndoesn't have any prerequisites other than Microsoft Visual Studio, Meson\nand Git for Windows.\n\nConsequently, some of the programs returned by `find_program()` may not\nbe found via PATH, but via these extra directories. But while Meson can\nuse these tools directly without any special treatment, any scripts that\nwe execute may not be able to find those programs. To help them we thus\nprepend the directories of a subset of the found programs to PATH.\n\nThis doesn't make much sense though: we don't need to prepend PATH for\nany program that was found via PATH, but we really only need to do so\nfor programs located via the extraneous Windows-specific paths. So\ninstead of prepending all programs paths, we really only need to prepend\nthe Windows-specific paths.\n\nAdapt the code accordingly by only prepeding Windows-specific paths to\nPATH, which both simplifies the code and clarifies intent.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n meson.build | 14 +++++++-------\n 1 file changed, 7 insertions(+), 7 deletions(-)\n\ndiff --git a/meson.build b/meson.build\nindex c8df19804ae..acd6074b32d 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -198,19 +198,19 @@ endif\n \n cygpath = find_program('cygpath', dirs: program_path, required: false)\n diff = find_program('diff', dirs: program_path)\n+git = find_program('git', dirs: program_path, required: false)\n shell = find_program('sh', dirs: program_path)\n tar = find_program('tar', dirs: program_path)\n \n-script_environment = environment()\n+# Sanity-check that programs required for the build exist.\n foreach tool : ['cat', 'cut', 'grep', 'sed', 'sort', 'tr', 'uname']\n-  program = find_program(tool, dirs: program_path)\n-  script_environment.prepend('PATH', fs.parent(program.full_path()))\n+  find_program(tool, dirs: program_path)\n endforeach\n \n-git = find_program('git', dirs: program_path, required: false)\n-if git.found()\n-  script_environment.prepend('PATH', fs.parent(git.full_path()))\n-endif\n+script_environment = environment()\n+foreach path : program_path\n+  script_environment.prepend('PATH', path)\n+endforeach\n \n if get_option('sane_tool_path') != ''\n   script_environment.prepend('PATH', get_option('sane_tool_path'))\n\n-- \n2.48.1.741.g8a9f3a5cdc.dirty\n\n"},{"id":"513066","messageId":"20250226-b4-pks-meson-improvements-v3-9-60c77cf673ae@pks.im","threadId":"63006","inReplyTo":"20250226-b4-pks-meson-improvements-v3-0-60c77cf673ae@pks.im","subject":"[PATCH v3 09/13] meson: improve handling of `sane_tool_path` option","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-02-26T08:22:19Z","receivedAt":"2025-02-26T08:22:29Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"The `sane_tool_path` option can be used to override the PATH variable\nfrom which the build process, tests and ultimately Git will end up\npicking programs from. It is currently lacking though because we only\nuse it to populate the PATH environment variable for executed scripts\nand for the `BROKEN_PATH_FIX` mechanism, but we don't use it to find\nprograms used in the build process itself.\n\nFix this issue by treating it similar to the Windows-specific paths,\nwhich will make us use it both to find programs and to populate the PATH\nenvironment variable.\n\nTo help with this fix, change the type of the option to be an array of\npaths, which makes the handling a bit easier for us. It's also the\ncorrect thing to do as the input indeed is a list of paths.\n\nFurthermore, the option now overrides the default behaviour on Windows,\nwhich si to pick up tools from Git for Windows. This is done so that it\nbecomes easier to override that default behaviour in case it's not\ndesired.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n meson.build       | 17 ++++++++---------\n meson_options.txt |  4 ++--\n 2 files changed, 10 insertions(+), 11 deletions(-)\n\ndiff --git a/meson.build b/meson.build\nindex acd6074b32d..ed857aaa4ab 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -191,9 +191,11 @@ project('git', 'c',\n fs = import('fs')\n \n program_path = []\n-# Git for Windows provides all the tools we need to build Git.\n-if host_machine.system() == 'windows'\n-  program_path += [ 'C:/Program Files/Git/bin', 'C:/Program Files/Git/usr/bin' ]\n+if get_option('sane_tool_path').length() != 0\n+  program_path = get_option('sane_tool_path')\n+elif host_machine.system() == 'windows'\n+  # Git for Windows provides all the tools we need to build Git.\n+  program_path = [ 'C:/Program Files/Git/bin', 'C:/Program Files/Git/usr/bin' ]\n endif\n \n cygpath = find_program('cygpath', dirs: program_path, required: false)\n@@ -212,10 +214,6 @@ foreach path : program_path\n   script_environment.prepend('PATH', path)\n endforeach\n \n-if get_option('sane_tool_path') != ''\n-  script_environment.prepend('PATH', get_option('sane_tool_path'))\n-endif\n-\n # The environment used by GIT-VERSION-GEN. Note that we explicitly override\n # environment variables that might be set by the user. This is by design so\n # that we always use whatever Meson has configured instead of what is present\n@@ -671,8 +669,9 @@ build_options_config.set('GIT_TEST_UTF8_LOCALE', '')\n build_options_config.set_quoted('LOCALEDIR', fs.as_posix(get_option('prefix') / get_option('localedir')))\n build_options_config.set('GITWEBDIR', fs.as_posix(get_option('prefix') / get_option('datadir') / 'gitweb'))\n \n-if get_option('sane_tool_path') != ''\n-  build_options_config.set_quoted('BROKEN_PATH_FIX', 's|^\\# @BROKEN_PATH_FIX@$|git_broken_path_fix \"' + get_option('sane_tool_path') + '\"|')\n+if get_option('sane_tool_path').length() != 0\n+  sane_tool_path = (host_machine.system() == 'windows' ? ';' : ':').join(get_option('sane_tool_path'))\n+  build_options_config.set_quoted('BROKEN_PATH_FIX', 's|^\\# @BROKEN_PATH_FIX@$|git_broken_path_fix \"' + sane_tool_path + '\"|')\n else\n   build_options_config.set_quoted('BROKEN_PATH_FIX', '/^\\# @BROKEN_PATH_FIX@$/d')\n endif\ndiff --git a/meson_options.txt b/meson_options.txt\nindex c102185ed5e..e0e8089891b 100644\n--- a/meson_options.txt\n+++ b/meson_options.txt\n@@ -13,8 +13,8 @@ option('perl_cpan_fallback', type: 'boolean', value: true,\n   description: 'Install bundled copies of CPAN modules that serve as a fallback in case the modules are not available on the system.')\n option('runtime_prefix', type: 'boolean', value: false,\n   description: 'Resolve ancillary tooling and support files relative to the location of the runtime binary instead of hard-coding them into the binary.')\n-option('sane_tool_path', type: 'string', value: '',\n-  description: 'A colon-separated list of paths to prepend to PATH if your tools in /usr/bin are broken.')\n+option('sane_tool_path', type: 'array', value: [],\n+  description: 'An array of paths to pick up tools from in case the normal tools are broken or lacking.')\n \n # Build information compiled into Git and other parts like documentation.\n option('build_date', type: 'string', value: '',\n\n-- \n2.48.1.741.g8a9f3a5cdc.dirty\n\n"},{"id":"513067","messageId":"20250226-b4-pks-meson-improvements-v3-10-60c77cf673ae@pks.im","threadId":"63006","inReplyTo":"20250226-b4-pks-meson-improvements-v3-0-60c77cf673ae@pks.im","subject":"[PATCH v3 10/13] meson: prevent finding sed(1) in a loop","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-02-26T08:22:20Z","receivedAt":"2025-02-26T08:22:31Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"We're searching for the sed(1) executable in a loop, which will make us\ntry to find it multiple times. Starting with the preceding commit we\nalready declare a variable for that program in the top-level build file.\nUse it so that we only need to search for the program once.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n Documentation/howto/meson.build | 2 +-\n meson.build                     | 3 ++-\n 2 files changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/howto/meson.build b/Documentation/howto/meson.build\nindex c023c104161..92a08b13eed 100644\n--- a/Documentation/howto/meson.build\n+++ b/Documentation/howto/meson.build\n@@ -41,7 +41,7 @@ custom_target(\n foreach howto : howto_sources\n   howto_stripped = custom_target(\n     command: [\n-      find_program('sed'),\n+      sed,\n       '-e',\n       '1,/^$/d',\n       '@INPUT@',\ndiff --git a/meson.build b/meson.build\nindex ed857aaa4ab..5bf6a914ead 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -201,11 +201,12 @@ endif\n cygpath = find_program('cygpath', dirs: program_path, required: false)\n diff = find_program('diff', dirs: program_path)\n git = find_program('git', dirs: program_path, required: false)\n+sed = find_program('sed', dirs: program_path)\n shell = find_program('sh', dirs: program_path)\n tar = find_program('tar', dirs: program_path)\n \n # Sanity-check that programs required for the build exist.\n-foreach tool : ['cat', 'cut', 'grep', 'sed', 'sort', 'tr', 'uname']\n+foreach tool : ['cat', 'cut', 'grep', 'sort', 'tr', 'uname']\n   find_program(tool, dirs: program_path)\n endforeach\n \n\n-- \n2.48.1.741.g8a9f3a5cdc.dirty\n\n"},{"id":"513068","messageId":"20250226-b4-pks-meson-improvements-v3-12-60c77cf673ae@pks.im","threadId":"63006","inReplyTo":"20250226-b4-pks-meson-improvements-v3-0-60c77cf673ae@pks.im","subject":"[PATCH v3 12/13] meson: consistently use custom program paths to resolve programs","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-02-26T08:22:22Z","receivedAt":"2025-02-26T08:22:33Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"The calls to `find_program()` in our documentation don't use our custom\nprogram path. This variable gets populated on Windows with the location\nof Git for Windows so that we can use it to provide our build tools.\nConsequently, we may not be able to find all necessary binaries on\nWindows.\n\nAdapt the calls to use the program path to fix this. While at it, drop\n`required: true` arguments, which are the default anyway.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n Documentation/meson.build | 12 ++++++------\n 1 file changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/Documentation/meson.build b/Documentation/meson.build\nindex 6438fa67920..c6117366ff9 100644\n--- a/Documentation/meson.build\n+++ b/Documentation/meson.build\n@@ -206,9 +206,9 @@ manpages = {\n \n docs_backend = get_option('docs_backend')\n if docs_backend == 'auto'\n-  if find_program('asciidoc', required: false).found()\n+  if find_program('asciidoc', dirs: program_path, required: false).found()\n     docs_backend = 'asciidoc'\n-  elif find_program('asciidoctor', required: false).found()\n+  elif find_program('asciidoctor', dirs: program_path, required: false).found()\n     docs_backend = 'asciidoctor'\n   else\n     error('Neither asciidoc nor asciidoctor were found.')\n@@ -216,7 +216,7 @@ if docs_backend == 'auto'\n endif\n \n if docs_backend == 'asciidoc'\n-  asciidoc = find_program('asciidoc', required: true)\n+  asciidoc = find_program('asciidoc', dirs: program_path)\n   asciidoc_html = 'xhtml11'\n   asciidoc_docbook = 'docbook'\n   xmlto_extra = [ ]\n@@ -245,7 +245,7 @@ if docs_backend == 'asciidoc'\n     asciidoc_conf,\n   ]\n elif docs_backend == 'asciidoctor'\n-  asciidoctor = find_program('asciidoctor', required: true)\n+  asciidoctor = find_program('asciidoctor', dirs: program_path)\n   asciidoc_html = 'xhtml5'\n   asciidoc_docbook = 'docbook5'\n   xmlto_extra = [\n@@ -283,7 +283,7 @@ elif docs_backend == 'asciidoctor'\n   ]\n endif\n \n-xmlto = find_program('xmlto')\n+xmlto = find_program('xmlto', dirs: program_path)\n \n cmd_lists = [\n   'cmds-ancillaryinterrogators.txt',\n@@ -404,7 +404,7 @@ if get_option('docs').contains('html')\n     pointing_to: 'git.html',\n   )\n \n-  xsltproc = find_program('xsltproc')\n+  xsltproc = find_program('xsltproc', dirs: program_path)\n \n   user_manual_xml = custom_target(\n     command: asciidoc_common_options + [\n\n-- \n2.48.1.741.g8a9f3a5cdc.dirty\n\n"},{"id":"513069","messageId":"20250226-b4-pks-meson-improvements-v3-11-60c77cf673ae@pks.im","threadId":"63006","inReplyTo":"20250226-b4-pks-meson-improvements-v3-0-60c77cf673ae@pks.im","subject":"[PATCH v3 11/13] meson: fix overwritten `git` variable","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-02-26T08:22:21Z","receivedAt":"2025-02-26T08:22:33Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"We're assigning the `git` variable in three places:\n\n  - In \"meson.build\" to store the external Git executable.\n\n  - In \"meson.build\" to store the compiled Git executable.\n\n  - In \"Documentation/meson.build\" to store the external Git executable,\n    a second time.\n\nThe last case is only needed because we overwrite the original variable\nwith the built version. Rename the variable used for the built Git\nexecutable so that we don't have to resolve the external Git executable\nmultiple times.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n Documentation/meson.build | 1 -\n meson.build               | 6 +++---\n 2 files changed, 3 insertions(+), 4 deletions(-)\n\ndiff --git a/Documentation/meson.build b/Documentation/meson.build\nindex 2a26fa8a5fe..6438fa67920 100644\n--- a/Documentation/meson.build\n+++ b/Documentation/meson.build\n@@ -283,7 +283,6 @@ elif docs_backend == 'asciidoctor'\n   ]\n endif\n \n-git = find_program('git', required: false)\n xmlto = find_program('xmlto')\n \n cmd_lists = [\ndiff --git a/meson.build b/meson.build\nindex 5bf6a914ead..930b85a6dfe 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -1608,13 +1608,13 @@ libgit_commonmain = declare_dependency(\n bin_wrappers = [ ]\n test_dependencies = [ ]\n \n-git = executable('git',\n+git_builtin = executable('git',\n   sources: builtin_sources + 'git.c',\n   dependencies: [libgit_commonmain],\n   install: true,\n   install_dir: get_option('libexecdir') / 'git-core',\n )\n-bin_wrappers += git\n+bin_wrappers += git_builtin\n \n test_dependencies += executable('git-daemon',\n   sources: 'daemon.c',\n@@ -1705,7 +1705,7 @@ test_dependencies += executable('git-imap-send',\n \n foreach alias : [ 'git-receive-pack', 'git-upload-archive', 'git-upload-pack' ]\n   bin_wrappers += executable(alias,\n-    objects: git.extract_all_objects(recursive: false),\n+    objects: git_builtin.extract_all_objects(recursive: false),\n     dependencies: [libgit_commonmain],\n   )\n \n\n-- \n2.48.1.741.g8a9f3a5cdc.dirty\n\n"},{"id":"513070","messageId":"20250226-b4-pks-meson-improvements-v3-13-60c77cf673ae@pks.im","threadId":"63006","inReplyTo":"20250226-b4-pks-meson-improvements-v3-0-60c77cf673ae@pks.im","subject":"[PATCH v3 13/13] gitlab-ci: restrict maximum number of link jobs on Windows","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-02-26T08:22:23Z","receivedAt":"2025-02-26T08:22:35Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"The hosted Windows runners on GitLab.com only have 7.5GB of RAM. Given\nthat \"link.exe\" provided by Microsoft Visual Studio is multi-threaded by\nitself already and thus quite memory hungry this can quickly lead to\nmemory starvation, out-of-memory situations and thus failed CI jobs.\n\nFix the issue by limiting the number of concurrent linker jobs. The same\nissue hasn't been observed on GitHub Actions yet, probably because it\ngot more than twice the amount of RAM with 16GB.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n .gitlab-ci.yml | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/.gitlab-ci.yml b/.gitlab-ci.yml\nindex 4976e18a050..7e1cecc6a70 100644\n--- a/.gitlab-ci.yml\n+++ b/.gitlab-ci.yml\n@@ -169,7 +169,7 @@ build:msvc-meson:\n   extends: .msvc-meson\n   stage: build\n   script:\n-    - meson setup build -Dperl=disabled\n+    - meson setup build -Dperl=disabled -Dbackend_max_links=1\n     - meson compile -C build\n   artifacts:\n     paths:\n\n-- \n2.48.1.741.g8a9f3a5cdc.dirty\n\n"}]}