Git fork

meson: simplify use of the common-main library

The "common-main.c" file is used by multiple executables. In order to
make it easy to set it up we have created a separate library that these
executables can link against. All of these executables also want to link
against `libgit.a` though, which makes it necessary to specify both of
these as dependencies for every executable.

Simplify this a bit by declaring the library as a source dependency:
instead of creating a static library, we now instead compile the common
set of files into each executable separately.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Patrick Steinhardt and committed by
Junio C Hamano
ebb35369 ce943288

+24 -25
+19 -20
meson.build
··· 1604 1604 error('Unsupported compiler ' + compiler.get_id()) 1605 1605 endif 1606 1606 endif 1607 - common_main_library = static_library('common-main', 1608 - sources: common_main_sources, 1609 - c_args: libgit_c_args, 1610 - dependencies: libgit_dependencies, 1611 - include_directories: libgit_include_directories, 1612 - ) 1613 - common_main = declare_dependency( 1614 - link_with: common_main_library, 1607 + 1608 + libgit_commonmain = declare_dependency( 1609 + link_with: static_library('common-main', 1610 + sources: common_main_sources, 1611 + dependencies: [ libgit ], 1612 + ), 1615 1613 link_args: common_main_link_args, 1614 + dependencies: [ libgit ], 1616 1615 ) 1617 1616 1618 1617 bin_wrappers = [ ] ··· 1620 1619 1621 1620 git = executable('git', 1622 1621 sources: builtin_sources + 'git.c', 1623 - dependencies: [libgit, common_main], 1622 + dependencies: [libgit_commonmain], 1624 1623 install: true, 1625 1624 install_dir: get_option('libexecdir') / 'git-core', 1626 1625 ) ··· 1628 1627 1629 1628 test_dependencies += executable('git-daemon', 1630 1629 sources: 'daemon.c', 1631 - dependencies: [libgit, common_main], 1630 + dependencies: [libgit_commonmain], 1632 1631 install: true, 1633 1632 install_dir: get_option('libexecdir') / 'git-core', 1634 1633 ) 1635 1634 1636 1635 test_dependencies += executable('git-sh-i18n--envsubst', 1637 1636 sources: 'sh-i18n--envsubst.c', 1638 - dependencies: [libgit, common_main], 1637 + dependencies: [libgit_commonmain], 1639 1638 install: true, 1640 1639 install_dir: get_option('libexecdir') / 'git-core', 1641 1640 ) 1642 1641 1643 1642 bin_wrappers += executable('git-shell', 1644 1643 sources: 'shell.c', 1645 - dependencies: [libgit, common_main], 1644 + dependencies: [libgit_commonmain], 1646 1645 install: true, 1647 1646 install_dir: get_option('libexecdir') / 'git-core', 1648 1647 ) 1649 1648 1650 1649 test_dependencies += executable('git-http-backend', 1651 1650 sources: 'http-backend.c', 1652 - dependencies: [libgit, common_main], 1651 + dependencies: [libgit_commonmain], 1653 1652 install: true, 1654 1653 install_dir: get_option('libexecdir') / 'git-core', 1655 1654 ) 1656 1655 1657 1656 bin_wrappers += executable('scalar', 1658 1657 sources: 'scalar.c', 1659 - dependencies: [libgit, common_main], 1658 + dependencies: [libgit_commonmain], 1660 1659 install: true, 1661 1660 install_dir: get_option('libexecdir') / 'git-core', 1662 1661 ) ··· 1669 1668 1670 1669 git_remote_http = executable('git-remote-http', 1671 1670 sources: curl_sources + 'remote-curl.c', 1672 - dependencies: [libgit, common_main], 1671 + dependencies: [libgit_commonmain], 1673 1672 install: true, 1674 1673 install_dir: get_option('libexecdir') / 'git-core', 1675 1674 ) ··· 1677 1676 1678 1677 test_dependencies += executable('git-http-fetch', 1679 1678 sources: curl_sources + 'http-fetch.c', 1680 - dependencies: [libgit, common_main], 1679 + dependencies: [libgit_commonmain], 1681 1680 install: true, 1682 1681 install_dir: get_option('libexecdir') / 'git-core', 1683 1682 ) ··· 1685 1684 if expat.found() 1686 1685 test_dependencies += executable('git-http-push', 1687 1686 sources: curl_sources + 'http-push.c', 1688 - dependencies: [libgit, common_main], 1687 + dependencies: [libgit_commonmain], 1689 1688 install: true, 1690 1689 install_dir: get_option('libexecdir') / 'git-core', 1691 1690 ) ··· 1694 1693 foreach alias : [ 'git-remote-https', 'git-remote-ftp', 'git-remote-ftps' ] 1695 1694 test_dependencies += executable(alias, 1696 1695 objects: git_remote_http.extract_all_objects(recursive: false), 1697 - dependencies: [libgit, common_main], 1696 + dependencies: [libgit_commonmain], 1698 1697 ) 1699 1698 1700 1699 install_symlink(alias + executable_suffix, ··· 1711 1710 1712 1711 test_dependencies += executable('git-imap-send', 1713 1712 sources: imap_send_sources, 1714 - dependencies: [libgit, common_main], 1713 + dependencies: [libgit_commonmain], 1715 1714 install: true, 1716 1715 install_dir: get_option('libexecdir') / 'git-core', 1717 1716 ) ··· 1719 1718 foreach alias : [ 'git-receive-pack', 'git-upload-archive', 'git-upload-pack' ] 1720 1719 bin_wrappers += executable(alias, 1721 1720 objects: git.extract_all_objects(recursive: false), 1722 - dependencies: [libgit, common_main], 1721 + dependencies: [libgit_commonmain], 1723 1722 ) 1724 1723 1725 1724 install_symlink(alias + executable_suffix,
+1 -1
oss-fuzz/meson.build
··· 15 15 'dummy-cmd-main.c', 16 16 fuzz_program, 17 17 ], 18 - dependencies: [libgit, common_main], 18 + dependencies: [libgit_commonmain], 19 19 ) 20 20 endforeach
+2 -2
t/helper/meson.build
··· 79 79 80 80 test_tool = executable('test-tool', 81 81 sources: test_tool_sources, 82 - dependencies: [libgit, common_main], 82 + dependencies: [libgit_commonmain], 83 83 ) 84 84 bin_wrappers += test_tool 85 85 test_dependencies += test_tool 86 86 87 87 test_fake_ssh = executable('test-fake-ssh', 88 88 sources: 'test-fake-ssh.c', 89 - dependencies: [libgit, common_main], 89 + dependencies: [libgit_commonmain], 90 90 ) 91 91 bin_wrappers += test_fake_ssh 92 92 test_dependencies += test_fake_ssh
+2 -2
t/meson.build
··· 39 39 40 40 clar_unit_tests = executable('unit-tests', 41 41 sources: clar_sources + clar_test_suites, 42 - dependencies: [libgit, common_main], 42 + dependencies: [libgit_commonmain], 43 43 ) 44 44 test('unit-tests', clar_unit_tests) 45 45 ··· 72 72 'unit-tests/lib-reftable.c', 73 73 unit_test_program, 74 74 ], 75 - dependencies: [libgit, common_main], 75 + dependencies: [libgit_commonmain], 76 76 ) 77 77 test(unit_test_name, unit_test, 78 78 workdir: meson.current_source_dir(),