1
0
mirror of https://github.com/git/git.git synced 2025-02-06 09:26:16 +00:00

Introduce support for the Meson build system

Introduce support for the Meson build system, a "modern" meta build
system that supports many different platforms, including Linux, macOS,
Windows and BSDs. Meson supports different backends, including Ninja,
Xcode and Microsoft Visual Studio. Several common IDEs provide an
integration with it.

The biggest contender compared to Meson is probably CMake as outlined in
our "Documentation/technical/build-systems.txt" file. Based on my own
personal experience from working with both build systems extensively I
strongly favor Meson over CMake. In my opinion, it feels significantly
easier to use with a syntax that feels more like a "real" programming
language. The second big reason is that Meson supports Rust natively,
which may prove to be important given that the project may pick up Rust
as another language eventually.

Using Meson is rather straight-forward. An example:

    ```
    # Meson uses out-of-tree builds. You can set up multiple build
    # directories, how you name them is completely up to you.
    $ mkdir build
    $ cd build
    $ meson setup .. -Dprefix=/tmp/git-installation

    # Build the project. This also provides several other targets like
    e.g. `install` or `test`.
    $ ninja

    # Meson has been wired up to support execution of our test suites.
    # Both our unit tests and our integration tests are supported.
    # Running `meson test` without any arguments will execute all tests,
    # but the syntax supports globbing to select only some tests.
    $ meson test 't-*'
    # Execute single test interactively to allow for debugging.
    $ meson test 't0000-*' --interactive --test-args=-ix
    ```

The build instructions have been successfully tested on the following
systems, tests are passing:

  - Apple macOS 10.15.

  - FreeBSD 14.1.

  - NixOS 24.11.

  - OpenBSD 7.6.

  - Ubuntu 24.04.

  - Windows 10 with Cygwin.

  - Windows 10 with MinGW64, except for t9700, which is also broken with
    our Makefile.

  - Windows 10 with Visual Studio 2022 toolchain, using the Native Tools
    Command Prompt with `meson setup --vsenv`. Tests pass, except for
    t9700.

  - Windows 10 with Visual Studio 2022 solution, using the Native Tools
    Command Prompt with `meson setup --backend vs2022`. Tests pass,
    except for t9700.

  - Windows 10 with VS Code, using the Meson plug-in.

It is expected that there will still be rough edges in the current
version. If this patch lands the expectation is that it will coexist
with our other build systems for a while. Like this, distributions can
slowly migrate over to Meson and report any findings they have to us
such that we can continue to iterate. A potential cutoff date for other
build systems may be Git 3.0.

Some notes:

  - The installed distribution is structured somewhat differently than
    how it used to be the case. All of our binaries are installed into
    `$libexec/git-core`, while all binaries part of `$bindir` are now
    symbolic links pointing to the former. This rule is consistent in
    itself and thus easier to reason about.

  - We do not install dashed binaries into `$libexec/git-core` anymore,
    so there won't e.g. be a symlink for git-add(1). These are not
    required by modern Git and there isn't really much of a use case for
    those anymore. By not installing those symlinks we thus start the
    deprecation of this layout.

  - We're targeting Meson 1.3.0, which has been released relatively
    recently November 2023. The only feature we use from that version is
    `fs.relative_to()`, which we could replace if necessary. If so, we
    could start to target Meson 1.0.0 and newer, released in December
    2022.

  - The whole build instructions count around 3300 lines, half of which
    is listing all of our code and test files. Our Makefiles are around
    5000 lines, autoconf adds another 1300 lines. CMake in comparison
    has only 1200 linescode, but it avoids listing individual files and
    does not wire up auto-configuration as extensively as the Meson
    instructions do.

  - We bundle a set of subproject wrappers for curl, expat, openssl,
    pcre2 and zlib. This allows developers to build Git without these
    dependencies preinstalled, and Meson will fetch and build them
    automatically. This is especially helpful on Windows.

Helped-by: Eli Schwartz <eschwartz@gentoo.org>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Patrick Steinhardt 2024-12-06 14:24:59 +01:00 committed by Junio C Hamano
parent 00ab97b1bc
commit 904339edbd
27 changed files with 3880 additions and 0 deletions

324
Documentation/meson.build Normal file
View File

@ -0,0 +1,324 @@
manpages = {
# Category 1.
'git-add.txt' : 1,
'git-am.txt' : 1,
'git-annotate.txt' : 1,
'git-apply.txt' : 1,
'git-archimport.txt' : 1,
'git-archive.txt' : 1,
'git-bisect.txt' : 1,
'git-blame.txt' : 1,
'git-branch.txt' : 1,
'git-bugreport.txt' : 1,
'git-bundle.txt' : 1,
'git-cat-file.txt' : 1,
'git-check-attr.txt' : 1,
'git-check-ignore.txt' : 1,
'git-check-mailmap.txt' : 1,
'git-checkout-index.txt' : 1,
'git-checkout.txt' : 1,
'git-check-ref-format.txt' : 1,
'git-cherry-pick.txt' : 1,
'git-cherry.txt' : 1,
'git-citool.txt' : 1,
'git-clean.txt' : 1,
'git-clone.txt' : 1,
'git-column.txt' : 1,
'git-commit-graph.txt' : 1,
'git-commit-tree.txt' : 1,
'git-commit.txt' : 1,
'git-config.txt' : 1,
'git-count-objects.txt' : 1,
'git-credential-cache--daemon.txt' : 1,
'git-credential-cache.txt' : 1,
'git-credential-store.txt' : 1,
'git-credential.txt' : 1,
'git-cvsexportcommit.txt' : 1,
'git-cvsimport.txt' : 1,
'git-cvsserver.txt' : 1,
'git-daemon.txt' : 1,
'git-describe.txt' : 1,
'git-diagnose.txt' : 1,
'git-diff-files.txt' : 1,
'git-diff-index.txt' : 1,
'git-difftool.txt' : 1,
'git-diff-tree.txt' : 1,
'git-diff.txt' : 1,
'git-fast-export.txt' : 1,
'git-fast-import.txt' : 1,
'git-fetch-pack.txt' : 1,
'git-fetch.txt' : 1,
'git-filter-branch.txt' : 1,
'git-fmt-merge-msg.txt' : 1,
'git-for-each-ref.txt' : 1,
'git-for-each-repo.txt' : 1,
'git-format-patch.txt' : 1,
'git-fsck-objects.txt' : 1,
'git-fsck.txt' : 1,
'git-fsmonitor--daemon.txt' : 1,
'git-gc.txt' : 1,
'git-get-tar-commit-id.txt' : 1,
'git-grep.txt' : 1,
'git-gui.txt' : 1,
'git-hash-object.txt' : 1,
'git-help.txt' : 1,
'git-hook.txt' : 1,
'git-http-backend.txt' : 1,
'git-http-fetch.txt' : 1,
'git-http-push.txt' : 1,
'git-imap-send.txt' : 1,
'git-index-pack.txt' : 1,
'git-init-db.txt' : 1,
'git-init.txt' : 1,
'git-instaweb.txt' : 1,
'git-interpret-trailers.txt' : 1,
'git-log.txt' : 1,
'git-ls-files.txt' : 1,
'git-ls-remote.txt' : 1,
'git-ls-tree.txt' : 1,
'git-mailinfo.txt' : 1,
'git-mailsplit.txt' : 1,
'git-maintenance.txt' : 1,
'git-merge-base.txt' : 1,
'git-merge-file.txt' : 1,
'git-merge-index.txt' : 1,
'git-merge-one-file.txt' : 1,
'git-mergetool--lib.txt' : 1,
'git-mergetool.txt' : 1,
'git-merge-tree.txt' : 1,
'git-merge.txt' : 1,
'git-mktag.txt' : 1,
'git-mktree.txt' : 1,
'git-multi-pack-index.txt' : 1,
'git-mv.txt' : 1,
'git-name-rev.txt' : 1,
'git-notes.txt' : 1,
'git-p4.txt' : 1,
'git-pack-objects.txt' : 1,
'git-pack-redundant.txt' : 1,
'git-pack-refs.txt' : 1,
'git-patch-id.txt' : 1,
'git-prune-packed.txt' : 1,
'git-prune.txt' : 1,
'git-pull.txt' : 1,
'git-push.txt' : 1,
'git-quiltimport.txt' : 1,
'git-range-diff.txt' : 1,
'git-read-tree.txt' : 1,
'git-rebase.txt' : 1,
'git-receive-pack.txt' : 1,
'git-reflog.txt' : 1,
'git-refs.txt' : 1,
'git-remote-ext.txt' : 1,
'git-remote-fd.txt' : 1,
'git-remote.txt' : 1,
'git-repack.txt' : 1,
'git-replace.txt' : 1,
'git-replay.txt' : 1,
'git-request-pull.txt' : 1,
'git-rerere.txt' : 1,
'git-reset.txt' : 1,
'git-restore.txt' : 1,
'git-revert.txt' : 1,
'git-rev-list.txt' : 1,
'git-rev-parse.txt' : 1,
'git-rm.txt' : 1,
'git-send-email.txt' : 1,
'git-send-pack.txt' : 1,
'git-shell.txt' : 1,
'git-sh-i18n--envsubst.txt' : 1,
'git-sh-i18n.txt' : 1,
'git-shortlog.txt' : 1,
'git-show-branch.txt' : 1,
'git-show-index.txt' : 1,
'git-show-ref.txt' : 1,
'git-show.txt' : 1,
'git-sh-setup.txt' : 1,
'git-sparse-checkout.txt' : 1,
'git-stage.txt' : 1,
'git-stash.txt' : 1,
'git-status.txt' : 1,
'git-stripspace.txt' : 1,
'git-submodule.txt' : 1,
'git-svn.txt' : 1,
'git-switch.txt' : 1,
'git-symbolic-ref.txt' : 1,
'git-tag.txt' : 1,
'git-unpack-file.txt' : 1,
'git-unpack-objects.txt' : 1,
'git-update-index.txt' : 1,
'git-update-ref.txt' : 1,
'git-update-server-info.txt' : 1,
'git-upload-archive.txt' : 1,
'git-upload-pack.txt' : 1,
'git-var.txt' : 1,
'git-verify-commit.txt' : 1,
'git-verify-pack.txt' : 1,
'git-verify-tag.txt' : 1,
'git-version.txt' : 1,
'git-web--browse.txt' : 1,
'git-whatchanged.txt' : 1,
'git-worktree.txt' : 1,
'git-write-tree.txt' : 1,
'git.txt' : 1,
'gitk.txt' : 1,
'gitweb.txt' : 1,
'scalar.txt' : 1,
# Category 5.
'gitattributes.txt' : 5,
'gitformat-bundle.txt' : 5,
'gitformat-chunk.txt' : 5,
'gitformat-commit-graph.txt' : 5,
'gitformat-index.txt' : 5,
'gitformat-pack.txt' : 5,
'gitformat-signature.txt' : 5,
'githooks.txt' : 5,
'gitignore.txt' : 5,
'gitmailmap.txt' : 5,
'gitmodules.txt' : 5,
'gitprotocol-capabilities.txt' : 5,
'gitprotocol-common.txt' : 5,
'gitprotocol-http.txt' : 5,
'gitprotocol-pack.txt' : 5,
'gitprotocol-v2.txt' : 5,
'gitrepository-layout.txt' : 5,
'gitweb.conf.txt' : 5,
# Category 7.
'gitcli.txt' : 7,
'gitcore-tutorial.txt' : 7,
'gitcredentials.txt' : 7,
'gitcvs-migration.txt' : 7,
'gitdiffcore.txt' : 7,
'giteveryday.txt' : 7,
'gitfaq.txt' : 7,
'gitglossary.txt' : 7,
'gitpacking.txt' : 7,
'gitnamespaces.txt' : 7,
'gitremote-helpers.txt' : 7,
'gitrevisions.txt' : 7,
'gitsubmodules.txt' : 7,
'gittutorial-2.txt' : 7,
'gittutorial.txt' : 7,
'gitworkflows.txt' : 7,
}
asciidoc = find_program('asciidoc')
git = find_program('git', required: false)
xmlto = find_program('xmlto')
asciidoc_conf = custom_target(
command: [
shell,
meson.project_source_root() / 'GIT-VERSION-GEN',
meson.project_source_root(),
'@INPUT@',
'@OUTPUT@',
],
input: meson.current_source_dir() / 'asciidoc.conf.in',
output: 'asciidoc.conf',
depends: [git_version_file],
)
asciidoc_common_options = [
asciidoc,
'--conf-file=' + asciidoc_conf.full_path(),
'--attribute=build_dir=' + meson.current_build_dir(),
]
cmd_lists = [
'cmds-ancillaryinterrogators.txt',
'cmds-ancillarymanipulators.txt',
'cmds-mainporcelain.txt',
'cmds-plumbinginterrogators.txt',
'cmds-plumbingmanipulators.txt',
'cmds-synchingrepositories.txt',
'cmds-synchelpers.txt',
'cmds-guide.txt',
'cmds-developerinterfaces.txt',
'cmds-userinterfaces.txt',
'cmds-purehelpers.txt',
'cmds-foreignscminterface.txt',
]
documentation_deps = [
asciidoc_conf,
]
documentation_deps += custom_target(
command: [
perl,
meson.current_source_dir() / 'cmd-list.perl',
meson.project_source_root(),
meson.current_build_dir(),
] + cmd_lists,
output: cmd_lists
)
foreach mode : [ 'diff', 'merge' ]
documentation_deps += custom_target(
command: [
shell,
meson.current_source_dir() / 'generate-mergetool-list.sh',
'..',
'diff',
'@OUTPUT@'
],
env: [
'MERGE_TOOLS_DIR=' + meson.project_source_root() / 'mergetools',
'TOOL_MODE=' + mode,
],
output: 'mergetools-' + mode + '.txt',
)
endforeach
foreach manpage, category : manpages
if get_option('docs').contains('man')
manpage_xml_target = custom_target(
command: asciidoc_common_options + [
'--backend=docbook',
'--doctype=manpage',
'--out-file=@OUTPUT@',
meson.current_source_dir() / manpage,
],
depends: documentation_deps,
output: fs.stem(manpage) + '.xml',
)
manpage_path = fs.stem(manpage) + '.' + category.to_string()
manpage_target = custom_target(
command: [
xmlto,
'-m',
meson.current_source_dir() / 'manpage-normal.xsl',
'-m',
meson.current_source_dir() / 'manpage-bold-literal.xsl',
'--stringparam',
'man.base.url.for.relative.links=' + get_option('prefix') / get_option('mandir'),
'man',
manpage_xml_target,
'-o',
meson.current_build_dir(),
],
output: manpage_path,
install: true,
install_dir: get_option('mandir') / 'man' + category.to_string(),
)
endif
if get_option('docs').contains('html') and category == 1
custom_target(
command: asciidoc_common_options + [
'--backend=xhtml11',
'--doctype=manpage',
'--out-file=@OUTPUT@',
meson.current_source_dir() / manpage,
],
depends: documentation_deps,
output: fs.stem(manpage) + '.html',
install: true,
install_dir: get_option('datadir') / 'doc/git-doc',
)
endif
endforeach

28
bin-wrappers/meson.build Normal file
View File

@ -0,0 +1,28 @@
bin_wrappers_config = configuration_data()
foreach key, value : {
'BUILD_DIR': meson.project_build_root(),
'MERGE_TOOLS_DIR': meson.project_source_root() / 'mergetools',
'TEMPLATE_DIR': meson.project_build_root() / 'templates',
'GIT_TEXTDOMAINDIR': meson.project_build_root() / 'po',
'GITPERLLIB': meson.project_build_root() / 'perl/lib',
}
# Paths need to be Unix-style without drive prefixes as they get added to the
# PATH variable. And given that drive prefixes contain a colon we'd otherwise
# end up with a broken PATH if we didn't convert them.
if cygpath.found()
value = run_command(cygpath, value, check: true).stdout().strip()
endif
bin_wrappers_config.set(key, value)
endforeach
foreach executable : bin_wrappers
executable_config = configuration_data()
executable_config.merge_from(bin_wrappers_config)
executable_config.set('PROG', executable.full_path())
configure_file(
input: 'wrap-for-bin.sh',
output: fs.stem(executable.full_path()),
configuration: executable_config,
)
endforeach

View File

@ -0,0 +1,16 @@
foreach script : [
'git-completion.bash',
'git-completion.tcsh',
'git-completion.zsh',
'git-prompt.sh'
]
if meson.version().version_compare('>=1.3.0')
test_dependencies += fs.copyfile(script)
else
configure_file(
input: script,
output: script,
copy: true,
)
endif
endforeach

1
contrib/meson.build Normal file
View File

@ -0,0 +1 @@
subdir('completion')

89
gitweb/meson.build Normal file
View File

@ -0,0 +1,89 @@
gitweb_config = configuration_data()
gitweb_config.set_quoted('PERL_PATH', perl.full_path())
gitweb_config.set_quoted('CSSMIN', '')
gitweb_config.set_quoted('JSMIN', '')
gitweb_config.set_quoted('GIT_BINDIR', get_option('prefix') / get_option('bindir'))
gitweb_config.set_quoted('GITWEB_CONFIG', get_option('gitweb_config'))
gitweb_config.set_quoted('GITWEB_CONFIG_SYSTEM', get_option('gitweb_config_system'))
gitweb_config.set_quoted('GITWEB_CONFIG_COMMON', get_option('gitweb_config_common'))
gitweb_config.set_quoted('GITWEB_HOME_LINK_STR', get_option('gitweb_home_link_str'))
gitweb_config.set_quoted('GITWEB_SITENAME', get_option('gitweb_sitename'))
gitweb_config.set_quoted('GITWEB_PROJECTROOT', get_option('gitweb_projectroot'))
gitweb_config.set_quoted('GITWEB_PROJECT_MAXDEPTH', get_option('gitweb_project_maxdepth'))
gitweb_config.set_quoted('GITWEB_EXPORT_OK', get_option('gitweb_export_ok'))
gitweb_config.set_quoted('GITWEB_STRICT_EXPORT', get_option('gitweb_strict_export'))
gitweb_config.set_quoted('GITWEB_BASE_URL', get_option('gitweb_base_url'))
gitweb_config.set_quoted('GITWEB_LIST', get_option('gitweb_list'))
gitweb_config.set_quoted('GITWEB_HOMETEXT', get_option('gitweb_hometext'))
gitweb_config.set_quoted('GITWEB_CSS', get_option('gitweb_css'))
gitweb_config.set_quoted('GITWEB_LOGO', get_option('gitweb_logo'))
gitweb_config.set_quoted('GITWEB_FAVICON', get_option('gitweb_favicon'))
gitweb_config.set_quoted('GITWEB_JS', get_option('gitweb_js'))
gitweb_config.set_quoted('GITWEB_SITE_HTML_HEAD_STRING', get_option('gitweb_site_html_head_string'))
gitweb_config.set_quoted('GITWEB_SITE_HEADER', get_option('gitweb_site_header'))
gitweb_config.set_quoted('GITWEB_SITE_FOOTER', get_option('gitweb_site_footer'))
gitweb_config.set_quoted('HIGHLIGHT_BIN', get_option('highlight_bin'))
configure_file(
input: 'GITWEB-BUILD-OPTIONS.in',
output: 'GITWEB-BUILD-OPTIONS',
configuration: gitweb_config,
)
test_dependencies += custom_target(
input: 'gitweb.perl',
output: 'gitweb.cgi',
command: [
shell,
meson.current_source_dir() / 'generate-gitweb-cgi.sh',
meson.current_build_dir() / 'GITWEB-BUILD-OPTIONS',
git_version_file.full_path(),
'@INPUT@',
'@OUTPUT@',
],
install: true,
install_dir: get_option('datadir') / 'gitweb',
depends: [git_version_file],
)
javascript_files = [
meson.current_source_dir() / 'static/js/adjust-timezone.js',
meson.current_source_dir() / 'static/js/blame_incremental.js',
meson.current_source_dir() / 'static/js/javascript-detection.js',
meson.current_source_dir() / 'static/js/lib/common-lib.js',
meson.current_source_dir() / 'static/js/lib/cookies.js',
meson.current_source_dir() / 'static/js/lib/datetime.js',
]
test_dependencies += custom_target(
input: javascript_files,
output: 'gitweb.js',
command: [
shell,
meson.current_source_dir() / 'generate-gitweb-js.sh',
'@OUTPUT@',
] + javascript_files,
install: true,
install_dir: get_option('datadir') / 'gitweb/static',
)
foreach asset : [
'static/git-favicon.png',
'static/git-logo.png',
'static/gitweb.css',
]
if meson.version().version_compare('>=1.3.0')
fs.copyfile(asset,
install: true,
install_dir: get_option('datadir') / 'gitweb' / fs.parent(asset),
)
else
configure_file(
input: asset,
output: fs.stem(asset),
copy: true,
install: true,
install_dir: get_option('datadir') / 'gitweb' / fs.parent(asset),
)
endif
endforeach

1901
meson.build Normal file

File diff suppressed because it is too large Load Diff

81
meson_options.txt Normal file
View File

@ -0,0 +1,81 @@
# Configuration for how Git behaves at runtime.
option('default_pager', type: 'string', value: 'less',
description: 'Fall-back pager.')
option('default_editor', type: 'string', value: 'vi',
description: 'Fall-back editor.')
option('gitconfig', type: 'string', value: '/etc/gitconfig',
description: 'Path to the global git configuration file.')
option('gitattributes', type: 'string', value: '/etc/gitattributes',
description: 'Path to the global git attributes file.')
option('pager_environment', type: 'string', value: 'LESS=FRX LV=-c',
description: 'Environment used when spawning the pager')
option('perl_cpan_fallback', type: 'boolean', value: true,
description: 'Install bundled copies of CPAN modules that serve as a fallback in case the modules are not available on the system.')
option('runtime_prefix', type: 'boolean', value: false,
description: 'Resolve ancillary tooling and support files relative to the location of the runtime binary instead of hard-coding them into the binary.')
option('sane_tool_path', type: 'string', value: '',
description: 'A colon-separated list of paths to prepend to PATH if your tools in /usr/bin are broken.')
# Features supported by Git.
option('curl', type: 'feature', value: 'enabled',
description: 'Build helpers used to access remotes with the HTTP transport.')
option('expat', type: 'feature', value: 'enabled',
description: 'Build helpers used to push to remotes with the HTTP transport.')
option('gettext', type: 'feature', value: 'auto',
description: 'Build translation files.')
option('iconv', type: 'feature', value: 'auto',
description: 'Support reencoding strings with different encodings.')
option('pcre2', type: 'feature', value: 'enabled',
description: 'Support Perl-compatible regular expressions in e.g. git-grep(1).')
option('perl', type: 'feature', value: 'auto',
description: 'Build tools written in Perl.')
option('python', type: 'feature', value: 'auto',
description: 'Build tools written in Python.')
option('regex', type: 'feature', value: 'auto',
description: 'Use the system-provided regex library instead of the bundled one.')
# Backends.
option('https_backend', type: 'combo', value: 'auto', choices: ['auto', 'openssl', 'CommonCrypto', 'none'],
description: 'The HTTPS backend to use when connecting to remotes.')
option('sha1_backend', type: 'combo', choices: ['openssl', 'block', 'sha1dc', 'common-crypto'], value: 'sha1dc',
description: 'The backend used for hashing objects with the SHA1 object format')
option('sha256_backend', type: 'combo', choices: ['openssl', 'nettle', 'gcrypt', 'block'], value: 'block',
description: 'The backend used for hashing objects with the SHA256 object format')
# Build tweaks.
option('macos_use_homebrew_gettext', type: 'boolean', value: true,
description: 'Use gettext from Homebrew instead of the slightly-broken system-provided one.')
# gitweb configuration.
option('gitweb_config', type: 'string', value: 'gitweb_config.perl')
option('gitweb_config_system', type: 'string', value: '/etc/gitweb.conf')
option('gitweb_config_common', type: 'string', value: '/etc/gitweb-common.conf')
option('gitweb_home_link_str', type: 'string', value: 'projects')
option('gitweb_sitename', type: 'string', value: '')
option('gitweb_projectroot', type: 'string', value: '/pub/git')
option('gitweb_project_maxdepth', type: 'string', value: '2007')
option('gitweb_export_ok', type: 'string', value: '')
option('gitweb_strict_export', type: 'string', value: '')
option('gitweb_base_url', type: 'string', value: '')
option('gitweb_list', type: 'string', value: '')
option('gitweb_hometext', type: 'string', value: 'indextext.html')
option('gitweb_css', type: 'string', value: 'static/gitweb.css')
option('gitweb_logo', type: 'string', value: 'static/git-logo.png')
option('gitweb_favicon', type: 'string', value: 'static/git-favicon.png')
option('gitweb_js', type: 'string', value: 'static/gitweb.js')
option('gitweb_site_html_head_string', type: 'string', value: '')
option('gitweb_site_header', type: 'string', value: '')
option('gitweb_site_footer', type: 'string', value: '')
option('highlight_bin', type: 'string', value: 'highlight')
# Documentation.
option('docs', type: 'array', choices: ['man', 'html'], value: [],
description: 'Which documenattion formats to build and install.')
option('default_help_format', type: 'combo', choices: ['man', 'html'], value: 'man',
description: 'Default format used when executing git-help(1).')
# Testing.
option('tests', type: 'boolean', value: true,
description: 'Enable building tests. This requires Perl, but is separate from the "perl" option such that you can build tests without Perl features enabled.')
option('test_output_directory', type: 'string',
description: 'Path to the directory used to store test outputs')

View File

@ -0,0 +1,7 @@
test_dependencies += custom_target(
input: 'Address.pm',
output: 'Address.pm',
command: generate_perl_command,
install: true,
install_dir: get_option('datadir') / 'perl5/FromCPAN/Mail',
)

View File

@ -0,0 +1,9 @@
test_dependencies += custom_target(
input: 'Error.pm',
output: 'Error.pm',
command: generate_perl_command,
install: true,
install_dir: get_option('datadir') / 'perl5/FromCPAN',
)
subdir('Mail')

View File

@ -0,0 +1,7 @@
test_dependencies += custom_target(
input: 'Address.pm',
output: 'Address.pm',
command: generate_perl_command,
install: true,
install_dir: get_option('datadir') / 'perl5/Git/LoadCPAN/Mail',
)

View File

@ -0,0 +1,9 @@
test_dependencies += custom_target(
input: 'Error.pm',
output: 'Error.pm',
command: generate_perl_command,
install: true,
install_dir: get_option('datadir') / 'perl5/Git/LoadCPAN',
)
subdir('Mail')

View File

@ -0,0 +1,7 @@
test_dependencies += custom_target(
input: 'YAML.pm',
output: 'YAML.pm',
command: generate_perl_command,
install: true,
install_dir: get_option('datadir') / 'perl5/Git/SVN',
)

20
perl/Git/SVN/meson.build Normal file
View File

@ -0,0 +1,20 @@
foreach source : [
'Editor.pm',
'Fetcher.pm',
'GlobSpec.pm',
'Log.pm',
'Migration.pm',
'Prompt.pm',
'Ra.pm',
'Utils.pm',
]
test_dependencies += custom_target(
input: source,
output: source,
command: generate_perl_command,
install: true,
install_dir: get_option('datadir') / 'perl5/Git/SVN',
)
endforeach
subdir('Memoize')

18
perl/Git/meson.build Normal file
View File

@ -0,0 +1,18 @@
foreach source : [
'I18N.pm',
'IndexInfo.pm',
'LoadCPAN.pm',
'Packet.pm',
'SVN.pm',
]
test_dependencies += custom_target(
input: source,
output: source,
command: generate_perl_command,
install: true,
install_dir: get_option('datadir') / 'perl5/Git',
)
endforeach
subdir('LoadCPAN')
subdir('SVN')

12
perl/meson.build Normal file
View File

@ -0,0 +1,12 @@
test_dependencies += custom_target(
input: 'Git.pm',
output: 'Git.pm',
command: generate_perl_command,
install: true,
install_dir: get_option('datadir') / 'perl5',
)
subdir('Git')
if get_option('perl_cpan_fallback')
subdir('FromCPAN')
endif

27
po/meson.build Normal file
View File

@ -0,0 +1,27 @@
i18n = import('i18n')
translations = i18n.gettext('git',
languages: [
'bg',
'ca',
'de',
'el',
'es',
'fr',
'id',
'is',
'it',
'ko',
'pl',
'pt_PT',
'ru',
'sv',
'tr',
'uk',
'vi',
'zh_CN',
'zh_TW',
],
install: true,
)
test_dependencies += translations[0]

1
subprojects/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/*/

13
subprojects/curl.wrap Normal file
View File

@ -0,0 +1,13 @@
[wrap-file]
directory = curl-8.10.1
source_url = https://github.com/curl/curl/releases/download/curl-8_10_1/curl-8.10.1.tar.xz
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/curl_8.10.1-1/curl-8.10.1.tar.xz
source_filename = curl-8.10.1.tar.xz
source_hash = 73a4b0e99596a09fa5924a4fb7e4b995a85fda0d18a2c02ab9cf134bebce04ee
patch_filename = curl_8.10.1-1_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/curl_8.10.1-1/get_patch
patch_hash = 707c28f35fc9b0e8d68c0c2800712007612f922a31da9637ce706a2159f3ddd8
wrapdb_version = 8.10.1-1
[provide]
dependency_names = libcurl

13
subprojects/expat.wrap Normal file
View File

@ -0,0 +1,13 @@
[wrap-file]
directory = expat-2.6.3
source_url = https://github.com/libexpat/libexpat/releases/download/R_2_6_3/expat-2.6.3.tar.xz
source_filename = expat-2.6.3.tar.bz2
source_hash = 274db254a6979bde5aad404763a704956940e465843f2a9bd9ed7af22e2c0efc
patch_filename = expat_2.6.3-1_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/expat_2.6.3-1/get_patch
patch_hash = cf017fbe105e31428b2768360bd9be39094df4e948a1e8d1c54b6f7c76460cb1
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/expat_2.6.3-1/expat-2.6.3.tar.bz2
wrapdb_version = 2.6.3-1
[provide]
expat = expat_dep

15
subprojects/openssl.wrap Normal file
View File

@ -0,0 +1,15 @@
[wrap-file]
directory = openssl-3.0.8
source_url = https://www.openssl.org/source/openssl-3.0.8.tar.gz
source_filename = openssl-3.0.8.tar.gz
source_hash = 6c13d2bf38fdf31eac3ce2a347073673f5d63263398f1f69d0df4a41253e4b3e
patch_filename = openssl_3.0.8-3_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/openssl_3.0.8-3/get_patch
patch_hash = 300da189e106942347d61a4a4295aa2edbcf06184f8d13b4cee0bed9fb936963
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/openssl_3.0.8-3/openssl-3.0.8.tar.gz
wrapdb_version = 3.0.8-3
[provide]
libcrypto = libcrypto_dep
libssl = libssl_dep
openssl = openssl_dep

16
subprojects/pcre2.wrap Normal file
View File

@ -0,0 +1,16 @@
[wrap-file]
directory = pcre2-10.44
source_url = https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.44/pcre2-10.44.tar.bz2
source_filename = pcre2-10.44.tar.bz2
source_hash = d34f02e113cf7193a1ebf2770d3ac527088d485d4e047ed10e5d217c6ef5de96
patch_filename = pcre2_10.44-2_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/pcre2_10.44-2/get_patch
patch_hash = 4336d422ee9043847e5e10dbbbd01940d4c9e5027f31ccdc33a7898a1ca94009
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/pcre2_10.44-2/pcre2-10.44.tar.bz2
wrapdb_version = 10.44-2
[provide]
libpcre2-8 = libpcre2_8
libpcre2-16 = libpcre2_16
libpcre2-32 = libpcre2_32
libpcre2-posix = libpcre2_posix

13
subprojects/zlib.wrap Normal file
View File

@ -0,0 +1,13 @@
[wrap-file]
directory = zlib-1.3.1
source_url = http://zlib.net/fossils/zlib-1.3.1.tar.gz
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/zlib_1.3.1-1/zlib-1.3.1.tar.gz
source_filename = zlib-1.3.1.tar.gz
source_hash = 9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23
patch_filename = zlib_1.3.1-1_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/zlib_1.3.1-1/get_patch
patch_hash = e79b98eb24a75392009cec6f99ca5cdca9881ff20bfa174e8b8926d5c7a47095
wrapdb_version = 1.3.1-1
[provide]
zlib = zlib_dep

91
t/helper/meson.build Normal file
View File

@ -0,0 +1,91 @@
test_tool_sources = [
'../unit-tests/test-lib.c',
'test-advise.c',
'test-bitmap.c',
'test-bloom.c',
'test-bundle-uri.c',
'test-cache-tree.c',
'test-chmtime.c',
'test-config.c',
'test-crontab.c',
'test-csprng.c',
'test-date.c',
'test-delete-gpgsig.c',
'test-delta.c',
'test-dir-iterator.c',
'test-drop-caches.c',
'test-dump-cache-tree.c',
'test-dump-fsmonitor.c',
'test-dump-split-index.c',
'test-dump-untracked-cache.c',
'test-env-helper.c',
'test-example-tap.c',
'test-find-pack.c',
'test-fsmonitor-client.c',
'test-genrandom.c',
'test-genzeros.c',
'test-getcwd.c',
'test-hash-speed.c',
'test-hash.c',
'test-hashmap.c',
'test-hexdump.c',
'test-json-writer.c',
'test-lazy-init-name-hash.c',
'test-match-trees.c',
'test-mergesort.c',
'test-mktemp.c',
'test-online-cpus.c',
'test-pack-mtimes.c',
'test-parse-options.c',
'test-parse-pathspec-file.c',
'test-partial-clone.c',
'test-path-utils.c',
'test-pcre2-config.c',
'test-pkt-line.c',
'test-proc-receive.c',
'test-progress.c',
'test-reach.c',
'test-read-cache.c',
'test-read-graph.c',
'test-read-midx.c',
'test-ref-store.c',
'test-reftable.c',
'test-regex.c',
'test-repository.c',
'test-revision-walking.c',
'test-rot13-filter.c',
'test-run-command.c',
'test-scrap-cache-tree.c',
'test-serve-v2.c',
'test-sha1.c',
'test-sha256.c',
'test-sigchain.c',
'test-simple-ipc.c',
'test-string-list.c',
'test-submodule-config.c',
'test-submodule-nested-repo-config.c',
'test-submodule.c',
'test-subprocess.c',
'test-tool.c',
'test-trace2.c',
'test-truncate.c',
'test-userdiff.c',
'test-wildmatch.c',
'test-windows-named-pipe.c',
'test-write-cache.c',
'test-xml-encode.c',
]
test_tool = executable('test-tool',
sources: test_tool_sources,
dependencies: [libgit, common_main],
)
bin_wrappers += test_tool
test_dependencies += test_tool
test_fake_ssh = executable('test-fake-ssh',
sources: 'test-fake-ssh.c',
dependencies: [libgit, common_main],
)
bin_wrappers += test_fake_ssh
test_dependencies += test_fake_ssh

1114
t/meson.build Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,26 @@
hooks = [
'applypatch-msg.sample',
'commit-msg.sample',
'fsmonitor-watchman.sample',
'post-update.sample',
'pre-applypatch.sample',
'pre-commit.sample',
'pre-merge-commit.sample',
'prepare-commit-msg.sample',
'pre-push.sample',
'pre-rebase.sample',
'pre-receive.sample',
'push-to-checkout.sample',
'sendemail-validate.sample',
'update.sample',
]
foreach hook : hooks
configure_file(
input: hook,
output: hook,
configuration: template_config,
install: true,
install_dir: get_option('datadir') / 'git-core/templates/hooks',
)
endforeach

View File

@ -0,0 +1,7 @@
configure_file(
input: 'exclude',
output: 'exclude',
configuration: template_config,
install: true,
install_dir: get_option('datadir') / 'git-core/templates/info',
)

15
templates/meson.build Normal file
View File

@ -0,0 +1,15 @@
template_config = configuration_data()
template_config.set('PERL_PATH', perl.found() ? fs.as_posix(perl.full_path()) : '')
template_config.set('SHELL_PATH', fs.as_posix(shell.full_path()))
template_config.set('GITWEBDIR', fs.as_posix(get_option('prefix') / get_option('datadir') / 'gitweb'))
configure_file(
input: 'description',
output: 'description',
configuration: template_config,
install: true,
install_dir: get_option('datadir') / 'git-core/templates',
)
subdir('hooks')
subdir('info')