[PATCH v3 00/13] meson: cleanups, improvements, smallish fixes
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Feb 26, 2025, 08:22 UTC
- Message-ID
- <20250226-b4-pks-meson-improvements-v3-0-60c77cf673ae@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.imChanges in v3:
- Fix missing linker arguments for a couple of aliased executables on
Windows with MSVC.
- Link to v2: https://lore.kernel.org/r/20250130-b4-pks-meson-improvements-v2-0-2f05581ffb44@pks.imI've kicked off an extra pipeline at [1] to verify that this version works on next and doesn't break anything.
Thanks!
Patrick
[1]: https://github.com/git/git/pull/1898
---
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 | 156 +++++++++++++++++++--------------------- meson_options.txt | 4 +- oss-fuzz/meson.build | 2 +- t/helper/meson.build | 4 +- t/meson.build | 4 +- 8 files changed, 89 insertions(+), 98 deletions(-)
Range-diff versus v2:
1: 94730a8bdb4 = 1: fd7097ab8bd meson: fix exec path with enabled runtime prefix
2: 97710a79d0f = 2: ff8d4cd70c6 meson: fix OpenSSL fallback when not explicitly required
3: 66a8c6f24d0 = 3: 238a45c8bb0 meson: inline the static 'git' library
4: f717119b1a0 ! 4: 1bd9f892310 meson: simplify use of the common-main library
@@ Commit message
instead of creating a static library, we now instead compile the common
set of files into each executable separately.
- This change surfaces an issue when linking aliases for git-remote-http:
- we extract all objects from `git-remote-http` et al and then link them
- into the new executable. As such, these objects would already contain
- a `main()` function. But now that we also compile "common-main.c" into
- these aliased executables we see a linker error due to `main()` being
- defined twice. We fix this by only linking against `libgit.a`.
-
Signed-off-by: Patrick Steinhardt <ps@pks.im>
## meson.build ##
@@ meson.build: if host_machine.system() == 'windows'
endif
endif
-common_main_library = static_library('common-main',
-+
-+libgit_commonmain = declare_dependency(
- sources: common_main_sources,
+- sources: common_main_sources,
- c_args: libgit_c_args,
- dependencies: libgit_dependencies,
- include_directories: libgit_include_directories,
-)
-common_main = declare_dependency(
- link_with: common_main_library,
++
++libgit_commonmain = declare_dependency(
++ link_with: static_library('common-main',
++ sources: common_main_sources,
++ dependencies: [ libgit ],
++ ),
link_args: common_main_link_args,
+ dependencies: [ libgit ],
)
@@ meson.build: if get_option('curl').enabled()
test_dependencies += executable(alias,
objects: git_remote_http.extract_all_objects(recursive: false),
- dependencies: [libgit, common_main],
-+ dependencies: [libgit],
++ dependencies: [libgit_commonmain],
)
install_symlink(alias + executable_suffix,
@@ meson.build: test_dependencies += executable('git-imap-send',
bin_wrappers += executable(alias,
objects: git.extract_all_objects(recursive: false),
- dependencies: [libgit, common_main],
-+ dependencies: [libgit],
++ dependencies: [libgit_commonmain],
)
install_symlink(alias + executable_suffix,
5: 1b61303b130 ! 5: 024f4297f5e meson: introduce `libgit_curl` dependency
@@ 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],
+- dependencies: [libgit_commonmain],
+ sources: 'remote-curl.c',
+ dependencies: [libgit_curl],
)
6: 70dc5edc05c = 6: 7fa4957e256 meson: stop linking libcurl into all executables
7: 7fe6d1d4e74 = 7: b24c4e06deb meson: drop separate version library
8: 1d0597eb7cf = 8: 8ca171f9694 meson: improve PATH handling
9: 9219ab697a7 = 9: beedc776a7b meson: improve handling of `sane_tool_path` option
10: 7e3e0bb409f = 10: 018f549375f meson: prevent finding sed(1) in a loop
11: c1243c17dbe ! 11: 3da8f4f105d meson: fix overwritten `git` variable
@@ meson.build: test_dependencies += executable('git-imap-send',
bin_wrappers += executable(alias,
- objects: git.extract_all_objects(recursive: false),
+ objects: git_builtin.extract_all_objects(recursive: false),
- dependencies: [libgit],
+ dependencies: [libgit_commonmain],
)
12: f06585cd99e = 12: b2febf1acac meson: consistently use custom program paths to resolve programs
13: 02f0ffdd362 = 13: f5bb92726dc gitlab-ci: restrict maximum number of link jobs on Windows--- base-commit: 6dd4e543f2219290db9faa61b30f7f30a34e4b50 change-id: 20250121-b4-pks-meson-improvements-3e575363e91c