meson: introduce `libgit_curl` dependency
We've got a set of common source files that we use for those executables that link against libcurl. The setup is somewhat repetitive though. 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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Patrick Steinhardt committed
Feb 26, 2025 at 09:22 UTC
dfc88bd6477bc6c1d2a9eb29a859ebf11a0a351d
1 file changed
+18
-21
meson.build
+18
-21
@@ -1661,30 +1661,32 @@ bin_wrappers += executable('scalar',
1661
)
1662
1663
if get_option('curl').enabled()
1664
- curl_sources = [
1665
- 'http.c',
1666
- 'http-walker.c',
1667
- ]
1668
-
1669
- git_remote_http = executable('git-remote-http',
1670
- sources: curl_sources + 'remote-curl.c',
1664
+ libgit_curl = declare_dependency(
1665
+ sources: [
1666
+ 'http.c',
1667
+ 'http-walker.c',
1668
+ ],
1669
dependencies: [libgit_commonmain],
1670
+ )
1671
+
1672
+ test_dependencies += executable('git-remote-http',
1673
+ sources: 'remote-curl.c',
1674
+ dependencies: [libgit_curl],
1675
install: true,
1676
install_dir: get_option('libexecdir') / 'git-core',
1677
)
1675
- test_dependencies += git_remote_http
1678
1679
test_dependencies += executable('git-http-fetch',
1678
- sources: curl_sources + 'http-fetch.c',
1679
- dependencies: [libgit_commonmain],
1680
+ sources: 'http-fetch.c',
1681
+ dependencies: [libgit_curl],
1682
install: true,
1683
install_dir: get_option('libexecdir') / 'git-core',
1684
)
1685
1686
if expat.found()
1687
test_dependencies += executable('git-http-push',
1686
- sources: curl_sources + 'http-push.c',
1687
- dependencies: [libgit_commonmain],
1688
+ sources: 'http-push.c',
1689
+ dependencies: [libgit_curl],
1690
install: true,
1691
install_dir: get_option('libexecdir') / 'git-core',
1692
)
@@ -1692,8 +1694,8 @@ if get_option('curl').enabled()
1694
1695
foreach alias : [ 'git-remote-https', 'git-remote-ftp', 'git-remote-ftps' ]
1696
test_dependencies += executable(alias,
1695
- objects: git_remote_http.extract_all_objects(recursive: false),
1696
- dependencies: [libgit_commonmain],
1697
+ sources: 'remote-curl.c',
1698
+ dependencies: [libgit_curl],
1699
)
1700
1701
install_symlink(alias + executable_suffix,
@@ -1703,14 +1705,9 @@ if get_option('curl').enabled()
1705
endforeach
1706
endif
1707
1706
-imap_send_sources = ['imap-send.c']
1707
-if use_curl_for_imap_send
1708
- imap_send_sources += curl_sources
1709
-endif
1710
-
1708
test_dependencies += executable('git-imap-send',
1712
- sources: imap_send_sources,
1713
- dependencies: [libgit_commonmain],
1709
+ sources: 'imap-send.c',
1710
+ dependencies: [ use_curl_for_imap_send ? libgit_curl : libgit_commonmain ],
1711
install: true,
1712
install_dir: get_option('libexecdir') / 'git-core',
1713
)