git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 00/13] meson: cleanups, improvements, smallish fixes

From
Patrick Steinhardt <ps@pks.im>
Date
Jan 30, 2025, 14:43 UTC
Message-ID
<20250130-b4-pks-meson-improvements-v2-0-2f05581ffb44@pks.im>
In-Reply-To
<20250129-b4-pks-meson-improvements-v1-0-ab709f0be12c@pks.im>
Hi,

this patch series contains a mostly-random set of smallish improvements, simplifications and fixes to the Meson build instructions.

Changes in v2:
  - Redo the two commits regarding PATH handling. We now only prepend
    system-specific paths to PATH and handle the `-Dsane_tool_path`
    option the same.
  - Continue to propagate libcurl include directories into libgit, as we
    need it for "help.c" to resolve LIBCURL_VERSION. Reorder the patch
    to minimize the required changes.
  - Fix a commit message typo.
  - Include another commit that fixes the OpenSSL fallback on Windows.
  - Include another commit to fix linker errors due to out-of-memory
    situations on Windows with GitLab CI.
  - Link to v1: https://lore.kernel.org/r/20250129-b4-pks-meson-improvements-v1-0-ab709f0be12c@pks.im

I have furthermore pulled in ps/build-meson-fixes at 7304bd2bc3 (ci: wire up Visual Studio build with Meson, 2025-01-22) as a dependency of this series. This is due to a semantic conflict with 28911f7dca (meson: wire up fuzzers, 2025-01-22).

Thanks!
Patrick
---
Patrick Steinhardt (13):
      meson: fix exec path with enabled runtime prefix
      meson: fix OpenSSL fallback when not explicitly required
      meson: inline the static 'git' library
      meson: simplify use of the common-main library
      meson: introduce `libgit_curl` dependency
      meson: stop linking libcurl into all executables
      meson: drop separate version library
      meson: improve PATH handling
      meson: improve handling of `sane_tool_path` option
      meson: prevent finding sed(1) in a loop
      meson: fix overwritten `git` variable
      meson: consistently use custom program paths to resolve programs
      gitlab-ci: restrict maximum number of link jobs on Windows
 .gitlab-ci.yml                  |   2 +-
 Documentation/howto/meson.build |   2 +-
 Documentation/meson.build       |  13 ++--
 meson.build                     | 151 +++++++++++++++++++---------------------
 meson_options.txt               |   4 +-
 oss-fuzz/meson.build            |   2 +-
 t/helper/meson.build            |   4 +-
 t/meson.build                   |   4 +-
 8 files changed, 85 insertions(+), 97 deletions(-)
Range-diff versus v1:
 1:  a4f1eb695a !  1:  932d79a814 meson: fix exec path with enabled runtime prefix
    @@ Commit message
     
         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 correcty, in Meson we always wire up the absolute
    +    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
 -:  ---------- >  2:  6bd07f35a6 meson: fix OpenSSL fallback when not explicitly required
 2:  da61c2a679 =  3:  94f9e45c56 meson: inline the static 'git' library
 3:  744754959e !  4:  669c811eb6 meson: simplify use of the common-main library
    @@ meson.build: test_dependencies += executable('git-imap-send',
      
        install_symlink(alias + executable_suffix,
     
    + ## oss-fuzz/meson.build ##
    +@@ oss-fuzz/meson.build: foreach fuzz_program : fuzz_programs
    +       'dummy-cmd-main.c',
    +       fuzz_program,
    +     ],
    +-    dependencies: [libgit, common_main],
    ++    dependencies: [libgit_commonmain],
    +   )
    + endforeach
    +
      ## t/helper/meson.build ##
     @@ t/helper/meson.build: test_tool_sources = [
      
 4:  172d3e07a5 <  -:  ---------- meson: stop linking libcurl into all executables
 5:  a0a1e548cc !  5:  edb9fba4b3 meson: introduce `libgit_curl` dependency
    @@ Commit message
         Simplify it by declaring a `libgit_curl` dependency that bundles all of
         it together.
     
    +    Note that we don't include curl itself as a dependency. This is because
    +    we already pull it in transitively via the libgit dependency, which is
    +    unfortunate because libgit itself shouldn't actually link against curl
    +    in the first place. This will get fixed in the next commit.
    +
         Signed-off-by: Patrick Steinhardt <ps@pks.im>
     
      ## meson.build ##
    @@ meson.build: bin_wrappers += executable('scalar',
     +      'http.c',
     +      'http-walker.c',
     +    ],
    -     dependencies: [libgit_commonmain, curl],
    +     dependencies: [libgit_commonmain],
     +  )
     +
     +  test_dependencies += executable('git-remote-http',
     +    sources: 'remote-curl.c',
    -+    dependencies: libgit_curl,
    ++    dependencies: [libgit_curl],
          install: true,
          install_dir: get_option('libexecdir') / 'git-core',
        )
    @@ meson.build: bin_wrappers += executable('scalar',
      
        test_dependencies += executable('git-http-fetch',
     -    sources: curl_sources + 'http-fetch.c',
    --    dependencies: [libgit_commonmain, curl],
    +-    dependencies: [libgit_commonmain],
     +    sources: 'http-fetch.c',
    -+    dependencies: libgit_curl,
    ++    dependencies: [libgit_curl],
          install: true,
          install_dir: get_option('libexecdir') / 'git-core',
        )
    @@ meson.build: bin_wrappers += executable('scalar',
        if expat.found()
          test_dependencies += executable('git-http-push',
     -      sources: curl_sources + 'http-push.c',
    --      dependencies: [libgit_commonmain, curl],
    +-      dependencies: [libgit_commonmain],
     +      sources: 'http-push.c',
    -+      dependencies: libgit_curl,
    ++      dependencies: [libgit_curl],
            install: true,
            install_dir: get_option('libexecdir') / 'git-core',
          )
    @@ meson.build: if get_option('curl').enabled()
        foreach alias : [ 'git-remote-https', 'git-remote-ftp', 'git-remote-ftps' ]
          test_dependencies += executable(alias,
     -      objects: git_remote_http.extract_all_objects(recursive: false),
    --      dependencies: [libgit, curl],
    +-      dependencies: [libgit],
     +      sources: 'remote-curl.c',
    -+      dependencies: libgit_curl,
    ++      dependencies: [libgit_curl],
          )
      
          install_symlink(alias + executable_suffix,
    @@ meson.build: if get_option('curl').enabled()
      endif
      
     -imap_send_sources = ['imap-send.c']
    --imap_send_dependencies = [libgit_commonmain]
     -if use_curl_for_imap_send
     -  imap_send_sources += curl_sources
    --  imap_send_dependencies += curl
     -endif
     -
      test_dependencies += executable('git-imap-send',
     -  sources: imap_send_sources,
    --  dependencies: imap_send_dependencies,
    +-  dependencies: [libgit_commonmain],
     +  sources: 'imap-send.c',
    -+  dependencies: use_curl_for_imap_send ? [libgit_curl] : [libgit_commonmain],
    ++  dependencies: [ use_curl_for_imap_send ? libgit_curl : libgit_commonmain ],
        install: true,
        install_dir: get_option('libexecdir') / 'git-core',
      )
 -:  ---------- >  6:  95ceafc2f4 meson: stop linking libcurl into all executables
 6:  ab55efa559 =  7:  65d00e36b8 meson: drop separate version library
 7:  7226cd6388 <  -:  ---------- meson: deduplicate the list of required programs
 8:  55a372a559 <  -:  ---------- meson: simplify setup of PATH environment variable
 -:  ---------- >  8:  3dc35872a3 meson: improve PATH handling
 -:  ---------- >  9:  e996dc571c meson: improve handling of `sane_tool_path` option
 9:  2abab952c0 ! 10:  2730e0166b meson: prevent finding sed(1) in a loop
    @@ Documentation/howto/meson.build: custom_target(
            '-e',
            '1,/^$/d',
            '@INPUT@',
    +
    + ## meson.build ##
    +@@ meson.build: endif
    + cygpath = find_program('cygpath', dirs: program_path, required: false)
    + diff = find_program('diff', dirs: program_path)
    + git = find_program('git', dirs: program_path, required: false)
    ++sed = find_program('sed', dirs: program_path)
    + shell = find_program('sh', dirs: program_path)
    + tar = find_program('tar', dirs: program_path)
    + 
    + # Sanity-check that programs required for the build exist.
    +-foreach tool : ['cat', 'cut', 'grep', 'sed', 'sort', 'tr', 'uname']
    ++foreach tool : ['cat', 'cut', 'grep', 'sort', 'tr', 'uname']
    +   find_program(tool, dirs: program_path)
    + endforeach
    + 
10:  a36529b4dd = 11:  9a54f2c2b7 meson: fix overwritten `git` variable
11:  2c60ae4349 = 12:  4604460ba2 meson: consistently use custom program paths to resolve programs
 -:  ---------- > 13:  9a6fd5435d gitlab-ci: restrict maximum number of link jobs on Windows

--- base-commit: 6dd4e543f2219290db9faa61b30f7f30a34e4b50 change-id: 20250121-b4-pks-meson-improvements-3e575363e91c

Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 18 of 35 in “meson: cleanups, improvements, smallish fixes”
  1. 00/11 meson: cleanups, improvements, smallish fixesPatrick Steinhardt, Jan 29, 2025
  2. 01/11 meson: fix exec path with enabled runtime prefixPatrick Steinhardt, Jan 29, 2025
  3. Justin ToblerJan 29, 2025
  4. Patrick SteinhardtJan 30, 2025
  5. 02/11 meson: inline the static 'git' libraryPatrick Steinhardt, Jan 29, 2025
  6. 04/11 meson: stop linking libcurl into all executablesPatrick Steinhardt, Jan 29, 2025
  7. 03/11 meson: simplify use of the common-main libraryPatrick Steinhardt, Jan 29, 2025
  8. 05/11 meson: introduce `libgit_curl` dependencyPatrick Steinhardt, Jan 29, 2025
  9. 07/11 meson: deduplicate the list of required programsPatrick Steinhardt, Jan 29, 2025
  10. Justin ToblerJan 29, 2025
  11. 06/11 meson: drop separate version libraryPatrick Steinhardt, Jan 29, 2025
  12. 08/11 meson: simplify setup of PATH environment variablePatrick Steinhardt, Jan 29, 2025
  13. Justin ToblerJan 29, 2025
  14. Patrick SteinhardtJan 30, 2025
  15. 09/11 meson: prevent finding sed(1) in a loopPatrick Steinhardt, Jan 29, 2025
  16. 10/11 meson: fix overwritten `git` variablePatrick Steinhardt, Jan 29, 2025
  17. 11/11 meson: consistently use custom program paths to resolve programsPatrick Steinhardt, Jan 29, 2025
  18. 00/13 meson: cleanups, improvements, smallish fixesPatrick Steinhardt, Jan 30, 2025
  19. 02/13 meson: fix OpenSSL fallback when not explicitly requiredPatrick Steinhardt, Jan 30, 2025
  20. 01/13 meson: fix exec path with enabled runtime prefixPatrick Steinhardt, Jan 30, 2025
  21. 03/13 meson: inline the static 'git' libraryPatrick Steinhardt, Jan 30, 2025
  22. 04/13 meson: simplify use of the common-main libraryPatrick Steinhardt, Jan 30, 2025
  23. 06/13 meson: stop linking libcurl into all executablesPatrick Steinhardt, Jan 30, 2025
  24. 05/13 meson: introduce `libgit_curl` dependencyPatrick Steinhardt, Jan 30, 2025
  25. 07/13 meson: drop separate version libraryPatrick Steinhardt, Jan 30, 2025
  26. Toon ClaesFeb 7, 2025
  27. 08/13 meson: improve PATH handlingPatrick Steinhardt, Jan 30, 2025
  28. 09/13 meson: improve handling of `sane_tool_path` optionPatrick Steinhardt, Jan 30, 2025
  29. Toon ClaesFeb 7, 2025
  30. Patrick SteinhardtFeb 7, 2025
  31. 10/13 meson: prevent finding sed(1) in a loopPatrick Steinhardt, Jan 30, 2025
  32. 11/13 meson: fix overwritten `git` variablePatrick Steinhardt, Jan 30, 2025
  33. 12/13 meson: consistently use custom program paths to resolve programsPatrick Steinhardt, Jan 30, 2025
  34. 13/13 gitlab-ci: restrict maximum number of link jobs on WindowsPatrick Steinhardt, Jan 30, 2025
  35. Justin ToblerFeb 7, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.