* [RFC PATCH 00/21] Modernize the build system
@ 2024-10-02 15:15 Patrick Steinhardt
2024-10-02 15:15 ` [RFC PATCH 01/21] Documentation: add comparison of build systems Patrick Steinhardt
` (31 more replies)
0 siblings, 32 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-02 15:15 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz
Hi,
this patch series wires up support for the Meson build system. It is
intended as a request for comments and acts based on the feedback I've
got during the Git contributor's summit and the discussion in [1].
The aim of the patch series is to modernize our build system and set us
up such that we can eventually replace the autoconf- and Makefile-based
build system that we have right now with a more modern alternative. As a
result I'm hoping for the build system to become easier to hack on and
use, have better integration and be faster.
This patch series is rather large. It is structured as follows:
- Patch 1 introduces a comparison of viable build systems. In its
current form, the document is of course rather biased because I am
its author. I am very happy to receive feedback on it to add factors
that I didn't mention yet.
- Patches 2 to 9 fix various different bugs I have found while working
on many different platforms. They can likely go into the tree
separately, and I'm happy to split these out into a separate patch
series if we want to.
- Patches 10 to 20 refactor parts of our preexisting build systems and
testing infrastructure to provide better support for out-of-tree
builds. While we already have CMake build instructions in our tree,
they do not currently have "proper" out-of-tree builds as they still
end up writing data into the source directory. So while these
patches are written with Meson in mind, they should also help CMake.
As a result of these patches, Meson builds and test runs are fully
self-contained.
- Patch 21 implements support for Meson. This is a big change, but
more than half of the lines can be attributed to file listings. I
have tested the build instructions on Linux, FreeBSD, macOS and
Windows. Not all of the platforms pass all of the tests, and I did
not yet get to integrating all of this with MSVC on Windows. Windows
is quite foreign to me, and I spent the last two days ripping my
hair out trying to get everything set up there, so this port is
still a bit more on the rough side. In any case, if we decide that
Meson might be a viable build system for us I will address those
shortcomings, but in the RFC phase I didn't want perfect to be the
enemy of good.
As I've said multiple times, I am strongly in favor of Meson over CMake,
and that's why I invested as much time as I did to wire it up this
extensively. But it goes without saying that this of course doesn't mean
that the project cannot come to a different conclusion than I did.
The patch series is built on top of e9356ba3ea (another batch after
2.47-rc0, 2024-09-30).
Thanks!
[1]: <GV1PR02MB848925A79A9DD733848182D58D662@GV1PR02MB8489.eurprd02.prod.outlook.com>
Patrick Steinhardt (21):
Documentation: add comparison of build systems
t/test-lib: fix quoting of TEST_RESULTS_SAN_FILE
t/lib-gitweb: test against the build version of gitweb
t/lib-gpg: fix setup of GNUPGHOME in MinGW
t3404: work around platform-specific behaviour on macOS 10.15
t/unit-tests: update clar unit test framework
t/clar: simplify how the clar derives `struct stat`
builtin/credential-cache: fix missing parameter for stub function
http: fix build error on FreeBSD
Makefile: extract script to generate clar declarations
Makefile: extract script to massage Perl scripts
Makefile: refactor GIT-VERSION-GEN to be reusable
Makefile: refactor generators to be PWD-independent
Makefile: use common template for GIT-BUILD-OPTIONS
Makefile: consistently use @PLACEHOLDER@ to substitute
Makefile: consistently use PERL_PATH
Makefile: allow "bin-wrappers/" directory to exist
Makefile: simplify building of templates
t: better support for out-of-tree builds
t: allow overriding build dir
Introduce support for the Meson build system
.gitignore | 1 -
Documentation/CodingGuidelines | 2 +-
Documentation/Makefile | 1 +
Documentation/technical/build-systems.txt | 164 ++
GIT-BUILD-OPTIONS.in | 40 +
GIT-VERSION-GEN | 12 +-
Makefile | 186 +-
bin-wrappers/.gitignore | 9 +
bin-wrappers/meson.build | 28 +
bin-wrappers/wrap-for-bin.sh | 37 +
builtin/credential-cache.c | 3 +-
configure.ac | 2 +-
contrib/buildsystems/CMakeLists.txt | 129 +-
contrib/completion/meson.build | 8 +
contrib/meson.build | 1 +
generate-cmdlist.sh | 42 +-
generate-configlist.sh | 20 +-
generate-hooklist.sh | 15 +-
generate-perl.sh | 22 +
git-cvsserver.perl | 2 +-
git-instaweb.sh | 8 +-
git-request-pull.sh | 2 +-
git-send-email.perl | 2 +-
git-sh-i18n.sh | 6 +-
git-sh-setup.sh | 6 +-
git-svn.perl | 2 +-
gitk-git/po/vi.po | 2 +-
gitweb/Makefile | 44 +-
gitweb/gitweb.perl | 44 +-
gitweb/meson.build | 32 +
gitweb/static/meson.build | 28 +
http.c | 10 +-
meson.build | 1567 +++++++++++++++++
meson_options.txt | 67 +
perl/FromCPAN/Mail/meson.build | 7 +
perl/FromCPAN/meson.build | 9 +
perl/Git/I18N.pm | 6 +-
perl/Git/LoadCPAN.pm | 6 +-
perl/Git/LoadCPAN/Mail/meson.build | 7 +
perl/Git/LoadCPAN/meson.build | 9 +
perl/Git/SVN/Memoize/meson.build | 7 +
perl/Git/SVN/meson.build | 20 +
perl/Git/meson.build | 18 +
.../header_templates/fixed_prefix.template.pl | 2 +-
.../runtime_prefix.template.pl | 8 +-
perl/meson.build | 18 +
po/meson.build | 28 +
t/helper/meson.build | 91 +
t/lib-gettext.sh | 4 +-
t/lib-gitweb.sh | 2 +-
t/lib-gpg.sh | 2 +-
t/meson.build | 1107 ++++++++++++
t/t3404-rebase-interactive.sh | 38 +-
t/t7609-mergetool--lib.sh | 2 +-
t/test-lib.sh | 24 +-
t/unit-tests/clar/.editorconfig | 13 +
t/unit-tests/clar/.github/workflows/ci.yml | 20 +-
t/unit-tests/clar/.gitignore | 1 +
t/unit-tests/clar/CMakeLists.txt | 28 +
t/unit-tests/clar/clar.c | 111 +-
t/unit-tests/clar/clar/print.h | 11 +-
t/unit-tests/clar/clar/sandbox.h | 17 +-
t/unit-tests/clar/clar/summary.h | 14 +-
t/unit-tests/clar/test/.gitignore | 4 -
t/unit-tests/clar/test/CMakeLists.txt | 41 +
t/unit-tests/clar/test/Makefile | 39 -
t/unit-tests/generate-clar-decls.sh | 16 +
templates/Makefile | 38 +-
templates/branches-- | 1 -
templates/{this--description => description} | 0
.../applypatch-msg.sample} | 0
.../commit-msg.sample} | 0
.../fsmonitor-watchman.sample} | 0
templates/hooks/meson.build | 24 +
.../post-update.sample} | 0
.../pre-applypatch.sample} | 0
.../pre-commit.sample} | 0
.../pre-merge-commit.sample} | 0
.../pre-push.sample} | 0
.../pre-rebase.sample} | 0
.../pre-receive.sample} | 0
.../prepare-commit-msg.sample} | 0
.../push-to-checkout.sample} | 0
.../sendemail-validate.sample} | 0
.../update.sample} | 0
templates/{info--exclude => info/exclude} | 0
templates/info/meson.build | 5 +
templates/meson.build | 8 +
unimplemented.sh | 2 +-
wrap-for-bin.sh | 36 -
90 files changed, 3901 insertions(+), 487 deletions(-)
create mode 100644 Documentation/technical/build-systems.txt
create mode 100644 GIT-BUILD-OPTIONS.in
create mode 100644 bin-wrappers/.gitignore
create mode 100644 bin-wrappers/meson.build
create mode 100755 bin-wrappers/wrap-for-bin.sh
create mode 100644 contrib/completion/meson.build
create mode 100644 contrib/meson.build
create mode 100755 generate-perl.sh
create mode 100644 gitweb/meson.build
create mode 100644 gitweb/static/meson.build
create mode 100644 meson.build
create mode 100644 meson_options.txt
create mode 100644 perl/FromCPAN/Mail/meson.build
create mode 100644 perl/FromCPAN/meson.build
create mode 100644 perl/Git/LoadCPAN/Mail/meson.build
create mode 100644 perl/Git/LoadCPAN/meson.build
create mode 100644 perl/Git/SVN/Memoize/meson.build
create mode 100644 perl/Git/SVN/meson.build
create mode 100644 perl/Git/meson.build
create mode 100644 perl/meson.build
create mode 100644 po/meson.build
create mode 100644 t/helper/meson.build
create mode 100644 t/meson.build
create mode 100644 t/unit-tests/clar/.editorconfig
create mode 100644 t/unit-tests/clar/.gitignore
create mode 100644 t/unit-tests/clar/CMakeLists.txt
delete mode 100644 t/unit-tests/clar/test/.gitignore
create mode 100644 t/unit-tests/clar/test/CMakeLists.txt
delete mode 100644 t/unit-tests/clar/test/Makefile
create mode 100755 t/unit-tests/generate-clar-decls.sh
delete mode 100644 templates/branches--
rename templates/{this--description => description} (100%)
rename templates/{hooks--applypatch-msg.sample => hooks/applypatch-msg.sample} (100%)
rename templates/{hooks--commit-msg.sample => hooks/commit-msg.sample} (100%)
rename templates/{hooks--fsmonitor-watchman.sample => hooks/fsmonitor-watchman.sample} (100%)
create mode 100644 templates/hooks/meson.build
rename templates/{hooks--post-update.sample => hooks/post-update.sample} (100%)
rename templates/{hooks--pre-applypatch.sample => hooks/pre-applypatch.sample} (100%)
rename templates/{hooks--pre-commit.sample => hooks/pre-commit.sample} (100%)
rename templates/{hooks--pre-merge-commit.sample => hooks/pre-merge-commit.sample} (100%)
rename templates/{hooks--pre-push.sample => hooks/pre-push.sample} (100%)
rename templates/{hooks--pre-rebase.sample => hooks/pre-rebase.sample} (100%)
rename templates/{hooks--pre-receive.sample => hooks/pre-receive.sample} (100%)
rename templates/{hooks--prepare-commit-msg.sample => hooks/prepare-commit-msg.sample} (100%)
rename templates/{hooks--push-to-checkout.sample => hooks/push-to-checkout.sample} (100%)
rename templates/{hooks--sendemail-validate.sample => hooks/sendemail-validate.sample} (100%)
rename templates/{hooks--update.sample => hooks/update.sample} (100%)
rename templates/{info--exclude => info/exclude} (100%)
create mode 100644 templates/info/meson.build
create mode 100644 templates/meson.build
delete mode 100644 wrap-for-bin.sh
--
2.47.0.rc0.dirty
^ permalink raw reply [flat|nested] 386+ messages in thread
* [RFC PATCH 01/21] Documentation: add comparison of build systems
2024-10-02 15:15 [RFC PATCH 00/21] Modernize the build system Patrick Steinhardt
@ 2024-10-02 15:15 ` Patrick Steinhardt
2024-10-02 18:14 ` Junio C Hamano
2024-10-02 20:24 ` Eric Sunshine
2024-10-02 15:15 ` [RFC PATCH 02/21] t/test-lib: fix quoting of TEST_RESULTS_SAN_FILE Patrick Steinhardt
` (30 subsequent siblings)
31 siblings, 2 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-02 15:15 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz
We're contemplating whether to eventually replace our build systems with
a build system that is easier to use. Add a comparison of build systems
to our technical documentation as a baseline for discussion.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Documentation/Makefile | 1 +
Documentation/technical/build-systems.txt | 164 ++++++++++++++++++++++
2 files changed, 165 insertions(+)
create mode 100644 Documentation/technical/build-systems.txt
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 0f55baa252..e23cffb5f9 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -111,6 +111,7 @@ TECH_DOCS += MyFirstObjectWalk
TECH_DOCS += SubmittingPatches
TECH_DOCS += ToolsForGit
TECH_DOCS += technical/bitmap-format
+TECH_DOCS += technical/build-systems
TECH_DOCS += technical/bundle-uri
TECH_DOCS += technical/hash-function-transition
TECH_DOCS += technical/long-running-process-protocol
diff --git a/Documentation/technical/build-systems.txt b/Documentation/technical/build-systems.txt
new file mode 100644
index 0000000000..8fac36ce1d
--- /dev/null
+++ b/Documentation/technical/build-systems.txt
@@ -0,0 +1,164 @@
+= Build Systems
+
+The build system is the primary way for both developers and system integrators
+to interact with the Git project. As such, we consider it important to pick a
+build system that fulfills our requirements while being easy to use and extend.
+
+This document outlines the different requirements that we have for the build
+system and then compares available build systems using these criteria.
+
+== Requirements
+
+The following subsections prevent a list of requirements that we have for any
+potential build system. Sections are sorted by decreasing priority, even though
+these priorities will naturally differ between users.
+
+=== Platform support
+
+The most important criterium is whether the build system supports all of the
+platforms that Git supports. The most important platforms include:
+
+ - Linux
+ - macOS
+ - Windows
+ - FreeBSD
+ - OpenBSD
+ - NetBSD
+
+The platforms which must be supported by the tool should be aligned with our
+[platform support policy](platform-support.txt).
+
+=== Auto-detection of supported features
+
+The build system MUST support auto-detection of features which are or aren't
+available on the current platform. Platform maintainers should not be required
+to manually configure the complete build.
+
+Auto-detection of the following items is considered to be important:
+
+ - Check for the existence of headers.
+ - Check for the existence of libraries.
+ - Check for the existence of exectuables.
+ - Check for the runtime behavior of specific functions.
+
+=== Ease of use
+
+The build system SHOULD be both easy to use and easy to extend. While this is
+naturally a subjective metric it is likely not controversial to say that some
+build systems are considerably harder to use than others.
+
+=== IDE support
+
+The build system SHOULD integrate with well-known IDEs. Well-known IDEs include:
+
+ - Microsoft Visual Studio
+ - Visual Studio Code
+ - Xcode
+
+There are four levels of support:
+
+ - Native integration into the IDE.
+ - Integration into the IDE via a plugin.
+ - Integration into the IDE via generating a project description with the build
+ system.
+ - No integration.
+
+Native integration is preferable, but integration via either a plugin or by
+generating a project description via the build system are considered feasible
+alternatives.
+
+Another important distinction is the level of integration. There are two
+features that one generally wants to have:
+
+ - Integration of build targets.
+ - Automatic setup of features like code completion with detected build
+ dependencies.
+
+The first bullet point is the bare minimum, but is not sufficient to be
+considered proper integration.
+
+=== Out-of-tree builds
+
+The build system SHOULD support out-of-tree builds. Out-of-tree builds allow a
+developer to configure multiple different build directories with different
+configuration, e.g. one "debug" build and one "release" build.
+
+=== Rust support
+
+Many long-time Git contributors are nowadays in favor of adopting Rust as a
+second language next to C. The build system SHOULD thus support Rust such that
+we do not have to reopen the discussion once we decide to pick up Rust.
+
+== Comparison
+
+The following list of build systems are considered:
+
+- GNU Make
+- autoconf
+- CMake
+- Meson
+
+=== GNU Make
+
+- Platform support: ubitquitous on all platforms, but not well-integrated into Windows.
+- Auto-detection: no built-in support for auto-detection of features.
+- Ease of use: easy to use, but discovering available options is hard. Makefile
+ rules can quickly get out of hand once reaching a certain scope.
+- IDE support: execution of Makefile targets is supported by many IDEs
+- Out-of-tree builds: supported in theory, not wired up in practice.
+- Rust: can be added.
+
+=== autoconf
+
+- Platform support: ubiquitous on all platforms, but not well-integrated into Windows.
+- Auto-detection: supported.
+- Ease of use: easy to use, discovering available options is comparatively
+ easy. The autoconf syntax is prohibitively hard to extend though due to its
+ complex set of interacting files and the hard-to-understand M4 language.
+- IDE support: no integration into IDEs at generation time. The generated
+ Makefiles have the same level of support as GNU Make.
+- Out-of-tree builds: supported in theory, not wired up in practice.
+- Rust: not supported.
+
+=== CMake
+
+- Platform support: not as extensive as GNU Make or autoconf, but all major
+ platforms are supported.
+ - AIX
+ - Cygwin
+ - FreeBSD
+ - Linux
+ - OpenBSD
+ - Solaris
+ - Windows
+ - macOS
+- Ease of use: easy to use, discovering available options is not always
+ trivial. The scripting language used by CMake is somewhat cumbersome to use,
+ but extending CMake build instructions is doable.
+- IDE support: natively integrated into Microsoft Visual Studio. Can generate
+ project descriptions for Xcode. An extension is available for Visual Studio
+ Code. Many other IDEs have plugins for CMake.
+- Out-of-tree builds: supported.
+- Rust: not supported.
+
+=== Meson
+
+- Platform: not as extensive as GNU Make or autoconf, but all major platforms
+ and some smaller ones are supported.
+ - AIX
+ - Cygwin
+ - DragonflyBSD
+ - FreeBSD
+ - Haiku
+ - Linux
+ - NetBSD
+ - OpenBSD
+ - Solaris
+ - Windows
+ - macOS
+- Ease of use: easy to use, discovering available options is easy. The
+ scripting language is straight-forward to use.
+- IDE support: Supports generating build instructions for Xcode and Microsoft
+ Visual Studio, a plugin exists for Visual Studio Code.
+- Out-of-tree builds: supported.
+- Rust: supported.
--
2.47.0.rc0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH 02/21] t/test-lib: fix quoting of TEST_RESULTS_SAN_FILE
2024-10-02 15:15 [RFC PATCH 00/21] Modernize the build system Patrick Steinhardt
2024-10-02 15:15 ` [RFC PATCH 01/21] Documentation: add comparison of build systems Patrick Steinhardt
@ 2024-10-02 15:15 ` Patrick Steinhardt
2024-10-02 15:15 ` [RFC PATCH 03/21] t/lib-gitweb: test against the build version of gitweb Patrick Steinhardt
` (29 subsequent siblings)
31 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-02 15:15 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz
When assembling our LSAN_OPTIONS that configure the leak sanitizer we
end up prepending the string with various different colon-separated
options via calls to `prepend_var`. One of the settings we add is the
path where the sanitizer should store logs, which can be an arbitrary
filesystem path.
Naturally, filesystem paths may contain whitespace characters. And while
it does seem as if we were quoting the value, we use escaped quotes and
consequently split up the value if it does contain spaces. This leads to
the following error in t0000 when having a value with whitespaces:
.../t/test-lib.sh: eval: line 64: unexpected EOF while looking for matching `"'
++ return 1
error: last command exited with $?=1
not ok 5 - subtest: 3 passing tests
The error itself is a bit puzzling at first. The basic problem is that
the code sees the leading escaped quote during eval, but because we
truncate everything after the space character it doesn't see the
trailing escaped quote and thus fails to parse the string.
Properly quote the value to fix the issue while using single-quotes to
quote the inner value passed to eval. The issue can be reproduced by
t0000 with such a path that contains spaces.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
t/test-lib.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index e718efe4c6..5de93911b9 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1601,7 +1601,7 @@ then
prepend_var LSAN_OPTIONS : dedup_token_length=9999
prepend_var LSAN_OPTIONS : log_exe_name=1
- prepend_var LSAN_OPTIONS : log_path=\"$TEST_RESULTS_SAN_FILE\"
+ prepend_var LSAN_OPTIONS : log_path="'$TEST_RESULTS_SAN_FILE'"
export LSAN_OPTIONS
elif test "$GIT_TEST_PASSING_SANITIZE_LEAK" = "check" ||
--
2.47.0.rc0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH 03/21] t/lib-gitweb: test against the build version of gitweb
2024-10-02 15:15 [RFC PATCH 00/21] Modernize the build system Patrick Steinhardt
2024-10-02 15:15 ` [RFC PATCH 01/21] Documentation: add comparison of build systems Patrick Steinhardt
2024-10-02 15:15 ` [RFC PATCH 02/21] t/test-lib: fix quoting of TEST_RESULTS_SAN_FILE Patrick Steinhardt
@ 2024-10-02 15:15 ` Patrick Steinhardt
2024-10-02 15:15 ` [RFC PATCH 04/21] t/lib-gpg: fix setup of GNUPGHOME in MinGW Patrick Steinhardt
` (28 subsequent siblings)
31 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-02 15:15 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz
When testing gitweb we set up the CGI script as "gitweb.perl", which is
the source file of the build target "gitweb.cgi". This works alright as
long as we run in-tree tests. But we're about to make out-of-tree tests
a reality, and there things will break because "gitweb.perl" will not be
found in the build directory.
Fix this by using "gitweb.cgi" instead.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
t/lib-gitweb.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/lib-gitweb.sh b/t/lib-gitweb.sh
index 1f32ca66ea..c64c87fb87 100644
--- a/t/lib-gitweb.sh
+++ b/t/lib-gitweb.sh
@@ -49,7 +49,7 @@ EOF
error "Cannot find gitweb at $GITWEB_TEST_INSTALLED."
say "# Testing $SCRIPT_NAME"
else # normal case, use source version of gitweb
- SCRIPT_NAME="$GIT_BUILD_DIR/gitweb/gitweb.perl"
+ SCRIPT_NAME="$GIT_BUILD_DIR/gitweb/gitweb.cgi"
fi
export SCRIPT_NAME
}
--
2.47.0.rc0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH 04/21] t/lib-gpg: fix setup of GNUPGHOME in MinGW
2024-10-02 15:15 [RFC PATCH 00/21] Modernize the build system Patrick Steinhardt
` (2 preceding siblings ...)
2024-10-02 15:15 ` [RFC PATCH 03/21] t/lib-gitweb: test against the build version of gitweb Patrick Steinhardt
@ 2024-10-02 15:15 ` Patrick Steinhardt
2024-10-02 21:49 ` Eric Sunshine
2024-10-02 15:15 ` [RFC PATCH 05/21] t3404: work around platform-specific behaviour on macOS 10.15 Patrick Steinhardt
` (27 subsequent siblings)
31 siblings, 1 reply; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-02 15:15 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz
In "t/lib-gpg.sh" we set up the "GNUPGHOME" environment variable to
point to a test-specific diretcory. This is done by using "$PWD/gpghome"
as value, where "$PWD" is the current test's trash directory.
This is broken for MinGW though because "$PWD" will use Windows-style
paths that contain drive letters. What we really want in this context is
a Unix-style path, which we can get by using `$(pwd)` instead.
Adapt the code accordingly to fix tests using this library.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
t/lib-gpg.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/lib-gpg.sh b/t/lib-gpg.sh
index add11e88fc..3845b6ac44 100644
--- a/t/lib-gpg.sh
+++ b/t/lib-gpg.sh
@@ -6,7 +6,7 @@
# executed in an eval'ed subshell that changes the working directory to a
# temporary one.
-GNUPGHOME="$PWD/gpghome"
+GNUPGHOME="$(pwd)/gpghome"
export GNUPGHOME
test_lazy_prereq GPG '
--
2.47.0.rc0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH 05/21] t3404: work around platform-specific behaviour on macOS 10.15
2024-10-02 15:15 [RFC PATCH 00/21] Modernize the build system Patrick Steinhardt
` (3 preceding siblings ...)
2024-10-02 15:15 ` [RFC PATCH 04/21] t/lib-gpg: fix setup of GNUPGHOME in MinGW Patrick Steinhardt
@ 2024-10-02 15:15 ` Patrick Steinhardt
2024-10-02 21:43 ` Eric Sunshine
2024-10-02 15:15 ` [RFC PATCH 06/21] t/unit-tests: update clar unit test framework Patrick Steinhardt
` (26 subsequent siblings)
31 siblings, 1 reply; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-02 15:15 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz
Two of our tests in t3404 use indented HERE docs where leading tabs on
some of the lines are actually relevant. The tabs do get removed though,
and we try to fix this up by using sed(1) to replace leading tabs in the
actual output, as well. But on macOS 10.15 this doesn't work as expected
and we somehow keep the tabs around in the actual output.
Work around this issue by retaining the tabs.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
t/t3404-rebase-interactive.sh | 38 +++++++++++++++++------------------
1 file changed, 18 insertions(+), 20 deletions(-)
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index f171af3061..da4f3e6caf 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -1917,18 +1917,17 @@ test_expect_success '--update-refs updates refs correctly' '
test_cmp_rev HEAD~1 refs/heads/third &&
test_cmp_rev HEAD refs/heads/no-conflict-branch &&
- cat >expect <<-\EOF &&
- Successfully rebased and updated refs/heads/update-refs.
- Updated the following refs with --update-refs:
- refs/heads/first
- refs/heads/no-conflict-branch
- refs/heads/second
- refs/heads/third
- EOF
+ cat >expect <<\EOF &&
+Successfully rebased and updated refs/heads/update-refs.
+Updated the following refs with --update-refs:
+ refs/heads/first
+ refs/heads/no-conflict-branch
+ refs/heads/second
+ refs/heads/third
+EOF
# Clear "Rebasing (X/Y)" progress lines and drop leading tabs.
- sed -e "s/Rebasing.*Successfully/Successfully/g" -e "s/^\t//g" \
- <err >err.trimmed &&
+ sed "s/Rebasing.*Successfully/Successfully/g" <err >err.trimmed &&
test_cmp expect err.trimmed
'
@@ -2178,19 +2177,18 @@ test_expect_success '--update-refs: check failed ref update' '
test_must_fail git rebase --continue 2>err &&
grep "update_ref failed for ref '\''refs/heads/second'\''" err &&
- cat >expect <<-\EOF &&
- Updated the following refs with --update-refs:
- refs/heads/first
- refs/heads/no-conflict-branch
- refs/heads/third
- Failed to update the following refs with --update-refs:
- refs/heads/second
- EOF
+ cat >expect <<\EOF &&
+Updated the following refs with --update-refs:
+ refs/heads/first
+ refs/heads/no-conflict-branch
+ refs/heads/third
+Failed to update the following refs with --update-refs:
+ refs/heads/second
+EOF
# Clear "Rebasing (X/Y)" progress lines and drop leading tabs.
tail -n 6 err >err.last &&
- sed -e "s/Rebasing.*Successfully/Successfully/g" -e "s/^\t//g" \
- <err.last >err.trimmed &&
+ sed "s/Rebasing.*Successfully/Successfully/g" <err.last >err.trimmed &&
test_cmp expect err.trimmed
'
--
2.47.0.rc0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH 06/21] t/unit-tests: update clar unit test framework
2024-10-02 15:15 [RFC PATCH 00/21] Modernize the build system Patrick Steinhardt
` (4 preceding siblings ...)
2024-10-02 15:15 ` [RFC PATCH 05/21] t3404: work around platform-specific behaviour on macOS 10.15 Patrick Steinhardt
@ 2024-10-02 15:15 ` Patrick Steinhardt
2024-10-02 15:15 ` [RFC PATCH 07/21] t/clar: simplify how the clar derives `struct stat` Patrick Steinhardt
` (25 subsequent siblings)
31 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-02 15:15 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz
Update clar unit test framework to 67e689a (Merge pull request #103 from
pks-t/pks-editorconfig, 2024-09-20).
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
t/unit-tests/clar/.editorconfig | 13 +++
t/unit-tests/clar/.github/workflows/ci.yml | 20 +++-
t/unit-tests/clar/.gitignore | 1 +
t/unit-tests/clar/CMakeLists.txt | 28 ++++++
t/unit-tests/clar/clar.c | 102 +++++++++++----------
t/unit-tests/clar/clar/print.h | 11 ++-
t/unit-tests/clar/clar/sandbox.h | 17 ++--
t/unit-tests/clar/clar/summary.h | 14 +--
t/unit-tests/clar/test/.gitignore | 4 -
t/unit-tests/clar/test/CMakeLists.txt | 41 +++++++++
t/unit-tests/clar/test/Makefile | 39 --------
11 files changed, 172 insertions(+), 118 deletions(-)
create mode 100644 t/unit-tests/clar/.editorconfig
create mode 100644 t/unit-tests/clar/.gitignore
create mode 100644 t/unit-tests/clar/CMakeLists.txt
delete mode 100644 t/unit-tests/clar/test/.gitignore
create mode 100644 t/unit-tests/clar/test/CMakeLists.txt
delete mode 100644 t/unit-tests/clar/test/Makefile
diff --git a/t/unit-tests/clar/.editorconfig b/t/unit-tests/clar/.editorconfig
new file mode 100644
index 0000000000..aa343a4288
--- /dev/null
+++ b/t/unit-tests/clar/.editorconfig
@@ -0,0 +1,13 @@
+root = true
+
+[*]
+charset = utf-8
+insert_final_newline = true
+
+[*.{c,h}]
+indent_style = tab
+tab_width = 8
+
+[CMakeLists.txt]
+indent_style = tab
+tab_width = 8
diff --git a/t/unit-tests/clar/.github/workflows/ci.yml b/t/unit-tests/clar/.github/workflows/ci.yml
index b1ac2de460..0065843d17 100644
--- a/t/unit-tests/clar/.github/workflows/ci.yml
+++ b/t/unit-tests/clar/.github/workflows/ci.yml
@@ -10,14 +10,26 @@ jobs:
build:
strategy:
matrix:
- os: [ ubuntu-latest, macos-latest ]
+ platform:
+ - os: ubuntu-latest
+ generator: Unix Makefiles
+ - os: macos-latest
+ generator: Unix Makefiles
+ - os: windows-latest
+ generator: Visual Studio 17 2022
+ - os: windows-latest
+ generator: MSYS Makefiles
+ - os: windows-latest
+ generator: MinGW Makefiles
- runs-on: ${{ matrix.os }}
+ runs-on: ${{ matrix.platform.os }}
steps:
- name: Check out
uses: actions/checkout@v2
- name: Build
run: |
- cd test
- make
+ mkdir build
+ cd build
+ cmake .. -G "${{matrix.platform.generator}}"
+ cmake --build .
diff --git a/t/unit-tests/clar/.gitignore b/t/unit-tests/clar/.gitignore
new file mode 100644
index 0000000000..84c048a73c
--- /dev/null
+++ b/t/unit-tests/clar/.gitignore
@@ -0,0 +1 @@
+/build/
diff --git a/t/unit-tests/clar/CMakeLists.txt b/t/unit-tests/clar/CMakeLists.txt
new file mode 100644
index 0000000000..12d4af114f
--- /dev/null
+++ b/t/unit-tests/clar/CMakeLists.txt
@@ -0,0 +1,28 @@
+cmake_minimum_required(VERSION 3.16..3.29)
+
+project(clar LANGUAGES C)
+
+option(BUILD_TESTS "Build test executable" ON)
+
+add_library(clar INTERFACE)
+target_sources(clar INTERFACE
+ clar.c
+ clar.h
+ clar/fixtures.h
+ clar/fs.h
+ clar/print.h
+ clar/sandbox.h
+ clar/summary.h
+)
+set_target_properties(clar PROPERTIES
+ C_STANDARD 90
+ C_STANDARD_REQUIRED ON
+ C_EXTENSIONS OFF
+)
+
+if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
+ include(CTest)
+ if(BUILD_TESTING)
+ add_subdirectory(test)
+ endif()
+endif()
diff --git a/t/unit-tests/clar/clar.c b/t/unit-tests/clar/clar.c
index cef0f023c2..f463ee823a 100644
--- a/t/unit-tests/clar/clar.c
+++ b/t/unit-tests/clar/clar.c
@@ -4,7 +4,8 @@
* This file is part of clar, distributed under the ISC license.
* For full terms see the included COPYING file.
*/
-#include <assert.h>
+
+#include <errno.h>
#include <setjmp.h>
#include <stdlib.h>
#include <stdio.h>
@@ -13,6 +14,7 @@
#include <stdarg.h>
#include <wchar.h>
#include <time.h>
+#include <inttypes.h>
/* required for sandboxing */
#include <sys/types.h>
@@ -61,13 +63,6 @@
# define p_snprintf snprintf
# endif
-# ifndef PRIuZ
-# define PRIuZ "Iu"
-# endif
-# ifndef PRIxZ
-# define PRIxZ "Ix"
-# endif
-
# if defined(_MSC_VER) || (defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR))
typedef struct stat STAT_T;
# else
@@ -78,12 +73,6 @@
# include <unistd.h>
# define _MAIN_CC
# define p_snprintf snprintf
-# ifndef PRIuZ
-# define PRIuZ "zu"
-# endif
-# ifndef PRIxZ
-# define PRIxZ "zx"
-# endif
typedef struct stat STAT_T;
#endif
@@ -102,7 +91,7 @@ fixture_path(const char *base, const char *fixture_name);
struct clar_error {
const char *file;
const char *function;
- size_t line_number;
+ uintmax_t line_number;
const char *error_msg;
char *description;
@@ -195,11 +184,12 @@ static void clar_print_shutdown(int test_count, int suite_count, int error_count
static void clar_print_error(int num, const struct clar_report *report, const struct clar_error *error);
static void clar_print_ontest(const char *suite_name, const char *test_name, int test_number, enum cl_test_status failed);
static void clar_print_onsuite(const char *suite_name, int suite_index);
+static void clar_print_onabortv(const char *msg, va_list argp);
static void clar_print_onabort(const char *msg, ...);
/* From clar_sandbox.c */
static void clar_unsandbox(void);
-static int clar_sandbox(void);
+static void clar_sandbox(void);
/* From summary.h */
static struct clar_summary *clar_summary_init(const char *filename);
@@ -218,6 +208,15 @@ static int clar_summary_shutdown(struct clar_summary *fp);
_clar.trace_payload); \
} while (0)
+static void clar_abort(const char *msg, ...)
+{
+ va_list argp;
+ va_start(argp, msg);
+ clar_print_onabortv(msg, argp);
+ va_end(argp);
+ exit(-1);
+}
+
void cl_trace_register(cl_trace_cb *cb, void *payload)
{
_clar.pfn_trace_cb = cb;
@@ -271,9 +270,7 @@ static double clar_time_diff(clar_time *start, clar_time *end)
static void clar_time_now(clar_time *out)
{
- struct timezone tz;
-
- gettimeofday(out, &tz);
+ gettimeofday(out, NULL);
}
static double clar_time_diff(clar_time *start, clar_time *end)
@@ -386,7 +383,8 @@ clar_run_suite(const struct clar_suite *suite, const char *filter)
_clar.active_test = test[i].name;
- report = calloc(1, sizeof(struct clar_report));
+ if ((report = calloc(1, sizeof(*report))) == NULL)
+ clar_abort("Failed to allocate report.\n");
report->suite = _clar.active_suite;
report->test = _clar.active_test;
report->test_number = _clar.tests_ran;
@@ -479,9 +477,10 @@ clar_parse_args(int argc, char **argv)
switch (action) {
case 's': {
- struct clar_explicit *explicit =
- calloc(1, sizeof(struct clar_explicit));
- assert(explicit);
+ struct clar_explicit *explicit;
+
+ if ((explicit = calloc(1, sizeof(*explicit))) == NULL)
+ clar_abort("Failed to allocate explicit test.\n");
explicit->suite_idx = j;
explicit->filter = argument;
@@ -505,10 +504,8 @@ clar_parse_args(int argc, char **argv)
}
}
- if (!found) {
- clar_print_onabort("No suite matching '%s' found.\n", argument);
- exit(-1);
- }
+ if (!found)
+ clar_abort("No suite matching '%s' found.\n", argument);
break;
}
@@ -540,11 +537,17 @@ clar_parse_args(int argc, char **argv)
case 'r':
_clar.write_summary = 1;
free(_clar.summary_filename);
- _clar.summary_filename = *(argument + 2) ? strdup(argument + 2) : NULL;
+ if (*(argument + 2)) {
+ if ((_clar.summary_filename = strdup(argument + 2)) == NULL)
+ clar_abort("Failed to allocate summary filename.\n");
+ } else {
+ _clar.summary_filename = NULL;
+ }
break;
default:
- assert(!"Unexpected commandline argument!");
+ clar_abort("Unexpected commandline argument '%s'.\n",
+ argument[1]);
}
}
}
@@ -566,22 +569,18 @@ clar_test_init(int argc, char **argv)
if (!_clar.summary_filename &&
(summary_env = getenv("CLAR_SUMMARY")) != NULL) {
_clar.write_summary = 1;
- _clar.summary_filename = strdup(summary_env);
+ if ((_clar.summary_filename = strdup(summary_env)) == NULL)
+ clar_abort("Failed to allocate summary filename.\n");
}
if (_clar.write_summary && !_clar.summary_filename)
- _clar.summary_filename = strdup("summary.xml");
+ if ((_clar.summary_filename = strdup("summary.xml")) == NULL)
+ clar_abort("Failed to allocate summary filename.\n");
- if (_clar.write_summary &&
- !(_clar.summary = clar_summary_init(_clar.summary_filename))) {
- clar_print_onabort("Failed to open the summary file\n");
- exit(-1);
- }
+ if (_clar.write_summary)
+ _clar.summary = clar_summary_init(_clar.summary_filename);
- if (clar_sandbox() < 0) {
- clar_print_onabort("Failed to sandbox the test runner.\n");
- exit(-1);
- }
+ clar_sandbox();
}
int
@@ -615,10 +614,9 @@ clar_test_shutdown(void)
clar_unsandbox();
- if (_clar.write_summary && clar_summary_shutdown(_clar.summary) < 0) {
- clar_print_onabort("Failed to write the summary file\n");
- exit(-1);
- }
+ if (_clar.write_summary && clar_summary_shutdown(_clar.summary) < 0)
+ clar_abort("Failed to write the summary file '%s: %s.\n",
+ _clar.summary_filename, strerror(errno));
for (explicit = _clar.explicit; explicit; explicit = explicit_next) {
explicit_next = explicit->next;
@@ -649,7 +647,7 @@ static void abort_test(void)
{
if (!_clar.trampoline_enabled) {
clar_print_onabort(
- "Fatal error: a cleanup method raised an exception.");
+ "Fatal error: a cleanup method raised an exception.\n");
clar_report_errors(_clar.last_report);
exit(-1);
}
@@ -673,7 +671,10 @@ void clar__fail(
const char *description,
int should_abort)
{
- struct clar_error *error = calloc(1, sizeof(struct clar_error));
+ struct clar_error *error;
+
+ if ((error = calloc(1, sizeof(*error))) == NULL)
+ clar_abort("Failed to allocate error.\n");
if (_clar.last_report->errors == NULL)
_clar.last_report->errors = error;
@@ -688,8 +689,9 @@ void clar__fail(
error->line_number = line;
error->error_msg = error_msg;
- if (description != NULL)
- error->description = strdup(description);
+ if (description != NULL &&
+ (error->description = strdup(description)) == NULL)
+ clar_abort("Failed to allocate description.\n");
_clar.total_errors++;
_clar.last_report->status = CL_TEST_FAILURE;
@@ -798,8 +800,8 @@ void clar__assert_equal(
}
}
}
- else if (!strcmp("%"PRIuZ, fmt) || !strcmp("%"PRIxZ, fmt)) {
- size_t sz1 = va_arg(args, size_t), sz2 = va_arg(args, size_t);
+ else if (!strcmp("%"PRIuMAX, fmt) || !strcmp("%"PRIxMAX, fmt)) {
+ uintmax_t sz1 = va_arg(args, uintmax_t), sz2 = va_arg(args, uintmax_t);
is_equal = (sz1 == sz2);
if (!is_equal) {
int offset = p_snprintf(buf, sizeof(buf), fmt, sz1);
diff --git a/t/unit-tests/clar/clar/print.h b/t/unit-tests/clar/clar/print.h
index c17e2f693b..69d0ee967e 100644
--- a/t/unit-tests/clar/clar/print.h
+++ b/t/unit-tests/clar/clar/print.h
@@ -21,7 +21,7 @@ static void clar_print_clap_error(int num, const struct clar_report *report, con
{
printf(" %d) Failure:\n", num);
- printf("%s::%s [%s:%"PRIuZ"]\n",
+ printf("%s::%s [%s:%"PRIuMAX"]\n",
report->suite,
report->test,
error->file,
@@ -136,7 +136,7 @@ static void clar_print_tap_ontest(const char *suite_name, const char *test_name,
printf(" at:\n");
printf(" file: '"); print_escaped(error->file); printf("'\n");
- printf(" line: %" PRIuZ "\n", error->line_number);
+ printf(" line: %" PRIuMAX "\n", error->line_number);
printf(" function: '%s'\n", error->function);
printf(" ---\n");
@@ -202,10 +202,15 @@ static void clar_print_onsuite(const char *suite_name, int suite_index)
PRINT(onsuite, suite_name, suite_index);
}
+static void clar_print_onabortv(const char *msg, va_list argp)
+{
+ PRINT(onabort, msg, argp);
+}
+
static void clar_print_onabort(const char *msg, ...)
{
va_list argp;
va_start(argp, msg);
- PRINT(onabort, msg, argp);
+ clar_print_onabortv(msg, argp);
va_end(argp);
}
diff --git a/t/unit-tests/clar/clar/sandbox.h b/t/unit-tests/clar/clar/sandbox.h
index e25057b7c4..681a1f80f1 100644
--- a/t/unit-tests/clar/clar/sandbox.h
+++ b/t/unit-tests/clar/clar/sandbox.h
@@ -122,14 +122,14 @@ static int build_sandbox_path(void)
if (mkdir(_clar_path, 0700) != 0)
return -1;
-#elif defined(__TANDEM)
- if (mktemp(_clar_path) == NULL)
+#elif defined(_WIN32)
+ if (_mktemp_s(_clar_path, sizeof(_clar_path)) != 0)
return -1;
if (mkdir(_clar_path, 0700) != 0)
return -1;
-#elif defined(_WIN32)
- if (_mktemp_s(_clar_path, sizeof(_clar_path)) != 0)
+#elif defined(__TANDEM)
+ if (mktemp(_clar_path) == NULL)
return -1;
if (mkdir(_clar_path, 0700) != 0)
@@ -142,15 +142,14 @@ static int build_sandbox_path(void)
return 0;
}
-static int clar_sandbox(void)
+static void clar_sandbox(void)
{
if (_clar_path[0] == '\0' && build_sandbox_path() < 0)
- return -1;
+ clar_abort("Failed to build sandbox path.\n");
if (chdir(_clar_path) != 0)
- return -1;
-
- return 0;
+ clar_abort("Failed to change into sandbox directory '%s': %s.\n",
+ _clar_path, strerror(errno));
}
const char *clar_sandbox_path(void)
diff --git a/t/unit-tests/clar/clar/summary.h b/t/unit-tests/clar/clar/summary.h
index 4dd352e28b..0d0b646fe7 100644
--- a/t/unit-tests/clar/clar/summary.h
+++ b/t/unit-tests/clar/clar/summary.h
@@ -66,16 +66,12 @@ struct clar_summary *clar_summary_init(const char *filename)
struct clar_summary *summary;
FILE *fp;
- if ((fp = fopen(filename, "w")) == NULL) {
- perror("fopen");
- return NULL;
- }
+ if ((fp = fopen(filename, "w")) == NULL)
+ clar_abort("Failed to open the summary file '%s': %s.\n",
+ filename, strerror(errno));
- if ((summary = malloc(sizeof(struct clar_summary))) == NULL) {
- perror("malloc");
- fclose(fp);
- return NULL;
- }
+ if ((summary = malloc(sizeof(struct clar_summary))) == NULL)
+ clar_abort("Failed to allocate summary.\n");
summary->filename = filename;
summary->fp = fp;
diff --git a/t/unit-tests/clar/test/.gitignore b/t/unit-tests/clar/test/.gitignore
deleted file mode 100644
index a477d0c40c..0000000000
--- a/t/unit-tests/clar/test/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-clar.suite
-.clarcache
-clar_test
-*.o
diff --git a/t/unit-tests/clar/test/CMakeLists.txt b/t/unit-tests/clar/test/CMakeLists.txt
new file mode 100644
index 0000000000..4c9012d061
--- /dev/null
+++ b/t/unit-tests/clar/test/CMakeLists.txt
@@ -0,0 +1,41 @@
+find_package(Python COMPONENTS Interpreter REQUIRED)
+
+add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/clar.suite"
+ COMMAND "${Python_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/generate.py" --output "${CMAKE_CURRENT_BINARY_DIR}"
+ DEPENDS main.c sample.c clar_test.h
+ WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
+)
+
+add_executable(clar_test)
+set_target_properties(clar_test PROPERTIES
+ C_STANDARD 90
+ C_STANDARD_REQUIRED ON
+ C_EXTENSIONS OFF
+)
+
+# MSVC generates all kinds of warnings. We may want to fix these in the future
+# and then unconditionally treat warnings as errors.
+if(NOT MSVC)
+ set_target_properties(clar_test PROPERTIES
+ COMPILE_WARNING_AS_ERROR ON
+ )
+endif()
+
+target_sources(clar_test PRIVATE
+ main.c
+ sample.c
+ "${CMAKE_CURRENT_BINARY_DIR}/clar.suite"
+)
+target_compile_definitions(clar_test PRIVATE
+ CLAR_FIXTURE_PATH="${CMAKE_CURRENT_SOURCE_DIR}/resources/"
+ _DARWIN_C_SOURCE
+ _POSIX_C_SOURCE=200809L
+)
+target_compile_options(clar_test PRIVATE
+ $<IF:$<CXX_COMPILER_ID:MSVC>,/W4,-Wall>
+)
+target_include_directories(clar_test PRIVATE
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_CURRENT_BINARY_DIR}"
+)
+target_link_libraries(clar_test clar)
diff --git a/t/unit-tests/clar/test/Makefile b/t/unit-tests/clar/test/Makefile
deleted file mode 100644
index 93c6b2ad32..0000000000
--- a/t/unit-tests/clar/test/Makefile
+++ /dev/null
@@ -1,39 +0,0 @@
-#
-# Copyright (c) Vicent Marti. All rights reserved.
-#
-# This file is part of clar, distributed under the ISC license.
-# For full terms see the included COPYING file.
-#
-
-#
-# Set up the path to the clar sources and to the fixtures directory
-#
-# The fixture path needs to be an absolute path so it can be used
-# even after we have chdir'ed into the test directory while testing.
-#
-CURRENT_MAKEFILE := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
-TEST_DIRECTORY := $(abspath $(dir $(CURRENT_MAKEFILE)))
-CLAR_PATH := $(dir $(TEST_DIRECTORY))
-CLAR_FIXTURE_PATH := $(TEST_DIRECTORY)/resources/
-
-CFLAGS=-g -I.. -I. -Wall -DCLAR_FIXTURE_PATH=\"$(CLAR_FIXTURE_PATH)\"
-
-.PHONY: clean
-
-# list the objects that go into our test
-objects = main.o sample.o
-
-# build the test executable itself
-clar_test: $(objects) clar_test.h clar.suite $(CLAR_PATH)clar.c
- $(CC) $(CFLAGS) -o $@ "$(CLAR_PATH)clar.c" $(objects)
-
-# test object files depend on clar macros
-$(objects) : $(CLAR_PATH)clar.h
-
-# build the clar.suite file of test metadata
-clar.suite:
- python "$(CLAR_PATH)generate.py" .
-
-# remove all generated files
-clean:
- $(RM) -rf *.o clar.suite .clarcache clar_test clar_test.dSYM
--
2.47.0.rc0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH 07/21] t/clar: simplify how the clar derives `struct stat`
2024-10-02 15:15 [RFC PATCH 00/21] Modernize the build system Patrick Steinhardt
` (5 preceding siblings ...)
2024-10-02 15:15 ` [RFC PATCH 06/21] t/unit-tests: update clar unit test framework Patrick Steinhardt
@ 2024-10-02 15:15 ` Patrick Steinhardt
2024-10-02 15:16 ` [RFC PATCH 08/21] builtin/credential-cache: fix missing parameter for stub function Patrick Steinhardt
` (24 subsequent siblings)
31 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-02 15:15 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz
Windows has different definitions of `struct stat`. The difference
between those structs is that they either use 32 or 64 bit timestamps
and/or filesizes.
In the clar we try to set that up automatically, but the logic to do so
is somewhat convoluted and really fragile. Refactor the code such that
we always define the `stat()` function and its structure together, which
is both easier to understand and less fragile.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
t/unit-tests/clar/clar.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/t/unit-tests/clar/clar.c b/t/unit-tests/clar/clar.c
index f463ee823a..12fa66d088 100644
--- a/t/unit-tests/clar/clar.c
+++ b/t/unit-tests/clar/clar.c
@@ -30,6 +30,9 @@
# ifndef stat
# define stat(path, st) _stat(path, st)
+ typedef struct _stat STAT_T;
+# else
+ typedef struct stat STAT_T;
# endif
# ifndef mkdir
# define mkdir(path, mode) _mkdir(path)
@@ -62,12 +65,6 @@
# else
# define p_snprintf snprintf
# endif
-
-# if defined(_MSC_VER) || (defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR))
- typedef struct stat STAT_T;
-# else
- typedef struct _stat STAT_T;
-# endif
#else
# include <sys/wait.h> /* waitpid(2) */
# include <unistd.h>
--
2.47.0.rc0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH 08/21] builtin/credential-cache: fix missing parameter for stub function
2024-10-02 15:15 [RFC PATCH 00/21] Modernize the build system Patrick Steinhardt
` (6 preceding siblings ...)
2024-10-02 15:15 ` [RFC PATCH 07/21] t/clar: simplify how the clar derives `struct stat` Patrick Steinhardt
@ 2024-10-02 15:16 ` Patrick Steinhardt
2024-10-02 15:16 ` [RFC PATCH 09/21] http: fix build error on FreeBSD Patrick Steinhardt
` (23 subsequent siblings)
31 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-02 15:16 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz
When not compiling the credential cache we may use a stub function for
`cmd_credential_cache()`. With commit 9b1cb5070f (builtin: add a
repository parameter for builtin functions, 2024-09-13), we have added a
new parameter to all of those top-level `cmd_*()` functions, and did
indeed adapt the non-stubbed-out `cmd_credential_cache()`. But we didn't
adapt the stubbed-out variant, so the code does not compile.
Fix this by adding the missing parameter.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
builtin/credential-cache.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/builtin/credential-cache.c b/builtin/credential-cache.c
index 5de8b9123b..c51f7fc2ad 100644
--- a/builtin/credential-cache.c
+++ b/builtin/credential-cache.c
@@ -189,7 +189,8 @@ int cmd_credential_cache(int argc,
#else
-int cmd_credential_cache(int argc, const char **argv, const char *prefix)
+int cmd_credential_cache(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
const char * const usage[] = {
"git credential-cache [options] <action>",
--
2.47.0.rc0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH 09/21] http: fix build error on FreeBSD
2024-10-02 15:15 [RFC PATCH 00/21] Modernize the build system Patrick Steinhardt
` (7 preceding siblings ...)
2024-10-02 15:16 ` [RFC PATCH 08/21] builtin/credential-cache: fix missing parameter for stub function Patrick Steinhardt
@ 2024-10-02 15:16 ` Patrick Steinhardt
2024-10-02 15:16 ` [RFC PATCH 10/21] Makefile: extract script to generate clar declarations Patrick Steinhardt
` (22 subsequent siblings)
31 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-02 15:16 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz
The `result` parameter passed to `http_request_reauth()` may either
point to a `struct strbuf` or a `FILE *`, where the `target` parameter
tells us which of either it actually is. To accommodate for both types
the pointer is a `void *`, which we then pass directly to functions
without doing a cast.
This is fine on most platforms, but it breaks on FreeBSD because
`fileno()` is implemented as a macro that tries to directly access the
`FILE *` structure.
Fix this issue by storing the `FILE *` in a local variable before we
pass it on to other functions.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
http.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/http.c b/http.c
index 376af88c5d..28f70a7a9c 100644
--- a/http.c
+++ b/http.c
@@ -2289,17 +2289,19 @@ static int http_request_reauth(const char *url,
case HTTP_REQUEST_STRBUF:
strbuf_reset(result);
break;
- case HTTP_REQUEST_FILE:
- if (fflush(result)) {
+ case HTTP_REQUEST_FILE: {
+ FILE *f = result;
+ if (fflush(f)) {
error_errno("unable to flush a file");
return HTTP_START_FAILED;
}
- rewind(result);
- if (ftruncate(fileno(result), 0) < 0) {
+ rewind(f);
+ if (ftruncate(fileno(f), 0) < 0) {
error_errno("unable to truncate a file");
return HTTP_START_FAILED;
}
break;
+ }
default:
BUG("Unknown http_request target");
}
--
2.47.0.rc0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH 10/21] Makefile: extract script to generate clar declarations
2024-10-02 15:15 [RFC PATCH 00/21] Modernize the build system Patrick Steinhardt
` (8 preceding siblings ...)
2024-10-02 15:16 ` [RFC PATCH 09/21] http: fix build error on FreeBSD Patrick Steinhardt
@ 2024-10-02 15:16 ` Patrick Steinhardt
2024-10-02 15:16 ` [RFC PATCH 11/21] Makefile: extract script to massage Perl scripts Patrick Steinhardt
` (21 subsequent siblings)
31 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-02 15:16 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz
Extract the script to generate function declarations for the clar unit
testing framework into a standalone script. This is done such that we
can reuse it in other build systems.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 4 +---
t/unit-tests/generate-clar-decls.sh | 16 ++++++++++++++++
2 files changed, 17 insertions(+), 3 deletions(-)
create mode 100755 t/unit-tests/generate-clar-decls.sh
diff --git a/Makefile b/Makefile
index 7344a7f725..de6426a684 100644
--- a/Makefile
+++ b/Makefile
@@ -3880,9 +3880,7 @@ GIT-TEST-SUITES: FORCE
fi
$(UNIT_TEST_DIR)/clar-decls.h: $(patsubst %,$(UNIT_TEST_DIR)/%.c,$(CLAR_TEST_SUITES)) GIT-TEST-SUITES
- $(QUIET_GEN)for suite in $(CLAR_TEST_SUITES); do \
- sed -ne "s/^\(void test_$${suite}__[a-zA-Z_0-9][a-zA-Z_0-9]*(void)$$\)/extern \1;/p" $(UNIT_TEST_DIR)/$$suite.c; \
- done >$@
+ $(QUIET_GEN)$(SHELL_PATH) $(UNIT_TEST_DIR)/generate-clar-decls.sh "$@" $(patsubst %,$(UNIT_TEST_DIR)/%.c,$(CLAR_TEST_SUITES))
$(UNIT_TEST_DIR)/clar.suite: $(UNIT_TEST_DIR)/clar-decls.h
$(QUIET_GEN)awk -f $(UNIT_TEST_DIR)/clar-generate.awk $< >$(UNIT_TEST_DIR)/clar.suite
$(CLAR_TEST_OBJS): $(UNIT_TEST_DIR)/clar-decls.h
diff --git a/t/unit-tests/generate-clar-decls.sh b/t/unit-tests/generate-clar-decls.sh
new file mode 100755
index 0000000000..d5ddbaa5da
--- /dev/null
+++ b/t/unit-tests/generate-clar-decls.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+if test $# -lt 3
+then
+ echo "USAGE: $0 <OUTPUT> <SUITE>..." 2>&1
+ exit 1
+fi
+
+OUTPUT="$1"
+shift
+
+for suite in $*
+do
+ sed -ne "s/^\(void test_$suite__[a-zA-Z_0-9][a-zA-Z_0-9]*(void)$\)/extern \1;/p" "$suite" ||
+ exit 1
+done >"$OUTPUT"
--
2.47.0.rc0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH 11/21] Makefile: extract script to massage Perl scripts
2024-10-02 15:15 [RFC PATCH 00/21] Modernize the build system Patrick Steinhardt
` (9 preceding siblings ...)
2024-10-02 15:16 ` [RFC PATCH 10/21] Makefile: extract script to generate clar declarations Patrick Steinhardt
@ 2024-10-02 15:16 ` Patrick Steinhardt
2024-10-02 15:16 ` [RFC PATCH 12/21] Makefile: refactor GIT-VERSION-GEN to be reusable Patrick Steinhardt
` (20 subsequent siblings)
31 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-02 15:16 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz
Extract the script to inject various build-time parameters into our Perl
scripts into a standalone script. This is done such that we can reuse it
in other build systems.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 10 +---------
generate-perl.sh | 22 ++++++++++++++++++++++
2 files changed, 23 insertions(+), 9 deletions(-)
create mode 100755 generate-perl.sh
diff --git a/Makefile b/Makefile
index de6426a684..f582ccdc98 100644
--- a/Makefile
+++ b/Makefile
@@ -2580,15 +2580,7 @@ endif
PERL_DEFINES += $(gitexecdir) $(perllibdir) $(localedir)
$(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
- $(QUIET_GEN) \
- sed -e '1{' \
- -e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \
- -e ' r GIT-PERL-HEADER' \
- -e ' G' \
- -e '}' \
- -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
- $< >$@+ && \
- chmod +x $@+ && \
+ $(QUIET_GEN)$(SHELL_PATH) generate-perl.sh $(GIT_VERSION) GIT-PERL-HEADER "$(PERL_PATH_SQ)" "$<" "$@+" && \
mv $@+ $@
PERL_DEFINES := $(subst $(space),:,$(PERL_DEFINES))
diff --git a/generate-perl.sh b/generate-perl.sh
new file mode 100755
index 0000000000..b9e04d6f42
--- /dev/null
+++ b/generate-perl.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+if test $# -ne 5
+then
+ echo "USAGE: $0 <GIT_VERSION> <PERL_HEADER> <PERL_PATH> <PERL_SCRIPT> <OUT>" >&2
+ exit 1
+fi
+
+GIT_VERSION="$1"
+PERL_HEADER="$2"
+PERL_PATH="$3"
+PERL_SCRIPT="$4"
+OUT="$5"
+
+sed -e '1{' \
+ -e " s|#!.*perl|#!$PERL_PATH|" \
+ -e " r $PERL_HEADER" \
+ -e ' G' \
+ -e '}' \
+ -e "s/@@GIT_VERSION@@/$GIT_VERSION/g" \
+ "$PERL_SCRIPT" >"$OUT"
+chmod a+x "$OUT"
--
2.47.0.rc0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH 12/21] Makefile: refactor GIT-VERSION-GEN to be reusable
2024-10-02 15:15 [RFC PATCH 00/21] Modernize the build system Patrick Steinhardt
` (10 preceding siblings ...)
2024-10-02 15:16 ` [RFC PATCH 11/21] Makefile: extract script to massage Perl scripts Patrick Steinhardt
@ 2024-10-02 15:16 ` Patrick Steinhardt
2024-10-02 15:16 ` [RFC PATCH 13/21] Makefile: refactor generators to be PWD-independent Patrick Steinhardt
` (19 subsequent siblings)
31 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-02 15:16 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz
Our "GIT-VERSION-GEN" script always writes the "GIT-VERSION-FILE" into
the current directory, where the expectation is that it should exist in
the source directory. But other build systems that support out-of-tree
builds may not want to do that to keep the source directory pristine,
even though CMake currently doesn't care.
Refactor the script such that it doesn't write output to a file anymore
but so that it instead writes the version to stdout. This makes it
easier to compute the same version as our Makefile would without having
to write the "GIT-VERSION-FILE".
We should ideally refactor our CMake build instructions to stop writing
into the source directory. But this step is out of scope of the current
patch series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-VERSION-GEN | 12 +-----------
Makefile | 3 ++-
contrib/buildsystems/CMakeLists.txt | 5 ++++-
3 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index 38e920725c..f626d74d6d 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -1,6 +1,5 @@
#!/bin/sh
-GVF=GIT-VERSION-FILE
DEF_VER=v2.47.0-rc0
LF='
@@ -28,13 +27,4 @@ fi
VN=$(expr "$VN" : v*'\(.*\)')
-if test -r $GVF
-then
- VC=$(sed -e 's/^GIT_VERSION = //' <$GVF)
-else
- VC=unset
-fi
-test "$VN" = "$VC" || {
- echo >&2 "GIT_VERSION = $VN"
- echo "GIT_VERSION = $VN" >$GVF
-}
+echo "$VN"
diff --git a/Makefile b/Makefile
index f582ccdc98..fae931ff0b 100644
--- a/Makefile
+++ b/Makefile
@@ -588,7 +588,8 @@ include shared.mak
# Disable -pedantic compilation.
GIT-VERSION-FILE: FORCE
- @$(SHELL_PATH) ./GIT-VERSION-GEN
+ @printf "GIT_VERSION = %s\n" $$($(SHELL_PATH) GIT-VERSION-GEN) >$@+
+ @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else cat $@+ >&2 && mv $@+ $@; fi
-include GIT-VERSION-FILE
# Set our default configuration.
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 62af7b33d2..01a23788e1 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -87,7 +87,10 @@ endif()
if(NOT EXISTS ${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE)
message("Generating GIT-VERSION-FILE")
execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ OUTPUT_VARIABLE GIT_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ file(WRITE ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "GIT_VERSION = '${GIT_VERSION}'\n")
endif()
#Parse GIT-VERSION-FILE to get the version
--
2.47.0.rc0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH 13/21] Makefile: refactor generators to be PWD-independent
2024-10-02 15:15 [RFC PATCH 00/21] Modernize the build system Patrick Steinhardt
` (11 preceding siblings ...)
2024-10-02 15:16 ` [RFC PATCH 12/21] Makefile: refactor GIT-VERSION-GEN to be reusable Patrick Steinhardt
@ 2024-10-02 15:16 ` Patrick Steinhardt
2024-10-02 15:16 ` [RFC PATCH 14/21] Makefile: use common template for GIT-BUILD-OPTIONS Patrick Steinhardt
` (18 subsequent siblings)
31 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-02 15:16 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz
We have multiple scripts that generate headers from other data. All of
these scripts have the assumption built-in that they are executed in the
current source directory, which makes them a bit unwieldy to use during
out-of-tree builds. This makes them a bit unwieldy to use. Refactor them
to instead take the source directory as well as the output file as
arguments.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 6 ++---
contrib/buildsystems/CMakeLists.txt | 12 +++------
generate-cmdlist.sh | 42 ++++++++++++++++++-----------
generate-configlist.sh | 20 ++++++++++----
generate-hooklist.sh | 15 ++++++++++-
5 files changed, 61 insertions(+), 34 deletions(-)
diff --git a/Makefile b/Makefile
index fae931ff0b..d128b5b3e4 100644
--- a/Makefile
+++ b/Makefile
@@ -2498,17 +2498,17 @@ $(BUILT_INS): git$X
config-list.h: generate-configlist.sh
config-list.h: Documentation/*config.txt Documentation/config/*.txt
- $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh >$@
+ $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh . $@
command-list.h: generate-cmdlist.sh command-list.txt
command-list.h: $(wildcard Documentation/git*.txt)
$(QUIET_GEN)$(SHELL_PATH) ./generate-cmdlist.sh \
$(patsubst %,--exclude-program %,$(EXCLUDED_PROGRAMS)) \
- command-list.txt >$@
+ . $@
hook-list.h: generate-hooklist.sh Documentation/githooks.txt
- $(QUIET_GEN)$(SHELL_PATH) ./generate-hooklist.sh >$@
+ $(QUIET_GEN)$(SHELL_PATH) ./generate-hooklist.sh . $@
SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):\
$(localedir_SQ):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 01a23788e1..27d986eaf0 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -655,23 +655,17 @@ set(EXCLUSION_PROGS_CACHE ${EXCLUSION_PROGS} CACHE STRING "Programs not built" F
if(NOT EXISTS ${CMAKE_BINARY_DIR}/command-list.h OR NOT EXCLUSION_PROGS_CACHE STREQUAL EXCLUSION_PROGS)
list(REMOVE_ITEM EXCLUSION_PROGS empty)
message("Generating command-list.h")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-cmdlist.sh ${EXCLUSION_PROGS} command-list.txt
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_FILE ${CMAKE_BINARY_DIR}/command-list.h)
+ execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-cmdlist.sh ${EXCLUSION_PROGS} ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}/command-list.h)
endif()
if(NOT EXISTS ${CMAKE_BINARY_DIR}/config-list.h)
message("Generating config-list.h")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-configlist.sh
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_FILE ${CMAKE_BINARY_DIR}/config-list.h)
+ execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-configlist.sh ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}/config.list)
endif()
if(NOT EXISTS ${CMAKE_BINARY_DIR}/hook-list.h)
message("Generating hook-list.h")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-hooklist.sh
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_FILE ${CMAKE_BINARY_DIR}/hook-list.h)
+ execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-hooklist.sh ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}/hook-list.h)
endif()
include_directories(${CMAKE_BINARY_DIR})
diff --git a/generate-cmdlist.sh b/generate-cmdlist.sh
index 205541e0f7..b923a5aab8 100755
--- a/generate-cmdlist.sh
+++ b/generate-cmdlist.sh
@@ -64,7 +64,7 @@ define_category_names () {
print_command_list () {
echo "static struct cmdname_help command_list[] = {"
- echo "$1" |
+ echo "$2" |
while read cmd rest
do
synopsis=
@@ -76,7 +76,7 @@ print_command_list () {
break
;;
esac
- done <"Documentation/$cmd.txt"
+ done <"$1/Documentation/$cmd.txt"
printf '\t{ "%s", N_("%s"), 0' "$cmd" "$synopsis"
printf " | CAT_%s" $rest
@@ -93,18 +93,28 @@ do
shift
done
-commands="$(command_list "$1")"
-categories="$(category_list "$commands")"
+if test "$#" -ne 2
+then
+ die "USAGE: $0 <SOURCE_DIR> <OUTPUT>"
+fi
+
+SOURCE_DIR="$1"
+OUTPUT="$2"
+
+{
+ commands="$(command_list "$SOURCE_DIR"/command-list.txt)"
+ categories="$(category_list "$commands")"
-echo "/* Automatically generated by generate-cmdlist.sh */
-struct cmdname_help {
- const char *name;
- const char *help;
- uint32_t category;
-};
-"
-define_categories "$categories"
-echo
-define_category_names "$categories"
-echo
-print_command_list "$commands"
+ echo "/* Automatically generated by generate-cmdlist.sh */
+ struct cmdname_help {
+ const char *name;
+ const char *help;
+ uint32_t category;
+ };
+ "
+ define_categories "$categories"
+ echo
+ define_category_names "$categories"
+ echo
+ print_command_list "$SOURCE_DIR" "$commands"
+} >"$OUTPUT"
diff --git a/generate-configlist.sh b/generate-configlist.sh
index 8692fe5cf4..512804a1ca 100755
--- a/generate-configlist.sh
+++ b/generate-configlist.sh
@@ -1,13 +1,19 @@
#!/bin/sh
-echo "/* Automatically generated by generate-configlist.sh */"
-echo
+SOURCE_DIR="$1"
+OUTPUT="$2"
+
+if test -z "$SOURCE_DIR" || ! test -d "$SOURCE_DIR" || test -z "$OUTPUT"
+then
+ echo "USAGE: $0 <SOURCE_DIR> <OUTPUT>" >&2
+ exit 1
+fi
print_config_list () {
cat <<EOF
static const char *config_name_list[] = {
EOF
- grep -h '^[a-zA-Z].*\..*::$' Documentation/*config.txt Documentation/config/*.txt |
+ grep -h '^[a-zA-Z].*\..*::$' "$SOURCE_DIR"/Documentation/*config.txt "$SOURCE_DIR"/Documentation/config/*.txt |
sed '/deprecated/d; s/::$//; s/, */\n/g' |
sort |
sed 's/^.*$/ "&",/'
@@ -17,5 +23,9 @@ EOF
EOF
}
-echo
-print_config_list
+{
+ echo "/* Automatically generated by generate-configlist.sh */"
+ echo
+ echo
+ print_config_list
+} >"$OUTPUT"
diff --git a/generate-hooklist.sh b/generate-hooklist.sh
index 2f9f54eb54..0ff2a0b6fb 100755
--- a/generate-hooklist.sh
+++ b/generate-hooklist.sh
@@ -2,6 +2,17 @@
#
# Usage: ./generate-hooklist.sh >hook-list.h
+SOURCE_DIR="$1"
+OUTPUT="$2"
+
+if test -z "$SOURCE_DIR" || ! test -d "$SOURCE_DIR" || test -z "$OUTPUT"
+then
+ echo "USAGE: $0 <SOURCE_DIR> <OUTPUT>" >&2
+ exit 1
+fi
+
+{
+
cat <<EOF
/* Automatically generated by generate-hooklist.sh */
@@ -11,10 +22,12 @@ EOF
sed -n \
-e '/^~~~~*$/ {x; s/^.*$/ "&",/; p;}' \
-e 'x' \
- <Documentation/githooks.txt |
+ <"$SOURCE_DIR"/Documentation/githooks.txt |
LC_ALL=C sort
cat <<EOF
NULL,
};
EOF
+
+} >"$OUTPUT"
--
2.47.0.rc0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH 14/21] Makefile: use common template for GIT-BUILD-OPTIONS
2024-10-02 15:15 [RFC PATCH 00/21] Modernize the build system Patrick Steinhardt
` (12 preceding siblings ...)
2024-10-02 15:16 ` [RFC PATCH 13/21] Makefile: refactor generators to be PWD-independent Patrick Steinhardt
@ 2024-10-02 15:16 ` Patrick Steinhardt
2024-10-02 15:16 ` [RFC PATCH 15/21] Makefile: consistently use @PLACEHOLDER@ to substitute Patrick Steinhardt
` (17 subsequent siblings)
31 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-02 15:16 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz
The "GIT-BUILD-OPTIONS" file is generated by our build systems to
propagate built-in features and paths to our tests. The generation is
done ad-hoc, where both our Makefile and the CMake build instructions
simply echo a bunch of strings into the file. This makes it very hard to
figure out what variables are expected to exist and what format they
have, and the written variables can easily get out of sync between build
systems.
Introduce a new "GIT-BUILD-OPTIONS.in" template to address this issue.
This has multiple advantages:
- It demonstrates which built options exist in the first place.
- It can serve as a spot to document the build options.
- Some build systems complain when not all variables could be
substituted, alerting us of mismatches. Others don't, but if we
forgot to substitute such variables we now have a bogus string that
will likely cause our tests to fail, if they have any meaning in the
first place.
Backfill values that we didn't yet set in our CMake build instructions.
While at it, remove the `SUPPORTS_SIMPLE_IPC` variable that we only set
up in CMake as it isn't used anywhere.
Note that this change requires us to move around the setup of
TEST_OUTPUT_DIRECTORY in "test-lib.sh" such that it comes after sourcing
the "GIT-BUILD-OPTIONS" file. This is the only instance I could find
where we rely on ordering on variables.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-BUILD-OPTIONS.in | 35 +++++++++
Makefile | 106 ++++++++++------------------
contrib/buildsystems/CMakeLists.txt | 56 ++++++++++-----
t/test-lib.sh | 13 ++--
4 files changed, 117 insertions(+), 93 deletions(-)
create mode 100644 GIT-BUILD-OPTIONS.in
diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in
new file mode 100644
index 0000000000..e73cd5fa1a
--- /dev/null
+++ b/GIT-BUILD-OPTIONS.in
@@ -0,0 +1,35 @@
+SHELL_PATH=@SHELL_PATH@
+TEST_SHELL_PATH=@TEST_SHELL_PATH@
+PERL_PATH=@PERL_PATH@
+DIFF=@DIFF@
+PYTHON_PATH=@PYTHON_PATH@
+TAR=@TAR@
+NO_CURL=@NO_CURL@
+NO_EXPAT=@NO_EXPAT@
+USE_LIBPCRE2=@USE_LIBPCRE2@
+NO_PERL=@NO_PERL@
+NO_PTHREADS=@NO_PTHREADS@
+NO_PYTHON=@NO_PYTHON@
+NO_REGEX=@NO_REGEX@
+NO_UNIX_SOCKETS=@NO_UNIX_SOCKETS@
+PAGER_ENV=@PAGER_ENV@
+SANITIZE_LEAK=@SANITIZE_LEAK@
+SANITIZE_ADDRESS=@SANITIZE_ADDRESS@
+X=@X@
+FSMONITOR_DAEMON_BACKEND=@FSMONITOR_DAEMON_BACKEND@
+FSMONITOR_OS_SETTINGS=@FSMONITOR_OS_SETTINGS@
+TEST_OUTPUT_DIRECTORY=@TEST_OUTPUT_DIRECTORY@
+GIT_TEST_OPTS=@GIT_TEST_OPTS@
+GIT_TEST_CMP=@GIT_TEST_CMP@
+GIT_TEST_CMP_USE_COPIED_CONTEXT=@GIT_TEST_CMP_USE_COPIED_CONTEXT@
+GIT_TEST_UTF8_LOCALE=@GIT_TEST_UTF8_LOCALE@
+NO_GETTEXT=@NO_GETTEXT@
+GIT_PERF_REPEAT_COUNT=@GIT_PERF_REPEAT_COUNT@
+GIT_PERF_REPO=@GIT_PERF_REPO@
+GIT_PERF_LARGE_REPO=@GIT_PERF_LARGE_REPO@
+GIT_PERF_MAKE_OPTS=@GIT_PERF_MAKE_OPTS@
+GIT_PERF_MAKE_COMMAND=@GIT_PERF_MAKE_COMMAND@
+GIT_INTEROP_MAKE_OPTS=@GIT_INTEROP_MAKE_OPTS@
+GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@
+GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@
+RUNTIME_PREFIX=@RUNTIME_PREFIX@
diff --git a/Makefile b/Makefile
index d128b5b3e4..e92ecd0c51 100644
--- a/Makefile
+++ b/Makefile
@@ -3133,75 +3133,43 @@ GIT-LDFLAGS: FORCE
# that runs GIT-BUILD-OPTIONS, and then again to protect it
# and the first level quoting from the shell that runs "echo".
GIT-BUILD-OPTIONS: FORCE
- @echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@+
- @echo TEST_SHELL_PATH=\''$(subst ','\'',$(TEST_SHELL_PATH_SQ))'\' >>$@+
- @echo PERL_PATH=\''$(subst ','\'',$(PERL_PATH_SQ))'\' >>$@+
- @echo DIFF=\''$(subst ','\'',$(subst ','\'',$(DIFF)))'\' >>$@+
- @echo PYTHON_PATH=\''$(subst ','\'',$(PYTHON_PATH_SQ))'\' >>$@+
- @echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@+
- @echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@+
- @echo NO_EXPAT=\''$(subst ','\'',$(subst ','\'',$(NO_EXPAT)))'\' >>$@+
- @echo USE_LIBPCRE2=\''$(subst ','\'',$(subst ','\'',$(USE_LIBPCRE2)))'\' >>$@+
- @echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@+
- @echo NO_PTHREADS=\''$(subst ','\'',$(subst ','\'',$(NO_PTHREADS)))'\' >>$@+
- @echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@+
- @echo NO_REGEX=\''$(subst ','\'',$(subst ','\'',$(NO_REGEX)))'\' >>$@+
- @echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@+
- @echo PAGER_ENV=\''$(subst ','\'',$(subst ','\'',$(PAGER_ENV)))'\' >>$@+
- @echo SANITIZE_LEAK=\''$(subst ','\'',$(subst ','\'',$(SANITIZE_LEAK)))'\' >>$@+
- @echo SANITIZE_ADDRESS=\''$(subst ','\'',$(subst ','\'',$(SANITIZE_ADDRESS)))'\' >>$@+
- @echo X=\'$(X)\' >>$@+
-ifdef FSMONITOR_DAEMON_BACKEND
- @echo FSMONITOR_DAEMON_BACKEND=\''$(subst ','\'',$(subst ','\'',$(FSMONITOR_DAEMON_BACKEND)))'\' >>$@+
-endif
-ifdef FSMONITOR_OS_SETTINGS
- @echo FSMONITOR_OS_SETTINGS=\''$(subst ','\'',$(subst ','\'',$(FSMONITOR_OS_SETTINGS)))'\' >>$@+
-endif
-ifdef TEST_OUTPUT_DIRECTORY
- @echo TEST_OUTPUT_DIRECTORY=\''$(subst ','\'',$(subst ','\'',$(TEST_OUTPUT_DIRECTORY)))'\' >>$@+
-endif
-ifdef GIT_TEST_OPTS
- @echo GIT_TEST_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_OPTS)))'\' >>$@+
-endif
-ifdef GIT_TEST_CMP
- @echo GIT_TEST_CMP=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_CMP)))'\' >>$@+
-endif
-ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
- @echo GIT_TEST_CMP_USE_COPIED_CONTEXT=YesPlease >>$@+
-endif
-ifdef GIT_TEST_UTF8_LOCALE
- @echo GIT_TEST_UTF8_LOCALE=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_UTF8_LOCALE)))'\' >>$@+
-endif
- @echo NO_GETTEXT=\''$(subst ','\'',$(subst ','\'',$(NO_GETTEXT)))'\' >>$@+
-ifdef GIT_PERF_REPEAT_COUNT
- @echo GIT_PERF_REPEAT_COUNT=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPEAT_COUNT)))'\' >>$@+
-endif
-ifdef GIT_PERF_REPO
- @echo GIT_PERF_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPO)))'\' >>$@+
-endif
-ifdef GIT_PERF_LARGE_REPO
- @echo GIT_PERF_LARGE_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_LARGE_REPO)))'\' >>$@+
-endif
-ifdef GIT_PERF_MAKE_OPTS
- @echo GIT_PERF_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_OPTS)))'\' >>$@+
-endif
-ifdef GIT_PERF_MAKE_COMMAND
- @echo GIT_PERF_MAKE_COMMAND=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_COMMAND)))'\' >>$@+
-endif
-ifdef GIT_INTEROP_MAKE_OPTS
- @echo GIT_INTEROP_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_INTEROP_MAKE_OPTS)))'\' >>$@+
-endif
-ifdef GIT_TEST_INDEX_VERSION
- @echo GIT_TEST_INDEX_VERSION=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_INDEX_VERSION)))'\' >>$@+
-endif
-ifdef GIT_TEST_PERL_FATAL_WARNINGS
- @echo GIT_TEST_PERL_FATAL_WARNINGS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_PERL_FATAL_WARNINGS)))'\' >>$@+
-endif
-ifdef RUNTIME_PREFIX
- @echo RUNTIME_PREFIX=\'true\' >>$@+
-else
- @echo RUNTIME_PREFIX=\'false\' >>$@+
-endif
+ @sed \
+ -e "s|@SHELL_PATH@|\'$(SHELL_PATH_SQ)\'|" \
+ -e "s|@TEST_SHELL_PATH@|\'$(TEST_SHELL_PATH_SQ)\'|" \
+ -e "s|@PERL_PATH@|\'$(PERL_PATH_SQ)\'|" \
+ -e "s|@DIFF@|\'$(DIFF)\'|" \
+ -e "s|@PYTHON_PATH@|\'$(PYTHON_PATH_SQ)\'|" \
+ -e "s|@TAR@|\'$(TAR)\'|" \
+ -e "s|@NO_CURL@|\'$(NO_CURL)\'|" \
+ -e "s|@NO_EXPAT@|\'$(NO_EXPAT)\'|" \
+ -e "s|@USE_LIBPCRE2@|\'$(USE_LIBPCRE2)\'|" \
+ -e "s|@NO_PERL@|\'$(NO_PERL)\'|" \
+ -e "s|@NO_PTHREADS@|\'$(NO_PTHREADS)\'|" \
+ -e "s|@NO_PYTHON@|\'$(NO_PYTHON)\'|" \
+ -e "s|@NO_REGEX@|\'$(NO_REGEX)\'|" \
+ -e "s|@NO_UNIX_SOCKETS@|\'$(NO_UNIX_SOCKETS)\'|" \
+ -e "s|@PAGER_ENV@|\'$(PAGER_ENV)\'|" \
+ -e "s|@SANITIZE_LEAK@|\'$(SANITIZE_LEAK)\'|" \
+ -e "s|@SANITIZE_ADDRESS@|\'$(SANITIZE_ADDRESS)\'|" \
+ -e "s|@X@|\'$(X)\'|" \
+ -e "s|@FSMONITOR_DAEMON_BACKEND@|\'$(FSMONITOR_DAEMON_BACKEND)\'|" \
+ -e "s|@FSMONITOR_OS_SETTINGS@|\'$(FSMONITOR_OS_SETTINGS)\'|" \
+ -e "s|@TEST_OUTPUT_DIRECTORY@|\'$(TEST_OUTPUT_DIRECTORY)\'|" \
+ -e "s|@GIT_TEST_OPTS@|\'$(GIT_TEST_OPTS)\'|" \
+ -e "s|@GIT_TEST_CMP@|\'$(GIT_TEST_CMP)\'|" \
+ -e "s|@GIT_TEST_CMP_USE_COPIED_CONTEXT@|\'$(GIT_TEST_CMP_USE_COPIED_CONTEXT)\'|" \
+ -e "s|@GIT_TEST_UTF8_LOCALE@|\'$(GIT_TEST_UTF8_LOCALE)\'|" \
+ -e "s|@NO_GETTEXT@|\'$(NO_GETTEXT)\'|" \
+ -e "s|@GIT_PERF_REPEAT_COUNT@|\'$(GIT_PERF_REPEAT_COUNT)\'|" \
+ -e "s|@GIT_PERF_REPO@|\'$(GIT_PERF_REPO)\'|" \
+ -e "s|@GIT_PERF_LARGE_REPO@|\'$(GIT_PERF_LARGE_REPO)\'|" \
+ -e "s|@GIT_PERF_MAKE_OPTS@|\'$(GIT_PERF_MAKE_OPTS)\'|" \
+ -e "s|@GIT_PERF_MAKE_COMMAND@|\'$(GIT_PERF_MAKE_COMMAND)\'|" \
+ -e "s|@GIT_INTEROP_MAKE_OPTS@|\'$(GIT_INTEROP_MAKE_OPTS)\'|" \
+ -e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \
+ -e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \
+ -e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX)\'|" \
+ GIT-BUILD-OPTIONS.in >$@+
@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
@if test -f GIT-BUILD-DIR; then rm GIT-BUILD-DIR; fi
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 27d986eaf0..2ba15155b3 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -1135,26 +1135,46 @@ if(NOT PYTHON_TESTS)
set(NO_PYTHON 1)
endif()
-file(WRITE ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "SHELL_PATH='${SHELL_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "TEST_SHELL_PATH='${TEST_SHELL_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PERL_PATH='${PERL_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "DIFF='${DIFF}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PYTHON_PATH='${PYTHON_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "TAR='${TAR}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_CURL='${NO_CURL}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_EXPAT='${NO_EXPAT}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PERL='${NO_PERL}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PTHREADS='${NO_PTHREADS}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_UNIX_SOCKETS='${NO_UNIX_SOCKETS}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PAGER_ENV='${PAGER_ENV}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "X='${EXE_EXTENSION}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_GETTEXT='${NO_GETTEXT}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "RUNTIME_PREFIX='${RUNTIME_PREFIX}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PYTHON='${NO_PYTHON}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "SUPPORTS_SIMPLE_IPC='${SUPPORTS_SIMPLE_IPC}'\n")
+file(STRINGS ${CMAKE_SOURCE_DIR}/GIT-BUILD-OPTIONS.in git_build_options NEWLINE_CONSUME)
+string(REPLACE "@SHELL_PATH@" "${SHELL_PATH}" git_build_options "${git_build_options}")
+string(REPLACE "@TEST_SHELL_PATH@" "${TEST_SHELL_PATH}" git_build_options "${git_build_options}")
+string(REPLACE "@PERL_PATH@" "${PERL_PATH}" git_build_options "${git_build_options}")
+string(REPLACE "@DIFF@" "${DIFF}" git_build_options "${git_build_options}")
+string(REPLACE "@PYTHON_PATH@" "${PYTHON_PATH}" git_build_options "${git_build_options}")
+string(REPLACE "@TAR@" "${TAR}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_CURL@" "${NO_CURL}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_EXPAT@" "${NO_EXPAT}" git_build_options "${git_build_options}")
+string(REPLACE "@USE_LIBPCRE2@" "" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PERL@" "${NO_PERL}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PTHREADS@" "${NO_PTHREADS}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PYTHON@" "${NO_PYTHON}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_REGEX@" "" git_build_options "${git_build_options}")
+string(REPLACE "@NO_UNIX_SOCKETS@" "${NO_UNIX_SOCKETS}" git_build_options "${git_build_options}")
+string(REPLACE "@PAGER_ENV@" "${PAGER_ENV}" git_build_options "${git_build_options}")
+string(REPLACE "@SANITIZE_LEAK@" "" git_build_options "${git_build_options}")
+string(REPLACE "@SANITIZE_ADDRESS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@X@" "${EXE_EXTENSION}" git_build_options "${git_build_options}")
+string(REPLACE "@FSMONITOR_DAEMON_BACKEND@" "win32" git_build_options "${git_build_options}")
+string(REPLACE "@FSMONITOR_OS_SETTINGS@" "win32" git_build_options "${git_build_options}")
+string(REPLACE "@TEST_OUTPUT_DIRECTORY@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_OPTS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_CMP@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_CMP_USE_COPIED_CONTEXT@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_UTF8_LOCALE@" "" git_build_options "${git_build_options}")
+string(REPLACE "@NO_GETTEXT@" "${NO_GETTEXT}" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_REPEAT_COUNT@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_REPO@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_LARGE_REPO@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_MAKE_OPTS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_MAKE_COMMAND@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@RUNTIME_PREFIX@" "${RUNTIME_PREFIX}" git_build_options "${git_build_options}")
if(USE_VCPKG)
- file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
+ string(APPEND git_build_options "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
endif()
+file(WRITE ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS ${git_build_options})
#Make the tests work when building out of the source tree
get_filename_component(CACHE_PATH ${CMAKE_CURRENT_LIST_DIR}/../../CMakeCache.txt ABSOLUTE)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 5de93911b9..3fab470f3b 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -35,12 +35,6 @@ else
# needing to exist.
TEST_DIRECTORY=$(cd "$TEST_DIRECTORY" && pwd) || exit 1
fi
-if test -z "$TEST_OUTPUT_DIRECTORY"
-then
- # Similarly, override this to store the test-results subdir
- # elsewhere
- TEST_OUTPUT_DIRECTORY=$TEST_DIRECTORY
-fi
GIT_BUILD_DIR="${TEST_DIRECTORY%/t}"
if test "$TEST_DIRECTORY" = "$GIT_BUILD_DIR"
then
@@ -100,6 +94,13 @@ fi
. "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
export PERL_PATH SHELL_PATH
+if test -z "$TEST_OUTPUT_DIRECTORY"
+then
+ # Similarly, override this to store the test-results subdir
+ # elsewhere
+ TEST_OUTPUT_DIRECTORY=$TEST_DIRECTORY
+fi
+
# In t0000, we need to override test directories of nested testcases. In case
# the developer has TEST_OUTPUT_DIRECTORY part of his build options, then we'd
# reset this value to instead contain what the developer has specified. We thus
--
2.47.0.rc0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH 15/21] Makefile: consistently use @PLACEHOLDER@ to substitute
2024-10-02 15:15 [RFC PATCH 00/21] Modernize the build system Patrick Steinhardt
` (13 preceding siblings ...)
2024-10-02 15:16 ` [RFC PATCH 14/21] Makefile: use common template for GIT-BUILD-OPTIONS Patrick Steinhardt
@ 2024-10-02 15:16 ` Patrick Steinhardt
2024-10-08 14:04 ` Phillip Wood
2024-10-02 15:16 ` [RFC PATCH 16/21] Makefile: consistently use PERL_PATH Patrick Steinhardt
` (16 subsequent siblings)
31 siblings, 1 reply; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-02 15:16 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz
We have a bunch of placeholders in our scripts that we replace at build
time, for example by using sed(1). These placeholders come in three
different formats: @PLACEHOLDER@, @@PLACEHOLDER@@ and ++PLACEHOLDER++.
Next to being inconsistent it also creates a bit of a problem with
CMake, which only supports the first syntax. To work around that we
instead manually replace such strings via string operations, which is
both a hassle and also removes safeguards that CMake has to verify that
we didn't forget to replace any placeholders. Besides that, other build
systems like Meson also support the CMake syntax.
Unify our codebase to consistently use the syntax supported by such
build systems.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 42 +++++++++---------
configure.ac | 2 +-
contrib/buildsystems/CMakeLists.txt | 34 +++++++-------
generate-perl.sh | 2 +-
git-cvsserver.perl | 2 +-
git-instaweb.sh | 8 ++--
git-request-pull.sh | 2 +-
git-send-email.perl | 2 +-
git-sh-i18n.sh | 6 +--
git-sh-setup.sh | 6 +--
git-svn.perl | 2 +-
gitk-git/po/vi.po | 2 +-
gitweb/Makefile | 44 +++++++++----------
gitweb/gitweb.perl | 44 +++++++++----------
perl/Git/I18N.pm | 6 +--
perl/Git/LoadCPAN.pm | 6 +--
| 2 +-
.../runtime_prefix.template.pl | 8 ++--
unimplemented.sh | 2 +-
wrap-for-bin.sh | 18 ++++----
20 files changed, 120 insertions(+), 120 deletions(-)
diff --git a/Makefile b/Makefile
index e92ecd0c51..91e64c1222 100644
--- a/Makefile
+++ b/Makefile
@@ -1552,10 +1552,10 @@ endif
ifdef SANE_TOOL_PATH
SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH))
-BROKEN_PATH_FIX = 's|^\# @@BROKEN_PATH_FIX@@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|'
+BROKEN_PATH_FIX = 's|^\# @BROKEN_PATH_FIX@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|'
PATH := $(SANE_TOOL_PATH):${PATH}
else
-BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d'
+BROKEN_PATH_FIX = '/^\# @BROKEN_PATH_FIX@$$/d'
endif
ifeq (,$(HOST_CPU))
@@ -2524,13 +2524,13 @@ GIT-SCRIPT-DEFINES: FORCE
define cmd_munge_script
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
- -e 's|@@DIFF@@|$(DIFF_SQ)|' \
- -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' \
- -e 's/@@USE_GETTEXT_SCHEME@@/$(USE_GETTEXT_SCHEME)/g' \
+ -e 's|@DIFF@|$(DIFF_SQ)|' \
+ -e 's|@LOCALEDIR@|$(localedir_SQ)|g' \
+ -e 's/@USE_GETTEXT_SCHEME@/$(USE_GETTEXT_SCHEME)/g' \
-e $(BROKEN_PATH_FIX) \
- -e 's|@@GITWEBDIR@@|$(gitwebdir_SQ)|g' \
- -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
- -e 's|@@PAGER_ENV@@|$(PAGER_ENV_SQ)|g' \
+ -e 's|@GITWEBDIR@|$(gitwebdir_SQ)|g' \
+ -e 's|@PERL@|$(PERL_PATH_SQ)|g' \
+ -e 's|@PAGER_ENV@|$(PAGER_ENV_SQ)|g' \
$@.sh >$@+
endef
@@ -2597,11 +2597,11 @@ GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile
INSTLIBDIR='$(perllibdir_SQ)' && \
INSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \
INSTLIBDIR="$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}" && \
- sed -e 's=@@PATHSEP@@=$(pathsep)=g' \
- -e "s=@@INSTLIBDIR@@=$$INSTLIBDIR=g" \
- -e 's=@@PERLLIBDIR_REL@@=$(perllibdir_relative_SQ)=g' \
- -e 's=@@GITEXECDIR_REL@@=$(gitexecdir_relative_SQ)=g' \
- -e 's=@@LOCALEDIR_REL@@=$(localedir_relative_SQ)=g' \
+ sed -e 's=@PATHSEP@=$(pathsep)=g' \
+ -e "s=@INSTLIBDIR@=$$INSTLIBDIR=g" \
+ -e 's=@PERLLIBDIR_REL@=$(perllibdir_relative_SQ)=g' \
+ -e 's=@GITEXECDIR_REL@=$(gitexecdir_relative_SQ)=g' \
+ -e 's=@LOCALEDIR_REL@=$(localedir_relative_SQ)=g' \
$< >$@+ && \
mv $@+ $@
@@ -2617,7 +2617,7 @@ else # NO_PERL
$(SCRIPT_PERL_GEN) git-instaweb: % : unimplemented.sh
$(QUIET_GEN) \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@@REASON@@|NO_PERL=$(NO_PERL)|g' \
+ -e 's|@REASON@|NO_PERL=$(NO_PERL)|g' \
unimplemented.sh >$@+ && \
chmod +x $@+ && \
mv $@+ $@
@@ -2638,13 +2638,13 @@ else # NO_PYTHON
$(SCRIPT_PYTHON_GEN): % : unimplemented.sh
$(QUIET_GEN) \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@@REASON@@|NO_PYTHON=$(NO_PYTHON)|g' \
+ -e 's|@REASON@|NO_PYTHON=$(NO_PYTHON)|g' \
unimplemented.sh >$@+ && \
chmod +x $@+ && \
mv $@+ $@
endif # NO_PYTHON
-CONFIGURE_RECIPE = sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
+CONFIGURE_RECIPE = sed -e 's/@GIT_VERSION@/$(GIT_VERSION)/g' \
configure.ac >configure.ac+ && \
autoconf -o configure configure.ac+ && \
$(RM) configure.ac+
@@ -3073,9 +3073,9 @@ endif
perl/build/lib/%.pm: perl/%.pm GIT-PERL-DEFINES
$(call mkdir_p_parent_template)
$(QUIET_GEN) \
- sed -e 's|@@LOCALEDIR@@|$(perl_localedir_SQ)|g' \
- -e 's|@@NO_GETTEXT@@|$(NO_GETTEXT_SQ)|g' \
- -e 's|@@NO_PERL_CPAN_FALLBACKS@@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \
+ sed -e 's|@LOCALEDIR@|$(perl_localedir_SQ)|g' \
+ -e 's|@NO_GETTEXT@|$(NO_GETTEXT_SQ)|g' \
+ -e 's|@NO_PERL_CPAN_FALLBACKS@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \
< $< > $@
perl/build/man/man3/Git.3pm: perl/Git.pm
@@ -3192,8 +3192,8 @@ all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PR
bin-wrappers/%: wrap-for-bin.sh
$(call mkdir_p_parent_template)
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@@BUILD_DIR@@|$(shell pwd)|' \
- -e 's|@@PROG@@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
+ -e 's|@BUILD_DIR@|$(shell pwd)|' \
+ -e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
chmod +x $@
# GNU make supports exporting all variables by "export" without parameters.
diff --git a/configure.ac b/configure.ac
index d1a96da14e..5923edc44a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -142,7 +142,7 @@ fi
## Configure body starts here.
AC_PREREQ(2.59)
-AC_INIT([git], [@@GIT_VERSION@@], [git@vger.kernel.org])
+AC_INIT([git], [@GIT_VERSION@], [git@vger.kernel.org])
AC_CONFIG_SRCDIR([git.c])
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 2ba15155b3..bf029b9428 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -833,14 +833,14 @@ set(git_shell_scripts
foreach(script ${git_shell_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.sh content NEWLINE_CONSUME)
string(REPLACE "@SHELL_PATH@" "${SHELL_PATH}" content "${content}")
- string(REPLACE "@@DIFF@@" "diff" content "${content}")
+ string(REPLACE "@DIFF@" "diff" content "${content}")
string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}")
string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" content "${content}")
- string(REPLACE "@@NO_CURL@@" "" content "${content}")
- string(REPLACE "@@USE_GETTEXT_SCHEME@@" "" content "${content}")
- string(REPLACE "# @@BROKEN_PATH_FIX@@" "" content "${content}")
- string(REPLACE "@@PERL@@" "${PERL_PATH}" content "${content}")
- string(REPLACE "@@PAGER_ENV@@" "LESS=FRX LV=-c" content "${content}")
+ string(REPLACE "@NO_CURL@" "" content "${content}")
+ string(REPLACE "@USE_GETTEXT_SCHEME@" "" content "${content}")
+ string(REPLACE "# @BROKEN_PATH_FIX@" "" content "${content}")
+ string(REPLACE "@PERL@" "${PERL_PATH}" content "${content}")
+ string(REPLACE "@PAGER_ENV@" "LESS=FRX LV=-c" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
endforeach()
@@ -849,13 +849,13 @@ parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" ".perl")
#create perl header
file(STRINGS ${CMAKE_SOURCE_DIR}/perl/header_templates/fixed_prefix.template.pl perl_header )
-string(REPLACE "@@PATHSEP@@" ":" perl_header "${perl_header}")
-string(REPLACE "@@INSTLIBDIR@@" "${INSTLIBDIR}" perl_header "${perl_header}")
+string(REPLACE "@PATHSEP@" ":" perl_header "${perl_header}")
+string(REPLACE "@INSTLIBDIR@" "${INSTLIBDIR}" perl_header "${perl_header}")
foreach(script ${git_perl_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.perl content NEWLINE_CONSUME)
string(REPLACE "#!/usr/bin/perl" "#!/usr/bin/perl\n${perl_header}\n" content "${content}")
- string(REPLACE "@@GIT_VERSION@@" "${PROJECT_VERSION}" content "${content}")
+ string(REPLACE "@GIT_VERSION@" "${PROJECT_VERSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
endforeach()
@@ -870,8 +870,8 @@ file(GLOB_RECURSE perl_modules "${CMAKE_SOURCE_DIR}/perl/*.pm")
foreach(pm ${perl_modules})
string(REPLACE "${CMAKE_SOURCE_DIR}/perl/" "" file_path ${pm})
file(STRINGS ${pm} content NEWLINE_CONSUME)
- string(REPLACE "@@LOCALEDIR@@" "${LOCALEDIR}" content "${content}")
- string(REPLACE "@@NO_PERL_CPAN_FALLBACKS@@" "" content "${content}")
+ string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}")
+ string(REPLACE "@NO_PERL_CPAN_FALLBACKS@" "" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/perl/build/lib/${file_path} ${content})
#test-lib.sh requires perl/build/lib to be the build directory of perl modules
endforeach()
@@ -1079,21 +1079,21 @@ set(wrapper_test_scripts
foreach(script ${wrapper_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
- string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
- string(REPLACE "@@PROG@@" "${script}${EXE_EXTENSION}" content "${content}")
+ string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+ string(REPLACE "@PROG@" "${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
foreach(script ${wrapper_test_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
- string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
- string(REPLACE "@@PROG@@" "t/helper/${script}${EXE_EXTENSION}" content "${content}")
+ string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+ string(REPLACE "@PROG@" "t/helper/${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
-string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
-string(REPLACE "@@PROG@@" "git-cvsserver" content "${content}")
+string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+string(REPLACE "@PROG@" "git-cvsserver" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})
#options for configuring test options
diff --git a/generate-perl.sh b/generate-perl.sh
index b9e04d6f42..41d78da029 100755
--- a/generate-perl.sh
+++ b/generate-perl.sh
@@ -17,6 +17,6 @@ sed -e '1{' \
-e " r $PERL_HEADER" \
-e ' G' \
-e '}' \
- -e "s/@@GIT_VERSION@@/$GIT_VERSION/g" \
+ -e "s/@GIT_VERSION@/$GIT_VERSION/g" \
"$PERL_SCRIPT" >"$OUT"
chmod a+x "$OUT"
diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index 124f598bdc..70ae7cb8e4 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -26,7 +26,7 @@
use File::Basename;
use Getopt::Long qw(:config require_order no_ignore_case);
-my $VERSION = '@@GIT_VERSION@@';
+my $VERSION = '@GIT_VERSION@';
my $log = GITCVS::log->new();
my $cfg;
diff --git a/git-instaweb.sh b/git-instaweb.sh
index 8dbe21d588..c8efb1205a 100755
--- a/git-instaweb.sh
+++ b/git-instaweb.sh
@@ -3,7 +3,7 @@
# Copyright (c) 2006 Eric Wong
#
-PERL='@@PERL@@'
+PERL='@PERL@'
OPTIONS_KEEPDASHDASH=
OPTIONS_STUCKLONG=
OPTIONS_SPEC="\
@@ -38,8 +38,8 @@ conf="$GIT_DIR/gitweb/httpd.conf"
# if installed, it doesn't need further configuration (module_path)
test -z "$httpd" && httpd='lighttpd -f'
-# Default is @@GITWEBDIR@@
-test -z "$root" && root='@@GITWEBDIR@@'
+# Default is @GITWEBDIR@
+test -z "$root" && root='@GITWEBDIR@'
# any untaken local port will do...
test -z "$port" && port=1234
@@ -716,7 +716,7 @@ EOF
gitweb_conf() {
cat > "$fqgitdir/gitweb/gitweb_config.perl" <<EOF
-#!@@PERL@@
+#!@PERL@
our \$projectroot = "$(dirname "$fqgitdir")";
our \$git_temp = "$fqgitdir/gitweb/tmp";
our \$projects_list = \$projectroot;
diff --git a/git-request-pull.sh b/git-request-pull.sh
index 01640a044b..10c88639e2 100755
--- a/git-request-pull.sh
+++ b/git-request-pull.sh
@@ -112,7 +112,7 @@ find_matching_ref='
}
'
-set fnord $(git ls-remote "$url" | @@PERL@@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
+set fnord $(git ls-remote "$url" | @PERL@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
remote_sha1=$2
ref=$3
diff --git a/git-send-email.perl b/git-send-email.perl
index c835d4c11a..02805c43e5 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1501,7 +1501,7 @@ sub gen_header {
@recipients = unique_email_list(@recipients,@cc,@initial_bcc);
@recipients = (map { extract_valid_address_or_die($_) } @recipients);
my $date = format_2822_time($time++);
- my $gitversion = '@@GIT_VERSION@@';
+ my $gitversion = '@GIT_VERSION@';
if ($gitversion =~ m/..GIT_VERSION../) {
$gitversion = Git::version();
}
diff --git a/git-sh-i18n.sh b/git-sh-i18n.sh
index a15c0620db..ae4b2d6ba9 100644
--- a/git-sh-i18n.sh
+++ b/git-sh-i18n.sh
@@ -9,7 +9,7 @@ TEXTDOMAIN=git
export TEXTDOMAIN
if test -z "$GIT_TEXTDOMAINDIR"
then
- TEXTDOMAINDIR="@@LOCALEDIR@@"
+ TEXTDOMAINDIR="@LOCALEDIR@"
else
TEXTDOMAINDIR="$GIT_TEXTDOMAINDIR"
fi
@@ -17,9 +17,9 @@ export TEXTDOMAINDIR
# First decide what scheme to use...
GIT_INTERNAL_GETTEXT_SH_SCHEME=fallthrough
-if test -n "@@USE_GETTEXT_SCHEME@@"
+if test -n "@USE_GETTEXT_SCHEME@"
then
- GIT_INTERNAL_GETTEXT_SH_SCHEME="@@USE_GETTEXT_SCHEME@@"
+ GIT_INTERNAL_GETTEXT_SH_SCHEME="@USE_GETTEXT_SCHEME@"
elif test -n "$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS"
then
: no probing necessary
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index ce273fe0e4..19aef72ec2 100644
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -41,7 +41,7 @@ git_broken_path_fix () {
esac
}
-# @@BROKEN_PATH_FIX@@
+# @BROKEN_PATH_FIX@
# Source git-sh-i18n for gettext support.
. "$(git --exec-path)/git-sh-i18n"
@@ -154,7 +154,7 @@ git_pager() {
else
GIT_PAGER=cat
fi
- for vardef in @@PAGER_ENV@@
+ for vardef in @PAGER_ENV@
do
var=${vardef%%=*}
eval ": \"\${$vardef}\" && export $var"
@@ -280,7 +280,7 @@ get_author_ident_from_commit () {
# remove lines from $1 that are not in $2, leaving only common lines.
create_virtual_base() {
sz0=$(wc -c <"$1")
- @@DIFF@@ -u -La/"$1" -Lb/"$1" "$1" "$2" | git apply --no-add
+ @DIFF@ -u -La/"$1" -Lb/"$1" "$1" "$2" | git apply --no-add
sz1=$(wc -c <"$1")
# If we do not have enough common material, it is not
diff --git a/git-svn.perl b/git-svn.perl
index 01e7a70de1..dcf65cf1d1 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -9,7 +9,7 @@
$_revision $_repository
$_q $_authors $_authors_prog %users/;
$AUTHOR = 'Eric Wong <normalperson@yhbt.net>';
-$VERSION = '@@GIT_VERSION@@';
+$VERSION = '@GIT_VERSION@';
use Carp qw/croak/;
use File::Basename qw/dirname basename/;
diff --git a/gitk-git/po/vi.po b/gitk-git/po/vi.po
index 5967498660..184430dcde 100644
--- a/gitk-git/po/vi.po
+++ b/gitk-git/po/vi.po
@@ -5,7 +5,7 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: gitk @@GIT_VERSION@@\n"
+"Project-Id-Version: gitk @GIT_VERSION@\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-05-17 14:32+1000\n"
"PO-Revision-Date: 2015-09-15 07:33+0700\n"
diff --git a/gitweb/Makefile b/gitweb/Makefile
index 3b68ab2d67..164c8d5375 100644
--- a/gitweb/Makefile
+++ b/gitweb/Makefile
@@ -79,28 +79,28 @@ GITWEB_JSLIB_FILES += static/js/blame_incremental.js
GITWEB_REPLACE = \
- -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
- -e 's|++GIT_BINDIR++|$(bindir)|g' \
- -e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \
- -e 's|++GITWEB_CONFIG_SYSTEM++|$(GITWEB_CONFIG_SYSTEM)|g' \
- -e 's|++GITWEB_CONFIG_COMMON++|$(GITWEB_CONFIG_COMMON)|g' \
- -e 's|++GITWEB_HOME_LINK_STR++|$(GITWEB_HOME_LINK_STR)|g' \
- -e 's|++GITWEB_SITENAME++|$(GITWEB_SITENAME)|g' \
- -e 's|++GITWEB_PROJECTROOT++|$(GITWEB_PROJECTROOT)|g' \
- -e 's|"++GITWEB_PROJECT_MAXDEPTH++"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
- -e 's|++GITWEB_EXPORT_OK++|$(GITWEB_EXPORT_OK)|g' \
- -e 's|++GITWEB_STRICT_EXPORT++|$(GITWEB_STRICT_EXPORT)|g' \
- -e 's|++GITWEB_BASE_URL++|$(GITWEB_BASE_URL)|g' \
- -e 's|++GITWEB_LIST++|$(GITWEB_LIST)|g' \
- -e 's|++GITWEB_HOMETEXT++|$(GITWEB_HOMETEXT)|g' \
- -e 's|++GITWEB_CSS++|$(GITWEB_CSS)|g' \
- -e 's|++GITWEB_LOGO++|$(GITWEB_LOGO)|g' \
- -e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \
- -e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \
- -e 's|++GITWEB_SITE_HTML_HEAD_STRING++|$(GITWEB_SITE_HTML_HEAD_STRING)|g' \
- -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \
- -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \
- -e 's|++HIGHLIGHT_BIN++|$(HIGHLIGHT_BIN)|g'
+ -e 's|@GIT_VERSION@|$(GIT_VERSION)|g' \
+ -e 's|@GIT_BINDIR@|$(bindir)|g' \
+ -e 's|@GITWEB_CONFIG@|$(GITWEB_CONFIG)|g' \
+ -e 's|@GITWEB_CONFIG_SYSTEM@|$(GITWEB_CONFIG_SYSTEM)|g' \
+ -e 's|@GITWEB_CONFIG_COMMON@|$(GITWEB_CONFIG_COMMON)|g' \
+ -e 's|@GITWEB_HOME_LINK_STR@|$(GITWEB_HOME_LINK_STR)|g' \
+ -e 's|@GITWEB_SITENAME@|$(GITWEB_SITENAME)|g' \
+ -e 's|@GITWEB_PROJECTROOT@|$(GITWEB_PROJECTROOT)|g' \
+ -e 's|"@GITWEB_PROJECT_MAXDEPTH@"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
+ -e 's|@GITWEB_EXPORT_OK@|$(GITWEB_EXPORT_OK)|g' \
+ -e 's|@GITWEB_STRICT_EXPORT@|$(GITWEB_STRICT_EXPORT)|g' \
+ -e 's|@GITWEB_BASE_URL@|$(GITWEB_BASE_URL)|g' \
+ -e 's|@GITWEB_LIST@|$(GITWEB_LIST)|g' \
+ -e 's|@GITWEB_HOMETEXT@|$(GITWEB_HOMETEXT)|g' \
+ -e 's|@GITWEB_CSS@|$(GITWEB_CSS)|g' \
+ -e 's|@GITWEB_LOGO@|$(GITWEB_LOGO)|g' \
+ -e 's|@GITWEB_FAVICON@|$(GITWEB_FAVICON)|g' \
+ -e 's|@GITWEB_JS@|$(GITWEB_JS)|g' \
+ -e 's|@GITWEB_SITE_HTML_HEAD_STRING@|$(GITWEB_SITE_HTML_HEAD_STRING)|g' \
+ -e 's|@GITWEB_SITE_HEADER@|$(GITWEB_SITE_HEADER)|g' \
+ -e 's|@GITWEB_SITE_FOOTER@|$(GITWEB_SITE_FOOTER)|g' \
+ -e 's|@HIGHLIGHT_BIN@|$(HIGHLIGHT_BIN)|g'
.PHONY: FORCE
$(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS: FORCE
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index b09a8d0523..76e1f4e244 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -35,7 +35,7 @@ BEGIN
CGI->compile() if $ENV{'MOD_PERL'};
}
-our $version = "++GIT_VERSION++";
+our $version = "@GIT_VERSION@";
our ($my_url, $my_uri, $base_url, $path_info, $home_link);
sub evaluate_uri {
@@ -80,46 +80,46 @@ sub evaluate_uri {
# core git executable to use
# this can just be "git" if your webserver has a sensible PATH
-our $GIT = "++GIT_BINDIR++/git";
+our $GIT = "@GIT_BINDIR@/git";
# absolute fs-path which will be prepended to the project path
#our $projectroot = "/pub/scm";
-our $projectroot = "++GITWEB_PROJECTROOT++";
+our $projectroot = "@GITWEB_PROJECTROOT@";
# fs traversing limit for getting project list
# the number is relative to the projectroot
-our $project_maxdepth = "++GITWEB_PROJECT_MAXDEPTH++";
+our $project_maxdepth = "@GITWEB_PROJECT_MAXDEPTH@";
# string of the home link on top of all pages
-our $home_link_str = "++GITWEB_HOME_LINK_STR++";
+our $home_link_str = "@GITWEB_HOME_LINK_STR@";
# extra breadcrumbs preceding the home link
our @extra_breadcrumbs = ();
# name of your site or organization to appear in page titles
# replace this with something more descriptive for clearer bookmarks
-our $site_name = "++GITWEB_SITENAME++"
+our $site_name = "@GITWEB_SITENAME@"
|| ($ENV{'SERVER_NAME'} || "Untitled") . " Git";
# html snippet to include in the <head> section of each page
-our $site_html_head_string = "++GITWEB_SITE_HTML_HEAD_STRING++";
+our $site_html_head_string = "@GITWEB_SITE_HTML_HEAD_STRING@";
# filename of html text to include at top of each page
-our $site_header = "++GITWEB_SITE_HEADER++";
+our $site_header = "@GITWEB_SITE_HEADER@";
# html text to include at home page
-our $home_text = "++GITWEB_HOMETEXT++";
+our $home_text = "@GITWEB_HOMETEXT@";
# filename of html text to include at bottom of each page
-our $site_footer = "++GITWEB_SITE_FOOTER++";
+our $site_footer = "@GITWEB_SITE_FOOTER@";
# URI of stylesheets
-our @stylesheets = ("++GITWEB_CSS++");
+our @stylesheets = ("@GITWEB_CSS@");
# URI of a single stylesheet, which can be overridden in GITWEB_CONFIG.
our $stylesheet = undef;
# URI of GIT logo (72x27 size)
-our $logo = "++GITWEB_LOGO++";
+our $logo = "@GITWEB_LOGO@";
# URI of GIT favicon, assumed to be image/png type
-our $favicon = "++GITWEB_FAVICON++";
+our $favicon = "@GITWEB_FAVICON@";
# URI of gitweb.js (JavaScript code for gitweb)
-our $javascript = "++GITWEB_JS++";
+our $javascript = "@GITWEB_JS@";
# URI and label (title) of GIT logo link
#our $logo_url = "https://www.kernel.org/pub/software/scm/git/docs/";
@@ -128,7 +128,7 @@ sub evaluate_uri {
our $logo_label = "git homepage";
# source of projects list
-our $projects_list = "++GITWEB_LIST++";
+our $projects_list = "@GITWEB_LIST@";
# the width (in characters) of the projects list "Description" column
our $projects_list_description_width = 25;
@@ -147,7 +147,7 @@ sub evaluate_uri {
# show repository only if this file exists
# (only effective if this variable evaluates to true)
-our $export_ok = "++GITWEB_EXPORT_OK++";
+our $export_ok = "@GITWEB_EXPORT_OK@";
# don't generate age column on the projects list page
our $omit_age_column = 0;
@@ -161,11 +161,11 @@ sub evaluate_uri {
our $export_auth_hook = undef;
# only allow viewing of repositories also shown on the overview page
-our $strict_export = "++GITWEB_STRICT_EXPORT++";
+our $strict_export = "@GITWEB_STRICT_EXPORT@";
# list of git base URLs used for URL to where fetch project from,
# i.e. full URL is "$git_base_url/$project"
-our @git_base_url_list = grep { $_ ne '' } ("++GITWEB_BASE_URL++");
+our @git_base_url_list = grep { $_ ne '' } ("@GITWEB_BASE_URL@");
# default blob_plain mimetype and default charset for text/plain blob
our $default_blob_plain_mimetype = 'text/plain';
@@ -200,7 +200,7 @@ sub evaluate_uri {
# http://andre-simon.de/zip/download.php due to assumptions about parameters and output).
# Useful if highlight is not installed on your webserver's PATH.
# [Default: highlight]
-our $highlight_bin = "++HIGHLIGHT_BIN++";
+our $highlight_bin = "@HIGHLIGHT_BIN@";
# information about snapshot formats that gitweb is capable of serving
our %known_snapshot_formats = (
@@ -741,9 +741,9 @@ sub read_config_file {
our ($GITWEB_CONFIG, $GITWEB_CONFIG_SYSTEM, $GITWEB_CONFIG_COMMON);
sub evaluate_gitweb_config {
- our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "++GITWEB_CONFIG++";
- our $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || "++GITWEB_CONFIG_SYSTEM++";
- our $GITWEB_CONFIG_COMMON = $ENV{'GITWEB_CONFIG_COMMON'} || "++GITWEB_CONFIG_COMMON++";
+ our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "@GITWEB_CONFIG@";
+ our $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || "@GITWEB_CONFIG_SYSTEM@";
+ our $GITWEB_CONFIG_COMMON = $ENV{'GITWEB_CONFIG_COMMON'} || "@GITWEB_CONFIG_COMMON@";
# Protect against duplications of file names, to not read config twice.
# Only one of $GITWEB_CONFIG and $GITWEB_CONFIG_SYSTEM is used, so
diff --git a/perl/Git/I18N.pm b/perl/Git/I18N.pm
index 5454c3a6d2..1da830c98a 100644
--- a/perl/Git/I18N.pm
+++ b/perl/Git/I18N.pm
@@ -20,14 +20,14 @@ BEGIN
# this "'@@' [...] '@@'" pattern.
use constant NO_GETTEXT_STR => '@@' . 'NO_GETTEXT' . '@@';
use constant NO_GETTEXT => (
- q[@@NO_GETTEXT@@] ne ''
+ q[@NO_GETTEXT@] ne ''
and
- q[@@NO_GETTEXT@@] ne NO_GETTEXT_STR
+ q[@NO_GETTEXT@] ne NO_GETTEXT_STR
);
sub __bootstrap_locale_messages {
our $TEXTDOMAIN = 'git';
- our $TEXTDOMAINDIR ||= $ENV{GIT_TEXTDOMAINDIR} || '@@LOCALEDIR@@';
+ our $TEXTDOMAINDIR ||= $ENV{GIT_TEXTDOMAINDIR} || '@LOCALEDIR@';
die "NO_GETTEXT=" . NO_GETTEXT_STR if NO_GETTEXT;
require POSIX;
diff --git a/perl/Git/LoadCPAN.pm b/perl/Git/LoadCPAN.pm
index 8c7fa805f9..6be99840f8 100644
--- a/perl/Git/LoadCPAN.pm
+++ b/perl/Git/LoadCPAN.pm
@@ -31,11 +31,11 @@ =head1 DESCRIPTION
# Makefile, and allows for detecting whether the module is loaded from
# perl/Git as opposed to perl/build/Git, which is useful for one-off
# testing without having Error.pm et al installed.
-use constant NO_PERL_CPAN_FALLBACKS_STR => '@@' . 'NO_PERL_CPAN_FALLBACKS' . '@@';
+use constant NO_PERL_CPAN_FALLBACKS_STR => '@' . 'NO_PERL_CPAN_FALLBACKS' . '@';
use constant NO_PERL_CPAN_FALLBACKS => (
- q[@@NO_PERL_CPAN_FALLBACKS@@] ne ''
+ q[@NO_PERL_CPAN_FALLBACKS@] ne ''
and
- q[@@NO_PERL_CPAN_FALLBACKS@@] ne NO_PERL_CPAN_FALLBACKS_STR
+ q[@NO_PERL_CPAN_FALLBACKS@] ne NO_PERL_CPAN_FALLBACKS_STR
);
sub import {
--git a/perl/header_templates/fixed_prefix.template.pl b/perl/header_templates/fixed_prefix.template.pl
index 857b4391a4..d571ca5cde 100644
--- a/perl/header_templates/fixed_prefix.template.pl
+++ b/perl/header_templates/fixed_prefix.template.pl
@@ -1 +1 @@
-use lib (split(/@@PATHSEP@@/, $ENV{GITPERLLIB} || '@@INSTLIBDIR@@'));
+use lib (split(/@PATHSEP@/, $ENV{GITPERLLIB} || '@INSTLIBDIR@'));
diff --git a/perl/header_templates/runtime_prefix.template.pl b/perl/header_templates/runtime_prefix.template.pl
index 9d28b3d863..e6f8e661a1 100644
--- a/perl/header_templates/runtime_prefix.template.pl
+++ b/perl/header_templates/runtime_prefix.template.pl
@@ -3,7 +3,7 @@
# This finds our Git::* libraries relative to the script's runtime path.
sub __git_system_path {
my ($relpath) = @_;
- my $gitexecdir_relative = '@@GITEXECDIR_REL@@';
+ my $gitexecdir_relative = '@GITEXECDIR_REL@';
# GIT_EXEC_PATH is supplied by `git` or the test suite.
my $exec_path;
@@ -24,11 +24,11 @@ sub __git_system_path {
}
BEGIN {
- use lib split /@@PATHSEP@@/,
+ use lib split /@PATHSEP@/,
(
$ENV{GITPERLLIB} ||
do {
- my $perllibdir = __git_system_path('@@PERLLIBDIR_REL@@');
+ my $perllibdir = __git_system_path('@PERLLIBDIR_REL@');
(-e $perllibdir) || die("Invalid system path ($relpath): $path");
$perllibdir;
}
@@ -36,7 +36,7 @@ BEGIN
# Export the system locale directory to the I18N module. The locale directory
# is only installed if NO_GETTEXT is set.
- $Git::I18N::TEXTDOMAINDIR = __git_system_path('@@LOCALEDIR_REL@@');
+ $Git::I18N::TEXTDOMAINDIR = __git_system_path('@LOCALEDIR_REL@');
}
# END RUNTIME_PREFIX generated code.
diff --git a/unimplemented.sh b/unimplemented.sh
index fee21d24e8..41776b279d 100644
--- a/unimplemented.sh
+++ b/unimplemented.sh
@@ -1,4 +1,4 @@
#!/bin/sh
-echo >&2 "fatal: git was built without support for $(basename $0) (@@REASON@@)."
+echo >&2 "fatal: git was built without support for $(basename $0) (@REASON@)."
exit 128
diff --git a/wrap-for-bin.sh b/wrap-for-bin.sh
index 95851b85b6..7898a1c238 100644
--- a/wrap-for-bin.sh
+++ b/wrap-for-bin.sh
@@ -4,33 +4,33 @@
# to run test suite against sandbox, but with only bindir-installed
# executables in PATH. The Makefile copies this into various
# files in bin-wrappers, substituting
-# @@BUILD_DIR@@ and @@PROG@@.
+# @BUILD_DIR@ and @PROG@.
-GIT_EXEC_PATH='@@BUILD_DIR@@'
+GIT_EXEC_PATH='@BUILD_DIR@'
if test -n "$NO_SET_GIT_TEMPLATE_DIR"
then
unset GIT_TEMPLATE_DIR
else
- GIT_TEMPLATE_DIR='@@BUILD_DIR@@/templates/blt'
+ GIT_TEMPLATE_DIR='@BUILD_DIR@/templates/blt'
export GIT_TEMPLATE_DIR
fi
-GITPERLLIB='@@BUILD_DIR@@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}"
-GIT_TEXTDOMAINDIR='@@BUILD_DIR@@/po/build/locale'
-PATH='@@BUILD_DIR@@/bin-wrappers:'"$PATH"
+GITPERLLIB='@BUILD_DIR@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}"
+GIT_TEXTDOMAINDIR='@BUILD_DIR@/po/build/locale'
+PATH='@BUILD_DIR@/bin-wrappers:'"$PATH"
export GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
case "$GIT_DEBUGGER" in
'')
- exec "${GIT_EXEC_PATH}/@@PROG@@" "$@"
+ exec "${GIT_EXEC_PATH}/@PROG@" "$@"
;;
1)
unset GIT_DEBUGGER
- exec gdb --args "${GIT_EXEC_PATH}/@@PROG@@" "$@"
+ exec gdb --args "${GIT_EXEC_PATH}/@PROG@" "$@"
;;
*)
GIT_DEBUGGER_ARGS="$GIT_DEBUGGER"
unset GIT_DEBUGGER
- exec ${GIT_DEBUGGER_ARGS} "${GIT_EXEC_PATH}/@@PROG@@" "$@"
+ exec ${GIT_DEBUGGER_ARGS} "${GIT_EXEC_PATH}/@PROG@" "$@"
;;
esac
--
2.47.0.rc0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH 16/21] Makefile: consistently use PERL_PATH
2024-10-02 15:15 [RFC PATCH 00/21] Modernize the build system Patrick Steinhardt
` (14 preceding siblings ...)
2024-10-02 15:16 ` [RFC PATCH 15/21] Makefile: consistently use @PLACEHOLDER@ to substitute Patrick Steinhardt
@ 2024-10-02 15:16 ` Patrick Steinhardt
2024-10-02 15:16 ` [RFC PATCH 17/21] Makefile: allow "bin-wrappers/" directory to exist Patrick Steinhardt
` (15 subsequent siblings)
31 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-02 15:16 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz
When injecting the Perl path into our scripts we sometimes use '@PERL@'
while we othertimes use '@PERL_PATH@'. Refactor the code use the latter
consistently, which makes it easier to reuse the same logic for multiple
scripts.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 2 +-
contrib/buildsystems/CMakeLists.txt | 2 +-
git-instaweb.sh | 4 ++--
git-request-pull.sh | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile
index 91e64c1222..380b6a3dbc 100644
--- a/Makefile
+++ b/Makefile
@@ -2529,7 +2529,7 @@ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's/@USE_GETTEXT_SCHEME@/$(USE_GETTEXT_SCHEME)/g' \
-e $(BROKEN_PATH_FIX) \
-e 's|@GITWEBDIR@|$(gitwebdir_SQ)|g' \
- -e 's|@PERL@|$(PERL_PATH_SQ)|g' \
+ -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' \
-e 's|@PAGER_ENV@|$(PAGER_ENV_SQ)|g' \
$@.sh >$@+
endef
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index bf029b9428..5884fa73b1 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -839,7 +839,7 @@ foreach(script ${git_shell_scripts})
string(REPLACE "@NO_CURL@" "" content "${content}")
string(REPLACE "@USE_GETTEXT_SCHEME@" "" content "${content}")
string(REPLACE "# @BROKEN_PATH_FIX@" "" content "${content}")
- string(REPLACE "@PERL@" "${PERL_PATH}" content "${content}")
+ string(REPLACE "@PERL_PATH@" "${PERL_PATH}" content "${content}")
string(REPLACE "@PAGER_ENV@" "LESS=FRX LV=-c" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
endforeach()
diff --git a/git-instaweb.sh b/git-instaweb.sh
index c8efb1205a..5ad50160bb 100755
--- a/git-instaweb.sh
+++ b/git-instaweb.sh
@@ -3,7 +3,7 @@
# Copyright (c) 2006 Eric Wong
#
-PERL='@PERL@'
+PERL='@PERL_PATH@'
OPTIONS_KEEPDASHDASH=
OPTIONS_STUCKLONG=
OPTIONS_SPEC="\
@@ -716,7 +716,7 @@ EOF
gitweb_conf() {
cat > "$fqgitdir/gitweb/gitweb_config.perl" <<EOF
-#!@PERL@
+#!@PERL_PATH@
our \$projectroot = "$(dirname "$fqgitdir")";
our \$git_temp = "$fqgitdir/gitweb/tmp";
our \$projects_list = \$projectroot;
diff --git a/git-request-pull.sh b/git-request-pull.sh
index 10c88639e2..775ba8ea11 100755
--- a/git-request-pull.sh
+++ b/git-request-pull.sh
@@ -112,7 +112,7 @@ find_matching_ref='
}
'
-set fnord $(git ls-remote "$url" | @PERL@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
+set fnord $(git ls-remote "$url" | @PERL_PATH@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
remote_sha1=$2
ref=$3
--
2.47.0.rc0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH 17/21] Makefile: allow "bin-wrappers/" directory to exist
2024-10-02 15:15 [RFC PATCH 00/21] Modernize the build system Patrick Steinhardt
` (15 preceding siblings ...)
2024-10-02 15:16 ` [RFC PATCH 16/21] Makefile: consistently use PERL_PATH Patrick Steinhardt
@ 2024-10-02 15:16 ` Patrick Steinhardt
2024-10-02 15:16 ` [RFC PATCH 18/21] Makefile: simplify building of templates Patrick Steinhardt
` (14 subsequent siblings)
31 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-02 15:16 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz
The "bin-wrappers/" directory gets created by our build system and is
populated with one script for each of our binaries. There isn't anything
inherently wrong with the current layout, but it is somewhat hard to
adapt for out-of-tree build systems.
Adapt the layout such that our "bin-wrappers/" directory always exists
and contains our "wrap-for-bin.sh" script to make things a little bit
easier for subsequent steps.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
.gitignore | 1 -
Documentation/CodingGuidelines | 2 +-
Makefile | 6 +++---
bin-wrappers/.gitignore | 9 +++++++++
wrap-for-bin.sh => bin-wrappers/wrap-for-bin.sh | 0
contrib/buildsystems/CMakeLists.txt | 6 +++---
6 files changed, 16 insertions(+), 8 deletions(-)
create mode 100644 bin-wrappers/.gitignore
rename wrap-for-bin.sh => bin-wrappers/wrap-for-bin.sh (100%)
mode change 100644 => 100755
diff --git a/.gitignore b/.gitignore
index 6687bd6db4..349673c55c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,7 +12,6 @@
/GIT-TEST-SUITES
/GIT-USER-AGENT
/GIT-VERSION-FILE
-/bin-wrappers/
/git
/git-add
/git-am
diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
index 3263245b03..ad83156744 100644
--- a/Documentation/CodingGuidelines
+++ b/Documentation/CodingGuidelines
@@ -583,7 +583,7 @@ For C programs:
Run `GIT_DEBUGGER=1 ./bin-wrappers/git foo` to simply use gdb as is, or
run `GIT_DEBUGGER="<debugger> <debugger-args>" ./bin-wrappers/git foo` to
use your own debugger and arguments. Example: `GIT_DEBUGGER="ddd --gdb"
- ./bin-wrappers/git log` (See `wrap-for-bin.sh`.)
+ ./bin-wrappers/git log` (See `bin-wrappers/wrap-for-bin.sh`.)
- The primary data structure that a subsystem 'S' deals with is called
`struct S`. Functions that operate on `struct S` are named
diff --git a/Makefile b/Makefile
index 380b6a3dbc..b0c21c4c0d 100644
--- a/Makefile
+++ b/Makefile
@@ -3189,8 +3189,7 @@ test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $(
all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PROG)
-bin-wrappers/%: wrap-for-bin.sh
- $(call mkdir_p_parent_template)
+bin-wrappers/%: bin-wrappers/wrap-for-bin.sh
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@BUILD_DIR@|$(shell pwd)|' \
-e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
@@ -3686,7 +3685,8 @@ clean: profile-clean coverage-clean cocciclean
$(RM) $(FUZZ_PROGRAMS)
$(RM) $(SP_OBJ)
$(RM) $(HCC)
- $(RM) -r bin-wrappers $(dep_dirs) $(compdb_dir) compile_commands.json
+ $(RM) -r $(dep_dirs) $(compdb_dir) compile_commands.json
+ $(RM) $(test_bindir_programs)
$(RM) -r po/build/
$(RM) *.pyc *.pyo */*.pyc */*.pyo $(GENERATED_H) $(ETAGS_TARGET) tags cscope*
$(RM) -r .dist-tmp-dir .doc-tmp-dir
diff --git a/bin-wrappers/.gitignore b/bin-wrappers/.gitignore
new file mode 100644
index 0000000000..1c6c90458b
--- /dev/null
+++ b/bin-wrappers/.gitignore
@@ -0,0 +1,9 @@
+/git
+/git-cvsserver
+/git-receive-pack
+/git-shell
+/git-upload-archive
+/git-upload-pack
+/scalar
+/test-fake-ssh
+/test-tool
diff --git a/wrap-for-bin.sh b/bin-wrappers/wrap-for-bin.sh
old mode 100644
new mode 100755
similarity index 100%
rename from wrap-for-bin.sh
rename to bin-wrappers/wrap-for-bin.sh
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 5884fa73b1..700f4e5160 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -1078,20 +1078,20 @@ set(wrapper_test_scripts
foreach(script ${wrapper_scripts})
- file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
+ file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
string(REPLACE "@PROG@" "${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
foreach(script ${wrapper_test_scripts})
- file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
+ file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
string(REPLACE "@PROG@" "t/helper/${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
-file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
+file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
string(REPLACE "@PROG@" "git-cvsserver" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})
--
2.47.0.rc0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH 18/21] Makefile: simplify building of templates
2024-10-02 15:15 [RFC PATCH 00/21] Modernize the build system Patrick Steinhardt
` (16 preceding siblings ...)
2024-10-02 15:16 ` [RFC PATCH 17/21] Makefile: allow "bin-wrappers/" directory to exist Patrick Steinhardt
@ 2024-10-02 15:16 ` Patrick Steinhardt
2024-10-02 15:16 ` [RFC PATCH 19/21] t: better support for out-of-tree builds Patrick Steinhardt
` (13 subsequent siblings)
31 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-02 15:16 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz
When we install Git we also install a set of default templates that both
git-init(1) and git-clone(1) populate into our build directories. The
way the pristine templates are layed out in our source directory is
somewhat weird though: instead of reconstructing the actual directory
hierarchy in "templates/", we represent directory separators with "--".
The only reason I could come up with for why we have this is the
"branches/" directory, which is supposed to be empty when installing it.
And as Git famously doesn't store empty directories at all we have to
work around this limitation.
Now the thing is that the "branches/" directory is a leftover to how
branches used to be stored in the dark ages. gitrepository-layout(5)
lists this directory as "slightly deprecated", which I would claim is a
strong understatement. I have never encountered anybody using it today
and would be surprised if it even works as expected. So having the "--"
hack in place for an item that is basically unused, unmaintained and
deprecated doesn't only feel unreasonable, but installing that entry by
default may also cause confusion for users that do not know what this is
supposed to be in the first place.
Remove this directory from our templates and, now that we do not require
the workaround anymore, restructure the templates to form a proper
hierarchy. This makes it way easier for build systems to install these
templates into place.
We should likely think about removing support for "branch/" altogether,
but that is outside of the scope of this patch series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
contrib/buildsystems/CMakeLists.txt | 8 +---
templates/Makefile | 38 ++++++++++++-------
templates/branches-- | 1 -
templates/{this--description => description} | 0
.../applypatch-msg.sample} | 0
.../commit-msg.sample} | 0
.../fsmonitor-watchman.sample} | 0
.../post-update.sample} | 0
.../pre-applypatch.sample} | 0
.../pre-commit.sample} | 0
.../pre-merge-commit.sample} | 0
.../pre-push.sample} | 0
.../pre-rebase.sample} | 0
.../pre-receive.sample} | 0
.../prepare-commit-msg.sample} | 0
.../push-to-checkout.sample} | 0
.../sendemail-validate.sample} | 0
.../update.sample} | 0
templates/{info--exclude => info/exclude} | 0
19 files changed, 25 insertions(+), 22 deletions(-)
delete mode 100644 templates/branches--
rename templates/{this--description => description} (100%)
rename templates/{hooks--applypatch-msg.sample => hooks/applypatch-msg.sample} (100%)
rename templates/{hooks--commit-msg.sample => hooks/commit-msg.sample} (100%)
rename templates/{hooks--fsmonitor-watchman.sample => hooks/fsmonitor-watchman.sample} (100%)
rename templates/{hooks--post-update.sample => hooks/post-update.sample} (100%)
rename templates/{hooks--pre-applypatch.sample => hooks/pre-applypatch.sample} (100%)
rename templates/{hooks--pre-commit.sample => hooks/pre-commit.sample} (100%)
rename templates/{hooks--pre-merge-commit.sample => hooks/pre-merge-commit.sample} (100%)
rename templates/{hooks--pre-push.sample => hooks/pre-push.sample} (100%)
rename templates/{hooks--pre-rebase.sample => hooks/pre-rebase.sample} (100%)
rename templates/{hooks--pre-receive.sample => hooks/pre-receive.sample} (100%)
rename templates/{hooks--prepare-commit-msg.sample => hooks/prepare-commit-msg.sample} (100%)
rename templates/{hooks--push-to-checkout.sample => hooks/push-to-checkout.sample} (100%)
rename templates/{hooks--sendemail-validate.sample => hooks/sendemail-validate.sample} (100%)
rename templates/{hooks--update.sample => hooks/update.sample} (100%)
rename templates/{info--exclude => info/exclude} (100%)
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 700f4e5160..23c2fb91ce 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -878,23 +878,17 @@ endforeach()
#templates
-file(GLOB templates "${CMAKE_SOURCE_DIR}/templates/*")
+file(GLOB templates "${CMAKE_SOURCE_DIR}/templates/**")
list(TRANSFORM templates REPLACE "${CMAKE_SOURCE_DIR}/templates/" "")
list(REMOVE_ITEM templates ".gitignore")
list(REMOVE_ITEM templates "Makefile")
list(REMOVE_ITEM templates "blt")# Prevents an error when reconfiguring for in source builds
-list(REMOVE_ITEM templates "branches--")
-file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/templates/blt/branches) #create branches
-
#templates have @.*@ replacement so use configure_file instead
foreach(tm ${templates})
- string(REPLACE "--" "/" blt_tm ${tm})
- string(REPLACE "this" "" blt_tm ${blt_tm})# for this--
configure_file(${CMAKE_SOURCE_DIR}/templates/${tm} ${CMAKE_BINARY_DIR}/templates/blt/${blt_tm} @ONLY)
endforeach()
-
#translations
if(MSGFMT_EXE)
file(GLOB po_files "${CMAKE_SOURCE_DIR}/po/*.po")
diff --git a/templates/Makefile b/templates/Makefile
index 367ad00c24..0b91d18925 100644
--- a/templates/Makefile
+++ b/templates/Makefile
@@ -29,24 +29,34 @@ all: boilerplates.made custom
# in a file direc--tory--file in the source. They will be
# just copied to the destination.
-bpsrc = $(filter-out %~,$(wildcard *--*))
-boilerplates.made : $(bpsrc)
- $(QUIET)umask 022 && ls *--* 2>/dev/null | \
- while read boilerplate; \
+TEMPLATES = description
+TEMPLATES += hooks/applypatch-msg.sample
+TEMPLATES += hooks/commit-msg.sample
+TEMPLATES += hooks/fsmonitor-watchman.sample
+TEMPLATES += hooks/post-update.sample
+TEMPLATES += hooks/pre-applypatch.sample
+TEMPLATES += hooks/pre-commit.sample
+TEMPLATES += hooks/pre-merge-commit.sample
+TEMPLATES += hooks/prepare-commit-msg.sample
+TEMPLATES += hooks/pre-push.sample
+TEMPLATES += hooks/pre-rebase.sample
+TEMPLATES += hooks/pre-receive.sample
+TEMPLATES += hooks/push-to-checkout.sample
+TEMPLATES += hooks/sendemail-validate.sample
+TEMPLATES += hooks/update.sample
+TEMPLATES += info/exclude
+
+boilerplates.made: $(TEMPLATES)
+ $(QUIET)umask 022 && for template in $(TEMPLATES); \
do \
- case "$$boilerplate" in *~) continue ;; esac && \
- dst=`echo "$$boilerplate" | sed -e 's|^this|.|;s|--|/|g'` && \
- dir=`expr "$$dst" : '\(.*\)/'` && \
+ dir=$$(dirname "$$template") && \
mkdir -p blt/$$dir && \
- case "$$boilerplate" in \
- *--) continue;; \
- esac && \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
- -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' $$boilerplate > \
- blt/$$dst && \
- if test -x "$$boilerplate"; then rx=rx; else rx=r; fi && \
- chmod a+$$rx "blt/$$dst" || exit; \
+ -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' $$template > \
+ blt/$$template && \
+ if test -x "$$template"; then rx=rx; else rx=r; fi && \
+ chmod a+$$rx "blt/$$template" || exit; \
done && \
date >$@
diff --git a/templates/branches-- b/templates/branches--
deleted file mode 100644
index fae88709a6..0000000000
--- a/templates/branches--
+++ /dev/null
@@ -1 +0,0 @@
-: this is just to ensure the directory exists.
diff --git a/templates/this--description b/templates/description
similarity index 100%
rename from templates/this--description
rename to templates/description
diff --git a/templates/hooks--applypatch-msg.sample b/templates/hooks/applypatch-msg.sample
similarity index 100%
rename from templates/hooks--applypatch-msg.sample
rename to templates/hooks/applypatch-msg.sample
diff --git a/templates/hooks--commit-msg.sample b/templates/hooks/commit-msg.sample
similarity index 100%
rename from templates/hooks--commit-msg.sample
rename to templates/hooks/commit-msg.sample
diff --git a/templates/hooks--fsmonitor-watchman.sample b/templates/hooks/fsmonitor-watchman.sample
similarity index 100%
rename from templates/hooks--fsmonitor-watchman.sample
rename to templates/hooks/fsmonitor-watchman.sample
diff --git a/templates/hooks--post-update.sample b/templates/hooks/post-update.sample
similarity index 100%
rename from templates/hooks--post-update.sample
rename to templates/hooks/post-update.sample
diff --git a/templates/hooks--pre-applypatch.sample b/templates/hooks/pre-applypatch.sample
similarity index 100%
rename from templates/hooks--pre-applypatch.sample
rename to templates/hooks/pre-applypatch.sample
diff --git a/templates/hooks--pre-commit.sample b/templates/hooks/pre-commit.sample
similarity index 100%
rename from templates/hooks--pre-commit.sample
rename to templates/hooks/pre-commit.sample
diff --git a/templates/hooks--pre-merge-commit.sample b/templates/hooks/pre-merge-commit.sample
similarity index 100%
rename from templates/hooks--pre-merge-commit.sample
rename to templates/hooks/pre-merge-commit.sample
diff --git a/templates/hooks--pre-push.sample b/templates/hooks/pre-push.sample
similarity index 100%
rename from templates/hooks--pre-push.sample
rename to templates/hooks/pre-push.sample
diff --git a/templates/hooks--pre-rebase.sample b/templates/hooks/pre-rebase.sample
similarity index 100%
rename from templates/hooks--pre-rebase.sample
rename to templates/hooks/pre-rebase.sample
diff --git a/templates/hooks--pre-receive.sample b/templates/hooks/pre-receive.sample
similarity index 100%
rename from templates/hooks--pre-receive.sample
rename to templates/hooks/pre-receive.sample
diff --git a/templates/hooks--prepare-commit-msg.sample b/templates/hooks/prepare-commit-msg.sample
similarity index 100%
rename from templates/hooks--prepare-commit-msg.sample
rename to templates/hooks/prepare-commit-msg.sample
diff --git a/templates/hooks--push-to-checkout.sample b/templates/hooks/push-to-checkout.sample
similarity index 100%
rename from templates/hooks--push-to-checkout.sample
rename to templates/hooks/push-to-checkout.sample
diff --git a/templates/hooks--sendemail-validate.sample b/templates/hooks/sendemail-validate.sample
similarity index 100%
rename from templates/hooks--sendemail-validate.sample
rename to templates/hooks/sendemail-validate.sample
diff --git a/templates/hooks--update.sample b/templates/hooks/update.sample
similarity index 100%
rename from templates/hooks--update.sample
rename to templates/hooks/update.sample
diff --git a/templates/info--exclude b/templates/info/exclude
similarity index 100%
rename from templates/info--exclude
rename to templates/info/exclude
--
2.47.0.rc0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH 19/21] t: better support for out-of-tree builds
2024-10-02 15:15 [RFC PATCH 00/21] Modernize the build system Patrick Steinhardt
` (17 preceding siblings ...)
2024-10-02 15:16 ` [RFC PATCH 18/21] Makefile: simplify building of templates Patrick Steinhardt
@ 2024-10-02 15:16 ` Patrick Steinhardt
2024-10-02 15:16 ` [RFC PATCH 20/21] t: allow overriding build dir Patrick Steinhardt
` (12 subsequent siblings)
31 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-02 15:16 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz
Our in-tree builds used by the Makefile use various different build
directories scattered around different locations. The paths to those
build directories have to be propagated to our tests such that they can
find the contained files. This is done via a mixture of hardcoded paths
in our test library and injected variables in our bin-wrappers or
"GIT-BUILD-OPTIONS".
The latter two mechanisms are preferable over using hardcoded paths. For
one, we have all paths which are subject to change stored in a small set
of central files instead of having the knowledge of build paths in many
files. And second, it allows build systems which build files elsewhere
to adapt those paths based on their own needs. This is especially nice
in the context of build systems that use out-of-tree builds like CMake
or Meson.
Remove hardcoded knowledge of build paths from our test library and move
it into our bin-wrappers and "GIT-BUILD-OPTIONS".
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-BUILD-OPTIONS.in | 5 +++++
Makefile | 9 +++++++++
bin-wrappers/wrap-for-bin.sh | 11 ++++++-----
contrib/buildsystems/CMakeLists.txt | 8 ++++++++
t/lib-gettext.sh | 4 ++--
t/t7609-mergetool--lib.sh | 2 +-
t/test-lib.sh | 6 +++---
7 files changed, 34 insertions(+), 11 deletions(-)
diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in
index e73cd5fa1a..2b3f5ef2d6 100644
--- a/GIT-BUILD-OPTIONS.in
+++ b/GIT-BUILD-OPTIONS.in
@@ -32,4 +32,9 @@ GIT_PERF_MAKE_COMMAND=@GIT_PERF_MAKE_COMMAND@
GIT_INTEROP_MAKE_OPTS=@GIT_INTEROP_MAKE_OPTS@
GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@
GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@
+GIT_TEST_TEXTDOMAINDIR=@GIT_TEST_TEXTDOMAINDIR@
+GIT_TEST_POPATH=@GIT_TEST_POPATH@
+GIT_TEST_TEMPLATE_DIR=@GIT_TEST_TEMPLATE_DIR@
+GIT_TEST_GITPERLLIB=@GIT_TEST_GITPERLLIB@
+GIT_TEST_MERGE_TOOLS_DIR=@GIT_TEST_MERGE_TOOLS_DIR@
RUNTIME_PREFIX=@RUNTIME_PREFIX@
diff --git a/Makefile b/Makefile
index b0c21c4c0d..e6b75b6e3e 100644
--- a/Makefile
+++ b/Makefile
@@ -3168,6 +3168,11 @@ GIT-BUILD-OPTIONS: FORCE
-e "s|@GIT_INTEROP_MAKE_OPTS@|\'$(GIT_INTEROP_MAKE_OPTS)\'|" \
-e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \
-e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \
+ -e "s|@GIT_TEST_TEXTDOMAINDIR@|\'$(shell pwd)/po/build/locale\'|" \
+ -e "s|@GIT_TEST_POPATH@|\'$(shell pwd)/po\'|" \
+ -e "s|@GIT_TEST_TEMPLATE_DIR@|\'$(shell pwd)/templates/blt\'|" \
+ -e "s|@GIT_TEST_GITPERLLIB@|\'$(shell pwd)/perl/build/lib\'|" \
+ -e "s|@GIT_TEST_MERGE_TOOLS_DIR@|\'$(shell pwd)/mergetools\'|" \
-e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX)\'|" \
GIT-BUILD-OPTIONS.in >$@+
@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
@@ -3192,6 +3197,10 @@ all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PR
bin-wrappers/%: bin-wrappers/wrap-for-bin.sh
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@BUILD_DIR@|$(shell pwd)|' \
+ -e 's|@GIT_TEXTDOMAINDIR@|$(shell pwd)/po/build/locale|' \
+ -e 's|@GITPERLLIB@|$(shell pwd)/perl/build/lib|' \
+ -e 's|@MERGE_TOOLS_DIR@|$(shell pwd)/mergetools|' \
+ -e 's|@TEMPLATE_DIR@|$(shell pwd)/templates/blt|' \
-e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
chmod +x $@
diff --git a/bin-wrappers/wrap-for-bin.sh b/bin-wrappers/wrap-for-bin.sh
index 7898a1c238..1d3a59a008 100755
--- a/bin-wrappers/wrap-for-bin.sh
+++ b/bin-wrappers/wrap-for-bin.sh
@@ -4,21 +4,22 @@
# to run test suite against sandbox, but with only bindir-installed
# executables in PATH. The Makefile copies this into various
# files in bin-wrappers, substituting
-# @BUILD_DIR@ and @PROG@.
+# @BUILD_DIR@, @TEMPLATE_DIR@ and @PROG@.
GIT_EXEC_PATH='@BUILD_DIR@'
if test -n "$NO_SET_GIT_TEMPLATE_DIR"
then
unset GIT_TEMPLATE_DIR
else
- GIT_TEMPLATE_DIR='@BUILD_DIR@/templates/blt'
+ GIT_TEMPLATE_DIR='@TEMPLATE_DIR@'
export GIT_TEMPLATE_DIR
fi
-GITPERLLIB='@BUILD_DIR@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}"
-GIT_TEXTDOMAINDIR='@BUILD_DIR@/po/build/locale'
+MERGE_TOOLS_DIR='@MERGE_TOOLS_DIR@'
+GITPERLLIB='@GITPERLLIB@'"${GITPERLLIB:+:$GITPERLLIB}"
+GIT_TEXTDOMAINDIR='@GIT_TEXTDOMAINDIR@'
PATH='@BUILD_DIR@/bin-wrappers:'"$PATH"
-export GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
+export MERGE_TOOLS_DIR GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
case "$GIT_DEBUGGER" in
'')
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 23c2fb91ce..4048d3c367 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -1087,6 +1087,9 @@ endforeach()
file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+string(REPLACE "@GIT_TEXTDOMAINDIR@" "${CMAKE_BINARY_DIR}/po/build/locale" content "${content}")
+string(REPLACE "@GITPERLLIB@" "${CMAKE_BINARY_DIR}/perl/build/lib" content "${content}")
+string(REPLACE "@MERGE_TOOLS_DIR@" "${CMAKE_SOURCE_DIR}/mergetools" content "${content}")
string(REPLACE "@PROG@" "git-cvsserver" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})
@@ -1165,6 +1168,11 @@ string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_optio
string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}")
string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}")
string(REPLACE "@RUNTIME_PREFIX@" "${RUNTIME_PREFIX}" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_TEXTDOMAINDIR@" "${CMAKE_BINARY_DIR}/po/build/locale" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_POPATH@" "${CMAKE_BINARY_DIR}/po" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_TEMPLATE_DIR@" "${CMAKE_BINARY_DIR}/templates/blt" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_GITPERLLIB@" "${CMAKE_BINARY_DIR}/perl/build/lib" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_MERGE_TOOLS_DIR@" "${RUNTIME_PREFIX}" git_build_options "${git_build_options}")
if(USE_VCPKG)
string(APPEND git_build_options "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
endif()
diff --git a/t/lib-gettext.sh b/t/lib-gettext.sh
index cc6bb2cdea..7a734c6973 100644
--- a/t/lib-gettext.sh
+++ b/t/lib-gettext.sh
@@ -6,8 +6,8 @@
. ./test-lib.sh
-GIT_TEXTDOMAINDIR="$GIT_BUILD_DIR/po/build/locale"
-GIT_PO_PATH="$GIT_BUILD_DIR/po"
+GIT_TEXTDOMAINDIR="$GIT_TEST_TEXTDOMAINDIR"
+GIT_PO_PATH="$GIT_TEST_POPATH"
export GIT_TEXTDOMAINDIR GIT_PO_PATH
if test -n "$GIT_TEST_INSTALLED"
diff --git a/t/t7609-mergetool--lib.sh b/t/t7609-mergetool--lib.sh
index 8b1c3bd39f..a9273ba58d 100755
--- a/t/t7609-mergetool--lib.sh
+++ b/t/t7609-mergetool--lib.sh
@@ -8,7 +8,7 @@ TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'mergetool --tool=vimdiff creates the expected layout' '
- . "$GIT_BUILD_DIR"/mergetools/vimdiff &&
+ . "$GIT_TEST_MERGE_TOOLS_DIR"/vimdiff &&
run_unit_tests
'
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 3fab470f3b..e36a21ddf7 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1504,7 +1504,7 @@ else # normal case, use ../bin-wrappers only unless $with_dashes:
PATH="$GIT_BUILD_DIR:$GIT_BUILD_DIR/t/helper:$PATH"
fi
fi
-GIT_TEMPLATE_DIR="$GIT_BUILD_DIR"/templates/blt
+GIT_TEMPLATE_DIR="$GIT_TEST_TEMPLATE_DIR"
GIT_CONFIG_NOSYSTEM=1
GIT_ATTR_NOSYSTEM=1
GIT_CEILING_DIRECTORIES="$TRASH_DIRECTORY/.."
@@ -1520,9 +1520,9 @@ then
fi
fi
-GITPERLLIB="$GIT_BUILD_DIR"/perl/build/lib
+GITPERLLIB="$GIT_TEST_GITPERLLIB"
export GITPERLLIB
-test -d "$GIT_BUILD_DIR"/templates/blt || {
+test -d "$GIT_TEMPLATE_DIR" || {
BAIL_OUT "You haven't built things yet, have you?"
}
--
2.47.0.rc0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH 20/21] t: allow overriding build dir
2024-10-02 15:15 [RFC PATCH 00/21] Modernize the build system Patrick Steinhardt
` (18 preceding siblings ...)
2024-10-02 15:16 ` [RFC PATCH 19/21] t: better support for out-of-tree builds Patrick Steinhardt
@ 2024-10-02 15:16 ` Patrick Steinhardt
2024-10-08 14:04 ` Phillip Wood
2024-10-02 15:16 ` [RFC PATCH 21/21] Introduce support for the Meson build system Patrick Steinhardt
` (11 subsequent siblings)
31 siblings, 1 reply; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-02 15:16 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz
Our "test-lib.sh" assumes that our build directory is the parent
directory of "t/". While true when using our Makefile, it's not when
using build systems that support out-of-tree builds.
Allow such build systems to override the location of the build directory
with an environment variable.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
t/test-lib.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index e36a21ddf7..6f862621af 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -35,7 +35,7 @@ else
# needing to exist.
TEST_DIRECTORY=$(cd "$TEST_DIRECTORY" && pwd) || exit 1
fi
-GIT_BUILD_DIR="${TEST_DIRECTORY%/t}"
+GIT_BUILD_DIR="${GIT_BUILD_DIR:-${TEST_DIRECTORY%/t}}"
if test "$TEST_DIRECTORY" = "$GIT_BUILD_DIR"
then
echo "PANIC: Running in a $TEST_DIRECTORY that doesn't end in '/t'?" >&2
@@ -514,6 +514,7 @@ unset VISUAL EMAIL LANGUAGE $("$PERL_PATH" -e '
PERF_
CURL_VERBOSE
TRACE_CURL
+ BUILD_DIR
));
my @vars = grep(/^GIT_/ && !/^GIT_($ok)/o, @env);
print join("\n", @vars);
--
2.47.0.rc0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH 21/21] Introduce support for the Meson build system
2024-10-02 15:15 [RFC PATCH 00/21] Modernize the build system Patrick Steinhardt
` (19 preceding siblings ...)
2024-10-02 15:16 ` [RFC PATCH 20/21] t: allow overriding build dir Patrick Steinhardt
@ 2024-10-02 15:16 ` Patrick Steinhardt
2024-10-08 14:11 ` [RFC PATCH 00/21] Modernize the " Phillip Wood
` (10 subsequent siblings)
31 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-02 15:16 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz
Introduce support for the Meson build system, a "modern" meta build
system that supports many different plaforms, 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 is likely to 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 fordebugging.
$ meson test 't0000-*' --interactive --test-args=-ix
```
The build instructions have been successfully tested on the following
systems. Tests are mostly passing:
- Apple macOS 10.15.
- FreeBSD 14.1, except gitweb-based tests.
- NixOS 24.11.
- Ubuntu 24.04.
- Windows 10 with Cygwin, using `-Dperl=disabled -Dpython=disabled`,
except for t0052, t0301, t5500, t5572, t5601.
- Windows 10 with MinGW64, using `-Dperl=disabled -Dpython=disabled`,
except for t7300.
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 usecase for
those anymore. By not installing those symlinks we thus start the
deprecation of this layout.
- Support for installing documentation has not been wired up yet. This
will follow if the project can agree on Meson as build system.
- Support for Microsoft Visual Studio has not yet been tested, mostly
because I have been fighting with the Windows-based systems for a
long while already. This will follow if the project can agree on
Meson as build system
- Documentation does not yet exist. Same here, it will follow if the
project can agree on Meson.
- We're targeting a relatively-recent Meson 1.3.0, which has been
released 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 3000 lines, half of which
is listing all of our code and test files. Our Makefiles are around
5000 lines of, autoconf adds another 1300 lines. CMake in comparison
has only 1200 lines of code, but it avoids listing individual files
and does not wire up auto-configuration as extensively as the Meson
files do.
- I didn't yet port the workaround for the `gettext` package in
Homebrew being key-only over. Users have to manually add CFLAGS and
LDFLAGS for that library to work around this issue with Homebrew.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
bin-wrappers/meson.build | 28 +
contrib/completion/meson.build | 8 +
contrib/meson.build | 1 +
gitweb/meson.build | 32 +
gitweb/static/meson.build | 28 +
meson.build | 1567 ++++++++++++++++++++++++++++
meson_options.txt | 67 ++
perl/FromCPAN/Mail/meson.build | 7 +
perl/FromCPAN/meson.build | 9 +
perl/Git/LoadCPAN/Mail/meson.build | 7 +
perl/Git/LoadCPAN/meson.build | 9 +
perl/Git/SVN/Memoize/meson.build | 7 +
perl/Git/SVN/meson.build | 20 +
perl/Git/meson.build | 18 +
perl/meson.build | 18 +
po/meson.build | 28 +
t/helper/meson.build | 91 ++
t/meson.build | 1107 ++++++++++++++++++++
templates/hooks/meson.build | 24 +
templates/info/meson.build | 5 +
templates/meson.build | 8 +
21 files changed, 3089 insertions(+)
create mode 100644 bin-wrappers/meson.build
create mode 100644 contrib/completion/meson.build
create mode 100644 contrib/meson.build
create mode 100644 gitweb/meson.build
create mode 100644 gitweb/static/meson.build
create mode 100644 meson.build
create mode 100644 meson_options.txt
create mode 100644 perl/FromCPAN/Mail/meson.build
create mode 100644 perl/FromCPAN/meson.build
create mode 100644 perl/Git/LoadCPAN/Mail/meson.build
create mode 100644 perl/Git/LoadCPAN/meson.build
create mode 100644 perl/Git/SVN/Memoize/meson.build
create mode 100644 perl/Git/SVN/meson.build
create mode 100644 perl/Git/meson.build
create mode 100644 perl/meson.build
create mode 100644 po/meson.build
create mode 100644 t/helper/meson.build
create mode 100644 t/meson.build
create mode 100644 templates/hooks/meson.build
create mode 100644 templates/info/meson.build
create mode 100644 templates/meson.build
diff --git a/bin-wrappers/meson.build b/bin-wrappers/meson.build
new file mode 100644
index 0000000000..6d03a19d7b
--- /dev/null
+++ b/bin-wrappers/meson.build
@@ -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', fs.relative_to(executable.full_path(), meson.project_build_root()))
+
+ configure_file(
+ input: 'wrap-for-bin.sh',
+ output: fs.stem(executable.full_path()),
+ configuration: executable_config,
+ )
+endforeach
diff --git a/contrib/completion/meson.build b/contrib/completion/meson.build
new file mode 100644
index 0000000000..a9bfe2da31
--- /dev/null
+++ b/contrib/completion/meson.build
@@ -0,0 +1,8 @@
+foreach script : [
+ 'git-completion.bash',
+ 'git-completion.tcsh',
+ 'git-completion.zsh',
+ 'git-prompt.sh'
+]
+ test_dependencies += fs.copyfile(script)
+endforeach
diff --git a/contrib/meson.build b/contrib/meson.build
new file mode 100644
index 0000000000..a7b77b87c2
--- /dev/null
+++ b/contrib/meson.build
@@ -0,0 +1 @@
+subdir('completion')
diff --git a/gitweb/meson.build b/gitweb/meson.build
new file mode 100644
index 0000000000..f9c3a76647
--- /dev/null
+++ b/gitweb/meson.build
@@ -0,0 +1,32 @@
+configure_file(
+ input: 'gitweb.perl',
+ output: 'gitweb.cgi',
+ configuration: {
+ 'GIT_VERSION': meson.project_version(),
+ 'GIT_BINDIR': get_option('prefix') / get_option('bindir'),
+ 'GITWEB_CONFIG': get_option('gitweb_config'),
+ 'GITWEB_CONFIG_SYSTEM': get_option('gitweb_config_system'),
+ 'GITWEB_CONFIG_COMMON': get_option('gitweb_config_common'),
+ 'GITWEB_HOME_LINK_STR': get_option('gitweb_home_link_str'),
+ 'GITWEB_SITENAME': get_option('gitweb_sitename'),
+ 'GITWEB_PROJECTROOT': get_option('gitweb_projectroot'),
+ 'GITWEB_PROJECT_MAXDEPTH': get_option('gitweb_project_maxdepth'),
+ 'GITWEB_EXPORT_OK': get_option('gitweb_export_ok'),
+ 'GITWEB_STRICT_EXPORT': get_option('gitweb_strict_export'),
+ 'GITWEB_BASE_URL': get_option('gitweb_base_url'),
+ 'GITWEB_LIST': get_option('gitweb_list'),
+ 'GITWEB_HOMETEXT': get_option('gitweb_hometext'),
+ 'GITWEB_CSS': get_option('gitweb_css'),
+ 'GITWEB_LOGO': get_option('gitweb_logo'),
+ 'GITWEB_FAVICON': get_option('gitweb_favicon'),
+ 'GITWEB_JS': get_option('gitweb_js'),
+ 'GITWEB_SITE_HTML_HEAD_STRING': get_option('gitweb_site_html_head_string'),
+ 'GITWEB_SITE_HEADER': get_option('gitweb_site_header'),
+ 'GITWEB_SITE_FOOTER': get_option('gitweb_site_footer'),
+ 'HIGHLIGHT_BIN': get_option('highlight_bin'),
+ },
+ install: true,
+ install_dir: get_option('datadir') / 'gitweb',
+)
+
+subdir('static')
diff --git a/gitweb/static/meson.build b/gitweb/static/meson.build
new file mode 100644
index 0000000000..1bdbe70d2d
--- /dev/null
+++ b/gitweb/static/meson.build
@@ -0,0 +1,28 @@
+foreach asset : [
+ 'git-favicon.png',
+ 'git-logo.png',
+ 'gitweb.css',
+]
+ fs.copyfile(asset,
+ install: true,
+ install_dir: get_option('datadir') / 'gitweb/static',
+ )
+endforeach
+
+javascript_sources = [
+ meson.current_source_dir() / 'js/adjust-timezone.js',
+ meson.current_source_dir() / 'js/blame_incremental.js',
+ meson.current_source_dir() / 'js/javascript-detection.js',
+ meson.current_source_dir() / 'js/lib/common-lib.js',
+ meson.current_source_dir() / 'js/lib/cookies.js',
+ meson.current_source_dir() / 'js/lib/datetime.js',
+]
+
+custom_target(
+ input: javascript_sources,
+ output: 'gitweb.js',
+ capture: true,
+ command: ['cat'] + javascript_sources,
+ install: true,
+ install_dir: get_option('datadir') / 'gitweb/static',
+)
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000000..b6f875daba
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,1567 @@
+project('git', 'c',
+ version: run_command('GIT-VERSION-GEN', check: true).stdout().strip(),
+ meson_version: '>=1.3.0',
+)
+
+fs = import('fs')
+
+compiler = meson.get_compiler('c')
+
+cygpath = find_program('cygpath', required: false)
+shell = find_program('sh')
+tar = find_program('tar')
+diff = find_program('diff')
+
+libgit_sources = [
+ 'abspath.c',
+ 'add-interactive.c',
+ 'add-patch.c',
+ 'advice.c',
+ 'alias.c',
+ 'alloc.c',
+ 'apply.c',
+ 'archive-tar.c',
+ 'archive-zip.c',
+ 'archive.c',
+ 'attr.c',
+ 'base85.c',
+ 'bisect.c',
+ 'blame.c',
+ 'blob.c',
+ 'bloom.c',
+ 'branch.c',
+ 'bulk-checkin.c',
+ 'bundle-uri.c',
+ 'bundle.c',
+ 'cache-tree.c',
+ 'cbtree.c',
+ 'chdir-notify.c',
+ 'checkout.c',
+ 'chunk-format.c',
+ 'color.c',
+ 'column.c',
+ 'combine-diff.c',
+ 'commit-graph.c',
+ 'commit-reach.c',
+ 'commit.c',
+ 'compat/nonblock.c',
+ 'compat/obstack.c',
+ 'compat/terminal.c',
+ 'compat/zlib-uncompress2.c',
+ 'config.c',
+ 'connect.c',
+ 'connected.c',
+ 'convert.c',
+ 'copy.c',
+ 'credential.c',
+ 'csum-file.c',
+ 'ctype.c',
+ 'date.c',
+ 'decorate.c',
+ 'delta-islands.c',
+ 'diagnose.c',
+ 'diff-delta.c',
+ 'diff-merges.c',
+ 'diff-lib.c',
+ 'diff-no-index.c',
+ 'diff.c',
+ 'diffcore-break.c',
+ 'diffcore-delta.c',
+ 'diffcore-order.c',
+ 'diffcore-pickaxe.c',
+ 'diffcore-rename.c',
+ 'diffcore-rotate.c',
+ 'dir-iterator.c',
+ 'dir.c',
+ 'editor.c',
+ 'entry.c',
+ 'environment.c',
+ 'ewah/bitmap.c',
+ 'ewah/ewah_bitmap.c',
+ 'ewah/ewah_io.c',
+ 'ewah/ewah_rlw.c',
+ 'exec-cmd.c',
+ 'fetch-negotiator.c',
+ 'fetch-pack.c',
+ 'fmt-merge-msg.c',
+ 'fsck.c',
+ 'fsmonitor.c',
+ 'fsmonitor-ipc.c',
+ 'fsmonitor-settings.c',
+ 'gettext.c',
+ 'git-zlib.c',
+ 'gpg-interface.c',
+ 'graph.c',
+ 'grep.c',
+ 'hash-lookup.c',
+ 'hashmap.c',
+ 'help.c',
+ 'hex.c',
+ 'hex-ll.c',
+ 'hook.c',
+ 'ident.c',
+ 'json-writer.c',
+ 'kwset.c',
+ 'levenshtein.c',
+ 'line-log.c',
+ 'line-range.c',
+ 'linear-assignment.c',
+ 'list-objects-filter-options.c',
+ 'list-objects-filter.c',
+ 'list-objects.c',
+ 'lockfile.c',
+ 'log-tree.c',
+ 'loose.c',
+ 'ls-refs.c',
+ 'mailinfo.c',
+ 'mailmap.c',
+ 'match-trees.c',
+ 'mem-pool.c',
+ 'merge-blobs.c',
+ 'merge-ll.c',
+ 'merge-ort.c',
+ 'merge-ort-wrappers.c',
+ 'merge-recursive.c',
+ 'merge.c',
+ 'midx.c',
+ 'midx-write.c',
+ 'name-hash.c',
+ 'negotiator/default.c',
+ 'negotiator/noop.c',
+ 'negotiator/skipping.c',
+ 'notes-cache.c',
+ 'notes-merge.c',
+ 'notes-utils.c',
+ 'notes.c',
+ 'object-file-convert.c',
+ 'object-file.c',
+ 'object-name.c',
+ 'object.c',
+ 'oid-array.c',
+ 'oidmap.c',
+ 'oidset.c',
+ 'oidtree.c',
+ 'pack-bitmap-write.c',
+ 'pack-bitmap.c',
+ 'pack-check.c',
+ 'pack-mtimes.c',
+ 'pack-objects.c',
+ 'pack-revindex.c',
+ 'pack-write.c',
+ 'packfile.c',
+ 'pager.c',
+ 'parallel-checkout.c',
+ 'parse.c',
+ 'parse-options-cb.c',
+ 'parse-options.c',
+ 'patch-delta.c',
+ 'patch-ids.c',
+ 'path.c',
+ 'pathspec.c',
+ 'pkt-line.c',
+ 'preload-index.c',
+ 'pretty.c',
+ 'prio-queue.c',
+ 'progress.c',
+ 'promisor-remote.c',
+ 'prompt.c',
+ 'protocol.c',
+ 'protocol-caps.c',
+ 'prune-packed.c',
+ 'pseudo-merge.c',
+ 'quote.c',
+ 'range-diff.c',
+ 'reachable.c',
+ 'read-cache.c',
+ 'rebase-interactive.c',
+ 'rebase.c',
+ 'ref-filter.c',
+ 'reflog-walk.c',
+ 'reflog.c',
+ 'refs.c',
+ 'refs/debug.c',
+ 'refs/files-backend.c',
+ 'refs/reftable-backend.c',
+ 'refs/iterator.c',
+ 'refs/packed-backend.c',
+ 'refs/ref-cache.c',
+ 'refspec.c',
+ 'reftable/basics.c',
+ 'reftable/error.c',
+ 'reftable/block.c',
+ 'reftable/blocksource.c',
+ 'reftable/iter.c',
+ 'reftable/publicbasics.c',
+ 'reftable/merged.c',
+ 'reftable/pq.c',
+ 'reftable/reader.c',
+ 'reftable/record.c',
+ 'reftable/stack.c',
+ 'reftable/tree.c',
+ 'reftable/writer.c',
+ 'remote.c',
+ 'replace-object.c',
+ 'repo-settings.c',
+ 'repository.c',
+ 'rerere.c',
+ 'reset.c',
+ 'resolve-undo.c',
+ 'revision.c',
+ 'run-command.c',
+ 'send-pack.c',
+ 'sequencer.c',
+ 'serve.c',
+ 'server-info.c',
+ 'setup.c',
+ 'shallow.c',
+ 'sideband.c',
+ 'sigchain.c',
+ 'sparse-index.c',
+ 'split-index.c',
+ 'stable-qsort.c',
+ 'statinfo.c',
+ 'strbuf.c',
+ 'streaming.c',
+ 'string-list.c',
+ 'strmap.c',
+ 'strvec.c',
+ 'sub-process.c',
+ 'submodule-config.c',
+ 'submodule.c',
+ 'symlinks.c',
+ 'tag.c',
+ 'tempfile.c',
+ 'thread-utils.c',
+ 'tmp-objdir.c',
+ 'trace.c',
+ 'trace2.c',
+ 'trace2/tr2_cfg.c',
+ 'trace2/tr2_cmd_name.c',
+ 'trace2/tr2_ctr.c',
+ 'trace2/tr2_dst.c',
+ 'trace2/tr2_sid.c',
+ 'trace2/tr2_sysenv.c',
+ 'trace2/tr2_tbuf.c',
+ 'trace2/tr2_tgt_event.c',
+ 'trace2/tr2_tgt_normal.c',
+ 'trace2/tr2_tgt_perf.c',
+ 'trace2/tr2_tls.c',
+ 'trace2/tr2_tmr.c',
+ 'trailer.c',
+ 'transport-helper.c',
+ 'transport.c',
+ 'tree-diff.c',
+ 'tree-walk.c',
+ 'tree.c',
+ 'unpack-trees.c',
+ 'upload-pack.c',
+ 'url.c',
+ 'urlmatch.c',
+ 'usage.c',
+ 'userdiff.c',
+ 'utf8.c',
+ 'varint.c',
+ 'versioncmp.c',
+ 'walker.c',
+ 'wildmatch.c',
+ 'worktree.c',
+ 'wrapper.c',
+ 'write-or-die.c',
+ 'ws.c',
+ 'wt-status.c',
+ 'xdiff-interface.c',
+ 'xdiff/xdiffi.c',
+ 'xdiff/xemit.c',
+ 'xdiff/xhistogram.c',
+ 'xdiff/xmerge.c',
+ 'xdiff/xpatience.c',
+ 'xdiff/xprepare.c',
+ 'xdiff/xutils.c',
+]
+
+builtin_sources = [
+ 'builtin/add.c',
+ 'builtin/am.c',
+ 'builtin/annotate.c',
+ 'builtin/apply.c',
+ 'builtin/archive.c',
+ 'builtin/bisect.c',
+ 'builtin/blame.c',
+ 'builtin/branch.c',
+ 'builtin/bugreport.c',
+ 'builtin/bundle.c',
+ 'builtin/cat-file.c',
+ 'builtin/check-attr.c',
+ 'builtin/check-ignore.c',
+ 'builtin/check-mailmap.c',
+ 'builtin/check-ref-format.c',
+ 'builtin/checkout--worker.c',
+ 'builtin/checkout-index.c',
+ 'builtin/checkout.c',
+ 'builtin/clean.c',
+ 'builtin/clone.c',
+ 'builtin/column.c',
+ 'builtin/commit-graph.c',
+ 'builtin/commit-tree.c',
+ 'builtin/commit.c',
+ 'builtin/config.c',
+ 'builtin/count-objects.c',
+ 'builtin/credential-cache--daemon.c',
+ 'builtin/credential-cache.c',
+ 'builtin/credential-store.c',
+ 'builtin/credential.c',
+ 'builtin/describe.c',
+ 'builtin/diagnose.c',
+ 'builtin/diff-files.c',
+ 'builtin/diff-index.c',
+ 'builtin/diff-tree.c',
+ 'builtin/diff.c',
+ 'builtin/difftool.c',
+ 'builtin/fast-export.c',
+ 'builtin/fast-import.c',
+ 'builtin/fetch-pack.c',
+ 'builtin/fetch.c',
+ 'builtin/fmt-merge-msg.c',
+ 'builtin/for-each-ref.c',
+ 'builtin/for-each-repo.c',
+ 'builtin/fsck.c',
+ 'builtin/fsmonitor--daemon.c',
+ 'builtin/gc.c',
+ 'builtin/get-tar-commit-id.c',
+ 'builtin/grep.c',
+ 'builtin/hash-object.c',
+ 'builtin/help.c',
+ 'builtin/hook.c',
+ 'builtin/index-pack.c',
+ 'builtin/init-db.c',
+ 'builtin/interpret-trailers.c',
+ 'builtin/log.c',
+ 'builtin/ls-files.c',
+ 'builtin/ls-remote.c',
+ 'builtin/ls-tree.c',
+ 'builtin/mailinfo.c',
+ 'builtin/mailsplit.c',
+ 'builtin/merge-base.c',
+ 'builtin/merge-file.c',
+ 'builtin/merge-index.c',
+ 'builtin/merge-ours.c',
+ 'builtin/merge-recursive.c',
+ 'builtin/merge-tree.c',
+ 'builtin/merge.c',
+ 'builtin/mktag.c',
+ 'builtin/mktree.c',
+ 'builtin/multi-pack-index.c',
+ 'builtin/mv.c',
+ 'builtin/name-rev.c',
+ 'builtin/notes.c',
+ 'builtin/pack-objects.c',
+ 'builtin/pack-redundant.c',
+ 'builtin/pack-refs.c',
+ 'builtin/patch-id.c',
+ 'builtin/prune-packed.c',
+ 'builtin/prune.c',
+ 'builtin/pull.c',
+ 'builtin/push.c',
+ 'builtin/range-diff.c',
+ 'builtin/read-tree.c',
+ 'builtin/rebase.c',
+ 'builtin/receive-pack.c',
+ 'builtin/reflog.c',
+ 'builtin/refs.c',
+ 'builtin/remote-ext.c',
+ 'builtin/remote-fd.c',
+ 'builtin/remote.c',
+ 'builtin/repack.c',
+ 'builtin/replace.c',
+ 'builtin/replay.c',
+ 'builtin/rerere.c',
+ 'builtin/reset.c',
+ 'builtin/rev-list.c',
+ 'builtin/rev-parse.c',
+ 'builtin/revert.c',
+ 'builtin/rm.c',
+ 'builtin/send-pack.c',
+ 'builtin/shortlog.c',
+ 'builtin/show-branch.c',
+ 'builtin/show-index.c',
+ 'builtin/show-ref.c',
+ 'builtin/sparse-checkout.c',
+ 'builtin/stash.c',
+ 'builtin/stripspace.c',
+ 'builtin/submodule--helper.c',
+ 'builtin/symbolic-ref.c',
+ 'builtin/tag.c',
+ 'builtin/unpack-file.c',
+ 'builtin/unpack-objects.c',
+ 'builtin/update-index.c',
+ 'builtin/update-ref.c',
+ 'builtin/update-server-info.c',
+ 'builtin/upload-archive.c',
+ 'builtin/upload-pack.c',
+ 'builtin/var.c',
+ 'builtin/verify-commit.c',
+ 'builtin/verify-pack.c',
+ 'builtin/verify-tag.c',
+ 'builtin/worktree.c',
+ 'builtin/write-tree.c',
+]
+
+libgit_sources += custom_target(
+ 'command-list.h',
+ input: 'command-list.txt',
+ output: 'command-list.h',
+ command: [shell, meson.current_source_dir() + '/generate-cmdlist.sh', meson.current_source_dir(), '@OUTPUT@'],
+)
+
+libgit_sources += custom_target(
+ 'config-list.h',
+ output: 'config-list.h',
+ command: [
+ shell,
+ meson.current_source_dir() + '/generate-configlist.sh',
+ meson.current_source_dir(),
+ '@OUTPUT@',
+ ],
+)
+
+libgit_sources += custom_target(
+ 'hook-list.h',
+ input: 'Documentation/githooks.txt',
+ output: 'hook-list.h',
+ command: [
+ shell,
+ meson.current_source_dir() + '/generate-hooklist.sh',
+ meson.current_source_dir(),
+ '@OUTPUT@',
+ ],
+)
+
+# This contains the variables for GIT-BUILD-OPTIONS, which we use to propagate
+# build options to our tests.
+build_options_config = configuration_data()
+build_options_config.set('GIT_INTEROP_MAKE_OPTS', '')
+build_options_config.set('GIT_PERF_LARGE_REPO', '')
+build_options_config.set('GIT_PERF_MAKE_COMMAND', '')
+build_options_config.set('GIT_PERF_MAKE_OPTS', '')
+build_options_config.set('GIT_PERF_REPEAT_COUNT', '')
+build_options_config.set('GIT_PERF_REPO', '')
+build_options_config.set('GIT_TEST_CMP_USE_COPIED_CONTEXT', '')
+build_options_config.set('GIT_TEST_INDEX_VERSION', '')
+build_options_config.set('GIT_TEST_OPTS', '')
+build_options_config.set('GIT_TEST_PERL_FATAL_WARNINGS', '')
+build_options_config.set('GIT_TEST_UTF8_LOCALE', '')
+build_options_config.set('SANITIZE_ADDRESS', '')
+build_options_config.set('SANITIZE_LEAK', '')
+
+test_output_directory = get_option('test_output_directory')
+if test_output_directory == ''
+ test_output_directory = meson.project_build_root() / 'test-output'
+endif
+
+# These variables are used for building libgit.a.
+libgit_c_args = [
+ '-DBINDIR="' + get_option('bindir') + '"',
+ '-DDEFAULT_EDITOR="' + get_option('default_editor') + '"',
+ '-DDEFAULT_GIT_TEMPLATE_DIR="' + get_option('datadir') / 'git-core/templates' + '"',
+ '-DDEFAULT_HELP_FORMAT="' + get_option('default_help_format') + '"',
+ '-DDEFAULT_PAGER="' + get_option('default_pager') + '"',
+ '-DETC_GITATTRIBUTES="' + get_option('gitattributes') + '"',
+ '-DETC_GITCONFIG="' + get_option('gitconfig') + '"',
+ '-DFALLBACK_RUNTIME_PREFIX="' + get_option('prefix') + '"',
+ '-DGIT_EXEC_PATH="' + get_option('prefix') / get_option('libexecdir') / 'git-core"',
+ '-DGIT_HOST_CPU="' + host_machine.cpu_family() + '"',
+ '-DGIT_HTML_PATH="' + get_option('datadir') / 'doc/git-doc"',
+ '-DGIT_INFO_PATH="' + get_option('infodir') + '"',
+ '-DGIT_LOCALE_PATH="' + get_option('localedir') + '"',
+ '-DGIT_MAN_PATH="' + get_option('mandir') + '"',
+ '-DPAGER_ENV="' + get_option('pager_environment') + '"',
+ '-DSHELL_PATH="' + fs.as_posix(shell.full_path()) + '"',
+]
+libgit_include_directories = [ '.' ]
+libgit_dependencies = [ ]
+
+executable_suffix = ''
+if host_machine.system() == 'cygwin' or host_machine.system() == 'windows'
+ executable_suffix = '.exe'
+ libgit_c_args += '-DSTRIP_EXTENSION="' + executable_suffix + '"'
+endif
+build_options_config.set_quoted('X', executable_suffix)
+
+python = import('python').find_installation('python3', required: get_option('python'))
+if python.found()
+ build_options_config.set('NO_PYTHON', '')
+else
+ libgit_c_args += '-DNO_PYTHON'
+ build_options_config.set('NO_PYTHON', '1')
+endif
+
+# Perl is used for two different things: our test harness and to provide some
+# features. It is optional if you want to neither execute tests nor use any of
+# these optional features.
+perl_required = get_option('perl')
+if get_option('tests')
+ perl_required = true
+endif
+
+# Note that we only set NO_PERL if the Perl features were disabled by the user.
+# It may not be set when we have found Perl, but only use it to run tests.
+perl = find_program('perl', version: '>=5.8.1', required: perl_required)
+perl_features_enabled = perl.found() and get_option('perl').allowed()
+if perl_features_enabled
+ build_options_config.set('NO_PERL', '')
+else
+ libgit_c_args += '-DNO_PERL'
+ build_options_config.set('NO_PERL', '1')
+endif
+
+zlib = dependency('zlib')
+libgit_dependencies += zlib
+if not compiler.has_function('deflateBound',
+ prefix: '#include <zlib.h>',
+ dependencies: zlib,
+)
+ libgit_c_args += '-DNO_DEFLATE_BOUND'
+endif
+
+threads = dependency('threads', required: false)
+if threads.found()
+ libgit_dependencies += threads
+ build_options_config.set('NO_PTHREADS', '')
+else
+ libgit_c_args += '-DNO_PTHREADS'
+ build_options_config.set('NO_PTHREADS', '1')
+endif
+
+intl = dependency('intl', required: get_option('gettext'))
+if intl.found()
+ libgit_dependencies += intl
+ build_options_config.set('NO_GETTEXT', '')
+else
+ libgit_c_args += '-DNO_GETTEXT'
+ build_options_config.set('NO_GETTEXT', '1')
+endif
+
+iconv = dependency('iconv', required: get_option('iconv'))
+if iconv.found()
+ libgit_dependencies += iconv
+
+ have_old_iconv = false
+ if not compiler.compiles('''
+ #include <iconv.h>
+
+ extern size_t iconv(iconv_t cd,
+ char **inbuf, size_t *inbytesleft,
+ char **outbuf, size_t *outbytesleft);
+ ''', name: 'old iconv interface', dependencies: [iconv])
+ libgit_c_args += '-DOLD_ICONV'
+ have_old_iconv = true
+ endif
+
+ iconv_omits_bom_source = '''#
+ #include <iconv.h>
+
+ int main(int argc, const char **argv)
+ {
+ '''
+ if have_old_iconv
+ iconv_omits_bom_source += '''
+ typedef const char *iconv_ibp;
+ '''
+ else
+ iconv_omits_bom_source += '''
+ typedef char *iconv_ibp;
+ '''
+ endif
+ iconv_omits_bom_source += '''
+ int v;
+ iconv_t conv;
+ char in[] = "a"; iconv_ibp pin = in;
+ char out[20] = ""; char *pout = out;
+ size_t isz = sizeof in;
+ size_t osz = sizeof out;
+
+ conv = iconv_open("UTF-16", "UTF-8");
+ iconv(conv, &pin, &isz, &pout, &osz);
+ iconv_close(conv);
+ v = (unsigned char)(out[0]) + (unsigned char)(out[1]);
+ return v != 0xfe + 0xff;
+ }
+ '''
+
+ if compiler.run(iconv_omits_bom_source,
+ dependencies: iconv,
+ name: 'iconv omits BOM',
+ ).returncode() != 0
+ libgit_c_args += '-DICONV_OMITS_BOM'
+ endif
+else
+ libgit_c_args += '-DNO_ICONV'
+endif
+
+pcre2 = dependency('libpcre2-8', required: get_option('pcre2'))
+if pcre2.found()
+ libgit_dependencies += pcre2
+ libgit_c_args += '-DUSE_LIBPCRE2'
+ build_options_config.set('USE_LIBPCRE2', '1')
+else
+ build_options_config.set('USE_LIBPCRE2', '')
+endif
+
+curl = dependency('libcurl', version: '>=7.21.3', required: get_option('curl'))
+use_curl_for_imap_send = false
+if curl.found()
+ if curl.version().version_compare('>=7.34.0')
+ libgit_c_args += '-DUSE_CURL_FOR_IMAP_SEND'
+ use_curl_for_imap_send = true
+ endif
+
+ libgit_dependencies += curl
+ libgit_c_args += '-DCURL_DISABLE_TYPECHECK'
+ build_options_config.set('NO_CURL', '')
+else
+ libgit_c_args += '-DNO_CURL'
+ build_options_config.set('NO_CURL', '1')
+endif
+
+expat = dependency('expat', required: get_option('expat'))
+if expat.found()
+ libgit_dependencies += expat
+
+ if expat.version().version_compare('<=1.2')
+ libgit_c_args += '-DEXPAT_NEEDS_XMLPARSE_H'
+ endif
+ build_options_config.set('NO_EXPAT', '')
+else
+ libgit_c_args += '-DNO_EXPAT'
+ build_options_config.set('NO_EXPAT', '1')
+endif
+
+if not compiler.has_header('sys/select.h')
+ libgit_c_args += '-DNO_SYS_SELECT_H'
+endif
+
+has_poll_h = compiler.has_header('poll.h')
+if not has_poll_h
+ libgit_c_args += '-DNO_POLL_H'
+endif
+
+has_sys_poll_h = compiler.has_header('sys/poll.h')
+if not has_sys_poll_h
+ libgit_c_args += '-DNO_SYS_POLL_H'
+endif
+
+if not has_poll_h and not has_sys_poll_h
+ libgit_c_args += '-DNO_POLL'
+ libgit_sources += 'compat/poll/poll.c'
+ libgit_include_directories += 'compat/poll'
+endif
+
+if not compiler.has_header('inttypes.h')
+ libgit_c_args += '-DNO_INTTYPES_H'
+endif
+
+if compiler.has_header('libcharset.h')
+ libcharset = compiler.find_library('charset')
+
+ if compiler.has_function('locale_charset',
+ prefix: '#include <libcharset.h>',
+ dependencies: iconv,
+ )
+ libgit_c_args += '-DHAVE_LIBCHARSET_H'
+ elif compiler.has_function('locale_charset',
+ prefix: '#include <libcharset.h>',
+ dependencies: libcharset,
+ )
+ libgit_c_args += '-DHAVE_LIBCHARSET_H'
+ endif
+endif
+
+if compiler.has_header('alloca.h')
+ libgit_c_args += '-DHAVE_ALLOCA_H'
+endif
+
+if compiler.has_header('sys/sysinfo.h')
+ libgit_c_args += '-DHAVE_SYSINFO'
+endif
+
+# Windows has libgen.h and a basename implementation, but we still need our own
+# implementation to threat things like drive prefixes specially.
+if host_machine.system() == 'windows' or not compiler.has_header('libgen.h')
+ libgit_c_args += '-DNO_LIBGEN_H'
+ libgit_sources += 'compat/basename.c'
+endif
+
+if compiler.has_header('paths.h')
+ libgit_c_args += '-DHAVE_PATHS_H'
+endif
+
+if compiler.has_header('strings.h')
+ libgit_c_args += '-DHAVE_STRINGS_H'
+endif
+
+networking_dependencies = [ ]
+winsock = compiler.find_library('ws2_32', required: false)
+if winsock.found()
+ networking_dependencies += winsock
+endif
+libresolv = compiler.find_library('resolv', required: false)
+if libresolv.found()
+ networking_dependencies += libresolv
+endif
+libgit_dependencies += networking_dependencies
+
+foreach symbol : ['inet_ntop', 'inet_pton', 'strerror']
+ if not compiler.has_function(symbol, dependencies: networking_dependencies)
+ libgit_c_args += '-DNO_' + symbol.to_upper()
+ endif
+endforeach
+
+has_ipv6 = compiler.has_function('getaddrinfo', dependencies: networking_dependencies)
+if not has_ipv6
+ libgit_c_args += '-DNO_IPV6'
+endif
+
+if not compiler.compiles('''
+ #ifdef _WIN32
+ # include <winsock2.h>
+ #else
+ # include <sys/types.h>
+ # include <sys/socket.h>
+ #endif
+
+ void func(void)
+ {
+ struct sockaddr_storage x;
+ }
+''', name: 'struct sockaddr_storage')
+ if has_ipv6
+ libgit_c_args += '-Dsockaddr_storage=sockaddr_in6'
+ else
+ libgit_c_args += '-Dsockaddr_storage=sockaddr_in'
+ endif
+endif
+
+if compiler.has_function('socket', dependencies: networking_dependencies)
+ libgit_sources += [
+ 'unix-socket.c',
+ 'unix-stream-server.c',
+ ]
+ build_options_config.set('NO_UNIX_SOCKETS', '')
+else
+ libgit_c_args += '-DNO_UNIX_SOCKETS'
+ build_options_config.set('NO_UNIX_SOCKETS', '1')
+endif
+
+if not compiler.has_function('pread')
+ libgit_c_args += '-DNO_PREAD'
+ libgit_sources += 'compat/pread.c'
+endif
+
+if host_machine.system() == 'darwin'
+ libgit_sources += 'compat/precompose_utf8.c'
+ libgit_c_args += '-DPRECOMPOSE_UNICODE'
+ libgit_c_args += '-DPROTECT_HFS_DEFAULT'
+endif
+
+# Configure general compatibility wrappers.
+if host_machine.system() == 'cygwin'
+ libgit_sources += [
+ 'compat/win32/path-utils.c',
+ ]
+elif host_machine.system() == 'windows'
+ libgit_sources += [
+ 'compat/mingw.c',
+ 'compat/winansi.c',
+ 'compat/win32/flush.c',
+ 'compat/win32/path-utils.c',
+ 'compat/win32/pthread.c',
+ 'compat/win32/syslog.c',
+ 'compat/win32/trace2_win32_process_info.c',
+ 'compat/win32/dirent.c',
+ 'compat/win32mmap.c',
+ 'compat/nedmalloc/nedmalloc.c',
+ ]
+
+ libgit_c_args += [
+ '-DDETECT_MSYS_TTY',
+ '-DENSURE_MSYSTEM_IS_SET',
+ '-DNATIVE_CRLF',
+ '-DNOGDI',
+ '-DNO_POSIX_GOODIES',
+ '-DWIN32',
+ '-D_CONSOLE',
+ '-D_CONSOLE_DETECT_MSYS_TTY',
+ '-D__USE_MINGW_ANSI_STDIO=0',
+ ]
+
+ libgit_dependencies += compiler.find_library('ntdll')
+ libgit_include_directories += 'compat/win32'
+endif
+
+if host_machine.system() == 'linux'
+ libgit_sources += 'compat/linux/procinfo.c'
+else
+ libgit_sources += 'compat/stub/procinfo.c'
+endif
+
+if host_machine.system() == 'cygwin' or host_machine.system() == 'windows'
+ libgit_c_args += [
+ '-DUNRELIABLE_FSTAT',
+ '-DMMAP_PREVENTS_DELETE',
+ '-DOBJECT_CREATION_MODE=1',
+ ]
+endif
+
+# Configure the simple-ipc subsystem required fro the fsmonitor.
+if host_machine.system() == 'windows'
+ libgit_sources += [
+ 'compat/simple-ipc/ipc-shared.c',
+ 'compat/simple-ipc/ipc-win32.c',
+ ]
+ libgit_c_args += '-DSUPPORTS_SIMPLE_IPC'
+else
+ libgit_sources += [
+ 'compat/simple-ipc/ipc-shared.c',
+ 'compat/simple-ipc/ipc-unix-socket.c',
+ ]
+ libgit_c_args += '-DSUPPORTS_SIMPLE_IPC'
+endif
+
+fsmonitor_backend = ''
+if host_machine.system() == 'windows'
+ fsmonitor_backend = 'win32'
+elif host_machine.system() == 'darwin'
+ fsmonitor_backend = 'darwin'
+ libgit_dependencies += dependency('CoreServices')
+endif
+if fsmonitor_backend != ''
+ libgit_c_args += '-DHAVE_FSMONITOR_DAEMON_BACKEND'
+ libgit_c_args += '-DHAVE_FSMONITOR_OS_SETTINGS'
+
+ libgit_sources += [
+ 'compat/fsmonitor/fsm-health-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-ipc-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-listen-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-path-utils-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-settings-' + fsmonitor_backend + '.c',
+ ]
+endif
+build_options_config.set_quoted('FSMONITOR_DAEMON_BACKEND', fsmonitor_backend)
+build_options_config.set_quoted('FSMONITOR_OS_SETTINGS', fsmonitor_backend)
+
+if compiler.get_define('REG_STARTEND', prefix: '#include <regex.h>') != ''
+ build_options_config.set('NO_REGEX', '')
+else
+ libgit_c_args += [
+ '-DNO_REGEX',
+ '-DGAWK',
+ '-DNO_MBSUPPORT',
+ ]
+ build_options_config.set('NO_REGEX', '1')
+ libgit_sources += 'compat/regex/regex.c'
+ libgit_include_directories += 'compat/regex'
+endif
+if compiler.get_define('REG_ENHANCED', prefix: '#include <regex.h>') != ''
+ libgit_c_args += '-DUSE_ENHANCED_BASIC_REGULAR_EXPRESSIONS'
+ libgit_sources += 'compat/regcomp_enhanced.c'
+endif
+
+# setitimer and friends are provided by compat/mingw.c.
+if host_machine.system() != 'windows'
+ if not compiler.compiles('''
+ #include <sys/time.h>
+ void func(void)
+ {
+ struct itimerval value;
+ }
+ ''', name: 'struct itimerval')
+ libgit_c_args += '-DNO_STRUCT_ITIMERVAL'
+ libgit_c_args += '-DNO_SETITIMER'
+ elif not compiler.has_function('setitimer')
+ libgit_c_args += '-DNO_SETITIMER'
+ endif
+endif
+
+if compiler.has_member('struct stat', 'st_mtimespec.tv_nsec', prefix: '#include <sys/stat.h>')
+ libgit_c_args += '-DUSE_ST_TIMESPEC'
+elif not compiler.has_member('struct stat', 'st_mtim.tv_nsec', prefix: '#include <sys/stat.h>')
+ libgit_c_args += '-DNO_NSEC'
+endif
+
+if not compiler.has_member('struct stat', 'st_blocks', prefix: '#include <sys/stat.h>')
+ libgit_c_args += '-DNO_ST_BLOCKS_IN_STRUCT_STAT'
+endif
+
+if not compiler.has_member('struct dirent', 'd_type', prefix: '#include <dirent.h>')
+ libgit_c_args += '-DNO_D_TYPE_IN_DIRENT'
+endif
+
+if not compiler.has_member('struct passwd', 'pw_gecos', prefix: '#include <pwd.h>')
+ libgit_c_args += '-DNO_GECOS_IN_PWENT'
+endif
+
+if compiler.has_function('sync_file_range')
+ libgit_c_args += '-DHAVE_SYNC_FILE_RANGE'
+endif
+
+if not compiler.has_function('strcasestr')
+ libgit_c_args += '-DNO_STRCASESTR'
+ libgit_sources += 'compat/strcasestr.c'
+endif
+
+if not compiler.has_function('memmem')
+ libgit_c_args += '-DNO_MEMMEM'
+ libgit_sources += 'compat/memmem.c'
+endif
+
+if not compiler.has_function('strlcpy')
+ libgit_c_args += '-DNO_STRLCPY'
+ libgit_sources += 'compat/strlcpy.c'
+endif
+
+if not compiler.has_function('strdup')
+ libgit_c_args += '-DOVERRIDE_STRDUP'
+ libgit_sources += 'compat/strdup.c'
+endif
+
+if not compiler.has_function('strtoumax')
+ libgit_c_args += '-DNO_STRTOUMAX'
+ libgit_sources += [
+ 'compat/strtoumax.c',
+ 'compat/strtoimax.c',
+ ]
+endif
+
+if not compiler.has_function('strtoull')
+ libgit_c_args += '-DNO_STRTOULL'
+endif
+
+if not compiler.has_function('setenv')
+ libgit_c_args += '-DNO_SETENV'
+ libgit_sources += 'compat/setenv.c'
+endif
+
+if not compiler.has_function('qsort')
+ libgit_c_args += '-DINTERNAL_QSORT'
+endif
+libgit_sources += 'compat/qsort_s.c'
+
+# unsetenv is provided by compat/mingw.c.
+if host_machine.system() != 'windows' and not compiler.has_function('unsetenv')
+ libgit_c_args += '-DNO_UNSETENV'
+ libgit_sources += 'compat/unsetenv.c'
+endif
+
+if not compiler.has_function('mkdtemp')
+ libgit_c_args += '-DNO_MKDTEMP'
+ libgit_sources += 'compat/mkdtemp.c'
+endif
+
+if not compiler.has_function('initgroups')
+ libgit_c_args += '-DNO_INITGROUPS'
+endif
+
+if compiler.has_function('getdelim')
+ libgit_c_args += '-DHAVE_GETDELIM'
+endif
+
+if host_machine.system() == 'windows'
+ libgit_c_args += '-DUSE_WIN32_MMAP'
+elif not compiler.has_function('mmap')
+ libgit_c_args += '-DNO_MMAP'
+ libgit_sources += 'compat/mmap.c'
+endif
+
+if compiler.has_function('clock_gettime')
+ libgit_c_args += '-DHAVE_CLOCK_GETTIME'
+endif
+
+if compiler.compiles('''
+ #include <time.h>
+
+ void func(void)
+ {
+ clockid_t id = CLOCK_MONOTONIC;
+ }
+''', name: 'monotonic clock')
+ libgit_c_args += '-DHAVE_CLOCK_MONOTONIC'
+endif
+
+if compiler.compiles('''
+ #include <inttypes.h>
+
+ void func(void)
+ {
+ uintmax_t x = 0;
+ }
+''', name: 'uintmax_t')
+ libgit_c_args += '-DNO_UINTMAX_T'
+endif
+
+has_bsd_sysctl = false
+if compiler.has_header('sys/sysctl.h')
+ if compiler.compiles('''
+ #include <stddef.h>
+ #include <sys/sysctl.h>
+
+ void func(void)
+ {
+ int val, mib[2] = { 0 };
+ size_t len = sizeof(val);
+ sysctl(mib, 2, &val, &len, NULL, 0);
+ }
+ ''', name: 'BSD sysctl')
+ libgit_c_args += '-DHAVE_BSD_SYSCTL'
+ has_bsd_sysctl = true
+ endif
+endif
+
+if compiler.run('''
+ #include <stdio.h>
+
+ int main(int argc, const char **argv)
+ {
+ FILE *f = fopen(".", "r");
+ return f ? 0 : 1;
+ }
+''', name: 'fread reads directories').returncode() == 0
+ libgit_c_args += '-DFREAD_READS_DIRECTORIES'
+ libgit_sources += 'compat/fopen.c'
+endif
+
+if not meson.is_cross_build() and fs.exists('/dev/tty')
+ libgit_c_args += '-DHAVE_DEV_TTY'
+endif
+
+if get_option('openssl').enabled() and get_option('CommonCrypto').enabled()
+ error('Can only use one SSL backend')
+endif
+
+security_framework = dependency('Security', required: get_option('CommonCrypto').disable_auto_if(host_machine.system() != 'darwin'))
+core_foundation_framework = dependency('CoreFoundation', required: security_framework.found())
+if security_framework.found()
+ libgit_dependencies += security_framework
+ libgit_dependencies += core_foundation_framework
+ libgit_c_args += '-DAPPLE_COMMON_CRYPTO'
+endif
+
+# OpenSSL is required when requested via the 'openssl' feature or via one of
+# the SHA1/SHA256 backends.
+openssl_required = get_option('openssl').disable_auto_if(security_framework.found())
+if get_option('sha1_backend') == 'openssl' or get_option('sha256_backend') == 'openssl'
+ openssl_required = true
+endif
+
+openssl = dependency('openssl', required: openssl_required)
+if openssl.found()
+ libgit_dependencies += openssl
+endif
+
+# We may not want to use OpenSSL for anything but our SHA1/SHA256 backends, so
+# we cannot just set NO_OPENSSL based on whether or not the library was found.
+if not openssl.found() or get_option('openssl').disabled()
+ libgit_c_args += '-DNO_OPENSSL'
+endif
+
+sha1_backend = get_option('sha1_backend')
+if sha1_backend == 'sha1dc'
+ libgit_c_args += '-DSHA1_DC'
+ libgit_c_args += '-DSHA1DC_NO_STANDARD_INCLUDES=1'
+ libgit_c_args += '-DSHA1DC_INIT_SAFE_HASH_DEFAULT=0'
+ libgit_c_args += '-DSHA1DC_CUSTOM_INCLUDE_SHA1_C="git-compat-util.h"'
+ libgit_c_args += '-DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="git-compat-util.h"'
+
+ libgit_sources += [
+ 'sha1dc_git.c',
+ 'sha1dc/sha1.c',
+ 'sha1dc/ubc_check.c',
+ ]
+elif sha1_backend == 'common-crypto'
+ libgit_c_args += '-DCOMMON_DIGEST_FOR_OPENSSL'
+ libgit_c_args += '-DSHA1_APPLE'
+ libgit_c_args += '-DSHA1_MAX_BLOCK_SIZE=1024L*1024L*1024L'
+elif sha1_backend == 'openssl'
+ if not openssl.found()
+ openssl = dependency('openssl', required: true)
+ endif
+
+ libgit_c_args += '-DSHA1_OPENSSL'
+ # Apple CommonCrypto requires chunking
+elif sha1_backend == 'block'
+ libgit_c_args += '-DSHA1_BLK'
+ libgit_sources += 'block-sha1/sha1.c'
+else
+ error('Unhandled SHA1 backend ' + sha1_backend)
+endif
+
+sha256_backend = get_option('sha256_backend')
+if sha256_backend == 'openssl'
+ libgit_c_args += '-DSHA256_OPENSSL'
+elif sha256_backend == 'nettle'
+ nettle = dependency('nettle')
+ libgit_dependencies += nettle
+ libgit_c_args += '-DSHA256_NETTLE'
+elif sha256_backend == 'gcrypt'
+ gcrypt = dependency('gcrypt')
+ libgit_dependencies += gcrypt
+ libgit_c_args += '-DSHA256_GCRYPT'
+elif sha256_backend == 'block'
+ libgit_c_args += '-DSHA256_BLK'
+ libgit_sources += 'sha256/block/sha256.c'
+else
+ error('Unhandled SHA256 backend ' + sha256_backend)
+endif
+
+if compiler.has_header_symbol('stdlib.h', 'arc4random_buf')
+ libgit_c_args += '-DHAVE_ARC4RANDOM'
+elif compiler.has_header_symbol('bsd/stdlib.h', 'arc4random_buf')
+ libgit_c_args += '-DHAVE_ARC4RANDOM_BSD'
+elif compiler.has_function('getrandom', prefix: '#include <sys/random.h>')
+ libgit_c_args += '-DHAVE_GETRANDOM'
+elif compiler.has_function('getentropy', prefix: '#include <unistd.h>')
+ libgit_c_args += '-DHAVE_GETENTROPY'
+elif compiler.has_function('RtlGenRandom', prefix: '#include <windows.h>\n#include <ntsecapi.h>')
+ libgit_c_args += '-DHAVE_RTLGENRANDOM'
+elif openssl.found()
+ libgit_c_args += '-DHAVE_OPENSSL_CSPRNG'
+endif
+
+if get_option('runtime_prefix')
+ libgit_c_args += '-DRUNTIME_PREFIX'
+ build_options_config.set('RUNTIME_PREFIX', '1')
+
+ if compiler.has_header('mach-o/dyld.h')
+ libgit_c_args += '-DHAVE_NS_GET_EXECUTABLE_PATH'
+ endif
+
+ if has_bsd_sysctl and compiler.compiles('''
+ #include <sys/sysctl.h>
+
+ void func(void)
+ {
+ KERN_PROC_PATHNAME; KERN_PROC;
+ }
+ ''', name: 'BSD KERN_PROC_PATHNAME')
+ libgit_c_args += '-DHAVE_NS_GET_EXECUTABLE_PATH'
+ endif
+
+ if host_machine.system() == 'linux'
+ libgit_c_args += '-DPROCFS_EXECUTABLE_PATH="/proc/self/exe' + '"'
+ elif host_machine.system() == 'openbsd'
+ libgit_c_args += '-DPROCFS_EXECUTABLE_PATH="' + '/proc/curproc/file' + '"'
+ elif host_machine.system() == 'netbsd'
+ libgit_c_args += '-DPROCFS_EXECUTABLE_PATH="' + '/proc/curproc/exe' + '"'
+ endif
+
+ if host_machine.system() == 'windows' and compiler.compiles('''
+ #include <stdlib.h>
+
+ void func(void)
+ {
+ _wpgmptr;
+ }
+ ''', name: 'Win32 _wpgmptr')
+ libgit_c_args += '-DHAVE_WPGMPTR'
+ endif
+else
+ build_options_config.set('RUNTIME_PREFIX', '')
+endif
+
+foreach key, value : {
+ 'DIFF': diff.full_path(),
+ 'GIT_TEST_CMP': diff.full_path() + ' -u',
+ 'GIT_TEST_GITPERLLIB': meson.project_build_root() / 'perl',
+ 'GIT_TEST_MERGE_TOOLS_DIR': meson.project_source_root() / 'mergetools',
+ 'GIT_TEST_POPATH': meson.project_source_root() / 'po',
+ 'GIT_TEST_TEMPLATE_DIR': meson.project_build_root() / 'templates',
+ 'GIT_TEST_TEXTDOMAINDIR': meson.project_build_root() / 'po',
+ 'PAGER_ENV': get_option('pager_environment'),
+ 'PERL_PATH': perl.found() ? perl.full_path() : '',
+ 'PYTHON_PATH': python.found () ? python.full_path() : '',
+ 'SHELL_PATH': shell.full_path(),
+ 'TAR': tar.full_path(),
+ 'TEST_OUTPUT_DIRECTORY': test_output_directory,
+ 'TEST_SHELL_PATH': shell.full_path(),
+}
+ if value != '' and cygpath.found()
+ value = run_command(cygpath, value, check: true).stdout().strip()
+ endif
+ build_options_config.set_quoted(key, value)
+endforeach
+
+configure_file(
+ input: 'GIT-BUILD-OPTIONS.in',
+ output: 'GIT-BUILD-OPTIONS',
+ configuration: build_options_config,
+)
+
+# Build a separate library for "version.c" so that we do not have to rebuild
+# everything when the current Git commit changes. TODO: this only gets set up
+# at configuration time, so we do not notice version changes unless the build
+# instructions get regenerated. We should refactor the source file such that we
+# can substitute tags in the file via `vcs_tag()`.
+libgit_version_library = static_library('git-version',
+ sources: ['version.c'],
+ c_args: libgit_c_args + [
+ '-DGIT_VERSION="' + meson.project_version() + '"',
+ '-DGIT_USER_AGENT="' + 'git/' + meson.project_version() + '"',
+ '-DGIT_BUILT_FROM_COMMIT="' + run_command('git', 'rev-parse', '-q', '--verify', 'HEAD', check: false).stdout().strip() + '"',
+ ],
+ include_directories: libgit_include_directories,
+)
+
+libgit_library = static_library('git',
+ sources: libgit_sources,
+ c_args: libgit_c_args,
+ link_with: libgit_version_library,
+ include_directories: libgit_include_directories,
+)
+
+libgit = declare_dependency(
+ compile_args: libgit_c_args,
+ link_with: libgit_library,
+ dependencies: libgit_dependencies,
+ include_directories: libgit_include_directories,
+)
+
+common_main_sources = ['common-main.c']
+common_main_link_args = [ ]
+if host_machine.system() == 'windows'
+ # TODO: wire these up properly.
+ common_main_sources += import('windows').compile_resources('git.rc', args: [
+ '-DMAJOR=1',
+ '-DMINOR=1',
+ '-DMICRO=1',
+ '-DPATCHLEVEL=0',
+ '-DGIT_VERSION=\\\"' + meson.project_version() + '.GIT\\\"',
+ ])
+ if compiler.get_argument_syntax() == 'gcc'
+ common_main_link_args += [
+ '-municode',
+ '-Wl,-nxcompat',
+ '-Wl,-dynamicbase',
+ '-Wl,-pic-executable,-e,mainCRTStartup',
+ '-Wl,-subsystem,console',
+ ]
+ elif compiler.get_argument_syntax() == 'msvc'
+ common_main_link_args += [
+ '/NOLOGO',
+ '/ENTRY:wmainCRTStartup',
+ '/SUBSYSTEM:CONSOLE',
+ 'invalidcontinue.obj',
+ ]
+ else
+ error('Unsupported compiler ' + compiler.get_id())
+ endif
+endif
+common_main_library = static_library('common-main',
+ sources: common_main_sources,
+ c_args: libgit_c_args,
+ include_directories: libgit_include_directories,
+)
+common_main = declare_dependency(
+ link_with: common_main_library,
+ link_args: common_main_link_args,
+)
+
+bin_wrappers = [ ]
+test_dependencies = [ ]
+
+git = executable('git',
+ sources: builtin_sources + 'git.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+bin_wrappers += git
+
+test_dependencies += executable('git-daemon',
+ sources: 'daemon.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+test_dependencies += executable('git-sh-i18n--envsubst',
+ sources: 'sh-i18n--envsubst.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+bin_wrappers += executable('git-shell',
+ sources: 'shell.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+test_dependencies += executable('git-http-backend',
+ sources: 'http-backend.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+bin_wrappers += executable('scalar',
+ sources: 'scalar.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+if get_option('curl').enabled()
+ curl_sources = [
+ 'http.c',
+ 'http-walker.c',
+ ]
+
+ git_remote_http = executable('git-remote-http',
+ sources: curl_sources + 'remote-curl.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+ test_dependencies += git_remote_http
+
+ test_dependencies += executable('git-http-fetch',
+ sources: curl_sources + 'http-fetch.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+
+ if expat.found()
+ test_dependencies += executable('git-http-push',
+ sources: curl_sources + 'http-push.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+ endif
+
+ foreach alias : [ 'git-remote-https', 'git-remote-ftp', 'git-remote-ftps' ]
+ test_dependencies += executable(alias,
+ objects: git.extract_all_objects(recursive: false),
+ dependencies: [libgit, common_main],
+ )
+
+ install_symlink(alias + executable_suffix,
+ install_dir: get_option('libexecdir') / 'git-core',
+ pointing_to: 'git-remote-http',
+ )
+ endforeach
+endif
+
+imap_send_sources = ['imap-send.c']
+if use_curl_for_imap_send
+ imap_send_sources += curl_sources
+endif
+
+test_dependencies += executable('git-imap-send',
+ sources: imap_send_sources,
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+foreach alias : [ 'git-receive-pack', 'git-upload-archive', 'git-upload-pack' ]
+ bin_wrappers += executable(alias,
+ objects: git.extract_all_objects(recursive: false),
+ dependencies: [libgit, common_main],
+ )
+
+ install_symlink(alias + executable_suffix,
+ install_dir: get_option('libexecdir') / 'git-core',
+ pointing_to: 'git-remote-http',
+ )
+endforeach
+
+foreach symlink : [
+ 'git',
+ 'git-http-backend',
+ 'git-receive-pack',
+ 'git-shell',
+ 'git-upload-archive',
+ 'git-upload-pack',
+ 'scalar',
+]
+ install_symlink(symlink,
+ install_dir: get_option('bindir'),
+ pointing_to: fs.relative_to(get_option('libexecdir') / 'git-core' / symlink, get_option('bindir')),
+ )
+endforeach
+
+script_sh_config = configuration_data()
+script_sh_config.set('BROKEN_PATH_FIX', '')
+script_sh_config.set('DIFF', fs.as_posix(diff.full_path()))
+script_sh_config.set('PAGER_ENV', get_option('pager_environment'))
+script_sh_config.set('PERL_PATH', perl.found() ? fs.as_posix(perl.full_path()) : '')
+script_sh_config.set('SHELL_PATH', fs.as_posix(shell.full_path()))
+script_sh_config.set_quoted('LOCALEDIR', fs.as_posix(get_option('prefix') / get_option('localedir')))
+if intl.found()
+ script_sh_config.set('USE_GETTEXT_SCHEME', '')
+else
+ script_sh_config.set('USE_GETTEXT_SCHEME', 'fallthrough')
+endif
+script_sh_config.set('GITWEBDIR', fs.as_posix(get_option('prefix') / get_option('datadir') / 'gitweb'))
+
+scripts_sh = [
+ 'git-difftool--helper.sh',
+ 'git-filter-branch.sh',
+ 'git-merge-octopus.sh',
+ 'git-merge-one-file.sh',
+ 'git-merge-resolve.sh',
+ 'git-mergetool.sh',
+ 'git-quiltimport.sh',
+ 'git-request-pull.sh',
+ 'git-submodule.sh',
+ 'git-web--browse.sh',
+]
+
+if perl_features_enabled
+ scripts_sh += 'git-instaweb.sh'
+endif
+
+foreach script : scripts_sh
+ configure_file(
+ input: script,
+ output: fs.stem(script),
+ configuration: script_sh_config,
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+endforeach
+
+scripts_lib = [
+ 'git-mergetool--lib.sh',
+ 'git-sh-i18n.sh',
+ 'git-sh-setup.sh',
+]
+
+foreach script : scripts_lib
+ configure_file(
+ input: script,
+ output: fs.stem(script),
+ configuration: script_sh_config,
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+endforeach
+
+if perl_features_enabled
+ scripts_perl = [
+ 'git-archimport.perl',
+ 'git-cvsexportcommit.perl',
+ 'git-cvsimport.perl',
+ 'git-cvsserver.perl',
+ 'git-send-email.perl',
+ 'git-svn.perl',
+ ]
+
+ pathsep = ':'
+ if host_machine.system() == 'windows'
+ pathsep = ';'
+ endif
+
+ perl_header_template = 'perl/header_templates/fixed_prefix.template.pl'
+ if get_option('runtime_prefix')
+ perl_header_template = 'perl/header_templates/runtime_prefix.template.pl'
+ endif
+
+ perl_header = configure_file(
+ input: perl_header_template,
+ output: 'GIT-PERL-HEADER',
+ configuration: {
+ 'GITEXECDIR_REL': get_option('libexecdir') / 'git-core',
+ 'PERLLIBDIR_REL': get_option('datadir') / 'perl5',
+ 'LOCALEDIR_REL': get_option('datadir') / 'locale',
+ 'INSTLIBDIR': get_option('datadir') / 'perl5',
+ 'PATHSEP': pathsep,
+ },
+ )
+
+ foreach script : scripts_perl
+ generated_script = custom_target(script,
+ input: script,
+ output: fs.stem(script),
+ command: [
+ shell,
+ meson.project_source_root() / 'generate-perl.sh',
+ meson.project_version(),
+ perl_header,
+ perl.full_path(),
+ '@INPUT@',
+ '@OUTPUT@',
+ ],
+ install: true,
+ install_dir: get_option('datadir') / 'perl5',
+ )
+ test_dependencies += generated_script
+ if script == 'git-cvsserver.perl'
+ bin_wrappers += generated_script
+ endif
+ endforeach
+
+ subdir('perl')
+endif
+
+if python.found()
+ scripts_python = [
+ 'git-p4.py'
+ ]
+
+ foreach script : scripts_python
+ fs.copyfile(script, fs.stem(script),
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+ endforeach
+endif
+
+mergetools = [
+ 'mergetools/araxis',
+ 'mergetools/bc',
+ 'mergetools/codecompare',
+ 'mergetools/deltawalker',
+ 'mergetools/diffmerge',
+ 'mergetools/diffuse',
+ 'mergetools/ecmerge',
+ 'mergetools/emerge',
+ 'mergetools/examdiff',
+ 'mergetools/guiffy',
+ 'mergetools/gvimdiff',
+ 'mergetools/kdiff3',
+ 'mergetools/kompare',
+ 'mergetools/meld',
+ 'mergetools/nvimdiff',
+ 'mergetools/opendiff',
+ 'mergetools/p4merge',
+ 'mergetools/smerge',
+ 'mergetools/tkdiff',
+ 'mergetools/tortoisemerge',
+ 'mergetools/vimdiff',
+ 'mergetools/vscode',
+ 'mergetools/winmerge',
+ 'mergetools/xxdiff',
+]
+
+foreach mergetool : mergetools
+ install_data(mergetool, install_dir: get_option('libexecdir') / 'git-core' / 'mergetools')
+endforeach
+
+if intl.found()
+ subdir('po')
+endif
+subdir('contrib')
+subdir('gitweb')
+subdir('templates')
+
+# Everything but the bin-wrappers need to come before this target such that we
+# can properly set up test dependencies. The bin-wrappers themselves are set up
+# at configuration time, so these are fine.
+if get_option('tests')
+ subdir('t')
+endif
+
+subdir('bin-wrappers')
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000000..113863947f
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,67 @@
+option('default_help_format', type: 'combo', choices: ['man', 'html', 'info'], value: 'man',
+ description: 'Format of installed documentation.')
+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('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('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: 'enabled',
+ description: 'Build translation files.')
+option('iconv', type: 'feature', value: 'enabled',
+ 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: 'enabled',
+ description: 'Build tools written in Perl.')
+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('python', type: 'feature', value: 'enabled',
+ description: 'Build tools written in Python.')
+
+option('openssl', type: 'feature', value: 'auto',
+ description: 'Support access to HTTPS remotes. OpenSSL may still be pulled in if configured as SHA1 or SHA256 backend.')
+option('CommonCrypto', type: 'feature', value: 'auto',
+ description: 'Build tools written in Python.')
+
+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')
+
+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')
+
+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')
diff --git a/perl/FromCPAN/Mail/meson.build b/perl/FromCPAN/Mail/meson.build
new file mode 100644
index 0000000000..8cbd90ce18
--- /dev/null
+++ b/perl/FromCPAN/Mail/meson.build
@@ -0,0 +1,7 @@
+configure_file(
+ input: 'Address.pm',
+ output: 'Address.pm',
+ configuration: perl_config,
+ install: true,
+ install_dir: get_option('datadir') / 'perl5/FromCPAN/Mail',
+)
diff --git a/perl/FromCPAN/meson.build b/perl/FromCPAN/meson.build
new file mode 100644
index 0000000000..ff88b35c2c
--- /dev/null
+++ b/perl/FromCPAN/meson.build
@@ -0,0 +1,9 @@
+configure_file(
+ input: 'Error.pm',
+ output: 'Error.pm',
+ configuration: perl_config,
+ install: true,
+ install_dir: get_option('datadir') / 'perl5/FromCPAN',
+)
+
+subdir('Mail')
diff --git a/perl/Git/LoadCPAN/Mail/meson.build b/perl/Git/LoadCPAN/Mail/meson.build
new file mode 100644
index 0000000000..fbf324307b
--- /dev/null
+++ b/perl/Git/LoadCPAN/Mail/meson.build
@@ -0,0 +1,7 @@
+configure_file(
+ input: 'Address.pm',
+ output: 'Address.pm',
+ configuration: perl_config,
+ install: true,
+ install_dir: get_option('datadir') / 'perl5/Git/LoadCPAN/Mail',
+)
diff --git a/perl/Git/LoadCPAN/meson.build b/perl/Git/LoadCPAN/meson.build
new file mode 100644
index 0000000000..542e108225
--- /dev/null
+++ b/perl/Git/LoadCPAN/meson.build
@@ -0,0 +1,9 @@
+configure_file(
+ input: 'Error.pm',
+ output: 'Error.pm',
+ configuration: perl_config,
+ install: true,
+ install_dir: get_option('datadir') / 'perl5/Git/LoadCPAN',
+)
+
+subdir('Mail')
diff --git a/perl/Git/SVN/Memoize/meson.build b/perl/Git/SVN/Memoize/meson.build
new file mode 100644
index 0000000000..727375c833
--- /dev/null
+++ b/perl/Git/SVN/Memoize/meson.build
@@ -0,0 +1,7 @@
+configure_file(
+ input: 'YAML.pm',
+ output: 'YAML.pm',
+ configuration: perl_config,
+ install: true,
+ install_dir: get_option('datadir') / 'perl5/Git/SVN',
+)
diff --git a/perl/Git/SVN/meson.build b/perl/Git/SVN/meson.build
new file mode 100644
index 0000000000..eccc3f2263
--- /dev/null
+++ b/perl/Git/SVN/meson.build
@@ -0,0 +1,20 @@
+foreach source : [
+ 'Editor.pm',
+ 'Fetcher.pm',
+ 'GlobSpec.pm',
+ 'Log.pm',
+ 'Migration.pm',
+ 'Prompt.pm',
+ 'Ra.pm',
+ 'Utils.pm',
+]
+ configure_file(
+ input: source,
+ output: source,
+ configuration: perl_config,
+ install: true,
+ install_dir: get_option('datadir') / 'perl5/Git/SVN',
+ )
+endforeach
+
+subdir('Memoize')
diff --git a/perl/Git/meson.build b/perl/Git/meson.build
new file mode 100644
index 0000000000..97bd62290d
--- /dev/null
+++ b/perl/Git/meson.build
@@ -0,0 +1,18 @@
+foreach source : [
+ 'I18N.pm',
+ 'IndexInfo.pm',
+ 'LoadCPAN.pm',
+ 'Packet.pm',
+ 'SVN.pm',
+]
+ configure_file(
+ input: source,
+ output: source,
+ configuration: perl_config,
+ install: true,
+ install_dir: get_option('datadir') / 'perl5/Git',
+ )
+endforeach
+
+subdir('LoadCPAN')
+subdir('SVN')
diff --git a/perl/meson.build b/perl/meson.build
new file mode 100644
index 0000000000..0a7bf41d5b
--- /dev/null
+++ b/perl/meson.build
@@ -0,0 +1,18 @@
+perl_config = {
+ 'LOCALEDIR': get_option('prefix') / get_option('datadir') / 'locale',
+ 'NO_GETTEXT': iconv.found() ? '' : '1',
+ 'NO_PERL_CPAN_FALLBACKS': get_option('perl_cpan_fallback') ? '' : '1',
+}
+
+configure_file(
+ input: 'Git.pm',
+ output: 'Git.pm',
+ configuration: perl_config,
+ install: true,
+ install_dir: get_option('datadir') / 'perl5',
+)
+
+subdir('Git')
+if get_option('perl_cpan_fallback')
+ subdir('FromCPAN')
+endif
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000000..fb1b92eb0a
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1,28 @@
+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,
+ install_dir: get_option('datadir'),
+)
+test_dependencies += translations[0]
diff --git a/t/helper/meson.build b/t/helper/meson.build
new file mode 100644
index 0000000000..5e83884246
--- /dev/null
+++ b/t/helper/meson.build
@@ -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
diff --git a/t/meson.build b/t/meson.build
new file mode 100644
index 0000000000..c6eb1129f8
--- /dev/null
+++ b/t/meson.build
@@ -0,0 +1,1107 @@
+awk = find_program('awk')
+
+clar_test_suites = [
+ 'unit-tests/ctype.c',
+ 'unit-tests/strvec.c',
+]
+
+clar_sources = [
+ 'unit-tests/clar/clar.c',
+ 'unit-tests/unit-test.c',
+]
+
+clar_decls_h = custom_target('clar_decls_h',
+ input: clar_test_suites,
+ output: 'clar-decls.h',
+ command : [shell, meson.current_source_dir() + '/unit-tests/generate-clar-decls.sh', '@OUTPUT@', '@INPUT@'],
+)
+
+clar_suite = custom_target('clar_suite',
+ input: clar_decls_h,
+ output: 'clar.suite',
+ feed: true,
+ capture: true,
+ command : [awk, '-f', meson.current_source_dir() + '/unit-tests/clar-generate.awk'],
+)
+
+clar_generated_sources = [
+ clar_decls_h,
+ clar_suite,
+]
+
+clar_unit_tests = executable('unit-tests',
+ sources: clar_sources + clar_generated_sources + clar_test_suites,
+ dependencies: [libgit, common_main],
+)
+test('unit-tests', clar_unit_tests)
+
+unit_test_programs = [
+ 'unit-tests/t-example-decorate.c',
+ 'unit-tests/t-hash.c',
+ 'unit-tests/t-hashmap.c',
+ 'unit-tests/t-mem-pool.c',
+ 'unit-tests/t-oid-array.c',
+ 'unit-tests/t-oidmap.c',
+ 'unit-tests/t-oidtree.c',
+ 'unit-tests/t-prio-queue.c',
+ 'unit-tests/t-reftable-basics.c',
+ 'unit-tests/t-reftable-block.c',
+ 'unit-tests/t-reftable-merged.c',
+ 'unit-tests/t-reftable-pq.c',
+ 'unit-tests/t-reftable-readwrite.c',
+ 'unit-tests/t-reftable-record.c',
+ 'unit-tests/t-reftable-stack.c',
+ 'unit-tests/t-reftable-tree.c',
+ 'unit-tests/t-strbuf.c',
+ 'unit-tests/t-strcmp-offset.c',
+ 'unit-tests/t-trailer.c',
+ 'unit-tests/t-urlmatch-normalization.c',
+]
+
+foreach unit_test_program : unit_test_programs
+ unit_test_name = fs.stem(unit_test_program)
+ unit_test = executable(unit_test_name,
+ sources: [
+ 'unit-tests/test-lib.c',
+ 'unit-tests/lib-oid.c',
+ 'unit-tests/lib-reftable.c',
+ unit_test_program,
+ ],
+ dependencies: [libgit, common_main],
+ )
+ test(unit_test_name, unit_test,
+ workdir: meson.current_source_dir(),
+ )
+endforeach
+
+subdir('helper')
+
+integration_tests = [
+ 't0000-basic.sh',
+ 't0001-init.sh',
+ 't0002-gitfile.sh',
+ 't0003-attributes.sh',
+ 't0004-unwritable.sh',
+ 't0005-signals.sh',
+ 't0006-date.sh',
+ 't0007-git-var.sh',
+ 't0008-ignores.sh',
+ 't0010-racy-git.sh',
+ 't0012-help.sh',
+ 't0013-sha1dc.sh',
+ 't0014-alias.sh',
+ 't0017-env-helper.sh',
+ 't0018-advice.sh',
+ 't0019-json-writer.sh',
+ 't0020-crlf.sh',
+ 't0021-conversion.sh',
+ 't0022-crlf-rename.sh',
+ 't0023-crlf-am.sh',
+ 't0024-crlf-archive.sh',
+ 't0025-crlf-renormalize.sh',
+ 't0026-eol-config.sh',
+ 't0027-auto-crlf.sh',
+ 't0028-working-tree-encoding.sh',
+ 't0029-core-unsetenvvars.sh',
+ 't0030-stripspace.sh',
+ 't0033-safe-directory.sh',
+ 't0034-root-safe-directory.sh',
+ 't0035-safe-bare-repository.sh',
+ 't0040-parse-options.sh',
+ 't0041-usage.sh',
+ 't0050-filesystem.sh',
+ 't0051-windows-named-pipe.sh',
+ 't0052-simple-ipc.sh',
+ 't0055-beyond-symlinks.sh',
+ 't0056-git-C.sh',
+ 't0060-path-utils.sh',
+ 't0061-run-command.sh',
+ 't0062-revision-walking.sh',
+ 't0063-string-list.sh',
+ 't0066-dir-iterator.sh',
+ 't0067-parse_pathspec_file.sh',
+ 't0068-for-each-repo.sh',
+ 't0070-fundamental.sh',
+ 't0071-sort.sh',
+ 't0080-unit-test-output.sh',
+ 't0081-find-pack.sh',
+ 't0090-cache-tree.sh',
+ 't0091-bugreport.sh',
+ 't0092-diagnose.sh',
+ 't0095-bloom.sh',
+ 't0100-previous.sh',
+ 't0101-at-syntax.sh',
+ 't0200-gettext-basic.sh',
+ 't0201-gettext-fallbacks.sh',
+ 't0202-gettext-perl.sh',
+ 't0203-gettext-setlocale-sanity.sh',
+ 't0204-gettext-reencode-sanity.sh',
+ 't0210-trace2-normal.sh',
+ 't0211-trace2-perf.sh',
+ 't0212-trace2-event.sh',
+ 't0300-credentials.sh',
+ 't0301-credential-cache.sh',
+ 't0302-credential-store.sh',
+ 't0303-credential-external.sh',
+ 't0410-partial-clone.sh',
+ 't0411-clone-from-partial.sh',
+ 't0450-txt-doc-vs-help.sh',
+ 't0500-progress-display.sh',
+ 't0600-reffiles-backend.sh',
+ 't0601-reffiles-pack-refs.sh',
+ 't0602-reffiles-fsck.sh',
+ 't0610-reftable-basics.sh',
+ 't0611-reftable-httpd.sh',
+ 't0612-reftable-jgit-compatibility.sh',
+ 't0613-reftable-write-options.sh',
+ 't1000-read-tree-m-3way.sh',
+ 't1001-read-tree-m-2way.sh',
+ 't1002-read-tree-m-u-2way.sh',
+ 't1003-read-tree-prefix.sh',
+ 't1004-read-tree-m-u-wf.sh',
+ 't1005-read-tree-reset.sh',
+ 't1006-cat-file.sh',
+ 't1007-hash-object.sh',
+ 't1008-read-tree-overlay.sh',
+ 't1009-read-tree-new-index.sh',
+ 't1010-mktree.sh',
+ 't1011-read-tree-sparse-checkout.sh',
+ 't1012-read-tree-df.sh',
+ 't1013-read-tree-submodule.sh',
+ 't1014-read-tree-confusing.sh',
+ 't1015-read-index-unmerged.sh',
+ 't1016-compatObjectFormat.sh',
+ 't1020-subdirectory.sh',
+ 't1021-rerere-in-workdir.sh',
+ 't1022-read-tree-partial-clone.sh',
+ 't1050-large.sh',
+ 't1051-large-conversion.sh',
+ 't1060-object-corruption.sh',
+ 't1090-sparse-checkout-scope.sh',
+ 't1091-sparse-checkout-builtin.sh',
+ 't1092-sparse-checkout-compatibility.sh',
+ 't1100-commit-tree-options.sh',
+ 't1300-config.sh',
+ 't1301-shared-repo.sh',
+ 't1302-repo-version.sh',
+ 't1303-wacky-config.sh',
+ 't1304-default-acl.sh',
+ 't1305-config-include.sh',
+ 't1306-xdg-files.sh',
+ 't1307-config-blob.sh',
+ 't1308-config-set.sh',
+ 't1309-early-config.sh',
+ 't1310-config-default.sh',
+ 't1350-config-hooks-path.sh',
+ 't1400-update-ref.sh',
+ 't1401-symbolic-ref.sh',
+ 't1402-check-ref-format.sh',
+ 't1403-show-ref.sh',
+ 't1404-update-ref-errors.sh',
+ 't1405-main-ref-store.sh',
+ 't1406-submodule-ref-store.sh',
+ 't1407-worktree-ref-store.sh',
+ 't1408-packed-refs.sh',
+ 't1409-avoid-packing-refs.sh',
+ 't1410-reflog.sh',
+ 't1411-reflog-show.sh',
+ 't1412-reflog-loop.sh',
+ 't1413-reflog-detach.sh',
+ 't1414-reflog-walk.sh',
+ 't1415-worktree-refs.sh',
+ 't1416-ref-transaction-hooks.sh',
+ 't1417-reflog-updateref.sh',
+ 't1418-reflog-exists.sh',
+ 't1419-exclude-refs.sh',
+ 't1420-lost-found.sh',
+ 't1430-bad-ref-name.sh',
+ 't1450-fsck.sh',
+ 't1451-fsck-buffer.sh',
+ 't1460-refs-migrate.sh',
+ 't1500-rev-parse.sh',
+ 't1501-work-tree.sh',
+ 't1502-rev-parse-parseopt.sh',
+ 't1503-rev-parse-verify.sh',
+ 't1504-ceiling-dirs.sh',
+ 't1505-rev-parse-last.sh',
+ 't1506-rev-parse-diagnosis.sh',
+ 't1507-rev-parse-upstream.sh',
+ 't1508-at-combinations.sh',
+ 't1509-root-work-tree.sh',
+ 't1510-repo-setup.sh',
+ 't1511-rev-parse-caret.sh',
+ 't1512-rev-parse-disambiguation.sh',
+ 't1513-rev-parse-prefix.sh',
+ 't1514-rev-parse-push.sh',
+ 't1515-rev-parse-outside-repo.sh',
+ 't1517-outside-repo.sh',
+ 't1600-index.sh',
+ 't1601-index-bogus.sh',
+ 't1700-split-index.sh',
+ 't1701-racy-split-index.sh',
+ 't1800-hook.sh',
+ 't2000-conflict-when-checking-files-out.sh',
+ 't2002-checkout-cache-u.sh',
+ 't2003-checkout-cache-mkdir.sh',
+ 't2004-checkout-cache-temp.sh',
+ 't2005-checkout-index-symlinks.sh',
+ 't2006-checkout-index-basic.sh',
+ 't2007-checkout-symlink.sh',
+ 't2008-checkout-subdir.sh',
+ 't2009-checkout-statinfo.sh',
+ 't2010-checkout-ambiguous.sh',
+ 't2011-checkout-invalid-head.sh',
+ 't2012-checkout-last.sh',
+ 't2013-checkout-submodule.sh',
+ 't2014-checkout-switch.sh',
+ 't2015-checkout-unborn.sh',
+ 't2016-checkout-patch.sh',
+ 't2017-checkout-orphan.sh',
+ 't2018-checkout-branch.sh',
+ 't2019-checkout-ambiguous-ref.sh',
+ 't2020-checkout-detach.sh',
+ 't2021-checkout-overwrite.sh',
+ 't2022-checkout-paths.sh',
+ 't2023-checkout-m.sh',
+ 't2024-checkout-dwim.sh',
+ 't2025-checkout-no-overlay.sh',
+ 't2026-checkout-pathspec-file.sh',
+ 't2027-checkout-track.sh',
+ 't2030-unresolve-info.sh',
+ 't2050-git-dir-relative.sh',
+ 't2060-switch.sh',
+ 't2070-restore.sh',
+ 't2071-restore-patch.sh',
+ 't2072-restore-pathspec-file.sh',
+ 't2080-parallel-checkout-basics.sh',
+ 't2081-parallel-checkout-collisions.sh',
+ 't2082-parallel-checkout-attributes.sh',
+ 't2100-update-cache-badpath.sh',
+ 't2101-update-index-reupdate.sh',
+ 't2102-update-index-symlinks.sh',
+ 't2103-update-index-ignore-missing.sh',
+ 't2104-update-index-skip-worktree.sh',
+ 't2105-update-index-gitfile.sh',
+ 't2106-update-index-assume-unchanged.sh',
+ 't2107-update-index-basic.sh',
+ 't2108-update-index-refresh-racy.sh',
+ 't2200-add-update.sh',
+ 't2201-add-update-typechange.sh',
+ 't2202-add-addremove.sh',
+ 't2203-add-intent.sh',
+ 't2204-add-ignored.sh',
+ 't2205-add-worktree-config.sh',
+ 't2300-cd-to-toplevel.sh',
+ 't2400-worktree-add.sh',
+ 't2401-worktree-prune.sh',
+ 't2402-worktree-list.sh',
+ 't2403-worktree-move.sh',
+ 't2404-worktree-config.sh',
+ 't2405-worktree-submodule.sh',
+ 't2406-worktree-repair.sh',
+ 't2407-worktree-heads.sh',
+ 't2500-untracked-overwriting.sh',
+ 't2501-cwd-empty.sh',
+ 't3000-ls-files-others.sh',
+ 't3001-ls-files-others-exclude.sh',
+ 't3002-ls-files-dashpath.sh',
+ 't3003-ls-files-exclude.sh',
+ 't3004-ls-files-basic.sh',
+ 't3005-ls-files-relative.sh',
+ 't3006-ls-files-long.sh',
+ 't3007-ls-files-recurse-submodules.sh',
+ 't3008-ls-files-lazy-init-name-hash.sh',
+ 't3009-ls-files-others-nonsubmodule.sh',
+ 't3010-ls-files-killed-modified.sh',
+ 't3011-common-prefixes-and-directory-traversal.sh',
+ 't3012-ls-files-dedup.sh',
+ 't3013-ls-files-format.sh',
+ 't3020-ls-files-error-unmatch.sh',
+ 't3040-subprojects-basic.sh',
+ 't3050-subprojects-fetch.sh',
+ 't3060-ls-files-with-tree.sh',
+ 't3070-wildmatch.sh',
+ 't3100-ls-tree-restrict.sh',
+ 't3101-ls-tree-dirname.sh',
+ 't3102-ls-tree-wildcards.sh',
+ 't3103-ls-tree-misc.sh',
+ 't3104-ls-tree-format.sh',
+ 't3105-ls-tree-output.sh',
+ 't3200-branch.sh',
+ 't3201-branch-contains.sh',
+ 't3202-show-branch.sh',
+ 't3203-branch-output.sh',
+ 't3204-branch-name-interpretation.sh',
+ 't3205-branch-color.sh',
+ 't3206-range-diff.sh',
+ 't3207-branch-submodule.sh',
+ 't3211-peel-ref.sh',
+ 't3300-funny-names.sh',
+ 't3301-notes.sh',
+ 't3302-notes-index-expensive.sh',
+ 't3303-notes-subtrees.sh',
+ 't3304-notes-mixed.sh',
+ 't3305-notes-fanout.sh',
+ 't3306-notes-prune.sh',
+ 't3307-notes-man.sh',
+ 't3308-notes-merge.sh',
+ 't3309-notes-merge-auto-resolve.sh',
+ 't3310-notes-merge-manual-resolve.sh',
+ 't3311-notes-merge-fanout.sh',
+ 't3320-notes-merge-worktrees.sh',
+ 't3321-notes-stripspace.sh',
+ 't3400-rebase.sh',
+ 't3401-rebase-and-am-rename.sh',
+ 't3402-rebase-merge.sh',
+ 't3403-rebase-skip.sh',
+ 't3404-rebase-interactive.sh',
+ 't3405-rebase-malformed.sh',
+ 't3406-rebase-message.sh',
+ 't3407-rebase-abort.sh',
+ 't3408-rebase-multi-line.sh',
+ 't3409-rebase-environ.sh',
+ 't3412-rebase-root.sh',
+ 't3413-rebase-hook.sh',
+ 't3415-rebase-autosquash.sh',
+ 't3416-rebase-onto-threedots.sh',
+ 't3417-rebase-whitespace-fix.sh',
+ 't3418-rebase-continue.sh',
+ 't3419-rebase-patch-id.sh',
+ 't3420-rebase-autostash.sh',
+ 't3421-rebase-topology-linear.sh',
+ 't3422-rebase-incompatible-options.sh',
+ 't3423-rebase-reword.sh',
+ 't3424-rebase-empty.sh',
+ 't3425-rebase-topology-merges.sh',
+ 't3426-rebase-submodule.sh',
+ 't3427-rebase-subtree.sh',
+ 't3428-rebase-signoff.sh',
+ 't3429-rebase-edit-todo.sh',
+ 't3430-rebase-merges.sh',
+ 't3431-rebase-fork-point.sh',
+ 't3432-rebase-fast-forward.sh',
+ 't3433-rebase-across-mode-change.sh',
+ 't3434-rebase-i18n.sh',
+ 't3435-rebase-gpg-sign.sh',
+ 't3436-rebase-more-options.sh',
+ 't3437-rebase-fixup-options.sh',
+ 't3438-rebase-broken-files.sh',
+ 't3500-cherry.sh',
+ 't3501-revert-cherry-pick.sh',
+ 't3502-cherry-pick-merge.sh',
+ 't3503-cherry-pick-root.sh',
+ 't3504-cherry-pick-rerere.sh',
+ 't3505-cherry-pick-empty.sh',
+ 't3506-cherry-pick-ff.sh',
+ 't3507-cherry-pick-conflict.sh',
+ 't3508-cherry-pick-many-commits.sh',
+ 't3509-cherry-pick-merge-df.sh',
+ 't3510-cherry-pick-sequence.sh',
+ 't3511-cherry-pick-x.sh',
+ 't3512-cherry-pick-submodule.sh',
+ 't3513-revert-submodule.sh',
+ 't3514-cherry-pick-revert-gpg.sh',
+ 't3600-rm.sh',
+ 't3601-rm-pathspec-file.sh',
+ 't3602-rm-sparse-checkout.sh',
+ 't3650-replay-basics.sh',
+ 't3700-add.sh',
+ 't3701-add-interactive.sh',
+ 't3702-add-edit.sh',
+ 't3703-add-magic-pathspec.sh',
+ 't3704-add-pathspec-file.sh',
+ 't3705-add-sparse-checkout.sh',
+ 't3800-mktag.sh',
+ 't3900-i18n-commit.sh',
+ 't3901-i18n-patch.sh',
+ 't3902-quoted.sh',
+ 't3903-stash.sh',
+ 't3904-stash-patch.sh',
+ 't3905-stash-include-untracked.sh',
+ 't3906-stash-submodule.sh',
+ 't3907-stash-show-config.sh',
+ 't3908-stash-in-worktree.sh',
+ 't3909-stash-pathspec-file.sh',
+ 't3910-mac-os-precompose.sh',
+ 't3920-crlf-messages.sh',
+ 't4000-diff-format.sh',
+ 't4001-diff-rename.sh',
+ 't4002-diff-basic.sh',
+ 't4003-diff-rename-1.sh',
+ 't4004-diff-rename-symlink.sh',
+ 't4005-diff-rename-2.sh',
+ 't4006-diff-mode.sh',
+ 't4007-rename-3.sh',
+ 't4008-diff-break-rewrite.sh',
+ 't4009-diff-rename-4.sh',
+ 't4010-diff-pathspec.sh',
+ 't4011-diff-symlink.sh',
+ 't4012-diff-binary.sh',
+ 't4013-diff-various.sh',
+ 't4014-format-patch.sh',
+ 't4015-diff-whitespace.sh',
+ 't4016-diff-quote.sh',
+ 't4017-diff-retval.sh',
+ 't4018-diff-funcname.sh',
+ 't4019-diff-wserror.sh',
+ 't4020-diff-external.sh',
+ 't4021-format-patch-numbered.sh',
+ 't4022-diff-rewrite.sh',
+ 't4023-diff-rename-typechange.sh',
+ 't4024-diff-optimize-common.sh',
+ 't4025-hunk-header.sh',
+ 't4026-color.sh',
+ 't4027-diff-submodule.sh',
+ 't4028-format-patch-mime-headers.sh',
+ 't4029-diff-trailing-space.sh',
+ 't4030-diff-textconv.sh',
+ 't4031-diff-rewrite-binary.sh',
+ 't4032-diff-inter-hunk-context.sh',
+ 't4033-diff-patience.sh',
+ 't4034-diff-words.sh',
+ 't4035-diff-quiet.sh',
+ 't4036-format-patch-signer-mime.sh',
+ 't4037-diff-r-t-dirs.sh',
+ 't4038-diff-combined.sh',
+ 't4039-diff-assume-unchanged.sh',
+ 't4040-whitespace-status.sh',
+ 't4041-diff-submodule-option.sh',
+ 't4042-diff-textconv-caching.sh',
+ 't4043-diff-rename-binary.sh',
+ 't4044-diff-index-unique-abbrev.sh',
+ 't4045-diff-relative.sh',
+ 't4046-diff-unmerged.sh',
+ 't4047-diff-dirstat.sh',
+ 't4048-diff-combined-binary.sh',
+ 't4049-diff-stat-count.sh',
+ 't4050-diff-histogram.sh',
+ 't4051-diff-function-context.sh',
+ 't4052-stat-output.sh',
+ 't4053-diff-no-index.sh',
+ 't4054-diff-bogus-tree.sh',
+ 't4055-diff-context.sh',
+ 't4056-diff-order.sh',
+ 't4057-diff-combined-paths.sh',
+ 't4058-diff-duplicates.sh',
+ 't4059-diff-submodule-not-initialized.sh',
+ 't4060-diff-submodule-option-diff-format.sh',
+ 't4061-diff-indent.sh',
+ 't4062-diff-pickaxe.sh',
+ 't4063-diff-blobs.sh',
+ 't4064-diff-oidfind.sh',
+ 't4065-diff-anchored.sh',
+ 't4066-diff-emit-delay.sh',
+ 't4067-diff-partial-clone.sh',
+ 't4068-diff-symmetric-merge-base.sh',
+ 't4069-remerge-diff.sh',
+ 't4100-apply-stat.sh',
+ 't4101-apply-nonl.sh',
+ 't4102-apply-rename.sh',
+ 't4103-apply-binary.sh',
+ 't4104-apply-boundary.sh',
+ 't4105-apply-fuzz.sh',
+ 't4106-apply-stdin.sh',
+ 't4107-apply-ignore-whitespace.sh',
+ 't4108-apply-threeway.sh',
+ 't4109-apply-multifrag.sh',
+ 't4110-apply-scan.sh',
+ 't4111-apply-subdir.sh',
+ 't4112-apply-renames.sh',
+ 't4113-apply-ending.sh',
+ 't4114-apply-typechange.sh',
+ 't4115-apply-symlink.sh',
+ 't4116-apply-reverse.sh',
+ 't4117-apply-reject.sh',
+ 't4118-apply-empty-context.sh',
+ 't4119-apply-config.sh',
+ 't4120-apply-popt.sh',
+ 't4121-apply-diffs.sh',
+ 't4122-apply-symlink-inside.sh',
+ 't4123-apply-shrink.sh',
+ 't4124-apply-ws-rule.sh',
+ 't4125-apply-ws-fuzz.sh',
+ 't4126-apply-empty.sh',
+ 't4127-apply-same-fn.sh',
+ 't4128-apply-root.sh',
+ 't4129-apply-samemode.sh',
+ 't4130-apply-criss-cross-rename.sh',
+ 't4131-apply-fake-ancestor.sh',
+ 't4132-apply-removal.sh',
+ 't4133-apply-filenames.sh',
+ 't4134-apply-submodule.sh',
+ 't4135-apply-weird-filenames.sh',
+ 't4136-apply-check.sh',
+ 't4137-apply-submodule.sh',
+ 't4138-apply-ws-expansion.sh',
+ 't4139-apply-escape.sh',
+ 't4140-apply-ita.sh',
+ 't4141-apply-too-large.sh',
+ 't4150-am.sh',
+ 't4151-am-abort.sh',
+ 't4152-am-subjects.sh',
+ 't4153-am-resume-override-opts.sh',
+ 't4200-rerere.sh',
+ 't4201-shortlog.sh',
+ 't4202-log.sh',
+ 't4203-mailmap.sh',
+ 't4204-patch-id.sh',
+ 't4205-log-pretty-formats.sh',
+ 't4206-log-follow-harder-copies.sh',
+ 't4207-log-decoration-colors.sh',
+ 't4208-log-magic-pathspec.sh',
+ 't4209-log-pickaxe.sh',
+ 't4210-log-i18n.sh',
+ 't4211-line-log.sh',
+ 't4212-log-corrupt.sh',
+ 't4213-log-tabexpand.sh',
+ 't4214-log-graph-octopus.sh',
+ 't4215-log-skewed-merges.sh',
+ 't4216-log-bloom.sh',
+ 't4217-log-limit.sh',
+ 't4252-am-options.sh',
+ 't4253-am-keep-cr-dos.sh',
+ 't4254-am-corrupt.sh',
+ 't4255-am-submodule.sh',
+ 't4256-am-format-flowed.sh',
+ 't4257-am-interactive.sh',
+ 't4258-am-quoted-cr.sh',
+ 't4300-merge-tree.sh',
+ 't4301-merge-tree-write-tree.sh',
+ 't5000-tar-tree.sh',
+ 't5001-archive-attr.sh',
+ 't5002-archive-attr-pattern.sh',
+ 't5003-archive-zip.sh',
+ 't5004-archive-corner-cases.sh',
+ 't5100-mailinfo.sh',
+ 't5150-request-pull.sh',
+ 't5200-update-server-info.sh',
+ 't5300-pack-object.sh',
+ 't5301-sliding-window.sh',
+ 't5302-pack-index.sh',
+ 't5303-pack-corruption-resilience.sh',
+ 't5304-prune.sh',
+ 't5305-include-tag.sh',
+ 't5306-pack-nobase.sh',
+ 't5307-pack-missing-commit.sh',
+ 't5308-pack-detect-duplicates.sh',
+ 't5309-pack-delta-cycles.sh',
+ 't5310-pack-bitmaps.sh',
+ 't5311-pack-bitmaps-shallow.sh',
+ 't5312-prune-corruption.sh',
+ 't5313-pack-bounds-checks.sh',
+ 't5314-pack-cycle-detection.sh',
+ 't5315-pack-objects-compression.sh',
+ 't5316-pack-delta-depth.sh',
+ 't5317-pack-objects-filter-objects.sh',
+ 't5318-commit-graph.sh',
+ 't5319-multi-pack-index.sh',
+ 't5320-delta-islands.sh',
+ 't5321-pack-large-objects.sh',
+ 't5322-pack-objects-sparse.sh',
+ 't5323-pack-redundant.sh',
+ 't5324-split-commit-graph.sh',
+ 't5325-reverse-index.sh',
+ 't5326-multi-pack-bitmaps.sh',
+ 't5327-multi-pack-bitmaps-rev.sh',
+ 't5328-commit-graph-64bit-time.sh',
+ 't5329-pack-objects-cruft.sh',
+ 't5330-no-lazy-fetch-with-commit-graph.sh',
+ 't5331-pack-objects-stdin.sh',
+ 't5332-multi-pack-reuse.sh',
+ 't5333-pseudo-merge-bitmaps.sh',
+ 't5334-incremental-multi-pack-index.sh',
+ 't5351-unpack-large-objects.sh',
+ 't5400-send-pack.sh',
+ 't5401-update-hooks.sh',
+ 't5402-post-merge-hook.sh',
+ 't5403-post-checkout-hook.sh',
+ 't5404-tracking-branches.sh',
+ 't5405-send-pack-rewind.sh',
+ 't5406-remote-rejects.sh',
+ 't5407-post-rewrite-hook.sh',
+ 't5408-send-pack-stdin.sh',
+ 't5409-colorize-remote-messages.sh',
+ 't5410-receive-pack-alternates.sh',
+ 't5411-proc-receive-hook.sh',
+ 't5500-fetch-pack.sh',
+ 't5501-fetch-push-alternates.sh',
+ 't5502-quickfetch.sh',
+ 't5503-tagfollow.sh',
+ 't5504-fetch-receive-strict.sh',
+ 't5505-remote.sh',
+ 't5506-remote-groups.sh',
+ 't5507-remote-environment.sh',
+ 't5509-fetch-push-namespaces.sh',
+ 't5510-fetch.sh',
+ 't5511-refspec.sh',
+ 't5512-ls-remote.sh',
+ 't5513-fetch-track.sh',
+ 't5514-fetch-multiple.sh',
+ 't5515-fetch-merge-logic.sh',
+ 't5516-fetch-push.sh',
+ 't5517-push-mirror.sh',
+ 't5518-fetch-exit-status.sh',
+ 't5519-push-alternates.sh',
+ 't5520-pull.sh',
+ 't5521-pull-options.sh',
+ 't5522-pull-symlink.sh',
+ 't5523-push-upstream.sh',
+ 't5524-pull-msg.sh',
+ 't5525-fetch-tagopt.sh',
+ 't5526-fetch-submodules.sh',
+ 't5527-fetch-odd-refs.sh',
+ 't5528-push-default.sh',
+ 't5529-push-errors.sh',
+ 't5530-upload-pack-error.sh',
+ 't5531-deep-submodule-push.sh',
+ 't5532-fetch-proxy.sh',
+ 't5533-push-cas.sh',
+ 't5534-push-signed.sh',
+ 't5535-fetch-push-symref.sh',
+ 't5536-fetch-conflicts.sh',
+ 't5537-fetch-shallow.sh',
+ 't5538-push-shallow.sh',
+ 't5539-fetch-http-shallow.sh',
+ 't5540-http-push-webdav.sh',
+ 't5541-http-push-smart.sh',
+ 't5542-push-http-shallow.sh',
+ 't5543-atomic-push.sh',
+ 't5544-pack-objects-hook.sh',
+ 't5545-push-options.sh',
+ 't5546-receive-limits.sh',
+ 't5547-push-quarantine.sh',
+ 't5548-push-porcelain.sh',
+ 't5549-fetch-push-http.sh',
+ 't5550-http-fetch-dumb.sh',
+ 't5551-http-fetch-smart.sh',
+ 't5552-skipping-fetch-negotiator.sh',
+ 't5553-set-upstream.sh',
+ 't5554-noop-fetch-negotiator.sh',
+ 't5555-http-smart-common.sh',
+ 't5557-http-get.sh',
+ 't5558-clone-bundle-uri.sh',
+ 't5559-http-fetch-smart-http2.sh',
+ 't5560-http-backend-noserver.sh',
+ 't5561-http-backend.sh',
+ 't5562-http-backend-content-length.sh',
+ 't5563-simple-http-auth.sh',
+ 't5564-http-proxy.sh',
+ 't5570-git-daemon.sh',
+ 't5571-pre-push-hook.sh',
+ 't5572-pull-submodule.sh',
+ 't5573-pull-verify-signatures.sh',
+ 't5574-fetch-output.sh',
+ 't5580-unc-paths.sh',
+ 't5581-http-curl-verbose.sh',
+ 't5582-fetch-negative-refspec.sh',
+ 't5583-push-branches.sh',
+ 't5600-clone-fail-cleanup.sh',
+ 't5601-clone.sh',
+ 't5602-clone-remote-exec.sh',
+ 't5603-clone-dirname.sh',
+ 't5604-clone-reference.sh',
+ 't5605-clone-local.sh',
+ 't5606-clone-options.sh',
+ 't5607-clone-bundle.sh',
+ 't5608-clone-2gb.sh',
+ 't5609-clone-branch.sh',
+ 't5610-clone-detached.sh',
+ 't5611-clone-config.sh',
+ 't5612-clone-refspec.sh',
+ 't5613-info-alternate.sh',
+ 't5614-clone-submodules-shallow.sh',
+ 't5615-alternate-env.sh',
+ 't5616-partial-clone.sh',
+ 't5617-clone-submodules-remote.sh',
+ 't5618-alternate-refs.sh',
+ 't5619-clone-local-ambiguous-transport.sh',
+ 't5700-protocol-v1.sh',
+ 't5701-git-serve.sh',
+ 't5702-protocol-v2.sh',
+ 't5703-upload-pack-ref-in-want.sh',
+ 't5704-protocol-violations.sh',
+ 't5705-session-id-in-capabilities.sh',
+ 't5730-protocol-v2-bundle-uri-file.sh',
+ 't5731-protocol-v2-bundle-uri-git.sh',
+ 't5732-protocol-v2-bundle-uri-http.sh',
+ 't5750-bundle-uri-parse.sh',
+ 't5801-remote-helpers.sh',
+ 't5802-connect-helper.sh',
+ 't5810-proto-disable-local.sh',
+ 't5811-proto-disable-git.sh',
+ 't5812-proto-disable-http.sh',
+ 't5813-proto-disable-ssh.sh',
+ 't5814-proto-disable-ext.sh',
+ 't5815-submodule-protos.sh',
+ 't5900-repo-selection.sh',
+ 't6000-rev-list-misc.sh',
+ 't6001-rev-list-graft.sh',
+ 't6002-rev-list-bisect.sh',
+ 't6003-rev-list-topo-order.sh',
+ 't6004-rev-list-path-optim.sh',
+ 't6005-rev-list-count.sh',
+ 't6006-rev-list-format.sh',
+ 't6007-rev-list-cherry-pick-file.sh',
+ 't6008-rev-list-submodule.sh',
+ 't6009-rev-list-parent.sh',
+ 't6010-merge-base.sh',
+ 't6011-rev-list-with-bad-commit.sh',
+ 't6012-rev-list-simplify.sh',
+ 't6013-rev-list-reverse-parents.sh',
+ 't6014-rev-list-all.sh',
+ 't6016-rev-list-graph-simplify-history.sh',
+ 't6017-rev-list-stdin.sh',
+ 't6018-rev-list-glob.sh',
+ 't6019-rev-list-ancestry-path.sh',
+ 't6020-bundle-misc.sh',
+ 't6021-rev-list-exclude-hidden.sh',
+ 't6022-rev-list-missing.sh',
+ 't6030-bisect-porcelain.sh',
+ 't6040-tracking-info.sh',
+ 't6041-bisect-submodule.sh',
+ 't6050-replace.sh',
+ 't6060-merge-index.sh',
+ 't6100-rev-list-in-order.sh',
+ 't6101-rev-parse-parents.sh',
+ 't6102-rev-list-unexpected-objects.sh',
+ 't6110-rev-list-sparse.sh',
+ 't6111-rev-list-treesame.sh',
+ 't6112-rev-list-filters-objects.sh',
+ 't6113-rev-list-bitmap-filters.sh',
+ 't6114-keep-packs.sh',
+ 't6115-rev-list-du.sh',
+ 't6120-describe.sh',
+ 't6130-pathspec-noglob.sh',
+ 't6131-pathspec-icase.sh',
+ 't6132-pathspec-exclude.sh',
+ 't6133-pathspec-rev-dwim.sh',
+ 't6134-pathspec-in-submodule.sh',
+ 't6135-pathspec-with-attrs.sh',
+ 't6136-pathspec-in-bare.sh',
+ 't6200-fmt-merge-msg.sh',
+ 't6300-for-each-ref.sh',
+ 't6301-for-each-ref-errors.sh',
+ 't6302-for-each-ref-filter.sh',
+ 't6400-merge-df.sh',
+ 't6401-merge-criss-cross.sh',
+ 't6402-merge-rename.sh',
+ 't6403-merge-file.sh',
+ 't6404-recursive-merge.sh',
+ 't6405-merge-symlinks.sh',
+ 't6406-merge-attr.sh',
+ 't6407-merge-binary.sh',
+ 't6408-merge-up-to-date.sh',
+ 't6409-merge-subtree.sh',
+ 't6411-merge-filemode.sh',
+ 't6412-merge-large-rename.sh',
+ 't6413-merge-crlf.sh',
+ 't6414-merge-rename-nocruft.sh',
+ 't6415-merge-dir-to-symlink.sh',
+ 't6416-recursive-corner-cases.sh',
+ 't6417-merge-ours-theirs.sh',
+ 't6418-merge-text-auto.sh',
+ 't6419-merge-ignorecase.sh',
+ 't6421-merge-partial-clone.sh',
+ 't6422-merge-rename-corner-cases.sh',
+ 't6423-merge-rename-directories.sh',
+ 't6424-merge-unrelated-index-changes.sh',
+ 't6425-merge-rename-delete.sh',
+ 't6426-merge-skip-unneeded-updates.sh',
+ 't6427-diff3-conflict-markers.sh',
+ 't6428-merge-conflicts-sparse.sh',
+ 't6429-merge-sequence-rename-caching.sh',
+ 't6430-merge-recursive.sh',
+ 't6431-merge-criscross.sh',
+ 't6432-merge-recursive-space-options.sh',
+ 't6433-merge-toplevel.sh',
+ 't6434-merge-recursive-rename-options.sh',
+ 't6435-merge-sparse.sh',
+ 't6436-merge-overwrite.sh',
+ 't6437-submodule-merge.sh',
+ 't6438-submodule-directory-file-conflicts.sh',
+ 't6439-merge-co-error-msgs.sh',
+ 't6500-gc.sh',
+ 't6501-freshen-objects.sh',
+ 't6600-test-reach.sh',
+ 't6700-tree-depth.sh',
+ 't7001-mv.sh',
+ 't7002-mv-sparse-checkout.sh',
+ 't7003-filter-branch.sh',
+ 't7004-tag.sh',
+ 't7005-editor.sh',
+ 't7006-pager.sh',
+ 't7007-show.sh',
+ 't7008-filter-branch-null-sha1.sh',
+ 't7010-setup.sh',
+ 't7011-skip-worktree-reading.sh',
+ 't7012-skip-worktree-writing.sh',
+ 't7030-verify-tag.sh',
+ 't7031-verify-tag-signed-ssh.sh',
+ 't7060-wtstatus.sh',
+ 't7061-wtstatus-ignore.sh',
+ 't7062-wtstatus-ignorecase.sh',
+ 't7063-status-untracked-cache.sh',
+ 't7064-wtstatus-pv2.sh',
+ 't7101-reset-empty-subdirs.sh',
+ 't7102-reset.sh',
+ 't7103-reset-bare.sh',
+ 't7104-reset-hard.sh',
+ 't7105-reset-patch.sh',
+ 't7106-reset-unborn-branch.sh',
+ 't7107-reset-pathspec-file.sh',
+ 't7110-reset-merge.sh',
+ 't7111-reset-table.sh',
+ 't7112-reset-submodule.sh',
+ 't7113-post-index-change-hook.sh',
+ 't7201-co.sh',
+ 't7300-clean.sh',
+ 't7301-clean-interactive.sh',
+ 't7400-submodule-basic.sh',
+ 't7401-submodule-summary.sh',
+ 't7402-submodule-rebase.sh',
+ 't7403-submodule-sync.sh',
+ 't7406-submodule-update.sh',
+ 't7407-submodule-foreach.sh',
+ 't7408-submodule-reference.sh',
+ 't7409-submodule-detached-work-tree.sh',
+ 't7411-submodule-config.sh',
+ 't7412-submodule-absorbgitdirs.sh',
+ 't7413-submodule-is-active.sh',
+ 't7414-submodule-mistakes.sh',
+ 't7416-submodule-dash-url.sh',
+ 't7417-submodule-path-url.sh',
+ 't7418-submodule-sparse-gitmodules.sh',
+ 't7419-submodule-set-branch.sh',
+ 't7420-submodule-set-url.sh',
+ 't7421-submodule-summary-add.sh',
+ 't7422-submodule-output.sh',
+ 't7423-submodule-symlinks.sh',
+ 't7424-submodule-mixed-ref-formats.sh',
+ 't7450-bad-git-dotfiles.sh',
+ 't7500-commit-template-squash-signoff.sh',
+ 't7501-commit-basic-functionality.sh',
+ 't7502-commit-porcelain.sh',
+ 't7503-pre-commit-and-pre-merge-commit-hooks.sh',
+ 't7504-commit-msg-hook.sh',
+ 't7505-prepare-commit-msg-hook.sh',
+ 't7506-status-submodule.sh',
+ 't7507-commit-verbose.sh',
+ 't7508-status.sh',
+ 't7509-commit-authorship.sh',
+ 't7510-signed-commit.sh',
+ 't7511-status-index.sh',
+ 't7512-status-help.sh',
+ 't7513-interpret-trailers.sh',
+ 't7514-commit-patch.sh',
+ 't7515-status-symlinks.sh',
+ 't7516-commit-races.sh',
+ 't7517-per-repo-email.sh',
+ 't7518-ident-corner-cases.sh',
+ 't7519-status-fsmonitor.sh',
+ 't7520-ignored-hook-warning.sh',
+ 't7521-ignored-mode.sh',
+ 't7524-commit-summary.sh',
+ 't7525-status-rename.sh',
+ 't7526-commit-pathspec-file.sh',
+ 't7527-builtin-fsmonitor.sh',
+ 't7528-signed-commit-ssh.sh',
+ 't7600-merge.sh',
+ 't7601-merge-pull-config.sh',
+ 't7602-merge-octopus-many.sh',
+ 't7603-merge-reduce-heads.sh',
+ 't7604-merge-custom-message.sh',
+ 't7605-merge-resolve.sh',
+ 't7606-merge-custom.sh',
+ 't7607-merge-state.sh',
+ 't7608-merge-messages.sh',
+ 't7609-mergetool--lib.sh',
+ 't7610-mergetool.sh',
+ 't7611-merge-abort.sh',
+ 't7612-merge-verify-signatures.sh',
+ 't7614-merge-signoff.sh',
+ 't7615-diff-algo-with-mergy-operations.sh',
+ 't7700-repack.sh',
+ 't7701-repack-unpack-unreachable.sh',
+ 't7702-repack-cyclic-alternate.sh',
+ 't7703-repack-geometric.sh',
+ 't7704-repack-cruft.sh',
+ 't7800-difftool.sh',
+ 't7810-grep.sh',
+ 't7811-grep-open.sh',
+ 't7812-grep-icase-non-ascii.sh',
+ 't7813-grep-icase-iso.sh',
+ 't7814-grep-recurse-submodules.sh',
+ 't7815-grep-binary.sh',
+ 't7816-grep-binary-pattern.sh',
+ 't7817-grep-sparse-checkout.sh',
+ 't7900-maintenance.sh',
+ 't8001-annotate.sh',
+ 't8002-blame.sh',
+ 't8003-blame-corner-cases.sh',
+ 't8004-blame-with-conflicts.sh',
+ 't8005-blame-i18n.sh',
+ 't8006-blame-textconv.sh',
+ 't8007-cat-file-textconv.sh',
+ 't8008-blame-formats.sh',
+ 't8009-blame-vs-topicbranches.sh',
+ 't8010-cat-file-filters.sh',
+ 't8011-blame-split-file.sh',
+ 't8012-blame-colors.sh',
+ 't8013-blame-ignore-revs.sh',
+ 't8014-blame-ignore-fuzzy.sh',
+ 't9001-send-email.sh',
+ 't9002-column.sh',
+ 't9003-help-autocorrect.sh',
+ 't9100-git-svn-basic.sh',
+ 't9101-git-svn-props.sh',
+ 't9102-git-svn-deep-rmdir.sh',
+ 't9103-git-svn-tracked-directory-removed.sh',
+ 't9104-git-svn-follow-parent.sh',
+ 't9105-git-svn-commit-diff.sh',
+ 't9106-git-svn-commit-diff-clobber.sh',
+ 't9107-git-svn-migrate.sh',
+ 't9108-git-svn-glob.sh',
+ 't9109-git-svn-multi-glob.sh',
+ 't9110-git-svn-use-svm-props.sh',
+ 't9111-git-svn-use-svnsync-props.sh',
+ 't9112-git-svn-md5less-file.sh',
+ 't9113-git-svn-dcommit-new-file.sh',
+ 't9114-git-svn-dcommit-merge.sh',
+ 't9115-git-svn-dcommit-funky-renames.sh',
+ 't9116-git-svn-log.sh',
+ 't9117-git-svn-init-clone.sh',
+ 't9118-git-svn-funky-branch-names.sh',
+ 't9119-git-svn-info.sh',
+ 't9120-git-svn-clone-with-percent-escapes.sh',
+ 't9121-git-svn-fetch-renamed-dir.sh',
+ 't9122-git-svn-author.sh',
+ 't9123-git-svn-rebuild-with-rewriteroot.sh',
+ 't9124-git-svn-dcommit-auto-props.sh',
+ 't9125-git-svn-multi-glob-branch-names.sh',
+ 't9126-git-svn-follow-deleted-readded-directory.sh',
+ 't9127-git-svn-partial-rebuild.sh',
+ 't9128-git-svn-cmd-branch.sh',
+ 't9129-git-svn-i18n-commitencoding.sh',
+ 't9130-git-svn-authors-file.sh',
+ 't9131-git-svn-empty-symlink.sh',
+ 't9132-git-svn-broken-symlink.sh',
+ 't9133-git-svn-nested-git-repo.sh',
+ 't9134-git-svn-ignore-paths.sh',
+ 't9135-git-svn-moved-branch-empty-file.sh',
+ 't9136-git-svn-recreated-branch-empty-file.sh',
+ 't9137-git-svn-dcommit-clobber-series.sh',
+ 't9138-git-svn-authors-prog.sh',
+ 't9139-git-svn-non-utf8-commitencoding.sh',
+ 't9140-git-svn-reset.sh',
+ 't9141-git-svn-multiple-branches.sh',
+ 't9142-git-svn-shallow-clone.sh',
+ 't9143-git-svn-gc.sh',
+ 't9144-git-svn-old-rev_map.sh',
+ 't9145-git-svn-master-branch.sh',
+ 't9146-git-svn-empty-dirs.sh',
+ 't9147-git-svn-include-paths.sh',
+ 't9148-git-svn-propset.sh',
+ 't9150-svk-mergetickets.sh',
+ 't9151-svn-mergeinfo.sh',
+ 't9152-svn-empty-dirs-after-gc.sh',
+ 't9153-git-svn-rewrite-uuid.sh',
+ 't9154-git-svn-fancy-glob.sh',
+ 't9155-git-svn-fetch-deleted-tag.sh',
+ 't9156-git-svn-fetch-deleted-tag-2.sh',
+ 't9157-git-svn-fetch-merge.sh',
+ 't9158-git-svn-mergeinfo.sh',
+ 't9159-git-svn-no-parent-mergeinfo.sh',
+ 't9160-git-svn-preserve-empty-dirs.sh',
+ 't9161-git-svn-mergeinfo-push.sh',
+ 't9162-git-svn-dcommit-interactive.sh',
+ 't9163-git-svn-reset-clears-caches.sh',
+ 't9164-git-svn-dcommit-concurrent.sh',
+ 't9165-git-svn-fetch-merge-branch-of-branch.sh',
+ 't9166-git-svn-fetch-merge-branch-of-branch2.sh',
+ 't9167-git-svn-cmd-branch-subproject.sh',
+ 't9168-git-svn-partially-globbed-names.sh',
+ 't9169-git-svn-dcommit-crlf.sh',
+ 't9200-git-cvsexportcommit.sh',
+ 't9210-scalar.sh',
+ 't9211-scalar-clone.sh',
+ 't9300-fast-import.sh',
+ 't9301-fast-import-notes.sh',
+ 't9302-fast-import-unpack-limit.sh',
+ 't9303-fast-import-compression.sh',
+ 't9304-fast-import-marks.sh',
+ 't9350-fast-export.sh',
+ 't9351-fast-export-anonymize.sh',
+ 't9400-git-cvsserver-server.sh',
+ 't9401-git-cvsserver-crlf.sh',
+ 't9402-git-cvsserver-refs.sh',
+ 't9500-gitweb-standalone-no-errors.sh',
+ 't9501-gitweb-standalone-http-status.sh',
+ 't9502-gitweb-standalone-parse-output.sh',
+ 't9600-cvsimport.sh',
+ 't9601-cvsimport-vendor-branch.sh',
+ 't9602-cvsimport-branches-tags.sh',
+ 't9603-cvsimport-patchsets.sh',
+ 't9604-cvsimport-timestamps.sh',
+ 't9700-perl-git.sh',
+ 't9800-git-p4-basic.sh',
+ 't9801-git-p4-branch.sh',
+ 't9802-git-p4-filetype.sh',
+ 't9803-git-p4-shell-metachars.sh',
+ 't9804-git-p4-label.sh',
+ 't9805-git-p4-skip-submit-edit.sh',
+ 't9806-git-p4-options.sh',
+ 't9807-git-p4-submit.sh',
+ 't9808-git-p4-chdir.sh',
+ 't9809-git-p4-client-view.sh',
+ 't9810-git-p4-rcs.sh',
+ 't9811-git-p4-label-import.sh',
+ 't9812-git-p4-wildcards.sh',
+ 't9813-git-p4-preserve-users.sh',
+ 't9814-git-p4-rename.sh',
+ 't9815-git-p4-submit-fail.sh',
+ 't9816-git-p4-locked.sh',
+ 't9817-git-p4-exclude.sh',
+ 't9818-git-p4-block.sh',
+ 't9819-git-p4-case-folding.sh',
+ 't9820-git-p4-editor-handling.sh',
+ 't9821-git-p4-path-variations.sh',
+ 't9822-git-p4-path-encoding.sh',
+ 't9823-git-p4-mock-lfs.sh',
+ 't9824-git-p4-git-lfs.sh',
+ 't9825-git-p4-handle-utf16-without-bom.sh',
+ 't9826-git-p4-keep-empty-commits.sh',
+ 't9827-git-p4-change-filetype.sh',
+ 't9828-git-p4-map-user.sh',
+ 't9829-git-p4-jobs.sh',
+ 't9830-git-p4-symlink-dir.sh',
+ 't9831-git-p4-triggers.sh',
+ 't9832-unshelve.sh',
+ 't9833-errors.sh',
+ 't9834-git-p4-file-dir-bug.sh',
+ 't9835-git-p4-metadata-encoding-python2.sh',
+ 't9836-git-p4-metadata-encoding-python3.sh',
+ 't9850-shell.sh',
+ 't9901-git-web--browse.sh',
+ 't9902-completion.sh',
+ 't9903-bash-prompt.sh',
+]
+
+# GIT_BUILD_DIR needs to be Unix-style without drive prefixes as it 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 it.
+git_build_dir = meson.project_build_root()
+if cygpath.found()
+ git_build_dir = run_command(cygpath, git_build_dir, check: true).stdout().strip()
+endif
+
+foreach integration_test : integration_tests
+ test(fs.stem(integration_test), shell,
+ args: [ integration_test ],
+ workdir: meson.current_source_dir(),
+ env: {
+ 'GIT_BUILD_DIR': git_build_dir,
+ },
+ depends: test_dependencies + bin_wrappers,
+ timeout: 0,
+ )
+endforeach
diff --git a/templates/hooks/meson.build b/templates/hooks/meson.build
new file mode 100644
index 0000000000..9bef5d7cfa
--- /dev/null
+++ b/templates/hooks/meson.build
@@ -0,0 +1,24 @@
+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: script_sh_config,
+ )
+endforeach
diff --git a/templates/info/meson.build b/templates/info/meson.build
new file mode 100644
index 0000000000..4ee1cfdf89
--- /dev/null
+++ b/templates/info/meson.build
@@ -0,0 +1,5 @@
+configure_file(
+ input: 'exclude',
+ output: 'exclude',
+ configuration: script_sh_config,
+)
diff --git a/templates/meson.build b/templates/meson.build
new file mode 100644
index 0000000000..7428aaf1e6
--- /dev/null
+++ b/templates/meson.build
@@ -0,0 +1,8 @@
+configure_file(
+ input: 'description',
+ output: 'description',
+ configuration: script_sh_config,
+)
+
+subdir('hooks')
+subdir('info')
--
2.47.0.rc0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* Re: [RFC PATCH 01/21] Documentation: add comparison of build systems
2024-10-02 15:15 ` [RFC PATCH 01/21] Documentation: add comparison of build systems Patrick Steinhardt
@ 2024-10-02 18:14 ` Junio C Hamano
2024-10-06 20:14 ` Eli Schwartz
2024-10-07 10:18 ` Patrick Steinhardt
2024-10-02 20:24 ` Eric Sunshine
1 sibling, 2 replies; 386+ messages in thread
From: Junio C Hamano @ 2024-10-02 18:14 UTC (permalink / raw)
To: Patrick Steinhardt; +Cc: git, Eli Schwartz
Patrick Steinhardt <ps@pks.im> writes:
> We're contemplating whether to eventually replace our build systems with
> a build system that is easier to use. Add a comparison of build systems
> to our technical documentation as a baseline for discussion.
>
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
Thanks for starting this.
> diff --git a/Documentation/technical/build-systems.txt b/Documentation/technical/build-systems.txt
> new file mode 100644
> index 0000000000..8fac36ce1d
> --- /dev/null
> +++ b/Documentation/technical/build-systems.txt
> @@ -0,0 +1,164 @@
> += Build Systems
> +
> +The build system is the primary way for both developers and system integrators
> +to interact with the Git project. As such, we consider it important to pick a
> +build system that fulfills our requirements while being easy to use and extend.
Maybe it is me, but this sounds as if _we_ do not need "easy to use
and extend", but "easy to use and extend" are extra afterthought
consideration we are making for others, which is a bit disturbing.
Let me try paraphrasing what I think you wanted to say
As such, being easy to use and extend for those who are not
directly developing Git itself is just as important as other
requirements we have on any potential build system.
which hopefully would sound more like we are not treating those who
only build and tweak the product of our project as second-class
citizens.
> +This document outlines the different requirements that we have for the build
> +system and then compares available build systems using these criteria.
> +
> +== Requirements
> +
> +The following subsections prevent a list of requirements that we have for any
I think you meant "present".
> +potential build system. Sections are sorted by decreasing priority, even though
> +these priorities will naturally differ between users.
> +
> +=== Platform support
> +
> +The most important criterium is whether the build system supports all of the
> +platforms that Git supports. The most important platforms include:
Maybe it is just me, but when I hear "The most", I expect an
exhaustive list (hence "include" that came later somewhat surprised
me), and I consider these "the more important systems" (implying
"than others").
> + - Linux
> + - macOS
> + - Windows
> + - FreeBSD
> + - OpenBSD
> + - NetBSD
> +
> +The platforms which must be supported by the tool should be aligned with our
> +[platform support policy](platform-support.txt).
> +Auto-detection of the following items is considered to be important:
> +
> + - Check for the existence of headers.
> + - Check for the existence of libraries.
> + - Check for the existence of exectuables.
> + - Check for the runtime behavior of specific functions.
- Check for specific link order requirements when multiple libraries
are involved.
> +=== Ease of use
> +
> +The build system SHOULD be both easy to use and easy to extend. While this is
> +naturally a subjective metric it is likely not controversial to say that some
> +build systems are considerably harder to use than others.
If we want to pull RFC-2119/BCP-14 with shouting "SHOULD", we
probably should use something similar in the previous "Platform
support" section.
> +=== IDE support
> +=== Out-of-tree builds
Cross platform builds (e.g., building for arm on x86-64 host)?
> +=== Rust support
> +
> +Many long-time Git contributors are nowadays in favor of adopting Rust as a
> +second language next to C. The build system SHOULD thus support Rust such that
> +we do not have to reopen the discussion once we decide to pick up Rust.
What reasons do you have in mind that, without spelling this out,
Rust will be left behind while C is fully supported? If the build
system can keep track of dependencies by knowing foo.o is made from
foo.c and turning foo.c into foo.o takes running cc, it can do the
same for rustc. Do you mean include file dependencies and the like?
If the reason why we say "Language X needs to be supported" is
because it is not enough to be able to run a compiler on source
files written in the language, but it is also necessary to know when
to run the compiler (i.e., by dependency tracking), it is better to
spell it out.
In any case, instead of singling out Rust in the title, name the
section "languate support", and give an enumeration of compilers
languages, processors that we care about, just like we did for
platforms. For exaple, we may not necessarily want to treat "C
support, done as an afterthought of supporting C++" and "C support,
done natively" as equivalents (of course, the latter is better).
Shouldn't it also "support" asciidoc/asciidoctor/makeinfo for
the documentation toolchain?
Are there other things we use Makefile for in our current system
that we are forgetting in this requirements section, like "running
lint" or "running tests"?
Thanks.
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH 01/21] Documentation: add comparison of build systems
2024-10-02 15:15 ` [RFC PATCH 01/21] Documentation: add comparison of build systems Patrick Steinhardt
2024-10-02 18:14 ` Junio C Hamano
@ 2024-10-02 20:24 ` Eric Sunshine
2024-10-07 10:17 ` Patrick Steinhardt
1 sibling, 1 reply; 386+ messages in thread
From: Eric Sunshine @ 2024-10-02 20:24 UTC (permalink / raw)
To: Patrick Steinhardt; +Cc: git, Eli Schwartz
On Wed, Oct 2, 2024 at 11:16 AM Patrick Steinhardt <ps@pks.im> wrote:
> We're contemplating whether to eventually replace our build systems with
> a build system that is easier to use. Add a comparison of build systems
> to our technical documentation as a baseline for discussion.
>
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
> +=== Rust support
> +
> +Many long-time Git contributors are nowadays in favor of adopting Rust as a
> +second language next to C. The build system SHOULD thus support Rust such that
> +we do not have to reopen the discussion once we decide to pick up Rust.
I've been watching the Rust discussion mostly from the sidelines, so
it's possible that I've missed something, but I was more than a little
surprised to see the claim that "Many long-time Git contributors [are]
in favor of adopting Rust" since my impression of the discussions does
not reflect that claim, nor could I find sufficient references to
support such a strong statement. My understanding of the situation is
rather different; I've seen both proponents and opponents. With
regards to project regulars...
* The most vocal proponent has been brian who gives the impression of
being quite a fan of Rust, but hasn't provided particularly compelling
reasons to adopt it, and some of his arguments are highly subjective
(for instance, "Rust excels at multithreading"[1]; while it's true
that Rust may make multithreading safer, it is highly subjective to
say that it "excels" at it -- especially, for instance, for anyone
familiar with Go's approach to the same subject).
* The Google team is interested in having a Rust wrapper for core Git
library[2], but that doesn't imply or require adopting Rust into the
Git project itself.
* Randall has severe misgivings[3] about Rust being introduced into
the project due to its exclusionary nature with regards to the
platform(s) he supports.
* At least one well-established contributor has stated[4] that "Rust
scares" him. (Possibly this was said somewhat in jest, but I suspect
the feeling may be shared by more than a few long-time Git
contributors who see Rust as an overly complex, complicated, and
convoluted language but who haven't spoken up because they understand
that the programming world in general is moving toward more modern
languages such as Rust and Go.)
* The only properly compelling arguments I've seen in favor of
adopting Rust came from Elijah[5,6] who is always well-spoken,
well-reasoned, thorough, and backs up his statements with plenty of
factual evidence.
Those aside, I don't recall seeing any other long-time Git
contributors speak up in favor of adopting Rust.
[1]: https://lore.kernel.org/git/ZrqJM-vmPaJbdHP2@tapette.crustytoothpaste.net/
[2]: https://lore.kernel.org/git/cover.1723054623.git.steadmon@google.com/
[3]: https://lore.kernel.org/git/053f01db0b79$0d885b30$28991190$@nexbridge.com/
[4]: https://lore.kernel.org/git/Zu2D%2Fb1ZJbTlC1ml@nand.local/
[5]: https://lore.kernel.org/git/CABPp-BFWsWCGogqQ=haMsS4OhOdSwc3frcAxa6soQR5ORTceOA@mail.gmail.com/
[6]: https://lore.kernel.org/git/CABPp-BFOmwV-xBtjvtenb6RFz9wx2VWVpTeho0k=D8wsCCVwqQ@mail.gmail.com/
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH 05/21] t3404: work around platform-specific behaviour on macOS 10.15
2024-10-02 15:15 ` [RFC PATCH 05/21] t3404: work around platform-specific behaviour on macOS 10.15 Patrick Steinhardt
@ 2024-10-02 21:43 ` Eric Sunshine
2024-10-03 15:15 ` Phillip Wood
2024-10-07 10:18 ` Patrick Steinhardt
0 siblings, 2 replies; 386+ messages in thread
From: Eric Sunshine @ 2024-10-02 21:43 UTC (permalink / raw)
To: Patrick Steinhardt; +Cc: git, Eli Schwartz
On Wed, Oct 2, 2024 at 11:17 AM Patrick Steinhardt <ps@pks.im> wrote:
> Two of our tests in t3404 use indented HERE docs where leading tabs on
> some of the lines are actually relevant. The tabs do get removed though,
> and we try to fix this up by using sed(1) to replace leading tabs in the
> actual output, as well. But on macOS 10.15 this doesn't work as expected
> and we somehow keep the tabs around in the actual output.
I presume this nebulous explanation is due to the fact that the reason
why macOS 10.15 exhibits this anomalous behavior is not yet known?
> Work around this issue by retaining the tabs.
>
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
> diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
> @@ -1917,18 +1917,17 @@ test_expect_success '--update-refs updates refs correctly' '
> - cat >expect <<-\EOF &&
> - Successfully rebased and updated refs/heads/update-refs.
> - Updated the following refs with --update-refs:
> - refs/heads/first
> - refs/heads/no-conflict-branch
> - refs/heads/second
> - refs/heads/third
> - EOF
> + cat >expect <<\EOF &&
> +Successfully rebased and updated refs/heads/update-refs.
> +Updated the following refs with --update-refs:
> + refs/heads/first
> + refs/heads/no-conflict-branch
> + refs/heads/second
> + refs/heads/third
> +EOF
Although this works, the problem with this change (and its sibling
later in the patch) is that someday someone is going to come along
(say, for instance, a GSoC applicant doing a microproject) who submits
a patch to (re-)"modernize" this test by using `<<-` to (re-)indent
the heredoc body. A better approach would probably be to retain `<<-`
and use q_to_tab():
q_to_tab >expect <<-\EOF &&
Qrefs/heads/first
Q...
Qrefs/heads/third
EOF
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH 04/21] t/lib-gpg: fix setup of GNUPGHOME in MinGW
2024-10-02 15:15 ` [RFC PATCH 04/21] t/lib-gpg: fix setup of GNUPGHOME in MinGW Patrick Steinhardt
@ 2024-10-02 21:49 ` Eric Sunshine
2024-10-07 10:18 ` Patrick Steinhardt
0 siblings, 1 reply; 386+ messages in thread
From: Eric Sunshine @ 2024-10-02 21:49 UTC (permalink / raw)
To: Patrick Steinhardt; +Cc: git, Eli Schwartz
On Wed, Oct 2, 2024 at 11:17 AM Patrick Steinhardt <ps@pks.im> wrote:
> In "t/lib-gpg.sh" we set up the "GNUPGHOME" environment variable to
> point to a test-specific diretcory. This is done by using "$PWD/gpghome"
s/diretcory/directory/
> as value, where "$PWD" is the current test's trash directory.
>
> This is broken for MinGW though because "$PWD" will use Windows-style
> paths that contain drive letters. What we really want in this context is
> a Unix-style path, which we can get by using `$(pwd)` instead.
It's not clear from this description why Windows- vs. Unix-style paths
only now become a problem but have not been a problem up to this
point. Is it because PGP testing has always been disabled on Windows
until now? Or some other reason?
> Adapt the code accordingly to fix tests using this library.
>
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH 05/21] t3404: work around platform-specific behaviour on macOS 10.15
2024-10-02 21:43 ` Eric Sunshine
@ 2024-10-03 15:15 ` Phillip Wood
2024-10-03 22:22 ` Eric Sunshine
2024-10-07 10:18 ` Patrick Steinhardt
2024-10-07 10:18 ` Patrick Steinhardt
1 sibling, 2 replies; 386+ messages in thread
From: Phillip Wood @ 2024-10-03 15:15 UTC (permalink / raw)
To: Eric Sunshine, Patrick Steinhardt; +Cc: git, Eli Schwartz
On 02/10/2024 22:43, Eric Sunshine wrote:
> On Wed, Oct 2, 2024 at 11:17 AM Patrick Steinhardt <ps@pks.im> wrote:
>> Two of our tests in t3404 use indented HERE docs where leading tabs on
>> some of the lines are actually relevant. The tabs do get removed though,
>> and we try to fix this up by using sed(1) to replace leading tabs in the
>> actual output, as well. But on macOS 10.15 this doesn't work as expected
>> and we somehow keep the tabs around in the actual output.
>
> I presume this nebulous explanation is due to the fact that the reason
> why macOS 10.15 exhibits this anomalous behavior is not yet known?
I suspect that the problem is that we use "\t" which is non-standard
rather than a literal tab character in the sed expression.
> Although this works, the problem with this change (and its sibling
> later in the patch) is that someday someone is going to come along
> (say, for instance, a GSoC applicant doing a microproject) who submits
> a patch to (re-)"modernize" this test by using `<<-` to (re-)indent
> the heredoc body. A better approach would probably be to retain `<<-`
> and use q_to_tab():
>
> q_to_tab >expect <<-\EOF &&
> Qrefs/heads/first
> Q...
> Qrefs/heads/third
> EOF
I agree that using q_to_tab is a better approach here.
These first few patches all look like useful fixes in their own right. I
might be worth splitting them out into a separate series so they can
progress independently of the build system changes.
Best Wishes
Phillip
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH 05/21] t3404: work around platform-specific behaviour on macOS 10.15
2024-10-03 15:15 ` Phillip Wood
@ 2024-10-03 22:22 ` Eric Sunshine
2024-10-03 23:19 ` Junio C Hamano
2024-10-07 10:18 ` Patrick Steinhardt
1 sibling, 1 reply; 386+ messages in thread
From: Eric Sunshine @ 2024-10-03 22:22 UTC (permalink / raw)
To: phillip.wood; +Cc: Patrick Steinhardt, git, Eli Schwartz
On Thu, Oct 3, 2024 at 11:16 AM Phillip Wood <phillip.wood123@gmail.com> wrote:
> On 02/10/2024 22:43, Eric Sunshine wrote:
> > On Wed, Oct 2, 2024 at 11:17 AM Patrick Steinhardt <ps@pks.im> wrote:
> >> Two of our tests in t3404 use indented HERE docs where leading tabs on
> >> some of the lines are actually relevant. The tabs do get removed though,
> >> and we try to fix this up by using sed(1) to replace leading tabs in the
> >> actual output, as well. But on macOS 10.15 this doesn't work as expected
> >> and we somehow keep the tabs around in the actual output.
> >
> > I presume this nebulous explanation is due to the fact that the reason
> > why macOS 10.15 exhibits this anomalous behavior is not yet known?
>
> I suspect that the problem is that we use "\t" which is non-standard
> rather than a literal tab character in the sed expression.
Ah yes. The `sed` on macOS 10.15 would have been of an older
BSD-lineage than the more modern macOS versions, so that makes sense.
It wouldn't be a bad idea for the commit message to mention something
along those lines.
(I always use literal TAB with `sed` for this precise reason, which
may explain why my eyes skipped right over the non-standard use of
"\t" or I just wasn't paying close enough attention, which is equally
likely.)
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH 05/21] t3404: work around platform-specific behaviour on macOS 10.15
2024-10-03 22:22 ` Eric Sunshine
@ 2024-10-03 23:19 ` Junio C Hamano
2024-10-07 10:18 ` Patrick Steinhardt
0 siblings, 1 reply; 386+ messages in thread
From: Junio C Hamano @ 2024-10-03 23:19 UTC (permalink / raw)
To: Eric Sunshine; +Cc: phillip.wood, Patrick Steinhardt, git, Eli Schwartz
Eric Sunshine <sunshine@sunshineco.com> writes:
>> I suspect that the problem is that we use "\t" which is non-standard
>> rather than a literal tab character in the sed expression.
>
> Ah yes. The `sed` on macOS 10.15 would have been of an older
> BSD-lineage than the more modern macOS versions, so that makes sense.
> It wouldn't be a bad idea for the commit message to mention something
> along those lines.
>
> (I always use literal TAB with `sed` for this precise reason, which
> may explain why my eyes skipped right over the non-standard use of
> "\t" or I just wasn't paying close enough attention, which is equally
> likely.)
I also learned sed with old BSD behaviour to be portable (I somehow
thought it is not just "old BSD" but outside POSIX if you used "\t"
and friends). Checking with
$ git grep 'sed.*\\t' t/\*.sh
shows that t3305 also has this problem. The ones in t3404 are from
4611884e (sequencer: notify user of --update-refs activity,
2022-07-19), while the other one is from e1c52539 (t3305: check
notes fanout more carefully and robustly, 2020-02-03), both are
relatively old. If people are not reporting issues, it may be an
indication that sed implementations of BSD origin may have died off.
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH 01/21] Documentation: add comparison of build systems
2024-10-02 18:14 ` Junio C Hamano
@ 2024-10-06 20:14 ` Eli Schwartz
2024-10-07 10:18 ` Patrick Steinhardt
1 sibling, 0 replies; 386+ messages in thread
From: Eli Schwartz @ 2024-10-06 20:14 UTC (permalink / raw)
To: Junio C Hamano, Patrick Steinhardt; +Cc: git
[-- Attachment #1.1: Type: text/plain, Size: 3360 bytes --]
On 10/2/24 2:14 PM, Junio C Hamano wrote:
>> +=== Rust support
>> +
>> +Many long-time Git contributors are nowadays in favor of adopting Rust as a
>> +second language next to C. The build system SHOULD thus support Rust such that
>> +we do not have to reopen the discussion once we decide to pick up Rust.
>
> What reasons do you have in mind that, without spelling this out,
> Rust will be left behind while C is fully supported? If the build
> system can keep track of dependencies by knowing foo.o is made from
> foo.c and turning foo.c into foo.o takes running cc, it can do the
> same for rustc. Do you mean include file dependencies and the like?
It's actually tremendously more complicated, speaking as someone who as
reviewed and dabbled with support for rustc in meson. :)
Rust can trivially compile a single source file into a single executable
fairly easily, and it looks much like running a C compiler. Correctly
invoking rustc in any more complicated project, such as but not limited to:
- building an internal rust static library ("rlib", typically in the
form of a crate)
- linking to a C library
- exporting a C library
- cross compilation
- proc-macros=
quickly turns into a maze of options to ensure correct linkage, and you
also have to pass special options to do name-mangling right down the
entire dependency tree. Note also that the rust compiler driver has
decided for its own reasons to *partially* not rely on the C compiler as
a linker driver (it passes -nodefaultlibs for "ideological reasons"), so
you have to detect the correct libraries that need to be referenced by a
staticlib using rustc --print native-static-libs and then order matters
and sanitizers are broken anyway.
In short, you really need a build system for Rust, you cannot just run
rustc, which means you need to make the decision about a build system if
you ever end up using Rust.
> If the reason why we say "Language X needs to be supported" is
> because it is not enough to be able to run a compiler on source
> files written in the language, but it is also necessary to know when
> to run the compiler (i.e., by dependency tracking), it is better to
> spell it out.
Dependency tracking is tame stuff and just table stakes for build
systems. :)
> In any case, instead of singling out Rust in the title, name the
> section "languate support", and give an enumeration of compilers
> languages, processors that we care about, just like we did for
> platforms. For exaple, we may not necessarily want to treat "C
> support, done as an afterthought of supporting C++" and "C support,
> done natively" as equivalents (of course, the latter is better).
>
> Shouldn't it also "support" asciidoc/asciidoctor/makeinfo for
> the documentation toolchain?
Running asciidoc is pretty simple as it doesn't involve fiddly
domain-specific compiler internals. You just run a command -- the same
command everywhere -- with an "infile" and "outfile" parameter and the
asciidoc tool is essentially well behaved and does what you want it to
do. makeinfo isn't really any different.
> Are there other things we use Makefile for in our current system
> that we are forgetting in this requirements section, like "running
> lint" or "running tests"?
>
> Thanks.
--
Eli Schwartz
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH 01/21] Documentation: add comparison of build systems
2024-10-02 20:24 ` Eric Sunshine
@ 2024-10-07 10:17 ` Patrick Steinhardt
0 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-07 10:17 UTC (permalink / raw)
To: Eric Sunshine; +Cc: git, Eli Schwartz
On Wed, Oct 02, 2024 at 04:24:10PM -0400, Eric Sunshine wrote:
> On Wed, Oct 2, 2024 at 11:16 AM Patrick Steinhardt <ps@pks.im> wrote:
> > We're contemplating whether to eventually replace our build systems with
> > a build system that is easier to use. Add a comparison of build systems
> > to our technical documentation as a baseline for discussion.
> >
> > Signed-off-by: Patrick Steinhardt <ps@pks.im>
> > ---
> > +=== Rust support
> > +
> > +Many long-time Git contributors are nowadays in favor of adopting Rust as a
> > +second language next to C. The build system SHOULD thus support Rust such that
> > +we do not have to reopen the discussion once we decide to pick up Rust.
>
> I've been watching the Rust discussion mostly from the sidelines, so
> it's possible that I've missed something, but I was more than a little
> surprised to see the claim that "Many long-time Git contributors [are]
> in favor of adopting Rust" since my impression of the discussions does
> not reflect that claim, nor could I find sufficient references to
> support such a strong statement. My understanding of the situation is
> rather different; I've seen both proponents and opponents. With
> regards to project regulars...
I felt that during the Git Contributor's summit the room was in favor of
adopting Rust in general. The discussion seemed to rather revolve around
_how_ we start to adopt it, not _if_ we do so. I also cannot really
remember anybody pushing back on adopting Rust.
In any case, I'm happy to tone this down a bit, as the document is not
here to make the case for Rust. I think that it is very likely that we
will eventually start to adopt Rust, and because of that I tend to think
that we should be prepared for such a future instead of having to
reevaluate our build system because it cannot handle such a potential
future.
[snip]
> * At least one well-established contributor has stated[4] that "Rust
> scares" him. (Possibly this was said somewhat in jest, but I suspect
> the feeling may be shared by more than a few long-time Git
> contributors who see Rust as an overly complex, complicated, and
> convoluted language but who haven't spoken up because they understand
> that the programming world in general is moving toward more modern
> languages such as Rust and Go.)
Well, that was me :) I _am_ scared of the learning curve of Rust, but I
also think that it puts enough on the table to be a worthwhile addition.
So it was said half-jokingly.
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH 01/21] Documentation: add comparison of build systems
2024-10-02 18:14 ` Junio C Hamano
2024-10-06 20:14 ` Eli Schwartz
@ 2024-10-07 10:18 ` Patrick Steinhardt
2024-10-07 21:08 ` Junio C Hamano
1 sibling, 1 reply; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-07 10:18 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Eli Schwartz
On Wed, Oct 02, 2024 at 11:14:52AM -0700, Junio C Hamano wrote:
> Patrick Steinhardt <ps@pks.im> writes:
> > diff --git a/Documentation/technical/build-systems.txt b/Documentation/technical/build-systems.txt
> > new file mode 100644
> > index 0000000000..8fac36ce1d
> > --- /dev/null
> > +++ b/Documentation/technical/build-systems.txt
> > @@ -0,0 +1,164 @@
> > += Build Systems
> > +
> > +The build system is the primary way for both developers and system integrators
> > +to interact with the Git project. As such, we consider it important to pick a
> > +build system that fulfills our requirements while being easy to use and extend.
>
> Maybe it is me, but this sounds as if _we_ do not need "easy to use
> and extend", but "easy to use and extend" are extra afterthought
> consideration we are making for others, which is a bit disturbing.
>
> Let me try paraphrasing what I think you wanted to say
>
> As such, being easy to use and extend for those who are not
> directly developing Git itself is just as important as other
> requirements we have on any potential build system.
>
> which hopefully would sound more like we are not treating those who
> only build and tweak the product of our project as second-class
> citizens.
Oh, that sounds way better, yes!
> > +This document outlines the different requirements that we have for the build
> > +system and then compares available build systems using these criteria.
> > +
> > +== Requirements
> > +
> > +The following subsections prevent a list of requirements that we have for any
>
> I think you meant "present".
Yup.
> > +potential build system. Sections are sorted by decreasing priority, even though
> > +these priorities will naturally differ between users.
> > +
> > +=== Platform support
> > +
> > +The most important criterium is whether the build system supports all of the
> > +platforms that Git supports. The most important platforms include:
>
> Maybe it is just me, but when I hear "The most", I expect an
> exhaustive list (hence "include" that came later somewhat surprised
> me), and I consider these "the more important systems" (implying
> "than others").
Fair point. Ideally, I would be able to just point to our platform
support policy, but that document stops short of defining what kind of
guarantees we give for each platform.
So what are our primary platforms? Based on the criteria we have it
would be Windows, Ubuntu and macOS because we have CI runners for these,
all of which are included. Providing support for the BSDs is nice, but
these are likely rather "secondary" platforms.
> > +=== Ease of use
> > +
> > +The build system SHOULD be both easy to use and easy to extend. While this is
> > +naturally a subjective metric it is likely not controversial to say that some
> > +build systems are considerably harder to use than others.
>
> If we want to pull RFC-2119/BCP-14 with shouting "SHOULD", we
> probably should use something similar in the previous "Platform
> support" section.
I think I originally wanted to use RFC-2119, but then noticed that it's
rather pointless. I'll stop shouting.
> > +=== IDE support
> > +=== Out-of-tree builds
>
> Cross platform builds (e.g., building for arm on x86-64 host)?
Oh, yes, that one is indeed an ommission in the current doc.
> > +=== Rust support
> > +
> > +Many long-time Git contributors are nowadays in favor of adopting Rust as a
> > +second language next to C. The build system SHOULD thus support Rust such that
> > +we do not have to reopen the discussion once we decide to pick up Rust.
>
> What reasons do you have in mind that, without spelling this out,
> Rust will be left behind while C is fully supported? If the build
> system can keep track of dependencies by knowing foo.o is made from
> foo.c and turning foo.c into foo.o takes running cc, it can do the
> same for rustc. Do you mean include file dependencies and the like?
> If the reason why we say "Language X needs to be supported" is
> because it is not enough to be able to run a compiler on source
> files written in the language, but it is also necessary to know when
> to run the compiler (i.e., by dependency tracking), it is better to
> spell it out.
Eli already did a good job of explaining this. While it should be
possible to "retrofit" Rust support to basically all build systems out
there, it certainly would be nice if we could hide away most of the
intricate details of how Rust code needs to be compiled. It can get
complex rather fast.
> In any case, instead of singling out Rust in the title, name the
> section "languate support", and give an enumeration of compilers
> languages, processors that we care about, just like we did for
> platforms. For exaple, we may not necessarily want to treat "C
> support, done as an afterthought of supporting C++" and "C support,
> done natively" as equivalents (of course, the latter is better).
That makes sense to me, will do.
> Shouldn't it also "support" asciidoc/asciidoctor/makeinfo for
> the documentation toolchain?
It certainly should be flexible enough to allow for this, yes.
> Are there other things we use Makefile for in our current system
> that we are forgetting in this requirements section, like "running
> lint" or "running tests"?
I was a bit torn on whether or not to add "running tests", mostly
because it was supported by all of the proposed build systems. But
that's probably not a good reason to not make this requirement explicit.
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH 04/21] t/lib-gpg: fix setup of GNUPGHOME in MinGW
2024-10-02 21:49 ` Eric Sunshine
@ 2024-10-07 10:18 ` Patrick Steinhardt
0 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-07 10:18 UTC (permalink / raw)
To: Eric Sunshine; +Cc: git, Eli Schwartz
On Wed, Oct 02, 2024 at 05:49:10PM -0400, Eric Sunshine wrote:
> On Wed, Oct 2, 2024 at 11:17 AM Patrick Steinhardt <ps@pks.im> wrote:
> > In "t/lib-gpg.sh" we set up the "GNUPGHOME" environment variable to
> > point to a test-specific diretcory. This is done by using "$PWD/gpghome"
>
> s/diretcory/directory/
Thanks, fixed.
> > as value, where "$PWD" is the current test's trash directory.
> >
> > This is broken for MinGW though because "$PWD" will use Windows-style
> > paths that contain drive letters. What we really want in this context is
> > a Unix-style path, which we can get by using `$(pwd)` instead.
>
> It's not clear from this description why Windows- vs. Unix-style paths
> only now become a problem but have not been a problem up to this
> point. Is it because PGP testing has always been disabled on Windows
> until now? Or some other reason?
I guess that nobody ever ran these tests on Windows with GnuPG
installed. It is installed in MinGW though because pacman pulls it in as
a dependency.
Anyway, I've amended the commit message accordingly.
Patrick
> > Adapt the code accordingly to fix tests using this library.
> >
> > Signed-off-by: Patrick Steinhardt <ps@pks.im>
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH 05/21] t3404: work around platform-specific behaviour on macOS 10.15
2024-10-02 21:43 ` Eric Sunshine
2024-10-03 15:15 ` Phillip Wood
@ 2024-10-07 10:18 ` Patrick Steinhardt
1 sibling, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-07 10:18 UTC (permalink / raw)
To: Eric Sunshine; +Cc: git, Eli Schwartz
On Wed, Oct 02, 2024 at 05:43:45PM -0400, Eric Sunshine wrote:
> On Wed, Oct 2, 2024 at 11:17 AM Patrick Steinhardt <ps@pks.im> wrote:
> > Two of our tests in t3404 use indented HERE docs where leading tabs on
> > some of the lines are actually relevant. The tabs do get removed though,
> > and we try to fix this up by using sed(1) to replace leading tabs in the
> > actual output, as well. But on macOS 10.15 this doesn't work as expected
> > and we somehow keep the tabs around in the actual output.
>
> I presume this nebulous explanation is due to the fact that the reason
> why macOS 10.15 exhibits this anomalous behavior is not yet known?
Yeah, I didn't thoroughly investigate this one but just wanted to have
it fixed. I was hitting so many platform-dependent issues left and right
that at some point I started to feel a bit tired.
> > Work around this issue by retaining the tabs.
> >
> > Signed-off-by: Patrick Steinhardt <ps@pks.im>
> > ---
> > diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
> > @@ -1917,18 +1917,17 @@ test_expect_success '--update-refs updates refs correctly' '
> > - cat >expect <<-\EOF &&
> > - Successfully rebased and updated refs/heads/update-refs.
> > - Updated the following refs with --update-refs:
> > - refs/heads/first
> > - refs/heads/no-conflict-branch
> > - refs/heads/second
> > - refs/heads/third
> > - EOF
> > + cat >expect <<\EOF &&
> > +Successfully rebased and updated refs/heads/update-refs.
> > +Updated the following refs with --update-refs:
> > + refs/heads/first
> > + refs/heads/no-conflict-branch
> > + refs/heads/second
> > + refs/heads/third
> > +EOF
>
> Although this works, the problem with this change (and its sibling
> later in the patch) is that someday someone is going to come along
> (say, for instance, a GSoC applicant doing a microproject) who submits
> a patch to (re-)"modernize" this test by using `<<-` to (re-)indent
> the heredoc body. A better approach would probably be to retain `<<-`
> and use q_to_tab():
>
> q_to_tab >expect <<-\EOF &&
> Qrefs/heads/first
> Q...
> Qrefs/heads/third
> EOF
Cute! Didn't know we even had this helper.
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH 05/21] t3404: work around platform-specific behaviour on macOS 10.15
2024-10-03 15:15 ` Phillip Wood
2024-10-03 22:22 ` Eric Sunshine
@ 2024-10-07 10:18 ` Patrick Steinhardt
1 sibling, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-07 10:18 UTC (permalink / raw)
To: phillip.wood; +Cc: Eric Sunshine, git, Eli Schwartz
On Thu, Oct 03, 2024 at 04:15:50PM +0100, Phillip Wood wrote:
> On 02/10/2024 22:43, Eric Sunshine wrote:
> > On Wed, Oct 2, 2024 at 11:17 AM Patrick Steinhardt <ps@pks.im> wrote:
> > > Two of our tests in t3404 use indented HERE docs where leading tabs on
> > > some of the lines are actually relevant. The tabs do get removed though,
> > > and we try to fix this up by using sed(1) to replace leading tabs in the
> > > actual output, as well. But on macOS 10.15 this doesn't work as expected
> > > and we somehow keep the tabs around in the actual output.
> >
> > I presume this nebulous explanation is due to the fact that the reason
> > why macOS 10.15 exhibits this anomalous behavior is not yet known?
>
> I suspect that the problem is that we use "\t" which is non-standard rather
> than a literal tab character in the sed expression.
Ah, that makes sense.
> > Although this works, the problem with this change (and its sibling
> > later in the patch) is that someday someone is going to come along
> > (say, for instance, a GSoC applicant doing a microproject) who submits
> > a patch to (re-)"modernize" this test by using `<<-` to (re-)indent
> > the heredoc body. A better approach would probably be to retain `<<-`
> > and use q_to_tab():
> >
> > q_to_tab >expect <<-\EOF &&
> > Qrefs/heads/first
> > Q...
> > Qrefs/heads/third
> > EOF
>
> I agree that using q_to_tab is a better approach here.
>
> These first few patches all look like useful fixes in their own right. I
> might be worth splitting them out into a separate series so they can
> progress independently of the build system changes.
Yeah, I'm certainly happy to split these out into a separate series. For
now I'll keep things in one, but will do so depending on how this series
progresses.
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH 05/21] t3404: work around platform-specific behaviour on macOS 10.15
2024-10-03 23:19 ` Junio C Hamano
@ 2024-10-07 10:18 ` Patrick Steinhardt
0 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-07 10:18 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Eric Sunshine, phillip.wood, git, Eli Schwartz
On Thu, Oct 03, 2024 at 04:19:07PM -0700, Junio C Hamano wrote:
> Eric Sunshine <sunshine@sunshineco.com> writes:
>
> >> I suspect that the problem is that we use "\t" which is non-standard
> >> rather than a literal tab character in the sed expression.
> >
> > Ah yes. The `sed` on macOS 10.15 would have been of an older
> > BSD-lineage than the more modern macOS versions, so that makes sense.
> > It wouldn't be a bad idea for the commit message to mention something
> > along those lines.
> >
> > (I always use literal TAB with `sed` for this precise reason, which
> > may explain why my eyes skipped right over the non-standard use of
> > "\t" or I just wasn't paying close enough attention, which is equally
> > likely.)
>
> I also learned sed with old BSD behaviour to be portable (I somehow
> thought it is not just "old BSD" but outside POSIX if you used "\t"
> and friends). Checking with
>
> $ git grep 'sed.*\\t' t/\*.sh
>
> shows that t3305 also has this problem. The ones in t3404 are from
> 4611884e (sequencer: notify user of --update-refs activity,
> 2022-07-19), while the other one is from e1c52539 (t3305: check
> notes fanout more carefully and robustly, 2020-02-03), both are
> relatively old. If people are not reporting issues, it may be an
> indication that sed implementations of BSD origin may have died off.
Probably. Curious that I didn't see issues in t3305.
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH 01/21] Documentation: add comparison of build systems
2024-10-07 10:18 ` Patrick Steinhardt
@ 2024-10-07 21:08 ` Junio C Hamano
0 siblings, 0 replies; 386+ messages in thread
From: Junio C Hamano @ 2024-10-07 21:08 UTC (permalink / raw)
To: Patrick Steinhardt; +Cc: git, Eli Schwartz
Patrick Steinhardt <ps@pks.im> writes:
>> Are there other things we use Makefile for in our current system
>> that we are forgetting in this requirements section, like "running
>> lint" or "running tests"?
>
> I was a bit torn on whether or not to add "running tests", mostly
> because it was supported by all of the proposed build systems. But
> that's probably not a good reason to not make this requirement explicit.
If a magic build system can omit tests that it can prove (by looking
at dependency graph) that they will not be affected with the change
I made to this single source file "builtin/cat-file.c", that would
certainly be welcome.
We can dream for build system that specifically cater to and know
intricate details of a language. We should also be able to dream of
such a thing ;-)
Thanks.
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH 15/21] Makefile: consistently use @PLACEHOLDER@ to substitute
2024-10-02 15:16 ` [RFC PATCH 15/21] Makefile: consistently use @PLACEHOLDER@ to substitute Patrick Steinhardt
@ 2024-10-08 14:04 ` Phillip Wood
2024-10-08 14:23 ` Patrick Steinhardt
0 siblings, 1 reply; 386+ messages in thread
From: Phillip Wood @ 2024-10-08 14:04 UTC (permalink / raw)
To: Patrick Steinhardt, git; +Cc: Eli Schwartz
Hi Patrick
On 02/10/2024 16:16, Patrick Steinhardt wrote:
> We have a bunch of placeholders in our scripts that we replace at build
> time, for example by using sed(1). These placeholders come in three
> different formats: @PLACEHOLDER@, @@PLACEHOLDER@@ and ++PLACEHOLDER++.
I agree that it's a good idea to stanardise on a single format here.
> Next to being inconsistent it also creates a bit of a problem with
> CMake, which only supports the first syntax.
I'm a bit confused - is this referring to CMake's "configure_file" command?
> To work around that we
> instead manually replace such strings via string operations, which is
> both a hassle and also removes safeguards that CMake has to verify that
> we didn't forget to replace any placeholders. Besides that, other build
> systems like Meson also support the CMake syntax.
>
> Unify our codebase to consistently use the syntax supported by such
> build systems.
Sounds good!
Phillip
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
> Makefile | 42 +++++++++---------
> configure.ac | 2 +-
> contrib/buildsystems/CMakeLists.txt | 34 +++++++-------
> generate-perl.sh | 2 +-
> git-cvsserver.perl | 2 +-
> git-instaweb.sh | 8 ++--
> git-request-pull.sh | 2 +-
> git-send-email.perl | 2 +-
> git-sh-i18n.sh | 6 +--
> git-sh-setup.sh | 6 +--
> git-svn.perl | 2 +-
> gitk-git/po/vi.po | 2 +-
> gitweb/Makefile | 44 +++++++++----------
> gitweb/gitweb.perl | 44 +++++++++----------
> perl/Git/I18N.pm | 6 +--
> perl/Git/LoadCPAN.pm | 6 +--
> .../header_templates/fixed_prefix.template.pl | 2 +-
> .../runtime_prefix.template.pl | 8 ++--
> unimplemented.sh | 2 +-
> wrap-for-bin.sh | 18 ++++----
> 20 files changed, 120 insertions(+), 120 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index e92ecd0c51..91e64c1222 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1552,10 +1552,10 @@ endif
>
> ifdef SANE_TOOL_PATH
> SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH))
> -BROKEN_PATH_FIX = 's|^\# @@BROKEN_PATH_FIX@@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|'
> +BROKEN_PATH_FIX = 's|^\# @BROKEN_PATH_FIX@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|'
> PATH := $(SANE_TOOL_PATH):${PATH}
> else
> -BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d'
> +BROKEN_PATH_FIX = '/^\# @BROKEN_PATH_FIX@$$/d'
> endif
>
> ifeq (,$(HOST_CPU))
> @@ -2524,13 +2524,13 @@ GIT-SCRIPT-DEFINES: FORCE
> define cmd_munge_script
> sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
> -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
> - -e 's|@@DIFF@@|$(DIFF_SQ)|' \
> - -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' \
> - -e 's/@@USE_GETTEXT_SCHEME@@/$(USE_GETTEXT_SCHEME)/g' \
> + -e 's|@DIFF@|$(DIFF_SQ)|' \
> + -e 's|@LOCALEDIR@|$(localedir_SQ)|g' \
> + -e 's/@USE_GETTEXT_SCHEME@/$(USE_GETTEXT_SCHEME)/g' \
> -e $(BROKEN_PATH_FIX) \
> - -e 's|@@GITWEBDIR@@|$(gitwebdir_SQ)|g' \
> - -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
> - -e 's|@@PAGER_ENV@@|$(PAGER_ENV_SQ)|g' \
> + -e 's|@GITWEBDIR@|$(gitwebdir_SQ)|g' \
> + -e 's|@PERL@|$(PERL_PATH_SQ)|g' \
> + -e 's|@PAGER_ENV@|$(PAGER_ENV_SQ)|g' \
> $@.sh >$@+
> endef
>
> @@ -2597,11 +2597,11 @@ GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile
> INSTLIBDIR='$(perllibdir_SQ)' && \
> INSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \
> INSTLIBDIR="$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}" && \
> - sed -e 's=@@PATHSEP@@=$(pathsep)=g' \
> - -e "s=@@INSTLIBDIR@@=$$INSTLIBDIR=g" \
> - -e 's=@@PERLLIBDIR_REL@@=$(perllibdir_relative_SQ)=g' \
> - -e 's=@@GITEXECDIR_REL@@=$(gitexecdir_relative_SQ)=g' \
> - -e 's=@@LOCALEDIR_REL@@=$(localedir_relative_SQ)=g' \
> + sed -e 's=@PATHSEP@=$(pathsep)=g' \
> + -e "s=@INSTLIBDIR@=$$INSTLIBDIR=g" \
> + -e 's=@PERLLIBDIR_REL@=$(perllibdir_relative_SQ)=g' \
> + -e 's=@GITEXECDIR_REL@=$(gitexecdir_relative_SQ)=g' \
> + -e 's=@LOCALEDIR_REL@=$(localedir_relative_SQ)=g' \
> $< >$@+ && \
> mv $@+ $@
>
> @@ -2617,7 +2617,7 @@ else # NO_PERL
> $(SCRIPT_PERL_GEN) git-instaweb: % : unimplemented.sh
> $(QUIET_GEN) \
> sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
> - -e 's|@@REASON@@|NO_PERL=$(NO_PERL)|g' \
> + -e 's|@REASON@|NO_PERL=$(NO_PERL)|g' \
> unimplemented.sh >$@+ && \
> chmod +x $@+ && \
> mv $@+ $@
> @@ -2638,13 +2638,13 @@ else # NO_PYTHON
> $(SCRIPT_PYTHON_GEN): % : unimplemented.sh
> $(QUIET_GEN) \
> sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
> - -e 's|@@REASON@@|NO_PYTHON=$(NO_PYTHON)|g' \
> + -e 's|@REASON@|NO_PYTHON=$(NO_PYTHON)|g' \
> unimplemented.sh >$@+ && \
> chmod +x $@+ && \
> mv $@+ $@
> endif # NO_PYTHON
>
> -CONFIGURE_RECIPE = sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
> +CONFIGURE_RECIPE = sed -e 's/@GIT_VERSION@/$(GIT_VERSION)/g' \
> configure.ac >configure.ac+ && \
> autoconf -o configure configure.ac+ && \
> $(RM) configure.ac+
> @@ -3073,9 +3073,9 @@ endif
> perl/build/lib/%.pm: perl/%.pm GIT-PERL-DEFINES
> $(call mkdir_p_parent_template)
> $(QUIET_GEN) \
> - sed -e 's|@@LOCALEDIR@@|$(perl_localedir_SQ)|g' \
> - -e 's|@@NO_GETTEXT@@|$(NO_GETTEXT_SQ)|g' \
> - -e 's|@@NO_PERL_CPAN_FALLBACKS@@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \
> + sed -e 's|@LOCALEDIR@|$(perl_localedir_SQ)|g' \
> + -e 's|@NO_GETTEXT@|$(NO_GETTEXT_SQ)|g' \
> + -e 's|@NO_PERL_CPAN_FALLBACKS@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \
> < $< > $@
>
> perl/build/man/man3/Git.3pm: perl/Git.pm
> @@ -3192,8 +3192,8 @@ all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PR
> bin-wrappers/%: wrap-for-bin.sh
> $(call mkdir_p_parent_template)
> $(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
> - -e 's|@@BUILD_DIR@@|$(shell pwd)|' \
> - -e 's|@@PROG@@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
> + -e 's|@BUILD_DIR@|$(shell pwd)|' \
> + -e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
> chmod +x $@
>
> # GNU make supports exporting all variables by "export" without parameters.
> diff --git a/configure.ac b/configure.ac
> index d1a96da14e..5923edc44a 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -142,7 +142,7 @@ fi
> ## Configure body starts here.
>
> AC_PREREQ(2.59)
> -AC_INIT([git], [@@GIT_VERSION@@], [git@vger.kernel.org])
> +AC_INIT([git], [@GIT_VERSION@], [git@vger.kernel.org])
>
> AC_CONFIG_SRCDIR([git.c])
>
> diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
> index 2ba15155b3..bf029b9428 100644
> --- a/contrib/buildsystems/CMakeLists.txt
> +++ b/contrib/buildsystems/CMakeLists.txt
> @@ -833,14 +833,14 @@ set(git_shell_scripts
> foreach(script ${git_shell_scripts})
> file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.sh content NEWLINE_CONSUME)
> string(REPLACE "@SHELL_PATH@" "${SHELL_PATH}" content "${content}")
> - string(REPLACE "@@DIFF@@" "diff" content "${content}")
> + string(REPLACE "@DIFF@" "diff" content "${content}")
> string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}")
> string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" content "${content}")
> - string(REPLACE "@@NO_CURL@@" "" content "${content}")
> - string(REPLACE "@@USE_GETTEXT_SCHEME@@" "" content "${content}")
> - string(REPLACE "# @@BROKEN_PATH_FIX@@" "" content "${content}")
> - string(REPLACE "@@PERL@@" "${PERL_PATH}" content "${content}")
> - string(REPLACE "@@PAGER_ENV@@" "LESS=FRX LV=-c" content "${content}")
> + string(REPLACE "@NO_CURL@" "" content "${content}")
> + string(REPLACE "@USE_GETTEXT_SCHEME@" "" content "${content}")
> + string(REPLACE "# @BROKEN_PATH_FIX@" "" content "${content}")
> + string(REPLACE "@PERL@" "${PERL_PATH}" content "${content}")
> + string(REPLACE "@PAGER_ENV@" "LESS=FRX LV=-c" content "${content}")
> file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
> endforeach()
>
> @@ -849,13 +849,13 @@ parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" ".perl")
>
> #create perl header
> file(STRINGS ${CMAKE_SOURCE_DIR}/perl/header_templates/fixed_prefix.template.pl perl_header )
> -string(REPLACE "@@PATHSEP@@" ":" perl_header "${perl_header}")
> -string(REPLACE "@@INSTLIBDIR@@" "${INSTLIBDIR}" perl_header "${perl_header}")
> +string(REPLACE "@PATHSEP@" ":" perl_header "${perl_header}")
> +string(REPLACE "@INSTLIBDIR@" "${INSTLIBDIR}" perl_header "${perl_header}")
>
> foreach(script ${git_perl_scripts})
> file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.perl content NEWLINE_CONSUME)
> string(REPLACE "#!/usr/bin/perl" "#!/usr/bin/perl\n${perl_header}\n" content "${content}")
> - string(REPLACE "@@GIT_VERSION@@" "${PROJECT_VERSION}" content "${content}")
> + string(REPLACE "@GIT_VERSION@" "${PROJECT_VERSION}" content "${content}")
> file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
> endforeach()
>
> @@ -870,8 +870,8 @@ file(GLOB_RECURSE perl_modules "${CMAKE_SOURCE_DIR}/perl/*.pm")
> foreach(pm ${perl_modules})
> string(REPLACE "${CMAKE_SOURCE_DIR}/perl/" "" file_path ${pm})
> file(STRINGS ${pm} content NEWLINE_CONSUME)
> - string(REPLACE "@@LOCALEDIR@@" "${LOCALEDIR}" content "${content}")
> - string(REPLACE "@@NO_PERL_CPAN_FALLBACKS@@" "" content "${content}")
> + string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}")
> + string(REPLACE "@NO_PERL_CPAN_FALLBACKS@" "" content "${content}")
> file(WRITE ${CMAKE_BINARY_DIR}/perl/build/lib/${file_path} ${content})
> #test-lib.sh requires perl/build/lib to be the build directory of perl modules
> endforeach()
> @@ -1079,21 +1079,21 @@ set(wrapper_test_scripts
>
> foreach(script ${wrapper_scripts})
> file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
> - string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
> - string(REPLACE "@@PROG@@" "${script}${EXE_EXTENSION}" content "${content}")
> + string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
> + string(REPLACE "@PROG@" "${script}${EXE_EXTENSION}" content "${content}")
> file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
> endforeach()
>
> foreach(script ${wrapper_test_scripts})
> file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
> - string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
> - string(REPLACE "@@PROG@@" "t/helper/${script}${EXE_EXTENSION}" content "${content}")
> + string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
> + string(REPLACE "@PROG@" "t/helper/${script}${EXE_EXTENSION}" content "${content}")
> file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
> endforeach()
>
> file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
> -string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
> -string(REPLACE "@@PROG@@" "git-cvsserver" content "${content}")
> +string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
> +string(REPLACE "@PROG@" "git-cvsserver" content "${content}")
> file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})
>
> #options for configuring test options
> diff --git a/generate-perl.sh b/generate-perl.sh
> index b9e04d6f42..41d78da029 100755
> --- a/generate-perl.sh
> +++ b/generate-perl.sh
> @@ -17,6 +17,6 @@ sed -e '1{' \
> -e " r $PERL_HEADER" \
> -e ' G' \
> -e '}' \
> - -e "s/@@GIT_VERSION@@/$GIT_VERSION/g" \
> + -e "s/@GIT_VERSION@/$GIT_VERSION/g" \
> "$PERL_SCRIPT" >"$OUT"
> chmod a+x "$OUT"
> diff --git a/git-cvsserver.perl b/git-cvsserver.perl
> index 124f598bdc..70ae7cb8e4 100755
> --- a/git-cvsserver.perl
> +++ b/git-cvsserver.perl
> @@ -26,7 +26,7 @@
> use File::Basename;
> use Getopt::Long qw(:config require_order no_ignore_case);
>
> -my $VERSION = '@@GIT_VERSION@@';
> +my $VERSION = '@GIT_VERSION@';
>
> my $log = GITCVS::log->new();
> my $cfg;
> diff --git a/git-instaweb.sh b/git-instaweb.sh
> index 8dbe21d588..c8efb1205a 100755
> --- a/git-instaweb.sh
> +++ b/git-instaweb.sh
> @@ -3,7 +3,7 @@
> # Copyright (c) 2006 Eric Wong
> #
>
> -PERL='@@PERL@@'
> +PERL='@PERL@'
> OPTIONS_KEEPDASHDASH=
> OPTIONS_STUCKLONG=
> OPTIONS_SPEC="\
> @@ -38,8 +38,8 @@ conf="$GIT_DIR/gitweb/httpd.conf"
> # if installed, it doesn't need further configuration (module_path)
> test -z "$httpd" && httpd='lighttpd -f'
>
> -# Default is @@GITWEBDIR@@
> -test -z "$root" && root='@@GITWEBDIR@@'
> +# Default is @GITWEBDIR@
> +test -z "$root" && root='@GITWEBDIR@'
>
> # any untaken local port will do...
> test -z "$port" && port=1234
> @@ -716,7 +716,7 @@ EOF
>
> gitweb_conf() {
> cat > "$fqgitdir/gitweb/gitweb_config.perl" <<EOF
> -#!@@PERL@@
> +#!@PERL@
> our \$projectroot = "$(dirname "$fqgitdir")";
> our \$git_temp = "$fqgitdir/gitweb/tmp";
> our \$projects_list = \$projectroot;
> diff --git a/git-request-pull.sh b/git-request-pull.sh
> index 01640a044b..10c88639e2 100755
> --- a/git-request-pull.sh
> +++ b/git-request-pull.sh
> @@ -112,7 +112,7 @@ find_matching_ref='
> }
> '
>
> -set fnord $(git ls-remote "$url" | @@PERL@@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
> +set fnord $(git ls-remote "$url" | @PERL@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
> remote_sha1=$2
> ref=$3
>
> diff --git a/git-send-email.perl b/git-send-email.perl
> index c835d4c11a..02805c43e5 100755
> --- a/git-send-email.perl
> +++ b/git-send-email.perl
> @@ -1501,7 +1501,7 @@ sub gen_header {
> @recipients = unique_email_list(@recipients,@cc,@initial_bcc);
> @recipients = (map { extract_valid_address_or_die($_) } @recipients);
> my $date = format_2822_time($time++);
> - my $gitversion = '@@GIT_VERSION@@';
> + my $gitversion = '@GIT_VERSION@';
> if ($gitversion =~ m/..GIT_VERSION../) {
> $gitversion = Git::version();
> }
> diff --git a/git-sh-i18n.sh b/git-sh-i18n.sh
> index a15c0620db..ae4b2d6ba9 100644
> --- a/git-sh-i18n.sh
> +++ b/git-sh-i18n.sh
> @@ -9,7 +9,7 @@ TEXTDOMAIN=git
> export TEXTDOMAIN
> if test -z "$GIT_TEXTDOMAINDIR"
> then
> - TEXTDOMAINDIR="@@LOCALEDIR@@"
> + TEXTDOMAINDIR="@LOCALEDIR@"
> else
> TEXTDOMAINDIR="$GIT_TEXTDOMAINDIR"
> fi
> @@ -17,9 +17,9 @@ export TEXTDOMAINDIR
>
> # First decide what scheme to use...
> GIT_INTERNAL_GETTEXT_SH_SCHEME=fallthrough
> -if test -n "@@USE_GETTEXT_SCHEME@@"
> +if test -n "@USE_GETTEXT_SCHEME@"
> then
> - GIT_INTERNAL_GETTEXT_SH_SCHEME="@@USE_GETTEXT_SCHEME@@"
> + GIT_INTERNAL_GETTEXT_SH_SCHEME="@USE_GETTEXT_SCHEME@"
> elif test -n "$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS"
> then
> : no probing necessary
> diff --git a/git-sh-setup.sh b/git-sh-setup.sh
> index ce273fe0e4..19aef72ec2 100644
> --- a/git-sh-setup.sh
> +++ b/git-sh-setup.sh
> @@ -41,7 +41,7 @@ git_broken_path_fix () {
> esac
> }
>
> -# @@BROKEN_PATH_FIX@@
> +# @BROKEN_PATH_FIX@
>
> # Source git-sh-i18n for gettext support.
> . "$(git --exec-path)/git-sh-i18n"
> @@ -154,7 +154,7 @@ git_pager() {
> else
> GIT_PAGER=cat
> fi
> - for vardef in @@PAGER_ENV@@
> + for vardef in @PAGER_ENV@
> do
> var=${vardef%%=*}
> eval ": \"\${$vardef}\" && export $var"
> @@ -280,7 +280,7 @@ get_author_ident_from_commit () {
> # remove lines from $1 that are not in $2, leaving only common lines.
> create_virtual_base() {
> sz0=$(wc -c <"$1")
> - @@DIFF@@ -u -La/"$1" -Lb/"$1" "$1" "$2" | git apply --no-add
> + @DIFF@ -u -La/"$1" -Lb/"$1" "$1" "$2" | git apply --no-add
> sz1=$(wc -c <"$1")
>
> # If we do not have enough common material, it is not
> diff --git a/git-svn.perl b/git-svn.perl
> index 01e7a70de1..dcf65cf1d1 100755
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -9,7 +9,7 @@
> $_revision $_repository
> $_q $_authors $_authors_prog %users/;
> $AUTHOR = 'Eric Wong <normalperson@yhbt.net>';
> -$VERSION = '@@GIT_VERSION@@';
> +$VERSION = '@GIT_VERSION@';
>
> use Carp qw/croak/;
> use File::Basename qw/dirname basename/;
> diff --git a/gitk-git/po/vi.po b/gitk-git/po/vi.po
> index 5967498660..184430dcde 100644
> --- a/gitk-git/po/vi.po
> +++ b/gitk-git/po/vi.po
> @@ -5,7 +5,7 @@
> #
> msgid ""
> msgstr ""
> -"Project-Id-Version: gitk @@GIT_VERSION@@\n"
> +"Project-Id-Version: gitk @GIT_VERSION@\n"
> "Report-Msgid-Bugs-To: \n"
> "POT-Creation-Date: 2015-05-17 14:32+1000\n"
> "PO-Revision-Date: 2015-09-15 07:33+0700\n"
> diff --git a/gitweb/Makefile b/gitweb/Makefile
> index 3b68ab2d67..164c8d5375 100644
> --- a/gitweb/Makefile
> +++ b/gitweb/Makefile
> @@ -79,28 +79,28 @@ GITWEB_JSLIB_FILES += static/js/blame_incremental.js
>
>
> GITWEB_REPLACE = \
> - -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
> - -e 's|++GIT_BINDIR++|$(bindir)|g' \
> - -e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \
> - -e 's|++GITWEB_CONFIG_SYSTEM++|$(GITWEB_CONFIG_SYSTEM)|g' \
> - -e 's|++GITWEB_CONFIG_COMMON++|$(GITWEB_CONFIG_COMMON)|g' \
> - -e 's|++GITWEB_HOME_LINK_STR++|$(GITWEB_HOME_LINK_STR)|g' \
> - -e 's|++GITWEB_SITENAME++|$(GITWEB_SITENAME)|g' \
> - -e 's|++GITWEB_PROJECTROOT++|$(GITWEB_PROJECTROOT)|g' \
> - -e 's|"++GITWEB_PROJECT_MAXDEPTH++"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
> - -e 's|++GITWEB_EXPORT_OK++|$(GITWEB_EXPORT_OK)|g' \
> - -e 's|++GITWEB_STRICT_EXPORT++|$(GITWEB_STRICT_EXPORT)|g' \
> - -e 's|++GITWEB_BASE_URL++|$(GITWEB_BASE_URL)|g' \
> - -e 's|++GITWEB_LIST++|$(GITWEB_LIST)|g' \
> - -e 's|++GITWEB_HOMETEXT++|$(GITWEB_HOMETEXT)|g' \
> - -e 's|++GITWEB_CSS++|$(GITWEB_CSS)|g' \
> - -e 's|++GITWEB_LOGO++|$(GITWEB_LOGO)|g' \
> - -e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \
> - -e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \
> - -e 's|++GITWEB_SITE_HTML_HEAD_STRING++|$(GITWEB_SITE_HTML_HEAD_STRING)|g' \
> - -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \
> - -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \
> - -e 's|++HIGHLIGHT_BIN++|$(HIGHLIGHT_BIN)|g'
> + -e 's|@GIT_VERSION@|$(GIT_VERSION)|g' \
> + -e 's|@GIT_BINDIR@|$(bindir)|g' \
> + -e 's|@GITWEB_CONFIG@|$(GITWEB_CONFIG)|g' \
> + -e 's|@GITWEB_CONFIG_SYSTEM@|$(GITWEB_CONFIG_SYSTEM)|g' \
> + -e 's|@GITWEB_CONFIG_COMMON@|$(GITWEB_CONFIG_COMMON)|g' \
> + -e 's|@GITWEB_HOME_LINK_STR@|$(GITWEB_HOME_LINK_STR)|g' \
> + -e 's|@GITWEB_SITENAME@|$(GITWEB_SITENAME)|g' \
> + -e 's|@GITWEB_PROJECTROOT@|$(GITWEB_PROJECTROOT)|g' \
> + -e 's|"@GITWEB_PROJECT_MAXDEPTH@"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
> + -e 's|@GITWEB_EXPORT_OK@|$(GITWEB_EXPORT_OK)|g' \
> + -e 's|@GITWEB_STRICT_EXPORT@|$(GITWEB_STRICT_EXPORT)|g' \
> + -e 's|@GITWEB_BASE_URL@|$(GITWEB_BASE_URL)|g' \
> + -e 's|@GITWEB_LIST@|$(GITWEB_LIST)|g' \
> + -e 's|@GITWEB_HOMETEXT@|$(GITWEB_HOMETEXT)|g' \
> + -e 's|@GITWEB_CSS@|$(GITWEB_CSS)|g' \
> + -e 's|@GITWEB_LOGO@|$(GITWEB_LOGO)|g' \
> + -e 's|@GITWEB_FAVICON@|$(GITWEB_FAVICON)|g' \
> + -e 's|@GITWEB_JS@|$(GITWEB_JS)|g' \
> + -e 's|@GITWEB_SITE_HTML_HEAD_STRING@|$(GITWEB_SITE_HTML_HEAD_STRING)|g' \
> + -e 's|@GITWEB_SITE_HEADER@|$(GITWEB_SITE_HEADER)|g' \
> + -e 's|@GITWEB_SITE_FOOTER@|$(GITWEB_SITE_FOOTER)|g' \
> + -e 's|@HIGHLIGHT_BIN@|$(HIGHLIGHT_BIN)|g'
>
> .PHONY: FORCE
> $(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS: FORCE
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index b09a8d0523..76e1f4e244 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -35,7 +35,7 @@ BEGIN
> CGI->compile() if $ENV{'MOD_PERL'};
> }
>
> -our $version = "++GIT_VERSION++";
> +our $version = "@GIT_VERSION@";
>
> our ($my_url, $my_uri, $base_url, $path_info, $home_link);
> sub evaluate_uri {
> @@ -80,46 +80,46 @@ sub evaluate_uri {
>
> # core git executable to use
> # this can just be "git" if your webserver has a sensible PATH
> -our $GIT = "++GIT_BINDIR++/git";
> +our $GIT = "@GIT_BINDIR@/git";
>
> # absolute fs-path which will be prepended to the project path
> #our $projectroot = "/pub/scm";
> -our $projectroot = "++GITWEB_PROJECTROOT++";
> +our $projectroot = "@GITWEB_PROJECTROOT@";
>
> # fs traversing limit for getting project list
> # the number is relative to the projectroot
> -our $project_maxdepth = "++GITWEB_PROJECT_MAXDEPTH++";
> +our $project_maxdepth = "@GITWEB_PROJECT_MAXDEPTH@";
>
> # string of the home link on top of all pages
> -our $home_link_str = "++GITWEB_HOME_LINK_STR++";
> +our $home_link_str = "@GITWEB_HOME_LINK_STR@";
>
> # extra breadcrumbs preceding the home link
> our @extra_breadcrumbs = ();
>
> # name of your site or organization to appear in page titles
> # replace this with something more descriptive for clearer bookmarks
> -our $site_name = "++GITWEB_SITENAME++"
> +our $site_name = "@GITWEB_SITENAME@"
> || ($ENV{'SERVER_NAME'} || "Untitled") . " Git";
>
> # html snippet to include in the <head> section of each page
> -our $site_html_head_string = "++GITWEB_SITE_HTML_HEAD_STRING++";
> +our $site_html_head_string = "@GITWEB_SITE_HTML_HEAD_STRING@";
> # filename of html text to include at top of each page
> -our $site_header = "++GITWEB_SITE_HEADER++";
> +our $site_header = "@GITWEB_SITE_HEADER@";
> # html text to include at home page
> -our $home_text = "++GITWEB_HOMETEXT++";
> +our $home_text = "@GITWEB_HOMETEXT@";
> # filename of html text to include at bottom of each page
> -our $site_footer = "++GITWEB_SITE_FOOTER++";
> +our $site_footer = "@GITWEB_SITE_FOOTER@";
>
> # URI of stylesheets
> -our @stylesheets = ("++GITWEB_CSS++");
> +our @stylesheets = ("@GITWEB_CSS@");
> # URI of a single stylesheet, which can be overridden in GITWEB_CONFIG.
> our $stylesheet = undef;
> # URI of GIT logo (72x27 size)
> -our $logo = "++GITWEB_LOGO++";
> +our $logo = "@GITWEB_LOGO@";
> # URI of GIT favicon, assumed to be image/png type
> -our $favicon = "++GITWEB_FAVICON++";
> +our $favicon = "@GITWEB_FAVICON@";
> # URI of gitweb.js (JavaScript code for gitweb)
> -our $javascript = "++GITWEB_JS++";
> +our $javascript = "@GITWEB_JS@";
>
> # URI and label (title) of GIT logo link
> #our $logo_url = "https://www.kernel.org/pub/software/scm/git/docs/";
> @@ -128,7 +128,7 @@ sub evaluate_uri {
> our $logo_label = "git homepage";
>
> # source of projects list
> -our $projects_list = "++GITWEB_LIST++";
> +our $projects_list = "@GITWEB_LIST@";
>
> # the width (in characters) of the projects list "Description" column
> our $projects_list_description_width = 25;
> @@ -147,7 +147,7 @@ sub evaluate_uri {
>
> # show repository only if this file exists
> # (only effective if this variable evaluates to true)
> -our $export_ok = "++GITWEB_EXPORT_OK++";
> +our $export_ok = "@GITWEB_EXPORT_OK@";
>
> # don't generate age column on the projects list page
> our $omit_age_column = 0;
> @@ -161,11 +161,11 @@ sub evaluate_uri {
> our $export_auth_hook = undef;
>
> # only allow viewing of repositories also shown on the overview page
> -our $strict_export = "++GITWEB_STRICT_EXPORT++";
> +our $strict_export = "@GITWEB_STRICT_EXPORT@";
>
> # list of git base URLs used for URL to where fetch project from,
> # i.e. full URL is "$git_base_url/$project"
> -our @git_base_url_list = grep { $_ ne '' } ("++GITWEB_BASE_URL++");
> +our @git_base_url_list = grep { $_ ne '' } ("@GITWEB_BASE_URL@");
>
> # default blob_plain mimetype and default charset for text/plain blob
> our $default_blob_plain_mimetype = 'text/plain';
> @@ -200,7 +200,7 @@ sub evaluate_uri {
> # http://andre-simon.de/zip/download.php due to assumptions about parameters and output).
> # Useful if highlight is not installed on your webserver's PATH.
> # [Default: highlight]
> -our $highlight_bin = "++HIGHLIGHT_BIN++";
> +our $highlight_bin = "@HIGHLIGHT_BIN@";
>
> # information about snapshot formats that gitweb is capable of serving
> our %known_snapshot_formats = (
> @@ -741,9 +741,9 @@ sub read_config_file {
>
> our ($GITWEB_CONFIG, $GITWEB_CONFIG_SYSTEM, $GITWEB_CONFIG_COMMON);
> sub evaluate_gitweb_config {
> - our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "++GITWEB_CONFIG++";
> - our $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || "++GITWEB_CONFIG_SYSTEM++";
> - our $GITWEB_CONFIG_COMMON = $ENV{'GITWEB_CONFIG_COMMON'} || "++GITWEB_CONFIG_COMMON++";
> + our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "@GITWEB_CONFIG@";
> + our $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || "@GITWEB_CONFIG_SYSTEM@";
> + our $GITWEB_CONFIG_COMMON = $ENV{'GITWEB_CONFIG_COMMON'} || "@GITWEB_CONFIG_COMMON@";
>
> # Protect against duplications of file names, to not read config twice.
> # Only one of $GITWEB_CONFIG and $GITWEB_CONFIG_SYSTEM is used, so
> diff --git a/perl/Git/I18N.pm b/perl/Git/I18N.pm
> index 5454c3a6d2..1da830c98a 100644
> --- a/perl/Git/I18N.pm
> +++ b/perl/Git/I18N.pm
> @@ -20,14 +20,14 @@ BEGIN
> # this "'@@' [...] '@@'" pattern.
> use constant NO_GETTEXT_STR => '@@' . 'NO_GETTEXT' . '@@';
> use constant NO_GETTEXT => (
> - q[@@NO_GETTEXT@@] ne ''
> + q[@NO_GETTEXT@] ne ''
> and
> - q[@@NO_GETTEXT@@] ne NO_GETTEXT_STR
> + q[@NO_GETTEXT@] ne NO_GETTEXT_STR
> );
>
> sub __bootstrap_locale_messages {
> our $TEXTDOMAIN = 'git';
> - our $TEXTDOMAINDIR ||= $ENV{GIT_TEXTDOMAINDIR} || '@@LOCALEDIR@@';
> + our $TEXTDOMAINDIR ||= $ENV{GIT_TEXTDOMAINDIR} || '@LOCALEDIR@';
> die "NO_GETTEXT=" . NO_GETTEXT_STR if NO_GETTEXT;
>
> require POSIX;
> diff --git a/perl/Git/LoadCPAN.pm b/perl/Git/LoadCPAN.pm
> index 8c7fa805f9..6be99840f8 100644
> --- a/perl/Git/LoadCPAN.pm
> +++ b/perl/Git/LoadCPAN.pm
> @@ -31,11 +31,11 @@ =head1 DESCRIPTION
> # Makefile, and allows for detecting whether the module is loaded from
> # perl/Git as opposed to perl/build/Git, which is useful for one-off
> # testing without having Error.pm et al installed.
> -use constant NO_PERL_CPAN_FALLBACKS_STR => '@@' . 'NO_PERL_CPAN_FALLBACKS' . '@@';
> +use constant NO_PERL_CPAN_FALLBACKS_STR => '@' . 'NO_PERL_CPAN_FALLBACKS' . '@';
> use constant NO_PERL_CPAN_FALLBACKS => (
> - q[@@NO_PERL_CPAN_FALLBACKS@@] ne ''
> + q[@NO_PERL_CPAN_FALLBACKS@] ne ''
> and
> - q[@@NO_PERL_CPAN_FALLBACKS@@] ne NO_PERL_CPAN_FALLBACKS_STR
> + q[@NO_PERL_CPAN_FALLBACKS@] ne NO_PERL_CPAN_FALLBACKS_STR
> );
>
> sub import {
> diff --git a/perl/header_templates/fixed_prefix.template.pl b/perl/header_templates/fixed_prefix.template.pl
> index 857b4391a4..d571ca5cde 100644
> --- a/perl/header_templates/fixed_prefix.template.pl
> +++ b/perl/header_templates/fixed_prefix.template.pl
> @@ -1 +1 @@
> -use lib (split(/@@PATHSEP@@/, $ENV{GITPERLLIB} || '@@INSTLIBDIR@@'));
> +use lib (split(/@PATHSEP@/, $ENV{GITPERLLIB} || '@INSTLIBDIR@'));
> diff --git a/perl/header_templates/runtime_prefix.template.pl b/perl/header_templates/runtime_prefix.template.pl
> index 9d28b3d863..e6f8e661a1 100644
> --- a/perl/header_templates/runtime_prefix.template.pl
> +++ b/perl/header_templates/runtime_prefix.template.pl
> @@ -3,7 +3,7 @@
> # This finds our Git::* libraries relative to the script's runtime path.
> sub __git_system_path {
> my ($relpath) = @_;
> - my $gitexecdir_relative = '@@GITEXECDIR_REL@@';
> + my $gitexecdir_relative = '@GITEXECDIR_REL@';
>
> # GIT_EXEC_PATH is supplied by `git` or the test suite.
> my $exec_path;
> @@ -24,11 +24,11 @@ sub __git_system_path {
> }
>
> BEGIN {
> - use lib split /@@PATHSEP@@/,
> + use lib split /@PATHSEP@/,
> (
> $ENV{GITPERLLIB} ||
> do {
> - my $perllibdir = __git_system_path('@@PERLLIBDIR_REL@@');
> + my $perllibdir = __git_system_path('@PERLLIBDIR_REL@');
> (-e $perllibdir) || die("Invalid system path ($relpath): $path");
> $perllibdir;
> }
> @@ -36,7 +36,7 @@ BEGIN
>
> # Export the system locale directory to the I18N module. The locale directory
> # is only installed if NO_GETTEXT is set.
> - $Git::I18N::TEXTDOMAINDIR = __git_system_path('@@LOCALEDIR_REL@@');
> + $Git::I18N::TEXTDOMAINDIR = __git_system_path('@LOCALEDIR_REL@');
> }
>
> # END RUNTIME_PREFIX generated code.
> diff --git a/unimplemented.sh b/unimplemented.sh
> index fee21d24e8..41776b279d 100644
> --- a/unimplemented.sh
> +++ b/unimplemented.sh
> @@ -1,4 +1,4 @@
> #!/bin/sh
>
> -echo >&2 "fatal: git was built without support for $(basename $0) (@@REASON@@)."
> +echo >&2 "fatal: git was built without support for $(basename $0) (@REASON@)."
> exit 128
> diff --git a/wrap-for-bin.sh b/wrap-for-bin.sh
> index 95851b85b6..7898a1c238 100644
> --- a/wrap-for-bin.sh
> +++ b/wrap-for-bin.sh
> @@ -4,33 +4,33 @@
> # to run test suite against sandbox, but with only bindir-installed
> # executables in PATH. The Makefile copies this into various
> # files in bin-wrappers, substituting
> -# @@BUILD_DIR@@ and @@PROG@@.
> +# @BUILD_DIR@ and @PROG@.
>
> -GIT_EXEC_PATH='@@BUILD_DIR@@'
> +GIT_EXEC_PATH='@BUILD_DIR@'
> if test -n "$NO_SET_GIT_TEMPLATE_DIR"
> then
> unset GIT_TEMPLATE_DIR
> else
> - GIT_TEMPLATE_DIR='@@BUILD_DIR@@/templates/blt'
> + GIT_TEMPLATE_DIR='@BUILD_DIR@/templates/blt'
> export GIT_TEMPLATE_DIR
> fi
> -GITPERLLIB='@@BUILD_DIR@@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}"
> -GIT_TEXTDOMAINDIR='@@BUILD_DIR@@/po/build/locale'
> -PATH='@@BUILD_DIR@@/bin-wrappers:'"$PATH"
> +GITPERLLIB='@BUILD_DIR@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}"
> +GIT_TEXTDOMAINDIR='@BUILD_DIR@/po/build/locale'
> +PATH='@BUILD_DIR@/bin-wrappers:'"$PATH"
>
> export GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
>
> case "$GIT_DEBUGGER" in
> '')
> - exec "${GIT_EXEC_PATH}/@@PROG@@" "$@"
> + exec "${GIT_EXEC_PATH}/@PROG@" "$@"
> ;;
> 1)
> unset GIT_DEBUGGER
> - exec gdb --args "${GIT_EXEC_PATH}/@@PROG@@" "$@"
> + exec gdb --args "${GIT_EXEC_PATH}/@PROG@" "$@"
> ;;
> *)
> GIT_DEBUGGER_ARGS="$GIT_DEBUGGER"
> unset GIT_DEBUGGER
> - exec ${GIT_DEBUGGER_ARGS} "${GIT_EXEC_PATH}/@@PROG@@" "$@"
> + exec ${GIT_DEBUGGER_ARGS} "${GIT_EXEC_PATH}/@PROG@" "$@"
> ;;
> esac
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH 20/21] t: allow overriding build dir
2024-10-02 15:16 ` [RFC PATCH 20/21] t: allow overriding build dir Patrick Steinhardt
@ 2024-10-08 14:04 ` Phillip Wood
2024-10-08 14:23 ` Patrick Steinhardt
0 siblings, 1 reply; 386+ messages in thread
From: Phillip Wood @ 2024-10-08 14:04 UTC (permalink / raw)
To: Patrick Steinhardt, git; +Cc: Eli Schwartz
Hi Patrick
On 02/10/2024 16:16, Patrick Steinhardt wrote:
> Our "test-lib.sh" assumes that our build directory is the parent
> directory of "t/". While true when using our Makefile, it's not when
> using build systems that support out-of-tree builds.
>
> Allow such build systems to override the location of the build directory
> with an environment variable.
ee9e66e4e76 (cmake: avoid editing t/test-lib.sh, 2022-10-18) added
support for reading the "real" build directory from
"$GIT_BUILD_DIR/GIT-BUILD-DIR". Using an environment variable is fine
when running the tests from the build system but it is a pain to have to
set it when running them manually.
Best Wishes
Phillip
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
> t/test-lib.sh | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/t/test-lib.sh b/t/test-lib.sh
> index e36a21ddf7..6f862621af 100644
> --- a/t/test-lib.sh
> +++ b/t/test-lib.sh
> @@ -35,7 +35,7 @@ else
> # needing to exist.
> TEST_DIRECTORY=$(cd "$TEST_DIRECTORY" && pwd) || exit 1
> fi
> -GIT_BUILD_DIR="${TEST_DIRECTORY%/t}"
> +GIT_BUILD_DIR="${GIT_BUILD_DIR:-${TEST_DIRECTORY%/t}}"
> if test "$TEST_DIRECTORY" = "$GIT_BUILD_DIR"
> then
> echo "PANIC: Running in a $TEST_DIRECTORY that doesn't end in '/t'?" >&2
> @@ -514,6 +514,7 @@ unset VISUAL EMAIL LANGUAGE $("$PERL_PATH" -e '
> PERF_
> CURL_VERBOSE
> TRACE_CURL
> + BUILD_DIR
> ));
> my @vars = grep(/^GIT_/ && !/^GIT_($ok)/o, @env);
> print join("\n", @vars);
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH 00/21] Modernize the build system
2024-10-02 15:15 [RFC PATCH 00/21] Modernize the build system Patrick Steinhardt
` (20 preceding siblings ...)
2024-10-02 15:16 ` [RFC PATCH 21/21] Introduce support for the Meson build system Patrick Steinhardt
@ 2024-10-08 14:11 ` Phillip Wood
2024-10-08 14:23 ` Patrick Steinhardt
2024-10-09 14:56 ` [RFC PATCH v2 00/24] Modernize our " Patrick Steinhardt
` (9 subsequent siblings)
31 siblings, 1 reply; 386+ messages in thread
From: Phillip Wood @ 2024-10-08 14:11 UTC (permalink / raw)
To: Patrick Steinhardt, git; +Cc: Eli Schwartz
Hi Patrick
On 02/10/2024 16:15, Patrick Steinhardt wrote:
>
> - Patches 2 to 9 fix various different bugs I have found while working
> on many different platforms. They can likely go into the tree
> separately, and I'm happy to split these out into a separate patch
> series if we want to.
These all look like useful improvements in their own right, splitting
them out would make sense to me.
> - Patches 10 to 20 refactor parts of our preexisting build systems and
> testing infrastructure to provide better support for out-of-tree
> builds. While we already have CMake build instructions in our tree,
> they do not currently have "proper" out-of-tree builds as they still
> end up writing data into the source directory. So while these
> patches are written with Meson in mind, they should also help CMake.
> As a result of these patches, Meson builds and test runs are fully
> self-contained.
Patches 14-16 and 18 look useful in their own right even if we don't
adopt Meson. The others all look sensible in the context of supporting
multiple build systems and might be worth doing anyway especially if
they simplify the existing CMakeLists.txt.
I've skipped patches 1 and 21 for now, I'll have a look at those later
in the week.
Best Wishes
Phillip
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH 15/21] Makefile: consistently use @PLACEHOLDER@ to substitute
2024-10-08 14:04 ` Phillip Wood
@ 2024-10-08 14:23 ` Patrick Steinhardt
0 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-08 14:23 UTC (permalink / raw)
To: phillip.wood; +Cc: git, Eli Schwartz
On Tue, Oct 08, 2024 at 03:04:29PM +0100, Phillip Wood wrote:
> Hi Patrick
>
> On 02/10/2024 16:16, Patrick Steinhardt wrote:
> > We have a bunch of placeholders in our scripts that we replace at build
> > time, for example by using sed(1). These placeholders come in three
> > different formats: @PLACEHOLDER@, @@PLACEHOLDER@@ and ++PLACEHOLDER++.
>
> I agree that it's a good idea to stanardise on a single format here.
>
> > Next to being inconsistent it also creates a bit of a problem with
> > CMake, which only supports the first syntax.
>
> I'm a bit confused - is this referring to CMake's "configure_file" command?
Ah, yes. I should've made this more explicit.
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH 20/21] t: allow overriding build dir
2024-10-08 14:04 ` Phillip Wood
@ 2024-10-08 14:23 ` Patrick Steinhardt
0 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-08 14:23 UTC (permalink / raw)
To: phillip.wood; +Cc: git, Eli Schwartz
On Tue, Oct 08, 2024 at 03:04:33PM +0100, Phillip Wood wrote:
> Hi Patrick
>
> On 02/10/2024 16:16, Patrick Steinhardt wrote:
> > Our "test-lib.sh" assumes that our build directory is the parent
> > directory of "t/". While true when using our Makefile, it's not when
> > using build systems that support out-of-tree builds.
> >
> > Allow such build systems to override the location of the build directory
> > with an environment variable.
>
> ee9e66e4e76 (cmake: avoid editing t/test-lib.sh, 2022-10-18) added support
> for reading the "real" build directory from "$GIT_BUILD_DIR/GIT-BUILD-DIR".
> Using an environment variable is fine when running the tests from the build
> system but it is a pain to have to set it when running them manually.
That doesn't quite solve the problem though, because "$GIT_BUILD_DIR"
points to the _source_ directory as noted in the mentioned commit. So
the resulting build is still not fully self-contained. So I don't
currently see another way than to introduce a separate environment
variable.
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH 00/21] Modernize the build system
2024-10-08 14:11 ` [RFC PATCH 00/21] Modernize the " Phillip Wood
@ 2024-10-08 14:23 ` Patrick Steinhardt
0 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-08 14:23 UTC (permalink / raw)
To: phillip.wood; +Cc: git, Eli Schwartz
On Tue, Oct 08, 2024 at 03:11:35PM +0100, Phillip Wood wrote:
> Hi Patrick
>
> On 02/10/2024 16:15, Patrick Steinhardt wrote:
> >
> > - Patches 2 to 9 fix various different bugs I have found while working
> > on many different platforms. They can likely go into the tree
> > separately, and I'm happy to split these out into a separate patch
> > series if we want to.
>
> These all look like useful improvements in their own right, splitting them
> out would make sense to me.
For now I'll reorder them such that they are all up front. Like that it
should be easy enough to just merge the first X commits while keeping
the overall series together. The reviewers don't have to go through all
commits.
If that's creating problems though I'll split this out into a standalone
series.
> > - Patches 10 to 20 refactor parts of our preexisting build systems and
> > testing infrastructure to provide better support for out-of-tree
> > builds. While we already have CMake build instructions in our tree,
> > they do not currently have "proper" out-of-tree builds as they still
> > end up writing data into the source directory. So while these
> > patches are written with Meson in mind, they should also help CMake.
> > As a result of these patches, Meson builds and test runs are fully
> > self-contained.
>
> Patches 14-16 and 18 look useful in their own right even if we don't adopt
> Meson. The others all look sensible in the context of supporting multiple
> build systems and might be worth doing anyway especially if they simplify
> the existing CMakeLists.txt.
>
> I've skipped patches 1 and 21 for now, I'll have a look at those later in
> the week.
I'll also send an updated version soonish that includes support for
MSVC, likely tomorrow. So you may want to hold off reviewing them for
now.
Thanks for your review!
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* [RFC PATCH v2 00/24] Modernize our build system
2024-10-02 15:15 [RFC PATCH 00/21] Modernize the build system Patrick Steinhardt
` (21 preceding siblings ...)
2024-10-08 14:11 ` [RFC PATCH 00/21] Modernize the " Phillip Wood
@ 2024-10-09 14:56 ` Patrick Steinhardt
2024-10-09 14:56 ` [RFC PATCH v2 01/24] t/test-lib: fix quoting of TEST_RESULTS_SAN_FILE Patrick Steinhardt
` (25 more replies)
2024-10-18 12:23 ` [RFC PATCH v3 00/15] Modernize the " Patrick Steinhardt
` (8 subsequent siblings)
31 siblings, 26 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-09 14:56 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano
Hi,
this is the second version of the patch series that modernizes our build
system by introducing Meson. This series is still in an RFC state.
Changes compared to v1:
- I've reordered patches such that the platform-specific patches all
come up front. This allows us to merge them independently of the
rest of this series.
- I've included a couple more fixes to platform-specific issues.
- I've introduced an ICONV prerequisite. Executing tests is currently
broken when compiling with NO_ICONV=Yes, and this prerequisite fixes
that.
- I've upstreamed the standalone patch to the clar framework I had in
v1 for how we typedef `struct stat`, and adapted the commit that
updates clar to update to the newer version that includes the patch.
- I've fixed an issue in "generate-clar-decls.h" when the build path
contains spaces. I found this by accident when I had a spaces in my
source directory on Windows.
- I've rebased on top of Git v2.47.
- I've clarified some commit messages.
- I've updated "build-systems.txt" based on the feedback I got.
- I've made Meson work with the Microsoft Visual Studio compiler.
- I've included subproject wrappers. These are small files that tell
Meson for how to build a dependency as a fallback in case the host
system does not have the dependency. This allows a developer to
build Git without any system-provided dependencies and is quite
helpful especially on Windows.
- Various other small fixes and improvements to Meson.
Overall I've got this to a state where things are mostly working. I've
successfully built and tested stuff on Linux, macOS 10.15, Windows 10
with MSVC, MinGW and Cygwin as well as FreeBSD.
The series is structured as following:
- Patches 1 to 11 provide various fixes to preexisting issues on
several platforms. These fixes can be merged independently of the
rest of this series -- so even if you don't care for the remainder
of it, I'd be happy if those were reviewed.
@Junio: Let me know whether this is good enough for you, or whether
I should split those patches out into a separate series.
- Patches 12 to 22 refactor parts of our build system to make proper
out-of-tree builds a reality.
- Patch 23 introdudces the "build-systems.txt" file.
- Patch 24 introduces the Meson build system.
Thanks!
Patrick
Patrick Steinhardt (24):
t/test-lib: fix quoting of TEST_RESULTS_SAN_FILE
t/test-lib: wire up NO_ICONV prerequisite
t/lib-gitweb: test against the build version of gitweb
t/lib-gpg: fix setup of GNUPGHOME in MinGW
t1401: make invocation of tar(1) work with Win32-provided one
t3404: work around platform-specific behaviour on macOS 10.15
t5500, t5601: skip tests which exercise paths with '[::1]' on Cygwin
t7300: work around platform-specific behaviour with long paths on
MinGW
t/unit-tests: update clar unit test framework
builtin/credential-cache: fix missing parameter for stub function
http: fix build error on FreeBSD
Makefile: extract script to generate clar declarations
Makefile: extract script to massage Perl scripts
Makefile: refactor GIT-VERSION-GEN to be reusable
Makefile: refactor generators to be PWD-independent
Makefile: use common template for GIT-BUILD-OPTIONS
Makefile: consistently use @PLACEHOLDER@ to substitute
Makefile: consistently use PERL_PATH
Makefile: allow "bin-wrappers/" directory to exist
Makefile: simplify building of templates
t: better support for out-of-tree builds
t: allow overriding build dir
Documentation: add comparison of build systems
Introduce support for the Meson build system
.gitignore | 1 -
Documentation/CodingGuidelines | 2 +-
Documentation/Makefile | 1 +
Documentation/technical/build-systems.txt | 224 +++
GIT-BUILD-OPTIONS.in | 41 +
GIT-VERSION-GEN | 12 +-
Makefile | 187 +-
bin-wrappers/.gitignore | 9 +
bin-wrappers/meson.build | 28 +
bin-wrappers/wrap-for-bin.sh | 37 +
builtin/credential-cache.c | 3 +-
configure.ac | 2 +-
contrib/buildsystems/CMakeLists.txt | 135 +-
contrib/completion/meson.build | 8 +
contrib/meson.build | 1 +
generate-cmdlist.sh | 42 +-
generate-configlist.sh | 20 +-
generate-hooklist.sh | 15 +-
generate-perl.sh | 22 +
git-cvsserver.perl | 2 +-
git-instaweb.sh | 8 +-
git-request-pull.sh | 2 +-
git-send-email.perl | 2 +-
git-sh-i18n.sh | 6 +-
git-sh-setup.sh | 6 +-
git-svn.perl | 2 +-
gitk-git/po/vi.po | 2 +-
gitweb/Makefile | 44 +-
gitweb/gitweb.perl | 44 +-
gitweb/meson.build | 32 +
gitweb/static/meson.build | 28 +
http.c | 10 +-
meson.build | 1607 +++++++++++++++++
meson_options.txt | 70 +
perl/FromCPAN/Mail/meson.build | 7 +
perl/FromCPAN/meson.build | 9 +
perl/Git/I18N.pm | 6 +-
perl/Git/LoadCPAN.pm | 6 +-
perl/Git/LoadCPAN/Mail/meson.build | 7 +
perl/Git/LoadCPAN/meson.build | 9 +
perl/Git/SVN/Memoize/meson.build | 7 +
perl/Git/SVN/meson.build | 20 +
perl/Git/meson.build | 18 +
.../header_templates/fixed_prefix.template.pl | 2 +-
.../runtime_prefix.template.pl | 8 +-
perl/meson.build | 18 +
po/meson.build | 28 +
subprojects/curl.wrap | 13 +
subprojects/expat.wrap | 13 +
subprojects/openssl.wrap | 15 +
subprojects/pcre2.wrap | 16 +
subprojects/zlib.wrap | 13 +
t/helper/meson.build | 91 +
t/lib-gettext.sh | 4 +-
t/lib-gitweb.sh | 2 +-
t/lib-gpg.sh | 2 +-
t/meson.build | 1105 ++++++++++++
t/t0028-working-tree-encoding.sh | 6 +
t/t1401-symbolic-ref.sh | 2 +-
t/t2082-parallel-checkout-attributes.sh | 2 +-
t/t3404-rebase-interactive.sh | 26 +-
t/t3434-rebase-i18n.sh | 6 +
t/t3900-i18n-commit.sh | 6 +
t/t3901-i18n-patch.sh | 6 +
t/t4041-diff-submodule-option.sh | 16 +-
t/t4059-diff-submodule-not-initialized.sh | 16 +-
t/t4060-diff-submodule-option-diff-format.sh | 17 +-
t/t4201-shortlog.sh | 8 +-
t/t4205-log-pretty-formats.sh | 102 +-
t/t4210-log-i18n.sh | 6 +
t/t4254-am-corrupt.sh | 6 +
t/t5100-mailinfo.sh | 14 +-
t/t5500-fetch-pack.sh | 14 +-
t/t5550-http-fetch-dumb.sh | 4 +-
t/t5601-clone.sh | 11 +-
t/t6006-rev-list-format.sh | 54 +-
t/t7102-reset.sh | 40 +-
t/t7300-clean.sh | 2 +-
t/t7609-mergetool--lib.sh | 2 +-
t/t8005-blame-i18n.sh | 6 +
t/t9300-fast-import.sh | 2 +-
t/t9350-fast-export.sh | 10 +-
t/test-lib.sh | 25 +-
t/unit-tests/clar/.editorconfig | 13 +
t/unit-tests/clar/.github/workflows/ci.yml | 20 +-
t/unit-tests/clar/.gitignore | 1 +
t/unit-tests/clar/CMakeLists.txt | 28 +
t/unit-tests/clar/clar.c | 111 +-
t/unit-tests/clar/clar/print.h | 11 +-
t/unit-tests/clar/clar/sandbox.h | 17 +-
t/unit-tests/clar/clar/summary.h | 14 +-
t/unit-tests/clar/test/.gitignore | 4 -
t/unit-tests/clar/test/CMakeLists.txt | 41 +
t/unit-tests/clar/test/Makefile | 39 -
t/unit-tests/generate-clar-decls.sh | 18 +
templates/Makefile | 38 +-
templates/branches-- | 1 -
templates/{this--description => description} | 0
.../applypatch-msg.sample} | 0
.../commit-msg.sample} | 0
.../fsmonitor-watchman.sample} | 0
templates/hooks/meson.build | 24 +
.../post-update.sample} | 0
.../pre-applypatch.sample} | 0
.../pre-commit.sample} | 0
.../pre-merge-commit.sample} | 0
.../pre-push.sample} | 0
.../pre-rebase.sample} | 0
.../pre-receive.sample} | 0
.../prepare-commit-msg.sample} | 0
.../push-to-checkout.sample} | 0
.../sendemail-validate.sample} | 0
.../update.sample} | 0
templates/{info--exclude => info/exclude} | 0
templates/info/meson.build | 5 +
templates/meson.build | 8 +
unimplemented.sh | 2 +-
wrap-for-bin.sh | 36 -
118 files changed, 4319 insertions(+), 595 deletions(-)
create mode 100644 Documentation/technical/build-systems.txt
create mode 100644 GIT-BUILD-OPTIONS.in
create mode 100644 bin-wrappers/.gitignore
create mode 100644 bin-wrappers/meson.build
create mode 100755 bin-wrappers/wrap-for-bin.sh
create mode 100644 contrib/completion/meson.build
create mode 100644 contrib/meson.build
create mode 100755 generate-perl.sh
create mode 100644 gitweb/meson.build
create mode 100644 gitweb/static/meson.build
create mode 100644 meson.build
create mode 100644 meson_options.txt
create mode 100644 perl/FromCPAN/Mail/meson.build
create mode 100644 perl/FromCPAN/meson.build
create mode 100644 perl/Git/LoadCPAN/Mail/meson.build
create mode 100644 perl/Git/LoadCPAN/meson.build
create mode 100644 perl/Git/SVN/Memoize/meson.build
create mode 100644 perl/Git/SVN/meson.build
create mode 100644 perl/Git/meson.build
create mode 100644 perl/meson.build
create mode 100644 po/meson.build
create mode 100644 subprojects/curl.wrap
create mode 100644 subprojects/expat.wrap
create mode 100644 subprojects/openssl.wrap
create mode 100644 subprojects/pcre2.wrap
create mode 100644 subprojects/zlib.wrap
create mode 100644 t/helper/meson.build
create mode 100644 t/meson.build
create mode 100644 t/unit-tests/clar/.editorconfig
create mode 100644 t/unit-tests/clar/.gitignore
create mode 100644 t/unit-tests/clar/CMakeLists.txt
delete mode 100644 t/unit-tests/clar/test/.gitignore
create mode 100644 t/unit-tests/clar/test/CMakeLists.txt
delete mode 100644 t/unit-tests/clar/test/Makefile
create mode 100755 t/unit-tests/generate-clar-decls.sh
delete mode 100644 templates/branches--
rename templates/{this--description => description} (100%)
rename templates/{hooks--applypatch-msg.sample => hooks/applypatch-msg.sample} (100%)
rename templates/{hooks--commit-msg.sample => hooks/commit-msg.sample} (100%)
rename templates/{hooks--fsmonitor-watchman.sample => hooks/fsmonitor-watchman.sample} (100%)
create mode 100644 templates/hooks/meson.build
rename templates/{hooks--post-update.sample => hooks/post-update.sample} (100%)
rename templates/{hooks--pre-applypatch.sample => hooks/pre-applypatch.sample} (100%)
rename templates/{hooks--pre-commit.sample => hooks/pre-commit.sample} (100%)
rename templates/{hooks--pre-merge-commit.sample => hooks/pre-merge-commit.sample} (100%)
rename templates/{hooks--pre-push.sample => hooks/pre-push.sample} (100%)
rename templates/{hooks--pre-rebase.sample => hooks/pre-rebase.sample} (100%)
rename templates/{hooks--pre-receive.sample => hooks/pre-receive.sample} (100%)
rename templates/{hooks--prepare-commit-msg.sample => hooks/prepare-commit-msg.sample} (100%)
rename templates/{hooks--push-to-checkout.sample => hooks/push-to-checkout.sample} (100%)
rename templates/{hooks--sendemail-validate.sample => hooks/sendemail-validate.sample} (100%)
rename templates/{hooks--update.sample => hooks/update.sample} (100%)
rename templates/{info--exclude => info/exclude} (100%)
create mode 100644 templates/info/meson.build
create mode 100644 templates/meson.build
delete mode 100644 wrap-for-bin.sh
Range-diff against v1:
2: 559b593b598 = 1: 6dd59db9b2b t/test-lib: fix quoting of TEST_RESULTS_SAN_FILE
-: ----------- > 2: 5ec91ac12da t/test-lib: wire up NO_ICONV prerequisite
3: be8ba4b9679 = 3: 94664e2cc06 t/lib-gitweb: test against the build version of gitweb
4: b5c116396da ! 4: ffb661dad71 t/lib-gpg: fix setup of GNUPGHOME in MinGW
@@ Commit message
t/lib-gpg: fix setup of GNUPGHOME in MinGW
In "t/lib-gpg.sh" we set up the "GNUPGHOME" environment variable to
- point to a test-specific diretcory. This is done by using "$PWD/gpghome"
+ point to a test-specific directory. This is done by using "$PWD/gpghome"
as value, where "$PWD" is the current test's trash directory.
This is broken for MinGW though because "$PWD" will use Windows-style
paths that contain drive letters. What we really want in this context is
- a Unix-style path, which we can get by using `$(pwd)` instead.
+ a Unix-style path, which we can get by using `$(pwd)` instead. It is
+ somewhat puzzling that nobody ever hit this issue, but it may easily be
+ that nobody ever tests on Windows with GnuPG installed, which would make
+ us skip those tests.
Adapt the code accordingly to fix tests using this library.
-: ----------- > 5: 958cf3a6b57 t1401: make invocation of tar(1) work with Win32-provided one
-: ----------- > 6: bada3a82fdd t3404: work around platform-specific behaviour on macOS 10.15
-: ----------- > 7: b4bdefe9e34 t5500, t5601: skip tests which exercise paths with '[::1]' on Cygwin
-: ----------- > 8: 48ce19d876f t7300: work around platform-specific behaviour with long paths on MinGW
6: a0eff395839 ! 9: 73b4362164a t/unit-tests: update clar unit test framework
@@ Metadata
## Commit message ##
t/unit-tests: update clar unit test framework
- Update clar unit test framework to 67e689a (Merge pull request #103 from
- pks-t/pks-editorconfig, 2024-09-20).
+ Update clar unit test framework to f065214 (Merge pull request #105 from
+ pks-t/pks-win32-stat-compat, 2024-10-03), which fixes some platform
+ compatibility issues with Windows.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
@@ t/unit-tests/clar/clar.c
/* required for sandboxing */
#include <sys/types.h>
@@
+
+ # ifndef stat
+ # define stat(path, st) _stat(path, st)
++ typedef struct _stat STAT_T;
++# else
++ typedef struct stat STAT_T;
+ # endif
+ # ifndef mkdir
+ # define mkdir(path, mode) _mkdir(path)
+@@
+ # else
# define p_snprintf snprintf
# endif
-
+-
-# ifndef PRIuZ
-# define PRIuZ "Iu"
-# endif
@@ t/unit-tests/clar/clar.c
-# define PRIxZ "Ix"
-# endif
-
- # if defined(_MSC_VER) || (defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR))
- typedef struct stat STAT_T;
- # else
-@@
+-# if defined(_MSC_VER) || (defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR))
+- typedef struct stat STAT_T;
+-# else
+- typedef struct _stat STAT_T;
+-# endif
+ #else
+ # include <sys/wait.h> /* waitpid(2) */
# include <unistd.h>
# define _MAIN_CC
# define p_snprintf snprintf
8: 7a36ad58384 = 10: 161f6b063af builtin/credential-cache: fix missing parameter for stub function
9: 1c1cd4d8ef9 = 11: e4ef4bdf1c5 http: fix build error on FreeBSD
10: b05a551b1c2 ! 12: 6ea97bc92f2 Makefile: extract script to generate clar declarations
@@ t/unit-tests/generate-clar-decls.sh (new)
@@
+#!/bin/sh
+
-+if test $# -lt 3
++if test $# -lt 2
+then
+ echo "USAGE: $0 <OUTPUT> <SUITE>..." 2>&1
+ exit 1
@@ t/unit-tests/generate-clar-decls.sh (new)
+OUTPUT="$1"
+shift
+
-+for suite in $*
++while test "$#" -ne 0
+do
++ suite="$1"
++ shift
+ sed -ne "s/^\(void test_$suite__[a-zA-Z_0-9][a-zA-Z_0-9]*(void)$\)/extern \1;/p" "$suite" ||
+ exit 1
+done >"$OUTPUT"
11: ccfa97bd3db = 13: 7f567d7ce23 Makefile: extract script to massage Perl scripts
12: ada39ec21dd ! 14: dfc941cd18d Makefile: refactor GIT-VERSION-GEN to be reusable
@@ GIT-VERSION-GEN
#!/bin/sh
-GVF=GIT-VERSION-FILE
- DEF_VER=v2.47.0-rc0
+ DEF_VER=v2.47.0
LF='
@@ GIT-VERSION-GEN: fi
13: 7136aeaa138 = 15: e468d3751f0 Makefile: refactor generators to be PWD-independent
14: a5a43ed685e ! 16: dbf9e39e3df Makefile: use common template for GIT-BUILD-OPTIONS
@@ GIT-BUILD-OPTIONS.in (new)
+PYTHON_PATH=@PYTHON_PATH@
+TAR=@TAR@
+NO_CURL=@NO_CURL@
++NO_ICONV=@NO_ICONV@
+NO_EXPAT=@NO_EXPAT@
+USE_LIBPCRE2=@USE_LIBPCRE2@
+NO_PERL=@NO_PERL@
@@ Makefile: GIT-LDFLAGS: FORCE
- @echo PYTHON_PATH=\''$(subst ','\'',$(PYTHON_PATH_SQ))'\' >>$@+
- @echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@+
- @echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@+
+- @echo NO_ICONV=\''$(subst ','\'',$(subst ','\'',$(NO_ICONV)))'\' >>$@+
- @echo NO_EXPAT=\''$(subst ','\'',$(subst ','\'',$(NO_EXPAT)))'\' >>$@+
- @echo USE_LIBPCRE2=\''$(subst ','\'',$(subst ','\'',$(USE_LIBPCRE2)))'\' >>$@+
- @echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@+
@@ Makefile: GIT-LDFLAGS: FORCE
+ -e "s|@PYTHON_PATH@|\'$(PYTHON_PATH_SQ)\'|" \
+ -e "s|@TAR@|\'$(TAR)\'|" \
+ -e "s|@NO_CURL@|\'$(NO_CURL)\'|" \
++ -e "s|@NO_ICONV@|\'$(NO_ICONV)\'|" \
+ -e "s|@NO_EXPAT@|\'$(NO_EXPAT)\'|" \
+ -e "s|@USE_LIBPCRE2@|\'$(USE_LIBPCRE2)\'|" \
+ -e "s|@NO_PERL@|\'$(NO_PERL)\'|" \
@@ contrib/buildsystems/CMakeLists.txt: if(NOT PYTHON_TESTS)
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PYTHON_PATH='${PYTHON_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "TAR='${TAR}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_CURL='${NO_CURL}'\n")
+-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_ICONV='${NO_ICONV}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_EXPAT='${NO_EXPAT}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PERL='${NO_PERL}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PTHREADS='${NO_PTHREADS}'\n")
@@ contrib/buildsystems/CMakeLists.txt: if(NOT PYTHON_TESTS)
+string(REPLACE "@PYTHON_PATH@" "${PYTHON_PATH}" git_build_options "${git_build_options}")
+string(REPLACE "@TAR@" "${TAR}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_CURL@" "${NO_CURL}" git_build_options "${git_build_options}")
++string(REPLACE "@NO_ICONV@" "${NO_ICONV}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_EXPAT@" "${NO_EXPAT}" git_build_options "${git_build_options}")
+string(REPLACE "@USE_LIBPCRE2@" "" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PERL@" "${NO_PERL}" git_build_options "${git_build_options}")
15: 6aaf3263228 ! 17: 97b9789dd68 Makefile: consistently use @PLACEHOLDER@ to substitute
@@ Commit message
different formats: @PLACEHOLDER@, @@PLACEHOLDER@@ and ++PLACEHOLDER++.
Next to being inconsistent it also creates a bit of a problem with
- CMake, which only supports the first syntax. To work around that we
- instead manually replace such strings via string operations, which is
- both a hassle and also removes safeguards that CMake has to verify that
- we didn't forget to replace any placeholders. Besides that, other build
- systems like Meson also support the CMake syntax.
+ CMake, which only supports the first syntax in its `configure_file()`
+ function. To work around that we instead manually replace placeholders
+ via string operations, which is a hassle and removes safeguards that
+ CMake has to verify that we didn't forget to replace any placeholders.
+ Besides that, other build systems like Meson also support the CMake
+ syntax.
Unify our codebase to consistently use the syntax supported by such
build systems.
16: 73417f39a5e = 18: 1ee9c61fc33 Makefile: consistently use PERL_PATH
17: 4b356c0b634 = 19: 9fd1aeb1e96 Makefile: allow "bin-wrappers/" directory to exist
18: bf55d0c226d = 20: 4eda54cf0f5 Makefile: simplify building of templates
19: 7a0a6b996c3 = 21: 1172c440600 t: better support for out-of-tree builds
20: c5ae59ce905 ! 22: b5cd5250b77 t: allow overriding build dir
@@ Commit message
directory of "t/". While true when using our Makefile, it's not when
using build systems that support out-of-tree builds.
- Allow such build systems to override the location of the build directory
- with an environment variable.
+ In commit ee9e66e4e7 (cmake: avoid editing t/test-lib.sh, 2022-10-18),
+ we have introduce support for overriding the GIT_BIULD_DIR by creating
+ the file "$GIT_BUILD_DIR/GIT-BUILD-DIR" with its contents pointing to
+ the location of the build directory. The intent was to stop modifying
+ "t/test-lib.sh" with the CMake build systems while allowing out-of-tree
+ builds. But "$GIT_BUILD_DIR" is somewhat misleadingly named, as it in
+ fact points to the _source_ directory. So while that commit solved part
+ of the problem for out-of-tree builds, CMake still has to write files
+ into the source tree.
+
+ Solve the second part of the problem, namely not having to write any
+ data into the source directory at all, by also supporting an environment
+ variable that allows us to point to a different build directory. This
+ allows us to perform properly self-contained out-of-tree builds.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
1: 508e3783d28 ! 23: afa2f79d46c Documentation: add comparison of build systems
@@ Documentation/technical/build-systems.txt (new)
+= Build Systems
+
+The build system is the primary way for both developers and system integrators
-+to interact with the Git project. As such, we consider it important to pick a
-+build system that fulfills our requirements while being easy to use and extend.
++to interact with the Git project. As such, being easy to use and extend for
++those who are not directly developing Git itself is just as important as other
++requirements we have on any potential build system.
+
+This document outlines the different requirements that we have for the build
+system and then compares available build systems using these criteria.
+
+== Requirements
+
-+The following subsections prevent a list of requirements that we have for any
++The following subsections present a list of requirements that we have for any
+potential build system. Sections are sorted by decreasing priority, even though
+these priorities will naturally differ between users.
+
+=== Platform support
+
-+The most important criterium is whether the build system supports all of the
-+platforms that Git supports. The most important platforms include:
++The build system must have support for all of our primary platforms as outlined
++by. These platforms are:
+
+ - Linux
-+ - macOS
+ - Windows
++ - macOS
++
++Furthermore, the build system should have support for the following secondary
++platforms:
++
++ - AIX
+ - FreeBSD
-+ - OpenBSD
+ - NetBSD
++ - OpenBSD
+
+The platforms which must be supported by the tool should be aligned with our
+[platform support policy](platform-support.txt).
+
+=== Auto-detection of supported features
+
-+The build system MUST support auto-detection of features which are or aren't
++The build system must support auto-detection of features which are or aren't
+available on the current platform. Platform maintainers should not be required
+to manually configure the complete build.
+
@@ Documentation/technical/build-systems.txt (new)
+ - Check for the existence of libraries.
+ - Check for the existence of exectuables.
+ - Check for the runtime behavior of specific functions.
++ - Check for specific link order requirements when multiple libraries are
++ involved.
+
+=== Ease of use
+
-+The build system SHOULD be both easy to use and easy to extend. While this is
++The build system should be both easy to use and easy to extend. While this is
+naturally a subjective metric it is likely not controversial to say that some
+build systems are considerably harder to use than others.
+
+=== IDE support
+
-+The build system SHOULD integrate with well-known IDEs. Well-known IDEs include:
++The build system should integrate with well-known IDEs. Well-known IDEs include:
+
+ - Microsoft Visual Studio
+ - Visual Studio Code
@@ Documentation/technical/build-systems.txt (new)
+
+=== Out-of-tree builds
+
-+The build system SHOULD support out-of-tree builds. Out-of-tree builds allow a
++The build system should support out-of-tree builds. Out-of-tree builds allow a
+developer to configure multiple different build directories with different
+configuration, e.g. one "debug" build and one "release" build.
+
-+=== Rust support
++=== Cross-platform builds
++
++The build system should support cross-platform builds, e.g. building for arm on
++an x86-64 host.
++
++=== Language support
++
++The following languages and toolchains are of relevance and should be supported
++by the build system:
++
++ - C: the primary compiled language used by Git, must be supported. Relevant
++ toolchains are GCC, Clang and MSVC.
++ - Rust: candidate as a second compiled lanugage, should be supported. Relevant
++ toolchains is the LLVM-based rustc.
++
++Built-in support for the respective languages is preferred over support that
++needs to be wired up manually to avoid unnecessary complexity. Native support
++includes the following features:
++
++ - Compiling objects.
++ - Dependency tracking.
++ - Detection of available features.
++ - Discovery of relevant toolchains.
++ - Linking libraries and executables.
++
++=== Test integration
++
++It should be possible to integrate tests into the build system such that it is
++possible to build and test Git within the build system. Features which are nice
++to have:
+
-+Many long-time Git contributors are nowadays in favor of adopting Rust as a
-+second language next to C. The build system SHOULD thus support Rust such that
-+we do not have to reopen the discussion once we decide to pick up Rust.
++ - Track build-time dependencies for respective tests. Unit tests have
++ different requirements than integration tests.
++ - Allow filtering of which tests to run.
++ - Allow interactive tests that drop the user into a shell with `test_pause` or
++ `debug`.
+
+== Comparison
+
@@ Documentation/technical/build-systems.txt (new)
+ rules can quickly get out of hand once reaching a certain scope.
+- IDE support: execution of Makefile targets is supported by many IDEs
+- Out-of-tree builds: supported in theory, not wired up in practice.
-+- Rust: can be added.
++- Cross-platform builds: supported in theory, not wired up in practice.
++- Language support:
++ - C: Limited built-in support, many parts need to be wired up manually.
++ - Rust: No built-in support, needs to be wired up manually.
++- Test integration: partially supported, many parts need to be wired up
++ manually.
+
+=== autoconf
+
@@ Documentation/technical/build-systems.txt (new)
+- IDE support: no integration into IDEs at generation time. The generated
+ Makefiles have the same level of support as GNU Make.
+- Out-of-tree builds: supported in theory, not wired up in practice.
-+- Rust: not supported.
++- Cross-platform builds: supported.
++- Language support:
++ - C: Limited built-in support, many parts need to be wired up manually.
++ - Rust: No built-in support, needs to be wired up manually.
++- Test integration: partially supported, many parts need to be wired up
++ manually.
+
+=== CMake
+
@@ Documentation/technical/build-systems.txt (new)
+ project descriptions for Xcode. An extension is available for Visual Studio
+ Code. Many other IDEs have plugins for CMake.
+- Out-of-tree builds: supported.
-+- Rust: not supported.
++- Cross-platform builds: supported.
++- Language support:
++ - C: Supported for GCC, Clang, MSVC and other toolchains.
++ - Rust: No built-in support, needs to be wired up manually.
++- Test integration: supported, even though test dependencies are a bit
++ cumbersome to use via "test fixtures". Interactive test runs are not
++ supported.
+
+=== Meson
+
@@ Documentation/technical/build-systems.txt (new)
+- IDE support: Supports generating build instructions for Xcode and Microsoft
+ Visual Studio, a plugin exists for Visual Studio Code.
+- Out-of-tree builds: supported.
-+- Rust: supported.
++- Cross-platform builds: supported.
++- Language support:
++ - C: Supported for GCC, Clang, MSVC and other toolchains.
++ - Rust: Supported for rustc.
++- Test integration: supported. Interactive tests are supported starting with
++ Meson 1.5.0 via the `--interactive` flag.
5: 00fd829833c < -: ----------- t3404: work around platform-specific behaviour on macOS 10.15
7: f006545eef1 < -: ----------- t/clar: simplify how the clar derives `struct stat`
21: a19af6507c0 ! 24: 724232b0fad Introduce support for the Meson build system
@@ Commit message
```
The build instructions have been successfully tested on the following
- systems. Tests are mostly passing:
+ systems, tests are passing:
- Apple macOS 10.15.
+
- FreeBSD 14.1, except gitweb-based tests.
+
- NixOS 24.11.
+
- Ubuntu 24.04.
- - Windows 10 with Cygwin, using `-Dperl=disabled -Dpython=disabled`,
- except for t0052, t0301, t5500, t5572, t5601.
- - Windows 10 with MinGW64, using `-Dperl=disabled -Dpython=disabled`,
- except for t7300.
+
+ - Windows 10 with Cygwin, using `-Dperl=disabled -Dpython=disabled`.
+
+ - Windows 10 with MinGW64, using `-Dperl=disabled -Dpython=disabled`.
+
+ - Windows 10 with MSVC 2022, using `-Dperl=disabled -Dpython=disabled
+ -Dgettext=disabled -Diconv=disabled --wrap-mode=forcefallback`.
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
@@ Commit message
- Support for installing documentation has not been wired up yet. This
will follow if the project can agree on Meson as build system.
- - Support for Microsoft Visual Studio has not yet been tested, mostly
- because I have been fighting with the Windows-based systems for a
- long while already. This will follow if the project can agree on
- Meson as build system
-
- Documentation does not yet exist. Same here, it will follow if the
project can agree on Meson.
- - We're targeting a relatively-recent Meson 1.3.0, which has been
- released November 2023. The only feature we use from that version is
+ - We're targeting a 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 3000 lines, half of which
is listing all of our code and test files. Our Makefiles are around
- 5000 lines of, autoconf adds another 1300 lines. CMake in comparison
- has only 1200 lines of code, but it avoids listing individual files
- and does not wire up auto-configuration as extensively as the Meson
- files do.
+ 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.
- - I didn't yet port the workaround for the `gettext` package in
- Homebrew being key-only over. Users have to manually add CFLAGS and
- LDFLAGS for that library to work around this issue with Homebrew.
+ - 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.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
@@ gitweb/static/meson.build (new)
## meson.build (new) ##
@@
+project('git', 'c',
-+ version: run_command('GIT-VERSION-GEN', check: true).stdout().strip(),
+ meson_version: '>=1.3.0',
++ # MSVC does not support GNU99, and C99 does not define __STDC_VERSION__
++ # on MSVC. So we instead fall back to C11 there.
++ default_options: ['c_std=gnu99,c11'],
++ version: run_command('GIT-VERSION-GEN', check: true).stdout().strip(),
+)
+
+fs = import('fs')
@@ meson.build (new)
+ 'builtin/write-tree.c',
+]
+
++script_environment = environment()
++foreach tool : ['cat', 'cut', 'grep', 'sed', 'sort', 'tr', 'uname']
++ program = find_program(tool)
++ script_environment.prepend('PATH', fs.parent(program.full_path()))
++endforeach
++
+libgit_sources += custom_target(
+ 'command-list.h',
+ input: 'command-list.txt',
+ output: 'command-list.h',
+ command: [shell, meson.current_source_dir() + '/generate-cmdlist.sh', meson.current_source_dir(), '@OUTPUT@'],
++ env: script_environment,
+)
+
+libgit_sources += custom_target(
@@ meson.build (new)
+ meson.current_source_dir(),
+ '@OUTPUT@',
+ ],
++ env: script_environment,
+)
+
+libgit_sources += custom_target(
@@ meson.build (new)
+ meson.current_source_dir(),
+ '@OUTPUT@',
+ ],
++ env: script_environment,
+)
+
+# This contains the variables for GIT-BUILD-OPTIONS, which we use to propagate
@@ meson.build (new)
+ build_options_config.set('NO_PERL', '1')
+endif
+
-+zlib = dependency('zlib')
-+libgit_dependencies += zlib
-+if not compiler.has_function('deflateBound',
++zlib = dependency('zlib', default_options: ['default_library=static', 'tests=disabled'])
++if zlib.type_name() != 'internal' and not compiler.has_function('deflateBound',
+ prefix: '#include <zlib.h>',
+ dependencies: zlib,
+)
+ libgit_c_args += '-DNO_DEFLATE_BOUND'
+endif
++libgit_dependencies += zlib
+
+threads = dependency('threads', required: false)
+if threads.found()
@@ meson.build (new)
+ build_options_config.set('NO_PTHREADS', '1')
+endif
+
-+intl = dependency('intl', required: get_option('gettext'))
++if get_option('gettext').allowed() and host_machine.system() == 'darwin' and get_option('macos_use_homebrew_gettext')
++ if host_machine.cpu_family() == 'x86_64'
++ libintl_prefix = '/usr/local'
++ elif host_machine.cpu_family() == 'aarch64'
++ libintl_prefix = '/opt/homebrew'
++ else
++ error('Homebrew workaround not supported on current architecture')
++ endif
++
++ intl = compiler.find_library('intl', dirs: libintl_prefix / 'lib', required: get_option('gettext'))
++ if intl.found()
++ intl = declare_dependency(
++ dependencies: intl,
++ include_directories: libintl_prefix / 'include',
++ )
++ endif
++else
++ intl = dependency('intl', required: get_option('gettext'))
++endif
+if intl.found()
+ libgit_dependencies += intl
+ build_options_config.set('NO_GETTEXT', '')
@@ meson.build (new)
+iconv = dependency('iconv', required: get_option('iconv'))
+if iconv.found()
+ libgit_dependencies += iconv
++ build_options_config.set('NO_ICONV', '')
+
+ have_old_iconv = false
+ if not compiler.compiles('''
@@ meson.build (new)
+ endif
+else
+ libgit_c_args += '-DNO_ICONV'
++ build_options_config.set('NO_ICONV', '1')
+endif
+
-+pcre2 = dependency('libpcre2-8', required: get_option('pcre2'))
++pcre2 = dependency('libpcre2-8', required: get_option('pcre2'), default_options: ['default_library=static', 'test=false'])
+if pcre2.found()
+ libgit_dependencies += pcre2
+ libgit_c_args += '-DUSE_LIBPCRE2'
@@ meson.build (new)
+ build_options_config.set('USE_LIBPCRE2', '')
+endif
+
-+curl = dependency('libcurl', version: '>=7.21.3', required: get_option('curl'))
++curl = dependency('libcurl', version: '>=7.21.3', required: get_option('curl'), default_options: ['default_library=static', 'tests=disabled'])
+use_curl_for_imap_send = false
+if curl.found()
+ if curl.version().version_compare('>=7.34.0')
@@ meson.build (new)
+ build_options_config.set('NO_CURL', '1')
+endif
+
-+expat = dependency('expat', required: get_option('expat'))
++expat = dependency('expat', required: get_option('expat'), default_options: ['default_library=static', 'build_tests=false'])
+if expat.found()
+ libgit_dependencies += expat
+
@@ meson.build (new)
+endif
+
+networking_dependencies = [ ]
-+winsock = compiler.find_library('ws2_32', required: false)
-+if winsock.found()
-+ networking_dependencies += winsock
-+endif
-+libresolv = compiler.find_library('resolv', required: false)
-+if libresolv.found()
-+ networking_dependencies += libresolv
++if host_machine.system() == 'windows'
++ winsock = compiler.find_library('ws2_32', required: false)
++ if winsock.found()
++ networking_dependencies += winsock
++ endif
++else
++ libresolv = compiler.find_library('resolv', required: false)
++ if libresolv.found()
++ networking_dependencies += libresolv
++ endif
+endif
+libgit_dependencies += networking_dependencies
+
@@ meson.build (new)
+ 'compat/win32/path-utils.c',
+ 'compat/win32/pthread.c',
+ 'compat/win32/syslog.c',
-+ 'compat/win32/trace2_win32_process_info.c',
+ 'compat/win32/dirent.c',
+ 'compat/win32mmap.c',
+ 'compat/nedmalloc/nedmalloc.c',
@@ meson.build (new)
+
+ libgit_dependencies += compiler.find_library('ntdll')
+ libgit_include_directories += 'compat/win32'
++ if compiler.get_id() == 'msvc'
++ libgit_include_directories += 'compat/vcbuild/include'
++ endif
+endif
+
+if host_machine.system() == 'linux'
+ libgit_sources += 'compat/linux/procinfo.c'
++elif host_machine.system() == 'windows'
++ libgit_sources += 'compat/win32/trace2_win32_process_info.c'
+else
+ libgit_sources += 'compat/stub/procinfo.c'
+endif
@@ meson.build (new)
+build_options_config.set_quoted('FSMONITOR_DAEMON_BACKEND', fsmonitor_backend)
+build_options_config.set_quoted('FSMONITOR_OS_SETTINGS', fsmonitor_backend)
+
-+if compiler.get_define('REG_STARTEND', prefix: '#include <regex.h>') != ''
++if compiler.has_header('regex.h') and compiler.get_define('REG_STARTEND', prefix: '#include <regex.h>') != ''
+ build_options_config.set('NO_REGEX', '')
++
++ if compiler.get_define('REG_ENHANCED', prefix: '#include <regex.h>') != ''
++ libgit_c_args += '-DUSE_ENHANCED_BASIC_REGULAR_EXPRESSIONS'
++ libgit_sources += 'compat/regcomp_enhanced.c'
++ endif
+else
+ libgit_c_args += [
+ '-DNO_REGEX',
@@ meson.build (new)
+ libgit_sources += 'compat/regex/regex.c'
+ libgit_include_directories += 'compat/regex'
+endif
-+if compiler.get_define('REG_ENHANCED', prefix: '#include <regex.h>') != ''
-+ libgit_c_args += '-DUSE_ENHANCED_BASIC_REGULAR_EXPRESSIONS'
-+ libgit_sources += 'compat/regcomp_enhanced.c'
-+endif
+
+# setitimer and friends are provided by compat/mingw.c.
+if host_machine.system() != 'windows'
@@ meson.build (new)
+ openssl_required = true
+endif
+
-+openssl = dependency('openssl', required: openssl_required)
++openssl = dependency('openssl', required: openssl_required, default_options: ['default_library=static'])
+if openssl.found()
+ libgit_dependencies += openssl
+endif
@@ meson.build (new)
+ '-DGIT_USER_AGENT="' + 'git/' + meson.project_version() + '"',
+ '-DGIT_BUILT_FROM_COMMIT="' + run_command('git', 'rev-parse', '-q', '--verify', 'HEAD', check: false).stdout().strip() + '"',
+ ],
++ dependencies: libgit_dependencies,
+ include_directories: libgit_include_directories,
+)
+
@@ meson.build (new)
+ sources: libgit_sources,
+ c_args: libgit_c_args,
+ link_with: libgit_version_library,
++ dependencies: libgit_dependencies,
+ include_directories: libgit_include_directories,
+)
+
@@ meson.build (new)
+ '-Wl,-nxcompat',
+ '-Wl,-dynamicbase',
+ '-Wl,-pic-executable,-e,mainCRTStartup',
-+ '-Wl,-subsystem,console',
+ ]
+ elif compiler.get_argument_syntax() == 'msvc'
+ common_main_link_args += [
-+ '/NOLOGO',
+ '/ENTRY:wmainCRTStartup',
-+ '/SUBSYSTEM:CONSOLE',
+ 'invalidcontinue.obj',
+ ]
+ else
@@ meson.build (new)
+common_main_library = static_library('common-main',
+ sources: common_main_sources,
+ c_args: libgit_c_args,
++ dependencies: libgit_dependencies,
+ include_directories: libgit_include_directories,
+)
+common_main = declare_dependency(
@@ meson.build (new)
+
+ foreach alias : [ 'git-remote-https', 'git-remote-ftp', 'git-remote-ftps' ]
+ test_dependencies += executable(alias,
-+ objects: git.extract_all_objects(recursive: false),
++ objects: git_remote_http.extract_all_objects(recursive: false),
+ dependencies: [libgit, common_main],
+ )
+
@@ meson_options.txt (new)
+option('sha256_backend', type: 'combo', choices: ['openssl', 'nettle', 'gcrypt', 'block'], value: 'block',
+ description: 'The backend used for hashing objects with the SHA256 object format')
+
++option('macos_use_homebrew_gettext', type: 'boolean', value: true,
++ description: 'Use gettext from Homebrew instead of the slightly-broken system-provided one.')
++
+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')
@@ po/meson.build (new)
+)
+test_dependencies += translations[0]
+ ## subprojects/curl.wrap (new) ##
+@@
++[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
+
+ ## subprojects/expat.wrap (new) ##
+@@
++[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
+
+ ## subprojects/openssl.wrap (new) ##
+@@
++[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
+
+ ## subprojects/pcre2.wrap (new) ##
+@@
++[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
+
+ ## subprojects/zlib.wrap (new) ##
+@@
++[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
+
## t/helper/meson.build (new) ##
@@
+test_tool_sources = [
@@ t/meson.build (new)
+]
+
+clar_decls_h = custom_target('clar_decls_h',
-+ input: clar_test_suites,
-+ output: 'clar-decls.h',
-+ command : [shell, meson.current_source_dir() + '/unit-tests/generate-clar-decls.sh', '@OUTPUT@', '@INPUT@'],
++ input: clar_test_suites,
++ output: 'clar-decls.h',
++ command : [shell, meson.current_source_dir() + '/unit-tests/generate-clar-decls.sh', '@OUTPUT@', '@INPUT@'],
++ env: script_environment,
+)
++clar_sources += clar_decls_h
+
-+clar_suite = custom_target('clar_suite',
-+ input: clar_decls_h,
-+ output: 'clar.suite',
-+ feed: true,
-+ capture: true,
-+ command : [awk, '-f', meson.current_source_dir() + '/unit-tests/clar-generate.awk'],
++clar_sources += custom_target('clar_suite',
++ input: clar_decls_h,
++ output: 'clar.suite',
++ feed: true,
++ capture: true,
++ command : [awk, '-f', meson.current_source_dir() + '/unit-tests/clar-generate.awk'],
+)
+
-+clar_generated_sources = [
-+ clar_decls_h,
-+ clar_suite,
-+]
-+
+clar_unit_tests = executable('unit-tests',
-+ sources: clar_sources + clar_generated_sources + clar_test_suites,
++ sources: clar_sources + clar_test_suites,
+ dependencies: [libgit, common_main],
+)
+test('unit-tests', clar_unit_tests)
@@ t/meson.build (new)
+ git_build_dir = run_command(cygpath, git_build_dir, check: true).stdout().strip()
+endif
+
++test_environment = script_environment
++test_environment.set('GIT_BUILD_DIR', git_build_dir)
++
+foreach integration_test : integration_tests
+ test(fs.stem(integration_test), shell,
+ args: [ integration_test ],
+ workdir: meson.current_source_dir(),
-+ env: {
-+ 'GIT_BUILD_DIR': git_build_dir,
-+ },
++ env: test_environment,
+ depends: test_dependencies + bin_wrappers,
+ timeout: 0,
+ )
--
2.47.0.rc1.33.g90fe3800b9.dirty
^ permalink raw reply [flat|nested] 386+ messages in thread
* [RFC PATCH v2 01/24] t/test-lib: fix quoting of TEST_RESULTS_SAN_FILE
2024-10-09 14:56 ` [RFC PATCH v2 00/24] Modernize our " Patrick Steinhardt
@ 2024-10-09 14:56 ` Patrick Steinhardt
2024-10-09 14:56 ` [RFC PATCH v2 02/24] t/test-lib: wire up NO_ICONV prerequisite Patrick Steinhardt
` (24 subsequent siblings)
25 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-09 14:56 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano
When assembling our LSAN_OPTIONS that configure the leak sanitizer we
end up prepending the string with various different colon-separated
options via calls to `prepend_var`. One of the settings we add is the
path where the sanitizer should store logs, which can be an arbitrary
filesystem path.
Naturally, filesystem paths may contain whitespace characters. And while
it does seem as if we were quoting the value, we use escaped quotes and
consequently split up the value if it does contain spaces. This leads to
the following error in t0000 when having a value with whitespaces:
.../t/test-lib.sh: eval: line 64: unexpected EOF while looking for matching `"'
++ return 1
error: last command exited with $?=1
not ok 5 - subtest: 3 passing tests
The error itself is a bit puzzling at first. The basic problem is that
the code sees the leading escaped quote during eval, but because we
truncate everything after the space character it doesn't see the
trailing escaped quote and thus fails to parse the string.
Properly quote the value to fix the issue while using single-quotes to
quote the inner value passed to eval. The issue can be reproduced by
t0000 with such a path that contains spaces.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
t/test-lib.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index b1a8ee5c002..241198ba95f 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1572,7 +1572,7 @@ then
prepend_var LSAN_OPTIONS : dedup_token_length=9999
prepend_var LSAN_OPTIONS : log_exe_name=1
- prepend_var LSAN_OPTIONS : log_path=\"$TEST_RESULTS_SAN_FILE\"
+ prepend_var LSAN_OPTIONS : log_path="'$TEST_RESULTS_SAN_FILE'"
export LSAN_OPTIONS
elif test "$GIT_TEST_PASSING_SANITIZE_LEAK" = "check" ||
--
2.47.0.rc1.33.g90fe3800b9.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v2 02/24] t/test-lib: wire up NO_ICONV prerequisite
2024-10-09 14:56 ` [RFC PATCH v2 00/24] Modernize our " Patrick Steinhardt
2024-10-09 14:56 ` [RFC PATCH v2 01/24] t/test-lib: fix quoting of TEST_RESULTS_SAN_FILE Patrick Steinhardt
@ 2024-10-09 14:56 ` Patrick Steinhardt
2024-10-09 14:56 ` [RFC PATCH v2 03/24] t/lib-gitweb: test against the build version of gitweb Patrick Steinhardt
` (23 subsequent siblings)
25 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-09 14:56 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano
The iconv library is used by Git to reencode files, commit messages and
other things. As such it is a rather integral part, but given that many
platforms nowadays use UTF-8 everywhere you can live without support for
reencoding in many situations. It is thus optional to build Git with
iconv, and some of our platforms wired up in "config.mak.uname" disable
it. But while we support building without it, running our test suite
with "NO_ICONV=Yes" causes many test failures.
Wire up a new test prerequisite ICONV that gets populated via our
GIT-BUILD-OPTIONS. Annotate failing tests accordingly.
Note that this commit does not do a deep dive into every single test to
assess whether the failure is expected or not. Most of the tests do
smell like the expected kind of failure though.
Further note that there are several "!MINGW" conditions in t4201, and
all of these fail due to iconv-related errors. This is quite likely a
leftover from times before dce7d29551 (msvc: support building Git using
MS Visual C++, 2019-06-25), which switched Windows-based builds over
from "NO_ICONV=YesPlease" to "NEEDS_LIBICONV=YesPlease". Consequently,
adapt those tests to also use the new ICONV prerequisite.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 1 +
contrib/buildsystems/CMakeLists.txt | 6 ++
t/t0028-working-tree-encoding.sh | 6 ++
t/t2082-parallel-checkout-attributes.sh | 2 +-
t/t3434-rebase-i18n.sh | 6 ++
t/t3900-i18n-commit.sh | 6 ++
t/t3901-i18n-patch.sh | 6 ++
t/t4041-diff-submodule-option.sh | 16 ++-
t/t4059-diff-submodule-not-initialized.sh | 16 ++-
t/t4060-diff-submodule-option-diff-format.sh | 17 ++--
t/t4201-shortlog.sh | 8 +-
t/t4205-log-pretty-formats.sh | 102 +++++++++++--------
t/t4210-log-i18n.sh | 6 ++
t/t4254-am-corrupt.sh | 6 ++
t/t5100-mailinfo.sh | 14 ++-
t/t5550-http-fetch-dumb.sh | 4 +-
t/t6006-rev-list-format.sh | 54 ++++++----
t/t7102-reset.sh | 40 +++++---
t/t8005-blame-i18n.sh | 6 ++
t/t9300-fast-import.sh | 2 +-
t/t9350-fast-export.sh | 10 +-
t/test-lib.sh | 1 +
22 files changed, 229 insertions(+), 106 deletions(-)
diff --git a/Makefile b/Makefile
index 2dde1fd2b8b..c094840426c 100644
--- a/Makefile
+++ b/Makefile
@@ -3172,6 +3172,7 @@ GIT-BUILD-OPTIONS: FORCE
@echo PYTHON_PATH=\''$(subst ','\'',$(PYTHON_PATH_SQ))'\' >>$@+
@echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@+
@echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@+
+ @echo NO_ICONV=\''$(subst ','\'',$(subst ','\'',$(NO_ICONV)))'\' >>$@+
@echo NO_EXPAT=\''$(subst ','\'',$(subst ','\'',$(NO_EXPAT)))'\' >>$@+
@echo USE_LIBPCRE2=\''$(subst ','\'',$(subst ','\'',$(USE_LIBPCRE2)))'\' >>$@+
@echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@+
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 62af7b33d2f..1384c0eb6d3 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -1109,6 +1109,7 @@ set(DIFF diff)
set(PYTHON_PATH /usr/bin/python)
set(TAR tar)
set(NO_CURL )
+set(NO_ICONV )
set(NO_EXPAT )
set(USE_LIBPCRE2 )
set(NO_PERL )
@@ -1122,6 +1123,10 @@ if(NOT CURL_FOUND)
set(NO_CURL 1)
endif()
+if(NOT Iconv_FOUND)
+ SET(NO_ICONV 1)
+endif()
+
if(NOT EXPAT_FOUND)
set(NO_EXPAT 1)
endif()
@@ -1145,6 +1150,7 @@ file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "DIFF='${DIFF}'\n")
file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PYTHON_PATH='${PYTHON_PATH}'\n")
file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "TAR='${TAR}'\n")
file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_CURL='${NO_CURL}'\n")
+file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_ICONV='${NO_ICONV}'\n")
file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_EXPAT='${NO_EXPAT}'\n")
file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PERL='${NO_PERL}'\n")
file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PTHREADS='${NO_PTHREADS}'\n")
diff --git a/t/t0028-working-tree-encoding.sh b/t/t0028-working-tree-encoding.sh
index ad151a34670..510da4ca12d 100755
--- a/t/t0028-working-tree-encoding.sh
+++ b/t/t0028-working-tree-encoding.sh
@@ -12,6 +12,12 @@ TEST_CREATE_REPO_NO_TEMPLATE=1
GIT_TRACE_WORKING_TREE_ENCODING=1 && export GIT_TRACE_WORKING_TREE_ENCODING
+if ! test_have_prereq ICONV
+then
+ skip_all='skipping working tree encoding tests; iconv not available'
+ test_done
+fi
+
test_expect_success 'setup test files' '
git config core.eol lf &&
diff --git a/t/t2082-parallel-checkout-attributes.sh b/t/t2082-parallel-checkout-attributes.sh
index aec55496eb1..a040aa54cee 100755
--- a/t/t2082-parallel-checkout-attributes.sh
+++ b/t/t2082-parallel-checkout-attributes.sh
@@ -34,7 +34,7 @@ test_expect_success 'parallel-checkout with ident' '
)
'
-test_expect_success 'parallel-checkout with re-encoding' '
+test_expect_success ICONV 'parallel-checkout with re-encoding' '
set_checkout_config 2 0 &&
git init encoding &&
(
diff --git a/t/t3434-rebase-i18n.sh b/t/t3434-rebase-i18n.sh
index 26a48d6b103..97fc9a23f21 100755
--- a/t/t3434-rebase-i18n.sh
+++ b/t/t3434-rebase-i18n.sh
@@ -20,6 +20,12 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
+if ! test_have_prereq ICONV
+then
+ skip_all='skipping rebase i18n tests; iconv not available'
+ test_done
+fi
+
compare_msg () {
iconv -f "$2" -t "$3" "$TEST_DIRECTORY/t3434/$1" >expect &&
git cat-file commit HEAD >raw &&
diff --git a/t/t3900-i18n-commit.sh b/t/t3900-i18n-commit.sh
index db7b403bc15..9d4b5ab1f95 100755
--- a/t/t3900-i18n-commit.sh
+++ b/t/t3900-i18n-commit.sh
@@ -8,6 +8,12 @@ test_description='commit and log output encodings'
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
+if ! test_have_prereq ICONV
+then
+ skip_all='skipping commit i18n tests; iconv not available'
+ test_done
+fi
+
compare_with () {
git show -s $1 | sed -e '1,/^$/d' -e 's/^ //' >current &&
case "$3" in
diff --git a/t/t3901-i18n-patch.sh b/t/t3901-i18n-patch.sh
index 5f0b9afc3fa..e0659c92935 100755
--- a/t/t3901-i18n-patch.sh
+++ b/t/t3901-i18n-patch.sh
@@ -11,6 +11,12 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
+if ! test_have_prereq ICONV
+then
+ skip_all='skipping patch i18n tests; iconv not available'
+ test_done
+fi
+
check_encoding () {
# Make sure characters are not corrupted
cnt="$1" header="$2" i=1 j=0
diff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh
index 8fc40e75eb3..aa149e0085e 100755
--- a/t/t4041-diff-submodule-option.sh
+++ b/t/t4041-diff-submodule-option.sh
@@ -15,12 +15,18 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
-# Tested non-UTF-8 encoding
-test_encoding="ISO8859-1"
+# Test non-UTF-8 encoding in case iconv is available.
+if test_have_prereq ICONV
+then
+ test_encoding="ISO8859-1"
+ # String "added" in German (translated with Google Translate), encoded in UTF-8,
+ # used in sample commit log messages in add_file() function below.
+ added=$(printf "hinzugef\303\274gt")
+else
+ test_encoding="UTF-8"
+ added="added"
+fi
-# String "added" in German (translated with Google Translate), encoded in UTF-8,
-# used in sample commit log messages in add_file() function below.
-added=$(printf "hinzugef\303\274gt")
add_file () {
(
cd "$1" &&
diff --git a/t/t4059-diff-submodule-not-initialized.sh b/t/t4059-diff-submodule-not-initialized.sh
index 668f5263038..28fd3cdb154 100755
--- a/t/t4059-diff-submodule-not-initialized.sh
+++ b/t/t4059-diff-submodule-not-initialized.sh
@@ -12,12 +12,18 @@ initialized previously but the checkout has since been removed.
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
-# Tested non-UTF-8 encoding
-test_encoding="ISO8859-1"
-# String "added" in German (translated with Google Translate), encoded in UTF-8,
-# used in sample commit log messages in add_file() function below.
-added=$(printf "hinzugef\303\274gt")
+# Test non-UTF-8 encoding in case iconv is available.
+if test_have_prereq ICONV
+then
+ test_encoding="ISO8859-1"
+ # String "added" in German (translated with Google Translate), encoded in UTF-8,
+ # used in sample commit log messages in add_file() function below.
+ added=$(printf "hinzugef\303\274gt")
+else
+ test_encoding="UTF-8"
+ added="added"
+fi
add_file () {
(
diff --git a/t/t4060-diff-submodule-option-diff-format.sh b/t/t4060-diff-submodule-option-diff-format.sh
index 8ce67442d96..918334fa4c8 100755
--- a/t/t4060-diff-submodule-option-diff-format.sh
+++ b/t/t4060-diff-submodule-option-diff-format.sh
@@ -13,12 +13,17 @@ This test tries to verify the sanity of --submodule=diff option of git diff.
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
-# Tested non-UTF-8 encoding
-test_encoding="ISO8859-1"
-
-# String "added" in German (translated with Google Translate), encoded in UTF-8,
-# used in sample commit log messages in add_file() function below.
-added=$(printf "hinzugef\303\274gt")
+# Test non-UTF-8 encoding in case iconv is available.
+if test_have_prereq ICONV
+then
+ test_encoding="ISO8859-1"
+ # String "added" in German (translated with Google Translate), encoded in UTF-8,
+ # used in sample commit log messages in add_file() function below.
+ added=$(printf "hinzugef\303\274gt")
+else
+ test_encoding="UTF-8"
+ added="added"
+fi
add_file () {
(
diff --git a/t/t4201-shortlog.sh b/t/t4201-shortlog.sh
index c20c8857244..680e707ba1e 100755
--- a/t/t4201-shortlog.sh
+++ b/t/t4201-shortlog.sh
@@ -105,7 +105,7 @@ test_expect_success 'output from user-defined format is re-wrapped' '
test_cmp expect log.predictable
'
-test_expect_success !MINGW 'shortlog wrapping' '
+test_expect_success ICONV 'shortlog wrapping' '
cat >expect <<\EOF &&
A U Thor (5):
Test
@@ -126,13 +126,13 @@ EOF
test_cmp expect out
'
-test_expect_success !MINGW 'shortlog from non-git directory' '
+test_expect_success ICONV 'shortlog from non-git directory' '
git log --no-expand-tabs HEAD >log &&
GIT_DIR=non-existing git shortlog -w <log >out &&
test_cmp expect out
'
-test_expect_success !MINGW 'shortlog can read --format=raw output' '
+test_expect_success ICONV 'shortlog can read --format=raw output' '
git log --format=raw HEAD >log &&
GIT_DIR=non-existing git shortlog -w <log >out &&
test_cmp expect out
@@ -182,7 +182,7 @@ $DSCHO (2):
EOF
-test_expect_success !MINGW 'shortlog encoding' '
+test_expect_success ICONV 'shortlog encoding' '
git reset --hard "$commit" &&
git config --unset i18n.commitencoding &&
echo 2 > a1 &&
diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
index eb63ce011fa..dbbd6125510 100755
--- a/t/t4205-log-pretty-formats.sh
+++ b/t/t4205-log-pretty-formats.sh
@@ -114,19 +114,19 @@ test_expect_success 'alias loop' '
test_must_fail git log --pretty=test-foo
'
-test_expect_success 'NUL separation' '
+test_expect_success ICONV 'NUL separation' '
printf "add bar\0$(commit_msg)" >expected &&
git log -z --pretty="format:%s" >actual &&
test_cmp expected actual
'
-test_expect_success 'NUL termination' '
+test_expect_success ICONV 'NUL termination' '
printf "add bar\0$(commit_msg)\0" >expected &&
git log -z --pretty="tformat:%s" >actual &&
test_cmp expected actual
'
-test_expect_success 'NUL separation with --stat' '
+test_expect_success ICONV 'NUL separation with --stat' '
stat0_part=$(git diff --stat HEAD^ HEAD) &&
stat1_part=$(git diff-tree --no-commit-id --stat --root HEAD^) &&
printf "add bar\n$stat0_part\n\0$(commit_msg)\n$stat1_part\n" >expected &&
@@ -181,7 +181,7 @@ test_expect_success 'setup more commits' '
head4=$(git rev-parse --verify --short HEAD~3)
'
-test_expect_success 'left alignment formatting' '
+test_expect_success ICONV 'left alignment formatting' '
git log --pretty="tformat:%<(40)%s" >actual &&
qz_to_tab_space <<-EOF >expected &&
message two Z
@@ -192,7 +192,7 @@ test_expect_success 'left alignment formatting' '
test_cmp expected actual
'
-test_expect_success 'left alignment formatting. i18n.logOutputEncoding' '
+test_expect_success ICONV 'left alignment formatting. i18n.logOutputEncoding' '
git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%<(40)%s" >actual &&
qz_to_tab_space <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
message two Z
@@ -203,7 +203,7 @@ test_expect_success 'left alignment formatting. i18n.logOutputEncoding' '
test_cmp expected actual
'
-test_expect_success 'left alignment formatting at the nth column' '
+test_expect_success ICONV 'left alignment formatting at the nth column' '
git log --pretty="tformat:%h %<|(40)%s" >actual &&
qz_to_tab_space <<-EOF >expected &&
$head1 message two Z
@@ -214,7 +214,7 @@ test_expect_success 'left alignment formatting at the nth column' '
test_cmp expected actual
'
-test_expect_success 'left alignment formatting at the nth column' '
+test_expect_success ICONV 'left alignment formatting at the nth column' '
COLUMNS=50 git log --pretty="tformat:%h %<|(-10)%s" >actual &&
qz_to_tab_space <<-EOF >expected &&
$head1 message two Z
@@ -225,7 +225,7 @@ test_expect_success 'left alignment formatting at the nth column' '
test_cmp expected actual
'
-test_expect_success 'left alignment formatting at the nth column. i18n.logOutputEncoding' '
+test_expect_success ICONV 'left alignment formatting at the nth column. i18n.logOutputEncoding' '
git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%h %<|(40)%s" >actual &&
qz_to_tab_space <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
$head1 message two Z
@@ -236,7 +236,7 @@ test_expect_success 'left alignment formatting at the nth column. i18n.logOutput
test_cmp expected actual
'
-test_expect_success 'left alignment formatting with no padding' '
+test_expect_success ICONV 'left alignment formatting with no padding' '
git log --pretty="tformat:%<(1)%s" >actual &&
cat <<-EOF >expected &&
message two
@@ -258,7 +258,7 @@ test_expect_success 'left alignment formatting with no padding. i18n.logOutputEn
test_cmp expected actual
'
-test_expect_success 'left alignment formatting with trunc' '
+test_expect_success ICONV 'left alignment formatting with trunc' '
git log --pretty="tformat:%<(10,trunc)%s" >actual &&
qz_to_tab_space <<-\EOF >expected &&
message ..
@@ -269,7 +269,7 @@ test_expect_success 'left alignment formatting with trunc' '
test_cmp expected actual
'
-test_expect_success 'left alignment formatting with trunc. i18n.logOutputEncoding' '
+test_expect_success ICONV 'left alignment formatting with trunc. i18n.logOutputEncoding' '
git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%<(10,trunc)%s" >actual &&
qz_to_tab_space <<-\EOF | iconv -f utf-8 -t $test_encoding >expected &&
message ..
@@ -280,7 +280,7 @@ test_expect_success 'left alignment formatting with trunc. i18n.logOutputEncodin
test_cmp expected actual
'
-test_expect_success 'left alignment formatting with ltrunc' '
+test_expect_success ICONV 'left alignment formatting with ltrunc' '
git log --pretty="tformat:%<(10,ltrunc)%s" >actual &&
qz_to_tab_space <<-EOF >expected &&
..sage two
@@ -291,7 +291,7 @@ test_expect_success 'left alignment formatting with ltrunc' '
test_cmp expected actual
'
-test_expect_success 'left alignment formatting with ltrunc. i18n.logOutputEncoding' '
+test_expect_success ICONV 'left alignment formatting with ltrunc. i18n.logOutputEncoding' '
git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%<(10,ltrunc)%s" >actual &&
qz_to_tab_space <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
..sage two
@@ -302,7 +302,7 @@ test_expect_success 'left alignment formatting with ltrunc. i18n.logOutputEncodi
test_cmp expected actual
'
-test_expect_success 'left alignment formatting with mtrunc' '
+test_expect_success ICONV 'left alignment formatting with mtrunc' '
git log --pretty="tformat:%<(10,mtrunc)%s" >actual &&
qz_to_tab_space <<-\EOF >expected &&
mess.. two
@@ -313,7 +313,7 @@ test_expect_success 'left alignment formatting with mtrunc' '
test_cmp expected actual
'
-test_expect_success 'left alignment formatting with mtrunc. i18n.logOutputEncoding' '
+test_expect_success ICONV 'left alignment formatting with mtrunc. i18n.logOutputEncoding' '
git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%<(10,mtrunc)%s" >actual &&
qz_to_tab_space <<-\EOF | iconv -f utf-8 -t $test_encoding >expected &&
mess.. two
@@ -324,7 +324,7 @@ test_expect_success 'left alignment formatting with mtrunc. i18n.logOutputEncodi
test_cmp expected actual
'
-test_expect_success 'right alignment formatting' '
+test_expect_success ICONV 'right alignment formatting' '
git log --pretty="tformat:%>(40)%s" >actual &&
qz_to_tab_space <<-EOF >expected &&
Z message two
@@ -335,7 +335,7 @@ test_expect_success 'right alignment formatting' '
test_cmp expected actual
'
-test_expect_success 'right alignment formatting. i18n.logOutputEncoding' '
+test_expect_success ICONV 'right alignment formatting. i18n.logOutputEncoding' '
git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%>(40)%s" >actual &&
qz_to_tab_space <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
Z message two
@@ -346,7 +346,7 @@ test_expect_success 'right alignment formatting. i18n.logOutputEncoding' '
test_cmp expected actual
'
-test_expect_success 'right alignment formatting at the nth column' '
+test_expect_success ICONV 'right alignment formatting at the nth column' '
git log --pretty="tformat:%h %>|(40)%s" >actual &&
qz_to_tab_space <<-EOF >expected &&
$head1 message two
@@ -357,7 +357,7 @@ test_expect_success 'right alignment formatting at the nth column' '
test_cmp expected actual
'
-test_expect_success 'right alignment formatting at the nth column' '
+test_expect_success ICONV 'right alignment formatting at the nth column' '
COLUMNS=50 git log --pretty="tformat:%h %>|(-10)%s" >actual &&
qz_to_tab_space <<-EOF >expected &&
$head1 message two
@@ -368,7 +368,7 @@ test_expect_success 'right alignment formatting at the nth column' '
test_cmp expected actual
'
-test_expect_success 'right alignment formatting at the nth column. i18n.logOutputEncoding' '
+test_expect_success ICONV 'right alignment formatting at the nth column. i18n.logOutputEncoding' '
git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%h %>|(40)%s" >actual &&
qz_to_tab_space <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
$head1 message two
@@ -381,7 +381,7 @@ test_expect_success 'right alignment formatting at the nth column. i18n.logOutpu
# Note: Space between 'message' and 'two' should be in the same column
# as in previous test.
-test_expect_success 'right alignment formatting at the nth column with --graph. i18n.logOutputEncoding' '
+test_expect_success ICONV 'right alignment formatting at the nth column with --graph. i18n.logOutputEncoding' '
git -c i18n.logOutputEncoding=$test_encoding log --graph --pretty="tformat:%h %>|(40)%s" >actual &&
iconv -f utf-8 -t $test_encoding >expected <<-EOF &&
* $head1 message two
@@ -392,7 +392,7 @@ test_expect_success 'right alignment formatting at the nth column with --graph.
test_cmp expected actual
'
-test_expect_success 'right alignment formatting with no padding' '
+test_expect_success ICONV 'right alignment formatting with no padding' '
git log --pretty="tformat:%>(1)%s" >actual &&
cat <<-EOF >expected &&
message two
@@ -403,7 +403,7 @@ test_expect_success 'right alignment formatting with no padding' '
test_cmp expected actual
'
-test_expect_success 'right alignment formatting with no padding and with --graph' '
+test_expect_success ICONV 'right alignment formatting with no padding and with --graph' '
git log --graph --pretty="tformat:%>(1)%s" >actual &&
cat <<-EOF >expected &&
* message two
@@ -414,7 +414,7 @@ test_expect_success 'right alignment formatting with no padding and with --graph
test_cmp expected actual
'
-test_expect_success 'right alignment formatting with no padding. i18n.logOutputEncoding' '
+test_expect_success ICONV 'right alignment formatting with no padding. i18n.logOutputEncoding' '
git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%>(1)%s" >actual &&
cat <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
message two
@@ -425,7 +425,7 @@ test_expect_success 'right alignment formatting with no padding. i18n.logOutputE
test_cmp expected actual
'
-test_expect_success 'center alignment formatting' '
+test_expect_success ICONV 'center alignment formatting' '
git log --pretty="tformat:%><(40)%s" >actual &&
qz_to_tab_space <<-EOF >expected &&
Z message two Z
@@ -436,7 +436,7 @@ test_expect_success 'center alignment formatting' '
test_cmp expected actual
'
-test_expect_success 'center alignment formatting. i18n.logOutputEncoding' '
+test_expect_success ICONV 'center alignment formatting. i18n.logOutputEncoding' '
git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%><(40)%s" >actual &&
qz_to_tab_space <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
Z message two Z
@@ -446,7 +446,7 @@ test_expect_success 'center alignment formatting. i18n.logOutputEncoding' '
EOF
test_cmp expected actual
'
-test_expect_success 'center alignment formatting at the nth column' '
+test_expect_success ICONV 'center alignment formatting at the nth column' '
git log --pretty="tformat:%h %><|(40)%s" >actual &&
qz_to_tab_space <<-EOF >expected &&
$head1 message two Z
@@ -457,7 +457,7 @@ test_expect_success 'center alignment formatting at the nth column' '
test_cmp expected actual
'
-test_expect_success 'center alignment formatting at the nth column' '
+test_expect_success ICONV 'center alignment formatting at the nth column' '
COLUMNS=70 git log --pretty="tformat:%h %><|(-30)%s" >actual &&
qz_to_tab_space <<-EOF >expected &&
$head1 message two Z
@@ -468,7 +468,7 @@ test_expect_success 'center alignment formatting at the nth column' '
test_cmp expected actual
'
-test_expect_success 'center alignment formatting at the nth column. i18n.logOutputEncoding' '
+test_expect_success ICONV 'center alignment formatting at the nth column. i18n.logOutputEncoding' '
git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%h %><|(40)%s" >actual &&
qz_to_tab_space <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
$head1 message two Z
@@ -479,7 +479,7 @@ test_expect_success 'center alignment formatting at the nth column. i18n.logOutp
test_cmp expected actual
'
-test_expect_success 'center alignment formatting with no padding' '
+test_expect_success ICONV 'center alignment formatting with no padding' '
git log --pretty="tformat:%><(1)%s" >actual &&
cat <<-EOF >expected &&
message two
@@ -493,7 +493,7 @@ test_expect_success 'center alignment formatting with no padding' '
# save HEAD's SHA-1 digest (with no abbreviations) to use it below
# as far as the next test amends HEAD
old_head1=$(git rev-parse --verify HEAD~0)
-test_expect_success 'center alignment formatting with no padding. i18n.logOutputEncoding' '
+test_expect_success ICONV 'center alignment formatting with no padding. i18n.logOutputEncoding' '
git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%><(1)%s" >actual &&
cat <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
message two
@@ -504,7 +504,7 @@ test_expect_success 'center alignment formatting with no padding. i18n.logOutput
test_cmp expected actual
'
-test_expect_success 'left/right alignment formatting with stealing' '
+test_expect_success ICONV 'left/right alignment formatting with stealing' '
git commit --amend -m short --author "long long long <long@me.com>" &&
git log --pretty="tformat:%<(10,trunc)%s%>>(10,ltrunc)% an" >actual &&
cat <<-\EOF >expected &&
@@ -515,7 +515,7 @@ test_expect_success 'left/right alignment formatting with stealing' '
EOF
test_cmp expected actual
'
-test_expect_success 'left/right alignment formatting with stealing. i18n.logOutputEncoding' '
+test_expect_success ICONV 'left/right alignment formatting with stealing. i18n.logOutputEncoding' '
git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%<(10,trunc)%s%>>(10,ltrunc)% an" >actual &&
cat <<-\EOF | iconv -f utf-8 -t $test_encoding >expected &&
short long long long
@@ -564,22 +564,38 @@ test_expect_success 'log decoration properly follows tag chain' '
git tag -d tag1 &&
git commit --amend -m shorter &&
git log --no-walk --tags --pretty="%H %d" --decorate=full >actual &&
- cat <<-EOF >expected &&
- $head2 (tag: refs/tags/message-one)
- $old_head1 (tag: refs/tags/message-two)
- $head1 (tag: refs/tags/tag2)
- EOF
+ if test_have_prereq ICONV
+ then
+ cat <<-EOF >expected
+ $head2 (tag: refs/tags/message-one)
+ $old_head1 (tag: refs/tags/message-two)
+ $head1 (tag: refs/tags/tag2)
+ EOF
+ else
+ cat <<-EOF >expected
+ $head2 (tag: refs/tags/message-one)
+ $old_head1 (tag: refs/tags/tag2, tag: refs/tags/message-two)
+ EOF
+ fi &&
sort -k3 actual >actual1 &&
test_cmp expected actual1
'
test_expect_success 'clean log decoration' '
git log --no-walk --tags --pretty="%H %D" --decorate=full >actual &&
- cat >expected <<-EOF &&
- $head2 tag: refs/tags/message-one
- $old_head1 tag: refs/tags/message-two
- $head1 tag: refs/tags/tag2
- EOF
+ if test_have_prereq ICONV
+ then
+ cat <<-EOF >expected
+ $head2 tag: refs/tags/message-one
+ $old_head1 tag: refs/tags/message-two
+ $head1 tag: refs/tags/tag2
+ EOF
+ else
+ cat <<-EOF >expected
+ $head2 tag: refs/tags/message-one
+ $old_head1 tag: refs/tags/tag2, tag: refs/tags/message-two
+ EOF
+ fi &&
sort -k3 actual >actual1 &&
test_cmp expected actual1
'
diff --git a/t/t4210-log-i18n.sh b/t/t4210-log-i18n.sh
index 7120030b5c6..4a12b2b4979 100755
--- a/t/t4210-log-i18n.sh
+++ b/t/t4210-log-i18n.sh
@@ -5,6 +5,12 @@ test_description='test log with i18n features'
TEST_PASSES_SANITIZE_LEAK=true
. ./lib-gettext.sh
+if ! test_have_prereq ICONV
+then
+ skip_all='skipping log i18n tests; iconv not available'
+ test_done
+fi
+
# two forms of é
utf8_e=$(printf '\303\251')
latin1_e=$(printf '\351')
diff --git a/t/t4254-am-corrupt.sh b/t/t4254-am-corrupt.sh
index 661feb60709..cb03522d021 100755
--- a/t/t4254-am-corrupt.sh
+++ b/t/t4254-am-corrupt.sh
@@ -5,6 +5,12 @@ test_description='git am with corrupt input'
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
+if ! test_have_prereq ICONV
+then
+ skip_all='skipping am encoding corruption tests; iconv not available'
+ test_done
+fi
+
make_mbox_with_nul () {
space=' '
q_nul_in_subject=
diff --git a/t/t5100-mailinfo.sh b/t/t5100-mailinfo.sh
index 065156c1f39..23b2f218725 100755
--- a/t/t5100-mailinfo.sh
+++ b/t/t5100-mailinfo.sh
@@ -28,7 +28,12 @@ check_mailinfo () {
for mail in 00*
do
- test_expect_success "mailinfo $mail" '
+ case "$mail" in
+ 0004)
+ prereq=ICONV;;
+ esac
+
+ test_expect_success $prereq "mailinfo $mail" '
check_mailinfo "$mail" "" &&
if test -f "$DATA/msg$mail--scissors"
then
@@ -56,7 +61,12 @@ test_expect_success 'split box with rfc2047 samples' \
for mail in rfc2047/00*
do
- test_expect_success "mailinfo $mail" '
+ case "$mail" in
+ rfc2047/0001)
+ prereq=ICONV;;
+ esac
+
+ test_expect_success $prereq "mailinfo $mail" '
git mailinfo -u "$mail-msg" "$mail-patch" <"$mail" >"$mail-info" &&
echo msg &&
test_cmp "$DATA/empty" "$mail-msg" &&
diff --git a/t/t5550-http-fetch-dumb.sh b/t/t5550-http-fetch-dumb.sh
index 58189c9f7dc..3c873de17ec 100755
--- a/t/t5550-http-fetch-dumb.sh
+++ b/t/t5550-http-fetch-dumb.sh
@@ -344,12 +344,12 @@ test_expect_success 'git client shows text/plain with a charset' '
grep "this is the error message" stderr
'
-test_expect_success 'http error messages are reencoded' '
+test_expect_success ICONV 'http error messages are reencoded' '
test_must_fail git clone "$HTTPD_URL/error/utf16" 2>stderr &&
grep "this is the error message" stderr
'
-test_expect_success 'reencoding is robust to whitespace oddities' '
+test_expect_success ICONV 'reencoding is robust to whitespace oddities' '
test_must_fail git clone "$HTTPD_URL/error/odd-spacing" 2>stderr &&
grep "this is the error message" stderr
'
diff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh
index f1623b1c06d..2a01a62a2f3 100755
--- a/t/t6006-rev-list-format.sh
+++ b/t/t6006-rev-list-format.sh
@@ -13,21 +13,41 @@ TEST_PASSES_SANITIZE_LEAK=true
. "$TEST_DIRECTORY"/lib-terminal.sh
test_tick
-# Tested non-UTF-8 encoding
-test_encoding="ISO8859-1"
-
-# String "added" in German
-# (translated with Google Translate),
-# encoded in UTF-8, used as a commit log message below.
-added_utf8_part=$(printf "\303\274")
-added_utf8_part_iso88591=$(echo "$added_utf8_part" | iconv -f utf-8 -t $test_encoding)
-added=$(printf "added (hinzugef${added_utf8_part}gt) foo")
-added_iso88591=$(echo "$added" | iconv -f utf-8 -t $test_encoding)
-# same but "changed"
-changed_utf8_part=$(printf "\303\244")
-changed_utf8_part_iso88591=$(echo "$changed_utf8_part" | iconv -f utf-8 -t $test_encoding)
-changed=$(printf "changed (ge${changed_utf8_part}ndert) foo")
-changed_iso88591=$(echo "$changed" | iconv -f utf-8 -t $test_encoding)
+
+if test_have_prereq ICONV
+then
+ # Tested non-UTF-8 encoding
+ test_encoding="ISO8859-1"
+
+ # String "added" in German
+ # (translated with Google Translate),
+ # encoded in UTF-8, used as a commit log message below.
+ added_utf8_part=$(printf "\303\274")
+ added_utf8_part_iso88591=$(echo "$added_utf8_part" | iconv -f utf-8 -t $test_encoding)
+ added=$(printf "added (hinzugef${added_utf8_part}gt) foo")
+ added_iso88591=$(echo "$added" | iconv -f utf-8 -t $test_encoding)
+ # same but "changed"
+ changed_utf8_part=$(printf "\303\244")
+ changed_utf8_part_iso88591=$(echo "$changed_utf8_part" | iconv -f utf-8 -t $test_encoding)
+ changed=$(printf "changed (ge${changed_utf8_part}ndert) foo")
+ changed_iso88591=$(echo "$changed" | iconv -f utf-8 -t $test_encoding)
+else
+ # Tested non-UTF-8 encoding
+ test_encoding="UTF-8"
+
+ # String "added" in German
+ # (translated with Google Translate),
+ # encoded in UTF-8, used as a commit log message below.
+ added_utf8_part="u"
+ added_utf8_part_iso88591="u"
+ added=$(printf "added (hinzugef${added_utf8_part}gt) foo")
+ added_iso88591="$added"
+ # same but "changed"
+ changed_utf8_part="a"
+ changed_utf8_part_iso88591="a"
+ changed=$(printf "changed (ge${changed_utf8_part}ndert) foo")
+ changed_iso88591="$changed"
+fi
# Count of char to truncate
# Number is chosen so, that non-ACSII characters
@@ -198,7 +218,7 @@ Thu, 7 Apr 2005 15:13:13 -0700
1112911993
EOF
-test_format encoding %e <<EOF
+test_format ICONV encoding %e <<EOF
commit $head2
$test_encoding
commit $head1
@@ -374,7 +394,7 @@ test_expect_success 'setup complex body' '
head3_short=$(git rev-parse --short $head3)
'
-test_format complex-encoding %e <<EOF
+test_format ICONV complex-encoding %e <<EOF
commit $head3
$test_encoding
commit $head2
diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh
index 2add26d7684..e9a6cc72658 100755
--- a/t/t7102-reset.sh
+++ b/t/t7102-reset.sh
@@ -13,21 +13,31 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
-commit_msg () {
- # String "modify 2nd file (changed)" partly in German
- # (translated with Google Translate),
- # encoded in UTF-8, used as a commit log message below.
- msg="modify 2nd file (ge\303\244ndert)\n"
- if test -n "$1"
- then
- printf "$msg" | iconv -f utf-8 -t "$1"
- else
- printf "$msg"
- fi
-}
-
-# Tested non-UTF-8 encoding
-test_encoding="ISO8859-1"
+if test_have_prereq ICONV
+then
+ commit_msg () {
+ # String "modify 2nd file (changed)" partly in German
+ # (translated with Google Translate),
+ # encoded in UTF-8, used as a commit log message below.
+ msg="modify 2nd file (ge\303\244ndert)\n"
+ if test -n "$1"
+ then
+ printf "$msg" | iconv -f utf-8 -t "$1"
+ else
+ printf "$msg"
+ fi
+ }
+
+ # Tested non-UTF-8 encoding
+ test_encoding="ISO8859-1"
+else
+ commit_msg () {
+ echo "modify 2nd file (geandert)"
+ }
+
+ # Tested non-UTF-8 encoding
+ test_encoding="UTF-8"
+fi
test_expect_success 'creating initial files and commits' '
test_tick &&
diff --git a/t/t8005-blame-i18n.sh b/t/t8005-blame-i18n.sh
index 75da219ed1b..7a1f581c240 100755
--- a/t/t8005-blame-i18n.sh
+++ b/t/t8005-blame-i18n.sh
@@ -3,6 +3,12 @@
test_description='git blame encoding conversion'
. ./test-lib.sh
+if ! test_have_prereq ICONV
+then
+ skip_all='skipping blame i18n tests; iconv not available'
+ test_done
+fi
+
. "$TEST_DIRECTORY"/t8005/utf8.txt
. "$TEST_DIRECTORY"/t8005/euc-japan.txt
. "$TEST_DIRECTORY"/t8005/sjis.txt
diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index 3b3c371740a..6224f54d4d2 100755
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
@@ -3676,7 +3676,7 @@ test_expect_success !MINGW 'W: get-mark & empty orphan commit with erroneous thi
### series X (other new features)
###
-test_expect_success 'X: handling encoding' '
+test_expect_success ICONV 'X: handling encoding' '
test_tick &&
cat >input <<-INPUT_END &&
commit refs/heads/encoding
diff --git a/t/t9350-fast-export.sh b/t/t9350-fast-export.sh
index 1eb035ee4ce..aa33791b77b 100755
--- a/t/t9350-fast-export.sh
+++ b/t/t9350-fast-export.sh
@@ -124,7 +124,7 @@ test_expect_success 'fast-export --show-original-ids | git fast-import' '
test $MUSS = $(git rev-parse --verify refs/tags/muss)
'
-test_expect_success 'reencoding iso-8859-7' '
+test_expect_success ICONV 'reencoding iso-8859-7' '
test_when_finished "git reset --hard HEAD~1" &&
test_config i18n.commitencoding iso-8859-7 &&
@@ -420,7 +420,7 @@ M 100644 :1 there
EOF
-test_expect_success 'dropping tag of filtered out object' '
+test_expect_success ICONV 'dropping tag of filtered out object' '
(
cd limit-by-paths &&
git fast-export --tag-of-filtered-object=drop mytag -- there > output &&
@@ -437,7 +437,7 @@ msg
EOF
-test_expect_success 'rewriting tag of filtered out object' '
+test_expect_success ICONV 'rewriting tag of filtered out object' '
(
cd limit-by-paths &&
git fast-export --tag-of-filtered-object=rewrite mytag -- there > output &&
@@ -666,7 +666,7 @@ M 100644 :13 file
EOF
-test_expect_success 'avoid uninteresting refs' '
+test_expect_success ICONV 'avoid uninteresting refs' '
> tmp-marks &&
git fast-export --import-marks=tmp-marks \
--export-marks=tmp-marks main > /dev/null &&
@@ -685,7 +685,7 @@ from :14
EOF
-test_expect_success 'refs are updated even if no commits need to be exported' '
+test_expect_success ICONV 'refs are updated even if no commits need to be exported' '
> tmp-marks &&
git fast-export --import-marks=tmp-marks \
--export-marks=tmp-marks main > /dev/null &&
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 241198ba95f..a278181a056 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1743,6 +1743,7 @@ esac
( COLUMNS=1 && test $COLUMNS = 1 ) && test_set_prereq COLUMNS_CAN_BE_1
test -z "$NO_CURL" && test_set_prereq LIBCURL
+test -z "$NO_ICONV" && test_set_prereq ICONV
test -z "$NO_PERL" && test_set_prereq PERL
test -z "$NO_PTHREADS" && test_set_prereq PTHREADS
test -z "$NO_PYTHON" && test_set_prereq PYTHON
--
2.47.0.rc1.33.g90fe3800b9.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v2 03/24] t/lib-gitweb: test against the build version of gitweb
2024-10-09 14:56 ` [RFC PATCH v2 00/24] Modernize our " Patrick Steinhardt
2024-10-09 14:56 ` [RFC PATCH v2 01/24] t/test-lib: fix quoting of TEST_RESULTS_SAN_FILE Patrick Steinhardt
2024-10-09 14:56 ` [RFC PATCH v2 02/24] t/test-lib: wire up NO_ICONV prerequisite Patrick Steinhardt
@ 2024-10-09 14:56 ` Patrick Steinhardt
2024-10-09 14:56 ` [RFC PATCH v2 04/24] t/lib-gpg: fix setup of GNUPGHOME in MinGW Patrick Steinhardt
` (22 subsequent siblings)
25 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-09 14:56 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano
When testing gitweb we set up the CGI script as "gitweb.perl", which is
the source file of the build target "gitweb.cgi". This works alright as
long as we run in-tree tests. But we're about to make out-of-tree tests
a reality, and there things will break because "gitweb.perl" will not be
found in the build directory.
Fix this by using "gitweb.cgi" instead.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
t/lib-gitweb.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/lib-gitweb.sh b/t/lib-gitweb.sh
index 1f32ca66ea5..c64c87fb87d 100644
--- a/t/lib-gitweb.sh
+++ b/t/lib-gitweb.sh
@@ -49,7 +49,7 @@ EOF
error "Cannot find gitweb at $GITWEB_TEST_INSTALLED."
say "# Testing $SCRIPT_NAME"
else # normal case, use source version of gitweb
- SCRIPT_NAME="$GIT_BUILD_DIR/gitweb/gitweb.perl"
+ SCRIPT_NAME="$GIT_BUILD_DIR/gitweb/gitweb.cgi"
fi
export SCRIPT_NAME
}
--
2.47.0.rc1.33.g90fe3800b9.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v2 04/24] t/lib-gpg: fix setup of GNUPGHOME in MinGW
2024-10-09 14:56 ` [RFC PATCH v2 00/24] Modernize our " Patrick Steinhardt
` (2 preceding siblings ...)
2024-10-09 14:56 ` [RFC PATCH v2 03/24] t/lib-gitweb: test against the build version of gitweb Patrick Steinhardt
@ 2024-10-09 14:56 ` Patrick Steinhardt
2024-10-09 14:56 ` [RFC PATCH v2 05/24] t1401: make invocation of tar(1) work with Win32-provided one Patrick Steinhardt
` (21 subsequent siblings)
25 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-09 14:56 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano
In "t/lib-gpg.sh" we set up the "GNUPGHOME" environment variable to
point to a test-specific directory. This is done by using "$PWD/gpghome"
as value, where "$PWD" is the current test's trash directory.
This is broken for MinGW though because "$PWD" will use Windows-style
paths that contain drive letters. What we really want in this context is
a Unix-style path, which we can get by using `$(pwd)` instead. It is
somewhat puzzling that nobody ever hit this issue, but it may easily be
that nobody ever tests on Windows with GnuPG installed, which would make
us skip those tests.
Adapt the code accordingly to fix tests using this library.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
t/lib-gpg.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/lib-gpg.sh b/t/lib-gpg.sh
index add11e88fc0..3845b6ac449 100644
--- a/t/lib-gpg.sh
+++ b/t/lib-gpg.sh
@@ -6,7 +6,7 @@
# executed in an eval'ed subshell that changes the working directory to a
# temporary one.
-GNUPGHOME="$PWD/gpghome"
+GNUPGHOME="$(pwd)/gpghome"
export GNUPGHOME
test_lazy_prereq GPG '
--
2.47.0.rc1.33.g90fe3800b9.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v2 05/24] t1401: make invocation of tar(1) work with Win32-provided one
2024-10-09 14:56 ` [RFC PATCH v2 00/24] Modernize our " Patrick Steinhardt
` (3 preceding siblings ...)
2024-10-09 14:56 ` [RFC PATCH v2 04/24] t/lib-gpg: fix setup of GNUPGHOME in MinGW Patrick Steinhardt
@ 2024-10-09 14:56 ` Patrick Steinhardt
2024-10-09 14:56 ` [RFC PATCH v2 06/24] t3404: work around platform-specific behaviour on macOS 10.15 Patrick Steinhardt
` (20 subsequent siblings)
25 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-09 14:56 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano
Windows nowadays provides a tar(1) binary in "C:\Windows\system32". This
version of tar(1) doesn't seem to handle the case where directory paths
end with a trailing forward slash. And as we do that in t1401 the result
is that the test fails.
Drop the trailing slash. Other tests that use tar(1) work alright, this
is the only instance where it has been failing.
---
t/t1401-symbolic-ref.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/t1401-symbolic-ref.sh b/t/t1401-symbolic-ref.sh
index 5c60d6f812d..90af3f955c0 100755
--- a/t/t1401-symbolic-ref.sh
+++ b/t/t1401-symbolic-ref.sh
@@ -16,7 +16,7 @@ reset_to_sane() {
test_expect_success 'setup' '
git symbolic-ref HEAD refs/heads/foo &&
test_commit file &&
- "$TAR" cf .git.tar .git/
+ "$TAR" cf .git.tar .git
'
test_expect_success 'symbolic-ref read/write roundtrip' '
--
2.47.0.rc1.33.g90fe3800b9.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v2 06/24] t3404: work around platform-specific behaviour on macOS 10.15
2024-10-09 14:56 ` [RFC PATCH v2 00/24] Modernize our " Patrick Steinhardt
` (4 preceding siblings ...)
2024-10-09 14:56 ` [RFC PATCH v2 05/24] t1401: make invocation of tar(1) work with Win32-provided one Patrick Steinhardt
@ 2024-10-09 14:56 ` Patrick Steinhardt
2024-10-09 14:56 ` [RFC PATCH v2 07/24] t5500, t5601: skip tests which exercise paths with '[::1]' on Cygwin Patrick Steinhardt
` (19 subsequent siblings)
25 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-09 14:56 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano
Two of our tests in t3404 use indented HERE docs where leading tabs on
some of the lines are actually relevant. The tabs do get removed though,
and we try to fix this up by using sed(1) to replace leading tabs in the
actual output, as well. But macOS 10.15 uses an oldish version of sed(1)
that has BSD lineage, which does not understand "\t", and thus we fail
to strip those leading tabs and fail the test.
Address this issue by using `q_to_tab` such that we do not have to strip
leading tabs from the actual output.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
t/t3404-rebase-interactive.sh | 26 ++++++++++++--------------
1 file changed, 12 insertions(+), 14 deletions(-)
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index f171af3061d..7ce75237803 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -1917,18 +1917,17 @@ test_expect_success '--update-refs updates refs correctly' '
test_cmp_rev HEAD~1 refs/heads/third &&
test_cmp_rev HEAD refs/heads/no-conflict-branch &&
- cat >expect <<-\EOF &&
+ q_to_tab >expect <<-\EOF &&
Successfully rebased and updated refs/heads/update-refs.
Updated the following refs with --update-refs:
- refs/heads/first
- refs/heads/no-conflict-branch
- refs/heads/second
- refs/heads/third
+ Qrefs/heads/first
+ Qrefs/heads/no-conflict-branch
+ Qrefs/heads/second
+ Qrefs/heads/third
EOF
# Clear "Rebasing (X/Y)" progress lines and drop leading tabs.
- sed -e "s/Rebasing.*Successfully/Successfully/g" -e "s/^\t//g" \
- <err >err.trimmed &&
+ sed "s/Rebasing.*Successfully/Successfully/g" <err >err.trimmed &&
test_cmp expect err.trimmed
'
@@ -2178,19 +2177,18 @@ test_expect_success '--update-refs: check failed ref update' '
test_must_fail git rebase --continue 2>err &&
grep "update_ref failed for ref '\''refs/heads/second'\''" err &&
- cat >expect <<-\EOF &&
+ q_to_tab >expect <<-\EOF &&
Updated the following refs with --update-refs:
- refs/heads/first
- refs/heads/no-conflict-branch
- refs/heads/third
+ Qrefs/heads/first
+ Qrefs/heads/no-conflict-branch
+ Qrefs/heads/third
Failed to update the following refs with --update-refs:
- refs/heads/second
+ Qrefs/heads/second
EOF
# Clear "Rebasing (X/Y)" progress lines and drop leading tabs.
tail -n 6 err >err.last &&
- sed -e "s/Rebasing.*Successfully/Successfully/g" -e "s/^\t//g" \
- <err.last >err.trimmed &&
+ sed "s/Rebasing.*Successfully/Successfully/g" <err.last >err.trimmed &&
test_cmp expect err.trimmed
'
--
2.47.0.rc1.33.g90fe3800b9.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v2 07/24] t5500, t5601: skip tests which exercise paths with '[::1]' on Cygwin
2024-10-09 14:56 ` [RFC PATCH v2 00/24] Modernize our " Patrick Steinhardt
` (5 preceding siblings ...)
2024-10-09 14:56 ` [RFC PATCH v2 06/24] t3404: work around platform-specific behaviour on macOS 10.15 Patrick Steinhardt
@ 2024-10-09 14:56 ` Patrick Steinhardt
2024-10-09 14:56 ` [RFC PATCH v2 08/24] t7300: work around platform-specific behaviour with long paths on MinGW Patrick Steinhardt
` (18 subsequent siblings)
25 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-09 14:56 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano
Parsing repositories which contain '[::1]' is broken on Cygwin. It seems
as if Cygwin is confusing those as drive letter prefixes or something
like this, but I couldn't deduce the actual root cause.
Mark those tests as broken for now.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
t/t5500-fetch-pack.sh | 14 ++++++++++----
t/t5601-clone.sh | 11 +++++++++--
2 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh
index 605f17240c1..416522c86ad 100755
--- a/t/t5500-fetch-pack.sh
+++ b/t/t5500-fetch-pack.sh
@@ -774,7 +774,7 @@ do
# file with scheme
for p in file
do
- test_expect_success !MINGW "fetch-pack --diag-url $p://$h/$r" '
+ test_expect_success !WINDOWS "fetch-pack --diag-url $p://$h/$r" '
check_prot_path $p://$h/$r $p "/$r"
'
test_expect_success MINGW "fetch-pack --diag-url $p://$h/$r" '
@@ -784,7 +784,7 @@ do
check_prot_path $p:///$r $p "/$r"
'
# No "/~" -> "~" conversion for file
- test_expect_success !MINGW "fetch-pack --diag-url $p://$h/~$r" '
+ test_expect_success !WINDOWS "fetch-pack --diag-url $p://$h/~$r" '
check_prot_path $p://$h/~$r $p "/~$r"
'
test_expect_success MINGW "fetch-pack --diag-url $p://$h/~$r" '
@@ -806,11 +806,17 @@ do
p=ssh
for h in host [::1]
do
- test_expect_success "fetch-pack --diag-url $h:$r" '
+ expectation="success"
+ if test_have_prereq CYGWIN && test "$h" = "[::1]"
+ then
+ expectation="failure"
+ fi
+
+ test_expect_$expectation "fetch-pack --diag-url $h:$r" '
check_prot_host_port_path $h:$r $p "$h" NONE "$r"
'
# Do "/~" -> "~" conversion
- test_expect_success "fetch-pack --diag-url $h:/~$r" '
+ test_expect_$expectation "fetch-pack --diag-url $h:/~$r" '
check_prot_host_port_path $h:/~$r $p "$h" NONE "~$r"
'
done
diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh
index 5d7ea147f1a..9fe665eadfb 100755
--- a/t/t5601-clone.sh
+++ b/t/t5601-clone.sh
@@ -530,10 +530,17 @@ do
'
done
+# Parsing of paths that look like IPv6 addresses is broken on Cygwin.
+expectation_for_ipv6_tests=success
+if test_have_prereq CYGWIN
+then
+ expectation_for_ipv6_tests=failure
+fi
+
#ipv6
for repo in rep rep/home/project 123
do
- test_expect_success "clone [::1]:$repo" '
+ test_expect_$expectation_for_ipv6_tests "clone [::1]:$repo" '
test_clone_url [::1]:$repo ::1 "$repo"
'
done
@@ -542,7 +549,7 @@ test_expect_success "clone host:/~repo" '
test_clone_url host:/~repo host "~repo"
'
-test_expect_success "clone [::1]:/~repo" '
+test_expect_$expectation_for_ipv6_tests "clone [::1]:/~repo" '
test_clone_url [::1]:/~repo ::1 "~repo"
'
--
2.47.0.rc1.33.g90fe3800b9.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v2 08/24] t7300: work around platform-specific behaviour with long paths on MinGW
2024-10-09 14:56 ` [RFC PATCH v2 00/24] Modernize our " Patrick Steinhardt
` (6 preceding siblings ...)
2024-10-09 14:56 ` [RFC PATCH v2 07/24] t5500, t5601: skip tests which exercise paths with '[::1]' on Cygwin Patrick Steinhardt
@ 2024-10-09 14:56 ` Patrick Steinhardt
2024-10-09 14:56 ` [RFC PATCH v2 09/24] t/unit-tests: update clar unit test framework Patrick Steinhardt
` (17 subsequent siblings)
25 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-09 14:56 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano
Windows by default has a restriction in place to only allow paths up to
260 characters. This restriction can nowadays be lifted by setting a
registry key, but is still active by default.
In t7300 we have one test that exercises the behaviour of git-clean(1)
with such long paths. Interestingly enough, this test fails on my system
that uses Windows 10 with mingw-w64 installed via MSYS2: instead of
observing ENAMETOOLONG, we observe ENOENT. This behaviour is consistent
across multiple different environments I have tried.
I cannot say why exactly we observe a different error here, but I would
not be surprised if this was either dependent on the Windows version,
the version of MinGW, the current working directory of Git or any kind
of combination of these.
Work around the issue by handling both errors.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
t/t7300-clean.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/t7300-clean.sh b/t/t7300-clean.sh
index 0aae0dee670..12ab25296b0 100755
--- a/t/t7300-clean.sh
+++ b/t/t7300-clean.sh
@@ -747,7 +747,7 @@ test_expect_success MINGW 'handle clean & core.longpaths = false nicely' '
test_must_fail git clean -xdf 2>.git/err &&
# grepping for a strerror string is unportable but it is OK here with
# MINGW prereq
- test_grep "too long" .git/err
+ test_grep -e "too long" -e "No such file or directory" .git/err
'
test_expect_success 'clean untracked paths by pathspec' '
--
2.47.0.rc1.33.g90fe3800b9.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v2 09/24] t/unit-tests: update clar unit test framework
2024-10-09 14:56 ` [RFC PATCH v2 00/24] Modernize our " Patrick Steinhardt
` (7 preceding siblings ...)
2024-10-09 14:56 ` [RFC PATCH v2 08/24] t7300: work around platform-specific behaviour with long paths on MinGW Patrick Steinhardt
@ 2024-10-09 14:56 ` Patrick Steinhardt
2024-10-09 14:56 ` [RFC PATCH v2 10/24] builtin/credential-cache: fix missing parameter for stub function Patrick Steinhardt
` (16 subsequent siblings)
25 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-09 14:56 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano
Update clar unit test framework to f065214 (Merge pull request #105 from
pks-t/pks-win32-stat-compat, 2024-10-03), which fixes some platform
compatibility issues with Windows.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
t/unit-tests/clar/.editorconfig | 13 +++
t/unit-tests/clar/.github/workflows/ci.yml | 20 +++-
t/unit-tests/clar/.gitignore | 1 +
t/unit-tests/clar/CMakeLists.txt | 28 ++++++
t/unit-tests/clar/clar.c | 111 ++++++++++-----------
t/unit-tests/clar/clar/print.h | 11 +-
t/unit-tests/clar/clar/sandbox.h | 17 ++--
t/unit-tests/clar/clar/summary.h | 14 +--
t/unit-tests/clar/test/.gitignore | 4 -
t/unit-tests/clar/test/CMakeLists.txt | 41 ++++++++
t/unit-tests/clar/test/Makefile | 39 --------
11 files changed, 175 insertions(+), 124 deletions(-)
create mode 100644 t/unit-tests/clar/.editorconfig
create mode 100644 t/unit-tests/clar/.gitignore
create mode 100644 t/unit-tests/clar/CMakeLists.txt
delete mode 100644 t/unit-tests/clar/test/.gitignore
create mode 100644 t/unit-tests/clar/test/CMakeLists.txt
delete mode 100644 t/unit-tests/clar/test/Makefile
diff --git a/t/unit-tests/clar/.editorconfig b/t/unit-tests/clar/.editorconfig
new file mode 100644
index 00000000000..aa343a42885
--- /dev/null
+++ b/t/unit-tests/clar/.editorconfig
@@ -0,0 +1,13 @@
+root = true
+
+[*]
+charset = utf-8
+insert_final_newline = true
+
+[*.{c,h}]
+indent_style = tab
+tab_width = 8
+
+[CMakeLists.txt]
+indent_style = tab
+tab_width = 8
diff --git a/t/unit-tests/clar/.github/workflows/ci.yml b/t/unit-tests/clar/.github/workflows/ci.yml
index b1ac2de460a..0065843d17a 100644
--- a/t/unit-tests/clar/.github/workflows/ci.yml
+++ b/t/unit-tests/clar/.github/workflows/ci.yml
@@ -10,14 +10,26 @@ jobs:
build:
strategy:
matrix:
- os: [ ubuntu-latest, macos-latest ]
+ platform:
+ - os: ubuntu-latest
+ generator: Unix Makefiles
+ - os: macos-latest
+ generator: Unix Makefiles
+ - os: windows-latest
+ generator: Visual Studio 17 2022
+ - os: windows-latest
+ generator: MSYS Makefiles
+ - os: windows-latest
+ generator: MinGW Makefiles
- runs-on: ${{ matrix.os }}
+ runs-on: ${{ matrix.platform.os }}
steps:
- name: Check out
uses: actions/checkout@v2
- name: Build
run: |
- cd test
- make
+ mkdir build
+ cd build
+ cmake .. -G "${{matrix.platform.generator}}"
+ cmake --build .
diff --git a/t/unit-tests/clar/.gitignore b/t/unit-tests/clar/.gitignore
new file mode 100644
index 00000000000..84c048a73cc
--- /dev/null
+++ b/t/unit-tests/clar/.gitignore
@@ -0,0 +1 @@
+/build/
diff --git a/t/unit-tests/clar/CMakeLists.txt b/t/unit-tests/clar/CMakeLists.txt
new file mode 100644
index 00000000000..12d4af114fe
--- /dev/null
+++ b/t/unit-tests/clar/CMakeLists.txt
@@ -0,0 +1,28 @@
+cmake_minimum_required(VERSION 3.16..3.29)
+
+project(clar LANGUAGES C)
+
+option(BUILD_TESTS "Build test executable" ON)
+
+add_library(clar INTERFACE)
+target_sources(clar INTERFACE
+ clar.c
+ clar.h
+ clar/fixtures.h
+ clar/fs.h
+ clar/print.h
+ clar/sandbox.h
+ clar/summary.h
+)
+set_target_properties(clar PROPERTIES
+ C_STANDARD 90
+ C_STANDARD_REQUIRED ON
+ C_EXTENSIONS OFF
+)
+
+if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
+ include(CTest)
+ if(BUILD_TESTING)
+ add_subdirectory(test)
+ endif()
+endif()
diff --git a/t/unit-tests/clar/clar.c b/t/unit-tests/clar/clar.c
index cef0f023c24..12fa66d088a 100644
--- a/t/unit-tests/clar/clar.c
+++ b/t/unit-tests/clar/clar.c
@@ -4,7 +4,8 @@
* This file is part of clar, distributed under the ISC license.
* For full terms see the included COPYING file.
*/
-#include <assert.h>
+
+#include <errno.h>
#include <setjmp.h>
#include <stdlib.h>
#include <stdio.h>
@@ -13,6 +14,7 @@
#include <stdarg.h>
#include <wchar.h>
#include <time.h>
+#include <inttypes.h>
/* required for sandboxing */
#include <sys/types.h>
@@ -28,6 +30,9 @@
# ifndef stat
# define stat(path, st) _stat(path, st)
+ typedef struct _stat STAT_T;
+# else
+ typedef struct stat STAT_T;
# endif
# ifndef mkdir
# define mkdir(path, mode) _mkdir(path)
@@ -60,30 +65,11 @@
# else
# define p_snprintf snprintf
# endif
-
-# ifndef PRIuZ
-# define PRIuZ "Iu"
-# endif
-# ifndef PRIxZ
-# define PRIxZ "Ix"
-# endif
-
-# if defined(_MSC_VER) || (defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR))
- typedef struct stat STAT_T;
-# else
- typedef struct _stat STAT_T;
-# endif
#else
# include <sys/wait.h> /* waitpid(2) */
# include <unistd.h>
# define _MAIN_CC
# define p_snprintf snprintf
-# ifndef PRIuZ
-# define PRIuZ "zu"
-# endif
-# ifndef PRIxZ
-# define PRIxZ "zx"
-# endif
typedef struct stat STAT_T;
#endif
@@ -102,7 +88,7 @@ fixture_path(const char *base, const char *fixture_name);
struct clar_error {
const char *file;
const char *function;
- size_t line_number;
+ uintmax_t line_number;
const char *error_msg;
char *description;
@@ -195,11 +181,12 @@ static void clar_print_shutdown(int test_count, int suite_count, int error_count
static void clar_print_error(int num, const struct clar_report *report, const struct clar_error *error);
static void clar_print_ontest(const char *suite_name, const char *test_name, int test_number, enum cl_test_status failed);
static void clar_print_onsuite(const char *suite_name, int suite_index);
+static void clar_print_onabortv(const char *msg, va_list argp);
static void clar_print_onabort(const char *msg, ...);
/* From clar_sandbox.c */
static void clar_unsandbox(void);
-static int clar_sandbox(void);
+static void clar_sandbox(void);
/* From summary.h */
static struct clar_summary *clar_summary_init(const char *filename);
@@ -218,6 +205,15 @@ static int clar_summary_shutdown(struct clar_summary *fp);
_clar.trace_payload); \
} while (0)
+static void clar_abort(const char *msg, ...)
+{
+ va_list argp;
+ va_start(argp, msg);
+ clar_print_onabortv(msg, argp);
+ va_end(argp);
+ exit(-1);
+}
+
void cl_trace_register(cl_trace_cb *cb, void *payload)
{
_clar.pfn_trace_cb = cb;
@@ -271,9 +267,7 @@ static double clar_time_diff(clar_time *start, clar_time *end)
static void clar_time_now(clar_time *out)
{
- struct timezone tz;
-
- gettimeofday(out, &tz);
+ gettimeofday(out, NULL);
}
static double clar_time_diff(clar_time *start, clar_time *end)
@@ -386,7 +380,8 @@ clar_run_suite(const struct clar_suite *suite, const char *filter)
_clar.active_test = test[i].name;
- report = calloc(1, sizeof(struct clar_report));
+ if ((report = calloc(1, sizeof(*report))) == NULL)
+ clar_abort("Failed to allocate report.\n");
report->suite = _clar.active_suite;
report->test = _clar.active_test;
report->test_number = _clar.tests_ran;
@@ -479,9 +474,10 @@ clar_parse_args(int argc, char **argv)
switch (action) {
case 's': {
- struct clar_explicit *explicit =
- calloc(1, sizeof(struct clar_explicit));
- assert(explicit);
+ struct clar_explicit *explicit;
+
+ if ((explicit = calloc(1, sizeof(*explicit))) == NULL)
+ clar_abort("Failed to allocate explicit test.\n");
explicit->suite_idx = j;
explicit->filter = argument;
@@ -505,10 +501,8 @@ clar_parse_args(int argc, char **argv)
}
}
- if (!found) {
- clar_print_onabort("No suite matching '%s' found.\n", argument);
- exit(-1);
- }
+ if (!found)
+ clar_abort("No suite matching '%s' found.\n", argument);
break;
}
@@ -540,11 +534,17 @@ clar_parse_args(int argc, char **argv)
case 'r':
_clar.write_summary = 1;
free(_clar.summary_filename);
- _clar.summary_filename = *(argument + 2) ? strdup(argument + 2) : NULL;
+ if (*(argument + 2)) {
+ if ((_clar.summary_filename = strdup(argument + 2)) == NULL)
+ clar_abort("Failed to allocate summary filename.\n");
+ } else {
+ _clar.summary_filename = NULL;
+ }
break;
default:
- assert(!"Unexpected commandline argument!");
+ clar_abort("Unexpected commandline argument '%s'.\n",
+ argument[1]);
}
}
}
@@ -566,22 +566,18 @@ clar_test_init(int argc, char **argv)
if (!_clar.summary_filename &&
(summary_env = getenv("CLAR_SUMMARY")) != NULL) {
_clar.write_summary = 1;
- _clar.summary_filename = strdup(summary_env);
+ if ((_clar.summary_filename = strdup(summary_env)) == NULL)
+ clar_abort("Failed to allocate summary filename.\n");
}
if (_clar.write_summary && !_clar.summary_filename)
- _clar.summary_filename = strdup("summary.xml");
+ if ((_clar.summary_filename = strdup("summary.xml")) == NULL)
+ clar_abort("Failed to allocate summary filename.\n");
- if (_clar.write_summary &&
- !(_clar.summary = clar_summary_init(_clar.summary_filename))) {
- clar_print_onabort("Failed to open the summary file\n");
- exit(-1);
- }
+ if (_clar.write_summary)
+ _clar.summary = clar_summary_init(_clar.summary_filename);
- if (clar_sandbox() < 0) {
- clar_print_onabort("Failed to sandbox the test runner.\n");
- exit(-1);
- }
+ clar_sandbox();
}
int
@@ -615,10 +611,9 @@ clar_test_shutdown(void)
clar_unsandbox();
- if (_clar.write_summary && clar_summary_shutdown(_clar.summary) < 0) {
- clar_print_onabort("Failed to write the summary file\n");
- exit(-1);
- }
+ if (_clar.write_summary && clar_summary_shutdown(_clar.summary) < 0)
+ clar_abort("Failed to write the summary file '%s: %s.\n",
+ _clar.summary_filename, strerror(errno));
for (explicit = _clar.explicit; explicit; explicit = explicit_next) {
explicit_next = explicit->next;
@@ -649,7 +644,7 @@ static void abort_test(void)
{
if (!_clar.trampoline_enabled) {
clar_print_onabort(
- "Fatal error: a cleanup method raised an exception.");
+ "Fatal error: a cleanup method raised an exception.\n");
clar_report_errors(_clar.last_report);
exit(-1);
}
@@ -673,7 +668,10 @@ void clar__fail(
const char *description,
int should_abort)
{
- struct clar_error *error = calloc(1, sizeof(struct clar_error));
+ struct clar_error *error;
+
+ if ((error = calloc(1, sizeof(*error))) == NULL)
+ clar_abort("Failed to allocate error.\n");
if (_clar.last_report->errors == NULL)
_clar.last_report->errors = error;
@@ -688,8 +686,9 @@ void clar__fail(
error->line_number = line;
error->error_msg = error_msg;
- if (description != NULL)
- error->description = strdup(description);
+ if (description != NULL &&
+ (error->description = strdup(description)) == NULL)
+ clar_abort("Failed to allocate description.\n");
_clar.total_errors++;
_clar.last_report->status = CL_TEST_FAILURE;
@@ -798,8 +797,8 @@ void clar__assert_equal(
}
}
}
- else if (!strcmp("%"PRIuZ, fmt) || !strcmp("%"PRIxZ, fmt)) {
- size_t sz1 = va_arg(args, size_t), sz2 = va_arg(args, size_t);
+ else if (!strcmp("%"PRIuMAX, fmt) || !strcmp("%"PRIxMAX, fmt)) {
+ uintmax_t sz1 = va_arg(args, uintmax_t), sz2 = va_arg(args, uintmax_t);
is_equal = (sz1 == sz2);
if (!is_equal) {
int offset = p_snprintf(buf, sizeof(buf), fmt, sz1);
diff --git a/t/unit-tests/clar/clar/print.h b/t/unit-tests/clar/clar/print.h
index c17e2f693bd..69d0ee967e7 100644
--- a/t/unit-tests/clar/clar/print.h
+++ b/t/unit-tests/clar/clar/print.h
@@ -21,7 +21,7 @@ static void clar_print_clap_error(int num, const struct clar_report *report, con
{
printf(" %d) Failure:\n", num);
- printf("%s::%s [%s:%"PRIuZ"]\n",
+ printf("%s::%s [%s:%"PRIuMAX"]\n",
report->suite,
report->test,
error->file,
@@ -136,7 +136,7 @@ static void clar_print_tap_ontest(const char *suite_name, const char *test_name,
printf(" at:\n");
printf(" file: '"); print_escaped(error->file); printf("'\n");
- printf(" line: %" PRIuZ "\n", error->line_number);
+ printf(" line: %" PRIuMAX "\n", error->line_number);
printf(" function: '%s'\n", error->function);
printf(" ---\n");
@@ -202,10 +202,15 @@ static void clar_print_onsuite(const char *suite_name, int suite_index)
PRINT(onsuite, suite_name, suite_index);
}
+static void clar_print_onabortv(const char *msg, va_list argp)
+{
+ PRINT(onabort, msg, argp);
+}
+
static void clar_print_onabort(const char *msg, ...)
{
va_list argp;
va_start(argp, msg);
- PRINT(onabort, msg, argp);
+ clar_print_onabortv(msg, argp);
va_end(argp);
}
diff --git a/t/unit-tests/clar/clar/sandbox.h b/t/unit-tests/clar/clar/sandbox.h
index e25057b7c49..681a1f80f17 100644
--- a/t/unit-tests/clar/clar/sandbox.h
+++ b/t/unit-tests/clar/clar/sandbox.h
@@ -122,14 +122,14 @@ static int build_sandbox_path(void)
if (mkdir(_clar_path, 0700) != 0)
return -1;
-#elif defined(__TANDEM)
- if (mktemp(_clar_path) == NULL)
+#elif defined(_WIN32)
+ if (_mktemp_s(_clar_path, sizeof(_clar_path)) != 0)
return -1;
if (mkdir(_clar_path, 0700) != 0)
return -1;
-#elif defined(_WIN32)
- if (_mktemp_s(_clar_path, sizeof(_clar_path)) != 0)
+#elif defined(__TANDEM)
+ if (mktemp(_clar_path) == NULL)
return -1;
if (mkdir(_clar_path, 0700) != 0)
@@ -142,15 +142,14 @@ static int build_sandbox_path(void)
return 0;
}
-static int clar_sandbox(void)
+static void clar_sandbox(void)
{
if (_clar_path[0] == '\0' && build_sandbox_path() < 0)
- return -1;
+ clar_abort("Failed to build sandbox path.\n");
if (chdir(_clar_path) != 0)
- return -1;
-
- return 0;
+ clar_abort("Failed to change into sandbox directory '%s': %s.\n",
+ _clar_path, strerror(errno));
}
const char *clar_sandbox_path(void)
diff --git a/t/unit-tests/clar/clar/summary.h b/t/unit-tests/clar/clar/summary.h
index 4dd352e28b8..0d0b646fe75 100644
--- a/t/unit-tests/clar/clar/summary.h
+++ b/t/unit-tests/clar/clar/summary.h
@@ -66,16 +66,12 @@ struct clar_summary *clar_summary_init(const char *filename)
struct clar_summary *summary;
FILE *fp;
- if ((fp = fopen(filename, "w")) == NULL) {
- perror("fopen");
- return NULL;
- }
+ if ((fp = fopen(filename, "w")) == NULL)
+ clar_abort("Failed to open the summary file '%s': %s.\n",
+ filename, strerror(errno));
- if ((summary = malloc(sizeof(struct clar_summary))) == NULL) {
- perror("malloc");
- fclose(fp);
- return NULL;
- }
+ if ((summary = malloc(sizeof(struct clar_summary))) == NULL)
+ clar_abort("Failed to allocate summary.\n");
summary->filename = filename;
summary->fp = fp;
diff --git a/t/unit-tests/clar/test/.gitignore b/t/unit-tests/clar/test/.gitignore
deleted file mode 100644
index a477d0c40ca..00000000000
--- a/t/unit-tests/clar/test/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-clar.suite
-.clarcache
-clar_test
-*.o
diff --git a/t/unit-tests/clar/test/CMakeLists.txt b/t/unit-tests/clar/test/CMakeLists.txt
new file mode 100644
index 00000000000..4c9012d0611
--- /dev/null
+++ b/t/unit-tests/clar/test/CMakeLists.txt
@@ -0,0 +1,41 @@
+find_package(Python COMPONENTS Interpreter REQUIRED)
+
+add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/clar.suite"
+ COMMAND "${Python_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/generate.py" --output "${CMAKE_CURRENT_BINARY_DIR}"
+ DEPENDS main.c sample.c clar_test.h
+ WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
+)
+
+add_executable(clar_test)
+set_target_properties(clar_test PROPERTIES
+ C_STANDARD 90
+ C_STANDARD_REQUIRED ON
+ C_EXTENSIONS OFF
+)
+
+# MSVC generates all kinds of warnings. We may want to fix these in the future
+# and then unconditionally treat warnings as errors.
+if(NOT MSVC)
+ set_target_properties(clar_test PROPERTIES
+ COMPILE_WARNING_AS_ERROR ON
+ )
+endif()
+
+target_sources(clar_test PRIVATE
+ main.c
+ sample.c
+ "${CMAKE_CURRENT_BINARY_DIR}/clar.suite"
+)
+target_compile_definitions(clar_test PRIVATE
+ CLAR_FIXTURE_PATH="${CMAKE_CURRENT_SOURCE_DIR}/resources/"
+ _DARWIN_C_SOURCE
+ _POSIX_C_SOURCE=200809L
+)
+target_compile_options(clar_test PRIVATE
+ $<IF:$<CXX_COMPILER_ID:MSVC>,/W4,-Wall>
+)
+target_include_directories(clar_test PRIVATE
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_CURRENT_BINARY_DIR}"
+)
+target_link_libraries(clar_test clar)
diff --git a/t/unit-tests/clar/test/Makefile b/t/unit-tests/clar/test/Makefile
deleted file mode 100644
index 93c6b2ad32c..00000000000
--- a/t/unit-tests/clar/test/Makefile
+++ /dev/null
@@ -1,39 +0,0 @@
-#
-# Copyright (c) Vicent Marti. All rights reserved.
-#
-# This file is part of clar, distributed under the ISC license.
-# For full terms see the included COPYING file.
-#
-
-#
-# Set up the path to the clar sources and to the fixtures directory
-#
-# The fixture path needs to be an absolute path so it can be used
-# even after we have chdir'ed into the test directory while testing.
-#
-CURRENT_MAKEFILE := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
-TEST_DIRECTORY := $(abspath $(dir $(CURRENT_MAKEFILE)))
-CLAR_PATH := $(dir $(TEST_DIRECTORY))
-CLAR_FIXTURE_PATH := $(TEST_DIRECTORY)/resources/
-
-CFLAGS=-g -I.. -I. -Wall -DCLAR_FIXTURE_PATH=\"$(CLAR_FIXTURE_PATH)\"
-
-.PHONY: clean
-
-# list the objects that go into our test
-objects = main.o sample.o
-
-# build the test executable itself
-clar_test: $(objects) clar_test.h clar.suite $(CLAR_PATH)clar.c
- $(CC) $(CFLAGS) -o $@ "$(CLAR_PATH)clar.c" $(objects)
-
-# test object files depend on clar macros
-$(objects) : $(CLAR_PATH)clar.h
-
-# build the clar.suite file of test metadata
-clar.suite:
- python "$(CLAR_PATH)generate.py" .
-
-# remove all generated files
-clean:
- $(RM) -rf *.o clar.suite .clarcache clar_test clar_test.dSYM
--
2.47.0.rc1.33.g90fe3800b9.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v2 10/24] builtin/credential-cache: fix missing parameter for stub function
2024-10-09 14:56 ` [RFC PATCH v2 00/24] Modernize our " Patrick Steinhardt
` (8 preceding siblings ...)
2024-10-09 14:56 ` [RFC PATCH v2 09/24] t/unit-tests: update clar unit test framework Patrick Steinhardt
@ 2024-10-09 14:56 ` Patrick Steinhardt
2024-10-09 14:56 ` [RFC PATCH v2 11/24] http: fix build error on FreeBSD Patrick Steinhardt
` (15 subsequent siblings)
25 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-09 14:56 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano
When not compiling the credential cache we may use a stub function for
`cmd_credential_cache()`. With commit 9b1cb5070f (builtin: add a
repository parameter for builtin functions, 2024-09-13), we have added a
new parameter to all of those top-level `cmd_*()` functions, and did
indeed adapt the non-stubbed-out `cmd_credential_cache()`. But we didn't
adapt the stubbed-out variant, so the code does not compile.
Fix this by adding the missing parameter.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
builtin/credential-cache.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/builtin/credential-cache.c b/builtin/credential-cache.c
index 5de8b9123bf..c51f7fc2ade 100644
--- a/builtin/credential-cache.c
+++ b/builtin/credential-cache.c
@@ -189,7 +189,8 @@ int cmd_credential_cache(int argc,
#else
-int cmd_credential_cache(int argc, const char **argv, const char *prefix)
+int cmd_credential_cache(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
const char * const usage[] = {
"git credential-cache [options] <action>",
--
2.47.0.rc1.33.g90fe3800b9.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v2 11/24] http: fix build error on FreeBSD
2024-10-09 14:56 ` [RFC PATCH v2 00/24] Modernize our " Patrick Steinhardt
` (9 preceding siblings ...)
2024-10-09 14:56 ` [RFC PATCH v2 10/24] builtin/credential-cache: fix missing parameter for stub function Patrick Steinhardt
@ 2024-10-09 14:56 ` Patrick Steinhardt
2024-10-09 14:56 ` [RFC PATCH v2 12/24] Makefile: extract script to generate clar declarations Patrick Steinhardt
` (14 subsequent siblings)
25 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-09 14:56 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano
The `result` parameter passed to `http_request_reauth()` may either
point to a `struct strbuf` or a `FILE *`, where the `target` parameter
tells us which of either it actually is. To accommodate for both types
the pointer is a `void *`, which we then pass directly to functions
without doing a cast.
This is fine on most platforms, but it breaks on FreeBSD because
`fileno()` is implemented as a macro that tries to directly access the
`FILE *` structure.
Fix this issue by storing the `FILE *` in a local variable before we
pass it on to other functions.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
http.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/http.c b/http.c
index d59e59f66b1..72973175a85 100644
--- a/http.c
+++ b/http.c
@@ -2290,17 +2290,19 @@ static int http_request_reauth(const char *url,
case HTTP_REQUEST_STRBUF:
strbuf_reset(result);
break;
- case HTTP_REQUEST_FILE:
- if (fflush(result)) {
+ case HTTP_REQUEST_FILE: {
+ FILE *f = result;
+ if (fflush(f)) {
error_errno("unable to flush a file");
return HTTP_START_FAILED;
}
- rewind(result);
- if (ftruncate(fileno(result), 0) < 0) {
+ rewind(f);
+ if (ftruncate(fileno(f), 0) < 0) {
error_errno("unable to truncate a file");
return HTTP_START_FAILED;
}
break;
+ }
default:
BUG("Unknown http_request target");
}
--
2.47.0.rc1.33.g90fe3800b9.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v2 12/24] Makefile: extract script to generate clar declarations
2024-10-09 14:56 ` [RFC PATCH v2 00/24] Modernize our " Patrick Steinhardt
` (10 preceding siblings ...)
2024-10-09 14:56 ` [RFC PATCH v2 11/24] http: fix build error on FreeBSD Patrick Steinhardt
@ 2024-10-09 14:56 ` Patrick Steinhardt
2024-10-09 14:56 ` [RFC PATCH v2 13/24] Makefile: extract script to massage Perl scripts Patrick Steinhardt
` (13 subsequent siblings)
25 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-09 14:56 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano
Extract the script to generate function declarations for the clar unit
testing framework into a standalone script. This is done such that we
can reuse it in other build systems.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 4 +---
t/unit-tests/generate-clar-decls.sh | 18 ++++++++++++++++++
2 files changed, 19 insertions(+), 3 deletions(-)
create mode 100755 t/unit-tests/generate-clar-decls.sh
diff --git a/Makefile b/Makefile
index c094840426c..0d542c58f3a 100644
--- a/Makefile
+++ b/Makefile
@@ -3906,9 +3906,7 @@ GIT-TEST-SUITES: FORCE
fi
$(UNIT_TEST_DIR)/clar-decls.h: $(patsubst %,$(UNIT_TEST_DIR)/%.c,$(CLAR_TEST_SUITES)) GIT-TEST-SUITES
- $(QUIET_GEN)for suite in $(CLAR_TEST_SUITES); do \
- sed -ne "s/^\(void test_$${suite}__[a-zA-Z_0-9][a-zA-Z_0-9]*(void)$$\)/extern \1;/p" $(UNIT_TEST_DIR)/$$suite.c; \
- done >$@
+ $(QUIET_GEN)$(SHELL_PATH) $(UNIT_TEST_DIR)/generate-clar-decls.sh "$@" $(patsubst %,$(UNIT_TEST_DIR)/%.c,$(CLAR_TEST_SUITES))
$(UNIT_TEST_DIR)/clar.suite: $(UNIT_TEST_DIR)/clar-decls.h
$(QUIET_GEN)awk -f $(UNIT_TEST_DIR)/clar-generate.awk $< >$(UNIT_TEST_DIR)/clar.suite
$(CLAR_TEST_OBJS): $(UNIT_TEST_DIR)/clar-decls.h
diff --git a/t/unit-tests/generate-clar-decls.sh b/t/unit-tests/generate-clar-decls.sh
new file mode 100755
index 00000000000..6646a90f711
--- /dev/null
+++ b/t/unit-tests/generate-clar-decls.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+if test $# -lt 2
+then
+ echo "USAGE: $0 <OUTPUT> <SUITE>..." 2>&1
+ exit 1
+fi
+
+OUTPUT="$1"
+shift
+
+while test "$#" -ne 0
+do
+ suite="$1"
+ shift
+ sed -ne "s/^\(void test_$suite__[a-zA-Z_0-9][a-zA-Z_0-9]*(void)$\)/extern \1;/p" "$suite" ||
+ exit 1
+done >"$OUTPUT"
--
2.47.0.rc1.33.g90fe3800b9.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v2 13/24] Makefile: extract script to massage Perl scripts
2024-10-09 14:56 ` [RFC PATCH v2 00/24] Modernize our " Patrick Steinhardt
` (11 preceding siblings ...)
2024-10-09 14:56 ` [RFC PATCH v2 12/24] Makefile: extract script to generate clar declarations Patrick Steinhardt
@ 2024-10-09 14:56 ` Patrick Steinhardt
2024-10-09 14:56 ` [RFC PATCH v2 14/24] Makefile: refactor GIT-VERSION-GEN to be reusable Patrick Steinhardt
` (12 subsequent siblings)
25 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-09 14:56 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano
Extract the script to inject various build-time parameters into our Perl
scripts into a standalone script. This is done such that we can reuse it
in other build systems.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 10 +---------
generate-perl.sh | 22 ++++++++++++++++++++++
2 files changed, 23 insertions(+), 9 deletions(-)
create mode 100755 generate-perl.sh
diff --git a/Makefile b/Makefile
index 0d542c58f3a..50fbc4f29d0 100644
--- a/Makefile
+++ b/Makefile
@@ -2605,15 +2605,7 @@ endif
PERL_DEFINES += $(gitexecdir) $(perllibdir) $(localedir)
$(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
- $(QUIET_GEN) \
- sed -e '1{' \
- -e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \
- -e ' r GIT-PERL-HEADER' \
- -e ' G' \
- -e '}' \
- -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
- $< >$@+ && \
- chmod +x $@+ && \
+ $(QUIET_GEN)$(SHELL_PATH) generate-perl.sh $(GIT_VERSION) GIT-PERL-HEADER "$(PERL_PATH_SQ)" "$<" "$@+" && \
mv $@+ $@
PERL_DEFINES := $(subst $(space),:,$(PERL_DEFINES))
diff --git a/generate-perl.sh b/generate-perl.sh
new file mode 100755
index 00000000000..b9e04d6f42a
--- /dev/null
+++ b/generate-perl.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+if test $# -ne 5
+then
+ echo "USAGE: $0 <GIT_VERSION> <PERL_HEADER> <PERL_PATH> <PERL_SCRIPT> <OUT>" >&2
+ exit 1
+fi
+
+GIT_VERSION="$1"
+PERL_HEADER="$2"
+PERL_PATH="$3"
+PERL_SCRIPT="$4"
+OUT="$5"
+
+sed -e '1{' \
+ -e " s|#!.*perl|#!$PERL_PATH|" \
+ -e " r $PERL_HEADER" \
+ -e ' G' \
+ -e '}' \
+ -e "s/@@GIT_VERSION@@/$GIT_VERSION/g" \
+ "$PERL_SCRIPT" >"$OUT"
+chmod a+x "$OUT"
--
2.47.0.rc1.33.g90fe3800b9.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v2 14/24] Makefile: refactor GIT-VERSION-GEN to be reusable
2024-10-09 14:56 ` [RFC PATCH v2 00/24] Modernize our " Patrick Steinhardt
` (12 preceding siblings ...)
2024-10-09 14:56 ` [RFC PATCH v2 13/24] Makefile: extract script to massage Perl scripts Patrick Steinhardt
@ 2024-10-09 14:56 ` Patrick Steinhardt
2024-10-09 14:56 ` [RFC PATCH v2 15/24] Makefile: refactor generators to be PWD-independent Patrick Steinhardt
` (11 subsequent siblings)
25 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-09 14:56 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano
Our "GIT-VERSION-GEN" script always writes the "GIT-VERSION-FILE" into
the current directory, where the expectation is that it should exist in
the source directory. But other build systems that support out-of-tree
builds may not want to do that to keep the source directory pristine,
even though CMake currently doesn't care.
Refactor the script such that it doesn't write output to a file anymore
but so that it instead writes the version to stdout. This makes it
easier to compute the same version as our Makefile would without having
to write the "GIT-VERSION-FILE".
We should ideally refactor our CMake build instructions to stop writing
into the source directory. But this step is out of scope of the current
patch series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-VERSION-GEN | 12 +-----------
Makefile | 3 ++-
contrib/buildsystems/CMakeLists.txt | 5 ++++-
3 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index b3265f7becb..f2c0f47786b 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -1,6 +1,5 @@
#!/bin/sh
-GVF=GIT-VERSION-FILE
DEF_VER=v2.47.0
LF='
@@ -28,13 +27,4 @@ fi
VN=$(expr "$VN" : v*'\(.*\)')
-if test -r $GVF
-then
- VC=$(sed -e 's/^GIT_VERSION = //' <$GVF)
-else
- VC=unset
-fi
-test "$VN" = "$VC" || {
- echo >&2 "GIT_VERSION = $VN"
- echo "GIT_VERSION = $VN" >$GVF
-}
+echo "$VN"
diff --git a/Makefile b/Makefile
index 50fbc4f29d0..cd28f88e1b3 100644
--- a/Makefile
+++ b/Makefile
@@ -592,7 +592,8 @@ include shared.mak
# Disable -pedantic compilation.
GIT-VERSION-FILE: FORCE
- @$(SHELL_PATH) ./GIT-VERSION-GEN
+ @printf "GIT_VERSION = %s\n" $$($(SHELL_PATH) GIT-VERSION-GEN) >$@+
+ @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else cat $@+ >&2 && mv $@+ $@; fi
-include GIT-VERSION-FILE
# Set our default configuration.
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 1384c0eb6d3..21d6bce26c7 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -87,7 +87,10 @@ endif()
if(NOT EXISTS ${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE)
message("Generating GIT-VERSION-FILE")
execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ OUTPUT_VARIABLE GIT_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ file(WRITE ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "GIT_VERSION = '${GIT_VERSION}'\n")
endif()
#Parse GIT-VERSION-FILE to get the version
--
2.47.0.rc1.33.g90fe3800b9.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v2 15/24] Makefile: refactor generators to be PWD-independent
2024-10-09 14:56 ` [RFC PATCH v2 00/24] Modernize our " Patrick Steinhardt
` (13 preceding siblings ...)
2024-10-09 14:56 ` [RFC PATCH v2 14/24] Makefile: refactor GIT-VERSION-GEN to be reusable Patrick Steinhardt
@ 2024-10-09 14:56 ` Patrick Steinhardt
2024-10-09 14:56 ` [RFC PATCH v2 16/24] Makefile: use common template for GIT-BUILD-OPTIONS Patrick Steinhardt
` (10 subsequent siblings)
25 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-09 14:56 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano
We have multiple scripts that generate headers from other data. All of
these scripts have the assumption built-in that they are executed in the
current source directory, which makes them a bit unwieldy to use during
out-of-tree builds. This makes them a bit unwieldy to use. Refactor them
to instead take the source directory as well as the output file as
arguments.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 6 ++---
contrib/buildsystems/CMakeLists.txt | 12 +++------
generate-cmdlist.sh | 42 ++++++++++++++++++-----------
generate-configlist.sh | 20 ++++++++++----
generate-hooklist.sh | 15 ++++++++++-
5 files changed, 61 insertions(+), 34 deletions(-)
diff --git a/Makefile b/Makefile
index cd28f88e1b3..0a7d07c9dfb 100644
--- a/Makefile
+++ b/Makefile
@@ -2523,17 +2523,17 @@ $(BUILT_INS): git$X
config-list.h: generate-configlist.sh
config-list.h: Documentation/*config.txt Documentation/config/*.txt
- $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh >$@
+ $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh . $@
command-list.h: generate-cmdlist.sh command-list.txt
command-list.h: $(wildcard Documentation/git*.txt)
$(QUIET_GEN)$(SHELL_PATH) ./generate-cmdlist.sh \
$(patsubst %,--exclude-program %,$(EXCLUDED_PROGRAMS)) \
- command-list.txt >$@
+ . $@
hook-list.h: generate-hooklist.sh Documentation/githooks.txt
- $(QUIET_GEN)$(SHELL_PATH) ./generate-hooklist.sh >$@
+ $(QUIET_GEN)$(SHELL_PATH) ./generate-hooklist.sh . $@
SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):\
$(localedir_SQ):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 21d6bce26c7..330a3f3504a 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -655,23 +655,17 @@ set(EXCLUSION_PROGS_CACHE ${EXCLUSION_PROGS} CACHE STRING "Programs not built" F
if(NOT EXISTS ${CMAKE_BINARY_DIR}/command-list.h OR NOT EXCLUSION_PROGS_CACHE STREQUAL EXCLUSION_PROGS)
list(REMOVE_ITEM EXCLUSION_PROGS empty)
message("Generating command-list.h")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-cmdlist.sh ${EXCLUSION_PROGS} command-list.txt
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_FILE ${CMAKE_BINARY_DIR}/command-list.h)
+ execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-cmdlist.sh ${EXCLUSION_PROGS} ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}/command-list.h)
endif()
if(NOT EXISTS ${CMAKE_BINARY_DIR}/config-list.h)
message("Generating config-list.h")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-configlist.sh
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_FILE ${CMAKE_BINARY_DIR}/config-list.h)
+ execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-configlist.sh ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}/config.list)
endif()
if(NOT EXISTS ${CMAKE_BINARY_DIR}/hook-list.h)
message("Generating hook-list.h")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-hooklist.sh
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_FILE ${CMAKE_BINARY_DIR}/hook-list.h)
+ execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-hooklist.sh ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}/hook-list.h)
endif()
include_directories(${CMAKE_BINARY_DIR})
diff --git a/generate-cmdlist.sh b/generate-cmdlist.sh
index 205541e0f7f..b923a5aab80 100755
--- a/generate-cmdlist.sh
+++ b/generate-cmdlist.sh
@@ -64,7 +64,7 @@ define_category_names () {
print_command_list () {
echo "static struct cmdname_help command_list[] = {"
- echo "$1" |
+ echo "$2" |
while read cmd rest
do
synopsis=
@@ -76,7 +76,7 @@ print_command_list () {
break
;;
esac
- done <"Documentation/$cmd.txt"
+ done <"$1/Documentation/$cmd.txt"
printf '\t{ "%s", N_("%s"), 0' "$cmd" "$synopsis"
printf " | CAT_%s" $rest
@@ -93,18 +93,28 @@ do
shift
done
-commands="$(command_list "$1")"
-categories="$(category_list "$commands")"
+if test "$#" -ne 2
+then
+ die "USAGE: $0 <SOURCE_DIR> <OUTPUT>"
+fi
+
+SOURCE_DIR="$1"
+OUTPUT="$2"
+
+{
+ commands="$(command_list "$SOURCE_DIR"/command-list.txt)"
+ categories="$(category_list "$commands")"
-echo "/* Automatically generated by generate-cmdlist.sh */
-struct cmdname_help {
- const char *name;
- const char *help;
- uint32_t category;
-};
-"
-define_categories "$categories"
-echo
-define_category_names "$categories"
-echo
-print_command_list "$commands"
+ echo "/* Automatically generated by generate-cmdlist.sh */
+ struct cmdname_help {
+ const char *name;
+ const char *help;
+ uint32_t category;
+ };
+ "
+ define_categories "$categories"
+ echo
+ define_category_names "$categories"
+ echo
+ print_command_list "$SOURCE_DIR" "$commands"
+} >"$OUTPUT"
diff --git a/generate-configlist.sh b/generate-configlist.sh
index 8692fe5cf4d..512804a1ca1 100755
--- a/generate-configlist.sh
+++ b/generate-configlist.sh
@@ -1,13 +1,19 @@
#!/bin/sh
-echo "/* Automatically generated by generate-configlist.sh */"
-echo
+SOURCE_DIR="$1"
+OUTPUT="$2"
+
+if test -z "$SOURCE_DIR" || ! test -d "$SOURCE_DIR" || test -z "$OUTPUT"
+then
+ echo "USAGE: $0 <SOURCE_DIR> <OUTPUT>" >&2
+ exit 1
+fi
print_config_list () {
cat <<EOF
static const char *config_name_list[] = {
EOF
- grep -h '^[a-zA-Z].*\..*::$' Documentation/*config.txt Documentation/config/*.txt |
+ grep -h '^[a-zA-Z].*\..*::$' "$SOURCE_DIR"/Documentation/*config.txt "$SOURCE_DIR"/Documentation/config/*.txt |
sed '/deprecated/d; s/::$//; s/, */\n/g' |
sort |
sed 's/^.*$/ "&",/'
@@ -17,5 +23,9 @@ EOF
EOF
}
-echo
-print_config_list
+{
+ echo "/* Automatically generated by generate-configlist.sh */"
+ echo
+ echo
+ print_config_list
+} >"$OUTPUT"
diff --git a/generate-hooklist.sh b/generate-hooklist.sh
index 2f9f54eb545..0ff2a0b6fbd 100755
--- a/generate-hooklist.sh
+++ b/generate-hooklist.sh
@@ -2,6 +2,17 @@
#
# Usage: ./generate-hooklist.sh >hook-list.h
+SOURCE_DIR="$1"
+OUTPUT="$2"
+
+if test -z "$SOURCE_DIR" || ! test -d "$SOURCE_DIR" || test -z "$OUTPUT"
+then
+ echo "USAGE: $0 <SOURCE_DIR> <OUTPUT>" >&2
+ exit 1
+fi
+
+{
+
cat <<EOF
/* Automatically generated by generate-hooklist.sh */
@@ -11,10 +22,12 @@ EOF
sed -n \
-e '/^~~~~*$/ {x; s/^.*$/ "&",/; p;}' \
-e 'x' \
- <Documentation/githooks.txt |
+ <"$SOURCE_DIR"/Documentation/githooks.txt |
LC_ALL=C sort
cat <<EOF
NULL,
};
EOF
+
+} >"$OUTPUT"
--
2.47.0.rc1.33.g90fe3800b9.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v2 16/24] Makefile: use common template for GIT-BUILD-OPTIONS
2024-10-09 14:56 ` [RFC PATCH v2 00/24] Modernize our " Patrick Steinhardt
` (14 preceding siblings ...)
2024-10-09 14:56 ` [RFC PATCH v2 15/24] Makefile: refactor generators to be PWD-independent Patrick Steinhardt
@ 2024-10-09 14:56 ` Patrick Steinhardt
2024-10-09 14:56 ` [RFC PATCH v2 17/24] Makefile: consistently use @PLACEHOLDER@ to substitute Patrick Steinhardt
` (9 subsequent siblings)
25 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-09 14:56 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano
The "GIT-BUILD-OPTIONS" file is generated by our build systems to
propagate built-in features and paths to our tests. The generation is
done ad-hoc, where both our Makefile and the CMake build instructions
simply echo a bunch of strings into the file. This makes it very hard to
figure out what variables are expected to exist and what format they
have, and the written variables can easily get out of sync between build
systems.
Introduce a new "GIT-BUILD-OPTIONS.in" template to address this issue.
This has multiple advantages:
- It demonstrates which built options exist in the first place.
- It can serve as a spot to document the build options.
- Some build systems complain when not all variables could be
substituted, alerting us of mismatches. Others don't, but if we
forgot to substitute such variables we now have a bogus string that
will likely cause our tests to fail, if they have any meaning in the
first place.
Backfill values that we didn't yet set in our CMake build instructions.
While at it, remove the `SUPPORTS_SIMPLE_IPC` variable that we only set
up in CMake as it isn't used anywhere.
Note that this change requires us to move around the setup of
TEST_OUTPUT_DIRECTORY in "test-lib.sh" such that it comes after sourcing
the "GIT-BUILD-OPTIONS" file. This is the only instance I could find
where we rely on ordering on variables.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-BUILD-OPTIONS.in | 36 ++++++++++
Makefile | 108 ++++++++++------------------
contrib/buildsystems/CMakeLists.txt | 58 ++++++++++-----
t/test-lib.sh | 13 ++--
4 files changed, 120 insertions(+), 95 deletions(-)
create mode 100644 GIT-BUILD-OPTIONS.in
diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in
new file mode 100644
index 00000000000..f0ca240493c
--- /dev/null
+++ b/GIT-BUILD-OPTIONS.in
@@ -0,0 +1,36 @@
+SHELL_PATH=@SHELL_PATH@
+TEST_SHELL_PATH=@TEST_SHELL_PATH@
+PERL_PATH=@PERL_PATH@
+DIFF=@DIFF@
+PYTHON_PATH=@PYTHON_PATH@
+TAR=@TAR@
+NO_CURL=@NO_CURL@
+NO_ICONV=@NO_ICONV@
+NO_EXPAT=@NO_EXPAT@
+USE_LIBPCRE2=@USE_LIBPCRE2@
+NO_PERL=@NO_PERL@
+NO_PTHREADS=@NO_PTHREADS@
+NO_PYTHON=@NO_PYTHON@
+NO_REGEX=@NO_REGEX@
+NO_UNIX_SOCKETS=@NO_UNIX_SOCKETS@
+PAGER_ENV=@PAGER_ENV@
+SANITIZE_LEAK=@SANITIZE_LEAK@
+SANITIZE_ADDRESS=@SANITIZE_ADDRESS@
+X=@X@
+FSMONITOR_DAEMON_BACKEND=@FSMONITOR_DAEMON_BACKEND@
+FSMONITOR_OS_SETTINGS=@FSMONITOR_OS_SETTINGS@
+TEST_OUTPUT_DIRECTORY=@TEST_OUTPUT_DIRECTORY@
+GIT_TEST_OPTS=@GIT_TEST_OPTS@
+GIT_TEST_CMP=@GIT_TEST_CMP@
+GIT_TEST_CMP_USE_COPIED_CONTEXT=@GIT_TEST_CMP_USE_COPIED_CONTEXT@
+GIT_TEST_UTF8_LOCALE=@GIT_TEST_UTF8_LOCALE@
+NO_GETTEXT=@NO_GETTEXT@
+GIT_PERF_REPEAT_COUNT=@GIT_PERF_REPEAT_COUNT@
+GIT_PERF_REPO=@GIT_PERF_REPO@
+GIT_PERF_LARGE_REPO=@GIT_PERF_LARGE_REPO@
+GIT_PERF_MAKE_OPTS=@GIT_PERF_MAKE_OPTS@
+GIT_PERF_MAKE_COMMAND=@GIT_PERF_MAKE_COMMAND@
+GIT_INTEROP_MAKE_OPTS=@GIT_INTEROP_MAKE_OPTS@
+GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@
+GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@
+RUNTIME_PREFIX=@RUNTIME_PREFIX@
diff --git a/Makefile b/Makefile
index 0a7d07c9dfb..3079822da40 100644
--- a/Makefile
+++ b/Makefile
@@ -3158,76 +3158,44 @@ GIT-LDFLAGS: FORCE
# that runs GIT-BUILD-OPTIONS, and then again to protect it
# and the first level quoting from the shell that runs "echo".
GIT-BUILD-OPTIONS: FORCE
- @echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@+
- @echo TEST_SHELL_PATH=\''$(subst ','\'',$(TEST_SHELL_PATH_SQ))'\' >>$@+
- @echo PERL_PATH=\''$(subst ','\'',$(PERL_PATH_SQ))'\' >>$@+
- @echo DIFF=\''$(subst ','\'',$(subst ','\'',$(DIFF)))'\' >>$@+
- @echo PYTHON_PATH=\''$(subst ','\'',$(PYTHON_PATH_SQ))'\' >>$@+
- @echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@+
- @echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@+
- @echo NO_ICONV=\''$(subst ','\'',$(subst ','\'',$(NO_ICONV)))'\' >>$@+
- @echo NO_EXPAT=\''$(subst ','\'',$(subst ','\'',$(NO_EXPAT)))'\' >>$@+
- @echo USE_LIBPCRE2=\''$(subst ','\'',$(subst ','\'',$(USE_LIBPCRE2)))'\' >>$@+
- @echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@+
- @echo NO_PTHREADS=\''$(subst ','\'',$(subst ','\'',$(NO_PTHREADS)))'\' >>$@+
- @echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@+
- @echo NO_REGEX=\''$(subst ','\'',$(subst ','\'',$(NO_REGEX)))'\' >>$@+
- @echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@+
- @echo PAGER_ENV=\''$(subst ','\'',$(subst ','\'',$(PAGER_ENV)))'\' >>$@+
- @echo SANITIZE_LEAK=\''$(subst ','\'',$(subst ','\'',$(SANITIZE_LEAK)))'\' >>$@+
- @echo SANITIZE_ADDRESS=\''$(subst ','\'',$(subst ','\'',$(SANITIZE_ADDRESS)))'\' >>$@+
- @echo X=\'$(X)\' >>$@+
-ifdef FSMONITOR_DAEMON_BACKEND
- @echo FSMONITOR_DAEMON_BACKEND=\''$(subst ','\'',$(subst ','\'',$(FSMONITOR_DAEMON_BACKEND)))'\' >>$@+
-endif
-ifdef FSMONITOR_OS_SETTINGS
- @echo FSMONITOR_OS_SETTINGS=\''$(subst ','\'',$(subst ','\'',$(FSMONITOR_OS_SETTINGS)))'\' >>$@+
-endif
-ifdef TEST_OUTPUT_DIRECTORY
- @echo TEST_OUTPUT_DIRECTORY=\''$(subst ','\'',$(subst ','\'',$(TEST_OUTPUT_DIRECTORY)))'\' >>$@+
-endif
-ifdef GIT_TEST_OPTS
- @echo GIT_TEST_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_OPTS)))'\' >>$@+
-endif
-ifdef GIT_TEST_CMP
- @echo GIT_TEST_CMP=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_CMP)))'\' >>$@+
-endif
-ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
- @echo GIT_TEST_CMP_USE_COPIED_CONTEXT=YesPlease >>$@+
-endif
-ifdef GIT_TEST_UTF8_LOCALE
- @echo GIT_TEST_UTF8_LOCALE=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_UTF8_LOCALE)))'\' >>$@+
-endif
- @echo NO_GETTEXT=\''$(subst ','\'',$(subst ','\'',$(NO_GETTEXT)))'\' >>$@+
-ifdef GIT_PERF_REPEAT_COUNT
- @echo GIT_PERF_REPEAT_COUNT=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPEAT_COUNT)))'\' >>$@+
-endif
-ifdef GIT_PERF_REPO
- @echo GIT_PERF_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPO)))'\' >>$@+
-endif
-ifdef GIT_PERF_LARGE_REPO
- @echo GIT_PERF_LARGE_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_LARGE_REPO)))'\' >>$@+
-endif
-ifdef GIT_PERF_MAKE_OPTS
- @echo GIT_PERF_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_OPTS)))'\' >>$@+
-endif
-ifdef GIT_PERF_MAKE_COMMAND
- @echo GIT_PERF_MAKE_COMMAND=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_COMMAND)))'\' >>$@+
-endif
-ifdef GIT_INTEROP_MAKE_OPTS
- @echo GIT_INTEROP_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_INTEROP_MAKE_OPTS)))'\' >>$@+
-endif
-ifdef GIT_TEST_INDEX_VERSION
- @echo GIT_TEST_INDEX_VERSION=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_INDEX_VERSION)))'\' >>$@+
-endif
-ifdef GIT_TEST_PERL_FATAL_WARNINGS
- @echo GIT_TEST_PERL_FATAL_WARNINGS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_PERL_FATAL_WARNINGS)))'\' >>$@+
-endif
-ifdef RUNTIME_PREFIX
- @echo RUNTIME_PREFIX=\'true\' >>$@+
-else
- @echo RUNTIME_PREFIX=\'false\' >>$@+
-endif
+ @sed \
+ -e "s|@SHELL_PATH@|\'$(SHELL_PATH_SQ)\'|" \
+ -e "s|@TEST_SHELL_PATH@|\'$(TEST_SHELL_PATH_SQ)\'|" \
+ -e "s|@PERL_PATH@|\'$(PERL_PATH_SQ)\'|" \
+ -e "s|@DIFF@|\'$(DIFF)\'|" \
+ -e "s|@PYTHON_PATH@|\'$(PYTHON_PATH_SQ)\'|" \
+ -e "s|@TAR@|\'$(TAR)\'|" \
+ -e "s|@NO_CURL@|\'$(NO_CURL)\'|" \
+ -e "s|@NO_ICONV@|\'$(NO_ICONV)\'|" \
+ -e "s|@NO_EXPAT@|\'$(NO_EXPAT)\'|" \
+ -e "s|@USE_LIBPCRE2@|\'$(USE_LIBPCRE2)\'|" \
+ -e "s|@NO_PERL@|\'$(NO_PERL)\'|" \
+ -e "s|@NO_PTHREADS@|\'$(NO_PTHREADS)\'|" \
+ -e "s|@NO_PYTHON@|\'$(NO_PYTHON)\'|" \
+ -e "s|@NO_REGEX@|\'$(NO_REGEX)\'|" \
+ -e "s|@NO_UNIX_SOCKETS@|\'$(NO_UNIX_SOCKETS)\'|" \
+ -e "s|@PAGER_ENV@|\'$(PAGER_ENV)\'|" \
+ -e "s|@SANITIZE_LEAK@|\'$(SANITIZE_LEAK)\'|" \
+ -e "s|@SANITIZE_ADDRESS@|\'$(SANITIZE_ADDRESS)\'|" \
+ -e "s|@X@|\'$(X)\'|" \
+ -e "s|@FSMONITOR_DAEMON_BACKEND@|\'$(FSMONITOR_DAEMON_BACKEND)\'|" \
+ -e "s|@FSMONITOR_OS_SETTINGS@|\'$(FSMONITOR_OS_SETTINGS)\'|" \
+ -e "s|@TEST_OUTPUT_DIRECTORY@|\'$(TEST_OUTPUT_DIRECTORY)\'|" \
+ -e "s|@GIT_TEST_OPTS@|\'$(GIT_TEST_OPTS)\'|" \
+ -e "s|@GIT_TEST_CMP@|\'$(GIT_TEST_CMP)\'|" \
+ -e "s|@GIT_TEST_CMP_USE_COPIED_CONTEXT@|\'$(GIT_TEST_CMP_USE_COPIED_CONTEXT)\'|" \
+ -e "s|@GIT_TEST_UTF8_LOCALE@|\'$(GIT_TEST_UTF8_LOCALE)\'|" \
+ -e "s|@NO_GETTEXT@|\'$(NO_GETTEXT)\'|" \
+ -e "s|@GIT_PERF_REPEAT_COUNT@|\'$(GIT_PERF_REPEAT_COUNT)\'|" \
+ -e "s|@GIT_PERF_REPO@|\'$(GIT_PERF_REPO)\'|" \
+ -e "s|@GIT_PERF_LARGE_REPO@|\'$(GIT_PERF_LARGE_REPO)\'|" \
+ -e "s|@GIT_PERF_MAKE_OPTS@|\'$(GIT_PERF_MAKE_OPTS)\'|" \
+ -e "s|@GIT_PERF_MAKE_COMMAND@|\'$(GIT_PERF_MAKE_COMMAND)\'|" \
+ -e "s|@GIT_INTEROP_MAKE_OPTS@|\'$(GIT_INTEROP_MAKE_OPTS)\'|" \
+ -e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \
+ -e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \
+ -e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX)\'|" \
+ GIT-BUILD-OPTIONS.in >$@+
@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
@if test -f GIT-BUILD-DIR; then rm GIT-BUILD-DIR; fi
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 330a3f3504a..842879976a2 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -1140,27 +1140,47 @@ if(NOT PYTHON_TESTS)
set(NO_PYTHON 1)
endif()
-file(WRITE ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "SHELL_PATH='${SHELL_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "TEST_SHELL_PATH='${TEST_SHELL_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PERL_PATH='${PERL_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "DIFF='${DIFF}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PYTHON_PATH='${PYTHON_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "TAR='${TAR}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_CURL='${NO_CURL}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_ICONV='${NO_ICONV}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_EXPAT='${NO_EXPAT}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PERL='${NO_PERL}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PTHREADS='${NO_PTHREADS}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_UNIX_SOCKETS='${NO_UNIX_SOCKETS}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PAGER_ENV='${PAGER_ENV}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "X='${EXE_EXTENSION}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_GETTEXT='${NO_GETTEXT}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "RUNTIME_PREFIX='${RUNTIME_PREFIX}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PYTHON='${NO_PYTHON}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "SUPPORTS_SIMPLE_IPC='${SUPPORTS_SIMPLE_IPC}'\n")
+file(STRINGS ${CMAKE_SOURCE_DIR}/GIT-BUILD-OPTIONS.in git_build_options NEWLINE_CONSUME)
+string(REPLACE "@SHELL_PATH@" "${SHELL_PATH}" git_build_options "${git_build_options}")
+string(REPLACE "@TEST_SHELL_PATH@" "${TEST_SHELL_PATH}" git_build_options "${git_build_options}")
+string(REPLACE "@PERL_PATH@" "${PERL_PATH}" git_build_options "${git_build_options}")
+string(REPLACE "@DIFF@" "${DIFF}" git_build_options "${git_build_options}")
+string(REPLACE "@PYTHON_PATH@" "${PYTHON_PATH}" git_build_options "${git_build_options}")
+string(REPLACE "@TAR@" "${TAR}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_CURL@" "${NO_CURL}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_ICONV@" "${NO_ICONV}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_EXPAT@" "${NO_EXPAT}" git_build_options "${git_build_options}")
+string(REPLACE "@USE_LIBPCRE2@" "" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PERL@" "${NO_PERL}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PTHREADS@" "${NO_PTHREADS}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PYTHON@" "${NO_PYTHON}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_REGEX@" "" git_build_options "${git_build_options}")
+string(REPLACE "@NO_UNIX_SOCKETS@" "${NO_UNIX_SOCKETS}" git_build_options "${git_build_options}")
+string(REPLACE "@PAGER_ENV@" "${PAGER_ENV}" git_build_options "${git_build_options}")
+string(REPLACE "@SANITIZE_LEAK@" "" git_build_options "${git_build_options}")
+string(REPLACE "@SANITIZE_ADDRESS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@X@" "${EXE_EXTENSION}" git_build_options "${git_build_options}")
+string(REPLACE "@FSMONITOR_DAEMON_BACKEND@" "win32" git_build_options "${git_build_options}")
+string(REPLACE "@FSMONITOR_OS_SETTINGS@" "win32" git_build_options "${git_build_options}")
+string(REPLACE "@TEST_OUTPUT_DIRECTORY@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_OPTS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_CMP@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_CMP_USE_COPIED_CONTEXT@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_UTF8_LOCALE@" "" git_build_options "${git_build_options}")
+string(REPLACE "@NO_GETTEXT@" "${NO_GETTEXT}" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_REPEAT_COUNT@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_REPO@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_LARGE_REPO@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_MAKE_OPTS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_MAKE_COMMAND@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@RUNTIME_PREFIX@" "${RUNTIME_PREFIX}" git_build_options "${git_build_options}")
if(USE_VCPKG)
- file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
+ string(APPEND git_build_options "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
endif()
+file(WRITE ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS ${git_build_options})
#Make the tests work when building out of the source tree
get_filename_component(CACHE_PATH ${CMAKE_CURRENT_LIST_DIR}/../../CMakeCache.txt ABSOLUTE)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index a278181a056..4dd641baefe 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -35,12 +35,6 @@ else
# needing to exist.
TEST_DIRECTORY=$(cd "$TEST_DIRECTORY" && pwd) || exit 1
fi
-if test -z "$TEST_OUTPUT_DIRECTORY"
-then
- # Similarly, override this to store the test-results subdir
- # elsewhere
- TEST_OUTPUT_DIRECTORY=$TEST_DIRECTORY
-fi
GIT_BUILD_DIR="${TEST_DIRECTORY%/t}"
if test "$TEST_DIRECTORY" = "$GIT_BUILD_DIR"
then
@@ -100,6 +94,13 @@ fi
. "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
export PERL_PATH SHELL_PATH
+if test -z "$TEST_OUTPUT_DIRECTORY"
+then
+ # Similarly, override this to store the test-results subdir
+ # elsewhere
+ TEST_OUTPUT_DIRECTORY=$TEST_DIRECTORY
+fi
+
# In t0000, we need to override test directories of nested testcases. In case
# the developer has TEST_OUTPUT_DIRECTORY part of his build options, then we'd
# reset this value to instead contain what the developer has specified. We thus
--
2.47.0.rc1.33.g90fe3800b9.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v2 17/24] Makefile: consistently use @PLACEHOLDER@ to substitute
2024-10-09 14:56 ` [RFC PATCH v2 00/24] Modernize our " Patrick Steinhardt
` (15 preceding siblings ...)
2024-10-09 14:56 ` [RFC PATCH v2 16/24] Makefile: use common template for GIT-BUILD-OPTIONS Patrick Steinhardt
@ 2024-10-09 14:56 ` Patrick Steinhardt
2024-10-09 14:56 ` [RFC PATCH v2 18/24] Makefile: consistently use PERL_PATH Patrick Steinhardt
` (8 subsequent siblings)
25 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-09 14:56 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano
We have a bunch of placeholders in our scripts that we replace at build
time, for example by using sed(1). These placeholders come in three
different formats: @PLACEHOLDER@, @@PLACEHOLDER@@ and ++PLACEHOLDER++.
Next to being inconsistent it also creates a bit of a problem with
CMake, which only supports the first syntax in its `configure_file()`
function. To work around that we instead manually replace placeholders
via string operations, which is a hassle and removes safeguards that
CMake has to verify that we didn't forget to replace any placeholders.
Besides that, other build systems like Meson also support the CMake
syntax.
Unify our codebase to consistently use the syntax supported by such
build systems.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 42 +++++++++---------
configure.ac | 2 +-
contrib/buildsystems/CMakeLists.txt | 34 +++++++-------
generate-perl.sh | 2 +-
git-cvsserver.perl | 2 +-
git-instaweb.sh | 8 ++--
git-request-pull.sh | 2 +-
git-send-email.perl | 2 +-
git-sh-i18n.sh | 6 +--
git-sh-setup.sh | 6 +--
git-svn.perl | 2 +-
gitk-git/po/vi.po | 2 +-
gitweb/Makefile | 44 +++++++++----------
gitweb/gitweb.perl | 44 +++++++++----------
perl/Git/I18N.pm | 6 +--
perl/Git/LoadCPAN.pm | 6 +--
| 2 +-
.../runtime_prefix.template.pl | 8 ++--
unimplemented.sh | 2 +-
wrap-for-bin.sh | 18 ++++----
20 files changed, 120 insertions(+), 120 deletions(-)
diff --git a/Makefile b/Makefile
index 3079822da40..9f710a7cba9 100644
--- a/Makefile
+++ b/Makefile
@@ -1556,10 +1556,10 @@ endif
ifdef SANE_TOOL_PATH
SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH))
-BROKEN_PATH_FIX = 's|^\# @@BROKEN_PATH_FIX@@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|'
+BROKEN_PATH_FIX = 's|^\# @BROKEN_PATH_FIX@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|'
PATH := $(SANE_TOOL_PATH):${PATH}
else
-BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d'
+BROKEN_PATH_FIX = '/^\# @BROKEN_PATH_FIX@$$/d'
endif
ifeq (,$(HOST_CPU))
@@ -2549,13 +2549,13 @@ GIT-SCRIPT-DEFINES: FORCE
define cmd_munge_script
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
- -e 's|@@DIFF@@|$(DIFF_SQ)|' \
- -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' \
- -e 's/@@USE_GETTEXT_SCHEME@@/$(USE_GETTEXT_SCHEME)/g' \
+ -e 's|@DIFF@|$(DIFF_SQ)|' \
+ -e 's|@LOCALEDIR@|$(localedir_SQ)|g' \
+ -e 's/@USE_GETTEXT_SCHEME@/$(USE_GETTEXT_SCHEME)/g' \
-e $(BROKEN_PATH_FIX) \
- -e 's|@@GITWEBDIR@@|$(gitwebdir_SQ)|g' \
- -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
- -e 's|@@PAGER_ENV@@|$(PAGER_ENV_SQ)|g' \
+ -e 's|@GITWEBDIR@|$(gitwebdir_SQ)|g' \
+ -e 's|@PERL@|$(PERL_PATH_SQ)|g' \
+ -e 's|@PAGER_ENV@|$(PAGER_ENV_SQ)|g' \
$@.sh >$@+
endef
@@ -2622,11 +2622,11 @@ GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile
INSTLIBDIR='$(perllibdir_SQ)' && \
INSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \
INSTLIBDIR="$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}" && \
- sed -e 's=@@PATHSEP@@=$(pathsep)=g' \
- -e "s=@@INSTLIBDIR@@=$$INSTLIBDIR=g" \
- -e 's=@@PERLLIBDIR_REL@@=$(perllibdir_relative_SQ)=g' \
- -e 's=@@GITEXECDIR_REL@@=$(gitexecdir_relative_SQ)=g' \
- -e 's=@@LOCALEDIR_REL@@=$(localedir_relative_SQ)=g' \
+ sed -e 's=@PATHSEP@=$(pathsep)=g' \
+ -e "s=@INSTLIBDIR@=$$INSTLIBDIR=g" \
+ -e 's=@PERLLIBDIR_REL@=$(perllibdir_relative_SQ)=g' \
+ -e 's=@GITEXECDIR_REL@=$(gitexecdir_relative_SQ)=g' \
+ -e 's=@LOCALEDIR_REL@=$(localedir_relative_SQ)=g' \
$< >$@+ && \
mv $@+ $@
@@ -2642,7 +2642,7 @@ else # NO_PERL
$(SCRIPT_PERL_GEN) git-instaweb: % : unimplemented.sh
$(QUIET_GEN) \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@@REASON@@|NO_PERL=$(NO_PERL)|g' \
+ -e 's|@REASON@|NO_PERL=$(NO_PERL)|g' \
unimplemented.sh >$@+ && \
chmod +x $@+ && \
mv $@+ $@
@@ -2663,13 +2663,13 @@ else # NO_PYTHON
$(SCRIPT_PYTHON_GEN): % : unimplemented.sh
$(QUIET_GEN) \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@@REASON@@|NO_PYTHON=$(NO_PYTHON)|g' \
+ -e 's|@REASON@|NO_PYTHON=$(NO_PYTHON)|g' \
unimplemented.sh >$@+ && \
chmod +x $@+ && \
mv $@+ $@
endif # NO_PYTHON
-CONFIGURE_RECIPE = sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
+CONFIGURE_RECIPE = sed -e 's/@GIT_VERSION@/$(GIT_VERSION)/g' \
configure.ac >configure.ac+ && \
autoconf -o configure configure.ac+ && \
$(RM) configure.ac+
@@ -3098,9 +3098,9 @@ endif
perl/build/lib/%.pm: perl/%.pm GIT-PERL-DEFINES
$(call mkdir_p_parent_template)
$(QUIET_GEN) \
- sed -e 's|@@LOCALEDIR@@|$(perl_localedir_SQ)|g' \
- -e 's|@@NO_GETTEXT@@|$(NO_GETTEXT_SQ)|g' \
- -e 's|@@NO_PERL_CPAN_FALLBACKS@@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \
+ sed -e 's|@LOCALEDIR@|$(perl_localedir_SQ)|g' \
+ -e 's|@NO_GETTEXT@|$(NO_GETTEXT_SQ)|g' \
+ -e 's|@NO_PERL_CPAN_FALLBACKS@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \
< $< > $@
perl/build/man/man3/Git.3pm: perl/Git.pm
@@ -3218,8 +3218,8 @@ all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PR
bin-wrappers/%: wrap-for-bin.sh
$(call mkdir_p_parent_template)
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@@BUILD_DIR@@|$(shell pwd)|' \
- -e 's|@@PROG@@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
+ -e 's|@BUILD_DIR@|$(shell pwd)|' \
+ -e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
chmod +x $@
# GNU make supports exporting all variables by "export" without parameters.
diff --git a/configure.ac b/configure.ac
index d1a96da14eb..5923edc44aa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -142,7 +142,7 @@ fi
## Configure body starts here.
AC_PREREQ(2.59)
-AC_INIT([git], [@@GIT_VERSION@@], [git@vger.kernel.org])
+AC_INIT([git], [@GIT_VERSION@], [git@vger.kernel.org])
AC_CONFIG_SRCDIR([git.c])
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 842879976a2..73008bf2d18 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -833,14 +833,14 @@ set(git_shell_scripts
foreach(script ${git_shell_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.sh content NEWLINE_CONSUME)
string(REPLACE "@SHELL_PATH@" "${SHELL_PATH}" content "${content}")
- string(REPLACE "@@DIFF@@" "diff" content "${content}")
+ string(REPLACE "@DIFF@" "diff" content "${content}")
string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}")
string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" content "${content}")
- string(REPLACE "@@NO_CURL@@" "" content "${content}")
- string(REPLACE "@@USE_GETTEXT_SCHEME@@" "" content "${content}")
- string(REPLACE "# @@BROKEN_PATH_FIX@@" "" content "${content}")
- string(REPLACE "@@PERL@@" "${PERL_PATH}" content "${content}")
- string(REPLACE "@@PAGER_ENV@@" "LESS=FRX LV=-c" content "${content}")
+ string(REPLACE "@NO_CURL@" "" content "${content}")
+ string(REPLACE "@USE_GETTEXT_SCHEME@" "" content "${content}")
+ string(REPLACE "# @BROKEN_PATH_FIX@" "" content "${content}")
+ string(REPLACE "@PERL@" "${PERL_PATH}" content "${content}")
+ string(REPLACE "@PAGER_ENV@" "LESS=FRX LV=-c" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
endforeach()
@@ -849,13 +849,13 @@ parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" ".perl")
#create perl header
file(STRINGS ${CMAKE_SOURCE_DIR}/perl/header_templates/fixed_prefix.template.pl perl_header )
-string(REPLACE "@@PATHSEP@@" ":" perl_header "${perl_header}")
-string(REPLACE "@@INSTLIBDIR@@" "${INSTLIBDIR}" perl_header "${perl_header}")
+string(REPLACE "@PATHSEP@" ":" perl_header "${perl_header}")
+string(REPLACE "@INSTLIBDIR@" "${INSTLIBDIR}" perl_header "${perl_header}")
foreach(script ${git_perl_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.perl content NEWLINE_CONSUME)
string(REPLACE "#!/usr/bin/perl" "#!/usr/bin/perl\n${perl_header}\n" content "${content}")
- string(REPLACE "@@GIT_VERSION@@" "${PROJECT_VERSION}" content "${content}")
+ string(REPLACE "@GIT_VERSION@" "${PROJECT_VERSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
endforeach()
@@ -870,8 +870,8 @@ file(GLOB_RECURSE perl_modules "${CMAKE_SOURCE_DIR}/perl/*.pm")
foreach(pm ${perl_modules})
string(REPLACE "${CMAKE_SOURCE_DIR}/perl/" "" file_path ${pm})
file(STRINGS ${pm} content NEWLINE_CONSUME)
- string(REPLACE "@@LOCALEDIR@@" "${LOCALEDIR}" content "${content}")
- string(REPLACE "@@NO_PERL_CPAN_FALLBACKS@@" "" content "${content}")
+ string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}")
+ string(REPLACE "@NO_PERL_CPAN_FALLBACKS@" "" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/perl/build/lib/${file_path} ${content})
#test-lib.sh requires perl/build/lib to be the build directory of perl modules
endforeach()
@@ -1079,21 +1079,21 @@ set(wrapper_test_scripts
foreach(script ${wrapper_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
- string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
- string(REPLACE "@@PROG@@" "${script}${EXE_EXTENSION}" content "${content}")
+ string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+ string(REPLACE "@PROG@" "${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
foreach(script ${wrapper_test_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
- string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
- string(REPLACE "@@PROG@@" "t/helper/${script}${EXE_EXTENSION}" content "${content}")
+ string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+ string(REPLACE "@PROG@" "t/helper/${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
-string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
-string(REPLACE "@@PROG@@" "git-cvsserver" content "${content}")
+string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+string(REPLACE "@PROG@" "git-cvsserver" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})
#options for configuring test options
diff --git a/generate-perl.sh b/generate-perl.sh
index b9e04d6f42a..41d78da029b 100755
--- a/generate-perl.sh
+++ b/generate-perl.sh
@@ -17,6 +17,6 @@ sed -e '1{' \
-e " r $PERL_HEADER" \
-e ' G' \
-e '}' \
- -e "s/@@GIT_VERSION@@/$GIT_VERSION/g" \
+ -e "s/@GIT_VERSION@/$GIT_VERSION/g" \
"$PERL_SCRIPT" >"$OUT"
chmod a+x "$OUT"
diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index 124f598bdc0..70ae7cb8e45 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -26,7 +26,7 @@
use File::Basename;
use Getopt::Long qw(:config require_order no_ignore_case);
-my $VERSION = '@@GIT_VERSION@@';
+my $VERSION = '@GIT_VERSION@';
my $log = GITCVS::log->new();
my $cfg;
diff --git a/git-instaweb.sh b/git-instaweb.sh
index 8dbe21d5887..c8efb1205a8 100755
--- a/git-instaweb.sh
+++ b/git-instaweb.sh
@@ -3,7 +3,7 @@
# Copyright (c) 2006 Eric Wong
#
-PERL='@@PERL@@'
+PERL='@PERL@'
OPTIONS_KEEPDASHDASH=
OPTIONS_STUCKLONG=
OPTIONS_SPEC="\
@@ -38,8 +38,8 @@ conf="$GIT_DIR/gitweb/httpd.conf"
# if installed, it doesn't need further configuration (module_path)
test -z "$httpd" && httpd='lighttpd -f'
-# Default is @@GITWEBDIR@@
-test -z "$root" && root='@@GITWEBDIR@@'
+# Default is @GITWEBDIR@
+test -z "$root" && root='@GITWEBDIR@'
# any untaken local port will do...
test -z "$port" && port=1234
@@ -716,7 +716,7 @@ EOF
gitweb_conf() {
cat > "$fqgitdir/gitweb/gitweb_config.perl" <<EOF
-#!@@PERL@@
+#!@PERL@
our \$projectroot = "$(dirname "$fqgitdir")";
our \$git_temp = "$fqgitdir/gitweb/tmp";
our \$projects_list = \$projectroot;
diff --git a/git-request-pull.sh b/git-request-pull.sh
index 01640a044bb..10c88639e28 100755
--- a/git-request-pull.sh
+++ b/git-request-pull.sh
@@ -112,7 +112,7 @@ find_matching_ref='
}
'
-set fnord $(git ls-remote "$url" | @@PERL@@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
+set fnord $(git ls-remote "$url" | @PERL@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
remote_sha1=$2
ref=$3
diff --git a/git-send-email.perl b/git-send-email.perl
index c835d4c11af..02805c43e52 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1501,7 +1501,7 @@ sub gen_header {
@recipients = unique_email_list(@recipients,@cc,@initial_bcc);
@recipients = (map { extract_valid_address_or_die($_) } @recipients);
my $date = format_2822_time($time++);
- my $gitversion = '@@GIT_VERSION@@';
+ my $gitversion = '@GIT_VERSION@';
if ($gitversion =~ m/..GIT_VERSION../) {
$gitversion = Git::version();
}
diff --git a/git-sh-i18n.sh b/git-sh-i18n.sh
index a15c0620db6..ae4b2d6ba9d 100644
--- a/git-sh-i18n.sh
+++ b/git-sh-i18n.sh
@@ -9,7 +9,7 @@ TEXTDOMAIN=git
export TEXTDOMAIN
if test -z "$GIT_TEXTDOMAINDIR"
then
- TEXTDOMAINDIR="@@LOCALEDIR@@"
+ TEXTDOMAINDIR="@LOCALEDIR@"
else
TEXTDOMAINDIR="$GIT_TEXTDOMAINDIR"
fi
@@ -17,9 +17,9 @@ export TEXTDOMAINDIR
# First decide what scheme to use...
GIT_INTERNAL_GETTEXT_SH_SCHEME=fallthrough
-if test -n "@@USE_GETTEXT_SCHEME@@"
+if test -n "@USE_GETTEXT_SCHEME@"
then
- GIT_INTERNAL_GETTEXT_SH_SCHEME="@@USE_GETTEXT_SCHEME@@"
+ GIT_INTERNAL_GETTEXT_SH_SCHEME="@USE_GETTEXT_SCHEME@"
elif test -n "$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS"
then
: no probing necessary
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index ce273fe0e48..19aef72ec25 100644
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -41,7 +41,7 @@ git_broken_path_fix () {
esac
}
-# @@BROKEN_PATH_FIX@@
+# @BROKEN_PATH_FIX@
# Source git-sh-i18n for gettext support.
. "$(git --exec-path)/git-sh-i18n"
@@ -154,7 +154,7 @@ git_pager() {
else
GIT_PAGER=cat
fi
- for vardef in @@PAGER_ENV@@
+ for vardef in @PAGER_ENV@
do
var=${vardef%%=*}
eval ": \"\${$vardef}\" && export $var"
@@ -280,7 +280,7 @@ get_author_ident_from_commit () {
# remove lines from $1 that are not in $2, leaving only common lines.
create_virtual_base() {
sz0=$(wc -c <"$1")
- @@DIFF@@ -u -La/"$1" -Lb/"$1" "$1" "$2" | git apply --no-add
+ @DIFF@ -u -La/"$1" -Lb/"$1" "$1" "$2" | git apply --no-add
sz1=$(wc -c <"$1")
# If we do not have enough common material, it is not
diff --git a/git-svn.perl b/git-svn.perl
index 01e7a70de1c..dcf65cf1d1d 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -9,7 +9,7 @@
$_revision $_repository
$_q $_authors $_authors_prog %users/;
$AUTHOR = 'Eric Wong <normalperson@yhbt.net>';
-$VERSION = '@@GIT_VERSION@@';
+$VERSION = '@GIT_VERSION@';
use Carp qw/croak/;
use File::Basename qw/dirname basename/;
diff --git a/gitk-git/po/vi.po b/gitk-git/po/vi.po
index 59674986604..184430dcdee 100644
--- a/gitk-git/po/vi.po
+++ b/gitk-git/po/vi.po
@@ -5,7 +5,7 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: gitk @@GIT_VERSION@@\n"
+"Project-Id-Version: gitk @GIT_VERSION@\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-05-17 14:32+1000\n"
"PO-Revision-Date: 2015-09-15 07:33+0700\n"
diff --git a/gitweb/Makefile b/gitweb/Makefile
index 3b68ab2d672..164c8d53757 100644
--- a/gitweb/Makefile
+++ b/gitweb/Makefile
@@ -79,28 +79,28 @@ GITWEB_JSLIB_FILES += static/js/blame_incremental.js
GITWEB_REPLACE = \
- -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
- -e 's|++GIT_BINDIR++|$(bindir)|g' \
- -e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \
- -e 's|++GITWEB_CONFIG_SYSTEM++|$(GITWEB_CONFIG_SYSTEM)|g' \
- -e 's|++GITWEB_CONFIG_COMMON++|$(GITWEB_CONFIG_COMMON)|g' \
- -e 's|++GITWEB_HOME_LINK_STR++|$(GITWEB_HOME_LINK_STR)|g' \
- -e 's|++GITWEB_SITENAME++|$(GITWEB_SITENAME)|g' \
- -e 's|++GITWEB_PROJECTROOT++|$(GITWEB_PROJECTROOT)|g' \
- -e 's|"++GITWEB_PROJECT_MAXDEPTH++"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
- -e 's|++GITWEB_EXPORT_OK++|$(GITWEB_EXPORT_OK)|g' \
- -e 's|++GITWEB_STRICT_EXPORT++|$(GITWEB_STRICT_EXPORT)|g' \
- -e 's|++GITWEB_BASE_URL++|$(GITWEB_BASE_URL)|g' \
- -e 's|++GITWEB_LIST++|$(GITWEB_LIST)|g' \
- -e 's|++GITWEB_HOMETEXT++|$(GITWEB_HOMETEXT)|g' \
- -e 's|++GITWEB_CSS++|$(GITWEB_CSS)|g' \
- -e 's|++GITWEB_LOGO++|$(GITWEB_LOGO)|g' \
- -e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \
- -e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \
- -e 's|++GITWEB_SITE_HTML_HEAD_STRING++|$(GITWEB_SITE_HTML_HEAD_STRING)|g' \
- -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \
- -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \
- -e 's|++HIGHLIGHT_BIN++|$(HIGHLIGHT_BIN)|g'
+ -e 's|@GIT_VERSION@|$(GIT_VERSION)|g' \
+ -e 's|@GIT_BINDIR@|$(bindir)|g' \
+ -e 's|@GITWEB_CONFIG@|$(GITWEB_CONFIG)|g' \
+ -e 's|@GITWEB_CONFIG_SYSTEM@|$(GITWEB_CONFIG_SYSTEM)|g' \
+ -e 's|@GITWEB_CONFIG_COMMON@|$(GITWEB_CONFIG_COMMON)|g' \
+ -e 's|@GITWEB_HOME_LINK_STR@|$(GITWEB_HOME_LINK_STR)|g' \
+ -e 's|@GITWEB_SITENAME@|$(GITWEB_SITENAME)|g' \
+ -e 's|@GITWEB_PROJECTROOT@|$(GITWEB_PROJECTROOT)|g' \
+ -e 's|"@GITWEB_PROJECT_MAXDEPTH@"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
+ -e 's|@GITWEB_EXPORT_OK@|$(GITWEB_EXPORT_OK)|g' \
+ -e 's|@GITWEB_STRICT_EXPORT@|$(GITWEB_STRICT_EXPORT)|g' \
+ -e 's|@GITWEB_BASE_URL@|$(GITWEB_BASE_URL)|g' \
+ -e 's|@GITWEB_LIST@|$(GITWEB_LIST)|g' \
+ -e 's|@GITWEB_HOMETEXT@|$(GITWEB_HOMETEXT)|g' \
+ -e 's|@GITWEB_CSS@|$(GITWEB_CSS)|g' \
+ -e 's|@GITWEB_LOGO@|$(GITWEB_LOGO)|g' \
+ -e 's|@GITWEB_FAVICON@|$(GITWEB_FAVICON)|g' \
+ -e 's|@GITWEB_JS@|$(GITWEB_JS)|g' \
+ -e 's|@GITWEB_SITE_HTML_HEAD_STRING@|$(GITWEB_SITE_HTML_HEAD_STRING)|g' \
+ -e 's|@GITWEB_SITE_HEADER@|$(GITWEB_SITE_HEADER)|g' \
+ -e 's|@GITWEB_SITE_FOOTER@|$(GITWEB_SITE_FOOTER)|g' \
+ -e 's|@HIGHLIGHT_BIN@|$(HIGHLIGHT_BIN)|g'
.PHONY: FORCE
$(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS: FORCE
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index b09a8d05238..76e1f4e244f 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -35,7 +35,7 @@ BEGIN
CGI->compile() if $ENV{'MOD_PERL'};
}
-our $version = "++GIT_VERSION++";
+our $version = "@GIT_VERSION@";
our ($my_url, $my_uri, $base_url, $path_info, $home_link);
sub evaluate_uri {
@@ -80,46 +80,46 @@ sub evaluate_uri {
# core git executable to use
# this can just be "git" if your webserver has a sensible PATH
-our $GIT = "++GIT_BINDIR++/git";
+our $GIT = "@GIT_BINDIR@/git";
# absolute fs-path which will be prepended to the project path
#our $projectroot = "/pub/scm";
-our $projectroot = "++GITWEB_PROJECTROOT++";
+our $projectroot = "@GITWEB_PROJECTROOT@";
# fs traversing limit for getting project list
# the number is relative to the projectroot
-our $project_maxdepth = "++GITWEB_PROJECT_MAXDEPTH++";
+our $project_maxdepth = "@GITWEB_PROJECT_MAXDEPTH@";
# string of the home link on top of all pages
-our $home_link_str = "++GITWEB_HOME_LINK_STR++";
+our $home_link_str = "@GITWEB_HOME_LINK_STR@";
# extra breadcrumbs preceding the home link
our @extra_breadcrumbs = ();
# name of your site or organization to appear in page titles
# replace this with something more descriptive for clearer bookmarks
-our $site_name = "++GITWEB_SITENAME++"
+our $site_name = "@GITWEB_SITENAME@"
|| ($ENV{'SERVER_NAME'} || "Untitled") . " Git";
# html snippet to include in the <head> section of each page
-our $site_html_head_string = "++GITWEB_SITE_HTML_HEAD_STRING++";
+our $site_html_head_string = "@GITWEB_SITE_HTML_HEAD_STRING@";
# filename of html text to include at top of each page
-our $site_header = "++GITWEB_SITE_HEADER++";
+our $site_header = "@GITWEB_SITE_HEADER@";
# html text to include at home page
-our $home_text = "++GITWEB_HOMETEXT++";
+our $home_text = "@GITWEB_HOMETEXT@";
# filename of html text to include at bottom of each page
-our $site_footer = "++GITWEB_SITE_FOOTER++";
+our $site_footer = "@GITWEB_SITE_FOOTER@";
# URI of stylesheets
-our @stylesheets = ("++GITWEB_CSS++");
+our @stylesheets = ("@GITWEB_CSS@");
# URI of a single stylesheet, which can be overridden in GITWEB_CONFIG.
our $stylesheet = undef;
# URI of GIT logo (72x27 size)
-our $logo = "++GITWEB_LOGO++";
+our $logo = "@GITWEB_LOGO@";
# URI of GIT favicon, assumed to be image/png type
-our $favicon = "++GITWEB_FAVICON++";
+our $favicon = "@GITWEB_FAVICON@";
# URI of gitweb.js (JavaScript code for gitweb)
-our $javascript = "++GITWEB_JS++";
+our $javascript = "@GITWEB_JS@";
# URI and label (title) of GIT logo link
#our $logo_url = "https://www.kernel.org/pub/software/scm/git/docs/";
@@ -128,7 +128,7 @@ sub evaluate_uri {
our $logo_label = "git homepage";
# source of projects list
-our $projects_list = "++GITWEB_LIST++";
+our $projects_list = "@GITWEB_LIST@";
# the width (in characters) of the projects list "Description" column
our $projects_list_description_width = 25;
@@ -147,7 +147,7 @@ sub evaluate_uri {
# show repository only if this file exists
# (only effective if this variable evaluates to true)
-our $export_ok = "++GITWEB_EXPORT_OK++";
+our $export_ok = "@GITWEB_EXPORT_OK@";
# don't generate age column on the projects list page
our $omit_age_column = 0;
@@ -161,11 +161,11 @@ sub evaluate_uri {
our $export_auth_hook = undef;
# only allow viewing of repositories also shown on the overview page
-our $strict_export = "++GITWEB_STRICT_EXPORT++";
+our $strict_export = "@GITWEB_STRICT_EXPORT@";
# list of git base URLs used for URL to where fetch project from,
# i.e. full URL is "$git_base_url/$project"
-our @git_base_url_list = grep { $_ ne '' } ("++GITWEB_BASE_URL++");
+our @git_base_url_list = grep { $_ ne '' } ("@GITWEB_BASE_URL@");
# default blob_plain mimetype and default charset for text/plain blob
our $default_blob_plain_mimetype = 'text/plain';
@@ -200,7 +200,7 @@ sub evaluate_uri {
# http://andre-simon.de/zip/download.php due to assumptions about parameters and output).
# Useful if highlight is not installed on your webserver's PATH.
# [Default: highlight]
-our $highlight_bin = "++HIGHLIGHT_BIN++";
+our $highlight_bin = "@HIGHLIGHT_BIN@";
# information about snapshot formats that gitweb is capable of serving
our %known_snapshot_formats = (
@@ -741,9 +741,9 @@ sub read_config_file {
our ($GITWEB_CONFIG, $GITWEB_CONFIG_SYSTEM, $GITWEB_CONFIG_COMMON);
sub evaluate_gitweb_config {
- our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "++GITWEB_CONFIG++";
- our $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || "++GITWEB_CONFIG_SYSTEM++";
- our $GITWEB_CONFIG_COMMON = $ENV{'GITWEB_CONFIG_COMMON'} || "++GITWEB_CONFIG_COMMON++";
+ our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "@GITWEB_CONFIG@";
+ our $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || "@GITWEB_CONFIG_SYSTEM@";
+ our $GITWEB_CONFIG_COMMON = $ENV{'GITWEB_CONFIG_COMMON'} || "@GITWEB_CONFIG_COMMON@";
# Protect against duplications of file names, to not read config twice.
# Only one of $GITWEB_CONFIG and $GITWEB_CONFIG_SYSTEM is used, so
diff --git a/perl/Git/I18N.pm b/perl/Git/I18N.pm
index 475e90a6df5..f8f0ca31254 100644
--- a/perl/Git/I18N.pm
+++ b/perl/Git/I18N.pm
@@ -20,14 +20,14 @@ BEGIN
# this "'@@' [...] '@@'" pattern.
use constant NO_GETTEXT_STR => '@@' . 'NO_GETTEXT' . '@@';
use constant NO_GETTEXT => (
- q[@@NO_GETTEXT@@] ne ''
+ q[@NO_GETTEXT@] ne ''
and
- q[@@NO_GETTEXT@@] ne NO_GETTEXT_STR
+ q[@NO_GETTEXT@] ne NO_GETTEXT_STR
);
sub __bootstrap_locale_messages {
our $TEXTDOMAIN = 'git';
- our $TEXTDOMAINDIR ||= $ENV{GIT_TEXTDOMAINDIR} || '@@LOCALEDIR@@';
+ our $TEXTDOMAINDIR ||= $ENV{GIT_TEXTDOMAINDIR} || '@LOCALEDIR@';
die "NO_GETTEXT=" . NO_GETTEXT_STR if NO_GETTEXT;
require POSIX;
diff --git a/perl/Git/LoadCPAN.pm b/perl/Git/LoadCPAN.pm
index 8c7fa805f97..6be99840f84 100644
--- a/perl/Git/LoadCPAN.pm
+++ b/perl/Git/LoadCPAN.pm
@@ -31,11 +31,11 @@ =head1 DESCRIPTION
# Makefile, and allows for detecting whether the module is loaded from
# perl/Git as opposed to perl/build/Git, which is useful for one-off
# testing without having Error.pm et al installed.
-use constant NO_PERL_CPAN_FALLBACKS_STR => '@@' . 'NO_PERL_CPAN_FALLBACKS' . '@@';
+use constant NO_PERL_CPAN_FALLBACKS_STR => '@' . 'NO_PERL_CPAN_FALLBACKS' . '@';
use constant NO_PERL_CPAN_FALLBACKS => (
- q[@@NO_PERL_CPAN_FALLBACKS@@] ne ''
+ q[@NO_PERL_CPAN_FALLBACKS@] ne ''
and
- q[@@NO_PERL_CPAN_FALLBACKS@@] ne NO_PERL_CPAN_FALLBACKS_STR
+ q[@NO_PERL_CPAN_FALLBACKS@] ne NO_PERL_CPAN_FALLBACKS_STR
);
sub import {
--git a/perl/header_templates/fixed_prefix.template.pl b/perl/header_templates/fixed_prefix.template.pl
index 857b4391a49..d571ca5cde5 100644
--- a/perl/header_templates/fixed_prefix.template.pl
+++ b/perl/header_templates/fixed_prefix.template.pl
@@ -1 +1 @@
-use lib (split(/@@PATHSEP@@/, $ENV{GITPERLLIB} || '@@INSTLIBDIR@@'));
+use lib (split(/@PATHSEP@/, $ENV{GITPERLLIB} || '@INSTLIBDIR@'));
diff --git a/perl/header_templates/runtime_prefix.template.pl b/perl/header_templates/runtime_prefix.template.pl
index 9d28b3d8636..e6f8e661a16 100644
--- a/perl/header_templates/runtime_prefix.template.pl
+++ b/perl/header_templates/runtime_prefix.template.pl
@@ -3,7 +3,7 @@
# This finds our Git::* libraries relative to the script's runtime path.
sub __git_system_path {
my ($relpath) = @_;
- my $gitexecdir_relative = '@@GITEXECDIR_REL@@';
+ my $gitexecdir_relative = '@GITEXECDIR_REL@';
# GIT_EXEC_PATH is supplied by `git` or the test suite.
my $exec_path;
@@ -24,11 +24,11 @@ sub __git_system_path {
}
BEGIN {
- use lib split /@@PATHSEP@@/,
+ use lib split /@PATHSEP@/,
(
$ENV{GITPERLLIB} ||
do {
- my $perllibdir = __git_system_path('@@PERLLIBDIR_REL@@');
+ my $perllibdir = __git_system_path('@PERLLIBDIR_REL@');
(-e $perllibdir) || die("Invalid system path ($relpath): $path");
$perllibdir;
}
@@ -36,7 +36,7 @@ BEGIN
# Export the system locale directory to the I18N module. The locale directory
# is only installed if NO_GETTEXT is set.
- $Git::I18N::TEXTDOMAINDIR = __git_system_path('@@LOCALEDIR_REL@@');
+ $Git::I18N::TEXTDOMAINDIR = __git_system_path('@LOCALEDIR_REL@');
}
# END RUNTIME_PREFIX generated code.
diff --git a/unimplemented.sh b/unimplemented.sh
index fee21d24e8a..41776b279d4 100644
--- a/unimplemented.sh
+++ b/unimplemented.sh
@@ -1,4 +1,4 @@
#!/bin/sh
-echo >&2 "fatal: git was built without support for $(basename $0) (@@REASON@@)."
+echo >&2 "fatal: git was built without support for $(basename $0) (@REASON@)."
exit 128
diff --git a/wrap-for-bin.sh b/wrap-for-bin.sh
index 95851b85b6b..7898a1c238d 100644
--- a/wrap-for-bin.sh
+++ b/wrap-for-bin.sh
@@ -4,33 +4,33 @@
# to run test suite against sandbox, but with only bindir-installed
# executables in PATH. The Makefile copies this into various
# files in bin-wrappers, substituting
-# @@BUILD_DIR@@ and @@PROG@@.
+# @BUILD_DIR@ and @PROG@.
-GIT_EXEC_PATH='@@BUILD_DIR@@'
+GIT_EXEC_PATH='@BUILD_DIR@'
if test -n "$NO_SET_GIT_TEMPLATE_DIR"
then
unset GIT_TEMPLATE_DIR
else
- GIT_TEMPLATE_DIR='@@BUILD_DIR@@/templates/blt'
+ GIT_TEMPLATE_DIR='@BUILD_DIR@/templates/blt'
export GIT_TEMPLATE_DIR
fi
-GITPERLLIB='@@BUILD_DIR@@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}"
-GIT_TEXTDOMAINDIR='@@BUILD_DIR@@/po/build/locale'
-PATH='@@BUILD_DIR@@/bin-wrappers:'"$PATH"
+GITPERLLIB='@BUILD_DIR@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}"
+GIT_TEXTDOMAINDIR='@BUILD_DIR@/po/build/locale'
+PATH='@BUILD_DIR@/bin-wrappers:'"$PATH"
export GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
case "$GIT_DEBUGGER" in
'')
- exec "${GIT_EXEC_PATH}/@@PROG@@" "$@"
+ exec "${GIT_EXEC_PATH}/@PROG@" "$@"
;;
1)
unset GIT_DEBUGGER
- exec gdb --args "${GIT_EXEC_PATH}/@@PROG@@" "$@"
+ exec gdb --args "${GIT_EXEC_PATH}/@PROG@" "$@"
;;
*)
GIT_DEBUGGER_ARGS="$GIT_DEBUGGER"
unset GIT_DEBUGGER
- exec ${GIT_DEBUGGER_ARGS} "${GIT_EXEC_PATH}/@@PROG@@" "$@"
+ exec ${GIT_DEBUGGER_ARGS} "${GIT_EXEC_PATH}/@PROG@" "$@"
;;
esac
--
2.47.0.rc1.33.g90fe3800b9.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v2 18/24] Makefile: consistently use PERL_PATH
2024-10-09 14:56 ` [RFC PATCH v2 00/24] Modernize our " Patrick Steinhardt
` (16 preceding siblings ...)
2024-10-09 14:56 ` [RFC PATCH v2 17/24] Makefile: consistently use @PLACEHOLDER@ to substitute Patrick Steinhardt
@ 2024-10-09 14:56 ` Patrick Steinhardt
2024-10-09 14:57 ` [RFC PATCH v2 19/24] Makefile: allow "bin-wrappers/" directory to exist Patrick Steinhardt
` (7 subsequent siblings)
25 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-09 14:56 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano
When injecting the Perl path into our scripts we sometimes use '@PERL@'
while we othertimes use '@PERL_PATH@'. Refactor the code use the latter
consistently, which makes it easier to reuse the same logic for multiple
scripts.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 2 +-
contrib/buildsystems/CMakeLists.txt | 2 +-
git-instaweb.sh | 4 ++--
git-request-pull.sh | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile
index 9f710a7cba9..46327596275 100644
--- a/Makefile
+++ b/Makefile
@@ -2554,7 +2554,7 @@ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's/@USE_GETTEXT_SCHEME@/$(USE_GETTEXT_SCHEME)/g' \
-e $(BROKEN_PATH_FIX) \
-e 's|@GITWEBDIR@|$(gitwebdir_SQ)|g' \
- -e 's|@PERL@|$(PERL_PATH_SQ)|g' \
+ -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' \
-e 's|@PAGER_ENV@|$(PAGER_ENV_SQ)|g' \
$@.sh >$@+
endef
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 73008bf2d18..d63c9078345 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -839,7 +839,7 @@ foreach(script ${git_shell_scripts})
string(REPLACE "@NO_CURL@" "" content "${content}")
string(REPLACE "@USE_GETTEXT_SCHEME@" "" content "${content}")
string(REPLACE "# @BROKEN_PATH_FIX@" "" content "${content}")
- string(REPLACE "@PERL@" "${PERL_PATH}" content "${content}")
+ string(REPLACE "@PERL_PATH@" "${PERL_PATH}" content "${content}")
string(REPLACE "@PAGER_ENV@" "LESS=FRX LV=-c" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
endforeach()
diff --git a/git-instaweb.sh b/git-instaweb.sh
index c8efb1205a8..5ad50160bb0 100755
--- a/git-instaweb.sh
+++ b/git-instaweb.sh
@@ -3,7 +3,7 @@
# Copyright (c) 2006 Eric Wong
#
-PERL='@PERL@'
+PERL='@PERL_PATH@'
OPTIONS_KEEPDASHDASH=
OPTIONS_STUCKLONG=
OPTIONS_SPEC="\
@@ -716,7 +716,7 @@ EOF
gitweb_conf() {
cat > "$fqgitdir/gitweb/gitweb_config.perl" <<EOF
-#!@PERL@
+#!@PERL_PATH@
our \$projectroot = "$(dirname "$fqgitdir")";
our \$git_temp = "$fqgitdir/gitweb/tmp";
our \$projects_list = \$projectroot;
diff --git a/git-request-pull.sh b/git-request-pull.sh
index 10c88639e28..775ba8ea11a 100755
--- a/git-request-pull.sh
+++ b/git-request-pull.sh
@@ -112,7 +112,7 @@ find_matching_ref='
}
'
-set fnord $(git ls-remote "$url" | @PERL@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
+set fnord $(git ls-remote "$url" | @PERL_PATH@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
remote_sha1=$2
ref=$3
--
2.47.0.rc1.33.g90fe3800b9.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v2 19/24] Makefile: allow "bin-wrappers/" directory to exist
2024-10-09 14:56 ` [RFC PATCH v2 00/24] Modernize our " Patrick Steinhardt
` (17 preceding siblings ...)
2024-10-09 14:56 ` [RFC PATCH v2 18/24] Makefile: consistently use PERL_PATH Patrick Steinhardt
@ 2024-10-09 14:57 ` Patrick Steinhardt
2024-10-09 14:57 ` [RFC PATCH v2 20/24] Makefile: simplify building of templates Patrick Steinhardt
` (6 subsequent siblings)
25 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-09 14:57 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano
The "bin-wrappers/" directory gets created by our build system and is
populated with one script for each of our binaries. There isn't anything
inherently wrong with the current layout, but it is somewhat hard to
adapt for out-of-tree build systems.
Adapt the layout such that our "bin-wrappers/" directory always exists
and contains our "wrap-for-bin.sh" script to make things a little bit
easier for subsequent steps.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
.gitignore | 1 -
Documentation/CodingGuidelines | 2 +-
Makefile | 6 +++---
bin-wrappers/.gitignore | 9 +++++++++
wrap-for-bin.sh => bin-wrappers/wrap-for-bin.sh | 0
contrib/buildsystems/CMakeLists.txt | 6 +++---
6 files changed, 16 insertions(+), 8 deletions(-)
create mode 100644 bin-wrappers/.gitignore
rename wrap-for-bin.sh => bin-wrappers/wrap-for-bin.sh (100%)
mode change 100644 => 100755
diff --git a/.gitignore b/.gitignore
index 6687bd6db4c..349673c55c9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,7 +12,6 @@
/GIT-TEST-SUITES
/GIT-USER-AGENT
/GIT-VERSION-FILE
-/bin-wrappers/
/git
/git-add
/git-am
diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
index 3263245b032..ad831567444 100644
--- a/Documentation/CodingGuidelines
+++ b/Documentation/CodingGuidelines
@@ -583,7 +583,7 @@ For C programs:
Run `GIT_DEBUGGER=1 ./bin-wrappers/git foo` to simply use gdb as is, or
run `GIT_DEBUGGER="<debugger> <debugger-args>" ./bin-wrappers/git foo` to
use your own debugger and arguments. Example: `GIT_DEBUGGER="ddd --gdb"
- ./bin-wrappers/git log` (See `wrap-for-bin.sh`.)
+ ./bin-wrappers/git log` (See `bin-wrappers/wrap-for-bin.sh`.)
- The primary data structure that a subsystem 'S' deals with is called
`struct S`. Functions that operate on `struct S` are named
diff --git a/Makefile b/Makefile
index 46327596275..554d8ea83b2 100644
--- a/Makefile
+++ b/Makefile
@@ -3215,8 +3215,7 @@ test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $(
all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PROG)
-bin-wrappers/%: wrap-for-bin.sh
- $(call mkdir_p_parent_template)
+bin-wrappers/%: bin-wrappers/wrap-for-bin.sh
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@BUILD_DIR@|$(shell pwd)|' \
-e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
@@ -3712,7 +3711,8 @@ clean: profile-clean coverage-clean cocciclean
$(RM) $(FUZZ_PROGRAMS)
$(RM) $(SP_OBJ)
$(RM) $(HCC)
- $(RM) -r bin-wrappers $(dep_dirs) $(compdb_dir) compile_commands.json
+ $(RM) -r $(dep_dirs) $(compdb_dir) compile_commands.json
+ $(RM) $(test_bindir_programs)
$(RM) -r po/build/
$(RM) *.pyc *.pyo */*.pyc */*.pyo $(GENERATED_H) $(ETAGS_TARGET) tags cscope*
$(RM) -r .dist-tmp-dir .doc-tmp-dir
diff --git a/bin-wrappers/.gitignore b/bin-wrappers/.gitignore
new file mode 100644
index 00000000000..1c6c90458b7
--- /dev/null
+++ b/bin-wrappers/.gitignore
@@ -0,0 +1,9 @@
+/git
+/git-cvsserver
+/git-receive-pack
+/git-shell
+/git-upload-archive
+/git-upload-pack
+/scalar
+/test-fake-ssh
+/test-tool
diff --git a/wrap-for-bin.sh b/bin-wrappers/wrap-for-bin.sh
old mode 100644
new mode 100755
similarity index 100%
rename from wrap-for-bin.sh
rename to bin-wrappers/wrap-for-bin.sh
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index d63c9078345..e32ce8ce8b7 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -1078,20 +1078,20 @@ set(wrapper_test_scripts
foreach(script ${wrapper_scripts})
- file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
+ file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
string(REPLACE "@PROG@" "${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
foreach(script ${wrapper_test_scripts})
- file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
+ file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
string(REPLACE "@PROG@" "t/helper/${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
-file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
+file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
string(REPLACE "@PROG@" "git-cvsserver" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})
--
2.47.0.rc1.33.g90fe3800b9.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v2 20/24] Makefile: simplify building of templates
2024-10-09 14:56 ` [RFC PATCH v2 00/24] Modernize our " Patrick Steinhardt
` (18 preceding siblings ...)
2024-10-09 14:57 ` [RFC PATCH v2 19/24] Makefile: allow "bin-wrappers/" directory to exist Patrick Steinhardt
@ 2024-10-09 14:57 ` Patrick Steinhardt
2024-10-09 14:57 ` [RFC PATCH v2 21/24] t: better support for out-of-tree builds Patrick Steinhardt
` (5 subsequent siblings)
25 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-09 14:57 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano
When we install Git we also install a set of default templates that both
git-init(1) and git-clone(1) populate into our build directories. The
way the pristine templates are layed out in our source directory is
somewhat weird though: instead of reconstructing the actual directory
hierarchy in "templates/", we represent directory separators with "--".
The only reason I could come up with for why we have this is the
"branches/" directory, which is supposed to be empty when installing it.
And as Git famously doesn't store empty directories at all we have to
work around this limitation.
Now the thing is that the "branches/" directory is a leftover to how
branches used to be stored in the dark ages. gitrepository-layout(5)
lists this directory as "slightly deprecated", which I would claim is a
strong understatement. I have never encountered anybody using it today
and would be surprised if it even works as expected. So having the "--"
hack in place for an item that is basically unused, unmaintained and
deprecated doesn't only feel unreasonable, but installing that entry by
default may also cause confusion for users that do not know what this is
supposed to be in the first place.
Remove this directory from our templates and, now that we do not require
the workaround anymore, restructure the templates to form a proper
hierarchy. This makes it way easier for build systems to install these
templates into place.
We should likely think about removing support for "branch/" altogether,
but that is outside of the scope of this patch series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
contrib/buildsystems/CMakeLists.txt | 8 +---
templates/Makefile | 38 ++++++++++++-------
templates/branches-- | 1 -
templates/{this--description => description} | 0
.../applypatch-msg.sample} | 0
.../commit-msg.sample} | 0
.../fsmonitor-watchman.sample} | 0
.../post-update.sample} | 0
.../pre-applypatch.sample} | 0
.../pre-commit.sample} | 0
.../pre-merge-commit.sample} | 0
.../pre-push.sample} | 0
.../pre-rebase.sample} | 0
.../pre-receive.sample} | 0
.../prepare-commit-msg.sample} | 0
.../push-to-checkout.sample} | 0
.../sendemail-validate.sample} | 0
.../update.sample} | 0
templates/{info--exclude => info/exclude} | 0
19 files changed, 25 insertions(+), 22 deletions(-)
delete mode 100644 templates/branches--
rename templates/{this--description => description} (100%)
rename templates/{hooks--applypatch-msg.sample => hooks/applypatch-msg.sample} (100%)
rename templates/{hooks--commit-msg.sample => hooks/commit-msg.sample} (100%)
rename templates/{hooks--fsmonitor-watchman.sample => hooks/fsmonitor-watchman.sample} (100%)
rename templates/{hooks--post-update.sample => hooks/post-update.sample} (100%)
rename templates/{hooks--pre-applypatch.sample => hooks/pre-applypatch.sample} (100%)
rename templates/{hooks--pre-commit.sample => hooks/pre-commit.sample} (100%)
rename templates/{hooks--pre-merge-commit.sample => hooks/pre-merge-commit.sample} (100%)
rename templates/{hooks--pre-push.sample => hooks/pre-push.sample} (100%)
rename templates/{hooks--pre-rebase.sample => hooks/pre-rebase.sample} (100%)
rename templates/{hooks--pre-receive.sample => hooks/pre-receive.sample} (100%)
rename templates/{hooks--prepare-commit-msg.sample => hooks/prepare-commit-msg.sample} (100%)
rename templates/{hooks--push-to-checkout.sample => hooks/push-to-checkout.sample} (100%)
rename templates/{hooks--sendemail-validate.sample => hooks/sendemail-validate.sample} (100%)
rename templates/{hooks--update.sample => hooks/update.sample} (100%)
rename templates/{info--exclude => info/exclude} (100%)
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index e32ce8ce8b7..b95287468cd 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -878,23 +878,17 @@ endforeach()
#templates
-file(GLOB templates "${CMAKE_SOURCE_DIR}/templates/*")
+file(GLOB templates "${CMAKE_SOURCE_DIR}/templates/**")
list(TRANSFORM templates REPLACE "${CMAKE_SOURCE_DIR}/templates/" "")
list(REMOVE_ITEM templates ".gitignore")
list(REMOVE_ITEM templates "Makefile")
list(REMOVE_ITEM templates "blt")# Prevents an error when reconfiguring for in source builds
-list(REMOVE_ITEM templates "branches--")
-file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/templates/blt/branches) #create branches
-
#templates have @.*@ replacement so use configure_file instead
foreach(tm ${templates})
- string(REPLACE "--" "/" blt_tm ${tm})
- string(REPLACE "this" "" blt_tm ${blt_tm})# for this--
configure_file(${CMAKE_SOURCE_DIR}/templates/${tm} ${CMAKE_BINARY_DIR}/templates/blt/${blt_tm} @ONLY)
endforeach()
-
#translations
if(MSGFMT_EXE)
file(GLOB po_files "${CMAKE_SOURCE_DIR}/po/*.po")
diff --git a/templates/Makefile b/templates/Makefile
index 367ad00c24c..0b91d189257 100644
--- a/templates/Makefile
+++ b/templates/Makefile
@@ -29,24 +29,34 @@ all: boilerplates.made custom
# in a file direc--tory--file in the source. They will be
# just copied to the destination.
-bpsrc = $(filter-out %~,$(wildcard *--*))
-boilerplates.made : $(bpsrc)
- $(QUIET)umask 022 && ls *--* 2>/dev/null | \
- while read boilerplate; \
+TEMPLATES = description
+TEMPLATES += hooks/applypatch-msg.sample
+TEMPLATES += hooks/commit-msg.sample
+TEMPLATES += hooks/fsmonitor-watchman.sample
+TEMPLATES += hooks/post-update.sample
+TEMPLATES += hooks/pre-applypatch.sample
+TEMPLATES += hooks/pre-commit.sample
+TEMPLATES += hooks/pre-merge-commit.sample
+TEMPLATES += hooks/prepare-commit-msg.sample
+TEMPLATES += hooks/pre-push.sample
+TEMPLATES += hooks/pre-rebase.sample
+TEMPLATES += hooks/pre-receive.sample
+TEMPLATES += hooks/push-to-checkout.sample
+TEMPLATES += hooks/sendemail-validate.sample
+TEMPLATES += hooks/update.sample
+TEMPLATES += info/exclude
+
+boilerplates.made: $(TEMPLATES)
+ $(QUIET)umask 022 && for template in $(TEMPLATES); \
do \
- case "$$boilerplate" in *~) continue ;; esac && \
- dst=`echo "$$boilerplate" | sed -e 's|^this|.|;s|--|/|g'` && \
- dir=`expr "$$dst" : '\(.*\)/'` && \
+ dir=$$(dirname "$$template") && \
mkdir -p blt/$$dir && \
- case "$$boilerplate" in \
- *--) continue;; \
- esac && \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
- -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' $$boilerplate > \
- blt/$$dst && \
- if test -x "$$boilerplate"; then rx=rx; else rx=r; fi && \
- chmod a+$$rx "blt/$$dst" || exit; \
+ -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' $$template > \
+ blt/$$template && \
+ if test -x "$$template"; then rx=rx; else rx=r; fi && \
+ chmod a+$$rx "blt/$$template" || exit; \
done && \
date >$@
diff --git a/templates/branches-- b/templates/branches--
deleted file mode 100644
index fae88709a63..00000000000
--- a/templates/branches--
+++ /dev/null
@@ -1 +0,0 @@
-: this is just to ensure the directory exists.
diff --git a/templates/this--description b/templates/description
similarity index 100%
rename from templates/this--description
rename to templates/description
diff --git a/templates/hooks--applypatch-msg.sample b/templates/hooks/applypatch-msg.sample
similarity index 100%
rename from templates/hooks--applypatch-msg.sample
rename to templates/hooks/applypatch-msg.sample
diff --git a/templates/hooks--commit-msg.sample b/templates/hooks/commit-msg.sample
similarity index 100%
rename from templates/hooks--commit-msg.sample
rename to templates/hooks/commit-msg.sample
diff --git a/templates/hooks--fsmonitor-watchman.sample b/templates/hooks/fsmonitor-watchman.sample
similarity index 100%
rename from templates/hooks--fsmonitor-watchman.sample
rename to templates/hooks/fsmonitor-watchman.sample
diff --git a/templates/hooks--post-update.sample b/templates/hooks/post-update.sample
similarity index 100%
rename from templates/hooks--post-update.sample
rename to templates/hooks/post-update.sample
diff --git a/templates/hooks--pre-applypatch.sample b/templates/hooks/pre-applypatch.sample
similarity index 100%
rename from templates/hooks--pre-applypatch.sample
rename to templates/hooks/pre-applypatch.sample
diff --git a/templates/hooks--pre-commit.sample b/templates/hooks/pre-commit.sample
similarity index 100%
rename from templates/hooks--pre-commit.sample
rename to templates/hooks/pre-commit.sample
diff --git a/templates/hooks--pre-merge-commit.sample b/templates/hooks/pre-merge-commit.sample
similarity index 100%
rename from templates/hooks--pre-merge-commit.sample
rename to templates/hooks/pre-merge-commit.sample
diff --git a/templates/hooks--pre-push.sample b/templates/hooks/pre-push.sample
similarity index 100%
rename from templates/hooks--pre-push.sample
rename to templates/hooks/pre-push.sample
diff --git a/templates/hooks--pre-rebase.sample b/templates/hooks/pre-rebase.sample
similarity index 100%
rename from templates/hooks--pre-rebase.sample
rename to templates/hooks/pre-rebase.sample
diff --git a/templates/hooks--pre-receive.sample b/templates/hooks/pre-receive.sample
similarity index 100%
rename from templates/hooks--pre-receive.sample
rename to templates/hooks/pre-receive.sample
diff --git a/templates/hooks--prepare-commit-msg.sample b/templates/hooks/prepare-commit-msg.sample
similarity index 100%
rename from templates/hooks--prepare-commit-msg.sample
rename to templates/hooks/prepare-commit-msg.sample
diff --git a/templates/hooks--push-to-checkout.sample b/templates/hooks/push-to-checkout.sample
similarity index 100%
rename from templates/hooks--push-to-checkout.sample
rename to templates/hooks/push-to-checkout.sample
diff --git a/templates/hooks--sendemail-validate.sample b/templates/hooks/sendemail-validate.sample
similarity index 100%
rename from templates/hooks--sendemail-validate.sample
rename to templates/hooks/sendemail-validate.sample
diff --git a/templates/hooks--update.sample b/templates/hooks/update.sample
similarity index 100%
rename from templates/hooks--update.sample
rename to templates/hooks/update.sample
diff --git a/templates/info--exclude b/templates/info/exclude
similarity index 100%
rename from templates/info--exclude
rename to templates/info/exclude
--
2.47.0.rc1.33.g90fe3800b9.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v2 21/24] t: better support for out-of-tree builds
2024-10-09 14:56 ` [RFC PATCH v2 00/24] Modernize our " Patrick Steinhardt
` (19 preceding siblings ...)
2024-10-09 14:57 ` [RFC PATCH v2 20/24] Makefile: simplify building of templates Patrick Steinhardt
@ 2024-10-09 14:57 ` Patrick Steinhardt
2024-10-09 14:57 ` [RFC PATCH v2 22/24] t: allow overriding build dir Patrick Steinhardt
` (4 subsequent siblings)
25 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-09 14:57 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano
Our in-tree builds used by the Makefile use various different build
directories scattered around different locations. The paths to those
build directories have to be propagated to our tests such that they can
find the contained files. This is done via a mixture of hardcoded paths
in our test library and injected variables in our bin-wrappers or
"GIT-BUILD-OPTIONS".
The latter two mechanisms are preferable over using hardcoded paths. For
one, we have all paths which are subject to change stored in a small set
of central files instead of having the knowledge of build paths in many
files. And second, it allows build systems which build files elsewhere
to adapt those paths based on their own needs. This is especially nice
in the context of build systems that use out-of-tree builds like CMake
or Meson.
Remove hardcoded knowledge of build paths from our test library and move
it into our bin-wrappers and "GIT-BUILD-OPTIONS".
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-BUILD-OPTIONS.in | 5 +++++
Makefile | 9 +++++++++
bin-wrappers/wrap-for-bin.sh | 11 ++++++-----
contrib/buildsystems/CMakeLists.txt | 8 ++++++++
t/lib-gettext.sh | 4 ++--
t/t7609-mergetool--lib.sh | 2 +-
t/test-lib.sh | 6 +++---
7 files changed, 34 insertions(+), 11 deletions(-)
diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in
index f0ca240493c..cce06577840 100644
--- a/GIT-BUILD-OPTIONS.in
+++ b/GIT-BUILD-OPTIONS.in
@@ -33,4 +33,9 @@ GIT_PERF_MAKE_COMMAND=@GIT_PERF_MAKE_COMMAND@
GIT_INTEROP_MAKE_OPTS=@GIT_INTEROP_MAKE_OPTS@
GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@
GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@
+GIT_TEST_TEXTDOMAINDIR=@GIT_TEST_TEXTDOMAINDIR@
+GIT_TEST_POPATH=@GIT_TEST_POPATH@
+GIT_TEST_TEMPLATE_DIR=@GIT_TEST_TEMPLATE_DIR@
+GIT_TEST_GITPERLLIB=@GIT_TEST_GITPERLLIB@
+GIT_TEST_MERGE_TOOLS_DIR=@GIT_TEST_MERGE_TOOLS_DIR@
RUNTIME_PREFIX=@RUNTIME_PREFIX@
diff --git a/Makefile b/Makefile
index 554d8ea83b2..7764d3e284c 100644
--- a/Makefile
+++ b/Makefile
@@ -3194,6 +3194,11 @@ GIT-BUILD-OPTIONS: FORCE
-e "s|@GIT_INTEROP_MAKE_OPTS@|\'$(GIT_INTEROP_MAKE_OPTS)\'|" \
-e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \
-e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \
+ -e "s|@GIT_TEST_TEXTDOMAINDIR@|\'$(shell pwd)/po/build/locale\'|" \
+ -e "s|@GIT_TEST_POPATH@|\'$(shell pwd)/po\'|" \
+ -e "s|@GIT_TEST_TEMPLATE_DIR@|\'$(shell pwd)/templates/blt\'|" \
+ -e "s|@GIT_TEST_GITPERLLIB@|\'$(shell pwd)/perl/build/lib\'|" \
+ -e "s|@GIT_TEST_MERGE_TOOLS_DIR@|\'$(shell pwd)/mergetools\'|" \
-e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX)\'|" \
GIT-BUILD-OPTIONS.in >$@+
@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
@@ -3218,6 +3223,10 @@ all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PR
bin-wrappers/%: bin-wrappers/wrap-for-bin.sh
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@BUILD_DIR@|$(shell pwd)|' \
+ -e 's|@GIT_TEXTDOMAINDIR@|$(shell pwd)/po/build/locale|' \
+ -e 's|@GITPERLLIB@|$(shell pwd)/perl/build/lib|' \
+ -e 's|@MERGE_TOOLS_DIR@|$(shell pwd)/mergetools|' \
+ -e 's|@TEMPLATE_DIR@|$(shell pwd)/templates/blt|' \
-e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
chmod +x $@
diff --git a/bin-wrappers/wrap-for-bin.sh b/bin-wrappers/wrap-for-bin.sh
index 7898a1c238d..1d3a59a0081 100755
--- a/bin-wrappers/wrap-for-bin.sh
+++ b/bin-wrappers/wrap-for-bin.sh
@@ -4,21 +4,22 @@
# to run test suite against sandbox, but with only bindir-installed
# executables in PATH. The Makefile copies this into various
# files in bin-wrappers, substituting
-# @BUILD_DIR@ and @PROG@.
+# @BUILD_DIR@, @TEMPLATE_DIR@ and @PROG@.
GIT_EXEC_PATH='@BUILD_DIR@'
if test -n "$NO_SET_GIT_TEMPLATE_DIR"
then
unset GIT_TEMPLATE_DIR
else
- GIT_TEMPLATE_DIR='@BUILD_DIR@/templates/blt'
+ GIT_TEMPLATE_DIR='@TEMPLATE_DIR@'
export GIT_TEMPLATE_DIR
fi
-GITPERLLIB='@BUILD_DIR@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}"
-GIT_TEXTDOMAINDIR='@BUILD_DIR@/po/build/locale'
+MERGE_TOOLS_DIR='@MERGE_TOOLS_DIR@'
+GITPERLLIB='@GITPERLLIB@'"${GITPERLLIB:+:$GITPERLLIB}"
+GIT_TEXTDOMAINDIR='@GIT_TEXTDOMAINDIR@'
PATH='@BUILD_DIR@/bin-wrappers:'"$PATH"
-export GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
+export MERGE_TOOLS_DIR GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
case "$GIT_DEBUGGER" in
'')
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index b95287468cd..bf5e2b5c08d 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -1087,6 +1087,9 @@ endforeach()
file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+string(REPLACE "@GIT_TEXTDOMAINDIR@" "${CMAKE_BINARY_DIR}/po/build/locale" content "${content}")
+string(REPLACE "@GITPERLLIB@" "${CMAKE_BINARY_DIR}/perl/build/lib" content "${content}")
+string(REPLACE "@MERGE_TOOLS_DIR@" "${CMAKE_SOURCE_DIR}/mergetools" content "${content}")
string(REPLACE "@PROG@" "git-cvsserver" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})
@@ -1171,6 +1174,11 @@ string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_optio
string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}")
string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}")
string(REPLACE "@RUNTIME_PREFIX@" "${RUNTIME_PREFIX}" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_TEXTDOMAINDIR@" "${CMAKE_BINARY_DIR}/po/build/locale" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_POPATH@" "${CMAKE_BINARY_DIR}/po" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_TEMPLATE_DIR@" "${CMAKE_BINARY_DIR}/templates/blt" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_GITPERLLIB@" "${CMAKE_BINARY_DIR}/perl/build/lib" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_MERGE_TOOLS_DIR@" "${RUNTIME_PREFIX}" git_build_options "${git_build_options}")
if(USE_VCPKG)
string(APPEND git_build_options "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
endif()
diff --git a/t/lib-gettext.sh b/t/lib-gettext.sh
index cc6bb2cdeaa..7a734c6973e 100644
--- a/t/lib-gettext.sh
+++ b/t/lib-gettext.sh
@@ -6,8 +6,8 @@
. ./test-lib.sh
-GIT_TEXTDOMAINDIR="$GIT_BUILD_DIR/po/build/locale"
-GIT_PO_PATH="$GIT_BUILD_DIR/po"
+GIT_TEXTDOMAINDIR="$GIT_TEST_TEXTDOMAINDIR"
+GIT_PO_PATH="$GIT_TEST_POPATH"
export GIT_TEXTDOMAINDIR GIT_PO_PATH
if test -n "$GIT_TEST_INSTALLED"
diff --git a/t/t7609-mergetool--lib.sh b/t/t7609-mergetool--lib.sh
index 8b1c3bd39f2..a9273ba58d7 100755
--- a/t/t7609-mergetool--lib.sh
+++ b/t/t7609-mergetool--lib.sh
@@ -8,7 +8,7 @@ TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'mergetool --tool=vimdiff creates the expected layout' '
- . "$GIT_BUILD_DIR"/mergetools/vimdiff &&
+ . "$GIT_TEST_MERGE_TOOLS_DIR"/vimdiff &&
run_unit_tests
'
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 4dd641baefe..677424ced06 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1478,7 +1478,7 @@ else # normal case, use ../bin-wrappers only unless $with_dashes:
PATH="$GIT_BUILD_DIR:$GIT_BUILD_DIR/t/helper:$PATH"
fi
fi
-GIT_TEMPLATE_DIR="$GIT_BUILD_DIR"/templates/blt
+GIT_TEMPLATE_DIR="$GIT_TEST_TEMPLATE_DIR"
GIT_CONFIG_NOSYSTEM=1
GIT_ATTR_NOSYSTEM=1
GIT_CEILING_DIRECTORIES="$TRASH_DIRECTORY/.."
@@ -1494,9 +1494,9 @@ then
fi
fi
-GITPERLLIB="$GIT_BUILD_DIR"/perl/build/lib
+GITPERLLIB="$GIT_TEST_GITPERLLIB"
export GITPERLLIB
-test -d "$GIT_BUILD_DIR"/templates/blt || {
+test -d "$GIT_TEMPLATE_DIR" || {
BAIL_OUT "You haven't built things yet, have you?"
}
--
2.47.0.rc1.33.g90fe3800b9.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v2 22/24] t: allow overriding build dir
2024-10-09 14:56 ` [RFC PATCH v2 00/24] Modernize our " Patrick Steinhardt
` (20 preceding siblings ...)
2024-10-09 14:57 ` [RFC PATCH v2 21/24] t: better support for out-of-tree builds Patrick Steinhardt
@ 2024-10-09 14:57 ` Patrick Steinhardt
2024-10-09 14:57 ` [RFC PATCH v2 23/24] Documentation: add comparison of build systems Patrick Steinhardt
` (3 subsequent siblings)
25 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-09 14:57 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano
Our "test-lib.sh" assumes that our build directory is the parent
directory of "t/". While true when using our Makefile, it's not when
using build systems that support out-of-tree builds.
In commit ee9e66e4e7 (cmake: avoid editing t/test-lib.sh, 2022-10-18),
we have introduce support for overriding the GIT_BIULD_DIR by creating
the file "$GIT_BUILD_DIR/GIT-BUILD-DIR" with its contents pointing to
the location of the build directory. The intent was to stop modifying
"t/test-lib.sh" with the CMake build systems while allowing out-of-tree
builds. But "$GIT_BUILD_DIR" is somewhat misleadingly named, as it in
fact points to the _source_ directory. So while that commit solved part
of the problem for out-of-tree builds, CMake still has to write files
into the source tree.
Solve the second part of the problem, namely not having to write any
data into the source directory at all, by also supporting an environment
variable that allows us to point to a different build directory. This
allows us to perform properly self-contained out-of-tree builds.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
t/test-lib.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 677424ced06..096af9be6b1 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -35,7 +35,7 @@ else
# needing to exist.
TEST_DIRECTORY=$(cd "$TEST_DIRECTORY" && pwd) || exit 1
fi
-GIT_BUILD_DIR="${TEST_DIRECTORY%/t}"
+GIT_BUILD_DIR="${GIT_BUILD_DIR:-${TEST_DIRECTORY%/t}}"
if test "$TEST_DIRECTORY" = "$GIT_BUILD_DIR"
then
echo "PANIC: Running in a $TEST_DIRECTORY that doesn't end in '/t'?" >&2
@@ -513,6 +513,7 @@ unset VISUAL EMAIL LANGUAGE $("$PERL_PATH" -e '
PERF_
CURL_VERBOSE
TRACE_CURL
+ BUILD_DIR
));
my @vars = grep(/^GIT_/ && !/^GIT_($ok)/o, @env);
print join("\n", @vars);
--
2.47.0.rc1.33.g90fe3800b9.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v2 23/24] Documentation: add comparison of build systems
2024-10-09 14:56 ` [RFC PATCH v2 00/24] Modernize our " Patrick Steinhardt
` (21 preceding siblings ...)
2024-10-09 14:57 ` [RFC PATCH v2 22/24] t: allow overriding build dir Patrick Steinhardt
@ 2024-10-09 14:57 ` Patrick Steinhardt
2024-10-14 15:23 ` Phillip Wood
2024-10-09 14:57 ` [RFC PATCH v2 24/24] Introduce support for the Meson build system Patrick Steinhardt
` (2 subsequent siblings)
25 siblings, 1 reply; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-09 14:57 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano
We're contemplating whether to eventually replace our build systems with
a build system that is easier to use. Add a comparison of build systems
to our technical documentation as a baseline for discussion.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Documentation/Makefile | 1 +
Documentation/technical/build-systems.txt | 224 ++++++++++++++++++++++
2 files changed, 225 insertions(+)
create mode 100644 Documentation/technical/build-systems.txt
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 0f55baa252f..e23cffb5f9a 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -111,6 +111,7 @@ TECH_DOCS += MyFirstObjectWalk
TECH_DOCS += SubmittingPatches
TECH_DOCS += ToolsForGit
TECH_DOCS += technical/bitmap-format
+TECH_DOCS += technical/build-systems
TECH_DOCS += technical/bundle-uri
TECH_DOCS += technical/hash-function-transition
TECH_DOCS += technical/long-running-process-protocol
diff --git a/Documentation/technical/build-systems.txt b/Documentation/technical/build-systems.txt
new file mode 100644
index 00000000000..c00d9b71978
--- /dev/null
+++ b/Documentation/technical/build-systems.txt
@@ -0,0 +1,224 @@
+= Build Systems
+
+The build system is the primary way for both developers and system integrators
+to interact with the Git project. As such, being easy to use and extend for
+those who are not directly developing Git itself is just as important as other
+requirements we have on any potential build system.
+
+This document outlines the different requirements that we have for the build
+system and then compares available build systems using these criteria.
+
+== Requirements
+
+The following subsections present a list of requirements that we have for any
+potential build system. Sections are sorted by decreasing priority, even though
+these priorities will naturally differ between users.
+
+=== Platform support
+
+The build system must have support for all of our primary platforms as outlined
+by. These platforms are:
+
+ - Linux
+ - Windows
+ - macOS
+
+Furthermore, the build system should have support for the following secondary
+platforms:
+
+ - AIX
+ - FreeBSD
+ - NetBSD
+ - OpenBSD
+
+The platforms which must be supported by the tool should be aligned with our
+[platform support policy](platform-support.txt).
+
+=== Auto-detection of supported features
+
+The build system must support auto-detection of features which are or aren't
+available on the current platform. Platform maintainers should not be required
+to manually configure the complete build.
+
+Auto-detection of the following items is considered to be important:
+
+ - Check for the existence of headers.
+ - Check for the existence of libraries.
+ - Check for the existence of exectuables.
+ - Check for the runtime behavior of specific functions.
+ - Check for specific link order requirements when multiple libraries are
+ involved.
+
+=== Ease of use
+
+The build system should be both easy to use and easy to extend. While this is
+naturally a subjective metric it is likely not controversial to say that some
+build systems are considerably harder to use than others.
+
+=== IDE support
+
+The build system should integrate with well-known IDEs. Well-known IDEs include:
+
+ - Microsoft Visual Studio
+ - Visual Studio Code
+ - Xcode
+
+There are four levels of support:
+
+ - Native integration into the IDE.
+ - Integration into the IDE via a plugin.
+ - Integration into the IDE via generating a project description with the build
+ system.
+ - No integration.
+
+Native integration is preferable, but integration via either a plugin or by
+generating a project description via the build system are considered feasible
+alternatives.
+
+Another important distinction is the level of integration. There are two
+features that one generally wants to have:
+
+ - Integration of build targets.
+ - Automatic setup of features like code completion with detected build
+ dependencies.
+
+The first bullet point is the bare minimum, but is not sufficient to be
+considered proper integration.
+
+=== Out-of-tree builds
+
+The build system should support out-of-tree builds. Out-of-tree builds allow a
+developer to configure multiple different build directories with different
+configuration, e.g. one "debug" build and one "release" build.
+
+=== Cross-platform builds
+
+The build system should support cross-platform builds, e.g. building for arm on
+an x86-64 host.
+
+=== Language support
+
+The following languages and toolchains are of relevance and should be supported
+by the build system:
+
+ - C: the primary compiled language used by Git, must be supported. Relevant
+ toolchains are GCC, Clang and MSVC.
+ - Rust: candidate as a second compiled lanugage, should be supported. Relevant
+ toolchains is the LLVM-based rustc.
+
+Built-in support for the respective languages is preferred over support that
+needs to be wired up manually to avoid unnecessary complexity. Native support
+includes the following features:
+
+ - Compiling objects.
+ - Dependency tracking.
+ - Detection of available features.
+ - Discovery of relevant toolchains.
+ - Linking libraries and executables.
+
+=== Test integration
+
+It should be possible to integrate tests into the build system such that it is
+possible to build and test Git within the build system. Features which are nice
+to have:
+
+ - Track build-time dependencies for respective tests. Unit tests have
+ different requirements than integration tests.
+ - Allow filtering of which tests to run.
+ - Allow interactive tests that drop the user into a shell with `test_pause` or
+ `debug`.
+
+== Comparison
+
+The following list of build systems are considered:
+
+- GNU Make
+- autoconf
+- CMake
+- Meson
+
+=== GNU Make
+
+- Platform support: ubitquitous on all platforms, but not well-integrated into Windows.
+- Auto-detection: no built-in support for auto-detection of features.
+- Ease of use: easy to use, but discovering available options is hard. Makefile
+ rules can quickly get out of hand once reaching a certain scope.
+- IDE support: execution of Makefile targets is supported by many IDEs
+- Out-of-tree builds: supported in theory, not wired up in practice.
+- Cross-platform builds: supported in theory, not wired up in practice.
+- Language support:
+ - C: Limited built-in support, many parts need to be wired up manually.
+ - Rust: No built-in support, needs to be wired up manually.
+- Test integration: partially supported, many parts need to be wired up
+ manually.
+
+=== autoconf
+
+- Platform support: ubiquitous on all platforms, but not well-integrated into Windows.
+- Auto-detection: supported.
+- Ease of use: easy to use, discovering available options is comparatively
+ easy. The autoconf syntax is prohibitively hard to extend though due to its
+ complex set of interacting files and the hard-to-understand M4 language.
+- IDE support: no integration into IDEs at generation time. The generated
+ Makefiles have the same level of support as GNU Make.
+- Out-of-tree builds: supported in theory, not wired up in practice.
+- Cross-platform builds: supported.
+- Language support:
+ - C: Limited built-in support, many parts need to be wired up manually.
+ - Rust: No built-in support, needs to be wired up manually.
+- Test integration: partially supported, many parts need to be wired up
+ manually.
+
+=== CMake
+
+- Platform support: not as extensive as GNU Make or autoconf, but all major
+ platforms are supported.
+ - AIX
+ - Cygwin
+ - FreeBSD
+ - Linux
+ - OpenBSD
+ - Solaris
+ - Windows
+ - macOS
+- Ease of use: easy to use, discovering available options is not always
+ trivial. The scripting language used by CMake is somewhat cumbersome to use,
+ but extending CMake build instructions is doable.
+- IDE support: natively integrated into Microsoft Visual Studio. Can generate
+ project descriptions for Xcode. An extension is available for Visual Studio
+ Code. Many other IDEs have plugins for CMake.
+- Out-of-tree builds: supported.
+- Cross-platform builds: supported.
+- Language support:
+ - C: Supported for GCC, Clang, MSVC and other toolchains.
+ - Rust: No built-in support, needs to be wired up manually.
+- Test integration: supported, even though test dependencies are a bit
+ cumbersome to use via "test fixtures". Interactive test runs are not
+ supported.
+
+=== Meson
+
+- Platform: not as extensive as GNU Make or autoconf, but all major platforms
+ and some smaller ones are supported.
+ - AIX
+ - Cygwin
+ - DragonflyBSD
+ - FreeBSD
+ - Haiku
+ - Linux
+ - NetBSD
+ - OpenBSD
+ - Solaris
+ - Windows
+ - macOS
+- Ease of use: easy to use, discovering available options is easy. The
+ scripting language is straight-forward to use.
+- IDE support: Supports generating build instructions for Xcode and Microsoft
+ Visual Studio, a plugin exists for Visual Studio Code.
+- Out-of-tree builds: supported.
+- Cross-platform builds: supported.
+- Language support:
+ - C: Supported for GCC, Clang, MSVC and other toolchains.
+ - Rust: Supported for rustc.
+- Test integration: supported. Interactive tests are supported starting with
+ Meson 1.5.0 via the `--interactive` flag.
--
2.47.0.rc1.33.g90fe3800b9.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v2 24/24] Introduce support for the Meson build system
2024-10-09 14:56 ` [RFC PATCH v2 00/24] Modernize our " Patrick Steinhardt
` (22 preceding siblings ...)
2024-10-09 14:57 ` [RFC PATCH v2 23/24] Documentation: add comparison of build systems Patrick Steinhardt
@ 2024-10-09 14:57 ` Patrick Steinhardt
2024-10-14 2:07 ` Eli Schwartz
2024-10-10 5:26 ` [RFC PATCH v2 00/24] Modernize our " Junio C Hamano
2024-10-12 2:04 ` Junio C Hamano
25 siblings, 1 reply; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-09 14:57 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano
Introduce support for the Meson build system, a "modern" meta build
system that supports many different plaforms, 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 is likely to 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 fordebugging.
$ 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, except gitweb-based tests.
- NixOS 24.11.
- Ubuntu 24.04.
- Windows 10 with Cygwin, using `-Dperl=disabled -Dpython=disabled`.
- Windows 10 with MinGW64, using `-Dperl=disabled -Dpython=disabled`.
- Windows 10 with MSVC 2022, using `-Dperl=disabled -Dpython=disabled
-Dgettext=disabled -Diconv=disabled --wrap-mode=forcefallback`.
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 usecase for
those anymore. By not installing those symlinks we thus start the
deprecation of this layout.
- Support for installing documentation has not been wired up yet. This
will follow if the project can agree on Meson as build system.
- Documentation does not yet exist. Same here, it will follow if the
project can agree on Meson.
- We're targeting a 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 3000 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.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
bin-wrappers/meson.build | 28 +
contrib/completion/meson.build | 8 +
contrib/meson.build | 1 +
gitweb/meson.build | 32 +
gitweb/static/meson.build | 28 +
meson.build | 1607 ++++++++++++++++++++++++++++
meson_options.txt | 70 ++
perl/FromCPAN/Mail/meson.build | 7 +
perl/FromCPAN/meson.build | 9 +
perl/Git/LoadCPAN/Mail/meson.build | 7 +
perl/Git/LoadCPAN/meson.build | 9 +
perl/Git/SVN/Memoize/meson.build | 7 +
perl/Git/SVN/meson.build | 20 +
perl/Git/meson.build | 18 +
perl/meson.build | 18 +
po/meson.build | 28 +
subprojects/curl.wrap | 13 +
subprojects/expat.wrap | 13 +
subprojects/openssl.wrap | 15 +
subprojects/pcre2.wrap | 16 +
subprojects/zlib.wrap | 13 +
t/helper/meson.build | 91 ++
t/meson.build | 1105 +++++++++++++++++++
templates/hooks/meson.build | 24 +
templates/info/meson.build | 5 +
templates/meson.build | 8 +
26 files changed, 3200 insertions(+)
create mode 100644 bin-wrappers/meson.build
create mode 100644 contrib/completion/meson.build
create mode 100644 contrib/meson.build
create mode 100644 gitweb/meson.build
create mode 100644 gitweb/static/meson.build
create mode 100644 meson.build
create mode 100644 meson_options.txt
create mode 100644 perl/FromCPAN/Mail/meson.build
create mode 100644 perl/FromCPAN/meson.build
create mode 100644 perl/Git/LoadCPAN/Mail/meson.build
create mode 100644 perl/Git/LoadCPAN/meson.build
create mode 100644 perl/Git/SVN/Memoize/meson.build
create mode 100644 perl/Git/SVN/meson.build
create mode 100644 perl/Git/meson.build
create mode 100644 perl/meson.build
create mode 100644 po/meson.build
create mode 100644 subprojects/curl.wrap
create mode 100644 subprojects/expat.wrap
create mode 100644 subprojects/openssl.wrap
create mode 100644 subprojects/pcre2.wrap
create mode 100644 subprojects/zlib.wrap
create mode 100644 t/helper/meson.build
create mode 100644 t/meson.build
create mode 100644 templates/hooks/meson.build
create mode 100644 templates/info/meson.build
create mode 100644 templates/meson.build
diff --git a/bin-wrappers/meson.build b/bin-wrappers/meson.build
new file mode 100644
index 00000000000..6d03a19d7b8
--- /dev/null
+++ b/bin-wrappers/meson.build
@@ -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', fs.relative_to(executable.full_path(), meson.project_build_root()))
+
+ configure_file(
+ input: 'wrap-for-bin.sh',
+ output: fs.stem(executable.full_path()),
+ configuration: executable_config,
+ )
+endforeach
diff --git a/contrib/completion/meson.build b/contrib/completion/meson.build
new file mode 100644
index 00000000000..a9bfe2da312
--- /dev/null
+++ b/contrib/completion/meson.build
@@ -0,0 +1,8 @@
+foreach script : [
+ 'git-completion.bash',
+ 'git-completion.tcsh',
+ 'git-completion.zsh',
+ 'git-prompt.sh'
+]
+ test_dependencies += fs.copyfile(script)
+endforeach
diff --git a/contrib/meson.build b/contrib/meson.build
new file mode 100644
index 00000000000..a7b77b87c22
--- /dev/null
+++ b/contrib/meson.build
@@ -0,0 +1 @@
+subdir('completion')
diff --git a/gitweb/meson.build b/gitweb/meson.build
new file mode 100644
index 00000000000..f9c3a766472
--- /dev/null
+++ b/gitweb/meson.build
@@ -0,0 +1,32 @@
+configure_file(
+ input: 'gitweb.perl',
+ output: 'gitweb.cgi',
+ configuration: {
+ 'GIT_VERSION': meson.project_version(),
+ 'GIT_BINDIR': get_option('prefix') / get_option('bindir'),
+ 'GITWEB_CONFIG': get_option('gitweb_config'),
+ 'GITWEB_CONFIG_SYSTEM': get_option('gitweb_config_system'),
+ 'GITWEB_CONFIG_COMMON': get_option('gitweb_config_common'),
+ 'GITWEB_HOME_LINK_STR': get_option('gitweb_home_link_str'),
+ 'GITWEB_SITENAME': get_option('gitweb_sitename'),
+ 'GITWEB_PROJECTROOT': get_option('gitweb_projectroot'),
+ 'GITWEB_PROJECT_MAXDEPTH': get_option('gitweb_project_maxdepth'),
+ 'GITWEB_EXPORT_OK': get_option('gitweb_export_ok'),
+ 'GITWEB_STRICT_EXPORT': get_option('gitweb_strict_export'),
+ 'GITWEB_BASE_URL': get_option('gitweb_base_url'),
+ 'GITWEB_LIST': get_option('gitweb_list'),
+ 'GITWEB_HOMETEXT': get_option('gitweb_hometext'),
+ 'GITWEB_CSS': get_option('gitweb_css'),
+ 'GITWEB_LOGO': get_option('gitweb_logo'),
+ 'GITWEB_FAVICON': get_option('gitweb_favicon'),
+ 'GITWEB_JS': get_option('gitweb_js'),
+ 'GITWEB_SITE_HTML_HEAD_STRING': get_option('gitweb_site_html_head_string'),
+ 'GITWEB_SITE_HEADER': get_option('gitweb_site_header'),
+ 'GITWEB_SITE_FOOTER': get_option('gitweb_site_footer'),
+ 'HIGHLIGHT_BIN': get_option('highlight_bin'),
+ },
+ install: true,
+ install_dir: get_option('datadir') / 'gitweb',
+)
+
+subdir('static')
diff --git a/gitweb/static/meson.build b/gitweb/static/meson.build
new file mode 100644
index 00000000000..1bdbe70d2d6
--- /dev/null
+++ b/gitweb/static/meson.build
@@ -0,0 +1,28 @@
+foreach asset : [
+ 'git-favicon.png',
+ 'git-logo.png',
+ 'gitweb.css',
+]
+ fs.copyfile(asset,
+ install: true,
+ install_dir: get_option('datadir') / 'gitweb/static',
+ )
+endforeach
+
+javascript_sources = [
+ meson.current_source_dir() / 'js/adjust-timezone.js',
+ meson.current_source_dir() / 'js/blame_incremental.js',
+ meson.current_source_dir() / 'js/javascript-detection.js',
+ meson.current_source_dir() / 'js/lib/common-lib.js',
+ meson.current_source_dir() / 'js/lib/cookies.js',
+ meson.current_source_dir() / 'js/lib/datetime.js',
+]
+
+custom_target(
+ input: javascript_sources,
+ output: 'gitweb.js',
+ capture: true,
+ command: ['cat'] + javascript_sources,
+ install: true,
+ install_dir: get_option('datadir') / 'gitweb/static',
+)
diff --git a/meson.build b/meson.build
new file mode 100644
index 00000000000..338d472bc66
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,1607 @@
+project('git', 'c',
+ meson_version: '>=1.3.0',
+ # MSVC does not support GNU99, and C99 does not define __STDC_VERSION__
+ # on MSVC. So we instead fall back to C11 there.
+ default_options: ['c_std=gnu99,c11'],
+ version: run_command('GIT-VERSION-GEN', check: true).stdout().strip(),
+)
+
+fs = import('fs')
+
+compiler = meson.get_compiler('c')
+
+cygpath = find_program('cygpath', required: false)
+shell = find_program('sh')
+tar = find_program('tar')
+diff = find_program('diff')
+
+libgit_sources = [
+ 'abspath.c',
+ 'add-interactive.c',
+ 'add-patch.c',
+ 'advice.c',
+ 'alias.c',
+ 'alloc.c',
+ 'apply.c',
+ 'archive-tar.c',
+ 'archive-zip.c',
+ 'archive.c',
+ 'attr.c',
+ 'base85.c',
+ 'bisect.c',
+ 'blame.c',
+ 'blob.c',
+ 'bloom.c',
+ 'branch.c',
+ 'bulk-checkin.c',
+ 'bundle-uri.c',
+ 'bundle.c',
+ 'cache-tree.c',
+ 'cbtree.c',
+ 'chdir-notify.c',
+ 'checkout.c',
+ 'chunk-format.c',
+ 'color.c',
+ 'column.c',
+ 'combine-diff.c',
+ 'commit-graph.c',
+ 'commit-reach.c',
+ 'commit.c',
+ 'compat/nonblock.c',
+ 'compat/obstack.c',
+ 'compat/terminal.c',
+ 'compat/zlib-uncompress2.c',
+ 'config.c',
+ 'connect.c',
+ 'connected.c',
+ 'convert.c',
+ 'copy.c',
+ 'credential.c',
+ 'csum-file.c',
+ 'ctype.c',
+ 'date.c',
+ 'decorate.c',
+ 'delta-islands.c',
+ 'diagnose.c',
+ 'diff-delta.c',
+ 'diff-merges.c',
+ 'diff-lib.c',
+ 'diff-no-index.c',
+ 'diff.c',
+ 'diffcore-break.c',
+ 'diffcore-delta.c',
+ 'diffcore-order.c',
+ 'diffcore-pickaxe.c',
+ 'diffcore-rename.c',
+ 'diffcore-rotate.c',
+ 'dir-iterator.c',
+ 'dir.c',
+ 'editor.c',
+ 'entry.c',
+ 'environment.c',
+ 'ewah/bitmap.c',
+ 'ewah/ewah_bitmap.c',
+ 'ewah/ewah_io.c',
+ 'ewah/ewah_rlw.c',
+ 'exec-cmd.c',
+ 'fetch-negotiator.c',
+ 'fetch-pack.c',
+ 'fmt-merge-msg.c',
+ 'fsck.c',
+ 'fsmonitor.c',
+ 'fsmonitor-ipc.c',
+ 'fsmonitor-settings.c',
+ 'gettext.c',
+ 'git-zlib.c',
+ 'gpg-interface.c',
+ 'graph.c',
+ 'grep.c',
+ 'hash-lookup.c',
+ 'hashmap.c',
+ 'help.c',
+ 'hex.c',
+ 'hex-ll.c',
+ 'hook.c',
+ 'ident.c',
+ 'json-writer.c',
+ 'kwset.c',
+ 'levenshtein.c',
+ 'line-log.c',
+ 'line-range.c',
+ 'linear-assignment.c',
+ 'list-objects-filter-options.c',
+ 'list-objects-filter.c',
+ 'list-objects.c',
+ 'lockfile.c',
+ 'log-tree.c',
+ 'loose.c',
+ 'ls-refs.c',
+ 'mailinfo.c',
+ 'mailmap.c',
+ 'match-trees.c',
+ 'mem-pool.c',
+ 'merge-blobs.c',
+ 'merge-ll.c',
+ 'merge-ort.c',
+ 'merge-ort-wrappers.c',
+ 'merge-recursive.c',
+ 'merge.c',
+ 'midx.c',
+ 'midx-write.c',
+ 'name-hash.c',
+ 'negotiator/default.c',
+ 'negotiator/noop.c',
+ 'negotiator/skipping.c',
+ 'notes-cache.c',
+ 'notes-merge.c',
+ 'notes-utils.c',
+ 'notes.c',
+ 'object-file-convert.c',
+ 'object-file.c',
+ 'object-name.c',
+ 'object.c',
+ 'oid-array.c',
+ 'oidmap.c',
+ 'oidset.c',
+ 'oidtree.c',
+ 'pack-bitmap-write.c',
+ 'pack-bitmap.c',
+ 'pack-check.c',
+ 'pack-mtimes.c',
+ 'pack-objects.c',
+ 'pack-revindex.c',
+ 'pack-write.c',
+ 'packfile.c',
+ 'pager.c',
+ 'parallel-checkout.c',
+ 'parse.c',
+ 'parse-options-cb.c',
+ 'parse-options.c',
+ 'patch-delta.c',
+ 'patch-ids.c',
+ 'path.c',
+ 'pathspec.c',
+ 'pkt-line.c',
+ 'preload-index.c',
+ 'pretty.c',
+ 'prio-queue.c',
+ 'progress.c',
+ 'promisor-remote.c',
+ 'prompt.c',
+ 'protocol.c',
+ 'protocol-caps.c',
+ 'prune-packed.c',
+ 'pseudo-merge.c',
+ 'quote.c',
+ 'range-diff.c',
+ 'reachable.c',
+ 'read-cache.c',
+ 'rebase-interactive.c',
+ 'rebase.c',
+ 'ref-filter.c',
+ 'reflog-walk.c',
+ 'reflog.c',
+ 'refs.c',
+ 'refs/debug.c',
+ 'refs/files-backend.c',
+ 'refs/reftable-backend.c',
+ 'refs/iterator.c',
+ 'refs/packed-backend.c',
+ 'refs/ref-cache.c',
+ 'refspec.c',
+ 'reftable/basics.c',
+ 'reftable/error.c',
+ 'reftable/block.c',
+ 'reftable/blocksource.c',
+ 'reftable/iter.c',
+ 'reftable/publicbasics.c',
+ 'reftable/merged.c',
+ 'reftable/pq.c',
+ 'reftable/reader.c',
+ 'reftable/record.c',
+ 'reftable/stack.c',
+ 'reftable/tree.c',
+ 'reftable/writer.c',
+ 'remote.c',
+ 'replace-object.c',
+ 'repo-settings.c',
+ 'repository.c',
+ 'rerere.c',
+ 'reset.c',
+ 'resolve-undo.c',
+ 'revision.c',
+ 'run-command.c',
+ 'send-pack.c',
+ 'sequencer.c',
+ 'serve.c',
+ 'server-info.c',
+ 'setup.c',
+ 'shallow.c',
+ 'sideband.c',
+ 'sigchain.c',
+ 'sparse-index.c',
+ 'split-index.c',
+ 'stable-qsort.c',
+ 'statinfo.c',
+ 'strbuf.c',
+ 'streaming.c',
+ 'string-list.c',
+ 'strmap.c',
+ 'strvec.c',
+ 'sub-process.c',
+ 'submodule-config.c',
+ 'submodule.c',
+ 'symlinks.c',
+ 'tag.c',
+ 'tempfile.c',
+ 'thread-utils.c',
+ 'tmp-objdir.c',
+ 'trace.c',
+ 'trace2.c',
+ 'trace2/tr2_cfg.c',
+ 'trace2/tr2_cmd_name.c',
+ 'trace2/tr2_ctr.c',
+ 'trace2/tr2_dst.c',
+ 'trace2/tr2_sid.c',
+ 'trace2/tr2_sysenv.c',
+ 'trace2/tr2_tbuf.c',
+ 'trace2/tr2_tgt_event.c',
+ 'trace2/tr2_tgt_normal.c',
+ 'trace2/tr2_tgt_perf.c',
+ 'trace2/tr2_tls.c',
+ 'trace2/tr2_tmr.c',
+ 'trailer.c',
+ 'transport-helper.c',
+ 'transport.c',
+ 'tree-diff.c',
+ 'tree-walk.c',
+ 'tree.c',
+ 'unpack-trees.c',
+ 'upload-pack.c',
+ 'url.c',
+ 'urlmatch.c',
+ 'usage.c',
+ 'userdiff.c',
+ 'utf8.c',
+ 'varint.c',
+ 'versioncmp.c',
+ 'walker.c',
+ 'wildmatch.c',
+ 'worktree.c',
+ 'wrapper.c',
+ 'write-or-die.c',
+ 'ws.c',
+ 'wt-status.c',
+ 'xdiff-interface.c',
+ 'xdiff/xdiffi.c',
+ 'xdiff/xemit.c',
+ 'xdiff/xhistogram.c',
+ 'xdiff/xmerge.c',
+ 'xdiff/xpatience.c',
+ 'xdiff/xprepare.c',
+ 'xdiff/xutils.c',
+]
+
+builtin_sources = [
+ 'builtin/add.c',
+ 'builtin/am.c',
+ 'builtin/annotate.c',
+ 'builtin/apply.c',
+ 'builtin/archive.c',
+ 'builtin/bisect.c',
+ 'builtin/blame.c',
+ 'builtin/branch.c',
+ 'builtin/bugreport.c',
+ 'builtin/bundle.c',
+ 'builtin/cat-file.c',
+ 'builtin/check-attr.c',
+ 'builtin/check-ignore.c',
+ 'builtin/check-mailmap.c',
+ 'builtin/check-ref-format.c',
+ 'builtin/checkout--worker.c',
+ 'builtin/checkout-index.c',
+ 'builtin/checkout.c',
+ 'builtin/clean.c',
+ 'builtin/clone.c',
+ 'builtin/column.c',
+ 'builtin/commit-graph.c',
+ 'builtin/commit-tree.c',
+ 'builtin/commit.c',
+ 'builtin/config.c',
+ 'builtin/count-objects.c',
+ 'builtin/credential-cache--daemon.c',
+ 'builtin/credential-cache.c',
+ 'builtin/credential-store.c',
+ 'builtin/credential.c',
+ 'builtin/describe.c',
+ 'builtin/diagnose.c',
+ 'builtin/diff-files.c',
+ 'builtin/diff-index.c',
+ 'builtin/diff-tree.c',
+ 'builtin/diff.c',
+ 'builtin/difftool.c',
+ 'builtin/fast-export.c',
+ 'builtin/fast-import.c',
+ 'builtin/fetch-pack.c',
+ 'builtin/fetch.c',
+ 'builtin/fmt-merge-msg.c',
+ 'builtin/for-each-ref.c',
+ 'builtin/for-each-repo.c',
+ 'builtin/fsck.c',
+ 'builtin/fsmonitor--daemon.c',
+ 'builtin/gc.c',
+ 'builtin/get-tar-commit-id.c',
+ 'builtin/grep.c',
+ 'builtin/hash-object.c',
+ 'builtin/help.c',
+ 'builtin/hook.c',
+ 'builtin/index-pack.c',
+ 'builtin/init-db.c',
+ 'builtin/interpret-trailers.c',
+ 'builtin/log.c',
+ 'builtin/ls-files.c',
+ 'builtin/ls-remote.c',
+ 'builtin/ls-tree.c',
+ 'builtin/mailinfo.c',
+ 'builtin/mailsplit.c',
+ 'builtin/merge-base.c',
+ 'builtin/merge-file.c',
+ 'builtin/merge-index.c',
+ 'builtin/merge-ours.c',
+ 'builtin/merge-recursive.c',
+ 'builtin/merge-tree.c',
+ 'builtin/merge.c',
+ 'builtin/mktag.c',
+ 'builtin/mktree.c',
+ 'builtin/multi-pack-index.c',
+ 'builtin/mv.c',
+ 'builtin/name-rev.c',
+ 'builtin/notes.c',
+ 'builtin/pack-objects.c',
+ 'builtin/pack-redundant.c',
+ 'builtin/pack-refs.c',
+ 'builtin/patch-id.c',
+ 'builtin/prune-packed.c',
+ 'builtin/prune.c',
+ 'builtin/pull.c',
+ 'builtin/push.c',
+ 'builtin/range-diff.c',
+ 'builtin/read-tree.c',
+ 'builtin/rebase.c',
+ 'builtin/receive-pack.c',
+ 'builtin/reflog.c',
+ 'builtin/refs.c',
+ 'builtin/remote-ext.c',
+ 'builtin/remote-fd.c',
+ 'builtin/remote.c',
+ 'builtin/repack.c',
+ 'builtin/replace.c',
+ 'builtin/replay.c',
+ 'builtin/rerere.c',
+ 'builtin/reset.c',
+ 'builtin/rev-list.c',
+ 'builtin/rev-parse.c',
+ 'builtin/revert.c',
+ 'builtin/rm.c',
+ 'builtin/send-pack.c',
+ 'builtin/shortlog.c',
+ 'builtin/show-branch.c',
+ 'builtin/show-index.c',
+ 'builtin/show-ref.c',
+ 'builtin/sparse-checkout.c',
+ 'builtin/stash.c',
+ 'builtin/stripspace.c',
+ 'builtin/submodule--helper.c',
+ 'builtin/symbolic-ref.c',
+ 'builtin/tag.c',
+ 'builtin/unpack-file.c',
+ 'builtin/unpack-objects.c',
+ 'builtin/update-index.c',
+ 'builtin/update-ref.c',
+ 'builtin/update-server-info.c',
+ 'builtin/upload-archive.c',
+ 'builtin/upload-pack.c',
+ 'builtin/var.c',
+ 'builtin/verify-commit.c',
+ 'builtin/verify-pack.c',
+ 'builtin/verify-tag.c',
+ 'builtin/worktree.c',
+ 'builtin/write-tree.c',
+]
+
+script_environment = environment()
+foreach tool : ['cat', 'cut', 'grep', 'sed', 'sort', 'tr', 'uname']
+ program = find_program(tool)
+ script_environment.prepend('PATH', fs.parent(program.full_path()))
+endforeach
+
+libgit_sources += custom_target(
+ 'command-list.h',
+ input: 'command-list.txt',
+ output: 'command-list.h',
+ command: [shell, meson.current_source_dir() + '/generate-cmdlist.sh', meson.current_source_dir(), '@OUTPUT@'],
+ env: script_environment,
+)
+
+libgit_sources += custom_target(
+ 'config-list.h',
+ output: 'config-list.h',
+ command: [
+ shell,
+ meson.current_source_dir() + '/generate-configlist.sh',
+ meson.current_source_dir(),
+ '@OUTPUT@',
+ ],
+ env: script_environment,
+)
+
+libgit_sources += custom_target(
+ 'hook-list.h',
+ input: 'Documentation/githooks.txt',
+ output: 'hook-list.h',
+ command: [
+ shell,
+ meson.current_source_dir() + '/generate-hooklist.sh',
+ meson.current_source_dir(),
+ '@OUTPUT@',
+ ],
+ env: script_environment,
+)
+
+# This contains the variables for GIT-BUILD-OPTIONS, which we use to propagate
+# build options to our tests.
+build_options_config = configuration_data()
+build_options_config.set('GIT_INTEROP_MAKE_OPTS', '')
+build_options_config.set('GIT_PERF_LARGE_REPO', '')
+build_options_config.set('GIT_PERF_MAKE_COMMAND', '')
+build_options_config.set('GIT_PERF_MAKE_OPTS', '')
+build_options_config.set('GIT_PERF_REPEAT_COUNT', '')
+build_options_config.set('GIT_PERF_REPO', '')
+build_options_config.set('GIT_TEST_CMP_USE_COPIED_CONTEXT', '')
+build_options_config.set('GIT_TEST_INDEX_VERSION', '')
+build_options_config.set('GIT_TEST_OPTS', '')
+build_options_config.set('GIT_TEST_PERL_FATAL_WARNINGS', '')
+build_options_config.set('GIT_TEST_UTF8_LOCALE', '')
+build_options_config.set('SANITIZE_ADDRESS', '')
+build_options_config.set('SANITIZE_LEAK', '')
+
+test_output_directory = get_option('test_output_directory')
+if test_output_directory == ''
+ test_output_directory = meson.project_build_root() / 'test-output'
+endif
+
+# These variables are used for building libgit.a.
+libgit_c_args = [
+ '-DBINDIR="' + get_option('bindir') + '"',
+ '-DDEFAULT_EDITOR="' + get_option('default_editor') + '"',
+ '-DDEFAULT_GIT_TEMPLATE_DIR="' + get_option('datadir') / 'git-core/templates' + '"',
+ '-DDEFAULT_HELP_FORMAT="' + get_option('default_help_format') + '"',
+ '-DDEFAULT_PAGER="' + get_option('default_pager') + '"',
+ '-DETC_GITATTRIBUTES="' + get_option('gitattributes') + '"',
+ '-DETC_GITCONFIG="' + get_option('gitconfig') + '"',
+ '-DFALLBACK_RUNTIME_PREFIX="' + get_option('prefix') + '"',
+ '-DGIT_EXEC_PATH="' + get_option('prefix') / get_option('libexecdir') / 'git-core"',
+ '-DGIT_HOST_CPU="' + host_machine.cpu_family() + '"',
+ '-DGIT_HTML_PATH="' + get_option('datadir') / 'doc/git-doc"',
+ '-DGIT_INFO_PATH="' + get_option('infodir') + '"',
+ '-DGIT_LOCALE_PATH="' + get_option('localedir') + '"',
+ '-DGIT_MAN_PATH="' + get_option('mandir') + '"',
+ '-DPAGER_ENV="' + get_option('pager_environment') + '"',
+ '-DSHELL_PATH="' + fs.as_posix(shell.full_path()) + '"',
+]
+libgit_include_directories = [ '.' ]
+libgit_dependencies = [ ]
+
+executable_suffix = ''
+if host_machine.system() == 'cygwin' or host_machine.system() == 'windows'
+ executable_suffix = '.exe'
+ libgit_c_args += '-DSTRIP_EXTENSION="' + executable_suffix + '"'
+endif
+build_options_config.set_quoted('X', executable_suffix)
+
+python = import('python').find_installation('python3', required: get_option('python'))
+if python.found()
+ build_options_config.set('NO_PYTHON', '')
+else
+ libgit_c_args += '-DNO_PYTHON'
+ build_options_config.set('NO_PYTHON', '1')
+endif
+
+# Perl is used for two different things: our test harness and to provide some
+# features. It is optional if you want to neither execute tests nor use any of
+# these optional features.
+perl_required = get_option('perl')
+if get_option('tests')
+ perl_required = true
+endif
+
+# Note that we only set NO_PERL if the Perl features were disabled by the user.
+# It may not be set when we have found Perl, but only use it to run tests.
+perl = find_program('perl', version: '>=5.8.1', required: perl_required)
+perl_features_enabled = perl.found() and get_option('perl').allowed()
+if perl_features_enabled
+ build_options_config.set('NO_PERL', '')
+else
+ libgit_c_args += '-DNO_PERL'
+ build_options_config.set('NO_PERL', '1')
+endif
+
+zlib = dependency('zlib', default_options: ['default_library=static', 'tests=disabled'])
+if zlib.type_name() != 'internal' and not compiler.has_function('deflateBound',
+ prefix: '#include <zlib.h>',
+ dependencies: zlib,
+)
+ libgit_c_args += '-DNO_DEFLATE_BOUND'
+endif
+libgit_dependencies += zlib
+
+threads = dependency('threads', required: false)
+if threads.found()
+ libgit_dependencies += threads
+ build_options_config.set('NO_PTHREADS', '')
+else
+ libgit_c_args += '-DNO_PTHREADS'
+ build_options_config.set('NO_PTHREADS', '1')
+endif
+
+if get_option('gettext').allowed() and host_machine.system() == 'darwin' and get_option('macos_use_homebrew_gettext')
+ if host_machine.cpu_family() == 'x86_64'
+ libintl_prefix = '/usr/local'
+ elif host_machine.cpu_family() == 'aarch64'
+ libintl_prefix = '/opt/homebrew'
+ else
+ error('Homebrew workaround not supported on current architecture')
+ endif
+
+ intl = compiler.find_library('intl', dirs: libintl_prefix / 'lib', required: get_option('gettext'))
+ if intl.found()
+ intl = declare_dependency(
+ dependencies: intl,
+ include_directories: libintl_prefix / 'include',
+ )
+ endif
+else
+ intl = dependency('intl', required: get_option('gettext'))
+endif
+if intl.found()
+ libgit_dependencies += intl
+ build_options_config.set('NO_GETTEXT', '')
+else
+ libgit_c_args += '-DNO_GETTEXT'
+ build_options_config.set('NO_GETTEXT', '1')
+endif
+
+iconv = dependency('iconv', required: get_option('iconv'))
+if iconv.found()
+ libgit_dependencies += iconv
+ build_options_config.set('NO_ICONV', '')
+
+ have_old_iconv = false
+ if not compiler.compiles('''
+ #include <iconv.h>
+
+ extern size_t iconv(iconv_t cd,
+ char **inbuf, size_t *inbytesleft,
+ char **outbuf, size_t *outbytesleft);
+ ''', name: 'old iconv interface', dependencies: [iconv])
+ libgit_c_args += '-DOLD_ICONV'
+ have_old_iconv = true
+ endif
+
+ iconv_omits_bom_source = '''#
+ #include <iconv.h>
+
+ int main(int argc, const char **argv)
+ {
+ '''
+ if have_old_iconv
+ iconv_omits_bom_source += '''
+ typedef const char *iconv_ibp;
+ '''
+ else
+ iconv_omits_bom_source += '''
+ typedef char *iconv_ibp;
+ '''
+ endif
+ iconv_omits_bom_source += '''
+ int v;
+ iconv_t conv;
+ char in[] = "a"; iconv_ibp pin = in;
+ char out[20] = ""; char *pout = out;
+ size_t isz = sizeof in;
+ size_t osz = sizeof out;
+
+ conv = iconv_open("UTF-16", "UTF-8");
+ iconv(conv, &pin, &isz, &pout, &osz);
+ iconv_close(conv);
+ v = (unsigned char)(out[0]) + (unsigned char)(out[1]);
+ return v != 0xfe + 0xff;
+ }
+ '''
+
+ if compiler.run(iconv_omits_bom_source,
+ dependencies: iconv,
+ name: 'iconv omits BOM',
+ ).returncode() != 0
+ libgit_c_args += '-DICONV_OMITS_BOM'
+ endif
+else
+ libgit_c_args += '-DNO_ICONV'
+ build_options_config.set('NO_ICONV', '1')
+endif
+
+pcre2 = dependency('libpcre2-8', required: get_option('pcre2'), default_options: ['default_library=static', 'test=false'])
+if pcre2.found()
+ libgit_dependencies += pcre2
+ libgit_c_args += '-DUSE_LIBPCRE2'
+ build_options_config.set('USE_LIBPCRE2', '1')
+else
+ build_options_config.set('USE_LIBPCRE2', '')
+endif
+
+curl = dependency('libcurl', version: '>=7.21.3', required: get_option('curl'), default_options: ['default_library=static', 'tests=disabled'])
+use_curl_for_imap_send = false
+if curl.found()
+ if curl.version().version_compare('>=7.34.0')
+ libgit_c_args += '-DUSE_CURL_FOR_IMAP_SEND'
+ use_curl_for_imap_send = true
+ endif
+
+ libgit_dependencies += curl
+ libgit_c_args += '-DCURL_DISABLE_TYPECHECK'
+ build_options_config.set('NO_CURL', '')
+else
+ libgit_c_args += '-DNO_CURL'
+ build_options_config.set('NO_CURL', '1')
+endif
+
+expat = dependency('expat', required: get_option('expat'), default_options: ['default_library=static', 'build_tests=false'])
+if expat.found()
+ libgit_dependencies += expat
+
+ if expat.version().version_compare('<=1.2')
+ libgit_c_args += '-DEXPAT_NEEDS_XMLPARSE_H'
+ endif
+ build_options_config.set('NO_EXPAT', '')
+else
+ libgit_c_args += '-DNO_EXPAT'
+ build_options_config.set('NO_EXPAT', '1')
+endif
+
+if not compiler.has_header('sys/select.h')
+ libgit_c_args += '-DNO_SYS_SELECT_H'
+endif
+
+has_poll_h = compiler.has_header('poll.h')
+if not has_poll_h
+ libgit_c_args += '-DNO_POLL_H'
+endif
+
+has_sys_poll_h = compiler.has_header('sys/poll.h')
+if not has_sys_poll_h
+ libgit_c_args += '-DNO_SYS_POLL_H'
+endif
+
+if not has_poll_h and not has_sys_poll_h
+ libgit_c_args += '-DNO_POLL'
+ libgit_sources += 'compat/poll/poll.c'
+ libgit_include_directories += 'compat/poll'
+endif
+
+if not compiler.has_header('inttypes.h')
+ libgit_c_args += '-DNO_INTTYPES_H'
+endif
+
+if compiler.has_header('libcharset.h')
+ libcharset = compiler.find_library('charset')
+
+ if compiler.has_function('locale_charset',
+ prefix: '#include <libcharset.h>',
+ dependencies: iconv,
+ )
+ libgit_c_args += '-DHAVE_LIBCHARSET_H'
+ elif compiler.has_function('locale_charset',
+ prefix: '#include <libcharset.h>',
+ dependencies: libcharset,
+ )
+ libgit_c_args += '-DHAVE_LIBCHARSET_H'
+ endif
+endif
+
+if compiler.has_header('alloca.h')
+ libgit_c_args += '-DHAVE_ALLOCA_H'
+endif
+
+if compiler.has_header('sys/sysinfo.h')
+ libgit_c_args += '-DHAVE_SYSINFO'
+endif
+
+# Windows has libgen.h and a basename implementation, but we still need our own
+# implementation to threat things like drive prefixes specially.
+if host_machine.system() == 'windows' or not compiler.has_header('libgen.h')
+ libgit_c_args += '-DNO_LIBGEN_H'
+ libgit_sources += 'compat/basename.c'
+endif
+
+if compiler.has_header('paths.h')
+ libgit_c_args += '-DHAVE_PATHS_H'
+endif
+
+if compiler.has_header('strings.h')
+ libgit_c_args += '-DHAVE_STRINGS_H'
+endif
+
+networking_dependencies = [ ]
+if host_machine.system() == 'windows'
+ winsock = compiler.find_library('ws2_32', required: false)
+ if winsock.found()
+ networking_dependencies += winsock
+ endif
+else
+ libresolv = compiler.find_library('resolv', required: false)
+ if libresolv.found()
+ networking_dependencies += libresolv
+ endif
+endif
+libgit_dependencies += networking_dependencies
+
+foreach symbol : ['inet_ntop', 'inet_pton', 'strerror']
+ if not compiler.has_function(symbol, dependencies: networking_dependencies)
+ libgit_c_args += '-DNO_' + symbol.to_upper()
+ endif
+endforeach
+
+has_ipv6 = compiler.has_function('getaddrinfo', dependencies: networking_dependencies)
+if not has_ipv6
+ libgit_c_args += '-DNO_IPV6'
+endif
+
+if not compiler.compiles('''
+ #ifdef _WIN32
+ # include <winsock2.h>
+ #else
+ # include <sys/types.h>
+ # include <sys/socket.h>
+ #endif
+
+ void func(void)
+ {
+ struct sockaddr_storage x;
+ }
+''', name: 'struct sockaddr_storage')
+ if has_ipv6
+ libgit_c_args += '-Dsockaddr_storage=sockaddr_in6'
+ else
+ libgit_c_args += '-Dsockaddr_storage=sockaddr_in'
+ endif
+endif
+
+if compiler.has_function('socket', dependencies: networking_dependencies)
+ libgit_sources += [
+ 'unix-socket.c',
+ 'unix-stream-server.c',
+ ]
+ build_options_config.set('NO_UNIX_SOCKETS', '')
+else
+ libgit_c_args += '-DNO_UNIX_SOCKETS'
+ build_options_config.set('NO_UNIX_SOCKETS', '1')
+endif
+
+if not compiler.has_function('pread')
+ libgit_c_args += '-DNO_PREAD'
+ libgit_sources += 'compat/pread.c'
+endif
+
+if host_machine.system() == 'darwin'
+ libgit_sources += 'compat/precompose_utf8.c'
+ libgit_c_args += '-DPRECOMPOSE_UNICODE'
+ libgit_c_args += '-DPROTECT_HFS_DEFAULT'
+endif
+
+# Configure general compatibility wrappers.
+if host_machine.system() == 'cygwin'
+ libgit_sources += [
+ 'compat/win32/path-utils.c',
+ ]
+elif host_machine.system() == 'windows'
+ libgit_sources += [
+ 'compat/mingw.c',
+ 'compat/winansi.c',
+ 'compat/win32/flush.c',
+ 'compat/win32/path-utils.c',
+ 'compat/win32/pthread.c',
+ 'compat/win32/syslog.c',
+ 'compat/win32/dirent.c',
+ 'compat/win32mmap.c',
+ 'compat/nedmalloc/nedmalloc.c',
+ ]
+
+ libgit_c_args += [
+ '-DDETECT_MSYS_TTY',
+ '-DENSURE_MSYSTEM_IS_SET',
+ '-DNATIVE_CRLF',
+ '-DNOGDI',
+ '-DNO_POSIX_GOODIES',
+ '-DWIN32',
+ '-D_CONSOLE',
+ '-D_CONSOLE_DETECT_MSYS_TTY',
+ '-D__USE_MINGW_ANSI_STDIO=0',
+ ]
+
+ libgit_dependencies += compiler.find_library('ntdll')
+ libgit_include_directories += 'compat/win32'
+ if compiler.get_id() == 'msvc'
+ libgit_include_directories += 'compat/vcbuild/include'
+ endif
+endif
+
+if host_machine.system() == 'linux'
+ libgit_sources += 'compat/linux/procinfo.c'
+elif host_machine.system() == 'windows'
+ libgit_sources += 'compat/win32/trace2_win32_process_info.c'
+else
+ libgit_sources += 'compat/stub/procinfo.c'
+endif
+
+if host_machine.system() == 'cygwin' or host_machine.system() == 'windows'
+ libgit_c_args += [
+ '-DUNRELIABLE_FSTAT',
+ '-DMMAP_PREVENTS_DELETE',
+ '-DOBJECT_CREATION_MODE=1',
+ ]
+endif
+
+# Configure the simple-ipc subsystem required fro the fsmonitor.
+if host_machine.system() == 'windows'
+ libgit_sources += [
+ 'compat/simple-ipc/ipc-shared.c',
+ 'compat/simple-ipc/ipc-win32.c',
+ ]
+ libgit_c_args += '-DSUPPORTS_SIMPLE_IPC'
+else
+ libgit_sources += [
+ 'compat/simple-ipc/ipc-shared.c',
+ 'compat/simple-ipc/ipc-unix-socket.c',
+ ]
+ libgit_c_args += '-DSUPPORTS_SIMPLE_IPC'
+endif
+
+fsmonitor_backend = ''
+if host_machine.system() == 'windows'
+ fsmonitor_backend = 'win32'
+elif host_machine.system() == 'darwin'
+ fsmonitor_backend = 'darwin'
+ libgit_dependencies += dependency('CoreServices')
+endif
+if fsmonitor_backend != ''
+ libgit_c_args += '-DHAVE_FSMONITOR_DAEMON_BACKEND'
+ libgit_c_args += '-DHAVE_FSMONITOR_OS_SETTINGS'
+
+ libgit_sources += [
+ 'compat/fsmonitor/fsm-health-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-ipc-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-listen-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-path-utils-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-settings-' + fsmonitor_backend + '.c',
+ ]
+endif
+build_options_config.set_quoted('FSMONITOR_DAEMON_BACKEND', fsmonitor_backend)
+build_options_config.set_quoted('FSMONITOR_OS_SETTINGS', fsmonitor_backend)
+
+if compiler.has_header('regex.h') and compiler.get_define('REG_STARTEND', prefix: '#include <regex.h>') != ''
+ build_options_config.set('NO_REGEX', '')
+
+ if compiler.get_define('REG_ENHANCED', prefix: '#include <regex.h>') != ''
+ libgit_c_args += '-DUSE_ENHANCED_BASIC_REGULAR_EXPRESSIONS'
+ libgit_sources += 'compat/regcomp_enhanced.c'
+ endif
+else
+ libgit_c_args += [
+ '-DNO_REGEX',
+ '-DGAWK',
+ '-DNO_MBSUPPORT',
+ ]
+ build_options_config.set('NO_REGEX', '1')
+ libgit_sources += 'compat/regex/regex.c'
+ libgit_include_directories += 'compat/regex'
+endif
+
+# setitimer and friends are provided by compat/mingw.c.
+if host_machine.system() != 'windows'
+ if not compiler.compiles('''
+ #include <sys/time.h>
+ void func(void)
+ {
+ struct itimerval value;
+ }
+ ''', name: 'struct itimerval')
+ libgit_c_args += '-DNO_STRUCT_ITIMERVAL'
+ libgit_c_args += '-DNO_SETITIMER'
+ elif not compiler.has_function('setitimer')
+ libgit_c_args += '-DNO_SETITIMER'
+ endif
+endif
+
+if compiler.has_member('struct stat', 'st_mtimespec.tv_nsec', prefix: '#include <sys/stat.h>')
+ libgit_c_args += '-DUSE_ST_TIMESPEC'
+elif not compiler.has_member('struct stat', 'st_mtim.tv_nsec', prefix: '#include <sys/stat.h>')
+ libgit_c_args += '-DNO_NSEC'
+endif
+
+if not compiler.has_member('struct stat', 'st_blocks', prefix: '#include <sys/stat.h>')
+ libgit_c_args += '-DNO_ST_BLOCKS_IN_STRUCT_STAT'
+endif
+
+if not compiler.has_member('struct dirent', 'd_type', prefix: '#include <dirent.h>')
+ libgit_c_args += '-DNO_D_TYPE_IN_DIRENT'
+endif
+
+if not compiler.has_member('struct passwd', 'pw_gecos', prefix: '#include <pwd.h>')
+ libgit_c_args += '-DNO_GECOS_IN_PWENT'
+endif
+
+if compiler.has_function('sync_file_range')
+ libgit_c_args += '-DHAVE_SYNC_FILE_RANGE'
+endif
+
+if not compiler.has_function('strcasestr')
+ libgit_c_args += '-DNO_STRCASESTR'
+ libgit_sources += 'compat/strcasestr.c'
+endif
+
+if not compiler.has_function('memmem')
+ libgit_c_args += '-DNO_MEMMEM'
+ libgit_sources += 'compat/memmem.c'
+endif
+
+if not compiler.has_function('strlcpy')
+ libgit_c_args += '-DNO_STRLCPY'
+ libgit_sources += 'compat/strlcpy.c'
+endif
+
+if not compiler.has_function('strdup')
+ libgit_c_args += '-DOVERRIDE_STRDUP'
+ libgit_sources += 'compat/strdup.c'
+endif
+
+if not compiler.has_function('strtoumax')
+ libgit_c_args += '-DNO_STRTOUMAX'
+ libgit_sources += [
+ 'compat/strtoumax.c',
+ 'compat/strtoimax.c',
+ ]
+endif
+
+if not compiler.has_function('strtoull')
+ libgit_c_args += '-DNO_STRTOULL'
+endif
+
+if not compiler.has_function('setenv')
+ libgit_c_args += '-DNO_SETENV'
+ libgit_sources += 'compat/setenv.c'
+endif
+
+if not compiler.has_function('qsort')
+ libgit_c_args += '-DINTERNAL_QSORT'
+endif
+libgit_sources += 'compat/qsort_s.c'
+
+# unsetenv is provided by compat/mingw.c.
+if host_machine.system() != 'windows' and not compiler.has_function('unsetenv')
+ libgit_c_args += '-DNO_UNSETENV'
+ libgit_sources += 'compat/unsetenv.c'
+endif
+
+if not compiler.has_function('mkdtemp')
+ libgit_c_args += '-DNO_MKDTEMP'
+ libgit_sources += 'compat/mkdtemp.c'
+endif
+
+if not compiler.has_function('initgroups')
+ libgit_c_args += '-DNO_INITGROUPS'
+endif
+
+if compiler.has_function('getdelim')
+ libgit_c_args += '-DHAVE_GETDELIM'
+endif
+
+if host_machine.system() == 'windows'
+ libgit_c_args += '-DUSE_WIN32_MMAP'
+elif not compiler.has_function('mmap')
+ libgit_c_args += '-DNO_MMAP'
+ libgit_sources += 'compat/mmap.c'
+endif
+
+if compiler.has_function('clock_gettime')
+ libgit_c_args += '-DHAVE_CLOCK_GETTIME'
+endif
+
+if compiler.compiles('''
+ #include <time.h>
+
+ void func(void)
+ {
+ clockid_t id = CLOCK_MONOTONIC;
+ }
+''', name: 'monotonic clock')
+ libgit_c_args += '-DHAVE_CLOCK_MONOTONIC'
+endif
+
+if compiler.compiles('''
+ #include <inttypes.h>
+
+ void func(void)
+ {
+ uintmax_t x = 0;
+ }
+''', name: 'uintmax_t')
+ libgit_c_args += '-DNO_UINTMAX_T'
+endif
+
+has_bsd_sysctl = false
+if compiler.has_header('sys/sysctl.h')
+ if compiler.compiles('''
+ #include <stddef.h>
+ #include <sys/sysctl.h>
+
+ void func(void)
+ {
+ int val, mib[2] = { 0 };
+ size_t len = sizeof(val);
+ sysctl(mib, 2, &val, &len, NULL, 0);
+ }
+ ''', name: 'BSD sysctl')
+ libgit_c_args += '-DHAVE_BSD_SYSCTL'
+ has_bsd_sysctl = true
+ endif
+endif
+
+if compiler.run('''
+ #include <stdio.h>
+
+ int main(int argc, const char **argv)
+ {
+ FILE *f = fopen(".", "r");
+ return f ? 0 : 1;
+ }
+''', name: 'fread reads directories').returncode() == 0
+ libgit_c_args += '-DFREAD_READS_DIRECTORIES'
+ libgit_sources += 'compat/fopen.c'
+endif
+
+if not meson.is_cross_build() and fs.exists('/dev/tty')
+ libgit_c_args += '-DHAVE_DEV_TTY'
+endif
+
+if get_option('openssl').enabled() and get_option('CommonCrypto').enabled()
+ error('Can only use one SSL backend')
+endif
+
+security_framework = dependency('Security', required: get_option('CommonCrypto').disable_auto_if(host_machine.system() != 'darwin'))
+core_foundation_framework = dependency('CoreFoundation', required: security_framework.found())
+if security_framework.found()
+ libgit_dependencies += security_framework
+ libgit_dependencies += core_foundation_framework
+ libgit_c_args += '-DAPPLE_COMMON_CRYPTO'
+endif
+
+# OpenSSL is required when requested via the 'openssl' feature or via one of
+# the SHA1/SHA256 backends.
+openssl_required = get_option('openssl').disable_auto_if(security_framework.found())
+if get_option('sha1_backend') == 'openssl' or get_option('sha256_backend') == 'openssl'
+ openssl_required = true
+endif
+
+openssl = dependency('openssl', required: openssl_required, default_options: ['default_library=static'])
+if openssl.found()
+ libgit_dependencies += openssl
+endif
+
+# We may not want to use OpenSSL for anything but our SHA1/SHA256 backends, so
+# we cannot just set NO_OPENSSL based on whether or not the library was found.
+if not openssl.found() or get_option('openssl').disabled()
+ libgit_c_args += '-DNO_OPENSSL'
+endif
+
+sha1_backend = get_option('sha1_backend')
+if sha1_backend == 'sha1dc'
+ libgit_c_args += '-DSHA1_DC'
+ libgit_c_args += '-DSHA1DC_NO_STANDARD_INCLUDES=1'
+ libgit_c_args += '-DSHA1DC_INIT_SAFE_HASH_DEFAULT=0'
+ libgit_c_args += '-DSHA1DC_CUSTOM_INCLUDE_SHA1_C="git-compat-util.h"'
+ libgit_c_args += '-DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="git-compat-util.h"'
+
+ libgit_sources += [
+ 'sha1dc_git.c',
+ 'sha1dc/sha1.c',
+ 'sha1dc/ubc_check.c',
+ ]
+elif sha1_backend == 'common-crypto'
+ libgit_c_args += '-DCOMMON_DIGEST_FOR_OPENSSL'
+ libgit_c_args += '-DSHA1_APPLE'
+ libgit_c_args += '-DSHA1_MAX_BLOCK_SIZE=1024L*1024L*1024L'
+elif sha1_backend == 'openssl'
+ if not openssl.found()
+ openssl = dependency('openssl', required: true)
+ endif
+
+ libgit_c_args += '-DSHA1_OPENSSL'
+ # Apple CommonCrypto requires chunking
+elif sha1_backend == 'block'
+ libgit_c_args += '-DSHA1_BLK'
+ libgit_sources += 'block-sha1/sha1.c'
+else
+ error('Unhandled SHA1 backend ' + sha1_backend)
+endif
+
+sha256_backend = get_option('sha256_backend')
+if sha256_backend == 'openssl'
+ libgit_c_args += '-DSHA256_OPENSSL'
+elif sha256_backend == 'nettle'
+ nettle = dependency('nettle')
+ libgit_dependencies += nettle
+ libgit_c_args += '-DSHA256_NETTLE'
+elif sha256_backend == 'gcrypt'
+ gcrypt = dependency('gcrypt')
+ libgit_dependencies += gcrypt
+ libgit_c_args += '-DSHA256_GCRYPT'
+elif sha256_backend == 'block'
+ libgit_c_args += '-DSHA256_BLK'
+ libgit_sources += 'sha256/block/sha256.c'
+else
+ error('Unhandled SHA256 backend ' + sha256_backend)
+endif
+
+if compiler.has_header_symbol('stdlib.h', 'arc4random_buf')
+ libgit_c_args += '-DHAVE_ARC4RANDOM'
+elif compiler.has_header_symbol('bsd/stdlib.h', 'arc4random_buf')
+ libgit_c_args += '-DHAVE_ARC4RANDOM_BSD'
+elif compiler.has_function('getrandom', prefix: '#include <sys/random.h>')
+ libgit_c_args += '-DHAVE_GETRANDOM'
+elif compiler.has_function('getentropy', prefix: '#include <unistd.h>')
+ libgit_c_args += '-DHAVE_GETENTROPY'
+elif compiler.has_function('RtlGenRandom', prefix: '#include <windows.h>\n#include <ntsecapi.h>')
+ libgit_c_args += '-DHAVE_RTLGENRANDOM'
+elif openssl.found()
+ libgit_c_args += '-DHAVE_OPENSSL_CSPRNG'
+endif
+
+if get_option('runtime_prefix')
+ libgit_c_args += '-DRUNTIME_PREFIX'
+ build_options_config.set('RUNTIME_PREFIX', '1')
+
+ if compiler.has_header('mach-o/dyld.h')
+ libgit_c_args += '-DHAVE_NS_GET_EXECUTABLE_PATH'
+ endif
+
+ if has_bsd_sysctl and compiler.compiles('''
+ #include <sys/sysctl.h>
+
+ void func(void)
+ {
+ KERN_PROC_PATHNAME; KERN_PROC;
+ }
+ ''', name: 'BSD KERN_PROC_PATHNAME')
+ libgit_c_args += '-DHAVE_NS_GET_EXECUTABLE_PATH'
+ endif
+
+ if host_machine.system() == 'linux'
+ libgit_c_args += '-DPROCFS_EXECUTABLE_PATH="/proc/self/exe' + '"'
+ elif host_machine.system() == 'openbsd'
+ libgit_c_args += '-DPROCFS_EXECUTABLE_PATH="' + '/proc/curproc/file' + '"'
+ elif host_machine.system() == 'netbsd'
+ libgit_c_args += '-DPROCFS_EXECUTABLE_PATH="' + '/proc/curproc/exe' + '"'
+ endif
+
+ if host_machine.system() == 'windows' and compiler.compiles('''
+ #include <stdlib.h>
+
+ void func(void)
+ {
+ _wpgmptr;
+ }
+ ''', name: 'Win32 _wpgmptr')
+ libgit_c_args += '-DHAVE_WPGMPTR'
+ endif
+else
+ build_options_config.set('RUNTIME_PREFIX', '')
+endif
+
+foreach key, value : {
+ 'DIFF': diff.full_path(),
+ 'GIT_TEST_CMP': diff.full_path() + ' -u',
+ 'GIT_TEST_GITPERLLIB': meson.project_build_root() / 'perl',
+ 'GIT_TEST_MERGE_TOOLS_DIR': meson.project_source_root() / 'mergetools',
+ 'GIT_TEST_POPATH': meson.project_source_root() / 'po',
+ 'GIT_TEST_TEMPLATE_DIR': meson.project_build_root() / 'templates',
+ 'GIT_TEST_TEXTDOMAINDIR': meson.project_build_root() / 'po',
+ 'PAGER_ENV': get_option('pager_environment'),
+ 'PERL_PATH': perl.found() ? perl.full_path() : '',
+ 'PYTHON_PATH': python.found () ? python.full_path() : '',
+ 'SHELL_PATH': shell.full_path(),
+ 'TAR': tar.full_path(),
+ 'TEST_OUTPUT_DIRECTORY': test_output_directory,
+ 'TEST_SHELL_PATH': shell.full_path(),
+}
+ if value != '' and cygpath.found()
+ value = run_command(cygpath, value, check: true).stdout().strip()
+ endif
+ build_options_config.set_quoted(key, value)
+endforeach
+
+configure_file(
+ input: 'GIT-BUILD-OPTIONS.in',
+ output: 'GIT-BUILD-OPTIONS',
+ configuration: build_options_config,
+)
+
+# Build a separate library for "version.c" so that we do not have to rebuild
+# everything when the current Git commit changes. TODO: this only gets set up
+# at configuration time, so we do not notice version changes unless the build
+# instructions get regenerated. We should refactor the source file such that we
+# can substitute tags in the file via `vcs_tag()`.
+libgit_version_library = static_library('git-version',
+ sources: ['version.c'],
+ c_args: libgit_c_args + [
+ '-DGIT_VERSION="' + meson.project_version() + '"',
+ '-DGIT_USER_AGENT="' + 'git/' + meson.project_version() + '"',
+ '-DGIT_BUILT_FROM_COMMIT="' + run_command('git', 'rev-parse', '-q', '--verify', 'HEAD', check: false).stdout().strip() + '"',
+ ],
+ dependencies: libgit_dependencies,
+ include_directories: libgit_include_directories,
+)
+
+libgit_library = static_library('git',
+ sources: libgit_sources,
+ c_args: libgit_c_args,
+ link_with: libgit_version_library,
+ dependencies: libgit_dependencies,
+ include_directories: libgit_include_directories,
+)
+
+libgit = declare_dependency(
+ compile_args: libgit_c_args,
+ link_with: libgit_library,
+ dependencies: libgit_dependencies,
+ include_directories: libgit_include_directories,
+)
+
+common_main_sources = ['common-main.c']
+common_main_link_args = [ ]
+if host_machine.system() == 'windows'
+ # TODO: wire these up properly.
+ common_main_sources += import('windows').compile_resources('git.rc', args: [
+ '-DMAJOR=1',
+ '-DMINOR=1',
+ '-DMICRO=1',
+ '-DPATCHLEVEL=0',
+ '-DGIT_VERSION=\\\"' + meson.project_version() + '.GIT\\\"',
+ ])
+ if compiler.get_argument_syntax() == 'gcc'
+ common_main_link_args += [
+ '-municode',
+ '-Wl,-nxcompat',
+ '-Wl,-dynamicbase',
+ '-Wl,-pic-executable,-e,mainCRTStartup',
+ ]
+ elif compiler.get_argument_syntax() == 'msvc'
+ common_main_link_args += [
+ '/ENTRY:wmainCRTStartup',
+ 'invalidcontinue.obj',
+ ]
+ else
+ error('Unsupported compiler ' + compiler.get_id())
+ endif
+endif
+common_main_library = static_library('common-main',
+ 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,
+ link_args: common_main_link_args,
+)
+
+bin_wrappers = [ ]
+test_dependencies = [ ]
+
+git = executable('git',
+ sources: builtin_sources + 'git.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+bin_wrappers += git
+
+test_dependencies += executable('git-daemon',
+ sources: 'daemon.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+test_dependencies += executable('git-sh-i18n--envsubst',
+ sources: 'sh-i18n--envsubst.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+bin_wrappers += executable('git-shell',
+ sources: 'shell.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+test_dependencies += executable('git-http-backend',
+ sources: 'http-backend.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+bin_wrappers += executable('scalar',
+ sources: 'scalar.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+if get_option('curl').enabled()
+ curl_sources = [
+ 'http.c',
+ 'http-walker.c',
+ ]
+
+ git_remote_http = executable('git-remote-http',
+ sources: curl_sources + 'remote-curl.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+ test_dependencies += git_remote_http
+
+ test_dependencies += executable('git-http-fetch',
+ sources: curl_sources + 'http-fetch.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+
+ if expat.found()
+ test_dependencies += executable('git-http-push',
+ sources: curl_sources + 'http-push.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+ endif
+
+ 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, common_main],
+ )
+
+ install_symlink(alias + executable_suffix,
+ install_dir: get_option('libexecdir') / 'git-core',
+ pointing_to: 'git-remote-http',
+ )
+ endforeach
+endif
+
+imap_send_sources = ['imap-send.c']
+if use_curl_for_imap_send
+ imap_send_sources += curl_sources
+endif
+
+test_dependencies += executable('git-imap-send',
+ sources: imap_send_sources,
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+foreach alias : [ 'git-receive-pack', 'git-upload-archive', 'git-upload-pack' ]
+ bin_wrappers += executable(alias,
+ objects: git.extract_all_objects(recursive: false),
+ dependencies: [libgit, common_main],
+ )
+
+ install_symlink(alias + executable_suffix,
+ install_dir: get_option('libexecdir') / 'git-core',
+ pointing_to: 'git-remote-http',
+ )
+endforeach
+
+foreach symlink : [
+ 'git',
+ 'git-http-backend',
+ 'git-receive-pack',
+ 'git-shell',
+ 'git-upload-archive',
+ 'git-upload-pack',
+ 'scalar',
+]
+ install_symlink(symlink,
+ install_dir: get_option('bindir'),
+ pointing_to: fs.relative_to(get_option('libexecdir') / 'git-core' / symlink, get_option('bindir')),
+ )
+endforeach
+
+script_sh_config = configuration_data()
+script_sh_config.set('BROKEN_PATH_FIX', '')
+script_sh_config.set('DIFF', fs.as_posix(diff.full_path()))
+script_sh_config.set('PAGER_ENV', get_option('pager_environment'))
+script_sh_config.set('PERL_PATH', perl.found() ? fs.as_posix(perl.full_path()) : '')
+script_sh_config.set('SHELL_PATH', fs.as_posix(shell.full_path()))
+script_sh_config.set_quoted('LOCALEDIR', fs.as_posix(get_option('prefix') / get_option('localedir')))
+if intl.found()
+ script_sh_config.set('USE_GETTEXT_SCHEME', '')
+else
+ script_sh_config.set('USE_GETTEXT_SCHEME', 'fallthrough')
+endif
+script_sh_config.set('GITWEBDIR', fs.as_posix(get_option('prefix') / get_option('datadir') / 'gitweb'))
+
+scripts_sh = [
+ 'git-difftool--helper.sh',
+ 'git-filter-branch.sh',
+ 'git-merge-octopus.sh',
+ 'git-merge-one-file.sh',
+ 'git-merge-resolve.sh',
+ 'git-mergetool.sh',
+ 'git-quiltimport.sh',
+ 'git-request-pull.sh',
+ 'git-submodule.sh',
+ 'git-web--browse.sh',
+]
+
+if perl_features_enabled
+ scripts_sh += 'git-instaweb.sh'
+endif
+
+foreach script : scripts_sh
+ configure_file(
+ input: script,
+ output: fs.stem(script),
+ configuration: script_sh_config,
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+endforeach
+
+scripts_lib = [
+ 'git-mergetool--lib.sh',
+ 'git-sh-i18n.sh',
+ 'git-sh-setup.sh',
+]
+
+foreach script : scripts_lib
+ configure_file(
+ input: script,
+ output: fs.stem(script),
+ configuration: script_sh_config,
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+endforeach
+
+if perl_features_enabled
+ scripts_perl = [
+ 'git-archimport.perl',
+ 'git-cvsexportcommit.perl',
+ 'git-cvsimport.perl',
+ 'git-cvsserver.perl',
+ 'git-send-email.perl',
+ 'git-svn.perl',
+ ]
+
+ pathsep = ':'
+ if host_machine.system() == 'windows'
+ pathsep = ';'
+ endif
+
+ perl_header_template = 'perl/header_templates/fixed_prefix.template.pl'
+ if get_option('runtime_prefix')
+ perl_header_template = 'perl/header_templates/runtime_prefix.template.pl'
+ endif
+
+ perl_header = configure_file(
+ input: perl_header_template,
+ output: 'GIT-PERL-HEADER',
+ configuration: {
+ 'GITEXECDIR_REL': get_option('libexecdir') / 'git-core',
+ 'PERLLIBDIR_REL': get_option('datadir') / 'perl5',
+ 'LOCALEDIR_REL': get_option('datadir') / 'locale',
+ 'INSTLIBDIR': get_option('datadir') / 'perl5',
+ 'PATHSEP': pathsep,
+ },
+ )
+
+ foreach script : scripts_perl
+ generated_script = custom_target(script,
+ input: script,
+ output: fs.stem(script),
+ command: [
+ shell,
+ meson.project_source_root() / 'generate-perl.sh',
+ meson.project_version(),
+ perl_header,
+ perl.full_path(),
+ '@INPUT@',
+ '@OUTPUT@',
+ ],
+ install: true,
+ install_dir: get_option('datadir') / 'perl5',
+ )
+ test_dependencies += generated_script
+ if script == 'git-cvsserver.perl'
+ bin_wrappers += generated_script
+ endif
+ endforeach
+
+ subdir('perl')
+endif
+
+if python.found()
+ scripts_python = [
+ 'git-p4.py'
+ ]
+
+ foreach script : scripts_python
+ fs.copyfile(script, fs.stem(script),
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+ endforeach
+endif
+
+mergetools = [
+ 'mergetools/araxis',
+ 'mergetools/bc',
+ 'mergetools/codecompare',
+ 'mergetools/deltawalker',
+ 'mergetools/diffmerge',
+ 'mergetools/diffuse',
+ 'mergetools/ecmerge',
+ 'mergetools/emerge',
+ 'mergetools/examdiff',
+ 'mergetools/guiffy',
+ 'mergetools/gvimdiff',
+ 'mergetools/kdiff3',
+ 'mergetools/kompare',
+ 'mergetools/meld',
+ 'mergetools/nvimdiff',
+ 'mergetools/opendiff',
+ 'mergetools/p4merge',
+ 'mergetools/smerge',
+ 'mergetools/tkdiff',
+ 'mergetools/tortoisemerge',
+ 'mergetools/vimdiff',
+ 'mergetools/vscode',
+ 'mergetools/winmerge',
+ 'mergetools/xxdiff',
+]
+
+foreach mergetool : mergetools
+ install_data(mergetool, install_dir: get_option('libexecdir') / 'git-core' / 'mergetools')
+endforeach
+
+if intl.found()
+ subdir('po')
+endif
+subdir('contrib')
+subdir('gitweb')
+subdir('templates')
+
+# Everything but the bin-wrappers need to come before this target such that we
+# can properly set up test dependencies. The bin-wrappers themselves are set up
+# at configuration time, so these are fine.
+if get_option('tests')
+ subdir('t')
+endif
+
+subdir('bin-wrappers')
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 00000000000..22e85a1756e
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,70 @@
+option('default_help_format', type: 'combo', choices: ['man', 'html', 'info'], value: 'man',
+ description: 'Format of installed documentation.')
+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('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('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: 'enabled',
+ description: 'Build translation files.')
+option('iconv', type: 'feature', value: 'enabled',
+ 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: 'enabled',
+ description: 'Build tools written in Perl.')
+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('python', type: 'feature', value: 'enabled',
+ description: 'Build tools written in Python.')
+
+option('openssl', type: 'feature', value: 'auto',
+ description: 'Support access to HTTPS remotes. OpenSSL may still be pulled in if configured as SHA1 or SHA256 backend.')
+option('CommonCrypto', type: 'feature', value: 'auto',
+ description: 'Build tools written in Python.')
+
+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')
+
+option('macos_use_homebrew_gettext', type: 'boolean', value: true,
+ description: 'Use gettext from Homebrew instead of the slightly-broken system-provided one.')
+
+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')
+
+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')
diff --git a/perl/FromCPAN/Mail/meson.build b/perl/FromCPAN/Mail/meson.build
new file mode 100644
index 00000000000..8cbd90ce184
--- /dev/null
+++ b/perl/FromCPAN/Mail/meson.build
@@ -0,0 +1,7 @@
+configure_file(
+ input: 'Address.pm',
+ output: 'Address.pm',
+ configuration: perl_config,
+ install: true,
+ install_dir: get_option('datadir') / 'perl5/FromCPAN/Mail',
+)
diff --git a/perl/FromCPAN/meson.build b/perl/FromCPAN/meson.build
new file mode 100644
index 00000000000..ff88b35c2ca
--- /dev/null
+++ b/perl/FromCPAN/meson.build
@@ -0,0 +1,9 @@
+configure_file(
+ input: 'Error.pm',
+ output: 'Error.pm',
+ configuration: perl_config,
+ install: true,
+ install_dir: get_option('datadir') / 'perl5/FromCPAN',
+)
+
+subdir('Mail')
diff --git a/perl/Git/LoadCPAN/Mail/meson.build b/perl/Git/LoadCPAN/Mail/meson.build
new file mode 100644
index 00000000000..fbf324307bf
--- /dev/null
+++ b/perl/Git/LoadCPAN/Mail/meson.build
@@ -0,0 +1,7 @@
+configure_file(
+ input: 'Address.pm',
+ output: 'Address.pm',
+ configuration: perl_config,
+ install: true,
+ install_dir: get_option('datadir') / 'perl5/Git/LoadCPAN/Mail',
+)
diff --git a/perl/Git/LoadCPAN/meson.build b/perl/Git/LoadCPAN/meson.build
new file mode 100644
index 00000000000..542e1082252
--- /dev/null
+++ b/perl/Git/LoadCPAN/meson.build
@@ -0,0 +1,9 @@
+configure_file(
+ input: 'Error.pm',
+ output: 'Error.pm',
+ configuration: perl_config,
+ install: true,
+ install_dir: get_option('datadir') / 'perl5/Git/LoadCPAN',
+)
+
+subdir('Mail')
diff --git a/perl/Git/SVN/Memoize/meson.build b/perl/Git/SVN/Memoize/meson.build
new file mode 100644
index 00000000000..727375c8337
--- /dev/null
+++ b/perl/Git/SVN/Memoize/meson.build
@@ -0,0 +1,7 @@
+configure_file(
+ input: 'YAML.pm',
+ output: 'YAML.pm',
+ configuration: perl_config,
+ install: true,
+ install_dir: get_option('datadir') / 'perl5/Git/SVN',
+)
diff --git a/perl/Git/SVN/meson.build b/perl/Git/SVN/meson.build
new file mode 100644
index 00000000000..eccc3f2263d
--- /dev/null
+++ b/perl/Git/SVN/meson.build
@@ -0,0 +1,20 @@
+foreach source : [
+ 'Editor.pm',
+ 'Fetcher.pm',
+ 'GlobSpec.pm',
+ 'Log.pm',
+ 'Migration.pm',
+ 'Prompt.pm',
+ 'Ra.pm',
+ 'Utils.pm',
+]
+ configure_file(
+ input: source,
+ output: source,
+ configuration: perl_config,
+ install: true,
+ install_dir: get_option('datadir') / 'perl5/Git/SVN',
+ )
+endforeach
+
+subdir('Memoize')
diff --git a/perl/Git/meson.build b/perl/Git/meson.build
new file mode 100644
index 00000000000..97bd62290d2
--- /dev/null
+++ b/perl/Git/meson.build
@@ -0,0 +1,18 @@
+foreach source : [
+ 'I18N.pm',
+ 'IndexInfo.pm',
+ 'LoadCPAN.pm',
+ 'Packet.pm',
+ 'SVN.pm',
+]
+ configure_file(
+ input: source,
+ output: source,
+ configuration: perl_config,
+ install: true,
+ install_dir: get_option('datadir') / 'perl5/Git',
+ )
+endforeach
+
+subdir('LoadCPAN')
+subdir('SVN')
diff --git a/perl/meson.build b/perl/meson.build
new file mode 100644
index 00000000000..0a7bf41d5b9
--- /dev/null
+++ b/perl/meson.build
@@ -0,0 +1,18 @@
+perl_config = {
+ 'LOCALEDIR': get_option('prefix') / get_option('datadir') / 'locale',
+ 'NO_GETTEXT': iconv.found() ? '' : '1',
+ 'NO_PERL_CPAN_FALLBACKS': get_option('perl_cpan_fallback') ? '' : '1',
+}
+
+configure_file(
+ input: 'Git.pm',
+ output: 'Git.pm',
+ configuration: perl_config,
+ install: true,
+ install_dir: get_option('datadir') / 'perl5',
+)
+
+subdir('Git')
+if get_option('perl_cpan_fallback')
+ subdir('FromCPAN')
+endif
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 00000000000..fb1b92eb0a2
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1,28 @@
+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,
+ install_dir: get_option('datadir'),
+)
+test_dependencies += translations[0]
diff --git a/subprojects/curl.wrap b/subprojects/curl.wrap
new file mode 100644
index 00000000000..f7e384b85cf
--- /dev/null
+++ b/subprojects/curl.wrap
@@ -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
diff --git a/subprojects/expat.wrap b/subprojects/expat.wrap
new file mode 100644
index 00000000000..2e0427dcfd1
--- /dev/null
+++ b/subprojects/expat.wrap
@@ -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
diff --git a/subprojects/openssl.wrap b/subprojects/openssl.wrap
new file mode 100644
index 00000000000..873d55106e9
--- /dev/null
+++ b/subprojects/openssl.wrap
@@ -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
diff --git a/subprojects/pcre2.wrap b/subprojects/pcre2.wrap
new file mode 100644
index 00000000000..7e184472543
--- /dev/null
+++ b/subprojects/pcre2.wrap
@@ -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
diff --git a/subprojects/zlib.wrap b/subprojects/zlib.wrap
new file mode 100644
index 00000000000..aa14de17740
--- /dev/null
+++ b/subprojects/zlib.wrap
@@ -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
diff --git a/t/helper/meson.build b/t/helper/meson.build
new file mode 100644
index 00000000000..5e83884246e
--- /dev/null
+++ b/t/helper/meson.build
@@ -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
diff --git a/t/meson.build b/t/meson.build
new file mode 100644
index 00000000000..8b1627e9164
--- /dev/null
+++ b/t/meson.build
@@ -0,0 +1,1105 @@
+awk = find_program('awk')
+
+clar_test_suites = [
+ 'unit-tests/ctype.c',
+ 'unit-tests/strvec.c',
+]
+
+clar_sources = [
+ 'unit-tests/clar/clar.c',
+ 'unit-tests/unit-test.c',
+]
+
+clar_decls_h = custom_target('clar_decls_h',
+ input: clar_test_suites,
+ output: 'clar-decls.h',
+ command : [shell, meson.current_source_dir() + '/unit-tests/generate-clar-decls.sh', '@OUTPUT@', '@INPUT@'],
+ env: script_environment,
+)
+clar_sources += clar_decls_h
+
+clar_sources += custom_target('clar_suite',
+ input: clar_decls_h,
+ output: 'clar.suite',
+ feed: true,
+ capture: true,
+ command : [awk, '-f', meson.current_source_dir() + '/unit-tests/clar-generate.awk'],
+)
+
+clar_unit_tests = executable('unit-tests',
+ sources: clar_sources + clar_test_suites,
+ dependencies: [libgit, common_main],
+)
+test('unit-tests', clar_unit_tests)
+
+unit_test_programs = [
+ 'unit-tests/t-example-decorate.c',
+ 'unit-tests/t-hash.c',
+ 'unit-tests/t-hashmap.c',
+ 'unit-tests/t-mem-pool.c',
+ 'unit-tests/t-oid-array.c',
+ 'unit-tests/t-oidmap.c',
+ 'unit-tests/t-oidtree.c',
+ 'unit-tests/t-prio-queue.c',
+ 'unit-tests/t-reftable-basics.c',
+ 'unit-tests/t-reftable-block.c',
+ 'unit-tests/t-reftable-merged.c',
+ 'unit-tests/t-reftable-pq.c',
+ 'unit-tests/t-reftable-readwrite.c',
+ 'unit-tests/t-reftable-record.c',
+ 'unit-tests/t-reftable-stack.c',
+ 'unit-tests/t-reftable-tree.c',
+ 'unit-tests/t-strbuf.c',
+ 'unit-tests/t-strcmp-offset.c',
+ 'unit-tests/t-trailer.c',
+ 'unit-tests/t-urlmatch-normalization.c',
+]
+
+foreach unit_test_program : unit_test_programs
+ unit_test_name = fs.stem(unit_test_program)
+ unit_test = executable(unit_test_name,
+ sources: [
+ 'unit-tests/test-lib.c',
+ 'unit-tests/lib-oid.c',
+ 'unit-tests/lib-reftable.c',
+ unit_test_program,
+ ],
+ dependencies: [libgit, common_main],
+ )
+ test(unit_test_name, unit_test,
+ workdir: meson.current_source_dir(),
+ )
+endforeach
+
+subdir('helper')
+
+integration_tests = [
+ 't0000-basic.sh',
+ 't0001-init.sh',
+ 't0002-gitfile.sh',
+ 't0003-attributes.sh',
+ 't0004-unwritable.sh',
+ 't0005-signals.sh',
+ 't0006-date.sh',
+ 't0007-git-var.sh',
+ 't0008-ignores.sh',
+ 't0010-racy-git.sh',
+ 't0012-help.sh',
+ 't0013-sha1dc.sh',
+ 't0014-alias.sh',
+ 't0017-env-helper.sh',
+ 't0018-advice.sh',
+ 't0019-json-writer.sh',
+ 't0020-crlf.sh',
+ 't0021-conversion.sh',
+ 't0022-crlf-rename.sh',
+ 't0023-crlf-am.sh',
+ 't0024-crlf-archive.sh',
+ 't0025-crlf-renormalize.sh',
+ 't0026-eol-config.sh',
+ 't0027-auto-crlf.sh',
+ 't0028-working-tree-encoding.sh',
+ 't0029-core-unsetenvvars.sh',
+ 't0030-stripspace.sh',
+ 't0033-safe-directory.sh',
+ 't0034-root-safe-directory.sh',
+ 't0035-safe-bare-repository.sh',
+ 't0040-parse-options.sh',
+ 't0041-usage.sh',
+ 't0050-filesystem.sh',
+ 't0051-windows-named-pipe.sh',
+ 't0052-simple-ipc.sh',
+ 't0055-beyond-symlinks.sh',
+ 't0056-git-C.sh',
+ 't0060-path-utils.sh',
+ 't0061-run-command.sh',
+ 't0062-revision-walking.sh',
+ 't0063-string-list.sh',
+ 't0066-dir-iterator.sh',
+ 't0067-parse_pathspec_file.sh',
+ 't0068-for-each-repo.sh',
+ 't0070-fundamental.sh',
+ 't0071-sort.sh',
+ 't0080-unit-test-output.sh',
+ 't0081-find-pack.sh',
+ 't0090-cache-tree.sh',
+ 't0091-bugreport.sh',
+ 't0092-diagnose.sh',
+ 't0095-bloom.sh',
+ 't0100-previous.sh',
+ 't0101-at-syntax.sh',
+ 't0200-gettext-basic.sh',
+ 't0201-gettext-fallbacks.sh',
+ 't0202-gettext-perl.sh',
+ 't0203-gettext-setlocale-sanity.sh',
+ 't0204-gettext-reencode-sanity.sh',
+ 't0210-trace2-normal.sh',
+ 't0211-trace2-perf.sh',
+ 't0212-trace2-event.sh',
+ 't0300-credentials.sh',
+ 't0301-credential-cache.sh',
+ 't0302-credential-store.sh',
+ 't0303-credential-external.sh',
+ 't0410-partial-clone.sh',
+ 't0411-clone-from-partial.sh',
+ 't0450-txt-doc-vs-help.sh',
+ 't0500-progress-display.sh',
+ 't0600-reffiles-backend.sh',
+ 't0601-reffiles-pack-refs.sh',
+ 't0602-reffiles-fsck.sh',
+ 't0610-reftable-basics.sh',
+ 't0611-reftable-httpd.sh',
+ 't0612-reftable-jgit-compatibility.sh',
+ 't0613-reftable-write-options.sh',
+ 't1000-read-tree-m-3way.sh',
+ 't1001-read-tree-m-2way.sh',
+ 't1002-read-tree-m-u-2way.sh',
+ 't1003-read-tree-prefix.sh',
+ 't1004-read-tree-m-u-wf.sh',
+ 't1005-read-tree-reset.sh',
+ 't1006-cat-file.sh',
+ 't1007-hash-object.sh',
+ 't1008-read-tree-overlay.sh',
+ 't1009-read-tree-new-index.sh',
+ 't1010-mktree.sh',
+ 't1011-read-tree-sparse-checkout.sh',
+ 't1012-read-tree-df.sh',
+ 't1013-read-tree-submodule.sh',
+ 't1014-read-tree-confusing.sh',
+ 't1015-read-index-unmerged.sh',
+ 't1016-compatObjectFormat.sh',
+ 't1020-subdirectory.sh',
+ 't1021-rerere-in-workdir.sh',
+ 't1022-read-tree-partial-clone.sh',
+ 't1050-large.sh',
+ 't1051-large-conversion.sh',
+ 't1060-object-corruption.sh',
+ 't1090-sparse-checkout-scope.sh',
+ 't1091-sparse-checkout-builtin.sh',
+ 't1092-sparse-checkout-compatibility.sh',
+ 't1100-commit-tree-options.sh',
+ 't1300-config.sh',
+ 't1301-shared-repo.sh',
+ 't1302-repo-version.sh',
+ 't1303-wacky-config.sh',
+ 't1304-default-acl.sh',
+ 't1305-config-include.sh',
+ 't1306-xdg-files.sh',
+ 't1307-config-blob.sh',
+ 't1308-config-set.sh',
+ 't1309-early-config.sh',
+ 't1310-config-default.sh',
+ 't1350-config-hooks-path.sh',
+ 't1400-update-ref.sh',
+ 't1401-symbolic-ref.sh',
+ 't1402-check-ref-format.sh',
+ 't1403-show-ref.sh',
+ 't1404-update-ref-errors.sh',
+ 't1405-main-ref-store.sh',
+ 't1406-submodule-ref-store.sh',
+ 't1407-worktree-ref-store.sh',
+ 't1408-packed-refs.sh',
+ 't1409-avoid-packing-refs.sh',
+ 't1410-reflog.sh',
+ 't1411-reflog-show.sh',
+ 't1412-reflog-loop.sh',
+ 't1413-reflog-detach.sh',
+ 't1414-reflog-walk.sh',
+ 't1415-worktree-refs.sh',
+ 't1416-ref-transaction-hooks.sh',
+ 't1417-reflog-updateref.sh',
+ 't1418-reflog-exists.sh',
+ 't1419-exclude-refs.sh',
+ 't1420-lost-found.sh',
+ 't1430-bad-ref-name.sh',
+ 't1450-fsck.sh',
+ 't1451-fsck-buffer.sh',
+ 't1460-refs-migrate.sh',
+ 't1500-rev-parse.sh',
+ 't1501-work-tree.sh',
+ 't1502-rev-parse-parseopt.sh',
+ 't1503-rev-parse-verify.sh',
+ 't1504-ceiling-dirs.sh',
+ 't1505-rev-parse-last.sh',
+ 't1506-rev-parse-diagnosis.sh',
+ 't1507-rev-parse-upstream.sh',
+ 't1508-at-combinations.sh',
+ 't1509-root-work-tree.sh',
+ 't1510-repo-setup.sh',
+ 't1511-rev-parse-caret.sh',
+ 't1512-rev-parse-disambiguation.sh',
+ 't1513-rev-parse-prefix.sh',
+ 't1514-rev-parse-push.sh',
+ 't1515-rev-parse-outside-repo.sh',
+ 't1517-outside-repo.sh',
+ 't1600-index.sh',
+ 't1601-index-bogus.sh',
+ 't1700-split-index.sh',
+ 't1701-racy-split-index.sh',
+ 't1800-hook.sh',
+ 't2000-conflict-when-checking-files-out.sh',
+ 't2002-checkout-cache-u.sh',
+ 't2003-checkout-cache-mkdir.sh',
+ 't2004-checkout-cache-temp.sh',
+ 't2005-checkout-index-symlinks.sh',
+ 't2006-checkout-index-basic.sh',
+ 't2007-checkout-symlink.sh',
+ 't2008-checkout-subdir.sh',
+ 't2009-checkout-statinfo.sh',
+ 't2010-checkout-ambiguous.sh',
+ 't2011-checkout-invalid-head.sh',
+ 't2012-checkout-last.sh',
+ 't2013-checkout-submodule.sh',
+ 't2014-checkout-switch.sh',
+ 't2015-checkout-unborn.sh',
+ 't2016-checkout-patch.sh',
+ 't2017-checkout-orphan.sh',
+ 't2018-checkout-branch.sh',
+ 't2019-checkout-ambiguous-ref.sh',
+ 't2020-checkout-detach.sh',
+ 't2021-checkout-overwrite.sh',
+ 't2022-checkout-paths.sh',
+ 't2023-checkout-m.sh',
+ 't2024-checkout-dwim.sh',
+ 't2025-checkout-no-overlay.sh',
+ 't2026-checkout-pathspec-file.sh',
+ 't2027-checkout-track.sh',
+ 't2030-unresolve-info.sh',
+ 't2050-git-dir-relative.sh',
+ 't2060-switch.sh',
+ 't2070-restore.sh',
+ 't2071-restore-patch.sh',
+ 't2072-restore-pathspec-file.sh',
+ 't2080-parallel-checkout-basics.sh',
+ 't2081-parallel-checkout-collisions.sh',
+ 't2082-parallel-checkout-attributes.sh',
+ 't2100-update-cache-badpath.sh',
+ 't2101-update-index-reupdate.sh',
+ 't2102-update-index-symlinks.sh',
+ 't2103-update-index-ignore-missing.sh',
+ 't2104-update-index-skip-worktree.sh',
+ 't2105-update-index-gitfile.sh',
+ 't2106-update-index-assume-unchanged.sh',
+ 't2107-update-index-basic.sh',
+ 't2108-update-index-refresh-racy.sh',
+ 't2200-add-update.sh',
+ 't2201-add-update-typechange.sh',
+ 't2202-add-addremove.sh',
+ 't2203-add-intent.sh',
+ 't2204-add-ignored.sh',
+ 't2205-add-worktree-config.sh',
+ 't2300-cd-to-toplevel.sh',
+ 't2400-worktree-add.sh',
+ 't2401-worktree-prune.sh',
+ 't2402-worktree-list.sh',
+ 't2403-worktree-move.sh',
+ 't2404-worktree-config.sh',
+ 't2405-worktree-submodule.sh',
+ 't2406-worktree-repair.sh',
+ 't2407-worktree-heads.sh',
+ 't2500-untracked-overwriting.sh',
+ 't2501-cwd-empty.sh',
+ 't3000-ls-files-others.sh',
+ 't3001-ls-files-others-exclude.sh',
+ 't3002-ls-files-dashpath.sh',
+ 't3003-ls-files-exclude.sh',
+ 't3004-ls-files-basic.sh',
+ 't3005-ls-files-relative.sh',
+ 't3006-ls-files-long.sh',
+ 't3007-ls-files-recurse-submodules.sh',
+ 't3008-ls-files-lazy-init-name-hash.sh',
+ 't3009-ls-files-others-nonsubmodule.sh',
+ 't3010-ls-files-killed-modified.sh',
+ 't3011-common-prefixes-and-directory-traversal.sh',
+ 't3012-ls-files-dedup.sh',
+ 't3013-ls-files-format.sh',
+ 't3020-ls-files-error-unmatch.sh',
+ 't3040-subprojects-basic.sh',
+ 't3050-subprojects-fetch.sh',
+ 't3060-ls-files-with-tree.sh',
+ 't3070-wildmatch.sh',
+ 't3100-ls-tree-restrict.sh',
+ 't3101-ls-tree-dirname.sh',
+ 't3102-ls-tree-wildcards.sh',
+ 't3103-ls-tree-misc.sh',
+ 't3104-ls-tree-format.sh',
+ 't3105-ls-tree-output.sh',
+ 't3200-branch.sh',
+ 't3201-branch-contains.sh',
+ 't3202-show-branch.sh',
+ 't3203-branch-output.sh',
+ 't3204-branch-name-interpretation.sh',
+ 't3205-branch-color.sh',
+ 't3206-range-diff.sh',
+ 't3207-branch-submodule.sh',
+ 't3211-peel-ref.sh',
+ 't3300-funny-names.sh',
+ 't3301-notes.sh',
+ 't3302-notes-index-expensive.sh',
+ 't3303-notes-subtrees.sh',
+ 't3304-notes-mixed.sh',
+ 't3305-notes-fanout.sh',
+ 't3306-notes-prune.sh',
+ 't3307-notes-man.sh',
+ 't3308-notes-merge.sh',
+ 't3309-notes-merge-auto-resolve.sh',
+ 't3310-notes-merge-manual-resolve.sh',
+ 't3311-notes-merge-fanout.sh',
+ 't3320-notes-merge-worktrees.sh',
+ 't3321-notes-stripspace.sh',
+ 't3400-rebase.sh',
+ 't3401-rebase-and-am-rename.sh',
+ 't3402-rebase-merge.sh',
+ 't3403-rebase-skip.sh',
+ 't3404-rebase-interactive.sh',
+ 't3405-rebase-malformed.sh',
+ 't3406-rebase-message.sh',
+ 't3407-rebase-abort.sh',
+ 't3408-rebase-multi-line.sh',
+ 't3409-rebase-environ.sh',
+ 't3412-rebase-root.sh',
+ 't3413-rebase-hook.sh',
+ 't3415-rebase-autosquash.sh',
+ 't3416-rebase-onto-threedots.sh',
+ 't3417-rebase-whitespace-fix.sh',
+ 't3418-rebase-continue.sh',
+ 't3419-rebase-patch-id.sh',
+ 't3420-rebase-autostash.sh',
+ 't3421-rebase-topology-linear.sh',
+ 't3422-rebase-incompatible-options.sh',
+ 't3423-rebase-reword.sh',
+ 't3424-rebase-empty.sh',
+ 't3425-rebase-topology-merges.sh',
+ 't3426-rebase-submodule.sh',
+ 't3427-rebase-subtree.sh',
+ 't3428-rebase-signoff.sh',
+ 't3429-rebase-edit-todo.sh',
+ 't3430-rebase-merges.sh',
+ 't3431-rebase-fork-point.sh',
+ 't3432-rebase-fast-forward.sh',
+ 't3433-rebase-across-mode-change.sh',
+ 't3434-rebase-i18n.sh',
+ 't3435-rebase-gpg-sign.sh',
+ 't3436-rebase-more-options.sh',
+ 't3437-rebase-fixup-options.sh',
+ 't3438-rebase-broken-files.sh',
+ 't3500-cherry.sh',
+ 't3501-revert-cherry-pick.sh',
+ 't3502-cherry-pick-merge.sh',
+ 't3503-cherry-pick-root.sh',
+ 't3504-cherry-pick-rerere.sh',
+ 't3505-cherry-pick-empty.sh',
+ 't3506-cherry-pick-ff.sh',
+ 't3507-cherry-pick-conflict.sh',
+ 't3508-cherry-pick-many-commits.sh',
+ 't3509-cherry-pick-merge-df.sh',
+ 't3510-cherry-pick-sequence.sh',
+ 't3511-cherry-pick-x.sh',
+ 't3512-cherry-pick-submodule.sh',
+ 't3513-revert-submodule.sh',
+ 't3514-cherry-pick-revert-gpg.sh',
+ 't3600-rm.sh',
+ 't3601-rm-pathspec-file.sh',
+ 't3602-rm-sparse-checkout.sh',
+ 't3650-replay-basics.sh',
+ 't3700-add.sh',
+ 't3701-add-interactive.sh',
+ 't3702-add-edit.sh',
+ 't3703-add-magic-pathspec.sh',
+ 't3704-add-pathspec-file.sh',
+ 't3705-add-sparse-checkout.sh',
+ 't3800-mktag.sh',
+ 't3900-i18n-commit.sh',
+ 't3901-i18n-patch.sh',
+ 't3902-quoted.sh',
+ 't3903-stash.sh',
+ 't3904-stash-patch.sh',
+ 't3905-stash-include-untracked.sh',
+ 't3906-stash-submodule.sh',
+ 't3907-stash-show-config.sh',
+ 't3908-stash-in-worktree.sh',
+ 't3909-stash-pathspec-file.sh',
+ 't3910-mac-os-precompose.sh',
+ 't3920-crlf-messages.sh',
+ 't4000-diff-format.sh',
+ 't4001-diff-rename.sh',
+ 't4002-diff-basic.sh',
+ 't4003-diff-rename-1.sh',
+ 't4004-diff-rename-symlink.sh',
+ 't4005-diff-rename-2.sh',
+ 't4006-diff-mode.sh',
+ 't4007-rename-3.sh',
+ 't4008-diff-break-rewrite.sh',
+ 't4009-diff-rename-4.sh',
+ 't4010-diff-pathspec.sh',
+ 't4011-diff-symlink.sh',
+ 't4012-diff-binary.sh',
+ 't4013-diff-various.sh',
+ 't4014-format-patch.sh',
+ 't4015-diff-whitespace.sh',
+ 't4016-diff-quote.sh',
+ 't4017-diff-retval.sh',
+ 't4018-diff-funcname.sh',
+ 't4019-diff-wserror.sh',
+ 't4020-diff-external.sh',
+ 't4021-format-patch-numbered.sh',
+ 't4022-diff-rewrite.sh',
+ 't4023-diff-rename-typechange.sh',
+ 't4024-diff-optimize-common.sh',
+ 't4025-hunk-header.sh',
+ 't4026-color.sh',
+ 't4027-diff-submodule.sh',
+ 't4028-format-patch-mime-headers.sh',
+ 't4029-diff-trailing-space.sh',
+ 't4030-diff-textconv.sh',
+ 't4031-diff-rewrite-binary.sh',
+ 't4032-diff-inter-hunk-context.sh',
+ 't4033-diff-patience.sh',
+ 't4034-diff-words.sh',
+ 't4035-diff-quiet.sh',
+ 't4036-format-patch-signer-mime.sh',
+ 't4037-diff-r-t-dirs.sh',
+ 't4038-diff-combined.sh',
+ 't4039-diff-assume-unchanged.sh',
+ 't4040-whitespace-status.sh',
+ 't4041-diff-submodule-option.sh',
+ 't4042-diff-textconv-caching.sh',
+ 't4043-diff-rename-binary.sh',
+ 't4044-diff-index-unique-abbrev.sh',
+ 't4045-diff-relative.sh',
+ 't4046-diff-unmerged.sh',
+ 't4047-diff-dirstat.sh',
+ 't4048-diff-combined-binary.sh',
+ 't4049-diff-stat-count.sh',
+ 't4050-diff-histogram.sh',
+ 't4051-diff-function-context.sh',
+ 't4052-stat-output.sh',
+ 't4053-diff-no-index.sh',
+ 't4054-diff-bogus-tree.sh',
+ 't4055-diff-context.sh',
+ 't4056-diff-order.sh',
+ 't4057-diff-combined-paths.sh',
+ 't4058-diff-duplicates.sh',
+ 't4059-diff-submodule-not-initialized.sh',
+ 't4060-diff-submodule-option-diff-format.sh',
+ 't4061-diff-indent.sh',
+ 't4062-diff-pickaxe.sh',
+ 't4063-diff-blobs.sh',
+ 't4064-diff-oidfind.sh',
+ 't4065-diff-anchored.sh',
+ 't4066-diff-emit-delay.sh',
+ 't4067-diff-partial-clone.sh',
+ 't4068-diff-symmetric-merge-base.sh',
+ 't4069-remerge-diff.sh',
+ 't4100-apply-stat.sh',
+ 't4101-apply-nonl.sh',
+ 't4102-apply-rename.sh',
+ 't4103-apply-binary.sh',
+ 't4104-apply-boundary.sh',
+ 't4105-apply-fuzz.sh',
+ 't4106-apply-stdin.sh',
+ 't4107-apply-ignore-whitespace.sh',
+ 't4108-apply-threeway.sh',
+ 't4109-apply-multifrag.sh',
+ 't4110-apply-scan.sh',
+ 't4111-apply-subdir.sh',
+ 't4112-apply-renames.sh',
+ 't4113-apply-ending.sh',
+ 't4114-apply-typechange.sh',
+ 't4115-apply-symlink.sh',
+ 't4116-apply-reverse.sh',
+ 't4117-apply-reject.sh',
+ 't4118-apply-empty-context.sh',
+ 't4119-apply-config.sh',
+ 't4120-apply-popt.sh',
+ 't4121-apply-diffs.sh',
+ 't4122-apply-symlink-inside.sh',
+ 't4123-apply-shrink.sh',
+ 't4124-apply-ws-rule.sh',
+ 't4125-apply-ws-fuzz.sh',
+ 't4126-apply-empty.sh',
+ 't4127-apply-same-fn.sh',
+ 't4128-apply-root.sh',
+ 't4129-apply-samemode.sh',
+ 't4130-apply-criss-cross-rename.sh',
+ 't4131-apply-fake-ancestor.sh',
+ 't4132-apply-removal.sh',
+ 't4133-apply-filenames.sh',
+ 't4134-apply-submodule.sh',
+ 't4135-apply-weird-filenames.sh',
+ 't4136-apply-check.sh',
+ 't4137-apply-submodule.sh',
+ 't4138-apply-ws-expansion.sh',
+ 't4139-apply-escape.sh',
+ 't4140-apply-ita.sh',
+ 't4141-apply-too-large.sh',
+ 't4150-am.sh',
+ 't4151-am-abort.sh',
+ 't4152-am-subjects.sh',
+ 't4153-am-resume-override-opts.sh',
+ 't4200-rerere.sh',
+ 't4201-shortlog.sh',
+ 't4202-log.sh',
+ 't4203-mailmap.sh',
+ 't4204-patch-id.sh',
+ 't4205-log-pretty-formats.sh',
+ 't4206-log-follow-harder-copies.sh',
+ 't4207-log-decoration-colors.sh',
+ 't4208-log-magic-pathspec.sh',
+ 't4209-log-pickaxe.sh',
+ 't4210-log-i18n.sh',
+ 't4211-line-log.sh',
+ 't4212-log-corrupt.sh',
+ 't4213-log-tabexpand.sh',
+ 't4214-log-graph-octopus.sh',
+ 't4215-log-skewed-merges.sh',
+ 't4216-log-bloom.sh',
+ 't4217-log-limit.sh',
+ 't4252-am-options.sh',
+ 't4253-am-keep-cr-dos.sh',
+ 't4254-am-corrupt.sh',
+ 't4255-am-submodule.sh',
+ 't4256-am-format-flowed.sh',
+ 't4257-am-interactive.sh',
+ 't4258-am-quoted-cr.sh',
+ 't4300-merge-tree.sh',
+ 't4301-merge-tree-write-tree.sh',
+ 't5000-tar-tree.sh',
+ 't5001-archive-attr.sh',
+ 't5002-archive-attr-pattern.sh',
+ 't5003-archive-zip.sh',
+ 't5004-archive-corner-cases.sh',
+ 't5100-mailinfo.sh',
+ 't5150-request-pull.sh',
+ 't5200-update-server-info.sh',
+ 't5300-pack-object.sh',
+ 't5301-sliding-window.sh',
+ 't5302-pack-index.sh',
+ 't5303-pack-corruption-resilience.sh',
+ 't5304-prune.sh',
+ 't5305-include-tag.sh',
+ 't5306-pack-nobase.sh',
+ 't5307-pack-missing-commit.sh',
+ 't5308-pack-detect-duplicates.sh',
+ 't5309-pack-delta-cycles.sh',
+ 't5310-pack-bitmaps.sh',
+ 't5311-pack-bitmaps-shallow.sh',
+ 't5312-prune-corruption.sh',
+ 't5313-pack-bounds-checks.sh',
+ 't5314-pack-cycle-detection.sh',
+ 't5315-pack-objects-compression.sh',
+ 't5316-pack-delta-depth.sh',
+ 't5317-pack-objects-filter-objects.sh',
+ 't5318-commit-graph.sh',
+ 't5319-multi-pack-index.sh',
+ 't5320-delta-islands.sh',
+ 't5321-pack-large-objects.sh',
+ 't5322-pack-objects-sparse.sh',
+ 't5323-pack-redundant.sh',
+ 't5324-split-commit-graph.sh',
+ 't5325-reverse-index.sh',
+ 't5326-multi-pack-bitmaps.sh',
+ 't5327-multi-pack-bitmaps-rev.sh',
+ 't5328-commit-graph-64bit-time.sh',
+ 't5329-pack-objects-cruft.sh',
+ 't5330-no-lazy-fetch-with-commit-graph.sh',
+ 't5331-pack-objects-stdin.sh',
+ 't5332-multi-pack-reuse.sh',
+ 't5333-pseudo-merge-bitmaps.sh',
+ 't5334-incremental-multi-pack-index.sh',
+ 't5351-unpack-large-objects.sh',
+ 't5400-send-pack.sh',
+ 't5401-update-hooks.sh',
+ 't5402-post-merge-hook.sh',
+ 't5403-post-checkout-hook.sh',
+ 't5404-tracking-branches.sh',
+ 't5405-send-pack-rewind.sh',
+ 't5406-remote-rejects.sh',
+ 't5407-post-rewrite-hook.sh',
+ 't5408-send-pack-stdin.sh',
+ 't5409-colorize-remote-messages.sh',
+ 't5410-receive-pack-alternates.sh',
+ 't5411-proc-receive-hook.sh',
+ 't5500-fetch-pack.sh',
+ 't5501-fetch-push-alternates.sh',
+ 't5502-quickfetch.sh',
+ 't5503-tagfollow.sh',
+ 't5504-fetch-receive-strict.sh',
+ 't5505-remote.sh',
+ 't5506-remote-groups.sh',
+ 't5507-remote-environment.sh',
+ 't5509-fetch-push-namespaces.sh',
+ 't5510-fetch.sh',
+ 't5511-refspec.sh',
+ 't5512-ls-remote.sh',
+ 't5513-fetch-track.sh',
+ 't5514-fetch-multiple.sh',
+ 't5515-fetch-merge-logic.sh',
+ 't5516-fetch-push.sh',
+ 't5517-push-mirror.sh',
+ 't5518-fetch-exit-status.sh',
+ 't5519-push-alternates.sh',
+ 't5520-pull.sh',
+ 't5521-pull-options.sh',
+ 't5522-pull-symlink.sh',
+ 't5523-push-upstream.sh',
+ 't5524-pull-msg.sh',
+ 't5525-fetch-tagopt.sh',
+ 't5526-fetch-submodules.sh',
+ 't5527-fetch-odd-refs.sh',
+ 't5528-push-default.sh',
+ 't5529-push-errors.sh',
+ 't5530-upload-pack-error.sh',
+ 't5531-deep-submodule-push.sh',
+ 't5532-fetch-proxy.sh',
+ 't5533-push-cas.sh',
+ 't5534-push-signed.sh',
+ 't5535-fetch-push-symref.sh',
+ 't5536-fetch-conflicts.sh',
+ 't5537-fetch-shallow.sh',
+ 't5538-push-shallow.sh',
+ 't5539-fetch-http-shallow.sh',
+ 't5540-http-push-webdav.sh',
+ 't5541-http-push-smart.sh',
+ 't5542-push-http-shallow.sh',
+ 't5543-atomic-push.sh',
+ 't5544-pack-objects-hook.sh',
+ 't5545-push-options.sh',
+ 't5546-receive-limits.sh',
+ 't5547-push-quarantine.sh',
+ 't5548-push-porcelain.sh',
+ 't5549-fetch-push-http.sh',
+ 't5550-http-fetch-dumb.sh',
+ 't5551-http-fetch-smart.sh',
+ 't5552-skipping-fetch-negotiator.sh',
+ 't5553-set-upstream.sh',
+ 't5554-noop-fetch-negotiator.sh',
+ 't5555-http-smart-common.sh',
+ 't5557-http-get.sh',
+ 't5558-clone-bundle-uri.sh',
+ 't5559-http-fetch-smart-http2.sh',
+ 't5560-http-backend-noserver.sh',
+ 't5561-http-backend.sh',
+ 't5562-http-backend-content-length.sh',
+ 't5563-simple-http-auth.sh',
+ 't5564-http-proxy.sh',
+ 't5570-git-daemon.sh',
+ 't5571-pre-push-hook.sh',
+ 't5572-pull-submodule.sh',
+ 't5573-pull-verify-signatures.sh',
+ 't5574-fetch-output.sh',
+ 't5580-unc-paths.sh',
+ 't5581-http-curl-verbose.sh',
+ 't5582-fetch-negative-refspec.sh',
+ 't5583-push-branches.sh',
+ 't5600-clone-fail-cleanup.sh',
+ 't5601-clone.sh',
+ 't5602-clone-remote-exec.sh',
+ 't5603-clone-dirname.sh',
+ 't5604-clone-reference.sh',
+ 't5605-clone-local.sh',
+ 't5606-clone-options.sh',
+ 't5607-clone-bundle.sh',
+ 't5608-clone-2gb.sh',
+ 't5609-clone-branch.sh',
+ 't5610-clone-detached.sh',
+ 't5611-clone-config.sh',
+ 't5612-clone-refspec.sh',
+ 't5613-info-alternate.sh',
+ 't5614-clone-submodules-shallow.sh',
+ 't5615-alternate-env.sh',
+ 't5616-partial-clone.sh',
+ 't5617-clone-submodules-remote.sh',
+ 't5618-alternate-refs.sh',
+ 't5619-clone-local-ambiguous-transport.sh',
+ 't5700-protocol-v1.sh',
+ 't5701-git-serve.sh',
+ 't5702-protocol-v2.sh',
+ 't5703-upload-pack-ref-in-want.sh',
+ 't5704-protocol-violations.sh',
+ 't5705-session-id-in-capabilities.sh',
+ 't5730-protocol-v2-bundle-uri-file.sh',
+ 't5731-protocol-v2-bundle-uri-git.sh',
+ 't5732-protocol-v2-bundle-uri-http.sh',
+ 't5750-bundle-uri-parse.sh',
+ 't5801-remote-helpers.sh',
+ 't5802-connect-helper.sh',
+ 't5810-proto-disable-local.sh',
+ 't5811-proto-disable-git.sh',
+ 't5812-proto-disable-http.sh',
+ 't5813-proto-disable-ssh.sh',
+ 't5814-proto-disable-ext.sh',
+ 't5815-submodule-protos.sh',
+ 't5900-repo-selection.sh',
+ 't6000-rev-list-misc.sh',
+ 't6001-rev-list-graft.sh',
+ 't6002-rev-list-bisect.sh',
+ 't6003-rev-list-topo-order.sh',
+ 't6004-rev-list-path-optim.sh',
+ 't6005-rev-list-count.sh',
+ 't6006-rev-list-format.sh',
+ 't6007-rev-list-cherry-pick-file.sh',
+ 't6008-rev-list-submodule.sh',
+ 't6009-rev-list-parent.sh',
+ 't6010-merge-base.sh',
+ 't6011-rev-list-with-bad-commit.sh',
+ 't6012-rev-list-simplify.sh',
+ 't6013-rev-list-reverse-parents.sh',
+ 't6014-rev-list-all.sh',
+ 't6016-rev-list-graph-simplify-history.sh',
+ 't6017-rev-list-stdin.sh',
+ 't6018-rev-list-glob.sh',
+ 't6019-rev-list-ancestry-path.sh',
+ 't6020-bundle-misc.sh',
+ 't6021-rev-list-exclude-hidden.sh',
+ 't6022-rev-list-missing.sh',
+ 't6030-bisect-porcelain.sh',
+ 't6040-tracking-info.sh',
+ 't6041-bisect-submodule.sh',
+ 't6050-replace.sh',
+ 't6060-merge-index.sh',
+ 't6100-rev-list-in-order.sh',
+ 't6101-rev-parse-parents.sh',
+ 't6102-rev-list-unexpected-objects.sh',
+ 't6110-rev-list-sparse.sh',
+ 't6111-rev-list-treesame.sh',
+ 't6112-rev-list-filters-objects.sh',
+ 't6113-rev-list-bitmap-filters.sh',
+ 't6114-keep-packs.sh',
+ 't6115-rev-list-du.sh',
+ 't6120-describe.sh',
+ 't6130-pathspec-noglob.sh',
+ 't6131-pathspec-icase.sh',
+ 't6132-pathspec-exclude.sh',
+ 't6133-pathspec-rev-dwim.sh',
+ 't6134-pathspec-in-submodule.sh',
+ 't6135-pathspec-with-attrs.sh',
+ 't6136-pathspec-in-bare.sh',
+ 't6200-fmt-merge-msg.sh',
+ 't6300-for-each-ref.sh',
+ 't6301-for-each-ref-errors.sh',
+ 't6302-for-each-ref-filter.sh',
+ 't6400-merge-df.sh',
+ 't6401-merge-criss-cross.sh',
+ 't6402-merge-rename.sh',
+ 't6403-merge-file.sh',
+ 't6404-recursive-merge.sh',
+ 't6405-merge-symlinks.sh',
+ 't6406-merge-attr.sh',
+ 't6407-merge-binary.sh',
+ 't6408-merge-up-to-date.sh',
+ 't6409-merge-subtree.sh',
+ 't6411-merge-filemode.sh',
+ 't6412-merge-large-rename.sh',
+ 't6413-merge-crlf.sh',
+ 't6414-merge-rename-nocruft.sh',
+ 't6415-merge-dir-to-symlink.sh',
+ 't6416-recursive-corner-cases.sh',
+ 't6417-merge-ours-theirs.sh',
+ 't6418-merge-text-auto.sh',
+ 't6419-merge-ignorecase.sh',
+ 't6421-merge-partial-clone.sh',
+ 't6422-merge-rename-corner-cases.sh',
+ 't6423-merge-rename-directories.sh',
+ 't6424-merge-unrelated-index-changes.sh',
+ 't6425-merge-rename-delete.sh',
+ 't6426-merge-skip-unneeded-updates.sh',
+ 't6427-diff3-conflict-markers.sh',
+ 't6428-merge-conflicts-sparse.sh',
+ 't6429-merge-sequence-rename-caching.sh',
+ 't6430-merge-recursive.sh',
+ 't6431-merge-criscross.sh',
+ 't6432-merge-recursive-space-options.sh',
+ 't6433-merge-toplevel.sh',
+ 't6434-merge-recursive-rename-options.sh',
+ 't6435-merge-sparse.sh',
+ 't6436-merge-overwrite.sh',
+ 't6437-submodule-merge.sh',
+ 't6438-submodule-directory-file-conflicts.sh',
+ 't6439-merge-co-error-msgs.sh',
+ 't6500-gc.sh',
+ 't6501-freshen-objects.sh',
+ 't6600-test-reach.sh',
+ 't6700-tree-depth.sh',
+ 't7001-mv.sh',
+ 't7002-mv-sparse-checkout.sh',
+ 't7003-filter-branch.sh',
+ 't7004-tag.sh',
+ 't7005-editor.sh',
+ 't7006-pager.sh',
+ 't7007-show.sh',
+ 't7008-filter-branch-null-sha1.sh',
+ 't7010-setup.sh',
+ 't7011-skip-worktree-reading.sh',
+ 't7012-skip-worktree-writing.sh',
+ 't7030-verify-tag.sh',
+ 't7031-verify-tag-signed-ssh.sh',
+ 't7060-wtstatus.sh',
+ 't7061-wtstatus-ignore.sh',
+ 't7062-wtstatus-ignorecase.sh',
+ 't7063-status-untracked-cache.sh',
+ 't7064-wtstatus-pv2.sh',
+ 't7101-reset-empty-subdirs.sh',
+ 't7102-reset.sh',
+ 't7103-reset-bare.sh',
+ 't7104-reset-hard.sh',
+ 't7105-reset-patch.sh',
+ 't7106-reset-unborn-branch.sh',
+ 't7107-reset-pathspec-file.sh',
+ 't7110-reset-merge.sh',
+ 't7111-reset-table.sh',
+ 't7112-reset-submodule.sh',
+ 't7113-post-index-change-hook.sh',
+ 't7201-co.sh',
+ 't7300-clean.sh',
+ 't7301-clean-interactive.sh',
+ 't7400-submodule-basic.sh',
+ 't7401-submodule-summary.sh',
+ 't7402-submodule-rebase.sh',
+ 't7403-submodule-sync.sh',
+ 't7406-submodule-update.sh',
+ 't7407-submodule-foreach.sh',
+ 't7408-submodule-reference.sh',
+ 't7409-submodule-detached-work-tree.sh',
+ 't7411-submodule-config.sh',
+ 't7412-submodule-absorbgitdirs.sh',
+ 't7413-submodule-is-active.sh',
+ 't7414-submodule-mistakes.sh',
+ 't7416-submodule-dash-url.sh',
+ 't7417-submodule-path-url.sh',
+ 't7418-submodule-sparse-gitmodules.sh',
+ 't7419-submodule-set-branch.sh',
+ 't7420-submodule-set-url.sh',
+ 't7421-submodule-summary-add.sh',
+ 't7422-submodule-output.sh',
+ 't7423-submodule-symlinks.sh',
+ 't7424-submodule-mixed-ref-formats.sh',
+ 't7450-bad-git-dotfiles.sh',
+ 't7500-commit-template-squash-signoff.sh',
+ 't7501-commit-basic-functionality.sh',
+ 't7502-commit-porcelain.sh',
+ 't7503-pre-commit-and-pre-merge-commit-hooks.sh',
+ 't7504-commit-msg-hook.sh',
+ 't7505-prepare-commit-msg-hook.sh',
+ 't7506-status-submodule.sh',
+ 't7507-commit-verbose.sh',
+ 't7508-status.sh',
+ 't7509-commit-authorship.sh',
+ 't7510-signed-commit.sh',
+ 't7511-status-index.sh',
+ 't7512-status-help.sh',
+ 't7513-interpret-trailers.sh',
+ 't7514-commit-patch.sh',
+ 't7515-status-symlinks.sh',
+ 't7516-commit-races.sh',
+ 't7517-per-repo-email.sh',
+ 't7518-ident-corner-cases.sh',
+ 't7519-status-fsmonitor.sh',
+ 't7520-ignored-hook-warning.sh',
+ 't7521-ignored-mode.sh',
+ 't7524-commit-summary.sh',
+ 't7525-status-rename.sh',
+ 't7526-commit-pathspec-file.sh',
+ 't7527-builtin-fsmonitor.sh',
+ 't7528-signed-commit-ssh.sh',
+ 't7600-merge.sh',
+ 't7601-merge-pull-config.sh',
+ 't7602-merge-octopus-many.sh',
+ 't7603-merge-reduce-heads.sh',
+ 't7604-merge-custom-message.sh',
+ 't7605-merge-resolve.sh',
+ 't7606-merge-custom.sh',
+ 't7607-merge-state.sh',
+ 't7608-merge-messages.sh',
+ 't7609-mergetool--lib.sh',
+ 't7610-mergetool.sh',
+ 't7611-merge-abort.sh',
+ 't7612-merge-verify-signatures.sh',
+ 't7614-merge-signoff.sh',
+ 't7615-diff-algo-with-mergy-operations.sh',
+ 't7700-repack.sh',
+ 't7701-repack-unpack-unreachable.sh',
+ 't7702-repack-cyclic-alternate.sh',
+ 't7703-repack-geometric.sh',
+ 't7704-repack-cruft.sh',
+ 't7800-difftool.sh',
+ 't7810-grep.sh',
+ 't7811-grep-open.sh',
+ 't7812-grep-icase-non-ascii.sh',
+ 't7813-grep-icase-iso.sh',
+ 't7814-grep-recurse-submodules.sh',
+ 't7815-grep-binary.sh',
+ 't7816-grep-binary-pattern.sh',
+ 't7817-grep-sparse-checkout.sh',
+ 't7900-maintenance.sh',
+ 't8001-annotate.sh',
+ 't8002-blame.sh',
+ 't8003-blame-corner-cases.sh',
+ 't8004-blame-with-conflicts.sh',
+ 't8005-blame-i18n.sh',
+ 't8006-blame-textconv.sh',
+ 't8007-cat-file-textconv.sh',
+ 't8008-blame-formats.sh',
+ 't8009-blame-vs-topicbranches.sh',
+ 't8010-cat-file-filters.sh',
+ 't8011-blame-split-file.sh',
+ 't8012-blame-colors.sh',
+ 't8013-blame-ignore-revs.sh',
+ 't8014-blame-ignore-fuzzy.sh',
+ 't9001-send-email.sh',
+ 't9002-column.sh',
+ 't9003-help-autocorrect.sh',
+ 't9100-git-svn-basic.sh',
+ 't9101-git-svn-props.sh',
+ 't9102-git-svn-deep-rmdir.sh',
+ 't9103-git-svn-tracked-directory-removed.sh',
+ 't9104-git-svn-follow-parent.sh',
+ 't9105-git-svn-commit-diff.sh',
+ 't9106-git-svn-commit-diff-clobber.sh',
+ 't9107-git-svn-migrate.sh',
+ 't9108-git-svn-glob.sh',
+ 't9109-git-svn-multi-glob.sh',
+ 't9110-git-svn-use-svm-props.sh',
+ 't9111-git-svn-use-svnsync-props.sh',
+ 't9112-git-svn-md5less-file.sh',
+ 't9113-git-svn-dcommit-new-file.sh',
+ 't9114-git-svn-dcommit-merge.sh',
+ 't9115-git-svn-dcommit-funky-renames.sh',
+ 't9116-git-svn-log.sh',
+ 't9117-git-svn-init-clone.sh',
+ 't9118-git-svn-funky-branch-names.sh',
+ 't9119-git-svn-info.sh',
+ 't9120-git-svn-clone-with-percent-escapes.sh',
+ 't9121-git-svn-fetch-renamed-dir.sh',
+ 't9122-git-svn-author.sh',
+ 't9123-git-svn-rebuild-with-rewriteroot.sh',
+ 't9124-git-svn-dcommit-auto-props.sh',
+ 't9125-git-svn-multi-glob-branch-names.sh',
+ 't9126-git-svn-follow-deleted-readded-directory.sh',
+ 't9127-git-svn-partial-rebuild.sh',
+ 't9128-git-svn-cmd-branch.sh',
+ 't9129-git-svn-i18n-commitencoding.sh',
+ 't9130-git-svn-authors-file.sh',
+ 't9131-git-svn-empty-symlink.sh',
+ 't9132-git-svn-broken-symlink.sh',
+ 't9133-git-svn-nested-git-repo.sh',
+ 't9134-git-svn-ignore-paths.sh',
+ 't9135-git-svn-moved-branch-empty-file.sh',
+ 't9136-git-svn-recreated-branch-empty-file.sh',
+ 't9137-git-svn-dcommit-clobber-series.sh',
+ 't9138-git-svn-authors-prog.sh',
+ 't9139-git-svn-non-utf8-commitencoding.sh',
+ 't9140-git-svn-reset.sh',
+ 't9141-git-svn-multiple-branches.sh',
+ 't9142-git-svn-shallow-clone.sh',
+ 't9143-git-svn-gc.sh',
+ 't9144-git-svn-old-rev_map.sh',
+ 't9145-git-svn-master-branch.sh',
+ 't9146-git-svn-empty-dirs.sh',
+ 't9147-git-svn-include-paths.sh',
+ 't9148-git-svn-propset.sh',
+ 't9150-svk-mergetickets.sh',
+ 't9151-svn-mergeinfo.sh',
+ 't9152-svn-empty-dirs-after-gc.sh',
+ 't9153-git-svn-rewrite-uuid.sh',
+ 't9154-git-svn-fancy-glob.sh',
+ 't9155-git-svn-fetch-deleted-tag.sh',
+ 't9156-git-svn-fetch-deleted-tag-2.sh',
+ 't9157-git-svn-fetch-merge.sh',
+ 't9158-git-svn-mergeinfo.sh',
+ 't9159-git-svn-no-parent-mergeinfo.sh',
+ 't9160-git-svn-preserve-empty-dirs.sh',
+ 't9161-git-svn-mergeinfo-push.sh',
+ 't9162-git-svn-dcommit-interactive.sh',
+ 't9163-git-svn-reset-clears-caches.sh',
+ 't9164-git-svn-dcommit-concurrent.sh',
+ 't9165-git-svn-fetch-merge-branch-of-branch.sh',
+ 't9166-git-svn-fetch-merge-branch-of-branch2.sh',
+ 't9167-git-svn-cmd-branch-subproject.sh',
+ 't9168-git-svn-partially-globbed-names.sh',
+ 't9169-git-svn-dcommit-crlf.sh',
+ 't9200-git-cvsexportcommit.sh',
+ 't9210-scalar.sh',
+ 't9211-scalar-clone.sh',
+ 't9300-fast-import.sh',
+ 't9301-fast-import-notes.sh',
+ 't9302-fast-import-unpack-limit.sh',
+ 't9303-fast-import-compression.sh',
+ 't9304-fast-import-marks.sh',
+ 't9350-fast-export.sh',
+ 't9351-fast-export-anonymize.sh',
+ 't9400-git-cvsserver-server.sh',
+ 't9401-git-cvsserver-crlf.sh',
+ 't9402-git-cvsserver-refs.sh',
+ 't9500-gitweb-standalone-no-errors.sh',
+ 't9501-gitweb-standalone-http-status.sh',
+ 't9502-gitweb-standalone-parse-output.sh',
+ 't9600-cvsimport.sh',
+ 't9601-cvsimport-vendor-branch.sh',
+ 't9602-cvsimport-branches-tags.sh',
+ 't9603-cvsimport-patchsets.sh',
+ 't9604-cvsimport-timestamps.sh',
+ 't9700-perl-git.sh',
+ 't9800-git-p4-basic.sh',
+ 't9801-git-p4-branch.sh',
+ 't9802-git-p4-filetype.sh',
+ 't9803-git-p4-shell-metachars.sh',
+ 't9804-git-p4-label.sh',
+ 't9805-git-p4-skip-submit-edit.sh',
+ 't9806-git-p4-options.sh',
+ 't9807-git-p4-submit.sh',
+ 't9808-git-p4-chdir.sh',
+ 't9809-git-p4-client-view.sh',
+ 't9810-git-p4-rcs.sh',
+ 't9811-git-p4-label-import.sh',
+ 't9812-git-p4-wildcards.sh',
+ 't9813-git-p4-preserve-users.sh',
+ 't9814-git-p4-rename.sh',
+ 't9815-git-p4-submit-fail.sh',
+ 't9816-git-p4-locked.sh',
+ 't9817-git-p4-exclude.sh',
+ 't9818-git-p4-block.sh',
+ 't9819-git-p4-case-folding.sh',
+ 't9820-git-p4-editor-handling.sh',
+ 't9821-git-p4-path-variations.sh',
+ 't9822-git-p4-path-encoding.sh',
+ 't9823-git-p4-mock-lfs.sh',
+ 't9824-git-p4-git-lfs.sh',
+ 't9825-git-p4-handle-utf16-without-bom.sh',
+ 't9826-git-p4-keep-empty-commits.sh',
+ 't9827-git-p4-change-filetype.sh',
+ 't9828-git-p4-map-user.sh',
+ 't9829-git-p4-jobs.sh',
+ 't9830-git-p4-symlink-dir.sh',
+ 't9831-git-p4-triggers.sh',
+ 't9832-unshelve.sh',
+ 't9833-errors.sh',
+ 't9834-git-p4-file-dir-bug.sh',
+ 't9835-git-p4-metadata-encoding-python2.sh',
+ 't9836-git-p4-metadata-encoding-python3.sh',
+ 't9850-shell.sh',
+ 't9901-git-web--browse.sh',
+ 't9902-completion.sh',
+ 't9903-bash-prompt.sh',
+]
+
+# GIT_BUILD_DIR needs to be Unix-style without drive prefixes as it 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 it.
+git_build_dir = meson.project_build_root()
+if cygpath.found()
+ git_build_dir = run_command(cygpath, git_build_dir, check: true).stdout().strip()
+endif
+
+test_environment = script_environment
+test_environment.set('GIT_BUILD_DIR', git_build_dir)
+
+foreach integration_test : integration_tests
+ test(fs.stem(integration_test), shell,
+ args: [ integration_test ],
+ workdir: meson.current_source_dir(),
+ env: test_environment,
+ depends: test_dependencies + bin_wrappers,
+ timeout: 0,
+ )
+endforeach
diff --git a/templates/hooks/meson.build b/templates/hooks/meson.build
new file mode 100644
index 00000000000..9bef5d7cfad
--- /dev/null
+++ b/templates/hooks/meson.build
@@ -0,0 +1,24 @@
+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: script_sh_config,
+ )
+endforeach
diff --git a/templates/info/meson.build b/templates/info/meson.build
new file mode 100644
index 00000000000..4ee1cfdf896
--- /dev/null
+++ b/templates/info/meson.build
@@ -0,0 +1,5 @@
+configure_file(
+ input: 'exclude',
+ output: 'exclude',
+ configuration: script_sh_config,
+)
diff --git a/templates/meson.build b/templates/meson.build
new file mode 100644
index 00000000000..7428aaf1e6f
--- /dev/null
+++ b/templates/meson.build
@@ -0,0 +1,8 @@
+configure_file(
+ input: 'description',
+ output: 'description',
+ configuration: script_sh_config,
+)
+
+subdir('hooks')
+subdir('info')
--
2.47.0.rc1.33.g90fe3800b9.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v2 00/24] Modernize our build system
2024-10-09 14:56 ` [RFC PATCH v2 00/24] Modernize our " Patrick Steinhardt
` (23 preceding siblings ...)
2024-10-09 14:57 ` [RFC PATCH v2 24/24] Introduce support for the Meson build system Patrick Steinhardt
@ 2024-10-10 5:26 ` Junio C Hamano
2024-10-10 5:28 ` Patrick Steinhardt
2024-10-12 2:04 ` Junio C Hamano
25 siblings, 1 reply; 386+ messages in thread
From: Junio C Hamano @ 2024-10-10 5:26 UTC (permalink / raw)
To: Patrick Steinhardt; +Cc: git, Eli Schwartz, Eric Sunshine, Phillip Wood
Patrick Steinhardt <ps@pks.im> writes:
> - Patches 12 to 22 refactor parts of our build system to make proper
> out-of-tree builds a reality.
Oooooh.
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v2 00/24] Modernize our build system
2024-10-10 5:26 ` [RFC PATCH v2 00/24] Modernize our " Junio C Hamano
@ 2024-10-10 5:28 ` Patrick Steinhardt
2024-10-10 5:49 ` Patrick Steinhardt
0 siblings, 1 reply; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-10 5:28 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Eli Schwartz, Eric Sunshine, Phillip Wood
On Wed, Oct 09, 2024 at 10:26:42PM -0700, Junio C Hamano wrote:
> Patrick Steinhardt <ps@pks.im> writes:
>
> > - Patches 12 to 22 refactor parts of our build system to make proper
> > out-of-tree builds a reality.
>
> Oooooh.
I hope I didn't get you too exited: not wired up in Makefiles! I was
being a bit unclear here, it basically lands all the pieces required to
make that happen, but the bits only get properly wired up by Meson.
There is no reasony why we cannot have it in our Makefile, too, though.
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v2 00/24] Modernize our build system
2024-10-10 5:28 ` Patrick Steinhardt
@ 2024-10-10 5:49 ` Patrick Steinhardt
0 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-10 5:49 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Eli Schwartz, Eric Sunshine, Phillip Wood
On Thu, Oct 10, 2024 at 07:28:39AM +0200, Patrick Steinhardt wrote:
> On Wed, Oct 09, 2024 at 10:26:42PM -0700, Junio C Hamano wrote:
> > Patrick Steinhardt <ps@pks.im> writes:
> >
> > > - Patches 12 to 22 refactor parts of our build system to make proper
> > > out-of-tree builds a reality.
> >
> > Oooooh.
>
> I hope I didn't get you too exited: not wired up in Makefiles! I was
> being a bit unclear here, it basically lands all the pieces required to
> make that happen, but the bits only get properly wired up by Meson.
> There is no reasony why we cannot have it in our Makefile, too, though.
To expand on this a bit: I was wondering whether I should do that
though, as it would make it was easier to split up this whole patch
series into multiple parts that all provide a benefit on their own:
- Part 1: the platform-specific fixes.
- Part 2: prepare us for proper (optional) out-of-tree builds, making
things work with our Makefile. A lot of the parts are a prerequisite
for Meson anyway.
- Part 3: the modern build system.
So if people think that this is worth it I'd be happy to do it this way.
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v2 00/24] Modernize our build system
2024-10-09 14:56 ` [RFC PATCH v2 00/24] Modernize our " Patrick Steinhardt
` (24 preceding siblings ...)
2024-10-10 5:26 ` [RFC PATCH v2 00/24] Modernize our " Junio C Hamano
@ 2024-10-12 2:04 ` Junio C Hamano
2024-10-12 15:58 ` Taylor Blau
25 siblings, 1 reply; 386+ messages in thread
From: Junio C Hamano @ 2024-10-12 2:04 UTC (permalink / raw)
To: Patrick Steinhardt; +Cc: git, Eli Schwartz, Eric Sunshine, Phillip Wood
Patrick Steinhardt <ps@pks.im> writes:
> this is the second version of the patch series that modernizes our build
> system by introducing Meson. This series is still in an RFC state.
I'll keep it in the broken-out repository (https://github.com/gitster/git)
but eject it out of 'seen' for now. Builds with the topic seem to
be unhappy with circular dependency,
cf. https://github.com/git/git/actions/runs/11299216196
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v2 00/24] Modernize our build system
2024-10-12 2:04 ` Junio C Hamano
@ 2024-10-12 15:58 ` Taylor Blau
0 siblings, 0 replies; 386+ messages in thread
From: Taylor Blau @ 2024-10-12 15:58 UTC (permalink / raw)
To: Junio C Hamano
Cc: Patrick Steinhardt, git, Eli Schwartz, Eric Sunshine,
Phillip Wood
On Fri, Oct 11, 2024 at 07:04:38PM -0700, Junio C Hamano wrote:
> Patrick Steinhardt <ps@pks.im> writes:
>
> > this is the second version of the patch series that modernizes our build
> > system by introducing Meson. This series is still in an RFC state.
>
> I'll keep it in the broken-out repository (https://github.com/gitster/git)
> but eject it out of 'seen' for now. Builds with the topic seem to
> be unhappy with circular dependency,
I'll do the same for now. The latest version of the topic is in my tree
as ps/build, and I'll keep it there until we can integrate it into
'seen' without breakage.
> cf. https://github.com/git/git/actions/runs/11299216196
Thanks,
Taylor
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v2 24/24] Introduce support for the Meson build system
2024-10-09 14:57 ` [RFC PATCH v2 24/24] Introduce support for the Meson build system Patrick Steinhardt
@ 2024-10-14 2:07 ` Eli Schwartz
2024-10-14 5:20 ` Patrick Steinhardt
0 siblings, 1 reply; 386+ messages in thread
From: Eli Schwartz @ 2024-10-14 2:07 UTC (permalink / raw)
To: Patrick Steinhardt, git; +Cc: Eric Sunshine, Phillip Wood, Junio C Hamano
[-- Attachment #1.1: Type: text/plain, Size: 1267 bytes --]
On 10/9/24 10:57 AM, Patrick Steinhardt wrote:
> +script_environment = environment()
> +foreach tool : ['cat', 'cut', 'grep', 'sed', 'sort', 'tr', 'uname']
> + program = find_program(tool)
> + script_environment.prepend('PATH', fs.parent(program.full_path()))
> +endforeach
> +
> +libgit_sources += custom_target(
> + 'command-list.h',
> + input: 'command-list.txt',
> + output: 'command-list.h',
> + command: [shell, meson.current_source_dir() + '/generate-cmdlist.sh', meson.current_source_dir(), '@OUTPUT@'],
> + env: script_environment,
> +)
Maybe I am missing something about the necessity of this setting up of
PATH? Should these programs not already be on PATH -- how does meson
find them?
> +zlib = dependency('zlib', default_options: ['default_library=static', 'tests=disabled'])
> +if zlib.type_name() != 'internal' and not compiler.has_function('deflateBound',
> + prefix: '#include <zlib.h>',
> + dependencies: zlib,
> +)
> + libgit_c_args += '-DNO_DEFLATE_BOUND'
> +endif
Probably should have mentioned this earlier on, but.
What about
if zlib.version().version_compare('>=1.2.0')
libgit_c_args += '-DNO_DEFLATE_BOUND'
endif
since that is when that function was added.
--
Eli Schwartz
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v2 24/24] Introduce support for the Meson build system
2024-10-14 2:07 ` Eli Schwartz
@ 2024-10-14 5:20 ` Patrick Steinhardt
0 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-14 5:20 UTC (permalink / raw)
To: Eli Schwartz; +Cc: git, Eric Sunshine, Phillip Wood, Junio C Hamano
On Sun, Oct 13, 2024 at 10:07:10PM -0400, Eli Schwartz wrote:
> On 10/9/24 10:57 AM, Patrick Steinhardt wrote:
> > +script_environment = environment()
> > +foreach tool : ['cat', 'cut', 'grep', 'sed', 'sort', 'tr', 'uname']
> > + program = find_program(tool)
> > + script_environment.prepend('PATH', fs.parent(program.full_path()))
> > +endforeach
> > +
> > +libgit_sources += custom_target(
> > + 'command-list.h',
> > + input: 'command-list.txt',
> > + output: 'command-list.h',
> > + command: [shell, meson.current_source_dir() + '/generate-cmdlist.sh', meson.current_source_dir(), '@OUTPUT@'],
> > + env: script_environment,
> > +)
>
>
> Maybe I am missing something about the necessity of this setting up of
> PATH? Should these programs not already be on PATH -- how does meson
> find them?
It is required when generating the project file in one environment so
that it can be used in another one. E.g. when using MinGW64 to generate
the Visual Studio solution, where the tools are not in PATH anymore.
> > +zlib = dependency('zlib', default_options: ['default_library=static', 'tests=disabled'])
> > +if zlib.type_name() != 'internal' and not compiler.has_function('deflateBound',
> > + prefix: '#include <zlib.h>',
> > + dependencies: zlib,
> > +)
> > + libgit_c_args += '-DNO_DEFLATE_BOUND'
> > +endif
>
>
> Probably should have mentioned this earlier on, but.
>
> What about
>
> if zlib.version().version_compare('>=1.2.0')
> libgit_c_args += '-DNO_DEFLATE_BOUND'
> endif
>
>
> since that is when that function was added.
Arguably we can also just declare a minimum required zlib version
nowadays. v1.2.0 has been released in 2011, more than a decade ago. But
in any case, your version is certainly cleaner, thanks!
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v2 23/24] Documentation: add comparison of build systems
2024-10-09 14:57 ` [RFC PATCH v2 23/24] Documentation: add comparison of build systems Patrick Steinhardt
@ 2024-10-14 15:23 ` Phillip Wood
2024-10-15 12:12 ` Patrick Steinhardt
0 siblings, 1 reply; 386+ messages in thread
From: Phillip Wood @ 2024-10-14 15:23 UTC (permalink / raw)
To: Patrick Steinhardt, git; +Cc: Eli Schwartz, Eric Sunshine, Junio C Hamano
Hi Patrick
On 09/10/2024 15:57, Patrick Steinhardt wrote:
Thanks for putting this together, I've left a few comments below.
> +== Requirements
> +
> +The following subsections present a list of requirements that we have for any
> +potential build system. Sections are sorted by decreasing priority, even though
> +these priorities will naturally differ between users.
This last sentence sounds a bit self contradictory - whose priorities
are we using?
> +=== Platform support
> +
> +The build system must have support for all of our primary platforms as outlined
> +by. These platforms are:
Something seems to have been lost when the first sentence was edited.
> + - Linux
> + - Windows
> + - macOS
> +
> +Furthermore, the build system should have support for the following secondary
> +platforms:
> +
> + - AIX
> + - FreeBSD
> + - NetBSD
> + - OpenBSD
> +
> +The platforms which must be supported by the tool should be aligned with our
> +[platform support policy](platform-support.txt).
The platform support document does not use the terms primary or
secondary when talking about support so I'm not sure what distinction
we're trying to make here. Also where does NonStop fit into this?
> +=== Ease of use
> +
> +The build system should be both easy to use and easy to extend. While this is
> +naturally a subjective metric it is likely not controversial to say that some
> +build systems are considerably harder to use than others.
The tricky part is deciding how to measure ease of use if we're going to
use it as a metric for selecting a build system.
> +=== Out-of-tree builds
> +
> +The build system should support out-of-tree builds.
Yes please!
> +=== Language support
> +
> +The following languages and toolchains are of relevance and should be supported
> +by the build system:
> +
> + - C: the primary compiled language used by Git, must be supported. Relevant
> + toolchains are GCC, Clang and MSVC.
> + - Rust: candidate as a second compiled lanugage, should be supported. Relevant
> + toolchains is the LLVM-based rustc.
> +
> +Built-in support for the respective languages is preferred over support that
> +needs to be wired up manually to avoid unnecessary complexity. Native support
> +includes the following features:
> +
> + - Compiling objects.
> + - Dependency tracking.
> + - Detection of available features.
> + - Discovery of relevant toolchains.
> + - Linking libraries and executables.
Do we want a section about templating (i.e. substituting @XXX@) support
which we use when installing scripts?
> +=== Test integration
> +
> +It should be possible to integrate tests into the build system such that it is
> +possible to build and test Git within the build system. Features which are nice
> +to have:
> +
> + - Track build-time dependencies for respective tests. Unit tests have
> + different requirements than integration tests.
> + - Allow filtering of which tests to run.
> + - Allow interactive tests that drop the user into a shell with `test_pause` or
> + `debug`.
Does this last point mean we want to be able to selectively pass
--interactive to the test script(s) being run?
> +=== CMake
> +
> +- Platform support: not as extensive as GNU Make or autoconf, but all major
> + platforms are supported.
> + - AIX
> + - Cygwin
> + - FreeBSD
> + - Linux
> + - OpenBSD
> + - Solaris
> + - Windows
> + - macOS
This matches the list in the CMake README but in practice it is
available for a much wider range of platforms including all those listed
below for meson.
> +- Ease of use: easy to use, discovering available options is not always
> + trivial. The scripting language used by CMake is somewhat cumbersome to use,
> + but extending CMake build instructions is doable.
> +- IDE support: natively integrated into Microsoft Visual Studio. Can generate
> + project descriptions for Xcode. An extension is available for Visual Studio
> + Code. Many other IDEs have plugins for CMake.
> +- Out-of-tree builds: supported.
> +- Cross-platform builds: supported.
> +- Language support:
> + - C: Supported for GCC, Clang, MSVC and other toolchains.
> + - Rust: No built-in support, needs to be wired up manually.
> +- Test integration: supported, even though test dependencies are a bit
> + cumbersome to use via "test fixtures". Interactive test runs are not
> + supported.
> +
> +=== Meson
> +
> +- Platform: not as extensive as GNU Make or autoconf, but all major platforms
> + and some smaller ones are supported.
> + - AIX
> + - Cygwin
> + - DragonflyBSD
> + - FreeBSD
> + - Haiku
> + - Linux
> + - NetBSD
> + - OpenBSD
> + - Solaris
> + - Windows
> + - macOS
> +- Ease of use: easy to use, discovering available options is easy. The
> + scripting language is straight-forward to use.
> +- IDE support: Supports generating build instructions for Xcode and Microsoft
> + Visual Studio, a plugin exists for Visual Studio Code.
This is my main concern about meson - it means we either loose the nice
integration on Windows that we have with CMake or we have to continue to
maintain both. As I understand it Microsoft Visual Studio support
requires the user to open a mingw terminal and run some to generate a
build description which they can then use form the GUI which is what the
CMake support was added to avoid. I guess they also need to install
meson somehow as well.
Best Wishes
Phillip
> +- Out-of-tree builds: supported.
> +- Cross-platform builds: supported.
> +- Language support:
> + - C: Supported for GCC, Clang, MSVC and other toolchains.
> + - Rust: Supported for rustc.
> +- Test integration: supported. Interactive tests are supported starting with
> + Meson 1.5.0 via the `--interactive` flag.
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v2 23/24] Documentation: add comparison of build systems
2024-10-14 15:23 ` Phillip Wood
@ 2024-10-15 12:12 ` Patrick Steinhardt
2024-10-16 13:36 ` phillip.wood123
0 siblings, 1 reply; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-15 12:12 UTC (permalink / raw)
To: phillip.wood; +Cc: git, Eli Schwartz, Eric Sunshine, Junio C Hamano
On Mon, Oct 14, 2024 at 04:23:33PM +0100, Phillip Wood wrote:
> On 09/10/2024 15:57, Patrick Steinhardt wrote:
> > +== Requirements
> > +
> > +The following subsections present a list of requirements that we have for any
> > +potential build system. Sections are sorted by decreasing priority, even though
> > +these priorities will naturally differ between users.
>
> This last sentence sounds a bit self contradictory - whose priorities are we
> using?
I guess it's priorities as received by the author, namely me. I didn't
quite know how to write this, as I didn't want to force my own prios on
everybody else without saying so. But if people agree with the general
ordering I'm happy to drop this sentence.
> > +=== Platform support
> > +
> > +The build system must have support for all of our primary platforms as outlined
> > +by. These platforms are:
>
> Something seems to have been lost when the first sentence was edited.
>
> > + - Linux
> > + - Windows
> > + - macOS
> > +
> > +Furthermore, the build system should have support for the following secondary
> > +platforms:
> > +
> > + - AIX
> > + - FreeBSD
> > + - NetBSD
> > + - OpenBSD
> > +
> > +The platforms which must be supported by the tool should be aligned with our
> > +[platform support policy](platform-support.txt).
>
> The platform support document does not use the terms primary or secondary
> when talking about support so I'm not sure what distinction we're trying to
> make here. Also where does NonStop fit into this?
Yes, true, and that's an issue from my point of view. I think we should
make explicit the different kinds of support we have and have a proper
list of systems that are supported and their general "support tier".
Anyway, that's a different can of worms that I don't want to open right
now. My table is still crawling with worms from previously-opened cans.
I've reworded this slightly now and added NonStop.
> > +=== Ease of use
> > +
> > +The build system should be both easy to use and easy to extend. While this is
> > +naturally a subjective metric it is likely not controversial to say that some
> > +build systems are considerably harder to use than others.
>
> The tricky part is deciding how to measure ease of use if we're going to use
> it as a metric for selecting a build system.
Yup. It's part of the reason why I wanted to have all build systems in
the tree, such that it is possible to compare them by just having a look
for how it looks like.
Things are naturally going to be subjective, and that is fine. But I
guess that we can mostly agree on some general things, like "autoconf
looks like gibberish".
> > +=== Language support
> > +
> > +The following languages and toolchains are of relevance and should be supported
> > +by the build system:
> > +
> > + - C: the primary compiled language used by Git, must be supported. Relevant
> > + toolchains are GCC, Clang and MSVC.
> > + - Rust: candidate as a second compiled lanugage, should be supported. Relevant
> > + toolchains is the LLVM-based rustc.
> > +
> > +Built-in support for the respective languages is preferred over support that
> > +needs to be wired up manually to avoid unnecessary complexity. Native support
> > +includes the following features:
> > +
> > + - Compiling objects.
> > + - Dependency tracking.
> > + - Detection of available features.
> > + - Discovery of relevant toolchains.
> > + - Linking libraries and executables.
>
> Do we want a section about templating (i.e. substituting @XXX@) support
> which we use when installing scripts?
It doesn't hurt.
> > +=== Test integration
> > +
> > +It should be possible to integrate tests into the build system such that it is
> > +possible to build and test Git within the build system. Features which are nice
> > +to have:
> > +
> > + - Track build-time dependencies for respective tests. Unit tests have
> > + different requirements than integration tests.
> > + - Allow filtering of which tests to run.
> > + - Allow interactive tests that drop the user into a shell with `test_pause` or
> > + `debug`.
>
> Does this last point mean we want to be able to selectively pass
> --interactive to the test script(s) being run?
What I mean by this is that when I see that a specific test fails, I
want to be able to execute only that single test such that things like
`test_pause` fail. What I don't mean is that the build system should
know to automatically rerun failing tests with that.
I've reformulated it to "Allow running tests such that utilities like
`test_pause` or `debug` work."
> > +=== CMake
> > +
> > +- Platform support: not as extensive as GNU Make or autoconf, but all major
> > + platforms are supported.
> > + - AIX
> > + - Cygwin
> > + - FreeBSD
> > + - Linux
> > + - OpenBSD
> > + - Solaris
> > + - Windows
> > + - macOS
>
> This matches the list in the CMake README but in practice it is available
> for a much wider range of platforms including all those listed below for
> meson.
I was searching for an official statement, but couldn't find anything.
Do you maybe have a pointer?
> > +- Ease of use: easy to use, discovering available options is not always
> > + trivial. The scripting language used by CMake is somewhat cumbersome to use,
> > + but extending CMake build instructions is doable.
> > +- IDE support: natively integrated into Microsoft Visual Studio. Can generate
> > + project descriptions for Xcode. An extension is available for Visual Studio
> > + Code. Many other IDEs have plugins for CMake.
> > +- Out-of-tree builds: supported.
> > +- Cross-platform builds: supported.
> > +- Language support:
> > + - C: Supported for GCC, Clang, MSVC and other toolchains.
> > + - Rust: No built-in support, needs to be wired up manually.
> > +- Test integration: supported, even though test dependencies are a bit
> > + cumbersome to use via "test fixtures". Interactive test runs are not
> > + supported.
> > +
> > +=== Meson
> > +
> > +- Platform: not as extensive as GNU Make or autoconf, but all major platforms
> > + and some smaller ones are supported.
> > + - AIX
> > + - Cygwin
> > + - DragonflyBSD
> > + - FreeBSD
> > + - Haiku
> > + - Linux
> > + - NetBSD
> > + - OpenBSD
> > + - Solaris
> > + - Windows
> > + - macOS
> > +- Ease of use: easy to use, discovering available options is easy. The
> > + scripting language is straight-forward to use.
> > +- IDE support: Supports generating build instructions for Xcode and Microsoft
> > + Visual Studio, a plugin exists for Visual Studio Code.
>
> This is my main concern about meson - it means we either loose the nice
> integration on Windows that we have with CMake or we have to continue to
> maintain both. As I understand it Microsoft Visual Studio support requires
> the user to open a mingw terminal and run some to generate a build
> description which they can then use form the GUI which is what the CMake
> support was added to avoid. I guess they also need to install meson somehow
> as well.
I'm personally not particularly worried about having to generate the
MSVC solution from the command line once, as long as things just work
from thereon without requiring the developer to jump through hoops to
get it set up. It certainly doesn't seem like a particularly high
barrier to me, and should be a huge improvement compared to our current
Makefile.
I'm mostly there by now with the subprojects added in this version of
the patch series, which make it way easier to use MSVC without all deps
having been installed. But I still have to port over the SANE_TOOL_PATH
hack that we have in CMake.
I do understand that just clicking a button to import a CMakeLists.txt
is easier. It's mostly that I personally value the sanity that Meson
brings with it higher, which is of course a subjective opinion.
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v2 23/24] Documentation: add comparison of build systems
2024-10-15 12:12 ` Patrick Steinhardt
@ 2024-10-16 13:36 ` phillip.wood123
2024-10-17 9:36 ` Patrick Steinhardt
0 siblings, 1 reply; 386+ messages in thread
From: phillip.wood123 @ 2024-10-16 13:36 UTC (permalink / raw)
To: Patrick Steinhardt, phillip.wood
Cc: git, Eli Schwartz, Eric Sunshine, Junio C Hamano
Hi Patrick
On 15/10/2024 13:12, Patrick Steinhardt wrote:
> On Mon, Oct 14, 2024 at 04:23:33PM +0100, Phillip Wood wrote:
>> On 09/10/2024 15:57, Patrick Steinhardt wrote:
>>> +== Requirements
>>> +
>>> +The following subsections present a list of requirements that we have for any
>>> +potential build system. Sections are sorted by decreasing priority, even though
>>> +these priorities will naturally differ between users.
>>
>> This last sentence sounds a bit self contradictory - whose priorities are we
>> using?
>
> I guess it's priorities as received by the author, namely me. I didn't
> quite know how to write this, as I didn't want to force my own prios on
> everybody else without saying so. But if people agree with the general
> ordering I'm happy to drop this sentence.
I think that would make sense - anyone who objects to the order you've
selected can also say so in a review.
>>> +=== Platform support
>>> +
>>> +The build system must have support for all of our primary platforms as outlined
>>> +by. These platforms are:
>>
>> Something seems to have been lost when the first sentence was edited.
>>
>>> + - Linux
>>> + - Windows
>>> + - macOS
>>> +
>>> +Furthermore, the build system should have support for the following secondary
>>> +platforms:
>>> +
>>> + - AIX
>>> + - FreeBSD
>>> + - NetBSD
>>> + - OpenBSD
>>> +
>>> +The platforms which must be supported by the tool should be aligned with our
>>> +[platform support policy](platform-support.txt).
>>
>> The platform support document does not use the terms primary or secondary
>> when talking about support so I'm not sure what distinction we're trying to
>> make here. Also where does NonStop fit into this?
>
> Yes, true, and that's an issue from my point of view. I think we should
> make explicit the different kinds of support we have and have a proper
> list of systems that are supported and their general "support tier".
That would probably be clearer but as you say it can wait
> Anyway, that's a different can of worms that I don't want to open right
> now. My table is still crawling with worms from previously-opened cans.
It's going to take a while for me to get that image out of my mind!
> I've reworded this slightly now and added NonStop.
Great
>>> +=== Test integration
>>> +
>>> +It should be possible to integrate tests into the build system such that it is
>>> +possible to build and test Git within the build system. Features which are nice
>>> +to have:
>>> +
>>> + - Track build-time dependencies for respective tests. Unit tests have
>>> + different requirements than integration tests.
>>> + - Allow filtering of which tests to run.
>>> + - Allow interactive tests that drop the user into a shell with `test_pause` or
>>> + `debug`.
>>
>> Does this last point mean we want to be able to selectively pass
>> --interactive to the test script(s) being run?
>
> What I mean by this is that when I see that a specific test fails, I
> want to be able to execute only that single test such that things like
> `test_pause` fail. What I don't mean is that the build system should
> know to automatically rerun failing tests with that.
>
> I've reformulated it to "Allow running tests such that utilities like
> `test_pause` or `debug` work."
Ah so this is basically "there should be a way to disable
parallelization and let the test access the terminal"?
>>> +=== CMake
>>> +
>>> +- Platform support: not as extensive as GNU Make or autoconf, but all major
>>> + platforms are supported.
>>> + - AIX
>>> + - Cygwin
>>> + - FreeBSD
>>> + - Linux
>>> + - OpenBSD
>>> + - Solaris
>>> + - Windows
>>> + - macOS
>>
>> This matches the list in the CMake README but in practice it is available
>> for a much wider range of platforms including all those listed below for
>> meson.
>
> I was searching for an official statement, but couldn't find anything.
> Do you maybe have a pointer?
I've not been able to find any documentation but
https://github.com/Kitware/CMake/tree/9c25632ba0ad0525b20195d371b3d78a8bcc4113/Modules/Platform
seems to show which platforms and compilers are supported.
>>> +- Ease of use: easy to use, discovering available options is easy. The
>>> + scripting language is straight-forward to use.
>>> +- IDE support: Supports generating build instructions for Xcode and Microsoft
>>> + Visual Studio, a plugin exists for Visual Studio Code.
>>
>> This is my main concern about meson - it means we either loose the nice
>> integration on Windows that we have with CMake or we have to continue to
>> maintain both. As I understand it Microsoft Visual Studio support requires
>> the user to open a mingw terminal and run some to generate a build
>> description which they can then use form the GUI which is what the CMake
>> support was added to avoid. I guess they also need to install meson somehow
>> as well.
>
> I'm personally not particularly worried about having to generate the
> MSVC solution from the command line once, as long as things just work
> from thereon without requiring the developer to jump through hoops to
> get it set up. It certainly doesn't seem like a particularly high
> barrier to me, and should be a huge improvement compared to our current
> Makefile.
It's an improvement on our Makefile but a regression compared to our
CMakeList.txt which was specifically aimed making it easy for new
contributors to get started without downloading any extra software or
running terminal commands.
> I'm mostly there by now with the subprojects added in this version of
> the patch series, which make it way easier to use MSVC without all deps
> having been installed. But I still have to port over the SANE_TOOL_PATH
> hack that we have in CMake.
>
> I do understand that just clicking a button to import a CMakeLists.txt
> is easier. It's mostly that I personally value the sanity that Meson
> brings with it higher, which is of course a subjective opinion.
Right, I suspect the people who added support for building git in Visual
Studio with CMake have different priorities. It's a real shame the meson
there isn't a meson plugin for Visual Studio.
Best Wishes
Phillip
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v2 23/24] Documentation: add comparison of build systems
2024-10-16 13:36 ` phillip.wood123
@ 2024-10-17 9:36 ` Patrick Steinhardt
2024-10-17 10:58 ` Patrick Steinhardt
0 siblings, 1 reply; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-17 9:36 UTC (permalink / raw)
To: phillip.wood; +Cc: git, Eli Schwartz, Eric Sunshine, Junio C Hamano
On Wed, Oct 16, 2024 at 02:36:54PM +0100, phillip.wood123@gmail.com wrote:
> > > > +=== Test integration
> > > > +
> > > > +It should be possible to integrate tests into the build system such that it is
> > > > +possible to build and test Git within the build system. Features which are nice
> > > > +to have:
> > > > +
> > > > + - Track build-time dependencies for respective tests. Unit tests have
> > > > + different requirements than integration tests.
> > > > + - Allow filtering of which tests to run.
> > > > + - Allow interactive tests that drop the user into a shell with `test_pause` or
> > > > + `debug`.
> > >
> > > Does this last point mean we want to be able to selectively pass
> > > --interactive to the test script(s) being run?
> >
> > What I mean by this is that when I see that a specific test fails, I
> > want to be able to execute only that single test such that things like
> > `test_pause` fail. What I don't mean is that the build system should
> > know to automatically rerun failing tests with that.
> >
> > I've reformulated it to "Allow running tests such that utilities like
> > `test_pause` or `debug` work."
>
> Ah so this is basically "there should be a way to disable parallelization
> and let the test access the terminal"?
Exactly.
With out-of-tree builds the development process is going to change a
bit, and it is going to be closer integrated with the build system.
Right now it's easy to manually execute a test and thus give it access
to the terminal. And while that shouldn't go away, you'd now have to set
up an additional environment variable to tell the test where the build
directory lives. There isn't really a way to avoid that.
But to me that also means that it's important that features we're all
used to remain easily accessible, and `test_pause` and `debug` are two
things that many developers probably use on a daily basis. I was worried
about that a when starting out on the Meson journey, but now I actually
have to say that I already favor the Meson workflow over the Makefile
workflow. Previously, I always used to do:
$ make -C .. -j20 && ./t1234-something.sh
With Meson that becomes:
$ meson test -i t1234-something
Which, at least to me, somehow feels way more enjoyable.
> > > > +- Ease of use: easy to use, discovering available options is easy. The
> > > > + scripting language is straight-forward to use.
> > > > +- IDE support: Supports generating build instructions for Xcode and Microsoft
> > > > + Visual Studio, a plugin exists for Visual Studio Code.
> > >
> > > This is my main concern about meson - it means we either loose the nice
> > > integration on Windows that we have with CMake or we have to continue to
> > > maintain both. As I understand it Microsoft Visual Studio support requires
> > > the user to open a mingw terminal and run some to generate a build
> > > description which they can then use form the GUI which is what the CMake
> > > support was added to avoid. I guess they also need to install meson somehow
> > > as well.
> >
> > I'm personally not particularly worried about having to generate the
> > MSVC solution from the command line once, as long as things just work
> > from thereon without requiring the developer to jump through hoops to
> > get it set up. It certainly doesn't seem like a particularly high
> > barrier to me, and should be a huge improvement compared to our current
> > Makefile.
>
> It's an improvement on our Makefile but a regression compared to our
> CMakeList.txt which was specifically aimed making it easy for new
> contributors to get started without downloading any extra software or
> running terminal commands.
Yeah, that's fair enough.
> > I'm mostly there by now with the subprojects added in this version of
> > the patch series, which make it way easier to use MSVC without all deps
> > having been installed. But I still have to port over the SANE_TOOL_PATH
> > hack that we have in CMake.
> >
> > I do understand that just clicking a button to import a CMakeLists.txt
> > is easier. It's mostly that I personally value the sanity that Meson
> > brings with it higher, which is of course a subjective opinion.
>
> Right, I suspect the people who added support for building git in Visual
> Studio with CMake have different priorities. It's a real shame the meson
> there isn't a meson plugin for Visual Studio.
It certainly would be great to have such a plugin. There is one for
Visual Studio Code, but of course MSVC and VSC aren't the same. Which
reminds me, I should give that plugin a try.
In any case, my hope would be that eventually such a plugin does show
up. My gut feeling tells me that Meson has been picking up quite a bit
of steam over the last couple years, and more and more projects are
picking it up. And that makes me hopeful that we would eventually get
such a plugin.
It's of course wishful thinking, but as said, meanwhile we do have a way
for MSVC by generating the solution manually. So I'd already see it as a
net win if the official build system supports MSVC, even though not as
easily as with the click of a button.
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v2 23/24] Documentation: add comparison of build systems
2024-10-17 9:36 ` Patrick Steinhardt
@ 2024-10-17 10:58 ` Patrick Steinhardt
0 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-17 10:58 UTC (permalink / raw)
To: phillip.wood; +Cc: git, Eli Schwartz, Eric Sunshine, Junio C Hamano
On Thu, Oct 17, 2024 at 11:36:25AM +0200, Patrick Steinhardt wrote:
> On Wed, Oct 16, 2024 at 02:36:54PM +0100, phillip.wood123@gmail.com wrote:
> > > I'm mostly there by now with the subprojects added in this version of
> > > the patch series, which make it way easier to use MSVC without all deps
> > > having been installed. But I still have to port over the SANE_TOOL_PATH
> > > hack that we have in CMake.
> > >
> > > I do understand that just clicking a button to import a CMakeLists.txt
> > > is easier. It's mostly that I personally value the sanity that Meson
> > > brings with it higher, which is of course a subjective opinion.
> >
> > Right, I suspect the people who added support for building git in Visual
> > Studio with CMake have different priorities. It's a real shame the meson
> > there isn't a meson plugin for Visual Studio.
>
> It certainly would be great to have such a plugin. There is one for
> Visual Studio Code, but of course MSVC and VSC aren't the same. Which
> reminds me, I should give that plugin a try.
>
> In any case, my hope would be that eventually such a plugin does show
> up. My gut feeling tells me that Meson has been picking up quite a bit
> of steam over the last couple years, and more and more projects are
> picking it up. And that makes me hopeful that we would eventually get
> such a plugin.
>
> It's of course wishful thinking, but as said, meanwhile we do have a way
> for MSVC by generating the solution manually. So I'd already see it as a
> net win if the official build system supports MSVC, even though not as
> easily as with the click of a button.
So I've had a look at Visual Studio Code now. Things didn't work as-is
yet, but I've made some changes and now things work out of the box. You
install the Meson plugin, clone the Git project, and Meson configures
automatically. The only requirement is that you've got Git for Windows
installed, which provides all the build tools and which gets picked up
by Meson automatically now.
Afterwards you can just click on any build and/or test target and then
VS Code builds dependencies, including subprojects like curl, zlib,
openssl and the like, and executes the tests for you.
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* [RFC PATCH v3 00/15] Modernize the build system
2024-10-02 15:15 [RFC PATCH 00/21] Modernize the build system Patrick Steinhardt
` (22 preceding siblings ...)
2024-10-09 14:56 ` [RFC PATCH v2 00/24] Modernize our " Patrick Steinhardt
@ 2024-10-18 12:23 ` Patrick Steinhardt
2024-10-18 12:23 ` [RFC PATCH v3 01/15] Makefile: use common template for GIT-BUILD-OPTIONS Patrick Steinhardt
` (17 more replies)
2024-10-24 12:39 ` [RFC PATCH v4 00/19] " Patrick Steinhardt
` (7 subsequent siblings)
31 siblings, 18 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-18 12:23 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones
Hi,
this is the third version of my patch series that aims to modernize our
build system infrastructure. It refactors our existing build infra to be
ready for out-of-tree builds and then wires up Meson.
Changes compared to v2:
- I have split out semi-related changes like the platform
compatibility fixes into separate series. More on that further down
below, where I explain the current base.
- I have polished the CMake-related changes I've been doing as prereqs
while refactoring our build system. Some of the changes weren't
tested before, but now CMake works as expected.
- Fixed up some dependencies in our Makefile, as I didn't amend them
to depend on the new generator scripts.
- I have extracted some more scripts to massage our Perl library code,
shells cripts and gitweb.cgi such that they can be used by Make,
CMake and Meson. This also fixes generation of "gitweb.cgi" on
Meson as reported by Ramsay.
- I have fixed the cyclic dependency in our Makefile that I have
introduced with v2.
- I have addressed some feedback regarding "build-systems.txt".
- I have made things work with OpenBSD 7.6.
- Things now work on Cygwin and MinGW64 as expected, no more test
failures except for t9700, which also fails with our Makefile.
- I have improved how we set up the required tooling on Windows such
that we detect Git for Windows-provided tools as we do with CMake.
Like this, VS Code can now trivially import the Meson project and
configure it. Furthermore, generation of the Visual Studio solution
is trivial as well. So overall, things work fine now on all the
important Windows environments that I'm aware of.
- Several smaller fixes all over the place.
I've included a range-diff, but it's quite crowded overall.
In general I think that this is in a pretty good shape now. I have
tested things on NixOS, macOS 10.15, OpenBSD 7.6, FreeBSD 14.1, Windows
10 with MSVC, VS Code, MinGW and Cygwin, and things are generally smooth
and just work. I'm sure there's still going to be weirdnesses on some
platforms regardless of that.
This series is based on 15030f9556 (The second batch, 2024-10-15) and
has the following dependencies:
- ps/cmake-clar at c6d3e52c91 (cmake: set up proper
dependencies for generated clar headers, 2024-10-15).
- ps/upgrade-clar at f3501edb0e (Makefile: adjust sed command for
generating "clar-decls.h", 2024-10-14).
- ps/platform-compat-fixes at 80ebd91b83 (http: fix build error on
FreeBSD, 2024-10-16).
These deps are mostly just there to make tests pass on all platforms,
but I wouldn't want folks to go test things and discover breakage that
is not caused by Meson itself :) You can also find this version of the
patch series at [1], branch "pks-meson-v3". @Taylor, I'm fine with
keeping this out of "seen" if you prefer to wait for those dependencies
to land first.
Thanks!
Patrick
[1]: https://gitlab.com/gitlab-org/git.git
Patrick Steinhardt (15):
Makefile: use common template for GIT-BUILD-OPTIONS
Makefile: consistently use @PLACEHOLDER@ to substitute
Makefile: consistently use PERL_PATH
Makefile: extract script to massage Perl scripts
Makefile: use "generate-perl.sh" to massage Perl library
Makefile: extract script to massage Shell scripts
Makefile: extract script to generate gitweb.cgi
Makefile: refactor GIT-VERSION-GEN to be reusable
Makefile: refactor generators to be PWD-independent
Makefile: allow "bin-wrappers/" directory to exist
Makefile: simplify building of templates
t: better support for out-of-tree builds
t: allow overriding build dir
Documentation: add comparison of build systems
Introduce support for the Meson build system
.gitignore | 1 -
Documentation/CodingGuidelines | 2 +-
Documentation/Makefile | 1 +
Documentation/technical/build-systems.txt | 224 +++
GIT-BUILD-OPTIONS.in | 47 +
GIT-VERSION-GEN | 12 +-
Makefile | 208 +--
bin-wrappers/.gitignore | 9 +
bin-wrappers/meson.build | 28 +
bin-wrappers/wrap-for-bin.sh | 37 +
configure.ac | 2 +-
contrib/buildsystems/CMakeLists.txt | 218 ++-
contrib/completion/meson.build | 8 +
contrib/meson.build | 1 +
generate-cmdlist.sh | 42 +-
generate-configlist.sh | 20 +-
generate-hooklist.sh | 15 +-
generate-perl.sh | 36 +
generate-script.sh | 34 +
git-cvsserver.perl | 2 +-
git-instaweb.sh | 8 +-
git-request-pull.sh | 2 +-
git-send-email.perl | 2 +-
git-sh-i18n.sh | 6 +-
git-sh-setup.sh | 6 +-
git-svn.perl | 2 +-
gitk-git/po/vi.po | 2 +-
gitweb/GITWEB-BUILD-OPTIONS.in | 25 +
gitweb/Makefile | 58 +-
gitweb/generate-gitweb.sh | 45 +
gitweb/gitweb.perl | 44 +-
gitweb/meson.build | 63 +
meson.build | 1614 +++++++++++++++++
meson_options.txt | 70 +
perl/FromCPAN/Mail/meson.build | 7 +
perl/FromCPAN/meson.build | 9 +
perl/Git/I18N.pm | 6 +-
perl/Git/LoadCPAN.pm | 6 +-
perl/Git/LoadCPAN/Mail/meson.build | 7 +
perl/Git/LoadCPAN/meson.build | 9 +
perl/Git/SVN/Memoize/meson.build | 7 +
perl/Git/SVN/meson.build | 20 +
perl/Git/meson.build | 18 +
.../header_templates/fixed_prefix.template.pl | 2 +-
.../runtime_prefix.template.pl | 8 +-
perl/meson.build | 12 +
po/meson.build | 28 +
subprojects/.gitignore | 1 +
subprojects/curl.wrap | 13 +
subprojects/expat.wrap | 13 +
subprojects/openssl.wrap | 15 +
subprojects/pcre2.wrap | 16 +
subprojects/zlib.wrap | 13 +
t/helper/meson.build | 91 +
t/lib-gettext.sh | 4 +-
t/meson.build | 1103 +++++++++++
t/t7609-mergetool--lib.sh | 2 +-
t/test-lib.sh | 22 +-
templates/Makefile | 39 +-
templates/branches-- | 1 -
templates/{this--description => description} | 0
.../applypatch-msg.sample} | 0
.../commit-msg.sample} | 0
.../fsmonitor-watchman.sample} | 0
templates/hooks/meson.build | 24 +
.../post-update.sample} | 0
.../pre-applypatch.sample} | 0
.../pre-commit.sample} | 0
.../pre-merge-commit.sample} | 0
.../pre-push.sample} | 0
.../pre-rebase.sample} | 0
.../pre-receive.sample} | 0
.../prepare-commit-msg.sample} | 0
.../push-to-checkout.sample} | 0
.../sendemail-validate.sample} | 0
.../update.sample} | 0
templates/{info--exclude => info/exclude} | 0
templates/info/meson.build | 5 +
templates/meson.build | 13 +
unimplemented.sh | 2 +-
wrap-for-bin.sh | 36 -
81 files changed, 4040 insertions(+), 406 deletions(-)
create mode 100644 Documentation/technical/build-systems.txt
create mode 100644 GIT-BUILD-OPTIONS.in
create mode 100644 bin-wrappers/.gitignore
create mode 100644 bin-wrappers/meson.build
create mode 100755 bin-wrappers/wrap-for-bin.sh
create mode 100644 contrib/completion/meson.build
create mode 100644 contrib/meson.build
create mode 100755 generate-perl.sh
create mode 100755 generate-script.sh
create mode 100644 gitweb/GITWEB-BUILD-OPTIONS.in
create mode 100755 gitweb/generate-gitweb.sh
create mode 100644 gitweb/meson.build
create mode 100644 meson.build
create mode 100644 meson_options.txt
create mode 100644 perl/FromCPAN/Mail/meson.build
create mode 100644 perl/FromCPAN/meson.build
create mode 100644 perl/Git/LoadCPAN/Mail/meson.build
create mode 100644 perl/Git/LoadCPAN/meson.build
create mode 100644 perl/Git/SVN/Memoize/meson.build
create mode 100644 perl/Git/SVN/meson.build
create mode 100644 perl/Git/meson.build
create mode 100644 perl/meson.build
create mode 100644 po/meson.build
create mode 100644 subprojects/.gitignore
create mode 100644 subprojects/curl.wrap
create mode 100644 subprojects/expat.wrap
create mode 100644 subprojects/openssl.wrap
create mode 100644 subprojects/pcre2.wrap
create mode 100644 subprojects/zlib.wrap
create mode 100644 t/helper/meson.build
create mode 100644 t/meson.build
delete mode 100644 templates/branches--
rename templates/{this--description => description} (100%)
rename templates/{hooks--applypatch-msg.sample => hooks/applypatch-msg.sample} (100%)
rename templates/{hooks--commit-msg.sample => hooks/commit-msg.sample} (100%)
rename templates/{hooks--fsmonitor-watchman.sample => hooks/fsmonitor-watchman.sample} (100%)
create mode 100644 templates/hooks/meson.build
rename templates/{hooks--post-update.sample => hooks/post-update.sample} (100%)
rename templates/{hooks--pre-applypatch.sample => hooks/pre-applypatch.sample} (100%)
rename templates/{hooks--pre-commit.sample => hooks/pre-commit.sample} (100%)
rename templates/{hooks--pre-merge-commit.sample => hooks/pre-merge-commit.sample} (100%)
rename templates/{hooks--pre-push.sample => hooks/pre-push.sample} (100%)
rename templates/{hooks--pre-rebase.sample => hooks/pre-rebase.sample} (100%)
rename templates/{hooks--pre-receive.sample => hooks/pre-receive.sample} (100%)
rename templates/{hooks--prepare-commit-msg.sample => hooks/prepare-commit-msg.sample} (100%)
rename templates/{hooks--push-to-checkout.sample => hooks/push-to-checkout.sample} (100%)
rename templates/{hooks--sendemail-validate.sample => hooks/sendemail-validate.sample} (100%)
rename templates/{hooks--update.sample => hooks/update.sample} (100%)
rename templates/{info--exclude => info/exclude} (100%)
create mode 100644 templates/info/meson.build
create mode 100644 templates/meson.build
delete mode 100644 wrap-for-bin.sh
Range-diff against v2:
1: 6dd59db9b2b < -: ----------- t/test-lib: fix quoting of TEST_RESULTS_SAN_FILE
2: 5ec91ac12da < -: ----------- t/test-lib: wire up NO_ICONV prerequisite
3: 94664e2cc06 < -: ----------- t/lib-gitweb: test against the build version of gitweb
4: ffb661dad71 < -: ----------- t/lib-gpg: fix setup of GNUPGHOME in MinGW
5: 958cf3a6b57 < -: ----------- t1401: make invocation of tar(1) work with Win32-provided one
6: bada3a82fdd < -: ----------- t3404: work around platform-specific behaviour on macOS 10.15
7: b4bdefe9e34 < -: ----------- t5500, t5601: skip tests which exercise paths with '[::1]' on Cygwin
8: 48ce19d876f < -: ----------- t7300: work around platform-specific behaviour with long paths on MinGW
9: 73b4362164a < -: ----------- t/unit-tests: update clar unit test framework
10: 161f6b063af < -: ----------- builtin/credential-cache: fix missing parameter for stub function
11: e4ef4bdf1c5 < -: ----------- http: fix build error on FreeBSD
12: 6ea97bc92f2 < -: ----------- Makefile: extract script to generate clar declarations
16: dbf9e39e3df = 1: 800fb080f45 Makefile: use common template for GIT-BUILD-OPTIONS
17: 97b9789dd68 ! 2: 1a4a23c66ca Makefile: consistently use @PLACEHOLDER@ to substitute
@@ Makefile: GIT-SCRIPT-DEFINES: FORCE
$@.sh >$@+
endef
+@@ Makefile: $(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
+ -e ' r GIT-PERL-HEADER' \
+ -e ' G' \
+ -e '}' \
+- -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
++ -e 's/@GIT_VERSION@/$(GIT_VERSION)/g' \
+ $< >$@+ && \
+ chmod +x $@+ && \
+ mv $@+ $@
@@ Makefile: GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile
INSTLIBDIR='$(perllibdir_SQ)' && \
INSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \
@@ contrib/buildsystems/CMakeLists.txt: set(wrapper_test_scripts
#options for configuring test options
- ## generate-perl.sh ##
-@@ generate-perl.sh: sed -e '1{' \
- -e " r $PERL_HEADER" \
- -e ' G' \
- -e '}' \
-- -e "s/@@GIT_VERSION@@/$GIT_VERSION/g" \
-+ -e "s/@GIT_VERSION@/$GIT_VERSION/g" \
- "$PERL_SCRIPT" >"$OUT"
- chmod a+x "$OUT"
-
## git-cvsserver.perl ##
@@
use File::Basename;
18: 1ee9c61fc33 = 3: 8261f108968 Makefile: consistently use PERL_PATH
13: 7f567d7ce23 ! 4: 4894179b948 Makefile: extract script to massage Perl scripts
@@ Commit message
## Makefile ##
@@ Makefile: endif
+
PERL_DEFINES += $(gitexecdir) $(perllibdir) $(localedir)
- $(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
+-$(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
- $(QUIET_GEN) \
- sed -e '1{' \
- -e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \
- -e ' r GIT-PERL-HEADER' \
- -e ' G' \
- -e '}' \
-- -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
+- -e 's/@GIT_VERSION@/$(GIT_VERSION)/g' \
- $< >$@+ && \
- chmod +x $@+ && \
-+ $(QUIET_GEN)$(SHELL_PATH) generate-perl.sh $(GIT_VERSION) GIT-PERL-HEADER "$(PERL_PATH_SQ)" "$<" "$@+" && \
++$(SCRIPT_PERL_GEN): % : %.perl generate-perl.sh GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
++ $(QUIET_GEN)$(SHELL_PATH) generate-perl.sh ./GIT-BUILD-OPTIONS $(GIT_VERSION) GIT-PERL-HEADER "$<" "$@+" && \
mv $@+ $@
PERL_DEFINES := $(subst $(space),:,$(PERL_DEFINES))
+ ## contrib/buildsystems/CMakeLists.txt ##
+@@ contrib/buildsystems/CMakeLists.txt: foreach(script ${git_shell_scripts})
+ endforeach()
+
+ #perl scripts
+-parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" ".perl")
++parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" "")
+
+ #create perl header
+ file(STRINGS ${CMAKE_SOURCE_DIR}/perl/header_templates/fixed_prefix.template.pl perl_header )
+ string(REPLACE "@PATHSEP@" ":" perl_header "${perl_header}")
+ string(REPLACE "@INSTLIBDIR@" "${INSTLIBDIR}" perl_header "${perl_header}")
++file(WRITE ${CMAKE_BINARY_DIR}/PERL-HEADER ${perl_header})
+
+ foreach(script ${git_perl_scripts})
+- file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.perl content NEWLINE_CONSUME)
+- string(REPLACE "#!/usr/bin/perl" "#!/usr/bin/perl\n${perl_header}\n" content "${content}")
+- string(REPLACE "@GIT_VERSION@" "${PROJECT_VERSION}" content "${content}")
+- file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
++ string(REPLACE ".perl" "" perl_gen_path "${script}")
++
++ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${perl_gen_path}
++ COMMAND ${CMAKE_SOURCE_DIR}/generate-perl.sh
++ ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS
++ ${PROJECT_VERSION}
++ ${CMAKE_BINARY_DIR}/PERL-HEADER
++ ${CMAKE_SOURCE_DIR}/${script}
++ ${CMAKE_BINARY_DIR}/${perl_gen_path}
++ DEPENDS ${CMAKE_SOURCE_DIR}/generate-perl.sh
++ ${CMAKE_SOURCE_DIR}/${script})
++ list(APPEND perl_gen ${CMAKE_BINARY_DIR}/${perl_gen_path})
+ endforeach()
++add_custom_target(perl-gen ALL DEPENDS ${perl_gen})
+
+ #python script
+ file(STRINGS ${CMAKE_SOURCE_DIR}/git-p4.py content NEWLINE_CONSUME)
+
## generate-perl.sh (new) ##
@@
+#!/bin/sh
+
++set -e
++
+if test $# -ne 5
+then
-+ echo "USAGE: $0 <GIT_VERSION> <PERL_HEADER> <PERL_PATH> <PERL_SCRIPT> <OUT>" >&2
++ echo "USAGE: $0 <GIT_BUILD_OPTIONS> <GIT_VERSION> <PERL_HEADER> <INPUT> <OUTPUT>" >&2
+ exit 1
+fi
+
-+GIT_VERSION="$1"
-+PERL_HEADER="$2"
-+PERL_PATH="$3"
-+PERL_SCRIPT="$4"
-+OUT="$5"
++GIT_BUILD_OPTIONS="$1"
++GIT_VERSION="$2"
++PERL_HEADER="$3"
++INPUT="$4"
++OUTPUT="$5"
++
++. "$GIT_BUILD_OPTIONS"
+
+sed -e '1{' \
+ -e " s|#!.*perl|#!$PERL_PATH|" \
+ -e " r $PERL_HEADER" \
+ -e ' G' \
+ -e '}' \
-+ -e "s/@@GIT_VERSION@@/$GIT_VERSION/g" \
-+ "$PERL_SCRIPT" >"$OUT"
-+chmod a+x "$OUT"
++ -e "s/@GIT_VERSION@/$GIT_VERSION/g" \
++ "$INPUT" >"$OUTPUT"
++chmod a+x "$OUTPUT"
-: ----------- > 5: b40bc302291 Makefile: use "generate-perl.sh" to massage Perl library
-: ----------- > 6: c13ce99be3a Makefile: extract script to massage Shell scripts
-: ----------- > 7: ebffd855836 Makefile: extract script to generate gitweb.cgi
14: dfc941cd18d ! 8: d2cdfad10f5 Makefile: refactor GIT-VERSION-GEN to be reusable
@@ Commit message
easier to compute the same version as our Makefile would without having
to write the "GIT-VERSION-FILE".
- We should ideally refactor our CMake build instructions to stop writing
- into the source directory. But this step is out of scope of the current
- patch series.
-
Signed-off-by: Patrick Steinhardt <ps@pks.im>
## GIT-VERSION-GEN ##
@@ GIT-VERSION-GEN
#!/bin/sh
-GVF=GIT-VERSION-FILE
- DEF_VER=v2.47.0
+ DEF_VER=v2.47.GIT
LF='
@@ GIT-VERSION-GEN: fi
@@ Makefile: include shared.mak
# Set our default configuration.
## contrib/buildsystems/CMakeLists.txt ##
-@@ contrib/buildsystems/CMakeLists.txt: endif()
- if(NOT EXISTS ${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE)
- message("Generating GIT-VERSION-FILE")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN
-- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
-+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
-+ OUTPUT_VARIABLE GIT_VERSION
-+ OUTPUT_STRIP_TRAILING_WHITESPACE)
-+ file(WRITE ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "GIT_VERSION = '${GIT_VERSION}'\n")
+@@ contrib/buildsystems/CMakeLists.txt: if(NOT SH_EXE)
+ "On Windows, you can get it as part of 'Git for Windows' install at https://gitforwindows.org/")
endif()
+-#Create GIT-VERSION-FILE using GIT-VERSION-GEN
+-if(NOT EXISTS ${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE)
+- message("Generating GIT-VERSION-FILE")
+- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN
+- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
+-endif()
++execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN
++ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
++ OUTPUT_VARIABLE git_version
++ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
#Parse GIT-VERSION-FILE to get the version
+-file(STRINGS ${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE git_version REGEX "GIT_VERSION = (.*)")
+-string(REPLACE "GIT_VERSION = " "" git_version ${git_version})
+ string(FIND ${git_version} "GIT" location)
+ if(location EQUAL -1)
+ string(REGEX MATCH "[0-9]*\\.[0-9]*\\.[0-9]*" git_version ${git_version})
15: e468d3751f0 ! 9: 9be0719ce1b Makefile: refactor generators to be PWD-independent
@@ contrib/buildsystems/CMakeLists.txt: set(EXCLUSION_PROGS_CACHE ${EXCLUSION_PROGS
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-configlist.sh
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_FILE ${CMAKE_BINARY_DIR}/config-list.h)
-+ execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-configlist.sh ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}/config.list)
++ execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-configlist.sh ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}/config-list.h)
endif()
if(NOT EXISTS ${CMAKE_BINARY_DIR}/hook-list.h)
19: 9fd1aeb1e96 ! 10: 93869e53178 Makefile: allow "bin-wrappers/" directory to exist
@@ Makefile: test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_
-bin-wrappers/%: wrap-for-bin.sh
- $(call mkdir_p_parent_template)
-+bin-wrappers/%: bin-wrappers/wrap-for-bin.sh
++$(test_bindir_programs): bin-wrappers/%: bin-wrappers/wrap-for-bin.sh
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@BUILD_DIR@|$(shell pwd)|' \
-e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
20: 4eda54cf0f5 ! 11: 1c37d6d1f19 Makefile: simplify building of templates
@@ Commit message
Signed-off-by: Patrick Steinhardt <ps@pks.im>
## contrib/buildsystems/CMakeLists.txt ##
-@@ contrib/buildsystems/CMakeLists.txt: endforeach()
+@@ contrib/buildsystems/CMakeLists.txt: project(git
+ #TODO Enable NLS on windows natively
+ #macros for parsing the Makefile for sources and scripts
+-macro(parse_makefile_for_sources list_var regex)
+- file(STRINGS ${CMAKE_SOURCE_DIR}/Makefile ${list_var} REGEX "^${regex} \\+=(.*)")
++macro(parse_makefile_for_sources list_var makefile regex)
++ file(STRINGS ${makefile} ${list_var} REGEX "^${regex} \\+=(.*)")
+ string(REPLACE "${regex} +=" "" ${list_var} ${${list_var}})
+ string(REPLACE "$(COMPAT_OBJS)" "" ${list_var} ${${list_var}}) #remove "$(COMPAT_OBJS)" This is only for libgit.
+ string(STRIP ${${list_var}} ${list_var}) #remove trailing/leading whitespaces
+@@ contrib/buildsystems/CMakeLists.txt: include_directories(${CMAKE_BINARY_DIR})
- #templates
--file(GLOB templates "${CMAKE_SOURCE_DIR}/templates/*")
-+file(GLOB templates "${CMAKE_SOURCE_DIR}/templates/**")
- list(TRANSFORM templates REPLACE "${CMAKE_SOURCE_DIR}/templates/" "")
- list(REMOVE_ITEM templates ".gitignore")
- list(REMOVE_ITEM templates "Makefile")
- list(REMOVE_ITEM templates "blt")# Prevents an error when reconfiguring for in source builds
+ #build
+ #libgit
+-parse_makefile_for_sources(libgit_SOURCES "LIB_OBJS")
++parse_makefile_for_sources(libgit_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "LIB_OBJS")
+
+ list(TRANSFORM libgit_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
+ list(TRANSFORM compat_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
+ add_library(libgit ${libgit_SOURCES} ${compat_SOURCES})
+
+ #libxdiff
+-parse_makefile_for_sources(libxdiff_SOURCES "XDIFF_OBJS")
++parse_makefile_for_sources(libxdiff_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "XDIFF_OBJS")
+
+ list(TRANSFORM libxdiff_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
+ add_library(xdiff STATIC ${libxdiff_SOURCES})
+
+ #reftable
+-parse_makefile_for_sources(reftable_SOURCES "REFTABLE_OBJS")
++parse_makefile_for_sources(reftable_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "REFTABLE_OBJS")
+
+ list(TRANSFORM reftable_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
+ add_library(reftable STATIC ${reftable_SOURCES})
+@@ contrib/buildsystems/CMakeLists.txt: elseif(UNIX)
+ endif()
+
+ #git
+-parse_makefile_for_sources(git_SOURCES "BUILTIN_OBJS")
++parse_makefile_for_sources(git_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "BUILTIN_OBJS")
+ list(TRANSFORM git_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
+ add_executable(git ${CMAKE_SOURCE_DIR}/git.c ${git_SOURCES})
+@@ contrib/buildsystems/CMakeLists.txt: file(STRINGS ${CMAKE_SOURCE_DIR}/git-p4.py content NEWLINE_CONSUME)
+ string(REPLACE "#!/usr/bin/env python" "#!/usr/bin/python" content "${content}")
+ file(WRITE ${CMAKE_BINARY_DIR}/git-p4 ${content})
+
+-#templates
+-file(GLOB templates "${CMAKE_SOURCE_DIR}/templates/*")
+-list(TRANSFORM templates REPLACE "${CMAKE_SOURCE_DIR}/templates/" "")
+-list(REMOVE_ITEM templates ".gitignore")
+-list(REMOVE_ITEM templates "Makefile")
+-list(REMOVE_ITEM templates "blt")# Prevents an error when reconfiguring for in source builds
+-
-list(REMOVE_ITEM templates "branches--")
-file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/templates/blt/branches) #create branches
-
++#${CMAKE_SOURCE_DIR}/Makefile templates
++parse_makefile_for_sources(templates ${CMAKE_SOURCE_DIR}/templates/Makefile "TEMPLATES")
++string(REPLACE " " ";" templates ${templates})
#templates have @.*@ replacement so use configure_file instead
foreach(tm ${templates})
- string(REPLACE "--" "/" blt_tm ${tm})
- string(REPLACE "this" "" blt_tm ${blt_tm})# for this--
- configure_file(${CMAKE_SOURCE_DIR}/templates/${tm} ${CMAKE_BINARY_DIR}/templates/blt/${blt_tm} @ONLY)
+- configure_file(${CMAKE_SOURCE_DIR}/templates/${tm} ${CMAKE_BINARY_DIR}/templates/blt/${blt_tm} @ONLY)
++ configure_file(${CMAKE_SOURCE_DIR}/templates/${tm} ${CMAKE_BINARY_DIR}/templates/blt/${tm} @ONLY)
endforeach()
-
#translations
if(MSGFMT_EXE)
file(GLOB po_files "${CMAKE_SOURCE_DIR}/po/*.po")
+@@ contrib/buildsystems/CMakeLists.txt: add_executable(test-fake-ssh ${CMAKE_SOURCE_DIR}/t/helper/test-fake-ssh.c)
+ target_link_libraries(test-fake-ssh common-main)
+
+ #unit-tests
+-parse_makefile_for_sources(unit-test_SOURCES "UNIT_TEST_OBJS")
++parse_makefile_for_sources(unit-test_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "UNIT_TEST_OBJS")
+ list(TRANSFORM unit-test_SOURCES REPLACE "\\$\\(UNIT_TEST_DIR\\)/" "${CMAKE_SOURCE_DIR}/t/unit-tests/")
+ add_library(unit-test-lib STATIC ${unit-test_SOURCES})
+
+@@ contrib/buildsystems/CMakeLists.txt: if(MSVC)
+ endif()
+
+ #test-tool
+-parse_makefile_for_sources(test-tool_SOURCES "TEST_BUILTINS_OBJS")
++parse_makefile_for_sources(test-tool_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "TEST_BUILTINS_OBJS")
+ add_library(test-lib OBJECT ${CMAKE_SOURCE_DIR}/t/unit-tests/test-lib.c)
+
+ list(TRANSFORM test-tool_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/t/helper/")
## templates/Makefile ##
@@ templates/Makefile: all: boilerplates.made custom
@@ templates/Makefile: all: boilerplates.made custom
-boilerplates.made : $(bpsrc)
- $(QUIET)umask 022 && ls *--* 2>/dev/null | \
- while read boilerplate; \
-+TEMPLATES = description
++TEMPLATES =
++TEMPLATES += description
+TEMPLATES += hooks/applypatch-msg.sample
+TEMPLATES += hooks/commit-msg.sample
+TEMPLATES += hooks/fsmonitor-watchman.sample
21: 1172c440600 ! 12: c45d2df6b8d t: better support for out-of-tree builds
@@ GIT-BUILD-OPTIONS.in: GIT_PERF_MAKE_COMMAND=@GIT_PERF_MAKE_COMMAND@
+GIT_TEST_GITPERLLIB=@GIT_TEST_GITPERLLIB@
+GIT_TEST_MERGE_TOOLS_DIR=@GIT_TEST_MERGE_TOOLS_DIR@
RUNTIME_PREFIX=@RUNTIME_PREFIX@
+ GITWEBDIR=@GITWEBDIR@
+ USE_GETTEXT_SCHEME=@USE_GETTEXT_SCHEME@
## Makefile ##
@@ Makefile: GIT-BUILD-OPTIONS: FORCE
@@ Makefile: GIT-BUILD-OPTIONS: FORCE
+ -e "s|@GIT_TEST_GITPERLLIB@|\'$(shell pwd)/perl/build/lib\'|" \
+ -e "s|@GIT_TEST_MERGE_TOOLS_DIR@|\'$(shell pwd)/mergetools\'|" \
-e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX)\'|" \
- GIT-BUILD-OPTIONS.in >$@+
- @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
+ -e "s|@GITWEBDIR@|\'$(gitwebdir_SQ)\'|" \
+ -e "s|@USE_GETTEXT_SCHEME@|\'$(USE_GETTEXT_SCHEME)\'|" \
@@ Makefile: all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PR
- bin-wrappers/%: bin-wrappers/wrap-for-bin.sh
+ $(test_bindir_programs): bin-wrappers/%: bin-wrappers/wrap-for-bin.sh
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@BUILD_DIR@|$(shell pwd)|' \
+ -e 's|@GIT_TEXTDOMAINDIR@|$(shell pwd)/po/build/locale|' \
@@ contrib/buildsystems/CMakeLists.txt: endforeach()
string(REPLACE "@PROG@" "git-cvsserver" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})
-@@ contrib/buildsystems/CMakeLists.txt: string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_optio
+@@ contrib/buildsystems/CMakeLists.txt: string(REPLACE "@GIT_PERF_MAKE_COMMAND@" "" git_build_options "${git_build_optio
+ string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_options}")
string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}")
string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}")
- string(REPLACE "@RUNTIME_PREFIX@" "${RUNTIME_PREFIX}" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_TEXTDOMAINDIR@" "${CMAKE_BINARY_DIR}/po/build/locale" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_POPATH@" "${CMAKE_BINARY_DIR}/po" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_TEMPLATE_DIR@" "${CMAKE_BINARY_DIR}/templates/blt" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_GITPERLLIB@" "${CMAKE_BINARY_DIR}/perl/build/lib" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_MERGE_TOOLS_DIR@" "${RUNTIME_PREFIX}" git_build_options "${git_build_options}")
- if(USE_VCPKG)
- string(APPEND git_build_options "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
- endif()
+ string(REPLACE "@RUNTIME_PREFIX@" "${RUNTIME_PREFIX}" git_build_options "${git_build_options}")
+ string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" git_build_options "${git_build_options}")
+ string(REPLACE "@USE_GETTEXT_SCHEME@" "" git_build_options "${git_build_options}")
## t/lib-gettext.sh ##
@@
22: b5cd5250b77 = 13: 542b01515e1 t: allow overriding build dir
23: afa2f79d46c ! 14: bd59e31bb55 Documentation: add comparison of build systems
@@ Documentation/technical/build-systems.txt (new)
+== Requirements
+
+The following subsections present a list of requirements that we have for any
-+potential build system. Sections are sorted by decreasing priority, even though
-+these priorities will naturally differ between users.
++potential build system. Sections are sorted by decreasing priority.
+
+=== Platform support
+
-+The build system must have support for all of our primary platforms as outlined
-+by. These platforms are:
++The build system must have support for all of our platforms that we continually
++test against as outlined by our platform support policy. These platforms are:
+
+ - Linux
+ - Windows
+ - macOS
+
-+Furthermore, the build system should have support for the following secondary
-+platforms:
++Furthermore, the build system should have support for the following platforms
++that generally have somebody running test pipelines against regularly:
+
+ - AIX
+ - FreeBSD
+ - NetBSD
++ - NonStop
+ - OpenBSD
+
+The platforms which must be supported by the tool should be aligned with our
@@ Documentation/technical/build-systems.txt (new)
+ - Detection of available features.
+ - Discovery of relevant toolchains.
+ - Linking libraries and executables.
++ - Templating placeholders in scripts.
+
+=== Test integration
+
@@ Documentation/technical/build-systems.txt (new)
+ - Track build-time dependencies for respective tests. Unit tests have
+ different requirements than integration tests.
+ - Allow filtering of which tests to run.
-+ - Allow interactive tests that drop the user into a shell with `test_pause` or
-+ `debug`.
++ - Allow running tests such that utilities like `test_pause` or `debug` work.
+
+== Comparison
+
24: 724232b0fad ! 15: ac327d98e9c Introduce support for the Meson build system
@@ Commit message
- Apple macOS 10.15.
- - FreeBSD 14.1, except gitweb-based tests.
+ - FreeBSD 14.1.
- NixOS 24.11.
+ - OpenBSD 7.6.
+
- Ubuntu 24.04.
- - Windows 10 with Cygwin, using `-Dperl=disabled -Dpython=disabled`.
+ - 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 MinGW64, using `-Dperl=disabled -Dpython=disabled`.
+ - 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 MSVC 2022, using `-Dperl=disabled -Dpython=disabled
- -Dgettext=disabled -Diconv=disabled --wrap-mode=forcefallback`.
+ - 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
@@ Commit message
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>
## bin-wrappers/meson.build (new) ##
@@ contrib/meson.build (new)
## gitweb/meson.build (new) ##
@@
++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_VERSION', git_version)
++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(script,
+ input: 'gitweb.perl',
+ output: 'gitweb.cgi',
-+ configuration: {
-+ 'GIT_VERSION': meson.project_version(),
-+ 'GIT_BINDIR': get_option('prefix') / get_option('bindir'),
-+ 'GITWEB_CONFIG': get_option('gitweb_config'),
-+ 'GITWEB_CONFIG_SYSTEM': get_option('gitweb_config_system'),
-+ 'GITWEB_CONFIG_COMMON': get_option('gitweb_config_common'),
-+ 'GITWEB_HOME_LINK_STR': get_option('gitweb_home_link_str'),
-+ 'GITWEB_SITENAME': get_option('gitweb_sitename'),
-+ 'GITWEB_PROJECTROOT': get_option('gitweb_projectroot'),
-+ 'GITWEB_PROJECT_MAXDEPTH': get_option('gitweb_project_maxdepth'),
-+ 'GITWEB_EXPORT_OK': get_option('gitweb_export_ok'),
-+ 'GITWEB_STRICT_EXPORT': get_option('gitweb_strict_export'),
-+ 'GITWEB_BASE_URL': get_option('gitweb_base_url'),
-+ 'GITWEB_LIST': get_option('gitweb_list'),
-+ 'GITWEB_HOMETEXT': get_option('gitweb_hometext'),
-+ 'GITWEB_CSS': get_option('gitweb_css'),
-+ 'GITWEB_LOGO': get_option('gitweb_logo'),
-+ 'GITWEB_FAVICON': get_option('gitweb_favicon'),
-+ 'GITWEB_JS': get_option('gitweb_js'),
-+ 'GITWEB_SITE_HTML_HEAD_STRING': get_option('gitweb_site_html_head_string'),
-+ 'GITWEB_SITE_HEADER': get_option('gitweb_site_header'),
-+ 'GITWEB_SITE_FOOTER': get_option('gitweb_site_footer'),
-+ 'HIGHLIGHT_BIN': get_option('highlight_bin'),
-+ },
++ command: [
++ shell,
++ meson.current_source_dir() / 'generate-gitweb.sh',
++ meson.current_build_dir() / 'GITWEB-BUILD-OPTIONS',
++ '@INPUT@',
++ '@OUTPUT@',
++ ],
+ install: true,
+ install_dir: get_option('datadir') / 'gitweb',
+)
+
-+subdir('static')
-
- ## gitweb/static/meson.build (new) ##
-@@
+foreach asset : [
-+ 'git-favicon.png',
-+ 'git-logo.png',
-+ 'gitweb.css',
++ 'static/git-favicon.png',
++ 'static/git-logo.png',
++ 'static/gitweb.css',
++ 'static/js/adjust-timezone.js',
++ 'static/js/blame_incremental.js',
++ 'static/js/javascript-detection.js',
++ 'static/js/lib/common-lib.js',
++ 'static/js/lib/cookies.js',
++ 'static/js/lib/datetime.js',
+]
+ fs.copyfile(asset,
+ install: true,
-+ install_dir: get_option('datadir') / 'gitweb/static',
++ install_dir: get_option('datadir') / 'gitweb' / fs.parent(asset),
+ )
+endforeach
-+
-+javascript_sources = [
-+ meson.current_source_dir() / 'js/adjust-timezone.js',
-+ meson.current_source_dir() / 'js/blame_incremental.js',
-+ meson.current_source_dir() / 'js/javascript-detection.js',
-+ meson.current_source_dir() / 'js/lib/common-lib.js',
-+ meson.current_source_dir() / 'js/lib/cookies.js',
-+ meson.current_source_dir() / 'js/lib/datetime.js',
-+]
-+
-+custom_target(
-+ input: javascript_sources,
-+ output: 'gitweb.js',
-+ capture: true,
-+ command: ['cat'] + javascript_sources,
-+ install: true,
-+ install_dir: get_option('datadir') / 'gitweb/static',
-+)
## meson.build (new) ##
@@
@@ meson.build (new)
+ # MSVC does not support GNU99, and C99 does not define __STDC_VERSION__
+ # on MSVC. So we instead fall back to C11 there.
+ default_options: ['c_std=gnu99,c11'],
-+ version: run_command('GIT-VERSION-GEN', check: true).stdout().strip(),
++ version: 'v2.47.GIT',
+)
+
+fs = import('fs')
+
-+compiler = meson.get_compiler('c')
++program_path = []
++# Git for Windows provides all the tools we need to build Git.
++if host_machine.system() == 'windows'
++ program_path += [ 'C:/Program Files/Git/bin', 'C:/Program Files/Git/usr/bin' ]
++endif
+
-+cygpath = find_program('cygpath', required: false)
-+shell = find_program('sh')
-+tar = find_program('tar')
-+diff = find_program('diff')
++awk = find_program('awk', dirs: program_path)
++cygpath = find_program('cygpath', dirs: program_path, required: false)
++diff = find_program('diff', dirs: program_path)
++shell = find_program('sh', dirs: program_path)
++tar = find_program('tar', dirs: program_path)
++
++script_environment = environment()
++foreach tool : ['cat', 'cut', 'git', 'grep', 'sed', 'sort', 'tr', 'uname']
++ program = find_program(tool, dirs: program_path)
++ script_environment.prepend('PATH', fs.parent(program.full_path()))
++endforeach
++
++git_version = run_command(shell, 'GIT-VERSION-GEN', check: false, env: script_environment).stdout().strip()
++if git_version == ''
++ git_version = meson.project_version()
++endif
++
++compiler = meson.get_compiler('c')
+
+libgit_sources = [
+ 'abspath.c',
@@ meson.build (new)
+ 'reftable/block.c',
+ 'reftable/blocksource.c',
+ 'reftable/iter.c',
-+ 'reftable/publicbasics.c',
+ 'reftable/merged.c',
+ 'reftable/pq.c',
+ 'reftable/reader.c',
@@ meson.build (new)
+ 'builtin/write-tree.c',
+]
+
-+script_environment = environment()
-+foreach tool : ['cat', 'cut', 'grep', 'sed', 'sort', 'tr', 'uname']
-+ program = find_program(tool)
-+ script_environment.prepend('PATH', fs.parent(program.full_path()))
-+endforeach
-+
+libgit_sources += custom_target(
+ 'command-list.h',
+ input: 'command-list.txt',
@@ meson.build (new)
+build_options_config.set('GIT_TEST_UTF8_LOCALE', '')
+build_options_config.set('SANITIZE_ADDRESS', '')
+build_options_config.set('SANITIZE_LEAK', '')
++build_options_config.set('BROKEN_PATH_FIX', '')
++build_options_config.set_quoted('LOCALEDIR', fs.as_posix(get_option('prefix') / get_option('localedir')))
++build_options_config.set('GITWEBDIR', fs.as_posix(get_option('prefix') / get_option('datadir') / 'gitweb'))
+
+test_output_directory = get_option('test_output_directory')
+if test_output_directory == ''
@@ meson.build (new)
+
+# Note that we only set NO_PERL if the Perl features were disabled by the user.
+# It may not be set when we have found Perl, but only use it to run tests.
-+perl = find_program('perl', version: '>=5.8.1', required: perl_required)
++perl = find_program('perl', version: '>=5.8.1', dirs: program_path, required: perl_required)
+perl_features_enabled = perl.found() and get_option('perl').allowed()
+if perl_features_enabled
+ build_options_config.set('NO_PERL', '')
++
++ if get_option('runtime_prefix')
++ build_options_config.set('PERL_LOCALEDIR', '')
++ else
++ build_options_config.set_quoted('PERL_LOCALEDIR', fs.as_posix(get_option('prefix') / get_option('localedir')))
++ endif
++
++ if get_option('perl_cpan_fallback')
++ build_options_config.set('NO_PERL_CPAN_FALLBACKS', '')
++ else
++ build_options_config.set_quoted('NO_PERL_CPAN_FALLBACKS', 'YesPlease')
++ endif
+else
+ libgit_c_args += '-DNO_PERL'
+ build_options_config.set('NO_PERL', '1')
++ build_options_config.set('PERL_LOCALEDIR', '')
++ build_options_config.set('NO_PERL_CPAN_FALLBACKS', '')
+endif
+
+zlib = dependency('zlib', default_options: ['default_library=static', 'tests=disabled'])
-+if zlib.type_name() != 'internal' and not compiler.has_function('deflateBound',
-+ prefix: '#include <zlib.h>',
-+ dependencies: zlib,
-+)
++if zlib.version().version_compare('<1.2.0')
+ libgit_c_args += '-DNO_DEFLATE_BOUND'
+endif
+libgit_dependencies += zlib
@@ meson.build (new)
+if intl.found()
+ libgit_dependencies += intl
+ build_options_config.set('NO_GETTEXT', '')
++ build_options_config.set('USE_GETTEXT_SCHEME', '')
+else
+ libgit_c_args += '-DNO_GETTEXT'
+ build_options_config.set('NO_GETTEXT', '1')
++ build_options_config.set('USE_GETTEXT_SCHEME', 'fallthrough')
+endif
+
+iconv = dependency('iconv', required: get_option('iconv'))
@@ meson.build (new)
+libgit_version_library = static_library('git-version',
+ sources: ['version.c'],
+ c_args: libgit_c_args + [
-+ '-DGIT_VERSION="' + meson.project_version() + '"',
-+ '-DGIT_USER_AGENT="' + 'git/' + meson.project_version() + '"',
++ '-DGIT_VERSION="' + git_version + '"',
++ '-DGIT_USER_AGENT="' + 'git/' + git_version + '"',
+ '-DGIT_BUILT_FROM_COMMIT="' + run_command('git', 'rev-parse', '-q', '--verify', 'HEAD', check: false).stdout().strip() + '"',
+ ],
+ dependencies: libgit_dependencies,
@@ meson.build (new)
+ '-DMINOR=1',
+ '-DMICRO=1',
+ '-DPATCHLEVEL=0',
-+ '-DGIT_VERSION=\\\"' + meson.project_version() + '.GIT\\\"',
++ '-DGIT_VERSION=\\\"' + git_version + '.GIT\\\"',
+ ])
+ if compiler.get_argument_syntax() == 'gcc'
+ common_main_link_args += [
@@ meson.build (new)
+ )
+endforeach
+
-+script_sh_config = configuration_data()
-+script_sh_config.set('BROKEN_PATH_FIX', '')
-+script_sh_config.set('DIFF', fs.as_posix(diff.full_path()))
-+script_sh_config.set('PAGER_ENV', get_option('pager_environment'))
-+script_sh_config.set('PERL_PATH', perl.found() ? fs.as_posix(perl.full_path()) : '')
-+script_sh_config.set('SHELL_PATH', fs.as_posix(shell.full_path()))
-+script_sh_config.set_quoted('LOCALEDIR', fs.as_posix(get_option('prefix') / get_option('localedir')))
-+if intl.found()
-+ script_sh_config.set('USE_GETTEXT_SCHEME', '')
-+else
-+ script_sh_config.set('USE_GETTEXT_SCHEME', 'fallthrough')
-+endif
-+script_sh_config.set('GITWEBDIR', fs.as_posix(get_option('prefix') / get_option('datadir') / 'gitweb'))
-+
+scripts_sh = [
+ 'git-difftool--helper.sh',
+ 'git-filter-branch.sh',
+ 'git-merge-octopus.sh',
+ 'git-merge-one-file.sh',
+ 'git-merge-resolve.sh',
++ 'git-mergetool--lib.sh',
+ 'git-mergetool.sh',
+ 'git-quiltimport.sh',
+ 'git-request-pull.sh',
++ 'git-sh-i18n.sh',
++ 'git-sh-setup.sh',
+ 'git-submodule.sh',
+ 'git-web--browse.sh',
+]
-+
+if perl_features_enabled
+ scripts_sh += 'git-instaweb.sh'
+endif
+
+foreach script : scripts_sh
-+ configure_file(
++ test_dependencies += custom_target(script,
+ input: script,
+ output: fs.stem(script),
-+ configuration: script_sh_config,
-+ install: true,
-+ install_dir: get_option('libexecdir') / 'git-core',
-+ )
-+endforeach
-+
-+scripts_lib = [
-+ 'git-mergetool--lib.sh',
-+ 'git-sh-i18n.sh',
-+ 'git-sh-setup.sh',
-+]
-+
-+foreach script : scripts_lib
-+ configure_file(
-+ input: script,
-+ output: fs.stem(script),
-+ configuration: script_sh_config,
++ command: [
++ shell,
++ meson.project_source_root() / 'generate-script.sh',
++ '@INPUT@',
++ '@OUTPUT@',
++ meson.project_build_root() / 'GIT-BUILD-OPTIONS',
++ ],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
@@ meson.build (new)
+ },
+ )
+
++ generate_perl_command = [
++ shell,
++ meson.project_source_root() / 'generate-perl.sh',
++ meson.project_build_root() / 'GIT-BUILD-OPTIONS',
++ git_version,
++ perl_header,
++ '@INPUT@',
++ '@OUTPUT@',
++ ]
++
+ foreach script : scripts_perl
+ generated_script = custom_target(script,
+ input: script,
+ output: fs.stem(script),
-+ command: [
-+ shell,
-+ meson.project_source_root() / 'generate-perl.sh',
-+ meson.project_version(),
-+ perl_header,
-+ perl.full_path(),
-+ '@INPUT@',
-+ '@OUTPUT@',
-+ ],
++ command: generate_perl_command,
+ install: true,
+ install_dir: get_option('datadir') / 'perl5',
+ )
@@ meson_options.txt (new)
+ 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: 'enabled',
++option('gettext', type: 'feature', value: 'auto',
+ description: 'Build translation files.')
-+option('iconv', type: 'feature', value: 'enabled',
++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: 'enabled',
++option('perl', type: 'feature', value: 'auto',
+ description: 'Build tools written in Perl.')
+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('python', type: 'feature', value: 'enabled',
++option('python', type: 'feature', value: 'auto',
+ description: 'Build tools written in Python.')
+
+option('openssl', type: 'feature', value: 'auto',
@@ meson_options.txt (new)
## perl/FromCPAN/Mail/meson.build (new) ##
@@
-+configure_file(
++test_dependencies += custom_target('Address.pm',
+ input: 'Address.pm',
+ output: 'Address.pm',
-+ configuration: perl_config,
++ command: generate_perl_command,
+ install: true,
+ install_dir: get_option('datadir') / 'perl5/FromCPAN/Mail',
+)
## perl/FromCPAN/meson.build (new) ##
@@
-+configure_file(
++test_dependencies += custom_target('Error.pm',
+ input: 'Error.pm',
+ output: 'Error.pm',
-+ configuration: perl_config,
++ command: generate_perl_command,
+ install: true,
+ install_dir: get_option('datadir') / 'perl5/FromCPAN',
+)
@@ perl/FromCPAN/meson.build (new)
## perl/Git/LoadCPAN/Mail/meson.build (new) ##
@@
-+configure_file(
++test_dependencies += custom_target('Address.pm',
+ input: 'Address.pm',
+ output: 'Address.pm',
-+ configuration: perl_config,
++ command: generate_perl_command,
+ install: true,
+ install_dir: get_option('datadir') / 'perl5/Git/LoadCPAN/Mail',
+)
## perl/Git/LoadCPAN/meson.build (new) ##
@@
-+configure_file(
++test_dependencies += custom_target('Error.pm',
+ input: 'Error.pm',
+ output: 'Error.pm',
-+ configuration: perl_config,
++ command: generate_perl_command,
+ install: true,
+ install_dir: get_option('datadir') / 'perl5/Git/LoadCPAN',
+)
@@ perl/Git/LoadCPAN/meson.build (new)
## perl/Git/SVN/Memoize/meson.build (new) ##
@@
-+configure_file(
++test_dependencies += custom_target('YAML.pm',
+ input: 'YAML.pm',
+ output: 'YAML.pm',
-+ configuration: perl_config,
++ command: generate_perl_command,
+ install: true,
+ install_dir: get_option('datadir') / 'perl5/Git/SVN',
+)
@@ perl/Git/SVN/meson.build (new)
+ 'Ra.pm',
+ 'Utils.pm',
+]
-+ configure_file(
++ test_dependencies += custom_target(source,
+ input: source,
+ output: source,
-+ configuration: perl_config,
++ command: generate_perl_command,
+ install: true,
+ install_dir: get_option('datadir') / 'perl5/Git/SVN',
+ )
@@ perl/Git/meson.build (new)
+ 'Packet.pm',
+ 'SVN.pm',
+]
-+ configure_file(
++ test_dependencies += custom_target(source,
+ input: source,
+ output: source,
-+ configuration: perl_config,
++ command: generate_perl_command,
+ install: true,
+ install_dir: get_option('datadir') / 'perl5/Git',
+ )
@@ perl/Git/meson.build (new)
## perl/meson.build (new) ##
@@
-+perl_config = {
-+ 'LOCALEDIR': get_option('prefix') / get_option('datadir') / 'locale',
-+ 'NO_GETTEXT': iconv.found() ? '' : '1',
-+ 'NO_PERL_CPAN_FALLBACKS': get_option('perl_cpan_fallback') ? '' : '1',
-+}
-+
-+configure_file(
++test_dependencies += custom_target('Git.pm',
+ input: 'Git.pm',
+ output: 'Git.pm',
-+ configuration: perl_config,
++ command: generate_perl_command,
+ install: true,
+ install_dir: get_option('datadir') / 'perl5',
+)
@@ po/meson.build (new)
+)
+test_dependencies += translations[0]
+ ## subprojects/.gitignore (new) ##
+@@
++/*/
+
## subprojects/curl.wrap (new) ##
@@
+[wrap-file]
@@ t/helper/meson.build (new)
## t/meson.build (new) ##
@@
-+awk = find_program('awk')
-+
+clar_test_suites = [
+ 'unit-tests/ctype.c',
+ 'unit-tests/strvec.c',
@@ templates/hooks/meson.build (new)
+ configure_file(
+ input: hook,
+ output: hook,
-+ configuration: script_sh_config,
++ configuration: template_config,
+ )
+endforeach
@@ templates/info/meson.build (new)
+configure_file(
+ input: 'exclude',
+ output: 'exclude',
-+ configuration: script_sh_config,
++ configuration: template_config,
+)
## templates/meson.build (new) ##
@@
++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: script_sh_config,
++ configuration: template_config,
+)
+
+subdir('hooks')
--
2.47.0.72.gef8ce8f3d4.dirty
^ permalink raw reply [flat|nested] 386+ messages in thread
* [RFC PATCH v3 01/15] Makefile: use common template for GIT-BUILD-OPTIONS
2024-10-18 12:23 ` [RFC PATCH v3 00/15] Modernize the " Patrick Steinhardt
@ 2024-10-18 12:23 ` Patrick Steinhardt
2024-10-19 5:00 ` Eric Sunshine
2024-10-18 12:23 ` [RFC PATCH v3 02/15] Makefile: consistently use @PLACEHOLDER@ to substitute Patrick Steinhardt
` (16 subsequent siblings)
17 siblings, 1 reply; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-18 12:23 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones
The "GIT-BUILD-OPTIONS" file is generated by our build systems to
propagate built-in features and paths to our tests. The generation is
done ad-hoc, where both our Makefile and the CMake build instructions
simply echo a bunch of strings into the file. This makes it very hard to
figure out what variables are expected to exist and what format they
have, and the written variables can easily get out of sync between build
systems.
Introduce a new "GIT-BUILD-OPTIONS.in" template to address this issue.
This has multiple advantages:
- It demonstrates which built options exist in the first place.
- It can serve as a spot to document the build options.
- Some build systems complain when not all variables could be
substituted, alerting us of mismatches. Others don't, but if we
forgot to substitute such variables we now have a bogus string that
will likely cause our tests to fail, if they have any meaning in the
first place.
Backfill values that we didn't yet set in our CMake build instructions.
While at it, remove the `SUPPORTS_SIMPLE_IPC` variable that we only set
up in CMake as it isn't used anywhere.
Note that this change requires us to move around the setup of
TEST_OUTPUT_DIRECTORY in "test-lib.sh" such that it comes after sourcing
the "GIT-BUILD-OPTIONS" file. This is the only instance I could find
where we rely on ordering on variables.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-BUILD-OPTIONS.in | 36 ++++++++++
Makefile | 108 ++++++++++------------------
contrib/buildsystems/CMakeLists.txt | 58 ++++++++++-----
t/test-lib.sh | 13 ++--
4 files changed, 120 insertions(+), 95 deletions(-)
create mode 100644 GIT-BUILD-OPTIONS.in
diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in
new file mode 100644
index 00000000000..f0ca240493c
--- /dev/null
+++ b/GIT-BUILD-OPTIONS.in
@@ -0,0 +1,36 @@
+SHELL_PATH=@SHELL_PATH@
+TEST_SHELL_PATH=@TEST_SHELL_PATH@
+PERL_PATH=@PERL_PATH@
+DIFF=@DIFF@
+PYTHON_PATH=@PYTHON_PATH@
+TAR=@TAR@
+NO_CURL=@NO_CURL@
+NO_ICONV=@NO_ICONV@
+NO_EXPAT=@NO_EXPAT@
+USE_LIBPCRE2=@USE_LIBPCRE2@
+NO_PERL=@NO_PERL@
+NO_PTHREADS=@NO_PTHREADS@
+NO_PYTHON=@NO_PYTHON@
+NO_REGEX=@NO_REGEX@
+NO_UNIX_SOCKETS=@NO_UNIX_SOCKETS@
+PAGER_ENV=@PAGER_ENV@
+SANITIZE_LEAK=@SANITIZE_LEAK@
+SANITIZE_ADDRESS=@SANITIZE_ADDRESS@
+X=@X@
+FSMONITOR_DAEMON_BACKEND=@FSMONITOR_DAEMON_BACKEND@
+FSMONITOR_OS_SETTINGS=@FSMONITOR_OS_SETTINGS@
+TEST_OUTPUT_DIRECTORY=@TEST_OUTPUT_DIRECTORY@
+GIT_TEST_OPTS=@GIT_TEST_OPTS@
+GIT_TEST_CMP=@GIT_TEST_CMP@
+GIT_TEST_CMP_USE_COPIED_CONTEXT=@GIT_TEST_CMP_USE_COPIED_CONTEXT@
+GIT_TEST_UTF8_LOCALE=@GIT_TEST_UTF8_LOCALE@
+NO_GETTEXT=@NO_GETTEXT@
+GIT_PERF_REPEAT_COUNT=@GIT_PERF_REPEAT_COUNT@
+GIT_PERF_REPO=@GIT_PERF_REPO@
+GIT_PERF_LARGE_REPO=@GIT_PERF_LARGE_REPO@
+GIT_PERF_MAKE_OPTS=@GIT_PERF_MAKE_OPTS@
+GIT_PERF_MAKE_COMMAND=@GIT_PERF_MAKE_COMMAND@
+GIT_INTEROP_MAKE_OPTS=@GIT_INTEROP_MAKE_OPTS@
+GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@
+GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@
+RUNTIME_PREFIX=@RUNTIME_PREFIX@
diff --git a/Makefile b/Makefile
index 9fd84415d83..7d4b5f04a04 100644
--- a/Makefile
+++ b/Makefile
@@ -3164,76 +3164,44 @@ GIT-LDFLAGS: FORCE
# that runs GIT-BUILD-OPTIONS, and then again to protect it
# and the first level quoting from the shell that runs "echo".
GIT-BUILD-OPTIONS: FORCE
- @echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@+
- @echo TEST_SHELL_PATH=\''$(subst ','\'',$(TEST_SHELL_PATH_SQ))'\' >>$@+
- @echo PERL_PATH=\''$(subst ','\'',$(PERL_PATH_SQ))'\' >>$@+
- @echo DIFF=\''$(subst ','\'',$(subst ','\'',$(DIFF)))'\' >>$@+
- @echo PYTHON_PATH=\''$(subst ','\'',$(PYTHON_PATH_SQ))'\' >>$@+
- @echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@+
- @echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@+
- @echo NO_ICONV=\''$(subst ','\'',$(subst ','\'',$(NO_ICONV)))'\' >>$@+
- @echo NO_EXPAT=\''$(subst ','\'',$(subst ','\'',$(NO_EXPAT)))'\' >>$@+
- @echo USE_LIBPCRE2=\''$(subst ','\'',$(subst ','\'',$(USE_LIBPCRE2)))'\' >>$@+
- @echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@+
- @echo NO_PTHREADS=\''$(subst ','\'',$(subst ','\'',$(NO_PTHREADS)))'\' >>$@+
- @echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@+
- @echo NO_REGEX=\''$(subst ','\'',$(subst ','\'',$(NO_REGEX)))'\' >>$@+
- @echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@+
- @echo PAGER_ENV=\''$(subst ','\'',$(subst ','\'',$(PAGER_ENV)))'\' >>$@+
- @echo SANITIZE_LEAK=\''$(subst ','\'',$(subst ','\'',$(SANITIZE_LEAK)))'\' >>$@+
- @echo SANITIZE_ADDRESS=\''$(subst ','\'',$(subst ','\'',$(SANITIZE_ADDRESS)))'\' >>$@+
- @echo X=\'$(X)\' >>$@+
-ifdef FSMONITOR_DAEMON_BACKEND
- @echo FSMONITOR_DAEMON_BACKEND=\''$(subst ','\'',$(subst ','\'',$(FSMONITOR_DAEMON_BACKEND)))'\' >>$@+
-endif
-ifdef FSMONITOR_OS_SETTINGS
- @echo FSMONITOR_OS_SETTINGS=\''$(subst ','\'',$(subst ','\'',$(FSMONITOR_OS_SETTINGS)))'\' >>$@+
-endif
-ifdef TEST_OUTPUT_DIRECTORY
- @echo TEST_OUTPUT_DIRECTORY=\''$(subst ','\'',$(subst ','\'',$(TEST_OUTPUT_DIRECTORY)))'\' >>$@+
-endif
-ifdef GIT_TEST_OPTS
- @echo GIT_TEST_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_OPTS)))'\' >>$@+
-endif
-ifdef GIT_TEST_CMP
- @echo GIT_TEST_CMP=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_CMP)))'\' >>$@+
-endif
-ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
- @echo GIT_TEST_CMP_USE_COPIED_CONTEXT=YesPlease >>$@+
-endif
-ifdef GIT_TEST_UTF8_LOCALE
- @echo GIT_TEST_UTF8_LOCALE=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_UTF8_LOCALE)))'\' >>$@+
-endif
- @echo NO_GETTEXT=\''$(subst ','\'',$(subst ','\'',$(NO_GETTEXT)))'\' >>$@+
-ifdef GIT_PERF_REPEAT_COUNT
- @echo GIT_PERF_REPEAT_COUNT=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPEAT_COUNT)))'\' >>$@+
-endif
-ifdef GIT_PERF_REPO
- @echo GIT_PERF_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPO)))'\' >>$@+
-endif
-ifdef GIT_PERF_LARGE_REPO
- @echo GIT_PERF_LARGE_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_LARGE_REPO)))'\' >>$@+
-endif
-ifdef GIT_PERF_MAKE_OPTS
- @echo GIT_PERF_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_OPTS)))'\' >>$@+
-endif
-ifdef GIT_PERF_MAKE_COMMAND
- @echo GIT_PERF_MAKE_COMMAND=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_COMMAND)))'\' >>$@+
-endif
-ifdef GIT_INTEROP_MAKE_OPTS
- @echo GIT_INTEROP_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_INTEROP_MAKE_OPTS)))'\' >>$@+
-endif
-ifdef GIT_TEST_INDEX_VERSION
- @echo GIT_TEST_INDEX_VERSION=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_INDEX_VERSION)))'\' >>$@+
-endif
-ifdef GIT_TEST_PERL_FATAL_WARNINGS
- @echo GIT_TEST_PERL_FATAL_WARNINGS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_PERL_FATAL_WARNINGS)))'\' >>$@+
-endif
-ifdef RUNTIME_PREFIX
- @echo RUNTIME_PREFIX=\'true\' >>$@+
-else
- @echo RUNTIME_PREFIX=\'false\' >>$@+
-endif
+ @sed \
+ -e "s|@SHELL_PATH@|\'$(SHELL_PATH_SQ)\'|" \
+ -e "s|@TEST_SHELL_PATH@|\'$(TEST_SHELL_PATH_SQ)\'|" \
+ -e "s|@PERL_PATH@|\'$(PERL_PATH_SQ)\'|" \
+ -e "s|@DIFF@|\'$(DIFF)\'|" \
+ -e "s|@PYTHON_PATH@|\'$(PYTHON_PATH_SQ)\'|" \
+ -e "s|@TAR@|\'$(TAR)\'|" \
+ -e "s|@NO_CURL@|\'$(NO_CURL)\'|" \
+ -e "s|@NO_ICONV@|\'$(NO_ICONV)\'|" \
+ -e "s|@NO_EXPAT@|\'$(NO_EXPAT)\'|" \
+ -e "s|@USE_LIBPCRE2@|\'$(USE_LIBPCRE2)\'|" \
+ -e "s|@NO_PERL@|\'$(NO_PERL)\'|" \
+ -e "s|@NO_PTHREADS@|\'$(NO_PTHREADS)\'|" \
+ -e "s|@NO_PYTHON@|\'$(NO_PYTHON)\'|" \
+ -e "s|@NO_REGEX@|\'$(NO_REGEX)\'|" \
+ -e "s|@NO_UNIX_SOCKETS@|\'$(NO_UNIX_SOCKETS)\'|" \
+ -e "s|@PAGER_ENV@|\'$(PAGER_ENV)\'|" \
+ -e "s|@SANITIZE_LEAK@|\'$(SANITIZE_LEAK)\'|" \
+ -e "s|@SANITIZE_ADDRESS@|\'$(SANITIZE_ADDRESS)\'|" \
+ -e "s|@X@|\'$(X)\'|" \
+ -e "s|@FSMONITOR_DAEMON_BACKEND@|\'$(FSMONITOR_DAEMON_BACKEND)\'|" \
+ -e "s|@FSMONITOR_OS_SETTINGS@|\'$(FSMONITOR_OS_SETTINGS)\'|" \
+ -e "s|@TEST_OUTPUT_DIRECTORY@|\'$(TEST_OUTPUT_DIRECTORY)\'|" \
+ -e "s|@GIT_TEST_OPTS@|\'$(GIT_TEST_OPTS)\'|" \
+ -e "s|@GIT_TEST_CMP@|\'$(GIT_TEST_CMP)\'|" \
+ -e "s|@GIT_TEST_CMP_USE_COPIED_CONTEXT@|\'$(GIT_TEST_CMP_USE_COPIED_CONTEXT)\'|" \
+ -e "s|@GIT_TEST_UTF8_LOCALE@|\'$(GIT_TEST_UTF8_LOCALE)\'|" \
+ -e "s|@NO_GETTEXT@|\'$(NO_GETTEXT)\'|" \
+ -e "s|@GIT_PERF_REPEAT_COUNT@|\'$(GIT_PERF_REPEAT_COUNT)\'|" \
+ -e "s|@GIT_PERF_REPO@|\'$(GIT_PERF_REPO)\'|" \
+ -e "s|@GIT_PERF_LARGE_REPO@|\'$(GIT_PERF_LARGE_REPO)\'|" \
+ -e "s|@GIT_PERF_MAKE_OPTS@|\'$(GIT_PERF_MAKE_OPTS)\'|" \
+ -e "s|@GIT_PERF_MAKE_COMMAND@|\'$(GIT_PERF_MAKE_COMMAND)\'|" \
+ -e "s|@GIT_INTEROP_MAKE_OPTS@|\'$(GIT_INTEROP_MAKE_OPTS)\'|" \
+ -e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \
+ -e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \
+ -e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX)\'|" \
+ GIT-BUILD-OPTIONS.in >$@+
@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
@if test -f GIT-BUILD-DIR; then rm GIT-BUILD-DIR; fi
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 8974bb9fa20..680e5b3c8b0 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -1117,27 +1117,47 @@ if(NOT PYTHON_TESTS)
set(NO_PYTHON 1)
endif()
-file(WRITE ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "SHELL_PATH='${SHELL_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "TEST_SHELL_PATH='${TEST_SHELL_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PERL_PATH='${PERL_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "DIFF='${DIFF}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PYTHON_PATH='${PYTHON_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "TAR='${TAR}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_CURL='${NO_CURL}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_ICONV='${NO_ICONV}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_EXPAT='${NO_EXPAT}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PERL='${NO_PERL}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PTHREADS='${NO_PTHREADS}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_UNIX_SOCKETS='${NO_UNIX_SOCKETS}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PAGER_ENV='${PAGER_ENV}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "X='${EXE_EXTENSION}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_GETTEXT='${NO_GETTEXT}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "RUNTIME_PREFIX='${RUNTIME_PREFIX}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PYTHON='${NO_PYTHON}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "SUPPORTS_SIMPLE_IPC='${SUPPORTS_SIMPLE_IPC}'\n")
+file(STRINGS ${CMAKE_SOURCE_DIR}/GIT-BUILD-OPTIONS.in git_build_options NEWLINE_CONSUME)
+string(REPLACE "@SHELL_PATH@" "${SHELL_PATH}" git_build_options "${git_build_options}")
+string(REPLACE "@TEST_SHELL_PATH@" "${TEST_SHELL_PATH}" git_build_options "${git_build_options}")
+string(REPLACE "@PERL_PATH@" "${PERL_PATH}" git_build_options "${git_build_options}")
+string(REPLACE "@DIFF@" "${DIFF}" git_build_options "${git_build_options}")
+string(REPLACE "@PYTHON_PATH@" "${PYTHON_PATH}" git_build_options "${git_build_options}")
+string(REPLACE "@TAR@" "${TAR}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_CURL@" "${NO_CURL}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_ICONV@" "${NO_ICONV}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_EXPAT@" "${NO_EXPAT}" git_build_options "${git_build_options}")
+string(REPLACE "@USE_LIBPCRE2@" "" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PERL@" "${NO_PERL}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PTHREADS@" "${NO_PTHREADS}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PYTHON@" "${NO_PYTHON}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_REGEX@" "" git_build_options "${git_build_options}")
+string(REPLACE "@NO_UNIX_SOCKETS@" "${NO_UNIX_SOCKETS}" git_build_options "${git_build_options}")
+string(REPLACE "@PAGER_ENV@" "${PAGER_ENV}" git_build_options "${git_build_options}")
+string(REPLACE "@SANITIZE_LEAK@" "" git_build_options "${git_build_options}")
+string(REPLACE "@SANITIZE_ADDRESS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@X@" "${EXE_EXTENSION}" git_build_options "${git_build_options}")
+string(REPLACE "@FSMONITOR_DAEMON_BACKEND@" "win32" git_build_options "${git_build_options}")
+string(REPLACE "@FSMONITOR_OS_SETTINGS@" "win32" git_build_options "${git_build_options}")
+string(REPLACE "@TEST_OUTPUT_DIRECTORY@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_OPTS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_CMP@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_CMP_USE_COPIED_CONTEXT@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_UTF8_LOCALE@" "" git_build_options "${git_build_options}")
+string(REPLACE "@NO_GETTEXT@" "${NO_GETTEXT}" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_REPEAT_COUNT@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_REPO@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_LARGE_REPO@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_MAKE_OPTS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_MAKE_COMMAND@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@RUNTIME_PREFIX@" "${RUNTIME_PREFIX}" git_build_options "${git_build_options}")
if(USE_VCPKG)
- file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
+ string(APPEND git_build_options "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
endif()
+file(WRITE ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS ${git_build_options})
#Make the tests work when building out of the source tree
get_filename_component(CACHE_PATH ${CMAKE_CURRENT_LIST_DIR}/../../CMakeCache.txt ABSOLUTE)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index a278181a056..4dd641baefe 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -35,12 +35,6 @@ else
# needing to exist.
TEST_DIRECTORY=$(cd "$TEST_DIRECTORY" && pwd) || exit 1
fi
-if test -z "$TEST_OUTPUT_DIRECTORY"
-then
- # Similarly, override this to store the test-results subdir
- # elsewhere
- TEST_OUTPUT_DIRECTORY=$TEST_DIRECTORY
-fi
GIT_BUILD_DIR="${TEST_DIRECTORY%/t}"
if test "$TEST_DIRECTORY" = "$GIT_BUILD_DIR"
then
@@ -100,6 +94,13 @@ fi
. "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
export PERL_PATH SHELL_PATH
+if test -z "$TEST_OUTPUT_DIRECTORY"
+then
+ # Similarly, override this to store the test-results subdir
+ # elsewhere
+ TEST_OUTPUT_DIRECTORY=$TEST_DIRECTORY
+fi
+
# In t0000, we need to override test directories of nested testcases. In case
# the developer has TEST_OUTPUT_DIRECTORY part of his build options, then we'd
# reset this value to instead contain what the developer has specified. We thus
--
2.47.0.72.gef8ce8f3d4.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v3 02/15] Makefile: consistently use @PLACEHOLDER@ to substitute
2024-10-18 12:23 ` [RFC PATCH v3 00/15] Modernize the " Patrick Steinhardt
2024-10-18 12:23 ` [RFC PATCH v3 01/15] Makefile: use common template for GIT-BUILD-OPTIONS Patrick Steinhardt
@ 2024-10-18 12:23 ` Patrick Steinhardt
2024-10-18 12:23 ` [RFC PATCH v3 03/15] Makefile: consistently use PERL_PATH Patrick Steinhardt
` (15 subsequent siblings)
17 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-18 12:23 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones
We have a bunch of placeholders in our scripts that we replace at build
time, for example by using sed(1). These placeholders come in three
different formats: @PLACEHOLDER@, @@PLACEHOLDER@@ and ++PLACEHOLDER++.
Next to being inconsistent it also creates a bit of a problem with
CMake, which only supports the first syntax in its `configure_file()`
function. To work around that we instead manually replace placeholders
via string operations, which is a hassle and removes safeguards that
CMake has to verify that we didn't forget to replace any placeholders.
Besides that, other build systems like Meson also support the CMake
syntax.
Unify our codebase to consistently use the syntax supported by such
build systems.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 44 +++++++++----------
configure.ac | 2 +-
contrib/buildsystems/CMakeLists.txt | 34 +++++++-------
git-cvsserver.perl | 2 +-
git-instaweb.sh | 8 ++--
git-request-pull.sh | 2 +-
git-send-email.perl | 2 +-
git-sh-i18n.sh | 6 +--
git-sh-setup.sh | 6 +--
git-svn.perl | 2 +-
gitk-git/po/vi.po | 2 +-
gitweb/Makefile | 44 +++++++++----------
gitweb/gitweb.perl | 44 +++++++++----------
perl/Git/I18N.pm | 6 +--
perl/Git/LoadCPAN.pm | 6 +--
| 2 +-
.../runtime_prefix.template.pl | 8 ++--
unimplemented.sh | 2 +-
wrap-for-bin.sh | 18 ++++----
19 files changed, 120 insertions(+), 120 deletions(-)
diff --git a/Makefile b/Makefile
index 7d4b5f04a04..d98ce366c08 100644
--- a/Makefile
+++ b/Makefile
@@ -1555,10 +1555,10 @@ endif
ifdef SANE_TOOL_PATH
SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH))
-BROKEN_PATH_FIX = 's|^\# @@BROKEN_PATH_FIX@@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|'
+BROKEN_PATH_FIX = 's|^\# @BROKEN_PATH_FIX@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|'
PATH := $(SANE_TOOL_PATH):${PATH}
else
-BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d'
+BROKEN_PATH_FIX = '/^\# @BROKEN_PATH_FIX@$$/d'
endif
ifeq (,$(HOST_CPU))
@@ -2548,13 +2548,13 @@ GIT-SCRIPT-DEFINES: FORCE
define cmd_munge_script
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
- -e 's|@@DIFF@@|$(DIFF_SQ)|' \
- -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' \
- -e 's/@@USE_GETTEXT_SCHEME@@/$(USE_GETTEXT_SCHEME)/g' \
+ -e 's|@DIFF@|$(DIFF_SQ)|' \
+ -e 's|@LOCALEDIR@|$(localedir_SQ)|g' \
+ -e 's/@USE_GETTEXT_SCHEME@/$(USE_GETTEXT_SCHEME)/g' \
-e $(BROKEN_PATH_FIX) \
- -e 's|@@GITWEBDIR@@|$(gitwebdir_SQ)|g' \
- -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
- -e 's|@@PAGER_ENV@@|$(PAGER_ENV_SQ)|g' \
+ -e 's|@GITWEBDIR@|$(gitwebdir_SQ)|g' \
+ -e 's|@PERL@|$(PERL_PATH_SQ)|g' \
+ -e 's|@PAGER_ENV@|$(PAGER_ENV_SQ)|g' \
$@.sh >$@+
endef
@@ -2611,7 +2611,7 @@ $(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
-e ' r GIT-PERL-HEADER' \
-e ' G' \
-e '}' \
- -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
+ -e 's/@GIT_VERSION@/$(GIT_VERSION)/g' \
$< >$@+ && \
chmod +x $@+ && \
mv $@+ $@
@@ -2629,11 +2629,11 @@ GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile
INSTLIBDIR='$(perllibdir_SQ)' && \
INSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \
INSTLIBDIR="$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}" && \
- sed -e 's=@@PATHSEP@@=$(pathsep)=g' \
- -e "s=@@INSTLIBDIR@@=$$INSTLIBDIR=g" \
- -e 's=@@PERLLIBDIR_REL@@=$(perllibdir_relative_SQ)=g' \
- -e 's=@@GITEXECDIR_REL@@=$(gitexecdir_relative_SQ)=g' \
- -e 's=@@LOCALEDIR_REL@@=$(localedir_relative_SQ)=g' \
+ sed -e 's=@PATHSEP@=$(pathsep)=g' \
+ -e "s=@INSTLIBDIR@=$$INSTLIBDIR=g" \
+ -e 's=@PERLLIBDIR_REL@=$(perllibdir_relative_SQ)=g' \
+ -e 's=@GITEXECDIR_REL@=$(gitexecdir_relative_SQ)=g' \
+ -e 's=@LOCALEDIR_REL@=$(localedir_relative_SQ)=g' \
$< >$@+ && \
mv $@+ $@
@@ -2649,7 +2649,7 @@ else # NO_PERL
$(SCRIPT_PERL_GEN) git-instaweb: % : unimplemented.sh
$(QUIET_GEN) \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@@REASON@@|NO_PERL=$(NO_PERL)|g' \
+ -e 's|@REASON@|NO_PERL=$(NO_PERL)|g' \
unimplemented.sh >$@+ && \
chmod +x $@+ && \
mv $@+ $@
@@ -2670,13 +2670,13 @@ else # NO_PYTHON
$(SCRIPT_PYTHON_GEN): % : unimplemented.sh
$(QUIET_GEN) \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@@REASON@@|NO_PYTHON=$(NO_PYTHON)|g' \
+ -e 's|@REASON@|NO_PYTHON=$(NO_PYTHON)|g' \
unimplemented.sh >$@+ && \
chmod +x $@+ && \
mv $@+ $@
endif # NO_PYTHON
-CONFIGURE_RECIPE = sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
+CONFIGURE_RECIPE = sed -e 's/@GIT_VERSION@/$(GIT_VERSION)/g' \
configure.ac >configure.ac+ && \
autoconf -o configure configure.ac+ && \
$(RM) configure.ac+
@@ -3104,9 +3104,9 @@ endif
perl/build/lib/%.pm: perl/%.pm GIT-PERL-DEFINES
$(call mkdir_p_parent_template)
$(QUIET_GEN) \
- sed -e 's|@@LOCALEDIR@@|$(perl_localedir_SQ)|g' \
- -e 's|@@NO_GETTEXT@@|$(NO_GETTEXT_SQ)|g' \
- -e 's|@@NO_PERL_CPAN_FALLBACKS@@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \
+ sed -e 's|@LOCALEDIR@|$(perl_localedir_SQ)|g' \
+ -e 's|@NO_GETTEXT@|$(NO_GETTEXT_SQ)|g' \
+ -e 's|@NO_PERL_CPAN_FALLBACKS@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \
< $< > $@
perl/build/man/man3/Git.3pm: perl/Git.pm
@@ -3224,8 +3224,8 @@ all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PR
bin-wrappers/%: wrap-for-bin.sh
$(call mkdir_p_parent_template)
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@@BUILD_DIR@@|$(shell pwd)|' \
- -e 's|@@PROG@@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
+ -e 's|@BUILD_DIR@|$(shell pwd)|' \
+ -e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
chmod +x $@
# GNU make supports exporting all variables by "export" without parameters.
diff --git a/configure.ac b/configure.ac
index d1a96da14eb..5923edc44aa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -142,7 +142,7 @@ fi
## Configure body starts here.
AC_PREREQ(2.59)
-AC_INIT([git], [@@GIT_VERSION@@], [git@vger.kernel.org])
+AC_INIT([git], [@GIT_VERSION@], [git@vger.kernel.org])
AC_CONFIG_SRCDIR([git.c])
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 680e5b3c8b0..a41540458b7 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -836,14 +836,14 @@ set(git_shell_scripts
foreach(script ${git_shell_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.sh content NEWLINE_CONSUME)
string(REPLACE "@SHELL_PATH@" "${SHELL_PATH}" content "${content}")
- string(REPLACE "@@DIFF@@" "diff" content "${content}")
+ string(REPLACE "@DIFF@" "diff" content "${content}")
string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}")
string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" content "${content}")
- string(REPLACE "@@NO_CURL@@" "" content "${content}")
- string(REPLACE "@@USE_GETTEXT_SCHEME@@" "" content "${content}")
- string(REPLACE "# @@BROKEN_PATH_FIX@@" "" content "${content}")
- string(REPLACE "@@PERL@@" "${PERL_PATH}" content "${content}")
- string(REPLACE "@@PAGER_ENV@@" "LESS=FRX LV=-c" content "${content}")
+ string(REPLACE "@NO_CURL@" "" content "${content}")
+ string(REPLACE "@USE_GETTEXT_SCHEME@" "" content "${content}")
+ string(REPLACE "# @BROKEN_PATH_FIX@" "" content "${content}")
+ string(REPLACE "@PERL@" "${PERL_PATH}" content "${content}")
+ string(REPLACE "@PAGER_ENV@" "LESS=FRX LV=-c" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
endforeach()
@@ -852,13 +852,13 @@ parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" ".perl")
#create perl header
file(STRINGS ${CMAKE_SOURCE_DIR}/perl/header_templates/fixed_prefix.template.pl perl_header )
-string(REPLACE "@@PATHSEP@@" ":" perl_header "${perl_header}")
-string(REPLACE "@@INSTLIBDIR@@" "${INSTLIBDIR}" perl_header "${perl_header}")
+string(REPLACE "@PATHSEP@" ":" perl_header "${perl_header}")
+string(REPLACE "@INSTLIBDIR@" "${INSTLIBDIR}" perl_header "${perl_header}")
foreach(script ${git_perl_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.perl content NEWLINE_CONSUME)
string(REPLACE "#!/usr/bin/perl" "#!/usr/bin/perl\n${perl_header}\n" content "${content}")
- string(REPLACE "@@GIT_VERSION@@" "${PROJECT_VERSION}" content "${content}")
+ string(REPLACE "@GIT_VERSION@" "${PROJECT_VERSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
endforeach()
@@ -873,8 +873,8 @@ file(GLOB_RECURSE perl_modules "${CMAKE_SOURCE_DIR}/perl/*.pm")
foreach(pm ${perl_modules})
string(REPLACE "${CMAKE_SOURCE_DIR}/perl/" "" file_path ${pm})
file(STRINGS ${pm} content NEWLINE_CONSUME)
- string(REPLACE "@@LOCALEDIR@@" "${LOCALEDIR}" content "${content}")
- string(REPLACE "@@NO_PERL_CPAN_FALLBACKS@@" "" content "${content}")
+ string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}")
+ string(REPLACE "@NO_PERL_CPAN_FALLBACKS@" "" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/perl/build/lib/${file_path} ${content})
#test-lib.sh requires perl/build/lib to be the build directory of perl modules
endforeach()
@@ -1056,21 +1056,21 @@ set(wrapper_test_scripts
foreach(script ${wrapper_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
- string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
- string(REPLACE "@@PROG@@" "${script}${EXE_EXTENSION}" content "${content}")
+ string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+ string(REPLACE "@PROG@" "${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
foreach(script ${wrapper_test_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
- string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
- string(REPLACE "@@PROG@@" "t/helper/${script}${EXE_EXTENSION}" content "${content}")
+ string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+ string(REPLACE "@PROG@" "t/helper/${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
-string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
-string(REPLACE "@@PROG@@" "git-cvsserver" content "${content}")
+string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+string(REPLACE "@PROG@" "git-cvsserver" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})
#options for configuring test options
diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index 124f598bdc0..70ae7cb8e45 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -26,7 +26,7 @@
use File::Basename;
use Getopt::Long qw(:config require_order no_ignore_case);
-my $VERSION = '@@GIT_VERSION@@';
+my $VERSION = '@GIT_VERSION@';
my $log = GITCVS::log->new();
my $cfg;
diff --git a/git-instaweb.sh b/git-instaweb.sh
index 8dbe21d5887..c8efb1205a8 100755
--- a/git-instaweb.sh
+++ b/git-instaweb.sh
@@ -3,7 +3,7 @@
# Copyright (c) 2006 Eric Wong
#
-PERL='@@PERL@@'
+PERL='@PERL@'
OPTIONS_KEEPDASHDASH=
OPTIONS_STUCKLONG=
OPTIONS_SPEC="\
@@ -38,8 +38,8 @@ conf="$GIT_DIR/gitweb/httpd.conf"
# if installed, it doesn't need further configuration (module_path)
test -z "$httpd" && httpd='lighttpd -f'
-# Default is @@GITWEBDIR@@
-test -z "$root" && root='@@GITWEBDIR@@'
+# Default is @GITWEBDIR@
+test -z "$root" && root='@GITWEBDIR@'
# any untaken local port will do...
test -z "$port" && port=1234
@@ -716,7 +716,7 @@ EOF
gitweb_conf() {
cat > "$fqgitdir/gitweb/gitweb_config.perl" <<EOF
-#!@@PERL@@
+#!@PERL@
our \$projectroot = "$(dirname "$fqgitdir")";
our \$git_temp = "$fqgitdir/gitweb/tmp";
our \$projects_list = \$projectroot;
diff --git a/git-request-pull.sh b/git-request-pull.sh
index 01640a044bb..10c88639e28 100755
--- a/git-request-pull.sh
+++ b/git-request-pull.sh
@@ -112,7 +112,7 @@ find_matching_ref='
}
'
-set fnord $(git ls-remote "$url" | @@PERL@@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
+set fnord $(git ls-remote "$url" | @PERL@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
remote_sha1=$2
ref=$3
diff --git a/git-send-email.perl b/git-send-email.perl
index c835d4c11af..02805c43e52 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1501,7 +1501,7 @@ sub gen_header {
@recipients = unique_email_list(@recipients,@cc,@initial_bcc);
@recipients = (map { extract_valid_address_or_die($_) } @recipients);
my $date = format_2822_time($time++);
- my $gitversion = '@@GIT_VERSION@@';
+ my $gitversion = '@GIT_VERSION@';
if ($gitversion =~ m/..GIT_VERSION../) {
$gitversion = Git::version();
}
diff --git a/git-sh-i18n.sh b/git-sh-i18n.sh
index a15c0620db6..ae4b2d6ba9d 100644
--- a/git-sh-i18n.sh
+++ b/git-sh-i18n.sh
@@ -9,7 +9,7 @@ TEXTDOMAIN=git
export TEXTDOMAIN
if test -z "$GIT_TEXTDOMAINDIR"
then
- TEXTDOMAINDIR="@@LOCALEDIR@@"
+ TEXTDOMAINDIR="@LOCALEDIR@"
else
TEXTDOMAINDIR="$GIT_TEXTDOMAINDIR"
fi
@@ -17,9 +17,9 @@ export TEXTDOMAINDIR
# First decide what scheme to use...
GIT_INTERNAL_GETTEXT_SH_SCHEME=fallthrough
-if test -n "@@USE_GETTEXT_SCHEME@@"
+if test -n "@USE_GETTEXT_SCHEME@"
then
- GIT_INTERNAL_GETTEXT_SH_SCHEME="@@USE_GETTEXT_SCHEME@@"
+ GIT_INTERNAL_GETTEXT_SH_SCHEME="@USE_GETTEXT_SCHEME@"
elif test -n "$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS"
then
: no probing necessary
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index ce273fe0e48..19aef72ec25 100644
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -41,7 +41,7 @@ git_broken_path_fix () {
esac
}
-# @@BROKEN_PATH_FIX@@
+# @BROKEN_PATH_FIX@
# Source git-sh-i18n for gettext support.
. "$(git --exec-path)/git-sh-i18n"
@@ -154,7 +154,7 @@ git_pager() {
else
GIT_PAGER=cat
fi
- for vardef in @@PAGER_ENV@@
+ for vardef in @PAGER_ENV@
do
var=${vardef%%=*}
eval ": \"\${$vardef}\" && export $var"
@@ -280,7 +280,7 @@ get_author_ident_from_commit () {
# remove lines from $1 that are not in $2, leaving only common lines.
create_virtual_base() {
sz0=$(wc -c <"$1")
- @@DIFF@@ -u -La/"$1" -Lb/"$1" "$1" "$2" | git apply --no-add
+ @DIFF@ -u -La/"$1" -Lb/"$1" "$1" "$2" | git apply --no-add
sz1=$(wc -c <"$1")
# If we do not have enough common material, it is not
diff --git a/git-svn.perl b/git-svn.perl
index 01e7a70de1c..dcf65cf1d1d 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -9,7 +9,7 @@
$_revision $_repository
$_q $_authors $_authors_prog %users/;
$AUTHOR = 'Eric Wong <normalperson@yhbt.net>';
-$VERSION = '@@GIT_VERSION@@';
+$VERSION = '@GIT_VERSION@';
use Carp qw/croak/;
use File::Basename qw/dirname basename/;
diff --git a/gitk-git/po/vi.po b/gitk-git/po/vi.po
index 59674986604..184430dcdee 100644
--- a/gitk-git/po/vi.po
+++ b/gitk-git/po/vi.po
@@ -5,7 +5,7 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: gitk @@GIT_VERSION@@\n"
+"Project-Id-Version: gitk @GIT_VERSION@\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-05-17 14:32+1000\n"
"PO-Revision-Date: 2015-09-15 07:33+0700\n"
diff --git a/gitweb/Makefile b/gitweb/Makefile
index 3b68ab2d672..164c8d53757 100644
--- a/gitweb/Makefile
+++ b/gitweb/Makefile
@@ -79,28 +79,28 @@ GITWEB_JSLIB_FILES += static/js/blame_incremental.js
GITWEB_REPLACE = \
- -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
- -e 's|++GIT_BINDIR++|$(bindir)|g' \
- -e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \
- -e 's|++GITWEB_CONFIG_SYSTEM++|$(GITWEB_CONFIG_SYSTEM)|g' \
- -e 's|++GITWEB_CONFIG_COMMON++|$(GITWEB_CONFIG_COMMON)|g' \
- -e 's|++GITWEB_HOME_LINK_STR++|$(GITWEB_HOME_LINK_STR)|g' \
- -e 's|++GITWEB_SITENAME++|$(GITWEB_SITENAME)|g' \
- -e 's|++GITWEB_PROJECTROOT++|$(GITWEB_PROJECTROOT)|g' \
- -e 's|"++GITWEB_PROJECT_MAXDEPTH++"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
- -e 's|++GITWEB_EXPORT_OK++|$(GITWEB_EXPORT_OK)|g' \
- -e 's|++GITWEB_STRICT_EXPORT++|$(GITWEB_STRICT_EXPORT)|g' \
- -e 's|++GITWEB_BASE_URL++|$(GITWEB_BASE_URL)|g' \
- -e 's|++GITWEB_LIST++|$(GITWEB_LIST)|g' \
- -e 's|++GITWEB_HOMETEXT++|$(GITWEB_HOMETEXT)|g' \
- -e 's|++GITWEB_CSS++|$(GITWEB_CSS)|g' \
- -e 's|++GITWEB_LOGO++|$(GITWEB_LOGO)|g' \
- -e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \
- -e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \
- -e 's|++GITWEB_SITE_HTML_HEAD_STRING++|$(GITWEB_SITE_HTML_HEAD_STRING)|g' \
- -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \
- -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \
- -e 's|++HIGHLIGHT_BIN++|$(HIGHLIGHT_BIN)|g'
+ -e 's|@GIT_VERSION@|$(GIT_VERSION)|g' \
+ -e 's|@GIT_BINDIR@|$(bindir)|g' \
+ -e 's|@GITWEB_CONFIG@|$(GITWEB_CONFIG)|g' \
+ -e 's|@GITWEB_CONFIG_SYSTEM@|$(GITWEB_CONFIG_SYSTEM)|g' \
+ -e 's|@GITWEB_CONFIG_COMMON@|$(GITWEB_CONFIG_COMMON)|g' \
+ -e 's|@GITWEB_HOME_LINK_STR@|$(GITWEB_HOME_LINK_STR)|g' \
+ -e 's|@GITWEB_SITENAME@|$(GITWEB_SITENAME)|g' \
+ -e 's|@GITWEB_PROJECTROOT@|$(GITWEB_PROJECTROOT)|g' \
+ -e 's|"@GITWEB_PROJECT_MAXDEPTH@"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
+ -e 's|@GITWEB_EXPORT_OK@|$(GITWEB_EXPORT_OK)|g' \
+ -e 's|@GITWEB_STRICT_EXPORT@|$(GITWEB_STRICT_EXPORT)|g' \
+ -e 's|@GITWEB_BASE_URL@|$(GITWEB_BASE_URL)|g' \
+ -e 's|@GITWEB_LIST@|$(GITWEB_LIST)|g' \
+ -e 's|@GITWEB_HOMETEXT@|$(GITWEB_HOMETEXT)|g' \
+ -e 's|@GITWEB_CSS@|$(GITWEB_CSS)|g' \
+ -e 's|@GITWEB_LOGO@|$(GITWEB_LOGO)|g' \
+ -e 's|@GITWEB_FAVICON@|$(GITWEB_FAVICON)|g' \
+ -e 's|@GITWEB_JS@|$(GITWEB_JS)|g' \
+ -e 's|@GITWEB_SITE_HTML_HEAD_STRING@|$(GITWEB_SITE_HTML_HEAD_STRING)|g' \
+ -e 's|@GITWEB_SITE_HEADER@|$(GITWEB_SITE_HEADER)|g' \
+ -e 's|@GITWEB_SITE_FOOTER@|$(GITWEB_SITE_FOOTER)|g' \
+ -e 's|@HIGHLIGHT_BIN@|$(HIGHLIGHT_BIN)|g'
.PHONY: FORCE
$(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS: FORCE
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index b09a8d05238..76e1f4e244f 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -35,7 +35,7 @@ BEGIN
CGI->compile() if $ENV{'MOD_PERL'};
}
-our $version = "++GIT_VERSION++";
+our $version = "@GIT_VERSION@";
our ($my_url, $my_uri, $base_url, $path_info, $home_link);
sub evaluate_uri {
@@ -80,46 +80,46 @@ sub evaluate_uri {
# core git executable to use
# this can just be "git" if your webserver has a sensible PATH
-our $GIT = "++GIT_BINDIR++/git";
+our $GIT = "@GIT_BINDIR@/git";
# absolute fs-path which will be prepended to the project path
#our $projectroot = "/pub/scm";
-our $projectroot = "++GITWEB_PROJECTROOT++";
+our $projectroot = "@GITWEB_PROJECTROOT@";
# fs traversing limit for getting project list
# the number is relative to the projectroot
-our $project_maxdepth = "++GITWEB_PROJECT_MAXDEPTH++";
+our $project_maxdepth = "@GITWEB_PROJECT_MAXDEPTH@";
# string of the home link on top of all pages
-our $home_link_str = "++GITWEB_HOME_LINK_STR++";
+our $home_link_str = "@GITWEB_HOME_LINK_STR@";
# extra breadcrumbs preceding the home link
our @extra_breadcrumbs = ();
# name of your site or organization to appear in page titles
# replace this with something more descriptive for clearer bookmarks
-our $site_name = "++GITWEB_SITENAME++"
+our $site_name = "@GITWEB_SITENAME@"
|| ($ENV{'SERVER_NAME'} || "Untitled") . " Git";
# html snippet to include in the <head> section of each page
-our $site_html_head_string = "++GITWEB_SITE_HTML_HEAD_STRING++";
+our $site_html_head_string = "@GITWEB_SITE_HTML_HEAD_STRING@";
# filename of html text to include at top of each page
-our $site_header = "++GITWEB_SITE_HEADER++";
+our $site_header = "@GITWEB_SITE_HEADER@";
# html text to include at home page
-our $home_text = "++GITWEB_HOMETEXT++";
+our $home_text = "@GITWEB_HOMETEXT@";
# filename of html text to include at bottom of each page
-our $site_footer = "++GITWEB_SITE_FOOTER++";
+our $site_footer = "@GITWEB_SITE_FOOTER@";
# URI of stylesheets
-our @stylesheets = ("++GITWEB_CSS++");
+our @stylesheets = ("@GITWEB_CSS@");
# URI of a single stylesheet, which can be overridden in GITWEB_CONFIG.
our $stylesheet = undef;
# URI of GIT logo (72x27 size)
-our $logo = "++GITWEB_LOGO++";
+our $logo = "@GITWEB_LOGO@";
# URI of GIT favicon, assumed to be image/png type
-our $favicon = "++GITWEB_FAVICON++";
+our $favicon = "@GITWEB_FAVICON@";
# URI of gitweb.js (JavaScript code for gitweb)
-our $javascript = "++GITWEB_JS++";
+our $javascript = "@GITWEB_JS@";
# URI and label (title) of GIT logo link
#our $logo_url = "https://www.kernel.org/pub/software/scm/git/docs/";
@@ -128,7 +128,7 @@ sub evaluate_uri {
our $logo_label = "git homepage";
# source of projects list
-our $projects_list = "++GITWEB_LIST++";
+our $projects_list = "@GITWEB_LIST@";
# the width (in characters) of the projects list "Description" column
our $projects_list_description_width = 25;
@@ -147,7 +147,7 @@ sub evaluate_uri {
# show repository only if this file exists
# (only effective if this variable evaluates to true)
-our $export_ok = "++GITWEB_EXPORT_OK++";
+our $export_ok = "@GITWEB_EXPORT_OK@";
# don't generate age column on the projects list page
our $omit_age_column = 0;
@@ -161,11 +161,11 @@ sub evaluate_uri {
our $export_auth_hook = undef;
# only allow viewing of repositories also shown on the overview page
-our $strict_export = "++GITWEB_STRICT_EXPORT++";
+our $strict_export = "@GITWEB_STRICT_EXPORT@";
# list of git base URLs used for URL to where fetch project from,
# i.e. full URL is "$git_base_url/$project"
-our @git_base_url_list = grep { $_ ne '' } ("++GITWEB_BASE_URL++");
+our @git_base_url_list = grep { $_ ne '' } ("@GITWEB_BASE_URL@");
# default blob_plain mimetype and default charset for text/plain blob
our $default_blob_plain_mimetype = 'text/plain';
@@ -200,7 +200,7 @@ sub evaluate_uri {
# http://andre-simon.de/zip/download.php due to assumptions about parameters and output).
# Useful if highlight is not installed on your webserver's PATH.
# [Default: highlight]
-our $highlight_bin = "++HIGHLIGHT_BIN++";
+our $highlight_bin = "@HIGHLIGHT_BIN@";
# information about snapshot formats that gitweb is capable of serving
our %known_snapshot_formats = (
@@ -741,9 +741,9 @@ sub read_config_file {
our ($GITWEB_CONFIG, $GITWEB_CONFIG_SYSTEM, $GITWEB_CONFIG_COMMON);
sub evaluate_gitweb_config {
- our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "++GITWEB_CONFIG++";
- our $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || "++GITWEB_CONFIG_SYSTEM++";
- our $GITWEB_CONFIG_COMMON = $ENV{'GITWEB_CONFIG_COMMON'} || "++GITWEB_CONFIG_COMMON++";
+ our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "@GITWEB_CONFIG@";
+ our $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || "@GITWEB_CONFIG_SYSTEM@";
+ our $GITWEB_CONFIG_COMMON = $ENV{'GITWEB_CONFIG_COMMON'} || "@GITWEB_CONFIG_COMMON@";
# Protect against duplications of file names, to not read config twice.
# Only one of $GITWEB_CONFIG and $GITWEB_CONFIG_SYSTEM is used, so
diff --git a/perl/Git/I18N.pm b/perl/Git/I18N.pm
index 475e90a6df5..f8f0ca31254 100644
--- a/perl/Git/I18N.pm
+++ b/perl/Git/I18N.pm
@@ -20,14 +20,14 @@ BEGIN
# this "'@@' [...] '@@'" pattern.
use constant NO_GETTEXT_STR => '@@' . 'NO_GETTEXT' . '@@';
use constant NO_GETTEXT => (
- q[@@NO_GETTEXT@@] ne ''
+ q[@NO_GETTEXT@] ne ''
and
- q[@@NO_GETTEXT@@] ne NO_GETTEXT_STR
+ q[@NO_GETTEXT@] ne NO_GETTEXT_STR
);
sub __bootstrap_locale_messages {
our $TEXTDOMAIN = 'git';
- our $TEXTDOMAINDIR ||= $ENV{GIT_TEXTDOMAINDIR} || '@@LOCALEDIR@@';
+ our $TEXTDOMAINDIR ||= $ENV{GIT_TEXTDOMAINDIR} || '@LOCALEDIR@';
die "NO_GETTEXT=" . NO_GETTEXT_STR if NO_GETTEXT;
require POSIX;
diff --git a/perl/Git/LoadCPAN.pm b/perl/Git/LoadCPAN.pm
index 8c7fa805f97..6be99840f84 100644
--- a/perl/Git/LoadCPAN.pm
+++ b/perl/Git/LoadCPAN.pm
@@ -31,11 +31,11 @@ =head1 DESCRIPTION
# Makefile, and allows for detecting whether the module is loaded from
# perl/Git as opposed to perl/build/Git, which is useful for one-off
# testing without having Error.pm et al installed.
-use constant NO_PERL_CPAN_FALLBACKS_STR => '@@' . 'NO_PERL_CPAN_FALLBACKS' . '@@';
+use constant NO_PERL_CPAN_FALLBACKS_STR => '@' . 'NO_PERL_CPAN_FALLBACKS' . '@';
use constant NO_PERL_CPAN_FALLBACKS => (
- q[@@NO_PERL_CPAN_FALLBACKS@@] ne ''
+ q[@NO_PERL_CPAN_FALLBACKS@] ne ''
and
- q[@@NO_PERL_CPAN_FALLBACKS@@] ne NO_PERL_CPAN_FALLBACKS_STR
+ q[@NO_PERL_CPAN_FALLBACKS@] ne NO_PERL_CPAN_FALLBACKS_STR
);
sub import {
--git a/perl/header_templates/fixed_prefix.template.pl b/perl/header_templates/fixed_prefix.template.pl
index 857b4391a49..d571ca5cde5 100644
--- a/perl/header_templates/fixed_prefix.template.pl
+++ b/perl/header_templates/fixed_prefix.template.pl
@@ -1 +1 @@
-use lib (split(/@@PATHSEP@@/, $ENV{GITPERLLIB} || '@@INSTLIBDIR@@'));
+use lib (split(/@PATHSEP@/, $ENV{GITPERLLIB} || '@INSTLIBDIR@'));
diff --git a/perl/header_templates/runtime_prefix.template.pl b/perl/header_templates/runtime_prefix.template.pl
index 9d28b3d8636..e6f8e661a16 100644
--- a/perl/header_templates/runtime_prefix.template.pl
+++ b/perl/header_templates/runtime_prefix.template.pl
@@ -3,7 +3,7 @@
# This finds our Git::* libraries relative to the script's runtime path.
sub __git_system_path {
my ($relpath) = @_;
- my $gitexecdir_relative = '@@GITEXECDIR_REL@@';
+ my $gitexecdir_relative = '@GITEXECDIR_REL@';
# GIT_EXEC_PATH is supplied by `git` or the test suite.
my $exec_path;
@@ -24,11 +24,11 @@ sub __git_system_path {
}
BEGIN {
- use lib split /@@PATHSEP@@/,
+ use lib split /@PATHSEP@/,
(
$ENV{GITPERLLIB} ||
do {
- my $perllibdir = __git_system_path('@@PERLLIBDIR_REL@@');
+ my $perllibdir = __git_system_path('@PERLLIBDIR_REL@');
(-e $perllibdir) || die("Invalid system path ($relpath): $path");
$perllibdir;
}
@@ -36,7 +36,7 @@ BEGIN
# Export the system locale directory to the I18N module. The locale directory
# is only installed if NO_GETTEXT is set.
- $Git::I18N::TEXTDOMAINDIR = __git_system_path('@@LOCALEDIR_REL@@');
+ $Git::I18N::TEXTDOMAINDIR = __git_system_path('@LOCALEDIR_REL@');
}
# END RUNTIME_PREFIX generated code.
diff --git a/unimplemented.sh b/unimplemented.sh
index fee21d24e8a..41776b279d4 100644
--- a/unimplemented.sh
+++ b/unimplemented.sh
@@ -1,4 +1,4 @@
#!/bin/sh
-echo >&2 "fatal: git was built without support for $(basename $0) (@@REASON@@)."
+echo >&2 "fatal: git was built without support for $(basename $0) (@REASON@)."
exit 128
diff --git a/wrap-for-bin.sh b/wrap-for-bin.sh
index 95851b85b6b..7898a1c238d 100644
--- a/wrap-for-bin.sh
+++ b/wrap-for-bin.sh
@@ -4,33 +4,33 @@
# to run test suite against sandbox, but with only bindir-installed
# executables in PATH. The Makefile copies this into various
# files in bin-wrappers, substituting
-# @@BUILD_DIR@@ and @@PROG@@.
+# @BUILD_DIR@ and @PROG@.
-GIT_EXEC_PATH='@@BUILD_DIR@@'
+GIT_EXEC_PATH='@BUILD_DIR@'
if test -n "$NO_SET_GIT_TEMPLATE_DIR"
then
unset GIT_TEMPLATE_DIR
else
- GIT_TEMPLATE_DIR='@@BUILD_DIR@@/templates/blt'
+ GIT_TEMPLATE_DIR='@BUILD_DIR@/templates/blt'
export GIT_TEMPLATE_DIR
fi
-GITPERLLIB='@@BUILD_DIR@@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}"
-GIT_TEXTDOMAINDIR='@@BUILD_DIR@@/po/build/locale'
-PATH='@@BUILD_DIR@@/bin-wrappers:'"$PATH"
+GITPERLLIB='@BUILD_DIR@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}"
+GIT_TEXTDOMAINDIR='@BUILD_DIR@/po/build/locale'
+PATH='@BUILD_DIR@/bin-wrappers:'"$PATH"
export GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
case "$GIT_DEBUGGER" in
'')
- exec "${GIT_EXEC_PATH}/@@PROG@@" "$@"
+ exec "${GIT_EXEC_PATH}/@PROG@" "$@"
;;
1)
unset GIT_DEBUGGER
- exec gdb --args "${GIT_EXEC_PATH}/@@PROG@@" "$@"
+ exec gdb --args "${GIT_EXEC_PATH}/@PROG@" "$@"
;;
*)
GIT_DEBUGGER_ARGS="$GIT_DEBUGGER"
unset GIT_DEBUGGER
- exec ${GIT_DEBUGGER_ARGS} "${GIT_EXEC_PATH}/@@PROG@@" "$@"
+ exec ${GIT_DEBUGGER_ARGS} "${GIT_EXEC_PATH}/@PROG@" "$@"
;;
esac
--
2.47.0.72.gef8ce8f3d4.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v3 03/15] Makefile: consistently use PERL_PATH
2024-10-18 12:23 ` [RFC PATCH v3 00/15] Modernize the " Patrick Steinhardt
2024-10-18 12:23 ` [RFC PATCH v3 01/15] Makefile: use common template for GIT-BUILD-OPTIONS Patrick Steinhardt
2024-10-18 12:23 ` [RFC PATCH v3 02/15] Makefile: consistently use @PLACEHOLDER@ to substitute Patrick Steinhardt
@ 2024-10-18 12:23 ` Patrick Steinhardt
2024-10-18 12:23 ` [RFC PATCH v3 04/15] Makefile: extract script to massage Perl scripts Patrick Steinhardt
` (14 subsequent siblings)
17 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-18 12:23 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones
When injecting the Perl path into our scripts we sometimes use '@PERL@'
while we othertimes use '@PERL_PATH@'. Refactor the code use the latter
consistently, which makes it easier to reuse the same logic for multiple
scripts.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 2 +-
contrib/buildsystems/CMakeLists.txt | 2 +-
git-instaweb.sh | 4 ++--
git-request-pull.sh | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile
index d98ce366c08..394466b716d 100644
--- a/Makefile
+++ b/Makefile
@@ -2553,7 +2553,7 @@ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's/@USE_GETTEXT_SCHEME@/$(USE_GETTEXT_SCHEME)/g' \
-e $(BROKEN_PATH_FIX) \
-e 's|@GITWEBDIR@|$(gitwebdir_SQ)|g' \
- -e 's|@PERL@|$(PERL_PATH_SQ)|g' \
+ -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' \
-e 's|@PAGER_ENV@|$(PAGER_ENV_SQ)|g' \
$@.sh >$@+
endef
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index a41540458b7..608ad9714d4 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -842,7 +842,7 @@ foreach(script ${git_shell_scripts})
string(REPLACE "@NO_CURL@" "" content "${content}")
string(REPLACE "@USE_GETTEXT_SCHEME@" "" content "${content}")
string(REPLACE "# @BROKEN_PATH_FIX@" "" content "${content}")
- string(REPLACE "@PERL@" "${PERL_PATH}" content "${content}")
+ string(REPLACE "@PERL_PATH@" "${PERL_PATH}" content "${content}")
string(REPLACE "@PAGER_ENV@" "LESS=FRX LV=-c" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
endforeach()
diff --git a/git-instaweb.sh b/git-instaweb.sh
index c8efb1205a8..5ad50160bb0 100755
--- a/git-instaweb.sh
+++ b/git-instaweb.sh
@@ -3,7 +3,7 @@
# Copyright (c) 2006 Eric Wong
#
-PERL='@PERL@'
+PERL='@PERL_PATH@'
OPTIONS_KEEPDASHDASH=
OPTIONS_STUCKLONG=
OPTIONS_SPEC="\
@@ -716,7 +716,7 @@ EOF
gitweb_conf() {
cat > "$fqgitdir/gitweb/gitweb_config.perl" <<EOF
-#!@PERL@
+#!@PERL_PATH@
our \$projectroot = "$(dirname "$fqgitdir")";
our \$git_temp = "$fqgitdir/gitweb/tmp";
our \$projects_list = \$projectroot;
diff --git a/git-request-pull.sh b/git-request-pull.sh
index 10c88639e28..775ba8ea11a 100755
--- a/git-request-pull.sh
+++ b/git-request-pull.sh
@@ -112,7 +112,7 @@ find_matching_ref='
}
'
-set fnord $(git ls-remote "$url" | @PERL@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
+set fnord $(git ls-remote "$url" | @PERL_PATH@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
remote_sha1=$2
ref=$3
--
2.47.0.72.gef8ce8f3d4.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v3 04/15] Makefile: extract script to massage Perl scripts
2024-10-18 12:23 ` [RFC PATCH v3 00/15] Modernize the " Patrick Steinhardt
` (2 preceding siblings ...)
2024-10-18 12:23 ` [RFC PATCH v3 03/15] Makefile: consistently use PERL_PATH Patrick Steinhardt
@ 2024-10-18 12:23 ` Patrick Steinhardt
2024-10-18 12:24 ` [RFC PATCH v3 05/15] Makefile: use "generate-perl.sh" to massage Perl library Patrick Steinhardt
` (13 subsequent siblings)
17 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-18 12:23 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones
Extract the script to inject various build-time parameters into our Perl
scripts into a standalone script. This is done such that we can reuse it
in other build systems.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 12 ++----------
contrib/buildsystems/CMakeLists.txt | 20 +++++++++++++++-----
generate-perl.sh | 26 ++++++++++++++++++++++++++
3 files changed, 43 insertions(+), 15 deletions(-)
create mode 100755 generate-perl.sh
diff --git a/Makefile b/Makefile
index 394466b716d..ee1ef7ce8fb 100644
--- a/Makefile
+++ b/Makefile
@@ -2604,16 +2604,8 @@ endif
PERL_DEFINES += $(gitexecdir) $(perllibdir) $(localedir)
-$(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
- $(QUIET_GEN) \
- sed -e '1{' \
- -e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \
- -e ' r GIT-PERL-HEADER' \
- -e ' G' \
- -e '}' \
- -e 's/@GIT_VERSION@/$(GIT_VERSION)/g' \
- $< >$@+ && \
- chmod +x $@+ && \
+$(SCRIPT_PERL_GEN): % : %.perl generate-perl.sh GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
+ $(QUIET_GEN)$(SHELL_PATH) generate-perl.sh ./GIT-BUILD-OPTIONS $(GIT_VERSION) GIT-PERL-HEADER "$<" "$@+" && \
mv $@+ $@
PERL_DEFINES := $(subst $(space),:,$(PERL_DEFINES))
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 608ad9714d4..7fb6a149f21 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -848,19 +848,29 @@ foreach(script ${git_shell_scripts})
endforeach()
#perl scripts
-parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" ".perl")
+parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" "")
#create perl header
file(STRINGS ${CMAKE_SOURCE_DIR}/perl/header_templates/fixed_prefix.template.pl perl_header )
string(REPLACE "@PATHSEP@" ":" perl_header "${perl_header}")
string(REPLACE "@INSTLIBDIR@" "${INSTLIBDIR}" perl_header "${perl_header}")
+file(WRITE ${CMAKE_BINARY_DIR}/PERL-HEADER ${perl_header})
foreach(script ${git_perl_scripts})
- file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.perl content NEWLINE_CONSUME)
- string(REPLACE "#!/usr/bin/perl" "#!/usr/bin/perl\n${perl_header}\n" content "${content}")
- string(REPLACE "@GIT_VERSION@" "${PROJECT_VERSION}" content "${content}")
- file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
+ string(REPLACE ".perl" "" perl_gen_path "${script}")
+
+ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${perl_gen_path}
+ COMMAND ${CMAKE_SOURCE_DIR}/generate-perl.sh
+ ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS
+ ${PROJECT_VERSION}
+ ${CMAKE_BINARY_DIR}/PERL-HEADER
+ ${CMAKE_SOURCE_DIR}/${script}
+ ${CMAKE_BINARY_DIR}/${perl_gen_path}
+ DEPENDS ${CMAKE_SOURCE_DIR}/generate-perl.sh
+ ${CMAKE_SOURCE_DIR}/${script})
+ list(APPEND perl_gen ${CMAKE_BINARY_DIR}/${perl_gen_path})
endforeach()
+add_custom_target(perl-gen ALL DEPENDS ${perl_gen})
#python script
file(STRINGS ${CMAKE_SOURCE_DIR}/git-p4.py content NEWLINE_CONSUME)
diff --git a/generate-perl.sh b/generate-perl.sh
new file mode 100755
index 00000000000..12e116b76e5
--- /dev/null
+++ b/generate-perl.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+set -e
+
+if test $# -ne 5
+then
+ echo "USAGE: $0 <GIT_BUILD_OPTIONS> <GIT_VERSION> <PERL_HEADER> <INPUT> <OUTPUT>" >&2
+ exit 1
+fi
+
+GIT_BUILD_OPTIONS="$1"
+GIT_VERSION="$2"
+PERL_HEADER="$3"
+INPUT="$4"
+OUTPUT="$5"
+
+. "$GIT_BUILD_OPTIONS"
+
+sed -e '1{' \
+ -e " s|#!.*perl|#!$PERL_PATH|" \
+ -e " r $PERL_HEADER" \
+ -e ' G' \
+ -e '}' \
+ -e "s/@GIT_VERSION@/$GIT_VERSION/g" \
+ "$INPUT" >"$OUTPUT"
+chmod a+x "$OUTPUT"
--
2.47.0.72.gef8ce8f3d4.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v3 05/15] Makefile: use "generate-perl.sh" to massage Perl library
2024-10-18 12:23 ` [RFC PATCH v3 00/15] Modernize the " Patrick Steinhardt
` (3 preceding siblings ...)
2024-10-18 12:23 ` [RFC PATCH v3 04/15] Makefile: extract script to massage Perl scripts Patrick Steinhardt
@ 2024-10-18 12:24 ` Patrick Steinhardt
2024-10-18 12:24 ` [RFC PATCH v3 06/15] Makefile: extract script to massage Shell scripts Patrick Steinhardt
` (12 subsequent siblings)
17 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-18 12:24 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones
Extend "generate-perl.sh" such that it knows to also massage the Perl
library files. There are two major differences:
- We do not read in the Perl header. This is handled by matching on
whether or not we have a Perl shebang.
- We substitute some more variables, which we read in via our
GIT-BUILD-OPTIONS.
Adapt both our Makefile and the CMake build instructions to use this.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-BUILD-OPTIONS.in | 2 ++
Makefile | 10 ++++------
contrib/buildsystems/CMakeLists.txt | 20 ++++++--------------
generate-perl.sh | 14 ++++++++++++--
4 files changed, 24 insertions(+), 22 deletions(-)
diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in
index f0ca240493c..050432f9fc4 100644
--- a/GIT-BUILD-OPTIONS.in
+++ b/GIT-BUILD-OPTIONS.in
@@ -1,6 +1,8 @@
SHELL_PATH=@SHELL_PATH@
TEST_SHELL_PATH=@TEST_SHELL_PATH@
PERL_PATH=@PERL_PATH@
+PERL_LOCALEDIR=@PERL_LOCALEDIR@
+NO_PERL_CPAN_FALLBACKS=@NO_PERL_CPAN_FALLBACKS@
DIFF=@DIFF@
PYTHON_PATH=@PYTHON_PATH@
TAR=@TAR@
diff --git a/Makefile b/Makefile
index ee1ef7ce8fb..770ad830292 100644
--- a/Makefile
+++ b/Makefile
@@ -3093,13 +3093,9 @@ endif
NO_PERL_CPAN_FALLBACKS_SQ = $(subst ','\'',$(NO_PERL_CPAN_FALLBACKS))
endif
-perl/build/lib/%.pm: perl/%.pm GIT-PERL-DEFINES
+perl/build/lib/%.pm: perl/%.pm generate-perl.sh GIT-BUILD-OPTIONS GIT-PERL-DEFINES
$(call mkdir_p_parent_template)
- $(QUIET_GEN) \
- sed -e 's|@LOCALEDIR@|$(perl_localedir_SQ)|g' \
- -e 's|@NO_GETTEXT@|$(NO_GETTEXT_SQ)|g' \
- -e 's|@NO_PERL_CPAN_FALLBACKS@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \
- < $< > $@
+ $(QUIET_GEN)$(SHELL_PATH) generate-perl.sh ./GIT-BUILD-OPTIONS $(GIT_VERSION) GIT-PERL-HEADER "$<" "$@"
perl/build/man/man3/Git.3pm: perl/Git.pm
$(call mkdir_p_parent_template)
@@ -3160,6 +3156,8 @@ GIT-BUILD-OPTIONS: FORCE
-e "s|@SHELL_PATH@|\'$(SHELL_PATH_SQ)\'|" \
-e "s|@TEST_SHELL_PATH@|\'$(TEST_SHELL_PATH_SQ)\'|" \
-e "s|@PERL_PATH@|\'$(PERL_PATH_SQ)\'|" \
+ -e "s|@PERL_LOCALEDIR@|\'$(perl_localedir_SQ)\'|" \
+ -e "s|@NO_PERL_CPAN_FALLBACKS@|\'$(NO_PERL_CPAN_FALLBACKS_SQ)\'|" \
-e "s|@DIFF@|\'$(DIFF)\'|" \
-e "s|@PYTHON_PATH@|\'$(PYTHON_PATH_SQ)\'|" \
-e "s|@TAR@|\'$(TAR)\'|" \
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 7fb6a149f21..ddf39dc90e7 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -849,6 +849,9 @@ endforeach()
#perl scripts
parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" "")
+#perl modules
+file(GLOB_RECURSE perl_modules "${CMAKE_SOURCE_DIR}/perl/*.pm")
+list(TRANSFORM perl_modules REPLACE "${CMAKE_SOURCE_DIR}/" "")
#create perl header
file(STRINGS ${CMAKE_SOURCE_DIR}/perl/header_templates/fixed_prefix.template.pl perl_header )
@@ -856,7 +859,7 @@ string(REPLACE "@PATHSEP@" ":" perl_header "${perl_header}")
string(REPLACE "@INSTLIBDIR@" "${INSTLIBDIR}" perl_header "${perl_header}")
file(WRITE ${CMAKE_BINARY_DIR}/PERL-HEADER ${perl_header})
-foreach(script ${git_perl_scripts})
+foreach(script ${git_perl_scripts} ${perl_modules})
string(REPLACE ".perl" "" perl_gen_path "${script}")
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${perl_gen_path}
@@ -877,19 +880,6 @@ file(STRINGS ${CMAKE_SOURCE_DIR}/git-p4.py content NEWLINE_CONSUME)
string(REPLACE "#!/usr/bin/env python" "#!/usr/bin/python" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/git-p4 ${content})
-#perl modules
-file(GLOB_RECURSE perl_modules "${CMAKE_SOURCE_DIR}/perl/*.pm")
-
-foreach(pm ${perl_modules})
- string(REPLACE "${CMAKE_SOURCE_DIR}/perl/" "" file_path ${pm})
- file(STRINGS ${pm} content NEWLINE_CONSUME)
- string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}")
- string(REPLACE "@NO_PERL_CPAN_FALLBACKS@" "" content "${content}")
- file(WRITE ${CMAKE_BINARY_DIR}/perl/build/lib/${file_path} ${content})
-#test-lib.sh requires perl/build/lib to be the build directory of perl modules
-endforeach()
-
-
#templates
file(GLOB templates "${CMAKE_SOURCE_DIR}/templates/*")
list(TRANSFORM templates REPLACE "${CMAKE_SOURCE_DIR}/templates/" "")
@@ -1131,6 +1121,8 @@ file(STRINGS ${CMAKE_SOURCE_DIR}/GIT-BUILD-OPTIONS.in git_build_options NEWLINE_
string(REPLACE "@SHELL_PATH@" "${SHELL_PATH}" git_build_options "${git_build_options}")
string(REPLACE "@TEST_SHELL_PATH@" "${TEST_SHELL_PATH}" git_build_options "${git_build_options}")
string(REPLACE "@PERL_PATH@" "${PERL_PATH}" git_build_options "${git_build_options}")
+string(REPLACE "@PERL_LOCALEDIR@" "${LOCALEDIR}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PERL_CPAN_FALLBACKS@" "" git_build_options "${git_build_options}")
string(REPLACE "@DIFF@" "${DIFF}" git_build_options "${git_build_options}")
string(REPLACE "@PYTHON_PATH@" "${PYTHON_PATH}" git_build_options "${git_build_options}")
string(REPLACE "@TAR@" "${TAR}" git_build_options "${git_build_options}")
diff --git a/generate-perl.sh b/generate-perl.sh
index 12e116b76e5..cb1629857c6 100755
--- a/generate-perl.sh
+++ b/generate-perl.sh
@@ -17,10 +17,20 @@ OUTPUT="$5"
. "$GIT_BUILD_OPTIONS"
sed -e '1{' \
+ -e " /^#!.*perl/!b" \
-e " s|#!.*perl|#!$PERL_PATH|" \
-e " r $PERL_HEADER" \
-e ' G' \
-e '}' \
- -e "s/@GIT_VERSION@/$GIT_VERSION/g" \
+ -e "s|@GIT_VERSION@|$GIT_VERSION|g" \
+ -e "s|@LOCALEDIR@|$PERL_LOCALEDIR|g" \
+ -e "s|@NO_GETTEXT@|$NO_GETTEXT|g" \
+ -e "s|@NO_PERL_CPAN_FALLBACKS@|$NO_PERL_CPAN_FALLBACKS|g" \
"$INPUT" >"$OUTPUT"
-chmod a+x "$OUTPUT"
+
+case "$(basename "$INPUT")" in
+*.perl)
+ chmod a+x "$OUTPUT";;
+*)
+ ;;
+esac
--
2.47.0.72.gef8ce8f3d4.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v3 06/15] Makefile: extract script to massage Shell scripts
2024-10-18 12:23 ` [RFC PATCH v3 00/15] Modernize the " Patrick Steinhardt
` (4 preceding siblings ...)
2024-10-18 12:24 ` [RFC PATCH v3 05/15] Makefile: use "generate-perl.sh" to massage Perl library Patrick Steinhardt
@ 2024-10-18 12:24 ` Patrick Steinhardt
2024-10-18 12:24 ` [RFC PATCH v3 07/15] Makefile: extract script to generate gitweb.cgi Patrick Steinhardt
` (11 subsequent siblings)
17 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-18 12:24 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones
Same as in the preceding commits, extract a script that allows us to
unify how we massage shell scripts.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-BUILD-OPTIONS.in | 4 ++++
Makefile | 34 +++++++++--------------------
contrib/buildsystems/CMakeLists.txt | 30 +++++++++++++++----------
generate-script.sh | 34 +++++++++++++++++++++++++++++
4 files changed, 67 insertions(+), 35 deletions(-)
create mode 100755 generate-script.sh
diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in
index 050432f9fc4..9b95a6b3eee 100644
--- a/GIT-BUILD-OPTIONS.in
+++ b/GIT-BUILD-OPTIONS.in
@@ -36,3 +36,7 @@ GIT_INTEROP_MAKE_OPTS=@GIT_INTEROP_MAKE_OPTS@
GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@
GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@
RUNTIME_PREFIX=@RUNTIME_PREFIX@
+GITWEBDIR=@GITWEBDIR@
+USE_GETTEXT_SCHEME=@USE_GETTEXT_SCHEME@
+LOCALEDIR=@LOCALEDIR@
+BROKEN_PATH_FIX=@BROKEN_PATH_FIX@
diff --git a/Makefile b/Makefile
index 770ad830292..85877b25bab 100644
--- a/Makefile
+++ b/Makefile
@@ -1555,10 +1555,10 @@ endif
ifdef SANE_TOOL_PATH
SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH))
-BROKEN_PATH_FIX = 's|^\# @BROKEN_PATH_FIX@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|'
+BROKEN_PATH_FIX = s|^\# @BROKEN_PATH_FIX@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|
PATH := $(SANE_TOOL_PATH):${PATH}
else
-BROKEN_PATH_FIX = '/^\# @BROKEN_PATH_FIX@$$/d'
+BROKEN_PATH_FIX = /^\# @BROKEN_PATH_FIX@$$/d
endif
ifeq (,$(HOST_CPU))
@@ -2545,26 +2545,8 @@ GIT-SCRIPT-DEFINES: FORCE
echo "$$FLAGS" >$@; \
fi
-define cmd_munge_script
-sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
- -e 's|@DIFF@|$(DIFF_SQ)|' \
- -e 's|@LOCALEDIR@|$(localedir_SQ)|g' \
- -e 's/@USE_GETTEXT_SCHEME@/$(USE_GETTEXT_SCHEME)/g' \
- -e $(BROKEN_PATH_FIX) \
- -e 's|@GITWEBDIR@|$(gitwebdir_SQ)|g' \
- -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' \
- -e 's|@PAGER_ENV@|$(PAGER_ENV_SQ)|g' \
- $@.sh >$@+
-endef
-
-$(SCRIPT_SH_GEN) : % : %.sh GIT-SCRIPT-DEFINES
- $(QUIET_GEN)$(cmd_munge_script) && \
- chmod +x $@+ && \
- mv $@+ $@
-
-$(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEFINES
- $(QUIET_GEN)$(cmd_munge_script) && \
+$(SCRIPT_SH_GEN) $(SCRIPT_LIB) : % : %.sh generate-script.sh GIT-BUILD-OPTIONS GIT-SCRIPT-DEFINES
+ $(QUIET_GEN)./generate-script.sh "$<" "$@+" ./GIT-BUILD-OPTIONS && \
mv $@+ $@
git.res: git.rc GIT-VERSION-FILE GIT-PREFIX
@@ -2633,8 +2615,8 @@ GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile
perllibdir:
@echo '$(perllibdir_SQ)'
-git-instaweb: git-instaweb.sh GIT-SCRIPT-DEFINES
- $(QUIET_GEN)$(cmd_munge_script) && \
+git-instaweb: git-instaweb.sh generate-script.sh GIT-BUILD-OPTIONS GIT-SCRIPT-DEFINES
+ $(QUIET_GEN)./generate-script.sh "$<" "$@+" ./GIT-BUILD-OPTIONS && \
chmod +x $@+ && \
mv $@+ $@
else # NO_PERL
@@ -3191,6 +3173,10 @@ GIT-BUILD-OPTIONS: FORCE
-e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \
-e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \
-e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX)\'|" \
+ -e "s|@GITWEBDIR@|\'$(gitwebdir_SQ)\'|" \
+ -e "s|@USE_GETTEXT_SCHEME@|\'$(USE_GETTEXT_SCHEME)\'|" \
+ -e "s|@LOCALEDIR@|\'$(localedir_SQ)\'|" \
+ -e "s|@BROKEN_PATH_FIX@|\'$(BROKEN_PATH_FIX)\'|" \
GIT-BUILD-OPTIONS.in >$@+
@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
@if test -f GIT-BUILD-DIR; then rm GIT-BUILD-DIR; fi
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index ddf39dc90e7..2e22e87d188 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -834,18 +834,22 @@ set(git_shell_scripts
${git_sh_scripts} ${git_shlib_scripts} git-instaweb)
foreach(script ${git_shell_scripts})
- file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.sh content NEWLINE_CONSUME)
- string(REPLACE "@SHELL_PATH@" "${SHELL_PATH}" content "${content}")
- string(REPLACE "@DIFF@" "diff" content "${content}")
- string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}")
- string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" content "${content}")
- string(REPLACE "@NO_CURL@" "" content "${content}")
- string(REPLACE "@USE_GETTEXT_SCHEME@" "" content "${content}")
- string(REPLACE "# @BROKEN_PATH_FIX@" "" content "${content}")
- string(REPLACE "@PERL_PATH@" "${PERL_PATH}" content "${content}")
- string(REPLACE "@PAGER_ENV@" "LESS=FRX LV=-c" content "${content}")
- file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
+ if ("${script}" IN_LIST git_sh_scripts)
+ string(REPLACE ".sh" "" shell_gen_path "${script}")
+ else()
+ set(shell_gen_path "${script}")
+ endif()
+
+ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${shell_gen_path}
+ COMMAND ${CMAKE_SOURCE_DIR}/generate-script.sh
+ ${CMAKE_SOURCE_DIR}/${script}.sh
+ ${CMAKE_BINARY_DIR}/${shell_gen_path}
+ ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS
+ DEPENDS ${CMAKE_SOURCE_DIR}/generate-script.sh
+ ${CMAKE_SOURCE_DIR}/${script}.sh)
+ list(APPEND shell_gen ${CMAKE_BINARY_DIR}/${shell_gen_path})
endforeach()
+add_custom_target(shell-gen ALL DEPENDS ${shell_gen})
#perl scripts
parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" "")
@@ -1156,6 +1160,10 @@ string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_optio
string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}")
string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}")
string(REPLACE "@RUNTIME_PREFIX@" "${RUNTIME_PREFIX}" git_build_options "${git_build_options}")
+string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" git_build_options "${git_build_options}")
+string(REPLACE "@USE_GETTEXT_SCHEME@" "" git_build_options "${git_build_options}")
+string(REPLACE "@LOCALEDIR@" "LOCALEDIR" git_build_options "${git_build_options}")
+string(REPLACE "@BROKEN_PATH_FIX@" "" git_build_options "${git_build_options}")
if(USE_VCPKG)
string(APPEND git_build_options "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
endif()
diff --git a/generate-script.sh b/generate-script.sh
new file mode 100755
index 00000000000..d001e43d7bf
--- /dev/null
+++ b/generate-script.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+set -e
+
+if test $# -ne 3
+then
+ echo "USAGE: $0 <INPUT> <OUTPUT> <GIT-BUILD-OPTIONS>" >&2
+ exit 1
+fi
+
+INPUT="$1"
+OUTPUT="$2"
+BUILD_OPTIONS="$3"
+
+. "$BUILD_OPTIONS"
+
+sed -e "1s|#!.*/sh|#!$SHELL_PATH|" \
+ -e "s|@SHELL_PATH@|$SHELL_PATH|" \
+ -e "s|@DIFF@|$DIFF|" \
+ -e "s|@LOCALEDIR@|$LOCALEDIR|g" \
+ -e "s/@USE_GETTEXT_SCHEME@/$USE_GETTEXT_SCHEME/g" \
+ -e "$BROKEN_PATH_FIX" \
+ -e "s|@GITWEBDIR@|$GITWEBDIR|g" \
+ -e "s|@PERL_PATH@|$PERL_PATH|g" \
+ -e "s|@PAGER_ENV@|$PAGER_ENV|g" \
+ "$INPUT" >"$OUTPUT"
+
+case "$(basename "$INPUT")" in
+git-mergetool--lib.sh|git-sh-i18n.sh|git-sh-setup.sh)
+ ;;
+*)
+ chmod a+x "$OUTPUT"
+ ;;
+esac
--
2.47.0.72.gef8ce8f3d4.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v3 07/15] Makefile: extract script to generate gitweb.cgi
2024-10-18 12:23 ` [RFC PATCH v3 00/15] Modernize the " Patrick Steinhardt
` (5 preceding siblings ...)
2024-10-18 12:24 ` [RFC PATCH v3 06/15] Makefile: extract script to massage Shell scripts Patrick Steinhardt
@ 2024-10-18 12:24 ` Patrick Steinhardt
2024-10-18 12:24 ` [RFC PATCH v3 08/15] Makefile: refactor GIT-VERSION-GEN to be reusable Patrick Steinhardt
` (10 subsequent siblings)
17 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-18 12:24 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones
In order to generate "gitweb.cgi" we have to replace various different
placeholders. This is done ad-hoc and is thus not easily reusable across
different build systems.
Introduce a new GITWEB-BUILD-OPTIONS.in template that we populate at
configuration time with the expected options. This script is then used
as input for a new "generate-gitweb.sh" script that generates the final
"gitweb.cgi" file. While this requires us to repeat the options multiple
times, it is in line to how we generate other build options like our
GIT-BUILD-OPTIONS file.
While at it, refactor how we replace the GITWEB_PROJECT_MAXDEPTH. Even
though this variable is supposed to be an integer, the source file has
the value quoted. The quotes are eventually stripped via sed(1), which
replaces `"@GITWEB_PROJECT_MAXDEPTH@"` with the actual value, which is
rather nonsensical. This is made clearer by just dropping the quotes in
the source file.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
gitweb/GITWEB-BUILD-OPTIONS.in | 25 +++++++++++++++
gitweb/Makefile | 58 ++++++++++++++++------------------
gitweb/generate-gitweb.sh | 45 ++++++++++++++++++++++++++
gitweb/gitweb.perl | 2 +-
4 files changed, 99 insertions(+), 31 deletions(-)
create mode 100644 gitweb/GITWEB-BUILD-OPTIONS.in
create mode 100755 gitweb/generate-gitweb.sh
diff --git a/gitweb/GITWEB-BUILD-OPTIONS.in b/gitweb/GITWEB-BUILD-OPTIONS.in
new file mode 100644
index 00000000000..20a6487796f
--- /dev/null
+++ b/gitweb/GITWEB-BUILD-OPTIONS.in
@@ -0,0 +1,25 @@
+PERL_PATH=@PERL_PATH@
+JSMIN=@JSMIN@
+CSSMIN=@CSSMIN@
+GIT_VERSION=@GIT_VERSION@
+GIT_BINDIR=@GIT_BINDIR@
+GITWEB_CONFIG=@GITWEB_CONFIG@
+GITWEB_CONFIG_SYSTEM=@GITWEB_CONFIG_SYSTEM@
+GITWEB_CONFIG_COMMON=@GITWEB_CONFIG_COMMON@
+GITWEB_HOME_LINK_STR=@GITWEB_HOME_LINK_STR@
+GITWEB_SITENAME=@GITWEB_SITENAME@
+GITWEB_PROJECTROOT=@GITWEB_PROJECTROOT@
+GITWEB_PROJECT_MAXDEPTH=@GITWEB_PROJECT_MAXDEPTH@
+GITWEB_EXPORT_OK=@GITWEB_EXPORT_OK@
+GITWEB_STRICT_EXPORT=@GITWEB_STRICT_EXPORT@
+GITWEB_BASE_URL=@GITWEB_BASE_URL@
+GITWEB_LIST=@GITWEB_LIST@
+GITWEB_HOMETEXT=@GITWEB_HOMETEXT@
+GITWEB_CSS=@GITWEB_CSS@
+GITWEB_LOGO=@GITWEB_LOGO@
+GITWEB_FAVICON=@GITWEB_FAVICON@
+GITWEB_JS=@GITWEB_JS@
+GITWEB_SITE_HTML_HEAD_STRING=@GITWEB_SITE_HTML_HEAD_STRING@
+GITWEB_SITE_HEADER=@GITWEB_SITE_HEADER@
+GITWEB_SITE_FOOTER=@GITWEB_SITE_FOOTER@
+HIGHLIGHT_BIN=@HIGHLIGHT_BIN@
diff --git a/gitweb/Makefile b/gitweb/Makefile
index 164c8d53757..48c3958bc66 100644
--- a/gitweb/Makefile
+++ b/gitweb/Makefile
@@ -77,43 +77,41 @@ GITWEB_JSLIB_FILES += static/js/javascript-detection.js
GITWEB_JSLIB_FILES += static/js/adjust-timezone.js
GITWEB_JSLIB_FILES += static/js/blame_incremental.js
-
-GITWEB_REPLACE = \
- -e 's|@GIT_VERSION@|$(GIT_VERSION)|g' \
- -e 's|@GIT_BINDIR@|$(bindir)|g' \
- -e 's|@GITWEB_CONFIG@|$(GITWEB_CONFIG)|g' \
- -e 's|@GITWEB_CONFIG_SYSTEM@|$(GITWEB_CONFIG_SYSTEM)|g' \
- -e 's|@GITWEB_CONFIG_COMMON@|$(GITWEB_CONFIG_COMMON)|g' \
- -e 's|@GITWEB_HOME_LINK_STR@|$(GITWEB_HOME_LINK_STR)|g' \
- -e 's|@GITWEB_SITENAME@|$(GITWEB_SITENAME)|g' \
- -e 's|@GITWEB_PROJECTROOT@|$(GITWEB_PROJECTROOT)|g' \
- -e 's|"@GITWEB_PROJECT_MAXDEPTH@"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
- -e 's|@GITWEB_EXPORT_OK@|$(GITWEB_EXPORT_OK)|g' \
- -e 's|@GITWEB_STRICT_EXPORT@|$(GITWEB_STRICT_EXPORT)|g' \
- -e 's|@GITWEB_BASE_URL@|$(GITWEB_BASE_URL)|g' \
- -e 's|@GITWEB_LIST@|$(GITWEB_LIST)|g' \
- -e 's|@GITWEB_HOMETEXT@|$(GITWEB_HOMETEXT)|g' \
- -e 's|@GITWEB_CSS@|$(GITWEB_CSS)|g' \
- -e 's|@GITWEB_LOGO@|$(GITWEB_LOGO)|g' \
- -e 's|@GITWEB_FAVICON@|$(GITWEB_FAVICON)|g' \
- -e 's|@GITWEB_JS@|$(GITWEB_JS)|g' \
- -e 's|@GITWEB_SITE_HTML_HEAD_STRING@|$(GITWEB_SITE_HTML_HEAD_STRING)|g' \
- -e 's|@GITWEB_SITE_HEADER@|$(GITWEB_SITE_HEADER)|g' \
- -e 's|@GITWEB_SITE_FOOTER@|$(GITWEB_SITE_FOOTER)|g' \
- -e 's|@HIGHLIGHT_BIN@|$(HIGHLIGHT_BIN)|g'
-
.PHONY: FORCE
$(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS: FORCE
- @rm -f $@+
- @echo "x" '$(PERL_PATH_SQ)' $(GITWEB_REPLACE) "$(JSMIN)|$(CSSMIN)" >$@+
+ @sed -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|' \
+ -e 's|@JSMIN@|$(JSMIN)|' \
+ -e 's|@CSSMIN@|$(CSSMIN)|' \
+ -e 's|@GIT_VERSION@|$(GIT_VERSION)|' \
+ -e 's|@GIT_BINDIR@|$(bindir)|' \
+ -e 's|@GITWEB_CONFIG@|$(GITWEB_CONFIG)|' \
+ -e 's|@GITWEB_CONFIG_SYSTEM@|$(GITWEB_CONFIG_SYSTEM)|' \
+ -e 's|@GITWEB_CONFIG_COMMON@|$(GITWEB_CONFIG_COMMON)|' \
+ -e 's|@GITWEB_HOME_LINK_STR@|$(GITWEB_HOME_LINK_STR)|' \
+ -e 's|@GITWEB_SITENAME@|$(GITWEB_SITENAME)|' \
+ -e 's|@GITWEB_PROJECTROOT@|$(GITWEB_PROJECTROOT)|' \
+ -e 's|@GITWEB_PROJECT_MAXDEPTH@|$(GITWEB_PROJECT_MAXDEPTH)|' \
+ -e 's|@GITWEB_EXPORT_OK@|$(GITWEB_EXPORT_OK)|' \
+ -e 's|@GITWEB_STRICT_EXPORT@|$(GITWEB_STRICT_EXPORT)|' \
+ -e 's|@GITWEB_BASE_URL@|$(GITWEB_BASE_URL)|' \
+ -e 's|@GITWEB_LIST@|$(GITWEB_LIST)|' \
+ -e 's|@GITWEB_HOMETEXT@|$(GITWEB_HOMETEXT)|' \
+ -e 's|@GITWEB_CSS@|$(GITWEB_CSS)|' \
+ -e 's|@GITWEB_LOGO@|$(GITWEB_LOGO)|' \
+ -e 's|@GITWEB_FAVICON@|$(GITWEB_FAVICON)|' \
+ -e 's|@GITWEB_JS@|$(GITWEB_JS)|' \
+ -e 's|@GITWEB_SITE_HTML_HEAD_STRING@|$(GITWEB_SITE_HTML_HEAD_STRING)|' \
+ -e 's|@GITWEB_SITE_HEADER@|$(GITWEB_SITE_HEADER)|' \
+ -e 's|@GITWEB_SITE_FOOTER@|$(GITWEB_SITE_FOOTER)|' \
+ -e 's|@HIGHLIGHT_BIN@|$(HIGHLIGHT_BIN)|' \
+ $(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS.in >"$@+"
@cmp -s $@+ $@ && rm -f $@+ || mv -f $@+ $@
+$(MAK_DIR_GITWEB)gitweb.cgi: $(MAK_DIR_GITWEB)generate-gitweb.sh
$(MAK_DIR_GITWEB)gitweb.cgi: $(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS
$(MAK_DIR_GITWEB)gitweb.cgi: $(MAK_DIR_GITWEB)gitweb.perl
$(QUIET_GEN)$(RM) $@ $@+ && \
- sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
- $(GITWEB_REPLACE) $< >$@+ && \
- chmod +x $@+ && \
+ $(MAK_DIR_GITWEB)generate-gitweb.sh $(MAK_DIR_GITWEB)/GITWEB-BUILD-OPTIONS $< $@+ && \
mv $@+ $@
$(MAK_DIR_GITWEB)static/gitweb.js: $(addprefix $(MAK_DIR_GITWEB),$(GITWEB_JSLIB_FILES))
diff --git a/gitweb/generate-gitweb.sh b/gitweb/generate-gitweb.sh
new file mode 100755
index 00000000000..b47ea6e599e
--- /dev/null
+++ b/gitweb/generate-gitweb.sh
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+set -e
+
+if test $# -ne 3
+then
+ echo "USAGE: $0 <GITWEB-BUILD-OPTIONS> <INPUT> <OUTPUT>" >&2
+ exit 1
+fi
+
+GITWEB_BUILD_OPTIONS="$1"
+INPUT="$2"
+OUTPUT="$3"
+
+. "$GITWEB_BUILD_OPTIONS"
+
+sed -e "1s|#!/usr/bin/perl|#!$PERL_PATH|" \
+ -e "s|@PERL_PATH@|$PERL_PATH|" \
+ -e "s|@JSMIN@|$JSMIN|" \
+ -e "s|@CSSMIN@|$CSSMIN|" \
+ -e "s|@GIT_VERSION@|$GIT_VERSION|" \
+ -e "s|@GIT_BINDIR@|$GIT_BINDIR|" \
+ -e "s|@GITWEB_CONFIG@|$GITWEB_CONFIG|" \
+ -e "s|@GITWEB_CONFIG_SYSTEM@|$GITWEB_CONFIG_SYSTEM|" \
+ -e "s|@GITWEB_CONFIG_COMMON@|$GITWEB_CONFIG_COMMON|" \
+ -e "s|@GITWEB_HOME_LINK_STR@|$GITWEB_HOME_LINK_STR|" \
+ -e "s|@GITWEB_SITENAME@|$GITWEB_SITENAME|" \
+ -e "s|@GITWEB_PROJECTROOT@|$GITWEB_PROJECTROOT|" \
+ -e "s|@GITWEB_PROJECT_MAXDEPTH@|$GITWEB_PROJECT_MAXDEPTH|" \
+ -e "s|@GITWEB_EXPORT_OK@|$GITWEB_EXPORT_OK|" \
+ -e "s|@GITWEB_STRICT_EXPORT@|$GITWEB_STRICT_EXPORT|" \
+ -e "s|@GITWEB_BASE_URL@|$GITWEB_BASE_URL|" \
+ -e "s|@GITWEB_LIST@|$GITWEB_LIST|" \
+ -e "s|@GITWEB_HOMETEXT@|$GITWEB_HOMETEXT|" \
+ -e "s|@GITWEB_CSS@|$GITWEB_CSS|" \
+ -e "s|@GITWEB_LOGO@|$GITWEB_LOGO|" \
+ -e "s|@GITWEB_FAVICON@|$GITWEB_FAVICON|" \
+ -e "s|@GITWEB_JS@|$GITWEB_JS|" \
+ -e "s|@GITWEB_SITE_HTML_HEAD_STRING@|$GITWEB_SITE_HTML_HEAD_STRING|" \
+ -e "s|@GITWEB_SITE_HEADER@|$GITWEB_SITE_HEADER|" \
+ -e "s|@GITWEB_SITE_FOOTER@|$GITWEB_SITE_FOOTER|" \
+ -e "s|@HIGHLIGHT_BIN@|$HIGHLIGHT_BIN|" \
+ "$INPUT" >"$OUTPUT"
+
+chmod a+x "$OUTPUT"
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 76e1f4e244f..41bc64ec73f 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -88,7 +88,7 @@ sub evaluate_uri {
# fs traversing limit for getting project list
# the number is relative to the projectroot
-our $project_maxdepth = "@GITWEB_PROJECT_MAXDEPTH@";
+our $project_maxdepth = @GITWEB_PROJECT_MAXDEPTH@;
# string of the home link on top of all pages
our $home_link_str = "@GITWEB_HOME_LINK_STR@";
--
2.47.0.72.gef8ce8f3d4.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v3 08/15] Makefile: refactor GIT-VERSION-GEN to be reusable
2024-10-18 12:23 ` [RFC PATCH v3 00/15] Modernize the " Patrick Steinhardt
` (6 preceding siblings ...)
2024-10-18 12:24 ` [RFC PATCH v3 07/15] Makefile: extract script to generate gitweb.cgi Patrick Steinhardt
@ 2024-10-18 12:24 ` Patrick Steinhardt
2024-10-18 12:24 ` [RFC PATCH v3 09/15] Makefile: refactor generators to be PWD-independent Patrick Steinhardt
` (9 subsequent siblings)
17 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-18 12:24 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones
Our "GIT-VERSION-GEN" script always writes the "GIT-VERSION-FILE" into
the current directory, where the expectation is that it should exist in
the source directory. But other build systems that support out-of-tree
builds may not want to do that to keep the source directory pristine,
even though CMake currently doesn't care.
Refactor the script such that it doesn't write output to a file anymore
but so that it instead writes the version to stdout. This makes it
easier to compute the same version as our Makefile would without having
to write the "GIT-VERSION-FILE".
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-VERSION-GEN | 12 +-----------
Makefile | 3 ++-
contrib/buildsystems/CMakeLists.txt | 12 ++++--------
3 files changed, 7 insertions(+), 20 deletions(-)
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index 78e8631f677..671f853512a 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -1,6 +1,5 @@
#!/bin/sh
-GVF=GIT-VERSION-FILE
DEF_VER=v2.47.GIT
LF='
@@ -28,13 +27,4 @@ fi
VN=$(expr "$VN" : v*'\(.*\)')
-if test -r $GVF
-then
- VC=$(sed -e 's/^GIT_VERSION = //' <$GVF)
-else
- VC=unset
-fi
-test "$VN" = "$VC" || {
- echo >&2 "GIT_VERSION = $VN"
- echo "GIT_VERSION = $VN" >$GVF
-}
+echo "$VN"
diff --git a/Makefile b/Makefile
index 85877b25bab..2211adbeba2 100644
--- a/Makefile
+++ b/Makefile
@@ -592,7 +592,8 @@ include shared.mak
# Disable -pedantic compilation.
GIT-VERSION-FILE: FORCE
- @$(SHELL_PATH) ./GIT-VERSION-GEN
+ @printf "GIT_VERSION = %s\n" $$($(SHELL_PATH) GIT-VERSION-GEN) >$@+
+ @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else cat $@+ >&2 && mv $@+ $@; fi
-include GIT-VERSION-FILE
# Set our default configuration.
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 2e22e87d188..e1200f294de 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -83,16 +83,12 @@ if(NOT SH_EXE)
"On Windows, you can get it as part of 'Git for Windows' install at https://gitforwindows.org/")
endif()
-#Create GIT-VERSION-FILE using GIT-VERSION-GEN
-if(NOT EXISTS ${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE)
- message("Generating GIT-VERSION-FILE")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
-endif()
+execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ OUTPUT_VARIABLE git_version
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
#Parse GIT-VERSION-FILE to get the version
-file(STRINGS ${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE git_version REGEX "GIT_VERSION = (.*)")
-string(REPLACE "GIT_VERSION = " "" git_version ${git_version})
string(FIND ${git_version} "GIT" location)
if(location EQUAL -1)
string(REGEX MATCH "[0-9]*\\.[0-9]*\\.[0-9]*" git_version ${git_version})
--
2.47.0.72.gef8ce8f3d4.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v3 09/15] Makefile: refactor generators to be PWD-independent
2024-10-18 12:23 ` [RFC PATCH v3 00/15] Modernize the " Patrick Steinhardt
` (7 preceding siblings ...)
2024-10-18 12:24 ` [RFC PATCH v3 08/15] Makefile: refactor GIT-VERSION-GEN to be reusable Patrick Steinhardt
@ 2024-10-18 12:24 ` Patrick Steinhardt
2024-10-19 5:06 ` Eric Sunshine
2024-10-18 12:24 ` [RFC PATCH v3 10/15] Makefile: allow "bin-wrappers/" directory to exist Patrick Steinhardt
` (8 subsequent siblings)
17 siblings, 1 reply; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-18 12:24 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones
We have multiple scripts that generate headers from other data. All of
these scripts have the assumption built-in that they are executed in the
current source directory, which makes them a bit unwieldy to use during
out-of-tree builds. This makes them a bit unwieldy to use. Refactor them
to instead take the source directory as well as the output file as
arguments.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 6 ++---
contrib/buildsystems/CMakeLists.txt | 12 +++------
generate-cmdlist.sh | 42 ++++++++++++++++++-----------
generate-configlist.sh | 20 ++++++++++----
generate-hooklist.sh | 15 ++++++++++-
5 files changed, 61 insertions(+), 34 deletions(-)
diff --git a/Makefile b/Makefile
index 2211adbeba2..d10a72132f7 100644
--- a/Makefile
+++ b/Makefile
@@ -2523,17 +2523,17 @@ $(BUILT_INS): git$X
config-list.h: generate-configlist.sh
config-list.h: Documentation/*config.txt Documentation/config/*.txt
- $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh >$@
+ $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh . $@
command-list.h: generate-cmdlist.sh command-list.txt
command-list.h: $(wildcard Documentation/git*.txt)
$(QUIET_GEN)$(SHELL_PATH) ./generate-cmdlist.sh \
$(patsubst %,--exclude-program %,$(EXCLUDED_PROGRAMS)) \
- command-list.txt >$@
+ . $@
hook-list.h: generate-hooklist.sh Documentation/githooks.txt
- $(QUIET_GEN)$(SHELL_PATH) ./generate-hooklist.sh >$@
+ $(QUIET_GEN)$(SHELL_PATH) ./generate-hooklist.sh . $@
SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):\
$(localedir_SQ):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index e1200f294de..f4ffe64965d 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -648,23 +648,17 @@ set(EXCLUSION_PROGS_CACHE ${EXCLUSION_PROGS} CACHE STRING "Programs not built" F
if(NOT EXISTS ${CMAKE_BINARY_DIR}/command-list.h OR NOT EXCLUSION_PROGS_CACHE STREQUAL EXCLUSION_PROGS)
list(REMOVE_ITEM EXCLUSION_PROGS empty)
message("Generating command-list.h")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-cmdlist.sh ${EXCLUSION_PROGS} command-list.txt
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_FILE ${CMAKE_BINARY_DIR}/command-list.h)
+ execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-cmdlist.sh ${EXCLUSION_PROGS} ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}/command-list.h)
endif()
if(NOT EXISTS ${CMAKE_BINARY_DIR}/config-list.h)
message("Generating config-list.h")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-configlist.sh
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_FILE ${CMAKE_BINARY_DIR}/config-list.h)
+ execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-configlist.sh ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}/config-list.h)
endif()
if(NOT EXISTS ${CMAKE_BINARY_DIR}/hook-list.h)
message("Generating hook-list.h")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-hooklist.sh
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_FILE ${CMAKE_BINARY_DIR}/hook-list.h)
+ execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-hooklist.sh ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}/hook-list.h)
endif()
include_directories(${CMAKE_BINARY_DIR})
diff --git a/generate-cmdlist.sh b/generate-cmdlist.sh
index 205541e0f7f..b923a5aab80 100755
--- a/generate-cmdlist.sh
+++ b/generate-cmdlist.sh
@@ -64,7 +64,7 @@ define_category_names () {
print_command_list () {
echo "static struct cmdname_help command_list[] = {"
- echo "$1" |
+ echo "$2" |
while read cmd rest
do
synopsis=
@@ -76,7 +76,7 @@ print_command_list () {
break
;;
esac
- done <"Documentation/$cmd.txt"
+ done <"$1/Documentation/$cmd.txt"
printf '\t{ "%s", N_("%s"), 0' "$cmd" "$synopsis"
printf " | CAT_%s" $rest
@@ -93,18 +93,28 @@ do
shift
done
-commands="$(command_list "$1")"
-categories="$(category_list "$commands")"
+if test "$#" -ne 2
+then
+ die "USAGE: $0 <SOURCE_DIR> <OUTPUT>"
+fi
+
+SOURCE_DIR="$1"
+OUTPUT="$2"
+
+{
+ commands="$(command_list "$SOURCE_DIR"/command-list.txt)"
+ categories="$(category_list "$commands")"
-echo "/* Automatically generated by generate-cmdlist.sh */
-struct cmdname_help {
- const char *name;
- const char *help;
- uint32_t category;
-};
-"
-define_categories "$categories"
-echo
-define_category_names "$categories"
-echo
-print_command_list "$commands"
+ echo "/* Automatically generated by generate-cmdlist.sh */
+ struct cmdname_help {
+ const char *name;
+ const char *help;
+ uint32_t category;
+ };
+ "
+ define_categories "$categories"
+ echo
+ define_category_names "$categories"
+ echo
+ print_command_list "$SOURCE_DIR" "$commands"
+} >"$OUTPUT"
diff --git a/generate-configlist.sh b/generate-configlist.sh
index 8692fe5cf4d..512804a1ca1 100755
--- a/generate-configlist.sh
+++ b/generate-configlist.sh
@@ -1,13 +1,19 @@
#!/bin/sh
-echo "/* Automatically generated by generate-configlist.sh */"
-echo
+SOURCE_DIR="$1"
+OUTPUT="$2"
+
+if test -z "$SOURCE_DIR" || ! test -d "$SOURCE_DIR" || test -z "$OUTPUT"
+then
+ echo "USAGE: $0 <SOURCE_DIR> <OUTPUT>" >&2
+ exit 1
+fi
print_config_list () {
cat <<EOF
static const char *config_name_list[] = {
EOF
- grep -h '^[a-zA-Z].*\..*::$' Documentation/*config.txt Documentation/config/*.txt |
+ grep -h '^[a-zA-Z].*\..*::$' "$SOURCE_DIR"/Documentation/*config.txt "$SOURCE_DIR"/Documentation/config/*.txt |
sed '/deprecated/d; s/::$//; s/, */\n/g' |
sort |
sed 's/^.*$/ "&",/'
@@ -17,5 +23,9 @@ EOF
EOF
}
-echo
-print_config_list
+{
+ echo "/* Automatically generated by generate-configlist.sh */"
+ echo
+ echo
+ print_config_list
+} >"$OUTPUT"
diff --git a/generate-hooklist.sh b/generate-hooklist.sh
index 2f9f54eb545..0ff2a0b6fbd 100755
--- a/generate-hooklist.sh
+++ b/generate-hooklist.sh
@@ -2,6 +2,17 @@
#
# Usage: ./generate-hooklist.sh >hook-list.h
+SOURCE_DIR="$1"
+OUTPUT="$2"
+
+if test -z "$SOURCE_DIR" || ! test -d "$SOURCE_DIR" || test -z "$OUTPUT"
+then
+ echo "USAGE: $0 <SOURCE_DIR> <OUTPUT>" >&2
+ exit 1
+fi
+
+{
+
cat <<EOF
/* Automatically generated by generate-hooklist.sh */
@@ -11,10 +22,12 @@ EOF
sed -n \
-e '/^~~~~*$/ {x; s/^.*$/ "&",/; p;}' \
-e 'x' \
- <Documentation/githooks.txt |
+ <"$SOURCE_DIR"/Documentation/githooks.txt |
LC_ALL=C sort
cat <<EOF
NULL,
};
EOF
+
+} >"$OUTPUT"
--
2.47.0.72.gef8ce8f3d4.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v3 10/15] Makefile: allow "bin-wrappers/" directory to exist
2024-10-18 12:23 ` [RFC PATCH v3 00/15] Modernize the " Patrick Steinhardt
` (8 preceding siblings ...)
2024-10-18 12:24 ` [RFC PATCH v3 09/15] Makefile: refactor generators to be PWD-independent Patrick Steinhardt
@ 2024-10-18 12:24 ` Patrick Steinhardt
2024-10-18 12:24 ` [RFC PATCH v3 11/15] Makefile: simplify building of templates Patrick Steinhardt
` (7 subsequent siblings)
17 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-18 12:24 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones
The "bin-wrappers/" directory gets created by our build system and is
populated with one script for each of our binaries. There isn't anything
inherently wrong with the current layout, but it is somewhat hard to
adapt for out-of-tree build systems.
Adapt the layout such that our "bin-wrappers/" directory always exists
and contains our "wrap-for-bin.sh" script to make things a little bit
easier for subsequent steps.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
.gitignore | 1 -
Documentation/CodingGuidelines | 2 +-
Makefile | 6 +++---
bin-wrappers/.gitignore | 9 +++++++++
wrap-for-bin.sh => bin-wrappers/wrap-for-bin.sh | 0
contrib/buildsystems/CMakeLists.txt | 6 +++---
6 files changed, 16 insertions(+), 8 deletions(-)
create mode 100644 bin-wrappers/.gitignore
rename wrap-for-bin.sh => bin-wrappers/wrap-for-bin.sh (100%)
mode change 100644 => 100755
diff --git a/.gitignore b/.gitignore
index 6687bd6db4c..349673c55c9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,7 +12,6 @@
/GIT-TEST-SUITES
/GIT-USER-AGENT
/GIT-VERSION-FILE
-/bin-wrappers/
/git
/git-add
/git-am
diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
index 30fda4142ca..982b705f0d8 100644
--- a/Documentation/CodingGuidelines
+++ b/Documentation/CodingGuidelines
@@ -583,7 +583,7 @@ For C programs:
Run `GIT_DEBUGGER=1 ./bin-wrappers/git foo` to simply use gdb as is, or
run `GIT_DEBUGGER="<debugger> <debugger-args>" ./bin-wrappers/git foo` to
use your own debugger and arguments. Example: `GIT_DEBUGGER="ddd --gdb"
- ./bin-wrappers/git log` (See `wrap-for-bin.sh`.)
+ ./bin-wrappers/git log` (See `bin-wrappers/wrap-for-bin.sh`.)
- The primary data structure that a subsystem 'S' deals with is called
`struct S`. Functions that operate on `struct S` are named
diff --git a/Makefile b/Makefile
index d10a72132f7..dc6510028fb 100644
--- a/Makefile
+++ b/Makefile
@@ -3198,8 +3198,7 @@ test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $(
all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PROG)
-bin-wrappers/%: wrap-for-bin.sh
- $(call mkdir_p_parent_template)
+$(test_bindir_programs): bin-wrappers/%: bin-wrappers/wrap-for-bin.sh
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@BUILD_DIR@|$(shell pwd)|' \
-e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
@@ -3695,7 +3694,8 @@ clean: profile-clean coverage-clean cocciclean
$(RM) $(FUZZ_PROGRAMS)
$(RM) $(SP_OBJ)
$(RM) $(HCC)
- $(RM) -r bin-wrappers $(dep_dirs) $(compdb_dir) compile_commands.json
+ $(RM) -r $(dep_dirs) $(compdb_dir) compile_commands.json
+ $(RM) $(test_bindir_programs)
$(RM) -r po/build/
$(RM) *.pyc *.pyo */*.pyc */*.pyo $(GENERATED_H) $(ETAGS_TARGET) tags cscope*
$(RM) -r .dist-tmp-dir .doc-tmp-dir
diff --git a/bin-wrappers/.gitignore b/bin-wrappers/.gitignore
new file mode 100644
index 00000000000..1c6c90458b7
--- /dev/null
+++ b/bin-wrappers/.gitignore
@@ -0,0 +1,9 @@
+/git
+/git-cvsserver
+/git-receive-pack
+/git-shell
+/git-upload-archive
+/git-upload-pack
+/scalar
+/test-fake-ssh
+/test-tool
diff --git a/wrap-for-bin.sh b/bin-wrappers/wrap-for-bin.sh
old mode 100644
new mode 100755
similarity index 100%
rename from wrap-for-bin.sh
rename to bin-wrappers/wrap-for-bin.sh
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index f4ffe64965d..fdf0c0ff769 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -1049,20 +1049,20 @@ set(wrapper_test_scripts
foreach(script ${wrapper_scripts})
- file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
+ file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
string(REPLACE "@PROG@" "${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
foreach(script ${wrapper_test_scripts})
- file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
+ file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
string(REPLACE "@PROG@" "t/helper/${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
-file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
+file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
string(REPLACE "@PROG@" "git-cvsserver" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})
--
2.47.0.72.gef8ce8f3d4.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v3 11/15] Makefile: simplify building of templates
2024-10-18 12:23 ` [RFC PATCH v3 00/15] Modernize the " Patrick Steinhardt
` (9 preceding siblings ...)
2024-10-18 12:24 ` [RFC PATCH v3 10/15] Makefile: allow "bin-wrappers/" directory to exist Patrick Steinhardt
@ 2024-10-18 12:24 ` Patrick Steinhardt
2024-10-19 5:09 ` Eric Sunshine
2024-10-18 12:24 ` [RFC PATCH v3 12/15] t: better support for out-of-tree builds Patrick Steinhardt
` (6 subsequent siblings)
17 siblings, 1 reply; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-18 12:24 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones
When we install Git we also install a set of default templates that both
git-init(1) and git-clone(1) populate into our build directories. The
way the pristine templates are layed out in our source directory is
somewhat weird though: instead of reconstructing the actual directory
hierarchy in "templates/", we represent directory separators with "--".
The only reason I could come up with for why we have this is the
"branches/" directory, which is supposed to be empty when installing it.
And as Git famously doesn't store empty directories at all we have to
work around this limitation.
Now the thing is that the "branches/" directory is a leftover to how
branches used to be stored in the dark ages. gitrepository-layout(5)
lists this directory as "slightly deprecated", which I would claim is a
strong understatement. I have never encountered anybody using it today
and would be surprised if it even works as expected. So having the "--"
hack in place for an item that is basically unused, unmaintained and
deprecated doesn't only feel unreasonable, but installing that entry by
default may also cause confusion for users that do not know what this is
supposed to be in the first place.
Remove this directory from our templates and, now that we do not require
the workaround anymore, restructure the templates to form a proper
hierarchy. This makes it way easier for build systems to install these
templates into place.
We should likely think about removing support for "branch/" altogether,
but that is outside of the scope of this patch series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
contrib/buildsystems/CMakeLists.txt | 34 ++++++----------
templates/Makefile | 39 ++++++++++++-------
templates/branches-- | 1 -
templates/{this--description => description} | 0
.../applypatch-msg.sample} | 0
.../commit-msg.sample} | 0
.../fsmonitor-watchman.sample} | 0
.../post-update.sample} | 0
.../pre-applypatch.sample} | 0
.../pre-commit.sample} | 0
.../pre-merge-commit.sample} | 0
.../pre-push.sample} | 0
.../pre-rebase.sample} | 0
.../pre-receive.sample} | 0
.../prepare-commit-msg.sample} | 0
.../push-to-checkout.sample} | 0
.../sendemail-validate.sample} | 0
.../update.sample} | 0
templates/{info--exclude => info/exclude} | 0
19 files changed, 37 insertions(+), 37 deletions(-)
delete mode 100644 templates/branches--
rename templates/{this--description => description} (100%)
rename templates/{hooks--applypatch-msg.sample => hooks/applypatch-msg.sample} (100%)
rename templates/{hooks--commit-msg.sample => hooks/commit-msg.sample} (100%)
rename templates/{hooks--fsmonitor-watchman.sample => hooks/fsmonitor-watchman.sample} (100%)
rename templates/{hooks--post-update.sample => hooks/post-update.sample} (100%)
rename templates/{hooks--pre-applypatch.sample => hooks/pre-applypatch.sample} (100%)
rename templates/{hooks--pre-commit.sample => hooks/pre-commit.sample} (100%)
rename templates/{hooks--pre-merge-commit.sample => hooks/pre-merge-commit.sample} (100%)
rename templates/{hooks--pre-push.sample => hooks/pre-push.sample} (100%)
rename templates/{hooks--pre-rebase.sample => hooks/pre-rebase.sample} (100%)
rename templates/{hooks--pre-receive.sample => hooks/pre-receive.sample} (100%)
rename templates/{hooks--prepare-commit-msg.sample => hooks/prepare-commit-msg.sample} (100%)
rename templates/{hooks--push-to-checkout.sample => hooks/push-to-checkout.sample} (100%)
rename templates/{hooks--sendemail-validate.sample => hooks/sendemail-validate.sample} (100%)
rename templates/{hooks--update.sample => hooks/update.sample} (100%)
rename templates/{info--exclude => info/exclude} (100%)
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index fdf0c0ff769..ad4e3f0b6ce 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -106,8 +106,8 @@ project(git
#TODO Enable NLS on windows natively
#macros for parsing the Makefile for sources and scripts
-macro(parse_makefile_for_sources list_var regex)
- file(STRINGS ${CMAKE_SOURCE_DIR}/Makefile ${list_var} REGEX "^${regex} \\+=(.*)")
+macro(parse_makefile_for_sources list_var makefile regex)
+ file(STRINGS ${makefile} ${list_var} REGEX "^${regex} \\+=(.*)")
string(REPLACE "${regex} +=" "" ${list_var} ${${list_var}})
string(REPLACE "$(COMPAT_OBJS)" "" ${list_var} ${${list_var}}) #remove "$(COMPAT_OBJS)" This is only for libgit.
string(STRIP ${${list_var}} ${list_var}) #remove trailing/leading whitespaces
@@ -665,20 +665,20 @@ include_directories(${CMAKE_BINARY_DIR})
#build
#libgit
-parse_makefile_for_sources(libgit_SOURCES "LIB_OBJS")
+parse_makefile_for_sources(libgit_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "LIB_OBJS")
list(TRANSFORM libgit_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
list(TRANSFORM compat_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
add_library(libgit ${libgit_SOURCES} ${compat_SOURCES})
#libxdiff
-parse_makefile_for_sources(libxdiff_SOURCES "XDIFF_OBJS")
+parse_makefile_for_sources(libxdiff_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "XDIFF_OBJS")
list(TRANSFORM libxdiff_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
add_library(xdiff STATIC ${libxdiff_SOURCES})
#reftable
-parse_makefile_for_sources(reftable_SOURCES "REFTABLE_OBJS")
+parse_makefile_for_sources(reftable_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "REFTABLE_OBJS")
list(TRANSFORM reftable_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
add_library(reftable STATIC ${reftable_SOURCES})
@@ -742,7 +742,7 @@ elseif(UNIX)
endif()
#git
-parse_makefile_for_sources(git_SOURCES "BUILTIN_OBJS")
+parse_makefile_for_sources(git_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "BUILTIN_OBJS")
list(TRANSFORM git_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
add_executable(git ${CMAKE_SOURCE_DIR}/git.c ${git_SOURCES})
@@ -874,24 +874,14 @@ file(STRINGS ${CMAKE_SOURCE_DIR}/git-p4.py content NEWLINE_CONSUME)
string(REPLACE "#!/usr/bin/env python" "#!/usr/bin/python" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/git-p4 ${content})
-#templates
-file(GLOB templates "${CMAKE_SOURCE_DIR}/templates/*")
-list(TRANSFORM templates REPLACE "${CMAKE_SOURCE_DIR}/templates/" "")
-list(REMOVE_ITEM templates ".gitignore")
-list(REMOVE_ITEM templates "Makefile")
-list(REMOVE_ITEM templates "blt")# Prevents an error when reconfiguring for in source builds
-
-list(REMOVE_ITEM templates "branches--")
-file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/templates/blt/branches) #create branches
-
+#${CMAKE_SOURCE_DIR}/Makefile templates
+parse_makefile_for_sources(templates ${CMAKE_SOURCE_DIR}/templates/Makefile "TEMPLATES")
+string(REPLACE " " ";" templates ${templates})
#templates have @.*@ replacement so use configure_file instead
foreach(tm ${templates})
- string(REPLACE "--" "/" blt_tm ${tm})
- string(REPLACE "this" "" blt_tm ${blt_tm})# for this--
- configure_file(${CMAKE_SOURCE_DIR}/templates/${tm} ${CMAKE_BINARY_DIR}/templates/blt/${blt_tm} @ONLY)
+ configure_file(${CMAKE_SOURCE_DIR}/templates/${tm} ${CMAKE_BINARY_DIR}/templates/blt/${tm} @ONLY)
endforeach()
-
#translations
if(MSGFMT_EXE)
file(GLOB po_files "${CMAKE_SOURCE_DIR}/po/*.po")
@@ -965,7 +955,7 @@ add_executable(test-fake-ssh ${CMAKE_SOURCE_DIR}/t/helper/test-fake-ssh.c)
target_link_libraries(test-fake-ssh common-main)
#unit-tests
-parse_makefile_for_sources(unit-test_SOURCES "UNIT_TEST_OBJS")
+parse_makefile_for_sources(unit-test_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "UNIT_TEST_OBJS")
list(TRANSFORM unit-test_SOURCES REPLACE "\\$\\(UNIT_TEST_DIR\\)/" "${CMAKE_SOURCE_DIR}/t/unit-tests/")
add_library(unit-test-lib STATIC ${unit-test_SOURCES})
@@ -1023,7 +1013,7 @@ if(MSVC)
endif()
#test-tool
-parse_makefile_for_sources(test-tool_SOURCES "TEST_BUILTINS_OBJS")
+parse_makefile_for_sources(test-tool_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "TEST_BUILTINS_OBJS")
add_library(test-lib OBJECT ${CMAKE_SOURCE_DIR}/t/unit-tests/test-lib.c)
list(TRANSFORM test-tool_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/t/helper/")
diff --git a/templates/Makefile b/templates/Makefile
index 367ad00c24c..bd1e9e30c12 100644
--- a/templates/Makefile
+++ b/templates/Makefile
@@ -29,24 +29,35 @@ all: boilerplates.made custom
# in a file direc--tory--file in the source. They will be
# just copied to the destination.
-bpsrc = $(filter-out %~,$(wildcard *--*))
-boilerplates.made : $(bpsrc)
- $(QUIET)umask 022 && ls *--* 2>/dev/null | \
- while read boilerplate; \
+TEMPLATES =
+TEMPLATES += description
+TEMPLATES += hooks/applypatch-msg.sample
+TEMPLATES += hooks/commit-msg.sample
+TEMPLATES += hooks/fsmonitor-watchman.sample
+TEMPLATES += hooks/post-update.sample
+TEMPLATES += hooks/pre-applypatch.sample
+TEMPLATES += hooks/pre-commit.sample
+TEMPLATES += hooks/pre-merge-commit.sample
+TEMPLATES += hooks/prepare-commit-msg.sample
+TEMPLATES += hooks/pre-push.sample
+TEMPLATES += hooks/pre-rebase.sample
+TEMPLATES += hooks/pre-receive.sample
+TEMPLATES += hooks/push-to-checkout.sample
+TEMPLATES += hooks/sendemail-validate.sample
+TEMPLATES += hooks/update.sample
+TEMPLATES += info/exclude
+
+boilerplates.made: $(TEMPLATES)
+ $(QUIET)umask 022 && for template in $(TEMPLATES); \
do \
- case "$$boilerplate" in *~) continue ;; esac && \
- dst=`echo "$$boilerplate" | sed -e 's|^this|.|;s|--|/|g'` && \
- dir=`expr "$$dst" : '\(.*\)/'` && \
+ dir=$$(dirname "$$template") && \
mkdir -p blt/$$dir && \
- case "$$boilerplate" in \
- *--) continue;; \
- esac && \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
- -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' $$boilerplate > \
- blt/$$dst && \
- if test -x "$$boilerplate"; then rx=rx; else rx=r; fi && \
- chmod a+$$rx "blt/$$dst" || exit; \
+ -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' $$template > \
+ blt/$$template && \
+ if test -x "$$template"; then rx=rx; else rx=r; fi && \
+ chmod a+$$rx "blt/$$template" || exit; \
done && \
date >$@
diff --git a/templates/branches-- b/templates/branches--
deleted file mode 100644
index fae88709a63..00000000000
--- a/templates/branches--
+++ /dev/null
@@ -1 +0,0 @@
-: this is just to ensure the directory exists.
diff --git a/templates/this--description b/templates/description
similarity index 100%
rename from templates/this--description
rename to templates/description
diff --git a/templates/hooks--applypatch-msg.sample b/templates/hooks/applypatch-msg.sample
similarity index 100%
rename from templates/hooks--applypatch-msg.sample
rename to templates/hooks/applypatch-msg.sample
diff --git a/templates/hooks--commit-msg.sample b/templates/hooks/commit-msg.sample
similarity index 100%
rename from templates/hooks--commit-msg.sample
rename to templates/hooks/commit-msg.sample
diff --git a/templates/hooks--fsmonitor-watchman.sample b/templates/hooks/fsmonitor-watchman.sample
similarity index 100%
rename from templates/hooks--fsmonitor-watchman.sample
rename to templates/hooks/fsmonitor-watchman.sample
diff --git a/templates/hooks--post-update.sample b/templates/hooks/post-update.sample
similarity index 100%
rename from templates/hooks--post-update.sample
rename to templates/hooks/post-update.sample
diff --git a/templates/hooks--pre-applypatch.sample b/templates/hooks/pre-applypatch.sample
similarity index 100%
rename from templates/hooks--pre-applypatch.sample
rename to templates/hooks/pre-applypatch.sample
diff --git a/templates/hooks--pre-commit.sample b/templates/hooks/pre-commit.sample
similarity index 100%
rename from templates/hooks--pre-commit.sample
rename to templates/hooks/pre-commit.sample
diff --git a/templates/hooks--pre-merge-commit.sample b/templates/hooks/pre-merge-commit.sample
similarity index 100%
rename from templates/hooks--pre-merge-commit.sample
rename to templates/hooks/pre-merge-commit.sample
diff --git a/templates/hooks--pre-push.sample b/templates/hooks/pre-push.sample
similarity index 100%
rename from templates/hooks--pre-push.sample
rename to templates/hooks/pre-push.sample
diff --git a/templates/hooks--pre-rebase.sample b/templates/hooks/pre-rebase.sample
similarity index 100%
rename from templates/hooks--pre-rebase.sample
rename to templates/hooks/pre-rebase.sample
diff --git a/templates/hooks--pre-receive.sample b/templates/hooks/pre-receive.sample
similarity index 100%
rename from templates/hooks--pre-receive.sample
rename to templates/hooks/pre-receive.sample
diff --git a/templates/hooks--prepare-commit-msg.sample b/templates/hooks/prepare-commit-msg.sample
similarity index 100%
rename from templates/hooks--prepare-commit-msg.sample
rename to templates/hooks/prepare-commit-msg.sample
diff --git a/templates/hooks--push-to-checkout.sample b/templates/hooks/push-to-checkout.sample
similarity index 100%
rename from templates/hooks--push-to-checkout.sample
rename to templates/hooks/push-to-checkout.sample
diff --git a/templates/hooks--sendemail-validate.sample b/templates/hooks/sendemail-validate.sample
similarity index 100%
rename from templates/hooks--sendemail-validate.sample
rename to templates/hooks/sendemail-validate.sample
diff --git a/templates/hooks--update.sample b/templates/hooks/update.sample
similarity index 100%
rename from templates/hooks--update.sample
rename to templates/hooks/update.sample
diff --git a/templates/info--exclude b/templates/info/exclude
similarity index 100%
rename from templates/info--exclude
rename to templates/info/exclude
--
2.47.0.72.gef8ce8f3d4.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v3 12/15] t: better support for out-of-tree builds
2024-10-18 12:23 ` [RFC PATCH v3 00/15] Modernize the " Patrick Steinhardt
` (10 preceding siblings ...)
2024-10-18 12:24 ` [RFC PATCH v3 11/15] Makefile: simplify building of templates Patrick Steinhardt
@ 2024-10-18 12:24 ` Patrick Steinhardt
2024-10-18 12:24 ` [RFC PATCH v3 13/15] t: allow overriding build dir Patrick Steinhardt
` (5 subsequent siblings)
17 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-18 12:24 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones
Our in-tree builds used by the Makefile use various different build
directories scattered around different locations. The paths to those
build directories have to be propagated to our tests such that they can
find the contained files. This is done via a mixture of hardcoded paths
in our test library and injected variables in our bin-wrappers or
"GIT-BUILD-OPTIONS".
The latter two mechanisms are preferable over using hardcoded paths. For
one, we have all paths which are subject to change stored in a small set
of central files instead of having the knowledge of build paths in many
files. And second, it allows build systems which build files elsewhere
to adapt those paths based on their own needs. This is especially nice
in the context of build systems that use out-of-tree builds like CMake
or Meson.
Remove hardcoded knowledge of build paths from our test library and move
it into our bin-wrappers and "GIT-BUILD-OPTIONS".
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-BUILD-OPTIONS.in | 5 +++++
Makefile | 9 +++++++++
bin-wrappers/wrap-for-bin.sh | 11 ++++++-----
contrib/buildsystems/CMakeLists.txt | 8 ++++++++
t/lib-gettext.sh | 4 ++--
t/t7609-mergetool--lib.sh | 2 +-
t/test-lib.sh | 6 +++---
7 files changed, 34 insertions(+), 11 deletions(-)
diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in
index 9b95a6b3eee..f651116102a 100644
--- a/GIT-BUILD-OPTIONS.in
+++ b/GIT-BUILD-OPTIONS.in
@@ -35,6 +35,11 @@ GIT_PERF_MAKE_COMMAND=@GIT_PERF_MAKE_COMMAND@
GIT_INTEROP_MAKE_OPTS=@GIT_INTEROP_MAKE_OPTS@
GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@
GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@
+GIT_TEST_TEXTDOMAINDIR=@GIT_TEST_TEXTDOMAINDIR@
+GIT_TEST_POPATH=@GIT_TEST_POPATH@
+GIT_TEST_TEMPLATE_DIR=@GIT_TEST_TEMPLATE_DIR@
+GIT_TEST_GITPERLLIB=@GIT_TEST_GITPERLLIB@
+GIT_TEST_MERGE_TOOLS_DIR=@GIT_TEST_MERGE_TOOLS_DIR@
RUNTIME_PREFIX=@RUNTIME_PREFIX@
GITWEBDIR=@GITWEBDIR@
USE_GETTEXT_SCHEME=@USE_GETTEXT_SCHEME@
diff --git a/Makefile b/Makefile
index dc6510028fb..a93aeb3bc8f 100644
--- a/Makefile
+++ b/Makefile
@@ -3173,6 +3173,11 @@ GIT-BUILD-OPTIONS: FORCE
-e "s|@GIT_INTEROP_MAKE_OPTS@|\'$(GIT_INTEROP_MAKE_OPTS)\'|" \
-e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \
-e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \
+ -e "s|@GIT_TEST_TEXTDOMAINDIR@|\'$(shell pwd)/po/build/locale\'|" \
+ -e "s|@GIT_TEST_POPATH@|\'$(shell pwd)/po\'|" \
+ -e "s|@GIT_TEST_TEMPLATE_DIR@|\'$(shell pwd)/templates/blt\'|" \
+ -e "s|@GIT_TEST_GITPERLLIB@|\'$(shell pwd)/perl/build/lib\'|" \
+ -e "s|@GIT_TEST_MERGE_TOOLS_DIR@|\'$(shell pwd)/mergetools\'|" \
-e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX)\'|" \
-e "s|@GITWEBDIR@|\'$(gitwebdir_SQ)\'|" \
-e "s|@USE_GETTEXT_SCHEME@|\'$(USE_GETTEXT_SCHEME)\'|" \
@@ -3201,6 +3206,10 @@ all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PR
$(test_bindir_programs): bin-wrappers/%: bin-wrappers/wrap-for-bin.sh
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@BUILD_DIR@|$(shell pwd)|' \
+ -e 's|@GIT_TEXTDOMAINDIR@|$(shell pwd)/po/build/locale|' \
+ -e 's|@GITPERLLIB@|$(shell pwd)/perl/build/lib|' \
+ -e 's|@MERGE_TOOLS_DIR@|$(shell pwd)/mergetools|' \
+ -e 's|@TEMPLATE_DIR@|$(shell pwd)/templates/blt|' \
-e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
chmod +x $@
diff --git a/bin-wrappers/wrap-for-bin.sh b/bin-wrappers/wrap-for-bin.sh
index 7898a1c238d..1d3a59a0081 100755
--- a/bin-wrappers/wrap-for-bin.sh
+++ b/bin-wrappers/wrap-for-bin.sh
@@ -4,21 +4,22 @@
# to run test suite against sandbox, but with only bindir-installed
# executables in PATH. The Makefile copies this into various
# files in bin-wrappers, substituting
-# @BUILD_DIR@ and @PROG@.
+# @BUILD_DIR@, @TEMPLATE_DIR@ and @PROG@.
GIT_EXEC_PATH='@BUILD_DIR@'
if test -n "$NO_SET_GIT_TEMPLATE_DIR"
then
unset GIT_TEMPLATE_DIR
else
- GIT_TEMPLATE_DIR='@BUILD_DIR@/templates/blt'
+ GIT_TEMPLATE_DIR='@TEMPLATE_DIR@'
export GIT_TEMPLATE_DIR
fi
-GITPERLLIB='@BUILD_DIR@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}"
-GIT_TEXTDOMAINDIR='@BUILD_DIR@/po/build/locale'
+MERGE_TOOLS_DIR='@MERGE_TOOLS_DIR@'
+GITPERLLIB='@GITPERLLIB@'"${GITPERLLIB:+:$GITPERLLIB}"
+GIT_TEXTDOMAINDIR='@GIT_TEXTDOMAINDIR@'
PATH='@BUILD_DIR@/bin-wrappers:'"$PATH"
-export GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
+export MERGE_TOOLS_DIR GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
case "$GIT_DEBUGGER" in
'')
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index ad4e3f0b6ce..f0a1a75382a 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -1054,6 +1054,9 @@ endforeach()
file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+string(REPLACE "@GIT_TEXTDOMAINDIR@" "${CMAKE_BINARY_DIR}/po/build/locale" content "${content}")
+string(REPLACE "@GITPERLLIB@" "${CMAKE_BINARY_DIR}/perl/build/lib" content "${content}")
+string(REPLACE "@MERGE_TOOLS_DIR@" "${CMAKE_SOURCE_DIR}/mergetools" content "${content}")
string(REPLACE "@PROG@" "git-cvsserver" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})
@@ -1139,6 +1142,11 @@ string(REPLACE "@GIT_PERF_MAKE_COMMAND@" "" git_build_options "${git_build_optio
string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_options}")
string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}")
string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_TEXTDOMAINDIR@" "${CMAKE_BINARY_DIR}/po/build/locale" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_POPATH@" "${CMAKE_BINARY_DIR}/po" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_TEMPLATE_DIR@" "${CMAKE_BINARY_DIR}/templates/blt" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_GITPERLLIB@" "${CMAKE_BINARY_DIR}/perl/build/lib" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_MERGE_TOOLS_DIR@" "${RUNTIME_PREFIX}" git_build_options "${git_build_options}")
string(REPLACE "@RUNTIME_PREFIX@" "${RUNTIME_PREFIX}" git_build_options "${git_build_options}")
string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" git_build_options "${git_build_options}")
string(REPLACE "@USE_GETTEXT_SCHEME@" "" git_build_options "${git_build_options}")
diff --git a/t/lib-gettext.sh b/t/lib-gettext.sh
index cc6bb2cdeaa..7a734c6973e 100644
--- a/t/lib-gettext.sh
+++ b/t/lib-gettext.sh
@@ -6,8 +6,8 @@
. ./test-lib.sh
-GIT_TEXTDOMAINDIR="$GIT_BUILD_DIR/po/build/locale"
-GIT_PO_PATH="$GIT_BUILD_DIR/po"
+GIT_TEXTDOMAINDIR="$GIT_TEST_TEXTDOMAINDIR"
+GIT_PO_PATH="$GIT_TEST_POPATH"
export GIT_TEXTDOMAINDIR GIT_PO_PATH
if test -n "$GIT_TEST_INSTALLED"
diff --git a/t/t7609-mergetool--lib.sh b/t/t7609-mergetool--lib.sh
index 8b1c3bd39f2..a9273ba58d7 100755
--- a/t/t7609-mergetool--lib.sh
+++ b/t/t7609-mergetool--lib.sh
@@ -8,7 +8,7 @@ TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'mergetool --tool=vimdiff creates the expected layout' '
- . "$GIT_BUILD_DIR"/mergetools/vimdiff &&
+ . "$GIT_TEST_MERGE_TOOLS_DIR"/vimdiff &&
run_unit_tests
'
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 4dd641baefe..677424ced06 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1478,7 +1478,7 @@ else # normal case, use ../bin-wrappers only unless $with_dashes:
PATH="$GIT_BUILD_DIR:$GIT_BUILD_DIR/t/helper:$PATH"
fi
fi
-GIT_TEMPLATE_DIR="$GIT_BUILD_DIR"/templates/blt
+GIT_TEMPLATE_DIR="$GIT_TEST_TEMPLATE_DIR"
GIT_CONFIG_NOSYSTEM=1
GIT_ATTR_NOSYSTEM=1
GIT_CEILING_DIRECTORIES="$TRASH_DIRECTORY/.."
@@ -1494,9 +1494,9 @@ then
fi
fi
-GITPERLLIB="$GIT_BUILD_DIR"/perl/build/lib
+GITPERLLIB="$GIT_TEST_GITPERLLIB"
export GITPERLLIB
-test -d "$GIT_BUILD_DIR"/templates/blt || {
+test -d "$GIT_TEMPLATE_DIR" || {
BAIL_OUT "You haven't built things yet, have you?"
}
--
2.47.0.72.gef8ce8f3d4.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v3 13/15] t: allow overriding build dir
2024-10-18 12:23 ` [RFC PATCH v3 00/15] Modernize the " Patrick Steinhardt
` (11 preceding siblings ...)
2024-10-18 12:24 ` [RFC PATCH v3 12/15] t: better support for out-of-tree builds Patrick Steinhardt
@ 2024-10-18 12:24 ` Patrick Steinhardt
2024-10-19 5:11 ` Eric Sunshine
2024-10-18 12:24 ` [RFC PATCH v3 14/15] Documentation: add comparison of build systems Patrick Steinhardt
` (4 subsequent siblings)
17 siblings, 1 reply; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-18 12:24 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones
Our "test-lib.sh" assumes that our build directory is the parent
directory of "t/". While true when using our Makefile, it's not when
using build systems that support out-of-tree builds.
In commit ee9e66e4e7 (cmake: avoid editing t/test-lib.sh, 2022-10-18),
we have introduce support for overriding the GIT_BIULD_DIR by creating
the file "$GIT_BUILD_DIR/GIT-BUILD-DIR" with its contents pointing to
the location of the build directory. The intent was to stop modifying
"t/test-lib.sh" with the CMake build systems while allowing out-of-tree
builds. But "$GIT_BUILD_DIR" is somewhat misleadingly named, as it in
fact points to the _source_ directory. So while that commit solved part
of the problem for out-of-tree builds, CMake still has to write files
into the source tree.
Solve the second part of the problem, namely not having to write any
data into the source directory at all, by also supporting an environment
variable that allows us to point to a different build directory. This
allows us to perform properly self-contained out-of-tree builds.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
t/test-lib.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 677424ced06..096af9be6b1 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -35,7 +35,7 @@ else
# needing to exist.
TEST_DIRECTORY=$(cd "$TEST_DIRECTORY" && pwd) || exit 1
fi
-GIT_BUILD_DIR="${TEST_DIRECTORY%/t}"
+GIT_BUILD_DIR="${GIT_BUILD_DIR:-${TEST_DIRECTORY%/t}}"
if test "$TEST_DIRECTORY" = "$GIT_BUILD_DIR"
then
echo "PANIC: Running in a $TEST_DIRECTORY that doesn't end in '/t'?" >&2
@@ -513,6 +513,7 @@ unset VISUAL EMAIL LANGUAGE $("$PERL_PATH" -e '
PERF_
CURL_VERBOSE
TRACE_CURL
+ BUILD_DIR
));
my @vars = grep(/^GIT_/ && !/^GIT_($ok)/o, @env);
print join("\n", @vars);
--
2.47.0.72.gef8ce8f3d4.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v3 14/15] Documentation: add comparison of build systems
2024-10-18 12:23 ` [RFC PATCH v3 00/15] Modernize the " Patrick Steinhardt
` (12 preceding siblings ...)
2024-10-18 12:24 ` [RFC PATCH v3 13/15] t: allow overriding build dir Patrick Steinhardt
@ 2024-10-18 12:24 ` Patrick Steinhardt
2024-10-18 12:24 ` [RFC PATCH v3 15/15] Introduce support for the Meson build system Patrick Steinhardt
` (3 subsequent siblings)
17 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-18 12:24 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones
We're contemplating whether to eventually replace our build systems with
a build system that is easier to use. Add a comparison of build systems
to our technical documentation as a baseline for discussion.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Documentation/Makefile | 1 +
Documentation/technical/build-systems.txt | 224 ++++++++++++++++++++++
2 files changed, 225 insertions(+)
create mode 100644 Documentation/technical/build-systems.txt
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 0f55baa252f..e23cffb5f9a 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -111,6 +111,7 @@ TECH_DOCS += MyFirstObjectWalk
TECH_DOCS += SubmittingPatches
TECH_DOCS += ToolsForGit
TECH_DOCS += technical/bitmap-format
+TECH_DOCS += technical/build-systems
TECH_DOCS += technical/bundle-uri
TECH_DOCS += technical/hash-function-transition
TECH_DOCS += technical/long-running-process-protocol
diff --git a/Documentation/technical/build-systems.txt b/Documentation/technical/build-systems.txt
new file mode 100644
index 00000000000..d9dafb407c4
--- /dev/null
+++ b/Documentation/technical/build-systems.txt
@@ -0,0 +1,224 @@
+= Build Systems
+
+The build system is the primary way for both developers and system integrators
+to interact with the Git project. As such, being easy to use and extend for
+those who are not directly developing Git itself is just as important as other
+requirements we have on any potential build system.
+
+This document outlines the different requirements that we have for the build
+system and then compares available build systems using these criteria.
+
+== Requirements
+
+The following subsections present a list of requirements that we have for any
+potential build system. Sections are sorted by decreasing priority.
+
+=== Platform support
+
+The build system must have support for all of our platforms that we continually
+test against as outlined by our platform support policy. These platforms are:
+
+ - Linux
+ - Windows
+ - macOS
+
+Furthermore, the build system should have support for the following platforms
+that generally have somebody running test pipelines against regularly:
+
+ - AIX
+ - FreeBSD
+ - NetBSD
+ - NonStop
+ - OpenBSD
+
+The platforms which must be supported by the tool should be aligned with our
+[platform support policy](platform-support.txt).
+
+=== Auto-detection of supported features
+
+The build system must support auto-detection of features which are or aren't
+available on the current platform. Platform maintainers should not be required
+to manually configure the complete build.
+
+Auto-detection of the following items is considered to be important:
+
+ - Check for the existence of headers.
+ - Check for the existence of libraries.
+ - Check for the existence of exectuables.
+ - Check for the runtime behavior of specific functions.
+ - Check for specific link order requirements when multiple libraries are
+ involved.
+
+=== Ease of use
+
+The build system should be both easy to use and easy to extend. While this is
+naturally a subjective metric it is likely not controversial to say that some
+build systems are considerably harder to use than others.
+
+=== IDE support
+
+The build system should integrate with well-known IDEs. Well-known IDEs include:
+
+ - Microsoft Visual Studio
+ - Visual Studio Code
+ - Xcode
+
+There are four levels of support:
+
+ - Native integration into the IDE.
+ - Integration into the IDE via a plugin.
+ - Integration into the IDE via generating a project description with the build
+ system.
+ - No integration.
+
+Native integration is preferable, but integration via either a plugin or by
+generating a project description via the build system are considered feasible
+alternatives.
+
+Another important distinction is the level of integration. There are two
+features that one generally wants to have:
+
+ - Integration of build targets.
+ - Automatic setup of features like code completion with detected build
+ dependencies.
+
+The first bullet point is the bare minimum, but is not sufficient to be
+considered proper integration.
+
+=== Out-of-tree builds
+
+The build system should support out-of-tree builds. Out-of-tree builds allow a
+developer to configure multiple different build directories with different
+configuration, e.g. one "debug" build and one "release" build.
+
+=== Cross-platform builds
+
+The build system should support cross-platform builds, e.g. building for arm on
+an x86-64 host.
+
+=== Language support
+
+The following languages and toolchains are of relevance and should be supported
+by the build system:
+
+ - C: the primary compiled language used by Git, must be supported. Relevant
+ toolchains are GCC, Clang and MSVC.
+ - Rust: candidate as a second compiled lanugage, should be supported. Relevant
+ toolchains is the LLVM-based rustc.
+
+Built-in support for the respective languages is preferred over support that
+needs to be wired up manually to avoid unnecessary complexity. Native support
+includes the following features:
+
+ - Compiling objects.
+ - Dependency tracking.
+ - Detection of available features.
+ - Discovery of relevant toolchains.
+ - Linking libraries and executables.
+ - Templating placeholders in scripts.
+
+=== Test integration
+
+It should be possible to integrate tests into the build system such that it is
+possible to build and test Git within the build system. Features which are nice
+to have:
+
+ - Track build-time dependencies for respective tests. Unit tests have
+ different requirements than integration tests.
+ - Allow filtering of which tests to run.
+ - Allow running tests such that utilities like `test_pause` or `debug` work.
+
+== Comparison
+
+The following list of build systems are considered:
+
+- GNU Make
+- autoconf
+- CMake
+- Meson
+
+=== GNU Make
+
+- Platform support: ubitquitous on all platforms, but not well-integrated into Windows.
+- Auto-detection: no built-in support for auto-detection of features.
+- Ease of use: easy to use, but discovering available options is hard. Makefile
+ rules can quickly get out of hand once reaching a certain scope.
+- IDE support: execution of Makefile targets is supported by many IDEs
+- Out-of-tree builds: supported in theory, not wired up in practice.
+- Cross-platform builds: supported in theory, not wired up in practice.
+- Language support:
+ - C: Limited built-in support, many parts need to be wired up manually.
+ - Rust: No built-in support, needs to be wired up manually.
+- Test integration: partially supported, many parts need to be wired up
+ manually.
+
+=== autoconf
+
+- Platform support: ubiquitous on all platforms, but not well-integrated into Windows.
+- Auto-detection: supported.
+- Ease of use: easy to use, discovering available options is comparatively
+ easy. The autoconf syntax is prohibitively hard to extend though due to its
+ complex set of interacting files and the hard-to-understand M4 language.
+- IDE support: no integration into IDEs at generation time. The generated
+ Makefiles have the same level of support as GNU Make.
+- Out-of-tree builds: supported in theory, not wired up in practice.
+- Cross-platform builds: supported.
+- Language support:
+ - C: Limited built-in support, many parts need to be wired up manually.
+ - Rust: No built-in support, needs to be wired up manually.
+- Test integration: partially supported, many parts need to be wired up
+ manually.
+
+=== CMake
+
+- Platform support: not as extensive as GNU Make or autoconf, but all major
+ platforms are supported.
+ - AIX
+ - Cygwin
+ - FreeBSD
+ - Linux
+ - OpenBSD
+ - Solaris
+ - Windows
+ - macOS
+- Ease of use: easy to use, discovering available options is not always
+ trivial. The scripting language used by CMake is somewhat cumbersome to use,
+ but extending CMake build instructions is doable.
+- IDE support: natively integrated into Microsoft Visual Studio. Can generate
+ project descriptions for Xcode. An extension is available for Visual Studio
+ Code. Many other IDEs have plugins for CMake.
+- Out-of-tree builds: supported.
+- Cross-platform builds: supported.
+- Language support:
+ - C: Supported for GCC, Clang, MSVC and other toolchains.
+ - Rust: No built-in support, needs to be wired up manually.
+- Test integration: supported, even though test dependencies are a bit
+ cumbersome to use via "test fixtures". Interactive test runs are not
+ supported.
+
+=== Meson
+
+- Platform: not as extensive as GNU Make or autoconf, but all major platforms
+ and some smaller ones are supported.
+ - AIX
+ - Cygwin
+ - DragonflyBSD
+ - FreeBSD
+ - Haiku
+ - Linux
+ - NetBSD
+ - OpenBSD
+ - Solaris
+ - Windows
+ - macOS
+- Ease of use: easy to use, discovering available options is easy. The
+ scripting language is straight-forward to use.
+- IDE support: Supports generating build instructions for Xcode and Microsoft
+ Visual Studio, a plugin exists for Visual Studio Code.
+- Out-of-tree builds: supported.
+- Cross-platform builds: supported.
+- Language support:
+ - C: Supported for GCC, Clang, MSVC and other toolchains.
+ - Rust: Supported for rustc.
+- Test integration: supported. Interactive tests are supported starting with
+ Meson 1.5.0 via the `--interactive` flag.
--
2.47.0.72.gef8ce8f3d4.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v3 15/15] Introduce support for the Meson build system
2024-10-18 12:23 ` [RFC PATCH v3 00/15] Modernize the " Patrick Steinhardt
` (13 preceding siblings ...)
2024-10-18 12:24 ` [RFC PATCH v3 14/15] Documentation: add comparison of build systems Patrick Steinhardt
@ 2024-10-18 12:24 ` Patrick Steinhardt
2024-10-19 5:21 ` Eric Sunshine
2024-10-18 16:08 ` [RFC PATCH v3 00/15] Modernize the " Ramsay Jones
` (2 subsequent siblings)
17 siblings, 1 reply; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-18 12:24 UTC (permalink / raw)
To: git; +Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones
Introduce support for the Meson build system, a "modern" meta build
system that supports many different plaforms, 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 is likely to 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 fordebugging.
$ 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 usecase for
those anymore. By not installing those symlinks we thus start the
deprecation of this layout.
- Support for installing documentation has not been wired up yet. This
will follow if the project can agree on Meson as build system.
- Documentation does not yet exist. Same here, it will follow if the
project can agree on Meson.
- We're targeting a 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 3000 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>
---
bin-wrappers/meson.build | 28 +
contrib/completion/meson.build | 8 +
contrib/meson.build | 1 +
gitweb/meson.build | 63 ++
meson.build | 1614 ++++++++++++++++++++++++++++
meson_options.txt | 70 ++
perl/FromCPAN/Mail/meson.build | 7 +
perl/FromCPAN/meson.build | 9 +
perl/Git/LoadCPAN/Mail/meson.build | 7 +
perl/Git/LoadCPAN/meson.build | 9 +
perl/Git/SVN/Memoize/meson.build | 7 +
perl/Git/SVN/meson.build | 20 +
perl/Git/meson.build | 18 +
perl/meson.build | 12 +
po/meson.build | 28 +
subprojects/.gitignore | 1 +
subprojects/curl.wrap | 13 +
subprojects/expat.wrap | 13 +
subprojects/openssl.wrap | 15 +
subprojects/pcre2.wrap | 16 +
subprojects/zlib.wrap | 13 +
t/helper/meson.build | 91 ++
t/meson.build | 1103 +++++++++++++++++++
templates/hooks/meson.build | 24 +
templates/info/meson.build | 5 +
templates/meson.build | 13 +
26 files changed, 3208 insertions(+)
create mode 100644 bin-wrappers/meson.build
create mode 100644 contrib/completion/meson.build
create mode 100644 contrib/meson.build
create mode 100644 gitweb/meson.build
create mode 100644 meson.build
create mode 100644 meson_options.txt
create mode 100644 perl/FromCPAN/Mail/meson.build
create mode 100644 perl/FromCPAN/meson.build
create mode 100644 perl/Git/LoadCPAN/Mail/meson.build
create mode 100644 perl/Git/LoadCPAN/meson.build
create mode 100644 perl/Git/SVN/Memoize/meson.build
create mode 100644 perl/Git/SVN/meson.build
create mode 100644 perl/Git/meson.build
create mode 100644 perl/meson.build
create mode 100644 po/meson.build
create mode 100644 subprojects/.gitignore
create mode 100644 subprojects/curl.wrap
create mode 100644 subprojects/expat.wrap
create mode 100644 subprojects/openssl.wrap
create mode 100644 subprojects/pcre2.wrap
create mode 100644 subprojects/zlib.wrap
create mode 100644 t/helper/meson.build
create mode 100644 t/meson.build
create mode 100644 templates/hooks/meson.build
create mode 100644 templates/info/meson.build
create mode 100644 templates/meson.build
diff --git a/bin-wrappers/meson.build b/bin-wrappers/meson.build
new file mode 100644
index 00000000000..6d03a19d7b8
--- /dev/null
+++ b/bin-wrappers/meson.build
@@ -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', fs.relative_to(executable.full_path(), meson.project_build_root()))
+
+ configure_file(
+ input: 'wrap-for-bin.sh',
+ output: fs.stem(executable.full_path()),
+ configuration: executable_config,
+ )
+endforeach
diff --git a/contrib/completion/meson.build b/contrib/completion/meson.build
new file mode 100644
index 00000000000..a9bfe2da312
--- /dev/null
+++ b/contrib/completion/meson.build
@@ -0,0 +1,8 @@
+foreach script : [
+ 'git-completion.bash',
+ 'git-completion.tcsh',
+ 'git-completion.zsh',
+ 'git-prompt.sh'
+]
+ test_dependencies += fs.copyfile(script)
+endforeach
diff --git a/contrib/meson.build b/contrib/meson.build
new file mode 100644
index 00000000000..a7b77b87c22
--- /dev/null
+++ b/contrib/meson.build
@@ -0,0 +1 @@
+subdir('completion')
diff --git a/gitweb/meson.build b/gitweb/meson.build
new file mode 100644
index 00000000000..c8d0106ae9a
--- /dev/null
+++ b/gitweb/meson.build
@@ -0,0 +1,63 @@
+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_VERSION', git_version)
+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(script,
+ input: 'gitweb.perl',
+ output: 'gitweb.cgi',
+ command: [
+ shell,
+ meson.current_source_dir() / 'generate-gitweb.sh',
+ meson.current_build_dir() / 'GITWEB-BUILD-OPTIONS',
+ '@INPUT@',
+ '@OUTPUT@',
+ ],
+ install: true,
+ install_dir: get_option('datadir') / 'gitweb',
+)
+
+foreach asset : [
+ 'static/git-favicon.png',
+ 'static/git-logo.png',
+ 'static/gitweb.css',
+ 'static/js/adjust-timezone.js',
+ 'static/js/blame_incremental.js',
+ 'static/js/javascript-detection.js',
+ 'static/js/lib/common-lib.js',
+ 'static/js/lib/cookies.js',
+ 'static/js/lib/datetime.js',
+]
+ fs.copyfile(asset,
+ install: true,
+ install_dir: get_option('datadir') / 'gitweb' / fs.parent(asset),
+ )
+endforeach
diff --git a/meson.build b/meson.build
new file mode 100644
index 00000000000..7c7a59d7fb0
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,1614 @@
+project('git', 'c',
+ meson_version: '>=1.3.0',
+ # MSVC does not support GNU99, and C99 does not define __STDC_VERSION__
+ # on MSVC. So we instead fall back to C11 there.
+ default_options: ['c_std=gnu99,c11'],
+ version: 'v2.47.GIT',
+)
+
+fs = import('fs')
+
+program_path = []
+# Git for Windows provides all the tools we need to build Git.
+if host_machine.system() == 'windows'
+ program_path += [ 'C:/Program Files/Git/bin', 'C:/Program Files/Git/usr/bin' ]
+endif
+
+awk = find_program('awk', dirs: program_path)
+cygpath = find_program('cygpath', dirs: program_path, required: false)
+diff = find_program('diff', dirs: program_path)
+shell = find_program('sh', dirs: program_path)
+tar = find_program('tar', dirs: program_path)
+
+script_environment = environment()
+foreach tool : ['cat', 'cut', 'git', 'grep', 'sed', 'sort', 'tr', 'uname']
+ program = find_program(tool, dirs: program_path)
+ script_environment.prepend('PATH', fs.parent(program.full_path()))
+endforeach
+
+git_version = run_command(shell, 'GIT-VERSION-GEN', check: false, env: script_environment).stdout().strip()
+if git_version == ''
+ git_version = meson.project_version()
+endif
+
+compiler = meson.get_compiler('c')
+
+libgit_sources = [
+ 'abspath.c',
+ 'add-interactive.c',
+ 'add-patch.c',
+ 'advice.c',
+ 'alias.c',
+ 'alloc.c',
+ 'apply.c',
+ 'archive-tar.c',
+ 'archive-zip.c',
+ 'archive.c',
+ 'attr.c',
+ 'base85.c',
+ 'bisect.c',
+ 'blame.c',
+ 'blob.c',
+ 'bloom.c',
+ 'branch.c',
+ 'bulk-checkin.c',
+ 'bundle-uri.c',
+ 'bundle.c',
+ 'cache-tree.c',
+ 'cbtree.c',
+ 'chdir-notify.c',
+ 'checkout.c',
+ 'chunk-format.c',
+ 'color.c',
+ 'column.c',
+ 'combine-diff.c',
+ 'commit-graph.c',
+ 'commit-reach.c',
+ 'commit.c',
+ 'compat/nonblock.c',
+ 'compat/obstack.c',
+ 'compat/terminal.c',
+ 'compat/zlib-uncompress2.c',
+ 'config.c',
+ 'connect.c',
+ 'connected.c',
+ 'convert.c',
+ 'copy.c',
+ 'credential.c',
+ 'csum-file.c',
+ 'ctype.c',
+ 'date.c',
+ 'decorate.c',
+ 'delta-islands.c',
+ 'diagnose.c',
+ 'diff-delta.c',
+ 'diff-merges.c',
+ 'diff-lib.c',
+ 'diff-no-index.c',
+ 'diff.c',
+ 'diffcore-break.c',
+ 'diffcore-delta.c',
+ 'diffcore-order.c',
+ 'diffcore-pickaxe.c',
+ 'diffcore-rename.c',
+ 'diffcore-rotate.c',
+ 'dir-iterator.c',
+ 'dir.c',
+ 'editor.c',
+ 'entry.c',
+ 'environment.c',
+ 'ewah/bitmap.c',
+ 'ewah/ewah_bitmap.c',
+ 'ewah/ewah_io.c',
+ 'ewah/ewah_rlw.c',
+ 'exec-cmd.c',
+ 'fetch-negotiator.c',
+ 'fetch-pack.c',
+ 'fmt-merge-msg.c',
+ 'fsck.c',
+ 'fsmonitor.c',
+ 'fsmonitor-ipc.c',
+ 'fsmonitor-settings.c',
+ 'gettext.c',
+ 'git-zlib.c',
+ 'gpg-interface.c',
+ 'graph.c',
+ 'grep.c',
+ 'hash-lookup.c',
+ 'hashmap.c',
+ 'help.c',
+ 'hex.c',
+ 'hex-ll.c',
+ 'hook.c',
+ 'ident.c',
+ 'json-writer.c',
+ 'kwset.c',
+ 'levenshtein.c',
+ 'line-log.c',
+ 'line-range.c',
+ 'linear-assignment.c',
+ 'list-objects-filter-options.c',
+ 'list-objects-filter.c',
+ 'list-objects.c',
+ 'lockfile.c',
+ 'log-tree.c',
+ 'loose.c',
+ 'ls-refs.c',
+ 'mailinfo.c',
+ 'mailmap.c',
+ 'match-trees.c',
+ 'mem-pool.c',
+ 'merge-blobs.c',
+ 'merge-ll.c',
+ 'merge-ort.c',
+ 'merge-ort-wrappers.c',
+ 'merge-recursive.c',
+ 'merge.c',
+ 'midx.c',
+ 'midx-write.c',
+ 'name-hash.c',
+ 'negotiator/default.c',
+ 'negotiator/noop.c',
+ 'negotiator/skipping.c',
+ 'notes-cache.c',
+ 'notes-merge.c',
+ 'notes-utils.c',
+ 'notes.c',
+ 'object-file-convert.c',
+ 'object-file.c',
+ 'object-name.c',
+ 'object.c',
+ 'oid-array.c',
+ 'oidmap.c',
+ 'oidset.c',
+ 'oidtree.c',
+ 'pack-bitmap-write.c',
+ 'pack-bitmap.c',
+ 'pack-check.c',
+ 'pack-mtimes.c',
+ 'pack-objects.c',
+ 'pack-revindex.c',
+ 'pack-write.c',
+ 'packfile.c',
+ 'pager.c',
+ 'parallel-checkout.c',
+ 'parse.c',
+ 'parse-options-cb.c',
+ 'parse-options.c',
+ 'patch-delta.c',
+ 'patch-ids.c',
+ 'path.c',
+ 'pathspec.c',
+ 'pkt-line.c',
+ 'preload-index.c',
+ 'pretty.c',
+ 'prio-queue.c',
+ 'progress.c',
+ 'promisor-remote.c',
+ 'prompt.c',
+ 'protocol.c',
+ 'protocol-caps.c',
+ 'prune-packed.c',
+ 'pseudo-merge.c',
+ 'quote.c',
+ 'range-diff.c',
+ 'reachable.c',
+ 'read-cache.c',
+ 'rebase-interactive.c',
+ 'rebase.c',
+ 'ref-filter.c',
+ 'reflog-walk.c',
+ 'reflog.c',
+ 'refs.c',
+ 'refs/debug.c',
+ 'refs/files-backend.c',
+ 'refs/reftable-backend.c',
+ 'refs/iterator.c',
+ 'refs/packed-backend.c',
+ 'refs/ref-cache.c',
+ 'refspec.c',
+ 'reftable/basics.c',
+ 'reftable/error.c',
+ 'reftable/block.c',
+ 'reftable/blocksource.c',
+ 'reftable/iter.c',
+ 'reftable/merged.c',
+ 'reftable/pq.c',
+ 'reftable/reader.c',
+ 'reftable/record.c',
+ 'reftable/stack.c',
+ 'reftable/tree.c',
+ 'reftable/writer.c',
+ 'remote.c',
+ 'replace-object.c',
+ 'repo-settings.c',
+ 'repository.c',
+ 'rerere.c',
+ 'reset.c',
+ 'resolve-undo.c',
+ 'revision.c',
+ 'run-command.c',
+ 'send-pack.c',
+ 'sequencer.c',
+ 'serve.c',
+ 'server-info.c',
+ 'setup.c',
+ 'shallow.c',
+ 'sideband.c',
+ 'sigchain.c',
+ 'sparse-index.c',
+ 'split-index.c',
+ 'stable-qsort.c',
+ 'statinfo.c',
+ 'strbuf.c',
+ 'streaming.c',
+ 'string-list.c',
+ 'strmap.c',
+ 'strvec.c',
+ 'sub-process.c',
+ 'submodule-config.c',
+ 'submodule.c',
+ 'symlinks.c',
+ 'tag.c',
+ 'tempfile.c',
+ 'thread-utils.c',
+ 'tmp-objdir.c',
+ 'trace.c',
+ 'trace2.c',
+ 'trace2/tr2_cfg.c',
+ 'trace2/tr2_cmd_name.c',
+ 'trace2/tr2_ctr.c',
+ 'trace2/tr2_dst.c',
+ 'trace2/tr2_sid.c',
+ 'trace2/tr2_sysenv.c',
+ 'trace2/tr2_tbuf.c',
+ 'trace2/tr2_tgt_event.c',
+ 'trace2/tr2_tgt_normal.c',
+ 'trace2/tr2_tgt_perf.c',
+ 'trace2/tr2_tls.c',
+ 'trace2/tr2_tmr.c',
+ 'trailer.c',
+ 'transport-helper.c',
+ 'transport.c',
+ 'tree-diff.c',
+ 'tree-walk.c',
+ 'tree.c',
+ 'unpack-trees.c',
+ 'upload-pack.c',
+ 'url.c',
+ 'urlmatch.c',
+ 'usage.c',
+ 'userdiff.c',
+ 'utf8.c',
+ 'varint.c',
+ 'versioncmp.c',
+ 'walker.c',
+ 'wildmatch.c',
+ 'worktree.c',
+ 'wrapper.c',
+ 'write-or-die.c',
+ 'ws.c',
+ 'wt-status.c',
+ 'xdiff-interface.c',
+ 'xdiff/xdiffi.c',
+ 'xdiff/xemit.c',
+ 'xdiff/xhistogram.c',
+ 'xdiff/xmerge.c',
+ 'xdiff/xpatience.c',
+ 'xdiff/xprepare.c',
+ 'xdiff/xutils.c',
+]
+
+builtin_sources = [
+ 'builtin/add.c',
+ 'builtin/am.c',
+ 'builtin/annotate.c',
+ 'builtin/apply.c',
+ 'builtin/archive.c',
+ 'builtin/bisect.c',
+ 'builtin/blame.c',
+ 'builtin/branch.c',
+ 'builtin/bugreport.c',
+ 'builtin/bundle.c',
+ 'builtin/cat-file.c',
+ 'builtin/check-attr.c',
+ 'builtin/check-ignore.c',
+ 'builtin/check-mailmap.c',
+ 'builtin/check-ref-format.c',
+ 'builtin/checkout--worker.c',
+ 'builtin/checkout-index.c',
+ 'builtin/checkout.c',
+ 'builtin/clean.c',
+ 'builtin/clone.c',
+ 'builtin/column.c',
+ 'builtin/commit-graph.c',
+ 'builtin/commit-tree.c',
+ 'builtin/commit.c',
+ 'builtin/config.c',
+ 'builtin/count-objects.c',
+ 'builtin/credential-cache--daemon.c',
+ 'builtin/credential-cache.c',
+ 'builtin/credential-store.c',
+ 'builtin/credential.c',
+ 'builtin/describe.c',
+ 'builtin/diagnose.c',
+ 'builtin/diff-files.c',
+ 'builtin/diff-index.c',
+ 'builtin/diff-tree.c',
+ 'builtin/diff.c',
+ 'builtin/difftool.c',
+ 'builtin/fast-export.c',
+ 'builtin/fast-import.c',
+ 'builtin/fetch-pack.c',
+ 'builtin/fetch.c',
+ 'builtin/fmt-merge-msg.c',
+ 'builtin/for-each-ref.c',
+ 'builtin/for-each-repo.c',
+ 'builtin/fsck.c',
+ 'builtin/fsmonitor--daemon.c',
+ 'builtin/gc.c',
+ 'builtin/get-tar-commit-id.c',
+ 'builtin/grep.c',
+ 'builtin/hash-object.c',
+ 'builtin/help.c',
+ 'builtin/hook.c',
+ 'builtin/index-pack.c',
+ 'builtin/init-db.c',
+ 'builtin/interpret-trailers.c',
+ 'builtin/log.c',
+ 'builtin/ls-files.c',
+ 'builtin/ls-remote.c',
+ 'builtin/ls-tree.c',
+ 'builtin/mailinfo.c',
+ 'builtin/mailsplit.c',
+ 'builtin/merge-base.c',
+ 'builtin/merge-file.c',
+ 'builtin/merge-index.c',
+ 'builtin/merge-ours.c',
+ 'builtin/merge-recursive.c',
+ 'builtin/merge-tree.c',
+ 'builtin/merge.c',
+ 'builtin/mktag.c',
+ 'builtin/mktree.c',
+ 'builtin/multi-pack-index.c',
+ 'builtin/mv.c',
+ 'builtin/name-rev.c',
+ 'builtin/notes.c',
+ 'builtin/pack-objects.c',
+ 'builtin/pack-redundant.c',
+ 'builtin/pack-refs.c',
+ 'builtin/patch-id.c',
+ 'builtin/prune-packed.c',
+ 'builtin/prune.c',
+ 'builtin/pull.c',
+ 'builtin/push.c',
+ 'builtin/range-diff.c',
+ 'builtin/read-tree.c',
+ 'builtin/rebase.c',
+ 'builtin/receive-pack.c',
+ 'builtin/reflog.c',
+ 'builtin/refs.c',
+ 'builtin/remote-ext.c',
+ 'builtin/remote-fd.c',
+ 'builtin/remote.c',
+ 'builtin/repack.c',
+ 'builtin/replace.c',
+ 'builtin/replay.c',
+ 'builtin/rerere.c',
+ 'builtin/reset.c',
+ 'builtin/rev-list.c',
+ 'builtin/rev-parse.c',
+ 'builtin/revert.c',
+ 'builtin/rm.c',
+ 'builtin/send-pack.c',
+ 'builtin/shortlog.c',
+ 'builtin/show-branch.c',
+ 'builtin/show-index.c',
+ 'builtin/show-ref.c',
+ 'builtin/sparse-checkout.c',
+ 'builtin/stash.c',
+ 'builtin/stripspace.c',
+ 'builtin/submodule--helper.c',
+ 'builtin/symbolic-ref.c',
+ 'builtin/tag.c',
+ 'builtin/unpack-file.c',
+ 'builtin/unpack-objects.c',
+ 'builtin/update-index.c',
+ 'builtin/update-ref.c',
+ 'builtin/update-server-info.c',
+ 'builtin/upload-archive.c',
+ 'builtin/upload-pack.c',
+ 'builtin/var.c',
+ 'builtin/verify-commit.c',
+ 'builtin/verify-pack.c',
+ 'builtin/verify-tag.c',
+ 'builtin/worktree.c',
+ 'builtin/write-tree.c',
+]
+
+libgit_sources += custom_target(
+ 'command-list.h',
+ input: 'command-list.txt',
+ output: 'command-list.h',
+ command: [shell, meson.current_source_dir() + '/generate-cmdlist.sh', meson.current_source_dir(), '@OUTPUT@'],
+ env: script_environment,
+)
+
+libgit_sources += custom_target(
+ 'config-list.h',
+ output: 'config-list.h',
+ command: [
+ shell,
+ meson.current_source_dir() + '/generate-configlist.sh',
+ meson.current_source_dir(),
+ '@OUTPUT@',
+ ],
+ env: script_environment,
+)
+
+libgit_sources += custom_target(
+ 'hook-list.h',
+ input: 'Documentation/githooks.txt',
+ output: 'hook-list.h',
+ command: [
+ shell,
+ meson.current_source_dir() + '/generate-hooklist.sh',
+ meson.current_source_dir(),
+ '@OUTPUT@',
+ ],
+ env: script_environment,
+)
+
+# This contains the variables for GIT-BUILD-OPTIONS, which we use to propagate
+# build options to our tests.
+build_options_config = configuration_data()
+build_options_config.set('GIT_INTEROP_MAKE_OPTS', '')
+build_options_config.set('GIT_PERF_LARGE_REPO', '')
+build_options_config.set('GIT_PERF_MAKE_COMMAND', '')
+build_options_config.set('GIT_PERF_MAKE_OPTS', '')
+build_options_config.set('GIT_PERF_REPEAT_COUNT', '')
+build_options_config.set('GIT_PERF_REPO', '')
+build_options_config.set('GIT_TEST_CMP_USE_COPIED_CONTEXT', '')
+build_options_config.set('GIT_TEST_INDEX_VERSION', '')
+build_options_config.set('GIT_TEST_OPTS', '')
+build_options_config.set('GIT_TEST_PERL_FATAL_WARNINGS', '')
+build_options_config.set('GIT_TEST_UTF8_LOCALE', '')
+build_options_config.set('SANITIZE_ADDRESS', '')
+build_options_config.set('SANITIZE_LEAK', '')
+build_options_config.set('BROKEN_PATH_FIX', '')
+build_options_config.set_quoted('LOCALEDIR', fs.as_posix(get_option('prefix') / get_option('localedir')))
+build_options_config.set('GITWEBDIR', fs.as_posix(get_option('prefix') / get_option('datadir') / 'gitweb'))
+
+test_output_directory = get_option('test_output_directory')
+if test_output_directory == ''
+ test_output_directory = meson.project_build_root() / 'test-output'
+endif
+
+# These variables are used for building libgit.a.
+libgit_c_args = [
+ '-DBINDIR="' + get_option('bindir') + '"',
+ '-DDEFAULT_EDITOR="' + get_option('default_editor') + '"',
+ '-DDEFAULT_GIT_TEMPLATE_DIR="' + get_option('datadir') / 'git-core/templates' + '"',
+ '-DDEFAULT_HELP_FORMAT="' + get_option('default_help_format') + '"',
+ '-DDEFAULT_PAGER="' + get_option('default_pager') + '"',
+ '-DETC_GITATTRIBUTES="' + get_option('gitattributes') + '"',
+ '-DETC_GITCONFIG="' + get_option('gitconfig') + '"',
+ '-DFALLBACK_RUNTIME_PREFIX="' + get_option('prefix') + '"',
+ '-DGIT_EXEC_PATH="' + get_option('prefix') / get_option('libexecdir') / 'git-core"',
+ '-DGIT_HOST_CPU="' + host_machine.cpu_family() + '"',
+ '-DGIT_HTML_PATH="' + get_option('datadir') / 'doc/git-doc"',
+ '-DGIT_INFO_PATH="' + get_option('infodir') + '"',
+ '-DGIT_LOCALE_PATH="' + get_option('localedir') + '"',
+ '-DGIT_MAN_PATH="' + get_option('mandir') + '"',
+ '-DPAGER_ENV="' + get_option('pager_environment') + '"',
+ '-DSHELL_PATH="' + fs.as_posix(shell.full_path()) + '"',
+]
+libgit_include_directories = [ '.' ]
+libgit_dependencies = [ ]
+
+executable_suffix = ''
+if host_machine.system() == 'cygwin' or host_machine.system() == 'windows'
+ executable_suffix = '.exe'
+ libgit_c_args += '-DSTRIP_EXTENSION="' + executable_suffix + '"'
+endif
+build_options_config.set_quoted('X', executable_suffix)
+
+python = import('python').find_installation('python3', required: get_option('python'))
+if python.found()
+ build_options_config.set('NO_PYTHON', '')
+else
+ libgit_c_args += '-DNO_PYTHON'
+ build_options_config.set('NO_PYTHON', '1')
+endif
+
+# Perl is used for two different things: our test harness and to provide some
+# features. It is optional if you want to neither execute tests nor use any of
+# these optional features.
+perl_required = get_option('perl')
+if get_option('tests')
+ perl_required = true
+endif
+
+# Note that we only set NO_PERL if the Perl features were disabled by the user.
+# It may not be set when we have found Perl, but only use it to run tests.
+perl = find_program('perl', version: '>=5.8.1', dirs: program_path, required: perl_required)
+perl_features_enabled = perl.found() and get_option('perl').allowed()
+if perl_features_enabled
+ build_options_config.set('NO_PERL', '')
+
+ if get_option('runtime_prefix')
+ build_options_config.set('PERL_LOCALEDIR', '')
+ else
+ build_options_config.set_quoted('PERL_LOCALEDIR', fs.as_posix(get_option('prefix') / get_option('localedir')))
+ endif
+
+ if get_option('perl_cpan_fallback')
+ build_options_config.set('NO_PERL_CPAN_FALLBACKS', '')
+ else
+ build_options_config.set_quoted('NO_PERL_CPAN_FALLBACKS', 'YesPlease')
+ endif
+else
+ libgit_c_args += '-DNO_PERL'
+ build_options_config.set('NO_PERL', '1')
+ build_options_config.set('PERL_LOCALEDIR', '')
+ build_options_config.set('NO_PERL_CPAN_FALLBACKS', '')
+endif
+
+zlib = dependency('zlib', default_options: ['default_library=static', 'tests=disabled'])
+if zlib.version().version_compare('<1.2.0')
+ libgit_c_args += '-DNO_DEFLATE_BOUND'
+endif
+libgit_dependencies += zlib
+
+threads = dependency('threads', required: false)
+if threads.found()
+ libgit_dependencies += threads
+ build_options_config.set('NO_PTHREADS', '')
+else
+ libgit_c_args += '-DNO_PTHREADS'
+ build_options_config.set('NO_PTHREADS', '1')
+endif
+
+if get_option('gettext').allowed() and host_machine.system() == 'darwin' and get_option('macos_use_homebrew_gettext')
+ if host_machine.cpu_family() == 'x86_64'
+ libintl_prefix = '/usr/local'
+ elif host_machine.cpu_family() == 'aarch64'
+ libintl_prefix = '/opt/homebrew'
+ else
+ error('Homebrew workaround not supported on current architecture')
+ endif
+
+ intl = compiler.find_library('intl', dirs: libintl_prefix / 'lib', required: get_option('gettext'))
+ if intl.found()
+ intl = declare_dependency(
+ dependencies: intl,
+ include_directories: libintl_prefix / 'include',
+ )
+ endif
+else
+ intl = dependency('intl', required: get_option('gettext'))
+endif
+if intl.found()
+ libgit_dependencies += intl
+ build_options_config.set('NO_GETTEXT', '')
+ build_options_config.set('USE_GETTEXT_SCHEME', '')
+else
+ libgit_c_args += '-DNO_GETTEXT'
+ build_options_config.set('NO_GETTEXT', '1')
+ build_options_config.set('USE_GETTEXT_SCHEME', 'fallthrough')
+endif
+
+iconv = dependency('iconv', required: get_option('iconv'))
+if iconv.found()
+ libgit_dependencies += iconv
+ build_options_config.set('NO_ICONV', '')
+
+ have_old_iconv = false
+ if not compiler.compiles('''
+ #include <iconv.h>
+
+ extern size_t iconv(iconv_t cd,
+ char **inbuf, size_t *inbytesleft,
+ char **outbuf, size_t *outbytesleft);
+ ''', name: 'old iconv interface', dependencies: [iconv])
+ libgit_c_args += '-DOLD_ICONV'
+ have_old_iconv = true
+ endif
+
+ iconv_omits_bom_source = '''#
+ #include <iconv.h>
+
+ int main(int argc, const char **argv)
+ {
+ '''
+ if have_old_iconv
+ iconv_omits_bom_source += '''
+ typedef const char *iconv_ibp;
+ '''
+ else
+ iconv_omits_bom_source += '''
+ typedef char *iconv_ibp;
+ '''
+ endif
+ iconv_omits_bom_source += '''
+ int v;
+ iconv_t conv;
+ char in[] = "a"; iconv_ibp pin = in;
+ char out[20] = ""; char *pout = out;
+ size_t isz = sizeof in;
+ size_t osz = sizeof out;
+
+ conv = iconv_open("UTF-16", "UTF-8");
+ iconv(conv, &pin, &isz, &pout, &osz);
+ iconv_close(conv);
+ v = (unsigned char)(out[0]) + (unsigned char)(out[1]);
+ return v != 0xfe + 0xff;
+ }
+ '''
+
+ if compiler.run(iconv_omits_bom_source,
+ dependencies: iconv,
+ name: 'iconv omits BOM',
+ ).returncode() != 0
+ libgit_c_args += '-DICONV_OMITS_BOM'
+ endif
+else
+ libgit_c_args += '-DNO_ICONV'
+ build_options_config.set('NO_ICONV', '1')
+endif
+
+pcre2 = dependency('libpcre2-8', required: get_option('pcre2'), default_options: ['default_library=static', 'test=false'])
+if pcre2.found()
+ libgit_dependencies += pcre2
+ libgit_c_args += '-DUSE_LIBPCRE2'
+ build_options_config.set('USE_LIBPCRE2', '1')
+else
+ build_options_config.set('USE_LIBPCRE2', '')
+endif
+
+curl = dependency('libcurl', version: '>=7.21.3', required: get_option('curl'), default_options: ['default_library=static', 'tests=disabled'])
+use_curl_for_imap_send = false
+if curl.found()
+ if curl.version().version_compare('>=7.34.0')
+ libgit_c_args += '-DUSE_CURL_FOR_IMAP_SEND'
+ use_curl_for_imap_send = true
+ endif
+
+ libgit_dependencies += curl
+ libgit_c_args += '-DCURL_DISABLE_TYPECHECK'
+ build_options_config.set('NO_CURL', '')
+else
+ libgit_c_args += '-DNO_CURL'
+ build_options_config.set('NO_CURL', '1')
+endif
+
+expat = dependency('expat', required: get_option('expat'), default_options: ['default_library=static', 'build_tests=false'])
+if expat.found()
+ libgit_dependencies += expat
+
+ if expat.version().version_compare('<=1.2')
+ libgit_c_args += '-DEXPAT_NEEDS_XMLPARSE_H'
+ endif
+ build_options_config.set('NO_EXPAT', '')
+else
+ libgit_c_args += '-DNO_EXPAT'
+ build_options_config.set('NO_EXPAT', '1')
+endif
+
+if not compiler.has_header('sys/select.h')
+ libgit_c_args += '-DNO_SYS_SELECT_H'
+endif
+
+has_poll_h = compiler.has_header('poll.h')
+if not has_poll_h
+ libgit_c_args += '-DNO_POLL_H'
+endif
+
+has_sys_poll_h = compiler.has_header('sys/poll.h')
+if not has_sys_poll_h
+ libgit_c_args += '-DNO_SYS_POLL_H'
+endif
+
+if not has_poll_h and not has_sys_poll_h
+ libgit_c_args += '-DNO_POLL'
+ libgit_sources += 'compat/poll/poll.c'
+ libgit_include_directories += 'compat/poll'
+endif
+
+if not compiler.has_header('inttypes.h')
+ libgit_c_args += '-DNO_INTTYPES_H'
+endif
+
+if compiler.has_header('libcharset.h')
+ libcharset = compiler.find_library('charset')
+
+ if compiler.has_function('locale_charset',
+ prefix: '#include <libcharset.h>',
+ dependencies: iconv,
+ )
+ libgit_c_args += '-DHAVE_LIBCHARSET_H'
+ elif compiler.has_function('locale_charset',
+ prefix: '#include <libcharset.h>',
+ dependencies: libcharset,
+ )
+ libgit_c_args += '-DHAVE_LIBCHARSET_H'
+ endif
+endif
+
+if compiler.has_header('alloca.h')
+ libgit_c_args += '-DHAVE_ALLOCA_H'
+endif
+
+if compiler.has_header('sys/sysinfo.h')
+ libgit_c_args += '-DHAVE_SYSINFO'
+endif
+
+# Windows has libgen.h and a basename implementation, but we still need our own
+# implementation to threat things like drive prefixes specially.
+if host_machine.system() == 'windows' or not compiler.has_header('libgen.h')
+ libgit_c_args += '-DNO_LIBGEN_H'
+ libgit_sources += 'compat/basename.c'
+endif
+
+if compiler.has_header('paths.h')
+ libgit_c_args += '-DHAVE_PATHS_H'
+endif
+
+if compiler.has_header('strings.h')
+ libgit_c_args += '-DHAVE_STRINGS_H'
+endif
+
+networking_dependencies = [ ]
+if host_machine.system() == 'windows'
+ winsock = compiler.find_library('ws2_32', required: false)
+ if winsock.found()
+ networking_dependencies += winsock
+ endif
+else
+ libresolv = compiler.find_library('resolv', required: false)
+ if libresolv.found()
+ networking_dependencies += libresolv
+ endif
+endif
+libgit_dependencies += networking_dependencies
+
+foreach symbol : ['inet_ntop', 'inet_pton', 'strerror']
+ if not compiler.has_function(symbol, dependencies: networking_dependencies)
+ libgit_c_args += '-DNO_' + symbol.to_upper()
+ endif
+endforeach
+
+has_ipv6 = compiler.has_function('getaddrinfo', dependencies: networking_dependencies)
+if not has_ipv6
+ libgit_c_args += '-DNO_IPV6'
+endif
+
+if not compiler.compiles('''
+ #ifdef _WIN32
+ # include <winsock2.h>
+ #else
+ # include <sys/types.h>
+ # include <sys/socket.h>
+ #endif
+
+ void func(void)
+ {
+ struct sockaddr_storage x;
+ }
+''', name: 'struct sockaddr_storage')
+ if has_ipv6
+ libgit_c_args += '-Dsockaddr_storage=sockaddr_in6'
+ else
+ libgit_c_args += '-Dsockaddr_storage=sockaddr_in'
+ endif
+endif
+
+if compiler.has_function('socket', dependencies: networking_dependencies)
+ libgit_sources += [
+ 'unix-socket.c',
+ 'unix-stream-server.c',
+ ]
+ build_options_config.set('NO_UNIX_SOCKETS', '')
+else
+ libgit_c_args += '-DNO_UNIX_SOCKETS'
+ build_options_config.set('NO_UNIX_SOCKETS', '1')
+endif
+
+if not compiler.has_function('pread')
+ libgit_c_args += '-DNO_PREAD'
+ libgit_sources += 'compat/pread.c'
+endif
+
+if host_machine.system() == 'darwin'
+ libgit_sources += 'compat/precompose_utf8.c'
+ libgit_c_args += '-DPRECOMPOSE_UNICODE'
+ libgit_c_args += '-DPROTECT_HFS_DEFAULT'
+endif
+
+# Configure general compatibility wrappers.
+if host_machine.system() == 'cygwin'
+ libgit_sources += [
+ 'compat/win32/path-utils.c',
+ ]
+elif host_machine.system() == 'windows'
+ libgit_sources += [
+ 'compat/mingw.c',
+ 'compat/winansi.c',
+ 'compat/win32/flush.c',
+ 'compat/win32/path-utils.c',
+ 'compat/win32/pthread.c',
+ 'compat/win32/syslog.c',
+ 'compat/win32/dirent.c',
+ 'compat/win32mmap.c',
+ 'compat/nedmalloc/nedmalloc.c',
+ ]
+
+ libgit_c_args += [
+ '-DDETECT_MSYS_TTY',
+ '-DENSURE_MSYSTEM_IS_SET',
+ '-DNATIVE_CRLF',
+ '-DNOGDI',
+ '-DNO_POSIX_GOODIES',
+ '-DWIN32',
+ '-D_CONSOLE',
+ '-D_CONSOLE_DETECT_MSYS_TTY',
+ '-D__USE_MINGW_ANSI_STDIO=0',
+ ]
+
+ libgit_dependencies += compiler.find_library('ntdll')
+ libgit_include_directories += 'compat/win32'
+ if compiler.get_id() == 'msvc'
+ libgit_include_directories += 'compat/vcbuild/include'
+ endif
+endif
+
+if host_machine.system() == 'linux'
+ libgit_sources += 'compat/linux/procinfo.c'
+elif host_machine.system() == 'windows'
+ libgit_sources += 'compat/win32/trace2_win32_process_info.c'
+else
+ libgit_sources += 'compat/stub/procinfo.c'
+endif
+
+if host_machine.system() == 'cygwin' or host_machine.system() == 'windows'
+ libgit_c_args += [
+ '-DUNRELIABLE_FSTAT',
+ '-DMMAP_PREVENTS_DELETE',
+ '-DOBJECT_CREATION_MODE=1',
+ ]
+endif
+
+# Configure the simple-ipc subsystem required fro the fsmonitor.
+if host_machine.system() == 'windows'
+ libgit_sources += [
+ 'compat/simple-ipc/ipc-shared.c',
+ 'compat/simple-ipc/ipc-win32.c',
+ ]
+ libgit_c_args += '-DSUPPORTS_SIMPLE_IPC'
+else
+ libgit_sources += [
+ 'compat/simple-ipc/ipc-shared.c',
+ 'compat/simple-ipc/ipc-unix-socket.c',
+ ]
+ libgit_c_args += '-DSUPPORTS_SIMPLE_IPC'
+endif
+
+fsmonitor_backend = ''
+if host_machine.system() == 'windows'
+ fsmonitor_backend = 'win32'
+elif host_machine.system() == 'darwin'
+ fsmonitor_backend = 'darwin'
+ libgit_dependencies += dependency('CoreServices')
+endif
+if fsmonitor_backend != ''
+ libgit_c_args += '-DHAVE_FSMONITOR_DAEMON_BACKEND'
+ libgit_c_args += '-DHAVE_FSMONITOR_OS_SETTINGS'
+
+ libgit_sources += [
+ 'compat/fsmonitor/fsm-health-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-ipc-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-listen-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-path-utils-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-settings-' + fsmonitor_backend + '.c',
+ ]
+endif
+build_options_config.set_quoted('FSMONITOR_DAEMON_BACKEND', fsmonitor_backend)
+build_options_config.set_quoted('FSMONITOR_OS_SETTINGS', fsmonitor_backend)
+
+if compiler.has_header('regex.h') and compiler.get_define('REG_STARTEND', prefix: '#include <regex.h>') != ''
+ build_options_config.set('NO_REGEX', '')
+
+ if compiler.get_define('REG_ENHANCED', prefix: '#include <regex.h>') != ''
+ libgit_c_args += '-DUSE_ENHANCED_BASIC_REGULAR_EXPRESSIONS'
+ libgit_sources += 'compat/regcomp_enhanced.c'
+ endif
+else
+ libgit_c_args += [
+ '-DNO_REGEX',
+ '-DGAWK',
+ '-DNO_MBSUPPORT',
+ ]
+ build_options_config.set('NO_REGEX', '1')
+ libgit_sources += 'compat/regex/regex.c'
+ libgit_include_directories += 'compat/regex'
+endif
+
+# setitimer and friends are provided by compat/mingw.c.
+if host_machine.system() != 'windows'
+ if not compiler.compiles('''
+ #include <sys/time.h>
+ void func(void)
+ {
+ struct itimerval value;
+ }
+ ''', name: 'struct itimerval')
+ libgit_c_args += '-DNO_STRUCT_ITIMERVAL'
+ libgit_c_args += '-DNO_SETITIMER'
+ elif not compiler.has_function('setitimer')
+ libgit_c_args += '-DNO_SETITIMER'
+ endif
+endif
+
+if compiler.has_member('struct stat', 'st_mtimespec.tv_nsec', prefix: '#include <sys/stat.h>')
+ libgit_c_args += '-DUSE_ST_TIMESPEC'
+elif not compiler.has_member('struct stat', 'st_mtim.tv_nsec', prefix: '#include <sys/stat.h>')
+ libgit_c_args += '-DNO_NSEC'
+endif
+
+if not compiler.has_member('struct stat', 'st_blocks', prefix: '#include <sys/stat.h>')
+ libgit_c_args += '-DNO_ST_BLOCKS_IN_STRUCT_STAT'
+endif
+
+if not compiler.has_member('struct dirent', 'd_type', prefix: '#include <dirent.h>')
+ libgit_c_args += '-DNO_D_TYPE_IN_DIRENT'
+endif
+
+if not compiler.has_member('struct passwd', 'pw_gecos', prefix: '#include <pwd.h>')
+ libgit_c_args += '-DNO_GECOS_IN_PWENT'
+endif
+
+if compiler.has_function('sync_file_range')
+ libgit_c_args += '-DHAVE_SYNC_FILE_RANGE'
+endif
+
+if not compiler.has_function('strcasestr')
+ libgit_c_args += '-DNO_STRCASESTR'
+ libgit_sources += 'compat/strcasestr.c'
+endif
+
+if not compiler.has_function('memmem')
+ libgit_c_args += '-DNO_MEMMEM'
+ libgit_sources += 'compat/memmem.c'
+endif
+
+if not compiler.has_function('strlcpy')
+ libgit_c_args += '-DNO_STRLCPY'
+ libgit_sources += 'compat/strlcpy.c'
+endif
+
+if not compiler.has_function('strdup')
+ libgit_c_args += '-DOVERRIDE_STRDUP'
+ libgit_sources += 'compat/strdup.c'
+endif
+
+if not compiler.has_function('strtoumax')
+ libgit_c_args += '-DNO_STRTOUMAX'
+ libgit_sources += [
+ 'compat/strtoumax.c',
+ 'compat/strtoimax.c',
+ ]
+endif
+
+if not compiler.has_function('strtoull')
+ libgit_c_args += '-DNO_STRTOULL'
+endif
+
+if not compiler.has_function('setenv')
+ libgit_c_args += '-DNO_SETENV'
+ libgit_sources += 'compat/setenv.c'
+endif
+
+if not compiler.has_function('qsort')
+ libgit_c_args += '-DINTERNAL_QSORT'
+endif
+libgit_sources += 'compat/qsort_s.c'
+
+# unsetenv is provided by compat/mingw.c.
+if host_machine.system() != 'windows' and not compiler.has_function('unsetenv')
+ libgit_c_args += '-DNO_UNSETENV'
+ libgit_sources += 'compat/unsetenv.c'
+endif
+
+if not compiler.has_function('mkdtemp')
+ libgit_c_args += '-DNO_MKDTEMP'
+ libgit_sources += 'compat/mkdtemp.c'
+endif
+
+if not compiler.has_function('initgroups')
+ libgit_c_args += '-DNO_INITGROUPS'
+endif
+
+if compiler.has_function('getdelim')
+ libgit_c_args += '-DHAVE_GETDELIM'
+endif
+
+if host_machine.system() == 'windows'
+ libgit_c_args += '-DUSE_WIN32_MMAP'
+elif not compiler.has_function('mmap')
+ libgit_c_args += '-DNO_MMAP'
+ libgit_sources += 'compat/mmap.c'
+endif
+
+if compiler.has_function('clock_gettime')
+ libgit_c_args += '-DHAVE_CLOCK_GETTIME'
+endif
+
+if compiler.compiles('''
+ #include <time.h>
+
+ void func(void)
+ {
+ clockid_t id = CLOCK_MONOTONIC;
+ }
+''', name: 'monotonic clock')
+ libgit_c_args += '-DHAVE_CLOCK_MONOTONIC'
+endif
+
+if compiler.compiles('''
+ #include <inttypes.h>
+
+ void func(void)
+ {
+ uintmax_t x = 0;
+ }
+''', name: 'uintmax_t')
+ libgit_c_args += '-DNO_UINTMAX_T'
+endif
+
+has_bsd_sysctl = false
+if compiler.has_header('sys/sysctl.h')
+ if compiler.compiles('''
+ #include <stddef.h>
+ #include <sys/sysctl.h>
+
+ void func(void)
+ {
+ int val, mib[2] = { 0 };
+ size_t len = sizeof(val);
+ sysctl(mib, 2, &val, &len, NULL, 0);
+ }
+ ''', name: 'BSD sysctl')
+ libgit_c_args += '-DHAVE_BSD_SYSCTL'
+ has_bsd_sysctl = true
+ endif
+endif
+
+if compiler.run('''
+ #include <stdio.h>
+
+ int main(int argc, const char **argv)
+ {
+ FILE *f = fopen(".", "r");
+ return f ? 0 : 1;
+ }
+''', name: 'fread reads directories').returncode() == 0
+ libgit_c_args += '-DFREAD_READS_DIRECTORIES'
+ libgit_sources += 'compat/fopen.c'
+endif
+
+if not meson.is_cross_build() and fs.exists('/dev/tty')
+ libgit_c_args += '-DHAVE_DEV_TTY'
+endif
+
+if get_option('openssl').enabled() and get_option('CommonCrypto').enabled()
+ error('Can only use one SSL backend')
+endif
+
+security_framework = dependency('Security', required: get_option('CommonCrypto').disable_auto_if(host_machine.system() != 'darwin'))
+core_foundation_framework = dependency('CoreFoundation', required: security_framework.found())
+if security_framework.found()
+ libgit_dependencies += security_framework
+ libgit_dependencies += core_foundation_framework
+ libgit_c_args += '-DAPPLE_COMMON_CRYPTO'
+endif
+
+# OpenSSL is required when requested via the 'openssl' feature or via one of
+# the SHA1/SHA256 backends.
+openssl_required = get_option('openssl').disable_auto_if(security_framework.found())
+if get_option('sha1_backend') == 'openssl' or get_option('sha256_backend') == 'openssl'
+ openssl_required = true
+endif
+
+openssl = dependency('openssl', required: openssl_required, default_options: ['default_library=static'])
+if openssl.found()
+ libgit_dependencies += openssl
+endif
+
+# We may not want to use OpenSSL for anything but our SHA1/SHA256 backends, so
+# we cannot just set NO_OPENSSL based on whether or not the library was found.
+if not openssl.found() or get_option('openssl').disabled()
+ libgit_c_args += '-DNO_OPENSSL'
+endif
+
+sha1_backend = get_option('sha1_backend')
+if sha1_backend == 'sha1dc'
+ libgit_c_args += '-DSHA1_DC'
+ libgit_c_args += '-DSHA1DC_NO_STANDARD_INCLUDES=1'
+ libgit_c_args += '-DSHA1DC_INIT_SAFE_HASH_DEFAULT=0'
+ libgit_c_args += '-DSHA1DC_CUSTOM_INCLUDE_SHA1_C="git-compat-util.h"'
+ libgit_c_args += '-DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="git-compat-util.h"'
+
+ libgit_sources += [
+ 'sha1dc_git.c',
+ 'sha1dc/sha1.c',
+ 'sha1dc/ubc_check.c',
+ ]
+elif sha1_backend == 'common-crypto'
+ libgit_c_args += '-DCOMMON_DIGEST_FOR_OPENSSL'
+ libgit_c_args += '-DSHA1_APPLE'
+ libgit_c_args += '-DSHA1_MAX_BLOCK_SIZE=1024L*1024L*1024L'
+elif sha1_backend == 'openssl'
+ if not openssl.found()
+ openssl = dependency('openssl', required: true)
+ endif
+
+ libgit_c_args += '-DSHA1_OPENSSL'
+ # Apple CommonCrypto requires chunking
+elif sha1_backend == 'block'
+ libgit_c_args += '-DSHA1_BLK'
+ libgit_sources += 'block-sha1/sha1.c'
+else
+ error('Unhandled SHA1 backend ' + sha1_backend)
+endif
+
+sha256_backend = get_option('sha256_backend')
+if sha256_backend == 'openssl'
+ libgit_c_args += '-DSHA256_OPENSSL'
+elif sha256_backend == 'nettle'
+ nettle = dependency('nettle')
+ libgit_dependencies += nettle
+ libgit_c_args += '-DSHA256_NETTLE'
+elif sha256_backend == 'gcrypt'
+ gcrypt = dependency('gcrypt')
+ libgit_dependencies += gcrypt
+ libgit_c_args += '-DSHA256_GCRYPT'
+elif sha256_backend == 'block'
+ libgit_c_args += '-DSHA256_BLK'
+ libgit_sources += 'sha256/block/sha256.c'
+else
+ error('Unhandled SHA256 backend ' + sha256_backend)
+endif
+
+if compiler.has_header_symbol('stdlib.h', 'arc4random_buf')
+ libgit_c_args += '-DHAVE_ARC4RANDOM'
+elif compiler.has_header_symbol('bsd/stdlib.h', 'arc4random_buf')
+ libgit_c_args += '-DHAVE_ARC4RANDOM_BSD'
+elif compiler.has_function('getrandom', prefix: '#include <sys/random.h>')
+ libgit_c_args += '-DHAVE_GETRANDOM'
+elif compiler.has_function('getentropy', prefix: '#include <unistd.h>')
+ libgit_c_args += '-DHAVE_GETENTROPY'
+elif compiler.has_function('RtlGenRandom', prefix: '#include <windows.h>\n#include <ntsecapi.h>')
+ libgit_c_args += '-DHAVE_RTLGENRANDOM'
+elif openssl.found()
+ libgit_c_args += '-DHAVE_OPENSSL_CSPRNG'
+endif
+
+if get_option('runtime_prefix')
+ libgit_c_args += '-DRUNTIME_PREFIX'
+ build_options_config.set('RUNTIME_PREFIX', '1')
+
+ if compiler.has_header('mach-o/dyld.h')
+ libgit_c_args += '-DHAVE_NS_GET_EXECUTABLE_PATH'
+ endif
+
+ if has_bsd_sysctl and compiler.compiles('''
+ #include <sys/sysctl.h>
+
+ void func(void)
+ {
+ KERN_PROC_PATHNAME; KERN_PROC;
+ }
+ ''', name: 'BSD KERN_PROC_PATHNAME')
+ libgit_c_args += '-DHAVE_NS_GET_EXECUTABLE_PATH'
+ endif
+
+ if host_machine.system() == 'linux'
+ libgit_c_args += '-DPROCFS_EXECUTABLE_PATH="/proc/self/exe' + '"'
+ elif host_machine.system() == 'openbsd'
+ libgit_c_args += '-DPROCFS_EXECUTABLE_PATH="' + '/proc/curproc/file' + '"'
+ elif host_machine.system() == 'netbsd'
+ libgit_c_args += '-DPROCFS_EXECUTABLE_PATH="' + '/proc/curproc/exe' + '"'
+ endif
+
+ if host_machine.system() == 'windows' and compiler.compiles('''
+ #include <stdlib.h>
+
+ void func(void)
+ {
+ _wpgmptr;
+ }
+ ''', name: 'Win32 _wpgmptr')
+ libgit_c_args += '-DHAVE_WPGMPTR'
+ endif
+else
+ build_options_config.set('RUNTIME_PREFIX', '')
+endif
+
+foreach key, value : {
+ 'DIFF': diff.full_path(),
+ 'GIT_TEST_CMP': diff.full_path() + ' -u',
+ 'GIT_TEST_GITPERLLIB': meson.project_build_root() / 'perl',
+ 'GIT_TEST_MERGE_TOOLS_DIR': meson.project_source_root() / 'mergetools',
+ 'GIT_TEST_POPATH': meson.project_source_root() / 'po',
+ 'GIT_TEST_TEMPLATE_DIR': meson.project_build_root() / 'templates',
+ 'GIT_TEST_TEXTDOMAINDIR': meson.project_build_root() / 'po',
+ 'PAGER_ENV': get_option('pager_environment'),
+ 'PERL_PATH': perl.found() ? perl.full_path() : '',
+ 'PYTHON_PATH': python.found () ? python.full_path() : '',
+ 'SHELL_PATH': shell.full_path(),
+ 'TAR': tar.full_path(),
+ 'TEST_OUTPUT_DIRECTORY': test_output_directory,
+ 'TEST_SHELL_PATH': shell.full_path(),
+}
+ if value != '' and cygpath.found()
+ value = run_command(cygpath, value, check: true).stdout().strip()
+ endif
+ build_options_config.set_quoted(key, value)
+endforeach
+
+configure_file(
+ input: 'GIT-BUILD-OPTIONS.in',
+ output: 'GIT-BUILD-OPTIONS',
+ configuration: build_options_config,
+)
+
+# Build a separate library for "version.c" so that we do not have to rebuild
+# everything when the current Git commit changes. TODO: this only gets set up
+# at configuration time, so we do not notice version changes unless the build
+# instructions get regenerated. We should refactor the source file such that we
+# can substitute tags in the file via `vcs_tag()`.
+libgit_version_library = static_library('git-version',
+ sources: ['version.c'],
+ c_args: libgit_c_args + [
+ '-DGIT_VERSION="' + git_version + '"',
+ '-DGIT_USER_AGENT="' + 'git/' + git_version + '"',
+ '-DGIT_BUILT_FROM_COMMIT="' + run_command('git', 'rev-parse', '-q', '--verify', 'HEAD', check: false).stdout().strip() + '"',
+ ],
+ dependencies: libgit_dependencies,
+ include_directories: libgit_include_directories,
+)
+
+libgit_library = static_library('git',
+ sources: libgit_sources,
+ c_args: libgit_c_args,
+ link_with: libgit_version_library,
+ dependencies: libgit_dependencies,
+ include_directories: libgit_include_directories,
+)
+
+libgit = declare_dependency(
+ compile_args: libgit_c_args,
+ link_with: libgit_library,
+ dependencies: libgit_dependencies,
+ include_directories: libgit_include_directories,
+)
+
+common_main_sources = ['common-main.c']
+common_main_link_args = [ ]
+if host_machine.system() == 'windows'
+ # TODO: wire these up properly.
+ common_main_sources += import('windows').compile_resources('git.rc', args: [
+ '-DMAJOR=1',
+ '-DMINOR=1',
+ '-DMICRO=1',
+ '-DPATCHLEVEL=0',
+ '-DGIT_VERSION=\\\"' + git_version + '.GIT\\\"',
+ ])
+ if compiler.get_argument_syntax() == 'gcc'
+ common_main_link_args += [
+ '-municode',
+ '-Wl,-nxcompat',
+ '-Wl,-dynamicbase',
+ '-Wl,-pic-executable,-e,mainCRTStartup',
+ ]
+ elif compiler.get_argument_syntax() == 'msvc'
+ common_main_link_args += [
+ '/ENTRY:wmainCRTStartup',
+ 'invalidcontinue.obj',
+ ]
+ else
+ error('Unsupported compiler ' + compiler.get_id())
+ endif
+endif
+common_main_library = static_library('common-main',
+ 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,
+ link_args: common_main_link_args,
+)
+
+bin_wrappers = [ ]
+test_dependencies = [ ]
+
+git = executable('git',
+ sources: builtin_sources + 'git.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+bin_wrappers += git
+
+test_dependencies += executable('git-daemon',
+ sources: 'daemon.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+test_dependencies += executable('git-sh-i18n--envsubst',
+ sources: 'sh-i18n--envsubst.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+bin_wrappers += executable('git-shell',
+ sources: 'shell.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+test_dependencies += executable('git-http-backend',
+ sources: 'http-backend.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+bin_wrappers += executable('scalar',
+ sources: 'scalar.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+if get_option('curl').enabled()
+ curl_sources = [
+ 'http.c',
+ 'http-walker.c',
+ ]
+
+ git_remote_http = executable('git-remote-http',
+ sources: curl_sources + 'remote-curl.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+ test_dependencies += git_remote_http
+
+ test_dependencies += executable('git-http-fetch',
+ sources: curl_sources + 'http-fetch.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+
+ if expat.found()
+ test_dependencies += executable('git-http-push',
+ sources: curl_sources + 'http-push.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+ endif
+
+ 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, common_main],
+ )
+
+ install_symlink(alias + executable_suffix,
+ install_dir: get_option('libexecdir') / 'git-core',
+ pointing_to: 'git-remote-http',
+ )
+ endforeach
+endif
+
+imap_send_sources = ['imap-send.c']
+if use_curl_for_imap_send
+ imap_send_sources += curl_sources
+endif
+
+test_dependencies += executable('git-imap-send',
+ sources: imap_send_sources,
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+foreach alias : [ 'git-receive-pack', 'git-upload-archive', 'git-upload-pack' ]
+ bin_wrappers += executable(alias,
+ objects: git.extract_all_objects(recursive: false),
+ dependencies: [libgit, common_main],
+ )
+
+ install_symlink(alias + executable_suffix,
+ install_dir: get_option('libexecdir') / 'git-core',
+ pointing_to: 'git-remote-http',
+ )
+endforeach
+
+foreach symlink : [
+ 'git',
+ 'git-http-backend',
+ 'git-receive-pack',
+ 'git-shell',
+ 'git-upload-archive',
+ 'git-upload-pack',
+ 'scalar',
+]
+ install_symlink(symlink,
+ install_dir: get_option('bindir'),
+ pointing_to: fs.relative_to(get_option('libexecdir') / 'git-core' / symlink, get_option('bindir')),
+ )
+endforeach
+
+scripts_sh = [
+ 'git-difftool--helper.sh',
+ 'git-filter-branch.sh',
+ 'git-merge-octopus.sh',
+ 'git-merge-one-file.sh',
+ 'git-merge-resolve.sh',
+ 'git-mergetool--lib.sh',
+ 'git-mergetool.sh',
+ 'git-quiltimport.sh',
+ 'git-request-pull.sh',
+ 'git-sh-i18n.sh',
+ 'git-sh-setup.sh',
+ 'git-submodule.sh',
+ 'git-web--browse.sh',
+]
+if perl_features_enabled
+ scripts_sh += 'git-instaweb.sh'
+endif
+
+foreach script : scripts_sh
+ test_dependencies += custom_target(script,
+ input: script,
+ output: fs.stem(script),
+ command: [
+ shell,
+ meson.project_source_root() / 'generate-script.sh',
+ '@INPUT@',
+ '@OUTPUT@',
+ meson.project_build_root() / 'GIT-BUILD-OPTIONS',
+ ],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+endforeach
+
+if perl_features_enabled
+ scripts_perl = [
+ 'git-archimport.perl',
+ 'git-cvsexportcommit.perl',
+ 'git-cvsimport.perl',
+ 'git-cvsserver.perl',
+ 'git-send-email.perl',
+ 'git-svn.perl',
+ ]
+
+ pathsep = ':'
+ if host_machine.system() == 'windows'
+ pathsep = ';'
+ endif
+
+ perl_header_template = 'perl/header_templates/fixed_prefix.template.pl'
+ if get_option('runtime_prefix')
+ perl_header_template = 'perl/header_templates/runtime_prefix.template.pl'
+ endif
+
+ perl_header = configure_file(
+ input: perl_header_template,
+ output: 'GIT-PERL-HEADER',
+ configuration: {
+ 'GITEXECDIR_REL': get_option('libexecdir') / 'git-core',
+ 'PERLLIBDIR_REL': get_option('datadir') / 'perl5',
+ 'LOCALEDIR_REL': get_option('datadir') / 'locale',
+ 'INSTLIBDIR': get_option('datadir') / 'perl5',
+ 'PATHSEP': pathsep,
+ },
+ )
+
+ generate_perl_command = [
+ shell,
+ meson.project_source_root() / 'generate-perl.sh',
+ meson.project_build_root() / 'GIT-BUILD-OPTIONS',
+ git_version,
+ perl_header,
+ '@INPUT@',
+ '@OUTPUT@',
+ ]
+
+ foreach script : scripts_perl
+ generated_script = custom_target(script,
+ input: script,
+ output: fs.stem(script),
+ command: generate_perl_command,
+ install: true,
+ install_dir: get_option('datadir') / 'perl5',
+ )
+ test_dependencies += generated_script
+ if script == 'git-cvsserver.perl'
+ bin_wrappers += generated_script
+ endif
+ endforeach
+
+ subdir('perl')
+endif
+
+if python.found()
+ scripts_python = [
+ 'git-p4.py'
+ ]
+
+ foreach script : scripts_python
+ fs.copyfile(script, fs.stem(script),
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+ endforeach
+endif
+
+mergetools = [
+ 'mergetools/araxis',
+ 'mergetools/bc',
+ 'mergetools/codecompare',
+ 'mergetools/deltawalker',
+ 'mergetools/diffmerge',
+ 'mergetools/diffuse',
+ 'mergetools/ecmerge',
+ 'mergetools/emerge',
+ 'mergetools/examdiff',
+ 'mergetools/guiffy',
+ 'mergetools/gvimdiff',
+ 'mergetools/kdiff3',
+ 'mergetools/kompare',
+ 'mergetools/meld',
+ 'mergetools/nvimdiff',
+ 'mergetools/opendiff',
+ 'mergetools/p4merge',
+ 'mergetools/smerge',
+ 'mergetools/tkdiff',
+ 'mergetools/tortoisemerge',
+ 'mergetools/vimdiff',
+ 'mergetools/vscode',
+ 'mergetools/winmerge',
+ 'mergetools/xxdiff',
+]
+
+foreach mergetool : mergetools
+ install_data(mergetool, install_dir: get_option('libexecdir') / 'git-core' / 'mergetools')
+endforeach
+
+if intl.found()
+ subdir('po')
+endif
+subdir('contrib')
+subdir('gitweb')
+subdir('templates')
+
+# Everything but the bin-wrappers need to come before this target such that we
+# can properly set up test dependencies. The bin-wrappers themselves are set up
+# at configuration time, so these are fine.
+if get_option('tests')
+ subdir('t')
+endif
+
+subdir('bin-wrappers')
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 00000000000..9b80a301023
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,70 @@
+option('default_help_format', type: 'combo', choices: ['man', 'html', 'info'], value: 'man',
+ description: 'Format of installed documentation.')
+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('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('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('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('python', type: 'feature', value: 'auto',
+ description: 'Build tools written in Python.')
+
+option('openssl', type: 'feature', value: 'auto',
+ description: 'Support access to HTTPS remotes. OpenSSL may still be pulled in if configured as SHA1 or SHA256 backend.')
+option('CommonCrypto', type: 'feature', value: 'auto',
+ description: 'Build tools written in Python.')
+
+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')
+
+option('macos_use_homebrew_gettext', type: 'boolean', value: true,
+ description: 'Use gettext from Homebrew instead of the slightly-broken system-provided one.')
+
+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')
+
+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')
diff --git a/perl/FromCPAN/Mail/meson.build b/perl/FromCPAN/Mail/meson.build
new file mode 100644
index 00000000000..9c7d30a1961
--- /dev/null
+++ b/perl/FromCPAN/Mail/meson.build
@@ -0,0 +1,7 @@
+test_dependencies += custom_target('Address.pm',
+ input: 'Address.pm',
+ output: 'Address.pm',
+ command: generate_perl_command,
+ install: true,
+ install_dir: get_option('datadir') / 'perl5/FromCPAN/Mail',
+)
diff --git a/perl/FromCPAN/meson.build b/perl/FromCPAN/meson.build
new file mode 100644
index 00000000000..643fe748d25
--- /dev/null
+++ b/perl/FromCPAN/meson.build
@@ -0,0 +1,9 @@
+test_dependencies += custom_target('Error.pm',
+ input: 'Error.pm',
+ output: 'Error.pm',
+ command: generate_perl_command,
+ install: true,
+ install_dir: get_option('datadir') / 'perl5/FromCPAN',
+)
+
+subdir('Mail')
diff --git a/perl/Git/LoadCPAN/Mail/meson.build b/perl/Git/LoadCPAN/Mail/meson.build
new file mode 100644
index 00000000000..88a4ed52ff6
--- /dev/null
+++ b/perl/Git/LoadCPAN/Mail/meson.build
@@ -0,0 +1,7 @@
+test_dependencies += custom_target('Address.pm',
+ input: 'Address.pm',
+ output: 'Address.pm',
+ command: generate_perl_command,
+ install: true,
+ install_dir: get_option('datadir') / 'perl5/Git/LoadCPAN/Mail',
+)
diff --git a/perl/Git/LoadCPAN/meson.build b/perl/Git/LoadCPAN/meson.build
new file mode 100644
index 00000000000..4dd194e54e1
--- /dev/null
+++ b/perl/Git/LoadCPAN/meson.build
@@ -0,0 +1,9 @@
+test_dependencies += custom_target('Error.pm',
+ input: 'Error.pm',
+ output: 'Error.pm',
+ command: generate_perl_command,
+ install: true,
+ install_dir: get_option('datadir') / 'perl5/Git/LoadCPAN',
+)
+
+subdir('Mail')
diff --git a/perl/Git/SVN/Memoize/meson.build b/perl/Git/SVN/Memoize/meson.build
new file mode 100644
index 00000000000..66bc5c905ea
--- /dev/null
+++ b/perl/Git/SVN/Memoize/meson.build
@@ -0,0 +1,7 @@
+test_dependencies += custom_target('YAML.pm',
+ input: 'YAML.pm',
+ output: 'YAML.pm',
+ command: generate_perl_command,
+ install: true,
+ install_dir: get_option('datadir') / 'perl5/Git/SVN',
+)
diff --git a/perl/Git/SVN/meson.build b/perl/Git/SVN/meson.build
new file mode 100644
index 00000000000..197c2c08408
--- /dev/null
+++ b/perl/Git/SVN/meson.build
@@ -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(source,
+ input: source,
+ output: source,
+ command: generate_perl_command,
+ install: true,
+ install_dir: get_option('datadir') / 'perl5/Git/SVN',
+ )
+endforeach
+
+subdir('Memoize')
diff --git a/perl/Git/meson.build b/perl/Git/meson.build
new file mode 100644
index 00000000000..ec1b6e2b2f7
--- /dev/null
+++ b/perl/Git/meson.build
@@ -0,0 +1,18 @@
+foreach source : [
+ 'I18N.pm',
+ 'IndexInfo.pm',
+ 'LoadCPAN.pm',
+ 'Packet.pm',
+ 'SVN.pm',
+]
+ test_dependencies += custom_target(source,
+ input: source,
+ output: source,
+ command: generate_perl_command,
+ install: true,
+ install_dir: get_option('datadir') / 'perl5/Git',
+ )
+endforeach
+
+subdir('LoadCPAN')
+subdir('SVN')
diff --git a/perl/meson.build b/perl/meson.build
new file mode 100644
index 00000000000..35a23123cf5
--- /dev/null
+++ b/perl/meson.build
@@ -0,0 +1,12 @@
+test_dependencies += custom_target('Git.pm',
+ 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
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 00000000000..fb1b92eb0a2
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1,28 @@
+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,
+ install_dir: get_option('datadir'),
+)
+test_dependencies += translations[0]
diff --git a/subprojects/.gitignore b/subprojects/.gitignore
new file mode 100644
index 00000000000..63ea916ef5f
--- /dev/null
+++ b/subprojects/.gitignore
@@ -0,0 +1 @@
+/*/
diff --git a/subprojects/curl.wrap b/subprojects/curl.wrap
new file mode 100644
index 00000000000..f7e384b85cf
--- /dev/null
+++ b/subprojects/curl.wrap
@@ -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
diff --git a/subprojects/expat.wrap b/subprojects/expat.wrap
new file mode 100644
index 00000000000..2e0427dcfd1
--- /dev/null
+++ b/subprojects/expat.wrap
@@ -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
diff --git a/subprojects/openssl.wrap b/subprojects/openssl.wrap
new file mode 100644
index 00000000000..873d55106e9
--- /dev/null
+++ b/subprojects/openssl.wrap
@@ -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
diff --git a/subprojects/pcre2.wrap b/subprojects/pcre2.wrap
new file mode 100644
index 00000000000..7e184472543
--- /dev/null
+++ b/subprojects/pcre2.wrap
@@ -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
diff --git a/subprojects/zlib.wrap b/subprojects/zlib.wrap
new file mode 100644
index 00000000000..aa14de17740
--- /dev/null
+++ b/subprojects/zlib.wrap
@@ -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
diff --git a/t/helper/meson.build b/t/helper/meson.build
new file mode 100644
index 00000000000..5e83884246e
--- /dev/null
+++ b/t/helper/meson.build
@@ -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
diff --git a/t/meson.build b/t/meson.build
new file mode 100644
index 00000000000..152fd7dc134
--- /dev/null
+++ b/t/meson.build
@@ -0,0 +1,1103 @@
+clar_test_suites = [
+ 'unit-tests/ctype.c',
+ 'unit-tests/strvec.c',
+]
+
+clar_sources = [
+ 'unit-tests/clar/clar.c',
+ 'unit-tests/unit-test.c',
+]
+
+clar_decls_h = custom_target('clar_decls_h',
+ input: clar_test_suites,
+ output: 'clar-decls.h',
+ command : [shell, meson.current_source_dir() + '/unit-tests/generate-clar-decls.sh', '@OUTPUT@', '@INPUT@'],
+ env: script_environment,
+)
+clar_sources += clar_decls_h
+
+clar_sources += custom_target('clar_suite',
+ input: clar_decls_h,
+ output: 'clar.suite',
+ feed: true,
+ capture: true,
+ command : [awk, '-f', meson.current_source_dir() + '/unit-tests/clar-generate.awk'],
+)
+
+clar_unit_tests = executable('unit-tests',
+ sources: clar_sources + clar_test_suites,
+ dependencies: [libgit, common_main],
+)
+test('unit-tests', clar_unit_tests)
+
+unit_test_programs = [
+ 'unit-tests/t-example-decorate.c',
+ 'unit-tests/t-hash.c',
+ 'unit-tests/t-hashmap.c',
+ 'unit-tests/t-mem-pool.c',
+ 'unit-tests/t-oid-array.c',
+ 'unit-tests/t-oidmap.c',
+ 'unit-tests/t-oidtree.c',
+ 'unit-tests/t-prio-queue.c',
+ 'unit-tests/t-reftable-basics.c',
+ 'unit-tests/t-reftable-block.c',
+ 'unit-tests/t-reftable-merged.c',
+ 'unit-tests/t-reftable-pq.c',
+ 'unit-tests/t-reftable-readwrite.c',
+ 'unit-tests/t-reftable-record.c',
+ 'unit-tests/t-reftable-stack.c',
+ 'unit-tests/t-reftable-tree.c',
+ 'unit-tests/t-strbuf.c',
+ 'unit-tests/t-strcmp-offset.c',
+ 'unit-tests/t-trailer.c',
+ 'unit-tests/t-urlmatch-normalization.c',
+]
+
+foreach unit_test_program : unit_test_programs
+ unit_test_name = fs.stem(unit_test_program)
+ unit_test = executable(unit_test_name,
+ sources: [
+ 'unit-tests/test-lib.c',
+ 'unit-tests/lib-oid.c',
+ 'unit-tests/lib-reftable.c',
+ unit_test_program,
+ ],
+ dependencies: [libgit, common_main],
+ )
+ test(unit_test_name, unit_test,
+ workdir: meson.current_source_dir(),
+ )
+endforeach
+
+subdir('helper')
+
+integration_tests = [
+ 't0000-basic.sh',
+ 't0001-init.sh',
+ 't0002-gitfile.sh',
+ 't0003-attributes.sh',
+ 't0004-unwritable.sh',
+ 't0005-signals.sh',
+ 't0006-date.sh',
+ 't0007-git-var.sh',
+ 't0008-ignores.sh',
+ 't0010-racy-git.sh',
+ 't0012-help.sh',
+ 't0013-sha1dc.sh',
+ 't0014-alias.sh',
+ 't0017-env-helper.sh',
+ 't0018-advice.sh',
+ 't0019-json-writer.sh',
+ 't0020-crlf.sh',
+ 't0021-conversion.sh',
+ 't0022-crlf-rename.sh',
+ 't0023-crlf-am.sh',
+ 't0024-crlf-archive.sh',
+ 't0025-crlf-renormalize.sh',
+ 't0026-eol-config.sh',
+ 't0027-auto-crlf.sh',
+ 't0028-working-tree-encoding.sh',
+ 't0029-core-unsetenvvars.sh',
+ 't0030-stripspace.sh',
+ 't0033-safe-directory.sh',
+ 't0034-root-safe-directory.sh',
+ 't0035-safe-bare-repository.sh',
+ 't0040-parse-options.sh',
+ 't0041-usage.sh',
+ 't0050-filesystem.sh',
+ 't0051-windows-named-pipe.sh',
+ 't0052-simple-ipc.sh',
+ 't0055-beyond-symlinks.sh',
+ 't0056-git-C.sh',
+ 't0060-path-utils.sh',
+ 't0061-run-command.sh',
+ 't0062-revision-walking.sh',
+ 't0063-string-list.sh',
+ 't0066-dir-iterator.sh',
+ 't0067-parse_pathspec_file.sh',
+ 't0068-for-each-repo.sh',
+ 't0070-fundamental.sh',
+ 't0071-sort.sh',
+ 't0080-unit-test-output.sh',
+ 't0081-find-pack.sh',
+ 't0090-cache-tree.sh',
+ 't0091-bugreport.sh',
+ 't0092-diagnose.sh',
+ 't0095-bloom.sh',
+ 't0100-previous.sh',
+ 't0101-at-syntax.sh',
+ 't0200-gettext-basic.sh',
+ 't0201-gettext-fallbacks.sh',
+ 't0202-gettext-perl.sh',
+ 't0203-gettext-setlocale-sanity.sh',
+ 't0204-gettext-reencode-sanity.sh',
+ 't0210-trace2-normal.sh',
+ 't0211-trace2-perf.sh',
+ 't0212-trace2-event.sh',
+ 't0300-credentials.sh',
+ 't0301-credential-cache.sh',
+ 't0302-credential-store.sh',
+ 't0303-credential-external.sh',
+ 't0410-partial-clone.sh',
+ 't0411-clone-from-partial.sh',
+ 't0450-txt-doc-vs-help.sh',
+ 't0500-progress-display.sh',
+ 't0600-reffiles-backend.sh',
+ 't0601-reffiles-pack-refs.sh',
+ 't0602-reffiles-fsck.sh',
+ 't0610-reftable-basics.sh',
+ 't0611-reftable-httpd.sh',
+ 't0612-reftable-jgit-compatibility.sh',
+ 't0613-reftable-write-options.sh',
+ 't1000-read-tree-m-3way.sh',
+ 't1001-read-tree-m-2way.sh',
+ 't1002-read-tree-m-u-2way.sh',
+ 't1003-read-tree-prefix.sh',
+ 't1004-read-tree-m-u-wf.sh',
+ 't1005-read-tree-reset.sh',
+ 't1006-cat-file.sh',
+ 't1007-hash-object.sh',
+ 't1008-read-tree-overlay.sh',
+ 't1009-read-tree-new-index.sh',
+ 't1010-mktree.sh',
+ 't1011-read-tree-sparse-checkout.sh',
+ 't1012-read-tree-df.sh',
+ 't1013-read-tree-submodule.sh',
+ 't1014-read-tree-confusing.sh',
+ 't1015-read-index-unmerged.sh',
+ 't1016-compatObjectFormat.sh',
+ 't1020-subdirectory.sh',
+ 't1021-rerere-in-workdir.sh',
+ 't1022-read-tree-partial-clone.sh',
+ 't1050-large.sh',
+ 't1051-large-conversion.sh',
+ 't1060-object-corruption.sh',
+ 't1090-sparse-checkout-scope.sh',
+ 't1091-sparse-checkout-builtin.sh',
+ 't1092-sparse-checkout-compatibility.sh',
+ 't1100-commit-tree-options.sh',
+ 't1300-config.sh',
+ 't1301-shared-repo.sh',
+ 't1302-repo-version.sh',
+ 't1303-wacky-config.sh',
+ 't1304-default-acl.sh',
+ 't1305-config-include.sh',
+ 't1306-xdg-files.sh',
+ 't1307-config-blob.sh',
+ 't1308-config-set.sh',
+ 't1309-early-config.sh',
+ 't1310-config-default.sh',
+ 't1350-config-hooks-path.sh',
+ 't1400-update-ref.sh',
+ 't1401-symbolic-ref.sh',
+ 't1402-check-ref-format.sh',
+ 't1403-show-ref.sh',
+ 't1404-update-ref-errors.sh',
+ 't1405-main-ref-store.sh',
+ 't1406-submodule-ref-store.sh',
+ 't1407-worktree-ref-store.sh',
+ 't1408-packed-refs.sh',
+ 't1409-avoid-packing-refs.sh',
+ 't1410-reflog.sh',
+ 't1411-reflog-show.sh',
+ 't1412-reflog-loop.sh',
+ 't1413-reflog-detach.sh',
+ 't1414-reflog-walk.sh',
+ 't1415-worktree-refs.sh',
+ 't1416-ref-transaction-hooks.sh',
+ 't1417-reflog-updateref.sh',
+ 't1418-reflog-exists.sh',
+ 't1419-exclude-refs.sh',
+ 't1420-lost-found.sh',
+ 't1430-bad-ref-name.sh',
+ 't1450-fsck.sh',
+ 't1451-fsck-buffer.sh',
+ 't1460-refs-migrate.sh',
+ 't1500-rev-parse.sh',
+ 't1501-work-tree.sh',
+ 't1502-rev-parse-parseopt.sh',
+ 't1503-rev-parse-verify.sh',
+ 't1504-ceiling-dirs.sh',
+ 't1505-rev-parse-last.sh',
+ 't1506-rev-parse-diagnosis.sh',
+ 't1507-rev-parse-upstream.sh',
+ 't1508-at-combinations.sh',
+ 't1509-root-work-tree.sh',
+ 't1510-repo-setup.sh',
+ 't1511-rev-parse-caret.sh',
+ 't1512-rev-parse-disambiguation.sh',
+ 't1513-rev-parse-prefix.sh',
+ 't1514-rev-parse-push.sh',
+ 't1515-rev-parse-outside-repo.sh',
+ 't1517-outside-repo.sh',
+ 't1600-index.sh',
+ 't1601-index-bogus.sh',
+ 't1700-split-index.sh',
+ 't1701-racy-split-index.sh',
+ 't1800-hook.sh',
+ 't2000-conflict-when-checking-files-out.sh',
+ 't2002-checkout-cache-u.sh',
+ 't2003-checkout-cache-mkdir.sh',
+ 't2004-checkout-cache-temp.sh',
+ 't2005-checkout-index-symlinks.sh',
+ 't2006-checkout-index-basic.sh',
+ 't2007-checkout-symlink.sh',
+ 't2008-checkout-subdir.sh',
+ 't2009-checkout-statinfo.sh',
+ 't2010-checkout-ambiguous.sh',
+ 't2011-checkout-invalid-head.sh',
+ 't2012-checkout-last.sh',
+ 't2013-checkout-submodule.sh',
+ 't2014-checkout-switch.sh',
+ 't2015-checkout-unborn.sh',
+ 't2016-checkout-patch.sh',
+ 't2017-checkout-orphan.sh',
+ 't2018-checkout-branch.sh',
+ 't2019-checkout-ambiguous-ref.sh',
+ 't2020-checkout-detach.sh',
+ 't2021-checkout-overwrite.sh',
+ 't2022-checkout-paths.sh',
+ 't2023-checkout-m.sh',
+ 't2024-checkout-dwim.sh',
+ 't2025-checkout-no-overlay.sh',
+ 't2026-checkout-pathspec-file.sh',
+ 't2027-checkout-track.sh',
+ 't2030-unresolve-info.sh',
+ 't2050-git-dir-relative.sh',
+ 't2060-switch.sh',
+ 't2070-restore.sh',
+ 't2071-restore-patch.sh',
+ 't2072-restore-pathspec-file.sh',
+ 't2080-parallel-checkout-basics.sh',
+ 't2081-parallel-checkout-collisions.sh',
+ 't2082-parallel-checkout-attributes.sh',
+ 't2100-update-cache-badpath.sh',
+ 't2101-update-index-reupdate.sh',
+ 't2102-update-index-symlinks.sh',
+ 't2103-update-index-ignore-missing.sh',
+ 't2104-update-index-skip-worktree.sh',
+ 't2105-update-index-gitfile.sh',
+ 't2106-update-index-assume-unchanged.sh',
+ 't2107-update-index-basic.sh',
+ 't2108-update-index-refresh-racy.sh',
+ 't2200-add-update.sh',
+ 't2201-add-update-typechange.sh',
+ 't2202-add-addremove.sh',
+ 't2203-add-intent.sh',
+ 't2204-add-ignored.sh',
+ 't2205-add-worktree-config.sh',
+ 't2300-cd-to-toplevel.sh',
+ 't2400-worktree-add.sh',
+ 't2401-worktree-prune.sh',
+ 't2402-worktree-list.sh',
+ 't2403-worktree-move.sh',
+ 't2404-worktree-config.sh',
+ 't2405-worktree-submodule.sh',
+ 't2406-worktree-repair.sh',
+ 't2407-worktree-heads.sh',
+ 't2500-untracked-overwriting.sh',
+ 't2501-cwd-empty.sh',
+ 't3000-ls-files-others.sh',
+ 't3001-ls-files-others-exclude.sh',
+ 't3002-ls-files-dashpath.sh',
+ 't3003-ls-files-exclude.sh',
+ 't3004-ls-files-basic.sh',
+ 't3005-ls-files-relative.sh',
+ 't3006-ls-files-long.sh',
+ 't3007-ls-files-recurse-submodules.sh',
+ 't3008-ls-files-lazy-init-name-hash.sh',
+ 't3009-ls-files-others-nonsubmodule.sh',
+ 't3010-ls-files-killed-modified.sh',
+ 't3011-common-prefixes-and-directory-traversal.sh',
+ 't3012-ls-files-dedup.sh',
+ 't3013-ls-files-format.sh',
+ 't3020-ls-files-error-unmatch.sh',
+ 't3040-subprojects-basic.sh',
+ 't3050-subprojects-fetch.sh',
+ 't3060-ls-files-with-tree.sh',
+ 't3070-wildmatch.sh',
+ 't3100-ls-tree-restrict.sh',
+ 't3101-ls-tree-dirname.sh',
+ 't3102-ls-tree-wildcards.sh',
+ 't3103-ls-tree-misc.sh',
+ 't3104-ls-tree-format.sh',
+ 't3105-ls-tree-output.sh',
+ 't3200-branch.sh',
+ 't3201-branch-contains.sh',
+ 't3202-show-branch.sh',
+ 't3203-branch-output.sh',
+ 't3204-branch-name-interpretation.sh',
+ 't3205-branch-color.sh',
+ 't3206-range-diff.sh',
+ 't3207-branch-submodule.sh',
+ 't3211-peel-ref.sh',
+ 't3300-funny-names.sh',
+ 't3301-notes.sh',
+ 't3302-notes-index-expensive.sh',
+ 't3303-notes-subtrees.sh',
+ 't3304-notes-mixed.sh',
+ 't3305-notes-fanout.sh',
+ 't3306-notes-prune.sh',
+ 't3307-notes-man.sh',
+ 't3308-notes-merge.sh',
+ 't3309-notes-merge-auto-resolve.sh',
+ 't3310-notes-merge-manual-resolve.sh',
+ 't3311-notes-merge-fanout.sh',
+ 't3320-notes-merge-worktrees.sh',
+ 't3321-notes-stripspace.sh',
+ 't3400-rebase.sh',
+ 't3401-rebase-and-am-rename.sh',
+ 't3402-rebase-merge.sh',
+ 't3403-rebase-skip.sh',
+ 't3404-rebase-interactive.sh',
+ 't3405-rebase-malformed.sh',
+ 't3406-rebase-message.sh',
+ 't3407-rebase-abort.sh',
+ 't3408-rebase-multi-line.sh',
+ 't3409-rebase-environ.sh',
+ 't3412-rebase-root.sh',
+ 't3413-rebase-hook.sh',
+ 't3415-rebase-autosquash.sh',
+ 't3416-rebase-onto-threedots.sh',
+ 't3417-rebase-whitespace-fix.sh',
+ 't3418-rebase-continue.sh',
+ 't3419-rebase-patch-id.sh',
+ 't3420-rebase-autostash.sh',
+ 't3421-rebase-topology-linear.sh',
+ 't3422-rebase-incompatible-options.sh',
+ 't3423-rebase-reword.sh',
+ 't3424-rebase-empty.sh',
+ 't3425-rebase-topology-merges.sh',
+ 't3426-rebase-submodule.sh',
+ 't3427-rebase-subtree.sh',
+ 't3428-rebase-signoff.sh',
+ 't3429-rebase-edit-todo.sh',
+ 't3430-rebase-merges.sh',
+ 't3431-rebase-fork-point.sh',
+ 't3432-rebase-fast-forward.sh',
+ 't3433-rebase-across-mode-change.sh',
+ 't3434-rebase-i18n.sh',
+ 't3435-rebase-gpg-sign.sh',
+ 't3436-rebase-more-options.sh',
+ 't3437-rebase-fixup-options.sh',
+ 't3438-rebase-broken-files.sh',
+ 't3500-cherry.sh',
+ 't3501-revert-cherry-pick.sh',
+ 't3502-cherry-pick-merge.sh',
+ 't3503-cherry-pick-root.sh',
+ 't3504-cherry-pick-rerere.sh',
+ 't3505-cherry-pick-empty.sh',
+ 't3506-cherry-pick-ff.sh',
+ 't3507-cherry-pick-conflict.sh',
+ 't3508-cherry-pick-many-commits.sh',
+ 't3509-cherry-pick-merge-df.sh',
+ 't3510-cherry-pick-sequence.sh',
+ 't3511-cherry-pick-x.sh',
+ 't3512-cherry-pick-submodule.sh',
+ 't3513-revert-submodule.sh',
+ 't3514-cherry-pick-revert-gpg.sh',
+ 't3600-rm.sh',
+ 't3601-rm-pathspec-file.sh',
+ 't3602-rm-sparse-checkout.sh',
+ 't3650-replay-basics.sh',
+ 't3700-add.sh',
+ 't3701-add-interactive.sh',
+ 't3702-add-edit.sh',
+ 't3703-add-magic-pathspec.sh',
+ 't3704-add-pathspec-file.sh',
+ 't3705-add-sparse-checkout.sh',
+ 't3800-mktag.sh',
+ 't3900-i18n-commit.sh',
+ 't3901-i18n-patch.sh',
+ 't3902-quoted.sh',
+ 't3903-stash.sh',
+ 't3904-stash-patch.sh',
+ 't3905-stash-include-untracked.sh',
+ 't3906-stash-submodule.sh',
+ 't3907-stash-show-config.sh',
+ 't3908-stash-in-worktree.sh',
+ 't3909-stash-pathspec-file.sh',
+ 't3910-mac-os-precompose.sh',
+ 't3920-crlf-messages.sh',
+ 't4000-diff-format.sh',
+ 't4001-diff-rename.sh',
+ 't4002-diff-basic.sh',
+ 't4003-diff-rename-1.sh',
+ 't4004-diff-rename-symlink.sh',
+ 't4005-diff-rename-2.sh',
+ 't4006-diff-mode.sh',
+ 't4007-rename-3.sh',
+ 't4008-diff-break-rewrite.sh',
+ 't4009-diff-rename-4.sh',
+ 't4010-diff-pathspec.sh',
+ 't4011-diff-symlink.sh',
+ 't4012-diff-binary.sh',
+ 't4013-diff-various.sh',
+ 't4014-format-patch.sh',
+ 't4015-diff-whitespace.sh',
+ 't4016-diff-quote.sh',
+ 't4017-diff-retval.sh',
+ 't4018-diff-funcname.sh',
+ 't4019-diff-wserror.sh',
+ 't4020-diff-external.sh',
+ 't4021-format-patch-numbered.sh',
+ 't4022-diff-rewrite.sh',
+ 't4023-diff-rename-typechange.sh',
+ 't4024-diff-optimize-common.sh',
+ 't4025-hunk-header.sh',
+ 't4026-color.sh',
+ 't4027-diff-submodule.sh',
+ 't4028-format-patch-mime-headers.sh',
+ 't4029-diff-trailing-space.sh',
+ 't4030-diff-textconv.sh',
+ 't4031-diff-rewrite-binary.sh',
+ 't4032-diff-inter-hunk-context.sh',
+ 't4033-diff-patience.sh',
+ 't4034-diff-words.sh',
+ 't4035-diff-quiet.sh',
+ 't4036-format-patch-signer-mime.sh',
+ 't4037-diff-r-t-dirs.sh',
+ 't4038-diff-combined.sh',
+ 't4039-diff-assume-unchanged.sh',
+ 't4040-whitespace-status.sh',
+ 't4041-diff-submodule-option.sh',
+ 't4042-diff-textconv-caching.sh',
+ 't4043-diff-rename-binary.sh',
+ 't4044-diff-index-unique-abbrev.sh',
+ 't4045-diff-relative.sh',
+ 't4046-diff-unmerged.sh',
+ 't4047-diff-dirstat.sh',
+ 't4048-diff-combined-binary.sh',
+ 't4049-diff-stat-count.sh',
+ 't4050-diff-histogram.sh',
+ 't4051-diff-function-context.sh',
+ 't4052-stat-output.sh',
+ 't4053-diff-no-index.sh',
+ 't4054-diff-bogus-tree.sh',
+ 't4055-diff-context.sh',
+ 't4056-diff-order.sh',
+ 't4057-diff-combined-paths.sh',
+ 't4058-diff-duplicates.sh',
+ 't4059-diff-submodule-not-initialized.sh',
+ 't4060-diff-submodule-option-diff-format.sh',
+ 't4061-diff-indent.sh',
+ 't4062-diff-pickaxe.sh',
+ 't4063-diff-blobs.sh',
+ 't4064-diff-oidfind.sh',
+ 't4065-diff-anchored.sh',
+ 't4066-diff-emit-delay.sh',
+ 't4067-diff-partial-clone.sh',
+ 't4068-diff-symmetric-merge-base.sh',
+ 't4069-remerge-diff.sh',
+ 't4100-apply-stat.sh',
+ 't4101-apply-nonl.sh',
+ 't4102-apply-rename.sh',
+ 't4103-apply-binary.sh',
+ 't4104-apply-boundary.sh',
+ 't4105-apply-fuzz.sh',
+ 't4106-apply-stdin.sh',
+ 't4107-apply-ignore-whitespace.sh',
+ 't4108-apply-threeway.sh',
+ 't4109-apply-multifrag.sh',
+ 't4110-apply-scan.sh',
+ 't4111-apply-subdir.sh',
+ 't4112-apply-renames.sh',
+ 't4113-apply-ending.sh',
+ 't4114-apply-typechange.sh',
+ 't4115-apply-symlink.sh',
+ 't4116-apply-reverse.sh',
+ 't4117-apply-reject.sh',
+ 't4118-apply-empty-context.sh',
+ 't4119-apply-config.sh',
+ 't4120-apply-popt.sh',
+ 't4121-apply-diffs.sh',
+ 't4122-apply-symlink-inside.sh',
+ 't4123-apply-shrink.sh',
+ 't4124-apply-ws-rule.sh',
+ 't4125-apply-ws-fuzz.sh',
+ 't4126-apply-empty.sh',
+ 't4127-apply-same-fn.sh',
+ 't4128-apply-root.sh',
+ 't4129-apply-samemode.sh',
+ 't4130-apply-criss-cross-rename.sh',
+ 't4131-apply-fake-ancestor.sh',
+ 't4132-apply-removal.sh',
+ 't4133-apply-filenames.sh',
+ 't4134-apply-submodule.sh',
+ 't4135-apply-weird-filenames.sh',
+ 't4136-apply-check.sh',
+ 't4137-apply-submodule.sh',
+ 't4138-apply-ws-expansion.sh',
+ 't4139-apply-escape.sh',
+ 't4140-apply-ita.sh',
+ 't4141-apply-too-large.sh',
+ 't4150-am.sh',
+ 't4151-am-abort.sh',
+ 't4152-am-subjects.sh',
+ 't4153-am-resume-override-opts.sh',
+ 't4200-rerere.sh',
+ 't4201-shortlog.sh',
+ 't4202-log.sh',
+ 't4203-mailmap.sh',
+ 't4204-patch-id.sh',
+ 't4205-log-pretty-formats.sh',
+ 't4206-log-follow-harder-copies.sh',
+ 't4207-log-decoration-colors.sh',
+ 't4208-log-magic-pathspec.sh',
+ 't4209-log-pickaxe.sh',
+ 't4210-log-i18n.sh',
+ 't4211-line-log.sh',
+ 't4212-log-corrupt.sh',
+ 't4213-log-tabexpand.sh',
+ 't4214-log-graph-octopus.sh',
+ 't4215-log-skewed-merges.sh',
+ 't4216-log-bloom.sh',
+ 't4217-log-limit.sh',
+ 't4252-am-options.sh',
+ 't4253-am-keep-cr-dos.sh',
+ 't4254-am-corrupt.sh',
+ 't4255-am-submodule.sh',
+ 't4256-am-format-flowed.sh',
+ 't4257-am-interactive.sh',
+ 't4258-am-quoted-cr.sh',
+ 't4300-merge-tree.sh',
+ 't4301-merge-tree-write-tree.sh',
+ 't5000-tar-tree.sh',
+ 't5001-archive-attr.sh',
+ 't5002-archive-attr-pattern.sh',
+ 't5003-archive-zip.sh',
+ 't5004-archive-corner-cases.sh',
+ 't5100-mailinfo.sh',
+ 't5150-request-pull.sh',
+ 't5200-update-server-info.sh',
+ 't5300-pack-object.sh',
+ 't5301-sliding-window.sh',
+ 't5302-pack-index.sh',
+ 't5303-pack-corruption-resilience.sh',
+ 't5304-prune.sh',
+ 't5305-include-tag.sh',
+ 't5306-pack-nobase.sh',
+ 't5307-pack-missing-commit.sh',
+ 't5308-pack-detect-duplicates.sh',
+ 't5309-pack-delta-cycles.sh',
+ 't5310-pack-bitmaps.sh',
+ 't5311-pack-bitmaps-shallow.sh',
+ 't5312-prune-corruption.sh',
+ 't5313-pack-bounds-checks.sh',
+ 't5314-pack-cycle-detection.sh',
+ 't5315-pack-objects-compression.sh',
+ 't5316-pack-delta-depth.sh',
+ 't5317-pack-objects-filter-objects.sh',
+ 't5318-commit-graph.sh',
+ 't5319-multi-pack-index.sh',
+ 't5320-delta-islands.sh',
+ 't5321-pack-large-objects.sh',
+ 't5322-pack-objects-sparse.sh',
+ 't5323-pack-redundant.sh',
+ 't5324-split-commit-graph.sh',
+ 't5325-reverse-index.sh',
+ 't5326-multi-pack-bitmaps.sh',
+ 't5327-multi-pack-bitmaps-rev.sh',
+ 't5328-commit-graph-64bit-time.sh',
+ 't5329-pack-objects-cruft.sh',
+ 't5330-no-lazy-fetch-with-commit-graph.sh',
+ 't5331-pack-objects-stdin.sh',
+ 't5332-multi-pack-reuse.sh',
+ 't5333-pseudo-merge-bitmaps.sh',
+ 't5334-incremental-multi-pack-index.sh',
+ 't5351-unpack-large-objects.sh',
+ 't5400-send-pack.sh',
+ 't5401-update-hooks.sh',
+ 't5402-post-merge-hook.sh',
+ 't5403-post-checkout-hook.sh',
+ 't5404-tracking-branches.sh',
+ 't5405-send-pack-rewind.sh',
+ 't5406-remote-rejects.sh',
+ 't5407-post-rewrite-hook.sh',
+ 't5408-send-pack-stdin.sh',
+ 't5409-colorize-remote-messages.sh',
+ 't5410-receive-pack-alternates.sh',
+ 't5411-proc-receive-hook.sh',
+ 't5500-fetch-pack.sh',
+ 't5501-fetch-push-alternates.sh',
+ 't5502-quickfetch.sh',
+ 't5503-tagfollow.sh',
+ 't5504-fetch-receive-strict.sh',
+ 't5505-remote.sh',
+ 't5506-remote-groups.sh',
+ 't5507-remote-environment.sh',
+ 't5509-fetch-push-namespaces.sh',
+ 't5510-fetch.sh',
+ 't5511-refspec.sh',
+ 't5512-ls-remote.sh',
+ 't5513-fetch-track.sh',
+ 't5514-fetch-multiple.sh',
+ 't5515-fetch-merge-logic.sh',
+ 't5516-fetch-push.sh',
+ 't5517-push-mirror.sh',
+ 't5518-fetch-exit-status.sh',
+ 't5519-push-alternates.sh',
+ 't5520-pull.sh',
+ 't5521-pull-options.sh',
+ 't5522-pull-symlink.sh',
+ 't5523-push-upstream.sh',
+ 't5524-pull-msg.sh',
+ 't5525-fetch-tagopt.sh',
+ 't5526-fetch-submodules.sh',
+ 't5527-fetch-odd-refs.sh',
+ 't5528-push-default.sh',
+ 't5529-push-errors.sh',
+ 't5530-upload-pack-error.sh',
+ 't5531-deep-submodule-push.sh',
+ 't5532-fetch-proxy.sh',
+ 't5533-push-cas.sh',
+ 't5534-push-signed.sh',
+ 't5535-fetch-push-symref.sh',
+ 't5536-fetch-conflicts.sh',
+ 't5537-fetch-shallow.sh',
+ 't5538-push-shallow.sh',
+ 't5539-fetch-http-shallow.sh',
+ 't5540-http-push-webdav.sh',
+ 't5541-http-push-smart.sh',
+ 't5542-push-http-shallow.sh',
+ 't5543-atomic-push.sh',
+ 't5544-pack-objects-hook.sh',
+ 't5545-push-options.sh',
+ 't5546-receive-limits.sh',
+ 't5547-push-quarantine.sh',
+ 't5548-push-porcelain.sh',
+ 't5549-fetch-push-http.sh',
+ 't5550-http-fetch-dumb.sh',
+ 't5551-http-fetch-smart.sh',
+ 't5552-skipping-fetch-negotiator.sh',
+ 't5553-set-upstream.sh',
+ 't5554-noop-fetch-negotiator.sh',
+ 't5555-http-smart-common.sh',
+ 't5557-http-get.sh',
+ 't5558-clone-bundle-uri.sh',
+ 't5559-http-fetch-smart-http2.sh',
+ 't5560-http-backend-noserver.sh',
+ 't5561-http-backend.sh',
+ 't5562-http-backend-content-length.sh',
+ 't5563-simple-http-auth.sh',
+ 't5564-http-proxy.sh',
+ 't5570-git-daemon.sh',
+ 't5571-pre-push-hook.sh',
+ 't5572-pull-submodule.sh',
+ 't5573-pull-verify-signatures.sh',
+ 't5574-fetch-output.sh',
+ 't5580-unc-paths.sh',
+ 't5581-http-curl-verbose.sh',
+ 't5582-fetch-negative-refspec.sh',
+ 't5583-push-branches.sh',
+ 't5600-clone-fail-cleanup.sh',
+ 't5601-clone.sh',
+ 't5602-clone-remote-exec.sh',
+ 't5603-clone-dirname.sh',
+ 't5604-clone-reference.sh',
+ 't5605-clone-local.sh',
+ 't5606-clone-options.sh',
+ 't5607-clone-bundle.sh',
+ 't5608-clone-2gb.sh',
+ 't5609-clone-branch.sh',
+ 't5610-clone-detached.sh',
+ 't5611-clone-config.sh',
+ 't5612-clone-refspec.sh',
+ 't5613-info-alternate.sh',
+ 't5614-clone-submodules-shallow.sh',
+ 't5615-alternate-env.sh',
+ 't5616-partial-clone.sh',
+ 't5617-clone-submodules-remote.sh',
+ 't5618-alternate-refs.sh',
+ 't5619-clone-local-ambiguous-transport.sh',
+ 't5700-protocol-v1.sh',
+ 't5701-git-serve.sh',
+ 't5702-protocol-v2.sh',
+ 't5703-upload-pack-ref-in-want.sh',
+ 't5704-protocol-violations.sh',
+ 't5705-session-id-in-capabilities.sh',
+ 't5730-protocol-v2-bundle-uri-file.sh',
+ 't5731-protocol-v2-bundle-uri-git.sh',
+ 't5732-protocol-v2-bundle-uri-http.sh',
+ 't5750-bundle-uri-parse.sh',
+ 't5801-remote-helpers.sh',
+ 't5802-connect-helper.sh',
+ 't5810-proto-disable-local.sh',
+ 't5811-proto-disable-git.sh',
+ 't5812-proto-disable-http.sh',
+ 't5813-proto-disable-ssh.sh',
+ 't5814-proto-disable-ext.sh',
+ 't5815-submodule-protos.sh',
+ 't5900-repo-selection.sh',
+ 't6000-rev-list-misc.sh',
+ 't6001-rev-list-graft.sh',
+ 't6002-rev-list-bisect.sh',
+ 't6003-rev-list-topo-order.sh',
+ 't6004-rev-list-path-optim.sh',
+ 't6005-rev-list-count.sh',
+ 't6006-rev-list-format.sh',
+ 't6007-rev-list-cherry-pick-file.sh',
+ 't6008-rev-list-submodule.sh',
+ 't6009-rev-list-parent.sh',
+ 't6010-merge-base.sh',
+ 't6011-rev-list-with-bad-commit.sh',
+ 't6012-rev-list-simplify.sh',
+ 't6013-rev-list-reverse-parents.sh',
+ 't6014-rev-list-all.sh',
+ 't6016-rev-list-graph-simplify-history.sh',
+ 't6017-rev-list-stdin.sh',
+ 't6018-rev-list-glob.sh',
+ 't6019-rev-list-ancestry-path.sh',
+ 't6020-bundle-misc.sh',
+ 't6021-rev-list-exclude-hidden.sh',
+ 't6022-rev-list-missing.sh',
+ 't6030-bisect-porcelain.sh',
+ 't6040-tracking-info.sh',
+ 't6041-bisect-submodule.sh',
+ 't6050-replace.sh',
+ 't6060-merge-index.sh',
+ 't6100-rev-list-in-order.sh',
+ 't6101-rev-parse-parents.sh',
+ 't6102-rev-list-unexpected-objects.sh',
+ 't6110-rev-list-sparse.sh',
+ 't6111-rev-list-treesame.sh',
+ 't6112-rev-list-filters-objects.sh',
+ 't6113-rev-list-bitmap-filters.sh',
+ 't6114-keep-packs.sh',
+ 't6115-rev-list-du.sh',
+ 't6120-describe.sh',
+ 't6130-pathspec-noglob.sh',
+ 't6131-pathspec-icase.sh',
+ 't6132-pathspec-exclude.sh',
+ 't6133-pathspec-rev-dwim.sh',
+ 't6134-pathspec-in-submodule.sh',
+ 't6135-pathspec-with-attrs.sh',
+ 't6136-pathspec-in-bare.sh',
+ 't6200-fmt-merge-msg.sh',
+ 't6300-for-each-ref.sh',
+ 't6301-for-each-ref-errors.sh',
+ 't6302-for-each-ref-filter.sh',
+ 't6400-merge-df.sh',
+ 't6401-merge-criss-cross.sh',
+ 't6402-merge-rename.sh',
+ 't6403-merge-file.sh',
+ 't6404-recursive-merge.sh',
+ 't6405-merge-symlinks.sh',
+ 't6406-merge-attr.sh',
+ 't6407-merge-binary.sh',
+ 't6408-merge-up-to-date.sh',
+ 't6409-merge-subtree.sh',
+ 't6411-merge-filemode.sh',
+ 't6412-merge-large-rename.sh',
+ 't6413-merge-crlf.sh',
+ 't6414-merge-rename-nocruft.sh',
+ 't6415-merge-dir-to-symlink.sh',
+ 't6416-recursive-corner-cases.sh',
+ 't6417-merge-ours-theirs.sh',
+ 't6418-merge-text-auto.sh',
+ 't6419-merge-ignorecase.sh',
+ 't6421-merge-partial-clone.sh',
+ 't6422-merge-rename-corner-cases.sh',
+ 't6423-merge-rename-directories.sh',
+ 't6424-merge-unrelated-index-changes.sh',
+ 't6425-merge-rename-delete.sh',
+ 't6426-merge-skip-unneeded-updates.sh',
+ 't6427-diff3-conflict-markers.sh',
+ 't6428-merge-conflicts-sparse.sh',
+ 't6429-merge-sequence-rename-caching.sh',
+ 't6430-merge-recursive.sh',
+ 't6431-merge-criscross.sh',
+ 't6432-merge-recursive-space-options.sh',
+ 't6433-merge-toplevel.sh',
+ 't6434-merge-recursive-rename-options.sh',
+ 't6435-merge-sparse.sh',
+ 't6436-merge-overwrite.sh',
+ 't6437-submodule-merge.sh',
+ 't6438-submodule-directory-file-conflicts.sh',
+ 't6439-merge-co-error-msgs.sh',
+ 't6500-gc.sh',
+ 't6501-freshen-objects.sh',
+ 't6600-test-reach.sh',
+ 't6700-tree-depth.sh',
+ 't7001-mv.sh',
+ 't7002-mv-sparse-checkout.sh',
+ 't7003-filter-branch.sh',
+ 't7004-tag.sh',
+ 't7005-editor.sh',
+ 't7006-pager.sh',
+ 't7007-show.sh',
+ 't7008-filter-branch-null-sha1.sh',
+ 't7010-setup.sh',
+ 't7011-skip-worktree-reading.sh',
+ 't7012-skip-worktree-writing.sh',
+ 't7030-verify-tag.sh',
+ 't7031-verify-tag-signed-ssh.sh',
+ 't7060-wtstatus.sh',
+ 't7061-wtstatus-ignore.sh',
+ 't7062-wtstatus-ignorecase.sh',
+ 't7063-status-untracked-cache.sh',
+ 't7064-wtstatus-pv2.sh',
+ 't7101-reset-empty-subdirs.sh',
+ 't7102-reset.sh',
+ 't7103-reset-bare.sh',
+ 't7104-reset-hard.sh',
+ 't7105-reset-patch.sh',
+ 't7106-reset-unborn-branch.sh',
+ 't7107-reset-pathspec-file.sh',
+ 't7110-reset-merge.sh',
+ 't7111-reset-table.sh',
+ 't7112-reset-submodule.sh',
+ 't7113-post-index-change-hook.sh',
+ 't7201-co.sh',
+ 't7300-clean.sh',
+ 't7301-clean-interactive.sh',
+ 't7400-submodule-basic.sh',
+ 't7401-submodule-summary.sh',
+ 't7402-submodule-rebase.sh',
+ 't7403-submodule-sync.sh',
+ 't7406-submodule-update.sh',
+ 't7407-submodule-foreach.sh',
+ 't7408-submodule-reference.sh',
+ 't7409-submodule-detached-work-tree.sh',
+ 't7411-submodule-config.sh',
+ 't7412-submodule-absorbgitdirs.sh',
+ 't7413-submodule-is-active.sh',
+ 't7414-submodule-mistakes.sh',
+ 't7416-submodule-dash-url.sh',
+ 't7417-submodule-path-url.sh',
+ 't7418-submodule-sparse-gitmodules.sh',
+ 't7419-submodule-set-branch.sh',
+ 't7420-submodule-set-url.sh',
+ 't7421-submodule-summary-add.sh',
+ 't7422-submodule-output.sh',
+ 't7423-submodule-symlinks.sh',
+ 't7424-submodule-mixed-ref-formats.sh',
+ 't7450-bad-git-dotfiles.sh',
+ 't7500-commit-template-squash-signoff.sh',
+ 't7501-commit-basic-functionality.sh',
+ 't7502-commit-porcelain.sh',
+ 't7503-pre-commit-and-pre-merge-commit-hooks.sh',
+ 't7504-commit-msg-hook.sh',
+ 't7505-prepare-commit-msg-hook.sh',
+ 't7506-status-submodule.sh',
+ 't7507-commit-verbose.sh',
+ 't7508-status.sh',
+ 't7509-commit-authorship.sh',
+ 't7510-signed-commit.sh',
+ 't7511-status-index.sh',
+ 't7512-status-help.sh',
+ 't7513-interpret-trailers.sh',
+ 't7514-commit-patch.sh',
+ 't7515-status-symlinks.sh',
+ 't7516-commit-races.sh',
+ 't7517-per-repo-email.sh',
+ 't7518-ident-corner-cases.sh',
+ 't7519-status-fsmonitor.sh',
+ 't7520-ignored-hook-warning.sh',
+ 't7521-ignored-mode.sh',
+ 't7524-commit-summary.sh',
+ 't7525-status-rename.sh',
+ 't7526-commit-pathspec-file.sh',
+ 't7527-builtin-fsmonitor.sh',
+ 't7528-signed-commit-ssh.sh',
+ 't7600-merge.sh',
+ 't7601-merge-pull-config.sh',
+ 't7602-merge-octopus-many.sh',
+ 't7603-merge-reduce-heads.sh',
+ 't7604-merge-custom-message.sh',
+ 't7605-merge-resolve.sh',
+ 't7606-merge-custom.sh',
+ 't7607-merge-state.sh',
+ 't7608-merge-messages.sh',
+ 't7609-mergetool--lib.sh',
+ 't7610-mergetool.sh',
+ 't7611-merge-abort.sh',
+ 't7612-merge-verify-signatures.sh',
+ 't7614-merge-signoff.sh',
+ 't7615-diff-algo-with-mergy-operations.sh',
+ 't7700-repack.sh',
+ 't7701-repack-unpack-unreachable.sh',
+ 't7702-repack-cyclic-alternate.sh',
+ 't7703-repack-geometric.sh',
+ 't7704-repack-cruft.sh',
+ 't7800-difftool.sh',
+ 't7810-grep.sh',
+ 't7811-grep-open.sh',
+ 't7812-grep-icase-non-ascii.sh',
+ 't7813-grep-icase-iso.sh',
+ 't7814-grep-recurse-submodules.sh',
+ 't7815-grep-binary.sh',
+ 't7816-grep-binary-pattern.sh',
+ 't7817-grep-sparse-checkout.sh',
+ 't7900-maintenance.sh',
+ 't8001-annotate.sh',
+ 't8002-blame.sh',
+ 't8003-blame-corner-cases.sh',
+ 't8004-blame-with-conflicts.sh',
+ 't8005-blame-i18n.sh',
+ 't8006-blame-textconv.sh',
+ 't8007-cat-file-textconv.sh',
+ 't8008-blame-formats.sh',
+ 't8009-blame-vs-topicbranches.sh',
+ 't8010-cat-file-filters.sh',
+ 't8011-blame-split-file.sh',
+ 't8012-blame-colors.sh',
+ 't8013-blame-ignore-revs.sh',
+ 't8014-blame-ignore-fuzzy.sh',
+ 't9001-send-email.sh',
+ 't9002-column.sh',
+ 't9003-help-autocorrect.sh',
+ 't9100-git-svn-basic.sh',
+ 't9101-git-svn-props.sh',
+ 't9102-git-svn-deep-rmdir.sh',
+ 't9103-git-svn-tracked-directory-removed.sh',
+ 't9104-git-svn-follow-parent.sh',
+ 't9105-git-svn-commit-diff.sh',
+ 't9106-git-svn-commit-diff-clobber.sh',
+ 't9107-git-svn-migrate.sh',
+ 't9108-git-svn-glob.sh',
+ 't9109-git-svn-multi-glob.sh',
+ 't9110-git-svn-use-svm-props.sh',
+ 't9111-git-svn-use-svnsync-props.sh',
+ 't9112-git-svn-md5less-file.sh',
+ 't9113-git-svn-dcommit-new-file.sh',
+ 't9114-git-svn-dcommit-merge.sh',
+ 't9115-git-svn-dcommit-funky-renames.sh',
+ 't9116-git-svn-log.sh',
+ 't9117-git-svn-init-clone.sh',
+ 't9118-git-svn-funky-branch-names.sh',
+ 't9119-git-svn-info.sh',
+ 't9120-git-svn-clone-with-percent-escapes.sh',
+ 't9121-git-svn-fetch-renamed-dir.sh',
+ 't9122-git-svn-author.sh',
+ 't9123-git-svn-rebuild-with-rewriteroot.sh',
+ 't9124-git-svn-dcommit-auto-props.sh',
+ 't9125-git-svn-multi-glob-branch-names.sh',
+ 't9126-git-svn-follow-deleted-readded-directory.sh',
+ 't9127-git-svn-partial-rebuild.sh',
+ 't9128-git-svn-cmd-branch.sh',
+ 't9129-git-svn-i18n-commitencoding.sh',
+ 't9130-git-svn-authors-file.sh',
+ 't9131-git-svn-empty-symlink.sh',
+ 't9132-git-svn-broken-symlink.sh',
+ 't9133-git-svn-nested-git-repo.sh',
+ 't9134-git-svn-ignore-paths.sh',
+ 't9135-git-svn-moved-branch-empty-file.sh',
+ 't9136-git-svn-recreated-branch-empty-file.sh',
+ 't9137-git-svn-dcommit-clobber-series.sh',
+ 't9138-git-svn-authors-prog.sh',
+ 't9139-git-svn-non-utf8-commitencoding.sh',
+ 't9140-git-svn-reset.sh',
+ 't9141-git-svn-multiple-branches.sh',
+ 't9142-git-svn-shallow-clone.sh',
+ 't9143-git-svn-gc.sh',
+ 't9144-git-svn-old-rev_map.sh',
+ 't9145-git-svn-master-branch.sh',
+ 't9146-git-svn-empty-dirs.sh',
+ 't9147-git-svn-include-paths.sh',
+ 't9148-git-svn-propset.sh',
+ 't9150-svk-mergetickets.sh',
+ 't9151-svn-mergeinfo.sh',
+ 't9152-svn-empty-dirs-after-gc.sh',
+ 't9153-git-svn-rewrite-uuid.sh',
+ 't9154-git-svn-fancy-glob.sh',
+ 't9155-git-svn-fetch-deleted-tag.sh',
+ 't9156-git-svn-fetch-deleted-tag-2.sh',
+ 't9157-git-svn-fetch-merge.sh',
+ 't9158-git-svn-mergeinfo.sh',
+ 't9159-git-svn-no-parent-mergeinfo.sh',
+ 't9160-git-svn-preserve-empty-dirs.sh',
+ 't9161-git-svn-mergeinfo-push.sh',
+ 't9162-git-svn-dcommit-interactive.sh',
+ 't9163-git-svn-reset-clears-caches.sh',
+ 't9164-git-svn-dcommit-concurrent.sh',
+ 't9165-git-svn-fetch-merge-branch-of-branch.sh',
+ 't9166-git-svn-fetch-merge-branch-of-branch2.sh',
+ 't9167-git-svn-cmd-branch-subproject.sh',
+ 't9168-git-svn-partially-globbed-names.sh',
+ 't9169-git-svn-dcommit-crlf.sh',
+ 't9200-git-cvsexportcommit.sh',
+ 't9210-scalar.sh',
+ 't9211-scalar-clone.sh',
+ 't9300-fast-import.sh',
+ 't9301-fast-import-notes.sh',
+ 't9302-fast-import-unpack-limit.sh',
+ 't9303-fast-import-compression.sh',
+ 't9304-fast-import-marks.sh',
+ 't9350-fast-export.sh',
+ 't9351-fast-export-anonymize.sh',
+ 't9400-git-cvsserver-server.sh',
+ 't9401-git-cvsserver-crlf.sh',
+ 't9402-git-cvsserver-refs.sh',
+ 't9500-gitweb-standalone-no-errors.sh',
+ 't9501-gitweb-standalone-http-status.sh',
+ 't9502-gitweb-standalone-parse-output.sh',
+ 't9600-cvsimport.sh',
+ 't9601-cvsimport-vendor-branch.sh',
+ 't9602-cvsimport-branches-tags.sh',
+ 't9603-cvsimport-patchsets.sh',
+ 't9604-cvsimport-timestamps.sh',
+ 't9700-perl-git.sh',
+ 't9800-git-p4-basic.sh',
+ 't9801-git-p4-branch.sh',
+ 't9802-git-p4-filetype.sh',
+ 't9803-git-p4-shell-metachars.sh',
+ 't9804-git-p4-label.sh',
+ 't9805-git-p4-skip-submit-edit.sh',
+ 't9806-git-p4-options.sh',
+ 't9807-git-p4-submit.sh',
+ 't9808-git-p4-chdir.sh',
+ 't9809-git-p4-client-view.sh',
+ 't9810-git-p4-rcs.sh',
+ 't9811-git-p4-label-import.sh',
+ 't9812-git-p4-wildcards.sh',
+ 't9813-git-p4-preserve-users.sh',
+ 't9814-git-p4-rename.sh',
+ 't9815-git-p4-submit-fail.sh',
+ 't9816-git-p4-locked.sh',
+ 't9817-git-p4-exclude.sh',
+ 't9818-git-p4-block.sh',
+ 't9819-git-p4-case-folding.sh',
+ 't9820-git-p4-editor-handling.sh',
+ 't9821-git-p4-path-variations.sh',
+ 't9822-git-p4-path-encoding.sh',
+ 't9823-git-p4-mock-lfs.sh',
+ 't9824-git-p4-git-lfs.sh',
+ 't9825-git-p4-handle-utf16-without-bom.sh',
+ 't9826-git-p4-keep-empty-commits.sh',
+ 't9827-git-p4-change-filetype.sh',
+ 't9828-git-p4-map-user.sh',
+ 't9829-git-p4-jobs.sh',
+ 't9830-git-p4-symlink-dir.sh',
+ 't9831-git-p4-triggers.sh',
+ 't9832-unshelve.sh',
+ 't9833-errors.sh',
+ 't9834-git-p4-file-dir-bug.sh',
+ 't9835-git-p4-metadata-encoding-python2.sh',
+ 't9836-git-p4-metadata-encoding-python3.sh',
+ 't9850-shell.sh',
+ 't9901-git-web--browse.sh',
+ 't9902-completion.sh',
+ 't9903-bash-prompt.sh',
+]
+
+# GIT_BUILD_DIR needs to be Unix-style without drive prefixes as it 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 it.
+git_build_dir = meson.project_build_root()
+if cygpath.found()
+ git_build_dir = run_command(cygpath, git_build_dir, check: true).stdout().strip()
+endif
+
+test_environment = script_environment
+test_environment.set('GIT_BUILD_DIR', git_build_dir)
+
+foreach integration_test : integration_tests
+ test(fs.stem(integration_test), shell,
+ args: [ integration_test ],
+ workdir: meson.current_source_dir(),
+ env: test_environment,
+ depends: test_dependencies + bin_wrappers,
+ timeout: 0,
+ )
+endforeach
diff --git a/templates/hooks/meson.build b/templates/hooks/meson.build
new file mode 100644
index 00000000000..f948b9fb145
--- /dev/null
+++ b/templates/hooks/meson.build
@@ -0,0 +1,24 @@
+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,
+ )
+endforeach
diff --git a/templates/info/meson.build b/templates/info/meson.build
new file mode 100644
index 00000000000..1a2f2f84d2f
--- /dev/null
+++ b/templates/info/meson.build
@@ -0,0 +1,5 @@
+configure_file(
+ input: 'exclude',
+ output: 'exclude',
+ configuration: template_config,
+)
diff --git a/templates/meson.build b/templates/meson.build
new file mode 100644
index 00000000000..010b9ef6d3a
--- /dev/null
+++ b/templates/meson.build
@@ -0,0 +1,13 @@
+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,
+)
+
+subdir('hooks')
+subdir('info')
--
2.47.0.72.gef8ce8f3d4.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v3 00/15] Modernize the build system
2024-10-18 12:23 ` [RFC PATCH v3 00/15] Modernize the " Patrick Steinhardt
` (14 preceding siblings ...)
2024-10-18 12:24 ` [RFC PATCH v3 15/15] Introduce support for the Meson build system Patrick Steinhardt
@ 2024-10-18 16:08 ` Ramsay Jones
2024-10-20 8:51 ` Eli Schwartz
2024-10-23 12:04 ` Patrick Steinhardt
2024-10-18 21:09 ` Taylor Blau
2024-10-21 22:10 ` Taylor Blau
17 siblings, 2 replies; 386+ messages in thread
From: Ramsay Jones @ 2024-10-18 16:08 UTC (permalink / raw)
To: Patrick Steinhardt, git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano
On 18/10/2024 13:23, Patrick Steinhardt wrote:
> Hi,
>
> this is the third version of my patch series that aims to modernize our
> build system infrastructure. It refactors our existing build infra to be
> ready for out-of-tree builds and then wires up Meson.
>
> Changes compared to v2:
>
> - I have split out semi-related changes like the platform
> compatibility fixes into separate series. More on that further down
> below, where I explain the current base.
>
> - I have polished the CMake-related changes I've been doing as prereqs
> while refactoring our build system. Some of the changes weren't
> tested before, but now CMake works as expected.
Just curious, does the cmake build system work on Linux now?
(cmake is another system that I don't really know, except in a
'monkey-see monkey-do' kinda way)
>
> - Fixed up some dependencies in our Makefile, as I didn't amend them
> to depend on the new generator scripts.
>
> - I have extracted some more scripts to massage our Perl library code,
> shells cripts and gitweb.cgi such that they can be used by Make,
> CMake and Meson. This also fixes generation of "gitweb.cgi" on
> Meson as reported by Ramsay.
I haven't had time to test this yet (I haven't even properly read the
patches), but from a quick squint, this looks similar to my attempts
to do the same thing the other night (minus the cmake stuff, of course).
However, I didn't notice anything in the commit message about changing
the format of the GITWEB-BUILD-OPTIONS file, which already exists before
that commit. I did the same, btw, but it seems that file was only used to
'notice' when the configuration changed to enable the re-build of gitweb.cgi.
In which case, the change in format (rather than content) was not an issue.
>
> - I have fixed the cyclic dependency in our Makefile that I have
> introduced with v2.
>
> - I have addressed some feedback regarding "build-systems.txt".
>
> - I have made things work with OpenBSD 7.6.
>
> - Things now work on Cygwin and MinGW64 as expected, no more test
> failures except for t9700, which also fails with our Makefile.
This caused me some concern for a little while, since I don't recall
that the t9700 test has ever failed for me on cygwin. I have the test
output files for all versions of git (each rc and rel) from v2.12.0-rc0
(5th Feb 2017) to today (all 143 of them) and none of them show that
test failing. (I remove files from that directory on occasion when it
takes up too much disk space).
However, you qualify that statement in the commit message to make clear
that it works on cygwin, but fails on other windows 'targets'. phew! :)
> - I have improved how we set up the required tooling on Windows such
> that we detect Git for Windows-provided tools as we do with CMake.
> Like this, VS Code can now trivially import the Meson project and
> configure it. Furthermore, generation of the Visual Studio solution
> is trivial as well. So overall, things work fine now on all the
> important Windows environments that I'm aware of.
>
> - Several smaller fixes all over the place.
>
> I've included a range-diff, but it's quite crowded overall.
>
> In general I think that this is in a pretty good shape now. I have
> tested things on NixOS, macOS 10.15, OpenBSD 7.6, FreeBSD 14.1, Windows
> 10 with MSVC, VS Code, MinGW and Cygwin, and things are generally smooth
> and just work. I'm sure there's still going to be weirdnesses on some
> platforms regardless of that.
I had a very quick attempt on cygwin the other night, and it behaved
differently at the 'ninja test' stage. It printed something like
'[0/1] all tests' and then seemed to do nothing, except 'python3.9'
was hovering up all cycles (well over 75% anyway) with no indication
of any progress. This was nothing like the behaviour on Linux (which
also looked a bit strange, but at least showed progress on each test
as it ran).
I ^C-ed it, since I didn't want to wait 6 hours before it (hopefully)
finished running.
Thanks!
ATB,
Ramsay Jones
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v3 00/15] Modernize the build system
2024-10-18 12:23 ` [RFC PATCH v3 00/15] Modernize the " Patrick Steinhardt
` (15 preceding siblings ...)
2024-10-18 16:08 ` [RFC PATCH v3 00/15] Modernize the " Ramsay Jones
@ 2024-10-18 21:09 ` Taylor Blau
2024-10-23 12:04 ` Patrick Steinhardt
2024-10-21 22:10 ` Taylor Blau
17 siblings, 1 reply; 386+ messages in thread
From: Taylor Blau @ 2024-10-18 21:09 UTC (permalink / raw)
To: Patrick Steinhardt
Cc: git, Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones
On Fri, Oct 18, 2024 at 02:23:47PM +0200, Patrick Steinhardt wrote:
> This series is based on 15030f9556 (The second batch, 2024-10-15) and
> has the following dependencies:
>
> - ps/cmake-clar at c6d3e52c91 (cmake: set up proper
> dependencies for generated clar headers, 2024-10-15).
>
> - ps/upgrade-clar at f3501edb0e (Makefile: adjust sed command for
> generating "clar-decls.h", 2024-10-14).
>
> - ps/platform-compat-fixes at 80ebd91b83 (http: fix build error on
> FreeBSD, 2024-10-16).
>
> These deps are mostly just there to make tests pass on all platforms,
> but I wouldn't want folks to go test things and discover breakage that
> is not caused by Meson itself :) You can also find this version of the
> patch series at [1], branch "pks-meson-v3". @Taylor, I'm fine with
> keeping this out of "seen" if you prefer to wait for those dependencies
> to land first.
Of the three, only the last one is marked as "Will merge to 'next'?" in
the next integration round[^1]. All three are in 'seen', so this should
apply cleanly on top of those.
What is the state of those first two topics? Are they ready to go, or
are we expecting a new round for any of them?
Thanks,
Taylor
[^1]: I think I will do another full integration cycle on Tuesday of
next week, but I am not entirely sure yet.
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v3 01/15] Makefile: use common template for GIT-BUILD-OPTIONS
2024-10-18 12:23 ` [RFC PATCH v3 01/15] Makefile: use common template for GIT-BUILD-OPTIONS Patrick Steinhardt
@ 2024-10-19 5:00 ` Eric Sunshine
2024-10-23 12:04 ` Patrick Steinhardt
0 siblings, 1 reply; 386+ messages in thread
From: Eric Sunshine @ 2024-10-19 5:00 UTC (permalink / raw)
To: Patrick Steinhardt
Cc: git, Eli Schwartz, Phillip Wood, Junio C Hamano, Ramsay Jones
On Fri, Oct 18, 2024 at 8:23 AM Patrick Steinhardt <ps@pks.im> wrote:
> Introduce a new "GIT-BUILD-OPTIONS.in" template to address this issue.
> This has multiple advantages:
> [...]
> - Some build systems complain when not all variables could be
> substituted, alerting us of mismatches. Others don't, but if we
> forgot to substitute such variables we now have a bogus string that
> will likely cause our tests to fail, if they have any meaning in the
> first place.
Regarding the above...
> + @sed \
> + -e "s|@SHELL_PATH@|\'$(SHELL_PATH_SQ)\'|" \
> + -e "s|@TEST_SHELL_PATH@|\'$(TEST_SHELL_PATH_SQ)\'|" \
> + [...]
> + GIT-BUILD-OPTIONS.in >$@+
> @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
> @if test -f GIT-BUILD-DIR; then rm GIT-BUILD-DIR; fi
... can't we `grep` whether any unsubstituted variables remain in $@+
and complain if they do?
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v3 09/15] Makefile: refactor generators to be PWD-independent
2024-10-18 12:24 ` [RFC PATCH v3 09/15] Makefile: refactor generators to be PWD-independent Patrick Steinhardt
@ 2024-10-19 5:06 ` Eric Sunshine
0 siblings, 0 replies; 386+ messages in thread
From: Eric Sunshine @ 2024-10-19 5:06 UTC (permalink / raw)
To: Patrick Steinhardt
Cc: git, Eli Schwartz, Phillip Wood, Junio C Hamano, Ramsay Jones
On Fri, Oct 18, 2024 at 8:24 AM Patrick Steinhardt <ps@pks.im> wrote:
> We have multiple scripts that generate headers from other data. All of
> these scripts have the assumption built-in that they are executed in the
> current source directory, which makes them a bit unwieldy to use during
> out-of-tree builds. This makes them a bit unwieldy to use. Refactor them
> to instead take the source directory as well as the output file as
> arguments.
Duplicate "makes them a bit unwieldy to use".
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v3 11/15] Makefile: simplify building of templates
2024-10-18 12:24 ` [RFC PATCH v3 11/15] Makefile: simplify building of templates Patrick Steinhardt
@ 2024-10-19 5:09 ` Eric Sunshine
0 siblings, 0 replies; 386+ messages in thread
From: Eric Sunshine @ 2024-10-19 5:09 UTC (permalink / raw)
To: Patrick Steinhardt
Cc: git, Eli Schwartz, Phillip Wood, Junio C Hamano, Ramsay Jones
On Fri, Oct 18, 2024 at 8:24 AM Patrick Steinhardt <ps@pks.im> wrote:
> When we install Git we also install a set of default templates that both
> git-init(1) and git-clone(1) populate into our build directories. The
> way the pristine templates are layed out in our source directory is
> somewhat weird though: instead of reconstructing the actual directory
> hierarchy in "templates/", we represent directory separators with "--".
s/layed/laid/
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v3 13/15] t: allow overriding build dir
2024-10-18 12:24 ` [RFC PATCH v3 13/15] t: allow overriding build dir Patrick Steinhardt
@ 2024-10-19 5:11 ` Eric Sunshine
0 siblings, 0 replies; 386+ messages in thread
From: Eric Sunshine @ 2024-10-19 5:11 UTC (permalink / raw)
To: Patrick Steinhardt
Cc: git, Eli Schwartz, Phillip Wood, Junio C Hamano, Ramsay Jones
On Fri, Oct 18, 2024 at 8:24 AM Patrick Steinhardt <ps@pks.im> wrote:
> Our "test-lib.sh" assumes that our build directory is the parent
> directory of "t/". While true when using our Makefile, it's not when
> using build systems that support out-of-tree builds.
>
> In commit ee9e66e4e7 (cmake: avoid editing t/test-lib.sh, 2022-10-18),
> we have introduce support for overriding the GIT_BIULD_DIR by creating
s/GIT_BIULD_DIR/GIT_BUILD_DIR/
> the file "$GIT_BUILD_DIR/GIT-BUILD-DIR" with its contents pointing to
> the location of the build directory. The intent was to stop modifying
> "t/test-lib.sh" with the CMake build systems while allowing out-of-tree
> builds. But "$GIT_BUILD_DIR" is somewhat misleadingly named, as it in
> fact points to the _source_ directory. So while that commit solved part
> of the problem for out-of-tree builds, CMake still has to write files
> into the source tree.
>
> Solve the second part of the problem, namely not having to write any
> data into the source directory at all, by also supporting an environment
> variable that allows us to point to a different build directory. This
> allows us to perform properly self-contained out-of-tree builds.
>
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v3 15/15] Introduce support for the Meson build system
2024-10-18 12:24 ` [RFC PATCH v3 15/15] Introduce support for the Meson build system Patrick Steinhardt
@ 2024-10-19 5:21 ` Eric Sunshine
0 siblings, 0 replies; 386+ messages in thread
From: Eric Sunshine @ 2024-10-19 5:21 UTC (permalink / raw)
To: Patrick Steinhardt
Cc: git, Eli Schwartz, Phillip Wood, Junio C Hamano, Ramsay Jones
On Fri, Oct 18, 2024 at 8:24 AM Patrick Steinhardt <ps@pks.im> wrote:
> Introduce support for the Meson build system, a "modern" meta build
> system that supports many different plaforms, 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.
s/plaforms/platforms/
> 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 is likely to pick
> up Rust as another language eventually.
s/is likely to/may/
> # Execute single test interactively to allow fordebugging.
> $ meson test 't0000-*' --interactive --test-args=-ix
s/fordebugging/for debugging/
> - 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 usecase for
> those anymore. By not installing those symlinks we thus start the
> deprecation of this layout.
s/usecase/use case/
> - We're targeting a 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.
s/targeting a Meson/targeting Meson/
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v3 00/15] Modernize the build system
2024-10-18 16:08 ` [RFC PATCH v3 00/15] Modernize the " Ramsay Jones
@ 2024-10-20 8:51 ` Eli Schwartz
2024-10-21 22:56 ` Ramsay Jones
2024-10-23 12:04 ` Patrick Steinhardt
1 sibling, 1 reply; 386+ messages in thread
From: Eli Schwartz @ 2024-10-20 8:51 UTC (permalink / raw)
To: Ramsay Jones, Patrick Steinhardt, git
Cc: Eric Sunshine, Phillip Wood, Junio C Hamano
[-- Attachment #1.1: Type: text/plain, Size: 2224 bytes --]
On 10/18/24 12:08 PM, Ramsay Jones wrote:
> I had a very quick attempt on cygwin the other night, and it behaved
> differently at the 'ninja test' stage. It printed something like
> '[0/1] all tests' and then seemed to do nothing, except 'python3.9'
> was hovering up all cycles (well over 75% anyway) with no indication
> of any progress. This was nothing like the behaviour on Linux (which
> also looked a bit strange, but at least showed progress on each test
> as it ran).
>
> I ^C-ed it, since I didn't want to wait 6 hours before it (hopefully)
> finished running.
Running "ninja test" can be thought of as a convenience target to make
all commands available via the Makefile equivalent. What it actually
does, though, is first depend on "all" + any explicit test dependencies,
and then dispatch to the separate "meson test" tool with some tastefully
chosen arguments such as "--no-rebuild" (to prevent rerunning ninja) as
well as --print-errorlogs.
Running "meson test" directly is still possible, and maybe required if
you want to do things such as --interactive, or running a specific
testcase rather than all of them, or --maxfail, or well, all kinds of
fiddly and specific fine-tuning. :)
But in particular, I am wondering if maybe your cygwin issue is somehow
due to ninja deciding that it really really wanted to buffer all output
and wait until it completes before showing anything. It's not supposed
to do that, since we wire it up to the "console" pool:
https://ninja-build.org/manual.html#_the_literal_console_literal_pool
The other possibility is that the python installation has decided to
buffer itself:
https://docs.python.org/3/using/cmdline.html#cmdoption-u
possibly because due to ninja's juggling of pseudo ttys, the python
runtime for "meson test" thinks it is *not* running in a tty. I know
that ninja messes around with this in counterintuitive ways in general,
but I am not sure exactly how that interacts with the console pool. But
regardless of the reason -- if it is happening at the python level, then
exporting PYTHONUNBUFFERED=1 may help. It's something I've had to do
before for programs other than meson, at least.
--
Eli Schwartz
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v3 00/15] Modernize the build system
2024-10-18 12:23 ` [RFC PATCH v3 00/15] Modernize the " Patrick Steinhardt
` (16 preceding siblings ...)
2024-10-18 21:09 ` Taylor Blau
@ 2024-10-21 22:10 ` Taylor Blau
2024-10-23 12:04 ` Patrick Steinhardt
17 siblings, 1 reply; 386+ messages in thread
From: Taylor Blau @ 2024-10-21 22:10 UTC (permalink / raw)
To: Patrick Steinhardt
Cc: git, Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones
On Fri, Oct 18, 2024 at 02:23:47PM +0200, Patrick Steinhardt wrote:
> This series is based on 15030f9556 (The second batch, 2024-10-15) and
> has the following dependencies:
>
> - ps/cmake-clar at c6d3e52c91 (cmake: set up proper
> dependencies for generated clar headers, 2024-10-15).
>
> - ps/upgrade-clar at f3501edb0e (Makefile: adjust sed command for
> generating "clar-decls.h", 2024-10-14).
>
> - ps/platform-compat-fixes at 80ebd91b83 (http: fix build error on
> FreeBSD, 2024-10-16).
While this is still sitting on my review queue, I rebuilt this topic
based on the above (extremely helpful) information, but it seems to
produce some conflicts when I try to merge it in at the end of 'seen':
--- 8< ---
diff --cc Makefile
index 2c1afd08cb,a93aeb3bc8..0000000000
--- a/Makefile
+++ b/Makefile
@@@ -3932,10 -3859,9 +3886,18 @@@ GIT-TEST-SUITES: FORC
fi
$(UNIT_TEST_DIR)/clar-decls.h: $(patsubst %,$(UNIT_TEST_DIR)/%.c,$(CLAR_TEST_SUITES)) GIT-TEST-SUITES
++<<<<<<< HEAD
+ $(QUIET_GEN)$(SHELL_PATH) $(UNIT_TEST_DIR)/generate-clar-decls.sh "$@" $(filter %.c,$^)
++||||||| merged common ancestors
++ $(QUIET_GEN)for suite in $(CLAR_TEST_SUITES); do \
++ sed -ne "s/^\(void test_$${suite}__[a-zA-Z_0-9][a-zA-Z_0-9]*(void)$$\)/extern \1;/p" $(UNIT_TEST_DIR)/$$suite.c; \
++ done >$@
++=======
+ $(QUIET_GEN)$(SHELL_PATH) $(UNIT_TEST_DIR)/generate-clar-decls.sh "$@" $(patsubst %,$(UNIT_TEST_DIR)/%.c,$(CLAR_TEST_SUITES))
++>>>>>>> ps/build
$(UNIT_TEST_DIR)/clar.suite: $(UNIT_TEST_DIR)/clar-decls.h
$(QUIET_GEN)awk -f $(UNIT_TEST_DIR)/clar-generate.awk $< >$(UNIT_TEST_DIR)/clar.suite
+$(UNIT_TEST_DIR)/clar/clar.o: $(UNIT_TEST_DIR)/clar.suite
$(CLAR_TEST_OBJS): $(UNIT_TEST_DIR)/clar-decls.h
$(CLAR_TEST_OBJS): EXTRA_CPPFLAGS = -I$(UNIT_TEST_DIR)
$(CLAR_TEST_PROG): $(UNIT_TEST_DIR)/clar.suite $(CLAR_TEST_OBJS) $(GITLIBS) GIT-LDFLAGS
diff --cc t/unit-tests/clar/clar.c
index d54e455367,64879cf2bd..0000000000
--- a/t/unit-tests/clar/clar.c
+++ b/t/unit-tests/clar/clar.c
@@@ -812,9 -801,8 +812,17 @@@ void clar__assert_equal
}
}
}
++<<<<<<< HEAD
+#endif /* CLAR_HAVE_WCHAR */
else if (!strcmp("%"PRIuMAX, fmt) || !strcmp("%"PRIxMAX, fmt)) {
uintmax_t sz1 = va_arg(args, uintmax_t), sz2 = va_arg(args, uintmax_t);
++||||||| merged common ancestors
++ else if (!strcmp("%"PRIuZ, fmt) || !strcmp("%"PRIxZ, fmt)) {
++ size_t sz1 = va_arg(args, size_t), sz2 = va_arg(args, size_t);
++=======
++ else if (!strcmp("%"PRIuMAX, fmt) || !strcmp("%"PRIxMAX, fmt)) {
++ uintmax_t sz1 = va_arg(args, uintmax_t), sz2 = va_arg(args, uintmax_t);
++>>>>>>> ps/build
is_equal = (sz1 == sz2);
if (!is_equal) {
int offset = p_snprintf(buf, sizeof(buf), fmt, sz1);
diff --cc t/unit-tests/generate-clar-decls.sh
index 688e0885f4,81da732917..0000000000
--- a/t/unit-tests/generate-clar-decls.sh
+++ b/t/unit-tests/generate-clar-decls.sh
@@@ -1,16 -1,16 +1,36 @@@
++<<<<<<< HEAD
+#!/bin/sh
+
+if test $# -lt 2
+then
+ echo "USAGE: $0 <OUTPUT> <SUITE>..." 2>&1
+ exit 1
+fi
+
+OUTPUT="$1"
+shift
+
+for suite in "$@"
+do
+ sed -ne "s/^\(void test_$(basename "${suite%.c}")__[a-zA-Z_0-9][a-zA-Z_0-9]*(void)\)$/extern \1;/p" "$suite" ||
+ exit 1
+done >"$OUTPUT"
++||||||| merged common ancestors
++=======
+ #!/bin/sh
+
+ if test $# -lt 2
+ then
+ echo "USAGE: $0 <OUTPUT> <SUITE>..." 2>&1
+ exit 1
+ fi
+
+ OUTPUT="$1"
+ shift
+
+ for suite in "$@"
+ do
+ sed -ne "s/^\(void test_$suite__[a-zA-Z_0-9][a-zA-Z_0-9]*(void)$\)/extern \1;/p" "$suite" ||
+ exit 1
+ done >"$OUTPUT"
++>>>>>>> ps/build
--- >8 ---
Thanks,
Taylor
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v3 00/15] Modernize the build system
2024-10-20 8:51 ` Eli Schwartz
@ 2024-10-21 22:56 ` Ramsay Jones
2024-10-23 12:04 ` Patrick Steinhardt
0 siblings, 1 reply; 386+ messages in thread
From: Ramsay Jones @ 2024-10-21 22:56 UTC (permalink / raw)
To: Eli Schwartz, Patrick Steinhardt, git
Cc: Eric Sunshine, Phillip Wood, Junio C Hamano
On 20/10/2024 09:51, Eli Schwartz wrote:
> On 10/18/24 12:08 PM, Ramsay Jones wrote:
[snip]
> possibly because due to ninja's juggling of pseudo ttys, the python
> runtime for "meson test" thinks it is *not* running in a tty. I know
> that ninja messes around with this in counterintuitive ways in general,
> but I am not sure exactly how that interacts with the console pool. But
> regardless of the reason -- if it is happening at the python level, then
> exporting PYTHONUNBUFFERED=1 may help. It's something I've had to do
> before for programs other than meson, at least.
Unfortunately, the 'PYTHONUNBUFFERED=1' idea didn't work. In fact nothing
I have tried on cygwin has worked. For example, if I use meson to run just
few tests, like so on Linux:
$ meson test --no-rebuild --print-errorlogs 't000*'
1/9 t0000-basic OK 7.52s
2/9 t0001-init OK 1.88s
3/9 t0002-gitfile OK 0.37s
4/9 t0003-attributes OK 1.35s
5/9 t0004-unwritable OK 0.23s
6/9 t0005-signals OK 0.16s
7/9 t0006-date OK 0.73s
8/9 t0007-git-var OK 0.40s
9/9 t0008-ignores OK 3.09s
Ok: 9
Expected Fail: 0
Fail: 0
Unexpected Pass: 0
Skipped: 0
Timeout: 0
Full log written to /home/ramsay/git/build/meson-logs/testlog.txt
$
On cygwin it looks like:
$ meson test --no-rebuild --print-errorlogs 't000*'
1/9 t0002-gitfile OK 12.32s
[2-4/9] 🌖 t0003-attributes 12s
Which actually looks nothing like what actually happens! The first line
is actually the result of (*maybe*) running all 9 tests, but during that
time the line started with '[1-4/9] ...' and they didn't run in sequence
but jumped around ending with t0002. Then on the second line, it almost
immediately hung, again with python hovering up all the cpu cycles. So
I had to kill the task from a second terminal.
Actually, I tell a lie, I did get a single test to work on cygwin:
$ meson test --no-rebuild --print-errorlogs 't0001*'
1/1 t0001-init OK 32.95s
Ok: 1
Expected Fail: 0
Fail: 0
Unexpected Pass: 0
Skipped: 0
Timeout: 0
Full log written to /home/ramsay/git/build/meson-logs/testlog.txt
$
Notice that this took much longer, at 32.95s, than (what looked like) all
nine tests above at 12.32s. (although via 'make test' t0000-basic.sh alone
took 124.13s for v2.47.0!).
Patrick, how do you run the tests on cygwin?
ATB,
Ramsay Jones
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v3 00/15] Modernize the build system
2024-10-18 16:08 ` [RFC PATCH v3 00/15] Modernize the " Ramsay Jones
2024-10-20 8:51 ` Eli Schwartz
@ 2024-10-23 12:04 ` Patrick Steinhardt
1 sibling, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-23 12:04 UTC (permalink / raw)
To: Ramsay Jones
Cc: git, Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano
On Fri, Oct 18, 2024 at 05:08:41PM +0100, Ramsay Jones wrote:
> On 18/10/2024 13:23, Patrick Steinhardt wrote:
> > Hi,
> >
> > this is the third version of my patch series that aims to modernize our
> > build system infrastructure. It refactors our existing build infra to be
> > ready for out-of-tree builds and then wires up Meson.
> >
> > Changes compared to v2:
> >
> > - I have split out semi-related changes like the platform
> > compatibility fixes into separate series. More on that further down
> > below, where I explain the current base.
> >
> > - I have polished the CMake-related changes I've been doing as prereqs
> > while refactoring our build system. Some of the changes weren't
> > tested before, but now CMake works as expected.
>
> Just curious, does the cmake build system work on Linux now?
>
> (cmake is another system that I don't really know, except in a
> 'monkey-see monkey-do' kinda way)
To some extent. Some issues have been fixed and/or improved by this
series, but we're not fully there for CMake:
- It builds, but the build leaks outside of the build directory into
the source tree. In theory we now have all parts together to fix
that, as demonstrated by the Meson build support, but I didn't wire
this up.
- The tests do not run at all for me, might be I'm holding it wrong.
But with the patch that allows us to override the GIT-BUILD-DIR we
should be able to get out-of-tree tests running, as well. Again, I
didn't wire this up.
- Some things simply haven't been wired up at all, like building
"gitweb.cgi". Any gitweb-tests would thus fail.
But in any case, this patch series doesn't regress support for CMake
anymore like previous versions did.
> > - Fixed up some dependencies in our Makefile, as I didn't amend them
> > to depend on the new generator scripts.
> >
> > - I have extracted some more scripts to massage our Perl library code,
> > shells cripts and gitweb.cgi such that they can be used by Make,
> > CMake and Meson. This also fixes generation of "gitweb.cgi" on
> > Meson as reported by Ramsay.
>
> I haven't had time to test this yet (I haven't even properly read the
> patches), but from a quick squint, this looks similar to my attempts
> to do the same thing the other night (minus the cmake stuff, of course).
>
> However, I didn't notice anything in the commit message about changing
> the format of the GITWEB-BUILD-OPTIONS file, which already exists before
> that commit. I did the same, btw, but it seems that file was only used to
> 'notice' when the configuration changed to enable the re-build of gitweb.cgi.
> In which case, the change in format (rather than content) was not an issue.
Yeah, it's been a bit weird before. It contained sed commands to
execute, but also some other relevant build options. Made this whole
thing a bit weird to use.
In any case, it works the same way that GIT-BUILD-OPTIONS work now,
which I think is a good thing. The plumbing around it is a bit verbose,
but other than that I think it's straight-forward.
> >
> > - I have fixed the cyclic dependency in our Makefile that I have
> > introduced with v2.
> >
> > - I have addressed some feedback regarding "build-systems.txt".
> >
> > - I have made things work with OpenBSD 7.6.
> >
> > - Things now work on Cygwin and MinGW64 as expected, no more test
> > failures except for t9700, which also fails with our Makefile.
>
> This caused me some concern for a little while, since I don't recall
> that the t9700 test has ever failed for me on cygwin. I have the test
> output files for all versions of git (each rc and rel) from v2.12.0-rc0
> (5th Feb 2017) to today (all 143 of them) and none of them show that
> test failing. (I remove files from that directory on occasion when it
> takes up too much disk space).
>
> However, you qualify that statement in the commit message to make clear
> that it works on cygwin, but fails on other windows 'targets'. phew! :)
Oh, yeah, that one seems misleading indeed.
> > - I have improved how we set up the required tooling on Windows such
> > that we detect Git for Windows-provided tools as we do with CMake.
> > Like this, VS Code can now trivially import the Meson project and
> > configure it. Furthermore, generation of the Visual Studio solution
> > is trivial as well. So overall, things work fine now on all the
> > important Windows environments that I'm aware of.
> >
> > - Several smaller fixes all over the place.
> >
> > I've included a range-diff, but it's quite crowded overall.
> >
> > In general I think that this is in a pretty good shape now. I have
> > tested things on NixOS, macOS 10.15, OpenBSD 7.6, FreeBSD 14.1, Windows
> > 10 with MSVC, VS Code, MinGW and Cygwin, and things are generally smooth
> > and just work. I'm sure there's still going to be weirdnesses on some
> > platforms regardless of that.
>
> I had a very quick attempt on cygwin the other night, and it behaved
> differently at the 'ninja test' stage. It printed something like
> '[0/1] all tests' and then seemed to do nothing, except 'python3.9'
> was hovering up all cycles (well over 75% anyway) with no indication
> of any progress. This was nothing like the behaviour on Linux (which
> also looked a bit strange, but at least showed progress on each test
> as it ran).
>
> I ^C-ed it, since I didn't want to wait 6 hours before it (hopefully)
> finished running.
Interesting, that's something I didn't experience yet. I'll chime in
further down in this thread.
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v3 00/15] Modernize the build system
2024-10-18 21:09 ` Taylor Blau
@ 2024-10-23 12:04 ` Patrick Steinhardt
2024-10-23 20:15 ` Taylor Blau
0 siblings, 1 reply; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-23 12:04 UTC (permalink / raw)
To: Taylor Blau
Cc: git, Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones
On Fri, Oct 18, 2024 at 05:09:43PM -0400, Taylor Blau wrote:
> On Fri, Oct 18, 2024 at 02:23:47PM +0200, Patrick Steinhardt wrote:
> > This series is based on 15030f9556 (The second batch, 2024-10-15) and
> > has the following dependencies:
> >
> > - ps/cmake-clar at c6d3e52c91 (cmake: set up proper
> > dependencies for generated clar headers, 2024-10-15).
> >
> > - ps/upgrade-clar at f3501edb0e (Makefile: adjust sed command for
> > generating "clar-decls.h", 2024-10-14).
> >
> > - ps/platform-compat-fixes at 80ebd91b83 (http: fix build error on
> > FreeBSD, 2024-10-16).
> >
> > These deps are mostly just there to make tests pass on all platforms,
> > but I wouldn't want folks to go test things and discover breakage that
> > is not caused by Meson itself :) You can also find this version of the
> > patch series at [1], branch "pks-meson-v3". @Taylor, I'm fine with
> > keeping this out of "seen" if you prefer to wait for those dependencies
> > to land first.
>
> Of the three, only the last one is marked as "Will merge to 'next'?" in
> the next integration round[^1]. All three are in 'seen', so this should
> apply cleanly on top of those.
>
> What is the state of those first two topics? Are they ready to go, or
> are we expecting a new round for any of them?
These have been merged into a single topic now and should be ready to go
from my point of view. But they still require reviews.
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v3 00/15] Modernize the build system
2024-10-21 22:10 ` Taylor Blau
@ 2024-10-23 12:04 ` Patrick Steinhardt
2024-10-23 20:12 ` Taylor Blau
0 siblings, 1 reply; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-23 12:04 UTC (permalink / raw)
To: Taylor Blau
Cc: git, Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones
On Mon, Oct 21, 2024 at 06:10:10PM -0400, Taylor Blau wrote:
> On Fri, Oct 18, 2024 at 02:23:47PM +0200, Patrick Steinhardt wrote:
> > This series is based on 15030f9556 (The second batch, 2024-10-15) and
> > has the following dependencies:
> >
> > - ps/cmake-clar at c6d3e52c91 (cmake: set up proper
> > dependencies for generated clar headers, 2024-10-15).
> >
> > - ps/upgrade-clar at f3501edb0e (Makefile: adjust sed command for
> > generating "clar-decls.h", 2024-10-14).
> >
> > - ps/platform-compat-fixes at 80ebd91b83 (http: fix build error on
> > FreeBSD, 2024-10-16).
>
> While this is still sitting on my review queue, I rebuilt this topic
> based on the above (extremely helpful) information, but it seems to
> produce some conflicts when I try to merge it in at the end of 'seen':
Huh, interesting. The first two series had conflicts with each other, so
I wouldn't be surprised if what you see comes from that. Those two
topics have been merged into a single topic now.
I'll send an updated version of this series at the end of this week that
also aims to fix conflicts with 'seen'.
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v3 00/15] Modernize the build system
2024-10-21 22:56 ` Ramsay Jones
@ 2024-10-23 12:04 ` Patrick Steinhardt
2024-10-23 14:38 ` Ramsay Jones
0 siblings, 1 reply; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-23 12:04 UTC (permalink / raw)
To: Ramsay Jones
Cc: Eli Schwartz, git, Eric Sunshine, Phillip Wood, Junio C Hamano
On Mon, Oct 21, 2024 at 11:56:42PM +0100, Ramsay Jones wrote:
> On 20/10/2024 09:51, Eli Schwartz wrote:
> > On 10/18/24 12:08 PM, Ramsay Jones wrote:
> [snip]
> > possibly because due to ninja's juggling of pseudo ttys, the python
> > runtime for "meson test" thinks it is *not* running in a tty. I know
> > that ninja messes around with this in counterintuitive ways in general,
> > but I am not sure exactly how that interacts with the console pool. But
> > regardless of the reason -- if it is happening at the python level, then
> > exporting PYTHONUNBUFFERED=1 may help. It's something I've had to do
> > before for programs other than meson, at least.
>
> Unfortunately, the 'PYTHONUNBUFFERED=1' idea didn't work. In fact nothing
> I have tried on cygwin has worked. For example, if I use meson to run just
> few tests, like so on Linux:
>
> $ meson test --no-rebuild --print-errorlogs 't000*'
> 1/9 t0000-basic OK 7.52s
> 2/9 t0001-init OK 1.88s
> 3/9 t0002-gitfile OK 0.37s
> 4/9 t0003-attributes OK 1.35s
> 5/9 t0004-unwritable OK 0.23s
> 6/9 t0005-signals OK 0.16s
> 7/9 t0006-date OK 0.73s
> 8/9 t0007-git-var OK 0.40s
> 9/9 t0008-ignores OK 3.09s
>
> Ok: 9
> Expected Fail: 0
> Fail: 0
> Unexpected Pass: 0
> Skipped: 0
> Timeout: 0
>
> Full log written to /home/ramsay/git/build/meson-logs/testlog.txt
> $
>
> On cygwin it looks like:
>
> $ meson test --no-rebuild --print-errorlogs 't000*'
> 1/9 t0002-gitfile OK 12.32s
> [2-4/9] 🌖 t0003-attributes 12s
>
> Which actually looks nothing like what actually happens! The first line
> is actually the result of (*maybe*) running all 9 tests, but during that
> time the line started with '[1-4/9] ...' and they didn't run in sequence
> but jumped around ending with t0002. Then on the second line, it almost
> immediately hung, again with python hovering up all the cpu cycles. So
> I had to kill the task from a second terminal.
>
> Actually, I tell a lie, I did get a single test to work on cygwin:
>
> $ meson test --no-rebuild --print-errorlogs 't0001*'
> 1/1 t0001-init OK 32.95s
>
> Ok: 1
> Expected Fail: 0
> Fail: 0
> Unexpected Pass: 0
> Skipped: 0
> Timeout: 0
>
> Full log written to /home/ramsay/git/build/meson-logs/testlog.txt
> $
>
> Notice that this took much longer, at 32.95s, than (what looked like) all
> nine tests above at 12.32s. (although via 'make test' t0000-basic.sh alone
> took 124.13s for v2.47.0!).
>
> Patrick, how do you run the tests on cygwin?
I didn't have to do anything special here, so this is quite puzzling. In
a fully-updated Cygwin installation:
$ which meson
/usr/bin/meson
$ meson --version
1.3.2
$ python --version
3.9.16
$ mkdir build
$ meson setup ..
... autoconfiguration logs ...
$ meson test 't000*'
ninja: Entering directory `/home/Patrick Steinhardt/git/build'
[582/582] Linking target git-receive-pack.exe
1/9 t0005-signals OK 4.17s
2/9 t0004-unwritable OK 4.58s
3/9 t0002-gitfile OK 6.95s
4/9 t0007-git-var OK 8.15s
5/9 t0006-date OK 15.42s
6/9 t0003-attributes OK 26.84s
7/9 t0001-init OK 29.09s
8/9 t0008-ignores OK 57.17s
9/9 t0000-basic OK 83.82s
Ok: 9
Expected Fail: 0
Fail: 0
Unexpected Pass: 0
Skipped: 0
Timeout: 0
Full log written to /home/Patrick Steinhardt/git/build/meson-logs/testlog.txt
This is starting with a fresh repo, I executed `git clean -dfx`
beforehand.
Do any of the versions used maybe differ?
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v3 01/15] Makefile: use common template for GIT-BUILD-OPTIONS
2024-10-19 5:00 ` Eric Sunshine
@ 2024-10-23 12:04 ` Patrick Steinhardt
0 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-23 12:04 UTC (permalink / raw)
To: Eric Sunshine
Cc: git, Eli Schwartz, Phillip Wood, Junio C Hamano, Ramsay Jones
On Sat, Oct 19, 2024 at 01:00:46AM -0400, Eric Sunshine wrote:
> On Fri, Oct 18, 2024 at 8:23 AM Patrick Steinhardt <ps@pks.im> wrote:
> > Introduce a new "GIT-BUILD-OPTIONS.in" template to address this issue.
> > This has multiple advantages:
> > [...]
> > - Some build systems complain when not all variables could be
> > substituted, alerting us of mismatches. Others don't, but if we
> > forgot to substitute such variables we now have a bogus string that
> > will likely cause our tests to fail, if they have any meaning in the
> > first place.
>
> Regarding the above...
>
> > + @sed \
> > + -e "s|@SHELL_PATH@|\'$(SHELL_PATH_SQ)\'|" \
> > + -e "s|@TEST_SHELL_PATH@|\'$(TEST_SHELL_PATH_SQ)\'|" \
> > + [...]
> > + GIT-BUILD-OPTIONS.in >$@+
> > @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
> > @if test -f GIT-BUILD-DIR; then rm GIT-BUILD-DIR; fi
>
> ... can't we `grep` whether any unsubstituted variables remain in $@+
> and complain if they do?
You mean with the new `GIT-BUILD-OPTIONS.in` template? Yes, we can.
Meson generates such warnings automatically, but that of course does not
help our Makefile.
I'll add that.
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v3 00/15] Modernize the build system
2024-10-23 12:04 ` Patrick Steinhardt
@ 2024-10-23 14:38 ` Ramsay Jones
2024-10-23 15:58 ` Eli Schwartz
2024-10-24 7:19 ` Patrick Steinhardt
0 siblings, 2 replies; 386+ messages in thread
From: Ramsay Jones @ 2024-10-23 14:38 UTC (permalink / raw)
To: Patrick Steinhardt
Cc: Eli Schwartz, git, Eric Sunshine, Phillip Wood, Junio C Hamano
On 23/10/2024 13:04, Patrick Steinhardt wrote:
> On Mon, Oct 21, 2024 at 11:56:42PM +0100, Ramsay Jones wrote:
>> On 20/10/2024 09:51, Eli Schwartz wrote:
>>> On 10/18/24 12:08 PM, Ramsay Jones wrote:
>> [snip]
>> Patrick, how do you run the tests on cygwin?
>
> I didn't have to do anything special here, so this is quite puzzling. In
> a fully-updated Cygwin installation:
>
> $ which meson
> /usr/bin/meson
> $ meson --version
> 1.3.2
> $ python --version
> 3.9.16
> $ mkdir build
> $ meson setup ..
> ... autoconfiguration logs ...
> $ meson test 't000*'
Hmm, I could have sworn that this caused a complete rebuild for me
(even when having just built), hence the '--no-rebuild --print-errorlogs'
parameters to meson test. (Oh, maybe that was just 'meson test' - so
how do you run *all* tests with meson - rather than 'ninja test').
> ninja: Entering directory `/home/Patrick Steinhardt/git/build'
> [582/582] Linking target git-receive-pack.exe
> 1/9 t0005-signals OK 4.17s
> 2/9 t0004-unwritable OK 4.58s
> 3/9 t0002-gitfile OK 6.95s
> 4/9 t0007-git-var OK 8.15s
> 5/9 t0006-date OK 15.42s
> 6/9 t0003-attributes OK 26.84s
> 7/9 t0001-init OK 29.09s
> 8/9 t0008-ignores OK 57.17s
> 9/9 t0000-basic OK 83.82s
>
> Ok: 9
> Expected Fail: 0
> Fail: 0
> Unexpected Pass: 0
> Skipped: 0
> Timeout: 0
>
> Full log written to /home/Patrick Steinhardt/git/build/meson-logs/testlog.txt
>
> This is starting with a fresh repo, I executed `git clean -dfx`
> beforehand.
Hmm, I have far to many 'precious' files to use 'git clean'!
(perhaps I should clone the repo to get a totally clean slate).
>
> Do any of the versions used maybe differ?
Ah, yes, I should have noted the versions:
$ uname -a
CYGWIN_NT-10.0-19045 satellite 3.5.4-1.x86_64 2024-08-25 16:52 UTC x86_64 Cygwin
$
$ which meson ninja python
/usr/bin/meson
/usr/bin/ninja
/usr/bin/python
$
$ meson --version
1.3.2
$
$ ninja --version
1.12.0
$
$ python --version
Python 3.9.18
$
So, a slightly newer python - what versions of ninja and the cygwin
'.dll' are you using? (the latter is more likely to cause an issue).
BTW, I have been doing:
$ meson setup .. -Dprefix=$HOME
so that it matches the default prefix from the Makefile (not that I
have attempted to actually install yet!;) ). Can the default be set
in the meson.build file (with command-line override, of course)?
ATB,
Ramsay Jones
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v3 00/15] Modernize the build system
2024-10-23 14:38 ` Ramsay Jones
@ 2024-10-23 15:58 ` Eli Schwartz
2024-10-24 1:43 ` Ramsay Jones
2024-10-24 7:19 ` Patrick Steinhardt
1 sibling, 1 reply; 386+ messages in thread
From: Eli Schwartz @ 2024-10-23 15:58 UTC (permalink / raw)
To: Ramsay Jones, Patrick Steinhardt
Cc: git, Eric Sunshine, Phillip Wood, Junio C Hamano
[-- Attachment #1.1: Type: text/plain, Size: 1684 bytes --]
On 10/23/24 10:38 AM, Ramsay Jones wrote:
> Hmm, I could have sworn that this caused a complete rebuild for me
> (even when having just built), hence the '--no-rebuild --print-errorlogs'
> parameters to meson test. (Oh, maybe that was just 'meson test' - so
> how do you run *all* tests with meson - rather than 'ninja test').
"meson test" without --no-rebuild will first run "ninja" to verify that
everything has been built, and build it if it hasn't been. When passing
specific test names, it will filter for dependencies of that specific
testcase, and only ensure *those* are up to date. Assuming those
dependencies are accurate, of course. :D
What do you mean by "complete rebuild"? Do you mean all binaries that
were already built and up to date get marked stale and recreated?
> BTW, I have been doing:
>
> $ meson setup .. -Dprefix=$HOME
>
> so that it matches the default prefix from the Makefile (not that I
> have attempted to actually install yet!;) ). Can the default be set
> in the meson.build file (with command-line override, of course)?
project('git', 'c',
meson_version: '>=1.3.0',
# MSVC does not support GNU99, and C99 does not define __STDC_VERSION__
# on MSVC. So we instead fall back to C11 there.
default_options: ['c_std=gnu99,c11'],
You can pass any command-line options in as default_options, including
prefix. Defaulting to $HOME is somewhat unconventional regardless of
whether it's done in a Makefile or a configure.ac or a meson.build or a
CMakeLists.txt, but given the Makefile does indeed do that I suppose
it's not incredibly bizarre to do it in meson.build as well. :)
--
Eli Schwartz
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v3 00/15] Modernize the build system
2024-10-23 12:04 ` Patrick Steinhardt
@ 2024-10-23 20:12 ` Taylor Blau
0 siblings, 0 replies; 386+ messages in thread
From: Taylor Blau @ 2024-10-23 20:12 UTC (permalink / raw)
To: Patrick Steinhardt
Cc: git, Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones
On Wed, Oct 23, 2024 at 02:04:21PM +0200, Patrick Steinhardt wrote:
> On Mon, Oct 21, 2024 at 06:10:10PM -0400, Taylor Blau wrote:
> > On Fri, Oct 18, 2024 at 02:23:47PM +0200, Patrick Steinhardt wrote:
> > > This series is based on 15030f9556 (The second batch, 2024-10-15) and
> > > has the following dependencies:
> > >
> > > - ps/cmake-clar at c6d3e52c91 (cmake: set up proper
> > > dependencies for generated clar headers, 2024-10-15).
> > >
> > > - ps/upgrade-clar at f3501edb0e (Makefile: adjust sed command for
> > > generating "clar-decls.h", 2024-10-14).
> > >
> > > - ps/platform-compat-fixes at 80ebd91b83 (http: fix build error on
> > > FreeBSD, 2024-10-16).
> >
> > While this is still sitting on my review queue, I rebuilt this topic
> > based on the above (extremely helpful) information, but it seems to
> > produce some conflicts when I try to merge it in at the end of 'seen':
>
> Huh, interesting. The first two series had conflicts with each other, so
> I wouldn't be surprised if what you see comes from that. Those two
> topics have been merged into a single topic now.
>
> I'll send an updated version of this series at the end of this week that
> also aims to fix conflicts with 'seen'.
Great, thanks!
Thanks,
Taylor
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v3 00/15] Modernize the build system
2024-10-23 12:04 ` Patrick Steinhardt
@ 2024-10-23 20:15 ` Taylor Blau
2024-10-24 7:20 ` Patrick Steinhardt
0 siblings, 1 reply; 386+ messages in thread
From: Taylor Blau @ 2024-10-23 20:15 UTC (permalink / raw)
To: Patrick Steinhardt
Cc: git, Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones
On Wed, Oct 23, 2024 at 02:04:17PM +0200, Patrick Steinhardt wrote:
> On Fri, Oct 18, 2024 at 05:09:43PM -0400, Taylor Blau wrote:
> > On Fri, Oct 18, 2024 at 02:23:47PM +0200, Patrick Steinhardt wrote:
> > > This series is based on 15030f9556 (The second batch, 2024-10-15) and
> > > has the following dependencies:
> > >
> > > - ps/cmake-clar at c6d3e52c91 (cmake: set up proper
> > > dependencies for generated clar headers, 2024-10-15).
> > >
> > > - ps/upgrade-clar at f3501edb0e (Makefile: adjust sed command for
> > > generating "clar-decls.h", 2024-10-14).
> > >
> > > - ps/platform-compat-fixes at 80ebd91b83 (http: fix build error on
> > > FreeBSD, 2024-10-16).
> > >
> > > These deps are mostly just there to make tests pass on all platforms,
> > > but I wouldn't want folks to go test things and discover breakage that
> > > is not caused by Meson itself :) You can also find this version of the
> > > patch series at [1], branch "pks-meson-v3". @Taylor, I'm fine with
> > > keeping this out of "seen" if you prefer to wait for those dependencies
> > > to land first.
> >
> > Of the three, only the last one is marked as "Will merge to 'next'?" in
> > the next integration round[^1]. All three are in 'seen', so this should
> > apply cleanly on top of those.
> >
> > What is the state of those first two topics? Are they ready to go, or
> > are we expecting a new round for any of them?
>
> These have been merged into a single topic now and should be ready to go
> from my point of view. But they still require reviews.
OK, so: ps/platform-compat-fixes is in 'next', and ps/cmake-clar has
been folded into ps/upgrade-clar. Have all three have been combined into
ps/build?
If so, should this topic be rebuilt on ps/upgrade-clar so that we don't
see the same patches twice, perhaps? Or am I still missing something
here?
Thanks,
Taylor
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v3 00/15] Modernize the build system
2024-10-23 15:58 ` Eli Schwartz
@ 2024-10-24 1:43 ` Ramsay Jones
2024-10-24 7:19 ` Patrick Steinhardt
0 siblings, 1 reply; 386+ messages in thread
From: Ramsay Jones @ 2024-10-24 1:43 UTC (permalink / raw)
To: Eli Schwartz, Patrick Steinhardt
Cc: git, Eric Sunshine, Phillip Wood, Junio C Hamano
On 23/10/2024 16:58, Eli Schwartz wrote:
> On 10/23/24 10:38 AM, Ramsay Jones wrote:
>> Hmm, I could have sworn that this caused a complete rebuild for me
>> (even when having just built), hence the '--no-rebuild --print-errorlogs'
>> parameters to meson test. (Oh, maybe that was just 'meson test' - so
>> how do you run *all* tests with meson - rather than 'ninja test').
>
>
> "meson test" without --no-rebuild will first run "ninja" to verify that
> everything has been built, and build it if it hasn't been. When passing
> specific test names, it will filter for dependencies of that specific
> testcase, and only ensure *those* are up to date. Assuming those
> dependencies are accurate, of course. :D
Heh, yes, I just tried it tonight, and it did just as you describe:
$ meson test
ninja: Entering directory `/home/ramsay/new-git/build'
ninja: no work to do.
$
> What do you mean by "complete rebuild"? Do you mean all binaries that
> were already built and up to date get marked stale and recreated?
My bad, I was a little loose in my language. Whatever it was that I typed
(and I obviously can't remember what it was!), resulted in meson going
through the configuration step again followed by compilation/linking of
all binaries (or at least, that's what it looked like).
>> BTW, I have been doing:
>>
>> $ meson setup .. -Dprefix=$HOME
>>
>> so that it matches the default prefix from the Makefile (not that I
>> have attempted to actually install yet!;) ). Can the default be set
>> in the meson.build file (with command-line override, of course)?
>
>
> project('git', 'c',
> meson_version: '>=1.3.0',
> # MSVC does not support GNU99, and C99 does not define __STDC_VERSION__
> # on MSVC. So we instead fall back to C11 there.
> default_options: ['c_std=gnu99,c11'],
Ah yes, this seems to work:
$ git diff
diff --git a/meson.build b/meson.build
index 7c7a59d7fb..23b6f0baa2 100644
--- a/meson.build
+++ b/meson.build
@@ -2,7 +2,7 @@ project('git', 'c',
meson_version: '>=1.3.0',
# MSVC does not support GNU99, and C99 does not define __STDC_VERSION__
# on MSVC. So we instead fall back to C11 there.
- default_options: ['c_std=gnu99,c11'],
+ default_options: ['c_std=gnu99,c11', 'prefix=$HOME'],
version: 'v2.47.GIT',
)
$
$ meson setup .. --reconfigure
...
User defined options
prefix: /home/ramsay
Found ninja-1.12.0 at /usr/bin/ninja
Cleaning... 0 files.
$
Using the command-line to override also works:
$ meson setup .. --reconfigure -Dprefix=/usr/local
...
User defined options
prefix: /usr/local
Found ninja-1.12.0 at /usr/bin/ninja
Cleaning... 0 files.
$
> You can pass any command-line options in as default_options, including
> prefix. Defaulting to $HOME is somewhat unconventional regardless of
> whether it's done in a Makefile or a configure.ac or a meson.build or a
> CMakeLists.txt, but given the Makefile does indeed do that I suppose
> it's not incredibly bizarre to do it in meson.build as well. :)
I don't have any strong feelings either way, it's just that people are
used to doing a 'make install' and having the git build installed in
their home directory (including me). But it is not a huge effort to
add the '-Dprefix=$HOME', it simply needs to be documented.
I think I need to go away and RTFM at this point and not annoy you (and
others) with such noob questions! :)
[For me ATM, meson works fine on Linux, but it simply doesn't work at all
on cygwin as far as the tests are concerned (and I haven't tried installing
yet). Patrick is not seeing any problems, so I would like to understand
why we have such different results.]
Thanks!
ATB,
Ramsay Jones
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v3 00/15] Modernize the build system
2024-10-24 1:43 ` Ramsay Jones
@ 2024-10-24 7:19 ` Patrick Steinhardt
0 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-24 7:19 UTC (permalink / raw)
To: Ramsay Jones
Cc: Eli Schwartz, git, Eric Sunshine, Phillip Wood, Junio C Hamano
On Thu, Oct 24, 2024 at 02:43:40AM +0100, Ramsay Jones wrote:
> > You can pass any command-line options in as default_options, including
> > prefix. Defaulting to $HOME is somewhat unconventional regardless of
> > whether it's done in a Makefile or a configure.ac or a meson.build or a
> > CMakeLists.txt, but given the Makefile does indeed do that I suppose
> > it's not incredibly bizarre to do it in meson.build as well. :)
>
> I don't have any strong feelings either way, it's just that people are
> used to doing a 'make install' and having the git build installed in
> their home directory (including me). But it is not a huge effort to
> add the '-Dprefix=$HOME', it simply needs to be documented.
For now I'll leave it as-is, but if people feel strongly about it I
don't mind changing the default value.
> I think I need to go away and RTFM at this point and not annoy you (and
> others) with such noob questions! :)
I find your input to be highly valuable, so thanks for testing things!
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v3 00/15] Modernize the build system
2024-10-23 14:38 ` Ramsay Jones
2024-10-23 15:58 ` Eli Schwartz
@ 2024-10-24 7:19 ` Patrick Steinhardt
2024-10-24 17:34 ` Ramsay Jones
1 sibling, 1 reply; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-24 7:19 UTC (permalink / raw)
To: Ramsay Jones
Cc: Eli Schwartz, git, Eric Sunshine, Phillip Wood, Junio C Hamano
On Wed, Oct 23, 2024 at 03:38:18PM +0100, Ramsay Jones wrote:
> > Do any of the versions used maybe differ?
>
> Ah, yes, I should have noted the versions:
>
> $ uname -a
> CYGWIN_NT-10.0-19045 satellite 3.5.4-1.x86_64 2024-08-25 16:52 UTC x86_64 Cygwin
I'm on basically the same system:
CYGWIN_NT-10.0-19045 DESKTOP-OLQRBOP 3.5.4-1.x86_64 2024-08-25 16:52 UTC x86_64 Cygwin
Which makes this even weirder.
> $
>
> $ which meson ninja python
> /usr/bin/meson
> /usr/bin/ninja
> /usr/bin/python
> $
>
> $ meson --version
> 1.3.2
> $
>
> $ ninja --version
> 1.12.0
> $
>
> $ python --version
> Python 3.9.18
> $
Let me try to update Cygwin to the latest versions... huh. Why is your
Python version newer than mine? I cannot seem to find this version of
Python in any of the mirrors.
Oh, wait! I can see that there's a "python3" 3.9.18 available as a
testing version. I don't quite understand how this works though, because
when I install it I still have Python 3.9.16. Seems like there are two
Python packages: "python3", which has the 3.9.18 test version, and then
there's "python39", which only has 3.9.16. The first one just seems to
be a meta package, so it doesn't contain anything.
So... where did you get Python 3.9.18 from? You mentioned that it also
hogs all CPU, so could it be that this is basically a broken Python
installation?
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v3 00/15] Modernize the build system
2024-10-23 20:15 ` Taylor Blau
@ 2024-10-24 7:20 ` Patrick Steinhardt
0 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-24 7:20 UTC (permalink / raw)
To: Taylor Blau
Cc: git, Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones
On Wed, Oct 23, 2024 at 04:15:12PM -0400, Taylor Blau wrote:
> On Wed, Oct 23, 2024 at 02:04:17PM +0200, Patrick Steinhardt wrote:
> > On Fri, Oct 18, 2024 at 05:09:43PM -0400, Taylor Blau wrote:
> > > On Fri, Oct 18, 2024 at 02:23:47PM +0200, Patrick Steinhardt wrote:
> > > > This series is based on 15030f9556 (The second batch, 2024-10-15) and
> > > > has the following dependencies:
> > > >
> > > > - ps/cmake-clar at c6d3e52c91 (cmake: set up proper
> > > > dependencies for generated clar headers, 2024-10-15).
> > > >
> > > > - ps/upgrade-clar at f3501edb0e (Makefile: adjust sed command for
> > > > generating "clar-decls.h", 2024-10-14).
> > > >
> > > > - ps/platform-compat-fixes at 80ebd91b83 (http: fix build error on
> > > > FreeBSD, 2024-10-16).
> > > >
> > > > These deps are mostly just there to make tests pass on all platforms,
> > > > but I wouldn't want folks to go test things and discover breakage that
> > > > is not caused by Meson itself :) You can also find this version of the
> > > > patch series at [1], branch "pks-meson-v3". @Taylor, I'm fine with
> > > > keeping this out of "seen" if you prefer to wait for those dependencies
> > > > to land first.
> > >
> > > Of the three, only the last one is marked as "Will merge to 'next'?" in
> > > the next integration round[^1]. All three are in 'seen', so this should
> > > apply cleanly on top of those.
> > >
> > > What is the state of those first two topics? Are they ready to go, or
> > > are we expecting a new round for any of them?
> >
> > These have been merged into a single topic now and should be ready to go
> > from my point of view. But they still require reviews.
>
> OK, so: ps/platform-compat-fixes is in 'next', and ps/cmake-clar has
> been folded into ps/upgrade-clar. Have all three have been combined into
> ps/build?
>
> If so, should this topic be rebuilt on ps/upgrade-clar so that we don't
> see the same patches twice, perhaps? Or am I still missing something
> here?
No, you don't miss anything here, rebuilding this on top of
ps/upgrade-clar plus ps/platform-compat-fixes is exactly the right thing
to do.
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* [RFC PATCH v4 00/19] Modernize the build system
2024-10-02 15:15 [RFC PATCH 00/21] Modernize the build system Patrick Steinhardt
` (23 preceding siblings ...)
2024-10-18 12:23 ` [RFC PATCH v3 00/15] Modernize the " Patrick Steinhardt
@ 2024-10-24 12:39 ` Patrick Steinhardt
2024-10-24 12:39 ` [RFC PATCH v4 01/19] Makefile: use common template for GIT-BUILD-OPTIONS Patrick Steinhardt
` (21 more replies)
2024-11-11 15:30 ` [RFC PATCH v5 " Patrick Steinhardt
` (6 subsequent siblings)
31 siblings, 22 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-24 12:39 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau
Hi,
this is the fourth version of my patch series that modernizes our build
system. It refactors various parts of it to make it possible to perform
out-of-tree builds in theory and then wires up Meson.
Changes compared to v3:
- Various typo fixes.
- Our Makefile now detects unsubstituted build options in the newly-
introduced "GIT-BUILD-OPTIONS.in" template.
- I've wired up support for building and installing manpages. This was
the last important bit missing to get a fully functioning Git
installation. We generate the same set of manpages that our Makefile
would and also render a subset of the HTML pages we generate. Not
wired up are our technical docs, but doing those shouldn't be all
that involved.
Documentation is not built by default, but can be enabled by passing
any combination of `-Ddocs=html,man`.
- I've dropped the target names for `custom_target()` invocations.
Those are auto-derived from the first output anyway, so they only
add unnecessary noise.
- The last patch is a compatibility patch for "seen". There are a
couple of topics that interact with this series, and I didn't want
to make all of them a strict dependency. So I've decided to just
create a fixup-style commit that does the necessary changes in order
to work with "seen". Like this, you can test without "seen" by
simply dropping that last commit, and you can test with "seen" by
merging it into this topic.
@Taylor: I didn't really have a better idea than this. There are
six additional topics that this branch interacts with, and building
the branch with eight dependencies in total didn't feel sensible.
Ideally, the topic branch itself shouldn't have the last commit, but
once it gets merged into 'seen' we should have it. Let me know in
case you have a better idea though.
This topic is built on top of fd3785337b (The third batch, 2024-10-22)
with the following two branches merged into it:
- ps/upgrade-clar at 30bf9f0aaa (cmake: set up proper dependencies for
generated clar headers, 2024-10-21). This is currently in 'seen'.
- ps/platform-compat-fixes at 80ebd91b83 (http: fix build error on
FreeBSD, 2024-10-16). This has been merged to 'next'.
I was pondering a bit whether I should split this topic up even further.
I've already evicted other parts out of it such that they can land
separately, and landing the Makefile refactorings independently would
reduce the overall review load. These steps also make sense even if we
don't have Meson, as those are all either simplifications, improvements
for CMake or a necessary step towards out-of-tree builds. Let me know
your thoughts!
Thanks!
Patrick
Patrick Steinhardt (19):
Makefile: use common template for GIT-BUILD-OPTIONS
Makefile: consistently use @PLACEHOLDER@ to substitute
Makefile: consistently use PERL_PATH
Makefile: extract script to massage Perl scripts
Makefile: use "generate-perl.sh" to massage Perl library
Makefile: extract script to massage Shell scripts
Makefile: extract script to generate gitweb.cgi
Makefile: refactor GIT-VERSION-GEN to be reusable
Makefile: refactor generators to be PWD-independent
Makefile: allow "bin-wrappers/" directory to exist
Makefile: simplify building of templates
Documentation: allow sourcing generated includes from separate dir
Documentation: teach "cmd-list.perl" about out-of-tree builds
Documentation: extract script to generate a list of mergetools
t: better support for out-of-tree builds
t: allow overriding build dir
Documentation: add comparison of build systems
Introduce support for the Meson build system
meson: fix conflicts with in-flight topics
.gitignore | 1 -
Documentation/CodingGuidelines | 2 +-
Documentation/Makefile | 28 +-
Documentation/build-docdep.perl | 2 +
Documentation/cmd-list.perl | 23 +-
Documentation/config/diff.txt | 2 +-
Documentation/config/merge.txt | 2 +-
Documentation/generate-mergetool-list.sh | 17 +
Documentation/git.txt | 24 +-
Documentation/meson.build | 317 ++++
Documentation/technical/build-systems.txt | 224 +++
GIT-BUILD-OPTIONS.in | 47 +
GIT-VERSION-GEN | 12 +-
Makefile | 209 +--
bin-wrappers/.gitignore | 9 +
bin-wrappers/meson.build | 28 +
bin-wrappers/wrap-for-bin.sh | 37 +
configure.ac | 2 +-
contrib/buildsystems/CMakeLists.txt | 218 ++-
contrib/completion/meson.build | 8 +
contrib/meson.build | 1 +
generate-cmdlist.sh | 42 +-
generate-configlist.sh | 20 +-
generate-hooklist.sh | 15 +-
generate-perl.sh | 36 +
generate-script.sh | 34 +
git-cvsserver.perl | 2 +-
git-instaweb.sh | 8 +-
git-request-pull.sh | 2 +-
git-send-email.perl | 2 +-
git-sh-i18n.sh | 6 +-
git-sh-setup.sh | 6 +-
git-svn.perl | 2 +-
gitk-git/po/vi.po | 2 +-
gitweb/GITWEB-BUILD-OPTIONS.in | 25 +
gitweb/Makefile | 58 +-
gitweb/generate-gitweb.sh | 45 +
gitweb/gitweb.perl | 44 +-
gitweb/meson.build | 63 +
meson.build | 1618 +++++++++++++++++
meson_options.txt | 73 +
perl/FromCPAN/Mail/meson.build | 7 +
perl/FromCPAN/meson.build | 9 +
perl/Git/I18N.pm | 6 +-
perl/Git/LoadCPAN.pm | 6 +-
perl/Git/LoadCPAN/Mail/meson.build | 7 +
perl/Git/LoadCPAN/meson.build | 9 +
perl/Git/SVN/Memoize/meson.build | 7 +
perl/Git/SVN/meson.build | 20 +
perl/Git/meson.build | 18 +
.../header_templates/fixed_prefix.template.pl | 2 +-
.../runtime_prefix.template.pl | 8 +-
perl/meson.build | 12 +
po/meson.build | 27 +
subprojects/.gitignore | 1 +
subprojects/curl.wrap | 13 +
subprojects/expat.wrap | 13 +
subprojects/openssl.wrap | 15 +
subprojects/pcre2.wrap | 16 +
subprojects/zlib.wrap | 13 +
t/helper/meson.build | 92 +
t/lib-gettext.sh | 4 +-
t/meson.build | 1110 +++++++++++
t/t7609-mergetool--lib.sh | 2 +-
t/test-lib.sh | 22 +-
templates/Makefile | 39 +-
templates/branches-- | 1 -
templates/{this--description => description} | 0
.../applypatch-msg.sample} | 0
.../commit-msg.sample} | 0
.../fsmonitor-watchman.sample} | 0
templates/hooks/meson.build | 24 +
.../post-update.sample} | 0
.../pre-applypatch.sample} | 0
.../pre-commit.sample} | 0
.../pre-merge-commit.sample} | 0
.../pre-push.sample} | 0
.../pre-rebase.sample} | 0
.../pre-receive.sample} | 0
.../prepare-commit-msg.sample} | 0
.../push-to-checkout.sample} | 0
.../sendemail-validate.sample} | 0
.../update.sample} | 0
templates/{info--exclude => info/exclude} | 0
templates/info/meson.build | 5 +
templates/meson.build | 13 +
unimplemented.sh | 2 +-
wrap-for-bin.sh | 36 -
88 files changed, 4428 insertions(+), 447 deletions(-)
create mode 100755 Documentation/generate-mergetool-list.sh
create mode 100644 Documentation/meson.build
create mode 100644 Documentation/technical/build-systems.txt
create mode 100644 GIT-BUILD-OPTIONS.in
create mode 100644 bin-wrappers/.gitignore
create mode 100644 bin-wrappers/meson.build
create mode 100755 bin-wrappers/wrap-for-bin.sh
create mode 100644 contrib/completion/meson.build
create mode 100644 contrib/meson.build
create mode 100755 generate-perl.sh
create mode 100755 generate-script.sh
create mode 100644 gitweb/GITWEB-BUILD-OPTIONS.in
create mode 100755 gitweb/generate-gitweb.sh
create mode 100644 gitweb/meson.build
create mode 100644 meson.build
create mode 100644 meson_options.txt
create mode 100644 perl/FromCPAN/Mail/meson.build
create mode 100644 perl/FromCPAN/meson.build
create mode 100644 perl/Git/LoadCPAN/Mail/meson.build
create mode 100644 perl/Git/LoadCPAN/meson.build
create mode 100644 perl/Git/SVN/Memoize/meson.build
create mode 100644 perl/Git/SVN/meson.build
create mode 100644 perl/Git/meson.build
create mode 100644 perl/meson.build
create mode 100644 po/meson.build
create mode 100644 subprojects/.gitignore
create mode 100644 subprojects/curl.wrap
create mode 100644 subprojects/expat.wrap
create mode 100644 subprojects/openssl.wrap
create mode 100644 subprojects/pcre2.wrap
create mode 100644 subprojects/zlib.wrap
create mode 100644 t/helper/meson.build
create mode 100644 t/meson.build
delete mode 100644 templates/branches--
rename templates/{this--description => description} (100%)
rename templates/{hooks--applypatch-msg.sample => hooks/applypatch-msg.sample} (100%)
rename templates/{hooks--commit-msg.sample => hooks/commit-msg.sample} (100%)
rename templates/{hooks--fsmonitor-watchman.sample => hooks/fsmonitor-watchman.sample} (100%)
create mode 100644 templates/hooks/meson.build
rename templates/{hooks--post-update.sample => hooks/post-update.sample} (100%)
rename templates/{hooks--pre-applypatch.sample => hooks/pre-applypatch.sample} (100%)
rename templates/{hooks--pre-commit.sample => hooks/pre-commit.sample} (100%)
rename templates/{hooks--pre-merge-commit.sample => hooks/pre-merge-commit.sample} (100%)
rename templates/{hooks--pre-push.sample => hooks/pre-push.sample} (100%)
rename templates/{hooks--pre-rebase.sample => hooks/pre-rebase.sample} (100%)
rename templates/{hooks--pre-receive.sample => hooks/pre-receive.sample} (100%)
rename templates/{hooks--prepare-commit-msg.sample => hooks/prepare-commit-msg.sample} (100%)
rename templates/{hooks--push-to-checkout.sample => hooks/push-to-checkout.sample} (100%)
rename templates/{hooks--sendemail-validate.sample => hooks/sendemail-validate.sample} (100%)
rename templates/{hooks--update.sample => hooks/update.sample} (100%)
rename templates/{info--exclude => info/exclude} (100%)
create mode 100644 templates/info/meson.build
create mode 100644 templates/meson.build
delete mode 100644 wrap-for-bin.sh
Range-diff against v3:
1: 800fb080f45 ! 1: 8c481cb9e01 Makefile: use common template for GIT-BUILD-OPTIONS
@@ Makefile: GIT-LDFLAGS: FORCE
+ -e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \
+ -e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX)\'|" \
+ GIT-BUILD-OPTIONS.in >$@+
++ @if grep -q '^[A-Z][A-Z_]*=@.*@$$' $@+; then echo "Unsubstituted build options in $@" >&2 && exit 1; fi
@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
@if test -f GIT-BUILD-DIR; then rm GIT-BUILD-DIR; fi
2: 1a4a23c66ca = 2: 308dcbe0bd4 Makefile: consistently use @PLACEHOLDER@ to substitute
3: 8261f108968 = 3: 20e77ffc5f5 Makefile: consistently use PERL_PATH
4: 4894179b948 = 4: 50b607a412a Makefile: extract script to massage Perl scripts
5: b40bc302291 = 5: eddafe1cf89 Makefile: use "generate-perl.sh" to massage Perl library
6: c13ce99be3a ! 6: 2cf8cf86218 Makefile: extract script to massage Shell scripts
@@ Makefile: GIT-BUILD-OPTIONS: FORCE
+ -e "s|@LOCALEDIR@|\'$(localedir_SQ)\'|" \
+ -e "s|@BROKEN_PATH_FIX@|\'$(BROKEN_PATH_FIX)\'|" \
GIT-BUILD-OPTIONS.in >$@+
+ @if grep -q '^[A-Z][A-Z_]*=@.*@$$' $@+; then echo "Unsubstituted build options in $@" >&2 && exit 1; fi
@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
- @if test -f GIT-BUILD-DIR; then rm GIT-BUILD-DIR; fi
## contrib/buildsystems/CMakeLists.txt ##
@@ contrib/buildsystems/CMakeLists.txt: set(git_shell_scripts
7: ebffd855836 = 7: e8abda661cf Makefile: extract script to generate gitweb.cgi
8: d2cdfad10f5 = 8: 0e682b68e25 Makefile: refactor GIT-VERSION-GEN to be reusable
9: 9be0719ce1b ! 9: 46b7760fbcd Makefile: refactor generators to be PWD-independent
@@ Commit message
We have multiple scripts that generate headers from other data. All of
these scripts have the assumption built-in that they are executed in the
current source directory, which makes them a bit unwieldy to use during
- out-of-tree builds. This makes them a bit unwieldy to use. Refactor them
- to instead take the source directory as well as the output file as
- arguments.
+ out-of-tree builds.
+
+ Refactor them to instead take the source directory as well as the output
+ file as arguments.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
10: 93869e53178 = 10: ec4a9e65ec3 Makefile: allow "bin-wrappers/" directory to exist
11: 1c37d6d1f19 ! 11: b330fd783d4 Makefile: simplify building of templates
@@ Commit message
When we install Git we also install a set of default templates that both
git-init(1) and git-clone(1) populate into our build directories. The
- way the pristine templates are layed out in our source directory is
+ way the pristine templates are laid out in our source directory is
somewhat weird though: instead of reconstructing the actual directory
hierarchy in "templates/", we represent directory separators with "--".
-: ----------- > 12: fb7231ae4c7 Documentation: allow sourcing generated includes from separate dir
-: ----------- > 13: cf1743667e9 Documentation: teach "cmd-list.perl" about out-of-tree builds
-: ----------- > 14: 6926a282a80 Documentation: extract script to generate a list of mergetools
12: c45d2df6b8d = 15: ed3affb794c t: better support for out-of-tree builds
13: 542b01515e1 ! 16: 205b038f961 t: allow overriding build dir
@@ Commit message
using build systems that support out-of-tree builds.
In commit ee9e66e4e7 (cmake: avoid editing t/test-lib.sh, 2022-10-18),
- we have introduce support for overriding the GIT_BIULD_DIR by creating
+ we have introduce support for overriding the GIT_BUILD_DIR by creating
the file "$GIT_BUILD_DIR/GIT-BUILD-DIR" with its contents pointing to
the location of the build directory. The intent was to stop modifying
"t/test-lib.sh" with the CMake build systems while allowing out-of-tree
14: bd59e31bb55 = 17: bef26dd67c5 Documentation: add comparison of build systems
15: ac327d98e9c ! 18: 780180568d9 Introduce support for the Meson build system
@@ Commit message
Introduce support for the Meson build system
Introduce support for the Meson build system, a "modern" meta build
- system that supports many different plaforms, including Linux, macOS,
+ 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.
@@ Commit message
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 is likely to pick
- up Rust as another language eventually.
+ 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:
@@ Commit message
# 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 fordebugging.
+ # Execute single test interactively to allow for debugging.
$ meson test 't0000-*' --interactive --test-args=-ix
```
@@ Commit message
- 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 usecase for
+ 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.
- - Support for installing documentation has not been wired up yet. This
- will follow if the project can agree on Meson as build system.
-
- Documentation does not yet exist. Same here, it will follow if the
project can agree on Meson.
- - We're targeting a Meson 1.3.0, which has been released relatively
+ - 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 3000 lines, half of which
+ - 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
@@ Commit message
Helped-by: Eli Schwartz <eschwartz@gentoo.org>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
+ ## Documentation/meson.build (new) ##
+@@
++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')
++
++git_revdate = ''
++if git.found()
++ git_revdate = run_command(git, 'show', '--quiet', '--pretty=%as', check: false).stdout().strip()
++endif
++
++asciidoc_common_options = [
++ asciidoc,
++ '--conf-file=' + meson.current_source_dir() / 'asciidoc.conf',
++ '--attribute=manual=Git Manual',
++ '--attribute=mansource=Git ' + git_version,
++ '--attribute=revdate=' + git_revdate,
++ '--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 = [ ]
++
++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
+
## bin-wrappers/meson.build (new) ##
@@
+bin_wrappers_config = configuration_data()
@@ gitweb/meson.build (new)
+ configuration: gitweb_config,
+)
+
-+test_dependencies += custom_target(script,
++test_dependencies += custom_target(
+ input: 'gitweb.perl',
+ output: 'gitweb.cgi',
+ command: [
@@ meson.build (new)
+]
+
+libgit_sources += custom_target(
-+ 'command-list.h',
+ input: 'command-list.txt',
+ output: 'command-list.h',
+ command: [shell, meson.current_source_dir() + '/generate-cmdlist.sh', meson.current_source_dir(), '@OUTPUT@'],
@@ meson.build (new)
+)
+
+libgit_sources += custom_target(
-+ 'config-list.h',
+ output: 'config-list.h',
+ command: [
+ shell,
@@ meson.build (new)
+)
+
+libgit_sources += custom_target(
-+ 'hook-list.h',
+ input: 'Documentation/githooks.txt',
+ output: 'hook-list.h',
+ command: [
@@ meson.build (new)
+endif
+
+foreach script : scripts_sh
-+ test_dependencies += custom_target(script,
++ test_dependencies += custom_target(
+ input: script,
+ output: fs.stem(script),
+ command: [
@@ meson.build (new)
+ ]
+
+ foreach script : scripts_perl
-+ generated_script = custom_target(script,
++ generated_script = custom_target(
+ input: script,
+ output: fs.stem(script),
+ command: generate_perl_command,
@@ meson.build (new)
+endif
+
+subdir('bin-wrappers')
++if get_option('docs') != []
++ subdir('Documentation')
++endif
## meson_options.txt (new) ##
@@
-+option('default_help_format', type: 'combo', choices: ['man', 'html', 'info'], value: 'man',
-+ description: 'Format of installed documentation.')
+option('default_pager', type: 'string', value: 'less',
+ description: 'Fall-back pager.')
+option('default_editor', type: 'string', value: 'vi',
@@ meson_options.txt (new)
+option('gitweb_site_footer', type: 'string', value: '')
+option('highlight_bin', type: 'string', value: 'highlight')
+
++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).')
++
+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',
@@ meson_options.txt (new)
## perl/FromCPAN/Mail/meson.build (new) ##
@@
-+test_dependencies += custom_target('Address.pm',
++test_dependencies += custom_target(
+ input: 'Address.pm',
+ output: 'Address.pm',
+ command: generate_perl_command,
@@ perl/FromCPAN/Mail/meson.build (new)
## perl/FromCPAN/meson.build (new) ##
@@
-+test_dependencies += custom_target('Error.pm',
++test_dependencies += custom_target(
+ input: 'Error.pm',
+ output: 'Error.pm',
+ command: generate_perl_command,
@@ perl/FromCPAN/meson.build (new)
## perl/Git/LoadCPAN/Mail/meson.build (new) ##
@@
-+test_dependencies += custom_target('Address.pm',
++test_dependencies += custom_target(
+ input: 'Address.pm',
+ output: 'Address.pm',
+ command: generate_perl_command,
@@ perl/Git/LoadCPAN/Mail/meson.build (new)
## perl/Git/LoadCPAN/meson.build (new) ##
@@
-+test_dependencies += custom_target('Error.pm',
++test_dependencies += custom_target(
+ input: 'Error.pm',
+ output: 'Error.pm',
+ command: generate_perl_command,
@@ perl/Git/LoadCPAN/meson.build (new)
## perl/Git/SVN/Memoize/meson.build (new) ##
@@
-+test_dependencies += custom_target('YAML.pm',
++test_dependencies += custom_target(
+ input: 'YAML.pm',
+ output: 'YAML.pm',
+ command: generate_perl_command,
@@ perl/Git/SVN/meson.build (new)
+ 'Ra.pm',
+ 'Utils.pm',
+]
-+ test_dependencies += custom_target(source,
++ test_dependencies += custom_target(
+ input: source,
+ output: source,
+ command: generate_perl_command,
@@ perl/Git/meson.build (new)
+ 'Packet.pm',
+ 'SVN.pm',
+]
-+ test_dependencies += custom_target(source,
++ test_dependencies += custom_target(
+ input: source,
+ output: source,
+ command: generate_perl_command,
@@ perl/Git/meson.build (new)
## perl/meson.build (new) ##
@@
-+test_dependencies += custom_target('Git.pm',
++test_dependencies += custom_target(
+ input: 'Git.pm',
+ output: 'Git.pm',
+ command: generate_perl_command,
@@ po/meson.build (new)
+ 'zh_TW',
+ ],
+ install: true,
-+ install_dir: get_option('datadir'),
+)
+test_dependencies += translations[0]
@@ t/meson.build (new)
+ 'unit-tests/unit-test.c',
+]
+
-+clar_decls_h = custom_target('clar_decls_h',
++clar_decls_h = custom_target(
+ input: clar_test_suites,
+ output: 'clar-decls.h',
+ command : [shell, meson.current_source_dir() + '/unit-tests/generate-clar-decls.sh', '@OUTPUT@', '@INPUT@'],
@@ t/meson.build (new)
+)
+clar_sources += clar_decls_h
+
-+clar_sources += custom_target('clar_suite',
++clar_sources += custom_target(
+ input: clar_decls_h,
+ output: 'clar.suite',
+ feed: true,
@@ t/meson.build (new)
+ 'unit-tests/t-reftable-block.c',
+ 'unit-tests/t-reftable-merged.c',
+ 'unit-tests/t-reftable-pq.c',
++ 'unit-tests/t-reftable-reader.c',
+ 'unit-tests/t-reftable-readwrite.c',
+ 'unit-tests/t-reftable-record.c',
+ 'unit-tests/t-reftable-stack.c',
@@ t/meson.build (new)
+ 't2405-worktree-submodule.sh',
+ 't2406-worktree-repair.sh',
+ 't2407-worktree-heads.sh',
++ 't2408-worktree-relative.sh',
+ 't2500-untracked-overwriting.sh',
+ 't2501-cwd-empty.sh',
+ 't3000-ls-files-others.sh',
-: ----------- > 19: 45e2ab4044a meson: fix conflicts with in-flight topics
--
2.47.0.118.gfd3785337b.dirty
^ permalink raw reply [flat|nested] 386+ messages in thread
* [RFC PATCH v4 01/19] Makefile: use common template for GIT-BUILD-OPTIONS
2024-10-24 12:39 ` [RFC PATCH v4 00/19] " Patrick Steinhardt
@ 2024-10-24 12:39 ` Patrick Steinhardt
2024-10-24 12:39 ` [RFC PATCH v4 02/19] Makefile: consistently use @PLACEHOLDER@ to substitute Patrick Steinhardt
` (20 subsequent siblings)
21 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-24 12:39 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau
The "GIT-BUILD-OPTIONS" file is generated by our build systems to
propagate built-in features and paths to our tests. The generation is
done ad-hoc, where both our Makefile and the CMake build instructions
simply echo a bunch of strings into the file. This makes it very hard to
figure out what variables are expected to exist and what format they
have, and the written variables can easily get out of sync between build
systems.
Introduce a new "GIT-BUILD-OPTIONS.in" template to address this issue.
This has multiple advantages:
- It demonstrates which built options exist in the first place.
- It can serve as a spot to document the build options.
- Some build systems complain when not all variables could be
substituted, alerting us of mismatches. Others don't, but if we
forgot to substitute such variables we now have a bogus string that
will likely cause our tests to fail, if they have any meaning in the
first place.
Backfill values that we didn't yet set in our CMake build instructions.
While at it, remove the `SUPPORTS_SIMPLE_IPC` variable that we only set
up in CMake as it isn't used anywhere.
Note that this change requires us to move around the setup of
TEST_OUTPUT_DIRECTORY in "test-lib.sh" such that it comes after sourcing
the "GIT-BUILD-OPTIONS" file. This is the only instance I could find
where we rely on ordering on variables.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-BUILD-OPTIONS.in | 36 +++++++++
Makefile | 109 ++++++++++------------------
contrib/buildsystems/CMakeLists.txt | 58 ++++++++++-----
t/test-lib.sh | 13 ++--
4 files changed, 121 insertions(+), 95 deletions(-)
create mode 100644 GIT-BUILD-OPTIONS.in
diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in
new file mode 100644
index 00000000000..f0ca240493c
--- /dev/null
+++ b/GIT-BUILD-OPTIONS.in
@@ -0,0 +1,36 @@
+SHELL_PATH=@SHELL_PATH@
+TEST_SHELL_PATH=@TEST_SHELL_PATH@
+PERL_PATH=@PERL_PATH@
+DIFF=@DIFF@
+PYTHON_PATH=@PYTHON_PATH@
+TAR=@TAR@
+NO_CURL=@NO_CURL@
+NO_ICONV=@NO_ICONV@
+NO_EXPAT=@NO_EXPAT@
+USE_LIBPCRE2=@USE_LIBPCRE2@
+NO_PERL=@NO_PERL@
+NO_PTHREADS=@NO_PTHREADS@
+NO_PYTHON=@NO_PYTHON@
+NO_REGEX=@NO_REGEX@
+NO_UNIX_SOCKETS=@NO_UNIX_SOCKETS@
+PAGER_ENV=@PAGER_ENV@
+SANITIZE_LEAK=@SANITIZE_LEAK@
+SANITIZE_ADDRESS=@SANITIZE_ADDRESS@
+X=@X@
+FSMONITOR_DAEMON_BACKEND=@FSMONITOR_DAEMON_BACKEND@
+FSMONITOR_OS_SETTINGS=@FSMONITOR_OS_SETTINGS@
+TEST_OUTPUT_DIRECTORY=@TEST_OUTPUT_DIRECTORY@
+GIT_TEST_OPTS=@GIT_TEST_OPTS@
+GIT_TEST_CMP=@GIT_TEST_CMP@
+GIT_TEST_CMP_USE_COPIED_CONTEXT=@GIT_TEST_CMP_USE_COPIED_CONTEXT@
+GIT_TEST_UTF8_LOCALE=@GIT_TEST_UTF8_LOCALE@
+NO_GETTEXT=@NO_GETTEXT@
+GIT_PERF_REPEAT_COUNT=@GIT_PERF_REPEAT_COUNT@
+GIT_PERF_REPO=@GIT_PERF_REPO@
+GIT_PERF_LARGE_REPO=@GIT_PERF_LARGE_REPO@
+GIT_PERF_MAKE_OPTS=@GIT_PERF_MAKE_OPTS@
+GIT_PERF_MAKE_COMMAND=@GIT_PERF_MAKE_COMMAND@
+GIT_INTEROP_MAKE_OPTS=@GIT_INTEROP_MAKE_OPTS@
+GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@
+GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@
+RUNTIME_PREFIX=@RUNTIME_PREFIX@
diff --git a/Makefile b/Makefile
index 6ad330fc582..457f36487cb 100644
--- a/Makefile
+++ b/Makefile
@@ -3164,76 +3164,45 @@ GIT-LDFLAGS: FORCE
# that runs GIT-BUILD-OPTIONS, and then again to protect it
# and the first level quoting from the shell that runs "echo".
GIT-BUILD-OPTIONS: FORCE
- @echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@+
- @echo TEST_SHELL_PATH=\''$(subst ','\'',$(TEST_SHELL_PATH_SQ))'\' >>$@+
- @echo PERL_PATH=\''$(subst ','\'',$(PERL_PATH_SQ))'\' >>$@+
- @echo DIFF=\''$(subst ','\'',$(subst ','\'',$(DIFF)))'\' >>$@+
- @echo PYTHON_PATH=\''$(subst ','\'',$(PYTHON_PATH_SQ))'\' >>$@+
- @echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@+
- @echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@+
- @echo NO_ICONV=\''$(subst ','\'',$(subst ','\'',$(NO_ICONV)))'\' >>$@+
- @echo NO_EXPAT=\''$(subst ','\'',$(subst ','\'',$(NO_EXPAT)))'\' >>$@+
- @echo USE_LIBPCRE2=\''$(subst ','\'',$(subst ','\'',$(USE_LIBPCRE2)))'\' >>$@+
- @echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@+
- @echo NO_PTHREADS=\''$(subst ','\'',$(subst ','\'',$(NO_PTHREADS)))'\' >>$@+
- @echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@+
- @echo NO_REGEX=\''$(subst ','\'',$(subst ','\'',$(NO_REGEX)))'\' >>$@+
- @echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@+
- @echo PAGER_ENV=\''$(subst ','\'',$(subst ','\'',$(PAGER_ENV)))'\' >>$@+
- @echo SANITIZE_LEAK=\''$(subst ','\'',$(subst ','\'',$(SANITIZE_LEAK)))'\' >>$@+
- @echo SANITIZE_ADDRESS=\''$(subst ','\'',$(subst ','\'',$(SANITIZE_ADDRESS)))'\' >>$@+
- @echo X=\'$(X)\' >>$@+
-ifdef FSMONITOR_DAEMON_BACKEND
- @echo FSMONITOR_DAEMON_BACKEND=\''$(subst ','\'',$(subst ','\'',$(FSMONITOR_DAEMON_BACKEND)))'\' >>$@+
-endif
-ifdef FSMONITOR_OS_SETTINGS
- @echo FSMONITOR_OS_SETTINGS=\''$(subst ','\'',$(subst ','\'',$(FSMONITOR_OS_SETTINGS)))'\' >>$@+
-endif
-ifdef TEST_OUTPUT_DIRECTORY
- @echo TEST_OUTPUT_DIRECTORY=\''$(subst ','\'',$(subst ','\'',$(TEST_OUTPUT_DIRECTORY)))'\' >>$@+
-endif
-ifdef GIT_TEST_OPTS
- @echo GIT_TEST_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_OPTS)))'\' >>$@+
-endif
-ifdef GIT_TEST_CMP
- @echo GIT_TEST_CMP=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_CMP)))'\' >>$@+
-endif
-ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
- @echo GIT_TEST_CMP_USE_COPIED_CONTEXT=YesPlease >>$@+
-endif
-ifdef GIT_TEST_UTF8_LOCALE
- @echo GIT_TEST_UTF8_LOCALE=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_UTF8_LOCALE)))'\' >>$@+
-endif
- @echo NO_GETTEXT=\''$(subst ','\'',$(subst ','\'',$(NO_GETTEXT)))'\' >>$@+
-ifdef GIT_PERF_REPEAT_COUNT
- @echo GIT_PERF_REPEAT_COUNT=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPEAT_COUNT)))'\' >>$@+
-endif
-ifdef GIT_PERF_REPO
- @echo GIT_PERF_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPO)))'\' >>$@+
-endif
-ifdef GIT_PERF_LARGE_REPO
- @echo GIT_PERF_LARGE_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_LARGE_REPO)))'\' >>$@+
-endif
-ifdef GIT_PERF_MAKE_OPTS
- @echo GIT_PERF_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_OPTS)))'\' >>$@+
-endif
-ifdef GIT_PERF_MAKE_COMMAND
- @echo GIT_PERF_MAKE_COMMAND=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_COMMAND)))'\' >>$@+
-endif
-ifdef GIT_INTEROP_MAKE_OPTS
- @echo GIT_INTEROP_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_INTEROP_MAKE_OPTS)))'\' >>$@+
-endif
-ifdef GIT_TEST_INDEX_VERSION
- @echo GIT_TEST_INDEX_VERSION=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_INDEX_VERSION)))'\' >>$@+
-endif
-ifdef GIT_TEST_PERL_FATAL_WARNINGS
- @echo GIT_TEST_PERL_FATAL_WARNINGS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_PERL_FATAL_WARNINGS)))'\' >>$@+
-endif
-ifdef RUNTIME_PREFIX
- @echo RUNTIME_PREFIX=\'true\' >>$@+
-else
- @echo RUNTIME_PREFIX=\'false\' >>$@+
-endif
+ @sed \
+ -e "s|@SHELL_PATH@|\'$(SHELL_PATH_SQ)\'|" \
+ -e "s|@TEST_SHELL_PATH@|\'$(TEST_SHELL_PATH_SQ)\'|" \
+ -e "s|@PERL_PATH@|\'$(PERL_PATH_SQ)\'|" \
+ -e "s|@DIFF@|\'$(DIFF)\'|" \
+ -e "s|@PYTHON_PATH@|\'$(PYTHON_PATH_SQ)\'|" \
+ -e "s|@TAR@|\'$(TAR)\'|" \
+ -e "s|@NO_CURL@|\'$(NO_CURL)\'|" \
+ -e "s|@NO_ICONV@|\'$(NO_ICONV)\'|" \
+ -e "s|@NO_EXPAT@|\'$(NO_EXPAT)\'|" \
+ -e "s|@USE_LIBPCRE2@|\'$(USE_LIBPCRE2)\'|" \
+ -e "s|@NO_PERL@|\'$(NO_PERL)\'|" \
+ -e "s|@NO_PTHREADS@|\'$(NO_PTHREADS)\'|" \
+ -e "s|@NO_PYTHON@|\'$(NO_PYTHON)\'|" \
+ -e "s|@NO_REGEX@|\'$(NO_REGEX)\'|" \
+ -e "s|@NO_UNIX_SOCKETS@|\'$(NO_UNIX_SOCKETS)\'|" \
+ -e "s|@PAGER_ENV@|\'$(PAGER_ENV)\'|" \
+ -e "s|@SANITIZE_LEAK@|\'$(SANITIZE_LEAK)\'|" \
+ -e "s|@SANITIZE_ADDRESS@|\'$(SANITIZE_ADDRESS)\'|" \
+ -e "s|@X@|\'$(X)\'|" \
+ -e "s|@FSMONITOR_DAEMON_BACKEND@|\'$(FSMONITOR_DAEMON_BACKEND)\'|" \
+ -e "s|@FSMONITOR_OS_SETTINGS@|\'$(FSMONITOR_OS_SETTINGS)\'|" \
+ -e "s|@TEST_OUTPUT_DIRECTORY@|\'$(TEST_OUTPUT_DIRECTORY)\'|" \
+ -e "s|@GIT_TEST_OPTS@|\'$(GIT_TEST_OPTS)\'|" \
+ -e "s|@GIT_TEST_CMP@|\'$(GIT_TEST_CMP)\'|" \
+ -e "s|@GIT_TEST_CMP_USE_COPIED_CONTEXT@|\'$(GIT_TEST_CMP_USE_COPIED_CONTEXT)\'|" \
+ -e "s|@GIT_TEST_UTF8_LOCALE@|\'$(GIT_TEST_UTF8_LOCALE)\'|" \
+ -e "s|@NO_GETTEXT@|\'$(NO_GETTEXT)\'|" \
+ -e "s|@GIT_PERF_REPEAT_COUNT@|\'$(GIT_PERF_REPEAT_COUNT)\'|" \
+ -e "s|@GIT_PERF_REPO@|\'$(GIT_PERF_REPO)\'|" \
+ -e "s|@GIT_PERF_LARGE_REPO@|\'$(GIT_PERF_LARGE_REPO)\'|" \
+ -e "s|@GIT_PERF_MAKE_OPTS@|\'$(GIT_PERF_MAKE_OPTS)\'|" \
+ -e "s|@GIT_PERF_MAKE_COMMAND@|\'$(GIT_PERF_MAKE_COMMAND)\'|" \
+ -e "s|@GIT_INTEROP_MAKE_OPTS@|\'$(GIT_INTEROP_MAKE_OPTS)\'|" \
+ -e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \
+ -e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \
+ -e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX)\'|" \
+ GIT-BUILD-OPTIONS.in >$@+
+ @if grep -q '^[A-Z][A-Z_]*=@.*@$$' $@+; then echo "Unsubstituted build options in $@" >&2 && exit 1; fi
@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
@if test -f GIT-BUILD-DIR; then rm GIT-BUILD-DIR; fi
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 8974bb9fa20..680e5b3c8b0 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -1117,27 +1117,47 @@ if(NOT PYTHON_TESTS)
set(NO_PYTHON 1)
endif()
-file(WRITE ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "SHELL_PATH='${SHELL_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "TEST_SHELL_PATH='${TEST_SHELL_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PERL_PATH='${PERL_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "DIFF='${DIFF}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PYTHON_PATH='${PYTHON_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "TAR='${TAR}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_CURL='${NO_CURL}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_ICONV='${NO_ICONV}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_EXPAT='${NO_EXPAT}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PERL='${NO_PERL}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PTHREADS='${NO_PTHREADS}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_UNIX_SOCKETS='${NO_UNIX_SOCKETS}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PAGER_ENV='${PAGER_ENV}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "X='${EXE_EXTENSION}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_GETTEXT='${NO_GETTEXT}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "RUNTIME_PREFIX='${RUNTIME_PREFIX}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PYTHON='${NO_PYTHON}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "SUPPORTS_SIMPLE_IPC='${SUPPORTS_SIMPLE_IPC}'\n")
+file(STRINGS ${CMAKE_SOURCE_DIR}/GIT-BUILD-OPTIONS.in git_build_options NEWLINE_CONSUME)
+string(REPLACE "@SHELL_PATH@" "${SHELL_PATH}" git_build_options "${git_build_options}")
+string(REPLACE "@TEST_SHELL_PATH@" "${TEST_SHELL_PATH}" git_build_options "${git_build_options}")
+string(REPLACE "@PERL_PATH@" "${PERL_PATH}" git_build_options "${git_build_options}")
+string(REPLACE "@DIFF@" "${DIFF}" git_build_options "${git_build_options}")
+string(REPLACE "@PYTHON_PATH@" "${PYTHON_PATH}" git_build_options "${git_build_options}")
+string(REPLACE "@TAR@" "${TAR}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_CURL@" "${NO_CURL}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_ICONV@" "${NO_ICONV}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_EXPAT@" "${NO_EXPAT}" git_build_options "${git_build_options}")
+string(REPLACE "@USE_LIBPCRE2@" "" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PERL@" "${NO_PERL}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PTHREADS@" "${NO_PTHREADS}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PYTHON@" "${NO_PYTHON}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_REGEX@" "" git_build_options "${git_build_options}")
+string(REPLACE "@NO_UNIX_SOCKETS@" "${NO_UNIX_SOCKETS}" git_build_options "${git_build_options}")
+string(REPLACE "@PAGER_ENV@" "${PAGER_ENV}" git_build_options "${git_build_options}")
+string(REPLACE "@SANITIZE_LEAK@" "" git_build_options "${git_build_options}")
+string(REPLACE "@SANITIZE_ADDRESS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@X@" "${EXE_EXTENSION}" git_build_options "${git_build_options}")
+string(REPLACE "@FSMONITOR_DAEMON_BACKEND@" "win32" git_build_options "${git_build_options}")
+string(REPLACE "@FSMONITOR_OS_SETTINGS@" "win32" git_build_options "${git_build_options}")
+string(REPLACE "@TEST_OUTPUT_DIRECTORY@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_OPTS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_CMP@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_CMP_USE_COPIED_CONTEXT@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_UTF8_LOCALE@" "" git_build_options "${git_build_options}")
+string(REPLACE "@NO_GETTEXT@" "${NO_GETTEXT}" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_REPEAT_COUNT@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_REPO@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_LARGE_REPO@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_MAKE_OPTS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_MAKE_COMMAND@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@RUNTIME_PREFIX@" "${RUNTIME_PREFIX}" git_build_options "${git_build_options}")
if(USE_VCPKG)
- file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
+ string(APPEND git_build_options "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
endif()
+file(WRITE ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS ${git_build_options})
#Make the tests work when building out of the source tree
get_filename_component(CACHE_PATH ${CMAKE_CURRENT_LIST_DIR}/../../CMakeCache.txt ABSOLUTE)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index a278181a056..4dd641baefe 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -35,12 +35,6 @@ else
# needing to exist.
TEST_DIRECTORY=$(cd "$TEST_DIRECTORY" && pwd) || exit 1
fi
-if test -z "$TEST_OUTPUT_DIRECTORY"
-then
- # Similarly, override this to store the test-results subdir
- # elsewhere
- TEST_OUTPUT_DIRECTORY=$TEST_DIRECTORY
-fi
GIT_BUILD_DIR="${TEST_DIRECTORY%/t}"
if test "$TEST_DIRECTORY" = "$GIT_BUILD_DIR"
then
@@ -100,6 +94,13 @@ fi
. "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
export PERL_PATH SHELL_PATH
+if test -z "$TEST_OUTPUT_DIRECTORY"
+then
+ # Similarly, override this to store the test-results subdir
+ # elsewhere
+ TEST_OUTPUT_DIRECTORY=$TEST_DIRECTORY
+fi
+
# In t0000, we need to override test directories of nested testcases. In case
# the developer has TEST_OUTPUT_DIRECTORY part of his build options, then we'd
# reset this value to instead contain what the developer has specified. We thus
--
2.47.0.118.gfd3785337b.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v4 02/19] Makefile: consistently use @PLACEHOLDER@ to substitute
2024-10-24 12:39 ` [RFC PATCH v4 00/19] " Patrick Steinhardt
2024-10-24 12:39 ` [RFC PATCH v4 01/19] Makefile: use common template for GIT-BUILD-OPTIONS Patrick Steinhardt
@ 2024-10-24 12:39 ` Patrick Steinhardt
2024-10-24 12:39 ` [RFC PATCH v4 03/19] Makefile: consistently use PERL_PATH Patrick Steinhardt
` (19 subsequent siblings)
21 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-24 12:39 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau
We have a bunch of placeholders in our scripts that we replace at build
time, for example by using sed(1). These placeholders come in three
different formats: @PLACEHOLDER@, @@PLACEHOLDER@@ and ++PLACEHOLDER++.
Next to being inconsistent it also creates a bit of a problem with
CMake, which only supports the first syntax in its `configure_file()`
function. To work around that we instead manually replace placeholders
via string operations, which is a hassle and removes safeguards that
CMake has to verify that we didn't forget to replace any placeholders.
Besides that, other build systems like Meson also support the CMake
syntax.
Unify our codebase to consistently use the syntax supported by such
build systems.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 44 +++++++++----------
configure.ac | 2 +-
contrib/buildsystems/CMakeLists.txt | 34 +++++++-------
git-cvsserver.perl | 2 +-
git-instaweb.sh | 8 ++--
git-request-pull.sh | 2 +-
git-send-email.perl | 2 +-
git-sh-i18n.sh | 6 +--
git-sh-setup.sh | 6 +--
git-svn.perl | 2 +-
gitk-git/po/vi.po | 2 +-
gitweb/Makefile | 44 +++++++++----------
gitweb/gitweb.perl | 44 +++++++++----------
perl/Git/I18N.pm | 6 +--
perl/Git/LoadCPAN.pm | 6 +--
| 2 +-
.../runtime_prefix.template.pl | 8 ++--
unimplemented.sh | 2 +-
wrap-for-bin.sh | 18 ++++----
19 files changed, 120 insertions(+), 120 deletions(-)
diff --git a/Makefile b/Makefile
index 457f36487cb..8a2b292e3d2 100644
--- a/Makefile
+++ b/Makefile
@@ -1555,10 +1555,10 @@ endif
ifdef SANE_TOOL_PATH
SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH))
-BROKEN_PATH_FIX = 's|^\# @@BROKEN_PATH_FIX@@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|'
+BROKEN_PATH_FIX = 's|^\# @BROKEN_PATH_FIX@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|'
PATH := $(SANE_TOOL_PATH):${PATH}
else
-BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d'
+BROKEN_PATH_FIX = '/^\# @BROKEN_PATH_FIX@$$/d'
endif
ifeq (,$(HOST_CPU))
@@ -2548,13 +2548,13 @@ GIT-SCRIPT-DEFINES: FORCE
define cmd_munge_script
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
- -e 's|@@DIFF@@|$(DIFF_SQ)|' \
- -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' \
- -e 's/@@USE_GETTEXT_SCHEME@@/$(USE_GETTEXT_SCHEME)/g' \
+ -e 's|@DIFF@|$(DIFF_SQ)|' \
+ -e 's|@LOCALEDIR@|$(localedir_SQ)|g' \
+ -e 's/@USE_GETTEXT_SCHEME@/$(USE_GETTEXT_SCHEME)/g' \
-e $(BROKEN_PATH_FIX) \
- -e 's|@@GITWEBDIR@@|$(gitwebdir_SQ)|g' \
- -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
- -e 's|@@PAGER_ENV@@|$(PAGER_ENV_SQ)|g' \
+ -e 's|@GITWEBDIR@|$(gitwebdir_SQ)|g' \
+ -e 's|@PERL@|$(PERL_PATH_SQ)|g' \
+ -e 's|@PAGER_ENV@|$(PAGER_ENV_SQ)|g' \
$@.sh >$@+
endef
@@ -2611,7 +2611,7 @@ $(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
-e ' r GIT-PERL-HEADER' \
-e ' G' \
-e '}' \
- -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
+ -e 's/@GIT_VERSION@/$(GIT_VERSION)/g' \
$< >$@+ && \
chmod +x $@+ && \
mv $@+ $@
@@ -2629,11 +2629,11 @@ GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile
INSTLIBDIR='$(perllibdir_SQ)' && \
INSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \
INSTLIBDIR="$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}" && \
- sed -e 's=@@PATHSEP@@=$(pathsep)=g' \
- -e "s=@@INSTLIBDIR@@=$$INSTLIBDIR=g" \
- -e 's=@@PERLLIBDIR_REL@@=$(perllibdir_relative_SQ)=g' \
- -e 's=@@GITEXECDIR_REL@@=$(gitexecdir_relative_SQ)=g' \
- -e 's=@@LOCALEDIR_REL@@=$(localedir_relative_SQ)=g' \
+ sed -e 's=@PATHSEP@=$(pathsep)=g' \
+ -e "s=@INSTLIBDIR@=$$INSTLIBDIR=g" \
+ -e 's=@PERLLIBDIR_REL@=$(perllibdir_relative_SQ)=g' \
+ -e 's=@GITEXECDIR_REL@=$(gitexecdir_relative_SQ)=g' \
+ -e 's=@LOCALEDIR_REL@=$(localedir_relative_SQ)=g' \
$< >$@+ && \
mv $@+ $@
@@ -2649,7 +2649,7 @@ else # NO_PERL
$(SCRIPT_PERL_GEN) git-instaweb: % : unimplemented.sh
$(QUIET_GEN) \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@@REASON@@|NO_PERL=$(NO_PERL)|g' \
+ -e 's|@REASON@|NO_PERL=$(NO_PERL)|g' \
unimplemented.sh >$@+ && \
chmod +x $@+ && \
mv $@+ $@
@@ -2670,13 +2670,13 @@ else # NO_PYTHON
$(SCRIPT_PYTHON_GEN): % : unimplemented.sh
$(QUIET_GEN) \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@@REASON@@|NO_PYTHON=$(NO_PYTHON)|g' \
+ -e 's|@REASON@|NO_PYTHON=$(NO_PYTHON)|g' \
unimplemented.sh >$@+ && \
chmod +x $@+ && \
mv $@+ $@
endif # NO_PYTHON
-CONFIGURE_RECIPE = sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
+CONFIGURE_RECIPE = sed -e 's/@GIT_VERSION@/$(GIT_VERSION)/g' \
configure.ac >configure.ac+ && \
autoconf -o configure configure.ac+ && \
$(RM) configure.ac+
@@ -3104,9 +3104,9 @@ endif
perl/build/lib/%.pm: perl/%.pm GIT-PERL-DEFINES
$(call mkdir_p_parent_template)
$(QUIET_GEN) \
- sed -e 's|@@LOCALEDIR@@|$(perl_localedir_SQ)|g' \
- -e 's|@@NO_GETTEXT@@|$(NO_GETTEXT_SQ)|g' \
- -e 's|@@NO_PERL_CPAN_FALLBACKS@@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \
+ sed -e 's|@LOCALEDIR@|$(perl_localedir_SQ)|g' \
+ -e 's|@NO_GETTEXT@|$(NO_GETTEXT_SQ)|g' \
+ -e 's|@NO_PERL_CPAN_FALLBACKS@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \
< $< > $@
perl/build/man/man3/Git.3pm: perl/Git.pm
@@ -3225,8 +3225,8 @@ all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PR
bin-wrappers/%: wrap-for-bin.sh
$(call mkdir_p_parent_template)
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@@BUILD_DIR@@|$(shell pwd)|' \
- -e 's|@@PROG@@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
+ -e 's|@BUILD_DIR@|$(shell pwd)|' \
+ -e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
chmod +x $@
# GNU make supports exporting all variables by "export" without parameters.
diff --git a/configure.ac b/configure.ac
index d1a96da14eb..5923edc44aa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -142,7 +142,7 @@ fi
## Configure body starts here.
AC_PREREQ(2.59)
-AC_INIT([git], [@@GIT_VERSION@@], [git@vger.kernel.org])
+AC_INIT([git], [@GIT_VERSION@], [git@vger.kernel.org])
AC_CONFIG_SRCDIR([git.c])
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 680e5b3c8b0..a41540458b7 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -836,14 +836,14 @@ set(git_shell_scripts
foreach(script ${git_shell_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.sh content NEWLINE_CONSUME)
string(REPLACE "@SHELL_PATH@" "${SHELL_PATH}" content "${content}")
- string(REPLACE "@@DIFF@@" "diff" content "${content}")
+ string(REPLACE "@DIFF@" "diff" content "${content}")
string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}")
string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" content "${content}")
- string(REPLACE "@@NO_CURL@@" "" content "${content}")
- string(REPLACE "@@USE_GETTEXT_SCHEME@@" "" content "${content}")
- string(REPLACE "# @@BROKEN_PATH_FIX@@" "" content "${content}")
- string(REPLACE "@@PERL@@" "${PERL_PATH}" content "${content}")
- string(REPLACE "@@PAGER_ENV@@" "LESS=FRX LV=-c" content "${content}")
+ string(REPLACE "@NO_CURL@" "" content "${content}")
+ string(REPLACE "@USE_GETTEXT_SCHEME@" "" content "${content}")
+ string(REPLACE "# @BROKEN_PATH_FIX@" "" content "${content}")
+ string(REPLACE "@PERL@" "${PERL_PATH}" content "${content}")
+ string(REPLACE "@PAGER_ENV@" "LESS=FRX LV=-c" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
endforeach()
@@ -852,13 +852,13 @@ parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" ".perl")
#create perl header
file(STRINGS ${CMAKE_SOURCE_DIR}/perl/header_templates/fixed_prefix.template.pl perl_header )
-string(REPLACE "@@PATHSEP@@" ":" perl_header "${perl_header}")
-string(REPLACE "@@INSTLIBDIR@@" "${INSTLIBDIR}" perl_header "${perl_header}")
+string(REPLACE "@PATHSEP@" ":" perl_header "${perl_header}")
+string(REPLACE "@INSTLIBDIR@" "${INSTLIBDIR}" perl_header "${perl_header}")
foreach(script ${git_perl_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.perl content NEWLINE_CONSUME)
string(REPLACE "#!/usr/bin/perl" "#!/usr/bin/perl\n${perl_header}\n" content "${content}")
- string(REPLACE "@@GIT_VERSION@@" "${PROJECT_VERSION}" content "${content}")
+ string(REPLACE "@GIT_VERSION@" "${PROJECT_VERSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
endforeach()
@@ -873,8 +873,8 @@ file(GLOB_RECURSE perl_modules "${CMAKE_SOURCE_DIR}/perl/*.pm")
foreach(pm ${perl_modules})
string(REPLACE "${CMAKE_SOURCE_DIR}/perl/" "" file_path ${pm})
file(STRINGS ${pm} content NEWLINE_CONSUME)
- string(REPLACE "@@LOCALEDIR@@" "${LOCALEDIR}" content "${content}")
- string(REPLACE "@@NO_PERL_CPAN_FALLBACKS@@" "" content "${content}")
+ string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}")
+ string(REPLACE "@NO_PERL_CPAN_FALLBACKS@" "" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/perl/build/lib/${file_path} ${content})
#test-lib.sh requires perl/build/lib to be the build directory of perl modules
endforeach()
@@ -1056,21 +1056,21 @@ set(wrapper_test_scripts
foreach(script ${wrapper_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
- string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
- string(REPLACE "@@PROG@@" "${script}${EXE_EXTENSION}" content "${content}")
+ string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+ string(REPLACE "@PROG@" "${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
foreach(script ${wrapper_test_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
- string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
- string(REPLACE "@@PROG@@" "t/helper/${script}${EXE_EXTENSION}" content "${content}")
+ string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+ string(REPLACE "@PROG@" "t/helper/${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
-string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
-string(REPLACE "@@PROG@@" "git-cvsserver" content "${content}")
+string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+string(REPLACE "@PROG@" "git-cvsserver" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})
#options for configuring test options
diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index 124f598bdc0..70ae7cb8e45 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -26,7 +26,7 @@
use File::Basename;
use Getopt::Long qw(:config require_order no_ignore_case);
-my $VERSION = '@@GIT_VERSION@@';
+my $VERSION = '@GIT_VERSION@';
my $log = GITCVS::log->new();
my $cfg;
diff --git a/git-instaweb.sh b/git-instaweb.sh
index 8dbe21d5887..c8efb1205a8 100755
--- a/git-instaweb.sh
+++ b/git-instaweb.sh
@@ -3,7 +3,7 @@
# Copyright (c) 2006 Eric Wong
#
-PERL='@@PERL@@'
+PERL='@PERL@'
OPTIONS_KEEPDASHDASH=
OPTIONS_STUCKLONG=
OPTIONS_SPEC="\
@@ -38,8 +38,8 @@ conf="$GIT_DIR/gitweb/httpd.conf"
# if installed, it doesn't need further configuration (module_path)
test -z "$httpd" && httpd='lighttpd -f'
-# Default is @@GITWEBDIR@@
-test -z "$root" && root='@@GITWEBDIR@@'
+# Default is @GITWEBDIR@
+test -z "$root" && root='@GITWEBDIR@'
# any untaken local port will do...
test -z "$port" && port=1234
@@ -716,7 +716,7 @@ EOF
gitweb_conf() {
cat > "$fqgitdir/gitweb/gitweb_config.perl" <<EOF
-#!@@PERL@@
+#!@PERL@
our \$projectroot = "$(dirname "$fqgitdir")";
our \$git_temp = "$fqgitdir/gitweb/tmp";
our \$projects_list = \$projectroot;
diff --git a/git-request-pull.sh b/git-request-pull.sh
index 01640a044bb..10c88639e28 100755
--- a/git-request-pull.sh
+++ b/git-request-pull.sh
@@ -112,7 +112,7 @@ find_matching_ref='
}
'
-set fnord $(git ls-remote "$url" | @@PERL@@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
+set fnord $(git ls-remote "$url" | @PERL@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
remote_sha1=$2
ref=$3
diff --git a/git-send-email.perl b/git-send-email.perl
index c835d4c11af..02805c43e52 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1501,7 +1501,7 @@ sub gen_header {
@recipients = unique_email_list(@recipients,@cc,@initial_bcc);
@recipients = (map { extract_valid_address_or_die($_) } @recipients);
my $date = format_2822_time($time++);
- my $gitversion = '@@GIT_VERSION@@';
+ my $gitversion = '@GIT_VERSION@';
if ($gitversion =~ m/..GIT_VERSION../) {
$gitversion = Git::version();
}
diff --git a/git-sh-i18n.sh b/git-sh-i18n.sh
index a15c0620db6..ae4b2d6ba9d 100644
--- a/git-sh-i18n.sh
+++ b/git-sh-i18n.sh
@@ -9,7 +9,7 @@ TEXTDOMAIN=git
export TEXTDOMAIN
if test -z "$GIT_TEXTDOMAINDIR"
then
- TEXTDOMAINDIR="@@LOCALEDIR@@"
+ TEXTDOMAINDIR="@LOCALEDIR@"
else
TEXTDOMAINDIR="$GIT_TEXTDOMAINDIR"
fi
@@ -17,9 +17,9 @@ export TEXTDOMAINDIR
# First decide what scheme to use...
GIT_INTERNAL_GETTEXT_SH_SCHEME=fallthrough
-if test -n "@@USE_GETTEXT_SCHEME@@"
+if test -n "@USE_GETTEXT_SCHEME@"
then
- GIT_INTERNAL_GETTEXT_SH_SCHEME="@@USE_GETTEXT_SCHEME@@"
+ GIT_INTERNAL_GETTEXT_SH_SCHEME="@USE_GETTEXT_SCHEME@"
elif test -n "$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS"
then
: no probing necessary
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index ce273fe0e48..19aef72ec25 100644
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -41,7 +41,7 @@ git_broken_path_fix () {
esac
}
-# @@BROKEN_PATH_FIX@@
+# @BROKEN_PATH_FIX@
# Source git-sh-i18n for gettext support.
. "$(git --exec-path)/git-sh-i18n"
@@ -154,7 +154,7 @@ git_pager() {
else
GIT_PAGER=cat
fi
- for vardef in @@PAGER_ENV@@
+ for vardef in @PAGER_ENV@
do
var=${vardef%%=*}
eval ": \"\${$vardef}\" && export $var"
@@ -280,7 +280,7 @@ get_author_ident_from_commit () {
# remove lines from $1 that are not in $2, leaving only common lines.
create_virtual_base() {
sz0=$(wc -c <"$1")
- @@DIFF@@ -u -La/"$1" -Lb/"$1" "$1" "$2" | git apply --no-add
+ @DIFF@ -u -La/"$1" -Lb/"$1" "$1" "$2" | git apply --no-add
sz1=$(wc -c <"$1")
# If we do not have enough common material, it is not
diff --git a/git-svn.perl b/git-svn.perl
index 01e7a70de1c..dcf65cf1d1d 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -9,7 +9,7 @@
$_revision $_repository
$_q $_authors $_authors_prog %users/;
$AUTHOR = 'Eric Wong <normalperson@yhbt.net>';
-$VERSION = '@@GIT_VERSION@@';
+$VERSION = '@GIT_VERSION@';
use Carp qw/croak/;
use File::Basename qw/dirname basename/;
diff --git a/gitk-git/po/vi.po b/gitk-git/po/vi.po
index 59674986604..184430dcdee 100644
--- a/gitk-git/po/vi.po
+++ b/gitk-git/po/vi.po
@@ -5,7 +5,7 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: gitk @@GIT_VERSION@@\n"
+"Project-Id-Version: gitk @GIT_VERSION@\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-05-17 14:32+1000\n"
"PO-Revision-Date: 2015-09-15 07:33+0700\n"
diff --git a/gitweb/Makefile b/gitweb/Makefile
index 3b68ab2d672..164c8d53757 100644
--- a/gitweb/Makefile
+++ b/gitweb/Makefile
@@ -79,28 +79,28 @@ GITWEB_JSLIB_FILES += static/js/blame_incremental.js
GITWEB_REPLACE = \
- -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
- -e 's|++GIT_BINDIR++|$(bindir)|g' \
- -e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \
- -e 's|++GITWEB_CONFIG_SYSTEM++|$(GITWEB_CONFIG_SYSTEM)|g' \
- -e 's|++GITWEB_CONFIG_COMMON++|$(GITWEB_CONFIG_COMMON)|g' \
- -e 's|++GITWEB_HOME_LINK_STR++|$(GITWEB_HOME_LINK_STR)|g' \
- -e 's|++GITWEB_SITENAME++|$(GITWEB_SITENAME)|g' \
- -e 's|++GITWEB_PROJECTROOT++|$(GITWEB_PROJECTROOT)|g' \
- -e 's|"++GITWEB_PROJECT_MAXDEPTH++"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
- -e 's|++GITWEB_EXPORT_OK++|$(GITWEB_EXPORT_OK)|g' \
- -e 's|++GITWEB_STRICT_EXPORT++|$(GITWEB_STRICT_EXPORT)|g' \
- -e 's|++GITWEB_BASE_URL++|$(GITWEB_BASE_URL)|g' \
- -e 's|++GITWEB_LIST++|$(GITWEB_LIST)|g' \
- -e 's|++GITWEB_HOMETEXT++|$(GITWEB_HOMETEXT)|g' \
- -e 's|++GITWEB_CSS++|$(GITWEB_CSS)|g' \
- -e 's|++GITWEB_LOGO++|$(GITWEB_LOGO)|g' \
- -e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \
- -e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \
- -e 's|++GITWEB_SITE_HTML_HEAD_STRING++|$(GITWEB_SITE_HTML_HEAD_STRING)|g' \
- -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \
- -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \
- -e 's|++HIGHLIGHT_BIN++|$(HIGHLIGHT_BIN)|g'
+ -e 's|@GIT_VERSION@|$(GIT_VERSION)|g' \
+ -e 's|@GIT_BINDIR@|$(bindir)|g' \
+ -e 's|@GITWEB_CONFIG@|$(GITWEB_CONFIG)|g' \
+ -e 's|@GITWEB_CONFIG_SYSTEM@|$(GITWEB_CONFIG_SYSTEM)|g' \
+ -e 's|@GITWEB_CONFIG_COMMON@|$(GITWEB_CONFIG_COMMON)|g' \
+ -e 's|@GITWEB_HOME_LINK_STR@|$(GITWEB_HOME_LINK_STR)|g' \
+ -e 's|@GITWEB_SITENAME@|$(GITWEB_SITENAME)|g' \
+ -e 's|@GITWEB_PROJECTROOT@|$(GITWEB_PROJECTROOT)|g' \
+ -e 's|"@GITWEB_PROJECT_MAXDEPTH@"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
+ -e 's|@GITWEB_EXPORT_OK@|$(GITWEB_EXPORT_OK)|g' \
+ -e 's|@GITWEB_STRICT_EXPORT@|$(GITWEB_STRICT_EXPORT)|g' \
+ -e 's|@GITWEB_BASE_URL@|$(GITWEB_BASE_URL)|g' \
+ -e 's|@GITWEB_LIST@|$(GITWEB_LIST)|g' \
+ -e 's|@GITWEB_HOMETEXT@|$(GITWEB_HOMETEXT)|g' \
+ -e 's|@GITWEB_CSS@|$(GITWEB_CSS)|g' \
+ -e 's|@GITWEB_LOGO@|$(GITWEB_LOGO)|g' \
+ -e 's|@GITWEB_FAVICON@|$(GITWEB_FAVICON)|g' \
+ -e 's|@GITWEB_JS@|$(GITWEB_JS)|g' \
+ -e 's|@GITWEB_SITE_HTML_HEAD_STRING@|$(GITWEB_SITE_HTML_HEAD_STRING)|g' \
+ -e 's|@GITWEB_SITE_HEADER@|$(GITWEB_SITE_HEADER)|g' \
+ -e 's|@GITWEB_SITE_FOOTER@|$(GITWEB_SITE_FOOTER)|g' \
+ -e 's|@HIGHLIGHT_BIN@|$(HIGHLIGHT_BIN)|g'
.PHONY: FORCE
$(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS: FORCE
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index b09a8d05238..76e1f4e244f 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -35,7 +35,7 @@ BEGIN
CGI->compile() if $ENV{'MOD_PERL'};
}
-our $version = "++GIT_VERSION++";
+our $version = "@GIT_VERSION@";
our ($my_url, $my_uri, $base_url, $path_info, $home_link);
sub evaluate_uri {
@@ -80,46 +80,46 @@ sub evaluate_uri {
# core git executable to use
# this can just be "git" if your webserver has a sensible PATH
-our $GIT = "++GIT_BINDIR++/git";
+our $GIT = "@GIT_BINDIR@/git";
# absolute fs-path which will be prepended to the project path
#our $projectroot = "/pub/scm";
-our $projectroot = "++GITWEB_PROJECTROOT++";
+our $projectroot = "@GITWEB_PROJECTROOT@";
# fs traversing limit for getting project list
# the number is relative to the projectroot
-our $project_maxdepth = "++GITWEB_PROJECT_MAXDEPTH++";
+our $project_maxdepth = "@GITWEB_PROJECT_MAXDEPTH@";
# string of the home link on top of all pages
-our $home_link_str = "++GITWEB_HOME_LINK_STR++";
+our $home_link_str = "@GITWEB_HOME_LINK_STR@";
# extra breadcrumbs preceding the home link
our @extra_breadcrumbs = ();
# name of your site or organization to appear in page titles
# replace this with something more descriptive for clearer bookmarks
-our $site_name = "++GITWEB_SITENAME++"
+our $site_name = "@GITWEB_SITENAME@"
|| ($ENV{'SERVER_NAME'} || "Untitled") . " Git";
# html snippet to include in the <head> section of each page
-our $site_html_head_string = "++GITWEB_SITE_HTML_HEAD_STRING++";
+our $site_html_head_string = "@GITWEB_SITE_HTML_HEAD_STRING@";
# filename of html text to include at top of each page
-our $site_header = "++GITWEB_SITE_HEADER++";
+our $site_header = "@GITWEB_SITE_HEADER@";
# html text to include at home page
-our $home_text = "++GITWEB_HOMETEXT++";
+our $home_text = "@GITWEB_HOMETEXT@";
# filename of html text to include at bottom of each page
-our $site_footer = "++GITWEB_SITE_FOOTER++";
+our $site_footer = "@GITWEB_SITE_FOOTER@";
# URI of stylesheets
-our @stylesheets = ("++GITWEB_CSS++");
+our @stylesheets = ("@GITWEB_CSS@");
# URI of a single stylesheet, which can be overridden in GITWEB_CONFIG.
our $stylesheet = undef;
# URI of GIT logo (72x27 size)
-our $logo = "++GITWEB_LOGO++";
+our $logo = "@GITWEB_LOGO@";
# URI of GIT favicon, assumed to be image/png type
-our $favicon = "++GITWEB_FAVICON++";
+our $favicon = "@GITWEB_FAVICON@";
# URI of gitweb.js (JavaScript code for gitweb)
-our $javascript = "++GITWEB_JS++";
+our $javascript = "@GITWEB_JS@";
# URI and label (title) of GIT logo link
#our $logo_url = "https://www.kernel.org/pub/software/scm/git/docs/";
@@ -128,7 +128,7 @@ sub evaluate_uri {
our $logo_label = "git homepage";
# source of projects list
-our $projects_list = "++GITWEB_LIST++";
+our $projects_list = "@GITWEB_LIST@";
# the width (in characters) of the projects list "Description" column
our $projects_list_description_width = 25;
@@ -147,7 +147,7 @@ sub evaluate_uri {
# show repository only if this file exists
# (only effective if this variable evaluates to true)
-our $export_ok = "++GITWEB_EXPORT_OK++";
+our $export_ok = "@GITWEB_EXPORT_OK@";
# don't generate age column on the projects list page
our $omit_age_column = 0;
@@ -161,11 +161,11 @@ sub evaluate_uri {
our $export_auth_hook = undef;
# only allow viewing of repositories also shown on the overview page
-our $strict_export = "++GITWEB_STRICT_EXPORT++";
+our $strict_export = "@GITWEB_STRICT_EXPORT@";
# list of git base URLs used for URL to where fetch project from,
# i.e. full URL is "$git_base_url/$project"
-our @git_base_url_list = grep { $_ ne '' } ("++GITWEB_BASE_URL++");
+our @git_base_url_list = grep { $_ ne '' } ("@GITWEB_BASE_URL@");
# default blob_plain mimetype and default charset for text/plain blob
our $default_blob_plain_mimetype = 'text/plain';
@@ -200,7 +200,7 @@ sub evaluate_uri {
# http://andre-simon.de/zip/download.php due to assumptions about parameters and output).
# Useful if highlight is not installed on your webserver's PATH.
# [Default: highlight]
-our $highlight_bin = "++HIGHLIGHT_BIN++";
+our $highlight_bin = "@HIGHLIGHT_BIN@";
# information about snapshot formats that gitweb is capable of serving
our %known_snapshot_formats = (
@@ -741,9 +741,9 @@ sub read_config_file {
our ($GITWEB_CONFIG, $GITWEB_CONFIG_SYSTEM, $GITWEB_CONFIG_COMMON);
sub evaluate_gitweb_config {
- our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "++GITWEB_CONFIG++";
- our $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || "++GITWEB_CONFIG_SYSTEM++";
- our $GITWEB_CONFIG_COMMON = $ENV{'GITWEB_CONFIG_COMMON'} || "++GITWEB_CONFIG_COMMON++";
+ our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "@GITWEB_CONFIG@";
+ our $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || "@GITWEB_CONFIG_SYSTEM@";
+ our $GITWEB_CONFIG_COMMON = $ENV{'GITWEB_CONFIG_COMMON'} || "@GITWEB_CONFIG_COMMON@";
# Protect against duplications of file names, to not read config twice.
# Only one of $GITWEB_CONFIG and $GITWEB_CONFIG_SYSTEM is used, so
diff --git a/perl/Git/I18N.pm b/perl/Git/I18N.pm
index 475e90a6df5..f8f0ca31254 100644
--- a/perl/Git/I18N.pm
+++ b/perl/Git/I18N.pm
@@ -20,14 +20,14 @@ BEGIN
# this "'@@' [...] '@@'" pattern.
use constant NO_GETTEXT_STR => '@@' . 'NO_GETTEXT' . '@@';
use constant NO_GETTEXT => (
- q[@@NO_GETTEXT@@] ne ''
+ q[@NO_GETTEXT@] ne ''
and
- q[@@NO_GETTEXT@@] ne NO_GETTEXT_STR
+ q[@NO_GETTEXT@] ne NO_GETTEXT_STR
);
sub __bootstrap_locale_messages {
our $TEXTDOMAIN = 'git';
- our $TEXTDOMAINDIR ||= $ENV{GIT_TEXTDOMAINDIR} || '@@LOCALEDIR@@';
+ our $TEXTDOMAINDIR ||= $ENV{GIT_TEXTDOMAINDIR} || '@LOCALEDIR@';
die "NO_GETTEXT=" . NO_GETTEXT_STR if NO_GETTEXT;
require POSIX;
diff --git a/perl/Git/LoadCPAN.pm b/perl/Git/LoadCPAN.pm
index 8c7fa805f97..6be99840f84 100644
--- a/perl/Git/LoadCPAN.pm
+++ b/perl/Git/LoadCPAN.pm
@@ -31,11 +31,11 @@ =head1 DESCRIPTION
# Makefile, and allows for detecting whether the module is loaded from
# perl/Git as opposed to perl/build/Git, which is useful for one-off
# testing without having Error.pm et al installed.
-use constant NO_PERL_CPAN_FALLBACKS_STR => '@@' . 'NO_PERL_CPAN_FALLBACKS' . '@@';
+use constant NO_PERL_CPAN_FALLBACKS_STR => '@' . 'NO_PERL_CPAN_FALLBACKS' . '@';
use constant NO_PERL_CPAN_FALLBACKS => (
- q[@@NO_PERL_CPAN_FALLBACKS@@] ne ''
+ q[@NO_PERL_CPAN_FALLBACKS@] ne ''
and
- q[@@NO_PERL_CPAN_FALLBACKS@@] ne NO_PERL_CPAN_FALLBACKS_STR
+ q[@NO_PERL_CPAN_FALLBACKS@] ne NO_PERL_CPAN_FALLBACKS_STR
);
sub import {
--git a/perl/header_templates/fixed_prefix.template.pl b/perl/header_templates/fixed_prefix.template.pl
index 857b4391a49..d571ca5cde5 100644
--- a/perl/header_templates/fixed_prefix.template.pl
+++ b/perl/header_templates/fixed_prefix.template.pl
@@ -1 +1 @@
-use lib (split(/@@PATHSEP@@/, $ENV{GITPERLLIB} || '@@INSTLIBDIR@@'));
+use lib (split(/@PATHSEP@/, $ENV{GITPERLLIB} || '@INSTLIBDIR@'));
diff --git a/perl/header_templates/runtime_prefix.template.pl b/perl/header_templates/runtime_prefix.template.pl
index 9d28b3d8636..e6f8e661a16 100644
--- a/perl/header_templates/runtime_prefix.template.pl
+++ b/perl/header_templates/runtime_prefix.template.pl
@@ -3,7 +3,7 @@
# This finds our Git::* libraries relative to the script's runtime path.
sub __git_system_path {
my ($relpath) = @_;
- my $gitexecdir_relative = '@@GITEXECDIR_REL@@';
+ my $gitexecdir_relative = '@GITEXECDIR_REL@';
# GIT_EXEC_PATH is supplied by `git` or the test suite.
my $exec_path;
@@ -24,11 +24,11 @@ sub __git_system_path {
}
BEGIN {
- use lib split /@@PATHSEP@@/,
+ use lib split /@PATHSEP@/,
(
$ENV{GITPERLLIB} ||
do {
- my $perllibdir = __git_system_path('@@PERLLIBDIR_REL@@');
+ my $perllibdir = __git_system_path('@PERLLIBDIR_REL@');
(-e $perllibdir) || die("Invalid system path ($relpath): $path");
$perllibdir;
}
@@ -36,7 +36,7 @@ BEGIN
# Export the system locale directory to the I18N module. The locale directory
# is only installed if NO_GETTEXT is set.
- $Git::I18N::TEXTDOMAINDIR = __git_system_path('@@LOCALEDIR_REL@@');
+ $Git::I18N::TEXTDOMAINDIR = __git_system_path('@LOCALEDIR_REL@');
}
# END RUNTIME_PREFIX generated code.
diff --git a/unimplemented.sh b/unimplemented.sh
index fee21d24e8a..41776b279d4 100644
--- a/unimplemented.sh
+++ b/unimplemented.sh
@@ -1,4 +1,4 @@
#!/bin/sh
-echo >&2 "fatal: git was built without support for $(basename $0) (@@REASON@@)."
+echo >&2 "fatal: git was built without support for $(basename $0) (@REASON@)."
exit 128
diff --git a/wrap-for-bin.sh b/wrap-for-bin.sh
index 95851b85b6b..7898a1c238d 100644
--- a/wrap-for-bin.sh
+++ b/wrap-for-bin.sh
@@ -4,33 +4,33 @@
# to run test suite against sandbox, but with only bindir-installed
# executables in PATH. The Makefile copies this into various
# files in bin-wrappers, substituting
-# @@BUILD_DIR@@ and @@PROG@@.
+# @BUILD_DIR@ and @PROG@.
-GIT_EXEC_PATH='@@BUILD_DIR@@'
+GIT_EXEC_PATH='@BUILD_DIR@'
if test -n "$NO_SET_GIT_TEMPLATE_DIR"
then
unset GIT_TEMPLATE_DIR
else
- GIT_TEMPLATE_DIR='@@BUILD_DIR@@/templates/blt'
+ GIT_TEMPLATE_DIR='@BUILD_DIR@/templates/blt'
export GIT_TEMPLATE_DIR
fi
-GITPERLLIB='@@BUILD_DIR@@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}"
-GIT_TEXTDOMAINDIR='@@BUILD_DIR@@/po/build/locale'
-PATH='@@BUILD_DIR@@/bin-wrappers:'"$PATH"
+GITPERLLIB='@BUILD_DIR@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}"
+GIT_TEXTDOMAINDIR='@BUILD_DIR@/po/build/locale'
+PATH='@BUILD_DIR@/bin-wrappers:'"$PATH"
export GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
case "$GIT_DEBUGGER" in
'')
- exec "${GIT_EXEC_PATH}/@@PROG@@" "$@"
+ exec "${GIT_EXEC_PATH}/@PROG@" "$@"
;;
1)
unset GIT_DEBUGGER
- exec gdb --args "${GIT_EXEC_PATH}/@@PROG@@" "$@"
+ exec gdb --args "${GIT_EXEC_PATH}/@PROG@" "$@"
;;
*)
GIT_DEBUGGER_ARGS="$GIT_DEBUGGER"
unset GIT_DEBUGGER
- exec ${GIT_DEBUGGER_ARGS} "${GIT_EXEC_PATH}/@@PROG@@" "$@"
+ exec ${GIT_DEBUGGER_ARGS} "${GIT_EXEC_PATH}/@PROG@" "$@"
;;
esac
--
2.47.0.118.gfd3785337b.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v4 03/19] Makefile: consistently use PERL_PATH
2024-10-24 12:39 ` [RFC PATCH v4 00/19] " Patrick Steinhardt
2024-10-24 12:39 ` [RFC PATCH v4 01/19] Makefile: use common template for GIT-BUILD-OPTIONS Patrick Steinhardt
2024-10-24 12:39 ` [RFC PATCH v4 02/19] Makefile: consistently use @PLACEHOLDER@ to substitute Patrick Steinhardt
@ 2024-10-24 12:39 ` Patrick Steinhardt
2024-10-24 12:39 ` [RFC PATCH v4 04/19] Makefile: extract script to massage Perl scripts Patrick Steinhardt
` (18 subsequent siblings)
21 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-24 12:39 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau
When injecting the Perl path into our scripts we sometimes use '@PERL@'
while we othertimes use '@PERL_PATH@'. Refactor the code use the latter
consistently, which makes it easier to reuse the same logic for multiple
scripts.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 2 +-
contrib/buildsystems/CMakeLists.txt | 2 +-
git-instaweb.sh | 4 ++--
git-request-pull.sh | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile
index 8a2b292e3d2..22ed53f39e7 100644
--- a/Makefile
+++ b/Makefile
@@ -2553,7 +2553,7 @@ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's/@USE_GETTEXT_SCHEME@/$(USE_GETTEXT_SCHEME)/g' \
-e $(BROKEN_PATH_FIX) \
-e 's|@GITWEBDIR@|$(gitwebdir_SQ)|g' \
- -e 's|@PERL@|$(PERL_PATH_SQ)|g' \
+ -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' \
-e 's|@PAGER_ENV@|$(PAGER_ENV_SQ)|g' \
$@.sh >$@+
endef
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index a41540458b7..608ad9714d4 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -842,7 +842,7 @@ foreach(script ${git_shell_scripts})
string(REPLACE "@NO_CURL@" "" content "${content}")
string(REPLACE "@USE_GETTEXT_SCHEME@" "" content "${content}")
string(REPLACE "# @BROKEN_PATH_FIX@" "" content "${content}")
- string(REPLACE "@PERL@" "${PERL_PATH}" content "${content}")
+ string(REPLACE "@PERL_PATH@" "${PERL_PATH}" content "${content}")
string(REPLACE "@PAGER_ENV@" "LESS=FRX LV=-c" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
endforeach()
diff --git a/git-instaweb.sh b/git-instaweb.sh
index c8efb1205a8..5ad50160bb0 100755
--- a/git-instaweb.sh
+++ b/git-instaweb.sh
@@ -3,7 +3,7 @@
# Copyright (c) 2006 Eric Wong
#
-PERL='@PERL@'
+PERL='@PERL_PATH@'
OPTIONS_KEEPDASHDASH=
OPTIONS_STUCKLONG=
OPTIONS_SPEC="\
@@ -716,7 +716,7 @@ EOF
gitweb_conf() {
cat > "$fqgitdir/gitweb/gitweb_config.perl" <<EOF
-#!@PERL@
+#!@PERL_PATH@
our \$projectroot = "$(dirname "$fqgitdir")";
our \$git_temp = "$fqgitdir/gitweb/tmp";
our \$projects_list = \$projectroot;
diff --git a/git-request-pull.sh b/git-request-pull.sh
index 10c88639e28..775ba8ea11a 100755
--- a/git-request-pull.sh
+++ b/git-request-pull.sh
@@ -112,7 +112,7 @@ find_matching_ref='
}
'
-set fnord $(git ls-remote "$url" | @PERL@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
+set fnord $(git ls-remote "$url" | @PERL_PATH@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
remote_sha1=$2
ref=$3
--
2.47.0.118.gfd3785337b.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v4 04/19] Makefile: extract script to massage Perl scripts
2024-10-24 12:39 ` [RFC PATCH v4 00/19] " Patrick Steinhardt
` (2 preceding siblings ...)
2024-10-24 12:39 ` [RFC PATCH v4 03/19] Makefile: consistently use PERL_PATH Patrick Steinhardt
@ 2024-10-24 12:39 ` Patrick Steinhardt
2024-11-10 14:36 ` Phillip Wood
2024-10-24 12:39 ` [RFC PATCH v4 05/19] Makefile: use "generate-perl.sh" to massage Perl library Patrick Steinhardt
` (17 subsequent siblings)
21 siblings, 1 reply; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-24 12:39 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau
Extract the script to inject various build-time parameters into our Perl
scripts into a standalone script. This is done such that we can reuse it
in other build systems.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 12 ++----------
contrib/buildsystems/CMakeLists.txt | 20 +++++++++++++++-----
generate-perl.sh | 26 ++++++++++++++++++++++++++
3 files changed, 43 insertions(+), 15 deletions(-)
create mode 100755 generate-perl.sh
diff --git a/Makefile b/Makefile
index 22ed53f39e7..e04a381e8f0 100644
--- a/Makefile
+++ b/Makefile
@@ -2604,16 +2604,8 @@ endif
PERL_DEFINES += $(gitexecdir) $(perllibdir) $(localedir)
-$(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
- $(QUIET_GEN) \
- sed -e '1{' \
- -e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \
- -e ' r GIT-PERL-HEADER' \
- -e ' G' \
- -e '}' \
- -e 's/@GIT_VERSION@/$(GIT_VERSION)/g' \
- $< >$@+ && \
- chmod +x $@+ && \
+$(SCRIPT_PERL_GEN): % : %.perl generate-perl.sh GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
+ $(QUIET_GEN)$(SHELL_PATH) generate-perl.sh ./GIT-BUILD-OPTIONS $(GIT_VERSION) GIT-PERL-HEADER "$<" "$@+" && \
mv $@+ $@
PERL_DEFINES := $(subst $(space),:,$(PERL_DEFINES))
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 608ad9714d4..7fb6a149f21 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -848,19 +848,29 @@ foreach(script ${git_shell_scripts})
endforeach()
#perl scripts
-parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" ".perl")
+parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" "")
#create perl header
file(STRINGS ${CMAKE_SOURCE_DIR}/perl/header_templates/fixed_prefix.template.pl perl_header )
string(REPLACE "@PATHSEP@" ":" perl_header "${perl_header}")
string(REPLACE "@INSTLIBDIR@" "${INSTLIBDIR}" perl_header "${perl_header}")
+file(WRITE ${CMAKE_BINARY_DIR}/PERL-HEADER ${perl_header})
foreach(script ${git_perl_scripts})
- file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.perl content NEWLINE_CONSUME)
- string(REPLACE "#!/usr/bin/perl" "#!/usr/bin/perl\n${perl_header}\n" content "${content}")
- string(REPLACE "@GIT_VERSION@" "${PROJECT_VERSION}" content "${content}")
- file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
+ string(REPLACE ".perl" "" perl_gen_path "${script}")
+
+ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${perl_gen_path}
+ COMMAND ${CMAKE_SOURCE_DIR}/generate-perl.sh
+ ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS
+ ${PROJECT_VERSION}
+ ${CMAKE_BINARY_DIR}/PERL-HEADER
+ ${CMAKE_SOURCE_DIR}/${script}
+ ${CMAKE_BINARY_DIR}/${perl_gen_path}
+ DEPENDS ${CMAKE_SOURCE_DIR}/generate-perl.sh
+ ${CMAKE_SOURCE_DIR}/${script})
+ list(APPEND perl_gen ${CMAKE_BINARY_DIR}/${perl_gen_path})
endforeach()
+add_custom_target(perl-gen ALL DEPENDS ${perl_gen})
#python script
file(STRINGS ${CMAKE_SOURCE_DIR}/git-p4.py content NEWLINE_CONSUME)
diff --git a/generate-perl.sh b/generate-perl.sh
new file mode 100755
index 00000000000..12e116b76e5
--- /dev/null
+++ b/generate-perl.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+set -e
+
+if test $# -ne 5
+then
+ echo "USAGE: $0 <GIT_BUILD_OPTIONS> <GIT_VERSION> <PERL_HEADER> <INPUT> <OUTPUT>" >&2
+ exit 1
+fi
+
+GIT_BUILD_OPTIONS="$1"
+GIT_VERSION="$2"
+PERL_HEADER="$3"
+INPUT="$4"
+OUTPUT="$5"
+
+. "$GIT_BUILD_OPTIONS"
+
+sed -e '1{' \
+ -e " s|#!.*perl|#!$PERL_PATH|" \
+ -e " r $PERL_HEADER" \
+ -e ' G' \
+ -e '}' \
+ -e "s/@GIT_VERSION@/$GIT_VERSION/g" \
+ "$INPUT" >"$OUTPUT"
+chmod a+x "$OUTPUT"
--
2.47.0.118.gfd3785337b.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v4 05/19] Makefile: use "generate-perl.sh" to massage Perl library
2024-10-24 12:39 ` [RFC PATCH v4 00/19] " Patrick Steinhardt
` (3 preceding siblings ...)
2024-10-24 12:39 ` [RFC PATCH v4 04/19] Makefile: extract script to massage Perl scripts Patrick Steinhardt
@ 2024-10-24 12:39 ` Patrick Steinhardt
2024-11-11 10:53 ` Phillip Wood
2024-10-24 12:40 ` [RFC PATCH v4 06/19] Makefile: extract script to massage Shell scripts Patrick Steinhardt
` (16 subsequent siblings)
21 siblings, 1 reply; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-24 12:39 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau
Extend "generate-perl.sh" such that it knows to also massage the Perl
library files. There are two major differences:
- We do not read in the Perl header. This is handled by matching on
whether or not we have a Perl shebang.
- We substitute some more variables, which we read in via our
GIT-BUILD-OPTIONS.
Adapt both our Makefile and the CMake build instructions to use this.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-BUILD-OPTIONS.in | 2 ++
Makefile | 10 ++++------
contrib/buildsystems/CMakeLists.txt | 20 ++++++--------------
generate-perl.sh | 14 ++++++++++++--
4 files changed, 24 insertions(+), 22 deletions(-)
diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in
index f0ca240493c..050432f9fc4 100644
--- a/GIT-BUILD-OPTIONS.in
+++ b/GIT-BUILD-OPTIONS.in
@@ -1,6 +1,8 @@
SHELL_PATH=@SHELL_PATH@
TEST_SHELL_PATH=@TEST_SHELL_PATH@
PERL_PATH=@PERL_PATH@
+PERL_LOCALEDIR=@PERL_LOCALEDIR@
+NO_PERL_CPAN_FALLBACKS=@NO_PERL_CPAN_FALLBACKS@
DIFF=@DIFF@
PYTHON_PATH=@PYTHON_PATH@
TAR=@TAR@
diff --git a/Makefile b/Makefile
index e04a381e8f0..fc13d5bb01c 100644
--- a/Makefile
+++ b/Makefile
@@ -3093,13 +3093,9 @@ endif
NO_PERL_CPAN_FALLBACKS_SQ = $(subst ','\'',$(NO_PERL_CPAN_FALLBACKS))
endif
-perl/build/lib/%.pm: perl/%.pm GIT-PERL-DEFINES
+perl/build/lib/%.pm: perl/%.pm generate-perl.sh GIT-BUILD-OPTIONS GIT-PERL-DEFINES
$(call mkdir_p_parent_template)
- $(QUIET_GEN) \
- sed -e 's|@LOCALEDIR@|$(perl_localedir_SQ)|g' \
- -e 's|@NO_GETTEXT@|$(NO_GETTEXT_SQ)|g' \
- -e 's|@NO_PERL_CPAN_FALLBACKS@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \
- < $< > $@
+ $(QUIET_GEN)$(SHELL_PATH) generate-perl.sh ./GIT-BUILD-OPTIONS $(GIT_VERSION) GIT-PERL-HEADER "$<" "$@"
perl/build/man/man3/Git.3pm: perl/Git.pm
$(call mkdir_p_parent_template)
@@ -3160,6 +3156,8 @@ GIT-BUILD-OPTIONS: FORCE
-e "s|@SHELL_PATH@|\'$(SHELL_PATH_SQ)\'|" \
-e "s|@TEST_SHELL_PATH@|\'$(TEST_SHELL_PATH_SQ)\'|" \
-e "s|@PERL_PATH@|\'$(PERL_PATH_SQ)\'|" \
+ -e "s|@PERL_LOCALEDIR@|\'$(perl_localedir_SQ)\'|" \
+ -e "s|@NO_PERL_CPAN_FALLBACKS@|\'$(NO_PERL_CPAN_FALLBACKS_SQ)\'|" \
-e "s|@DIFF@|\'$(DIFF)\'|" \
-e "s|@PYTHON_PATH@|\'$(PYTHON_PATH_SQ)\'|" \
-e "s|@TAR@|\'$(TAR)\'|" \
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 7fb6a149f21..ddf39dc90e7 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -849,6 +849,9 @@ endforeach()
#perl scripts
parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" "")
+#perl modules
+file(GLOB_RECURSE perl_modules "${CMAKE_SOURCE_DIR}/perl/*.pm")
+list(TRANSFORM perl_modules REPLACE "${CMAKE_SOURCE_DIR}/" "")
#create perl header
file(STRINGS ${CMAKE_SOURCE_DIR}/perl/header_templates/fixed_prefix.template.pl perl_header )
@@ -856,7 +859,7 @@ string(REPLACE "@PATHSEP@" ":" perl_header "${perl_header}")
string(REPLACE "@INSTLIBDIR@" "${INSTLIBDIR}" perl_header "${perl_header}")
file(WRITE ${CMAKE_BINARY_DIR}/PERL-HEADER ${perl_header})
-foreach(script ${git_perl_scripts})
+foreach(script ${git_perl_scripts} ${perl_modules})
string(REPLACE ".perl" "" perl_gen_path "${script}")
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${perl_gen_path}
@@ -877,19 +880,6 @@ file(STRINGS ${CMAKE_SOURCE_DIR}/git-p4.py content NEWLINE_CONSUME)
string(REPLACE "#!/usr/bin/env python" "#!/usr/bin/python" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/git-p4 ${content})
-#perl modules
-file(GLOB_RECURSE perl_modules "${CMAKE_SOURCE_DIR}/perl/*.pm")
-
-foreach(pm ${perl_modules})
- string(REPLACE "${CMAKE_SOURCE_DIR}/perl/" "" file_path ${pm})
- file(STRINGS ${pm} content NEWLINE_CONSUME)
- string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}")
- string(REPLACE "@NO_PERL_CPAN_FALLBACKS@" "" content "${content}")
- file(WRITE ${CMAKE_BINARY_DIR}/perl/build/lib/${file_path} ${content})
-#test-lib.sh requires perl/build/lib to be the build directory of perl modules
-endforeach()
-
-
#templates
file(GLOB templates "${CMAKE_SOURCE_DIR}/templates/*")
list(TRANSFORM templates REPLACE "${CMAKE_SOURCE_DIR}/templates/" "")
@@ -1131,6 +1121,8 @@ file(STRINGS ${CMAKE_SOURCE_DIR}/GIT-BUILD-OPTIONS.in git_build_options NEWLINE_
string(REPLACE "@SHELL_PATH@" "${SHELL_PATH}" git_build_options "${git_build_options}")
string(REPLACE "@TEST_SHELL_PATH@" "${TEST_SHELL_PATH}" git_build_options "${git_build_options}")
string(REPLACE "@PERL_PATH@" "${PERL_PATH}" git_build_options "${git_build_options}")
+string(REPLACE "@PERL_LOCALEDIR@" "${LOCALEDIR}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PERL_CPAN_FALLBACKS@" "" git_build_options "${git_build_options}")
string(REPLACE "@DIFF@" "${DIFF}" git_build_options "${git_build_options}")
string(REPLACE "@PYTHON_PATH@" "${PYTHON_PATH}" git_build_options "${git_build_options}")
string(REPLACE "@TAR@" "${TAR}" git_build_options "${git_build_options}")
diff --git a/generate-perl.sh b/generate-perl.sh
index 12e116b76e5..cb1629857c6 100755
--- a/generate-perl.sh
+++ b/generate-perl.sh
@@ -17,10 +17,20 @@ OUTPUT="$5"
. "$GIT_BUILD_OPTIONS"
sed -e '1{' \
+ -e " /^#!.*perl/!b" \
-e " s|#!.*perl|#!$PERL_PATH|" \
-e " r $PERL_HEADER" \
-e ' G' \
-e '}' \
- -e "s/@GIT_VERSION@/$GIT_VERSION/g" \
+ -e "s|@GIT_VERSION@|$GIT_VERSION|g" \
+ -e "s|@LOCALEDIR@|$PERL_LOCALEDIR|g" \
+ -e "s|@NO_GETTEXT@|$NO_GETTEXT|g" \
+ -e "s|@NO_PERL_CPAN_FALLBACKS@|$NO_PERL_CPAN_FALLBACKS|g" \
"$INPUT" >"$OUTPUT"
-chmod a+x "$OUTPUT"
+
+case "$(basename "$INPUT")" in
+*.perl)
+ chmod a+x "$OUTPUT";;
+*)
+ ;;
+esac
--
2.47.0.118.gfd3785337b.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v4 06/19] Makefile: extract script to massage Shell scripts
2024-10-24 12:39 ` [RFC PATCH v4 00/19] " Patrick Steinhardt
` (4 preceding siblings ...)
2024-10-24 12:39 ` [RFC PATCH v4 05/19] Makefile: use "generate-perl.sh" to massage Perl library Patrick Steinhardt
@ 2024-10-24 12:40 ` Patrick Steinhardt
2024-11-10 14:42 ` Phillip Wood
2024-10-24 12:40 ` [RFC PATCH v4 07/19] Makefile: extract script to generate gitweb.cgi Patrick Steinhardt
` (15 subsequent siblings)
21 siblings, 1 reply; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-24 12:40 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau
Same as in the preceding commits, extract a script that allows us to
unify how we massage shell scripts.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-BUILD-OPTIONS.in | 4 ++++
Makefile | 34 +++++++++--------------------
contrib/buildsystems/CMakeLists.txt | 30 +++++++++++++++----------
generate-script.sh | 34 +++++++++++++++++++++++++++++
4 files changed, 67 insertions(+), 35 deletions(-)
create mode 100755 generate-script.sh
diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in
index 050432f9fc4..9b95a6b3eee 100644
--- a/GIT-BUILD-OPTIONS.in
+++ b/GIT-BUILD-OPTIONS.in
@@ -36,3 +36,7 @@ GIT_INTEROP_MAKE_OPTS=@GIT_INTEROP_MAKE_OPTS@
GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@
GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@
RUNTIME_PREFIX=@RUNTIME_PREFIX@
+GITWEBDIR=@GITWEBDIR@
+USE_GETTEXT_SCHEME=@USE_GETTEXT_SCHEME@
+LOCALEDIR=@LOCALEDIR@
+BROKEN_PATH_FIX=@BROKEN_PATH_FIX@
diff --git a/Makefile b/Makefile
index fc13d5bb01c..2afad000762 100644
--- a/Makefile
+++ b/Makefile
@@ -1555,10 +1555,10 @@ endif
ifdef SANE_TOOL_PATH
SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH))
-BROKEN_PATH_FIX = 's|^\# @BROKEN_PATH_FIX@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|'
+BROKEN_PATH_FIX = s|^\# @BROKEN_PATH_FIX@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|
PATH := $(SANE_TOOL_PATH):${PATH}
else
-BROKEN_PATH_FIX = '/^\# @BROKEN_PATH_FIX@$$/d'
+BROKEN_PATH_FIX = /^\# @BROKEN_PATH_FIX@$$/d
endif
ifeq (,$(HOST_CPU))
@@ -2545,26 +2545,8 @@ GIT-SCRIPT-DEFINES: FORCE
echo "$$FLAGS" >$@; \
fi
-define cmd_munge_script
-sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
- -e 's|@DIFF@|$(DIFF_SQ)|' \
- -e 's|@LOCALEDIR@|$(localedir_SQ)|g' \
- -e 's/@USE_GETTEXT_SCHEME@/$(USE_GETTEXT_SCHEME)/g' \
- -e $(BROKEN_PATH_FIX) \
- -e 's|@GITWEBDIR@|$(gitwebdir_SQ)|g' \
- -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' \
- -e 's|@PAGER_ENV@|$(PAGER_ENV_SQ)|g' \
- $@.sh >$@+
-endef
-
-$(SCRIPT_SH_GEN) : % : %.sh GIT-SCRIPT-DEFINES
- $(QUIET_GEN)$(cmd_munge_script) && \
- chmod +x $@+ && \
- mv $@+ $@
-
-$(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEFINES
- $(QUIET_GEN)$(cmd_munge_script) && \
+$(SCRIPT_SH_GEN) $(SCRIPT_LIB) : % : %.sh generate-script.sh GIT-BUILD-OPTIONS GIT-SCRIPT-DEFINES
+ $(QUIET_GEN)./generate-script.sh "$<" "$@+" ./GIT-BUILD-OPTIONS && \
mv $@+ $@
git.res: git.rc GIT-VERSION-FILE GIT-PREFIX
@@ -2633,8 +2615,8 @@ GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile
perllibdir:
@echo '$(perllibdir_SQ)'
-git-instaweb: git-instaweb.sh GIT-SCRIPT-DEFINES
- $(QUIET_GEN)$(cmd_munge_script) && \
+git-instaweb: git-instaweb.sh generate-script.sh GIT-BUILD-OPTIONS GIT-SCRIPT-DEFINES
+ $(QUIET_GEN)./generate-script.sh "$<" "$@+" ./GIT-BUILD-OPTIONS && \
chmod +x $@+ && \
mv $@+ $@
else # NO_PERL
@@ -3191,6 +3173,10 @@ GIT-BUILD-OPTIONS: FORCE
-e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \
-e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \
-e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX)\'|" \
+ -e "s|@GITWEBDIR@|\'$(gitwebdir_SQ)\'|" \
+ -e "s|@USE_GETTEXT_SCHEME@|\'$(USE_GETTEXT_SCHEME)\'|" \
+ -e "s|@LOCALEDIR@|\'$(localedir_SQ)\'|" \
+ -e "s|@BROKEN_PATH_FIX@|\'$(BROKEN_PATH_FIX)\'|" \
GIT-BUILD-OPTIONS.in >$@+
@if grep -q '^[A-Z][A-Z_]*=@.*@$$' $@+; then echo "Unsubstituted build options in $@" >&2 && exit 1; fi
@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index ddf39dc90e7..2e22e87d188 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -834,18 +834,22 @@ set(git_shell_scripts
${git_sh_scripts} ${git_shlib_scripts} git-instaweb)
foreach(script ${git_shell_scripts})
- file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.sh content NEWLINE_CONSUME)
- string(REPLACE "@SHELL_PATH@" "${SHELL_PATH}" content "${content}")
- string(REPLACE "@DIFF@" "diff" content "${content}")
- string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}")
- string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" content "${content}")
- string(REPLACE "@NO_CURL@" "" content "${content}")
- string(REPLACE "@USE_GETTEXT_SCHEME@" "" content "${content}")
- string(REPLACE "# @BROKEN_PATH_FIX@" "" content "${content}")
- string(REPLACE "@PERL_PATH@" "${PERL_PATH}" content "${content}")
- string(REPLACE "@PAGER_ENV@" "LESS=FRX LV=-c" content "${content}")
- file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
+ if ("${script}" IN_LIST git_sh_scripts)
+ string(REPLACE ".sh" "" shell_gen_path "${script}")
+ else()
+ set(shell_gen_path "${script}")
+ endif()
+
+ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${shell_gen_path}
+ COMMAND ${CMAKE_SOURCE_DIR}/generate-script.sh
+ ${CMAKE_SOURCE_DIR}/${script}.sh
+ ${CMAKE_BINARY_DIR}/${shell_gen_path}
+ ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS
+ DEPENDS ${CMAKE_SOURCE_DIR}/generate-script.sh
+ ${CMAKE_SOURCE_DIR}/${script}.sh)
+ list(APPEND shell_gen ${CMAKE_BINARY_DIR}/${shell_gen_path})
endforeach()
+add_custom_target(shell-gen ALL DEPENDS ${shell_gen})
#perl scripts
parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" "")
@@ -1156,6 +1160,10 @@ string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_optio
string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}")
string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}")
string(REPLACE "@RUNTIME_PREFIX@" "${RUNTIME_PREFIX}" git_build_options "${git_build_options}")
+string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" git_build_options "${git_build_options}")
+string(REPLACE "@USE_GETTEXT_SCHEME@" "" git_build_options "${git_build_options}")
+string(REPLACE "@LOCALEDIR@" "LOCALEDIR" git_build_options "${git_build_options}")
+string(REPLACE "@BROKEN_PATH_FIX@" "" git_build_options "${git_build_options}")
if(USE_VCPKG)
string(APPEND git_build_options "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
endif()
diff --git a/generate-script.sh b/generate-script.sh
new file mode 100755
index 00000000000..d001e43d7bf
--- /dev/null
+++ b/generate-script.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+set -e
+
+if test $# -ne 3
+then
+ echo "USAGE: $0 <INPUT> <OUTPUT> <GIT-BUILD-OPTIONS>" >&2
+ exit 1
+fi
+
+INPUT="$1"
+OUTPUT="$2"
+BUILD_OPTIONS="$3"
+
+. "$BUILD_OPTIONS"
+
+sed -e "1s|#!.*/sh|#!$SHELL_PATH|" \
+ -e "s|@SHELL_PATH@|$SHELL_PATH|" \
+ -e "s|@DIFF@|$DIFF|" \
+ -e "s|@LOCALEDIR@|$LOCALEDIR|g" \
+ -e "s/@USE_GETTEXT_SCHEME@/$USE_GETTEXT_SCHEME/g" \
+ -e "$BROKEN_PATH_FIX" \
+ -e "s|@GITWEBDIR@|$GITWEBDIR|g" \
+ -e "s|@PERL_PATH@|$PERL_PATH|g" \
+ -e "s|@PAGER_ENV@|$PAGER_ENV|g" \
+ "$INPUT" >"$OUTPUT"
+
+case "$(basename "$INPUT")" in
+git-mergetool--lib.sh|git-sh-i18n.sh|git-sh-setup.sh)
+ ;;
+*)
+ chmod a+x "$OUTPUT"
+ ;;
+esac
--
2.47.0.118.gfd3785337b.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v4 07/19] Makefile: extract script to generate gitweb.cgi
2024-10-24 12:39 ` [RFC PATCH v4 00/19] " Patrick Steinhardt
` (5 preceding siblings ...)
2024-10-24 12:40 ` [RFC PATCH v4 06/19] Makefile: extract script to massage Shell scripts Patrick Steinhardt
@ 2024-10-24 12:40 ` Patrick Steinhardt
2024-10-24 12:40 ` [RFC PATCH v4 08/19] Makefile: refactor GIT-VERSION-GEN to be reusable Patrick Steinhardt
` (14 subsequent siblings)
21 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-24 12:40 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau
In order to generate "gitweb.cgi" we have to replace various different
placeholders. This is done ad-hoc and is thus not easily reusable across
different build systems.
Introduce a new GITWEB-BUILD-OPTIONS.in template that we populate at
configuration time with the expected options. This script is then used
as input for a new "generate-gitweb.sh" script that generates the final
"gitweb.cgi" file. While this requires us to repeat the options multiple
times, it is in line to how we generate other build options like our
GIT-BUILD-OPTIONS file.
While at it, refactor how we replace the GITWEB_PROJECT_MAXDEPTH. Even
though this variable is supposed to be an integer, the source file has
the value quoted. The quotes are eventually stripped via sed(1), which
replaces `"@GITWEB_PROJECT_MAXDEPTH@"` with the actual value, which is
rather nonsensical. This is made clearer by just dropping the quotes in
the source file.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
gitweb/GITWEB-BUILD-OPTIONS.in | 25 +++++++++++++++
gitweb/Makefile | 58 ++++++++++++++++------------------
gitweb/generate-gitweb.sh | 45 ++++++++++++++++++++++++++
gitweb/gitweb.perl | 2 +-
4 files changed, 99 insertions(+), 31 deletions(-)
create mode 100644 gitweb/GITWEB-BUILD-OPTIONS.in
create mode 100755 gitweb/generate-gitweb.sh
diff --git a/gitweb/GITWEB-BUILD-OPTIONS.in b/gitweb/GITWEB-BUILD-OPTIONS.in
new file mode 100644
index 00000000000..20a6487796f
--- /dev/null
+++ b/gitweb/GITWEB-BUILD-OPTIONS.in
@@ -0,0 +1,25 @@
+PERL_PATH=@PERL_PATH@
+JSMIN=@JSMIN@
+CSSMIN=@CSSMIN@
+GIT_VERSION=@GIT_VERSION@
+GIT_BINDIR=@GIT_BINDIR@
+GITWEB_CONFIG=@GITWEB_CONFIG@
+GITWEB_CONFIG_SYSTEM=@GITWEB_CONFIG_SYSTEM@
+GITWEB_CONFIG_COMMON=@GITWEB_CONFIG_COMMON@
+GITWEB_HOME_LINK_STR=@GITWEB_HOME_LINK_STR@
+GITWEB_SITENAME=@GITWEB_SITENAME@
+GITWEB_PROJECTROOT=@GITWEB_PROJECTROOT@
+GITWEB_PROJECT_MAXDEPTH=@GITWEB_PROJECT_MAXDEPTH@
+GITWEB_EXPORT_OK=@GITWEB_EXPORT_OK@
+GITWEB_STRICT_EXPORT=@GITWEB_STRICT_EXPORT@
+GITWEB_BASE_URL=@GITWEB_BASE_URL@
+GITWEB_LIST=@GITWEB_LIST@
+GITWEB_HOMETEXT=@GITWEB_HOMETEXT@
+GITWEB_CSS=@GITWEB_CSS@
+GITWEB_LOGO=@GITWEB_LOGO@
+GITWEB_FAVICON=@GITWEB_FAVICON@
+GITWEB_JS=@GITWEB_JS@
+GITWEB_SITE_HTML_HEAD_STRING=@GITWEB_SITE_HTML_HEAD_STRING@
+GITWEB_SITE_HEADER=@GITWEB_SITE_HEADER@
+GITWEB_SITE_FOOTER=@GITWEB_SITE_FOOTER@
+HIGHLIGHT_BIN=@HIGHLIGHT_BIN@
diff --git a/gitweb/Makefile b/gitweb/Makefile
index 164c8d53757..48c3958bc66 100644
--- a/gitweb/Makefile
+++ b/gitweb/Makefile
@@ -77,43 +77,41 @@ GITWEB_JSLIB_FILES += static/js/javascript-detection.js
GITWEB_JSLIB_FILES += static/js/adjust-timezone.js
GITWEB_JSLIB_FILES += static/js/blame_incremental.js
-
-GITWEB_REPLACE = \
- -e 's|@GIT_VERSION@|$(GIT_VERSION)|g' \
- -e 's|@GIT_BINDIR@|$(bindir)|g' \
- -e 's|@GITWEB_CONFIG@|$(GITWEB_CONFIG)|g' \
- -e 's|@GITWEB_CONFIG_SYSTEM@|$(GITWEB_CONFIG_SYSTEM)|g' \
- -e 's|@GITWEB_CONFIG_COMMON@|$(GITWEB_CONFIG_COMMON)|g' \
- -e 's|@GITWEB_HOME_LINK_STR@|$(GITWEB_HOME_LINK_STR)|g' \
- -e 's|@GITWEB_SITENAME@|$(GITWEB_SITENAME)|g' \
- -e 's|@GITWEB_PROJECTROOT@|$(GITWEB_PROJECTROOT)|g' \
- -e 's|"@GITWEB_PROJECT_MAXDEPTH@"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
- -e 's|@GITWEB_EXPORT_OK@|$(GITWEB_EXPORT_OK)|g' \
- -e 's|@GITWEB_STRICT_EXPORT@|$(GITWEB_STRICT_EXPORT)|g' \
- -e 's|@GITWEB_BASE_URL@|$(GITWEB_BASE_URL)|g' \
- -e 's|@GITWEB_LIST@|$(GITWEB_LIST)|g' \
- -e 's|@GITWEB_HOMETEXT@|$(GITWEB_HOMETEXT)|g' \
- -e 's|@GITWEB_CSS@|$(GITWEB_CSS)|g' \
- -e 's|@GITWEB_LOGO@|$(GITWEB_LOGO)|g' \
- -e 's|@GITWEB_FAVICON@|$(GITWEB_FAVICON)|g' \
- -e 's|@GITWEB_JS@|$(GITWEB_JS)|g' \
- -e 's|@GITWEB_SITE_HTML_HEAD_STRING@|$(GITWEB_SITE_HTML_HEAD_STRING)|g' \
- -e 's|@GITWEB_SITE_HEADER@|$(GITWEB_SITE_HEADER)|g' \
- -e 's|@GITWEB_SITE_FOOTER@|$(GITWEB_SITE_FOOTER)|g' \
- -e 's|@HIGHLIGHT_BIN@|$(HIGHLIGHT_BIN)|g'
-
.PHONY: FORCE
$(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS: FORCE
- @rm -f $@+
- @echo "x" '$(PERL_PATH_SQ)' $(GITWEB_REPLACE) "$(JSMIN)|$(CSSMIN)" >$@+
+ @sed -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|' \
+ -e 's|@JSMIN@|$(JSMIN)|' \
+ -e 's|@CSSMIN@|$(CSSMIN)|' \
+ -e 's|@GIT_VERSION@|$(GIT_VERSION)|' \
+ -e 's|@GIT_BINDIR@|$(bindir)|' \
+ -e 's|@GITWEB_CONFIG@|$(GITWEB_CONFIG)|' \
+ -e 's|@GITWEB_CONFIG_SYSTEM@|$(GITWEB_CONFIG_SYSTEM)|' \
+ -e 's|@GITWEB_CONFIG_COMMON@|$(GITWEB_CONFIG_COMMON)|' \
+ -e 's|@GITWEB_HOME_LINK_STR@|$(GITWEB_HOME_LINK_STR)|' \
+ -e 's|@GITWEB_SITENAME@|$(GITWEB_SITENAME)|' \
+ -e 's|@GITWEB_PROJECTROOT@|$(GITWEB_PROJECTROOT)|' \
+ -e 's|@GITWEB_PROJECT_MAXDEPTH@|$(GITWEB_PROJECT_MAXDEPTH)|' \
+ -e 's|@GITWEB_EXPORT_OK@|$(GITWEB_EXPORT_OK)|' \
+ -e 's|@GITWEB_STRICT_EXPORT@|$(GITWEB_STRICT_EXPORT)|' \
+ -e 's|@GITWEB_BASE_URL@|$(GITWEB_BASE_URL)|' \
+ -e 's|@GITWEB_LIST@|$(GITWEB_LIST)|' \
+ -e 's|@GITWEB_HOMETEXT@|$(GITWEB_HOMETEXT)|' \
+ -e 's|@GITWEB_CSS@|$(GITWEB_CSS)|' \
+ -e 's|@GITWEB_LOGO@|$(GITWEB_LOGO)|' \
+ -e 's|@GITWEB_FAVICON@|$(GITWEB_FAVICON)|' \
+ -e 's|@GITWEB_JS@|$(GITWEB_JS)|' \
+ -e 's|@GITWEB_SITE_HTML_HEAD_STRING@|$(GITWEB_SITE_HTML_HEAD_STRING)|' \
+ -e 's|@GITWEB_SITE_HEADER@|$(GITWEB_SITE_HEADER)|' \
+ -e 's|@GITWEB_SITE_FOOTER@|$(GITWEB_SITE_FOOTER)|' \
+ -e 's|@HIGHLIGHT_BIN@|$(HIGHLIGHT_BIN)|' \
+ $(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS.in >"$@+"
@cmp -s $@+ $@ && rm -f $@+ || mv -f $@+ $@
+$(MAK_DIR_GITWEB)gitweb.cgi: $(MAK_DIR_GITWEB)generate-gitweb.sh
$(MAK_DIR_GITWEB)gitweb.cgi: $(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS
$(MAK_DIR_GITWEB)gitweb.cgi: $(MAK_DIR_GITWEB)gitweb.perl
$(QUIET_GEN)$(RM) $@ $@+ && \
- sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
- $(GITWEB_REPLACE) $< >$@+ && \
- chmod +x $@+ && \
+ $(MAK_DIR_GITWEB)generate-gitweb.sh $(MAK_DIR_GITWEB)/GITWEB-BUILD-OPTIONS $< $@+ && \
mv $@+ $@
$(MAK_DIR_GITWEB)static/gitweb.js: $(addprefix $(MAK_DIR_GITWEB),$(GITWEB_JSLIB_FILES))
diff --git a/gitweb/generate-gitweb.sh b/gitweb/generate-gitweb.sh
new file mode 100755
index 00000000000..b47ea6e599e
--- /dev/null
+++ b/gitweb/generate-gitweb.sh
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+set -e
+
+if test $# -ne 3
+then
+ echo "USAGE: $0 <GITWEB-BUILD-OPTIONS> <INPUT> <OUTPUT>" >&2
+ exit 1
+fi
+
+GITWEB_BUILD_OPTIONS="$1"
+INPUT="$2"
+OUTPUT="$3"
+
+. "$GITWEB_BUILD_OPTIONS"
+
+sed -e "1s|#!/usr/bin/perl|#!$PERL_PATH|" \
+ -e "s|@PERL_PATH@|$PERL_PATH|" \
+ -e "s|@JSMIN@|$JSMIN|" \
+ -e "s|@CSSMIN@|$CSSMIN|" \
+ -e "s|@GIT_VERSION@|$GIT_VERSION|" \
+ -e "s|@GIT_BINDIR@|$GIT_BINDIR|" \
+ -e "s|@GITWEB_CONFIG@|$GITWEB_CONFIG|" \
+ -e "s|@GITWEB_CONFIG_SYSTEM@|$GITWEB_CONFIG_SYSTEM|" \
+ -e "s|@GITWEB_CONFIG_COMMON@|$GITWEB_CONFIG_COMMON|" \
+ -e "s|@GITWEB_HOME_LINK_STR@|$GITWEB_HOME_LINK_STR|" \
+ -e "s|@GITWEB_SITENAME@|$GITWEB_SITENAME|" \
+ -e "s|@GITWEB_PROJECTROOT@|$GITWEB_PROJECTROOT|" \
+ -e "s|@GITWEB_PROJECT_MAXDEPTH@|$GITWEB_PROJECT_MAXDEPTH|" \
+ -e "s|@GITWEB_EXPORT_OK@|$GITWEB_EXPORT_OK|" \
+ -e "s|@GITWEB_STRICT_EXPORT@|$GITWEB_STRICT_EXPORT|" \
+ -e "s|@GITWEB_BASE_URL@|$GITWEB_BASE_URL|" \
+ -e "s|@GITWEB_LIST@|$GITWEB_LIST|" \
+ -e "s|@GITWEB_HOMETEXT@|$GITWEB_HOMETEXT|" \
+ -e "s|@GITWEB_CSS@|$GITWEB_CSS|" \
+ -e "s|@GITWEB_LOGO@|$GITWEB_LOGO|" \
+ -e "s|@GITWEB_FAVICON@|$GITWEB_FAVICON|" \
+ -e "s|@GITWEB_JS@|$GITWEB_JS|" \
+ -e "s|@GITWEB_SITE_HTML_HEAD_STRING@|$GITWEB_SITE_HTML_HEAD_STRING|" \
+ -e "s|@GITWEB_SITE_HEADER@|$GITWEB_SITE_HEADER|" \
+ -e "s|@GITWEB_SITE_FOOTER@|$GITWEB_SITE_FOOTER|" \
+ -e "s|@HIGHLIGHT_BIN@|$HIGHLIGHT_BIN|" \
+ "$INPUT" >"$OUTPUT"
+
+chmod a+x "$OUTPUT"
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 76e1f4e244f..41bc64ec73f 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -88,7 +88,7 @@ sub evaluate_uri {
# fs traversing limit for getting project list
# the number is relative to the projectroot
-our $project_maxdepth = "@GITWEB_PROJECT_MAXDEPTH@";
+our $project_maxdepth = @GITWEB_PROJECT_MAXDEPTH@;
# string of the home link on top of all pages
our $home_link_str = "@GITWEB_HOME_LINK_STR@";
--
2.47.0.118.gfd3785337b.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v4 08/19] Makefile: refactor GIT-VERSION-GEN to be reusable
2024-10-24 12:39 ` [RFC PATCH v4 00/19] " Patrick Steinhardt
` (6 preceding siblings ...)
2024-10-24 12:40 ` [RFC PATCH v4 07/19] Makefile: extract script to generate gitweb.cgi Patrick Steinhardt
@ 2024-10-24 12:40 ` Patrick Steinhardt
2024-10-24 12:40 ` [RFC PATCH v4 09/19] Makefile: refactor generators to be PWD-independent Patrick Steinhardt
` (13 subsequent siblings)
21 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-24 12:40 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau
Our "GIT-VERSION-GEN" script always writes the "GIT-VERSION-FILE" into
the current directory, where the expectation is that it should exist in
the source directory. But other build systems that support out-of-tree
builds may not want to do that to keep the source directory pristine,
even though CMake currently doesn't care.
Refactor the script such that it doesn't write output to a file anymore
but so that it instead writes the version to stdout. This makes it
easier to compute the same version as our Makefile would without having
to write the "GIT-VERSION-FILE".
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-VERSION-GEN | 12 +-----------
Makefile | 3 ++-
contrib/buildsystems/CMakeLists.txt | 12 ++++--------
3 files changed, 7 insertions(+), 20 deletions(-)
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index 78e8631f677..671f853512a 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -1,6 +1,5 @@
#!/bin/sh
-GVF=GIT-VERSION-FILE
DEF_VER=v2.47.GIT
LF='
@@ -28,13 +27,4 @@ fi
VN=$(expr "$VN" : v*'\(.*\)')
-if test -r $GVF
-then
- VC=$(sed -e 's/^GIT_VERSION = //' <$GVF)
-else
- VC=unset
-fi
-test "$VN" = "$VC" || {
- echo >&2 "GIT_VERSION = $VN"
- echo "GIT_VERSION = $VN" >$GVF
-}
+echo "$VN"
diff --git a/Makefile b/Makefile
index 2afad000762..461f0216bf6 100644
--- a/Makefile
+++ b/Makefile
@@ -592,7 +592,8 @@ include shared.mak
# Disable -pedantic compilation.
GIT-VERSION-FILE: FORCE
- @$(SHELL_PATH) ./GIT-VERSION-GEN
+ @printf "GIT_VERSION = %s\n" $$($(SHELL_PATH) GIT-VERSION-GEN) >$@+
+ @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else cat $@+ >&2 && mv $@+ $@; fi
-include GIT-VERSION-FILE
# Set our default configuration.
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 2e22e87d188..e1200f294de 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -83,16 +83,12 @@ if(NOT SH_EXE)
"On Windows, you can get it as part of 'Git for Windows' install at https://gitforwindows.org/")
endif()
-#Create GIT-VERSION-FILE using GIT-VERSION-GEN
-if(NOT EXISTS ${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE)
- message("Generating GIT-VERSION-FILE")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
-endif()
+execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ OUTPUT_VARIABLE git_version
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
#Parse GIT-VERSION-FILE to get the version
-file(STRINGS ${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE git_version REGEX "GIT_VERSION = (.*)")
-string(REPLACE "GIT_VERSION = " "" git_version ${git_version})
string(FIND ${git_version} "GIT" location)
if(location EQUAL -1)
string(REGEX MATCH "[0-9]*\\.[0-9]*\\.[0-9]*" git_version ${git_version})
--
2.47.0.118.gfd3785337b.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v4 09/19] Makefile: refactor generators to be PWD-independent
2024-10-24 12:39 ` [RFC PATCH v4 00/19] " Patrick Steinhardt
` (7 preceding siblings ...)
2024-10-24 12:40 ` [RFC PATCH v4 08/19] Makefile: refactor GIT-VERSION-GEN to be reusable Patrick Steinhardt
@ 2024-10-24 12:40 ` Patrick Steinhardt
2024-10-24 12:40 ` [RFC PATCH v4 10/19] Makefile: allow "bin-wrappers/" directory to exist Patrick Steinhardt
` (12 subsequent siblings)
21 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-24 12:40 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau
We have multiple scripts that generate headers from other data. All of
these scripts have the assumption built-in that they are executed in the
current source directory, which makes them a bit unwieldy to use during
out-of-tree builds.
Refactor them to instead take the source directory as well as the output
file as arguments.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 6 ++---
contrib/buildsystems/CMakeLists.txt | 12 +++------
generate-cmdlist.sh | 42 ++++++++++++++++++-----------
generate-configlist.sh | 20 ++++++++++----
generate-hooklist.sh | 15 ++++++++++-
5 files changed, 61 insertions(+), 34 deletions(-)
diff --git a/Makefile b/Makefile
index 461f0216bf6..975c18dfb8f 100644
--- a/Makefile
+++ b/Makefile
@@ -2523,17 +2523,17 @@ $(BUILT_INS): git$X
config-list.h: generate-configlist.sh
config-list.h: Documentation/*config.txt Documentation/config/*.txt
- $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh >$@
+ $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh . $@
command-list.h: generate-cmdlist.sh command-list.txt
command-list.h: $(wildcard Documentation/git*.txt)
$(QUIET_GEN)$(SHELL_PATH) ./generate-cmdlist.sh \
$(patsubst %,--exclude-program %,$(EXCLUDED_PROGRAMS)) \
- command-list.txt >$@
+ . $@
hook-list.h: generate-hooklist.sh Documentation/githooks.txt
- $(QUIET_GEN)$(SHELL_PATH) ./generate-hooklist.sh >$@
+ $(QUIET_GEN)$(SHELL_PATH) ./generate-hooklist.sh . $@
SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):\
$(localedir_SQ):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index e1200f294de..f4ffe64965d 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -648,23 +648,17 @@ set(EXCLUSION_PROGS_CACHE ${EXCLUSION_PROGS} CACHE STRING "Programs not built" F
if(NOT EXISTS ${CMAKE_BINARY_DIR}/command-list.h OR NOT EXCLUSION_PROGS_CACHE STREQUAL EXCLUSION_PROGS)
list(REMOVE_ITEM EXCLUSION_PROGS empty)
message("Generating command-list.h")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-cmdlist.sh ${EXCLUSION_PROGS} command-list.txt
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_FILE ${CMAKE_BINARY_DIR}/command-list.h)
+ execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-cmdlist.sh ${EXCLUSION_PROGS} ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}/command-list.h)
endif()
if(NOT EXISTS ${CMAKE_BINARY_DIR}/config-list.h)
message("Generating config-list.h")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-configlist.sh
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_FILE ${CMAKE_BINARY_DIR}/config-list.h)
+ execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-configlist.sh ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}/config-list.h)
endif()
if(NOT EXISTS ${CMAKE_BINARY_DIR}/hook-list.h)
message("Generating hook-list.h")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-hooklist.sh
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_FILE ${CMAKE_BINARY_DIR}/hook-list.h)
+ execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-hooklist.sh ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}/hook-list.h)
endif()
include_directories(${CMAKE_BINARY_DIR})
diff --git a/generate-cmdlist.sh b/generate-cmdlist.sh
index 205541e0f7f..b923a5aab80 100755
--- a/generate-cmdlist.sh
+++ b/generate-cmdlist.sh
@@ -64,7 +64,7 @@ define_category_names () {
print_command_list () {
echo "static struct cmdname_help command_list[] = {"
- echo "$1" |
+ echo "$2" |
while read cmd rest
do
synopsis=
@@ -76,7 +76,7 @@ print_command_list () {
break
;;
esac
- done <"Documentation/$cmd.txt"
+ done <"$1/Documentation/$cmd.txt"
printf '\t{ "%s", N_("%s"), 0' "$cmd" "$synopsis"
printf " | CAT_%s" $rest
@@ -93,18 +93,28 @@ do
shift
done
-commands="$(command_list "$1")"
-categories="$(category_list "$commands")"
+if test "$#" -ne 2
+then
+ die "USAGE: $0 <SOURCE_DIR> <OUTPUT>"
+fi
+
+SOURCE_DIR="$1"
+OUTPUT="$2"
+
+{
+ commands="$(command_list "$SOURCE_DIR"/command-list.txt)"
+ categories="$(category_list "$commands")"
-echo "/* Automatically generated by generate-cmdlist.sh */
-struct cmdname_help {
- const char *name;
- const char *help;
- uint32_t category;
-};
-"
-define_categories "$categories"
-echo
-define_category_names "$categories"
-echo
-print_command_list "$commands"
+ echo "/* Automatically generated by generate-cmdlist.sh */
+ struct cmdname_help {
+ const char *name;
+ const char *help;
+ uint32_t category;
+ };
+ "
+ define_categories "$categories"
+ echo
+ define_category_names "$categories"
+ echo
+ print_command_list "$SOURCE_DIR" "$commands"
+} >"$OUTPUT"
diff --git a/generate-configlist.sh b/generate-configlist.sh
index 8692fe5cf4d..512804a1ca1 100755
--- a/generate-configlist.sh
+++ b/generate-configlist.sh
@@ -1,13 +1,19 @@
#!/bin/sh
-echo "/* Automatically generated by generate-configlist.sh */"
-echo
+SOURCE_DIR="$1"
+OUTPUT="$2"
+
+if test -z "$SOURCE_DIR" || ! test -d "$SOURCE_DIR" || test -z "$OUTPUT"
+then
+ echo "USAGE: $0 <SOURCE_DIR> <OUTPUT>" >&2
+ exit 1
+fi
print_config_list () {
cat <<EOF
static const char *config_name_list[] = {
EOF
- grep -h '^[a-zA-Z].*\..*::$' Documentation/*config.txt Documentation/config/*.txt |
+ grep -h '^[a-zA-Z].*\..*::$' "$SOURCE_DIR"/Documentation/*config.txt "$SOURCE_DIR"/Documentation/config/*.txt |
sed '/deprecated/d; s/::$//; s/, */\n/g' |
sort |
sed 's/^.*$/ "&",/'
@@ -17,5 +23,9 @@ EOF
EOF
}
-echo
-print_config_list
+{
+ echo "/* Automatically generated by generate-configlist.sh */"
+ echo
+ echo
+ print_config_list
+} >"$OUTPUT"
diff --git a/generate-hooklist.sh b/generate-hooklist.sh
index 2f9f54eb545..0ff2a0b6fbd 100755
--- a/generate-hooklist.sh
+++ b/generate-hooklist.sh
@@ -2,6 +2,17 @@
#
# Usage: ./generate-hooklist.sh >hook-list.h
+SOURCE_DIR="$1"
+OUTPUT="$2"
+
+if test -z "$SOURCE_DIR" || ! test -d "$SOURCE_DIR" || test -z "$OUTPUT"
+then
+ echo "USAGE: $0 <SOURCE_DIR> <OUTPUT>" >&2
+ exit 1
+fi
+
+{
+
cat <<EOF
/* Automatically generated by generate-hooklist.sh */
@@ -11,10 +22,12 @@ EOF
sed -n \
-e '/^~~~~*$/ {x; s/^.*$/ "&",/; p;}' \
-e 'x' \
- <Documentation/githooks.txt |
+ <"$SOURCE_DIR"/Documentation/githooks.txt |
LC_ALL=C sort
cat <<EOF
NULL,
};
EOF
+
+} >"$OUTPUT"
--
2.47.0.118.gfd3785337b.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v4 10/19] Makefile: allow "bin-wrappers/" directory to exist
2024-10-24 12:39 ` [RFC PATCH v4 00/19] " Patrick Steinhardt
` (8 preceding siblings ...)
2024-10-24 12:40 ` [RFC PATCH v4 09/19] Makefile: refactor generators to be PWD-independent Patrick Steinhardt
@ 2024-10-24 12:40 ` Patrick Steinhardt
2024-10-24 12:40 ` [RFC PATCH v4 11/19] Makefile: simplify building of templates Patrick Steinhardt
` (11 subsequent siblings)
21 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-24 12:40 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau
The "bin-wrappers/" directory gets created by our build system and is
populated with one script for each of our binaries. There isn't anything
inherently wrong with the current layout, but it is somewhat hard to
adapt for out-of-tree build systems.
Adapt the layout such that our "bin-wrappers/" directory always exists
and contains our "wrap-for-bin.sh" script to make things a little bit
easier for subsequent steps.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
.gitignore | 1 -
Documentation/CodingGuidelines | 2 +-
Makefile | 6 +++---
bin-wrappers/.gitignore | 9 +++++++++
wrap-for-bin.sh => bin-wrappers/wrap-for-bin.sh | 0
contrib/buildsystems/CMakeLists.txt | 6 +++---
6 files changed, 16 insertions(+), 8 deletions(-)
create mode 100644 bin-wrappers/.gitignore
rename wrap-for-bin.sh => bin-wrappers/wrap-for-bin.sh (100%)
mode change 100644 => 100755
diff --git a/.gitignore b/.gitignore
index 6687bd6db4c..349673c55c9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,7 +12,6 @@
/GIT-TEST-SUITES
/GIT-USER-AGENT
/GIT-VERSION-FILE
-/bin-wrappers/
/git
/git-add
/git-am
diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
index 30fda4142ca..982b705f0d8 100644
--- a/Documentation/CodingGuidelines
+++ b/Documentation/CodingGuidelines
@@ -583,7 +583,7 @@ For C programs:
Run `GIT_DEBUGGER=1 ./bin-wrappers/git foo` to simply use gdb as is, or
run `GIT_DEBUGGER="<debugger> <debugger-args>" ./bin-wrappers/git foo` to
use your own debugger and arguments. Example: `GIT_DEBUGGER="ddd --gdb"
- ./bin-wrappers/git log` (See `wrap-for-bin.sh`.)
+ ./bin-wrappers/git log` (See `bin-wrappers/wrap-for-bin.sh`.)
- The primary data structure that a subsystem 'S' deals with is called
`struct S`. Functions that operate on `struct S` are named
diff --git a/Makefile b/Makefile
index 975c18dfb8f..c409a0e1b7d 100644
--- a/Makefile
+++ b/Makefile
@@ -3199,8 +3199,7 @@ test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $(
all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PROG)
-bin-wrappers/%: wrap-for-bin.sh
- $(call mkdir_p_parent_template)
+$(test_bindir_programs): bin-wrappers/%: bin-wrappers/wrap-for-bin.sh
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@BUILD_DIR@|$(shell pwd)|' \
-e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
@@ -3696,7 +3695,8 @@ clean: profile-clean coverage-clean cocciclean
$(RM) $(FUZZ_PROGRAMS)
$(RM) $(SP_OBJ)
$(RM) $(HCC)
- $(RM) -r bin-wrappers $(dep_dirs) $(compdb_dir) compile_commands.json
+ $(RM) -r $(dep_dirs) $(compdb_dir) compile_commands.json
+ $(RM) $(test_bindir_programs)
$(RM) -r po/build/
$(RM) *.pyc *.pyo */*.pyc */*.pyo $(GENERATED_H) $(ETAGS_TARGET) tags cscope*
$(RM) -r .dist-tmp-dir .doc-tmp-dir
diff --git a/bin-wrappers/.gitignore b/bin-wrappers/.gitignore
new file mode 100644
index 00000000000..1c6c90458b7
--- /dev/null
+++ b/bin-wrappers/.gitignore
@@ -0,0 +1,9 @@
+/git
+/git-cvsserver
+/git-receive-pack
+/git-shell
+/git-upload-archive
+/git-upload-pack
+/scalar
+/test-fake-ssh
+/test-tool
diff --git a/wrap-for-bin.sh b/bin-wrappers/wrap-for-bin.sh
old mode 100644
new mode 100755
similarity index 100%
rename from wrap-for-bin.sh
rename to bin-wrappers/wrap-for-bin.sh
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index f4ffe64965d..fdf0c0ff769 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -1049,20 +1049,20 @@ set(wrapper_test_scripts
foreach(script ${wrapper_scripts})
- file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
+ file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
string(REPLACE "@PROG@" "${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
foreach(script ${wrapper_test_scripts})
- file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
+ file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
string(REPLACE "@PROG@" "t/helper/${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
-file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
+file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
string(REPLACE "@PROG@" "git-cvsserver" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})
--
2.47.0.118.gfd3785337b.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v4 11/19] Makefile: simplify building of templates
2024-10-24 12:39 ` [RFC PATCH v4 00/19] " Patrick Steinhardt
` (9 preceding siblings ...)
2024-10-24 12:40 ` [RFC PATCH v4 10/19] Makefile: allow "bin-wrappers/" directory to exist Patrick Steinhardt
@ 2024-10-24 12:40 ` Patrick Steinhardt
2024-10-24 12:40 ` [RFC PATCH v4 12/19] Documentation: allow sourcing generated includes from separate dir Patrick Steinhardt
` (10 subsequent siblings)
21 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-24 12:40 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau
When we install Git we also install a set of default templates that both
git-init(1) and git-clone(1) populate into our build directories. The
way the pristine templates are laid out in our source directory is
somewhat weird though: instead of reconstructing the actual directory
hierarchy in "templates/", we represent directory separators with "--".
The only reason I could come up with for why we have this is the
"branches/" directory, which is supposed to be empty when installing it.
And as Git famously doesn't store empty directories at all we have to
work around this limitation.
Now the thing is that the "branches/" directory is a leftover to how
branches used to be stored in the dark ages. gitrepository-layout(5)
lists this directory as "slightly deprecated", which I would claim is a
strong understatement. I have never encountered anybody using it today
and would be surprised if it even works as expected. So having the "--"
hack in place for an item that is basically unused, unmaintained and
deprecated doesn't only feel unreasonable, but installing that entry by
default may also cause confusion for users that do not know what this is
supposed to be in the first place.
Remove this directory from our templates and, now that we do not require
the workaround anymore, restructure the templates to form a proper
hierarchy. This makes it way easier for build systems to install these
templates into place.
We should likely think about removing support for "branch/" altogether,
but that is outside of the scope of this patch series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
contrib/buildsystems/CMakeLists.txt | 34 ++++++----------
templates/Makefile | 39 ++++++++++++-------
templates/branches-- | 1 -
templates/{this--description => description} | 0
.../applypatch-msg.sample} | 0
.../commit-msg.sample} | 0
.../fsmonitor-watchman.sample} | 0
.../post-update.sample} | 0
.../pre-applypatch.sample} | 0
.../pre-commit.sample} | 0
.../pre-merge-commit.sample} | 0
.../pre-push.sample} | 0
.../pre-rebase.sample} | 0
.../pre-receive.sample} | 0
.../prepare-commit-msg.sample} | 0
.../push-to-checkout.sample} | 0
.../sendemail-validate.sample} | 0
.../update.sample} | 0
templates/{info--exclude => info/exclude} | 0
19 files changed, 37 insertions(+), 37 deletions(-)
delete mode 100644 templates/branches--
rename templates/{this--description => description} (100%)
rename templates/{hooks--applypatch-msg.sample => hooks/applypatch-msg.sample} (100%)
rename templates/{hooks--commit-msg.sample => hooks/commit-msg.sample} (100%)
rename templates/{hooks--fsmonitor-watchman.sample => hooks/fsmonitor-watchman.sample} (100%)
rename templates/{hooks--post-update.sample => hooks/post-update.sample} (100%)
rename templates/{hooks--pre-applypatch.sample => hooks/pre-applypatch.sample} (100%)
rename templates/{hooks--pre-commit.sample => hooks/pre-commit.sample} (100%)
rename templates/{hooks--pre-merge-commit.sample => hooks/pre-merge-commit.sample} (100%)
rename templates/{hooks--pre-push.sample => hooks/pre-push.sample} (100%)
rename templates/{hooks--pre-rebase.sample => hooks/pre-rebase.sample} (100%)
rename templates/{hooks--pre-receive.sample => hooks/pre-receive.sample} (100%)
rename templates/{hooks--prepare-commit-msg.sample => hooks/prepare-commit-msg.sample} (100%)
rename templates/{hooks--push-to-checkout.sample => hooks/push-to-checkout.sample} (100%)
rename templates/{hooks--sendemail-validate.sample => hooks/sendemail-validate.sample} (100%)
rename templates/{hooks--update.sample => hooks/update.sample} (100%)
rename templates/{info--exclude => info/exclude} (100%)
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index fdf0c0ff769..ad4e3f0b6ce 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -106,8 +106,8 @@ project(git
#TODO Enable NLS on windows natively
#macros for parsing the Makefile for sources and scripts
-macro(parse_makefile_for_sources list_var regex)
- file(STRINGS ${CMAKE_SOURCE_DIR}/Makefile ${list_var} REGEX "^${regex} \\+=(.*)")
+macro(parse_makefile_for_sources list_var makefile regex)
+ file(STRINGS ${makefile} ${list_var} REGEX "^${regex} \\+=(.*)")
string(REPLACE "${regex} +=" "" ${list_var} ${${list_var}})
string(REPLACE "$(COMPAT_OBJS)" "" ${list_var} ${${list_var}}) #remove "$(COMPAT_OBJS)" This is only for libgit.
string(STRIP ${${list_var}} ${list_var}) #remove trailing/leading whitespaces
@@ -665,20 +665,20 @@ include_directories(${CMAKE_BINARY_DIR})
#build
#libgit
-parse_makefile_for_sources(libgit_SOURCES "LIB_OBJS")
+parse_makefile_for_sources(libgit_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "LIB_OBJS")
list(TRANSFORM libgit_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
list(TRANSFORM compat_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
add_library(libgit ${libgit_SOURCES} ${compat_SOURCES})
#libxdiff
-parse_makefile_for_sources(libxdiff_SOURCES "XDIFF_OBJS")
+parse_makefile_for_sources(libxdiff_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "XDIFF_OBJS")
list(TRANSFORM libxdiff_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
add_library(xdiff STATIC ${libxdiff_SOURCES})
#reftable
-parse_makefile_for_sources(reftable_SOURCES "REFTABLE_OBJS")
+parse_makefile_for_sources(reftable_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "REFTABLE_OBJS")
list(TRANSFORM reftable_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
add_library(reftable STATIC ${reftable_SOURCES})
@@ -742,7 +742,7 @@ elseif(UNIX)
endif()
#git
-parse_makefile_for_sources(git_SOURCES "BUILTIN_OBJS")
+parse_makefile_for_sources(git_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "BUILTIN_OBJS")
list(TRANSFORM git_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
add_executable(git ${CMAKE_SOURCE_DIR}/git.c ${git_SOURCES})
@@ -874,24 +874,14 @@ file(STRINGS ${CMAKE_SOURCE_DIR}/git-p4.py content NEWLINE_CONSUME)
string(REPLACE "#!/usr/bin/env python" "#!/usr/bin/python" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/git-p4 ${content})
-#templates
-file(GLOB templates "${CMAKE_SOURCE_DIR}/templates/*")
-list(TRANSFORM templates REPLACE "${CMAKE_SOURCE_DIR}/templates/" "")
-list(REMOVE_ITEM templates ".gitignore")
-list(REMOVE_ITEM templates "Makefile")
-list(REMOVE_ITEM templates "blt")# Prevents an error when reconfiguring for in source builds
-
-list(REMOVE_ITEM templates "branches--")
-file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/templates/blt/branches) #create branches
-
+#${CMAKE_SOURCE_DIR}/Makefile templates
+parse_makefile_for_sources(templates ${CMAKE_SOURCE_DIR}/templates/Makefile "TEMPLATES")
+string(REPLACE " " ";" templates ${templates})
#templates have @.*@ replacement so use configure_file instead
foreach(tm ${templates})
- string(REPLACE "--" "/" blt_tm ${tm})
- string(REPLACE "this" "" blt_tm ${blt_tm})# for this--
- configure_file(${CMAKE_SOURCE_DIR}/templates/${tm} ${CMAKE_BINARY_DIR}/templates/blt/${blt_tm} @ONLY)
+ configure_file(${CMAKE_SOURCE_DIR}/templates/${tm} ${CMAKE_BINARY_DIR}/templates/blt/${tm} @ONLY)
endforeach()
-
#translations
if(MSGFMT_EXE)
file(GLOB po_files "${CMAKE_SOURCE_DIR}/po/*.po")
@@ -965,7 +955,7 @@ add_executable(test-fake-ssh ${CMAKE_SOURCE_DIR}/t/helper/test-fake-ssh.c)
target_link_libraries(test-fake-ssh common-main)
#unit-tests
-parse_makefile_for_sources(unit-test_SOURCES "UNIT_TEST_OBJS")
+parse_makefile_for_sources(unit-test_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "UNIT_TEST_OBJS")
list(TRANSFORM unit-test_SOURCES REPLACE "\\$\\(UNIT_TEST_DIR\\)/" "${CMAKE_SOURCE_DIR}/t/unit-tests/")
add_library(unit-test-lib STATIC ${unit-test_SOURCES})
@@ -1023,7 +1013,7 @@ if(MSVC)
endif()
#test-tool
-parse_makefile_for_sources(test-tool_SOURCES "TEST_BUILTINS_OBJS")
+parse_makefile_for_sources(test-tool_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "TEST_BUILTINS_OBJS")
add_library(test-lib OBJECT ${CMAKE_SOURCE_DIR}/t/unit-tests/test-lib.c)
list(TRANSFORM test-tool_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/t/helper/")
diff --git a/templates/Makefile b/templates/Makefile
index 367ad00c24c..bd1e9e30c12 100644
--- a/templates/Makefile
+++ b/templates/Makefile
@@ -29,24 +29,35 @@ all: boilerplates.made custom
# in a file direc--tory--file in the source. They will be
# just copied to the destination.
-bpsrc = $(filter-out %~,$(wildcard *--*))
-boilerplates.made : $(bpsrc)
- $(QUIET)umask 022 && ls *--* 2>/dev/null | \
- while read boilerplate; \
+TEMPLATES =
+TEMPLATES += description
+TEMPLATES += hooks/applypatch-msg.sample
+TEMPLATES += hooks/commit-msg.sample
+TEMPLATES += hooks/fsmonitor-watchman.sample
+TEMPLATES += hooks/post-update.sample
+TEMPLATES += hooks/pre-applypatch.sample
+TEMPLATES += hooks/pre-commit.sample
+TEMPLATES += hooks/pre-merge-commit.sample
+TEMPLATES += hooks/prepare-commit-msg.sample
+TEMPLATES += hooks/pre-push.sample
+TEMPLATES += hooks/pre-rebase.sample
+TEMPLATES += hooks/pre-receive.sample
+TEMPLATES += hooks/push-to-checkout.sample
+TEMPLATES += hooks/sendemail-validate.sample
+TEMPLATES += hooks/update.sample
+TEMPLATES += info/exclude
+
+boilerplates.made: $(TEMPLATES)
+ $(QUIET)umask 022 && for template in $(TEMPLATES); \
do \
- case "$$boilerplate" in *~) continue ;; esac && \
- dst=`echo "$$boilerplate" | sed -e 's|^this|.|;s|--|/|g'` && \
- dir=`expr "$$dst" : '\(.*\)/'` && \
+ dir=$$(dirname "$$template") && \
mkdir -p blt/$$dir && \
- case "$$boilerplate" in \
- *--) continue;; \
- esac && \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
- -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' $$boilerplate > \
- blt/$$dst && \
- if test -x "$$boilerplate"; then rx=rx; else rx=r; fi && \
- chmod a+$$rx "blt/$$dst" || exit; \
+ -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' $$template > \
+ blt/$$template && \
+ if test -x "$$template"; then rx=rx; else rx=r; fi && \
+ chmod a+$$rx "blt/$$template" || exit; \
done && \
date >$@
diff --git a/templates/branches-- b/templates/branches--
deleted file mode 100644
index fae88709a63..00000000000
--- a/templates/branches--
+++ /dev/null
@@ -1 +0,0 @@
-: this is just to ensure the directory exists.
diff --git a/templates/this--description b/templates/description
similarity index 100%
rename from templates/this--description
rename to templates/description
diff --git a/templates/hooks--applypatch-msg.sample b/templates/hooks/applypatch-msg.sample
similarity index 100%
rename from templates/hooks--applypatch-msg.sample
rename to templates/hooks/applypatch-msg.sample
diff --git a/templates/hooks--commit-msg.sample b/templates/hooks/commit-msg.sample
similarity index 100%
rename from templates/hooks--commit-msg.sample
rename to templates/hooks/commit-msg.sample
diff --git a/templates/hooks--fsmonitor-watchman.sample b/templates/hooks/fsmonitor-watchman.sample
similarity index 100%
rename from templates/hooks--fsmonitor-watchman.sample
rename to templates/hooks/fsmonitor-watchman.sample
diff --git a/templates/hooks--post-update.sample b/templates/hooks/post-update.sample
similarity index 100%
rename from templates/hooks--post-update.sample
rename to templates/hooks/post-update.sample
diff --git a/templates/hooks--pre-applypatch.sample b/templates/hooks/pre-applypatch.sample
similarity index 100%
rename from templates/hooks--pre-applypatch.sample
rename to templates/hooks/pre-applypatch.sample
diff --git a/templates/hooks--pre-commit.sample b/templates/hooks/pre-commit.sample
similarity index 100%
rename from templates/hooks--pre-commit.sample
rename to templates/hooks/pre-commit.sample
diff --git a/templates/hooks--pre-merge-commit.sample b/templates/hooks/pre-merge-commit.sample
similarity index 100%
rename from templates/hooks--pre-merge-commit.sample
rename to templates/hooks/pre-merge-commit.sample
diff --git a/templates/hooks--pre-push.sample b/templates/hooks/pre-push.sample
similarity index 100%
rename from templates/hooks--pre-push.sample
rename to templates/hooks/pre-push.sample
diff --git a/templates/hooks--pre-rebase.sample b/templates/hooks/pre-rebase.sample
similarity index 100%
rename from templates/hooks--pre-rebase.sample
rename to templates/hooks/pre-rebase.sample
diff --git a/templates/hooks--pre-receive.sample b/templates/hooks/pre-receive.sample
similarity index 100%
rename from templates/hooks--pre-receive.sample
rename to templates/hooks/pre-receive.sample
diff --git a/templates/hooks--prepare-commit-msg.sample b/templates/hooks/prepare-commit-msg.sample
similarity index 100%
rename from templates/hooks--prepare-commit-msg.sample
rename to templates/hooks/prepare-commit-msg.sample
diff --git a/templates/hooks--push-to-checkout.sample b/templates/hooks/push-to-checkout.sample
similarity index 100%
rename from templates/hooks--push-to-checkout.sample
rename to templates/hooks/push-to-checkout.sample
diff --git a/templates/hooks--sendemail-validate.sample b/templates/hooks/sendemail-validate.sample
similarity index 100%
rename from templates/hooks--sendemail-validate.sample
rename to templates/hooks/sendemail-validate.sample
diff --git a/templates/hooks--update.sample b/templates/hooks/update.sample
similarity index 100%
rename from templates/hooks--update.sample
rename to templates/hooks/update.sample
diff --git a/templates/info--exclude b/templates/info/exclude
similarity index 100%
rename from templates/info--exclude
rename to templates/info/exclude
--
2.47.0.118.gfd3785337b.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v4 12/19] Documentation: allow sourcing generated includes from separate dir
2024-10-24 12:39 ` [RFC PATCH v4 00/19] " Patrick Steinhardt
` (10 preceding siblings ...)
2024-10-24 12:40 ` [RFC PATCH v4 11/19] Makefile: simplify building of templates Patrick Steinhardt
@ 2024-10-24 12:40 ` Patrick Steinhardt
2024-10-24 12:40 ` [RFC PATCH v4 13/19] Documentation: teach "cmd-list.perl" about out-of-tree builds Patrick Steinhardt
` (9 subsequent siblings)
21 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-24 12:40 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau
Our documentation uses "include::" directives to include parts that are
either reused across multiple documents or parts that we generate at
build time. Unfortunately, top-level includes are only ever resolved
relative to the base directory, which is typically the directory of the
including document. Most importantly, it is not possible to have either
asciidoc or asciidoctor search multiple directories.
It follows that both kinds of includes must live in the same directory.
This is of course a bummer for out-of-tree builds, because here the
dynamically-built includes live in the build directory whereas the
static includes live in the source directory.
Introduce a `build_dir` attribute and prepend it to all of our includes
for dynamically-built files. This attribute gets set to the build
directory and thus converts the include path to an absolute path, which
asciidoc and asciidoctor know how to resolve.
Note that this change also requires us to update "build-docdep.perl",
which tries to figure out included files such our Makefile can set up
proper build-time dependencies. This script simply scans through the
source files for any lines that match "^include::" and treats the
remainder of the line as included file path. But given that those may
now contain the "{build_dir}" variable we have to teach the script to
replace that attribute with the actual build directory.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Documentation/Makefile | 3 ++-
Documentation/build-docdep.perl | 2 ++
Documentation/config/diff.txt | 2 +-
Documentation/config/merge.txt | 2 +-
Documentation/git.txt | 24 ++++++++++++------------
5 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 0f55baa252f..75755ceec18 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -218,6 +218,7 @@ SHELL_PATH ?= $(SHELL)
# Shell quote;
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
+ASCIIDOC_EXTRA += -abuild_dir='$(shell pwd)'
ifdef DEFAULT_PAGER
DEFAULT_PAGER_SQ = $(subst ','\'',$(DEFAULT_PAGER))
ASCIIDOC_EXTRA += -a 'git-default-pager=$(DEFAULT_PAGER_SQ)'
@@ -283,7 +284,7 @@ docdep_prereqs = \
cmd-list.made $(cmds_txt)
doc.dep : $(docdep_prereqs) $(DOC_DEP_TXT) build-docdep.perl
- $(QUIET_GEN)$(PERL_PATH) ./build-docdep.perl >$@ $(QUIET_STDERR)
+ $(QUIET_GEN)$(PERL_PATH) ./build-docdep.perl "$(shell pwd)" >$@ $(QUIET_STDERR)
ifneq ($(MAKECMDGOALS),clean)
-include doc.dep
diff --git a/Documentation/build-docdep.perl b/Documentation/build-docdep.perl
index 1b3ac8fdd95..315efaa2fa2 100755
--- a/Documentation/build-docdep.perl
+++ b/Documentation/build-docdep.perl
@@ -1,5 +1,6 @@
#!/usr/bin/perl
+my ($build_dir) = @ARGV;
my %include = ();
my %included = ();
@@ -10,6 +11,7 @@
chomp;
s/^include::\s*//;
s/\[\]//;
+ s/{build_dir}/${build_dir}/;
$include{$text}{$_} = 1;
$included{$_} = 1;
}
diff --git a/Documentation/config/diff.txt b/Documentation/config/diff.txt
index 190bda17e51..9575af91fa5 100644
--- a/Documentation/config/diff.txt
+++ b/Documentation/config/diff.txt
@@ -206,7 +206,7 @@ diff.<driver>.cachetextconv::
Set this option to true to make the diff driver cache the text
conversion outputs. See linkgit:gitattributes[5] for details.
-include::../mergetools-diff.txt[]
+include::{build_dir}/mergetools-diff.txt[]
diff.indentHeuristic::
Set this option to `false` to disable the default heuristics
diff --git a/Documentation/config/merge.txt b/Documentation/config/merge.txt
index 8851b6cedef..82554d65a0a 100644
--- a/Documentation/config/merge.txt
+++ b/Documentation/config/merge.txt
@@ -101,7 +101,7 @@ merge.guitool::
Any other value is treated as a custom merge tool and requires that a
corresponding mergetool.<guitool>.cmd variable is defined.
-include::../mergetools-merge.txt[]
+include::{build_dir}/mergetools-merge.txt[]
merge.verbosity::
Controls the amount of output shown by the recursive merge
diff --git a/Documentation/git.txt b/Documentation/git.txt
index d15a8697625..44f0797ccff 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -245,17 +245,17 @@ ancillary user utilities.
Main porcelain commands
~~~~~~~~~~~~~~~~~~~~~~~
-include::cmds-mainporcelain.txt[]
+include::{build_dir}/cmds-mainporcelain.txt[]
Ancillary Commands
~~~~~~~~~~~~~~~~~~
Manipulators:
-include::cmds-ancillarymanipulators.txt[]
+include::{build_dir}/cmds-ancillarymanipulators.txt[]
Interrogators:
-include::cmds-ancillaryinterrogators.txt[]
+include::{build_dir}/cmds-ancillaryinterrogators.txt[]
Interacting with Others
@@ -264,7 +264,7 @@ Interacting with Others
These commands are to interact with foreign SCM and with other
people via patch over e-mail.
-include::cmds-foreignscminterface.txt[]
+include::{build_dir}/cmds-foreignscminterface.txt[]
Reset, restore and revert
~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -313,13 +313,13 @@ repositories.
Manipulation commands
~~~~~~~~~~~~~~~~~~~~~
-include::cmds-plumbingmanipulators.txt[]
+include::{build_dir}/cmds-plumbingmanipulators.txt[]
Interrogation commands
~~~~~~~~~~~~~~~~~~~~~~
-include::cmds-plumbinginterrogators.txt[]
+include::{build_dir}/cmds-plumbinginterrogators.txt[]
In general, the interrogate commands do not touch the files in
the working tree.
@@ -328,12 +328,12 @@ the working tree.
Syncing repositories
~~~~~~~~~~~~~~~~~~~~
-include::cmds-synchingrepositories.txt[]
+include::{build_dir}/cmds-synchingrepositories.txt[]
The following are helper commands used by the above; end users
typically do not use them directly.
-include::cmds-synchelpers.txt[]
+include::{build_dir}/cmds-synchelpers.txt[]
Internal helper commands
@@ -342,14 +342,14 @@ Internal helper commands
These are internal helper commands used by other commands; end
users typically do not use them directly.
-include::cmds-purehelpers.txt[]
+include::{build_dir}/cmds-purehelpers.txt[]
Guides
------
The following documentation pages are guides about Git concepts.
-include::cmds-guide.txt[]
+include::{build_dir}/cmds-guide.txt[]
Repository, command and file interfaces
---------------------------------------
@@ -358,7 +358,7 @@ This documentation discusses repository and command interfaces which
users are expected to interact with directly. See `--user-formats` in
linkgit:git-help[1] for more details on the criteria.
-include::cmds-userinterfaces.txt[]
+include::{build_dir}/cmds-userinterfaces.txt[]
File formats, protocols and other developer interfaces
------------------------------------------------------
@@ -367,7 +367,7 @@ This documentation discusses file formats, over-the-wire protocols and
other git developer interfaces. See `--developer-interfaces` in
linkgit:git-help[1].
-include::cmds-developerinterfaces.txt[]
+include::{build_dir}/cmds-developerinterfaces.txt[]
Configuration Mechanism
-----------------------
--
2.47.0.118.gfd3785337b.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v4 13/19] Documentation: teach "cmd-list.perl" about out-of-tree builds
2024-10-24 12:39 ` [RFC PATCH v4 00/19] " Patrick Steinhardt
` (11 preceding siblings ...)
2024-10-24 12:40 ` [RFC PATCH v4 12/19] Documentation: allow sourcing generated includes from separate dir Patrick Steinhardt
@ 2024-10-24 12:40 ` Patrick Steinhardt
2024-10-24 12:40 ` [RFC PATCH v4 14/19] Documentation: extract script to generate a list of mergetools Patrick Steinhardt
` (8 subsequent siblings)
21 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-24 12:40 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau
The "cmd-list.perl" script generates a list of commands that can be
included into our manpages. The script doesn't know about out-of-tree
builds and instead writes resulting files into the source directory.
Adapt it such that we can read data from the source directory and write
data into the build directory.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Documentation/Makefile | 2 +-
Documentation/cmd-list.perl | 23 ++++++++++++-----------
2 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 75755ceec18..2b9fd37ff70 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -306,7 +306,7 @@ cmds_txt = cmds-ancillaryinterrogators.txt \
$(cmds_txt): cmd-list.made
cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
- $(QUIET_GEN)$(PERL_PATH) ./cmd-list.perl ../command-list.txt $(cmds_txt) $(QUIET_STDERR) && \
+ $(QUIET_GEN)$(PERL_PATH) ./cmd-list.perl .. . $(cmds_txt) && \
date >$@
mergetools_txt = mergetools-diff.txt mergetools-merge.txt
diff --git a/Documentation/cmd-list.perl b/Documentation/cmd-list.perl
index 755a110bc48..e260a989774 100755
--- a/Documentation/cmd-list.perl
+++ b/Documentation/cmd-list.perl
@@ -3,12 +3,13 @@
use File::Compare qw(compare);
sub format_one {
- my ($out, $nameattr) = @_;
+ my ($source_dir, $out, $nameattr) = @_;
my ($name, $attr) = @$nameattr;
+ my ($path) = "$source_dir/Documentation/$name.txt";
my ($state, $description);
my $mansection;
$state = 0;
- open I, '<', "$name.txt" or die "No such file $name.txt";
+ open I, '<', "$path" or die "No such file $path.txt";
while (<I>) {
if (/^(?:git|scalar)[a-z0-9-]*\(([0-9])\)$/) {
$mansection = $1;
@@ -29,7 +30,7 @@ sub format_one {
}
close I;
if (!defined $description) {
- die "No description found in $name.txt";
+ die "No description found in $path.txt";
}
if (my ($verify_name, $text) = ($description =~ /^($name) - (.*)/)) {
print $out "linkgit:$name\[$mansection\]::\n\t";
@@ -43,9 +44,9 @@ sub format_one {
}
}
-my ($input, @categories) = @ARGV;
+my ($source_dir, $build_dir, @categories) = @ARGV;
-open IN, "<$input";
+open IN, "<$source_dir/command-list.txt";
while (<IN>) {
last if /^### command list/;
}
@@ -63,17 +64,17 @@ sub format_one {
for my $out (@categories) {
my ($cat) = $out =~ /^cmds-(.*)\.txt$/;
- open O, '>', "$out+" or die "Cannot open output file $out+";
+ my ($path) = "$build_dir/$out";
+ open O, '>', "$path+" or die "Cannot open output file $out+";
for (@{$cmds{$cat}}) {
- format_one(\*O, $_);
+ format_one($source_dir, \*O, $_);
}
close O;
- if (-f "$out" && compare("$out", "$out+") == 0) {
- unlink "$out+";
+ if (-f "$path" && compare("$path", "$path+") == 0) {
+ unlink "$path+";
}
else {
- print STDERR "$out\n";
- rename "$out+", "$out";
+ rename "$path+", "$path";
}
}
--
2.47.0.118.gfd3785337b.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v4 14/19] Documentation: extract script to generate a list of mergetools
2024-10-24 12:39 ` [RFC PATCH v4 00/19] " Patrick Steinhardt
` (12 preceding siblings ...)
2024-10-24 12:40 ` [RFC PATCH v4 13/19] Documentation: teach "cmd-list.perl" about out-of-tree builds Patrick Steinhardt
@ 2024-10-24 12:40 ` Patrick Steinhardt
2024-10-24 12:40 ` [RFC PATCH v4 15/19] t: better support for out-of-tree builds Patrick Steinhardt
` (7 subsequent siblings)
21 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-24 12:40 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau
We include the list of available mergetools into our manpages. Extract
the script that performs this logic such that we can reuse it in other
build systems.
While at it, refactor the Makefile targets such that we don't create
"mergetools-list.made" anymore. It shouldn't be necessary, as we can
instead have other targets depend on "mergetools-{diff,merge}.txt"
directly.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Documentation/Makefile | 22 ++++++++--------------
Documentation/generate-mergetool-list.sh | 17 +++++++++++++++++
2 files changed, 25 insertions(+), 14 deletions(-)
create mode 100755 Documentation/generate-mergetool-list.sh
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 2b9fd37ff70..e2ce98a751f 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -276,11 +276,13 @@ ifneq ($(filter-out lint-docs clean,$(MAKECMDGOALS)),)
-include ../GIT-VERSION-FILE
endif
+mergetools_txt = mergetools-diff.txt mergetools-merge.txt
+
#
# Determine "include::" file references in asciidoc files.
#
docdep_prereqs = \
- mergetools-list.made $(mergetools_txt) \
+ $(mergetools_txt) \
cmd-list.made $(cmds_txt)
doc.dep : $(docdep_prereqs) $(DOC_DEP_TXT) build-docdep.perl
@@ -309,19 +311,11 @@ cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
$(QUIET_GEN)$(PERL_PATH) ./cmd-list.perl .. . $(cmds_txt) && \
date >$@
-mergetools_txt = mergetools-diff.txt mergetools-merge.txt
-
-$(mergetools_txt): mergetools-list.made
-
-mergetools-list.made: ../git-mergetool--lib.sh $(wildcard ../mergetools/*)
- $(QUIET_GEN) \
- $(SHELL_PATH) -c 'MERGE_TOOLS_DIR=../mergetools && TOOL_MODE=diff && \
- . ../git-mergetool--lib.sh && \
- show_tool_names can_diff' | sed -e "s/\([a-z0-9]*\)/\`\1\`;;/" >mergetools-diff.txt && \
- $(SHELL_PATH) -c 'MERGE_TOOLS_DIR=../mergetools && TOOL_MODE=merge && \
- . ../git-mergetool--lib.sh && \
- show_tool_names can_merge' | sed -e "s/\([a-z0-9]*\)/\`\1\`;;/" >mergetools-merge.txt && \
- date >$@
+mergetools-%.txt: generate-mergetool-list.sh ../git-mergetool--lib.sh $(wildcard ../mergetools/*)
+mergetools-diff.txt:
+ $(QUIET_GEN)$(SHELL_PATH) ./generate-mergetool-list.sh .. diff $@
+mergetools-merge.txt:
+ $(QUIET_GEN)$(SHELL_PATH) ./generate-mergetool-list.sh .. merge $@
TRACK_ASCIIDOCFLAGS = $(subst ','\'',$(ASCIIDOC_COMMON):$(ASCIIDOC_HTML):$(ASCIIDOC_DOCBOOK))
diff --git a/Documentation/generate-mergetool-list.sh b/Documentation/generate-mergetool-list.sh
new file mode 100755
index 00000000000..696196fbcb8
--- /dev/null
+++ b/Documentation/generate-mergetool-list.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+if test "$#" -ne 3
+then
+ echo "USAGE: $0 <SOURCE_DIR> <MODE> <OUTPUT>" >&2
+ exit 1
+fi
+
+SOURCE_DIR="$1"
+TOOL_MODE="$2"
+OUTPUT="$3"
+MERGE_TOOLS_DIR="$SOURCE_DIR/mergetools"
+
+(
+ . "$SOURCE_DIR"/git-mergetool--lib.sh &&
+ show_tool_names can_$TOOL_MODE
+) | sed -e "s/\([a-z0-9]*\)/\`\1\`;;/" >"$OUTPUT"
--
2.47.0.118.gfd3785337b.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v4 15/19] t: better support for out-of-tree builds
2024-10-24 12:39 ` [RFC PATCH v4 00/19] " Patrick Steinhardt
` (13 preceding siblings ...)
2024-10-24 12:40 ` [RFC PATCH v4 14/19] Documentation: extract script to generate a list of mergetools Patrick Steinhardt
@ 2024-10-24 12:40 ` Patrick Steinhardt
2024-10-24 12:40 ` [RFC PATCH v4 16/19] t: allow overriding build dir Patrick Steinhardt
` (6 subsequent siblings)
21 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-24 12:40 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau
Our in-tree builds used by the Makefile use various different build
directories scattered around different locations. The paths to those
build directories have to be propagated to our tests such that they can
find the contained files. This is done via a mixture of hardcoded paths
in our test library and injected variables in our bin-wrappers or
"GIT-BUILD-OPTIONS".
The latter two mechanisms are preferable over using hardcoded paths. For
one, we have all paths which are subject to change stored in a small set
of central files instead of having the knowledge of build paths in many
files. And second, it allows build systems which build files elsewhere
to adapt those paths based on their own needs. This is especially nice
in the context of build systems that use out-of-tree builds like CMake
or Meson.
Remove hardcoded knowledge of build paths from our test library and move
it into our bin-wrappers and "GIT-BUILD-OPTIONS".
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-BUILD-OPTIONS.in | 5 +++++
Makefile | 9 +++++++++
bin-wrappers/wrap-for-bin.sh | 11 ++++++-----
contrib/buildsystems/CMakeLists.txt | 8 ++++++++
t/lib-gettext.sh | 4 ++--
t/t7609-mergetool--lib.sh | 2 +-
t/test-lib.sh | 6 +++---
7 files changed, 34 insertions(+), 11 deletions(-)
diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in
index 9b95a6b3eee..f651116102a 100644
--- a/GIT-BUILD-OPTIONS.in
+++ b/GIT-BUILD-OPTIONS.in
@@ -35,6 +35,11 @@ GIT_PERF_MAKE_COMMAND=@GIT_PERF_MAKE_COMMAND@
GIT_INTEROP_MAKE_OPTS=@GIT_INTEROP_MAKE_OPTS@
GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@
GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@
+GIT_TEST_TEXTDOMAINDIR=@GIT_TEST_TEXTDOMAINDIR@
+GIT_TEST_POPATH=@GIT_TEST_POPATH@
+GIT_TEST_TEMPLATE_DIR=@GIT_TEST_TEMPLATE_DIR@
+GIT_TEST_GITPERLLIB=@GIT_TEST_GITPERLLIB@
+GIT_TEST_MERGE_TOOLS_DIR=@GIT_TEST_MERGE_TOOLS_DIR@
RUNTIME_PREFIX=@RUNTIME_PREFIX@
GITWEBDIR=@GITWEBDIR@
USE_GETTEXT_SCHEME=@USE_GETTEXT_SCHEME@
diff --git a/Makefile b/Makefile
index c409a0e1b7d..1f0c3bc72ed 100644
--- a/Makefile
+++ b/Makefile
@@ -3173,6 +3173,11 @@ GIT-BUILD-OPTIONS: FORCE
-e "s|@GIT_INTEROP_MAKE_OPTS@|\'$(GIT_INTEROP_MAKE_OPTS)\'|" \
-e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \
-e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \
+ -e "s|@GIT_TEST_TEXTDOMAINDIR@|\'$(shell pwd)/po/build/locale\'|" \
+ -e "s|@GIT_TEST_POPATH@|\'$(shell pwd)/po\'|" \
+ -e "s|@GIT_TEST_TEMPLATE_DIR@|\'$(shell pwd)/templates/blt\'|" \
+ -e "s|@GIT_TEST_GITPERLLIB@|\'$(shell pwd)/perl/build/lib\'|" \
+ -e "s|@GIT_TEST_MERGE_TOOLS_DIR@|\'$(shell pwd)/mergetools\'|" \
-e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX)\'|" \
-e "s|@GITWEBDIR@|\'$(gitwebdir_SQ)\'|" \
-e "s|@USE_GETTEXT_SCHEME@|\'$(USE_GETTEXT_SCHEME)\'|" \
@@ -3202,6 +3207,10 @@ all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PR
$(test_bindir_programs): bin-wrappers/%: bin-wrappers/wrap-for-bin.sh
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@BUILD_DIR@|$(shell pwd)|' \
+ -e 's|@GIT_TEXTDOMAINDIR@|$(shell pwd)/po/build/locale|' \
+ -e 's|@GITPERLLIB@|$(shell pwd)/perl/build/lib|' \
+ -e 's|@MERGE_TOOLS_DIR@|$(shell pwd)/mergetools|' \
+ -e 's|@TEMPLATE_DIR@|$(shell pwd)/templates/blt|' \
-e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
chmod +x $@
diff --git a/bin-wrappers/wrap-for-bin.sh b/bin-wrappers/wrap-for-bin.sh
index 7898a1c238d..1d3a59a0081 100755
--- a/bin-wrappers/wrap-for-bin.sh
+++ b/bin-wrappers/wrap-for-bin.sh
@@ -4,21 +4,22 @@
# to run test suite against sandbox, but with only bindir-installed
# executables in PATH. The Makefile copies this into various
# files in bin-wrappers, substituting
-# @BUILD_DIR@ and @PROG@.
+# @BUILD_DIR@, @TEMPLATE_DIR@ and @PROG@.
GIT_EXEC_PATH='@BUILD_DIR@'
if test -n "$NO_SET_GIT_TEMPLATE_DIR"
then
unset GIT_TEMPLATE_DIR
else
- GIT_TEMPLATE_DIR='@BUILD_DIR@/templates/blt'
+ GIT_TEMPLATE_DIR='@TEMPLATE_DIR@'
export GIT_TEMPLATE_DIR
fi
-GITPERLLIB='@BUILD_DIR@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}"
-GIT_TEXTDOMAINDIR='@BUILD_DIR@/po/build/locale'
+MERGE_TOOLS_DIR='@MERGE_TOOLS_DIR@'
+GITPERLLIB='@GITPERLLIB@'"${GITPERLLIB:+:$GITPERLLIB}"
+GIT_TEXTDOMAINDIR='@GIT_TEXTDOMAINDIR@'
PATH='@BUILD_DIR@/bin-wrappers:'"$PATH"
-export GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
+export MERGE_TOOLS_DIR GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
case "$GIT_DEBUGGER" in
'')
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index ad4e3f0b6ce..f0a1a75382a 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -1054,6 +1054,9 @@ endforeach()
file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+string(REPLACE "@GIT_TEXTDOMAINDIR@" "${CMAKE_BINARY_DIR}/po/build/locale" content "${content}")
+string(REPLACE "@GITPERLLIB@" "${CMAKE_BINARY_DIR}/perl/build/lib" content "${content}")
+string(REPLACE "@MERGE_TOOLS_DIR@" "${CMAKE_SOURCE_DIR}/mergetools" content "${content}")
string(REPLACE "@PROG@" "git-cvsserver" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})
@@ -1139,6 +1142,11 @@ string(REPLACE "@GIT_PERF_MAKE_COMMAND@" "" git_build_options "${git_build_optio
string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_options}")
string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}")
string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_TEXTDOMAINDIR@" "${CMAKE_BINARY_DIR}/po/build/locale" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_POPATH@" "${CMAKE_BINARY_DIR}/po" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_TEMPLATE_DIR@" "${CMAKE_BINARY_DIR}/templates/blt" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_GITPERLLIB@" "${CMAKE_BINARY_DIR}/perl/build/lib" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_MERGE_TOOLS_DIR@" "${RUNTIME_PREFIX}" git_build_options "${git_build_options}")
string(REPLACE "@RUNTIME_PREFIX@" "${RUNTIME_PREFIX}" git_build_options "${git_build_options}")
string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" git_build_options "${git_build_options}")
string(REPLACE "@USE_GETTEXT_SCHEME@" "" git_build_options "${git_build_options}")
diff --git a/t/lib-gettext.sh b/t/lib-gettext.sh
index cc6bb2cdeaa..7a734c6973e 100644
--- a/t/lib-gettext.sh
+++ b/t/lib-gettext.sh
@@ -6,8 +6,8 @@
. ./test-lib.sh
-GIT_TEXTDOMAINDIR="$GIT_BUILD_DIR/po/build/locale"
-GIT_PO_PATH="$GIT_BUILD_DIR/po"
+GIT_TEXTDOMAINDIR="$GIT_TEST_TEXTDOMAINDIR"
+GIT_PO_PATH="$GIT_TEST_POPATH"
export GIT_TEXTDOMAINDIR GIT_PO_PATH
if test -n "$GIT_TEST_INSTALLED"
diff --git a/t/t7609-mergetool--lib.sh b/t/t7609-mergetool--lib.sh
index 8b1c3bd39f2..a9273ba58d7 100755
--- a/t/t7609-mergetool--lib.sh
+++ b/t/t7609-mergetool--lib.sh
@@ -8,7 +8,7 @@ TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'mergetool --tool=vimdiff creates the expected layout' '
- . "$GIT_BUILD_DIR"/mergetools/vimdiff &&
+ . "$GIT_TEST_MERGE_TOOLS_DIR"/vimdiff &&
run_unit_tests
'
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 4dd641baefe..677424ced06 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1478,7 +1478,7 @@ else # normal case, use ../bin-wrappers only unless $with_dashes:
PATH="$GIT_BUILD_DIR:$GIT_BUILD_DIR/t/helper:$PATH"
fi
fi
-GIT_TEMPLATE_DIR="$GIT_BUILD_DIR"/templates/blt
+GIT_TEMPLATE_DIR="$GIT_TEST_TEMPLATE_DIR"
GIT_CONFIG_NOSYSTEM=1
GIT_ATTR_NOSYSTEM=1
GIT_CEILING_DIRECTORIES="$TRASH_DIRECTORY/.."
@@ -1494,9 +1494,9 @@ then
fi
fi
-GITPERLLIB="$GIT_BUILD_DIR"/perl/build/lib
+GITPERLLIB="$GIT_TEST_GITPERLLIB"
export GITPERLLIB
-test -d "$GIT_BUILD_DIR"/templates/blt || {
+test -d "$GIT_TEMPLATE_DIR" || {
BAIL_OUT "You haven't built things yet, have you?"
}
--
2.47.0.118.gfd3785337b.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v4 16/19] t: allow overriding build dir
2024-10-24 12:39 ` [RFC PATCH v4 00/19] " Patrick Steinhardt
` (14 preceding siblings ...)
2024-10-24 12:40 ` [RFC PATCH v4 15/19] t: better support for out-of-tree builds Patrick Steinhardt
@ 2024-10-24 12:40 ` Patrick Steinhardt
2024-10-24 12:40 ` [RFC PATCH v4 17/19] Documentation: add comparison of build systems Patrick Steinhardt
` (5 subsequent siblings)
21 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-24 12:40 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau
Our "test-lib.sh" assumes that our build directory is the parent
directory of "t/". While true when using our Makefile, it's not when
using build systems that support out-of-tree builds.
In commit ee9e66e4e7 (cmake: avoid editing t/test-lib.sh, 2022-10-18),
we have introduce support for overriding the GIT_BUILD_DIR by creating
the file "$GIT_BUILD_DIR/GIT-BUILD-DIR" with its contents pointing to
the location of the build directory. The intent was to stop modifying
"t/test-lib.sh" with the CMake build systems while allowing out-of-tree
builds. But "$GIT_BUILD_DIR" is somewhat misleadingly named, as it in
fact points to the _source_ directory. So while that commit solved part
of the problem for out-of-tree builds, CMake still has to write files
into the source tree.
Solve the second part of the problem, namely not having to write any
data into the source directory at all, by also supporting an environment
variable that allows us to point to a different build directory. This
allows us to perform properly self-contained out-of-tree builds.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
t/test-lib.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 677424ced06..096af9be6b1 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -35,7 +35,7 @@ else
# needing to exist.
TEST_DIRECTORY=$(cd "$TEST_DIRECTORY" && pwd) || exit 1
fi
-GIT_BUILD_DIR="${TEST_DIRECTORY%/t}"
+GIT_BUILD_DIR="${GIT_BUILD_DIR:-${TEST_DIRECTORY%/t}}"
if test "$TEST_DIRECTORY" = "$GIT_BUILD_DIR"
then
echo "PANIC: Running in a $TEST_DIRECTORY that doesn't end in '/t'?" >&2
@@ -513,6 +513,7 @@ unset VISUAL EMAIL LANGUAGE $("$PERL_PATH" -e '
PERF_
CURL_VERBOSE
TRACE_CURL
+ BUILD_DIR
));
my @vars = grep(/^GIT_/ && !/^GIT_($ok)/o, @env);
print join("\n", @vars);
--
2.47.0.118.gfd3785337b.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v4 17/19] Documentation: add comparison of build systems
2024-10-24 12:39 ` [RFC PATCH v4 00/19] " Patrick Steinhardt
` (15 preceding siblings ...)
2024-10-24 12:40 ` [RFC PATCH v4 16/19] t: allow overriding build dir Patrick Steinhardt
@ 2024-10-24 12:40 ` Patrick Steinhardt
2024-10-24 12:40 ` [RFC PATCH v4 18/19] Introduce support for the Meson build system Patrick Steinhardt
` (4 subsequent siblings)
21 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-24 12:40 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau
We're contemplating whether to eventually replace our build systems with
a build system that is easier to use. Add a comparison of build systems
to our technical documentation as a baseline for discussion.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Documentation/Makefile | 1 +
Documentation/technical/build-systems.txt | 224 ++++++++++++++++++++++
2 files changed, 225 insertions(+)
create mode 100644 Documentation/technical/build-systems.txt
diff --git a/Documentation/Makefile b/Documentation/Makefile
index e2ce98a751f..e1527c6d442 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -111,6 +111,7 @@ TECH_DOCS += MyFirstObjectWalk
TECH_DOCS += SubmittingPatches
TECH_DOCS += ToolsForGit
TECH_DOCS += technical/bitmap-format
+TECH_DOCS += technical/build-systems
TECH_DOCS += technical/bundle-uri
TECH_DOCS += technical/hash-function-transition
TECH_DOCS += technical/long-running-process-protocol
diff --git a/Documentation/technical/build-systems.txt b/Documentation/technical/build-systems.txt
new file mode 100644
index 00000000000..d9dafb407c4
--- /dev/null
+++ b/Documentation/technical/build-systems.txt
@@ -0,0 +1,224 @@
+= Build Systems
+
+The build system is the primary way for both developers and system integrators
+to interact with the Git project. As such, being easy to use and extend for
+those who are not directly developing Git itself is just as important as other
+requirements we have on any potential build system.
+
+This document outlines the different requirements that we have for the build
+system and then compares available build systems using these criteria.
+
+== Requirements
+
+The following subsections present a list of requirements that we have for any
+potential build system. Sections are sorted by decreasing priority.
+
+=== Platform support
+
+The build system must have support for all of our platforms that we continually
+test against as outlined by our platform support policy. These platforms are:
+
+ - Linux
+ - Windows
+ - macOS
+
+Furthermore, the build system should have support for the following platforms
+that generally have somebody running test pipelines against regularly:
+
+ - AIX
+ - FreeBSD
+ - NetBSD
+ - NonStop
+ - OpenBSD
+
+The platforms which must be supported by the tool should be aligned with our
+[platform support policy](platform-support.txt).
+
+=== Auto-detection of supported features
+
+The build system must support auto-detection of features which are or aren't
+available on the current platform. Platform maintainers should not be required
+to manually configure the complete build.
+
+Auto-detection of the following items is considered to be important:
+
+ - Check for the existence of headers.
+ - Check for the existence of libraries.
+ - Check for the existence of exectuables.
+ - Check for the runtime behavior of specific functions.
+ - Check for specific link order requirements when multiple libraries are
+ involved.
+
+=== Ease of use
+
+The build system should be both easy to use and easy to extend. While this is
+naturally a subjective metric it is likely not controversial to say that some
+build systems are considerably harder to use than others.
+
+=== IDE support
+
+The build system should integrate with well-known IDEs. Well-known IDEs include:
+
+ - Microsoft Visual Studio
+ - Visual Studio Code
+ - Xcode
+
+There are four levels of support:
+
+ - Native integration into the IDE.
+ - Integration into the IDE via a plugin.
+ - Integration into the IDE via generating a project description with the build
+ system.
+ - No integration.
+
+Native integration is preferable, but integration via either a plugin or by
+generating a project description via the build system are considered feasible
+alternatives.
+
+Another important distinction is the level of integration. There are two
+features that one generally wants to have:
+
+ - Integration of build targets.
+ - Automatic setup of features like code completion with detected build
+ dependencies.
+
+The first bullet point is the bare minimum, but is not sufficient to be
+considered proper integration.
+
+=== Out-of-tree builds
+
+The build system should support out-of-tree builds. Out-of-tree builds allow a
+developer to configure multiple different build directories with different
+configuration, e.g. one "debug" build and one "release" build.
+
+=== Cross-platform builds
+
+The build system should support cross-platform builds, e.g. building for arm on
+an x86-64 host.
+
+=== Language support
+
+The following languages and toolchains are of relevance and should be supported
+by the build system:
+
+ - C: the primary compiled language used by Git, must be supported. Relevant
+ toolchains are GCC, Clang and MSVC.
+ - Rust: candidate as a second compiled lanugage, should be supported. Relevant
+ toolchains is the LLVM-based rustc.
+
+Built-in support for the respective languages is preferred over support that
+needs to be wired up manually to avoid unnecessary complexity. Native support
+includes the following features:
+
+ - Compiling objects.
+ - Dependency tracking.
+ - Detection of available features.
+ - Discovery of relevant toolchains.
+ - Linking libraries and executables.
+ - Templating placeholders in scripts.
+
+=== Test integration
+
+It should be possible to integrate tests into the build system such that it is
+possible to build and test Git within the build system. Features which are nice
+to have:
+
+ - Track build-time dependencies for respective tests. Unit tests have
+ different requirements than integration tests.
+ - Allow filtering of which tests to run.
+ - Allow running tests such that utilities like `test_pause` or `debug` work.
+
+== Comparison
+
+The following list of build systems are considered:
+
+- GNU Make
+- autoconf
+- CMake
+- Meson
+
+=== GNU Make
+
+- Platform support: ubitquitous on all platforms, but not well-integrated into Windows.
+- Auto-detection: no built-in support for auto-detection of features.
+- Ease of use: easy to use, but discovering available options is hard. Makefile
+ rules can quickly get out of hand once reaching a certain scope.
+- IDE support: execution of Makefile targets is supported by many IDEs
+- Out-of-tree builds: supported in theory, not wired up in practice.
+- Cross-platform builds: supported in theory, not wired up in practice.
+- Language support:
+ - C: Limited built-in support, many parts need to be wired up manually.
+ - Rust: No built-in support, needs to be wired up manually.
+- Test integration: partially supported, many parts need to be wired up
+ manually.
+
+=== autoconf
+
+- Platform support: ubiquitous on all platforms, but not well-integrated into Windows.
+- Auto-detection: supported.
+- Ease of use: easy to use, discovering available options is comparatively
+ easy. The autoconf syntax is prohibitively hard to extend though due to its
+ complex set of interacting files and the hard-to-understand M4 language.
+- IDE support: no integration into IDEs at generation time. The generated
+ Makefiles have the same level of support as GNU Make.
+- Out-of-tree builds: supported in theory, not wired up in practice.
+- Cross-platform builds: supported.
+- Language support:
+ - C: Limited built-in support, many parts need to be wired up manually.
+ - Rust: No built-in support, needs to be wired up manually.
+- Test integration: partially supported, many parts need to be wired up
+ manually.
+
+=== CMake
+
+- Platform support: not as extensive as GNU Make or autoconf, but all major
+ platforms are supported.
+ - AIX
+ - Cygwin
+ - FreeBSD
+ - Linux
+ - OpenBSD
+ - Solaris
+ - Windows
+ - macOS
+- Ease of use: easy to use, discovering available options is not always
+ trivial. The scripting language used by CMake is somewhat cumbersome to use,
+ but extending CMake build instructions is doable.
+- IDE support: natively integrated into Microsoft Visual Studio. Can generate
+ project descriptions for Xcode. An extension is available for Visual Studio
+ Code. Many other IDEs have plugins for CMake.
+- Out-of-tree builds: supported.
+- Cross-platform builds: supported.
+- Language support:
+ - C: Supported for GCC, Clang, MSVC and other toolchains.
+ - Rust: No built-in support, needs to be wired up manually.
+- Test integration: supported, even though test dependencies are a bit
+ cumbersome to use via "test fixtures". Interactive test runs are not
+ supported.
+
+=== Meson
+
+- Platform: not as extensive as GNU Make or autoconf, but all major platforms
+ and some smaller ones are supported.
+ - AIX
+ - Cygwin
+ - DragonflyBSD
+ - FreeBSD
+ - Haiku
+ - Linux
+ - NetBSD
+ - OpenBSD
+ - Solaris
+ - Windows
+ - macOS
+- Ease of use: easy to use, discovering available options is easy. The
+ scripting language is straight-forward to use.
+- IDE support: Supports generating build instructions for Xcode and Microsoft
+ Visual Studio, a plugin exists for Visual Studio Code.
+- Out-of-tree builds: supported.
+- Cross-platform builds: supported.
+- Language support:
+ - C: Supported for GCC, Clang, MSVC and other toolchains.
+ - Rust: Supported for rustc.
+- Test integration: supported. Interactive tests are supported starting with
+ Meson 1.5.0 via the `--interactive` flag.
--
2.47.0.118.gfd3785337b.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v4 18/19] Introduce support for the Meson build system
2024-10-24 12:39 ` [RFC PATCH v4 00/19] " Patrick Steinhardt
` (16 preceding siblings ...)
2024-10-24 12:40 ` [RFC PATCH v4 17/19] Documentation: add comparison of build systems Patrick Steinhardt
@ 2024-10-24 12:40 ` Patrick Steinhardt
2024-10-24 12:40 ` [RFC PATCH v4 19/19] meson: fix conflicts with in-flight topics Patrick Steinhardt
` (3 subsequent siblings)
21 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-24 12:40 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau
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.
- Documentation does not yet exist. Same here, it will follow if the
project can agree on Meson.
- 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>
---
Documentation/meson.build | 317 ++++++
bin-wrappers/meson.build | 28 +
contrib/completion/meson.build | 8 +
contrib/meson.build | 1 +
gitweb/meson.build | 63 ++
meson.build | 1614 ++++++++++++++++++++++++++++
meson_options.txt | 73 ++
perl/FromCPAN/Mail/meson.build | 7 +
perl/FromCPAN/meson.build | 9 +
perl/Git/LoadCPAN/Mail/meson.build | 7 +
perl/Git/LoadCPAN/meson.build | 9 +
perl/Git/SVN/Memoize/meson.build | 7 +
perl/Git/SVN/meson.build | 20 +
perl/Git/meson.build | 18 +
perl/meson.build | 12 +
po/meson.build | 27 +
subprojects/.gitignore | 1 +
subprojects/curl.wrap | 13 +
subprojects/expat.wrap | 13 +
subprojects/openssl.wrap | 15 +
subprojects/pcre2.wrap | 16 +
subprojects/zlib.wrap | 13 +
t/helper/meson.build | 91 ++
t/meson.build | 1105 +++++++++++++++++++
templates/hooks/meson.build | 24 +
templates/info/meson.build | 5 +
templates/meson.build | 13 +
27 files changed, 3529 insertions(+)
create mode 100644 Documentation/meson.build
create mode 100644 bin-wrappers/meson.build
create mode 100644 contrib/completion/meson.build
create mode 100644 contrib/meson.build
create mode 100644 gitweb/meson.build
create mode 100644 meson.build
create mode 100644 meson_options.txt
create mode 100644 perl/FromCPAN/Mail/meson.build
create mode 100644 perl/FromCPAN/meson.build
create mode 100644 perl/Git/LoadCPAN/Mail/meson.build
create mode 100644 perl/Git/LoadCPAN/meson.build
create mode 100644 perl/Git/SVN/Memoize/meson.build
create mode 100644 perl/Git/SVN/meson.build
create mode 100644 perl/Git/meson.build
create mode 100644 perl/meson.build
create mode 100644 po/meson.build
create mode 100644 subprojects/.gitignore
create mode 100644 subprojects/curl.wrap
create mode 100644 subprojects/expat.wrap
create mode 100644 subprojects/openssl.wrap
create mode 100644 subprojects/pcre2.wrap
create mode 100644 subprojects/zlib.wrap
create mode 100644 t/helper/meson.build
create mode 100644 t/meson.build
create mode 100644 templates/hooks/meson.build
create mode 100644 templates/info/meson.build
create mode 100644 templates/meson.build
diff --git a/Documentation/meson.build b/Documentation/meson.build
new file mode 100644
index 00000000000..15ba5004ad4
--- /dev/null
+++ b/Documentation/meson.build
@@ -0,0 +1,317 @@
+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')
+
+git_revdate = ''
+if git.found()
+ git_revdate = run_command(git, 'show', '--quiet', '--pretty=%as', check: false).stdout().strip()
+endif
+
+asciidoc_common_options = [
+ asciidoc,
+ '--conf-file=' + meson.current_source_dir() / 'asciidoc.conf',
+ '--attribute=manual=Git Manual',
+ '--attribute=mansource=Git ' + git_version,
+ '--attribute=revdate=' + git_revdate,
+ '--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 = [ ]
+
+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
diff --git a/bin-wrappers/meson.build b/bin-wrappers/meson.build
new file mode 100644
index 00000000000..6d03a19d7b8
--- /dev/null
+++ b/bin-wrappers/meson.build
@@ -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', fs.relative_to(executable.full_path(), meson.project_build_root()))
+
+ configure_file(
+ input: 'wrap-for-bin.sh',
+ output: fs.stem(executable.full_path()),
+ configuration: executable_config,
+ )
+endforeach
diff --git a/contrib/completion/meson.build b/contrib/completion/meson.build
new file mode 100644
index 00000000000..a9bfe2da312
--- /dev/null
+++ b/contrib/completion/meson.build
@@ -0,0 +1,8 @@
+foreach script : [
+ 'git-completion.bash',
+ 'git-completion.tcsh',
+ 'git-completion.zsh',
+ 'git-prompt.sh'
+]
+ test_dependencies += fs.copyfile(script)
+endforeach
diff --git a/contrib/meson.build b/contrib/meson.build
new file mode 100644
index 00000000000..a7b77b87c22
--- /dev/null
+++ b/contrib/meson.build
@@ -0,0 +1 @@
+subdir('completion')
diff --git a/gitweb/meson.build b/gitweb/meson.build
new file mode 100644
index 00000000000..43c28cea453
--- /dev/null
+++ b/gitweb/meson.build
@@ -0,0 +1,63 @@
+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_VERSION', git_version)
+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.sh',
+ meson.current_build_dir() / 'GITWEB-BUILD-OPTIONS',
+ '@INPUT@',
+ '@OUTPUT@',
+ ],
+ install: true,
+ install_dir: get_option('datadir') / 'gitweb',
+)
+
+foreach asset : [
+ 'static/git-favicon.png',
+ 'static/git-logo.png',
+ 'static/gitweb.css',
+ 'static/js/adjust-timezone.js',
+ 'static/js/blame_incremental.js',
+ 'static/js/javascript-detection.js',
+ 'static/js/lib/common-lib.js',
+ 'static/js/lib/cookies.js',
+ 'static/js/lib/datetime.js',
+]
+ fs.copyfile(asset,
+ install: true,
+ install_dir: get_option('datadir') / 'gitweb' / fs.parent(asset),
+ )
+endforeach
diff --git a/meson.build b/meson.build
new file mode 100644
index 00000000000..86d9a5c9f94
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,1614 @@
+project('git', 'c',
+ meson_version: '>=1.3.0',
+ # MSVC does not support GNU99, and C99 does not define __STDC_VERSION__
+ # on MSVC. So we instead fall back to C11 there.
+ default_options: ['c_std=gnu99,c11'],
+ version: 'v2.47.GIT',
+)
+
+fs = import('fs')
+
+program_path = []
+# Git for Windows provides all the tools we need to build Git.
+if host_machine.system() == 'windows'
+ program_path += [ 'C:/Program Files/Git/bin', 'C:/Program Files/Git/usr/bin' ]
+endif
+
+awk = find_program('awk', dirs: program_path)
+cygpath = find_program('cygpath', dirs: program_path, required: false)
+diff = find_program('diff', dirs: program_path)
+shell = find_program('sh', dirs: program_path)
+tar = find_program('tar', dirs: program_path)
+
+script_environment = environment()
+foreach tool : ['cat', 'cut', 'git', 'grep', 'sed', 'sort', 'tr', 'uname']
+ program = find_program(tool, dirs: program_path)
+ script_environment.prepend('PATH', fs.parent(program.full_path()))
+endforeach
+
+git_version = run_command(shell, 'GIT-VERSION-GEN', check: false, env: script_environment).stdout().strip()
+if git_version == ''
+ git_version = meson.project_version()
+endif
+
+compiler = meson.get_compiler('c')
+
+libgit_sources = [
+ 'abspath.c',
+ 'add-interactive.c',
+ 'add-patch.c',
+ 'advice.c',
+ 'alias.c',
+ 'alloc.c',
+ 'apply.c',
+ 'archive-tar.c',
+ 'archive-zip.c',
+ 'archive.c',
+ 'attr.c',
+ 'base85.c',
+ 'bisect.c',
+ 'blame.c',
+ 'blob.c',
+ 'bloom.c',
+ 'branch.c',
+ 'bulk-checkin.c',
+ 'bundle-uri.c',
+ 'bundle.c',
+ 'cache-tree.c',
+ 'cbtree.c',
+ 'chdir-notify.c',
+ 'checkout.c',
+ 'chunk-format.c',
+ 'color.c',
+ 'column.c',
+ 'combine-diff.c',
+ 'commit-graph.c',
+ 'commit-reach.c',
+ 'commit.c',
+ 'compat/nonblock.c',
+ 'compat/obstack.c',
+ 'compat/terminal.c',
+ 'compat/zlib-uncompress2.c',
+ 'config.c',
+ 'connect.c',
+ 'connected.c',
+ 'convert.c',
+ 'copy.c',
+ 'credential.c',
+ 'csum-file.c',
+ 'ctype.c',
+ 'date.c',
+ 'decorate.c',
+ 'delta-islands.c',
+ 'diagnose.c',
+ 'diff-delta.c',
+ 'diff-merges.c',
+ 'diff-lib.c',
+ 'diff-no-index.c',
+ 'diff.c',
+ 'diffcore-break.c',
+ 'diffcore-delta.c',
+ 'diffcore-order.c',
+ 'diffcore-pickaxe.c',
+ 'diffcore-rename.c',
+ 'diffcore-rotate.c',
+ 'dir-iterator.c',
+ 'dir.c',
+ 'editor.c',
+ 'entry.c',
+ 'environment.c',
+ 'ewah/bitmap.c',
+ 'ewah/ewah_bitmap.c',
+ 'ewah/ewah_io.c',
+ 'ewah/ewah_rlw.c',
+ 'exec-cmd.c',
+ 'fetch-negotiator.c',
+ 'fetch-pack.c',
+ 'fmt-merge-msg.c',
+ 'fsck.c',
+ 'fsmonitor.c',
+ 'fsmonitor-ipc.c',
+ 'fsmonitor-settings.c',
+ 'gettext.c',
+ 'git-zlib.c',
+ 'gpg-interface.c',
+ 'graph.c',
+ 'grep.c',
+ 'hash-lookup.c',
+ 'hashmap.c',
+ 'help.c',
+ 'hex.c',
+ 'hex-ll.c',
+ 'hook.c',
+ 'ident.c',
+ 'json-writer.c',
+ 'kwset.c',
+ 'levenshtein.c',
+ 'line-log.c',
+ 'line-range.c',
+ 'linear-assignment.c',
+ 'list-objects-filter-options.c',
+ 'list-objects-filter.c',
+ 'list-objects.c',
+ 'lockfile.c',
+ 'log-tree.c',
+ 'loose.c',
+ 'ls-refs.c',
+ 'mailinfo.c',
+ 'mailmap.c',
+ 'match-trees.c',
+ 'mem-pool.c',
+ 'merge-blobs.c',
+ 'merge-ll.c',
+ 'merge-ort.c',
+ 'merge-ort-wrappers.c',
+ 'merge-recursive.c',
+ 'merge.c',
+ 'midx.c',
+ 'midx-write.c',
+ 'name-hash.c',
+ 'negotiator/default.c',
+ 'negotiator/noop.c',
+ 'negotiator/skipping.c',
+ 'notes-cache.c',
+ 'notes-merge.c',
+ 'notes-utils.c',
+ 'notes.c',
+ 'object-file-convert.c',
+ 'object-file.c',
+ 'object-name.c',
+ 'object.c',
+ 'oid-array.c',
+ 'oidmap.c',
+ 'oidset.c',
+ 'oidtree.c',
+ 'pack-bitmap-write.c',
+ 'pack-bitmap.c',
+ 'pack-check.c',
+ 'pack-mtimes.c',
+ 'pack-objects.c',
+ 'pack-revindex.c',
+ 'pack-write.c',
+ 'packfile.c',
+ 'pager.c',
+ 'parallel-checkout.c',
+ 'parse.c',
+ 'parse-options-cb.c',
+ 'parse-options.c',
+ 'patch-delta.c',
+ 'patch-ids.c',
+ 'path.c',
+ 'pathspec.c',
+ 'pkt-line.c',
+ 'preload-index.c',
+ 'pretty.c',
+ 'prio-queue.c',
+ 'progress.c',
+ 'promisor-remote.c',
+ 'prompt.c',
+ 'protocol.c',
+ 'protocol-caps.c',
+ 'prune-packed.c',
+ 'pseudo-merge.c',
+ 'quote.c',
+ 'range-diff.c',
+ 'reachable.c',
+ 'read-cache.c',
+ 'rebase-interactive.c',
+ 'rebase.c',
+ 'ref-filter.c',
+ 'reflog-walk.c',
+ 'reflog.c',
+ 'refs.c',
+ 'refs/debug.c',
+ 'refs/files-backend.c',
+ 'refs/reftable-backend.c',
+ 'refs/iterator.c',
+ 'refs/packed-backend.c',
+ 'refs/ref-cache.c',
+ 'refspec.c',
+ 'reftable/basics.c',
+ 'reftable/error.c',
+ 'reftable/block.c',
+ 'reftable/blocksource.c',
+ 'reftable/iter.c',
+ 'reftable/merged.c',
+ 'reftable/pq.c',
+ 'reftable/reader.c',
+ 'reftable/record.c',
+ 'reftable/stack.c',
+ 'reftable/tree.c',
+ 'reftable/writer.c',
+ 'remote.c',
+ 'replace-object.c',
+ 'repo-settings.c',
+ 'repository.c',
+ 'rerere.c',
+ 'reset.c',
+ 'resolve-undo.c',
+ 'revision.c',
+ 'run-command.c',
+ 'send-pack.c',
+ 'sequencer.c',
+ 'serve.c',
+ 'server-info.c',
+ 'setup.c',
+ 'shallow.c',
+ 'sideband.c',
+ 'sigchain.c',
+ 'sparse-index.c',
+ 'split-index.c',
+ 'stable-qsort.c',
+ 'statinfo.c',
+ 'strbuf.c',
+ 'streaming.c',
+ 'string-list.c',
+ 'strmap.c',
+ 'strvec.c',
+ 'sub-process.c',
+ 'submodule-config.c',
+ 'submodule.c',
+ 'symlinks.c',
+ 'tag.c',
+ 'tempfile.c',
+ 'thread-utils.c',
+ 'tmp-objdir.c',
+ 'trace.c',
+ 'trace2.c',
+ 'trace2/tr2_cfg.c',
+ 'trace2/tr2_cmd_name.c',
+ 'trace2/tr2_ctr.c',
+ 'trace2/tr2_dst.c',
+ 'trace2/tr2_sid.c',
+ 'trace2/tr2_sysenv.c',
+ 'trace2/tr2_tbuf.c',
+ 'trace2/tr2_tgt_event.c',
+ 'trace2/tr2_tgt_normal.c',
+ 'trace2/tr2_tgt_perf.c',
+ 'trace2/tr2_tls.c',
+ 'trace2/tr2_tmr.c',
+ 'trailer.c',
+ 'transport-helper.c',
+ 'transport.c',
+ 'tree-diff.c',
+ 'tree-walk.c',
+ 'tree.c',
+ 'unpack-trees.c',
+ 'upload-pack.c',
+ 'url.c',
+ 'urlmatch.c',
+ 'usage.c',
+ 'userdiff.c',
+ 'utf8.c',
+ 'varint.c',
+ 'versioncmp.c',
+ 'walker.c',
+ 'wildmatch.c',
+ 'worktree.c',
+ 'wrapper.c',
+ 'write-or-die.c',
+ 'ws.c',
+ 'wt-status.c',
+ 'xdiff-interface.c',
+ 'xdiff/xdiffi.c',
+ 'xdiff/xemit.c',
+ 'xdiff/xhistogram.c',
+ 'xdiff/xmerge.c',
+ 'xdiff/xpatience.c',
+ 'xdiff/xprepare.c',
+ 'xdiff/xutils.c',
+]
+
+builtin_sources = [
+ 'builtin/add.c',
+ 'builtin/am.c',
+ 'builtin/annotate.c',
+ 'builtin/apply.c',
+ 'builtin/archive.c',
+ 'builtin/bisect.c',
+ 'builtin/blame.c',
+ 'builtin/branch.c',
+ 'builtin/bugreport.c',
+ 'builtin/bundle.c',
+ 'builtin/cat-file.c',
+ 'builtin/check-attr.c',
+ 'builtin/check-ignore.c',
+ 'builtin/check-mailmap.c',
+ 'builtin/check-ref-format.c',
+ 'builtin/checkout--worker.c',
+ 'builtin/checkout-index.c',
+ 'builtin/checkout.c',
+ 'builtin/clean.c',
+ 'builtin/clone.c',
+ 'builtin/column.c',
+ 'builtin/commit-graph.c',
+ 'builtin/commit-tree.c',
+ 'builtin/commit.c',
+ 'builtin/config.c',
+ 'builtin/count-objects.c',
+ 'builtin/credential-cache--daemon.c',
+ 'builtin/credential-cache.c',
+ 'builtin/credential-store.c',
+ 'builtin/credential.c',
+ 'builtin/describe.c',
+ 'builtin/diagnose.c',
+ 'builtin/diff-files.c',
+ 'builtin/diff-index.c',
+ 'builtin/diff-tree.c',
+ 'builtin/diff.c',
+ 'builtin/difftool.c',
+ 'builtin/fast-export.c',
+ 'builtin/fast-import.c',
+ 'builtin/fetch-pack.c',
+ 'builtin/fetch.c',
+ 'builtin/fmt-merge-msg.c',
+ 'builtin/for-each-ref.c',
+ 'builtin/for-each-repo.c',
+ 'builtin/fsck.c',
+ 'builtin/fsmonitor--daemon.c',
+ 'builtin/gc.c',
+ 'builtin/get-tar-commit-id.c',
+ 'builtin/grep.c',
+ 'builtin/hash-object.c',
+ 'builtin/help.c',
+ 'builtin/hook.c',
+ 'builtin/index-pack.c',
+ 'builtin/init-db.c',
+ 'builtin/interpret-trailers.c',
+ 'builtin/log.c',
+ 'builtin/ls-files.c',
+ 'builtin/ls-remote.c',
+ 'builtin/ls-tree.c',
+ 'builtin/mailinfo.c',
+ 'builtin/mailsplit.c',
+ 'builtin/merge-base.c',
+ 'builtin/merge-file.c',
+ 'builtin/merge-index.c',
+ 'builtin/merge-ours.c',
+ 'builtin/merge-recursive.c',
+ 'builtin/merge-tree.c',
+ 'builtin/merge.c',
+ 'builtin/mktag.c',
+ 'builtin/mktree.c',
+ 'builtin/multi-pack-index.c',
+ 'builtin/mv.c',
+ 'builtin/name-rev.c',
+ 'builtin/notes.c',
+ 'builtin/pack-objects.c',
+ 'builtin/pack-redundant.c',
+ 'builtin/pack-refs.c',
+ 'builtin/patch-id.c',
+ 'builtin/prune-packed.c',
+ 'builtin/prune.c',
+ 'builtin/pull.c',
+ 'builtin/push.c',
+ 'builtin/range-diff.c',
+ 'builtin/read-tree.c',
+ 'builtin/rebase.c',
+ 'builtin/receive-pack.c',
+ 'builtin/reflog.c',
+ 'builtin/refs.c',
+ 'builtin/remote-ext.c',
+ 'builtin/remote-fd.c',
+ 'builtin/remote.c',
+ 'builtin/repack.c',
+ 'builtin/replace.c',
+ 'builtin/replay.c',
+ 'builtin/rerere.c',
+ 'builtin/reset.c',
+ 'builtin/rev-list.c',
+ 'builtin/rev-parse.c',
+ 'builtin/revert.c',
+ 'builtin/rm.c',
+ 'builtin/send-pack.c',
+ 'builtin/shortlog.c',
+ 'builtin/show-branch.c',
+ 'builtin/show-index.c',
+ 'builtin/show-ref.c',
+ 'builtin/sparse-checkout.c',
+ 'builtin/stash.c',
+ 'builtin/stripspace.c',
+ 'builtin/submodule--helper.c',
+ 'builtin/symbolic-ref.c',
+ 'builtin/tag.c',
+ 'builtin/unpack-file.c',
+ 'builtin/unpack-objects.c',
+ 'builtin/update-index.c',
+ 'builtin/update-ref.c',
+ 'builtin/update-server-info.c',
+ 'builtin/upload-archive.c',
+ 'builtin/upload-pack.c',
+ 'builtin/var.c',
+ 'builtin/verify-commit.c',
+ 'builtin/verify-pack.c',
+ 'builtin/verify-tag.c',
+ 'builtin/worktree.c',
+ 'builtin/write-tree.c',
+]
+
+libgit_sources += custom_target(
+ input: 'command-list.txt',
+ output: 'command-list.h',
+ command: [shell, meson.current_source_dir() + '/generate-cmdlist.sh', meson.current_source_dir(), '@OUTPUT@'],
+ env: script_environment,
+)
+
+libgit_sources += custom_target(
+ output: 'config-list.h',
+ command: [
+ shell,
+ meson.current_source_dir() + '/generate-configlist.sh',
+ meson.current_source_dir(),
+ '@OUTPUT@',
+ ],
+ env: script_environment,
+)
+
+libgit_sources += custom_target(
+ input: 'Documentation/githooks.txt',
+ output: 'hook-list.h',
+ command: [
+ shell,
+ meson.current_source_dir() + '/generate-hooklist.sh',
+ meson.current_source_dir(),
+ '@OUTPUT@',
+ ],
+ env: script_environment,
+)
+
+# This contains the variables for GIT-BUILD-OPTIONS, which we use to propagate
+# build options to our tests.
+build_options_config = configuration_data()
+build_options_config.set('GIT_INTEROP_MAKE_OPTS', '')
+build_options_config.set('GIT_PERF_LARGE_REPO', '')
+build_options_config.set('GIT_PERF_MAKE_COMMAND', '')
+build_options_config.set('GIT_PERF_MAKE_OPTS', '')
+build_options_config.set('GIT_PERF_REPEAT_COUNT', '')
+build_options_config.set('GIT_PERF_REPO', '')
+build_options_config.set('GIT_TEST_CMP_USE_COPIED_CONTEXT', '')
+build_options_config.set('GIT_TEST_INDEX_VERSION', '')
+build_options_config.set('GIT_TEST_OPTS', '')
+build_options_config.set('GIT_TEST_PERL_FATAL_WARNINGS', '')
+build_options_config.set('GIT_TEST_UTF8_LOCALE', '')
+build_options_config.set('SANITIZE_ADDRESS', '')
+build_options_config.set('SANITIZE_LEAK', '')
+build_options_config.set('BROKEN_PATH_FIX', '')
+build_options_config.set_quoted('LOCALEDIR', fs.as_posix(get_option('prefix') / get_option('localedir')))
+build_options_config.set('GITWEBDIR', fs.as_posix(get_option('prefix') / get_option('datadir') / 'gitweb'))
+
+test_output_directory = get_option('test_output_directory')
+if test_output_directory == ''
+ test_output_directory = meson.project_build_root() / 'test-output'
+endif
+
+# These variables are used for building libgit.a.
+libgit_c_args = [
+ '-DBINDIR="' + get_option('bindir') + '"',
+ '-DDEFAULT_EDITOR="' + get_option('default_editor') + '"',
+ '-DDEFAULT_GIT_TEMPLATE_DIR="' + get_option('datadir') / 'git-core/templates' + '"',
+ '-DDEFAULT_HELP_FORMAT="' + get_option('default_help_format') + '"',
+ '-DDEFAULT_PAGER="' + get_option('default_pager') + '"',
+ '-DETC_GITATTRIBUTES="' + get_option('gitattributes') + '"',
+ '-DETC_GITCONFIG="' + get_option('gitconfig') + '"',
+ '-DFALLBACK_RUNTIME_PREFIX="' + get_option('prefix') + '"',
+ '-DGIT_EXEC_PATH="' + get_option('prefix') / get_option('libexecdir') / 'git-core"',
+ '-DGIT_HOST_CPU="' + host_machine.cpu_family() + '"',
+ '-DGIT_HTML_PATH="' + get_option('datadir') / 'doc/git-doc"',
+ '-DGIT_INFO_PATH="' + get_option('infodir') + '"',
+ '-DGIT_LOCALE_PATH="' + get_option('localedir') + '"',
+ '-DGIT_MAN_PATH="' + get_option('mandir') + '"',
+ '-DPAGER_ENV="' + get_option('pager_environment') + '"',
+ '-DSHELL_PATH="' + fs.as_posix(shell.full_path()) + '"',
+]
+libgit_include_directories = [ '.' ]
+libgit_dependencies = [ ]
+
+executable_suffix = ''
+if host_machine.system() == 'cygwin' or host_machine.system() == 'windows'
+ executable_suffix = '.exe'
+ libgit_c_args += '-DSTRIP_EXTENSION="' + executable_suffix + '"'
+endif
+build_options_config.set_quoted('X', executable_suffix)
+
+python = import('python').find_installation('python3', required: get_option('python'))
+if python.found()
+ build_options_config.set('NO_PYTHON', '')
+else
+ libgit_c_args += '-DNO_PYTHON'
+ build_options_config.set('NO_PYTHON', '1')
+endif
+
+# Perl is used for two different things: our test harness and to provide some
+# features. It is optional if you want to neither execute tests nor use any of
+# these optional features.
+perl_required = get_option('perl')
+if get_option('tests')
+ perl_required = true
+endif
+
+# Note that we only set NO_PERL if the Perl features were disabled by the user.
+# It may not be set when we have found Perl, but only use it to run tests.
+perl = find_program('perl', version: '>=5.8.1', dirs: program_path, required: perl_required)
+perl_features_enabled = perl.found() and get_option('perl').allowed()
+if perl_features_enabled
+ build_options_config.set('NO_PERL', '')
+
+ if get_option('runtime_prefix')
+ build_options_config.set('PERL_LOCALEDIR', '')
+ else
+ build_options_config.set_quoted('PERL_LOCALEDIR', fs.as_posix(get_option('prefix') / get_option('localedir')))
+ endif
+
+ if get_option('perl_cpan_fallback')
+ build_options_config.set('NO_PERL_CPAN_FALLBACKS', '')
+ else
+ build_options_config.set_quoted('NO_PERL_CPAN_FALLBACKS', 'YesPlease')
+ endif
+else
+ libgit_c_args += '-DNO_PERL'
+ build_options_config.set('NO_PERL', '1')
+ build_options_config.set('PERL_LOCALEDIR', '')
+ build_options_config.set('NO_PERL_CPAN_FALLBACKS', '')
+endif
+
+zlib = dependency('zlib', default_options: ['default_library=static', 'tests=disabled'])
+if zlib.version().version_compare('<1.2.0')
+ libgit_c_args += '-DNO_DEFLATE_BOUND'
+endif
+libgit_dependencies += zlib
+
+threads = dependency('threads', required: false)
+if threads.found()
+ libgit_dependencies += threads
+ build_options_config.set('NO_PTHREADS', '')
+else
+ libgit_c_args += '-DNO_PTHREADS'
+ build_options_config.set('NO_PTHREADS', '1')
+endif
+
+if get_option('gettext').allowed() and host_machine.system() == 'darwin' and get_option('macos_use_homebrew_gettext')
+ if host_machine.cpu_family() == 'x86_64'
+ libintl_prefix = '/usr/local'
+ elif host_machine.cpu_family() == 'aarch64'
+ libintl_prefix = '/opt/homebrew'
+ else
+ error('Homebrew workaround not supported on current architecture')
+ endif
+
+ intl = compiler.find_library('intl', dirs: libintl_prefix / 'lib', required: get_option('gettext'))
+ if intl.found()
+ intl = declare_dependency(
+ dependencies: intl,
+ include_directories: libintl_prefix / 'include',
+ )
+ endif
+else
+ intl = dependency('intl', required: get_option('gettext'))
+endif
+if intl.found()
+ libgit_dependencies += intl
+ build_options_config.set('NO_GETTEXT', '')
+ build_options_config.set('USE_GETTEXT_SCHEME', '')
+else
+ libgit_c_args += '-DNO_GETTEXT'
+ build_options_config.set('NO_GETTEXT', '1')
+ build_options_config.set('USE_GETTEXT_SCHEME', 'fallthrough')
+endif
+
+iconv = dependency('iconv', required: get_option('iconv'))
+if iconv.found()
+ libgit_dependencies += iconv
+ build_options_config.set('NO_ICONV', '')
+
+ have_old_iconv = false
+ if not compiler.compiles('''
+ #include <iconv.h>
+
+ extern size_t iconv(iconv_t cd,
+ char **inbuf, size_t *inbytesleft,
+ char **outbuf, size_t *outbytesleft);
+ ''', name: 'old iconv interface', dependencies: [iconv])
+ libgit_c_args += '-DOLD_ICONV'
+ have_old_iconv = true
+ endif
+
+ iconv_omits_bom_source = '''#
+ #include <iconv.h>
+
+ int main(int argc, const char **argv)
+ {
+ '''
+ if have_old_iconv
+ iconv_omits_bom_source += '''
+ typedef const char *iconv_ibp;
+ '''
+ else
+ iconv_omits_bom_source += '''
+ typedef char *iconv_ibp;
+ '''
+ endif
+ iconv_omits_bom_source += '''
+ int v;
+ iconv_t conv;
+ char in[] = "a"; iconv_ibp pin = in;
+ char out[20] = ""; char *pout = out;
+ size_t isz = sizeof in;
+ size_t osz = sizeof out;
+
+ conv = iconv_open("UTF-16", "UTF-8");
+ iconv(conv, &pin, &isz, &pout, &osz);
+ iconv_close(conv);
+ v = (unsigned char)(out[0]) + (unsigned char)(out[1]);
+ return v != 0xfe + 0xff;
+ }
+ '''
+
+ if compiler.run(iconv_omits_bom_source,
+ dependencies: iconv,
+ name: 'iconv omits BOM',
+ ).returncode() != 0
+ libgit_c_args += '-DICONV_OMITS_BOM'
+ endif
+else
+ libgit_c_args += '-DNO_ICONV'
+ build_options_config.set('NO_ICONV', '1')
+endif
+
+pcre2 = dependency('libpcre2-8', required: get_option('pcre2'), default_options: ['default_library=static', 'test=false'])
+if pcre2.found()
+ libgit_dependencies += pcre2
+ libgit_c_args += '-DUSE_LIBPCRE2'
+ build_options_config.set('USE_LIBPCRE2', '1')
+else
+ build_options_config.set('USE_LIBPCRE2', '')
+endif
+
+curl = dependency('libcurl', version: '>=7.21.3', required: get_option('curl'), default_options: ['default_library=static', 'tests=disabled'])
+use_curl_for_imap_send = false
+if curl.found()
+ if curl.version().version_compare('>=7.34.0')
+ libgit_c_args += '-DUSE_CURL_FOR_IMAP_SEND'
+ use_curl_for_imap_send = true
+ endif
+
+ libgit_dependencies += curl
+ libgit_c_args += '-DCURL_DISABLE_TYPECHECK'
+ build_options_config.set('NO_CURL', '')
+else
+ libgit_c_args += '-DNO_CURL'
+ build_options_config.set('NO_CURL', '1')
+endif
+
+expat = dependency('expat', required: get_option('expat'), default_options: ['default_library=static', 'build_tests=false'])
+if expat.found()
+ libgit_dependencies += expat
+
+ if expat.version().version_compare('<=1.2')
+ libgit_c_args += '-DEXPAT_NEEDS_XMLPARSE_H'
+ endif
+ build_options_config.set('NO_EXPAT', '')
+else
+ libgit_c_args += '-DNO_EXPAT'
+ build_options_config.set('NO_EXPAT', '1')
+endif
+
+if not compiler.has_header('sys/select.h')
+ libgit_c_args += '-DNO_SYS_SELECT_H'
+endif
+
+has_poll_h = compiler.has_header('poll.h')
+if not has_poll_h
+ libgit_c_args += '-DNO_POLL_H'
+endif
+
+has_sys_poll_h = compiler.has_header('sys/poll.h')
+if not has_sys_poll_h
+ libgit_c_args += '-DNO_SYS_POLL_H'
+endif
+
+if not has_poll_h and not has_sys_poll_h
+ libgit_c_args += '-DNO_POLL'
+ libgit_sources += 'compat/poll/poll.c'
+ libgit_include_directories += 'compat/poll'
+endif
+
+if not compiler.has_header('inttypes.h')
+ libgit_c_args += '-DNO_INTTYPES_H'
+endif
+
+if compiler.has_header('libcharset.h')
+ libcharset = compiler.find_library('charset')
+
+ if compiler.has_function('locale_charset',
+ prefix: '#include <libcharset.h>',
+ dependencies: iconv,
+ )
+ libgit_c_args += '-DHAVE_LIBCHARSET_H'
+ elif compiler.has_function('locale_charset',
+ prefix: '#include <libcharset.h>',
+ dependencies: libcharset,
+ )
+ libgit_c_args += '-DHAVE_LIBCHARSET_H'
+ endif
+endif
+
+if compiler.has_header('alloca.h')
+ libgit_c_args += '-DHAVE_ALLOCA_H'
+endif
+
+if compiler.has_header('sys/sysinfo.h')
+ libgit_c_args += '-DHAVE_SYSINFO'
+endif
+
+# Windows has libgen.h and a basename implementation, but we still need our own
+# implementation to threat things like drive prefixes specially.
+if host_machine.system() == 'windows' or not compiler.has_header('libgen.h')
+ libgit_c_args += '-DNO_LIBGEN_H'
+ libgit_sources += 'compat/basename.c'
+endif
+
+if compiler.has_header('paths.h')
+ libgit_c_args += '-DHAVE_PATHS_H'
+endif
+
+if compiler.has_header('strings.h')
+ libgit_c_args += '-DHAVE_STRINGS_H'
+endif
+
+networking_dependencies = [ ]
+if host_machine.system() == 'windows'
+ winsock = compiler.find_library('ws2_32', required: false)
+ if winsock.found()
+ networking_dependencies += winsock
+ endif
+else
+ libresolv = compiler.find_library('resolv', required: false)
+ if libresolv.found()
+ networking_dependencies += libresolv
+ endif
+endif
+libgit_dependencies += networking_dependencies
+
+foreach symbol : ['inet_ntop', 'inet_pton', 'strerror']
+ if not compiler.has_function(symbol, dependencies: networking_dependencies)
+ libgit_c_args += '-DNO_' + symbol.to_upper()
+ endif
+endforeach
+
+has_ipv6 = compiler.has_function('getaddrinfo', dependencies: networking_dependencies)
+if not has_ipv6
+ libgit_c_args += '-DNO_IPV6'
+endif
+
+if not compiler.compiles('''
+ #ifdef _WIN32
+ # include <winsock2.h>
+ #else
+ # include <sys/types.h>
+ # include <sys/socket.h>
+ #endif
+
+ void func(void)
+ {
+ struct sockaddr_storage x;
+ }
+''', name: 'struct sockaddr_storage')
+ if has_ipv6
+ libgit_c_args += '-Dsockaddr_storage=sockaddr_in6'
+ else
+ libgit_c_args += '-Dsockaddr_storage=sockaddr_in'
+ endif
+endif
+
+if compiler.has_function('socket', dependencies: networking_dependencies)
+ libgit_sources += [
+ 'unix-socket.c',
+ 'unix-stream-server.c',
+ ]
+ build_options_config.set('NO_UNIX_SOCKETS', '')
+else
+ libgit_c_args += '-DNO_UNIX_SOCKETS'
+ build_options_config.set('NO_UNIX_SOCKETS', '1')
+endif
+
+if not compiler.has_function('pread')
+ libgit_c_args += '-DNO_PREAD'
+ libgit_sources += 'compat/pread.c'
+endif
+
+if host_machine.system() == 'darwin'
+ libgit_sources += 'compat/precompose_utf8.c'
+ libgit_c_args += '-DPRECOMPOSE_UNICODE'
+ libgit_c_args += '-DPROTECT_HFS_DEFAULT'
+endif
+
+# Configure general compatibility wrappers.
+if host_machine.system() == 'cygwin'
+ libgit_sources += [
+ 'compat/win32/path-utils.c',
+ ]
+elif host_machine.system() == 'windows'
+ libgit_sources += [
+ 'compat/mingw.c',
+ 'compat/winansi.c',
+ 'compat/win32/flush.c',
+ 'compat/win32/path-utils.c',
+ 'compat/win32/pthread.c',
+ 'compat/win32/syslog.c',
+ 'compat/win32/dirent.c',
+ 'compat/win32mmap.c',
+ 'compat/nedmalloc/nedmalloc.c',
+ ]
+
+ libgit_c_args += [
+ '-DDETECT_MSYS_TTY',
+ '-DENSURE_MSYSTEM_IS_SET',
+ '-DNATIVE_CRLF',
+ '-DNOGDI',
+ '-DNO_POSIX_GOODIES',
+ '-DWIN32',
+ '-D_CONSOLE',
+ '-D_CONSOLE_DETECT_MSYS_TTY',
+ '-D__USE_MINGW_ANSI_STDIO=0',
+ ]
+
+ libgit_dependencies += compiler.find_library('ntdll')
+ libgit_include_directories += 'compat/win32'
+ if compiler.get_id() == 'msvc'
+ libgit_include_directories += 'compat/vcbuild/include'
+ endif
+endif
+
+if host_machine.system() == 'linux'
+ libgit_sources += 'compat/linux/procinfo.c'
+elif host_machine.system() == 'windows'
+ libgit_sources += 'compat/win32/trace2_win32_process_info.c'
+else
+ libgit_sources += 'compat/stub/procinfo.c'
+endif
+
+if host_machine.system() == 'cygwin' or host_machine.system() == 'windows'
+ libgit_c_args += [
+ '-DUNRELIABLE_FSTAT',
+ '-DMMAP_PREVENTS_DELETE',
+ '-DOBJECT_CREATION_MODE=1',
+ ]
+endif
+
+# Configure the simple-ipc subsystem required fro the fsmonitor.
+if host_machine.system() == 'windows'
+ libgit_sources += [
+ 'compat/simple-ipc/ipc-shared.c',
+ 'compat/simple-ipc/ipc-win32.c',
+ ]
+ libgit_c_args += '-DSUPPORTS_SIMPLE_IPC'
+else
+ libgit_sources += [
+ 'compat/simple-ipc/ipc-shared.c',
+ 'compat/simple-ipc/ipc-unix-socket.c',
+ ]
+ libgit_c_args += '-DSUPPORTS_SIMPLE_IPC'
+endif
+
+fsmonitor_backend = ''
+if host_machine.system() == 'windows'
+ fsmonitor_backend = 'win32'
+elif host_machine.system() == 'darwin'
+ fsmonitor_backend = 'darwin'
+ libgit_dependencies += dependency('CoreServices')
+endif
+if fsmonitor_backend != ''
+ libgit_c_args += '-DHAVE_FSMONITOR_DAEMON_BACKEND'
+ libgit_c_args += '-DHAVE_FSMONITOR_OS_SETTINGS'
+
+ libgit_sources += [
+ 'compat/fsmonitor/fsm-health-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-ipc-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-listen-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-path-utils-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-settings-' + fsmonitor_backend + '.c',
+ ]
+endif
+build_options_config.set_quoted('FSMONITOR_DAEMON_BACKEND', fsmonitor_backend)
+build_options_config.set_quoted('FSMONITOR_OS_SETTINGS', fsmonitor_backend)
+
+if compiler.has_header('regex.h') and compiler.get_define('REG_STARTEND', prefix: '#include <regex.h>') != ''
+ build_options_config.set('NO_REGEX', '')
+
+ if compiler.get_define('REG_ENHANCED', prefix: '#include <regex.h>') != ''
+ libgit_c_args += '-DUSE_ENHANCED_BASIC_REGULAR_EXPRESSIONS'
+ libgit_sources += 'compat/regcomp_enhanced.c'
+ endif
+else
+ libgit_c_args += [
+ '-DNO_REGEX',
+ '-DGAWK',
+ '-DNO_MBSUPPORT',
+ ]
+ build_options_config.set('NO_REGEX', '1')
+ libgit_sources += 'compat/regex/regex.c'
+ libgit_include_directories += 'compat/regex'
+endif
+
+# setitimer and friends are provided by compat/mingw.c.
+if host_machine.system() != 'windows'
+ if not compiler.compiles('''
+ #include <sys/time.h>
+ void func(void)
+ {
+ struct itimerval value;
+ }
+ ''', name: 'struct itimerval')
+ libgit_c_args += '-DNO_STRUCT_ITIMERVAL'
+ libgit_c_args += '-DNO_SETITIMER'
+ elif not compiler.has_function('setitimer')
+ libgit_c_args += '-DNO_SETITIMER'
+ endif
+endif
+
+if compiler.has_member('struct stat', 'st_mtimespec.tv_nsec', prefix: '#include <sys/stat.h>')
+ libgit_c_args += '-DUSE_ST_TIMESPEC'
+elif not compiler.has_member('struct stat', 'st_mtim.tv_nsec', prefix: '#include <sys/stat.h>')
+ libgit_c_args += '-DNO_NSEC'
+endif
+
+if not compiler.has_member('struct stat', 'st_blocks', prefix: '#include <sys/stat.h>')
+ libgit_c_args += '-DNO_ST_BLOCKS_IN_STRUCT_STAT'
+endif
+
+if not compiler.has_member('struct dirent', 'd_type', prefix: '#include <dirent.h>')
+ libgit_c_args += '-DNO_D_TYPE_IN_DIRENT'
+endif
+
+if not compiler.has_member('struct passwd', 'pw_gecos', prefix: '#include <pwd.h>')
+ libgit_c_args += '-DNO_GECOS_IN_PWENT'
+endif
+
+if compiler.has_function('sync_file_range')
+ libgit_c_args += '-DHAVE_SYNC_FILE_RANGE'
+endif
+
+if not compiler.has_function('strcasestr')
+ libgit_c_args += '-DNO_STRCASESTR'
+ libgit_sources += 'compat/strcasestr.c'
+endif
+
+if not compiler.has_function('memmem')
+ libgit_c_args += '-DNO_MEMMEM'
+ libgit_sources += 'compat/memmem.c'
+endif
+
+if not compiler.has_function('strlcpy')
+ libgit_c_args += '-DNO_STRLCPY'
+ libgit_sources += 'compat/strlcpy.c'
+endif
+
+if not compiler.has_function('strdup')
+ libgit_c_args += '-DOVERRIDE_STRDUP'
+ libgit_sources += 'compat/strdup.c'
+endif
+
+if not compiler.has_function('strtoumax')
+ libgit_c_args += '-DNO_STRTOUMAX'
+ libgit_sources += [
+ 'compat/strtoumax.c',
+ 'compat/strtoimax.c',
+ ]
+endif
+
+if not compiler.has_function('strtoull')
+ libgit_c_args += '-DNO_STRTOULL'
+endif
+
+if not compiler.has_function('setenv')
+ libgit_c_args += '-DNO_SETENV'
+ libgit_sources += 'compat/setenv.c'
+endif
+
+if not compiler.has_function('qsort')
+ libgit_c_args += '-DINTERNAL_QSORT'
+endif
+libgit_sources += 'compat/qsort_s.c'
+
+# unsetenv is provided by compat/mingw.c.
+if host_machine.system() != 'windows' and not compiler.has_function('unsetenv')
+ libgit_c_args += '-DNO_UNSETENV'
+ libgit_sources += 'compat/unsetenv.c'
+endif
+
+if not compiler.has_function('mkdtemp')
+ libgit_c_args += '-DNO_MKDTEMP'
+ libgit_sources += 'compat/mkdtemp.c'
+endif
+
+if not compiler.has_function('initgroups')
+ libgit_c_args += '-DNO_INITGROUPS'
+endif
+
+if compiler.has_function('getdelim')
+ libgit_c_args += '-DHAVE_GETDELIM'
+endif
+
+if host_machine.system() == 'windows'
+ libgit_c_args += '-DUSE_WIN32_MMAP'
+elif not compiler.has_function('mmap')
+ libgit_c_args += '-DNO_MMAP'
+ libgit_sources += 'compat/mmap.c'
+endif
+
+if compiler.has_function('clock_gettime')
+ libgit_c_args += '-DHAVE_CLOCK_GETTIME'
+endif
+
+if compiler.compiles('''
+ #include <time.h>
+
+ void func(void)
+ {
+ clockid_t id = CLOCK_MONOTONIC;
+ }
+''', name: 'monotonic clock')
+ libgit_c_args += '-DHAVE_CLOCK_MONOTONIC'
+endif
+
+if compiler.compiles('''
+ #include <inttypes.h>
+
+ void func(void)
+ {
+ uintmax_t x = 0;
+ }
+''', name: 'uintmax_t')
+ libgit_c_args += '-DNO_UINTMAX_T'
+endif
+
+has_bsd_sysctl = false
+if compiler.has_header('sys/sysctl.h')
+ if compiler.compiles('''
+ #include <stddef.h>
+ #include <sys/sysctl.h>
+
+ void func(void)
+ {
+ int val, mib[2] = { 0 };
+ size_t len = sizeof(val);
+ sysctl(mib, 2, &val, &len, NULL, 0);
+ }
+ ''', name: 'BSD sysctl')
+ libgit_c_args += '-DHAVE_BSD_SYSCTL'
+ has_bsd_sysctl = true
+ endif
+endif
+
+if compiler.run('''
+ #include <stdio.h>
+
+ int main(int argc, const char **argv)
+ {
+ FILE *f = fopen(".", "r");
+ return f ? 0 : 1;
+ }
+''', name: 'fread reads directories').returncode() == 0
+ libgit_c_args += '-DFREAD_READS_DIRECTORIES'
+ libgit_sources += 'compat/fopen.c'
+endif
+
+if not meson.is_cross_build() and fs.exists('/dev/tty')
+ libgit_c_args += '-DHAVE_DEV_TTY'
+endif
+
+if get_option('openssl').enabled() and get_option('CommonCrypto').enabled()
+ error('Can only use one SSL backend')
+endif
+
+security_framework = dependency('Security', required: get_option('CommonCrypto').disable_auto_if(host_machine.system() != 'darwin'))
+core_foundation_framework = dependency('CoreFoundation', required: security_framework.found())
+if security_framework.found()
+ libgit_dependencies += security_framework
+ libgit_dependencies += core_foundation_framework
+ libgit_c_args += '-DAPPLE_COMMON_CRYPTO'
+endif
+
+# OpenSSL is required when requested via the 'openssl' feature or via one of
+# the SHA1/SHA256 backends.
+openssl_required = get_option('openssl').disable_auto_if(security_framework.found())
+if get_option('sha1_backend') == 'openssl' or get_option('sha256_backend') == 'openssl'
+ openssl_required = true
+endif
+
+openssl = dependency('openssl', required: openssl_required, default_options: ['default_library=static'])
+if openssl.found()
+ libgit_dependencies += openssl
+endif
+
+# We may not want to use OpenSSL for anything but our SHA1/SHA256 backends, so
+# we cannot just set NO_OPENSSL based on whether or not the library was found.
+if not openssl.found() or get_option('openssl').disabled()
+ libgit_c_args += '-DNO_OPENSSL'
+endif
+
+sha1_backend = get_option('sha1_backend')
+if sha1_backend == 'sha1dc'
+ libgit_c_args += '-DSHA1_DC'
+ libgit_c_args += '-DSHA1DC_NO_STANDARD_INCLUDES=1'
+ libgit_c_args += '-DSHA1DC_INIT_SAFE_HASH_DEFAULT=0'
+ libgit_c_args += '-DSHA1DC_CUSTOM_INCLUDE_SHA1_C="git-compat-util.h"'
+ libgit_c_args += '-DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="git-compat-util.h"'
+
+ libgit_sources += [
+ 'sha1dc_git.c',
+ 'sha1dc/sha1.c',
+ 'sha1dc/ubc_check.c',
+ ]
+elif sha1_backend == 'common-crypto'
+ libgit_c_args += '-DCOMMON_DIGEST_FOR_OPENSSL'
+ libgit_c_args += '-DSHA1_APPLE'
+ libgit_c_args += '-DSHA1_MAX_BLOCK_SIZE=1024L*1024L*1024L'
+elif sha1_backend == 'openssl'
+ if not openssl.found()
+ openssl = dependency('openssl', required: true)
+ endif
+
+ libgit_c_args += '-DSHA1_OPENSSL'
+ # Apple CommonCrypto requires chunking
+elif sha1_backend == 'block'
+ libgit_c_args += '-DSHA1_BLK'
+ libgit_sources += 'block-sha1/sha1.c'
+else
+ error('Unhandled SHA1 backend ' + sha1_backend)
+endif
+
+sha256_backend = get_option('sha256_backend')
+if sha256_backend == 'openssl'
+ libgit_c_args += '-DSHA256_OPENSSL'
+elif sha256_backend == 'nettle'
+ nettle = dependency('nettle')
+ libgit_dependencies += nettle
+ libgit_c_args += '-DSHA256_NETTLE'
+elif sha256_backend == 'gcrypt'
+ gcrypt = dependency('gcrypt')
+ libgit_dependencies += gcrypt
+ libgit_c_args += '-DSHA256_GCRYPT'
+elif sha256_backend == 'block'
+ libgit_c_args += '-DSHA256_BLK'
+ libgit_sources += 'sha256/block/sha256.c'
+else
+ error('Unhandled SHA256 backend ' + sha256_backend)
+endif
+
+if compiler.has_header_symbol('stdlib.h', 'arc4random_buf')
+ libgit_c_args += '-DHAVE_ARC4RANDOM'
+elif compiler.has_header_symbol('bsd/stdlib.h', 'arc4random_buf')
+ libgit_c_args += '-DHAVE_ARC4RANDOM_BSD'
+elif compiler.has_function('getrandom', prefix: '#include <sys/random.h>')
+ libgit_c_args += '-DHAVE_GETRANDOM'
+elif compiler.has_function('getentropy', prefix: '#include <unistd.h>')
+ libgit_c_args += '-DHAVE_GETENTROPY'
+elif compiler.has_function('RtlGenRandom', prefix: '#include <windows.h>\n#include <ntsecapi.h>')
+ libgit_c_args += '-DHAVE_RTLGENRANDOM'
+elif openssl.found()
+ libgit_c_args += '-DHAVE_OPENSSL_CSPRNG'
+endif
+
+if get_option('runtime_prefix')
+ libgit_c_args += '-DRUNTIME_PREFIX'
+ build_options_config.set('RUNTIME_PREFIX', '1')
+
+ if compiler.has_header('mach-o/dyld.h')
+ libgit_c_args += '-DHAVE_NS_GET_EXECUTABLE_PATH'
+ endif
+
+ if has_bsd_sysctl and compiler.compiles('''
+ #include <sys/sysctl.h>
+
+ void func(void)
+ {
+ KERN_PROC_PATHNAME; KERN_PROC;
+ }
+ ''', name: 'BSD KERN_PROC_PATHNAME')
+ libgit_c_args += '-DHAVE_NS_GET_EXECUTABLE_PATH'
+ endif
+
+ if host_machine.system() == 'linux'
+ libgit_c_args += '-DPROCFS_EXECUTABLE_PATH="/proc/self/exe' + '"'
+ elif host_machine.system() == 'openbsd'
+ libgit_c_args += '-DPROCFS_EXECUTABLE_PATH="' + '/proc/curproc/file' + '"'
+ elif host_machine.system() == 'netbsd'
+ libgit_c_args += '-DPROCFS_EXECUTABLE_PATH="' + '/proc/curproc/exe' + '"'
+ endif
+
+ if host_machine.system() == 'windows' and compiler.compiles('''
+ #include <stdlib.h>
+
+ void func(void)
+ {
+ _wpgmptr;
+ }
+ ''', name: 'Win32 _wpgmptr')
+ libgit_c_args += '-DHAVE_WPGMPTR'
+ endif
+else
+ build_options_config.set('RUNTIME_PREFIX', '')
+endif
+
+foreach key, value : {
+ 'DIFF': diff.full_path(),
+ 'GIT_TEST_CMP': diff.full_path() + ' -u',
+ 'GIT_TEST_GITPERLLIB': meson.project_build_root() / 'perl',
+ 'GIT_TEST_MERGE_TOOLS_DIR': meson.project_source_root() / 'mergetools',
+ 'GIT_TEST_POPATH': meson.project_source_root() / 'po',
+ 'GIT_TEST_TEMPLATE_DIR': meson.project_build_root() / 'templates',
+ 'GIT_TEST_TEXTDOMAINDIR': meson.project_build_root() / 'po',
+ 'PAGER_ENV': get_option('pager_environment'),
+ 'PERL_PATH': perl.found() ? perl.full_path() : '',
+ 'PYTHON_PATH': python.found () ? python.full_path() : '',
+ 'SHELL_PATH': shell.full_path(),
+ 'TAR': tar.full_path(),
+ 'TEST_OUTPUT_DIRECTORY': test_output_directory,
+ 'TEST_SHELL_PATH': shell.full_path(),
+}
+ if value != '' and cygpath.found()
+ value = run_command(cygpath, value, check: true).stdout().strip()
+ endif
+ build_options_config.set_quoted(key, value)
+endforeach
+
+configure_file(
+ input: 'GIT-BUILD-OPTIONS.in',
+ output: 'GIT-BUILD-OPTIONS',
+ configuration: build_options_config,
+)
+
+# Build a separate library for "version.c" so that we do not have to rebuild
+# everything when the current Git commit changes. TODO: this only gets set up
+# at configuration time, so we do not notice version changes unless the build
+# instructions get regenerated. We should refactor the source file such that we
+# can substitute tags in the file via `vcs_tag()`.
+libgit_version_library = static_library('git-version',
+ sources: ['version.c'],
+ c_args: libgit_c_args + [
+ '-DGIT_VERSION="' + git_version + '"',
+ '-DGIT_USER_AGENT="' + 'git/' + git_version + '"',
+ '-DGIT_BUILT_FROM_COMMIT="' + run_command('git', 'rev-parse', '-q', '--verify', 'HEAD', check: false).stdout().strip() + '"',
+ ],
+ dependencies: libgit_dependencies,
+ include_directories: libgit_include_directories,
+)
+
+libgit_library = static_library('git',
+ sources: libgit_sources,
+ c_args: libgit_c_args,
+ link_with: libgit_version_library,
+ dependencies: libgit_dependencies,
+ include_directories: libgit_include_directories,
+)
+
+libgit = declare_dependency(
+ compile_args: libgit_c_args,
+ link_with: libgit_library,
+ dependencies: libgit_dependencies,
+ include_directories: libgit_include_directories,
+)
+
+common_main_sources = ['common-main.c']
+common_main_link_args = [ ]
+if host_machine.system() == 'windows'
+ # TODO: wire these up properly.
+ common_main_sources += import('windows').compile_resources('git.rc', args: [
+ '-DMAJOR=1',
+ '-DMINOR=1',
+ '-DMICRO=1',
+ '-DPATCHLEVEL=0',
+ '-DGIT_VERSION=\\\"' + git_version + '.GIT\\\"',
+ ])
+ if compiler.get_argument_syntax() == 'gcc'
+ common_main_link_args += [
+ '-municode',
+ '-Wl,-nxcompat',
+ '-Wl,-dynamicbase',
+ '-Wl,-pic-executable,-e,mainCRTStartup',
+ ]
+ elif compiler.get_argument_syntax() == 'msvc'
+ common_main_link_args += [
+ '/ENTRY:wmainCRTStartup',
+ 'invalidcontinue.obj',
+ ]
+ else
+ error('Unsupported compiler ' + compiler.get_id())
+ endif
+endif
+common_main_library = static_library('common-main',
+ 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,
+ link_args: common_main_link_args,
+)
+
+bin_wrappers = [ ]
+test_dependencies = [ ]
+
+git = executable('git',
+ sources: builtin_sources + 'git.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+bin_wrappers += git
+
+test_dependencies += executable('git-daemon',
+ sources: 'daemon.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+test_dependencies += executable('git-sh-i18n--envsubst',
+ sources: 'sh-i18n--envsubst.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+bin_wrappers += executable('git-shell',
+ sources: 'shell.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+test_dependencies += executable('git-http-backend',
+ sources: 'http-backend.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+bin_wrappers += executable('scalar',
+ sources: 'scalar.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+if get_option('curl').enabled()
+ curl_sources = [
+ 'http.c',
+ 'http-walker.c',
+ ]
+
+ git_remote_http = executable('git-remote-http',
+ sources: curl_sources + 'remote-curl.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+ test_dependencies += git_remote_http
+
+ test_dependencies += executable('git-http-fetch',
+ sources: curl_sources + 'http-fetch.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+
+ if expat.found()
+ test_dependencies += executable('git-http-push',
+ sources: curl_sources + 'http-push.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+ endif
+
+ 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, common_main],
+ )
+
+ install_symlink(alias + executable_suffix,
+ install_dir: get_option('libexecdir') / 'git-core',
+ pointing_to: 'git-remote-http',
+ )
+ endforeach
+endif
+
+imap_send_sources = ['imap-send.c']
+if use_curl_for_imap_send
+ imap_send_sources += curl_sources
+endif
+
+test_dependencies += executable('git-imap-send',
+ sources: imap_send_sources,
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+foreach alias : [ 'git-receive-pack', 'git-upload-archive', 'git-upload-pack' ]
+ bin_wrappers += executable(alias,
+ objects: git.extract_all_objects(recursive: false),
+ dependencies: [libgit, common_main],
+ )
+
+ install_symlink(alias + executable_suffix,
+ install_dir: get_option('libexecdir') / 'git-core',
+ pointing_to: 'git-remote-http',
+ )
+endforeach
+
+foreach symlink : [
+ 'git',
+ 'git-http-backend',
+ 'git-receive-pack',
+ 'git-shell',
+ 'git-upload-archive',
+ 'git-upload-pack',
+ 'scalar',
+]
+ install_symlink(symlink,
+ install_dir: get_option('bindir'),
+ pointing_to: fs.relative_to(get_option('libexecdir') / 'git-core' / symlink, get_option('bindir')),
+ )
+endforeach
+
+scripts_sh = [
+ 'git-difftool--helper.sh',
+ 'git-filter-branch.sh',
+ 'git-merge-octopus.sh',
+ 'git-merge-one-file.sh',
+ 'git-merge-resolve.sh',
+ 'git-mergetool--lib.sh',
+ 'git-mergetool.sh',
+ 'git-quiltimport.sh',
+ 'git-request-pull.sh',
+ 'git-sh-i18n.sh',
+ 'git-sh-setup.sh',
+ 'git-submodule.sh',
+ 'git-web--browse.sh',
+]
+if perl_features_enabled
+ scripts_sh += 'git-instaweb.sh'
+endif
+
+foreach script : scripts_sh
+ test_dependencies += custom_target(
+ input: script,
+ output: fs.stem(script),
+ command: [
+ shell,
+ meson.project_source_root() / 'generate-script.sh',
+ '@INPUT@',
+ '@OUTPUT@',
+ meson.project_build_root() / 'GIT-BUILD-OPTIONS',
+ ],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+endforeach
+
+if perl_features_enabled
+ scripts_perl = [
+ 'git-archimport.perl',
+ 'git-cvsexportcommit.perl',
+ 'git-cvsimport.perl',
+ 'git-cvsserver.perl',
+ 'git-send-email.perl',
+ 'git-svn.perl',
+ ]
+
+ pathsep = ':'
+ if host_machine.system() == 'windows'
+ pathsep = ';'
+ endif
+
+ perl_header_template = 'perl/header_templates/fixed_prefix.template.pl'
+ if get_option('runtime_prefix')
+ perl_header_template = 'perl/header_templates/runtime_prefix.template.pl'
+ endif
+
+ perl_header = configure_file(
+ input: perl_header_template,
+ output: 'GIT-PERL-HEADER',
+ configuration: {
+ 'GITEXECDIR_REL': get_option('libexecdir') / 'git-core',
+ 'PERLLIBDIR_REL': get_option('datadir') / 'perl5',
+ 'LOCALEDIR_REL': get_option('datadir') / 'locale',
+ 'INSTLIBDIR': get_option('datadir') / 'perl5',
+ 'PATHSEP': pathsep,
+ },
+ )
+
+ generate_perl_command = [
+ shell,
+ meson.project_source_root() / 'generate-perl.sh',
+ meson.project_build_root() / 'GIT-BUILD-OPTIONS',
+ git_version,
+ perl_header,
+ '@INPUT@',
+ '@OUTPUT@',
+ ]
+
+ foreach script : scripts_perl
+ generated_script = custom_target(
+ input: script,
+ output: fs.stem(script),
+ command: generate_perl_command,
+ install: true,
+ install_dir: get_option('datadir') / 'perl5',
+ )
+ test_dependencies += generated_script
+ if script == 'git-cvsserver.perl'
+ bin_wrappers += generated_script
+ endif
+ endforeach
+
+ subdir('perl')
+endif
+
+if python.found()
+ scripts_python = [
+ 'git-p4.py'
+ ]
+
+ foreach script : scripts_python
+ fs.copyfile(script, fs.stem(script),
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+ endforeach
+endif
+
+mergetools = [
+ 'mergetools/araxis',
+ 'mergetools/bc',
+ 'mergetools/codecompare',
+ 'mergetools/deltawalker',
+ 'mergetools/diffmerge',
+ 'mergetools/diffuse',
+ 'mergetools/ecmerge',
+ 'mergetools/emerge',
+ 'mergetools/examdiff',
+ 'mergetools/guiffy',
+ 'mergetools/gvimdiff',
+ 'mergetools/kdiff3',
+ 'mergetools/kompare',
+ 'mergetools/meld',
+ 'mergetools/nvimdiff',
+ 'mergetools/opendiff',
+ 'mergetools/p4merge',
+ 'mergetools/smerge',
+ 'mergetools/tkdiff',
+ 'mergetools/tortoisemerge',
+ 'mergetools/vimdiff',
+ 'mergetools/vscode',
+ 'mergetools/winmerge',
+ 'mergetools/xxdiff',
+]
+
+foreach mergetool : mergetools
+ install_data(mergetool, install_dir: get_option('libexecdir') / 'git-core' / 'mergetools')
+endforeach
+
+if intl.found()
+ subdir('po')
+endif
+subdir('contrib')
+subdir('gitweb')
+subdir('templates')
+
+# Everything but the bin-wrappers need to come before this target such that we
+# can properly set up test dependencies. The bin-wrappers themselves are set up
+# at configuration time, so these are fine.
+if get_option('tests')
+ subdir('t')
+endif
+
+subdir('bin-wrappers')
+if get_option('docs') != []
+ subdir('Documentation')
+endif
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 00000000000..9164ed69eaf
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,73 @@
+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('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('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('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('python', type: 'feature', value: 'auto',
+ description: 'Build tools written in Python.')
+
+option('openssl', type: 'feature', value: 'auto',
+ description: 'Support access to HTTPS remotes. OpenSSL may still be pulled in if configured as SHA1 or SHA256 backend.')
+option('CommonCrypto', type: 'feature', value: 'auto',
+ description: 'Build tools written in Python.')
+
+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')
+
+option('macos_use_homebrew_gettext', type: 'boolean', value: true,
+ description: 'Use gettext from Homebrew instead of the slightly-broken system-provided one.')
+
+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')
+
+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).')
+
+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')
diff --git a/perl/FromCPAN/Mail/meson.build b/perl/FromCPAN/Mail/meson.build
new file mode 100644
index 00000000000..129cff161c5
--- /dev/null
+++ b/perl/FromCPAN/Mail/meson.build
@@ -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',
+)
diff --git a/perl/FromCPAN/meson.build b/perl/FromCPAN/meson.build
new file mode 100644
index 00000000000..4e7ea909df3
--- /dev/null
+++ b/perl/FromCPAN/meson.build
@@ -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')
diff --git a/perl/Git/LoadCPAN/Mail/meson.build b/perl/Git/LoadCPAN/Mail/meson.build
new file mode 100644
index 00000000000..7da5b37adb2
--- /dev/null
+++ b/perl/Git/LoadCPAN/Mail/meson.build
@@ -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',
+)
diff --git a/perl/Git/LoadCPAN/meson.build b/perl/Git/LoadCPAN/meson.build
new file mode 100644
index 00000000000..9468c073aeb
--- /dev/null
+++ b/perl/Git/LoadCPAN/meson.build
@@ -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')
diff --git a/perl/Git/SVN/Memoize/meson.build b/perl/Git/SVN/Memoize/meson.build
new file mode 100644
index 00000000000..515ab3dd926
--- /dev/null
+++ b/perl/Git/SVN/Memoize/meson.build
@@ -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',
+)
diff --git a/perl/Git/SVN/meson.build b/perl/Git/SVN/meson.build
new file mode 100644
index 00000000000..8338531041d
--- /dev/null
+++ b/perl/Git/SVN/meson.build
@@ -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')
diff --git a/perl/Git/meson.build b/perl/Git/meson.build
new file mode 100644
index 00000000000..259209d7302
--- /dev/null
+++ b/perl/Git/meson.build
@@ -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')
diff --git a/perl/meson.build b/perl/meson.build
new file mode 100644
index 00000000000..c22d6f8a1a3
--- /dev/null
+++ b/perl/meson.build
@@ -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
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 00000000000..d7154b6395b
--- /dev/null
+++ b/po/meson.build
@@ -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]
diff --git a/subprojects/.gitignore b/subprojects/.gitignore
new file mode 100644
index 00000000000..63ea916ef5f
--- /dev/null
+++ b/subprojects/.gitignore
@@ -0,0 +1 @@
+/*/
diff --git a/subprojects/curl.wrap b/subprojects/curl.wrap
new file mode 100644
index 00000000000..f7e384b85cf
--- /dev/null
+++ b/subprojects/curl.wrap
@@ -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
diff --git a/subprojects/expat.wrap b/subprojects/expat.wrap
new file mode 100644
index 00000000000..2e0427dcfd1
--- /dev/null
+++ b/subprojects/expat.wrap
@@ -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
diff --git a/subprojects/openssl.wrap b/subprojects/openssl.wrap
new file mode 100644
index 00000000000..873d55106e9
--- /dev/null
+++ b/subprojects/openssl.wrap
@@ -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
diff --git a/subprojects/pcre2.wrap b/subprojects/pcre2.wrap
new file mode 100644
index 00000000000..7e184472543
--- /dev/null
+++ b/subprojects/pcre2.wrap
@@ -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
diff --git a/subprojects/zlib.wrap b/subprojects/zlib.wrap
new file mode 100644
index 00000000000..aa14de17740
--- /dev/null
+++ b/subprojects/zlib.wrap
@@ -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
diff --git a/t/helper/meson.build b/t/helper/meson.build
new file mode 100644
index 00000000000..5e83884246e
--- /dev/null
+++ b/t/helper/meson.build
@@ -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
diff --git a/t/meson.build b/t/meson.build
new file mode 100644
index 00000000000..48efe51fbe6
--- /dev/null
+++ b/t/meson.build
@@ -0,0 +1,1105 @@
+clar_test_suites = [
+ 'unit-tests/ctype.c',
+ 'unit-tests/strvec.c',
+]
+
+clar_sources = [
+ 'unit-tests/clar/clar.c',
+ 'unit-tests/unit-test.c',
+]
+
+clar_decls_h = custom_target(
+ input: clar_test_suites,
+ output: 'clar-decls.h',
+ command : [shell, meson.current_source_dir() + '/unit-tests/generate-clar-decls.sh', '@OUTPUT@', '@INPUT@'],
+ env: script_environment,
+)
+clar_sources += clar_decls_h
+
+clar_sources += custom_target(
+ input: clar_decls_h,
+ output: 'clar.suite',
+ feed: true,
+ capture: true,
+ command : [awk, '-f', meson.current_source_dir() + '/unit-tests/clar-generate.awk'],
+)
+
+clar_unit_tests = executable('unit-tests',
+ sources: clar_sources + clar_test_suites,
+ dependencies: [libgit, common_main],
+)
+test('unit-tests', clar_unit_tests)
+
+unit_test_programs = [
+ 'unit-tests/t-example-decorate.c',
+ 'unit-tests/t-hash.c',
+ 'unit-tests/t-hashmap.c',
+ 'unit-tests/t-mem-pool.c',
+ 'unit-tests/t-oid-array.c',
+ 'unit-tests/t-oidmap.c',
+ 'unit-tests/t-oidtree.c',
+ 'unit-tests/t-prio-queue.c',
+ 'unit-tests/t-reftable-basics.c',
+ 'unit-tests/t-reftable-block.c',
+ 'unit-tests/t-reftable-merged.c',
+ 'unit-tests/t-reftable-pq.c',
+ 'unit-tests/t-reftable-reader.c',
+ 'unit-tests/t-reftable-readwrite.c',
+ 'unit-tests/t-reftable-record.c',
+ 'unit-tests/t-reftable-stack.c',
+ 'unit-tests/t-reftable-tree.c',
+ 'unit-tests/t-strbuf.c',
+ 'unit-tests/t-strcmp-offset.c',
+ 'unit-tests/t-trailer.c',
+ 'unit-tests/t-urlmatch-normalization.c',
+]
+
+foreach unit_test_program : unit_test_programs
+ unit_test_name = fs.stem(unit_test_program)
+ unit_test = executable(unit_test_name,
+ sources: [
+ 'unit-tests/test-lib.c',
+ 'unit-tests/lib-oid.c',
+ 'unit-tests/lib-reftable.c',
+ unit_test_program,
+ ],
+ dependencies: [libgit, common_main],
+ )
+ test(unit_test_name, unit_test,
+ workdir: meson.current_source_dir(),
+ )
+endforeach
+
+subdir('helper')
+
+integration_tests = [
+ 't0000-basic.sh',
+ 't0001-init.sh',
+ 't0002-gitfile.sh',
+ 't0003-attributes.sh',
+ 't0004-unwritable.sh',
+ 't0005-signals.sh',
+ 't0006-date.sh',
+ 't0007-git-var.sh',
+ 't0008-ignores.sh',
+ 't0010-racy-git.sh',
+ 't0012-help.sh',
+ 't0013-sha1dc.sh',
+ 't0014-alias.sh',
+ 't0017-env-helper.sh',
+ 't0018-advice.sh',
+ 't0019-json-writer.sh',
+ 't0020-crlf.sh',
+ 't0021-conversion.sh',
+ 't0022-crlf-rename.sh',
+ 't0023-crlf-am.sh',
+ 't0024-crlf-archive.sh',
+ 't0025-crlf-renormalize.sh',
+ 't0026-eol-config.sh',
+ 't0027-auto-crlf.sh',
+ 't0028-working-tree-encoding.sh',
+ 't0029-core-unsetenvvars.sh',
+ 't0030-stripspace.sh',
+ 't0033-safe-directory.sh',
+ 't0034-root-safe-directory.sh',
+ 't0035-safe-bare-repository.sh',
+ 't0040-parse-options.sh',
+ 't0041-usage.sh',
+ 't0050-filesystem.sh',
+ 't0051-windows-named-pipe.sh',
+ 't0052-simple-ipc.sh',
+ 't0055-beyond-symlinks.sh',
+ 't0056-git-C.sh',
+ 't0060-path-utils.sh',
+ 't0061-run-command.sh',
+ 't0062-revision-walking.sh',
+ 't0063-string-list.sh',
+ 't0066-dir-iterator.sh',
+ 't0067-parse_pathspec_file.sh',
+ 't0068-for-each-repo.sh',
+ 't0070-fundamental.sh',
+ 't0071-sort.sh',
+ 't0080-unit-test-output.sh',
+ 't0081-find-pack.sh',
+ 't0090-cache-tree.sh',
+ 't0091-bugreport.sh',
+ 't0092-diagnose.sh',
+ 't0095-bloom.sh',
+ 't0100-previous.sh',
+ 't0101-at-syntax.sh',
+ 't0200-gettext-basic.sh',
+ 't0201-gettext-fallbacks.sh',
+ 't0202-gettext-perl.sh',
+ 't0203-gettext-setlocale-sanity.sh',
+ 't0204-gettext-reencode-sanity.sh',
+ 't0210-trace2-normal.sh',
+ 't0211-trace2-perf.sh',
+ 't0212-trace2-event.sh',
+ 't0300-credentials.sh',
+ 't0301-credential-cache.sh',
+ 't0302-credential-store.sh',
+ 't0303-credential-external.sh',
+ 't0410-partial-clone.sh',
+ 't0411-clone-from-partial.sh',
+ 't0450-txt-doc-vs-help.sh',
+ 't0500-progress-display.sh',
+ 't0600-reffiles-backend.sh',
+ 't0601-reffiles-pack-refs.sh',
+ 't0602-reffiles-fsck.sh',
+ 't0610-reftable-basics.sh',
+ 't0611-reftable-httpd.sh',
+ 't0612-reftable-jgit-compatibility.sh',
+ 't0613-reftable-write-options.sh',
+ 't1000-read-tree-m-3way.sh',
+ 't1001-read-tree-m-2way.sh',
+ 't1002-read-tree-m-u-2way.sh',
+ 't1003-read-tree-prefix.sh',
+ 't1004-read-tree-m-u-wf.sh',
+ 't1005-read-tree-reset.sh',
+ 't1006-cat-file.sh',
+ 't1007-hash-object.sh',
+ 't1008-read-tree-overlay.sh',
+ 't1009-read-tree-new-index.sh',
+ 't1010-mktree.sh',
+ 't1011-read-tree-sparse-checkout.sh',
+ 't1012-read-tree-df.sh',
+ 't1013-read-tree-submodule.sh',
+ 't1014-read-tree-confusing.sh',
+ 't1015-read-index-unmerged.sh',
+ 't1016-compatObjectFormat.sh',
+ 't1020-subdirectory.sh',
+ 't1021-rerere-in-workdir.sh',
+ 't1022-read-tree-partial-clone.sh',
+ 't1050-large.sh',
+ 't1051-large-conversion.sh',
+ 't1060-object-corruption.sh',
+ 't1090-sparse-checkout-scope.sh',
+ 't1091-sparse-checkout-builtin.sh',
+ 't1092-sparse-checkout-compatibility.sh',
+ 't1100-commit-tree-options.sh',
+ 't1300-config.sh',
+ 't1301-shared-repo.sh',
+ 't1302-repo-version.sh',
+ 't1303-wacky-config.sh',
+ 't1304-default-acl.sh',
+ 't1305-config-include.sh',
+ 't1306-xdg-files.sh',
+ 't1307-config-blob.sh',
+ 't1308-config-set.sh',
+ 't1309-early-config.sh',
+ 't1310-config-default.sh',
+ 't1350-config-hooks-path.sh',
+ 't1400-update-ref.sh',
+ 't1401-symbolic-ref.sh',
+ 't1402-check-ref-format.sh',
+ 't1403-show-ref.sh',
+ 't1404-update-ref-errors.sh',
+ 't1405-main-ref-store.sh',
+ 't1406-submodule-ref-store.sh',
+ 't1407-worktree-ref-store.sh',
+ 't1408-packed-refs.sh',
+ 't1409-avoid-packing-refs.sh',
+ 't1410-reflog.sh',
+ 't1411-reflog-show.sh',
+ 't1412-reflog-loop.sh',
+ 't1413-reflog-detach.sh',
+ 't1414-reflog-walk.sh',
+ 't1415-worktree-refs.sh',
+ 't1416-ref-transaction-hooks.sh',
+ 't1417-reflog-updateref.sh',
+ 't1418-reflog-exists.sh',
+ 't1419-exclude-refs.sh',
+ 't1420-lost-found.sh',
+ 't1430-bad-ref-name.sh',
+ 't1450-fsck.sh',
+ 't1451-fsck-buffer.sh',
+ 't1460-refs-migrate.sh',
+ 't1500-rev-parse.sh',
+ 't1501-work-tree.sh',
+ 't1502-rev-parse-parseopt.sh',
+ 't1503-rev-parse-verify.sh',
+ 't1504-ceiling-dirs.sh',
+ 't1505-rev-parse-last.sh',
+ 't1506-rev-parse-diagnosis.sh',
+ 't1507-rev-parse-upstream.sh',
+ 't1508-at-combinations.sh',
+ 't1509-root-work-tree.sh',
+ 't1510-repo-setup.sh',
+ 't1511-rev-parse-caret.sh',
+ 't1512-rev-parse-disambiguation.sh',
+ 't1513-rev-parse-prefix.sh',
+ 't1514-rev-parse-push.sh',
+ 't1515-rev-parse-outside-repo.sh',
+ 't1517-outside-repo.sh',
+ 't1600-index.sh',
+ 't1601-index-bogus.sh',
+ 't1700-split-index.sh',
+ 't1701-racy-split-index.sh',
+ 't1800-hook.sh',
+ 't2000-conflict-when-checking-files-out.sh',
+ 't2002-checkout-cache-u.sh',
+ 't2003-checkout-cache-mkdir.sh',
+ 't2004-checkout-cache-temp.sh',
+ 't2005-checkout-index-symlinks.sh',
+ 't2006-checkout-index-basic.sh',
+ 't2007-checkout-symlink.sh',
+ 't2008-checkout-subdir.sh',
+ 't2009-checkout-statinfo.sh',
+ 't2010-checkout-ambiguous.sh',
+ 't2011-checkout-invalid-head.sh',
+ 't2012-checkout-last.sh',
+ 't2013-checkout-submodule.sh',
+ 't2014-checkout-switch.sh',
+ 't2015-checkout-unborn.sh',
+ 't2016-checkout-patch.sh',
+ 't2017-checkout-orphan.sh',
+ 't2018-checkout-branch.sh',
+ 't2019-checkout-ambiguous-ref.sh',
+ 't2020-checkout-detach.sh',
+ 't2021-checkout-overwrite.sh',
+ 't2022-checkout-paths.sh',
+ 't2023-checkout-m.sh',
+ 't2024-checkout-dwim.sh',
+ 't2025-checkout-no-overlay.sh',
+ 't2026-checkout-pathspec-file.sh',
+ 't2027-checkout-track.sh',
+ 't2030-unresolve-info.sh',
+ 't2050-git-dir-relative.sh',
+ 't2060-switch.sh',
+ 't2070-restore.sh',
+ 't2071-restore-patch.sh',
+ 't2072-restore-pathspec-file.sh',
+ 't2080-parallel-checkout-basics.sh',
+ 't2081-parallel-checkout-collisions.sh',
+ 't2082-parallel-checkout-attributes.sh',
+ 't2100-update-cache-badpath.sh',
+ 't2101-update-index-reupdate.sh',
+ 't2102-update-index-symlinks.sh',
+ 't2103-update-index-ignore-missing.sh',
+ 't2104-update-index-skip-worktree.sh',
+ 't2105-update-index-gitfile.sh',
+ 't2106-update-index-assume-unchanged.sh',
+ 't2107-update-index-basic.sh',
+ 't2108-update-index-refresh-racy.sh',
+ 't2200-add-update.sh',
+ 't2201-add-update-typechange.sh',
+ 't2202-add-addremove.sh',
+ 't2203-add-intent.sh',
+ 't2204-add-ignored.sh',
+ 't2205-add-worktree-config.sh',
+ 't2300-cd-to-toplevel.sh',
+ 't2400-worktree-add.sh',
+ 't2401-worktree-prune.sh',
+ 't2402-worktree-list.sh',
+ 't2403-worktree-move.sh',
+ 't2404-worktree-config.sh',
+ 't2405-worktree-submodule.sh',
+ 't2406-worktree-repair.sh',
+ 't2407-worktree-heads.sh',
+ 't2408-worktree-relative.sh',
+ 't2500-untracked-overwriting.sh',
+ 't2501-cwd-empty.sh',
+ 't3000-ls-files-others.sh',
+ 't3001-ls-files-others-exclude.sh',
+ 't3002-ls-files-dashpath.sh',
+ 't3003-ls-files-exclude.sh',
+ 't3004-ls-files-basic.sh',
+ 't3005-ls-files-relative.sh',
+ 't3006-ls-files-long.sh',
+ 't3007-ls-files-recurse-submodules.sh',
+ 't3008-ls-files-lazy-init-name-hash.sh',
+ 't3009-ls-files-others-nonsubmodule.sh',
+ 't3010-ls-files-killed-modified.sh',
+ 't3011-common-prefixes-and-directory-traversal.sh',
+ 't3012-ls-files-dedup.sh',
+ 't3013-ls-files-format.sh',
+ 't3020-ls-files-error-unmatch.sh',
+ 't3040-subprojects-basic.sh',
+ 't3050-subprojects-fetch.sh',
+ 't3060-ls-files-with-tree.sh',
+ 't3070-wildmatch.sh',
+ 't3100-ls-tree-restrict.sh',
+ 't3101-ls-tree-dirname.sh',
+ 't3102-ls-tree-wildcards.sh',
+ 't3103-ls-tree-misc.sh',
+ 't3104-ls-tree-format.sh',
+ 't3105-ls-tree-output.sh',
+ 't3200-branch.sh',
+ 't3201-branch-contains.sh',
+ 't3202-show-branch.sh',
+ 't3203-branch-output.sh',
+ 't3204-branch-name-interpretation.sh',
+ 't3205-branch-color.sh',
+ 't3206-range-diff.sh',
+ 't3207-branch-submodule.sh',
+ 't3211-peel-ref.sh',
+ 't3300-funny-names.sh',
+ 't3301-notes.sh',
+ 't3302-notes-index-expensive.sh',
+ 't3303-notes-subtrees.sh',
+ 't3304-notes-mixed.sh',
+ 't3305-notes-fanout.sh',
+ 't3306-notes-prune.sh',
+ 't3307-notes-man.sh',
+ 't3308-notes-merge.sh',
+ 't3309-notes-merge-auto-resolve.sh',
+ 't3310-notes-merge-manual-resolve.sh',
+ 't3311-notes-merge-fanout.sh',
+ 't3320-notes-merge-worktrees.sh',
+ 't3321-notes-stripspace.sh',
+ 't3400-rebase.sh',
+ 't3401-rebase-and-am-rename.sh',
+ 't3402-rebase-merge.sh',
+ 't3403-rebase-skip.sh',
+ 't3404-rebase-interactive.sh',
+ 't3405-rebase-malformed.sh',
+ 't3406-rebase-message.sh',
+ 't3407-rebase-abort.sh',
+ 't3408-rebase-multi-line.sh',
+ 't3409-rebase-environ.sh',
+ 't3412-rebase-root.sh',
+ 't3413-rebase-hook.sh',
+ 't3415-rebase-autosquash.sh',
+ 't3416-rebase-onto-threedots.sh',
+ 't3417-rebase-whitespace-fix.sh',
+ 't3418-rebase-continue.sh',
+ 't3419-rebase-patch-id.sh',
+ 't3420-rebase-autostash.sh',
+ 't3421-rebase-topology-linear.sh',
+ 't3422-rebase-incompatible-options.sh',
+ 't3423-rebase-reword.sh',
+ 't3424-rebase-empty.sh',
+ 't3425-rebase-topology-merges.sh',
+ 't3426-rebase-submodule.sh',
+ 't3427-rebase-subtree.sh',
+ 't3428-rebase-signoff.sh',
+ 't3429-rebase-edit-todo.sh',
+ 't3430-rebase-merges.sh',
+ 't3431-rebase-fork-point.sh',
+ 't3432-rebase-fast-forward.sh',
+ 't3433-rebase-across-mode-change.sh',
+ 't3434-rebase-i18n.sh',
+ 't3435-rebase-gpg-sign.sh',
+ 't3436-rebase-more-options.sh',
+ 't3437-rebase-fixup-options.sh',
+ 't3438-rebase-broken-files.sh',
+ 't3500-cherry.sh',
+ 't3501-revert-cherry-pick.sh',
+ 't3502-cherry-pick-merge.sh',
+ 't3503-cherry-pick-root.sh',
+ 't3504-cherry-pick-rerere.sh',
+ 't3505-cherry-pick-empty.sh',
+ 't3506-cherry-pick-ff.sh',
+ 't3507-cherry-pick-conflict.sh',
+ 't3508-cherry-pick-many-commits.sh',
+ 't3509-cherry-pick-merge-df.sh',
+ 't3510-cherry-pick-sequence.sh',
+ 't3511-cherry-pick-x.sh',
+ 't3512-cherry-pick-submodule.sh',
+ 't3513-revert-submodule.sh',
+ 't3514-cherry-pick-revert-gpg.sh',
+ 't3600-rm.sh',
+ 't3601-rm-pathspec-file.sh',
+ 't3602-rm-sparse-checkout.sh',
+ 't3650-replay-basics.sh',
+ 't3700-add.sh',
+ 't3701-add-interactive.sh',
+ 't3702-add-edit.sh',
+ 't3703-add-magic-pathspec.sh',
+ 't3704-add-pathspec-file.sh',
+ 't3705-add-sparse-checkout.sh',
+ 't3800-mktag.sh',
+ 't3900-i18n-commit.sh',
+ 't3901-i18n-patch.sh',
+ 't3902-quoted.sh',
+ 't3903-stash.sh',
+ 't3904-stash-patch.sh',
+ 't3905-stash-include-untracked.sh',
+ 't3906-stash-submodule.sh',
+ 't3907-stash-show-config.sh',
+ 't3908-stash-in-worktree.sh',
+ 't3909-stash-pathspec-file.sh',
+ 't3910-mac-os-precompose.sh',
+ 't3920-crlf-messages.sh',
+ 't4000-diff-format.sh',
+ 't4001-diff-rename.sh',
+ 't4002-diff-basic.sh',
+ 't4003-diff-rename-1.sh',
+ 't4004-diff-rename-symlink.sh',
+ 't4005-diff-rename-2.sh',
+ 't4006-diff-mode.sh',
+ 't4007-rename-3.sh',
+ 't4008-diff-break-rewrite.sh',
+ 't4009-diff-rename-4.sh',
+ 't4010-diff-pathspec.sh',
+ 't4011-diff-symlink.sh',
+ 't4012-diff-binary.sh',
+ 't4013-diff-various.sh',
+ 't4014-format-patch.sh',
+ 't4015-diff-whitespace.sh',
+ 't4016-diff-quote.sh',
+ 't4017-diff-retval.sh',
+ 't4018-diff-funcname.sh',
+ 't4019-diff-wserror.sh',
+ 't4020-diff-external.sh',
+ 't4021-format-patch-numbered.sh',
+ 't4022-diff-rewrite.sh',
+ 't4023-diff-rename-typechange.sh',
+ 't4024-diff-optimize-common.sh',
+ 't4025-hunk-header.sh',
+ 't4026-color.sh',
+ 't4027-diff-submodule.sh',
+ 't4028-format-patch-mime-headers.sh',
+ 't4029-diff-trailing-space.sh',
+ 't4030-diff-textconv.sh',
+ 't4031-diff-rewrite-binary.sh',
+ 't4032-diff-inter-hunk-context.sh',
+ 't4033-diff-patience.sh',
+ 't4034-diff-words.sh',
+ 't4035-diff-quiet.sh',
+ 't4036-format-patch-signer-mime.sh',
+ 't4037-diff-r-t-dirs.sh',
+ 't4038-diff-combined.sh',
+ 't4039-diff-assume-unchanged.sh',
+ 't4040-whitespace-status.sh',
+ 't4041-diff-submodule-option.sh',
+ 't4042-diff-textconv-caching.sh',
+ 't4043-diff-rename-binary.sh',
+ 't4044-diff-index-unique-abbrev.sh',
+ 't4045-diff-relative.sh',
+ 't4046-diff-unmerged.sh',
+ 't4047-diff-dirstat.sh',
+ 't4048-diff-combined-binary.sh',
+ 't4049-diff-stat-count.sh',
+ 't4050-diff-histogram.sh',
+ 't4051-diff-function-context.sh',
+ 't4052-stat-output.sh',
+ 't4053-diff-no-index.sh',
+ 't4054-diff-bogus-tree.sh',
+ 't4055-diff-context.sh',
+ 't4056-diff-order.sh',
+ 't4057-diff-combined-paths.sh',
+ 't4058-diff-duplicates.sh',
+ 't4059-diff-submodule-not-initialized.sh',
+ 't4060-diff-submodule-option-diff-format.sh',
+ 't4061-diff-indent.sh',
+ 't4062-diff-pickaxe.sh',
+ 't4063-diff-blobs.sh',
+ 't4064-diff-oidfind.sh',
+ 't4065-diff-anchored.sh',
+ 't4066-diff-emit-delay.sh',
+ 't4067-diff-partial-clone.sh',
+ 't4068-diff-symmetric-merge-base.sh',
+ 't4069-remerge-diff.sh',
+ 't4100-apply-stat.sh',
+ 't4101-apply-nonl.sh',
+ 't4102-apply-rename.sh',
+ 't4103-apply-binary.sh',
+ 't4104-apply-boundary.sh',
+ 't4105-apply-fuzz.sh',
+ 't4106-apply-stdin.sh',
+ 't4107-apply-ignore-whitespace.sh',
+ 't4108-apply-threeway.sh',
+ 't4109-apply-multifrag.sh',
+ 't4110-apply-scan.sh',
+ 't4111-apply-subdir.sh',
+ 't4112-apply-renames.sh',
+ 't4113-apply-ending.sh',
+ 't4114-apply-typechange.sh',
+ 't4115-apply-symlink.sh',
+ 't4116-apply-reverse.sh',
+ 't4117-apply-reject.sh',
+ 't4118-apply-empty-context.sh',
+ 't4119-apply-config.sh',
+ 't4120-apply-popt.sh',
+ 't4121-apply-diffs.sh',
+ 't4122-apply-symlink-inside.sh',
+ 't4123-apply-shrink.sh',
+ 't4124-apply-ws-rule.sh',
+ 't4125-apply-ws-fuzz.sh',
+ 't4126-apply-empty.sh',
+ 't4127-apply-same-fn.sh',
+ 't4128-apply-root.sh',
+ 't4129-apply-samemode.sh',
+ 't4130-apply-criss-cross-rename.sh',
+ 't4131-apply-fake-ancestor.sh',
+ 't4132-apply-removal.sh',
+ 't4133-apply-filenames.sh',
+ 't4134-apply-submodule.sh',
+ 't4135-apply-weird-filenames.sh',
+ 't4136-apply-check.sh',
+ 't4137-apply-submodule.sh',
+ 't4138-apply-ws-expansion.sh',
+ 't4139-apply-escape.sh',
+ 't4140-apply-ita.sh',
+ 't4141-apply-too-large.sh',
+ 't4150-am.sh',
+ 't4151-am-abort.sh',
+ 't4152-am-subjects.sh',
+ 't4153-am-resume-override-opts.sh',
+ 't4200-rerere.sh',
+ 't4201-shortlog.sh',
+ 't4202-log.sh',
+ 't4203-mailmap.sh',
+ 't4204-patch-id.sh',
+ 't4205-log-pretty-formats.sh',
+ 't4206-log-follow-harder-copies.sh',
+ 't4207-log-decoration-colors.sh',
+ 't4208-log-magic-pathspec.sh',
+ 't4209-log-pickaxe.sh',
+ 't4210-log-i18n.sh',
+ 't4211-line-log.sh',
+ 't4212-log-corrupt.sh',
+ 't4213-log-tabexpand.sh',
+ 't4214-log-graph-octopus.sh',
+ 't4215-log-skewed-merges.sh',
+ 't4216-log-bloom.sh',
+ 't4217-log-limit.sh',
+ 't4252-am-options.sh',
+ 't4253-am-keep-cr-dos.sh',
+ 't4254-am-corrupt.sh',
+ 't4255-am-submodule.sh',
+ 't4256-am-format-flowed.sh',
+ 't4257-am-interactive.sh',
+ 't4258-am-quoted-cr.sh',
+ 't4300-merge-tree.sh',
+ 't4301-merge-tree-write-tree.sh',
+ 't5000-tar-tree.sh',
+ 't5001-archive-attr.sh',
+ 't5002-archive-attr-pattern.sh',
+ 't5003-archive-zip.sh',
+ 't5004-archive-corner-cases.sh',
+ 't5100-mailinfo.sh',
+ 't5150-request-pull.sh',
+ 't5200-update-server-info.sh',
+ 't5300-pack-object.sh',
+ 't5301-sliding-window.sh',
+ 't5302-pack-index.sh',
+ 't5303-pack-corruption-resilience.sh',
+ 't5304-prune.sh',
+ 't5305-include-tag.sh',
+ 't5306-pack-nobase.sh',
+ 't5307-pack-missing-commit.sh',
+ 't5308-pack-detect-duplicates.sh',
+ 't5309-pack-delta-cycles.sh',
+ 't5310-pack-bitmaps.sh',
+ 't5311-pack-bitmaps-shallow.sh',
+ 't5312-prune-corruption.sh',
+ 't5313-pack-bounds-checks.sh',
+ 't5314-pack-cycle-detection.sh',
+ 't5315-pack-objects-compression.sh',
+ 't5316-pack-delta-depth.sh',
+ 't5317-pack-objects-filter-objects.sh',
+ 't5318-commit-graph.sh',
+ 't5319-multi-pack-index.sh',
+ 't5320-delta-islands.sh',
+ 't5321-pack-large-objects.sh',
+ 't5322-pack-objects-sparse.sh',
+ 't5323-pack-redundant.sh',
+ 't5324-split-commit-graph.sh',
+ 't5325-reverse-index.sh',
+ 't5326-multi-pack-bitmaps.sh',
+ 't5327-multi-pack-bitmaps-rev.sh',
+ 't5328-commit-graph-64bit-time.sh',
+ 't5329-pack-objects-cruft.sh',
+ 't5330-no-lazy-fetch-with-commit-graph.sh',
+ 't5331-pack-objects-stdin.sh',
+ 't5332-multi-pack-reuse.sh',
+ 't5333-pseudo-merge-bitmaps.sh',
+ 't5334-incremental-multi-pack-index.sh',
+ 't5351-unpack-large-objects.sh',
+ 't5400-send-pack.sh',
+ 't5401-update-hooks.sh',
+ 't5402-post-merge-hook.sh',
+ 't5403-post-checkout-hook.sh',
+ 't5404-tracking-branches.sh',
+ 't5405-send-pack-rewind.sh',
+ 't5406-remote-rejects.sh',
+ 't5407-post-rewrite-hook.sh',
+ 't5408-send-pack-stdin.sh',
+ 't5409-colorize-remote-messages.sh',
+ 't5410-receive-pack-alternates.sh',
+ 't5411-proc-receive-hook.sh',
+ 't5500-fetch-pack.sh',
+ 't5501-fetch-push-alternates.sh',
+ 't5502-quickfetch.sh',
+ 't5503-tagfollow.sh',
+ 't5504-fetch-receive-strict.sh',
+ 't5505-remote.sh',
+ 't5506-remote-groups.sh',
+ 't5507-remote-environment.sh',
+ 't5509-fetch-push-namespaces.sh',
+ 't5510-fetch.sh',
+ 't5511-refspec.sh',
+ 't5512-ls-remote.sh',
+ 't5513-fetch-track.sh',
+ 't5514-fetch-multiple.sh',
+ 't5515-fetch-merge-logic.sh',
+ 't5516-fetch-push.sh',
+ 't5517-push-mirror.sh',
+ 't5518-fetch-exit-status.sh',
+ 't5519-push-alternates.sh',
+ 't5520-pull.sh',
+ 't5521-pull-options.sh',
+ 't5522-pull-symlink.sh',
+ 't5523-push-upstream.sh',
+ 't5524-pull-msg.sh',
+ 't5525-fetch-tagopt.sh',
+ 't5526-fetch-submodules.sh',
+ 't5527-fetch-odd-refs.sh',
+ 't5528-push-default.sh',
+ 't5529-push-errors.sh',
+ 't5530-upload-pack-error.sh',
+ 't5531-deep-submodule-push.sh',
+ 't5532-fetch-proxy.sh',
+ 't5533-push-cas.sh',
+ 't5534-push-signed.sh',
+ 't5535-fetch-push-symref.sh',
+ 't5536-fetch-conflicts.sh',
+ 't5537-fetch-shallow.sh',
+ 't5538-push-shallow.sh',
+ 't5539-fetch-http-shallow.sh',
+ 't5540-http-push-webdav.sh',
+ 't5541-http-push-smart.sh',
+ 't5542-push-http-shallow.sh',
+ 't5543-atomic-push.sh',
+ 't5544-pack-objects-hook.sh',
+ 't5545-push-options.sh',
+ 't5546-receive-limits.sh',
+ 't5547-push-quarantine.sh',
+ 't5548-push-porcelain.sh',
+ 't5549-fetch-push-http.sh',
+ 't5550-http-fetch-dumb.sh',
+ 't5551-http-fetch-smart.sh',
+ 't5552-skipping-fetch-negotiator.sh',
+ 't5553-set-upstream.sh',
+ 't5554-noop-fetch-negotiator.sh',
+ 't5555-http-smart-common.sh',
+ 't5557-http-get.sh',
+ 't5558-clone-bundle-uri.sh',
+ 't5559-http-fetch-smart-http2.sh',
+ 't5560-http-backend-noserver.sh',
+ 't5561-http-backend.sh',
+ 't5562-http-backend-content-length.sh',
+ 't5563-simple-http-auth.sh',
+ 't5564-http-proxy.sh',
+ 't5570-git-daemon.sh',
+ 't5571-pre-push-hook.sh',
+ 't5572-pull-submodule.sh',
+ 't5573-pull-verify-signatures.sh',
+ 't5574-fetch-output.sh',
+ 't5580-unc-paths.sh',
+ 't5581-http-curl-verbose.sh',
+ 't5582-fetch-negative-refspec.sh',
+ 't5583-push-branches.sh',
+ 't5600-clone-fail-cleanup.sh',
+ 't5601-clone.sh',
+ 't5602-clone-remote-exec.sh',
+ 't5603-clone-dirname.sh',
+ 't5604-clone-reference.sh',
+ 't5605-clone-local.sh',
+ 't5606-clone-options.sh',
+ 't5607-clone-bundle.sh',
+ 't5608-clone-2gb.sh',
+ 't5609-clone-branch.sh',
+ 't5610-clone-detached.sh',
+ 't5611-clone-config.sh',
+ 't5612-clone-refspec.sh',
+ 't5613-info-alternate.sh',
+ 't5614-clone-submodules-shallow.sh',
+ 't5615-alternate-env.sh',
+ 't5616-partial-clone.sh',
+ 't5617-clone-submodules-remote.sh',
+ 't5618-alternate-refs.sh',
+ 't5619-clone-local-ambiguous-transport.sh',
+ 't5700-protocol-v1.sh',
+ 't5701-git-serve.sh',
+ 't5702-protocol-v2.sh',
+ 't5703-upload-pack-ref-in-want.sh',
+ 't5704-protocol-violations.sh',
+ 't5705-session-id-in-capabilities.sh',
+ 't5730-protocol-v2-bundle-uri-file.sh',
+ 't5731-protocol-v2-bundle-uri-git.sh',
+ 't5732-protocol-v2-bundle-uri-http.sh',
+ 't5750-bundle-uri-parse.sh',
+ 't5801-remote-helpers.sh',
+ 't5802-connect-helper.sh',
+ 't5810-proto-disable-local.sh',
+ 't5811-proto-disable-git.sh',
+ 't5812-proto-disable-http.sh',
+ 't5813-proto-disable-ssh.sh',
+ 't5814-proto-disable-ext.sh',
+ 't5815-submodule-protos.sh',
+ 't5900-repo-selection.sh',
+ 't6000-rev-list-misc.sh',
+ 't6001-rev-list-graft.sh',
+ 't6002-rev-list-bisect.sh',
+ 't6003-rev-list-topo-order.sh',
+ 't6004-rev-list-path-optim.sh',
+ 't6005-rev-list-count.sh',
+ 't6006-rev-list-format.sh',
+ 't6007-rev-list-cherry-pick-file.sh',
+ 't6008-rev-list-submodule.sh',
+ 't6009-rev-list-parent.sh',
+ 't6010-merge-base.sh',
+ 't6011-rev-list-with-bad-commit.sh',
+ 't6012-rev-list-simplify.sh',
+ 't6013-rev-list-reverse-parents.sh',
+ 't6014-rev-list-all.sh',
+ 't6016-rev-list-graph-simplify-history.sh',
+ 't6017-rev-list-stdin.sh',
+ 't6018-rev-list-glob.sh',
+ 't6019-rev-list-ancestry-path.sh',
+ 't6020-bundle-misc.sh',
+ 't6021-rev-list-exclude-hidden.sh',
+ 't6022-rev-list-missing.sh',
+ 't6030-bisect-porcelain.sh',
+ 't6040-tracking-info.sh',
+ 't6041-bisect-submodule.sh',
+ 't6050-replace.sh',
+ 't6060-merge-index.sh',
+ 't6100-rev-list-in-order.sh',
+ 't6101-rev-parse-parents.sh',
+ 't6102-rev-list-unexpected-objects.sh',
+ 't6110-rev-list-sparse.sh',
+ 't6111-rev-list-treesame.sh',
+ 't6112-rev-list-filters-objects.sh',
+ 't6113-rev-list-bitmap-filters.sh',
+ 't6114-keep-packs.sh',
+ 't6115-rev-list-du.sh',
+ 't6120-describe.sh',
+ 't6130-pathspec-noglob.sh',
+ 't6131-pathspec-icase.sh',
+ 't6132-pathspec-exclude.sh',
+ 't6133-pathspec-rev-dwim.sh',
+ 't6134-pathspec-in-submodule.sh',
+ 't6135-pathspec-with-attrs.sh',
+ 't6136-pathspec-in-bare.sh',
+ 't6200-fmt-merge-msg.sh',
+ 't6300-for-each-ref.sh',
+ 't6301-for-each-ref-errors.sh',
+ 't6302-for-each-ref-filter.sh',
+ 't6400-merge-df.sh',
+ 't6401-merge-criss-cross.sh',
+ 't6402-merge-rename.sh',
+ 't6403-merge-file.sh',
+ 't6404-recursive-merge.sh',
+ 't6405-merge-symlinks.sh',
+ 't6406-merge-attr.sh',
+ 't6407-merge-binary.sh',
+ 't6408-merge-up-to-date.sh',
+ 't6409-merge-subtree.sh',
+ 't6411-merge-filemode.sh',
+ 't6412-merge-large-rename.sh',
+ 't6413-merge-crlf.sh',
+ 't6414-merge-rename-nocruft.sh',
+ 't6415-merge-dir-to-symlink.sh',
+ 't6416-recursive-corner-cases.sh',
+ 't6417-merge-ours-theirs.sh',
+ 't6418-merge-text-auto.sh',
+ 't6419-merge-ignorecase.sh',
+ 't6421-merge-partial-clone.sh',
+ 't6422-merge-rename-corner-cases.sh',
+ 't6423-merge-rename-directories.sh',
+ 't6424-merge-unrelated-index-changes.sh',
+ 't6425-merge-rename-delete.sh',
+ 't6426-merge-skip-unneeded-updates.sh',
+ 't6427-diff3-conflict-markers.sh',
+ 't6428-merge-conflicts-sparse.sh',
+ 't6429-merge-sequence-rename-caching.sh',
+ 't6430-merge-recursive.sh',
+ 't6431-merge-criscross.sh',
+ 't6432-merge-recursive-space-options.sh',
+ 't6433-merge-toplevel.sh',
+ 't6434-merge-recursive-rename-options.sh',
+ 't6435-merge-sparse.sh',
+ 't6436-merge-overwrite.sh',
+ 't6437-submodule-merge.sh',
+ 't6438-submodule-directory-file-conflicts.sh',
+ 't6439-merge-co-error-msgs.sh',
+ 't6500-gc.sh',
+ 't6501-freshen-objects.sh',
+ 't6600-test-reach.sh',
+ 't6700-tree-depth.sh',
+ 't7001-mv.sh',
+ 't7002-mv-sparse-checkout.sh',
+ 't7003-filter-branch.sh',
+ 't7004-tag.sh',
+ 't7005-editor.sh',
+ 't7006-pager.sh',
+ 't7007-show.sh',
+ 't7008-filter-branch-null-sha1.sh',
+ 't7010-setup.sh',
+ 't7011-skip-worktree-reading.sh',
+ 't7012-skip-worktree-writing.sh',
+ 't7030-verify-tag.sh',
+ 't7031-verify-tag-signed-ssh.sh',
+ 't7060-wtstatus.sh',
+ 't7061-wtstatus-ignore.sh',
+ 't7062-wtstatus-ignorecase.sh',
+ 't7063-status-untracked-cache.sh',
+ 't7064-wtstatus-pv2.sh',
+ 't7101-reset-empty-subdirs.sh',
+ 't7102-reset.sh',
+ 't7103-reset-bare.sh',
+ 't7104-reset-hard.sh',
+ 't7105-reset-patch.sh',
+ 't7106-reset-unborn-branch.sh',
+ 't7107-reset-pathspec-file.sh',
+ 't7110-reset-merge.sh',
+ 't7111-reset-table.sh',
+ 't7112-reset-submodule.sh',
+ 't7113-post-index-change-hook.sh',
+ 't7201-co.sh',
+ 't7300-clean.sh',
+ 't7301-clean-interactive.sh',
+ 't7400-submodule-basic.sh',
+ 't7401-submodule-summary.sh',
+ 't7402-submodule-rebase.sh',
+ 't7403-submodule-sync.sh',
+ 't7406-submodule-update.sh',
+ 't7407-submodule-foreach.sh',
+ 't7408-submodule-reference.sh',
+ 't7409-submodule-detached-work-tree.sh',
+ 't7411-submodule-config.sh',
+ 't7412-submodule-absorbgitdirs.sh',
+ 't7413-submodule-is-active.sh',
+ 't7414-submodule-mistakes.sh',
+ 't7416-submodule-dash-url.sh',
+ 't7417-submodule-path-url.sh',
+ 't7418-submodule-sparse-gitmodules.sh',
+ 't7419-submodule-set-branch.sh',
+ 't7420-submodule-set-url.sh',
+ 't7421-submodule-summary-add.sh',
+ 't7422-submodule-output.sh',
+ 't7423-submodule-symlinks.sh',
+ 't7424-submodule-mixed-ref-formats.sh',
+ 't7450-bad-git-dotfiles.sh',
+ 't7500-commit-template-squash-signoff.sh',
+ 't7501-commit-basic-functionality.sh',
+ 't7502-commit-porcelain.sh',
+ 't7503-pre-commit-and-pre-merge-commit-hooks.sh',
+ 't7504-commit-msg-hook.sh',
+ 't7505-prepare-commit-msg-hook.sh',
+ 't7506-status-submodule.sh',
+ 't7507-commit-verbose.sh',
+ 't7508-status.sh',
+ 't7509-commit-authorship.sh',
+ 't7510-signed-commit.sh',
+ 't7511-status-index.sh',
+ 't7512-status-help.sh',
+ 't7513-interpret-trailers.sh',
+ 't7514-commit-patch.sh',
+ 't7515-status-symlinks.sh',
+ 't7516-commit-races.sh',
+ 't7517-per-repo-email.sh',
+ 't7518-ident-corner-cases.sh',
+ 't7519-status-fsmonitor.sh',
+ 't7520-ignored-hook-warning.sh',
+ 't7521-ignored-mode.sh',
+ 't7524-commit-summary.sh',
+ 't7525-status-rename.sh',
+ 't7526-commit-pathspec-file.sh',
+ 't7527-builtin-fsmonitor.sh',
+ 't7528-signed-commit-ssh.sh',
+ 't7600-merge.sh',
+ 't7601-merge-pull-config.sh',
+ 't7602-merge-octopus-many.sh',
+ 't7603-merge-reduce-heads.sh',
+ 't7604-merge-custom-message.sh',
+ 't7605-merge-resolve.sh',
+ 't7606-merge-custom.sh',
+ 't7607-merge-state.sh',
+ 't7608-merge-messages.sh',
+ 't7609-mergetool--lib.sh',
+ 't7610-mergetool.sh',
+ 't7611-merge-abort.sh',
+ 't7612-merge-verify-signatures.sh',
+ 't7614-merge-signoff.sh',
+ 't7615-diff-algo-with-mergy-operations.sh',
+ 't7700-repack.sh',
+ 't7701-repack-unpack-unreachable.sh',
+ 't7702-repack-cyclic-alternate.sh',
+ 't7703-repack-geometric.sh',
+ 't7704-repack-cruft.sh',
+ 't7800-difftool.sh',
+ 't7810-grep.sh',
+ 't7811-grep-open.sh',
+ 't7812-grep-icase-non-ascii.sh',
+ 't7813-grep-icase-iso.sh',
+ 't7814-grep-recurse-submodules.sh',
+ 't7815-grep-binary.sh',
+ 't7816-grep-binary-pattern.sh',
+ 't7817-grep-sparse-checkout.sh',
+ 't7900-maintenance.sh',
+ 't8001-annotate.sh',
+ 't8002-blame.sh',
+ 't8003-blame-corner-cases.sh',
+ 't8004-blame-with-conflicts.sh',
+ 't8005-blame-i18n.sh',
+ 't8006-blame-textconv.sh',
+ 't8007-cat-file-textconv.sh',
+ 't8008-blame-formats.sh',
+ 't8009-blame-vs-topicbranches.sh',
+ 't8010-cat-file-filters.sh',
+ 't8011-blame-split-file.sh',
+ 't8012-blame-colors.sh',
+ 't8013-blame-ignore-revs.sh',
+ 't8014-blame-ignore-fuzzy.sh',
+ 't9001-send-email.sh',
+ 't9002-column.sh',
+ 't9003-help-autocorrect.sh',
+ 't9100-git-svn-basic.sh',
+ 't9101-git-svn-props.sh',
+ 't9102-git-svn-deep-rmdir.sh',
+ 't9103-git-svn-tracked-directory-removed.sh',
+ 't9104-git-svn-follow-parent.sh',
+ 't9105-git-svn-commit-diff.sh',
+ 't9106-git-svn-commit-diff-clobber.sh',
+ 't9107-git-svn-migrate.sh',
+ 't9108-git-svn-glob.sh',
+ 't9109-git-svn-multi-glob.sh',
+ 't9110-git-svn-use-svm-props.sh',
+ 't9111-git-svn-use-svnsync-props.sh',
+ 't9112-git-svn-md5less-file.sh',
+ 't9113-git-svn-dcommit-new-file.sh',
+ 't9114-git-svn-dcommit-merge.sh',
+ 't9115-git-svn-dcommit-funky-renames.sh',
+ 't9116-git-svn-log.sh',
+ 't9117-git-svn-init-clone.sh',
+ 't9118-git-svn-funky-branch-names.sh',
+ 't9119-git-svn-info.sh',
+ 't9120-git-svn-clone-with-percent-escapes.sh',
+ 't9121-git-svn-fetch-renamed-dir.sh',
+ 't9122-git-svn-author.sh',
+ 't9123-git-svn-rebuild-with-rewriteroot.sh',
+ 't9124-git-svn-dcommit-auto-props.sh',
+ 't9125-git-svn-multi-glob-branch-names.sh',
+ 't9126-git-svn-follow-deleted-readded-directory.sh',
+ 't9127-git-svn-partial-rebuild.sh',
+ 't9128-git-svn-cmd-branch.sh',
+ 't9129-git-svn-i18n-commitencoding.sh',
+ 't9130-git-svn-authors-file.sh',
+ 't9131-git-svn-empty-symlink.sh',
+ 't9132-git-svn-broken-symlink.sh',
+ 't9133-git-svn-nested-git-repo.sh',
+ 't9134-git-svn-ignore-paths.sh',
+ 't9135-git-svn-moved-branch-empty-file.sh',
+ 't9136-git-svn-recreated-branch-empty-file.sh',
+ 't9137-git-svn-dcommit-clobber-series.sh',
+ 't9138-git-svn-authors-prog.sh',
+ 't9139-git-svn-non-utf8-commitencoding.sh',
+ 't9140-git-svn-reset.sh',
+ 't9141-git-svn-multiple-branches.sh',
+ 't9142-git-svn-shallow-clone.sh',
+ 't9143-git-svn-gc.sh',
+ 't9144-git-svn-old-rev_map.sh',
+ 't9145-git-svn-master-branch.sh',
+ 't9146-git-svn-empty-dirs.sh',
+ 't9147-git-svn-include-paths.sh',
+ 't9148-git-svn-propset.sh',
+ 't9150-svk-mergetickets.sh',
+ 't9151-svn-mergeinfo.sh',
+ 't9152-svn-empty-dirs-after-gc.sh',
+ 't9153-git-svn-rewrite-uuid.sh',
+ 't9154-git-svn-fancy-glob.sh',
+ 't9155-git-svn-fetch-deleted-tag.sh',
+ 't9156-git-svn-fetch-deleted-tag-2.sh',
+ 't9157-git-svn-fetch-merge.sh',
+ 't9158-git-svn-mergeinfo.sh',
+ 't9159-git-svn-no-parent-mergeinfo.sh',
+ 't9160-git-svn-preserve-empty-dirs.sh',
+ 't9161-git-svn-mergeinfo-push.sh',
+ 't9162-git-svn-dcommit-interactive.sh',
+ 't9163-git-svn-reset-clears-caches.sh',
+ 't9164-git-svn-dcommit-concurrent.sh',
+ 't9165-git-svn-fetch-merge-branch-of-branch.sh',
+ 't9166-git-svn-fetch-merge-branch-of-branch2.sh',
+ 't9167-git-svn-cmd-branch-subproject.sh',
+ 't9168-git-svn-partially-globbed-names.sh',
+ 't9169-git-svn-dcommit-crlf.sh',
+ 't9200-git-cvsexportcommit.sh',
+ 't9210-scalar.sh',
+ 't9211-scalar-clone.sh',
+ 't9300-fast-import.sh',
+ 't9301-fast-import-notes.sh',
+ 't9302-fast-import-unpack-limit.sh',
+ 't9303-fast-import-compression.sh',
+ 't9304-fast-import-marks.sh',
+ 't9350-fast-export.sh',
+ 't9351-fast-export-anonymize.sh',
+ 't9400-git-cvsserver-server.sh',
+ 't9401-git-cvsserver-crlf.sh',
+ 't9402-git-cvsserver-refs.sh',
+ 't9500-gitweb-standalone-no-errors.sh',
+ 't9501-gitweb-standalone-http-status.sh',
+ 't9502-gitweb-standalone-parse-output.sh',
+ 't9600-cvsimport.sh',
+ 't9601-cvsimport-vendor-branch.sh',
+ 't9602-cvsimport-branches-tags.sh',
+ 't9603-cvsimport-patchsets.sh',
+ 't9604-cvsimport-timestamps.sh',
+ 't9700-perl-git.sh',
+ 't9800-git-p4-basic.sh',
+ 't9801-git-p4-branch.sh',
+ 't9802-git-p4-filetype.sh',
+ 't9803-git-p4-shell-metachars.sh',
+ 't9804-git-p4-label.sh',
+ 't9805-git-p4-skip-submit-edit.sh',
+ 't9806-git-p4-options.sh',
+ 't9807-git-p4-submit.sh',
+ 't9808-git-p4-chdir.sh',
+ 't9809-git-p4-client-view.sh',
+ 't9810-git-p4-rcs.sh',
+ 't9811-git-p4-label-import.sh',
+ 't9812-git-p4-wildcards.sh',
+ 't9813-git-p4-preserve-users.sh',
+ 't9814-git-p4-rename.sh',
+ 't9815-git-p4-submit-fail.sh',
+ 't9816-git-p4-locked.sh',
+ 't9817-git-p4-exclude.sh',
+ 't9818-git-p4-block.sh',
+ 't9819-git-p4-case-folding.sh',
+ 't9820-git-p4-editor-handling.sh',
+ 't9821-git-p4-path-variations.sh',
+ 't9822-git-p4-path-encoding.sh',
+ 't9823-git-p4-mock-lfs.sh',
+ 't9824-git-p4-git-lfs.sh',
+ 't9825-git-p4-handle-utf16-without-bom.sh',
+ 't9826-git-p4-keep-empty-commits.sh',
+ 't9827-git-p4-change-filetype.sh',
+ 't9828-git-p4-map-user.sh',
+ 't9829-git-p4-jobs.sh',
+ 't9830-git-p4-symlink-dir.sh',
+ 't9831-git-p4-triggers.sh',
+ 't9832-unshelve.sh',
+ 't9833-errors.sh',
+ 't9834-git-p4-file-dir-bug.sh',
+ 't9835-git-p4-metadata-encoding-python2.sh',
+ 't9836-git-p4-metadata-encoding-python3.sh',
+ 't9850-shell.sh',
+ 't9901-git-web--browse.sh',
+ 't9902-completion.sh',
+ 't9903-bash-prompt.sh',
+]
+
+# GIT_BUILD_DIR needs to be Unix-style without drive prefixes as it 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 it.
+git_build_dir = meson.project_build_root()
+if cygpath.found()
+ git_build_dir = run_command(cygpath, git_build_dir, check: true).stdout().strip()
+endif
+
+test_environment = script_environment
+test_environment.set('GIT_BUILD_DIR', git_build_dir)
+
+foreach integration_test : integration_tests
+ test(fs.stem(integration_test), shell,
+ args: [ integration_test ],
+ workdir: meson.current_source_dir(),
+ env: test_environment,
+ depends: test_dependencies + bin_wrappers,
+ timeout: 0,
+ )
+endforeach
diff --git a/templates/hooks/meson.build b/templates/hooks/meson.build
new file mode 100644
index 00000000000..f948b9fb145
--- /dev/null
+++ b/templates/hooks/meson.build
@@ -0,0 +1,24 @@
+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,
+ )
+endforeach
diff --git a/templates/info/meson.build b/templates/info/meson.build
new file mode 100644
index 00000000000..1a2f2f84d2f
--- /dev/null
+++ b/templates/info/meson.build
@@ -0,0 +1,5 @@
+configure_file(
+ input: 'exclude',
+ output: 'exclude',
+ configuration: template_config,
+)
diff --git a/templates/meson.build b/templates/meson.build
new file mode 100644
index 00000000000..010b9ef6d3a
--- /dev/null
+++ b/templates/meson.build
@@ -0,0 +1,13 @@
+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,
+)
+
+subdir('hooks')
+subdir('info')
--
2.47.0.118.gfd3785337b.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v4 19/19] meson: fix conflicts with in-flight topics
2024-10-24 12:39 ` [RFC PATCH v4 00/19] " Patrick Steinhardt
` (17 preceding siblings ...)
2024-10-24 12:40 ` [RFC PATCH v4 18/19] Introduce support for the Meson build system Patrick Steinhardt
@ 2024-10-24 12:40 ` Patrick Steinhardt
2024-10-24 16:02 ` [RFC PATCH v4 00/19] Modernize the build system Taylor Blau
` (2 subsequent siblings)
21 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-24 12:40 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau
As support for Meson is still in-flight we have to accommodate for
conflicts with topics in "seen". The following conflicts are being
addressed in this commit:
- ej/cat-file-remote-object-info adds t1017.
- cc/promisor-remote-capability adds t5710.
- ds/path-walk adds t6601 as well as "path-walk.c" and
"test-path-walk.c".
- am/git-blame-ignore-revs-by-default adds t8015 and t8016.
- ps/reftable-detach adds "reftable/system.c".
- js/libgit-rust adds "common-exit.c" and "common-init.c".
This is somewhat painful in the current state where Meson is not yet
part of the main tree, but we'll have to live with that for the time
being.
I've split this commit out into a separate fixup-style commit such that
it is possible to test this topic both with and without "seen" merged
into it. You can simply revert this commit to test without "seen".
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
meson.build | 4 ++++
t/helper/meson.build | 1 +
t/meson.build | 5 +++++
3 files changed, 10 insertions(+)
diff --git a/meson.build b/meson.build
index 86d9a5c9f94..d1b97443b8f 100644
--- a/meson.build
+++ b/meson.build
@@ -65,6 +65,8 @@ libgit_sources = [
'commit-graph.c',
'commit-reach.c',
'commit.c',
+ 'common-exit.c',
+ 'common-init.c',
'compat/nonblock.c',
'compat/obstack.c',
'compat/terminal.c',
@@ -177,6 +179,7 @@ libgit_sources = [
'parse-options.c',
'patch-delta.c',
'patch-ids.c',
+ 'path-walk.c',
'path.c',
'pathspec.c',
'pkt-line.c',
@@ -217,6 +220,7 @@ libgit_sources = [
'reftable/reader.c',
'reftable/record.c',
'reftable/stack.c',
+ 'reftable/system.c',
'reftable/tree.c',
'reftable/writer.c',
'remote.c',
diff --git a/t/helper/meson.build b/t/helper/meson.build
index 5e83884246e..f502d1aaa36 100644
--- a/t/helper/meson.build
+++ b/t/helper/meson.build
@@ -40,6 +40,7 @@ test_tool_sources = [
'test-parse-pathspec-file.c',
'test-partial-clone.c',
'test-path-utils.c',
+ 'test-path-walk.c',
'test-pcre2-config.c',
'test-pkt-line.c',
'test-proc-receive.c',
diff --git a/t/meson.build b/t/meson.build
index 48efe51fbe6..dfe7c3b8064 100644
--- a/t/meson.build
+++ b/t/meson.build
@@ -167,6 +167,7 @@ integration_tests = [
't1014-read-tree-confusing.sh',
't1015-read-index-unmerged.sh',
't1016-compatObjectFormat.sh',
+ 't1017-cat-file-remote-object-info.sh',
't1020-subdirectory.sh',
't1021-rerere-in-workdir.sh',
't1022-read-tree-partial-clone.sh',
@@ -718,6 +719,7 @@ integration_tests = [
't5703-upload-pack-ref-in-want.sh',
't5704-protocol-violations.sh',
't5705-session-id-in-capabilities.sh',
+ 't5710-promisor-remote-capability.sh',
't5730-protocol-v2-bundle-uri-file.sh',
't5731-protocol-v2-bundle-uri-git.sh',
't5732-protocol-v2-bundle-uri-http.sh',
@@ -820,6 +822,7 @@ integration_tests = [
't6500-gc.sh',
't6501-freshen-objects.sh',
't6600-test-reach.sh',
+ 't6601-path-walk.sh',
't6700-tree-depth.sh',
't7001-mv.sh',
't7002-mv-sparse-checkout.sh',
@@ -946,6 +949,8 @@ integration_tests = [
't8012-blame-colors.sh',
't8013-blame-ignore-revs.sh',
't8014-blame-ignore-fuzzy.sh',
+ 't8015-blame-default-ignore-revs.sh',
+ 't8016-blame-override-ignore-revs.sh',
't9001-send-email.sh',
't9002-column.sh',
't9003-help-autocorrect.sh',
--
2.47.0.118.gfd3785337b.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v4 00/19] Modernize the build system
2024-10-24 12:39 ` [RFC PATCH v4 00/19] " Patrick Steinhardt
` (18 preceding siblings ...)
2024-10-24 12:40 ` [RFC PATCH v4 19/19] meson: fix conflicts with in-flight topics Patrick Steinhardt
@ 2024-10-24 16:02 ` Taylor Blau
2024-10-25 19:59 ` Taylor Blau
2024-10-28 21:34 ` Ramsay Jones
21 siblings, 0 replies; 386+ messages in thread
From: Taylor Blau @ 2024-10-24 16:02 UTC (permalink / raw)
To: Patrick Steinhardt
Cc: git, Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones
On Thu, Oct 24, 2024 at 02:39:43PM +0200, Patrick Steinhardt wrote:
> - The last patch is a compatibility patch for "seen". There are a
> couple of topics that interact with this series, and I didn't want
> to make all of them a strict dependency. So I've decided to just
> create a fixup-style commit that does the necessary changes in order
> to work with "seen". Like this, you can test without "seen" by
> simply dropping that last commit, and you can test with "seen" by
> merging it into this topic.
>
> @Taylor: I didn't really have a better idea than this. There are
> six additional topics that this branch interacts with, and building
> the branch with eight dependencies in total didn't feel sensible.
> Ideally, the topic branch itself shouldn't have the last commit, but
> once it gets merged into 'seen' we should have it. Let me know in
> case you have a better idea though.
>
> This topic is built on top of fd3785337b (The third batch, 2024-10-22)
> with the following two branches merged into it:
>
> - ps/upgrade-clar at 30bf9f0aaa (cmake: set up proper dependencies for
> generated clar headers, 2024-10-21). This is currently in 'seen'.
>
> - ps/platform-compat-fixes at 80ebd91b83 (http: fix build error on
> FreeBSD, 2024-10-16). This has been merged to 'next'.
Thanks for all of the helpful information. I changed the base up to
"The third batch" and merged in the two branches you mentioned.
Everything builds fine at the tip and passes 'make test'.
> I was pondering a bit whether I should split this topic up even further.
> I've already evicted other parts out of it such that they can land
> separately, and landing the Makefile refactorings independently would
> reduce the overall review load. These steps also make sense even if we
> don't have Meson, as those are all either simplifications, improvements
> for CMake or a necessary step towards out-of-tree builds. Let me know
> your thoughts!
I think erring on the side of smaller series makes them easier to
review, as Stolee and I were talking about in another thread. But if you
feel like this topic is receiving sufficient review as-is, then I
wouldn't bother changing it.
Thanks,
Taylor
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v3 00/15] Modernize the build system
2024-10-24 7:19 ` Patrick Steinhardt
@ 2024-10-24 17:34 ` Ramsay Jones
2024-10-25 5:20 ` Patrick Steinhardt
0 siblings, 1 reply; 386+ messages in thread
From: Ramsay Jones @ 2024-10-24 17:34 UTC (permalink / raw)
To: Patrick Steinhardt
Cc: Eli Schwartz, git, Eric Sunshine, Phillip Wood, Junio C Hamano
On 24/10/2024 08:19, Patrick Steinhardt wrote:
> On Wed, Oct 23, 2024 at 03:38:18PM +0100, Ramsay Jones wrote:
>>> Do any of the versions used maybe differ?
[snip]
> Oh, wait! I can see that there's a "python3" 3.9.18 available as a
> testing version. I don't quite understand how this works though, because
> when I install it I still have Python 3.9.16. Seems like there are two
> Python packages: "python3", which has the 3.9.18 test version, and then
> there's "python39", which only has 3.9.16. The first one just seems to
> be a meta package, so it doesn't contain anything.
>
> So... where did you get Python 3.9.18 from? You mentioned that it also
> hogs all CPU, so could it be that this is basically a broken Python
> installation?
Hmm I have no idea how my python installation got messed up (I never try
to install TEST packages, but I do just install anything that is in the
'pending' page without even thinking!).
Last night I remembered that when installing something recently on windows
it also (without even asking) installed a windows python as well, but that
is hidden due to my path ...
$ /cygdrive/c/Users/ramsay/AppData/Local/Programs/Python/Python312/python --version
Python 3.12.4
$
My current python packages (which include many obsolete python2 packages)
looks like:
$ cygcheck -c python
Cygwin Package Information
Package Version Status
python 3.0.0-1 OK
$ cygcheck -c python3
Cygwin Package Information
Package Version Status
python3 3.9.18-1 OK
$ which python python3
/usr/bin/python
/usr/bin/python3
$ python --version
Python 3.9.18
$ python3 --version
Python 3.9.18
$
Go away and wrangle with setup.exe ...
$ python --version
Python 3.9.16
$ python3 --version
Python 3.9.16
$ which python python3
/usr/bin/python
/usr/bin/python3
$ cd git
$ mkdir build
$ cd build
$ meson setup .. -Dprefix=$HOME
...
git v2.47.GIT
User defined options
prefix: /home/ramsay
Found ninja-1.12.0 at /usr/bin/ninja
$ ninja
[699/699] Linking target t/helper/test-tool.exe
$ meson test 't000*'
ninja: Entering directory `/home/ramsay/git/build'
ninja: no work to do.
1/9 t0002-gitfile OK 10.52s
2/9 t0004-unwritable OK 6.78s
3/9 t0005-signals OK 5.96s
4/9 t0003-attributes OK 54.40s
5/9 t0006-date OK 31.39s
6/9 t0001-init OK 61.68s
7/9 t0007-git-var OK 12.93s
8/9 t0008-ignores FAIL 106.29s exit status 1
>>> PATH='/home/ramsay/git:/usr/bin:/usr/bin:/usr/bin:/usr/bin:/home/ramsay/bin:/usr/bin:/usr/bin:/home/ramsay/bin:/home/ramsay/bin:/usr/local/bin:/usr/bin:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:/cygdrive/c/WINDOWS/System32/Wbem:/cygdrive/c/WINDOWS/System32/WindowsPowerShell/v1.0:/cygdrive/c/WINDOWS/System32/OpenSSH:/cygdrive/c/Users/ramsay/AppData/Local/Programs/Python/Python312/Scripts:/cygdrive/c/Users/ramsay/AppData/Local/Programs/Python/Python312:/cygdrive/c/Users/ramsay/AppData/Local/Programs/Python/Launcher:/cygdrive/c/Users/ramsay/AppData/Local/Microsoft/WindowsApps:/usr/lib/lapack' MALLOC_PERTURB_=105 ASAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1 UBSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1 GIT_BUILD_DIR=/home/ramsay/git/build /usr/bin/sh t0008-ignores.sh
9/9 t0000-basic OK 193.52s
Ok: 8
Expected Fail: 0
Fail: 1
Unexpected Pass: 0
Skipped: 0
Timeout: 0
Full log written to /home/ramsay/git/build/meson-logs/testlog.txt
$
So, a big improvement! :)
Having a quick squint at the failure, it '# failed 1 among 397 test(s)'
which was 'not ok 391 - correct handling of backslashes', which is the
only test marked with a '!CYGWIN' prerequisite! ;) So it seems that I
am doing something wrong, which results in the prerequisite not being
set.
I haven't debugged that yet, but I wanted to note the above improvement
having 'fixed' my python installation. (It doesn't look good for the
TEST package! :) ).
Thanks!
ATB,
Ramsay Jones
`
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v3 00/15] Modernize the build system
2024-10-24 17:34 ` Ramsay Jones
@ 2024-10-25 5:20 ` Patrick Steinhardt
2024-10-25 16:36 ` Ramsay Jones
0 siblings, 1 reply; 386+ messages in thread
From: Patrick Steinhardt @ 2024-10-25 5:20 UTC (permalink / raw)
To: Ramsay Jones
Cc: Eli Schwartz, git, Eric Sunshine, Phillip Wood, Junio C Hamano
On Thu, Oct 24, 2024 at 06:34:24PM +0100, Ramsay Jones wrote:
> On 24/10/2024 08:19, Patrick Steinhardt wrote:
> Having a quick squint at the failure, it '# failed 1 among 397 test(s)'
> which was 'not ok 391 - correct handling of backslashes', which is the
> only test marked with a '!CYGWIN' prerequisite! ;) So it seems that I
> am doing something wrong, which results in the prerequisite not being
> set.
The CYGWIN prerequisite is set depending on whether or not `uname -s`
contains "*CYGWIN*". Does your system maybe pick up the wrong uname(1)
binary somehow?
> I haven't debugged that yet, but I wanted to note the above improvement
> having 'fixed' my python installation. (It doesn't look good for the
> TEST package! :) ).
Great, happy to hear that this is resolved now.
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v3 00/15] Modernize the build system
2024-10-25 5:20 ` Patrick Steinhardt
@ 2024-10-25 16:36 ` Ramsay Jones
2024-11-04 12:16 ` Patrick Steinhardt
0 siblings, 1 reply; 386+ messages in thread
From: Ramsay Jones @ 2024-10-25 16:36 UTC (permalink / raw)
To: Patrick Steinhardt
Cc: Eli Schwartz, git, Eric Sunshine, Phillip Wood, Junio C Hamano
On 25/10/2024 06:20, Patrick Steinhardt wrote:
> On Thu, Oct 24, 2024 at 06:34:24PM +0100, Ramsay Jones wrote:
>> On 24/10/2024 08:19, Patrick Steinhardt wrote:
>> Having a quick squint at the failure, it '# failed 1 among 397 test(s)'
>> which was 'not ok 391 - correct handling of backslashes', which is the
>> only test marked with a '!CYGWIN' prerequisite! ;) So it seems that I
>> am doing something wrong, which results in the prerequisite not being
>> set.
>
> The CYGWIN prerequisite is set depending on whether or not `uname -s`
> contains "*CYGWIN*". Does your system maybe pick up the wrong uname(1)
> binary somehow?
Yep, I suspected that I knew what the problem was, I just had not looked
to see if my hunch was correct yet! :) And indeed:
$ pwd
/home/ramsay/git
$ ls -l uname*
-rw-r--r-- 1 ramsay None 11K Jun 28 2019 uname.c
-rwxr-xr-x 1 ramsay None 167K Jun 28 2019 uname.exe*
$ ./uname -s
Windows
$ ./uname -a
Windows satellite 10.0 19045() AMD-64 Windows 10 Home
$ uname -a
CYGWIN_NT-10.0-19045 satellite 3.5.4-1.x86_64 2024-08-25 16:52 UTC x86_64 Cygwin
$
As you can see, many many moons ago (28 Jun 2019 was just the last time
it was updated/built - I suspect it was first written in 2006), I had
written my own version of uname. If memory serves, it was actually for
the 'msys' version, not cygwin! ;)
Anyway, when the test executes my PATH starts:
/home/ramsay/git/build/bin-wrappers:/home/ramsay/git:/usr/bin ...
It is not immediately obvious why '/home/ramsay/git' is in there, but
if I move my uname out of the way:
$ mv uname* ../src
$ ls -l uname*
ls: cannot access 'uname*': No such file or directory
$
then everything works:
$ cd build
$ meson test 't000*'
ninja: Entering directory `/home/ramsay/git/build'
ninja: no work to do.
1/9 t0002-gitfile OK 10.28s
2/9 t0004-unwritable OK 6.70s
3/9 t0005-signals OK 6.13s
4/9 t0003-attributes OK 52.56s
5/9 t0006-date OK 30.16s
6/9 t0001-init OK 60.24s
7/9 t0007-git-var OK 12.93s
8/9 t0008-ignores OK 106.42s
9/9 t0000-basic OK 192.99s
Ok: 9
Expected Fail: 0
Fail: 0
Unexpected Pass: 0
Skipped: 0
Timeout: 0
Full log written to /home/ramsay/git/build/meson-logs/testlog.txt
$
So, I just need to build the v4 version and test again (at some point
I have to do a full (6 hour+) test run on cygwin!).
Thanks!
ATB,
Ramsay Jones
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v4 00/19] Modernize the build system
2024-10-24 12:39 ` [RFC PATCH v4 00/19] " Patrick Steinhardt
` (19 preceding siblings ...)
2024-10-24 16:02 ` [RFC PATCH v4 00/19] Modernize the build system Taylor Blau
@ 2024-10-25 19:59 ` Taylor Blau
2024-11-04 12:17 ` Patrick Steinhardt
2024-11-04 15:11 ` Eli Schwartz
2024-10-28 21:34 ` Ramsay Jones
21 siblings, 2 replies; 386+ messages in thread
From: Taylor Blau @ 2024-10-25 19:59 UTC (permalink / raw)
To: Patrick Steinhardt
Cc: git, Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones
On Thu, Oct 24, 2024 at 02:39:43PM +0200, Patrick Steinhardt wrote:
> Hi,
>
> this is the fourth version of my patch series that modernizes our build
> system. It refactors various parts of it to make it possible to perform
> out-of-tree builds in theory and then wires up Meson.
I was thinking a little bit about this topic last night and wanted to
collect my thoughts somewhere.
I think that there are a couple of things that I'm not 100% clear or
sold on, which are:
- What is the eventual goal of this series? Do we plan to transition
the existing make-driven builds to instead be built with Meson? Will
we have both? Something else?
- What is the eventual plan for CMake, which is maintained currently
in the contrib directory? Will it be deprecated in favor of Meson?
Will we continue to support it?
Let me expand a little on each of those in turn:
== What is the eventual goal?
From reading [PATCH 17/19], it seems the main arguments in favor of
using Meson are:
- Ease of use: easy to use, discovering available options is easy. The
scripting language is straight-forward to use.
- IDE support: Supports generating build instructions for Xcode and Microsoft
Visual Studio, a plugin exists for Visual Studio Code.
- Out-of-tree builds: supported.
- Cross-platform builds: supported.
- Language support:
- C: Supported for GCC, Clang, MSVC and other toolchains.
- Rust: Supported for rustc.
- Test integration: supported. Interactive tests are supported starting with
Meson 1.5.0 via the `--interactive` flag.
I don't think that when reading these any of them stick out to me and
compel me to learn a new build system. I understand and am sympathetic
to the fact that GNU Make has odd syntax and can be cumbersome. But I
don't think that incrementally modifying our Makefile over time is
difficult, and it has certainly worked well over the years.
Certainly there is ample support for IDE integration with Make.
Out-of-tree builds and cross-platform builds could be supported in
theory as you note within the existing build system. Another suggestion
you make is that Meson has better native support for Rust, which I agree
may be important to consider in the future.
But I don't think that any of those three (out-of-tree builds,
cross-compilation, or Rust support) are insurmountable challenges in
Make. Certainly there is a lot of inertia there, but I don't think
that's a bad thing. Contributors are used to the existing build system,
it has worked well for us, works across many platforms and has (IMO)
stood the test of time.
I admittedly have a hard time squaring the benefits and goals we have
with Meson with the cost of learning a new build system, and/or moving
away from Make entirely.
I am entirely open to the possibility that there is something that I am
missing here, and that Meson really is a better choice for Git given our
current direction. But I think if that's true, then the series needs to
explain that more prominently.
== What is the eventual plan for CMake?
From [PATCH 18/19], you write:
> 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.
I don't view this is a good intermediate state, and is in my view making
an existing problem that we have worse. On the "existing problem": I
think that landing CMake support in contrib was a mistake. In my view,
CMake support should have either been a first-class citizen in Git (such
that we don't consider a change "done" until it can be built by CMake),
or should have been maintained out-of-tree.
But I think we struck a worst-of-both-worlds balance by landing it in
contrib. It's maintained in the tree, so people expect to be able to
build the project with it because it comes with a bog-standard clone of
git.git.
But despite living in the project's tree, it is not a first-class
citizen, and subjectively it seems that we get an awful lot of mail
asking why something doesn't build in CMake, etc. (To your credit, I
think you have been one of the main people to help with that, often
fixing those bugs yourself, which is greatly appreciated).
I don't want to see the project have to pseudo-maintain three build
systems. It seems like doing so would be cumbersome, and error-prone. I
am already probably guilty of breaking CMake builds when I add a new
compilation unit to the project, because of a combination of my lack of
familiarity with CMake, and the fact that we don't have a project-wide
convention of treating it with the same care as we do the Makefile. I
think that having three build systems (even if they only co-existed
until Git 3.0) would make that problem worse.
I feel that if we are going to pursue Meson over CMake and/or Make, we
should have a clear plan to either get rid of CMake, keep it up-to-date,
or something else.
== Conclusion
To step back, I want to say that I appreciate your work on this series
and am certainly not opposed[^1] to the idea that we may need to make
significant changes to our build infrastructure to support the project's
goals.
But I think that what I'm missing currently is a clear picture of what
goals we *can't* achieve with the existing build system (or could, but
only at significant cost/awkwardness), and why Meson is the right choice
to address those gaps.
If the project can agree that pursuing Meson as a replacement for Make,
CMake, or both, then I think we would need further clarification on what
we want to do with CMake (and more generally how we want to support new
efforts to add additional build systems to Git in the future).
Anyway. If I have significantly missed the point here, please feel free
to correct me. In the meantime, I think discussing these points would be
useful to clarifying the direction of the series.
Thanks,
Taylor
[^1]: Both in my current capacity as interim-maintainer, but also as a
regular contributor to the project, who would (in both cases) be
interested in evolving the build system we use in furtherance of
project goals.
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v4 00/19] Modernize the build system
2024-10-24 12:39 ` [RFC PATCH v4 00/19] " Patrick Steinhardt
` (20 preceding siblings ...)
2024-10-25 19:59 ` Taylor Blau
@ 2024-10-28 21:34 ` Ramsay Jones
2024-11-04 12:16 ` Patrick Steinhardt
21 siblings, 1 reply; 386+ messages in thread
From: Ramsay Jones @ 2024-10-28 21:34 UTC (permalink / raw)
To: Patrick Steinhardt, git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Taylor Blau
On 24/10/2024 13:39, Patrick Steinhardt wrote:
> Hi,
>
> this is the fourth version of my patch series that modernizes our build
> system. It refactors various parts of it to make it possible to perform
> out-of-tree builds in theory and then wires up Meson.
As Promised, I have tested this version on Linux and Cygwin (not full test
on patches 1-18). When built on top of fd3785337b (The third batch) with
the two branches merged (as indicated below) Linux (build+test) and cygwin
(just build) work as expected.
> Changes compared to v3:
>
> - Various typo fixes.
>
> - Our Makefile now detects unsubstituted build options in the newly-
> introduced "GIT-BUILD-OPTIONS.in" template.
>
> - I've wired up support for building and installing manpages. This was
> the last important bit missing to get a fully functioning Git
> installation. We generate the same set of manpages that our Makefile
> would and also render a subset of the HTML pages we generate. Not
> wired up are our technical docs, but doing those shouldn't be all
> that involved.
>
> Documentation is not built by default, but can be enabled by passing
> any combination of `-Ddocs=html,man`.
I haven't tried this (yet).
> - I've dropped the target names for `custom_target()` invocations.
> Those are auto-derived from the first output anyway, so they only
> add unnecessary noise.
>
> - The last patch is a compatibility patch for "seen". There are a
> couple of topics that interact with this series, and I didn't want
> to make all of them a strict dependency. So I've decided to just
> create a fixup-style commit that does the necessary changes in order
> to work with "seen". Like this, you can test without "seen" by
> simply dropping that last commit, and you can test with "seen" by
> merging it into this topic.
I couldn't try this patch because (at the time) the 'seen' branch
didn't build. :(
> @Taylor: I didn't really have a better idea than this. There are
> six additional topics that this branch interacts with, and building
> the branch with eight dependencies in total didn't feel sensible.
> Ideally, the topic branch itself shouldn't have the last commit, but
> once it gets merged into 'seen' we should have it. Let me know in
> case you have a better idea though.
>
> This topic is built on top of fd3785337b (The third batch, 2024-10-22)
> with the following two branches merged into it:
>
> - ps/upgrade-clar at 30bf9f0aaa (cmake: set up proper dependencies for
> generated clar headers, 2024-10-21). This is currently in 'seen'.
>
> - ps/platform-compat-fixes at 80ebd91b83 (http: fix build error on
> FreeBSD, 2024-10-16). This has been merged to 'next'.
As indicated above, this worked just fine.
Now that 'seen' builds again [92855bf61d ("Merge branch 'ps/build' into seen",
2024-10-27)], I tested meson on Linux and Cygwin (build and *full* test this
time).
On Linux, the result looks like:
$ tail meson-logs/testlog.txt
Summary of Failures:
117/1035 t1017-cat-file-remote-object-info FAIL 0.01s exit status 2
Ok: 1034
Expected Fail: 0
Fail: 1
Unexpected Pass: 0
Skipped: 0
Timeout: 0
$
It looks like a branch has been removed from 'seen'. :) (ie the t1017* test
file does not exist).
On cygwin, the result looks like:
$ tail -11 meson-logs/testlog.txt
Summary of Failures:
23/1035 t-reftable-stack TIMEOUT 30.26s killed by signal 15 SIGTERM
114/1035 t1017-cat-file-remote-object-info FAIL 0.13s exit status 127
Ok: 1033
Expected Fail: 0
Fail: 1
Unexpected Pass: 0
Skipped: 0
Timeout: 1
$
The t-reftable-stack unit test took just over 75s on the v2.27.0 test run.
I haven't looked into it yet, but plenty of other tests run for longer than
the 30s, so I don't know why that test seems to be different.
Also, it is worth noting that the test ran for 2hr50min. Usually I have to
wait 6hr approx. for 'make test' to finish because I don't like to use any
'-j' parameters (You can't do anything else on the machine while it is
cooking the cpu!). :)
Thanks!
ATB,
Ramsay Jones
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v3 00/15] Modernize the build system
2024-10-25 16:36 ` Ramsay Jones
@ 2024-11-04 12:16 ` Patrick Steinhardt
0 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-04 12:16 UTC (permalink / raw)
To: Ramsay Jones
Cc: Eli Schwartz, git, Eric Sunshine, Phillip Wood, Junio C Hamano
On Fri, Oct 25, 2024 at 05:36:00PM +0100, Ramsay Jones wrote:
>
>
> On 25/10/2024 06:20, Patrick Steinhardt wrote:
> > On Thu, Oct 24, 2024 at 06:34:24PM +0100, Ramsay Jones wrote:
> >> On 24/10/2024 08:19, Patrick Steinhardt wrote:
> >> Having a quick squint at the failure, it '# failed 1 among 397 test(s)'
> >> which was 'not ok 391 - correct handling of backslashes', which is the
> >> only test marked with a '!CYGWIN' prerequisite! ;) So it seems that I
> >> am doing something wrong, which results in the prerequisite not being
> >> set.
> >
> > The CYGWIN prerequisite is set depending on whether or not `uname -s`
> > contains "*CYGWIN*". Does your system maybe pick up the wrong uname(1)
> > binary somehow?
>
>
> Yep, I suspected that I knew what the problem was, I just had not looked
> to see if my hunch was correct yet! :) And indeed:
>
> $ pwd
> /home/ramsay/git
> $ ls -l uname*
> -rw-r--r-- 1 ramsay None 11K Jun 28 2019 uname.c
> -rwxr-xr-x 1 ramsay None 167K Jun 28 2019 uname.exe*
> $ ./uname -s
> Windows
> $ ./uname -a
> Windows satellite 10.0 19045() AMD-64 Windows 10 Home
> $ uname -a
> CYGWIN_NT-10.0-19045 satellite 3.5.4-1.x86_64 2024-08-25 16:52 UTC x86_64 Cygwin
> $
>
> As you can see, many many moons ago (28 Jun 2019 was just the last time
> it was updated/built - I suspect it was first written in 2006), I had
> written my own version of uname. If memory serves, it was actually for
> the 'msys' version, not cygwin! ;)
>
> Anyway, when the test executes my PATH starts:
>
> /home/ramsay/git/build/bin-wrappers:/home/ramsay/git:/usr/bin ...
>
> It is not immediately obvious why '/home/ramsay/git' is in there, but
> if I move my uname out of the way:
>
> $ mv uname* ../src
> $ ls -l uname*
> ls: cannot access 'uname*': No such file or directory
> $
Interesting. I guess that `find_program()` finds some of the required
binaries in the Git directory itself, which sounds wrong to me. I'll
have a look at this.
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v4 00/19] Modernize the build system
2024-10-28 21:34 ` Ramsay Jones
@ 2024-11-04 12:16 ` Patrick Steinhardt
0 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-04 12:16 UTC (permalink / raw)
To: Ramsay Jones
Cc: git, Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Taylor Blau
On Mon, Oct 28, 2024 at 09:34:25PM +0000, Ramsay Jones wrote:
>
>
> On 24/10/2024 13:39, Patrick Steinhardt wrote:
> > Hi,
> >
> > this is the fourth version of my patch series that modernizes our build
> > system. It refactors various parts of it to make it possible to perform
> > out-of-tree builds in theory and then wires up Meson.
>
> As Promised, I have tested this version on Linux and Cygwin (not full test
> on patches 1-18). When built on top of fd3785337b (The third batch) with
> the two branches merged (as indicated below) Linux (build+test) and cygwin
> (just build) work as expected.
Thanks!
> > - I've dropped the target names for `custom_target()` invocations.
> > Those are auto-derived from the first output anyway, so they only
> > add unnecessary noise.
> >
> > - The last patch is a compatibility patch for "seen". There are a
> > couple of topics that interact with this series, and I didn't want
> > to make all of them a strict dependency. So I've decided to just
> > create a fixup-style commit that does the necessary changes in order
> > to work with "seen". Like this, you can test without "seen" by
> > simply dropping that last commit, and you can test with "seen" by
> > merging it into this topic.
>
> I couldn't try this patch because (at the time) the 'seen' branch
> didn't build. :(
Okay. I'll adapt the next version accordingly.
> On cygwin, the result looks like:
>
> $ tail -11 meson-logs/testlog.txt
> Summary of Failures:
>
> 23/1035 t-reftable-stack TIMEOUT 30.26s killed by signal 15 SIGTERM
> 114/1035 t1017-cat-file-remote-object-info FAIL 0.13s exit status 127
>
> Ok: 1033
> Expected Fail: 0
> Fail: 1
> Unexpected Pass: 0
> Skipped: 0
> Timeout: 1
> $
>
> The t-reftable-stack unit test took just over 75s on the v2.27.0 test run.
> I haven't looked into it yet, but plenty of other tests run for longer than
> the 30s, so I don't know why that test seems to be different.
Meson has a default timeout of 30 seconds for tests. I only removed that
timeout for our shell scripts, but didn't for the unit tests. I'll fix
that in the next version.
> Also, it is worth noting that the test ran for 2hr50min. Usually I have to
> wait 6hr approx. for 'make test' to finish because I don't like to use any
> '-j' parameters (You can't do anything else on the machine while it is
> cooking the cpu!). :)
You probably know, but you can of course also pick the number of CPU
cores to run tests on with Meson: `meson test -j1`.
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v4 00/19] Modernize the build system
2024-10-25 19:59 ` Taylor Blau
@ 2024-11-04 12:17 ` Patrick Steinhardt
2024-11-04 15:03 ` Eli Schwartz
2024-11-04 15:18 ` Taylor Blau
2024-11-04 15:11 ` Eli Schwartz
1 sibling, 2 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-04 12:17 UTC (permalink / raw)
To: Taylor Blau
Cc: git, Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones
On Fri, Oct 25, 2024 at 03:59:30PM -0400, Taylor Blau wrote:
> On Thu, Oct 24, 2024 at 02:39:43PM +0200, Patrick Steinhardt wrote:
> > Hi,
> >
> > this is the fourth version of my patch series that modernizes our build
> > system. It refactors various parts of it to make it possible to perform
> > out-of-tree builds in theory and then wires up Meson.
>
> I was thinking a little bit about this topic last night and wanted to
> collect my thoughts somewhere.
>
> I think that there are a couple of things that I'm not 100% clear or
> sold on, which are:
>
> - What is the eventual goal of this series? Do we plan to transition
> the existing make-driven builds to instead be built with Meson? Will
> we have both? Something else?
>
> - What is the eventual plan for CMake, which is maintained currently
> in the contrib directory? Will it be deprecated in favor of Meson?
> Will we continue to support it?
My goal is to end up with a single build system eventually, so yes, we'd
at one point in time drop both the Makefile and our CMake build
instructions. That would of course not happen over night, but across
multiple releases such that devs and packagers can start exercising the
new build infra before we remove it.
> Let me expand a little on each of those in turn:
>
> == What is the eventual goal?
>
> From reading [PATCH 17/19], it seems the main arguments in favor of
> using Meson are:
>
> - Ease of use: easy to use, discovering available options is easy. The
> scripting language is straight-forward to use.
> - IDE support: Supports generating build instructions for Xcode and Microsoft
> Visual Studio, a plugin exists for Visual Studio Code.
> - Out-of-tree builds: supported.
> - Cross-platform builds: supported.
> - Language support:
> - C: Supported for GCC, Clang, MSVC and other toolchains.
> - Rust: Supported for rustc.
> - Test integration: supported. Interactive tests are supported starting with
> Meson 1.5.0 via the `--interactive` flag.
>
> I don't think that when reading these any of them stick out to me and
> compel me to learn a new build system. I understand and am sympathetic
> to the fact that GNU Make has odd syntax and can be cumbersome. But I
> don't think that incrementally modifying our Makefile over time is
> difficult, and it has certainly worked well over the years.
My main goal isn't necessarily to make things work better for old
timers, but _especially_ to make it easier for newcomers. You of course
can wire up many missing features with Makefiles, but that only goes so
far. What you won't get with them is good cross-platform support, deep
integration with IDEs and good discoverability.
> Certainly there is ample support for IDE integration with Make.
Not quite. While there is ample support for executing Makefile targets,
there isn't really a lot of integration for "advanced" features:
- Auto-configuration.
- Multiple build types.
- Code completion.
- Discovery of the working set of source files.
So the integration that exists for Makefiles is for most of the part
extremely shallow.
Also, I'd claim that Makefiles are really only well-integrated on Linux
or BSDs. For other systems like Windows it is extremely awkward and you
don't really have a nice developer experience there.
There are other factors as well, like auto-detection of the system. Our
Makefile only works well for specific platforms that somebody uses on a
regular basis, and wiring up a new platform requires manual code in our
"config.mak.uname" file. That's somewhat awkward and hard to maintain
going forward as every single platform requires its own bits and pieces.
The solution to that problem is autoconfiguration by detecting platform
specific bits and pieces. And we _also_ have such a build system in the
form of autoconf, but now we're entering territory that is awfully hard
to maintain. Most people don't use it at all, the only user seems to
really be distros. And they tend to hit many issues with autoconf
because we devs don't use that infra in the first place, creating a bit
of an awkward situation. Unifying this infrastructure such that devs and
packagers use the same build infra is thus another goal of my series.
> Out-of-tree builds and cross-platform builds could be supported in
> theory as you note within the existing build system. Another suggestion
> you make is that Meson has better native support for Rust, which I agree
> may be important to consider in the future.
>
> But I don't think that any of those three (out-of-tree builds,
> cross-compilation, or Rust support) are insurmountable challenges in
> Make. Certainly there is a lot of inertia there, but I don't think
> that's a bad thing. Contributors are used to the existing build system,
> it has worked well for us, works across many platforms and has (IMO)
> stood the test of time.
We indeed can wire up all of these features. But the way things are
wired up right now is extremely fragile and very manual. I don't
disagree with your statement that we old-timers know our way around the
build system. But I certainly don't think it is easy to hack on, and
that is a problem especially if we want to set up Git for success for
the next decade. I want to ensure that the Git project is easily
accessible to people.
> I admittedly have a hard time squaring the benefits and goals we have
> with Meson with the cost of learning a new build system, and/or moving
> away from Make entirely.
I guess this depends on the exact persona you're optimizing for. There
are three main personas involved here:
- Long-time Git contributors. I don't worry about that persona too
much. Folks in this category tend to be highly skilled, and they
should not have much of an issue with adapting to Meson.
- New contributors. This is a group of people that I think would
benefit from Meson. They get integration with their favorite IDE,
have easy ways to discover how to tweak build instructions and can
use standard invocations for Meson that they might already know from
other projects.
- Packagers. This is another group of people that would benefit from
my point of view. This is mostly because Meson has certain standards
for how to approach problems, and thus the packager would know for
how to handle things. They don't have to manually track build
options and changes thereof, as these can be easily discovered and
because Meson will error out in case invalid options are passed.
> I am entirely open to the possibility that there is something that I am
> missing here, and that Meson really is a better choice for Git given our
> current direction. But I think if that's true, then the series needs to
> explain that more prominently.
Sure, I am happy to update the commit message.
> == What is the eventual plan for CMake?
>
> From [PATCH 18/19], you write:
>
> > 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.
>
> I don't view this is a good intermediate state, and is in my view making
> an existing problem that we have worse. On the "existing problem": I
> think that landing CMake support in contrib was a mistake. In my view,
> CMake support should have either been a first-class citizen in Git (such
> that we don't consider a change "done" until it can be built by CMake),
> or should have been maintained out-of-tree.
>
> But I think we struck a worst-of-both-worlds balance by landing it in
> contrib. It's maintained in the tree, so people expect to be able to
> build the project with it because it comes with a bog-standard clone of
> git.git.
>
> But despite living in the project's tree, it is not a first-class
> citizen, and subjectively it seems that we get an awful lot of mail
> asking why something doesn't build in CMake, etc. (To your credit, I
> think you have been one of the main people to help with that, often
> fixing those bugs yourself, which is greatly appreciated).
>
> I don't want to see the project have to pseudo-maintain three build
> systems. It seems like doing so would be cumbersome, and error-prone. I
> am already probably guilty of breaking CMake builds when I add a new
> compilation unit to the project, because of a combination of my lack of
> familiarity with CMake, and the fact that we don't have a project-wide
> convention of treating it with the same care as we do the Makefile. I
> think that having three build systems (even if they only co-existed
> until Git 3.0) would make that problem worse.
>
> I feel that if we are going to pursue Meson over CMake and/or Make, we
> should have a clear plan to either get rid of CMake, keep it up-to-date,
> or something else.
I fully agree with all you're saying here. Whatever the solution, the
new build system should be a proper first-class citizen and should be
exercised by our CI systems such that they don't silently break.
I also agree that it's going to be a hassle to maintain three (or three
and a half if you count autoconf) build systems. But I don't want to
break any users out there by dropping everything but Meson immediately,
so I think we just have to accept multiple build systems as an
intermediate step. How exactly that would look like is certainly up for
debate. My take would be:
1. Adopt the new build system and start exercising it via CI.
2. Drop CMake.
3. Drop autoconf.
4. Drop Makefiles.
This should happen over multiple releases such that every step will pull
in additional user groups, which will make the new build system more
solid overall. I could see that one step corresponds to one release
cycle, but I'm also happy to adapt the pacing as necessary.
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v4 00/19] Modernize the build system
2024-11-04 12:17 ` Patrick Steinhardt
@ 2024-11-04 15:03 ` Eli Schwartz
2024-11-11 10:36 ` Patrick Steinhardt
2024-11-04 15:18 ` Taylor Blau
1 sibling, 1 reply; 386+ messages in thread
From: Eli Schwartz @ 2024-11-04 15:03 UTC (permalink / raw)
To: Patrick Steinhardt, Taylor Blau
Cc: git, Eric Sunshine, Phillip Wood, Junio C Hamano, Ramsay Jones
[-- Attachment #1.1: Type: text/plain, Size: 937 bytes --]
On 11/4/24 7:17 AM, Patrick Steinhardt wrote:
> The solution to that problem is autoconfiguration by detecting platform
> specific bits and pieces. And we _also_ have such a build system in the
> form of autoconf, but now we're entering territory that is awfully hard
> to maintain. Most people don't use it at all, the only user seems to
> really be distros. And they tend to hit many issues with autoconf
> because we devs don't use that infra in the first place, creating a bit
> of an awkward situation. Unifying this infrastructure such that devs and
> packagers use the same build infra is thus another goal of my series.
As a distro packager (not of git specifically), my understanding was
that *no* distros use the autoconf, and that at least some distros say
the reason for this is that the autoconf is so unused that it doesn't
actually work.
We tried to use the autoconf but failed.
--
Eli Schwartz
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v4 00/19] Modernize the build system
2024-10-25 19:59 ` Taylor Blau
2024-11-04 12:17 ` Patrick Steinhardt
@ 2024-11-04 15:11 ` Eli Schwartz
1 sibling, 0 replies; 386+ messages in thread
From: Eli Schwartz @ 2024-11-04 15:11 UTC (permalink / raw)
To: Taylor Blau, Patrick Steinhardt
Cc: git, Eric Sunshine, Phillip Wood, Junio C Hamano, Ramsay Jones
[-- Attachment #1.1: Type: text/plain, Size: 1977 bytes --]
On 10/25/24 3:59 PM, Taylor Blau wrote:
> == Conclusion
>
> To step back, I want to say that I appreciate your work on this series
> and am certainly not opposed[^1] to the idea that we may need to make
> significant changes to our build infrastructure to support the project's
> goals.
>
> But I think that what I'm missing currently is a clear picture of what
> goals we *can't* achieve with the existing build system (or could, but
> only at significant cost/awkwardness), and why Meson is the right choice
> to address those gaps.
>
> If the project can agree that pursuing Meson as a replacement for Make,
> CMake, or both, then I think we would need further clarification on what
> we want to do with CMake (and more generally how we want to support new
> efforts to add additional build systems to Git in the future).
One extremely big distinction is that Make is not a configuration
system, and cannot be, and git has many configuration options that are
currently underserved to the point of nonexistence. This causes a *lot*
of trouble to people attempting to build git as it's not often clear how
to do so other than by building a stock no-options build.
When you do try it, you frequently end up with broken option passing
resulting in an inconsistent git installation where some parts of the
code are built with one option, and other parts of the code are built
with its inverse, and neither of them are the third set of options that
you had finally settled on. This also affects distro maintainers.
The configure.ac tries to solve this problem and fails because it
appears no one bothers to maintain it. The CMake files try to solve this
problem but only for Windows (?). Possibly the reason people struggle
with both is because both feel quite painful to use -- the initial
premise of this patch series is, after all, "I the submitter believe
this build system is nicer than the other option".
--
Eli Schwartz
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v4 00/19] Modernize the build system
2024-11-04 12:17 ` Patrick Steinhardt
2024-11-04 15:03 ` Eli Schwartz
@ 2024-11-04 15:18 ` Taylor Blau
2024-11-09 12:58 ` David Aguilar
2024-11-11 10:36 ` Patrick Steinhardt
1 sibling, 2 replies; 386+ messages in thread
From: Taylor Blau @ 2024-11-04 15:18 UTC (permalink / raw)
To: Patrick Steinhardt
Cc: git, Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones
On Mon, Nov 04, 2024 at 01:17:00PM +0100, Patrick Steinhardt wrote:
> > I admittedly have a hard time squaring the benefits and goals we have
> > with Meson with the cost of learning a new build system, and/or moving
> > away from Make entirely.
>
> I guess this depends on the exact persona you're optimizing for. There
> are three main personas involved here:
>
> - Long-time Git contributors. I don't worry about that persona too
> much. Folks in this category tend to be highly skilled, and they
> should not have much of an issue with adapting to Meson.
>
> - New contributors. This is a group of people that I think would
> benefit from Meson. They get integration with their favorite IDE,
> have easy ways to discover how to tweak build instructions and can
> use standard invocations for Meson that they might already know from
> other projects.
>
> - Packagers. This is another group of people that would benefit from
> my point of view. This is mostly because Meson has certain standards
> for how to approach problems, and thus the packager would know for
> how to handle things. They don't have to manually track build
> options and changes thereof, as these can be easily discovered and
> because Meson will error out in case invalid options are passed.
I appreciate your thoughtful response to my concerns here. Please feel
free to correct me if I am wrong, but I think the bulk of your argument
is captured fairly well by these three points, so I want to focus my
response here.
Responding in turn, I think my feeling is something like:
- Long-time Git contributors are going to be the ones who will most
frequently use the new build system. I am definitely sympathetic to
getting too comfortable with our existing tools, but so far in your
response I have not seen a compelling reason to switch the project
to use Meson.
What I really want to say here is that I don't think we should be
over-correcting on things that we are all comfortable with when they
are indeed not the optimal solution.
We can and should challenge those assumptions. But I think what I
see here is us challenging the assumption that 'make' is not the
right tool for the project, and (at least personally) not seeing
that it isn't.
- New contributors are a group that we should be optimizing for, I
certainly agree with you there. But I think there are a couple of
points that your response glosses over:
* New contributors should be telling us what build system they
prefer, not the other way around. If we are going to switch to
using a new build system to better accommodate new contributors,
it should be because either (a) they have told us what doesn't
work with 'make', or (b) we have a bulk of evidence that new
contributors cannot easily build the project.
* New contributors do not interact with build system internals
nearly as much as more experienced contributors. I would imagine
that the vast majority of those interactions are simply running
"make" or "make test".
You mention a handful of other niceties that Meson provides,
like language server support, but I am not sure that I agree
those are (a) the responsibility of the build system to provide,
or (b) that those needs aren't already well met by the vast
number of existing tools and IDE integrations that can work with
ctags.
- Packagers are something that I admittedly have less exposure to than
the other groups listed here, but I think my feeling there is
similar. While they are more likely to exercise far more parts of
the build system, I think we should also only be switching to a new
build system if there is evidence of significant, unmet needs by
packagers, which I have not seen.
> > I feel that if we are going to pursue Meson over CMake and/or Make, we
> > should have a clear plan to either get rid of CMake, keep it up-to-date,
> > or something else.
>
> I fully agree with all you're saying here. Whatever the solution, the
> new build system should be a proper first-class citizen and should be
> exercised by our CI systems such that they don't silently break.
>
> I also agree that it's going to be a hassle to maintain three (or three
> and a half if you count autoconf) build systems. But I don't want to
> break any users out there by dropping everything but Meson immediately,
> so I think we just have to accept multiple build systems as an
> intermediate step. How exactly that would look like is certainly up for
> debate. My take would be:
>
> 1. Adopt the new build system and start exercising it via CI.
>
> 2. Drop CMake.
>
> 3. Drop autoconf.
>
> 4. Drop Makefiles.
>
> This should happen over multiple releases such that every step will pull
> in additional user groups, which will make the new build system more
> solid overall. I could see that one step corresponds to one release
> cycle, but I'm also happy to adapt the pacing as necessary.
I have a hard time imagining the project ever dropping its Makefile
entirely, if for no other reason that make is available nearly
everywhere that we want to build Git, and the Makefile is the product of
nearly two decades of work to make it compile anywhere.
If our tree really is going to have a Makefile in it forever, then I
think adding Meson (even if we remove CMake support) has many of the
same challenges as the state we're in today "supporting" Make and CMake
in parallel.
Thanks,
Taylor
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v4 00/19] Modernize the build system
2024-11-04 15:18 ` Taylor Blau
@ 2024-11-09 12:58 ` David Aguilar
2024-11-10 1:07 ` Eli Schwartz
2024-11-11 10:36 ` Patrick Steinhardt
2024-11-11 10:36 ` Patrick Steinhardt
1 sibling, 2 replies; 386+ messages in thread
From: David Aguilar @ 2024-11-09 12:58 UTC (permalink / raw)
To: Taylor Blau
Cc: Patrick Steinhardt, git, Eli Schwartz, Eric Sunshine,
Phillip Wood, Junio C Hamano, Ramsay Jones
On Mon, Nov 04, 2024 at 10:18:20AM -0500, Taylor Blau wrote:
> On Mon, Nov 04, 2024 at 01:17:00PM +0100, Patrick Steinhardt wrote:
> > > I admittedly have a hard time squaring the benefits and goals we have
> > > with Meson with the cost of learning a new build system, and/or moving
> > > away from Make entirely.
> >
> > I guess this depends on the exact persona you're optimizing for. There
> > are three main personas involved here:
> >
> > - New contributors. This is a group of people that I think would
> > benefit from Meson. They get integration with their favorite IDE,
> > have easy ways to discover how to tweak build instructions and can
> > use standard invocations for Meson that they might already know from
> > other projects.
As someone that was once a New Contributor, my perception is that new
contributors are more likely to be familiar with CMake due to its longer
history and wider general popularity.
CMake has standard invocations and IDE integration so this isn't really
a Meson-specific feature.
That said, if we mean, "Linux/Unix-savvy New Contributors," then
I can understand why Meson might be a favorite, and perhaps this
might be the crowd we are looking to target (in the same vein of
the original argument for why Git uses C instead of C++).
The remainder of my reply assumes that we are targetting a general
audience (in other words, including Windows users).
Disclaimer ~ I don't use Windows so I'm making some broad assumptions and
generalizations about that userbase.
> Patrick Steinhardt wrote:
> > - Packagers. This is another group of people that would benefit from
> > my point of view. This is mostly because Meson has certain standards
> > for how to approach problems, and thus the packager would know for
> > how to handle things. They don't have to manually track build
> > options and changes thereof, as these can be easily discovered and
> > because Meson will error out in case invalid options are passed.
CMake's option() variables and its GNUInstallDirs module pretty much
handles all of the standardization that packagers are looking for on
this front, so this argument doesn't push the needle towards Meson over
CMake from my perspective.
> Taylor Blau wrote:
> I appreciate your thoughtful response to my concerns here. Please feel
> free to correct me if I am wrong, but I think the bulk of your argument
> is captured fairly well by these three points, so I want to focus my
> response here.
>
> Responding in turn, I think my feeling is something like:
>
> - Long-time Git contributors are going to be the ones who will most
> frequently use the new build system. I am definitely sympathetic to
> getting too comfortable with our existing tools, but so far in your
> response I have not seen a compelling reason to switch the project
> to use Meson.
Likewise, I have not seen a compelling reason to not focus the
effort on CMake instead. In other words, why not enhance the current
status quo (Make + CMake) instead of trying to replace it?
> - New contributors are a group that we should be optimizing for, I
> certainly agree with you there. But I think there are a couple of
> points that your response glosses over:
>
> * New contributors should be telling us what build system they
> prefer, not the other way around. If we are going to switch to
> using a new build system to better accommodate new contributors,
> it should be because either (a) they have told us what doesn't
> work with 'make', or (b) we have a bulk of evidence that new
> contributors cannot easily build the project.
As someone that was once a New Contributor, I would be more comfortable
with CMake (over Meson) because it's widespread and because it has
less dependencies.
> * New contributors do not interact with build system internals
> nearly as much as more experienced contributors. I would imagine
> that the vast majority of those interactions are simply running
> "make" or "make test".
>
> You mention a handful of other niceties that Meson provides,
> like language server support, but I am not sure that I agree
> those are (a) the responsibility of the build system to provide,
> or (b) that those needs aren't already well met by the vast
> number of existing tools and IDE integrations that can work with
> ctags.
CMake has all of these same bells and whistles, and it's already present
in git.git. LSP support just means being able to generate a
compile_commands.json file, and the current CMake setup already does
that.
The one thing that no one has mentioned is dependencies.
CMake has less dependencies. Python is arguably a liability in the build
system arena, and Meson requires it.
Furthermore, if you must have your fast Ninja builds then CMake supports
that too, but, critically, it's optional. If you don't have Ninja then
you can use CMake's Makefile generator. Meson, OTOH, requires
Ninja. CMake seems like a more pragmatic option in that regard.
Sorry for derailing this thread to share my Meson vs. CMake opinion, but
if the main con that the Meson website has to say about CMake is, "The
scripting language is cumbersome to work with. Some simple things are
more complicated than necessary." [1] then my general feeling is that
it's not a very strong reason for Git's needs.
[1] https://mesonbuild.com/Comparisons.html#cmake
> - Packagers are something that I admittedly have less exposure to than
> the other groups listed here, but I think my feeling there is
> similar. While they are more likely to exercise far more parts of
> the build system, I think we should also only be switching to a new
> build system if there is evidence of significant, unmet needs by
> packagers, which I have not seen.
I concur with that. As someone that deals with packaging I strongly
prefer tools that have minimal dependencies, just like Git. Meson
brings along extra requirements (namely Python, as I mentioned before)
whereas CMake requires just a C++ compiler and Make.
On that front, Git's Make-only setup is pretty wonderful from a
packager's perspective because all you need is Make, so I don't
think we would ever want to ditch the Makefiles, and that's okay.
> > > I feel that if we are going to pursue Meson over CMake and/or Make, we
> > > should have a clear plan to either get rid of CMake, keep it up-to-date,
> > > or something else.
We should also have a strong reason to transition to Meson over the
"something else" option of improving the CMake integration instead of
trying to replace it.
> > I fully agree with all you're saying here. Whatever the solution, the
> > new build system should be a proper first-class citizen and should be
> > exercised by our CI systems such that they don't silently break.
> >
> > I also agree that it's going to be a hassle to maintain three (or three
> > and a half if you count autoconf) build systems. But I don't want to
> > break any users out there by dropping everything but Meson immediately,
> > so I think we just have to accept multiple build systems as an
> > intermediate step. How exactly that would look like is certainly up for
> > debate. My take would be:
> >
> > 1. Adopt the new build system and start exercising it via CI.
> >
> > 2. Drop CMake.
> >
> > 3. Drop autoconf.
> >
> > 4. Drop Makefiles.
> >
> > This should happen over multiple releases such that every step will pull
> > in additional user groups, which will make the new build system more
> > solid overall. I could see that one step corresponds to one release
> > cycle, but I'm also happy to adapt the pacing as necessary.
My take would be:
1. Enhance CMake
2. Drop Autoconf
3. Profit?
This would not need to happen over multiple releases. There'd just be
one minor or major release where (2) would happen once (1) has reached
some substantial level of maturity, and that'd be it.
Arguably, we could even do (2) before (1) and it'd be fine.
> I have a hard time imagining the project ever dropping its Makefile
> entirely, if for no other reason that make is available nearly
> everywhere that we want to build Git, and the Makefile is the product of
> nearly two decades of work to make it compile anywhere.
>
> If our tree really is going to have a Makefile in it forever, then I
> think adding Meson (even if we remove CMake support) has many of the
> same challenges as the state we're in today "supporting" Make and CMake
> in parallel.
I agree, and from my outsider perspective it seems like a simpler answer
would be to double-down on CMake rather than having to adopt another
system and do the whole deprecation dance.
My perception is that any benefits we would get from supporting Meson
would also be present with CMake, but with less effort.
That's just my opinion, though. Perhaps there are strong reasons for why
Meson is a better tool for the purposes of attracting New Contributors
and improving our day-to-day usage, but the benefits are not immediately
obvious to me at least.
--
David
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v4 00/19] Modernize the build system
2024-11-09 12:58 ` David Aguilar
@ 2024-11-10 1:07 ` Eli Schwartz
2024-11-11 10:36 ` Patrick Steinhardt
1 sibling, 0 replies; 386+ messages in thread
From: Eli Schwartz @ 2024-11-10 1:07 UTC (permalink / raw)
To: David Aguilar, Taylor Blau
Cc: Patrick Steinhardt, git, Eric Sunshine, Phillip Wood,
Junio C Hamano, Ramsay Jones
[-- Attachment #1.1: Type: text/plain, Size: 8857 bytes --]
On 11/9/24 7:58 AM, David Aguilar wrote:
>> Patrick Steinhardt wrote:
>>> - Packagers. This is another group of people that would benefit from
>>> my point of view. This is mostly because Meson has certain standards
>>> for how to approach problems, and thus the packager would know for
>>> how to handle things. They don't have to manually track build
>>> options and changes thereof, as these can be easily discovered and
>>> because Meson will error out in case invalid options are passed.
>
> CMake's option() variables and its GNUInstallDirs module pretty much
> handles all of the standardization that packagers are looking for on
> this front, so this argument doesn't push the needle towards Meson over
> CMake from my perspective.
The specific points brought by Patrick, which I guess you are disputing,
are that meson options are "easily discovered" and "will error out in
case invalid options are passed".
Obviously biased as a Meson maintainer, but
No. Absolutely not. CMake's option() variables are deeply, frustratingly
bad as a user experience, for one simple reason. They are
turing-complete and you cannot know they exist until you have
successfully configured cmake at least once. Even then, the only way to
find out about them is to execute a cmake subcommand that prints "cache
variables" rather than "options", since options are just cache variables
marked with an explanation.
In comparison, GNU autotools rigorously defined the standard GNU
interface to configuring a build. In a freshly extracted copy of the
source code, run
./configure --help
It lists various options, split up by section e.g.
Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
[/usr/local]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[PREFIX]
By default, `make install' will install all the files in
`/usr/local/bin', `/usr/local/lib' etc. You can specify
an installation prefix other than `/usr/local' using `--prefix',
for instance `--prefix=$HOME'.
For better control, use the options below.
Fine tuning of the installation directories:
--bindir=DIR user executables [EPREFIX/bin]
It has additional sections for "optional features" / "optional
packages", and lists "Some influential environment variables" as well.
You do *not* need to successfully configure before seeing this help
text, and the same options always exist every time you run it.
Meson does something similar: in a freshly extracted source tree, run
"meson configure". It has some cool tricks, such as opening into a pager
if possible, and having table-formatted, colored output to make it easy
to distinguish between the option name, its default and allowed values,
and the description.
Meson splits the options table between core, base, compiler-specific,
directory standards, and project-specific options. All the options that
come from the project itself are further available in a single
meson_options.txt" / "meson.options" file at the root of the project,
you don't have to inspect thousands of lines of code to see where
option() might have been invoked, or figure out whether it was
transitively defined by including a module installed by a different
project to /usr/share/ECM/modules/ (???) that includes a third module
from /usr/share/cmake/Modules/ without which the option simply does not
exist at all.
CMake thus fails on both points raised by Patrick:
- cmake options *cannot* be easily discovered, and many people (myself
included) would argue that they cannot be discovered at all, whether
easily or otherwise
- since cmake options are, in fact, just cache variables, it logically
cannot be an error to define options that don't exist. You are quite
free to define any cache variables you want, whether they exist or
not, and cmake is entirely unconcerned with your doing so. Define a
"NOT_AN_OPTION" variable that doesn't exist? ok, no effect -- no part
of the build attempts to dereference ${NOT_AN_OPTION} so it is simply
ignored.
...
GNUInstallDirs is... workable, sort of, but is also a tremendous footgun
as you have to manually set it up and most people do not. Being able to
work around the bad defaults is better than nothing, sure. No one is
forcing any given project to use the bad defaults. But I'd hardly call
that a ringing endorsement.
> As someone that was once a New Contributor, I would be more comfortable
> with CMake (over Meson) because it's widespread and because it has
> less dependencies.
I just took a look at cmake's dependencies on my Gentoo system. It
appears to have a whole lot of them.
RDEPEND="
>=app-arch/libarchive-3.3.3:=
app-crypt/rhash:0=
>=dev-libs/expat-2.0.1
>=dev-libs/jsoncpp-1.9.2-r2:0=
>=dev-libs/libuv-1.10.0:=
>=net-misc/curl-7.21.5[ssl]
sys-libs/zlib
virtual/pkgconfig
dap? ( dev-cpp/cppdap )
gui? (
!qt6? (
dev-qt/qtcore:5
dev-qt/qtgui:5
dev-qt/qtwidgets:5
)
qt6? ( dev-qt/qtbase:6[gui,widgets] )
)
ncurses? ( sys-libs/ncurses:= )
"
It also is written in C++.
meson is written in python, so it depends on that. And of course on
ninja (for unix systems). It has no other dependencies, period, end of
story.
Although like cmake, it depends on my system on virtual/pkgconfig -- for
both packages, that pkgconfig dependency is a convenience since software
has a habit of using build system functions such as "pkg_check_modules"
(cmake) or "dependency" (meson) with almost universal regularity, so
it's easier than having tens of thousands of packages all depend on
virtual/pkgconfig.
cmake is easily installed from their website as a prebuilt binary with
all dependencies bundled inside, I suppose. So that is "less
dependencies"? But meson releases a prebuilt binary redistributable as a
Windows MSI as well -- and on Linux, python is usually preinstalled.
There's no *demand* for a prebuilt binary redistributable for Linux. If
there was, we already have the packaging scripts to make one, and it's
how I test the operation of the Windows MSI.
By the way, Python 3.6 to 3.10 use C89 "with several select C99
features". There are people who consider CMake's C++ requirement an
insurmountably steep obstacle, e.g. that is why OpenSSL refuses to use
any build system other than their own custom one written in Perl.
> The one thing that no one has mentioned is dependencies.
>
> CMake has less dependencies. Python is arguably a liability in the build
> system arena, and Meson requires it.
Please explain more about this. I don't really understand what you mean
by "a liability", nor how it is "more dependencies" than cmake.
> Furthermore, if you must have your fast Ninja builds then CMake supports
> that too, but, critically, it's optional. If you don't have Ninja then
> you can use CMake's Makefile generator. Meson, OTOH, requires
> Ninja. CMake seems like a more pragmatic option in that regard.
>
> Sorry for derailing this thread to share my Meson vs. CMake opinion, but
> if the main con that the Meson website has to say about CMake is, "The
> scripting language is cumbersome to work with. Some simple things are
> more complicated than necessary." [1] then my general feeling is that
> it's not a very strong reason for Git's needs.
>
> [1] https://mesonbuild.com/Comparisons.html#cmake
Those are "some pros and cons", not all pros and cons, and it may
surprise you to hear that that page is not well maintained because a) no
one is strongly motivated to do so, b) no one feels passionately about
making an anti-cmake rant part of the core documentation.
That page was written once in 2014 and essentially never touched since,
though tree-wide formatting tweaks were made and the documentation
switched hosting and git imported into the main git repository in 2017.
> I concur with that. As someone that deals with packaging I strongly
> prefer tools that have minimal dependencies, just like Git. Meson
> brings along extra requirements (namely Python, as I mentioned before)
> whereas CMake requires just a C++ compiler and Make.
... wait, so is this or isn't this about the dependencies for building
and installing cmake, rather than merely running it?
CMake depends on projects that build with cmake, by the way. This is the
hell dimension of distro packaging.
(It also depends on jsoncpp which builds with meson, incidentally.)
--
Eli Schwartz
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v4 04/19] Makefile: extract script to massage Perl scripts
2024-10-24 12:39 ` [RFC PATCH v4 04/19] Makefile: extract script to massage Perl scripts Patrick Steinhardt
@ 2024-11-10 14:36 ` Phillip Wood
2024-11-11 10:36 ` Patrick Steinhardt
0 siblings, 1 reply; 386+ messages in thread
From: Phillip Wood @ 2024-11-10 14:36 UTC (permalink / raw)
To: Patrick Steinhardt, git
Cc: Eli Schwartz, Eric Sunshine, Junio C Hamano, Ramsay Jones,
Taylor Blau
Hi Patrick
On 24/10/2024 13:39, Patrick Steinhardt wrote:
>
> + add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${perl_gen_path}
> + COMMAND ${CMAKE_SOURCE_DIR}/generate-perl.sh
This is missing ${SH_EXE} in order to work with cmd.exe on windows when
running the build from Visual Studio. Also do we want to quote the
command arguments in case there is a ';' in the path - we seem to be a
bit inconsistant in about that in CMakeLists.txt. Also we should add
VERBATIM so that special characters in the arguments are quoted when
generating the build rules.
Best Wishes
Phillip
> + ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS
> + ${PROJECT_VERSION}
> + ${CMAKE_BINARY_DIR}/PERL-HEADER
> + ${CMAKE_SOURCE_DIR}/${script}
> + ${CMAKE_BINARY_DIR}/${perl_gen_path}
> + DEPENDS ${CMAKE_SOURCE_DIR}/generate-perl.sh
> + ${CMAKE_SOURCE_DIR}/${script})
> + list(APPEND perl_gen ${CMAKE_BINARY_DIR}/${perl_gen_path})
> endforeach()
> +add_custom_target(perl-gen ALL DEPENDS ${perl_gen})
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v4 06/19] Makefile: extract script to massage Shell scripts
2024-10-24 12:40 ` [RFC PATCH v4 06/19] Makefile: extract script to massage Shell scripts Patrick Steinhardt
@ 2024-11-10 14:42 ` Phillip Wood
0 siblings, 0 replies; 386+ messages in thread
From: Phillip Wood @ 2024-11-10 14:42 UTC (permalink / raw)
To: Patrick Steinhardt, git
Cc: Eli Schwartz, Eric Sunshine, Junio C Hamano, Ramsay Jones,
Taylor Blau
Hi Patrick
On 24/10/2024 13:40, Patrick Steinhardt wrote:
>
> + add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${shell_gen_path}
> + COMMAND ${CMAKE_SOURCE_DIR}/generate-script.sh
Same comments as the other patch - this need ${SH_EXE} as the command name
> @@ -1156,6 +1160,10 @@ string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_optio
> string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}")
> string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}")
> string(REPLACE "@RUNTIME_PREFIX@" "${RUNTIME_PREFIX}" git_build_options "${git_build_options}")
> +string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" git_build_options "${git_build_options}")
> +string(REPLACE "@USE_GETTEXT_SCHEME@" "" git_build_options "${git_build_options}")
> +string(REPLACE "@LOCALEDIR@" "LOCALEDIR" git_build_options "${git_build_options}")
s/"LOCALEDIR"/"${LOCALEDIR}"/
Best Wishes
Phillip
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v4 04/19] Makefile: extract script to massage Perl scripts
2024-11-10 14:36 ` Phillip Wood
@ 2024-11-11 10:36 ` Patrick Steinhardt
0 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-11 10:36 UTC (permalink / raw)
To: phillip.wood
Cc: git, Eli Schwartz, Eric Sunshine, Junio C Hamano, Ramsay Jones,
Taylor Blau
On Sun, Nov 10, 2024 at 02:36:49PM +0000, Phillip Wood wrote:
> Hi Patrick
>
> On 24/10/2024 13:39, Patrick Steinhardt wrote:
> >
> > + add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${perl_gen_path}
> > + COMMAND ${CMAKE_SOURCE_DIR}/generate-perl.sh
>
> This is missing ${SH_EXE} in order to work with cmd.exe on windows when
> running the build from Visual Studio. Also do we want to quote the command
> arguments in case there is a ';' in the path - we seem to be a bit
> inconsistant in about that in CMakeLists.txt. Also we should add VERBATIM so
> that special characters in the arguments are quoted when generating the
> build rules.
Indeed, I also had it in my mind to revisit these patches and fix them
up based on Dscho's findings in the other thread. Thanks for being
proactive and pointing them out!
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v4 00/19] Modernize the build system
2024-11-04 15:03 ` Eli Schwartz
@ 2024-11-11 10:36 ` Patrick Steinhardt
0 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-11 10:36 UTC (permalink / raw)
To: Eli Schwartz
Cc: Taylor Blau, git, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones
On Mon, Nov 04, 2024 at 10:03:17AM -0500, Eli Schwartz wrote:
> On 11/4/24 7:17 AM, Patrick Steinhardt wrote:
> > The solution to that problem is autoconfiguration by detecting platform
> > specific bits and pieces. And we _also_ have such a build system in the
> > form of autoconf, but now we're entering territory that is awfully hard
> > to maintain. Most people don't use it at all, the only user seems to
> > really be distros. And they tend to hit many issues with autoconf
> > because we devs don't use that infra in the first place, creating a bit
> > of an awkward situation. Unifying this infrastructure such that devs and
> > packagers use the same build infra is thus another goal of my series.
>
>
> As a distro packager (not of git specifically), my understanding was
> that *no* distros use the autoconf, and that at least some distros say
> the reason for this is that the autoconf is so unused that it doesn't
> actually work.
>
> We tried to use the autoconf but failed.
I thought I saw some distros using autoconf, so it at least isn't
_completely_ broken. Let me double check... FreeBSD uses it, but other
than that all the others that I've checked use the Makefile directly.
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v4 00/19] Modernize the build system
2024-11-04 15:18 ` Taylor Blau
2024-11-09 12:58 ` David Aguilar
@ 2024-11-11 10:36 ` Patrick Steinhardt
2024-11-11 21:06 ` Jeff King
1 sibling, 1 reply; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-11 10:36 UTC (permalink / raw)
To: Taylor Blau
Cc: git, Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones
On Mon, Nov 04, 2024 at 10:18:20AM -0500, Taylor Blau wrote:
> On Mon, Nov 04, 2024 at 01:17:00PM +0100, Patrick Steinhardt wrote:
> > > I admittedly have a hard time squaring the benefits and goals we have
> > > with Meson with the cost of learning a new build system, and/or moving
> > > away from Make entirely.
> >
> > I guess this depends on the exact persona you're optimizing for. There
> > are three main personas involved here:
> >
> > - Long-time Git contributors. I don't worry about that persona too
> > much. Folks in this category tend to be highly skilled, and they
> > should not have much of an issue with adapting to Meson.
> >
> > - New contributors. This is a group of people that I think would
> > benefit from Meson. They get integration with their favorite IDE,
> > have easy ways to discover how to tweak build instructions and can
> > use standard invocations for Meson that they might already know from
> > other projects.
> >
> > - Packagers. This is another group of people that would benefit from
> > my point of view. This is mostly because Meson has certain standards
> > for how to approach problems, and thus the packager would know for
> > how to handle things. They don't have to manually track build
> > options and changes thereof, as these can be easily discovered and
> > because Meson will error out in case invalid options are passed.
>
> I appreciate your thoughtful response to my concerns here. Please feel
> free to correct me if I am wrong, but I think the bulk of your argument
> is captured fairly well by these three points, so I want to focus my
> response here.
>
> Responding in turn, I think my feeling is something like:
>
> - Long-time Git contributors are going to be the ones who will most
> frequently use the new build system. I am definitely sympathetic to
> getting too comfortable with our existing tools, but so far in your
> response I have not seen a compelling reason to switch the project
> to use Meson.
Yes, that's certainly true. And while I think we should optimize more
for newcomers as stated, I still think that Meson is very much
preferable over Makefiles for long-time contributors, as well. The
transition period may take some time, but in the end it just feels
superior to Make from my poin of view.
Out of curiosity: did you try the Meson build? I personally have to say
that I already prefer working with it because the workflow with it is so
much nicer. It has nicer output, is faster, has out-of-tree builds,
makes it easier to configure and test execution feels way nicer compared
to my previous workflow with make.
This is all subjective of course.
> What I really want to say here is that I don't think we should be
> over-correcting on things that we are all comfortable with when they
> are indeed not the optimal solution.
>
> We can and should challenge those assumptions. But I think what I
> see here is us challenging the assumption that 'make' is not the
> right tool for the project, and (at least personally) not seeing
> that it isn't.
As said, Makefiles have some problems that aren't really solveable from
my perspective. And I think part of the problem in this context is that
the typical developer working on Git is very much centered around Unix.
The experience on non-Unix systems is kind of a pain though as there is
no proper integration with anything.
And that's not only true for non-Unix-like platforms, but basically for
anyone who isn't comfortable working from the command line. Integration
of the project into an IDE with our Makefile is hard to pull off. While
many editors can of course trivially execute the Makefile for you,
setting things up such that it is _properly_ integrated into the IDE is
hard.
Overall, I don't think we old time contributors lose anything by using
Meson instead of Makefiles, quite on the contrary we get speedier builds
and nicer integration. We'd have to adapt eventually, but I don't see
that as a huge barrier.
> - New contributors are a group that we should be optimizing for, I
> certainly agree with you there. But I think there are a couple of
> points that your response glosses over:
>
> * New contributors should be telling us what build system they
> prefer, not the other way around. If we are going to switch to
> using a new build system to better accommodate new contributors,
> it should be because either (a) they have told us what doesn't
> work with 'make', or (b) we have a bulk of evidence that new
> contributors cannot easily build the project.
That's basically why the whole patch series is marked as an RFC: to get
feedback from people and ask them for their opinion.
> * New contributors do not interact with build system internals
> nearly as much as more experienced contributors. I would imagine
> that the vast majority of those interactions are simply running
> "make" or "make test".
Agreed.
I assume that what they are after is a streamlined process for how to
compile and test the project. The build system should be providing good
feedback for missing dependencies, for existing build options and how to
use them. These are all things that Meson provides by default, and our
Makefile doesn't.
> You mention a handful of other niceties that Meson provides,
> like language server support, but I am not sure that I agree
> those are (a) the responsibility of the build system to provide,
> or (b) that those needs aren't already well met by the vast
> number of existing tools and IDE integrations that can work with
> ctags.
From my own experience the integration with other IDEs isn't great at
all in Makefile-based projects. I don't use IDEs though, so I am
probably not the best resource to judge.
> - Packagers are something that I admittedly have less exposure to than
> the other groups listed here, but I think my feeling there is
> similar. While they are more likely to exercise far more parts of
> the build system, I think we should also only be switching to a new
> build system if there is evidence of significant, unmet needs by
> packagers, which I have not seen.
We have repeatedly gotten feedback that our autoconf-based build is
basically broken and does not work well. After all, that's what spawned
the whole discussion around a more modern build system that is able to
properly auto-detect what the host system provides.
> > > I feel that if we are going to pursue Meson over CMake and/or Make, we
> > > should have a clear plan to either get rid of CMake, keep it up-to-date,
> > > or something else.
> >
> > I fully agree with all you're saying here. Whatever the solution, the
> > new build system should be a proper first-class citizen and should be
> > exercised by our CI systems such that they don't silently break.
> >
> > I also agree that it's going to be a hassle to maintain three (or three
> > and a half if you count autoconf) build systems. But I don't want to
> > break any users out there by dropping everything but Meson immediately,
> > so I think we just have to accept multiple build systems as an
> > intermediate step. How exactly that would look like is certainly up for
> > debate. My take would be:
> >
> > 1. Adopt the new build system and start exercising it via CI.
> >
> > 2. Drop CMake.
> >
> > 3. Drop autoconf.
> >
> > 4. Drop Makefiles.
> >
> > This should happen over multiple releases such that every step will pull
> > in additional user groups, which will make the new build system more
> > solid overall. I could see that one step corresponds to one release
> > cycle, but I'm also happy to adapt the pacing as necessary.
>
> I have a hard time imagining the project ever dropping its Makefile
> entirely, if for no other reason that make is available nearly
> everywhere that we want to build Git, and the Makefile is the product of
> nearly two decades of work to make it compile anywhere.
>
> If our tree really is going to have a Makefile in it forever, then I
> think adding Meson (even if we remove CMake support) has many of the
> same challenges as the state we're in today "supporting" Make and CMake
> in parallel.
If our stance is that we cannot ever drop our Makefile because it has
grown for such a long time, but maintaing two official build systems at
the same time is not an option either, then our hands are tied. So I
don't think is a reasonable approach overall.
Yes, transitions like this will cause some pain, but I think that it is
relatively easy to avoid most of the pain by having a proper plan for
how to do the transition. The biggest pain will be that we have to
maintain multiple build systems and keep them in sync for some time, but
that also has a couple of advantages:
- We can iteratively evolve the replacement build system over time
until it is ready to fully replace the old one.
- We don't have to screw anyone over by having a hard cutoff date.
- We can decide that the replacement build system is insufficient and
discard it.
- Users of the build system can experiment with both build systems.
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v4 00/19] Modernize the build system
2024-11-09 12:58 ` David Aguilar
2024-11-10 1:07 ` Eli Schwartz
@ 2024-11-11 10:36 ` Patrick Steinhardt
2024-11-11 21:48 ` Eli Schwartz
2024-11-13 9:21 ` David Aguilar
1 sibling, 2 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-11 10:36 UTC (permalink / raw)
To: David Aguilar
Cc: Taylor Blau, git, Eli Schwartz, Eric Sunshine, Phillip Wood,
Junio C Hamano, Ramsay Jones
On Sat, Nov 09, 2024 at 04:58:56AM -0800, David Aguilar wrote:
> On Mon, Nov 04, 2024 at 10:18:20AM -0500, Taylor Blau wrote:
> > On Mon, Nov 04, 2024 at 01:17:00PM +0100, Patrick Steinhardt wrote:
> > > > I admittedly have a hard time squaring the benefits and goals we have
> > > > with Meson with the cost of learning a new build system, and/or moving
> > > > away from Make entirely.
> > >
> > > I guess this depends on the exact persona you're optimizing for. There
> > > are three main personas involved here:
> > >
> > > - New contributors. This is a group of people that I think would
> > > benefit from Meson. They get integration with their favorite IDE,
> > > have easy ways to discover how to tweak build instructions and can
> > > use standard invocations for Meson that they might already know from
> > > other projects.
>
> As someone that was once a New Contributor, my perception is that new
> contributors are more likely to be familiar with CMake due to its longer
> history and wider general popularity.
>
> CMake has standard invocations and IDE integration so this isn't really
> a Meson-specific feature.
>
> That said, if we mean, "Linux/Unix-savvy New Contributors," then
> I can understand why Meson might be a favorite, and perhaps this
> might be the crowd we are looking to target (in the same vein of
> the original argument for why Git uses C instead of C++).
>
> The remainder of my reply assumes that we are targetting a general
> audience (in other words, including Windows users).
>
> Disclaimer ~ I don't use Windows so I'm making some broad assumptions and
> generalizations about that userbase.
My goal is to not only make things easier to use for Linux users, but
also for users on other platforms like Windows while also catering to
the typical developer of Git and making the solution for them as tasty
as possible.
I agree that CMake is a tad easier to use and set up on Windows, mostly
because it is directly integrated into MSVC. But I also think that CMake
is a harder sell towards the power users because it is comparatively
hard to maintain due to its somewhat arcane syntax, implicit variables
and things like this.
So I'm basically trying to find a good middle ground where all of the
respective target audiences get benefit:
- For Unix devs I think that Meson is easier to maintain and use
compared to CMake. We also get nice features like out-of-source
builds, good integration with the test suite and easy integration
with IDEs.
- For Windows devs we have an officially supported way to build Meson
from MSVC and co. Also, subprojects allow us to have as easy story
for how to build Git without preinstalled dependencies, which is not
currently possible with CMake to the best of my knowledge.
- For packagers I think that Meson provides better discoverability of
options than CMake.
So Meson may not be the perfect solution for everyone of these target
audiences, and better solutions may exist to cater specific needs. But
it provides a net benefit for every single one of these audiences from
my point of view. And when taking the benefits for all target audiences
combined I think that Meson provides the bigger win compared to CMake.
> > Patrick Steinhardt wrote:
> > > - Packagers. This is another group of people that would benefit from
> > > my point of view. This is mostly because Meson has certain standards
> > > for how to approach problems, and thus the packager would know for
> > > how to handle things. They don't have to manually track build
> > > options and changes thereof, as these can be easily discovered and
> > > because Meson will error out in case invalid options are passed.
>
> CMake's option() variables and its GNUInstallDirs module pretty much
> handles all of the standardization that packagers are looking for on
> this front, so this argument doesn't push the needle towards Meson over
> CMake from my perspective.
I think that discoverability of Meson is way better. Here you can simply
say `meson configure` and it provides you a nice list of all options
that are available. For CMake it always used to be a big pain.
> > Taylor Blau wrote:
> > I appreciate your thoughtful response to my concerns here. Please feel
> > free to correct me if I am wrong, but I think the bulk of your argument
> > is captured fairly well by these three points, so I want to focus my
> > response here.
> >
> > Responding in turn, I think my feeling is something like:
> >
> > - Long-time Git contributors are going to be the ones who will most
> > frequently use the new build system. I am definitely sympathetic to
> > getting too comfortable with our existing tools, but so far in your
> > response I have not seen a compelling reason to switch the project
> > to use Meson.
>
> Likewise, I have not seen a compelling reason to not focus the
> effort on CMake instead. In other words, why not enhance the current
> status quo (Make + CMake) instead of trying to replace it?
As mentioned above, I mostly think that Meson makes for a more
compelling overall package. That being said, if we eventually come to
the conclusion that we as a community want CMake instead of Meson, then
I am willing to go there.
> > * New contributors do not interact with build system internals
> > nearly as much as more experienced contributors. I would imagine
> > that the vast majority of those interactions are simply running
> > "make" or "make test".
> >
> > You mention a handful of other niceties that Meson provides,
> > like language server support, but I am not sure that I agree
> > those are (a) the responsibility of the build system to provide,
> > or (b) that those needs aren't already well met by the vast
> > number of existing tools and IDE integrations that can work with
> > ctags.
>
> CMake has all of these same bells and whistles, and it's already present
> in git.git. LSP support just means being able to generate a
> compile_commands.json file, and the current CMake setup already does
> that.
>
> The one thing that no one has mentioned is dependencies.
>
> CMake has less dependencies. Python is arguably a liability in the build
> system arena, and Meson requires it.
Eli has menitoned [muon](https://muon.build/), which is a drop-in
replacement for Meson written in plain C99. I don't know whether it is
currently able to compile the Git project, but if this is going to be a
concern for people I can try to make sure that it does.
> Furthermore, if you must have your fast Ninja builds then CMake supports
> that too, but, critically, it's optional. If you don't have Ninja then
> you can use CMake's Makefile generator. Meson, OTOH, requires
> Ninja. CMake seems like a more pragmatic option in that regard.
>
> Sorry for derailing this thread to share my Meson vs. CMake opinion, but
> if the main con that the Meson website has to say about CMake is, "The
> scripting language is cumbersome to work with. Some simple things are
> more complicated than necessary." [1] then my general feeling is that
> it's not a very strong reason for Git's needs.
No need to be sorry at all, the whole thread is marked as an RFC exactly
so that people can provide their opinions.
> > > I fully agree with all you're saying here. Whatever the solution, the
> > > new build system should be a proper first-class citizen and should be
> > > exercised by our CI systems such that they don't silently break.
> > >
> > > I also agree that it's going to be a hassle to maintain three (or three
> > > and a half if you count autoconf) build systems. But I don't want to
> > > break any users out there by dropping everything but Meson immediately,
> > > so I think we just have to accept multiple build systems as an
> > > intermediate step. How exactly that would look like is certainly up for
> > > debate. My take would be:
> > >
> > > 1. Adopt the new build system and start exercising it via CI.
> > >
> > > 2. Drop CMake.
> > >
> > > 3. Drop autoconf.
> > >
> > > 4. Drop Makefiles.
> > >
> > > This should happen over multiple releases such that every step will pull
> > > in additional user groups, which will make the new build system more
> > > solid overall. I could see that one step corresponds to one release
> > > cycle, but I'm also happy to adapt the pacing as necessary.
>
> My take would be:
>
> 1. Enhance CMake
> 2. Drop Autoconf
> 3. Profit?
>
> This would not need to happen over multiple releases. There'd just be
> one minor or major release where (2) would happen once (1) has reached
> some substantial level of maturity, and that'd be it.
>
> Arguably, we could even do (2) before (1) and it'd be fine.
I'd honestly be sad if we go down the CMake route, mostly because I
think that it is an inferior build system compared to Meson. I have
worked with it extensively in the context of libgit2 and always found it
to be a pain due to its esoteric syntax, the use of so many implicit
variables, platform CMake policies, and there being so many ways to do
the same thing and, where the easiest solution is typically the wrong
one to pick.
That being said, I'm trying to be as pragmatic is possible: my main goal
is to have a modern build system that is easier to use. So while I think
that Meson fits better into that role, the next-best thing would be
CMake from my point of view.
So I'll continue to champion Meson, but if the project as a whole agrees
to take up CMake as another official build system then I'll adapt and
make that happen.
> > I have a hard time imagining the project ever dropping its Makefile
> > entirely, if for no other reason that make is available nearly
> > everywhere that we want to build Git, and the Makefile is the product of
> > nearly two decades of work to make it compile anywhere.
> >
> > If our tree really is going to have a Makefile in it forever, then I
> > think adding Meson (even if we remove CMake support) has many of the
> > same challenges as the state we're in today "supporting" Make and CMake
> > in parallel.
>
> I agree, and from my outsider perspective it seems like a simpler answer
> would be to double-down on CMake rather than having to adopt another
> system and do the whole deprecation dance.
>
> My perception is that any benefits we would get from supporting Meson
> would also be present with CMake, but with less effort.
I doubt the "less effort" part. The Meson build instructions are way
more complete compared to the CMake build instructions by now -- many
things that work with Meson don't work with CMake. So we would have to
invest significant resources to polish CMake.
> That's just my opinion, though. Perhaps there are strong reasons for why
> Meson is a better tool for the purposes of attracting New Contributors
> and improving our day-to-day usage, but the benefits are not immediately
> obvious to me at least.
Thanks for your input, highly appreciated!
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v4 05/19] Makefile: use "generate-perl.sh" to massage Perl library
2024-10-24 12:39 ` [RFC PATCH v4 05/19] Makefile: use "generate-perl.sh" to massage Perl library Patrick Steinhardt
@ 2024-11-11 10:53 ` Phillip Wood
2024-11-11 14:13 ` Patrick Steinhardt
0 siblings, 1 reply; 386+ messages in thread
From: Phillip Wood @ 2024-11-11 10:53 UTC (permalink / raw)
To: Patrick Steinhardt, git
Cc: Eli Schwartz, Eric Sunshine, Junio C Hamano, Ramsay Jones,
Taylor Blau
Hi Patrick
On 24/10/2024 13:39, Patrick Steinhardt wrote:
> diff --git a/generate-perl.sh b/generate-perl.sh
> index 12e116b76e5..cb1629857c6 100755
> --- a/generate-perl.sh
> +++ b/generate-perl.sh
> @@ -17,10 +17,20 @@ OUTPUT="$5"
> . "$GIT_BUILD_OPTIONS"
I need to add
case "$OUTPUT" in
*.pm)
dir="$(dirname $OUTPUT)"
if ! test -d "$dir"
then
mkdir -p "$dir"
fi
;;
esac
to create the output directories when building out of tree using CMake
on Linux. I'm not sure why it works on Windows without this, or why we
don't need to create the leading directories when generating
clar-decls.h or clar.suite as CMake seems to do it for us when it
initializes the build directory.
> sed -e '1{' \
> + -e " /^#!.*perl/!b" \
> -e " s|#!.*perl|#!$PERL_PATH|" \
> -e " r $PERL_HEADER" \
> -e ' G' \
> -e '}' \
> - -e "s/@GIT_VERSION@/$GIT_VERSION/g" \
> + -e "s|@GIT_VERSION@|$GIT_VERSION|g" \
> + -e "s|@LOCALEDIR@|$PERL_LOCALEDIR|g" \
> + -e "s|@NO_GETTEXT@|$NO_GETTEXT|g" \
> + -e "s|@NO_PERL_CPAN_FALLBACKS@|$NO_PERL_CPAN_FALLBACKS|g" \
> "$INPUT" >"$OUTPUT"
> -chmod a+x "$OUTPUT"
> +
> +case "$(basename "$INPUT")" in
Nit: there's no need to call "basename" here as "*" will match directory
separators in a case statement.
Best Wishes
Phillip
> +*.perl)
> + chmod a+x "$OUTPUT";;
> +*)
> + ;;
> +esac
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v4 05/19] Makefile: use "generate-perl.sh" to massage Perl library
2024-11-11 10:53 ` Phillip Wood
@ 2024-11-11 14:13 ` Patrick Steinhardt
2024-11-11 14:18 ` Paul Smith
0 siblings, 1 reply; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-11 14:13 UTC (permalink / raw)
To: phillip.wood
Cc: git, Eli Schwartz, Eric Sunshine, Junio C Hamano, Ramsay Jones,
Taylor Blau
On Mon, Nov 11, 2024 at 10:53:58AM +0000, Phillip Wood wrote:
> Hi Patrick
>
> On 24/10/2024 13:39, Patrick Steinhardt wrote:
> > diff --git a/generate-perl.sh b/generate-perl.sh
> > index 12e116b76e5..cb1629857c6 100755
> > --- a/generate-perl.sh
> > +++ b/generate-perl.sh
> > @@ -17,10 +17,20 @@ OUTPUT="$5"
> > . "$GIT_BUILD_OPTIONS"
>
> I need to add
>
> case "$OUTPUT" in
> *.pm)
> dir="$(dirname $OUTPUT)"
> if ! test -d "$dir"
> then
> mkdir -p "$dir"
> fi
> ;;
> esac
>
> to create the output directories when building out of tree using CMake on
> Linux. I'm not sure why it works on Windows without this, or why we don't
> need to create the leading directories when generating clar-decls.h or
> clar.suite as CMake seems to do it for us when it initializes the build
> directory.
Ah, indeed, I can reproduce this when using Makefiles. I'll solve this
via `file(MAKE_DIRECTORY)`.
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v4 05/19] Makefile: use "generate-perl.sh" to massage Perl library
2024-11-11 14:13 ` Patrick Steinhardt
@ 2024-11-11 14:18 ` Paul Smith
2024-11-11 14:48 ` Patrick Steinhardt
0 siblings, 1 reply; 386+ messages in thread
From: Paul Smith @ 2024-11-11 14:18 UTC (permalink / raw)
To: git
On Mon, 2024-11-11 at 15:13 +0100, Patrick Steinhardt wrote:
> > case "$OUTPUT" in
> > *.pm)
> > dir="$(dirname $OUTPUT)"
> > if ! test -d "$dir"
> > then
> > mkdir -p "$dir"
> > fi
> > ;;
> > esac
This seems kind of complicated to me. Why not just simply:
case "$OUTPUT" in
(*.pm) mkdir -p "$(dirname $OUTPUT)" ;;
esac
There's no point in testing for existence of the directory before
invoking mkdir -p IMO.
Maybe the git environment has some rules about this?
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v4 05/19] Makefile: use "generate-perl.sh" to massage Perl library
2024-11-11 14:18 ` Paul Smith
@ 2024-11-11 14:48 ` Patrick Steinhardt
0 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-11 14:48 UTC (permalink / raw)
To: Paul Smith; +Cc: git
On Mon, Nov 11, 2024 at 09:18:35AM -0500, Paul Smith wrote:
> On Mon, 2024-11-11 at 15:13 +0100, Patrick Steinhardt wrote:
> > > case "$OUTPUT" in
> > > *.pm)
> > > dir="$(dirname $OUTPUT)"
> > > if ! test -d "$dir"
> > > then
> > > mkdir -p "$dir"
> > > fi
> > > ;;
> > > esac
>
> This seems kind of complicated to me. Why not just simply:
>
> case "$OUTPUT" in
> (*.pm) mkdir -p "$(dirname $OUTPUT)" ;;
> esac
>
> There's no point in testing for existence of the directory before
> invoking mkdir -p IMO.
>
> Maybe the git environment has some rules about this?
I won't use either of these. Our Makefile already knows to create the
parent directory anyway:
perl/build/lib/%.pm: perl/%.pm generate-perl.sh GIT-BUILD-OPTIONS GIT-PERL-DEFINES
$(call mkdir_p_parent_template)
$(QUIET_GEN)$(SHELL_PATH) generate-perl.sh ./GIT-BUILD-OPTIONS $(GIT_VERSION) GIT-PERL-HEADER "$<" "$@"
The issue is rather that CMake didn't know to do the same, so I'm
solving this in CMake rather than in the script.
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* [RFC PATCH v5 00/19] Modernize the build system
2024-10-02 15:15 [RFC PATCH 00/21] Modernize the build system Patrick Steinhardt
` (24 preceding siblings ...)
2024-10-24 12:39 ` [RFC PATCH v4 00/19] " Patrick Steinhardt
@ 2024-11-11 15:30 ` Patrick Steinhardt
2024-11-11 15:30 ` [RFC PATCH v5 01/19] Makefile: use common template for GIT-BUILD-OPTIONS Patrick Steinhardt
` (19 more replies)
2024-11-12 17:02 ` [PATCH RFC v6 " Patrick Steinhardt
` (5 subsequent siblings)
31 siblings, 20 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-11 15:30 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar
Hi,
this is the fourth version of my patch series that modernizes our build
system. It refactors various parts of it to make it possible to perform
out-of-tree builds in theory and then wires up Meson.
Changes compared to v4:
- Improve our CMake build instructions tot use `SH_EXE` to execute
scripts.
- Create Perl build directories in our CMake build instructions.
- Remove superfluous use of basename(1).
- Remove timeout for unit tests in Meson.
Thanks!
Patrick
Patrick Steinhardt (19):
Makefile: use common template for GIT-BUILD-OPTIONS
Makefile: consistently use @PLACEHOLDER@ to substitute
Makefile: consistently use PERL_PATH
Makefile: extract script to massage Perl scripts
Makefile: use "generate-perl.sh" to massage Perl library
Makefile: extract script to massage Shell scripts
Makefile: extract script to generate gitweb.cgi
Makefile: refactor GIT-VERSION-GEN to be reusable
Makefile: refactor generators to be PWD-independent
Makefile: allow "bin-wrappers/" directory to exist
Makefile: simplify building of templates
Documentation: allow sourcing generated includes from separate dir
Documentation: teach "cmd-list.perl" about out-of-tree builds
Documentation: extract script to generate a list of mergetools
t: better support for out-of-tree builds
t: allow overriding build dir
Documentation: add comparison of build systems
Introduce support for the Meson build system
meson: fix conflicts with in-flight topics
.gitignore | 1 -
Documentation/CodingGuidelines | 2 +-
Documentation/Makefile | 28 +-
Documentation/build-docdep.perl | 2 +
Documentation/cmd-list.perl | 23 +-
Documentation/config/diff.txt | 2 +-
Documentation/config/merge.txt | 2 +-
Documentation/generate-mergetool-list.sh | 17 +
Documentation/git.txt | 24 +-
Documentation/meson.build | 317 ++++
Documentation/technical/build-systems.txt | 224 +++
GIT-BUILD-OPTIONS.in | 47 +
GIT-VERSION-GEN | 12 +-
Makefile | 209 +--
bin-wrappers/.gitignore | 9 +
bin-wrappers/meson.build | 28 +
bin-wrappers/wrap-for-bin.sh | 37 +
configure.ac | 2 +-
contrib/buildsystems/CMakeLists.txt | 230 ++-
contrib/completion/meson.build | 8 +
contrib/meson.build | 1 +
generate-cmdlist.sh | 42 +-
generate-configlist.sh | 20 +-
generate-hooklist.sh | 15 +-
generate-perl.sh | 36 +
generate-script.sh | 34 +
git-cvsserver.perl | 2 +-
git-instaweb.sh | 8 +-
git-request-pull.sh | 2 +-
git-send-email.perl | 2 +-
git-sh-i18n.sh | 6 +-
git-sh-setup.sh | 6 +-
git-svn.perl | 2 +-
gitk-git/po/vi.po | 2 +-
gitweb/GITWEB-BUILD-OPTIONS.in | 25 +
gitweb/Makefile | 58 +-
gitweb/generate-gitweb.sh | 45 +
gitweb/gitweb.perl | 44 +-
gitweb/meson.build | 63 +
meson.build | 1618 +++++++++++++++++
meson_options.txt | 73 +
perl/FromCPAN/Mail/meson.build | 7 +
perl/FromCPAN/meson.build | 9 +
perl/Git/I18N.pm | 6 +-
perl/Git/LoadCPAN.pm | 6 +-
perl/Git/LoadCPAN/Mail/meson.build | 7 +
perl/Git/LoadCPAN/meson.build | 9 +
perl/Git/SVN/Memoize/meson.build | 7 +
perl/Git/SVN/meson.build | 20 +
perl/Git/meson.build | 18 +
.../header_templates/fixed_prefix.template.pl | 2 +-
.../runtime_prefix.template.pl | 8 +-
perl/meson.build | 12 +
po/meson.build | 27 +
subprojects/.gitignore | 1 +
subprojects/curl.wrap | 13 +
subprojects/expat.wrap | 13 +
subprojects/openssl.wrap | 15 +
subprojects/pcre2.wrap | 16 +
subprojects/zlib.wrap | 13 +
t/helper/meson.build | 92 +
t/lib-gettext.sh | 4 +-
t/meson.build | 1111 +++++++++++
t/t7609-mergetool--lib.sh | 2 +-
t/test-lib.sh | 22 +-
templates/Makefile | 39 +-
templates/branches-- | 1 -
templates/{this--description => description} | 0
.../applypatch-msg.sample} | 0
.../commit-msg.sample} | 0
.../fsmonitor-watchman.sample} | 0
templates/hooks/meson.build | 24 +
.../post-update.sample} | 0
.../pre-applypatch.sample} | 0
.../pre-commit.sample} | 0
.../pre-merge-commit.sample} | 0
.../pre-push.sample} | 0
.../pre-rebase.sample} | 0
.../pre-receive.sample} | 0
.../prepare-commit-msg.sample} | 0
.../push-to-checkout.sample} | 0
.../sendemail-validate.sample} | 0
.../update.sample} | 0
templates/{info--exclude => info/exclude} | 0
templates/info/meson.build | 5 +
templates/meson.build | 13 +
unimplemented.sh | 2 +-
wrap-for-bin.sh | 36 -
88 files changed, 4441 insertions(+), 447 deletions(-)
create mode 100755 Documentation/generate-mergetool-list.sh
create mode 100644 Documentation/meson.build
create mode 100644 Documentation/technical/build-systems.txt
create mode 100644 GIT-BUILD-OPTIONS.in
create mode 100644 bin-wrappers/.gitignore
create mode 100644 bin-wrappers/meson.build
create mode 100755 bin-wrappers/wrap-for-bin.sh
create mode 100644 contrib/completion/meson.build
create mode 100644 contrib/meson.build
create mode 100755 generate-perl.sh
create mode 100755 generate-script.sh
create mode 100644 gitweb/GITWEB-BUILD-OPTIONS.in
create mode 100755 gitweb/generate-gitweb.sh
create mode 100644 gitweb/meson.build
create mode 100644 meson.build
create mode 100644 meson_options.txt
create mode 100644 perl/FromCPAN/Mail/meson.build
create mode 100644 perl/FromCPAN/meson.build
create mode 100644 perl/Git/LoadCPAN/Mail/meson.build
create mode 100644 perl/Git/LoadCPAN/meson.build
create mode 100644 perl/Git/SVN/Memoize/meson.build
create mode 100644 perl/Git/SVN/meson.build
create mode 100644 perl/Git/meson.build
create mode 100644 perl/meson.build
create mode 100644 po/meson.build
create mode 100644 subprojects/.gitignore
create mode 100644 subprojects/curl.wrap
create mode 100644 subprojects/expat.wrap
create mode 100644 subprojects/openssl.wrap
create mode 100644 subprojects/pcre2.wrap
create mode 100644 subprojects/zlib.wrap
create mode 100644 t/helper/meson.build
create mode 100644 t/meson.build
delete mode 100644 templates/branches--
rename templates/{this--description => description} (100%)
rename templates/{hooks--applypatch-msg.sample => hooks/applypatch-msg.sample} (100%)
rename templates/{hooks--commit-msg.sample => hooks/commit-msg.sample} (100%)
rename templates/{hooks--fsmonitor-watchman.sample => hooks/fsmonitor-watchman.sample} (100%)
create mode 100644 templates/hooks/meson.build
rename templates/{hooks--post-update.sample => hooks/post-update.sample} (100%)
rename templates/{hooks--pre-applypatch.sample => hooks/pre-applypatch.sample} (100%)
rename templates/{hooks--pre-commit.sample => hooks/pre-commit.sample} (100%)
rename templates/{hooks--pre-merge-commit.sample => hooks/pre-merge-commit.sample} (100%)
rename templates/{hooks--pre-push.sample => hooks/pre-push.sample} (100%)
rename templates/{hooks--pre-rebase.sample => hooks/pre-rebase.sample} (100%)
rename templates/{hooks--pre-receive.sample => hooks/pre-receive.sample} (100%)
rename templates/{hooks--prepare-commit-msg.sample => hooks/prepare-commit-msg.sample} (100%)
rename templates/{hooks--push-to-checkout.sample => hooks/push-to-checkout.sample} (100%)
rename templates/{hooks--sendemail-validate.sample => hooks/sendemail-validate.sample} (100%)
rename templates/{hooks--update.sample => hooks/update.sample} (100%)
rename templates/{info--exclude => info/exclude} (100%)
create mode 100644 templates/info/meson.build
create mode 100644 templates/meson.build
delete mode 100644 wrap-for-bin.sh
Range-diff against v4:
1: 8c481cb9e01 = 1: 8c481cb9e01 Makefile: use common template for GIT-BUILD-OPTIONS
2: 308dcbe0bd4 = 2: 308dcbe0bd4 Makefile: consistently use @PLACEHOLDER@ to substitute
3: 20e77ffc5f5 = 3: 20e77ffc5f5 Makefile: consistently use PERL_PATH
4: 50b607a412a ! 4: 44297298476 Makefile: extract script to massage Perl scripts
@@ contrib/buildsystems/CMakeLists.txt: foreach(script ${git_shell_scripts})
- file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
+ string(REPLACE ".perl" "" perl_gen_path "${script}")
+
-+ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${perl_gen_path}
-+ COMMAND ${CMAKE_SOURCE_DIR}/generate-perl.sh
-+ ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS
-+ ${PROJECT_VERSION}
-+ ${CMAKE_BINARY_DIR}/PERL-HEADER
-+ ${CMAKE_SOURCE_DIR}/${script}
-+ ${CMAKE_BINARY_DIR}/${perl_gen_path}
-+ DEPENDS ${CMAKE_SOURCE_DIR}/generate-perl.sh
-+ ${CMAKE_SOURCE_DIR}/${script})
++ add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/${perl_gen_path}"
++ COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-perl.sh"
++ "${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS"
++ "${PROJECT_VERSION}"
++ "${CMAKE_BINARY_DIR}/PERL-HEADER"
++ "${CMAKE_SOURCE_DIR}/${script}"
++ "${CMAKE_BINARY_DIR}/${perl_gen_path}"
++ DEPENDS "${CMAKE_SOURCE_DIR}/generate-perl.sh"
++ "${CMAKE_SOURCE_DIR}/${script}"
++ VERBATIM)
+ list(APPEND perl_gen ${CMAKE_BINARY_DIR}/${perl_gen_path})
endforeach()
+add_custom_target(perl-gen ALL DEPENDS ${perl_gen})
5: eddafe1cf89 ! 5: 87dc74adfd4 Makefile: use "generate-perl.sh" to massage Perl library
@@ contrib/buildsystems/CMakeLists.txt: string(REPLACE "@PATHSEP@" ":" perl_header
+foreach(script ${git_perl_scripts} ${perl_modules})
string(REPLACE ".perl" "" perl_gen_path "${script}")
- add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${perl_gen_path}
++ get_filename_component(perl_gen_dir "${perl_gen_path}" DIRECTORY)
++ file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/${perl_gen_dir}")
++
+ add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/${perl_gen_path}"
+ COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-perl.sh"
+ "${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS"
@@ contrib/buildsystems/CMakeLists.txt: file(STRINGS ${CMAKE_SOURCE_DIR}/git-p4.py content NEWLINE_CONSUME)
string(REPLACE "#!/usr/bin/env python" "#!/usr/bin/python" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/git-p4 ${content})
@@ generate-perl.sh: OUTPUT="$5"
"$INPUT" >"$OUTPUT"
-chmod a+x "$OUTPUT"
+
-+case "$(basename "$INPUT")" in
++case "$INPUT" in
+*.perl)
+ chmod a+x "$OUTPUT";;
+*)
6: 2cf8cf86218 ! 6: 180655bbab8 Makefile: extract script to massage Shell scripts
@@ contrib/buildsystems/CMakeLists.txt: set(git_shell_scripts
+ set(shell_gen_path "${script}")
+ endif()
+
-+ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${shell_gen_path}
-+ COMMAND ${CMAKE_SOURCE_DIR}/generate-script.sh
-+ ${CMAKE_SOURCE_DIR}/${script}.sh
-+ ${CMAKE_BINARY_DIR}/${shell_gen_path}
-+ ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS
-+ DEPENDS ${CMAKE_SOURCE_DIR}/generate-script.sh
-+ ${CMAKE_SOURCE_DIR}/${script}.sh)
++ add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/${shell_gen_path}"
++ COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-script.sh"
++ "${CMAKE_SOURCE_DIR}/${script}.sh"
++ "${CMAKE_BINARY_DIR}/${shell_gen_path}"
++ "${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS"
++ DEPENDS "${CMAKE_SOURCE_DIR}/generate-script.sh"
++ "${CMAKE_SOURCE_DIR}/${script}.sh"
++ VERBATIM)
+ list(APPEND shell_gen ${CMAKE_BINARY_DIR}/${shell_gen_path})
endforeach()
+add_custom_target(shell-gen ALL DEPENDS ${shell_gen})
@@ contrib/buildsystems/CMakeLists.txt: string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" ""
string(REPLACE "@RUNTIME_PREFIX@" "${RUNTIME_PREFIX}" git_build_options "${git_build_options}")
+string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" git_build_options "${git_build_options}")
+string(REPLACE "@USE_GETTEXT_SCHEME@" "" git_build_options "${git_build_options}")
-+string(REPLACE "@LOCALEDIR@" "LOCALEDIR" git_build_options "${git_build_options}")
++string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" git_build_options "${git_build_options}")
+string(REPLACE "@BROKEN_PATH_FIX@" "" git_build_options "${git_build_options}")
if(USE_VCPKG)
string(APPEND git_build_options "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
7: e8abda661cf = 7: 07d5a9c2957 Makefile: extract script to generate gitweb.cgi
8: 0e682b68e25 ! 8: 065d03468f0 Makefile: refactor GIT-VERSION-GEN to be reusable
@@ contrib/buildsystems/CMakeLists.txt: if(NOT SH_EXE)
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
-endif()
-+execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN
-+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
++execute_process(COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
++ WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
+ OUTPUT_VARIABLE git_version
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
9: 46b7760fbcd ! 9: 817d58cbaf9 Makefile: refactor generators to be PWD-independent
@@ contrib/buildsystems/CMakeLists.txt: set(EXCLUSION_PROGS_CACHE ${EXCLUSION_PROGS
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-cmdlist.sh ${EXCLUSION_PROGS} command-list.txt
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_FILE ${CMAKE_BINARY_DIR}/command-list.h)
-+ execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-cmdlist.sh ${EXCLUSION_PROGS} ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}/command-list.h)
++ execute_process(COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-cmdlist.sh"
++ ${EXCLUSION_PROGS}
++ "${CMAKE_SOURCE_DIR}"
++ "${CMAKE_BINARY_DIR}/command-list.h")
endif()
if(NOT EXISTS ${CMAKE_BINARY_DIR}/config-list.h)
@@ contrib/buildsystems/CMakeLists.txt: set(EXCLUSION_PROGS_CACHE ${EXCLUSION_PROGS
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-configlist.sh
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_FILE ${CMAKE_BINARY_DIR}/config-list.h)
-+ execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-configlist.sh ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}/config-list.h)
++ execute_process(COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-configlist.sh"
++ "${CMAKE_SOURCE_DIR}"
++ "${CMAKE_BINARY_DIR}/config-list.h")
endif()
if(NOT EXISTS ${CMAKE_BINARY_DIR}/hook-list.h)
@@ contrib/buildsystems/CMakeLists.txt: set(EXCLUSION_PROGS_CACHE ${EXCLUSION_PROGS
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-hooklist.sh
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_FILE ${CMAKE_BINARY_DIR}/hook-list.h)
-+ execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-hooklist.sh ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}/hook-list.h)
++ execute_process(COMMAND "${SH_EXE}" ${CMAKE_SOURCE_DIR}/generate-hooklist.sh
++ "${CMAKE_SOURCE_DIR}"
++ "${CMAKE_BINARY_DIR}/hook-list.h")
endif()
include_directories(${CMAKE_BINARY_DIR})
10: ec4a9e65ec3 = 10: 33c9c322853 Makefile: allow "bin-wrappers/" directory to exist
11: b330fd783d4 = 11: a193157a2d8 Makefile: simplify building of templates
12: fb7231ae4c7 = 12: 46667dc608c Documentation: allow sourcing generated includes from separate dir
13: cf1743667e9 = 13: 7079149d6a1 Documentation: teach "cmd-list.perl" about out-of-tree builds
14: 6926a282a80 = 14: 4ef7262aa04 Documentation: extract script to generate a list of mergetools
15: ed3affb794c = 15: 565c3d149f6 t: better support for out-of-tree builds
16: 205b038f961 = 16: 8ebb9184043 t: allow overriding build dir
17: bef26dd67c5 = 17: a39f9a4547b Documentation: add comparison of build systems
18: 780180568d9 ! 18: de2239fbfcd Introduce support for the Meson build system
@@ t/meson.build (new)
+ )
+ test(unit_test_name, unit_test,
+ workdir: meson.current_source_dir(),
++ timeout: 0,
+ )
+endforeach
+
19: 45e2ab4044a = 19: 0be293e8bff meson: fix conflicts with in-flight topics
--
2.47.0.229.g8f8d6eee53.dirty
^ permalink raw reply [flat|nested] 386+ messages in thread
* [RFC PATCH v5 01/19] Makefile: use common template for GIT-BUILD-OPTIONS
2024-11-11 15:30 ` [RFC PATCH v5 " Patrick Steinhardt
@ 2024-11-11 15:30 ` Patrick Steinhardt
2024-11-11 15:30 ` [RFC PATCH v5 02/19] Makefile: consistently use @PLACEHOLDER@ to substitute Patrick Steinhardt
` (18 subsequent siblings)
19 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-11 15:30 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar
The "GIT-BUILD-OPTIONS" file is generated by our build systems to
propagate built-in features and paths to our tests. The generation is
done ad-hoc, where both our Makefile and the CMake build instructions
simply echo a bunch of strings into the file. This makes it very hard to
figure out what variables are expected to exist and what format they
have, and the written variables can easily get out of sync between build
systems.
Introduce a new "GIT-BUILD-OPTIONS.in" template to address this issue.
This has multiple advantages:
- It demonstrates which built options exist in the first place.
- It can serve as a spot to document the build options.
- Some build systems complain when not all variables could be
substituted, alerting us of mismatches. Others don't, but if we
forgot to substitute such variables we now have a bogus string that
will likely cause our tests to fail, if they have any meaning in the
first place.
Backfill values that we didn't yet set in our CMake build instructions.
While at it, remove the `SUPPORTS_SIMPLE_IPC` variable that we only set
up in CMake as it isn't used anywhere.
Note that this change requires us to move around the setup of
TEST_OUTPUT_DIRECTORY in "test-lib.sh" such that it comes after sourcing
the "GIT-BUILD-OPTIONS" file. This is the only instance I could find
where we rely on ordering on variables.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-BUILD-OPTIONS.in | 36 +++++++++
Makefile | 109 ++++++++++------------------
contrib/buildsystems/CMakeLists.txt | 58 ++++++++++-----
t/test-lib.sh | 13 ++--
4 files changed, 121 insertions(+), 95 deletions(-)
create mode 100644 GIT-BUILD-OPTIONS.in
diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in
new file mode 100644
index 00000000000..f0ca240493c
--- /dev/null
+++ b/GIT-BUILD-OPTIONS.in
@@ -0,0 +1,36 @@
+SHELL_PATH=@SHELL_PATH@
+TEST_SHELL_PATH=@TEST_SHELL_PATH@
+PERL_PATH=@PERL_PATH@
+DIFF=@DIFF@
+PYTHON_PATH=@PYTHON_PATH@
+TAR=@TAR@
+NO_CURL=@NO_CURL@
+NO_ICONV=@NO_ICONV@
+NO_EXPAT=@NO_EXPAT@
+USE_LIBPCRE2=@USE_LIBPCRE2@
+NO_PERL=@NO_PERL@
+NO_PTHREADS=@NO_PTHREADS@
+NO_PYTHON=@NO_PYTHON@
+NO_REGEX=@NO_REGEX@
+NO_UNIX_SOCKETS=@NO_UNIX_SOCKETS@
+PAGER_ENV=@PAGER_ENV@
+SANITIZE_LEAK=@SANITIZE_LEAK@
+SANITIZE_ADDRESS=@SANITIZE_ADDRESS@
+X=@X@
+FSMONITOR_DAEMON_BACKEND=@FSMONITOR_DAEMON_BACKEND@
+FSMONITOR_OS_SETTINGS=@FSMONITOR_OS_SETTINGS@
+TEST_OUTPUT_DIRECTORY=@TEST_OUTPUT_DIRECTORY@
+GIT_TEST_OPTS=@GIT_TEST_OPTS@
+GIT_TEST_CMP=@GIT_TEST_CMP@
+GIT_TEST_CMP_USE_COPIED_CONTEXT=@GIT_TEST_CMP_USE_COPIED_CONTEXT@
+GIT_TEST_UTF8_LOCALE=@GIT_TEST_UTF8_LOCALE@
+NO_GETTEXT=@NO_GETTEXT@
+GIT_PERF_REPEAT_COUNT=@GIT_PERF_REPEAT_COUNT@
+GIT_PERF_REPO=@GIT_PERF_REPO@
+GIT_PERF_LARGE_REPO=@GIT_PERF_LARGE_REPO@
+GIT_PERF_MAKE_OPTS=@GIT_PERF_MAKE_OPTS@
+GIT_PERF_MAKE_COMMAND=@GIT_PERF_MAKE_COMMAND@
+GIT_INTEROP_MAKE_OPTS=@GIT_INTEROP_MAKE_OPTS@
+GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@
+GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@
+RUNTIME_PREFIX=@RUNTIME_PREFIX@
diff --git a/Makefile b/Makefile
index 6ad330fc582..457f36487cb 100644
--- a/Makefile
+++ b/Makefile
@@ -3164,76 +3164,45 @@ GIT-LDFLAGS: FORCE
# that runs GIT-BUILD-OPTIONS, and then again to protect it
# and the first level quoting from the shell that runs "echo".
GIT-BUILD-OPTIONS: FORCE
- @echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@+
- @echo TEST_SHELL_PATH=\''$(subst ','\'',$(TEST_SHELL_PATH_SQ))'\' >>$@+
- @echo PERL_PATH=\''$(subst ','\'',$(PERL_PATH_SQ))'\' >>$@+
- @echo DIFF=\''$(subst ','\'',$(subst ','\'',$(DIFF)))'\' >>$@+
- @echo PYTHON_PATH=\''$(subst ','\'',$(PYTHON_PATH_SQ))'\' >>$@+
- @echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@+
- @echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@+
- @echo NO_ICONV=\''$(subst ','\'',$(subst ','\'',$(NO_ICONV)))'\' >>$@+
- @echo NO_EXPAT=\''$(subst ','\'',$(subst ','\'',$(NO_EXPAT)))'\' >>$@+
- @echo USE_LIBPCRE2=\''$(subst ','\'',$(subst ','\'',$(USE_LIBPCRE2)))'\' >>$@+
- @echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@+
- @echo NO_PTHREADS=\''$(subst ','\'',$(subst ','\'',$(NO_PTHREADS)))'\' >>$@+
- @echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@+
- @echo NO_REGEX=\''$(subst ','\'',$(subst ','\'',$(NO_REGEX)))'\' >>$@+
- @echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@+
- @echo PAGER_ENV=\''$(subst ','\'',$(subst ','\'',$(PAGER_ENV)))'\' >>$@+
- @echo SANITIZE_LEAK=\''$(subst ','\'',$(subst ','\'',$(SANITIZE_LEAK)))'\' >>$@+
- @echo SANITIZE_ADDRESS=\''$(subst ','\'',$(subst ','\'',$(SANITIZE_ADDRESS)))'\' >>$@+
- @echo X=\'$(X)\' >>$@+
-ifdef FSMONITOR_DAEMON_BACKEND
- @echo FSMONITOR_DAEMON_BACKEND=\''$(subst ','\'',$(subst ','\'',$(FSMONITOR_DAEMON_BACKEND)))'\' >>$@+
-endif
-ifdef FSMONITOR_OS_SETTINGS
- @echo FSMONITOR_OS_SETTINGS=\''$(subst ','\'',$(subst ','\'',$(FSMONITOR_OS_SETTINGS)))'\' >>$@+
-endif
-ifdef TEST_OUTPUT_DIRECTORY
- @echo TEST_OUTPUT_DIRECTORY=\''$(subst ','\'',$(subst ','\'',$(TEST_OUTPUT_DIRECTORY)))'\' >>$@+
-endif
-ifdef GIT_TEST_OPTS
- @echo GIT_TEST_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_OPTS)))'\' >>$@+
-endif
-ifdef GIT_TEST_CMP
- @echo GIT_TEST_CMP=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_CMP)))'\' >>$@+
-endif
-ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
- @echo GIT_TEST_CMP_USE_COPIED_CONTEXT=YesPlease >>$@+
-endif
-ifdef GIT_TEST_UTF8_LOCALE
- @echo GIT_TEST_UTF8_LOCALE=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_UTF8_LOCALE)))'\' >>$@+
-endif
- @echo NO_GETTEXT=\''$(subst ','\'',$(subst ','\'',$(NO_GETTEXT)))'\' >>$@+
-ifdef GIT_PERF_REPEAT_COUNT
- @echo GIT_PERF_REPEAT_COUNT=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPEAT_COUNT)))'\' >>$@+
-endif
-ifdef GIT_PERF_REPO
- @echo GIT_PERF_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPO)))'\' >>$@+
-endif
-ifdef GIT_PERF_LARGE_REPO
- @echo GIT_PERF_LARGE_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_LARGE_REPO)))'\' >>$@+
-endif
-ifdef GIT_PERF_MAKE_OPTS
- @echo GIT_PERF_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_OPTS)))'\' >>$@+
-endif
-ifdef GIT_PERF_MAKE_COMMAND
- @echo GIT_PERF_MAKE_COMMAND=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_COMMAND)))'\' >>$@+
-endif
-ifdef GIT_INTEROP_MAKE_OPTS
- @echo GIT_INTEROP_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_INTEROP_MAKE_OPTS)))'\' >>$@+
-endif
-ifdef GIT_TEST_INDEX_VERSION
- @echo GIT_TEST_INDEX_VERSION=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_INDEX_VERSION)))'\' >>$@+
-endif
-ifdef GIT_TEST_PERL_FATAL_WARNINGS
- @echo GIT_TEST_PERL_FATAL_WARNINGS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_PERL_FATAL_WARNINGS)))'\' >>$@+
-endif
-ifdef RUNTIME_PREFIX
- @echo RUNTIME_PREFIX=\'true\' >>$@+
-else
- @echo RUNTIME_PREFIX=\'false\' >>$@+
-endif
+ @sed \
+ -e "s|@SHELL_PATH@|\'$(SHELL_PATH_SQ)\'|" \
+ -e "s|@TEST_SHELL_PATH@|\'$(TEST_SHELL_PATH_SQ)\'|" \
+ -e "s|@PERL_PATH@|\'$(PERL_PATH_SQ)\'|" \
+ -e "s|@DIFF@|\'$(DIFF)\'|" \
+ -e "s|@PYTHON_PATH@|\'$(PYTHON_PATH_SQ)\'|" \
+ -e "s|@TAR@|\'$(TAR)\'|" \
+ -e "s|@NO_CURL@|\'$(NO_CURL)\'|" \
+ -e "s|@NO_ICONV@|\'$(NO_ICONV)\'|" \
+ -e "s|@NO_EXPAT@|\'$(NO_EXPAT)\'|" \
+ -e "s|@USE_LIBPCRE2@|\'$(USE_LIBPCRE2)\'|" \
+ -e "s|@NO_PERL@|\'$(NO_PERL)\'|" \
+ -e "s|@NO_PTHREADS@|\'$(NO_PTHREADS)\'|" \
+ -e "s|@NO_PYTHON@|\'$(NO_PYTHON)\'|" \
+ -e "s|@NO_REGEX@|\'$(NO_REGEX)\'|" \
+ -e "s|@NO_UNIX_SOCKETS@|\'$(NO_UNIX_SOCKETS)\'|" \
+ -e "s|@PAGER_ENV@|\'$(PAGER_ENV)\'|" \
+ -e "s|@SANITIZE_LEAK@|\'$(SANITIZE_LEAK)\'|" \
+ -e "s|@SANITIZE_ADDRESS@|\'$(SANITIZE_ADDRESS)\'|" \
+ -e "s|@X@|\'$(X)\'|" \
+ -e "s|@FSMONITOR_DAEMON_BACKEND@|\'$(FSMONITOR_DAEMON_BACKEND)\'|" \
+ -e "s|@FSMONITOR_OS_SETTINGS@|\'$(FSMONITOR_OS_SETTINGS)\'|" \
+ -e "s|@TEST_OUTPUT_DIRECTORY@|\'$(TEST_OUTPUT_DIRECTORY)\'|" \
+ -e "s|@GIT_TEST_OPTS@|\'$(GIT_TEST_OPTS)\'|" \
+ -e "s|@GIT_TEST_CMP@|\'$(GIT_TEST_CMP)\'|" \
+ -e "s|@GIT_TEST_CMP_USE_COPIED_CONTEXT@|\'$(GIT_TEST_CMP_USE_COPIED_CONTEXT)\'|" \
+ -e "s|@GIT_TEST_UTF8_LOCALE@|\'$(GIT_TEST_UTF8_LOCALE)\'|" \
+ -e "s|@NO_GETTEXT@|\'$(NO_GETTEXT)\'|" \
+ -e "s|@GIT_PERF_REPEAT_COUNT@|\'$(GIT_PERF_REPEAT_COUNT)\'|" \
+ -e "s|@GIT_PERF_REPO@|\'$(GIT_PERF_REPO)\'|" \
+ -e "s|@GIT_PERF_LARGE_REPO@|\'$(GIT_PERF_LARGE_REPO)\'|" \
+ -e "s|@GIT_PERF_MAKE_OPTS@|\'$(GIT_PERF_MAKE_OPTS)\'|" \
+ -e "s|@GIT_PERF_MAKE_COMMAND@|\'$(GIT_PERF_MAKE_COMMAND)\'|" \
+ -e "s|@GIT_INTEROP_MAKE_OPTS@|\'$(GIT_INTEROP_MAKE_OPTS)\'|" \
+ -e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \
+ -e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \
+ -e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX)\'|" \
+ GIT-BUILD-OPTIONS.in >$@+
+ @if grep -q '^[A-Z][A-Z_]*=@.*@$$' $@+; then echo "Unsubstituted build options in $@" >&2 && exit 1; fi
@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
@if test -f GIT-BUILD-DIR; then rm GIT-BUILD-DIR; fi
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 8974bb9fa20..680e5b3c8b0 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -1117,27 +1117,47 @@ if(NOT PYTHON_TESTS)
set(NO_PYTHON 1)
endif()
-file(WRITE ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "SHELL_PATH='${SHELL_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "TEST_SHELL_PATH='${TEST_SHELL_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PERL_PATH='${PERL_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "DIFF='${DIFF}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PYTHON_PATH='${PYTHON_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "TAR='${TAR}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_CURL='${NO_CURL}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_ICONV='${NO_ICONV}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_EXPAT='${NO_EXPAT}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PERL='${NO_PERL}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PTHREADS='${NO_PTHREADS}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_UNIX_SOCKETS='${NO_UNIX_SOCKETS}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PAGER_ENV='${PAGER_ENV}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "X='${EXE_EXTENSION}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_GETTEXT='${NO_GETTEXT}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "RUNTIME_PREFIX='${RUNTIME_PREFIX}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PYTHON='${NO_PYTHON}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "SUPPORTS_SIMPLE_IPC='${SUPPORTS_SIMPLE_IPC}'\n")
+file(STRINGS ${CMAKE_SOURCE_DIR}/GIT-BUILD-OPTIONS.in git_build_options NEWLINE_CONSUME)
+string(REPLACE "@SHELL_PATH@" "${SHELL_PATH}" git_build_options "${git_build_options}")
+string(REPLACE "@TEST_SHELL_PATH@" "${TEST_SHELL_PATH}" git_build_options "${git_build_options}")
+string(REPLACE "@PERL_PATH@" "${PERL_PATH}" git_build_options "${git_build_options}")
+string(REPLACE "@DIFF@" "${DIFF}" git_build_options "${git_build_options}")
+string(REPLACE "@PYTHON_PATH@" "${PYTHON_PATH}" git_build_options "${git_build_options}")
+string(REPLACE "@TAR@" "${TAR}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_CURL@" "${NO_CURL}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_ICONV@" "${NO_ICONV}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_EXPAT@" "${NO_EXPAT}" git_build_options "${git_build_options}")
+string(REPLACE "@USE_LIBPCRE2@" "" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PERL@" "${NO_PERL}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PTHREADS@" "${NO_PTHREADS}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PYTHON@" "${NO_PYTHON}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_REGEX@" "" git_build_options "${git_build_options}")
+string(REPLACE "@NO_UNIX_SOCKETS@" "${NO_UNIX_SOCKETS}" git_build_options "${git_build_options}")
+string(REPLACE "@PAGER_ENV@" "${PAGER_ENV}" git_build_options "${git_build_options}")
+string(REPLACE "@SANITIZE_LEAK@" "" git_build_options "${git_build_options}")
+string(REPLACE "@SANITIZE_ADDRESS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@X@" "${EXE_EXTENSION}" git_build_options "${git_build_options}")
+string(REPLACE "@FSMONITOR_DAEMON_BACKEND@" "win32" git_build_options "${git_build_options}")
+string(REPLACE "@FSMONITOR_OS_SETTINGS@" "win32" git_build_options "${git_build_options}")
+string(REPLACE "@TEST_OUTPUT_DIRECTORY@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_OPTS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_CMP@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_CMP_USE_COPIED_CONTEXT@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_UTF8_LOCALE@" "" git_build_options "${git_build_options}")
+string(REPLACE "@NO_GETTEXT@" "${NO_GETTEXT}" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_REPEAT_COUNT@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_REPO@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_LARGE_REPO@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_MAKE_OPTS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_MAKE_COMMAND@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@RUNTIME_PREFIX@" "${RUNTIME_PREFIX}" git_build_options "${git_build_options}")
if(USE_VCPKG)
- file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
+ string(APPEND git_build_options "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
endif()
+file(WRITE ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS ${git_build_options})
#Make the tests work when building out of the source tree
get_filename_component(CACHE_PATH ${CMAKE_CURRENT_LIST_DIR}/../../CMakeCache.txt ABSOLUTE)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index a278181a056..4dd641baefe 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -35,12 +35,6 @@ else
# needing to exist.
TEST_DIRECTORY=$(cd "$TEST_DIRECTORY" && pwd) || exit 1
fi
-if test -z "$TEST_OUTPUT_DIRECTORY"
-then
- # Similarly, override this to store the test-results subdir
- # elsewhere
- TEST_OUTPUT_DIRECTORY=$TEST_DIRECTORY
-fi
GIT_BUILD_DIR="${TEST_DIRECTORY%/t}"
if test "$TEST_DIRECTORY" = "$GIT_BUILD_DIR"
then
@@ -100,6 +94,13 @@ fi
. "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
export PERL_PATH SHELL_PATH
+if test -z "$TEST_OUTPUT_DIRECTORY"
+then
+ # Similarly, override this to store the test-results subdir
+ # elsewhere
+ TEST_OUTPUT_DIRECTORY=$TEST_DIRECTORY
+fi
+
# In t0000, we need to override test directories of nested testcases. In case
# the developer has TEST_OUTPUT_DIRECTORY part of his build options, then we'd
# reset this value to instead contain what the developer has specified. We thus
--
2.47.0.229.g8f8d6eee53.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v5 02/19] Makefile: consistently use @PLACEHOLDER@ to substitute
2024-11-11 15:30 ` [RFC PATCH v5 " Patrick Steinhardt
2024-11-11 15:30 ` [RFC PATCH v5 01/19] Makefile: use common template for GIT-BUILD-OPTIONS Patrick Steinhardt
@ 2024-11-11 15:30 ` Patrick Steinhardt
2024-11-11 15:30 ` [RFC PATCH v5 03/19] Makefile: consistently use PERL_PATH Patrick Steinhardt
` (17 subsequent siblings)
19 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-11 15:30 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar
We have a bunch of placeholders in our scripts that we replace at build
time, for example by using sed(1). These placeholders come in three
different formats: @PLACEHOLDER@, @@PLACEHOLDER@@ and ++PLACEHOLDER++.
Next to being inconsistent it also creates a bit of a problem with
CMake, which only supports the first syntax in its `configure_file()`
function. To work around that we instead manually replace placeholders
via string operations, which is a hassle and removes safeguards that
CMake has to verify that we didn't forget to replace any placeholders.
Besides that, other build systems like Meson also support the CMake
syntax.
Unify our codebase to consistently use the syntax supported by such
build systems.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 44 +++++++++----------
configure.ac | 2 +-
contrib/buildsystems/CMakeLists.txt | 34 +++++++-------
git-cvsserver.perl | 2 +-
git-instaweb.sh | 8 ++--
git-request-pull.sh | 2 +-
git-send-email.perl | 2 +-
git-sh-i18n.sh | 6 +--
git-sh-setup.sh | 6 +--
git-svn.perl | 2 +-
gitk-git/po/vi.po | 2 +-
gitweb/Makefile | 44 +++++++++----------
gitweb/gitweb.perl | 44 +++++++++----------
perl/Git/I18N.pm | 6 +--
perl/Git/LoadCPAN.pm | 6 +--
| 2 +-
.../runtime_prefix.template.pl | 8 ++--
unimplemented.sh | 2 +-
wrap-for-bin.sh | 18 ++++----
19 files changed, 120 insertions(+), 120 deletions(-)
diff --git a/Makefile b/Makefile
index 457f36487cb..8a2b292e3d2 100644
--- a/Makefile
+++ b/Makefile
@@ -1555,10 +1555,10 @@ endif
ifdef SANE_TOOL_PATH
SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH))
-BROKEN_PATH_FIX = 's|^\# @@BROKEN_PATH_FIX@@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|'
+BROKEN_PATH_FIX = 's|^\# @BROKEN_PATH_FIX@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|'
PATH := $(SANE_TOOL_PATH):${PATH}
else
-BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d'
+BROKEN_PATH_FIX = '/^\# @BROKEN_PATH_FIX@$$/d'
endif
ifeq (,$(HOST_CPU))
@@ -2548,13 +2548,13 @@ GIT-SCRIPT-DEFINES: FORCE
define cmd_munge_script
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
- -e 's|@@DIFF@@|$(DIFF_SQ)|' \
- -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' \
- -e 's/@@USE_GETTEXT_SCHEME@@/$(USE_GETTEXT_SCHEME)/g' \
+ -e 's|@DIFF@|$(DIFF_SQ)|' \
+ -e 's|@LOCALEDIR@|$(localedir_SQ)|g' \
+ -e 's/@USE_GETTEXT_SCHEME@/$(USE_GETTEXT_SCHEME)/g' \
-e $(BROKEN_PATH_FIX) \
- -e 's|@@GITWEBDIR@@|$(gitwebdir_SQ)|g' \
- -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
- -e 's|@@PAGER_ENV@@|$(PAGER_ENV_SQ)|g' \
+ -e 's|@GITWEBDIR@|$(gitwebdir_SQ)|g' \
+ -e 's|@PERL@|$(PERL_PATH_SQ)|g' \
+ -e 's|@PAGER_ENV@|$(PAGER_ENV_SQ)|g' \
$@.sh >$@+
endef
@@ -2611,7 +2611,7 @@ $(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
-e ' r GIT-PERL-HEADER' \
-e ' G' \
-e '}' \
- -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
+ -e 's/@GIT_VERSION@/$(GIT_VERSION)/g' \
$< >$@+ && \
chmod +x $@+ && \
mv $@+ $@
@@ -2629,11 +2629,11 @@ GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile
INSTLIBDIR='$(perllibdir_SQ)' && \
INSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \
INSTLIBDIR="$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}" && \
- sed -e 's=@@PATHSEP@@=$(pathsep)=g' \
- -e "s=@@INSTLIBDIR@@=$$INSTLIBDIR=g" \
- -e 's=@@PERLLIBDIR_REL@@=$(perllibdir_relative_SQ)=g' \
- -e 's=@@GITEXECDIR_REL@@=$(gitexecdir_relative_SQ)=g' \
- -e 's=@@LOCALEDIR_REL@@=$(localedir_relative_SQ)=g' \
+ sed -e 's=@PATHSEP@=$(pathsep)=g' \
+ -e "s=@INSTLIBDIR@=$$INSTLIBDIR=g" \
+ -e 's=@PERLLIBDIR_REL@=$(perllibdir_relative_SQ)=g' \
+ -e 's=@GITEXECDIR_REL@=$(gitexecdir_relative_SQ)=g' \
+ -e 's=@LOCALEDIR_REL@=$(localedir_relative_SQ)=g' \
$< >$@+ && \
mv $@+ $@
@@ -2649,7 +2649,7 @@ else # NO_PERL
$(SCRIPT_PERL_GEN) git-instaweb: % : unimplemented.sh
$(QUIET_GEN) \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@@REASON@@|NO_PERL=$(NO_PERL)|g' \
+ -e 's|@REASON@|NO_PERL=$(NO_PERL)|g' \
unimplemented.sh >$@+ && \
chmod +x $@+ && \
mv $@+ $@
@@ -2670,13 +2670,13 @@ else # NO_PYTHON
$(SCRIPT_PYTHON_GEN): % : unimplemented.sh
$(QUIET_GEN) \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@@REASON@@|NO_PYTHON=$(NO_PYTHON)|g' \
+ -e 's|@REASON@|NO_PYTHON=$(NO_PYTHON)|g' \
unimplemented.sh >$@+ && \
chmod +x $@+ && \
mv $@+ $@
endif # NO_PYTHON
-CONFIGURE_RECIPE = sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
+CONFIGURE_RECIPE = sed -e 's/@GIT_VERSION@/$(GIT_VERSION)/g' \
configure.ac >configure.ac+ && \
autoconf -o configure configure.ac+ && \
$(RM) configure.ac+
@@ -3104,9 +3104,9 @@ endif
perl/build/lib/%.pm: perl/%.pm GIT-PERL-DEFINES
$(call mkdir_p_parent_template)
$(QUIET_GEN) \
- sed -e 's|@@LOCALEDIR@@|$(perl_localedir_SQ)|g' \
- -e 's|@@NO_GETTEXT@@|$(NO_GETTEXT_SQ)|g' \
- -e 's|@@NO_PERL_CPAN_FALLBACKS@@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \
+ sed -e 's|@LOCALEDIR@|$(perl_localedir_SQ)|g' \
+ -e 's|@NO_GETTEXT@|$(NO_GETTEXT_SQ)|g' \
+ -e 's|@NO_PERL_CPAN_FALLBACKS@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \
< $< > $@
perl/build/man/man3/Git.3pm: perl/Git.pm
@@ -3225,8 +3225,8 @@ all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PR
bin-wrappers/%: wrap-for-bin.sh
$(call mkdir_p_parent_template)
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@@BUILD_DIR@@|$(shell pwd)|' \
- -e 's|@@PROG@@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
+ -e 's|@BUILD_DIR@|$(shell pwd)|' \
+ -e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
chmod +x $@
# GNU make supports exporting all variables by "export" without parameters.
diff --git a/configure.ac b/configure.ac
index d1a96da14eb..5923edc44aa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -142,7 +142,7 @@ fi
## Configure body starts here.
AC_PREREQ(2.59)
-AC_INIT([git], [@@GIT_VERSION@@], [git@vger.kernel.org])
+AC_INIT([git], [@GIT_VERSION@], [git@vger.kernel.org])
AC_CONFIG_SRCDIR([git.c])
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 680e5b3c8b0..a41540458b7 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -836,14 +836,14 @@ set(git_shell_scripts
foreach(script ${git_shell_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.sh content NEWLINE_CONSUME)
string(REPLACE "@SHELL_PATH@" "${SHELL_PATH}" content "${content}")
- string(REPLACE "@@DIFF@@" "diff" content "${content}")
+ string(REPLACE "@DIFF@" "diff" content "${content}")
string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}")
string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" content "${content}")
- string(REPLACE "@@NO_CURL@@" "" content "${content}")
- string(REPLACE "@@USE_GETTEXT_SCHEME@@" "" content "${content}")
- string(REPLACE "# @@BROKEN_PATH_FIX@@" "" content "${content}")
- string(REPLACE "@@PERL@@" "${PERL_PATH}" content "${content}")
- string(REPLACE "@@PAGER_ENV@@" "LESS=FRX LV=-c" content "${content}")
+ string(REPLACE "@NO_CURL@" "" content "${content}")
+ string(REPLACE "@USE_GETTEXT_SCHEME@" "" content "${content}")
+ string(REPLACE "# @BROKEN_PATH_FIX@" "" content "${content}")
+ string(REPLACE "@PERL@" "${PERL_PATH}" content "${content}")
+ string(REPLACE "@PAGER_ENV@" "LESS=FRX LV=-c" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
endforeach()
@@ -852,13 +852,13 @@ parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" ".perl")
#create perl header
file(STRINGS ${CMAKE_SOURCE_DIR}/perl/header_templates/fixed_prefix.template.pl perl_header )
-string(REPLACE "@@PATHSEP@@" ":" perl_header "${perl_header}")
-string(REPLACE "@@INSTLIBDIR@@" "${INSTLIBDIR}" perl_header "${perl_header}")
+string(REPLACE "@PATHSEP@" ":" perl_header "${perl_header}")
+string(REPLACE "@INSTLIBDIR@" "${INSTLIBDIR}" perl_header "${perl_header}")
foreach(script ${git_perl_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.perl content NEWLINE_CONSUME)
string(REPLACE "#!/usr/bin/perl" "#!/usr/bin/perl\n${perl_header}\n" content "${content}")
- string(REPLACE "@@GIT_VERSION@@" "${PROJECT_VERSION}" content "${content}")
+ string(REPLACE "@GIT_VERSION@" "${PROJECT_VERSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
endforeach()
@@ -873,8 +873,8 @@ file(GLOB_RECURSE perl_modules "${CMAKE_SOURCE_DIR}/perl/*.pm")
foreach(pm ${perl_modules})
string(REPLACE "${CMAKE_SOURCE_DIR}/perl/" "" file_path ${pm})
file(STRINGS ${pm} content NEWLINE_CONSUME)
- string(REPLACE "@@LOCALEDIR@@" "${LOCALEDIR}" content "${content}")
- string(REPLACE "@@NO_PERL_CPAN_FALLBACKS@@" "" content "${content}")
+ string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}")
+ string(REPLACE "@NO_PERL_CPAN_FALLBACKS@" "" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/perl/build/lib/${file_path} ${content})
#test-lib.sh requires perl/build/lib to be the build directory of perl modules
endforeach()
@@ -1056,21 +1056,21 @@ set(wrapper_test_scripts
foreach(script ${wrapper_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
- string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
- string(REPLACE "@@PROG@@" "${script}${EXE_EXTENSION}" content "${content}")
+ string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+ string(REPLACE "@PROG@" "${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
foreach(script ${wrapper_test_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
- string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
- string(REPLACE "@@PROG@@" "t/helper/${script}${EXE_EXTENSION}" content "${content}")
+ string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+ string(REPLACE "@PROG@" "t/helper/${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
-string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
-string(REPLACE "@@PROG@@" "git-cvsserver" content "${content}")
+string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+string(REPLACE "@PROG@" "git-cvsserver" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})
#options for configuring test options
diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index 124f598bdc0..70ae7cb8e45 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -26,7 +26,7 @@
use File::Basename;
use Getopt::Long qw(:config require_order no_ignore_case);
-my $VERSION = '@@GIT_VERSION@@';
+my $VERSION = '@GIT_VERSION@';
my $log = GITCVS::log->new();
my $cfg;
diff --git a/git-instaweb.sh b/git-instaweb.sh
index 8dbe21d5887..c8efb1205a8 100755
--- a/git-instaweb.sh
+++ b/git-instaweb.sh
@@ -3,7 +3,7 @@
# Copyright (c) 2006 Eric Wong
#
-PERL='@@PERL@@'
+PERL='@PERL@'
OPTIONS_KEEPDASHDASH=
OPTIONS_STUCKLONG=
OPTIONS_SPEC="\
@@ -38,8 +38,8 @@ conf="$GIT_DIR/gitweb/httpd.conf"
# if installed, it doesn't need further configuration (module_path)
test -z "$httpd" && httpd='lighttpd -f'
-# Default is @@GITWEBDIR@@
-test -z "$root" && root='@@GITWEBDIR@@'
+# Default is @GITWEBDIR@
+test -z "$root" && root='@GITWEBDIR@'
# any untaken local port will do...
test -z "$port" && port=1234
@@ -716,7 +716,7 @@ EOF
gitweb_conf() {
cat > "$fqgitdir/gitweb/gitweb_config.perl" <<EOF
-#!@@PERL@@
+#!@PERL@
our \$projectroot = "$(dirname "$fqgitdir")";
our \$git_temp = "$fqgitdir/gitweb/tmp";
our \$projects_list = \$projectroot;
diff --git a/git-request-pull.sh b/git-request-pull.sh
index 01640a044bb..10c88639e28 100755
--- a/git-request-pull.sh
+++ b/git-request-pull.sh
@@ -112,7 +112,7 @@ find_matching_ref='
}
'
-set fnord $(git ls-remote "$url" | @@PERL@@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
+set fnord $(git ls-remote "$url" | @PERL@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
remote_sha1=$2
ref=$3
diff --git a/git-send-email.perl b/git-send-email.perl
index c835d4c11af..02805c43e52 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1501,7 +1501,7 @@ sub gen_header {
@recipients = unique_email_list(@recipients,@cc,@initial_bcc);
@recipients = (map { extract_valid_address_or_die($_) } @recipients);
my $date = format_2822_time($time++);
- my $gitversion = '@@GIT_VERSION@@';
+ my $gitversion = '@GIT_VERSION@';
if ($gitversion =~ m/..GIT_VERSION../) {
$gitversion = Git::version();
}
diff --git a/git-sh-i18n.sh b/git-sh-i18n.sh
index a15c0620db6..ae4b2d6ba9d 100644
--- a/git-sh-i18n.sh
+++ b/git-sh-i18n.sh
@@ -9,7 +9,7 @@ TEXTDOMAIN=git
export TEXTDOMAIN
if test -z "$GIT_TEXTDOMAINDIR"
then
- TEXTDOMAINDIR="@@LOCALEDIR@@"
+ TEXTDOMAINDIR="@LOCALEDIR@"
else
TEXTDOMAINDIR="$GIT_TEXTDOMAINDIR"
fi
@@ -17,9 +17,9 @@ export TEXTDOMAINDIR
# First decide what scheme to use...
GIT_INTERNAL_GETTEXT_SH_SCHEME=fallthrough
-if test -n "@@USE_GETTEXT_SCHEME@@"
+if test -n "@USE_GETTEXT_SCHEME@"
then
- GIT_INTERNAL_GETTEXT_SH_SCHEME="@@USE_GETTEXT_SCHEME@@"
+ GIT_INTERNAL_GETTEXT_SH_SCHEME="@USE_GETTEXT_SCHEME@"
elif test -n "$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS"
then
: no probing necessary
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index ce273fe0e48..19aef72ec25 100644
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -41,7 +41,7 @@ git_broken_path_fix () {
esac
}
-# @@BROKEN_PATH_FIX@@
+# @BROKEN_PATH_FIX@
# Source git-sh-i18n for gettext support.
. "$(git --exec-path)/git-sh-i18n"
@@ -154,7 +154,7 @@ git_pager() {
else
GIT_PAGER=cat
fi
- for vardef in @@PAGER_ENV@@
+ for vardef in @PAGER_ENV@
do
var=${vardef%%=*}
eval ": \"\${$vardef}\" && export $var"
@@ -280,7 +280,7 @@ get_author_ident_from_commit () {
# remove lines from $1 that are not in $2, leaving only common lines.
create_virtual_base() {
sz0=$(wc -c <"$1")
- @@DIFF@@ -u -La/"$1" -Lb/"$1" "$1" "$2" | git apply --no-add
+ @DIFF@ -u -La/"$1" -Lb/"$1" "$1" "$2" | git apply --no-add
sz1=$(wc -c <"$1")
# If we do not have enough common material, it is not
diff --git a/git-svn.perl b/git-svn.perl
index 01e7a70de1c..dcf65cf1d1d 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -9,7 +9,7 @@
$_revision $_repository
$_q $_authors $_authors_prog %users/;
$AUTHOR = 'Eric Wong <normalperson@yhbt.net>';
-$VERSION = '@@GIT_VERSION@@';
+$VERSION = '@GIT_VERSION@';
use Carp qw/croak/;
use File::Basename qw/dirname basename/;
diff --git a/gitk-git/po/vi.po b/gitk-git/po/vi.po
index 59674986604..184430dcdee 100644
--- a/gitk-git/po/vi.po
+++ b/gitk-git/po/vi.po
@@ -5,7 +5,7 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: gitk @@GIT_VERSION@@\n"
+"Project-Id-Version: gitk @GIT_VERSION@\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-05-17 14:32+1000\n"
"PO-Revision-Date: 2015-09-15 07:33+0700\n"
diff --git a/gitweb/Makefile b/gitweb/Makefile
index 3b68ab2d672..164c8d53757 100644
--- a/gitweb/Makefile
+++ b/gitweb/Makefile
@@ -79,28 +79,28 @@ GITWEB_JSLIB_FILES += static/js/blame_incremental.js
GITWEB_REPLACE = \
- -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
- -e 's|++GIT_BINDIR++|$(bindir)|g' \
- -e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \
- -e 's|++GITWEB_CONFIG_SYSTEM++|$(GITWEB_CONFIG_SYSTEM)|g' \
- -e 's|++GITWEB_CONFIG_COMMON++|$(GITWEB_CONFIG_COMMON)|g' \
- -e 's|++GITWEB_HOME_LINK_STR++|$(GITWEB_HOME_LINK_STR)|g' \
- -e 's|++GITWEB_SITENAME++|$(GITWEB_SITENAME)|g' \
- -e 's|++GITWEB_PROJECTROOT++|$(GITWEB_PROJECTROOT)|g' \
- -e 's|"++GITWEB_PROJECT_MAXDEPTH++"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
- -e 's|++GITWEB_EXPORT_OK++|$(GITWEB_EXPORT_OK)|g' \
- -e 's|++GITWEB_STRICT_EXPORT++|$(GITWEB_STRICT_EXPORT)|g' \
- -e 's|++GITWEB_BASE_URL++|$(GITWEB_BASE_URL)|g' \
- -e 's|++GITWEB_LIST++|$(GITWEB_LIST)|g' \
- -e 's|++GITWEB_HOMETEXT++|$(GITWEB_HOMETEXT)|g' \
- -e 's|++GITWEB_CSS++|$(GITWEB_CSS)|g' \
- -e 's|++GITWEB_LOGO++|$(GITWEB_LOGO)|g' \
- -e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \
- -e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \
- -e 's|++GITWEB_SITE_HTML_HEAD_STRING++|$(GITWEB_SITE_HTML_HEAD_STRING)|g' \
- -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \
- -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \
- -e 's|++HIGHLIGHT_BIN++|$(HIGHLIGHT_BIN)|g'
+ -e 's|@GIT_VERSION@|$(GIT_VERSION)|g' \
+ -e 's|@GIT_BINDIR@|$(bindir)|g' \
+ -e 's|@GITWEB_CONFIG@|$(GITWEB_CONFIG)|g' \
+ -e 's|@GITWEB_CONFIG_SYSTEM@|$(GITWEB_CONFIG_SYSTEM)|g' \
+ -e 's|@GITWEB_CONFIG_COMMON@|$(GITWEB_CONFIG_COMMON)|g' \
+ -e 's|@GITWEB_HOME_LINK_STR@|$(GITWEB_HOME_LINK_STR)|g' \
+ -e 's|@GITWEB_SITENAME@|$(GITWEB_SITENAME)|g' \
+ -e 's|@GITWEB_PROJECTROOT@|$(GITWEB_PROJECTROOT)|g' \
+ -e 's|"@GITWEB_PROJECT_MAXDEPTH@"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
+ -e 's|@GITWEB_EXPORT_OK@|$(GITWEB_EXPORT_OK)|g' \
+ -e 's|@GITWEB_STRICT_EXPORT@|$(GITWEB_STRICT_EXPORT)|g' \
+ -e 's|@GITWEB_BASE_URL@|$(GITWEB_BASE_URL)|g' \
+ -e 's|@GITWEB_LIST@|$(GITWEB_LIST)|g' \
+ -e 's|@GITWEB_HOMETEXT@|$(GITWEB_HOMETEXT)|g' \
+ -e 's|@GITWEB_CSS@|$(GITWEB_CSS)|g' \
+ -e 's|@GITWEB_LOGO@|$(GITWEB_LOGO)|g' \
+ -e 's|@GITWEB_FAVICON@|$(GITWEB_FAVICON)|g' \
+ -e 's|@GITWEB_JS@|$(GITWEB_JS)|g' \
+ -e 's|@GITWEB_SITE_HTML_HEAD_STRING@|$(GITWEB_SITE_HTML_HEAD_STRING)|g' \
+ -e 's|@GITWEB_SITE_HEADER@|$(GITWEB_SITE_HEADER)|g' \
+ -e 's|@GITWEB_SITE_FOOTER@|$(GITWEB_SITE_FOOTER)|g' \
+ -e 's|@HIGHLIGHT_BIN@|$(HIGHLIGHT_BIN)|g'
.PHONY: FORCE
$(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS: FORCE
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index b09a8d05238..76e1f4e244f 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -35,7 +35,7 @@ BEGIN
CGI->compile() if $ENV{'MOD_PERL'};
}
-our $version = "++GIT_VERSION++";
+our $version = "@GIT_VERSION@";
our ($my_url, $my_uri, $base_url, $path_info, $home_link);
sub evaluate_uri {
@@ -80,46 +80,46 @@ sub evaluate_uri {
# core git executable to use
# this can just be "git" if your webserver has a sensible PATH
-our $GIT = "++GIT_BINDIR++/git";
+our $GIT = "@GIT_BINDIR@/git";
# absolute fs-path which will be prepended to the project path
#our $projectroot = "/pub/scm";
-our $projectroot = "++GITWEB_PROJECTROOT++";
+our $projectroot = "@GITWEB_PROJECTROOT@";
# fs traversing limit for getting project list
# the number is relative to the projectroot
-our $project_maxdepth = "++GITWEB_PROJECT_MAXDEPTH++";
+our $project_maxdepth = "@GITWEB_PROJECT_MAXDEPTH@";
# string of the home link on top of all pages
-our $home_link_str = "++GITWEB_HOME_LINK_STR++";
+our $home_link_str = "@GITWEB_HOME_LINK_STR@";
# extra breadcrumbs preceding the home link
our @extra_breadcrumbs = ();
# name of your site or organization to appear in page titles
# replace this with something more descriptive for clearer bookmarks
-our $site_name = "++GITWEB_SITENAME++"
+our $site_name = "@GITWEB_SITENAME@"
|| ($ENV{'SERVER_NAME'} || "Untitled") . " Git";
# html snippet to include in the <head> section of each page
-our $site_html_head_string = "++GITWEB_SITE_HTML_HEAD_STRING++";
+our $site_html_head_string = "@GITWEB_SITE_HTML_HEAD_STRING@";
# filename of html text to include at top of each page
-our $site_header = "++GITWEB_SITE_HEADER++";
+our $site_header = "@GITWEB_SITE_HEADER@";
# html text to include at home page
-our $home_text = "++GITWEB_HOMETEXT++";
+our $home_text = "@GITWEB_HOMETEXT@";
# filename of html text to include at bottom of each page
-our $site_footer = "++GITWEB_SITE_FOOTER++";
+our $site_footer = "@GITWEB_SITE_FOOTER@";
# URI of stylesheets
-our @stylesheets = ("++GITWEB_CSS++");
+our @stylesheets = ("@GITWEB_CSS@");
# URI of a single stylesheet, which can be overridden in GITWEB_CONFIG.
our $stylesheet = undef;
# URI of GIT logo (72x27 size)
-our $logo = "++GITWEB_LOGO++";
+our $logo = "@GITWEB_LOGO@";
# URI of GIT favicon, assumed to be image/png type
-our $favicon = "++GITWEB_FAVICON++";
+our $favicon = "@GITWEB_FAVICON@";
# URI of gitweb.js (JavaScript code for gitweb)
-our $javascript = "++GITWEB_JS++";
+our $javascript = "@GITWEB_JS@";
# URI and label (title) of GIT logo link
#our $logo_url = "https://www.kernel.org/pub/software/scm/git/docs/";
@@ -128,7 +128,7 @@ sub evaluate_uri {
our $logo_label = "git homepage";
# source of projects list
-our $projects_list = "++GITWEB_LIST++";
+our $projects_list = "@GITWEB_LIST@";
# the width (in characters) of the projects list "Description" column
our $projects_list_description_width = 25;
@@ -147,7 +147,7 @@ sub evaluate_uri {
# show repository only if this file exists
# (only effective if this variable evaluates to true)
-our $export_ok = "++GITWEB_EXPORT_OK++";
+our $export_ok = "@GITWEB_EXPORT_OK@";
# don't generate age column on the projects list page
our $omit_age_column = 0;
@@ -161,11 +161,11 @@ sub evaluate_uri {
our $export_auth_hook = undef;
# only allow viewing of repositories also shown on the overview page
-our $strict_export = "++GITWEB_STRICT_EXPORT++";
+our $strict_export = "@GITWEB_STRICT_EXPORT@";
# list of git base URLs used for URL to where fetch project from,
# i.e. full URL is "$git_base_url/$project"
-our @git_base_url_list = grep { $_ ne '' } ("++GITWEB_BASE_URL++");
+our @git_base_url_list = grep { $_ ne '' } ("@GITWEB_BASE_URL@");
# default blob_plain mimetype and default charset for text/plain blob
our $default_blob_plain_mimetype = 'text/plain';
@@ -200,7 +200,7 @@ sub evaluate_uri {
# http://andre-simon.de/zip/download.php due to assumptions about parameters and output).
# Useful if highlight is not installed on your webserver's PATH.
# [Default: highlight]
-our $highlight_bin = "++HIGHLIGHT_BIN++";
+our $highlight_bin = "@HIGHLIGHT_BIN@";
# information about snapshot formats that gitweb is capable of serving
our %known_snapshot_formats = (
@@ -741,9 +741,9 @@ sub read_config_file {
our ($GITWEB_CONFIG, $GITWEB_CONFIG_SYSTEM, $GITWEB_CONFIG_COMMON);
sub evaluate_gitweb_config {
- our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "++GITWEB_CONFIG++";
- our $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || "++GITWEB_CONFIG_SYSTEM++";
- our $GITWEB_CONFIG_COMMON = $ENV{'GITWEB_CONFIG_COMMON'} || "++GITWEB_CONFIG_COMMON++";
+ our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "@GITWEB_CONFIG@";
+ our $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || "@GITWEB_CONFIG_SYSTEM@";
+ our $GITWEB_CONFIG_COMMON = $ENV{'GITWEB_CONFIG_COMMON'} || "@GITWEB_CONFIG_COMMON@";
# Protect against duplications of file names, to not read config twice.
# Only one of $GITWEB_CONFIG and $GITWEB_CONFIG_SYSTEM is used, so
diff --git a/perl/Git/I18N.pm b/perl/Git/I18N.pm
index 475e90a6df5..f8f0ca31254 100644
--- a/perl/Git/I18N.pm
+++ b/perl/Git/I18N.pm
@@ -20,14 +20,14 @@ BEGIN
# this "'@@' [...] '@@'" pattern.
use constant NO_GETTEXT_STR => '@@' . 'NO_GETTEXT' . '@@';
use constant NO_GETTEXT => (
- q[@@NO_GETTEXT@@] ne ''
+ q[@NO_GETTEXT@] ne ''
and
- q[@@NO_GETTEXT@@] ne NO_GETTEXT_STR
+ q[@NO_GETTEXT@] ne NO_GETTEXT_STR
);
sub __bootstrap_locale_messages {
our $TEXTDOMAIN = 'git';
- our $TEXTDOMAINDIR ||= $ENV{GIT_TEXTDOMAINDIR} || '@@LOCALEDIR@@';
+ our $TEXTDOMAINDIR ||= $ENV{GIT_TEXTDOMAINDIR} || '@LOCALEDIR@';
die "NO_GETTEXT=" . NO_GETTEXT_STR if NO_GETTEXT;
require POSIX;
diff --git a/perl/Git/LoadCPAN.pm b/perl/Git/LoadCPAN.pm
index 8c7fa805f97..6be99840f84 100644
--- a/perl/Git/LoadCPAN.pm
+++ b/perl/Git/LoadCPAN.pm
@@ -31,11 +31,11 @@ =head1 DESCRIPTION
# Makefile, and allows for detecting whether the module is loaded from
# perl/Git as opposed to perl/build/Git, which is useful for one-off
# testing without having Error.pm et al installed.
-use constant NO_PERL_CPAN_FALLBACKS_STR => '@@' . 'NO_PERL_CPAN_FALLBACKS' . '@@';
+use constant NO_PERL_CPAN_FALLBACKS_STR => '@' . 'NO_PERL_CPAN_FALLBACKS' . '@';
use constant NO_PERL_CPAN_FALLBACKS => (
- q[@@NO_PERL_CPAN_FALLBACKS@@] ne ''
+ q[@NO_PERL_CPAN_FALLBACKS@] ne ''
and
- q[@@NO_PERL_CPAN_FALLBACKS@@] ne NO_PERL_CPAN_FALLBACKS_STR
+ q[@NO_PERL_CPAN_FALLBACKS@] ne NO_PERL_CPAN_FALLBACKS_STR
);
sub import {
--git a/perl/header_templates/fixed_prefix.template.pl b/perl/header_templates/fixed_prefix.template.pl
index 857b4391a49..d571ca5cde5 100644
--- a/perl/header_templates/fixed_prefix.template.pl
+++ b/perl/header_templates/fixed_prefix.template.pl
@@ -1 +1 @@
-use lib (split(/@@PATHSEP@@/, $ENV{GITPERLLIB} || '@@INSTLIBDIR@@'));
+use lib (split(/@PATHSEP@/, $ENV{GITPERLLIB} || '@INSTLIBDIR@'));
diff --git a/perl/header_templates/runtime_prefix.template.pl b/perl/header_templates/runtime_prefix.template.pl
index 9d28b3d8636..e6f8e661a16 100644
--- a/perl/header_templates/runtime_prefix.template.pl
+++ b/perl/header_templates/runtime_prefix.template.pl
@@ -3,7 +3,7 @@
# This finds our Git::* libraries relative to the script's runtime path.
sub __git_system_path {
my ($relpath) = @_;
- my $gitexecdir_relative = '@@GITEXECDIR_REL@@';
+ my $gitexecdir_relative = '@GITEXECDIR_REL@';
# GIT_EXEC_PATH is supplied by `git` or the test suite.
my $exec_path;
@@ -24,11 +24,11 @@ sub __git_system_path {
}
BEGIN {
- use lib split /@@PATHSEP@@/,
+ use lib split /@PATHSEP@/,
(
$ENV{GITPERLLIB} ||
do {
- my $perllibdir = __git_system_path('@@PERLLIBDIR_REL@@');
+ my $perllibdir = __git_system_path('@PERLLIBDIR_REL@');
(-e $perllibdir) || die("Invalid system path ($relpath): $path");
$perllibdir;
}
@@ -36,7 +36,7 @@ BEGIN
# Export the system locale directory to the I18N module. The locale directory
# is only installed if NO_GETTEXT is set.
- $Git::I18N::TEXTDOMAINDIR = __git_system_path('@@LOCALEDIR_REL@@');
+ $Git::I18N::TEXTDOMAINDIR = __git_system_path('@LOCALEDIR_REL@');
}
# END RUNTIME_PREFIX generated code.
diff --git a/unimplemented.sh b/unimplemented.sh
index fee21d24e8a..41776b279d4 100644
--- a/unimplemented.sh
+++ b/unimplemented.sh
@@ -1,4 +1,4 @@
#!/bin/sh
-echo >&2 "fatal: git was built without support for $(basename $0) (@@REASON@@)."
+echo >&2 "fatal: git was built without support for $(basename $0) (@REASON@)."
exit 128
diff --git a/wrap-for-bin.sh b/wrap-for-bin.sh
index 95851b85b6b..7898a1c238d 100644
--- a/wrap-for-bin.sh
+++ b/wrap-for-bin.sh
@@ -4,33 +4,33 @@
# to run test suite against sandbox, but with only bindir-installed
# executables in PATH. The Makefile copies this into various
# files in bin-wrappers, substituting
-# @@BUILD_DIR@@ and @@PROG@@.
+# @BUILD_DIR@ and @PROG@.
-GIT_EXEC_PATH='@@BUILD_DIR@@'
+GIT_EXEC_PATH='@BUILD_DIR@'
if test -n "$NO_SET_GIT_TEMPLATE_DIR"
then
unset GIT_TEMPLATE_DIR
else
- GIT_TEMPLATE_DIR='@@BUILD_DIR@@/templates/blt'
+ GIT_TEMPLATE_DIR='@BUILD_DIR@/templates/blt'
export GIT_TEMPLATE_DIR
fi
-GITPERLLIB='@@BUILD_DIR@@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}"
-GIT_TEXTDOMAINDIR='@@BUILD_DIR@@/po/build/locale'
-PATH='@@BUILD_DIR@@/bin-wrappers:'"$PATH"
+GITPERLLIB='@BUILD_DIR@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}"
+GIT_TEXTDOMAINDIR='@BUILD_DIR@/po/build/locale'
+PATH='@BUILD_DIR@/bin-wrappers:'"$PATH"
export GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
case "$GIT_DEBUGGER" in
'')
- exec "${GIT_EXEC_PATH}/@@PROG@@" "$@"
+ exec "${GIT_EXEC_PATH}/@PROG@" "$@"
;;
1)
unset GIT_DEBUGGER
- exec gdb --args "${GIT_EXEC_PATH}/@@PROG@@" "$@"
+ exec gdb --args "${GIT_EXEC_PATH}/@PROG@" "$@"
;;
*)
GIT_DEBUGGER_ARGS="$GIT_DEBUGGER"
unset GIT_DEBUGGER
- exec ${GIT_DEBUGGER_ARGS} "${GIT_EXEC_PATH}/@@PROG@@" "$@"
+ exec ${GIT_DEBUGGER_ARGS} "${GIT_EXEC_PATH}/@PROG@" "$@"
;;
esac
--
2.47.0.229.g8f8d6eee53.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v5 03/19] Makefile: consistently use PERL_PATH
2024-11-11 15:30 ` [RFC PATCH v5 " Patrick Steinhardt
2024-11-11 15:30 ` [RFC PATCH v5 01/19] Makefile: use common template for GIT-BUILD-OPTIONS Patrick Steinhardt
2024-11-11 15:30 ` [RFC PATCH v5 02/19] Makefile: consistently use @PLACEHOLDER@ to substitute Patrick Steinhardt
@ 2024-11-11 15:30 ` Patrick Steinhardt
2024-11-11 15:30 ` [RFC PATCH v5 04/19] Makefile: extract script to massage Perl scripts Patrick Steinhardt
` (16 subsequent siblings)
19 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-11 15:30 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar
When injecting the Perl path into our scripts we sometimes use '@PERL@'
while we othertimes use '@PERL_PATH@'. Refactor the code use the latter
consistently, which makes it easier to reuse the same logic for multiple
scripts.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 2 +-
contrib/buildsystems/CMakeLists.txt | 2 +-
git-instaweb.sh | 4 ++--
git-request-pull.sh | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile
index 8a2b292e3d2..22ed53f39e7 100644
--- a/Makefile
+++ b/Makefile
@@ -2553,7 +2553,7 @@ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's/@USE_GETTEXT_SCHEME@/$(USE_GETTEXT_SCHEME)/g' \
-e $(BROKEN_PATH_FIX) \
-e 's|@GITWEBDIR@|$(gitwebdir_SQ)|g' \
- -e 's|@PERL@|$(PERL_PATH_SQ)|g' \
+ -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' \
-e 's|@PAGER_ENV@|$(PAGER_ENV_SQ)|g' \
$@.sh >$@+
endef
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index a41540458b7..608ad9714d4 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -842,7 +842,7 @@ foreach(script ${git_shell_scripts})
string(REPLACE "@NO_CURL@" "" content "${content}")
string(REPLACE "@USE_GETTEXT_SCHEME@" "" content "${content}")
string(REPLACE "# @BROKEN_PATH_FIX@" "" content "${content}")
- string(REPLACE "@PERL@" "${PERL_PATH}" content "${content}")
+ string(REPLACE "@PERL_PATH@" "${PERL_PATH}" content "${content}")
string(REPLACE "@PAGER_ENV@" "LESS=FRX LV=-c" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
endforeach()
diff --git a/git-instaweb.sh b/git-instaweb.sh
index c8efb1205a8..5ad50160bb0 100755
--- a/git-instaweb.sh
+++ b/git-instaweb.sh
@@ -3,7 +3,7 @@
# Copyright (c) 2006 Eric Wong
#
-PERL='@PERL@'
+PERL='@PERL_PATH@'
OPTIONS_KEEPDASHDASH=
OPTIONS_STUCKLONG=
OPTIONS_SPEC="\
@@ -716,7 +716,7 @@ EOF
gitweb_conf() {
cat > "$fqgitdir/gitweb/gitweb_config.perl" <<EOF
-#!@PERL@
+#!@PERL_PATH@
our \$projectroot = "$(dirname "$fqgitdir")";
our \$git_temp = "$fqgitdir/gitweb/tmp";
our \$projects_list = \$projectroot;
diff --git a/git-request-pull.sh b/git-request-pull.sh
index 10c88639e28..775ba8ea11a 100755
--- a/git-request-pull.sh
+++ b/git-request-pull.sh
@@ -112,7 +112,7 @@ find_matching_ref='
}
'
-set fnord $(git ls-remote "$url" | @PERL@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
+set fnord $(git ls-remote "$url" | @PERL_PATH@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
remote_sha1=$2
ref=$3
--
2.47.0.229.g8f8d6eee53.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v5 04/19] Makefile: extract script to massage Perl scripts
2024-11-11 15:30 ` [RFC PATCH v5 " Patrick Steinhardt
` (2 preceding siblings ...)
2024-11-11 15:30 ` [RFC PATCH v5 03/19] Makefile: consistently use PERL_PATH Patrick Steinhardt
@ 2024-11-11 15:30 ` Patrick Steinhardt
2024-11-11 15:30 ` [RFC PATCH v5 05/19] Makefile: use "generate-perl.sh" to massage Perl library Patrick Steinhardt
` (15 subsequent siblings)
19 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-11 15:30 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar
Extract the script to inject various build-time parameters into our Perl
scripts into a standalone script. This is done such that we can reuse it
in other build systems.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 12 ++----------
contrib/buildsystems/CMakeLists.txt | 21 ++++++++++++++++-----
generate-perl.sh | 26 ++++++++++++++++++++++++++
3 files changed, 44 insertions(+), 15 deletions(-)
create mode 100755 generate-perl.sh
diff --git a/Makefile b/Makefile
index 22ed53f39e7..e04a381e8f0 100644
--- a/Makefile
+++ b/Makefile
@@ -2604,16 +2604,8 @@ endif
PERL_DEFINES += $(gitexecdir) $(perllibdir) $(localedir)
-$(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
- $(QUIET_GEN) \
- sed -e '1{' \
- -e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \
- -e ' r GIT-PERL-HEADER' \
- -e ' G' \
- -e '}' \
- -e 's/@GIT_VERSION@/$(GIT_VERSION)/g' \
- $< >$@+ && \
- chmod +x $@+ && \
+$(SCRIPT_PERL_GEN): % : %.perl generate-perl.sh GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
+ $(QUIET_GEN)$(SHELL_PATH) generate-perl.sh ./GIT-BUILD-OPTIONS $(GIT_VERSION) GIT-PERL-HEADER "$<" "$@+" && \
mv $@+ $@
PERL_DEFINES := $(subst $(space),:,$(PERL_DEFINES))
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 608ad9714d4..2ae337c61b5 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -848,19 +848,30 @@ foreach(script ${git_shell_scripts})
endforeach()
#perl scripts
-parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" ".perl")
+parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" "")
#create perl header
file(STRINGS ${CMAKE_SOURCE_DIR}/perl/header_templates/fixed_prefix.template.pl perl_header )
string(REPLACE "@PATHSEP@" ":" perl_header "${perl_header}")
string(REPLACE "@INSTLIBDIR@" "${INSTLIBDIR}" perl_header "${perl_header}")
+file(WRITE ${CMAKE_BINARY_DIR}/PERL-HEADER ${perl_header})
foreach(script ${git_perl_scripts})
- file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.perl content NEWLINE_CONSUME)
- string(REPLACE "#!/usr/bin/perl" "#!/usr/bin/perl\n${perl_header}\n" content "${content}")
- string(REPLACE "@GIT_VERSION@" "${PROJECT_VERSION}" content "${content}")
- file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
+ string(REPLACE ".perl" "" perl_gen_path "${script}")
+
+ add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/${perl_gen_path}"
+ COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-perl.sh"
+ "${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS"
+ "${PROJECT_VERSION}"
+ "${CMAKE_BINARY_DIR}/PERL-HEADER"
+ "${CMAKE_SOURCE_DIR}/${script}"
+ "${CMAKE_BINARY_DIR}/${perl_gen_path}"
+ DEPENDS "${CMAKE_SOURCE_DIR}/generate-perl.sh"
+ "${CMAKE_SOURCE_DIR}/${script}"
+ VERBATIM)
+ list(APPEND perl_gen ${CMAKE_BINARY_DIR}/${perl_gen_path})
endforeach()
+add_custom_target(perl-gen ALL DEPENDS ${perl_gen})
#python script
file(STRINGS ${CMAKE_SOURCE_DIR}/git-p4.py content NEWLINE_CONSUME)
diff --git a/generate-perl.sh b/generate-perl.sh
new file mode 100755
index 00000000000..12e116b76e5
--- /dev/null
+++ b/generate-perl.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+set -e
+
+if test $# -ne 5
+then
+ echo "USAGE: $0 <GIT_BUILD_OPTIONS> <GIT_VERSION> <PERL_HEADER> <INPUT> <OUTPUT>" >&2
+ exit 1
+fi
+
+GIT_BUILD_OPTIONS="$1"
+GIT_VERSION="$2"
+PERL_HEADER="$3"
+INPUT="$4"
+OUTPUT="$5"
+
+. "$GIT_BUILD_OPTIONS"
+
+sed -e '1{' \
+ -e " s|#!.*perl|#!$PERL_PATH|" \
+ -e " r $PERL_HEADER" \
+ -e ' G' \
+ -e '}' \
+ -e "s/@GIT_VERSION@/$GIT_VERSION/g" \
+ "$INPUT" >"$OUTPUT"
+chmod a+x "$OUTPUT"
--
2.47.0.229.g8f8d6eee53.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v5 05/19] Makefile: use "generate-perl.sh" to massage Perl library
2024-11-11 15:30 ` [RFC PATCH v5 " Patrick Steinhardt
` (3 preceding siblings ...)
2024-11-11 15:30 ` [RFC PATCH v5 04/19] Makefile: extract script to massage Perl scripts Patrick Steinhardt
@ 2024-11-11 15:30 ` Patrick Steinhardt
2024-11-11 15:30 ` [RFC PATCH v5 06/19] Makefile: extract script to massage Shell scripts Patrick Steinhardt
` (14 subsequent siblings)
19 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-11 15:30 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar
Extend "generate-perl.sh" such that it knows to also massage the Perl
library files. There are two major differences:
- We do not read in the Perl header. This is handled by matching on
whether or not we have a Perl shebang.
- We substitute some more variables, which we read in via our
GIT-BUILD-OPTIONS.
Adapt both our Makefile and the CMake build instructions to use this.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-BUILD-OPTIONS.in | 2 ++
Makefile | 10 ++++------
contrib/buildsystems/CMakeLists.txt | 23 +++++++++--------------
generate-perl.sh | 14 ++++++++++++--
4 files changed, 27 insertions(+), 22 deletions(-)
diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in
index f0ca240493c..050432f9fc4 100644
--- a/GIT-BUILD-OPTIONS.in
+++ b/GIT-BUILD-OPTIONS.in
@@ -1,6 +1,8 @@
SHELL_PATH=@SHELL_PATH@
TEST_SHELL_PATH=@TEST_SHELL_PATH@
PERL_PATH=@PERL_PATH@
+PERL_LOCALEDIR=@PERL_LOCALEDIR@
+NO_PERL_CPAN_FALLBACKS=@NO_PERL_CPAN_FALLBACKS@
DIFF=@DIFF@
PYTHON_PATH=@PYTHON_PATH@
TAR=@TAR@
diff --git a/Makefile b/Makefile
index e04a381e8f0..fc13d5bb01c 100644
--- a/Makefile
+++ b/Makefile
@@ -3093,13 +3093,9 @@ endif
NO_PERL_CPAN_FALLBACKS_SQ = $(subst ','\'',$(NO_PERL_CPAN_FALLBACKS))
endif
-perl/build/lib/%.pm: perl/%.pm GIT-PERL-DEFINES
+perl/build/lib/%.pm: perl/%.pm generate-perl.sh GIT-BUILD-OPTIONS GIT-PERL-DEFINES
$(call mkdir_p_parent_template)
- $(QUIET_GEN) \
- sed -e 's|@LOCALEDIR@|$(perl_localedir_SQ)|g' \
- -e 's|@NO_GETTEXT@|$(NO_GETTEXT_SQ)|g' \
- -e 's|@NO_PERL_CPAN_FALLBACKS@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \
- < $< > $@
+ $(QUIET_GEN)$(SHELL_PATH) generate-perl.sh ./GIT-BUILD-OPTIONS $(GIT_VERSION) GIT-PERL-HEADER "$<" "$@"
perl/build/man/man3/Git.3pm: perl/Git.pm
$(call mkdir_p_parent_template)
@@ -3160,6 +3156,8 @@ GIT-BUILD-OPTIONS: FORCE
-e "s|@SHELL_PATH@|\'$(SHELL_PATH_SQ)\'|" \
-e "s|@TEST_SHELL_PATH@|\'$(TEST_SHELL_PATH_SQ)\'|" \
-e "s|@PERL_PATH@|\'$(PERL_PATH_SQ)\'|" \
+ -e "s|@PERL_LOCALEDIR@|\'$(perl_localedir_SQ)\'|" \
+ -e "s|@NO_PERL_CPAN_FALLBACKS@|\'$(NO_PERL_CPAN_FALLBACKS_SQ)\'|" \
-e "s|@DIFF@|\'$(DIFF)\'|" \
-e "s|@PYTHON_PATH@|\'$(PYTHON_PATH_SQ)\'|" \
-e "s|@TAR@|\'$(TAR)\'|" \
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 2ae337c61b5..97504c3d7e4 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -849,6 +849,9 @@ endforeach()
#perl scripts
parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" "")
+#perl modules
+file(GLOB_RECURSE perl_modules "${CMAKE_SOURCE_DIR}/perl/*.pm")
+list(TRANSFORM perl_modules REPLACE "${CMAKE_SOURCE_DIR}/" "")
#create perl header
file(STRINGS ${CMAKE_SOURCE_DIR}/perl/header_templates/fixed_prefix.template.pl perl_header )
@@ -856,9 +859,12 @@ string(REPLACE "@PATHSEP@" ":" perl_header "${perl_header}")
string(REPLACE "@INSTLIBDIR@" "${INSTLIBDIR}" perl_header "${perl_header}")
file(WRITE ${CMAKE_BINARY_DIR}/PERL-HEADER ${perl_header})
-foreach(script ${git_perl_scripts})
+foreach(script ${git_perl_scripts} ${perl_modules})
string(REPLACE ".perl" "" perl_gen_path "${script}")
+ get_filename_component(perl_gen_dir "${perl_gen_path}" DIRECTORY)
+ file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/${perl_gen_dir}")
+
add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/${perl_gen_path}"
COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-perl.sh"
"${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS"
@@ -878,19 +884,6 @@ file(STRINGS ${CMAKE_SOURCE_DIR}/git-p4.py content NEWLINE_CONSUME)
string(REPLACE "#!/usr/bin/env python" "#!/usr/bin/python" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/git-p4 ${content})
-#perl modules
-file(GLOB_RECURSE perl_modules "${CMAKE_SOURCE_DIR}/perl/*.pm")
-
-foreach(pm ${perl_modules})
- string(REPLACE "${CMAKE_SOURCE_DIR}/perl/" "" file_path ${pm})
- file(STRINGS ${pm} content NEWLINE_CONSUME)
- string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}")
- string(REPLACE "@NO_PERL_CPAN_FALLBACKS@" "" content "${content}")
- file(WRITE ${CMAKE_BINARY_DIR}/perl/build/lib/${file_path} ${content})
-#test-lib.sh requires perl/build/lib to be the build directory of perl modules
-endforeach()
-
-
#templates
file(GLOB templates "${CMAKE_SOURCE_DIR}/templates/*")
list(TRANSFORM templates REPLACE "${CMAKE_SOURCE_DIR}/templates/" "")
@@ -1132,6 +1125,8 @@ file(STRINGS ${CMAKE_SOURCE_DIR}/GIT-BUILD-OPTIONS.in git_build_options NEWLINE_
string(REPLACE "@SHELL_PATH@" "${SHELL_PATH}" git_build_options "${git_build_options}")
string(REPLACE "@TEST_SHELL_PATH@" "${TEST_SHELL_PATH}" git_build_options "${git_build_options}")
string(REPLACE "@PERL_PATH@" "${PERL_PATH}" git_build_options "${git_build_options}")
+string(REPLACE "@PERL_LOCALEDIR@" "${LOCALEDIR}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PERL_CPAN_FALLBACKS@" "" git_build_options "${git_build_options}")
string(REPLACE "@DIFF@" "${DIFF}" git_build_options "${git_build_options}")
string(REPLACE "@PYTHON_PATH@" "${PYTHON_PATH}" git_build_options "${git_build_options}")
string(REPLACE "@TAR@" "${TAR}" git_build_options "${git_build_options}")
diff --git a/generate-perl.sh b/generate-perl.sh
index 12e116b76e5..cfbff20f55b 100755
--- a/generate-perl.sh
+++ b/generate-perl.sh
@@ -17,10 +17,20 @@ OUTPUT="$5"
. "$GIT_BUILD_OPTIONS"
sed -e '1{' \
+ -e " /^#!.*perl/!b" \
-e " s|#!.*perl|#!$PERL_PATH|" \
-e " r $PERL_HEADER" \
-e ' G' \
-e '}' \
- -e "s/@GIT_VERSION@/$GIT_VERSION/g" \
+ -e "s|@GIT_VERSION@|$GIT_VERSION|g" \
+ -e "s|@LOCALEDIR@|$PERL_LOCALEDIR|g" \
+ -e "s|@NO_GETTEXT@|$NO_GETTEXT|g" \
+ -e "s|@NO_PERL_CPAN_FALLBACKS@|$NO_PERL_CPAN_FALLBACKS|g" \
"$INPUT" >"$OUTPUT"
-chmod a+x "$OUTPUT"
+
+case "$INPUT" in
+*.perl)
+ chmod a+x "$OUTPUT";;
+*)
+ ;;
+esac
--
2.47.0.229.g8f8d6eee53.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v5 06/19] Makefile: extract script to massage Shell scripts
2024-11-11 15:30 ` [RFC PATCH v5 " Patrick Steinhardt
` (4 preceding siblings ...)
2024-11-11 15:30 ` [RFC PATCH v5 05/19] Makefile: use "generate-perl.sh" to massage Perl library Patrick Steinhardt
@ 2024-11-11 15:30 ` Patrick Steinhardt
2024-11-11 15:30 ` [RFC PATCH v5 07/19] Makefile: extract script to generate gitweb.cgi Patrick Steinhardt
` (13 subsequent siblings)
19 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-11 15:30 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar
Same as in the preceding commits, extract a script that allows us to
unify how we massage shell scripts.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-BUILD-OPTIONS.in | 4 ++++
Makefile | 34 +++++++++--------------------
contrib/buildsystems/CMakeLists.txt | 31 ++++++++++++++++----------
generate-script.sh | 34 +++++++++++++++++++++++++++++
4 files changed, 68 insertions(+), 35 deletions(-)
create mode 100755 generate-script.sh
diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in
index 050432f9fc4..9b95a6b3eee 100644
--- a/GIT-BUILD-OPTIONS.in
+++ b/GIT-BUILD-OPTIONS.in
@@ -36,3 +36,7 @@ GIT_INTEROP_MAKE_OPTS=@GIT_INTEROP_MAKE_OPTS@
GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@
GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@
RUNTIME_PREFIX=@RUNTIME_PREFIX@
+GITWEBDIR=@GITWEBDIR@
+USE_GETTEXT_SCHEME=@USE_GETTEXT_SCHEME@
+LOCALEDIR=@LOCALEDIR@
+BROKEN_PATH_FIX=@BROKEN_PATH_FIX@
diff --git a/Makefile b/Makefile
index fc13d5bb01c..2afad000762 100644
--- a/Makefile
+++ b/Makefile
@@ -1555,10 +1555,10 @@ endif
ifdef SANE_TOOL_PATH
SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH))
-BROKEN_PATH_FIX = 's|^\# @BROKEN_PATH_FIX@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|'
+BROKEN_PATH_FIX = s|^\# @BROKEN_PATH_FIX@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|
PATH := $(SANE_TOOL_PATH):${PATH}
else
-BROKEN_PATH_FIX = '/^\# @BROKEN_PATH_FIX@$$/d'
+BROKEN_PATH_FIX = /^\# @BROKEN_PATH_FIX@$$/d
endif
ifeq (,$(HOST_CPU))
@@ -2545,26 +2545,8 @@ GIT-SCRIPT-DEFINES: FORCE
echo "$$FLAGS" >$@; \
fi
-define cmd_munge_script
-sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
- -e 's|@DIFF@|$(DIFF_SQ)|' \
- -e 's|@LOCALEDIR@|$(localedir_SQ)|g' \
- -e 's/@USE_GETTEXT_SCHEME@/$(USE_GETTEXT_SCHEME)/g' \
- -e $(BROKEN_PATH_FIX) \
- -e 's|@GITWEBDIR@|$(gitwebdir_SQ)|g' \
- -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' \
- -e 's|@PAGER_ENV@|$(PAGER_ENV_SQ)|g' \
- $@.sh >$@+
-endef
-
-$(SCRIPT_SH_GEN) : % : %.sh GIT-SCRIPT-DEFINES
- $(QUIET_GEN)$(cmd_munge_script) && \
- chmod +x $@+ && \
- mv $@+ $@
-
-$(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEFINES
- $(QUIET_GEN)$(cmd_munge_script) && \
+$(SCRIPT_SH_GEN) $(SCRIPT_LIB) : % : %.sh generate-script.sh GIT-BUILD-OPTIONS GIT-SCRIPT-DEFINES
+ $(QUIET_GEN)./generate-script.sh "$<" "$@+" ./GIT-BUILD-OPTIONS && \
mv $@+ $@
git.res: git.rc GIT-VERSION-FILE GIT-PREFIX
@@ -2633,8 +2615,8 @@ GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile
perllibdir:
@echo '$(perllibdir_SQ)'
-git-instaweb: git-instaweb.sh GIT-SCRIPT-DEFINES
- $(QUIET_GEN)$(cmd_munge_script) && \
+git-instaweb: git-instaweb.sh generate-script.sh GIT-BUILD-OPTIONS GIT-SCRIPT-DEFINES
+ $(QUIET_GEN)./generate-script.sh "$<" "$@+" ./GIT-BUILD-OPTIONS && \
chmod +x $@+ && \
mv $@+ $@
else # NO_PERL
@@ -3191,6 +3173,10 @@ GIT-BUILD-OPTIONS: FORCE
-e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \
-e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \
-e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX)\'|" \
+ -e "s|@GITWEBDIR@|\'$(gitwebdir_SQ)\'|" \
+ -e "s|@USE_GETTEXT_SCHEME@|\'$(USE_GETTEXT_SCHEME)\'|" \
+ -e "s|@LOCALEDIR@|\'$(localedir_SQ)\'|" \
+ -e "s|@BROKEN_PATH_FIX@|\'$(BROKEN_PATH_FIX)\'|" \
GIT-BUILD-OPTIONS.in >$@+
@if grep -q '^[A-Z][A-Z_]*=@.*@$$' $@+; then echo "Unsubstituted build options in $@" >&2 && exit 1; fi
@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 97504c3d7e4..d2ec6cfc78f 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -834,18 +834,23 @@ set(git_shell_scripts
${git_sh_scripts} ${git_shlib_scripts} git-instaweb)
foreach(script ${git_shell_scripts})
- file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.sh content NEWLINE_CONSUME)
- string(REPLACE "@SHELL_PATH@" "${SHELL_PATH}" content "${content}")
- string(REPLACE "@DIFF@" "diff" content "${content}")
- string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}")
- string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" content "${content}")
- string(REPLACE "@NO_CURL@" "" content "${content}")
- string(REPLACE "@USE_GETTEXT_SCHEME@" "" content "${content}")
- string(REPLACE "# @BROKEN_PATH_FIX@" "" content "${content}")
- string(REPLACE "@PERL_PATH@" "${PERL_PATH}" content "${content}")
- string(REPLACE "@PAGER_ENV@" "LESS=FRX LV=-c" content "${content}")
- file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
+ if ("${script}" IN_LIST git_sh_scripts)
+ string(REPLACE ".sh" "" shell_gen_path "${script}")
+ else()
+ set(shell_gen_path "${script}")
+ endif()
+
+ add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/${shell_gen_path}"
+ COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-script.sh"
+ "${CMAKE_SOURCE_DIR}/${script}.sh"
+ "${CMAKE_BINARY_DIR}/${shell_gen_path}"
+ "${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS"
+ DEPENDS "${CMAKE_SOURCE_DIR}/generate-script.sh"
+ "${CMAKE_SOURCE_DIR}/${script}.sh"
+ VERBATIM)
+ list(APPEND shell_gen ${CMAKE_BINARY_DIR}/${shell_gen_path})
endforeach()
+add_custom_target(shell-gen ALL DEPENDS ${shell_gen})
#perl scripts
parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" "")
@@ -1160,6 +1165,10 @@ string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_optio
string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}")
string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}")
string(REPLACE "@RUNTIME_PREFIX@" "${RUNTIME_PREFIX}" git_build_options "${git_build_options}")
+string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" git_build_options "${git_build_options}")
+string(REPLACE "@USE_GETTEXT_SCHEME@" "" git_build_options "${git_build_options}")
+string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" git_build_options "${git_build_options}")
+string(REPLACE "@BROKEN_PATH_FIX@" "" git_build_options "${git_build_options}")
if(USE_VCPKG)
string(APPEND git_build_options "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
endif()
diff --git a/generate-script.sh b/generate-script.sh
new file mode 100755
index 00000000000..d001e43d7bf
--- /dev/null
+++ b/generate-script.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+set -e
+
+if test $# -ne 3
+then
+ echo "USAGE: $0 <INPUT> <OUTPUT> <GIT-BUILD-OPTIONS>" >&2
+ exit 1
+fi
+
+INPUT="$1"
+OUTPUT="$2"
+BUILD_OPTIONS="$3"
+
+. "$BUILD_OPTIONS"
+
+sed -e "1s|#!.*/sh|#!$SHELL_PATH|" \
+ -e "s|@SHELL_PATH@|$SHELL_PATH|" \
+ -e "s|@DIFF@|$DIFF|" \
+ -e "s|@LOCALEDIR@|$LOCALEDIR|g" \
+ -e "s/@USE_GETTEXT_SCHEME@/$USE_GETTEXT_SCHEME/g" \
+ -e "$BROKEN_PATH_FIX" \
+ -e "s|@GITWEBDIR@|$GITWEBDIR|g" \
+ -e "s|@PERL_PATH@|$PERL_PATH|g" \
+ -e "s|@PAGER_ENV@|$PAGER_ENV|g" \
+ "$INPUT" >"$OUTPUT"
+
+case "$(basename "$INPUT")" in
+git-mergetool--lib.sh|git-sh-i18n.sh|git-sh-setup.sh)
+ ;;
+*)
+ chmod a+x "$OUTPUT"
+ ;;
+esac
--
2.47.0.229.g8f8d6eee53.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v5 07/19] Makefile: extract script to generate gitweb.cgi
2024-11-11 15:30 ` [RFC PATCH v5 " Patrick Steinhardt
` (5 preceding siblings ...)
2024-11-11 15:30 ` [RFC PATCH v5 06/19] Makefile: extract script to massage Shell scripts Patrick Steinhardt
@ 2024-11-11 15:30 ` Patrick Steinhardt
2024-11-11 15:30 ` [RFC PATCH v5 08/19] Makefile: refactor GIT-VERSION-GEN to be reusable Patrick Steinhardt
` (12 subsequent siblings)
19 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-11 15:30 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar
In order to generate "gitweb.cgi" we have to replace various different
placeholders. This is done ad-hoc and is thus not easily reusable across
different build systems.
Introduce a new GITWEB-BUILD-OPTIONS.in template that we populate at
configuration time with the expected options. This script is then used
as input for a new "generate-gitweb.sh" script that generates the final
"gitweb.cgi" file. While this requires us to repeat the options multiple
times, it is in line to how we generate other build options like our
GIT-BUILD-OPTIONS file.
While at it, refactor how we replace the GITWEB_PROJECT_MAXDEPTH. Even
though this variable is supposed to be an integer, the source file has
the value quoted. The quotes are eventually stripped via sed(1), which
replaces `"@GITWEB_PROJECT_MAXDEPTH@"` with the actual value, which is
rather nonsensical. This is made clearer by just dropping the quotes in
the source file.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
gitweb/GITWEB-BUILD-OPTIONS.in | 25 +++++++++++++++
gitweb/Makefile | 58 ++++++++++++++++------------------
gitweb/generate-gitweb.sh | 45 ++++++++++++++++++++++++++
gitweb/gitweb.perl | 2 +-
4 files changed, 99 insertions(+), 31 deletions(-)
create mode 100644 gitweb/GITWEB-BUILD-OPTIONS.in
create mode 100755 gitweb/generate-gitweb.sh
diff --git a/gitweb/GITWEB-BUILD-OPTIONS.in b/gitweb/GITWEB-BUILD-OPTIONS.in
new file mode 100644
index 00000000000..20a6487796f
--- /dev/null
+++ b/gitweb/GITWEB-BUILD-OPTIONS.in
@@ -0,0 +1,25 @@
+PERL_PATH=@PERL_PATH@
+JSMIN=@JSMIN@
+CSSMIN=@CSSMIN@
+GIT_VERSION=@GIT_VERSION@
+GIT_BINDIR=@GIT_BINDIR@
+GITWEB_CONFIG=@GITWEB_CONFIG@
+GITWEB_CONFIG_SYSTEM=@GITWEB_CONFIG_SYSTEM@
+GITWEB_CONFIG_COMMON=@GITWEB_CONFIG_COMMON@
+GITWEB_HOME_LINK_STR=@GITWEB_HOME_LINK_STR@
+GITWEB_SITENAME=@GITWEB_SITENAME@
+GITWEB_PROJECTROOT=@GITWEB_PROJECTROOT@
+GITWEB_PROJECT_MAXDEPTH=@GITWEB_PROJECT_MAXDEPTH@
+GITWEB_EXPORT_OK=@GITWEB_EXPORT_OK@
+GITWEB_STRICT_EXPORT=@GITWEB_STRICT_EXPORT@
+GITWEB_BASE_URL=@GITWEB_BASE_URL@
+GITWEB_LIST=@GITWEB_LIST@
+GITWEB_HOMETEXT=@GITWEB_HOMETEXT@
+GITWEB_CSS=@GITWEB_CSS@
+GITWEB_LOGO=@GITWEB_LOGO@
+GITWEB_FAVICON=@GITWEB_FAVICON@
+GITWEB_JS=@GITWEB_JS@
+GITWEB_SITE_HTML_HEAD_STRING=@GITWEB_SITE_HTML_HEAD_STRING@
+GITWEB_SITE_HEADER=@GITWEB_SITE_HEADER@
+GITWEB_SITE_FOOTER=@GITWEB_SITE_FOOTER@
+HIGHLIGHT_BIN=@HIGHLIGHT_BIN@
diff --git a/gitweb/Makefile b/gitweb/Makefile
index 164c8d53757..48c3958bc66 100644
--- a/gitweb/Makefile
+++ b/gitweb/Makefile
@@ -77,43 +77,41 @@ GITWEB_JSLIB_FILES += static/js/javascript-detection.js
GITWEB_JSLIB_FILES += static/js/adjust-timezone.js
GITWEB_JSLIB_FILES += static/js/blame_incremental.js
-
-GITWEB_REPLACE = \
- -e 's|@GIT_VERSION@|$(GIT_VERSION)|g' \
- -e 's|@GIT_BINDIR@|$(bindir)|g' \
- -e 's|@GITWEB_CONFIG@|$(GITWEB_CONFIG)|g' \
- -e 's|@GITWEB_CONFIG_SYSTEM@|$(GITWEB_CONFIG_SYSTEM)|g' \
- -e 's|@GITWEB_CONFIG_COMMON@|$(GITWEB_CONFIG_COMMON)|g' \
- -e 's|@GITWEB_HOME_LINK_STR@|$(GITWEB_HOME_LINK_STR)|g' \
- -e 's|@GITWEB_SITENAME@|$(GITWEB_SITENAME)|g' \
- -e 's|@GITWEB_PROJECTROOT@|$(GITWEB_PROJECTROOT)|g' \
- -e 's|"@GITWEB_PROJECT_MAXDEPTH@"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
- -e 's|@GITWEB_EXPORT_OK@|$(GITWEB_EXPORT_OK)|g' \
- -e 's|@GITWEB_STRICT_EXPORT@|$(GITWEB_STRICT_EXPORT)|g' \
- -e 's|@GITWEB_BASE_URL@|$(GITWEB_BASE_URL)|g' \
- -e 's|@GITWEB_LIST@|$(GITWEB_LIST)|g' \
- -e 's|@GITWEB_HOMETEXT@|$(GITWEB_HOMETEXT)|g' \
- -e 's|@GITWEB_CSS@|$(GITWEB_CSS)|g' \
- -e 's|@GITWEB_LOGO@|$(GITWEB_LOGO)|g' \
- -e 's|@GITWEB_FAVICON@|$(GITWEB_FAVICON)|g' \
- -e 's|@GITWEB_JS@|$(GITWEB_JS)|g' \
- -e 's|@GITWEB_SITE_HTML_HEAD_STRING@|$(GITWEB_SITE_HTML_HEAD_STRING)|g' \
- -e 's|@GITWEB_SITE_HEADER@|$(GITWEB_SITE_HEADER)|g' \
- -e 's|@GITWEB_SITE_FOOTER@|$(GITWEB_SITE_FOOTER)|g' \
- -e 's|@HIGHLIGHT_BIN@|$(HIGHLIGHT_BIN)|g'
-
.PHONY: FORCE
$(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS: FORCE
- @rm -f $@+
- @echo "x" '$(PERL_PATH_SQ)' $(GITWEB_REPLACE) "$(JSMIN)|$(CSSMIN)" >$@+
+ @sed -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|' \
+ -e 's|@JSMIN@|$(JSMIN)|' \
+ -e 's|@CSSMIN@|$(CSSMIN)|' \
+ -e 's|@GIT_VERSION@|$(GIT_VERSION)|' \
+ -e 's|@GIT_BINDIR@|$(bindir)|' \
+ -e 's|@GITWEB_CONFIG@|$(GITWEB_CONFIG)|' \
+ -e 's|@GITWEB_CONFIG_SYSTEM@|$(GITWEB_CONFIG_SYSTEM)|' \
+ -e 's|@GITWEB_CONFIG_COMMON@|$(GITWEB_CONFIG_COMMON)|' \
+ -e 's|@GITWEB_HOME_LINK_STR@|$(GITWEB_HOME_LINK_STR)|' \
+ -e 's|@GITWEB_SITENAME@|$(GITWEB_SITENAME)|' \
+ -e 's|@GITWEB_PROJECTROOT@|$(GITWEB_PROJECTROOT)|' \
+ -e 's|@GITWEB_PROJECT_MAXDEPTH@|$(GITWEB_PROJECT_MAXDEPTH)|' \
+ -e 's|@GITWEB_EXPORT_OK@|$(GITWEB_EXPORT_OK)|' \
+ -e 's|@GITWEB_STRICT_EXPORT@|$(GITWEB_STRICT_EXPORT)|' \
+ -e 's|@GITWEB_BASE_URL@|$(GITWEB_BASE_URL)|' \
+ -e 's|@GITWEB_LIST@|$(GITWEB_LIST)|' \
+ -e 's|@GITWEB_HOMETEXT@|$(GITWEB_HOMETEXT)|' \
+ -e 's|@GITWEB_CSS@|$(GITWEB_CSS)|' \
+ -e 's|@GITWEB_LOGO@|$(GITWEB_LOGO)|' \
+ -e 's|@GITWEB_FAVICON@|$(GITWEB_FAVICON)|' \
+ -e 's|@GITWEB_JS@|$(GITWEB_JS)|' \
+ -e 's|@GITWEB_SITE_HTML_HEAD_STRING@|$(GITWEB_SITE_HTML_HEAD_STRING)|' \
+ -e 's|@GITWEB_SITE_HEADER@|$(GITWEB_SITE_HEADER)|' \
+ -e 's|@GITWEB_SITE_FOOTER@|$(GITWEB_SITE_FOOTER)|' \
+ -e 's|@HIGHLIGHT_BIN@|$(HIGHLIGHT_BIN)|' \
+ $(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS.in >"$@+"
@cmp -s $@+ $@ && rm -f $@+ || mv -f $@+ $@
+$(MAK_DIR_GITWEB)gitweb.cgi: $(MAK_DIR_GITWEB)generate-gitweb.sh
$(MAK_DIR_GITWEB)gitweb.cgi: $(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS
$(MAK_DIR_GITWEB)gitweb.cgi: $(MAK_DIR_GITWEB)gitweb.perl
$(QUIET_GEN)$(RM) $@ $@+ && \
- sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
- $(GITWEB_REPLACE) $< >$@+ && \
- chmod +x $@+ && \
+ $(MAK_DIR_GITWEB)generate-gitweb.sh $(MAK_DIR_GITWEB)/GITWEB-BUILD-OPTIONS $< $@+ && \
mv $@+ $@
$(MAK_DIR_GITWEB)static/gitweb.js: $(addprefix $(MAK_DIR_GITWEB),$(GITWEB_JSLIB_FILES))
diff --git a/gitweb/generate-gitweb.sh b/gitweb/generate-gitweb.sh
new file mode 100755
index 00000000000..b47ea6e599e
--- /dev/null
+++ b/gitweb/generate-gitweb.sh
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+set -e
+
+if test $# -ne 3
+then
+ echo "USAGE: $0 <GITWEB-BUILD-OPTIONS> <INPUT> <OUTPUT>" >&2
+ exit 1
+fi
+
+GITWEB_BUILD_OPTIONS="$1"
+INPUT="$2"
+OUTPUT="$3"
+
+. "$GITWEB_BUILD_OPTIONS"
+
+sed -e "1s|#!/usr/bin/perl|#!$PERL_PATH|" \
+ -e "s|@PERL_PATH@|$PERL_PATH|" \
+ -e "s|@JSMIN@|$JSMIN|" \
+ -e "s|@CSSMIN@|$CSSMIN|" \
+ -e "s|@GIT_VERSION@|$GIT_VERSION|" \
+ -e "s|@GIT_BINDIR@|$GIT_BINDIR|" \
+ -e "s|@GITWEB_CONFIG@|$GITWEB_CONFIG|" \
+ -e "s|@GITWEB_CONFIG_SYSTEM@|$GITWEB_CONFIG_SYSTEM|" \
+ -e "s|@GITWEB_CONFIG_COMMON@|$GITWEB_CONFIG_COMMON|" \
+ -e "s|@GITWEB_HOME_LINK_STR@|$GITWEB_HOME_LINK_STR|" \
+ -e "s|@GITWEB_SITENAME@|$GITWEB_SITENAME|" \
+ -e "s|@GITWEB_PROJECTROOT@|$GITWEB_PROJECTROOT|" \
+ -e "s|@GITWEB_PROJECT_MAXDEPTH@|$GITWEB_PROJECT_MAXDEPTH|" \
+ -e "s|@GITWEB_EXPORT_OK@|$GITWEB_EXPORT_OK|" \
+ -e "s|@GITWEB_STRICT_EXPORT@|$GITWEB_STRICT_EXPORT|" \
+ -e "s|@GITWEB_BASE_URL@|$GITWEB_BASE_URL|" \
+ -e "s|@GITWEB_LIST@|$GITWEB_LIST|" \
+ -e "s|@GITWEB_HOMETEXT@|$GITWEB_HOMETEXT|" \
+ -e "s|@GITWEB_CSS@|$GITWEB_CSS|" \
+ -e "s|@GITWEB_LOGO@|$GITWEB_LOGO|" \
+ -e "s|@GITWEB_FAVICON@|$GITWEB_FAVICON|" \
+ -e "s|@GITWEB_JS@|$GITWEB_JS|" \
+ -e "s|@GITWEB_SITE_HTML_HEAD_STRING@|$GITWEB_SITE_HTML_HEAD_STRING|" \
+ -e "s|@GITWEB_SITE_HEADER@|$GITWEB_SITE_HEADER|" \
+ -e "s|@GITWEB_SITE_FOOTER@|$GITWEB_SITE_FOOTER|" \
+ -e "s|@HIGHLIGHT_BIN@|$HIGHLIGHT_BIN|" \
+ "$INPUT" >"$OUTPUT"
+
+chmod a+x "$OUTPUT"
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 76e1f4e244f..41bc64ec73f 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -88,7 +88,7 @@ sub evaluate_uri {
# fs traversing limit for getting project list
# the number is relative to the projectroot
-our $project_maxdepth = "@GITWEB_PROJECT_MAXDEPTH@";
+our $project_maxdepth = @GITWEB_PROJECT_MAXDEPTH@;
# string of the home link on top of all pages
our $home_link_str = "@GITWEB_HOME_LINK_STR@";
--
2.47.0.229.g8f8d6eee53.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v5 08/19] Makefile: refactor GIT-VERSION-GEN to be reusable
2024-11-11 15:30 ` [RFC PATCH v5 " Patrick Steinhardt
` (6 preceding siblings ...)
2024-11-11 15:30 ` [RFC PATCH v5 07/19] Makefile: extract script to generate gitweb.cgi Patrick Steinhardt
@ 2024-11-11 15:30 ` Patrick Steinhardt
2024-11-11 15:30 ` [RFC PATCH v5 09/19] Makefile: refactor generators to be PWD-independent Patrick Steinhardt
` (11 subsequent siblings)
19 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-11 15:30 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar
Our "GIT-VERSION-GEN" script always writes the "GIT-VERSION-FILE" into
the current directory, where the expectation is that it should exist in
the source directory. But other build systems that support out-of-tree
builds may not want to do that to keep the source directory pristine,
even though CMake currently doesn't care.
Refactor the script such that it doesn't write output to a file anymore
but so that it instead writes the version to stdout. This makes it
easier to compute the same version as our Makefile would without having
to write the "GIT-VERSION-FILE".
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-VERSION-GEN | 12 +-----------
Makefile | 3 ++-
contrib/buildsystems/CMakeLists.txt | 12 ++++--------
3 files changed, 7 insertions(+), 20 deletions(-)
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index 78e8631f677..671f853512a 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -1,6 +1,5 @@
#!/bin/sh
-GVF=GIT-VERSION-FILE
DEF_VER=v2.47.GIT
LF='
@@ -28,13 +27,4 @@ fi
VN=$(expr "$VN" : v*'\(.*\)')
-if test -r $GVF
-then
- VC=$(sed -e 's/^GIT_VERSION = //' <$GVF)
-else
- VC=unset
-fi
-test "$VN" = "$VC" || {
- echo >&2 "GIT_VERSION = $VN"
- echo "GIT_VERSION = $VN" >$GVF
-}
+echo "$VN"
diff --git a/Makefile b/Makefile
index 2afad000762..461f0216bf6 100644
--- a/Makefile
+++ b/Makefile
@@ -592,7 +592,8 @@ include shared.mak
# Disable -pedantic compilation.
GIT-VERSION-FILE: FORCE
- @$(SHELL_PATH) ./GIT-VERSION-GEN
+ @printf "GIT_VERSION = %s\n" $$($(SHELL_PATH) GIT-VERSION-GEN) >$@+
+ @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else cat $@+ >&2 && mv $@+ $@; fi
-include GIT-VERSION-FILE
# Set our default configuration.
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index d2ec6cfc78f..689b76578ad 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -83,16 +83,12 @@ if(NOT SH_EXE)
"On Windows, you can get it as part of 'Git for Windows' install at https://gitforwindows.org/")
endif()
-#Create GIT-VERSION-FILE using GIT-VERSION-GEN
-if(NOT EXISTS ${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE)
- message("Generating GIT-VERSION-FILE")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
-endif()
+execute_process(COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
+ WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
+ OUTPUT_VARIABLE git_version
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
#Parse GIT-VERSION-FILE to get the version
-file(STRINGS ${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE git_version REGEX "GIT_VERSION = (.*)")
-string(REPLACE "GIT_VERSION = " "" git_version ${git_version})
string(FIND ${git_version} "GIT" location)
if(location EQUAL -1)
string(REGEX MATCH "[0-9]*\\.[0-9]*\\.[0-9]*" git_version ${git_version})
--
2.47.0.229.g8f8d6eee53.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v5 09/19] Makefile: refactor generators to be PWD-independent
2024-11-11 15:30 ` [RFC PATCH v5 " Patrick Steinhardt
` (7 preceding siblings ...)
2024-11-11 15:30 ` [RFC PATCH v5 08/19] Makefile: refactor GIT-VERSION-GEN to be reusable Patrick Steinhardt
@ 2024-11-11 15:30 ` Patrick Steinhardt
2024-11-11 15:31 ` [RFC PATCH v5 10/19] Makefile: allow "bin-wrappers/" directory to exist Patrick Steinhardt
` (10 subsequent siblings)
19 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-11 15:30 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar
We have multiple scripts that generate headers from other data. All of
these scripts have the assumption built-in that they are executed in the
current source directory, which makes them a bit unwieldy to use during
out-of-tree builds.
Refactor them to instead take the source directory as well as the output
file as arguments.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 6 ++---
contrib/buildsystems/CMakeLists.txt | 19 ++++++-------
generate-cmdlist.sh | 42 ++++++++++++++++++-----------
generate-configlist.sh | 20 ++++++++++----
generate-hooklist.sh | 15 ++++++++++-
5 files changed, 68 insertions(+), 34 deletions(-)
diff --git a/Makefile b/Makefile
index 461f0216bf6..975c18dfb8f 100644
--- a/Makefile
+++ b/Makefile
@@ -2523,17 +2523,17 @@ $(BUILT_INS): git$X
config-list.h: generate-configlist.sh
config-list.h: Documentation/*config.txt Documentation/config/*.txt
- $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh >$@
+ $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh . $@
command-list.h: generate-cmdlist.sh command-list.txt
command-list.h: $(wildcard Documentation/git*.txt)
$(QUIET_GEN)$(SHELL_PATH) ./generate-cmdlist.sh \
$(patsubst %,--exclude-program %,$(EXCLUDED_PROGRAMS)) \
- command-list.txt >$@
+ . $@
hook-list.h: generate-hooklist.sh Documentation/githooks.txt
- $(QUIET_GEN)$(SHELL_PATH) ./generate-hooklist.sh >$@
+ $(QUIET_GEN)$(SHELL_PATH) ./generate-hooklist.sh . $@
SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):\
$(localedir_SQ):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 689b76578ad..73a3cbf5302 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -648,23 +648,24 @@ set(EXCLUSION_PROGS_CACHE ${EXCLUSION_PROGS} CACHE STRING "Programs not built" F
if(NOT EXISTS ${CMAKE_BINARY_DIR}/command-list.h OR NOT EXCLUSION_PROGS_CACHE STREQUAL EXCLUSION_PROGS)
list(REMOVE_ITEM EXCLUSION_PROGS empty)
message("Generating command-list.h")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-cmdlist.sh ${EXCLUSION_PROGS} command-list.txt
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_FILE ${CMAKE_BINARY_DIR}/command-list.h)
+ execute_process(COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-cmdlist.sh"
+ ${EXCLUSION_PROGS}
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_BINARY_DIR}/command-list.h")
endif()
if(NOT EXISTS ${CMAKE_BINARY_DIR}/config-list.h)
message("Generating config-list.h")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-configlist.sh
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_FILE ${CMAKE_BINARY_DIR}/config-list.h)
+ execute_process(COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-configlist.sh"
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_BINARY_DIR}/config-list.h")
endif()
if(NOT EXISTS ${CMAKE_BINARY_DIR}/hook-list.h)
message("Generating hook-list.h")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-hooklist.sh
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_FILE ${CMAKE_BINARY_DIR}/hook-list.h)
+ execute_process(COMMAND "${SH_EXE}" ${CMAKE_SOURCE_DIR}/generate-hooklist.sh
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_BINARY_DIR}/hook-list.h")
endif()
include_directories(${CMAKE_BINARY_DIR})
diff --git a/generate-cmdlist.sh b/generate-cmdlist.sh
index 205541e0f7f..b923a5aab80 100755
--- a/generate-cmdlist.sh
+++ b/generate-cmdlist.sh
@@ -64,7 +64,7 @@ define_category_names () {
print_command_list () {
echo "static struct cmdname_help command_list[] = {"
- echo "$1" |
+ echo "$2" |
while read cmd rest
do
synopsis=
@@ -76,7 +76,7 @@ print_command_list () {
break
;;
esac
- done <"Documentation/$cmd.txt"
+ done <"$1/Documentation/$cmd.txt"
printf '\t{ "%s", N_("%s"), 0' "$cmd" "$synopsis"
printf " | CAT_%s" $rest
@@ -93,18 +93,28 @@ do
shift
done
-commands="$(command_list "$1")"
-categories="$(category_list "$commands")"
+if test "$#" -ne 2
+then
+ die "USAGE: $0 <SOURCE_DIR> <OUTPUT>"
+fi
+
+SOURCE_DIR="$1"
+OUTPUT="$2"
+
+{
+ commands="$(command_list "$SOURCE_DIR"/command-list.txt)"
+ categories="$(category_list "$commands")"
-echo "/* Automatically generated by generate-cmdlist.sh */
-struct cmdname_help {
- const char *name;
- const char *help;
- uint32_t category;
-};
-"
-define_categories "$categories"
-echo
-define_category_names "$categories"
-echo
-print_command_list "$commands"
+ echo "/* Automatically generated by generate-cmdlist.sh */
+ struct cmdname_help {
+ const char *name;
+ const char *help;
+ uint32_t category;
+ };
+ "
+ define_categories "$categories"
+ echo
+ define_category_names "$categories"
+ echo
+ print_command_list "$SOURCE_DIR" "$commands"
+} >"$OUTPUT"
diff --git a/generate-configlist.sh b/generate-configlist.sh
index 8692fe5cf4d..512804a1ca1 100755
--- a/generate-configlist.sh
+++ b/generate-configlist.sh
@@ -1,13 +1,19 @@
#!/bin/sh
-echo "/* Automatically generated by generate-configlist.sh */"
-echo
+SOURCE_DIR="$1"
+OUTPUT="$2"
+
+if test -z "$SOURCE_DIR" || ! test -d "$SOURCE_DIR" || test -z "$OUTPUT"
+then
+ echo "USAGE: $0 <SOURCE_DIR> <OUTPUT>" >&2
+ exit 1
+fi
print_config_list () {
cat <<EOF
static const char *config_name_list[] = {
EOF
- grep -h '^[a-zA-Z].*\..*::$' Documentation/*config.txt Documentation/config/*.txt |
+ grep -h '^[a-zA-Z].*\..*::$' "$SOURCE_DIR"/Documentation/*config.txt "$SOURCE_DIR"/Documentation/config/*.txt |
sed '/deprecated/d; s/::$//; s/, */\n/g' |
sort |
sed 's/^.*$/ "&",/'
@@ -17,5 +23,9 @@ EOF
EOF
}
-echo
-print_config_list
+{
+ echo "/* Automatically generated by generate-configlist.sh */"
+ echo
+ echo
+ print_config_list
+} >"$OUTPUT"
diff --git a/generate-hooklist.sh b/generate-hooklist.sh
index 2f9f54eb545..0ff2a0b6fbd 100755
--- a/generate-hooklist.sh
+++ b/generate-hooklist.sh
@@ -2,6 +2,17 @@
#
# Usage: ./generate-hooklist.sh >hook-list.h
+SOURCE_DIR="$1"
+OUTPUT="$2"
+
+if test -z "$SOURCE_DIR" || ! test -d "$SOURCE_DIR" || test -z "$OUTPUT"
+then
+ echo "USAGE: $0 <SOURCE_DIR> <OUTPUT>" >&2
+ exit 1
+fi
+
+{
+
cat <<EOF
/* Automatically generated by generate-hooklist.sh */
@@ -11,10 +22,12 @@ EOF
sed -n \
-e '/^~~~~*$/ {x; s/^.*$/ "&",/; p;}' \
-e 'x' \
- <Documentation/githooks.txt |
+ <"$SOURCE_DIR"/Documentation/githooks.txt |
LC_ALL=C sort
cat <<EOF
NULL,
};
EOF
+
+} >"$OUTPUT"
--
2.47.0.229.g8f8d6eee53.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v5 10/19] Makefile: allow "bin-wrappers/" directory to exist
2024-11-11 15:30 ` [RFC PATCH v5 " Patrick Steinhardt
` (8 preceding siblings ...)
2024-11-11 15:30 ` [RFC PATCH v5 09/19] Makefile: refactor generators to be PWD-independent Patrick Steinhardt
@ 2024-11-11 15:31 ` Patrick Steinhardt
2024-11-11 15:31 ` [RFC PATCH v5 11/19] Makefile: simplify building of templates Patrick Steinhardt
` (9 subsequent siblings)
19 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-11 15:31 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar
The "bin-wrappers/" directory gets created by our build system and is
populated with one script for each of our binaries. There isn't anything
inherently wrong with the current layout, but it is somewhat hard to
adapt for out-of-tree build systems.
Adapt the layout such that our "bin-wrappers/" directory always exists
and contains our "wrap-for-bin.sh" script to make things a little bit
easier for subsequent steps.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
.gitignore | 1 -
Documentation/CodingGuidelines | 2 +-
Makefile | 6 +++---
bin-wrappers/.gitignore | 9 +++++++++
wrap-for-bin.sh => bin-wrappers/wrap-for-bin.sh | 0
contrib/buildsystems/CMakeLists.txt | 6 +++---
6 files changed, 16 insertions(+), 8 deletions(-)
create mode 100644 bin-wrappers/.gitignore
rename wrap-for-bin.sh => bin-wrappers/wrap-for-bin.sh (100%)
mode change 100644 => 100755
diff --git a/.gitignore b/.gitignore
index 6687bd6db4c..349673c55c9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,7 +12,6 @@
/GIT-TEST-SUITES
/GIT-USER-AGENT
/GIT-VERSION-FILE
-/bin-wrappers/
/git
/git-add
/git-am
diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
index 30fda4142ca..982b705f0d8 100644
--- a/Documentation/CodingGuidelines
+++ b/Documentation/CodingGuidelines
@@ -583,7 +583,7 @@ For C programs:
Run `GIT_DEBUGGER=1 ./bin-wrappers/git foo` to simply use gdb as is, or
run `GIT_DEBUGGER="<debugger> <debugger-args>" ./bin-wrappers/git foo` to
use your own debugger and arguments. Example: `GIT_DEBUGGER="ddd --gdb"
- ./bin-wrappers/git log` (See `wrap-for-bin.sh`.)
+ ./bin-wrappers/git log` (See `bin-wrappers/wrap-for-bin.sh`.)
- The primary data structure that a subsystem 'S' deals with is called
`struct S`. Functions that operate on `struct S` are named
diff --git a/Makefile b/Makefile
index 975c18dfb8f..c409a0e1b7d 100644
--- a/Makefile
+++ b/Makefile
@@ -3199,8 +3199,7 @@ test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $(
all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PROG)
-bin-wrappers/%: wrap-for-bin.sh
- $(call mkdir_p_parent_template)
+$(test_bindir_programs): bin-wrappers/%: bin-wrappers/wrap-for-bin.sh
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@BUILD_DIR@|$(shell pwd)|' \
-e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
@@ -3696,7 +3695,8 @@ clean: profile-clean coverage-clean cocciclean
$(RM) $(FUZZ_PROGRAMS)
$(RM) $(SP_OBJ)
$(RM) $(HCC)
- $(RM) -r bin-wrappers $(dep_dirs) $(compdb_dir) compile_commands.json
+ $(RM) -r $(dep_dirs) $(compdb_dir) compile_commands.json
+ $(RM) $(test_bindir_programs)
$(RM) -r po/build/
$(RM) *.pyc *.pyo */*.pyc */*.pyo $(GENERATED_H) $(ETAGS_TARGET) tags cscope*
$(RM) -r .dist-tmp-dir .doc-tmp-dir
diff --git a/bin-wrappers/.gitignore b/bin-wrappers/.gitignore
new file mode 100644
index 00000000000..1c6c90458b7
--- /dev/null
+++ b/bin-wrappers/.gitignore
@@ -0,0 +1,9 @@
+/git
+/git-cvsserver
+/git-receive-pack
+/git-shell
+/git-upload-archive
+/git-upload-pack
+/scalar
+/test-fake-ssh
+/test-tool
diff --git a/wrap-for-bin.sh b/bin-wrappers/wrap-for-bin.sh
old mode 100644
new mode 100755
similarity index 100%
rename from wrap-for-bin.sh
rename to bin-wrappers/wrap-for-bin.sh
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 73a3cbf5302..4f652927b1f 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -1061,20 +1061,20 @@ set(wrapper_test_scripts
foreach(script ${wrapper_scripts})
- file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
+ file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
string(REPLACE "@PROG@" "${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
foreach(script ${wrapper_test_scripts})
- file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
+ file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
string(REPLACE "@PROG@" "t/helper/${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
-file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
+file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
string(REPLACE "@PROG@" "git-cvsserver" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})
--
2.47.0.229.g8f8d6eee53.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v5 11/19] Makefile: simplify building of templates
2024-11-11 15:30 ` [RFC PATCH v5 " Patrick Steinhardt
` (9 preceding siblings ...)
2024-11-11 15:31 ` [RFC PATCH v5 10/19] Makefile: allow "bin-wrappers/" directory to exist Patrick Steinhardt
@ 2024-11-11 15:31 ` Patrick Steinhardt
2024-11-11 15:31 ` [RFC PATCH v5 12/19] Documentation: allow sourcing generated includes from separate dir Patrick Steinhardt
` (8 subsequent siblings)
19 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-11 15:31 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar
When we install Git we also install a set of default templates that both
git-init(1) and git-clone(1) populate into our build directories. The
way the pristine templates are laid out in our source directory is
somewhat weird though: instead of reconstructing the actual directory
hierarchy in "templates/", we represent directory separators with "--".
The only reason I could come up with for why we have this is the
"branches/" directory, which is supposed to be empty when installing it.
And as Git famously doesn't store empty directories at all we have to
work around this limitation.
Now the thing is that the "branches/" directory is a leftover to how
branches used to be stored in the dark ages. gitrepository-layout(5)
lists this directory as "slightly deprecated", which I would claim is a
strong understatement. I have never encountered anybody using it today
and would be surprised if it even works as expected. So having the "--"
hack in place for an item that is basically unused, unmaintained and
deprecated doesn't only feel unreasonable, but installing that entry by
default may also cause confusion for users that do not know what this is
supposed to be in the first place.
Remove this directory from our templates and, now that we do not require
the workaround anymore, restructure the templates to form a proper
hierarchy. This makes it way easier for build systems to install these
templates into place.
We should likely think about removing support for "branch/" altogether,
but that is outside of the scope of this patch series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
contrib/buildsystems/CMakeLists.txt | 34 ++++++----------
templates/Makefile | 39 ++++++++++++-------
templates/branches-- | 1 -
templates/{this--description => description} | 0
.../applypatch-msg.sample} | 0
.../commit-msg.sample} | 0
.../fsmonitor-watchman.sample} | 0
.../post-update.sample} | 0
.../pre-applypatch.sample} | 0
.../pre-commit.sample} | 0
.../pre-merge-commit.sample} | 0
.../pre-push.sample} | 0
.../pre-rebase.sample} | 0
.../pre-receive.sample} | 0
.../prepare-commit-msg.sample} | 0
.../push-to-checkout.sample} | 0
.../sendemail-validate.sample} | 0
.../update.sample} | 0
templates/{info--exclude => info/exclude} | 0
19 files changed, 37 insertions(+), 37 deletions(-)
delete mode 100644 templates/branches--
rename templates/{this--description => description} (100%)
rename templates/{hooks--applypatch-msg.sample => hooks/applypatch-msg.sample} (100%)
rename templates/{hooks--commit-msg.sample => hooks/commit-msg.sample} (100%)
rename templates/{hooks--fsmonitor-watchman.sample => hooks/fsmonitor-watchman.sample} (100%)
rename templates/{hooks--post-update.sample => hooks/post-update.sample} (100%)
rename templates/{hooks--pre-applypatch.sample => hooks/pre-applypatch.sample} (100%)
rename templates/{hooks--pre-commit.sample => hooks/pre-commit.sample} (100%)
rename templates/{hooks--pre-merge-commit.sample => hooks/pre-merge-commit.sample} (100%)
rename templates/{hooks--pre-push.sample => hooks/pre-push.sample} (100%)
rename templates/{hooks--pre-rebase.sample => hooks/pre-rebase.sample} (100%)
rename templates/{hooks--pre-receive.sample => hooks/pre-receive.sample} (100%)
rename templates/{hooks--prepare-commit-msg.sample => hooks/prepare-commit-msg.sample} (100%)
rename templates/{hooks--push-to-checkout.sample => hooks/push-to-checkout.sample} (100%)
rename templates/{hooks--sendemail-validate.sample => hooks/sendemail-validate.sample} (100%)
rename templates/{hooks--update.sample => hooks/update.sample} (100%)
rename templates/{info--exclude => info/exclude} (100%)
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 4f652927b1f..f63661c6b5d 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -106,8 +106,8 @@ project(git
#TODO Enable NLS on windows natively
#macros for parsing the Makefile for sources and scripts
-macro(parse_makefile_for_sources list_var regex)
- file(STRINGS ${CMAKE_SOURCE_DIR}/Makefile ${list_var} REGEX "^${regex} \\+=(.*)")
+macro(parse_makefile_for_sources list_var makefile regex)
+ file(STRINGS ${makefile} ${list_var} REGEX "^${regex} \\+=(.*)")
string(REPLACE "${regex} +=" "" ${list_var} ${${list_var}})
string(REPLACE "$(COMPAT_OBJS)" "" ${list_var} ${${list_var}}) #remove "$(COMPAT_OBJS)" This is only for libgit.
string(STRIP ${${list_var}} ${list_var}) #remove trailing/leading whitespaces
@@ -672,20 +672,20 @@ include_directories(${CMAKE_BINARY_DIR})
#build
#libgit
-parse_makefile_for_sources(libgit_SOURCES "LIB_OBJS")
+parse_makefile_for_sources(libgit_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "LIB_OBJS")
list(TRANSFORM libgit_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
list(TRANSFORM compat_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
add_library(libgit ${libgit_SOURCES} ${compat_SOURCES})
#libxdiff
-parse_makefile_for_sources(libxdiff_SOURCES "XDIFF_OBJS")
+parse_makefile_for_sources(libxdiff_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "XDIFF_OBJS")
list(TRANSFORM libxdiff_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
add_library(xdiff STATIC ${libxdiff_SOURCES})
#reftable
-parse_makefile_for_sources(reftable_SOURCES "REFTABLE_OBJS")
+parse_makefile_for_sources(reftable_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "REFTABLE_OBJS")
list(TRANSFORM reftable_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
add_library(reftable STATIC ${reftable_SOURCES})
@@ -749,7 +749,7 @@ elseif(UNIX)
endif()
#git
-parse_makefile_for_sources(git_SOURCES "BUILTIN_OBJS")
+parse_makefile_for_sources(git_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "BUILTIN_OBJS")
list(TRANSFORM git_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
add_executable(git ${CMAKE_SOURCE_DIR}/git.c ${git_SOURCES})
@@ -886,24 +886,14 @@ file(STRINGS ${CMAKE_SOURCE_DIR}/git-p4.py content NEWLINE_CONSUME)
string(REPLACE "#!/usr/bin/env python" "#!/usr/bin/python" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/git-p4 ${content})
-#templates
-file(GLOB templates "${CMAKE_SOURCE_DIR}/templates/*")
-list(TRANSFORM templates REPLACE "${CMAKE_SOURCE_DIR}/templates/" "")
-list(REMOVE_ITEM templates ".gitignore")
-list(REMOVE_ITEM templates "Makefile")
-list(REMOVE_ITEM templates "blt")# Prevents an error when reconfiguring for in source builds
-
-list(REMOVE_ITEM templates "branches--")
-file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/templates/blt/branches) #create branches
-
+#${CMAKE_SOURCE_DIR}/Makefile templates
+parse_makefile_for_sources(templates ${CMAKE_SOURCE_DIR}/templates/Makefile "TEMPLATES")
+string(REPLACE " " ";" templates ${templates})
#templates have @.*@ replacement so use configure_file instead
foreach(tm ${templates})
- string(REPLACE "--" "/" blt_tm ${tm})
- string(REPLACE "this" "" blt_tm ${blt_tm})# for this--
- configure_file(${CMAKE_SOURCE_DIR}/templates/${tm} ${CMAKE_BINARY_DIR}/templates/blt/${blt_tm} @ONLY)
+ configure_file(${CMAKE_SOURCE_DIR}/templates/${tm} ${CMAKE_BINARY_DIR}/templates/blt/${tm} @ONLY)
endforeach()
-
#translations
if(MSGFMT_EXE)
file(GLOB po_files "${CMAKE_SOURCE_DIR}/po/*.po")
@@ -977,7 +967,7 @@ add_executable(test-fake-ssh ${CMAKE_SOURCE_DIR}/t/helper/test-fake-ssh.c)
target_link_libraries(test-fake-ssh common-main)
#unit-tests
-parse_makefile_for_sources(unit-test_SOURCES "UNIT_TEST_OBJS")
+parse_makefile_for_sources(unit-test_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "UNIT_TEST_OBJS")
list(TRANSFORM unit-test_SOURCES REPLACE "\\$\\(UNIT_TEST_DIR\\)/" "${CMAKE_SOURCE_DIR}/t/unit-tests/")
add_library(unit-test-lib STATIC ${unit-test_SOURCES})
@@ -1035,7 +1025,7 @@ if(MSVC)
endif()
#test-tool
-parse_makefile_for_sources(test-tool_SOURCES "TEST_BUILTINS_OBJS")
+parse_makefile_for_sources(test-tool_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "TEST_BUILTINS_OBJS")
add_library(test-lib OBJECT ${CMAKE_SOURCE_DIR}/t/unit-tests/test-lib.c)
list(TRANSFORM test-tool_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/t/helper/")
diff --git a/templates/Makefile b/templates/Makefile
index 367ad00c24c..bd1e9e30c12 100644
--- a/templates/Makefile
+++ b/templates/Makefile
@@ -29,24 +29,35 @@ all: boilerplates.made custom
# in a file direc--tory--file in the source. They will be
# just copied to the destination.
-bpsrc = $(filter-out %~,$(wildcard *--*))
-boilerplates.made : $(bpsrc)
- $(QUIET)umask 022 && ls *--* 2>/dev/null | \
- while read boilerplate; \
+TEMPLATES =
+TEMPLATES += description
+TEMPLATES += hooks/applypatch-msg.sample
+TEMPLATES += hooks/commit-msg.sample
+TEMPLATES += hooks/fsmonitor-watchman.sample
+TEMPLATES += hooks/post-update.sample
+TEMPLATES += hooks/pre-applypatch.sample
+TEMPLATES += hooks/pre-commit.sample
+TEMPLATES += hooks/pre-merge-commit.sample
+TEMPLATES += hooks/prepare-commit-msg.sample
+TEMPLATES += hooks/pre-push.sample
+TEMPLATES += hooks/pre-rebase.sample
+TEMPLATES += hooks/pre-receive.sample
+TEMPLATES += hooks/push-to-checkout.sample
+TEMPLATES += hooks/sendemail-validate.sample
+TEMPLATES += hooks/update.sample
+TEMPLATES += info/exclude
+
+boilerplates.made: $(TEMPLATES)
+ $(QUIET)umask 022 && for template in $(TEMPLATES); \
do \
- case "$$boilerplate" in *~) continue ;; esac && \
- dst=`echo "$$boilerplate" | sed -e 's|^this|.|;s|--|/|g'` && \
- dir=`expr "$$dst" : '\(.*\)/'` && \
+ dir=$$(dirname "$$template") && \
mkdir -p blt/$$dir && \
- case "$$boilerplate" in \
- *--) continue;; \
- esac && \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
- -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' $$boilerplate > \
- blt/$$dst && \
- if test -x "$$boilerplate"; then rx=rx; else rx=r; fi && \
- chmod a+$$rx "blt/$$dst" || exit; \
+ -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' $$template > \
+ blt/$$template && \
+ if test -x "$$template"; then rx=rx; else rx=r; fi && \
+ chmod a+$$rx "blt/$$template" || exit; \
done && \
date >$@
diff --git a/templates/branches-- b/templates/branches--
deleted file mode 100644
index fae88709a63..00000000000
--- a/templates/branches--
+++ /dev/null
@@ -1 +0,0 @@
-: this is just to ensure the directory exists.
diff --git a/templates/this--description b/templates/description
similarity index 100%
rename from templates/this--description
rename to templates/description
diff --git a/templates/hooks--applypatch-msg.sample b/templates/hooks/applypatch-msg.sample
similarity index 100%
rename from templates/hooks--applypatch-msg.sample
rename to templates/hooks/applypatch-msg.sample
diff --git a/templates/hooks--commit-msg.sample b/templates/hooks/commit-msg.sample
similarity index 100%
rename from templates/hooks--commit-msg.sample
rename to templates/hooks/commit-msg.sample
diff --git a/templates/hooks--fsmonitor-watchman.sample b/templates/hooks/fsmonitor-watchman.sample
similarity index 100%
rename from templates/hooks--fsmonitor-watchman.sample
rename to templates/hooks/fsmonitor-watchman.sample
diff --git a/templates/hooks--post-update.sample b/templates/hooks/post-update.sample
similarity index 100%
rename from templates/hooks--post-update.sample
rename to templates/hooks/post-update.sample
diff --git a/templates/hooks--pre-applypatch.sample b/templates/hooks/pre-applypatch.sample
similarity index 100%
rename from templates/hooks--pre-applypatch.sample
rename to templates/hooks/pre-applypatch.sample
diff --git a/templates/hooks--pre-commit.sample b/templates/hooks/pre-commit.sample
similarity index 100%
rename from templates/hooks--pre-commit.sample
rename to templates/hooks/pre-commit.sample
diff --git a/templates/hooks--pre-merge-commit.sample b/templates/hooks/pre-merge-commit.sample
similarity index 100%
rename from templates/hooks--pre-merge-commit.sample
rename to templates/hooks/pre-merge-commit.sample
diff --git a/templates/hooks--pre-push.sample b/templates/hooks/pre-push.sample
similarity index 100%
rename from templates/hooks--pre-push.sample
rename to templates/hooks/pre-push.sample
diff --git a/templates/hooks--pre-rebase.sample b/templates/hooks/pre-rebase.sample
similarity index 100%
rename from templates/hooks--pre-rebase.sample
rename to templates/hooks/pre-rebase.sample
diff --git a/templates/hooks--pre-receive.sample b/templates/hooks/pre-receive.sample
similarity index 100%
rename from templates/hooks--pre-receive.sample
rename to templates/hooks/pre-receive.sample
diff --git a/templates/hooks--prepare-commit-msg.sample b/templates/hooks/prepare-commit-msg.sample
similarity index 100%
rename from templates/hooks--prepare-commit-msg.sample
rename to templates/hooks/prepare-commit-msg.sample
diff --git a/templates/hooks--push-to-checkout.sample b/templates/hooks/push-to-checkout.sample
similarity index 100%
rename from templates/hooks--push-to-checkout.sample
rename to templates/hooks/push-to-checkout.sample
diff --git a/templates/hooks--sendemail-validate.sample b/templates/hooks/sendemail-validate.sample
similarity index 100%
rename from templates/hooks--sendemail-validate.sample
rename to templates/hooks/sendemail-validate.sample
diff --git a/templates/hooks--update.sample b/templates/hooks/update.sample
similarity index 100%
rename from templates/hooks--update.sample
rename to templates/hooks/update.sample
diff --git a/templates/info--exclude b/templates/info/exclude
similarity index 100%
rename from templates/info--exclude
rename to templates/info/exclude
--
2.47.0.229.g8f8d6eee53.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v5 12/19] Documentation: allow sourcing generated includes from separate dir
2024-11-11 15:30 ` [RFC PATCH v5 " Patrick Steinhardt
` (10 preceding siblings ...)
2024-11-11 15:31 ` [RFC PATCH v5 11/19] Makefile: simplify building of templates Patrick Steinhardt
@ 2024-11-11 15:31 ` Patrick Steinhardt
2024-11-11 15:31 ` [RFC PATCH v5 13/19] Documentation: teach "cmd-list.perl" about out-of-tree builds Patrick Steinhardt
` (7 subsequent siblings)
19 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-11 15:31 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar
Our documentation uses "include::" directives to include parts that are
either reused across multiple documents or parts that we generate at
build time. Unfortunately, top-level includes are only ever resolved
relative to the base directory, which is typically the directory of the
including document. Most importantly, it is not possible to have either
asciidoc or asciidoctor search multiple directories.
It follows that both kinds of includes must live in the same directory.
This is of course a bummer for out-of-tree builds, because here the
dynamically-built includes live in the build directory whereas the
static includes live in the source directory.
Introduce a `build_dir` attribute and prepend it to all of our includes
for dynamically-built files. This attribute gets set to the build
directory and thus converts the include path to an absolute path, which
asciidoc and asciidoctor know how to resolve.
Note that this change also requires us to update "build-docdep.perl",
which tries to figure out included files such our Makefile can set up
proper build-time dependencies. This script simply scans through the
source files for any lines that match "^include::" and treats the
remainder of the line as included file path. But given that those may
now contain the "{build_dir}" variable we have to teach the script to
replace that attribute with the actual build directory.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Documentation/Makefile | 3 ++-
Documentation/build-docdep.perl | 2 ++
Documentation/config/diff.txt | 2 +-
Documentation/config/merge.txt | 2 +-
Documentation/git.txt | 24 ++++++++++++------------
5 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 0f55baa252f..75755ceec18 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -218,6 +218,7 @@ SHELL_PATH ?= $(SHELL)
# Shell quote;
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
+ASCIIDOC_EXTRA += -abuild_dir='$(shell pwd)'
ifdef DEFAULT_PAGER
DEFAULT_PAGER_SQ = $(subst ','\'',$(DEFAULT_PAGER))
ASCIIDOC_EXTRA += -a 'git-default-pager=$(DEFAULT_PAGER_SQ)'
@@ -283,7 +284,7 @@ docdep_prereqs = \
cmd-list.made $(cmds_txt)
doc.dep : $(docdep_prereqs) $(DOC_DEP_TXT) build-docdep.perl
- $(QUIET_GEN)$(PERL_PATH) ./build-docdep.perl >$@ $(QUIET_STDERR)
+ $(QUIET_GEN)$(PERL_PATH) ./build-docdep.perl "$(shell pwd)" >$@ $(QUIET_STDERR)
ifneq ($(MAKECMDGOALS),clean)
-include doc.dep
diff --git a/Documentation/build-docdep.perl b/Documentation/build-docdep.perl
index 1b3ac8fdd95..315efaa2fa2 100755
--- a/Documentation/build-docdep.perl
+++ b/Documentation/build-docdep.perl
@@ -1,5 +1,6 @@
#!/usr/bin/perl
+my ($build_dir) = @ARGV;
my %include = ();
my %included = ();
@@ -10,6 +11,7 @@
chomp;
s/^include::\s*//;
s/\[\]//;
+ s/{build_dir}/${build_dir}/;
$include{$text}{$_} = 1;
$included{$_} = 1;
}
diff --git a/Documentation/config/diff.txt b/Documentation/config/diff.txt
index 190bda17e51..9575af91fa5 100644
--- a/Documentation/config/diff.txt
+++ b/Documentation/config/diff.txt
@@ -206,7 +206,7 @@ diff.<driver>.cachetextconv::
Set this option to true to make the diff driver cache the text
conversion outputs. See linkgit:gitattributes[5] for details.
-include::../mergetools-diff.txt[]
+include::{build_dir}/mergetools-diff.txt[]
diff.indentHeuristic::
Set this option to `false` to disable the default heuristics
diff --git a/Documentation/config/merge.txt b/Documentation/config/merge.txt
index 8851b6cedef..82554d65a0a 100644
--- a/Documentation/config/merge.txt
+++ b/Documentation/config/merge.txt
@@ -101,7 +101,7 @@ merge.guitool::
Any other value is treated as a custom merge tool and requires that a
corresponding mergetool.<guitool>.cmd variable is defined.
-include::../mergetools-merge.txt[]
+include::{build_dir}/mergetools-merge.txt[]
merge.verbosity::
Controls the amount of output shown by the recursive merge
diff --git a/Documentation/git.txt b/Documentation/git.txt
index d15a8697625..44f0797ccff 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -245,17 +245,17 @@ ancillary user utilities.
Main porcelain commands
~~~~~~~~~~~~~~~~~~~~~~~
-include::cmds-mainporcelain.txt[]
+include::{build_dir}/cmds-mainporcelain.txt[]
Ancillary Commands
~~~~~~~~~~~~~~~~~~
Manipulators:
-include::cmds-ancillarymanipulators.txt[]
+include::{build_dir}/cmds-ancillarymanipulators.txt[]
Interrogators:
-include::cmds-ancillaryinterrogators.txt[]
+include::{build_dir}/cmds-ancillaryinterrogators.txt[]
Interacting with Others
@@ -264,7 +264,7 @@ Interacting with Others
These commands are to interact with foreign SCM and with other
people via patch over e-mail.
-include::cmds-foreignscminterface.txt[]
+include::{build_dir}/cmds-foreignscminterface.txt[]
Reset, restore and revert
~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -313,13 +313,13 @@ repositories.
Manipulation commands
~~~~~~~~~~~~~~~~~~~~~
-include::cmds-plumbingmanipulators.txt[]
+include::{build_dir}/cmds-plumbingmanipulators.txt[]
Interrogation commands
~~~~~~~~~~~~~~~~~~~~~~
-include::cmds-plumbinginterrogators.txt[]
+include::{build_dir}/cmds-plumbinginterrogators.txt[]
In general, the interrogate commands do not touch the files in
the working tree.
@@ -328,12 +328,12 @@ the working tree.
Syncing repositories
~~~~~~~~~~~~~~~~~~~~
-include::cmds-synchingrepositories.txt[]
+include::{build_dir}/cmds-synchingrepositories.txt[]
The following are helper commands used by the above; end users
typically do not use them directly.
-include::cmds-synchelpers.txt[]
+include::{build_dir}/cmds-synchelpers.txt[]
Internal helper commands
@@ -342,14 +342,14 @@ Internal helper commands
These are internal helper commands used by other commands; end
users typically do not use them directly.
-include::cmds-purehelpers.txt[]
+include::{build_dir}/cmds-purehelpers.txt[]
Guides
------
The following documentation pages are guides about Git concepts.
-include::cmds-guide.txt[]
+include::{build_dir}/cmds-guide.txt[]
Repository, command and file interfaces
---------------------------------------
@@ -358,7 +358,7 @@ This documentation discusses repository and command interfaces which
users are expected to interact with directly. See `--user-formats` in
linkgit:git-help[1] for more details on the criteria.
-include::cmds-userinterfaces.txt[]
+include::{build_dir}/cmds-userinterfaces.txt[]
File formats, protocols and other developer interfaces
------------------------------------------------------
@@ -367,7 +367,7 @@ This documentation discusses file formats, over-the-wire protocols and
other git developer interfaces. See `--developer-interfaces` in
linkgit:git-help[1].
-include::cmds-developerinterfaces.txt[]
+include::{build_dir}/cmds-developerinterfaces.txt[]
Configuration Mechanism
-----------------------
--
2.47.0.229.g8f8d6eee53.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v5 13/19] Documentation: teach "cmd-list.perl" about out-of-tree builds
2024-11-11 15:30 ` [RFC PATCH v5 " Patrick Steinhardt
` (11 preceding siblings ...)
2024-11-11 15:31 ` [RFC PATCH v5 12/19] Documentation: allow sourcing generated includes from separate dir Patrick Steinhardt
@ 2024-11-11 15:31 ` Patrick Steinhardt
2024-11-11 15:31 ` [RFC PATCH v5 14/19] Documentation: extract script to generate a list of mergetools Patrick Steinhardt
` (6 subsequent siblings)
19 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-11 15:31 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar
The "cmd-list.perl" script generates a list of commands that can be
included into our manpages. The script doesn't know about out-of-tree
builds and instead writes resulting files into the source directory.
Adapt it such that we can read data from the source directory and write
data into the build directory.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Documentation/Makefile | 2 +-
Documentation/cmd-list.perl | 23 ++++++++++++-----------
2 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 75755ceec18..2b9fd37ff70 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -306,7 +306,7 @@ cmds_txt = cmds-ancillaryinterrogators.txt \
$(cmds_txt): cmd-list.made
cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
- $(QUIET_GEN)$(PERL_PATH) ./cmd-list.perl ../command-list.txt $(cmds_txt) $(QUIET_STDERR) && \
+ $(QUIET_GEN)$(PERL_PATH) ./cmd-list.perl .. . $(cmds_txt) && \
date >$@
mergetools_txt = mergetools-diff.txt mergetools-merge.txt
diff --git a/Documentation/cmd-list.perl b/Documentation/cmd-list.perl
index 755a110bc48..e260a989774 100755
--- a/Documentation/cmd-list.perl
+++ b/Documentation/cmd-list.perl
@@ -3,12 +3,13 @@
use File::Compare qw(compare);
sub format_one {
- my ($out, $nameattr) = @_;
+ my ($source_dir, $out, $nameattr) = @_;
my ($name, $attr) = @$nameattr;
+ my ($path) = "$source_dir/Documentation/$name.txt";
my ($state, $description);
my $mansection;
$state = 0;
- open I, '<', "$name.txt" or die "No such file $name.txt";
+ open I, '<', "$path" or die "No such file $path.txt";
while (<I>) {
if (/^(?:git|scalar)[a-z0-9-]*\(([0-9])\)$/) {
$mansection = $1;
@@ -29,7 +30,7 @@ sub format_one {
}
close I;
if (!defined $description) {
- die "No description found in $name.txt";
+ die "No description found in $path.txt";
}
if (my ($verify_name, $text) = ($description =~ /^($name) - (.*)/)) {
print $out "linkgit:$name\[$mansection\]::\n\t";
@@ -43,9 +44,9 @@ sub format_one {
}
}
-my ($input, @categories) = @ARGV;
+my ($source_dir, $build_dir, @categories) = @ARGV;
-open IN, "<$input";
+open IN, "<$source_dir/command-list.txt";
while (<IN>) {
last if /^### command list/;
}
@@ -63,17 +64,17 @@ sub format_one {
for my $out (@categories) {
my ($cat) = $out =~ /^cmds-(.*)\.txt$/;
- open O, '>', "$out+" or die "Cannot open output file $out+";
+ my ($path) = "$build_dir/$out";
+ open O, '>', "$path+" or die "Cannot open output file $out+";
for (@{$cmds{$cat}}) {
- format_one(\*O, $_);
+ format_one($source_dir, \*O, $_);
}
close O;
- if (-f "$out" && compare("$out", "$out+") == 0) {
- unlink "$out+";
+ if (-f "$path" && compare("$path", "$path+") == 0) {
+ unlink "$path+";
}
else {
- print STDERR "$out\n";
- rename "$out+", "$out";
+ rename "$path+", "$path";
}
}
--
2.47.0.229.g8f8d6eee53.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v5 14/19] Documentation: extract script to generate a list of mergetools
2024-11-11 15:30 ` [RFC PATCH v5 " Patrick Steinhardt
` (12 preceding siblings ...)
2024-11-11 15:31 ` [RFC PATCH v5 13/19] Documentation: teach "cmd-list.perl" about out-of-tree builds Patrick Steinhardt
@ 2024-11-11 15:31 ` Patrick Steinhardt
2024-11-11 15:31 ` [RFC PATCH v5 15/19] t: better support for out-of-tree builds Patrick Steinhardt
` (5 subsequent siblings)
19 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-11 15:31 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar
We include the list of available mergetools into our manpages. Extract
the script that performs this logic such that we can reuse it in other
build systems.
While at it, refactor the Makefile targets such that we don't create
"mergetools-list.made" anymore. It shouldn't be necessary, as we can
instead have other targets depend on "mergetools-{diff,merge}.txt"
directly.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Documentation/Makefile | 22 ++++++++--------------
Documentation/generate-mergetool-list.sh | 17 +++++++++++++++++
2 files changed, 25 insertions(+), 14 deletions(-)
create mode 100755 Documentation/generate-mergetool-list.sh
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 2b9fd37ff70..e2ce98a751f 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -276,11 +276,13 @@ ifneq ($(filter-out lint-docs clean,$(MAKECMDGOALS)),)
-include ../GIT-VERSION-FILE
endif
+mergetools_txt = mergetools-diff.txt mergetools-merge.txt
+
#
# Determine "include::" file references in asciidoc files.
#
docdep_prereqs = \
- mergetools-list.made $(mergetools_txt) \
+ $(mergetools_txt) \
cmd-list.made $(cmds_txt)
doc.dep : $(docdep_prereqs) $(DOC_DEP_TXT) build-docdep.perl
@@ -309,19 +311,11 @@ cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
$(QUIET_GEN)$(PERL_PATH) ./cmd-list.perl .. . $(cmds_txt) && \
date >$@
-mergetools_txt = mergetools-diff.txt mergetools-merge.txt
-
-$(mergetools_txt): mergetools-list.made
-
-mergetools-list.made: ../git-mergetool--lib.sh $(wildcard ../mergetools/*)
- $(QUIET_GEN) \
- $(SHELL_PATH) -c 'MERGE_TOOLS_DIR=../mergetools && TOOL_MODE=diff && \
- . ../git-mergetool--lib.sh && \
- show_tool_names can_diff' | sed -e "s/\([a-z0-9]*\)/\`\1\`;;/" >mergetools-diff.txt && \
- $(SHELL_PATH) -c 'MERGE_TOOLS_DIR=../mergetools && TOOL_MODE=merge && \
- . ../git-mergetool--lib.sh && \
- show_tool_names can_merge' | sed -e "s/\([a-z0-9]*\)/\`\1\`;;/" >mergetools-merge.txt && \
- date >$@
+mergetools-%.txt: generate-mergetool-list.sh ../git-mergetool--lib.sh $(wildcard ../mergetools/*)
+mergetools-diff.txt:
+ $(QUIET_GEN)$(SHELL_PATH) ./generate-mergetool-list.sh .. diff $@
+mergetools-merge.txt:
+ $(QUIET_GEN)$(SHELL_PATH) ./generate-mergetool-list.sh .. merge $@
TRACK_ASCIIDOCFLAGS = $(subst ','\'',$(ASCIIDOC_COMMON):$(ASCIIDOC_HTML):$(ASCIIDOC_DOCBOOK))
diff --git a/Documentation/generate-mergetool-list.sh b/Documentation/generate-mergetool-list.sh
new file mode 100755
index 00000000000..696196fbcb8
--- /dev/null
+++ b/Documentation/generate-mergetool-list.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+if test "$#" -ne 3
+then
+ echo "USAGE: $0 <SOURCE_DIR> <MODE> <OUTPUT>" >&2
+ exit 1
+fi
+
+SOURCE_DIR="$1"
+TOOL_MODE="$2"
+OUTPUT="$3"
+MERGE_TOOLS_DIR="$SOURCE_DIR/mergetools"
+
+(
+ . "$SOURCE_DIR"/git-mergetool--lib.sh &&
+ show_tool_names can_$TOOL_MODE
+) | sed -e "s/\([a-z0-9]*\)/\`\1\`;;/" >"$OUTPUT"
--
2.47.0.229.g8f8d6eee53.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v5 15/19] t: better support for out-of-tree builds
2024-11-11 15:30 ` [RFC PATCH v5 " Patrick Steinhardt
` (13 preceding siblings ...)
2024-11-11 15:31 ` [RFC PATCH v5 14/19] Documentation: extract script to generate a list of mergetools Patrick Steinhardt
@ 2024-11-11 15:31 ` Patrick Steinhardt
2024-11-11 15:31 ` [RFC PATCH v5 16/19] t: allow overriding build dir Patrick Steinhardt
` (4 subsequent siblings)
19 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-11 15:31 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar
Our in-tree builds used by the Makefile use various different build
directories scattered around different locations. The paths to those
build directories have to be propagated to our tests such that they can
find the contained files. This is done via a mixture of hardcoded paths
in our test library and injected variables in our bin-wrappers or
"GIT-BUILD-OPTIONS".
The latter two mechanisms are preferable over using hardcoded paths. For
one, we have all paths which are subject to change stored in a small set
of central files instead of having the knowledge of build paths in many
files. And second, it allows build systems which build files elsewhere
to adapt those paths based on their own needs. This is especially nice
in the context of build systems that use out-of-tree builds like CMake
or Meson.
Remove hardcoded knowledge of build paths from our test library and move
it into our bin-wrappers and "GIT-BUILD-OPTIONS".
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-BUILD-OPTIONS.in | 5 +++++
Makefile | 9 +++++++++
bin-wrappers/wrap-for-bin.sh | 11 ++++++-----
contrib/buildsystems/CMakeLists.txt | 8 ++++++++
t/lib-gettext.sh | 4 ++--
t/t7609-mergetool--lib.sh | 2 +-
t/test-lib.sh | 6 +++---
7 files changed, 34 insertions(+), 11 deletions(-)
diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in
index 9b95a6b3eee..f651116102a 100644
--- a/GIT-BUILD-OPTIONS.in
+++ b/GIT-BUILD-OPTIONS.in
@@ -35,6 +35,11 @@ GIT_PERF_MAKE_COMMAND=@GIT_PERF_MAKE_COMMAND@
GIT_INTEROP_MAKE_OPTS=@GIT_INTEROP_MAKE_OPTS@
GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@
GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@
+GIT_TEST_TEXTDOMAINDIR=@GIT_TEST_TEXTDOMAINDIR@
+GIT_TEST_POPATH=@GIT_TEST_POPATH@
+GIT_TEST_TEMPLATE_DIR=@GIT_TEST_TEMPLATE_DIR@
+GIT_TEST_GITPERLLIB=@GIT_TEST_GITPERLLIB@
+GIT_TEST_MERGE_TOOLS_DIR=@GIT_TEST_MERGE_TOOLS_DIR@
RUNTIME_PREFIX=@RUNTIME_PREFIX@
GITWEBDIR=@GITWEBDIR@
USE_GETTEXT_SCHEME=@USE_GETTEXT_SCHEME@
diff --git a/Makefile b/Makefile
index c409a0e1b7d..1f0c3bc72ed 100644
--- a/Makefile
+++ b/Makefile
@@ -3173,6 +3173,11 @@ GIT-BUILD-OPTIONS: FORCE
-e "s|@GIT_INTEROP_MAKE_OPTS@|\'$(GIT_INTEROP_MAKE_OPTS)\'|" \
-e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \
-e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \
+ -e "s|@GIT_TEST_TEXTDOMAINDIR@|\'$(shell pwd)/po/build/locale\'|" \
+ -e "s|@GIT_TEST_POPATH@|\'$(shell pwd)/po\'|" \
+ -e "s|@GIT_TEST_TEMPLATE_DIR@|\'$(shell pwd)/templates/blt\'|" \
+ -e "s|@GIT_TEST_GITPERLLIB@|\'$(shell pwd)/perl/build/lib\'|" \
+ -e "s|@GIT_TEST_MERGE_TOOLS_DIR@|\'$(shell pwd)/mergetools\'|" \
-e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX)\'|" \
-e "s|@GITWEBDIR@|\'$(gitwebdir_SQ)\'|" \
-e "s|@USE_GETTEXT_SCHEME@|\'$(USE_GETTEXT_SCHEME)\'|" \
@@ -3202,6 +3207,10 @@ all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PR
$(test_bindir_programs): bin-wrappers/%: bin-wrappers/wrap-for-bin.sh
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@BUILD_DIR@|$(shell pwd)|' \
+ -e 's|@GIT_TEXTDOMAINDIR@|$(shell pwd)/po/build/locale|' \
+ -e 's|@GITPERLLIB@|$(shell pwd)/perl/build/lib|' \
+ -e 's|@MERGE_TOOLS_DIR@|$(shell pwd)/mergetools|' \
+ -e 's|@TEMPLATE_DIR@|$(shell pwd)/templates/blt|' \
-e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
chmod +x $@
diff --git a/bin-wrappers/wrap-for-bin.sh b/bin-wrappers/wrap-for-bin.sh
index 7898a1c238d..1d3a59a0081 100755
--- a/bin-wrappers/wrap-for-bin.sh
+++ b/bin-wrappers/wrap-for-bin.sh
@@ -4,21 +4,22 @@
# to run test suite against sandbox, but with only bindir-installed
# executables in PATH. The Makefile copies this into various
# files in bin-wrappers, substituting
-# @BUILD_DIR@ and @PROG@.
+# @BUILD_DIR@, @TEMPLATE_DIR@ and @PROG@.
GIT_EXEC_PATH='@BUILD_DIR@'
if test -n "$NO_SET_GIT_TEMPLATE_DIR"
then
unset GIT_TEMPLATE_DIR
else
- GIT_TEMPLATE_DIR='@BUILD_DIR@/templates/blt'
+ GIT_TEMPLATE_DIR='@TEMPLATE_DIR@'
export GIT_TEMPLATE_DIR
fi
-GITPERLLIB='@BUILD_DIR@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}"
-GIT_TEXTDOMAINDIR='@BUILD_DIR@/po/build/locale'
+MERGE_TOOLS_DIR='@MERGE_TOOLS_DIR@'
+GITPERLLIB='@GITPERLLIB@'"${GITPERLLIB:+:$GITPERLLIB}"
+GIT_TEXTDOMAINDIR='@GIT_TEXTDOMAINDIR@'
PATH='@BUILD_DIR@/bin-wrappers:'"$PATH"
-export GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
+export MERGE_TOOLS_DIR GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
case "$GIT_DEBUGGER" in
'')
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index f63661c6b5d..665f3638e9b 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -1066,6 +1066,9 @@ endforeach()
file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+string(REPLACE "@GIT_TEXTDOMAINDIR@" "${CMAKE_BINARY_DIR}/po/build/locale" content "${content}")
+string(REPLACE "@GITPERLLIB@" "${CMAKE_BINARY_DIR}/perl/build/lib" content "${content}")
+string(REPLACE "@MERGE_TOOLS_DIR@" "${CMAKE_SOURCE_DIR}/mergetools" content "${content}")
string(REPLACE "@PROG@" "git-cvsserver" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})
@@ -1151,6 +1154,11 @@ string(REPLACE "@GIT_PERF_MAKE_COMMAND@" "" git_build_options "${git_build_optio
string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_options}")
string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}")
string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_TEXTDOMAINDIR@" "${CMAKE_BINARY_DIR}/po/build/locale" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_POPATH@" "${CMAKE_BINARY_DIR}/po" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_TEMPLATE_DIR@" "${CMAKE_BINARY_DIR}/templates/blt" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_GITPERLLIB@" "${CMAKE_BINARY_DIR}/perl/build/lib" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_MERGE_TOOLS_DIR@" "${RUNTIME_PREFIX}" git_build_options "${git_build_options}")
string(REPLACE "@RUNTIME_PREFIX@" "${RUNTIME_PREFIX}" git_build_options "${git_build_options}")
string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" git_build_options "${git_build_options}")
string(REPLACE "@USE_GETTEXT_SCHEME@" "" git_build_options "${git_build_options}")
diff --git a/t/lib-gettext.sh b/t/lib-gettext.sh
index cc6bb2cdeaa..7a734c6973e 100644
--- a/t/lib-gettext.sh
+++ b/t/lib-gettext.sh
@@ -6,8 +6,8 @@
. ./test-lib.sh
-GIT_TEXTDOMAINDIR="$GIT_BUILD_DIR/po/build/locale"
-GIT_PO_PATH="$GIT_BUILD_DIR/po"
+GIT_TEXTDOMAINDIR="$GIT_TEST_TEXTDOMAINDIR"
+GIT_PO_PATH="$GIT_TEST_POPATH"
export GIT_TEXTDOMAINDIR GIT_PO_PATH
if test -n "$GIT_TEST_INSTALLED"
diff --git a/t/t7609-mergetool--lib.sh b/t/t7609-mergetool--lib.sh
index 8b1c3bd39f2..a9273ba58d7 100755
--- a/t/t7609-mergetool--lib.sh
+++ b/t/t7609-mergetool--lib.sh
@@ -8,7 +8,7 @@ TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'mergetool --tool=vimdiff creates the expected layout' '
- . "$GIT_BUILD_DIR"/mergetools/vimdiff &&
+ . "$GIT_TEST_MERGE_TOOLS_DIR"/vimdiff &&
run_unit_tests
'
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 4dd641baefe..677424ced06 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1478,7 +1478,7 @@ else # normal case, use ../bin-wrappers only unless $with_dashes:
PATH="$GIT_BUILD_DIR:$GIT_BUILD_DIR/t/helper:$PATH"
fi
fi
-GIT_TEMPLATE_DIR="$GIT_BUILD_DIR"/templates/blt
+GIT_TEMPLATE_DIR="$GIT_TEST_TEMPLATE_DIR"
GIT_CONFIG_NOSYSTEM=1
GIT_ATTR_NOSYSTEM=1
GIT_CEILING_DIRECTORIES="$TRASH_DIRECTORY/.."
@@ -1494,9 +1494,9 @@ then
fi
fi
-GITPERLLIB="$GIT_BUILD_DIR"/perl/build/lib
+GITPERLLIB="$GIT_TEST_GITPERLLIB"
export GITPERLLIB
-test -d "$GIT_BUILD_DIR"/templates/blt || {
+test -d "$GIT_TEMPLATE_DIR" || {
BAIL_OUT "You haven't built things yet, have you?"
}
--
2.47.0.229.g8f8d6eee53.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v5 16/19] t: allow overriding build dir
2024-11-11 15:30 ` [RFC PATCH v5 " Patrick Steinhardt
` (14 preceding siblings ...)
2024-11-11 15:31 ` [RFC PATCH v5 15/19] t: better support for out-of-tree builds Patrick Steinhardt
@ 2024-11-11 15:31 ` Patrick Steinhardt
2024-11-11 15:31 ` [RFC PATCH v5 17/19] Documentation: add comparison of build systems Patrick Steinhardt
` (3 subsequent siblings)
19 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-11 15:31 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar
Our "test-lib.sh" assumes that our build directory is the parent
directory of "t/". While true when using our Makefile, it's not when
using build systems that support out-of-tree builds.
In commit ee9e66e4e7 (cmake: avoid editing t/test-lib.sh, 2022-10-18),
we have introduce support for overriding the GIT_BUILD_DIR by creating
the file "$GIT_BUILD_DIR/GIT-BUILD-DIR" with its contents pointing to
the location of the build directory. The intent was to stop modifying
"t/test-lib.sh" with the CMake build systems while allowing out-of-tree
builds. But "$GIT_BUILD_DIR" is somewhat misleadingly named, as it in
fact points to the _source_ directory. So while that commit solved part
of the problem for out-of-tree builds, CMake still has to write files
into the source tree.
Solve the second part of the problem, namely not having to write any
data into the source directory at all, by also supporting an environment
variable that allows us to point to a different build directory. This
allows us to perform properly self-contained out-of-tree builds.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
t/test-lib.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 677424ced06..096af9be6b1 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -35,7 +35,7 @@ else
# needing to exist.
TEST_DIRECTORY=$(cd "$TEST_DIRECTORY" && pwd) || exit 1
fi
-GIT_BUILD_DIR="${TEST_DIRECTORY%/t}"
+GIT_BUILD_DIR="${GIT_BUILD_DIR:-${TEST_DIRECTORY%/t}}"
if test "$TEST_DIRECTORY" = "$GIT_BUILD_DIR"
then
echo "PANIC: Running in a $TEST_DIRECTORY that doesn't end in '/t'?" >&2
@@ -513,6 +513,7 @@ unset VISUAL EMAIL LANGUAGE $("$PERL_PATH" -e '
PERF_
CURL_VERBOSE
TRACE_CURL
+ BUILD_DIR
));
my @vars = grep(/^GIT_/ && !/^GIT_($ok)/o, @env);
print join("\n", @vars);
--
2.47.0.229.g8f8d6eee53.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v5 17/19] Documentation: add comparison of build systems
2024-11-11 15:30 ` [RFC PATCH v5 " Patrick Steinhardt
` (15 preceding siblings ...)
2024-11-11 15:31 ` [RFC PATCH v5 16/19] t: allow overriding build dir Patrick Steinhardt
@ 2024-11-11 15:31 ` Patrick Steinhardt
2024-11-11 15:31 ` [RFC PATCH v5 18/19] Introduce support for the Meson build system Patrick Steinhardt
` (2 subsequent siblings)
19 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-11 15:31 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar
We're contemplating whether to eventually replace our build systems with
a build system that is easier to use. Add a comparison of build systems
to our technical documentation as a baseline for discussion.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Documentation/Makefile | 1 +
Documentation/technical/build-systems.txt | 224 ++++++++++++++++++++++
2 files changed, 225 insertions(+)
create mode 100644 Documentation/technical/build-systems.txt
diff --git a/Documentation/Makefile b/Documentation/Makefile
index e2ce98a751f..e1527c6d442 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -111,6 +111,7 @@ TECH_DOCS += MyFirstObjectWalk
TECH_DOCS += SubmittingPatches
TECH_DOCS += ToolsForGit
TECH_DOCS += technical/bitmap-format
+TECH_DOCS += technical/build-systems
TECH_DOCS += technical/bundle-uri
TECH_DOCS += technical/hash-function-transition
TECH_DOCS += technical/long-running-process-protocol
diff --git a/Documentation/technical/build-systems.txt b/Documentation/technical/build-systems.txt
new file mode 100644
index 00000000000..d9dafb407c4
--- /dev/null
+++ b/Documentation/technical/build-systems.txt
@@ -0,0 +1,224 @@
+= Build Systems
+
+The build system is the primary way for both developers and system integrators
+to interact with the Git project. As such, being easy to use and extend for
+those who are not directly developing Git itself is just as important as other
+requirements we have on any potential build system.
+
+This document outlines the different requirements that we have for the build
+system and then compares available build systems using these criteria.
+
+== Requirements
+
+The following subsections present a list of requirements that we have for any
+potential build system. Sections are sorted by decreasing priority.
+
+=== Platform support
+
+The build system must have support for all of our platforms that we continually
+test against as outlined by our platform support policy. These platforms are:
+
+ - Linux
+ - Windows
+ - macOS
+
+Furthermore, the build system should have support for the following platforms
+that generally have somebody running test pipelines against regularly:
+
+ - AIX
+ - FreeBSD
+ - NetBSD
+ - NonStop
+ - OpenBSD
+
+The platforms which must be supported by the tool should be aligned with our
+[platform support policy](platform-support.txt).
+
+=== Auto-detection of supported features
+
+The build system must support auto-detection of features which are or aren't
+available on the current platform. Platform maintainers should not be required
+to manually configure the complete build.
+
+Auto-detection of the following items is considered to be important:
+
+ - Check for the existence of headers.
+ - Check for the existence of libraries.
+ - Check for the existence of exectuables.
+ - Check for the runtime behavior of specific functions.
+ - Check for specific link order requirements when multiple libraries are
+ involved.
+
+=== Ease of use
+
+The build system should be both easy to use and easy to extend. While this is
+naturally a subjective metric it is likely not controversial to say that some
+build systems are considerably harder to use than others.
+
+=== IDE support
+
+The build system should integrate with well-known IDEs. Well-known IDEs include:
+
+ - Microsoft Visual Studio
+ - Visual Studio Code
+ - Xcode
+
+There are four levels of support:
+
+ - Native integration into the IDE.
+ - Integration into the IDE via a plugin.
+ - Integration into the IDE via generating a project description with the build
+ system.
+ - No integration.
+
+Native integration is preferable, but integration via either a plugin or by
+generating a project description via the build system are considered feasible
+alternatives.
+
+Another important distinction is the level of integration. There are two
+features that one generally wants to have:
+
+ - Integration of build targets.
+ - Automatic setup of features like code completion with detected build
+ dependencies.
+
+The first bullet point is the bare minimum, but is not sufficient to be
+considered proper integration.
+
+=== Out-of-tree builds
+
+The build system should support out-of-tree builds. Out-of-tree builds allow a
+developer to configure multiple different build directories with different
+configuration, e.g. one "debug" build and one "release" build.
+
+=== Cross-platform builds
+
+The build system should support cross-platform builds, e.g. building for arm on
+an x86-64 host.
+
+=== Language support
+
+The following languages and toolchains are of relevance and should be supported
+by the build system:
+
+ - C: the primary compiled language used by Git, must be supported. Relevant
+ toolchains are GCC, Clang and MSVC.
+ - Rust: candidate as a second compiled lanugage, should be supported. Relevant
+ toolchains is the LLVM-based rustc.
+
+Built-in support for the respective languages is preferred over support that
+needs to be wired up manually to avoid unnecessary complexity. Native support
+includes the following features:
+
+ - Compiling objects.
+ - Dependency tracking.
+ - Detection of available features.
+ - Discovery of relevant toolchains.
+ - Linking libraries and executables.
+ - Templating placeholders in scripts.
+
+=== Test integration
+
+It should be possible to integrate tests into the build system such that it is
+possible to build and test Git within the build system. Features which are nice
+to have:
+
+ - Track build-time dependencies for respective tests. Unit tests have
+ different requirements than integration tests.
+ - Allow filtering of which tests to run.
+ - Allow running tests such that utilities like `test_pause` or `debug` work.
+
+== Comparison
+
+The following list of build systems are considered:
+
+- GNU Make
+- autoconf
+- CMake
+- Meson
+
+=== GNU Make
+
+- Platform support: ubitquitous on all platforms, but not well-integrated into Windows.
+- Auto-detection: no built-in support for auto-detection of features.
+- Ease of use: easy to use, but discovering available options is hard. Makefile
+ rules can quickly get out of hand once reaching a certain scope.
+- IDE support: execution of Makefile targets is supported by many IDEs
+- Out-of-tree builds: supported in theory, not wired up in practice.
+- Cross-platform builds: supported in theory, not wired up in practice.
+- Language support:
+ - C: Limited built-in support, many parts need to be wired up manually.
+ - Rust: No built-in support, needs to be wired up manually.
+- Test integration: partially supported, many parts need to be wired up
+ manually.
+
+=== autoconf
+
+- Platform support: ubiquitous on all platforms, but not well-integrated into Windows.
+- Auto-detection: supported.
+- Ease of use: easy to use, discovering available options is comparatively
+ easy. The autoconf syntax is prohibitively hard to extend though due to its
+ complex set of interacting files and the hard-to-understand M4 language.
+- IDE support: no integration into IDEs at generation time. The generated
+ Makefiles have the same level of support as GNU Make.
+- Out-of-tree builds: supported in theory, not wired up in practice.
+- Cross-platform builds: supported.
+- Language support:
+ - C: Limited built-in support, many parts need to be wired up manually.
+ - Rust: No built-in support, needs to be wired up manually.
+- Test integration: partially supported, many parts need to be wired up
+ manually.
+
+=== CMake
+
+- Platform support: not as extensive as GNU Make or autoconf, but all major
+ platforms are supported.
+ - AIX
+ - Cygwin
+ - FreeBSD
+ - Linux
+ - OpenBSD
+ - Solaris
+ - Windows
+ - macOS
+- Ease of use: easy to use, discovering available options is not always
+ trivial. The scripting language used by CMake is somewhat cumbersome to use,
+ but extending CMake build instructions is doable.
+- IDE support: natively integrated into Microsoft Visual Studio. Can generate
+ project descriptions for Xcode. An extension is available for Visual Studio
+ Code. Many other IDEs have plugins for CMake.
+- Out-of-tree builds: supported.
+- Cross-platform builds: supported.
+- Language support:
+ - C: Supported for GCC, Clang, MSVC and other toolchains.
+ - Rust: No built-in support, needs to be wired up manually.
+- Test integration: supported, even though test dependencies are a bit
+ cumbersome to use via "test fixtures". Interactive test runs are not
+ supported.
+
+=== Meson
+
+- Platform: not as extensive as GNU Make or autoconf, but all major platforms
+ and some smaller ones are supported.
+ - AIX
+ - Cygwin
+ - DragonflyBSD
+ - FreeBSD
+ - Haiku
+ - Linux
+ - NetBSD
+ - OpenBSD
+ - Solaris
+ - Windows
+ - macOS
+- Ease of use: easy to use, discovering available options is easy. The
+ scripting language is straight-forward to use.
+- IDE support: Supports generating build instructions for Xcode and Microsoft
+ Visual Studio, a plugin exists for Visual Studio Code.
+- Out-of-tree builds: supported.
+- Cross-platform builds: supported.
+- Language support:
+ - C: Supported for GCC, Clang, MSVC and other toolchains.
+ - Rust: Supported for rustc.
+- Test integration: supported. Interactive tests are supported starting with
+ Meson 1.5.0 via the `--interactive` flag.
--
2.47.0.229.g8f8d6eee53.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v5 18/19] Introduce support for the Meson build system
2024-11-11 15:30 ` [RFC PATCH v5 " Patrick Steinhardt
` (16 preceding siblings ...)
2024-11-11 15:31 ` [RFC PATCH v5 17/19] Documentation: add comparison of build systems Patrick Steinhardt
@ 2024-11-11 15:31 ` Patrick Steinhardt
2024-11-11 15:31 ` [RFC PATCH v5 19/19] meson: fix conflicts with in-flight topics Patrick Steinhardt
2024-11-13 3:10 ` [RFC PATCH v5 00/19] Modernize the build system Ramsay Jones
19 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-11 15:31 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar
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.
- Documentation does not yet exist. Same here, it will follow if the
project can agree on Meson.
- 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>
---
Documentation/meson.build | 317 ++++++
bin-wrappers/meson.build | 28 +
contrib/completion/meson.build | 8 +
contrib/meson.build | 1 +
gitweb/meson.build | 63 ++
meson.build | 1614 ++++++++++++++++++++++++++++
meson_options.txt | 73 ++
perl/FromCPAN/Mail/meson.build | 7 +
perl/FromCPAN/meson.build | 9 +
perl/Git/LoadCPAN/Mail/meson.build | 7 +
perl/Git/LoadCPAN/meson.build | 9 +
perl/Git/SVN/Memoize/meson.build | 7 +
perl/Git/SVN/meson.build | 20 +
perl/Git/meson.build | 18 +
perl/meson.build | 12 +
po/meson.build | 27 +
subprojects/.gitignore | 1 +
subprojects/curl.wrap | 13 +
subprojects/expat.wrap | 13 +
subprojects/openssl.wrap | 15 +
subprojects/pcre2.wrap | 16 +
subprojects/zlib.wrap | 13 +
t/helper/meson.build | 91 ++
t/meson.build | 1106 +++++++++++++++++++
templates/hooks/meson.build | 24 +
templates/info/meson.build | 5 +
templates/meson.build | 13 +
27 files changed, 3530 insertions(+)
create mode 100644 Documentation/meson.build
create mode 100644 bin-wrappers/meson.build
create mode 100644 contrib/completion/meson.build
create mode 100644 contrib/meson.build
create mode 100644 gitweb/meson.build
create mode 100644 meson.build
create mode 100644 meson_options.txt
create mode 100644 perl/FromCPAN/Mail/meson.build
create mode 100644 perl/FromCPAN/meson.build
create mode 100644 perl/Git/LoadCPAN/Mail/meson.build
create mode 100644 perl/Git/LoadCPAN/meson.build
create mode 100644 perl/Git/SVN/Memoize/meson.build
create mode 100644 perl/Git/SVN/meson.build
create mode 100644 perl/Git/meson.build
create mode 100644 perl/meson.build
create mode 100644 po/meson.build
create mode 100644 subprojects/.gitignore
create mode 100644 subprojects/curl.wrap
create mode 100644 subprojects/expat.wrap
create mode 100644 subprojects/openssl.wrap
create mode 100644 subprojects/pcre2.wrap
create mode 100644 subprojects/zlib.wrap
create mode 100644 t/helper/meson.build
create mode 100644 t/meson.build
create mode 100644 templates/hooks/meson.build
create mode 100644 templates/info/meson.build
create mode 100644 templates/meson.build
diff --git a/Documentation/meson.build b/Documentation/meson.build
new file mode 100644
index 00000000000..15ba5004ad4
--- /dev/null
+++ b/Documentation/meson.build
@@ -0,0 +1,317 @@
+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')
+
+git_revdate = ''
+if git.found()
+ git_revdate = run_command(git, 'show', '--quiet', '--pretty=%as', check: false).stdout().strip()
+endif
+
+asciidoc_common_options = [
+ asciidoc,
+ '--conf-file=' + meson.current_source_dir() / 'asciidoc.conf',
+ '--attribute=manual=Git Manual',
+ '--attribute=mansource=Git ' + git_version,
+ '--attribute=revdate=' + git_revdate,
+ '--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 = [ ]
+
+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
diff --git a/bin-wrappers/meson.build b/bin-wrappers/meson.build
new file mode 100644
index 00000000000..6d03a19d7b8
--- /dev/null
+++ b/bin-wrappers/meson.build
@@ -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', fs.relative_to(executable.full_path(), meson.project_build_root()))
+
+ configure_file(
+ input: 'wrap-for-bin.sh',
+ output: fs.stem(executable.full_path()),
+ configuration: executable_config,
+ )
+endforeach
diff --git a/contrib/completion/meson.build b/contrib/completion/meson.build
new file mode 100644
index 00000000000..a9bfe2da312
--- /dev/null
+++ b/contrib/completion/meson.build
@@ -0,0 +1,8 @@
+foreach script : [
+ 'git-completion.bash',
+ 'git-completion.tcsh',
+ 'git-completion.zsh',
+ 'git-prompt.sh'
+]
+ test_dependencies += fs.copyfile(script)
+endforeach
diff --git a/contrib/meson.build b/contrib/meson.build
new file mode 100644
index 00000000000..a7b77b87c22
--- /dev/null
+++ b/contrib/meson.build
@@ -0,0 +1 @@
+subdir('completion')
diff --git a/gitweb/meson.build b/gitweb/meson.build
new file mode 100644
index 00000000000..43c28cea453
--- /dev/null
+++ b/gitweb/meson.build
@@ -0,0 +1,63 @@
+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_VERSION', git_version)
+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.sh',
+ meson.current_build_dir() / 'GITWEB-BUILD-OPTIONS',
+ '@INPUT@',
+ '@OUTPUT@',
+ ],
+ install: true,
+ install_dir: get_option('datadir') / 'gitweb',
+)
+
+foreach asset : [
+ 'static/git-favicon.png',
+ 'static/git-logo.png',
+ 'static/gitweb.css',
+ 'static/js/adjust-timezone.js',
+ 'static/js/blame_incremental.js',
+ 'static/js/javascript-detection.js',
+ 'static/js/lib/common-lib.js',
+ 'static/js/lib/cookies.js',
+ 'static/js/lib/datetime.js',
+]
+ fs.copyfile(asset,
+ install: true,
+ install_dir: get_option('datadir') / 'gitweb' / fs.parent(asset),
+ )
+endforeach
diff --git a/meson.build b/meson.build
new file mode 100644
index 00000000000..86d9a5c9f94
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,1614 @@
+project('git', 'c',
+ meson_version: '>=1.3.0',
+ # MSVC does not support GNU99, and C99 does not define __STDC_VERSION__
+ # on MSVC. So we instead fall back to C11 there.
+ default_options: ['c_std=gnu99,c11'],
+ version: 'v2.47.GIT',
+)
+
+fs = import('fs')
+
+program_path = []
+# Git for Windows provides all the tools we need to build Git.
+if host_machine.system() == 'windows'
+ program_path += [ 'C:/Program Files/Git/bin', 'C:/Program Files/Git/usr/bin' ]
+endif
+
+awk = find_program('awk', dirs: program_path)
+cygpath = find_program('cygpath', dirs: program_path, required: false)
+diff = find_program('diff', dirs: program_path)
+shell = find_program('sh', dirs: program_path)
+tar = find_program('tar', dirs: program_path)
+
+script_environment = environment()
+foreach tool : ['cat', 'cut', 'git', 'grep', 'sed', 'sort', 'tr', 'uname']
+ program = find_program(tool, dirs: program_path)
+ script_environment.prepend('PATH', fs.parent(program.full_path()))
+endforeach
+
+git_version = run_command(shell, 'GIT-VERSION-GEN', check: false, env: script_environment).stdout().strip()
+if git_version == ''
+ git_version = meson.project_version()
+endif
+
+compiler = meson.get_compiler('c')
+
+libgit_sources = [
+ 'abspath.c',
+ 'add-interactive.c',
+ 'add-patch.c',
+ 'advice.c',
+ 'alias.c',
+ 'alloc.c',
+ 'apply.c',
+ 'archive-tar.c',
+ 'archive-zip.c',
+ 'archive.c',
+ 'attr.c',
+ 'base85.c',
+ 'bisect.c',
+ 'blame.c',
+ 'blob.c',
+ 'bloom.c',
+ 'branch.c',
+ 'bulk-checkin.c',
+ 'bundle-uri.c',
+ 'bundle.c',
+ 'cache-tree.c',
+ 'cbtree.c',
+ 'chdir-notify.c',
+ 'checkout.c',
+ 'chunk-format.c',
+ 'color.c',
+ 'column.c',
+ 'combine-diff.c',
+ 'commit-graph.c',
+ 'commit-reach.c',
+ 'commit.c',
+ 'compat/nonblock.c',
+ 'compat/obstack.c',
+ 'compat/terminal.c',
+ 'compat/zlib-uncompress2.c',
+ 'config.c',
+ 'connect.c',
+ 'connected.c',
+ 'convert.c',
+ 'copy.c',
+ 'credential.c',
+ 'csum-file.c',
+ 'ctype.c',
+ 'date.c',
+ 'decorate.c',
+ 'delta-islands.c',
+ 'diagnose.c',
+ 'diff-delta.c',
+ 'diff-merges.c',
+ 'diff-lib.c',
+ 'diff-no-index.c',
+ 'diff.c',
+ 'diffcore-break.c',
+ 'diffcore-delta.c',
+ 'diffcore-order.c',
+ 'diffcore-pickaxe.c',
+ 'diffcore-rename.c',
+ 'diffcore-rotate.c',
+ 'dir-iterator.c',
+ 'dir.c',
+ 'editor.c',
+ 'entry.c',
+ 'environment.c',
+ 'ewah/bitmap.c',
+ 'ewah/ewah_bitmap.c',
+ 'ewah/ewah_io.c',
+ 'ewah/ewah_rlw.c',
+ 'exec-cmd.c',
+ 'fetch-negotiator.c',
+ 'fetch-pack.c',
+ 'fmt-merge-msg.c',
+ 'fsck.c',
+ 'fsmonitor.c',
+ 'fsmonitor-ipc.c',
+ 'fsmonitor-settings.c',
+ 'gettext.c',
+ 'git-zlib.c',
+ 'gpg-interface.c',
+ 'graph.c',
+ 'grep.c',
+ 'hash-lookup.c',
+ 'hashmap.c',
+ 'help.c',
+ 'hex.c',
+ 'hex-ll.c',
+ 'hook.c',
+ 'ident.c',
+ 'json-writer.c',
+ 'kwset.c',
+ 'levenshtein.c',
+ 'line-log.c',
+ 'line-range.c',
+ 'linear-assignment.c',
+ 'list-objects-filter-options.c',
+ 'list-objects-filter.c',
+ 'list-objects.c',
+ 'lockfile.c',
+ 'log-tree.c',
+ 'loose.c',
+ 'ls-refs.c',
+ 'mailinfo.c',
+ 'mailmap.c',
+ 'match-trees.c',
+ 'mem-pool.c',
+ 'merge-blobs.c',
+ 'merge-ll.c',
+ 'merge-ort.c',
+ 'merge-ort-wrappers.c',
+ 'merge-recursive.c',
+ 'merge.c',
+ 'midx.c',
+ 'midx-write.c',
+ 'name-hash.c',
+ 'negotiator/default.c',
+ 'negotiator/noop.c',
+ 'negotiator/skipping.c',
+ 'notes-cache.c',
+ 'notes-merge.c',
+ 'notes-utils.c',
+ 'notes.c',
+ 'object-file-convert.c',
+ 'object-file.c',
+ 'object-name.c',
+ 'object.c',
+ 'oid-array.c',
+ 'oidmap.c',
+ 'oidset.c',
+ 'oidtree.c',
+ 'pack-bitmap-write.c',
+ 'pack-bitmap.c',
+ 'pack-check.c',
+ 'pack-mtimes.c',
+ 'pack-objects.c',
+ 'pack-revindex.c',
+ 'pack-write.c',
+ 'packfile.c',
+ 'pager.c',
+ 'parallel-checkout.c',
+ 'parse.c',
+ 'parse-options-cb.c',
+ 'parse-options.c',
+ 'patch-delta.c',
+ 'patch-ids.c',
+ 'path.c',
+ 'pathspec.c',
+ 'pkt-line.c',
+ 'preload-index.c',
+ 'pretty.c',
+ 'prio-queue.c',
+ 'progress.c',
+ 'promisor-remote.c',
+ 'prompt.c',
+ 'protocol.c',
+ 'protocol-caps.c',
+ 'prune-packed.c',
+ 'pseudo-merge.c',
+ 'quote.c',
+ 'range-diff.c',
+ 'reachable.c',
+ 'read-cache.c',
+ 'rebase-interactive.c',
+ 'rebase.c',
+ 'ref-filter.c',
+ 'reflog-walk.c',
+ 'reflog.c',
+ 'refs.c',
+ 'refs/debug.c',
+ 'refs/files-backend.c',
+ 'refs/reftable-backend.c',
+ 'refs/iterator.c',
+ 'refs/packed-backend.c',
+ 'refs/ref-cache.c',
+ 'refspec.c',
+ 'reftable/basics.c',
+ 'reftable/error.c',
+ 'reftable/block.c',
+ 'reftable/blocksource.c',
+ 'reftable/iter.c',
+ 'reftable/merged.c',
+ 'reftable/pq.c',
+ 'reftable/reader.c',
+ 'reftable/record.c',
+ 'reftable/stack.c',
+ 'reftable/tree.c',
+ 'reftable/writer.c',
+ 'remote.c',
+ 'replace-object.c',
+ 'repo-settings.c',
+ 'repository.c',
+ 'rerere.c',
+ 'reset.c',
+ 'resolve-undo.c',
+ 'revision.c',
+ 'run-command.c',
+ 'send-pack.c',
+ 'sequencer.c',
+ 'serve.c',
+ 'server-info.c',
+ 'setup.c',
+ 'shallow.c',
+ 'sideband.c',
+ 'sigchain.c',
+ 'sparse-index.c',
+ 'split-index.c',
+ 'stable-qsort.c',
+ 'statinfo.c',
+ 'strbuf.c',
+ 'streaming.c',
+ 'string-list.c',
+ 'strmap.c',
+ 'strvec.c',
+ 'sub-process.c',
+ 'submodule-config.c',
+ 'submodule.c',
+ 'symlinks.c',
+ 'tag.c',
+ 'tempfile.c',
+ 'thread-utils.c',
+ 'tmp-objdir.c',
+ 'trace.c',
+ 'trace2.c',
+ 'trace2/tr2_cfg.c',
+ 'trace2/tr2_cmd_name.c',
+ 'trace2/tr2_ctr.c',
+ 'trace2/tr2_dst.c',
+ 'trace2/tr2_sid.c',
+ 'trace2/tr2_sysenv.c',
+ 'trace2/tr2_tbuf.c',
+ 'trace2/tr2_tgt_event.c',
+ 'trace2/tr2_tgt_normal.c',
+ 'trace2/tr2_tgt_perf.c',
+ 'trace2/tr2_tls.c',
+ 'trace2/tr2_tmr.c',
+ 'trailer.c',
+ 'transport-helper.c',
+ 'transport.c',
+ 'tree-diff.c',
+ 'tree-walk.c',
+ 'tree.c',
+ 'unpack-trees.c',
+ 'upload-pack.c',
+ 'url.c',
+ 'urlmatch.c',
+ 'usage.c',
+ 'userdiff.c',
+ 'utf8.c',
+ 'varint.c',
+ 'versioncmp.c',
+ 'walker.c',
+ 'wildmatch.c',
+ 'worktree.c',
+ 'wrapper.c',
+ 'write-or-die.c',
+ 'ws.c',
+ 'wt-status.c',
+ 'xdiff-interface.c',
+ 'xdiff/xdiffi.c',
+ 'xdiff/xemit.c',
+ 'xdiff/xhistogram.c',
+ 'xdiff/xmerge.c',
+ 'xdiff/xpatience.c',
+ 'xdiff/xprepare.c',
+ 'xdiff/xutils.c',
+]
+
+builtin_sources = [
+ 'builtin/add.c',
+ 'builtin/am.c',
+ 'builtin/annotate.c',
+ 'builtin/apply.c',
+ 'builtin/archive.c',
+ 'builtin/bisect.c',
+ 'builtin/blame.c',
+ 'builtin/branch.c',
+ 'builtin/bugreport.c',
+ 'builtin/bundle.c',
+ 'builtin/cat-file.c',
+ 'builtin/check-attr.c',
+ 'builtin/check-ignore.c',
+ 'builtin/check-mailmap.c',
+ 'builtin/check-ref-format.c',
+ 'builtin/checkout--worker.c',
+ 'builtin/checkout-index.c',
+ 'builtin/checkout.c',
+ 'builtin/clean.c',
+ 'builtin/clone.c',
+ 'builtin/column.c',
+ 'builtin/commit-graph.c',
+ 'builtin/commit-tree.c',
+ 'builtin/commit.c',
+ 'builtin/config.c',
+ 'builtin/count-objects.c',
+ 'builtin/credential-cache--daemon.c',
+ 'builtin/credential-cache.c',
+ 'builtin/credential-store.c',
+ 'builtin/credential.c',
+ 'builtin/describe.c',
+ 'builtin/diagnose.c',
+ 'builtin/diff-files.c',
+ 'builtin/diff-index.c',
+ 'builtin/diff-tree.c',
+ 'builtin/diff.c',
+ 'builtin/difftool.c',
+ 'builtin/fast-export.c',
+ 'builtin/fast-import.c',
+ 'builtin/fetch-pack.c',
+ 'builtin/fetch.c',
+ 'builtin/fmt-merge-msg.c',
+ 'builtin/for-each-ref.c',
+ 'builtin/for-each-repo.c',
+ 'builtin/fsck.c',
+ 'builtin/fsmonitor--daemon.c',
+ 'builtin/gc.c',
+ 'builtin/get-tar-commit-id.c',
+ 'builtin/grep.c',
+ 'builtin/hash-object.c',
+ 'builtin/help.c',
+ 'builtin/hook.c',
+ 'builtin/index-pack.c',
+ 'builtin/init-db.c',
+ 'builtin/interpret-trailers.c',
+ 'builtin/log.c',
+ 'builtin/ls-files.c',
+ 'builtin/ls-remote.c',
+ 'builtin/ls-tree.c',
+ 'builtin/mailinfo.c',
+ 'builtin/mailsplit.c',
+ 'builtin/merge-base.c',
+ 'builtin/merge-file.c',
+ 'builtin/merge-index.c',
+ 'builtin/merge-ours.c',
+ 'builtin/merge-recursive.c',
+ 'builtin/merge-tree.c',
+ 'builtin/merge.c',
+ 'builtin/mktag.c',
+ 'builtin/mktree.c',
+ 'builtin/multi-pack-index.c',
+ 'builtin/mv.c',
+ 'builtin/name-rev.c',
+ 'builtin/notes.c',
+ 'builtin/pack-objects.c',
+ 'builtin/pack-redundant.c',
+ 'builtin/pack-refs.c',
+ 'builtin/patch-id.c',
+ 'builtin/prune-packed.c',
+ 'builtin/prune.c',
+ 'builtin/pull.c',
+ 'builtin/push.c',
+ 'builtin/range-diff.c',
+ 'builtin/read-tree.c',
+ 'builtin/rebase.c',
+ 'builtin/receive-pack.c',
+ 'builtin/reflog.c',
+ 'builtin/refs.c',
+ 'builtin/remote-ext.c',
+ 'builtin/remote-fd.c',
+ 'builtin/remote.c',
+ 'builtin/repack.c',
+ 'builtin/replace.c',
+ 'builtin/replay.c',
+ 'builtin/rerere.c',
+ 'builtin/reset.c',
+ 'builtin/rev-list.c',
+ 'builtin/rev-parse.c',
+ 'builtin/revert.c',
+ 'builtin/rm.c',
+ 'builtin/send-pack.c',
+ 'builtin/shortlog.c',
+ 'builtin/show-branch.c',
+ 'builtin/show-index.c',
+ 'builtin/show-ref.c',
+ 'builtin/sparse-checkout.c',
+ 'builtin/stash.c',
+ 'builtin/stripspace.c',
+ 'builtin/submodule--helper.c',
+ 'builtin/symbolic-ref.c',
+ 'builtin/tag.c',
+ 'builtin/unpack-file.c',
+ 'builtin/unpack-objects.c',
+ 'builtin/update-index.c',
+ 'builtin/update-ref.c',
+ 'builtin/update-server-info.c',
+ 'builtin/upload-archive.c',
+ 'builtin/upload-pack.c',
+ 'builtin/var.c',
+ 'builtin/verify-commit.c',
+ 'builtin/verify-pack.c',
+ 'builtin/verify-tag.c',
+ 'builtin/worktree.c',
+ 'builtin/write-tree.c',
+]
+
+libgit_sources += custom_target(
+ input: 'command-list.txt',
+ output: 'command-list.h',
+ command: [shell, meson.current_source_dir() + '/generate-cmdlist.sh', meson.current_source_dir(), '@OUTPUT@'],
+ env: script_environment,
+)
+
+libgit_sources += custom_target(
+ output: 'config-list.h',
+ command: [
+ shell,
+ meson.current_source_dir() + '/generate-configlist.sh',
+ meson.current_source_dir(),
+ '@OUTPUT@',
+ ],
+ env: script_environment,
+)
+
+libgit_sources += custom_target(
+ input: 'Documentation/githooks.txt',
+ output: 'hook-list.h',
+ command: [
+ shell,
+ meson.current_source_dir() + '/generate-hooklist.sh',
+ meson.current_source_dir(),
+ '@OUTPUT@',
+ ],
+ env: script_environment,
+)
+
+# This contains the variables for GIT-BUILD-OPTIONS, which we use to propagate
+# build options to our tests.
+build_options_config = configuration_data()
+build_options_config.set('GIT_INTEROP_MAKE_OPTS', '')
+build_options_config.set('GIT_PERF_LARGE_REPO', '')
+build_options_config.set('GIT_PERF_MAKE_COMMAND', '')
+build_options_config.set('GIT_PERF_MAKE_OPTS', '')
+build_options_config.set('GIT_PERF_REPEAT_COUNT', '')
+build_options_config.set('GIT_PERF_REPO', '')
+build_options_config.set('GIT_TEST_CMP_USE_COPIED_CONTEXT', '')
+build_options_config.set('GIT_TEST_INDEX_VERSION', '')
+build_options_config.set('GIT_TEST_OPTS', '')
+build_options_config.set('GIT_TEST_PERL_FATAL_WARNINGS', '')
+build_options_config.set('GIT_TEST_UTF8_LOCALE', '')
+build_options_config.set('SANITIZE_ADDRESS', '')
+build_options_config.set('SANITIZE_LEAK', '')
+build_options_config.set('BROKEN_PATH_FIX', '')
+build_options_config.set_quoted('LOCALEDIR', fs.as_posix(get_option('prefix') / get_option('localedir')))
+build_options_config.set('GITWEBDIR', fs.as_posix(get_option('prefix') / get_option('datadir') / 'gitweb'))
+
+test_output_directory = get_option('test_output_directory')
+if test_output_directory == ''
+ test_output_directory = meson.project_build_root() / 'test-output'
+endif
+
+# These variables are used for building libgit.a.
+libgit_c_args = [
+ '-DBINDIR="' + get_option('bindir') + '"',
+ '-DDEFAULT_EDITOR="' + get_option('default_editor') + '"',
+ '-DDEFAULT_GIT_TEMPLATE_DIR="' + get_option('datadir') / 'git-core/templates' + '"',
+ '-DDEFAULT_HELP_FORMAT="' + get_option('default_help_format') + '"',
+ '-DDEFAULT_PAGER="' + get_option('default_pager') + '"',
+ '-DETC_GITATTRIBUTES="' + get_option('gitattributes') + '"',
+ '-DETC_GITCONFIG="' + get_option('gitconfig') + '"',
+ '-DFALLBACK_RUNTIME_PREFIX="' + get_option('prefix') + '"',
+ '-DGIT_EXEC_PATH="' + get_option('prefix') / get_option('libexecdir') / 'git-core"',
+ '-DGIT_HOST_CPU="' + host_machine.cpu_family() + '"',
+ '-DGIT_HTML_PATH="' + get_option('datadir') / 'doc/git-doc"',
+ '-DGIT_INFO_PATH="' + get_option('infodir') + '"',
+ '-DGIT_LOCALE_PATH="' + get_option('localedir') + '"',
+ '-DGIT_MAN_PATH="' + get_option('mandir') + '"',
+ '-DPAGER_ENV="' + get_option('pager_environment') + '"',
+ '-DSHELL_PATH="' + fs.as_posix(shell.full_path()) + '"',
+]
+libgit_include_directories = [ '.' ]
+libgit_dependencies = [ ]
+
+executable_suffix = ''
+if host_machine.system() == 'cygwin' or host_machine.system() == 'windows'
+ executable_suffix = '.exe'
+ libgit_c_args += '-DSTRIP_EXTENSION="' + executable_suffix + '"'
+endif
+build_options_config.set_quoted('X', executable_suffix)
+
+python = import('python').find_installation('python3', required: get_option('python'))
+if python.found()
+ build_options_config.set('NO_PYTHON', '')
+else
+ libgit_c_args += '-DNO_PYTHON'
+ build_options_config.set('NO_PYTHON', '1')
+endif
+
+# Perl is used for two different things: our test harness and to provide some
+# features. It is optional if you want to neither execute tests nor use any of
+# these optional features.
+perl_required = get_option('perl')
+if get_option('tests')
+ perl_required = true
+endif
+
+# Note that we only set NO_PERL if the Perl features were disabled by the user.
+# It may not be set when we have found Perl, but only use it to run tests.
+perl = find_program('perl', version: '>=5.8.1', dirs: program_path, required: perl_required)
+perl_features_enabled = perl.found() and get_option('perl').allowed()
+if perl_features_enabled
+ build_options_config.set('NO_PERL', '')
+
+ if get_option('runtime_prefix')
+ build_options_config.set('PERL_LOCALEDIR', '')
+ else
+ build_options_config.set_quoted('PERL_LOCALEDIR', fs.as_posix(get_option('prefix') / get_option('localedir')))
+ endif
+
+ if get_option('perl_cpan_fallback')
+ build_options_config.set('NO_PERL_CPAN_FALLBACKS', '')
+ else
+ build_options_config.set_quoted('NO_PERL_CPAN_FALLBACKS', 'YesPlease')
+ endif
+else
+ libgit_c_args += '-DNO_PERL'
+ build_options_config.set('NO_PERL', '1')
+ build_options_config.set('PERL_LOCALEDIR', '')
+ build_options_config.set('NO_PERL_CPAN_FALLBACKS', '')
+endif
+
+zlib = dependency('zlib', default_options: ['default_library=static', 'tests=disabled'])
+if zlib.version().version_compare('<1.2.0')
+ libgit_c_args += '-DNO_DEFLATE_BOUND'
+endif
+libgit_dependencies += zlib
+
+threads = dependency('threads', required: false)
+if threads.found()
+ libgit_dependencies += threads
+ build_options_config.set('NO_PTHREADS', '')
+else
+ libgit_c_args += '-DNO_PTHREADS'
+ build_options_config.set('NO_PTHREADS', '1')
+endif
+
+if get_option('gettext').allowed() and host_machine.system() == 'darwin' and get_option('macos_use_homebrew_gettext')
+ if host_machine.cpu_family() == 'x86_64'
+ libintl_prefix = '/usr/local'
+ elif host_machine.cpu_family() == 'aarch64'
+ libintl_prefix = '/opt/homebrew'
+ else
+ error('Homebrew workaround not supported on current architecture')
+ endif
+
+ intl = compiler.find_library('intl', dirs: libintl_prefix / 'lib', required: get_option('gettext'))
+ if intl.found()
+ intl = declare_dependency(
+ dependencies: intl,
+ include_directories: libintl_prefix / 'include',
+ )
+ endif
+else
+ intl = dependency('intl', required: get_option('gettext'))
+endif
+if intl.found()
+ libgit_dependencies += intl
+ build_options_config.set('NO_GETTEXT', '')
+ build_options_config.set('USE_GETTEXT_SCHEME', '')
+else
+ libgit_c_args += '-DNO_GETTEXT'
+ build_options_config.set('NO_GETTEXT', '1')
+ build_options_config.set('USE_GETTEXT_SCHEME', 'fallthrough')
+endif
+
+iconv = dependency('iconv', required: get_option('iconv'))
+if iconv.found()
+ libgit_dependencies += iconv
+ build_options_config.set('NO_ICONV', '')
+
+ have_old_iconv = false
+ if not compiler.compiles('''
+ #include <iconv.h>
+
+ extern size_t iconv(iconv_t cd,
+ char **inbuf, size_t *inbytesleft,
+ char **outbuf, size_t *outbytesleft);
+ ''', name: 'old iconv interface', dependencies: [iconv])
+ libgit_c_args += '-DOLD_ICONV'
+ have_old_iconv = true
+ endif
+
+ iconv_omits_bom_source = '''#
+ #include <iconv.h>
+
+ int main(int argc, const char **argv)
+ {
+ '''
+ if have_old_iconv
+ iconv_omits_bom_source += '''
+ typedef const char *iconv_ibp;
+ '''
+ else
+ iconv_omits_bom_source += '''
+ typedef char *iconv_ibp;
+ '''
+ endif
+ iconv_omits_bom_source += '''
+ int v;
+ iconv_t conv;
+ char in[] = "a"; iconv_ibp pin = in;
+ char out[20] = ""; char *pout = out;
+ size_t isz = sizeof in;
+ size_t osz = sizeof out;
+
+ conv = iconv_open("UTF-16", "UTF-8");
+ iconv(conv, &pin, &isz, &pout, &osz);
+ iconv_close(conv);
+ v = (unsigned char)(out[0]) + (unsigned char)(out[1]);
+ return v != 0xfe + 0xff;
+ }
+ '''
+
+ if compiler.run(iconv_omits_bom_source,
+ dependencies: iconv,
+ name: 'iconv omits BOM',
+ ).returncode() != 0
+ libgit_c_args += '-DICONV_OMITS_BOM'
+ endif
+else
+ libgit_c_args += '-DNO_ICONV'
+ build_options_config.set('NO_ICONV', '1')
+endif
+
+pcre2 = dependency('libpcre2-8', required: get_option('pcre2'), default_options: ['default_library=static', 'test=false'])
+if pcre2.found()
+ libgit_dependencies += pcre2
+ libgit_c_args += '-DUSE_LIBPCRE2'
+ build_options_config.set('USE_LIBPCRE2', '1')
+else
+ build_options_config.set('USE_LIBPCRE2', '')
+endif
+
+curl = dependency('libcurl', version: '>=7.21.3', required: get_option('curl'), default_options: ['default_library=static', 'tests=disabled'])
+use_curl_for_imap_send = false
+if curl.found()
+ if curl.version().version_compare('>=7.34.0')
+ libgit_c_args += '-DUSE_CURL_FOR_IMAP_SEND'
+ use_curl_for_imap_send = true
+ endif
+
+ libgit_dependencies += curl
+ libgit_c_args += '-DCURL_DISABLE_TYPECHECK'
+ build_options_config.set('NO_CURL', '')
+else
+ libgit_c_args += '-DNO_CURL'
+ build_options_config.set('NO_CURL', '1')
+endif
+
+expat = dependency('expat', required: get_option('expat'), default_options: ['default_library=static', 'build_tests=false'])
+if expat.found()
+ libgit_dependencies += expat
+
+ if expat.version().version_compare('<=1.2')
+ libgit_c_args += '-DEXPAT_NEEDS_XMLPARSE_H'
+ endif
+ build_options_config.set('NO_EXPAT', '')
+else
+ libgit_c_args += '-DNO_EXPAT'
+ build_options_config.set('NO_EXPAT', '1')
+endif
+
+if not compiler.has_header('sys/select.h')
+ libgit_c_args += '-DNO_SYS_SELECT_H'
+endif
+
+has_poll_h = compiler.has_header('poll.h')
+if not has_poll_h
+ libgit_c_args += '-DNO_POLL_H'
+endif
+
+has_sys_poll_h = compiler.has_header('sys/poll.h')
+if not has_sys_poll_h
+ libgit_c_args += '-DNO_SYS_POLL_H'
+endif
+
+if not has_poll_h and not has_sys_poll_h
+ libgit_c_args += '-DNO_POLL'
+ libgit_sources += 'compat/poll/poll.c'
+ libgit_include_directories += 'compat/poll'
+endif
+
+if not compiler.has_header('inttypes.h')
+ libgit_c_args += '-DNO_INTTYPES_H'
+endif
+
+if compiler.has_header('libcharset.h')
+ libcharset = compiler.find_library('charset')
+
+ if compiler.has_function('locale_charset',
+ prefix: '#include <libcharset.h>',
+ dependencies: iconv,
+ )
+ libgit_c_args += '-DHAVE_LIBCHARSET_H'
+ elif compiler.has_function('locale_charset',
+ prefix: '#include <libcharset.h>',
+ dependencies: libcharset,
+ )
+ libgit_c_args += '-DHAVE_LIBCHARSET_H'
+ endif
+endif
+
+if compiler.has_header('alloca.h')
+ libgit_c_args += '-DHAVE_ALLOCA_H'
+endif
+
+if compiler.has_header('sys/sysinfo.h')
+ libgit_c_args += '-DHAVE_SYSINFO'
+endif
+
+# Windows has libgen.h and a basename implementation, but we still need our own
+# implementation to threat things like drive prefixes specially.
+if host_machine.system() == 'windows' or not compiler.has_header('libgen.h')
+ libgit_c_args += '-DNO_LIBGEN_H'
+ libgit_sources += 'compat/basename.c'
+endif
+
+if compiler.has_header('paths.h')
+ libgit_c_args += '-DHAVE_PATHS_H'
+endif
+
+if compiler.has_header('strings.h')
+ libgit_c_args += '-DHAVE_STRINGS_H'
+endif
+
+networking_dependencies = [ ]
+if host_machine.system() == 'windows'
+ winsock = compiler.find_library('ws2_32', required: false)
+ if winsock.found()
+ networking_dependencies += winsock
+ endif
+else
+ libresolv = compiler.find_library('resolv', required: false)
+ if libresolv.found()
+ networking_dependencies += libresolv
+ endif
+endif
+libgit_dependencies += networking_dependencies
+
+foreach symbol : ['inet_ntop', 'inet_pton', 'strerror']
+ if not compiler.has_function(symbol, dependencies: networking_dependencies)
+ libgit_c_args += '-DNO_' + symbol.to_upper()
+ endif
+endforeach
+
+has_ipv6 = compiler.has_function('getaddrinfo', dependencies: networking_dependencies)
+if not has_ipv6
+ libgit_c_args += '-DNO_IPV6'
+endif
+
+if not compiler.compiles('''
+ #ifdef _WIN32
+ # include <winsock2.h>
+ #else
+ # include <sys/types.h>
+ # include <sys/socket.h>
+ #endif
+
+ void func(void)
+ {
+ struct sockaddr_storage x;
+ }
+''', name: 'struct sockaddr_storage')
+ if has_ipv6
+ libgit_c_args += '-Dsockaddr_storage=sockaddr_in6'
+ else
+ libgit_c_args += '-Dsockaddr_storage=sockaddr_in'
+ endif
+endif
+
+if compiler.has_function('socket', dependencies: networking_dependencies)
+ libgit_sources += [
+ 'unix-socket.c',
+ 'unix-stream-server.c',
+ ]
+ build_options_config.set('NO_UNIX_SOCKETS', '')
+else
+ libgit_c_args += '-DNO_UNIX_SOCKETS'
+ build_options_config.set('NO_UNIX_SOCKETS', '1')
+endif
+
+if not compiler.has_function('pread')
+ libgit_c_args += '-DNO_PREAD'
+ libgit_sources += 'compat/pread.c'
+endif
+
+if host_machine.system() == 'darwin'
+ libgit_sources += 'compat/precompose_utf8.c'
+ libgit_c_args += '-DPRECOMPOSE_UNICODE'
+ libgit_c_args += '-DPROTECT_HFS_DEFAULT'
+endif
+
+# Configure general compatibility wrappers.
+if host_machine.system() == 'cygwin'
+ libgit_sources += [
+ 'compat/win32/path-utils.c',
+ ]
+elif host_machine.system() == 'windows'
+ libgit_sources += [
+ 'compat/mingw.c',
+ 'compat/winansi.c',
+ 'compat/win32/flush.c',
+ 'compat/win32/path-utils.c',
+ 'compat/win32/pthread.c',
+ 'compat/win32/syslog.c',
+ 'compat/win32/dirent.c',
+ 'compat/win32mmap.c',
+ 'compat/nedmalloc/nedmalloc.c',
+ ]
+
+ libgit_c_args += [
+ '-DDETECT_MSYS_TTY',
+ '-DENSURE_MSYSTEM_IS_SET',
+ '-DNATIVE_CRLF',
+ '-DNOGDI',
+ '-DNO_POSIX_GOODIES',
+ '-DWIN32',
+ '-D_CONSOLE',
+ '-D_CONSOLE_DETECT_MSYS_TTY',
+ '-D__USE_MINGW_ANSI_STDIO=0',
+ ]
+
+ libgit_dependencies += compiler.find_library('ntdll')
+ libgit_include_directories += 'compat/win32'
+ if compiler.get_id() == 'msvc'
+ libgit_include_directories += 'compat/vcbuild/include'
+ endif
+endif
+
+if host_machine.system() == 'linux'
+ libgit_sources += 'compat/linux/procinfo.c'
+elif host_machine.system() == 'windows'
+ libgit_sources += 'compat/win32/trace2_win32_process_info.c'
+else
+ libgit_sources += 'compat/stub/procinfo.c'
+endif
+
+if host_machine.system() == 'cygwin' or host_machine.system() == 'windows'
+ libgit_c_args += [
+ '-DUNRELIABLE_FSTAT',
+ '-DMMAP_PREVENTS_DELETE',
+ '-DOBJECT_CREATION_MODE=1',
+ ]
+endif
+
+# Configure the simple-ipc subsystem required fro the fsmonitor.
+if host_machine.system() == 'windows'
+ libgit_sources += [
+ 'compat/simple-ipc/ipc-shared.c',
+ 'compat/simple-ipc/ipc-win32.c',
+ ]
+ libgit_c_args += '-DSUPPORTS_SIMPLE_IPC'
+else
+ libgit_sources += [
+ 'compat/simple-ipc/ipc-shared.c',
+ 'compat/simple-ipc/ipc-unix-socket.c',
+ ]
+ libgit_c_args += '-DSUPPORTS_SIMPLE_IPC'
+endif
+
+fsmonitor_backend = ''
+if host_machine.system() == 'windows'
+ fsmonitor_backend = 'win32'
+elif host_machine.system() == 'darwin'
+ fsmonitor_backend = 'darwin'
+ libgit_dependencies += dependency('CoreServices')
+endif
+if fsmonitor_backend != ''
+ libgit_c_args += '-DHAVE_FSMONITOR_DAEMON_BACKEND'
+ libgit_c_args += '-DHAVE_FSMONITOR_OS_SETTINGS'
+
+ libgit_sources += [
+ 'compat/fsmonitor/fsm-health-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-ipc-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-listen-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-path-utils-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-settings-' + fsmonitor_backend + '.c',
+ ]
+endif
+build_options_config.set_quoted('FSMONITOR_DAEMON_BACKEND', fsmonitor_backend)
+build_options_config.set_quoted('FSMONITOR_OS_SETTINGS', fsmonitor_backend)
+
+if compiler.has_header('regex.h') and compiler.get_define('REG_STARTEND', prefix: '#include <regex.h>') != ''
+ build_options_config.set('NO_REGEX', '')
+
+ if compiler.get_define('REG_ENHANCED', prefix: '#include <regex.h>') != ''
+ libgit_c_args += '-DUSE_ENHANCED_BASIC_REGULAR_EXPRESSIONS'
+ libgit_sources += 'compat/regcomp_enhanced.c'
+ endif
+else
+ libgit_c_args += [
+ '-DNO_REGEX',
+ '-DGAWK',
+ '-DNO_MBSUPPORT',
+ ]
+ build_options_config.set('NO_REGEX', '1')
+ libgit_sources += 'compat/regex/regex.c'
+ libgit_include_directories += 'compat/regex'
+endif
+
+# setitimer and friends are provided by compat/mingw.c.
+if host_machine.system() != 'windows'
+ if not compiler.compiles('''
+ #include <sys/time.h>
+ void func(void)
+ {
+ struct itimerval value;
+ }
+ ''', name: 'struct itimerval')
+ libgit_c_args += '-DNO_STRUCT_ITIMERVAL'
+ libgit_c_args += '-DNO_SETITIMER'
+ elif not compiler.has_function('setitimer')
+ libgit_c_args += '-DNO_SETITIMER'
+ endif
+endif
+
+if compiler.has_member('struct stat', 'st_mtimespec.tv_nsec', prefix: '#include <sys/stat.h>')
+ libgit_c_args += '-DUSE_ST_TIMESPEC'
+elif not compiler.has_member('struct stat', 'st_mtim.tv_nsec', prefix: '#include <sys/stat.h>')
+ libgit_c_args += '-DNO_NSEC'
+endif
+
+if not compiler.has_member('struct stat', 'st_blocks', prefix: '#include <sys/stat.h>')
+ libgit_c_args += '-DNO_ST_BLOCKS_IN_STRUCT_STAT'
+endif
+
+if not compiler.has_member('struct dirent', 'd_type', prefix: '#include <dirent.h>')
+ libgit_c_args += '-DNO_D_TYPE_IN_DIRENT'
+endif
+
+if not compiler.has_member('struct passwd', 'pw_gecos', prefix: '#include <pwd.h>')
+ libgit_c_args += '-DNO_GECOS_IN_PWENT'
+endif
+
+if compiler.has_function('sync_file_range')
+ libgit_c_args += '-DHAVE_SYNC_FILE_RANGE'
+endif
+
+if not compiler.has_function('strcasestr')
+ libgit_c_args += '-DNO_STRCASESTR'
+ libgit_sources += 'compat/strcasestr.c'
+endif
+
+if not compiler.has_function('memmem')
+ libgit_c_args += '-DNO_MEMMEM'
+ libgit_sources += 'compat/memmem.c'
+endif
+
+if not compiler.has_function('strlcpy')
+ libgit_c_args += '-DNO_STRLCPY'
+ libgit_sources += 'compat/strlcpy.c'
+endif
+
+if not compiler.has_function('strdup')
+ libgit_c_args += '-DOVERRIDE_STRDUP'
+ libgit_sources += 'compat/strdup.c'
+endif
+
+if not compiler.has_function('strtoumax')
+ libgit_c_args += '-DNO_STRTOUMAX'
+ libgit_sources += [
+ 'compat/strtoumax.c',
+ 'compat/strtoimax.c',
+ ]
+endif
+
+if not compiler.has_function('strtoull')
+ libgit_c_args += '-DNO_STRTOULL'
+endif
+
+if not compiler.has_function('setenv')
+ libgit_c_args += '-DNO_SETENV'
+ libgit_sources += 'compat/setenv.c'
+endif
+
+if not compiler.has_function('qsort')
+ libgit_c_args += '-DINTERNAL_QSORT'
+endif
+libgit_sources += 'compat/qsort_s.c'
+
+# unsetenv is provided by compat/mingw.c.
+if host_machine.system() != 'windows' and not compiler.has_function('unsetenv')
+ libgit_c_args += '-DNO_UNSETENV'
+ libgit_sources += 'compat/unsetenv.c'
+endif
+
+if not compiler.has_function('mkdtemp')
+ libgit_c_args += '-DNO_MKDTEMP'
+ libgit_sources += 'compat/mkdtemp.c'
+endif
+
+if not compiler.has_function('initgroups')
+ libgit_c_args += '-DNO_INITGROUPS'
+endif
+
+if compiler.has_function('getdelim')
+ libgit_c_args += '-DHAVE_GETDELIM'
+endif
+
+if host_machine.system() == 'windows'
+ libgit_c_args += '-DUSE_WIN32_MMAP'
+elif not compiler.has_function('mmap')
+ libgit_c_args += '-DNO_MMAP'
+ libgit_sources += 'compat/mmap.c'
+endif
+
+if compiler.has_function('clock_gettime')
+ libgit_c_args += '-DHAVE_CLOCK_GETTIME'
+endif
+
+if compiler.compiles('''
+ #include <time.h>
+
+ void func(void)
+ {
+ clockid_t id = CLOCK_MONOTONIC;
+ }
+''', name: 'monotonic clock')
+ libgit_c_args += '-DHAVE_CLOCK_MONOTONIC'
+endif
+
+if compiler.compiles('''
+ #include <inttypes.h>
+
+ void func(void)
+ {
+ uintmax_t x = 0;
+ }
+''', name: 'uintmax_t')
+ libgit_c_args += '-DNO_UINTMAX_T'
+endif
+
+has_bsd_sysctl = false
+if compiler.has_header('sys/sysctl.h')
+ if compiler.compiles('''
+ #include <stddef.h>
+ #include <sys/sysctl.h>
+
+ void func(void)
+ {
+ int val, mib[2] = { 0 };
+ size_t len = sizeof(val);
+ sysctl(mib, 2, &val, &len, NULL, 0);
+ }
+ ''', name: 'BSD sysctl')
+ libgit_c_args += '-DHAVE_BSD_SYSCTL'
+ has_bsd_sysctl = true
+ endif
+endif
+
+if compiler.run('''
+ #include <stdio.h>
+
+ int main(int argc, const char **argv)
+ {
+ FILE *f = fopen(".", "r");
+ return f ? 0 : 1;
+ }
+''', name: 'fread reads directories').returncode() == 0
+ libgit_c_args += '-DFREAD_READS_DIRECTORIES'
+ libgit_sources += 'compat/fopen.c'
+endif
+
+if not meson.is_cross_build() and fs.exists('/dev/tty')
+ libgit_c_args += '-DHAVE_DEV_TTY'
+endif
+
+if get_option('openssl').enabled() and get_option('CommonCrypto').enabled()
+ error('Can only use one SSL backend')
+endif
+
+security_framework = dependency('Security', required: get_option('CommonCrypto').disable_auto_if(host_machine.system() != 'darwin'))
+core_foundation_framework = dependency('CoreFoundation', required: security_framework.found())
+if security_framework.found()
+ libgit_dependencies += security_framework
+ libgit_dependencies += core_foundation_framework
+ libgit_c_args += '-DAPPLE_COMMON_CRYPTO'
+endif
+
+# OpenSSL is required when requested via the 'openssl' feature or via one of
+# the SHA1/SHA256 backends.
+openssl_required = get_option('openssl').disable_auto_if(security_framework.found())
+if get_option('sha1_backend') == 'openssl' or get_option('sha256_backend') == 'openssl'
+ openssl_required = true
+endif
+
+openssl = dependency('openssl', required: openssl_required, default_options: ['default_library=static'])
+if openssl.found()
+ libgit_dependencies += openssl
+endif
+
+# We may not want to use OpenSSL for anything but our SHA1/SHA256 backends, so
+# we cannot just set NO_OPENSSL based on whether or not the library was found.
+if not openssl.found() or get_option('openssl').disabled()
+ libgit_c_args += '-DNO_OPENSSL'
+endif
+
+sha1_backend = get_option('sha1_backend')
+if sha1_backend == 'sha1dc'
+ libgit_c_args += '-DSHA1_DC'
+ libgit_c_args += '-DSHA1DC_NO_STANDARD_INCLUDES=1'
+ libgit_c_args += '-DSHA1DC_INIT_SAFE_HASH_DEFAULT=0'
+ libgit_c_args += '-DSHA1DC_CUSTOM_INCLUDE_SHA1_C="git-compat-util.h"'
+ libgit_c_args += '-DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="git-compat-util.h"'
+
+ libgit_sources += [
+ 'sha1dc_git.c',
+ 'sha1dc/sha1.c',
+ 'sha1dc/ubc_check.c',
+ ]
+elif sha1_backend == 'common-crypto'
+ libgit_c_args += '-DCOMMON_DIGEST_FOR_OPENSSL'
+ libgit_c_args += '-DSHA1_APPLE'
+ libgit_c_args += '-DSHA1_MAX_BLOCK_SIZE=1024L*1024L*1024L'
+elif sha1_backend == 'openssl'
+ if not openssl.found()
+ openssl = dependency('openssl', required: true)
+ endif
+
+ libgit_c_args += '-DSHA1_OPENSSL'
+ # Apple CommonCrypto requires chunking
+elif sha1_backend == 'block'
+ libgit_c_args += '-DSHA1_BLK'
+ libgit_sources += 'block-sha1/sha1.c'
+else
+ error('Unhandled SHA1 backend ' + sha1_backend)
+endif
+
+sha256_backend = get_option('sha256_backend')
+if sha256_backend == 'openssl'
+ libgit_c_args += '-DSHA256_OPENSSL'
+elif sha256_backend == 'nettle'
+ nettle = dependency('nettle')
+ libgit_dependencies += nettle
+ libgit_c_args += '-DSHA256_NETTLE'
+elif sha256_backend == 'gcrypt'
+ gcrypt = dependency('gcrypt')
+ libgit_dependencies += gcrypt
+ libgit_c_args += '-DSHA256_GCRYPT'
+elif sha256_backend == 'block'
+ libgit_c_args += '-DSHA256_BLK'
+ libgit_sources += 'sha256/block/sha256.c'
+else
+ error('Unhandled SHA256 backend ' + sha256_backend)
+endif
+
+if compiler.has_header_symbol('stdlib.h', 'arc4random_buf')
+ libgit_c_args += '-DHAVE_ARC4RANDOM'
+elif compiler.has_header_symbol('bsd/stdlib.h', 'arc4random_buf')
+ libgit_c_args += '-DHAVE_ARC4RANDOM_BSD'
+elif compiler.has_function('getrandom', prefix: '#include <sys/random.h>')
+ libgit_c_args += '-DHAVE_GETRANDOM'
+elif compiler.has_function('getentropy', prefix: '#include <unistd.h>')
+ libgit_c_args += '-DHAVE_GETENTROPY'
+elif compiler.has_function('RtlGenRandom', prefix: '#include <windows.h>\n#include <ntsecapi.h>')
+ libgit_c_args += '-DHAVE_RTLGENRANDOM'
+elif openssl.found()
+ libgit_c_args += '-DHAVE_OPENSSL_CSPRNG'
+endif
+
+if get_option('runtime_prefix')
+ libgit_c_args += '-DRUNTIME_PREFIX'
+ build_options_config.set('RUNTIME_PREFIX', '1')
+
+ if compiler.has_header('mach-o/dyld.h')
+ libgit_c_args += '-DHAVE_NS_GET_EXECUTABLE_PATH'
+ endif
+
+ if has_bsd_sysctl and compiler.compiles('''
+ #include <sys/sysctl.h>
+
+ void func(void)
+ {
+ KERN_PROC_PATHNAME; KERN_PROC;
+ }
+ ''', name: 'BSD KERN_PROC_PATHNAME')
+ libgit_c_args += '-DHAVE_NS_GET_EXECUTABLE_PATH'
+ endif
+
+ if host_machine.system() == 'linux'
+ libgit_c_args += '-DPROCFS_EXECUTABLE_PATH="/proc/self/exe' + '"'
+ elif host_machine.system() == 'openbsd'
+ libgit_c_args += '-DPROCFS_EXECUTABLE_PATH="' + '/proc/curproc/file' + '"'
+ elif host_machine.system() == 'netbsd'
+ libgit_c_args += '-DPROCFS_EXECUTABLE_PATH="' + '/proc/curproc/exe' + '"'
+ endif
+
+ if host_machine.system() == 'windows' and compiler.compiles('''
+ #include <stdlib.h>
+
+ void func(void)
+ {
+ _wpgmptr;
+ }
+ ''', name: 'Win32 _wpgmptr')
+ libgit_c_args += '-DHAVE_WPGMPTR'
+ endif
+else
+ build_options_config.set('RUNTIME_PREFIX', '')
+endif
+
+foreach key, value : {
+ 'DIFF': diff.full_path(),
+ 'GIT_TEST_CMP': diff.full_path() + ' -u',
+ 'GIT_TEST_GITPERLLIB': meson.project_build_root() / 'perl',
+ 'GIT_TEST_MERGE_TOOLS_DIR': meson.project_source_root() / 'mergetools',
+ 'GIT_TEST_POPATH': meson.project_source_root() / 'po',
+ 'GIT_TEST_TEMPLATE_DIR': meson.project_build_root() / 'templates',
+ 'GIT_TEST_TEXTDOMAINDIR': meson.project_build_root() / 'po',
+ 'PAGER_ENV': get_option('pager_environment'),
+ 'PERL_PATH': perl.found() ? perl.full_path() : '',
+ 'PYTHON_PATH': python.found () ? python.full_path() : '',
+ 'SHELL_PATH': shell.full_path(),
+ 'TAR': tar.full_path(),
+ 'TEST_OUTPUT_DIRECTORY': test_output_directory,
+ 'TEST_SHELL_PATH': shell.full_path(),
+}
+ if value != '' and cygpath.found()
+ value = run_command(cygpath, value, check: true).stdout().strip()
+ endif
+ build_options_config.set_quoted(key, value)
+endforeach
+
+configure_file(
+ input: 'GIT-BUILD-OPTIONS.in',
+ output: 'GIT-BUILD-OPTIONS',
+ configuration: build_options_config,
+)
+
+# Build a separate library for "version.c" so that we do not have to rebuild
+# everything when the current Git commit changes. TODO: this only gets set up
+# at configuration time, so we do not notice version changes unless the build
+# instructions get regenerated. We should refactor the source file such that we
+# can substitute tags in the file via `vcs_tag()`.
+libgit_version_library = static_library('git-version',
+ sources: ['version.c'],
+ c_args: libgit_c_args + [
+ '-DGIT_VERSION="' + git_version + '"',
+ '-DGIT_USER_AGENT="' + 'git/' + git_version + '"',
+ '-DGIT_BUILT_FROM_COMMIT="' + run_command('git', 'rev-parse', '-q', '--verify', 'HEAD', check: false).stdout().strip() + '"',
+ ],
+ dependencies: libgit_dependencies,
+ include_directories: libgit_include_directories,
+)
+
+libgit_library = static_library('git',
+ sources: libgit_sources,
+ c_args: libgit_c_args,
+ link_with: libgit_version_library,
+ dependencies: libgit_dependencies,
+ include_directories: libgit_include_directories,
+)
+
+libgit = declare_dependency(
+ compile_args: libgit_c_args,
+ link_with: libgit_library,
+ dependencies: libgit_dependencies,
+ include_directories: libgit_include_directories,
+)
+
+common_main_sources = ['common-main.c']
+common_main_link_args = [ ]
+if host_machine.system() == 'windows'
+ # TODO: wire these up properly.
+ common_main_sources += import('windows').compile_resources('git.rc', args: [
+ '-DMAJOR=1',
+ '-DMINOR=1',
+ '-DMICRO=1',
+ '-DPATCHLEVEL=0',
+ '-DGIT_VERSION=\\\"' + git_version + '.GIT\\\"',
+ ])
+ if compiler.get_argument_syntax() == 'gcc'
+ common_main_link_args += [
+ '-municode',
+ '-Wl,-nxcompat',
+ '-Wl,-dynamicbase',
+ '-Wl,-pic-executable,-e,mainCRTStartup',
+ ]
+ elif compiler.get_argument_syntax() == 'msvc'
+ common_main_link_args += [
+ '/ENTRY:wmainCRTStartup',
+ 'invalidcontinue.obj',
+ ]
+ else
+ error('Unsupported compiler ' + compiler.get_id())
+ endif
+endif
+common_main_library = static_library('common-main',
+ 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,
+ link_args: common_main_link_args,
+)
+
+bin_wrappers = [ ]
+test_dependencies = [ ]
+
+git = executable('git',
+ sources: builtin_sources + 'git.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+bin_wrappers += git
+
+test_dependencies += executable('git-daemon',
+ sources: 'daemon.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+test_dependencies += executable('git-sh-i18n--envsubst',
+ sources: 'sh-i18n--envsubst.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+bin_wrappers += executable('git-shell',
+ sources: 'shell.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+test_dependencies += executable('git-http-backend',
+ sources: 'http-backend.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+bin_wrappers += executable('scalar',
+ sources: 'scalar.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+if get_option('curl').enabled()
+ curl_sources = [
+ 'http.c',
+ 'http-walker.c',
+ ]
+
+ git_remote_http = executable('git-remote-http',
+ sources: curl_sources + 'remote-curl.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+ test_dependencies += git_remote_http
+
+ test_dependencies += executable('git-http-fetch',
+ sources: curl_sources + 'http-fetch.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+
+ if expat.found()
+ test_dependencies += executable('git-http-push',
+ sources: curl_sources + 'http-push.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+ endif
+
+ 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, common_main],
+ )
+
+ install_symlink(alias + executable_suffix,
+ install_dir: get_option('libexecdir') / 'git-core',
+ pointing_to: 'git-remote-http',
+ )
+ endforeach
+endif
+
+imap_send_sources = ['imap-send.c']
+if use_curl_for_imap_send
+ imap_send_sources += curl_sources
+endif
+
+test_dependencies += executable('git-imap-send',
+ sources: imap_send_sources,
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+foreach alias : [ 'git-receive-pack', 'git-upload-archive', 'git-upload-pack' ]
+ bin_wrappers += executable(alias,
+ objects: git.extract_all_objects(recursive: false),
+ dependencies: [libgit, common_main],
+ )
+
+ install_symlink(alias + executable_suffix,
+ install_dir: get_option('libexecdir') / 'git-core',
+ pointing_to: 'git-remote-http',
+ )
+endforeach
+
+foreach symlink : [
+ 'git',
+ 'git-http-backend',
+ 'git-receive-pack',
+ 'git-shell',
+ 'git-upload-archive',
+ 'git-upload-pack',
+ 'scalar',
+]
+ install_symlink(symlink,
+ install_dir: get_option('bindir'),
+ pointing_to: fs.relative_to(get_option('libexecdir') / 'git-core' / symlink, get_option('bindir')),
+ )
+endforeach
+
+scripts_sh = [
+ 'git-difftool--helper.sh',
+ 'git-filter-branch.sh',
+ 'git-merge-octopus.sh',
+ 'git-merge-one-file.sh',
+ 'git-merge-resolve.sh',
+ 'git-mergetool--lib.sh',
+ 'git-mergetool.sh',
+ 'git-quiltimport.sh',
+ 'git-request-pull.sh',
+ 'git-sh-i18n.sh',
+ 'git-sh-setup.sh',
+ 'git-submodule.sh',
+ 'git-web--browse.sh',
+]
+if perl_features_enabled
+ scripts_sh += 'git-instaweb.sh'
+endif
+
+foreach script : scripts_sh
+ test_dependencies += custom_target(
+ input: script,
+ output: fs.stem(script),
+ command: [
+ shell,
+ meson.project_source_root() / 'generate-script.sh',
+ '@INPUT@',
+ '@OUTPUT@',
+ meson.project_build_root() / 'GIT-BUILD-OPTIONS',
+ ],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+endforeach
+
+if perl_features_enabled
+ scripts_perl = [
+ 'git-archimport.perl',
+ 'git-cvsexportcommit.perl',
+ 'git-cvsimport.perl',
+ 'git-cvsserver.perl',
+ 'git-send-email.perl',
+ 'git-svn.perl',
+ ]
+
+ pathsep = ':'
+ if host_machine.system() == 'windows'
+ pathsep = ';'
+ endif
+
+ perl_header_template = 'perl/header_templates/fixed_prefix.template.pl'
+ if get_option('runtime_prefix')
+ perl_header_template = 'perl/header_templates/runtime_prefix.template.pl'
+ endif
+
+ perl_header = configure_file(
+ input: perl_header_template,
+ output: 'GIT-PERL-HEADER',
+ configuration: {
+ 'GITEXECDIR_REL': get_option('libexecdir') / 'git-core',
+ 'PERLLIBDIR_REL': get_option('datadir') / 'perl5',
+ 'LOCALEDIR_REL': get_option('datadir') / 'locale',
+ 'INSTLIBDIR': get_option('datadir') / 'perl5',
+ 'PATHSEP': pathsep,
+ },
+ )
+
+ generate_perl_command = [
+ shell,
+ meson.project_source_root() / 'generate-perl.sh',
+ meson.project_build_root() / 'GIT-BUILD-OPTIONS',
+ git_version,
+ perl_header,
+ '@INPUT@',
+ '@OUTPUT@',
+ ]
+
+ foreach script : scripts_perl
+ generated_script = custom_target(
+ input: script,
+ output: fs.stem(script),
+ command: generate_perl_command,
+ install: true,
+ install_dir: get_option('datadir') / 'perl5',
+ )
+ test_dependencies += generated_script
+ if script == 'git-cvsserver.perl'
+ bin_wrappers += generated_script
+ endif
+ endforeach
+
+ subdir('perl')
+endif
+
+if python.found()
+ scripts_python = [
+ 'git-p4.py'
+ ]
+
+ foreach script : scripts_python
+ fs.copyfile(script, fs.stem(script),
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+ endforeach
+endif
+
+mergetools = [
+ 'mergetools/araxis',
+ 'mergetools/bc',
+ 'mergetools/codecompare',
+ 'mergetools/deltawalker',
+ 'mergetools/diffmerge',
+ 'mergetools/diffuse',
+ 'mergetools/ecmerge',
+ 'mergetools/emerge',
+ 'mergetools/examdiff',
+ 'mergetools/guiffy',
+ 'mergetools/gvimdiff',
+ 'mergetools/kdiff3',
+ 'mergetools/kompare',
+ 'mergetools/meld',
+ 'mergetools/nvimdiff',
+ 'mergetools/opendiff',
+ 'mergetools/p4merge',
+ 'mergetools/smerge',
+ 'mergetools/tkdiff',
+ 'mergetools/tortoisemerge',
+ 'mergetools/vimdiff',
+ 'mergetools/vscode',
+ 'mergetools/winmerge',
+ 'mergetools/xxdiff',
+]
+
+foreach mergetool : mergetools
+ install_data(mergetool, install_dir: get_option('libexecdir') / 'git-core' / 'mergetools')
+endforeach
+
+if intl.found()
+ subdir('po')
+endif
+subdir('contrib')
+subdir('gitweb')
+subdir('templates')
+
+# Everything but the bin-wrappers need to come before this target such that we
+# can properly set up test dependencies. The bin-wrappers themselves are set up
+# at configuration time, so these are fine.
+if get_option('tests')
+ subdir('t')
+endif
+
+subdir('bin-wrappers')
+if get_option('docs') != []
+ subdir('Documentation')
+endif
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 00000000000..9164ed69eaf
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,73 @@
+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('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('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('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('python', type: 'feature', value: 'auto',
+ description: 'Build tools written in Python.')
+
+option('openssl', type: 'feature', value: 'auto',
+ description: 'Support access to HTTPS remotes. OpenSSL may still be pulled in if configured as SHA1 or SHA256 backend.')
+option('CommonCrypto', type: 'feature', value: 'auto',
+ description: 'Build tools written in Python.')
+
+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')
+
+option('macos_use_homebrew_gettext', type: 'boolean', value: true,
+ description: 'Use gettext from Homebrew instead of the slightly-broken system-provided one.')
+
+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')
+
+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).')
+
+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')
diff --git a/perl/FromCPAN/Mail/meson.build b/perl/FromCPAN/Mail/meson.build
new file mode 100644
index 00000000000..129cff161c5
--- /dev/null
+++ b/perl/FromCPAN/Mail/meson.build
@@ -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',
+)
diff --git a/perl/FromCPAN/meson.build b/perl/FromCPAN/meson.build
new file mode 100644
index 00000000000..4e7ea909df3
--- /dev/null
+++ b/perl/FromCPAN/meson.build
@@ -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')
diff --git a/perl/Git/LoadCPAN/Mail/meson.build b/perl/Git/LoadCPAN/Mail/meson.build
new file mode 100644
index 00000000000..7da5b37adb2
--- /dev/null
+++ b/perl/Git/LoadCPAN/Mail/meson.build
@@ -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',
+)
diff --git a/perl/Git/LoadCPAN/meson.build b/perl/Git/LoadCPAN/meson.build
new file mode 100644
index 00000000000..9468c073aeb
--- /dev/null
+++ b/perl/Git/LoadCPAN/meson.build
@@ -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')
diff --git a/perl/Git/SVN/Memoize/meson.build b/perl/Git/SVN/Memoize/meson.build
new file mode 100644
index 00000000000..515ab3dd926
--- /dev/null
+++ b/perl/Git/SVN/Memoize/meson.build
@@ -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',
+)
diff --git a/perl/Git/SVN/meson.build b/perl/Git/SVN/meson.build
new file mode 100644
index 00000000000..8338531041d
--- /dev/null
+++ b/perl/Git/SVN/meson.build
@@ -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')
diff --git a/perl/Git/meson.build b/perl/Git/meson.build
new file mode 100644
index 00000000000..259209d7302
--- /dev/null
+++ b/perl/Git/meson.build
@@ -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')
diff --git a/perl/meson.build b/perl/meson.build
new file mode 100644
index 00000000000..c22d6f8a1a3
--- /dev/null
+++ b/perl/meson.build
@@ -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
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 00000000000..d7154b6395b
--- /dev/null
+++ b/po/meson.build
@@ -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]
diff --git a/subprojects/.gitignore b/subprojects/.gitignore
new file mode 100644
index 00000000000..63ea916ef5f
--- /dev/null
+++ b/subprojects/.gitignore
@@ -0,0 +1 @@
+/*/
diff --git a/subprojects/curl.wrap b/subprojects/curl.wrap
new file mode 100644
index 00000000000..f7e384b85cf
--- /dev/null
+++ b/subprojects/curl.wrap
@@ -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
diff --git a/subprojects/expat.wrap b/subprojects/expat.wrap
new file mode 100644
index 00000000000..2e0427dcfd1
--- /dev/null
+++ b/subprojects/expat.wrap
@@ -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
diff --git a/subprojects/openssl.wrap b/subprojects/openssl.wrap
new file mode 100644
index 00000000000..873d55106e9
--- /dev/null
+++ b/subprojects/openssl.wrap
@@ -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
diff --git a/subprojects/pcre2.wrap b/subprojects/pcre2.wrap
new file mode 100644
index 00000000000..7e184472543
--- /dev/null
+++ b/subprojects/pcre2.wrap
@@ -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
diff --git a/subprojects/zlib.wrap b/subprojects/zlib.wrap
new file mode 100644
index 00000000000..aa14de17740
--- /dev/null
+++ b/subprojects/zlib.wrap
@@ -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
diff --git a/t/helper/meson.build b/t/helper/meson.build
new file mode 100644
index 00000000000..5e83884246e
--- /dev/null
+++ b/t/helper/meson.build
@@ -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
diff --git a/t/meson.build b/t/meson.build
new file mode 100644
index 00000000000..9ec0b7fa34a
--- /dev/null
+++ b/t/meson.build
@@ -0,0 +1,1106 @@
+clar_test_suites = [
+ 'unit-tests/ctype.c',
+ 'unit-tests/strvec.c',
+]
+
+clar_sources = [
+ 'unit-tests/clar/clar.c',
+ 'unit-tests/unit-test.c',
+]
+
+clar_decls_h = custom_target(
+ input: clar_test_suites,
+ output: 'clar-decls.h',
+ command : [shell, meson.current_source_dir() + '/unit-tests/generate-clar-decls.sh', '@OUTPUT@', '@INPUT@'],
+ env: script_environment,
+)
+clar_sources += clar_decls_h
+
+clar_sources += custom_target(
+ input: clar_decls_h,
+ output: 'clar.suite',
+ feed: true,
+ capture: true,
+ command : [awk, '-f', meson.current_source_dir() + '/unit-tests/clar-generate.awk'],
+)
+
+clar_unit_tests = executable('unit-tests',
+ sources: clar_sources + clar_test_suites,
+ dependencies: [libgit, common_main],
+)
+test('unit-tests', clar_unit_tests)
+
+unit_test_programs = [
+ 'unit-tests/t-example-decorate.c',
+ 'unit-tests/t-hash.c',
+ 'unit-tests/t-hashmap.c',
+ 'unit-tests/t-mem-pool.c',
+ 'unit-tests/t-oid-array.c',
+ 'unit-tests/t-oidmap.c',
+ 'unit-tests/t-oidtree.c',
+ 'unit-tests/t-prio-queue.c',
+ 'unit-tests/t-reftable-basics.c',
+ 'unit-tests/t-reftable-block.c',
+ 'unit-tests/t-reftable-merged.c',
+ 'unit-tests/t-reftable-pq.c',
+ 'unit-tests/t-reftable-reader.c',
+ 'unit-tests/t-reftable-readwrite.c',
+ 'unit-tests/t-reftable-record.c',
+ 'unit-tests/t-reftable-stack.c',
+ 'unit-tests/t-reftable-tree.c',
+ 'unit-tests/t-strbuf.c',
+ 'unit-tests/t-strcmp-offset.c',
+ 'unit-tests/t-trailer.c',
+ 'unit-tests/t-urlmatch-normalization.c',
+]
+
+foreach unit_test_program : unit_test_programs
+ unit_test_name = fs.stem(unit_test_program)
+ unit_test = executable(unit_test_name,
+ sources: [
+ 'unit-tests/test-lib.c',
+ 'unit-tests/lib-oid.c',
+ 'unit-tests/lib-reftable.c',
+ unit_test_program,
+ ],
+ dependencies: [libgit, common_main],
+ )
+ test(unit_test_name, unit_test,
+ workdir: meson.current_source_dir(),
+ timeout: 0,
+ )
+endforeach
+
+subdir('helper')
+
+integration_tests = [
+ 't0000-basic.sh',
+ 't0001-init.sh',
+ 't0002-gitfile.sh',
+ 't0003-attributes.sh',
+ 't0004-unwritable.sh',
+ 't0005-signals.sh',
+ 't0006-date.sh',
+ 't0007-git-var.sh',
+ 't0008-ignores.sh',
+ 't0010-racy-git.sh',
+ 't0012-help.sh',
+ 't0013-sha1dc.sh',
+ 't0014-alias.sh',
+ 't0017-env-helper.sh',
+ 't0018-advice.sh',
+ 't0019-json-writer.sh',
+ 't0020-crlf.sh',
+ 't0021-conversion.sh',
+ 't0022-crlf-rename.sh',
+ 't0023-crlf-am.sh',
+ 't0024-crlf-archive.sh',
+ 't0025-crlf-renormalize.sh',
+ 't0026-eol-config.sh',
+ 't0027-auto-crlf.sh',
+ 't0028-working-tree-encoding.sh',
+ 't0029-core-unsetenvvars.sh',
+ 't0030-stripspace.sh',
+ 't0033-safe-directory.sh',
+ 't0034-root-safe-directory.sh',
+ 't0035-safe-bare-repository.sh',
+ 't0040-parse-options.sh',
+ 't0041-usage.sh',
+ 't0050-filesystem.sh',
+ 't0051-windows-named-pipe.sh',
+ 't0052-simple-ipc.sh',
+ 't0055-beyond-symlinks.sh',
+ 't0056-git-C.sh',
+ 't0060-path-utils.sh',
+ 't0061-run-command.sh',
+ 't0062-revision-walking.sh',
+ 't0063-string-list.sh',
+ 't0066-dir-iterator.sh',
+ 't0067-parse_pathspec_file.sh',
+ 't0068-for-each-repo.sh',
+ 't0070-fundamental.sh',
+ 't0071-sort.sh',
+ 't0080-unit-test-output.sh',
+ 't0081-find-pack.sh',
+ 't0090-cache-tree.sh',
+ 't0091-bugreport.sh',
+ 't0092-diagnose.sh',
+ 't0095-bloom.sh',
+ 't0100-previous.sh',
+ 't0101-at-syntax.sh',
+ 't0200-gettext-basic.sh',
+ 't0201-gettext-fallbacks.sh',
+ 't0202-gettext-perl.sh',
+ 't0203-gettext-setlocale-sanity.sh',
+ 't0204-gettext-reencode-sanity.sh',
+ 't0210-trace2-normal.sh',
+ 't0211-trace2-perf.sh',
+ 't0212-trace2-event.sh',
+ 't0300-credentials.sh',
+ 't0301-credential-cache.sh',
+ 't0302-credential-store.sh',
+ 't0303-credential-external.sh',
+ 't0410-partial-clone.sh',
+ 't0411-clone-from-partial.sh',
+ 't0450-txt-doc-vs-help.sh',
+ 't0500-progress-display.sh',
+ 't0600-reffiles-backend.sh',
+ 't0601-reffiles-pack-refs.sh',
+ 't0602-reffiles-fsck.sh',
+ 't0610-reftable-basics.sh',
+ 't0611-reftable-httpd.sh',
+ 't0612-reftable-jgit-compatibility.sh',
+ 't0613-reftable-write-options.sh',
+ 't1000-read-tree-m-3way.sh',
+ 't1001-read-tree-m-2way.sh',
+ 't1002-read-tree-m-u-2way.sh',
+ 't1003-read-tree-prefix.sh',
+ 't1004-read-tree-m-u-wf.sh',
+ 't1005-read-tree-reset.sh',
+ 't1006-cat-file.sh',
+ 't1007-hash-object.sh',
+ 't1008-read-tree-overlay.sh',
+ 't1009-read-tree-new-index.sh',
+ 't1010-mktree.sh',
+ 't1011-read-tree-sparse-checkout.sh',
+ 't1012-read-tree-df.sh',
+ 't1013-read-tree-submodule.sh',
+ 't1014-read-tree-confusing.sh',
+ 't1015-read-index-unmerged.sh',
+ 't1016-compatObjectFormat.sh',
+ 't1020-subdirectory.sh',
+ 't1021-rerere-in-workdir.sh',
+ 't1022-read-tree-partial-clone.sh',
+ 't1050-large.sh',
+ 't1051-large-conversion.sh',
+ 't1060-object-corruption.sh',
+ 't1090-sparse-checkout-scope.sh',
+ 't1091-sparse-checkout-builtin.sh',
+ 't1092-sparse-checkout-compatibility.sh',
+ 't1100-commit-tree-options.sh',
+ 't1300-config.sh',
+ 't1301-shared-repo.sh',
+ 't1302-repo-version.sh',
+ 't1303-wacky-config.sh',
+ 't1304-default-acl.sh',
+ 't1305-config-include.sh',
+ 't1306-xdg-files.sh',
+ 't1307-config-blob.sh',
+ 't1308-config-set.sh',
+ 't1309-early-config.sh',
+ 't1310-config-default.sh',
+ 't1350-config-hooks-path.sh',
+ 't1400-update-ref.sh',
+ 't1401-symbolic-ref.sh',
+ 't1402-check-ref-format.sh',
+ 't1403-show-ref.sh',
+ 't1404-update-ref-errors.sh',
+ 't1405-main-ref-store.sh',
+ 't1406-submodule-ref-store.sh',
+ 't1407-worktree-ref-store.sh',
+ 't1408-packed-refs.sh',
+ 't1409-avoid-packing-refs.sh',
+ 't1410-reflog.sh',
+ 't1411-reflog-show.sh',
+ 't1412-reflog-loop.sh',
+ 't1413-reflog-detach.sh',
+ 't1414-reflog-walk.sh',
+ 't1415-worktree-refs.sh',
+ 't1416-ref-transaction-hooks.sh',
+ 't1417-reflog-updateref.sh',
+ 't1418-reflog-exists.sh',
+ 't1419-exclude-refs.sh',
+ 't1420-lost-found.sh',
+ 't1430-bad-ref-name.sh',
+ 't1450-fsck.sh',
+ 't1451-fsck-buffer.sh',
+ 't1460-refs-migrate.sh',
+ 't1500-rev-parse.sh',
+ 't1501-work-tree.sh',
+ 't1502-rev-parse-parseopt.sh',
+ 't1503-rev-parse-verify.sh',
+ 't1504-ceiling-dirs.sh',
+ 't1505-rev-parse-last.sh',
+ 't1506-rev-parse-diagnosis.sh',
+ 't1507-rev-parse-upstream.sh',
+ 't1508-at-combinations.sh',
+ 't1509-root-work-tree.sh',
+ 't1510-repo-setup.sh',
+ 't1511-rev-parse-caret.sh',
+ 't1512-rev-parse-disambiguation.sh',
+ 't1513-rev-parse-prefix.sh',
+ 't1514-rev-parse-push.sh',
+ 't1515-rev-parse-outside-repo.sh',
+ 't1517-outside-repo.sh',
+ 't1600-index.sh',
+ 't1601-index-bogus.sh',
+ 't1700-split-index.sh',
+ 't1701-racy-split-index.sh',
+ 't1800-hook.sh',
+ 't2000-conflict-when-checking-files-out.sh',
+ 't2002-checkout-cache-u.sh',
+ 't2003-checkout-cache-mkdir.sh',
+ 't2004-checkout-cache-temp.sh',
+ 't2005-checkout-index-symlinks.sh',
+ 't2006-checkout-index-basic.sh',
+ 't2007-checkout-symlink.sh',
+ 't2008-checkout-subdir.sh',
+ 't2009-checkout-statinfo.sh',
+ 't2010-checkout-ambiguous.sh',
+ 't2011-checkout-invalid-head.sh',
+ 't2012-checkout-last.sh',
+ 't2013-checkout-submodule.sh',
+ 't2014-checkout-switch.sh',
+ 't2015-checkout-unborn.sh',
+ 't2016-checkout-patch.sh',
+ 't2017-checkout-orphan.sh',
+ 't2018-checkout-branch.sh',
+ 't2019-checkout-ambiguous-ref.sh',
+ 't2020-checkout-detach.sh',
+ 't2021-checkout-overwrite.sh',
+ 't2022-checkout-paths.sh',
+ 't2023-checkout-m.sh',
+ 't2024-checkout-dwim.sh',
+ 't2025-checkout-no-overlay.sh',
+ 't2026-checkout-pathspec-file.sh',
+ 't2027-checkout-track.sh',
+ 't2030-unresolve-info.sh',
+ 't2050-git-dir-relative.sh',
+ 't2060-switch.sh',
+ 't2070-restore.sh',
+ 't2071-restore-patch.sh',
+ 't2072-restore-pathspec-file.sh',
+ 't2080-parallel-checkout-basics.sh',
+ 't2081-parallel-checkout-collisions.sh',
+ 't2082-parallel-checkout-attributes.sh',
+ 't2100-update-cache-badpath.sh',
+ 't2101-update-index-reupdate.sh',
+ 't2102-update-index-symlinks.sh',
+ 't2103-update-index-ignore-missing.sh',
+ 't2104-update-index-skip-worktree.sh',
+ 't2105-update-index-gitfile.sh',
+ 't2106-update-index-assume-unchanged.sh',
+ 't2107-update-index-basic.sh',
+ 't2108-update-index-refresh-racy.sh',
+ 't2200-add-update.sh',
+ 't2201-add-update-typechange.sh',
+ 't2202-add-addremove.sh',
+ 't2203-add-intent.sh',
+ 't2204-add-ignored.sh',
+ 't2205-add-worktree-config.sh',
+ 't2300-cd-to-toplevel.sh',
+ 't2400-worktree-add.sh',
+ 't2401-worktree-prune.sh',
+ 't2402-worktree-list.sh',
+ 't2403-worktree-move.sh',
+ 't2404-worktree-config.sh',
+ 't2405-worktree-submodule.sh',
+ 't2406-worktree-repair.sh',
+ 't2407-worktree-heads.sh',
+ 't2408-worktree-relative.sh',
+ 't2500-untracked-overwriting.sh',
+ 't2501-cwd-empty.sh',
+ 't3000-ls-files-others.sh',
+ 't3001-ls-files-others-exclude.sh',
+ 't3002-ls-files-dashpath.sh',
+ 't3003-ls-files-exclude.sh',
+ 't3004-ls-files-basic.sh',
+ 't3005-ls-files-relative.sh',
+ 't3006-ls-files-long.sh',
+ 't3007-ls-files-recurse-submodules.sh',
+ 't3008-ls-files-lazy-init-name-hash.sh',
+ 't3009-ls-files-others-nonsubmodule.sh',
+ 't3010-ls-files-killed-modified.sh',
+ 't3011-common-prefixes-and-directory-traversal.sh',
+ 't3012-ls-files-dedup.sh',
+ 't3013-ls-files-format.sh',
+ 't3020-ls-files-error-unmatch.sh',
+ 't3040-subprojects-basic.sh',
+ 't3050-subprojects-fetch.sh',
+ 't3060-ls-files-with-tree.sh',
+ 't3070-wildmatch.sh',
+ 't3100-ls-tree-restrict.sh',
+ 't3101-ls-tree-dirname.sh',
+ 't3102-ls-tree-wildcards.sh',
+ 't3103-ls-tree-misc.sh',
+ 't3104-ls-tree-format.sh',
+ 't3105-ls-tree-output.sh',
+ 't3200-branch.sh',
+ 't3201-branch-contains.sh',
+ 't3202-show-branch.sh',
+ 't3203-branch-output.sh',
+ 't3204-branch-name-interpretation.sh',
+ 't3205-branch-color.sh',
+ 't3206-range-diff.sh',
+ 't3207-branch-submodule.sh',
+ 't3211-peel-ref.sh',
+ 't3300-funny-names.sh',
+ 't3301-notes.sh',
+ 't3302-notes-index-expensive.sh',
+ 't3303-notes-subtrees.sh',
+ 't3304-notes-mixed.sh',
+ 't3305-notes-fanout.sh',
+ 't3306-notes-prune.sh',
+ 't3307-notes-man.sh',
+ 't3308-notes-merge.sh',
+ 't3309-notes-merge-auto-resolve.sh',
+ 't3310-notes-merge-manual-resolve.sh',
+ 't3311-notes-merge-fanout.sh',
+ 't3320-notes-merge-worktrees.sh',
+ 't3321-notes-stripspace.sh',
+ 't3400-rebase.sh',
+ 't3401-rebase-and-am-rename.sh',
+ 't3402-rebase-merge.sh',
+ 't3403-rebase-skip.sh',
+ 't3404-rebase-interactive.sh',
+ 't3405-rebase-malformed.sh',
+ 't3406-rebase-message.sh',
+ 't3407-rebase-abort.sh',
+ 't3408-rebase-multi-line.sh',
+ 't3409-rebase-environ.sh',
+ 't3412-rebase-root.sh',
+ 't3413-rebase-hook.sh',
+ 't3415-rebase-autosquash.sh',
+ 't3416-rebase-onto-threedots.sh',
+ 't3417-rebase-whitespace-fix.sh',
+ 't3418-rebase-continue.sh',
+ 't3419-rebase-patch-id.sh',
+ 't3420-rebase-autostash.sh',
+ 't3421-rebase-topology-linear.sh',
+ 't3422-rebase-incompatible-options.sh',
+ 't3423-rebase-reword.sh',
+ 't3424-rebase-empty.sh',
+ 't3425-rebase-topology-merges.sh',
+ 't3426-rebase-submodule.sh',
+ 't3427-rebase-subtree.sh',
+ 't3428-rebase-signoff.sh',
+ 't3429-rebase-edit-todo.sh',
+ 't3430-rebase-merges.sh',
+ 't3431-rebase-fork-point.sh',
+ 't3432-rebase-fast-forward.sh',
+ 't3433-rebase-across-mode-change.sh',
+ 't3434-rebase-i18n.sh',
+ 't3435-rebase-gpg-sign.sh',
+ 't3436-rebase-more-options.sh',
+ 't3437-rebase-fixup-options.sh',
+ 't3438-rebase-broken-files.sh',
+ 't3500-cherry.sh',
+ 't3501-revert-cherry-pick.sh',
+ 't3502-cherry-pick-merge.sh',
+ 't3503-cherry-pick-root.sh',
+ 't3504-cherry-pick-rerere.sh',
+ 't3505-cherry-pick-empty.sh',
+ 't3506-cherry-pick-ff.sh',
+ 't3507-cherry-pick-conflict.sh',
+ 't3508-cherry-pick-many-commits.sh',
+ 't3509-cherry-pick-merge-df.sh',
+ 't3510-cherry-pick-sequence.sh',
+ 't3511-cherry-pick-x.sh',
+ 't3512-cherry-pick-submodule.sh',
+ 't3513-revert-submodule.sh',
+ 't3514-cherry-pick-revert-gpg.sh',
+ 't3600-rm.sh',
+ 't3601-rm-pathspec-file.sh',
+ 't3602-rm-sparse-checkout.sh',
+ 't3650-replay-basics.sh',
+ 't3700-add.sh',
+ 't3701-add-interactive.sh',
+ 't3702-add-edit.sh',
+ 't3703-add-magic-pathspec.sh',
+ 't3704-add-pathspec-file.sh',
+ 't3705-add-sparse-checkout.sh',
+ 't3800-mktag.sh',
+ 't3900-i18n-commit.sh',
+ 't3901-i18n-patch.sh',
+ 't3902-quoted.sh',
+ 't3903-stash.sh',
+ 't3904-stash-patch.sh',
+ 't3905-stash-include-untracked.sh',
+ 't3906-stash-submodule.sh',
+ 't3907-stash-show-config.sh',
+ 't3908-stash-in-worktree.sh',
+ 't3909-stash-pathspec-file.sh',
+ 't3910-mac-os-precompose.sh',
+ 't3920-crlf-messages.sh',
+ 't4000-diff-format.sh',
+ 't4001-diff-rename.sh',
+ 't4002-diff-basic.sh',
+ 't4003-diff-rename-1.sh',
+ 't4004-diff-rename-symlink.sh',
+ 't4005-diff-rename-2.sh',
+ 't4006-diff-mode.sh',
+ 't4007-rename-3.sh',
+ 't4008-diff-break-rewrite.sh',
+ 't4009-diff-rename-4.sh',
+ 't4010-diff-pathspec.sh',
+ 't4011-diff-symlink.sh',
+ 't4012-diff-binary.sh',
+ 't4013-diff-various.sh',
+ 't4014-format-patch.sh',
+ 't4015-diff-whitespace.sh',
+ 't4016-diff-quote.sh',
+ 't4017-diff-retval.sh',
+ 't4018-diff-funcname.sh',
+ 't4019-diff-wserror.sh',
+ 't4020-diff-external.sh',
+ 't4021-format-patch-numbered.sh',
+ 't4022-diff-rewrite.sh',
+ 't4023-diff-rename-typechange.sh',
+ 't4024-diff-optimize-common.sh',
+ 't4025-hunk-header.sh',
+ 't4026-color.sh',
+ 't4027-diff-submodule.sh',
+ 't4028-format-patch-mime-headers.sh',
+ 't4029-diff-trailing-space.sh',
+ 't4030-diff-textconv.sh',
+ 't4031-diff-rewrite-binary.sh',
+ 't4032-diff-inter-hunk-context.sh',
+ 't4033-diff-patience.sh',
+ 't4034-diff-words.sh',
+ 't4035-diff-quiet.sh',
+ 't4036-format-patch-signer-mime.sh',
+ 't4037-diff-r-t-dirs.sh',
+ 't4038-diff-combined.sh',
+ 't4039-diff-assume-unchanged.sh',
+ 't4040-whitespace-status.sh',
+ 't4041-diff-submodule-option.sh',
+ 't4042-diff-textconv-caching.sh',
+ 't4043-diff-rename-binary.sh',
+ 't4044-diff-index-unique-abbrev.sh',
+ 't4045-diff-relative.sh',
+ 't4046-diff-unmerged.sh',
+ 't4047-diff-dirstat.sh',
+ 't4048-diff-combined-binary.sh',
+ 't4049-diff-stat-count.sh',
+ 't4050-diff-histogram.sh',
+ 't4051-diff-function-context.sh',
+ 't4052-stat-output.sh',
+ 't4053-diff-no-index.sh',
+ 't4054-diff-bogus-tree.sh',
+ 't4055-diff-context.sh',
+ 't4056-diff-order.sh',
+ 't4057-diff-combined-paths.sh',
+ 't4058-diff-duplicates.sh',
+ 't4059-diff-submodule-not-initialized.sh',
+ 't4060-diff-submodule-option-diff-format.sh',
+ 't4061-diff-indent.sh',
+ 't4062-diff-pickaxe.sh',
+ 't4063-diff-blobs.sh',
+ 't4064-diff-oidfind.sh',
+ 't4065-diff-anchored.sh',
+ 't4066-diff-emit-delay.sh',
+ 't4067-diff-partial-clone.sh',
+ 't4068-diff-symmetric-merge-base.sh',
+ 't4069-remerge-diff.sh',
+ 't4100-apply-stat.sh',
+ 't4101-apply-nonl.sh',
+ 't4102-apply-rename.sh',
+ 't4103-apply-binary.sh',
+ 't4104-apply-boundary.sh',
+ 't4105-apply-fuzz.sh',
+ 't4106-apply-stdin.sh',
+ 't4107-apply-ignore-whitespace.sh',
+ 't4108-apply-threeway.sh',
+ 't4109-apply-multifrag.sh',
+ 't4110-apply-scan.sh',
+ 't4111-apply-subdir.sh',
+ 't4112-apply-renames.sh',
+ 't4113-apply-ending.sh',
+ 't4114-apply-typechange.sh',
+ 't4115-apply-symlink.sh',
+ 't4116-apply-reverse.sh',
+ 't4117-apply-reject.sh',
+ 't4118-apply-empty-context.sh',
+ 't4119-apply-config.sh',
+ 't4120-apply-popt.sh',
+ 't4121-apply-diffs.sh',
+ 't4122-apply-symlink-inside.sh',
+ 't4123-apply-shrink.sh',
+ 't4124-apply-ws-rule.sh',
+ 't4125-apply-ws-fuzz.sh',
+ 't4126-apply-empty.sh',
+ 't4127-apply-same-fn.sh',
+ 't4128-apply-root.sh',
+ 't4129-apply-samemode.sh',
+ 't4130-apply-criss-cross-rename.sh',
+ 't4131-apply-fake-ancestor.sh',
+ 't4132-apply-removal.sh',
+ 't4133-apply-filenames.sh',
+ 't4134-apply-submodule.sh',
+ 't4135-apply-weird-filenames.sh',
+ 't4136-apply-check.sh',
+ 't4137-apply-submodule.sh',
+ 't4138-apply-ws-expansion.sh',
+ 't4139-apply-escape.sh',
+ 't4140-apply-ita.sh',
+ 't4141-apply-too-large.sh',
+ 't4150-am.sh',
+ 't4151-am-abort.sh',
+ 't4152-am-subjects.sh',
+ 't4153-am-resume-override-opts.sh',
+ 't4200-rerere.sh',
+ 't4201-shortlog.sh',
+ 't4202-log.sh',
+ 't4203-mailmap.sh',
+ 't4204-patch-id.sh',
+ 't4205-log-pretty-formats.sh',
+ 't4206-log-follow-harder-copies.sh',
+ 't4207-log-decoration-colors.sh',
+ 't4208-log-magic-pathspec.sh',
+ 't4209-log-pickaxe.sh',
+ 't4210-log-i18n.sh',
+ 't4211-line-log.sh',
+ 't4212-log-corrupt.sh',
+ 't4213-log-tabexpand.sh',
+ 't4214-log-graph-octopus.sh',
+ 't4215-log-skewed-merges.sh',
+ 't4216-log-bloom.sh',
+ 't4217-log-limit.sh',
+ 't4252-am-options.sh',
+ 't4253-am-keep-cr-dos.sh',
+ 't4254-am-corrupt.sh',
+ 't4255-am-submodule.sh',
+ 't4256-am-format-flowed.sh',
+ 't4257-am-interactive.sh',
+ 't4258-am-quoted-cr.sh',
+ 't4300-merge-tree.sh',
+ 't4301-merge-tree-write-tree.sh',
+ 't5000-tar-tree.sh',
+ 't5001-archive-attr.sh',
+ 't5002-archive-attr-pattern.sh',
+ 't5003-archive-zip.sh',
+ 't5004-archive-corner-cases.sh',
+ 't5100-mailinfo.sh',
+ 't5150-request-pull.sh',
+ 't5200-update-server-info.sh',
+ 't5300-pack-object.sh',
+ 't5301-sliding-window.sh',
+ 't5302-pack-index.sh',
+ 't5303-pack-corruption-resilience.sh',
+ 't5304-prune.sh',
+ 't5305-include-tag.sh',
+ 't5306-pack-nobase.sh',
+ 't5307-pack-missing-commit.sh',
+ 't5308-pack-detect-duplicates.sh',
+ 't5309-pack-delta-cycles.sh',
+ 't5310-pack-bitmaps.sh',
+ 't5311-pack-bitmaps-shallow.sh',
+ 't5312-prune-corruption.sh',
+ 't5313-pack-bounds-checks.sh',
+ 't5314-pack-cycle-detection.sh',
+ 't5315-pack-objects-compression.sh',
+ 't5316-pack-delta-depth.sh',
+ 't5317-pack-objects-filter-objects.sh',
+ 't5318-commit-graph.sh',
+ 't5319-multi-pack-index.sh',
+ 't5320-delta-islands.sh',
+ 't5321-pack-large-objects.sh',
+ 't5322-pack-objects-sparse.sh',
+ 't5323-pack-redundant.sh',
+ 't5324-split-commit-graph.sh',
+ 't5325-reverse-index.sh',
+ 't5326-multi-pack-bitmaps.sh',
+ 't5327-multi-pack-bitmaps-rev.sh',
+ 't5328-commit-graph-64bit-time.sh',
+ 't5329-pack-objects-cruft.sh',
+ 't5330-no-lazy-fetch-with-commit-graph.sh',
+ 't5331-pack-objects-stdin.sh',
+ 't5332-multi-pack-reuse.sh',
+ 't5333-pseudo-merge-bitmaps.sh',
+ 't5334-incremental-multi-pack-index.sh',
+ 't5351-unpack-large-objects.sh',
+ 't5400-send-pack.sh',
+ 't5401-update-hooks.sh',
+ 't5402-post-merge-hook.sh',
+ 't5403-post-checkout-hook.sh',
+ 't5404-tracking-branches.sh',
+ 't5405-send-pack-rewind.sh',
+ 't5406-remote-rejects.sh',
+ 't5407-post-rewrite-hook.sh',
+ 't5408-send-pack-stdin.sh',
+ 't5409-colorize-remote-messages.sh',
+ 't5410-receive-pack-alternates.sh',
+ 't5411-proc-receive-hook.sh',
+ 't5500-fetch-pack.sh',
+ 't5501-fetch-push-alternates.sh',
+ 't5502-quickfetch.sh',
+ 't5503-tagfollow.sh',
+ 't5504-fetch-receive-strict.sh',
+ 't5505-remote.sh',
+ 't5506-remote-groups.sh',
+ 't5507-remote-environment.sh',
+ 't5509-fetch-push-namespaces.sh',
+ 't5510-fetch.sh',
+ 't5511-refspec.sh',
+ 't5512-ls-remote.sh',
+ 't5513-fetch-track.sh',
+ 't5514-fetch-multiple.sh',
+ 't5515-fetch-merge-logic.sh',
+ 't5516-fetch-push.sh',
+ 't5517-push-mirror.sh',
+ 't5518-fetch-exit-status.sh',
+ 't5519-push-alternates.sh',
+ 't5520-pull.sh',
+ 't5521-pull-options.sh',
+ 't5522-pull-symlink.sh',
+ 't5523-push-upstream.sh',
+ 't5524-pull-msg.sh',
+ 't5525-fetch-tagopt.sh',
+ 't5526-fetch-submodules.sh',
+ 't5527-fetch-odd-refs.sh',
+ 't5528-push-default.sh',
+ 't5529-push-errors.sh',
+ 't5530-upload-pack-error.sh',
+ 't5531-deep-submodule-push.sh',
+ 't5532-fetch-proxy.sh',
+ 't5533-push-cas.sh',
+ 't5534-push-signed.sh',
+ 't5535-fetch-push-symref.sh',
+ 't5536-fetch-conflicts.sh',
+ 't5537-fetch-shallow.sh',
+ 't5538-push-shallow.sh',
+ 't5539-fetch-http-shallow.sh',
+ 't5540-http-push-webdav.sh',
+ 't5541-http-push-smart.sh',
+ 't5542-push-http-shallow.sh',
+ 't5543-atomic-push.sh',
+ 't5544-pack-objects-hook.sh',
+ 't5545-push-options.sh',
+ 't5546-receive-limits.sh',
+ 't5547-push-quarantine.sh',
+ 't5548-push-porcelain.sh',
+ 't5549-fetch-push-http.sh',
+ 't5550-http-fetch-dumb.sh',
+ 't5551-http-fetch-smart.sh',
+ 't5552-skipping-fetch-negotiator.sh',
+ 't5553-set-upstream.sh',
+ 't5554-noop-fetch-negotiator.sh',
+ 't5555-http-smart-common.sh',
+ 't5557-http-get.sh',
+ 't5558-clone-bundle-uri.sh',
+ 't5559-http-fetch-smart-http2.sh',
+ 't5560-http-backend-noserver.sh',
+ 't5561-http-backend.sh',
+ 't5562-http-backend-content-length.sh',
+ 't5563-simple-http-auth.sh',
+ 't5564-http-proxy.sh',
+ 't5570-git-daemon.sh',
+ 't5571-pre-push-hook.sh',
+ 't5572-pull-submodule.sh',
+ 't5573-pull-verify-signatures.sh',
+ 't5574-fetch-output.sh',
+ 't5580-unc-paths.sh',
+ 't5581-http-curl-verbose.sh',
+ 't5582-fetch-negative-refspec.sh',
+ 't5583-push-branches.sh',
+ 't5600-clone-fail-cleanup.sh',
+ 't5601-clone.sh',
+ 't5602-clone-remote-exec.sh',
+ 't5603-clone-dirname.sh',
+ 't5604-clone-reference.sh',
+ 't5605-clone-local.sh',
+ 't5606-clone-options.sh',
+ 't5607-clone-bundle.sh',
+ 't5608-clone-2gb.sh',
+ 't5609-clone-branch.sh',
+ 't5610-clone-detached.sh',
+ 't5611-clone-config.sh',
+ 't5612-clone-refspec.sh',
+ 't5613-info-alternate.sh',
+ 't5614-clone-submodules-shallow.sh',
+ 't5615-alternate-env.sh',
+ 't5616-partial-clone.sh',
+ 't5617-clone-submodules-remote.sh',
+ 't5618-alternate-refs.sh',
+ 't5619-clone-local-ambiguous-transport.sh',
+ 't5700-protocol-v1.sh',
+ 't5701-git-serve.sh',
+ 't5702-protocol-v2.sh',
+ 't5703-upload-pack-ref-in-want.sh',
+ 't5704-protocol-violations.sh',
+ 't5705-session-id-in-capabilities.sh',
+ 't5730-protocol-v2-bundle-uri-file.sh',
+ 't5731-protocol-v2-bundle-uri-git.sh',
+ 't5732-protocol-v2-bundle-uri-http.sh',
+ 't5750-bundle-uri-parse.sh',
+ 't5801-remote-helpers.sh',
+ 't5802-connect-helper.sh',
+ 't5810-proto-disable-local.sh',
+ 't5811-proto-disable-git.sh',
+ 't5812-proto-disable-http.sh',
+ 't5813-proto-disable-ssh.sh',
+ 't5814-proto-disable-ext.sh',
+ 't5815-submodule-protos.sh',
+ 't5900-repo-selection.sh',
+ 't6000-rev-list-misc.sh',
+ 't6001-rev-list-graft.sh',
+ 't6002-rev-list-bisect.sh',
+ 't6003-rev-list-topo-order.sh',
+ 't6004-rev-list-path-optim.sh',
+ 't6005-rev-list-count.sh',
+ 't6006-rev-list-format.sh',
+ 't6007-rev-list-cherry-pick-file.sh',
+ 't6008-rev-list-submodule.sh',
+ 't6009-rev-list-parent.sh',
+ 't6010-merge-base.sh',
+ 't6011-rev-list-with-bad-commit.sh',
+ 't6012-rev-list-simplify.sh',
+ 't6013-rev-list-reverse-parents.sh',
+ 't6014-rev-list-all.sh',
+ 't6016-rev-list-graph-simplify-history.sh',
+ 't6017-rev-list-stdin.sh',
+ 't6018-rev-list-glob.sh',
+ 't6019-rev-list-ancestry-path.sh',
+ 't6020-bundle-misc.sh',
+ 't6021-rev-list-exclude-hidden.sh',
+ 't6022-rev-list-missing.sh',
+ 't6030-bisect-porcelain.sh',
+ 't6040-tracking-info.sh',
+ 't6041-bisect-submodule.sh',
+ 't6050-replace.sh',
+ 't6060-merge-index.sh',
+ 't6100-rev-list-in-order.sh',
+ 't6101-rev-parse-parents.sh',
+ 't6102-rev-list-unexpected-objects.sh',
+ 't6110-rev-list-sparse.sh',
+ 't6111-rev-list-treesame.sh',
+ 't6112-rev-list-filters-objects.sh',
+ 't6113-rev-list-bitmap-filters.sh',
+ 't6114-keep-packs.sh',
+ 't6115-rev-list-du.sh',
+ 't6120-describe.sh',
+ 't6130-pathspec-noglob.sh',
+ 't6131-pathspec-icase.sh',
+ 't6132-pathspec-exclude.sh',
+ 't6133-pathspec-rev-dwim.sh',
+ 't6134-pathspec-in-submodule.sh',
+ 't6135-pathspec-with-attrs.sh',
+ 't6136-pathspec-in-bare.sh',
+ 't6200-fmt-merge-msg.sh',
+ 't6300-for-each-ref.sh',
+ 't6301-for-each-ref-errors.sh',
+ 't6302-for-each-ref-filter.sh',
+ 't6400-merge-df.sh',
+ 't6401-merge-criss-cross.sh',
+ 't6402-merge-rename.sh',
+ 't6403-merge-file.sh',
+ 't6404-recursive-merge.sh',
+ 't6405-merge-symlinks.sh',
+ 't6406-merge-attr.sh',
+ 't6407-merge-binary.sh',
+ 't6408-merge-up-to-date.sh',
+ 't6409-merge-subtree.sh',
+ 't6411-merge-filemode.sh',
+ 't6412-merge-large-rename.sh',
+ 't6413-merge-crlf.sh',
+ 't6414-merge-rename-nocruft.sh',
+ 't6415-merge-dir-to-symlink.sh',
+ 't6416-recursive-corner-cases.sh',
+ 't6417-merge-ours-theirs.sh',
+ 't6418-merge-text-auto.sh',
+ 't6419-merge-ignorecase.sh',
+ 't6421-merge-partial-clone.sh',
+ 't6422-merge-rename-corner-cases.sh',
+ 't6423-merge-rename-directories.sh',
+ 't6424-merge-unrelated-index-changes.sh',
+ 't6425-merge-rename-delete.sh',
+ 't6426-merge-skip-unneeded-updates.sh',
+ 't6427-diff3-conflict-markers.sh',
+ 't6428-merge-conflicts-sparse.sh',
+ 't6429-merge-sequence-rename-caching.sh',
+ 't6430-merge-recursive.sh',
+ 't6431-merge-criscross.sh',
+ 't6432-merge-recursive-space-options.sh',
+ 't6433-merge-toplevel.sh',
+ 't6434-merge-recursive-rename-options.sh',
+ 't6435-merge-sparse.sh',
+ 't6436-merge-overwrite.sh',
+ 't6437-submodule-merge.sh',
+ 't6438-submodule-directory-file-conflicts.sh',
+ 't6439-merge-co-error-msgs.sh',
+ 't6500-gc.sh',
+ 't6501-freshen-objects.sh',
+ 't6600-test-reach.sh',
+ 't6700-tree-depth.sh',
+ 't7001-mv.sh',
+ 't7002-mv-sparse-checkout.sh',
+ 't7003-filter-branch.sh',
+ 't7004-tag.sh',
+ 't7005-editor.sh',
+ 't7006-pager.sh',
+ 't7007-show.sh',
+ 't7008-filter-branch-null-sha1.sh',
+ 't7010-setup.sh',
+ 't7011-skip-worktree-reading.sh',
+ 't7012-skip-worktree-writing.sh',
+ 't7030-verify-tag.sh',
+ 't7031-verify-tag-signed-ssh.sh',
+ 't7060-wtstatus.sh',
+ 't7061-wtstatus-ignore.sh',
+ 't7062-wtstatus-ignorecase.sh',
+ 't7063-status-untracked-cache.sh',
+ 't7064-wtstatus-pv2.sh',
+ 't7101-reset-empty-subdirs.sh',
+ 't7102-reset.sh',
+ 't7103-reset-bare.sh',
+ 't7104-reset-hard.sh',
+ 't7105-reset-patch.sh',
+ 't7106-reset-unborn-branch.sh',
+ 't7107-reset-pathspec-file.sh',
+ 't7110-reset-merge.sh',
+ 't7111-reset-table.sh',
+ 't7112-reset-submodule.sh',
+ 't7113-post-index-change-hook.sh',
+ 't7201-co.sh',
+ 't7300-clean.sh',
+ 't7301-clean-interactive.sh',
+ 't7400-submodule-basic.sh',
+ 't7401-submodule-summary.sh',
+ 't7402-submodule-rebase.sh',
+ 't7403-submodule-sync.sh',
+ 't7406-submodule-update.sh',
+ 't7407-submodule-foreach.sh',
+ 't7408-submodule-reference.sh',
+ 't7409-submodule-detached-work-tree.sh',
+ 't7411-submodule-config.sh',
+ 't7412-submodule-absorbgitdirs.sh',
+ 't7413-submodule-is-active.sh',
+ 't7414-submodule-mistakes.sh',
+ 't7416-submodule-dash-url.sh',
+ 't7417-submodule-path-url.sh',
+ 't7418-submodule-sparse-gitmodules.sh',
+ 't7419-submodule-set-branch.sh',
+ 't7420-submodule-set-url.sh',
+ 't7421-submodule-summary-add.sh',
+ 't7422-submodule-output.sh',
+ 't7423-submodule-symlinks.sh',
+ 't7424-submodule-mixed-ref-formats.sh',
+ 't7450-bad-git-dotfiles.sh',
+ 't7500-commit-template-squash-signoff.sh',
+ 't7501-commit-basic-functionality.sh',
+ 't7502-commit-porcelain.sh',
+ 't7503-pre-commit-and-pre-merge-commit-hooks.sh',
+ 't7504-commit-msg-hook.sh',
+ 't7505-prepare-commit-msg-hook.sh',
+ 't7506-status-submodule.sh',
+ 't7507-commit-verbose.sh',
+ 't7508-status.sh',
+ 't7509-commit-authorship.sh',
+ 't7510-signed-commit.sh',
+ 't7511-status-index.sh',
+ 't7512-status-help.sh',
+ 't7513-interpret-trailers.sh',
+ 't7514-commit-patch.sh',
+ 't7515-status-symlinks.sh',
+ 't7516-commit-races.sh',
+ 't7517-per-repo-email.sh',
+ 't7518-ident-corner-cases.sh',
+ 't7519-status-fsmonitor.sh',
+ 't7520-ignored-hook-warning.sh',
+ 't7521-ignored-mode.sh',
+ 't7524-commit-summary.sh',
+ 't7525-status-rename.sh',
+ 't7526-commit-pathspec-file.sh',
+ 't7527-builtin-fsmonitor.sh',
+ 't7528-signed-commit-ssh.sh',
+ 't7600-merge.sh',
+ 't7601-merge-pull-config.sh',
+ 't7602-merge-octopus-many.sh',
+ 't7603-merge-reduce-heads.sh',
+ 't7604-merge-custom-message.sh',
+ 't7605-merge-resolve.sh',
+ 't7606-merge-custom.sh',
+ 't7607-merge-state.sh',
+ 't7608-merge-messages.sh',
+ 't7609-mergetool--lib.sh',
+ 't7610-mergetool.sh',
+ 't7611-merge-abort.sh',
+ 't7612-merge-verify-signatures.sh',
+ 't7614-merge-signoff.sh',
+ 't7615-diff-algo-with-mergy-operations.sh',
+ 't7700-repack.sh',
+ 't7701-repack-unpack-unreachable.sh',
+ 't7702-repack-cyclic-alternate.sh',
+ 't7703-repack-geometric.sh',
+ 't7704-repack-cruft.sh',
+ 't7800-difftool.sh',
+ 't7810-grep.sh',
+ 't7811-grep-open.sh',
+ 't7812-grep-icase-non-ascii.sh',
+ 't7813-grep-icase-iso.sh',
+ 't7814-grep-recurse-submodules.sh',
+ 't7815-grep-binary.sh',
+ 't7816-grep-binary-pattern.sh',
+ 't7817-grep-sparse-checkout.sh',
+ 't7900-maintenance.sh',
+ 't8001-annotate.sh',
+ 't8002-blame.sh',
+ 't8003-blame-corner-cases.sh',
+ 't8004-blame-with-conflicts.sh',
+ 't8005-blame-i18n.sh',
+ 't8006-blame-textconv.sh',
+ 't8007-cat-file-textconv.sh',
+ 't8008-blame-formats.sh',
+ 't8009-blame-vs-topicbranches.sh',
+ 't8010-cat-file-filters.sh',
+ 't8011-blame-split-file.sh',
+ 't8012-blame-colors.sh',
+ 't8013-blame-ignore-revs.sh',
+ 't8014-blame-ignore-fuzzy.sh',
+ 't9001-send-email.sh',
+ 't9002-column.sh',
+ 't9003-help-autocorrect.sh',
+ 't9100-git-svn-basic.sh',
+ 't9101-git-svn-props.sh',
+ 't9102-git-svn-deep-rmdir.sh',
+ 't9103-git-svn-tracked-directory-removed.sh',
+ 't9104-git-svn-follow-parent.sh',
+ 't9105-git-svn-commit-diff.sh',
+ 't9106-git-svn-commit-diff-clobber.sh',
+ 't9107-git-svn-migrate.sh',
+ 't9108-git-svn-glob.sh',
+ 't9109-git-svn-multi-glob.sh',
+ 't9110-git-svn-use-svm-props.sh',
+ 't9111-git-svn-use-svnsync-props.sh',
+ 't9112-git-svn-md5less-file.sh',
+ 't9113-git-svn-dcommit-new-file.sh',
+ 't9114-git-svn-dcommit-merge.sh',
+ 't9115-git-svn-dcommit-funky-renames.sh',
+ 't9116-git-svn-log.sh',
+ 't9117-git-svn-init-clone.sh',
+ 't9118-git-svn-funky-branch-names.sh',
+ 't9119-git-svn-info.sh',
+ 't9120-git-svn-clone-with-percent-escapes.sh',
+ 't9121-git-svn-fetch-renamed-dir.sh',
+ 't9122-git-svn-author.sh',
+ 't9123-git-svn-rebuild-with-rewriteroot.sh',
+ 't9124-git-svn-dcommit-auto-props.sh',
+ 't9125-git-svn-multi-glob-branch-names.sh',
+ 't9126-git-svn-follow-deleted-readded-directory.sh',
+ 't9127-git-svn-partial-rebuild.sh',
+ 't9128-git-svn-cmd-branch.sh',
+ 't9129-git-svn-i18n-commitencoding.sh',
+ 't9130-git-svn-authors-file.sh',
+ 't9131-git-svn-empty-symlink.sh',
+ 't9132-git-svn-broken-symlink.sh',
+ 't9133-git-svn-nested-git-repo.sh',
+ 't9134-git-svn-ignore-paths.sh',
+ 't9135-git-svn-moved-branch-empty-file.sh',
+ 't9136-git-svn-recreated-branch-empty-file.sh',
+ 't9137-git-svn-dcommit-clobber-series.sh',
+ 't9138-git-svn-authors-prog.sh',
+ 't9139-git-svn-non-utf8-commitencoding.sh',
+ 't9140-git-svn-reset.sh',
+ 't9141-git-svn-multiple-branches.sh',
+ 't9142-git-svn-shallow-clone.sh',
+ 't9143-git-svn-gc.sh',
+ 't9144-git-svn-old-rev_map.sh',
+ 't9145-git-svn-master-branch.sh',
+ 't9146-git-svn-empty-dirs.sh',
+ 't9147-git-svn-include-paths.sh',
+ 't9148-git-svn-propset.sh',
+ 't9150-svk-mergetickets.sh',
+ 't9151-svn-mergeinfo.sh',
+ 't9152-svn-empty-dirs-after-gc.sh',
+ 't9153-git-svn-rewrite-uuid.sh',
+ 't9154-git-svn-fancy-glob.sh',
+ 't9155-git-svn-fetch-deleted-tag.sh',
+ 't9156-git-svn-fetch-deleted-tag-2.sh',
+ 't9157-git-svn-fetch-merge.sh',
+ 't9158-git-svn-mergeinfo.sh',
+ 't9159-git-svn-no-parent-mergeinfo.sh',
+ 't9160-git-svn-preserve-empty-dirs.sh',
+ 't9161-git-svn-mergeinfo-push.sh',
+ 't9162-git-svn-dcommit-interactive.sh',
+ 't9163-git-svn-reset-clears-caches.sh',
+ 't9164-git-svn-dcommit-concurrent.sh',
+ 't9165-git-svn-fetch-merge-branch-of-branch.sh',
+ 't9166-git-svn-fetch-merge-branch-of-branch2.sh',
+ 't9167-git-svn-cmd-branch-subproject.sh',
+ 't9168-git-svn-partially-globbed-names.sh',
+ 't9169-git-svn-dcommit-crlf.sh',
+ 't9200-git-cvsexportcommit.sh',
+ 't9210-scalar.sh',
+ 't9211-scalar-clone.sh',
+ 't9300-fast-import.sh',
+ 't9301-fast-import-notes.sh',
+ 't9302-fast-import-unpack-limit.sh',
+ 't9303-fast-import-compression.sh',
+ 't9304-fast-import-marks.sh',
+ 't9350-fast-export.sh',
+ 't9351-fast-export-anonymize.sh',
+ 't9400-git-cvsserver-server.sh',
+ 't9401-git-cvsserver-crlf.sh',
+ 't9402-git-cvsserver-refs.sh',
+ 't9500-gitweb-standalone-no-errors.sh',
+ 't9501-gitweb-standalone-http-status.sh',
+ 't9502-gitweb-standalone-parse-output.sh',
+ 't9600-cvsimport.sh',
+ 't9601-cvsimport-vendor-branch.sh',
+ 't9602-cvsimport-branches-tags.sh',
+ 't9603-cvsimport-patchsets.sh',
+ 't9604-cvsimport-timestamps.sh',
+ 't9700-perl-git.sh',
+ 't9800-git-p4-basic.sh',
+ 't9801-git-p4-branch.sh',
+ 't9802-git-p4-filetype.sh',
+ 't9803-git-p4-shell-metachars.sh',
+ 't9804-git-p4-label.sh',
+ 't9805-git-p4-skip-submit-edit.sh',
+ 't9806-git-p4-options.sh',
+ 't9807-git-p4-submit.sh',
+ 't9808-git-p4-chdir.sh',
+ 't9809-git-p4-client-view.sh',
+ 't9810-git-p4-rcs.sh',
+ 't9811-git-p4-label-import.sh',
+ 't9812-git-p4-wildcards.sh',
+ 't9813-git-p4-preserve-users.sh',
+ 't9814-git-p4-rename.sh',
+ 't9815-git-p4-submit-fail.sh',
+ 't9816-git-p4-locked.sh',
+ 't9817-git-p4-exclude.sh',
+ 't9818-git-p4-block.sh',
+ 't9819-git-p4-case-folding.sh',
+ 't9820-git-p4-editor-handling.sh',
+ 't9821-git-p4-path-variations.sh',
+ 't9822-git-p4-path-encoding.sh',
+ 't9823-git-p4-mock-lfs.sh',
+ 't9824-git-p4-git-lfs.sh',
+ 't9825-git-p4-handle-utf16-without-bom.sh',
+ 't9826-git-p4-keep-empty-commits.sh',
+ 't9827-git-p4-change-filetype.sh',
+ 't9828-git-p4-map-user.sh',
+ 't9829-git-p4-jobs.sh',
+ 't9830-git-p4-symlink-dir.sh',
+ 't9831-git-p4-triggers.sh',
+ 't9832-unshelve.sh',
+ 't9833-errors.sh',
+ 't9834-git-p4-file-dir-bug.sh',
+ 't9835-git-p4-metadata-encoding-python2.sh',
+ 't9836-git-p4-metadata-encoding-python3.sh',
+ 't9850-shell.sh',
+ 't9901-git-web--browse.sh',
+ 't9902-completion.sh',
+ 't9903-bash-prompt.sh',
+]
+
+# GIT_BUILD_DIR needs to be Unix-style without drive prefixes as it 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 it.
+git_build_dir = meson.project_build_root()
+if cygpath.found()
+ git_build_dir = run_command(cygpath, git_build_dir, check: true).stdout().strip()
+endif
+
+test_environment = script_environment
+test_environment.set('GIT_BUILD_DIR', git_build_dir)
+
+foreach integration_test : integration_tests
+ test(fs.stem(integration_test), shell,
+ args: [ integration_test ],
+ workdir: meson.current_source_dir(),
+ env: test_environment,
+ depends: test_dependencies + bin_wrappers,
+ timeout: 0,
+ )
+endforeach
diff --git a/templates/hooks/meson.build b/templates/hooks/meson.build
new file mode 100644
index 00000000000..f948b9fb145
--- /dev/null
+++ b/templates/hooks/meson.build
@@ -0,0 +1,24 @@
+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,
+ )
+endforeach
diff --git a/templates/info/meson.build b/templates/info/meson.build
new file mode 100644
index 00000000000..1a2f2f84d2f
--- /dev/null
+++ b/templates/info/meson.build
@@ -0,0 +1,5 @@
+configure_file(
+ input: 'exclude',
+ output: 'exclude',
+ configuration: template_config,
+)
diff --git a/templates/meson.build b/templates/meson.build
new file mode 100644
index 00000000000..010b9ef6d3a
--- /dev/null
+++ b/templates/meson.build
@@ -0,0 +1,13 @@
+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,
+)
+
+subdir('hooks')
+subdir('info')
--
2.47.0.229.g8f8d6eee53.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [RFC PATCH v5 19/19] meson: fix conflicts with in-flight topics
2024-11-11 15:30 ` [RFC PATCH v5 " Patrick Steinhardt
` (17 preceding siblings ...)
2024-11-11 15:31 ` [RFC PATCH v5 18/19] Introduce support for the Meson build system Patrick Steinhardt
@ 2024-11-11 15:31 ` Patrick Steinhardt
2024-11-13 3:10 ` [RFC PATCH v5 00/19] Modernize the build system Ramsay Jones
19 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-11 15:31 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar
As support for Meson is still in-flight we have to accommodate for
conflicts with topics in "seen". The following conflicts are being
addressed in this commit:
- ej/cat-file-remote-object-info adds t1017.
- cc/promisor-remote-capability adds t5710.
- ds/path-walk adds t6601 as well as "path-walk.c" and
"test-path-walk.c".
- am/git-blame-ignore-revs-by-default adds t8015 and t8016.
- ps/reftable-detach adds "reftable/system.c".
- js/libgit-rust adds "common-exit.c" and "common-init.c".
This is somewhat painful in the current state where Meson is not yet
part of the main tree, but we'll have to live with that for the time
being.
I've split this commit out into a separate fixup-style commit such that
it is possible to test this topic both with and without "seen" merged
into it. You can simply revert this commit to test without "seen".
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
meson.build | 4 ++++
t/helper/meson.build | 1 +
t/meson.build | 5 +++++
3 files changed, 10 insertions(+)
diff --git a/meson.build b/meson.build
index 86d9a5c9f94..d1b97443b8f 100644
--- a/meson.build
+++ b/meson.build
@@ -65,6 +65,8 @@ libgit_sources = [
'commit-graph.c',
'commit-reach.c',
'commit.c',
+ 'common-exit.c',
+ 'common-init.c',
'compat/nonblock.c',
'compat/obstack.c',
'compat/terminal.c',
@@ -177,6 +179,7 @@ libgit_sources = [
'parse-options.c',
'patch-delta.c',
'patch-ids.c',
+ 'path-walk.c',
'path.c',
'pathspec.c',
'pkt-line.c',
@@ -217,6 +220,7 @@ libgit_sources = [
'reftable/reader.c',
'reftable/record.c',
'reftable/stack.c',
+ 'reftable/system.c',
'reftable/tree.c',
'reftable/writer.c',
'remote.c',
diff --git a/t/helper/meson.build b/t/helper/meson.build
index 5e83884246e..f502d1aaa36 100644
--- a/t/helper/meson.build
+++ b/t/helper/meson.build
@@ -40,6 +40,7 @@ test_tool_sources = [
'test-parse-pathspec-file.c',
'test-partial-clone.c',
'test-path-utils.c',
+ 'test-path-walk.c',
'test-pcre2-config.c',
'test-pkt-line.c',
'test-proc-receive.c',
diff --git a/t/meson.build b/t/meson.build
index 9ec0b7fa34a..c9ea849233c 100644
--- a/t/meson.build
+++ b/t/meson.build
@@ -168,6 +168,7 @@ integration_tests = [
't1014-read-tree-confusing.sh',
't1015-read-index-unmerged.sh',
't1016-compatObjectFormat.sh',
+ 't1017-cat-file-remote-object-info.sh',
't1020-subdirectory.sh',
't1021-rerere-in-workdir.sh',
't1022-read-tree-partial-clone.sh',
@@ -719,6 +720,7 @@ integration_tests = [
't5703-upload-pack-ref-in-want.sh',
't5704-protocol-violations.sh',
't5705-session-id-in-capabilities.sh',
+ 't5710-promisor-remote-capability.sh',
't5730-protocol-v2-bundle-uri-file.sh',
't5731-protocol-v2-bundle-uri-git.sh',
't5732-protocol-v2-bundle-uri-http.sh',
@@ -821,6 +823,7 @@ integration_tests = [
't6500-gc.sh',
't6501-freshen-objects.sh',
't6600-test-reach.sh',
+ 't6601-path-walk.sh',
't6700-tree-depth.sh',
't7001-mv.sh',
't7002-mv-sparse-checkout.sh',
@@ -947,6 +950,8 @@ integration_tests = [
't8012-blame-colors.sh',
't8013-blame-ignore-revs.sh',
't8014-blame-ignore-fuzzy.sh',
+ 't8015-blame-default-ignore-revs.sh',
+ 't8016-blame-override-ignore-revs.sh',
't9001-send-email.sh',
't9002-column.sh',
't9003-help-autocorrect.sh',
--
2.47.0.229.g8f8d6eee53.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v4 00/19] Modernize the build system
2024-11-11 10:36 ` Patrick Steinhardt
@ 2024-11-11 21:06 ` Jeff King
2024-11-11 21:39 ` Eli Schwartz
0 siblings, 1 reply; 386+ messages in thread
From: Jeff King @ 2024-11-11 21:06 UTC (permalink / raw)
To: Patrick Steinhardt
Cc: Taylor Blau, git, Eli Schwartz, Eric Sunshine, Phillip Wood,
Junio C Hamano, Ramsay Jones
On Mon, Nov 11, 2024 at 11:36:30AM +0100, Patrick Steinhardt wrote:
> > - Long-time Git contributors are going to be the ones who will most
> > frequently use the new build system. I am definitely sympathetic to
> > getting too comfortable with our existing tools, but so far in your
> > response I have not seen a compelling reason to switch the project
> > to use Meson.
>
> Yes, that's certainly true. And while I think we should optimize more
> for newcomers as stated, I still think that Meson is very much
> preferable over Makefiles for long-time contributors, as well. The
> transition period may take some time, but in the end it just feels
> superior to Make from my poin of view.
The number one thing I care about as a developer is that the build is
_reliable_. Right now, if I move forwards and backwards in history and
type "make" I will almost[1] always get a correct result based on the
current tree, with the minimal required amount of building. This is
important for bisecting.
When I have worked on other projects, especially those that use
autotools, I quite frequently run into cases where building from a dirty
state cause bizarre problems that go away with a "git clean &&
./configure && make". But then bisection is _much_ slower because we're
building from scratch (not to mention that autoconf itself is
horrifically slow).
How does the meson build do here? I don't have any reason to think it
would be bad, but I am nervous of any change.
[1] I say "almost" because there are one or two spots in our history
where you can run into link errors jumping over them. But for a
20-year project that's not too bad, and they happen infrequently
enough that I don't worry about it.
> Out of curiosity: did you try the Meson build? I personally have to say
> that I already prefer working with it because the workflow with it is so
> much nicer. It has nicer output, is faster, has out-of-tree builds,
> makes it easier to configure and test execution feels way nicer compared
> to my previous workflow with make.
I hadn't tried it. I did now, checking out origin/ps/build^ (to drop the
"seen" resolution topic), but it didn't work:
$ meson setup build
[...]
Program msgfmt found: NO
po/meson.build:3: WARNING: Gettext not found, all translation (po) targets will be ignored.
po/meson.build:3:20: ERROR: Can not assign void to variable.
I guess the assignment of "translations" there needs to be made
conditional?
-Peff
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v4 00/19] Modernize the build system
2024-11-11 21:06 ` Jeff King
@ 2024-11-11 21:39 ` Eli Schwartz
2024-11-11 22:13 ` Jeff King
0 siblings, 1 reply; 386+ messages in thread
From: Eli Schwartz @ 2024-11-11 21:39 UTC (permalink / raw)
To: Jeff King, Patrick Steinhardt
Cc: Taylor Blau, git, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones
[-- Attachment #1.1: Type: text/plain, Size: 2823 bytes --]
On 11/11/24 4:06 PM, Jeff King wrote:
> The number one thing I care about as a developer is that the build is
> _reliable_. Right now, if I move forwards and backwards in history and
> type "make" I will almost[1] always get a correct result based on the
> current tree, with the minimal required amount of building. This is
> important for bisecting.
>
> When I have worked on other projects, especially those that use
> autotools, I quite frequently run into cases where building from a dirty
> state cause bizarre problems that go away with a "git clean &&
> ./configure && make". But then bisection is _much_ slower because we're
> building from scratch (not to mention that autoconf itself is
> horrifically slow).
>
> How does the meson build do here? I don't have any reason to think it
> would be bad, but I am nervous of any change.
This is something that has bothered me about autoconf as well. Meson is
much more reliable about:
- forcing a buildsystem reconfigure on any changes to the buildsystem
files
- due to using ninja, forcing any object files to be rebuilt on e.g. any
changes to compiler flags, since the *entire* compiler command line is
part of the key that determines staleness
- keeping your existing objects between buildsystem reconfigures, if the
resulting reconfigure didn't change the compiler command line for that
specific object file
>> Out of curiosity: did you try the Meson build? I personally have to say
>> that I already prefer working with it because the workflow with it is so
>> much nicer. It has nicer output, is faster, has out-of-tree builds,
>> makes it easier to configure and test execution feels way nicer compared
>> to my previous workflow with make.
>
> I hadn't tried it. I did now, checking out origin/ps/build^ (to drop the
> "seen" resolution topic), but it didn't work:
>
> $ meson setup build
> [...]
> Program msgfmt found: NO
> po/meson.build:3: WARNING: Gettext not found, all translation (po) targets will be ignored.
>
> po/meson.build:3:20: ERROR: Can not assign void to variable.
>
> I guess the assignment of "translations" there needs to be made
> conditional?
Yeah, this is an interesting quirk. Many projects would tend to figure
that translation (po) targets are "optional" because if you don't have
msgfmt installed then you can just install the project without any
translations and then non-English speakers will be inconvenienced but at
least the entire project isn't completely un-buildable. So meson
automatically disables the target and logs a warning, but then this
project *also* wants to depend on the translations for the testsuite.
So this should be taken into account. Do the tests actually need
translations, though?
--
Eli Schwartz
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v4 00/19] Modernize the build system
2024-11-11 10:36 ` Patrick Steinhardt
@ 2024-11-11 21:48 ` Eli Schwartz
2024-11-12 10:48 ` Patrick Steinhardt
2024-11-13 9:21 ` David Aguilar
1 sibling, 1 reply; 386+ messages in thread
From: Eli Schwartz @ 2024-11-11 21:48 UTC (permalink / raw)
To: Patrick Steinhardt, David Aguilar
Cc: Taylor Blau, git, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones
[-- Attachment #1.1: Type: text/plain, Size: 5073 bytes --]
On 11/11/24 5:36 AM, Patrick Steinhardt wrote:
> On Sat, Nov 09, 2024 at 04:58:56AM -0800, David Aguilar wrote:
>> The one thing that no one has mentioned is dependencies.
>>
>> CMake has less dependencies. Python is arguably a liability in the build
>> system arena, and Meson requires it.
>
> Eli has menitoned [muon](https://muon.build/), which is a drop-in
> replacement for Meson written in plain C99. I don't know whether it is
> currently able to compile the Git project, but if this is going to be a
> concern for people I can try to make sure that it does.
I was wondering whether I should say something, because I don't really
feel the criticism was on-target to begin with. But...
I am delighted to be able to confirm, that muon works quite well here.
It did require two small tweaks for not yet implemented features in
muon, that meson had and which this patch series depends on:
the iconv special dependency, which I provided a patch for:
https://git.sr.ht/~lattis/muon/commit/75d33f6b6d482344d969e4ad6ce1527353f91cce
using fallback from gnu99 to c11 for the sake of MSVC, which I reported
and got the muon developer to implement:
https://git.sr.ht/~lattis/muon/commit/a70e9687f3bfb8b9c21baf9acdfe84f97a42b11f
(Note the commit author dates by the way. I had the same general thought
about whether muon could satisfy git users such as, frankly, ones more
interesting to me than "python has too many dependencies". Such as
perhaps HPE NonStop users, and I tried muon out a month ago. Yes -- even
though I am a *meson* maintainer, I consider this a useful alternative
to have. Meson's FAQ includes discussion about whether it makes sense to
require Python, and notes that we specifically avoided providing any
"provide your own python extensions" functionality because it would
prevent being able to ever rewrite in another not-python language. We
also document muon as an alternative in our FAQ.)
With these two small changes, muon compiles git successfully, and passes
all tests but one:
running tests for project 'git'
1030/1030 f:1 s:0 j:1
[===========================================================================================================================================================================================]
finished 1030 tests, 0 expected fail, 1 fail, 0 skipped
fail 9.32s t5324-split-commit-graph
stdout: 'ok 1 - setup repo
ok 2 - tweak umask for modebit tests
ok 3 - create commits and write commit-graph
ok 4 - check normal git operations: graph exists
ok 5 - add more commits, and write a new base graph
ok 6 - fork and fail to base a chain on a commit-graph file
ok 7 - add three more commits, write a tip graph
ok 8 - check normal git operations: split commit-graph: merge 3 vs 2
ok 9 - add one commit, write a tip graph
ok 10 - check normal git operations: three-layer commit-graph: commit 11
vs 6
ok 11 - add one commit, write a merged graph
ok 12 - check normal git operations: merged commit-graph: commit 12 vs 6
ok 13 - create fork and chain across alternate
ok 14 - check normal git operations: alternate: commit 13 vs 6
ok 15 - test merge stragety constants
ok 16 - remove commit-graph-chain file after flattening
ok 17 - verify hashes along chain, even in shallow
ok 18 - verify notices chain slice which is bogus (base)
ok 19 - verify notices chain slice which is bogus (tip)
ok 20 - verify --shallow does not check base contents
ok 21 - warn on base graph chunk incorrect
ok 22 - verify after commit-graph-chain corruption (base)
ok 23 - verify after commit-graph-chain corruption (tip)
ok 24 - verify notices too-short chain file
ok 25 - verify across alternates
ok 26 - reader bounds-checks base-graph chunk
ok 27 - add octopus merge
ok 28 - check normal git operations: graph exists
ok 29 - split across alternate where alternate is not split
ok 30 - --split=no-merge always writes an incremental
ok 31 - --split=replace replaces the chain
not ok 32 - handles file descriptor exhaustion
#
# git init ulimit &&
# (
# cd ulimit &&
# for i in $(test_seq 64)
# do
# test_commit $i &&
# run_with_limited_open_files test_might_fail git commit-graph write \
# --split=no-merge --reachable || return 1
# done
# )
#
ok 33 - split commit-graph respects core.sharedrepository 0666
ok 34 - split commit-graph respects core.sharedrepository 0600
ok 35 - --split=replace with partial Bloom data
ok 36 - prevent regression for duplicate commits across layers
ok 37 - setup repo for mixed generation commit-graph-chain
ok 38 - do not write generation data chunk if not present on existing tip
ok 39 - do not write generation data chunk if the topmost remaining
layer does not have generation data chunk
ok 40 - write generation data chunk if topmost remaining layer has
generation data chunk
ok 41 - write generation data chunk when commit-graph chain is replaced
ok 42 - temporary graph layer is discarded upon failure
# failed 1 among 42 test(s)
1..42
'
--
Eli Schwartz
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v4 00/19] Modernize the build system
2024-11-11 21:39 ` Eli Schwartz
@ 2024-11-11 22:13 ` Jeff King
2024-11-11 23:55 ` Eli Schwartz
0 siblings, 1 reply; 386+ messages in thread
From: Jeff King @ 2024-11-11 22:13 UTC (permalink / raw)
To: Eli Schwartz
Cc: Patrick Steinhardt, Taylor Blau, git, Eric Sunshine, Phillip Wood,
Junio C Hamano, Ramsay Jones
On Mon, Nov 11, 2024 at 04:39:08PM -0500, Eli Schwartz wrote:
> > I hadn't tried it. I did now, checking out origin/ps/build^ (to drop the
> > "seen" resolution topic), but it didn't work:
> >
> > $ meson setup build
> > [...]
> > Program msgfmt found: NO
> > po/meson.build:3: WARNING: Gettext not found, all translation (po) targets will be ignored.
> >
> > po/meson.build:3:20: ERROR: Can not assign void to variable.
> >
> > I guess the assignment of "translations" there needs to be made
> > conditional?
>
>
> Yeah, this is an interesting quirk. Many projects would tend to figure
> that translation (po) targets are "optional" because if you don't have
> msgfmt installed then you can just install the project without any
> translations and then non-English speakers will be inconvenienced but at
> least the entire project isn't completely un-buildable. So meson
> automatically disables the target and logs a warning, but then this
> project *also* wants to depend on the translations for the testsuite.
>
> So this should be taken into account. Do the tests actually need
> translations, though?
No, they don't. I don't have msgfmt on my system at all, and always
build with NO_GETTEXT.
-Peff
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v4 00/19] Modernize the build system
2024-11-11 22:13 ` Jeff King
@ 2024-11-11 23:55 ` Eli Schwartz
2024-11-12 2:21 ` Jeff King
0 siblings, 1 reply; 386+ messages in thread
From: Eli Schwartz @ 2024-11-11 23:55 UTC (permalink / raw)
To: Jeff King
Cc: Patrick Steinhardt, Taylor Blau, git, Eric Sunshine, Phillip Wood,
Junio C Hamano, Ramsay Jones
[-- Attachment #1.1: Type: text/plain, Size: 1029 bytes --]
On 11/11/24 5:13 PM, Jeff King wrote:
> No, they don't. I don't have msgfmt on my system at all, and always
> build with NO_GETTEXT.
Well, even systems without msgfmt installed may have the gettext()
family of symbols available. On various systems, it may even be built
into their libc.
So, detecting and handling this case sensibly out of the box would be
good, which I guess means checking for find_program('msgfmt') inside of
po/meson.build
That being said, the meson way to handle NO_GETTEXT is to use the build
option
meson setup builddir -Dgettext=disabled
That option is a "feature option", which means by default its value is
auto, not disabled, and it will check for an available libintl / libc
gettext().
The po/ directory is only processed if libintl / libc gettext() is
found. Passing -Dgettext=disabled means that it will be forcibly
overridden to "not found". Meson will log this configuration message:
Dependency intl skipped: feature gettext disabled
--
Eli Schwartz
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v4 00/19] Modernize the build system
2024-11-11 23:55 ` Eli Schwartz
@ 2024-11-12 2:21 ` Jeff King
2024-11-12 2:36 ` Eli Schwartz
0 siblings, 1 reply; 386+ messages in thread
From: Jeff King @ 2024-11-12 2:21 UTC (permalink / raw)
To: Eli Schwartz
Cc: Patrick Steinhardt, Taylor Blau, git, Eric Sunshine, Phillip Wood,
Junio C Hamano, Ramsay Jones
On Mon, Nov 11, 2024 at 06:55:38PM -0500, Eli Schwartz wrote:
> On 11/11/24 5:13 PM, Jeff King wrote:
> > No, they don't. I don't have msgfmt on my system at all, and always
> > build with NO_GETTEXT.
>
> Well, even systems without msgfmt installed may have the gettext()
> family of symbols available. On various systems, it may even be built
> into their libc.
>
> So, detecting and handling this case sensibly out of the box would be
> good, which I guess means checking for find_program('msgfmt') inside of
> po/meson.build
Yes, this is a glibc system where gettext() is in the libc. I agree the
fault is in po/meson.build which is not ready to handle the null return
from import('i18n'). So it is not handling the case where gettext() is
available but msgfmt is not.
Mostly I was responding to your original question, though, which is: do
the tests need translations. They definitely do not, as I do not
generally build Git with gettext support at all. So if there is a
dependency there, it seems wrong.
> That being said, the meson way to handle NO_GETTEXT is to use the build
> option
>
> meson setup builddir -Dgettext=disabled
Yes, that does get "meson setup" to complete for me. That gives me two
other questions:
- how would I know this option exists? I think you mentioned elsewhere
in the thread the ability to ask about which options exist, but I
couldn't find anything via "meson -h", etc.
- is there a way to put configuration like this in a file, similar to
our current config.mak?
-Peff
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v4 00/19] Modernize the build system
2024-11-12 2:21 ` Jeff King
@ 2024-11-12 2:36 ` Eli Schwartz
2024-11-12 4:52 ` Jeff King
0 siblings, 1 reply; 386+ messages in thread
From: Eli Schwartz @ 2024-11-12 2:36 UTC (permalink / raw)
To: Jeff King
Cc: Patrick Steinhardt, Taylor Blau, git, Eric Sunshine, Phillip Wood,
Junio C Hamano, Ramsay Jones
[-- Attachment #1.1: Type: text/plain, Size: 1831 bytes --]
On 11/11/24 9:21 PM, Jeff King wrote:
> Yes, that does get "meson setup" to complete for me. That gives me two
> other questions:
>
> - how would I know this option exists? I think you mentioned elsewhere
> in the thread the ability to ask about which options exist, but I
> couldn't find anything via "meson -h", etc.
meson -h lists:
configure Change project options
Which could perhaps be reworded as it allows you to both view and change
them.
If you install meson via a linux distribution package, it probably has
nice integration with our manpage. If you install it with `pip install
meson` then not so much...
$ man meson
The configure command
meson configure provides a way to configure a Meson project from
the command line. Its usage is simple:
meson configure [ build directory ] [ options to set ]
If build directory is omitted, the current directory is used
instead.
If no parameters are set, meson configure will print the value of
all build options to the console.
To set values, use the -D command line argument like this.
meson configure -Dopt1=value1 -Dopt2=value2
> - is there a way to put configuration like this in a file, similar to
> our current config.mak?
https://mesonbuild.com/Machine-files.html
machine files (passed via --cross-file or --native-file) allow you to
define your toolchain, e.g. set up persistent CFLAGS and CC that you can
store as a configuration file, check into git, share with people, etc.
You can also store configuration options in them:
[project options]
gettext = 'disabled'
default_editor = 'vim'
[built-in options]
c_std = 'gnu17'
b_lto = true
b_sanitize = 'address,undefined'
--
Eli Schwartz
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v4 00/19] Modernize the build system
2024-11-12 2:36 ` Eli Schwartz
@ 2024-11-12 4:52 ` Jeff King
2024-11-12 5:07 ` Junio C Hamano
2024-11-12 5:29 ` Eli Schwartz
0 siblings, 2 replies; 386+ messages in thread
From: Jeff King @ 2024-11-12 4:52 UTC (permalink / raw)
To: Eli Schwartz
Cc: Patrick Steinhardt, Taylor Blau, git, Eric Sunshine, Phillip Wood,
Junio C Hamano, Ramsay Jones
On Mon, Nov 11, 2024 at 09:36:25PM -0500, Eli Schwartz wrote:
> > - how would I know this option exists? I think you mentioned elsewhere
> > in the thread the ability to ask about which options exist, but I
> > couldn't find anything via "meson -h", etc.
>
>
> meson -h lists:
>
>
> configure Change project options
>
>
> Which could perhaps be reworded as it allows you to both view and change
> them.
Ah. I saw that, but I tried:
$ meson configure build
Meson configurator encountered an error:
ERROR: Directory /home/peff/compile/git/build is neither a Meson build directory nor a project source directory.
which seemed like a chicken-and-egg (I cannot configure a build
directory until I "setup", but I cannot "setup" until I figure out the
configuration options that work).
But it seems:
$ meson configure .
gives me a list, albeit with a warning about using the source directory.
It looks like just "meson configure" does the same, but somehow I didn't
try that. ;)
> > - is there a way to put configuration like this in a file, similar to
> > our current config.mak?
>
> https://mesonbuild.com/Machine-files.html
>
> machine files (passed via --cross-file or --native-file) allow you to
> define your toolchain, e.g. set up persistent CFLAGS and CC that you can
> store as a configuration file, check into git, share with people, etc.
Thanks. And sorry, I am being a bit more lazy than usual about going out
and reading documentation on my own[1].
My usual workflow is to symlink config.mak to my custom file (which of
course I maintain in another Git repo). And then "make" just does the
right thing, even if I'm moving around through history, bisecting, etc.
I think the meson equivalent is that I would "meson setup build
--native-file /path/to/my/config.mak" once, which would copy all of the
values in to that environment. And then starting ninja from that "build"
directory would presumably work throughout history. My config.mak does
have some runtime logic, though (e.g., when bisecting old commits it
relaxes the compiler options). It sounds like that would need to re-run
meson, and not work at the ninja level.
I'm also not clear on how to alternatively build with different
optimization levels, or with different sanitizers. Right now that is:
# normal build and test some script
make && cd t && ./t0000-basic.sh -v -i
# now with sanitizer
make SANITIZE=address && cd t && ./t0000-basic.sh -v -i
If I understand correctly, the workflow here is either to have two
separate build directories, or to "meson configure" between the two.
And AFAICT the tests _have_ to be run via "meson test" now, if we want
them to find the Git built in the separate directories.
-Peff
[1] I think my gut feeling is that these are questions that Patrick
should be answering if he wants to sell the project on moving away
from make. I know we can't expect to be spoon-fed all parts of a
transition, but I am starting from the point of view of: I am
perfectly happy with make, why do you want me to switch?
Another thing I am observing about this is that "meson" is not
really just replacing "make". It is also replacing autoconf to some
degree in probing various things (like gettext). But that is not
something I (or most developers) were using at all. So it is not
just transitioning to a different piece of software, but also
changing the fundamental approach. Though I imagine with the right
--native-file options, I could disable all of the probing entirely.
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v4 00/19] Modernize the build system
2024-11-12 4:52 ` Jeff King
@ 2024-11-12 5:07 ` Junio C Hamano
2024-11-12 10:48 ` Patrick Steinhardt
2024-11-12 5:29 ` Eli Schwartz
1 sibling, 1 reply; 386+ messages in thread
From: Junio C Hamano @ 2024-11-12 5:07 UTC (permalink / raw)
To: Jeff King
Cc: Eli Schwartz, Patrick Steinhardt, Taylor Blau, git, Eric Sunshine,
Phillip Wood, Ramsay Jones
Jeff King <peff@peff.net> writes:
> [1] I think my gut feeling is that these are questions that Patrick
> should be answering if he wants to sell the project on moving away
> from make. I know we can't expect to be spoon-fed all parts of a
> transition, but I am starting from the point of view of: I am
> perfectly happy with make, why do you want me to switch?
Yeah, that is a very fair thing to say.
Even if you personally (or I for that matter) were not 100% happy
with make, it is important for somebody who has sufficiently gained
respect in the project to play devil's advocate to say it, and I am
glad you did.
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v4 00/19] Modernize the build system
2024-11-12 4:52 ` Jeff King
2024-11-12 5:07 ` Junio C Hamano
@ 2024-11-12 5:29 ` Eli Schwartz
1 sibling, 0 replies; 386+ messages in thread
From: Eli Schwartz @ 2024-11-12 5:29 UTC (permalink / raw)
To: Jeff King
Cc: Patrick Steinhardt, Taylor Blau, git, Eric Sunshine, Phillip Wood,
Junio C Hamano, Ramsay Jones
[-- Attachment #1.1: Type: text/plain, Size: 3527 bytes --]
On 11/11/24 11:52 PM, Jeff King wrote:
> I think the meson equivalent is that I would "meson setup build
> --native-file /path/to/my/config.mak" once, which would copy all of the
> values in to that environment. And then starting ninja from that "build"
> directory would presumably work throughout history. My config.mak does
> have some runtime logic, though (e.g., when bisecting old commits it
> relaxes the compiler options). It sounds like that would need to re-run
> meson, and not work at the ninja level.
Well, at least to change compiler options and relax them it would need
to re-run meson once.
> I'm also not clear on how to alternatively build with different
> optimization levels, or with different sanitizers. Right now that is:
>
> # normal build and test some script
> make && cd t && ./t0000-basic.sh -v -i
>
> # now with sanitizer
> make SANITIZE=address && cd t && ./t0000-basic.sh -v -i
>
> If I understand correctly, the workflow here is either to have two
> separate build directories, or to "meson configure" between the two.
> And AFAICT the tests _have_ to be run via "meson test" now, if we want
> them to find the Git built in the separate directories.
Yes, and yes. Well, kind of.
meson test t0000-basic
# supports globbing and passing args
meson test t0000* --test-args="-v -i"
GIT_BUILD_DIR=$PWD/../build ./t0000-basic.sh -v -i
are all functional. The introduction of meson doesn't change how the
tests actually work, but it does introduce an environment variable
pointing to the built git program(s) in some location other than "the
parent directory of t/ itself", and `meson test` sets that variable then
runs ./tXXXX-testname.sh itself. So you could continue to run it directly.
> [1] I think my gut feeling is that these are questions that Patrick
> should be answering if he wants to sell the project on moving away
> from make. I know we can't expect to be spoon-fed all parts of a
> transition, but I am starting from the point of view of: I am
> perfectly happy with make, why do you want me to switch?
>
> Another thing I am observing about this is that "meson" is not
> really just replacing "make". It is also replacing autoconf to some
> degree in probing various things (like gettext). But that is not
> something I (or most developers) were using at all. So it is not
> just transitioning to a different piece of software, but also
> changing the fundamental approach. Though I imagine with the right
> --native-file options, I could disable all of the probing entirely.
I would say that technically you were already probing various things. It
is simply that the Makefile performed all those probes each time you ran
`make`, e.g.
ifndef CURL_LDFLAGS
CURL_LDFLAGS = $(eval CURL_LDFLAGS := $$(shell $$(CURL_CONFIG)
--libs))$(CURL_LDFLAGS)
endif
ran curl-config --libs every time, which is very much a probe.
Other things like NEEDS_LIBICONV were not a probe, but did require the
user to know it was necessary... possibly since conditionally checking
for -liconv -lintl in a Makefile is difficult to do automatically. :)
Really, the main difference in my view is that probing is moved to an
explicit step rather than happening "under the hood" as part of
executing `make`. And that's a definite difference, since `make` is a
single step and `meson setup build && ninja -C build/` is two steps.
--
Eli Schwartz
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v4 00/19] Modernize the build system
2024-11-12 5:07 ` Junio C Hamano
@ 2024-11-12 10:48 ` Patrick Steinhardt
0 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-12 10:48 UTC (permalink / raw)
To: Junio C Hamano
Cc: Jeff King, Eli Schwartz, Taylor Blau, git, Eric Sunshine,
Phillip Wood, Ramsay Jones
On Tue, Nov 12, 2024 at 02:07:25PM +0900, Junio C Hamano wrote:
> Jeff King <peff@peff.net> writes:
>
> > [1] I think my gut feeling is that these are questions that Patrick
> > should be answering if he wants to sell the project on moving away
> > from make. I know we can't expect to be spoon-fed all parts of a
> > transition, but I am starting from the point of view of: I am
> > perfectly happy with make, why do you want me to switch?
>
> Yeah, that is a very fair thing to say.
>
> Even if you personally (or I for that matter) were not 100% happy
> with make, it is important for somebody who has sufficiently gained
> respect in the project to play devil's advocate to say it, and I am
> glad you did.
Yup, I agree with you a 100%.
I was first focussing on getting everything set up and then get some
early signals as to whether this is a direction that we can go into in
the first place, and because of that I didn't yet provide any docs. But
based on your feedback I guess I should focus on exactly that as my next
step. So I'll include docs in the next reroll that demonstrate everyday
workflows in Git and how to do these with Meson.
Thanks!
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v4 00/19] Modernize the build system
2024-11-11 21:48 ` Eli Schwartz
@ 2024-11-12 10:48 ` Patrick Steinhardt
2024-11-12 15:56 ` Patrick Steinhardt
0 siblings, 1 reply; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-12 10:48 UTC (permalink / raw)
To: Eli Schwartz
Cc: David Aguilar, Taylor Blau, git, Eric Sunshine, Phillip Wood,
Junio C Hamano, Ramsay Jones
On Mon, Nov 11, 2024 at 04:48:14PM -0500, Eli Schwartz wrote:
> On 11/11/24 5:36 AM, Patrick Steinhardt wrote:
> > On Sat, Nov 09, 2024 at 04:58:56AM -0800, David Aguilar wrote:
> >> The one thing that no one has mentioned is dependencies.
> >>
> >> CMake has less dependencies. Python is arguably a liability in the build
> >> system arena, and Meson requires it.
> >
> > Eli has menitoned [muon](https://muon.build/), which is a drop-in
> > replacement for Meson written in plain C99. I don't know whether it is
> > currently able to compile the Git project, but if this is going to be a
> > concern for people I can try to make sure that it does.
>
> I was wondering whether I should say something, because I don't really
> feel the criticism was on-target to begin with. But...
>
> I am delighted to be able to confirm, that muon works quite well here.
>
> It did require two small tweaks for not yet implemented features in
> muon, that meson had and which this patch series depends on:
>
> the iconv special dependency, which I provided a patch for:
>
> https://git.sr.ht/~lattis/muon/commit/75d33f6b6d482344d969e4ad6ce1527353f91cce
>
> using fallback from gnu99 to c11 for the sake of MSVC, which I reported
> and got the muon developer to implement:
>
> https://git.sr.ht/~lattis/muon/commit/a70e9687f3bfb8b9c21baf9acdfe84f97a42b11f
>
>
> (Note the commit author dates by the way. I had the same general thought
> about whether muon could satisfy git users such as, frankly, ones more
> interesting to me than "python has too many dependencies". Such as
> perhaps HPE NonStop users, and I tried muon out a month ago. Yes -- even
> though I am a *meson* maintainer, I consider this a useful alternative
> to have. Meson's FAQ includes discussion about whether it makes sense to
> require Python, and notes that we specifically avoided providing any
> "provide your own python extensions" functionality because it would
> prevent being able to ever rewrite in another not-python language. We
> also document muon as an alternative in our FAQ.)
>
>
> With these two small changes, muon compiles git successfully, and passes
> all tests but one:
Thanks, I'll have a look at the test failure.
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v4 00/19] Modernize the build system
2024-11-12 10:48 ` Patrick Steinhardt
@ 2024-11-12 15:56 ` Patrick Steinhardt
0 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-12 15:56 UTC (permalink / raw)
To: Eli Schwartz
Cc: David Aguilar, Taylor Blau, git, Eric Sunshine, Phillip Wood,
Junio C Hamano, Ramsay Jones
On Tue, Nov 12, 2024 at 11:48:31AM +0100, Patrick Steinhardt wrote:
> On Mon, Nov 11, 2024 at 04:48:14PM -0500, Eli Schwartz wrote:
> > On 11/11/24 5:36 AM, Patrick Steinhardt wrote:
> > > On Sat, Nov 09, 2024 at 04:58:56AM -0800, David Aguilar wrote:
> > >> The one thing that no one has mentioned is dependencies.
> > >>
> > >> CMake has less dependencies. Python is arguably a liability in the build
> > >> system arena, and Meson requires it.
> > >
> > > Eli has menitoned [muon](https://muon.build/), which is a drop-in
> > > replacement for Meson written in plain C99. I don't know whether it is
> > > currently able to compile the Git project, but if this is going to be a
> > > concern for people I can try to make sure that it does.
> >
> > I was wondering whether I should say something, because I don't really
> > feel the criticism was on-target to begin with. But...
> >
> > I am delighted to be able to confirm, that muon works quite well here.
> >
> > It did require two small tweaks for not yet implemented features in
> > muon, that meson had and which this patch series depends on:
> >
> > the iconv special dependency, which I provided a patch for:
> >
> > https://git.sr.ht/~lattis/muon/commit/75d33f6b6d482344d969e4ad6ce1527353f91cce
> >
> > using fallback from gnu99 to c11 for the sake of MSVC, which I reported
> > and got the muon developer to implement:
> >
> > https://git.sr.ht/~lattis/muon/commit/a70e9687f3bfb8b9c21baf9acdfe84f97a42b11f
> >
> >
> > (Note the commit author dates by the way. I had the same general thought
> > about whether muon could satisfy git users such as, frankly, ones more
> > interesting to me than "python has too many dependencies". Such as
> > perhaps HPE NonStop users, and I tried muon out a month ago. Yes -- even
> > though I am a *meson* maintainer, I consider this a useful alternative
> > to have. Meson's FAQ includes discussion about whether it makes sense to
> > require Python, and notes that we specifically avoided providing any
> > "provide your own python extensions" functionality because it would
> > prevent being able to ever rewrite in another not-python language. We
> > also document muon as an alternative in our FAQ.)
> >
> >
> > With these two small changes, muon compiles git successfully, and passes
> > all tests but one:
>
> Thanks, I'll have a look at the test failure.
I couldn't reproduce the test failures on my system reliably. I did
notice that some of the tests are quite flaky, and that seems mostly to
be attributed to file descriptor exhaustion. These problems go away when
running `muon test -j1`.
So maybe there is an issue to how file descriptor are allocated? That's
just a guess though.
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* [PATCH RFC v6 00/19] Modernize the build system
2024-10-02 15:15 [RFC PATCH 00/21] Modernize the build system Patrick Steinhardt
` (25 preceding siblings ...)
2024-11-11 15:30 ` [RFC PATCH v5 " Patrick Steinhardt
@ 2024-11-12 17:02 ` Patrick Steinhardt
2024-11-12 17:02 ` [PATCH RFC v6 01/19] Makefile: use common template for GIT-BUILD-OPTIONS Patrick Steinhardt
` (20 more replies)
2024-11-15 7:21 ` [PATCH RFC v7 00/22] " Patrick Steinhardt
` (4 subsequent siblings)
31 siblings, 21 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-12 17:02 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King
Hi,
this patch series modernizes our build infrasturcture. It refactors
various parts of it to make it possible to perform out-of-tree builds in
theory.
The series then continues to wire up Meson as a proposed alternative as
a modern replacement for our current build systems. It provides better
integration into IDEs than our Makefiles, better usability than our
Makefiles and CMake, better configuration and discoverability thereof
than autoconf and CMake (which is of course my personal opinion).
The intent is to have Meson replace autoconf, which is mostly unused and
broken. Eventually, the plan would to also replace CMake and our
Makefiles in case we figure out that this replacement is indeed a net
benefit for the project, but all of this would happen over the course of
multiple releases.
Changes in v6:
- Add documentation for how to use Meson.
- Fix compilation in case libintl exists, but required tools like
msgfmt and related don't. Instead of failing, we now automatically
compile with the equivalent of NO_GETTEXT=YesPlease.
- Update last patch that fixes semantic merge conflics with in-flight
topics in "seen".
- I've changed the series to be based on "master" at b31fb630c0 (Merge
https://github.com/j6t/git-gui, 2024-11-11) as all prereqs of this
series have since landed. This doesn't make any difference though
as there aren't any merge conflicts or additional changes caused by
this. I mostly mention this so that there is no confusion around the
changed base commit.
As before, the tip of this patch series catches up with what is
happening in "seen". If you want to test it without topics in "seen" you
have to revert it.
Links to previous versions:
- Link to v1: https://lore.kernel.org/r/cover.1727881164.git.ps@pks.im
- Link to v2: https://lore.kernel.org/r/cover.1728485139.git.ps@pks.im
- Link to v3: https://lore.kernel.org/r/cover.1729254070.git.ps@pks.im
- Link to v4: https://lore.kernel.org/r/cover.1729771605.git.ps@pks.im
- Link to v5: https://lore.kernel.org/r/cover.1731335938.git.ps@pks.im
Thanks!
Patrick
To: git@vger.kernel.org
Cc: Eli Schwartz <eschwartz@gentoo.org>
Cc: Eric Sunshine <sunshine@sunshineco.com>
Cc: Phillip Wood <phillip.wood123@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>
Cc: Ramsay Jones <ramsay@ramsayjones.plus.com>
Cc: Taylor Blau <me@ttaylorr.com>
Cc: David Aguilar <davvid@gmail.com>
Cc: Jeff King <peff@peff.net>
Patrick Steinhardt (19):
Makefile: use common template for GIT-BUILD-OPTIONS
Makefile: consistently use @PLACEHOLDER@ to substitute
Makefile: consistently use PERL_PATH
Makefile: extract script to massage Perl scripts
Makefile: use "generate-perl.sh" to massage Perl library
Makefile: extract script to massage Shell scripts
Makefile: extract script to generate gitweb.cgi
Makefile: refactor GIT-VERSION-GEN to be reusable
Makefile: refactor generators to be PWD-independent
Makefile: allow "bin-wrappers/" directory to exist
Makefile: simplify building of templates
Documentation: allow sourcing generated includes from separate dir
Documentation: teach "cmd-list.perl" about out-of-tree builds
Documentation: extract script to generate a list of mergetools
t: better support for out-of-tree builds
t: allow overriding build dir
Documentation: add comparison of build systems
Introduce support for the Meson build system
meson: fix conflicts with in-flight topics
.gitignore | 1 -
Documentation/CodingGuidelines | 2 +-
Documentation/Makefile | 28 +-
Documentation/build-docdep.perl | 2 +
Documentation/cmd-list.perl | 23 +-
Documentation/config/diff.txt | 2 +-
Documentation/config/merge.txt | 2 +-
Documentation/generate-mergetool-list.sh | 17 +
Documentation/git.txt | 24 +-
Documentation/meson.build | 317 ++++
Documentation/technical/build-systems.txt | 224 +++
GIT-BUILD-OPTIONS.in | 47 +
GIT-VERSION-GEN | 12 +-
Makefile | 209 +--
bin-wrappers/.gitignore | 9 +
bin-wrappers/meson.build | 28 +
bin-wrappers/wrap-for-bin.sh | 37 +
configure.ac | 2 +-
contrib/buildsystems/CMakeLists.txt | 230 +--
contrib/completion/meson.build | 8 +
contrib/meson.build | 1 +
generate-cmdlist.sh | 42 +-
generate-configlist.sh | 20 +-
generate-hooklist.sh | 15 +-
generate-perl.sh | 36 +
generate-script.sh | 34 +
git-cvsserver.perl | 2 +-
git-instaweb.sh | 8 +-
git-request-pull.sh | 2 +-
git-send-email.perl | 2 +-
git-sh-i18n.sh | 6 +-
git-sh-setup.sh | 6 +-
git-svn.perl | 2 +-
gitk-git/po/vi.po | 2 +-
gitweb/GITWEB-BUILD-OPTIONS.in | 25 +
gitweb/Makefile | 58 +-
gitweb/generate-gitweb.sh | 45 +
gitweb/gitweb.perl | 44 +-
gitweb/meson.build | 63 +
meson.build | 1780 ++++++++++++++++++++
meson_options.txt | 73 +
perl/FromCPAN/Mail/meson.build | 7 +
perl/FromCPAN/meson.build | 9 +
perl/Git/I18N.pm | 6 +-
perl/Git/LoadCPAN.pm | 6 +-
perl/Git/LoadCPAN/Mail/meson.build | 7 +
perl/Git/LoadCPAN/meson.build | 9 +
perl/Git/SVN/Memoize/meson.build | 7 +
perl/Git/SVN/meson.build | 20 +
perl/Git/meson.build | 18 +
perl/header_templates/fixed_prefix.template.pl | 2 +-
perl/header_templates/runtime_prefix.template.pl | 8 +-
perl/meson.build | 12 +
po/meson.build | 27 +
subprojects/.gitignore | 1 +
subprojects/curl.wrap | 13 +
subprojects/expat.wrap | 13 +
subprojects/openssl.wrap | 15 +
subprojects/pcre2.wrap | 16 +
subprojects/zlib.wrap | 13 +
t/helper/meson.build | 93 +
t/lib-gettext.sh | 4 +-
t/meson.build | 1107 ++++++++++++
t/t7609-mergetool--lib.sh | 2 +-
t/test-lib.sh | 22 +-
templates/Makefile | 39 +-
templates/branches-- | 1 -
templates/{this--description => description} | 0
.../applypatch-msg.sample} | 0
.../commit-msg.sample} | 0
.../fsmonitor-watchman.sample} | 0
templates/hooks/meson.build | 24 +
.../post-update.sample} | 0
.../pre-applypatch.sample} | 0
.../pre-commit.sample} | 0
.../pre-merge-commit.sample} | 0
.../pre-push.sample} | 0
.../pre-rebase.sample} | 0
.../pre-receive.sample} | 0
.../prepare-commit-msg.sample} | 0
.../push-to-checkout.sample} | 0
.../sendemail-validate.sample} | 0
.../{hooks--update.sample => hooks/update.sample} | 0
templates/{info--exclude => info/exclude} | 0
templates/info/meson.build | 5 +
templates/meson.build | 13 +
unimplemented.sh | 2 +-
wrap-for-bin.sh | 36 -
88 files changed, 4600 insertions(+), 447 deletions(-)
Range-diff versus v5:
1: ed28e754e8 = 1: 687ae57464 Makefile: use common template for GIT-BUILD-OPTIONS
2: 178ba0e5d6 = 2: 53d5f0103a Makefile: consistently use @PLACEHOLDER@ to substitute
3: 66b82c152b = 3: 15a4864450 Makefile: consistently use PERL_PATH
4: 8382a6b840 = 4: ed09cc6027 Makefile: extract script to massage Perl scripts
5: 51491b778d = 5: 56caa7a075 Makefile: use "generate-perl.sh" to massage Perl library
6: c3946a69db = 6: ee2135d178 Makefile: extract script to massage Shell scripts
7: a58c901466 = 7: 13fbeee749 Makefile: extract script to generate gitweb.cgi
8: a9b886b27a = 8: f0073e58c8 Makefile: refactor GIT-VERSION-GEN to be reusable
9: f2eccc7d65 = 9: fd412ba3a0 Makefile: refactor generators to be PWD-independent
10: c891e56e32 = 10: 2e3833a0a3 Makefile: allow "bin-wrappers/" directory to exist
11: 4e9525f64e = 11: 7d93c8afa0 Makefile: simplify building of templates
12: b209ab75b5 = 12: 8dad1314b2 Documentation: allow sourcing generated includes from separate dir
13: 5e8be2473c = 13: 90d6e0b4eb Documentation: teach "cmd-list.perl" about out-of-tree builds
14: 621d18d281 = 14: 0911b47694 Documentation: extract script to generate a list of mergetools
15: f56eb0cd86 = 15: 3861eab108 t: better support for out-of-tree builds
16: 9618c7745e = 16: 2226f932d3 t: allow overriding build dir
17: 568287b16a = 17: a9686e2940 Documentation: add comparison of build systems
18: 42bc858172 ! 18: a7a7f7efe3 Introduce support for the Meson build system
@@ Commit message
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
+ - 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.
- - Documentation does not yet exist. Same here, it will follow if the
- project can agree on Meson.
-
- 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
@@ gitweb/meson.build (new)
## meson.build (new) ##
@@
++# Meson build system
++# ==================
++#
++# The Meson build system is an alternative to our Makefile that you can use to
++# build, test and install Git. Using Meson results in a couple of benefits:
++#
++# - Out-of-tree builds.
++# - Better integration into IDEs.
++# - Easy-to-use autoconfiguration of available features on your system.
++#
++# To use Meson from the command line you need to have both Meson and Ninja
++# installed. Alternatively, if you do not have Python available on your system,
++# you can also use Muon instead of Meson and Samurai instead of Ninja, both of
++# which are drop-ins replacement that only depend on C.
++#
++# Basic usage
++# ===========
++#
++# In the most trivial case, you can configure, build and install Git like this:
++#
++# 1. Set up the build directory. This only needs to happen once per build
++# directory you want to have. You can also configure multiple different
++# build directories with different configurations.
++#
++# $ meson setup build/
++#
++# The build directory gets ignored by Git automatically as Meson will write
++# a ".gitignore" file into it. From hereon, we will assume that you execute
++# commands inside this build directory.
++#
++# 2. Compile Git. You can either use Meson, Ninja or Samurai to do this, so all
++# of the following invocations are equivalent:
++#
++# $ meson compile
++# $ ninja
++# $ samu
++#
++# The different invocations should ultimately not make much of a difference.
++# Using Meson also works with other generators though, like when the build
++# directory has been set up for use with Microsoft Visual Studio.
++#
++# 3. Execute tests. Again, you can either use Meson, Ninja or Samurai to do this:
++#
++# $ meson test
++# $ ninja test
++# $ samu test
++#
++# It is recommended to use Meson in this case though as it also provides you
++# additional features that the other build systems don't have available.
++# You can e.g. pass additional arguments to the test executables or run
++# individual tests:
++#
++# # Execute the t0000-basic integration test and t-reftable-stack unit test.
++# $ meson test t0000-basic t-reftable-stack
++#
++# # Execute all reftable unit tests.
++# $ meson test t-reftable-*
++#
++# # Execute all tests and stop with the first failure.
++# $ meson test --maxfail 1
++#
++# # Execute single test interactively such that features like `debug ()` work.
++# $ meson test -i --test-args='-ix' t1400-update-ref
++#
++# 4. Install the Git distribution. Again, this can be done via Meson, Ninja or
++# Samurai:
++#
++# $ meson install
++# $ ninja install
++# $ samu install
++#
++# The prefix into which Git shall be installed is defined when setting up
++# the build directory. More on that in the "Configuration" section.
++#
++# Meson supports multiple backends. The default backend generates Ninja build
++# instructions, but it also supports the generation of Microsoft Visual
++# Studio solutions as well as Xcode projects. IDEs like Eclipse and Visual
++# Studio Code provide plugins to import Meson files directly.
++#
++# Configuration
++# =============
++#
++# The exact configuration of Git is determined when setting up the Git
++# directory. Unless told otherwise, Meson will automatically detect the
++# availability of various bits and pieces. There are two different kinds of
++# options that can be used to further tweak the build:
++#
++# - Built-in options provided by Meson.
++#
++# - Options defined by the project in the "meson_options.txt" file.
++#
++# Both kinds of options can be inspected by running `meson configure` in the
++# build directory, which will give you a list of the current value for all
++# options.
++#
++# Options can be configured either when setting up the build directory or can
++# be changed in preexisting build directories:
++#
++# # Set up a build directory with optimized settings that will be
++# # installed into an alternative prefix.
++# $ meson setup --buildtype release --optimization 3 --strip --prefix=/home/$USER
++#
++# # Set up a build directory with 'address' and 'undefined' sanitizers
++# # using Clang.
++# $ CC=clang meson setup -Db_sanitize=address,undefined
++#
++# # Disable tests in a preexisting build directory.
++# $ meson configure -Dtests=false
++#
++# # Disable features based on Python
++# $ meson configure -Dpython=disabled
++#
++# # Disable features based on Python
++# $ meson configure -Dpython=disabled
++#
++# Options have a type like booleans, choices, strings or features. Features are
++# somewhat special as they can have one of three values: enabled, disabled or
++# auto. While the first two values are self-explanatory, "auto" will enable or
++# disable the feature based on the availability of prerequisites to support it.
++# Python-based features for example will be enabled automatically when a Python
++# interpreter could be found. The default value of such features can be changed
++# globally via `meson setup --auto-features={enabled,disabled,auto}`, which
++# will set the value of all features with a value of "auto" to the provided one
++# by default.
++#
++# It is also possible to store a set of configuration options in machine files.
++# This can be useful in case you regularly want to reuse the same set of options:
++#
++# [binaries]
++# c = ['clang']
++# ar = ['ar']
++#
++# [project options]
++# gettext = 'disabled'
++# default_editor = 'vim'
++#
++# [built-in options]
++# b_lto = true
++# b_sanitize = 'address,undefined'
++#
++# These machine files can be passed to Meson via `meson setup --native-file`.
++#
++# Subproject wrappers
++# ===================
++#
++# Subproject wrappers are a feature provided by Meson that allow the automatic
++# fallback to a "wrapped" dependency in case the dependency is not provided by
++# the system. For example if the system is lacking curl, then Meson will use
++# "subprojects/curl.wrap" to set up curl as a subproject and compile and link
++# the dependency into Git itself. This is especially helpful on systems like
++# Windows, where you typically don't have such dependencies installed.
++#
++# The use of subproject wrappers can be disabled by executing `meson setup
++# --wrap-mode nofallback`.
++
+project('git', 'c',
+ meson_version: '>=1.3.0',
+ # MSVC does not support GNU99, and C99 does not define __STDC_VERSION__
@@ meson.build (new)
+ build_options_config.set('NO_PTHREADS', '1')
+endif
+
-+if get_option('gettext').allowed() and host_machine.system() == 'darwin' and get_option('macos_use_homebrew_gettext')
++msgfmt = find_program('msgfmt', dirs: program_path, required: false)
++gettext_option = get_option('gettext').disable_auto_if(not msgfmt.found())
++if not msgfmt.found() and gettext_option.enabled()
++ error('Internationalization via libintl requires msgfmt')
++endif
++
++if gettext_option.allowed() and host_machine.system() == 'darwin' and get_option('macos_use_homebrew_gettext')
+ if host_machine.cpu_family() == 'x86_64'
+ libintl_prefix = '/usr/local'
+ elif host_machine.cpu_family() == 'aarch64'
@@ meson.build (new)
+ error('Homebrew workaround not supported on current architecture')
+ endif
+
-+ intl = compiler.find_library('intl', dirs: libintl_prefix / 'lib', required: get_option('gettext'))
++ intl = compiler.find_library('intl', dirs: libintl_prefix / 'lib', required: gettext_option)
+ if intl.found()
+ intl = declare_dependency(
+ dependencies: intl,
@@ meson.build (new)
+ )
+ endif
+else
-+ intl = dependency('intl', required: get_option('gettext'))
++ intl = dependency('intl', required: gettext_option)
+endif
+if intl.found()
+ libgit_dependencies += intl
19: f483916825 ! 19: 8315d432f1 meson: fix conflicts with in-flight topics
@@ Commit message
conflicts with topics in "seen". The following conflicts are being
addressed in this commit:
- - ej/cat-file-remote-object-info adds t1017.
+ - ej/cat-file-remote-object-info adds t1017 and "fetch-object-info.c".
- cc/promisor-remote-capability adds t5710.
- ds/path-walk adds t6601 as well as "path-walk.c" and
"test-path-walk.c".
- - am/git-blame-ignore-revs-by-default adds t8015 and t8016.
-
- ps/reftable-detach adds "reftable/system.c".
- js/libgit-rust adds "common-exit.c" and "common-init.c".
+ - ps/clar-build-improvement adapts the awk(1) script that generates
+ "clar.suites" to instead be a shell script.
+
+ - ds/full-name-hash adds "t/helper/test-name-hash.c".
+
+ - cw/worktree-extension deletes t2408.
+
This is somewhat painful in the current state where Meson is not yet
part of the main tree, but we'll have to live with that for the time
being.
@@ meson.build: libgit_sources = [
'compat/nonblock.c',
'compat/obstack.c',
'compat/terminal.c',
+@@ meson.build: libgit_sources = [
+ 'ewah/ewah_rlw.c',
+ 'exec-cmd.c',
+ 'fetch-negotiator.c',
++ 'fetch-object-info.c',
+ 'fetch-pack.c',
+ 'fmt-merge-msg.c',
+ 'fsck.c',
@@ meson.build: libgit_sources = [
'parse-options.c',
'patch-delta.c',
@@ meson.build: libgit_sources = [
## t/helper/meson.build ##
@@ t/helper/meson.build: test_tool_sources = [
+ 'test-match-trees.c',
+ 'test-mergesort.c',
+ 'test-mktemp.c',
++ 'test-name-hash.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',
@@ t/helper/meson.build: test_tool_sources = [
'test-proc-receive.c',
## t/meson.build ##
+@@ t/meson.build: clar_sources += clar_decls_h
+ clar_sources += custom_target(
+ input: clar_decls_h,
+ output: 'clar.suite',
+- feed: true,
+- capture: true,
+- command : [awk, '-f', meson.current_source_dir() + '/unit-tests/clar-generate.awk'],
++ command : [shell, meson.current_source_dir() + '/unit-tests/generate-clar-suites.sh', '@INPUT@', '@OUTPUT@'],
++ env: script_environment,
+ )
+
+ clar_unit_tests = executable('unit-tests',
@@ t/meson.build: integration_tests = [
't1014-read-tree-confusing.sh',
't1015-read-index-unmerged.sh',
@@ t/meson.build: integration_tests = [
't1020-subdirectory.sh',
't1021-rerere-in-workdir.sh',
't1022-read-tree-partial-clone.sh',
+@@ t/meson.build: integration_tests = [
+ 't2405-worktree-submodule.sh',
+ 't2406-worktree-repair.sh',
+ 't2407-worktree-heads.sh',
+- 't2408-worktree-relative.sh',
+ 't2500-untracked-overwriting.sh',
+ 't2501-cwd-empty.sh',
+ 't3000-ls-files-others.sh',
@@ t/meson.build: integration_tests = [
't5703-upload-pack-ref-in-want.sh',
't5704-protocol-violations.sh',
@@ t/meson.build: integration_tests = [
't6700-tree-depth.sh',
't7001-mv.sh',
't7002-mv-sparse-checkout.sh',
-@@ t/meson.build: integration_tests = [
- 't8012-blame-colors.sh',
- 't8013-blame-ignore-revs.sh',
- 't8014-blame-ignore-fuzzy.sh',
-+ 't8015-blame-default-ignore-revs.sh',
-+ 't8016-blame-override-ignore-revs.sh',
- 't9001-send-email.sh',
- 't9002-column.sh',
- 't9003-help-autocorrect.sh',
---
base-commit: b31fb630c0fc6869a33ed717163e8a1210460d94
change-id: 20241112-pks-meson-95b665c08f06
^ permalink raw reply [flat|nested] 386+ messages in thread
* [PATCH RFC v6 01/19] Makefile: use common template for GIT-BUILD-OPTIONS
2024-11-12 17:02 ` [PATCH RFC v6 " Patrick Steinhardt
@ 2024-11-12 17:02 ` Patrick Steinhardt
2024-11-13 7:13 ` Junio C Hamano
2024-11-12 17:02 ` [PATCH RFC v6 02/19] Makefile: consistently use @PLACEHOLDER@ to substitute Patrick Steinhardt
` (19 subsequent siblings)
20 siblings, 1 reply; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-12 17:02 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King
The "GIT-BUILD-OPTIONS" file is generated by our build systems to
propagate built-in features and paths to our tests. The generation is
done ad-hoc, where both our Makefile and the CMake build instructions
simply echo a bunch of strings into the file. This makes it very hard to
figure out what variables are expected to exist and what format they
have, and the written variables can easily get out of sync between build
systems.
Introduce a new "GIT-BUILD-OPTIONS.in" template to address this issue.
This has multiple advantages:
- It demonstrates which built options exist in the first place.
- It can serve as a spot to document the build options.
- Some build systems complain when not all variables could be
substituted, alerting us of mismatches. Others don't, but if we
forgot to substitute such variables we now have a bogus string that
will likely cause our tests to fail, if they have any meaning in the
first place.
Backfill values that we didn't yet set in our CMake build instructions.
While at it, remove the `SUPPORTS_SIMPLE_IPC` variable that we only set
up in CMake as it isn't used anywhere.
Note that this change requires us to move around the setup of
TEST_OUTPUT_DIRECTORY in "test-lib.sh" such that it comes after sourcing
the "GIT-BUILD-OPTIONS" file. This is the only instance I could find
where we rely on ordering on variables.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-BUILD-OPTIONS.in | 36 ++++++++++++
Makefile | 109 +++++++++++++-----------------------
contrib/buildsystems/CMakeLists.txt | 58 ++++++++++++-------
t/test-lib.sh | 13 +++--
4 files changed, 121 insertions(+), 95 deletions(-)
diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in
new file mode 100644
index 0000000000000000000000000000000000000000..f0ca240493c94aa41a6b6241a8474e42f7cdc8b9
--- /dev/null
+++ b/GIT-BUILD-OPTIONS.in
@@ -0,0 +1,36 @@
+SHELL_PATH=@SHELL_PATH@
+TEST_SHELL_PATH=@TEST_SHELL_PATH@
+PERL_PATH=@PERL_PATH@
+DIFF=@DIFF@
+PYTHON_PATH=@PYTHON_PATH@
+TAR=@TAR@
+NO_CURL=@NO_CURL@
+NO_ICONV=@NO_ICONV@
+NO_EXPAT=@NO_EXPAT@
+USE_LIBPCRE2=@USE_LIBPCRE2@
+NO_PERL=@NO_PERL@
+NO_PTHREADS=@NO_PTHREADS@
+NO_PYTHON=@NO_PYTHON@
+NO_REGEX=@NO_REGEX@
+NO_UNIX_SOCKETS=@NO_UNIX_SOCKETS@
+PAGER_ENV=@PAGER_ENV@
+SANITIZE_LEAK=@SANITIZE_LEAK@
+SANITIZE_ADDRESS=@SANITIZE_ADDRESS@
+X=@X@
+FSMONITOR_DAEMON_BACKEND=@FSMONITOR_DAEMON_BACKEND@
+FSMONITOR_OS_SETTINGS=@FSMONITOR_OS_SETTINGS@
+TEST_OUTPUT_DIRECTORY=@TEST_OUTPUT_DIRECTORY@
+GIT_TEST_OPTS=@GIT_TEST_OPTS@
+GIT_TEST_CMP=@GIT_TEST_CMP@
+GIT_TEST_CMP_USE_COPIED_CONTEXT=@GIT_TEST_CMP_USE_COPIED_CONTEXT@
+GIT_TEST_UTF8_LOCALE=@GIT_TEST_UTF8_LOCALE@
+NO_GETTEXT=@NO_GETTEXT@
+GIT_PERF_REPEAT_COUNT=@GIT_PERF_REPEAT_COUNT@
+GIT_PERF_REPO=@GIT_PERF_REPO@
+GIT_PERF_LARGE_REPO=@GIT_PERF_LARGE_REPO@
+GIT_PERF_MAKE_OPTS=@GIT_PERF_MAKE_OPTS@
+GIT_PERF_MAKE_COMMAND=@GIT_PERF_MAKE_COMMAND@
+GIT_INTEROP_MAKE_OPTS=@GIT_INTEROP_MAKE_OPTS@
+GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@
+GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@
+RUNTIME_PREFIX=@RUNTIME_PREFIX@
diff --git a/Makefile b/Makefile
index d06c9a8ffa7b637050c9619a367fbe61e7243a74..962df75635a8cbf7114970ddfe7948ff17c65fdc 100644
--- a/Makefile
+++ b/Makefile
@@ -3164,76 +3164,45 @@ GIT-LDFLAGS: FORCE
# that runs GIT-BUILD-OPTIONS, and then again to protect it
# and the first level quoting from the shell that runs "echo".
GIT-BUILD-OPTIONS: FORCE
- @echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@+
- @echo TEST_SHELL_PATH=\''$(subst ','\'',$(TEST_SHELL_PATH_SQ))'\' >>$@+
- @echo PERL_PATH=\''$(subst ','\'',$(PERL_PATH_SQ))'\' >>$@+
- @echo DIFF=\''$(subst ','\'',$(subst ','\'',$(DIFF)))'\' >>$@+
- @echo PYTHON_PATH=\''$(subst ','\'',$(PYTHON_PATH_SQ))'\' >>$@+
- @echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@+
- @echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@+
- @echo NO_ICONV=\''$(subst ','\'',$(subst ','\'',$(NO_ICONV)))'\' >>$@+
- @echo NO_EXPAT=\''$(subst ','\'',$(subst ','\'',$(NO_EXPAT)))'\' >>$@+
- @echo USE_LIBPCRE2=\''$(subst ','\'',$(subst ','\'',$(USE_LIBPCRE2)))'\' >>$@+
- @echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@+
- @echo NO_PTHREADS=\''$(subst ','\'',$(subst ','\'',$(NO_PTHREADS)))'\' >>$@+
- @echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@+
- @echo NO_REGEX=\''$(subst ','\'',$(subst ','\'',$(NO_REGEX)))'\' >>$@+
- @echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@+
- @echo PAGER_ENV=\''$(subst ','\'',$(subst ','\'',$(PAGER_ENV)))'\' >>$@+
- @echo SANITIZE_LEAK=\''$(subst ','\'',$(subst ','\'',$(SANITIZE_LEAK)))'\' >>$@+
- @echo SANITIZE_ADDRESS=\''$(subst ','\'',$(subst ','\'',$(SANITIZE_ADDRESS)))'\' >>$@+
- @echo X=\'$(X)\' >>$@+
-ifdef FSMONITOR_DAEMON_BACKEND
- @echo FSMONITOR_DAEMON_BACKEND=\''$(subst ','\'',$(subst ','\'',$(FSMONITOR_DAEMON_BACKEND)))'\' >>$@+
-endif
-ifdef FSMONITOR_OS_SETTINGS
- @echo FSMONITOR_OS_SETTINGS=\''$(subst ','\'',$(subst ','\'',$(FSMONITOR_OS_SETTINGS)))'\' >>$@+
-endif
-ifdef TEST_OUTPUT_DIRECTORY
- @echo TEST_OUTPUT_DIRECTORY=\''$(subst ','\'',$(subst ','\'',$(TEST_OUTPUT_DIRECTORY)))'\' >>$@+
-endif
-ifdef GIT_TEST_OPTS
- @echo GIT_TEST_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_OPTS)))'\' >>$@+
-endif
-ifdef GIT_TEST_CMP
- @echo GIT_TEST_CMP=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_CMP)))'\' >>$@+
-endif
-ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
- @echo GIT_TEST_CMP_USE_COPIED_CONTEXT=YesPlease >>$@+
-endif
-ifdef GIT_TEST_UTF8_LOCALE
- @echo GIT_TEST_UTF8_LOCALE=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_UTF8_LOCALE)))'\' >>$@+
-endif
- @echo NO_GETTEXT=\''$(subst ','\'',$(subst ','\'',$(NO_GETTEXT)))'\' >>$@+
-ifdef GIT_PERF_REPEAT_COUNT
- @echo GIT_PERF_REPEAT_COUNT=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPEAT_COUNT)))'\' >>$@+
-endif
-ifdef GIT_PERF_REPO
- @echo GIT_PERF_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPO)))'\' >>$@+
-endif
-ifdef GIT_PERF_LARGE_REPO
- @echo GIT_PERF_LARGE_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_LARGE_REPO)))'\' >>$@+
-endif
-ifdef GIT_PERF_MAKE_OPTS
- @echo GIT_PERF_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_OPTS)))'\' >>$@+
-endif
-ifdef GIT_PERF_MAKE_COMMAND
- @echo GIT_PERF_MAKE_COMMAND=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_COMMAND)))'\' >>$@+
-endif
-ifdef GIT_INTEROP_MAKE_OPTS
- @echo GIT_INTEROP_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_INTEROP_MAKE_OPTS)))'\' >>$@+
-endif
-ifdef GIT_TEST_INDEX_VERSION
- @echo GIT_TEST_INDEX_VERSION=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_INDEX_VERSION)))'\' >>$@+
-endif
-ifdef GIT_TEST_PERL_FATAL_WARNINGS
- @echo GIT_TEST_PERL_FATAL_WARNINGS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_PERL_FATAL_WARNINGS)))'\' >>$@+
-endif
-ifdef RUNTIME_PREFIX
- @echo RUNTIME_PREFIX=\'true\' >>$@+
-else
- @echo RUNTIME_PREFIX=\'false\' >>$@+
-endif
+ @sed \
+ -e "s|@SHELL_PATH@|\'$(SHELL_PATH_SQ)\'|" \
+ -e "s|@TEST_SHELL_PATH@|\'$(TEST_SHELL_PATH_SQ)\'|" \
+ -e "s|@PERL_PATH@|\'$(PERL_PATH_SQ)\'|" \
+ -e "s|@DIFF@|\'$(DIFF)\'|" \
+ -e "s|@PYTHON_PATH@|\'$(PYTHON_PATH_SQ)\'|" \
+ -e "s|@TAR@|\'$(TAR)\'|" \
+ -e "s|@NO_CURL@|\'$(NO_CURL)\'|" \
+ -e "s|@NO_ICONV@|\'$(NO_ICONV)\'|" \
+ -e "s|@NO_EXPAT@|\'$(NO_EXPAT)\'|" \
+ -e "s|@USE_LIBPCRE2@|\'$(USE_LIBPCRE2)\'|" \
+ -e "s|@NO_PERL@|\'$(NO_PERL)\'|" \
+ -e "s|@NO_PTHREADS@|\'$(NO_PTHREADS)\'|" \
+ -e "s|@NO_PYTHON@|\'$(NO_PYTHON)\'|" \
+ -e "s|@NO_REGEX@|\'$(NO_REGEX)\'|" \
+ -e "s|@NO_UNIX_SOCKETS@|\'$(NO_UNIX_SOCKETS)\'|" \
+ -e "s|@PAGER_ENV@|\'$(PAGER_ENV)\'|" \
+ -e "s|@SANITIZE_LEAK@|\'$(SANITIZE_LEAK)\'|" \
+ -e "s|@SANITIZE_ADDRESS@|\'$(SANITIZE_ADDRESS)\'|" \
+ -e "s|@X@|\'$(X)\'|" \
+ -e "s|@FSMONITOR_DAEMON_BACKEND@|\'$(FSMONITOR_DAEMON_BACKEND)\'|" \
+ -e "s|@FSMONITOR_OS_SETTINGS@|\'$(FSMONITOR_OS_SETTINGS)\'|" \
+ -e "s|@TEST_OUTPUT_DIRECTORY@|\'$(TEST_OUTPUT_DIRECTORY)\'|" \
+ -e "s|@GIT_TEST_OPTS@|\'$(GIT_TEST_OPTS)\'|" \
+ -e "s|@GIT_TEST_CMP@|\'$(GIT_TEST_CMP)\'|" \
+ -e "s|@GIT_TEST_CMP_USE_COPIED_CONTEXT@|\'$(GIT_TEST_CMP_USE_COPIED_CONTEXT)\'|" \
+ -e "s|@GIT_TEST_UTF8_LOCALE@|\'$(GIT_TEST_UTF8_LOCALE)\'|" \
+ -e "s|@NO_GETTEXT@|\'$(NO_GETTEXT)\'|" \
+ -e "s|@GIT_PERF_REPEAT_COUNT@|\'$(GIT_PERF_REPEAT_COUNT)\'|" \
+ -e "s|@GIT_PERF_REPO@|\'$(GIT_PERF_REPO)\'|" \
+ -e "s|@GIT_PERF_LARGE_REPO@|\'$(GIT_PERF_LARGE_REPO)\'|" \
+ -e "s|@GIT_PERF_MAKE_OPTS@|\'$(GIT_PERF_MAKE_OPTS)\'|" \
+ -e "s|@GIT_PERF_MAKE_COMMAND@|\'$(GIT_PERF_MAKE_COMMAND)\'|" \
+ -e "s|@GIT_INTEROP_MAKE_OPTS@|\'$(GIT_INTEROP_MAKE_OPTS)\'|" \
+ -e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \
+ -e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \
+ -e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX)\'|" \
+ GIT-BUILD-OPTIONS.in >$@+
+ @if grep -q '^[A-Z][A-Z_]*=@.*@$$' $@+; then echo "Unsubstituted build options in $@" >&2 && exit 1; fi
@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
@if test -f GIT-BUILD-DIR; then rm GIT-BUILD-DIR; fi
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 8974bb9fa202a0556fd9b16d105836d8cb66f543..680e5b3c8b0382d2723855f11d7fe9c7d6b28bde 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -1117,27 +1117,47 @@ if(NOT PYTHON_TESTS)
set(NO_PYTHON 1)
endif()
-file(WRITE ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "SHELL_PATH='${SHELL_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "TEST_SHELL_PATH='${TEST_SHELL_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PERL_PATH='${PERL_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "DIFF='${DIFF}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PYTHON_PATH='${PYTHON_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "TAR='${TAR}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_CURL='${NO_CURL}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_ICONV='${NO_ICONV}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_EXPAT='${NO_EXPAT}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PERL='${NO_PERL}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PTHREADS='${NO_PTHREADS}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_UNIX_SOCKETS='${NO_UNIX_SOCKETS}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PAGER_ENV='${PAGER_ENV}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "X='${EXE_EXTENSION}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_GETTEXT='${NO_GETTEXT}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "RUNTIME_PREFIX='${RUNTIME_PREFIX}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PYTHON='${NO_PYTHON}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "SUPPORTS_SIMPLE_IPC='${SUPPORTS_SIMPLE_IPC}'\n")
+file(STRINGS ${CMAKE_SOURCE_DIR}/GIT-BUILD-OPTIONS.in git_build_options NEWLINE_CONSUME)
+string(REPLACE "@SHELL_PATH@" "${SHELL_PATH}" git_build_options "${git_build_options}")
+string(REPLACE "@TEST_SHELL_PATH@" "${TEST_SHELL_PATH}" git_build_options "${git_build_options}")
+string(REPLACE "@PERL_PATH@" "${PERL_PATH}" git_build_options "${git_build_options}")
+string(REPLACE "@DIFF@" "${DIFF}" git_build_options "${git_build_options}")
+string(REPLACE "@PYTHON_PATH@" "${PYTHON_PATH}" git_build_options "${git_build_options}")
+string(REPLACE "@TAR@" "${TAR}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_CURL@" "${NO_CURL}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_ICONV@" "${NO_ICONV}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_EXPAT@" "${NO_EXPAT}" git_build_options "${git_build_options}")
+string(REPLACE "@USE_LIBPCRE2@" "" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PERL@" "${NO_PERL}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PTHREADS@" "${NO_PTHREADS}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PYTHON@" "${NO_PYTHON}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_REGEX@" "" git_build_options "${git_build_options}")
+string(REPLACE "@NO_UNIX_SOCKETS@" "${NO_UNIX_SOCKETS}" git_build_options "${git_build_options}")
+string(REPLACE "@PAGER_ENV@" "${PAGER_ENV}" git_build_options "${git_build_options}")
+string(REPLACE "@SANITIZE_LEAK@" "" git_build_options "${git_build_options}")
+string(REPLACE "@SANITIZE_ADDRESS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@X@" "${EXE_EXTENSION}" git_build_options "${git_build_options}")
+string(REPLACE "@FSMONITOR_DAEMON_BACKEND@" "win32" git_build_options "${git_build_options}")
+string(REPLACE "@FSMONITOR_OS_SETTINGS@" "win32" git_build_options "${git_build_options}")
+string(REPLACE "@TEST_OUTPUT_DIRECTORY@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_OPTS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_CMP@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_CMP_USE_COPIED_CONTEXT@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_UTF8_LOCALE@" "" git_build_options "${git_build_options}")
+string(REPLACE "@NO_GETTEXT@" "${NO_GETTEXT}" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_REPEAT_COUNT@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_REPO@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_LARGE_REPO@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_MAKE_OPTS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_MAKE_COMMAND@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@RUNTIME_PREFIX@" "${RUNTIME_PREFIX}" git_build_options "${git_build_options}")
if(USE_VCPKG)
- file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
+ string(APPEND git_build_options "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
endif()
+file(WRITE ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS ${git_build_options})
#Make the tests work when building out of the source tree
get_filename_component(CACHE_PATH ${CMAKE_CURRENT_LIST_DIR}/../../CMakeCache.txt ABSOLUTE)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index a278181a0568a2422ab1e7f007bc016b95a58e63..4dd641baefee532e2c0fa80bc78c7b7c6ab768a1 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -35,12 +35,6 @@ else
# needing to exist.
TEST_DIRECTORY=$(cd "$TEST_DIRECTORY" && pwd) || exit 1
fi
-if test -z "$TEST_OUTPUT_DIRECTORY"
-then
- # Similarly, override this to store the test-results subdir
- # elsewhere
- TEST_OUTPUT_DIRECTORY=$TEST_DIRECTORY
-fi
GIT_BUILD_DIR="${TEST_DIRECTORY%/t}"
if test "$TEST_DIRECTORY" = "$GIT_BUILD_DIR"
then
@@ -100,6 +94,13 @@ fi
. "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
export PERL_PATH SHELL_PATH
+if test -z "$TEST_OUTPUT_DIRECTORY"
+then
+ # Similarly, override this to store the test-results subdir
+ # elsewhere
+ TEST_OUTPUT_DIRECTORY=$TEST_DIRECTORY
+fi
+
# In t0000, we need to override test directories of nested testcases. In case
# the developer has TEST_OUTPUT_DIRECTORY part of his build options, then we'd
# reset this value to instead contain what the developer has specified. We thus
--
2.47.0.251.gb31fb630c0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH RFC v6 02/19] Makefile: consistently use @PLACEHOLDER@ to substitute
2024-11-12 17:02 ` [PATCH RFC v6 " Patrick Steinhardt
2024-11-12 17:02 ` [PATCH RFC v6 01/19] Makefile: use common template for GIT-BUILD-OPTIONS Patrick Steinhardt
@ 2024-11-12 17:02 ` Patrick Steinhardt
2024-11-12 17:02 ` [PATCH RFC v6 03/19] Makefile: consistently use PERL_PATH Patrick Steinhardt
` (18 subsequent siblings)
20 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-12 17:02 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King
We have a bunch of placeholders in our scripts that we replace at build
time, for example by using sed(1). These placeholders come in three
different formats: @PLACEHOLDER@, @@PLACEHOLDER@@ and ++PLACEHOLDER++.
Next to being inconsistent it also creates a bit of a problem with
CMake, which only supports the first syntax in its `configure_file()`
function. To work around that we instead manually replace placeholders
via string operations, which is a hassle and removes safeguards that
CMake has to verify that we didn't forget to replace any placeholders.
Besides that, other build systems like Meson also support the CMake
syntax.
Unify our codebase to consistently use the syntax supported by such
build systems.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 44 ++++++++++++------------
configure.ac | 2 +-
contrib/buildsystems/CMakeLists.txt | 34 +++++++++---------
git-cvsserver.perl | 2 +-
git-instaweb.sh | 8 ++---
git-request-pull.sh | 2 +-
git-send-email.perl | 2 +-
git-sh-i18n.sh | 6 ++--
git-sh-setup.sh | 6 ++--
git-svn.perl | 2 +-
gitk-git/po/vi.po | 2 +-
gitweb/Makefile | 44 ++++++++++++------------
gitweb/gitweb.perl | 44 ++++++++++++------------
perl/Git/I18N.pm | 6 ++--
perl/Git/LoadCPAN.pm | 6 ++--
| 2 +-
| 8 ++---
unimplemented.sh | 2 +-
wrap-for-bin.sh | 18 +++++-----
19 files changed, 120 insertions(+), 120 deletions(-)
diff --git a/Makefile b/Makefile
index 962df75635a8cbf7114970ddfe7948ff17c65fdc..d59f6c16868e24a1e13b0c16cc05adb79f81bbc8 100644
--- a/Makefile
+++ b/Makefile
@@ -1555,10 +1555,10 @@ endif
ifdef SANE_TOOL_PATH
SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH))
-BROKEN_PATH_FIX = 's|^\# @@BROKEN_PATH_FIX@@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|'
+BROKEN_PATH_FIX = 's|^\# @BROKEN_PATH_FIX@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|'
PATH := $(SANE_TOOL_PATH):${PATH}
else
-BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d'
+BROKEN_PATH_FIX = '/^\# @BROKEN_PATH_FIX@$$/d'
endif
ifeq (,$(HOST_CPU))
@@ -2548,13 +2548,13 @@ GIT-SCRIPT-DEFINES: FORCE
define cmd_munge_script
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
- -e 's|@@DIFF@@|$(DIFF_SQ)|' \
- -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' \
- -e 's/@@USE_GETTEXT_SCHEME@@/$(USE_GETTEXT_SCHEME)/g' \
+ -e 's|@DIFF@|$(DIFF_SQ)|' \
+ -e 's|@LOCALEDIR@|$(localedir_SQ)|g' \
+ -e 's/@USE_GETTEXT_SCHEME@/$(USE_GETTEXT_SCHEME)/g' \
-e $(BROKEN_PATH_FIX) \
- -e 's|@@GITWEBDIR@@|$(gitwebdir_SQ)|g' \
- -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
- -e 's|@@PAGER_ENV@@|$(PAGER_ENV_SQ)|g' \
+ -e 's|@GITWEBDIR@|$(gitwebdir_SQ)|g' \
+ -e 's|@PERL@|$(PERL_PATH_SQ)|g' \
+ -e 's|@PAGER_ENV@|$(PAGER_ENV_SQ)|g' \
$@.sh >$@+
endef
@@ -2611,7 +2611,7 @@ $(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
-e ' r GIT-PERL-HEADER' \
-e ' G' \
-e '}' \
- -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
+ -e 's/@GIT_VERSION@/$(GIT_VERSION)/g' \
$< >$@+ && \
chmod +x $@+ && \
mv $@+ $@
@@ -2629,11 +2629,11 @@ GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile
INSTLIBDIR='$(perllibdir_SQ)' && \
INSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \
INSTLIBDIR="$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}" && \
- sed -e 's=@@PATHSEP@@=$(pathsep)=g' \
- -e "s=@@INSTLIBDIR@@=$$INSTLIBDIR=g" \
- -e 's=@@PERLLIBDIR_REL@@=$(perllibdir_relative_SQ)=g' \
- -e 's=@@GITEXECDIR_REL@@=$(gitexecdir_relative_SQ)=g' \
- -e 's=@@LOCALEDIR_REL@@=$(localedir_relative_SQ)=g' \
+ sed -e 's=@PATHSEP@=$(pathsep)=g' \
+ -e "s=@INSTLIBDIR@=$$INSTLIBDIR=g" \
+ -e 's=@PERLLIBDIR_REL@=$(perllibdir_relative_SQ)=g' \
+ -e 's=@GITEXECDIR_REL@=$(gitexecdir_relative_SQ)=g' \
+ -e 's=@LOCALEDIR_REL@=$(localedir_relative_SQ)=g' \
$< >$@+ && \
mv $@+ $@
@@ -2649,7 +2649,7 @@ else # NO_PERL
$(SCRIPT_PERL_GEN) git-instaweb: % : unimplemented.sh
$(QUIET_GEN) \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@@REASON@@|NO_PERL=$(NO_PERL)|g' \
+ -e 's|@REASON@|NO_PERL=$(NO_PERL)|g' \
unimplemented.sh >$@+ && \
chmod +x $@+ && \
mv $@+ $@
@@ -2670,13 +2670,13 @@ else # NO_PYTHON
$(SCRIPT_PYTHON_GEN): % : unimplemented.sh
$(QUIET_GEN) \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@@REASON@@|NO_PYTHON=$(NO_PYTHON)|g' \
+ -e 's|@REASON@|NO_PYTHON=$(NO_PYTHON)|g' \
unimplemented.sh >$@+ && \
chmod +x $@+ && \
mv $@+ $@
endif # NO_PYTHON
-CONFIGURE_RECIPE = sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
+CONFIGURE_RECIPE = sed -e 's/@GIT_VERSION@/$(GIT_VERSION)/g' \
configure.ac >configure.ac+ && \
autoconf -o configure configure.ac+ && \
$(RM) configure.ac+
@@ -3104,9 +3104,9 @@ endif
perl/build/lib/%.pm: perl/%.pm GIT-PERL-DEFINES
$(call mkdir_p_parent_template)
$(QUIET_GEN) \
- sed -e 's|@@LOCALEDIR@@|$(perl_localedir_SQ)|g' \
- -e 's|@@NO_GETTEXT@@|$(NO_GETTEXT_SQ)|g' \
- -e 's|@@NO_PERL_CPAN_FALLBACKS@@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \
+ sed -e 's|@LOCALEDIR@|$(perl_localedir_SQ)|g' \
+ -e 's|@NO_GETTEXT@|$(NO_GETTEXT_SQ)|g' \
+ -e 's|@NO_PERL_CPAN_FALLBACKS@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \
< $< > $@
perl/build/man/man3/Git.3pm: perl/Git.pm
@@ -3225,8 +3225,8 @@ all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PR
bin-wrappers/%: wrap-for-bin.sh
$(call mkdir_p_parent_template)
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@@BUILD_DIR@@|$(shell pwd)|' \
- -e 's|@@PROG@@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
+ -e 's|@BUILD_DIR@|$(shell pwd)|' \
+ -e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
chmod +x $@
# GNU make supports exporting all variables by "export" without parameters.
diff --git a/configure.ac b/configure.ac
index d1a96da14eb56766e1538da80ab97ed8a99b24f6..5923edc44aa7b6cc355fa6589b6d075b0c0a7772 100644
--- a/configure.ac
+++ b/configure.ac
@@ -142,7 +142,7 @@ fi
## Configure body starts here.
AC_PREREQ(2.59)
-AC_INIT([git], [@@GIT_VERSION@@], [git@vger.kernel.org])
+AC_INIT([git], [@GIT_VERSION@], [git@vger.kernel.org])
AC_CONFIG_SRCDIR([git.c])
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 680e5b3c8b0382d2723855f11d7fe9c7d6b28bde..a41540458b7ae4f50ec92c115dc6fab3ef5088ff 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -836,14 +836,14 @@ set(git_shell_scripts
foreach(script ${git_shell_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.sh content NEWLINE_CONSUME)
string(REPLACE "@SHELL_PATH@" "${SHELL_PATH}" content "${content}")
- string(REPLACE "@@DIFF@@" "diff" content "${content}")
+ string(REPLACE "@DIFF@" "diff" content "${content}")
string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}")
string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" content "${content}")
- string(REPLACE "@@NO_CURL@@" "" content "${content}")
- string(REPLACE "@@USE_GETTEXT_SCHEME@@" "" content "${content}")
- string(REPLACE "# @@BROKEN_PATH_FIX@@" "" content "${content}")
- string(REPLACE "@@PERL@@" "${PERL_PATH}" content "${content}")
- string(REPLACE "@@PAGER_ENV@@" "LESS=FRX LV=-c" content "${content}")
+ string(REPLACE "@NO_CURL@" "" content "${content}")
+ string(REPLACE "@USE_GETTEXT_SCHEME@" "" content "${content}")
+ string(REPLACE "# @BROKEN_PATH_FIX@" "" content "${content}")
+ string(REPLACE "@PERL@" "${PERL_PATH}" content "${content}")
+ string(REPLACE "@PAGER_ENV@" "LESS=FRX LV=-c" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
endforeach()
@@ -852,13 +852,13 @@ parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" ".perl")
#create perl header
file(STRINGS ${CMAKE_SOURCE_DIR}/perl/header_templates/fixed_prefix.template.pl perl_header )
-string(REPLACE "@@PATHSEP@@" ":" perl_header "${perl_header}")
-string(REPLACE "@@INSTLIBDIR@@" "${INSTLIBDIR}" perl_header "${perl_header}")
+string(REPLACE "@PATHSEP@" ":" perl_header "${perl_header}")
+string(REPLACE "@INSTLIBDIR@" "${INSTLIBDIR}" perl_header "${perl_header}")
foreach(script ${git_perl_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.perl content NEWLINE_CONSUME)
string(REPLACE "#!/usr/bin/perl" "#!/usr/bin/perl\n${perl_header}\n" content "${content}")
- string(REPLACE "@@GIT_VERSION@@" "${PROJECT_VERSION}" content "${content}")
+ string(REPLACE "@GIT_VERSION@" "${PROJECT_VERSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
endforeach()
@@ -873,8 +873,8 @@ file(GLOB_RECURSE perl_modules "${CMAKE_SOURCE_DIR}/perl/*.pm")
foreach(pm ${perl_modules})
string(REPLACE "${CMAKE_SOURCE_DIR}/perl/" "" file_path ${pm})
file(STRINGS ${pm} content NEWLINE_CONSUME)
- string(REPLACE "@@LOCALEDIR@@" "${LOCALEDIR}" content "${content}")
- string(REPLACE "@@NO_PERL_CPAN_FALLBACKS@@" "" content "${content}")
+ string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}")
+ string(REPLACE "@NO_PERL_CPAN_FALLBACKS@" "" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/perl/build/lib/${file_path} ${content})
#test-lib.sh requires perl/build/lib to be the build directory of perl modules
endforeach()
@@ -1056,21 +1056,21 @@ set(wrapper_test_scripts
foreach(script ${wrapper_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
- string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
- string(REPLACE "@@PROG@@" "${script}${EXE_EXTENSION}" content "${content}")
+ string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+ string(REPLACE "@PROG@" "${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
foreach(script ${wrapper_test_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
- string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
- string(REPLACE "@@PROG@@" "t/helper/${script}${EXE_EXTENSION}" content "${content}")
+ string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+ string(REPLACE "@PROG@" "t/helper/${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
-string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
-string(REPLACE "@@PROG@@" "git-cvsserver" content "${content}")
+string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+string(REPLACE "@PROG@" "git-cvsserver" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})
#options for configuring test options
diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index 124f598bdc07058b139f8dcbf8245128c52d9176..70ae7cb8e456885ddf2b13a70d21831cdaa7bf06 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -26,7 +26,7 @@
use File::Basename;
use Getopt::Long qw(:config require_order no_ignore_case);
-my $VERSION = '@@GIT_VERSION@@';
+my $VERSION = '@GIT_VERSION@';
my $log = GITCVS::log->new();
my $cfg;
diff --git a/git-instaweb.sh b/git-instaweb.sh
index 8dbe21d5887595352bc0159ea9befdf296b8105f..c8efb1205a8e2a66a6aced840980978897e122bc 100755
--- a/git-instaweb.sh
+++ b/git-instaweb.sh
@@ -3,7 +3,7 @@
# Copyright (c) 2006 Eric Wong
#
-PERL='@@PERL@@'
+PERL='@PERL@'
OPTIONS_KEEPDASHDASH=
OPTIONS_STUCKLONG=
OPTIONS_SPEC="\
@@ -38,8 +38,8 @@ conf="$GIT_DIR/gitweb/httpd.conf"
# if installed, it doesn't need further configuration (module_path)
test -z "$httpd" && httpd='lighttpd -f'
-# Default is @@GITWEBDIR@@
-test -z "$root" && root='@@GITWEBDIR@@'
+# Default is @GITWEBDIR@
+test -z "$root" && root='@GITWEBDIR@'
# any untaken local port will do...
test -z "$port" && port=1234
@@ -716,7 +716,7 @@ EOF
gitweb_conf() {
cat > "$fqgitdir/gitweb/gitweb_config.perl" <<EOF
-#!@@PERL@@
+#!@PERL@
our \$projectroot = "$(dirname "$fqgitdir")";
our \$git_temp = "$fqgitdir/gitweb/tmp";
our \$projects_list = \$projectroot;
diff --git a/git-request-pull.sh b/git-request-pull.sh
index 01640a044bb10f4167338fca957c43a240e1b6c0..10c88639e28c02650ffea3d4671afa9a9f0bb182 100755
--- a/git-request-pull.sh
+++ b/git-request-pull.sh
@@ -112,7 +112,7 @@ find_matching_ref='
}
'
-set fnord $(git ls-remote "$url" | @@PERL@@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
+set fnord $(git ls-remote "$url" | @PERL@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
remote_sha1=$2
ref=$3
diff --git a/git-send-email.perl b/git-send-email.perl
index c835d4c11af259242f1128101a15b237302c7f42..02805c43e52570fe5ae5432fb9343ce9165cc16b 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1501,7 +1501,7 @@ sub gen_header {
@recipients = unique_email_list(@recipients,@cc,@initial_bcc);
@recipients = (map { extract_valid_address_or_die($_) } @recipients);
my $date = format_2822_time($time++);
- my $gitversion = '@@GIT_VERSION@@';
+ my $gitversion = '@GIT_VERSION@';
if ($gitversion =~ m/..GIT_VERSION../) {
$gitversion = Git::version();
}
diff --git a/git-sh-i18n.sh b/git-sh-i18n.sh
index a15c0620db6893898152b1c9e363a0af7f1b304e..ae4b2d6ba9dc061ef40ef1867f0cd5e975df8fe5 100644
--- a/git-sh-i18n.sh
+++ b/git-sh-i18n.sh
@@ -9,7 +9,7 @@ TEXTDOMAIN=git
export TEXTDOMAIN
if test -z "$GIT_TEXTDOMAINDIR"
then
- TEXTDOMAINDIR="@@LOCALEDIR@@"
+ TEXTDOMAINDIR="@LOCALEDIR@"
else
TEXTDOMAINDIR="$GIT_TEXTDOMAINDIR"
fi
@@ -17,9 +17,9 @@ export TEXTDOMAINDIR
# First decide what scheme to use...
GIT_INTERNAL_GETTEXT_SH_SCHEME=fallthrough
-if test -n "@@USE_GETTEXT_SCHEME@@"
+if test -n "@USE_GETTEXT_SCHEME@"
then
- GIT_INTERNAL_GETTEXT_SH_SCHEME="@@USE_GETTEXT_SCHEME@@"
+ GIT_INTERNAL_GETTEXT_SH_SCHEME="@USE_GETTEXT_SCHEME@"
elif test -n "$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS"
then
: no probing necessary
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index ce273fe0e48d997cb067e77707026616a9302eb2..19aef72ec2553027bb25a5968d4e428ba986fdb2 100644
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -41,7 +41,7 @@ git_broken_path_fix () {
esac
}
-# @@BROKEN_PATH_FIX@@
+# @BROKEN_PATH_FIX@
# Source git-sh-i18n for gettext support.
. "$(git --exec-path)/git-sh-i18n"
@@ -154,7 +154,7 @@ git_pager() {
else
GIT_PAGER=cat
fi
- for vardef in @@PAGER_ENV@@
+ for vardef in @PAGER_ENV@
do
var=${vardef%%=*}
eval ": \"\${$vardef}\" && export $var"
@@ -280,7 +280,7 @@ get_author_ident_from_commit () {
# remove lines from $1 that are not in $2, leaving only common lines.
create_virtual_base() {
sz0=$(wc -c <"$1")
- @@DIFF@@ -u -La/"$1" -Lb/"$1" "$1" "$2" | git apply --no-add
+ @DIFF@ -u -La/"$1" -Lb/"$1" "$1" "$2" | git apply --no-add
sz1=$(wc -c <"$1")
# If we do not have enough common material, it is not
diff --git a/git-svn.perl b/git-svn.perl
index 01e7a70de1c0eb37b3feefe364ad78d4c8973097..dcf65cf1d1d4dc53b9f813f931ecff1a387c2657 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -9,7 +9,7 @@
$_revision $_repository
$_q $_authors $_authors_prog %users/;
$AUTHOR = 'Eric Wong <normalperson@yhbt.net>';
-$VERSION = '@@GIT_VERSION@@';
+$VERSION = '@GIT_VERSION@';
use Carp qw/croak/;
use File::Basename qw/dirname basename/;
diff --git a/gitk-git/po/vi.po b/gitk-git/po/vi.po
index 59674986604891d9901e87c163e61dd39db14184..184430dcdeea7cbb76895840f84a889b6abc20bf 100644
--- a/gitk-git/po/vi.po
+++ b/gitk-git/po/vi.po
@@ -5,7 +5,7 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: gitk @@GIT_VERSION@@\n"
+"Project-Id-Version: gitk @GIT_VERSION@\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-05-17 14:32+1000\n"
"PO-Revision-Date: 2015-09-15 07:33+0700\n"
diff --git a/gitweb/Makefile b/gitweb/Makefile
index 3b68ab2d672c4afae62f8f4dc024e0911027b58d..164c8d53757f98599ad14eeb22ca8d542eb7502a 100644
--- a/gitweb/Makefile
+++ b/gitweb/Makefile
@@ -79,28 +79,28 @@ GITWEB_JSLIB_FILES += static/js/blame_incremental.js
GITWEB_REPLACE = \
- -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
- -e 's|++GIT_BINDIR++|$(bindir)|g' \
- -e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \
- -e 's|++GITWEB_CONFIG_SYSTEM++|$(GITWEB_CONFIG_SYSTEM)|g' \
- -e 's|++GITWEB_CONFIG_COMMON++|$(GITWEB_CONFIG_COMMON)|g' \
- -e 's|++GITWEB_HOME_LINK_STR++|$(GITWEB_HOME_LINK_STR)|g' \
- -e 's|++GITWEB_SITENAME++|$(GITWEB_SITENAME)|g' \
- -e 's|++GITWEB_PROJECTROOT++|$(GITWEB_PROJECTROOT)|g' \
- -e 's|"++GITWEB_PROJECT_MAXDEPTH++"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
- -e 's|++GITWEB_EXPORT_OK++|$(GITWEB_EXPORT_OK)|g' \
- -e 's|++GITWEB_STRICT_EXPORT++|$(GITWEB_STRICT_EXPORT)|g' \
- -e 's|++GITWEB_BASE_URL++|$(GITWEB_BASE_URL)|g' \
- -e 's|++GITWEB_LIST++|$(GITWEB_LIST)|g' \
- -e 's|++GITWEB_HOMETEXT++|$(GITWEB_HOMETEXT)|g' \
- -e 's|++GITWEB_CSS++|$(GITWEB_CSS)|g' \
- -e 's|++GITWEB_LOGO++|$(GITWEB_LOGO)|g' \
- -e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \
- -e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \
- -e 's|++GITWEB_SITE_HTML_HEAD_STRING++|$(GITWEB_SITE_HTML_HEAD_STRING)|g' \
- -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \
- -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \
- -e 's|++HIGHLIGHT_BIN++|$(HIGHLIGHT_BIN)|g'
+ -e 's|@GIT_VERSION@|$(GIT_VERSION)|g' \
+ -e 's|@GIT_BINDIR@|$(bindir)|g' \
+ -e 's|@GITWEB_CONFIG@|$(GITWEB_CONFIG)|g' \
+ -e 's|@GITWEB_CONFIG_SYSTEM@|$(GITWEB_CONFIG_SYSTEM)|g' \
+ -e 's|@GITWEB_CONFIG_COMMON@|$(GITWEB_CONFIG_COMMON)|g' \
+ -e 's|@GITWEB_HOME_LINK_STR@|$(GITWEB_HOME_LINK_STR)|g' \
+ -e 's|@GITWEB_SITENAME@|$(GITWEB_SITENAME)|g' \
+ -e 's|@GITWEB_PROJECTROOT@|$(GITWEB_PROJECTROOT)|g' \
+ -e 's|"@GITWEB_PROJECT_MAXDEPTH@"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
+ -e 's|@GITWEB_EXPORT_OK@|$(GITWEB_EXPORT_OK)|g' \
+ -e 's|@GITWEB_STRICT_EXPORT@|$(GITWEB_STRICT_EXPORT)|g' \
+ -e 's|@GITWEB_BASE_URL@|$(GITWEB_BASE_URL)|g' \
+ -e 's|@GITWEB_LIST@|$(GITWEB_LIST)|g' \
+ -e 's|@GITWEB_HOMETEXT@|$(GITWEB_HOMETEXT)|g' \
+ -e 's|@GITWEB_CSS@|$(GITWEB_CSS)|g' \
+ -e 's|@GITWEB_LOGO@|$(GITWEB_LOGO)|g' \
+ -e 's|@GITWEB_FAVICON@|$(GITWEB_FAVICON)|g' \
+ -e 's|@GITWEB_JS@|$(GITWEB_JS)|g' \
+ -e 's|@GITWEB_SITE_HTML_HEAD_STRING@|$(GITWEB_SITE_HTML_HEAD_STRING)|g' \
+ -e 's|@GITWEB_SITE_HEADER@|$(GITWEB_SITE_HEADER)|g' \
+ -e 's|@GITWEB_SITE_FOOTER@|$(GITWEB_SITE_FOOTER)|g' \
+ -e 's|@HIGHLIGHT_BIN@|$(HIGHLIGHT_BIN)|g'
.PHONY: FORCE
$(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS: FORCE
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index b09a8d052383fdf1190f1fab008ddef99290e1f0..76e1f4e244fd23dd29b935e83753efa9c6d5bb5e 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -35,7 +35,7 @@ BEGIN
CGI->compile() if $ENV{'MOD_PERL'};
}
-our $version = "++GIT_VERSION++";
+our $version = "@GIT_VERSION@";
our ($my_url, $my_uri, $base_url, $path_info, $home_link);
sub evaluate_uri {
@@ -80,46 +80,46 @@ sub evaluate_uri {
# core git executable to use
# this can just be "git" if your webserver has a sensible PATH
-our $GIT = "++GIT_BINDIR++/git";
+our $GIT = "@GIT_BINDIR@/git";
# absolute fs-path which will be prepended to the project path
#our $projectroot = "/pub/scm";
-our $projectroot = "++GITWEB_PROJECTROOT++";
+our $projectroot = "@GITWEB_PROJECTROOT@";
# fs traversing limit for getting project list
# the number is relative to the projectroot
-our $project_maxdepth = "++GITWEB_PROJECT_MAXDEPTH++";
+our $project_maxdepth = "@GITWEB_PROJECT_MAXDEPTH@";
# string of the home link on top of all pages
-our $home_link_str = "++GITWEB_HOME_LINK_STR++";
+our $home_link_str = "@GITWEB_HOME_LINK_STR@";
# extra breadcrumbs preceding the home link
our @extra_breadcrumbs = ();
# name of your site or organization to appear in page titles
# replace this with something more descriptive for clearer bookmarks
-our $site_name = "++GITWEB_SITENAME++"
+our $site_name = "@GITWEB_SITENAME@"
|| ($ENV{'SERVER_NAME'} || "Untitled") . " Git";
# html snippet to include in the <head> section of each page
-our $site_html_head_string = "++GITWEB_SITE_HTML_HEAD_STRING++";
+our $site_html_head_string = "@GITWEB_SITE_HTML_HEAD_STRING@";
# filename of html text to include at top of each page
-our $site_header = "++GITWEB_SITE_HEADER++";
+our $site_header = "@GITWEB_SITE_HEADER@";
# html text to include at home page
-our $home_text = "++GITWEB_HOMETEXT++";
+our $home_text = "@GITWEB_HOMETEXT@";
# filename of html text to include at bottom of each page
-our $site_footer = "++GITWEB_SITE_FOOTER++";
+our $site_footer = "@GITWEB_SITE_FOOTER@";
# URI of stylesheets
-our @stylesheets = ("++GITWEB_CSS++");
+our @stylesheets = ("@GITWEB_CSS@");
# URI of a single stylesheet, which can be overridden in GITWEB_CONFIG.
our $stylesheet = undef;
# URI of GIT logo (72x27 size)
-our $logo = "++GITWEB_LOGO++";
+our $logo = "@GITWEB_LOGO@";
# URI of GIT favicon, assumed to be image/png type
-our $favicon = "++GITWEB_FAVICON++";
+our $favicon = "@GITWEB_FAVICON@";
# URI of gitweb.js (JavaScript code for gitweb)
-our $javascript = "++GITWEB_JS++";
+our $javascript = "@GITWEB_JS@";
# URI and label (title) of GIT logo link
#our $logo_url = "https://www.kernel.org/pub/software/scm/git/docs/";
@@ -128,7 +128,7 @@ sub evaluate_uri {
our $logo_label = "git homepage";
# source of projects list
-our $projects_list = "++GITWEB_LIST++";
+our $projects_list = "@GITWEB_LIST@";
# the width (in characters) of the projects list "Description" column
our $projects_list_description_width = 25;
@@ -147,7 +147,7 @@ sub evaluate_uri {
# show repository only if this file exists
# (only effective if this variable evaluates to true)
-our $export_ok = "++GITWEB_EXPORT_OK++";
+our $export_ok = "@GITWEB_EXPORT_OK@";
# don't generate age column on the projects list page
our $omit_age_column = 0;
@@ -161,11 +161,11 @@ sub evaluate_uri {
our $export_auth_hook = undef;
# only allow viewing of repositories also shown on the overview page
-our $strict_export = "++GITWEB_STRICT_EXPORT++";
+our $strict_export = "@GITWEB_STRICT_EXPORT@";
# list of git base URLs used for URL to where fetch project from,
# i.e. full URL is "$git_base_url/$project"
-our @git_base_url_list = grep { $_ ne '' } ("++GITWEB_BASE_URL++");
+our @git_base_url_list = grep { $_ ne '' } ("@GITWEB_BASE_URL@");
# default blob_plain mimetype and default charset for text/plain blob
our $default_blob_plain_mimetype = 'text/plain';
@@ -200,7 +200,7 @@ sub evaluate_uri {
# http://andre-simon.de/zip/download.php due to assumptions about parameters and output).
# Useful if highlight is not installed on your webserver's PATH.
# [Default: highlight]
-our $highlight_bin = "++HIGHLIGHT_BIN++";
+our $highlight_bin = "@HIGHLIGHT_BIN@";
# information about snapshot formats that gitweb is capable of serving
our %known_snapshot_formats = (
@@ -741,9 +741,9 @@ sub read_config_file {
our ($GITWEB_CONFIG, $GITWEB_CONFIG_SYSTEM, $GITWEB_CONFIG_COMMON);
sub evaluate_gitweb_config {
- our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "++GITWEB_CONFIG++";
- our $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || "++GITWEB_CONFIG_SYSTEM++";
- our $GITWEB_CONFIG_COMMON = $ENV{'GITWEB_CONFIG_COMMON'} || "++GITWEB_CONFIG_COMMON++";
+ our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "@GITWEB_CONFIG@";
+ our $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || "@GITWEB_CONFIG_SYSTEM@";
+ our $GITWEB_CONFIG_COMMON = $ENV{'GITWEB_CONFIG_COMMON'} || "@GITWEB_CONFIG_COMMON@";
# Protect against duplications of file names, to not read config twice.
# Only one of $GITWEB_CONFIG and $GITWEB_CONFIG_SYSTEM is used, so
diff --git a/perl/Git/I18N.pm b/perl/Git/I18N.pm
index 475e90a6df5a272d6b4d557d8d37d68e3f77dfa8..f8f0ca312543ce2d099f16354e62acbc205abe5a 100644
--- a/perl/Git/I18N.pm
+++ b/perl/Git/I18N.pm
@@ -20,14 +20,14 @@ BEGIN
# this "'@@' [...] '@@'" pattern.
use constant NO_GETTEXT_STR => '@@' . 'NO_GETTEXT' . '@@';
use constant NO_GETTEXT => (
- q[@@NO_GETTEXT@@] ne ''
+ q[@NO_GETTEXT@] ne ''
and
- q[@@NO_GETTEXT@@] ne NO_GETTEXT_STR
+ q[@NO_GETTEXT@] ne NO_GETTEXT_STR
);
sub __bootstrap_locale_messages {
our $TEXTDOMAIN = 'git';
- our $TEXTDOMAINDIR ||= $ENV{GIT_TEXTDOMAINDIR} || '@@LOCALEDIR@@';
+ our $TEXTDOMAINDIR ||= $ENV{GIT_TEXTDOMAINDIR} || '@LOCALEDIR@';
die "NO_GETTEXT=" . NO_GETTEXT_STR if NO_GETTEXT;
require POSIX;
diff --git a/perl/Git/LoadCPAN.pm b/perl/Git/LoadCPAN.pm
index 8c7fa805f97390a47366b0d0058966ee391b9df1..6be99840f84fb2fe945f969fb23f73454c6b171b 100644
--- a/perl/Git/LoadCPAN.pm
+++ b/perl/Git/LoadCPAN.pm
@@ -31,11 +31,11 @@ =head1 DESCRIPTION
# Makefile, and allows for detecting whether the module is loaded from
# perl/Git as opposed to perl/build/Git, which is useful for one-off
# testing without having Error.pm et al installed.
-use constant NO_PERL_CPAN_FALLBACKS_STR => '@@' . 'NO_PERL_CPAN_FALLBACKS' . '@@';
+use constant NO_PERL_CPAN_FALLBACKS_STR => '@' . 'NO_PERL_CPAN_FALLBACKS' . '@';
use constant NO_PERL_CPAN_FALLBACKS => (
- q[@@NO_PERL_CPAN_FALLBACKS@@] ne ''
+ q[@NO_PERL_CPAN_FALLBACKS@] ne ''
and
- q[@@NO_PERL_CPAN_FALLBACKS@@] ne NO_PERL_CPAN_FALLBACKS_STR
+ q[@NO_PERL_CPAN_FALLBACKS@] ne NO_PERL_CPAN_FALLBACKS_STR
);
sub import {
--git a/perl/header_templates/fixed_prefix.template.pl b/perl/header_templates/fixed_prefix.template.pl
index 857b4391a499394ea788a6b56773aecd5afd53c3..d571ca5cde513a98cc25e7acb52b5415b98ffe10 100644
--- a/perl/header_templates/fixed_prefix.template.pl
+++ b/perl/header_templates/fixed_prefix.template.pl
@@ -1 +1 @@
-use lib (split(/@@PATHSEP@@/, $ENV{GITPERLLIB} || '@@INSTLIBDIR@@'));
+use lib (split(/@PATHSEP@/, $ENV{GITPERLLIB} || '@INSTLIBDIR@'));
--git a/perl/header_templates/runtime_prefix.template.pl b/perl/header_templates/runtime_prefix.template.pl
index 9d28b3d8636c6c6d48ea287a5fef0f7833f6c08c..e6f8e661a164519d4fdb55429746380e84ae3fcb 100644
--- a/perl/header_templates/runtime_prefix.template.pl
+++ b/perl/header_templates/runtime_prefix.template.pl
@@ -3,7 +3,7 @@
# This finds our Git::* libraries relative to the script's runtime path.
sub __git_system_path {
my ($relpath) = @_;
- my $gitexecdir_relative = '@@GITEXECDIR_REL@@';
+ my $gitexecdir_relative = '@GITEXECDIR_REL@';
# GIT_EXEC_PATH is supplied by `git` or the test suite.
my $exec_path;
@@ -24,11 +24,11 @@ sub __git_system_path {
}
BEGIN {
- use lib split /@@PATHSEP@@/,
+ use lib split /@PATHSEP@/,
(
$ENV{GITPERLLIB} ||
do {
- my $perllibdir = __git_system_path('@@PERLLIBDIR_REL@@');
+ my $perllibdir = __git_system_path('@PERLLIBDIR_REL@');
(-e $perllibdir) || die("Invalid system path ($relpath): $path");
$perllibdir;
}
@@ -36,7 +36,7 @@ BEGIN
# Export the system locale directory to the I18N module. The locale directory
# is only installed if NO_GETTEXT is set.
- $Git::I18N::TEXTDOMAINDIR = __git_system_path('@@LOCALEDIR_REL@@');
+ $Git::I18N::TEXTDOMAINDIR = __git_system_path('@LOCALEDIR_REL@');
}
# END RUNTIME_PREFIX generated code.
diff --git a/unimplemented.sh b/unimplemented.sh
index fee21d24e8ab89208b4aa0af7007b7c033b753bc..41776b279d4263ae6a9034b30f1bd26ac9b792bd 100644
--- a/unimplemented.sh
+++ b/unimplemented.sh
@@ -1,4 +1,4 @@
#!/bin/sh
-echo >&2 "fatal: git was built without support for $(basename $0) (@@REASON@@)."
+echo >&2 "fatal: git was built without support for $(basename $0) (@REASON@)."
exit 128
diff --git a/wrap-for-bin.sh b/wrap-for-bin.sh
index 95851b85b6b7181130f0cd441c2bd7ac0bfb89da..7898a1c238dde20617cf96d144930dc59f67feab 100644
--- a/wrap-for-bin.sh
+++ b/wrap-for-bin.sh
@@ -4,33 +4,33 @@
# to run test suite against sandbox, but with only bindir-installed
# executables in PATH. The Makefile copies this into various
# files in bin-wrappers, substituting
-# @@BUILD_DIR@@ and @@PROG@@.
+# @BUILD_DIR@ and @PROG@.
-GIT_EXEC_PATH='@@BUILD_DIR@@'
+GIT_EXEC_PATH='@BUILD_DIR@'
if test -n "$NO_SET_GIT_TEMPLATE_DIR"
then
unset GIT_TEMPLATE_DIR
else
- GIT_TEMPLATE_DIR='@@BUILD_DIR@@/templates/blt'
+ GIT_TEMPLATE_DIR='@BUILD_DIR@/templates/blt'
export GIT_TEMPLATE_DIR
fi
-GITPERLLIB='@@BUILD_DIR@@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}"
-GIT_TEXTDOMAINDIR='@@BUILD_DIR@@/po/build/locale'
-PATH='@@BUILD_DIR@@/bin-wrappers:'"$PATH"
+GITPERLLIB='@BUILD_DIR@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}"
+GIT_TEXTDOMAINDIR='@BUILD_DIR@/po/build/locale'
+PATH='@BUILD_DIR@/bin-wrappers:'"$PATH"
export GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
case "$GIT_DEBUGGER" in
'')
- exec "${GIT_EXEC_PATH}/@@PROG@@" "$@"
+ exec "${GIT_EXEC_PATH}/@PROG@" "$@"
;;
1)
unset GIT_DEBUGGER
- exec gdb --args "${GIT_EXEC_PATH}/@@PROG@@" "$@"
+ exec gdb --args "${GIT_EXEC_PATH}/@PROG@" "$@"
;;
*)
GIT_DEBUGGER_ARGS="$GIT_DEBUGGER"
unset GIT_DEBUGGER
- exec ${GIT_DEBUGGER_ARGS} "${GIT_EXEC_PATH}/@@PROG@@" "$@"
+ exec ${GIT_DEBUGGER_ARGS} "${GIT_EXEC_PATH}/@PROG@" "$@"
;;
esac
--
2.47.0.251.gb31fb630c0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH RFC v6 03/19] Makefile: consistently use PERL_PATH
2024-11-12 17:02 ` [PATCH RFC v6 " Patrick Steinhardt
2024-11-12 17:02 ` [PATCH RFC v6 01/19] Makefile: use common template for GIT-BUILD-OPTIONS Patrick Steinhardt
2024-11-12 17:02 ` [PATCH RFC v6 02/19] Makefile: consistently use @PLACEHOLDER@ to substitute Patrick Steinhardt
@ 2024-11-12 17:02 ` Patrick Steinhardt
2024-11-12 17:02 ` [PATCH RFC v6 04/19] Makefile: extract script to massage Perl scripts Patrick Steinhardt
` (17 subsequent siblings)
20 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-12 17:02 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King
When injecting the Perl path into our scripts we sometimes use '@PERL@'
while we othertimes use '@PERL_PATH@'. Refactor the code use the latter
consistently, which makes it easier to reuse the same logic for multiple
scripts.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 2 +-
contrib/buildsystems/CMakeLists.txt | 2 +-
git-instaweb.sh | 4 ++--
git-request-pull.sh | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile
index d59f6c16868e24a1e13b0c16cc05adb79f81bbc8..2a08473824ede4699e370de7f8b8af183449536a 100644
--- a/Makefile
+++ b/Makefile
@@ -2553,7 +2553,7 @@ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's/@USE_GETTEXT_SCHEME@/$(USE_GETTEXT_SCHEME)/g' \
-e $(BROKEN_PATH_FIX) \
-e 's|@GITWEBDIR@|$(gitwebdir_SQ)|g' \
- -e 's|@PERL@|$(PERL_PATH_SQ)|g' \
+ -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' \
-e 's|@PAGER_ENV@|$(PAGER_ENV_SQ)|g' \
$@.sh >$@+
endef
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index a41540458b7ae4f50ec92c115dc6fab3ef5088ff..608ad9714d460b362e07d7169a9c386ba819d40a 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -842,7 +842,7 @@ foreach(script ${git_shell_scripts})
string(REPLACE "@NO_CURL@" "" content "${content}")
string(REPLACE "@USE_GETTEXT_SCHEME@" "" content "${content}")
string(REPLACE "# @BROKEN_PATH_FIX@" "" content "${content}")
- string(REPLACE "@PERL@" "${PERL_PATH}" content "${content}")
+ string(REPLACE "@PERL_PATH@" "${PERL_PATH}" content "${content}")
string(REPLACE "@PAGER_ENV@" "LESS=FRX LV=-c" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
endforeach()
diff --git a/git-instaweb.sh b/git-instaweb.sh
index c8efb1205a8e2a66a6aced840980978897e122bc..5ad50160bb035885d8c180bee3ebb0a8e9622abc 100755
--- a/git-instaweb.sh
+++ b/git-instaweb.sh
@@ -3,7 +3,7 @@
# Copyright (c) 2006 Eric Wong
#
-PERL='@PERL@'
+PERL='@PERL_PATH@'
OPTIONS_KEEPDASHDASH=
OPTIONS_STUCKLONG=
OPTIONS_SPEC="\
@@ -716,7 +716,7 @@ EOF
gitweb_conf() {
cat > "$fqgitdir/gitweb/gitweb_config.perl" <<EOF
-#!@PERL@
+#!@PERL_PATH@
our \$projectroot = "$(dirname "$fqgitdir")";
our \$git_temp = "$fqgitdir/gitweb/tmp";
our \$projects_list = \$projectroot;
diff --git a/git-request-pull.sh b/git-request-pull.sh
index 10c88639e28c02650ffea3d4671afa9a9f0bb182..775ba8ea11aa0fce90ae9bfaea8eac5b8bc584a4 100755
--- a/git-request-pull.sh
+++ b/git-request-pull.sh
@@ -112,7 +112,7 @@ find_matching_ref='
}
'
-set fnord $(git ls-remote "$url" | @PERL@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
+set fnord $(git ls-remote "$url" | @PERL_PATH@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
remote_sha1=$2
ref=$3
--
2.47.0.251.gb31fb630c0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH RFC v6 04/19] Makefile: extract script to massage Perl scripts
2024-11-12 17:02 ` [PATCH RFC v6 " Patrick Steinhardt
` (2 preceding siblings ...)
2024-11-12 17:02 ` [PATCH RFC v6 03/19] Makefile: consistently use PERL_PATH Patrick Steinhardt
@ 2024-11-12 17:02 ` Patrick Steinhardt
2024-11-12 17:02 ` [PATCH RFC v6 05/19] Makefile: use "generate-perl.sh" to massage Perl library Patrick Steinhardt
` (16 subsequent siblings)
20 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-12 17:02 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King
Extract the script to inject various build-time parameters into our Perl
scripts into a standalone script. This is done such that we can reuse it
in other build systems.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 12 ++----------
contrib/buildsystems/CMakeLists.txt | 21 ++++++++++++++++-----
generate-perl.sh | 26 ++++++++++++++++++++++++++
3 files changed, 44 insertions(+), 15 deletions(-)
diff --git a/Makefile b/Makefile
index 2a08473824ede4699e370de7f8b8af183449536a..55e363a83d6ca2561fe1429b072892f9facca9d8 100644
--- a/Makefile
+++ b/Makefile
@@ -2604,16 +2604,8 @@ endif
PERL_DEFINES += $(gitexecdir) $(perllibdir) $(localedir)
-$(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
- $(QUIET_GEN) \
- sed -e '1{' \
- -e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \
- -e ' r GIT-PERL-HEADER' \
- -e ' G' \
- -e '}' \
- -e 's/@GIT_VERSION@/$(GIT_VERSION)/g' \
- $< >$@+ && \
- chmod +x $@+ && \
+$(SCRIPT_PERL_GEN): % : %.perl generate-perl.sh GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
+ $(QUIET_GEN)$(SHELL_PATH) generate-perl.sh ./GIT-BUILD-OPTIONS $(GIT_VERSION) GIT-PERL-HEADER "$<" "$@+" && \
mv $@+ $@
PERL_DEFINES := $(subst $(space),:,$(PERL_DEFINES))
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 608ad9714d460b362e07d7169a9c386ba819d40a..2ae337c61b5fdf54e6ae277053c24696fe91083b 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -848,19 +848,30 @@ foreach(script ${git_shell_scripts})
endforeach()
#perl scripts
-parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" ".perl")
+parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" "")
#create perl header
file(STRINGS ${CMAKE_SOURCE_DIR}/perl/header_templates/fixed_prefix.template.pl perl_header )
string(REPLACE "@PATHSEP@" ":" perl_header "${perl_header}")
string(REPLACE "@INSTLIBDIR@" "${INSTLIBDIR}" perl_header "${perl_header}")
+file(WRITE ${CMAKE_BINARY_DIR}/PERL-HEADER ${perl_header})
foreach(script ${git_perl_scripts})
- file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.perl content NEWLINE_CONSUME)
- string(REPLACE "#!/usr/bin/perl" "#!/usr/bin/perl\n${perl_header}\n" content "${content}")
- string(REPLACE "@GIT_VERSION@" "${PROJECT_VERSION}" content "${content}")
- file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
+ string(REPLACE ".perl" "" perl_gen_path "${script}")
+
+ add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/${perl_gen_path}"
+ COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-perl.sh"
+ "${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS"
+ "${PROJECT_VERSION}"
+ "${CMAKE_BINARY_DIR}/PERL-HEADER"
+ "${CMAKE_SOURCE_DIR}/${script}"
+ "${CMAKE_BINARY_DIR}/${perl_gen_path}"
+ DEPENDS "${CMAKE_SOURCE_DIR}/generate-perl.sh"
+ "${CMAKE_SOURCE_DIR}/${script}"
+ VERBATIM)
+ list(APPEND perl_gen ${CMAKE_BINARY_DIR}/${perl_gen_path})
endforeach()
+add_custom_target(perl-gen ALL DEPENDS ${perl_gen})
#python script
file(STRINGS ${CMAKE_SOURCE_DIR}/git-p4.py content NEWLINE_CONSUME)
diff --git a/generate-perl.sh b/generate-perl.sh
new file mode 100755
index 0000000000000000000000000000000000000000..12e116b76e5f39c14c9992e9a75090917e72e957
--- /dev/null
+++ b/generate-perl.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+set -e
+
+if test $# -ne 5
+then
+ echo "USAGE: $0 <GIT_BUILD_OPTIONS> <GIT_VERSION> <PERL_HEADER> <INPUT> <OUTPUT>" >&2
+ exit 1
+fi
+
+GIT_BUILD_OPTIONS="$1"
+GIT_VERSION="$2"
+PERL_HEADER="$3"
+INPUT="$4"
+OUTPUT="$5"
+
+. "$GIT_BUILD_OPTIONS"
+
+sed -e '1{' \
+ -e " s|#!.*perl|#!$PERL_PATH|" \
+ -e " r $PERL_HEADER" \
+ -e ' G' \
+ -e '}' \
+ -e "s/@GIT_VERSION@/$GIT_VERSION/g" \
+ "$INPUT" >"$OUTPUT"
+chmod a+x "$OUTPUT"
--
2.47.0.251.gb31fb630c0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH RFC v6 05/19] Makefile: use "generate-perl.sh" to massage Perl library
2024-11-12 17:02 ` [PATCH RFC v6 " Patrick Steinhardt
` (3 preceding siblings ...)
2024-11-12 17:02 ` [PATCH RFC v6 04/19] Makefile: extract script to massage Perl scripts Patrick Steinhardt
@ 2024-11-12 17:02 ` Patrick Steinhardt
2024-11-12 17:02 ` [PATCH RFC v6 06/19] Makefile: extract script to massage Shell scripts Patrick Steinhardt
` (15 subsequent siblings)
20 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-12 17:02 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King
Extend "generate-perl.sh" such that it knows to also massage the Perl
library files. There are two major differences:
- We do not read in the Perl header. This is handled by matching on
whether or not we have a Perl shebang.
- We substitute some more variables, which we read in via our
GIT-BUILD-OPTIONS.
Adapt both our Makefile and the CMake build instructions to use this.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-BUILD-OPTIONS.in | 2 ++
Makefile | 10 ++++------
contrib/buildsystems/CMakeLists.txt | 23 +++++++++--------------
generate-perl.sh | 14 ++++++++++++--
4 files changed, 27 insertions(+), 22 deletions(-)
diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in
index f0ca240493c94aa41a6b6241a8474e42f7cdc8b9..050432f9fc49f93d0f6ed98c1307405c52761be0 100644
--- a/GIT-BUILD-OPTIONS.in
+++ b/GIT-BUILD-OPTIONS.in
@@ -1,6 +1,8 @@
SHELL_PATH=@SHELL_PATH@
TEST_SHELL_PATH=@TEST_SHELL_PATH@
PERL_PATH=@PERL_PATH@
+PERL_LOCALEDIR=@PERL_LOCALEDIR@
+NO_PERL_CPAN_FALLBACKS=@NO_PERL_CPAN_FALLBACKS@
DIFF=@DIFF@
PYTHON_PATH=@PYTHON_PATH@
TAR=@TAR@
diff --git a/Makefile b/Makefile
index 55e363a83d6ca2561fe1429b072892f9facca9d8..cff71e5e84c69d87bb67b72f7bcfecd639ae7188 100644
--- a/Makefile
+++ b/Makefile
@@ -3093,13 +3093,9 @@ endif
NO_PERL_CPAN_FALLBACKS_SQ = $(subst ','\'',$(NO_PERL_CPAN_FALLBACKS))
endif
-perl/build/lib/%.pm: perl/%.pm GIT-PERL-DEFINES
+perl/build/lib/%.pm: perl/%.pm generate-perl.sh GIT-BUILD-OPTIONS GIT-PERL-DEFINES
$(call mkdir_p_parent_template)
- $(QUIET_GEN) \
- sed -e 's|@LOCALEDIR@|$(perl_localedir_SQ)|g' \
- -e 's|@NO_GETTEXT@|$(NO_GETTEXT_SQ)|g' \
- -e 's|@NO_PERL_CPAN_FALLBACKS@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \
- < $< > $@
+ $(QUIET_GEN)$(SHELL_PATH) generate-perl.sh ./GIT-BUILD-OPTIONS $(GIT_VERSION) GIT-PERL-HEADER "$<" "$@"
perl/build/man/man3/Git.3pm: perl/Git.pm
$(call mkdir_p_parent_template)
@@ -3160,6 +3156,8 @@ GIT-BUILD-OPTIONS: FORCE
-e "s|@SHELL_PATH@|\'$(SHELL_PATH_SQ)\'|" \
-e "s|@TEST_SHELL_PATH@|\'$(TEST_SHELL_PATH_SQ)\'|" \
-e "s|@PERL_PATH@|\'$(PERL_PATH_SQ)\'|" \
+ -e "s|@PERL_LOCALEDIR@|\'$(perl_localedir_SQ)\'|" \
+ -e "s|@NO_PERL_CPAN_FALLBACKS@|\'$(NO_PERL_CPAN_FALLBACKS_SQ)\'|" \
-e "s|@DIFF@|\'$(DIFF)\'|" \
-e "s|@PYTHON_PATH@|\'$(PYTHON_PATH_SQ)\'|" \
-e "s|@TAR@|\'$(TAR)\'|" \
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 2ae337c61b5fdf54e6ae277053c24696fe91083b..97504c3d7e4aa67041139c6bc9d5731874de19ef 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -849,6 +849,9 @@ endforeach()
#perl scripts
parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" "")
+#perl modules
+file(GLOB_RECURSE perl_modules "${CMAKE_SOURCE_DIR}/perl/*.pm")
+list(TRANSFORM perl_modules REPLACE "${CMAKE_SOURCE_DIR}/" "")
#create perl header
file(STRINGS ${CMAKE_SOURCE_DIR}/perl/header_templates/fixed_prefix.template.pl perl_header )
@@ -856,9 +859,12 @@ string(REPLACE "@PATHSEP@" ":" perl_header "${perl_header}")
string(REPLACE "@INSTLIBDIR@" "${INSTLIBDIR}" perl_header "${perl_header}")
file(WRITE ${CMAKE_BINARY_DIR}/PERL-HEADER ${perl_header})
-foreach(script ${git_perl_scripts})
+foreach(script ${git_perl_scripts} ${perl_modules})
string(REPLACE ".perl" "" perl_gen_path "${script}")
+ get_filename_component(perl_gen_dir "${perl_gen_path}" DIRECTORY)
+ file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/${perl_gen_dir}")
+
add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/${perl_gen_path}"
COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-perl.sh"
"${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS"
@@ -878,19 +884,6 @@ file(STRINGS ${CMAKE_SOURCE_DIR}/git-p4.py content NEWLINE_CONSUME)
string(REPLACE "#!/usr/bin/env python" "#!/usr/bin/python" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/git-p4 ${content})
-#perl modules
-file(GLOB_RECURSE perl_modules "${CMAKE_SOURCE_DIR}/perl/*.pm")
-
-foreach(pm ${perl_modules})
- string(REPLACE "${CMAKE_SOURCE_DIR}/perl/" "" file_path ${pm})
- file(STRINGS ${pm} content NEWLINE_CONSUME)
- string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}")
- string(REPLACE "@NO_PERL_CPAN_FALLBACKS@" "" content "${content}")
- file(WRITE ${CMAKE_BINARY_DIR}/perl/build/lib/${file_path} ${content})
-#test-lib.sh requires perl/build/lib to be the build directory of perl modules
-endforeach()
-
-
#templates
file(GLOB templates "${CMAKE_SOURCE_DIR}/templates/*")
list(TRANSFORM templates REPLACE "${CMAKE_SOURCE_DIR}/templates/" "")
@@ -1132,6 +1125,8 @@ file(STRINGS ${CMAKE_SOURCE_DIR}/GIT-BUILD-OPTIONS.in git_build_options NEWLINE_
string(REPLACE "@SHELL_PATH@" "${SHELL_PATH}" git_build_options "${git_build_options}")
string(REPLACE "@TEST_SHELL_PATH@" "${TEST_SHELL_PATH}" git_build_options "${git_build_options}")
string(REPLACE "@PERL_PATH@" "${PERL_PATH}" git_build_options "${git_build_options}")
+string(REPLACE "@PERL_LOCALEDIR@" "${LOCALEDIR}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PERL_CPAN_FALLBACKS@" "" git_build_options "${git_build_options}")
string(REPLACE "@DIFF@" "${DIFF}" git_build_options "${git_build_options}")
string(REPLACE "@PYTHON_PATH@" "${PYTHON_PATH}" git_build_options "${git_build_options}")
string(REPLACE "@TAR@" "${TAR}" git_build_options "${git_build_options}")
diff --git a/generate-perl.sh b/generate-perl.sh
index 12e116b76e5f39c14c9992e9a75090917e72e957..cfbff20f55bb8adf9f0c59e30bebd6b28432bc22 100755
--- a/generate-perl.sh
+++ b/generate-perl.sh
@@ -17,10 +17,20 @@ OUTPUT="$5"
. "$GIT_BUILD_OPTIONS"
sed -e '1{' \
+ -e " /^#!.*perl/!b" \
-e " s|#!.*perl|#!$PERL_PATH|" \
-e " r $PERL_HEADER" \
-e ' G' \
-e '}' \
- -e "s/@GIT_VERSION@/$GIT_VERSION/g" \
+ -e "s|@GIT_VERSION@|$GIT_VERSION|g" \
+ -e "s|@LOCALEDIR@|$PERL_LOCALEDIR|g" \
+ -e "s|@NO_GETTEXT@|$NO_GETTEXT|g" \
+ -e "s|@NO_PERL_CPAN_FALLBACKS@|$NO_PERL_CPAN_FALLBACKS|g" \
"$INPUT" >"$OUTPUT"
-chmod a+x "$OUTPUT"
+
+case "$INPUT" in
+*.perl)
+ chmod a+x "$OUTPUT";;
+*)
+ ;;
+esac
--
2.47.0.251.gb31fb630c0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH RFC v6 06/19] Makefile: extract script to massage Shell scripts
2024-11-12 17:02 ` [PATCH RFC v6 " Patrick Steinhardt
` (4 preceding siblings ...)
2024-11-12 17:02 ` [PATCH RFC v6 05/19] Makefile: use "generate-perl.sh" to massage Perl library Patrick Steinhardt
@ 2024-11-12 17:02 ` Patrick Steinhardt
2024-11-12 17:02 ` [PATCH RFC v6 07/19] Makefile: extract script to generate gitweb.cgi Patrick Steinhardt
` (14 subsequent siblings)
20 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-12 17:02 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King
Same as in the preceding commits, extract a script that allows us to
unify how we massage shell scripts.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-BUILD-OPTIONS.in | 4 ++++
Makefile | 34 ++++++++++------------------------
contrib/buildsystems/CMakeLists.txt | 31 ++++++++++++++++++++-----------
generate-script.sh | 34 ++++++++++++++++++++++++++++++++++
4 files changed, 68 insertions(+), 35 deletions(-)
diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in
index 050432f9fc49f93d0f6ed98c1307405c52761be0..9b95a6b3eee334b6f691702696ca9d92201b6bac 100644
--- a/GIT-BUILD-OPTIONS.in
+++ b/GIT-BUILD-OPTIONS.in
@@ -36,3 +36,7 @@ GIT_INTEROP_MAKE_OPTS=@GIT_INTEROP_MAKE_OPTS@
GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@
GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@
RUNTIME_PREFIX=@RUNTIME_PREFIX@
+GITWEBDIR=@GITWEBDIR@
+USE_GETTEXT_SCHEME=@USE_GETTEXT_SCHEME@
+LOCALEDIR=@LOCALEDIR@
+BROKEN_PATH_FIX=@BROKEN_PATH_FIX@
diff --git a/Makefile b/Makefile
index cff71e5e84c69d87bb67b72f7bcfecd639ae7188..28f5e96c4def70f2eed3675cfad665022ad91704 100644
--- a/Makefile
+++ b/Makefile
@@ -1555,10 +1555,10 @@ endif
ifdef SANE_TOOL_PATH
SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH))
-BROKEN_PATH_FIX = 's|^\# @BROKEN_PATH_FIX@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|'
+BROKEN_PATH_FIX = s|^\# @BROKEN_PATH_FIX@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|
PATH := $(SANE_TOOL_PATH):${PATH}
else
-BROKEN_PATH_FIX = '/^\# @BROKEN_PATH_FIX@$$/d'
+BROKEN_PATH_FIX = /^\# @BROKEN_PATH_FIX@$$/d
endif
ifeq (,$(HOST_CPU))
@@ -2545,26 +2545,8 @@ GIT-SCRIPT-DEFINES: FORCE
echo "$$FLAGS" >$@; \
fi
-define cmd_munge_script
-sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
- -e 's|@DIFF@|$(DIFF_SQ)|' \
- -e 's|@LOCALEDIR@|$(localedir_SQ)|g' \
- -e 's/@USE_GETTEXT_SCHEME@/$(USE_GETTEXT_SCHEME)/g' \
- -e $(BROKEN_PATH_FIX) \
- -e 's|@GITWEBDIR@|$(gitwebdir_SQ)|g' \
- -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' \
- -e 's|@PAGER_ENV@|$(PAGER_ENV_SQ)|g' \
- $@.sh >$@+
-endef
-
-$(SCRIPT_SH_GEN) : % : %.sh GIT-SCRIPT-DEFINES
- $(QUIET_GEN)$(cmd_munge_script) && \
- chmod +x $@+ && \
- mv $@+ $@
-
-$(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEFINES
- $(QUIET_GEN)$(cmd_munge_script) && \
+$(SCRIPT_SH_GEN) $(SCRIPT_LIB) : % : %.sh generate-script.sh GIT-BUILD-OPTIONS GIT-SCRIPT-DEFINES
+ $(QUIET_GEN)./generate-script.sh "$<" "$@+" ./GIT-BUILD-OPTIONS && \
mv $@+ $@
git.res: git.rc GIT-VERSION-FILE GIT-PREFIX
@@ -2633,8 +2615,8 @@ GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile
perllibdir:
@echo '$(perllibdir_SQ)'
-git-instaweb: git-instaweb.sh GIT-SCRIPT-DEFINES
- $(QUIET_GEN)$(cmd_munge_script) && \
+git-instaweb: git-instaweb.sh generate-script.sh GIT-BUILD-OPTIONS GIT-SCRIPT-DEFINES
+ $(QUIET_GEN)./generate-script.sh "$<" "$@+" ./GIT-BUILD-OPTIONS && \
chmod +x $@+ && \
mv $@+ $@
else # NO_PERL
@@ -3191,6 +3173,10 @@ GIT-BUILD-OPTIONS: FORCE
-e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \
-e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \
-e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX)\'|" \
+ -e "s|@GITWEBDIR@|\'$(gitwebdir_SQ)\'|" \
+ -e "s|@USE_GETTEXT_SCHEME@|\'$(USE_GETTEXT_SCHEME)\'|" \
+ -e "s|@LOCALEDIR@|\'$(localedir_SQ)\'|" \
+ -e "s|@BROKEN_PATH_FIX@|\'$(BROKEN_PATH_FIX)\'|" \
GIT-BUILD-OPTIONS.in >$@+
@if grep -q '^[A-Z][A-Z_]*=@.*@$$' $@+; then echo "Unsubstituted build options in $@" >&2 && exit 1; fi
@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 97504c3d7e4aa67041139c6bc9d5731874de19ef..d2ec6cfc78f092f6299a624d5382d71fcb4d0644 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -834,18 +834,23 @@ set(git_shell_scripts
${git_sh_scripts} ${git_shlib_scripts} git-instaweb)
foreach(script ${git_shell_scripts})
- file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.sh content NEWLINE_CONSUME)
- string(REPLACE "@SHELL_PATH@" "${SHELL_PATH}" content "${content}")
- string(REPLACE "@DIFF@" "diff" content "${content}")
- string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}")
- string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" content "${content}")
- string(REPLACE "@NO_CURL@" "" content "${content}")
- string(REPLACE "@USE_GETTEXT_SCHEME@" "" content "${content}")
- string(REPLACE "# @BROKEN_PATH_FIX@" "" content "${content}")
- string(REPLACE "@PERL_PATH@" "${PERL_PATH}" content "${content}")
- string(REPLACE "@PAGER_ENV@" "LESS=FRX LV=-c" content "${content}")
- file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
+ if ("${script}" IN_LIST git_sh_scripts)
+ string(REPLACE ".sh" "" shell_gen_path "${script}")
+ else()
+ set(shell_gen_path "${script}")
+ endif()
+
+ add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/${shell_gen_path}"
+ COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-script.sh"
+ "${CMAKE_SOURCE_DIR}/${script}.sh"
+ "${CMAKE_BINARY_DIR}/${shell_gen_path}"
+ "${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS"
+ DEPENDS "${CMAKE_SOURCE_DIR}/generate-script.sh"
+ "${CMAKE_SOURCE_DIR}/${script}.sh"
+ VERBATIM)
+ list(APPEND shell_gen ${CMAKE_BINARY_DIR}/${shell_gen_path})
endforeach()
+add_custom_target(shell-gen ALL DEPENDS ${shell_gen})
#perl scripts
parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" "")
@@ -1160,6 +1165,10 @@ string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_optio
string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}")
string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}")
string(REPLACE "@RUNTIME_PREFIX@" "${RUNTIME_PREFIX}" git_build_options "${git_build_options}")
+string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" git_build_options "${git_build_options}")
+string(REPLACE "@USE_GETTEXT_SCHEME@" "" git_build_options "${git_build_options}")
+string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" git_build_options "${git_build_options}")
+string(REPLACE "@BROKEN_PATH_FIX@" "" git_build_options "${git_build_options}")
if(USE_VCPKG)
string(APPEND git_build_options "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
endif()
diff --git a/generate-script.sh b/generate-script.sh
new file mode 100755
index 0000000000000000000000000000000000000000..d001e43d7bf1c4d72f41f805128ae42330a54558
--- /dev/null
+++ b/generate-script.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+set -e
+
+if test $# -ne 3
+then
+ echo "USAGE: $0 <INPUT> <OUTPUT> <GIT-BUILD-OPTIONS>" >&2
+ exit 1
+fi
+
+INPUT="$1"
+OUTPUT="$2"
+BUILD_OPTIONS="$3"
+
+. "$BUILD_OPTIONS"
+
+sed -e "1s|#!.*/sh|#!$SHELL_PATH|" \
+ -e "s|@SHELL_PATH@|$SHELL_PATH|" \
+ -e "s|@DIFF@|$DIFF|" \
+ -e "s|@LOCALEDIR@|$LOCALEDIR|g" \
+ -e "s/@USE_GETTEXT_SCHEME@/$USE_GETTEXT_SCHEME/g" \
+ -e "$BROKEN_PATH_FIX" \
+ -e "s|@GITWEBDIR@|$GITWEBDIR|g" \
+ -e "s|@PERL_PATH@|$PERL_PATH|g" \
+ -e "s|@PAGER_ENV@|$PAGER_ENV|g" \
+ "$INPUT" >"$OUTPUT"
+
+case "$(basename "$INPUT")" in
+git-mergetool--lib.sh|git-sh-i18n.sh|git-sh-setup.sh)
+ ;;
+*)
+ chmod a+x "$OUTPUT"
+ ;;
+esac
--
2.47.0.251.gb31fb630c0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH RFC v6 07/19] Makefile: extract script to generate gitweb.cgi
2024-11-12 17:02 ` [PATCH RFC v6 " Patrick Steinhardt
` (5 preceding siblings ...)
2024-11-12 17:02 ` [PATCH RFC v6 06/19] Makefile: extract script to massage Shell scripts Patrick Steinhardt
@ 2024-11-12 17:02 ` Patrick Steinhardt
2024-11-12 17:02 ` [PATCH RFC v6 08/19] Makefile: refactor GIT-VERSION-GEN to be reusable Patrick Steinhardt
` (13 subsequent siblings)
20 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-12 17:02 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King
In order to generate "gitweb.cgi" we have to replace various different
placeholders. This is done ad-hoc and is thus not easily reusable across
different build systems.
Introduce a new GITWEB-BUILD-OPTIONS.in template that we populate at
configuration time with the expected options. This script is then used
as input for a new "generate-gitweb.sh" script that generates the final
"gitweb.cgi" file. While this requires us to repeat the options multiple
times, it is in line to how we generate other build options like our
GIT-BUILD-OPTIONS file.
While at it, refactor how we replace the GITWEB_PROJECT_MAXDEPTH. Even
though this variable is supposed to be an integer, the source file has
the value quoted. The quotes are eventually stripped via sed(1), which
replaces `"@GITWEB_PROJECT_MAXDEPTH@"` with the actual value, which is
rather nonsensical. This is made clearer by just dropping the quotes in
the source file.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
gitweb/GITWEB-BUILD-OPTIONS.in | 25 ++++++++++++++++++
gitweb/Makefile | 58 ++++++++++++++++++++----------------------
gitweb/generate-gitweb.sh | 45 ++++++++++++++++++++++++++++++++
gitweb/gitweb.perl | 2 +-
4 files changed, 99 insertions(+), 31 deletions(-)
diff --git a/gitweb/GITWEB-BUILD-OPTIONS.in b/gitweb/GITWEB-BUILD-OPTIONS.in
new file mode 100644
index 0000000000000000000000000000000000000000..20a6487796fce4fcd741566e878e1e538847ee33
--- /dev/null
+++ b/gitweb/GITWEB-BUILD-OPTIONS.in
@@ -0,0 +1,25 @@
+PERL_PATH=@PERL_PATH@
+JSMIN=@JSMIN@
+CSSMIN=@CSSMIN@
+GIT_VERSION=@GIT_VERSION@
+GIT_BINDIR=@GIT_BINDIR@
+GITWEB_CONFIG=@GITWEB_CONFIG@
+GITWEB_CONFIG_SYSTEM=@GITWEB_CONFIG_SYSTEM@
+GITWEB_CONFIG_COMMON=@GITWEB_CONFIG_COMMON@
+GITWEB_HOME_LINK_STR=@GITWEB_HOME_LINK_STR@
+GITWEB_SITENAME=@GITWEB_SITENAME@
+GITWEB_PROJECTROOT=@GITWEB_PROJECTROOT@
+GITWEB_PROJECT_MAXDEPTH=@GITWEB_PROJECT_MAXDEPTH@
+GITWEB_EXPORT_OK=@GITWEB_EXPORT_OK@
+GITWEB_STRICT_EXPORT=@GITWEB_STRICT_EXPORT@
+GITWEB_BASE_URL=@GITWEB_BASE_URL@
+GITWEB_LIST=@GITWEB_LIST@
+GITWEB_HOMETEXT=@GITWEB_HOMETEXT@
+GITWEB_CSS=@GITWEB_CSS@
+GITWEB_LOGO=@GITWEB_LOGO@
+GITWEB_FAVICON=@GITWEB_FAVICON@
+GITWEB_JS=@GITWEB_JS@
+GITWEB_SITE_HTML_HEAD_STRING=@GITWEB_SITE_HTML_HEAD_STRING@
+GITWEB_SITE_HEADER=@GITWEB_SITE_HEADER@
+GITWEB_SITE_FOOTER=@GITWEB_SITE_FOOTER@
+HIGHLIGHT_BIN=@HIGHLIGHT_BIN@
diff --git a/gitweb/Makefile b/gitweb/Makefile
index 164c8d53757f98599ad14eeb22ca8d542eb7502a..48c3958bc66c951bde422857754d4cc413a21885 100644
--- a/gitweb/Makefile
+++ b/gitweb/Makefile
@@ -77,43 +77,41 @@ GITWEB_JSLIB_FILES += static/js/javascript-detection.js
GITWEB_JSLIB_FILES += static/js/adjust-timezone.js
GITWEB_JSLIB_FILES += static/js/blame_incremental.js
-
-GITWEB_REPLACE = \
- -e 's|@GIT_VERSION@|$(GIT_VERSION)|g' \
- -e 's|@GIT_BINDIR@|$(bindir)|g' \
- -e 's|@GITWEB_CONFIG@|$(GITWEB_CONFIG)|g' \
- -e 's|@GITWEB_CONFIG_SYSTEM@|$(GITWEB_CONFIG_SYSTEM)|g' \
- -e 's|@GITWEB_CONFIG_COMMON@|$(GITWEB_CONFIG_COMMON)|g' \
- -e 's|@GITWEB_HOME_LINK_STR@|$(GITWEB_HOME_LINK_STR)|g' \
- -e 's|@GITWEB_SITENAME@|$(GITWEB_SITENAME)|g' \
- -e 's|@GITWEB_PROJECTROOT@|$(GITWEB_PROJECTROOT)|g' \
- -e 's|"@GITWEB_PROJECT_MAXDEPTH@"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
- -e 's|@GITWEB_EXPORT_OK@|$(GITWEB_EXPORT_OK)|g' \
- -e 's|@GITWEB_STRICT_EXPORT@|$(GITWEB_STRICT_EXPORT)|g' \
- -e 's|@GITWEB_BASE_URL@|$(GITWEB_BASE_URL)|g' \
- -e 's|@GITWEB_LIST@|$(GITWEB_LIST)|g' \
- -e 's|@GITWEB_HOMETEXT@|$(GITWEB_HOMETEXT)|g' \
- -e 's|@GITWEB_CSS@|$(GITWEB_CSS)|g' \
- -e 's|@GITWEB_LOGO@|$(GITWEB_LOGO)|g' \
- -e 's|@GITWEB_FAVICON@|$(GITWEB_FAVICON)|g' \
- -e 's|@GITWEB_JS@|$(GITWEB_JS)|g' \
- -e 's|@GITWEB_SITE_HTML_HEAD_STRING@|$(GITWEB_SITE_HTML_HEAD_STRING)|g' \
- -e 's|@GITWEB_SITE_HEADER@|$(GITWEB_SITE_HEADER)|g' \
- -e 's|@GITWEB_SITE_FOOTER@|$(GITWEB_SITE_FOOTER)|g' \
- -e 's|@HIGHLIGHT_BIN@|$(HIGHLIGHT_BIN)|g'
-
.PHONY: FORCE
$(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS: FORCE
- @rm -f $@+
- @echo "x" '$(PERL_PATH_SQ)' $(GITWEB_REPLACE) "$(JSMIN)|$(CSSMIN)" >$@+
+ @sed -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|' \
+ -e 's|@JSMIN@|$(JSMIN)|' \
+ -e 's|@CSSMIN@|$(CSSMIN)|' \
+ -e 's|@GIT_VERSION@|$(GIT_VERSION)|' \
+ -e 's|@GIT_BINDIR@|$(bindir)|' \
+ -e 's|@GITWEB_CONFIG@|$(GITWEB_CONFIG)|' \
+ -e 's|@GITWEB_CONFIG_SYSTEM@|$(GITWEB_CONFIG_SYSTEM)|' \
+ -e 's|@GITWEB_CONFIG_COMMON@|$(GITWEB_CONFIG_COMMON)|' \
+ -e 's|@GITWEB_HOME_LINK_STR@|$(GITWEB_HOME_LINK_STR)|' \
+ -e 's|@GITWEB_SITENAME@|$(GITWEB_SITENAME)|' \
+ -e 's|@GITWEB_PROJECTROOT@|$(GITWEB_PROJECTROOT)|' \
+ -e 's|@GITWEB_PROJECT_MAXDEPTH@|$(GITWEB_PROJECT_MAXDEPTH)|' \
+ -e 's|@GITWEB_EXPORT_OK@|$(GITWEB_EXPORT_OK)|' \
+ -e 's|@GITWEB_STRICT_EXPORT@|$(GITWEB_STRICT_EXPORT)|' \
+ -e 's|@GITWEB_BASE_URL@|$(GITWEB_BASE_URL)|' \
+ -e 's|@GITWEB_LIST@|$(GITWEB_LIST)|' \
+ -e 's|@GITWEB_HOMETEXT@|$(GITWEB_HOMETEXT)|' \
+ -e 's|@GITWEB_CSS@|$(GITWEB_CSS)|' \
+ -e 's|@GITWEB_LOGO@|$(GITWEB_LOGO)|' \
+ -e 's|@GITWEB_FAVICON@|$(GITWEB_FAVICON)|' \
+ -e 's|@GITWEB_JS@|$(GITWEB_JS)|' \
+ -e 's|@GITWEB_SITE_HTML_HEAD_STRING@|$(GITWEB_SITE_HTML_HEAD_STRING)|' \
+ -e 's|@GITWEB_SITE_HEADER@|$(GITWEB_SITE_HEADER)|' \
+ -e 's|@GITWEB_SITE_FOOTER@|$(GITWEB_SITE_FOOTER)|' \
+ -e 's|@HIGHLIGHT_BIN@|$(HIGHLIGHT_BIN)|' \
+ $(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS.in >"$@+"
@cmp -s $@+ $@ && rm -f $@+ || mv -f $@+ $@
+$(MAK_DIR_GITWEB)gitweb.cgi: $(MAK_DIR_GITWEB)generate-gitweb.sh
$(MAK_DIR_GITWEB)gitweb.cgi: $(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS
$(MAK_DIR_GITWEB)gitweb.cgi: $(MAK_DIR_GITWEB)gitweb.perl
$(QUIET_GEN)$(RM) $@ $@+ && \
- sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
- $(GITWEB_REPLACE) $< >$@+ && \
- chmod +x $@+ && \
+ $(MAK_DIR_GITWEB)generate-gitweb.sh $(MAK_DIR_GITWEB)/GITWEB-BUILD-OPTIONS $< $@+ && \
mv $@+ $@
$(MAK_DIR_GITWEB)static/gitweb.js: $(addprefix $(MAK_DIR_GITWEB),$(GITWEB_JSLIB_FILES))
diff --git a/gitweb/generate-gitweb.sh b/gitweb/generate-gitweb.sh
new file mode 100755
index 0000000000000000000000000000000000000000..b47ea6e599e5eb27e78993e7a72a2f242677ea0a
--- /dev/null
+++ b/gitweb/generate-gitweb.sh
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+set -e
+
+if test $# -ne 3
+then
+ echo "USAGE: $0 <GITWEB-BUILD-OPTIONS> <INPUT> <OUTPUT>" >&2
+ exit 1
+fi
+
+GITWEB_BUILD_OPTIONS="$1"
+INPUT="$2"
+OUTPUT="$3"
+
+. "$GITWEB_BUILD_OPTIONS"
+
+sed -e "1s|#!/usr/bin/perl|#!$PERL_PATH|" \
+ -e "s|@PERL_PATH@|$PERL_PATH|" \
+ -e "s|@JSMIN@|$JSMIN|" \
+ -e "s|@CSSMIN@|$CSSMIN|" \
+ -e "s|@GIT_VERSION@|$GIT_VERSION|" \
+ -e "s|@GIT_BINDIR@|$GIT_BINDIR|" \
+ -e "s|@GITWEB_CONFIG@|$GITWEB_CONFIG|" \
+ -e "s|@GITWEB_CONFIG_SYSTEM@|$GITWEB_CONFIG_SYSTEM|" \
+ -e "s|@GITWEB_CONFIG_COMMON@|$GITWEB_CONFIG_COMMON|" \
+ -e "s|@GITWEB_HOME_LINK_STR@|$GITWEB_HOME_LINK_STR|" \
+ -e "s|@GITWEB_SITENAME@|$GITWEB_SITENAME|" \
+ -e "s|@GITWEB_PROJECTROOT@|$GITWEB_PROJECTROOT|" \
+ -e "s|@GITWEB_PROJECT_MAXDEPTH@|$GITWEB_PROJECT_MAXDEPTH|" \
+ -e "s|@GITWEB_EXPORT_OK@|$GITWEB_EXPORT_OK|" \
+ -e "s|@GITWEB_STRICT_EXPORT@|$GITWEB_STRICT_EXPORT|" \
+ -e "s|@GITWEB_BASE_URL@|$GITWEB_BASE_URL|" \
+ -e "s|@GITWEB_LIST@|$GITWEB_LIST|" \
+ -e "s|@GITWEB_HOMETEXT@|$GITWEB_HOMETEXT|" \
+ -e "s|@GITWEB_CSS@|$GITWEB_CSS|" \
+ -e "s|@GITWEB_LOGO@|$GITWEB_LOGO|" \
+ -e "s|@GITWEB_FAVICON@|$GITWEB_FAVICON|" \
+ -e "s|@GITWEB_JS@|$GITWEB_JS|" \
+ -e "s|@GITWEB_SITE_HTML_HEAD_STRING@|$GITWEB_SITE_HTML_HEAD_STRING|" \
+ -e "s|@GITWEB_SITE_HEADER@|$GITWEB_SITE_HEADER|" \
+ -e "s|@GITWEB_SITE_FOOTER@|$GITWEB_SITE_FOOTER|" \
+ -e "s|@HIGHLIGHT_BIN@|$HIGHLIGHT_BIN|" \
+ "$INPUT" >"$OUTPUT"
+
+chmod a+x "$OUTPUT"
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 76e1f4e244fd23dd29b935e83753efa9c6d5bb5e..41bc64ec73f9f05666480025c3b70650607b4cd8 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -88,7 +88,7 @@ sub evaluate_uri {
# fs traversing limit for getting project list
# the number is relative to the projectroot
-our $project_maxdepth = "@GITWEB_PROJECT_MAXDEPTH@";
+our $project_maxdepth = @GITWEB_PROJECT_MAXDEPTH@;
# string of the home link on top of all pages
our $home_link_str = "@GITWEB_HOME_LINK_STR@";
--
2.47.0.251.gb31fb630c0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH RFC v6 08/19] Makefile: refactor GIT-VERSION-GEN to be reusable
2024-11-12 17:02 ` [PATCH RFC v6 " Patrick Steinhardt
` (6 preceding siblings ...)
2024-11-12 17:02 ` [PATCH RFC v6 07/19] Makefile: extract script to generate gitweb.cgi Patrick Steinhardt
@ 2024-11-12 17:02 ` Patrick Steinhardt
2024-11-13 16:30 ` Phillip Wood
2024-11-12 17:02 ` [PATCH RFC v6 09/19] Makefile: refactor generators to be PWD-independent Patrick Steinhardt
` (12 subsequent siblings)
20 siblings, 1 reply; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-12 17:02 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King
Our "GIT-VERSION-GEN" script always writes the "GIT-VERSION-FILE" into
the current directory, where the expectation is that it should exist in
the source directory. But other build systems that support out-of-tree
builds may not want to do that to keep the source directory pristine,
even though CMake currently doesn't care.
Refactor the script such that it doesn't write output to a file anymore
but so that it instead writes the version to stdout. This makes it
easier to compute the same version as our Makefile would without having
to write the "GIT-VERSION-FILE".
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-VERSION-GEN | 12 +-----------
Makefile | 3 ++-
contrib/buildsystems/CMakeLists.txt | 12 ++++--------
3 files changed, 7 insertions(+), 20 deletions(-)
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index 78e8631f677bbebe8f18d83191f0fd014465563e..671f853512a8cfafe85dc18ec5bf85e52018ca69 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -1,6 +1,5 @@
#!/bin/sh
-GVF=GIT-VERSION-FILE
DEF_VER=v2.47.GIT
LF='
@@ -28,13 +27,4 @@ fi
VN=$(expr "$VN" : v*'\(.*\)')
-if test -r $GVF
-then
- VC=$(sed -e 's/^GIT_VERSION = //' <$GVF)
-else
- VC=unset
-fi
-test "$VN" = "$VC" || {
- echo >&2 "GIT_VERSION = $VN"
- echo "GIT_VERSION = $VN" >$GVF
-}
+echo "$VN"
diff --git a/Makefile b/Makefile
index 28f5e96c4def70f2eed3675cfad665022ad91704..96b4a860f5d560344b680403574302761184af04 100644
--- a/Makefile
+++ b/Makefile
@@ -592,7 +592,8 @@ include shared.mak
# Disable -pedantic compilation.
GIT-VERSION-FILE: FORCE
- @$(SHELL_PATH) ./GIT-VERSION-GEN
+ @printf "GIT_VERSION = %s\n" $$($(SHELL_PATH) GIT-VERSION-GEN) >$@+
+ @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else cat $@+ >&2 && mv $@+ $@; fi
-include GIT-VERSION-FILE
# Set our default configuration.
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index d2ec6cfc78f092f6299a624d5382d71fcb4d0644..689b76578ad1e39b09e0dcd62bfc0508cc081364 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -83,16 +83,12 @@ if(NOT SH_EXE)
"On Windows, you can get it as part of 'Git for Windows' install at https://gitforwindows.org/")
endif()
-#Create GIT-VERSION-FILE using GIT-VERSION-GEN
-if(NOT EXISTS ${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE)
- message("Generating GIT-VERSION-FILE")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
-endif()
+execute_process(COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
+ WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
+ OUTPUT_VARIABLE git_version
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
#Parse GIT-VERSION-FILE to get the version
-file(STRINGS ${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE git_version REGEX "GIT_VERSION = (.*)")
-string(REPLACE "GIT_VERSION = " "" git_version ${git_version})
string(FIND ${git_version} "GIT" location)
if(location EQUAL -1)
string(REGEX MATCH "[0-9]*\\.[0-9]*\\.[0-9]*" git_version ${git_version})
--
2.47.0.251.gb31fb630c0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH RFC v6 09/19] Makefile: refactor generators to be PWD-independent
2024-11-12 17:02 ` [PATCH RFC v6 " Patrick Steinhardt
` (7 preceding siblings ...)
2024-11-12 17:02 ` [PATCH RFC v6 08/19] Makefile: refactor GIT-VERSION-GEN to be reusable Patrick Steinhardt
@ 2024-11-12 17:02 ` Patrick Steinhardt
2024-11-12 17:02 ` [PATCH RFC v6 10/19] Makefile: allow "bin-wrappers/" directory to exist Patrick Steinhardt
` (11 subsequent siblings)
20 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-12 17:02 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King
We have multiple scripts that generate headers from other data. All of
these scripts have the assumption built-in that they are executed in the
current source directory, which makes them a bit unwieldy to use during
out-of-tree builds.
Refactor them to instead take the source directory as well as the output
file as arguments.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 6 +++---
contrib/buildsystems/CMakeLists.txt | 19 +++++++++--------
generate-cmdlist.sh | 42 +++++++++++++++++++++++--------------
generate-configlist.sh | 20 +++++++++++++-----
generate-hooklist.sh | 15 ++++++++++++-
5 files changed, 68 insertions(+), 34 deletions(-)
diff --git a/Makefile b/Makefile
index 96b4a860f5d560344b680403574302761184af04..ba79a514cc4f906ead5b64884cfeeb06c62e4635 100644
--- a/Makefile
+++ b/Makefile
@@ -2523,17 +2523,17 @@ $(BUILT_INS): git$X
config-list.h: generate-configlist.sh
config-list.h: Documentation/*config.txt Documentation/config/*.txt
- $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh >$@
+ $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh . $@
command-list.h: generate-cmdlist.sh command-list.txt
command-list.h: $(wildcard Documentation/git*.txt)
$(QUIET_GEN)$(SHELL_PATH) ./generate-cmdlist.sh \
$(patsubst %,--exclude-program %,$(EXCLUDED_PROGRAMS)) \
- command-list.txt >$@
+ . $@
hook-list.h: generate-hooklist.sh Documentation/githooks.txt
- $(QUIET_GEN)$(SHELL_PATH) ./generate-hooklist.sh >$@
+ $(QUIET_GEN)$(SHELL_PATH) ./generate-hooklist.sh . $@
SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):\
$(localedir_SQ):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 689b76578ad1e39b09e0dcd62bfc0508cc081364..73a3cbf5302fb8fac9965299a19b28e7b47478a9 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -648,23 +648,24 @@ set(EXCLUSION_PROGS_CACHE ${EXCLUSION_PROGS} CACHE STRING "Programs not built" F
if(NOT EXISTS ${CMAKE_BINARY_DIR}/command-list.h OR NOT EXCLUSION_PROGS_CACHE STREQUAL EXCLUSION_PROGS)
list(REMOVE_ITEM EXCLUSION_PROGS empty)
message("Generating command-list.h")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-cmdlist.sh ${EXCLUSION_PROGS} command-list.txt
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_FILE ${CMAKE_BINARY_DIR}/command-list.h)
+ execute_process(COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-cmdlist.sh"
+ ${EXCLUSION_PROGS}
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_BINARY_DIR}/command-list.h")
endif()
if(NOT EXISTS ${CMAKE_BINARY_DIR}/config-list.h)
message("Generating config-list.h")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-configlist.sh
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_FILE ${CMAKE_BINARY_DIR}/config-list.h)
+ execute_process(COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-configlist.sh"
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_BINARY_DIR}/config-list.h")
endif()
if(NOT EXISTS ${CMAKE_BINARY_DIR}/hook-list.h)
message("Generating hook-list.h")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-hooklist.sh
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_FILE ${CMAKE_BINARY_DIR}/hook-list.h)
+ execute_process(COMMAND "${SH_EXE}" ${CMAKE_SOURCE_DIR}/generate-hooklist.sh
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_BINARY_DIR}/hook-list.h")
endif()
include_directories(${CMAKE_BINARY_DIR})
diff --git a/generate-cmdlist.sh b/generate-cmdlist.sh
index 205541e0f7f81b1df4061215ae34a2742a45475d..b923a5aab80dfa571a40a4f6fa3d860fcf8f8dd1 100755
--- a/generate-cmdlist.sh
+++ b/generate-cmdlist.sh
@@ -64,7 +64,7 @@ define_category_names () {
print_command_list () {
echo "static struct cmdname_help command_list[] = {"
- echo "$1" |
+ echo "$2" |
while read cmd rest
do
synopsis=
@@ -76,7 +76,7 @@ print_command_list () {
break
;;
esac
- done <"Documentation/$cmd.txt"
+ done <"$1/Documentation/$cmd.txt"
printf '\t{ "%s", N_("%s"), 0' "$cmd" "$synopsis"
printf " | CAT_%s" $rest
@@ -93,18 +93,28 @@ do
shift
done
-commands="$(command_list "$1")"
-categories="$(category_list "$commands")"
+if test "$#" -ne 2
+then
+ die "USAGE: $0 <SOURCE_DIR> <OUTPUT>"
+fi
+
+SOURCE_DIR="$1"
+OUTPUT="$2"
+
+{
+ commands="$(command_list "$SOURCE_DIR"/command-list.txt)"
+ categories="$(category_list "$commands")"
-echo "/* Automatically generated by generate-cmdlist.sh */
-struct cmdname_help {
- const char *name;
- const char *help;
- uint32_t category;
-};
-"
-define_categories "$categories"
-echo
-define_category_names "$categories"
-echo
-print_command_list "$commands"
+ echo "/* Automatically generated by generate-cmdlist.sh */
+ struct cmdname_help {
+ const char *name;
+ const char *help;
+ uint32_t category;
+ };
+ "
+ define_categories "$categories"
+ echo
+ define_category_names "$categories"
+ echo
+ print_command_list "$SOURCE_DIR" "$commands"
+} >"$OUTPUT"
diff --git a/generate-configlist.sh b/generate-configlist.sh
index 8692fe5cf4d5e4025265e6110254b05640615fea..512804a1ca1b63a0630ae152569b31486273eae0 100755
--- a/generate-configlist.sh
+++ b/generate-configlist.sh
@@ -1,13 +1,19 @@
#!/bin/sh
-echo "/* Automatically generated by generate-configlist.sh */"
-echo
+SOURCE_DIR="$1"
+OUTPUT="$2"
+
+if test -z "$SOURCE_DIR" || ! test -d "$SOURCE_DIR" || test -z "$OUTPUT"
+then
+ echo "USAGE: $0 <SOURCE_DIR> <OUTPUT>" >&2
+ exit 1
+fi
print_config_list () {
cat <<EOF
static const char *config_name_list[] = {
EOF
- grep -h '^[a-zA-Z].*\..*::$' Documentation/*config.txt Documentation/config/*.txt |
+ grep -h '^[a-zA-Z].*\..*::$' "$SOURCE_DIR"/Documentation/*config.txt "$SOURCE_DIR"/Documentation/config/*.txt |
sed '/deprecated/d; s/::$//; s/, */\n/g' |
sort |
sed 's/^.*$/ "&",/'
@@ -17,5 +23,9 @@ EOF
EOF
}
-echo
-print_config_list
+{
+ echo "/* Automatically generated by generate-configlist.sh */"
+ echo
+ echo
+ print_config_list
+} >"$OUTPUT"
diff --git a/generate-hooklist.sh b/generate-hooklist.sh
index 2f9f54eb545be2bd79c37a868dbeef96d2ddfb9f..0ff2a0b6fbd16772de1f88cad36af8185892bb47 100755
--- a/generate-hooklist.sh
+++ b/generate-hooklist.sh
@@ -2,6 +2,17 @@
#
# Usage: ./generate-hooklist.sh >hook-list.h
+SOURCE_DIR="$1"
+OUTPUT="$2"
+
+if test -z "$SOURCE_DIR" || ! test -d "$SOURCE_DIR" || test -z "$OUTPUT"
+then
+ echo "USAGE: $0 <SOURCE_DIR> <OUTPUT>" >&2
+ exit 1
+fi
+
+{
+
cat <<EOF
/* Automatically generated by generate-hooklist.sh */
@@ -11,10 +22,12 @@ EOF
sed -n \
-e '/^~~~~*$/ {x; s/^.*$/ "&",/; p;}' \
-e 'x' \
- <Documentation/githooks.txt |
+ <"$SOURCE_DIR"/Documentation/githooks.txt |
LC_ALL=C sort
cat <<EOF
NULL,
};
EOF
+
+} >"$OUTPUT"
--
2.47.0.251.gb31fb630c0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH RFC v6 10/19] Makefile: allow "bin-wrappers/" directory to exist
2024-11-12 17:02 ` [PATCH RFC v6 " Patrick Steinhardt
` (8 preceding siblings ...)
2024-11-12 17:02 ` [PATCH RFC v6 09/19] Makefile: refactor generators to be PWD-independent Patrick Steinhardt
@ 2024-11-12 17:02 ` Patrick Steinhardt
2024-11-12 17:02 ` [PATCH RFC v6 11/19] Makefile: simplify building of templates Patrick Steinhardt
` (10 subsequent siblings)
20 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-12 17:02 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King
The "bin-wrappers/" directory gets created by our build system and is
populated with one script for each of our binaries. There isn't anything
inherently wrong with the current layout, but it is somewhat hard to
adapt for out-of-tree build systems.
Adapt the layout such that our "bin-wrappers/" directory always exists
and contains our "wrap-for-bin.sh" script to make things a little bit
easier for subsequent steps.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
.gitignore | 1 -
Documentation/CodingGuidelines | 2 +-
Makefile | 6 +++---
bin-wrappers/.gitignore | 9 +++++++++
wrap-for-bin.sh => bin-wrappers/wrap-for-bin.sh | 0
contrib/buildsystems/CMakeLists.txt | 6 +++---
6 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/.gitignore b/.gitignore
index 6687bd6db4c0a6adf02292a9cb545d3e5270e2b0..349673c55c944f0e098ebbe8f74be60fdaa0a304 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,7 +12,6 @@
/GIT-TEST-SUITES
/GIT-USER-AGENT
/GIT-VERSION-FILE
-/bin-wrappers/
/git
/git-add
/git-am
diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
index 87904791cbcea6e57d0fb3c7d4e27f2b0d80b95f..1df9d0c42f1ee7b16ecd7abc22d2653dbf9bae2e 100644
--- a/Documentation/CodingGuidelines
+++ b/Documentation/CodingGuidelines
@@ -583,7 +583,7 @@ For C programs:
Run `GIT_DEBUGGER=1 ./bin-wrappers/git foo` to simply use gdb as is, or
run `GIT_DEBUGGER="<debugger> <debugger-args>" ./bin-wrappers/git foo` to
use your own debugger and arguments. Example: `GIT_DEBUGGER="ddd --gdb"
- ./bin-wrappers/git log` (See `wrap-for-bin.sh`.)
+ ./bin-wrappers/git log` (See `bin-wrappers/wrap-for-bin.sh`.)
- The primary data structure that a subsystem 'S' deals with is called
`struct S`. Functions that operate on `struct S` are named
diff --git a/Makefile b/Makefile
index ba79a514cc4f906ead5b64884cfeeb06c62e4635..f6f4381c8e6246e8dbab0ca0193320146edc9dca 100644
--- a/Makefile
+++ b/Makefile
@@ -3199,8 +3199,7 @@ test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $(
all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PROG)
-bin-wrappers/%: wrap-for-bin.sh
- $(call mkdir_p_parent_template)
+$(test_bindir_programs): bin-wrappers/%: bin-wrappers/wrap-for-bin.sh
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@BUILD_DIR@|$(shell pwd)|' \
-e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
@@ -3696,7 +3695,8 @@ clean: profile-clean coverage-clean cocciclean
$(RM) $(FUZZ_PROGRAMS)
$(RM) $(SP_OBJ)
$(RM) $(HCC)
- $(RM) -r bin-wrappers $(dep_dirs) $(compdb_dir) compile_commands.json
+ $(RM) -r $(dep_dirs) $(compdb_dir) compile_commands.json
+ $(RM) $(test_bindir_programs)
$(RM) -r po/build/
$(RM) *.pyc *.pyo */*.pyc */*.pyo $(GENERATED_H) $(ETAGS_TARGET) tags cscope*
$(RM) -r .dist-tmp-dir .doc-tmp-dir
diff --git a/bin-wrappers/.gitignore b/bin-wrappers/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..1c6c90458b758641d0311e812563b32dd4656b48
--- /dev/null
+++ b/bin-wrappers/.gitignore
@@ -0,0 +1,9 @@
+/git
+/git-cvsserver
+/git-receive-pack
+/git-shell
+/git-upload-archive
+/git-upload-pack
+/scalar
+/test-fake-ssh
+/test-tool
diff --git a/wrap-for-bin.sh b/bin-wrappers/wrap-for-bin.sh
old mode 100644
new mode 100755
similarity index 100%
rename from wrap-for-bin.sh
rename to bin-wrappers/wrap-for-bin.sh
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 73a3cbf5302fb8fac9965299a19b28e7b47478a9..4f652927b1f3a2906bc5cfd0f7ba44a025770883 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -1061,20 +1061,20 @@ set(wrapper_test_scripts
foreach(script ${wrapper_scripts})
- file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
+ file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
string(REPLACE "@PROG@" "${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
foreach(script ${wrapper_test_scripts})
- file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
+ file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
string(REPLACE "@PROG@" "t/helper/${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
-file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
+file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
string(REPLACE "@PROG@" "git-cvsserver" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})
--
2.47.0.251.gb31fb630c0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH RFC v6 11/19] Makefile: simplify building of templates
2024-11-12 17:02 ` [PATCH RFC v6 " Patrick Steinhardt
` (9 preceding siblings ...)
2024-11-12 17:02 ` [PATCH RFC v6 10/19] Makefile: allow "bin-wrappers/" directory to exist Patrick Steinhardt
@ 2024-11-12 17:02 ` Patrick Steinhardt
2024-11-12 17:02 ` [PATCH RFC v6 12/19] Documentation: allow sourcing generated includes from separate dir Patrick Steinhardt
` (9 subsequent siblings)
20 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-12 17:02 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King
When we install Git we also install a set of default templates that both
git-init(1) and git-clone(1) populate into our build directories. The
way the pristine templates are laid out in our source directory is
somewhat weird though: instead of reconstructing the actual directory
hierarchy in "templates/", we represent directory separators with "--".
The only reason I could come up with for why we have this is the
"branches/" directory, which is supposed to be empty when installing it.
And as Git famously doesn't store empty directories at all we have to
work around this limitation.
Now the thing is that the "branches/" directory is a leftover to how
branches used to be stored in the dark ages. gitrepository-layout(5)
lists this directory as "slightly deprecated", which I would claim is a
strong understatement. I have never encountered anybody using it today
and would be surprised if it even works as expected. So having the "--"
hack in place for an item that is basically unused, unmaintained and
deprecated doesn't only feel unreasonable, but installing that entry by
default may also cause confusion for users that do not know what this is
supposed to be in the first place.
Remove this directory from our templates and, now that we do not require
the workaround anymore, restructure the templates to form a proper
hierarchy. This makes it way easier for build systems to install these
templates into place.
We should likely think about removing support for "branch/" altogether,
but that is outside of the scope of this patch series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
contrib/buildsystems/CMakeLists.txt | 34 +++++++------------
templates/Makefile | 39 ++++++++++++++--------
templates/branches-- | 1 -
templates/{this--description => description} | 0
.../applypatch-msg.sample} | 0
.../commit-msg.sample} | 0
.../fsmonitor-watchman.sample} | 0
.../post-update.sample} | 0
.../pre-applypatch.sample} | 0
.../pre-commit.sample} | 0
.../pre-merge-commit.sample} | 0
.../pre-push.sample} | 0
.../pre-rebase.sample} | 0
.../pre-receive.sample} | 0
.../prepare-commit-msg.sample} | 0
.../push-to-checkout.sample} | 0
.../sendemail-validate.sample} | 0
.../{hooks--update.sample => hooks/update.sample} | 0
templates/{info--exclude => info/exclude} | 0
19 files changed, 37 insertions(+), 37 deletions(-)
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 4f652927b1f3a2906bc5cfd0f7ba44a025770883..f63661c6b5d9f51778a0e08fab7032bea5010e6f 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -106,8 +106,8 @@ project(git
#TODO Enable NLS on windows natively
#macros for parsing the Makefile for sources and scripts
-macro(parse_makefile_for_sources list_var regex)
- file(STRINGS ${CMAKE_SOURCE_DIR}/Makefile ${list_var} REGEX "^${regex} \\+=(.*)")
+macro(parse_makefile_for_sources list_var makefile regex)
+ file(STRINGS ${makefile} ${list_var} REGEX "^${regex} \\+=(.*)")
string(REPLACE "${regex} +=" "" ${list_var} ${${list_var}})
string(REPLACE "$(COMPAT_OBJS)" "" ${list_var} ${${list_var}}) #remove "$(COMPAT_OBJS)" This is only for libgit.
string(STRIP ${${list_var}} ${list_var}) #remove trailing/leading whitespaces
@@ -672,20 +672,20 @@ include_directories(${CMAKE_BINARY_DIR})
#build
#libgit
-parse_makefile_for_sources(libgit_SOURCES "LIB_OBJS")
+parse_makefile_for_sources(libgit_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "LIB_OBJS")
list(TRANSFORM libgit_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
list(TRANSFORM compat_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
add_library(libgit ${libgit_SOURCES} ${compat_SOURCES})
#libxdiff
-parse_makefile_for_sources(libxdiff_SOURCES "XDIFF_OBJS")
+parse_makefile_for_sources(libxdiff_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "XDIFF_OBJS")
list(TRANSFORM libxdiff_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
add_library(xdiff STATIC ${libxdiff_SOURCES})
#reftable
-parse_makefile_for_sources(reftable_SOURCES "REFTABLE_OBJS")
+parse_makefile_for_sources(reftable_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "REFTABLE_OBJS")
list(TRANSFORM reftable_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
add_library(reftable STATIC ${reftable_SOURCES})
@@ -749,7 +749,7 @@ elseif(UNIX)
endif()
#git
-parse_makefile_for_sources(git_SOURCES "BUILTIN_OBJS")
+parse_makefile_for_sources(git_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "BUILTIN_OBJS")
list(TRANSFORM git_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
add_executable(git ${CMAKE_SOURCE_DIR}/git.c ${git_SOURCES})
@@ -886,24 +886,14 @@ file(STRINGS ${CMAKE_SOURCE_DIR}/git-p4.py content NEWLINE_CONSUME)
string(REPLACE "#!/usr/bin/env python" "#!/usr/bin/python" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/git-p4 ${content})
-#templates
-file(GLOB templates "${CMAKE_SOURCE_DIR}/templates/*")
-list(TRANSFORM templates REPLACE "${CMAKE_SOURCE_DIR}/templates/" "")
-list(REMOVE_ITEM templates ".gitignore")
-list(REMOVE_ITEM templates "Makefile")
-list(REMOVE_ITEM templates "blt")# Prevents an error when reconfiguring for in source builds
-
-list(REMOVE_ITEM templates "branches--")
-file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/templates/blt/branches) #create branches
-
+#${CMAKE_SOURCE_DIR}/Makefile templates
+parse_makefile_for_sources(templates ${CMAKE_SOURCE_DIR}/templates/Makefile "TEMPLATES")
+string(REPLACE " " ";" templates ${templates})
#templates have @.*@ replacement so use configure_file instead
foreach(tm ${templates})
- string(REPLACE "--" "/" blt_tm ${tm})
- string(REPLACE "this" "" blt_tm ${blt_tm})# for this--
- configure_file(${CMAKE_SOURCE_DIR}/templates/${tm} ${CMAKE_BINARY_DIR}/templates/blt/${blt_tm} @ONLY)
+ configure_file(${CMAKE_SOURCE_DIR}/templates/${tm} ${CMAKE_BINARY_DIR}/templates/blt/${tm} @ONLY)
endforeach()
-
#translations
if(MSGFMT_EXE)
file(GLOB po_files "${CMAKE_SOURCE_DIR}/po/*.po")
@@ -977,7 +967,7 @@ add_executable(test-fake-ssh ${CMAKE_SOURCE_DIR}/t/helper/test-fake-ssh.c)
target_link_libraries(test-fake-ssh common-main)
#unit-tests
-parse_makefile_for_sources(unit-test_SOURCES "UNIT_TEST_OBJS")
+parse_makefile_for_sources(unit-test_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "UNIT_TEST_OBJS")
list(TRANSFORM unit-test_SOURCES REPLACE "\\$\\(UNIT_TEST_DIR\\)/" "${CMAKE_SOURCE_DIR}/t/unit-tests/")
add_library(unit-test-lib STATIC ${unit-test_SOURCES})
@@ -1035,7 +1025,7 @@ if(MSVC)
endif()
#test-tool
-parse_makefile_for_sources(test-tool_SOURCES "TEST_BUILTINS_OBJS")
+parse_makefile_for_sources(test-tool_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "TEST_BUILTINS_OBJS")
add_library(test-lib OBJECT ${CMAKE_SOURCE_DIR}/t/unit-tests/test-lib.c)
list(TRANSFORM test-tool_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/t/helper/")
diff --git a/templates/Makefile b/templates/Makefile
index 367ad00c24cb34c0668eb5236dc3b08a477a65b7..bd1e9e30c120032b209fb1d221b9d93eea31c649 100644
--- a/templates/Makefile
+++ b/templates/Makefile
@@ -29,24 +29,35 @@ all: boilerplates.made custom
# in a file direc--tory--file in the source. They will be
# just copied to the destination.
-bpsrc = $(filter-out %~,$(wildcard *--*))
-boilerplates.made : $(bpsrc)
- $(QUIET)umask 022 && ls *--* 2>/dev/null | \
- while read boilerplate; \
+TEMPLATES =
+TEMPLATES += description
+TEMPLATES += hooks/applypatch-msg.sample
+TEMPLATES += hooks/commit-msg.sample
+TEMPLATES += hooks/fsmonitor-watchman.sample
+TEMPLATES += hooks/post-update.sample
+TEMPLATES += hooks/pre-applypatch.sample
+TEMPLATES += hooks/pre-commit.sample
+TEMPLATES += hooks/pre-merge-commit.sample
+TEMPLATES += hooks/prepare-commit-msg.sample
+TEMPLATES += hooks/pre-push.sample
+TEMPLATES += hooks/pre-rebase.sample
+TEMPLATES += hooks/pre-receive.sample
+TEMPLATES += hooks/push-to-checkout.sample
+TEMPLATES += hooks/sendemail-validate.sample
+TEMPLATES += hooks/update.sample
+TEMPLATES += info/exclude
+
+boilerplates.made: $(TEMPLATES)
+ $(QUIET)umask 022 && for template in $(TEMPLATES); \
do \
- case "$$boilerplate" in *~) continue ;; esac && \
- dst=`echo "$$boilerplate" | sed -e 's|^this|.|;s|--|/|g'` && \
- dir=`expr "$$dst" : '\(.*\)/'` && \
+ dir=$$(dirname "$$template") && \
mkdir -p blt/$$dir && \
- case "$$boilerplate" in \
- *--) continue;; \
- esac && \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
- -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' $$boilerplate > \
- blt/$$dst && \
- if test -x "$$boilerplate"; then rx=rx; else rx=r; fi && \
- chmod a+$$rx "blt/$$dst" || exit; \
+ -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' $$template > \
+ blt/$$template && \
+ if test -x "$$template"; then rx=rx; else rx=r; fi && \
+ chmod a+$$rx "blt/$$template" || exit; \
done && \
date >$@
diff --git a/templates/branches-- b/templates/branches--
deleted file mode 100644
index fae88709a636f3a06cc813dd64b28bfee7fa2073..0000000000000000000000000000000000000000
--- a/templates/branches--
+++ /dev/null
@@ -1 +0,0 @@
-: this is just to ensure the directory exists.
diff --git a/templates/this--description b/templates/description
similarity index 100%
rename from templates/this--description
rename to templates/description
diff --git a/templates/hooks--applypatch-msg.sample b/templates/hooks/applypatch-msg.sample
similarity index 100%
rename from templates/hooks--applypatch-msg.sample
rename to templates/hooks/applypatch-msg.sample
diff --git a/templates/hooks--commit-msg.sample b/templates/hooks/commit-msg.sample
similarity index 100%
rename from templates/hooks--commit-msg.sample
rename to templates/hooks/commit-msg.sample
diff --git a/templates/hooks--fsmonitor-watchman.sample b/templates/hooks/fsmonitor-watchman.sample
similarity index 100%
rename from templates/hooks--fsmonitor-watchman.sample
rename to templates/hooks/fsmonitor-watchman.sample
diff --git a/templates/hooks--post-update.sample b/templates/hooks/post-update.sample
similarity index 100%
rename from templates/hooks--post-update.sample
rename to templates/hooks/post-update.sample
diff --git a/templates/hooks--pre-applypatch.sample b/templates/hooks/pre-applypatch.sample
similarity index 100%
rename from templates/hooks--pre-applypatch.sample
rename to templates/hooks/pre-applypatch.sample
diff --git a/templates/hooks--pre-commit.sample b/templates/hooks/pre-commit.sample
similarity index 100%
rename from templates/hooks--pre-commit.sample
rename to templates/hooks/pre-commit.sample
diff --git a/templates/hooks--pre-merge-commit.sample b/templates/hooks/pre-merge-commit.sample
similarity index 100%
rename from templates/hooks--pre-merge-commit.sample
rename to templates/hooks/pre-merge-commit.sample
diff --git a/templates/hooks--pre-push.sample b/templates/hooks/pre-push.sample
similarity index 100%
rename from templates/hooks--pre-push.sample
rename to templates/hooks/pre-push.sample
diff --git a/templates/hooks--pre-rebase.sample b/templates/hooks/pre-rebase.sample
similarity index 100%
rename from templates/hooks--pre-rebase.sample
rename to templates/hooks/pre-rebase.sample
diff --git a/templates/hooks--pre-receive.sample b/templates/hooks/pre-receive.sample
similarity index 100%
rename from templates/hooks--pre-receive.sample
rename to templates/hooks/pre-receive.sample
diff --git a/templates/hooks--prepare-commit-msg.sample b/templates/hooks/prepare-commit-msg.sample
similarity index 100%
rename from templates/hooks--prepare-commit-msg.sample
rename to templates/hooks/prepare-commit-msg.sample
diff --git a/templates/hooks--push-to-checkout.sample b/templates/hooks/push-to-checkout.sample
similarity index 100%
rename from templates/hooks--push-to-checkout.sample
rename to templates/hooks/push-to-checkout.sample
diff --git a/templates/hooks--sendemail-validate.sample b/templates/hooks/sendemail-validate.sample
similarity index 100%
rename from templates/hooks--sendemail-validate.sample
rename to templates/hooks/sendemail-validate.sample
diff --git a/templates/hooks--update.sample b/templates/hooks/update.sample
similarity index 100%
rename from templates/hooks--update.sample
rename to templates/hooks/update.sample
diff --git a/templates/info--exclude b/templates/info/exclude
similarity index 100%
rename from templates/info--exclude
rename to templates/info/exclude
--
2.47.0.251.gb31fb630c0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH RFC v6 12/19] Documentation: allow sourcing generated includes from separate dir
2024-11-12 17:02 ` [PATCH RFC v6 " Patrick Steinhardt
` (10 preceding siblings ...)
2024-11-12 17:02 ` [PATCH RFC v6 11/19] Makefile: simplify building of templates Patrick Steinhardt
@ 2024-11-12 17:02 ` Patrick Steinhardt
2024-11-12 17:02 ` [PATCH RFC v6 13/19] Documentation: teach "cmd-list.perl" about out-of-tree builds Patrick Steinhardt
` (8 subsequent siblings)
20 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-12 17:02 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King
Our documentation uses "include::" directives to include parts that are
either reused across multiple documents or parts that we generate at
build time. Unfortunately, top-level includes are only ever resolved
relative to the base directory, which is typically the directory of the
including document. Most importantly, it is not possible to have either
asciidoc or asciidoctor search multiple directories.
It follows that both kinds of includes must live in the same directory.
This is of course a bummer for out-of-tree builds, because here the
dynamically-built includes live in the build directory whereas the
static includes live in the source directory.
Introduce a `build_dir` attribute and prepend it to all of our includes
for dynamically-built files. This attribute gets set to the build
directory and thus converts the include path to an absolute path, which
asciidoc and asciidoctor know how to resolve.
Note that this change also requires us to update "build-docdep.perl",
which tries to figure out included files such our Makefile can set up
proper build-time dependencies. This script simply scans through the
source files for any lines that match "^include::" and treats the
remainder of the line as included file path. But given that those may
now contain the "{build_dir}" variable we have to teach the script to
replace that attribute with the actual build directory.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Documentation/Makefile | 3 ++-
Documentation/build-docdep.perl | 2 ++
Documentation/config/diff.txt | 2 +-
Documentation/config/merge.txt | 2 +-
Documentation/git.txt | 24 ++++++++++++------------
5 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 0f55baa252fffbcd506f0c6f410b26b37f2e9b11..75755ceec189836813e01fa43bae69bdd2083f3e 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -218,6 +218,7 @@ SHELL_PATH ?= $(SHELL)
# Shell quote;
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
+ASCIIDOC_EXTRA += -abuild_dir='$(shell pwd)'
ifdef DEFAULT_PAGER
DEFAULT_PAGER_SQ = $(subst ','\'',$(DEFAULT_PAGER))
ASCIIDOC_EXTRA += -a 'git-default-pager=$(DEFAULT_PAGER_SQ)'
@@ -283,7 +284,7 @@ docdep_prereqs = \
cmd-list.made $(cmds_txt)
doc.dep : $(docdep_prereqs) $(DOC_DEP_TXT) build-docdep.perl
- $(QUIET_GEN)$(PERL_PATH) ./build-docdep.perl >$@ $(QUIET_STDERR)
+ $(QUIET_GEN)$(PERL_PATH) ./build-docdep.perl "$(shell pwd)" >$@ $(QUIET_STDERR)
ifneq ($(MAKECMDGOALS),clean)
-include doc.dep
diff --git a/Documentation/build-docdep.perl b/Documentation/build-docdep.perl
index 1b3ac8fdd95fa1d57afbdffb1a9743f36ed22fdd..315efaa2fa2f2efc89b2c8073cc97cd2cc83611c 100755
--- a/Documentation/build-docdep.perl
+++ b/Documentation/build-docdep.perl
@@ -1,5 +1,6 @@
#!/usr/bin/perl
+my ($build_dir) = @ARGV;
my %include = ();
my %included = ();
@@ -10,6 +11,7 @@
chomp;
s/^include::\s*//;
s/\[\]//;
+ s/{build_dir}/${build_dir}/;
$include{$text}{$_} = 1;
$included{$_} = 1;
}
diff --git a/Documentation/config/diff.txt b/Documentation/config/diff.txt
index 190bda17e51c57a00b25bf98afa038b8a89e4ea5..9575af91fa53d3f67925d31e77b81222e737fc3a 100644
--- a/Documentation/config/diff.txt
+++ b/Documentation/config/diff.txt
@@ -206,7 +206,7 @@ diff.<driver>.cachetextconv::
Set this option to true to make the diff driver cache the text
conversion outputs. See linkgit:gitattributes[5] for details.
-include::../mergetools-diff.txt[]
+include::{build_dir}/mergetools-diff.txt[]
diff.indentHeuristic::
Set this option to `false` to disable the default heuristics
diff --git a/Documentation/config/merge.txt b/Documentation/config/merge.txt
index 8851b6cedef980c106b9e86541862b517aa1f2ad..82554d65a0aa0826fdb53c5d834389d38f308e3e 100644
--- a/Documentation/config/merge.txt
+++ b/Documentation/config/merge.txt
@@ -101,7 +101,7 @@ merge.guitool::
Any other value is treated as a custom merge tool and requires that a
corresponding mergetool.<guitool>.cmd variable is defined.
-include::../mergetools-merge.txt[]
+include::{build_dir}/mergetools-merge.txt[]
merge.verbosity::
Controls the amount of output shown by the recursive merge
diff --git a/Documentation/git.txt b/Documentation/git.txt
index d15a8697625d6b6c598a2bc774bf243675ab68ea..44f0797ccffb1a7359bee9c20182953293b70d6d 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -245,17 +245,17 @@ ancillary user utilities.
Main porcelain commands
~~~~~~~~~~~~~~~~~~~~~~~
-include::cmds-mainporcelain.txt[]
+include::{build_dir}/cmds-mainporcelain.txt[]
Ancillary Commands
~~~~~~~~~~~~~~~~~~
Manipulators:
-include::cmds-ancillarymanipulators.txt[]
+include::{build_dir}/cmds-ancillarymanipulators.txt[]
Interrogators:
-include::cmds-ancillaryinterrogators.txt[]
+include::{build_dir}/cmds-ancillaryinterrogators.txt[]
Interacting with Others
@@ -264,7 +264,7 @@ Interacting with Others
These commands are to interact with foreign SCM and with other
people via patch over e-mail.
-include::cmds-foreignscminterface.txt[]
+include::{build_dir}/cmds-foreignscminterface.txt[]
Reset, restore and revert
~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -313,13 +313,13 @@ repositories.
Manipulation commands
~~~~~~~~~~~~~~~~~~~~~
-include::cmds-plumbingmanipulators.txt[]
+include::{build_dir}/cmds-plumbingmanipulators.txt[]
Interrogation commands
~~~~~~~~~~~~~~~~~~~~~~
-include::cmds-plumbinginterrogators.txt[]
+include::{build_dir}/cmds-plumbinginterrogators.txt[]
In general, the interrogate commands do not touch the files in
the working tree.
@@ -328,12 +328,12 @@ the working tree.
Syncing repositories
~~~~~~~~~~~~~~~~~~~~
-include::cmds-synchingrepositories.txt[]
+include::{build_dir}/cmds-synchingrepositories.txt[]
The following are helper commands used by the above; end users
typically do not use them directly.
-include::cmds-synchelpers.txt[]
+include::{build_dir}/cmds-synchelpers.txt[]
Internal helper commands
@@ -342,14 +342,14 @@ Internal helper commands
These are internal helper commands used by other commands; end
users typically do not use them directly.
-include::cmds-purehelpers.txt[]
+include::{build_dir}/cmds-purehelpers.txt[]
Guides
------
The following documentation pages are guides about Git concepts.
-include::cmds-guide.txt[]
+include::{build_dir}/cmds-guide.txt[]
Repository, command and file interfaces
---------------------------------------
@@ -358,7 +358,7 @@ This documentation discusses repository and command interfaces which
users are expected to interact with directly. See `--user-formats` in
linkgit:git-help[1] for more details on the criteria.
-include::cmds-userinterfaces.txt[]
+include::{build_dir}/cmds-userinterfaces.txt[]
File formats, protocols and other developer interfaces
------------------------------------------------------
@@ -367,7 +367,7 @@ This documentation discusses file formats, over-the-wire protocols and
other git developer interfaces. See `--developer-interfaces` in
linkgit:git-help[1].
-include::cmds-developerinterfaces.txt[]
+include::{build_dir}/cmds-developerinterfaces.txt[]
Configuration Mechanism
-----------------------
--
2.47.0.251.gb31fb630c0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH RFC v6 13/19] Documentation: teach "cmd-list.perl" about out-of-tree builds
2024-11-12 17:02 ` [PATCH RFC v6 " Patrick Steinhardt
` (11 preceding siblings ...)
2024-11-12 17:02 ` [PATCH RFC v6 12/19] Documentation: allow sourcing generated includes from separate dir Patrick Steinhardt
@ 2024-11-12 17:02 ` Patrick Steinhardt
2024-11-12 17:02 ` [PATCH RFC v6 14/19] Documentation: extract script to generate a list of mergetools Patrick Steinhardt
` (7 subsequent siblings)
20 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-12 17:02 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King
The "cmd-list.perl" script generates a list of commands that can be
included into our manpages. The script doesn't know about out-of-tree
builds and instead writes resulting files into the source directory.
Adapt it such that we can read data from the source directory and write
data into the build directory.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Documentation/Makefile | 2 +-
Documentation/cmd-list.perl | 23 ++++++++++++-----------
2 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 75755ceec189836813e01fa43bae69bdd2083f3e..2b9fd37ff7021f3d44eaa282b942c623f403510a 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -306,7 +306,7 @@ cmds_txt = cmds-ancillaryinterrogators.txt \
$(cmds_txt): cmd-list.made
cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
- $(QUIET_GEN)$(PERL_PATH) ./cmd-list.perl ../command-list.txt $(cmds_txt) $(QUIET_STDERR) && \
+ $(QUIET_GEN)$(PERL_PATH) ./cmd-list.perl .. . $(cmds_txt) && \
date >$@
mergetools_txt = mergetools-diff.txt mergetools-merge.txt
diff --git a/Documentation/cmd-list.perl b/Documentation/cmd-list.perl
index 755a110bc48d7e2b596651ca13664c01192d966c..e260a989774071b66d2b56c56c5045b84a508c5c 100755
--- a/Documentation/cmd-list.perl
+++ b/Documentation/cmd-list.perl
@@ -3,12 +3,13 @@
use File::Compare qw(compare);
sub format_one {
- my ($out, $nameattr) = @_;
+ my ($source_dir, $out, $nameattr) = @_;
my ($name, $attr) = @$nameattr;
+ my ($path) = "$source_dir/Documentation/$name.txt";
my ($state, $description);
my $mansection;
$state = 0;
- open I, '<', "$name.txt" or die "No such file $name.txt";
+ open I, '<', "$path" or die "No such file $path.txt";
while (<I>) {
if (/^(?:git|scalar)[a-z0-9-]*\(([0-9])\)$/) {
$mansection = $1;
@@ -29,7 +30,7 @@ sub format_one {
}
close I;
if (!defined $description) {
- die "No description found in $name.txt";
+ die "No description found in $path.txt";
}
if (my ($verify_name, $text) = ($description =~ /^($name) - (.*)/)) {
print $out "linkgit:$name\[$mansection\]::\n\t";
@@ -43,9 +44,9 @@ sub format_one {
}
}
-my ($input, @categories) = @ARGV;
+my ($source_dir, $build_dir, @categories) = @ARGV;
-open IN, "<$input";
+open IN, "<$source_dir/command-list.txt";
while (<IN>) {
last if /^### command list/;
}
@@ -63,17 +64,17 @@ sub format_one {
for my $out (@categories) {
my ($cat) = $out =~ /^cmds-(.*)\.txt$/;
- open O, '>', "$out+" or die "Cannot open output file $out+";
+ my ($path) = "$build_dir/$out";
+ open O, '>', "$path+" or die "Cannot open output file $out+";
for (@{$cmds{$cat}}) {
- format_one(\*O, $_);
+ format_one($source_dir, \*O, $_);
}
close O;
- if (-f "$out" && compare("$out", "$out+") == 0) {
- unlink "$out+";
+ if (-f "$path" && compare("$path", "$path+") == 0) {
+ unlink "$path+";
}
else {
- print STDERR "$out\n";
- rename "$out+", "$out";
+ rename "$path+", "$path";
}
}
--
2.47.0.251.gb31fb630c0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH RFC v6 14/19] Documentation: extract script to generate a list of mergetools
2024-11-12 17:02 ` [PATCH RFC v6 " Patrick Steinhardt
` (12 preceding siblings ...)
2024-11-12 17:02 ` [PATCH RFC v6 13/19] Documentation: teach "cmd-list.perl" about out-of-tree builds Patrick Steinhardt
@ 2024-11-12 17:02 ` Patrick Steinhardt
2024-11-12 17:02 ` [PATCH RFC v6 15/19] t: better support for out-of-tree builds Patrick Steinhardt
` (6 subsequent siblings)
20 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-12 17:02 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King
We include the list of available mergetools into our manpages. Extract
the script that performs this logic such that we can reuse it in other
build systems.
While at it, refactor the Makefile targets such that we don't create
"mergetools-list.made" anymore. It shouldn't be necessary, as we can
instead have other targets depend on "mergetools-{diff,merge}.txt"
directly.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Documentation/Makefile | 22 ++++++++--------------
Documentation/generate-mergetool-list.sh | 17 +++++++++++++++++
2 files changed, 25 insertions(+), 14 deletions(-)
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 2b9fd37ff7021f3d44eaa282b942c623f403510a..e2ce98a751f090af8a8c095e7b138ef601e9c0be 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -276,11 +276,13 @@ ifneq ($(filter-out lint-docs clean,$(MAKECMDGOALS)),)
-include ../GIT-VERSION-FILE
endif
+mergetools_txt = mergetools-diff.txt mergetools-merge.txt
+
#
# Determine "include::" file references in asciidoc files.
#
docdep_prereqs = \
- mergetools-list.made $(mergetools_txt) \
+ $(mergetools_txt) \
cmd-list.made $(cmds_txt)
doc.dep : $(docdep_prereqs) $(DOC_DEP_TXT) build-docdep.perl
@@ -309,19 +311,11 @@ cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
$(QUIET_GEN)$(PERL_PATH) ./cmd-list.perl .. . $(cmds_txt) && \
date >$@
-mergetools_txt = mergetools-diff.txt mergetools-merge.txt
-
-$(mergetools_txt): mergetools-list.made
-
-mergetools-list.made: ../git-mergetool--lib.sh $(wildcard ../mergetools/*)
- $(QUIET_GEN) \
- $(SHELL_PATH) -c 'MERGE_TOOLS_DIR=../mergetools && TOOL_MODE=diff && \
- . ../git-mergetool--lib.sh && \
- show_tool_names can_diff' | sed -e "s/\([a-z0-9]*\)/\`\1\`;;/" >mergetools-diff.txt && \
- $(SHELL_PATH) -c 'MERGE_TOOLS_DIR=../mergetools && TOOL_MODE=merge && \
- . ../git-mergetool--lib.sh && \
- show_tool_names can_merge' | sed -e "s/\([a-z0-9]*\)/\`\1\`;;/" >mergetools-merge.txt && \
- date >$@
+mergetools-%.txt: generate-mergetool-list.sh ../git-mergetool--lib.sh $(wildcard ../mergetools/*)
+mergetools-diff.txt:
+ $(QUIET_GEN)$(SHELL_PATH) ./generate-mergetool-list.sh .. diff $@
+mergetools-merge.txt:
+ $(QUIET_GEN)$(SHELL_PATH) ./generate-mergetool-list.sh .. merge $@
TRACK_ASCIIDOCFLAGS = $(subst ','\'',$(ASCIIDOC_COMMON):$(ASCIIDOC_HTML):$(ASCIIDOC_DOCBOOK))
diff --git a/Documentation/generate-mergetool-list.sh b/Documentation/generate-mergetool-list.sh
new file mode 100755
index 0000000000000000000000000000000000000000..696196fbcb86084abffc1d29355705a37b1532b3
--- /dev/null
+++ b/Documentation/generate-mergetool-list.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+if test "$#" -ne 3
+then
+ echo "USAGE: $0 <SOURCE_DIR> <MODE> <OUTPUT>" >&2
+ exit 1
+fi
+
+SOURCE_DIR="$1"
+TOOL_MODE="$2"
+OUTPUT="$3"
+MERGE_TOOLS_DIR="$SOURCE_DIR/mergetools"
+
+(
+ . "$SOURCE_DIR"/git-mergetool--lib.sh &&
+ show_tool_names can_$TOOL_MODE
+) | sed -e "s/\([a-z0-9]*\)/\`\1\`;;/" >"$OUTPUT"
--
2.47.0.251.gb31fb630c0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH RFC v6 15/19] t: better support for out-of-tree builds
2024-11-12 17:02 ` [PATCH RFC v6 " Patrick Steinhardt
` (13 preceding siblings ...)
2024-11-12 17:02 ` [PATCH RFC v6 14/19] Documentation: extract script to generate a list of mergetools Patrick Steinhardt
@ 2024-11-12 17:02 ` Patrick Steinhardt
2024-11-12 17:02 ` [PATCH RFC v6 16/19] t: allow overriding build dir Patrick Steinhardt
` (5 subsequent siblings)
20 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-12 17:02 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King
Our in-tree builds used by the Makefile use various different build
directories scattered around different locations. The paths to those
build directories have to be propagated to our tests such that they can
find the contained files. This is done via a mixture of hardcoded paths
in our test library and injected variables in our bin-wrappers or
"GIT-BUILD-OPTIONS".
The latter two mechanisms are preferable over using hardcoded paths. For
one, we have all paths which are subject to change stored in a small set
of central files instead of having the knowledge of build paths in many
files. And second, it allows build systems which build files elsewhere
to adapt those paths based on their own needs. This is especially nice
in the context of build systems that use out-of-tree builds like CMake
or Meson.
Remove hardcoded knowledge of build paths from our test library and move
it into our bin-wrappers and "GIT-BUILD-OPTIONS".
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-BUILD-OPTIONS.in | 5 +++++
Makefile | 9 +++++++++
bin-wrappers/wrap-for-bin.sh | 11 ++++++-----
contrib/buildsystems/CMakeLists.txt | 8 ++++++++
t/lib-gettext.sh | 4 ++--
t/t7609-mergetool--lib.sh | 2 +-
t/test-lib.sh | 6 +++---
7 files changed, 34 insertions(+), 11 deletions(-)
diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in
index 9b95a6b3eee334b6f691702696ca9d92201b6bac..f651116102ae2977622dccd12b199fe7ad65af99 100644
--- a/GIT-BUILD-OPTIONS.in
+++ b/GIT-BUILD-OPTIONS.in
@@ -35,6 +35,11 @@ GIT_PERF_MAKE_COMMAND=@GIT_PERF_MAKE_COMMAND@
GIT_INTEROP_MAKE_OPTS=@GIT_INTEROP_MAKE_OPTS@
GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@
GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@
+GIT_TEST_TEXTDOMAINDIR=@GIT_TEST_TEXTDOMAINDIR@
+GIT_TEST_POPATH=@GIT_TEST_POPATH@
+GIT_TEST_TEMPLATE_DIR=@GIT_TEST_TEMPLATE_DIR@
+GIT_TEST_GITPERLLIB=@GIT_TEST_GITPERLLIB@
+GIT_TEST_MERGE_TOOLS_DIR=@GIT_TEST_MERGE_TOOLS_DIR@
RUNTIME_PREFIX=@RUNTIME_PREFIX@
GITWEBDIR=@GITWEBDIR@
USE_GETTEXT_SCHEME=@USE_GETTEXT_SCHEME@
diff --git a/Makefile b/Makefile
index f6f4381c8e6246e8dbab0ca0193320146edc9dca..41221f330b3e46fb13fb3165700fa0242e842324 100644
--- a/Makefile
+++ b/Makefile
@@ -3173,6 +3173,11 @@ GIT-BUILD-OPTIONS: FORCE
-e "s|@GIT_INTEROP_MAKE_OPTS@|\'$(GIT_INTEROP_MAKE_OPTS)\'|" \
-e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \
-e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \
+ -e "s|@GIT_TEST_TEXTDOMAINDIR@|\'$(shell pwd)/po/build/locale\'|" \
+ -e "s|@GIT_TEST_POPATH@|\'$(shell pwd)/po\'|" \
+ -e "s|@GIT_TEST_TEMPLATE_DIR@|\'$(shell pwd)/templates/blt\'|" \
+ -e "s|@GIT_TEST_GITPERLLIB@|\'$(shell pwd)/perl/build/lib\'|" \
+ -e "s|@GIT_TEST_MERGE_TOOLS_DIR@|\'$(shell pwd)/mergetools\'|" \
-e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX)\'|" \
-e "s|@GITWEBDIR@|\'$(gitwebdir_SQ)\'|" \
-e "s|@USE_GETTEXT_SCHEME@|\'$(USE_GETTEXT_SCHEME)\'|" \
@@ -3202,6 +3207,10 @@ all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PR
$(test_bindir_programs): bin-wrappers/%: bin-wrappers/wrap-for-bin.sh
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@BUILD_DIR@|$(shell pwd)|' \
+ -e 's|@GIT_TEXTDOMAINDIR@|$(shell pwd)/po/build/locale|' \
+ -e 's|@GITPERLLIB@|$(shell pwd)/perl/build/lib|' \
+ -e 's|@MERGE_TOOLS_DIR@|$(shell pwd)/mergetools|' \
+ -e 's|@TEMPLATE_DIR@|$(shell pwd)/templates/blt|' \
-e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
chmod +x $@
diff --git a/bin-wrappers/wrap-for-bin.sh b/bin-wrappers/wrap-for-bin.sh
index 7898a1c238dde20617cf96d144930dc59f67feab..1d3a59a0081e1fc6066af187093cb1d11d01a929 100755
--- a/bin-wrappers/wrap-for-bin.sh
+++ b/bin-wrappers/wrap-for-bin.sh
@@ -4,21 +4,22 @@
# to run test suite against sandbox, but with only bindir-installed
# executables in PATH. The Makefile copies this into various
# files in bin-wrappers, substituting
-# @BUILD_DIR@ and @PROG@.
+# @BUILD_DIR@, @TEMPLATE_DIR@ and @PROG@.
GIT_EXEC_PATH='@BUILD_DIR@'
if test -n "$NO_SET_GIT_TEMPLATE_DIR"
then
unset GIT_TEMPLATE_DIR
else
- GIT_TEMPLATE_DIR='@BUILD_DIR@/templates/blt'
+ GIT_TEMPLATE_DIR='@TEMPLATE_DIR@'
export GIT_TEMPLATE_DIR
fi
-GITPERLLIB='@BUILD_DIR@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}"
-GIT_TEXTDOMAINDIR='@BUILD_DIR@/po/build/locale'
+MERGE_TOOLS_DIR='@MERGE_TOOLS_DIR@'
+GITPERLLIB='@GITPERLLIB@'"${GITPERLLIB:+:$GITPERLLIB}"
+GIT_TEXTDOMAINDIR='@GIT_TEXTDOMAINDIR@'
PATH='@BUILD_DIR@/bin-wrappers:'"$PATH"
-export GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
+export MERGE_TOOLS_DIR GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
case "$GIT_DEBUGGER" in
'')
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index f63661c6b5d9f51778a0e08fab7032bea5010e6f..665f3638e9b200c7a5c2931cc93e1ee4e49db2f3 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -1066,6 +1066,9 @@ endforeach()
file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+string(REPLACE "@GIT_TEXTDOMAINDIR@" "${CMAKE_BINARY_DIR}/po/build/locale" content "${content}")
+string(REPLACE "@GITPERLLIB@" "${CMAKE_BINARY_DIR}/perl/build/lib" content "${content}")
+string(REPLACE "@MERGE_TOOLS_DIR@" "${CMAKE_SOURCE_DIR}/mergetools" content "${content}")
string(REPLACE "@PROG@" "git-cvsserver" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})
@@ -1151,6 +1154,11 @@ string(REPLACE "@GIT_PERF_MAKE_COMMAND@" "" git_build_options "${git_build_optio
string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_options}")
string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}")
string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_TEXTDOMAINDIR@" "${CMAKE_BINARY_DIR}/po/build/locale" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_POPATH@" "${CMAKE_BINARY_DIR}/po" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_TEMPLATE_DIR@" "${CMAKE_BINARY_DIR}/templates/blt" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_GITPERLLIB@" "${CMAKE_BINARY_DIR}/perl/build/lib" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_MERGE_TOOLS_DIR@" "${RUNTIME_PREFIX}" git_build_options "${git_build_options}")
string(REPLACE "@RUNTIME_PREFIX@" "${RUNTIME_PREFIX}" git_build_options "${git_build_options}")
string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" git_build_options "${git_build_options}")
string(REPLACE "@USE_GETTEXT_SCHEME@" "" git_build_options "${git_build_options}")
diff --git a/t/lib-gettext.sh b/t/lib-gettext.sh
index cc6bb2cdeaae7b5bb23211c0d9c37c9deb39e14f..7a734c6973e65995d3403a26cc9e5c1a5a1ce074 100644
--- a/t/lib-gettext.sh
+++ b/t/lib-gettext.sh
@@ -6,8 +6,8 @@
. ./test-lib.sh
-GIT_TEXTDOMAINDIR="$GIT_BUILD_DIR/po/build/locale"
-GIT_PO_PATH="$GIT_BUILD_DIR/po"
+GIT_TEXTDOMAINDIR="$GIT_TEST_TEXTDOMAINDIR"
+GIT_PO_PATH="$GIT_TEST_POPATH"
export GIT_TEXTDOMAINDIR GIT_PO_PATH
if test -n "$GIT_TEST_INSTALLED"
diff --git a/t/t7609-mergetool--lib.sh b/t/t7609-mergetool--lib.sh
index 8b1c3bd39f2249417099ea2f24218268925909af..a9273ba58d76333c74d0072794ed0d95b966f16f 100755
--- a/t/t7609-mergetool--lib.sh
+++ b/t/t7609-mergetool--lib.sh
@@ -8,7 +8,7 @@ TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'mergetool --tool=vimdiff creates the expected layout' '
- . "$GIT_BUILD_DIR"/mergetools/vimdiff &&
+ . "$GIT_TEST_MERGE_TOOLS_DIR"/vimdiff &&
run_unit_tests
'
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 4dd641baefee532e2c0fa80bc78c7b7c6ab768a1..677424ced06a0351133d6e44d1b7ca1e77623a59 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1478,7 +1478,7 @@ else # normal case, use ../bin-wrappers only unless $with_dashes:
PATH="$GIT_BUILD_DIR:$GIT_BUILD_DIR/t/helper:$PATH"
fi
fi
-GIT_TEMPLATE_DIR="$GIT_BUILD_DIR"/templates/blt
+GIT_TEMPLATE_DIR="$GIT_TEST_TEMPLATE_DIR"
GIT_CONFIG_NOSYSTEM=1
GIT_ATTR_NOSYSTEM=1
GIT_CEILING_DIRECTORIES="$TRASH_DIRECTORY/.."
@@ -1494,9 +1494,9 @@ then
fi
fi
-GITPERLLIB="$GIT_BUILD_DIR"/perl/build/lib
+GITPERLLIB="$GIT_TEST_GITPERLLIB"
export GITPERLLIB
-test -d "$GIT_BUILD_DIR"/templates/blt || {
+test -d "$GIT_TEMPLATE_DIR" || {
BAIL_OUT "You haven't built things yet, have you?"
}
--
2.47.0.251.gb31fb630c0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH RFC v6 16/19] t: allow overriding build dir
2024-11-12 17:02 ` [PATCH RFC v6 " Patrick Steinhardt
` (14 preceding siblings ...)
2024-11-12 17:02 ` [PATCH RFC v6 15/19] t: better support for out-of-tree builds Patrick Steinhardt
@ 2024-11-12 17:02 ` Patrick Steinhardt
2024-11-12 17:03 ` [PATCH RFC v6 17/19] Documentation: add comparison of build systems Patrick Steinhardt
` (4 subsequent siblings)
20 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-12 17:02 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King
Our "test-lib.sh" assumes that our build directory is the parent
directory of "t/". While true when using our Makefile, it's not when
using build systems that support out-of-tree builds.
In commit ee9e66e4e7 (cmake: avoid editing t/test-lib.sh, 2022-10-18),
we have introduce support for overriding the GIT_BUILD_DIR by creating
the file "$GIT_BUILD_DIR/GIT-BUILD-DIR" with its contents pointing to
the location of the build directory. The intent was to stop modifying
"t/test-lib.sh" with the CMake build systems while allowing out-of-tree
builds. But "$GIT_BUILD_DIR" is somewhat misleadingly named, as it in
fact points to the _source_ directory. So while that commit solved part
of the problem for out-of-tree builds, CMake still has to write files
into the source tree.
Solve the second part of the problem, namely not having to write any
data into the source directory at all, by also supporting an environment
variable that allows us to point to a different build directory. This
allows us to perform properly self-contained out-of-tree builds.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
t/test-lib.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 677424ced06a0351133d6e44d1b7ca1e77623a59..096af9be6b11b2f7f0caaa5dc187e00f4bdbf1c0 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -35,7 +35,7 @@ else
# needing to exist.
TEST_DIRECTORY=$(cd "$TEST_DIRECTORY" && pwd) || exit 1
fi
-GIT_BUILD_DIR="${TEST_DIRECTORY%/t}"
+GIT_BUILD_DIR="${GIT_BUILD_DIR:-${TEST_DIRECTORY%/t}}"
if test "$TEST_DIRECTORY" = "$GIT_BUILD_DIR"
then
echo "PANIC: Running in a $TEST_DIRECTORY that doesn't end in '/t'?" >&2
@@ -513,6 +513,7 @@ unset VISUAL EMAIL LANGUAGE $("$PERL_PATH" -e '
PERF_
CURL_VERBOSE
TRACE_CURL
+ BUILD_DIR
));
my @vars = grep(/^GIT_/ && !/^GIT_($ok)/o, @env);
print join("\n", @vars);
--
2.47.0.251.gb31fb630c0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH RFC v6 17/19] Documentation: add comparison of build systems
2024-11-12 17:02 ` [PATCH RFC v6 " Patrick Steinhardt
` (15 preceding siblings ...)
2024-11-12 17:02 ` [PATCH RFC v6 16/19] t: allow overriding build dir Patrick Steinhardt
@ 2024-11-12 17:03 ` Patrick Steinhardt
2024-11-12 17:03 ` [PATCH RFC v6 18/19] Introduce support for the Meson build system Patrick Steinhardt
` (3 subsequent siblings)
20 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-12 17:03 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King
We're contemplating whether to eventually replace our build systems with
a build system that is easier to use. Add a comparison of build systems
to our technical documentation as a baseline for discussion.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Documentation/Makefile | 1 +
Documentation/technical/build-systems.txt | 224 ++++++++++++++++++++++++++++++
2 files changed, 225 insertions(+)
diff --git a/Documentation/Makefile b/Documentation/Makefile
index e2ce98a751f090af8a8c095e7b138ef601e9c0be..e1527c6d4429efdd2341163ef895a13ddeae8e2f 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -111,6 +111,7 @@ TECH_DOCS += MyFirstObjectWalk
TECH_DOCS += SubmittingPatches
TECH_DOCS += ToolsForGit
TECH_DOCS += technical/bitmap-format
+TECH_DOCS += technical/build-systems
TECH_DOCS += technical/bundle-uri
TECH_DOCS += technical/hash-function-transition
TECH_DOCS += technical/long-running-process-protocol
diff --git a/Documentation/technical/build-systems.txt b/Documentation/technical/build-systems.txt
new file mode 100644
index 0000000000000000000000000000000000000000..d9dafb407c40902756ca0bde9d9dad8ced8788dd
--- /dev/null
+++ b/Documentation/technical/build-systems.txt
@@ -0,0 +1,224 @@
+= Build Systems
+
+The build system is the primary way for both developers and system integrators
+to interact with the Git project. As such, being easy to use and extend for
+those who are not directly developing Git itself is just as important as other
+requirements we have on any potential build system.
+
+This document outlines the different requirements that we have for the build
+system and then compares available build systems using these criteria.
+
+== Requirements
+
+The following subsections present a list of requirements that we have for any
+potential build system. Sections are sorted by decreasing priority.
+
+=== Platform support
+
+The build system must have support for all of our platforms that we continually
+test against as outlined by our platform support policy. These platforms are:
+
+ - Linux
+ - Windows
+ - macOS
+
+Furthermore, the build system should have support for the following platforms
+that generally have somebody running test pipelines against regularly:
+
+ - AIX
+ - FreeBSD
+ - NetBSD
+ - NonStop
+ - OpenBSD
+
+The platforms which must be supported by the tool should be aligned with our
+[platform support policy](platform-support.txt).
+
+=== Auto-detection of supported features
+
+The build system must support auto-detection of features which are or aren't
+available on the current platform. Platform maintainers should not be required
+to manually configure the complete build.
+
+Auto-detection of the following items is considered to be important:
+
+ - Check for the existence of headers.
+ - Check for the existence of libraries.
+ - Check for the existence of exectuables.
+ - Check for the runtime behavior of specific functions.
+ - Check for specific link order requirements when multiple libraries are
+ involved.
+
+=== Ease of use
+
+The build system should be both easy to use and easy to extend. While this is
+naturally a subjective metric it is likely not controversial to say that some
+build systems are considerably harder to use than others.
+
+=== IDE support
+
+The build system should integrate with well-known IDEs. Well-known IDEs include:
+
+ - Microsoft Visual Studio
+ - Visual Studio Code
+ - Xcode
+
+There are four levels of support:
+
+ - Native integration into the IDE.
+ - Integration into the IDE via a plugin.
+ - Integration into the IDE via generating a project description with the build
+ system.
+ - No integration.
+
+Native integration is preferable, but integration via either a plugin or by
+generating a project description via the build system are considered feasible
+alternatives.
+
+Another important distinction is the level of integration. There are two
+features that one generally wants to have:
+
+ - Integration of build targets.
+ - Automatic setup of features like code completion with detected build
+ dependencies.
+
+The first bullet point is the bare minimum, but is not sufficient to be
+considered proper integration.
+
+=== Out-of-tree builds
+
+The build system should support out-of-tree builds. Out-of-tree builds allow a
+developer to configure multiple different build directories with different
+configuration, e.g. one "debug" build and one "release" build.
+
+=== Cross-platform builds
+
+The build system should support cross-platform builds, e.g. building for arm on
+an x86-64 host.
+
+=== Language support
+
+The following languages and toolchains are of relevance and should be supported
+by the build system:
+
+ - C: the primary compiled language used by Git, must be supported. Relevant
+ toolchains are GCC, Clang and MSVC.
+ - Rust: candidate as a second compiled lanugage, should be supported. Relevant
+ toolchains is the LLVM-based rustc.
+
+Built-in support for the respective languages is preferred over support that
+needs to be wired up manually to avoid unnecessary complexity. Native support
+includes the following features:
+
+ - Compiling objects.
+ - Dependency tracking.
+ - Detection of available features.
+ - Discovery of relevant toolchains.
+ - Linking libraries and executables.
+ - Templating placeholders in scripts.
+
+=== Test integration
+
+It should be possible to integrate tests into the build system such that it is
+possible to build and test Git within the build system. Features which are nice
+to have:
+
+ - Track build-time dependencies for respective tests. Unit tests have
+ different requirements than integration tests.
+ - Allow filtering of which tests to run.
+ - Allow running tests such that utilities like `test_pause` or `debug` work.
+
+== Comparison
+
+The following list of build systems are considered:
+
+- GNU Make
+- autoconf
+- CMake
+- Meson
+
+=== GNU Make
+
+- Platform support: ubitquitous on all platforms, but not well-integrated into Windows.
+- Auto-detection: no built-in support for auto-detection of features.
+- Ease of use: easy to use, but discovering available options is hard. Makefile
+ rules can quickly get out of hand once reaching a certain scope.
+- IDE support: execution of Makefile targets is supported by many IDEs
+- Out-of-tree builds: supported in theory, not wired up in practice.
+- Cross-platform builds: supported in theory, not wired up in practice.
+- Language support:
+ - C: Limited built-in support, many parts need to be wired up manually.
+ - Rust: No built-in support, needs to be wired up manually.
+- Test integration: partially supported, many parts need to be wired up
+ manually.
+
+=== autoconf
+
+- Platform support: ubiquitous on all platforms, but not well-integrated into Windows.
+- Auto-detection: supported.
+- Ease of use: easy to use, discovering available options is comparatively
+ easy. The autoconf syntax is prohibitively hard to extend though due to its
+ complex set of interacting files and the hard-to-understand M4 language.
+- IDE support: no integration into IDEs at generation time. The generated
+ Makefiles have the same level of support as GNU Make.
+- Out-of-tree builds: supported in theory, not wired up in practice.
+- Cross-platform builds: supported.
+- Language support:
+ - C: Limited built-in support, many parts need to be wired up manually.
+ - Rust: No built-in support, needs to be wired up manually.
+- Test integration: partially supported, many parts need to be wired up
+ manually.
+
+=== CMake
+
+- Platform support: not as extensive as GNU Make or autoconf, but all major
+ platforms are supported.
+ - AIX
+ - Cygwin
+ - FreeBSD
+ - Linux
+ - OpenBSD
+ - Solaris
+ - Windows
+ - macOS
+- Ease of use: easy to use, discovering available options is not always
+ trivial. The scripting language used by CMake is somewhat cumbersome to use,
+ but extending CMake build instructions is doable.
+- IDE support: natively integrated into Microsoft Visual Studio. Can generate
+ project descriptions for Xcode. An extension is available for Visual Studio
+ Code. Many other IDEs have plugins for CMake.
+- Out-of-tree builds: supported.
+- Cross-platform builds: supported.
+- Language support:
+ - C: Supported for GCC, Clang, MSVC and other toolchains.
+ - Rust: No built-in support, needs to be wired up manually.
+- Test integration: supported, even though test dependencies are a bit
+ cumbersome to use via "test fixtures". Interactive test runs are not
+ supported.
+
+=== Meson
+
+- Platform: not as extensive as GNU Make or autoconf, but all major platforms
+ and some smaller ones are supported.
+ - AIX
+ - Cygwin
+ - DragonflyBSD
+ - FreeBSD
+ - Haiku
+ - Linux
+ - NetBSD
+ - OpenBSD
+ - Solaris
+ - Windows
+ - macOS
+- Ease of use: easy to use, discovering available options is easy. The
+ scripting language is straight-forward to use.
+- IDE support: Supports generating build instructions for Xcode and Microsoft
+ Visual Studio, a plugin exists for Visual Studio Code.
+- Out-of-tree builds: supported.
+- Cross-platform builds: supported.
+- Language support:
+ - C: Supported for GCC, Clang, MSVC and other toolchains.
+ - Rust: Supported for rustc.
+- Test integration: supported. Interactive tests are supported starting with
+ Meson 1.5.0 via the `--interactive` flag.
--
2.47.0.251.gb31fb630c0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH RFC v6 18/19] Introduce support for the Meson build system
2024-11-12 17:02 ` [PATCH RFC v6 " Patrick Steinhardt
` (16 preceding siblings ...)
2024-11-12 17:03 ` [PATCH RFC v6 17/19] Documentation: add comparison of build systems Patrick Steinhardt
@ 2024-11-12 17:03 ` Patrick Steinhardt
2024-11-13 6:47 ` Junio C Hamano
2024-11-13 16:30 ` Phillip Wood
2024-11-12 17:03 ` [PATCH RFC v6 19/19] meson: fix conflicts with in-flight topics Patrick Steinhardt
` (2 subsequent siblings)
20 siblings, 2 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-12 17:03 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King
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>
---
Documentation/meson.build | 317 +++++++
bin-wrappers/meson.build | 28 +
contrib/completion/meson.build | 8 +
contrib/meson.build | 1 +
gitweb/meson.build | 63 ++
meson.build | 1775 ++++++++++++++++++++++++++++++++++++
meson_options.txt | 73 ++
perl/FromCPAN/Mail/meson.build | 7 +
perl/FromCPAN/meson.build | 9 +
perl/Git/LoadCPAN/Mail/meson.build | 7 +
perl/Git/LoadCPAN/meson.build | 9 +
perl/Git/SVN/Memoize/meson.build | 7 +
perl/Git/SVN/meson.build | 20 +
perl/Git/meson.build | 18 +
perl/meson.build | 12 +
po/meson.build | 27 +
subprojects/.gitignore | 1 +
subprojects/curl.wrap | 13 +
subprojects/expat.wrap | 13 +
subprojects/openssl.wrap | 15 +
subprojects/pcre2.wrap | 16 +
subprojects/zlib.wrap | 13 +
t/helper/meson.build | 91 ++
t/meson.build | 1106 ++++++++++++++++++++++
templates/hooks/meson.build | 24 +
templates/info/meson.build | 5 +
templates/meson.build | 13 +
27 files changed, 3691 insertions(+)
diff --git a/Documentation/meson.build b/Documentation/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..15ba5004ad43188fc9ff9b85148278b20c03bf6f
--- /dev/null
+++ b/Documentation/meson.build
@@ -0,0 +1,317 @@
+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')
+
+git_revdate = ''
+if git.found()
+ git_revdate = run_command(git, 'show', '--quiet', '--pretty=%as', check: false).stdout().strip()
+endif
+
+asciidoc_common_options = [
+ asciidoc,
+ '--conf-file=' + meson.current_source_dir() / 'asciidoc.conf',
+ '--attribute=manual=Git Manual',
+ '--attribute=mansource=Git ' + git_version,
+ '--attribute=revdate=' + git_revdate,
+ '--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 = [ ]
+
+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
diff --git a/bin-wrappers/meson.build b/bin-wrappers/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..6d03a19d7b8e3cf78ac0499b6cedf47e0c6cb441
--- /dev/null
+++ b/bin-wrappers/meson.build
@@ -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', fs.relative_to(executable.full_path(), meson.project_build_root()))
+
+ configure_file(
+ input: 'wrap-for-bin.sh',
+ output: fs.stem(executable.full_path()),
+ configuration: executable_config,
+ )
+endforeach
diff --git a/contrib/completion/meson.build b/contrib/completion/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..a9bfe2da312ac9764367b656bd8a4099b575ad72
--- /dev/null
+++ b/contrib/completion/meson.build
@@ -0,0 +1,8 @@
+foreach script : [
+ 'git-completion.bash',
+ 'git-completion.tcsh',
+ 'git-completion.zsh',
+ 'git-prompt.sh'
+]
+ test_dependencies += fs.copyfile(script)
+endforeach
diff --git a/contrib/meson.build b/contrib/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..a7b77b87c22c8f1d8a86faaafc2b647b94651db8
--- /dev/null
+++ b/contrib/meson.build
@@ -0,0 +1 @@
+subdir('completion')
diff --git a/gitweb/meson.build b/gitweb/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..43c28cea4539ca10d1d020724dec8e7fa3c04de9
--- /dev/null
+++ b/gitweb/meson.build
@@ -0,0 +1,63 @@
+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_VERSION', git_version)
+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.sh',
+ meson.current_build_dir() / 'GITWEB-BUILD-OPTIONS',
+ '@INPUT@',
+ '@OUTPUT@',
+ ],
+ install: true,
+ install_dir: get_option('datadir') / 'gitweb',
+)
+
+foreach asset : [
+ 'static/git-favicon.png',
+ 'static/git-logo.png',
+ 'static/gitweb.css',
+ 'static/js/adjust-timezone.js',
+ 'static/js/blame_incremental.js',
+ 'static/js/javascript-detection.js',
+ 'static/js/lib/common-lib.js',
+ 'static/js/lib/cookies.js',
+ 'static/js/lib/datetime.js',
+]
+ fs.copyfile(asset,
+ install: true,
+ install_dir: get_option('datadir') / 'gitweb' / fs.parent(asset),
+ )
+endforeach
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..58f131bdb0e388697ca1b3455945239ad6343af2
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,1775 @@
+# Meson build system
+# ==================
+#
+# The Meson build system is an alternative to our Makefile that you can use to
+# build, test and install Git. Using Meson results in a couple of benefits:
+#
+# - Out-of-tree builds.
+# - Better integration into IDEs.
+# - Easy-to-use autoconfiguration of available features on your system.
+#
+# To use Meson from the command line you need to have both Meson and Ninja
+# installed. Alternatively, if you do not have Python available on your system,
+# you can also use Muon instead of Meson and Samurai instead of Ninja, both of
+# which are drop-ins replacement that only depend on C.
+#
+# Basic usage
+# ===========
+#
+# In the most trivial case, you can configure, build and install Git like this:
+#
+# 1. Set up the build directory. This only needs to happen once per build
+# directory you want to have. You can also configure multiple different
+# build directories with different configurations.
+#
+# $ meson setup build/
+#
+# The build directory gets ignored by Git automatically as Meson will write
+# a ".gitignore" file into it. From hereon, we will assume that you execute
+# commands inside this build directory.
+#
+# 2. Compile Git. You can either use Meson, Ninja or Samurai to do this, so all
+# of the following invocations are equivalent:
+#
+# $ meson compile
+# $ ninja
+# $ samu
+#
+# The different invocations should ultimately not make much of a difference.
+# Using Meson also works with other generators though, like when the build
+# directory has been set up for use with Microsoft Visual Studio.
+#
+# 3. Execute tests. Again, you can either use Meson, Ninja or Samurai to do this:
+#
+# $ meson test
+# $ ninja test
+# $ samu test
+#
+# It is recommended to use Meson in this case though as it also provides you
+# additional features that the other build systems don't have available.
+# You can e.g. pass additional arguments to the test executables or run
+# individual tests:
+#
+# # Execute the t0000-basic integration test and t-reftable-stack unit test.
+# $ meson test t0000-basic t-reftable-stack
+#
+# # Execute all reftable unit tests.
+# $ meson test t-reftable-*
+#
+# # Execute all tests and stop with the first failure.
+# $ meson test --maxfail 1
+#
+# # Execute single test interactively such that features like `debug ()` work.
+# $ meson test -i --test-args='-ix' t1400-update-ref
+#
+# 4. Install the Git distribution. Again, this can be done via Meson, Ninja or
+# Samurai:
+#
+# $ meson install
+# $ ninja install
+# $ samu install
+#
+# The prefix into which Git shall be installed is defined when setting up
+# the build directory. More on that in the "Configuration" section.
+#
+# Meson supports multiple backends. The default backend generates Ninja build
+# instructions, but it also supports the generation of Microsoft Visual
+# Studio solutions as well as Xcode projects. IDEs like Eclipse and Visual
+# Studio Code provide plugins to import Meson files directly.
+#
+# Configuration
+# =============
+#
+# The exact configuration of Git is determined when setting up the Git
+# directory. Unless told otherwise, Meson will automatically detect the
+# availability of various bits and pieces. There are two different kinds of
+# options that can be used to further tweak the build:
+#
+# - Built-in options provided by Meson.
+#
+# - Options defined by the project in the "meson_options.txt" file.
+#
+# Both kinds of options can be inspected by running `meson configure` in the
+# build directory, which will give you a list of the current value for all
+# options.
+#
+# Options can be configured either when setting up the build directory or can
+# be changed in preexisting build directories:
+#
+# # Set up a build directory with optimized settings that will be
+# # installed into an alternative prefix.
+# $ meson setup --buildtype release --optimization 3 --strip --prefix=/home/$USER
+#
+# # Set up a build directory with 'address' and 'undefined' sanitizers
+# # using Clang.
+# $ CC=clang meson setup -Db_sanitize=address,undefined
+#
+# # Disable tests in a preexisting build directory.
+# $ meson configure -Dtests=false
+#
+# # Disable features based on Python
+# $ meson configure -Dpython=disabled
+#
+# # Disable features based on Python
+# $ meson configure -Dpython=disabled
+#
+# Options have a type like booleans, choices, strings or features. Features are
+# somewhat special as they can have one of three values: enabled, disabled or
+# auto. While the first two values are self-explanatory, "auto" will enable or
+# disable the feature based on the availability of prerequisites to support it.
+# Python-based features for example will be enabled automatically when a Python
+# interpreter could be found. The default value of such features can be changed
+# globally via `meson setup --auto-features={enabled,disabled,auto}`, which
+# will set the value of all features with a value of "auto" to the provided one
+# by default.
+#
+# It is also possible to store a set of configuration options in machine files.
+# This can be useful in case you regularly want to reuse the same set of options:
+#
+# [binaries]
+# c = ['clang']
+# ar = ['ar']
+#
+# [project options]
+# gettext = 'disabled'
+# default_editor = 'vim'
+#
+# [built-in options]
+# b_lto = true
+# b_sanitize = 'address,undefined'
+#
+# These machine files can be passed to Meson via `meson setup --native-file`.
+#
+# Subproject wrappers
+# ===================
+#
+# Subproject wrappers are a feature provided by Meson that allow the automatic
+# fallback to a "wrapped" dependency in case the dependency is not provided by
+# the system. For example if the system is lacking curl, then Meson will use
+# "subprojects/curl.wrap" to set up curl as a subproject and compile and link
+# the dependency into Git itself. This is especially helpful on systems like
+# Windows, where you typically don't have such dependencies installed.
+#
+# The use of subproject wrappers can be disabled by executing `meson setup
+# --wrap-mode nofallback`.
+
+project('git', 'c',
+ meson_version: '>=1.3.0',
+ # MSVC does not support GNU99, and C99 does not define __STDC_VERSION__
+ # on MSVC. So we instead fall back to C11 there.
+ default_options: ['c_std=gnu99,c11'],
+ version: 'v2.47.GIT',
+)
+
+fs = import('fs')
+
+program_path = []
+# Git for Windows provides all the tools we need to build Git.
+if host_machine.system() == 'windows'
+ program_path += [ 'C:/Program Files/Git/bin', 'C:/Program Files/Git/usr/bin' ]
+endif
+
+awk = find_program('awk', dirs: program_path)
+cygpath = find_program('cygpath', dirs: program_path, required: false)
+diff = find_program('diff', dirs: program_path)
+shell = find_program('sh', dirs: program_path)
+tar = find_program('tar', dirs: program_path)
+
+script_environment = environment()
+foreach tool : ['cat', 'cut', 'git', 'grep', 'sed', 'sort', 'tr', 'uname']
+ program = find_program(tool, dirs: program_path)
+ script_environment.prepend('PATH', fs.parent(program.full_path()))
+endforeach
+
+git_version = run_command(shell, 'GIT-VERSION-GEN', check: false, env: script_environment).stdout().strip()
+if git_version == ''
+ git_version = meson.project_version()
+endif
+
+compiler = meson.get_compiler('c')
+
+libgit_sources = [
+ 'abspath.c',
+ 'add-interactive.c',
+ 'add-patch.c',
+ 'advice.c',
+ 'alias.c',
+ 'alloc.c',
+ 'apply.c',
+ 'archive-tar.c',
+ 'archive-zip.c',
+ 'archive.c',
+ 'attr.c',
+ 'base85.c',
+ 'bisect.c',
+ 'blame.c',
+ 'blob.c',
+ 'bloom.c',
+ 'branch.c',
+ 'bulk-checkin.c',
+ 'bundle-uri.c',
+ 'bundle.c',
+ 'cache-tree.c',
+ 'cbtree.c',
+ 'chdir-notify.c',
+ 'checkout.c',
+ 'chunk-format.c',
+ 'color.c',
+ 'column.c',
+ 'combine-diff.c',
+ 'commit-graph.c',
+ 'commit-reach.c',
+ 'commit.c',
+ 'compat/nonblock.c',
+ 'compat/obstack.c',
+ 'compat/terminal.c',
+ 'compat/zlib-uncompress2.c',
+ 'config.c',
+ 'connect.c',
+ 'connected.c',
+ 'convert.c',
+ 'copy.c',
+ 'credential.c',
+ 'csum-file.c',
+ 'ctype.c',
+ 'date.c',
+ 'decorate.c',
+ 'delta-islands.c',
+ 'diagnose.c',
+ 'diff-delta.c',
+ 'diff-merges.c',
+ 'diff-lib.c',
+ 'diff-no-index.c',
+ 'diff.c',
+ 'diffcore-break.c',
+ 'diffcore-delta.c',
+ 'diffcore-order.c',
+ 'diffcore-pickaxe.c',
+ 'diffcore-rename.c',
+ 'diffcore-rotate.c',
+ 'dir-iterator.c',
+ 'dir.c',
+ 'editor.c',
+ 'entry.c',
+ 'environment.c',
+ 'ewah/bitmap.c',
+ 'ewah/ewah_bitmap.c',
+ 'ewah/ewah_io.c',
+ 'ewah/ewah_rlw.c',
+ 'exec-cmd.c',
+ 'fetch-negotiator.c',
+ 'fetch-pack.c',
+ 'fmt-merge-msg.c',
+ 'fsck.c',
+ 'fsmonitor.c',
+ 'fsmonitor-ipc.c',
+ 'fsmonitor-settings.c',
+ 'gettext.c',
+ 'git-zlib.c',
+ 'gpg-interface.c',
+ 'graph.c',
+ 'grep.c',
+ 'hash-lookup.c',
+ 'hashmap.c',
+ 'help.c',
+ 'hex.c',
+ 'hex-ll.c',
+ 'hook.c',
+ 'ident.c',
+ 'json-writer.c',
+ 'kwset.c',
+ 'levenshtein.c',
+ 'line-log.c',
+ 'line-range.c',
+ 'linear-assignment.c',
+ 'list-objects-filter-options.c',
+ 'list-objects-filter.c',
+ 'list-objects.c',
+ 'lockfile.c',
+ 'log-tree.c',
+ 'loose.c',
+ 'ls-refs.c',
+ 'mailinfo.c',
+ 'mailmap.c',
+ 'match-trees.c',
+ 'mem-pool.c',
+ 'merge-blobs.c',
+ 'merge-ll.c',
+ 'merge-ort.c',
+ 'merge-ort-wrappers.c',
+ 'merge-recursive.c',
+ 'merge.c',
+ 'midx.c',
+ 'midx-write.c',
+ 'name-hash.c',
+ 'negotiator/default.c',
+ 'negotiator/noop.c',
+ 'negotiator/skipping.c',
+ 'notes-cache.c',
+ 'notes-merge.c',
+ 'notes-utils.c',
+ 'notes.c',
+ 'object-file-convert.c',
+ 'object-file.c',
+ 'object-name.c',
+ 'object.c',
+ 'oid-array.c',
+ 'oidmap.c',
+ 'oidset.c',
+ 'oidtree.c',
+ 'pack-bitmap-write.c',
+ 'pack-bitmap.c',
+ 'pack-check.c',
+ 'pack-mtimes.c',
+ 'pack-objects.c',
+ 'pack-revindex.c',
+ 'pack-write.c',
+ 'packfile.c',
+ 'pager.c',
+ 'parallel-checkout.c',
+ 'parse.c',
+ 'parse-options-cb.c',
+ 'parse-options.c',
+ 'patch-delta.c',
+ 'patch-ids.c',
+ 'path.c',
+ 'pathspec.c',
+ 'pkt-line.c',
+ 'preload-index.c',
+ 'pretty.c',
+ 'prio-queue.c',
+ 'progress.c',
+ 'promisor-remote.c',
+ 'prompt.c',
+ 'protocol.c',
+ 'protocol-caps.c',
+ 'prune-packed.c',
+ 'pseudo-merge.c',
+ 'quote.c',
+ 'range-diff.c',
+ 'reachable.c',
+ 'read-cache.c',
+ 'rebase-interactive.c',
+ 'rebase.c',
+ 'ref-filter.c',
+ 'reflog-walk.c',
+ 'reflog.c',
+ 'refs.c',
+ 'refs/debug.c',
+ 'refs/files-backend.c',
+ 'refs/reftable-backend.c',
+ 'refs/iterator.c',
+ 'refs/packed-backend.c',
+ 'refs/ref-cache.c',
+ 'refspec.c',
+ 'reftable/basics.c',
+ 'reftable/error.c',
+ 'reftable/block.c',
+ 'reftable/blocksource.c',
+ 'reftable/iter.c',
+ 'reftable/merged.c',
+ 'reftable/pq.c',
+ 'reftable/reader.c',
+ 'reftable/record.c',
+ 'reftable/stack.c',
+ 'reftable/tree.c',
+ 'reftable/writer.c',
+ 'remote.c',
+ 'replace-object.c',
+ 'repo-settings.c',
+ 'repository.c',
+ 'rerere.c',
+ 'reset.c',
+ 'resolve-undo.c',
+ 'revision.c',
+ 'run-command.c',
+ 'send-pack.c',
+ 'sequencer.c',
+ 'serve.c',
+ 'server-info.c',
+ 'setup.c',
+ 'shallow.c',
+ 'sideband.c',
+ 'sigchain.c',
+ 'sparse-index.c',
+ 'split-index.c',
+ 'stable-qsort.c',
+ 'statinfo.c',
+ 'strbuf.c',
+ 'streaming.c',
+ 'string-list.c',
+ 'strmap.c',
+ 'strvec.c',
+ 'sub-process.c',
+ 'submodule-config.c',
+ 'submodule.c',
+ 'symlinks.c',
+ 'tag.c',
+ 'tempfile.c',
+ 'thread-utils.c',
+ 'tmp-objdir.c',
+ 'trace.c',
+ 'trace2.c',
+ 'trace2/tr2_cfg.c',
+ 'trace2/tr2_cmd_name.c',
+ 'trace2/tr2_ctr.c',
+ 'trace2/tr2_dst.c',
+ 'trace2/tr2_sid.c',
+ 'trace2/tr2_sysenv.c',
+ 'trace2/tr2_tbuf.c',
+ 'trace2/tr2_tgt_event.c',
+ 'trace2/tr2_tgt_normal.c',
+ 'trace2/tr2_tgt_perf.c',
+ 'trace2/tr2_tls.c',
+ 'trace2/tr2_tmr.c',
+ 'trailer.c',
+ 'transport-helper.c',
+ 'transport.c',
+ 'tree-diff.c',
+ 'tree-walk.c',
+ 'tree.c',
+ 'unpack-trees.c',
+ 'upload-pack.c',
+ 'url.c',
+ 'urlmatch.c',
+ 'usage.c',
+ 'userdiff.c',
+ 'utf8.c',
+ 'varint.c',
+ 'versioncmp.c',
+ 'walker.c',
+ 'wildmatch.c',
+ 'worktree.c',
+ 'wrapper.c',
+ 'write-or-die.c',
+ 'ws.c',
+ 'wt-status.c',
+ 'xdiff-interface.c',
+ 'xdiff/xdiffi.c',
+ 'xdiff/xemit.c',
+ 'xdiff/xhistogram.c',
+ 'xdiff/xmerge.c',
+ 'xdiff/xpatience.c',
+ 'xdiff/xprepare.c',
+ 'xdiff/xutils.c',
+]
+
+builtin_sources = [
+ 'builtin/add.c',
+ 'builtin/am.c',
+ 'builtin/annotate.c',
+ 'builtin/apply.c',
+ 'builtin/archive.c',
+ 'builtin/bisect.c',
+ 'builtin/blame.c',
+ 'builtin/branch.c',
+ 'builtin/bugreport.c',
+ 'builtin/bundle.c',
+ 'builtin/cat-file.c',
+ 'builtin/check-attr.c',
+ 'builtin/check-ignore.c',
+ 'builtin/check-mailmap.c',
+ 'builtin/check-ref-format.c',
+ 'builtin/checkout--worker.c',
+ 'builtin/checkout-index.c',
+ 'builtin/checkout.c',
+ 'builtin/clean.c',
+ 'builtin/clone.c',
+ 'builtin/column.c',
+ 'builtin/commit-graph.c',
+ 'builtin/commit-tree.c',
+ 'builtin/commit.c',
+ 'builtin/config.c',
+ 'builtin/count-objects.c',
+ 'builtin/credential-cache--daemon.c',
+ 'builtin/credential-cache.c',
+ 'builtin/credential-store.c',
+ 'builtin/credential.c',
+ 'builtin/describe.c',
+ 'builtin/diagnose.c',
+ 'builtin/diff-files.c',
+ 'builtin/diff-index.c',
+ 'builtin/diff-tree.c',
+ 'builtin/diff.c',
+ 'builtin/difftool.c',
+ 'builtin/fast-export.c',
+ 'builtin/fast-import.c',
+ 'builtin/fetch-pack.c',
+ 'builtin/fetch.c',
+ 'builtin/fmt-merge-msg.c',
+ 'builtin/for-each-ref.c',
+ 'builtin/for-each-repo.c',
+ 'builtin/fsck.c',
+ 'builtin/fsmonitor--daemon.c',
+ 'builtin/gc.c',
+ 'builtin/get-tar-commit-id.c',
+ 'builtin/grep.c',
+ 'builtin/hash-object.c',
+ 'builtin/help.c',
+ 'builtin/hook.c',
+ 'builtin/index-pack.c',
+ 'builtin/init-db.c',
+ 'builtin/interpret-trailers.c',
+ 'builtin/log.c',
+ 'builtin/ls-files.c',
+ 'builtin/ls-remote.c',
+ 'builtin/ls-tree.c',
+ 'builtin/mailinfo.c',
+ 'builtin/mailsplit.c',
+ 'builtin/merge-base.c',
+ 'builtin/merge-file.c',
+ 'builtin/merge-index.c',
+ 'builtin/merge-ours.c',
+ 'builtin/merge-recursive.c',
+ 'builtin/merge-tree.c',
+ 'builtin/merge.c',
+ 'builtin/mktag.c',
+ 'builtin/mktree.c',
+ 'builtin/multi-pack-index.c',
+ 'builtin/mv.c',
+ 'builtin/name-rev.c',
+ 'builtin/notes.c',
+ 'builtin/pack-objects.c',
+ 'builtin/pack-redundant.c',
+ 'builtin/pack-refs.c',
+ 'builtin/patch-id.c',
+ 'builtin/prune-packed.c',
+ 'builtin/prune.c',
+ 'builtin/pull.c',
+ 'builtin/push.c',
+ 'builtin/range-diff.c',
+ 'builtin/read-tree.c',
+ 'builtin/rebase.c',
+ 'builtin/receive-pack.c',
+ 'builtin/reflog.c',
+ 'builtin/refs.c',
+ 'builtin/remote-ext.c',
+ 'builtin/remote-fd.c',
+ 'builtin/remote.c',
+ 'builtin/repack.c',
+ 'builtin/replace.c',
+ 'builtin/replay.c',
+ 'builtin/rerere.c',
+ 'builtin/reset.c',
+ 'builtin/rev-list.c',
+ 'builtin/rev-parse.c',
+ 'builtin/revert.c',
+ 'builtin/rm.c',
+ 'builtin/send-pack.c',
+ 'builtin/shortlog.c',
+ 'builtin/show-branch.c',
+ 'builtin/show-index.c',
+ 'builtin/show-ref.c',
+ 'builtin/sparse-checkout.c',
+ 'builtin/stash.c',
+ 'builtin/stripspace.c',
+ 'builtin/submodule--helper.c',
+ 'builtin/symbolic-ref.c',
+ 'builtin/tag.c',
+ 'builtin/unpack-file.c',
+ 'builtin/unpack-objects.c',
+ 'builtin/update-index.c',
+ 'builtin/update-ref.c',
+ 'builtin/update-server-info.c',
+ 'builtin/upload-archive.c',
+ 'builtin/upload-pack.c',
+ 'builtin/var.c',
+ 'builtin/verify-commit.c',
+ 'builtin/verify-pack.c',
+ 'builtin/verify-tag.c',
+ 'builtin/worktree.c',
+ 'builtin/write-tree.c',
+]
+
+libgit_sources += custom_target(
+ input: 'command-list.txt',
+ output: 'command-list.h',
+ command: [shell, meson.current_source_dir() + '/generate-cmdlist.sh', meson.current_source_dir(), '@OUTPUT@'],
+ env: script_environment,
+)
+
+libgit_sources += custom_target(
+ output: 'config-list.h',
+ command: [
+ shell,
+ meson.current_source_dir() + '/generate-configlist.sh',
+ meson.current_source_dir(),
+ '@OUTPUT@',
+ ],
+ env: script_environment,
+)
+
+libgit_sources += custom_target(
+ input: 'Documentation/githooks.txt',
+ output: 'hook-list.h',
+ command: [
+ shell,
+ meson.current_source_dir() + '/generate-hooklist.sh',
+ meson.current_source_dir(),
+ '@OUTPUT@',
+ ],
+ env: script_environment,
+)
+
+# This contains the variables for GIT-BUILD-OPTIONS, which we use to propagate
+# build options to our tests.
+build_options_config = configuration_data()
+build_options_config.set('GIT_INTEROP_MAKE_OPTS', '')
+build_options_config.set('GIT_PERF_LARGE_REPO', '')
+build_options_config.set('GIT_PERF_MAKE_COMMAND', '')
+build_options_config.set('GIT_PERF_MAKE_OPTS', '')
+build_options_config.set('GIT_PERF_REPEAT_COUNT', '')
+build_options_config.set('GIT_PERF_REPO', '')
+build_options_config.set('GIT_TEST_CMP_USE_COPIED_CONTEXT', '')
+build_options_config.set('GIT_TEST_INDEX_VERSION', '')
+build_options_config.set('GIT_TEST_OPTS', '')
+build_options_config.set('GIT_TEST_PERL_FATAL_WARNINGS', '')
+build_options_config.set('GIT_TEST_UTF8_LOCALE', '')
+build_options_config.set('SANITIZE_ADDRESS', '')
+build_options_config.set('SANITIZE_LEAK', '')
+build_options_config.set('BROKEN_PATH_FIX', '')
+build_options_config.set_quoted('LOCALEDIR', fs.as_posix(get_option('prefix') / get_option('localedir')))
+build_options_config.set('GITWEBDIR', fs.as_posix(get_option('prefix') / get_option('datadir') / 'gitweb'))
+
+test_output_directory = get_option('test_output_directory')
+if test_output_directory == ''
+ test_output_directory = meson.project_build_root() / 'test-output'
+endif
+
+# These variables are used for building libgit.a.
+libgit_c_args = [
+ '-DBINDIR="' + get_option('bindir') + '"',
+ '-DDEFAULT_EDITOR="' + get_option('default_editor') + '"',
+ '-DDEFAULT_GIT_TEMPLATE_DIR="' + get_option('datadir') / 'git-core/templates' + '"',
+ '-DDEFAULT_HELP_FORMAT="' + get_option('default_help_format') + '"',
+ '-DDEFAULT_PAGER="' + get_option('default_pager') + '"',
+ '-DETC_GITATTRIBUTES="' + get_option('gitattributes') + '"',
+ '-DETC_GITCONFIG="' + get_option('gitconfig') + '"',
+ '-DFALLBACK_RUNTIME_PREFIX="' + get_option('prefix') + '"',
+ '-DGIT_EXEC_PATH="' + get_option('prefix') / get_option('libexecdir') / 'git-core"',
+ '-DGIT_HOST_CPU="' + host_machine.cpu_family() + '"',
+ '-DGIT_HTML_PATH="' + get_option('datadir') / 'doc/git-doc"',
+ '-DGIT_INFO_PATH="' + get_option('infodir') + '"',
+ '-DGIT_LOCALE_PATH="' + get_option('localedir') + '"',
+ '-DGIT_MAN_PATH="' + get_option('mandir') + '"',
+ '-DPAGER_ENV="' + get_option('pager_environment') + '"',
+ '-DSHELL_PATH="' + fs.as_posix(shell.full_path()) + '"',
+]
+libgit_include_directories = [ '.' ]
+libgit_dependencies = [ ]
+
+executable_suffix = ''
+if host_machine.system() == 'cygwin' or host_machine.system() == 'windows'
+ executable_suffix = '.exe'
+ libgit_c_args += '-DSTRIP_EXTENSION="' + executable_suffix + '"'
+endif
+build_options_config.set_quoted('X', executable_suffix)
+
+python = import('python').find_installation('python3', required: get_option('python'))
+if python.found()
+ build_options_config.set('NO_PYTHON', '')
+else
+ libgit_c_args += '-DNO_PYTHON'
+ build_options_config.set('NO_PYTHON', '1')
+endif
+
+# Perl is used for two different things: our test harness and to provide some
+# features. It is optional if you want to neither execute tests nor use any of
+# these optional features.
+perl_required = get_option('perl')
+if get_option('tests')
+ perl_required = true
+endif
+
+# Note that we only set NO_PERL if the Perl features were disabled by the user.
+# It may not be set when we have found Perl, but only use it to run tests.
+perl = find_program('perl', version: '>=5.8.1', dirs: program_path, required: perl_required)
+perl_features_enabled = perl.found() and get_option('perl').allowed()
+if perl_features_enabled
+ build_options_config.set('NO_PERL', '')
+
+ if get_option('runtime_prefix')
+ build_options_config.set('PERL_LOCALEDIR', '')
+ else
+ build_options_config.set_quoted('PERL_LOCALEDIR', fs.as_posix(get_option('prefix') / get_option('localedir')))
+ endif
+
+ if get_option('perl_cpan_fallback')
+ build_options_config.set('NO_PERL_CPAN_FALLBACKS', '')
+ else
+ build_options_config.set_quoted('NO_PERL_CPAN_FALLBACKS', 'YesPlease')
+ endif
+else
+ libgit_c_args += '-DNO_PERL'
+ build_options_config.set('NO_PERL', '1')
+ build_options_config.set('PERL_LOCALEDIR', '')
+ build_options_config.set('NO_PERL_CPAN_FALLBACKS', '')
+endif
+
+zlib = dependency('zlib', default_options: ['default_library=static', 'tests=disabled'])
+if zlib.version().version_compare('<1.2.0')
+ libgit_c_args += '-DNO_DEFLATE_BOUND'
+endif
+libgit_dependencies += zlib
+
+threads = dependency('threads', required: false)
+if threads.found()
+ libgit_dependencies += threads
+ build_options_config.set('NO_PTHREADS', '')
+else
+ libgit_c_args += '-DNO_PTHREADS'
+ build_options_config.set('NO_PTHREADS', '1')
+endif
+
+msgfmt = find_program('msgfmt', dirs: program_path, required: false)
+gettext_option = get_option('gettext').disable_auto_if(not msgfmt.found())
+if not msgfmt.found() and gettext_option.enabled()
+ error('Internationalization via libintl requires msgfmt')
+endif
+
+if gettext_option.allowed() and host_machine.system() == 'darwin' and get_option('macos_use_homebrew_gettext')
+ if host_machine.cpu_family() == 'x86_64'
+ libintl_prefix = '/usr/local'
+ elif host_machine.cpu_family() == 'aarch64'
+ libintl_prefix = '/opt/homebrew'
+ else
+ error('Homebrew workaround not supported on current architecture')
+ endif
+
+ intl = compiler.find_library('intl', dirs: libintl_prefix / 'lib', required: gettext_option)
+ if intl.found()
+ intl = declare_dependency(
+ dependencies: intl,
+ include_directories: libintl_prefix / 'include',
+ )
+ endif
+else
+ intl = dependency('intl', required: gettext_option)
+endif
+if intl.found()
+ libgit_dependencies += intl
+ build_options_config.set('NO_GETTEXT', '')
+ build_options_config.set('USE_GETTEXT_SCHEME', '')
+else
+ libgit_c_args += '-DNO_GETTEXT'
+ build_options_config.set('NO_GETTEXT', '1')
+ build_options_config.set('USE_GETTEXT_SCHEME', 'fallthrough')
+endif
+
+iconv = dependency('iconv', required: get_option('iconv'))
+if iconv.found()
+ libgit_dependencies += iconv
+ build_options_config.set('NO_ICONV', '')
+
+ have_old_iconv = false
+ if not compiler.compiles('''
+ #include <iconv.h>
+
+ extern size_t iconv(iconv_t cd,
+ char **inbuf, size_t *inbytesleft,
+ char **outbuf, size_t *outbytesleft);
+ ''', name: 'old iconv interface', dependencies: [iconv])
+ libgit_c_args += '-DOLD_ICONV'
+ have_old_iconv = true
+ endif
+
+ iconv_omits_bom_source = '''#
+ #include <iconv.h>
+
+ int main(int argc, const char **argv)
+ {
+ '''
+ if have_old_iconv
+ iconv_omits_bom_source += '''
+ typedef const char *iconv_ibp;
+ '''
+ else
+ iconv_omits_bom_source += '''
+ typedef char *iconv_ibp;
+ '''
+ endif
+ iconv_omits_bom_source += '''
+ int v;
+ iconv_t conv;
+ char in[] = "a"; iconv_ibp pin = in;
+ char out[20] = ""; char *pout = out;
+ size_t isz = sizeof in;
+ size_t osz = sizeof out;
+
+ conv = iconv_open("UTF-16", "UTF-8");
+ iconv(conv, &pin, &isz, &pout, &osz);
+ iconv_close(conv);
+ v = (unsigned char)(out[0]) + (unsigned char)(out[1]);
+ return v != 0xfe + 0xff;
+ }
+ '''
+
+ if compiler.run(iconv_omits_bom_source,
+ dependencies: iconv,
+ name: 'iconv omits BOM',
+ ).returncode() != 0
+ libgit_c_args += '-DICONV_OMITS_BOM'
+ endif
+else
+ libgit_c_args += '-DNO_ICONV'
+ build_options_config.set('NO_ICONV', '1')
+endif
+
+pcre2 = dependency('libpcre2-8', required: get_option('pcre2'), default_options: ['default_library=static', 'test=false'])
+if pcre2.found()
+ libgit_dependencies += pcre2
+ libgit_c_args += '-DUSE_LIBPCRE2'
+ build_options_config.set('USE_LIBPCRE2', '1')
+else
+ build_options_config.set('USE_LIBPCRE2', '')
+endif
+
+curl = dependency('libcurl', version: '>=7.21.3', required: get_option('curl'), default_options: ['default_library=static', 'tests=disabled'])
+use_curl_for_imap_send = false
+if curl.found()
+ if curl.version().version_compare('>=7.34.0')
+ libgit_c_args += '-DUSE_CURL_FOR_IMAP_SEND'
+ use_curl_for_imap_send = true
+ endif
+
+ libgit_dependencies += curl
+ libgit_c_args += '-DCURL_DISABLE_TYPECHECK'
+ build_options_config.set('NO_CURL', '')
+else
+ libgit_c_args += '-DNO_CURL'
+ build_options_config.set('NO_CURL', '1')
+endif
+
+expat = dependency('expat', required: get_option('expat'), default_options: ['default_library=static', 'build_tests=false'])
+if expat.found()
+ libgit_dependencies += expat
+
+ if expat.version().version_compare('<=1.2')
+ libgit_c_args += '-DEXPAT_NEEDS_XMLPARSE_H'
+ endif
+ build_options_config.set('NO_EXPAT', '')
+else
+ libgit_c_args += '-DNO_EXPAT'
+ build_options_config.set('NO_EXPAT', '1')
+endif
+
+if not compiler.has_header('sys/select.h')
+ libgit_c_args += '-DNO_SYS_SELECT_H'
+endif
+
+has_poll_h = compiler.has_header('poll.h')
+if not has_poll_h
+ libgit_c_args += '-DNO_POLL_H'
+endif
+
+has_sys_poll_h = compiler.has_header('sys/poll.h')
+if not has_sys_poll_h
+ libgit_c_args += '-DNO_SYS_POLL_H'
+endif
+
+if not has_poll_h and not has_sys_poll_h
+ libgit_c_args += '-DNO_POLL'
+ libgit_sources += 'compat/poll/poll.c'
+ libgit_include_directories += 'compat/poll'
+endif
+
+if not compiler.has_header('inttypes.h')
+ libgit_c_args += '-DNO_INTTYPES_H'
+endif
+
+if compiler.has_header('libcharset.h')
+ libcharset = compiler.find_library('charset')
+
+ if compiler.has_function('locale_charset',
+ prefix: '#include <libcharset.h>',
+ dependencies: iconv,
+ )
+ libgit_c_args += '-DHAVE_LIBCHARSET_H'
+ elif compiler.has_function('locale_charset',
+ prefix: '#include <libcharset.h>',
+ dependencies: libcharset,
+ )
+ libgit_c_args += '-DHAVE_LIBCHARSET_H'
+ endif
+endif
+
+if compiler.has_header('alloca.h')
+ libgit_c_args += '-DHAVE_ALLOCA_H'
+endif
+
+if compiler.has_header('sys/sysinfo.h')
+ libgit_c_args += '-DHAVE_SYSINFO'
+endif
+
+# Windows has libgen.h and a basename implementation, but we still need our own
+# implementation to threat things like drive prefixes specially.
+if host_machine.system() == 'windows' or not compiler.has_header('libgen.h')
+ libgit_c_args += '-DNO_LIBGEN_H'
+ libgit_sources += 'compat/basename.c'
+endif
+
+if compiler.has_header('paths.h')
+ libgit_c_args += '-DHAVE_PATHS_H'
+endif
+
+if compiler.has_header('strings.h')
+ libgit_c_args += '-DHAVE_STRINGS_H'
+endif
+
+networking_dependencies = [ ]
+if host_machine.system() == 'windows'
+ winsock = compiler.find_library('ws2_32', required: false)
+ if winsock.found()
+ networking_dependencies += winsock
+ endif
+else
+ libresolv = compiler.find_library('resolv', required: false)
+ if libresolv.found()
+ networking_dependencies += libresolv
+ endif
+endif
+libgit_dependencies += networking_dependencies
+
+foreach symbol : ['inet_ntop', 'inet_pton', 'strerror']
+ if not compiler.has_function(symbol, dependencies: networking_dependencies)
+ libgit_c_args += '-DNO_' + symbol.to_upper()
+ endif
+endforeach
+
+has_ipv6 = compiler.has_function('getaddrinfo', dependencies: networking_dependencies)
+if not has_ipv6
+ libgit_c_args += '-DNO_IPV6'
+endif
+
+if not compiler.compiles('''
+ #ifdef _WIN32
+ # include <winsock2.h>
+ #else
+ # include <sys/types.h>
+ # include <sys/socket.h>
+ #endif
+
+ void func(void)
+ {
+ struct sockaddr_storage x;
+ }
+''', name: 'struct sockaddr_storage')
+ if has_ipv6
+ libgit_c_args += '-Dsockaddr_storage=sockaddr_in6'
+ else
+ libgit_c_args += '-Dsockaddr_storage=sockaddr_in'
+ endif
+endif
+
+if compiler.has_function('socket', dependencies: networking_dependencies)
+ libgit_sources += [
+ 'unix-socket.c',
+ 'unix-stream-server.c',
+ ]
+ build_options_config.set('NO_UNIX_SOCKETS', '')
+else
+ libgit_c_args += '-DNO_UNIX_SOCKETS'
+ build_options_config.set('NO_UNIX_SOCKETS', '1')
+endif
+
+if not compiler.has_function('pread')
+ libgit_c_args += '-DNO_PREAD'
+ libgit_sources += 'compat/pread.c'
+endif
+
+if host_machine.system() == 'darwin'
+ libgit_sources += 'compat/precompose_utf8.c'
+ libgit_c_args += '-DPRECOMPOSE_UNICODE'
+ libgit_c_args += '-DPROTECT_HFS_DEFAULT'
+endif
+
+# Configure general compatibility wrappers.
+if host_machine.system() == 'cygwin'
+ libgit_sources += [
+ 'compat/win32/path-utils.c',
+ ]
+elif host_machine.system() == 'windows'
+ libgit_sources += [
+ 'compat/mingw.c',
+ 'compat/winansi.c',
+ 'compat/win32/flush.c',
+ 'compat/win32/path-utils.c',
+ 'compat/win32/pthread.c',
+ 'compat/win32/syslog.c',
+ 'compat/win32/dirent.c',
+ 'compat/win32mmap.c',
+ 'compat/nedmalloc/nedmalloc.c',
+ ]
+
+ libgit_c_args += [
+ '-DDETECT_MSYS_TTY',
+ '-DENSURE_MSYSTEM_IS_SET',
+ '-DNATIVE_CRLF',
+ '-DNOGDI',
+ '-DNO_POSIX_GOODIES',
+ '-DWIN32',
+ '-D_CONSOLE',
+ '-D_CONSOLE_DETECT_MSYS_TTY',
+ '-D__USE_MINGW_ANSI_STDIO=0',
+ ]
+
+ libgit_dependencies += compiler.find_library('ntdll')
+ libgit_include_directories += 'compat/win32'
+ if compiler.get_id() == 'msvc'
+ libgit_include_directories += 'compat/vcbuild/include'
+ endif
+endif
+
+if host_machine.system() == 'linux'
+ libgit_sources += 'compat/linux/procinfo.c'
+elif host_machine.system() == 'windows'
+ libgit_sources += 'compat/win32/trace2_win32_process_info.c'
+else
+ libgit_sources += 'compat/stub/procinfo.c'
+endif
+
+if host_machine.system() == 'cygwin' or host_machine.system() == 'windows'
+ libgit_c_args += [
+ '-DUNRELIABLE_FSTAT',
+ '-DMMAP_PREVENTS_DELETE',
+ '-DOBJECT_CREATION_MODE=1',
+ ]
+endif
+
+# Configure the simple-ipc subsystem required fro the fsmonitor.
+if host_machine.system() == 'windows'
+ libgit_sources += [
+ 'compat/simple-ipc/ipc-shared.c',
+ 'compat/simple-ipc/ipc-win32.c',
+ ]
+ libgit_c_args += '-DSUPPORTS_SIMPLE_IPC'
+else
+ libgit_sources += [
+ 'compat/simple-ipc/ipc-shared.c',
+ 'compat/simple-ipc/ipc-unix-socket.c',
+ ]
+ libgit_c_args += '-DSUPPORTS_SIMPLE_IPC'
+endif
+
+fsmonitor_backend = ''
+if host_machine.system() == 'windows'
+ fsmonitor_backend = 'win32'
+elif host_machine.system() == 'darwin'
+ fsmonitor_backend = 'darwin'
+ libgit_dependencies += dependency('CoreServices')
+endif
+if fsmonitor_backend != ''
+ libgit_c_args += '-DHAVE_FSMONITOR_DAEMON_BACKEND'
+ libgit_c_args += '-DHAVE_FSMONITOR_OS_SETTINGS'
+
+ libgit_sources += [
+ 'compat/fsmonitor/fsm-health-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-ipc-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-listen-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-path-utils-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-settings-' + fsmonitor_backend + '.c',
+ ]
+endif
+build_options_config.set_quoted('FSMONITOR_DAEMON_BACKEND', fsmonitor_backend)
+build_options_config.set_quoted('FSMONITOR_OS_SETTINGS', fsmonitor_backend)
+
+if compiler.has_header('regex.h') and compiler.get_define('REG_STARTEND', prefix: '#include <regex.h>') != ''
+ build_options_config.set('NO_REGEX', '')
+
+ if compiler.get_define('REG_ENHANCED', prefix: '#include <regex.h>') != ''
+ libgit_c_args += '-DUSE_ENHANCED_BASIC_REGULAR_EXPRESSIONS'
+ libgit_sources += 'compat/regcomp_enhanced.c'
+ endif
+else
+ libgit_c_args += [
+ '-DNO_REGEX',
+ '-DGAWK',
+ '-DNO_MBSUPPORT',
+ ]
+ build_options_config.set('NO_REGEX', '1')
+ libgit_sources += 'compat/regex/regex.c'
+ libgit_include_directories += 'compat/regex'
+endif
+
+# setitimer and friends are provided by compat/mingw.c.
+if host_machine.system() != 'windows'
+ if not compiler.compiles('''
+ #include <sys/time.h>
+ void func(void)
+ {
+ struct itimerval value;
+ }
+ ''', name: 'struct itimerval')
+ libgit_c_args += '-DNO_STRUCT_ITIMERVAL'
+ libgit_c_args += '-DNO_SETITIMER'
+ elif not compiler.has_function('setitimer')
+ libgit_c_args += '-DNO_SETITIMER'
+ endif
+endif
+
+if compiler.has_member('struct stat', 'st_mtimespec.tv_nsec', prefix: '#include <sys/stat.h>')
+ libgit_c_args += '-DUSE_ST_TIMESPEC'
+elif not compiler.has_member('struct stat', 'st_mtim.tv_nsec', prefix: '#include <sys/stat.h>')
+ libgit_c_args += '-DNO_NSEC'
+endif
+
+if not compiler.has_member('struct stat', 'st_blocks', prefix: '#include <sys/stat.h>')
+ libgit_c_args += '-DNO_ST_BLOCKS_IN_STRUCT_STAT'
+endif
+
+if not compiler.has_member('struct dirent', 'd_type', prefix: '#include <dirent.h>')
+ libgit_c_args += '-DNO_D_TYPE_IN_DIRENT'
+endif
+
+if not compiler.has_member('struct passwd', 'pw_gecos', prefix: '#include <pwd.h>')
+ libgit_c_args += '-DNO_GECOS_IN_PWENT'
+endif
+
+if compiler.has_function('sync_file_range')
+ libgit_c_args += '-DHAVE_SYNC_FILE_RANGE'
+endif
+
+if not compiler.has_function('strcasestr')
+ libgit_c_args += '-DNO_STRCASESTR'
+ libgit_sources += 'compat/strcasestr.c'
+endif
+
+if not compiler.has_function('memmem')
+ libgit_c_args += '-DNO_MEMMEM'
+ libgit_sources += 'compat/memmem.c'
+endif
+
+if not compiler.has_function('strlcpy')
+ libgit_c_args += '-DNO_STRLCPY'
+ libgit_sources += 'compat/strlcpy.c'
+endif
+
+if not compiler.has_function('strdup')
+ libgit_c_args += '-DOVERRIDE_STRDUP'
+ libgit_sources += 'compat/strdup.c'
+endif
+
+if not compiler.has_function('strtoumax')
+ libgit_c_args += '-DNO_STRTOUMAX'
+ libgit_sources += [
+ 'compat/strtoumax.c',
+ 'compat/strtoimax.c',
+ ]
+endif
+
+if not compiler.has_function('strtoull')
+ libgit_c_args += '-DNO_STRTOULL'
+endif
+
+if not compiler.has_function('setenv')
+ libgit_c_args += '-DNO_SETENV'
+ libgit_sources += 'compat/setenv.c'
+endif
+
+if not compiler.has_function('qsort')
+ libgit_c_args += '-DINTERNAL_QSORT'
+endif
+libgit_sources += 'compat/qsort_s.c'
+
+# unsetenv is provided by compat/mingw.c.
+if host_machine.system() != 'windows' and not compiler.has_function('unsetenv')
+ libgit_c_args += '-DNO_UNSETENV'
+ libgit_sources += 'compat/unsetenv.c'
+endif
+
+if not compiler.has_function('mkdtemp')
+ libgit_c_args += '-DNO_MKDTEMP'
+ libgit_sources += 'compat/mkdtemp.c'
+endif
+
+if not compiler.has_function('initgroups')
+ libgit_c_args += '-DNO_INITGROUPS'
+endif
+
+if compiler.has_function('getdelim')
+ libgit_c_args += '-DHAVE_GETDELIM'
+endif
+
+if host_machine.system() == 'windows'
+ libgit_c_args += '-DUSE_WIN32_MMAP'
+elif not compiler.has_function('mmap')
+ libgit_c_args += '-DNO_MMAP'
+ libgit_sources += 'compat/mmap.c'
+endif
+
+if compiler.has_function('clock_gettime')
+ libgit_c_args += '-DHAVE_CLOCK_GETTIME'
+endif
+
+if compiler.compiles('''
+ #include <time.h>
+
+ void func(void)
+ {
+ clockid_t id = CLOCK_MONOTONIC;
+ }
+''', name: 'monotonic clock')
+ libgit_c_args += '-DHAVE_CLOCK_MONOTONIC'
+endif
+
+if compiler.compiles('''
+ #include <inttypes.h>
+
+ void func(void)
+ {
+ uintmax_t x = 0;
+ }
+''', name: 'uintmax_t')
+ libgit_c_args += '-DNO_UINTMAX_T'
+endif
+
+has_bsd_sysctl = false
+if compiler.has_header('sys/sysctl.h')
+ if compiler.compiles('''
+ #include <stddef.h>
+ #include <sys/sysctl.h>
+
+ void func(void)
+ {
+ int val, mib[2] = { 0 };
+ size_t len = sizeof(val);
+ sysctl(mib, 2, &val, &len, NULL, 0);
+ }
+ ''', name: 'BSD sysctl')
+ libgit_c_args += '-DHAVE_BSD_SYSCTL'
+ has_bsd_sysctl = true
+ endif
+endif
+
+if compiler.run('''
+ #include <stdio.h>
+
+ int main(int argc, const char **argv)
+ {
+ FILE *f = fopen(".", "r");
+ return f ? 0 : 1;
+ }
+''', name: 'fread reads directories').returncode() == 0
+ libgit_c_args += '-DFREAD_READS_DIRECTORIES'
+ libgit_sources += 'compat/fopen.c'
+endif
+
+if not meson.is_cross_build() and fs.exists('/dev/tty')
+ libgit_c_args += '-DHAVE_DEV_TTY'
+endif
+
+if get_option('openssl').enabled() and get_option('CommonCrypto').enabled()
+ error('Can only use one SSL backend')
+endif
+
+security_framework = dependency('Security', required: get_option('CommonCrypto').disable_auto_if(host_machine.system() != 'darwin'))
+core_foundation_framework = dependency('CoreFoundation', required: security_framework.found())
+if security_framework.found()
+ libgit_dependencies += security_framework
+ libgit_dependencies += core_foundation_framework
+ libgit_c_args += '-DAPPLE_COMMON_CRYPTO'
+endif
+
+# OpenSSL is required when requested via the 'openssl' feature or via one of
+# the SHA1/SHA256 backends.
+openssl_required = get_option('openssl').disable_auto_if(security_framework.found())
+if get_option('sha1_backend') == 'openssl' or get_option('sha256_backend') == 'openssl'
+ openssl_required = true
+endif
+
+openssl = dependency('openssl', required: openssl_required, default_options: ['default_library=static'])
+if openssl.found()
+ libgit_dependencies += openssl
+endif
+
+# We may not want to use OpenSSL for anything but our SHA1/SHA256 backends, so
+# we cannot just set NO_OPENSSL based on whether or not the library was found.
+if not openssl.found() or get_option('openssl').disabled()
+ libgit_c_args += '-DNO_OPENSSL'
+endif
+
+sha1_backend = get_option('sha1_backend')
+if sha1_backend == 'sha1dc'
+ libgit_c_args += '-DSHA1_DC'
+ libgit_c_args += '-DSHA1DC_NO_STANDARD_INCLUDES=1'
+ libgit_c_args += '-DSHA1DC_INIT_SAFE_HASH_DEFAULT=0'
+ libgit_c_args += '-DSHA1DC_CUSTOM_INCLUDE_SHA1_C="git-compat-util.h"'
+ libgit_c_args += '-DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="git-compat-util.h"'
+
+ libgit_sources += [
+ 'sha1dc_git.c',
+ 'sha1dc/sha1.c',
+ 'sha1dc/ubc_check.c',
+ ]
+elif sha1_backend == 'common-crypto'
+ libgit_c_args += '-DCOMMON_DIGEST_FOR_OPENSSL'
+ libgit_c_args += '-DSHA1_APPLE'
+ libgit_c_args += '-DSHA1_MAX_BLOCK_SIZE=1024L*1024L*1024L'
+elif sha1_backend == 'openssl'
+ if not openssl.found()
+ openssl = dependency('openssl', required: true)
+ endif
+
+ libgit_c_args += '-DSHA1_OPENSSL'
+ # Apple CommonCrypto requires chunking
+elif sha1_backend == 'block'
+ libgit_c_args += '-DSHA1_BLK'
+ libgit_sources += 'block-sha1/sha1.c'
+else
+ error('Unhandled SHA1 backend ' + sha1_backend)
+endif
+
+sha256_backend = get_option('sha256_backend')
+if sha256_backend == 'openssl'
+ libgit_c_args += '-DSHA256_OPENSSL'
+elif sha256_backend == 'nettle'
+ nettle = dependency('nettle')
+ libgit_dependencies += nettle
+ libgit_c_args += '-DSHA256_NETTLE'
+elif sha256_backend == 'gcrypt'
+ gcrypt = dependency('gcrypt')
+ libgit_dependencies += gcrypt
+ libgit_c_args += '-DSHA256_GCRYPT'
+elif sha256_backend == 'block'
+ libgit_c_args += '-DSHA256_BLK'
+ libgit_sources += 'sha256/block/sha256.c'
+else
+ error('Unhandled SHA256 backend ' + sha256_backend)
+endif
+
+if compiler.has_header_symbol('stdlib.h', 'arc4random_buf')
+ libgit_c_args += '-DHAVE_ARC4RANDOM'
+elif compiler.has_header_symbol('bsd/stdlib.h', 'arc4random_buf')
+ libgit_c_args += '-DHAVE_ARC4RANDOM_BSD'
+elif compiler.has_function('getrandom', prefix: '#include <sys/random.h>')
+ libgit_c_args += '-DHAVE_GETRANDOM'
+elif compiler.has_function('getentropy', prefix: '#include <unistd.h>')
+ libgit_c_args += '-DHAVE_GETENTROPY'
+elif compiler.has_function('RtlGenRandom', prefix: '#include <windows.h>\n#include <ntsecapi.h>')
+ libgit_c_args += '-DHAVE_RTLGENRANDOM'
+elif openssl.found()
+ libgit_c_args += '-DHAVE_OPENSSL_CSPRNG'
+endif
+
+if get_option('runtime_prefix')
+ libgit_c_args += '-DRUNTIME_PREFIX'
+ build_options_config.set('RUNTIME_PREFIX', '1')
+
+ if compiler.has_header('mach-o/dyld.h')
+ libgit_c_args += '-DHAVE_NS_GET_EXECUTABLE_PATH'
+ endif
+
+ if has_bsd_sysctl and compiler.compiles('''
+ #include <sys/sysctl.h>
+
+ void func(void)
+ {
+ KERN_PROC_PATHNAME; KERN_PROC;
+ }
+ ''', name: 'BSD KERN_PROC_PATHNAME')
+ libgit_c_args += '-DHAVE_NS_GET_EXECUTABLE_PATH'
+ endif
+
+ if host_machine.system() == 'linux'
+ libgit_c_args += '-DPROCFS_EXECUTABLE_PATH="/proc/self/exe' + '"'
+ elif host_machine.system() == 'openbsd'
+ libgit_c_args += '-DPROCFS_EXECUTABLE_PATH="' + '/proc/curproc/file' + '"'
+ elif host_machine.system() == 'netbsd'
+ libgit_c_args += '-DPROCFS_EXECUTABLE_PATH="' + '/proc/curproc/exe' + '"'
+ endif
+
+ if host_machine.system() == 'windows' and compiler.compiles('''
+ #include <stdlib.h>
+
+ void func(void)
+ {
+ _wpgmptr;
+ }
+ ''', name: 'Win32 _wpgmptr')
+ libgit_c_args += '-DHAVE_WPGMPTR'
+ endif
+else
+ build_options_config.set('RUNTIME_PREFIX', '')
+endif
+
+foreach key, value : {
+ 'DIFF': diff.full_path(),
+ 'GIT_TEST_CMP': diff.full_path() + ' -u',
+ 'GIT_TEST_GITPERLLIB': meson.project_build_root() / 'perl',
+ 'GIT_TEST_MERGE_TOOLS_DIR': meson.project_source_root() / 'mergetools',
+ 'GIT_TEST_POPATH': meson.project_source_root() / 'po',
+ 'GIT_TEST_TEMPLATE_DIR': meson.project_build_root() / 'templates',
+ 'GIT_TEST_TEXTDOMAINDIR': meson.project_build_root() / 'po',
+ 'PAGER_ENV': get_option('pager_environment'),
+ 'PERL_PATH': perl.found() ? perl.full_path() : '',
+ 'PYTHON_PATH': python.found () ? python.full_path() : '',
+ 'SHELL_PATH': shell.full_path(),
+ 'TAR': tar.full_path(),
+ 'TEST_OUTPUT_DIRECTORY': test_output_directory,
+ 'TEST_SHELL_PATH': shell.full_path(),
+}
+ if value != '' and cygpath.found()
+ value = run_command(cygpath, value, check: true).stdout().strip()
+ endif
+ build_options_config.set_quoted(key, value)
+endforeach
+
+configure_file(
+ input: 'GIT-BUILD-OPTIONS.in',
+ output: 'GIT-BUILD-OPTIONS',
+ configuration: build_options_config,
+)
+
+# Build a separate library for "version.c" so that we do not have to rebuild
+# everything when the current Git commit changes. TODO: this only gets set up
+# at configuration time, so we do not notice version changes unless the build
+# instructions get regenerated. We should refactor the source file such that we
+# can substitute tags in the file via `vcs_tag()`.
+libgit_version_library = static_library('git-version',
+ sources: ['version.c'],
+ c_args: libgit_c_args + [
+ '-DGIT_VERSION="' + git_version + '"',
+ '-DGIT_USER_AGENT="' + 'git/' + git_version + '"',
+ '-DGIT_BUILT_FROM_COMMIT="' + run_command('git', 'rev-parse', '-q', '--verify', 'HEAD', check: false).stdout().strip() + '"',
+ ],
+ dependencies: libgit_dependencies,
+ include_directories: libgit_include_directories,
+)
+
+libgit_library = static_library('git',
+ sources: libgit_sources,
+ c_args: libgit_c_args,
+ link_with: libgit_version_library,
+ dependencies: libgit_dependencies,
+ include_directories: libgit_include_directories,
+)
+
+libgit = declare_dependency(
+ compile_args: libgit_c_args,
+ link_with: libgit_library,
+ dependencies: libgit_dependencies,
+ include_directories: libgit_include_directories,
+)
+
+common_main_sources = ['common-main.c']
+common_main_link_args = [ ]
+if host_machine.system() == 'windows'
+ # TODO: wire these up properly.
+ common_main_sources += import('windows').compile_resources('git.rc', args: [
+ '-DMAJOR=1',
+ '-DMINOR=1',
+ '-DMICRO=1',
+ '-DPATCHLEVEL=0',
+ '-DGIT_VERSION=\\\"' + git_version + '.GIT\\\"',
+ ])
+ if compiler.get_argument_syntax() == 'gcc'
+ common_main_link_args += [
+ '-municode',
+ '-Wl,-nxcompat',
+ '-Wl,-dynamicbase',
+ '-Wl,-pic-executable,-e,mainCRTStartup',
+ ]
+ elif compiler.get_argument_syntax() == 'msvc'
+ common_main_link_args += [
+ '/ENTRY:wmainCRTStartup',
+ 'invalidcontinue.obj',
+ ]
+ else
+ error('Unsupported compiler ' + compiler.get_id())
+ endif
+endif
+common_main_library = static_library('common-main',
+ 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,
+ link_args: common_main_link_args,
+)
+
+bin_wrappers = [ ]
+test_dependencies = [ ]
+
+git = executable('git',
+ sources: builtin_sources + 'git.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+bin_wrappers += git
+
+test_dependencies += executable('git-daemon',
+ sources: 'daemon.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+test_dependencies += executable('git-sh-i18n--envsubst',
+ sources: 'sh-i18n--envsubst.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+bin_wrappers += executable('git-shell',
+ sources: 'shell.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+test_dependencies += executable('git-http-backend',
+ sources: 'http-backend.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+bin_wrappers += executable('scalar',
+ sources: 'scalar.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+if get_option('curl').enabled()
+ curl_sources = [
+ 'http.c',
+ 'http-walker.c',
+ ]
+
+ git_remote_http = executable('git-remote-http',
+ sources: curl_sources + 'remote-curl.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+ test_dependencies += git_remote_http
+
+ test_dependencies += executable('git-http-fetch',
+ sources: curl_sources + 'http-fetch.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+
+ if expat.found()
+ test_dependencies += executable('git-http-push',
+ sources: curl_sources + 'http-push.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+ endif
+
+ 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, common_main],
+ )
+
+ install_symlink(alias + executable_suffix,
+ install_dir: get_option('libexecdir') / 'git-core',
+ pointing_to: 'git-remote-http',
+ )
+ endforeach
+endif
+
+imap_send_sources = ['imap-send.c']
+if use_curl_for_imap_send
+ imap_send_sources += curl_sources
+endif
+
+test_dependencies += executable('git-imap-send',
+ sources: imap_send_sources,
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+foreach alias : [ 'git-receive-pack', 'git-upload-archive', 'git-upload-pack' ]
+ bin_wrappers += executable(alias,
+ objects: git.extract_all_objects(recursive: false),
+ dependencies: [libgit, common_main],
+ )
+
+ install_symlink(alias + executable_suffix,
+ install_dir: get_option('libexecdir') / 'git-core',
+ pointing_to: 'git-remote-http',
+ )
+endforeach
+
+foreach symlink : [
+ 'git',
+ 'git-http-backend',
+ 'git-receive-pack',
+ 'git-shell',
+ 'git-upload-archive',
+ 'git-upload-pack',
+ 'scalar',
+]
+ install_symlink(symlink,
+ install_dir: get_option('bindir'),
+ pointing_to: fs.relative_to(get_option('libexecdir') / 'git-core' / symlink, get_option('bindir')),
+ )
+endforeach
+
+scripts_sh = [
+ 'git-difftool--helper.sh',
+ 'git-filter-branch.sh',
+ 'git-merge-octopus.sh',
+ 'git-merge-one-file.sh',
+ 'git-merge-resolve.sh',
+ 'git-mergetool--lib.sh',
+ 'git-mergetool.sh',
+ 'git-quiltimport.sh',
+ 'git-request-pull.sh',
+ 'git-sh-i18n.sh',
+ 'git-sh-setup.sh',
+ 'git-submodule.sh',
+ 'git-web--browse.sh',
+]
+if perl_features_enabled
+ scripts_sh += 'git-instaweb.sh'
+endif
+
+foreach script : scripts_sh
+ test_dependencies += custom_target(
+ input: script,
+ output: fs.stem(script),
+ command: [
+ shell,
+ meson.project_source_root() / 'generate-script.sh',
+ '@INPUT@',
+ '@OUTPUT@',
+ meson.project_build_root() / 'GIT-BUILD-OPTIONS',
+ ],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+endforeach
+
+if perl_features_enabled
+ scripts_perl = [
+ 'git-archimport.perl',
+ 'git-cvsexportcommit.perl',
+ 'git-cvsimport.perl',
+ 'git-cvsserver.perl',
+ 'git-send-email.perl',
+ 'git-svn.perl',
+ ]
+
+ pathsep = ':'
+ if host_machine.system() == 'windows'
+ pathsep = ';'
+ endif
+
+ perl_header_template = 'perl/header_templates/fixed_prefix.template.pl'
+ if get_option('runtime_prefix')
+ perl_header_template = 'perl/header_templates/runtime_prefix.template.pl'
+ endif
+
+ perl_header = configure_file(
+ input: perl_header_template,
+ output: 'GIT-PERL-HEADER',
+ configuration: {
+ 'GITEXECDIR_REL': get_option('libexecdir') / 'git-core',
+ 'PERLLIBDIR_REL': get_option('datadir') / 'perl5',
+ 'LOCALEDIR_REL': get_option('datadir') / 'locale',
+ 'INSTLIBDIR': get_option('datadir') / 'perl5',
+ 'PATHSEP': pathsep,
+ },
+ )
+
+ generate_perl_command = [
+ shell,
+ meson.project_source_root() / 'generate-perl.sh',
+ meson.project_build_root() / 'GIT-BUILD-OPTIONS',
+ git_version,
+ perl_header,
+ '@INPUT@',
+ '@OUTPUT@',
+ ]
+
+ foreach script : scripts_perl
+ generated_script = custom_target(
+ input: script,
+ output: fs.stem(script),
+ command: generate_perl_command,
+ install: true,
+ install_dir: get_option('datadir') / 'perl5',
+ )
+ test_dependencies += generated_script
+ if script == 'git-cvsserver.perl'
+ bin_wrappers += generated_script
+ endif
+ endforeach
+
+ subdir('perl')
+endif
+
+if python.found()
+ scripts_python = [
+ 'git-p4.py'
+ ]
+
+ foreach script : scripts_python
+ fs.copyfile(script, fs.stem(script),
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+ endforeach
+endif
+
+mergetools = [
+ 'mergetools/araxis',
+ 'mergetools/bc',
+ 'mergetools/codecompare',
+ 'mergetools/deltawalker',
+ 'mergetools/diffmerge',
+ 'mergetools/diffuse',
+ 'mergetools/ecmerge',
+ 'mergetools/emerge',
+ 'mergetools/examdiff',
+ 'mergetools/guiffy',
+ 'mergetools/gvimdiff',
+ 'mergetools/kdiff3',
+ 'mergetools/kompare',
+ 'mergetools/meld',
+ 'mergetools/nvimdiff',
+ 'mergetools/opendiff',
+ 'mergetools/p4merge',
+ 'mergetools/smerge',
+ 'mergetools/tkdiff',
+ 'mergetools/tortoisemerge',
+ 'mergetools/vimdiff',
+ 'mergetools/vscode',
+ 'mergetools/winmerge',
+ 'mergetools/xxdiff',
+]
+
+foreach mergetool : mergetools
+ install_data(mergetool, install_dir: get_option('libexecdir') / 'git-core' / 'mergetools')
+endforeach
+
+if intl.found()
+ subdir('po')
+endif
+subdir('contrib')
+subdir('gitweb')
+subdir('templates')
+
+# Everything but the bin-wrappers need to come before this target such that we
+# can properly set up test dependencies. The bin-wrappers themselves are set up
+# at configuration time, so these are fine.
+if get_option('tests')
+ subdir('t')
+endif
+
+subdir('bin-wrappers')
+if get_option('docs') != []
+ subdir('Documentation')
+endif
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000000000000000000000000000000000000..9164ed69eaff15fda29799a1d9fca485994aeac2
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,73 @@
+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('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('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('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('python', type: 'feature', value: 'auto',
+ description: 'Build tools written in Python.')
+
+option('openssl', type: 'feature', value: 'auto',
+ description: 'Support access to HTTPS remotes. OpenSSL may still be pulled in if configured as SHA1 or SHA256 backend.')
+option('CommonCrypto', type: 'feature', value: 'auto',
+ description: 'Build tools written in Python.')
+
+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')
+
+option('macos_use_homebrew_gettext', type: 'boolean', value: true,
+ description: 'Use gettext from Homebrew instead of the slightly-broken system-provided one.')
+
+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')
+
+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).')
+
+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')
diff --git a/perl/FromCPAN/Mail/meson.build b/perl/FromCPAN/Mail/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..129cff161c585645c111af0386bafe136258e3db
--- /dev/null
+++ b/perl/FromCPAN/Mail/meson.build
@@ -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',
+)
diff --git a/perl/FromCPAN/meson.build b/perl/FromCPAN/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..4e7ea909df3593fb65facb4bf6a1c42e954d6f70
--- /dev/null
+++ b/perl/FromCPAN/meson.build
@@ -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')
diff --git a/perl/Git/LoadCPAN/Mail/meson.build b/perl/Git/LoadCPAN/Mail/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..7da5b37adb278b4e13f41ea5ebc762bb4d78b64b
--- /dev/null
+++ b/perl/Git/LoadCPAN/Mail/meson.build
@@ -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',
+)
diff --git a/perl/Git/LoadCPAN/meson.build b/perl/Git/LoadCPAN/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..9468c073aeb5ae1980f88b4c7f2c7fe69355ea37
--- /dev/null
+++ b/perl/Git/LoadCPAN/meson.build
@@ -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')
diff --git a/perl/Git/SVN/Memoize/meson.build b/perl/Git/SVN/Memoize/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..515ab3dd926618f6c46b030e1f283d637fdddedf
--- /dev/null
+++ b/perl/Git/SVN/Memoize/meson.build
@@ -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',
+)
diff --git a/perl/Git/SVN/meson.build b/perl/Git/SVN/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..8338531041d8e5cd4e8c2c8a0c3dcfc8b2d23cc9
--- /dev/null
+++ b/perl/Git/SVN/meson.build
@@ -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')
diff --git a/perl/Git/meson.build b/perl/Git/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..259209d7302809b6c1d3249d9d21548515c31c77
--- /dev/null
+++ b/perl/Git/meson.build
@@ -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')
diff --git a/perl/meson.build b/perl/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..c22d6f8a1a3266ded27c43c43c88620f9b4badcf
--- /dev/null
+++ b/perl/meson.build
@@ -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
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..d7154b6395b2bf4a27110aad65aa1f51f979a1e9
--- /dev/null
+++ b/po/meson.build
@@ -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]
diff --git a/subprojects/.gitignore b/subprojects/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..63ea916ef5f30255aef0c0b0b63f37b0e1d99fb2
--- /dev/null
+++ b/subprojects/.gitignore
@@ -0,0 +1 @@
+/*/
diff --git a/subprojects/curl.wrap b/subprojects/curl.wrap
new file mode 100644
index 0000000000000000000000000000000000000000..f7e384b85cf5ee98672e4409e1d30f8f6f0e5735
--- /dev/null
+++ b/subprojects/curl.wrap
@@ -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
diff --git a/subprojects/expat.wrap b/subprojects/expat.wrap
new file mode 100644
index 0000000000000000000000000000000000000000..2e0427dcfd144c22d8c0bfd333e3cf31f14855a7
--- /dev/null
+++ b/subprojects/expat.wrap
@@ -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
diff --git a/subprojects/openssl.wrap b/subprojects/openssl.wrap
new file mode 100644
index 0000000000000000000000000000000000000000..873d55106e9b83c487a88dfbb85eaf73429464d7
--- /dev/null
+++ b/subprojects/openssl.wrap
@@ -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
diff --git a/subprojects/pcre2.wrap b/subprojects/pcre2.wrap
new file mode 100644
index 0000000000000000000000000000000000000000..7e184472543bde1572b9e780ae29318fe01e72bc
--- /dev/null
+++ b/subprojects/pcre2.wrap
@@ -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
diff --git a/subprojects/zlib.wrap b/subprojects/zlib.wrap
new file mode 100644
index 0000000000000000000000000000000000000000..aa14de17740728cecdb7431fb101e55e9b022273
--- /dev/null
+++ b/subprojects/zlib.wrap
@@ -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
diff --git a/t/helper/meson.build b/t/helper/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..5e83884246edc7841738de5085f3255aa1fa3fbe
--- /dev/null
+++ b/t/helper/meson.build
@@ -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
diff --git a/t/meson.build b/t/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..9ec0b7fa34a033d508448dbd56ab2322a5106fd0
--- /dev/null
+++ b/t/meson.build
@@ -0,0 +1,1106 @@
+clar_test_suites = [
+ 'unit-tests/ctype.c',
+ 'unit-tests/strvec.c',
+]
+
+clar_sources = [
+ 'unit-tests/clar/clar.c',
+ 'unit-tests/unit-test.c',
+]
+
+clar_decls_h = custom_target(
+ input: clar_test_suites,
+ output: 'clar-decls.h',
+ command : [shell, meson.current_source_dir() + '/unit-tests/generate-clar-decls.sh', '@OUTPUT@', '@INPUT@'],
+ env: script_environment,
+)
+clar_sources += clar_decls_h
+
+clar_sources += custom_target(
+ input: clar_decls_h,
+ output: 'clar.suite',
+ feed: true,
+ capture: true,
+ command : [awk, '-f', meson.current_source_dir() + '/unit-tests/clar-generate.awk'],
+)
+
+clar_unit_tests = executable('unit-tests',
+ sources: clar_sources + clar_test_suites,
+ dependencies: [libgit, common_main],
+)
+test('unit-tests', clar_unit_tests)
+
+unit_test_programs = [
+ 'unit-tests/t-example-decorate.c',
+ 'unit-tests/t-hash.c',
+ 'unit-tests/t-hashmap.c',
+ 'unit-tests/t-mem-pool.c',
+ 'unit-tests/t-oid-array.c',
+ 'unit-tests/t-oidmap.c',
+ 'unit-tests/t-oidtree.c',
+ 'unit-tests/t-prio-queue.c',
+ 'unit-tests/t-reftable-basics.c',
+ 'unit-tests/t-reftable-block.c',
+ 'unit-tests/t-reftable-merged.c',
+ 'unit-tests/t-reftable-pq.c',
+ 'unit-tests/t-reftable-reader.c',
+ 'unit-tests/t-reftable-readwrite.c',
+ 'unit-tests/t-reftable-record.c',
+ 'unit-tests/t-reftable-stack.c',
+ 'unit-tests/t-reftable-tree.c',
+ 'unit-tests/t-strbuf.c',
+ 'unit-tests/t-strcmp-offset.c',
+ 'unit-tests/t-trailer.c',
+ 'unit-tests/t-urlmatch-normalization.c',
+]
+
+foreach unit_test_program : unit_test_programs
+ unit_test_name = fs.stem(unit_test_program)
+ unit_test = executable(unit_test_name,
+ sources: [
+ 'unit-tests/test-lib.c',
+ 'unit-tests/lib-oid.c',
+ 'unit-tests/lib-reftable.c',
+ unit_test_program,
+ ],
+ dependencies: [libgit, common_main],
+ )
+ test(unit_test_name, unit_test,
+ workdir: meson.current_source_dir(),
+ timeout: 0,
+ )
+endforeach
+
+subdir('helper')
+
+integration_tests = [
+ 't0000-basic.sh',
+ 't0001-init.sh',
+ 't0002-gitfile.sh',
+ 't0003-attributes.sh',
+ 't0004-unwritable.sh',
+ 't0005-signals.sh',
+ 't0006-date.sh',
+ 't0007-git-var.sh',
+ 't0008-ignores.sh',
+ 't0010-racy-git.sh',
+ 't0012-help.sh',
+ 't0013-sha1dc.sh',
+ 't0014-alias.sh',
+ 't0017-env-helper.sh',
+ 't0018-advice.sh',
+ 't0019-json-writer.sh',
+ 't0020-crlf.sh',
+ 't0021-conversion.sh',
+ 't0022-crlf-rename.sh',
+ 't0023-crlf-am.sh',
+ 't0024-crlf-archive.sh',
+ 't0025-crlf-renormalize.sh',
+ 't0026-eol-config.sh',
+ 't0027-auto-crlf.sh',
+ 't0028-working-tree-encoding.sh',
+ 't0029-core-unsetenvvars.sh',
+ 't0030-stripspace.sh',
+ 't0033-safe-directory.sh',
+ 't0034-root-safe-directory.sh',
+ 't0035-safe-bare-repository.sh',
+ 't0040-parse-options.sh',
+ 't0041-usage.sh',
+ 't0050-filesystem.sh',
+ 't0051-windows-named-pipe.sh',
+ 't0052-simple-ipc.sh',
+ 't0055-beyond-symlinks.sh',
+ 't0056-git-C.sh',
+ 't0060-path-utils.sh',
+ 't0061-run-command.sh',
+ 't0062-revision-walking.sh',
+ 't0063-string-list.sh',
+ 't0066-dir-iterator.sh',
+ 't0067-parse_pathspec_file.sh',
+ 't0068-for-each-repo.sh',
+ 't0070-fundamental.sh',
+ 't0071-sort.sh',
+ 't0080-unit-test-output.sh',
+ 't0081-find-pack.sh',
+ 't0090-cache-tree.sh',
+ 't0091-bugreport.sh',
+ 't0092-diagnose.sh',
+ 't0095-bloom.sh',
+ 't0100-previous.sh',
+ 't0101-at-syntax.sh',
+ 't0200-gettext-basic.sh',
+ 't0201-gettext-fallbacks.sh',
+ 't0202-gettext-perl.sh',
+ 't0203-gettext-setlocale-sanity.sh',
+ 't0204-gettext-reencode-sanity.sh',
+ 't0210-trace2-normal.sh',
+ 't0211-trace2-perf.sh',
+ 't0212-trace2-event.sh',
+ 't0300-credentials.sh',
+ 't0301-credential-cache.sh',
+ 't0302-credential-store.sh',
+ 't0303-credential-external.sh',
+ 't0410-partial-clone.sh',
+ 't0411-clone-from-partial.sh',
+ 't0450-txt-doc-vs-help.sh',
+ 't0500-progress-display.sh',
+ 't0600-reffiles-backend.sh',
+ 't0601-reffiles-pack-refs.sh',
+ 't0602-reffiles-fsck.sh',
+ 't0610-reftable-basics.sh',
+ 't0611-reftable-httpd.sh',
+ 't0612-reftable-jgit-compatibility.sh',
+ 't0613-reftable-write-options.sh',
+ 't1000-read-tree-m-3way.sh',
+ 't1001-read-tree-m-2way.sh',
+ 't1002-read-tree-m-u-2way.sh',
+ 't1003-read-tree-prefix.sh',
+ 't1004-read-tree-m-u-wf.sh',
+ 't1005-read-tree-reset.sh',
+ 't1006-cat-file.sh',
+ 't1007-hash-object.sh',
+ 't1008-read-tree-overlay.sh',
+ 't1009-read-tree-new-index.sh',
+ 't1010-mktree.sh',
+ 't1011-read-tree-sparse-checkout.sh',
+ 't1012-read-tree-df.sh',
+ 't1013-read-tree-submodule.sh',
+ 't1014-read-tree-confusing.sh',
+ 't1015-read-index-unmerged.sh',
+ 't1016-compatObjectFormat.sh',
+ 't1020-subdirectory.sh',
+ 't1021-rerere-in-workdir.sh',
+ 't1022-read-tree-partial-clone.sh',
+ 't1050-large.sh',
+ 't1051-large-conversion.sh',
+ 't1060-object-corruption.sh',
+ 't1090-sparse-checkout-scope.sh',
+ 't1091-sparse-checkout-builtin.sh',
+ 't1092-sparse-checkout-compatibility.sh',
+ 't1100-commit-tree-options.sh',
+ 't1300-config.sh',
+ 't1301-shared-repo.sh',
+ 't1302-repo-version.sh',
+ 't1303-wacky-config.sh',
+ 't1304-default-acl.sh',
+ 't1305-config-include.sh',
+ 't1306-xdg-files.sh',
+ 't1307-config-blob.sh',
+ 't1308-config-set.sh',
+ 't1309-early-config.sh',
+ 't1310-config-default.sh',
+ 't1350-config-hooks-path.sh',
+ 't1400-update-ref.sh',
+ 't1401-symbolic-ref.sh',
+ 't1402-check-ref-format.sh',
+ 't1403-show-ref.sh',
+ 't1404-update-ref-errors.sh',
+ 't1405-main-ref-store.sh',
+ 't1406-submodule-ref-store.sh',
+ 't1407-worktree-ref-store.sh',
+ 't1408-packed-refs.sh',
+ 't1409-avoid-packing-refs.sh',
+ 't1410-reflog.sh',
+ 't1411-reflog-show.sh',
+ 't1412-reflog-loop.sh',
+ 't1413-reflog-detach.sh',
+ 't1414-reflog-walk.sh',
+ 't1415-worktree-refs.sh',
+ 't1416-ref-transaction-hooks.sh',
+ 't1417-reflog-updateref.sh',
+ 't1418-reflog-exists.sh',
+ 't1419-exclude-refs.sh',
+ 't1420-lost-found.sh',
+ 't1430-bad-ref-name.sh',
+ 't1450-fsck.sh',
+ 't1451-fsck-buffer.sh',
+ 't1460-refs-migrate.sh',
+ 't1500-rev-parse.sh',
+ 't1501-work-tree.sh',
+ 't1502-rev-parse-parseopt.sh',
+ 't1503-rev-parse-verify.sh',
+ 't1504-ceiling-dirs.sh',
+ 't1505-rev-parse-last.sh',
+ 't1506-rev-parse-diagnosis.sh',
+ 't1507-rev-parse-upstream.sh',
+ 't1508-at-combinations.sh',
+ 't1509-root-work-tree.sh',
+ 't1510-repo-setup.sh',
+ 't1511-rev-parse-caret.sh',
+ 't1512-rev-parse-disambiguation.sh',
+ 't1513-rev-parse-prefix.sh',
+ 't1514-rev-parse-push.sh',
+ 't1515-rev-parse-outside-repo.sh',
+ 't1517-outside-repo.sh',
+ 't1600-index.sh',
+ 't1601-index-bogus.sh',
+ 't1700-split-index.sh',
+ 't1701-racy-split-index.sh',
+ 't1800-hook.sh',
+ 't2000-conflict-when-checking-files-out.sh',
+ 't2002-checkout-cache-u.sh',
+ 't2003-checkout-cache-mkdir.sh',
+ 't2004-checkout-cache-temp.sh',
+ 't2005-checkout-index-symlinks.sh',
+ 't2006-checkout-index-basic.sh',
+ 't2007-checkout-symlink.sh',
+ 't2008-checkout-subdir.sh',
+ 't2009-checkout-statinfo.sh',
+ 't2010-checkout-ambiguous.sh',
+ 't2011-checkout-invalid-head.sh',
+ 't2012-checkout-last.sh',
+ 't2013-checkout-submodule.sh',
+ 't2014-checkout-switch.sh',
+ 't2015-checkout-unborn.sh',
+ 't2016-checkout-patch.sh',
+ 't2017-checkout-orphan.sh',
+ 't2018-checkout-branch.sh',
+ 't2019-checkout-ambiguous-ref.sh',
+ 't2020-checkout-detach.sh',
+ 't2021-checkout-overwrite.sh',
+ 't2022-checkout-paths.sh',
+ 't2023-checkout-m.sh',
+ 't2024-checkout-dwim.sh',
+ 't2025-checkout-no-overlay.sh',
+ 't2026-checkout-pathspec-file.sh',
+ 't2027-checkout-track.sh',
+ 't2030-unresolve-info.sh',
+ 't2050-git-dir-relative.sh',
+ 't2060-switch.sh',
+ 't2070-restore.sh',
+ 't2071-restore-patch.sh',
+ 't2072-restore-pathspec-file.sh',
+ 't2080-parallel-checkout-basics.sh',
+ 't2081-parallel-checkout-collisions.sh',
+ 't2082-parallel-checkout-attributes.sh',
+ 't2100-update-cache-badpath.sh',
+ 't2101-update-index-reupdate.sh',
+ 't2102-update-index-symlinks.sh',
+ 't2103-update-index-ignore-missing.sh',
+ 't2104-update-index-skip-worktree.sh',
+ 't2105-update-index-gitfile.sh',
+ 't2106-update-index-assume-unchanged.sh',
+ 't2107-update-index-basic.sh',
+ 't2108-update-index-refresh-racy.sh',
+ 't2200-add-update.sh',
+ 't2201-add-update-typechange.sh',
+ 't2202-add-addremove.sh',
+ 't2203-add-intent.sh',
+ 't2204-add-ignored.sh',
+ 't2205-add-worktree-config.sh',
+ 't2300-cd-to-toplevel.sh',
+ 't2400-worktree-add.sh',
+ 't2401-worktree-prune.sh',
+ 't2402-worktree-list.sh',
+ 't2403-worktree-move.sh',
+ 't2404-worktree-config.sh',
+ 't2405-worktree-submodule.sh',
+ 't2406-worktree-repair.sh',
+ 't2407-worktree-heads.sh',
+ 't2408-worktree-relative.sh',
+ 't2500-untracked-overwriting.sh',
+ 't2501-cwd-empty.sh',
+ 't3000-ls-files-others.sh',
+ 't3001-ls-files-others-exclude.sh',
+ 't3002-ls-files-dashpath.sh',
+ 't3003-ls-files-exclude.sh',
+ 't3004-ls-files-basic.sh',
+ 't3005-ls-files-relative.sh',
+ 't3006-ls-files-long.sh',
+ 't3007-ls-files-recurse-submodules.sh',
+ 't3008-ls-files-lazy-init-name-hash.sh',
+ 't3009-ls-files-others-nonsubmodule.sh',
+ 't3010-ls-files-killed-modified.sh',
+ 't3011-common-prefixes-and-directory-traversal.sh',
+ 't3012-ls-files-dedup.sh',
+ 't3013-ls-files-format.sh',
+ 't3020-ls-files-error-unmatch.sh',
+ 't3040-subprojects-basic.sh',
+ 't3050-subprojects-fetch.sh',
+ 't3060-ls-files-with-tree.sh',
+ 't3070-wildmatch.sh',
+ 't3100-ls-tree-restrict.sh',
+ 't3101-ls-tree-dirname.sh',
+ 't3102-ls-tree-wildcards.sh',
+ 't3103-ls-tree-misc.sh',
+ 't3104-ls-tree-format.sh',
+ 't3105-ls-tree-output.sh',
+ 't3200-branch.sh',
+ 't3201-branch-contains.sh',
+ 't3202-show-branch.sh',
+ 't3203-branch-output.sh',
+ 't3204-branch-name-interpretation.sh',
+ 't3205-branch-color.sh',
+ 't3206-range-diff.sh',
+ 't3207-branch-submodule.sh',
+ 't3211-peel-ref.sh',
+ 't3300-funny-names.sh',
+ 't3301-notes.sh',
+ 't3302-notes-index-expensive.sh',
+ 't3303-notes-subtrees.sh',
+ 't3304-notes-mixed.sh',
+ 't3305-notes-fanout.sh',
+ 't3306-notes-prune.sh',
+ 't3307-notes-man.sh',
+ 't3308-notes-merge.sh',
+ 't3309-notes-merge-auto-resolve.sh',
+ 't3310-notes-merge-manual-resolve.sh',
+ 't3311-notes-merge-fanout.sh',
+ 't3320-notes-merge-worktrees.sh',
+ 't3321-notes-stripspace.sh',
+ 't3400-rebase.sh',
+ 't3401-rebase-and-am-rename.sh',
+ 't3402-rebase-merge.sh',
+ 't3403-rebase-skip.sh',
+ 't3404-rebase-interactive.sh',
+ 't3405-rebase-malformed.sh',
+ 't3406-rebase-message.sh',
+ 't3407-rebase-abort.sh',
+ 't3408-rebase-multi-line.sh',
+ 't3409-rebase-environ.sh',
+ 't3412-rebase-root.sh',
+ 't3413-rebase-hook.sh',
+ 't3415-rebase-autosquash.sh',
+ 't3416-rebase-onto-threedots.sh',
+ 't3417-rebase-whitespace-fix.sh',
+ 't3418-rebase-continue.sh',
+ 't3419-rebase-patch-id.sh',
+ 't3420-rebase-autostash.sh',
+ 't3421-rebase-topology-linear.sh',
+ 't3422-rebase-incompatible-options.sh',
+ 't3423-rebase-reword.sh',
+ 't3424-rebase-empty.sh',
+ 't3425-rebase-topology-merges.sh',
+ 't3426-rebase-submodule.sh',
+ 't3427-rebase-subtree.sh',
+ 't3428-rebase-signoff.sh',
+ 't3429-rebase-edit-todo.sh',
+ 't3430-rebase-merges.sh',
+ 't3431-rebase-fork-point.sh',
+ 't3432-rebase-fast-forward.sh',
+ 't3433-rebase-across-mode-change.sh',
+ 't3434-rebase-i18n.sh',
+ 't3435-rebase-gpg-sign.sh',
+ 't3436-rebase-more-options.sh',
+ 't3437-rebase-fixup-options.sh',
+ 't3438-rebase-broken-files.sh',
+ 't3500-cherry.sh',
+ 't3501-revert-cherry-pick.sh',
+ 't3502-cherry-pick-merge.sh',
+ 't3503-cherry-pick-root.sh',
+ 't3504-cherry-pick-rerere.sh',
+ 't3505-cherry-pick-empty.sh',
+ 't3506-cherry-pick-ff.sh',
+ 't3507-cherry-pick-conflict.sh',
+ 't3508-cherry-pick-many-commits.sh',
+ 't3509-cherry-pick-merge-df.sh',
+ 't3510-cherry-pick-sequence.sh',
+ 't3511-cherry-pick-x.sh',
+ 't3512-cherry-pick-submodule.sh',
+ 't3513-revert-submodule.sh',
+ 't3514-cherry-pick-revert-gpg.sh',
+ 't3600-rm.sh',
+ 't3601-rm-pathspec-file.sh',
+ 't3602-rm-sparse-checkout.sh',
+ 't3650-replay-basics.sh',
+ 't3700-add.sh',
+ 't3701-add-interactive.sh',
+ 't3702-add-edit.sh',
+ 't3703-add-magic-pathspec.sh',
+ 't3704-add-pathspec-file.sh',
+ 't3705-add-sparse-checkout.sh',
+ 't3800-mktag.sh',
+ 't3900-i18n-commit.sh',
+ 't3901-i18n-patch.sh',
+ 't3902-quoted.sh',
+ 't3903-stash.sh',
+ 't3904-stash-patch.sh',
+ 't3905-stash-include-untracked.sh',
+ 't3906-stash-submodule.sh',
+ 't3907-stash-show-config.sh',
+ 't3908-stash-in-worktree.sh',
+ 't3909-stash-pathspec-file.sh',
+ 't3910-mac-os-precompose.sh',
+ 't3920-crlf-messages.sh',
+ 't4000-diff-format.sh',
+ 't4001-diff-rename.sh',
+ 't4002-diff-basic.sh',
+ 't4003-diff-rename-1.sh',
+ 't4004-diff-rename-symlink.sh',
+ 't4005-diff-rename-2.sh',
+ 't4006-diff-mode.sh',
+ 't4007-rename-3.sh',
+ 't4008-diff-break-rewrite.sh',
+ 't4009-diff-rename-4.sh',
+ 't4010-diff-pathspec.sh',
+ 't4011-diff-symlink.sh',
+ 't4012-diff-binary.sh',
+ 't4013-diff-various.sh',
+ 't4014-format-patch.sh',
+ 't4015-diff-whitespace.sh',
+ 't4016-diff-quote.sh',
+ 't4017-diff-retval.sh',
+ 't4018-diff-funcname.sh',
+ 't4019-diff-wserror.sh',
+ 't4020-diff-external.sh',
+ 't4021-format-patch-numbered.sh',
+ 't4022-diff-rewrite.sh',
+ 't4023-diff-rename-typechange.sh',
+ 't4024-diff-optimize-common.sh',
+ 't4025-hunk-header.sh',
+ 't4026-color.sh',
+ 't4027-diff-submodule.sh',
+ 't4028-format-patch-mime-headers.sh',
+ 't4029-diff-trailing-space.sh',
+ 't4030-diff-textconv.sh',
+ 't4031-diff-rewrite-binary.sh',
+ 't4032-diff-inter-hunk-context.sh',
+ 't4033-diff-patience.sh',
+ 't4034-diff-words.sh',
+ 't4035-diff-quiet.sh',
+ 't4036-format-patch-signer-mime.sh',
+ 't4037-diff-r-t-dirs.sh',
+ 't4038-diff-combined.sh',
+ 't4039-diff-assume-unchanged.sh',
+ 't4040-whitespace-status.sh',
+ 't4041-diff-submodule-option.sh',
+ 't4042-diff-textconv-caching.sh',
+ 't4043-diff-rename-binary.sh',
+ 't4044-diff-index-unique-abbrev.sh',
+ 't4045-diff-relative.sh',
+ 't4046-diff-unmerged.sh',
+ 't4047-diff-dirstat.sh',
+ 't4048-diff-combined-binary.sh',
+ 't4049-diff-stat-count.sh',
+ 't4050-diff-histogram.sh',
+ 't4051-diff-function-context.sh',
+ 't4052-stat-output.sh',
+ 't4053-diff-no-index.sh',
+ 't4054-diff-bogus-tree.sh',
+ 't4055-diff-context.sh',
+ 't4056-diff-order.sh',
+ 't4057-diff-combined-paths.sh',
+ 't4058-diff-duplicates.sh',
+ 't4059-diff-submodule-not-initialized.sh',
+ 't4060-diff-submodule-option-diff-format.sh',
+ 't4061-diff-indent.sh',
+ 't4062-diff-pickaxe.sh',
+ 't4063-diff-blobs.sh',
+ 't4064-diff-oidfind.sh',
+ 't4065-diff-anchored.sh',
+ 't4066-diff-emit-delay.sh',
+ 't4067-diff-partial-clone.sh',
+ 't4068-diff-symmetric-merge-base.sh',
+ 't4069-remerge-diff.sh',
+ 't4100-apply-stat.sh',
+ 't4101-apply-nonl.sh',
+ 't4102-apply-rename.sh',
+ 't4103-apply-binary.sh',
+ 't4104-apply-boundary.sh',
+ 't4105-apply-fuzz.sh',
+ 't4106-apply-stdin.sh',
+ 't4107-apply-ignore-whitespace.sh',
+ 't4108-apply-threeway.sh',
+ 't4109-apply-multifrag.sh',
+ 't4110-apply-scan.sh',
+ 't4111-apply-subdir.sh',
+ 't4112-apply-renames.sh',
+ 't4113-apply-ending.sh',
+ 't4114-apply-typechange.sh',
+ 't4115-apply-symlink.sh',
+ 't4116-apply-reverse.sh',
+ 't4117-apply-reject.sh',
+ 't4118-apply-empty-context.sh',
+ 't4119-apply-config.sh',
+ 't4120-apply-popt.sh',
+ 't4121-apply-diffs.sh',
+ 't4122-apply-symlink-inside.sh',
+ 't4123-apply-shrink.sh',
+ 't4124-apply-ws-rule.sh',
+ 't4125-apply-ws-fuzz.sh',
+ 't4126-apply-empty.sh',
+ 't4127-apply-same-fn.sh',
+ 't4128-apply-root.sh',
+ 't4129-apply-samemode.sh',
+ 't4130-apply-criss-cross-rename.sh',
+ 't4131-apply-fake-ancestor.sh',
+ 't4132-apply-removal.sh',
+ 't4133-apply-filenames.sh',
+ 't4134-apply-submodule.sh',
+ 't4135-apply-weird-filenames.sh',
+ 't4136-apply-check.sh',
+ 't4137-apply-submodule.sh',
+ 't4138-apply-ws-expansion.sh',
+ 't4139-apply-escape.sh',
+ 't4140-apply-ita.sh',
+ 't4141-apply-too-large.sh',
+ 't4150-am.sh',
+ 't4151-am-abort.sh',
+ 't4152-am-subjects.sh',
+ 't4153-am-resume-override-opts.sh',
+ 't4200-rerere.sh',
+ 't4201-shortlog.sh',
+ 't4202-log.sh',
+ 't4203-mailmap.sh',
+ 't4204-patch-id.sh',
+ 't4205-log-pretty-formats.sh',
+ 't4206-log-follow-harder-copies.sh',
+ 't4207-log-decoration-colors.sh',
+ 't4208-log-magic-pathspec.sh',
+ 't4209-log-pickaxe.sh',
+ 't4210-log-i18n.sh',
+ 't4211-line-log.sh',
+ 't4212-log-corrupt.sh',
+ 't4213-log-tabexpand.sh',
+ 't4214-log-graph-octopus.sh',
+ 't4215-log-skewed-merges.sh',
+ 't4216-log-bloom.sh',
+ 't4217-log-limit.sh',
+ 't4252-am-options.sh',
+ 't4253-am-keep-cr-dos.sh',
+ 't4254-am-corrupt.sh',
+ 't4255-am-submodule.sh',
+ 't4256-am-format-flowed.sh',
+ 't4257-am-interactive.sh',
+ 't4258-am-quoted-cr.sh',
+ 't4300-merge-tree.sh',
+ 't4301-merge-tree-write-tree.sh',
+ 't5000-tar-tree.sh',
+ 't5001-archive-attr.sh',
+ 't5002-archive-attr-pattern.sh',
+ 't5003-archive-zip.sh',
+ 't5004-archive-corner-cases.sh',
+ 't5100-mailinfo.sh',
+ 't5150-request-pull.sh',
+ 't5200-update-server-info.sh',
+ 't5300-pack-object.sh',
+ 't5301-sliding-window.sh',
+ 't5302-pack-index.sh',
+ 't5303-pack-corruption-resilience.sh',
+ 't5304-prune.sh',
+ 't5305-include-tag.sh',
+ 't5306-pack-nobase.sh',
+ 't5307-pack-missing-commit.sh',
+ 't5308-pack-detect-duplicates.sh',
+ 't5309-pack-delta-cycles.sh',
+ 't5310-pack-bitmaps.sh',
+ 't5311-pack-bitmaps-shallow.sh',
+ 't5312-prune-corruption.sh',
+ 't5313-pack-bounds-checks.sh',
+ 't5314-pack-cycle-detection.sh',
+ 't5315-pack-objects-compression.sh',
+ 't5316-pack-delta-depth.sh',
+ 't5317-pack-objects-filter-objects.sh',
+ 't5318-commit-graph.sh',
+ 't5319-multi-pack-index.sh',
+ 't5320-delta-islands.sh',
+ 't5321-pack-large-objects.sh',
+ 't5322-pack-objects-sparse.sh',
+ 't5323-pack-redundant.sh',
+ 't5324-split-commit-graph.sh',
+ 't5325-reverse-index.sh',
+ 't5326-multi-pack-bitmaps.sh',
+ 't5327-multi-pack-bitmaps-rev.sh',
+ 't5328-commit-graph-64bit-time.sh',
+ 't5329-pack-objects-cruft.sh',
+ 't5330-no-lazy-fetch-with-commit-graph.sh',
+ 't5331-pack-objects-stdin.sh',
+ 't5332-multi-pack-reuse.sh',
+ 't5333-pseudo-merge-bitmaps.sh',
+ 't5334-incremental-multi-pack-index.sh',
+ 't5351-unpack-large-objects.sh',
+ 't5400-send-pack.sh',
+ 't5401-update-hooks.sh',
+ 't5402-post-merge-hook.sh',
+ 't5403-post-checkout-hook.sh',
+ 't5404-tracking-branches.sh',
+ 't5405-send-pack-rewind.sh',
+ 't5406-remote-rejects.sh',
+ 't5407-post-rewrite-hook.sh',
+ 't5408-send-pack-stdin.sh',
+ 't5409-colorize-remote-messages.sh',
+ 't5410-receive-pack-alternates.sh',
+ 't5411-proc-receive-hook.sh',
+ 't5500-fetch-pack.sh',
+ 't5501-fetch-push-alternates.sh',
+ 't5502-quickfetch.sh',
+ 't5503-tagfollow.sh',
+ 't5504-fetch-receive-strict.sh',
+ 't5505-remote.sh',
+ 't5506-remote-groups.sh',
+ 't5507-remote-environment.sh',
+ 't5509-fetch-push-namespaces.sh',
+ 't5510-fetch.sh',
+ 't5511-refspec.sh',
+ 't5512-ls-remote.sh',
+ 't5513-fetch-track.sh',
+ 't5514-fetch-multiple.sh',
+ 't5515-fetch-merge-logic.sh',
+ 't5516-fetch-push.sh',
+ 't5517-push-mirror.sh',
+ 't5518-fetch-exit-status.sh',
+ 't5519-push-alternates.sh',
+ 't5520-pull.sh',
+ 't5521-pull-options.sh',
+ 't5522-pull-symlink.sh',
+ 't5523-push-upstream.sh',
+ 't5524-pull-msg.sh',
+ 't5525-fetch-tagopt.sh',
+ 't5526-fetch-submodules.sh',
+ 't5527-fetch-odd-refs.sh',
+ 't5528-push-default.sh',
+ 't5529-push-errors.sh',
+ 't5530-upload-pack-error.sh',
+ 't5531-deep-submodule-push.sh',
+ 't5532-fetch-proxy.sh',
+ 't5533-push-cas.sh',
+ 't5534-push-signed.sh',
+ 't5535-fetch-push-symref.sh',
+ 't5536-fetch-conflicts.sh',
+ 't5537-fetch-shallow.sh',
+ 't5538-push-shallow.sh',
+ 't5539-fetch-http-shallow.sh',
+ 't5540-http-push-webdav.sh',
+ 't5541-http-push-smart.sh',
+ 't5542-push-http-shallow.sh',
+ 't5543-atomic-push.sh',
+ 't5544-pack-objects-hook.sh',
+ 't5545-push-options.sh',
+ 't5546-receive-limits.sh',
+ 't5547-push-quarantine.sh',
+ 't5548-push-porcelain.sh',
+ 't5549-fetch-push-http.sh',
+ 't5550-http-fetch-dumb.sh',
+ 't5551-http-fetch-smart.sh',
+ 't5552-skipping-fetch-negotiator.sh',
+ 't5553-set-upstream.sh',
+ 't5554-noop-fetch-negotiator.sh',
+ 't5555-http-smart-common.sh',
+ 't5557-http-get.sh',
+ 't5558-clone-bundle-uri.sh',
+ 't5559-http-fetch-smart-http2.sh',
+ 't5560-http-backend-noserver.sh',
+ 't5561-http-backend.sh',
+ 't5562-http-backend-content-length.sh',
+ 't5563-simple-http-auth.sh',
+ 't5564-http-proxy.sh',
+ 't5570-git-daemon.sh',
+ 't5571-pre-push-hook.sh',
+ 't5572-pull-submodule.sh',
+ 't5573-pull-verify-signatures.sh',
+ 't5574-fetch-output.sh',
+ 't5580-unc-paths.sh',
+ 't5581-http-curl-verbose.sh',
+ 't5582-fetch-negative-refspec.sh',
+ 't5583-push-branches.sh',
+ 't5600-clone-fail-cleanup.sh',
+ 't5601-clone.sh',
+ 't5602-clone-remote-exec.sh',
+ 't5603-clone-dirname.sh',
+ 't5604-clone-reference.sh',
+ 't5605-clone-local.sh',
+ 't5606-clone-options.sh',
+ 't5607-clone-bundle.sh',
+ 't5608-clone-2gb.sh',
+ 't5609-clone-branch.sh',
+ 't5610-clone-detached.sh',
+ 't5611-clone-config.sh',
+ 't5612-clone-refspec.sh',
+ 't5613-info-alternate.sh',
+ 't5614-clone-submodules-shallow.sh',
+ 't5615-alternate-env.sh',
+ 't5616-partial-clone.sh',
+ 't5617-clone-submodules-remote.sh',
+ 't5618-alternate-refs.sh',
+ 't5619-clone-local-ambiguous-transport.sh',
+ 't5700-protocol-v1.sh',
+ 't5701-git-serve.sh',
+ 't5702-protocol-v2.sh',
+ 't5703-upload-pack-ref-in-want.sh',
+ 't5704-protocol-violations.sh',
+ 't5705-session-id-in-capabilities.sh',
+ 't5730-protocol-v2-bundle-uri-file.sh',
+ 't5731-protocol-v2-bundle-uri-git.sh',
+ 't5732-protocol-v2-bundle-uri-http.sh',
+ 't5750-bundle-uri-parse.sh',
+ 't5801-remote-helpers.sh',
+ 't5802-connect-helper.sh',
+ 't5810-proto-disable-local.sh',
+ 't5811-proto-disable-git.sh',
+ 't5812-proto-disable-http.sh',
+ 't5813-proto-disable-ssh.sh',
+ 't5814-proto-disable-ext.sh',
+ 't5815-submodule-protos.sh',
+ 't5900-repo-selection.sh',
+ 't6000-rev-list-misc.sh',
+ 't6001-rev-list-graft.sh',
+ 't6002-rev-list-bisect.sh',
+ 't6003-rev-list-topo-order.sh',
+ 't6004-rev-list-path-optim.sh',
+ 't6005-rev-list-count.sh',
+ 't6006-rev-list-format.sh',
+ 't6007-rev-list-cherry-pick-file.sh',
+ 't6008-rev-list-submodule.sh',
+ 't6009-rev-list-parent.sh',
+ 't6010-merge-base.sh',
+ 't6011-rev-list-with-bad-commit.sh',
+ 't6012-rev-list-simplify.sh',
+ 't6013-rev-list-reverse-parents.sh',
+ 't6014-rev-list-all.sh',
+ 't6016-rev-list-graph-simplify-history.sh',
+ 't6017-rev-list-stdin.sh',
+ 't6018-rev-list-glob.sh',
+ 't6019-rev-list-ancestry-path.sh',
+ 't6020-bundle-misc.sh',
+ 't6021-rev-list-exclude-hidden.sh',
+ 't6022-rev-list-missing.sh',
+ 't6030-bisect-porcelain.sh',
+ 't6040-tracking-info.sh',
+ 't6041-bisect-submodule.sh',
+ 't6050-replace.sh',
+ 't6060-merge-index.sh',
+ 't6100-rev-list-in-order.sh',
+ 't6101-rev-parse-parents.sh',
+ 't6102-rev-list-unexpected-objects.sh',
+ 't6110-rev-list-sparse.sh',
+ 't6111-rev-list-treesame.sh',
+ 't6112-rev-list-filters-objects.sh',
+ 't6113-rev-list-bitmap-filters.sh',
+ 't6114-keep-packs.sh',
+ 't6115-rev-list-du.sh',
+ 't6120-describe.sh',
+ 't6130-pathspec-noglob.sh',
+ 't6131-pathspec-icase.sh',
+ 't6132-pathspec-exclude.sh',
+ 't6133-pathspec-rev-dwim.sh',
+ 't6134-pathspec-in-submodule.sh',
+ 't6135-pathspec-with-attrs.sh',
+ 't6136-pathspec-in-bare.sh',
+ 't6200-fmt-merge-msg.sh',
+ 't6300-for-each-ref.sh',
+ 't6301-for-each-ref-errors.sh',
+ 't6302-for-each-ref-filter.sh',
+ 't6400-merge-df.sh',
+ 't6401-merge-criss-cross.sh',
+ 't6402-merge-rename.sh',
+ 't6403-merge-file.sh',
+ 't6404-recursive-merge.sh',
+ 't6405-merge-symlinks.sh',
+ 't6406-merge-attr.sh',
+ 't6407-merge-binary.sh',
+ 't6408-merge-up-to-date.sh',
+ 't6409-merge-subtree.sh',
+ 't6411-merge-filemode.sh',
+ 't6412-merge-large-rename.sh',
+ 't6413-merge-crlf.sh',
+ 't6414-merge-rename-nocruft.sh',
+ 't6415-merge-dir-to-symlink.sh',
+ 't6416-recursive-corner-cases.sh',
+ 't6417-merge-ours-theirs.sh',
+ 't6418-merge-text-auto.sh',
+ 't6419-merge-ignorecase.sh',
+ 't6421-merge-partial-clone.sh',
+ 't6422-merge-rename-corner-cases.sh',
+ 't6423-merge-rename-directories.sh',
+ 't6424-merge-unrelated-index-changes.sh',
+ 't6425-merge-rename-delete.sh',
+ 't6426-merge-skip-unneeded-updates.sh',
+ 't6427-diff3-conflict-markers.sh',
+ 't6428-merge-conflicts-sparse.sh',
+ 't6429-merge-sequence-rename-caching.sh',
+ 't6430-merge-recursive.sh',
+ 't6431-merge-criscross.sh',
+ 't6432-merge-recursive-space-options.sh',
+ 't6433-merge-toplevel.sh',
+ 't6434-merge-recursive-rename-options.sh',
+ 't6435-merge-sparse.sh',
+ 't6436-merge-overwrite.sh',
+ 't6437-submodule-merge.sh',
+ 't6438-submodule-directory-file-conflicts.sh',
+ 't6439-merge-co-error-msgs.sh',
+ 't6500-gc.sh',
+ 't6501-freshen-objects.sh',
+ 't6600-test-reach.sh',
+ 't6700-tree-depth.sh',
+ 't7001-mv.sh',
+ 't7002-mv-sparse-checkout.sh',
+ 't7003-filter-branch.sh',
+ 't7004-tag.sh',
+ 't7005-editor.sh',
+ 't7006-pager.sh',
+ 't7007-show.sh',
+ 't7008-filter-branch-null-sha1.sh',
+ 't7010-setup.sh',
+ 't7011-skip-worktree-reading.sh',
+ 't7012-skip-worktree-writing.sh',
+ 't7030-verify-tag.sh',
+ 't7031-verify-tag-signed-ssh.sh',
+ 't7060-wtstatus.sh',
+ 't7061-wtstatus-ignore.sh',
+ 't7062-wtstatus-ignorecase.sh',
+ 't7063-status-untracked-cache.sh',
+ 't7064-wtstatus-pv2.sh',
+ 't7101-reset-empty-subdirs.sh',
+ 't7102-reset.sh',
+ 't7103-reset-bare.sh',
+ 't7104-reset-hard.sh',
+ 't7105-reset-patch.sh',
+ 't7106-reset-unborn-branch.sh',
+ 't7107-reset-pathspec-file.sh',
+ 't7110-reset-merge.sh',
+ 't7111-reset-table.sh',
+ 't7112-reset-submodule.sh',
+ 't7113-post-index-change-hook.sh',
+ 't7201-co.sh',
+ 't7300-clean.sh',
+ 't7301-clean-interactive.sh',
+ 't7400-submodule-basic.sh',
+ 't7401-submodule-summary.sh',
+ 't7402-submodule-rebase.sh',
+ 't7403-submodule-sync.sh',
+ 't7406-submodule-update.sh',
+ 't7407-submodule-foreach.sh',
+ 't7408-submodule-reference.sh',
+ 't7409-submodule-detached-work-tree.sh',
+ 't7411-submodule-config.sh',
+ 't7412-submodule-absorbgitdirs.sh',
+ 't7413-submodule-is-active.sh',
+ 't7414-submodule-mistakes.sh',
+ 't7416-submodule-dash-url.sh',
+ 't7417-submodule-path-url.sh',
+ 't7418-submodule-sparse-gitmodules.sh',
+ 't7419-submodule-set-branch.sh',
+ 't7420-submodule-set-url.sh',
+ 't7421-submodule-summary-add.sh',
+ 't7422-submodule-output.sh',
+ 't7423-submodule-symlinks.sh',
+ 't7424-submodule-mixed-ref-formats.sh',
+ 't7450-bad-git-dotfiles.sh',
+ 't7500-commit-template-squash-signoff.sh',
+ 't7501-commit-basic-functionality.sh',
+ 't7502-commit-porcelain.sh',
+ 't7503-pre-commit-and-pre-merge-commit-hooks.sh',
+ 't7504-commit-msg-hook.sh',
+ 't7505-prepare-commit-msg-hook.sh',
+ 't7506-status-submodule.sh',
+ 't7507-commit-verbose.sh',
+ 't7508-status.sh',
+ 't7509-commit-authorship.sh',
+ 't7510-signed-commit.sh',
+ 't7511-status-index.sh',
+ 't7512-status-help.sh',
+ 't7513-interpret-trailers.sh',
+ 't7514-commit-patch.sh',
+ 't7515-status-symlinks.sh',
+ 't7516-commit-races.sh',
+ 't7517-per-repo-email.sh',
+ 't7518-ident-corner-cases.sh',
+ 't7519-status-fsmonitor.sh',
+ 't7520-ignored-hook-warning.sh',
+ 't7521-ignored-mode.sh',
+ 't7524-commit-summary.sh',
+ 't7525-status-rename.sh',
+ 't7526-commit-pathspec-file.sh',
+ 't7527-builtin-fsmonitor.sh',
+ 't7528-signed-commit-ssh.sh',
+ 't7600-merge.sh',
+ 't7601-merge-pull-config.sh',
+ 't7602-merge-octopus-many.sh',
+ 't7603-merge-reduce-heads.sh',
+ 't7604-merge-custom-message.sh',
+ 't7605-merge-resolve.sh',
+ 't7606-merge-custom.sh',
+ 't7607-merge-state.sh',
+ 't7608-merge-messages.sh',
+ 't7609-mergetool--lib.sh',
+ 't7610-mergetool.sh',
+ 't7611-merge-abort.sh',
+ 't7612-merge-verify-signatures.sh',
+ 't7614-merge-signoff.sh',
+ 't7615-diff-algo-with-mergy-operations.sh',
+ 't7700-repack.sh',
+ 't7701-repack-unpack-unreachable.sh',
+ 't7702-repack-cyclic-alternate.sh',
+ 't7703-repack-geometric.sh',
+ 't7704-repack-cruft.sh',
+ 't7800-difftool.sh',
+ 't7810-grep.sh',
+ 't7811-grep-open.sh',
+ 't7812-grep-icase-non-ascii.sh',
+ 't7813-grep-icase-iso.sh',
+ 't7814-grep-recurse-submodules.sh',
+ 't7815-grep-binary.sh',
+ 't7816-grep-binary-pattern.sh',
+ 't7817-grep-sparse-checkout.sh',
+ 't7900-maintenance.sh',
+ 't8001-annotate.sh',
+ 't8002-blame.sh',
+ 't8003-blame-corner-cases.sh',
+ 't8004-blame-with-conflicts.sh',
+ 't8005-blame-i18n.sh',
+ 't8006-blame-textconv.sh',
+ 't8007-cat-file-textconv.sh',
+ 't8008-blame-formats.sh',
+ 't8009-blame-vs-topicbranches.sh',
+ 't8010-cat-file-filters.sh',
+ 't8011-blame-split-file.sh',
+ 't8012-blame-colors.sh',
+ 't8013-blame-ignore-revs.sh',
+ 't8014-blame-ignore-fuzzy.sh',
+ 't9001-send-email.sh',
+ 't9002-column.sh',
+ 't9003-help-autocorrect.sh',
+ 't9100-git-svn-basic.sh',
+ 't9101-git-svn-props.sh',
+ 't9102-git-svn-deep-rmdir.sh',
+ 't9103-git-svn-tracked-directory-removed.sh',
+ 't9104-git-svn-follow-parent.sh',
+ 't9105-git-svn-commit-diff.sh',
+ 't9106-git-svn-commit-diff-clobber.sh',
+ 't9107-git-svn-migrate.sh',
+ 't9108-git-svn-glob.sh',
+ 't9109-git-svn-multi-glob.sh',
+ 't9110-git-svn-use-svm-props.sh',
+ 't9111-git-svn-use-svnsync-props.sh',
+ 't9112-git-svn-md5less-file.sh',
+ 't9113-git-svn-dcommit-new-file.sh',
+ 't9114-git-svn-dcommit-merge.sh',
+ 't9115-git-svn-dcommit-funky-renames.sh',
+ 't9116-git-svn-log.sh',
+ 't9117-git-svn-init-clone.sh',
+ 't9118-git-svn-funky-branch-names.sh',
+ 't9119-git-svn-info.sh',
+ 't9120-git-svn-clone-with-percent-escapes.sh',
+ 't9121-git-svn-fetch-renamed-dir.sh',
+ 't9122-git-svn-author.sh',
+ 't9123-git-svn-rebuild-with-rewriteroot.sh',
+ 't9124-git-svn-dcommit-auto-props.sh',
+ 't9125-git-svn-multi-glob-branch-names.sh',
+ 't9126-git-svn-follow-deleted-readded-directory.sh',
+ 't9127-git-svn-partial-rebuild.sh',
+ 't9128-git-svn-cmd-branch.sh',
+ 't9129-git-svn-i18n-commitencoding.sh',
+ 't9130-git-svn-authors-file.sh',
+ 't9131-git-svn-empty-symlink.sh',
+ 't9132-git-svn-broken-symlink.sh',
+ 't9133-git-svn-nested-git-repo.sh',
+ 't9134-git-svn-ignore-paths.sh',
+ 't9135-git-svn-moved-branch-empty-file.sh',
+ 't9136-git-svn-recreated-branch-empty-file.sh',
+ 't9137-git-svn-dcommit-clobber-series.sh',
+ 't9138-git-svn-authors-prog.sh',
+ 't9139-git-svn-non-utf8-commitencoding.sh',
+ 't9140-git-svn-reset.sh',
+ 't9141-git-svn-multiple-branches.sh',
+ 't9142-git-svn-shallow-clone.sh',
+ 't9143-git-svn-gc.sh',
+ 't9144-git-svn-old-rev_map.sh',
+ 't9145-git-svn-master-branch.sh',
+ 't9146-git-svn-empty-dirs.sh',
+ 't9147-git-svn-include-paths.sh',
+ 't9148-git-svn-propset.sh',
+ 't9150-svk-mergetickets.sh',
+ 't9151-svn-mergeinfo.sh',
+ 't9152-svn-empty-dirs-after-gc.sh',
+ 't9153-git-svn-rewrite-uuid.sh',
+ 't9154-git-svn-fancy-glob.sh',
+ 't9155-git-svn-fetch-deleted-tag.sh',
+ 't9156-git-svn-fetch-deleted-tag-2.sh',
+ 't9157-git-svn-fetch-merge.sh',
+ 't9158-git-svn-mergeinfo.sh',
+ 't9159-git-svn-no-parent-mergeinfo.sh',
+ 't9160-git-svn-preserve-empty-dirs.sh',
+ 't9161-git-svn-mergeinfo-push.sh',
+ 't9162-git-svn-dcommit-interactive.sh',
+ 't9163-git-svn-reset-clears-caches.sh',
+ 't9164-git-svn-dcommit-concurrent.sh',
+ 't9165-git-svn-fetch-merge-branch-of-branch.sh',
+ 't9166-git-svn-fetch-merge-branch-of-branch2.sh',
+ 't9167-git-svn-cmd-branch-subproject.sh',
+ 't9168-git-svn-partially-globbed-names.sh',
+ 't9169-git-svn-dcommit-crlf.sh',
+ 't9200-git-cvsexportcommit.sh',
+ 't9210-scalar.sh',
+ 't9211-scalar-clone.sh',
+ 't9300-fast-import.sh',
+ 't9301-fast-import-notes.sh',
+ 't9302-fast-import-unpack-limit.sh',
+ 't9303-fast-import-compression.sh',
+ 't9304-fast-import-marks.sh',
+ 't9350-fast-export.sh',
+ 't9351-fast-export-anonymize.sh',
+ 't9400-git-cvsserver-server.sh',
+ 't9401-git-cvsserver-crlf.sh',
+ 't9402-git-cvsserver-refs.sh',
+ 't9500-gitweb-standalone-no-errors.sh',
+ 't9501-gitweb-standalone-http-status.sh',
+ 't9502-gitweb-standalone-parse-output.sh',
+ 't9600-cvsimport.sh',
+ 't9601-cvsimport-vendor-branch.sh',
+ 't9602-cvsimport-branches-tags.sh',
+ 't9603-cvsimport-patchsets.sh',
+ 't9604-cvsimport-timestamps.sh',
+ 't9700-perl-git.sh',
+ 't9800-git-p4-basic.sh',
+ 't9801-git-p4-branch.sh',
+ 't9802-git-p4-filetype.sh',
+ 't9803-git-p4-shell-metachars.sh',
+ 't9804-git-p4-label.sh',
+ 't9805-git-p4-skip-submit-edit.sh',
+ 't9806-git-p4-options.sh',
+ 't9807-git-p4-submit.sh',
+ 't9808-git-p4-chdir.sh',
+ 't9809-git-p4-client-view.sh',
+ 't9810-git-p4-rcs.sh',
+ 't9811-git-p4-label-import.sh',
+ 't9812-git-p4-wildcards.sh',
+ 't9813-git-p4-preserve-users.sh',
+ 't9814-git-p4-rename.sh',
+ 't9815-git-p4-submit-fail.sh',
+ 't9816-git-p4-locked.sh',
+ 't9817-git-p4-exclude.sh',
+ 't9818-git-p4-block.sh',
+ 't9819-git-p4-case-folding.sh',
+ 't9820-git-p4-editor-handling.sh',
+ 't9821-git-p4-path-variations.sh',
+ 't9822-git-p4-path-encoding.sh',
+ 't9823-git-p4-mock-lfs.sh',
+ 't9824-git-p4-git-lfs.sh',
+ 't9825-git-p4-handle-utf16-without-bom.sh',
+ 't9826-git-p4-keep-empty-commits.sh',
+ 't9827-git-p4-change-filetype.sh',
+ 't9828-git-p4-map-user.sh',
+ 't9829-git-p4-jobs.sh',
+ 't9830-git-p4-symlink-dir.sh',
+ 't9831-git-p4-triggers.sh',
+ 't9832-unshelve.sh',
+ 't9833-errors.sh',
+ 't9834-git-p4-file-dir-bug.sh',
+ 't9835-git-p4-metadata-encoding-python2.sh',
+ 't9836-git-p4-metadata-encoding-python3.sh',
+ 't9850-shell.sh',
+ 't9901-git-web--browse.sh',
+ 't9902-completion.sh',
+ 't9903-bash-prompt.sh',
+]
+
+# GIT_BUILD_DIR needs to be Unix-style without drive prefixes as it 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 it.
+git_build_dir = meson.project_build_root()
+if cygpath.found()
+ git_build_dir = run_command(cygpath, git_build_dir, check: true).stdout().strip()
+endif
+
+test_environment = script_environment
+test_environment.set('GIT_BUILD_DIR', git_build_dir)
+
+foreach integration_test : integration_tests
+ test(fs.stem(integration_test), shell,
+ args: [ integration_test ],
+ workdir: meson.current_source_dir(),
+ env: test_environment,
+ depends: test_dependencies + bin_wrappers,
+ timeout: 0,
+ )
+endforeach
diff --git a/templates/hooks/meson.build b/templates/hooks/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..f948b9fb1453933f5648cbdc815135e634ff8cc6
--- /dev/null
+++ b/templates/hooks/meson.build
@@ -0,0 +1,24 @@
+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,
+ )
+endforeach
diff --git a/templates/info/meson.build b/templates/info/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..1a2f2f84d2f3067fc47f37eb1439cf21c7f25f06
--- /dev/null
+++ b/templates/info/meson.build
@@ -0,0 +1,5 @@
+configure_file(
+ input: 'exclude',
+ output: 'exclude',
+ configuration: template_config,
+)
diff --git a/templates/meson.build b/templates/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..010b9ef6d3a025d42931d84c2cd7d66c42cdf955
--- /dev/null
+++ b/templates/meson.build
@@ -0,0 +1,13 @@
+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,
+)
+
+subdir('hooks')
+subdir('info')
--
2.47.0.251.gb31fb630c0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH RFC v6 19/19] meson: fix conflicts with in-flight topics
2024-11-12 17:02 ` [PATCH RFC v6 " Patrick Steinhardt
` (17 preceding siblings ...)
2024-11-12 17:03 ` [PATCH RFC v6 18/19] Introduce support for the Meson build system Patrick Steinhardt
@ 2024-11-12 17:03 ` Patrick Steinhardt
2024-11-13 3:30 ` [-SPAM-] [PATCH RFC v6 00/19] Modernize the build system Ramsay Jones
2024-11-13 10:45 ` Christian Couder
20 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-12 17:03 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King
As support for Meson is still in-flight we have to accommodate for
conflicts with topics in "seen". The following conflicts are being
addressed in this commit:
- ej/cat-file-remote-object-info adds t1017 and "fetch-object-info.c".
- cc/promisor-remote-capability adds t5710.
- ds/path-walk adds t6601 as well as "path-walk.c" and
"test-path-walk.c".
- ps/reftable-detach adds "reftable/system.c".
- js/libgit-rust adds "common-exit.c" and "common-init.c".
- ps/clar-build-improvement adapts the awk(1) script that generates
"clar.suites" to instead be a shell script.
- ds/full-name-hash adds "t/helper/test-name-hash.c".
- cw/worktree-extension deletes t2408.
This is somewhat painful in the current state where Meson is not yet
part of the main tree, but we'll have to live with that for the time
being.
I've split this commit out into a separate fixup-style commit such that
it is possible to test this topic both with and without "seen" merged
into it. You can simply revert this commit to test without "seen".
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
meson.build | 5 +++++
t/helper/meson.build | 2 ++
t/meson.build | 9 +++++----
3 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/meson.build b/meson.build
index 58f131bdb0e388697ca1b3455945239ad6343af2..321e681f8bd75984dac80102ea4cc85d44c76d80 100644
--- a/meson.build
+++ b/meson.build
@@ -220,6 +220,8 @@ libgit_sources = [
'commit-graph.c',
'commit-reach.c',
'commit.c',
+ 'common-exit.c',
+ 'common-init.c',
'compat/nonblock.c',
'compat/obstack.c',
'compat/terminal.c',
@@ -258,6 +260,7 @@ libgit_sources = [
'ewah/ewah_rlw.c',
'exec-cmd.c',
'fetch-negotiator.c',
+ 'fetch-object-info.c',
'fetch-pack.c',
'fmt-merge-msg.c',
'fsck.c',
@@ -332,6 +335,7 @@ libgit_sources = [
'parse-options.c',
'patch-delta.c',
'patch-ids.c',
+ 'path-walk.c',
'path.c',
'pathspec.c',
'pkt-line.c',
@@ -372,6 +376,7 @@ libgit_sources = [
'reftable/reader.c',
'reftable/record.c',
'reftable/stack.c',
+ 'reftable/system.c',
'reftable/tree.c',
'reftable/writer.c',
'remote.c',
diff --git a/t/helper/meson.build b/t/helper/meson.build
index 5e83884246edc7841738de5085f3255aa1fa3fbe..1d6154ce9756db17bc9f69bc3cd71a32b93857c5 100644
--- a/t/helper/meson.build
+++ b/t/helper/meson.build
@@ -34,12 +34,14 @@ test_tool_sources = [
'test-match-trees.c',
'test-mergesort.c',
'test-mktemp.c',
+ 'test-name-hash.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-path-walk.c',
'test-pcre2-config.c',
'test-pkt-line.c',
'test-proc-receive.c',
diff --git a/t/meson.build b/t/meson.build
index 9ec0b7fa34a033d508448dbd56ab2322a5106fd0..8f0ba136eeb0558f866d7fd3f0559d94139d4777 100644
--- a/t/meson.build
+++ b/t/meson.build
@@ -19,9 +19,8 @@ clar_sources += clar_decls_h
clar_sources += custom_target(
input: clar_decls_h,
output: 'clar.suite',
- feed: true,
- capture: true,
- command : [awk, '-f', meson.current_source_dir() + '/unit-tests/clar-generate.awk'],
+ command : [shell, meson.current_source_dir() + '/unit-tests/generate-clar-suites.sh', '@INPUT@', '@OUTPUT@'],
+ env: script_environment,
)
clar_unit_tests = executable('unit-tests',
@@ -168,6 +167,7 @@ integration_tests = [
't1014-read-tree-confusing.sh',
't1015-read-index-unmerged.sh',
't1016-compatObjectFormat.sh',
+ 't1017-cat-file-remote-object-info.sh',
't1020-subdirectory.sh',
't1021-rerere-in-workdir.sh',
't1022-read-tree-partial-clone.sh',
@@ -297,7 +297,6 @@ integration_tests = [
't2405-worktree-submodule.sh',
't2406-worktree-repair.sh',
't2407-worktree-heads.sh',
- 't2408-worktree-relative.sh',
't2500-untracked-overwriting.sh',
't2501-cwd-empty.sh',
't3000-ls-files-others.sh',
@@ -719,6 +718,7 @@ integration_tests = [
't5703-upload-pack-ref-in-want.sh',
't5704-protocol-violations.sh',
't5705-session-id-in-capabilities.sh',
+ 't5710-promisor-remote-capability.sh',
't5730-protocol-v2-bundle-uri-file.sh',
't5731-protocol-v2-bundle-uri-git.sh',
't5732-protocol-v2-bundle-uri-http.sh',
@@ -821,6 +821,7 @@ integration_tests = [
't6500-gc.sh',
't6501-freshen-objects.sh',
't6600-test-reach.sh',
+ 't6601-path-walk.sh',
't6700-tree-depth.sh',
't7001-mv.sh',
't7002-mv-sparse-checkout.sh',
--
2.47.0.251.gb31fb630c0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v5 00/19] Modernize the build system
2024-11-11 15:30 ` [RFC PATCH v5 " Patrick Steinhardt
` (18 preceding siblings ...)
2024-11-11 15:31 ` [RFC PATCH v5 19/19] meson: fix conflicts with in-flight topics Patrick Steinhardt
@ 2024-11-13 3:10 ` Ramsay Jones
19 siblings, 0 replies; 386+ messages in thread
From: Ramsay Jones @ 2024-11-13 3:10 UTC (permalink / raw)
To: Patrick Steinhardt, git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Taylor Blau, David Aguilar
On 11/11/2024 15:30, Patrick Steinhardt wrote:
> Hi,
>
> this is the fourth version of my patch series that modernizes our build
> system. It refactors various parts of it to make it possible to perform
> out-of-tree builds in theory and then wires up Meson.
>
> Changes compared to v4:
>
> - Improve our CMake build instructions tot use `SH_EXE` to execute
> scripts.
>
> - Create Perl build directories in our CMake build instructions.
>
> - Remove superfluous use of basename(1).
>
> - Remove timeout for unit tests in Meson.
I tested this version, without issue, on Linux and cygwin (build not test)
ATB,
Ramsay Jones
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [-SPAM-] [PATCH RFC v6 00/19] Modernize the build system
2024-11-12 17:02 ` [PATCH RFC v6 " Patrick Steinhardt
` (18 preceding siblings ...)
2024-11-12 17:03 ` [PATCH RFC v6 19/19] meson: fix conflicts with in-flight topics Patrick Steinhardt
@ 2024-11-13 3:30 ` Ramsay Jones
2024-11-13 13:24 ` Patrick Steinhardt
2024-11-13 10:45 ` Christian Couder
20 siblings, 1 reply; 386+ messages in thread
From: Ramsay Jones @ 2024-11-13 3:30 UTC (permalink / raw)
To: Patrick Steinhardt, git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Taylor Blau, David Aguilar, Jeff King
On 12/11/2024 17:02, Patrick Steinhardt wrote:
> Hi,
>
> this patch series modernizes our build infrasturcture. It refactors
> various parts of it to make it possible to perform out-of-tree builds in
> theory.
>
> The series then continues to wire up Meson as a proposed alternative as
> a modern replacement for our current build systems. It provides better
> integration into IDEs than our Makefiles, better usability than our
> Makefiles and CMake, better configuration and discoverability thereof
> than autoconf and CMake (which is of course my personal opinion).
>
> The intent is to have Meson replace autoconf, which is mostly unused and
> broken. Eventually, the plan would to also replace CMake and our
> Makefiles in case we figure out that this replacement is indeed a net
> benefit for the project, but all of this would happen over the course of
> multiple releases.
>
> Changes in v6:
>
> - Add documentation for how to use Meson.
>
> - Fix compilation in case libintl exists, but required tools like
> msgfmt and related don't. Instead of failing, we now automatically
> compile with the equivalent of NO_GETTEXT=YesPlease.
>
> - Update last patch that fixes semantic merge conflics with in-flight
> topics in "seen".
>
> - I've changed the series to be based on "master" at b31fb630c0 (Merge
> https://github.com/j6t/git-gui, 2024-11-11) as all prereqs of this
> series have since landed. This doesn't make any difference though
> as there aren't any merge conflicts or additional changes caused by
> this. I mostly mention this so that there is no confusion around the
> changed base commit.
>
Tested this version, without issue, on Linux and cygwin (build + test).
On cygwin, the unit test now no longer times out:
$ cd git/build
$ tail test-out
1030/1030 t9902-completion OK 114.74s
Ok: 1030
Expected Fail: 0
Fail: 0
Unexpected Pass: 0
Skipped: 0
Timeout: 0
Full log written to /home/ramsay/git/build/meson-logs/testlog.txt
$
Having said that, I was expecting to see an 'Unexpected Pass', since
meson decides to not set NO_REGEX. (The 'make' build on cygwin will
set 'NO_REGEX = UnfortunatelyYes' in the config.mak.uname).
In the meson-logs/testlog.txt file, for the t7815-grep-binary.sh test
stdout, we find:
----------------------------------- stdout -----------------------------------
ok 1 - setup
ok 2 - git grep ina a
ok 3 - git grep -ah ina a
ok 4 - git grep -I ina a
ok 5 - git grep -c ina a
ok 6 - git grep -l ina a
ok 7 - git grep -L bar a
ok 8 - git grep -q ina a
ok 9 - git grep -F ile a
ok 10 - git grep -Fi iLE a
ok 11 - git grep ile a
ok 12 - git grep .fi a # TODO known breakage vanished
ok 13 - grep respects binary diff attribute
ok 14 - grep --cached respects binary diff attribute
ok 15 - grep --cached respects binary diff attribute (2)
ok 16 - grep revision respects binary diff attribute
ok 17 - grep respects not-binary diff attribute
ok 18 - setup textconv filters
ok 19 - grep does not honor textconv
ok 20 - grep --textconv honors textconv
ok 21 - grep --no-textconv does not honor textconv
ok 22 - grep --textconv blob honors textconv
# 1 known breakage(s) vanished; please update test(s)
# passed all remaining 21 test(s)
1..22
==============================================================================
Note the 'TODO known breakage vanished' on test 12.
Setting NO_REGEX on cygwin is for 'reasons' (not necessarily good) and we
need a way to override it's decision here. (In general, we need to be able
to use *any* of the many build variables to override meson's automatic
setting of these build variables).
Thanks!
ATB,
Ramsay Jones
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [PATCH RFC v6 18/19] Introduce support for the Meson build system
2024-11-12 17:03 ` [PATCH RFC v6 18/19] Introduce support for the Meson build system Patrick Steinhardt
@ 2024-11-13 6:47 ` Junio C Hamano
2024-11-13 13:24 ` Patrick Steinhardt
2024-11-13 16:30 ` Phillip Wood
1 sibling, 1 reply; 386+ messages in thread
From: Junio C Hamano @ 2024-11-13 6:47 UTC (permalink / raw)
To: Patrick Steinhardt
Cc: git, Eli Schwartz, Eric Sunshine, Phillip Wood, Ramsay Jones,
Taylor Blau, David Aguilar, Jeff King
Patrick Steinhardt <ps@pks.im> writes:
> +# # Disable features based on Python
> +# $ meson configure -Dpython=disabled
> +#
> +# # Disable features based on Python
> +# $ meson configure -Dpython=disabled
These are dups, right?
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [PATCH RFC v6 01/19] Makefile: use common template for GIT-BUILD-OPTIONS
2024-11-12 17:02 ` [PATCH RFC v6 01/19] Makefile: use common template for GIT-BUILD-OPTIONS Patrick Steinhardt
@ 2024-11-13 7:13 ` Junio C Hamano
2024-11-13 13:24 ` Patrick Steinhardt
0 siblings, 1 reply; 386+ messages in thread
From: Junio C Hamano @ 2024-11-13 7:13 UTC (permalink / raw)
To: Patrick Steinhardt
Cc: git, Eli Schwartz, Eric Sunshine, Phillip Wood, Ramsay Jones,
Taylor Blau, David Aguilar, Jeff King
Patrick Steinhardt <ps@pks.im> writes:
> Note that this change requires us to move around the setup of
> TEST_OUTPUT_DIRECTORY in "test-lib.sh" such that it comes after sourcing
> the "GIT-BUILD-OPTIONS" file. This is the only instance I could find
> where we rely on ordering on variables.
Doesn't this change break those who use the TEST_OUTPUT_DIRECTORY
environment variable as a mechanism to override where the ouput is
sent? E.g.,
$ cd t && TEST_OUTPUT_DIRECTORY=/else/where sh t1000-read-tree-m-3way.sh
They do not necessarily want their output directory affected by the
value that was in TEST_OUTPUT_DIRECTORY when $(MAKE) was run the
last time.
...
> -if test -z "$TEST_OUTPUT_DIRECTORY"
> -then
> - # Similarly, override this to store the test-results subdir
> - # elsewhere
> - TEST_OUTPUT_DIRECTORY=$TEST_DIRECTORY
> -fi
> GIT_BUILD_DIR="${TEST_DIRECTORY%/t}"
> if test "$TEST_DIRECTORY" = "$GIT_BUILD_DIR"
> then
> @@ -100,6 +94,13 @@ fi
> . "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
> export PERL_PATH SHELL_PATH
>
> +if test -z "$TEST_OUTPUT_DIRECTORY"
> +then
> + # Similarly, override this to store the test-results subdir
> + # elsewhere
> + TEST_OUTPUT_DIRECTORY=$TEST_DIRECTORY
> +fi
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v4 00/19] Modernize the build system
2024-11-11 10:36 ` Patrick Steinhardt
2024-11-11 21:48 ` Eli Schwartz
@ 2024-11-13 9:21 ` David Aguilar
2024-11-13 13:29 ` Patrick Steinhardt
` (2 more replies)
1 sibling, 3 replies; 386+ messages in thread
From: David Aguilar @ 2024-11-13 9:21 UTC (permalink / raw)
To: Patrick Steinhardt
Cc: Taylor Blau, git, Eli Schwartz, Eric Sunshine, Phillip Wood,
Junio C Hamano, Ramsay Jones, Jeff King
On Mon, Nov 11, 2024 at 11:36:34AM +0100, Patrick Steinhardt wrote:
> On Sat, Nov 09, 2024 at 04:58:56AM -0800, David Aguilar wrote:
> > That said, if we mean, "Linux/Unix-savvy New Contributors," then
> > I can understand why Meson might be a favorite, and perhaps this
> > might be the crowd we are looking to target [...]
>
> My goal is to not only make things easier to use for Linux users, but
> also for users on other platforms like Windows while also catering to
> the typical developer of Git and making the solution for them as tasty
> as possible.
>
> I agree that CMake is a tad easier to use and set up on Windows, mostly
> because it is directly integrated into MSVC. But I also think that CMake
> is a harder sell towards the power users because it is comparatively
> hard to maintain due to its somewhat arcane syntax, implicit variables
> and things like this.
>
> So I'm basically trying to find a good middle ground where all of the
> respective target audiences get benefit:
>
> - For Unix devs I think that Meson is easier to maintain and use
> compared to CMake. We also get nice features like out-of-source
> builds, good integration with the test suite and easy integration
> with IDEs.
>
> - For Windows devs we have an officially supported way to build Meson
> from MSVC and co. Also, subprojects allow us to have as easy story
> for how to build Git without preinstalled dependencies, which is not
> currently possible with CMake to the best of my knowledge.
>
> - For packagers I think that Meson provides better discoverability of
> options than CMake.
>
> So Meson may not be the perfect solution for everyone of these target
> audiences, and better solutions may exist to cater specific needs. But
> it provides a net benefit for every single one of these audiences from
> my point of view. And when taking the benefits for all target audiences
> combined I think that Meson provides the bigger win compared to CMake.
Thanks for clarifying. Not that it matters, but you've convinced me.
Constructive criticism follows below in the hope that it can help you
further harden the arguments for Meson.
> > > Patrick Steinhardt wrote:
> > > > - Packagers. This is another group of people that would benefit from
> > > > my point of view. This is mostly because Meson has certain standards
> > > > for how to approach problems, and thus the packager would know for
> > > > how to handle things. They don't have to manually track build
> > > > options and changes thereof, as these can be easily discovered and
> > > > because Meson will error out in case invalid options are passed.
> >
> > CMake's option() variables and its GNUInstallDirs module pretty much
> > handles all of the standardization that packagers are looking for on
> > this front, so this argument doesn't push the needle towards Meson over
> > CMake from my perspective.
>
> I think that discoverability of Meson is way better. Here you can simply
> say `meson configure` and it provides you a nice list of all options
> that are available. For CMake it always used to be a big pain.
The pain of discovering options with CMake is true in the general case.
A specific project can enforce conventions so that all option()s are
specified at the top of the main build script or a designated file
specifically for options. That would trivially make the options easily
discoverable in that there's only a single place to look, but that's
nowhere near the rigor that Meson enforces.
Following a sensible convention is why I didn't originally vibe with the
argument that option()s are insufficient, but that would merely be one
project's conventions and is by no means a universal practice.
Elsewhere in this thread it was also mentioned that unknown options are
blindly accepted by CMake. That's actually not true.
While it's not as rigorous as Meson because it doesn't error out by
default, CMake does issue a warning when you specify variables/options
that are not used by the project. IIRC this warning can be made into an
error by using the "cmake -Werror=dev" option, but I appreciate Meson
taking the stricter route as it results in better overall usability.
> > > Taylor Blau wrote:
> > > I appreciate your thoughtful response to my concerns here. Please feel
> > > free to correct me if I am wrong, but I think the bulk of your argument
> > > is captured fairly well by these three points, so I want to focus my
> > > response here.
> > >
> > > Responding in turn, I think my feeling is something like:
> > >
> > > - Long-time Git contributors are going to be the ones who will most
> > > frequently use the new build system. I am definitely sympathetic to
> > > getting too comfortable with our existing tools, but so far in your
> > > response I have not seen a compelling reason to switch the project
> > > to use Meson.
> >
> > Likewise, I have not seen a compelling reason to not focus the
> > effort on CMake instead. In other words, why not enhance the current
> > status quo (Make + CMake) instead of trying to replace it?
>
> As mentioned above, I mostly think that Meson makes for a more
> compelling overall package. That being said, if we eventually come to
> the conclusion that we as a community want CMake instead of Meson, then
> I am willing to go there.
I hope that's not where things land because the separation of
configuration vs. build steps does provide a benefit in day-to-day use
(specifically, faster incremental builds) due to the clean separation
of the configuration and build steps.
It seems like it would be nice if the Meson build were eventually
hooked up so that we can continue typing "make prefix=... install"
(perhaps through an opt-in "enable meson" variable) and the Makefile
would handle driving Meson + Ninja, but that's probably an untenable
feature given the complexity of the current Makefile.
If the Makefile were completely replaced one day then that would be
a nice to have, but it would probably be a bad crutch because the
natural tendency would be to shadow all of Meson's options behind
Makefile knobs. Encouraging users to just run meson directly
seems like a better overall situation. Bisecting is the only
reason why something like that might seem appealing, but
I probably wouldn't push for it myself and maybe there's a better
way to handle that when we cross that bridge.
> > > * New contributors do not interact with build system internals
> > > nearly as much as more experienced contributors. I would imagine
> > > that the vast majority of those interactions are simply running
> > > "make" or "make test".
> > >
> > > You mention a handful of other niceties that Meson provides,
> > > like language server support, but I am not sure that I agree
> > > those are (a) the responsibility of the build system to provide,
> > > or (b) that those needs aren't already well met by the vast
> > > number of existing tools and IDE integrations that can work with
> > > ctags.
> >
> > CMake has all of these same bells and whistles, and it's already present
> > in git.git. LSP support just means being able to generate a
> > compile_commands.json file, and the current CMake setup already does
> > that.
> >
> > The one thing that no one has mentioned is dependencies.
> >
> > CMake has less dependencies. Python is arguably a liability in the build
> > system arena, and Meson requires it.
>
> Eli has menitoned [muon](https://muon.build/), which is a drop-in
> replacement for Meson written in plain C99. I don't know whether it is
> currently able to compile the Git project, but if this is going to be a
> concern for people I can try to make sure that it does.
Thanks both for confirming that muon is a viable alternative.
Elsewhere in this thread packaging metadata for CMake was shared
arguing that CMake also has many dependencies. A subtle nuance there
is that those are all either optional dependencies (e.g. Qt for the GUI
parts) or they are dependencies that can be optionally supplied.
You can build CMake without those dependencies installed and CMake's
vendored versions will be statically linked instead. So, from the
perspective of wanting to go from 0 to 100 with just gcc/g++ installed,
CMake has less dependencies. This might be slightly disingenuous because
CMake vendors its dependencies and distros have to opt-in so that they
can supply their own versions, but the main takeaway is that GCC is all
you need and that's what I meant by, "less dependencies."
This is a moot point for most users, though, and it's even moreso moot
if muon compatibility can be maintained.
As to why I consider Python a liability ~ this is more of a concern for
Meson and it doesn't really matter for end users, but Python has a
proven track record of making breaking changes.
If you're building everything from scratch with new versions of
compilers and tools then the C++ project is the one that's going to
build just fine a decade from now with little to minimal effort.
Python doesn't have that track record.
Even though CMake is written in C++ (which is unacceptable for some
projects), this is subjectively one advantage that CMake seems to have.
This is a moot point, though, and perhaps Python will eventually reach
this same level of respect for not introducing breaking changes.
Furthermore, I suspect that most contributors are simply going to
"apt install meson" or "brew install meson" so it's not really that much
of an issue in practice for the majority of users/contributors.
> I'd honestly be sad if we go down the CMake route, mostly because I
> think that it is an inferior build system compared to Meson. I have
> worked with it extensively in the context of libgit2 and always found it
> to be a pain due to its esoteric syntax, the use of so many implicit
> variables, platform CMake policies, and there being so many ways to do
> the same thing and, where the easiest solution is typically the wrong
> one to pick.
>
> That being said, I'm trying to be as pragmatic is possible: my main goal
> is to have a modern build system that is easier to use. So while I think
> that Meson fits better into that role, the next-best thing would be
> CMake from my point of view.
>
> So I'll continue to champion Meson, but if the project as a whole agrees
> to take up CMake as another official build system then I'll adapt and
> make that happen.
I agree with you. Meson looks to be a technically better option.
I kinda wonder how many folks are actually using the contrib/ CMakeLists.txt,
and whether this effort would be helped by retiring it sooner rather
than later?
Would it be worth adding a canary to the CMake build that forces it to
fail to build unless "cmake -D ENABLE_DEPRECATED_BUILD=ON" option is
specified?
It could error out with a message telling users to reach out to the
list alongside the hint to specify the option if they just want
to get a working build.
On a rather low-powered machine here are some timings:
$ make clean
$ time make -j
181.36s user 15.35s system 99% cpu 3:17.33 total
$ ninja -C build clean
$ time ninja -C build
11.23s user 4.67s system 47% cpu 33.605 total
34s vs 3m17s ~ nice! That's also surprising.
That large of a difference is not explained by the extra
probes done by the Makefile; a no-op incremental build is 0.5s for
Make and 0.02s for Meson so the Makefile probes seem to only account
for at most 0.5s.
Is the Meson build simply building much less, and that's why
it's currently so much faster?
Or.. is it because I have "sccache" installed and Meson automatically
uses it? "ninja -C build -v" confirms that it's using sccache and
"make V=1" does not, so maybe that's why.
How do we disable the sccache usage?
"meson configure build" doesn't seem to list anything related to
caching, but it is really nice seeing all of the other options in one
place.
Improvement in build time seems like it could be something that sways
long-time contributors towards Meson. It is pretty nice that it
automatically picked up sccache in my $PATH and automatically gave me
those speedups.
> Thanks for your input, highly appreciated!
Thanks. I don't want to be the CMake champion, so here are a few
helpful/surprising details about the Meson build to help make it better.
(1) I first built w/out having "curl-config" installed. I was surprised
to find that "ninja -C build install" ended up installing "bin/curl" and
"bin/curl-config" into the prefix.
Is there a way to have the install step only install Git without
bringing along these other non-Git bits?
(2) There seems to be a difference in how symlinks and hardlinks are
handled in the install step.
Running "make prefix=$PWD/dist install" ends up with real files in
dist/bin/ (hardlinks) whereas with Meson all of the files in the bin/
directory are symlinks into ../libexec/.
(3) Not all of the same files seems to be getting installed.
I don't see bin/gitk or bin/git-cvsserver when building with Meson.
The share/git-core/templates/ directory is missing completely.
git-gui and its related files are missing. Perhaps this is
intentional/todo at this stage and hasn't been added yet.
Meson installs bin/git-http-backend (symlinked to libexec)
but in the original Makefile this file only exists in libexec/.
The contents of libexec/git-core/ seems to be missing dozens of
files compared to the Makefile build.
share/perl5/ has a bunch of extra git-{cvsserver,send-email,svn,...}
scripts so perhaps this is where some of those files went?
The Makefile places these files in the libexec/ area instead
of in the share/perl5/ area.
The Makefile does not install share/gitweb/static/js/.
Instead, it seems to mash everything together into a single
share/gitweb/static/gitweb.js file which Meson does not install.
Meson installs separate files in the share/gitweb/static/js/ area.
Was that intentional, or is that just another todo?
cheers,
--
David
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [PATCH RFC v6 00/19] Modernize the build system
2024-11-12 17:02 ` [PATCH RFC v6 " Patrick Steinhardt
` (19 preceding siblings ...)
2024-11-13 3:30 ` [-SPAM-] [PATCH RFC v6 00/19] Modernize the build system Ramsay Jones
@ 2024-11-13 10:45 ` Christian Couder
2024-11-13 13:24 ` Patrick Steinhardt
20 siblings, 1 reply; 386+ messages in thread
From: Christian Couder @ 2024-11-13 10:45 UTC (permalink / raw)
To: Patrick Steinhardt
Cc: git, Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King
On Tue, Nov 12, 2024 at 9:42 PM Patrick Steinhardt <ps@pks.im> wrote:
> ++# The prefix into which Git shall be installed is defined when setting up
> ++# the build directory. More on that in the "Configuration" section.
> ++#
> ++# Meson supports multiple backends. The default backend generates Ninja build
> ++# instructions, but it also supports the generation of Microsoft Visual
> ++# Studio solutions as well as Xcode projects. IDEs like Eclipse and Visual
> ++# Studio Code provide plugins to import Meson files directly.
> ++#
> ++# Configuration
> ++# =============
> ++#
> ++# The exact configuration of Git is determined when setting up the Git
> ++# directory.
Is it the "Git directory" or the "build directory"?
It might be helpful to repeat that this happens when `meson setup
build/` is run (as far as I understand it). Maybe something like:
"The exact configuration of Git is determined when setting up the
build directory, so when running `meson setup <build-dir>/`."
>Unless told otherwise, Meson will automatically detect the
> ++# availability of various bits and pieces. There are two different kinds of
> ++# options that can be used to further tweak the build:
> ++#
> ++# - Built-in options provided by Meson.
> ++#
> ++# - Options defined by the project in the "meson_options.txt" file.
> ++#
> ++# Both kinds of options can be inspected by running `meson configure` in the
> ++# build directory, which will give you a list of the current value for all
> ++# options.
> ++#
> ++# Options can be configured either when setting up the build directory or can
> ++# be changed in preexisting build directories:
> ++#
> ++# # Set up a build directory with optimized settings that will be
> ++# # installed into an alternative prefix.
> ++# $ meson setup --buildtype release --optimization 3 --strip --prefix=/home/$USER
It's not very clear if the above instruction should be run inside an
existing build directory to modify its configuration, or if it creates
a new build directory. If it creates one, it's also not clear what the
name of that directory would be. Maybe "build", but then what if an
existing build directory exists with that name?
> ++# # Set up a build directory with 'address' and 'undefined' sanitizers
> ++# # using Clang.
> ++# $ CC=clang meson setup -Db_sanitize=address,undefined
Same as above.
> ++# # Disable tests in a preexisting build directory.
> ++# $ meson configure -Dtests=false
As here the command is "configure" instead of "setup", I guess it
doesn't create a build directory and should be run inside a one.
> ++# # Disable features based on Python
> ++# $ meson configure -Dpython=disabled
> ++#
> ++# # Disable features based on Python
> ++# $ meson configure -Dpython=disabled
It looks like there is some duplication above.
> ++# Options have a type like booleans, choices, strings or features. Features are
> ++# somewhat special as they can have one of three values: enabled, disabled or
> ++# auto. While the first two values are self-explanatory, "auto" will enable or
> ++# disable the feature based on the availability of prerequisites to support it.
> ++# Python-based features for example will be enabled automatically when a Python
> ++# interpreter could be found. The default value of such features can be changed
> ++# globally via `meson setup --auto-features={enabled,disabled,auto}`, which
> ++# will set the value of all features with a value of "auto" to the provided one
> ++# by default.
> ++#
> ++# It is also possible to store a set of configuration options in machine files.
It's not very clear what a "machine file" is. How is it different from
a config file?
> ++# This can be useful in case you regularly want to reuse the same set of options:
> ++#
> ++# [binaries]
> ++# c = ['clang']
> ++# ar = ['ar']
> ++#
> ++# [project options]
> ++# gettext = 'disabled'
> ++# default_editor = 'vim'
> ++#
> ++# [built-in options]
> ++# b_lto = true
> ++# b_sanitize = 'address,undefined'
> ++#
> ++# These machine files can be passed to Meson via `meson setup --native-file`.
> ++#
> ++# Subproject wrappers
> ++# ===================
> ++#
> ++# Subproject wrappers are a feature provided by Meson that allow the automatic
> ++# fallback to a "wrapped" dependency in case the dependency is not provided by
> ++# the system. For example if the system is lacking curl, then Meson will use
> ++# "subprojects/curl.wrap" to set up curl as a subproject and compile and link
> ++# the dependency into Git itself. This is especially helpful on systems like
> ++# Windows, where you typically don't have such dependencies installed.
> ++#
> ++# The use of subproject wrappers can be disabled by executing `meson setup
> ++# --wrap-mode nofallback`.
I guess this will make the build fail if the system doesn't provide curl then.
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [PATCH RFC v6 00/19] Modernize the build system
2024-11-13 10:45 ` Christian Couder
@ 2024-11-13 13:24 ` Patrick Steinhardt
0 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-13 13:24 UTC (permalink / raw)
To: Christian Couder
Cc: git, Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King
On Wed, Nov 13, 2024 at 11:45:41AM +0100, Christian Couder wrote:
> On Tue, Nov 12, 2024 at 9:42 PM Patrick Steinhardt <ps@pks.im> wrote:
>
> > ++# The prefix into which Git shall be installed is defined when setting up
> > ++# the build directory. More on that in the "Configuration" section.
> > ++#
> > ++# Meson supports multiple backends. The default backend generates Ninja build
> > ++# instructions, but it also supports the generation of Microsoft Visual
> > ++# Studio solutions as well as Xcode projects. IDEs like Eclipse and Visual
> > ++# Studio Code provide plugins to import Meson files directly.
> > ++#
> > ++# Configuration
> > ++# =============
> > ++#
> > ++# The exact configuration of Git is determined when setting up the Git
> > ++# directory.
>
> Is it the "Git directory" or the "build directory"?
>
> It might be helpful to repeat that this happens when `meson setup
> build/` is run (as far as I understand it). Maybe something like:
>
> "The exact configuration of Git is determined when setting up the
> build directory, so when running `meson setup <build-dir>/`."
Good catch, this is of course the build directory. I've also adapted
in the spirit of your proposed text.
> >Unless told otherwise, Meson will automatically detect the
> > ++# availability of various bits and pieces. There are two different kinds of
> > ++# options that can be used to further tweak the build:
> > ++#
> > ++# - Built-in options provided by Meson.
> > ++#
> > ++# - Options defined by the project in the "meson_options.txt" file.
> > ++#
> > ++# Both kinds of options can be inspected by running `meson configure` in the
> > ++# build directory, which will give you a list of the current value for all
> > ++# options.
> > ++#
> > ++# Options can be configured either when setting up the build directory or can
> > ++# be changed in preexisting build directories:
> > ++#
> > ++# # Set up a build directory with optimized settings that will be
> > ++# # installed into an alternative prefix.
> > ++# $ meson setup --buildtype release --optimization 3 --strip --prefix=/home/$USER
>
> It's not very clear if the above instruction should be run inside an
> existing build directory to modify its configuration, or if it creates
> a new build directory. If it creates one, it's also not clear what the
> name of that directory would be. Maybe "build", but then what if an
> existing build directory exists with that name?
Oh, that's because I forgot to add the name of the build directory.
[snip]
> > ++# # Disable features based on Python
> > ++# $ meson configure -Dpython=disabled
> > ++#
> > ++# # Disable features based on Python
> > ++# $ meson configure -Dpython=disabled
>
> It looks like there is some duplication above.
Ah, indeed.
> > ++# Options have a type like booleans, choices, strings or features. Features are
> > ++# somewhat special as they can have one of three values: enabled, disabled or
> > ++# auto. While the first two values are self-explanatory, "auto" will enable or
> > ++# disable the feature based on the availability of prerequisites to support it.
> > ++# Python-based features for example will be enabled automatically when a Python
> > ++# interpreter could be found. The default value of such features can be changed
> > ++# globally via `meson setup --auto-features={enabled,disabled,auto}`, which
> > ++# will set the value of all features with a value of "auto" to the provided one
> > ++# by default.
> > ++#
> > ++# It is also possible to store a set of configuration options in machine files.
>
> It's not very clear what a "machine file" is. How is it different from
> a config file?
It's not, the machine file is a configuration file. It's just what Meson
calls it.
> > ++# This can be useful in case you regularly want to reuse the same set of options:
> > ++#
> > ++# [binaries]
> > ++# c = ['clang']
> > ++# ar = ['ar']
> > ++#
> > ++# [project options]
> > ++# gettext = 'disabled'
> > ++# default_editor = 'vim'
> > ++#
> > ++# [built-in options]
> > ++# b_lto = true
> > ++# b_sanitize = 'address,undefined'
> > ++#
> > ++# These machine files can be passed to Meson via `meson setup --native-file`.
> > ++#
> > ++# Subproject wrappers
> > ++# ===================
> > ++#
> > ++# Subproject wrappers are a feature provided by Meson that allow the automatic
> > ++# fallback to a "wrapped" dependency in case the dependency is not provided by
> > ++# the system. For example if the system is lacking curl, then Meson will use
> > ++# "subprojects/curl.wrap" to set up curl as a subproject and compile and link
> > ++# the dependency into Git itself. This is especially helpful on systems like
> > ++# Windows, where you typically don't have such dependencies installed.
> > ++#
> > ++# The use of subproject wrappers can be disabled by executing `meson setup
> > ++# --wrap-mode nofallback`.
>
> I guess this will make the build fail if the system doesn't provide curl then.
It depends on the value of the feature. If it's set to 'enabled' then
yes, Meson would fail. If it's set to 'auto' then it would simply
disable the feature and continue.
Right now it's set to 'enabled', so yes, we'd fail.
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [PATCH RFC v6 18/19] Introduce support for the Meson build system
2024-11-13 6:47 ` Junio C Hamano
@ 2024-11-13 13:24 ` Patrick Steinhardt
0 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-13 13:24 UTC (permalink / raw)
To: Junio C Hamano
Cc: git, Eli Schwartz, Eric Sunshine, Phillip Wood, Ramsay Jones,
Taylor Blau, David Aguilar, Jeff King
On Wed, Nov 13, 2024 at 03:47:55PM +0900, Junio C Hamano wrote:
> Patrick Steinhardt <ps@pks.im> writes:
>
> > +# # Disable features based on Python
> > +# $ meson configure -Dpython=disabled
> > +#
> > +# # Disable features based on Python
> > +# $ meson configure -Dpython=disabled
>
> These are dups, right?
Yup, fixed, thanks!
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [PATCH RFC v6 01/19] Makefile: use common template for GIT-BUILD-OPTIONS
2024-11-13 7:13 ` Junio C Hamano
@ 2024-11-13 13:24 ` Patrick Steinhardt
0 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-13 13:24 UTC (permalink / raw)
To: Junio C Hamano
Cc: git, Eli Schwartz, Eric Sunshine, Phillip Wood, Ramsay Jones,
Taylor Blau, David Aguilar, Jeff King
On Wed, Nov 13, 2024 at 04:13:11PM +0900, Junio C Hamano wrote:
> Patrick Steinhardt <ps@pks.im> writes:
>
> > Note that this change requires us to move around the setup of
> > TEST_OUTPUT_DIRECTORY in "test-lib.sh" such that it comes after sourcing
> > the "GIT-BUILD-OPTIONS" file. This is the only instance I could find
> > where we rely on ordering on variables.
>
> Doesn't this change break those who use the TEST_OUTPUT_DIRECTORY
> environment variable as a mechanism to override where the ouput is
> sent? E.g.,
>
> $ cd t && TEST_OUTPUT_DIRECTORY=/else/where sh t1000-read-tree-m-3way.sh
>
> They do not necessarily want their output directory affected by the
> value that was in TEST_OUTPUT_DIRECTORY when $(MAKE) was run the
> last time.
Ah, right. I only thought about the case where you set it up via
"config.mak", but you of course also have to handle it when set up via
the environment. Will fix.
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [-SPAM-] [PATCH RFC v6 00/19] Modernize the build system
2024-11-13 3:30 ` [-SPAM-] [PATCH RFC v6 00/19] Modernize the build system Ramsay Jones
@ 2024-11-13 13:24 ` Patrick Steinhardt
0 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-13 13:24 UTC (permalink / raw)
To: Ramsay Jones
Cc: git, Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Taylor Blau, David Aguilar, Jeff King
On Wed, Nov 13, 2024 at 03:30:20AM +0000, Ramsay Jones wrote:
> On 12/11/2024 17:02, Patrick Steinhardt wrote:
> > Hi,
> >
> > this patch series modernizes our build infrasturcture. It refactors
> > various parts of it to make it possible to perform out-of-tree builds in
> > theory.
> >
> > The series then continues to wire up Meson as a proposed alternative as
> > a modern replacement for our current build systems. It provides better
> > integration into IDEs than our Makefiles, better usability than our
> > Makefiles and CMake, better configuration and discoverability thereof
> > than autoconf and CMake (which is of course my personal opinion).
> >
> > The intent is to have Meson replace autoconf, which is mostly unused and
> > broken. Eventually, the plan would to also replace CMake and our
> > Makefiles in case we figure out that this replacement is indeed a net
> > benefit for the project, but all of this would happen over the course of
> > multiple releases.
> >
> > Changes in v6:
> >
> > - Add documentation for how to use Meson.
> >
> > - Fix compilation in case libintl exists, but required tools like
> > msgfmt and related don't. Instead of failing, we now automatically
> > compile with the equivalent of NO_GETTEXT=YesPlease.
> >
> > - Update last patch that fixes semantic merge conflics with in-flight
> > topics in "seen".
> >
> > - I've changed the series to be based on "master" at b31fb630c0 (Merge
> > https://github.com/j6t/git-gui, 2024-11-11) as all prereqs of this
> > series have since landed. This doesn't make any difference though
> > as there aren't any merge conflicts or additional changes caused by
> > this. I mostly mention this so that there is no confusion around the
> > changed base commit.
> >
>
> Tested this version, without issue, on Linux and cygwin (build + test).
Thanks for verifying!
> On cygwin, the unit test now no longer times out:
>
> $ cd git/build
> $ tail test-out
> 1030/1030 t9902-completion OK 114.74s
>
> Ok: 1030
> Expected Fail: 0
> Fail: 0
> Unexpected Pass: 0
> Skipped: 0
> Timeout: 0
>
> Full log written to /home/ramsay/git/build/meson-logs/testlog.txt
> $
Great.
> Having said that, I was expecting to see an 'Unexpected Pass', since
> meson decides to not set NO_REGEX. (The 'make' build on cygwin will
> set 'NO_REGEX = UnfortunatelyYes' in the config.mak.uname).
>
> In the meson-logs/testlog.txt file, for the t7815-grep-binary.sh test
> stdout, we find:
>
> ----------------------------------- stdout -----------------------------------
> ok 1 - setup
> ok 2 - git grep ina a
> ok 3 - git grep -ah ina a
> ok 4 - git grep -I ina a
> ok 5 - git grep -c ina a
> ok 6 - git grep -l ina a
> ok 7 - git grep -L bar a
> ok 8 - git grep -q ina a
> ok 9 - git grep -F ile a
> ok 10 - git grep -Fi iLE a
> ok 11 - git grep ile a
> ok 12 - git grep .fi a # TODO known breakage vanished
> ok 13 - grep respects binary diff attribute
> ok 14 - grep --cached respects binary diff attribute
> ok 15 - grep --cached respects binary diff attribute (2)
> ok 16 - grep revision respects binary diff attribute
> ok 17 - grep respects not-binary diff attribute
> ok 18 - setup textconv filters
> ok 19 - grep does not honor textconv
> ok 20 - grep --textconv honors textconv
> ok 21 - grep --no-textconv does not honor textconv
> ok 22 - grep --textconv blob honors textconv
> # 1 known breakage(s) vanished; please update test(s)
> # passed all remaining 21 test(s)
> 1..22
> ==============================================================================
>
> Note the 'TODO known breakage vanished' on test 12.
Interesting. Right now we don't parse the output of the test executions
themselves, so we only operate on the level of whether or not the whole
test suite passed. So it's expected that this does not get reported as
an unexpected pass.
While Meson can itself generate TAP output, I don't think that it has
support for _reading_ the TAP format.
> Setting NO_REGEX on cygwin is for 'reasons' (not necessarily good) and we
> need a way to override it's decision here. (In general, we need to be able
> to use *any* of the many build variables to override meson's automatic
> setting of these build variables).
I can add an option for this. Out of curiosity, what is the reason? Is
this anything that we can autodetect?
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v4 00/19] Modernize the build system
2024-11-13 9:21 ` David Aguilar
@ 2024-11-13 13:29 ` Patrick Steinhardt
2024-11-13 14:57 ` Eli Schwartz
2024-11-14 4:24 ` Junio C Hamano
2024-11-13 14:57 ` Eli Schwartz
2024-11-14 8:15 ` Patrick Steinhardt
2 siblings, 2 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-13 13:29 UTC (permalink / raw)
To: David Aguilar
Cc: Taylor Blau, git, Eli Schwartz, Eric Sunshine, Phillip Wood,
Junio C Hamano, Ramsay Jones, Jeff King
On Wed, Nov 13, 2024 at 01:21:52AM -0800, David Aguilar wrote:
> On Mon, Nov 11, 2024 at 11:36:34AM +0100, Patrick Steinhardt wrote:
> > On Sat, Nov 09, 2024 at 04:58:56AM -0800, David Aguilar wrote:
> > > That said, if we mean, "Linux/Unix-savvy New Contributors," then
> > > I can understand why Meson might be a favorite, and perhaps this
> > > might be the crowd we are looking to target [...]
> >
> > My goal is to not only make things easier to use for Linux users, but
> > also for users on other platforms like Windows while also catering to
> > the typical developer of Git and making the solution for them as tasty
> > as possible.
> >
> > I agree that CMake is a tad easier to use and set up on Windows, mostly
> > because it is directly integrated into MSVC. But I also think that CMake
> > is a harder sell towards the power users because it is comparatively
> > hard to maintain due to its somewhat arcane syntax, implicit variables
> > and things like this.
> >
> > So I'm basically trying to find a good middle ground where all of the
> > respective target audiences get benefit:
> >
> > - For Unix devs I think that Meson is easier to maintain and use
> > compared to CMake. We also get nice features like out-of-source
> > builds, good integration with the test suite and easy integration
> > with IDEs.
> >
> > - For Windows devs we have an officially supported way to build Meson
> > from MSVC and co. Also, subprojects allow us to have as easy story
> > for how to build Git without preinstalled dependencies, which is not
> > currently possible with CMake to the best of my knowledge.
> >
> > - For packagers I think that Meson provides better discoverability of
> > options than CMake.
> >
> > So Meson may not be the perfect solution for everyone of these target
> > audiences, and better solutions may exist to cater specific needs. But
> > it provides a net benefit for every single one of these audiences from
> > my point of view. And when taking the benefits for all target audiences
> > combined I think that Meson provides the bigger win compared to CMake.
>
> Thanks for clarifying. Not that it matters, but you've convinced me.
> Constructive criticism follows below in the hope that it can help you
> further harden the arguments for Meson.
Very happy to hear!
> > > > Patrick Steinhardt wrote:
> > > > > - Packagers. This is another group of people that would benefit from
> > > > > my point of view. This is mostly because Meson has certain standards
> > > > > for how to approach problems, and thus the packager would know for
> > > > > how to handle things. They don't have to manually track build
> > > > > options and changes thereof, as these can be easily discovered and
> > > > > because Meson will error out in case invalid options are passed.
> > >
> > > CMake's option() variables and its GNUInstallDirs module pretty much
> > > handles all of the standardization that packagers are looking for on
> > > this front, so this argument doesn't push the needle towards Meson over
> > > CMake from my perspective.
> >
> > I think that discoverability of Meson is way better. Here you can simply
> > say `meson configure` and it provides you a nice list of all options
> > that are available. For CMake it always used to be a big pain.
>
> The pain of discovering options with CMake is true in the general case.
>
> A specific project can enforce conventions so that all option()s are
> specified at the top of the main build script or a designated file
> specifically for options. That would trivially make the options easily
> discoverable in that there's only a single place to look, but that's
> nowhere near the rigor that Meson enforces.
>
> Following a sensible convention is why I didn't originally vibe with the
> argument that option()s are insufficient, but that would merely be one
> project's conventions and is by no means a universal practice.
>
> Elsewhere in this thread it was also mentioned that unknown options are
> blindly accepted by CMake. That's actually not true.
>
> While it's not as rigorous as Meson because it doesn't error out by
> default, CMake does issue a warning when you specify variables/options
> that are not used by the project. IIRC this warning can be made into an
> error by using the "cmake -Werror=dev" option, but I appreciate Meson
> taking the stricter route as it results in better overall usability.
Ah, fair enough, I remember seeing these warnings myself. As you say, I
also prefer being as strict as possible, as otherwise it is so easy to
miss the fact that a build option has been mistyped, removed or renamed.
The warning helps the dev if they pay attention, but especially in
automated systems I'd expect it to go unnoticed quite often.
> > > > Taylor Blau wrote:
> > > > I appreciate your thoughtful response to my concerns here. Please feel
> > > > free to correct me if I am wrong, but I think the bulk of your argument
> > > > is captured fairly well by these three points, so I want to focus my
> > > > response here.
> > > >
> > > > Responding in turn, I think my feeling is something like:
> > > >
> > > > - Long-time Git contributors are going to be the ones who will most
> > > > frequently use the new build system. I am definitely sympathetic to
> > > > getting too comfortable with our existing tools, but so far in your
> > > > response I have not seen a compelling reason to switch the project
> > > > to use Meson.
> > >
> > > Likewise, I have not seen a compelling reason to not focus the
> > > effort on CMake instead. In other words, why not enhance the current
> > > status quo (Make + CMake) instead of trying to replace it?
> >
> > As mentioned above, I mostly think that Meson makes for a more
> > compelling overall package. That being said, if we eventually come to
> > the conclusion that we as a community want CMake instead of Meson, then
> > I am willing to go there.
>
> I hope that's not where things land because the separation of
> configuration vs. build steps does provide a benefit in day-to-day use
> (specifically, faster incremental builds) due to the clean separation
> of the configuration and build steps.
>
> It seems like it would be nice if the Meson build were eventually
> hooked up so that we can continue typing "make prefix=... install"
> (perhaps through an opt-in "enable meson" variable) and the Makefile
> would handle driving Meson + Ninja, but that's probably an untenable
> feature given the complexity of the current Makefile.
>
> If the Makefile were completely replaced one day then that would be
> a nice to have, but it would probably be a bad crutch because the
> natural tendency would be to shadow all of Meson's options behind
> Makefile knobs. Encouraging users to just run meson directly
> seems like a better overall situation. Bisecting is the only
> reason why something like that might seem appealing, but
> I probably wouldn't push for it myself and maybe there's a better
> way to handle that when we cross that bridge.
In theory it is of course possible to have a thin wrapper around Meson,
but as you say it'd likely be a bit more on the painful side to write.
One could be pragmatic and only map the most commonly used options and
otherwise let the autodetection of features do its thing, which could be
good enough for bisectability.
On the other hand I don't see that our Makefile would go away anytime
soon. I would eventually want to remove it so that we have a single
build system, only, but I'd think that the timeline here would rather be
a year or two before we do so. So maybe that reduces the need for such a
mechanism.
> > > > * New contributors do not interact with build system internals
> > > > nearly as much as more experienced contributors. I would imagine
> > > > that the vast majority of those interactions are simply running
> > > > "make" or "make test".
> > > >
> > > > You mention a handful of other niceties that Meson provides,
> > > > like language server support, but I am not sure that I agree
> > > > those are (a) the responsibility of the build system to provide,
> > > > or (b) that those needs aren't already well met by the vast
> > > > number of existing tools and IDE integrations that can work with
> > > > ctags.
> > >
> > > CMake has all of these same bells and whistles, and it's already present
> > > in git.git. LSP support just means being able to generate a
> > > compile_commands.json file, and the current CMake setup already does
> > > that.
> > >
> > > The one thing that no one has mentioned is dependencies.
> > >
> > > CMake has less dependencies. Python is arguably a liability in the build
> > > system arena, and Meson requires it.
> >
> > Eli has menitoned [muon](https://muon.build/), which is a drop-in
> > replacement for Meson written in plain C99. I don't know whether it is
> > currently able to compile the Git project, but if this is going to be a
> > concern for people I can try to make sure that it does.
>
> Thanks both for confirming that muon is a viable alternative.
>
> Elsewhere in this thread packaging metadata for CMake was shared
> arguing that CMake also has many dependencies. A subtle nuance there
> is that those are all either optional dependencies (e.g. Qt for the GUI
> parts) or they are dependencies that can be optionally supplied.
>
> You can build CMake without those dependencies installed and CMake's
> vendored versions will be statically linked instead. So, from the
> perspective of wanting to go from 0 to 100 with just gcc/g++ installed,
> CMake has less dependencies. This might be slightly disingenuous because
> CMake vendors its dependencies and distros have to opt-in so that they
> can supply their own versions, but the main takeaway is that GCC is all
> you need and that's what I meant by, "less dependencies."
>
> This is a moot point for most users, though, and it's even moreso moot
> if muon compatibility can be maintained.
Fair. I don't really expect anybody to use the combination of muon/sumo
for everyday work, mostly because the usability is not quite up to par
with Meson/Ninja. But there are two use cases that I deem important:
- Esoteric platforms that may not have Python available. I don't know
whether there actually are any relevant ones, but with muon/sumo it
is possible to support these.
- Bootstrappability, which I think is rather critical for a project
like Git that is at the core of the whole software ecosystem.
Depending only on a C99 compiler and a shell is a huge win here.
A bit of an anecdota, but CMake itself for example struggles with this
quite heavily because it has dependencies that use CMake themselves. So
it is nice that there is a clear path for bootstrapping with Meson and
thus Git.
> As to why I consider Python a liability ~ this is more of a concern for
> Meson and it doesn't really matter for end users, but Python has a
> proven track record of making breaking changes.
>
> If you're building everything from scratch with new versions of
> compilers and tools then the C++ project is the one that's going to
> build just fine a decade from now with little to minimal effort.
> Python doesn't have that track record.
>
> Even though CMake is written in C++ (which is unacceptable for some
> projects), this is subjectively one advantage that CMake seems to have.
> This is a moot point, though, and perhaps Python will eventually reach
> this same level of respect for not introducing breaking changes.
>
> Furthermore, I suspect that most contributors are simply going to
> "apt install meson" or "brew install meson" so it's not really that much
> of an issue in practice for the majority of users/contributors.
Agreed.
> > I'd honestly be sad if we go down the CMake route, mostly because I
> > think that it is an inferior build system compared to Meson. I have
> > worked with it extensively in the context of libgit2 and always found it
> > to be a pain due to its esoteric syntax, the use of so many implicit
> > variables, platform CMake policies, and there being so many ways to do
> > the same thing and, where the easiest solution is typically the wrong
> > one to pick.
> >
> > That being said, I'm trying to be as pragmatic is possible: my main goal
> > is to have a modern build system that is easier to use. So while I think
> > that Meson fits better into that role, the next-best thing would be
> > CMake from my point of view.
> >
> > So I'll continue to champion Meson, but if the project as a whole agrees
> > to take up CMake as another official build system then I'll adapt and
> > make that happen.
>
> I agree with you. Meson looks to be a technically better option.
> I kinda wonder how many folks are actually using the contrib/ CMakeLists.txt,
> and whether this effort would be helped by retiring it sooner rather
> than later?
>
> Would it be worth adding a canary to the CMake build that forces it to
> fail to build unless "cmake -D ENABLE_DEPRECATED_BUILD=ON" option is
> specified?
>
> It could error out with a message telling users to reach out to the
> list alongside the hint to specify the option if they just want
> to get a working build.
I think it's still a bit too early to think about the actual deprecation
road -- before removing things I want to connect with any stakeholders
that use the old system and figure out whether I've got everything
covered that they need. I know that Johannes for example uses CMake
extensively, so I will make sure to connect with him before proposing
its removal.
I've also shifted my thinking a bit: instead of removing CMake as a
first step I'd like to remove the autoconf code. It is known to be
broken in many situations and there is only a very small set of users
out there. So replacing that with Meson would be a good first target
from my point of view.
In any case I don't want to negatively surprise anybody, so I am of
course very happy to discuss the roadmap here and will work with anybody
who has needs that I haven't addressed yet.
> On a rather low-powered machine here are some timings:
>
> $ make clean
> $ time make -j
> 181.36s user 15.35s system 99% cpu 3:17.33 total
>
> $ ninja -C build clean
> $ time ninja -C build
> 11.23s user 4.67s system 47% cpu 33.605 total
>
> 34s vs 3m17s ~ nice! That's also surprising.
Awesome!
> That large of a difference is not explained by the extra
> probes done by the Makefile; a no-op incremental build is 0.5s for
> Make and 0.02s for Meson so the Makefile probes seem to only account
> for at most 0.5s.
>
> Is the Meson build simply building much less, and that's why
> it's currently so much faster?
We don't build documentation by default and don't have gitk wired up,
but other than that the builds should be mostly equivalent.
> Or.. is it because I have "sccache" installed and Meson automatically
> uses it? "ninja -C build -v" confirms that it's using sccache and
> "make V=1" does not, so maybe that's why.
>
> How do we disable the sccache usage?
> "meson configure build" doesn't seem to list anything related to
> caching, but it is really nice seeing all of the other options in one
> place.
Yes, Meson knows to pick up sccache and ccache automatically. [1]
mentions that you can disable this by setting the compiler explicitly
via the CC environment variable.
[1]: https://mesonbuild.com/Feature-autodetection.html#ccache
> Improvement in build time seems like it could be something that sways
> long-time contributors towards Meson. It is pretty nice that it
> automatically picked up sccache in my $PATH and automatically gave me
> those speedups.
True.
> > Thanks for your input, highly appreciated!
>
> Thanks. I don't want to be the CMake champion, so here are a few
> helpful/surprising details about the Meson build to help make it better.
>
>
> (1) I first built w/out having "curl-config" installed. I was surprised
> to find that "ninja -C build install" ended up installing "bin/curl" and
> "bin/curl-config" into the prefix.
>
> Is there a way to have the install step only install Git without
> bringing along these other non-Git bits?
It definitely shouldn't install curl and curl-config, I'll have a look
at that. But other than that Meson is currently set up such that it will
automatically fall back to the subprojects in case certain dependencies
cannot be found. This can be disabled via `meson setup --wrap-mode
nofallback`.
> (2) There seems to be a difference in how symlinks and hardlinks are
> handled in the install step.
>
> Running "make prefix=$PWD/dist install" ends up with real files in
> dist/bin/ (hardlinks) whereas with Meson all of the files in the bin/
> directory are symlinks into ../libexec/.
Yup, that's documented as part of the commit message that introduces
Meson as one of the main differences.
> (3) Not all of the same files seems to be getting installed.
>
> I don't see bin/gitk or bin/git-cvsserver when building with Meson.
>
> The share/git-core/templates/ directory is missing completely.
>
> git-gui and its related files are missing. Perhaps this is
> intentional/todo at this stage and hasn't been added yet.
>
> Meson installs bin/git-http-backend (symlinked to libexec)
> but in the original Makefile this file only exists in libexec/.
>
> The contents of libexec/git-core/ seems to be missing dozens of
> files compared to the Makefile build.
>
> share/perl5/ has a bunch of extra git-{cvsserver,send-email,svn,...}
> scripts so perhaps this is where some of those files went?
> The Makefile places these files in the libexec/ area instead
> of in the share/perl5/ area.
>
> The Makefile does not install share/gitweb/static/js/.
> Instead, it seems to mash everything together into a single
> share/gitweb/static/gitweb.js file which Meson does not install.
> Meson installs separate files in the share/gitweb/static/js/ area.
> Was that intentional, or is that just another todo?
gitk and git-gui aren't currently wired up. All the other ones I'll have
a look at.
Thanks a lot for your feedback!
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v4 00/19] Modernize the build system
2024-11-13 9:21 ` David Aguilar
2024-11-13 13:29 ` Patrick Steinhardt
@ 2024-11-13 14:57 ` Eli Schwartz
2024-11-14 8:15 ` Patrick Steinhardt
2 siblings, 0 replies; 386+ messages in thread
From: Eli Schwartz @ 2024-11-13 14:57 UTC (permalink / raw)
To: David Aguilar, Patrick Steinhardt
Cc: Taylor Blau, git, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Jeff King
[-- Attachment #1.1: Type: text/plain, Size: 3155 bytes --]
On 11/13/24 4:21 AM, David Aguilar wrote:
> As to why I consider Python a liability ~ this is more of a concern for
> Meson and it doesn't really matter for end users, but Python has a
> proven track record of making breaking changes.
>
> If you're building everything from scratch with new versions of
> compilers and tools then the C++ project is the one that's going to
> build just fine a decade from now with little to minimal effort.
> Python doesn't have that track record.
>
> Even though CMake is written in C++ (which is unacceptable for some
> projects), this is subjectively one advantage that CMake seems to have.
> This is a moot point, though, and perhaps Python will eventually reach
> this same level of respect for not introducing breaking changes.
>
> Furthermore, I suspect that most contributors are simply going to
> "apt install meson" or "brew install meson" so it's not really that much
> of an issue in practice for the majority of users/contributors.
For what it's worth, meson is aware that python breaking changes are a
potential issue. Although the general python ecosystem is fairly lax
about this -- on *all* points across:
- cpython itself being backwards incompatible
- projects making breaking changes in a micro release
- projects deciding to only support the latest, or 2 most recent,
versions of cpython
meson pedantically avoids non-standard-library dependencies both for
bootstrappability and for points 2 & 3.
Regarding point 1, meson can't do a lot other than adapt. But the latest
version of meson will always support *all* non-EOL versions of python,
we do prerelease testing of cpython betas, and we do not drop support
even for EOL versions of cpython unless, having carefully evaluated the
benefits and negatives, we decide that the advantages of relying on a
new version outweigh the downside of preventing people on older systems
with older cpython from upgrading meson.
Currently that means we still support 7 different versions of cpython,
including 2 versions that are EOL (and 4 versions that built with c89,
before the migration to c11).
Of course, as you say it's a bit of a moot point given that muon exists.
But I just wanted to clarify that meson does take this concern seriously
and we try to do everything we can to make that work -- even when some
meson maintainers are unhappy and feel that being unable to depend on
unpredictable third-party modules cramps their style.
We know that we are core FOSS infrastructure, and are used by other core
FOSS infrastructure projects such as init systems (both systemd and
openrc), graphics stacks (mesa, libdrm, both xorg and wayland), desktops
(gnome has an official directive to use meson), and a variety of
freedesktop projects, many of which need to keep building on LTS
versions of Debian oldoldstable (not a typo) and oftentimes on even more
surprising platforms.
And in some cases we've been a bit influential in getting cpython to
revert breaking changes :) e.g. python 3.13 reverted the removal of the
importlib.resources "Functional API".
--
Eli Schwartz
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v4 00/19] Modernize the build system
2024-11-13 13:29 ` Patrick Steinhardt
@ 2024-11-13 14:57 ` Eli Schwartz
2024-11-14 8:15 ` Patrick Steinhardt
2024-11-14 4:24 ` Junio C Hamano
1 sibling, 1 reply; 386+ messages in thread
From: Eli Schwartz @ 2024-11-13 14:57 UTC (permalink / raw)
To: Patrick Steinhardt, David Aguilar
Cc: Taylor Blau, git, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Jeff King
[-- Attachment #1.1: Type: text/plain, Size: 3241 bytes --]
On 11/13/24 8:29 AM, Patrick Steinhardt wrote:
> Fair. I don't really expect anybody to use the combination of muon/sumo
> for everyday work, mostly because the usability is not quite up to par
> with Meson/Ninja. But there are two use cases that I deem important:
(samu :P)
> - Esoteric platforms that may not have Python available. I don't know
> whether there actually are any relevant ones, but with muon/sumo it
> is possible to support these.
>
> - Bootstrappability, which I think is rather critical for a project
> like Git that is at the core of the whole software ecosystem.
> Depending only on a C99 compiler and a shell is a huge win here.
>
> A bit of an anecdota, but CMake itself for example struggles with this
> quite heavily because it has dependencies that use CMake themselves. So
> it is nice that there is a clear path for bootstrapping with Meson and
> thus Git.
Yeah, the cmake bootstrap route tends to be an issue for Linux distros
because we want to use system packages for those dependencies, and while
it's possible to build a bootstrap seed `cmake` binary using their
shellscript and use it to build a "real" cmake, that doesn't really help
you install cmake's dependencies. There are some tricks you can do like
for example on Gentoo, bootstrap the OS with http2 support in curl
toggled off, so you can build without nghttp2 / no cmake, then use that
to build cmake, then rebuild curl. It requires manual intervention but
then you can reuse the existing cmake binary.
There's generally no path for building cmake with bundled dependencies,
as that would conflict with the desired end state of distributing cmake
linked to system packages.
>> Thanks. I don't want to be the CMake champion, so here are a few
>> helpful/surprising details about the Meson build to help make it better.
>>
>>
>> (1) I first built w/out having "curl-config" installed. I was surprised
>> to find that "ninja -C build install" ended up installing "bin/curl" and
>> "bin/curl-config" into the prefix.
>>
>> Is there a way to have the install step only install Git without
>> bringing along these other non-Git bits?
>
> It definitely shouldn't install curl and curl-config, I'll have a look
> at that. But other than that Meson is currently set up such that it will
> automatically fall back to the subprojects in case certain dependencies
> cannot be found. This can be disabled via `meson setup --wrap-mode
> nofallback`.
https://github.com/mesonbuild/wrapdb/tree/master/subprojects/packagefiles/curl
could be updated to handle the case where meson.is_subproject() returns
"true", by not installing tooling.
Alternatively, meson install --skip-subprojects can avoid installing
*any* files from subprojects, on the theory that subprojects exist
solely to provide static libraries linked into the real project.
(In theory, one could have a subproject where arbitrary data files from
a subproject dependency are crucial at runtime. I think the gnome
ecosystem does this, hence using GLib / Gtk as a subproject "needs" to
install the subproject too -- but curl definitely doesn't have this
issue...)
--
Eli Schwartz
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [PATCH RFC v6 08/19] Makefile: refactor GIT-VERSION-GEN to be reusable
2024-11-12 17:02 ` [PATCH RFC v6 08/19] Makefile: refactor GIT-VERSION-GEN to be reusable Patrick Steinhardt
@ 2024-11-13 16:30 ` Phillip Wood
2024-11-14 9:10 ` Patrick Steinhardt
0 siblings, 1 reply; 386+ messages in thread
From: Phillip Wood @ 2024-11-13 16:30 UTC (permalink / raw)
To: Patrick Steinhardt, git
Cc: Eli Schwartz, Eric Sunshine, Junio C Hamano, Ramsay Jones,
Taylor Blau, David Aguilar, Jeff King
Hi Patrick
On 12/11/2024 17:02, Patrick Steinhardt wrote:
> Our "GIT-VERSION-GEN" script always writes the "GIT-VERSION-FILE" into
> the current directory, where the expectation is that it should exist in
> the source directory. But other build systems that support out-of-tree
> builds may not want to do that to keep the source directory pristine,
> even though CMake currently doesn't care.
>
> Refactor the script such that it doesn't write output to a file anymore
> but so that it instead writes the version to stdout. This makes it
> easier to compute the same version as our Makefile would without having
> to write the "GIT-VERSION-FILE".
This patch moves the logic that only updates GIT-VERSION-FILE if the
version has changed from the script into the Makefile. As we really want
the CMake and meson builds to set the string at build time which
probably means extending GIT-VERSION-GEN to write a header file that
defines GIT_VERSION etc. I'm not sure this is a good direction. In the
long run I think we'd be better off with something like the patch below.
Best Wishes
Phillip
---- >8 ----
From: Phillip Wood <phillip.wood@dunelm.org.uk>
Subject: [PATCH] WIP CMake: update GIT_VERSION at runtime
The CMake build defines GIT_VERSION when it is configured and does not
update it when HEAD changes. Fix this by modifying GIT-VERSION-GEN so
that in addition to creating GIT_VERSION-FILE, it creates a header file
containing the version strings that is included in version.c.
TODO:
- update CMakeLists.txt to set the version information for git.res
at build time.
- Check for changes to GIT_USER_AGENT when the version has not
changed.
- Maybe remove GIT-VERISON-FILE infavor of parsing version-def.h so
that there is a single source of truth for the version.
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
---
GIT-VERSION-GEN | 17 +++++++++++++----
Makefile | 15 +++++++--------
contrib/buildsystems/CMakeLists.txt | 26 +++++++++++++++++++-------
version.c | 1 +
4 files changed, 40 insertions(+), 19 deletions(-)
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index 78e8631f677..25c033fa892 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -1,6 +1,7 @@
#!/bin/sh
-GVF=GIT-VERSION-FILE
+GVF="$1"
+VERSION_HEADER="$2"
DEF_VER=v2.47.GIT
LF='
@@ -30,11 +31,19 @@ VN=$(expr "$VN" : v*'\(.*\)')
if test -r $GVF
then
- VC=$(sed -e 's/^GIT_VERSION = //' <$GVF)
+ VC=$(sed -e 's/^GIT_VERSION = //' "$GVF")
else
VC=unset
fi
-test "$VN" = "$VC" || {
+test "$VN" = "$VC" && test -f "$VERSION_HEADER" || {
echo >&2 "GIT_VERSION = $VN"
- echo "GIT_VERSION = $VN" >$GVF
+ echo "GIT_VERSION = $VN" >"$GVF"
+ USER_AGENT="${GIT_USER_AGENT:-git/$VN}"
+ HEAD="$(GIT_CEILING_DIRECTORIES=.. \
+ git rev-parse -q --verify HEAD 2>/dev/null)"
+ cat <<-EOF >"$VERSION_HEADER"
+ #define GIT_VERSION "$VN"
+ #define GIT_BUILT_FROM_COMMIT "$HEAD"
+ #define GIT_USER_AGENT "$USER_AGENT"
+ EOF
}
diff --git a/Makefile b/Makefile
index 2afad000762..7cd42e2bed7 100644
--- a/Makefile
+++ b/Makefile
@@ -592,7 +592,11 @@ include shared.mak
# Disable -pedantic compilation.
GIT-VERSION-FILE: FORCE
- @$(SHELL_PATH) ./GIT-VERSION-GEN
+ @$(SHELL_PATH) ./GIT-VERSION-GEN GIT-VERSION-FILE version-def.h
+
+version-def.h: GIT-VERSION-FILE
+ @touch $@
+
-include GIT-VERSION-FILE
# Set our default configuration.
@@ -919,6 +923,7 @@ REFTABLE_LIB = reftable/libreftable.a
GENERATED_H += command-list.h
GENERATED_H += config-list.h
GENERATED_H += hook-list.h
+GENERATED_H += version-def.h
GENERATED_H += $(UNIT_TEST_DIR)/clar-decls.h
GENERATED_H += $(UNIT_TEST_DIR)/clar.suite
@@ -2505,13 +2510,7 @@ PAGER_ENV_CQ_SQ = $(subst ','\'',$(PAGER_ENV_CQ))
pager.sp pager.s pager.o: EXTRA_CPPFLAGS = \
-DPAGER_ENV='$(PAGER_ENV_CQ_SQ)'
-version.sp version.s version.o: GIT-VERSION-FILE GIT-USER-AGENT
-version.sp version.s version.o: EXTRA_CPPFLAGS = \
- '-DGIT_VERSION="$(GIT_VERSION)"' \
- '-DGIT_USER_AGENT=$(GIT_USER_AGENT_CQ_SQ)' \
- '-DGIT_BUILT_FROM_COMMIT="$(shell \
- GIT_CEILING_DIRECTORIES="$(CURDIR)/.." \
- git rev-parse -q --verify HEAD 2>/dev/null)"'
+version.sp version.s version.o: version-def.h GIT-USER-AGENT
$(BUILT_INS): git$X
$(QUIET_BUILT_IN)$(RM) $@ && \
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 2e22e87d188..e64045c4dbd 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -86,12 +86,15 @@ endif()
#Create GIT-VERSION-FILE using GIT-VERSION-GEN
if(NOT EXISTS ${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE)
message("Generating GIT-VERSION-FILE")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
+ execute_process(COMMAND ${SH_EXE}
+ "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
+ "${CMAKE_BINARY_DIR}/GIT-VERSION-FILE"
+ "${CMAKE_BINARY_DIR}/version-def.h"
+ WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}")
endif()
#Parse GIT-VERSION-FILE to get the version
-file(STRINGS ${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE git_version REGEX "GIT_VERSION = (.*)")
+file(STRINGS "${CMAKE_BINARY_DIR}/GIT-VERSION-FILE" git_version REGEX "^GIT_VERSION = (.*)")
string(REPLACE "GIT_VERSION = " "" git_version ${git_version})
string(FIND ${git_version} "GIT" location)
if(location EQUAL -1)
@@ -101,6 +104,16 @@ else()
string(APPEND git_version ".0") #for building from a snapshot
endif()
+add_custom_target(version-def
+ COMMAND ${SH_EXE}
+ ./GIT-VERSION-GEN
+ "${CMAKE_BINARY_DIR}/GIT-VERSION-FILE"
+ "${CMAKE_BINARY_DIR}/version-def.h"
+ WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
+ BYPRODUCTS "${CMAKE_BINARY_DIR}/GIT-VERSION-FILE"
+ - "${CMAKE_BINARY_DIR}/version-def.h"
+ VERBATIM)
+
project(git
VERSION ${git_version}
LANGUAGES C)
@@ -240,10 +253,7 @@ add_compile_definitions(PAGER_ENV="LESS=FRX LV=-c"
GIT_HTML_PATH="share/doc/git-doc"
DEFAULT_HELP_FORMAT="html"
DEFAULT_GIT_TEMPLATE_DIR="share/git-core/templates"
- GIT_VERSION="${PROJECT_VERSION}.GIT"
- GIT_USER_AGENT="git/${PROJECT_VERSION}.GIT"
- BINDIR="bin"
- GIT_BUILT_FROM_COMMIT="")
+ BINDIR="bin")
if(WIN32)
set(FALLBACK_RUNTIME_PREFIX /mingw64)
@@ -680,6 +690,8 @@ parse_makefile_for_sources(libgit_SOURCES "LIB_OBJS")
list(TRANSFORM libgit_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
list(TRANSFORM compat_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
add_library(libgit ${libgit_SOURCES} ${compat_SOURCES})
+target_include_directories(libgit PRIVATE "${CMAKE_BINARY_DIR}")
+add_dependencies(libgit version-def)
#libxdiff
parse_makefile_for_sources(libxdiff_SOURCES "XDIFF_OBJS")
diff --git a/version.c b/version.c
index 41b718c29e1..7adc4d51ff2 100644
--- a/version.c
+++ b/version.c
@@ -1,5 +1,6 @@
#include "git-compat-util.h"
#include "version.h"
+#include "version-def.h"
#include "strbuf.h"
const char git_version_string[] = GIT_VERSION;
--
2.47.0.354.g52c9d0440b0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* Re: [PATCH RFC v6 18/19] Introduce support for the Meson build system
2024-11-12 17:03 ` [PATCH RFC v6 18/19] Introduce support for the Meson build system Patrick Steinhardt
2024-11-13 6:47 ` Junio C Hamano
@ 2024-11-13 16:30 ` Phillip Wood
1 sibling, 0 replies; 386+ messages in thread
From: Phillip Wood @ 2024-11-13 16:30 UTC (permalink / raw)
To: Patrick Steinhardt, git
Cc: Eli Schwartz, Eric Sunshine, Junio C Hamano, Ramsay Jones,
Taylor Blau, David Aguilar, Jeff King
Hi Patrick
On 12/11/2024 17:03, Patrick Steinhardt wrote:
I had a read through to see what the meson syntax was like and it
seems to be quite nice. I've left a couple of comments below. It's
an impressive amount of work to get to this stage, it's a bit
daunting that replicating everything in our current Makefile is
even more work!
> +# # Set up a build directory with 'address' and 'undefined' sanitizers
> +# # using Clang.
> +# $ CC=clang meson setup -Db_sanitize=address,undefined
Unfortunately when building with this the tests fail with
==217115==ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD.
./test-lib.sh: line 1080: 217115 Aborted (core dumped) git switch -C primary
error: last command exited with $?=134
because we don't wire up -Db_sanitize to SANITIZE_ADDRESS in
GIT-BUILD-OPTIONS. The Makefile sets a few other build options as well
with SANATIZE=address which we should replicate here. I was suprised
meson wont allow -Db_sanitize=address,leak.
I assume that it would be possible to set some default CFLAGS to match
the Makefile and have something like DEVELOPER and DEVOPTS if we adopt
this? As a contributor it's really convenient to be able to set
DEVELOPER=1 and have a sane set of compiler flags. It's really good for
the project as it makes it easy for everyone to compile their code with
a standard set of warnings enabled.
> +if compiler.compiles('''
> + #include <inttypes.h>
> +
> + void func(void)
> + {
> + uintmax_t x = 0;
> + }
> +''', name: 'uintmax_t')
> + libgit_c_args += '-DNO_UINTMAX_T'
> +endif
I think the logic is backwards here - shouldn't we be defining
NO_UINTMAX_T if it does not compile? uintptr_t is optional so we
should be checking for that and defining NO_UINTPTR_T if it's missing
as well I think.
> +if compiler.run('''
> + #include <stdio.h>
> +
> + int main(int argc, const char **argv)
> + {
> + FILE *f = fopen(".", "r");
> + return f ? 0 : 1;
> + }
> +''', name: 'fread reads directories').returncode() == 0
> + libgit_c_args += '-DFREAD_READS_DIRECTORIES'
> + libgit_sources += 'compat/fopen.c'
> +endif
This checks a property of the build host so should it be guarded with
if not meson.is_cross_build() as below?
> +# Build a separate library for "version.c" so that we do not have to rebuild
> +# everything when the current Git commit changes. TODO: this only gets set up
> +# at configuration time, so we do not notice version changes unless the build
> +# instructions get regenerated. We should refactor the source file such that we
> +# can substitute tags in the file via `vcs_tag()`.
There are three version dependent strings GIT_VERSION,
GIT_BUILT_FROM_COMMIT and GIT_USER_AGENT - can vcs_tag() handle all
three or do we want a script that writes a header?
Best Wishes
Phillip
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v4 00/19] Modernize the build system
2024-11-13 13:29 ` Patrick Steinhardt
2024-11-13 14:57 ` Eli Schwartz
@ 2024-11-14 4:24 ` Junio C Hamano
2024-11-14 4:46 ` Eli Schwartz
1 sibling, 1 reply; 386+ messages in thread
From: Junio C Hamano @ 2024-11-14 4:24 UTC (permalink / raw)
To: Patrick Steinhardt
Cc: David Aguilar, Taylor Blau, git, Eli Schwartz, Eric Sunshine,
Phillip Wood, Ramsay Jones, Jeff King
Patrick Steinhardt <ps@pks.im> writes:
>> (2) There seems to be a difference in how symlinks and hardlinks are
>> handled in the install step.
>>
>> Running "make prefix=$PWD/dist install" ends up with real files in
>> dist/bin/ (hardlinks) whereas with Meson all of the files in the bin/
>> directory are symlinks into ../libexec/.
>
> Yup, that's documented as part of the commit message that introduces
> Meson as one of the main differences.
Is there a way to disable that? These symbolic-links pretending to
be installed files are quite annoying---when the target file is lost,
the links become useless.
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v4 00/19] Modernize the build system
2024-11-14 4:24 ` Junio C Hamano
@ 2024-11-14 4:46 ` Eli Schwartz
2024-11-14 8:15 ` Patrick Steinhardt
0 siblings, 1 reply; 386+ messages in thread
From: Eli Schwartz @ 2024-11-14 4:46 UTC (permalink / raw)
To: Junio C Hamano, Patrick Steinhardt
Cc: David Aguilar, Taylor Blau, git, Eric Sunshine, Phillip Wood,
Ramsay Jones, Jeff King
[-- Attachment #1.1: Type: text/plain, Size: 1307 bytes --]
On 11/13/24 11:24 PM, Junio C Hamano wrote:
> Is there a way to disable that? These symbolic-links pretending to
> be installed files are quite annoying---when the target file is lost,
> the links become useless.
INSTALL_SYMLINKS=1 in the existing Makefile is of course the one true
way... (and really, why would you expect the target file to be lost for
any reason).
That being said, it doesn't appear the patch series implements any of
the other multiplicity of choice in what kind of filesystem object gets
used for multiple copies of the same file. No hardlink or copy support
has been rigged up.
(Meson doesn't have a builtin function for performing hardlinks, by the
way. I don't really think I've seen people desire to do this outside of
one project being discussed right here right now. hardlinks are mainly
good at fooling people who look at them into not understanding the
association between the two, and at breaking across multiple
filesystems. It's definitely impossible to get it right automatically,
and asking users to make an informed choice here is just not something
that projects other than git seem to find valuable, for whatever reason.
So basically, it's fairly understandable that meson hasn't previously
added hardlink support.)
--
Eli Schwartz
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v4 00/19] Modernize the build system
2024-11-13 9:21 ` David Aguilar
2024-11-13 13:29 ` Patrick Steinhardt
2024-11-13 14:57 ` Eli Schwartz
@ 2024-11-14 8:15 ` Patrick Steinhardt
2 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-14 8:15 UTC (permalink / raw)
To: David Aguilar
Cc: Taylor Blau, git, Eli Schwartz, Eric Sunshine, Phillip Wood,
Junio C Hamano, Ramsay Jones, Jeff King
On Wed, Nov 13, 2024 at 01:21:52AM -0800, David Aguilar wrote:
> On Mon, Nov 11, 2024 at 11:36:34AM +0100, Patrick Steinhardt wrote:
> > On Sat, Nov 09, 2024 at 04:58:56AM -0800, David Aguilar wrote:
> (3) Not all of the same files seems to be getting installed.
>
> I don't see bin/gitk or bin/git-cvsserver when building with Meson.
gitk is intentionally committed. git-cvsserver is fixed now.
> The share/git-core/templates/ directory is missing completely.
Fixed.
> git-gui and its related files are missing. Perhaps this is
> intentional/todo at this stage and hasn't been added yet.
Yup, this is intentionally omitted for now.
> Meson installs bin/git-http-backend (symlinked to libexec)
> but in the original Makefile this file only exists in libexec/.
Huh, true. On my system (NixOS) it's also installed in 'bin/', but when
using the Makefile it indeed only ends up in 'libexec/'. Fixed now.
> The contents of libexec/git-core/ seems to be missing dozens of
> files compared to the Makefile build.
This is intentional, as I'm dropping the dashed builitins. Git does not
need these nowadays and resolves them internally anyway.
> share/perl5/ has a bunch of extra git-{cvsserver,send-email,svn,...}
> scripts so perhaps this is where some of those files went?
> The Makefile places these files in the libexec/ area instead
> of in the share/perl5/ area.
Fixed.
> The Makefile does not install share/gitweb/static/js/.
> Instead, it seems to mash everything together into a single
> share/gitweb/static/gitweb.js file which Meson does not install.
> Meson installs separate files in the share/gitweb/static/js/ area.
> Was that intentional, or is that just another todo?
No, this was unintentional, fixed now. What is missing in this context
is wiring up jsmin and cssmin, but I'll leave that as a todo for now.
Will send a new version later today with these fixes.
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v4 00/19] Modernize the build system
2024-11-13 14:57 ` Eli Schwartz
@ 2024-11-14 8:15 ` Patrick Steinhardt
0 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-14 8:15 UTC (permalink / raw)
To: Eli Schwartz
Cc: David Aguilar, Taylor Blau, git, Eric Sunshine, Phillip Wood,
Junio C Hamano, Ramsay Jones, Jeff King
On Wed, Nov 13, 2024 at 09:57:55AM -0500, Eli Schwartz wrote:
> On 11/13/24 8:29 AM, Patrick Steinhardt wrote:
> > Fair. I don't really expect anybody to use the combination of muon/sumo
> > for everyday work, mostly because the usability is not quite up to par
> > with Meson/Ninja. But there are two use cases that I deem important:
>
> (samu :P)
Heh. Just double checked that I got it correct in the docs, but seems
like I did.
> >> Thanks. I don't want to be the CMake champion, so here are a few
> >> helpful/surprising details about the Meson build to help make it better.
> >>
> >>
> >> (1) I first built w/out having "curl-config" installed. I was surprised
> >> to find that "ninja -C build install" ended up installing "bin/curl" and
> >> "bin/curl-config" into the prefix.
> >>
> >> Is there a way to have the install step only install Git without
> >> bringing along these other non-Git bits?
> >
> > It definitely shouldn't install curl and curl-config, I'll have a look
> > at that. But other than that Meson is currently set up such that it will
> > automatically fall back to the subprojects in case certain dependencies
> > cannot be found. This can be disabled via `meson setup --wrap-mode
> > nofallback`.
>
> https://github.com/mesonbuild/wrapdb/tree/master/subprojects/packagefiles/curl
>
> could be updated to handle the case where meson.is_subproject() returns
> "true", by not installing tooling.
>
> Alternatively, meson install --skip-subprojects can avoid installing
> *any* files from subprojects, on the theory that subprojects exist
> solely to provide static libraries linked into the real project.
>
> (In theory, one could have a subproject where arbitrary data files from
> a subproject dependency are crucial at runtime. I think the gnome
> ecosystem does this, hence using GLib / Gtk as a subproject "needs" to
> install the subproject too -- but curl definitely doesn't have this
> issue...)
Yeah. `--skip-subprojects` is one way to do this, but that of course
requires the user to know about it. It would be nice if one could wire
this up in "meson.build" directly, e.g. by passing a `install: false`
flag to `dependency()`. We don't want to install any of the subprojects
as we build all of them statically and link them into the final
binaries.
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v4 00/19] Modernize the build system
2024-11-14 4:46 ` Eli Schwartz
@ 2024-11-14 8:15 ` Patrick Steinhardt
2024-11-14 23:06 ` Junio C Hamano
0 siblings, 1 reply; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-14 8:15 UTC (permalink / raw)
To: Eli Schwartz
Cc: Junio C Hamano, David Aguilar, Taylor Blau, git, Eric Sunshine,
Phillip Wood, Ramsay Jones, Jeff King
On Wed, Nov 13, 2024 at 11:46:32PM -0500, Eli Schwartz wrote:
> On 11/13/24 11:24 PM, Junio C Hamano wrote:
> > Is there a way to disable that? These symbolic-links pretending to
> > be installed files are quite annoying---when the target file is lost,
> > the links become useless.
>
> INSTALL_SYMLINKS=1 in the existing Makefile is of course the one true
> way... (and really, why would you expect the target file to be lost for
> any reason).
>
> That being said, it doesn't appear the patch series implements any of
> the other multiplicity of choice in what kind of filesystem object gets
> used for multiple copies of the same file. No hardlink or copy support
> has been rigged up.
>
> (Meson doesn't have a builtin function for performing hardlinks, by the
> way. I don't really think I've seen people desire to do this outside of
> one project being discussed right here right now. hardlinks are mainly
> good at fooling people who look at them into not understanding the
> association between the two, and at breaking across multiple
> filesystems. It's definitely impossible to get it right automatically,
> and asking users to make an informed choice here is just not something
> that projects other than git seem to find valuable, for whatever reason.
> So basically, it's fairly understandable that meson hasn't previously
> added hardlink support.)
Yeah, for now we exclusively use symlinks for this and I didn't wire up
an alternative. This was mostly to keep things simple while still ending
up with a fully functional Git distribution. I also couldn't think of a
scenario where symlinks would be an issue -- Meson also supports them on
Windows, so that would not be an issue.
If this is a requirement I can adapt though. While Meson does not
support hardlinks natively, we can of of course manually wire up them
if required.
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [PATCH RFC v6 08/19] Makefile: refactor GIT-VERSION-GEN to be reusable
2024-11-13 16:30 ` Phillip Wood
@ 2024-11-14 9:10 ` Patrick Steinhardt
2024-11-14 23:12 ` Junio C Hamano
0 siblings, 1 reply; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-14 9:10 UTC (permalink / raw)
To: phillip.wood
Cc: git, Eli Schwartz, Eric Sunshine, Junio C Hamano, Ramsay Jones,
Taylor Blau, David Aguilar, Jeff King
On Wed, Nov 13, 2024 at 04:30:33PM +0000, Phillip Wood wrote:
> Hi Patrick
>
> On 12/11/2024 17:02, Patrick Steinhardt wrote:
> > Our "GIT-VERSION-GEN" script always writes the "GIT-VERSION-FILE" into
> > the current directory, where the expectation is that it should exist in
> > the source directory. But other build systems that support out-of-tree
> > builds may not want to do that to keep the source directory pristine,
> > even though CMake currently doesn't care.
> >
> > Refactor the script such that it doesn't write output to a file anymore
> > but so that it instead writes the version to stdout. This makes it
> > easier to compute the same version as our Makefile would without having
> > to write the "GIT-VERSION-FILE".
>
> This patch moves the logic that only updates GIT-VERSION-FILE if the
> version has changed from the script into the Makefile. As we really want
> the CMake and meson builds to set the string at build time which
> probably means extending GIT-VERSION-GEN to write a header file that
> defines GIT_VERSION etc. I'm not sure this is a good direction. In the
> long run I think we'd be better off with something like the patch below.
Yes, I fully agree that using a version header would make more sense. I
had the intent to do this as a follow-up, but I'll have a look at your
patch and maybe do it now already.
Thanks!
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [RFC PATCH v4 00/19] Modernize the build system
2024-11-14 8:15 ` Patrick Steinhardt
@ 2024-11-14 23:06 ` Junio C Hamano
0 siblings, 0 replies; 386+ messages in thread
From: Junio C Hamano @ 2024-11-14 23:06 UTC (permalink / raw)
To: Patrick Steinhardt
Cc: Eli Schwartz, David Aguilar, Taylor Blau, git, Eric Sunshine,
Phillip Wood, Ramsay Jones, Jeff King
Patrick Steinhardt <ps@pks.im> writes:
> If this is a requirement I can adapt though. While Meson does not
> support hardlinks natively, we can of of course manually wire up them
> if required.
Nah, there must be bigger fish to fry in the new build system
integration, and I have a feeling that by the time we are done, we
may have lost the largest need for hardlinks.
I have a feeling that in _some_ future, we may not be installing
"git-add" and friends for the built-in commands anywhere on disk,
which is historically the primary thing we use hardlinks for to
conserve both disk space and inodes.
Thanks.
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [PATCH RFC v6 08/19] Makefile: refactor GIT-VERSION-GEN to be reusable
2024-11-14 9:10 ` Patrick Steinhardt
@ 2024-11-14 23:12 ` Junio C Hamano
0 siblings, 0 replies; 386+ messages in thread
From: Junio C Hamano @ 2024-11-14 23:12 UTC (permalink / raw)
To: Patrick Steinhardt
Cc: phillip.wood, git, Eli Schwartz, Eric Sunshine, Ramsay Jones,
Taylor Blau, David Aguilar, Jeff King
Patrick Steinhardt <ps@pks.im> writes:
> Yes, I fully agree that using a version header would make more sense. I
> had the intent to do this as a follow-up, but I'll have a look at your
> patch and maybe do it now already.
Yeah, I like the direction myself, too.
Some folks (including me) may need to adjust build wrappers they
have around our Makefile when we change behaviour of GIT-VERSION-GEN
and friends, but these files are meant to be "implementation
details" that server our build, and anybody who have been depending
on their behaviour are responsible for adjusting to changes to them.
^ permalink raw reply [flat|nested] 386+ messages in thread
* [PATCH RFC v7 00/22] Modernize the build system
2024-10-02 15:15 [RFC PATCH 00/21] Modernize the build system Patrick Steinhardt
` (26 preceding siblings ...)
2024-11-12 17:02 ` [PATCH RFC v6 " Patrick Steinhardt
@ 2024-11-15 7:21 ` Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 01/22] Makefile: use common template for GIT-BUILD-OPTIONS Patrick Steinhardt
` (23 more replies)
2024-11-19 11:50 ` [PATCH v8 00/23] " Patrick Steinhardt
` (3 subsequent siblings)
31 siblings, 24 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-15 7:21 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
Hi,
this patch series modernizes our build infrasturcture. It refactors
various parts of it to make it possible to perform out-of-tree builds in
theory.
The series then continues to wire up Meson as a proposed alternative as
a modern replacement for our current build systems. It provides better
integration into IDEs than our Makefiles, better usability than our
Makefiles and CMake, better configuration and discoverability thereof
than autoconf and CMake (which is of course my personal opinion).
The intent is to have Meson replace autoconf, which is mostly unused and
broken. Eventually, the plan would to also replace CMake and our
Makefiles in case we figure out that this replacement is indeed a net
benefit for the project, but all of this would happen over the course of
multiple releases.
Changes in v7:
- Fix overriding TEST_OUTPUT_DIRECTORY via the environment.
- Rework generation of version information. GIT-VERSION-GEN now knows
to replace @PLACEHOLDERS@ in other files, and this gets used across
Makefiles, CMake and Meson now. This makes us properly rebuild when
the version info changes and fixes the version numbers in "git.rc".
- The CMake build instructions are now doing a proper out-of-tree
build.
- We now generate and install gitweb.js, which gets built via a new
"generate-gitweb-js.sh".
- Some improvements to the Meson documentation.
- Wire up DEVELOPER=1 style warnings via `--warnlevel 2` and above.
- Wire up sanitizers properly.
- Provide a new "regex" option to disable the platform-provided
version of regcomp() et al.
- Stop installing git-http-backend into bindir.
- Install Perl scripts into libexecdir.
- Install git-cvsserver into bindir and libexecdir.
- Install template directory into datadir.
As before, the tip of this patch series catches up with what is
happening in "seen". If you want to test it without topics in "seen" you
have to revert it.
Links to previous versions:
- Link to v1: https://lore.kernel.org/r/cover.1727881164.git.ps@pks.im
- Link to v2: https://lore.kernel.org/r/cover.1728485139.git.ps@pks.im
- Link to v3: https://lore.kernel.org/r/cover.1729254070.git.ps@pks.im
- Link to v4: https://lore.kernel.org/r/cover.1729771605.git.ps@pks.im
- Link to v5: https://lore.kernel.org/r/cover.1731335938.git.ps@pks.im
- Link to v6: https://lore.kernel.org/r/20241112-pks-meson-v6-0-648b30996827@pks.im
Thanks!
Patrick
To: git@vger.kernel.org
Cc: Eli Schwartz <eschwartz@gentoo.org>
Cc: Eric Sunshine <sunshine@sunshineco.com>
Cc: Phillip Wood <phillip.wood123@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>
Cc: Ramsay Jones <ramsay@ramsayjones.plus.com>
Cc: Taylor Blau <me@ttaylorr.com>
Cc: David Aguilar <davvid@gmail.com>
Cc: Jeff King <peff@peff.net>
Cc: Christian Couder <christian.couder@gmail.com>
Patrick Steinhardt (22):
Makefile: use common template for GIT-BUILD-OPTIONS
Makefile: consistently use @PLACEHOLDER@ to substitute
Makefile: refactor GIT-VERSION-GEN to be reusable
Makefile: propagate Git version via generated header
Makefile: generate "git.rc" via GIT-VERSION-GEN
Makefile: consistently use PERL_PATH
Makefile: extract script to massage Perl scripts
Makefile: use "generate-perl.sh" to massage Perl library
Makefile: extract script to massage Shell scripts
Makefile: extract script to generate gitweb.cgi
Makefile: extract script to generate gitweb.js
Makefile: refactor generators to be PWD-independent
Makefile: allow "bin-wrappers/" directory to exist
Makefile: simplify building of templates
Documentation: allow sourcing generated includes from separate dir
Documentation: teach "cmd-list.perl" about out-of-tree builds
Documentation: extract script to generate a list of mergetools
t: better support for out-of-tree builds
t: allow overriding build dir
Documentation: add comparison of build systems
Introduce support for the Meson build system
meson: fix conflicts with in-flight topics
.gitignore | 3 +-
Documentation/CodingGuidelines | 2 +-
Documentation/Makefile | 28 +-
Documentation/build-docdep.perl | 2 +
Documentation/cmd-list.perl | 23 +-
Documentation/config/diff.txt | 2 +-
Documentation/config/merge.txt | 2 +-
Documentation/generate-mergetool-list.sh | 17 +
Documentation/git.txt | 24 +-
Documentation/meson.build | 317 ++++
Documentation/technical/build-systems.txt | 224 +++
GIT-BUILD-OPTIONS.in | 47 +
GIT-VERSION-FILE.in | 1 +
GIT-VERSION-GEN | 62 +-
Makefile | 232 +--
bin-wrappers/.gitignore | 9 +
bin-wrappers/meson.build | 28 +
bin-wrappers/wrap-for-bin.sh | 37 +
ci/test-documentation.sh | 2 +-
configure.ac | 2 +-
contrib/buildsystems/CMakeLists.txt | 287 +--
contrib/buildsystems/git-version.in | 1 +
contrib/completion/meson.build | 8 +
contrib/meson.build | 1 +
generate-cmdlist.sh | 42 +-
generate-configlist.sh | 20 +-
generate-hooklist.sh | 15 +-
generate-perl.sh | 37 +
generate-script.sh | 34 +
git-cvsserver.perl | 2 +-
git-instaweb.sh | 8 +-
git-request-pull.sh | 2 +-
git-send-email.perl | 2 +-
git-sh-i18n.sh | 6 +-
git-sh-setup.sh | 6 +-
git-svn.perl | 2 +-
git.rc => git.rc.in | 6 +-
gitk-git/po/vi.po | 2 +-
gitweb/GITWEB-BUILD-OPTIONS.in | 24 +
gitweb/Makefile | 62 +-
gitweb/generate-gitweb-cgi.sh | 47 +
gitweb/generate-gitweb-js.sh | 12 +
gitweb/gitweb.perl | 44 +-
gitweb/meson.build | 79 +
meson.build | 1857 ++++++++++++++++++++
meson_options.txt | 83 +
perl/FromCPAN/Mail/meson.build | 7 +
perl/FromCPAN/meson.build | 9 +
perl/Git/I18N.pm | 6 +-
perl/Git/LoadCPAN.pm | 6 +-
perl/Git/LoadCPAN/Mail/meson.build | 7 +
perl/Git/LoadCPAN/meson.build | 9 +
perl/Git/SVN/Memoize/meson.build | 7 +
perl/Git/SVN/meson.build | 20 +
perl/Git/meson.build | 18 +
perl/header_templates/fixed_prefix.template.pl | 2 +-
perl/header_templates/runtime_prefix.template.pl | 8 +-
perl/meson.build | 12 +
po/meson.build | 27 +
subprojects/.gitignore | 1 +
subprojects/curl.wrap | 13 +
subprojects/expat.wrap | 13 +
subprojects/openssl.wrap | 15 +
subprojects/pcre2.wrap | 16 +
subprojects/zlib.wrap | 13 +
t/helper/meson.build | 93 +
t/lib-gettext.sh | 4 +-
t/meson.build | 1107 ++++++++++++
t/t7609-mergetool--lib.sh | 2 +-
t/test-lib.sh | 31 +-
templates/Makefile | 39 +-
templates/branches-- | 1 -
templates/{this--description => description} | 0
.../applypatch-msg.sample} | 0
.../commit-msg.sample} | 0
.../fsmonitor-watchman.sample} | 0
templates/hooks/meson.build | 26 +
.../post-update.sample} | 0
.../pre-applypatch.sample} | 0
.../pre-commit.sample} | 0
.../pre-merge-commit.sample} | 0
.../pre-push.sample} | 0
.../pre-rebase.sample} | 0
.../pre-receive.sample} | 0
.../prepare-commit-msg.sample} | 0
.../push-to-checkout.sample} | 0
.../sendemail-validate.sample} | 0
.../{hooks--update.sample => hooks/update.sample} | 0
templates/{info--exclude => info/exclude} | 0
templates/info/meson.build | 7 +
templates/meson.build | 15 +
unimplemented.sh | 2 +-
version-def.h.in | 8 +
version.c | 1 +
wrap-for-bin.sh | 36 -
95 files changed, 4848 insertions(+), 486 deletions(-)
Range-diff versus v6:
1: 7c89e63ea5 ! 1: 61d8677718 Makefile: use common template for GIT-BUILD-OPTIONS
@@ Commit message
While at it, remove the `SUPPORTS_SIMPLE_IPC` variable that we only set
up in CMake as it isn't used anywhere.
- Note that this change requires us to move around the setup of
- TEST_OUTPUT_DIRECTORY in "test-lib.sh" such that it comes after sourcing
- the "GIT-BUILD-OPTIONS" file. This is the only instance I could find
- where we rely on ordering on variables.
+ This change requires us to adapt the setup of TEST_OUTPUT_DIRECTORY in
+ "test-lib.sh" such that it does not get overwritten after sourcing when
+ it has been set up via the environment. This is the only instance I
+ could find where we rely on ordering on variables.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
@@ contrib/buildsystems/CMakeLists.txt: if(NOT PYTHON_TESTS)
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PYTHON='${NO_PYTHON}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "SUPPORTS_SIMPLE_IPC='${SUPPORTS_SIMPLE_IPC}'\n")
+file(STRINGS ${CMAKE_SOURCE_DIR}/GIT-BUILD-OPTIONS.in git_build_options NEWLINE_CONSUME)
-+string(REPLACE "@SHELL_PATH@" "${SHELL_PATH}" git_build_options "${git_build_options}")
-+string(REPLACE "@TEST_SHELL_PATH@" "${TEST_SHELL_PATH}" git_build_options "${git_build_options}")
-+string(REPLACE "@PERL_PATH@" "${PERL_PATH}" git_build_options "${git_build_options}")
-+string(REPLACE "@DIFF@" "${DIFF}" git_build_options "${git_build_options}")
-+string(REPLACE "@PYTHON_PATH@" "${PYTHON_PATH}" git_build_options "${git_build_options}")
-+string(REPLACE "@TAR@" "${TAR}" git_build_options "${git_build_options}")
++string(REPLACE "@SHELL_PATH@" "'${SHELL_PATH}'" git_build_options "${git_build_options}")
++string(REPLACE "@TEST_SHELL_PATH@" "'${TEST_SHELL_PATH}'" git_build_options "${git_build_options}")
++string(REPLACE "@PERL_PATH@" "'${PERL_PATH}'" git_build_options "${git_build_options}")
++string(REPLACE "@DIFF@" "'${DIFF}'" git_build_options "${git_build_options}")
++string(REPLACE "@PYTHON_PATH@" "'${PYTHON_PATH}'" git_build_options "${git_build_options}")
++string(REPLACE "@TAR@" "'${TAR}'" git_build_options "${git_build_options}")
+string(REPLACE "@NO_CURL@" "${NO_CURL}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_ICONV@" "${NO_ICONV}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_EXPAT@" "${NO_EXPAT}" git_build_options "${git_build_options}")
@@ contrib/buildsystems/CMakeLists.txt: if(NOT PYTHON_TESTS)
+string(REPLACE "@NO_PYTHON@" "${NO_PYTHON}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_REGEX@" "" git_build_options "${git_build_options}")
+string(REPLACE "@NO_UNIX_SOCKETS@" "${NO_UNIX_SOCKETS}" git_build_options "${git_build_options}")
-+string(REPLACE "@PAGER_ENV@" "${PAGER_ENV}" git_build_options "${git_build_options}")
++string(REPLACE "@PAGER_ENV@" "'${PAGER_ENV}'" git_build_options "${git_build_options}")
+string(REPLACE "@SANITIZE_LEAK@" "" git_build_options "${git_build_options}")
+string(REPLACE "@SANITIZE_ADDRESS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@X@" "${EXE_EXTENSION}" git_build_options "${git_build_options}")
@@ contrib/buildsystems/CMakeLists.txt: if(NOT PYTHON_TESTS)
+string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}")
-+string(REPLACE "@RUNTIME_PREFIX@" "${RUNTIME_PREFIX}" git_build_options "${git_build_options}")
++string(REPLACE "@RUNTIME_PREFIX@" "'${RUNTIME_PREFIX}'" git_build_options "${git_build_options}")
if(USE_VCPKG)
- file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
+ string(APPEND git_build_options "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
@@ t/test-lib.sh: else
GIT_BUILD_DIR="${TEST_DIRECTORY%/t}"
if test "$TEST_DIRECTORY" = "$GIT_BUILD_DIR"
then
+@@ t/test-lib.sh: export LSAN_OPTIONS
+ prepend_var UBSAN_OPTIONS : $GIT_SAN_OPTIONS
+ export UBSAN_OPTIONS
+
++# The TEST_OUTPUT_DIRECTORY will be overwritten via GIT-BUILD-OPTIONS. So in
++# case the caller has manually set up this variable via the environment we must
++# make sure to not overwrite that value, and thus we save it into
++# TEST_OUTPUT_DIRECTORY_OVERRIDE here.
++if test -n "$TEST_OUTPUT_DIRECTORY" && test -z "$TEST_OUTPUT_DIRECTORY_OVERRIDE"
++then
++ TEST_OUTPUT_DIRECTORY_OVERRIDE=$TEST_OUTPUT_DIRECTORY
++fi
++
+ if test ! -f "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
+ then
+ echo >&2 'error: GIT-BUILD-OPTIONS missing (has Git been built?).'
@@ t/test-lib.sh: fi
. "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
export PERL_PATH SHELL_PATH
2: ebddce640a = 2: 749b5d29e5 Makefile: consistently use @PLACEHOLDER@ to substitute
-: ---------- > 3: af6b00a7b7 Makefile: refactor GIT-VERSION-GEN to be reusable
-: ---------- > 4: 666c1d6cf4 Makefile: propagate Git version via generated header
-: ---------- > 5: 0358fa0574 Makefile: generate "git.rc" via GIT-VERSION-GEN
3: 2b8f7520bf = 6: d99407979a Makefile: consistently use PERL_PATH
4: 4545c43196 ! 7: 47e0291d3e Makefile: extract script to massage Perl scripts
@@ Makefile: endif
- $< >$@+ && \
- chmod +x $@+ && \
+$(SCRIPT_PERL_GEN): % : %.perl generate-perl.sh GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
-+ $(QUIET_GEN)$(SHELL_PATH) generate-perl.sh ./GIT-BUILD-OPTIONS $(GIT_VERSION) GIT-PERL-HEADER "$<" "$@+" && \
++ $(QUIET_GEN)$(SHELL_PATH) generate-perl.sh ./GIT-BUILD-OPTIONS ./GIT-VERSION-FILE GIT-PERL-HEADER "$<" "$@+" && \
mv $@+ $@
PERL_DEFINES := $(subst $(space),:,$(PERL_DEFINES))
@@ contrib/buildsystems/CMakeLists.txt: foreach(script ${git_shell_scripts})
string(REPLACE "@PATHSEP@" ":" perl_header "${perl_header}")
string(REPLACE "@INSTLIBDIR@" "${INSTLIBDIR}" perl_header "${perl_header}")
+file(WRITE ${CMAKE_BINARY_DIR}/PERL-HEADER ${perl_header})
++
++add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/GIT-VERSION-FILE"
++ COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
++ "${CMAKE_SOURCE_DIR}"
++ "${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE.in"
++ "${CMAKE_BINARY_DIR}/GIT-VERSION-FILE"
++ DEPENDS ${SH_EXE} "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
++ "${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE.in"
++ VERBATIM)
foreach(script ${git_perl_scripts})
- file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.perl content NEWLINE_CONSUME)
@@ contrib/buildsystems/CMakeLists.txt: foreach(script ${git_shell_scripts})
+ add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/${perl_gen_path}"
+ COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-perl.sh"
+ "${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS"
-+ "${PROJECT_VERSION}"
++ "${CMAKE_BINARY_DIR}/GIT-VERSION-FILE"
+ "${CMAKE_BINARY_DIR}/PERL-HEADER"
+ "${CMAKE_SOURCE_DIR}/${script}"
+ "${CMAKE_BINARY_DIR}/${perl_gen_path}"
+ DEPENDS "${CMAKE_SOURCE_DIR}/generate-perl.sh"
+ "${CMAKE_SOURCE_DIR}/${script}"
++ "${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS"
++ "${CMAKE_BINARY_DIR}/GIT-VERSION-FILE"
+ VERBATIM)
+ list(APPEND perl_gen ${CMAKE_BINARY_DIR}/${perl_gen_path})
endforeach()
@@ generate-perl.sh (new)
+
+if test $# -ne 5
+then
-+ echo "USAGE: $0 <GIT_BUILD_OPTIONS> <GIT_VERSION> <PERL_HEADER> <INPUT> <OUTPUT>" >&2
++ echo "USAGE: $0 <GIT_BUILD_OPTIONS> <GIT_VERSION_FILE> <PERL_HEADER> <INPUT> <OUTPUT>" >&2
+ exit 1
+fi
+
+GIT_BUILD_OPTIONS="$1"
-+GIT_VERSION="$2"
++GIT_VERSION_FILE="$2"
+PERL_HEADER="$3"
+INPUT="$4"
+OUTPUT="$5"
+
+. "$GIT_BUILD_OPTIONS"
++. "$GIT_VERSION_FILE"
+
+sed -e '1{' \
+ -e " s|#!.*perl|#!$PERL_PATH|" \
5: 50948f7020 ! 8: c3f9a22ae4 Makefile: use "generate-perl.sh" to massage Perl library
@@ Makefile: endif
endif
-perl/build/lib/%.pm: perl/%.pm GIT-PERL-DEFINES
-+perl/build/lib/%.pm: perl/%.pm generate-perl.sh GIT-BUILD-OPTIONS GIT-PERL-DEFINES
++perl/build/lib/%.pm: perl/%.pm generate-perl.sh GIT-BUILD-OPTIONS GIT-VERSION-FILE GIT-PERL-DEFINES
$(call mkdir_p_parent_template)
- $(QUIET_GEN) \
- sed -e 's|@LOCALEDIR@|$(perl_localedir_SQ)|g' \
- -e 's|@NO_GETTEXT@|$(NO_GETTEXT_SQ)|g' \
- -e 's|@NO_PERL_CPAN_FALLBACKS@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \
- < $< > $@
-+ $(QUIET_GEN)$(SHELL_PATH) generate-perl.sh ./GIT-BUILD-OPTIONS $(GIT_VERSION) GIT-PERL-HEADER "$<" "$@"
++ $(QUIET_GEN)$(SHELL_PATH) generate-perl.sh ./GIT-BUILD-OPTIONS ./GIT-VERSION-FILE GIT-PERL-HEADER "$<" "$@"
perl/build/man/man3/Git.3pm: perl/Git.pm
$(call mkdir_p_parent_template)
@@ contrib/buildsystems/CMakeLists.txt: endforeach()
#create perl header
file(STRINGS ${CMAKE_SOURCE_DIR}/perl/header_templates/fixed_prefix.template.pl perl_header )
-@@ contrib/buildsystems/CMakeLists.txt: string(REPLACE "@PATHSEP@" ":" perl_header "${perl_header}")
- string(REPLACE "@INSTLIBDIR@" "${INSTLIBDIR}" perl_header "${perl_header}")
- file(WRITE ${CMAKE_BINARY_DIR}/PERL-HEADER ${perl_header})
+@@ contrib/buildsystems/CMakeLists.txt: add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/GIT-VERSION-FILE"
+ "${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE.in"
+ VERBATIM)
-foreach(script ${git_perl_scripts})
+foreach(script ${git_perl_scripts} ${perl_modules})
@@ contrib/buildsystems/CMakeLists.txt: file(STRINGS ${CMAKE_SOURCE_DIR}/git-p4.py
file(GLOB templates "${CMAKE_SOURCE_DIR}/templates/*")
list(TRANSFORM templates REPLACE "${CMAKE_SOURCE_DIR}/templates/" "")
@@ contrib/buildsystems/CMakeLists.txt: file(STRINGS ${CMAKE_SOURCE_DIR}/GIT-BUILD-OPTIONS.in git_build_options NEWLINE_
- string(REPLACE "@SHELL_PATH@" "${SHELL_PATH}" git_build_options "${git_build_options}")
- string(REPLACE "@TEST_SHELL_PATH@" "${TEST_SHELL_PATH}" git_build_options "${git_build_options}")
- string(REPLACE "@PERL_PATH@" "${PERL_PATH}" git_build_options "${git_build_options}")
-+string(REPLACE "@PERL_LOCALEDIR@" "${LOCALEDIR}" git_build_options "${git_build_options}")
+ string(REPLACE "@SHELL_PATH@" "'${SHELL_PATH}'" git_build_options "${git_build_options}")
+ string(REPLACE "@TEST_SHELL_PATH@" "'${TEST_SHELL_PATH}'" git_build_options "${git_build_options}")
+ string(REPLACE "@PERL_PATH@" "'${PERL_PATH}'" git_build_options "${git_build_options}")
++string(REPLACE "@PERL_LOCALEDIR@" "'${LOCALEDIR}'" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PERL_CPAN_FALLBACKS@" "" git_build_options "${git_build_options}")
- string(REPLACE "@DIFF@" "${DIFF}" git_build_options "${git_build_options}")
- string(REPLACE "@PYTHON_PATH@" "${PYTHON_PATH}" git_build_options "${git_build_options}")
- string(REPLACE "@TAR@" "${TAR}" git_build_options "${git_build_options}")
+ string(REPLACE "@DIFF@" "'${DIFF}'" git_build_options "${git_build_options}")
+ string(REPLACE "@PYTHON_PATH@" "'${PYTHON_PATH}'" git_build_options "${git_build_options}")
+ string(REPLACE "@TAR@" "'${TAR}'" git_build_options "${git_build_options}")
## generate-perl.sh ##
@@ generate-perl.sh: OUTPUT="$5"
- . "$GIT_BUILD_OPTIONS"
+ . "$GIT_VERSION_FILE"
sed -e '1{' \
+ -e " /^#!.*perl/!b" \
6: 2340c63def ! 9: 23f094d0ba Makefile: extract script to massage Shell scripts
@@ Makefile: GIT-SCRIPT-DEFINES: FORCE
+ $(QUIET_GEN)./generate-script.sh "$<" "$@+" ./GIT-BUILD-OPTIONS && \
mv $@+ $@
- git.res: git.rc GIT-VERSION-FILE GIT-PREFIX
+ git.rc: git.rc.in GIT-VERSION-GEN GIT-VERSION-FILE
@@ Makefile: GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile
perllibdir:
@echo '$(perllibdir_SQ)'
@@ contrib/buildsystems/CMakeLists.txt: set(git_shell_scripts
@@ contrib/buildsystems/CMakeLists.txt: string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_optio
string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}")
string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}")
- string(REPLACE "@RUNTIME_PREFIX@" "${RUNTIME_PREFIX}" git_build_options "${git_build_options}")
-+string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" git_build_options "${git_build_options}")
+ string(REPLACE "@RUNTIME_PREFIX@" "'${RUNTIME_PREFIX}'" git_build_options "${git_build_options}")
++string(REPLACE "@GITWEBDIR@" "'${GITWEBDIR}'" git_build_options "${git_build_options}")
+string(REPLACE "@USE_GETTEXT_SCHEME@" "" git_build_options "${git_build_options}")
-+string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" git_build_options "${git_build_options}")
++string(REPLACE "@LOCALEDIR@" "'${LOCALEDIR}'" git_build_options "${git_build_options}")
+string(REPLACE "@BROKEN_PATH_FIX@" "" git_build_options "${git_build_options}")
if(USE_VCPKG)
string(APPEND git_build_options "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
7: 68c0dad962 ! 10: 457a42ef55 Makefile: extract script to generate gitweb.cgi
@@ gitweb/GITWEB-BUILD-OPTIONS.in (new)
+PERL_PATH=@PERL_PATH@
+JSMIN=@JSMIN@
+CSSMIN=@CSSMIN@
-+GIT_VERSION=@GIT_VERSION@
+GIT_BINDIR=@GIT_BINDIR@
+GITWEB_CONFIG=@GITWEB_CONFIG@
+GITWEB_CONFIG_SYSTEM=@GITWEB_CONFIG_SYSTEM@
@@ gitweb/Makefile: GITWEB_JSLIB_FILES += static/js/javascript-detection.js
+ $(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS.in >"$@+"
@cmp -s $@+ $@ && rm -f $@+ || mv -f $@+ $@
-+$(MAK_DIR_GITWEB)gitweb.cgi: $(MAK_DIR_GITWEB)generate-gitweb.sh
++$(MAK_DIR_GITWEB)gitweb.cgi: $(MAK_DIR_GITWEB)generate-gitweb-cgi.sh
$(MAK_DIR_GITWEB)gitweb.cgi: $(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS
++$(MAK_DIR_GITWEB)gitweb.cgi: GIT-VERSION-FILE
$(MAK_DIR_GITWEB)gitweb.cgi: $(MAK_DIR_GITWEB)gitweb.perl
$(QUIET_GEN)$(RM) $@ $@+ && \
- sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
- $(GITWEB_REPLACE) $< >$@+ && \
- chmod +x $@+ && \
-+ $(MAK_DIR_GITWEB)generate-gitweb.sh $(MAK_DIR_GITWEB)/GITWEB-BUILD-OPTIONS $< $@+ && \
++ $(MAK_DIR_GITWEB)generate-gitweb-cgi.sh $(MAK_DIR_GITWEB)/GITWEB-BUILD-OPTIONS ./GIT-VERSION-FILE $< $@+ && \
mv $@+ $@
$(MAK_DIR_GITWEB)static/gitweb.js: $(addprefix $(MAK_DIR_GITWEB),$(GITWEB_JSLIB_FILES))
- ## gitweb/generate-gitweb.sh (new) ##
+ ## gitweb/generate-gitweb-cgi.sh (new) ##
@@
+#!/bin/sh
+
+set -e
+
-+if test $# -ne 3
++if test $# -ne 4
+then
-+ echo "USAGE: $0 <GITWEB-BUILD-OPTIONS> <INPUT> <OUTPUT>" >&2
++ echo "USAGE: $0 <GITWEB-BUILD-OPTIONS> <GIT-VERSION-FILE> <INPUT> <OUTPUT>" >&2
+ exit 1
+fi
+
+GITWEB_BUILD_OPTIONS="$1"
-+INPUT="$2"
-+OUTPUT="$3"
++GIT_VERSION_FILE="$2"
++INPUT="$3"
++OUTPUT="$4"
+
+. "$GITWEB_BUILD_OPTIONS"
++. "$GIT_VERSION_FILE"
+
+sed -e "1s|#!/usr/bin/perl|#!$PERL_PATH|" \
+ -e "s|@PERL_PATH@|$PERL_PATH|" \
8: f2735c317c < -: ---------- Makefile: refactor GIT-VERSION-GEN to be reusable
-: ---------- > 11: a9842baae7 Makefile: extract script to generate gitweb.js
9: e4fa8b74e8 = 12: eb8c8eaf71 Makefile: refactor generators to be PWD-independent
10: b1bbebf30d = 13: 8d74f3adde Makefile: allow "bin-wrappers/" directory to exist
11: bee17be2a2 ! 14: cda66f5f07 Makefile: simplify building of templates
@@ contrib/buildsystems/CMakeLists.txt: include_directories(${CMAKE_BINARY_DIR})
list(TRANSFORM libgit_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
list(TRANSFORM compat_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
+@@ contrib/buildsystems/CMakeLists.txt: list(APPEND libgit_SOURCES "${CMAKE_BINARY_DIR}/version-def.h")
add_library(libgit ${libgit_SOURCES} ${compat_SOURCES})
#libxdiff
12: b4cea04721 = 15: d763b2c7bb Documentation: allow sourcing generated includes from separate dir
13: 56ba18676e = 16: c3b0ce492c Documentation: teach "cmd-list.perl" about out-of-tree builds
14: 448f3aac9b = 17: 432cc11dea Documentation: extract script to generate a list of mergetools
15: dd4ceab0d8 ! 18: 436f8d7dcb t: better support for out-of-tree builds
@@ contrib/buildsystems/CMakeLists.txt: string(REPLACE "@GIT_PERF_MAKE_COMMAND@" ""
string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_options}")
string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}")
string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}")
-+string(REPLACE "@GIT_TEST_TEXTDOMAINDIR@" "${CMAKE_BINARY_DIR}/po/build/locale" git_build_options "${git_build_options}")
-+string(REPLACE "@GIT_TEST_POPATH@" "${CMAKE_BINARY_DIR}/po" git_build_options "${git_build_options}")
-+string(REPLACE "@GIT_TEST_TEMPLATE_DIR@" "${CMAKE_BINARY_DIR}/templates/blt" git_build_options "${git_build_options}")
-+string(REPLACE "@GIT_TEST_GITPERLLIB@" "${CMAKE_BINARY_DIR}/perl/build/lib" git_build_options "${git_build_options}")
-+string(REPLACE "@GIT_TEST_MERGE_TOOLS_DIR@" "${RUNTIME_PREFIX}" git_build_options "${git_build_options}")
- string(REPLACE "@RUNTIME_PREFIX@" "${RUNTIME_PREFIX}" git_build_options "${git_build_options}")
- string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" git_build_options "${git_build_options}")
++string(REPLACE "@GIT_TEST_TEXTDOMAINDIR@" "'${CMAKE_BINARY_DIR}/po/build/locale'" git_build_options "${git_build_options}")
++string(REPLACE "@GIT_TEST_POPATH@" "'${CMAKE_BINARY_DIR}/po'" git_build_options "${git_build_options}")
++string(REPLACE "@GIT_TEST_TEMPLATE_DIR@" "'${CMAKE_BINARY_DIR}/templates/blt'" git_build_options "${git_build_options}")
++string(REPLACE "@GIT_TEST_GITPERLLIB@" "'${CMAKE_BINARY_DIR}/perl/build/lib'" git_build_options "${git_build_options}")
++string(REPLACE "@GIT_TEST_MERGE_TOOLS_DIR@" "'${RUNTIME_PREFIX}'" git_build_options "${git_build_options}")
+ string(REPLACE "@RUNTIME_PREFIX@" "'${RUNTIME_PREFIX}'" git_build_options "${git_build_options}")
+ string(REPLACE "@GITWEBDIR@" "'${GITWEBDIR}'" git_build_options "${git_build_options}")
string(REPLACE "@USE_GETTEXT_SCHEME@" "" git_build_options "${git_build_options}")
## t/lib-gettext.sh ##
16: c1ac988650 = 19: eba2e18294 t: allow overriding build dir
17: fd053fe4a9 = 20: 0abdac86b1 Documentation: add comparison of build systems
18: 4c10499220 ! 21: 30055908e5 Introduce support for the Meson build system
@@ gitweb/meson.build (new)
+gitweb_config.set_quoted('PERL_PATH', perl.full_path())
+gitweb_config.set_quoted('CSSMIN', '')
+gitweb_config.set_quoted('JSMIN', '')
-+gitweb_config.set_quoted('GIT_VERSION', git_version)
+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/meson.build (new)
+ output: 'gitweb.cgi',
+ command: [
+ shell,
-+ meson.current_source_dir() / 'generate-gitweb.sh',
++ 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',
-+ 'static/js/adjust-timezone.js',
-+ 'static/js/blame_incremental.js',
-+ 'static/js/javascript-detection.js',
-+ 'static/js/lib/common-lib.js',
-+ 'static/js/lib/cookies.js',
-+ 'static/js/lib/datetime.js',
+]
+ fs.copyfile(asset,
+ install: true,
@@ meson.build (new)
+# Configuration
+# =============
+#
-+# The exact configuration of Git is determined when setting up the Git
-+# directory. Unless told otherwise, Meson will automatically detect the
-+# availability of various bits and pieces. There are two different kinds of
-+# options that can be used to further tweak the build:
++# The exact configuration of Git is determined when setting up the build
++# directory via `meson setup`. Unless told otherwise, Meson will automatically
++# detect the availability of various bits and pieces. There are two different
++# kinds of options that can be used to further tweak the build:
+#
+# - Built-in options provided by Meson.
+#
@@ meson.build (new)
+# Options can be configured either when setting up the build directory or can
+# be changed in preexisting build directories:
+#
-+# # Set up a build directory with optimized settings that will be
++# # Set up a new build directory with optimized settings that will be
+# # installed into an alternative prefix.
-+# $ meson setup --buildtype release --optimization 3 --strip --prefix=/home/$USER
++# $ meson setup --buildtype release --optimization 3 --strip --prefix=/home/$USER build
++#
++# # Set up a new build directory with a higher warning level. Level 2 is
++# # mostly equivalent to setting DEVELOPER=1, level 3 and "everything"
++# # will enable even more warnings.
++# $ meson setup -Dwarning_level=2
+#
-+# # Set up a build directory with 'address' and 'undefined' sanitizers
++# # Set up a new build directory with 'address' and 'undefined' sanitizers
+# # using Clang.
-+# $ CC=clang meson setup -Db_sanitize=address,undefined
++# $ CC=clang meson setup -Db_sanitize=address,undefined build
+#
+# # Disable tests in a preexisting build directory.
+# $ meson configure -Dtests=false
@@ meson.build (new)
+# # Disable features based on Python
+# $ meson configure -Dpython=disabled
+#
-+# # Disable features based on Python
-+# $ meson configure -Dpython=disabled
-+#
+# Options have a type like booleans, choices, strings or features. Features are
+# somewhat special as they can have one of three values: enabled, disabled or
+# auto. While the first two values are self-explanatory, "auto" will enable or
@@ meson.build (new)
+ script_environment.prepend('PATH', fs.parent(program.full_path()))
+endforeach
+
-+git_version = run_command(shell, 'GIT-VERSION-GEN', check: false, env: script_environment).stdout().strip()
-+if git_version == ''
-+ git_version = meson.project_version()
-+endif
-+
+compiler = meson.get_compiler('c')
+
+libgit_sources = [
@@ meson.build (new)
+build_options_config.set('GIT_TEST_OPTS', '')
+build_options_config.set('GIT_TEST_PERL_FATAL_WARNINGS', '')
+build_options_config.set('GIT_TEST_UTF8_LOCALE', '')
-+build_options_config.set('SANITIZE_ADDRESS', '')
-+build_options_config.set('SANITIZE_LEAK', '')
+build_options_config.set('BROKEN_PATH_FIX', '')
+build_options_config.set_quoted('LOCALEDIR', fs.as_posix(get_option('prefix') / get_option('localedir')))
+build_options_config.set('GITWEBDIR', fs.as_posix(get_option('prefix') / get_option('datadir') / 'gitweb'))
@@ meson.build (new)
+libgit_include_directories = [ '.' ]
+libgit_dependencies = [ ]
+
++# Treat any warning level above 1 the same as we treat DEVELOPER=1 in our
++# Makefile.
++if get_option('warning_level') in ['2','3', 'everything'] and compiler.get_argument_syntax() == 'gcc'
++ foreach cflag : [
++ '-Wdeclaration-after-statement',
++ '-Wformat-security',
++ '-Wold-style-definition',
++ '-Woverflow',
++ '-Wpointer-arith',
++ '-Wstrict-prototypes',
++ '-Wunused',
++ '-Wvla',
++ '-Wwrite-strings',
++ '-fno-common',
++ '-Wtautological-constant-out-of-range-compare',
++ # If a function is public, there should be a prototype and the right
++ # header file should be included. If not, it should be static.
++ '-Wmissing-prototypes',
++ # These are disabled because we have these all over the place.
++ '-Wno-empty-body',
++ '-Wno-missing-field-initializers',
++ '-Wno-sign-compare',
++ ]
++ if compiler.has_argument(cflag)
++ libgit_c_args += cflag
++ endif
++ endforeach
++endif
++
++if get_option('b_sanitize').contains('address')
++ build_options_config.set('SANITIZE_ADDRESS', 'YesCompiledWithIt')
++else
++ build_options_config.set('SANITIZE_ADDRESS', '')
++endif
++if get_option('b_sanitize').contains('leak')
++ libgit_c_args += '-DSUPPRESS_ANNOTATED_LEAKS'
++ build_options_config.set('SANITIZE_LEAK', 'YesCompiledWithIt')
++else
++ build_options_config.set('SANITIZE_LEAK', '')
++endif
++if get_option('b_sanitize').contains('undefined')
++ libgit_c_args += '-DSHA1DC_FORCE_ALIGNED_ACCESS'
++endif
++
+executable_suffix = ''
+if host_machine.system() == 'cygwin' or host_machine.system() == 'windows'
+ executable_suffix = '.exe'
@@ meson.build (new)
+ build_options_config.set('USE_LIBPCRE2', '')
+endif
+
-+curl = dependency('libcurl', version: '>=7.21.3', required: get_option('curl'), default_options: ['default_library=static', 'tests=disabled'])
++curl = dependency('libcurl', version: '>=7.21.3', required: get_option('curl'), default_options: ['default_library=static', 'tests=disabled', 'tool=disabled'])
+use_curl_for_imap_send = false
+if curl.found()
+ if curl.version().version_compare('>=7.34.0')
@@ meson.build (new)
+build_options_config.set_quoted('FSMONITOR_DAEMON_BACKEND', fsmonitor_backend)
+build_options_config.set_quoted('FSMONITOR_OS_SETTINGS', fsmonitor_backend)
+
-+if compiler.has_header('regex.h') and compiler.get_define('REG_STARTEND', prefix: '#include <regex.h>') != ''
++if not get_option('b_sanitize').contains('address') and get_option('regex').allowed() and compiler.has_header('regex.h') and compiler.get_define('REG_STARTEND', prefix: '#include <regex.h>') != ''
+ build_options_config.set('NO_REGEX', '')
+
+ if compiler.get_define('REG_ENHANCED', prefix: '#include <regex.h>') != ''
+ libgit_c_args += '-DUSE_ENHANCED_BASIC_REGULAR_EXPRESSIONS'
+ libgit_sources += 'compat/regcomp_enhanced.c'
+ endif
-+else
++elif not get_option('regex').enabled()
+ libgit_c_args += [
+ '-DNO_REGEX',
+ '-DGAWK',
@@ meson.build (new)
+ build_options_config.set('NO_REGEX', '1')
+ libgit_sources += 'compat/regex/regex.c'
+ libgit_include_directories += 'compat/regex'
++else
++ error('Native regex support requested but not found')
+endif
+
+# setitimer and friends are provided by compat/mingw.c.
@@ meson.build (new)
+ libgit_c_args += '-DHAVE_CLOCK_MONOTONIC'
+endif
+
-+if compiler.compiles('''
++if not compiler.compiles('''
+ #include <inttypes.h>
+
+ void func(void)
@@ meson.build (new)
+ endif
+endif
+
-+if compiler.run('''
++if not meson.is_cross_build() and compiler.run('''
+ #include <stdio.h>
+
+ int main(int argc, const char **argv)
@@ meson.build (new)
+ configuration: build_options_config,
+)
+
++version_def_h = custom_target(
++ command: [
++ shell,
++ meson.current_source_dir() / 'GIT-VERSION-GEN',
++ meson.current_source_dir(),
++ '@INPUT@',
++ '@OUTPUT@',
++ ],
++ input: meson.current_source_dir() / 'version-def.h.in',
++ output: 'version-def.h',
++ build_always_stale: true,
++)
++
++git_version_file = custom_target(
++ command: [
++ shell,
++ meson.current_source_dir() / 'GIT-VERSION-GEN',
++ meson.current_source_dir(),
++ '@INPUT@',
++ '@OUTPUT@',
++ ],
++ input: meson.current_source_dir() / 'GIT-VERSION-FILE.in',
++ output: 'GIT-VERSION-FILE',
++ build_always_stale: true,
++)
++
+# Build a separate library for "version.c" so that we do not have to rebuild
-+# everything when the current Git commit changes. TODO: this only gets set up
-+# at configuration time, so we do not notice version changes unless the build
-+# instructions get regenerated. We should refactor the source file such that we
-+# can substitute tags in the file via `vcs_tag()`.
++# everything when the current Git commit changes.
+libgit_version_library = static_library('git-version',
-+ sources: ['version.c'],
-+ c_args: libgit_c_args + [
-+ '-DGIT_VERSION="' + git_version + '"',
-+ '-DGIT_USER_AGENT="' + 'git/' + git_version + '"',
-+ '-DGIT_BUILT_FROM_COMMIT="' + run_command('git', 'rev-parse', '-q', '--verify', 'HEAD', check: false).stdout().strip() + '"',
++ sources: [
++ 'version.c',
++ version_def_h,
+ ],
++ c_args: libgit_c_args,
+ dependencies: libgit_dependencies,
+ include_directories: libgit_include_directories,
+)
@@ meson.build (new)
+common_main_sources = ['common-main.c']
+common_main_link_args = [ ]
+if host_machine.system() == 'windows'
-+ # TODO: wire these up properly.
-+ common_main_sources += import('windows').compile_resources('git.rc', args: [
-+ '-DMAJOR=1',
-+ '-DMINOR=1',
-+ '-DMICRO=1',
-+ '-DPATCHLEVEL=0',
-+ '-DGIT_VERSION=\\\"' + git_version + '.GIT\\\"',
-+ ])
++ git_rc = custom_target(
++ command: [
++ shell,
++ meson.current_source_dir() / 'GIT-VERSION-GEN',
++ meson.current_source_dir(),
++ '@INPUT@',
++ '@OUTPUT@',
++ ],
++ input: meson.current_source_dir() / 'git.rc.in',
++ output: 'git.rc',
++ build_always_stale: true,
++ )
++
++ common_main_sources += import('windows').compile_resources(git_rc,
++ include_directories: [meson.current_source_dir()],
++ )
+ if compiler.get_argument_syntax() == 'gcc'
+ common_main_link_args += [
+ '-municode',
@@ meson.build (new)
+
+foreach symlink : [
+ 'git',
-+ 'git-http-backend',
+ 'git-receive-pack',
+ 'git-shell',
+ 'git-upload-archive',
@@ meson.build (new)
+ shell,
+ meson.project_source_root() / 'generate-perl.sh',
+ meson.project_build_root() / 'GIT-BUILD-OPTIONS',
-+ git_version,
++ git_version_file.full_path(),
+ perl_header,
+ '@INPUT@',
+ '@OUTPUT@',
@@ meson.build (new)
+ output: fs.stem(script),
+ command: generate_perl_command,
+ install: true,
-+ install_dir: get_option('datadir') / 'perl5',
++ install_dir: get_option('libexecdir') / 'git-core',
++ depends: [git_version_file],
+ )
+ test_dependencies += generated_script
++
+ if script == 'git-cvsserver.perl'
+ bin_wrappers += generated_script
++
++ install_symlink(fs.stem(script),
++ install_dir: get_option('bindir'),
++ pointing_to: fs.relative_to(get_option('libexecdir') / 'git-core' / fs.stem(script), get_option('bindir')),
++ )
+ endif
+ endforeach
+
@@ meson.build (new)
## meson_options.txt (new) ##
@@
++# 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',
@@ meson_options.txt (new)
+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.')
+
++# 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',
@@ meson_options.txt (new)
+ description: 'Install bundled copies of CPAN modules that serve as a fallback in case the modules are not available on the system.')
+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.')
+
++# HTTPS backends.
+option('openssl', type: 'feature', value: 'auto',
+ description: 'Support access to HTTPS remotes. OpenSSL may still be pulled in if configured as SHA1 or SHA256 backend.')
+option('CommonCrypto', type: 'feature', value: 'auto',
+ description: 'Build tools written in Python.')
+
++# Hashing backends.
+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')
@@ meson_options.txt (new)
+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',
@@ templates/hooks/meson.build (new)
+ input: hook,
+ output: hook,
+ configuration: template_config,
++ install: true,
++ install_dir: get_option('datadir') / 'git-core/templates',
+ )
+endforeach
@@ templates/info/meson.build (new)
+ input: 'exclude',
+ output: 'exclude',
+ configuration: template_config,
++ install: true,
++ install_dir: get_option('datadir') / 'git-core/templates',
+)
## templates/meson.build (new) ##
@@ templates/meson.build (new)
+ input: 'description',
+ output: 'description',
+ configuration: template_config,
++ install: true,
++ install_dir: get_option('datadir') / 'git-core/templates',
+)
+
+subdir('hooks')
19: 88a7a7e38b = 22: 3bdf6240a5 meson: fix conflicts with in-flight topics
---
base-commit: b31fb630c0fc6869a33ed717163e8a1210460d94
change-id: 20241112-pks-meson-95b665c08f06
^ permalink raw reply [flat|nested] 386+ messages in thread
* [PATCH RFC v7 01/22] Makefile: use common template for GIT-BUILD-OPTIONS
2024-11-15 7:21 ` [PATCH RFC v7 00/22] " Patrick Steinhardt
@ 2024-11-15 7:21 ` Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 02/22] Makefile: consistently use @PLACEHOLDER@ to substitute Patrick Steinhardt
` (22 subsequent siblings)
23 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-15 7:21 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
The "GIT-BUILD-OPTIONS" file is generated by our build systems to
propagate built-in features and paths to our tests. The generation is
done ad-hoc, where both our Makefile and the CMake build instructions
simply echo a bunch of strings into the file. This makes it very hard to
figure out what variables are expected to exist and what format they
have, and the written variables can easily get out of sync between build
systems.
Introduce a new "GIT-BUILD-OPTIONS.in" template to address this issue.
This has multiple advantages:
- It demonstrates which built options exist in the first place.
- It can serve as a spot to document the build options.
- Some build systems complain when not all variables could be
substituted, alerting us of mismatches. Others don't, but if we
forgot to substitute such variables we now have a bogus string that
will likely cause our tests to fail, if they have any meaning in the
first place.
Backfill values that we didn't yet set in our CMake build instructions.
While at it, remove the `SUPPORTS_SIMPLE_IPC` variable that we only set
up in CMake as it isn't used anywhere.
This change requires us to adapt the setup of TEST_OUTPUT_DIRECTORY in
"test-lib.sh" such that it does not get overwritten after sourcing when
it has been set up via the environment. This is the only instance I
could find where we rely on ordering on variables.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-BUILD-OPTIONS.in | 36 ++++++++++++
Makefile | 109 +++++++++++++-----------------------
contrib/buildsystems/CMakeLists.txt | 58 ++++++++++++-------
t/test-lib.sh | 22 ++++++--
4 files changed, 130 insertions(+), 95 deletions(-)
diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in
new file mode 100644
index 0000000000000000000000000000000000000000..f0ca240493c94aa41a6b6241a8474e42f7cdc8b9
--- /dev/null
+++ b/GIT-BUILD-OPTIONS.in
@@ -0,0 +1,36 @@
+SHELL_PATH=@SHELL_PATH@
+TEST_SHELL_PATH=@TEST_SHELL_PATH@
+PERL_PATH=@PERL_PATH@
+DIFF=@DIFF@
+PYTHON_PATH=@PYTHON_PATH@
+TAR=@TAR@
+NO_CURL=@NO_CURL@
+NO_ICONV=@NO_ICONV@
+NO_EXPAT=@NO_EXPAT@
+USE_LIBPCRE2=@USE_LIBPCRE2@
+NO_PERL=@NO_PERL@
+NO_PTHREADS=@NO_PTHREADS@
+NO_PYTHON=@NO_PYTHON@
+NO_REGEX=@NO_REGEX@
+NO_UNIX_SOCKETS=@NO_UNIX_SOCKETS@
+PAGER_ENV=@PAGER_ENV@
+SANITIZE_LEAK=@SANITIZE_LEAK@
+SANITIZE_ADDRESS=@SANITIZE_ADDRESS@
+X=@X@
+FSMONITOR_DAEMON_BACKEND=@FSMONITOR_DAEMON_BACKEND@
+FSMONITOR_OS_SETTINGS=@FSMONITOR_OS_SETTINGS@
+TEST_OUTPUT_DIRECTORY=@TEST_OUTPUT_DIRECTORY@
+GIT_TEST_OPTS=@GIT_TEST_OPTS@
+GIT_TEST_CMP=@GIT_TEST_CMP@
+GIT_TEST_CMP_USE_COPIED_CONTEXT=@GIT_TEST_CMP_USE_COPIED_CONTEXT@
+GIT_TEST_UTF8_LOCALE=@GIT_TEST_UTF8_LOCALE@
+NO_GETTEXT=@NO_GETTEXT@
+GIT_PERF_REPEAT_COUNT=@GIT_PERF_REPEAT_COUNT@
+GIT_PERF_REPO=@GIT_PERF_REPO@
+GIT_PERF_LARGE_REPO=@GIT_PERF_LARGE_REPO@
+GIT_PERF_MAKE_OPTS=@GIT_PERF_MAKE_OPTS@
+GIT_PERF_MAKE_COMMAND=@GIT_PERF_MAKE_COMMAND@
+GIT_INTEROP_MAKE_OPTS=@GIT_INTEROP_MAKE_OPTS@
+GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@
+GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@
+RUNTIME_PREFIX=@RUNTIME_PREFIX@
diff --git a/Makefile b/Makefile
index d06c9a8ffa7b637050c9619a367fbe61e7243a74..962df75635a8cbf7114970ddfe7948ff17c65fdc 100644
--- a/Makefile
+++ b/Makefile
@@ -3164,76 +3164,45 @@ GIT-LDFLAGS: FORCE
# that runs GIT-BUILD-OPTIONS, and then again to protect it
# and the first level quoting from the shell that runs "echo".
GIT-BUILD-OPTIONS: FORCE
- @echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@+
- @echo TEST_SHELL_PATH=\''$(subst ','\'',$(TEST_SHELL_PATH_SQ))'\' >>$@+
- @echo PERL_PATH=\''$(subst ','\'',$(PERL_PATH_SQ))'\' >>$@+
- @echo DIFF=\''$(subst ','\'',$(subst ','\'',$(DIFF)))'\' >>$@+
- @echo PYTHON_PATH=\''$(subst ','\'',$(PYTHON_PATH_SQ))'\' >>$@+
- @echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@+
- @echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@+
- @echo NO_ICONV=\''$(subst ','\'',$(subst ','\'',$(NO_ICONV)))'\' >>$@+
- @echo NO_EXPAT=\''$(subst ','\'',$(subst ','\'',$(NO_EXPAT)))'\' >>$@+
- @echo USE_LIBPCRE2=\''$(subst ','\'',$(subst ','\'',$(USE_LIBPCRE2)))'\' >>$@+
- @echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@+
- @echo NO_PTHREADS=\''$(subst ','\'',$(subst ','\'',$(NO_PTHREADS)))'\' >>$@+
- @echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@+
- @echo NO_REGEX=\''$(subst ','\'',$(subst ','\'',$(NO_REGEX)))'\' >>$@+
- @echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@+
- @echo PAGER_ENV=\''$(subst ','\'',$(subst ','\'',$(PAGER_ENV)))'\' >>$@+
- @echo SANITIZE_LEAK=\''$(subst ','\'',$(subst ','\'',$(SANITIZE_LEAK)))'\' >>$@+
- @echo SANITIZE_ADDRESS=\''$(subst ','\'',$(subst ','\'',$(SANITIZE_ADDRESS)))'\' >>$@+
- @echo X=\'$(X)\' >>$@+
-ifdef FSMONITOR_DAEMON_BACKEND
- @echo FSMONITOR_DAEMON_BACKEND=\''$(subst ','\'',$(subst ','\'',$(FSMONITOR_DAEMON_BACKEND)))'\' >>$@+
-endif
-ifdef FSMONITOR_OS_SETTINGS
- @echo FSMONITOR_OS_SETTINGS=\''$(subst ','\'',$(subst ','\'',$(FSMONITOR_OS_SETTINGS)))'\' >>$@+
-endif
-ifdef TEST_OUTPUT_DIRECTORY
- @echo TEST_OUTPUT_DIRECTORY=\''$(subst ','\'',$(subst ','\'',$(TEST_OUTPUT_DIRECTORY)))'\' >>$@+
-endif
-ifdef GIT_TEST_OPTS
- @echo GIT_TEST_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_OPTS)))'\' >>$@+
-endif
-ifdef GIT_TEST_CMP
- @echo GIT_TEST_CMP=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_CMP)))'\' >>$@+
-endif
-ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
- @echo GIT_TEST_CMP_USE_COPIED_CONTEXT=YesPlease >>$@+
-endif
-ifdef GIT_TEST_UTF8_LOCALE
- @echo GIT_TEST_UTF8_LOCALE=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_UTF8_LOCALE)))'\' >>$@+
-endif
- @echo NO_GETTEXT=\''$(subst ','\'',$(subst ','\'',$(NO_GETTEXT)))'\' >>$@+
-ifdef GIT_PERF_REPEAT_COUNT
- @echo GIT_PERF_REPEAT_COUNT=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPEAT_COUNT)))'\' >>$@+
-endif
-ifdef GIT_PERF_REPO
- @echo GIT_PERF_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPO)))'\' >>$@+
-endif
-ifdef GIT_PERF_LARGE_REPO
- @echo GIT_PERF_LARGE_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_LARGE_REPO)))'\' >>$@+
-endif
-ifdef GIT_PERF_MAKE_OPTS
- @echo GIT_PERF_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_OPTS)))'\' >>$@+
-endif
-ifdef GIT_PERF_MAKE_COMMAND
- @echo GIT_PERF_MAKE_COMMAND=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_COMMAND)))'\' >>$@+
-endif
-ifdef GIT_INTEROP_MAKE_OPTS
- @echo GIT_INTEROP_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_INTEROP_MAKE_OPTS)))'\' >>$@+
-endif
-ifdef GIT_TEST_INDEX_VERSION
- @echo GIT_TEST_INDEX_VERSION=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_INDEX_VERSION)))'\' >>$@+
-endif
-ifdef GIT_TEST_PERL_FATAL_WARNINGS
- @echo GIT_TEST_PERL_FATAL_WARNINGS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_PERL_FATAL_WARNINGS)))'\' >>$@+
-endif
-ifdef RUNTIME_PREFIX
- @echo RUNTIME_PREFIX=\'true\' >>$@+
-else
- @echo RUNTIME_PREFIX=\'false\' >>$@+
-endif
+ @sed \
+ -e "s|@SHELL_PATH@|\'$(SHELL_PATH_SQ)\'|" \
+ -e "s|@TEST_SHELL_PATH@|\'$(TEST_SHELL_PATH_SQ)\'|" \
+ -e "s|@PERL_PATH@|\'$(PERL_PATH_SQ)\'|" \
+ -e "s|@DIFF@|\'$(DIFF)\'|" \
+ -e "s|@PYTHON_PATH@|\'$(PYTHON_PATH_SQ)\'|" \
+ -e "s|@TAR@|\'$(TAR)\'|" \
+ -e "s|@NO_CURL@|\'$(NO_CURL)\'|" \
+ -e "s|@NO_ICONV@|\'$(NO_ICONV)\'|" \
+ -e "s|@NO_EXPAT@|\'$(NO_EXPAT)\'|" \
+ -e "s|@USE_LIBPCRE2@|\'$(USE_LIBPCRE2)\'|" \
+ -e "s|@NO_PERL@|\'$(NO_PERL)\'|" \
+ -e "s|@NO_PTHREADS@|\'$(NO_PTHREADS)\'|" \
+ -e "s|@NO_PYTHON@|\'$(NO_PYTHON)\'|" \
+ -e "s|@NO_REGEX@|\'$(NO_REGEX)\'|" \
+ -e "s|@NO_UNIX_SOCKETS@|\'$(NO_UNIX_SOCKETS)\'|" \
+ -e "s|@PAGER_ENV@|\'$(PAGER_ENV)\'|" \
+ -e "s|@SANITIZE_LEAK@|\'$(SANITIZE_LEAK)\'|" \
+ -e "s|@SANITIZE_ADDRESS@|\'$(SANITIZE_ADDRESS)\'|" \
+ -e "s|@X@|\'$(X)\'|" \
+ -e "s|@FSMONITOR_DAEMON_BACKEND@|\'$(FSMONITOR_DAEMON_BACKEND)\'|" \
+ -e "s|@FSMONITOR_OS_SETTINGS@|\'$(FSMONITOR_OS_SETTINGS)\'|" \
+ -e "s|@TEST_OUTPUT_DIRECTORY@|\'$(TEST_OUTPUT_DIRECTORY)\'|" \
+ -e "s|@GIT_TEST_OPTS@|\'$(GIT_TEST_OPTS)\'|" \
+ -e "s|@GIT_TEST_CMP@|\'$(GIT_TEST_CMP)\'|" \
+ -e "s|@GIT_TEST_CMP_USE_COPIED_CONTEXT@|\'$(GIT_TEST_CMP_USE_COPIED_CONTEXT)\'|" \
+ -e "s|@GIT_TEST_UTF8_LOCALE@|\'$(GIT_TEST_UTF8_LOCALE)\'|" \
+ -e "s|@NO_GETTEXT@|\'$(NO_GETTEXT)\'|" \
+ -e "s|@GIT_PERF_REPEAT_COUNT@|\'$(GIT_PERF_REPEAT_COUNT)\'|" \
+ -e "s|@GIT_PERF_REPO@|\'$(GIT_PERF_REPO)\'|" \
+ -e "s|@GIT_PERF_LARGE_REPO@|\'$(GIT_PERF_LARGE_REPO)\'|" \
+ -e "s|@GIT_PERF_MAKE_OPTS@|\'$(GIT_PERF_MAKE_OPTS)\'|" \
+ -e "s|@GIT_PERF_MAKE_COMMAND@|\'$(GIT_PERF_MAKE_COMMAND)\'|" \
+ -e "s|@GIT_INTEROP_MAKE_OPTS@|\'$(GIT_INTEROP_MAKE_OPTS)\'|" \
+ -e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \
+ -e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \
+ -e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX)\'|" \
+ GIT-BUILD-OPTIONS.in >$@+
+ @if grep -q '^[A-Z][A-Z_]*=@.*@$$' $@+; then echo "Unsubstituted build options in $@" >&2 && exit 1; fi
@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
@if test -f GIT-BUILD-DIR; then rm GIT-BUILD-DIR; fi
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 8974bb9fa202a0556fd9b16d105836d8cb66f543..e5d258419ddacd837c4abb07709fb3252fca5c3c 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -1117,27 +1117,47 @@ if(NOT PYTHON_TESTS)
set(NO_PYTHON 1)
endif()
-file(WRITE ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "SHELL_PATH='${SHELL_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "TEST_SHELL_PATH='${TEST_SHELL_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PERL_PATH='${PERL_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "DIFF='${DIFF}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PYTHON_PATH='${PYTHON_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "TAR='${TAR}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_CURL='${NO_CURL}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_ICONV='${NO_ICONV}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_EXPAT='${NO_EXPAT}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PERL='${NO_PERL}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PTHREADS='${NO_PTHREADS}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_UNIX_SOCKETS='${NO_UNIX_SOCKETS}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PAGER_ENV='${PAGER_ENV}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "X='${EXE_EXTENSION}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_GETTEXT='${NO_GETTEXT}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "RUNTIME_PREFIX='${RUNTIME_PREFIX}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PYTHON='${NO_PYTHON}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "SUPPORTS_SIMPLE_IPC='${SUPPORTS_SIMPLE_IPC}'\n")
+file(STRINGS ${CMAKE_SOURCE_DIR}/GIT-BUILD-OPTIONS.in git_build_options NEWLINE_CONSUME)
+string(REPLACE "@SHELL_PATH@" "'${SHELL_PATH}'" git_build_options "${git_build_options}")
+string(REPLACE "@TEST_SHELL_PATH@" "'${TEST_SHELL_PATH}'" git_build_options "${git_build_options}")
+string(REPLACE "@PERL_PATH@" "'${PERL_PATH}'" git_build_options "${git_build_options}")
+string(REPLACE "@DIFF@" "'${DIFF}'" git_build_options "${git_build_options}")
+string(REPLACE "@PYTHON_PATH@" "'${PYTHON_PATH}'" git_build_options "${git_build_options}")
+string(REPLACE "@TAR@" "'${TAR}'" git_build_options "${git_build_options}")
+string(REPLACE "@NO_CURL@" "${NO_CURL}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_ICONV@" "${NO_ICONV}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_EXPAT@" "${NO_EXPAT}" git_build_options "${git_build_options}")
+string(REPLACE "@USE_LIBPCRE2@" "" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PERL@" "${NO_PERL}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PTHREADS@" "${NO_PTHREADS}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PYTHON@" "${NO_PYTHON}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_REGEX@" "" git_build_options "${git_build_options}")
+string(REPLACE "@NO_UNIX_SOCKETS@" "${NO_UNIX_SOCKETS}" git_build_options "${git_build_options}")
+string(REPLACE "@PAGER_ENV@" "'${PAGER_ENV}'" git_build_options "${git_build_options}")
+string(REPLACE "@SANITIZE_LEAK@" "" git_build_options "${git_build_options}")
+string(REPLACE "@SANITIZE_ADDRESS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@X@" "${EXE_EXTENSION}" git_build_options "${git_build_options}")
+string(REPLACE "@FSMONITOR_DAEMON_BACKEND@" "win32" git_build_options "${git_build_options}")
+string(REPLACE "@FSMONITOR_OS_SETTINGS@" "win32" git_build_options "${git_build_options}")
+string(REPLACE "@TEST_OUTPUT_DIRECTORY@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_OPTS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_CMP@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_CMP_USE_COPIED_CONTEXT@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_UTF8_LOCALE@" "" git_build_options "${git_build_options}")
+string(REPLACE "@NO_GETTEXT@" "${NO_GETTEXT}" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_REPEAT_COUNT@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_REPO@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_LARGE_REPO@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_MAKE_OPTS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_MAKE_COMMAND@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@RUNTIME_PREFIX@" "'${RUNTIME_PREFIX}'" git_build_options "${git_build_options}")
if(USE_VCPKG)
- file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
+ string(APPEND git_build_options "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
endif()
+file(WRITE ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS ${git_build_options})
#Make the tests work when building out of the source tree
get_filename_component(CACHE_PATH ${CMAKE_CURRENT_LIST_DIR}/../../CMakeCache.txt ABSOLUTE)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index a278181a0568a2422ab1e7f007bc016b95a58e63..19057faa73925f619750fec30f05c3e5a1ba05ac 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -35,12 +35,6 @@ else
# needing to exist.
TEST_DIRECTORY=$(cd "$TEST_DIRECTORY" && pwd) || exit 1
fi
-if test -z "$TEST_OUTPUT_DIRECTORY"
-then
- # Similarly, override this to store the test-results subdir
- # elsewhere
- TEST_OUTPUT_DIRECTORY=$TEST_DIRECTORY
-fi
GIT_BUILD_DIR="${TEST_DIRECTORY%/t}"
if test "$TEST_DIRECTORY" = "$GIT_BUILD_DIR"
then
@@ -92,6 +86,15 @@ export LSAN_OPTIONS
prepend_var UBSAN_OPTIONS : $GIT_SAN_OPTIONS
export UBSAN_OPTIONS
+# The TEST_OUTPUT_DIRECTORY will be overwritten via GIT-BUILD-OPTIONS. So in
+# case the caller has manually set up this variable via the environment we must
+# make sure to not overwrite that value, and thus we save it into
+# TEST_OUTPUT_DIRECTORY_OVERRIDE here.
+if test -n "$TEST_OUTPUT_DIRECTORY" && test -z "$TEST_OUTPUT_DIRECTORY_OVERRIDE"
+then
+ TEST_OUTPUT_DIRECTORY_OVERRIDE=$TEST_OUTPUT_DIRECTORY
+fi
+
if test ! -f "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
then
echo >&2 'error: GIT-BUILD-OPTIONS missing (has Git been built?).'
@@ -100,6 +103,13 @@ fi
. "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
export PERL_PATH SHELL_PATH
+if test -z "$TEST_OUTPUT_DIRECTORY"
+then
+ # Similarly, override this to store the test-results subdir
+ # elsewhere
+ TEST_OUTPUT_DIRECTORY=$TEST_DIRECTORY
+fi
+
# In t0000, we need to override test directories of nested testcases. In case
# the developer has TEST_OUTPUT_DIRECTORY part of his build options, then we'd
# reset this value to instead contain what the developer has specified. We thus
--
2.47.0.251.gb31fb630c0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH RFC v7 02/22] Makefile: consistently use @PLACEHOLDER@ to substitute
2024-11-15 7:21 ` [PATCH RFC v7 00/22] " Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 01/22] Makefile: use common template for GIT-BUILD-OPTIONS Patrick Steinhardt
@ 2024-11-15 7:21 ` Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 03/22] Makefile: refactor GIT-VERSION-GEN to be reusable Patrick Steinhardt
` (21 subsequent siblings)
23 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-15 7:21 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
We have a bunch of placeholders in our scripts that we replace at build
time, for example by using sed(1). These placeholders come in three
different formats: @PLACEHOLDER@, @@PLACEHOLDER@@ and ++PLACEHOLDER++.
Next to being inconsistent it also creates a bit of a problem with
CMake, which only supports the first syntax in its `configure_file()`
function. To work around that we instead manually replace placeholders
via string operations, which is a hassle and removes safeguards that
CMake has to verify that we didn't forget to replace any placeholders.
Besides that, other build systems like Meson also support the CMake
syntax.
Unify our codebase to consistently use the syntax supported by such
build systems.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 44 ++++++++++++------------
configure.ac | 2 +-
contrib/buildsystems/CMakeLists.txt | 34 +++++++++---------
git-cvsserver.perl | 2 +-
git-instaweb.sh | 8 ++---
git-request-pull.sh | 2 +-
git-send-email.perl | 2 +-
git-sh-i18n.sh | 6 ++--
git-sh-setup.sh | 6 ++--
git-svn.perl | 2 +-
gitk-git/po/vi.po | 2 +-
gitweb/Makefile | 44 ++++++++++++------------
gitweb/gitweb.perl | 44 ++++++++++++------------
perl/Git/I18N.pm | 6 ++--
perl/Git/LoadCPAN.pm | 6 ++--
| 2 +-
| 8 ++---
unimplemented.sh | 2 +-
wrap-for-bin.sh | 18 +++++-----
19 files changed, 120 insertions(+), 120 deletions(-)
diff --git a/Makefile b/Makefile
index 962df75635a8cbf7114970ddfe7948ff17c65fdc..d59f6c16868e24a1e13b0c16cc05adb79f81bbc8 100644
--- a/Makefile
+++ b/Makefile
@@ -1555,10 +1555,10 @@ endif
ifdef SANE_TOOL_PATH
SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH))
-BROKEN_PATH_FIX = 's|^\# @@BROKEN_PATH_FIX@@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|'
+BROKEN_PATH_FIX = 's|^\# @BROKEN_PATH_FIX@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|'
PATH := $(SANE_TOOL_PATH):${PATH}
else
-BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d'
+BROKEN_PATH_FIX = '/^\# @BROKEN_PATH_FIX@$$/d'
endif
ifeq (,$(HOST_CPU))
@@ -2548,13 +2548,13 @@ GIT-SCRIPT-DEFINES: FORCE
define cmd_munge_script
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
- -e 's|@@DIFF@@|$(DIFF_SQ)|' \
- -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' \
- -e 's/@@USE_GETTEXT_SCHEME@@/$(USE_GETTEXT_SCHEME)/g' \
+ -e 's|@DIFF@|$(DIFF_SQ)|' \
+ -e 's|@LOCALEDIR@|$(localedir_SQ)|g' \
+ -e 's/@USE_GETTEXT_SCHEME@/$(USE_GETTEXT_SCHEME)/g' \
-e $(BROKEN_PATH_FIX) \
- -e 's|@@GITWEBDIR@@|$(gitwebdir_SQ)|g' \
- -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
- -e 's|@@PAGER_ENV@@|$(PAGER_ENV_SQ)|g' \
+ -e 's|@GITWEBDIR@|$(gitwebdir_SQ)|g' \
+ -e 's|@PERL@|$(PERL_PATH_SQ)|g' \
+ -e 's|@PAGER_ENV@|$(PAGER_ENV_SQ)|g' \
$@.sh >$@+
endef
@@ -2611,7 +2611,7 @@ $(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
-e ' r GIT-PERL-HEADER' \
-e ' G' \
-e '}' \
- -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
+ -e 's/@GIT_VERSION@/$(GIT_VERSION)/g' \
$< >$@+ && \
chmod +x $@+ && \
mv $@+ $@
@@ -2629,11 +2629,11 @@ GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile
INSTLIBDIR='$(perllibdir_SQ)' && \
INSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \
INSTLIBDIR="$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}" && \
- sed -e 's=@@PATHSEP@@=$(pathsep)=g' \
- -e "s=@@INSTLIBDIR@@=$$INSTLIBDIR=g" \
- -e 's=@@PERLLIBDIR_REL@@=$(perllibdir_relative_SQ)=g' \
- -e 's=@@GITEXECDIR_REL@@=$(gitexecdir_relative_SQ)=g' \
- -e 's=@@LOCALEDIR_REL@@=$(localedir_relative_SQ)=g' \
+ sed -e 's=@PATHSEP@=$(pathsep)=g' \
+ -e "s=@INSTLIBDIR@=$$INSTLIBDIR=g" \
+ -e 's=@PERLLIBDIR_REL@=$(perllibdir_relative_SQ)=g' \
+ -e 's=@GITEXECDIR_REL@=$(gitexecdir_relative_SQ)=g' \
+ -e 's=@LOCALEDIR_REL@=$(localedir_relative_SQ)=g' \
$< >$@+ && \
mv $@+ $@
@@ -2649,7 +2649,7 @@ else # NO_PERL
$(SCRIPT_PERL_GEN) git-instaweb: % : unimplemented.sh
$(QUIET_GEN) \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@@REASON@@|NO_PERL=$(NO_PERL)|g' \
+ -e 's|@REASON@|NO_PERL=$(NO_PERL)|g' \
unimplemented.sh >$@+ && \
chmod +x $@+ && \
mv $@+ $@
@@ -2670,13 +2670,13 @@ else # NO_PYTHON
$(SCRIPT_PYTHON_GEN): % : unimplemented.sh
$(QUIET_GEN) \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@@REASON@@|NO_PYTHON=$(NO_PYTHON)|g' \
+ -e 's|@REASON@|NO_PYTHON=$(NO_PYTHON)|g' \
unimplemented.sh >$@+ && \
chmod +x $@+ && \
mv $@+ $@
endif # NO_PYTHON
-CONFIGURE_RECIPE = sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
+CONFIGURE_RECIPE = sed -e 's/@GIT_VERSION@/$(GIT_VERSION)/g' \
configure.ac >configure.ac+ && \
autoconf -o configure configure.ac+ && \
$(RM) configure.ac+
@@ -3104,9 +3104,9 @@ endif
perl/build/lib/%.pm: perl/%.pm GIT-PERL-DEFINES
$(call mkdir_p_parent_template)
$(QUIET_GEN) \
- sed -e 's|@@LOCALEDIR@@|$(perl_localedir_SQ)|g' \
- -e 's|@@NO_GETTEXT@@|$(NO_GETTEXT_SQ)|g' \
- -e 's|@@NO_PERL_CPAN_FALLBACKS@@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \
+ sed -e 's|@LOCALEDIR@|$(perl_localedir_SQ)|g' \
+ -e 's|@NO_GETTEXT@|$(NO_GETTEXT_SQ)|g' \
+ -e 's|@NO_PERL_CPAN_FALLBACKS@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \
< $< > $@
perl/build/man/man3/Git.3pm: perl/Git.pm
@@ -3225,8 +3225,8 @@ all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PR
bin-wrappers/%: wrap-for-bin.sh
$(call mkdir_p_parent_template)
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@@BUILD_DIR@@|$(shell pwd)|' \
- -e 's|@@PROG@@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
+ -e 's|@BUILD_DIR@|$(shell pwd)|' \
+ -e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
chmod +x $@
# GNU make supports exporting all variables by "export" without parameters.
diff --git a/configure.ac b/configure.ac
index d1a96da14eb56766e1538da80ab97ed8a99b24f6..5923edc44aa7b6cc355fa6589b6d075b0c0a7772 100644
--- a/configure.ac
+++ b/configure.ac
@@ -142,7 +142,7 @@ fi
## Configure body starts here.
AC_PREREQ(2.59)
-AC_INIT([git], [@@GIT_VERSION@@], [git@vger.kernel.org])
+AC_INIT([git], [@GIT_VERSION@], [git@vger.kernel.org])
AC_CONFIG_SRCDIR([git.c])
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index e5d258419ddacd837c4abb07709fb3252fca5c3c..8b0020edeba289e5eaa15a5452013fa2e4c3ed33 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -836,14 +836,14 @@ set(git_shell_scripts
foreach(script ${git_shell_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.sh content NEWLINE_CONSUME)
string(REPLACE "@SHELL_PATH@" "${SHELL_PATH}" content "${content}")
- string(REPLACE "@@DIFF@@" "diff" content "${content}")
+ string(REPLACE "@DIFF@" "diff" content "${content}")
string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}")
string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" content "${content}")
- string(REPLACE "@@NO_CURL@@" "" content "${content}")
- string(REPLACE "@@USE_GETTEXT_SCHEME@@" "" content "${content}")
- string(REPLACE "# @@BROKEN_PATH_FIX@@" "" content "${content}")
- string(REPLACE "@@PERL@@" "${PERL_PATH}" content "${content}")
- string(REPLACE "@@PAGER_ENV@@" "LESS=FRX LV=-c" content "${content}")
+ string(REPLACE "@NO_CURL@" "" content "${content}")
+ string(REPLACE "@USE_GETTEXT_SCHEME@" "" content "${content}")
+ string(REPLACE "# @BROKEN_PATH_FIX@" "" content "${content}")
+ string(REPLACE "@PERL@" "${PERL_PATH}" content "${content}")
+ string(REPLACE "@PAGER_ENV@" "LESS=FRX LV=-c" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
endforeach()
@@ -852,13 +852,13 @@ parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" ".perl")
#create perl header
file(STRINGS ${CMAKE_SOURCE_DIR}/perl/header_templates/fixed_prefix.template.pl perl_header )
-string(REPLACE "@@PATHSEP@@" ":" perl_header "${perl_header}")
-string(REPLACE "@@INSTLIBDIR@@" "${INSTLIBDIR}" perl_header "${perl_header}")
+string(REPLACE "@PATHSEP@" ":" perl_header "${perl_header}")
+string(REPLACE "@INSTLIBDIR@" "${INSTLIBDIR}" perl_header "${perl_header}")
foreach(script ${git_perl_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.perl content NEWLINE_CONSUME)
string(REPLACE "#!/usr/bin/perl" "#!/usr/bin/perl\n${perl_header}\n" content "${content}")
- string(REPLACE "@@GIT_VERSION@@" "${PROJECT_VERSION}" content "${content}")
+ string(REPLACE "@GIT_VERSION@" "${PROJECT_VERSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
endforeach()
@@ -873,8 +873,8 @@ file(GLOB_RECURSE perl_modules "${CMAKE_SOURCE_DIR}/perl/*.pm")
foreach(pm ${perl_modules})
string(REPLACE "${CMAKE_SOURCE_DIR}/perl/" "" file_path ${pm})
file(STRINGS ${pm} content NEWLINE_CONSUME)
- string(REPLACE "@@LOCALEDIR@@" "${LOCALEDIR}" content "${content}")
- string(REPLACE "@@NO_PERL_CPAN_FALLBACKS@@" "" content "${content}")
+ string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}")
+ string(REPLACE "@NO_PERL_CPAN_FALLBACKS@" "" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/perl/build/lib/${file_path} ${content})
#test-lib.sh requires perl/build/lib to be the build directory of perl modules
endforeach()
@@ -1056,21 +1056,21 @@ set(wrapper_test_scripts
foreach(script ${wrapper_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
- string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
- string(REPLACE "@@PROG@@" "${script}${EXE_EXTENSION}" content "${content}")
+ string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+ string(REPLACE "@PROG@" "${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
foreach(script ${wrapper_test_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
- string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
- string(REPLACE "@@PROG@@" "t/helper/${script}${EXE_EXTENSION}" content "${content}")
+ string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+ string(REPLACE "@PROG@" "t/helper/${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
-string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
-string(REPLACE "@@PROG@@" "git-cvsserver" content "${content}")
+string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+string(REPLACE "@PROG@" "git-cvsserver" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})
#options for configuring test options
diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index 124f598bdc07058b139f8dcbf8245128c52d9176..70ae7cb8e456885ddf2b13a70d21831cdaa7bf06 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -26,7 +26,7 @@
use File::Basename;
use Getopt::Long qw(:config require_order no_ignore_case);
-my $VERSION = '@@GIT_VERSION@@';
+my $VERSION = '@GIT_VERSION@';
my $log = GITCVS::log->new();
my $cfg;
diff --git a/git-instaweb.sh b/git-instaweb.sh
index 8dbe21d5887595352bc0159ea9befdf296b8105f..c8efb1205a8e2a66a6aced840980978897e122bc 100755
--- a/git-instaweb.sh
+++ b/git-instaweb.sh
@@ -3,7 +3,7 @@
# Copyright (c) 2006 Eric Wong
#
-PERL='@@PERL@@'
+PERL='@PERL@'
OPTIONS_KEEPDASHDASH=
OPTIONS_STUCKLONG=
OPTIONS_SPEC="\
@@ -38,8 +38,8 @@ conf="$GIT_DIR/gitweb/httpd.conf"
# if installed, it doesn't need further configuration (module_path)
test -z "$httpd" && httpd='lighttpd -f'
-# Default is @@GITWEBDIR@@
-test -z "$root" && root='@@GITWEBDIR@@'
+# Default is @GITWEBDIR@
+test -z "$root" && root='@GITWEBDIR@'
# any untaken local port will do...
test -z "$port" && port=1234
@@ -716,7 +716,7 @@ EOF
gitweb_conf() {
cat > "$fqgitdir/gitweb/gitweb_config.perl" <<EOF
-#!@@PERL@@
+#!@PERL@
our \$projectroot = "$(dirname "$fqgitdir")";
our \$git_temp = "$fqgitdir/gitweb/tmp";
our \$projects_list = \$projectroot;
diff --git a/git-request-pull.sh b/git-request-pull.sh
index 01640a044bb10f4167338fca957c43a240e1b6c0..10c88639e28c02650ffea3d4671afa9a9f0bb182 100755
--- a/git-request-pull.sh
+++ b/git-request-pull.sh
@@ -112,7 +112,7 @@ find_matching_ref='
}
'
-set fnord $(git ls-remote "$url" | @@PERL@@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
+set fnord $(git ls-remote "$url" | @PERL@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
remote_sha1=$2
ref=$3
diff --git a/git-send-email.perl b/git-send-email.perl
index c835d4c11af259242f1128101a15b237302c7f42..02805c43e52570fe5ae5432fb9343ce9165cc16b 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1501,7 +1501,7 @@ sub gen_header {
@recipients = unique_email_list(@recipients,@cc,@initial_bcc);
@recipients = (map { extract_valid_address_or_die($_) } @recipients);
my $date = format_2822_time($time++);
- my $gitversion = '@@GIT_VERSION@@';
+ my $gitversion = '@GIT_VERSION@';
if ($gitversion =~ m/..GIT_VERSION../) {
$gitversion = Git::version();
}
diff --git a/git-sh-i18n.sh b/git-sh-i18n.sh
index a15c0620db6893898152b1c9e363a0af7f1b304e..ae4b2d6ba9dc061ef40ef1867f0cd5e975df8fe5 100644
--- a/git-sh-i18n.sh
+++ b/git-sh-i18n.sh
@@ -9,7 +9,7 @@ TEXTDOMAIN=git
export TEXTDOMAIN
if test -z "$GIT_TEXTDOMAINDIR"
then
- TEXTDOMAINDIR="@@LOCALEDIR@@"
+ TEXTDOMAINDIR="@LOCALEDIR@"
else
TEXTDOMAINDIR="$GIT_TEXTDOMAINDIR"
fi
@@ -17,9 +17,9 @@ export TEXTDOMAINDIR
# First decide what scheme to use...
GIT_INTERNAL_GETTEXT_SH_SCHEME=fallthrough
-if test -n "@@USE_GETTEXT_SCHEME@@"
+if test -n "@USE_GETTEXT_SCHEME@"
then
- GIT_INTERNAL_GETTEXT_SH_SCHEME="@@USE_GETTEXT_SCHEME@@"
+ GIT_INTERNAL_GETTEXT_SH_SCHEME="@USE_GETTEXT_SCHEME@"
elif test -n "$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS"
then
: no probing necessary
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index ce273fe0e48d997cb067e77707026616a9302eb2..19aef72ec2553027bb25a5968d4e428ba986fdb2 100644
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -41,7 +41,7 @@ git_broken_path_fix () {
esac
}
-# @@BROKEN_PATH_FIX@@
+# @BROKEN_PATH_FIX@
# Source git-sh-i18n for gettext support.
. "$(git --exec-path)/git-sh-i18n"
@@ -154,7 +154,7 @@ git_pager() {
else
GIT_PAGER=cat
fi
- for vardef in @@PAGER_ENV@@
+ for vardef in @PAGER_ENV@
do
var=${vardef%%=*}
eval ": \"\${$vardef}\" && export $var"
@@ -280,7 +280,7 @@ get_author_ident_from_commit () {
# remove lines from $1 that are not in $2, leaving only common lines.
create_virtual_base() {
sz0=$(wc -c <"$1")
- @@DIFF@@ -u -La/"$1" -Lb/"$1" "$1" "$2" | git apply --no-add
+ @DIFF@ -u -La/"$1" -Lb/"$1" "$1" "$2" | git apply --no-add
sz1=$(wc -c <"$1")
# If we do not have enough common material, it is not
diff --git a/git-svn.perl b/git-svn.perl
index 01e7a70de1c0eb37b3feefe364ad78d4c8973097..dcf65cf1d1d4dc53b9f813f931ecff1a387c2657 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -9,7 +9,7 @@
$_revision $_repository
$_q $_authors $_authors_prog %users/;
$AUTHOR = 'Eric Wong <normalperson@yhbt.net>';
-$VERSION = '@@GIT_VERSION@@';
+$VERSION = '@GIT_VERSION@';
use Carp qw/croak/;
use File::Basename qw/dirname basename/;
diff --git a/gitk-git/po/vi.po b/gitk-git/po/vi.po
index 59674986604891d9901e87c163e61dd39db14184..184430dcdeea7cbb76895840f84a889b6abc20bf 100644
--- a/gitk-git/po/vi.po
+++ b/gitk-git/po/vi.po
@@ -5,7 +5,7 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: gitk @@GIT_VERSION@@\n"
+"Project-Id-Version: gitk @GIT_VERSION@\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-05-17 14:32+1000\n"
"PO-Revision-Date: 2015-09-15 07:33+0700\n"
diff --git a/gitweb/Makefile b/gitweb/Makefile
index 3b68ab2d672c4afae62f8f4dc024e0911027b58d..164c8d53757f98599ad14eeb22ca8d542eb7502a 100644
--- a/gitweb/Makefile
+++ b/gitweb/Makefile
@@ -79,28 +79,28 @@ GITWEB_JSLIB_FILES += static/js/blame_incremental.js
GITWEB_REPLACE = \
- -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
- -e 's|++GIT_BINDIR++|$(bindir)|g' \
- -e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \
- -e 's|++GITWEB_CONFIG_SYSTEM++|$(GITWEB_CONFIG_SYSTEM)|g' \
- -e 's|++GITWEB_CONFIG_COMMON++|$(GITWEB_CONFIG_COMMON)|g' \
- -e 's|++GITWEB_HOME_LINK_STR++|$(GITWEB_HOME_LINK_STR)|g' \
- -e 's|++GITWEB_SITENAME++|$(GITWEB_SITENAME)|g' \
- -e 's|++GITWEB_PROJECTROOT++|$(GITWEB_PROJECTROOT)|g' \
- -e 's|"++GITWEB_PROJECT_MAXDEPTH++"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
- -e 's|++GITWEB_EXPORT_OK++|$(GITWEB_EXPORT_OK)|g' \
- -e 's|++GITWEB_STRICT_EXPORT++|$(GITWEB_STRICT_EXPORT)|g' \
- -e 's|++GITWEB_BASE_URL++|$(GITWEB_BASE_URL)|g' \
- -e 's|++GITWEB_LIST++|$(GITWEB_LIST)|g' \
- -e 's|++GITWEB_HOMETEXT++|$(GITWEB_HOMETEXT)|g' \
- -e 's|++GITWEB_CSS++|$(GITWEB_CSS)|g' \
- -e 's|++GITWEB_LOGO++|$(GITWEB_LOGO)|g' \
- -e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \
- -e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \
- -e 's|++GITWEB_SITE_HTML_HEAD_STRING++|$(GITWEB_SITE_HTML_HEAD_STRING)|g' \
- -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \
- -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \
- -e 's|++HIGHLIGHT_BIN++|$(HIGHLIGHT_BIN)|g'
+ -e 's|@GIT_VERSION@|$(GIT_VERSION)|g' \
+ -e 's|@GIT_BINDIR@|$(bindir)|g' \
+ -e 's|@GITWEB_CONFIG@|$(GITWEB_CONFIG)|g' \
+ -e 's|@GITWEB_CONFIG_SYSTEM@|$(GITWEB_CONFIG_SYSTEM)|g' \
+ -e 's|@GITWEB_CONFIG_COMMON@|$(GITWEB_CONFIG_COMMON)|g' \
+ -e 's|@GITWEB_HOME_LINK_STR@|$(GITWEB_HOME_LINK_STR)|g' \
+ -e 's|@GITWEB_SITENAME@|$(GITWEB_SITENAME)|g' \
+ -e 's|@GITWEB_PROJECTROOT@|$(GITWEB_PROJECTROOT)|g' \
+ -e 's|"@GITWEB_PROJECT_MAXDEPTH@"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
+ -e 's|@GITWEB_EXPORT_OK@|$(GITWEB_EXPORT_OK)|g' \
+ -e 's|@GITWEB_STRICT_EXPORT@|$(GITWEB_STRICT_EXPORT)|g' \
+ -e 's|@GITWEB_BASE_URL@|$(GITWEB_BASE_URL)|g' \
+ -e 's|@GITWEB_LIST@|$(GITWEB_LIST)|g' \
+ -e 's|@GITWEB_HOMETEXT@|$(GITWEB_HOMETEXT)|g' \
+ -e 's|@GITWEB_CSS@|$(GITWEB_CSS)|g' \
+ -e 's|@GITWEB_LOGO@|$(GITWEB_LOGO)|g' \
+ -e 's|@GITWEB_FAVICON@|$(GITWEB_FAVICON)|g' \
+ -e 's|@GITWEB_JS@|$(GITWEB_JS)|g' \
+ -e 's|@GITWEB_SITE_HTML_HEAD_STRING@|$(GITWEB_SITE_HTML_HEAD_STRING)|g' \
+ -e 's|@GITWEB_SITE_HEADER@|$(GITWEB_SITE_HEADER)|g' \
+ -e 's|@GITWEB_SITE_FOOTER@|$(GITWEB_SITE_FOOTER)|g' \
+ -e 's|@HIGHLIGHT_BIN@|$(HIGHLIGHT_BIN)|g'
.PHONY: FORCE
$(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS: FORCE
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index b09a8d052383fdf1190f1fab008ddef99290e1f0..76e1f4e244fd23dd29b935e83753efa9c6d5bb5e 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -35,7 +35,7 @@ BEGIN
CGI->compile() if $ENV{'MOD_PERL'};
}
-our $version = "++GIT_VERSION++";
+our $version = "@GIT_VERSION@";
our ($my_url, $my_uri, $base_url, $path_info, $home_link);
sub evaluate_uri {
@@ -80,46 +80,46 @@ sub evaluate_uri {
# core git executable to use
# this can just be "git" if your webserver has a sensible PATH
-our $GIT = "++GIT_BINDIR++/git";
+our $GIT = "@GIT_BINDIR@/git";
# absolute fs-path which will be prepended to the project path
#our $projectroot = "/pub/scm";
-our $projectroot = "++GITWEB_PROJECTROOT++";
+our $projectroot = "@GITWEB_PROJECTROOT@";
# fs traversing limit for getting project list
# the number is relative to the projectroot
-our $project_maxdepth = "++GITWEB_PROJECT_MAXDEPTH++";
+our $project_maxdepth = "@GITWEB_PROJECT_MAXDEPTH@";
# string of the home link on top of all pages
-our $home_link_str = "++GITWEB_HOME_LINK_STR++";
+our $home_link_str = "@GITWEB_HOME_LINK_STR@";
# extra breadcrumbs preceding the home link
our @extra_breadcrumbs = ();
# name of your site or organization to appear in page titles
# replace this with something more descriptive for clearer bookmarks
-our $site_name = "++GITWEB_SITENAME++"
+our $site_name = "@GITWEB_SITENAME@"
|| ($ENV{'SERVER_NAME'} || "Untitled") . " Git";
# html snippet to include in the <head> section of each page
-our $site_html_head_string = "++GITWEB_SITE_HTML_HEAD_STRING++";
+our $site_html_head_string = "@GITWEB_SITE_HTML_HEAD_STRING@";
# filename of html text to include at top of each page
-our $site_header = "++GITWEB_SITE_HEADER++";
+our $site_header = "@GITWEB_SITE_HEADER@";
# html text to include at home page
-our $home_text = "++GITWEB_HOMETEXT++";
+our $home_text = "@GITWEB_HOMETEXT@";
# filename of html text to include at bottom of each page
-our $site_footer = "++GITWEB_SITE_FOOTER++";
+our $site_footer = "@GITWEB_SITE_FOOTER@";
# URI of stylesheets
-our @stylesheets = ("++GITWEB_CSS++");
+our @stylesheets = ("@GITWEB_CSS@");
# URI of a single stylesheet, which can be overridden in GITWEB_CONFIG.
our $stylesheet = undef;
# URI of GIT logo (72x27 size)
-our $logo = "++GITWEB_LOGO++";
+our $logo = "@GITWEB_LOGO@";
# URI of GIT favicon, assumed to be image/png type
-our $favicon = "++GITWEB_FAVICON++";
+our $favicon = "@GITWEB_FAVICON@";
# URI of gitweb.js (JavaScript code for gitweb)
-our $javascript = "++GITWEB_JS++";
+our $javascript = "@GITWEB_JS@";
# URI and label (title) of GIT logo link
#our $logo_url = "https://www.kernel.org/pub/software/scm/git/docs/";
@@ -128,7 +128,7 @@ sub evaluate_uri {
our $logo_label = "git homepage";
# source of projects list
-our $projects_list = "++GITWEB_LIST++";
+our $projects_list = "@GITWEB_LIST@";
# the width (in characters) of the projects list "Description" column
our $projects_list_description_width = 25;
@@ -147,7 +147,7 @@ sub evaluate_uri {
# show repository only if this file exists
# (only effective if this variable evaluates to true)
-our $export_ok = "++GITWEB_EXPORT_OK++";
+our $export_ok = "@GITWEB_EXPORT_OK@";
# don't generate age column on the projects list page
our $omit_age_column = 0;
@@ -161,11 +161,11 @@ sub evaluate_uri {
our $export_auth_hook = undef;
# only allow viewing of repositories also shown on the overview page
-our $strict_export = "++GITWEB_STRICT_EXPORT++";
+our $strict_export = "@GITWEB_STRICT_EXPORT@";
# list of git base URLs used for URL to where fetch project from,
# i.e. full URL is "$git_base_url/$project"
-our @git_base_url_list = grep { $_ ne '' } ("++GITWEB_BASE_URL++");
+our @git_base_url_list = grep { $_ ne '' } ("@GITWEB_BASE_URL@");
# default blob_plain mimetype and default charset for text/plain blob
our $default_blob_plain_mimetype = 'text/plain';
@@ -200,7 +200,7 @@ sub evaluate_uri {
# http://andre-simon.de/zip/download.php due to assumptions about parameters and output).
# Useful if highlight is not installed on your webserver's PATH.
# [Default: highlight]
-our $highlight_bin = "++HIGHLIGHT_BIN++";
+our $highlight_bin = "@HIGHLIGHT_BIN@";
# information about snapshot formats that gitweb is capable of serving
our %known_snapshot_formats = (
@@ -741,9 +741,9 @@ sub read_config_file {
our ($GITWEB_CONFIG, $GITWEB_CONFIG_SYSTEM, $GITWEB_CONFIG_COMMON);
sub evaluate_gitweb_config {
- our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "++GITWEB_CONFIG++";
- our $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || "++GITWEB_CONFIG_SYSTEM++";
- our $GITWEB_CONFIG_COMMON = $ENV{'GITWEB_CONFIG_COMMON'} || "++GITWEB_CONFIG_COMMON++";
+ our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "@GITWEB_CONFIG@";
+ our $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || "@GITWEB_CONFIG_SYSTEM@";
+ our $GITWEB_CONFIG_COMMON = $ENV{'GITWEB_CONFIG_COMMON'} || "@GITWEB_CONFIG_COMMON@";
# Protect against duplications of file names, to not read config twice.
# Only one of $GITWEB_CONFIG and $GITWEB_CONFIG_SYSTEM is used, so
diff --git a/perl/Git/I18N.pm b/perl/Git/I18N.pm
index 475e90a6df5a272d6b4d557d8d37d68e3f77dfa8..f8f0ca312543ce2d099f16354e62acbc205abe5a 100644
--- a/perl/Git/I18N.pm
+++ b/perl/Git/I18N.pm
@@ -20,14 +20,14 @@ BEGIN
# this "'@@' [...] '@@'" pattern.
use constant NO_GETTEXT_STR => '@@' . 'NO_GETTEXT' . '@@';
use constant NO_GETTEXT => (
- q[@@NO_GETTEXT@@] ne ''
+ q[@NO_GETTEXT@] ne ''
and
- q[@@NO_GETTEXT@@] ne NO_GETTEXT_STR
+ q[@NO_GETTEXT@] ne NO_GETTEXT_STR
);
sub __bootstrap_locale_messages {
our $TEXTDOMAIN = 'git';
- our $TEXTDOMAINDIR ||= $ENV{GIT_TEXTDOMAINDIR} || '@@LOCALEDIR@@';
+ our $TEXTDOMAINDIR ||= $ENV{GIT_TEXTDOMAINDIR} || '@LOCALEDIR@';
die "NO_GETTEXT=" . NO_GETTEXT_STR if NO_GETTEXT;
require POSIX;
diff --git a/perl/Git/LoadCPAN.pm b/perl/Git/LoadCPAN.pm
index 8c7fa805f97390a47366b0d0058966ee391b9df1..6be99840f84fb2fe945f969fb23f73454c6b171b 100644
--- a/perl/Git/LoadCPAN.pm
+++ b/perl/Git/LoadCPAN.pm
@@ -31,11 +31,11 @@ =head1 DESCRIPTION
# Makefile, and allows for detecting whether the module is loaded from
# perl/Git as opposed to perl/build/Git, which is useful for one-off
# testing without having Error.pm et al installed.
-use constant NO_PERL_CPAN_FALLBACKS_STR => '@@' . 'NO_PERL_CPAN_FALLBACKS' . '@@';
+use constant NO_PERL_CPAN_FALLBACKS_STR => '@' . 'NO_PERL_CPAN_FALLBACKS' . '@';
use constant NO_PERL_CPAN_FALLBACKS => (
- q[@@NO_PERL_CPAN_FALLBACKS@@] ne ''
+ q[@NO_PERL_CPAN_FALLBACKS@] ne ''
and
- q[@@NO_PERL_CPAN_FALLBACKS@@] ne NO_PERL_CPAN_FALLBACKS_STR
+ q[@NO_PERL_CPAN_FALLBACKS@] ne NO_PERL_CPAN_FALLBACKS_STR
);
sub import {
--git a/perl/header_templates/fixed_prefix.template.pl b/perl/header_templates/fixed_prefix.template.pl
index 857b4391a499394ea788a6b56773aecd5afd53c3..d571ca5cde513a98cc25e7acb52b5415b98ffe10 100644
--- a/perl/header_templates/fixed_prefix.template.pl
+++ b/perl/header_templates/fixed_prefix.template.pl
@@ -1 +1 @@
-use lib (split(/@@PATHSEP@@/, $ENV{GITPERLLIB} || '@@INSTLIBDIR@@'));
+use lib (split(/@PATHSEP@/, $ENV{GITPERLLIB} || '@INSTLIBDIR@'));
--git a/perl/header_templates/runtime_prefix.template.pl b/perl/header_templates/runtime_prefix.template.pl
index 9d28b3d8636c6c6d48ea287a5fef0f7833f6c08c..e6f8e661a164519d4fdb55429746380e84ae3fcb 100644
--- a/perl/header_templates/runtime_prefix.template.pl
+++ b/perl/header_templates/runtime_prefix.template.pl
@@ -3,7 +3,7 @@
# This finds our Git::* libraries relative to the script's runtime path.
sub __git_system_path {
my ($relpath) = @_;
- my $gitexecdir_relative = '@@GITEXECDIR_REL@@';
+ my $gitexecdir_relative = '@GITEXECDIR_REL@';
# GIT_EXEC_PATH is supplied by `git` or the test suite.
my $exec_path;
@@ -24,11 +24,11 @@ sub __git_system_path {
}
BEGIN {
- use lib split /@@PATHSEP@@/,
+ use lib split /@PATHSEP@/,
(
$ENV{GITPERLLIB} ||
do {
- my $perllibdir = __git_system_path('@@PERLLIBDIR_REL@@');
+ my $perllibdir = __git_system_path('@PERLLIBDIR_REL@');
(-e $perllibdir) || die("Invalid system path ($relpath): $path");
$perllibdir;
}
@@ -36,7 +36,7 @@ BEGIN
# Export the system locale directory to the I18N module. The locale directory
# is only installed if NO_GETTEXT is set.
- $Git::I18N::TEXTDOMAINDIR = __git_system_path('@@LOCALEDIR_REL@@');
+ $Git::I18N::TEXTDOMAINDIR = __git_system_path('@LOCALEDIR_REL@');
}
# END RUNTIME_PREFIX generated code.
diff --git a/unimplemented.sh b/unimplemented.sh
index fee21d24e8ab89208b4aa0af7007b7c033b753bc..41776b279d4263ae6a9034b30f1bd26ac9b792bd 100644
--- a/unimplemented.sh
+++ b/unimplemented.sh
@@ -1,4 +1,4 @@
#!/bin/sh
-echo >&2 "fatal: git was built without support for $(basename $0) (@@REASON@@)."
+echo >&2 "fatal: git was built without support for $(basename $0) (@REASON@)."
exit 128
diff --git a/wrap-for-bin.sh b/wrap-for-bin.sh
index 95851b85b6b7181130f0cd441c2bd7ac0bfb89da..7898a1c238dde20617cf96d144930dc59f67feab 100644
--- a/wrap-for-bin.sh
+++ b/wrap-for-bin.sh
@@ -4,33 +4,33 @@
# to run test suite against sandbox, but with only bindir-installed
# executables in PATH. The Makefile copies this into various
# files in bin-wrappers, substituting
-# @@BUILD_DIR@@ and @@PROG@@.
+# @BUILD_DIR@ and @PROG@.
-GIT_EXEC_PATH='@@BUILD_DIR@@'
+GIT_EXEC_PATH='@BUILD_DIR@'
if test -n "$NO_SET_GIT_TEMPLATE_DIR"
then
unset GIT_TEMPLATE_DIR
else
- GIT_TEMPLATE_DIR='@@BUILD_DIR@@/templates/blt'
+ GIT_TEMPLATE_DIR='@BUILD_DIR@/templates/blt'
export GIT_TEMPLATE_DIR
fi
-GITPERLLIB='@@BUILD_DIR@@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}"
-GIT_TEXTDOMAINDIR='@@BUILD_DIR@@/po/build/locale'
-PATH='@@BUILD_DIR@@/bin-wrappers:'"$PATH"
+GITPERLLIB='@BUILD_DIR@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}"
+GIT_TEXTDOMAINDIR='@BUILD_DIR@/po/build/locale'
+PATH='@BUILD_DIR@/bin-wrappers:'"$PATH"
export GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
case "$GIT_DEBUGGER" in
'')
- exec "${GIT_EXEC_PATH}/@@PROG@@" "$@"
+ exec "${GIT_EXEC_PATH}/@PROG@" "$@"
;;
1)
unset GIT_DEBUGGER
- exec gdb --args "${GIT_EXEC_PATH}/@@PROG@@" "$@"
+ exec gdb --args "${GIT_EXEC_PATH}/@PROG@" "$@"
;;
*)
GIT_DEBUGGER_ARGS="$GIT_DEBUGGER"
unset GIT_DEBUGGER
- exec ${GIT_DEBUGGER_ARGS} "${GIT_EXEC_PATH}/@@PROG@@" "$@"
+ exec ${GIT_DEBUGGER_ARGS} "${GIT_EXEC_PATH}/@PROG@" "$@"
;;
esac
--
2.47.0.251.gb31fb630c0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH RFC v7 03/22] Makefile: refactor GIT-VERSION-GEN to be reusable
2024-11-15 7:21 ` [PATCH RFC v7 00/22] " Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 01/22] Makefile: use common template for GIT-BUILD-OPTIONS Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 02/22] Makefile: consistently use @PLACEHOLDER@ to substitute Patrick Steinhardt
@ 2024-11-15 7:21 ` Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 04/22] Makefile: propagate Git version via generated header Patrick Steinhardt
` (20 subsequent siblings)
23 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-15 7:21 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
Our "GIT-VERSION-GEN" script always writes the "GIT-VERSION-FILE" into
the current directory, where the expectation is that it should exist in
the source directory. But other build systems that support out-of-tree
builds may not want to do that to keep the source directory pristine,
even though CMake currently doesn't care.
Refactor the script such that it won't write the "GIT-VERSION-FILE"
directly anymore, but instead knows to replace @PLACEHOLDERS@ in an
arbitrary input file. This allows us to simplify the logic in CMake to
determine the project version, but can also be reused later on in order
to generate other files that need to contain version information like
our "git.rc" file.
While at it, change the format of the version file by removing the
spaces around the equals sign. Like this we can continue to include the
file in our Makefiles, but can also start to source it in shell scripts
in subsequent steps. Furthermore, we already start to replace some
placeholders that are not yet of relevance in this commit. These are
going to become relevant in subsequent steps, as well.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-VERSION-FILE.in | 1 +
GIT-VERSION-GEN | 62 ++++++++++++++++++++++++++++---------
Makefile | 5 ++-
ci/test-documentation.sh | 2 +-
contrib/buildsystems/CMakeLists.txt | 23 ++++----------
contrib/buildsystems/git-version.in | 1 +
6 files changed, 60 insertions(+), 34 deletions(-)
diff --git a/GIT-VERSION-FILE.in b/GIT-VERSION-FILE.in
new file mode 100644
index 0000000000000000000000000000000000000000..3789a48a34a3f9e37531fc24b577ffe3c657a3e9
--- /dev/null
+++ b/GIT-VERSION-FILE.in
@@ -0,0 +1 @@
+GIT_VERSION=@GIT_VERSION@
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index 78e8631f677bbebe8f18d83191f0fd014465563e..3a2dfd477b9b9c18ef34b33c9bf6a0d81b2740b5 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -1,23 +1,41 @@
#!/bin/sh
-GVF=GIT-VERSION-FILE
DEF_VER=v2.47.GIT
LF='
'
+if test "$#" -ne 3
+then
+ echo "USAGE: $0 <SOURCE_DIR> <INPUT> <OUTPUT>" >&2
+ exit 1
+fi
+
+SOURCE_DIR="$1"
+INPUT="$2"
+OUTPUT="$3"
+
+if ! test -f "$INPUT"
+then
+ echo "Input is not a file: $INPUT" >&2
+ exit 1
+fi
+
+GIT_CEILING_DIRECTORIES="$SOURCE_DIR/.."
+export GIT_CEILING_DIRECTORIES
+
# First see if there is a version file (included in release tarballs),
# then try git-describe, then default.
-if test -f version
+if test -f "$SOURCE_DIR"/version
then
- VN=$(cat version) || VN="$DEF_VER"
-elif { test -d "${GIT_DIR:-.git}" || test -f .git; } &&
- VN=$(git describe --match "v[0-9]*" HEAD 2>/dev/null) &&
+ VN=$(cat "$SOURCE_DIR"/version) || VN="$DEF_VER"
+elif { test -d "$SOURCE_DIR/.git" || test -d "${GIT_DIR:-.git}" || test -f "$SOURCE_DIR"/.git; } &&
+ VN=$(git -C "$SOURCE_DIR" describe --match "v[0-9]*" HEAD 2>/dev/null) &&
case "$VN" in
*$LF*) (exit 1) ;;
v[0-9]*)
- git update-index -q --refresh
- test -z "$(git diff-index --name-only HEAD --)" ||
+ git -C "$SOURCE_DIR" update-index -q --refresh
+ test -z "$(git -C "$SOURCE_DIR" diff-index --name-only HEAD --)" ||
VN="$VN-dirty" ;;
esac
then
@@ -26,15 +44,29 @@ else
VN="$DEF_VER"
fi
-VN=$(expr "$VN" : v*'\(.*\)')
+GIT_BUILT_FROM_COMMIT=$(git -C "$SOURCE_DIR" rev-parse -q --verify HEAD 2>/dev/null)
+GIT_VERSION=$(expr "$VN" : v*'\(.*\)')
+if test -z "$GIT_USER_AGENT"
+then
+ GIT_USER_AGENT=git/$GIT_VERSION
+fi
+
+read GIT_MAJOR_VERSION GIT_MINOR_VERSION GIT_MICRO_VERSION GIT_PATCH_LEVEL trailing <<EOF
+$(echo "$GIT_VERSION" 0 0 0 0 | tr '.a-zA-Z-' ' ')
+EOF
+
+sed -e "s|@GIT_VERSION@|$GIT_VERSION|" \
+ -e "s|@GIT_MAJOR_VERSION@|$GIT_MAJOR_VERSION|" \
+ -e "s|@GIT_MINOR_VERSION@|$GIT_MINOR_VERSION|" \
+ -e "s|@GIT_MICRO_VERSION@|$GIT_MICRO_VERSION|" \
+ -e "s|@GIT_PATCH_LEVEL@|$GIT_PATCH_LEVEL|" \
+ -e "s|@GIT_USER_AGENT@|$GIT_USER_AGENT|" \
+ -e "s|@GIT_BUILT_FROM_COMMIT@|$GIT_BUILT_FROM_COMMIT|" \
+ "$INPUT" >"$OUTPUT"+
-if test -r $GVF
+if ! test -f "$OUTPUT" || ! cmp "$OUTPUT"+ "$OUTPUT" >/dev/null
then
- VC=$(sed -e 's/^GIT_VERSION = //' <$GVF)
+ mv "$OUTPUT"+ "$OUTPUT"
else
- VC=unset
+ rm "$OUTPUT"+
fi
-test "$VN" = "$VC" || {
- echo >&2 "GIT_VERSION = $VN"
- echo "GIT_VERSION = $VN" >$GVF
-}
diff --git a/Makefile b/Makefile
index d59f6c16868e24a1e13b0c16cc05adb79f81bbc8..6c55c47e961047a8e9a80ab948e21c7466cf54de 100644
--- a/Makefile
+++ b/Makefile
@@ -592,7 +592,10 @@ include shared.mak
# Disable -pedantic compilation.
GIT-VERSION-FILE: FORCE
- @$(SHELL_PATH) ./GIT-VERSION-GEN
+ @OLD=$$(cat $@ 2>/dev/null || :) && \
+ $(SHELL_PATH) ./GIT-VERSION-GEN "$(shell pwd)" GIT-VERSION-FILE.in $@ && \
+ NEW=$$(cat $@ 2>/dev/null || :) && \
+ if test "$$OLD" != "$$NEW"; then echo "$$NEW" >&2; fi
-include GIT-VERSION-FILE
# Set our default configuration.
diff --git a/ci/test-documentation.sh b/ci/test-documentation.sh
index 02b3af394117f840e078479ca60030141e47f998..6c018b673e0563fa5589195a77804c91deb93515 100755
--- a/ci/test-documentation.sh
+++ b/ci/test-documentation.sh
@@ -6,7 +6,7 @@
. ${0%/*}/lib.sh
filter_log () {
- sed -e '/^GIT_VERSION = /d' \
+ sed -e '/^GIT_VERSION=/d' \
-e "/constant Gem::ConfigMap is deprecated/d" \
-e '/^ \* new asciidoc flags$/d' \
-e '/stripped namespace before processing/d' \
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 8b0020edeba289e5eaa15a5452013fa2e4c3ed33..752479cac59d3833e7fff9239ebea75179692bf4 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -83,23 +83,12 @@ if(NOT SH_EXE)
"On Windows, you can get it as part of 'Git for Windows' install at https://gitforwindows.org/")
endif()
-#Create GIT-VERSION-FILE using GIT-VERSION-GEN
-if(NOT EXISTS ${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE)
- message("Generating GIT-VERSION-FILE")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
-endif()
-
-#Parse GIT-VERSION-FILE to get the version
-file(STRINGS ${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE git_version REGEX "GIT_VERSION = (.*)")
-string(REPLACE "GIT_VERSION = " "" git_version ${git_version})
-string(FIND ${git_version} "GIT" location)
-if(location EQUAL -1)
- string(REGEX MATCH "[0-9]*\\.[0-9]*\\.[0-9]*" git_version ${git_version})
-else()
- string(REGEX MATCH "[0-9]*\\.[0-9]*" git_version ${git_version})
- string(APPEND git_version ".0") #for building from a snapshot
-endif()
+message("Generating Git version")
+execute_process(COMMAND ${SH_EXE} "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_SOURCE_DIR}/contrib/buildsystems/git-version.in"
+ "${CMAKE_BINARY_DIR}/git-version")
+file(STRINGS "${CMAKE_BINARY_DIR}/git-version" git_version)
project(git
VERSION ${git_version}
diff --git a/contrib/buildsystems/git-version.in b/contrib/buildsystems/git-version.in
new file mode 100644
index 0000000000000000000000000000000000000000..9750505ae77685ebb31a38468caaf13501b6739d
--- /dev/null
+++ b/contrib/buildsystems/git-version.in
@@ -0,0 +1 @@
+@GIT_MAJOR_VERSION@.@GIT_MINOR_VERSION@.@GIT_MICRO_VERSION@
--
2.47.0.251.gb31fb630c0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH RFC v7 04/22] Makefile: propagate Git version via generated header
2024-11-15 7:21 ` [PATCH RFC v7 00/22] " Patrick Steinhardt
` (2 preceding siblings ...)
2024-11-15 7:21 ` [PATCH RFC v7 03/22] Makefile: refactor GIT-VERSION-GEN to be reusable Patrick Steinhardt
@ 2024-11-15 7:21 ` Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 05/22] Makefile: generate "git.rc" via GIT-VERSION-GEN Patrick Steinhardt
` (19 subsequent siblings)
23 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-15 7:21 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
We set up a couple of preprocessor macros when compiling Git that
propagate the version that Git was built from to `git version` et al.
The way this is set up makes it harder than necessary to reuse the
infrastructure across the different build systems.
Refactor this such that we generate a "version-def.h" header via
`GIT-VERSION-GEN` instead.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
.gitignore | 1 +
Makefile | 12 +++++-------
contrib/buildsystems/CMakeLists.txt | 16 ++++++++++++----
version-def.h.in | 8 ++++++++
version.c | 1 +
5 files changed, 27 insertions(+), 11 deletions(-)
diff --git a/.gitignore b/.gitignore
index 6687bd6db4c0a6adf02292a9cb545d3e5270e2b0..e17963e84252fa094c10f5e84c0e3724153c819c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -195,6 +195,7 @@
/config-list.h
/command-list.h
/hook-list.h
+/version-def.h
*.tar.gz
*.dsc
*.deb
diff --git a/Makefile b/Makefile
index 6c55c47e961047a8e9a80ab948e21c7466cf54de..28807f6586a69d6ce0abf1b20ce31ca58e9d02a9 100644
--- a/Makefile
+++ b/Makefile
@@ -2508,13 +2508,11 @@ PAGER_ENV_CQ_SQ = $(subst ','\'',$(PAGER_ENV_CQ))
pager.sp pager.s pager.o: EXTRA_CPPFLAGS = \
-DPAGER_ENV='$(PAGER_ENV_CQ_SQ)'
-version.sp version.s version.o: GIT-VERSION-FILE GIT-USER-AGENT
-version.sp version.s version.o: EXTRA_CPPFLAGS = \
- '-DGIT_VERSION="$(GIT_VERSION)"' \
- '-DGIT_USER_AGENT=$(GIT_USER_AGENT_CQ_SQ)' \
- '-DGIT_BUILT_FROM_COMMIT="$(shell \
- GIT_CEILING_DIRECTORIES="$(CURDIR)/.." \
- git rev-parse -q --verify HEAD 2>/dev/null)"'
+version-def.h: version-def.h.in GIT-VERSION-GEN GIT-VERSION-FILE GIT-USER-AGENT
+ $(QUIET_GEN)GIT_USER_AGENT="$(GIT_USER_AGENT)" $(SHELL_PATH) ./GIT-VERSION-GEN "$(shell pwd)" $< $@+
+ @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
+
+version.sp version.s version.o: version-def.h
$(BUILT_INS): git$X
$(QUIET_BUILT_IN)$(RM) $@ && \
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 752479cac59d3833e7fff9239ebea75179692bf4..b9ebe2ef74e37d5fad51f6e23aa234c563cad392 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -229,10 +229,7 @@ add_compile_definitions(PAGER_ENV="LESS=FRX LV=-c"
GIT_HTML_PATH="share/doc/git-doc"
DEFAULT_HELP_FORMAT="html"
DEFAULT_GIT_TEMPLATE_DIR="share/git-core/templates"
- GIT_VERSION="${PROJECT_VERSION}.GIT"
- GIT_USER_AGENT="git/${PROJECT_VERSION}.GIT"
- BINDIR="bin"
- GIT_BUILT_FROM_COMMIT="")
+ BINDIR="bin")
if(WIN32)
set(FALLBACK_RUNTIME_PREFIX /mingw64)
@@ -668,6 +665,17 @@ parse_makefile_for_sources(libgit_SOURCES "LIB_OBJS")
list(TRANSFORM libgit_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
list(TRANSFORM compat_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
+
+add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/version-def.h"
+ COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_SOURCE_DIR}/version-def.h.in"
+ "${CMAKE_BINARY_DIR}/version-def.h"
+ DEPENDS "${SH_EXE}" "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
+ "${CMAKE_SOURCE_DIR}/version-def.h.in"
+ VERBATIM)
+list(APPEND libgit_SOURCES "${CMAKE_BINARY_DIR}/version-def.h")
+
add_library(libgit ${libgit_SOURCES} ${compat_SOURCES})
#libxdiff
diff --git a/version-def.h.in b/version-def.h.in
new file mode 100644
index 0000000000000000000000000000000000000000..347995df0611e19428cf96ec9539f0dcfea999d2
--- /dev/null
+++ b/version-def.h.in
@@ -0,0 +1,8 @@
+#ifndef VERSION_DEF_H
+#define VERSION_DEF_H
+
+#define GIT_VERSION "@GIT_VERSION@"
+#define GIT_BUILT_FROM_COMMIT "@GIT_BUILT_FROM_COMMIT@"
+#define GIT_USER_AGENT "@GIT_USER_AGENT@"
+
+#endif /* VERSION_DEF_H */
diff --git a/version.c b/version.c
index 41b718c29e1b9fc2981d7d14a3d25e69c31a3030..7adc4d51ff25a0841607c21807deaf20721252de 100644
--- a/version.c
+++ b/version.c
@@ -1,5 +1,6 @@
#include "git-compat-util.h"
#include "version.h"
+#include "version-def.h"
#include "strbuf.h"
const char git_version_string[] = GIT_VERSION;
--
2.47.0.251.gb31fb630c0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH RFC v7 05/22] Makefile: generate "git.rc" via GIT-VERSION-GEN
2024-11-15 7:21 ` [PATCH RFC v7 00/22] " Patrick Steinhardt
` (3 preceding siblings ...)
2024-11-15 7:21 ` [PATCH RFC v7 04/22] Makefile: propagate Git version via generated header Patrick Steinhardt
@ 2024-11-15 7:21 ` Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 06/22] Makefile: consistently use PERL_PATH Patrick Steinhardt
` (18 subsequent siblings)
23 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-15 7:21 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
The "git.rc" is used on Windows to embed information like the project
name and version into the resulting executables. As such we need to
inject the version information, which we do by using preprocessor
defines. The logic to do so is non-trivial and needs to be kept in sync
with the different build systems.
Refactor the logic so that we generate "git.rc" via `GIT-VERSION-GEN`.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
.gitignore | 1 +
Makefile | 11 ++++++-----
contrib/buildsystems/CMakeLists.txt | 19 +++++++++++++------
git.rc => git.rc.in | 6 +++---
4 files changed, 23 insertions(+), 14 deletions(-)
diff --git a/.gitignore b/.gitignore
index e17963e84252fa094c10f5e84c0e3724153c819c..d3be460040c6120d862a25dff1abd325b93b37fd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -199,6 +199,7 @@
*.tar.gz
*.dsc
*.deb
+/git.rc
/git.spec
*.exe
*.[aos]
diff --git a/Makefile b/Makefile
index 28807f6586a69d6ce0abf1b20ce31ca58e9d02a9..eced752985caa10a21870c4ba638b4e6fbb3e5ec 100644
--- a/Makefile
+++ b/Makefile
@@ -2568,11 +2568,12 @@ $(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEFINES
$(QUIET_GEN)$(cmd_munge_script) && \
mv $@+ $@
-git.res: git.rc GIT-VERSION-FILE GIT-PREFIX
- $(QUIET_RC)$(RC) \
- $(join -DMAJOR= -DMINOR= -DMICRO= -DPATCHLEVEL=, $(wordlist 1, 4, \
- $(shell echo $(GIT_VERSION) 0 0 0 0 | tr '.a-zA-Z-' ' '))) \
- -DGIT_VERSION="\\\"$(GIT_VERSION)\\\"" -i $< -o $@
+git.rc: git.rc.in GIT-VERSION-GEN GIT-VERSION-FILE
+ $(QUIET_GEN)$(SHELL_PATH) ./GIT-VERSION-GEN "$(shell pwd)" $< $@+
+ @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
+
+git.res: git.rc GIT-PREFIX
+ $(QUIET_RC)$(RC) -i $< -o $@
# This makes sure we depend on the NO_PERL setting itself.
$(SCRIPT_PERL_GEN): GIT-BUILD-OPTIONS
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index b9ebe2ef74e37d5fad51f6e23aa234c563cad392..b893b0143a72ad284887d1d4ca72f1beb0a39ad7 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -691,18 +691,25 @@ list(TRANSFORM reftable_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
add_library(reftable STATIC ${reftable_SOURCES})
if(WIN32)
+ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/git.rc
+ COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_SOURCE_DIR}/git.rc.in"
+ "${CMAKE_BINARY_DIR}/git.rc"
+ DEPENDS "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
+ "${CMAKE_SOURCE_DIR}/git.rc.in"
+ VERBATIM)
+
if(NOT MSVC)#use windres when compiling with gcc and clang
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/git.res
- COMMAND ${WINDRES_EXE} -O coff -DMAJOR=${PROJECT_VERSION_MAJOR} -DMINOR=${PROJECT_VERSION_MINOR}
- -DMICRO=${PROJECT_VERSION_PATCH} -DPATCHLEVEL=0 -DGIT_VERSION="\\\"${PROJECT_VERSION}.GIT\\\""
- -i ${CMAKE_SOURCE_DIR}/git.rc -o ${CMAKE_BINARY_DIR}/git.res
+ COMMAND ${WINDRES_EXE} -O coff -i ${CMAKE_BINARY_DIR}/git.rc -o ${CMAKE_BINARY_DIR}/git.res
+ DEPENDS "${CMAKE_BINARY_DIR}/git.rc"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
VERBATIM)
else()#MSVC use rc
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/git.res
- COMMAND ${CMAKE_RC_COMPILER} /d MAJOR=${PROJECT_VERSION_MAJOR} /d MINOR=${PROJECT_VERSION_MINOR}
- /d MICRO=${PROJECT_VERSION_PATCH} /d PATCHLEVEL=0 /d GIT_VERSION="${PROJECT_VERSION}.GIT"
- /fo ${CMAKE_BINARY_DIR}/git.res ${CMAKE_SOURCE_DIR}/git.rc
+ COMMAND ${CMAKE_RC_COMPILER} /fo ${CMAKE_BINARY_DIR}/git.res ${CMAKE_BINARY_DIR}/git.rc
+ DEPENDS "${CMAKE_BINARY_DIR}/git.rc"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
VERBATIM)
endif()
diff --git a/git.rc b/git.rc.in
similarity index 67%
rename from git.rc
rename to git.rc.in
index cc3fdc6cc6cb83b084eebe2ad49f3c78c981789b..e69444eef3f0c558707e067d52820668d2116308 100644
--- a/git.rc
+++ b/git.rc.in
@@ -1,6 +1,6 @@
1 VERSIONINFO
-FILEVERSION MAJOR,MINOR,MICRO,PATCHLEVEL
-PRODUCTVERSION MAJOR,MINOR,MICRO,PATCHLEVEL
+FILEVERSION @GIT_MAJOR_VERSION@,@GIT_MINOR_VERSION@,@GIT_MICRO_VERSION@,@GIT_PATCH_LEVEL@
+PRODUCTVERSION @GIT_MAJOR_VERSION@,@GIT_MINOR_VERSION@,@GIT_MICRO_VERSION@,@GIT_PATCH_LEVEL@
BEGIN
BLOCK "StringFileInfo"
BEGIN
@@ -11,7 +11,7 @@ BEGIN
VALUE "InternalName", "git\0"
VALUE "OriginalFilename", "git.exe\0"
VALUE "ProductName", "Git\0"
- VALUE "ProductVersion", GIT_VERSION "\0"
+ VALUE "ProductVersion", "@GIT_VERSION@\0"
END
END
--
2.47.0.251.gb31fb630c0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH RFC v7 06/22] Makefile: consistently use PERL_PATH
2024-11-15 7:21 ` [PATCH RFC v7 00/22] " Patrick Steinhardt
` (4 preceding siblings ...)
2024-11-15 7:21 ` [PATCH RFC v7 05/22] Makefile: generate "git.rc" via GIT-VERSION-GEN Patrick Steinhardt
@ 2024-11-15 7:21 ` Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 07/22] Makefile: extract script to massage Perl scripts Patrick Steinhardt
` (17 subsequent siblings)
23 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-15 7:21 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
When injecting the Perl path into our scripts we sometimes use '@PERL@'
while we othertimes use '@PERL_PATH@'. Refactor the code use the latter
consistently, which makes it easier to reuse the same logic for multiple
scripts.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 2 +-
contrib/buildsystems/CMakeLists.txt | 2 +-
git-instaweb.sh | 4 ++--
git-request-pull.sh | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile
index eced752985caa10a21870c4ba638b4e6fbb3e5ec..fd4b061d0ad140cf0c9fcc09aa5946b2ca0ca7a5 100644
--- a/Makefile
+++ b/Makefile
@@ -2554,7 +2554,7 @@ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's/@USE_GETTEXT_SCHEME@/$(USE_GETTEXT_SCHEME)/g' \
-e $(BROKEN_PATH_FIX) \
-e 's|@GITWEBDIR@|$(gitwebdir_SQ)|g' \
- -e 's|@PERL@|$(PERL_PATH_SQ)|g' \
+ -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' \
-e 's|@PAGER_ENV@|$(PAGER_ENV_SQ)|g' \
$@.sh >$@+
endef
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index b893b0143a72ad284887d1d4ca72f1beb0a39ad7..f8892c49c6d317040b3b6447b88133b2bfff3fcf 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -846,7 +846,7 @@ foreach(script ${git_shell_scripts})
string(REPLACE "@NO_CURL@" "" content "${content}")
string(REPLACE "@USE_GETTEXT_SCHEME@" "" content "${content}")
string(REPLACE "# @BROKEN_PATH_FIX@" "" content "${content}")
- string(REPLACE "@PERL@" "${PERL_PATH}" content "${content}")
+ string(REPLACE "@PERL_PATH@" "${PERL_PATH}" content "${content}")
string(REPLACE "@PAGER_ENV@" "LESS=FRX LV=-c" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
endforeach()
diff --git a/git-instaweb.sh b/git-instaweb.sh
index c8efb1205a8e2a66a6aced840980978897e122bc..5ad50160bb035885d8c180bee3ebb0a8e9622abc 100755
--- a/git-instaweb.sh
+++ b/git-instaweb.sh
@@ -3,7 +3,7 @@
# Copyright (c) 2006 Eric Wong
#
-PERL='@PERL@'
+PERL='@PERL_PATH@'
OPTIONS_KEEPDASHDASH=
OPTIONS_STUCKLONG=
OPTIONS_SPEC="\
@@ -716,7 +716,7 @@ EOF
gitweb_conf() {
cat > "$fqgitdir/gitweb/gitweb_config.perl" <<EOF
-#!@PERL@
+#!@PERL_PATH@
our \$projectroot = "$(dirname "$fqgitdir")";
our \$git_temp = "$fqgitdir/gitweb/tmp";
our \$projects_list = \$projectroot;
diff --git a/git-request-pull.sh b/git-request-pull.sh
index 10c88639e28c02650ffea3d4671afa9a9f0bb182..775ba8ea11aa0fce90ae9bfaea8eac5b8bc584a4 100755
--- a/git-request-pull.sh
+++ b/git-request-pull.sh
@@ -112,7 +112,7 @@ find_matching_ref='
}
'
-set fnord $(git ls-remote "$url" | @PERL@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
+set fnord $(git ls-remote "$url" | @PERL_PATH@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
remote_sha1=$2
ref=$3
--
2.47.0.251.gb31fb630c0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH RFC v7 07/22] Makefile: extract script to massage Perl scripts
2024-11-15 7:21 ` [PATCH RFC v7 00/22] " Patrick Steinhardt
` (5 preceding siblings ...)
2024-11-15 7:21 ` [PATCH RFC v7 06/22] Makefile: consistently use PERL_PATH Patrick Steinhardt
@ 2024-11-15 7:21 ` Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 08/22] Makefile: use "generate-perl.sh" to massage Perl library Patrick Steinhardt
` (16 subsequent siblings)
23 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-15 7:21 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
Extract the script to inject various build-time parameters into our Perl
scripts into a standalone script. This is done such that we can reuse it
in other build systems.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 12 ++----------
contrib/buildsystems/CMakeLists.txt | 32 +++++++++++++++++++++++++++-----
generate-perl.sh | 27 +++++++++++++++++++++++++++
3 files changed, 56 insertions(+), 15 deletions(-)
diff --git a/Makefile b/Makefile
index fd4b061d0ad140cf0c9fcc09aa5946b2ca0ca7a5..669ee4fb8d28fd9e1aeb0a794d5ce44ba60b5c9c 100644
--- a/Makefile
+++ b/Makefile
@@ -2606,16 +2606,8 @@ endif
PERL_DEFINES += $(gitexecdir) $(perllibdir) $(localedir)
-$(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
- $(QUIET_GEN) \
- sed -e '1{' \
- -e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \
- -e ' r GIT-PERL-HEADER' \
- -e ' G' \
- -e '}' \
- -e 's/@GIT_VERSION@/$(GIT_VERSION)/g' \
- $< >$@+ && \
- chmod +x $@+ && \
+$(SCRIPT_PERL_GEN): % : %.perl generate-perl.sh GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
+ $(QUIET_GEN)$(SHELL_PATH) generate-perl.sh ./GIT-BUILD-OPTIONS ./GIT-VERSION-FILE GIT-PERL-HEADER "$<" "$@+" && \
mv $@+ $@
PERL_DEFINES := $(subst $(space),:,$(PERL_DEFINES))
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index f8892c49c6d317040b3b6447b88133b2bfff3fcf..e2e7d3da2028cd36a9761f78607539080361b3ec 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -852,19 +852,41 @@ foreach(script ${git_shell_scripts})
endforeach()
#perl scripts
-parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" ".perl")
+parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" "")
#create perl header
file(STRINGS ${CMAKE_SOURCE_DIR}/perl/header_templates/fixed_prefix.template.pl perl_header )
string(REPLACE "@PATHSEP@" ":" perl_header "${perl_header}")
string(REPLACE "@INSTLIBDIR@" "${INSTLIBDIR}" perl_header "${perl_header}")
+file(WRITE ${CMAKE_BINARY_DIR}/PERL-HEADER ${perl_header})
+
+add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/GIT-VERSION-FILE"
+ COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE.in"
+ "${CMAKE_BINARY_DIR}/GIT-VERSION-FILE"
+ DEPENDS ${SH_EXE} "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
+ "${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE.in"
+ VERBATIM)
foreach(script ${git_perl_scripts})
- file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.perl content NEWLINE_CONSUME)
- string(REPLACE "#!/usr/bin/perl" "#!/usr/bin/perl\n${perl_header}\n" content "${content}")
- string(REPLACE "@GIT_VERSION@" "${PROJECT_VERSION}" content "${content}")
- file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
+ string(REPLACE ".perl" "" perl_gen_path "${script}")
+
+ add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/${perl_gen_path}"
+ COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-perl.sh"
+ "${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS"
+ "${CMAKE_BINARY_DIR}/GIT-VERSION-FILE"
+ "${CMAKE_BINARY_DIR}/PERL-HEADER"
+ "${CMAKE_SOURCE_DIR}/${script}"
+ "${CMAKE_BINARY_DIR}/${perl_gen_path}"
+ DEPENDS "${CMAKE_SOURCE_DIR}/generate-perl.sh"
+ "${CMAKE_SOURCE_DIR}/${script}"
+ "${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS"
+ "${CMAKE_BINARY_DIR}/GIT-VERSION-FILE"
+ VERBATIM)
+ list(APPEND perl_gen ${CMAKE_BINARY_DIR}/${perl_gen_path})
endforeach()
+add_custom_target(perl-gen ALL DEPENDS ${perl_gen})
#python script
file(STRINGS ${CMAKE_SOURCE_DIR}/git-p4.py content NEWLINE_CONSUME)
diff --git a/generate-perl.sh b/generate-perl.sh
new file mode 100755
index 0000000000000000000000000000000000000000..f168cce734dbbe80b58b4b761b13e8a177f70642
--- /dev/null
+++ b/generate-perl.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+set -e
+
+if test $# -ne 5
+then
+ echo "USAGE: $0 <GIT_BUILD_OPTIONS> <GIT_VERSION_FILE> <PERL_HEADER> <INPUT> <OUTPUT>" >&2
+ exit 1
+fi
+
+GIT_BUILD_OPTIONS="$1"
+GIT_VERSION_FILE="$2"
+PERL_HEADER="$3"
+INPUT="$4"
+OUTPUT="$5"
+
+. "$GIT_BUILD_OPTIONS"
+. "$GIT_VERSION_FILE"
+
+sed -e '1{' \
+ -e " s|#!.*perl|#!$PERL_PATH|" \
+ -e " r $PERL_HEADER" \
+ -e ' G' \
+ -e '}' \
+ -e "s/@GIT_VERSION@/$GIT_VERSION/g" \
+ "$INPUT" >"$OUTPUT"
+chmod a+x "$OUTPUT"
--
2.47.0.251.gb31fb630c0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH RFC v7 08/22] Makefile: use "generate-perl.sh" to massage Perl library
2024-11-15 7:21 ` [PATCH RFC v7 00/22] " Patrick Steinhardt
` (6 preceding siblings ...)
2024-11-15 7:21 ` [PATCH RFC v7 07/22] Makefile: extract script to massage Perl scripts Patrick Steinhardt
@ 2024-11-15 7:21 ` Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 09/22] Makefile: extract script to massage Shell scripts Patrick Steinhardt
` (15 subsequent siblings)
23 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-15 7:21 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
Extend "generate-perl.sh" such that it knows to also massage the Perl
library files. There are two major differences:
- We do not read in the Perl header. This is handled by matching on
whether or not we have a Perl shebang.
- We substitute some more variables, which we read in via our
GIT-BUILD-OPTIONS.
Adapt both our Makefile and the CMake build instructions to use this.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-BUILD-OPTIONS.in | 2 ++
Makefile | 10 ++++------
contrib/buildsystems/CMakeLists.txt | 23 +++++++++--------------
generate-perl.sh | 14 ++++++++++++--
4 files changed, 27 insertions(+), 22 deletions(-)
diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in
index f0ca240493c94aa41a6b6241a8474e42f7cdc8b9..050432f9fc49f93d0f6ed98c1307405c52761be0 100644
--- a/GIT-BUILD-OPTIONS.in
+++ b/GIT-BUILD-OPTIONS.in
@@ -1,6 +1,8 @@
SHELL_PATH=@SHELL_PATH@
TEST_SHELL_PATH=@TEST_SHELL_PATH@
PERL_PATH=@PERL_PATH@
+PERL_LOCALEDIR=@PERL_LOCALEDIR@
+NO_PERL_CPAN_FALLBACKS=@NO_PERL_CPAN_FALLBACKS@
DIFF=@DIFF@
PYTHON_PATH=@PYTHON_PATH@
TAR=@TAR@
diff --git a/Makefile b/Makefile
index 669ee4fb8d28fd9e1aeb0a794d5ce44ba60b5c9c..8aaa5bbfe2bd11aa88b7578e17b9839b1b9b0a0b 100644
--- a/Makefile
+++ b/Makefile
@@ -3095,13 +3095,9 @@ endif
NO_PERL_CPAN_FALLBACKS_SQ = $(subst ','\'',$(NO_PERL_CPAN_FALLBACKS))
endif
-perl/build/lib/%.pm: perl/%.pm GIT-PERL-DEFINES
+perl/build/lib/%.pm: perl/%.pm generate-perl.sh GIT-BUILD-OPTIONS GIT-VERSION-FILE GIT-PERL-DEFINES
$(call mkdir_p_parent_template)
- $(QUIET_GEN) \
- sed -e 's|@LOCALEDIR@|$(perl_localedir_SQ)|g' \
- -e 's|@NO_GETTEXT@|$(NO_GETTEXT_SQ)|g' \
- -e 's|@NO_PERL_CPAN_FALLBACKS@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \
- < $< > $@
+ $(QUIET_GEN)$(SHELL_PATH) generate-perl.sh ./GIT-BUILD-OPTIONS ./GIT-VERSION-FILE GIT-PERL-HEADER "$<" "$@"
perl/build/man/man3/Git.3pm: perl/Git.pm
$(call mkdir_p_parent_template)
@@ -3162,6 +3158,8 @@ GIT-BUILD-OPTIONS: FORCE
-e "s|@SHELL_PATH@|\'$(SHELL_PATH_SQ)\'|" \
-e "s|@TEST_SHELL_PATH@|\'$(TEST_SHELL_PATH_SQ)\'|" \
-e "s|@PERL_PATH@|\'$(PERL_PATH_SQ)\'|" \
+ -e "s|@PERL_LOCALEDIR@|\'$(perl_localedir_SQ)\'|" \
+ -e "s|@NO_PERL_CPAN_FALLBACKS@|\'$(NO_PERL_CPAN_FALLBACKS_SQ)\'|" \
-e "s|@DIFF@|\'$(DIFF)\'|" \
-e "s|@PYTHON_PATH@|\'$(PYTHON_PATH_SQ)\'|" \
-e "s|@TAR@|\'$(TAR)\'|" \
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index e2e7d3da2028cd36a9761f78607539080361b3ec..0f9180937e76cad4ad831d34877ea276413e76c9 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -853,6 +853,9 @@ endforeach()
#perl scripts
parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" "")
+#perl modules
+file(GLOB_RECURSE perl_modules "${CMAKE_SOURCE_DIR}/perl/*.pm")
+list(TRANSFORM perl_modules REPLACE "${CMAKE_SOURCE_DIR}/" "")
#create perl header
file(STRINGS ${CMAKE_SOURCE_DIR}/perl/header_templates/fixed_prefix.template.pl perl_header )
@@ -869,9 +872,12 @@ add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/GIT-VERSION-FILE"
"${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE.in"
VERBATIM)
-foreach(script ${git_perl_scripts})
+foreach(script ${git_perl_scripts} ${perl_modules})
string(REPLACE ".perl" "" perl_gen_path "${script}")
+ get_filename_component(perl_gen_dir "${perl_gen_path}" DIRECTORY)
+ file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/${perl_gen_dir}")
+
add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/${perl_gen_path}"
COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-perl.sh"
"${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS"
@@ -893,19 +899,6 @@ file(STRINGS ${CMAKE_SOURCE_DIR}/git-p4.py content NEWLINE_CONSUME)
string(REPLACE "#!/usr/bin/env python" "#!/usr/bin/python" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/git-p4 ${content})
-#perl modules
-file(GLOB_RECURSE perl_modules "${CMAKE_SOURCE_DIR}/perl/*.pm")
-
-foreach(pm ${perl_modules})
- string(REPLACE "${CMAKE_SOURCE_DIR}/perl/" "" file_path ${pm})
- file(STRINGS ${pm} content NEWLINE_CONSUME)
- string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}")
- string(REPLACE "@NO_PERL_CPAN_FALLBACKS@" "" content "${content}")
- file(WRITE ${CMAKE_BINARY_DIR}/perl/build/lib/${file_path} ${content})
-#test-lib.sh requires perl/build/lib to be the build directory of perl modules
-endforeach()
-
-
#templates
file(GLOB templates "${CMAKE_SOURCE_DIR}/templates/*")
list(TRANSFORM templates REPLACE "${CMAKE_SOURCE_DIR}/templates/" "")
@@ -1147,6 +1140,8 @@ file(STRINGS ${CMAKE_SOURCE_DIR}/GIT-BUILD-OPTIONS.in git_build_options NEWLINE_
string(REPLACE "@SHELL_PATH@" "'${SHELL_PATH}'" git_build_options "${git_build_options}")
string(REPLACE "@TEST_SHELL_PATH@" "'${TEST_SHELL_PATH}'" git_build_options "${git_build_options}")
string(REPLACE "@PERL_PATH@" "'${PERL_PATH}'" git_build_options "${git_build_options}")
+string(REPLACE "@PERL_LOCALEDIR@" "'${LOCALEDIR}'" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PERL_CPAN_FALLBACKS@" "" git_build_options "${git_build_options}")
string(REPLACE "@DIFF@" "'${DIFF}'" git_build_options "${git_build_options}")
string(REPLACE "@PYTHON_PATH@" "'${PYTHON_PATH}'" git_build_options "${git_build_options}")
string(REPLACE "@TAR@" "'${TAR}'" git_build_options "${git_build_options}")
diff --git a/generate-perl.sh b/generate-perl.sh
index f168cce734dbbe80b58b4b761b13e8a177f70642..d9eaed86218c5f74fdae06bf3170808104058fa7 100755
--- a/generate-perl.sh
+++ b/generate-perl.sh
@@ -18,10 +18,20 @@ OUTPUT="$5"
. "$GIT_VERSION_FILE"
sed -e '1{' \
+ -e " /^#!.*perl/!b" \
-e " s|#!.*perl|#!$PERL_PATH|" \
-e " r $PERL_HEADER" \
-e ' G' \
-e '}' \
- -e "s/@GIT_VERSION@/$GIT_VERSION/g" \
+ -e "s|@GIT_VERSION@|$GIT_VERSION|g" \
+ -e "s|@LOCALEDIR@|$PERL_LOCALEDIR|g" \
+ -e "s|@NO_GETTEXT@|$NO_GETTEXT|g" \
+ -e "s|@NO_PERL_CPAN_FALLBACKS@|$NO_PERL_CPAN_FALLBACKS|g" \
"$INPUT" >"$OUTPUT"
-chmod a+x "$OUTPUT"
+
+case "$INPUT" in
+*.perl)
+ chmod a+x "$OUTPUT";;
+*)
+ ;;
+esac
--
2.47.0.251.gb31fb630c0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH RFC v7 09/22] Makefile: extract script to massage Shell scripts
2024-11-15 7:21 ` [PATCH RFC v7 00/22] " Patrick Steinhardt
` (7 preceding siblings ...)
2024-11-15 7:21 ` [PATCH RFC v7 08/22] Makefile: use "generate-perl.sh" to massage Perl library Patrick Steinhardt
@ 2024-11-15 7:21 ` Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 10/22] Makefile: extract script to generate gitweb.cgi Patrick Steinhardt
` (14 subsequent siblings)
23 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-15 7:21 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
Same as in the preceding commits, extract a script that allows us to
unify how we massage shell scripts.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-BUILD-OPTIONS.in | 4 ++++
Makefile | 34 ++++++++++------------------------
contrib/buildsystems/CMakeLists.txt | 31 ++++++++++++++++++++-----------
generate-script.sh | 34 ++++++++++++++++++++++++++++++++++
4 files changed, 68 insertions(+), 35 deletions(-)
diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in
index 050432f9fc49f93d0f6ed98c1307405c52761be0..9b95a6b3eee334b6f691702696ca9d92201b6bac 100644
--- a/GIT-BUILD-OPTIONS.in
+++ b/GIT-BUILD-OPTIONS.in
@@ -36,3 +36,7 @@ GIT_INTEROP_MAKE_OPTS=@GIT_INTEROP_MAKE_OPTS@
GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@
GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@
RUNTIME_PREFIX=@RUNTIME_PREFIX@
+GITWEBDIR=@GITWEBDIR@
+USE_GETTEXT_SCHEME=@USE_GETTEXT_SCHEME@
+LOCALEDIR=@LOCALEDIR@
+BROKEN_PATH_FIX=@BROKEN_PATH_FIX@
diff --git a/Makefile b/Makefile
index 8aaa5bbfe2bd11aa88b7578e17b9839b1b9b0a0b..d921c4d8e2c362b2f6f95984fca4a11a02c9967a 100644
--- a/Makefile
+++ b/Makefile
@@ -1558,10 +1558,10 @@ endif
ifdef SANE_TOOL_PATH
SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH))
-BROKEN_PATH_FIX = 's|^\# @BROKEN_PATH_FIX@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|'
+BROKEN_PATH_FIX = s|^\# @BROKEN_PATH_FIX@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|
PATH := $(SANE_TOOL_PATH):${PATH}
else
-BROKEN_PATH_FIX = '/^\# @BROKEN_PATH_FIX@$$/d'
+BROKEN_PATH_FIX = /^\# @BROKEN_PATH_FIX@$$/d
endif
ifeq (,$(HOST_CPU))
@@ -2546,26 +2546,8 @@ GIT-SCRIPT-DEFINES: FORCE
echo "$$FLAGS" >$@; \
fi
-define cmd_munge_script
-sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
- -e 's|@DIFF@|$(DIFF_SQ)|' \
- -e 's|@LOCALEDIR@|$(localedir_SQ)|g' \
- -e 's/@USE_GETTEXT_SCHEME@/$(USE_GETTEXT_SCHEME)/g' \
- -e $(BROKEN_PATH_FIX) \
- -e 's|@GITWEBDIR@|$(gitwebdir_SQ)|g' \
- -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' \
- -e 's|@PAGER_ENV@|$(PAGER_ENV_SQ)|g' \
- $@.sh >$@+
-endef
-
-$(SCRIPT_SH_GEN) : % : %.sh GIT-SCRIPT-DEFINES
- $(QUIET_GEN)$(cmd_munge_script) && \
- chmod +x $@+ && \
- mv $@+ $@
-
-$(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEFINES
- $(QUIET_GEN)$(cmd_munge_script) && \
+$(SCRIPT_SH_GEN) $(SCRIPT_LIB) : % : %.sh generate-script.sh GIT-BUILD-OPTIONS GIT-SCRIPT-DEFINES
+ $(QUIET_GEN)./generate-script.sh "$<" "$@+" ./GIT-BUILD-OPTIONS && \
mv $@+ $@
git.rc: git.rc.in GIT-VERSION-GEN GIT-VERSION-FILE
@@ -2635,8 +2617,8 @@ GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile
perllibdir:
@echo '$(perllibdir_SQ)'
-git-instaweb: git-instaweb.sh GIT-SCRIPT-DEFINES
- $(QUIET_GEN)$(cmd_munge_script) && \
+git-instaweb: git-instaweb.sh generate-script.sh GIT-BUILD-OPTIONS GIT-SCRIPT-DEFINES
+ $(QUIET_GEN)./generate-script.sh "$<" "$@+" ./GIT-BUILD-OPTIONS && \
chmod +x $@+ && \
mv $@+ $@
else # NO_PERL
@@ -3193,6 +3175,10 @@ GIT-BUILD-OPTIONS: FORCE
-e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \
-e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \
-e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX)\'|" \
+ -e "s|@GITWEBDIR@|\'$(gitwebdir_SQ)\'|" \
+ -e "s|@USE_GETTEXT_SCHEME@|\'$(USE_GETTEXT_SCHEME)\'|" \
+ -e "s|@LOCALEDIR@|\'$(localedir_SQ)\'|" \
+ -e "s|@BROKEN_PATH_FIX@|\'$(BROKEN_PATH_FIX)\'|" \
GIT-BUILD-OPTIONS.in >$@+
@if grep -q '^[A-Z][A-Z_]*=@.*@$$' $@+; then echo "Unsubstituted build options in $@" >&2 && exit 1; fi
@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 0f9180937e76cad4ad831d34877ea276413e76c9..7121fdfbc2ba50b4c7afb3f2b45fdaa5b9909a60 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -838,18 +838,23 @@ set(git_shell_scripts
${git_sh_scripts} ${git_shlib_scripts} git-instaweb)
foreach(script ${git_shell_scripts})
- file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.sh content NEWLINE_CONSUME)
- string(REPLACE "@SHELL_PATH@" "${SHELL_PATH}" content "${content}")
- string(REPLACE "@DIFF@" "diff" content "${content}")
- string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}")
- string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" content "${content}")
- string(REPLACE "@NO_CURL@" "" content "${content}")
- string(REPLACE "@USE_GETTEXT_SCHEME@" "" content "${content}")
- string(REPLACE "# @BROKEN_PATH_FIX@" "" content "${content}")
- string(REPLACE "@PERL_PATH@" "${PERL_PATH}" content "${content}")
- string(REPLACE "@PAGER_ENV@" "LESS=FRX LV=-c" content "${content}")
- file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
+ if ("${script}" IN_LIST git_sh_scripts)
+ string(REPLACE ".sh" "" shell_gen_path "${script}")
+ else()
+ set(shell_gen_path "${script}")
+ endif()
+
+ add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/${shell_gen_path}"
+ COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-script.sh"
+ "${CMAKE_SOURCE_DIR}/${script}.sh"
+ "${CMAKE_BINARY_DIR}/${shell_gen_path}"
+ "${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS"
+ DEPENDS "${CMAKE_SOURCE_DIR}/generate-script.sh"
+ "${CMAKE_SOURCE_DIR}/${script}.sh"
+ VERBATIM)
+ list(APPEND shell_gen ${CMAKE_BINARY_DIR}/${shell_gen_path})
endforeach()
+add_custom_target(shell-gen ALL DEPENDS ${shell_gen})
#perl scripts
parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" "")
@@ -1175,6 +1180,10 @@ string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_optio
string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}")
string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}")
string(REPLACE "@RUNTIME_PREFIX@" "'${RUNTIME_PREFIX}'" git_build_options "${git_build_options}")
+string(REPLACE "@GITWEBDIR@" "'${GITWEBDIR}'" git_build_options "${git_build_options}")
+string(REPLACE "@USE_GETTEXT_SCHEME@" "" git_build_options "${git_build_options}")
+string(REPLACE "@LOCALEDIR@" "'${LOCALEDIR}'" git_build_options "${git_build_options}")
+string(REPLACE "@BROKEN_PATH_FIX@" "" git_build_options "${git_build_options}")
if(USE_VCPKG)
string(APPEND git_build_options "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
endif()
diff --git a/generate-script.sh b/generate-script.sh
new file mode 100755
index 0000000000000000000000000000000000000000..d001e43d7bf1c4d72f41f805128ae42330a54558
--- /dev/null
+++ b/generate-script.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+set -e
+
+if test $# -ne 3
+then
+ echo "USAGE: $0 <INPUT> <OUTPUT> <GIT-BUILD-OPTIONS>" >&2
+ exit 1
+fi
+
+INPUT="$1"
+OUTPUT="$2"
+BUILD_OPTIONS="$3"
+
+. "$BUILD_OPTIONS"
+
+sed -e "1s|#!.*/sh|#!$SHELL_PATH|" \
+ -e "s|@SHELL_PATH@|$SHELL_PATH|" \
+ -e "s|@DIFF@|$DIFF|" \
+ -e "s|@LOCALEDIR@|$LOCALEDIR|g" \
+ -e "s/@USE_GETTEXT_SCHEME@/$USE_GETTEXT_SCHEME/g" \
+ -e "$BROKEN_PATH_FIX" \
+ -e "s|@GITWEBDIR@|$GITWEBDIR|g" \
+ -e "s|@PERL_PATH@|$PERL_PATH|g" \
+ -e "s|@PAGER_ENV@|$PAGER_ENV|g" \
+ "$INPUT" >"$OUTPUT"
+
+case "$(basename "$INPUT")" in
+git-mergetool--lib.sh|git-sh-i18n.sh|git-sh-setup.sh)
+ ;;
+*)
+ chmod a+x "$OUTPUT"
+ ;;
+esac
--
2.47.0.251.gb31fb630c0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH RFC v7 10/22] Makefile: extract script to generate gitweb.cgi
2024-11-15 7:21 ` [PATCH RFC v7 00/22] " Patrick Steinhardt
` (8 preceding siblings ...)
2024-11-15 7:21 ` [PATCH RFC v7 09/22] Makefile: extract script to massage Shell scripts Patrick Steinhardt
@ 2024-11-15 7:21 ` Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 11/22] Makefile: extract script to generate gitweb.js Patrick Steinhardt
` (13 subsequent siblings)
23 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-15 7:21 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
In order to generate "gitweb.cgi" we have to replace various different
placeholders. This is done ad-hoc and is thus not easily reusable across
different build systems.
Introduce a new GITWEB-BUILD-OPTIONS.in template that we populate at
configuration time with the expected options. This script is then used
as input for a new "generate-gitweb.sh" script that generates the final
"gitweb.cgi" file. While this requires us to repeat the options multiple
times, it is in line to how we generate other build options like our
GIT-BUILD-OPTIONS file.
While at it, refactor how we replace the GITWEB_PROJECT_MAXDEPTH. Even
though this variable is supposed to be an integer, the source file has
the value quoted. The quotes are eventually stripped via sed(1), which
replaces `"@GITWEB_PROJECT_MAXDEPTH@"` with the actual value, which is
rather nonsensical. This is made clearer by just dropping the quotes in
the source file.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
gitweb/GITWEB-BUILD-OPTIONS.in | 24 +++++++++++++++++
gitweb/Makefile | 59 +++++++++++++++++++++---------------------
gitweb/generate-gitweb-cgi.sh | 47 +++++++++++++++++++++++++++++++++
gitweb/gitweb.perl | 2 +-
4 files changed, 101 insertions(+), 31 deletions(-)
diff --git a/gitweb/GITWEB-BUILD-OPTIONS.in b/gitweb/GITWEB-BUILD-OPTIONS.in
new file mode 100644
index 0000000000000000000000000000000000000000..41ac20654c4f79917993bafa8f7e447669552b9d
--- /dev/null
+++ b/gitweb/GITWEB-BUILD-OPTIONS.in
@@ -0,0 +1,24 @@
+PERL_PATH=@PERL_PATH@
+JSMIN=@JSMIN@
+CSSMIN=@CSSMIN@
+GIT_BINDIR=@GIT_BINDIR@
+GITWEB_CONFIG=@GITWEB_CONFIG@
+GITWEB_CONFIG_SYSTEM=@GITWEB_CONFIG_SYSTEM@
+GITWEB_CONFIG_COMMON=@GITWEB_CONFIG_COMMON@
+GITWEB_HOME_LINK_STR=@GITWEB_HOME_LINK_STR@
+GITWEB_SITENAME=@GITWEB_SITENAME@
+GITWEB_PROJECTROOT=@GITWEB_PROJECTROOT@
+GITWEB_PROJECT_MAXDEPTH=@GITWEB_PROJECT_MAXDEPTH@
+GITWEB_EXPORT_OK=@GITWEB_EXPORT_OK@
+GITWEB_STRICT_EXPORT=@GITWEB_STRICT_EXPORT@
+GITWEB_BASE_URL=@GITWEB_BASE_URL@
+GITWEB_LIST=@GITWEB_LIST@
+GITWEB_HOMETEXT=@GITWEB_HOMETEXT@
+GITWEB_CSS=@GITWEB_CSS@
+GITWEB_LOGO=@GITWEB_LOGO@
+GITWEB_FAVICON=@GITWEB_FAVICON@
+GITWEB_JS=@GITWEB_JS@
+GITWEB_SITE_HTML_HEAD_STRING=@GITWEB_SITE_HTML_HEAD_STRING@
+GITWEB_SITE_HEADER=@GITWEB_SITE_HEADER@
+GITWEB_SITE_FOOTER=@GITWEB_SITE_FOOTER@
+HIGHLIGHT_BIN=@HIGHLIGHT_BIN@
diff --git a/gitweb/Makefile b/gitweb/Makefile
index 164c8d53757f98599ad14eeb22ca8d542eb7502a..16a2ef2d1e5664d99f6f1d8ff4224c36769c55fb 100644
--- a/gitweb/Makefile
+++ b/gitweb/Makefile
@@ -77,43 +77,42 @@ GITWEB_JSLIB_FILES += static/js/javascript-detection.js
GITWEB_JSLIB_FILES += static/js/adjust-timezone.js
GITWEB_JSLIB_FILES += static/js/blame_incremental.js
-
-GITWEB_REPLACE = \
- -e 's|@GIT_VERSION@|$(GIT_VERSION)|g' \
- -e 's|@GIT_BINDIR@|$(bindir)|g' \
- -e 's|@GITWEB_CONFIG@|$(GITWEB_CONFIG)|g' \
- -e 's|@GITWEB_CONFIG_SYSTEM@|$(GITWEB_CONFIG_SYSTEM)|g' \
- -e 's|@GITWEB_CONFIG_COMMON@|$(GITWEB_CONFIG_COMMON)|g' \
- -e 's|@GITWEB_HOME_LINK_STR@|$(GITWEB_HOME_LINK_STR)|g' \
- -e 's|@GITWEB_SITENAME@|$(GITWEB_SITENAME)|g' \
- -e 's|@GITWEB_PROJECTROOT@|$(GITWEB_PROJECTROOT)|g' \
- -e 's|"@GITWEB_PROJECT_MAXDEPTH@"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
- -e 's|@GITWEB_EXPORT_OK@|$(GITWEB_EXPORT_OK)|g' \
- -e 's|@GITWEB_STRICT_EXPORT@|$(GITWEB_STRICT_EXPORT)|g' \
- -e 's|@GITWEB_BASE_URL@|$(GITWEB_BASE_URL)|g' \
- -e 's|@GITWEB_LIST@|$(GITWEB_LIST)|g' \
- -e 's|@GITWEB_HOMETEXT@|$(GITWEB_HOMETEXT)|g' \
- -e 's|@GITWEB_CSS@|$(GITWEB_CSS)|g' \
- -e 's|@GITWEB_LOGO@|$(GITWEB_LOGO)|g' \
- -e 's|@GITWEB_FAVICON@|$(GITWEB_FAVICON)|g' \
- -e 's|@GITWEB_JS@|$(GITWEB_JS)|g' \
- -e 's|@GITWEB_SITE_HTML_HEAD_STRING@|$(GITWEB_SITE_HTML_HEAD_STRING)|g' \
- -e 's|@GITWEB_SITE_HEADER@|$(GITWEB_SITE_HEADER)|g' \
- -e 's|@GITWEB_SITE_FOOTER@|$(GITWEB_SITE_FOOTER)|g' \
- -e 's|@HIGHLIGHT_BIN@|$(HIGHLIGHT_BIN)|g'
-
.PHONY: FORCE
$(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS: FORCE
- @rm -f $@+
- @echo "x" '$(PERL_PATH_SQ)' $(GITWEB_REPLACE) "$(JSMIN)|$(CSSMIN)" >$@+
+ @sed -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|' \
+ -e 's|@JSMIN@|$(JSMIN)|' \
+ -e 's|@CSSMIN@|$(CSSMIN)|' \
+ -e 's|@GIT_VERSION@|$(GIT_VERSION)|' \
+ -e 's|@GIT_BINDIR@|$(bindir)|' \
+ -e 's|@GITWEB_CONFIG@|$(GITWEB_CONFIG)|' \
+ -e 's|@GITWEB_CONFIG_SYSTEM@|$(GITWEB_CONFIG_SYSTEM)|' \
+ -e 's|@GITWEB_CONFIG_COMMON@|$(GITWEB_CONFIG_COMMON)|' \
+ -e 's|@GITWEB_HOME_LINK_STR@|$(GITWEB_HOME_LINK_STR)|' \
+ -e 's|@GITWEB_SITENAME@|$(GITWEB_SITENAME)|' \
+ -e 's|@GITWEB_PROJECTROOT@|$(GITWEB_PROJECTROOT)|' \
+ -e 's|@GITWEB_PROJECT_MAXDEPTH@|$(GITWEB_PROJECT_MAXDEPTH)|' \
+ -e 's|@GITWEB_EXPORT_OK@|$(GITWEB_EXPORT_OK)|' \
+ -e 's|@GITWEB_STRICT_EXPORT@|$(GITWEB_STRICT_EXPORT)|' \
+ -e 's|@GITWEB_BASE_URL@|$(GITWEB_BASE_URL)|' \
+ -e 's|@GITWEB_LIST@|$(GITWEB_LIST)|' \
+ -e 's|@GITWEB_HOMETEXT@|$(GITWEB_HOMETEXT)|' \
+ -e 's|@GITWEB_CSS@|$(GITWEB_CSS)|' \
+ -e 's|@GITWEB_LOGO@|$(GITWEB_LOGO)|' \
+ -e 's|@GITWEB_FAVICON@|$(GITWEB_FAVICON)|' \
+ -e 's|@GITWEB_JS@|$(GITWEB_JS)|' \
+ -e 's|@GITWEB_SITE_HTML_HEAD_STRING@|$(GITWEB_SITE_HTML_HEAD_STRING)|' \
+ -e 's|@GITWEB_SITE_HEADER@|$(GITWEB_SITE_HEADER)|' \
+ -e 's|@GITWEB_SITE_FOOTER@|$(GITWEB_SITE_FOOTER)|' \
+ -e 's|@HIGHLIGHT_BIN@|$(HIGHLIGHT_BIN)|' \
+ $(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS.in >"$@+"
@cmp -s $@+ $@ && rm -f $@+ || mv -f $@+ $@
+$(MAK_DIR_GITWEB)gitweb.cgi: $(MAK_DIR_GITWEB)generate-gitweb-cgi.sh
$(MAK_DIR_GITWEB)gitweb.cgi: $(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS
+$(MAK_DIR_GITWEB)gitweb.cgi: GIT-VERSION-FILE
$(MAK_DIR_GITWEB)gitweb.cgi: $(MAK_DIR_GITWEB)gitweb.perl
$(QUIET_GEN)$(RM) $@ $@+ && \
- sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
- $(GITWEB_REPLACE) $< >$@+ && \
- chmod +x $@+ && \
+ $(MAK_DIR_GITWEB)generate-gitweb-cgi.sh $(MAK_DIR_GITWEB)/GITWEB-BUILD-OPTIONS ./GIT-VERSION-FILE $< $@+ && \
mv $@+ $@
$(MAK_DIR_GITWEB)static/gitweb.js: $(addprefix $(MAK_DIR_GITWEB),$(GITWEB_JSLIB_FILES))
diff --git a/gitweb/generate-gitweb-cgi.sh b/gitweb/generate-gitweb-cgi.sh
new file mode 100755
index 0000000000000000000000000000000000000000..67a646aeb7c22fd69817ed14c9937f3123736405
--- /dev/null
+++ b/gitweb/generate-gitweb-cgi.sh
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+set -e
+
+if test $# -ne 4
+then
+ echo "USAGE: $0 <GITWEB-BUILD-OPTIONS> <GIT-VERSION-FILE> <INPUT> <OUTPUT>" >&2
+ exit 1
+fi
+
+GITWEB_BUILD_OPTIONS="$1"
+GIT_VERSION_FILE="$2"
+INPUT="$3"
+OUTPUT="$4"
+
+. "$GITWEB_BUILD_OPTIONS"
+. "$GIT_VERSION_FILE"
+
+sed -e "1s|#!/usr/bin/perl|#!$PERL_PATH|" \
+ -e "s|@PERL_PATH@|$PERL_PATH|" \
+ -e "s|@JSMIN@|$JSMIN|" \
+ -e "s|@CSSMIN@|$CSSMIN|" \
+ -e "s|@GIT_VERSION@|$GIT_VERSION|" \
+ -e "s|@GIT_BINDIR@|$GIT_BINDIR|" \
+ -e "s|@GITWEB_CONFIG@|$GITWEB_CONFIG|" \
+ -e "s|@GITWEB_CONFIG_SYSTEM@|$GITWEB_CONFIG_SYSTEM|" \
+ -e "s|@GITWEB_CONFIG_COMMON@|$GITWEB_CONFIG_COMMON|" \
+ -e "s|@GITWEB_HOME_LINK_STR@|$GITWEB_HOME_LINK_STR|" \
+ -e "s|@GITWEB_SITENAME@|$GITWEB_SITENAME|" \
+ -e "s|@GITWEB_PROJECTROOT@|$GITWEB_PROJECTROOT|" \
+ -e "s|@GITWEB_PROJECT_MAXDEPTH@|$GITWEB_PROJECT_MAXDEPTH|" \
+ -e "s|@GITWEB_EXPORT_OK@|$GITWEB_EXPORT_OK|" \
+ -e "s|@GITWEB_STRICT_EXPORT@|$GITWEB_STRICT_EXPORT|" \
+ -e "s|@GITWEB_BASE_URL@|$GITWEB_BASE_URL|" \
+ -e "s|@GITWEB_LIST@|$GITWEB_LIST|" \
+ -e "s|@GITWEB_HOMETEXT@|$GITWEB_HOMETEXT|" \
+ -e "s|@GITWEB_CSS@|$GITWEB_CSS|" \
+ -e "s|@GITWEB_LOGO@|$GITWEB_LOGO|" \
+ -e "s|@GITWEB_FAVICON@|$GITWEB_FAVICON|" \
+ -e "s|@GITWEB_JS@|$GITWEB_JS|" \
+ -e "s|@GITWEB_SITE_HTML_HEAD_STRING@|$GITWEB_SITE_HTML_HEAD_STRING|" \
+ -e "s|@GITWEB_SITE_HEADER@|$GITWEB_SITE_HEADER|" \
+ -e "s|@GITWEB_SITE_FOOTER@|$GITWEB_SITE_FOOTER|" \
+ -e "s|@HIGHLIGHT_BIN@|$HIGHLIGHT_BIN|" \
+ "$INPUT" >"$OUTPUT"
+
+chmod a+x "$OUTPUT"
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 76e1f4e244fd23dd29b935e83753efa9c6d5bb5e..41bc64ec73f9f05666480025c3b70650607b4cd8 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -88,7 +88,7 @@ sub evaluate_uri {
# fs traversing limit for getting project list
# the number is relative to the projectroot
-our $project_maxdepth = "@GITWEB_PROJECT_MAXDEPTH@";
+our $project_maxdepth = @GITWEB_PROJECT_MAXDEPTH@;
# string of the home link on top of all pages
our $home_link_str = "@GITWEB_HOME_LINK_STR@";
--
2.47.0.251.gb31fb630c0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH RFC v7 11/22] Makefile: extract script to generate gitweb.js
2024-11-15 7:21 ` [PATCH RFC v7 00/22] " Patrick Steinhardt
` (9 preceding siblings ...)
2024-11-15 7:21 ` [PATCH RFC v7 10/22] Makefile: extract script to generate gitweb.cgi Patrick Steinhardt
@ 2024-11-15 7:21 ` Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 12/22] Makefile: refactor generators to be PWD-independent Patrick Steinhardt
` (12 subsequent siblings)
23 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-15 7:21 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
Similar to the preceding commit, also extract the script to generate the
"gitweb.js" file. While the logic itself is trivial, it helps us avoid
duplication of logic across build systems and ensures that the build
systems will remain in sync with each other in case the logic ever needs
to change.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
gitweb/Makefile | 3 ++-
gitweb/generate-gitweb-js.sh | 12 ++++++++++++
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/gitweb/Makefile b/gitweb/Makefile
index 16a2ef2d1e5664d99f6f1d8ff4224c36769c55fb..d5748e93594eb6181269c2fe272bf7ef980cbe68 100644
--- a/gitweb/Makefile
+++ b/gitweb/Makefile
@@ -115,9 +115,10 @@ $(MAK_DIR_GITWEB)gitweb.cgi: $(MAK_DIR_GITWEB)gitweb.perl
$(MAK_DIR_GITWEB)generate-gitweb-cgi.sh $(MAK_DIR_GITWEB)/GITWEB-BUILD-OPTIONS ./GIT-VERSION-FILE $< $@+ && \
mv $@+ $@
+$(MAK_DIR_GITWEB)static/gitweb.js: $(MAK_DIR_GITWEB)generate-gitweb-js.sh
$(MAK_DIR_GITWEB)static/gitweb.js: $(addprefix $(MAK_DIR_GITWEB),$(GITWEB_JSLIB_FILES))
$(QUIET_GEN)$(RM) $@ $@+ && \
- cat $^ >$@+ && \
+ $(MAK_DIR_GITWEB)generate-gitweb-js.sh $@+ $^ && \
mv $@+ $@
### Installation rules
diff --git a/gitweb/generate-gitweb-js.sh b/gitweb/generate-gitweb-js.sh
new file mode 100755
index 0000000000000000000000000000000000000000..bb81220da393ebecae28b675c299b626f0e698fb
--- /dev/null
+++ b/gitweb/generate-gitweb-js.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+if test "$#" -lt 2
+then
+ echo "USAGE: $0 <OUTPUT> <INPUT>..." >&2
+ exit 1
+fi
+
+OUTPUT="$1"
+shift
+
+cat "$@" >"$OUTPUT"
--
2.47.0.251.gb31fb630c0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH RFC v7 12/22] Makefile: refactor generators to be PWD-independent
2024-11-15 7:21 ` [PATCH RFC v7 00/22] " Patrick Steinhardt
` (10 preceding siblings ...)
2024-11-15 7:21 ` [PATCH RFC v7 11/22] Makefile: extract script to generate gitweb.js Patrick Steinhardt
@ 2024-11-15 7:21 ` Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 13/22] Makefile: allow "bin-wrappers/" directory to exist Patrick Steinhardt
` (11 subsequent siblings)
23 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-15 7:21 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
We have multiple scripts that generate headers from other data. All of
these scripts have the assumption built-in that they are executed in the
current source directory, which makes them a bit unwieldy to use during
out-of-tree builds.
Refactor them to instead take the source directory as well as the output
file as arguments.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 6 +++---
contrib/buildsystems/CMakeLists.txt | 19 +++++++++--------
generate-cmdlist.sh | 42 +++++++++++++++++++++++--------------
generate-configlist.sh | 20 +++++++++++++-----
generate-hooklist.sh | 15 ++++++++++++-
5 files changed, 68 insertions(+), 34 deletions(-)
diff --git a/Makefile b/Makefile
index d921c4d8e2c362b2f6f95984fca4a11a02c9967a..d9a0025b30db24cb035f19812f0071fe0642386b 100644
--- a/Makefile
+++ b/Makefile
@@ -2523,17 +2523,17 @@ $(BUILT_INS): git$X
config-list.h: generate-configlist.sh
config-list.h: Documentation/*config.txt Documentation/config/*.txt
- $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh >$@
+ $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh . $@
command-list.h: generate-cmdlist.sh command-list.txt
command-list.h: $(wildcard Documentation/git*.txt)
$(QUIET_GEN)$(SHELL_PATH) ./generate-cmdlist.sh \
$(patsubst %,--exclude-program %,$(EXCLUDED_PROGRAMS)) \
- command-list.txt >$@
+ . $@
hook-list.h: generate-hooklist.sh Documentation/githooks.txt
- $(QUIET_GEN)$(SHELL_PATH) ./generate-hooklist.sh >$@
+ $(QUIET_GEN)$(SHELL_PATH) ./generate-hooklist.sh . $@
SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):\
$(localedir_SQ):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 7121fdfbc2ba50b4c7afb3f2b45fdaa5b9909a60..be1ce1f37a775c366098717047cd7579cd81015d 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -638,23 +638,24 @@ set(EXCLUSION_PROGS_CACHE ${EXCLUSION_PROGS} CACHE STRING "Programs not built" F
if(NOT EXISTS ${CMAKE_BINARY_DIR}/command-list.h OR NOT EXCLUSION_PROGS_CACHE STREQUAL EXCLUSION_PROGS)
list(REMOVE_ITEM EXCLUSION_PROGS empty)
message("Generating command-list.h")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-cmdlist.sh ${EXCLUSION_PROGS} command-list.txt
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_FILE ${CMAKE_BINARY_DIR}/command-list.h)
+ execute_process(COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-cmdlist.sh"
+ ${EXCLUSION_PROGS}
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_BINARY_DIR}/command-list.h")
endif()
if(NOT EXISTS ${CMAKE_BINARY_DIR}/config-list.h)
message("Generating config-list.h")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-configlist.sh
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_FILE ${CMAKE_BINARY_DIR}/config-list.h)
+ execute_process(COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-configlist.sh"
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_BINARY_DIR}/config-list.h")
endif()
if(NOT EXISTS ${CMAKE_BINARY_DIR}/hook-list.h)
message("Generating hook-list.h")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-hooklist.sh
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_FILE ${CMAKE_BINARY_DIR}/hook-list.h)
+ execute_process(COMMAND "${SH_EXE}" ${CMAKE_SOURCE_DIR}/generate-hooklist.sh
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_BINARY_DIR}/hook-list.h")
endif()
include_directories(${CMAKE_BINARY_DIR})
diff --git a/generate-cmdlist.sh b/generate-cmdlist.sh
index 205541e0f7f81b1df4061215ae34a2742a45475d..b923a5aab80dfa571a40a4f6fa3d860fcf8f8dd1 100755
--- a/generate-cmdlist.sh
+++ b/generate-cmdlist.sh
@@ -64,7 +64,7 @@ define_category_names () {
print_command_list () {
echo "static struct cmdname_help command_list[] = {"
- echo "$1" |
+ echo "$2" |
while read cmd rest
do
synopsis=
@@ -76,7 +76,7 @@ print_command_list () {
break
;;
esac
- done <"Documentation/$cmd.txt"
+ done <"$1/Documentation/$cmd.txt"
printf '\t{ "%s", N_("%s"), 0' "$cmd" "$synopsis"
printf " | CAT_%s" $rest
@@ -93,18 +93,28 @@ do
shift
done
-commands="$(command_list "$1")"
-categories="$(category_list "$commands")"
+if test "$#" -ne 2
+then
+ die "USAGE: $0 <SOURCE_DIR> <OUTPUT>"
+fi
+
+SOURCE_DIR="$1"
+OUTPUT="$2"
+
+{
+ commands="$(command_list "$SOURCE_DIR"/command-list.txt)"
+ categories="$(category_list "$commands")"
-echo "/* Automatically generated by generate-cmdlist.sh */
-struct cmdname_help {
- const char *name;
- const char *help;
- uint32_t category;
-};
-"
-define_categories "$categories"
-echo
-define_category_names "$categories"
-echo
-print_command_list "$commands"
+ echo "/* Automatically generated by generate-cmdlist.sh */
+ struct cmdname_help {
+ const char *name;
+ const char *help;
+ uint32_t category;
+ };
+ "
+ define_categories "$categories"
+ echo
+ define_category_names "$categories"
+ echo
+ print_command_list "$SOURCE_DIR" "$commands"
+} >"$OUTPUT"
diff --git a/generate-configlist.sh b/generate-configlist.sh
index 8692fe5cf4d5e4025265e6110254b05640615fea..512804a1ca1b63a0630ae152569b31486273eae0 100755
--- a/generate-configlist.sh
+++ b/generate-configlist.sh
@@ -1,13 +1,19 @@
#!/bin/sh
-echo "/* Automatically generated by generate-configlist.sh */"
-echo
+SOURCE_DIR="$1"
+OUTPUT="$2"
+
+if test -z "$SOURCE_DIR" || ! test -d "$SOURCE_DIR" || test -z "$OUTPUT"
+then
+ echo "USAGE: $0 <SOURCE_DIR> <OUTPUT>" >&2
+ exit 1
+fi
print_config_list () {
cat <<EOF
static const char *config_name_list[] = {
EOF
- grep -h '^[a-zA-Z].*\..*::$' Documentation/*config.txt Documentation/config/*.txt |
+ grep -h '^[a-zA-Z].*\..*::$' "$SOURCE_DIR"/Documentation/*config.txt "$SOURCE_DIR"/Documentation/config/*.txt |
sed '/deprecated/d; s/::$//; s/, */\n/g' |
sort |
sed 's/^.*$/ "&",/'
@@ -17,5 +23,9 @@ EOF
EOF
}
-echo
-print_config_list
+{
+ echo "/* Automatically generated by generate-configlist.sh */"
+ echo
+ echo
+ print_config_list
+} >"$OUTPUT"
diff --git a/generate-hooklist.sh b/generate-hooklist.sh
index 2f9f54eb545be2bd79c37a868dbeef96d2ddfb9f..0ff2a0b6fbd16772de1f88cad36af8185892bb47 100755
--- a/generate-hooklist.sh
+++ b/generate-hooklist.sh
@@ -2,6 +2,17 @@
#
# Usage: ./generate-hooklist.sh >hook-list.h
+SOURCE_DIR="$1"
+OUTPUT="$2"
+
+if test -z "$SOURCE_DIR" || ! test -d "$SOURCE_DIR" || test -z "$OUTPUT"
+then
+ echo "USAGE: $0 <SOURCE_DIR> <OUTPUT>" >&2
+ exit 1
+fi
+
+{
+
cat <<EOF
/* Automatically generated by generate-hooklist.sh */
@@ -11,10 +22,12 @@ EOF
sed -n \
-e '/^~~~~*$/ {x; s/^.*$/ "&",/; p;}' \
-e 'x' \
- <Documentation/githooks.txt |
+ <"$SOURCE_DIR"/Documentation/githooks.txt |
LC_ALL=C sort
cat <<EOF
NULL,
};
EOF
+
+} >"$OUTPUT"
--
2.47.0.251.gb31fb630c0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH RFC v7 13/22] Makefile: allow "bin-wrappers/" directory to exist
2024-11-15 7:21 ` [PATCH RFC v7 00/22] " Patrick Steinhardt
` (11 preceding siblings ...)
2024-11-15 7:21 ` [PATCH RFC v7 12/22] Makefile: refactor generators to be PWD-independent Patrick Steinhardt
@ 2024-11-15 7:21 ` Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 14/22] Makefile: simplify building of templates Patrick Steinhardt
` (10 subsequent siblings)
23 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-15 7:21 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
The "bin-wrappers/" directory gets created by our build system and is
populated with one script for each of our binaries. There isn't anything
inherently wrong with the current layout, but it is somewhat hard to
adapt for out-of-tree build systems.
Adapt the layout such that our "bin-wrappers/" directory always exists
and contains our "wrap-for-bin.sh" script to make things a little bit
easier for subsequent steps.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
.gitignore | 1 -
Documentation/CodingGuidelines | 2 +-
Makefile | 6 +++---
bin-wrappers/.gitignore | 9 +++++++++
wrap-for-bin.sh => bin-wrappers/wrap-for-bin.sh | 0
contrib/buildsystems/CMakeLists.txt | 6 +++---
6 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/.gitignore b/.gitignore
index d3be460040c6120d862a25dff1abd325b93b37fd..e82aa19df03fc865eaa0468f12b734cec0c48a2c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,7 +12,6 @@
/GIT-TEST-SUITES
/GIT-USER-AGENT
/GIT-VERSION-FILE
-/bin-wrappers/
/git
/git-add
/git-am
diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
index 87904791cbcea6e57d0fb3c7d4e27f2b0d80b95f..1df9d0c42f1ee7b16ecd7abc22d2653dbf9bae2e 100644
--- a/Documentation/CodingGuidelines
+++ b/Documentation/CodingGuidelines
@@ -583,7 +583,7 @@ For C programs:
Run `GIT_DEBUGGER=1 ./bin-wrappers/git foo` to simply use gdb as is, or
run `GIT_DEBUGGER="<debugger> <debugger-args>" ./bin-wrappers/git foo` to
use your own debugger and arguments. Example: `GIT_DEBUGGER="ddd --gdb"
- ./bin-wrappers/git log` (See `wrap-for-bin.sh`.)
+ ./bin-wrappers/git log` (See `bin-wrappers/wrap-for-bin.sh`.)
- The primary data structure that a subsystem 'S' deals with is called
`struct S`. Functions that operate on `struct S` are named
diff --git a/Makefile b/Makefile
index d9a0025b30db24cb035f19812f0071fe0642386b..056234e0bc0722ebc9f5d6ccae97f98fc9a64a37 100644
--- a/Makefile
+++ b/Makefile
@@ -3200,8 +3200,7 @@ test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $(
all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PROG)
-bin-wrappers/%: wrap-for-bin.sh
- $(call mkdir_p_parent_template)
+$(test_bindir_programs): bin-wrappers/%: bin-wrappers/wrap-for-bin.sh
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@BUILD_DIR@|$(shell pwd)|' \
-e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
@@ -3697,7 +3696,8 @@ clean: profile-clean coverage-clean cocciclean
$(RM) $(FUZZ_PROGRAMS)
$(RM) $(SP_OBJ)
$(RM) $(HCC)
- $(RM) -r bin-wrappers $(dep_dirs) $(compdb_dir) compile_commands.json
+ $(RM) -r $(dep_dirs) $(compdb_dir) compile_commands.json
+ $(RM) $(test_bindir_programs)
$(RM) -r po/build/
$(RM) *.pyc *.pyo */*.pyc */*.pyo $(GENERATED_H) $(ETAGS_TARGET) tags cscope*
$(RM) -r .dist-tmp-dir .doc-tmp-dir
diff --git a/bin-wrappers/.gitignore b/bin-wrappers/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..1c6c90458b758641d0311e812563b32dd4656b48
--- /dev/null
+++ b/bin-wrappers/.gitignore
@@ -0,0 +1,9 @@
+/git
+/git-cvsserver
+/git-receive-pack
+/git-shell
+/git-upload-archive
+/git-upload-pack
+/scalar
+/test-fake-ssh
+/test-tool
diff --git a/wrap-for-bin.sh b/bin-wrappers/wrap-for-bin.sh
old mode 100644
new mode 100755
similarity index 100%
rename from wrap-for-bin.sh
rename to bin-wrappers/wrap-for-bin.sh
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index be1ce1f37a775c366098717047cd7579cd81015d..6fc4f051400db00761232d0aaf1bc88634022b5b 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -1080,20 +1080,20 @@ set(wrapper_test_scripts
foreach(script ${wrapper_scripts})
- file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
+ file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
string(REPLACE "@PROG@" "${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
foreach(script ${wrapper_test_scripts})
- file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
+ file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
string(REPLACE "@PROG@" "t/helper/${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
-file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
+file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
string(REPLACE "@PROG@" "git-cvsserver" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})
--
2.47.0.251.gb31fb630c0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH RFC v7 14/22] Makefile: simplify building of templates
2024-11-15 7:21 ` [PATCH RFC v7 00/22] " Patrick Steinhardt
` (12 preceding siblings ...)
2024-11-15 7:21 ` [PATCH RFC v7 13/22] Makefile: allow "bin-wrappers/" directory to exist Patrick Steinhardt
@ 2024-11-15 7:21 ` Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 15/22] Documentation: allow sourcing generated includes from separate dir Patrick Steinhardt
` (9 subsequent siblings)
23 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-15 7:21 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
When we install Git we also install a set of default templates that both
git-init(1) and git-clone(1) populate into our build directories. The
way the pristine templates are laid out in our source directory is
somewhat weird though: instead of reconstructing the actual directory
hierarchy in "templates/", we represent directory separators with "--".
The only reason I could come up with for why we have this is the
"branches/" directory, which is supposed to be empty when installing it.
And as Git famously doesn't store empty directories at all we have to
work around this limitation.
Now the thing is that the "branches/" directory is a leftover to how
branches used to be stored in the dark ages. gitrepository-layout(5)
lists this directory as "slightly deprecated", which I would claim is a
strong understatement. I have never encountered anybody using it today
and would be surprised if it even works as expected. So having the "--"
hack in place for an item that is basically unused, unmaintained and
deprecated doesn't only feel unreasonable, but installing that entry by
default may also cause confusion for users that do not know what this is
supposed to be in the first place.
Remove this directory from our templates and, now that we do not require
the workaround anymore, restructure the templates to form a proper
hierarchy. This makes it way easier for build systems to install these
templates into place.
We should likely think about removing support for "branch/" altogether,
but that is outside of the scope of this patch series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
contrib/buildsystems/CMakeLists.txt | 34 +++++++------------
templates/Makefile | 39 ++++++++++++++--------
templates/branches-- | 1 -
templates/{this--description => description} | 0
.../applypatch-msg.sample} | 0
.../commit-msg.sample} | 0
.../fsmonitor-watchman.sample} | 0
.../post-update.sample} | 0
.../pre-applypatch.sample} | 0
.../pre-commit.sample} | 0
.../pre-merge-commit.sample} | 0
.../pre-push.sample} | 0
.../pre-rebase.sample} | 0
.../pre-receive.sample} | 0
.../prepare-commit-msg.sample} | 0
.../push-to-checkout.sample} | 0
.../sendemail-validate.sample} | 0
.../{hooks--update.sample => hooks/update.sample} | 0
templates/{info--exclude => info/exclude} | 0
19 files changed, 37 insertions(+), 37 deletions(-)
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 6fc4f051400db00761232d0aaf1bc88634022b5b..852b841601642402fb47489fba07445435e27930 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -99,8 +99,8 @@ project(git
#TODO Enable NLS on windows natively
#macros for parsing the Makefile for sources and scripts
-macro(parse_makefile_for_sources list_var regex)
- file(STRINGS ${CMAKE_SOURCE_DIR}/Makefile ${list_var} REGEX "^${regex} \\+=(.*)")
+macro(parse_makefile_for_sources list_var makefile regex)
+ file(STRINGS ${makefile} ${list_var} REGEX "^${regex} \\+=(.*)")
string(REPLACE "${regex} +=" "" ${list_var} ${${list_var}})
string(REPLACE "$(COMPAT_OBJS)" "" ${list_var} ${${list_var}}) #remove "$(COMPAT_OBJS)" This is only for libgit.
string(STRIP ${${list_var}} ${list_var}) #remove trailing/leading whitespaces
@@ -662,7 +662,7 @@ include_directories(${CMAKE_BINARY_DIR})
#build
#libgit
-parse_makefile_for_sources(libgit_SOURCES "LIB_OBJS")
+parse_makefile_for_sources(libgit_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "LIB_OBJS")
list(TRANSFORM libgit_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
list(TRANSFORM compat_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
@@ -680,13 +680,13 @@ list(APPEND libgit_SOURCES "${CMAKE_BINARY_DIR}/version-def.h")
add_library(libgit ${libgit_SOURCES} ${compat_SOURCES})
#libxdiff
-parse_makefile_for_sources(libxdiff_SOURCES "XDIFF_OBJS")
+parse_makefile_for_sources(libxdiff_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "XDIFF_OBJS")
list(TRANSFORM libxdiff_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
add_library(xdiff STATIC ${libxdiff_SOURCES})
#reftable
-parse_makefile_for_sources(reftable_SOURCES "REFTABLE_OBJS")
+parse_makefile_for_sources(reftable_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "REFTABLE_OBJS")
list(TRANSFORM reftable_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
add_library(reftable STATIC ${reftable_SOURCES})
@@ -757,7 +757,7 @@ elseif(UNIX)
endif()
#git
-parse_makefile_for_sources(git_SOURCES "BUILTIN_OBJS")
+parse_makefile_for_sources(git_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "BUILTIN_OBJS")
list(TRANSFORM git_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
add_executable(git ${CMAKE_SOURCE_DIR}/git.c ${git_SOURCES})
@@ -905,24 +905,14 @@ file(STRINGS ${CMAKE_SOURCE_DIR}/git-p4.py content NEWLINE_CONSUME)
string(REPLACE "#!/usr/bin/env python" "#!/usr/bin/python" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/git-p4 ${content})
-#templates
-file(GLOB templates "${CMAKE_SOURCE_DIR}/templates/*")
-list(TRANSFORM templates REPLACE "${CMAKE_SOURCE_DIR}/templates/" "")
-list(REMOVE_ITEM templates ".gitignore")
-list(REMOVE_ITEM templates "Makefile")
-list(REMOVE_ITEM templates "blt")# Prevents an error when reconfiguring for in source builds
-
-list(REMOVE_ITEM templates "branches--")
-file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/templates/blt/branches) #create branches
-
+#${CMAKE_SOURCE_DIR}/Makefile templates
+parse_makefile_for_sources(templates ${CMAKE_SOURCE_DIR}/templates/Makefile "TEMPLATES")
+string(REPLACE " " ";" templates ${templates})
#templates have @.*@ replacement so use configure_file instead
foreach(tm ${templates})
- string(REPLACE "--" "/" blt_tm ${tm})
- string(REPLACE "this" "" blt_tm ${blt_tm})# for this--
- configure_file(${CMAKE_SOURCE_DIR}/templates/${tm} ${CMAKE_BINARY_DIR}/templates/blt/${blt_tm} @ONLY)
+ configure_file(${CMAKE_SOURCE_DIR}/templates/${tm} ${CMAKE_BINARY_DIR}/templates/blt/${tm} @ONLY)
endforeach()
-
#translations
if(MSGFMT_EXE)
file(GLOB po_files "${CMAKE_SOURCE_DIR}/po/*.po")
@@ -996,7 +986,7 @@ add_executable(test-fake-ssh ${CMAKE_SOURCE_DIR}/t/helper/test-fake-ssh.c)
target_link_libraries(test-fake-ssh common-main)
#unit-tests
-parse_makefile_for_sources(unit-test_SOURCES "UNIT_TEST_OBJS")
+parse_makefile_for_sources(unit-test_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "UNIT_TEST_OBJS")
list(TRANSFORM unit-test_SOURCES REPLACE "\\$\\(UNIT_TEST_DIR\\)/" "${CMAKE_SOURCE_DIR}/t/unit-tests/")
add_library(unit-test-lib STATIC ${unit-test_SOURCES})
@@ -1054,7 +1044,7 @@ if(MSVC)
endif()
#test-tool
-parse_makefile_for_sources(test-tool_SOURCES "TEST_BUILTINS_OBJS")
+parse_makefile_for_sources(test-tool_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "TEST_BUILTINS_OBJS")
add_library(test-lib OBJECT ${CMAKE_SOURCE_DIR}/t/unit-tests/test-lib.c)
list(TRANSFORM test-tool_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/t/helper/")
diff --git a/templates/Makefile b/templates/Makefile
index 367ad00c24cb34c0668eb5236dc3b08a477a65b7..bd1e9e30c120032b209fb1d221b9d93eea31c649 100644
--- a/templates/Makefile
+++ b/templates/Makefile
@@ -29,24 +29,35 @@ all: boilerplates.made custom
# in a file direc--tory--file in the source. They will be
# just copied to the destination.
-bpsrc = $(filter-out %~,$(wildcard *--*))
-boilerplates.made : $(bpsrc)
- $(QUIET)umask 022 && ls *--* 2>/dev/null | \
- while read boilerplate; \
+TEMPLATES =
+TEMPLATES += description
+TEMPLATES += hooks/applypatch-msg.sample
+TEMPLATES += hooks/commit-msg.sample
+TEMPLATES += hooks/fsmonitor-watchman.sample
+TEMPLATES += hooks/post-update.sample
+TEMPLATES += hooks/pre-applypatch.sample
+TEMPLATES += hooks/pre-commit.sample
+TEMPLATES += hooks/pre-merge-commit.sample
+TEMPLATES += hooks/prepare-commit-msg.sample
+TEMPLATES += hooks/pre-push.sample
+TEMPLATES += hooks/pre-rebase.sample
+TEMPLATES += hooks/pre-receive.sample
+TEMPLATES += hooks/push-to-checkout.sample
+TEMPLATES += hooks/sendemail-validate.sample
+TEMPLATES += hooks/update.sample
+TEMPLATES += info/exclude
+
+boilerplates.made: $(TEMPLATES)
+ $(QUIET)umask 022 && for template in $(TEMPLATES); \
do \
- case "$$boilerplate" in *~) continue ;; esac && \
- dst=`echo "$$boilerplate" | sed -e 's|^this|.|;s|--|/|g'` && \
- dir=`expr "$$dst" : '\(.*\)/'` && \
+ dir=$$(dirname "$$template") && \
mkdir -p blt/$$dir && \
- case "$$boilerplate" in \
- *--) continue;; \
- esac && \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
- -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' $$boilerplate > \
- blt/$$dst && \
- if test -x "$$boilerplate"; then rx=rx; else rx=r; fi && \
- chmod a+$$rx "blt/$$dst" || exit; \
+ -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' $$template > \
+ blt/$$template && \
+ if test -x "$$template"; then rx=rx; else rx=r; fi && \
+ chmod a+$$rx "blt/$$template" || exit; \
done && \
date >$@
diff --git a/templates/branches-- b/templates/branches--
deleted file mode 100644
index fae88709a636f3a06cc813dd64b28bfee7fa2073..0000000000000000000000000000000000000000
--- a/templates/branches--
+++ /dev/null
@@ -1 +0,0 @@
-: this is just to ensure the directory exists.
diff --git a/templates/this--description b/templates/description
similarity index 100%
rename from templates/this--description
rename to templates/description
diff --git a/templates/hooks--applypatch-msg.sample b/templates/hooks/applypatch-msg.sample
similarity index 100%
rename from templates/hooks--applypatch-msg.sample
rename to templates/hooks/applypatch-msg.sample
diff --git a/templates/hooks--commit-msg.sample b/templates/hooks/commit-msg.sample
similarity index 100%
rename from templates/hooks--commit-msg.sample
rename to templates/hooks/commit-msg.sample
diff --git a/templates/hooks--fsmonitor-watchman.sample b/templates/hooks/fsmonitor-watchman.sample
similarity index 100%
rename from templates/hooks--fsmonitor-watchman.sample
rename to templates/hooks/fsmonitor-watchman.sample
diff --git a/templates/hooks--post-update.sample b/templates/hooks/post-update.sample
similarity index 100%
rename from templates/hooks--post-update.sample
rename to templates/hooks/post-update.sample
diff --git a/templates/hooks--pre-applypatch.sample b/templates/hooks/pre-applypatch.sample
similarity index 100%
rename from templates/hooks--pre-applypatch.sample
rename to templates/hooks/pre-applypatch.sample
diff --git a/templates/hooks--pre-commit.sample b/templates/hooks/pre-commit.sample
similarity index 100%
rename from templates/hooks--pre-commit.sample
rename to templates/hooks/pre-commit.sample
diff --git a/templates/hooks--pre-merge-commit.sample b/templates/hooks/pre-merge-commit.sample
similarity index 100%
rename from templates/hooks--pre-merge-commit.sample
rename to templates/hooks/pre-merge-commit.sample
diff --git a/templates/hooks--pre-push.sample b/templates/hooks/pre-push.sample
similarity index 100%
rename from templates/hooks--pre-push.sample
rename to templates/hooks/pre-push.sample
diff --git a/templates/hooks--pre-rebase.sample b/templates/hooks/pre-rebase.sample
similarity index 100%
rename from templates/hooks--pre-rebase.sample
rename to templates/hooks/pre-rebase.sample
diff --git a/templates/hooks--pre-receive.sample b/templates/hooks/pre-receive.sample
similarity index 100%
rename from templates/hooks--pre-receive.sample
rename to templates/hooks/pre-receive.sample
diff --git a/templates/hooks--prepare-commit-msg.sample b/templates/hooks/prepare-commit-msg.sample
similarity index 100%
rename from templates/hooks--prepare-commit-msg.sample
rename to templates/hooks/prepare-commit-msg.sample
diff --git a/templates/hooks--push-to-checkout.sample b/templates/hooks/push-to-checkout.sample
similarity index 100%
rename from templates/hooks--push-to-checkout.sample
rename to templates/hooks/push-to-checkout.sample
diff --git a/templates/hooks--sendemail-validate.sample b/templates/hooks/sendemail-validate.sample
similarity index 100%
rename from templates/hooks--sendemail-validate.sample
rename to templates/hooks/sendemail-validate.sample
diff --git a/templates/hooks--update.sample b/templates/hooks/update.sample
similarity index 100%
rename from templates/hooks--update.sample
rename to templates/hooks/update.sample
diff --git a/templates/info--exclude b/templates/info/exclude
similarity index 100%
rename from templates/info--exclude
rename to templates/info/exclude
--
2.47.0.251.gb31fb630c0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH RFC v7 15/22] Documentation: allow sourcing generated includes from separate dir
2024-11-15 7:21 ` [PATCH RFC v7 00/22] " Patrick Steinhardt
` (13 preceding siblings ...)
2024-11-15 7:21 ` [PATCH RFC v7 14/22] Makefile: simplify building of templates Patrick Steinhardt
@ 2024-11-15 7:21 ` Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 16/22] Documentation: teach "cmd-list.perl" about out-of-tree builds Patrick Steinhardt
` (8 subsequent siblings)
23 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-15 7:21 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
Our documentation uses "include::" directives to include parts that are
either reused across multiple documents or parts that we generate at
build time. Unfortunately, top-level includes are only ever resolved
relative to the base directory, which is typically the directory of the
including document. Most importantly, it is not possible to have either
asciidoc or asciidoctor search multiple directories.
It follows that both kinds of includes must live in the same directory.
This is of course a bummer for out-of-tree builds, because here the
dynamically-built includes live in the build directory whereas the
static includes live in the source directory.
Introduce a `build_dir` attribute and prepend it to all of our includes
for dynamically-built files. This attribute gets set to the build
directory and thus converts the include path to an absolute path, which
asciidoc and asciidoctor know how to resolve.
Note that this change also requires us to update "build-docdep.perl",
which tries to figure out included files such our Makefile can set up
proper build-time dependencies. This script simply scans through the
source files for any lines that match "^include::" and treats the
remainder of the line as included file path. But given that those may
now contain the "{build_dir}" variable we have to teach the script to
replace that attribute with the actual build directory.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Documentation/Makefile | 3 ++-
Documentation/build-docdep.perl | 2 ++
Documentation/config/diff.txt | 2 +-
Documentation/config/merge.txt | 2 +-
Documentation/git.txt | 24 ++++++++++++------------
5 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 0f55baa252fffbcd506f0c6f410b26b37f2e9b11..75755ceec189836813e01fa43bae69bdd2083f3e 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -218,6 +218,7 @@ SHELL_PATH ?= $(SHELL)
# Shell quote;
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
+ASCIIDOC_EXTRA += -abuild_dir='$(shell pwd)'
ifdef DEFAULT_PAGER
DEFAULT_PAGER_SQ = $(subst ','\'',$(DEFAULT_PAGER))
ASCIIDOC_EXTRA += -a 'git-default-pager=$(DEFAULT_PAGER_SQ)'
@@ -283,7 +284,7 @@ docdep_prereqs = \
cmd-list.made $(cmds_txt)
doc.dep : $(docdep_prereqs) $(DOC_DEP_TXT) build-docdep.perl
- $(QUIET_GEN)$(PERL_PATH) ./build-docdep.perl >$@ $(QUIET_STDERR)
+ $(QUIET_GEN)$(PERL_PATH) ./build-docdep.perl "$(shell pwd)" >$@ $(QUIET_STDERR)
ifneq ($(MAKECMDGOALS),clean)
-include doc.dep
diff --git a/Documentation/build-docdep.perl b/Documentation/build-docdep.perl
index 1b3ac8fdd95fa1d57afbdffb1a9743f36ed22fdd..315efaa2fa2f2efc89b2c8073cc97cd2cc83611c 100755
--- a/Documentation/build-docdep.perl
+++ b/Documentation/build-docdep.perl
@@ -1,5 +1,6 @@
#!/usr/bin/perl
+my ($build_dir) = @ARGV;
my %include = ();
my %included = ();
@@ -10,6 +11,7 @@
chomp;
s/^include::\s*//;
s/\[\]//;
+ s/{build_dir}/${build_dir}/;
$include{$text}{$_} = 1;
$included{$_} = 1;
}
diff --git a/Documentation/config/diff.txt b/Documentation/config/diff.txt
index 190bda17e51c57a00b25bf98afa038b8a89e4ea5..9575af91fa53d3f67925d31e77b81222e737fc3a 100644
--- a/Documentation/config/diff.txt
+++ b/Documentation/config/diff.txt
@@ -206,7 +206,7 @@ diff.<driver>.cachetextconv::
Set this option to true to make the diff driver cache the text
conversion outputs. See linkgit:gitattributes[5] for details.
-include::../mergetools-diff.txt[]
+include::{build_dir}/mergetools-diff.txt[]
diff.indentHeuristic::
Set this option to `false` to disable the default heuristics
diff --git a/Documentation/config/merge.txt b/Documentation/config/merge.txt
index 8851b6cedef980c106b9e86541862b517aa1f2ad..82554d65a0aa0826fdb53c5d834389d38f308e3e 100644
--- a/Documentation/config/merge.txt
+++ b/Documentation/config/merge.txt
@@ -101,7 +101,7 @@ merge.guitool::
Any other value is treated as a custom merge tool and requires that a
corresponding mergetool.<guitool>.cmd variable is defined.
-include::../mergetools-merge.txt[]
+include::{build_dir}/mergetools-merge.txt[]
merge.verbosity::
Controls the amount of output shown by the recursive merge
diff --git a/Documentation/git.txt b/Documentation/git.txt
index d15a8697625d6b6c598a2bc774bf243675ab68ea..44f0797ccffb1a7359bee9c20182953293b70d6d 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -245,17 +245,17 @@ ancillary user utilities.
Main porcelain commands
~~~~~~~~~~~~~~~~~~~~~~~
-include::cmds-mainporcelain.txt[]
+include::{build_dir}/cmds-mainporcelain.txt[]
Ancillary Commands
~~~~~~~~~~~~~~~~~~
Manipulators:
-include::cmds-ancillarymanipulators.txt[]
+include::{build_dir}/cmds-ancillarymanipulators.txt[]
Interrogators:
-include::cmds-ancillaryinterrogators.txt[]
+include::{build_dir}/cmds-ancillaryinterrogators.txt[]
Interacting with Others
@@ -264,7 +264,7 @@ Interacting with Others
These commands are to interact with foreign SCM and with other
people via patch over e-mail.
-include::cmds-foreignscminterface.txt[]
+include::{build_dir}/cmds-foreignscminterface.txt[]
Reset, restore and revert
~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -313,13 +313,13 @@ repositories.
Manipulation commands
~~~~~~~~~~~~~~~~~~~~~
-include::cmds-plumbingmanipulators.txt[]
+include::{build_dir}/cmds-plumbingmanipulators.txt[]
Interrogation commands
~~~~~~~~~~~~~~~~~~~~~~
-include::cmds-plumbinginterrogators.txt[]
+include::{build_dir}/cmds-plumbinginterrogators.txt[]
In general, the interrogate commands do not touch the files in
the working tree.
@@ -328,12 +328,12 @@ the working tree.
Syncing repositories
~~~~~~~~~~~~~~~~~~~~
-include::cmds-synchingrepositories.txt[]
+include::{build_dir}/cmds-synchingrepositories.txt[]
The following are helper commands used by the above; end users
typically do not use them directly.
-include::cmds-synchelpers.txt[]
+include::{build_dir}/cmds-synchelpers.txt[]
Internal helper commands
@@ -342,14 +342,14 @@ Internal helper commands
These are internal helper commands used by other commands; end
users typically do not use them directly.
-include::cmds-purehelpers.txt[]
+include::{build_dir}/cmds-purehelpers.txt[]
Guides
------
The following documentation pages are guides about Git concepts.
-include::cmds-guide.txt[]
+include::{build_dir}/cmds-guide.txt[]
Repository, command and file interfaces
---------------------------------------
@@ -358,7 +358,7 @@ This documentation discusses repository and command interfaces which
users are expected to interact with directly. See `--user-formats` in
linkgit:git-help[1] for more details on the criteria.
-include::cmds-userinterfaces.txt[]
+include::{build_dir}/cmds-userinterfaces.txt[]
File formats, protocols and other developer interfaces
------------------------------------------------------
@@ -367,7 +367,7 @@ This documentation discusses file formats, over-the-wire protocols and
other git developer interfaces. See `--developer-interfaces` in
linkgit:git-help[1].
-include::cmds-developerinterfaces.txt[]
+include::{build_dir}/cmds-developerinterfaces.txt[]
Configuration Mechanism
-----------------------
--
2.47.0.251.gb31fb630c0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH RFC v7 16/22] Documentation: teach "cmd-list.perl" about out-of-tree builds
2024-11-15 7:21 ` [PATCH RFC v7 00/22] " Patrick Steinhardt
` (14 preceding siblings ...)
2024-11-15 7:21 ` [PATCH RFC v7 15/22] Documentation: allow sourcing generated includes from separate dir Patrick Steinhardt
@ 2024-11-15 7:21 ` Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 17/22] Documentation: extract script to generate a list of mergetools Patrick Steinhardt
` (7 subsequent siblings)
23 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-15 7:21 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
The "cmd-list.perl" script generates a list of commands that can be
included into our manpages. The script doesn't know about out-of-tree
builds and instead writes resulting files into the source directory.
Adapt it such that we can read data from the source directory and write
data into the build directory.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Documentation/Makefile | 2 +-
Documentation/cmd-list.perl | 23 ++++++++++++-----------
2 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 75755ceec189836813e01fa43bae69bdd2083f3e..2b9fd37ff7021f3d44eaa282b942c623f403510a 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -306,7 +306,7 @@ cmds_txt = cmds-ancillaryinterrogators.txt \
$(cmds_txt): cmd-list.made
cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
- $(QUIET_GEN)$(PERL_PATH) ./cmd-list.perl ../command-list.txt $(cmds_txt) $(QUIET_STDERR) && \
+ $(QUIET_GEN)$(PERL_PATH) ./cmd-list.perl .. . $(cmds_txt) && \
date >$@
mergetools_txt = mergetools-diff.txt mergetools-merge.txt
diff --git a/Documentation/cmd-list.perl b/Documentation/cmd-list.perl
index 755a110bc48d7e2b596651ca13664c01192d966c..e260a989774071b66d2b56c56c5045b84a508c5c 100755
--- a/Documentation/cmd-list.perl
+++ b/Documentation/cmd-list.perl
@@ -3,12 +3,13 @@
use File::Compare qw(compare);
sub format_one {
- my ($out, $nameattr) = @_;
+ my ($source_dir, $out, $nameattr) = @_;
my ($name, $attr) = @$nameattr;
+ my ($path) = "$source_dir/Documentation/$name.txt";
my ($state, $description);
my $mansection;
$state = 0;
- open I, '<', "$name.txt" or die "No such file $name.txt";
+ open I, '<', "$path" or die "No such file $path.txt";
while (<I>) {
if (/^(?:git|scalar)[a-z0-9-]*\(([0-9])\)$/) {
$mansection = $1;
@@ -29,7 +30,7 @@ sub format_one {
}
close I;
if (!defined $description) {
- die "No description found in $name.txt";
+ die "No description found in $path.txt";
}
if (my ($verify_name, $text) = ($description =~ /^($name) - (.*)/)) {
print $out "linkgit:$name\[$mansection\]::\n\t";
@@ -43,9 +44,9 @@ sub format_one {
}
}
-my ($input, @categories) = @ARGV;
+my ($source_dir, $build_dir, @categories) = @ARGV;
-open IN, "<$input";
+open IN, "<$source_dir/command-list.txt";
while (<IN>) {
last if /^### command list/;
}
@@ -63,17 +64,17 @@ sub format_one {
for my $out (@categories) {
my ($cat) = $out =~ /^cmds-(.*)\.txt$/;
- open O, '>', "$out+" or die "Cannot open output file $out+";
+ my ($path) = "$build_dir/$out";
+ open O, '>', "$path+" or die "Cannot open output file $out+";
for (@{$cmds{$cat}}) {
- format_one(\*O, $_);
+ format_one($source_dir, \*O, $_);
}
close O;
- if (-f "$out" && compare("$out", "$out+") == 0) {
- unlink "$out+";
+ if (-f "$path" && compare("$path", "$path+") == 0) {
+ unlink "$path+";
}
else {
- print STDERR "$out\n";
- rename "$out+", "$out";
+ rename "$path+", "$path";
}
}
--
2.47.0.251.gb31fb630c0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH RFC v7 17/22] Documentation: extract script to generate a list of mergetools
2024-11-15 7:21 ` [PATCH RFC v7 00/22] " Patrick Steinhardt
` (15 preceding siblings ...)
2024-11-15 7:21 ` [PATCH RFC v7 16/22] Documentation: teach "cmd-list.perl" about out-of-tree builds Patrick Steinhardt
@ 2024-11-15 7:21 ` Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 18/22] t: better support for out-of-tree builds Patrick Steinhardt
` (6 subsequent siblings)
23 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-15 7:21 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
We include the list of available mergetools into our manpages. Extract
the script that performs this logic such that we can reuse it in other
build systems.
While at it, refactor the Makefile targets such that we don't create
"mergetools-list.made" anymore. It shouldn't be necessary, as we can
instead have other targets depend on "mergetools-{diff,merge}.txt"
directly.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Documentation/Makefile | 22 ++++++++--------------
Documentation/generate-mergetool-list.sh | 17 +++++++++++++++++
2 files changed, 25 insertions(+), 14 deletions(-)
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 2b9fd37ff7021f3d44eaa282b942c623f403510a..e2ce98a751f090af8a8c095e7b138ef601e9c0be 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -276,11 +276,13 @@ ifneq ($(filter-out lint-docs clean,$(MAKECMDGOALS)),)
-include ../GIT-VERSION-FILE
endif
+mergetools_txt = mergetools-diff.txt mergetools-merge.txt
+
#
# Determine "include::" file references in asciidoc files.
#
docdep_prereqs = \
- mergetools-list.made $(mergetools_txt) \
+ $(mergetools_txt) \
cmd-list.made $(cmds_txt)
doc.dep : $(docdep_prereqs) $(DOC_DEP_TXT) build-docdep.perl
@@ -309,19 +311,11 @@ cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
$(QUIET_GEN)$(PERL_PATH) ./cmd-list.perl .. . $(cmds_txt) && \
date >$@
-mergetools_txt = mergetools-diff.txt mergetools-merge.txt
-
-$(mergetools_txt): mergetools-list.made
-
-mergetools-list.made: ../git-mergetool--lib.sh $(wildcard ../mergetools/*)
- $(QUIET_GEN) \
- $(SHELL_PATH) -c 'MERGE_TOOLS_DIR=../mergetools && TOOL_MODE=diff && \
- . ../git-mergetool--lib.sh && \
- show_tool_names can_diff' | sed -e "s/\([a-z0-9]*\)/\`\1\`;;/" >mergetools-diff.txt && \
- $(SHELL_PATH) -c 'MERGE_TOOLS_DIR=../mergetools && TOOL_MODE=merge && \
- . ../git-mergetool--lib.sh && \
- show_tool_names can_merge' | sed -e "s/\([a-z0-9]*\)/\`\1\`;;/" >mergetools-merge.txt && \
- date >$@
+mergetools-%.txt: generate-mergetool-list.sh ../git-mergetool--lib.sh $(wildcard ../mergetools/*)
+mergetools-diff.txt:
+ $(QUIET_GEN)$(SHELL_PATH) ./generate-mergetool-list.sh .. diff $@
+mergetools-merge.txt:
+ $(QUIET_GEN)$(SHELL_PATH) ./generate-mergetool-list.sh .. merge $@
TRACK_ASCIIDOCFLAGS = $(subst ','\'',$(ASCIIDOC_COMMON):$(ASCIIDOC_HTML):$(ASCIIDOC_DOCBOOK))
diff --git a/Documentation/generate-mergetool-list.sh b/Documentation/generate-mergetool-list.sh
new file mode 100755
index 0000000000000000000000000000000000000000..696196fbcb86084abffc1d29355705a37b1532b3
--- /dev/null
+++ b/Documentation/generate-mergetool-list.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+if test "$#" -ne 3
+then
+ echo "USAGE: $0 <SOURCE_DIR> <MODE> <OUTPUT>" >&2
+ exit 1
+fi
+
+SOURCE_DIR="$1"
+TOOL_MODE="$2"
+OUTPUT="$3"
+MERGE_TOOLS_DIR="$SOURCE_DIR/mergetools"
+
+(
+ . "$SOURCE_DIR"/git-mergetool--lib.sh &&
+ show_tool_names can_$TOOL_MODE
+) | sed -e "s/\([a-z0-9]*\)/\`\1\`;;/" >"$OUTPUT"
--
2.47.0.251.gb31fb630c0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH RFC v7 18/22] t: better support for out-of-tree builds
2024-11-15 7:21 ` [PATCH RFC v7 00/22] " Patrick Steinhardt
` (16 preceding siblings ...)
2024-11-15 7:21 ` [PATCH RFC v7 17/22] Documentation: extract script to generate a list of mergetools Patrick Steinhardt
@ 2024-11-15 7:21 ` Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 19/22] t: allow overriding build dir Patrick Steinhardt
` (5 subsequent siblings)
23 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-15 7:21 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
Our in-tree builds used by the Makefile use various different build
directories scattered around different locations. The paths to those
build directories have to be propagated to our tests such that they can
find the contained files. This is done via a mixture of hardcoded paths
in our test library and injected variables in our bin-wrappers or
"GIT-BUILD-OPTIONS".
The latter two mechanisms are preferable over using hardcoded paths. For
one, we have all paths which are subject to change stored in a small set
of central files instead of having the knowledge of build paths in many
files. And second, it allows build systems which build files elsewhere
to adapt those paths based on their own needs. This is especially nice
in the context of build systems that use out-of-tree builds like CMake
or Meson.
Remove hardcoded knowledge of build paths from our test library and move
it into our bin-wrappers and "GIT-BUILD-OPTIONS".
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-BUILD-OPTIONS.in | 5 +++++
Makefile | 9 +++++++++
bin-wrappers/wrap-for-bin.sh | 11 ++++++-----
contrib/buildsystems/CMakeLists.txt | 8 ++++++++
t/lib-gettext.sh | 4 ++--
t/t7609-mergetool--lib.sh | 2 +-
t/test-lib.sh | 6 +++---
7 files changed, 34 insertions(+), 11 deletions(-)
diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in
index 9b95a6b3eee334b6f691702696ca9d92201b6bac..f651116102ae2977622dccd12b199fe7ad65af99 100644
--- a/GIT-BUILD-OPTIONS.in
+++ b/GIT-BUILD-OPTIONS.in
@@ -35,6 +35,11 @@ GIT_PERF_MAKE_COMMAND=@GIT_PERF_MAKE_COMMAND@
GIT_INTEROP_MAKE_OPTS=@GIT_INTEROP_MAKE_OPTS@
GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@
GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@
+GIT_TEST_TEXTDOMAINDIR=@GIT_TEST_TEXTDOMAINDIR@
+GIT_TEST_POPATH=@GIT_TEST_POPATH@
+GIT_TEST_TEMPLATE_DIR=@GIT_TEST_TEMPLATE_DIR@
+GIT_TEST_GITPERLLIB=@GIT_TEST_GITPERLLIB@
+GIT_TEST_MERGE_TOOLS_DIR=@GIT_TEST_MERGE_TOOLS_DIR@
RUNTIME_PREFIX=@RUNTIME_PREFIX@
GITWEBDIR=@GITWEBDIR@
USE_GETTEXT_SCHEME=@USE_GETTEXT_SCHEME@
diff --git a/Makefile b/Makefile
index 056234e0bc0722ebc9f5d6ccae97f98fc9a64a37..26845907657ae7d87530dc8d3f51761127afa95f 100644
--- a/Makefile
+++ b/Makefile
@@ -3174,6 +3174,11 @@ GIT-BUILD-OPTIONS: FORCE
-e "s|@GIT_INTEROP_MAKE_OPTS@|\'$(GIT_INTEROP_MAKE_OPTS)\'|" \
-e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \
-e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \
+ -e "s|@GIT_TEST_TEXTDOMAINDIR@|\'$(shell pwd)/po/build/locale\'|" \
+ -e "s|@GIT_TEST_POPATH@|\'$(shell pwd)/po\'|" \
+ -e "s|@GIT_TEST_TEMPLATE_DIR@|\'$(shell pwd)/templates/blt\'|" \
+ -e "s|@GIT_TEST_GITPERLLIB@|\'$(shell pwd)/perl/build/lib\'|" \
+ -e "s|@GIT_TEST_MERGE_TOOLS_DIR@|\'$(shell pwd)/mergetools\'|" \
-e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX)\'|" \
-e "s|@GITWEBDIR@|\'$(gitwebdir_SQ)\'|" \
-e "s|@USE_GETTEXT_SCHEME@|\'$(USE_GETTEXT_SCHEME)\'|" \
@@ -3203,6 +3208,10 @@ all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PR
$(test_bindir_programs): bin-wrappers/%: bin-wrappers/wrap-for-bin.sh
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@BUILD_DIR@|$(shell pwd)|' \
+ -e 's|@GIT_TEXTDOMAINDIR@|$(shell pwd)/po/build/locale|' \
+ -e 's|@GITPERLLIB@|$(shell pwd)/perl/build/lib|' \
+ -e 's|@MERGE_TOOLS_DIR@|$(shell pwd)/mergetools|' \
+ -e 's|@TEMPLATE_DIR@|$(shell pwd)/templates/blt|' \
-e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
chmod +x $@
diff --git a/bin-wrappers/wrap-for-bin.sh b/bin-wrappers/wrap-for-bin.sh
index 7898a1c238dde20617cf96d144930dc59f67feab..1d3a59a0081e1fc6066af187093cb1d11d01a929 100755
--- a/bin-wrappers/wrap-for-bin.sh
+++ b/bin-wrappers/wrap-for-bin.sh
@@ -4,21 +4,22 @@
# to run test suite against sandbox, but with only bindir-installed
# executables in PATH. The Makefile copies this into various
# files in bin-wrappers, substituting
-# @BUILD_DIR@ and @PROG@.
+# @BUILD_DIR@, @TEMPLATE_DIR@ and @PROG@.
GIT_EXEC_PATH='@BUILD_DIR@'
if test -n "$NO_SET_GIT_TEMPLATE_DIR"
then
unset GIT_TEMPLATE_DIR
else
- GIT_TEMPLATE_DIR='@BUILD_DIR@/templates/blt'
+ GIT_TEMPLATE_DIR='@TEMPLATE_DIR@'
export GIT_TEMPLATE_DIR
fi
-GITPERLLIB='@BUILD_DIR@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}"
-GIT_TEXTDOMAINDIR='@BUILD_DIR@/po/build/locale'
+MERGE_TOOLS_DIR='@MERGE_TOOLS_DIR@'
+GITPERLLIB='@GITPERLLIB@'"${GITPERLLIB:+:$GITPERLLIB}"
+GIT_TEXTDOMAINDIR='@GIT_TEXTDOMAINDIR@'
PATH='@BUILD_DIR@/bin-wrappers:'"$PATH"
-export GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
+export MERGE_TOOLS_DIR GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
case "$GIT_DEBUGGER" in
'')
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 852b841601642402fb47489fba07445435e27930..25d8452cc29ecf2ee21172bc8a31f57801908ba7 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -1085,6 +1085,9 @@ endforeach()
file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+string(REPLACE "@GIT_TEXTDOMAINDIR@" "${CMAKE_BINARY_DIR}/po/build/locale" content "${content}")
+string(REPLACE "@GITPERLLIB@" "${CMAKE_BINARY_DIR}/perl/build/lib" content "${content}")
+string(REPLACE "@MERGE_TOOLS_DIR@" "${CMAKE_SOURCE_DIR}/mergetools" content "${content}")
string(REPLACE "@PROG@" "git-cvsserver" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})
@@ -1170,6 +1173,11 @@ string(REPLACE "@GIT_PERF_MAKE_COMMAND@" "" git_build_options "${git_build_optio
string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_options}")
string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}")
string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_TEXTDOMAINDIR@" "'${CMAKE_BINARY_DIR}/po/build/locale'" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_POPATH@" "'${CMAKE_BINARY_DIR}/po'" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_TEMPLATE_DIR@" "'${CMAKE_BINARY_DIR}/templates/blt'" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_GITPERLLIB@" "'${CMAKE_BINARY_DIR}/perl/build/lib'" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_MERGE_TOOLS_DIR@" "'${RUNTIME_PREFIX}'" git_build_options "${git_build_options}")
string(REPLACE "@RUNTIME_PREFIX@" "'${RUNTIME_PREFIX}'" git_build_options "${git_build_options}")
string(REPLACE "@GITWEBDIR@" "'${GITWEBDIR}'" git_build_options "${git_build_options}")
string(REPLACE "@USE_GETTEXT_SCHEME@" "" git_build_options "${git_build_options}")
diff --git a/t/lib-gettext.sh b/t/lib-gettext.sh
index cc6bb2cdeaae7b5bb23211c0d9c37c9deb39e14f..7a734c6973e65995d3403a26cc9e5c1a5a1ce074 100644
--- a/t/lib-gettext.sh
+++ b/t/lib-gettext.sh
@@ -6,8 +6,8 @@
. ./test-lib.sh
-GIT_TEXTDOMAINDIR="$GIT_BUILD_DIR/po/build/locale"
-GIT_PO_PATH="$GIT_BUILD_DIR/po"
+GIT_TEXTDOMAINDIR="$GIT_TEST_TEXTDOMAINDIR"
+GIT_PO_PATH="$GIT_TEST_POPATH"
export GIT_TEXTDOMAINDIR GIT_PO_PATH
if test -n "$GIT_TEST_INSTALLED"
diff --git a/t/t7609-mergetool--lib.sh b/t/t7609-mergetool--lib.sh
index 8b1c3bd39f2249417099ea2f24218268925909af..a9273ba58d76333c74d0072794ed0d95b966f16f 100755
--- a/t/t7609-mergetool--lib.sh
+++ b/t/t7609-mergetool--lib.sh
@@ -8,7 +8,7 @@ TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'mergetool --tool=vimdiff creates the expected layout' '
- . "$GIT_BUILD_DIR"/mergetools/vimdiff &&
+ . "$GIT_TEST_MERGE_TOOLS_DIR"/vimdiff &&
run_unit_tests
'
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 19057faa73925f619750fec30f05c3e5a1ba05ac..ceb926c4258db853eeb50b2259a7f521501cf719 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1487,7 +1487,7 @@ else # normal case, use ../bin-wrappers only unless $with_dashes:
PATH="$GIT_BUILD_DIR:$GIT_BUILD_DIR/t/helper:$PATH"
fi
fi
-GIT_TEMPLATE_DIR="$GIT_BUILD_DIR"/templates/blt
+GIT_TEMPLATE_DIR="$GIT_TEST_TEMPLATE_DIR"
GIT_CONFIG_NOSYSTEM=1
GIT_ATTR_NOSYSTEM=1
GIT_CEILING_DIRECTORIES="$TRASH_DIRECTORY/.."
@@ -1503,9 +1503,9 @@ then
fi
fi
-GITPERLLIB="$GIT_BUILD_DIR"/perl/build/lib
+GITPERLLIB="$GIT_TEST_GITPERLLIB"
export GITPERLLIB
-test -d "$GIT_BUILD_DIR"/templates/blt || {
+test -d "$GIT_TEMPLATE_DIR" || {
BAIL_OUT "You haven't built things yet, have you?"
}
--
2.47.0.251.gb31fb630c0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH RFC v7 19/22] t: allow overriding build dir
2024-11-15 7:21 ` [PATCH RFC v7 00/22] " Patrick Steinhardt
` (17 preceding siblings ...)
2024-11-15 7:21 ` [PATCH RFC v7 18/22] t: better support for out-of-tree builds Patrick Steinhardt
@ 2024-11-15 7:21 ` Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 20/22] Documentation: add comparison of build systems Patrick Steinhardt
` (4 subsequent siblings)
23 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-15 7:21 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
Our "test-lib.sh" assumes that our build directory is the parent
directory of "t/". While true when using our Makefile, it's not when
using build systems that support out-of-tree builds.
In commit ee9e66e4e7 (cmake: avoid editing t/test-lib.sh, 2022-10-18),
we have introduce support for overriding the GIT_BUILD_DIR by creating
the file "$GIT_BUILD_DIR/GIT-BUILD-DIR" with its contents pointing to
the location of the build directory. The intent was to stop modifying
"t/test-lib.sh" with the CMake build systems while allowing out-of-tree
builds. But "$GIT_BUILD_DIR" is somewhat misleadingly named, as it in
fact points to the _source_ directory. So while that commit solved part
of the problem for out-of-tree builds, CMake still has to write files
into the source tree.
Solve the second part of the problem, namely not having to write any
data into the source directory at all, by also supporting an environment
variable that allows us to point to a different build directory. This
allows us to perform properly self-contained out-of-tree builds.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
t/test-lib.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index ceb926c4258db853eeb50b2259a7f521501cf719..cce0069287af48a607bc24fa474006a47014ea49 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -35,7 +35,7 @@ else
# needing to exist.
TEST_DIRECTORY=$(cd "$TEST_DIRECTORY" && pwd) || exit 1
fi
-GIT_BUILD_DIR="${TEST_DIRECTORY%/t}"
+GIT_BUILD_DIR="${GIT_BUILD_DIR:-${TEST_DIRECTORY%/t}}"
if test "$TEST_DIRECTORY" = "$GIT_BUILD_DIR"
then
echo "PANIC: Running in a $TEST_DIRECTORY that doesn't end in '/t'?" >&2
@@ -522,6 +522,7 @@ unset VISUAL EMAIL LANGUAGE $("$PERL_PATH" -e '
PERF_
CURL_VERBOSE
TRACE_CURL
+ BUILD_DIR
));
my @vars = grep(/^GIT_/ && !/^GIT_($ok)/o, @env);
print join("\n", @vars);
--
2.47.0.251.gb31fb630c0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH RFC v7 20/22] Documentation: add comparison of build systems
2024-11-15 7:21 ` [PATCH RFC v7 00/22] " Patrick Steinhardt
` (18 preceding siblings ...)
2024-11-15 7:21 ` [PATCH RFC v7 19/22] t: allow overriding build dir Patrick Steinhardt
@ 2024-11-15 7:21 ` Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 21/22] Introduce support for the Meson build system Patrick Steinhardt
` (3 subsequent siblings)
23 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-15 7:21 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
We're contemplating whether to eventually replace our build systems with
a build system that is easier to use. Add a comparison of build systems
to our technical documentation as a baseline for discussion.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Documentation/Makefile | 1 +
Documentation/technical/build-systems.txt | 224 ++++++++++++++++++++++++++++++
2 files changed, 225 insertions(+)
diff --git a/Documentation/Makefile b/Documentation/Makefile
index e2ce98a751f090af8a8c095e7b138ef601e9c0be..e1527c6d4429efdd2341163ef895a13ddeae8e2f 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -111,6 +111,7 @@ TECH_DOCS += MyFirstObjectWalk
TECH_DOCS += SubmittingPatches
TECH_DOCS += ToolsForGit
TECH_DOCS += technical/bitmap-format
+TECH_DOCS += technical/build-systems
TECH_DOCS += technical/bundle-uri
TECH_DOCS += technical/hash-function-transition
TECH_DOCS += technical/long-running-process-protocol
diff --git a/Documentation/technical/build-systems.txt b/Documentation/technical/build-systems.txt
new file mode 100644
index 0000000000000000000000000000000000000000..d9dafb407c40902756ca0bde9d9dad8ced8788dd
--- /dev/null
+++ b/Documentation/technical/build-systems.txt
@@ -0,0 +1,224 @@
+= Build Systems
+
+The build system is the primary way for both developers and system integrators
+to interact with the Git project. As such, being easy to use and extend for
+those who are not directly developing Git itself is just as important as other
+requirements we have on any potential build system.
+
+This document outlines the different requirements that we have for the build
+system and then compares available build systems using these criteria.
+
+== Requirements
+
+The following subsections present a list of requirements that we have for any
+potential build system. Sections are sorted by decreasing priority.
+
+=== Platform support
+
+The build system must have support for all of our platforms that we continually
+test against as outlined by our platform support policy. These platforms are:
+
+ - Linux
+ - Windows
+ - macOS
+
+Furthermore, the build system should have support for the following platforms
+that generally have somebody running test pipelines against regularly:
+
+ - AIX
+ - FreeBSD
+ - NetBSD
+ - NonStop
+ - OpenBSD
+
+The platforms which must be supported by the tool should be aligned with our
+[platform support policy](platform-support.txt).
+
+=== Auto-detection of supported features
+
+The build system must support auto-detection of features which are or aren't
+available on the current platform. Platform maintainers should not be required
+to manually configure the complete build.
+
+Auto-detection of the following items is considered to be important:
+
+ - Check for the existence of headers.
+ - Check for the existence of libraries.
+ - Check for the existence of exectuables.
+ - Check for the runtime behavior of specific functions.
+ - Check for specific link order requirements when multiple libraries are
+ involved.
+
+=== Ease of use
+
+The build system should be both easy to use and easy to extend. While this is
+naturally a subjective metric it is likely not controversial to say that some
+build systems are considerably harder to use than others.
+
+=== IDE support
+
+The build system should integrate with well-known IDEs. Well-known IDEs include:
+
+ - Microsoft Visual Studio
+ - Visual Studio Code
+ - Xcode
+
+There are four levels of support:
+
+ - Native integration into the IDE.
+ - Integration into the IDE via a plugin.
+ - Integration into the IDE via generating a project description with the build
+ system.
+ - No integration.
+
+Native integration is preferable, but integration via either a plugin or by
+generating a project description via the build system are considered feasible
+alternatives.
+
+Another important distinction is the level of integration. There are two
+features that one generally wants to have:
+
+ - Integration of build targets.
+ - Automatic setup of features like code completion with detected build
+ dependencies.
+
+The first bullet point is the bare minimum, but is not sufficient to be
+considered proper integration.
+
+=== Out-of-tree builds
+
+The build system should support out-of-tree builds. Out-of-tree builds allow a
+developer to configure multiple different build directories with different
+configuration, e.g. one "debug" build and one "release" build.
+
+=== Cross-platform builds
+
+The build system should support cross-platform builds, e.g. building for arm on
+an x86-64 host.
+
+=== Language support
+
+The following languages and toolchains are of relevance and should be supported
+by the build system:
+
+ - C: the primary compiled language used by Git, must be supported. Relevant
+ toolchains are GCC, Clang and MSVC.
+ - Rust: candidate as a second compiled lanugage, should be supported. Relevant
+ toolchains is the LLVM-based rustc.
+
+Built-in support for the respective languages is preferred over support that
+needs to be wired up manually to avoid unnecessary complexity. Native support
+includes the following features:
+
+ - Compiling objects.
+ - Dependency tracking.
+ - Detection of available features.
+ - Discovery of relevant toolchains.
+ - Linking libraries and executables.
+ - Templating placeholders in scripts.
+
+=== Test integration
+
+It should be possible to integrate tests into the build system such that it is
+possible to build and test Git within the build system. Features which are nice
+to have:
+
+ - Track build-time dependencies for respective tests. Unit tests have
+ different requirements than integration tests.
+ - Allow filtering of which tests to run.
+ - Allow running tests such that utilities like `test_pause` or `debug` work.
+
+== Comparison
+
+The following list of build systems are considered:
+
+- GNU Make
+- autoconf
+- CMake
+- Meson
+
+=== GNU Make
+
+- Platform support: ubitquitous on all platforms, but not well-integrated into Windows.
+- Auto-detection: no built-in support for auto-detection of features.
+- Ease of use: easy to use, but discovering available options is hard. Makefile
+ rules can quickly get out of hand once reaching a certain scope.
+- IDE support: execution of Makefile targets is supported by many IDEs
+- Out-of-tree builds: supported in theory, not wired up in practice.
+- Cross-platform builds: supported in theory, not wired up in practice.
+- Language support:
+ - C: Limited built-in support, many parts need to be wired up manually.
+ - Rust: No built-in support, needs to be wired up manually.
+- Test integration: partially supported, many parts need to be wired up
+ manually.
+
+=== autoconf
+
+- Platform support: ubiquitous on all platforms, but not well-integrated into Windows.
+- Auto-detection: supported.
+- Ease of use: easy to use, discovering available options is comparatively
+ easy. The autoconf syntax is prohibitively hard to extend though due to its
+ complex set of interacting files and the hard-to-understand M4 language.
+- IDE support: no integration into IDEs at generation time. The generated
+ Makefiles have the same level of support as GNU Make.
+- Out-of-tree builds: supported in theory, not wired up in practice.
+- Cross-platform builds: supported.
+- Language support:
+ - C: Limited built-in support, many parts need to be wired up manually.
+ - Rust: No built-in support, needs to be wired up manually.
+- Test integration: partially supported, many parts need to be wired up
+ manually.
+
+=== CMake
+
+- Platform support: not as extensive as GNU Make or autoconf, but all major
+ platforms are supported.
+ - AIX
+ - Cygwin
+ - FreeBSD
+ - Linux
+ - OpenBSD
+ - Solaris
+ - Windows
+ - macOS
+- Ease of use: easy to use, discovering available options is not always
+ trivial. The scripting language used by CMake is somewhat cumbersome to use,
+ but extending CMake build instructions is doable.
+- IDE support: natively integrated into Microsoft Visual Studio. Can generate
+ project descriptions for Xcode. An extension is available for Visual Studio
+ Code. Many other IDEs have plugins for CMake.
+- Out-of-tree builds: supported.
+- Cross-platform builds: supported.
+- Language support:
+ - C: Supported for GCC, Clang, MSVC and other toolchains.
+ - Rust: No built-in support, needs to be wired up manually.
+- Test integration: supported, even though test dependencies are a bit
+ cumbersome to use via "test fixtures". Interactive test runs are not
+ supported.
+
+=== Meson
+
+- Platform: not as extensive as GNU Make or autoconf, but all major platforms
+ and some smaller ones are supported.
+ - AIX
+ - Cygwin
+ - DragonflyBSD
+ - FreeBSD
+ - Haiku
+ - Linux
+ - NetBSD
+ - OpenBSD
+ - Solaris
+ - Windows
+ - macOS
+- Ease of use: easy to use, discovering available options is easy. The
+ scripting language is straight-forward to use.
+- IDE support: Supports generating build instructions for Xcode and Microsoft
+ Visual Studio, a plugin exists for Visual Studio Code.
+- Out-of-tree builds: supported.
+- Cross-platform builds: supported.
+- Language support:
+ - C: Supported for GCC, Clang, MSVC and other toolchains.
+ - Rust: Supported for rustc.
+- Test integration: supported. Interactive tests are supported starting with
+ Meson 1.5.0 via the `--interactive` flag.
--
2.47.0.251.gb31fb630c0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH RFC v7 21/22] Introduce support for the Meson build system
2024-11-15 7:21 ` [PATCH RFC v7 00/22] " Patrick Steinhardt
` (19 preceding siblings ...)
2024-11-15 7:21 ` [PATCH RFC v7 20/22] Documentation: add comparison of build systems Patrick Steinhardt
@ 2024-11-15 7:21 ` Patrick Steinhardt
2024-11-15 12:20 ` Christian Couder
2024-11-15 7:21 ` [PATCH RFC v7 22/22] meson: fix conflicts with in-flight topics Patrick Steinhardt
` (2 subsequent siblings)
23 siblings, 1 reply; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-15 7:21 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
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>
---
Documentation/meson.build | 317 ++++++
bin-wrappers/meson.build | 28 +
contrib/completion/meson.build | 8 +
contrib/meson.build | 1 +
gitweb/meson.build | 79 ++
meson.build | 1852 ++++++++++++++++++++++++++++++++++++
meson_options.txt | 83 ++
perl/FromCPAN/Mail/meson.build | 7 +
perl/FromCPAN/meson.build | 9 +
perl/Git/LoadCPAN/Mail/meson.build | 7 +
perl/Git/LoadCPAN/meson.build | 9 +
perl/Git/SVN/Memoize/meson.build | 7 +
perl/Git/SVN/meson.build | 20 +
perl/Git/meson.build | 18 +
perl/meson.build | 12 +
po/meson.build | 27 +
subprojects/.gitignore | 1 +
subprojects/curl.wrap | 13 +
subprojects/expat.wrap | 13 +
subprojects/openssl.wrap | 15 +
subprojects/pcre2.wrap | 16 +
subprojects/zlib.wrap | 13 +
t/helper/meson.build | 91 ++
t/meson.build | 1106 +++++++++++++++++++++
templates/hooks/meson.build | 26 +
templates/info/meson.build | 7 +
templates/meson.build | 15 +
27 files changed, 3800 insertions(+)
diff --git a/Documentation/meson.build b/Documentation/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..15ba5004ad43188fc9ff9b85148278b20c03bf6f
--- /dev/null
+++ b/Documentation/meson.build
@@ -0,0 +1,317 @@
+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')
+
+git_revdate = ''
+if git.found()
+ git_revdate = run_command(git, 'show', '--quiet', '--pretty=%as', check: false).stdout().strip()
+endif
+
+asciidoc_common_options = [
+ asciidoc,
+ '--conf-file=' + meson.current_source_dir() / 'asciidoc.conf',
+ '--attribute=manual=Git Manual',
+ '--attribute=mansource=Git ' + git_version,
+ '--attribute=revdate=' + git_revdate,
+ '--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 = [ ]
+
+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
diff --git a/bin-wrappers/meson.build b/bin-wrappers/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..6d03a19d7b8e3cf78ac0499b6cedf47e0c6cb441
--- /dev/null
+++ b/bin-wrappers/meson.build
@@ -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', fs.relative_to(executable.full_path(), meson.project_build_root()))
+
+ configure_file(
+ input: 'wrap-for-bin.sh',
+ output: fs.stem(executable.full_path()),
+ configuration: executable_config,
+ )
+endforeach
diff --git a/contrib/completion/meson.build b/contrib/completion/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..a9bfe2da312ac9764367b656bd8a4099b575ad72
--- /dev/null
+++ b/contrib/completion/meson.build
@@ -0,0 +1,8 @@
+foreach script : [
+ 'git-completion.bash',
+ 'git-completion.tcsh',
+ 'git-completion.zsh',
+ 'git-prompt.sh'
+]
+ test_dependencies += fs.copyfile(script)
+endforeach
diff --git a/contrib/meson.build b/contrib/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..a7b77b87c22c8f1d8a86faaafc2b647b94651db8
--- /dev/null
+++ b/contrib/meson.build
@@ -0,0 +1 @@
+subdir('completion')
diff --git a/gitweb/meson.build b/gitweb/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..ef868bd7dbcbcb5b69c2e73fc40c374435205c9c
--- /dev/null
+++ b/gitweb/meson.build
@@ -0,0 +1,79 @@
+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',
+]
+ fs.copyfile(asset,
+ install: true,
+ install_dir: get_option('datadir') / 'gitweb' / fs.parent(asset),
+ )
+endforeach
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..17974eafdd86d9c1b6696868f1497b71caa165a3
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,1852 @@
+# Meson build system
+# ==================
+#
+# The Meson build system is an alternative to our Makefile that you can use to
+# build, test and install Git. Using Meson results in a couple of benefits:
+#
+# - Out-of-tree builds.
+# - Better integration into IDEs.
+# - Easy-to-use autoconfiguration of available features on your system.
+#
+# To use Meson from the command line you need to have both Meson and Ninja
+# installed. Alternatively, if you do not have Python available on your system,
+# you can also use Muon instead of Meson and Samurai instead of Ninja, both of
+# which are drop-ins replacement that only depend on C.
+#
+# Basic usage
+# ===========
+#
+# In the most trivial case, you can configure, build and install Git like this:
+#
+# 1. Set up the build directory. This only needs to happen once per build
+# directory you want to have. You can also configure multiple different
+# build directories with different configurations.
+#
+# $ meson setup build/
+#
+# The build directory gets ignored by Git automatically as Meson will write
+# a ".gitignore" file into it. From hereon, we will assume that you execute
+# commands inside this build directory.
+#
+# 2. Compile Git. You can either use Meson, Ninja or Samurai to do this, so all
+# of the following invocations are equivalent:
+#
+# $ meson compile
+# $ ninja
+# $ samu
+#
+# The different invocations should ultimately not make much of a difference.
+# Using Meson also works with other generators though, like when the build
+# directory has been set up for use with Microsoft Visual Studio.
+#
+# 3. Execute tests. Again, you can either use Meson, Ninja or Samurai to do this:
+#
+# $ meson test
+# $ ninja test
+# $ samu test
+#
+# It is recommended to use Meson in this case though as it also provides you
+# additional features that the other build systems don't have available.
+# You can e.g. pass additional arguments to the test executables or run
+# individual tests:
+#
+# # Execute the t0000-basic integration test and t-reftable-stack unit test.
+# $ meson test t0000-basic t-reftable-stack
+#
+# # Execute all reftable unit tests.
+# $ meson test t-reftable-*
+#
+# # Execute all tests and stop with the first failure.
+# $ meson test --maxfail 1
+#
+# # Execute single test interactively such that features like `debug ()` work.
+# $ meson test -i --test-args='-ix' t1400-update-ref
+#
+# 4. Install the Git distribution. Again, this can be done via Meson, Ninja or
+# Samurai:
+#
+# $ meson install
+# $ ninja install
+# $ samu install
+#
+# The prefix into which Git shall be installed is defined when setting up
+# the build directory. More on that in the "Configuration" section.
+#
+# Meson supports multiple backends. The default backend generates Ninja build
+# instructions, but it also supports the generation of Microsoft Visual
+# Studio solutions as well as Xcode projects. IDEs like Eclipse and Visual
+# Studio Code provide plugins to import Meson files directly.
+#
+# Configuration
+# =============
+#
+# The exact configuration of Git is determined when setting up the build
+# directory via `meson setup`. Unless told otherwise, Meson will automatically
+# detect the availability of various bits and pieces. There are two different
+# kinds of options that can be used to further tweak the build:
+#
+# - Built-in options provided by Meson.
+#
+# - Options defined by the project in the "meson_options.txt" file.
+#
+# Both kinds of options can be inspected by running `meson configure` in the
+# build directory, which will give you a list of the current value for all
+# options.
+#
+# Options can be configured either when setting up the build directory or can
+# be changed in preexisting build directories:
+#
+# # Set up a new build directory with optimized settings that will be
+# # installed into an alternative prefix.
+# $ meson setup --buildtype release --optimization 3 --strip --prefix=/home/$USER build
+#
+# # Set up a new build directory with a higher warning level. Level 2 is
+# # mostly equivalent to setting DEVELOPER=1, level 3 and "everything"
+# # will enable even more warnings.
+# $ meson setup -Dwarning_level=2
+#
+# # Set up a new build directory with 'address' and 'undefined' sanitizers
+# # using Clang.
+# $ CC=clang meson setup -Db_sanitize=address,undefined build
+#
+# # Disable tests in a preexisting build directory.
+# $ meson configure -Dtests=false
+#
+# # Disable features based on Python
+# $ meson configure -Dpython=disabled
+#
+# Options have a type like booleans, choices, strings or features. Features are
+# somewhat special as they can have one of three values: enabled, disabled or
+# auto. While the first two values are self-explanatory, "auto" will enable or
+# disable the feature based on the availability of prerequisites to support it.
+# Python-based features for example will be enabled automatically when a Python
+# interpreter could be found. The default value of such features can be changed
+# globally via `meson setup --auto-features={enabled,disabled,auto}`, which
+# will set the value of all features with a value of "auto" to the provided one
+# by default.
+#
+# It is also possible to store a set of configuration options in machine files.
+# This can be useful in case you regularly want to reuse the same set of options:
+#
+# [binaries]
+# c = ['clang']
+# ar = ['ar']
+#
+# [project options]
+# gettext = 'disabled'
+# default_editor = 'vim'
+#
+# [built-in options]
+# b_lto = true
+# b_sanitize = 'address,undefined'
+#
+# These machine files can be passed to Meson via `meson setup --native-file`.
+#
+# Subproject wrappers
+# ===================
+#
+# Subproject wrappers are a feature provided by Meson that allow the automatic
+# fallback to a "wrapped" dependency in case the dependency is not provided by
+# the system. For example if the system is lacking curl, then Meson will use
+# "subprojects/curl.wrap" to set up curl as a subproject and compile and link
+# the dependency into Git itself. This is especially helpful on systems like
+# Windows, where you typically don't have such dependencies installed.
+#
+# The use of subproject wrappers can be disabled by executing `meson setup
+# --wrap-mode nofallback`.
+
+project('git', 'c',
+ meson_version: '>=1.3.0',
+ # MSVC does not support GNU99, and C99 does not define __STDC_VERSION__
+ # on MSVC. So we instead fall back to C11 there.
+ default_options: ['c_std=gnu99,c11'],
+ version: 'v2.47.GIT',
+)
+
+fs = import('fs')
+
+program_path = []
+# Git for Windows provides all the tools we need to build Git.
+if host_machine.system() == 'windows'
+ program_path += [ 'C:/Program Files/Git/bin', 'C:/Program Files/Git/usr/bin' ]
+endif
+
+awk = find_program('awk', dirs: program_path)
+cygpath = find_program('cygpath', dirs: program_path, required: false)
+diff = find_program('diff', dirs: program_path)
+shell = find_program('sh', dirs: program_path)
+tar = find_program('tar', dirs: program_path)
+
+script_environment = environment()
+foreach tool : ['cat', 'cut', 'git', 'grep', 'sed', 'sort', 'tr', 'uname']
+ program = find_program(tool, dirs: program_path)
+ script_environment.prepend('PATH', fs.parent(program.full_path()))
+endforeach
+
+compiler = meson.get_compiler('c')
+
+libgit_sources = [
+ 'abspath.c',
+ 'add-interactive.c',
+ 'add-patch.c',
+ 'advice.c',
+ 'alias.c',
+ 'alloc.c',
+ 'apply.c',
+ 'archive-tar.c',
+ 'archive-zip.c',
+ 'archive.c',
+ 'attr.c',
+ 'base85.c',
+ 'bisect.c',
+ 'blame.c',
+ 'blob.c',
+ 'bloom.c',
+ 'branch.c',
+ 'bulk-checkin.c',
+ 'bundle-uri.c',
+ 'bundle.c',
+ 'cache-tree.c',
+ 'cbtree.c',
+ 'chdir-notify.c',
+ 'checkout.c',
+ 'chunk-format.c',
+ 'color.c',
+ 'column.c',
+ 'combine-diff.c',
+ 'commit-graph.c',
+ 'commit-reach.c',
+ 'commit.c',
+ 'compat/nonblock.c',
+ 'compat/obstack.c',
+ 'compat/terminal.c',
+ 'compat/zlib-uncompress2.c',
+ 'config.c',
+ 'connect.c',
+ 'connected.c',
+ 'convert.c',
+ 'copy.c',
+ 'credential.c',
+ 'csum-file.c',
+ 'ctype.c',
+ 'date.c',
+ 'decorate.c',
+ 'delta-islands.c',
+ 'diagnose.c',
+ 'diff-delta.c',
+ 'diff-merges.c',
+ 'diff-lib.c',
+ 'diff-no-index.c',
+ 'diff.c',
+ 'diffcore-break.c',
+ 'diffcore-delta.c',
+ 'diffcore-order.c',
+ 'diffcore-pickaxe.c',
+ 'diffcore-rename.c',
+ 'diffcore-rotate.c',
+ 'dir-iterator.c',
+ 'dir.c',
+ 'editor.c',
+ 'entry.c',
+ 'environment.c',
+ 'ewah/bitmap.c',
+ 'ewah/ewah_bitmap.c',
+ 'ewah/ewah_io.c',
+ 'ewah/ewah_rlw.c',
+ 'exec-cmd.c',
+ 'fetch-negotiator.c',
+ 'fetch-pack.c',
+ 'fmt-merge-msg.c',
+ 'fsck.c',
+ 'fsmonitor.c',
+ 'fsmonitor-ipc.c',
+ 'fsmonitor-settings.c',
+ 'gettext.c',
+ 'git-zlib.c',
+ 'gpg-interface.c',
+ 'graph.c',
+ 'grep.c',
+ 'hash-lookup.c',
+ 'hashmap.c',
+ 'help.c',
+ 'hex.c',
+ 'hex-ll.c',
+ 'hook.c',
+ 'ident.c',
+ 'json-writer.c',
+ 'kwset.c',
+ 'levenshtein.c',
+ 'line-log.c',
+ 'line-range.c',
+ 'linear-assignment.c',
+ 'list-objects-filter-options.c',
+ 'list-objects-filter.c',
+ 'list-objects.c',
+ 'lockfile.c',
+ 'log-tree.c',
+ 'loose.c',
+ 'ls-refs.c',
+ 'mailinfo.c',
+ 'mailmap.c',
+ 'match-trees.c',
+ 'mem-pool.c',
+ 'merge-blobs.c',
+ 'merge-ll.c',
+ 'merge-ort.c',
+ 'merge-ort-wrappers.c',
+ 'merge-recursive.c',
+ 'merge.c',
+ 'midx.c',
+ 'midx-write.c',
+ 'name-hash.c',
+ 'negotiator/default.c',
+ 'negotiator/noop.c',
+ 'negotiator/skipping.c',
+ 'notes-cache.c',
+ 'notes-merge.c',
+ 'notes-utils.c',
+ 'notes.c',
+ 'object-file-convert.c',
+ 'object-file.c',
+ 'object-name.c',
+ 'object.c',
+ 'oid-array.c',
+ 'oidmap.c',
+ 'oidset.c',
+ 'oidtree.c',
+ 'pack-bitmap-write.c',
+ 'pack-bitmap.c',
+ 'pack-check.c',
+ 'pack-mtimes.c',
+ 'pack-objects.c',
+ 'pack-revindex.c',
+ 'pack-write.c',
+ 'packfile.c',
+ 'pager.c',
+ 'parallel-checkout.c',
+ 'parse.c',
+ 'parse-options-cb.c',
+ 'parse-options.c',
+ 'patch-delta.c',
+ 'patch-ids.c',
+ 'path.c',
+ 'pathspec.c',
+ 'pkt-line.c',
+ 'preload-index.c',
+ 'pretty.c',
+ 'prio-queue.c',
+ 'progress.c',
+ 'promisor-remote.c',
+ 'prompt.c',
+ 'protocol.c',
+ 'protocol-caps.c',
+ 'prune-packed.c',
+ 'pseudo-merge.c',
+ 'quote.c',
+ 'range-diff.c',
+ 'reachable.c',
+ 'read-cache.c',
+ 'rebase-interactive.c',
+ 'rebase.c',
+ 'ref-filter.c',
+ 'reflog-walk.c',
+ 'reflog.c',
+ 'refs.c',
+ 'refs/debug.c',
+ 'refs/files-backend.c',
+ 'refs/reftable-backend.c',
+ 'refs/iterator.c',
+ 'refs/packed-backend.c',
+ 'refs/ref-cache.c',
+ 'refspec.c',
+ 'reftable/basics.c',
+ 'reftable/error.c',
+ 'reftable/block.c',
+ 'reftable/blocksource.c',
+ 'reftable/iter.c',
+ 'reftable/merged.c',
+ 'reftable/pq.c',
+ 'reftable/reader.c',
+ 'reftable/record.c',
+ 'reftable/stack.c',
+ 'reftable/tree.c',
+ 'reftable/writer.c',
+ 'remote.c',
+ 'replace-object.c',
+ 'repo-settings.c',
+ 'repository.c',
+ 'rerere.c',
+ 'reset.c',
+ 'resolve-undo.c',
+ 'revision.c',
+ 'run-command.c',
+ 'send-pack.c',
+ 'sequencer.c',
+ 'serve.c',
+ 'server-info.c',
+ 'setup.c',
+ 'shallow.c',
+ 'sideband.c',
+ 'sigchain.c',
+ 'sparse-index.c',
+ 'split-index.c',
+ 'stable-qsort.c',
+ 'statinfo.c',
+ 'strbuf.c',
+ 'streaming.c',
+ 'string-list.c',
+ 'strmap.c',
+ 'strvec.c',
+ 'sub-process.c',
+ 'submodule-config.c',
+ 'submodule.c',
+ 'symlinks.c',
+ 'tag.c',
+ 'tempfile.c',
+ 'thread-utils.c',
+ 'tmp-objdir.c',
+ 'trace.c',
+ 'trace2.c',
+ 'trace2/tr2_cfg.c',
+ 'trace2/tr2_cmd_name.c',
+ 'trace2/tr2_ctr.c',
+ 'trace2/tr2_dst.c',
+ 'trace2/tr2_sid.c',
+ 'trace2/tr2_sysenv.c',
+ 'trace2/tr2_tbuf.c',
+ 'trace2/tr2_tgt_event.c',
+ 'trace2/tr2_tgt_normal.c',
+ 'trace2/tr2_tgt_perf.c',
+ 'trace2/tr2_tls.c',
+ 'trace2/tr2_tmr.c',
+ 'trailer.c',
+ 'transport-helper.c',
+ 'transport.c',
+ 'tree-diff.c',
+ 'tree-walk.c',
+ 'tree.c',
+ 'unpack-trees.c',
+ 'upload-pack.c',
+ 'url.c',
+ 'urlmatch.c',
+ 'usage.c',
+ 'userdiff.c',
+ 'utf8.c',
+ 'varint.c',
+ 'versioncmp.c',
+ 'walker.c',
+ 'wildmatch.c',
+ 'worktree.c',
+ 'wrapper.c',
+ 'write-or-die.c',
+ 'ws.c',
+ 'wt-status.c',
+ 'xdiff-interface.c',
+ 'xdiff/xdiffi.c',
+ 'xdiff/xemit.c',
+ 'xdiff/xhistogram.c',
+ 'xdiff/xmerge.c',
+ 'xdiff/xpatience.c',
+ 'xdiff/xprepare.c',
+ 'xdiff/xutils.c',
+]
+
+builtin_sources = [
+ 'builtin/add.c',
+ 'builtin/am.c',
+ 'builtin/annotate.c',
+ 'builtin/apply.c',
+ 'builtin/archive.c',
+ 'builtin/bisect.c',
+ 'builtin/blame.c',
+ 'builtin/branch.c',
+ 'builtin/bugreport.c',
+ 'builtin/bundle.c',
+ 'builtin/cat-file.c',
+ 'builtin/check-attr.c',
+ 'builtin/check-ignore.c',
+ 'builtin/check-mailmap.c',
+ 'builtin/check-ref-format.c',
+ 'builtin/checkout--worker.c',
+ 'builtin/checkout-index.c',
+ 'builtin/checkout.c',
+ 'builtin/clean.c',
+ 'builtin/clone.c',
+ 'builtin/column.c',
+ 'builtin/commit-graph.c',
+ 'builtin/commit-tree.c',
+ 'builtin/commit.c',
+ 'builtin/config.c',
+ 'builtin/count-objects.c',
+ 'builtin/credential-cache--daemon.c',
+ 'builtin/credential-cache.c',
+ 'builtin/credential-store.c',
+ 'builtin/credential.c',
+ 'builtin/describe.c',
+ 'builtin/diagnose.c',
+ 'builtin/diff-files.c',
+ 'builtin/diff-index.c',
+ 'builtin/diff-tree.c',
+ 'builtin/diff.c',
+ 'builtin/difftool.c',
+ 'builtin/fast-export.c',
+ 'builtin/fast-import.c',
+ 'builtin/fetch-pack.c',
+ 'builtin/fetch.c',
+ 'builtin/fmt-merge-msg.c',
+ 'builtin/for-each-ref.c',
+ 'builtin/for-each-repo.c',
+ 'builtin/fsck.c',
+ 'builtin/fsmonitor--daemon.c',
+ 'builtin/gc.c',
+ 'builtin/get-tar-commit-id.c',
+ 'builtin/grep.c',
+ 'builtin/hash-object.c',
+ 'builtin/help.c',
+ 'builtin/hook.c',
+ 'builtin/index-pack.c',
+ 'builtin/init-db.c',
+ 'builtin/interpret-trailers.c',
+ 'builtin/log.c',
+ 'builtin/ls-files.c',
+ 'builtin/ls-remote.c',
+ 'builtin/ls-tree.c',
+ 'builtin/mailinfo.c',
+ 'builtin/mailsplit.c',
+ 'builtin/merge-base.c',
+ 'builtin/merge-file.c',
+ 'builtin/merge-index.c',
+ 'builtin/merge-ours.c',
+ 'builtin/merge-recursive.c',
+ 'builtin/merge-tree.c',
+ 'builtin/merge.c',
+ 'builtin/mktag.c',
+ 'builtin/mktree.c',
+ 'builtin/multi-pack-index.c',
+ 'builtin/mv.c',
+ 'builtin/name-rev.c',
+ 'builtin/notes.c',
+ 'builtin/pack-objects.c',
+ 'builtin/pack-redundant.c',
+ 'builtin/pack-refs.c',
+ 'builtin/patch-id.c',
+ 'builtin/prune-packed.c',
+ 'builtin/prune.c',
+ 'builtin/pull.c',
+ 'builtin/push.c',
+ 'builtin/range-diff.c',
+ 'builtin/read-tree.c',
+ 'builtin/rebase.c',
+ 'builtin/receive-pack.c',
+ 'builtin/reflog.c',
+ 'builtin/refs.c',
+ 'builtin/remote-ext.c',
+ 'builtin/remote-fd.c',
+ 'builtin/remote.c',
+ 'builtin/repack.c',
+ 'builtin/replace.c',
+ 'builtin/replay.c',
+ 'builtin/rerere.c',
+ 'builtin/reset.c',
+ 'builtin/rev-list.c',
+ 'builtin/rev-parse.c',
+ 'builtin/revert.c',
+ 'builtin/rm.c',
+ 'builtin/send-pack.c',
+ 'builtin/shortlog.c',
+ 'builtin/show-branch.c',
+ 'builtin/show-index.c',
+ 'builtin/show-ref.c',
+ 'builtin/sparse-checkout.c',
+ 'builtin/stash.c',
+ 'builtin/stripspace.c',
+ 'builtin/submodule--helper.c',
+ 'builtin/symbolic-ref.c',
+ 'builtin/tag.c',
+ 'builtin/unpack-file.c',
+ 'builtin/unpack-objects.c',
+ 'builtin/update-index.c',
+ 'builtin/update-ref.c',
+ 'builtin/update-server-info.c',
+ 'builtin/upload-archive.c',
+ 'builtin/upload-pack.c',
+ 'builtin/var.c',
+ 'builtin/verify-commit.c',
+ 'builtin/verify-pack.c',
+ 'builtin/verify-tag.c',
+ 'builtin/worktree.c',
+ 'builtin/write-tree.c',
+]
+
+libgit_sources += custom_target(
+ input: 'command-list.txt',
+ output: 'command-list.h',
+ command: [shell, meson.current_source_dir() + '/generate-cmdlist.sh', meson.current_source_dir(), '@OUTPUT@'],
+ env: script_environment,
+)
+
+libgit_sources += custom_target(
+ output: 'config-list.h',
+ command: [
+ shell,
+ meson.current_source_dir() + '/generate-configlist.sh',
+ meson.current_source_dir(),
+ '@OUTPUT@',
+ ],
+ env: script_environment,
+)
+
+libgit_sources += custom_target(
+ input: 'Documentation/githooks.txt',
+ output: 'hook-list.h',
+ command: [
+ shell,
+ meson.current_source_dir() + '/generate-hooklist.sh',
+ meson.current_source_dir(),
+ '@OUTPUT@',
+ ],
+ env: script_environment,
+)
+
+# This contains the variables for GIT-BUILD-OPTIONS, which we use to propagate
+# build options to our tests.
+build_options_config = configuration_data()
+build_options_config.set('GIT_INTEROP_MAKE_OPTS', '')
+build_options_config.set('GIT_PERF_LARGE_REPO', '')
+build_options_config.set('GIT_PERF_MAKE_COMMAND', '')
+build_options_config.set('GIT_PERF_MAKE_OPTS', '')
+build_options_config.set('GIT_PERF_REPEAT_COUNT', '')
+build_options_config.set('GIT_PERF_REPO', '')
+build_options_config.set('GIT_TEST_CMP_USE_COPIED_CONTEXT', '')
+build_options_config.set('GIT_TEST_INDEX_VERSION', '')
+build_options_config.set('GIT_TEST_OPTS', '')
+build_options_config.set('GIT_TEST_PERL_FATAL_WARNINGS', '')
+build_options_config.set('GIT_TEST_UTF8_LOCALE', '')
+build_options_config.set('BROKEN_PATH_FIX', '')
+build_options_config.set_quoted('LOCALEDIR', fs.as_posix(get_option('prefix') / get_option('localedir')))
+build_options_config.set('GITWEBDIR', fs.as_posix(get_option('prefix') / get_option('datadir') / 'gitweb'))
+
+test_output_directory = get_option('test_output_directory')
+if test_output_directory == ''
+ test_output_directory = meson.project_build_root() / 'test-output'
+endif
+
+# These variables are used for building libgit.a.
+libgit_c_args = [
+ '-DBINDIR="' + get_option('bindir') + '"',
+ '-DDEFAULT_EDITOR="' + get_option('default_editor') + '"',
+ '-DDEFAULT_GIT_TEMPLATE_DIR="' + get_option('datadir') / 'git-core/templates' + '"',
+ '-DDEFAULT_HELP_FORMAT="' + get_option('default_help_format') + '"',
+ '-DDEFAULT_PAGER="' + get_option('default_pager') + '"',
+ '-DETC_GITATTRIBUTES="' + get_option('gitattributes') + '"',
+ '-DETC_GITCONFIG="' + get_option('gitconfig') + '"',
+ '-DFALLBACK_RUNTIME_PREFIX="' + get_option('prefix') + '"',
+ '-DGIT_EXEC_PATH="' + get_option('prefix') / get_option('libexecdir') / 'git-core"',
+ '-DGIT_HOST_CPU="' + host_machine.cpu_family() + '"',
+ '-DGIT_HTML_PATH="' + get_option('datadir') / 'doc/git-doc"',
+ '-DGIT_INFO_PATH="' + get_option('infodir') + '"',
+ '-DGIT_LOCALE_PATH="' + get_option('localedir') + '"',
+ '-DGIT_MAN_PATH="' + get_option('mandir') + '"',
+ '-DPAGER_ENV="' + get_option('pager_environment') + '"',
+ '-DSHELL_PATH="' + fs.as_posix(shell.full_path()) + '"',
+]
+libgit_include_directories = [ '.' ]
+libgit_dependencies = [ ]
+
+# Treat any warning level above 1 the same as we treat DEVELOPER=1 in our
+# Makefile.
+if get_option('warning_level') in ['2','3', 'everything'] and compiler.get_argument_syntax() == 'gcc'
+ foreach cflag : [
+ '-Wdeclaration-after-statement',
+ '-Wformat-security',
+ '-Wold-style-definition',
+ '-Woverflow',
+ '-Wpointer-arith',
+ '-Wstrict-prototypes',
+ '-Wunused',
+ '-Wvla',
+ '-Wwrite-strings',
+ '-fno-common',
+ '-Wtautological-constant-out-of-range-compare',
+ # If a function is public, there should be a prototype and the right
+ # header file should be included. If not, it should be static.
+ '-Wmissing-prototypes',
+ # These are disabled because we have these all over the place.
+ '-Wno-empty-body',
+ '-Wno-missing-field-initializers',
+ '-Wno-sign-compare',
+ ]
+ if compiler.has_argument(cflag)
+ libgit_c_args += cflag
+ endif
+ endforeach
+endif
+
+if get_option('b_sanitize').contains('address')
+ build_options_config.set('SANITIZE_ADDRESS', 'YesCompiledWithIt')
+else
+ build_options_config.set('SANITIZE_ADDRESS', '')
+endif
+if get_option('b_sanitize').contains('leak')
+ libgit_c_args += '-DSUPPRESS_ANNOTATED_LEAKS'
+ build_options_config.set('SANITIZE_LEAK', 'YesCompiledWithIt')
+else
+ build_options_config.set('SANITIZE_LEAK', '')
+endif
+if get_option('b_sanitize').contains('undefined')
+ libgit_c_args += '-DSHA1DC_FORCE_ALIGNED_ACCESS'
+endif
+
+executable_suffix = ''
+if host_machine.system() == 'cygwin' or host_machine.system() == 'windows'
+ executable_suffix = '.exe'
+ libgit_c_args += '-DSTRIP_EXTENSION="' + executable_suffix + '"'
+endif
+build_options_config.set_quoted('X', executable_suffix)
+
+python = import('python').find_installation('python3', required: get_option('python'))
+if python.found()
+ build_options_config.set('NO_PYTHON', '')
+else
+ libgit_c_args += '-DNO_PYTHON'
+ build_options_config.set('NO_PYTHON', '1')
+endif
+
+# Perl is used for two different things: our test harness and to provide some
+# features. It is optional if you want to neither execute tests nor use any of
+# these optional features.
+perl_required = get_option('perl')
+if get_option('tests')
+ perl_required = true
+endif
+
+# Note that we only set NO_PERL if the Perl features were disabled by the user.
+# It may not be set when we have found Perl, but only use it to run tests.
+perl = find_program('perl', version: '>=5.8.1', dirs: program_path, required: perl_required)
+perl_features_enabled = perl.found() and get_option('perl').allowed()
+if perl_features_enabled
+ build_options_config.set('NO_PERL', '')
+
+ if get_option('runtime_prefix')
+ build_options_config.set('PERL_LOCALEDIR', '')
+ else
+ build_options_config.set_quoted('PERL_LOCALEDIR', fs.as_posix(get_option('prefix') / get_option('localedir')))
+ endif
+
+ if get_option('perl_cpan_fallback')
+ build_options_config.set('NO_PERL_CPAN_FALLBACKS', '')
+ else
+ build_options_config.set_quoted('NO_PERL_CPAN_FALLBACKS', 'YesPlease')
+ endif
+else
+ libgit_c_args += '-DNO_PERL'
+ build_options_config.set('NO_PERL', '1')
+ build_options_config.set('PERL_LOCALEDIR', '')
+ build_options_config.set('NO_PERL_CPAN_FALLBACKS', '')
+endif
+
+zlib = dependency('zlib', default_options: ['default_library=static', 'tests=disabled'])
+if zlib.version().version_compare('<1.2.0')
+ libgit_c_args += '-DNO_DEFLATE_BOUND'
+endif
+libgit_dependencies += zlib
+
+threads = dependency('threads', required: false)
+if threads.found()
+ libgit_dependencies += threads
+ build_options_config.set('NO_PTHREADS', '')
+else
+ libgit_c_args += '-DNO_PTHREADS'
+ build_options_config.set('NO_PTHREADS', '1')
+endif
+
+msgfmt = find_program('msgfmt', dirs: program_path, required: false)
+gettext_option = get_option('gettext').disable_auto_if(not msgfmt.found())
+if not msgfmt.found() and gettext_option.enabled()
+ error('Internationalization via libintl requires msgfmt')
+endif
+
+if gettext_option.allowed() and host_machine.system() == 'darwin' and get_option('macos_use_homebrew_gettext')
+ if host_machine.cpu_family() == 'x86_64'
+ libintl_prefix = '/usr/local'
+ elif host_machine.cpu_family() == 'aarch64'
+ libintl_prefix = '/opt/homebrew'
+ else
+ error('Homebrew workaround not supported on current architecture')
+ endif
+
+ intl = compiler.find_library('intl', dirs: libintl_prefix / 'lib', required: gettext_option)
+ if intl.found()
+ intl = declare_dependency(
+ dependencies: intl,
+ include_directories: libintl_prefix / 'include',
+ )
+ endif
+else
+ intl = dependency('intl', required: gettext_option)
+endif
+if intl.found()
+ libgit_dependencies += intl
+ build_options_config.set('NO_GETTEXT', '')
+ build_options_config.set('USE_GETTEXT_SCHEME', '')
+else
+ libgit_c_args += '-DNO_GETTEXT'
+ build_options_config.set('NO_GETTEXT', '1')
+ build_options_config.set('USE_GETTEXT_SCHEME', 'fallthrough')
+endif
+
+iconv = dependency('iconv', required: get_option('iconv'))
+if iconv.found()
+ libgit_dependencies += iconv
+ build_options_config.set('NO_ICONV', '')
+
+ have_old_iconv = false
+ if not compiler.compiles('''
+ #include <iconv.h>
+
+ extern size_t iconv(iconv_t cd,
+ char **inbuf, size_t *inbytesleft,
+ char **outbuf, size_t *outbytesleft);
+ ''', name: 'old iconv interface', dependencies: [iconv])
+ libgit_c_args += '-DOLD_ICONV'
+ have_old_iconv = true
+ endif
+
+ iconv_omits_bom_source = '''#
+ #include <iconv.h>
+
+ int main(int argc, const char **argv)
+ {
+ '''
+ if have_old_iconv
+ iconv_omits_bom_source += '''
+ typedef const char *iconv_ibp;
+ '''
+ else
+ iconv_omits_bom_source += '''
+ typedef char *iconv_ibp;
+ '''
+ endif
+ iconv_omits_bom_source += '''
+ int v;
+ iconv_t conv;
+ char in[] = "a"; iconv_ibp pin = in;
+ char out[20] = ""; char *pout = out;
+ size_t isz = sizeof in;
+ size_t osz = sizeof out;
+
+ conv = iconv_open("UTF-16", "UTF-8");
+ iconv(conv, &pin, &isz, &pout, &osz);
+ iconv_close(conv);
+ v = (unsigned char)(out[0]) + (unsigned char)(out[1]);
+ return v != 0xfe + 0xff;
+ }
+ '''
+
+ if compiler.run(iconv_omits_bom_source,
+ dependencies: iconv,
+ name: 'iconv omits BOM',
+ ).returncode() != 0
+ libgit_c_args += '-DICONV_OMITS_BOM'
+ endif
+else
+ libgit_c_args += '-DNO_ICONV'
+ build_options_config.set('NO_ICONV', '1')
+endif
+
+pcre2 = dependency('libpcre2-8', required: get_option('pcre2'), default_options: ['default_library=static', 'test=false'])
+if pcre2.found()
+ libgit_dependencies += pcre2
+ libgit_c_args += '-DUSE_LIBPCRE2'
+ build_options_config.set('USE_LIBPCRE2', '1')
+else
+ build_options_config.set('USE_LIBPCRE2', '')
+endif
+
+curl = dependency('libcurl', version: '>=7.21.3', required: get_option('curl'), default_options: ['default_library=static', 'tests=disabled', 'tool=disabled'])
+use_curl_for_imap_send = false
+if curl.found()
+ if curl.version().version_compare('>=7.34.0')
+ libgit_c_args += '-DUSE_CURL_FOR_IMAP_SEND'
+ use_curl_for_imap_send = true
+ endif
+
+ libgit_dependencies += curl
+ libgit_c_args += '-DCURL_DISABLE_TYPECHECK'
+ build_options_config.set('NO_CURL', '')
+else
+ libgit_c_args += '-DNO_CURL'
+ build_options_config.set('NO_CURL', '1')
+endif
+
+expat = dependency('expat', required: get_option('expat'), default_options: ['default_library=static', 'build_tests=false'])
+if expat.found()
+ libgit_dependencies += expat
+
+ if expat.version().version_compare('<=1.2')
+ libgit_c_args += '-DEXPAT_NEEDS_XMLPARSE_H'
+ endif
+ build_options_config.set('NO_EXPAT', '')
+else
+ libgit_c_args += '-DNO_EXPAT'
+ build_options_config.set('NO_EXPAT', '1')
+endif
+
+if not compiler.has_header('sys/select.h')
+ libgit_c_args += '-DNO_SYS_SELECT_H'
+endif
+
+has_poll_h = compiler.has_header('poll.h')
+if not has_poll_h
+ libgit_c_args += '-DNO_POLL_H'
+endif
+
+has_sys_poll_h = compiler.has_header('sys/poll.h')
+if not has_sys_poll_h
+ libgit_c_args += '-DNO_SYS_POLL_H'
+endif
+
+if not has_poll_h and not has_sys_poll_h
+ libgit_c_args += '-DNO_POLL'
+ libgit_sources += 'compat/poll/poll.c'
+ libgit_include_directories += 'compat/poll'
+endif
+
+if not compiler.has_header('inttypes.h')
+ libgit_c_args += '-DNO_INTTYPES_H'
+endif
+
+if compiler.has_header('libcharset.h')
+ libcharset = compiler.find_library('charset')
+
+ if compiler.has_function('locale_charset',
+ prefix: '#include <libcharset.h>',
+ dependencies: iconv,
+ )
+ libgit_c_args += '-DHAVE_LIBCHARSET_H'
+ elif compiler.has_function('locale_charset',
+ prefix: '#include <libcharset.h>',
+ dependencies: libcharset,
+ )
+ libgit_c_args += '-DHAVE_LIBCHARSET_H'
+ endif
+endif
+
+if compiler.has_header('alloca.h')
+ libgit_c_args += '-DHAVE_ALLOCA_H'
+endif
+
+if compiler.has_header('sys/sysinfo.h')
+ libgit_c_args += '-DHAVE_SYSINFO'
+endif
+
+# Windows has libgen.h and a basename implementation, but we still need our own
+# implementation to threat things like drive prefixes specially.
+if host_machine.system() == 'windows' or not compiler.has_header('libgen.h')
+ libgit_c_args += '-DNO_LIBGEN_H'
+ libgit_sources += 'compat/basename.c'
+endif
+
+if compiler.has_header('paths.h')
+ libgit_c_args += '-DHAVE_PATHS_H'
+endif
+
+if compiler.has_header('strings.h')
+ libgit_c_args += '-DHAVE_STRINGS_H'
+endif
+
+networking_dependencies = [ ]
+if host_machine.system() == 'windows'
+ winsock = compiler.find_library('ws2_32', required: false)
+ if winsock.found()
+ networking_dependencies += winsock
+ endif
+else
+ libresolv = compiler.find_library('resolv', required: false)
+ if libresolv.found()
+ networking_dependencies += libresolv
+ endif
+endif
+libgit_dependencies += networking_dependencies
+
+foreach symbol : ['inet_ntop', 'inet_pton', 'strerror']
+ if not compiler.has_function(symbol, dependencies: networking_dependencies)
+ libgit_c_args += '-DNO_' + symbol.to_upper()
+ endif
+endforeach
+
+has_ipv6 = compiler.has_function('getaddrinfo', dependencies: networking_dependencies)
+if not has_ipv6
+ libgit_c_args += '-DNO_IPV6'
+endif
+
+if not compiler.compiles('''
+ #ifdef _WIN32
+ # include <winsock2.h>
+ #else
+ # include <sys/types.h>
+ # include <sys/socket.h>
+ #endif
+
+ void func(void)
+ {
+ struct sockaddr_storage x;
+ }
+''', name: 'struct sockaddr_storage')
+ if has_ipv6
+ libgit_c_args += '-Dsockaddr_storage=sockaddr_in6'
+ else
+ libgit_c_args += '-Dsockaddr_storage=sockaddr_in'
+ endif
+endif
+
+if compiler.has_function('socket', dependencies: networking_dependencies)
+ libgit_sources += [
+ 'unix-socket.c',
+ 'unix-stream-server.c',
+ ]
+ build_options_config.set('NO_UNIX_SOCKETS', '')
+else
+ libgit_c_args += '-DNO_UNIX_SOCKETS'
+ build_options_config.set('NO_UNIX_SOCKETS', '1')
+endif
+
+if not compiler.has_function('pread')
+ libgit_c_args += '-DNO_PREAD'
+ libgit_sources += 'compat/pread.c'
+endif
+
+if host_machine.system() == 'darwin'
+ libgit_sources += 'compat/precompose_utf8.c'
+ libgit_c_args += '-DPRECOMPOSE_UNICODE'
+ libgit_c_args += '-DPROTECT_HFS_DEFAULT'
+endif
+
+# Configure general compatibility wrappers.
+if host_machine.system() == 'cygwin'
+ libgit_sources += [
+ 'compat/win32/path-utils.c',
+ ]
+elif host_machine.system() == 'windows'
+ libgit_sources += [
+ 'compat/mingw.c',
+ 'compat/winansi.c',
+ 'compat/win32/flush.c',
+ 'compat/win32/path-utils.c',
+ 'compat/win32/pthread.c',
+ 'compat/win32/syslog.c',
+ 'compat/win32/dirent.c',
+ 'compat/win32mmap.c',
+ 'compat/nedmalloc/nedmalloc.c',
+ ]
+
+ libgit_c_args += [
+ '-DDETECT_MSYS_TTY',
+ '-DENSURE_MSYSTEM_IS_SET',
+ '-DNATIVE_CRLF',
+ '-DNOGDI',
+ '-DNO_POSIX_GOODIES',
+ '-DWIN32',
+ '-D_CONSOLE',
+ '-D_CONSOLE_DETECT_MSYS_TTY',
+ '-D__USE_MINGW_ANSI_STDIO=0',
+ ]
+
+ libgit_dependencies += compiler.find_library('ntdll')
+ libgit_include_directories += 'compat/win32'
+ if compiler.get_id() == 'msvc'
+ libgit_include_directories += 'compat/vcbuild/include'
+ endif
+endif
+
+if host_machine.system() == 'linux'
+ libgit_sources += 'compat/linux/procinfo.c'
+elif host_machine.system() == 'windows'
+ libgit_sources += 'compat/win32/trace2_win32_process_info.c'
+else
+ libgit_sources += 'compat/stub/procinfo.c'
+endif
+
+if host_machine.system() == 'cygwin' or host_machine.system() == 'windows'
+ libgit_c_args += [
+ '-DUNRELIABLE_FSTAT',
+ '-DMMAP_PREVENTS_DELETE',
+ '-DOBJECT_CREATION_MODE=1',
+ ]
+endif
+
+# Configure the simple-ipc subsystem required fro the fsmonitor.
+if host_machine.system() == 'windows'
+ libgit_sources += [
+ 'compat/simple-ipc/ipc-shared.c',
+ 'compat/simple-ipc/ipc-win32.c',
+ ]
+ libgit_c_args += '-DSUPPORTS_SIMPLE_IPC'
+else
+ libgit_sources += [
+ 'compat/simple-ipc/ipc-shared.c',
+ 'compat/simple-ipc/ipc-unix-socket.c',
+ ]
+ libgit_c_args += '-DSUPPORTS_SIMPLE_IPC'
+endif
+
+fsmonitor_backend = ''
+if host_machine.system() == 'windows'
+ fsmonitor_backend = 'win32'
+elif host_machine.system() == 'darwin'
+ fsmonitor_backend = 'darwin'
+ libgit_dependencies += dependency('CoreServices')
+endif
+if fsmonitor_backend != ''
+ libgit_c_args += '-DHAVE_FSMONITOR_DAEMON_BACKEND'
+ libgit_c_args += '-DHAVE_FSMONITOR_OS_SETTINGS'
+
+ libgit_sources += [
+ 'compat/fsmonitor/fsm-health-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-ipc-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-listen-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-path-utils-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-settings-' + fsmonitor_backend + '.c',
+ ]
+endif
+build_options_config.set_quoted('FSMONITOR_DAEMON_BACKEND', fsmonitor_backend)
+build_options_config.set_quoted('FSMONITOR_OS_SETTINGS', fsmonitor_backend)
+
+if not get_option('b_sanitize').contains('address') and get_option('regex').allowed() and compiler.has_header('regex.h') and compiler.get_define('REG_STARTEND', prefix: '#include <regex.h>') != ''
+ build_options_config.set('NO_REGEX', '')
+
+ if compiler.get_define('REG_ENHANCED', prefix: '#include <regex.h>') != ''
+ libgit_c_args += '-DUSE_ENHANCED_BASIC_REGULAR_EXPRESSIONS'
+ libgit_sources += 'compat/regcomp_enhanced.c'
+ endif
+elif not get_option('regex').enabled()
+ libgit_c_args += [
+ '-DNO_REGEX',
+ '-DGAWK',
+ '-DNO_MBSUPPORT',
+ ]
+ build_options_config.set('NO_REGEX', '1')
+ libgit_sources += 'compat/regex/regex.c'
+ libgit_include_directories += 'compat/regex'
+else
+ error('Native regex support requested but not found')
+endif
+
+# setitimer and friends are provided by compat/mingw.c.
+if host_machine.system() != 'windows'
+ if not compiler.compiles('''
+ #include <sys/time.h>
+ void func(void)
+ {
+ struct itimerval value;
+ }
+ ''', name: 'struct itimerval')
+ libgit_c_args += '-DNO_STRUCT_ITIMERVAL'
+ libgit_c_args += '-DNO_SETITIMER'
+ elif not compiler.has_function('setitimer')
+ libgit_c_args += '-DNO_SETITIMER'
+ endif
+endif
+
+if compiler.has_member('struct stat', 'st_mtimespec.tv_nsec', prefix: '#include <sys/stat.h>')
+ libgit_c_args += '-DUSE_ST_TIMESPEC'
+elif not compiler.has_member('struct stat', 'st_mtim.tv_nsec', prefix: '#include <sys/stat.h>')
+ libgit_c_args += '-DNO_NSEC'
+endif
+
+if not compiler.has_member('struct stat', 'st_blocks', prefix: '#include <sys/stat.h>')
+ libgit_c_args += '-DNO_ST_BLOCKS_IN_STRUCT_STAT'
+endif
+
+if not compiler.has_member('struct dirent', 'd_type', prefix: '#include <dirent.h>')
+ libgit_c_args += '-DNO_D_TYPE_IN_DIRENT'
+endif
+
+if not compiler.has_member('struct passwd', 'pw_gecos', prefix: '#include <pwd.h>')
+ libgit_c_args += '-DNO_GECOS_IN_PWENT'
+endif
+
+if compiler.has_function('sync_file_range')
+ libgit_c_args += '-DHAVE_SYNC_FILE_RANGE'
+endif
+
+if not compiler.has_function('strcasestr')
+ libgit_c_args += '-DNO_STRCASESTR'
+ libgit_sources += 'compat/strcasestr.c'
+endif
+
+if not compiler.has_function('memmem')
+ libgit_c_args += '-DNO_MEMMEM'
+ libgit_sources += 'compat/memmem.c'
+endif
+
+if not compiler.has_function('strlcpy')
+ libgit_c_args += '-DNO_STRLCPY'
+ libgit_sources += 'compat/strlcpy.c'
+endif
+
+if not compiler.has_function('strdup')
+ libgit_c_args += '-DOVERRIDE_STRDUP'
+ libgit_sources += 'compat/strdup.c'
+endif
+
+if not compiler.has_function('strtoumax')
+ libgit_c_args += '-DNO_STRTOUMAX'
+ libgit_sources += [
+ 'compat/strtoumax.c',
+ 'compat/strtoimax.c',
+ ]
+endif
+
+if not compiler.has_function('strtoull')
+ libgit_c_args += '-DNO_STRTOULL'
+endif
+
+if not compiler.has_function('setenv')
+ libgit_c_args += '-DNO_SETENV'
+ libgit_sources += 'compat/setenv.c'
+endif
+
+if not compiler.has_function('qsort')
+ libgit_c_args += '-DINTERNAL_QSORT'
+endif
+libgit_sources += 'compat/qsort_s.c'
+
+# unsetenv is provided by compat/mingw.c.
+if host_machine.system() != 'windows' and not compiler.has_function('unsetenv')
+ libgit_c_args += '-DNO_UNSETENV'
+ libgit_sources += 'compat/unsetenv.c'
+endif
+
+if not compiler.has_function('mkdtemp')
+ libgit_c_args += '-DNO_MKDTEMP'
+ libgit_sources += 'compat/mkdtemp.c'
+endif
+
+if not compiler.has_function('initgroups')
+ libgit_c_args += '-DNO_INITGROUPS'
+endif
+
+if compiler.has_function('getdelim')
+ libgit_c_args += '-DHAVE_GETDELIM'
+endif
+
+if host_machine.system() == 'windows'
+ libgit_c_args += '-DUSE_WIN32_MMAP'
+elif not compiler.has_function('mmap')
+ libgit_c_args += '-DNO_MMAP'
+ libgit_sources += 'compat/mmap.c'
+endif
+
+if compiler.has_function('clock_gettime')
+ libgit_c_args += '-DHAVE_CLOCK_GETTIME'
+endif
+
+if compiler.compiles('''
+ #include <time.h>
+
+ void func(void)
+ {
+ clockid_t id = CLOCK_MONOTONIC;
+ }
+''', name: 'monotonic clock')
+ libgit_c_args += '-DHAVE_CLOCK_MONOTONIC'
+endif
+
+if not compiler.compiles('''
+ #include <inttypes.h>
+
+ void func(void)
+ {
+ uintmax_t x = 0;
+ }
+''', name: 'uintmax_t')
+ libgit_c_args += '-DNO_UINTMAX_T'
+endif
+
+has_bsd_sysctl = false
+if compiler.has_header('sys/sysctl.h')
+ if compiler.compiles('''
+ #include <stddef.h>
+ #include <sys/sysctl.h>
+
+ void func(void)
+ {
+ int val, mib[2] = { 0 };
+ size_t len = sizeof(val);
+ sysctl(mib, 2, &val, &len, NULL, 0);
+ }
+ ''', name: 'BSD sysctl')
+ libgit_c_args += '-DHAVE_BSD_SYSCTL'
+ has_bsd_sysctl = true
+ endif
+endif
+
+if not meson.is_cross_build() and compiler.run('''
+ #include <stdio.h>
+
+ int main(int argc, const char **argv)
+ {
+ FILE *f = fopen(".", "r");
+ return f ? 0 : 1;
+ }
+''', name: 'fread reads directories').returncode() == 0
+ libgit_c_args += '-DFREAD_READS_DIRECTORIES'
+ libgit_sources += 'compat/fopen.c'
+endif
+
+if not meson.is_cross_build() and fs.exists('/dev/tty')
+ libgit_c_args += '-DHAVE_DEV_TTY'
+endif
+
+if get_option('openssl').enabled() and get_option('CommonCrypto').enabled()
+ error('Can only use one SSL backend')
+endif
+
+security_framework = dependency('Security', required: get_option('CommonCrypto').disable_auto_if(host_machine.system() != 'darwin'))
+core_foundation_framework = dependency('CoreFoundation', required: security_framework.found())
+if security_framework.found()
+ libgit_dependencies += security_framework
+ libgit_dependencies += core_foundation_framework
+ libgit_c_args += '-DAPPLE_COMMON_CRYPTO'
+endif
+
+# OpenSSL is required when requested via the 'openssl' feature or via one of
+# the SHA1/SHA256 backends.
+openssl_required = get_option('openssl').disable_auto_if(security_framework.found())
+if get_option('sha1_backend') == 'openssl' or get_option('sha256_backend') == 'openssl'
+ openssl_required = true
+endif
+
+openssl = dependency('openssl', required: openssl_required, default_options: ['default_library=static'])
+if openssl.found()
+ libgit_dependencies += openssl
+endif
+
+# We may not want to use OpenSSL for anything but our SHA1/SHA256 backends, so
+# we cannot just set NO_OPENSSL based on whether or not the library was found.
+if not openssl.found() or get_option('openssl').disabled()
+ libgit_c_args += '-DNO_OPENSSL'
+endif
+
+sha1_backend = get_option('sha1_backend')
+if sha1_backend == 'sha1dc'
+ libgit_c_args += '-DSHA1_DC'
+ libgit_c_args += '-DSHA1DC_NO_STANDARD_INCLUDES=1'
+ libgit_c_args += '-DSHA1DC_INIT_SAFE_HASH_DEFAULT=0'
+ libgit_c_args += '-DSHA1DC_CUSTOM_INCLUDE_SHA1_C="git-compat-util.h"'
+ libgit_c_args += '-DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="git-compat-util.h"'
+
+ libgit_sources += [
+ 'sha1dc_git.c',
+ 'sha1dc/sha1.c',
+ 'sha1dc/ubc_check.c',
+ ]
+elif sha1_backend == 'common-crypto'
+ libgit_c_args += '-DCOMMON_DIGEST_FOR_OPENSSL'
+ libgit_c_args += '-DSHA1_APPLE'
+ libgit_c_args += '-DSHA1_MAX_BLOCK_SIZE=1024L*1024L*1024L'
+elif sha1_backend == 'openssl'
+ if not openssl.found()
+ openssl = dependency('openssl', required: true)
+ endif
+
+ libgit_c_args += '-DSHA1_OPENSSL'
+ # Apple CommonCrypto requires chunking
+elif sha1_backend == 'block'
+ libgit_c_args += '-DSHA1_BLK'
+ libgit_sources += 'block-sha1/sha1.c'
+else
+ error('Unhandled SHA1 backend ' + sha1_backend)
+endif
+
+sha256_backend = get_option('sha256_backend')
+if sha256_backend == 'openssl'
+ libgit_c_args += '-DSHA256_OPENSSL'
+elif sha256_backend == 'nettle'
+ nettle = dependency('nettle')
+ libgit_dependencies += nettle
+ libgit_c_args += '-DSHA256_NETTLE'
+elif sha256_backend == 'gcrypt'
+ gcrypt = dependency('gcrypt')
+ libgit_dependencies += gcrypt
+ libgit_c_args += '-DSHA256_GCRYPT'
+elif sha256_backend == 'block'
+ libgit_c_args += '-DSHA256_BLK'
+ libgit_sources += 'sha256/block/sha256.c'
+else
+ error('Unhandled SHA256 backend ' + sha256_backend)
+endif
+
+if compiler.has_header_symbol('stdlib.h', 'arc4random_buf')
+ libgit_c_args += '-DHAVE_ARC4RANDOM'
+elif compiler.has_header_symbol('bsd/stdlib.h', 'arc4random_buf')
+ libgit_c_args += '-DHAVE_ARC4RANDOM_BSD'
+elif compiler.has_function('getrandom', prefix: '#include <sys/random.h>')
+ libgit_c_args += '-DHAVE_GETRANDOM'
+elif compiler.has_function('getentropy', prefix: '#include <unistd.h>')
+ libgit_c_args += '-DHAVE_GETENTROPY'
+elif compiler.has_function('RtlGenRandom', prefix: '#include <windows.h>\n#include <ntsecapi.h>')
+ libgit_c_args += '-DHAVE_RTLGENRANDOM'
+elif openssl.found()
+ libgit_c_args += '-DHAVE_OPENSSL_CSPRNG'
+endif
+
+if get_option('runtime_prefix')
+ libgit_c_args += '-DRUNTIME_PREFIX'
+ build_options_config.set('RUNTIME_PREFIX', '1')
+
+ if compiler.has_header('mach-o/dyld.h')
+ libgit_c_args += '-DHAVE_NS_GET_EXECUTABLE_PATH'
+ endif
+
+ if has_bsd_sysctl and compiler.compiles('''
+ #include <sys/sysctl.h>
+
+ void func(void)
+ {
+ KERN_PROC_PATHNAME; KERN_PROC;
+ }
+ ''', name: 'BSD KERN_PROC_PATHNAME')
+ libgit_c_args += '-DHAVE_NS_GET_EXECUTABLE_PATH'
+ endif
+
+ if host_machine.system() == 'linux'
+ libgit_c_args += '-DPROCFS_EXECUTABLE_PATH="/proc/self/exe' + '"'
+ elif host_machine.system() == 'openbsd'
+ libgit_c_args += '-DPROCFS_EXECUTABLE_PATH="' + '/proc/curproc/file' + '"'
+ elif host_machine.system() == 'netbsd'
+ libgit_c_args += '-DPROCFS_EXECUTABLE_PATH="' + '/proc/curproc/exe' + '"'
+ endif
+
+ if host_machine.system() == 'windows' and compiler.compiles('''
+ #include <stdlib.h>
+
+ void func(void)
+ {
+ _wpgmptr;
+ }
+ ''', name: 'Win32 _wpgmptr')
+ libgit_c_args += '-DHAVE_WPGMPTR'
+ endif
+else
+ build_options_config.set('RUNTIME_PREFIX', '')
+endif
+
+foreach key, value : {
+ 'DIFF': diff.full_path(),
+ 'GIT_TEST_CMP': diff.full_path() + ' -u',
+ 'GIT_TEST_GITPERLLIB': meson.project_build_root() / 'perl',
+ 'GIT_TEST_MERGE_TOOLS_DIR': meson.project_source_root() / 'mergetools',
+ 'GIT_TEST_POPATH': meson.project_source_root() / 'po',
+ 'GIT_TEST_TEMPLATE_DIR': meson.project_build_root() / 'templates',
+ 'GIT_TEST_TEXTDOMAINDIR': meson.project_build_root() / 'po',
+ 'PAGER_ENV': get_option('pager_environment'),
+ 'PERL_PATH': perl.found() ? perl.full_path() : '',
+ 'PYTHON_PATH': python.found () ? python.full_path() : '',
+ 'SHELL_PATH': shell.full_path(),
+ 'TAR': tar.full_path(),
+ 'TEST_OUTPUT_DIRECTORY': test_output_directory,
+ 'TEST_SHELL_PATH': shell.full_path(),
+}
+ if value != '' and cygpath.found()
+ value = run_command(cygpath, value, check: true).stdout().strip()
+ endif
+ build_options_config.set_quoted(key, value)
+endforeach
+
+configure_file(
+ input: 'GIT-BUILD-OPTIONS.in',
+ output: 'GIT-BUILD-OPTIONS',
+ configuration: build_options_config,
+)
+
+version_def_h = custom_target(
+ command: [
+ shell,
+ meson.current_source_dir() / 'GIT-VERSION-GEN',
+ meson.current_source_dir(),
+ '@INPUT@',
+ '@OUTPUT@',
+ ],
+ input: meson.current_source_dir() / 'version-def.h.in',
+ output: 'version-def.h',
+ build_always_stale: true,
+)
+
+git_version_file = custom_target(
+ command: [
+ shell,
+ meson.current_source_dir() / 'GIT-VERSION-GEN',
+ meson.current_source_dir(),
+ '@INPUT@',
+ '@OUTPUT@',
+ ],
+ input: meson.current_source_dir() / 'GIT-VERSION-FILE.in',
+ output: 'GIT-VERSION-FILE',
+ build_always_stale: true,
+)
+
+# Build a separate library for "version.c" so that we do not have to rebuild
+# everything when the current Git commit changes.
+libgit_version_library = static_library('git-version',
+ sources: [
+ 'version.c',
+ version_def_h,
+ ],
+ c_args: libgit_c_args,
+ dependencies: libgit_dependencies,
+ include_directories: libgit_include_directories,
+)
+
+libgit_library = static_library('git',
+ sources: libgit_sources,
+ c_args: libgit_c_args,
+ link_with: libgit_version_library,
+ dependencies: libgit_dependencies,
+ include_directories: libgit_include_directories,
+)
+
+libgit = declare_dependency(
+ compile_args: libgit_c_args,
+ link_with: libgit_library,
+ dependencies: libgit_dependencies,
+ include_directories: libgit_include_directories,
+)
+
+common_main_sources = ['common-main.c']
+common_main_link_args = [ ]
+if host_machine.system() == 'windows'
+ git_rc = custom_target(
+ command: [
+ shell,
+ meson.current_source_dir() / 'GIT-VERSION-GEN',
+ meson.current_source_dir(),
+ '@INPUT@',
+ '@OUTPUT@',
+ ],
+ input: meson.current_source_dir() / 'git.rc.in',
+ output: 'git.rc',
+ build_always_stale: true,
+ )
+
+ common_main_sources += import('windows').compile_resources(git_rc,
+ include_directories: [meson.current_source_dir()],
+ )
+ if compiler.get_argument_syntax() == 'gcc'
+ common_main_link_args += [
+ '-municode',
+ '-Wl,-nxcompat',
+ '-Wl,-dynamicbase',
+ '-Wl,-pic-executable,-e,mainCRTStartup',
+ ]
+ elif compiler.get_argument_syntax() == 'msvc'
+ common_main_link_args += [
+ '/ENTRY:wmainCRTStartup',
+ 'invalidcontinue.obj',
+ ]
+ else
+ error('Unsupported compiler ' + compiler.get_id())
+ endif
+endif
+common_main_library = static_library('common-main',
+ 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,
+ link_args: common_main_link_args,
+)
+
+bin_wrappers = [ ]
+test_dependencies = [ ]
+
+git = executable('git',
+ sources: builtin_sources + 'git.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+bin_wrappers += git
+
+test_dependencies += executable('git-daemon',
+ sources: 'daemon.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+test_dependencies += executable('git-sh-i18n--envsubst',
+ sources: 'sh-i18n--envsubst.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+bin_wrappers += executable('git-shell',
+ sources: 'shell.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+test_dependencies += executable('git-http-backend',
+ sources: 'http-backend.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+bin_wrappers += executable('scalar',
+ sources: 'scalar.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+if get_option('curl').enabled()
+ curl_sources = [
+ 'http.c',
+ 'http-walker.c',
+ ]
+
+ git_remote_http = executable('git-remote-http',
+ sources: curl_sources + 'remote-curl.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+ test_dependencies += git_remote_http
+
+ test_dependencies += executable('git-http-fetch',
+ sources: curl_sources + 'http-fetch.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+
+ if expat.found()
+ test_dependencies += executable('git-http-push',
+ sources: curl_sources + 'http-push.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+ endif
+
+ 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, common_main],
+ )
+
+ install_symlink(alias + executable_suffix,
+ install_dir: get_option('libexecdir') / 'git-core',
+ pointing_to: 'git-remote-http',
+ )
+ endforeach
+endif
+
+imap_send_sources = ['imap-send.c']
+if use_curl_for_imap_send
+ imap_send_sources += curl_sources
+endif
+
+test_dependencies += executable('git-imap-send',
+ sources: imap_send_sources,
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+foreach alias : [ 'git-receive-pack', 'git-upload-archive', 'git-upload-pack' ]
+ bin_wrappers += executable(alias,
+ objects: git.extract_all_objects(recursive: false),
+ dependencies: [libgit, common_main],
+ )
+
+ install_symlink(alias + executable_suffix,
+ install_dir: get_option('libexecdir') / 'git-core',
+ pointing_to: 'git-remote-http',
+ )
+endforeach
+
+foreach symlink : [
+ 'git',
+ 'git-receive-pack',
+ 'git-shell',
+ 'git-upload-archive',
+ 'git-upload-pack',
+ 'scalar',
+]
+ install_symlink(symlink,
+ install_dir: get_option('bindir'),
+ pointing_to: fs.relative_to(get_option('libexecdir') / 'git-core' / symlink, get_option('bindir')),
+ )
+endforeach
+
+scripts_sh = [
+ 'git-difftool--helper.sh',
+ 'git-filter-branch.sh',
+ 'git-merge-octopus.sh',
+ 'git-merge-one-file.sh',
+ 'git-merge-resolve.sh',
+ 'git-mergetool--lib.sh',
+ 'git-mergetool.sh',
+ 'git-quiltimport.sh',
+ 'git-request-pull.sh',
+ 'git-sh-i18n.sh',
+ 'git-sh-setup.sh',
+ 'git-submodule.sh',
+ 'git-web--browse.sh',
+]
+if perl_features_enabled
+ scripts_sh += 'git-instaweb.sh'
+endif
+
+foreach script : scripts_sh
+ test_dependencies += custom_target(
+ input: script,
+ output: fs.stem(script),
+ command: [
+ shell,
+ meson.project_source_root() / 'generate-script.sh',
+ '@INPUT@',
+ '@OUTPUT@',
+ meson.project_build_root() / 'GIT-BUILD-OPTIONS',
+ ],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+endforeach
+
+if perl_features_enabled
+ scripts_perl = [
+ 'git-archimport.perl',
+ 'git-cvsexportcommit.perl',
+ 'git-cvsimport.perl',
+ 'git-cvsserver.perl',
+ 'git-send-email.perl',
+ 'git-svn.perl',
+ ]
+
+ pathsep = ':'
+ if host_machine.system() == 'windows'
+ pathsep = ';'
+ endif
+
+ perl_header_template = 'perl/header_templates/fixed_prefix.template.pl'
+ if get_option('runtime_prefix')
+ perl_header_template = 'perl/header_templates/runtime_prefix.template.pl'
+ endif
+
+ perl_header = configure_file(
+ input: perl_header_template,
+ output: 'GIT-PERL-HEADER',
+ configuration: {
+ 'GITEXECDIR_REL': get_option('libexecdir') / 'git-core',
+ 'PERLLIBDIR_REL': get_option('datadir') / 'perl5',
+ 'LOCALEDIR_REL': get_option('datadir') / 'locale',
+ 'INSTLIBDIR': get_option('datadir') / 'perl5',
+ 'PATHSEP': pathsep,
+ },
+ )
+
+ generate_perl_command = [
+ shell,
+ meson.project_source_root() / 'generate-perl.sh',
+ meson.project_build_root() / 'GIT-BUILD-OPTIONS',
+ git_version_file.full_path(),
+ perl_header,
+ '@INPUT@',
+ '@OUTPUT@',
+ ]
+
+ foreach script : scripts_perl
+ generated_script = custom_target(
+ input: script,
+ output: fs.stem(script),
+ command: generate_perl_command,
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ depends: [git_version_file],
+ )
+ test_dependencies += generated_script
+
+ if script == 'git-cvsserver.perl'
+ bin_wrappers += generated_script
+
+ install_symlink(fs.stem(script),
+ install_dir: get_option('bindir'),
+ pointing_to: fs.relative_to(get_option('libexecdir') / 'git-core' / fs.stem(script), get_option('bindir')),
+ )
+ endif
+ endforeach
+
+ subdir('perl')
+endif
+
+if python.found()
+ scripts_python = [
+ 'git-p4.py'
+ ]
+
+ foreach script : scripts_python
+ fs.copyfile(script, fs.stem(script),
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+ endforeach
+endif
+
+mergetools = [
+ 'mergetools/araxis',
+ 'mergetools/bc',
+ 'mergetools/codecompare',
+ 'mergetools/deltawalker',
+ 'mergetools/diffmerge',
+ 'mergetools/diffuse',
+ 'mergetools/ecmerge',
+ 'mergetools/emerge',
+ 'mergetools/examdiff',
+ 'mergetools/guiffy',
+ 'mergetools/gvimdiff',
+ 'mergetools/kdiff3',
+ 'mergetools/kompare',
+ 'mergetools/meld',
+ 'mergetools/nvimdiff',
+ 'mergetools/opendiff',
+ 'mergetools/p4merge',
+ 'mergetools/smerge',
+ 'mergetools/tkdiff',
+ 'mergetools/tortoisemerge',
+ 'mergetools/vimdiff',
+ 'mergetools/vscode',
+ 'mergetools/winmerge',
+ 'mergetools/xxdiff',
+]
+
+foreach mergetool : mergetools
+ install_data(mergetool, install_dir: get_option('libexecdir') / 'git-core' / 'mergetools')
+endforeach
+
+if intl.found()
+ subdir('po')
+endif
+subdir('contrib')
+subdir('gitweb')
+subdir('templates')
+
+# Everything but the bin-wrappers need to come before this target such that we
+# can properly set up test dependencies. The bin-wrappers themselves are set up
+# at configuration time, so these are fine.
+if get_option('tests')
+ subdir('t')
+endif
+
+subdir('bin-wrappers')
+if get_option('docs') != []
+ subdir('Documentation')
+endif
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000000000000000000000000000000000000..83d9d527a0667ef85858e19c7f78896ab4b68aca
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,83 @@
+# 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('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.')
+
+# 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('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('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.')
+
+# HTTPS backends.
+option('openssl', type: 'feature', value: 'auto',
+ description: 'Support access to HTTPS remotes. OpenSSL may still be pulled in if configured as SHA1 or SHA256 backend.')
+option('CommonCrypto', type: 'feature', value: 'auto',
+ description: 'Build tools written in Python.')
+
+# Hashing backends.
+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')
diff --git a/perl/FromCPAN/Mail/meson.build b/perl/FromCPAN/Mail/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..129cff161c585645c111af0386bafe136258e3db
--- /dev/null
+++ b/perl/FromCPAN/Mail/meson.build
@@ -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',
+)
diff --git a/perl/FromCPAN/meson.build b/perl/FromCPAN/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..4e7ea909df3593fb65facb4bf6a1c42e954d6f70
--- /dev/null
+++ b/perl/FromCPAN/meson.build
@@ -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')
diff --git a/perl/Git/LoadCPAN/Mail/meson.build b/perl/Git/LoadCPAN/Mail/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..7da5b37adb278b4e13f41ea5ebc762bb4d78b64b
--- /dev/null
+++ b/perl/Git/LoadCPAN/Mail/meson.build
@@ -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',
+)
diff --git a/perl/Git/LoadCPAN/meson.build b/perl/Git/LoadCPAN/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..9468c073aeb5ae1980f88b4c7f2c7fe69355ea37
--- /dev/null
+++ b/perl/Git/LoadCPAN/meson.build
@@ -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')
diff --git a/perl/Git/SVN/Memoize/meson.build b/perl/Git/SVN/Memoize/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..515ab3dd926618f6c46b030e1f283d637fdddedf
--- /dev/null
+++ b/perl/Git/SVN/Memoize/meson.build
@@ -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',
+)
diff --git a/perl/Git/SVN/meson.build b/perl/Git/SVN/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..8338531041d8e5cd4e8c2c8a0c3dcfc8b2d23cc9
--- /dev/null
+++ b/perl/Git/SVN/meson.build
@@ -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')
diff --git a/perl/Git/meson.build b/perl/Git/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..259209d7302809b6c1d3249d9d21548515c31c77
--- /dev/null
+++ b/perl/Git/meson.build
@@ -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')
diff --git a/perl/meson.build b/perl/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..c22d6f8a1a3266ded27c43c43c88620f9b4badcf
--- /dev/null
+++ b/perl/meson.build
@@ -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
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..d7154b6395b2bf4a27110aad65aa1f51f979a1e9
--- /dev/null
+++ b/po/meson.build
@@ -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]
diff --git a/subprojects/.gitignore b/subprojects/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..63ea916ef5f30255aef0c0b0b63f37b0e1d99fb2
--- /dev/null
+++ b/subprojects/.gitignore
@@ -0,0 +1 @@
+/*/
diff --git a/subprojects/curl.wrap b/subprojects/curl.wrap
new file mode 100644
index 0000000000000000000000000000000000000000..f7e384b85cf5ee98672e4409e1d30f8f6f0e5735
--- /dev/null
+++ b/subprojects/curl.wrap
@@ -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
diff --git a/subprojects/expat.wrap b/subprojects/expat.wrap
new file mode 100644
index 0000000000000000000000000000000000000000..2e0427dcfd144c22d8c0bfd333e3cf31f14855a7
--- /dev/null
+++ b/subprojects/expat.wrap
@@ -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
diff --git a/subprojects/openssl.wrap b/subprojects/openssl.wrap
new file mode 100644
index 0000000000000000000000000000000000000000..873d55106e9b83c487a88dfbb85eaf73429464d7
--- /dev/null
+++ b/subprojects/openssl.wrap
@@ -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
diff --git a/subprojects/pcre2.wrap b/subprojects/pcre2.wrap
new file mode 100644
index 0000000000000000000000000000000000000000..7e184472543bde1572b9e780ae29318fe01e72bc
--- /dev/null
+++ b/subprojects/pcre2.wrap
@@ -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
diff --git a/subprojects/zlib.wrap b/subprojects/zlib.wrap
new file mode 100644
index 0000000000000000000000000000000000000000..aa14de17740728cecdb7431fb101e55e9b022273
--- /dev/null
+++ b/subprojects/zlib.wrap
@@ -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
diff --git a/t/helper/meson.build b/t/helper/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..5e83884246edc7841738de5085f3255aa1fa3fbe
--- /dev/null
+++ b/t/helper/meson.build
@@ -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
diff --git a/t/meson.build b/t/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..9ec0b7fa34a033d508448dbd56ab2322a5106fd0
--- /dev/null
+++ b/t/meson.build
@@ -0,0 +1,1106 @@
+clar_test_suites = [
+ 'unit-tests/ctype.c',
+ 'unit-tests/strvec.c',
+]
+
+clar_sources = [
+ 'unit-tests/clar/clar.c',
+ 'unit-tests/unit-test.c',
+]
+
+clar_decls_h = custom_target(
+ input: clar_test_suites,
+ output: 'clar-decls.h',
+ command : [shell, meson.current_source_dir() + '/unit-tests/generate-clar-decls.sh', '@OUTPUT@', '@INPUT@'],
+ env: script_environment,
+)
+clar_sources += clar_decls_h
+
+clar_sources += custom_target(
+ input: clar_decls_h,
+ output: 'clar.suite',
+ feed: true,
+ capture: true,
+ command : [awk, '-f', meson.current_source_dir() + '/unit-tests/clar-generate.awk'],
+)
+
+clar_unit_tests = executable('unit-tests',
+ sources: clar_sources + clar_test_suites,
+ dependencies: [libgit, common_main],
+)
+test('unit-tests', clar_unit_tests)
+
+unit_test_programs = [
+ 'unit-tests/t-example-decorate.c',
+ 'unit-tests/t-hash.c',
+ 'unit-tests/t-hashmap.c',
+ 'unit-tests/t-mem-pool.c',
+ 'unit-tests/t-oid-array.c',
+ 'unit-tests/t-oidmap.c',
+ 'unit-tests/t-oidtree.c',
+ 'unit-tests/t-prio-queue.c',
+ 'unit-tests/t-reftable-basics.c',
+ 'unit-tests/t-reftable-block.c',
+ 'unit-tests/t-reftable-merged.c',
+ 'unit-tests/t-reftable-pq.c',
+ 'unit-tests/t-reftable-reader.c',
+ 'unit-tests/t-reftable-readwrite.c',
+ 'unit-tests/t-reftable-record.c',
+ 'unit-tests/t-reftable-stack.c',
+ 'unit-tests/t-reftable-tree.c',
+ 'unit-tests/t-strbuf.c',
+ 'unit-tests/t-strcmp-offset.c',
+ 'unit-tests/t-trailer.c',
+ 'unit-tests/t-urlmatch-normalization.c',
+]
+
+foreach unit_test_program : unit_test_programs
+ unit_test_name = fs.stem(unit_test_program)
+ unit_test = executable(unit_test_name,
+ sources: [
+ 'unit-tests/test-lib.c',
+ 'unit-tests/lib-oid.c',
+ 'unit-tests/lib-reftable.c',
+ unit_test_program,
+ ],
+ dependencies: [libgit, common_main],
+ )
+ test(unit_test_name, unit_test,
+ workdir: meson.current_source_dir(),
+ timeout: 0,
+ )
+endforeach
+
+subdir('helper')
+
+integration_tests = [
+ 't0000-basic.sh',
+ 't0001-init.sh',
+ 't0002-gitfile.sh',
+ 't0003-attributes.sh',
+ 't0004-unwritable.sh',
+ 't0005-signals.sh',
+ 't0006-date.sh',
+ 't0007-git-var.sh',
+ 't0008-ignores.sh',
+ 't0010-racy-git.sh',
+ 't0012-help.sh',
+ 't0013-sha1dc.sh',
+ 't0014-alias.sh',
+ 't0017-env-helper.sh',
+ 't0018-advice.sh',
+ 't0019-json-writer.sh',
+ 't0020-crlf.sh',
+ 't0021-conversion.sh',
+ 't0022-crlf-rename.sh',
+ 't0023-crlf-am.sh',
+ 't0024-crlf-archive.sh',
+ 't0025-crlf-renormalize.sh',
+ 't0026-eol-config.sh',
+ 't0027-auto-crlf.sh',
+ 't0028-working-tree-encoding.sh',
+ 't0029-core-unsetenvvars.sh',
+ 't0030-stripspace.sh',
+ 't0033-safe-directory.sh',
+ 't0034-root-safe-directory.sh',
+ 't0035-safe-bare-repository.sh',
+ 't0040-parse-options.sh',
+ 't0041-usage.sh',
+ 't0050-filesystem.sh',
+ 't0051-windows-named-pipe.sh',
+ 't0052-simple-ipc.sh',
+ 't0055-beyond-symlinks.sh',
+ 't0056-git-C.sh',
+ 't0060-path-utils.sh',
+ 't0061-run-command.sh',
+ 't0062-revision-walking.sh',
+ 't0063-string-list.sh',
+ 't0066-dir-iterator.sh',
+ 't0067-parse_pathspec_file.sh',
+ 't0068-for-each-repo.sh',
+ 't0070-fundamental.sh',
+ 't0071-sort.sh',
+ 't0080-unit-test-output.sh',
+ 't0081-find-pack.sh',
+ 't0090-cache-tree.sh',
+ 't0091-bugreport.sh',
+ 't0092-diagnose.sh',
+ 't0095-bloom.sh',
+ 't0100-previous.sh',
+ 't0101-at-syntax.sh',
+ 't0200-gettext-basic.sh',
+ 't0201-gettext-fallbacks.sh',
+ 't0202-gettext-perl.sh',
+ 't0203-gettext-setlocale-sanity.sh',
+ 't0204-gettext-reencode-sanity.sh',
+ 't0210-trace2-normal.sh',
+ 't0211-trace2-perf.sh',
+ 't0212-trace2-event.sh',
+ 't0300-credentials.sh',
+ 't0301-credential-cache.sh',
+ 't0302-credential-store.sh',
+ 't0303-credential-external.sh',
+ 't0410-partial-clone.sh',
+ 't0411-clone-from-partial.sh',
+ 't0450-txt-doc-vs-help.sh',
+ 't0500-progress-display.sh',
+ 't0600-reffiles-backend.sh',
+ 't0601-reffiles-pack-refs.sh',
+ 't0602-reffiles-fsck.sh',
+ 't0610-reftable-basics.sh',
+ 't0611-reftable-httpd.sh',
+ 't0612-reftable-jgit-compatibility.sh',
+ 't0613-reftable-write-options.sh',
+ 't1000-read-tree-m-3way.sh',
+ 't1001-read-tree-m-2way.sh',
+ 't1002-read-tree-m-u-2way.sh',
+ 't1003-read-tree-prefix.sh',
+ 't1004-read-tree-m-u-wf.sh',
+ 't1005-read-tree-reset.sh',
+ 't1006-cat-file.sh',
+ 't1007-hash-object.sh',
+ 't1008-read-tree-overlay.sh',
+ 't1009-read-tree-new-index.sh',
+ 't1010-mktree.sh',
+ 't1011-read-tree-sparse-checkout.sh',
+ 't1012-read-tree-df.sh',
+ 't1013-read-tree-submodule.sh',
+ 't1014-read-tree-confusing.sh',
+ 't1015-read-index-unmerged.sh',
+ 't1016-compatObjectFormat.sh',
+ 't1020-subdirectory.sh',
+ 't1021-rerere-in-workdir.sh',
+ 't1022-read-tree-partial-clone.sh',
+ 't1050-large.sh',
+ 't1051-large-conversion.sh',
+ 't1060-object-corruption.sh',
+ 't1090-sparse-checkout-scope.sh',
+ 't1091-sparse-checkout-builtin.sh',
+ 't1092-sparse-checkout-compatibility.sh',
+ 't1100-commit-tree-options.sh',
+ 't1300-config.sh',
+ 't1301-shared-repo.sh',
+ 't1302-repo-version.sh',
+ 't1303-wacky-config.sh',
+ 't1304-default-acl.sh',
+ 't1305-config-include.sh',
+ 't1306-xdg-files.sh',
+ 't1307-config-blob.sh',
+ 't1308-config-set.sh',
+ 't1309-early-config.sh',
+ 't1310-config-default.sh',
+ 't1350-config-hooks-path.sh',
+ 't1400-update-ref.sh',
+ 't1401-symbolic-ref.sh',
+ 't1402-check-ref-format.sh',
+ 't1403-show-ref.sh',
+ 't1404-update-ref-errors.sh',
+ 't1405-main-ref-store.sh',
+ 't1406-submodule-ref-store.sh',
+ 't1407-worktree-ref-store.sh',
+ 't1408-packed-refs.sh',
+ 't1409-avoid-packing-refs.sh',
+ 't1410-reflog.sh',
+ 't1411-reflog-show.sh',
+ 't1412-reflog-loop.sh',
+ 't1413-reflog-detach.sh',
+ 't1414-reflog-walk.sh',
+ 't1415-worktree-refs.sh',
+ 't1416-ref-transaction-hooks.sh',
+ 't1417-reflog-updateref.sh',
+ 't1418-reflog-exists.sh',
+ 't1419-exclude-refs.sh',
+ 't1420-lost-found.sh',
+ 't1430-bad-ref-name.sh',
+ 't1450-fsck.sh',
+ 't1451-fsck-buffer.sh',
+ 't1460-refs-migrate.sh',
+ 't1500-rev-parse.sh',
+ 't1501-work-tree.sh',
+ 't1502-rev-parse-parseopt.sh',
+ 't1503-rev-parse-verify.sh',
+ 't1504-ceiling-dirs.sh',
+ 't1505-rev-parse-last.sh',
+ 't1506-rev-parse-diagnosis.sh',
+ 't1507-rev-parse-upstream.sh',
+ 't1508-at-combinations.sh',
+ 't1509-root-work-tree.sh',
+ 't1510-repo-setup.sh',
+ 't1511-rev-parse-caret.sh',
+ 't1512-rev-parse-disambiguation.sh',
+ 't1513-rev-parse-prefix.sh',
+ 't1514-rev-parse-push.sh',
+ 't1515-rev-parse-outside-repo.sh',
+ 't1517-outside-repo.sh',
+ 't1600-index.sh',
+ 't1601-index-bogus.sh',
+ 't1700-split-index.sh',
+ 't1701-racy-split-index.sh',
+ 't1800-hook.sh',
+ 't2000-conflict-when-checking-files-out.sh',
+ 't2002-checkout-cache-u.sh',
+ 't2003-checkout-cache-mkdir.sh',
+ 't2004-checkout-cache-temp.sh',
+ 't2005-checkout-index-symlinks.sh',
+ 't2006-checkout-index-basic.sh',
+ 't2007-checkout-symlink.sh',
+ 't2008-checkout-subdir.sh',
+ 't2009-checkout-statinfo.sh',
+ 't2010-checkout-ambiguous.sh',
+ 't2011-checkout-invalid-head.sh',
+ 't2012-checkout-last.sh',
+ 't2013-checkout-submodule.sh',
+ 't2014-checkout-switch.sh',
+ 't2015-checkout-unborn.sh',
+ 't2016-checkout-patch.sh',
+ 't2017-checkout-orphan.sh',
+ 't2018-checkout-branch.sh',
+ 't2019-checkout-ambiguous-ref.sh',
+ 't2020-checkout-detach.sh',
+ 't2021-checkout-overwrite.sh',
+ 't2022-checkout-paths.sh',
+ 't2023-checkout-m.sh',
+ 't2024-checkout-dwim.sh',
+ 't2025-checkout-no-overlay.sh',
+ 't2026-checkout-pathspec-file.sh',
+ 't2027-checkout-track.sh',
+ 't2030-unresolve-info.sh',
+ 't2050-git-dir-relative.sh',
+ 't2060-switch.sh',
+ 't2070-restore.sh',
+ 't2071-restore-patch.sh',
+ 't2072-restore-pathspec-file.sh',
+ 't2080-parallel-checkout-basics.sh',
+ 't2081-parallel-checkout-collisions.sh',
+ 't2082-parallel-checkout-attributes.sh',
+ 't2100-update-cache-badpath.sh',
+ 't2101-update-index-reupdate.sh',
+ 't2102-update-index-symlinks.sh',
+ 't2103-update-index-ignore-missing.sh',
+ 't2104-update-index-skip-worktree.sh',
+ 't2105-update-index-gitfile.sh',
+ 't2106-update-index-assume-unchanged.sh',
+ 't2107-update-index-basic.sh',
+ 't2108-update-index-refresh-racy.sh',
+ 't2200-add-update.sh',
+ 't2201-add-update-typechange.sh',
+ 't2202-add-addremove.sh',
+ 't2203-add-intent.sh',
+ 't2204-add-ignored.sh',
+ 't2205-add-worktree-config.sh',
+ 't2300-cd-to-toplevel.sh',
+ 't2400-worktree-add.sh',
+ 't2401-worktree-prune.sh',
+ 't2402-worktree-list.sh',
+ 't2403-worktree-move.sh',
+ 't2404-worktree-config.sh',
+ 't2405-worktree-submodule.sh',
+ 't2406-worktree-repair.sh',
+ 't2407-worktree-heads.sh',
+ 't2408-worktree-relative.sh',
+ 't2500-untracked-overwriting.sh',
+ 't2501-cwd-empty.sh',
+ 't3000-ls-files-others.sh',
+ 't3001-ls-files-others-exclude.sh',
+ 't3002-ls-files-dashpath.sh',
+ 't3003-ls-files-exclude.sh',
+ 't3004-ls-files-basic.sh',
+ 't3005-ls-files-relative.sh',
+ 't3006-ls-files-long.sh',
+ 't3007-ls-files-recurse-submodules.sh',
+ 't3008-ls-files-lazy-init-name-hash.sh',
+ 't3009-ls-files-others-nonsubmodule.sh',
+ 't3010-ls-files-killed-modified.sh',
+ 't3011-common-prefixes-and-directory-traversal.sh',
+ 't3012-ls-files-dedup.sh',
+ 't3013-ls-files-format.sh',
+ 't3020-ls-files-error-unmatch.sh',
+ 't3040-subprojects-basic.sh',
+ 't3050-subprojects-fetch.sh',
+ 't3060-ls-files-with-tree.sh',
+ 't3070-wildmatch.sh',
+ 't3100-ls-tree-restrict.sh',
+ 't3101-ls-tree-dirname.sh',
+ 't3102-ls-tree-wildcards.sh',
+ 't3103-ls-tree-misc.sh',
+ 't3104-ls-tree-format.sh',
+ 't3105-ls-tree-output.sh',
+ 't3200-branch.sh',
+ 't3201-branch-contains.sh',
+ 't3202-show-branch.sh',
+ 't3203-branch-output.sh',
+ 't3204-branch-name-interpretation.sh',
+ 't3205-branch-color.sh',
+ 't3206-range-diff.sh',
+ 't3207-branch-submodule.sh',
+ 't3211-peel-ref.sh',
+ 't3300-funny-names.sh',
+ 't3301-notes.sh',
+ 't3302-notes-index-expensive.sh',
+ 't3303-notes-subtrees.sh',
+ 't3304-notes-mixed.sh',
+ 't3305-notes-fanout.sh',
+ 't3306-notes-prune.sh',
+ 't3307-notes-man.sh',
+ 't3308-notes-merge.sh',
+ 't3309-notes-merge-auto-resolve.sh',
+ 't3310-notes-merge-manual-resolve.sh',
+ 't3311-notes-merge-fanout.sh',
+ 't3320-notes-merge-worktrees.sh',
+ 't3321-notes-stripspace.sh',
+ 't3400-rebase.sh',
+ 't3401-rebase-and-am-rename.sh',
+ 't3402-rebase-merge.sh',
+ 't3403-rebase-skip.sh',
+ 't3404-rebase-interactive.sh',
+ 't3405-rebase-malformed.sh',
+ 't3406-rebase-message.sh',
+ 't3407-rebase-abort.sh',
+ 't3408-rebase-multi-line.sh',
+ 't3409-rebase-environ.sh',
+ 't3412-rebase-root.sh',
+ 't3413-rebase-hook.sh',
+ 't3415-rebase-autosquash.sh',
+ 't3416-rebase-onto-threedots.sh',
+ 't3417-rebase-whitespace-fix.sh',
+ 't3418-rebase-continue.sh',
+ 't3419-rebase-patch-id.sh',
+ 't3420-rebase-autostash.sh',
+ 't3421-rebase-topology-linear.sh',
+ 't3422-rebase-incompatible-options.sh',
+ 't3423-rebase-reword.sh',
+ 't3424-rebase-empty.sh',
+ 't3425-rebase-topology-merges.sh',
+ 't3426-rebase-submodule.sh',
+ 't3427-rebase-subtree.sh',
+ 't3428-rebase-signoff.sh',
+ 't3429-rebase-edit-todo.sh',
+ 't3430-rebase-merges.sh',
+ 't3431-rebase-fork-point.sh',
+ 't3432-rebase-fast-forward.sh',
+ 't3433-rebase-across-mode-change.sh',
+ 't3434-rebase-i18n.sh',
+ 't3435-rebase-gpg-sign.sh',
+ 't3436-rebase-more-options.sh',
+ 't3437-rebase-fixup-options.sh',
+ 't3438-rebase-broken-files.sh',
+ 't3500-cherry.sh',
+ 't3501-revert-cherry-pick.sh',
+ 't3502-cherry-pick-merge.sh',
+ 't3503-cherry-pick-root.sh',
+ 't3504-cherry-pick-rerere.sh',
+ 't3505-cherry-pick-empty.sh',
+ 't3506-cherry-pick-ff.sh',
+ 't3507-cherry-pick-conflict.sh',
+ 't3508-cherry-pick-many-commits.sh',
+ 't3509-cherry-pick-merge-df.sh',
+ 't3510-cherry-pick-sequence.sh',
+ 't3511-cherry-pick-x.sh',
+ 't3512-cherry-pick-submodule.sh',
+ 't3513-revert-submodule.sh',
+ 't3514-cherry-pick-revert-gpg.sh',
+ 't3600-rm.sh',
+ 't3601-rm-pathspec-file.sh',
+ 't3602-rm-sparse-checkout.sh',
+ 't3650-replay-basics.sh',
+ 't3700-add.sh',
+ 't3701-add-interactive.sh',
+ 't3702-add-edit.sh',
+ 't3703-add-magic-pathspec.sh',
+ 't3704-add-pathspec-file.sh',
+ 't3705-add-sparse-checkout.sh',
+ 't3800-mktag.sh',
+ 't3900-i18n-commit.sh',
+ 't3901-i18n-patch.sh',
+ 't3902-quoted.sh',
+ 't3903-stash.sh',
+ 't3904-stash-patch.sh',
+ 't3905-stash-include-untracked.sh',
+ 't3906-stash-submodule.sh',
+ 't3907-stash-show-config.sh',
+ 't3908-stash-in-worktree.sh',
+ 't3909-stash-pathspec-file.sh',
+ 't3910-mac-os-precompose.sh',
+ 't3920-crlf-messages.sh',
+ 't4000-diff-format.sh',
+ 't4001-diff-rename.sh',
+ 't4002-diff-basic.sh',
+ 't4003-diff-rename-1.sh',
+ 't4004-diff-rename-symlink.sh',
+ 't4005-diff-rename-2.sh',
+ 't4006-diff-mode.sh',
+ 't4007-rename-3.sh',
+ 't4008-diff-break-rewrite.sh',
+ 't4009-diff-rename-4.sh',
+ 't4010-diff-pathspec.sh',
+ 't4011-diff-symlink.sh',
+ 't4012-diff-binary.sh',
+ 't4013-diff-various.sh',
+ 't4014-format-patch.sh',
+ 't4015-diff-whitespace.sh',
+ 't4016-diff-quote.sh',
+ 't4017-diff-retval.sh',
+ 't4018-diff-funcname.sh',
+ 't4019-diff-wserror.sh',
+ 't4020-diff-external.sh',
+ 't4021-format-patch-numbered.sh',
+ 't4022-diff-rewrite.sh',
+ 't4023-diff-rename-typechange.sh',
+ 't4024-diff-optimize-common.sh',
+ 't4025-hunk-header.sh',
+ 't4026-color.sh',
+ 't4027-diff-submodule.sh',
+ 't4028-format-patch-mime-headers.sh',
+ 't4029-diff-trailing-space.sh',
+ 't4030-diff-textconv.sh',
+ 't4031-diff-rewrite-binary.sh',
+ 't4032-diff-inter-hunk-context.sh',
+ 't4033-diff-patience.sh',
+ 't4034-diff-words.sh',
+ 't4035-diff-quiet.sh',
+ 't4036-format-patch-signer-mime.sh',
+ 't4037-diff-r-t-dirs.sh',
+ 't4038-diff-combined.sh',
+ 't4039-diff-assume-unchanged.sh',
+ 't4040-whitespace-status.sh',
+ 't4041-diff-submodule-option.sh',
+ 't4042-diff-textconv-caching.sh',
+ 't4043-diff-rename-binary.sh',
+ 't4044-diff-index-unique-abbrev.sh',
+ 't4045-diff-relative.sh',
+ 't4046-diff-unmerged.sh',
+ 't4047-diff-dirstat.sh',
+ 't4048-diff-combined-binary.sh',
+ 't4049-diff-stat-count.sh',
+ 't4050-diff-histogram.sh',
+ 't4051-diff-function-context.sh',
+ 't4052-stat-output.sh',
+ 't4053-diff-no-index.sh',
+ 't4054-diff-bogus-tree.sh',
+ 't4055-diff-context.sh',
+ 't4056-diff-order.sh',
+ 't4057-diff-combined-paths.sh',
+ 't4058-diff-duplicates.sh',
+ 't4059-diff-submodule-not-initialized.sh',
+ 't4060-diff-submodule-option-diff-format.sh',
+ 't4061-diff-indent.sh',
+ 't4062-diff-pickaxe.sh',
+ 't4063-diff-blobs.sh',
+ 't4064-diff-oidfind.sh',
+ 't4065-diff-anchored.sh',
+ 't4066-diff-emit-delay.sh',
+ 't4067-diff-partial-clone.sh',
+ 't4068-diff-symmetric-merge-base.sh',
+ 't4069-remerge-diff.sh',
+ 't4100-apply-stat.sh',
+ 't4101-apply-nonl.sh',
+ 't4102-apply-rename.sh',
+ 't4103-apply-binary.sh',
+ 't4104-apply-boundary.sh',
+ 't4105-apply-fuzz.sh',
+ 't4106-apply-stdin.sh',
+ 't4107-apply-ignore-whitespace.sh',
+ 't4108-apply-threeway.sh',
+ 't4109-apply-multifrag.sh',
+ 't4110-apply-scan.sh',
+ 't4111-apply-subdir.sh',
+ 't4112-apply-renames.sh',
+ 't4113-apply-ending.sh',
+ 't4114-apply-typechange.sh',
+ 't4115-apply-symlink.sh',
+ 't4116-apply-reverse.sh',
+ 't4117-apply-reject.sh',
+ 't4118-apply-empty-context.sh',
+ 't4119-apply-config.sh',
+ 't4120-apply-popt.sh',
+ 't4121-apply-diffs.sh',
+ 't4122-apply-symlink-inside.sh',
+ 't4123-apply-shrink.sh',
+ 't4124-apply-ws-rule.sh',
+ 't4125-apply-ws-fuzz.sh',
+ 't4126-apply-empty.sh',
+ 't4127-apply-same-fn.sh',
+ 't4128-apply-root.sh',
+ 't4129-apply-samemode.sh',
+ 't4130-apply-criss-cross-rename.sh',
+ 't4131-apply-fake-ancestor.sh',
+ 't4132-apply-removal.sh',
+ 't4133-apply-filenames.sh',
+ 't4134-apply-submodule.sh',
+ 't4135-apply-weird-filenames.sh',
+ 't4136-apply-check.sh',
+ 't4137-apply-submodule.sh',
+ 't4138-apply-ws-expansion.sh',
+ 't4139-apply-escape.sh',
+ 't4140-apply-ita.sh',
+ 't4141-apply-too-large.sh',
+ 't4150-am.sh',
+ 't4151-am-abort.sh',
+ 't4152-am-subjects.sh',
+ 't4153-am-resume-override-opts.sh',
+ 't4200-rerere.sh',
+ 't4201-shortlog.sh',
+ 't4202-log.sh',
+ 't4203-mailmap.sh',
+ 't4204-patch-id.sh',
+ 't4205-log-pretty-formats.sh',
+ 't4206-log-follow-harder-copies.sh',
+ 't4207-log-decoration-colors.sh',
+ 't4208-log-magic-pathspec.sh',
+ 't4209-log-pickaxe.sh',
+ 't4210-log-i18n.sh',
+ 't4211-line-log.sh',
+ 't4212-log-corrupt.sh',
+ 't4213-log-tabexpand.sh',
+ 't4214-log-graph-octopus.sh',
+ 't4215-log-skewed-merges.sh',
+ 't4216-log-bloom.sh',
+ 't4217-log-limit.sh',
+ 't4252-am-options.sh',
+ 't4253-am-keep-cr-dos.sh',
+ 't4254-am-corrupt.sh',
+ 't4255-am-submodule.sh',
+ 't4256-am-format-flowed.sh',
+ 't4257-am-interactive.sh',
+ 't4258-am-quoted-cr.sh',
+ 't4300-merge-tree.sh',
+ 't4301-merge-tree-write-tree.sh',
+ 't5000-tar-tree.sh',
+ 't5001-archive-attr.sh',
+ 't5002-archive-attr-pattern.sh',
+ 't5003-archive-zip.sh',
+ 't5004-archive-corner-cases.sh',
+ 't5100-mailinfo.sh',
+ 't5150-request-pull.sh',
+ 't5200-update-server-info.sh',
+ 't5300-pack-object.sh',
+ 't5301-sliding-window.sh',
+ 't5302-pack-index.sh',
+ 't5303-pack-corruption-resilience.sh',
+ 't5304-prune.sh',
+ 't5305-include-tag.sh',
+ 't5306-pack-nobase.sh',
+ 't5307-pack-missing-commit.sh',
+ 't5308-pack-detect-duplicates.sh',
+ 't5309-pack-delta-cycles.sh',
+ 't5310-pack-bitmaps.sh',
+ 't5311-pack-bitmaps-shallow.sh',
+ 't5312-prune-corruption.sh',
+ 't5313-pack-bounds-checks.sh',
+ 't5314-pack-cycle-detection.sh',
+ 't5315-pack-objects-compression.sh',
+ 't5316-pack-delta-depth.sh',
+ 't5317-pack-objects-filter-objects.sh',
+ 't5318-commit-graph.sh',
+ 't5319-multi-pack-index.sh',
+ 't5320-delta-islands.sh',
+ 't5321-pack-large-objects.sh',
+ 't5322-pack-objects-sparse.sh',
+ 't5323-pack-redundant.sh',
+ 't5324-split-commit-graph.sh',
+ 't5325-reverse-index.sh',
+ 't5326-multi-pack-bitmaps.sh',
+ 't5327-multi-pack-bitmaps-rev.sh',
+ 't5328-commit-graph-64bit-time.sh',
+ 't5329-pack-objects-cruft.sh',
+ 't5330-no-lazy-fetch-with-commit-graph.sh',
+ 't5331-pack-objects-stdin.sh',
+ 't5332-multi-pack-reuse.sh',
+ 't5333-pseudo-merge-bitmaps.sh',
+ 't5334-incremental-multi-pack-index.sh',
+ 't5351-unpack-large-objects.sh',
+ 't5400-send-pack.sh',
+ 't5401-update-hooks.sh',
+ 't5402-post-merge-hook.sh',
+ 't5403-post-checkout-hook.sh',
+ 't5404-tracking-branches.sh',
+ 't5405-send-pack-rewind.sh',
+ 't5406-remote-rejects.sh',
+ 't5407-post-rewrite-hook.sh',
+ 't5408-send-pack-stdin.sh',
+ 't5409-colorize-remote-messages.sh',
+ 't5410-receive-pack-alternates.sh',
+ 't5411-proc-receive-hook.sh',
+ 't5500-fetch-pack.sh',
+ 't5501-fetch-push-alternates.sh',
+ 't5502-quickfetch.sh',
+ 't5503-tagfollow.sh',
+ 't5504-fetch-receive-strict.sh',
+ 't5505-remote.sh',
+ 't5506-remote-groups.sh',
+ 't5507-remote-environment.sh',
+ 't5509-fetch-push-namespaces.sh',
+ 't5510-fetch.sh',
+ 't5511-refspec.sh',
+ 't5512-ls-remote.sh',
+ 't5513-fetch-track.sh',
+ 't5514-fetch-multiple.sh',
+ 't5515-fetch-merge-logic.sh',
+ 't5516-fetch-push.sh',
+ 't5517-push-mirror.sh',
+ 't5518-fetch-exit-status.sh',
+ 't5519-push-alternates.sh',
+ 't5520-pull.sh',
+ 't5521-pull-options.sh',
+ 't5522-pull-symlink.sh',
+ 't5523-push-upstream.sh',
+ 't5524-pull-msg.sh',
+ 't5525-fetch-tagopt.sh',
+ 't5526-fetch-submodules.sh',
+ 't5527-fetch-odd-refs.sh',
+ 't5528-push-default.sh',
+ 't5529-push-errors.sh',
+ 't5530-upload-pack-error.sh',
+ 't5531-deep-submodule-push.sh',
+ 't5532-fetch-proxy.sh',
+ 't5533-push-cas.sh',
+ 't5534-push-signed.sh',
+ 't5535-fetch-push-symref.sh',
+ 't5536-fetch-conflicts.sh',
+ 't5537-fetch-shallow.sh',
+ 't5538-push-shallow.sh',
+ 't5539-fetch-http-shallow.sh',
+ 't5540-http-push-webdav.sh',
+ 't5541-http-push-smart.sh',
+ 't5542-push-http-shallow.sh',
+ 't5543-atomic-push.sh',
+ 't5544-pack-objects-hook.sh',
+ 't5545-push-options.sh',
+ 't5546-receive-limits.sh',
+ 't5547-push-quarantine.sh',
+ 't5548-push-porcelain.sh',
+ 't5549-fetch-push-http.sh',
+ 't5550-http-fetch-dumb.sh',
+ 't5551-http-fetch-smart.sh',
+ 't5552-skipping-fetch-negotiator.sh',
+ 't5553-set-upstream.sh',
+ 't5554-noop-fetch-negotiator.sh',
+ 't5555-http-smart-common.sh',
+ 't5557-http-get.sh',
+ 't5558-clone-bundle-uri.sh',
+ 't5559-http-fetch-smart-http2.sh',
+ 't5560-http-backend-noserver.sh',
+ 't5561-http-backend.sh',
+ 't5562-http-backend-content-length.sh',
+ 't5563-simple-http-auth.sh',
+ 't5564-http-proxy.sh',
+ 't5570-git-daemon.sh',
+ 't5571-pre-push-hook.sh',
+ 't5572-pull-submodule.sh',
+ 't5573-pull-verify-signatures.sh',
+ 't5574-fetch-output.sh',
+ 't5580-unc-paths.sh',
+ 't5581-http-curl-verbose.sh',
+ 't5582-fetch-negative-refspec.sh',
+ 't5583-push-branches.sh',
+ 't5600-clone-fail-cleanup.sh',
+ 't5601-clone.sh',
+ 't5602-clone-remote-exec.sh',
+ 't5603-clone-dirname.sh',
+ 't5604-clone-reference.sh',
+ 't5605-clone-local.sh',
+ 't5606-clone-options.sh',
+ 't5607-clone-bundle.sh',
+ 't5608-clone-2gb.sh',
+ 't5609-clone-branch.sh',
+ 't5610-clone-detached.sh',
+ 't5611-clone-config.sh',
+ 't5612-clone-refspec.sh',
+ 't5613-info-alternate.sh',
+ 't5614-clone-submodules-shallow.sh',
+ 't5615-alternate-env.sh',
+ 't5616-partial-clone.sh',
+ 't5617-clone-submodules-remote.sh',
+ 't5618-alternate-refs.sh',
+ 't5619-clone-local-ambiguous-transport.sh',
+ 't5700-protocol-v1.sh',
+ 't5701-git-serve.sh',
+ 't5702-protocol-v2.sh',
+ 't5703-upload-pack-ref-in-want.sh',
+ 't5704-protocol-violations.sh',
+ 't5705-session-id-in-capabilities.sh',
+ 't5730-protocol-v2-bundle-uri-file.sh',
+ 't5731-protocol-v2-bundle-uri-git.sh',
+ 't5732-protocol-v2-bundle-uri-http.sh',
+ 't5750-bundle-uri-parse.sh',
+ 't5801-remote-helpers.sh',
+ 't5802-connect-helper.sh',
+ 't5810-proto-disable-local.sh',
+ 't5811-proto-disable-git.sh',
+ 't5812-proto-disable-http.sh',
+ 't5813-proto-disable-ssh.sh',
+ 't5814-proto-disable-ext.sh',
+ 't5815-submodule-protos.sh',
+ 't5900-repo-selection.sh',
+ 't6000-rev-list-misc.sh',
+ 't6001-rev-list-graft.sh',
+ 't6002-rev-list-bisect.sh',
+ 't6003-rev-list-topo-order.sh',
+ 't6004-rev-list-path-optim.sh',
+ 't6005-rev-list-count.sh',
+ 't6006-rev-list-format.sh',
+ 't6007-rev-list-cherry-pick-file.sh',
+ 't6008-rev-list-submodule.sh',
+ 't6009-rev-list-parent.sh',
+ 't6010-merge-base.sh',
+ 't6011-rev-list-with-bad-commit.sh',
+ 't6012-rev-list-simplify.sh',
+ 't6013-rev-list-reverse-parents.sh',
+ 't6014-rev-list-all.sh',
+ 't6016-rev-list-graph-simplify-history.sh',
+ 't6017-rev-list-stdin.sh',
+ 't6018-rev-list-glob.sh',
+ 't6019-rev-list-ancestry-path.sh',
+ 't6020-bundle-misc.sh',
+ 't6021-rev-list-exclude-hidden.sh',
+ 't6022-rev-list-missing.sh',
+ 't6030-bisect-porcelain.sh',
+ 't6040-tracking-info.sh',
+ 't6041-bisect-submodule.sh',
+ 't6050-replace.sh',
+ 't6060-merge-index.sh',
+ 't6100-rev-list-in-order.sh',
+ 't6101-rev-parse-parents.sh',
+ 't6102-rev-list-unexpected-objects.sh',
+ 't6110-rev-list-sparse.sh',
+ 't6111-rev-list-treesame.sh',
+ 't6112-rev-list-filters-objects.sh',
+ 't6113-rev-list-bitmap-filters.sh',
+ 't6114-keep-packs.sh',
+ 't6115-rev-list-du.sh',
+ 't6120-describe.sh',
+ 't6130-pathspec-noglob.sh',
+ 't6131-pathspec-icase.sh',
+ 't6132-pathspec-exclude.sh',
+ 't6133-pathspec-rev-dwim.sh',
+ 't6134-pathspec-in-submodule.sh',
+ 't6135-pathspec-with-attrs.sh',
+ 't6136-pathspec-in-bare.sh',
+ 't6200-fmt-merge-msg.sh',
+ 't6300-for-each-ref.sh',
+ 't6301-for-each-ref-errors.sh',
+ 't6302-for-each-ref-filter.sh',
+ 't6400-merge-df.sh',
+ 't6401-merge-criss-cross.sh',
+ 't6402-merge-rename.sh',
+ 't6403-merge-file.sh',
+ 't6404-recursive-merge.sh',
+ 't6405-merge-symlinks.sh',
+ 't6406-merge-attr.sh',
+ 't6407-merge-binary.sh',
+ 't6408-merge-up-to-date.sh',
+ 't6409-merge-subtree.sh',
+ 't6411-merge-filemode.sh',
+ 't6412-merge-large-rename.sh',
+ 't6413-merge-crlf.sh',
+ 't6414-merge-rename-nocruft.sh',
+ 't6415-merge-dir-to-symlink.sh',
+ 't6416-recursive-corner-cases.sh',
+ 't6417-merge-ours-theirs.sh',
+ 't6418-merge-text-auto.sh',
+ 't6419-merge-ignorecase.sh',
+ 't6421-merge-partial-clone.sh',
+ 't6422-merge-rename-corner-cases.sh',
+ 't6423-merge-rename-directories.sh',
+ 't6424-merge-unrelated-index-changes.sh',
+ 't6425-merge-rename-delete.sh',
+ 't6426-merge-skip-unneeded-updates.sh',
+ 't6427-diff3-conflict-markers.sh',
+ 't6428-merge-conflicts-sparse.sh',
+ 't6429-merge-sequence-rename-caching.sh',
+ 't6430-merge-recursive.sh',
+ 't6431-merge-criscross.sh',
+ 't6432-merge-recursive-space-options.sh',
+ 't6433-merge-toplevel.sh',
+ 't6434-merge-recursive-rename-options.sh',
+ 't6435-merge-sparse.sh',
+ 't6436-merge-overwrite.sh',
+ 't6437-submodule-merge.sh',
+ 't6438-submodule-directory-file-conflicts.sh',
+ 't6439-merge-co-error-msgs.sh',
+ 't6500-gc.sh',
+ 't6501-freshen-objects.sh',
+ 't6600-test-reach.sh',
+ 't6700-tree-depth.sh',
+ 't7001-mv.sh',
+ 't7002-mv-sparse-checkout.sh',
+ 't7003-filter-branch.sh',
+ 't7004-tag.sh',
+ 't7005-editor.sh',
+ 't7006-pager.sh',
+ 't7007-show.sh',
+ 't7008-filter-branch-null-sha1.sh',
+ 't7010-setup.sh',
+ 't7011-skip-worktree-reading.sh',
+ 't7012-skip-worktree-writing.sh',
+ 't7030-verify-tag.sh',
+ 't7031-verify-tag-signed-ssh.sh',
+ 't7060-wtstatus.sh',
+ 't7061-wtstatus-ignore.sh',
+ 't7062-wtstatus-ignorecase.sh',
+ 't7063-status-untracked-cache.sh',
+ 't7064-wtstatus-pv2.sh',
+ 't7101-reset-empty-subdirs.sh',
+ 't7102-reset.sh',
+ 't7103-reset-bare.sh',
+ 't7104-reset-hard.sh',
+ 't7105-reset-patch.sh',
+ 't7106-reset-unborn-branch.sh',
+ 't7107-reset-pathspec-file.sh',
+ 't7110-reset-merge.sh',
+ 't7111-reset-table.sh',
+ 't7112-reset-submodule.sh',
+ 't7113-post-index-change-hook.sh',
+ 't7201-co.sh',
+ 't7300-clean.sh',
+ 't7301-clean-interactive.sh',
+ 't7400-submodule-basic.sh',
+ 't7401-submodule-summary.sh',
+ 't7402-submodule-rebase.sh',
+ 't7403-submodule-sync.sh',
+ 't7406-submodule-update.sh',
+ 't7407-submodule-foreach.sh',
+ 't7408-submodule-reference.sh',
+ 't7409-submodule-detached-work-tree.sh',
+ 't7411-submodule-config.sh',
+ 't7412-submodule-absorbgitdirs.sh',
+ 't7413-submodule-is-active.sh',
+ 't7414-submodule-mistakes.sh',
+ 't7416-submodule-dash-url.sh',
+ 't7417-submodule-path-url.sh',
+ 't7418-submodule-sparse-gitmodules.sh',
+ 't7419-submodule-set-branch.sh',
+ 't7420-submodule-set-url.sh',
+ 't7421-submodule-summary-add.sh',
+ 't7422-submodule-output.sh',
+ 't7423-submodule-symlinks.sh',
+ 't7424-submodule-mixed-ref-formats.sh',
+ 't7450-bad-git-dotfiles.sh',
+ 't7500-commit-template-squash-signoff.sh',
+ 't7501-commit-basic-functionality.sh',
+ 't7502-commit-porcelain.sh',
+ 't7503-pre-commit-and-pre-merge-commit-hooks.sh',
+ 't7504-commit-msg-hook.sh',
+ 't7505-prepare-commit-msg-hook.sh',
+ 't7506-status-submodule.sh',
+ 't7507-commit-verbose.sh',
+ 't7508-status.sh',
+ 't7509-commit-authorship.sh',
+ 't7510-signed-commit.sh',
+ 't7511-status-index.sh',
+ 't7512-status-help.sh',
+ 't7513-interpret-trailers.sh',
+ 't7514-commit-patch.sh',
+ 't7515-status-symlinks.sh',
+ 't7516-commit-races.sh',
+ 't7517-per-repo-email.sh',
+ 't7518-ident-corner-cases.sh',
+ 't7519-status-fsmonitor.sh',
+ 't7520-ignored-hook-warning.sh',
+ 't7521-ignored-mode.sh',
+ 't7524-commit-summary.sh',
+ 't7525-status-rename.sh',
+ 't7526-commit-pathspec-file.sh',
+ 't7527-builtin-fsmonitor.sh',
+ 't7528-signed-commit-ssh.sh',
+ 't7600-merge.sh',
+ 't7601-merge-pull-config.sh',
+ 't7602-merge-octopus-many.sh',
+ 't7603-merge-reduce-heads.sh',
+ 't7604-merge-custom-message.sh',
+ 't7605-merge-resolve.sh',
+ 't7606-merge-custom.sh',
+ 't7607-merge-state.sh',
+ 't7608-merge-messages.sh',
+ 't7609-mergetool--lib.sh',
+ 't7610-mergetool.sh',
+ 't7611-merge-abort.sh',
+ 't7612-merge-verify-signatures.sh',
+ 't7614-merge-signoff.sh',
+ 't7615-diff-algo-with-mergy-operations.sh',
+ 't7700-repack.sh',
+ 't7701-repack-unpack-unreachable.sh',
+ 't7702-repack-cyclic-alternate.sh',
+ 't7703-repack-geometric.sh',
+ 't7704-repack-cruft.sh',
+ 't7800-difftool.sh',
+ 't7810-grep.sh',
+ 't7811-grep-open.sh',
+ 't7812-grep-icase-non-ascii.sh',
+ 't7813-grep-icase-iso.sh',
+ 't7814-grep-recurse-submodules.sh',
+ 't7815-grep-binary.sh',
+ 't7816-grep-binary-pattern.sh',
+ 't7817-grep-sparse-checkout.sh',
+ 't7900-maintenance.sh',
+ 't8001-annotate.sh',
+ 't8002-blame.sh',
+ 't8003-blame-corner-cases.sh',
+ 't8004-blame-with-conflicts.sh',
+ 't8005-blame-i18n.sh',
+ 't8006-blame-textconv.sh',
+ 't8007-cat-file-textconv.sh',
+ 't8008-blame-formats.sh',
+ 't8009-blame-vs-topicbranches.sh',
+ 't8010-cat-file-filters.sh',
+ 't8011-blame-split-file.sh',
+ 't8012-blame-colors.sh',
+ 't8013-blame-ignore-revs.sh',
+ 't8014-blame-ignore-fuzzy.sh',
+ 't9001-send-email.sh',
+ 't9002-column.sh',
+ 't9003-help-autocorrect.sh',
+ 't9100-git-svn-basic.sh',
+ 't9101-git-svn-props.sh',
+ 't9102-git-svn-deep-rmdir.sh',
+ 't9103-git-svn-tracked-directory-removed.sh',
+ 't9104-git-svn-follow-parent.sh',
+ 't9105-git-svn-commit-diff.sh',
+ 't9106-git-svn-commit-diff-clobber.sh',
+ 't9107-git-svn-migrate.sh',
+ 't9108-git-svn-glob.sh',
+ 't9109-git-svn-multi-glob.sh',
+ 't9110-git-svn-use-svm-props.sh',
+ 't9111-git-svn-use-svnsync-props.sh',
+ 't9112-git-svn-md5less-file.sh',
+ 't9113-git-svn-dcommit-new-file.sh',
+ 't9114-git-svn-dcommit-merge.sh',
+ 't9115-git-svn-dcommit-funky-renames.sh',
+ 't9116-git-svn-log.sh',
+ 't9117-git-svn-init-clone.sh',
+ 't9118-git-svn-funky-branch-names.sh',
+ 't9119-git-svn-info.sh',
+ 't9120-git-svn-clone-with-percent-escapes.sh',
+ 't9121-git-svn-fetch-renamed-dir.sh',
+ 't9122-git-svn-author.sh',
+ 't9123-git-svn-rebuild-with-rewriteroot.sh',
+ 't9124-git-svn-dcommit-auto-props.sh',
+ 't9125-git-svn-multi-glob-branch-names.sh',
+ 't9126-git-svn-follow-deleted-readded-directory.sh',
+ 't9127-git-svn-partial-rebuild.sh',
+ 't9128-git-svn-cmd-branch.sh',
+ 't9129-git-svn-i18n-commitencoding.sh',
+ 't9130-git-svn-authors-file.sh',
+ 't9131-git-svn-empty-symlink.sh',
+ 't9132-git-svn-broken-symlink.sh',
+ 't9133-git-svn-nested-git-repo.sh',
+ 't9134-git-svn-ignore-paths.sh',
+ 't9135-git-svn-moved-branch-empty-file.sh',
+ 't9136-git-svn-recreated-branch-empty-file.sh',
+ 't9137-git-svn-dcommit-clobber-series.sh',
+ 't9138-git-svn-authors-prog.sh',
+ 't9139-git-svn-non-utf8-commitencoding.sh',
+ 't9140-git-svn-reset.sh',
+ 't9141-git-svn-multiple-branches.sh',
+ 't9142-git-svn-shallow-clone.sh',
+ 't9143-git-svn-gc.sh',
+ 't9144-git-svn-old-rev_map.sh',
+ 't9145-git-svn-master-branch.sh',
+ 't9146-git-svn-empty-dirs.sh',
+ 't9147-git-svn-include-paths.sh',
+ 't9148-git-svn-propset.sh',
+ 't9150-svk-mergetickets.sh',
+ 't9151-svn-mergeinfo.sh',
+ 't9152-svn-empty-dirs-after-gc.sh',
+ 't9153-git-svn-rewrite-uuid.sh',
+ 't9154-git-svn-fancy-glob.sh',
+ 't9155-git-svn-fetch-deleted-tag.sh',
+ 't9156-git-svn-fetch-deleted-tag-2.sh',
+ 't9157-git-svn-fetch-merge.sh',
+ 't9158-git-svn-mergeinfo.sh',
+ 't9159-git-svn-no-parent-mergeinfo.sh',
+ 't9160-git-svn-preserve-empty-dirs.sh',
+ 't9161-git-svn-mergeinfo-push.sh',
+ 't9162-git-svn-dcommit-interactive.sh',
+ 't9163-git-svn-reset-clears-caches.sh',
+ 't9164-git-svn-dcommit-concurrent.sh',
+ 't9165-git-svn-fetch-merge-branch-of-branch.sh',
+ 't9166-git-svn-fetch-merge-branch-of-branch2.sh',
+ 't9167-git-svn-cmd-branch-subproject.sh',
+ 't9168-git-svn-partially-globbed-names.sh',
+ 't9169-git-svn-dcommit-crlf.sh',
+ 't9200-git-cvsexportcommit.sh',
+ 't9210-scalar.sh',
+ 't9211-scalar-clone.sh',
+ 't9300-fast-import.sh',
+ 't9301-fast-import-notes.sh',
+ 't9302-fast-import-unpack-limit.sh',
+ 't9303-fast-import-compression.sh',
+ 't9304-fast-import-marks.sh',
+ 't9350-fast-export.sh',
+ 't9351-fast-export-anonymize.sh',
+ 't9400-git-cvsserver-server.sh',
+ 't9401-git-cvsserver-crlf.sh',
+ 't9402-git-cvsserver-refs.sh',
+ 't9500-gitweb-standalone-no-errors.sh',
+ 't9501-gitweb-standalone-http-status.sh',
+ 't9502-gitweb-standalone-parse-output.sh',
+ 't9600-cvsimport.sh',
+ 't9601-cvsimport-vendor-branch.sh',
+ 't9602-cvsimport-branches-tags.sh',
+ 't9603-cvsimport-patchsets.sh',
+ 't9604-cvsimport-timestamps.sh',
+ 't9700-perl-git.sh',
+ 't9800-git-p4-basic.sh',
+ 't9801-git-p4-branch.sh',
+ 't9802-git-p4-filetype.sh',
+ 't9803-git-p4-shell-metachars.sh',
+ 't9804-git-p4-label.sh',
+ 't9805-git-p4-skip-submit-edit.sh',
+ 't9806-git-p4-options.sh',
+ 't9807-git-p4-submit.sh',
+ 't9808-git-p4-chdir.sh',
+ 't9809-git-p4-client-view.sh',
+ 't9810-git-p4-rcs.sh',
+ 't9811-git-p4-label-import.sh',
+ 't9812-git-p4-wildcards.sh',
+ 't9813-git-p4-preserve-users.sh',
+ 't9814-git-p4-rename.sh',
+ 't9815-git-p4-submit-fail.sh',
+ 't9816-git-p4-locked.sh',
+ 't9817-git-p4-exclude.sh',
+ 't9818-git-p4-block.sh',
+ 't9819-git-p4-case-folding.sh',
+ 't9820-git-p4-editor-handling.sh',
+ 't9821-git-p4-path-variations.sh',
+ 't9822-git-p4-path-encoding.sh',
+ 't9823-git-p4-mock-lfs.sh',
+ 't9824-git-p4-git-lfs.sh',
+ 't9825-git-p4-handle-utf16-without-bom.sh',
+ 't9826-git-p4-keep-empty-commits.sh',
+ 't9827-git-p4-change-filetype.sh',
+ 't9828-git-p4-map-user.sh',
+ 't9829-git-p4-jobs.sh',
+ 't9830-git-p4-symlink-dir.sh',
+ 't9831-git-p4-triggers.sh',
+ 't9832-unshelve.sh',
+ 't9833-errors.sh',
+ 't9834-git-p4-file-dir-bug.sh',
+ 't9835-git-p4-metadata-encoding-python2.sh',
+ 't9836-git-p4-metadata-encoding-python3.sh',
+ 't9850-shell.sh',
+ 't9901-git-web--browse.sh',
+ 't9902-completion.sh',
+ 't9903-bash-prompt.sh',
+]
+
+# GIT_BUILD_DIR needs to be Unix-style without drive prefixes as it 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 it.
+git_build_dir = meson.project_build_root()
+if cygpath.found()
+ git_build_dir = run_command(cygpath, git_build_dir, check: true).stdout().strip()
+endif
+
+test_environment = script_environment
+test_environment.set('GIT_BUILD_DIR', git_build_dir)
+
+foreach integration_test : integration_tests
+ test(fs.stem(integration_test), shell,
+ args: [ integration_test ],
+ workdir: meson.current_source_dir(),
+ env: test_environment,
+ depends: test_dependencies + bin_wrappers,
+ timeout: 0,
+ )
+endforeach
diff --git a/templates/hooks/meson.build b/templates/hooks/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..5bbb1bd483f24e05f826918fe63391ef72334e11
--- /dev/null
+++ b/templates/hooks/meson.build
@@ -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',
+ )
+endforeach
diff --git a/templates/info/meson.build b/templates/info/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..7af5ddd24985fc0a5888961939ae3b2758f2aaa8
--- /dev/null
+++ b/templates/info/meson.build
@@ -0,0 +1,7 @@
+configure_file(
+ input: 'exclude',
+ output: 'exclude',
+ configuration: template_config,
+ install: true,
+ install_dir: get_option('datadir') / 'git-core/templates',
+)
diff --git a/templates/meson.build b/templates/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..1faf9a44ceaa5a6eee673e66c9d5448c08dbc7d5
--- /dev/null
+++ b/templates/meson.build
@@ -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')
--
2.47.0.251.gb31fb630c0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH RFC v7 22/22] meson: fix conflicts with in-flight topics
2024-11-15 7:21 ` [PATCH RFC v7 00/22] " Patrick Steinhardt
` (20 preceding siblings ...)
2024-11-15 7:21 ` [PATCH RFC v7 21/22] Introduce support for the Meson build system Patrick Steinhardt
@ 2024-11-15 7:21 ` Patrick Steinhardt
2024-11-15 11:17 ` [PATCH RFC v7 00/22] Modernize the build system Patrick Steinhardt
2024-11-16 1:23 ` [-SPAM-] " Ramsay Jones
23 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-15 7:21 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
As support for Meson is still in-flight we have to accommodate for
conflicts with topics in "seen". The following conflicts are being
addressed in this commit:
- ej/cat-file-remote-object-info adds t1017 and "fetch-object-info.c".
- cc/promisor-remote-capability adds t5710.
- ds/path-walk adds t6601 as well as "path-walk.c" and
"test-path-walk.c".
- ps/reftable-detach adds "reftable/system.c".
- js/libgit-rust adds "common-exit.c" and "common-init.c".
- ps/clar-build-improvement adapts the awk(1) script that generates
"clar.suites" to instead be a shell script.
- ds/full-name-hash adds "t/helper/test-name-hash.c".
- cw/worktree-extension deletes t2408.
This is somewhat painful in the current state where Meson is not yet
part of the main tree, but we'll have to live with that for the time
being.
I've split this commit out into a separate fixup-style commit such that
it is possible to test this topic both with and without "seen" merged
into it. You can simply revert this commit to test without "seen".
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
meson.build | 5 +++++
t/helper/meson.build | 2 ++
t/meson.build | 9 +++++----
3 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/meson.build b/meson.build
index 17974eafdd86d9c1b6696868f1497b71caa165a3..f5f6bd183f187540a9a0aa1e02d276d819f54d7a 100644
--- a/meson.build
+++ b/meson.build
@@ -217,6 +217,8 @@ libgit_sources = [
'commit-graph.c',
'commit-reach.c',
'commit.c',
+ 'common-exit.c',
+ 'common-init.c',
'compat/nonblock.c',
'compat/obstack.c',
'compat/terminal.c',
@@ -255,6 +257,7 @@ libgit_sources = [
'ewah/ewah_rlw.c',
'exec-cmd.c',
'fetch-negotiator.c',
+ 'fetch-object-info.c',
'fetch-pack.c',
'fmt-merge-msg.c',
'fsck.c',
@@ -329,6 +332,7 @@ libgit_sources = [
'parse-options.c',
'patch-delta.c',
'patch-ids.c',
+ 'path-walk.c',
'path.c',
'pathspec.c',
'pkt-line.c',
@@ -369,6 +373,7 @@ libgit_sources = [
'reftable/reader.c',
'reftable/record.c',
'reftable/stack.c',
+ 'reftable/system.c',
'reftable/tree.c',
'reftable/writer.c',
'remote.c',
diff --git a/t/helper/meson.build b/t/helper/meson.build
index 5e83884246edc7841738de5085f3255aa1fa3fbe..1d6154ce9756db17bc9f69bc3cd71a32b93857c5 100644
--- a/t/helper/meson.build
+++ b/t/helper/meson.build
@@ -34,12 +34,14 @@ test_tool_sources = [
'test-match-trees.c',
'test-mergesort.c',
'test-mktemp.c',
+ 'test-name-hash.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-path-walk.c',
'test-pcre2-config.c',
'test-pkt-line.c',
'test-proc-receive.c',
diff --git a/t/meson.build b/t/meson.build
index 9ec0b7fa34a033d508448dbd56ab2322a5106fd0..8f0ba136eeb0558f866d7fd3f0559d94139d4777 100644
--- a/t/meson.build
+++ b/t/meson.build
@@ -19,9 +19,8 @@ clar_sources += clar_decls_h
clar_sources += custom_target(
input: clar_decls_h,
output: 'clar.suite',
- feed: true,
- capture: true,
- command : [awk, '-f', meson.current_source_dir() + '/unit-tests/clar-generate.awk'],
+ command : [shell, meson.current_source_dir() + '/unit-tests/generate-clar-suites.sh', '@INPUT@', '@OUTPUT@'],
+ env: script_environment,
)
clar_unit_tests = executable('unit-tests',
@@ -168,6 +167,7 @@ integration_tests = [
't1014-read-tree-confusing.sh',
't1015-read-index-unmerged.sh',
't1016-compatObjectFormat.sh',
+ 't1017-cat-file-remote-object-info.sh',
't1020-subdirectory.sh',
't1021-rerere-in-workdir.sh',
't1022-read-tree-partial-clone.sh',
@@ -297,7 +297,6 @@ integration_tests = [
't2405-worktree-submodule.sh',
't2406-worktree-repair.sh',
't2407-worktree-heads.sh',
- 't2408-worktree-relative.sh',
't2500-untracked-overwriting.sh',
't2501-cwd-empty.sh',
't3000-ls-files-others.sh',
@@ -719,6 +718,7 @@ integration_tests = [
't5703-upload-pack-ref-in-want.sh',
't5704-protocol-violations.sh',
't5705-session-id-in-capabilities.sh',
+ 't5710-promisor-remote-capability.sh',
't5730-protocol-v2-bundle-uri-file.sh',
't5731-protocol-v2-bundle-uri-git.sh',
't5732-protocol-v2-bundle-uri-http.sh',
@@ -821,6 +821,7 @@ integration_tests = [
't6500-gc.sh',
't6501-freshen-objects.sh',
't6600-test-reach.sh',
+ 't6601-path-walk.sh',
't6700-tree-depth.sh',
't7001-mv.sh',
't7002-mv-sparse-checkout.sh',
--
2.47.0.251.gb31fb630c0.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* Re: [PATCH RFC v7 00/22] Modernize the build system
2024-11-15 7:21 ` [PATCH RFC v7 00/22] " Patrick Steinhardt
` (21 preceding siblings ...)
2024-11-15 7:21 ` [PATCH RFC v7 22/22] meson: fix conflicts with in-flight topics Patrick Steinhardt
@ 2024-11-15 11:17 ` Patrick Steinhardt
2024-11-16 1:23 ` [-SPAM-] " Ramsay Jones
23 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-15 11:17 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
On Fri, Nov 15, 2024 at 08:21:12AM +0100, Patrick Steinhardt wrote:
> Hi,
>
> this patch series modernizes our build infrasturcture. It refactors
> various parts of it to make it possible to perform out-of-tree builds in
> theory.
I noticed that building documentation is broken in this version. I've
corrected that up locally, so this will be fixed in the next reroll.
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [PATCH RFC v7 21/22] Introduce support for the Meson build system
2024-11-15 7:21 ` [PATCH RFC v7 21/22] Introduce support for the Meson build system Patrick Steinhardt
@ 2024-11-15 12:20 ` Christian Couder
2024-11-18 9:29 ` Patrick Steinhardt
0 siblings, 1 reply; 386+ messages in thread
From: Christian Couder @ 2024-11-15 12:20 UTC (permalink / raw)
To: Patrick Steinhardt
Cc: git, Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
On Fri, Nov 15, 2024 at 8:21 AM Patrick Steinhardt <ps@pks.im> wrote:
> +# Basic usage
> +# ===========
> +#
> +# In the most trivial case, you can configure, build and install Git like this:
> +#
> +# 1. Set up the build directory. This only needs to happen once per build
> +# directory you want to have. You can also configure multiple different
> +# build directories with different configurations.
> +#
> +# $ meson setup build/
> +#
> +# The build directory gets ignored by Git automatically as Meson will write
> +# a ".gitignore" file into it. From hereon, we will assume that you execute
> +# commands inside this build directory.
> +#
> +# 2. Compile Git. You can either use Meson, Ninja or Samurai to do this, so all
> +# of the following invocations are equivalent:
> +#
> +# $ meson compile
> +# $ ninja
> +# $ samu
> +#
> +# The different invocations should ultimately not make much of a difference.
> +# Using Meson also works with other generators though, like when the build
> +# directory has been set up for use with Microsoft Visual Studio.
I think it might be helpful to say if the above commands are using
multiple processes in parallel (like `make -j 10` for example) to
build or not. If they are using multiple processes, it might be useful
to shortly say how the number of processes used is computed. If they
are not using multiple processes, it might be interesting to say if an
option exists for this or not, and if not, why.
If the above commands use ccache or can use it, or similar tools, it
could be interesting to say so too.
> +#
> +# 3. Execute tests. Again, you can either use Meson, Ninja or Samurai to do this:
> +#
> +# $ meson test
> +# $ ninja test
> +# $ samu test
> +#
> +# It is recommended to use Meson in this case though as it also provides you
> +# additional features that the other build systems don't have available.
> +# You can e.g. pass additional arguments to the test executables or run
> +# individual tests:
> +#
> +# # Execute the t0000-basic integration test and t-reftable-stack unit test.
> +# $ meson test t0000-basic t-reftable-stack
> +#
> +# # Execute all reftable unit tests.
> +# $ meson test t-reftable-*
> +#
> +# # Execute all tests and stop with the first failure.
> +# $ meson test --maxfail 1
> +#
> +# # Execute single test interactively such that features like `debug ()` work.
> +# $ meson test -i --test-args='-ix' t1400-update-ref
How about executing tests in parallel? I am asking because it's an
easy way to speed up test execution.
> +# 4. Install the Git distribution. Again, this can be done via Meson, Ninja or
> +# Samurai:
> +#
> +# $ meson install
> +# $ ninja install
> +# $ samu install
> +#
> +# The prefix into which Git shall be installed is defined when setting up
> +# the build directory. More on that in the "Configuration" section.
> +#
> +# Meson supports multiple backends. The default backend generates Ninja build
> +# instructions, but it also supports the generation of Microsoft Visual
> +# Studio solutions as well as Xcode projects. IDEs like Eclipse and Visual
> +# Studio Code provide plugins to import Meson files directly.
So I guess it's not necessary to configure Meson to make it use a
backend that generates VS Code or Xcode projects.
> +# Configuration
> +# =============
> +#
> +# The exact configuration of Git is determined when setting up the build
> +# directory via `meson setup`. Unless told otherwise, Meson will automatically
> +# detect the availability of various bits and pieces. There are two different
> +# kinds of options that can be used to further tweak the build:
> +#
> +# - Built-in options provided by Meson.
> +#
> +# - Options defined by the project in the "meson_options.txt" file.
> +#
> +# Both kinds of options can be inspected by running `meson configure` in the
> +# build directory, which will give you a list of the current value for all
> +# options.
> +#
> +# Options can be configured either when setting up the build directory or can
> +# be changed in preexisting build directories:
> +#
> +# # Set up a new build directory with optimized settings that will be
> +# # installed into an alternative prefix.
> +# $ meson setup --buildtype release --optimization 3 --strip --prefix=/home/$USER build
"build" is the name that was already given to the build directory
above in this doc, so it might be better to use something else, like
maybe "build-optimized/".
> +# # Set up a new build directory with a higher warning level. Level 2 is
> +# # mostly equivalent to setting DEVELOPER=1, level 3 and "everything"
> +# # will enable even more warnings.
> +# $ meson setup -Dwarning_level=2
There is no name for the new build directory in the above command,
maybe something like "build-warning/" should be added.
> +# # Set up a new build directory with 'address' and 'undefined' sanitizers
> +# # using Clang.
> +# $ CC=clang meson setup -Db_sanitize=address,undefined build
Maybe "build-address/" instead of "build".
> +# # Disable tests in a preexisting build directory.
> +# $ meson configure -Dtests=false
What happens if we run `meson test` then?
> +# # Disable features based on Python
> +# $ meson configure -Dpython=disabled
> +#
> +# Options have a type like booleans, choices, strings or features. Features are
> +# somewhat special as they can have one of three values: enabled, disabled or
> +# auto. While the first two values are self-explanatory, "auto" will enable or
> +# disable the feature based on the availability of prerequisites to support it.
> +# Python-based features for example will be enabled automatically when a Python
> +# interpreter could be found. The default value of such features can be changed
> +# globally via `meson setup --auto-features={enabled,disabled,auto}`, which
> +# will set the value of all features with a value of "auto" to the provided one
> +# by default.
"globally" here means for all the builds directories of the current
system user, or for all the build directories inside the directory
where `meson setup --auto-features={enabled,disabled,auto}` was run,
or just for all the features in the current build directory if this is
run inside a build directory?
> +# It is also possible to store a set of configuration options in machine files.
> +# This can be useful in case you regularly want to reuse the same set of options:
> +#
> +# [binaries]
> +# c = ['clang']
> +# ar = ['ar']
> +#
> +# [project options]
> +# gettext = 'disabled'
> +# default_editor = 'vim'
> +#
> +# [built-in options]
> +# b_lto = true
> +# b_sanitize = 'address,undefined'
> +#
> +# These machine files can be passed to Meson via `meson setup --native-file`.
I think it might be helpful to say that "machine files" is the name
used by meson for basically "config files".
Also it's not very clear which build directories will be impacted when
`meson setup --native-file my-machine-file` is run.
> +# Subproject wrappers
> +# ===================
> +#
> +# Subproject wrappers are a feature provided by Meson that allow the automatic
s/allow/allows/
> +# fallback to a "wrapped" dependency in case the dependency is not provided by
> +# the system. For example if the system is lacking curl, then Meson will use
> +# "subprojects/curl.wrap" to set up curl as a subproject and compile and link
> +# the dependency into Git itself. This is especially helpful on systems like
> +# Windows, where you typically don't have such dependencies installed.
> +#
> +# The use of subproject wrappers can be disabled by executing `meson setup
> +# --wrap-mode nofallback`.
It's not very clear which build directories will be impacted by this command.
Thanks.
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [-SPAM-] [PATCH RFC v7 00/22] Modernize the build system
2024-11-15 7:21 ` [PATCH RFC v7 00/22] " Patrick Steinhardt
` (22 preceding siblings ...)
2024-11-15 11:17 ` [PATCH RFC v7 00/22] Modernize the build system Patrick Steinhardt
@ 2024-11-16 1:23 ` Ramsay Jones
2024-11-18 9:30 ` Patrick Steinhardt
23 siblings, 1 reply; 386+ messages in thread
From: Ramsay Jones @ 2024-11-16 1:23 UTC (permalink / raw)
To: Patrick Steinhardt, git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Taylor Blau, David Aguilar, Jeff King, Christian Couder
On 15/11/2024 07:21, Patrick Steinhardt wrote:
[snip]
> Changes in v7:
>
> - Fix overriding TEST_OUTPUT_DIRECTORY via the environment.
>
> - Rework generation of version information. GIT-VERSION-GEN now knows
> to replace @PLACEHOLDERS@ in other files, and this gets used across
> Makefiles, CMake and Meson now. This makes us properly rebuild when
> the version info changes and fixes the version numbers in "git.rc".
>
> - The CMake build instructions are now doing a proper out-of-tree
> build.
>
> - We now generate and install gitweb.js, which gets built via a new
> "generate-gitweb-js.sh".
>
> - Some improvements to the Meson documentation.
>
> - Wire up DEVELOPER=1 style warnings via `--warnlevel 2` and above.
>
> - Wire up sanitizers properly.
>
> - Provide a new "regex" option to disable the platform-provided
> version of regcomp() et al.
Hmm, OK, but what about all the other 'configurations'?
>
> - Stop installing git-http-backend into bindir.
>
> - Install Perl scripts into libexecdir.
>
> - Install git-cvsserver into bindir and libexecdir.
>
> - Install template directory into datadir.
>
> As before, the tip of this patch series catches up with what is
> happening in "seen". If you want to test it without topics in "seen" you
> have to revert it.
>
Just a quick note to say that I tested this on Linux and Cygwin (just build)
and noticed a few things:
- 'make clean' does not delete the 'version-def.h' file.
- the RUNTIME_PREFIX set in the GIT-BUILD-OPTIONS file on the master
branch is not the same as on this 'meson-v7' branch (patches 1-21
based on current master branch):
$ diff GBO-master GIT-BUILD-OPTIONS
3a4,5
> PERL_LOCALEDIR='/home/ramsay/share/locale'
> NO_PERL_CPAN_FALLBACKS=''
19a22,28
> FSMONITOR_DAEMON_BACKEND=''
> FSMONITOR_OS_SETTINGS=''
> TEST_OUTPUT_DIRECTORY=''
> GIT_TEST_OPTS=''
> GIT_TEST_CMP=''
> GIT_TEST_CMP_USE_COPIED_CONTEXT=''
> GIT_TEST_UTF8_LOCALE=''
20a30,36
> GIT_PERF_REPEAT_COUNT=''
> GIT_PERF_REPO=''
> GIT_PERF_LARGE_REPO=''
> GIT_PERF_MAKE_OPTS=''
> GIT_PERF_MAKE_COMMAND=''
> GIT_INTEROP_MAKE_OPTS=''
> GIT_TEST_INDEX_VERSION=''
22c38,47
< RUNTIME_PREFIX='false'
---
> GIT_TEST_TEXTDOMAINDIR='/home/ramsay/git/po/build/locale'
> GIT_TEST_POPATH='/home/ramsay/git/po'
> GIT_TEST_TEMPLATE_DIR='/home/ramsay/git/templates/blt'
> GIT_TEST_GITPERLLIB='/home/ramsay/git/perl/build/lib'
> GIT_TEST_MERGE_TOOLS_DIR='/home/ramsay/git/mergetools'
> RUNTIME_PREFIX=''
> GITWEBDIR='/home/ramsay/share/gitweb'
> USE_GETTEXT_SCHEME=''
> LOCALEDIR='/home/ramsay/share/locale'
> BROKEN_PATH_FIX='/^# @BROKEN_PATH_FIX@$/d'
$
Note that master has RUNTIME_PREFIX='false' rather than being un-set.
(Indeed, the Makefile on the master branch normalizes the value of
RUNTIME_PREFIX to 'true' or 'false').
- I used the new 'regex' variable, on cygwin, like so:
$ meson setup .. -Dprefix=$HOME -Dregex=disabled
after first trying '-Dregex' and then '-Dregex=1', because why not? ;)
This correctly set NO_REGEX=1 in the build.
- As a result of the above, the grep-binary test now behaves the same
way as on Linux (ie that test now 'fails' instead of unexpectedly
passing). Note:
$ meson test 't7815-*'
ninja: Entering directory `/home/ramsay/git/build'
[2/9] Generating GIT-VERSION-FILE with a custom command
1/1 t7815-grep-binary OK 7.55s
Ok: 1
Expected Fail: 0
Fail: 0
Unexpected Pass: 0
Skipped: 0
Timeout: 0
Full log written to /home/ramsay/git/build/meson-logs/testlog.txt
$ vim meson-logs/testlog.txt # test 12 again '# TODO known breakage'
$
- The format of the GIT-BUILD-OPTIONS file generated by the Makefile
and meson are formatted differently, so you have to massage the
top-level file to be able to diff them:
$ sed -e 's/\x27\x27//' GIT-BUILD-OPTIONS |
> sed -e 's/\x27/"/g' >GBO
$ diff GBO build/GIT-BUILD-OPTIONS
1,2c1,2
< SHELL_PATH="/bin/sh"
< TEST_SHELL_PATH="/bin/sh"
---
> SHELL_PATH="/usr/bin/sh"
> TEST_SHELL_PATH="/usr/bin/sh"
6c6
< DIFF="diff"
---
> DIFF="/usr/bin/diff"
8c8
< TAR="tar"
---
> TAR="/usr/bin/tar"
12c12
< USE_LIBPCRE2=
---
> USE_LIBPCRE2=1
21,24c21,24
< X=
< FSMONITOR_DAEMON_BACKEND=
< FSMONITOR_OS_SETTINGS=
< TEST_OUTPUT_DIRECTORY=
---
> X=""
> FSMONITOR_DAEMON_BACKEND=""
> FSMONITOR_OS_SETTINGS=""
> TEST_OUTPUT_DIRECTORY="/home/ramsay/git/build/test-output"
26c26
< GIT_TEST_CMP=
---
> GIT_TEST_CMP="/usr/bin/diff -u"
37,38c37,38
< GIT_TEST_PERL_FATAL_WARNINGS="YesPlease"
< GIT_TEST_TEXTDOMAINDIR="/home/ramsay/git/po/build/locale"
---
> GIT_TEST_PERL_FATAL_WARNINGS=
> GIT_TEST_TEXTDOMAINDIR="/home/ramsay/git/build/po"
40,41c40,41
< GIT_TEST_TEMPLATE_DIR="/home/ramsay/git/templates/blt"
< GIT_TEST_GITPERLLIB="/home/ramsay/git/perl/build/lib"
---
> GIT_TEST_TEMPLATE_DIR="/home/ramsay/git/build/templates"
> GIT_TEST_GITPERLLIB="/home/ramsay/git/build/perl"
44c44
< GITWEBDIR="/home/ramsay/share/gitweb"
---
> GITWEBDIR=/home/ramsay/share/gitweb
47c47
< BROKEN_PATH_FIX="/^# @BROKEN_PATH_FIX@$/d"
---
> BROKEN_PATH_FIX=
$
Note that the Makefile build on Linux does not, by default, build with
libpcre, even if the library is installed on the system (as it is for me).
Also, note the values of BROKEN_PATH_FIX.
[This was on Linux; cygwin is similar but not identical]
ATB,
Ramsay Jones
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [PATCH RFC v7 21/22] Introduce support for the Meson build system
2024-11-15 12:20 ` Christian Couder
@ 2024-11-18 9:29 ` Patrick Steinhardt
0 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-18 9:29 UTC (permalink / raw)
To: Christian Couder
Cc: git, Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
On Fri, Nov 15, 2024 at 01:20:55PM +0100, Christian Couder wrote:
> On Fri, Nov 15, 2024 at 8:21 AM Patrick Steinhardt <ps@pks.im> wrote:
>
> > +# Basic usage
> > +# ===========
> > +#
> > +# In the most trivial case, you can configure, build and install Git like this:
> > +#
> > +# 1. Set up the build directory. This only needs to happen once per build
> > +# directory you want to have. You can also configure multiple different
> > +# build directories with different configurations.
> > +#
> > +# $ meson setup build/
> > +#
> > +# The build directory gets ignored by Git automatically as Meson will write
> > +# a ".gitignore" file into it. From hereon, we will assume that you execute
> > +# commands inside this build directory.
> > +#
> > +# 2. Compile Git. You can either use Meson, Ninja or Samurai to do this, so all
> > +# of the following invocations are equivalent:
> > +#
> > +# $ meson compile
> > +# $ ninja
> > +# $ samu
> > +#
> > +# The different invocations should ultimately not make much of a difference.
> > +# Using Meson also works with other generators though, like when the build
> > +# directory has been set up for use with Microsoft Visual Studio.
>
> I think it might be helpful to say if the above commands are using
> multiple processes in parallel (like `make -j 10` for example) to
> build or not. If they are using multiple processes, it might be useful
> to shortly say how the number of processes used is computed. If they
> are not using multiple processes, it might be interesting to say if an
> option exists for this or not, and if not, why.
Yup, will add a note. Ninja and Samurai scale with the number of
processor cores by default. The number of jobs can be changed with the
`-jN` flag.
> If the above commands use ccache or can use it, or similar tools, it
> could be interesting to say so too.
Added a note.
> > +#
> > +# 3. Execute tests. Again, you can either use Meson, Ninja or Samurai to do this:
> > +#
> > +# $ meson test
> > +# $ ninja test
> > +# $ samu test
> > +#
> > +# It is recommended to use Meson in this case though as it also provides you
> > +# additional features that the other build systems don't have available.
> > +# You can e.g. pass additional arguments to the test executables or run
> > +# individual tests:
> > +#
> > +# # Execute the t0000-basic integration test and t-reftable-stack unit test.
> > +# $ meson test t0000-basic t-reftable-stack
> > +#
> > +# # Execute all reftable unit tests.
> > +# $ meson test t-reftable-*
> > +#
> > +# # Execute all tests and stop with the first failure.
> > +# $ meson test --maxfail 1
> > +#
> > +# # Execute single test interactively such that features like `debug ()` work.
> > +# $ meson test -i --test-args='-ix' t1400-update-ref
>
> How about executing tests in parallel? I am asking because it's an
> easy way to speed up test execution.
Tests are executed in parallel by default. Same as above, you can change
this with `-jN`.
> > +# 4. Install the Git distribution. Again, this can be done via Meson, Ninja or
> > +# Samurai:
> > +#
> > +# $ meson install
> > +# $ ninja install
> > +# $ samu install
> > +#
> > +# The prefix into which Git shall be installed is defined when setting up
> > +# the build directory. More on that in the "Configuration" section.
> > +#
> > +# Meson supports multiple backends. The default backend generates Ninja build
> > +# instructions, but it also supports the generation of Microsoft Visual
> > +# Studio solutions as well as Xcode projects. IDEs like Eclipse and Visual
> > +# Studio Code provide plugins to import Meson files directly.
>
> So I guess it's not necessary to configure Meson to make it use a
> backend that generates VS Code or Xcode projects.
I've added a note on how to set the backend.
> > +# Configuration
> > +# =============
> > +#
> > +# The exact configuration of Git is determined when setting up the build
> > +# directory via `meson setup`. Unless told otherwise, Meson will automatically
> > +# detect the availability of various bits and pieces. There are two different
> > +# kinds of options that can be used to further tweak the build:
> > +#
> > +# - Built-in options provided by Meson.
> > +#
> > +# - Options defined by the project in the "meson_options.txt" file.
> > +#
> > +# Both kinds of options can be inspected by running `meson configure` in the
> > +# build directory, which will give you a list of the current value for all
> > +# options.
> > +#
> > +# Options can be configured either when setting up the build directory or can
> > +# be changed in preexisting build directories:
> > +#
> > +# # Set up a new build directory with optimized settings that will be
> > +# # installed into an alternative prefix.
> > +# $ meson setup --buildtype release --optimization 3 --strip --prefix=/home/$USER build
>
> "build" is the name that was already given to the build directory
> above in this doc, so it might be better to use something else, like
> maybe "build-optimized/".
It's only an example anyway, so I don't think it matters much whether
the directory names repeat. Same with the following commands.
> > +# # Set up a new build directory with a higher warning level. Level 2 is
> > +# # mostly equivalent to setting DEVELOPER=1, level 3 and "everything"
> > +# # will enable even more warnings.
> > +# $ meson setup -Dwarning_level=2
>
> There is no name for the new build directory in the above command,
> maybe something like "build-warning/" should be added.
>
> > +# # Set up a new build directory with 'address' and 'undefined' sanitizers
> > +# # using Clang.
> > +# $ CC=clang meson setup -Db_sanitize=address,undefined build
>
> Maybe "build-address/" instead of "build".
>
> > +# # Disable tests in a preexisting build directory.
> > +# $ meson configure -Dtests=false
>
> What happens if we run `meson test` then?
Meson simply prints "No tests defined."
> > +# # Disable features based on Python
> > +# $ meson configure -Dpython=disabled
> > +#
> > +# Options have a type like booleans, choices, strings or features. Features are
> > +# somewhat special as they can have one of three values: enabled, disabled or
> > +# auto. While the first two values are self-explanatory, "auto" will enable or
> > +# disable the feature based on the availability of prerequisites to support it.
> > +# Python-based features for example will be enabled automatically when a Python
> > +# interpreter could be found. The default value of such features can be changed
> > +# globally via `meson setup --auto-features={enabled,disabled,auto}`, which
> > +# will set the value of all features with a value of "auto" to the provided one
> > +# by default.
>
> "globally" here means for all the builds directories of the current
> system user, or for all the build directories inside the directory
> where `meson setup --auto-features={enabled,disabled,auto}` was run,
> or just for all the features in the current build directory if this is
> run inside a build directory?
The last one. I'll just drop this word.
> > +# It is also possible to store a set of configuration options in machine files.
> > +# This can be useful in case you regularly want to reuse the same set of options:
> > +#
> > +# [binaries]
> > +# c = ['clang']
> > +# ar = ['ar']
> > +#
> > +# [project options]
> > +# gettext = 'disabled'
> > +# default_editor = 'vim'
> > +#
> > +# [built-in options]
> > +# b_lto = true
> > +# b_sanitize = 'address,undefined'
> > +#
> > +# These machine files can be passed to Meson via `meson setup --native-file`.
>
> I think it might be helpful to say that "machine files" is the name
> used by meson for basically "config files".
>
> Also it's not very clear which build directories will be impacted when
> `meson setup --native-file my-machine-file` is run.
As `meson setup` sets up a new build directory it is that particular
directory. I've reworded this a bit.
> > +# Subproject wrappers
> > +# ===================
> > +#
> > +# Subproject wrappers are a feature provided by Meson that allow the automatic
>
> s/allow/allows/
>
> > +# fallback to a "wrapped" dependency in case the dependency is not provided by
> > +# the system. For example if the system is lacking curl, then Meson will use
> > +# "subprojects/curl.wrap" to set up curl as a subproject and compile and link
> > +# the dependency into Git itself. This is especially helpful on systems like
> > +# Windows, where you typically don't have such dependencies installed.
> > +#
> > +# The use of subproject wrappers can be disabled by executing `meson setup
> > +# --wrap-mode nofallback`.
>
> It's not very clear which build directories will be impacted by this command.
Reformulated slightly.
Thanks for your feedback!
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [-SPAM-] [PATCH RFC v7 00/22] Modernize the build system
2024-11-16 1:23 ` [-SPAM-] " Ramsay Jones
@ 2024-11-18 9:30 ` Patrick Steinhardt
2024-11-18 12:48 ` Junio C Hamano
0 siblings, 1 reply; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-18 9:30 UTC (permalink / raw)
To: Ramsay Jones
Cc: git, Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Taylor Blau, David Aguilar, Jeff King, Christian Couder
On Sat, Nov 16, 2024 at 01:23:19AM +0000, Ramsay Jones wrote:
> On 15/11/2024 07:21, Patrick Steinhardt wrote:
> [snip]
> > Changes in v7:
> >
> > - Fix overriding TEST_OUTPUT_DIRECTORY via the environment.
> >
> > - Rework generation of version information. GIT-VERSION-GEN now knows
> > to replace @PLACEHOLDERS@ in other files, and this gets used across
> > Makefiles, CMake and Meson now. This makes us properly rebuild when
> > the version info changes and fixes the version numbers in "git.rc".
> >
> > - The CMake build instructions are now doing a proper out-of-tree
> > build.
> >
> > - We now generate and install gitweb.js, which gets built via a new
> > "generate-gitweb-js.sh".
> >
> > - Some improvements to the Meson documentation.
> >
> > - Wire up DEVELOPER=1 style warnings via `--warnlevel 2` and above.
> >
> > - Wire up sanitizers properly.
> >
> > - Provide a new "regex" option to disable the platform-provided
> > version of regcomp() et al.
>
> Hmm, OK, but what about all the other 'configurations'?
I don't think it makes sense to introduce a separate option for every
single bit of the build process that can be changed. One of the biggest
differences compared to our Makefile is that Meson should be able to
automatically figure out the build environment and set up the build
accordingly, without any user interaction. So in the best case, whenever
we learn that a system does not work out of the box we'd not introduce
an option for this, but instead adapt the autoconfiguration logic to
detect that.
Now there will be exceptions where it does make sense to make something
a build option, due to whatever reason. But I'm in the camp of adding
them as-needed and not proactively so that we don't end up with hundreds
of options.
> > - Stop installing git-http-backend into bindir.
> >
> > - Install Perl scripts into libexecdir.
> >
> > - Install git-cvsserver into bindir and libexecdir.
> >
> > - Install template directory into datadir.
> >
> > As before, the tip of this patch series catches up with what is
> > happening in "seen". If you want to test it without topics in "seen" you
> > have to revert it.
> >
>
> Just a quick note to say that I tested this on Linux and Cygwin (just build)
> and noticed a few things:
>
> - 'make clean' does not delete the 'version-def.h' file.
This works now with the latest option.
> - the RUNTIME_PREFIX set in the GIT-BUILD-OPTIONS file on the master
> branch is not the same as on this 'meson-v7' branch (patches 1-21
> based on current master branch):
>
[snip]
>
> Note that master has RUNTIME_PREFIX='false' rather than being un-set.
> (Indeed, the Makefile on the master branch normalizes the value of
> RUNTIME_PREFIX to 'true' or 'false').
Ah, good catch, corrected.
> - The format of the GIT-BUILD-OPTIONS file generated by the Makefile
> and meson are formatted differently, so you have to massage the
> top-level file to be able to diff them:
>
[snip]
>
> Note that the Makefile build on Linux does not, by default, build with
> libpcre, even if the library is installed on the system (as it is for me).
I think building with libpcre by default does make sense though. I guess
that we don't with our Makefile because it's not doing autodetection of
available features in the first place, so it was safer to not compile
with the library by default.
> Also, note the values of BROKEN_PATH_FIX.
I've wired up the SANE_TOOL_PATH option properly now.
Thanks for your feedback!
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [-SPAM-] [PATCH RFC v7 00/22] Modernize the build system
2024-11-18 9:30 ` Patrick Steinhardt
@ 2024-11-18 12:48 ` Junio C Hamano
2024-11-18 13:05 ` Patrick Steinhardt
0 siblings, 1 reply; 386+ messages in thread
From: Junio C Hamano @ 2024-11-18 12:48 UTC (permalink / raw)
To: Patrick Steinhardt
Cc: Ramsay Jones, git, Eli Schwartz, Eric Sunshine, Phillip Wood,
Taylor Blau, David Aguilar, Jeff King, Christian Couder
Patrick Steinhardt <ps@pks.im> writes:
> Now there will be exceptions where it does make sense to make something
> a build option, due to whatever reason. But I'm in the camp of adding
> them as-needed and not proactively so that we don't end up with hundreds
> of options.
Surely, your system may have openssl installed, but for
non-technical reasons you may not want your Git to link with it,
which is impossible to auto-detect, of course.
To be quite honest, while I am very much sympathetic to the above,
in practice, I am afraid that these knobs we _already_ have in our
Makefile are exceptions that was added due to whatever reason "as
needed". Dropping any of them would mean that you are declaring
this: by default, all the past exceptions we made are nullified and
you have to resubmit for requalification if you want to keep your
favourite one.
That's not a very nice way to run the project, though.
Thanks.
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [-SPAM-] [PATCH RFC v7 00/22] Modernize the build system
2024-11-18 12:48 ` Junio C Hamano
@ 2024-11-18 13:05 ` Patrick Steinhardt
2024-11-18 23:39 ` Junio C Hamano
0 siblings, 1 reply; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-18 13:05 UTC (permalink / raw)
To: Junio C Hamano
Cc: Ramsay Jones, git, Eli Schwartz, Eric Sunshine, Phillip Wood,
Taylor Blau, David Aguilar, Jeff King, Christian Couder
On Mon, Nov 18, 2024 at 09:48:06PM +0900, Junio C Hamano wrote:
> Patrick Steinhardt <ps@pks.im> writes:
>
> > Now there will be exceptions where it does make sense to make something
> > a build option, due to whatever reason. But I'm in the camp of adding
> > them as-needed and not proactively so that we don't end up with hundreds
> > of options.
>
> Surely, your system may have openssl installed, but for
> non-technical reasons you may not want your Git to link with it,
> which is impossible to auto-detect, of course.
>
> To be quite honest, while I am very much sympathetic to the above,
> in practice, I am afraid that these knobs we _already_ have in our
> Makefile are exceptions that was added due to whatever reason "as
> needed". Dropping any of them would mean that you are declaring
> this: by default, all the past exceptions we made are nullified and
> you have to resubmit for requalification if you want to keep your
> favourite one.
>
> That's not a very nice way to run the project, though.
There is a difference though: you are talking about actual features
wired into Git, whereas I'm talking about other things like "Does the
system have `uintmax_t`?".
The former is a strong must to be toggled by the user, and it is already
wired up like this: you can choose to compile without OpenSSL and any
other optional library with Meson. All toggles we have in this context
in our Makefile must be supported by Meson. While auto-detection is nice
to have, it is mandatory that the detection can be disabled.
But for the second group I'm sceptical whether these really should be
configurable by the developer. Why would you care whether you use
`uintmax_t` provided by the system or by Git as a compat macro? I don't
see a strong reason to let the developer override this in a build system
that knows to auto-detect the availability of such features.
Now as said, there may be cases where it indeed is useful, but in
general I don't think it is.
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [-SPAM-] [PATCH RFC v7 00/22] Modernize the build system
2024-11-18 13:05 ` Patrick Steinhardt
@ 2024-11-18 23:39 ` Junio C Hamano
0 siblings, 0 replies; 386+ messages in thread
From: Junio C Hamano @ 2024-11-18 23:39 UTC (permalink / raw)
To: Patrick Steinhardt
Cc: Ramsay Jones, git, Eli Schwartz, Eric Sunshine, Phillip Wood,
Taylor Blau, David Aguilar, Jeff King, Christian Couder
Patrick Steinhardt <ps@pks.im> writes:
> But for the second group I'm sceptical whether these really should be
> configurable by the developer. Why would you care whether you use
> `uintmax_t` provided by the system or by Git as a compat macro? I don't
> see a strong reason to let the developer override this in a build system
> that knows to auto-detect the availability of such features.
>
> Now as said, there may be cases where it indeed is useful, but in
> general I don't think it is.
I think we are on the same page, then. When you said "detect", my
primarily thought was "uintmax_t and the presense of OpenSSL are
both auto-detectable, but the latter is a choice---forcing folks to
fight again to support the choice is unnice", while auto-detection
of the former in my mind was a given (perhaps think of "make +
autoconf" in an ideal world as a baseline for comparison).
There may be cases where it may be handy to pretend that types and
library functions your system offers do _not_ exist, for various
purposes like test-building or performance tuning, but these
purposes are of lessor importance than exclusion by policy, I would
say.
^ permalink raw reply [flat|nested] 386+ messages in thread
* [PATCH v8 00/23] Modernize the build system
2024-10-02 15:15 [RFC PATCH 00/21] Modernize the build system Patrick Steinhardt
` (27 preceding siblings ...)
2024-11-15 7:21 ` [PATCH RFC v7 00/22] " Patrick Steinhardt
@ 2024-11-19 11:50 ` Patrick Steinhardt
2024-11-19 11:50 ` [PATCH v8 01/23] Makefile: use common template for GIT-BUILD-OPTIONS Patrick Steinhardt
` (23 more replies)
2024-11-25 9:56 ` [PATCH v9 " Patrick Steinhardt
` (2 subsequent siblings)
31 siblings, 24 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-19 11:50 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
Hi,
this patch series modernizes our build infrasturcture. It refactors
various parts of it to make it possible to perform out-of-tree builds in
theory.
The series then continues to wire up Meson as a proposed alternative as
a modern replacement for our current build systems. It provides better
integration into IDEs than our Makefiles, better usability than our
Makefiles and CMake, better configuration and discoverability thereof
than autoconf and CMake (which is of course my personal opinion).
The intent is to have Meson replace autoconf, which is mostly unused and
broken. Eventually, the plan would to also replace CMake and our
Makefiles in case we figure out that this replacement is indeed a net
benefit for the project, but all of this would happen over the course of
multiple releases.
Changes in v8:
- Fix compilation when Git is not found in PATH.
- Fix undefined `git_version` variable when compiling docs.
- Rework how we propagate version attributes into AsciiDoc and
AsciiDoctor.
- Fix indentation of `cmd_lists` array.
- Avoid rebuilding files generated via GIT-VERSION-GEN unless
GIT-VERSION-FILE has changed.
- Fix RUNTIME_PREFIX value in GIT-BUILD-OPTIONS.
- Rework the HTTPS backend selection so that it is now a choice
instead of multiple separate options. The default value is 'auto',
which will auto-detect available backends. Other supported values
are 'openssl', 'CommonCrypto' or 'none'.
- Print a summary of auto-detected features at the end of `meson
setup`:
Auto-detected features
curl : false
expat : true
gettext : true
https : none
iconv : true
pcre2 : true
perl : true
python : true
User defined options
curl : disabled
https_backend: none
sha1_backend : sha1dc
I consider this version to be basically complete. Of course there are
still some bits and pieces missing, like e.g. "git-gui" or "gitk". But
the base is there and works as expected. I've also started daily driving
the Meson-based build now as my main Git installation to verify that it
works as expected. I've thus removed the RFC prefix, even though the
discussion will of course still go on.
As before, the tip of this patch series catches up with what is
happening in "seen". If you want to test it without topics in "seen" you
have to revert it.
Links to previous versions:
- Link to v1: https://lore.kernel.org/r/cover.1727881164.git.ps@pks.im
- Link to v2: https://lore.kernel.org/r/cover.1728485139.git.ps@pks.im
- Link to v3: https://lore.kernel.org/r/cover.1729254070.git.ps@pks.im
- Link to v4: https://lore.kernel.org/r/cover.1729771605.git.ps@pks.im
- Link to v5: https://lore.kernel.org/r/cover.1731335938.git.ps@pks.im
- Link to v6: https://lore.kernel.org/r/20241112-pks-meson-v6-0-648b30996827@pks.im
- Link to v7: https://lore.kernel.org/r/20241115-pks-meson-v7-0-47ec19b780b2@pks.im
Thanks!
Patrick
---
Patrick Steinhardt (23):
Makefile: use common template for GIT-BUILD-OPTIONS
Makefile: consistently use @PLACEHOLDER@ to substitute
Makefile: refactor GIT-VERSION-GEN to be reusable
Makefile: propagate Git version via generated header
Makefile: generate "git.rc" via GIT-VERSION-GEN
Makefile: generate doc versions via GIT-VERSION-GEN
Makefile: consistently use PERL_PATH
Makefile: extract script to massage Perl scripts
Makefile: use "generate-perl.sh" to massage Perl library
Makefile: extract script to massage Shell scripts
Makefile: extract script to generate gitweb.cgi
Makefile: extract script to generate gitweb.js
Makefile: refactor generators to be PWD-independent
Makefile: allow "bin-wrappers/" directory to exist
Makefile: simplify building of templates
Documentation: allow sourcing generated includes from separate dir
Documentation: teach "cmd-list.perl" about out-of-tree builds
Documentation: extract script to generate a list of mergetools
t: better support for out-of-tree builds
t: allow overriding build dir
Documentation: add comparison of build systems
Introduce support for the Meson build system
meson: fix conflicts with in-flight topics
.gitignore | 3 +-
Documentation/.gitignore | 2 +
Documentation/CodingGuidelines | 2 +-
Documentation/Makefile | 46 +-
Documentation/{asciidoc.conf => asciidoc.conf.in} | 3 +
...-extensions.rb => asciidoctor-extensions.rb.in} | 8 +-
Documentation/build-docdep.perl | 2 +
Documentation/cmd-list.perl | 23 +-
Documentation/config/diff.txt | 2 +-
Documentation/config/merge.txt | 2 +-
Documentation/generate-mergetool-list.sh | 17 +
Documentation/git.txt | 24 +-
Documentation/meson.build | 324 ++++
Documentation/technical/build-systems.txt | 224 +++
GIT-BUILD-OPTIONS.in | 47 +
GIT-VERSION-FILE.in | 1 +
GIT-VERSION-GEN | 64 +-
Makefile | 238 ++-
bin-wrappers/.gitignore | 9 +
bin-wrappers/meson.build | 28 +
bin-wrappers/wrap-for-bin.sh | 37 +
ci/test-documentation.sh | 2 +-
configure.ac | 2 +-
contrib/buildsystems/CMakeLists.txt | 287 +--
contrib/buildsystems/git-version.in | 1 +
contrib/completion/meson.build | 8 +
contrib/meson.build | 1 +
generate-cmdlist.sh | 42 +-
generate-configlist.sh | 20 +-
generate-hooklist.sh | 15 +-
generate-perl.sh | 37 +
generate-script.sh | 34 +
git-cvsserver.perl | 2 +-
git-instaweb.sh | 8 +-
git-request-pull.sh | 2 +-
git-send-email.perl | 2 +-
git-sh-i18n.sh | 6 +-
git-sh-setup.sh | 6 +-
git-svn.perl | 2 +-
git.rc => git.rc.in | 6 +-
gitk-git/po/vi.po | 2 +-
gitweb/GITWEB-BUILD-OPTIONS.in | 24 +
gitweb/Makefile | 62 +-
gitweb/generate-gitweb-cgi.sh | 47 +
gitweb/generate-gitweb-js.sh | 12 +
gitweb/gitweb.perl | 44 +-
gitweb/meson.build | 79 +
meson.build | 1894 ++++++++++++++++++++
meson_options.txt | 81 +
perl/FromCPAN/Mail/meson.build | 7 +
perl/FromCPAN/meson.build | 9 +
perl/Git/I18N.pm | 6 +-
perl/Git/LoadCPAN.pm | 6 +-
perl/Git/LoadCPAN/Mail/meson.build | 7 +
perl/Git/LoadCPAN/meson.build | 9 +
perl/Git/SVN/Memoize/meson.build | 7 +
perl/Git/SVN/meson.build | 20 +
perl/Git/meson.build | 18 +
perl/header_templates/fixed_prefix.template.pl | 2 +-
perl/header_templates/runtime_prefix.template.pl | 8 +-
perl/meson.build | 12 +
po/meson.build | 27 +
subprojects/.gitignore | 1 +
subprojects/curl.wrap | 13 +
subprojects/expat.wrap | 13 +
subprojects/openssl.wrap | 15 +
subprojects/pcre2.wrap | 16 +
subprojects/zlib.wrap | 13 +
t/helper/meson.build | 93 +
t/lib-gettext.sh | 4 +-
t/meson.build | 1107 ++++++++++++
t/t7609-mergetool--lib.sh | 2 +-
t/test-lib.sh | 31 +-
templates/Makefile | 39 +-
templates/branches-- | 1 -
templates/{this--description => description} | 0
.../applypatch-msg.sample} | 0
.../commit-msg.sample} | 0
.../fsmonitor-watchman.sample} | 0
templates/hooks/meson.build | 26 +
.../post-update.sample} | 0
.../pre-applypatch.sample} | 0
.../pre-commit.sample} | 0
.../pre-merge-commit.sample} | 0
.../pre-push.sample} | 0
.../pre-rebase.sample} | 0
.../pre-receive.sample} | 0
.../prepare-commit-msg.sample} | 0
.../push-to-checkout.sample} | 0
.../sendemail-validate.sample} | 0
.../{hooks--update.sample => hooks/update.sample} | 0
templates/{info--exclude => info/exclude} | 0
templates/info/meson.build | 7 +
templates/meson.build | 15 +
unimplemented.sh | 2 +-
version-def.h.in | 8 +
version.c | 1 +
wrap-for-bin.sh | 36 -
98 files changed, 4917 insertions(+), 498 deletions(-)
Range-diff versus v7:
1: df465921e9 ! 1: f96de8ecd6 Makefile: use common template for GIT-BUILD-OPTIONS
@@ GIT-BUILD-OPTIONS.in (new)
## Makefile ##
@@ Makefile: GIT-LDFLAGS: FORCE
+ echo "$$FLAGS" >GIT-LDFLAGS; \
+ fi
+
++ifdef RUNTIME_PREFIX
++RUNTIME_PREFIX_OPTION = true
++else
++RUNTIME_PREFIX_OPTION = false
++endif
++
+ # We need to apply sq twice, once to protect from the shell
# that runs GIT-BUILD-OPTIONS, and then again to protect it
# and the first level quoting from the shell that runs "echo".
GIT-BUILD-OPTIONS: FORCE
@@ Makefile: GIT-LDFLAGS: FORCE
+ -e "s|@GIT_INTEROP_MAKE_OPTS@|\'$(GIT_INTEROP_MAKE_OPTS)\'|" \
+ -e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \
+ -e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \
-+ -e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX)\'|" \
++ -e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX_OPTION)\'|" \
+ GIT-BUILD-OPTIONS.in >$@+
+ @if grep -q '^[A-Z][A-Z_]*=@.*@$$' $@+; then echo "Unsubstituted build options in $@" >&2 && exit 1; fi
@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
2: 485c32af5b = 2: fcc2f9c3b3 Makefile: consistently use @PLACEHOLDER@ to substitute
3: 5801eb7d78 ! 3: 2253e4834e Makefile: refactor GIT-VERSION-GEN to be reusable
@@ GIT-VERSION-GEN: else
-VN=$(expr "$VN" : v*'\(.*\)')
+GIT_BUILT_FROM_COMMIT=$(git -C "$SOURCE_DIR" rev-parse -q --verify HEAD 2>/dev/null)
++GIT_DATE=$(git -C "$SOURCE_DIR" show --quiet --format='%as')
+GIT_VERSION=$(expr "$VN" : v*'\(.*\)')
+if test -z "$GIT_USER_AGENT"
+then
@@ GIT-VERSION-GEN: else
+EOF
+
+sed -e "s|@GIT_VERSION@|$GIT_VERSION|" \
++ -e "s|@GIT_DATE@|$GIT_DATE|" \
+ -e "s|@GIT_MAJOR_VERSION@|$GIT_MAJOR_VERSION|" \
+ -e "s|@GIT_MINOR_VERSION@|$GIT_MINOR_VERSION|" \
+ -e "s|@GIT_MICRO_VERSION@|$GIT_MICRO_VERSION|" \
4: 2b8806369b = 4: 955a9881d3 Makefile: propagate Git version via generated header
5: e42ddd2210 = 5: 6378fd066c Makefile: generate "git.rc" via GIT-VERSION-GEN
-: ---------- > 6: 821546aa60 Makefile: generate doc versions via GIT-VERSION-GEN
6: 30fce16e4e = 7: a99a36598e Makefile: consistently use PERL_PATH
7: 1ef93ada56 = 8: ad80ca0ef1 Makefile: extract script to massage Perl scripts
8: c93ce837d3 = 9: 63f09bec07 Makefile: use "generate-perl.sh" to massage Perl library
9: 6578da265d ! 10: 0371a6b25b Makefile: extract script to massage Shell scripts
@@ Makefile: GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile
@@ Makefile: GIT-BUILD-OPTIONS: FORCE
-e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \
-e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \
- -e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX)\'|" \
+ -e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX_OPTION)\'|" \
+ -e "s|@GITWEBDIR@|\'$(gitwebdir_SQ)\'|" \
+ -e "s|@USE_GETTEXT_SCHEME@|\'$(USE_GETTEXT_SCHEME)\'|" \
+ -e "s|@LOCALEDIR@|\'$(localedir_SQ)\'|" \
-+ -e "s|@BROKEN_PATH_FIX@|\'$(BROKEN_PATH_FIX)\'|" \
++ -e "s!@BROKEN_PATH_FIX@!\'$(BROKEN_PATH_FIX)\'!" \
GIT-BUILD-OPTIONS.in >$@+
@if grep -q '^[A-Z][A-Z_]*=@.*@$$' $@+; then echo "Unsubstituted build options in $@" >&2 && exit 1; fi
@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
10: 0305db927c = 11: 769889f6ea Makefile: extract script to generate gitweb.cgi
11: a5ffdebfba = 12: 574dfac309 Makefile: extract script to generate gitweb.js
12: dffcfa67bb = 13: b97dd455d1 Makefile: refactor generators to be PWD-independent
13: 462f856f82 = 14: 2c0e27b10c Makefile: allow "bin-wrappers/" directory to exist
14: 273ab3c03f = 15: 09451bd549 Makefile: simplify building of templates
15: 6b4d770cc6 = 16: 47769c6edc Documentation: allow sourcing generated includes from separate dir
16: 7a0ec55ee6 = 17: 4e2b664838 Documentation: teach "cmd-list.perl" about out-of-tree builds
17: f78f810927 = 18: 6ed009b23c Documentation: extract script to generate a list of mergetools
18: d7da37b0a2 ! 19: 42a90d1967 t: better support for out-of-tree builds
@@ Makefile: GIT-BUILD-OPTIONS: FORCE
+ -e "s|@GIT_TEST_TEMPLATE_DIR@|\'$(shell pwd)/templates/blt\'|" \
+ -e "s|@GIT_TEST_GITPERLLIB@|\'$(shell pwd)/perl/build/lib\'|" \
+ -e "s|@GIT_TEST_MERGE_TOOLS_DIR@|\'$(shell pwd)/mergetools\'|" \
- -e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX)\'|" \
+ -e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX_OPTION)\'|" \
-e "s|@GITWEBDIR@|\'$(gitwebdir_SQ)\'|" \
-e "s|@USE_GETTEXT_SCHEME@|\'$(USE_GETTEXT_SCHEME)\'|" \
@@ Makefile: all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PR
19: 235c953976 = 20: 741a526f9e t: allow overriding build dir
20: b77e32e92d = 21: 7af31366e0 Documentation: add comparison of build systems
21: 584c56be09 ! 22: 5331e5b033 Introduce support for the Meson build system
@@ Documentation/meson.build (new)
+git = find_program('git', required: false)
+xmlto = find_program('xmlto')
+
-+git_revdate = ''
-+if git.found()
-+ git_revdate = run_command(git, 'show', '--quiet', '--pretty=%as', check: false).stdout().strip()
-+endif
++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=' + meson.current_source_dir() / 'asciidoc.conf',
-+ '--attribute=manual=Git Manual',
-+ '--attribute=mansource=Git ' + git_version,
-+ '--attribute=revdate=' + git_revdate,
++ '--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',
++ '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 = [ ]
++documentation_deps = [
++ asciidoc_conf,
++]
+
+documentation_deps += custom_target(
+ command: [
@@ meson.build (new)
+# Using Meson also works with other generators though, like when the build
+# directory has been set up for use with Microsoft Visual Studio.
+#
++# Ninja and Samurai use multiple jobs by default, scaling with the number of
++# processor cores available. You can pass the `-jN` flag to change this.
++#
++# Meson automatically picks up ccache and sccache when these are installed
++# when setting up the build directory. You can override this behaviour when
++# setting up the build directory by setting the `CC` environment variable to
++# your desired compiler.
++#
+# 3. Execute tests. Again, you can either use Meson, Ninja or Samurai to do this:
+#
+# $ meson test
@@ meson.build (new)
+# # Execute single test interactively such that features like `debug ()` work.
+# $ meson test -i --test-args='-ix' t1400-update-ref
+#
++# Test execution is parallelized by default and scales with the number of
++# processor cores available. You can change the number of processes by passing
++# the `-jN` flag to `meson test`.
++#
+# 4. Install the Git distribution. Again, this can be done via Meson, Ninja or
+# Samurai:
+#
@@ meson.build (new)
+#
+# Meson supports multiple backends. The default backend generates Ninja build
+# instructions, but it also supports the generation of Microsoft Visual
-+# Studio solutions as well as Xcode projects. IDEs like Eclipse and Visual
-+# Studio Code provide plugins to import Meson files directly.
++# Studio solutions as well as Xcode projects by passing the `--backend` option
++# to `meson setup`. IDEs like Eclipse and Visual Studio Code provide plugins to
++# import Meson files directly.
+#
+# Configuration
+# =============
@@ meson.build (new)
+# # Set up a new build directory with a higher warning level. Level 2 is
+# # mostly equivalent to setting DEVELOPER=1, level 3 and "everything"
+# # will enable even more warnings.
-+# $ meson setup -Dwarning_level=2
++# $ meson setup -Dwarning_level=2 build
+#
+# # Set up a new build directory with 'address' and 'undefined' sanitizers
+# # using Clang.
@@ meson.build (new)
+# disable the feature based on the availability of prerequisites to support it.
+# Python-based features for example will be enabled automatically when a Python
+# interpreter could be found. The default value of such features can be changed
-+# globally via `meson setup --auto-features={enabled,disabled,auto}`, which
-+# will set the value of all features with a value of "auto" to the provided one
-+# by default.
++# via `meson setup --auto-features={enabled,disabled,auto}`, which will set the
++# value of all features with a value of "auto" to the provided one by default.
+#
+# It is also possible to store a set of configuration options in machine files.
+# This can be useful in case you regularly want to reuse the same set of options:
@@ meson.build (new)
+# b_lto = true
+# b_sanitize = 'address,undefined'
+#
-+# These machine files can be passed to Meson via `meson setup --native-file`.
++# These machine files can be passed to `meson setup` via the `--native-file`
++# option.
+#
+# Subproject wrappers
+# ===================
+#
-+# Subproject wrappers are a feature provided by Meson that allow the automatic
++# Subproject wrappers are a feature provided by Meson that allows the automatic
+# fallback to a "wrapped" dependency in case the dependency is not provided by
+# the system. For example if the system is lacking curl, then Meson will use
+# "subprojects/curl.wrap" to set up curl as a subproject and compile and link
+# the dependency into Git itself. This is especially helpful on systems like
+# Windows, where you typically don't have such dependencies installed.
+#
-+# The use of subproject wrappers can be disabled by executing `meson setup
-+# --wrap-mode nofallback`.
++# The use of subproject wrappers can be disabled by executing `meson setup`
++# with the `--wrap-mode nofallback` option.
+
+project('git', 'c',
+ meson_version: '>=1.3.0',
@@ meson.build (new)
+tar = find_program('tar', dirs: program_path)
+
+script_environment = environment()
-+foreach tool : ['cat', 'cut', 'git', 'grep', 'sed', 'sort', 'tr', 'uname']
++foreach tool : ['cat', 'cut', 'grep', 'sed', 'sort', 'tr', 'uname']
+ program = find_program(tool, dirs: program_path)
+ script_environment.prepend('PATH', fs.parent(program.full_path()))
+endforeach
+
++git = find_program('git', dirs: program_path, required: false)
++if git.found()
++ script_environment.prepend('PATH', fs.parent(git.full_path()))
++endif
++
++if get_option('sane_tool_path') != ''
++ script_environment.prepend('PATH', get_option('sane_tool_path'))
++endif
++
+compiler = meson.get_compiler('c')
+
+libgit_sources = [
@@ meson.build (new)
+build_options_config.set('GIT_TEST_OPTS', '')
+build_options_config.set('GIT_TEST_PERL_FATAL_WARNINGS', '')
+build_options_config.set('GIT_TEST_UTF8_LOCALE', '')
-+build_options_config.set('BROKEN_PATH_FIX', '')
+build_options_config.set_quoted('LOCALEDIR', fs.as_posix(get_option('prefix') / get_option('localedir')))
+build_options_config.set('GITWEBDIR', fs.as_posix(get_option('prefix') / get_option('datadir') / 'gitweb'))
+
++if get_option('sane_tool_path') != ''
++ build_options_config.set_quoted('BROKEN_PATH_FIX', 's|^\# @BROKEN_PATH_FIX@$|git_broken_path_fix "' + get_option('sane_tool_path') + '"|')
++else
++ build_options_config.set_quoted('BROKEN_PATH_FIX', '/^\# @BROKEN_PATH_FIX@$/d')
++endif
++
+test_output_directory = get_option('test_output_directory')
+if test_output_directory == ''
+ test_output_directory = meson.project_build_root() / 'test-output'
@@ meson.build (new)
+ libgit_c_args += '-DHAVE_DEV_TTY'
+endif
+
-+if get_option('openssl').enabled() and get_option('CommonCrypto').enabled()
-+ error('Can only use one SSL backend')
-+endif
++https_backend = get_option('https_backend')
+
-+security_framework = dependency('Security', required: get_option('CommonCrypto').disable_auto_if(host_machine.system() != 'darwin'))
++security_framework = dependency('Security', required: https_backend == 'CommonCrypto')
+core_foundation_framework = dependency('CoreFoundation', required: security_framework.found())
-+if security_framework.found()
-+ libgit_dependencies += security_framework
-+ libgit_dependencies += core_foundation_framework
-+ libgit_c_args += '-DAPPLE_COMMON_CRYPTO'
++if https_backend == 'auto' and security_framework.found()
++ https_backend = 'CommonCrypto'
+endif
+
-+# OpenSSL is required when requested via the 'openssl' feature or via one of
-+# the SHA1/SHA256 backends.
-+openssl_required = get_option('openssl').disable_auto_if(security_framework.found())
-+if get_option('sha1_backend') == 'openssl' or get_option('sha256_backend') == 'openssl'
-+ openssl_required = true
++openssl_required = https_backend == 'openssl' or get_option('sha1_backend') == 'openssl' or get_option('sha256_backend') == 'openssl'
++openssl = dependency('openssl', required: openssl_required, default_options: ['default_library=static'])
++if https_backend == 'auto' and openssl.found()
++ https_backend = 'openssl'
+endif
+
-+openssl = dependency('openssl', required: openssl_required, default_options: ['default_library=static'])
-+if openssl.found()
++if https_backend == 'CommonCrypto'
++ libgit_dependencies += security_framework
++ libgit_dependencies += core_foundation_framework
++ libgit_c_args += '-DAPPLE_COMMON_CRYPTO'
++elif https_backend == 'openssl'
+ libgit_dependencies += openssl
++else
++ # We either couldn't find any dependencies with 'auto' or the user requested
++ # 'none'. Both cases are benign.
+endif
+
-+# We may not want to use OpenSSL for anything but our SHA1/SHA256 backends, so
-+# we cannot just set NO_OPENSSL based on whether or not the library was found.
-+if not openssl.found() or get_option('openssl').disabled()
++if https_backend != 'openssl'
+ libgit_c_args += '-DNO_OPENSSL'
+endif
+
@@ meson.build (new)
+elif sha1_backend == 'common-crypto'
+ libgit_c_args += '-DCOMMON_DIGEST_FOR_OPENSSL'
+ libgit_c_args += '-DSHA1_APPLE'
++ # Apple CommonCrypto requires chunking
+ libgit_c_args += '-DSHA1_MAX_BLOCK_SIZE=1024L*1024L*1024L'
+elif sha1_backend == 'openssl'
-+ if not openssl.found()
-+ openssl = dependency('openssl', required: true)
-+ endif
-+
+ libgit_c_args += '-DSHA1_OPENSSL'
-+ # Apple CommonCrypto requires chunking
++ libgit_dependencies += openssl
+elif sha1_backend == 'block'
+ libgit_c_args += '-DSHA1_BLK'
+ libgit_sources += 'block-sha1/sha1.c'
@@ meson.build (new)
+sha256_backend = get_option('sha256_backend')
+if sha256_backend == 'openssl'
+ libgit_c_args += '-DSHA256_OPENSSL'
++ libgit_dependencies += openssl
+elif sha256_backend == 'nettle'
+ nettle = dependency('nettle')
+ libgit_dependencies += nettle
@@ meson.build (new)
+
+if get_option('runtime_prefix')
+ libgit_c_args += '-DRUNTIME_PREFIX'
-+ build_options_config.set('RUNTIME_PREFIX', '1')
++ build_options_config.set('RUNTIME_PREFIX', 'true')
+
+ if compiler.has_header('mach-o/dyld.h')
+ libgit_c_args += '-DHAVE_NS_GET_EXECUTABLE_PATH'
@@ meson.build (new)
+ libgit_c_args += '-DHAVE_WPGMPTR'
+ endif
+else
-+ build_options_config.set('RUNTIME_PREFIX', '')
++ build_options_config.set('RUNTIME_PREFIX', 'false')
+endif
+
+foreach key, value : {
@@ meson.build (new)
+ configuration: build_options_config,
+)
+
-+version_def_h = custom_target(
++git_version_file = custom_target(
+ command: [
+ shell,
+ meson.current_source_dir() / 'GIT-VERSION-GEN',
@@ meson.build (new)
+ '@INPUT@',
+ '@OUTPUT@',
+ ],
-+ input: meson.current_source_dir() / 'version-def.h.in',
-+ output: 'version-def.h',
++ input: meson.current_source_dir() / 'GIT-VERSION-FILE.in',
++ output: 'GIT-VERSION-FILE',
+ build_always_stale: true,
+)
+
-+git_version_file = custom_target(
++version_def_h = custom_target(
+ command: [
+ shell,
+ meson.current_source_dir() / 'GIT-VERSION-GEN',
@@ meson.build (new)
+ '@INPUT@',
+ '@OUTPUT@',
+ ],
-+ input: meson.current_source_dir() / 'GIT-VERSION-FILE.in',
-+ output: 'GIT-VERSION-FILE',
-+ build_always_stale: true,
++ input: meson.current_source_dir() / 'version-def.h.in',
++ output: 'version-def.h',
++ # Depend on GIT-VERSION-FILE so that we don't always try to rebuild this
++ # target for the same commit.
++ depends: [git_version_file],
+)
+
+# Build a separate library for "version.c" so that we do not have to rebuild
@@ meson.build (new)
+ ],
+ input: meson.current_source_dir() / 'git.rc.in',
+ output: 'git.rc',
-+ build_always_stale: true,
++ depends: [git_version_file],
+ )
+
+ common_main_sources += import('windows').compile_resources(git_rc,
@@ meson.build (new)
+if get_option('docs') != []
+ subdir('Documentation')
+endif
++
++summary({
++ 'curl': curl.found(),
++ 'expat': expat.found(),
++ 'gettext': intl.found(),
++ 'https': https_backend,
++ 'iconv': iconv.found(),
++ 'pcre2': pcre2.found(),
++ 'perl': perl_features_enabled,
++ 'python': python.found(),
++}, section: 'Auto-detected features')
## meson_options.txt (new) ##
@@
@@ meson_options.txt (new)
+ 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',
@@ meson_options.txt (new)
+ 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('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('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.')
+
-+# HTTPS backends.
-+option('openssl', type: 'feature', value: 'auto',
-+ description: 'Support access to HTTPS remotes. OpenSSL may still be pulled in if configured as SHA1 or SHA256 backend.')
-+option('CommonCrypto', type: 'feature', value: 'auto',
-+ description: 'Build tools written in Python.')
-+
-+# Hashing backends.
++# 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',
22: abc986315e = 23: 9d4f54de6e meson: fix conflicts with in-flight topics
---
base-commit: b31fb630c0fc6869a33ed717163e8a1210460d94
change-id: 20241112-pks-meson-95b665c08f06
^ permalink raw reply [flat|nested] 386+ messages in thread
* [PATCH v8 01/23] Makefile: use common template for GIT-BUILD-OPTIONS
2024-11-19 11:50 ` [PATCH v8 00/23] " Patrick Steinhardt
@ 2024-11-19 11:50 ` Patrick Steinhardt
2024-11-19 11:50 ` [PATCH v8 02/23] Makefile: consistently use @PLACEHOLDER@ to substitute Patrick Steinhardt
` (22 subsequent siblings)
23 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-19 11:50 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
The "GIT-BUILD-OPTIONS" file is generated by our build systems to
propagate built-in features and paths to our tests. The generation is
done ad-hoc, where both our Makefile and the CMake build instructions
simply echo a bunch of strings into the file. This makes it very hard to
figure out what variables are expected to exist and what format they
have, and the written variables can easily get out of sync between build
systems.
Introduce a new "GIT-BUILD-OPTIONS.in" template to address this issue.
This has multiple advantages:
- It demonstrates which built options exist in the first place.
- It can serve as a spot to document the build options.
- Some build systems complain when not all variables could be
substituted, alerting us of mismatches. Others don't, but if we
forgot to substitute such variables we now have a bogus string that
will likely cause our tests to fail, if they have any meaning in the
first place.
Backfill values that we didn't yet set in our CMake build instructions.
While at it, remove the `SUPPORTS_SIMPLE_IPC` variable that we only set
up in CMake as it isn't used anywhere.
This change requires us to adapt the setup of TEST_OUTPUT_DIRECTORY in
"test-lib.sh" such that it does not get overwritten after sourcing when
it has been set up via the environment. This is the only instance I
could find where we rely on ordering on variables.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-BUILD-OPTIONS.in | 36 +++++++++++
Makefile | 115 ++++++++++++++----------------------
contrib/buildsystems/CMakeLists.txt | 58 ++++++++++++------
t/test-lib.sh | 22 +++++--
4 files changed, 136 insertions(+), 95 deletions(-)
diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in
new file mode 100644
index 0000000000000000000000000000000000000000..f0ca240493c94aa41a6b6241a8474e42f7cdc8b9
--- /dev/null
+++ b/GIT-BUILD-OPTIONS.in
@@ -0,0 +1,36 @@
+SHELL_PATH=@SHELL_PATH@
+TEST_SHELL_PATH=@TEST_SHELL_PATH@
+PERL_PATH=@PERL_PATH@
+DIFF=@DIFF@
+PYTHON_PATH=@PYTHON_PATH@
+TAR=@TAR@
+NO_CURL=@NO_CURL@
+NO_ICONV=@NO_ICONV@
+NO_EXPAT=@NO_EXPAT@
+USE_LIBPCRE2=@USE_LIBPCRE2@
+NO_PERL=@NO_PERL@
+NO_PTHREADS=@NO_PTHREADS@
+NO_PYTHON=@NO_PYTHON@
+NO_REGEX=@NO_REGEX@
+NO_UNIX_SOCKETS=@NO_UNIX_SOCKETS@
+PAGER_ENV=@PAGER_ENV@
+SANITIZE_LEAK=@SANITIZE_LEAK@
+SANITIZE_ADDRESS=@SANITIZE_ADDRESS@
+X=@X@
+FSMONITOR_DAEMON_BACKEND=@FSMONITOR_DAEMON_BACKEND@
+FSMONITOR_OS_SETTINGS=@FSMONITOR_OS_SETTINGS@
+TEST_OUTPUT_DIRECTORY=@TEST_OUTPUT_DIRECTORY@
+GIT_TEST_OPTS=@GIT_TEST_OPTS@
+GIT_TEST_CMP=@GIT_TEST_CMP@
+GIT_TEST_CMP_USE_COPIED_CONTEXT=@GIT_TEST_CMP_USE_COPIED_CONTEXT@
+GIT_TEST_UTF8_LOCALE=@GIT_TEST_UTF8_LOCALE@
+NO_GETTEXT=@NO_GETTEXT@
+GIT_PERF_REPEAT_COUNT=@GIT_PERF_REPEAT_COUNT@
+GIT_PERF_REPO=@GIT_PERF_REPO@
+GIT_PERF_LARGE_REPO=@GIT_PERF_LARGE_REPO@
+GIT_PERF_MAKE_OPTS=@GIT_PERF_MAKE_OPTS@
+GIT_PERF_MAKE_COMMAND=@GIT_PERF_MAKE_COMMAND@
+GIT_INTEROP_MAKE_OPTS=@GIT_INTEROP_MAKE_OPTS@
+GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@
+GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@
+RUNTIME_PREFIX=@RUNTIME_PREFIX@
diff --git a/Makefile b/Makefile
index d06c9a8ffa7b637050c9619a367fbe61e7243a74..8ea0f0c89802eebd075416e539d3c55cc696b2d9 100644
--- a/Makefile
+++ b/Makefile
@@ -3160,80 +3160,55 @@ GIT-LDFLAGS: FORCE
echo "$$FLAGS" >GIT-LDFLAGS; \
fi
+ifdef RUNTIME_PREFIX
+RUNTIME_PREFIX_OPTION = true
+else
+RUNTIME_PREFIX_OPTION = false
+endif
+
# We need to apply sq twice, once to protect from the shell
# that runs GIT-BUILD-OPTIONS, and then again to protect it
# and the first level quoting from the shell that runs "echo".
GIT-BUILD-OPTIONS: FORCE
- @echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@+
- @echo TEST_SHELL_PATH=\''$(subst ','\'',$(TEST_SHELL_PATH_SQ))'\' >>$@+
- @echo PERL_PATH=\''$(subst ','\'',$(PERL_PATH_SQ))'\' >>$@+
- @echo DIFF=\''$(subst ','\'',$(subst ','\'',$(DIFF)))'\' >>$@+
- @echo PYTHON_PATH=\''$(subst ','\'',$(PYTHON_PATH_SQ))'\' >>$@+
- @echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@+
- @echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@+
- @echo NO_ICONV=\''$(subst ','\'',$(subst ','\'',$(NO_ICONV)))'\' >>$@+
- @echo NO_EXPAT=\''$(subst ','\'',$(subst ','\'',$(NO_EXPAT)))'\' >>$@+
- @echo USE_LIBPCRE2=\''$(subst ','\'',$(subst ','\'',$(USE_LIBPCRE2)))'\' >>$@+
- @echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@+
- @echo NO_PTHREADS=\''$(subst ','\'',$(subst ','\'',$(NO_PTHREADS)))'\' >>$@+
- @echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@+
- @echo NO_REGEX=\''$(subst ','\'',$(subst ','\'',$(NO_REGEX)))'\' >>$@+
- @echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@+
- @echo PAGER_ENV=\''$(subst ','\'',$(subst ','\'',$(PAGER_ENV)))'\' >>$@+
- @echo SANITIZE_LEAK=\''$(subst ','\'',$(subst ','\'',$(SANITIZE_LEAK)))'\' >>$@+
- @echo SANITIZE_ADDRESS=\''$(subst ','\'',$(subst ','\'',$(SANITIZE_ADDRESS)))'\' >>$@+
- @echo X=\'$(X)\' >>$@+
-ifdef FSMONITOR_DAEMON_BACKEND
- @echo FSMONITOR_DAEMON_BACKEND=\''$(subst ','\'',$(subst ','\'',$(FSMONITOR_DAEMON_BACKEND)))'\' >>$@+
-endif
-ifdef FSMONITOR_OS_SETTINGS
- @echo FSMONITOR_OS_SETTINGS=\''$(subst ','\'',$(subst ','\'',$(FSMONITOR_OS_SETTINGS)))'\' >>$@+
-endif
-ifdef TEST_OUTPUT_DIRECTORY
- @echo TEST_OUTPUT_DIRECTORY=\''$(subst ','\'',$(subst ','\'',$(TEST_OUTPUT_DIRECTORY)))'\' >>$@+
-endif
-ifdef GIT_TEST_OPTS
- @echo GIT_TEST_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_OPTS)))'\' >>$@+
-endif
-ifdef GIT_TEST_CMP
- @echo GIT_TEST_CMP=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_CMP)))'\' >>$@+
-endif
-ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
- @echo GIT_TEST_CMP_USE_COPIED_CONTEXT=YesPlease >>$@+
-endif
-ifdef GIT_TEST_UTF8_LOCALE
- @echo GIT_TEST_UTF8_LOCALE=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_UTF8_LOCALE)))'\' >>$@+
-endif
- @echo NO_GETTEXT=\''$(subst ','\'',$(subst ','\'',$(NO_GETTEXT)))'\' >>$@+
-ifdef GIT_PERF_REPEAT_COUNT
- @echo GIT_PERF_REPEAT_COUNT=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPEAT_COUNT)))'\' >>$@+
-endif
-ifdef GIT_PERF_REPO
- @echo GIT_PERF_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPO)))'\' >>$@+
-endif
-ifdef GIT_PERF_LARGE_REPO
- @echo GIT_PERF_LARGE_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_LARGE_REPO)))'\' >>$@+
-endif
-ifdef GIT_PERF_MAKE_OPTS
- @echo GIT_PERF_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_OPTS)))'\' >>$@+
-endif
-ifdef GIT_PERF_MAKE_COMMAND
- @echo GIT_PERF_MAKE_COMMAND=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_COMMAND)))'\' >>$@+
-endif
-ifdef GIT_INTEROP_MAKE_OPTS
- @echo GIT_INTEROP_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_INTEROP_MAKE_OPTS)))'\' >>$@+
-endif
-ifdef GIT_TEST_INDEX_VERSION
- @echo GIT_TEST_INDEX_VERSION=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_INDEX_VERSION)))'\' >>$@+
-endif
-ifdef GIT_TEST_PERL_FATAL_WARNINGS
- @echo GIT_TEST_PERL_FATAL_WARNINGS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_PERL_FATAL_WARNINGS)))'\' >>$@+
-endif
-ifdef RUNTIME_PREFIX
- @echo RUNTIME_PREFIX=\'true\' >>$@+
-else
- @echo RUNTIME_PREFIX=\'false\' >>$@+
-endif
+ @sed \
+ -e "s|@SHELL_PATH@|\'$(SHELL_PATH_SQ)\'|" \
+ -e "s|@TEST_SHELL_PATH@|\'$(TEST_SHELL_PATH_SQ)\'|" \
+ -e "s|@PERL_PATH@|\'$(PERL_PATH_SQ)\'|" \
+ -e "s|@DIFF@|\'$(DIFF)\'|" \
+ -e "s|@PYTHON_PATH@|\'$(PYTHON_PATH_SQ)\'|" \
+ -e "s|@TAR@|\'$(TAR)\'|" \
+ -e "s|@NO_CURL@|\'$(NO_CURL)\'|" \
+ -e "s|@NO_ICONV@|\'$(NO_ICONV)\'|" \
+ -e "s|@NO_EXPAT@|\'$(NO_EXPAT)\'|" \
+ -e "s|@USE_LIBPCRE2@|\'$(USE_LIBPCRE2)\'|" \
+ -e "s|@NO_PERL@|\'$(NO_PERL)\'|" \
+ -e "s|@NO_PTHREADS@|\'$(NO_PTHREADS)\'|" \
+ -e "s|@NO_PYTHON@|\'$(NO_PYTHON)\'|" \
+ -e "s|@NO_REGEX@|\'$(NO_REGEX)\'|" \
+ -e "s|@NO_UNIX_SOCKETS@|\'$(NO_UNIX_SOCKETS)\'|" \
+ -e "s|@PAGER_ENV@|\'$(PAGER_ENV)\'|" \
+ -e "s|@SANITIZE_LEAK@|\'$(SANITIZE_LEAK)\'|" \
+ -e "s|@SANITIZE_ADDRESS@|\'$(SANITIZE_ADDRESS)\'|" \
+ -e "s|@X@|\'$(X)\'|" \
+ -e "s|@FSMONITOR_DAEMON_BACKEND@|\'$(FSMONITOR_DAEMON_BACKEND)\'|" \
+ -e "s|@FSMONITOR_OS_SETTINGS@|\'$(FSMONITOR_OS_SETTINGS)\'|" \
+ -e "s|@TEST_OUTPUT_DIRECTORY@|\'$(TEST_OUTPUT_DIRECTORY)\'|" \
+ -e "s|@GIT_TEST_OPTS@|\'$(GIT_TEST_OPTS)\'|" \
+ -e "s|@GIT_TEST_CMP@|\'$(GIT_TEST_CMP)\'|" \
+ -e "s|@GIT_TEST_CMP_USE_COPIED_CONTEXT@|\'$(GIT_TEST_CMP_USE_COPIED_CONTEXT)\'|" \
+ -e "s|@GIT_TEST_UTF8_LOCALE@|\'$(GIT_TEST_UTF8_LOCALE)\'|" \
+ -e "s|@NO_GETTEXT@|\'$(NO_GETTEXT)\'|" \
+ -e "s|@GIT_PERF_REPEAT_COUNT@|\'$(GIT_PERF_REPEAT_COUNT)\'|" \
+ -e "s|@GIT_PERF_REPO@|\'$(GIT_PERF_REPO)\'|" \
+ -e "s|@GIT_PERF_LARGE_REPO@|\'$(GIT_PERF_LARGE_REPO)\'|" \
+ -e "s|@GIT_PERF_MAKE_OPTS@|\'$(GIT_PERF_MAKE_OPTS)\'|" \
+ -e "s|@GIT_PERF_MAKE_COMMAND@|\'$(GIT_PERF_MAKE_COMMAND)\'|" \
+ -e "s|@GIT_INTEROP_MAKE_OPTS@|\'$(GIT_INTEROP_MAKE_OPTS)\'|" \
+ -e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \
+ -e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \
+ -e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX_OPTION)\'|" \
+ GIT-BUILD-OPTIONS.in >$@+
+ @if grep -q '^[A-Z][A-Z_]*=@.*@$$' $@+; then echo "Unsubstituted build options in $@" >&2 && exit 1; fi
@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
@if test -f GIT-BUILD-DIR; then rm GIT-BUILD-DIR; fi
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 8974bb9fa202a0556fd9b16d105836d8cb66f543..e5d258419ddacd837c4abb07709fb3252fca5c3c 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -1117,27 +1117,47 @@ if(NOT PYTHON_TESTS)
set(NO_PYTHON 1)
endif()
-file(WRITE ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "SHELL_PATH='${SHELL_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "TEST_SHELL_PATH='${TEST_SHELL_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PERL_PATH='${PERL_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "DIFF='${DIFF}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PYTHON_PATH='${PYTHON_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "TAR='${TAR}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_CURL='${NO_CURL}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_ICONV='${NO_ICONV}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_EXPAT='${NO_EXPAT}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PERL='${NO_PERL}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PTHREADS='${NO_PTHREADS}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_UNIX_SOCKETS='${NO_UNIX_SOCKETS}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PAGER_ENV='${PAGER_ENV}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "X='${EXE_EXTENSION}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_GETTEXT='${NO_GETTEXT}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "RUNTIME_PREFIX='${RUNTIME_PREFIX}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PYTHON='${NO_PYTHON}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "SUPPORTS_SIMPLE_IPC='${SUPPORTS_SIMPLE_IPC}'\n")
+file(STRINGS ${CMAKE_SOURCE_DIR}/GIT-BUILD-OPTIONS.in git_build_options NEWLINE_CONSUME)
+string(REPLACE "@SHELL_PATH@" "'${SHELL_PATH}'" git_build_options "${git_build_options}")
+string(REPLACE "@TEST_SHELL_PATH@" "'${TEST_SHELL_PATH}'" git_build_options "${git_build_options}")
+string(REPLACE "@PERL_PATH@" "'${PERL_PATH}'" git_build_options "${git_build_options}")
+string(REPLACE "@DIFF@" "'${DIFF}'" git_build_options "${git_build_options}")
+string(REPLACE "@PYTHON_PATH@" "'${PYTHON_PATH}'" git_build_options "${git_build_options}")
+string(REPLACE "@TAR@" "'${TAR}'" git_build_options "${git_build_options}")
+string(REPLACE "@NO_CURL@" "${NO_CURL}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_ICONV@" "${NO_ICONV}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_EXPAT@" "${NO_EXPAT}" git_build_options "${git_build_options}")
+string(REPLACE "@USE_LIBPCRE2@" "" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PERL@" "${NO_PERL}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PTHREADS@" "${NO_PTHREADS}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PYTHON@" "${NO_PYTHON}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_REGEX@" "" git_build_options "${git_build_options}")
+string(REPLACE "@NO_UNIX_SOCKETS@" "${NO_UNIX_SOCKETS}" git_build_options "${git_build_options}")
+string(REPLACE "@PAGER_ENV@" "'${PAGER_ENV}'" git_build_options "${git_build_options}")
+string(REPLACE "@SANITIZE_LEAK@" "" git_build_options "${git_build_options}")
+string(REPLACE "@SANITIZE_ADDRESS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@X@" "${EXE_EXTENSION}" git_build_options "${git_build_options}")
+string(REPLACE "@FSMONITOR_DAEMON_BACKEND@" "win32" git_build_options "${git_build_options}")
+string(REPLACE "@FSMONITOR_OS_SETTINGS@" "win32" git_build_options "${git_build_options}")
+string(REPLACE "@TEST_OUTPUT_DIRECTORY@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_OPTS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_CMP@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_CMP_USE_COPIED_CONTEXT@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_UTF8_LOCALE@" "" git_build_options "${git_build_options}")
+string(REPLACE "@NO_GETTEXT@" "${NO_GETTEXT}" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_REPEAT_COUNT@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_REPO@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_LARGE_REPO@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_MAKE_OPTS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_MAKE_COMMAND@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@RUNTIME_PREFIX@" "'${RUNTIME_PREFIX}'" git_build_options "${git_build_options}")
if(USE_VCPKG)
- file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
+ string(APPEND git_build_options "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
endif()
+file(WRITE ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS ${git_build_options})
#Make the tests work when building out of the source tree
get_filename_component(CACHE_PATH ${CMAKE_CURRENT_LIST_DIR}/../../CMakeCache.txt ABSOLUTE)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index a278181a0568a2422ab1e7f007bc016b95a58e63..19057faa73925f619750fec30f05c3e5a1ba05ac 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -35,12 +35,6 @@ else
# needing to exist.
TEST_DIRECTORY=$(cd "$TEST_DIRECTORY" && pwd) || exit 1
fi
-if test -z "$TEST_OUTPUT_DIRECTORY"
-then
- # Similarly, override this to store the test-results subdir
- # elsewhere
- TEST_OUTPUT_DIRECTORY=$TEST_DIRECTORY
-fi
GIT_BUILD_DIR="${TEST_DIRECTORY%/t}"
if test "$TEST_DIRECTORY" = "$GIT_BUILD_DIR"
then
@@ -92,6 +86,15 @@ export LSAN_OPTIONS
prepend_var UBSAN_OPTIONS : $GIT_SAN_OPTIONS
export UBSAN_OPTIONS
+# The TEST_OUTPUT_DIRECTORY will be overwritten via GIT-BUILD-OPTIONS. So in
+# case the caller has manually set up this variable via the environment we must
+# make sure to not overwrite that value, and thus we save it into
+# TEST_OUTPUT_DIRECTORY_OVERRIDE here.
+if test -n "$TEST_OUTPUT_DIRECTORY" && test -z "$TEST_OUTPUT_DIRECTORY_OVERRIDE"
+then
+ TEST_OUTPUT_DIRECTORY_OVERRIDE=$TEST_OUTPUT_DIRECTORY
+fi
+
if test ! -f "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
then
echo >&2 'error: GIT-BUILD-OPTIONS missing (has Git been built?).'
@@ -100,6 +103,13 @@ fi
. "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
export PERL_PATH SHELL_PATH
+if test -z "$TEST_OUTPUT_DIRECTORY"
+then
+ # Similarly, override this to store the test-results subdir
+ # elsewhere
+ TEST_OUTPUT_DIRECTORY=$TEST_DIRECTORY
+fi
+
# In t0000, we need to override test directories of nested testcases. In case
# the developer has TEST_OUTPUT_DIRECTORY part of his build options, then we'd
# reset this value to instead contain what the developer has specified. We thus
--
2.47.0.274.g962d0b743d.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v8 02/23] Makefile: consistently use @PLACEHOLDER@ to substitute
2024-11-19 11:50 ` [PATCH v8 00/23] " Patrick Steinhardt
2024-11-19 11:50 ` [PATCH v8 01/23] Makefile: use common template for GIT-BUILD-OPTIONS Patrick Steinhardt
@ 2024-11-19 11:50 ` Patrick Steinhardt
2024-11-19 19:23 ` Johannes Sixt
2024-11-19 11:50 ` [PATCH v8 03/23] Makefile: refactor GIT-VERSION-GEN to be reusable Patrick Steinhardt
` (21 subsequent siblings)
23 siblings, 1 reply; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-19 11:50 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
We have a bunch of placeholders in our scripts that we replace at build
time, for example by using sed(1). These placeholders come in three
different formats: @PLACEHOLDER@, @@PLACEHOLDER@@ and ++PLACEHOLDER++.
Next to being inconsistent it also creates a bit of a problem with
CMake, which only supports the first syntax in its `configure_file()`
function. To work around that we instead manually replace placeholders
via string operations, which is a hassle and removes safeguards that
CMake has to verify that we didn't forget to replace any placeholders.
Besides that, other build systems like Meson also support the CMake
syntax.
Unify our codebase to consistently use the syntax supported by such
build systems.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 44 ++++++++++++------------
configure.ac | 2 +-
contrib/buildsystems/CMakeLists.txt | 34 +++++++++---------
git-cvsserver.perl | 2 +-
git-instaweb.sh | 8 ++---
git-request-pull.sh | 2 +-
git-send-email.perl | 2 +-
git-sh-i18n.sh | 6 ++--
git-sh-setup.sh | 6 ++--
git-svn.perl | 2 +-
gitk-git/po/vi.po | 2 +-
gitweb/Makefile | 44 ++++++++++++------------
gitweb/gitweb.perl | 44 ++++++++++++------------
perl/Git/I18N.pm | 6 ++--
perl/Git/LoadCPAN.pm | 6 ++--
| 2 +-
| 8 ++---
unimplemented.sh | 2 +-
wrap-for-bin.sh | 18 +++++-----
19 files changed, 120 insertions(+), 120 deletions(-)
diff --git a/Makefile b/Makefile
index 8ea0f0c89802eebd075416e539d3c55cc696b2d9..c3b546235a177cb090f8f6adcb13e07a1ccdcef1 100644
--- a/Makefile
+++ b/Makefile
@@ -1555,10 +1555,10 @@ endif
ifdef SANE_TOOL_PATH
SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH))
-BROKEN_PATH_FIX = 's|^\# @@BROKEN_PATH_FIX@@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|'
+BROKEN_PATH_FIX = 's|^\# @BROKEN_PATH_FIX@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|'
PATH := $(SANE_TOOL_PATH):${PATH}
else
-BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d'
+BROKEN_PATH_FIX = '/^\# @BROKEN_PATH_FIX@$$/d'
endif
ifeq (,$(HOST_CPU))
@@ -2548,13 +2548,13 @@ GIT-SCRIPT-DEFINES: FORCE
define cmd_munge_script
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
- -e 's|@@DIFF@@|$(DIFF_SQ)|' \
- -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' \
- -e 's/@@USE_GETTEXT_SCHEME@@/$(USE_GETTEXT_SCHEME)/g' \
+ -e 's|@DIFF@|$(DIFF_SQ)|' \
+ -e 's|@LOCALEDIR@|$(localedir_SQ)|g' \
+ -e 's/@USE_GETTEXT_SCHEME@/$(USE_GETTEXT_SCHEME)/g' \
-e $(BROKEN_PATH_FIX) \
- -e 's|@@GITWEBDIR@@|$(gitwebdir_SQ)|g' \
- -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
- -e 's|@@PAGER_ENV@@|$(PAGER_ENV_SQ)|g' \
+ -e 's|@GITWEBDIR@|$(gitwebdir_SQ)|g' \
+ -e 's|@PERL@|$(PERL_PATH_SQ)|g' \
+ -e 's|@PAGER_ENV@|$(PAGER_ENV_SQ)|g' \
$@.sh >$@+
endef
@@ -2611,7 +2611,7 @@ $(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
-e ' r GIT-PERL-HEADER' \
-e ' G' \
-e '}' \
- -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
+ -e 's/@GIT_VERSION@/$(GIT_VERSION)/g' \
$< >$@+ && \
chmod +x $@+ && \
mv $@+ $@
@@ -2629,11 +2629,11 @@ GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile
INSTLIBDIR='$(perllibdir_SQ)' && \
INSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \
INSTLIBDIR="$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}" && \
- sed -e 's=@@PATHSEP@@=$(pathsep)=g' \
- -e "s=@@INSTLIBDIR@@=$$INSTLIBDIR=g" \
- -e 's=@@PERLLIBDIR_REL@@=$(perllibdir_relative_SQ)=g' \
- -e 's=@@GITEXECDIR_REL@@=$(gitexecdir_relative_SQ)=g' \
- -e 's=@@LOCALEDIR_REL@@=$(localedir_relative_SQ)=g' \
+ sed -e 's=@PATHSEP@=$(pathsep)=g' \
+ -e "s=@INSTLIBDIR@=$$INSTLIBDIR=g" \
+ -e 's=@PERLLIBDIR_REL@=$(perllibdir_relative_SQ)=g' \
+ -e 's=@GITEXECDIR_REL@=$(gitexecdir_relative_SQ)=g' \
+ -e 's=@LOCALEDIR_REL@=$(localedir_relative_SQ)=g' \
$< >$@+ && \
mv $@+ $@
@@ -2649,7 +2649,7 @@ else # NO_PERL
$(SCRIPT_PERL_GEN) git-instaweb: % : unimplemented.sh
$(QUIET_GEN) \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@@REASON@@|NO_PERL=$(NO_PERL)|g' \
+ -e 's|@REASON@|NO_PERL=$(NO_PERL)|g' \
unimplemented.sh >$@+ && \
chmod +x $@+ && \
mv $@+ $@
@@ -2670,13 +2670,13 @@ else # NO_PYTHON
$(SCRIPT_PYTHON_GEN): % : unimplemented.sh
$(QUIET_GEN) \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@@REASON@@|NO_PYTHON=$(NO_PYTHON)|g' \
+ -e 's|@REASON@|NO_PYTHON=$(NO_PYTHON)|g' \
unimplemented.sh >$@+ && \
chmod +x $@+ && \
mv $@+ $@
endif # NO_PYTHON
-CONFIGURE_RECIPE = sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
+CONFIGURE_RECIPE = sed -e 's/@GIT_VERSION@/$(GIT_VERSION)/g' \
configure.ac >configure.ac+ && \
autoconf -o configure configure.ac+ && \
$(RM) configure.ac+
@@ -3104,9 +3104,9 @@ endif
perl/build/lib/%.pm: perl/%.pm GIT-PERL-DEFINES
$(call mkdir_p_parent_template)
$(QUIET_GEN) \
- sed -e 's|@@LOCALEDIR@@|$(perl_localedir_SQ)|g' \
- -e 's|@@NO_GETTEXT@@|$(NO_GETTEXT_SQ)|g' \
- -e 's|@@NO_PERL_CPAN_FALLBACKS@@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \
+ sed -e 's|@LOCALEDIR@|$(perl_localedir_SQ)|g' \
+ -e 's|@NO_GETTEXT@|$(NO_GETTEXT_SQ)|g' \
+ -e 's|@NO_PERL_CPAN_FALLBACKS@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \
< $< > $@
perl/build/man/man3/Git.3pm: perl/Git.pm
@@ -3231,8 +3231,8 @@ all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PR
bin-wrappers/%: wrap-for-bin.sh
$(call mkdir_p_parent_template)
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@@BUILD_DIR@@|$(shell pwd)|' \
- -e 's|@@PROG@@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
+ -e 's|@BUILD_DIR@|$(shell pwd)|' \
+ -e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
chmod +x $@
# GNU make supports exporting all variables by "export" without parameters.
diff --git a/configure.ac b/configure.ac
index d1a96da14eb56766e1538da80ab97ed8a99b24f6..5923edc44aa7b6cc355fa6589b6d075b0c0a7772 100644
--- a/configure.ac
+++ b/configure.ac
@@ -142,7 +142,7 @@ fi
## Configure body starts here.
AC_PREREQ(2.59)
-AC_INIT([git], [@@GIT_VERSION@@], [git@vger.kernel.org])
+AC_INIT([git], [@GIT_VERSION@], [git@vger.kernel.org])
AC_CONFIG_SRCDIR([git.c])
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index e5d258419ddacd837c4abb07709fb3252fca5c3c..8b0020edeba289e5eaa15a5452013fa2e4c3ed33 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -836,14 +836,14 @@ set(git_shell_scripts
foreach(script ${git_shell_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.sh content NEWLINE_CONSUME)
string(REPLACE "@SHELL_PATH@" "${SHELL_PATH}" content "${content}")
- string(REPLACE "@@DIFF@@" "diff" content "${content}")
+ string(REPLACE "@DIFF@" "diff" content "${content}")
string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}")
string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" content "${content}")
- string(REPLACE "@@NO_CURL@@" "" content "${content}")
- string(REPLACE "@@USE_GETTEXT_SCHEME@@" "" content "${content}")
- string(REPLACE "# @@BROKEN_PATH_FIX@@" "" content "${content}")
- string(REPLACE "@@PERL@@" "${PERL_PATH}" content "${content}")
- string(REPLACE "@@PAGER_ENV@@" "LESS=FRX LV=-c" content "${content}")
+ string(REPLACE "@NO_CURL@" "" content "${content}")
+ string(REPLACE "@USE_GETTEXT_SCHEME@" "" content "${content}")
+ string(REPLACE "# @BROKEN_PATH_FIX@" "" content "${content}")
+ string(REPLACE "@PERL@" "${PERL_PATH}" content "${content}")
+ string(REPLACE "@PAGER_ENV@" "LESS=FRX LV=-c" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
endforeach()
@@ -852,13 +852,13 @@ parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" ".perl")
#create perl header
file(STRINGS ${CMAKE_SOURCE_DIR}/perl/header_templates/fixed_prefix.template.pl perl_header )
-string(REPLACE "@@PATHSEP@@" ":" perl_header "${perl_header}")
-string(REPLACE "@@INSTLIBDIR@@" "${INSTLIBDIR}" perl_header "${perl_header}")
+string(REPLACE "@PATHSEP@" ":" perl_header "${perl_header}")
+string(REPLACE "@INSTLIBDIR@" "${INSTLIBDIR}" perl_header "${perl_header}")
foreach(script ${git_perl_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.perl content NEWLINE_CONSUME)
string(REPLACE "#!/usr/bin/perl" "#!/usr/bin/perl\n${perl_header}\n" content "${content}")
- string(REPLACE "@@GIT_VERSION@@" "${PROJECT_VERSION}" content "${content}")
+ string(REPLACE "@GIT_VERSION@" "${PROJECT_VERSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
endforeach()
@@ -873,8 +873,8 @@ file(GLOB_RECURSE perl_modules "${CMAKE_SOURCE_DIR}/perl/*.pm")
foreach(pm ${perl_modules})
string(REPLACE "${CMAKE_SOURCE_DIR}/perl/" "" file_path ${pm})
file(STRINGS ${pm} content NEWLINE_CONSUME)
- string(REPLACE "@@LOCALEDIR@@" "${LOCALEDIR}" content "${content}")
- string(REPLACE "@@NO_PERL_CPAN_FALLBACKS@@" "" content "${content}")
+ string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}")
+ string(REPLACE "@NO_PERL_CPAN_FALLBACKS@" "" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/perl/build/lib/${file_path} ${content})
#test-lib.sh requires perl/build/lib to be the build directory of perl modules
endforeach()
@@ -1056,21 +1056,21 @@ set(wrapper_test_scripts
foreach(script ${wrapper_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
- string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
- string(REPLACE "@@PROG@@" "${script}${EXE_EXTENSION}" content "${content}")
+ string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+ string(REPLACE "@PROG@" "${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
foreach(script ${wrapper_test_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
- string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
- string(REPLACE "@@PROG@@" "t/helper/${script}${EXE_EXTENSION}" content "${content}")
+ string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+ string(REPLACE "@PROG@" "t/helper/${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
-string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
-string(REPLACE "@@PROG@@" "git-cvsserver" content "${content}")
+string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+string(REPLACE "@PROG@" "git-cvsserver" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})
#options for configuring test options
diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index 124f598bdc07058b139f8dcbf8245128c52d9176..70ae7cb8e456885ddf2b13a70d21831cdaa7bf06 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -26,7 +26,7 @@
use File::Basename;
use Getopt::Long qw(:config require_order no_ignore_case);
-my $VERSION = '@@GIT_VERSION@@';
+my $VERSION = '@GIT_VERSION@';
my $log = GITCVS::log->new();
my $cfg;
diff --git a/git-instaweb.sh b/git-instaweb.sh
index 8dbe21d5887595352bc0159ea9befdf296b8105f..c8efb1205a8e2a66a6aced840980978897e122bc 100755
--- a/git-instaweb.sh
+++ b/git-instaweb.sh
@@ -3,7 +3,7 @@
# Copyright (c) 2006 Eric Wong
#
-PERL='@@PERL@@'
+PERL='@PERL@'
OPTIONS_KEEPDASHDASH=
OPTIONS_STUCKLONG=
OPTIONS_SPEC="\
@@ -38,8 +38,8 @@ conf="$GIT_DIR/gitweb/httpd.conf"
# if installed, it doesn't need further configuration (module_path)
test -z "$httpd" && httpd='lighttpd -f'
-# Default is @@GITWEBDIR@@
-test -z "$root" && root='@@GITWEBDIR@@'
+# Default is @GITWEBDIR@
+test -z "$root" && root='@GITWEBDIR@'
# any untaken local port will do...
test -z "$port" && port=1234
@@ -716,7 +716,7 @@ EOF
gitweb_conf() {
cat > "$fqgitdir/gitweb/gitweb_config.perl" <<EOF
-#!@@PERL@@
+#!@PERL@
our \$projectroot = "$(dirname "$fqgitdir")";
our \$git_temp = "$fqgitdir/gitweb/tmp";
our \$projects_list = \$projectroot;
diff --git a/git-request-pull.sh b/git-request-pull.sh
index 01640a044bb10f4167338fca957c43a240e1b6c0..10c88639e28c02650ffea3d4671afa9a9f0bb182 100755
--- a/git-request-pull.sh
+++ b/git-request-pull.sh
@@ -112,7 +112,7 @@ find_matching_ref='
}
'
-set fnord $(git ls-remote "$url" | @@PERL@@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
+set fnord $(git ls-remote "$url" | @PERL@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
remote_sha1=$2
ref=$3
diff --git a/git-send-email.perl b/git-send-email.perl
index c835d4c11af259242f1128101a15b237302c7f42..02805c43e52570fe5ae5432fb9343ce9165cc16b 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1501,7 +1501,7 @@ sub gen_header {
@recipients = unique_email_list(@recipients,@cc,@initial_bcc);
@recipients = (map { extract_valid_address_or_die($_) } @recipients);
my $date = format_2822_time($time++);
- my $gitversion = '@@GIT_VERSION@@';
+ my $gitversion = '@GIT_VERSION@';
if ($gitversion =~ m/..GIT_VERSION../) {
$gitversion = Git::version();
}
diff --git a/git-sh-i18n.sh b/git-sh-i18n.sh
index a15c0620db6893898152b1c9e363a0af7f1b304e..ae4b2d6ba9dc061ef40ef1867f0cd5e975df8fe5 100644
--- a/git-sh-i18n.sh
+++ b/git-sh-i18n.sh
@@ -9,7 +9,7 @@ TEXTDOMAIN=git
export TEXTDOMAIN
if test -z "$GIT_TEXTDOMAINDIR"
then
- TEXTDOMAINDIR="@@LOCALEDIR@@"
+ TEXTDOMAINDIR="@LOCALEDIR@"
else
TEXTDOMAINDIR="$GIT_TEXTDOMAINDIR"
fi
@@ -17,9 +17,9 @@ export TEXTDOMAINDIR
# First decide what scheme to use...
GIT_INTERNAL_GETTEXT_SH_SCHEME=fallthrough
-if test -n "@@USE_GETTEXT_SCHEME@@"
+if test -n "@USE_GETTEXT_SCHEME@"
then
- GIT_INTERNAL_GETTEXT_SH_SCHEME="@@USE_GETTEXT_SCHEME@@"
+ GIT_INTERNAL_GETTEXT_SH_SCHEME="@USE_GETTEXT_SCHEME@"
elif test -n "$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS"
then
: no probing necessary
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index ce273fe0e48d997cb067e77707026616a9302eb2..19aef72ec2553027bb25a5968d4e428ba986fdb2 100644
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -41,7 +41,7 @@ git_broken_path_fix () {
esac
}
-# @@BROKEN_PATH_FIX@@
+# @BROKEN_PATH_FIX@
# Source git-sh-i18n for gettext support.
. "$(git --exec-path)/git-sh-i18n"
@@ -154,7 +154,7 @@ git_pager() {
else
GIT_PAGER=cat
fi
- for vardef in @@PAGER_ENV@@
+ for vardef in @PAGER_ENV@
do
var=${vardef%%=*}
eval ": \"\${$vardef}\" && export $var"
@@ -280,7 +280,7 @@ get_author_ident_from_commit () {
# remove lines from $1 that are not in $2, leaving only common lines.
create_virtual_base() {
sz0=$(wc -c <"$1")
- @@DIFF@@ -u -La/"$1" -Lb/"$1" "$1" "$2" | git apply --no-add
+ @DIFF@ -u -La/"$1" -Lb/"$1" "$1" "$2" | git apply --no-add
sz1=$(wc -c <"$1")
# If we do not have enough common material, it is not
diff --git a/git-svn.perl b/git-svn.perl
index 01e7a70de1c0eb37b3feefe364ad78d4c8973097..dcf65cf1d1d4dc53b9f813f931ecff1a387c2657 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -9,7 +9,7 @@
$_revision $_repository
$_q $_authors $_authors_prog %users/;
$AUTHOR = 'Eric Wong <normalperson@yhbt.net>';
-$VERSION = '@@GIT_VERSION@@';
+$VERSION = '@GIT_VERSION@';
use Carp qw/croak/;
use File::Basename qw/dirname basename/;
diff --git a/gitk-git/po/vi.po b/gitk-git/po/vi.po
index 59674986604891d9901e87c163e61dd39db14184..184430dcdeea7cbb76895840f84a889b6abc20bf 100644
--- a/gitk-git/po/vi.po
+++ b/gitk-git/po/vi.po
@@ -5,7 +5,7 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: gitk @@GIT_VERSION@@\n"
+"Project-Id-Version: gitk @GIT_VERSION@\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-05-17 14:32+1000\n"
"PO-Revision-Date: 2015-09-15 07:33+0700\n"
diff --git a/gitweb/Makefile b/gitweb/Makefile
index 3b68ab2d672c4afae62f8f4dc024e0911027b58d..164c8d53757f98599ad14eeb22ca8d542eb7502a 100644
--- a/gitweb/Makefile
+++ b/gitweb/Makefile
@@ -79,28 +79,28 @@ GITWEB_JSLIB_FILES += static/js/blame_incremental.js
GITWEB_REPLACE = \
- -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
- -e 's|++GIT_BINDIR++|$(bindir)|g' \
- -e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \
- -e 's|++GITWEB_CONFIG_SYSTEM++|$(GITWEB_CONFIG_SYSTEM)|g' \
- -e 's|++GITWEB_CONFIG_COMMON++|$(GITWEB_CONFIG_COMMON)|g' \
- -e 's|++GITWEB_HOME_LINK_STR++|$(GITWEB_HOME_LINK_STR)|g' \
- -e 's|++GITWEB_SITENAME++|$(GITWEB_SITENAME)|g' \
- -e 's|++GITWEB_PROJECTROOT++|$(GITWEB_PROJECTROOT)|g' \
- -e 's|"++GITWEB_PROJECT_MAXDEPTH++"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
- -e 's|++GITWEB_EXPORT_OK++|$(GITWEB_EXPORT_OK)|g' \
- -e 's|++GITWEB_STRICT_EXPORT++|$(GITWEB_STRICT_EXPORT)|g' \
- -e 's|++GITWEB_BASE_URL++|$(GITWEB_BASE_URL)|g' \
- -e 's|++GITWEB_LIST++|$(GITWEB_LIST)|g' \
- -e 's|++GITWEB_HOMETEXT++|$(GITWEB_HOMETEXT)|g' \
- -e 's|++GITWEB_CSS++|$(GITWEB_CSS)|g' \
- -e 's|++GITWEB_LOGO++|$(GITWEB_LOGO)|g' \
- -e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \
- -e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \
- -e 's|++GITWEB_SITE_HTML_HEAD_STRING++|$(GITWEB_SITE_HTML_HEAD_STRING)|g' \
- -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \
- -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \
- -e 's|++HIGHLIGHT_BIN++|$(HIGHLIGHT_BIN)|g'
+ -e 's|@GIT_VERSION@|$(GIT_VERSION)|g' \
+ -e 's|@GIT_BINDIR@|$(bindir)|g' \
+ -e 's|@GITWEB_CONFIG@|$(GITWEB_CONFIG)|g' \
+ -e 's|@GITWEB_CONFIG_SYSTEM@|$(GITWEB_CONFIG_SYSTEM)|g' \
+ -e 's|@GITWEB_CONFIG_COMMON@|$(GITWEB_CONFIG_COMMON)|g' \
+ -e 's|@GITWEB_HOME_LINK_STR@|$(GITWEB_HOME_LINK_STR)|g' \
+ -e 's|@GITWEB_SITENAME@|$(GITWEB_SITENAME)|g' \
+ -e 's|@GITWEB_PROJECTROOT@|$(GITWEB_PROJECTROOT)|g' \
+ -e 's|"@GITWEB_PROJECT_MAXDEPTH@"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
+ -e 's|@GITWEB_EXPORT_OK@|$(GITWEB_EXPORT_OK)|g' \
+ -e 's|@GITWEB_STRICT_EXPORT@|$(GITWEB_STRICT_EXPORT)|g' \
+ -e 's|@GITWEB_BASE_URL@|$(GITWEB_BASE_URL)|g' \
+ -e 's|@GITWEB_LIST@|$(GITWEB_LIST)|g' \
+ -e 's|@GITWEB_HOMETEXT@|$(GITWEB_HOMETEXT)|g' \
+ -e 's|@GITWEB_CSS@|$(GITWEB_CSS)|g' \
+ -e 's|@GITWEB_LOGO@|$(GITWEB_LOGO)|g' \
+ -e 's|@GITWEB_FAVICON@|$(GITWEB_FAVICON)|g' \
+ -e 's|@GITWEB_JS@|$(GITWEB_JS)|g' \
+ -e 's|@GITWEB_SITE_HTML_HEAD_STRING@|$(GITWEB_SITE_HTML_HEAD_STRING)|g' \
+ -e 's|@GITWEB_SITE_HEADER@|$(GITWEB_SITE_HEADER)|g' \
+ -e 's|@GITWEB_SITE_FOOTER@|$(GITWEB_SITE_FOOTER)|g' \
+ -e 's|@HIGHLIGHT_BIN@|$(HIGHLIGHT_BIN)|g'
.PHONY: FORCE
$(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS: FORCE
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index b09a8d052383fdf1190f1fab008ddef99290e1f0..76e1f4e244fd23dd29b935e83753efa9c6d5bb5e 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -35,7 +35,7 @@ BEGIN
CGI->compile() if $ENV{'MOD_PERL'};
}
-our $version = "++GIT_VERSION++";
+our $version = "@GIT_VERSION@";
our ($my_url, $my_uri, $base_url, $path_info, $home_link);
sub evaluate_uri {
@@ -80,46 +80,46 @@ sub evaluate_uri {
# core git executable to use
# this can just be "git" if your webserver has a sensible PATH
-our $GIT = "++GIT_BINDIR++/git";
+our $GIT = "@GIT_BINDIR@/git";
# absolute fs-path which will be prepended to the project path
#our $projectroot = "/pub/scm";
-our $projectroot = "++GITWEB_PROJECTROOT++";
+our $projectroot = "@GITWEB_PROJECTROOT@";
# fs traversing limit for getting project list
# the number is relative to the projectroot
-our $project_maxdepth = "++GITWEB_PROJECT_MAXDEPTH++";
+our $project_maxdepth = "@GITWEB_PROJECT_MAXDEPTH@";
# string of the home link on top of all pages
-our $home_link_str = "++GITWEB_HOME_LINK_STR++";
+our $home_link_str = "@GITWEB_HOME_LINK_STR@";
# extra breadcrumbs preceding the home link
our @extra_breadcrumbs = ();
# name of your site or organization to appear in page titles
# replace this with something more descriptive for clearer bookmarks
-our $site_name = "++GITWEB_SITENAME++"
+our $site_name = "@GITWEB_SITENAME@"
|| ($ENV{'SERVER_NAME'} || "Untitled") . " Git";
# html snippet to include in the <head> section of each page
-our $site_html_head_string = "++GITWEB_SITE_HTML_HEAD_STRING++";
+our $site_html_head_string = "@GITWEB_SITE_HTML_HEAD_STRING@";
# filename of html text to include at top of each page
-our $site_header = "++GITWEB_SITE_HEADER++";
+our $site_header = "@GITWEB_SITE_HEADER@";
# html text to include at home page
-our $home_text = "++GITWEB_HOMETEXT++";
+our $home_text = "@GITWEB_HOMETEXT@";
# filename of html text to include at bottom of each page
-our $site_footer = "++GITWEB_SITE_FOOTER++";
+our $site_footer = "@GITWEB_SITE_FOOTER@";
# URI of stylesheets
-our @stylesheets = ("++GITWEB_CSS++");
+our @stylesheets = ("@GITWEB_CSS@");
# URI of a single stylesheet, which can be overridden in GITWEB_CONFIG.
our $stylesheet = undef;
# URI of GIT logo (72x27 size)
-our $logo = "++GITWEB_LOGO++";
+our $logo = "@GITWEB_LOGO@";
# URI of GIT favicon, assumed to be image/png type
-our $favicon = "++GITWEB_FAVICON++";
+our $favicon = "@GITWEB_FAVICON@";
# URI of gitweb.js (JavaScript code for gitweb)
-our $javascript = "++GITWEB_JS++";
+our $javascript = "@GITWEB_JS@";
# URI and label (title) of GIT logo link
#our $logo_url = "https://www.kernel.org/pub/software/scm/git/docs/";
@@ -128,7 +128,7 @@ sub evaluate_uri {
our $logo_label = "git homepage";
# source of projects list
-our $projects_list = "++GITWEB_LIST++";
+our $projects_list = "@GITWEB_LIST@";
# the width (in characters) of the projects list "Description" column
our $projects_list_description_width = 25;
@@ -147,7 +147,7 @@ sub evaluate_uri {
# show repository only if this file exists
# (only effective if this variable evaluates to true)
-our $export_ok = "++GITWEB_EXPORT_OK++";
+our $export_ok = "@GITWEB_EXPORT_OK@";
# don't generate age column on the projects list page
our $omit_age_column = 0;
@@ -161,11 +161,11 @@ sub evaluate_uri {
our $export_auth_hook = undef;
# only allow viewing of repositories also shown on the overview page
-our $strict_export = "++GITWEB_STRICT_EXPORT++";
+our $strict_export = "@GITWEB_STRICT_EXPORT@";
# list of git base URLs used for URL to where fetch project from,
# i.e. full URL is "$git_base_url/$project"
-our @git_base_url_list = grep { $_ ne '' } ("++GITWEB_BASE_URL++");
+our @git_base_url_list = grep { $_ ne '' } ("@GITWEB_BASE_URL@");
# default blob_plain mimetype and default charset for text/plain blob
our $default_blob_plain_mimetype = 'text/plain';
@@ -200,7 +200,7 @@ sub evaluate_uri {
# http://andre-simon.de/zip/download.php due to assumptions about parameters and output).
# Useful if highlight is not installed on your webserver's PATH.
# [Default: highlight]
-our $highlight_bin = "++HIGHLIGHT_BIN++";
+our $highlight_bin = "@HIGHLIGHT_BIN@";
# information about snapshot formats that gitweb is capable of serving
our %known_snapshot_formats = (
@@ -741,9 +741,9 @@ sub read_config_file {
our ($GITWEB_CONFIG, $GITWEB_CONFIG_SYSTEM, $GITWEB_CONFIG_COMMON);
sub evaluate_gitweb_config {
- our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "++GITWEB_CONFIG++";
- our $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || "++GITWEB_CONFIG_SYSTEM++";
- our $GITWEB_CONFIG_COMMON = $ENV{'GITWEB_CONFIG_COMMON'} || "++GITWEB_CONFIG_COMMON++";
+ our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "@GITWEB_CONFIG@";
+ our $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || "@GITWEB_CONFIG_SYSTEM@";
+ our $GITWEB_CONFIG_COMMON = $ENV{'GITWEB_CONFIG_COMMON'} || "@GITWEB_CONFIG_COMMON@";
# Protect against duplications of file names, to not read config twice.
# Only one of $GITWEB_CONFIG and $GITWEB_CONFIG_SYSTEM is used, so
diff --git a/perl/Git/I18N.pm b/perl/Git/I18N.pm
index 475e90a6df5a272d6b4d557d8d37d68e3f77dfa8..f8f0ca312543ce2d099f16354e62acbc205abe5a 100644
--- a/perl/Git/I18N.pm
+++ b/perl/Git/I18N.pm
@@ -20,14 +20,14 @@ BEGIN
# this "'@@' [...] '@@'" pattern.
use constant NO_GETTEXT_STR => '@@' . 'NO_GETTEXT' . '@@';
use constant NO_GETTEXT => (
- q[@@NO_GETTEXT@@] ne ''
+ q[@NO_GETTEXT@] ne ''
and
- q[@@NO_GETTEXT@@] ne NO_GETTEXT_STR
+ q[@NO_GETTEXT@] ne NO_GETTEXT_STR
);
sub __bootstrap_locale_messages {
our $TEXTDOMAIN = 'git';
- our $TEXTDOMAINDIR ||= $ENV{GIT_TEXTDOMAINDIR} || '@@LOCALEDIR@@';
+ our $TEXTDOMAINDIR ||= $ENV{GIT_TEXTDOMAINDIR} || '@LOCALEDIR@';
die "NO_GETTEXT=" . NO_GETTEXT_STR if NO_GETTEXT;
require POSIX;
diff --git a/perl/Git/LoadCPAN.pm b/perl/Git/LoadCPAN.pm
index 8c7fa805f97390a47366b0d0058966ee391b9df1..6be99840f84fb2fe945f969fb23f73454c6b171b 100644
--- a/perl/Git/LoadCPAN.pm
+++ b/perl/Git/LoadCPAN.pm
@@ -31,11 +31,11 @@ =head1 DESCRIPTION
# Makefile, and allows for detecting whether the module is loaded from
# perl/Git as opposed to perl/build/Git, which is useful for one-off
# testing without having Error.pm et al installed.
-use constant NO_PERL_CPAN_FALLBACKS_STR => '@@' . 'NO_PERL_CPAN_FALLBACKS' . '@@';
+use constant NO_PERL_CPAN_FALLBACKS_STR => '@' . 'NO_PERL_CPAN_FALLBACKS' . '@';
use constant NO_PERL_CPAN_FALLBACKS => (
- q[@@NO_PERL_CPAN_FALLBACKS@@] ne ''
+ q[@NO_PERL_CPAN_FALLBACKS@] ne ''
and
- q[@@NO_PERL_CPAN_FALLBACKS@@] ne NO_PERL_CPAN_FALLBACKS_STR
+ q[@NO_PERL_CPAN_FALLBACKS@] ne NO_PERL_CPAN_FALLBACKS_STR
);
sub import {
--git a/perl/header_templates/fixed_prefix.template.pl b/perl/header_templates/fixed_prefix.template.pl
index 857b4391a499394ea788a6b56773aecd5afd53c3..d571ca5cde513a98cc25e7acb52b5415b98ffe10 100644
--- a/perl/header_templates/fixed_prefix.template.pl
+++ b/perl/header_templates/fixed_prefix.template.pl
@@ -1 +1 @@
-use lib (split(/@@PATHSEP@@/, $ENV{GITPERLLIB} || '@@INSTLIBDIR@@'));
+use lib (split(/@PATHSEP@/, $ENV{GITPERLLIB} || '@INSTLIBDIR@'));
--git a/perl/header_templates/runtime_prefix.template.pl b/perl/header_templates/runtime_prefix.template.pl
index 9d28b3d8636c6c6d48ea287a5fef0f7833f6c08c..e6f8e661a164519d4fdb55429746380e84ae3fcb 100644
--- a/perl/header_templates/runtime_prefix.template.pl
+++ b/perl/header_templates/runtime_prefix.template.pl
@@ -3,7 +3,7 @@
# This finds our Git::* libraries relative to the script's runtime path.
sub __git_system_path {
my ($relpath) = @_;
- my $gitexecdir_relative = '@@GITEXECDIR_REL@@';
+ my $gitexecdir_relative = '@GITEXECDIR_REL@';
# GIT_EXEC_PATH is supplied by `git` or the test suite.
my $exec_path;
@@ -24,11 +24,11 @@ sub __git_system_path {
}
BEGIN {
- use lib split /@@PATHSEP@@/,
+ use lib split /@PATHSEP@/,
(
$ENV{GITPERLLIB} ||
do {
- my $perllibdir = __git_system_path('@@PERLLIBDIR_REL@@');
+ my $perllibdir = __git_system_path('@PERLLIBDIR_REL@');
(-e $perllibdir) || die("Invalid system path ($relpath): $path");
$perllibdir;
}
@@ -36,7 +36,7 @@ BEGIN
# Export the system locale directory to the I18N module. The locale directory
# is only installed if NO_GETTEXT is set.
- $Git::I18N::TEXTDOMAINDIR = __git_system_path('@@LOCALEDIR_REL@@');
+ $Git::I18N::TEXTDOMAINDIR = __git_system_path('@LOCALEDIR_REL@');
}
# END RUNTIME_PREFIX generated code.
diff --git a/unimplemented.sh b/unimplemented.sh
index fee21d24e8ab89208b4aa0af7007b7c033b753bc..41776b279d4263ae6a9034b30f1bd26ac9b792bd 100644
--- a/unimplemented.sh
+++ b/unimplemented.sh
@@ -1,4 +1,4 @@
#!/bin/sh
-echo >&2 "fatal: git was built without support for $(basename $0) (@@REASON@@)."
+echo >&2 "fatal: git was built without support for $(basename $0) (@REASON@)."
exit 128
diff --git a/wrap-for-bin.sh b/wrap-for-bin.sh
index 95851b85b6b7181130f0cd441c2bd7ac0bfb89da..7898a1c238dde20617cf96d144930dc59f67feab 100644
--- a/wrap-for-bin.sh
+++ b/wrap-for-bin.sh
@@ -4,33 +4,33 @@
# to run test suite against sandbox, but with only bindir-installed
# executables in PATH. The Makefile copies this into various
# files in bin-wrappers, substituting
-# @@BUILD_DIR@@ and @@PROG@@.
+# @BUILD_DIR@ and @PROG@.
-GIT_EXEC_PATH='@@BUILD_DIR@@'
+GIT_EXEC_PATH='@BUILD_DIR@'
if test -n "$NO_SET_GIT_TEMPLATE_DIR"
then
unset GIT_TEMPLATE_DIR
else
- GIT_TEMPLATE_DIR='@@BUILD_DIR@@/templates/blt'
+ GIT_TEMPLATE_DIR='@BUILD_DIR@/templates/blt'
export GIT_TEMPLATE_DIR
fi
-GITPERLLIB='@@BUILD_DIR@@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}"
-GIT_TEXTDOMAINDIR='@@BUILD_DIR@@/po/build/locale'
-PATH='@@BUILD_DIR@@/bin-wrappers:'"$PATH"
+GITPERLLIB='@BUILD_DIR@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}"
+GIT_TEXTDOMAINDIR='@BUILD_DIR@/po/build/locale'
+PATH='@BUILD_DIR@/bin-wrappers:'"$PATH"
export GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
case "$GIT_DEBUGGER" in
'')
- exec "${GIT_EXEC_PATH}/@@PROG@@" "$@"
+ exec "${GIT_EXEC_PATH}/@PROG@" "$@"
;;
1)
unset GIT_DEBUGGER
- exec gdb --args "${GIT_EXEC_PATH}/@@PROG@@" "$@"
+ exec gdb --args "${GIT_EXEC_PATH}/@PROG@" "$@"
;;
*)
GIT_DEBUGGER_ARGS="$GIT_DEBUGGER"
unset GIT_DEBUGGER
- exec ${GIT_DEBUGGER_ARGS} "${GIT_EXEC_PATH}/@@PROG@@" "$@"
+ exec ${GIT_DEBUGGER_ARGS} "${GIT_EXEC_PATH}/@PROG@" "$@"
;;
esac
--
2.47.0.274.g962d0b743d.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v8 03/23] Makefile: refactor GIT-VERSION-GEN to be reusable
2024-11-19 11:50 ` [PATCH v8 00/23] " Patrick Steinhardt
2024-11-19 11:50 ` [PATCH v8 01/23] Makefile: use common template for GIT-BUILD-OPTIONS Patrick Steinhardt
2024-11-19 11:50 ` [PATCH v8 02/23] Makefile: consistently use @PLACEHOLDER@ to substitute Patrick Steinhardt
@ 2024-11-19 11:50 ` Patrick Steinhardt
2024-11-20 3:47 ` Junio C Hamano
2024-11-19 11:50 ` [PATCH v8 04/23] Makefile: propagate Git version via generated header Patrick Steinhardt
` (20 subsequent siblings)
23 siblings, 1 reply; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-19 11:50 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
Our "GIT-VERSION-GEN" script always writes the "GIT-VERSION-FILE" into
the current directory, where the expectation is that it should exist in
the source directory. But other build systems that support out-of-tree
builds may not want to do that to keep the source directory pristine,
even though CMake currently doesn't care.
Refactor the script such that it won't write the "GIT-VERSION-FILE"
directly anymore, but instead knows to replace @PLACEHOLDERS@ in an
arbitrary input file. This allows us to simplify the logic in CMake to
determine the project version, but can also be reused later on in order
to generate other files that need to contain version information like
our "git.rc" file.
While at it, change the format of the version file by removing the
spaces around the equals sign. Like this we can continue to include the
file in our Makefiles, but can also start to source it in shell scripts
in subsequent steps. Furthermore, we already start to replace some
placeholders that are not yet of relevance in this commit. These are
going to become relevant in subsequent steps, as well.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-VERSION-FILE.in | 1 +
GIT-VERSION-GEN | 64 ++++++++++++++++++++++++++++---------
Makefile | 5 ++-
ci/test-documentation.sh | 2 +-
contrib/buildsystems/CMakeLists.txt | 23 ++++---------
contrib/buildsystems/git-version.in | 1 +
6 files changed, 62 insertions(+), 34 deletions(-)
diff --git a/GIT-VERSION-FILE.in b/GIT-VERSION-FILE.in
new file mode 100644
index 0000000000000000000000000000000000000000..3789a48a34a3f9e37531fc24b577ffe3c657a3e9
--- /dev/null
+++ b/GIT-VERSION-FILE.in
@@ -0,0 +1 @@
+GIT_VERSION=@GIT_VERSION@
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index 78e8631f677bbebe8f18d83191f0fd014465563e..16f23d44873462aeb0fdb6a928f89fa32786bbbf 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -1,23 +1,41 @@
#!/bin/sh
-GVF=GIT-VERSION-FILE
DEF_VER=v2.47.GIT
LF='
'
+if test "$#" -ne 3
+then
+ echo "USAGE: $0 <SOURCE_DIR> <INPUT> <OUTPUT>" >&2
+ exit 1
+fi
+
+SOURCE_DIR="$1"
+INPUT="$2"
+OUTPUT="$3"
+
+if ! test -f "$INPUT"
+then
+ echo "Input is not a file: $INPUT" >&2
+ exit 1
+fi
+
+GIT_CEILING_DIRECTORIES="$SOURCE_DIR/.."
+export GIT_CEILING_DIRECTORIES
+
# First see if there is a version file (included in release tarballs),
# then try git-describe, then default.
-if test -f version
+if test -f "$SOURCE_DIR"/version
then
- VN=$(cat version) || VN="$DEF_VER"
-elif { test -d "${GIT_DIR:-.git}" || test -f .git; } &&
- VN=$(git describe --match "v[0-9]*" HEAD 2>/dev/null) &&
+ VN=$(cat "$SOURCE_DIR"/version) || VN="$DEF_VER"
+elif { test -d "$SOURCE_DIR/.git" || test -d "${GIT_DIR:-.git}" || test -f "$SOURCE_DIR"/.git; } &&
+ VN=$(git -C "$SOURCE_DIR" describe --match "v[0-9]*" HEAD 2>/dev/null) &&
case "$VN" in
*$LF*) (exit 1) ;;
v[0-9]*)
- git update-index -q --refresh
- test -z "$(git diff-index --name-only HEAD --)" ||
+ git -C "$SOURCE_DIR" update-index -q --refresh
+ test -z "$(git -C "$SOURCE_DIR" diff-index --name-only HEAD --)" ||
VN="$VN-dirty" ;;
esac
then
@@ -26,15 +44,31 @@ else
VN="$DEF_VER"
fi
-VN=$(expr "$VN" : v*'\(.*\)')
+GIT_BUILT_FROM_COMMIT=$(git -C "$SOURCE_DIR" rev-parse -q --verify HEAD 2>/dev/null)
+GIT_DATE=$(git -C "$SOURCE_DIR" show --quiet --format='%as')
+GIT_VERSION=$(expr "$VN" : v*'\(.*\)')
+if test -z "$GIT_USER_AGENT"
+then
+ GIT_USER_AGENT=git/$GIT_VERSION
+fi
+
+read GIT_MAJOR_VERSION GIT_MINOR_VERSION GIT_MICRO_VERSION GIT_PATCH_LEVEL trailing <<EOF
+$(echo "$GIT_VERSION" 0 0 0 0 | tr '.a-zA-Z-' ' ')
+EOF
+
+sed -e "s|@GIT_VERSION@|$GIT_VERSION|" \
+ -e "s|@GIT_DATE@|$GIT_DATE|" \
+ -e "s|@GIT_MAJOR_VERSION@|$GIT_MAJOR_VERSION|" \
+ -e "s|@GIT_MINOR_VERSION@|$GIT_MINOR_VERSION|" \
+ -e "s|@GIT_MICRO_VERSION@|$GIT_MICRO_VERSION|" \
+ -e "s|@GIT_PATCH_LEVEL@|$GIT_PATCH_LEVEL|" \
+ -e "s|@GIT_USER_AGENT@|$GIT_USER_AGENT|" \
+ -e "s|@GIT_BUILT_FROM_COMMIT@|$GIT_BUILT_FROM_COMMIT|" \
+ "$INPUT" >"$OUTPUT"+
-if test -r $GVF
+if ! test -f "$OUTPUT" || ! cmp "$OUTPUT"+ "$OUTPUT" >/dev/null
then
- VC=$(sed -e 's/^GIT_VERSION = //' <$GVF)
+ mv "$OUTPUT"+ "$OUTPUT"
else
- VC=unset
+ rm "$OUTPUT"+
fi
-test "$VN" = "$VC" || {
- echo >&2 "GIT_VERSION = $VN"
- echo "GIT_VERSION = $VN" >$GVF
-}
diff --git a/Makefile b/Makefile
index c3b546235a177cb090f8f6adcb13e07a1ccdcef1..456dfa0311b53627e6f5550c36a503808a4e5e3e 100644
--- a/Makefile
+++ b/Makefile
@@ -592,7 +592,10 @@ include shared.mak
# Disable -pedantic compilation.
GIT-VERSION-FILE: FORCE
- @$(SHELL_PATH) ./GIT-VERSION-GEN
+ @OLD=$$(cat $@ 2>/dev/null || :) && \
+ $(SHELL_PATH) ./GIT-VERSION-GEN "$(shell pwd)" GIT-VERSION-FILE.in $@ && \
+ NEW=$$(cat $@ 2>/dev/null || :) && \
+ if test "$$OLD" != "$$NEW"; then echo "$$NEW" >&2; fi
-include GIT-VERSION-FILE
# Set our default configuration.
diff --git a/ci/test-documentation.sh b/ci/test-documentation.sh
index 02b3af394117f840e078479ca60030141e47f998..6c018b673e0563fa5589195a77804c91deb93515 100755
--- a/ci/test-documentation.sh
+++ b/ci/test-documentation.sh
@@ -6,7 +6,7 @@
. ${0%/*}/lib.sh
filter_log () {
- sed -e '/^GIT_VERSION = /d' \
+ sed -e '/^GIT_VERSION=/d' \
-e "/constant Gem::ConfigMap is deprecated/d" \
-e '/^ \* new asciidoc flags$/d' \
-e '/stripped namespace before processing/d' \
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 8b0020edeba289e5eaa15a5452013fa2e4c3ed33..752479cac59d3833e7fff9239ebea75179692bf4 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -83,23 +83,12 @@ if(NOT SH_EXE)
"On Windows, you can get it as part of 'Git for Windows' install at https://gitforwindows.org/")
endif()
-#Create GIT-VERSION-FILE using GIT-VERSION-GEN
-if(NOT EXISTS ${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE)
- message("Generating GIT-VERSION-FILE")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
-endif()
-
-#Parse GIT-VERSION-FILE to get the version
-file(STRINGS ${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE git_version REGEX "GIT_VERSION = (.*)")
-string(REPLACE "GIT_VERSION = " "" git_version ${git_version})
-string(FIND ${git_version} "GIT" location)
-if(location EQUAL -1)
- string(REGEX MATCH "[0-9]*\\.[0-9]*\\.[0-9]*" git_version ${git_version})
-else()
- string(REGEX MATCH "[0-9]*\\.[0-9]*" git_version ${git_version})
- string(APPEND git_version ".0") #for building from a snapshot
-endif()
+message("Generating Git version")
+execute_process(COMMAND ${SH_EXE} "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_SOURCE_DIR}/contrib/buildsystems/git-version.in"
+ "${CMAKE_BINARY_DIR}/git-version")
+file(STRINGS "${CMAKE_BINARY_DIR}/git-version" git_version)
project(git
VERSION ${git_version}
diff --git a/contrib/buildsystems/git-version.in b/contrib/buildsystems/git-version.in
new file mode 100644
index 0000000000000000000000000000000000000000..9750505ae77685ebb31a38468caaf13501b6739d
--- /dev/null
+++ b/contrib/buildsystems/git-version.in
@@ -0,0 +1 @@
+@GIT_MAJOR_VERSION@.@GIT_MINOR_VERSION@.@GIT_MICRO_VERSION@
--
2.47.0.274.g962d0b743d.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v8 04/23] Makefile: propagate Git version via generated header
2024-11-19 11:50 ` [PATCH v8 00/23] " Patrick Steinhardt
` (2 preceding siblings ...)
2024-11-19 11:50 ` [PATCH v8 03/23] Makefile: refactor GIT-VERSION-GEN to be reusable Patrick Steinhardt
@ 2024-11-19 11:50 ` Patrick Steinhardt
2024-11-19 11:50 ` [PATCH v8 05/23] Makefile: generate "git.rc" via GIT-VERSION-GEN Patrick Steinhardt
` (19 subsequent siblings)
23 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-19 11:50 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
We set up a couple of preprocessor macros when compiling Git that
propagate the version that Git was built from to `git version` et al.
The way this is set up makes it harder than necessary to reuse the
infrastructure across the different build systems.
Refactor this such that we generate a "version-def.h" header via
`GIT-VERSION-GEN` instead.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
.gitignore | 1 +
Makefile | 12 +++++-------
contrib/buildsystems/CMakeLists.txt | 16 ++++++++++++----
version-def.h.in | 8 ++++++++
version.c | 1 +
5 files changed, 27 insertions(+), 11 deletions(-)
diff --git a/.gitignore b/.gitignore
index 6687bd6db4c0a6adf02292a9cb545d3e5270e2b0..e17963e84252fa094c10f5e84c0e3724153c819c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -195,6 +195,7 @@
/config-list.h
/command-list.h
/hook-list.h
+/version-def.h
*.tar.gz
*.dsc
*.deb
diff --git a/Makefile b/Makefile
index 456dfa0311b53627e6f5550c36a503808a4e5e3e..ede181f92708a1720027b25e30b74178ec1d45a6 100644
--- a/Makefile
+++ b/Makefile
@@ -2508,13 +2508,11 @@ PAGER_ENV_CQ_SQ = $(subst ','\'',$(PAGER_ENV_CQ))
pager.sp pager.s pager.o: EXTRA_CPPFLAGS = \
-DPAGER_ENV='$(PAGER_ENV_CQ_SQ)'
-version.sp version.s version.o: GIT-VERSION-FILE GIT-USER-AGENT
-version.sp version.s version.o: EXTRA_CPPFLAGS = \
- '-DGIT_VERSION="$(GIT_VERSION)"' \
- '-DGIT_USER_AGENT=$(GIT_USER_AGENT_CQ_SQ)' \
- '-DGIT_BUILT_FROM_COMMIT="$(shell \
- GIT_CEILING_DIRECTORIES="$(CURDIR)/.." \
- git rev-parse -q --verify HEAD 2>/dev/null)"'
+version-def.h: version-def.h.in GIT-VERSION-GEN GIT-VERSION-FILE GIT-USER-AGENT
+ $(QUIET_GEN)GIT_USER_AGENT="$(GIT_USER_AGENT)" $(SHELL_PATH) ./GIT-VERSION-GEN "$(shell pwd)" $< $@+
+ @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
+
+version.sp version.s version.o: version-def.h
$(BUILT_INS): git$X
$(QUIET_BUILT_IN)$(RM) $@ && \
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 752479cac59d3833e7fff9239ebea75179692bf4..b9ebe2ef74e37d5fad51f6e23aa234c563cad392 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -229,10 +229,7 @@ add_compile_definitions(PAGER_ENV="LESS=FRX LV=-c"
GIT_HTML_PATH="share/doc/git-doc"
DEFAULT_HELP_FORMAT="html"
DEFAULT_GIT_TEMPLATE_DIR="share/git-core/templates"
- GIT_VERSION="${PROJECT_VERSION}.GIT"
- GIT_USER_AGENT="git/${PROJECT_VERSION}.GIT"
- BINDIR="bin"
- GIT_BUILT_FROM_COMMIT="")
+ BINDIR="bin")
if(WIN32)
set(FALLBACK_RUNTIME_PREFIX /mingw64)
@@ -668,6 +665,17 @@ parse_makefile_for_sources(libgit_SOURCES "LIB_OBJS")
list(TRANSFORM libgit_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
list(TRANSFORM compat_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
+
+add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/version-def.h"
+ COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_SOURCE_DIR}/version-def.h.in"
+ "${CMAKE_BINARY_DIR}/version-def.h"
+ DEPENDS "${SH_EXE}" "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
+ "${CMAKE_SOURCE_DIR}/version-def.h.in"
+ VERBATIM)
+list(APPEND libgit_SOURCES "${CMAKE_BINARY_DIR}/version-def.h")
+
add_library(libgit ${libgit_SOURCES} ${compat_SOURCES})
#libxdiff
diff --git a/version-def.h.in b/version-def.h.in
new file mode 100644
index 0000000000000000000000000000000000000000..347995df0611e19428cf96ec9539f0dcfea999d2
--- /dev/null
+++ b/version-def.h.in
@@ -0,0 +1,8 @@
+#ifndef VERSION_DEF_H
+#define VERSION_DEF_H
+
+#define GIT_VERSION "@GIT_VERSION@"
+#define GIT_BUILT_FROM_COMMIT "@GIT_BUILT_FROM_COMMIT@"
+#define GIT_USER_AGENT "@GIT_USER_AGENT@"
+
+#endif /* VERSION_DEF_H */
diff --git a/version.c b/version.c
index 41b718c29e1b9fc2981d7d14a3d25e69c31a3030..7adc4d51ff25a0841607c21807deaf20721252de 100644
--- a/version.c
+++ b/version.c
@@ -1,5 +1,6 @@
#include "git-compat-util.h"
#include "version.h"
+#include "version-def.h"
#include "strbuf.h"
const char git_version_string[] = GIT_VERSION;
--
2.47.0.274.g962d0b743d.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v8 05/23] Makefile: generate "git.rc" via GIT-VERSION-GEN
2024-11-19 11:50 ` [PATCH v8 00/23] " Patrick Steinhardt
` (3 preceding siblings ...)
2024-11-19 11:50 ` [PATCH v8 04/23] Makefile: propagate Git version via generated header Patrick Steinhardt
@ 2024-11-19 11:50 ` Patrick Steinhardt
2024-11-19 11:50 ` [PATCH v8 06/23] Makefile: generate doc versions " Patrick Steinhardt
` (18 subsequent siblings)
23 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-19 11:50 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
The "git.rc" is used on Windows to embed information like the project
name and version into the resulting executables. As such we need to
inject the version information, which we do by using preprocessor
defines. The logic to do so is non-trivial and needs to be kept in sync
with the different build systems.
Refactor the logic so that we generate "git.rc" via `GIT-VERSION-GEN`.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
.gitignore | 1 +
Makefile | 11 ++++++-----
contrib/buildsystems/CMakeLists.txt | 19 +++++++++++++------
git.rc => git.rc.in | 6 +++---
4 files changed, 23 insertions(+), 14 deletions(-)
diff --git a/.gitignore b/.gitignore
index e17963e84252fa094c10f5e84c0e3724153c819c..d3be460040c6120d862a25dff1abd325b93b37fd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -199,6 +199,7 @@
*.tar.gz
*.dsc
*.deb
+/git.rc
/git.spec
*.exe
*.[aos]
diff --git a/Makefile b/Makefile
index ede181f92708a1720027b25e30b74178ec1d45a6..13dc29695361af8ded3c5146ff0578e198b4d0ab 100644
--- a/Makefile
+++ b/Makefile
@@ -2568,11 +2568,12 @@ $(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEFINES
$(QUIET_GEN)$(cmd_munge_script) && \
mv $@+ $@
-git.res: git.rc GIT-VERSION-FILE GIT-PREFIX
- $(QUIET_RC)$(RC) \
- $(join -DMAJOR= -DMINOR= -DMICRO= -DPATCHLEVEL=, $(wordlist 1, 4, \
- $(shell echo $(GIT_VERSION) 0 0 0 0 | tr '.a-zA-Z-' ' '))) \
- -DGIT_VERSION="\\\"$(GIT_VERSION)\\\"" -i $< -o $@
+git.rc: git.rc.in GIT-VERSION-GEN GIT-VERSION-FILE
+ $(QUIET_GEN)$(SHELL_PATH) ./GIT-VERSION-GEN "$(shell pwd)" $< $@+
+ @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
+
+git.res: git.rc GIT-PREFIX
+ $(QUIET_RC)$(RC) -i $< -o $@
# This makes sure we depend on the NO_PERL setting itself.
$(SCRIPT_PERL_GEN): GIT-BUILD-OPTIONS
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index b9ebe2ef74e37d5fad51f6e23aa234c563cad392..b893b0143a72ad284887d1d4ca72f1beb0a39ad7 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -691,18 +691,25 @@ list(TRANSFORM reftable_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
add_library(reftable STATIC ${reftable_SOURCES})
if(WIN32)
+ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/git.rc
+ COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_SOURCE_DIR}/git.rc.in"
+ "${CMAKE_BINARY_DIR}/git.rc"
+ DEPENDS "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
+ "${CMAKE_SOURCE_DIR}/git.rc.in"
+ VERBATIM)
+
if(NOT MSVC)#use windres when compiling with gcc and clang
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/git.res
- COMMAND ${WINDRES_EXE} -O coff -DMAJOR=${PROJECT_VERSION_MAJOR} -DMINOR=${PROJECT_VERSION_MINOR}
- -DMICRO=${PROJECT_VERSION_PATCH} -DPATCHLEVEL=0 -DGIT_VERSION="\\\"${PROJECT_VERSION}.GIT\\\""
- -i ${CMAKE_SOURCE_DIR}/git.rc -o ${CMAKE_BINARY_DIR}/git.res
+ COMMAND ${WINDRES_EXE} -O coff -i ${CMAKE_BINARY_DIR}/git.rc -o ${CMAKE_BINARY_DIR}/git.res
+ DEPENDS "${CMAKE_BINARY_DIR}/git.rc"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
VERBATIM)
else()#MSVC use rc
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/git.res
- COMMAND ${CMAKE_RC_COMPILER} /d MAJOR=${PROJECT_VERSION_MAJOR} /d MINOR=${PROJECT_VERSION_MINOR}
- /d MICRO=${PROJECT_VERSION_PATCH} /d PATCHLEVEL=0 /d GIT_VERSION="${PROJECT_VERSION}.GIT"
- /fo ${CMAKE_BINARY_DIR}/git.res ${CMAKE_SOURCE_DIR}/git.rc
+ COMMAND ${CMAKE_RC_COMPILER} /fo ${CMAKE_BINARY_DIR}/git.res ${CMAKE_BINARY_DIR}/git.rc
+ DEPENDS "${CMAKE_BINARY_DIR}/git.rc"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
VERBATIM)
endif()
diff --git a/git.rc b/git.rc.in
similarity index 67%
rename from git.rc
rename to git.rc.in
index cc3fdc6cc6cb83b084eebe2ad49f3c78c981789b..e69444eef3f0c558707e067d52820668d2116308 100644
--- a/git.rc
+++ b/git.rc.in
@@ -1,6 +1,6 @@
1 VERSIONINFO
-FILEVERSION MAJOR,MINOR,MICRO,PATCHLEVEL
-PRODUCTVERSION MAJOR,MINOR,MICRO,PATCHLEVEL
+FILEVERSION @GIT_MAJOR_VERSION@,@GIT_MINOR_VERSION@,@GIT_MICRO_VERSION@,@GIT_PATCH_LEVEL@
+PRODUCTVERSION @GIT_MAJOR_VERSION@,@GIT_MINOR_VERSION@,@GIT_MICRO_VERSION@,@GIT_PATCH_LEVEL@
BEGIN
BLOCK "StringFileInfo"
BEGIN
@@ -11,7 +11,7 @@ BEGIN
VALUE "InternalName", "git\0"
VALUE "OriginalFilename", "git.exe\0"
VALUE "ProductName", "Git\0"
- VALUE "ProductVersion", GIT_VERSION "\0"
+ VALUE "ProductVersion", "@GIT_VERSION@\0"
END
END
--
2.47.0.274.g962d0b743d.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v8 06/23] Makefile: generate doc versions via GIT-VERSION-GEN
2024-11-19 11:50 ` [PATCH v8 00/23] " Patrick Steinhardt
` (4 preceding siblings ...)
2024-11-19 11:50 ` [PATCH v8 05/23] Makefile: generate "git.rc" via GIT-VERSION-GEN Patrick Steinhardt
@ 2024-11-19 11:50 ` Patrick Steinhardt
2024-11-19 11:50 ` [PATCH v8 07/23] Makefile: consistently use PERL_PATH Patrick Steinhardt
` (17 subsequent siblings)
23 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-19 11:50 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
The documentation we generate embeds information for the exact Git
version used as well as the date of the commit. This information is
injected by injecting attributes into the build process via command line
argument.
Refactor the logic so that we write the information into "asciidoc.conf"
and "asciidoctor-extensions.rb" via `GIT-VERSION-GEN` for AsciiDoc and
AsciiDoctor, respectively.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Documentation/.gitignore | 2 ++
Documentation/Makefile | 18 ++++++++++++------
Documentation/{asciidoc.conf => asciidoc.conf.in} | 3 +++
...ctor-extensions.rb => asciidoctor-extensions.rb.in} | 8 ++------
4 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/Documentation/.gitignore b/Documentation/.gitignore
index a48448de32f98b1a054b36e886ea920bccebc494..649df89474d357ccc91109b5c35fe2d0910f968a 100644
--- a/Documentation/.gitignore
+++ b/Documentation/.gitignore
@@ -15,3 +15,5 @@ tmp-doc-diff/
GIT-ASCIIDOCFLAGS
/.build/
/GIT-EXCLUDED-PROGRAMS
+/asciidoc.conf
+/asciidoctor-extensions.rb
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 0f55baa252fffbcd506f0c6f410b26b37f2e9b11..aac489d3b01e9ca08f24a7f604d4b8dae50860d6 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -1,6 +1,8 @@
# Import tree-wide shared Makefile behavior and libraries
include ../shared.mak
+.PHONY: FORCE
+
# Guard against environment variables
MAN1_TXT =
MAN5_TXT =
@@ -148,16 +150,12 @@ man5dir = $(mandir)/man5
man7dir = $(mandir)/man7
# DESTDIR =
-GIT_DATE := $(shell git show --quiet --pretty='%as')
-
ASCIIDOC = asciidoc
ASCIIDOC_EXTRA =
ASCIIDOC_HTML = xhtml11
ASCIIDOC_DOCBOOK = docbook
ASCIIDOC_CONF = -f asciidoc.conf
-ASCIIDOC_COMMON = $(ASCIIDOC) $(ASCIIDOC_EXTRA) $(ASCIIDOC_CONF) \
- -amanmanual='Git Manual' -amansource='Git $(GIT_VERSION)' \
- -arevdate='$(GIT_DATE)'
+ASCIIDOC_COMMON = $(ASCIIDOC) $(ASCIIDOC_EXTRA) $(ASCIIDOC_CONF)
ASCIIDOC_DEPS = asciidoc.conf GIT-ASCIIDOCFLAGS
TXT_TO_HTML = $(ASCIIDOC_COMMON) -b $(ASCIIDOC_HTML)
TXT_TO_XML = $(ASCIIDOC_COMMON) -b $(ASCIIDOC_DOCBOOK)
@@ -210,6 +208,14 @@ ASCIIDOC_DEPS = asciidoctor-extensions.rb GIT-ASCIIDOCFLAGS
DBLATEX_COMMON =
XMLTO_EXTRA += --skip-validation
XMLTO_EXTRA += -x manpage.xsl
+
+asciidoctor-extensions.rb: asciidoctor-extensions.rb.in FORCE
+ $(QUIET_GEN)GIT_USER_AGENT="$(GIT_USER_AGENT)" $(SHELL_PATH) ../GIT-VERSION-GEN "$(shell pwd)/.." $< $@+
+ @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
+else
+asciidoc.conf: asciidoc.conf.in FORCE
+ $(QUIET_GEN)GIT_USER_AGENT="$(GIT_USER_AGENT)" $(SHELL_PATH) ../GIT-VERSION-GEN "$(shell pwd)/.." $< $@+
+ @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
endif
ASCIIDOC_DEPS += docinfo.html
@@ -364,7 +370,7 @@ manpage-cmd = $(QUIET_XMLTO)$(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
%.xml : %.txt $(ASCIIDOC_DEPS)
$(QUIET_ASCIIDOC)$(TXT_TO_XML) -d manpage -o $@ $<
-user-manual.xml: user-manual.txt user-manual.conf asciidoctor-extensions.rb GIT-ASCIIDOCFLAGS
+user-manual.xml: user-manual.txt user-manual.conf $(ASCIIDOC_DEPS)
$(QUIET_ASCIIDOC)$(TXT_TO_XML) -d book -o $@ $<
technical/api-index.txt: technical/api-index-skel.txt \
diff --git a/Documentation/asciidoc.conf b/Documentation/asciidoc.conf.in
similarity index 97%
rename from Documentation/asciidoc.conf
rename to Documentation/asciidoc.conf.in
index f6da6d1fbd2b208b072c1158dfcfb29c6c01f93a..dbe36a52eabfabef59e31d3be6518549e4f90206 100644
--- a/Documentation/asciidoc.conf
+++ b/Documentation/asciidoc.conf.in
@@ -21,6 +21,9 @@ tilde=~
apostrophe='
backtick=`
litdd=--
+manmanual='Git Manual'
+mansource='Git @GIT_VERSION@'
+revdate='@GIT_DATE@'
ifdef::backend-docbook[]
[linkgit-inlinemacro]
diff --git a/Documentation/asciidoctor-extensions.rb b/Documentation/asciidoctor-extensions.rb.in
similarity index 92%
rename from Documentation/asciidoctor-extensions.rb
rename to Documentation/asciidoctor-extensions.rb.in
index cb24480b63d2ecc5c4ef267f4c501da53fc5b5be..c4c200dace85cf0a89dbc0f54ef25e4d1b6fec4d 100644
--- a/Documentation/asciidoctor-extensions.rb
+++ b/Documentation/asciidoctor-extensions.rb.in
@@ -29,13 +29,9 @@ module Git
class DocumentPostProcessor < Asciidoctor::Extensions::Postprocessor
def process document, output
if document.basebackend? 'docbook'
- mansource = document.attributes['mansource']
- manversion = document.attributes['manversion']
- manmanual = document.attributes['manmanual']
new_tags = "" \
- "<refmiscinfo class=\"source\">#{mansource}</refmiscinfo>\n" \
- "<refmiscinfo class=\"version\">#{manversion}</refmiscinfo>\n" \
- "<refmiscinfo class=\"manual\">#{manmanual}</refmiscinfo>\n"
+ "<refmiscinfo class=\"source\">@GIT_VERSION@</refmiscinfo>\n" \
+ "<refmiscinfo class=\"manual\">Git Manual</refmiscinfo>\n"
output = output.sub(/<\/refmeta>/, new_tags + "</refmeta>")
end
output
--
2.47.0.274.g962d0b743d.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v8 07/23] Makefile: consistently use PERL_PATH
2024-11-19 11:50 ` [PATCH v8 00/23] " Patrick Steinhardt
` (5 preceding siblings ...)
2024-11-19 11:50 ` [PATCH v8 06/23] Makefile: generate doc versions " Patrick Steinhardt
@ 2024-11-19 11:50 ` Patrick Steinhardt
2024-11-19 11:50 ` [PATCH v8 08/23] Makefile: extract script to massage Perl scripts Patrick Steinhardt
` (16 subsequent siblings)
23 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-19 11:50 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
When injecting the Perl path into our scripts we sometimes use '@PERL@'
while we othertimes use '@PERL_PATH@'. Refactor the code use the latter
consistently, which makes it easier to reuse the same logic for multiple
scripts.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 2 +-
contrib/buildsystems/CMakeLists.txt | 2 +-
git-instaweb.sh | 4 ++--
git-request-pull.sh | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile
index 13dc29695361af8ded3c5146ff0578e198b4d0ab..94b1ccc7b714743a149df5200a5a8d60b605c1ab 100644
--- a/Makefile
+++ b/Makefile
@@ -2554,7 +2554,7 @@ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's/@USE_GETTEXT_SCHEME@/$(USE_GETTEXT_SCHEME)/g' \
-e $(BROKEN_PATH_FIX) \
-e 's|@GITWEBDIR@|$(gitwebdir_SQ)|g' \
- -e 's|@PERL@|$(PERL_PATH_SQ)|g' \
+ -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' \
-e 's|@PAGER_ENV@|$(PAGER_ENV_SQ)|g' \
$@.sh >$@+
endef
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index b893b0143a72ad284887d1d4ca72f1beb0a39ad7..f8892c49c6d317040b3b6447b88133b2bfff3fcf 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -846,7 +846,7 @@ foreach(script ${git_shell_scripts})
string(REPLACE "@NO_CURL@" "" content "${content}")
string(REPLACE "@USE_GETTEXT_SCHEME@" "" content "${content}")
string(REPLACE "# @BROKEN_PATH_FIX@" "" content "${content}")
- string(REPLACE "@PERL@" "${PERL_PATH}" content "${content}")
+ string(REPLACE "@PERL_PATH@" "${PERL_PATH}" content "${content}")
string(REPLACE "@PAGER_ENV@" "LESS=FRX LV=-c" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
endforeach()
diff --git a/git-instaweb.sh b/git-instaweb.sh
index c8efb1205a8e2a66a6aced840980978897e122bc..5ad50160bb035885d8c180bee3ebb0a8e9622abc 100755
--- a/git-instaweb.sh
+++ b/git-instaweb.sh
@@ -3,7 +3,7 @@
# Copyright (c) 2006 Eric Wong
#
-PERL='@PERL@'
+PERL='@PERL_PATH@'
OPTIONS_KEEPDASHDASH=
OPTIONS_STUCKLONG=
OPTIONS_SPEC="\
@@ -716,7 +716,7 @@ EOF
gitweb_conf() {
cat > "$fqgitdir/gitweb/gitweb_config.perl" <<EOF
-#!@PERL@
+#!@PERL_PATH@
our \$projectroot = "$(dirname "$fqgitdir")";
our \$git_temp = "$fqgitdir/gitweb/tmp";
our \$projects_list = \$projectroot;
diff --git a/git-request-pull.sh b/git-request-pull.sh
index 10c88639e28c02650ffea3d4671afa9a9f0bb182..775ba8ea11aa0fce90ae9bfaea8eac5b8bc584a4 100755
--- a/git-request-pull.sh
+++ b/git-request-pull.sh
@@ -112,7 +112,7 @@ find_matching_ref='
}
'
-set fnord $(git ls-remote "$url" | @PERL@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
+set fnord $(git ls-remote "$url" | @PERL_PATH@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
remote_sha1=$2
ref=$3
--
2.47.0.274.g962d0b743d.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v8 08/23] Makefile: extract script to massage Perl scripts
2024-11-19 11:50 ` [PATCH v8 00/23] " Patrick Steinhardt
` (6 preceding siblings ...)
2024-11-19 11:50 ` [PATCH v8 07/23] Makefile: consistently use PERL_PATH Patrick Steinhardt
@ 2024-11-19 11:50 ` Patrick Steinhardt
2024-11-19 11:50 ` [PATCH v8 09/23] Makefile: use "generate-perl.sh" to massage Perl library Patrick Steinhardt
` (15 subsequent siblings)
23 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-19 11:50 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
Extract the script to inject various build-time parameters into our Perl
scripts into a standalone script. This is done such that we can reuse it
in other build systems.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 12 ++----------
contrib/buildsystems/CMakeLists.txt | 32 +++++++++++++++++++++++++++-----
generate-perl.sh | 27 +++++++++++++++++++++++++++
3 files changed, 56 insertions(+), 15 deletions(-)
diff --git a/Makefile b/Makefile
index 94b1ccc7b714743a149df5200a5a8d60b605c1ab..d3d7e06e930ab031561d0605c3f4a1d05c8e71a3 100644
--- a/Makefile
+++ b/Makefile
@@ -2606,16 +2606,8 @@ endif
PERL_DEFINES += $(gitexecdir) $(perllibdir) $(localedir)
-$(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
- $(QUIET_GEN) \
- sed -e '1{' \
- -e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \
- -e ' r GIT-PERL-HEADER' \
- -e ' G' \
- -e '}' \
- -e 's/@GIT_VERSION@/$(GIT_VERSION)/g' \
- $< >$@+ && \
- chmod +x $@+ && \
+$(SCRIPT_PERL_GEN): % : %.perl generate-perl.sh GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
+ $(QUIET_GEN)$(SHELL_PATH) generate-perl.sh ./GIT-BUILD-OPTIONS ./GIT-VERSION-FILE GIT-PERL-HEADER "$<" "$@+" && \
mv $@+ $@
PERL_DEFINES := $(subst $(space),:,$(PERL_DEFINES))
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index f8892c49c6d317040b3b6447b88133b2bfff3fcf..e2e7d3da2028cd36a9761f78607539080361b3ec 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -852,19 +852,41 @@ foreach(script ${git_shell_scripts})
endforeach()
#perl scripts
-parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" ".perl")
+parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" "")
#create perl header
file(STRINGS ${CMAKE_SOURCE_DIR}/perl/header_templates/fixed_prefix.template.pl perl_header )
string(REPLACE "@PATHSEP@" ":" perl_header "${perl_header}")
string(REPLACE "@INSTLIBDIR@" "${INSTLIBDIR}" perl_header "${perl_header}")
+file(WRITE ${CMAKE_BINARY_DIR}/PERL-HEADER ${perl_header})
+
+add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/GIT-VERSION-FILE"
+ COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE.in"
+ "${CMAKE_BINARY_DIR}/GIT-VERSION-FILE"
+ DEPENDS ${SH_EXE} "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
+ "${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE.in"
+ VERBATIM)
foreach(script ${git_perl_scripts})
- file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.perl content NEWLINE_CONSUME)
- string(REPLACE "#!/usr/bin/perl" "#!/usr/bin/perl\n${perl_header}\n" content "${content}")
- string(REPLACE "@GIT_VERSION@" "${PROJECT_VERSION}" content "${content}")
- file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
+ string(REPLACE ".perl" "" perl_gen_path "${script}")
+
+ add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/${perl_gen_path}"
+ COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-perl.sh"
+ "${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS"
+ "${CMAKE_BINARY_DIR}/GIT-VERSION-FILE"
+ "${CMAKE_BINARY_DIR}/PERL-HEADER"
+ "${CMAKE_SOURCE_DIR}/${script}"
+ "${CMAKE_BINARY_DIR}/${perl_gen_path}"
+ DEPENDS "${CMAKE_SOURCE_DIR}/generate-perl.sh"
+ "${CMAKE_SOURCE_DIR}/${script}"
+ "${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS"
+ "${CMAKE_BINARY_DIR}/GIT-VERSION-FILE"
+ VERBATIM)
+ list(APPEND perl_gen ${CMAKE_BINARY_DIR}/${perl_gen_path})
endforeach()
+add_custom_target(perl-gen ALL DEPENDS ${perl_gen})
#python script
file(STRINGS ${CMAKE_SOURCE_DIR}/git-p4.py content NEWLINE_CONSUME)
diff --git a/generate-perl.sh b/generate-perl.sh
new file mode 100755
index 0000000000000000000000000000000000000000..f168cce734dbbe80b58b4b761b13e8a177f70642
--- /dev/null
+++ b/generate-perl.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+set -e
+
+if test $# -ne 5
+then
+ echo "USAGE: $0 <GIT_BUILD_OPTIONS> <GIT_VERSION_FILE> <PERL_HEADER> <INPUT> <OUTPUT>" >&2
+ exit 1
+fi
+
+GIT_BUILD_OPTIONS="$1"
+GIT_VERSION_FILE="$2"
+PERL_HEADER="$3"
+INPUT="$4"
+OUTPUT="$5"
+
+. "$GIT_BUILD_OPTIONS"
+. "$GIT_VERSION_FILE"
+
+sed -e '1{' \
+ -e " s|#!.*perl|#!$PERL_PATH|" \
+ -e " r $PERL_HEADER" \
+ -e ' G' \
+ -e '}' \
+ -e "s/@GIT_VERSION@/$GIT_VERSION/g" \
+ "$INPUT" >"$OUTPUT"
+chmod a+x "$OUTPUT"
--
2.47.0.274.g962d0b743d.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v8 09/23] Makefile: use "generate-perl.sh" to massage Perl library
2024-11-19 11:50 ` [PATCH v8 00/23] " Patrick Steinhardt
` (7 preceding siblings ...)
2024-11-19 11:50 ` [PATCH v8 08/23] Makefile: extract script to massage Perl scripts Patrick Steinhardt
@ 2024-11-19 11:50 ` Patrick Steinhardt
2024-11-19 11:50 ` [PATCH v8 10/23] Makefile: extract script to massage Shell scripts Patrick Steinhardt
` (14 subsequent siblings)
23 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-19 11:50 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
Extend "generate-perl.sh" such that it knows to also massage the Perl
library files. There are two major differences:
- We do not read in the Perl header. This is handled by matching on
whether or not we have a Perl shebang.
- We substitute some more variables, which we read in via our
GIT-BUILD-OPTIONS.
Adapt both our Makefile and the CMake build instructions to use this.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-BUILD-OPTIONS.in | 2 ++
Makefile | 10 ++++------
contrib/buildsystems/CMakeLists.txt | 23 +++++++++--------------
generate-perl.sh | 14 ++++++++++++--
4 files changed, 27 insertions(+), 22 deletions(-)
diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in
index f0ca240493c94aa41a6b6241a8474e42f7cdc8b9..050432f9fc49f93d0f6ed98c1307405c52761be0 100644
--- a/GIT-BUILD-OPTIONS.in
+++ b/GIT-BUILD-OPTIONS.in
@@ -1,6 +1,8 @@
SHELL_PATH=@SHELL_PATH@
TEST_SHELL_PATH=@TEST_SHELL_PATH@
PERL_PATH=@PERL_PATH@
+PERL_LOCALEDIR=@PERL_LOCALEDIR@
+NO_PERL_CPAN_FALLBACKS=@NO_PERL_CPAN_FALLBACKS@
DIFF=@DIFF@
PYTHON_PATH=@PYTHON_PATH@
TAR=@TAR@
diff --git a/Makefile b/Makefile
index d3d7e06e930ab031561d0605c3f4a1d05c8e71a3..07dc35101b69aad0c06ac61ddade8219ff52fcbd 100644
--- a/Makefile
+++ b/Makefile
@@ -3095,13 +3095,9 @@ endif
NO_PERL_CPAN_FALLBACKS_SQ = $(subst ','\'',$(NO_PERL_CPAN_FALLBACKS))
endif
-perl/build/lib/%.pm: perl/%.pm GIT-PERL-DEFINES
+perl/build/lib/%.pm: perl/%.pm generate-perl.sh GIT-BUILD-OPTIONS GIT-VERSION-FILE GIT-PERL-DEFINES
$(call mkdir_p_parent_template)
- $(QUIET_GEN) \
- sed -e 's|@LOCALEDIR@|$(perl_localedir_SQ)|g' \
- -e 's|@NO_GETTEXT@|$(NO_GETTEXT_SQ)|g' \
- -e 's|@NO_PERL_CPAN_FALLBACKS@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \
- < $< > $@
+ $(QUIET_GEN)$(SHELL_PATH) generate-perl.sh ./GIT-BUILD-OPTIONS ./GIT-VERSION-FILE GIT-PERL-HEADER "$<" "$@"
perl/build/man/man3/Git.3pm: perl/Git.pm
$(call mkdir_p_parent_template)
@@ -3168,6 +3164,8 @@ GIT-BUILD-OPTIONS: FORCE
-e "s|@SHELL_PATH@|\'$(SHELL_PATH_SQ)\'|" \
-e "s|@TEST_SHELL_PATH@|\'$(TEST_SHELL_PATH_SQ)\'|" \
-e "s|@PERL_PATH@|\'$(PERL_PATH_SQ)\'|" \
+ -e "s|@PERL_LOCALEDIR@|\'$(perl_localedir_SQ)\'|" \
+ -e "s|@NO_PERL_CPAN_FALLBACKS@|\'$(NO_PERL_CPAN_FALLBACKS_SQ)\'|" \
-e "s|@DIFF@|\'$(DIFF)\'|" \
-e "s|@PYTHON_PATH@|\'$(PYTHON_PATH_SQ)\'|" \
-e "s|@TAR@|\'$(TAR)\'|" \
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index e2e7d3da2028cd36a9761f78607539080361b3ec..0f9180937e76cad4ad831d34877ea276413e76c9 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -853,6 +853,9 @@ endforeach()
#perl scripts
parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" "")
+#perl modules
+file(GLOB_RECURSE perl_modules "${CMAKE_SOURCE_DIR}/perl/*.pm")
+list(TRANSFORM perl_modules REPLACE "${CMAKE_SOURCE_DIR}/" "")
#create perl header
file(STRINGS ${CMAKE_SOURCE_DIR}/perl/header_templates/fixed_prefix.template.pl perl_header )
@@ -869,9 +872,12 @@ add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/GIT-VERSION-FILE"
"${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE.in"
VERBATIM)
-foreach(script ${git_perl_scripts})
+foreach(script ${git_perl_scripts} ${perl_modules})
string(REPLACE ".perl" "" perl_gen_path "${script}")
+ get_filename_component(perl_gen_dir "${perl_gen_path}" DIRECTORY)
+ file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/${perl_gen_dir}")
+
add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/${perl_gen_path}"
COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-perl.sh"
"${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS"
@@ -893,19 +899,6 @@ file(STRINGS ${CMAKE_SOURCE_DIR}/git-p4.py content NEWLINE_CONSUME)
string(REPLACE "#!/usr/bin/env python" "#!/usr/bin/python" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/git-p4 ${content})
-#perl modules
-file(GLOB_RECURSE perl_modules "${CMAKE_SOURCE_DIR}/perl/*.pm")
-
-foreach(pm ${perl_modules})
- string(REPLACE "${CMAKE_SOURCE_DIR}/perl/" "" file_path ${pm})
- file(STRINGS ${pm} content NEWLINE_CONSUME)
- string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}")
- string(REPLACE "@NO_PERL_CPAN_FALLBACKS@" "" content "${content}")
- file(WRITE ${CMAKE_BINARY_DIR}/perl/build/lib/${file_path} ${content})
-#test-lib.sh requires perl/build/lib to be the build directory of perl modules
-endforeach()
-
-
#templates
file(GLOB templates "${CMAKE_SOURCE_DIR}/templates/*")
list(TRANSFORM templates REPLACE "${CMAKE_SOURCE_DIR}/templates/" "")
@@ -1147,6 +1140,8 @@ file(STRINGS ${CMAKE_SOURCE_DIR}/GIT-BUILD-OPTIONS.in git_build_options NEWLINE_
string(REPLACE "@SHELL_PATH@" "'${SHELL_PATH}'" git_build_options "${git_build_options}")
string(REPLACE "@TEST_SHELL_PATH@" "'${TEST_SHELL_PATH}'" git_build_options "${git_build_options}")
string(REPLACE "@PERL_PATH@" "'${PERL_PATH}'" git_build_options "${git_build_options}")
+string(REPLACE "@PERL_LOCALEDIR@" "'${LOCALEDIR}'" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PERL_CPAN_FALLBACKS@" "" git_build_options "${git_build_options}")
string(REPLACE "@DIFF@" "'${DIFF}'" git_build_options "${git_build_options}")
string(REPLACE "@PYTHON_PATH@" "'${PYTHON_PATH}'" git_build_options "${git_build_options}")
string(REPLACE "@TAR@" "'${TAR}'" git_build_options "${git_build_options}")
diff --git a/generate-perl.sh b/generate-perl.sh
index f168cce734dbbe80b58b4b761b13e8a177f70642..d9eaed86218c5f74fdae06bf3170808104058fa7 100755
--- a/generate-perl.sh
+++ b/generate-perl.sh
@@ -18,10 +18,20 @@ OUTPUT="$5"
. "$GIT_VERSION_FILE"
sed -e '1{' \
+ -e " /^#!.*perl/!b" \
-e " s|#!.*perl|#!$PERL_PATH|" \
-e " r $PERL_HEADER" \
-e ' G' \
-e '}' \
- -e "s/@GIT_VERSION@/$GIT_VERSION/g" \
+ -e "s|@GIT_VERSION@|$GIT_VERSION|g" \
+ -e "s|@LOCALEDIR@|$PERL_LOCALEDIR|g" \
+ -e "s|@NO_GETTEXT@|$NO_GETTEXT|g" \
+ -e "s|@NO_PERL_CPAN_FALLBACKS@|$NO_PERL_CPAN_FALLBACKS|g" \
"$INPUT" >"$OUTPUT"
-chmod a+x "$OUTPUT"
+
+case "$INPUT" in
+*.perl)
+ chmod a+x "$OUTPUT";;
+*)
+ ;;
+esac
--
2.47.0.274.g962d0b743d.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v8 10/23] Makefile: extract script to massage Shell scripts
2024-11-19 11:50 ` [PATCH v8 00/23] " Patrick Steinhardt
` (8 preceding siblings ...)
2024-11-19 11:50 ` [PATCH v8 09/23] Makefile: use "generate-perl.sh" to massage Perl library Patrick Steinhardt
@ 2024-11-19 11:50 ` Patrick Steinhardt
2024-11-19 11:50 ` [PATCH v8 11/23] Makefile: extract script to generate gitweb.cgi Patrick Steinhardt
` (13 subsequent siblings)
23 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-19 11:50 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
Same as in the preceding commits, extract a script that allows us to
unify how we massage shell scripts.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-BUILD-OPTIONS.in | 4 ++++
Makefile | 34 ++++++++++------------------------
contrib/buildsystems/CMakeLists.txt | 31 ++++++++++++++++++++-----------
generate-script.sh | 34 ++++++++++++++++++++++++++++++++++
4 files changed, 68 insertions(+), 35 deletions(-)
diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in
index 050432f9fc49f93d0f6ed98c1307405c52761be0..9b95a6b3eee334b6f691702696ca9d92201b6bac 100644
--- a/GIT-BUILD-OPTIONS.in
+++ b/GIT-BUILD-OPTIONS.in
@@ -36,3 +36,7 @@ GIT_INTEROP_MAKE_OPTS=@GIT_INTEROP_MAKE_OPTS@
GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@
GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@
RUNTIME_PREFIX=@RUNTIME_PREFIX@
+GITWEBDIR=@GITWEBDIR@
+USE_GETTEXT_SCHEME=@USE_GETTEXT_SCHEME@
+LOCALEDIR=@LOCALEDIR@
+BROKEN_PATH_FIX=@BROKEN_PATH_FIX@
diff --git a/Makefile b/Makefile
index 07dc35101b69aad0c06ac61ddade8219ff52fcbd..0d40dbdffa06311c2727f9ed47a730b772a7e684 100644
--- a/Makefile
+++ b/Makefile
@@ -1558,10 +1558,10 @@ endif
ifdef SANE_TOOL_PATH
SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH))
-BROKEN_PATH_FIX = 's|^\# @BROKEN_PATH_FIX@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|'
+BROKEN_PATH_FIX = s|^\# @BROKEN_PATH_FIX@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|
PATH := $(SANE_TOOL_PATH):${PATH}
else
-BROKEN_PATH_FIX = '/^\# @BROKEN_PATH_FIX@$$/d'
+BROKEN_PATH_FIX = /^\# @BROKEN_PATH_FIX@$$/d
endif
ifeq (,$(HOST_CPU))
@@ -2546,26 +2546,8 @@ GIT-SCRIPT-DEFINES: FORCE
echo "$$FLAGS" >$@; \
fi
-define cmd_munge_script
-sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
- -e 's|@DIFF@|$(DIFF_SQ)|' \
- -e 's|@LOCALEDIR@|$(localedir_SQ)|g' \
- -e 's/@USE_GETTEXT_SCHEME@/$(USE_GETTEXT_SCHEME)/g' \
- -e $(BROKEN_PATH_FIX) \
- -e 's|@GITWEBDIR@|$(gitwebdir_SQ)|g' \
- -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' \
- -e 's|@PAGER_ENV@|$(PAGER_ENV_SQ)|g' \
- $@.sh >$@+
-endef
-
-$(SCRIPT_SH_GEN) : % : %.sh GIT-SCRIPT-DEFINES
- $(QUIET_GEN)$(cmd_munge_script) && \
- chmod +x $@+ && \
- mv $@+ $@
-
-$(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEFINES
- $(QUIET_GEN)$(cmd_munge_script) && \
+$(SCRIPT_SH_GEN) $(SCRIPT_LIB) : % : %.sh generate-script.sh GIT-BUILD-OPTIONS GIT-SCRIPT-DEFINES
+ $(QUIET_GEN)./generate-script.sh "$<" "$@+" ./GIT-BUILD-OPTIONS && \
mv $@+ $@
git.rc: git.rc.in GIT-VERSION-GEN GIT-VERSION-FILE
@@ -2635,8 +2617,8 @@ GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile
perllibdir:
@echo '$(perllibdir_SQ)'
-git-instaweb: git-instaweb.sh GIT-SCRIPT-DEFINES
- $(QUIET_GEN)$(cmd_munge_script) && \
+git-instaweb: git-instaweb.sh generate-script.sh GIT-BUILD-OPTIONS GIT-SCRIPT-DEFINES
+ $(QUIET_GEN)./generate-script.sh "$<" "$@+" ./GIT-BUILD-OPTIONS && \
chmod +x $@+ && \
mv $@+ $@
else # NO_PERL
@@ -3199,6 +3181,10 @@ GIT-BUILD-OPTIONS: FORCE
-e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \
-e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \
-e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX_OPTION)\'|" \
+ -e "s|@GITWEBDIR@|\'$(gitwebdir_SQ)\'|" \
+ -e "s|@USE_GETTEXT_SCHEME@|\'$(USE_GETTEXT_SCHEME)\'|" \
+ -e "s|@LOCALEDIR@|\'$(localedir_SQ)\'|" \
+ -e "s!@BROKEN_PATH_FIX@!\'$(BROKEN_PATH_FIX)\'!" \
GIT-BUILD-OPTIONS.in >$@+
@if grep -q '^[A-Z][A-Z_]*=@.*@$$' $@+; then echo "Unsubstituted build options in $@" >&2 && exit 1; fi
@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 0f9180937e76cad4ad831d34877ea276413e76c9..7121fdfbc2ba50b4c7afb3f2b45fdaa5b9909a60 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -838,18 +838,23 @@ set(git_shell_scripts
${git_sh_scripts} ${git_shlib_scripts} git-instaweb)
foreach(script ${git_shell_scripts})
- file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.sh content NEWLINE_CONSUME)
- string(REPLACE "@SHELL_PATH@" "${SHELL_PATH}" content "${content}")
- string(REPLACE "@DIFF@" "diff" content "${content}")
- string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}")
- string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" content "${content}")
- string(REPLACE "@NO_CURL@" "" content "${content}")
- string(REPLACE "@USE_GETTEXT_SCHEME@" "" content "${content}")
- string(REPLACE "# @BROKEN_PATH_FIX@" "" content "${content}")
- string(REPLACE "@PERL_PATH@" "${PERL_PATH}" content "${content}")
- string(REPLACE "@PAGER_ENV@" "LESS=FRX LV=-c" content "${content}")
- file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
+ if ("${script}" IN_LIST git_sh_scripts)
+ string(REPLACE ".sh" "" shell_gen_path "${script}")
+ else()
+ set(shell_gen_path "${script}")
+ endif()
+
+ add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/${shell_gen_path}"
+ COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-script.sh"
+ "${CMAKE_SOURCE_DIR}/${script}.sh"
+ "${CMAKE_BINARY_DIR}/${shell_gen_path}"
+ "${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS"
+ DEPENDS "${CMAKE_SOURCE_DIR}/generate-script.sh"
+ "${CMAKE_SOURCE_DIR}/${script}.sh"
+ VERBATIM)
+ list(APPEND shell_gen ${CMAKE_BINARY_DIR}/${shell_gen_path})
endforeach()
+add_custom_target(shell-gen ALL DEPENDS ${shell_gen})
#perl scripts
parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" "")
@@ -1175,6 +1180,10 @@ string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_optio
string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}")
string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}")
string(REPLACE "@RUNTIME_PREFIX@" "'${RUNTIME_PREFIX}'" git_build_options "${git_build_options}")
+string(REPLACE "@GITWEBDIR@" "'${GITWEBDIR}'" git_build_options "${git_build_options}")
+string(REPLACE "@USE_GETTEXT_SCHEME@" "" git_build_options "${git_build_options}")
+string(REPLACE "@LOCALEDIR@" "'${LOCALEDIR}'" git_build_options "${git_build_options}")
+string(REPLACE "@BROKEN_PATH_FIX@" "" git_build_options "${git_build_options}")
if(USE_VCPKG)
string(APPEND git_build_options "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
endif()
diff --git a/generate-script.sh b/generate-script.sh
new file mode 100755
index 0000000000000000000000000000000000000000..d001e43d7bf1c4d72f41f805128ae42330a54558
--- /dev/null
+++ b/generate-script.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+set -e
+
+if test $# -ne 3
+then
+ echo "USAGE: $0 <INPUT> <OUTPUT> <GIT-BUILD-OPTIONS>" >&2
+ exit 1
+fi
+
+INPUT="$1"
+OUTPUT="$2"
+BUILD_OPTIONS="$3"
+
+. "$BUILD_OPTIONS"
+
+sed -e "1s|#!.*/sh|#!$SHELL_PATH|" \
+ -e "s|@SHELL_PATH@|$SHELL_PATH|" \
+ -e "s|@DIFF@|$DIFF|" \
+ -e "s|@LOCALEDIR@|$LOCALEDIR|g" \
+ -e "s/@USE_GETTEXT_SCHEME@/$USE_GETTEXT_SCHEME/g" \
+ -e "$BROKEN_PATH_FIX" \
+ -e "s|@GITWEBDIR@|$GITWEBDIR|g" \
+ -e "s|@PERL_PATH@|$PERL_PATH|g" \
+ -e "s|@PAGER_ENV@|$PAGER_ENV|g" \
+ "$INPUT" >"$OUTPUT"
+
+case "$(basename "$INPUT")" in
+git-mergetool--lib.sh|git-sh-i18n.sh|git-sh-setup.sh)
+ ;;
+*)
+ chmod a+x "$OUTPUT"
+ ;;
+esac
--
2.47.0.274.g962d0b743d.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v8 11/23] Makefile: extract script to generate gitweb.cgi
2024-11-19 11:50 ` [PATCH v8 00/23] " Patrick Steinhardt
` (9 preceding siblings ...)
2024-11-19 11:50 ` [PATCH v8 10/23] Makefile: extract script to massage Shell scripts Patrick Steinhardt
@ 2024-11-19 11:50 ` Patrick Steinhardt
2024-11-19 11:50 ` [PATCH v8 12/23] Makefile: extract script to generate gitweb.js Patrick Steinhardt
` (12 subsequent siblings)
23 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-19 11:50 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
In order to generate "gitweb.cgi" we have to replace various different
placeholders. This is done ad-hoc and is thus not easily reusable across
different build systems.
Introduce a new GITWEB-BUILD-OPTIONS.in template that we populate at
configuration time with the expected options. This script is then used
as input for a new "generate-gitweb.sh" script that generates the final
"gitweb.cgi" file. While this requires us to repeat the options multiple
times, it is in line to how we generate other build options like our
GIT-BUILD-OPTIONS file.
While at it, refactor how we replace the GITWEB_PROJECT_MAXDEPTH. Even
though this variable is supposed to be an integer, the source file has
the value quoted. The quotes are eventually stripped via sed(1), which
replaces `"@GITWEB_PROJECT_MAXDEPTH@"` with the actual value, which is
rather nonsensical. This is made clearer by just dropping the quotes in
the source file.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
gitweb/GITWEB-BUILD-OPTIONS.in | 24 +++++++++++++++++
gitweb/Makefile | 59 +++++++++++++++++++++---------------------
gitweb/generate-gitweb-cgi.sh | 47 +++++++++++++++++++++++++++++++++
gitweb/gitweb.perl | 2 +-
4 files changed, 101 insertions(+), 31 deletions(-)
diff --git a/gitweb/GITWEB-BUILD-OPTIONS.in b/gitweb/GITWEB-BUILD-OPTIONS.in
new file mode 100644
index 0000000000000000000000000000000000000000..41ac20654c4f79917993bafa8f7e447669552b9d
--- /dev/null
+++ b/gitweb/GITWEB-BUILD-OPTIONS.in
@@ -0,0 +1,24 @@
+PERL_PATH=@PERL_PATH@
+JSMIN=@JSMIN@
+CSSMIN=@CSSMIN@
+GIT_BINDIR=@GIT_BINDIR@
+GITWEB_CONFIG=@GITWEB_CONFIG@
+GITWEB_CONFIG_SYSTEM=@GITWEB_CONFIG_SYSTEM@
+GITWEB_CONFIG_COMMON=@GITWEB_CONFIG_COMMON@
+GITWEB_HOME_LINK_STR=@GITWEB_HOME_LINK_STR@
+GITWEB_SITENAME=@GITWEB_SITENAME@
+GITWEB_PROJECTROOT=@GITWEB_PROJECTROOT@
+GITWEB_PROJECT_MAXDEPTH=@GITWEB_PROJECT_MAXDEPTH@
+GITWEB_EXPORT_OK=@GITWEB_EXPORT_OK@
+GITWEB_STRICT_EXPORT=@GITWEB_STRICT_EXPORT@
+GITWEB_BASE_URL=@GITWEB_BASE_URL@
+GITWEB_LIST=@GITWEB_LIST@
+GITWEB_HOMETEXT=@GITWEB_HOMETEXT@
+GITWEB_CSS=@GITWEB_CSS@
+GITWEB_LOGO=@GITWEB_LOGO@
+GITWEB_FAVICON=@GITWEB_FAVICON@
+GITWEB_JS=@GITWEB_JS@
+GITWEB_SITE_HTML_HEAD_STRING=@GITWEB_SITE_HTML_HEAD_STRING@
+GITWEB_SITE_HEADER=@GITWEB_SITE_HEADER@
+GITWEB_SITE_FOOTER=@GITWEB_SITE_FOOTER@
+HIGHLIGHT_BIN=@HIGHLIGHT_BIN@
diff --git a/gitweb/Makefile b/gitweb/Makefile
index 164c8d53757f98599ad14eeb22ca8d542eb7502a..16a2ef2d1e5664d99f6f1d8ff4224c36769c55fb 100644
--- a/gitweb/Makefile
+++ b/gitweb/Makefile
@@ -77,43 +77,42 @@ GITWEB_JSLIB_FILES += static/js/javascript-detection.js
GITWEB_JSLIB_FILES += static/js/adjust-timezone.js
GITWEB_JSLIB_FILES += static/js/blame_incremental.js
-
-GITWEB_REPLACE = \
- -e 's|@GIT_VERSION@|$(GIT_VERSION)|g' \
- -e 's|@GIT_BINDIR@|$(bindir)|g' \
- -e 's|@GITWEB_CONFIG@|$(GITWEB_CONFIG)|g' \
- -e 's|@GITWEB_CONFIG_SYSTEM@|$(GITWEB_CONFIG_SYSTEM)|g' \
- -e 's|@GITWEB_CONFIG_COMMON@|$(GITWEB_CONFIG_COMMON)|g' \
- -e 's|@GITWEB_HOME_LINK_STR@|$(GITWEB_HOME_LINK_STR)|g' \
- -e 's|@GITWEB_SITENAME@|$(GITWEB_SITENAME)|g' \
- -e 's|@GITWEB_PROJECTROOT@|$(GITWEB_PROJECTROOT)|g' \
- -e 's|"@GITWEB_PROJECT_MAXDEPTH@"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
- -e 's|@GITWEB_EXPORT_OK@|$(GITWEB_EXPORT_OK)|g' \
- -e 's|@GITWEB_STRICT_EXPORT@|$(GITWEB_STRICT_EXPORT)|g' \
- -e 's|@GITWEB_BASE_URL@|$(GITWEB_BASE_URL)|g' \
- -e 's|@GITWEB_LIST@|$(GITWEB_LIST)|g' \
- -e 's|@GITWEB_HOMETEXT@|$(GITWEB_HOMETEXT)|g' \
- -e 's|@GITWEB_CSS@|$(GITWEB_CSS)|g' \
- -e 's|@GITWEB_LOGO@|$(GITWEB_LOGO)|g' \
- -e 's|@GITWEB_FAVICON@|$(GITWEB_FAVICON)|g' \
- -e 's|@GITWEB_JS@|$(GITWEB_JS)|g' \
- -e 's|@GITWEB_SITE_HTML_HEAD_STRING@|$(GITWEB_SITE_HTML_HEAD_STRING)|g' \
- -e 's|@GITWEB_SITE_HEADER@|$(GITWEB_SITE_HEADER)|g' \
- -e 's|@GITWEB_SITE_FOOTER@|$(GITWEB_SITE_FOOTER)|g' \
- -e 's|@HIGHLIGHT_BIN@|$(HIGHLIGHT_BIN)|g'
-
.PHONY: FORCE
$(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS: FORCE
- @rm -f $@+
- @echo "x" '$(PERL_PATH_SQ)' $(GITWEB_REPLACE) "$(JSMIN)|$(CSSMIN)" >$@+
+ @sed -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|' \
+ -e 's|@JSMIN@|$(JSMIN)|' \
+ -e 's|@CSSMIN@|$(CSSMIN)|' \
+ -e 's|@GIT_VERSION@|$(GIT_VERSION)|' \
+ -e 's|@GIT_BINDIR@|$(bindir)|' \
+ -e 's|@GITWEB_CONFIG@|$(GITWEB_CONFIG)|' \
+ -e 's|@GITWEB_CONFIG_SYSTEM@|$(GITWEB_CONFIG_SYSTEM)|' \
+ -e 's|@GITWEB_CONFIG_COMMON@|$(GITWEB_CONFIG_COMMON)|' \
+ -e 's|@GITWEB_HOME_LINK_STR@|$(GITWEB_HOME_LINK_STR)|' \
+ -e 's|@GITWEB_SITENAME@|$(GITWEB_SITENAME)|' \
+ -e 's|@GITWEB_PROJECTROOT@|$(GITWEB_PROJECTROOT)|' \
+ -e 's|@GITWEB_PROJECT_MAXDEPTH@|$(GITWEB_PROJECT_MAXDEPTH)|' \
+ -e 's|@GITWEB_EXPORT_OK@|$(GITWEB_EXPORT_OK)|' \
+ -e 's|@GITWEB_STRICT_EXPORT@|$(GITWEB_STRICT_EXPORT)|' \
+ -e 's|@GITWEB_BASE_URL@|$(GITWEB_BASE_URL)|' \
+ -e 's|@GITWEB_LIST@|$(GITWEB_LIST)|' \
+ -e 's|@GITWEB_HOMETEXT@|$(GITWEB_HOMETEXT)|' \
+ -e 's|@GITWEB_CSS@|$(GITWEB_CSS)|' \
+ -e 's|@GITWEB_LOGO@|$(GITWEB_LOGO)|' \
+ -e 's|@GITWEB_FAVICON@|$(GITWEB_FAVICON)|' \
+ -e 's|@GITWEB_JS@|$(GITWEB_JS)|' \
+ -e 's|@GITWEB_SITE_HTML_HEAD_STRING@|$(GITWEB_SITE_HTML_HEAD_STRING)|' \
+ -e 's|@GITWEB_SITE_HEADER@|$(GITWEB_SITE_HEADER)|' \
+ -e 's|@GITWEB_SITE_FOOTER@|$(GITWEB_SITE_FOOTER)|' \
+ -e 's|@HIGHLIGHT_BIN@|$(HIGHLIGHT_BIN)|' \
+ $(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS.in >"$@+"
@cmp -s $@+ $@ && rm -f $@+ || mv -f $@+ $@
+$(MAK_DIR_GITWEB)gitweb.cgi: $(MAK_DIR_GITWEB)generate-gitweb-cgi.sh
$(MAK_DIR_GITWEB)gitweb.cgi: $(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS
+$(MAK_DIR_GITWEB)gitweb.cgi: GIT-VERSION-FILE
$(MAK_DIR_GITWEB)gitweb.cgi: $(MAK_DIR_GITWEB)gitweb.perl
$(QUIET_GEN)$(RM) $@ $@+ && \
- sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
- $(GITWEB_REPLACE) $< >$@+ && \
- chmod +x $@+ && \
+ $(MAK_DIR_GITWEB)generate-gitweb-cgi.sh $(MAK_DIR_GITWEB)/GITWEB-BUILD-OPTIONS ./GIT-VERSION-FILE $< $@+ && \
mv $@+ $@
$(MAK_DIR_GITWEB)static/gitweb.js: $(addprefix $(MAK_DIR_GITWEB),$(GITWEB_JSLIB_FILES))
diff --git a/gitweb/generate-gitweb-cgi.sh b/gitweb/generate-gitweb-cgi.sh
new file mode 100755
index 0000000000000000000000000000000000000000..67a646aeb7c22fd69817ed14c9937f3123736405
--- /dev/null
+++ b/gitweb/generate-gitweb-cgi.sh
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+set -e
+
+if test $# -ne 4
+then
+ echo "USAGE: $0 <GITWEB-BUILD-OPTIONS> <GIT-VERSION-FILE> <INPUT> <OUTPUT>" >&2
+ exit 1
+fi
+
+GITWEB_BUILD_OPTIONS="$1"
+GIT_VERSION_FILE="$2"
+INPUT="$3"
+OUTPUT="$4"
+
+. "$GITWEB_BUILD_OPTIONS"
+. "$GIT_VERSION_FILE"
+
+sed -e "1s|#!/usr/bin/perl|#!$PERL_PATH|" \
+ -e "s|@PERL_PATH@|$PERL_PATH|" \
+ -e "s|@JSMIN@|$JSMIN|" \
+ -e "s|@CSSMIN@|$CSSMIN|" \
+ -e "s|@GIT_VERSION@|$GIT_VERSION|" \
+ -e "s|@GIT_BINDIR@|$GIT_BINDIR|" \
+ -e "s|@GITWEB_CONFIG@|$GITWEB_CONFIG|" \
+ -e "s|@GITWEB_CONFIG_SYSTEM@|$GITWEB_CONFIG_SYSTEM|" \
+ -e "s|@GITWEB_CONFIG_COMMON@|$GITWEB_CONFIG_COMMON|" \
+ -e "s|@GITWEB_HOME_LINK_STR@|$GITWEB_HOME_LINK_STR|" \
+ -e "s|@GITWEB_SITENAME@|$GITWEB_SITENAME|" \
+ -e "s|@GITWEB_PROJECTROOT@|$GITWEB_PROJECTROOT|" \
+ -e "s|@GITWEB_PROJECT_MAXDEPTH@|$GITWEB_PROJECT_MAXDEPTH|" \
+ -e "s|@GITWEB_EXPORT_OK@|$GITWEB_EXPORT_OK|" \
+ -e "s|@GITWEB_STRICT_EXPORT@|$GITWEB_STRICT_EXPORT|" \
+ -e "s|@GITWEB_BASE_URL@|$GITWEB_BASE_URL|" \
+ -e "s|@GITWEB_LIST@|$GITWEB_LIST|" \
+ -e "s|@GITWEB_HOMETEXT@|$GITWEB_HOMETEXT|" \
+ -e "s|@GITWEB_CSS@|$GITWEB_CSS|" \
+ -e "s|@GITWEB_LOGO@|$GITWEB_LOGO|" \
+ -e "s|@GITWEB_FAVICON@|$GITWEB_FAVICON|" \
+ -e "s|@GITWEB_JS@|$GITWEB_JS|" \
+ -e "s|@GITWEB_SITE_HTML_HEAD_STRING@|$GITWEB_SITE_HTML_HEAD_STRING|" \
+ -e "s|@GITWEB_SITE_HEADER@|$GITWEB_SITE_HEADER|" \
+ -e "s|@GITWEB_SITE_FOOTER@|$GITWEB_SITE_FOOTER|" \
+ -e "s|@HIGHLIGHT_BIN@|$HIGHLIGHT_BIN|" \
+ "$INPUT" >"$OUTPUT"
+
+chmod a+x "$OUTPUT"
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 76e1f4e244fd23dd29b935e83753efa9c6d5bb5e..41bc64ec73f9f05666480025c3b70650607b4cd8 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -88,7 +88,7 @@ sub evaluate_uri {
# fs traversing limit for getting project list
# the number is relative to the projectroot
-our $project_maxdepth = "@GITWEB_PROJECT_MAXDEPTH@";
+our $project_maxdepth = @GITWEB_PROJECT_MAXDEPTH@;
# string of the home link on top of all pages
our $home_link_str = "@GITWEB_HOME_LINK_STR@";
--
2.47.0.274.g962d0b743d.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v8 12/23] Makefile: extract script to generate gitweb.js
2024-11-19 11:50 ` [PATCH v8 00/23] " Patrick Steinhardt
` (10 preceding siblings ...)
2024-11-19 11:50 ` [PATCH v8 11/23] Makefile: extract script to generate gitweb.cgi Patrick Steinhardt
@ 2024-11-19 11:50 ` Patrick Steinhardt
2024-11-19 11:50 ` [PATCH v8 13/23] Makefile: refactor generators to be PWD-independent Patrick Steinhardt
` (11 subsequent siblings)
23 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-19 11:50 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
Similar to the preceding commit, also extract the script to generate the
"gitweb.js" file. While the logic itself is trivial, it helps us avoid
duplication of logic across build systems and ensures that the build
systems will remain in sync with each other in case the logic ever needs
to change.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
gitweb/Makefile | 3 ++-
gitweb/generate-gitweb-js.sh | 12 ++++++++++++
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/gitweb/Makefile b/gitweb/Makefile
index 16a2ef2d1e5664d99f6f1d8ff4224c36769c55fb..d5748e93594eb6181269c2fe272bf7ef980cbe68 100644
--- a/gitweb/Makefile
+++ b/gitweb/Makefile
@@ -115,9 +115,10 @@ $(MAK_DIR_GITWEB)gitweb.cgi: $(MAK_DIR_GITWEB)gitweb.perl
$(MAK_DIR_GITWEB)generate-gitweb-cgi.sh $(MAK_DIR_GITWEB)/GITWEB-BUILD-OPTIONS ./GIT-VERSION-FILE $< $@+ && \
mv $@+ $@
+$(MAK_DIR_GITWEB)static/gitweb.js: $(MAK_DIR_GITWEB)generate-gitweb-js.sh
$(MAK_DIR_GITWEB)static/gitweb.js: $(addprefix $(MAK_DIR_GITWEB),$(GITWEB_JSLIB_FILES))
$(QUIET_GEN)$(RM) $@ $@+ && \
- cat $^ >$@+ && \
+ $(MAK_DIR_GITWEB)generate-gitweb-js.sh $@+ $^ && \
mv $@+ $@
### Installation rules
diff --git a/gitweb/generate-gitweb-js.sh b/gitweb/generate-gitweb-js.sh
new file mode 100755
index 0000000000000000000000000000000000000000..bb81220da393ebecae28b675c299b626f0e698fb
--- /dev/null
+++ b/gitweb/generate-gitweb-js.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+if test "$#" -lt 2
+then
+ echo "USAGE: $0 <OUTPUT> <INPUT>..." >&2
+ exit 1
+fi
+
+OUTPUT="$1"
+shift
+
+cat "$@" >"$OUTPUT"
--
2.47.0.274.g962d0b743d.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v8 13/23] Makefile: refactor generators to be PWD-independent
2024-11-19 11:50 ` [PATCH v8 00/23] " Patrick Steinhardt
` (11 preceding siblings ...)
2024-11-19 11:50 ` [PATCH v8 12/23] Makefile: extract script to generate gitweb.js Patrick Steinhardt
@ 2024-11-19 11:50 ` Patrick Steinhardt
2024-11-19 11:50 ` [PATCH v8 14/23] Makefile: allow "bin-wrappers/" directory to exist Patrick Steinhardt
` (10 subsequent siblings)
23 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-19 11:50 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
We have multiple scripts that generate headers from other data. All of
these scripts have the assumption built-in that they are executed in the
current source directory, which makes them a bit unwieldy to use during
out-of-tree builds.
Refactor them to instead take the source directory as well as the output
file as arguments.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 6 +++---
contrib/buildsystems/CMakeLists.txt | 19 +++++++++--------
generate-cmdlist.sh | 42 +++++++++++++++++++++++--------------
generate-configlist.sh | 20 +++++++++++++-----
generate-hooklist.sh | 15 ++++++++++++-
5 files changed, 68 insertions(+), 34 deletions(-)
diff --git a/Makefile b/Makefile
index 0d40dbdffa06311c2727f9ed47a730b772a7e684..0417adbbbb5be9e8b3f45a468faa059a40f2ddea 100644
--- a/Makefile
+++ b/Makefile
@@ -2523,17 +2523,17 @@ $(BUILT_INS): git$X
config-list.h: generate-configlist.sh
config-list.h: Documentation/*config.txt Documentation/config/*.txt
- $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh >$@
+ $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh . $@
command-list.h: generate-cmdlist.sh command-list.txt
command-list.h: $(wildcard Documentation/git*.txt)
$(QUIET_GEN)$(SHELL_PATH) ./generate-cmdlist.sh \
$(patsubst %,--exclude-program %,$(EXCLUDED_PROGRAMS)) \
- command-list.txt >$@
+ . $@
hook-list.h: generate-hooklist.sh Documentation/githooks.txt
- $(QUIET_GEN)$(SHELL_PATH) ./generate-hooklist.sh >$@
+ $(QUIET_GEN)$(SHELL_PATH) ./generate-hooklist.sh . $@
SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):\
$(localedir_SQ):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 7121fdfbc2ba50b4c7afb3f2b45fdaa5b9909a60..be1ce1f37a775c366098717047cd7579cd81015d 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -638,23 +638,24 @@ set(EXCLUSION_PROGS_CACHE ${EXCLUSION_PROGS} CACHE STRING "Programs not built" F
if(NOT EXISTS ${CMAKE_BINARY_DIR}/command-list.h OR NOT EXCLUSION_PROGS_CACHE STREQUAL EXCLUSION_PROGS)
list(REMOVE_ITEM EXCLUSION_PROGS empty)
message("Generating command-list.h")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-cmdlist.sh ${EXCLUSION_PROGS} command-list.txt
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_FILE ${CMAKE_BINARY_DIR}/command-list.h)
+ execute_process(COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-cmdlist.sh"
+ ${EXCLUSION_PROGS}
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_BINARY_DIR}/command-list.h")
endif()
if(NOT EXISTS ${CMAKE_BINARY_DIR}/config-list.h)
message("Generating config-list.h")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-configlist.sh
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_FILE ${CMAKE_BINARY_DIR}/config-list.h)
+ execute_process(COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-configlist.sh"
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_BINARY_DIR}/config-list.h")
endif()
if(NOT EXISTS ${CMAKE_BINARY_DIR}/hook-list.h)
message("Generating hook-list.h")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-hooklist.sh
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_FILE ${CMAKE_BINARY_DIR}/hook-list.h)
+ execute_process(COMMAND "${SH_EXE}" ${CMAKE_SOURCE_DIR}/generate-hooklist.sh
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_BINARY_DIR}/hook-list.h")
endif()
include_directories(${CMAKE_BINARY_DIR})
diff --git a/generate-cmdlist.sh b/generate-cmdlist.sh
index 205541e0f7f81b1df4061215ae34a2742a45475d..b923a5aab80dfa571a40a4f6fa3d860fcf8f8dd1 100755
--- a/generate-cmdlist.sh
+++ b/generate-cmdlist.sh
@@ -64,7 +64,7 @@ define_category_names () {
print_command_list () {
echo "static struct cmdname_help command_list[] = {"
- echo "$1" |
+ echo "$2" |
while read cmd rest
do
synopsis=
@@ -76,7 +76,7 @@ print_command_list () {
break
;;
esac
- done <"Documentation/$cmd.txt"
+ done <"$1/Documentation/$cmd.txt"
printf '\t{ "%s", N_("%s"), 0' "$cmd" "$synopsis"
printf " | CAT_%s" $rest
@@ -93,18 +93,28 @@ do
shift
done
-commands="$(command_list "$1")"
-categories="$(category_list "$commands")"
+if test "$#" -ne 2
+then
+ die "USAGE: $0 <SOURCE_DIR> <OUTPUT>"
+fi
+
+SOURCE_DIR="$1"
+OUTPUT="$2"
+
+{
+ commands="$(command_list "$SOURCE_DIR"/command-list.txt)"
+ categories="$(category_list "$commands")"
-echo "/* Automatically generated by generate-cmdlist.sh */
-struct cmdname_help {
- const char *name;
- const char *help;
- uint32_t category;
-};
-"
-define_categories "$categories"
-echo
-define_category_names "$categories"
-echo
-print_command_list "$commands"
+ echo "/* Automatically generated by generate-cmdlist.sh */
+ struct cmdname_help {
+ const char *name;
+ const char *help;
+ uint32_t category;
+ };
+ "
+ define_categories "$categories"
+ echo
+ define_category_names "$categories"
+ echo
+ print_command_list "$SOURCE_DIR" "$commands"
+} >"$OUTPUT"
diff --git a/generate-configlist.sh b/generate-configlist.sh
index 8692fe5cf4d5e4025265e6110254b05640615fea..512804a1ca1b63a0630ae152569b31486273eae0 100755
--- a/generate-configlist.sh
+++ b/generate-configlist.sh
@@ -1,13 +1,19 @@
#!/bin/sh
-echo "/* Automatically generated by generate-configlist.sh */"
-echo
+SOURCE_DIR="$1"
+OUTPUT="$2"
+
+if test -z "$SOURCE_DIR" || ! test -d "$SOURCE_DIR" || test -z "$OUTPUT"
+then
+ echo "USAGE: $0 <SOURCE_DIR> <OUTPUT>" >&2
+ exit 1
+fi
print_config_list () {
cat <<EOF
static const char *config_name_list[] = {
EOF
- grep -h '^[a-zA-Z].*\..*::$' Documentation/*config.txt Documentation/config/*.txt |
+ grep -h '^[a-zA-Z].*\..*::$' "$SOURCE_DIR"/Documentation/*config.txt "$SOURCE_DIR"/Documentation/config/*.txt |
sed '/deprecated/d; s/::$//; s/, */\n/g' |
sort |
sed 's/^.*$/ "&",/'
@@ -17,5 +23,9 @@ EOF
EOF
}
-echo
-print_config_list
+{
+ echo "/* Automatically generated by generate-configlist.sh */"
+ echo
+ echo
+ print_config_list
+} >"$OUTPUT"
diff --git a/generate-hooklist.sh b/generate-hooklist.sh
index 2f9f54eb545be2bd79c37a868dbeef96d2ddfb9f..0ff2a0b6fbd16772de1f88cad36af8185892bb47 100755
--- a/generate-hooklist.sh
+++ b/generate-hooklist.sh
@@ -2,6 +2,17 @@
#
# Usage: ./generate-hooklist.sh >hook-list.h
+SOURCE_DIR="$1"
+OUTPUT="$2"
+
+if test -z "$SOURCE_DIR" || ! test -d "$SOURCE_DIR" || test -z "$OUTPUT"
+then
+ echo "USAGE: $0 <SOURCE_DIR> <OUTPUT>" >&2
+ exit 1
+fi
+
+{
+
cat <<EOF
/* Automatically generated by generate-hooklist.sh */
@@ -11,10 +22,12 @@ EOF
sed -n \
-e '/^~~~~*$/ {x; s/^.*$/ "&",/; p;}' \
-e 'x' \
- <Documentation/githooks.txt |
+ <"$SOURCE_DIR"/Documentation/githooks.txt |
LC_ALL=C sort
cat <<EOF
NULL,
};
EOF
+
+} >"$OUTPUT"
--
2.47.0.274.g962d0b743d.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v8 14/23] Makefile: allow "bin-wrappers/" directory to exist
2024-11-19 11:50 ` [PATCH v8 00/23] " Patrick Steinhardt
` (12 preceding siblings ...)
2024-11-19 11:50 ` [PATCH v8 13/23] Makefile: refactor generators to be PWD-independent Patrick Steinhardt
@ 2024-11-19 11:50 ` Patrick Steinhardt
2024-11-19 11:50 ` [PATCH v8 15/23] Makefile: simplify building of templates Patrick Steinhardt
` (9 subsequent siblings)
23 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-19 11:50 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
The "bin-wrappers/" directory gets created by our build system and is
populated with one script for each of our binaries. There isn't anything
inherently wrong with the current layout, but it is somewhat hard to
adapt for out-of-tree build systems.
Adapt the layout such that our "bin-wrappers/" directory always exists
and contains our "wrap-for-bin.sh" script to make things a little bit
easier for subsequent steps.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
.gitignore | 1 -
Documentation/CodingGuidelines | 2 +-
Makefile | 6 +++---
bin-wrappers/.gitignore | 9 +++++++++
wrap-for-bin.sh => bin-wrappers/wrap-for-bin.sh | 0
contrib/buildsystems/CMakeLists.txt | 6 +++---
6 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/.gitignore b/.gitignore
index d3be460040c6120d862a25dff1abd325b93b37fd..e82aa19df03fc865eaa0468f12b734cec0c48a2c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,7 +12,6 @@
/GIT-TEST-SUITES
/GIT-USER-AGENT
/GIT-VERSION-FILE
-/bin-wrappers/
/git
/git-add
/git-am
diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
index 87904791cbcea6e57d0fb3c7d4e27f2b0d80b95f..1df9d0c42f1ee7b16ecd7abc22d2653dbf9bae2e 100644
--- a/Documentation/CodingGuidelines
+++ b/Documentation/CodingGuidelines
@@ -583,7 +583,7 @@ For C programs:
Run `GIT_DEBUGGER=1 ./bin-wrappers/git foo` to simply use gdb as is, or
run `GIT_DEBUGGER="<debugger> <debugger-args>" ./bin-wrappers/git foo` to
use your own debugger and arguments. Example: `GIT_DEBUGGER="ddd --gdb"
- ./bin-wrappers/git log` (See `wrap-for-bin.sh`.)
+ ./bin-wrappers/git log` (See `bin-wrappers/wrap-for-bin.sh`.)
- The primary data structure that a subsystem 'S' deals with is called
`struct S`. Functions that operate on `struct S` are named
diff --git a/Makefile b/Makefile
index 0417adbbbb5be9e8b3f45a468faa059a40f2ddea..d0ec819e449575f43552a75761a9cb2e85c6ea65 100644
--- a/Makefile
+++ b/Makefile
@@ -3206,8 +3206,7 @@ test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $(
all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PROG)
-bin-wrappers/%: wrap-for-bin.sh
- $(call mkdir_p_parent_template)
+$(test_bindir_programs): bin-wrappers/%: bin-wrappers/wrap-for-bin.sh
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@BUILD_DIR@|$(shell pwd)|' \
-e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
@@ -3703,7 +3702,8 @@ clean: profile-clean coverage-clean cocciclean
$(RM) $(FUZZ_PROGRAMS)
$(RM) $(SP_OBJ)
$(RM) $(HCC)
- $(RM) -r bin-wrappers $(dep_dirs) $(compdb_dir) compile_commands.json
+ $(RM) -r $(dep_dirs) $(compdb_dir) compile_commands.json
+ $(RM) $(test_bindir_programs)
$(RM) -r po/build/
$(RM) *.pyc *.pyo */*.pyc */*.pyo $(GENERATED_H) $(ETAGS_TARGET) tags cscope*
$(RM) -r .dist-tmp-dir .doc-tmp-dir
diff --git a/bin-wrappers/.gitignore b/bin-wrappers/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..1c6c90458b758641d0311e812563b32dd4656b48
--- /dev/null
+++ b/bin-wrappers/.gitignore
@@ -0,0 +1,9 @@
+/git
+/git-cvsserver
+/git-receive-pack
+/git-shell
+/git-upload-archive
+/git-upload-pack
+/scalar
+/test-fake-ssh
+/test-tool
diff --git a/wrap-for-bin.sh b/bin-wrappers/wrap-for-bin.sh
old mode 100644
new mode 100755
similarity index 100%
rename from wrap-for-bin.sh
rename to bin-wrappers/wrap-for-bin.sh
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index be1ce1f37a775c366098717047cd7579cd81015d..6fc4f051400db00761232d0aaf1bc88634022b5b 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -1080,20 +1080,20 @@ set(wrapper_test_scripts
foreach(script ${wrapper_scripts})
- file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
+ file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
string(REPLACE "@PROG@" "${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
foreach(script ${wrapper_test_scripts})
- file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
+ file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
string(REPLACE "@PROG@" "t/helper/${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
-file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
+file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
string(REPLACE "@PROG@" "git-cvsserver" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})
--
2.47.0.274.g962d0b743d.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v8 15/23] Makefile: simplify building of templates
2024-11-19 11:50 ` [PATCH v8 00/23] " Patrick Steinhardt
` (13 preceding siblings ...)
2024-11-19 11:50 ` [PATCH v8 14/23] Makefile: allow "bin-wrappers/" directory to exist Patrick Steinhardt
@ 2024-11-19 11:50 ` Patrick Steinhardt
2024-11-19 11:50 ` [PATCH v8 16/23] Documentation: allow sourcing generated includes from separate dir Patrick Steinhardt
` (8 subsequent siblings)
23 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-19 11:50 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
When we install Git we also install a set of default templates that both
git-init(1) and git-clone(1) populate into our build directories. The
way the pristine templates are laid out in our source directory is
somewhat weird though: instead of reconstructing the actual directory
hierarchy in "templates/", we represent directory separators with "--".
The only reason I could come up with for why we have this is the
"branches/" directory, which is supposed to be empty when installing it.
And as Git famously doesn't store empty directories at all we have to
work around this limitation.
Now the thing is that the "branches/" directory is a leftover to how
branches used to be stored in the dark ages. gitrepository-layout(5)
lists this directory as "slightly deprecated", which I would claim is a
strong understatement. I have never encountered anybody using it today
and would be surprised if it even works as expected. So having the "--"
hack in place for an item that is basically unused, unmaintained and
deprecated doesn't only feel unreasonable, but installing that entry by
default may also cause confusion for users that do not know what this is
supposed to be in the first place.
Remove this directory from our templates and, now that we do not require
the workaround anymore, restructure the templates to form a proper
hierarchy. This makes it way easier for build systems to install these
templates into place.
We should likely think about removing support for "branch/" altogether,
but that is outside of the scope of this patch series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
contrib/buildsystems/CMakeLists.txt | 34 +++++++------------
templates/Makefile | 39 ++++++++++++++--------
templates/branches-- | 1 -
templates/{this--description => description} | 0
.../applypatch-msg.sample} | 0
.../commit-msg.sample} | 0
.../fsmonitor-watchman.sample} | 0
.../post-update.sample} | 0
.../pre-applypatch.sample} | 0
.../pre-commit.sample} | 0
.../pre-merge-commit.sample} | 0
.../pre-push.sample} | 0
.../pre-rebase.sample} | 0
.../pre-receive.sample} | 0
.../prepare-commit-msg.sample} | 0
.../push-to-checkout.sample} | 0
.../sendemail-validate.sample} | 0
.../{hooks--update.sample => hooks/update.sample} | 0
templates/{info--exclude => info/exclude} | 0
19 files changed, 37 insertions(+), 37 deletions(-)
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 6fc4f051400db00761232d0aaf1bc88634022b5b..852b841601642402fb47489fba07445435e27930 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -99,8 +99,8 @@ project(git
#TODO Enable NLS on windows natively
#macros for parsing the Makefile for sources and scripts
-macro(parse_makefile_for_sources list_var regex)
- file(STRINGS ${CMAKE_SOURCE_DIR}/Makefile ${list_var} REGEX "^${regex} \\+=(.*)")
+macro(parse_makefile_for_sources list_var makefile regex)
+ file(STRINGS ${makefile} ${list_var} REGEX "^${regex} \\+=(.*)")
string(REPLACE "${regex} +=" "" ${list_var} ${${list_var}})
string(REPLACE "$(COMPAT_OBJS)" "" ${list_var} ${${list_var}}) #remove "$(COMPAT_OBJS)" This is only for libgit.
string(STRIP ${${list_var}} ${list_var}) #remove trailing/leading whitespaces
@@ -662,7 +662,7 @@ include_directories(${CMAKE_BINARY_DIR})
#build
#libgit
-parse_makefile_for_sources(libgit_SOURCES "LIB_OBJS")
+parse_makefile_for_sources(libgit_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "LIB_OBJS")
list(TRANSFORM libgit_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
list(TRANSFORM compat_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
@@ -680,13 +680,13 @@ list(APPEND libgit_SOURCES "${CMAKE_BINARY_DIR}/version-def.h")
add_library(libgit ${libgit_SOURCES} ${compat_SOURCES})
#libxdiff
-parse_makefile_for_sources(libxdiff_SOURCES "XDIFF_OBJS")
+parse_makefile_for_sources(libxdiff_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "XDIFF_OBJS")
list(TRANSFORM libxdiff_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
add_library(xdiff STATIC ${libxdiff_SOURCES})
#reftable
-parse_makefile_for_sources(reftable_SOURCES "REFTABLE_OBJS")
+parse_makefile_for_sources(reftable_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "REFTABLE_OBJS")
list(TRANSFORM reftable_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
add_library(reftable STATIC ${reftable_SOURCES})
@@ -757,7 +757,7 @@ elseif(UNIX)
endif()
#git
-parse_makefile_for_sources(git_SOURCES "BUILTIN_OBJS")
+parse_makefile_for_sources(git_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "BUILTIN_OBJS")
list(TRANSFORM git_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
add_executable(git ${CMAKE_SOURCE_DIR}/git.c ${git_SOURCES})
@@ -905,24 +905,14 @@ file(STRINGS ${CMAKE_SOURCE_DIR}/git-p4.py content NEWLINE_CONSUME)
string(REPLACE "#!/usr/bin/env python" "#!/usr/bin/python" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/git-p4 ${content})
-#templates
-file(GLOB templates "${CMAKE_SOURCE_DIR}/templates/*")
-list(TRANSFORM templates REPLACE "${CMAKE_SOURCE_DIR}/templates/" "")
-list(REMOVE_ITEM templates ".gitignore")
-list(REMOVE_ITEM templates "Makefile")
-list(REMOVE_ITEM templates "blt")# Prevents an error when reconfiguring for in source builds
-
-list(REMOVE_ITEM templates "branches--")
-file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/templates/blt/branches) #create branches
-
+#${CMAKE_SOURCE_DIR}/Makefile templates
+parse_makefile_for_sources(templates ${CMAKE_SOURCE_DIR}/templates/Makefile "TEMPLATES")
+string(REPLACE " " ";" templates ${templates})
#templates have @.*@ replacement so use configure_file instead
foreach(tm ${templates})
- string(REPLACE "--" "/" blt_tm ${tm})
- string(REPLACE "this" "" blt_tm ${blt_tm})# for this--
- configure_file(${CMAKE_SOURCE_DIR}/templates/${tm} ${CMAKE_BINARY_DIR}/templates/blt/${blt_tm} @ONLY)
+ configure_file(${CMAKE_SOURCE_DIR}/templates/${tm} ${CMAKE_BINARY_DIR}/templates/blt/${tm} @ONLY)
endforeach()
-
#translations
if(MSGFMT_EXE)
file(GLOB po_files "${CMAKE_SOURCE_DIR}/po/*.po")
@@ -996,7 +986,7 @@ add_executable(test-fake-ssh ${CMAKE_SOURCE_DIR}/t/helper/test-fake-ssh.c)
target_link_libraries(test-fake-ssh common-main)
#unit-tests
-parse_makefile_for_sources(unit-test_SOURCES "UNIT_TEST_OBJS")
+parse_makefile_for_sources(unit-test_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "UNIT_TEST_OBJS")
list(TRANSFORM unit-test_SOURCES REPLACE "\\$\\(UNIT_TEST_DIR\\)/" "${CMAKE_SOURCE_DIR}/t/unit-tests/")
add_library(unit-test-lib STATIC ${unit-test_SOURCES})
@@ -1054,7 +1044,7 @@ if(MSVC)
endif()
#test-tool
-parse_makefile_for_sources(test-tool_SOURCES "TEST_BUILTINS_OBJS")
+parse_makefile_for_sources(test-tool_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "TEST_BUILTINS_OBJS")
add_library(test-lib OBJECT ${CMAKE_SOURCE_DIR}/t/unit-tests/test-lib.c)
list(TRANSFORM test-tool_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/t/helper/")
diff --git a/templates/Makefile b/templates/Makefile
index 367ad00c24cb34c0668eb5236dc3b08a477a65b7..bd1e9e30c120032b209fb1d221b9d93eea31c649 100644
--- a/templates/Makefile
+++ b/templates/Makefile
@@ -29,24 +29,35 @@ all: boilerplates.made custom
# in a file direc--tory--file in the source. They will be
# just copied to the destination.
-bpsrc = $(filter-out %~,$(wildcard *--*))
-boilerplates.made : $(bpsrc)
- $(QUIET)umask 022 && ls *--* 2>/dev/null | \
- while read boilerplate; \
+TEMPLATES =
+TEMPLATES += description
+TEMPLATES += hooks/applypatch-msg.sample
+TEMPLATES += hooks/commit-msg.sample
+TEMPLATES += hooks/fsmonitor-watchman.sample
+TEMPLATES += hooks/post-update.sample
+TEMPLATES += hooks/pre-applypatch.sample
+TEMPLATES += hooks/pre-commit.sample
+TEMPLATES += hooks/pre-merge-commit.sample
+TEMPLATES += hooks/prepare-commit-msg.sample
+TEMPLATES += hooks/pre-push.sample
+TEMPLATES += hooks/pre-rebase.sample
+TEMPLATES += hooks/pre-receive.sample
+TEMPLATES += hooks/push-to-checkout.sample
+TEMPLATES += hooks/sendemail-validate.sample
+TEMPLATES += hooks/update.sample
+TEMPLATES += info/exclude
+
+boilerplates.made: $(TEMPLATES)
+ $(QUIET)umask 022 && for template in $(TEMPLATES); \
do \
- case "$$boilerplate" in *~) continue ;; esac && \
- dst=`echo "$$boilerplate" | sed -e 's|^this|.|;s|--|/|g'` && \
- dir=`expr "$$dst" : '\(.*\)/'` && \
+ dir=$$(dirname "$$template") && \
mkdir -p blt/$$dir && \
- case "$$boilerplate" in \
- *--) continue;; \
- esac && \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
- -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' $$boilerplate > \
- blt/$$dst && \
- if test -x "$$boilerplate"; then rx=rx; else rx=r; fi && \
- chmod a+$$rx "blt/$$dst" || exit; \
+ -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' $$template > \
+ blt/$$template && \
+ if test -x "$$template"; then rx=rx; else rx=r; fi && \
+ chmod a+$$rx "blt/$$template" || exit; \
done && \
date >$@
diff --git a/templates/branches-- b/templates/branches--
deleted file mode 100644
index fae88709a636f3a06cc813dd64b28bfee7fa2073..0000000000000000000000000000000000000000
--- a/templates/branches--
+++ /dev/null
@@ -1 +0,0 @@
-: this is just to ensure the directory exists.
diff --git a/templates/this--description b/templates/description
similarity index 100%
rename from templates/this--description
rename to templates/description
diff --git a/templates/hooks--applypatch-msg.sample b/templates/hooks/applypatch-msg.sample
similarity index 100%
rename from templates/hooks--applypatch-msg.sample
rename to templates/hooks/applypatch-msg.sample
diff --git a/templates/hooks--commit-msg.sample b/templates/hooks/commit-msg.sample
similarity index 100%
rename from templates/hooks--commit-msg.sample
rename to templates/hooks/commit-msg.sample
diff --git a/templates/hooks--fsmonitor-watchman.sample b/templates/hooks/fsmonitor-watchman.sample
similarity index 100%
rename from templates/hooks--fsmonitor-watchman.sample
rename to templates/hooks/fsmonitor-watchman.sample
diff --git a/templates/hooks--post-update.sample b/templates/hooks/post-update.sample
similarity index 100%
rename from templates/hooks--post-update.sample
rename to templates/hooks/post-update.sample
diff --git a/templates/hooks--pre-applypatch.sample b/templates/hooks/pre-applypatch.sample
similarity index 100%
rename from templates/hooks--pre-applypatch.sample
rename to templates/hooks/pre-applypatch.sample
diff --git a/templates/hooks--pre-commit.sample b/templates/hooks/pre-commit.sample
similarity index 100%
rename from templates/hooks--pre-commit.sample
rename to templates/hooks/pre-commit.sample
diff --git a/templates/hooks--pre-merge-commit.sample b/templates/hooks/pre-merge-commit.sample
similarity index 100%
rename from templates/hooks--pre-merge-commit.sample
rename to templates/hooks/pre-merge-commit.sample
diff --git a/templates/hooks--pre-push.sample b/templates/hooks/pre-push.sample
similarity index 100%
rename from templates/hooks--pre-push.sample
rename to templates/hooks/pre-push.sample
diff --git a/templates/hooks--pre-rebase.sample b/templates/hooks/pre-rebase.sample
similarity index 100%
rename from templates/hooks--pre-rebase.sample
rename to templates/hooks/pre-rebase.sample
diff --git a/templates/hooks--pre-receive.sample b/templates/hooks/pre-receive.sample
similarity index 100%
rename from templates/hooks--pre-receive.sample
rename to templates/hooks/pre-receive.sample
diff --git a/templates/hooks--prepare-commit-msg.sample b/templates/hooks/prepare-commit-msg.sample
similarity index 100%
rename from templates/hooks--prepare-commit-msg.sample
rename to templates/hooks/prepare-commit-msg.sample
diff --git a/templates/hooks--push-to-checkout.sample b/templates/hooks/push-to-checkout.sample
similarity index 100%
rename from templates/hooks--push-to-checkout.sample
rename to templates/hooks/push-to-checkout.sample
diff --git a/templates/hooks--sendemail-validate.sample b/templates/hooks/sendemail-validate.sample
similarity index 100%
rename from templates/hooks--sendemail-validate.sample
rename to templates/hooks/sendemail-validate.sample
diff --git a/templates/hooks--update.sample b/templates/hooks/update.sample
similarity index 100%
rename from templates/hooks--update.sample
rename to templates/hooks/update.sample
diff --git a/templates/info--exclude b/templates/info/exclude
similarity index 100%
rename from templates/info--exclude
rename to templates/info/exclude
--
2.47.0.274.g962d0b743d.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v8 16/23] Documentation: allow sourcing generated includes from separate dir
2024-11-19 11:50 ` [PATCH v8 00/23] " Patrick Steinhardt
` (14 preceding siblings ...)
2024-11-19 11:50 ` [PATCH v8 15/23] Makefile: simplify building of templates Patrick Steinhardt
@ 2024-11-19 11:50 ` Patrick Steinhardt
2024-11-19 11:50 ` [PATCH v8 17/23] Documentation: teach "cmd-list.perl" about out-of-tree builds Patrick Steinhardt
` (7 subsequent siblings)
23 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-19 11:50 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
Our documentation uses "include::" directives to include parts that are
either reused across multiple documents or parts that we generate at
build time. Unfortunately, top-level includes are only ever resolved
relative to the base directory, which is typically the directory of the
including document. Most importantly, it is not possible to have either
asciidoc or asciidoctor search multiple directories.
It follows that both kinds of includes must live in the same directory.
This is of course a bummer for out-of-tree builds, because here the
dynamically-built includes live in the build directory whereas the
static includes live in the source directory.
Introduce a `build_dir` attribute and prepend it to all of our includes
for dynamically-built files. This attribute gets set to the build
directory and thus converts the include path to an absolute path, which
asciidoc and asciidoctor know how to resolve.
Note that this change also requires us to update "build-docdep.perl",
which tries to figure out included files such our Makefile can set up
proper build-time dependencies. This script simply scans through the
source files for any lines that match "^include::" and treats the
remainder of the line as included file path. But given that those may
now contain the "{build_dir}" variable we have to teach the script to
replace that attribute with the actual build directory.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Documentation/Makefile | 3 ++-
Documentation/build-docdep.perl | 2 ++
Documentation/config/diff.txt | 2 +-
Documentation/config/merge.txt | 2 +-
Documentation/git.txt | 24 ++++++++++++------------
5 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/Documentation/Makefile b/Documentation/Makefile
index aac489d3b01e9ca08f24a7f604d4b8dae50860d6..d26d9b155dc511494da4124ee22630d02f5d528c 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -224,6 +224,7 @@ SHELL_PATH ?= $(SHELL)
# Shell quote;
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
+ASCIIDOC_EXTRA += -abuild_dir='$(shell pwd)'
ifdef DEFAULT_PAGER
DEFAULT_PAGER_SQ = $(subst ','\'',$(DEFAULT_PAGER))
ASCIIDOC_EXTRA += -a 'git-default-pager=$(DEFAULT_PAGER_SQ)'
@@ -289,7 +290,7 @@ docdep_prereqs = \
cmd-list.made $(cmds_txt)
doc.dep : $(docdep_prereqs) $(DOC_DEP_TXT) build-docdep.perl
- $(QUIET_GEN)$(PERL_PATH) ./build-docdep.perl >$@ $(QUIET_STDERR)
+ $(QUIET_GEN)$(PERL_PATH) ./build-docdep.perl "$(shell pwd)" >$@ $(QUIET_STDERR)
ifneq ($(MAKECMDGOALS),clean)
-include doc.dep
diff --git a/Documentation/build-docdep.perl b/Documentation/build-docdep.perl
index 1b3ac8fdd95fa1d57afbdffb1a9743f36ed22fdd..315efaa2fa2f2efc89b2c8073cc97cd2cc83611c 100755
--- a/Documentation/build-docdep.perl
+++ b/Documentation/build-docdep.perl
@@ -1,5 +1,6 @@
#!/usr/bin/perl
+my ($build_dir) = @ARGV;
my %include = ();
my %included = ();
@@ -10,6 +11,7 @@
chomp;
s/^include::\s*//;
s/\[\]//;
+ s/{build_dir}/${build_dir}/;
$include{$text}{$_} = 1;
$included{$_} = 1;
}
diff --git a/Documentation/config/diff.txt b/Documentation/config/diff.txt
index 190bda17e51c57a00b25bf98afa038b8a89e4ea5..9575af91fa53d3f67925d31e77b81222e737fc3a 100644
--- a/Documentation/config/diff.txt
+++ b/Documentation/config/diff.txt
@@ -206,7 +206,7 @@ diff.<driver>.cachetextconv::
Set this option to true to make the diff driver cache the text
conversion outputs. See linkgit:gitattributes[5] for details.
-include::../mergetools-diff.txt[]
+include::{build_dir}/mergetools-diff.txt[]
diff.indentHeuristic::
Set this option to `false` to disable the default heuristics
diff --git a/Documentation/config/merge.txt b/Documentation/config/merge.txt
index 8851b6cedef980c106b9e86541862b517aa1f2ad..82554d65a0aa0826fdb53c5d834389d38f308e3e 100644
--- a/Documentation/config/merge.txt
+++ b/Documentation/config/merge.txt
@@ -101,7 +101,7 @@ merge.guitool::
Any other value is treated as a custom merge tool and requires that a
corresponding mergetool.<guitool>.cmd variable is defined.
-include::../mergetools-merge.txt[]
+include::{build_dir}/mergetools-merge.txt[]
merge.verbosity::
Controls the amount of output shown by the recursive merge
diff --git a/Documentation/git.txt b/Documentation/git.txt
index d15a8697625d6b6c598a2bc774bf243675ab68ea..44f0797ccffb1a7359bee9c20182953293b70d6d 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -245,17 +245,17 @@ ancillary user utilities.
Main porcelain commands
~~~~~~~~~~~~~~~~~~~~~~~
-include::cmds-mainporcelain.txt[]
+include::{build_dir}/cmds-mainporcelain.txt[]
Ancillary Commands
~~~~~~~~~~~~~~~~~~
Manipulators:
-include::cmds-ancillarymanipulators.txt[]
+include::{build_dir}/cmds-ancillarymanipulators.txt[]
Interrogators:
-include::cmds-ancillaryinterrogators.txt[]
+include::{build_dir}/cmds-ancillaryinterrogators.txt[]
Interacting with Others
@@ -264,7 +264,7 @@ Interacting with Others
These commands are to interact with foreign SCM and with other
people via patch over e-mail.
-include::cmds-foreignscminterface.txt[]
+include::{build_dir}/cmds-foreignscminterface.txt[]
Reset, restore and revert
~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -313,13 +313,13 @@ repositories.
Manipulation commands
~~~~~~~~~~~~~~~~~~~~~
-include::cmds-plumbingmanipulators.txt[]
+include::{build_dir}/cmds-plumbingmanipulators.txt[]
Interrogation commands
~~~~~~~~~~~~~~~~~~~~~~
-include::cmds-plumbinginterrogators.txt[]
+include::{build_dir}/cmds-plumbinginterrogators.txt[]
In general, the interrogate commands do not touch the files in
the working tree.
@@ -328,12 +328,12 @@ the working tree.
Syncing repositories
~~~~~~~~~~~~~~~~~~~~
-include::cmds-synchingrepositories.txt[]
+include::{build_dir}/cmds-synchingrepositories.txt[]
The following are helper commands used by the above; end users
typically do not use them directly.
-include::cmds-synchelpers.txt[]
+include::{build_dir}/cmds-synchelpers.txt[]
Internal helper commands
@@ -342,14 +342,14 @@ Internal helper commands
These are internal helper commands used by other commands; end
users typically do not use them directly.
-include::cmds-purehelpers.txt[]
+include::{build_dir}/cmds-purehelpers.txt[]
Guides
------
The following documentation pages are guides about Git concepts.
-include::cmds-guide.txt[]
+include::{build_dir}/cmds-guide.txt[]
Repository, command and file interfaces
---------------------------------------
@@ -358,7 +358,7 @@ This documentation discusses repository and command interfaces which
users are expected to interact with directly. See `--user-formats` in
linkgit:git-help[1] for more details on the criteria.
-include::cmds-userinterfaces.txt[]
+include::{build_dir}/cmds-userinterfaces.txt[]
File formats, protocols and other developer interfaces
------------------------------------------------------
@@ -367,7 +367,7 @@ This documentation discusses file formats, over-the-wire protocols and
other git developer interfaces. See `--developer-interfaces` in
linkgit:git-help[1].
-include::cmds-developerinterfaces.txt[]
+include::{build_dir}/cmds-developerinterfaces.txt[]
Configuration Mechanism
-----------------------
--
2.47.0.274.g962d0b743d.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v8 17/23] Documentation: teach "cmd-list.perl" about out-of-tree builds
2024-11-19 11:50 ` [PATCH v8 00/23] " Patrick Steinhardt
` (15 preceding siblings ...)
2024-11-19 11:50 ` [PATCH v8 16/23] Documentation: allow sourcing generated includes from separate dir Patrick Steinhardt
@ 2024-11-19 11:50 ` Patrick Steinhardt
2024-11-19 11:50 ` [PATCH v8 18/23] Documentation: extract script to generate a list of mergetools Patrick Steinhardt
` (6 subsequent siblings)
23 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-19 11:50 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
The "cmd-list.perl" script generates a list of commands that can be
included into our manpages. The script doesn't know about out-of-tree
builds and instead writes resulting files into the source directory.
Adapt it such that we can read data from the source directory and write
data into the build directory.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Documentation/Makefile | 2 +-
Documentation/cmd-list.perl | 23 ++++++++++++-----------
2 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/Documentation/Makefile b/Documentation/Makefile
index d26d9b155dc511494da4124ee22630d02f5d528c..ca59581df65ca478910321fc937f98b23d597bd2 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -312,7 +312,7 @@ cmds_txt = cmds-ancillaryinterrogators.txt \
$(cmds_txt): cmd-list.made
cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
- $(QUIET_GEN)$(PERL_PATH) ./cmd-list.perl ../command-list.txt $(cmds_txt) $(QUIET_STDERR) && \
+ $(QUIET_GEN)$(PERL_PATH) ./cmd-list.perl .. . $(cmds_txt) && \
date >$@
mergetools_txt = mergetools-diff.txt mergetools-merge.txt
diff --git a/Documentation/cmd-list.perl b/Documentation/cmd-list.perl
index 755a110bc48d7e2b596651ca13664c01192d966c..e260a989774071b66d2b56c56c5045b84a508c5c 100755
--- a/Documentation/cmd-list.perl
+++ b/Documentation/cmd-list.perl
@@ -3,12 +3,13 @@
use File::Compare qw(compare);
sub format_one {
- my ($out, $nameattr) = @_;
+ my ($source_dir, $out, $nameattr) = @_;
my ($name, $attr) = @$nameattr;
+ my ($path) = "$source_dir/Documentation/$name.txt";
my ($state, $description);
my $mansection;
$state = 0;
- open I, '<', "$name.txt" or die "No such file $name.txt";
+ open I, '<', "$path" or die "No such file $path.txt";
while (<I>) {
if (/^(?:git|scalar)[a-z0-9-]*\(([0-9])\)$/) {
$mansection = $1;
@@ -29,7 +30,7 @@ sub format_one {
}
close I;
if (!defined $description) {
- die "No description found in $name.txt";
+ die "No description found in $path.txt";
}
if (my ($verify_name, $text) = ($description =~ /^($name) - (.*)/)) {
print $out "linkgit:$name\[$mansection\]::\n\t";
@@ -43,9 +44,9 @@ sub format_one {
}
}
-my ($input, @categories) = @ARGV;
+my ($source_dir, $build_dir, @categories) = @ARGV;
-open IN, "<$input";
+open IN, "<$source_dir/command-list.txt";
while (<IN>) {
last if /^### command list/;
}
@@ -63,17 +64,17 @@ sub format_one {
for my $out (@categories) {
my ($cat) = $out =~ /^cmds-(.*)\.txt$/;
- open O, '>', "$out+" or die "Cannot open output file $out+";
+ my ($path) = "$build_dir/$out";
+ open O, '>', "$path+" or die "Cannot open output file $out+";
for (@{$cmds{$cat}}) {
- format_one(\*O, $_);
+ format_one($source_dir, \*O, $_);
}
close O;
- if (-f "$out" && compare("$out", "$out+") == 0) {
- unlink "$out+";
+ if (-f "$path" && compare("$path", "$path+") == 0) {
+ unlink "$path+";
}
else {
- print STDERR "$out\n";
- rename "$out+", "$out";
+ rename "$path+", "$path";
}
}
--
2.47.0.274.g962d0b743d.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v8 18/23] Documentation: extract script to generate a list of mergetools
2024-11-19 11:50 ` [PATCH v8 00/23] " Patrick Steinhardt
` (16 preceding siblings ...)
2024-11-19 11:50 ` [PATCH v8 17/23] Documentation: teach "cmd-list.perl" about out-of-tree builds Patrick Steinhardt
@ 2024-11-19 11:50 ` Patrick Steinhardt
2024-11-19 11:50 ` [PATCH v8 19/23] t: better support for out-of-tree builds Patrick Steinhardt
` (5 subsequent siblings)
23 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-19 11:50 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
We include the list of available mergetools into our manpages. Extract
the script that performs this logic such that we can reuse it in other
build systems.
While at it, refactor the Makefile targets such that we don't create
"mergetools-list.made" anymore. It shouldn't be necessary, as we can
instead have other targets depend on "mergetools-{diff,merge}.txt"
directly.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Documentation/Makefile | 22 ++++++++--------------
Documentation/generate-mergetool-list.sh | 17 +++++++++++++++++
2 files changed, 25 insertions(+), 14 deletions(-)
diff --git a/Documentation/Makefile b/Documentation/Makefile
index ca59581df65ca478910321fc937f98b23d597bd2..7e3a6e1b32fbbb0a0308bbda125c0abbcdb121fc 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -282,11 +282,13 @@ ifneq ($(filter-out lint-docs clean,$(MAKECMDGOALS)),)
-include ../GIT-VERSION-FILE
endif
+mergetools_txt = mergetools-diff.txt mergetools-merge.txt
+
#
# Determine "include::" file references in asciidoc files.
#
docdep_prereqs = \
- mergetools-list.made $(mergetools_txt) \
+ $(mergetools_txt) \
cmd-list.made $(cmds_txt)
doc.dep : $(docdep_prereqs) $(DOC_DEP_TXT) build-docdep.perl
@@ -315,19 +317,11 @@ cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
$(QUIET_GEN)$(PERL_PATH) ./cmd-list.perl .. . $(cmds_txt) && \
date >$@
-mergetools_txt = mergetools-diff.txt mergetools-merge.txt
-
-$(mergetools_txt): mergetools-list.made
-
-mergetools-list.made: ../git-mergetool--lib.sh $(wildcard ../mergetools/*)
- $(QUIET_GEN) \
- $(SHELL_PATH) -c 'MERGE_TOOLS_DIR=../mergetools && TOOL_MODE=diff && \
- . ../git-mergetool--lib.sh && \
- show_tool_names can_diff' | sed -e "s/\([a-z0-9]*\)/\`\1\`;;/" >mergetools-diff.txt && \
- $(SHELL_PATH) -c 'MERGE_TOOLS_DIR=../mergetools && TOOL_MODE=merge && \
- . ../git-mergetool--lib.sh && \
- show_tool_names can_merge' | sed -e "s/\([a-z0-9]*\)/\`\1\`;;/" >mergetools-merge.txt && \
- date >$@
+mergetools-%.txt: generate-mergetool-list.sh ../git-mergetool--lib.sh $(wildcard ../mergetools/*)
+mergetools-diff.txt:
+ $(QUIET_GEN)$(SHELL_PATH) ./generate-mergetool-list.sh .. diff $@
+mergetools-merge.txt:
+ $(QUIET_GEN)$(SHELL_PATH) ./generate-mergetool-list.sh .. merge $@
TRACK_ASCIIDOCFLAGS = $(subst ','\'',$(ASCIIDOC_COMMON):$(ASCIIDOC_HTML):$(ASCIIDOC_DOCBOOK))
diff --git a/Documentation/generate-mergetool-list.sh b/Documentation/generate-mergetool-list.sh
new file mode 100755
index 0000000000000000000000000000000000000000..696196fbcb86084abffc1d29355705a37b1532b3
--- /dev/null
+++ b/Documentation/generate-mergetool-list.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+if test "$#" -ne 3
+then
+ echo "USAGE: $0 <SOURCE_DIR> <MODE> <OUTPUT>" >&2
+ exit 1
+fi
+
+SOURCE_DIR="$1"
+TOOL_MODE="$2"
+OUTPUT="$3"
+MERGE_TOOLS_DIR="$SOURCE_DIR/mergetools"
+
+(
+ . "$SOURCE_DIR"/git-mergetool--lib.sh &&
+ show_tool_names can_$TOOL_MODE
+) | sed -e "s/\([a-z0-9]*\)/\`\1\`;;/" >"$OUTPUT"
--
2.47.0.274.g962d0b743d.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v8 19/23] t: better support for out-of-tree builds
2024-11-19 11:50 ` [PATCH v8 00/23] " Patrick Steinhardt
` (17 preceding siblings ...)
2024-11-19 11:50 ` [PATCH v8 18/23] Documentation: extract script to generate a list of mergetools Patrick Steinhardt
@ 2024-11-19 11:50 ` Patrick Steinhardt
2024-11-19 11:50 ` [PATCH v8 20/23] t: allow overriding build dir Patrick Steinhardt
` (4 subsequent siblings)
23 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-19 11:50 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
Our in-tree builds used by the Makefile use various different build
directories scattered around different locations. The paths to those
build directories have to be propagated to our tests such that they can
find the contained files. This is done via a mixture of hardcoded paths
in our test library and injected variables in our bin-wrappers or
"GIT-BUILD-OPTIONS".
The latter two mechanisms are preferable over using hardcoded paths. For
one, we have all paths which are subject to change stored in a small set
of central files instead of having the knowledge of build paths in many
files. And second, it allows build systems which build files elsewhere
to adapt those paths based on their own needs. This is especially nice
in the context of build systems that use out-of-tree builds like CMake
or Meson.
Remove hardcoded knowledge of build paths from our test library and move
it into our bin-wrappers and "GIT-BUILD-OPTIONS".
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-BUILD-OPTIONS.in | 5 +++++
Makefile | 9 +++++++++
bin-wrappers/wrap-for-bin.sh | 11 ++++++-----
contrib/buildsystems/CMakeLists.txt | 8 ++++++++
t/lib-gettext.sh | 4 ++--
t/t7609-mergetool--lib.sh | 2 +-
t/test-lib.sh | 6 +++---
7 files changed, 34 insertions(+), 11 deletions(-)
diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in
index 9b95a6b3eee334b6f691702696ca9d92201b6bac..f651116102ae2977622dccd12b199fe7ad65af99 100644
--- a/GIT-BUILD-OPTIONS.in
+++ b/GIT-BUILD-OPTIONS.in
@@ -35,6 +35,11 @@ GIT_PERF_MAKE_COMMAND=@GIT_PERF_MAKE_COMMAND@
GIT_INTEROP_MAKE_OPTS=@GIT_INTEROP_MAKE_OPTS@
GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@
GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@
+GIT_TEST_TEXTDOMAINDIR=@GIT_TEST_TEXTDOMAINDIR@
+GIT_TEST_POPATH=@GIT_TEST_POPATH@
+GIT_TEST_TEMPLATE_DIR=@GIT_TEST_TEMPLATE_DIR@
+GIT_TEST_GITPERLLIB=@GIT_TEST_GITPERLLIB@
+GIT_TEST_MERGE_TOOLS_DIR=@GIT_TEST_MERGE_TOOLS_DIR@
RUNTIME_PREFIX=@RUNTIME_PREFIX@
GITWEBDIR=@GITWEBDIR@
USE_GETTEXT_SCHEME=@USE_GETTEXT_SCHEME@
diff --git a/Makefile b/Makefile
index d0ec819e449575f43552a75761a9cb2e85c6ea65..8f0b8da0671675ec2dfa1318cfb981fd543f8326 100644
--- a/Makefile
+++ b/Makefile
@@ -3180,6 +3180,11 @@ GIT-BUILD-OPTIONS: FORCE
-e "s|@GIT_INTEROP_MAKE_OPTS@|\'$(GIT_INTEROP_MAKE_OPTS)\'|" \
-e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \
-e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \
+ -e "s|@GIT_TEST_TEXTDOMAINDIR@|\'$(shell pwd)/po/build/locale\'|" \
+ -e "s|@GIT_TEST_POPATH@|\'$(shell pwd)/po\'|" \
+ -e "s|@GIT_TEST_TEMPLATE_DIR@|\'$(shell pwd)/templates/blt\'|" \
+ -e "s|@GIT_TEST_GITPERLLIB@|\'$(shell pwd)/perl/build/lib\'|" \
+ -e "s|@GIT_TEST_MERGE_TOOLS_DIR@|\'$(shell pwd)/mergetools\'|" \
-e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX_OPTION)\'|" \
-e "s|@GITWEBDIR@|\'$(gitwebdir_SQ)\'|" \
-e "s|@USE_GETTEXT_SCHEME@|\'$(USE_GETTEXT_SCHEME)\'|" \
@@ -3209,6 +3214,10 @@ all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PR
$(test_bindir_programs): bin-wrappers/%: bin-wrappers/wrap-for-bin.sh
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@BUILD_DIR@|$(shell pwd)|' \
+ -e 's|@GIT_TEXTDOMAINDIR@|$(shell pwd)/po/build/locale|' \
+ -e 's|@GITPERLLIB@|$(shell pwd)/perl/build/lib|' \
+ -e 's|@MERGE_TOOLS_DIR@|$(shell pwd)/mergetools|' \
+ -e 's|@TEMPLATE_DIR@|$(shell pwd)/templates/blt|' \
-e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
chmod +x $@
diff --git a/bin-wrappers/wrap-for-bin.sh b/bin-wrappers/wrap-for-bin.sh
index 7898a1c238dde20617cf96d144930dc59f67feab..1d3a59a0081e1fc6066af187093cb1d11d01a929 100755
--- a/bin-wrappers/wrap-for-bin.sh
+++ b/bin-wrappers/wrap-for-bin.sh
@@ -4,21 +4,22 @@
# to run test suite against sandbox, but with only bindir-installed
# executables in PATH. The Makefile copies this into various
# files in bin-wrappers, substituting
-# @BUILD_DIR@ and @PROG@.
+# @BUILD_DIR@, @TEMPLATE_DIR@ and @PROG@.
GIT_EXEC_PATH='@BUILD_DIR@'
if test -n "$NO_SET_GIT_TEMPLATE_DIR"
then
unset GIT_TEMPLATE_DIR
else
- GIT_TEMPLATE_DIR='@BUILD_DIR@/templates/blt'
+ GIT_TEMPLATE_DIR='@TEMPLATE_DIR@'
export GIT_TEMPLATE_DIR
fi
-GITPERLLIB='@BUILD_DIR@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}"
-GIT_TEXTDOMAINDIR='@BUILD_DIR@/po/build/locale'
+MERGE_TOOLS_DIR='@MERGE_TOOLS_DIR@'
+GITPERLLIB='@GITPERLLIB@'"${GITPERLLIB:+:$GITPERLLIB}"
+GIT_TEXTDOMAINDIR='@GIT_TEXTDOMAINDIR@'
PATH='@BUILD_DIR@/bin-wrappers:'"$PATH"
-export GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
+export MERGE_TOOLS_DIR GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
case "$GIT_DEBUGGER" in
'')
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 852b841601642402fb47489fba07445435e27930..25d8452cc29ecf2ee21172bc8a31f57801908ba7 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -1085,6 +1085,9 @@ endforeach()
file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+string(REPLACE "@GIT_TEXTDOMAINDIR@" "${CMAKE_BINARY_DIR}/po/build/locale" content "${content}")
+string(REPLACE "@GITPERLLIB@" "${CMAKE_BINARY_DIR}/perl/build/lib" content "${content}")
+string(REPLACE "@MERGE_TOOLS_DIR@" "${CMAKE_SOURCE_DIR}/mergetools" content "${content}")
string(REPLACE "@PROG@" "git-cvsserver" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})
@@ -1170,6 +1173,11 @@ string(REPLACE "@GIT_PERF_MAKE_COMMAND@" "" git_build_options "${git_build_optio
string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_options}")
string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}")
string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_TEXTDOMAINDIR@" "'${CMAKE_BINARY_DIR}/po/build/locale'" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_POPATH@" "'${CMAKE_BINARY_DIR}/po'" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_TEMPLATE_DIR@" "'${CMAKE_BINARY_DIR}/templates/blt'" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_GITPERLLIB@" "'${CMAKE_BINARY_DIR}/perl/build/lib'" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_MERGE_TOOLS_DIR@" "'${RUNTIME_PREFIX}'" git_build_options "${git_build_options}")
string(REPLACE "@RUNTIME_PREFIX@" "'${RUNTIME_PREFIX}'" git_build_options "${git_build_options}")
string(REPLACE "@GITWEBDIR@" "'${GITWEBDIR}'" git_build_options "${git_build_options}")
string(REPLACE "@USE_GETTEXT_SCHEME@" "" git_build_options "${git_build_options}")
diff --git a/t/lib-gettext.sh b/t/lib-gettext.sh
index cc6bb2cdeaae7b5bb23211c0d9c37c9deb39e14f..7a734c6973e65995d3403a26cc9e5c1a5a1ce074 100644
--- a/t/lib-gettext.sh
+++ b/t/lib-gettext.sh
@@ -6,8 +6,8 @@
. ./test-lib.sh
-GIT_TEXTDOMAINDIR="$GIT_BUILD_DIR/po/build/locale"
-GIT_PO_PATH="$GIT_BUILD_DIR/po"
+GIT_TEXTDOMAINDIR="$GIT_TEST_TEXTDOMAINDIR"
+GIT_PO_PATH="$GIT_TEST_POPATH"
export GIT_TEXTDOMAINDIR GIT_PO_PATH
if test -n "$GIT_TEST_INSTALLED"
diff --git a/t/t7609-mergetool--lib.sh b/t/t7609-mergetool--lib.sh
index 8b1c3bd39f2249417099ea2f24218268925909af..a9273ba58d76333c74d0072794ed0d95b966f16f 100755
--- a/t/t7609-mergetool--lib.sh
+++ b/t/t7609-mergetool--lib.sh
@@ -8,7 +8,7 @@ TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'mergetool --tool=vimdiff creates the expected layout' '
- . "$GIT_BUILD_DIR"/mergetools/vimdiff &&
+ . "$GIT_TEST_MERGE_TOOLS_DIR"/vimdiff &&
run_unit_tests
'
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 19057faa73925f619750fec30f05c3e5a1ba05ac..ceb926c4258db853eeb50b2259a7f521501cf719 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1487,7 +1487,7 @@ else # normal case, use ../bin-wrappers only unless $with_dashes:
PATH="$GIT_BUILD_DIR:$GIT_BUILD_DIR/t/helper:$PATH"
fi
fi
-GIT_TEMPLATE_DIR="$GIT_BUILD_DIR"/templates/blt
+GIT_TEMPLATE_DIR="$GIT_TEST_TEMPLATE_DIR"
GIT_CONFIG_NOSYSTEM=1
GIT_ATTR_NOSYSTEM=1
GIT_CEILING_DIRECTORIES="$TRASH_DIRECTORY/.."
@@ -1503,9 +1503,9 @@ then
fi
fi
-GITPERLLIB="$GIT_BUILD_DIR"/perl/build/lib
+GITPERLLIB="$GIT_TEST_GITPERLLIB"
export GITPERLLIB
-test -d "$GIT_BUILD_DIR"/templates/blt || {
+test -d "$GIT_TEMPLATE_DIR" || {
BAIL_OUT "You haven't built things yet, have you?"
}
--
2.47.0.274.g962d0b743d.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v8 20/23] t: allow overriding build dir
2024-11-19 11:50 ` [PATCH v8 00/23] " Patrick Steinhardt
` (18 preceding siblings ...)
2024-11-19 11:50 ` [PATCH v8 19/23] t: better support for out-of-tree builds Patrick Steinhardt
@ 2024-11-19 11:50 ` Patrick Steinhardt
2024-11-19 11:50 ` [PATCH v8 21/23] Documentation: add comparison of build systems Patrick Steinhardt
` (3 subsequent siblings)
23 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-19 11:50 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
Our "test-lib.sh" assumes that our build directory is the parent
directory of "t/". While true when using our Makefile, it's not when
using build systems that support out-of-tree builds.
In commit ee9e66e4e7 (cmake: avoid editing t/test-lib.sh, 2022-10-18),
we have introduce support for overriding the GIT_BUILD_DIR by creating
the file "$GIT_BUILD_DIR/GIT-BUILD-DIR" with its contents pointing to
the location of the build directory. The intent was to stop modifying
"t/test-lib.sh" with the CMake build systems while allowing out-of-tree
builds. But "$GIT_BUILD_DIR" is somewhat misleadingly named, as it in
fact points to the _source_ directory. So while that commit solved part
of the problem for out-of-tree builds, CMake still has to write files
into the source tree.
Solve the second part of the problem, namely not having to write any
data into the source directory at all, by also supporting an environment
variable that allows us to point to a different build directory. This
allows us to perform properly self-contained out-of-tree builds.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
t/test-lib.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index ceb926c4258db853eeb50b2259a7f521501cf719..cce0069287af48a607bc24fa474006a47014ea49 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -35,7 +35,7 @@ else
# needing to exist.
TEST_DIRECTORY=$(cd "$TEST_DIRECTORY" && pwd) || exit 1
fi
-GIT_BUILD_DIR="${TEST_DIRECTORY%/t}"
+GIT_BUILD_DIR="${GIT_BUILD_DIR:-${TEST_DIRECTORY%/t}}"
if test "$TEST_DIRECTORY" = "$GIT_BUILD_DIR"
then
echo "PANIC: Running in a $TEST_DIRECTORY that doesn't end in '/t'?" >&2
@@ -522,6 +522,7 @@ unset VISUAL EMAIL LANGUAGE $("$PERL_PATH" -e '
PERF_
CURL_VERBOSE
TRACE_CURL
+ BUILD_DIR
));
my @vars = grep(/^GIT_/ && !/^GIT_($ok)/o, @env);
print join("\n", @vars);
--
2.47.0.274.g962d0b743d.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v8 21/23] Documentation: add comparison of build systems
2024-11-19 11:50 ` [PATCH v8 00/23] " Patrick Steinhardt
` (19 preceding siblings ...)
2024-11-19 11:50 ` [PATCH v8 20/23] t: allow overriding build dir Patrick Steinhardt
@ 2024-11-19 11:50 ` Patrick Steinhardt
2024-11-19 11:50 ` [PATCH v8 22/23] Introduce support for the Meson build system Patrick Steinhardt
` (2 subsequent siblings)
23 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-19 11:50 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
We're contemplating whether to eventually replace our build systems with
a build system that is easier to use. Add a comparison of build systems
to our technical documentation as a baseline for discussion.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Documentation/Makefile | 1 +
Documentation/technical/build-systems.txt | 224 ++++++++++++++++++++++++++++++
2 files changed, 225 insertions(+)
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 7e3a6e1b32fbbb0a0308bbda125c0abbcdb121fc..5ebc300ed3815b67ea3cb3a5104a36537572c09d 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -113,6 +113,7 @@ TECH_DOCS += MyFirstObjectWalk
TECH_DOCS += SubmittingPatches
TECH_DOCS += ToolsForGit
TECH_DOCS += technical/bitmap-format
+TECH_DOCS += technical/build-systems
TECH_DOCS += technical/bundle-uri
TECH_DOCS += technical/hash-function-transition
TECH_DOCS += technical/long-running-process-protocol
diff --git a/Documentation/technical/build-systems.txt b/Documentation/technical/build-systems.txt
new file mode 100644
index 0000000000000000000000000000000000000000..d9dafb407c40902756ca0bde9d9dad8ced8788dd
--- /dev/null
+++ b/Documentation/technical/build-systems.txt
@@ -0,0 +1,224 @@
+= Build Systems
+
+The build system is the primary way for both developers and system integrators
+to interact with the Git project. As such, being easy to use and extend for
+those who are not directly developing Git itself is just as important as other
+requirements we have on any potential build system.
+
+This document outlines the different requirements that we have for the build
+system and then compares available build systems using these criteria.
+
+== Requirements
+
+The following subsections present a list of requirements that we have for any
+potential build system. Sections are sorted by decreasing priority.
+
+=== Platform support
+
+The build system must have support for all of our platforms that we continually
+test against as outlined by our platform support policy. These platforms are:
+
+ - Linux
+ - Windows
+ - macOS
+
+Furthermore, the build system should have support for the following platforms
+that generally have somebody running test pipelines against regularly:
+
+ - AIX
+ - FreeBSD
+ - NetBSD
+ - NonStop
+ - OpenBSD
+
+The platforms which must be supported by the tool should be aligned with our
+[platform support policy](platform-support.txt).
+
+=== Auto-detection of supported features
+
+The build system must support auto-detection of features which are or aren't
+available on the current platform. Platform maintainers should not be required
+to manually configure the complete build.
+
+Auto-detection of the following items is considered to be important:
+
+ - Check for the existence of headers.
+ - Check for the existence of libraries.
+ - Check for the existence of exectuables.
+ - Check for the runtime behavior of specific functions.
+ - Check for specific link order requirements when multiple libraries are
+ involved.
+
+=== Ease of use
+
+The build system should be both easy to use and easy to extend. While this is
+naturally a subjective metric it is likely not controversial to say that some
+build systems are considerably harder to use than others.
+
+=== IDE support
+
+The build system should integrate with well-known IDEs. Well-known IDEs include:
+
+ - Microsoft Visual Studio
+ - Visual Studio Code
+ - Xcode
+
+There are four levels of support:
+
+ - Native integration into the IDE.
+ - Integration into the IDE via a plugin.
+ - Integration into the IDE via generating a project description with the build
+ system.
+ - No integration.
+
+Native integration is preferable, but integration via either a plugin or by
+generating a project description via the build system are considered feasible
+alternatives.
+
+Another important distinction is the level of integration. There are two
+features that one generally wants to have:
+
+ - Integration of build targets.
+ - Automatic setup of features like code completion with detected build
+ dependencies.
+
+The first bullet point is the bare minimum, but is not sufficient to be
+considered proper integration.
+
+=== Out-of-tree builds
+
+The build system should support out-of-tree builds. Out-of-tree builds allow a
+developer to configure multiple different build directories with different
+configuration, e.g. one "debug" build and one "release" build.
+
+=== Cross-platform builds
+
+The build system should support cross-platform builds, e.g. building for arm on
+an x86-64 host.
+
+=== Language support
+
+The following languages and toolchains are of relevance and should be supported
+by the build system:
+
+ - C: the primary compiled language used by Git, must be supported. Relevant
+ toolchains are GCC, Clang and MSVC.
+ - Rust: candidate as a second compiled lanugage, should be supported. Relevant
+ toolchains is the LLVM-based rustc.
+
+Built-in support for the respective languages is preferred over support that
+needs to be wired up manually to avoid unnecessary complexity. Native support
+includes the following features:
+
+ - Compiling objects.
+ - Dependency tracking.
+ - Detection of available features.
+ - Discovery of relevant toolchains.
+ - Linking libraries and executables.
+ - Templating placeholders in scripts.
+
+=== Test integration
+
+It should be possible to integrate tests into the build system such that it is
+possible to build and test Git within the build system. Features which are nice
+to have:
+
+ - Track build-time dependencies for respective tests. Unit tests have
+ different requirements than integration tests.
+ - Allow filtering of which tests to run.
+ - Allow running tests such that utilities like `test_pause` or `debug` work.
+
+== Comparison
+
+The following list of build systems are considered:
+
+- GNU Make
+- autoconf
+- CMake
+- Meson
+
+=== GNU Make
+
+- Platform support: ubitquitous on all platforms, but not well-integrated into Windows.
+- Auto-detection: no built-in support for auto-detection of features.
+- Ease of use: easy to use, but discovering available options is hard. Makefile
+ rules can quickly get out of hand once reaching a certain scope.
+- IDE support: execution of Makefile targets is supported by many IDEs
+- Out-of-tree builds: supported in theory, not wired up in practice.
+- Cross-platform builds: supported in theory, not wired up in practice.
+- Language support:
+ - C: Limited built-in support, many parts need to be wired up manually.
+ - Rust: No built-in support, needs to be wired up manually.
+- Test integration: partially supported, many parts need to be wired up
+ manually.
+
+=== autoconf
+
+- Platform support: ubiquitous on all platforms, but not well-integrated into Windows.
+- Auto-detection: supported.
+- Ease of use: easy to use, discovering available options is comparatively
+ easy. The autoconf syntax is prohibitively hard to extend though due to its
+ complex set of interacting files and the hard-to-understand M4 language.
+- IDE support: no integration into IDEs at generation time. The generated
+ Makefiles have the same level of support as GNU Make.
+- Out-of-tree builds: supported in theory, not wired up in practice.
+- Cross-platform builds: supported.
+- Language support:
+ - C: Limited built-in support, many parts need to be wired up manually.
+ - Rust: No built-in support, needs to be wired up manually.
+- Test integration: partially supported, many parts need to be wired up
+ manually.
+
+=== CMake
+
+- Platform support: not as extensive as GNU Make or autoconf, but all major
+ platforms are supported.
+ - AIX
+ - Cygwin
+ - FreeBSD
+ - Linux
+ - OpenBSD
+ - Solaris
+ - Windows
+ - macOS
+- Ease of use: easy to use, discovering available options is not always
+ trivial. The scripting language used by CMake is somewhat cumbersome to use,
+ but extending CMake build instructions is doable.
+- IDE support: natively integrated into Microsoft Visual Studio. Can generate
+ project descriptions for Xcode. An extension is available for Visual Studio
+ Code. Many other IDEs have plugins for CMake.
+- Out-of-tree builds: supported.
+- Cross-platform builds: supported.
+- Language support:
+ - C: Supported for GCC, Clang, MSVC and other toolchains.
+ - Rust: No built-in support, needs to be wired up manually.
+- Test integration: supported, even though test dependencies are a bit
+ cumbersome to use via "test fixtures". Interactive test runs are not
+ supported.
+
+=== Meson
+
+- Platform: not as extensive as GNU Make or autoconf, but all major platforms
+ and some smaller ones are supported.
+ - AIX
+ - Cygwin
+ - DragonflyBSD
+ - FreeBSD
+ - Haiku
+ - Linux
+ - NetBSD
+ - OpenBSD
+ - Solaris
+ - Windows
+ - macOS
+- Ease of use: easy to use, discovering available options is easy. The
+ scripting language is straight-forward to use.
+- IDE support: Supports generating build instructions for Xcode and Microsoft
+ Visual Studio, a plugin exists for Visual Studio Code.
+- Out-of-tree builds: supported.
+- Cross-platform builds: supported.
+- Language support:
+ - C: Supported for GCC, Clang, MSVC and other toolchains.
+ - Rust: Supported for rustc.
+- Test integration: supported. Interactive tests are supported starting with
+ Meson 1.5.0 via the `--interactive` flag.
--
2.47.0.274.g962d0b743d.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v8 22/23] Introduce support for the Meson build system
2024-11-19 11:50 ` [PATCH v8 00/23] " Patrick Steinhardt
` (20 preceding siblings ...)
2024-11-19 11:50 ` [PATCH v8 21/23] Documentation: add comparison of build systems Patrick Steinhardt
@ 2024-11-19 11:50 ` Patrick Steinhardt
2024-11-19 11:51 ` [PATCH v8 23/23] meson: fix conflicts with in-flight topics Patrick Steinhardt
2024-11-20 5:15 ` [PATCH v8 00/23] Modernize the build system Junio C Hamano
23 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-19 11:50 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
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>
---
Documentation/meson.build | 324 +++++++
bin-wrappers/meson.build | 28 +
contrib/completion/meson.build | 8 +
contrib/meson.build | 1 +
gitweb/meson.build | 79 ++
meson.build | 1889 ++++++++++++++++++++++++++++++++++++
meson_options.txt | 81 ++
perl/FromCPAN/Mail/meson.build | 7 +
perl/FromCPAN/meson.build | 9 +
perl/Git/LoadCPAN/Mail/meson.build | 7 +
perl/Git/LoadCPAN/meson.build | 9 +
perl/Git/SVN/Memoize/meson.build | 7 +
perl/Git/SVN/meson.build | 20 +
perl/Git/meson.build | 18 +
perl/meson.build | 12 +
po/meson.build | 27 +
subprojects/.gitignore | 1 +
subprojects/curl.wrap | 13 +
subprojects/expat.wrap | 13 +
subprojects/openssl.wrap | 15 +
subprojects/pcre2.wrap | 16 +
subprojects/zlib.wrap | 13 +
t/helper/meson.build | 91 ++
t/meson.build | 1106 +++++++++++++++++++++
templates/hooks/meson.build | 26 +
templates/info/meson.build | 7 +
templates/meson.build | 15 +
27 files changed, 3842 insertions(+)
diff --git a/Documentation/meson.build b/Documentation/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..f2426ccaa30c29bd60b850eb0a9a4ab77c66a629
--- /dev/null
+++ b/Documentation/meson.build
@@ -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
diff --git a/bin-wrappers/meson.build b/bin-wrappers/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..6d03a19d7b8e3cf78ac0499b6cedf47e0c6cb441
--- /dev/null
+++ b/bin-wrappers/meson.build
@@ -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', fs.relative_to(executable.full_path(), meson.project_build_root()))
+
+ configure_file(
+ input: 'wrap-for-bin.sh',
+ output: fs.stem(executable.full_path()),
+ configuration: executable_config,
+ )
+endforeach
diff --git a/contrib/completion/meson.build b/contrib/completion/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..a9bfe2da312ac9764367b656bd8a4099b575ad72
--- /dev/null
+++ b/contrib/completion/meson.build
@@ -0,0 +1,8 @@
+foreach script : [
+ 'git-completion.bash',
+ 'git-completion.tcsh',
+ 'git-completion.zsh',
+ 'git-prompt.sh'
+]
+ test_dependencies += fs.copyfile(script)
+endforeach
diff --git a/contrib/meson.build b/contrib/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..a7b77b87c22c8f1d8a86faaafc2b647b94651db8
--- /dev/null
+++ b/contrib/meson.build
@@ -0,0 +1 @@
+subdir('completion')
diff --git a/gitweb/meson.build b/gitweb/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..ef868bd7dbcbcb5b69c2e73fc40c374435205c9c
--- /dev/null
+++ b/gitweb/meson.build
@@ -0,0 +1,79 @@
+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',
+]
+ fs.copyfile(asset,
+ install: true,
+ install_dir: get_option('datadir') / 'gitweb' / fs.parent(asset),
+ )
+endforeach
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..5c6a4212b04174247db173860edd01926576d3e8
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,1889 @@
+# Meson build system
+# ==================
+#
+# The Meson build system is an alternative to our Makefile that you can use to
+# build, test and install Git. Using Meson results in a couple of benefits:
+#
+# - Out-of-tree builds.
+# - Better integration into IDEs.
+# - Easy-to-use autoconfiguration of available features on your system.
+#
+# To use Meson from the command line you need to have both Meson and Ninja
+# installed. Alternatively, if you do not have Python available on your system,
+# you can also use Muon instead of Meson and Samurai instead of Ninja, both of
+# which are drop-ins replacement that only depend on C.
+#
+# Basic usage
+# ===========
+#
+# In the most trivial case, you can configure, build and install Git like this:
+#
+# 1. Set up the build directory. This only needs to happen once per build
+# directory you want to have. You can also configure multiple different
+# build directories with different configurations.
+#
+# $ meson setup build/
+#
+# The build directory gets ignored by Git automatically as Meson will write
+# a ".gitignore" file into it. From hereon, we will assume that you execute
+# commands inside this build directory.
+#
+# 2. Compile Git. You can either use Meson, Ninja or Samurai to do this, so all
+# of the following invocations are equivalent:
+#
+# $ meson compile
+# $ ninja
+# $ samu
+#
+# The different invocations should ultimately not make much of a difference.
+# Using Meson also works with other generators though, like when the build
+# directory has been set up for use with Microsoft Visual Studio.
+#
+# Ninja and Samurai use multiple jobs by default, scaling with the number of
+# processor cores available. You can pass the `-jN` flag to change this.
+#
+# Meson automatically picks up ccache and sccache when these are installed
+# when setting up the build directory. You can override this behaviour when
+# setting up the build directory by setting the `CC` environment variable to
+# your desired compiler.
+#
+# 3. Execute tests. Again, you can either use Meson, Ninja or Samurai to do this:
+#
+# $ meson test
+# $ ninja test
+# $ samu test
+#
+# It is recommended to use Meson in this case though as it also provides you
+# additional features that the other build systems don't have available.
+# You can e.g. pass additional arguments to the test executables or run
+# individual tests:
+#
+# # Execute the t0000-basic integration test and t-reftable-stack unit test.
+# $ meson test t0000-basic t-reftable-stack
+#
+# # Execute all reftable unit tests.
+# $ meson test t-reftable-*
+#
+# # Execute all tests and stop with the first failure.
+# $ meson test --maxfail 1
+#
+# # Execute single test interactively such that features like `debug ()` work.
+# $ meson test -i --test-args='-ix' t1400-update-ref
+#
+# Test execution is parallelized by default and scales with the number of
+# processor cores available. You can change the number of processes by passing
+# the `-jN` flag to `meson test`.
+#
+# 4. Install the Git distribution. Again, this can be done via Meson, Ninja or
+# Samurai:
+#
+# $ meson install
+# $ ninja install
+# $ samu install
+#
+# The prefix into which Git shall be installed is defined when setting up
+# the build directory. More on that in the "Configuration" section.
+#
+# Meson supports multiple backends. The default backend generates Ninja build
+# instructions, but it also supports the generation of Microsoft Visual
+# Studio solutions as well as Xcode projects by passing the `--backend` option
+# to `meson setup`. IDEs like Eclipse and Visual Studio Code provide plugins to
+# import Meson files directly.
+#
+# Configuration
+# =============
+#
+# The exact configuration of Git is determined when setting up the build
+# directory via `meson setup`. Unless told otherwise, Meson will automatically
+# detect the availability of various bits and pieces. There are two different
+# kinds of options that can be used to further tweak the build:
+#
+# - Built-in options provided by Meson.
+#
+# - Options defined by the project in the "meson_options.txt" file.
+#
+# Both kinds of options can be inspected by running `meson configure` in the
+# build directory, which will give you a list of the current value for all
+# options.
+#
+# Options can be configured either when setting up the build directory or can
+# be changed in preexisting build directories:
+#
+# # Set up a new build directory with optimized settings that will be
+# # installed into an alternative prefix.
+# $ meson setup --buildtype release --optimization 3 --strip --prefix=/home/$USER build
+#
+# # Set up a new build directory with a higher warning level. Level 2 is
+# # mostly equivalent to setting DEVELOPER=1, level 3 and "everything"
+# # will enable even more warnings.
+# $ meson setup -Dwarning_level=2 build
+#
+# # Set up a new build directory with 'address' and 'undefined' sanitizers
+# # using Clang.
+# $ CC=clang meson setup -Db_sanitize=address,undefined build
+#
+# # Disable tests in a preexisting build directory.
+# $ meson configure -Dtests=false
+#
+# # Disable features based on Python
+# $ meson configure -Dpython=disabled
+#
+# Options have a type like booleans, choices, strings or features. Features are
+# somewhat special as they can have one of three values: enabled, disabled or
+# auto. While the first two values are self-explanatory, "auto" will enable or
+# disable the feature based on the availability of prerequisites to support it.
+# Python-based features for example will be enabled automatically when a Python
+# interpreter could be found. The default value of such features can be changed
+# via `meson setup --auto-features={enabled,disabled,auto}`, which will set the
+# value of all features with a value of "auto" to the provided one by default.
+#
+# It is also possible to store a set of configuration options in machine files.
+# This can be useful in case you regularly want to reuse the same set of options:
+#
+# [binaries]
+# c = ['clang']
+# ar = ['ar']
+#
+# [project options]
+# gettext = 'disabled'
+# default_editor = 'vim'
+#
+# [built-in options]
+# b_lto = true
+# b_sanitize = 'address,undefined'
+#
+# These machine files can be passed to `meson setup` via the `--native-file`
+# option.
+#
+# Subproject wrappers
+# ===================
+#
+# Subproject wrappers are a feature provided by Meson that allows the automatic
+# fallback to a "wrapped" dependency in case the dependency is not provided by
+# the system. For example if the system is lacking curl, then Meson will use
+# "subprojects/curl.wrap" to set up curl as a subproject and compile and link
+# the dependency into Git itself. This is especially helpful on systems like
+# Windows, where you typically don't have such dependencies installed.
+#
+# The use of subproject wrappers can be disabled by executing `meson setup`
+# with the `--wrap-mode nofallback` option.
+
+project('git', 'c',
+ meson_version: '>=1.3.0',
+ # MSVC does not support GNU99, and C99 does not define __STDC_VERSION__
+ # on MSVC. So we instead fall back to C11 there.
+ default_options: ['c_std=gnu99,c11'],
+ version: 'v2.47.GIT',
+)
+
+fs = import('fs')
+
+program_path = []
+# Git for Windows provides all the tools we need to build Git.
+if host_machine.system() == 'windows'
+ program_path += [ 'C:/Program Files/Git/bin', 'C:/Program Files/Git/usr/bin' ]
+endif
+
+awk = find_program('awk', dirs: program_path)
+cygpath = find_program('cygpath', dirs: program_path, required: false)
+diff = find_program('diff', dirs: program_path)
+shell = find_program('sh', dirs: program_path)
+tar = find_program('tar', dirs: program_path)
+
+script_environment = environment()
+foreach tool : ['cat', 'cut', 'grep', 'sed', 'sort', 'tr', 'uname']
+ program = find_program(tool, dirs: program_path)
+ script_environment.prepend('PATH', fs.parent(program.full_path()))
+endforeach
+
+git = find_program('git', dirs: program_path, required: false)
+if git.found()
+ script_environment.prepend('PATH', fs.parent(git.full_path()))
+endif
+
+if get_option('sane_tool_path') != ''
+ script_environment.prepend('PATH', get_option('sane_tool_path'))
+endif
+
+compiler = meson.get_compiler('c')
+
+libgit_sources = [
+ 'abspath.c',
+ 'add-interactive.c',
+ 'add-patch.c',
+ 'advice.c',
+ 'alias.c',
+ 'alloc.c',
+ 'apply.c',
+ 'archive-tar.c',
+ 'archive-zip.c',
+ 'archive.c',
+ 'attr.c',
+ 'base85.c',
+ 'bisect.c',
+ 'blame.c',
+ 'blob.c',
+ 'bloom.c',
+ 'branch.c',
+ 'bulk-checkin.c',
+ 'bundle-uri.c',
+ 'bundle.c',
+ 'cache-tree.c',
+ 'cbtree.c',
+ 'chdir-notify.c',
+ 'checkout.c',
+ 'chunk-format.c',
+ 'color.c',
+ 'column.c',
+ 'combine-diff.c',
+ 'commit-graph.c',
+ 'commit-reach.c',
+ 'commit.c',
+ 'compat/nonblock.c',
+ 'compat/obstack.c',
+ 'compat/terminal.c',
+ 'compat/zlib-uncompress2.c',
+ 'config.c',
+ 'connect.c',
+ 'connected.c',
+ 'convert.c',
+ 'copy.c',
+ 'credential.c',
+ 'csum-file.c',
+ 'ctype.c',
+ 'date.c',
+ 'decorate.c',
+ 'delta-islands.c',
+ 'diagnose.c',
+ 'diff-delta.c',
+ 'diff-merges.c',
+ 'diff-lib.c',
+ 'diff-no-index.c',
+ 'diff.c',
+ 'diffcore-break.c',
+ 'diffcore-delta.c',
+ 'diffcore-order.c',
+ 'diffcore-pickaxe.c',
+ 'diffcore-rename.c',
+ 'diffcore-rotate.c',
+ 'dir-iterator.c',
+ 'dir.c',
+ 'editor.c',
+ 'entry.c',
+ 'environment.c',
+ 'ewah/bitmap.c',
+ 'ewah/ewah_bitmap.c',
+ 'ewah/ewah_io.c',
+ 'ewah/ewah_rlw.c',
+ 'exec-cmd.c',
+ 'fetch-negotiator.c',
+ 'fetch-pack.c',
+ 'fmt-merge-msg.c',
+ 'fsck.c',
+ 'fsmonitor.c',
+ 'fsmonitor-ipc.c',
+ 'fsmonitor-settings.c',
+ 'gettext.c',
+ 'git-zlib.c',
+ 'gpg-interface.c',
+ 'graph.c',
+ 'grep.c',
+ 'hash-lookup.c',
+ 'hashmap.c',
+ 'help.c',
+ 'hex.c',
+ 'hex-ll.c',
+ 'hook.c',
+ 'ident.c',
+ 'json-writer.c',
+ 'kwset.c',
+ 'levenshtein.c',
+ 'line-log.c',
+ 'line-range.c',
+ 'linear-assignment.c',
+ 'list-objects-filter-options.c',
+ 'list-objects-filter.c',
+ 'list-objects.c',
+ 'lockfile.c',
+ 'log-tree.c',
+ 'loose.c',
+ 'ls-refs.c',
+ 'mailinfo.c',
+ 'mailmap.c',
+ 'match-trees.c',
+ 'mem-pool.c',
+ 'merge-blobs.c',
+ 'merge-ll.c',
+ 'merge-ort.c',
+ 'merge-ort-wrappers.c',
+ 'merge-recursive.c',
+ 'merge.c',
+ 'midx.c',
+ 'midx-write.c',
+ 'name-hash.c',
+ 'negotiator/default.c',
+ 'negotiator/noop.c',
+ 'negotiator/skipping.c',
+ 'notes-cache.c',
+ 'notes-merge.c',
+ 'notes-utils.c',
+ 'notes.c',
+ 'object-file-convert.c',
+ 'object-file.c',
+ 'object-name.c',
+ 'object.c',
+ 'oid-array.c',
+ 'oidmap.c',
+ 'oidset.c',
+ 'oidtree.c',
+ 'pack-bitmap-write.c',
+ 'pack-bitmap.c',
+ 'pack-check.c',
+ 'pack-mtimes.c',
+ 'pack-objects.c',
+ 'pack-revindex.c',
+ 'pack-write.c',
+ 'packfile.c',
+ 'pager.c',
+ 'parallel-checkout.c',
+ 'parse.c',
+ 'parse-options-cb.c',
+ 'parse-options.c',
+ 'patch-delta.c',
+ 'patch-ids.c',
+ 'path.c',
+ 'pathspec.c',
+ 'pkt-line.c',
+ 'preload-index.c',
+ 'pretty.c',
+ 'prio-queue.c',
+ 'progress.c',
+ 'promisor-remote.c',
+ 'prompt.c',
+ 'protocol.c',
+ 'protocol-caps.c',
+ 'prune-packed.c',
+ 'pseudo-merge.c',
+ 'quote.c',
+ 'range-diff.c',
+ 'reachable.c',
+ 'read-cache.c',
+ 'rebase-interactive.c',
+ 'rebase.c',
+ 'ref-filter.c',
+ 'reflog-walk.c',
+ 'reflog.c',
+ 'refs.c',
+ 'refs/debug.c',
+ 'refs/files-backend.c',
+ 'refs/reftable-backend.c',
+ 'refs/iterator.c',
+ 'refs/packed-backend.c',
+ 'refs/ref-cache.c',
+ 'refspec.c',
+ 'reftable/basics.c',
+ 'reftable/error.c',
+ 'reftable/block.c',
+ 'reftable/blocksource.c',
+ 'reftable/iter.c',
+ 'reftable/merged.c',
+ 'reftable/pq.c',
+ 'reftable/reader.c',
+ 'reftable/record.c',
+ 'reftable/stack.c',
+ 'reftable/tree.c',
+ 'reftable/writer.c',
+ 'remote.c',
+ 'replace-object.c',
+ 'repo-settings.c',
+ 'repository.c',
+ 'rerere.c',
+ 'reset.c',
+ 'resolve-undo.c',
+ 'revision.c',
+ 'run-command.c',
+ 'send-pack.c',
+ 'sequencer.c',
+ 'serve.c',
+ 'server-info.c',
+ 'setup.c',
+ 'shallow.c',
+ 'sideband.c',
+ 'sigchain.c',
+ 'sparse-index.c',
+ 'split-index.c',
+ 'stable-qsort.c',
+ 'statinfo.c',
+ 'strbuf.c',
+ 'streaming.c',
+ 'string-list.c',
+ 'strmap.c',
+ 'strvec.c',
+ 'sub-process.c',
+ 'submodule-config.c',
+ 'submodule.c',
+ 'symlinks.c',
+ 'tag.c',
+ 'tempfile.c',
+ 'thread-utils.c',
+ 'tmp-objdir.c',
+ 'trace.c',
+ 'trace2.c',
+ 'trace2/tr2_cfg.c',
+ 'trace2/tr2_cmd_name.c',
+ 'trace2/tr2_ctr.c',
+ 'trace2/tr2_dst.c',
+ 'trace2/tr2_sid.c',
+ 'trace2/tr2_sysenv.c',
+ 'trace2/tr2_tbuf.c',
+ 'trace2/tr2_tgt_event.c',
+ 'trace2/tr2_tgt_normal.c',
+ 'trace2/tr2_tgt_perf.c',
+ 'trace2/tr2_tls.c',
+ 'trace2/tr2_tmr.c',
+ 'trailer.c',
+ 'transport-helper.c',
+ 'transport.c',
+ 'tree-diff.c',
+ 'tree-walk.c',
+ 'tree.c',
+ 'unpack-trees.c',
+ 'upload-pack.c',
+ 'url.c',
+ 'urlmatch.c',
+ 'usage.c',
+ 'userdiff.c',
+ 'utf8.c',
+ 'varint.c',
+ 'versioncmp.c',
+ 'walker.c',
+ 'wildmatch.c',
+ 'worktree.c',
+ 'wrapper.c',
+ 'write-or-die.c',
+ 'ws.c',
+ 'wt-status.c',
+ 'xdiff-interface.c',
+ 'xdiff/xdiffi.c',
+ 'xdiff/xemit.c',
+ 'xdiff/xhistogram.c',
+ 'xdiff/xmerge.c',
+ 'xdiff/xpatience.c',
+ 'xdiff/xprepare.c',
+ 'xdiff/xutils.c',
+]
+
+builtin_sources = [
+ 'builtin/add.c',
+ 'builtin/am.c',
+ 'builtin/annotate.c',
+ 'builtin/apply.c',
+ 'builtin/archive.c',
+ 'builtin/bisect.c',
+ 'builtin/blame.c',
+ 'builtin/branch.c',
+ 'builtin/bugreport.c',
+ 'builtin/bundle.c',
+ 'builtin/cat-file.c',
+ 'builtin/check-attr.c',
+ 'builtin/check-ignore.c',
+ 'builtin/check-mailmap.c',
+ 'builtin/check-ref-format.c',
+ 'builtin/checkout--worker.c',
+ 'builtin/checkout-index.c',
+ 'builtin/checkout.c',
+ 'builtin/clean.c',
+ 'builtin/clone.c',
+ 'builtin/column.c',
+ 'builtin/commit-graph.c',
+ 'builtin/commit-tree.c',
+ 'builtin/commit.c',
+ 'builtin/config.c',
+ 'builtin/count-objects.c',
+ 'builtin/credential-cache--daemon.c',
+ 'builtin/credential-cache.c',
+ 'builtin/credential-store.c',
+ 'builtin/credential.c',
+ 'builtin/describe.c',
+ 'builtin/diagnose.c',
+ 'builtin/diff-files.c',
+ 'builtin/diff-index.c',
+ 'builtin/diff-tree.c',
+ 'builtin/diff.c',
+ 'builtin/difftool.c',
+ 'builtin/fast-export.c',
+ 'builtin/fast-import.c',
+ 'builtin/fetch-pack.c',
+ 'builtin/fetch.c',
+ 'builtin/fmt-merge-msg.c',
+ 'builtin/for-each-ref.c',
+ 'builtin/for-each-repo.c',
+ 'builtin/fsck.c',
+ 'builtin/fsmonitor--daemon.c',
+ 'builtin/gc.c',
+ 'builtin/get-tar-commit-id.c',
+ 'builtin/grep.c',
+ 'builtin/hash-object.c',
+ 'builtin/help.c',
+ 'builtin/hook.c',
+ 'builtin/index-pack.c',
+ 'builtin/init-db.c',
+ 'builtin/interpret-trailers.c',
+ 'builtin/log.c',
+ 'builtin/ls-files.c',
+ 'builtin/ls-remote.c',
+ 'builtin/ls-tree.c',
+ 'builtin/mailinfo.c',
+ 'builtin/mailsplit.c',
+ 'builtin/merge-base.c',
+ 'builtin/merge-file.c',
+ 'builtin/merge-index.c',
+ 'builtin/merge-ours.c',
+ 'builtin/merge-recursive.c',
+ 'builtin/merge-tree.c',
+ 'builtin/merge.c',
+ 'builtin/mktag.c',
+ 'builtin/mktree.c',
+ 'builtin/multi-pack-index.c',
+ 'builtin/mv.c',
+ 'builtin/name-rev.c',
+ 'builtin/notes.c',
+ 'builtin/pack-objects.c',
+ 'builtin/pack-redundant.c',
+ 'builtin/pack-refs.c',
+ 'builtin/patch-id.c',
+ 'builtin/prune-packed.c',
+ 'builtin/prune.c',
+ 'builtin/pull.c',
+ 'builtin/push.c',
+ 'builtin/range-diff.c',
+ 'builtin/read-tree.c',
+ 'builtin/rebase.c',
+ 'builtin/receive-pack.c',
+ 'builtin/reflog.c',
+ 'builtin/refs.c',
+ 'builtin/remote-ext.c',
+ 'builtin/remote-fd.c',
+ 'builtin/remote.c',
+ 'builtin/repack.c',
+ 'builtin/replace.c',
+ 'builtin/replay.c',
+ 'builtin/rerere.c',
+ 'builtin/reset.c',
+ 'builtin/rev-list.c',
+ 'builtin/rev-parse.c',
+ 'builtin/revert.c',
+ 'builtin/rm.c',
+ 'builtin/send-pack.c',
+ 'builtin/shortlog.c',
+ 'builtin/show-branch.c',
+ 'builtin/show-index.c',
+ 'builtin/show-ref.c',
+ 'builtin/sparse-checkout.c',
+ 'builtin/stash.c',
+ 'builtin/stripspace.c',
+ 'builtin/submodule--helper.c',
+ 'builtin/symbolic-ref.c',
+ 'builtin/tag.c',
+ 'builtin/unpack-file.c',
+ 'builtin/unpack-objects.c',
+ 'builtin/update-index.c',
+ 'builtin/update-ref.c',
+ 'builtin/update-server-info.c',
+ 'builtin/upload-archive.c',
+ 'builtin/upload-pack.c',
+ 'builtin/var.c',
+ 'builtin/verify-commit.c',
+ 'builtin/verify-pack.c',
+ 'builtin/verify-tag.c',
+ 'builtin/worktree.c',
+ 'builtin/write-tree.c',
+]
+
+libgit_sources += custom_target(
+ input: 'command-list.txt',
+ output: 'command-list.h',
+ command: [shell, meson.current_source_dir() + '/generate-cmdlist.sh', meson.current_source_dir(), '@OUTPUT@'],
+ env: script_environment,
+)
+
+libgit_sources += custom_target(
+ output: 'config-list.h',
+ command: [
+ shell,
+ meson.current_source_dir() + '/generate-configlist.sh',
+ meson.current_source_dir(),
+ '@OUTPUT@',
+ ],
+ env: script_environment,
+)
+
+libgit_sources += custom_target(
+ input: 'Documentation/githooks.txt',
+ output: 'hook-list.h',
+ command: [
+ shell,
+ meson.current_source_dir() + '/generate-hooklist.sh',
+ meson.current_source_dir(),
+ '@OUTPUT@',
+ ],
+ env: script_environment,
+)
+
+# This contains the variables for GIT-BUILD-OPTIONS, which we use to propagate
+# build options to our tests.
+build_options_config = configuration_data()
+build_options_config.set('GIT_INTEROP_MAKE_OPTS', '')
+build_options_config.set('GIT_PERF_LARGE_REPO', '')
+build_options_config.set('GIT_PERF_MAKE_COMMAND', '')
+build_options_config.set('GIT_PERF_MAKE_OPTS', '')
+build_options_config.set('GIT_PERF_REPEAT_COUNT', '')
+build_options_config.set('GIT_PERF_REPO', '')
+build_options_config.set('GIT_TEST_CMP_USE_COPIED_CONTEXT', '')
+build_options_config.set('GIT_TEST_INDEX_VERSION', '')
+build_options_config.set('GIT_TEST_OPTS', '')
+build_options_config.set('GIT_TEST_PERL_FATAL_WARNINGS', '')
+build_options_config.set('GIT_TEST_UTF8_LOCALE', '')
+build_options_config.set_quoted('LOCALEDIR', fs.as_posix(get_option('prefix') / get_option('localedir')))
+build_options_config.set('GITWEBDIR', fs.as_posix(get_option('prefix') / get_option('datadir') / 'gitweb'))
+
+if get_option('sane_tool_path') != ''
+ build_options_config.set_quoted('BROKEN_PATH_FIX', 's|^\# @BROKEN_PATH_FIX@$|git_broken_path_fix "' + get_option('sane_tool_path') + '"|')
+else
+ build_options_config.set_quoted('BROKEN_PATH_FIX', '/^\# @BROKEN_PATH_FIX@$/d')
+endif
+
+test_output_directory = get_option('test_output_directory')
+if test_output_directory == ''
+ test_output_directory = meson.project_build_root() / 'test-output'
+endif
+
+# These variables are used for building libgit.a.
+libgit_c_args = [
+ '-DBINDIR="' + get_option('bindir') + '"',
+ '-DDEFAULT_EDITOR="' + get_option('default_editor') + '"',
+ '-DDEFAULT_GIT_TEMPLATE_DIR="' + get_option('datadir') / 'git-core/templates' + '"',
+ '-DDEFAULT_HELP_FORMAT="' + get_option('default_help_format') + '"',
+ '-DDEFAULT_PAGER="' + get_option('default_pager') + '"',
+ '-DETC_GITATTRIBUTES="' + get_option('gitattributes') + '"',
+ '-DETC_GITCONFIG="' + get_option('gitconfig') + '"',
+ '-DFALLBACK_RUNTIME_PREFIX="' + get_option('prefix') + '"',
+ '-DGIT_EXEC_PATH="' + get_option('prefix') / get_option('libexecdir') / 'git-core"',
+ '-DGIT_HOST_CPU="' + host_machine.cpu_family() + '"',
+ '-DGIT_HTML_PATH="' + get_option('datadir') / 'doc/git-doc"',
+ '-DGIT_INFO_PATH="' + get_option('infodir') + '"',
+ '-DGIT_LOCALE_PATH="' + get_option('localedir') + '"',
+ '-DGIT_MAN_PATH="' + get_option('mandir') + '"',
+ '-DPAGER_ENV="' + get_option('pager_environment') + '"',
+ '-DSHELL_PATH="' + fs.as_posix(shell.full_path()) + '"',
+]
+libgit_include_directories = [ '.' ]
+libgit_dependencies = [ ]
+
+# Treat any warning level above 1 the same as we treat DEVELOPER=1 in our
+# Makefile.
+if get_option('warning_level') in ['2','3', 'everything'] and compiler.get_argument_syntax() == 'gcc'
+ foreach cflag : [
+ '-Wdeclaration-after-statement',
+ '-Wformat-security',
+ '-Wold-style-definition',
+ '-Woverflow',
+ '-Wpointer-arith',
+ '-Wstrict-prototypes',
+ '-Wunused',
+ '-Wvla',
+ '-Wwrite-strings',
+ '-fno-common',
+ '-Wtautological-constant-out-of-range-compare',
+ # If a function is public, there should be a prototype and the right
+ # header file should be included. If not, it should be static.
+ '-Wmissing-prototypes',
+ # These are disabled because we have these all over the place.
+ '-Wno-empty-body',
+ '-Wno-missing-field-initializers',
+ '-Wno-sign-compare',
+ ]
+ if compiler.has_argument(cflag)
+ libgit_c_args += cflag
+ endif
+ endforeach
+endif
+
+if get_option('b_sanitize').contains('address')
+ build_options_config.set('SANITIZE_ADDRESS', 'YesCompiledWithIt')
+else
+ build_options_config.set('SANITIZE_ADDRESS', '')
+endif
+if get_option('b_sanitize').contains('leak')
+ libgit_c_args += '-DSUPPRESS_ANNOTATED_LEAKS'
+ build_options_config.set('SANITIZE_LEAK', 'YesCompiledWithIt')
+else
+ build_options_config.set('SANITIZE_LEAK', '')
+endif
+if get_option('b_sanitize').contains('undefined')
+ libgit_c_args += '-DSHA1DC_FORCE_ALIGNED_ACCESS'
+endif
+
+executable_suffix = ''
+if host_machine.system() == 'cygwin' or host_machine.system() == 'windows'
+ executable_suffix = '.exe'
+ libgit_c_args += '-DSTRIP_EXTENSION="' + executable_suffix + '"'
+endif
+build_options_config.set_quoted('X', executable_suffix)
+
+python = import('python').find_installation('python3', required: get_option('python'))
+if python.found()
+ build_options_config.set('NO_PYTHON', '')
+else
+ libgit_c_args += '-DNO_PYTHON'
+ build_options_config.set('NO_PYTHON', '1')
+endif
+
+# Perl is used for two different things: our test harness and to provide some
+# features. It is optional if you want to neither execute tests nor use any of
+# these optional features.
+perl_required = get_option('perl')
+if get_option('tests')
+ perl_required = true
+endif
+
+# Note that we only set NO_PERL if the Perl features were disabled by the user.
+# It may not be set when we have found Perl, but only use it to run tests.
+perl = find_program('perl', version: '>=5.8.1', dirs: program_path, required: perl_required)
+perl_features_enabled = perl.found() and get_option('perl').allowed()
+if perl_features_enabled
+ build_options_config.set('NO_PERL', '')
+
+ if get_option('runtime_prefix')
+ build_options_config.set('PERL_LOCALEDIR', '')
+ else
+ build_options_config.set_quoted('PERL_LOCALEDIR', fs.as_posix(get_option('prefix') / get_option('localedir')))
+ endif
+
+ if get_option('perl_cpan_fallback')
+ build_options_config.set('NO_PERL_CPAN_FALLBACKS', '')
+ else
+ build_options_config.set_quoted('NO_PERL_CPAN_FALLBACKS', 'YesPlease')
+ endif
+else
+ libgit_c_args += '-DNO_PERL'
+ build_options_config.set('NO_PERL', '1')
+ build_options_config.set('PERL_LOCALEDIR', '')
+ build_options_config.set('NO_PERL_CPAN_FALLBACKS', '')
+endif
+
+zlib = dependency('zlib', default_options: ['default_library=static', 'tests=disabled'])
+if zlib.version().version_compare('<1.2.0')
+ libgit_c_args += '-DNO_DEFLATE_BOUND'
+endif
+libgit_dependencies += zlib
+
+threads = dependency('threads', required: false)
+if threads.found()
+ libgit_dependencies += threads
+ build_options_config.set('NO_PTHREADS', '')
+else
+ libgit_c_args += '-DNO_PTHREADS'
+ build_options_config.set('NO_PTHREADS', '1')
+endif
+
+msgfmt = find_program('msgfmt', dirs: program_path, required: false)
+gettext_option = get_option('gettext').disable_auto_if(not msgfmt.found())
+if not msgfmt.found() and gettext_option.enabled()
+ error('Internationalization via libintl requires msgfmt')
+endif
+
+if gettext_option.allowed() and host_machine.system() == 'darwin' and get_option('macos_use_homebrew_gettext')
+ if host_machine.cpu_family() == 'x86_64'
+ libintl_prefix = '/usr/local'
+ elif host_machine.cpu_family() == 'aarch64'
+ libintl_prefix = '/opt/homebrew'
+ else
+ error('Homebrew workaround not supported on current architecture')
+ endif
+
+ intl = compiler.find_library('intl', dirs: libintl_prefix / 'lib', required: gettext_option)
+ if intl.found()
+ intl = declare_dependency(
+ dependencies: intl,
+ include_directories: libintl_prefix / 'include',
+ )
+ endif
+else
+ intl = dependency('intl', required: gettext_option)
+endif
+if intl.found()
+ libgit_dependencies += intl
+ build_options_config.set('NO_GETTEXT', '')
+ build_options_config.set('USE_GETTEXT_SCHEME', '')
+else
+ libgit_c_args += '-DNO_GETTEXT'
+ build_options_config.set('NO_GETTEXT', '1')
+ build_options_config.set('USE_GETTEXT_SCHEME', 'fallthrough')
+endif
+
+iconv = dependency('iconv', required: get_option('iconv'))
+if iconv.found()
+ libgit_dependencies += iconv
+ build_options_config.set('NO_ICONV', '')
+
+ have_old_iconv = false
+ if not compiler.compiles('''
+ #include <iconv.h>
+
+ extern size_t iconv(iconv_t cd,
+ char **inbuf, size_t *inbytesleft,
+ char **outbuf, size_t *outbytesleft);
+ ''', name: 'old iconv interface', dependencies: [iconv])
+ libgit_c_args += '-DOLD_ICONV'
+ have_old_iconv = true
+ endif
+
+ iconv_omits_bom_source = '''#
+ #include <iconv.h>
+
+ int main(int argc, const char **argv)
+ {
+ '''
+ if have_old_iconv
+ iconv_omits_bom_source += '''
+ typedef const char *iconv_ibp;
+ '''
+ else
+ iconv_omits_bom_source += '''
+ typedef char *iconv_ibp;
+ '''
+ endif
+ iconv_omits_bom_source += '''
+ int v;
+ iconv_t conv;
+ char in[] = "a"; iconv_ibp pin = in;
+ char out[20] = ""; char *pout = out;
+ size_t isz = sizeof in;
+ size_t osz = sizeof out;
+
+ conv = iconv_open("UTF-16", "UTF-8");
+ iconv(conv, &pin, &isz, &pout, &osz);
+ iconv_close(conv);
+ v = (unsigned char)(out[0]) + (unsigned char)(out[1]);
+ return v != 0xfe + 0xff;
+ }
+ '''
+
+ if compiler.run(iconv_omits_bom_source,
+ dependencies: iconv,
+ name: 'iconv omits BOM',
+ ).returncode() != 0
+ libgit_c_args += '-DICONV_OMITS_BOM'
+ endif
+else
+ libgit_c_args += '-DNO_ICONV'
+ build_options_config.set('NO_ICONV', '1')
+endif
+
+pcre2 = dependency('libpcre2-8', required: get_option('pcre2'), default_options: ['default_library=static', 'test=false'])
+if pcre2.found()
+ libgit_dependencies += pcre2
+ libgit_c_args += '-DUSE_LIBPCRE2'
+ build_options_config.set('USE_LIBPCRE2', '1')
+else
+ build_options_config.set('USE_LIBPCRE2', '')
+endif
+
+curl = dependency('libcurl', version: '>=7.21.3', required: get_option('curl'), default_options: ['default_library=static', 'tests=disabled', 'tool=disabled'])
+use_curl_for_imap_send = false
+if curl.found()
+ if curl.version().version_compare('>=7.34.0')
+ libgit_c_args += '-DUSE_CURL_FOR_IMAP_SEND'
+ use_curl_for_imap_send = true
+ endif
+
+ libgit_dependencies += curl
+ libgit_c_args += '-DCURL_DISABLE_TYPECHECK'
+ build_options_config.set('NO_CURL', '')
+else
+ libgit_c_args += '-DNO_CURL'
+ build_options_config.set('NO_CURL', '1')
+endif
+
+expat = dependency('expat', required: get_option('expat'), default_options: ['default_library=static', 'build_tests=false'])
+if expat.found()
+ libgit_dependencies += expat
+
+ if expat.version().version_compare('<=1.2')
+ libgit_c_args += '-DEXPAT_NEEDS_XMLPARSE_H'
+ endif
+ build_options_config.set('NO_EXPAT', '')
+else
+ libgit_c_args += '-DNO_EXPAT'
+ build_options_config.set('NO_EXPAT', '1')
+endif
+
+if not compiler.has_header('sys/select.h')
+ libgit_c_args += '-DNO_SYS_SELECT_H'
+endif
+
+has_poll_h = compiler.has_header('poll.h')
+if not has_poll_h
+ libgit_c_args += '-DNO_POLL_H'
+endif
+
+has_sys_poll_h = compiler.has_header('sys/poll.h')
+if not has_sys_poll_h
+ libgit_c_args += '-DNO_SYS_POLL_H'
+endif
+
+if not has_poll_h and not has_sys_poll_h
+ libgit_c_args += '-DNO_POLL'
+ libgit_sources += 'compat/poll/poll.c'
+ libgit_include_directories += 'compat/poll'
+endif
+
+if not compiler.has_header('inttypes.h')
+ libgit_c_args += '-DNO_INTTYPES_H'
+endif
+
+if compiler.has_header('libcharset.h')
+ libcharset = compiler.find_library('charset')
+
+ if compiler.has_function('locale_charset',
+ prefix: '#include <libcharset.h>',
+ dependencies: iconv,
+ )
+ libgit_c_args += '-DHAVE_LIBCHARSET_H'
+ elif compiler.has_function('locale_charset',
+ prefix: '#include <libcharset.h>',
+ dependencies: libcharset,
+ )
+ libgit_c_args += '-DHAVE_LIBCHARSET_H'
+ endif
+endif
+
+if compiler.has_header('alloca.h')
+ libgit_c_args += '-DHAVE_ALLOCA_H'
+endif
+
+if compiler.has_header('sys/sysinfo.h')
+ libgit_c_args += '-DHAVE_SYSINFO'
+endif
+
+# Windows has libgen.h and a basename implementation, but we still need our own
+# implementation to threat things like drive prefixes specially.
+if host_machine.system() == 'windows' or not compiler.has_header('libgen.h')
+ libgit_c_args += '-DNO_LIBGEN_H'
+ libgit_sources += 'compat/basename.c'
+endif
+
+if compiler.has_header('paths.h')
+ libgit_c_args += '-DHAVE_PATHS_H'
+endif
+
+if compiler.has_header('strings.h')
+ libgit_c_args += '-DHAVE_STRINGS_H'
+endif
+
+networking_dependencies = [ ]
+if host_machine.system() == 'windows'
+ winsock = compiler.find_library('ws2_32', required: false)
+ if winsock.found()
+ networking_dependencies += winsock
+ endif
+else
+ libresolv = compiler.find_library('resolv', required: false)
+ if libresolv.found()
+ networking_dependencies += libresolv
+ endif
+endif
+libgit_dependencies += networking_dependencies
+
+foreach symbol : ['inet_ntop', 'inet_pton', 'strerror']
+ if not compiler.has_function(symbol, dependencies: networking_dependencies)
+ libgit_c_args += '-DNO_' + symbol.to_upper()
+ endif
+endforeach
+
+has_ipv6 = compiler.has_function('getaddrinfo', dependencies: networking_dependencies)
+if not has_ipv6
+ libgit_c_args += '-DNO_IPV6'
+endif
+
+if not compiler.compiles('''
+ #ifdef _WIN32
+ # include <winsock2.h>
+ #else
+ # include <sys/types.h>
+ # include <sys/socket.h>
+ #endif
+
+ void func(void)
+ {
+ struct sockaddr_storage x;
+ }
+''', name: 'struct sockaddr_storage')
+ if has_ipv6
+ libgit_c_args += '-Dsockaddr_storage=sockaddr_in6'
+ else
+ libgit_c_args += '-Dsockaddr_storage=sockaddr_in'
+ endif
+endif
+
+if compiler.has_function('socket', dependencies: networking_dependencies)
+ libgit_sources += [
+ 'unix-socket.c',
+ 'unix-stream-server.c',
+ ]
+ build_options_config.set('NO_UNIX_SOCKETS', '')
+else
+ libgit_c_args += '-DNO_UNIX_SOCKETS'
+ build_options_config.set('NO_UNIX_SOCKETS', '1')
+endif
+
+if not compiler.has_function('pread')
+ libgit_c_args += '-DNO_PREAD'
+ libgit_sources += 'compat/pread.c'
+endif
+
+if host_machine.system() == 'darwin'
+ libgit_sources += 'compat/precompose_utf8.c'
+ libgit_c_args += '-DPRECOMPOSE_UNICODE'
+ libgit_c_args += '-DPROTECT_HFS_DEFAULT'
+endif
+
+# Configure general compatibility wrappers.
+if host_machine.system() == 'cygwin'
+ libgit_sources += [
+ 'compat/win32/path-utils.c',
+ ]
+elif host_machine.system() == 'windows'
+ libgit_sources += [
+ 'compat/mingw.c',
+ 'compat/winansi.c',
+ 'compat/win32/flush.c',
+ 'compat/win32/path-utils.c',
+ 'compat/win32/pthread.c',
+ 'compat/win32/syslog.c',
+ 'compat/win32/dirent.c',
+ 'compat/win32mmap.c',
+ 'compat/nedmalloc/nedmalloc.c',
+ ]
+
+ libgit_c_args += [
+ '-DDETECT_MSYS_TTY',
+ '-DENSURE_MSYSTEM_IS_SET',
+ '-DNATIVE_CRLF',
+ '-DNOGDI',
+ '-DNO_POSIX_GOODIES',
+ '-DWIN32',
+ '-D_CONSOLE',
+ '-D_CONSOLE_DETECT_MSYS_TTY',
+ '-D__USE_MINGW_ANSI_STDIO=0',
+ ]
+
+ libgit_dependencies += compiler.find_library('ntdll')
+ libgit_include_directories += 'compat/win32'
+ if compiler.get_id() == 'msvc'
+ libgit_include_directories += 'compat/vcbuild/include'
+ endif
+endif
+
+if host_machine.system() == 'linux'
+ libgit_sources += 'compat/linux/procinfo.c'
+elif host_machine.system() == 'windows'
+ libgit_sources += 'compat/win32/trace2_win32_process_info.c'
+else
+ libgit_sources += 'compat/stub/procinfo.c'
+endif
+
+if host_machine.system() == 'cygwin' or host_machine.system() == 'windows'
+ libgit_c_args += [
+ '-DUNRELIABLE_FSTAT',
+ '-DMMAP_PREVENTS_DELETE',
+ '-DOBJECT_CREATION_MODE=1',
+ ]
+endif
+
+# Configure the simple-ipc subsystem required fro the fsmonitor.
+if host_machine.system() == 'windows'
+ libgit_sources += [
+ 'compat/simple-ipc/ipc-shared.c',
+ 'compat/simple-ipc/ipc-win32.c',
+ ]
+ libgit_c_args += '-DSUPPORTS_SIMPLE_IPC'
+else
+ libgit_sources += [
+ 'compat/simple-ipc/ipc-shared.c',
+ 'compat/simple-ipc/ipc-unix-socket.c',
+ ]
+ libgit_c_args += '-DSUPPORTS_SIMPLE_IPC'
+endif
+
+fsmonitor_backend = ''
+if host_machine.system() == 'windows'
+ fsmonitor_backend = 'win32'
+elif host_machine.system() == 'darwin'
+ fsmonitor_backend = 'darwin'
+ libgit_dependencies += dependency('CoreServices')
+endif
+if fsmonitor_backend != ''
+ libgit_c_args += '-DHAVE_FSMONITOR_DAEMON_BACKEND'
+ libgit_c_args += '-DHAVE_FSMONITOR_OS_SETTINGS'
+
+ libgit_sources += [
+ 'compat/fsmonitor/fsm-health-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-ipc-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-listen-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-path-utils-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-settings-' + fsmonitor_backend + '.c',
+ ]
+endif
+build_options_config.set_quoted('FSMONITOR_DAEMON_BACKEND', fsmonitor_backend)
+build_options_config.set_quoted('FSMONITOR_OS_SETTINGS', fsmonitor_backend)
+
+if not get_option('b_sanitize').contains('address') and get_option('regex').allowed() and compiler.has_header('regex.h') and compiler.get_define('REG_STARTEND', prefix: '#include <regex.h>') != ''
+ build_options_config.set('NO_REGEX', '')
+
+ if compiler.get_define('REG_ENHANCED', prefix: '#include <regex.h>') != ''
+ libgit_c_args += '-DUSE_ENHANCED_BASIC_REGULAR_EXPRESSIONS'
+ libgit_sources += 'compat/regcomp_enhanced.c'
+ endif
+elif not get_option('regex').enabled()
+ libgit_c_args += [
+ '-DNO_REGEX',
+ '-DGAWK',
+ '-DNO_MBSUPPORT',
+ ]
+ build_options_config.set('NO_REGEX', '1')
+ libgit_sources += 'compat/regex/regex.c'
+ libgit_include_directories += 'compat/regex'
+else
+ error('Native regex support requested but not found')
+endif
+
+# setitimer and friends are provided by compat/mingw.c.
+if host_machine.system() != 'windows'
+ if not compiler.compiles('''
+ #include <sys/time.h>
+ void func(void)
+ {
+ struct itimerval value;
+ }
+ ''', name: 'struct itimerval')
+ libgit_c_args += '-DNO_STRUCT_ITIMERVAL'
+ libgit_c_args += '-DNO_SETITIMER'
+ elif not compiler.has_function('setitimer')
+ libgit_c_args += '-DNO_SETITIMER'
+ endif
+endif
+
+if compiler.has_member('struct stat', 'st_mtimespec.tv_nsec', prefix: '#include <sys/stat.h>')
+ libgit_c_args += '-DUSE_ST_TIMESPEC'
+elif not compiler.has_member('struct stat', 'st_mtim.tv_nsec', prefix: '#include <sys/stat.h>')
+ libgit_c_args += '-DNO_NSEC'
+endif
+
+if not compiler.has_member('struct stat', 'st_blocks', prefix: '#include <sys/stat.h>')
+ libgit_c_args += '-DNO_ST_BLOCKS_IN_STRUCT_STAT'
+endif
+
+if not compiler.has_member('struct dirent', 'd_type', prefix: '#include <dirent.h>')
+ libgit_c_args += '-DNO_D_TYPE_IN_DIRENT'
+endif
+
+if not compiler.has_member('struct passwd', 'pw_gecos', prefix: '#include <pwd.h>')
+ libgit_c_args += '-DNO_GECOS_IN_PWENT'
+endif
+
+if compiler.has_function('sync_file_range')
+ libgit_c_args += '-DHAVE_SYNC_FILE_RANGE'
+endif
+
+if not compiler.has_function('strcasestr')
+ libgit_c_args += '-DNO_STRCASESTR'
+ libgit_sources += 'compat/strcasestr.c'
+endif
+
+if not compiler.has_function('memmem')
+ libgit_c_args += '-DNO_MEMMEM'
+ libgit_sources += 'compat/memmem.c'
+endif
+
+if not compiler.has_function('strlcpy')
+ libgit_c_args += '-DNO_STRLCPY'
+ libgit_sources += 'compat/strlcpy.c'
+endif
+
+if not compiler.has_function('strdup')
+ libgit_c_args += '-DOVERRIDE_STRDUP'
+ libgit_sources += 'compat/strdup.c'
+endif
+
+if not compiler.has_function('strtoumax')
+ libgit_c_args += '-DNO_STRTOUMAX'
+ libgit_sources += [
+ 'compat/strtoumax.c',
+ 'compat/strtoimax.c',
+ ]
+endif
+
+if not compiler.has_function('strtoull')
+ libgit_c_args += '-DNO_STRTOULL'
+endif
+
+if not compiler.has_function('setenv')
+ libgit_c_args += '-DNO_SETENV'
+ libgit_sources += 'compat/setenv.c'
+endif
+
+if not compiler.has_function('qsort')
+ libgit_c_args += '-DINTERNAL_QSORT'
+endif
+libgit_sources += 'compat/qsort_s.c'
+
+# unsetenv is provided by compat/mingw.c.
+if host_machine.system() != 'windows' and not compiler.has_function('unsetenv')
+ libgit_c_args += '-DNO_UNSETENV'
+ libgit_sources += 'compat/unsetenv.c'
+endif
+
+if not compiler.has_function('mkdtemp')
+ libgit_c_args += '-DNO_MKDTEMP'
+ libgit_sources += 'compat/mkdtemp.c'
+endif
+
+if not compiler.has_function('initgroups')
+ libgit_c_args += '-DNO_INITGROUPS'
+endif
+
+if compiler.has_function('getdelim')
+ libgit_c_args += '-DHAVE_GETDELIM'
+endif
+
+if host_machine.system() == 'windows'
+ libgit_c_args += '-DUSE_WIN32_MMAP'
+elif not compiler.has_function('mmap')
+ libgit_c_args += '-DNO_MMAP'
+ libgit_sources += 'compat/mmap.c'
+endif
+
+if compiler.has_function('clock_gettime')
+ libgit_c_args += '-DHAVE_CLOCK_GETTIME'
+endif
+
+if compiler.compiles('''
+ #include <time.h>
+
+ void func(void)
+ {
+ clockid_t id = CLOCK_MONOTONIC;
+ }
+''', name: 'monotonic clock')
+ libgit_c_args += '-DHAVE_CLOCK_MONOTONIC'
+endif
+
+if not compiler.compiles('''
+ #include <inttypes.h>
+
+ void func(void)
+ {
+ uintmax_t x = 0;
+ }
+''', name: 'uintmax_t')
+ libgit_c_args += '-DNO_UINTMAX_T'
+endif
+
+has_bsd_sysctl = false
+if compiler.has_header('sys/sysctl.h')
+ if compiler.compiles('''
+ #include <stddef.h>
+ #include <sys/sysctl.h>
+
+ void func(void)
+ {
+ int val, mib[2] = { 0 };
+ size_t len = sizeof(val);
+ sysctl(mib, 2, &val, &len, NULL, 0);
+ }
+ ''', name: 'BSD sysctl')
+ libgit_c_args += '-DHAVE_BSD_SYSCTL'
+ has_bsd_sysctl = true
+ endif
+endif
+
+if not meson.is_cross_build() and compiler.run('''
+ #include <stdio.h>
+
+ int main(int argc, const char **argv)
+ {
+ FILE *f = fopen(".", "r");
+ return f ? 0 : 1;
+ }
+''', name: 'fread reads directories').returncode() == 0
+ libgit_c_args += '-DFREAD_READS_DIRECTORIES'
+ libgit_sources += 'compat/fopen.c'
+endif
+
+if not meson.is_cross_build() and fs.exists('/dev/tty')
+ libgit_c_args += '-DHAVE_DEV_TTY'
+endif
+
+https_backend = get_option('https_backend')
+
+security_framework = dependency('Security', required: https_backend == 'CommonCrypto')
+core_foundation_framework = dependency('CoreFoundation', required: security_framework.found())
+if https_backend == 'auto' and security_framework.found()
+ https_backend = 'CommonCrypto'
+endif
+
+openssl_required = https_backend == 'openssl' or get_option('sha1_backend') == 'openssl' or get_option('sha256_backend') == 'openssl'
+openssl = dependency('openssl', required: openssl_required, default_options: ['default_library=static'])
+if https_backend == 'auto' and openssl.found()
+ https_backend = 'openssl'
+endif
+
+if https_backend == 'CommonCrypto'
+ libgit_dependencies += security_framework
+ libgit_dependencies += core_foundation_framework
+ libgit_c_args += '-DAPPLE_COMMON_CRYPTO'
+elif https_backend == 'openssl'
+ libgit_dependencies += openssl
+else
+ # We either couldn't find any dependencies with 'auto' or the user requested
+ # 'none'. Both cases are benign.
+endif
+
+if https_backend != 'openssl'
+ libgit_c_args += '-DNO_OPENSSL'
+endif
+
+sha1_backend = get_option('sha1_backend')
+if sha1_backend == 'sha1dc'
+ libgit_c_args += '-DSHA1_DC'
+ libgit_c_args += '-DSHA1DC_NO_STANDARD_INCLUDES=1'
+ libgit_c_args += '-DSHA1DC_INIT_SAFE_HASH_DEFAULT=0'
+ libgit_c_args += '-DSHA1DC_CUSTOM_INCLUDE_SHA1_C="git-compat-util.h"'
+ libgit_c_args += '-DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="git-compat-util.h"'
+
+ libgit_sources += [
+ 'sha1dc_git.c',
+ 'sha1dc/sha1.c',
+ 'sha1dc/ubc_check.c',
+ ]
+elif sha1_backend == 'common-crypto'
+ libgit_c_args += '-DCOMMON_DIGEST_FOR_OPENSSL'
+ libgit_c_args += '-DSHA1_APPLE'
+ # Apple CommonCrypto requires chunking
+ libgit_c_args += '-DSHA1_MAX_BLOCK_SIZE=1024L*1024L*1024L'
+elif sha1_backend == 'openssl'
+ libgit_c_args += '-DSHA1_OPENSSL'
+ libgit_dependencies += openssl
+elif sha1_backend == 'block'
+ libgit_c_args += '-DSHA1_BLK'
+ libgit_sources += 'block-sha1/sha1.c'
+else
+ error('Unhandled SHA1 backend ' + sha1_backend)
+endif
+
+sha256_backend = get_option('sha256_backend')
+if sha256_backend == 'openssl'
+ libgit_c_args += '-DSHA256_OPENSSL'
+ libgit_dependencies += openssl
+elif sha256_backend == 'nettle'
+ nettle = dependency('nettle')
+ libgit_dependencies += nettle
+ libgit_c_args += '-DSHA256_NETTLE'
+elif sha256_backend == 'gcrypt'
+ gcrypt = dependency('gcrypt')
+ libgit_dependencies += gcrypt
+ libgit_c_args += '-DSHA256_GCRYPT'
+elif sha256_backend == 'block'
+ libgit_c_args += '-DSHA256_BLK'
+ libgit_sources += 'sha256/block/sha256.c'
+else
+ error('Unhandled SHA256 backend ' + sha256_backend)
+endif
+
+if compiler.has_header_symbol('stdlib.h', 'arc4random_buf')
+ libgit_c_args += '-DHAVE_ARC4RANDOM'
+elif compiler.has_header_symbol('bsd/stdlib.h', 'arc4random_buf')
+ libgit_c_args += '-DHAVE_ARC4RANDOM_BSD'
+elif compiler.has_function('getrandom', prefix: '#include <sys/random.h>')
+ libgit_c_args += '-DHAVE_GETRANDOM'
+elif compiler.has_function('getentropy', prefix: '#include <unistd.h>')
+ libgit_c_args += '-DHAVE_GETENTROPY'
+elif compiler.has_function('RtlGenRandom', prefix: '#include <windows.h>\n#include <ntsecapi.h>')
+ libgit_c_args += '-DHAVE_RTLGENRANDOM'
+elif openssl.found()
+ libgit_c_args += '-DHAVE_OPENSSL_CSPRNG'
+endif
+
+if get_option('runtime_prefix')
+ libgit_c_args += '-DRUNTIME_PREFIX'
+ build_options_config.set('RUNTIME_PREFIX', 'true')
+
+ if compiler.has_header('mach-o/dyld.h')
+ libgit_c_args += '-DHAVE_NS_GET_EXECUTABLE_PATH'
+ endif
+
+ if has_bsd_sysctl and compiler.compiles('''
+ #include <sys/sysctl.h>
+
+ void func(void)
+ {
+ KERN_PROC_PATHNAME; KERN_PROC;
+ }
+ ''', name: 'BSD KERN_PROC_PATHNAME')
+ libgit_c_args += '-DHAVE_NS_GET_EXECUTABLE_PATH'
+ endif
+
+ if host_machine.system() == 'linux'
+ libgit_c_args += '-DPROCFS_EXECUTABLE_PATH="/proc/self/exe' + '"'
+ elif host_machine.system() == 'openbsd'
+ libgit_c_args += '-DPROCFS_EXECUTABLE_PATH="' + '/proc/curproc/file' + '"'
+ elif host_machine.system() == 'netbsd'
+ libgit_c_args += '-DPROCFS_EXECUTABLE_PATH="' + '/proc/curproc/exe' + '"'
+ endif
+
+ if host_machine.system() == 'windows' and compiler.compiles('''
+ #include <stdlib.h>
+
+ void func(void)
+ {
+ _wpgmptr;
+ }
+ ''', name: 'Win32 _wpgmptr')
+ libgit_c_args += '-DHAVE_WPGMPTR'
+ endif
+else
+ build_options_config.set('RUNTIME_PREFIX', 'false')
+endif
+
+foreach key, value : {
+ 'DIFF': diff.full_path(),
+ 'GIT_TEST_CMP': diff.full_path() + ' -u',
+ 'GIT_TEST_GITPERLLIB': meson.project_build_root() / 'perl',
+ 'GIT_TEST_MERGE_TOOLS_DIR': meson.project_source_root() / 'mergetools',
+ 'GIT_TEST_POPATH': meson.project_source_root() / 'po',
+ 'GIT_TEST_TEMPLATE_DIR': meson.project_build_root() / 'templates',
+ 'GIT_TEST_TEXTDOMAINDIR': meson.project_build_root() / 'po',
+ 'PAGER_ENV': get_option('pager_environment'),
+ 'PERL_PATH': perl.found() ? perl.full_path() : '',
+ 'PYTHON_PATH': python.found () ? python.full_path() : '',
+ 'SHELL_PATH': shell.full_path(),
+ 'TAR': tar.full_path(),
+ 'TEST_OUTPUT_DIRECTORY': test_output_directory,
+ 'TEST_SHELL_PATH': shell.full_path(),
+}
+ if value != '' and cygpath.found()
+ value = run_command(cygpath, value, check: true).stdout().strip()
+ endif
+ build_options_config.set_quoted(key, value)
+endforeach
+
+configure_file(
+ input: 'GIT-BUILD-OPTIONS.in',
+ output: 'GIT-BUILD-OPTIONS',
+ configuration: build_options_config,
+)
+
+git_version_file = custom_target(
+ command: [
+ shell,
+ meson.current_source_dir() / 'GIT-VERSION-GEN',
+ meson.current_source_dir(),
+ '@INPUT@',
+ '@OUTPUT@',
+ ],
+ input: meson.current_source_dir() / 'GIT-VERSION-FILE.in',
+ output: 'GIT-VERSION-FILE',
+ build_always_stale: true,
+)
+
+version_def_h = custom_target(
+ command: [
+ shell,
+ meson.current_source_dir() / 'GIT-VERSION-GEN',
+ meson.current_source_dir(),
+ '@INPUT@',
+ '@OUTPUT@',
+ ],
+ input: meson.current_source_dir() / 'version-def.h.in',
+ output: 'version-def.h',
+ # Depend on GIT-VERSION-FILE so that we don't always try to rebuild this
+ # target for the same commit.
+ depends: [git_version_file],
+)
+
+# Build a separate library for "version.c" so that we do not have to rebuild
+# everything when the current Git commit changes.
+libgit_version_library = static_library('git-version',
+ sources: [
+ 'version.c',
+ version_def_h,
+ ],
+ c_args: libgit_c_args,
+ dependencies: libgit_dependencies,
+ include_directories: libgit_include_directories,
+)
+
+libgit_library = static_library('git',
+ sources: libgit_sources,
+ c_args: libgit_c_args,
+ link_with: libgit_version_library,
+ dependencies: libgit_dependencies,
+ include_directories: libgit_include_directories,
+)
+
+libgit = declare_dependency(
+ compile_args: libgit_c_args,
+ link_with: libgit_library,
+ dependencies: libgit_dependencies,
+ include_directories: libgit_include_directories,
+)
+
+common_main_sources = ['common-main.c']
+common_main_link_args = [ ]
+if host_machine.system() == 'windows'
+ git_rc = custom_target(
+ command: [
+ shell,
+ meson.current_source_dir() / 'GIT-VERSION-GEN',
+ meson.current_source_dir(),
+ '@INPUT@',
+ '@OUTPUT@',
+ ],
+ input: meson.current_source_dir() / 'git.rc.in',
+ output: 'git.rc',
+ depends: [git_version_file],
+ )
+
+ common_main_sources += import('windows').compile_resources(git_rc,
+ include_directories: [meson.current_source_dir()],
+ )
+ if compiler.get_argument_syntax() == 'gcc'
+ common_main_link_args += [
+ '-municode',
+ '-Wl,-nxcompat',
+ '-Wl,-dynamicbase',
+ '-Wl,-pic-executable,-e,mainCRTStartup',
+ ]
+ elif compiler.get_argument_syntax() == 'msvc'
+ common_main_link_args += [
+ '/ENTRY:wmainCRTStartup',
+ 'invalidcontinue.obj',
+ ]
+ else
+ error('Unsupported compiler ' + compiler.get_id())
+ endif
+endif
+common_main_library = static_library('common-main',
+ 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,
+ link_args: common_main_link_args,
+)
+
+bin_wrappers = [ ]
+test_dependencies = [ ]
+
+git = executable('git',
+ sources: builtin_sources + 'git.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+bin_wrappers += git
+
+test_dependencies += executable('git-daemon',
+ sources: 'daemon.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+test_dependencies += executable('git-sh-i18n--envsubst',
+ sources: 'sh-i18n--envsubst.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+bin_wrappers += executable('git-shell',
+ sources: 'shell.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+test_dependencies += executable('git-http-backend',
+ sources: 'http-backend.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+bin_wrappers += executable('scalar',
+ sources: 'scalar.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+if get_option('curl').enabled()
+ curl_sources = [
+ 'http.c',
+ 'http-walker.c',
+ ]
+
+ git_remote_http = executable('git-remote-http',
+ sources: curl_sources + 'remote-curl.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+ test_dependencies += git_remote_http
+
+ test_dependencies += executable('git-http-fetch',
+ sources: curl_sources + 'http-fetch.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+
+ if expat.found()
+ test_dependencies += executable('git-http-push',
+ sources: curl_sources + 'http-push.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+ endif
+
+ 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, common_main],
+ )
+
+ install_symlink(alias + executable_suffix,
+ install_dir: get_option('libexecdir') / 'git-core',
+ pointing_to: 'git-remote-http',
+ )
+ endforeach
+endif
+
+imap_send_sources = ['imap-send.c']
+if use_curl_for_imap_send
+ imap_send_sources += curl_sources
+endif
+
+test_dependencies += executable('git-imap-send',
+ sources: imap_send_sources,
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+foreach alias : [ 'git-receive-pack', 'git-upload-archive', 'git-upload-pack' ]
+ bin_wrappers += executable(alias,
+ objects: git.extract_all_objects(recursive: false),
+ dependencies: [libgit, common_main],
+ )
+
+ install_symlink(alias + executable_suffix,
+ install_dir: get_option('libexecdir') / 'git-core',
+ pointing_to: 'git-remote-http',
+ )
+endforeach
+
+foreach symlink : [
+ 'git',
+ 'git-receive-pack',
+ 'git-shell',
+ 'git-upload-archive',
+ 'git-upload-pack',
+ 'scalar',
+]
+ install_symlink(symlink,
+ install_dir: get_option('bindir'),
+ pointing_to: fs.relative_to(get_option('libexecdir') / 'git-core' / symlink, get_option('bindir')),
+ )
+endforeach
+
+scripts_sh = [
+ 'git-difftool--helper.sh',
+ 'git-filter-branch.sh',
+ 'git-merge-octopus.sh',
+ 'git-merge-one-file.sh',
+ 'git-merge-resolve.sh',
+ 'git-mergetool--lib.sh',
+ 'git-mergetool.sh',
+ 'git-quiltimport.sh',
+ 'git-request-pull.sh',
+ 'git-sh-i18n.sh',
+ 'git-sh-setup.sh',
+ 'git-submodule.sh',
+ 'git-web--browse.sh',
+]
+if perl_features_enabled
+ scripts_sh += 'git-instaweb.sh'
+endif
+
+foreach script : scripts_sh
+ test_dependencies += custom_target(
+ input: script,
+ output: fs.stem(script),
+ command: [
+ shell,
+ meson.project_source_root() / 'generate-script.sh',
+ '@INPUT@',
+ '@OUTPUT@',
+ meson.project_build_root() / 'GIT-BUILD-OPTIONS',
+ ],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+endforeach
+
+if perl_features_enabled
+ scripts_perl = [
+ 'git-archimport.perl',
+ 'git-cvsexportcommit.perl',
+ 'git-cvsimport.perl',
+ 'git-cvsserver.perl',
+ 'git-send-email.perl',
+ 'git-svn.perl',
+ ]
+
+ pathsep = ':'
+ if host_machine.system() == 'windows'
+ pathsep = ';'
+ endif
+
+ perl_header_template = 'perl/header_templates/fixed_prefix.template.pl'
+ if get_option('runtime_prefix')
+ perl_header_template = 'perl/header_templates/runtime_prefix.template.pl'
+ endif
+
+ perl_header = configure_file(
+ input: perl_header_template,
+ output: 'GIT-PERL-HEADER',
+ configuration: {
+ 'GITEXECDIR_REL': get_option('libexecdir') / 'git-core',
+ 'PERLLIBDIR_REL': get_option('datadir') / 'perl5',
+ 'LOCALEDIR_REL': get_option('datadir') / 'locale',
+ 'INSTLIBDIR': get_option('datadir') / 'perl5',
+ 'PATHSEP': pathsep,
+ },
+ )
+
+ generate_perl_command = [
+ shell,
+ meson.project_source_root() / 'generate-perl.sh',
+ meson.project_build_root() / 'GIT-BUILD-OPTIONS',
+ git_version_file.full_path(),
+ perl_header,
+ '@INPUT@',
+ '@OUTPUT@',
+ ]
+
+ foreach script : scripts_perl
+ generated_script = custom_target(
+ input: script,
+ output: fs.stem(script),
+ command: generate_perl_command,
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ depends: [git_version_file],
+ )
+ test_dependencies += generated_script
+
+ if script == 'git-cvsserver.perl'
+ bin_wrappers += generated_script
+
+ install_symlink(fs.stem(script),
+ install_dir: get_option('bindir'),
+ pointing_to: fs.relative_to(get_option('libexecdir') / 'git-core' / fs.stem(script), get_option('bindir')),
+ )
+ endif
+ endforeach
+
+ subdir('perl')
+endif
+
+if python.found()
+ scripts_python = [
+ 'git-p4.py'
+ ]
+
+ foreach script : scripts_python
+ fs.copyfile(script, fs.stem(script),
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+ endforeach
+endif
+
+mergetools = [
+ 'mergetools/araxis',
+ 'mergetools/bc',
+ 'mergetools/codecompare',
+ 'mergetools/deltawalker',
+ 'mergetools/diffmerge',
+ 'mergetools/diffuse',
+ 'mergetools/ecmerge',
+ 'mergetools/emerge',
+ 'mergetools/examdiff',
+ 'mergetools/guiffy',
+ 'mergetools/gvimdiff',
+ 'mergetools/kdiff3',
+ 'mergetools/kompare',
+ 'mergetools/meld',
+ 'mergetools/nvimdiff',
+ 'mergetools/opendiff',
+ 'mergetools/p4merge',
+ 'mergetools/smerge',
+ 'mergetools/tkdiff',
+ 'mergetools/tortoisemerge',
+ 'mergetools/vimdiff',
+ 'mergetools/vscode',
+ 'mergetools/winmerge',
+ 'mergetools/xxdiff',
+]
+
+foreach mergetool : mergetools
+ install_data(mergetool, install_dir: get_option('libexecdir') / 'git-core' / 'mergetools')
+endforeach
+
+if intl.found()
+ subdir('po')
+endif
+subdir('contrib')
+subdir('gitweb')
+subdir('templates')
+
+# Everything but the bin-wrappers need to come before this target such that we
+# can properly set up test dependencies. The bin-wrappers themselves are set up
+# at configuration time, so these are fine.
+if get_option('tests')
+ subdir('t')
+endif
+
+subdir('bin-wrappers')
+if get_option('docs') != []
+ subdir('Documentation')
+endif
+
+summary({
+ 'curl': curl.found(),
+ 'expat': expat.found(),
+ 'gettext': intl.found(),
+ 'https': https_backend,
+ 'iconv': iconv.found(),
+ 'pcre2': pcre2.found(),
+ 'perl': perl_features_enabled,
+ 'python': python.found(),
+}, section: 'Auto-detected features')
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000000000000000000000000000000000000..32a72139bae870745d9131cc9086a4594826be91
--- /dev/null
+++ b/meson_options.txt
@@ -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')
diff --git a/perl/FromCPAN/Mail/meson.build b/perl/FromCPAN/Mail/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..129cff161c585645c111af0386bafe136258e3db
--- /dev/null
+++ b/perl/FromCPAN/Mail/meson.build
@@ -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',
+)
diff --git a/perl/FromCPAN/meson.build b/perl/FromCPAN/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..4e7ea909df3593fb65facb4bf6a1c42e954d6f70
--- /dev/null
+++ b/perl/FromCPAN/meson.build
@@ -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')
diff --git a/perl/Git/LoadCPAN/Mail/meson.build b/perl/Git/LoadCPAN/Mail/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..7da5b37adb278b4e13f41ea5ebc762bb4d78b64b
--- /dev/null
+++ b/perl/Git/LoadCPAN/Mail/meson.build
@@ -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',
+)
diff --git a/perl/Git/LoadCPAN/meson.build b/perl/Git/LoadCPAN/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..9468c073aeb5ae1980f88b4c7f2c7fe69355ea37
--- /dev/null
+++ b/perl/Git/LoadCPAN/meson.build
@@ -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')
diff --git a/perl/Git/SVN/Memoize/meson.build b/perl/Git/SVN/Memoize/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..515ab3dd926618f6c46b030e1f283d637fdddedf
--- /dev/null
+++ b/perl/Git/SVN/Memoize/meson.build
@@ -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',
+)
diff --git a/perl/Git/SVN/meson.build b/perl/Git/SVN/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..8338531041d8e5cd4e8c2c8a0c3dcfc8b2d23cc9
--- /dev/null
+++ b/perl/Git/SVN/meson.build
@@ -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')
diff --git a/perl/Git/meson.build b/perl/Git/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..259209d7302809b6c1d3249d9d21548515c31c77
--- /dev/null
+++ b/perl/Git/meson.build
@@ -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')
diff --git a/perl/meson.build b/perl/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..c22d6f8a1a3266ded27c43c43c88620f9b4badcf
--- /dev/null
+++ b/perl/meson.build
@@ -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
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..d7154b6395b2bf4a27110aad65aa1f51f979a1e9
--- /dev/null
+++ b/po/meson.build
@@ -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]
diff --git a/subprojects/.gitignore b/subprojects/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..63ea916ef5f30255aef0c0b0b63f37b0e1d99fb2
--- /dev/null
+++ b/subprojects/.gitignore
@@ -0,0 +1 @@
+/*/
diff --git a/subprojects/curl.wrap b/subprojects/curl.wrap
new file mode 100644
index 0000000000000000000000000000000000000000..f7e384b85cf5ee98672e4409e1d30f8f6f0e5735
--- /dev/null
+++ b/subprojects/curl.wrap
@@ -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
diff --git a/subprojects/expat.wrap b/subprojects/expat.wrap
new file mode 100644
index 0000000000000000000000000000000000000000..2e0427dcfd144c22d8c0bfd333e3cf31f14855a7
--- /dev/null
+++ b/subprojects/expat.wrap
@@ -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
diff --git a/subprojects/openssl.wrap b/subprojects/openssl.wrap
new file mode 100644
index 0000000000000000000000000000000000000000..873d55106e9b83c487a88dfbb85eaf73429464d7
--- /dev/null
+++ b/subprojects/openssl.wrap
@@ -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
diff --git a/subprojects/pcre2.wrap b/subprojects/pcre2.wrap
new file mode 100644
index 0000000000000000000000000000000000000000..7e184472543bde1572b9e780ae29318fe01e72bc
--- /dev/null
+++ b/subprojects/pcre2.wrap
@@ -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
diff --git a/subprojects/zlib.wrap b/subprojects/zlib.wrap
new file mode 100644
index 0000000000000000000000000000000000000000..aa14de17740728cecdb7431fb101e55e9b022273
--- /dev/null
+++ b/subprojects/zlib.wrap
@@ -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
diff --git a/t/helper/meson.build b/t/helper/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..5e83884246edc7841738de5085f3255aa1fa3fbe
--- /dev/null
+++ b/t/helper/meson.build
@@ -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
diff --git a/t/meson.build b/t/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..9ec0b7fa34a033d508448dbd56ab2322a5106fd0
--- /dev/null
+++ b/t/meson.build
@@ -0,0 +1,1106 @@
+clar_test_suites = [
+ 'unit-tests/ctype.c',
+ 'unit-tests/strvec.c',
+]
+
+clar_sources = [
+ 'unit-tests/clar/clar.c',
+ 'unit-tests/unit-test.c',
+]
+
+clar_decls_h = custom_target(
+ input: clar_test_suites,
+ output: 'clar-decls.h',
+ command : [shell, meson.current_source_dir() + '/unit-tests/generate-clar-decls.sh', '@OUTPUT@', '@INPUT@'],
+ env: script_environment,
+)
+clar_sources += clar_decls_h
+
+clar_sources += custom_target(
+ input: clar_decls_h,
+ output: 'clar.suite',
+ feed: true,
+ capture: true,
+ command : [awk, '-f', meson.current_source_dir() + '/unit-tests/clar-generate.awk'],
+)
+
+clar_unit_tests = executable('unit-tests',
+ sources: clar_sources + clar_test_suites,
+ dependencies: [libgit, common_main],
+)
+test('unit-tests', clar_unit_tests)
+
+unit_test_programs = [
+ 'unit-tests/t-example-decorate.c',
+ 'unit-tests/t-hash.c',
+ 'unit-tests/t-hashmap.c',
+ 'unit-tests/t-mem-pool.c',
+ 'unit-tests/t-oid-array.c',
+ 'unit-tests/t-oidmap.c',
+ 'unit-tests/t-oidtree.c',
+ 'unit-tests/t-prio-queue.c',
+ 'unit-tests/t-reftable-basics.c',
+ 'unit-tests/t-reftable-block.c',
+ 'unit-tests/t-reftable-merged.c',
+ 'unit-tests/t-reftable-pq.c',
+ 'unit-tests/t-reftable-reader.c',
+ 'unit-tests/t-reftable-readwrite.c',
+ 'unit-tests/t-reftable-record.c',
+ 'unit-tests/t-reftable-stack.c',
+ 'unit-tests/t-reftable-tree.c',
+ 'unit-tests/t-strbuf.c',
+ 'unit-tests/t-strcmp-offset.c',
+ 'unit-tests/t-trailer.c',
+ 'unit-tests/t-urlmatch-normalization.c',
+]
+
+foreach unit_test_program : unit_test_programs
+ unit_test_name = fs.stem(unit_test_program)
+ unit_test = executable(unit_test_name,
+ sources: [
+ 'unit-tests/test-lib.c',
+ 'unit-tests/lib-oid.c',
+ 'unit-tests/lib-reftable.c',
+ unit_test_program,
+ ],
+ dependencies: [libgit, common_main],
+ )
+ test(unit_test_name, unit_test,
+ workdir: meson.current_source_dir(),
+ timeout: 0,
+ )
+endforeach
+
+subdir('helper')
+
+integration_tests = [
+ 't0000-basic.sh',
+ 't0001-init.sh',
+ 't0002-gitfile.sh',
+ 't0003-attributes.sh',
+ 't0004-unwritable.sh',
+ 't0005-signals.sh',
+ 't0006-date.sh',
+ 't0007-git-var.sh',
+ 't0008-ignores.sh',
+ 't0010-racy-git.sh',
+ 't0012-help.sh',
+ 't0013-sha1dc.sh',
+ 't0014-alias.sh',
+ 't0017-env-helper.sh',
+ 't0018-advice.sh',
+ 't0019-json-writer.sh',
+ 't0020-crlf.sh',
+ 't0021-conversion.sh',
+ 't0022-crlf-rename.sh',
+ 't0023-crlf-am.sh',
+ 't0024-crlf-archive.sh',
+ 't0025-crlf-renormalize.sh',
+ 't0026-eol-config.sh',
+ 't0027-auto-crlf.sh',
+ 't0028-working-tree-encoding.sh',
+ 't0029-core-unsetenvvars.sh',
+ 't0030-stripspace.sh',
+ 't0033-safe-directory.sh',
+ 't0034-root-safe-directory.sh',
+ 't0035-safe-bare-repository.sh',
+ 't0040-parse-options.sh',
+ 't0041-usage.sh',
+ 't0050-filesystem.sh',
+ 't0051-windows-named-pipe.sh',
+ 't0052-simple-ipc.sh',
+ 't0055-beyond-symlinks.sh',
+ 't0056-git-C.sh',
+ 't0060-path-utils.sh',
+ 't0061-run-command.sh',
+ 't0062-revision-walking.sh',
+ 't0063-string-list.sh',
+ 't0066-dir-iterator.sh',
+ 't0067-parse_pathspec_file.sh',
+ 't0068-for-each-repo.sh',
+ 't0070-fundamental.sh',
+ 't0071-sort.sh',
+ 't0080-unit-test-output.sh',
+ 't0081-find-pack.sh',
+ 't0090-cache-tree.sh',
+ 't0091-bugreport.sh',
+ 't0092-diagnose.sh',
+ 't0095-bloom.sh',
+ 't0100-previous.sh',
+ 't0101-at-syntax.sh',
+ 't0200-gettext-basic.sh',
+ 't0201-gettext-fallbacks.sh',
+ 't0202-gettext-perl.sh',
+ 't0203-gettext-setlocale-sanity.sh',
+ 't0204-gettext-reencode-sanity.sh',
+ 't0210-trace2-normal.sh',
+ 't0211-trace2-perf.sh',
+ 't0212-trace2-event.sh',
+ 't0300-credentials.sh',
+ 't0301-credential-cache.sh',
+ 't0302-credential-store.sh',
+ 't0303-credential-external.sh',
+ 't0410-partial-clone.sh',
+ 't0411-clone-from-partial.sh',
+ 't0450-txt-doc-vs-help.sh',
+ 't0500-progress-display.sh',
+ 't0600-reffiles-backend.sh',
+ 't0601-reffiles-pack-refs.sh',
+ 't0602-reffiles-fsck.sh',
+ 't0610-reftable-basics.sh',
+ 't0611-reftable-httpd.sh',
+ 't0612-reftable-jgit-compatibility.sh',
+ 't0613-reftable-write-options.sh',
+ 't1000-read-tree-m-3way.sh',
+ 't1001-read-tree-m-2way.sh',
+ 't1002-read-tree-m-u-2way.sh',
+ 't1003-read-tree-prefix.sh',
+ 't1004-read-tree-m-u-wf.sh',
+ 't1005-read-tree-reset.sh',
+ 't1006-cat-file.sh',
+ 't1007-hash-object.sh',
+ 't1008-read-tree-overlay.sh',
+ 't1009-read-tree-new-index.sh',
+ 't1010-mktree.sh',
+ 't1011-read-tree-sparse-checkout.sh',
+ 't1012-read-tree-df.sh',
+ 't1013-read-tree-submodule.sh',
+ 't1014-read-tree-confusing.sh',
+ 't1015-read-index-unmerged.sh',
+ 't1016-compatObjectFormat.sh',
+ 't1020-subdirectory.sh',
+ 't1021-rerere-in-workdir.sh',
+ 't1022-read-tree-partial-clone.sh',
+ 't1050-large.sh',
+ 't1051-large-conversion.sh',
+ 't1060-object-corruption.sh',
+ 't1090-sparse-checkout-scope.sh',
+ 't1091-sparse-checkout-builtin.sh',
+ 't1092-sparse-checkout-compatibility.sh',
+ 't1100-commit-tree-options.sh',
+ 't1300-config.sh',
+ 't1301-shared-repo.sh',
+ 't1302-repo-version.sh',
+ 't1303-wacky-config.sh',
+ 't1304-default-acl.sh',
+ 't1305-config-include.sh',
+ 't1306-xdg-files.sh',
+ 't1307-config-blob.sh',
+ 't1308-config-set.sh',
+ 't1309-early-config.sh',
+ 't1310-config-default.sh',
+ 't1350-config-hooks-path.sh',
+ 't1400-update-ref.sh',
+ 't1401-symbolic-ref.sh',
+ 't1402-check-ref-format.sh',
+ 't1403-show-ref.sh',
+ 't1404-update-ref-errors.sh',
+ 't1405-main-ref-store.sh',
+ 't1406-submodule-ref-store.sh',
+ 't1407-worktree-ref-store.sh',
+ 't1408-packed-refs.sh',
+ 't1409-avoid-packing-refs.sh',
+ 't1410-reflog.sh',
+ 't1411-reflog-show.sh',
+ 't1412-reflog-loop.sh',
+ 't1413-reflog-detach.sh',
+ 't1414-reflog-walk.sh',
+ 't1415-worktree-refs.sh',
+ 't1416-ref-transaction-hooks.sh',
+ 't1417-reflog-updateref.sh',
+ 't1418-reflog-exists.sh',
+ 't1419-exclude-refs.sh',
+ 't1420-lost-found.sh',
+ 't1430-bad-ref-name.sh',
+ 't1450-fsck.sh',
+ 't1451-fsck-buffer.sh',
+ 't1460-refs-migrate.sh',
+ 't1500-rev-parse.sh',
+ 't1501-work-tree.sh',
+ 't1502-rev-parse-parseopt.sh',
+ 't1503-rev-parse-verify.sh',
+ 't1504-ceiling-dirs.sh',
+ 't1505-rev-parse-last.sh',
+ 't1506-rev-parse-diagnosis.sh',
+ 't1507-rev-parse-upstream.sh',
+ 't1508-at-combinations.sh',
+ 't1509-root-work-tree.sh',
+ 't1510-repo-setup.sh',
+ 't1511-rev-parse-caret.sh',
+ 't1512-rev-parse-disambiguation.sh',
+ 't1513-rev-parse-prefix.sh',
+ 't1514-rev-parse-push.sh',
+ 't1515-rev-parse-outside-repo.sh',
+ 't1517-outside-repo.sh',
+ 't1600-index.sh',
+ 't1601-index-bogus.sh',
+ 't1700-split-index.sh',
+ 't1701-racy-split-index.sh',
+ 't1800-hook.sh',
+ 't2000-conflict-when-checking-files-out.sh',
+ 't2002-checkout-cache-u.sh',
+ 't2003-checkout-cache-mkdir.sh',
+ 't2004-checkout-cache-temp.sh',
+ 't2005-checkout-index-symlinks.sh',
+ 't2006-checkout-index-basic.sh',
+ 't2007-checkout-symlink.sh',
+ 't2008-checkout-subdir.sh',
+ 't2009-checkout-statinfo.sh',
+ 't2010-checkout-ambiguous.sh',
+ 't2011-checkout-invalid-head.sh',
+ 't2012-checkout-last.sh',
+ 't2013-checkout-submodule.sh',
+ 't2014-checkout-switch.sh',
+ 't2015-checkout-unborn.sh',
+ 't2016-checkout-patch.sh',
+ 't2017-checkout-orphan.sh',
+ 't2018-checkout-branch.sh',
+ 't2019-checkout-ambiguous-ref.sh',
+ 't2020-checkout-detach.sh',
+ 't2021-checkout-overwrite.sh',
+ 't2022-checkout-paths.sh',
+ 't2023-checkout-m.sh',
+ 't2024-checkout-dwim.sh',
+ 't2025-checkout-no-overlay.sh',
+ 't2026-checkout-pathspec-file.sh',
+ 't2027-checkout-track.sh',
+ 't2030-unresolve-info.sh',
+ 't2050-git-dir-relative.sh',
+ 't2060-switch.sh',
+ 't2070-restore.sh',
+ 't2071-restore-patch.sh',
+ 't2072-restore-pathspec-file.sh',
+ 't2080-parallel-checkout-basics.sh',
+ 't2081-parallel-checkout-collisions.sh',
+ 't2082-parallel-checkout-attributes.sh',
+ 't2100-update-cache-badpath.sh',
+ 't2101-update-index-reupdate.sh',
+ 't2102-update-index-symlinks.sh',
+ 't2103-update-index-ignore-missing.sh',
+ 't2104-update-index-skip-worktree.sh',
+ 't2105-update-index-gitfile.sh',
+ 't2106-update-index-assume-unchanged.sh',
+ 't2107-update-index-basic.sh',
+ 't2108-update-index-refresh-racy.sh',
+ 't2200-add-update.sh',
+ 't2201-add-update-typechange.sh',
+ 't2202-add-addremove.sh',
+ 't2203-add-intent.sh',
+ 't2204-add-ignored.sh',
+ 't2205-add-worktree-config.sh',
+ 't2300-cd-to-toplevel.sh',
+ 't2400-worktree-add.sh',
+ 't2401-worktree-prune.sh',
+ 't2402-worktree-list.sh',
+ 't2403-worktree-move.sh',
+ 't2404-worktree-config.sh',
+ 't2405-worktree-submodule.sh',
+ 't2406-worktree-repair.sh',
+ 't2407-worktree-heads.sh',
+ 't2408-worktree-relative.sh',
+ 't2500-untracked-overwriting.sh',
+ 't2501-cwd-empty.sh',
+ 't3000-ls-files-others.sh',
+ 't3001-ls-files-others-exclude.sh',
+ 't3002-ls-files-dashpath.sh',
+ 't3003-ls-files-exclude.sh',
+ 't3004-ls-files-basic.sh',
+ 't3005-ls-files-relative.sh',
+ 't3006-ls-files-long.sh',
+ 't3007-ls-files-recurse-submodules.sh',
+ 't3008-ls-files-lazy-init-name-hash.sh',
+ 't3009-ls-files-others-nonsubmodule.sh',
+ 't3010-ls-files-killed-modified.sh',
+ 't3011-common-prefixes-and-directory-traversal.sh',
+ 't3012-ls-files-dedup.sh',
+ 't3013-ls-files-format.sh',
+ 't3020-ls-files-error-unmatch.sh',
+ 't3040-subprojects-basic.sh',
+ 't3050-subprojects-fetch.sh',
+ 't3060-ls-files-with-tree.sh',
+ 't3070-wildmatch.sh',
+ 't3100-ls-tree-restrict.sh',
+ 't3101-ls-tree-dirname.sh',
+ 't3102-ls-tree-wildcards.sh',
+ 't3103-ls-tree-misc.sh',
+ 't3104-ls-tree-format.sh',
+ 't3105-ls-tree-output.sh',
+ 't3200-branch.sh',
+ 't3201-branch-contains.sh',
+ 't3202-show-branch.sh',
+ 't3203-branch-output.sh',
+ 't3204-branch-name-interpretation.sh',
+ 't3205-branch-color.sh',
+ 't3206-range-diff.sh',
+ 't3207-branch-submodule.sh',
+ 't3211-peel-ref.sh',
+ 't3300-funny-names.sh',
+ 't3301-notes.sh',
+ 't3302-notes-index-expensive.sh',
+ 't3303-notes-subtrees.sh',
+ 't3304-notes-mixed.sh',
+ 't3305-notes-fanout.sh',
+ 't3306-notes-prune.sh',
+ 't3307-notes-man.sh',
+ 't3308-notes-merge.sh',
+ 't3309-notes-merge-auto-resolve.sh',
+ 't3310-notes-merge-manual-resolve.sh',
+ 't3311-notes-merge-fanout.sh',
+ 't3320-notes-merge-worktrees.sh',
+ 't3321-notes-stripspace.sh',
+ 't3400-rebase.sh',
+ 't3401-rebase-and-am-rename.sh',
+ 't3402-rebase-merge.sh',
+ 't3403-rebase-skip.sh',
+ 't3404-rebase-interactive.sh',
+ 't3405-rebase-malformed.sh',
+ 't3406-rebase-message.sh',
+ 't3407-rebase-abort.sh',
+ 't3408-rebase-multi-line.sh',
+ 't3409-rebase-environ.sh',
+ 't3412-rebase-root.sh',
+ 't3413-rebase-hook.sh',
+ 't3415-rebase-autosquash.sh',
+ 't3416-rebase-onto-threedots.sh',
+ 't3417-rebase-whitespace-fix.sh',
+ 't3418-rebase-continue.sh',
+ 't3419-rebase-patch-id.sh',
+ 't3420-rebase-autostash.sh',
+ 't3421-rebase-topology-linear.sh',
+ 't3422-rebase-incompatible-options.sh',
+ 't3423-rebase-reword.sh',
+ 't3424-rebase-empty.sh',
+ 't3425-rebase-topology-merges.sh',
+ 't3426-rebase-submodule.sh',
+ 't3427-rebase-subtree.sh',
+ 't3428-rebase-signoff.sh',
+ 't3429-rebase-edit-todo.sh',
+ 't3430-rebase-merges.sh',
+ 't3431-rebase-fork-point.sh',
+ 't3432-rebase-fast-forward.sh',
+ 't3433-rebase-across-mode-change.sh',
+ 't3434-rebase-i18n.sh',
+ 't3435-rebase-gpg-sign.sh',
+ 't3436-rebase-more-options.sh',
+ 't3437-rebase-fixup-options.sh',
+ 't3438-rebase-broken-files.sh',
+ 't3500-cherry.sh',
+ 't3501-revert-cherry-pick.sh',
+ 't3502-cherry-pick-merge.sh',
+ 't3503-cherry-pick-root.sh',
+ 't3504-cherry-pick-rerere.sh',
+ 't3505-cherry-pick-empty.sh',
+ 't3506-cherry-pick-ff.sh',
+ 't3507-cherry-pick-conflict.sh',
+ 't3508-cherry-pick-many-commits.sh',
+ 't3509-cherry-pick-merge-df.sh',
+ 't3510-cherry-pick-sequence.sh',
+ 't3511-cherry-pick-x.sh',
+ 't3512-cherry-pick-submodule.sh',
+ 't3513-revert-submodule.sh',
+ 't3514-cherry-pick-revert-gpg.sh',
+ 't3600-rm.sh',
+ 't3601-rm-pathspec-file.sh',
+ 't3602-rm-sparse-checkout.sh',
+ 't3650-replay-basics.sh',
+ 't3700-add.sh',
+ 't3701-add-interactive.sh',
+ 't3702-add-edit.sh',
+ 't3703-add-magic-pathspec.sh',
+ 't3704-add-pathspec-file.sh',
+ 't3705-add-sparse-checkout.sh',
+ 't3800-mktag.sh',
+ 't3900-i18n-commit.sh',
+ 't3901-i18n-patch.sh',
+ 't3902-quoted.sh',
+ 't3903-stash.sh',
+ 't3904-stash-patch.sh',
+ 't3905-stash-include-untracked.sh',
+ 't3906-stash-submodule.sh',
+ 't3907-stash-show-config.sh',
+ 't3908-stash-in-worktree.sh',
+ 't3909-stash-pathspec-file.sh',
+ 't3910-mac-os-precompose.sh',
+ 't3920-crlf-messages.sh',
+ 't4000-diff-format.sh',
+ 't4001-diff-rename.sh',
+ 't4002-diff-basic.sh',
+ 't4003-diff-rename-1.sh',
+ 't4004-diff-rename-symlink.sh',
+ 't4005-diff-rename-2.sh',
+ 't4006-diff-mode.sh',
+ 't4007-rename-3.sh',
+ 't4008-diff-break-rewrite.sh',
+ 't4009-diff-rename-4.sh',
+ 't4010-diff-pathspec.sh',
+ 't4011-diff-symlink.sh',
+ 't4012-diff-binary.sh',
+ 't4013-diff-various.sh',
+ 't4014-format-patch.sh',
+ 't4015-diff-whitespace.sh',
+ 't4016-diff-quote.sh',
+ 't4017-diff-retval.sh',
+ 't4018-diff-funcname.sh',
+ 't4019-diff-wserror.sh',
+ 't4020-diff-external.sh',
+ 't4021-format-patch-numbered.sh',
+ 't4022-diff-rewrite.sh',
+ 't4023-diff-rename-typechange.sh',
+ 't4024-diff-optimize-common.sh',
+ 't4025-hunk-header.sh',
+ 't4026-color.sh',
+ 't4027-diff-submodule.sh',
+ 't4028-format-patch-mime-headers.sh',
+ 't4029-diff-trailing-space.sh',
+ 't4030-diff-textconv.sh',
+ 't4031-diff-rewrite-binary.sh',
+ 't4032-diff-inter-hunk-context.sh',
+ 't4033-diff-patience.sh',
+ 't4034-diff-words.sh',
+ 't4035-diff-quiet.sh',
+ 't4036-format-patch-signer-mime.sh',
+ 't4037-diff-r-t-dirs.sh',
+ 't4038-diff-combined.sh',
+ 't4039-diff-assume-unchanged.sh',
+ 't4040-whitespace-status.sh',
+ 't4041-diff-submodule-option.sh',
+ 't4042-diff-textconv-caching.sh',
+ 't4043-diff-rename-binary.sh',
+ 't4044-diff-index-unique-abbrev.sh',
+ 't4045-diff-relative.sh',
+ 't4046-diff-unmerged.sh',
+ 't4047-diff-dirstat.sh',
+ 't4048-diff-combined-binary.sh',
+ 't4049-diff-stat-count.sh',
+ 't4050-diff-histogram.sh',
+ 't4051-diff-function-context.sh',
+ 't4052-stat-output.sh',
+ 't4053-diff-no-index.sh',
+ 't4054-diff-bogus-tree.sh',
+ 't4055-diff-context.sh',
+ 't4056-diff-order.sh',
+ 't4057-diff-combined-paths.sh',
+ 't4058-diff-duplicates.sh',
+ 't4059-diff-submodule-not-initialized.sh',
+ 't4060-diff-submodule-option-diff-format.sh',
+ 't4061-diff-indent.sh',
+ 't4062-diff-pickaxe.sh',
+ 't4063-diff-blobs.sh',
+ 't4064-diff-oidfind.sh',
+ 't4065-diff-anchored.sh',
+ 't4066-diff-emit-delay.sh',
+ 't4067-diff-partial-clone.sh',
+ 't4068-diff-symmetric-merge-base.sh',
+ 't4069-remerge-diff.sh',
+ 't4100-apply-stat.sh',
+ 't4101-apply-nonl.sh',
+ 't4102-apply-rename.sh',
+ 't4103-apply-binary.sh',
+ 't4104-apply-boundary.sh',
+ 't4105-apply-fuzz.sh',
+ 't4106-apply-stdin.sh',
+ 't4107-apply-ignore-whitespace.sh',
+ 't4108-apply-threeway.sh',
+ 't4109-apply-multifrag.sh',
+ 't4110-apply-scan.sh',
+ 't4111-apply-subdir.sh',
+ 't4112-apply-renames.sh',
+ 't4113-apply-ending.sh',
+ 't4114-apply-typechange.sh',
+ 't4115-apply-symlink.sh',
+ 't4116-apply-reverse.sh',
+ 't4117-apply-reject.sh',
+ 't4118-apply-empty-context.sh',
+ 't4119-apply-config.sh',
+ 't4120-apply-popt.sh',
+ 't4121-apply-diffs.sh',
+ 't4122-apply-symlink-inside.sh',
+ 't4123-apply-shrink.sh',
+ 't4124-apply-ws-rule.sh',
+ 't4125-apply-ws-fuzz.sh',
+ 't4126-apply-empty.sh',
+ 't4127-apply-same-fn.sh',
+ 't4128-apply-root.sh',
+ 't4129-apply-samemode.sh',
+ 't4130-apply-criss-cross-rename.sh',
+ 't4131-apply-fake-ancestor.sh',
+ 't4132-apply-removal.sh',
+ 't4133-apply-filenames.sh',
+ 't4134-apply-submodule.sh',
+ 't4135-apply-weird-filenames.sh',
+ 't4136-apply-check.sh',
+ 't4137-apply-submodule.sh',
+ 't4138-apply-ws-expansion.sh',
+ 't4139-apply-escape.sh',
+ 't4140-apply-ita.sh',
+ 't4141-apply-too-large.sh',
+ 't4150-am.sh',
+ 't4151-am-abort.sh',
+ 't4152-am-subjects.sh',
+ 't4153-am-resume-override-opts.sh',
+ 't4200-rerere.sh',
+ 't4201-shortlog.sh',
+ 't4202-log.sh',
+ 't4203-mailmap.sh',
+ 't4204-patch-id.sh',
+ 't4205-log-pretty-formats.sh',
+ 't4206-log-follow-harder-copies.sh',
+ 't4207-log-decoration-colors.sh',
+ 't4208-log-magic-pathspec.sh',
+ 't4209-log-pickaxe.sh',
+ 't4210-log-i18n.sh',
+ 't4211-line-log.sh',
+ 't4212-log-corrupt.sh',
+ 't4213-log-tabexpand.sh',
+ 't4214-log-graph-octopus.sh',
+ 't4215-log-skewed-merges.sh',
+ 't4216-log-bloom.sh',
+ 't4217-log-limit.sh',
+ 't4252-am-options.sh',
+ 't4253-am-keep-cr-dos.sh',
+ 't4254-am-corrupt.sh',
+ 't4255-am-submodule.sh',
+ 't4256-am-format-flowed.sh',
+ 't4257-am-interactive.sh',
+ 't4258-am-quoted-cr.sh',
+ 't4300-merge-tree.sh',
+ 't4301-merge-tree-write-tree.sh',
+ 't5000-tar-tree.sh',
+ 't5001-archive-attr.sh',
+ 't5002-archive-attr-pattern.sh',
+ 't5003-archive-zip.sh',
+ 't5004-archive-corner-cases.sh',
+ 't5100-mailinfo.sh',
+ 't5150-request-pull.sh',
+ 't5200-update-server-info.sh',
+ 't5300-pack-object.sh',
+ 't5301-sliding-window.sh',
+ 't5302-pack-index.sh',
+ 't5303-pack-corruption-resilience.sh',
+ 't5304-prune.sh',
+ 't5305-include-tag.sh',
+ 't5306-pack-nobase.sh',
+ 't5307-pack-missing-commit.sh',
+ 't5308-pack-detect-duplicates.sh',
+ 't5309-pack-delta-cycles.sh',
+ 't5310-pack-bitmaps.sh',
+ 't5311-pack-bitmaps-shallow.sh',
+ 't5312-prune-corruption.sh',
+ 't5313-pack-bounds-checks.sh',
+ 't5314-pack-cycle-detection.sh',
+ 't5315-pack-objects-compression.sh',
+ 't5316-pack-delta-depth.sh',
+ 't5317-pack-objects-filter-objects.sh',
+ 't5318-commit-graph.sh',
+ 't5319-multi-pack-index.sh',
+ 't5320-delta-islands.sh',
+ 't5321-pack-large-objects.sh',
+ 't5322-pack-objects-sparse.sh',
+ 't5323-pack-redundant.sh',
+ 't5324-split-commit-graph.sh',
+ 't5325-reverse-index.sh',
+ 't5326-multi-pack-bitmaps.sh',
+ 't5327-multi-pack-bitmaps-rev.sh',
+ 't5328-commit-graph-64bit-time.sh',
+ 't5329-pack-objects-cruft.sh',
+ 't5330-no-lazy-fetch-with-commit-graph.sh',
+ 't5331-pack-objects-stdin.sh',
+ 't5332-multi-pack-reuse.sh',
+ 't5333-pseudo-merge-bitmaps.sh',
+ 't5334-incremental-multi-pack-index.sh',
+ 't5351-unpack-large-objects.sh',
+ 't5400-send-pack.sh',
+ 't5401-update-hooks.sh',
+ 't5402-post-merge-hook.sh',
+ 't5403-post-checkout-hook.sh',
+ 't5404-tracking-branches.sh',
+ 't5405-send-pack-rewind.sh',
+ 't5406-remote-rejects.sh',
+ 't5407-post-rewrite-hook.sh',
+ 't5408-send-pack-stdin.sh',
+ 't5409-colorize-remote-messages.sh',
+ 't5410-receive-pack-alternates.sh',
+ 't5411-proc-receive-hook.sh',
+ 't5500-fetch-pack.sh',
+ 't5501-fetch-push-alternates.sh',
+ 't5502-quickfetch.sh',
+ 't5503-tagfollow.sh',
+ 't5504-fetch-receive-strict.sh',
+ 't5505-remote.sh',
+ 't5506-remote-groups.sh',
+ 't5507-remote-environment.sh',
+ 't5509-fetch-push-namespaces.sh',
+ 't5510-fetch.sh',
+ 't5511-refspec.sh',
+ 't5512-ls-remote.sh',
+ 't5513-fetch-track.sh',
+ 't5514-fetch-multiple.sh',
+ 't5515-fetch-merge-logic.sh',
+ 't5516-fetch-push.sh',
+ 't5517-push-mirror.sh',
+ 't5518-fetch-exit-status.sh',
+ 't5519-push-alternates.sh',
+ 't5520-pull.sh',
+ 't5521-pull-options.sh',
+ 't5522-pull-symlink.sh',
+ 't5523-push-upstream.sh',
+ 't5524-pull-msg.sh',
+ 't5525-fetch-tagopt.sh',
+ 't5526-fetch-submodules.sh',
+ 't5527-fetch-odd-refs.sh',
+ 't5528-push-default.sh',
+ 't5529-push-errors.sh',
+ 't5530-upload-pack-error.sh',
+ 't5531-deep-submodule-push.sh',
+ 't5532-fetch-proxy.sh',
+ 't5533-push-cas.sh',
+ 't5534-push-signed.sh',
+ 't5535-fetch-push-symref.sh',
+ 't5536-fetch-conflicts.sh',
+ 't5537-fetch-shallow.sh',
+ 't5538-push-shallow.sh',
+ 't5539-fetch-http-shallow.sh',
+ 't5540-http-push-webdav.sh',
+ 't5541-http-push-smart.sh',
+ 't5542-push-http-shallow.sh',
+ 't5543-atomic-push.sh',
+ 't5544-pack-objects-hook.sh',
+ 't5545-push-options.sh',
+ 't5546-receive-limits.sh',
+ 't5547-push-quarantine.sh',
+ 't5548-push-porcelain.sh',
+ 't5549-fetch-push-http.sh',
+ 't5550-http-fetch-dumb.sh',
+ 't5551-http-fetch-smart.sh',
+ 't5552-skipping-fetch-negotiator.sh',
+ 't5553-set-upstream.sh',
+ 't5554-noop-fetch-negotiator.sh',
+ 't5555-http-smart-common.sh',
+ 't5557-http-get.sh',
+ 't5558-clone-bundle-uri.sh',
+ 't5559-http-fetch-smart-http2.sh',
+ 't5560-http-backend-noserver.sh',
+ 't5561-http-backend.sh',
+ 't5562-http-backend-content-length.sh',
+ 't5563-simple-http-auth.sh',
+ 't5564-http-proxy.sh',
+ 't5570-git-daemon.sh',
+ 't5571-pre-push-hook.sh',
+ 't5572-pull-submodule.sh',
+ 't5573-pull-verify-signatures.sh',
+ 't5574-fetch-output.sh',
+ 't5580-unc-paths.sh',
+ 't5581-http-curl-verbose.sh',
+ 't5582-fetch-negative-refspec.sh',
+ 't5583-push-branches.sh',
+ 't5600-clone-fail-cleanup.sh',
+ 't5601-clone.sh',
+ 't5602-clone-remote-exec.sh',
+ 't5603-clone-dirname.sh',
+ 't5604-clone-reference.sh',
+ 't5605-clone-local.sh',
+ 't5606-clone-options.sh',
+ 't5607-clone-bundle.sh',
+ 't5608-clone-2gb.sh',
+ 't5609-clone-branch.sh',
+ 't5610-clone-detached.sh',
+ 't5611-clone-config.sh',
+ 't5612-clone-refspec.sh',
+ 't5613-info-alternate.sh',
+ 't5614-clone-submodules-shallow.sh',
+ 't5615-alternate-env.sh',
+ 't5616-partial-clone.sh',
+ 't5617-clone-submodules-remote.sh',
+ 't5618-alternate-refs.sh',
+ 't5619-clone-local-ambiguous-transport.sh',
+ 't5700-protocol-v1.sh',
+ 't5701-git-serve.sh',
+ 't5702-protocol-v2.sh',
+ 't5703-upload-pack-ref-in-want.sh',
+ 't5704-protocol-violations.sh',
+ 't5705-session-id-in-capabilities.sh',
+ 't5730-protocol-v2-bundle-uri-file.sh',
+ 't5731-protocol-v2-bundle-uri-git.sh',
+ 't5732-protocol-v2-bundle-uri-http.sh',
+ 't5750-bundle-uri-parse.sh',
+ 't5801-remote-helpers.sh',
+ 't5802-connect-helper.sh',
+ 't5810-proto-disable-local.sh',
+ 't5811-proto-disable-git.sh',
+ 't5812-proto-disable-http.sh',
+ 't5813-proto-disable-ssh.sh',
+ 't5814-proto-disable-ext.sh',
+ 't5815-submodule-protos.sh',
+ 't5900-repo-selection.sh',
+ 't6000-rev-list-misc.sh',
+ 't6001-rev-list-graft.sh',
+ 't6002-rev-list-bisect.sh',
+ 't6003-rev-list-topo-order.sh',
+ 't6004-rev-list-path-optim.sh',
+ 't6005-rev-list-count.sh',
+ 't6006-rev-list-format.sh',
+ 't6007-rev-list-cherry-pick-file.sh',
+ 't6008-rev-list-submodule.sh',
+ 't6009-rev-list-parent.sh',
+ 't6010-merge-base.sh',
+ 't6011-rev-list-with-bad-commit.sh',
+ 't6012-rev-list-simplify.sh',
+ 't6013-rev-list-reverse-parents.sh',
+ 't6014-rev-list-all.sh',
+ 't6016-rev-list-graph-simplify-history.sh',
+ 't6017-rev-list-stdin.sh',
+ 't6018-rev-list-glob.sh',
+ 't6019-rev-list-ancestry-path.sh',
+ 't6020-bundle-misc.sh',
+ 't6021-rev-list-exclude-hidden.sh',
+ 't6022-rev-list-missing.sh',
+ 't6030-bisect-porcelain.sh',
+ 't6040-tracking-info.sh',
+ 't6041-bisect-submodule.sh',
+ 't6050-replace.sh',
+ 't6060-merge-index.sh',
+ 't6100-rev-list-in-order.sh',
+ 't6101-rev-parse-parents.sh',
+ 't6102-rev-list-unexpected-objects.sh',
+ 't6110-rev-list-sparse.sh',
+ 't6111-rev-list-treesame.sh',
+ 't6112-rev-list-filters-objects.sh',
+ 't6113-rev-list-bitmap-filters.sh',
+ 't6114-keep-packs.sh',
+ 't6115-rev-list-du.sh',
+ 't6120-describe.sh',
+ 't6130-pathspec-noglob.sh',
+ 't6131-pathspec-icase.sh',
+ 't6132-pathspec-exclude.sh',
+ 't6133-pathspec-rev-dwim.sh',
+ 't6134-pathspec-in-submodule.sh',
+ 't6135-pathspec-with-attrs.sh',
+ 't6136-pathspec-in-bare.sh',
+ 't6200-fmt-merge-msg.sh',
+ 't6300-for-each-ref.sh',
+ 't6301-for-each-ref-errors.sh',
+ 't6302-for-each-ref-filter.sh',
+ 't6400-merge-df.sh',
+ 't6401-merge-criss-cross.sh',
+ 't6402-merge-rename.sh',
+ 't6403-merge-file.sh',
+ 't6404-recursive-merge.sh',
+ 't6405-merge-symlinks.sh',
+ 't6406-merge-attr.sh',
+ 't6407-merge-binary.sh',
+ 't6408-merge-up-to-date.sh',
+ 't6409-merge-subtree.sh',
+ 't6411-merge-filemode.sh',
+ 't6412-merge-large-rename.sh',
+ 't6413-merge-crlf.sh',
+ 't6414-merge-rename-nocruft.sh',
+ 't6415-merge-dir-to-symlink.sh',
+ 't6416-recursive-corner-cases.sh',
+ 't6417-merge-ours-theirs.sh',
+ 't6418-merge-text-auto.sh',
+ 't6419-merge-ignorecase.sh',
+ 't6421-merge-partial-clone.sh',
+ 't6422-merge-rename-corner-cases.sh',
+ 't6423-merge-rename-directories.sh',
+ 't6424-merge-unrelated-index-changes.sh',
+ 't6425-merge-rename-delete.sh',
+ 't6426-merge-skip-unneeded-updates.sh',
+ 't6427-diff3-conflict-markers.sh',
+ 't6428-merge-conflicts-sparse.sh',
+ 't6429-merge-sequence-rename-caching.sh',
+ 't6430-merge-recursive.sh',
+ 't6431-merge-criscross.sh',
+ 't6432-merge-recursive-space-options.sh',
+ 't6433-merge-toplevel.sh',
+ 't6434-merge-recursive-rename-options.sh',
+ 't6435-merge-sparse.sh',
+ 't6436-merge-overwrite.sh',
+ 't6437-submodule-merge.sh',
+ 't6438-submodule-directory-file-conflicts.sh',
+ 't6439-merge-co-error-msgs.sh',
+ 't6500-gc.sh',
+ 't6501-freshen-objects.sh',
+ 't6600-test-reach.sh',
+ 't6700-tree-depth.sh',
+ 't7001-mv.sh',
+ 't7002-mv-sparse-checkout.sh',
+ 't7003-filter-branch.sh',
+ 't7004-tag.sh',
+ 't7005-editor.sh',
+ 't7006-pager.sh',
+ 't7007-show.sh',
+ 't7008-filter-branch-null-sha1.sh',
+ 't7010-setup.sh',
+ 't7011-skip-worktree-reading.sh',
+ 't7012-skip-worktree-writing.sh',
+ 't7030-verify-tag.sh',
+ 't7031-verify-tag-signed-ssh.sh',
+ 't7060-wtstatus.sh',
+ 't7061-wtstatus-ignore.sh',
+ 't7062-wtstatus-ignorecase.sh',
+ 't7063-status-untracked-cache.sh',
+ 't7064-wtstatus-pv2.sh',
+ 't7101-reset-empty-subdirs.sh',
+ 't7102-reset.sh',
+ 't7103-reset-bare.sh',
+ 't7104-reset-hard.sh',
+ 't7105-reset-patch.sh',
+ 't7106-reset-unborn-branch.sh',
+ 't7107-reset-pathspec-file.sh',
+ 't7110-reset-merge.sh',
+ 't7111-reset-table.sh',
+ 't7112-reset-submodule.sh',
+ 't7113-post-index-change-hook.sh',
+ 't7201-co.sh',
+ 't7300-clean.sh',
+ 't7301-clean-interactive.sh',
+ 't7400-submodule-basic.sh',
+ 't7401-submodule-summary.sh',
+ 't7402-submodule-rebase.sh',
+ 't7403-submodule-sync.sh',
+ 't7406-submodule-update.sh',
+ 't7407-submodule-foreach.sh',
+ 't7408-submodule-reference.sh',
+ 't7409-submodule-detached-work-tree.sh',
+ 't7411-submodule-config.sh',
+ 't7412-submodule-absorbgitdirs.sh',
+ 't7413-submodule-is-active.sh',
+ 't7414-submodule-mistakes.sh',
+ 't7416-submodule-dash-url.sh',
+ 't7417-submodule-path-url.sh',
+ 't7418-submodule-sparse-gitmodules.sh',
+ 't7419-submodule-set-branch.sh',
+ 't7420-submodule-set-url.sh',
+ 't7421-submodule-summary-add.sh',
+ 't7422-submodule-output.sh',
+ 't7423-submodule-symlinks.sh',
+ 't7424-submodule-mixed-ref-formats.sh',
+ 't7450-bad-git-dotfiles.sh',
+ 't7500-commit-template-squash-signoff.sh',
+ 't7501-commit-basic-functionality.sh',
+ 't7502-commit-porcelain.sh',
+ 't7503-pre-commit-and-pre-merge-commit-hooks.sh',
+ 't7504-commit-msg-hook.sh',
+ 't7505-prepare-commit-msg-hook.sh',
+ 't7506-status-submodule.sh',
+ 't7507-commit-verbose.sh',
+ 't7508-status.sh',
+ 't7509-commit-authorship.sh',
+ 't7510-signed-commit.sh',
+ 't7511-status-index.sh',
+ 't7512-status-help.sh',
+ 't7513-interpret-trailers.sh',
+ 't7514-commit-patch.sh',
+ 't7515-status-symlinks.sh',
+ 't7516-commit-races.sh',
+ 't7517-per-repo-email.sh',
+ 't7518-ident-corner-cases.sh',
+ 't7519-status-fsmonitor.sh',
+ 't7520-ignored-hook-warning.sh',
+ 't7521-ignored-mode.sh',
+ 't7524-commit-summary.sh',
+ 't7525-status-rename.sh',
+ 't7526-commit-pathspec-file.sh',
+ 't7527-builtin-fsmonitor.sh',
+ 't7528-signed-commit-ssh.sh',
+ 't7600-merge.sh',
+ 't7601-merge-pull-config.sh',
+ 't7602-merge-octopus-many.sh',
+ 't7603-merge-reduce-heads.sh',
+ 't7604-merge-custom-message.sh',
+ 't7605-merge-resolve.sh',
+ 't7606-merge-custom.sh',
+ 't7607-merge-state.sh',
+ 't7608-merge-messages.sh',
+ 't7609-mergetool--lib.sh',
+ 't7610-mergetool.sh',
+ 't7611-merge-abort.sh',
+ 't7612-merge-verify-signatures.sh',
+ 't7614-merge-signoff.sh',
+ 't7615-diff-algo-with-mergy-operations.sh',
+ 't7700-repack.sh',
+ 't7701-repack-unpack-unreachable.sh',
+ 't7702-repack-cyclic-alternate.sh',
+ 't7703-repack-geometric.sh',
+ 't7704-repack-cruft.sh',
+ 't7800-difftool.sh',
+ 't7810-grep.sh',
+ 't7811-grep-open.sh',
+ 't7812-grep-icase-non-ascii.sh',
+ 't7813-grep-icase-iso.sh',
+ 't7814-grep-recurse-submodules.sh',
+ 't7815-grep-binary.sh',
+ 't7816-grep-binary-pattern.sh',
+ 't7817-grep-sparse-checkout.sh',
+ 't7900-maintenance.sh',
+ 't8001-annotate.sh',
+ 't8002-blame.sh',
+ 't8003-blame-corner-cases.sh',
+ 't8004-blame-with-conflicts.sh',
+ 't8005-blame-i18n.sh',
+ 't8006-blame-textconv.sh',
+ 't8007-cat-file-textconv.sh',
+ 't8008-blame-formats.sh',
+ 't8009-blame-vs-topicbranches.sh',
+ 't8010-cat-file-filters.sh',
+ 't8011-blame-split-file.sh',
+ 't8012-blame-colors.sh',
+ 't8013-blame-ignore-revs.sh',
+ 't8014-blame-ignore-fuzzy.sh',
+ 't9001-send-email.sh',
+ 't9002-column.sh',
+ 't9003-help-autocorrect.sh',
+ 't9100-git-svn-basic.sh',
+ 't9101-git-svn-props.sh',
+ 't9102-git-svn-deep-rmdir.sh',
+ 't9103-git-svn-tracked-directory-removed.sh',
+ 't9104-git-svn-follow-parent.sh',
+ 't9105-git-svn-commit-diff.sh',
+ 't9106-git-svn-commit-diff-clobber.sh',
+ 't9107-git-svn-migrate.sh',
+ 't9108-git-svn-glob.sh',
+ 't9109-git-svn-multi-glob.sh',
+ 't9110-git-svn-use-svm-props.sh',
+ 't9111-git-svn-use-svnsync-props.sh',
+ 't9112-git-svn-md5less-file.sh',
+ 't9113-git-svn-dcommit-new-file.sh',
+ 't9114-git-svn-dcommit-merge.sh',
+ 't9115-git-svn-dcommit-funky-renames.sh',
+ 't9116-git-svn-log.sh',
+ 't9117-git-svn-init-clone.sh',
+ 't9118-git-svn-funky-branch-names.sh',
+ 't9119-git-svn-info.sh',
+ 't9120-git-svn-clone-with-percent-escapes.sh',
+ 't9121-git-svn-fetch-renamed-dir.sh',
+ 't9122-git-svn-author.sh',
+ 't9123-git-svn-rebuild-with-rewriteroot.sh',
+ 't9124-git-svn-dcommit-auto-props.sh',
+ 't9125-git-svn-multi-glob-branch-names.sh',
+ 't9126-git-svn-follow-deleted-readded-directory.sh',
+ 't9127-git-svn-partial-rebuild.sh',
+ 't9128-git-svn-cmd-branch.sh',
+ 't9129-git-svn-i18n-commitencoding.sh',
+ 't9130-git-svn-authors-file.sh',
+ 't9131-git-svn-empty-symlink.sh',
+ 't9132-git-svn-broken-symlink.sh',
+ 't9133-git-svn-nested-git-repo.sh',
+ 't9134-git-svn-ignore-paths.sh',
+ 't9135-git-svn-moved-branch-empty-file.sh',
+ 't9136-git-svn-recreated-branch-empty-file.sh',
+ 't9137-git-svn-dcommit-clobber-series.sh',
+ 't9138-git-svn-authors-prog.sh',
+ 't9139-git-svn-non-utf8-commitencoding.sh',
+ 't9140-git-svn-reset.sh',
+ 't9141-git-svn-multiple-branches.sh',
+ 't9142-git-svn-shallow-clone.sh',
+ 't9143-git-svn-gc.sh',
+ 't9144-git-svn-old-rev_map.sh',
+ 't9145-git-svn-master-branch.sh',
+ 't9146-git-svn-empty-dirs.sh',
+ 't9147-git-svn-include-paths.sh',
+ 't9148-git-svn-propset.sh',
+ 't9150-svk-mergetickets.sh',
+ 't9151-svn-mergeinfo.sh',
+ 't9152-svn-empty-dirs-after-gc.sh',
+ 't9153-git-svn-rewrite-uuid.sh',
+ 't9154-git-svn-fancy-glob.sh',
+ 't9155-git-svn-fetch-deleted-tag.sh',
+ 't9156-git-svn-fetch-deleted-tag-2.sh',
+ 't9157-git-svn-fetch-merge.sh',
+ 't9158-git-svn-mergeinfo.sh',
+ 't9159-git-svn-no-parent-mergeinfo.sh',
+ 't9160-git-svn-preserve-empty-dirs.sh',
+ 't9161-git-svn-mergeinfo-push.sh',
+ 't9162-git-svn-dcommit-interactive.sh',
+ 't9163-git-svn-reset-clears-caches.sh',
+ 't9164-git-svn-dcommit-concurrent.sh',
+ 't9165-git-svn-fetch-merge-branch-of-branch.sh',
+ 't9166-git-svn-fetch-merge-branch-of-branch2.sh',
+ 't9167-git-svn-cmd-branch-subproject.sh',
+ 't9168-git-svn-partially-globbed-names.sh',
+ 't9169-git-svn-dcommit-crlf.sh',
+ 't9200-git-cvsexportcommit.sh',
+ 't9210-scalar.sh',
+ 't9211-scalar-clone.sh',
+ 't9300-fast-import.sh',
+ 't9301-fast-import-notes.sh',
+ 't9302-fast-import-unpack-limit.sh',
+ 't9303-fast-import-compression.sh',
+ 't9304-fast-import-marks.sh',
+ 't9350-fast-export.sh',
+ 't9351-fast-export-anonymize.sh',
+ 't9400-git-cvsserver-server.sh',
+ 't9401-git-cvsserver-crlf.sh',
+ 't9402-git-cvsserver-refs.sh',
+ 't9500-gitweb-standalone-no-errors.sh',
+ 't9501-gitweb-standalone-http-status.sh',
+ 't9502-gitweb-standalone-parse-output.sh',
+ 't9600-cvsimport.sh',
+ 't9601-cvsimport-vendor-branch.sh',
+ 't9602-cvsimport-branches-tags.sh',
+ 't9603-cvsimport-patchsets.sh',
+ 't9604-cvsimport-timestamps.sh',
+ 't9700-perl-git.sh',
+ 't9800-git-p4-basic.sh',
+ 't9801-git-p4-branch.sh',
+ 't9802-git-p4-filetype.sh',
+ 't9803-git-p4-shell-metachars.sh',
+ 't9804-git-p4-label.sh',
+ 't9805-git-p4-skip-submit-edit.sh',
+ 't9806-git-p4-options.sh',
+ 't9807-git-p4-submit.sh',
+ 't9808-git-p4-chdir.sh',
+ 't9809-git-p4-client-view.sh',
+ 't9810-git-p4-rcs.sh',
+ 't9811-git-p4-label-import.sh',
+ 't9812-git-p4-wildcards.sh',
+ 't9813-git-p4-preserve-users.sh',
+ 't9814-git-p4-rename.sh',
+ 't9815-git-p4-submit-fail.sh',
+ 't9816-git-p4-locked.sh',
+ 't9817-git-p4-exclude.sh',
+ 't9818-git-p4-block.sh',
+ 't9819-git-p4-case-folding.sh',
+ 't9820-git-p4-editor-handling.sh',
+ 't9821-git-p4-path-variations.sh',
+ 't9822-git-p4-path-encoding.sh',
+ 't9823-git-p4-mock-lfs.sh',
+ 't9824-git-p4-git-lfs.sh',
+ 't9825-git-p4-handle-utf16-without-bom.sh',
+ 't9826-git-p4-keep-empty-commits.sh',
+ 't9827-git-p4-change-filetype.sh',
+ 't9828-git-p4-map-user.sh',
+ 't9829-git-p4-jobs.sh',
+ 't9830-git-p4-symlink-dir.sh',
+ 't9831-git-p4-triggers.sh',
+ 't9832-unshelve.sh',
+ 't9833-errors.sh',
+ 't9834-git-p4-file-dir-bug.sh',
+ 't9835-git-p4-metadata-encoding-python2.sh',
+ 't9836-git-p4-metadata-encoding-python3.sh',
+ 't9850-shell.sh',
+ 't9901-git-web--browse.sh',
+ 't9902-completion.sh',
+ 't9903-bash-prompt.sh',
+]
+
+# GIT_BUILD_DIR needs to be Unix-style without drive prefixes as it 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 it.
+git_build_dir = meson.project_build_root()
+if cygpath.found()
+ git_build_dir = run_command(cygpath, git_build_dir, check: true).stdout().strip()
+endif
+
+test_environment = script_environment
+test_environment.set('GIT_BUILD_DIR', git_build_dir)
+
+foreach integration_test : integration_tests
+ test(fs.stem(integration_test), shell,
+ args: [ integration_test ],
+ workdir: meson.current_source_dir(),
+ env: test_environment,
+ depends: test_dependencies + bin_wrappers,
+ timeout: 0,
+ )
+endforeach
diff --git a/templates/hooks/meson.build b/templates/hooks/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..5bbb1bd483f24e05f826918fe63391ef72334e11
--- /dev/null
+++ b/templates/hooks/meson.build
@@ -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',
+ )
+endforeach
diff --git a/templates/info/meson.build b/templates/info/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..7af5ddd24985fc0a5888961939ae3b2758f2aaa8
--- /dev/null
+++ b/templates/info/meson.build
@@ -0,0 +1,7 @@
+configure_file(
+ input: 'exclude',
+ output: 'exclude',
+ configuration: template_config,
+ install: true,
+ install_dir: get_option('datadir') / 'git-core/templates',
+)
diff --git a/templates/meson.build b/templates/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..1faf9a44ceaa5a6eee673e66c9d5448c08dbc7d5
--- /dev/null
+++ b/templates/meson.build
@@ -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')
--
2.47.0.274.g962d0b743d.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v8 23/23] meson: fix conflicts with in-flight topics
2024-11-19 11:50 ` [PATCH v8 00/23] " Patrick Steinhardt
` (21 preceding siblings ...)
2024-11-19 11:50 ` [PATCH v8 22/23] Introduce support for the Meson build system Patrick Steinhardt
@ 2024-11-19 11:51 ` Patrick Steinhardt
2024-11-20 5:15 ` [PATCH v8 00/23] Modernize the build system Junio C Hamano
23 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-19 11:51 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder
As support for Meson is still in-flight we have to accommodate for
conflicts with topics in "seen". The following conflicts are being
addressed in this commit:
- ej/cat-file-remote-object-info adds t1017 and "fetch-object-info.c".
- cc/promisor-remote-capability adds t5710.
- ds/path-walk adds t6601 as well as "path-walk.c" and
"test-path-walk.c".
- ps/reftable-detach adds "reftable/system.c".
- js/libgit-rust adds "common-exit.c" and "common-init.c".
- ps/clar-build-improvement adapts the awk(1) script that generates
"clar.suites" to instead be a shell script.
- ds/full-name-hash adds "t/helper/test-name-hash.c".
- cw/worktree-extension deletes t2408.
This is somewhat painful in the current state where Meson is not yet
part of the main tree, but we'll have to live with that for the time
being.
I've split this commit out into a separate fixup-style commit such that
it is possible to test this topic both with and without "seen" merged
into it. You can simply revert this commit to test without "seen".
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
meson.build | 5 +++++
t/helper/meson.build | 2 ++
t/meson.build | 9 +++++----
3 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/meson.build b/meson.build
index 5c6a4212b04174247db173860edd01926576d3e8..a7adae7b1a146e7a55ae27788ac92066d3b05d26 100644
--- a/meson.build
+++ b/meson.build
@@ -239,6 +239,8 @@ libgit_sources = [
'commit-graph.c',
'commit-reach.c',
'commit.c',
+ 'common-exit.c',
+ 'common-init.c',
'compat/nonblock.c',
'compat/obstack.c',
'compat/terminal.c',
@@ -277,6 +279,7 @@ libgit_sources = [
'ewah/ewah_rlw.c',
'exec-cmd.c',
'fetch-negotiator.c',
+ 'fetch-object-info.c',
'fetch-pack.c',
'fmt-merge-msg.c',
'fsck.c',
@@ -351,6 +354,7 @@ libgit_sources = [
'parse-options.c',
'patch-delta.c',
'patch-ids.c',
+ 'path-walk.c',
'path.c',
'pathspec.c',
'pkt-line.c',
@@ -391,6 +395,7 @@ libgit_sources = [
'reftable/reader.c',
'reftable/record.c',
'reftable/stack.c',
+ 'reftable/system.c',
'reftable/tree.c',
'reftable/writer.c',
'remote.c',
diff --git a/t/helper/meson.build b/t/helper/meson.build
index 5e83884246edc7841738de5085f3255aa1fa3fbe..1d6154ce9756db17bc9f69bc3cd71a32b93857c5 100644
--- a/t/helper/meson.build
+++ b/t/helper/meson.build
@@ -34,12 +34,14 @@ test_tool_sources = [
'test-match-trees.c',
'test-mergesort.c',
'test-mktemp.c',
+ 'test-name-hash.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-path-walk.c',
'test-pcre2-config.c',
'test-pkt-line.c',
'test-proc-receive.c',
diff --git a/t/meson.build b/t/meson.build
index 9ec0b7fa34a033d508448dbd56ab2322a5106fd0..8f0ba136eeb0558f866d7fd3f0559d94139d4777 100644
--- a/t/meson.build
+++ b/t/meson.build
@@ -19,9 +19,8 @@ clar_sources += clar_decls_h
clar_sources += custom_target(
input: clar_decls_h,
output: 'clar.suite',
- feed: true,
- capture: true,
- command : [awk, '-f', meson.current_source_dir() + '/unit-tests/clar-generate.awk'],
+ command : [shell, meson.current_source_dir() + '/unit-tests/generate-clar-suites.sh', '@INPUT@', '@OUTPUT@'],
+ env: script_environment,
)
clar_unit_tests = executable('unit-tests',
@@ -168,6 +167,7 @@ integration_tests = [
't1014-read-tree-confusing.sh',
't1015-read-index-unmerged.sh',
't1016-compatObjectFormat.sh',
+ 't1017-cat-file-remote-object-info.sh',
't1020-subdirectory.sh',
't1021-rerere-in-workdir.sh',
't1022-read-tree-partial-clone.sh',
@@ -297,7 +297,6 @@ integration_tests = [
't2405-worktree-submodule.sh',
't2406-worktree-repair.sh',
't2407-worktree-heads.sh',
- 't2408-worktree-relative.sh',
't2500-untracked-overwriting.sh',
't2501-cwd-empty.sh',
't3000-ls-files-others.sh',
@@ -719,6 +718,7 @@ integration_tests = [
't5703-upload-pack-ref-in-want.sh',
't5704-protocol-violations.sh',
't5705-session-id-in-capabilities.sh',
+ 't5710-promisor-remote-capability.sh',
't5730-protocol-v2-bundle-uri-file.sh',
't5731-protocol-v2-bundle-uri-git.sh',
't5732-protocol-v2-bundle-uri-http.sh',
@@ -821,6 +821,7 @@ integration_tests = [
't6500-gc.sh',
't6501-freshen-objects.sh',
't6600-test-reach.sh',
+ 't6601-path-walk.sh',
't6700-tree-depth.sh',
't7001-mv.sh',
't7002-mv-sparse-checkout.sh',
--
2.47.0.274.g962d0b743d.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* Re: [PATCH v8 02/23] Makefile: consistently use @PLACEHOLDER@ to substitute
2024-11-19 11:50 ` [PATCH v8 02/23] Makefile: consistently use @PLACEHOLDER@ to substitute Patrick Steinhardt
@ 2024-11-19 19:23 ` Johannes Sixt
2024-11-20 8:35 ` Patrick Steinhardt
0 siblings, 1 reply; 386+ messages in thread
From: Johannes Sixt @ 2024-11-19 19:23 UTC (permalink / raw)
To: Patrick Steinhardt
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder, git
Am 19.11.24 um 12:50 schrieb Patrick Steinhardt:
> diff --git a/gitk-git/po/vi.po b/gitk-git/po/vi.po
> index 59674986604891d9901e87c163e61dd39db14184..184430dcdeea7cbb76895840f84a889b6abc20bf 100644
> --- a/gitk-git/po/vi.po
> +++ b/gitk-git/po/vi.po
> @@ -5,7 +5,7 @@
> #
> msgid ""
> msgstr ""
> -"Project-Id-Version: gitk @@GIT_VERSION@@\n"
> +"Project-Id-Version: gitk @GIT_VERSION@\n"
> "Report-Msgid-Bugs-To: \n"
> "POT-Creation-Date: 2015-05-17 14:32+1000\n"
> "PO-Revision-Date: 2015-09-15 07:33+0700\n"
Is it essential that this change of the gitk-git subtree is included in
this series? I think it does not hurt that it is omitted. I can pick up
the change and apply to Gitk independently.
-- Hannes
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [PATCH v8 03/23] Makefile: refactor GIT-VERSION-GEN to be reusable
2024-11-19 11:50 ` [PATCH v8 03/23] Makefile: refactor GIT-VERSION-GEN to be reusable Patrick Steinhardt
@ 2024-11-20 3:47 ` Junio C Hamano
2024-11-20 9:44 ` Patrick Steinhardt
0 siblings, 1 reply; 386+ messages in thread
From: Junio C Hamano @ 2024-11-20 3:47 UTC (permalink / raw)
To: Patrick Steinhardt
Cc: git, Eli Schwartz, Eric Sunshine, Phillip Wood, Ramsay Jones,
Taylor Blau, David Aguilar, Jeff King, Christian Couder
Patrick Steinhardt <ps@pks.im> writes:
> While at it, change the format of the version file by removing the
> spaces around the equals sign.
This may cause third-parties that act on the contents of the output
for their own purpose (read: may break distro scripts), but that is
part of packaging third-party software for a distro, so it may not
be considered a regression by them ;-)
> +if test "$#" -ne 3
> +then
> + echo "USAGE: $0 <SOURCE_DIR> <INPUT> <OUTPUT>" >&2
> + exit 1
> +fi
> +
> +SOURCE_DIR="$1"
> +INPUT="$2"
> +OUTPUT="$3"
> +
> +if ! test -f "$INPUT"
> +then
> + echo "Input is not a file: $INPUT" >&2
> + exit 1
> +fi
Just a taste thing, which does not warrant a reroll on its own, but
when redirecting to the standard error stream, writing >&2 early on
the command line is easier to signal that we are reading an error
message, e.g.
echo >&2 "This is an error message."
> +GIT_CEILING_DIRECTORIES="$SOURCE_DIR/.."
> +export GIT_CEILING_DIRECTORIES
Interesting. Presumably this is to prevent a foreign project having
a tarball extract of us in its subdirectory, which would be a good
protection.
> # First see if there is a version file (included in release tarballs),
> # then try git-describe, then default.
> -if test -f version
> +if test -f "$SOURCE_DIR"/version
> then
> - VN=$(cat version) || VN="$DEF_VER"
> -elif { test -d "${GIT_DIR:-.git}" || test -f .git; } &&
> - VN=$(git describe --match "v[0-9]*" HEAD 2>/dev/null) &&
> + VN=$(cat "$SOURCE_DIR"/version) || VN="$DEF_VER"
> +elif { test -d "$SOURCE_DIR/.git" || test -d "${GIT_DIR:-.git}" || test -f "$SOURCE_DIR"/.git; } &&
The line has grown a bit too long...
> + VN=$(git -C "$SOURCE_DIR" describe --match "v[0-9]*" HEAD 2>/dev/null) &&
> case "$VN" in
> *$LF*) (exit 1) ;;
> v[0-9]*)
> - git update-index -q --refresh
> - test -z "$(git diff-index --name-only HEAD --)" ||
> + git -C "$SOURCE_DIR" update-index -q --refresh
> + test -z "$(git -C "$SOURCE_DIR" diff-index --name-only HEAD --)" ||
> VN="$VN-dirty" ;;
VN matching this case arm is a good sign that we have "git"
available, so not squelching "Command git not found" here is
acceptable, with or without this patch.
> esac
> then
> @@ -26,15 +44,31 @@ else
> VN="$DEF_VER"
> fi
>
> -VN=$(expr "$VN" : v*'\(.*\)')
> +GIT_BUILT_FROM_COMMIT=$(git -C "$SOURCE_DIR" rev-parse -q --verify HEAD 2>/dev/null)
The 2>/dev/null here is required and is good. Even if the
source-dir is git controlled, if we do not have an installed Git
available, we set GIT_BUILT_FROM_COMMIT to an empty string, as we
cannot tell which commit we are building from (yet).
> +GIT_DATE=$(git -C "$SOURCE_DIR" show --quiet --format='%as')
This needs 2>/dev/null to squelch the case where we have no
installed git. I suspect "%cs" is more in line with the spirit of
GIT_DATE if I understand its purpose, i.e. "this is the time this
version was recorded in the Git history, with the intention to give
it the public" and better than "%as".
> +GIT_VERSION=$(expr "$VN" : v*'\(.*\)')
I think VN is now set by the if/else cascade above to a string that
begins with 'v', as lnog as the maintainer makes sure that their
tags begin with 'v' (or a distro person prepares the 'version' file
to honor the convention), so this should be a safething to do.
> +if test -z "$GIT_USER_AGENT"
> +then
> + GIT_USER_AGENT=git/$GIT_VERSION
Not required by the language, but Documentation/CodingGuidelines
encourages you to dq the RHS of this assignment.
> +fi
> +
> +read GIT_MAJOR_VERSION GIT_MINOR_VERSION GIT_MICRO_VERSION GIT_PATCH_LEVEL trailing <<EOF
> +$(echo "$GIT_VERSION" 0 0 0 0 | tr '.a-zA-Z-' ' ')
> +EOF
And because GIT_VERSION generation is safe above, this probably is
safe, too. In the ancient days, we had tags like "v0.99.9g" which
may not match the above convention, but with the understanding that
we establish an official convention going forward (i.e. we allow up
to four numbers, the rest is discarded so do not use more than
four), it is OK.
Who wants these broken-out versions and are they fine with
up-to-four limitation? Just being curious.
> diff --git a/contrib/buildsystems/git-version.in b/contrib/buildsystems/git-version.in
> new file mode 100644
> index 0000000000000000000000000000000000000000..9750505ae77685ebb31a38468caaf13501b6739d
> --- /dev/null
> +++ b/contrib/buildsystems/git-version.in
> @@ -0,0 +1 @@
> +@GIT_MAJOR_VERSION@.@GIT_MINOR_VERSION@.@GIT_MICRO_VERSION@
And this one seems to discard the fourth number, so those who
prepares VN to contain the fourth digit to differenciate a new
version with previous ones would be disappointed. Similarly,
because this requires the third number, we cannot change the
versioning scheme at 3.0 boundary to say "3.1 is the next version
after 3.0".
As this is merely setting the rule for our future, perhaps we want
to be consistently allow and require N dot-separated numbers
everywhere (e.g., we allow and require 3 numbers, not 2, not 4, but
exactly 3 numbers)?
Thanks.
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [PATCH v8 00/23] Modernize the build system
2024-11-19 11:50 ` [PATCH v8 00/23] " Patrick Steinhardt
` (22 preceding siblings ...)
2024-11-19 11:51 ` [PATCH v8 23/23] meson: fix conflicts with in-flight topics Patrick Steinhardt
@ 2024-11-20 5:15 ` Junio C Hamano
2024-11-20 8:56 ` Patrick Steinhardt
23 siblings, 1 reply; 386+ messages in thread
From: Junio C Hamano @ 2024-11-20 5:15 UTC (permalink / raw)
To: Patrick Steinhardt
Cc: git, Eli Schwartz, Eric Sunshine, Phillip Wood, Ramsay Jones,
Taylor Blau, David Aguilar, Jeff King, Christian Couder
This broke the documentation build with the log ending with
something like ...
GEN asciidoctor-extensions.rb
GEN docinfo.html
GEN howto-index.txt
* new asciidoc flags
ASCIIDOC git-tools.html
...
ASCIIDOC howto/keep-canonical-history-correct.html
ASCIIDOC howto/maintain-git.html
gmake[1]: *** No rule to make target 'asciidoc.conf', needed by 'technical/api-error-handling.html'. Stop.
gmake[1]: *** Waiting for unfinished jobs....
ASCIIDOC howto/coordinate-embargoed-releases.html
asciidoctor: FAILED: 'asciidoctor-extensions' could not be loaded
Use --trace to show backtrace
gmake[1]: *** [Makefile:428: howto/new-command.html] Error 1
I think all my builds these days (including the ones that push out
to https://github.com/git/htmldocs.git that in turn results in pages
at https://git.github.io/htmldocs/ getting updated) use asciidoctor
with "USE_ASCIIDOCTOR=YesPlease", if it makes a difference.
Thanks.
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [PATCH v8 02/23] Makefile: consistently use @PLACEHOLDER@ to substitute
2024-11-19 19:23 ` Johannes Sixt
@ 2024-11-20 8:35 ` Patrick Steinhardt
0 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-20 8:35 UTC (permalink / raw)
To: Johannes Sixt
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Christian Couder, git
On Tue, Nov 19, 2024 at 08:23:20PM +0100, Johannes Sixt wrote:
> Am 19.11.24 um 12:50 schrieb Patrick Steinhardt:
> > diff --git a/gitk-git/po/vi.po b/gitk-git/po/vi.po
> > index 59674986604891d9901e87c163e61dd39db14184..184430dcdeea7cbb76895840f84a889b6abc20bf 100644
> > --- a/gitk-git/po/vi.po
> > +++ b/gitk-git/po/vi.po
> > @@ -5,7 +5,7 @@
> > #
> > msgid ""
> > msgstr ""
> > -"Project-Id-Version: gitk @@GIT_VERSION@@\n"
> > +"Project-Id-Version: gitk @GIT_VERSION@\n"
> > "Report-Msgid-Bugs-To: \n"
> > "POT-Creation-Date: 2015-05-17 14:32+1000\n"
> > "PO-Revision-Date: 2015-09-15 07:33+0700\n"
>
> Is it essential that this change of the gitk-git subtree is included in
> this series? I think it does not hurt that it is omitted. I can pick up
> the change and apply to Gitk independently.
No, it's not, I'll drop this change. It's kind of curious why we have
this placeholder in this file in the first place. None of the other
translations do, and I couldn't find anything where we replace this
string.
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [PATCH v8 00/23] Modernize the build system
2024-11-20 5:15 ` [PATCH v8 00/23] Modernize the build system Junio C Hamano
@ 2024-11-20 8:56 ` Patrick Steinhardt
0 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-20 8:56 UTC (permalink / raw)
To: Junio C Hamano
Cc: git, Eli Schwartz, Eric Sunshine, Phillip Wood, Ramsay Jones,
Taylor Blau, David Aguilar, Jeff King, Christian Couder
On Wed, Nov 20, 2024 at 02:15:58PM +0900, Junio C Hamano wrote:
> This broke the documentation build with the log ending with
> something like ...
>
> GEN asciidoctor-extensions.rb
> GEN docinfo.html
> GEN howto-index.txt
> * new asciidoc flags
> ASCIIDOC git-tools.html
> ...
> ASCIIDOC howto/keep-canonical-history-correct.html
> ASCIIDOC howto/maintain-git.html
> gmake[1]: *** No rule to make target 'asciidoc.conf', needed by 'technical/api-error-handling.html'. Stop.
> gmake[1]: *** Waiting for unfinished jobs....
> ASCIIDOC howto/coordinate-embargoed-releases.html
> asciidoctor: FAILED: 'asciidoctor-extensions' could not be loaded
> Use --trace to show backtrace
> gmake[1]: *** [Makefile:428: howto/new-command.html] Error 1
>
> I think all my builds these days (including the ones that push out
> to https://github.com/git/htmldocs.git that in turn results in pages
> at https://git.github.io/htmldocs/ getting updated) use asciidoctor
> with "USE_ASCIIDOCTOR=YesPlease", if it makes a difference.
Indeed. I catched the other case where we rely on "asciidoc.conf"
unconditionally even with asciidoctor, but missed this one. This will be
fixed with the below diff.
Patrick
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 5ebc300ed3..9e6a55e0f3 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -375,7 +375,7 @@ technical/api-index.txt: technical/api-index-skel.txt \
technical/%.html: ASCIIDOC_EXTRA += -a git-relative-html-prefix=../
$(patsubst %,%.html,$(API_DOCS) technical/api-index $(TECH_DOCS)): %.html : %.txt \
- asciidoc.conf GIT-ASCIIDOCFLAGS
+ $(ASCIIDOC_DEPS)
$(QUIET_ASCIIDOC)$(TXT_TO_HTML) $*.txt
SubmittingPatches.txt: SubmittingPatches
^ permalink raw reply related [flat|nested] 386+ messages in thread
* Re: [PATCH v8 03/23] Makefile: refactor GIT-VERSION-GEN to be reusable
2024-11-20 3:47 ` Junio C Hamano
@ 2024-11-20 9:44 ` Patrick Steinhardt
2024-11-21 0:03 ` Junio C Hamano
0 siblings, 1 reply; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-20 9:44 UTC (permalink / raw)
To: Junio C Hamano
Cc: git, Eli Schwartz, Eric Sunshine, Phillip Wood, Ramsay Jones,
Taylor Blau, David Aguilar, Jeff King, Christian Couder
On Wed, Nov 20, 2024 at 12:47:40PM +0900, Junio C Hamano wrote:
> Patrick Steinhardt <ps@pks.im> writes:
> > +GIT_CEILING_DIRECTORIES="$SOURCE_DIR/.."
> > +export GIT_CEILING_DIRECTORIES
>
> Interesting. Presumably this is to prevent a foreign project having
> a tarball extract of us in its subdirectory, which would be a good
> protection.
Yup.
> > # First see if there is a version file (included in release tarballs),
> > # then try git-describe, then default.
> > -if test -f version
> > +if test -f "$SOURCE_DIR"/version
> > then
> > - VN=$(cat version) || VN="$DEF_VER"
> > -elif { test -d "${GIT_DIR:-.git}" || test -f .git; } &&
> > - VN=$(git describe --match "v[0-9]*" HEAD 2>/dev/null) &&
> > + VN=$(cat "$SOURCE_DIR"/version) || VN="$DEF_VER"
> > +elif { test -d "$SOURCE_DIR/.git" || test -d "${GIT_DIR:-.git}" || test -f "$SOURCE_DIR"/.git; } &&
>
> The line has grown a bit too long...
Fair. I wonder how this is supposed to be formatted in the first
place... I'll get creative.
> > +GIT_DATE=$(git -C "$SOURCE_DIR" show --quiet --format='%as')
>
> This needs 2>/dev/null to squelch the case where we have no
> installed git.
Will fix.
> I suspect "%cs" is more in line with the spirit of GIT_DATE if I
> understand its purpose, i.e. "this is the time this version was
> recorded in the Git history, with the intention to give it the public"
> and better than "%as".
While I agree with you, I'll leave this one as-is for now because this
is preexisting logic. But I'll rearrange a bit so that required
placeholders are only wired up once they are actually used so that it
can be seen where they come from and that the rewrite is faithful to the
original logic.
> > +fi
> > +
> > +read GIT_MAJOR_VERSION GIT_MINOR_VERSION GIT_MICRO_VERSION GIT_PATCH_LEVEL trailing <<EOF
> > +$(echo "$GIT_VERSION" 0 0 0 0 | tr '.a-zA-Z-' ' ')
> > +EOF
>
> And because GIT_VERSION generation is safe above, this probably is
> safe, too. In the ancient days, we had tags like "v0.99.9g" which
> may not match the above convention, but with the understanding that
> we establish an official convention going forward (i.e. we allow up
> to four numbers, the rest is discarded so do not use more than
> four), it is OK.
>
> Who wants these broken-out versions and are they fine with
> up-to-four limitation? Just being curious.
The only user is "git.rc", which is where the limitation originates
from.
> > diff --git a/contrib/buildsystems/git-version.in b/contrib/buildsystems/git-version.in
> > new file mode 100644
> > index 0000000000000000000000000000000000000000..9750505ae77685ebb31a38468caaf13501b6739d
> > --- /dev/null
> > +++ b/contrib/buildsystems/git-version.in
> > @@ -0,0 +1 @@
> > +@GIT_MAJOR_VERSION@.@GIT_MINOR_VERSION@.@GIT_MICRO_VERSION@
>
> And this one seems to discard the fourth number, so those who
> prepares VN to contain the fourth digit to differenciate a new
> version with previous ones would be disappointed. Similarly,
> because this requires the third number, we cannot change the
> versioning scheme at 3.0 boundary to say "3.1 is the next version
> after 3.0".
>
> As this is merely setting the rule for our future, perhaps we want
> to be consistently allow and require N dot-separated numbers
> everywhere (e.g., we allow and require 3 numbers, not 2, not 4, but
> exactly 3 numbers)?
Yeah, being consistent would be nice indeed. But for now I'd prefer to
keep this as-is because we'd otherwise change the version schema used by
CMake builds. In theory we can use 4 numbers here, too, where the fourth
number would correspond to the `PROJECT_VERSION_TWEAK` CMake variable.
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [PATCH v8 03/23] Makefile: refactor GIT-VERSION-GEN to be reusable
2024-11-20 9:44 ` Patrick Steinhardt
@ 2024-11-21 0:03 ` Junio C Hamano
2024-11-25 9:03 ` Patrick Steinhardt
0 siblings, 1 reply; 386+ messages in thread
From: Junio C Hamano @ 2024-11-21 0:03 UTC (permalink / raw)
To: Patrick Steinhardt
Cc: git, Eli Schwartz, Eric Sunshine, Phillip Wood, Ramsay Jones,
Taylor Blau, David Aguilar, Jeff King, Christian Couder
Patrick Steinhardt <ps@pks.im> writes:
>> I suspect "%cs" is more in line with the spirit of GIT_DATE if I
>> understand its purpose, i.e. "this is the time this version was
>> recorded in the Git history, with the intention to give it the public"
>> and better than "%as".
>
> While I agree with you, I'll leave this one as-is for now because this
> is preexisting logic.
Ah, then please disregard what I said. We are not _fixing_ anything
that is not broken in this series.
> But I'll rearrange a bit so that required
> placeholders are only wired up once they are actually used so that it
> can be seen where they come from and that the rewrite is faithful to the
> original logic.
Sounds very good.
> Yeah, being consistent would be nice indeed. But for now I'd prefer to
> keep this as-is because we'd otherwise change the version schema used by
> CMake builds. In theory we can use 4 numbers here, too, where the fourth
> number would correspond to the `PROJECT_VERSION_TWEAK` CMake variable.
As I only write vX,Y,Z with three numbers, any fourth number a build
system comes up with has no bit of information. So we could consider
what we use is 3-number scheme, and supply a fixed and meaningless '0'
to whoever wants the fourth number.
Which is essentially what you are doing with the "split $(echo $V 0 0 0 0)
with 'read A B C D' construct" ;-) I am fine with that as long as
we have a shared understanding documented somewhere.
Thanks.
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [PATCH v8 03/23] Makefile: refactor GIT-VERSION-GEN to be reusable
2024-11-21 0:03 ` Junio C Hamano
@ 2024-11-25 9:03 ` Patrick Steinhardt
0 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-25 9:03 UTC (permalink / raw)
To: Junio C Hamano
Cc: git, Eli Schwartz, Eric Sunshine, Phillip Wood, Ramsay Jones,
Taylor Blau, David Aguilar, Jeff King, Christian Couder
On Thu, Nov 21, 2024 at 09:03:50AM +0900, Junio C Hamano wrote:
> Patrick Steinhardt <ps@pks.im> writes:
> > Yeah, being consistent would be nice indeed. But for now I'd prefer to
> > keep this as-is because we'd otherwise change the version schema used by
> > CMake builds. In theory we can use 4 numbers here, too, where the fourth
> > number would correspond to the `PROJECT_VERSION_TWEAK` CMake variable.
>
> As I only write vX,Y,Z with three numbers, any fourth number a build
> system comes up with has no bit of information. So we could consider
> what we use is 3-number scheme, and supply a fixed and meaningless '0'
> to whoever wants the fourth number.
>
> Which is essentially what you are doing with the "split $(echo $V 0 0 0 0)
> with 'read A B C D' construct" ;-) I am fine with that as long as
> we have a shared understanding documented somewhere.
Yes and no. All of our official releases use three version numbers, that
much is true. But our development builds use four numbers, e.g.:
2.47.0.280.g199a5082df1.dirty
The fourth number corresponds to the number of patches applied since the
last release, and this is what we use in the context of "git.rc".
I'll add a comment to GIT-VERSION-GEN to explain this.
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* [PATCH v9 00/23] Modernize the build system
2024-10-02 15:15 [RFC PATCH 00/21] Modernize the build system Patrick Steinhardt
` (28 preceding siblings ...)
2024-11-19 11:50 ` [PATCH v8 00/23] " Patrick Steinhardt
@ 2024-11-25 9:56 ` Patrick Steinhardt
2024-11-25 9:56 ` [PATCH v9 01/23] Makefile: use common template for GIT-BUILD-OPTIONS Patrick Steinhardt
` (22 more replies)
2024-11-28 16:12 ` [PATCH v10 00/23] Modernize the build system Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 00/26] Modernize the build system Patrick Steinhardt
31 siblings, 23 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-25 9:56 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
Hi,
this patch series modernizes our build infrasturcture. It refactors
various parts of it to make it possible to perform out-of-tree builds in
theory.
The series then continues to wire up Meson as a proposed alternative as
a modern replacement for our current build systems. It provides better
integration into IDEs than our Makefiles, better usability than our
Makefiles and CMake, better configuration and discoverability thereof
than autoconf and CMake (which is of course my personal opinion).
The intent is to have Meson replace autoconf, which is mostly unused and
broken. Eventually, the plan is to also replace CMake and our Makefiles
in case we figure out that this replacement is indeed a net benefit for
the project, but all of this would happen over the course of multiple
releases.
Changes in v9:
- The series is now built on top of 6ea2d9d271 (Sync with Git 2.47.1,
2024-11-25) with ps/clar-build-improvement at 5dac35bbde (Makefile:
let clar header targets depend on their scripts, 2024-11-15) merged
into it. This is done to address semantic merge conflicts with that
series, which has been merged to 'next' by now.
- Drop unnecessary changes to gitk.
- A couple of small tweaks to the refactored GIT-VERSION-GEN script.
- Extend GIT-VERSION-GEN with additional placeholders in the commits
where they are first used instead of introducing them ahead of time.
This makes it easier to see that the refactoring is faithful to the
original.
- Use "echo >&2 $MSG" instead of "echo $MSG >&2".
- Fix another dependency when building technical docs via AsciiDoctor.
- Remove generated version files via `make clean`.
As before, the tip of this patch series catches up with what is
happening in "seen". If you want to test it without topics in "seen" you
have to revert it.
Links to previous versions:
- Link to v1: https://lore.kernel.org/r/cover.1727881164.git.ps@pks.im
- Link to v2: https://lore.kernel.org/r/cover.1728485139.git.ps@pks.im
- Link to v3: https://lore.kernel.org/r/cover.1729254070.git.ps@pks.im
- Link to v4: https://lore.kernel.org/r/cover.1729771605.git.ps@pks.im
- Link to v5: https://lore.kernel.org/r/cover.1731335938.git.ps@pks.im
- Link to v6: https://lore.kernel.org/r/20241112-pks-meson-v6-0-648b30996827@pks.im
- Link to v7: https://lore.kernel.org/r/20241115-pks-meson-v7-0-47ec19b780b2@pks.im
- Link to v8: https://lore.kernel.org/r/20241119-pks-meson-v8-0-809bf7f042f3@pks.im
Thanks!
Patrick
---
Patrick Steinhardt (23):
Makefile: use common template for GIT-BUILD-OPTIONS
Makefile: consistently use @PLACEHOLDER@ to substitute
Makefile: refactor GIT-VERSION-GEN to be reusable
Makefile: propagate Git version via generated header
Makefile: generate "git.rc" via GIT-VERSION-GEN
Makefile: generate doc versions via GIT-VERSION-GEN
Makefile: consistently use PERL_PATH
Makefile: extract script to massage Perl scripts
Makefile: use "generate-perl.sh" to massage Perl library
Makefile: extract script to massage Shell scripts
Makefile: extract script to generate gitweb.cgi
Makefile: extract script to generate gitweb.js
Makefile: refactor generators to be PWD-independent
Makefile: allow "bin-wrappers/" directory to exist
Makefile: simplify building of templates
Documentation: allow sourcing generated includes from separate dir
Documentation: teach "cmd-list.perl" about out-of-tree builds
Documentation: extract script to generate a list of mergetools
t: better support for out-of-tree builds
t: allow overriding build dir
Documentation: add comparison of build systems
Introduce support for the Meson build system
meson: fix conflicts with in-flight topics
.gitignore | 3 +-
Documentation/.gitignore | 2 +
Documentation/CodingGuidelines | 2 +-
Documentation/Makefile | 49 +-
Documentation/{asciidoc.conf => asciidoc.conf.in} | 3 +
...-extensions.rb => asciidoctor-extensions.rb.in} | 8 +-
Documentation/build-docdep.perl | 2 +
Documentation/cmd-list.perl | 23 +-
Documentation/config/diff.txt | 2 +-
Documentation/config/merge.txt | 2 +-
Documentation/generate-mergetool-list.sh | 17 +
Documentation/git.txt | 24 +-
Documentation/meson.build | 324 ++++
Documentation/technical/build-systems.txt | 224 +++
GIT-BUILD-OPTIONS.in | 47 +
GIT-VERSION-FILE.in | 1 +
GIT-VERSION-GEN | 74 +-
Makefile | 241 ++-
bin-wrappers/.gitignore | 9 +
bin-wrappers/meson.build | 28 +
bin-wrappers/wrap-for-bin.sh | 37 +
ci/test-documentation.sh | 2 +-
configure.ac | 2 +-
contrib/buildsystems/CMakeLists.txt | 287 +--
contrib/buildsystems/git-version.in | 1 +
contrib/completion/meson.build | 8 +
contrib/meson.build | 1 +
generate-cmdlist.sh | 42 +-
generate-configlist.sh | 20 +-
generate-hooklist.sh | 15 +-
generate-perl.sh | 37 +
generate-script.sh | 34 +
git-cvsserver.perl | 2 +-
git-instaweb.sh | 8 +-
git-request-pull.sh | 2 +-
git-send-email.perl | 2 +-
git-sh-i18n.sh | 6 +-
git-sh-setup.sh | 6 +-
git-svn.perl | 2 +-
git.rc => git.rc.in | 6 +-
gitweb/GITWEB-BUILD-OPTIONS.in | 24 +
gitweb/Makefile | 62 +-
gitweb/generate-gitweb-cgi.sh | 47 +
gitweb/generate-gitweb-js.sh | 12 +
gitweb/gitweb.perl | 44 +-
gitweb/meson.build | 79 +
meson.build | 1893 ++++++++++++++++++++
meson_options.txt | 81 +
perl/FromCPAN/Mail/meson.build | 7 +
perl/FromCPAN/meson.build | 9 +
perl/Git/I18N.pm | 6 +-
perl/Git/LoadCPAN.pm | 6 +-
perl/Git/LoadCPAN/Mail/meson.build | 7 +
perl/Git/LoadCPAN/meson.build | 9 +
perl/Git/SVN/Memoize/meson.build | 7 +
perl/Git/SVN/meson.build | 20 +
perl/Git/meson.build | 18 +
perl/header_templates/fixed_prefix.template.pl | 2 +-
perl/header_templates/runtime_prefix.template.pl | 8 +-
perl/meson.build | 12 +
po/meson.build | 27 +
subprojects/.gitignore | 1 +
subprojects/curl.wrap | 13 +
subprojects/expat.wrap | 13 +
subprojects/openssl.wrap | 15 +
subprojects/pcre2.wrap | 16 +
subprojects/zlib.wrap | 13 +
t/helper/meson.build | 93 +
t/lib-gettext.sh | 4 +-
t/meson.build | 1117 ++++++++++++
t/t7609-mergetool--lib.sh | 2 +-
t/test-lib.sh | 31 +-
templates/Makefile | 39 +-
templates/branches-- | 1 -
templates/{this--description => description} | 0
.../applypatch-msg.sample} | 0
.../commit-msg.sample} | 0
.../fsmonitor-watchman.sample} | 0
templates/hooks/meson.build | 26 +
.../post-update.sample} | 0
.../pre-applypatch.sample} | 0
.../pre-commit.sample} | 0
.../pre-merge-commit.sample} | 0
.../pre-push.sample} | 0
.../pre-rebase.sample} | 0
.../pre-receive.sample} | 0
.../prepare-commit-msg.sample} | 0
.../push-to-checkout.sample} | 0
.../sendemail-validate.sample} | 0
.../{hooks--update.sample => hooks/update.sample} | 0
templates/{info--exclude => info/exclude} | 0
templates/info/meson.build | 7 +
templates/meson.build | 15 +
unimplemented.sh | 2 +-
version-def.h.in | 8 +
version.c | 1 +
wrap-for-bin.sh | 36 -
97 files changed, 4939 insertions(+), 499 deletions(-)
Range-diff versus v8:
1: b4845f3a9e = 1: ec060ce948 Makefile: use common template for GIT-BUILD-OPTIONS
2: 1289899424 ! 2: 86dc8b411e Makefile: consistently use @PLACEHOLDER@ to substitute
@@ git-svn.perl
use Carp qw/croak/;
use File::Basename qw/dirname basename/;
- ## gitk-git/po/vi.po ##
-@@
- #
- msgid ""
- msgstr ""
--"Project-Id-Version: gitk @@GIT_VERSION@@\n"
-+"Project-Id-Version: gitk @GIT_VERSION@\n"
- "Report-Msgid-Bugs-To: \n"
- "POT-Creation-Date: 2015-05-17 14:32+1000\n"
- "PO-Revision-Date: 2015-09-15 07:33+0700\n"
-
## gitweb/Makefile ##
@@ gitweb/Makefile: GITWEB_JSLIB_FILES += static/js/blame_incremental.js
3: 91f8b36d50 ! 3: 779ff8e71f Makefile: refactor GIT-VERSION-GEN to be reusable
@@ Commit message
While at it, change the format of the version file by removing the
spaces around the equals sign. Like this we can continue to include the
file in our Makefiles, but can also start to source it in shell scripts
- in subsequent steps. Furthermore, we already start to replace some
- placeholders that are not yet of relevance in this commit. These are
- going to become relevant in subsequent steps, as well.
+ in subsequent steps.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
@@ GIT-VERSION-GEN
+if test "$#" -ne 3
+then
-+ echo "USAGE: $0 <SOURCE_DIR> <INPUT> <OUTPUT>" >&2
++ echo >&2 "USAGE: $0 <SOURCE_DIR> <INPUT> <OUTPUT>"
+ exit 1
+fi
+
@@ GIT-VERSION-GEN
+
+if ! test -f "$INPUT"
+then
-+ echo "Input is not a file: $INPUT" >&2
++ echo >&2 "Input is not a file: $INPUT"
+ exit 1
+fi
+
++# Protect us from reading Git version information outside of the Git directory
++# in case it is not a repository itself, but embedded in an unrelated
++# repository.
+GIT_CEILING_DIRECTORIES="$SOURCE_DIR/.."
+export GIT_CEILING_DIRECTORIES
+
@@ GIT-VERSION-GEN
-elif { test -d "${GIT_DIR:-.git}" || test -f .git; } &&
- VN=$(git describe --match "v[0-9]*" HEAD 2>/dev/null) &&
+ VN=$(cat "$SOURCE_DIR"/version) || VN="$DEF_VER"
-+elif { test -d "$SOURCE_DIR/.git" || test -d "${GIT_DIR:-.git}" || test -f "$SOURCE_DIR"/.git; } &&
++elif {
++ test -d "$SOURCE_DIR/.git" ||
++ test -d "${GIT_DIR:-.git}" ||
++ test -f "$SOURCE_DIR"/.git;
++ } &&
+ VN=$(git -C "$SOURCE_DIR" describe --match "v[0-9]*" HEAD 2>/dev/null) &&
case "$VN" in
*$LF*) (exit 1) ;;
@@ GIT-VERSION-GEN: else
fi
-VN=$(expr "$VN" : v*'\(.*\)')
-+GIT_BUILT_FROM_COMMIT=$(git -C "$SOURCE_DIR" rev-parse -q --verify HEAD 2>/dev/null)
-+GIT_DATE=$(git -C "$SOURCE_DIR" show --quiet --format='%as')
+GIT_VERSION=$(expr "$VN" : v*'\(.*\)')
-+if test -z "$GIT_USER_AGENT"
-+then
-+ GIT_USER_AGENT=git/$GIT_VERSION
-+fi
+
-+read GIT_MAJOR_VERSION GIT_MINOR_VERSION GIT_MICRO_VERSION GIT_PATCH_LEVEL trailing <<EOF
-+$(echo "$GIT_VERSION" 0 0 0 0 | tr '.a-zA-Z-' ' ')
++read GIT_MAJOR_VERSION GIT_MINOR_VERSION GIT_MICRO_VERSION trailing <<EOF
++$(echo "$GIT_VERSION" 0 0 0 | tr '.a-zA-Z-' ' ')
+EOF
+
+sed -e "s|@GIT_VERSION@|$GIT_VERSION|" \
-+ -e "s|@GIT_DATE@|$GIT_DATE|" \
+ -e "s|@GIT_MAJOR_VERSION@|$GIT_MAJOR_VERSION|" \
+ -e "s|@GIT_MINOR_VERSION@|$GIT_MINOR_VERSION|" \
+ -e "s|@GIT_MICRO_VERSION@|$GIT_MICRO_VERSION|" \
-+ -e "s|@GIT_PATCH_LEVEL@|$GIT_PATCH_LEVEL|" \
-+ -e "s|@GIT_USER_AGENT@|$GIT_USER_AGENT|" \
-+ -e "s|@GIT_BUILT_FROM_COMMIT@|$GIT_BUILT_FROM_COMMIT|" \
+ "$INPUT" >"$OUTPUT"+
-if test -r $GVF
4: d4cf7696df ! 4: c6553540c3 Makefile: propagate Git version via generated header
@@ .gitignore
*.dsc
*.deb
+ ## GIT-VERSION-GEN ##
+@@ GIT-VERSION-GEN: else
+ fi
+
+ GIT_VERSION=$(expr "$VN" : v*'\(.*\)')
++GIT_BUILT_FROM_COMMIT=$(git -C "$SOURCE_DIR" rev-parse -q --verify HEAD 2>/dev/null)
++if test -z "$GIT_USER_AGENT"
++then
++ GIT_USER_AGENT="git/$GIT_VERSION"
++fi
+
+ read GIT_MAJOR_VERSION GIT_MINOR_VERSION GIT_MICRO_VERSION trailing <<EOF
+ $(echo "$GIT_VERSION" 0 0 0 | tr '.a-zA-Z-' ' ')
+@@ GIT-VERSION-GEN: sed -e "s|@GIT_VERSION@|$GIT_VERSION|" \
+ -e "s|@GIT_MAJOR_VERSION@|$GIT_MAJOR_VERSION|" \
+ -e "s|@GIT_MINOR_VERSION@|$GIT_MINOR_VERSION|" \
+ -e "s|@GIT_MICRO_VERSION@|$GIT_MICRO_VERSION|" \
++ -e "s|@GIT_BUILT_FROM_COMMIT@|$GIT_BUILT_FROM_COMMIT|" \
++ -e "s|@GIT_USER_AGENT@|$GIT_USER_AGENT|" \
+ "$INPUT" >"$OUTPUT"+
+
+ if ! test -f "$OUTPUT" || ! cmp "$OUTPUT"+ "$OUTPUT" >/dev/null
+
## Makefile ##
@@ Makefile: PAGER_ENV_CQ_SQ = $(subst ','\'',$(PAGER_ENV_CQ))
pager.sp pager.s pager.o: EXTRA_CPPFLAGS = \
@@ Makefile: PAGER_ENV_CQ_SQ = $(subst ','\'',$(PAGER_ENV_CQ))
$(BUILT_INS): git$X
$(QUIET_BUILT_IN)$(RM) $@ && \
+@@ Makefile: clean: profile-clean coverage-clean cocciclean
+ $(RM) $(FUZZ_PROGRAMS)
+ $(RM) $(SP_OBJ)
+ $(RM) $(HCC)
++ $(RM) version-def.h
+ $(RM) -r bin-wrappers $(dep_dirs) $(compdb_dir) compile_commands.json
+ $(RM) -r po/build/
+ $(RM) *.pyc *.pyo */*.pyc */*.pyo $(GENERATED_H) $(ETAGS_TARGET) tags cscope*
## contrib/buildsystems/CMakeLists.txt ##
@@ contrib/buildsystems/CMakeLists.txt: add_compile_definitions(PAGER_ENV="LESS=FRX LV=-c"
5: 4864744286 ! 5: 1683e96248 Makefile: generate "git.rc" via GIT-VERSION-GEN
@@ .gitignore
*.exe
*.[aos]
+ ## GIT-VERSION-GEN ##
+@@ GIT-VERSION-GEN: then
+ GIT_USER_AGENT="git/$GIT_VERSION"
+ fi
+
+-read GIT_MAJOR_VERSION GIT_MINOR_VERSION GIT_MICRO_VERSION trailing <<EOF
+-$(echo "$GIT_VERSION" 0 0 0 | tr '.a-zA-Z-' ' ')
++# While released Git versions only have three numbers, development builds also
++# have a fourth number that corresponds to the number of patches since the last
++# release.
++read GIT_MAJOR_VERSION GIT_MINOR_VERSION GIT_MICRO_VERSION GIT_PATCH_LEVEL trailing <<EOF
++$(echo "$GIT_VERSION" 0 0 0 0 | tr '.a-zA-Z-' ' ')
+ EOF
+
+ sed -e "s|@GIT_VERSION@|$GIT_VERSION|" \
+ -e "s|@GIT_MAJOR_VERSION@|$GIT_MAJOR_VERSION|" \
+ -e "s|@GIT_MINOR_VERSION@|$GIT_MINOR_VERSION|" \
+ -e "s|@GIT_MICRO_VERSION@|$GIT_MICRO_VERSION|" \
++ -e "s|@GIT_PATCH_LEVEL@|$GIT_PATCH_LEVEL|" \
+ -e "s|@GIT_BUILT_FROM_COMMIT@|$GIT_BUILT_FROM_COMMIT|" \
+ -e "s|@GIT_USER_AGENT@|$GIT_USER_AGENT|" \
+ "$INPUT" >"$OUTPUT"+
+
## Makefile ##
@@ Makefile: $(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEFINES
$(QUIET_GEN)$(cmd_munge_script) && \
@@ Makefile: $(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEFINES
# This makes sure we depend on the NO_PERL setting itself.
$(SCRIPT_PERL_GEN): GIT-BUILD-OPTIONS
+@@ Makefile: clean: profile-clean coverage-clean cocciclean
+ $(RM) -r .build $(UNIT_TEST_BIN)
+ $(RM) GIT-TEST-SUITES
+ $(RM) po/git.pot po/git-core.pot
+- $(RM) git.res
++ $(RM) git.rc git.res
+ $(RM) $(OBJECTS)
+ $(RM) headless-git.o
+ $(RM) $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB)
## contrib/buildsystems/CMakeLists.txt ##
@@ contrib/buildsystems/CMakeLists.txt: list(TRANSFORM reftable_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
6: 48feeec815 ! 6: 517a961056 Makefile: generate doc versions via GIT-VERSION-GEN
@@ Documentation/Makefile: ASCIIDOC_DEPS = asciidoctor-extensions.rb GIT-ASCIIDOCFL
endif
ASCIIDOC_DEPS += docinfo.html
+@@ Documentation/Makefile: clean:
+ $(RM) SubmittingPatches.txt
+ $(RM) $(cmds_txt) $(mergetools_txt) *.made
+ $(RM) GIT-ASCIIDOCFLAGS
++ $(RM) asciidoc.conf asciidoctor-extensions.rb
+
+ docinfo.html: docinfo-html.in
+ $(QUIET_GEN)$(RM) $@ && cat $< >$@
@@ Documentation/Makefile: manpage-cmd = $(QUIET_XMLTO)$(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
%.xml : %.txt $(ASCIIDOC_DEPS)
$(QUIET_ASCIIDOC)$(TXT_TO_XML) -d manpage -o $@ $<
@@ Documentation/Makefile: manpage-cmd = $(QUIET_XMLTO)$(XMLTO) -m $(MANPAGE_XSL) $
$(QUIET_ASCIIDOC)$(TXT_TO_XML) -d book -o $@ $<
technical/api-index.txt: technical/api-index-skel.txt \
+@@ Documentation/Makefile: technical/api-index.txt: technical/api-index-skel.txt \
+
+ technical/%.html: ASCIIDOC_EXTRA += -a git-relative-html-prefix=../
+ $(patsubst %,%.html,$(API_DOCS) technical/api-index $(TECH_DOCS)): %.html : %.txt \
+- asciidoc.conf GIT-ASCIIDOCFLAGS
++ $(ASCIIDOC_DEPS)
+ $(QUIET_ASCIIDOC)$(TXT_TO_HTML) $*.txt
+
+ SubmittingPatches.txt: SubmittingPatches
## Documentation/asciidoc.conf => Documentation/asciidoc.conf.in ##
@@ Documentation/asciidoc.conf.in: tilde=~
@@ Documentation/asciidoctor-extensions.rb.in: module Git
output = output.sub(/<\/refmeta>/, new_tags + "</refmeta>")
end
output
+
+ ## GIT-VERSION-GEN ##
+@@ GIT-VERSION-GEN: fi
+
+ GIT_VERSION=$(expr "$VN" : v*'\(.*\)')
+ GIT_BUILT_FROM_COMMIT=$(git -C "$SOURCE_DIR" rev-parse -q --verify HEAD 2>/dev/null)
++GIT_DATE=$(git -C "$SOURCE_DIR" show --quiet --format='%as' 2>/dev/null)
+ if test -z "$GIT_USER_AGENT"
+ then
+ GIT_USER_AGENT="git/$GIT_VERSION"
+@@ GIT-VERSION-GEN: sed -e "s|@GIT_VERSION@|$GIT_VERSION|" \
+ -e "s|@GIT_PATCH_LEVEL@|$GIT_PATCH_LEVEL|" \
+ -e "s|@GIT_BUILT_FROM_COMMIT@|$GIT_BUILT_FROM_COMMIT|" \
+ -e "s|@GIT_USER_AGENT@|$GIT_USER_AGENT|" \
++ -e "s|@GIT_DATE@|$GIT_DATE|" \
+ "$INPUT" >"$OUTPUT"+
+
+ if ! test -f "$OUTPUT" || ! cmp "$OUTPUT"+ "$OUTPUT" >/dev/null
7: bc92451eb5 = 7: d5f0d9b3ca Makefile: consistently use PERL_PATH
8: bdb6dd42d3 ! 8: 38ca197462 Makefile: extract script to massage Perl scripts
@@ generate-perl.sh (new)
+
+if test $# -ne 5
+then
-+ echo "USAGE: $0 <GIT_BUILD_OPTIONS> <GIT_VERSION_FILE> <PERL_HEADER> <INPUT> <OUTPUT>" >&2
++ echo >&2 "USAGE: $0 <GIT_BUILD_OPTIONS> <GIT_VERSION_FILE> <PERL_HEADER> <INPUT> <OUTPUT>"
+ exit 1
+fi
+
9: d8eef36b36 = 9: d7c9edc4ab Makefile: use "generate-perl.sh" to massage Perl library
10: b9280e87d8 ! 10: 45352a2964 Makefile: extract script to massage Shell scripts
@@ generate-script.sh (new)
+
+if test $# -ne 3
+then
-+ echo "USAGE: $0 <INPUT> <OUTPUT> <GIT-BUILD-OPTIONS>" >&2
++ echo >&2 "USAGE: $0 <INPUT> <OUTPUT> <GIT-BUILD-OPTIONS>"
+ exit 1
+fi
+
11: bf399eb934 ! 11: d3a886a2e8 Makefile: extract script to generate gitweb.cgi
@@ gitweb/generate-gitweb-cgi.sh (new)
+
+if test $# -ne 4
+then
-+ echo "USAGE: $0 <GITWEB-BUILD-OPTIONS> <GIT-VERSION-FILE> <INPUT> <OUTPUT>" >&2
++ echo >&2 "USAGE: $0 <GITWEB-BUILD-OPTIONS> <GIT-VERSION-FILE> <INPUT> <OUTPUT>"
+ exit 1
+fi
+
12: 38d4103b1f ! 12: bb33f5c943 Makefile: extract script to generate gitweb.js
@@ gitweb/generate-gitweb-js.sh (new)
+
+if test "$#" -lt 2
+then
-+ echo "USAGE: $0 <OUTPUT> <INPUT>..." >&2
++ echo >&2 "USAGE: $0 <OUTPUT> <INPUT>..."
+ exit 1
+fi
+
13: 7ff4832b1f ! 13: 22c54e4e4b Makefile: refactor generators to be PWD-independent
@@ generate-configlist.sh
+
+if test -z "$SOURCE_DIR" || ! test -d "$SOURCE_DIR" || test -z "$OUTPUT"
+then
-+ echo "USAGE: $0 <SOURCE_DIR> <OUTPUT>" >&2
++ echo >&2 "USAGE: $0 <SOURCE_DIR> <OUTPUT>"
+ exit 1
+fi
@@ generate-hooklist.sh
+
+if test -z "$SOURCE_DIR" || ! test -d "$SOURCE_DIR" || test -z "$OUTPUT"
+then
-+ echo "USAGE: $0 <SOURCE_DIR> <OUTPUT>" >&2
++ echo >&2 "USAGE: $0 <SOURCE_DIR> <OUTPUT>"
+ exit 1
+fi
+
14: 89d260e6d9 ! 14: 8ace5376ec Makefile: allow "bin-wrappers/" directory to exist
@@ Makefile: test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_
-e 's|@BUILD_DIR@|$(shell pwd)|' \
-e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
@@ Makefile: clean: profile-clean coverage-clean cocciclean
- $(RM) $(FUZZ_PROGRAMS)
$(RM) $(SP_OBJ)
$(RM) $(HCC)
+ $(RM) version-def.h
- $(RM) -r bin-wrappers $(dep_dirs) $(compdb_dir) compile_commands.json
+ $(RM) -r $(dep_dirs) $(compdb_dir) compile_commands.json
+ $(RM) $(test_bindir_programs)
15: 0f53ade4b8 = 15: 68f4dcfbda Makefile: simplify building of templates
16: 6b8d5bc612 = 16: 2ae9c4d2f4 Documentation: allow sourcing generated includes from separate dir
17: 66e7a00010 = 17: f70ce79687 Documentation: teach "cmd-list.perl" about out-of-tree builds
18: 00a894ea08 ! 18: 31d4d55c7e Documentation: extract script to generate a list of mergetools
@@ Documentation/generate-mergetool-list.sh (new)
+
+if test "$#" -ne 3
+then
-+ echo "USAGE: $0 <SOURCE_DIR> <MODE> <OUTPUT>" >&2
++ echo >&2 "USAGE: $0 <SOURCE_DIR> <MODE> <OUTPUT>"
+ exit 1
+fi
+
19: 41c0f2d3f6 = 19: 482e166556 t: better support for out-of-tree builds
20: a548eaa6be = 20: c13463c792 t: allow overriding build dir
21: c270bf16b8 = 21: e32a07da87 Documentation: add comparison of build systems
22: f006635102 ! 22: bd09f835a5 Introduce support for the Meson build system
@@ meson.build (new)
+ program_path += [ 'C:/Program Files/Git/bin', 'C:/Program Files/Git/usr/bin' ]
+endif
+
-+awk = find_program('awk', dirs: program_path)
+cygpath = find_program('cygpath', dirs: program_path, required: false)
+diff = find_program('diff', dirs: program_path)
+shell = find_program('sh', dirs: program_path)
@@ t/meson.build (new)
+clar_decls_h = custom_target(
+ input: clar_test_suites,
+ output: 'clar-decls.h',
-+ command : [shell, meson.current_source_dir() + '/unit-tests/generate-clar-decls.sh', '@OUTPUT@', '@INPUT@'],
++ command : [
++ shell,
++ meson.current_source_dir() + '/unit-tests/generate-clar-decls.sh',
++ '@OUTPUT@',
++ '@INPUT@',
++ ],
+ env: script_environment,
+)
+clar_sources += clar_decls_h
@@ t/meson.build (new)
+clar_sources += custom_target(
+ input: clar_decls_h,
+ output: 'clar.suite',
-+ feed: true,
-+ capture: true,
-+ command : [awk, '-f', meson.current_source_dir() + '/unit-tests/clar-generate.awk'],
++ command : [
++ shell,
++ meson.current_source_dir() + '/unit-tests/generate-clar-suites.sh',
++ '@INPUT@',
++ '@OUTPUT@',
++ ],
++ env: script_environment,
+)
+
+clar_unit_tests = executable('unit-tests',
23: 00a3db6810 ! 23: ff646a148a meson: fix conflicts with in-flight topics
@@ Commit message
- cc/promisor-remote-capability adds t5710.
- - ds/path-walk adds t6601 as well as "path-walk.c" and
+ - ds/path-walk-1 adds t6601 as well as "path-walk.c" and
"test-path-walk.c".
- ps/reftable-detach adds "reftable/system.c".
- js/libgit-rust adds "common-exit.c" and "common-init.c".
- - ps/clar-build-improvement adapts the awk(1) script that generates
- "clar.suites" to instead be a shell script.
-
- ds/full-name-hash adds "t/helper/test-name-hash.c".
- cw/worktree-extension deletes t2408.
@@ t/helper/meson.build: test_tool_sources = [
'test-proc-receive.c',
## t/meson.build ##
-@@ t/meson.build: clar_sources += clar_decls_h
- clar_sources += custom_target(
- input: clar_decls_h,
- output: 'clar.suite',
-- feed: true,
-- capture: true,
-- command : [awk, '-f', meson.current_source_dir() + '/unit-tests/clar-generate.awk'],
-+ command : [shell, meson.current_source_dir() + '/unit-tests/generate-clar-suites.sh', '@INPUT@', '@OUTPUT@'],
-+ env: script_environment,
- )
-
- clar_unit_tests = executable('unit-tests',
@@ t/meson.build: integration_tests = [
't1014-read-tree-confusing.sh',
't1015-read-index-unmerged.sh',
---
base-commit: dbfa873276ccefac0b426e46f31101ecdbcf4f40
change-id: 20241112-pks-meson-95b665c08f06
^ permalink raw reply [flat|nested] 386+ messages in thread
* [PATCH v9 01/23] Makefile: use common template for GIT-BUILD-OPTIONS
2024-11-25 9:56 ` [PATCH v9 " Patrick Steinhardt
@ 2024-11-25 9:56 ` Patrick Steinhardt
2024-11-25 9:56 ` [PATCH v9 02/23] Makefile: consistently use @PLACEHOLDER@ to substitute Patrick Steinhardt
` (21 subsequent siblings)
22 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-25 9:56 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
The "GIT-BUILD-OPTIONS" file is generated by our build systems to
propagate built-in features and paths to our tests. The generation is
done ad-hoc, where both our Makefile and the CMake build instructions
simply echo a bunch of strings into the file. This makes it very hard to
figure out what variables are expected to exist and what format they
have, and the written variables can easily get out of sync between build
systems.
Introduce a new "GIT-BUILD-OPTIONS.in" template to address this issue.
This has multiple advantages:
- It demonstrates which built options exist in the first place.
- It can serve as a spot to document the build options.
- Some build systems complain when not all variables could be
substituted, alerting us of mismatches. Others don't, but if we
forgot to substitute such variables we now have a bogus string that
will likely cause our tests to fail, if they have any meaning in the
first place.
Backfill values that we didn't yet set in our CMake build instructions.
While at it, remove the `SUPPORTS_SIMPLE_IPC` variable that we only set
up in CMake as it isn't used anywhere.
This change requires us to adapt the setup of TEST_OUTPUT_DIRECTORY in
"test-lib.sh" such that it does not get overwritten after sourcing when
it has been set up via the environment. This is the only instance I
could find where we rely on ordering on variables.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-BUILD-OPTIONS.in | 36 +++++++++++
Makefile | 115 ++++++++++++++----------------------
contrib/buildsystems/CMakeLists.txt | 58 ++++++++++++------
t/test-lib.sh | 22 +++++--
4 files changed, 136 insertions(+), 95 deletions(-)
diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in
new file mode 100644
index 0000000000000000000000000000000000000000..f0ca240493c94aa41a6b6241a8474e42f7cdc8b9
--- /dev/null
+++ b/GIT-BUILD-OPTIONS.in
@@ -0,0 +1,36 @@
+SHELL_PATH=@SHELL_PATH@
+TEST_SHELL_PATH=@TEST_SHELL_PATH@
+PERL_PATH=@PERL_PATH@
+DIFF=@DIFF@
+PYTHON_PATH=@PYTHON_PATH@
+TAR=@TAR@
+NO_CURL=@NO_CURL@
+NO_ICONV=@NO_ICONV@
+NO_EXPAT=@NO_EXPAT@
+USE_LIBPCRE2=@USE_LIBPCRE2@
+NO_PERL=@NO_PERL@
+NO_PTHREADS=@NO_PTHREADS@
+NO_PYTHON=@NO_PYTHON@
+NO_REGEX=@NO_REGEX@
+NO_UNIX_SOCKETS=@NO_UNIX_SOCKETS@
+PAGER_ENV=@PAGER_ENV@
+SANITIZE_LEAK=@SANITIZE_LEAK@
+SANITIZE_ADDRESS=@SANITIZE_ADDRESS@
+X=@X@
+FSMONITOR_DAEMON_BACKEND=@FSMONITOR_DAEMON_BACKEND@
+FSMONITOR_OS_SETTINGS=@FSMONITOR_OS_SETTINGS@
+TEST_OUTPUT_DIRECTORY=@TEST_OUTPUT_DIRECTORY@
+GIT_TEST_OPTS=@GIT_TEST_OPTS@
+GIT_TEST_CMP=@GIT_TEST_CMP@
+GIT_TEST_CMP_USE_COPIED_CONTEXT=@GIT_TEST_CMP_USE_COPIED_CONTEXT@
+GIT_TEST_UTF8_LOCALE=@GIT_TEST_UTF8_LOCALE@
+NO_GETTEXT=@NO_GETTEXT@
+GIT_PERF_REPEAT_COUNT=@GIT_PERF_REPEAT_COUNT@
+GIT_PERF_REPO=@GIT_PERF_REPO@
+GIT_PERF_LARGE_REPO=@GIT_PERF_LARGE_REPO@
+GIT_PERF_MAKE_OPTS=@GIT_PERF_MAKE_OPTS@
+GIT_PERF_MAKE_COMMAND=@GIT_PERF_MAKE_COMMAND@
+GIT_INTEROP_MAKE_OPTS=@GIT_INTEROP_MAKE_OPTS@
+GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@
+GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@
+RUNTIME_PREFIX=@RUNTIME_PREFIX@
diff --git a/Makefile b/Makefile
index 549b24e7fdbbdc173dfec79cdaddf67ccba52e14..1f8434a902fa50035c29aecd0ac64c68e0f5db4f 100644
--- a/Makefile
+++ b/Makefile
@@ -3160,80 +3160,55 @@ GIT-LDFLAGS: FORCE
echo "$$FLAGS" >GIT-LDFLAGS; \
fi
+ifdef RUNTIME_PREFIX
+RUNTIME_PREFIX_OPTION = true
+else
+RUNTIME_PREFIX_OPTION = false
+endif
+
# We need to apply sq twice, once to protect from the shell
# that runs GIT-BUILD-OPTIONS, and then again to protect it
# and the first level quoting from the shell that runs "echo".
GIT-BUILD-OPTIONS: FORCE
- @echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@+
- @echo TEST_SHELL_PATH=\''$(subst ','\'',$(TEST_SHELL_PATH_SQ))'\' >>$@+
- @echo PERL_PATH=\''$(subst ','\'',$(PERL_PATH_SQ))'\' >>$@+
- @echo DIFF=\''$(subst ','\'',$(subst ','\'',$(DIFF)))'\' >>$@+
- @echo PYTHON_PATH=\''$(subst ','\'',$(PYTHON_PATH_SQ))'\' >>$@+
- @echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@+
- @echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@+
- @echo NO_ICONV=\''$(subst ','\'',$(subst ','\'',$(NO_ICONV)))'\' >>$@+
- @echo NO_EXPAT=\''$(subst ','\'',$(subst ','\'',$(NO_EXPAT)))'\' >>$@+
- @echo USE_LIBPCRE2=\''$(subst ','\'',$(subst ','\'',$(USE_LIBPCRE2)))'\' >>$@+
- @echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@+
- @echo NO_PTHREADS=\''$(subst ','\'',$(subst ','\'',$(NO_PTHREADS)))'\' >>$@+
- @echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@+
- @echo NO_REGEX=\''$(subst ','\'',$(subst ','\'',$(NO_REGEX)))'\' >>$@+
- @echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@+
- @echo PAGER_ENV=\''$(subst ','\'',$(subst ','\'',$(PAGER_ENV)))'\' >>$@+
- @echo SANITIZE_LEAK=\''$(subst ','\'',$(subst ','\'',$(SANITIZE_LEAK)))'\' >>$@+
- @echo SANITIZE_ADDRESS=\''$(subst ','\'',$(subst ','\'',$(SANITIZE_ADDRESS)))'\' >>$@+
- @echo X=\'$(X)\' >>$@+
-ifdef FSMONITOR_DAEMON_BACKEND
- @echo FSMONITOR_DAEMON_BACKEND=\''$(subst ','\'',$(subst ','\'',$(FSMONITOR_DAEMON_BACKEND)))'\' >>$@+
-endif
-ifdef FSMONITOR_OS_SETTINGS
- @echo FSMONITOR_OS_SETTINGS=\''$(subst ','\'',$(subst ','\'',$(FSMONITOR_OS_SETTINGS)))'\' >>$@+
-endif
-ifdef TEST_OUTPUT_DIRECTORY
- @echo TEST_OUTPUT_DIRECTORY=\''$(subst ','\'',$(subst ','\'',$(TEST_OUTPUT_DIRECTORY)))'\' >>$@+
-endif
-ifdef GIT_TEST_OPTS
- @echo GIT_TEST_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_OPTS)))'\' >>$@+
-endif
-ifdef GIT_TEST_CMP
- @echo GIT_TEST_CMP=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_CMP)))'\' >>$@+
-endif
-ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
- @echo GIT_TEST_CMP_USE_COPIED_CONTEXT=YesPlease >>$@+
-endif
-ifdef GIT_TEST_UTF8_LOCALE
- @echo GIT_TEST_UTF8_LOCALE=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_UTF8_LOCALE)))'\' >>$@+
-endif
- @echo NO_GETTEXT=\''$(subst ','\'',$(subst ','\'',$(NO_GETTEXT)))'\' >>$@+
-ifdef GIT_PERF_REPEAT_COUNT
- @echo GIT_PERF_REPEAT_COUNT=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPEAT_COUNT)))'\' >>$@+
-endif
-ifdef GIT_PERF_REPO
- @echo GIT_PERF_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPO)))'\' >>$@+
-endif
-ifdef GIT_PERF_LARGE_REPO
- @echo GIT_PERF_LARGE_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_LARGE_REPO)))'\' >>$@+
-endif
-ifdef GIT_PERF_MAKE_OPTS
- @echo GIT_PERF_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_OPTS)))'\' >>$@+
-endif
-ifdef GIT_PERF_MAKE_COMMAND
- @echo GIT_PERF_MAKE_COMMAND=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_COMMAND)))'\' >>$@+
-endif
-ifdef GIT_INTEROP_MAKE_OPTS
- @echo GIT_INTEROP_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_INTEROP_MAKE_OPTS)))'\' >>$@+
-endif
-ifdef GIT_TEST_INDEX_VERSION
- @echo GIT_TEST_INDEX_VERSION=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_INDEX_VERSION)))'\' >>$@+
-endif
-ifdef GIT_TEST_PERL_FATAL_WARNINGS
- @echo GIT_TEST_PERL_FATAL_WARNINGS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_PERL_FATAL_WARNINGS)))'\' >>$@+
-endif
-ifdef RUNTIME_PREFIX
- @echo RUNTIME_PREFIX=\'true\' >>$@+
-else
- @echo RUNTIME_PREFIX=\'false\' >>$@+
-endif
+ @sed \
+ -e "s|@SHELL_PATH@|\'$(SHELL_PATH_SQ)\'|" \
+ -e "s|@TEST_SHELL_PATH@|\'$(TEST_SHELL_PATH_SQ)\'|" \
+ -e "s|@PERL_PATH@|\'$(PERL_PATH_SQ)\'|" \
+ -e "s|@DIFF@|\'$(DIFF)\'|" \
+ -e "s|@PYTHON_PATH@|\'$(PYTHON_PATH_SQ)\'|" \
+ -e "s|@TAR@|\'$(TAR)\'|" \
+ -e "s|@NO_CURL@|\'$(NO_CURL)\'|" \
+ -e "s|@NO_ICONV@|\'$(NO_ICONV)\'|" \
+ -e "s|@NO_EXPAT@|\'$(NO_EXPAT)\'|" \
+ -e "s|@USE_LIBPCRE2@|\'$(USE_LIBPCRE2)\'|" \
+ -e "s|@NO_PERL@|\'$(NO_PERL)\'|" \
+ -e "s|@NO_PTHREADS@|\'$(NO_PTHREADS)\'|" \
+ -e "s|@NO_PYTHON@|\'$(NO_PYTHON)\'|" \
+ -e "s|@NO_REGEX@|\'$(NO_REGEX)\'|" \
+ -e "s|@NO_UNIX_SOCKETS@|\'$(NO_UNIX_SOCKETS)\'|" \
+ -e "s|@PAGER_ENV@|\'$(PAGER_ENV)\'|" \
+ -e "s|@SANITIZE_LEAK@|\'$(SANITIZE_LEAK)\'|" \
+ -e "s|@SANITIZE_ADDRESS@|\'$(SANITIZE_ADDRESS)\'|" \
+ -e "s|@X@|\'$(X)\'|" \
+ -e "s|@FSMONITOR_DAEMON_BACKEND@|\'$(FSMONITOR_DAEMON_BACKEND)\'|" \
+ -e "s|@FSMONITOR_OS_SETTINGS@|\'$(FSMONITOR_OS_SETTINGS)\'|" \
+ -e "s|@TEST_OUTPUT_DIRECTORY@|\'$(TEST_OUTPUT_DIRECTORY)\'|" \
+ -e "s|@GIT_TEST_OPTS@|\'$(GIT_TEST_OPTS)\'|" \
+ -e "s|@GIT_TEST_CMP@|\'$(GIT_TEST_CMP)\'|" \
+ -e "s|@GIT_TEST_CMP_USE_COPIED_CONTEXT@|\'$(GIT_TEST_CMP_USE_COPIED_CONTEXT)\'|" \
+ -e "s|@GIT_TEST_UTF8_LOCALE@|\'$(GIT_TEST_UTF8_LOCALE)\'|" \
+ -e "s|@NO_GETTEXT@|\'$(NO_GETTEXT)\'|" \
+ -e "s|@GIT_PERF_REPEAT_COUNT@|\'$(GIT_PERF_REPEAT_COUNT)\'|" \
+ -e "s|@GIT_PERF_REPO@|\'$(GIT_PERF_REPO)\'|" \
+ -e "s|@GIT_PERF_LARGE_REPO@|\'$(GIT_PERF_LARGE_REPO)\'|" \
+ -e "s|@GIT_PERF_MAKE_OPTS@|\'$(GIT_PERF_MAKE_OPTS)\'|" \
+ -e "s|@GIT_PERF_MAKE_COMMAND@|\'$(GIT_PERF_MAKE_COMMAND)\'|" \
+ -e "s|@GIT_INTEROP_MAKE_OPTS@|\'$(GIT_INTEROP_MAKE_OPTS)\'|" \
+ -e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \
+ -e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \
+ -e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX_OPTION)\'|" \
+ GIT-BUILD-OPTIONS.in >$@+
+ @if grep -q '^[A-Z][A-Z_]*=@.*@$$' $@+; then echo "Unsubstituted build options in $@" >&2 && exit 1; fi
@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
@if test -f GIT-BUILD-DIR; then rm GIT-BUILD-DIR; fi
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 8c71f5a1d0290c9204e094fb266f10c7b70af9fb..985004f5943128483e2138cd61aca8bd8ccbd240 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -1125,27 +1125,47 @@ if(NOT PYTHON_TESTS)
set(NO_PYTHON 1)
endif()
-file(WRITE ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "SHELL_PATH='${SHELL_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "TEST_SHELL_PATH='${TEST_SHELL_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PERL_PATH='${PERL_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "DIFF='${DIFF}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PYTHON_PATH='${PYTHON_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "TAR='${TAR}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_CURL='${NO_CURL}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_ICONV='${NO_ICONV}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_EXPAT='${NO_EXPAT}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PERL='${NO_PERL}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PTHREADS='${NO_PTHREADS}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_UNIX_SOCKETS='${NO_UNIX_SOCKETS}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PAGER_ENV='${PAGER_ENV}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "X='${EXE_EXTENSION}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_GETTEXT='${NO_GETTEXT}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "RUNTIME_PREFIX='${RUNTIME_PREFIX}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PYTHON='${NO_PYTHON}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "SUPPORTS_SIMPLE_IPC='${SUPPORTS_SIMPLE_IPC}'\n")
+file(STRINGS ${CMAKE_SOURCE_DIR}/GIT-BUILD-OPTIONS.in git_build_options NEWLINE_CONSUME)
+string(REPLACE "@SHELL_PATH@" "'${SHELL_PATH}'" git_build_options "${git_build_options}")
+string(REPLACE "@TEST_SHELL_PATH@" "'${TEST_SHELL_PATH}'" git_build_options "${git_build_options}")
+string(REPLACE "@PERL_PATH@" "'${PERL_PATH}'" git_build_options "${git_build_options}")
+string(REPLACE "@DIFF@" "'${DIFF}'" git_build_options "${git_build_options}")
+string(REPLACE "@PYTHON_PATH@" "'${PYTHON_PATH}'" git_build_options "${git_build_options}")
+string(REPLACE "@TAR@" "'${TAR}'" git_build_options "${git_build_options}")
+string(REPLACE "@NO_CURL@" "${NO_CURL}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_ICONV@" "${NO_ICONV}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_EXPAT@" "${NO_EXPAT}" git_build_options "${git_build_options}")
+string(REPLACE "@USE_LIBPCRE2@" "" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PERL@" "${NO_PERL}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PTHREADS@" "${NO_PTHREADS}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PYTHON@" "${NO_PYTHON}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_REGEX@" "" git_build_options "${git_build_options}")
+string(REPLACE "@NO_UNIX_SOCKETS@" "${NO_UNIX_SOCKETS}" git_build_options "${git_build_options}")
+string(REPLACE "@PAGER_ENV@" "'${PAGER_ENV}'" git_build_options "${git_build_options}")
+string(REPLACE "@SANITIZE_LEAK@" "" git_build_options "${git_build_options}")
+string(REPLACE "@SANITIZE_ADDRESS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@X@" "${EXE_EXTENSION}" git_build_options "${git_build_options}")
+string(REPLACE "@FSMONITOR_DAEMON_BACKEND@" "win32" git_build_options "${git_build_options}")
+string(REPLACE "@FSMONITOR_OS_SETTINGS@" "win32" git_build_options "${git_build_options}")
+string(REPLACE "@TEST_OUTPUT_DIRECTORY@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_OPTS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_CMP@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_CMP_USE_COPIED_CONTEXT@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_UTF8_LOCALE@" "" git_build_options "${git_build_options}")
+string(REPLACE "@NO_GETTEXT@" "${NO_GETTEXT}" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_REPEAT_COUNT@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_REPO@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_LARGE_REPO@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_MAKE_OPTS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_MAKE_COMMAND@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@RUNTIME_PREFIX@" "'${RUNTIME_PREFIX}'" git_build_options "${git_build_options}")
if(USE_VCPKG)
- file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
+ string(APPEND git_build_options "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
endif()
+file(WRITE ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS ${git_build_options})
#Make the tests work when building out of the source tree
get_filename_component(CACHE_PATH ${CMAKE_CURRENT_LIST_DIR}/../../CMakeCache.txt ABSOLUTE)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 6c60e8adae8c3daf39ceb8afc8c4938fa7fc48a4..cca6a09c68cb9d08c37b0ded3150118767153b9f 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -35,12 +35,6 @@ else
# needing to exist.
TEST_DIRECTORY=$(cd "$TEST_DIRECTORY" && pwd) || exit 1
fi
-if test -z "$TEST_OUTPUT_DIRECTORY"
-then
- # Similarly, override this to store the test-results subdir
- # elsewhere
- TEST_OUTPUT_DIRECTORY=$TEST_DIRECTORY
-fi
GIT_BUILD_DIR="${TEST_DIRECTORY%/t}"
if test "$TEST_DIRECTORY" = "$GIT_BUILD_DIR"
then
@@ -92,6 +86,15 @@ export LSAN_OPTIONS
prepend_var UBSAN_OPTIONS : $GIT_SAN_OPTIONS
export UBSAN_OPTIONS
+# The TEST_OUTPUT_DIRECTORY will be overwritten via GIT-BUILD-OPTIONS. So in
+# case the caller has manually set up this variable via the environment we must
+# make sure to not overwrite that value, and thus we save it into
+# TEST_OUTPUT_DIRECTORY_OVERRIDE here.
+if test -n "$TEST_OUTPUT_DIRECTORY" && test -z "$TEST_OUTPUT_DIRECTORY_OVERRIDE"
+then
+ TEST_OUTPUT_DIRECTORY_OVERRIDE=$TEST_OUTPUT_DIRECTORY
+fi
+
if test ! -f "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
then
echo >&2 'error: GIT-BUILD-OPTIONS missing (has Git been built?).'
@@ -100,6 +103,13 @@ fi
. "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
export PERL_PATH SHELL_PATH
+if test -z "$TEST_OUTPUT_DIRECTORY"
+then
+ # Similarly, override this to store the test-results subdir
+ # elsewhere
+ TEST_OUTPUT_DIRECTORY=$TEST_DIRECTORY
+fi
+
# In t0000, we need to override test directories of nested testcases. In case
# the developer has TEST_OUTPUT_DIRECTORY part of his build options, then we'd
# reset this value to instead contain what the developer has specified. We thus
--
2.47.0.274.g962d0b743d.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v9 02/23] Makefile: consistently use @PLACEHOLDER@ to substitute
2024-11-25 9:56 ` [PATCH v9 " Patrick Steinhardt
2024-11-25 9:56 ` [PATCH v9 01/23] Makefile: use common template for GIT-BUILD-OPTIONS Patrick Steinhardt
@ 2024-11-25 9:56 ` Patrick Steinhardt
2024-11-25 9:56 ` [PATCH v9 03/23] Makefile: refactor GIT-VERSION-GEN to be reusable Patrick Steinhardt
` (20 subsequent siblings)
22 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-25 9:56 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
We have a bunch of placeholders in our scripts that we replace at build
time, for example by using sed(1). These placeholders come in three
different formats: @PLACEHOLDER@, @@PLACEHOLDER@@ and ++PLACEHOLDER++.
Next to being inconsistent it also creates a bit of a problem with
CMake, which only supports the first syntax in its `configure_file()`
function. To work around that we instead manually replace placeholders
via string operations, which is a hassle and removes safeguards that
CMake has to verify that we didn't forget to replace any placeholders.
Besides that, other build systems like Meson also support the CMake
syntax.
Unify our codebase to consistently use the syntax supported by such
build systems.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 44 ++++++++++++------------
configure.ac | 2 +-
contrib/buildsystems/CMakeLists.txt | 34 +++++++++---------
git-cvsserver.perl | 2 +-
git-instaweb.sh | 8 ++---
git-request-pull.sh | 2 +-
git-send-email.perl | 2 +-
git-sh-i18n.sh | 6 ++--
git-sh-setup.sh | 6 ++--
git-svn.perl | 2 +-
gitweb/Makefile | 44 ++++++++++++------------
gitweb/gitweb.perl | 44 ++++++++++++------------
perl/Git/I18N.pm | 6 ++--
perl/Git/LoadCPAN.pm | 6 ++--
| 2 +-
| 8 ++---
unimplemented.sh | 2 +-
wrap-for-bin.sh | 18 +++++-----
18 files changed, 119 insertions(+), 119 deletions(-)
diff --git a/Makefile b/Makefile
index 1f8434a902fa50035c29aecd0ac64c68e0f5db4f..75e26d2e312f186bd5a0e3b48fb38850613bca4b 100644
--- a/Makefile
+++ b/Makefile
@@ -1555,10 +1555,10 @@ endif
ifdef SANE_TOOL_PATH
SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH))
-BROKEN_PATH_FIX = 's|^\# @@BROKEN_PATH_FIX@@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|'
+BROKEN_PATH_FIX = 's|^\# @BROKEN_PATH_FIX@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|'
PATH := $(SANE_TOOL_PATH):${PATH}
else
-BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d'
+BROKEN_PATH_FIX = '/^\# @BROKEN_PATH_FIX@$$/d'
endif
ifeq (,$(HOST_CPU))
@@ -2548,13 +2548,13 @@ GIT-SCRIPT-DEFINES: FORCE
define cmd_munge_script
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
- -e 's|@@DIFF@@|$(DIFF_SQ)|' \
- -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' \
- -e 's/@@USE_GETTEXT_SCHEME@@/$(USE_GETTEXT_SCHEME)/g' \
+ -e 's|@DIFF@|$(DIFF_SQ)|' \
+ -e 's|@LOCALEDIR@|$(localedir_SQ)|g' \
+ -e 's/@USE_GETTEXT_SCHEME@/$(USE_GETTEXT_SCHEME)/g' \
-e $(BROKEN_PATH_FIX) \
- -e 's|@@GITWEBDIR@@|$(gitwebdir_SQ)|g' \
- -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
- -e 's|@@PAGER_ENV@@|$(PAGER_ENV_SQ)|g' \
+ -e 's|@GITWEBDIR@|$(gitwebdir_SQ)|g' \
+ -e 's|@PERL@|$(PERL_PATH_SQ)|g' \
+ -e 's|@PAGER_ENV@|$(PAGER_ENV_SQ)|g' \
$@.sh >$@+
endef
@@ -2611,7 +2611,7 @@ $(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
-e ' r GIT-PERL-HEADER' \
-e ' G' \
-e '}' \
- -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
+ -e 's/@GIT_VERSION@/$(GIT_VERSION)/g' \
$< >$@+ && \
chmod +x $@+ && \
mv $@+ $@
@@ -2629,11 +2629,11 @@ GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile
INSTLIBDIR='$(perllibdir_SQ)' && \
INSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \
INSTLIBDIR="$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}" && \
- sed -e 's=@@PATHSEP@@=$(pathsep)=g' \
- -e "s=@@INSTLIBDIR@@=$$INSTLIBDIR=g" \
- -e 's=@@PERLLIBDIR_REL@@=$(perllibdir_relative_SQ)=g' \
- -e 's=@@GITEXECDIR_REL@@=$(gitexecdir_relative_SQ)=g' \
- -e 's=@@LOCALEDIR_REL@@=$(localedir_relative_SQ)=g' \
+ sed -e 's=@PATHSEP@=$(pathsep)=g' \
+ -e "s=@INSTLIBDIR@=$$INSTLIBDIR=g" \
+ -e 's=@PERLLIBDIR_REL@=$(perllibdir_relative_SQ)=g' \
+ -e 's=@GITEXECDIR_REL@=$(gitexecdir_relative_SQ)=g' \
+ -e 's=@LOCALEDIR_REL@=$(localedir_relative_SQ)=g' \
$< >$@+ && \
mv $@+ $@
@@ -2649,7 +2649,7 @@ else # NO_PERL
$(SCRIPT_PERL_GEN) git-instaweb: % : unimplemented.sh
$(QUIET_GEN) \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@@REASON@@|NO_PERL=$(NO_PERL)|g' \
+ -e 's|@REASON@|NO_PERL=$(NO_PERL)|g' \
unimplemented.sh >$@+ && \
chmod +x $@+ && \
mv $@+ $@
@@ -2670,13 +2670,13 @@ else # NO_PYTHON
$(SCRIPT_PYTHON_GEN): % : unimplemented.sh
$(QUIET_GEN) \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@@REASON@@|NO_PYTHON=$(NO_PYTHON)|g' \
+ -e 's|@REASON@|NO_PYTHON=$(NO_PYTHON)|g' \
unimplemented.sh >$@+ && \
chmod +x $@+ && \
mv $@+ $@
endif # NO_PYTHON
-CONFIGURE_RECIPE = sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
+CONFIGURE_RECIPE = sed -e 's/@GIT_VERSION@/$(GIT_VERSION)/g' \
configure.ac >configure.ac+ && \
autoconf -o configure configure.ac+ && \
$(RM) configure.ac+
@@ -3104,9 +3104,9 @@ endif
perl/build/lib/%.pm: perl/%.pm GIT-PERL-DEFINES
$(call mkdir_p_parent_template)
$(QUIET_GEN) \
- sed -e 's|@@LOCALEDIR@@|$(perl_localedir_SQ)|g' \
- -e 's|@@NO_GETTEXT@@|$(NO_GETTEXT_SQ)|g' \
- -e 's|@@NO_PERL_CPAN_FALLBACKS@@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \
+ sed -e 's|@LOCALEDIR@|$(perl_localedir_SQ)|g' \
+ -e 's|@NO_GETTEXT@|$(NO_GETTEXT_SQ)|g' \
+ -e 's|@NO_PERL_CPAN_FALLBACKS@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \
< $< > $@
perl/build/man/man3/Git.3pm: perl/Git.pm
@@ -3231,8 +3231,8 @@ all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PR
bin-wrappers/%: wrap-for-bin.sh
$(call mkdir_p_parent_template)
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@@BUILD_DIR@@|$(shell pwd)|' \
- -e 's|@@PROG@@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
+ -e 's|@BUILD_DIR@|$(shell pwd)|' \
+ -e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
chmod +x $@
# GNU make supports exporting all variables by "export" without parameters.
diff --git a/configure.ac b/configure.ac
index d1a96da14eb56766e1538da80ab97ed8a99b24f6..5923edc44aa7b6cc355fa6589b6d075b0c0a7772 100644
--- a/configure.ac
+++ b/configure.ac
@@ -142,7 +142,7 @@ fi
## Configure body starts here.
AC_PREREQ(2.59)
-AC_INIT([git], [@@GIT_VERSION@@], [git@vger.kernel.org])
+AC_INIT([git], [@GIT_VERSION@], [git@vger.kernel.org])
AC_CONFIG_SRCDIR([git.c])
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 985004f5943128483e2138cd61aca8bd8ccbd240..1abf5f099c1c6735ae7aec345de96bf623e2aa18 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -836,14 +836,14 @@ set(git_shell_scripts
foreach(script ${git_shell_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.sh content NEWLINE_CONSUME)
string(REPLACE "@SHELL_PATH@" "${SHELL_PATH}" content "${content}")
- string(REPLACE "@@DIFF@@" "diff" content "${content}")
+ string(REPLACE "@DIFF@" "diff" content "${content}")
string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}")
string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" content "${content}")
- string(REPLACE "@@NO_CURL@@" "" content "${content}")
- string(REPLACE "@@USE_GETTEXT_SCHEME@@" "" content "${content}")
- string(REPLACE "# @@BROKEN_PATH_FIX@@" "" content "${content}")
- string(REPLACE "@@PERL@@" "${PERL_PATH}" content "${content}")
- string(REPLACE "@@PAGER_ENV@@" "LESS=FRX LV=-c" content "${content}")
+ string(REPLACE "@NO_CURL@" "" content "${content}")
+ string(REPLACE "@USE_GETTEXT_SCHEME@" "" content "${content}")
+ string(REPLACE "# @BROKEN_PATH_FIX@" "" content "${content}")
+ string(REPLACE "@PERL@" "${PERL_PATH}" content "${content}")
+ string(REPLACE "@PAGER_ENV@" "LESS=FRX LV=-c" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
endforeach()
@@ -852,13 +852,13 @@ parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" ".perl")
#create perl header
file(STRINGS ${CMAKE_SOURCE_DIR}/perl/header_templates/fixed_prefix.template.pl perl_header )
-string(REPLACE "@@PATHSEP@@" ":" perl_header "${perl_header}")
-string(REPLACE "@@INSTLIBDIR@@" "${INSTLIBDIR}" perl_header "${perl_header}")
+string(REPLACE "@PATHSEP@" ":" perl_header "${perl_header}")
+string(REPLACE "@INSTLIBDIR@" "${INSTLIBDIR}" perl_header "${perl_header}")
foreach(script ${git_perl_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.perl content NEWLINE_CONSUME)
string(REPLACE "#!/usr/bin/perl" "#!/usr/bin/perl\n${perl_header}\n" content "${content}")
- string(REPLACE "@@GIT_VERSION@@" "${PROJECT_VERSION}" content "${content}")
+ string(REPLACE "@GIT_VERSION@" "${PROJECT_VERSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
endforeach()
@@ -873,8 +873,8 @@ file(GLOB_RECURSE perl_modules "${CMAKE_SOURCE_DIR}/perl/*.pm")
foreach(pm ${perl_modules})
string(REPLACE "${CMAKE_SOURCE_DIR}/perl/" "" file_path ${pm})
file(STRINGS ${pm} content NEWLINE_CONSUME)
- string(REPLACE "@@LOCALEDIR@@" "${LOCALEDIR}" content "${content}")
- string(REPLACE "@@NO_PERL_CPAN_FALLBACKS@@" "" content "${content}")
+ string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}")
+ string(REPLACE "@NO_PERL_CPAN_FALLBACKS@" "" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/perl/build/lib/${file_path} ${content})
#test-lib.sh requires perl/build/lib to be the build directory of perl modules
endforeach()
@@ -1064,21 +1064,21 @@ set(wrapper_test_scripts
foreach(script ${wrapper_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
- string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
- string(REPLACE "@@PROG@@" "${script}${EXE_EXTENSION}" content "${content}")
+ string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+ string(REPLACE "@PROG@" "${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
foreach(script ${wrapper_test_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
- string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
- string(REPLACE "@@PROG@@" "t/helper/${script}${EXE_EXTENSION}" content "${content}")
+ string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+ string(REPLACE "@PROG@" "t/helper/${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
-string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
-string(REPLACE "@@PROG@@" "git-cvsserver" content "${content}")
+string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+string(REPLACE "@PROG@" "git-cvsserver" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})
#options for configuring test options
diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index 124f598bdc07058b139f8dcbf8245128c52d9176..70ae7cb8e456885ddf2b13a70d21831cdaa7bf06 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -26,7 +26,7 @@
use File::Basename;
use Getopt::Long qw(:config require_order no_ignore_case);
-my $VERSION = '@@GIT_VERSION@@';
+my $VERSION = '@GIT_VERSION@';
my $log = GITCVS::log->new();
my $cfg;
diff --git a/git-instaweb.sh b/git-instaweb.sh
index 8dbe21d5887595352bc0159ea9befdf296b8105f..c8efb1205a8e2a66a6aced840980978897e122bc 100755
--- a/git-instaweb.sh
+++ b/git-instaweb.sh
@@ -3,7 +3,7 @@
# Copyright (c) 2006 Eric Wong
#
-PERL='@@PERL@@'
+PERL='@PERL@'
OPTIONS_KEEPDASHDASH=
OPTIONS_STUCKLONG=
OPTIONS_SPEC="\
@@ -38,8 +38,8 @@ conf="$GIT_DIR/gitweb/httpd.conf"
# if installed, it doesn't need further configuration (module_path)
test -z "$httpd" && httpd='lighttpd -f'
-# Default is @@GITWEBDIR@@
-test -z "$root" && root='@@GITWEBDIR@@'
+# Default is @GITWEBDIR@
+test -z "$root" && root='@GITWEBDIR@'
# any untaken local port will do...
test -z "$port" && port=1234
@@ -716,7 +716,7 @@ EOF
gitweb_conf() {
cat > "$fqgitdir/gitweb/gitweb_config.perl" <<EOF
-#!@@PERL@@
+#!@PERL@
our \$projectroot = "$(dirname "$fqgitdir")";
our \$git_temp = "$fqgitdir/gitweb/tmp";
our \$projects_list = \$projectroot;
diff --git a/git-request-pull.sh b/git-request-pull.sh
index 01640a044bb10f4167338fca957c43a240e1b6c0..10c88639e28c02650ffea3d4671afa9a9f0bb182 100755
--- a/git-request-pull.sh
+++ b/git-request-pull.sh
@@ -112,7 +112,7 @@ find_matching_ref='
}
'
-set fnord $(git ls-remote "$url" | @@PERL@@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
+set fnord $(git ls-remote "$url" | @PERL@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
remote_sha1=$2
ref=$3
diff --git a/git-send-email.perl b/git-send-email.perl
index c835d4c11af259242f1128101a15b237302c7f42..02805c43e52570fe5ae5432fb9343ce9165cc16b 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1501,7 +1501,7 @@ sub gen_header {
@recipients = unique_email_list(@recipients,@cc,@initial_bcc);
@recipients = (map { extract_valid_address_or_die($_) } @recipients);
my $date = format_2822_time($time++);
- my $gitversion = '@@GIT_VERSION@@';
+ my $gitversion = '@GIT_VERSION@';
if ($gitversion =~ m/..GIT_VERSION../) {
$gitversion = Git::version();
}
diff --git a/git-sh-i18n.sh b/git-sh-i18n.sh
index a15c0620db6893898152b1c9e363a0af7f1b304e..ae4b2d6ba9dc061ef40ef1867f0cd5e975df8fe5 100644
--- a/git-sh-i18n.sh
+++ b/git-sh-i18n.sh
@@ -9,7 +9,7 @@ TEXTDOMAIN=git
export TEXTDOMAIN
if test -z "$GIT_TEXTDOMAINDIR"
then
- TEXTDOMAINDIR="@@LOCALEDIR@@"
+ TEXTDOMAINDIR="@LOCALEDIR@"
else
TEXTDOMAINDIR="$GIT_TEXTDOMAINDIR"
fi
@@ -17,9 +17,9 @@ export TEXTDOMAINDIR
# First decide what scheme to use...
GIT_INTERNAL_GETTEXT_SH_SCHEME=fallthrough
-if test -n "@@USE_GETTEXT_SCHEME@@"
+if test -n "@USE_GETTEXT_SCHEME@"
then
- GIT_INTERNAL_GETTEXT_SH_SCHEME="@@USE_GETTEXT_SCHEME@@"
+ GIT_INTERNAL_GETTEXT_SH_SCHEME="@USE_GETTEXT_SCHEME@"
elif test -n "$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS"
then
: no probing necessary
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index ce273fe0e48d997cb067e77707026616a9302eb2..19aef72ec2553027bb25a5968d4e428ba986fdb2 100644
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -41,7 +41,7 @@ git_broken_path_fix () {
esac
}
-# @@BROKEN_PATH_FIX@@
+# @BROKEN_PATH_FIX@
# Source git-sh-i18n for gettext support.
. "$(git --exec-path)/git-sh-i18n"
@@ -154,7 +154,7 @@ git_pager() {
else
GIT_PAGER=cat
fi
- for vardef in @@PAGER_ENV@@
+ for vardef in @PAGER_ENV@
do
var=${vardef%%=*}
eval ": \"\${$vardef}\" && export $var"
@@ -280,7 +280,7 @@ get_author_ident_from_commit () {
# remove lines from $1 that are not in $2, leaving only common lines.
create_virtual_base() {
sz0=$(wc -c <"$1")
- @@DIFF@@ -u -La/"$1" -Lb/"$1" "$1" "$2" | git apply --no-add
+ @DIFF@ -u -La/"$1" -Lb/"$1" "$1" "$2" | git apply --no-add
sz1=$(wc -c <"$1")
# If we do not have enough common material, it is not
diff --git a/git-svn.perl b/git-svn.perl
index 01e7a70de1c0eb37b3feefe364ad78d4c8973097..dcf65cf1d1d4dc53b9f813f931ecff1a387c2657 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -9,7 +9,7 @@
$_revision $_repository
$_q $_authors $_authors_prog %users/;
$AUTHOR = 'Eric Wong <normalperson@yhbt.net>';
-$VERSION = '@@GIT_VERSION@@';
+$VERSION = '@GIT_VERSION@';
use Carp qw/croak/;
use File::Basename qw/dirname basename/;
diff --git a/gitweb/Makefile b/gitweb/Makefile
index 3b68ab2d672c4afae62f8f4dc024e0911027b58d..164c8d53757f98599ad14eeb22ca8d542eb7502a 100644
--- a/gitweb/Makefile
+++ b/gitweb/Makefile
@@ -79,28 +79,28 @@ GITWEB_JSLIB_FILES += static/js/blame_incremental.js
GITWEB_REPLACE = \
- -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
- -e 's|++GIT_BINDIR++|$(bindir)|g' \
- -e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \
- -e 's|++GITWEB_CONFIG_SYSTEM++|$(GITWEB_CONFIG_SYSTEM)|g' \
- -e 's|++GITWEB_CONFIG_COMMON++|$(GITWEB_CONFIG_COMMON)|g' \
- -e 's|++GITWEB_HOME_LINK_STR++|$(GITWEB_HOME_LINK_STR)|g' \
- -e 's|++GITWEB_SITENAME++|$(GITWEB_SITENAME)|g' \
- -e 's|++GITWEB_PROJECTROOT++|$(GITWEB_PROJECTROOT)|g' \
- -e 's|"++GITWEB_PROJECT_MAXDEPTH++"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
- -e 's|++GITWEB_EXPORT_OK++|$(GITWEB_EXPORT_OK)|g' \
- -e 's|++GITWEB_STRICT_EXPORT++|$(GITWEB_STRICT_EXPORT)|g' \
- -e 's|++GITWEB_BASE_URL++|$(GITWEB_BASE_URL)|g' \
- -e 's|++GITWEB_LIST++|$(GITWEB_LIST)|g' \
- -e 's|++GITWEB_HOMETEXT++|$(GITWEB_HOMETEXT)|g' \
- -e 's|++GITWEB_CSS++|$(GITWEB_CSS)|g' \
- -e 's|++GITWEB_LOGO++|$(GITWEB_LOGO)|g' \
- -e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \
- -e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \
- -e 's|++GITWEB_SITE_HTML_HEAD_STRING++|$(GITWEB_SITE_HTML_HEAD_STRING)|g' \
- -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \
- -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \
- -e 's|++HIGHLIGHT_BIN++|$(HIGHLIGHT_BIN)|g'
+ -e 's|@GIT_VERSION@|$(GIT_VERSION)|g' \
+ -e 's|@GIT_BINDIR@|$(bindir)|g' \
+ -e 's|@GITWEB_CONFIG@|$(GITWEB_CONFIG)|g' \
+ -e 's|@GITWEB_CONFIG_SYSTEM@|$(GITWEB_CONFIG_SYSTEM)|g' \
+ -e 's|@GITWEB_CONFIG_COMMON@|$(GITWEB_CONFIG_COMMON)|g' \
+ -e 's|@GITWEB_HOME_LINK_STR@|$(GITWEB_HOME_LINK_STR)|g' \
+ -e 's|@GITWEB_SITENAME@|$(GITWEB_SITENAME)|g' \
+ -e 's|@GITWEB_PROJECTROOT@|$(GITWEB_PROJECTROOT)|g' \
+ -e 's|"@GITWEB_PROJECT_MAXDEPTH@"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
+ -e 's|@GITWEB_EXPORT_OK@|$(GITWEB_EXPORT_OK)|g' \
+ -e 's|@GITWEB_STRICT_EXPORT@|$(GITWEB_STRICT_EXPORT)|g' \
+ -e 's|@GITWEB_BASE_URL@|$(GITWEB_BASE_URL)|g' \
+ -e 's|@GITWEB_LIST@|$(GITWEB_LIST)|g' \
+ -e 's|@GITWEB_HOMETEXT@|$(GITWEB_HOMETEXT)|g' \
+ -e 's|@GITWEB_CSS@|$(GITWEB_CSS)|g' \
+ -e 's|@GITWEB_LOGO@|$(GITWEB_LOGO)|g' \
+ -e 's|@GITWEB_FAVICON@|$(GITWEB_FAVICON)|g' \
+ -e 's|@GITWEB_JS@|$(GITWEB_JS)|g' \
+ -e 's|@GITWEB_SITE_HTML_HEAD_STRING@|$(GITWEB_SITE_HTML_HEAD_STRING)|g' \
+ -e 's|@GITWEB_SITE_HEADER@|$(GITWEB_SITE_HEADER)|g' \
+ -e 's|@GITWEB_SITE_FOOTER@|$(GITWEB_SITE_FOOTER)|g' \
+ -e 's|@HIGHLIGHT_BIN@|$(HIGHLIGHT_BIN)|g'
.PHONY: FORCE
$(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS: FORCE
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index b09a8d052383fdf1190f1fab008ddef99290e1f0..76e1f4e244fd23dd29b935e83753efa9c6d5bb5e 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -35,7 +35,7 @@ BEGIN
CGI->compile() if $ENV{'MOD_PERL'};
}
-our $version = "++GIT_VERSION++";
+our $version = "@GIT_VERSION@";
our ($my_url, $my_uri, $base_url, $path_info, $home_link);
sub evaluate_uri {
@@ -80,46 +80,46 @@ sub evaluate_uri {
# core git executable to use
# this can just be "git" if your webserver has a sensible PATH
-our $GIT = "++GIT_BINDIR++/git";
+our $GIT = "@GIT_BINDIR@/git";
# absolute fs-path which will be prepended to the project path
#our $projectroot = "/pub/scm";
-our $projectroot = "++GITWEB_PROJECTROOT++";
+our $projectroot = "@GITWEB_PROJECTROOT@";
# fs traversing limit for getting project list
# the number is relative to the projectroot
-our $project_maxdepth = "++GITWEB_PROJECT_MAXDEPTH++";
+our $project_maxdepth = "@GITWEB_PROJECT_MAXDEPTH@";
# string of the home link on top of all pages
-our $home_link_str = "++GITWEB_HOME_LINK_STR++";
+our $home_link_str = "@GITWEB_HOME_LINK_STR@";
# extra breadcrumbs preceding the home link
our @extra_breadcrumbs = ();
# name of your site or organization to appear in page titles
# replace this with something more descriptive for clearer bookmarks
-our $site_name = "++GITWEB_SITENAME++"
+our $site_name = "@GITWEB_SITENAME@"
|| ($ENV{'SERVER_NAME'} || "Untitled") . " Git";
# html snippet to include in the <head> section of each page
-our $site_html_head_string = "++GITWEB_SITE_HTML_HEAD_STRING++";
+our $site_html_head_string = "@GITWEB_SITE_HTML_HEAD_STRING@";
# filename of html text to include at top of each page
-our $site_header = "++GITWEB_SITE_HEADER++";
+our $site_header = "@GITWEB_SITE_HEADER@";
# html text to include at home page
-our $home_text = "++GITWEB_HOMETEXT++";
+our $home_text = "@GITWEB_HOMETEXT@";
# filename of html text to include at bottom of each page
-our $site_footer = "++GITWEB_SITE_FOOTER++";
+our $site_footer = "@GITWEB_SITE_FOOTER@";
# URI of stylesheets
-our @stylesheets = ("++GITWEB_CSS++");
+our @stylesheets = ("@GITWEB_CSS@");
# URI of a single stylesheet, which can be overridden in GITWEB_CONFIG.
our $stylesheet = undef;
# URI of GIT logo (72x27 size)
-our $logo = "++GITWEB_LOGO++";
+our $logo = "@GITWEB_LOGO@";
# URI of GIT favicon, assumed to be image/png type
-our $favicon = "++GITWEB_FAVICON++";
+our $favicon = "@GITWEB_FAVICON@";
# URI of gitweb.js (JavaScript code for gitweb)
-our $javascript = "++GITWEB_JS++";
+our $javascript = "@GITWEB_JS@";
# URI and label (title) of GIT logo link
#our $logo_url = "https://www.kernel.org/pub/software/scm/git/docs/";
@@ -128,7 +128,7 @@ sub evaluate_uri {
our $logo_label = "git homepage";
# source of projects list
-our $projects_list = "++GITWEB_LIST++";
+our $projects_list = "@GITWEB_LIST@";
# the width (in characters) of the projects list "Description" column
our $projects_list_description_width = 25;
@@ -147,7 +147,7 @@ sub evaluate_uri {
# show repository only if this file exists
# (only effective if this variable evaluates to true)
-our $export_ok = "++GITWEB_EXPORT_OK++";
+our $export_ok = "@GITWEB_EXPORT_OK@";
# don't generate age column on the projects list page
our $omit_age_column = 0;
@@ -161,11 +161,11 @@ sub evaluate_uri {
our $export_auth_hook = undef;
# only allow viewing of repositories also shown on the overview page
-our $strict_export = "++GITWEB_STRICT_EXPORT++";
+our $strict_export = "@GITWEB_STRICT_EXPORT@";
# list of git base URLs used for URL to where fetch project from,
# i.e. full URL is "$git_base_url/$project"
-our @git_base_url_list = grep { $_ ne '' } ("++GITWEB_BASE_URL++");
+our @git_base_url_list = grep { $_ ne '' } ("@GITWEB_BASE_URL@");
# default blob_plain mimetype and default charset for text/plain blob
our $default_blob_plain_mimetype = 'text/plain';
@@ -200,7 +200,7 @@ sub evaluate_uri {
# http://andre-simon.de/zip/download.php due to assumptions about parameters and output).
# Useful if highlight is not installed on your webserver's PATH.
# [Default: highlight]
-our $highlight_bin = "++HIGHLIGHT_BIN++";
+our $highlight_bin = "@HIGHLIGHT_BIN@";
# information about snapshot formats that gitweb is capable of serving
our %known_snapshot_formats = (
@@ -741,9 +741,9 @@ sub read_config_file {
our ($GITWEB_CONFIG, $GITWEB_CONFIG_SYSTEM, $GITWEB_CONFIG_COMMON);
sub evaluate_gitweb_config {
- our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "++GITWEB_CONFIG++";
- our $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || "++GITWEB_CONFIG_SYSTEM++";
- our $GITWEB_CONFIG_COMMON = $ENV{'GITWEB_CONFIG_COMMON'} || "++GITWEB_CONFIG_COMMON++";
+ our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "@GITWEB_CONFIG@";
+ our $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || "@GITWEB_CONFIG_SYSTEM@";
+ our $GITWEB_CONFIG_COMMON = $ENV{'GITWEB_CONFIG_COMMON'} || "@GITWEB_CONFIG_COMMON@";
# Protect against duplications of file names, to not read config twice.
# Only one of $GITWEB_CONFIG and $GITWEB_CONFIG_SYSTEM is used, so
diff --git a/perl/Git/I18N.pm b/perl/Git/I18N.pm
index 475e90a6df5a272d6b4d557d8d37d68e3f77dfa8..f8f0ca312543ce2d099f16354e62acbc205abe5a 100644
--- a/perl/Git/I18N.pm
+++ b/perl/Git/I18N.pm
@@ -20,14 +20,14 @@ BEGIN
# this "'@@' [...] '@@'" pattern.
use constant NO_GETTEXT_STR => '@@' . 'NO_GETTEXT' . '@@';
use constant NO_GETTEXT => (
- q[@@NO_GETTEXT@@] ne ''
+ q[@NO_GETTEXT@] ne ''
and
- q[@@NO_GETTEXT@@] ne NO_GETTEXT_STR
+ q[@NO_GETTEXT@] ne NO_GETTEXT_STR
);
sub __bootstrap_locale_messages {
our $TEXTDOMAIN = 'git';
- our $TEXTDOMAINDIR ||= $ENV{GIT_TEXTDOMAINDIR} || '@@LOCALEDIR@@';
+ our $TEXTDOMAINDIR ||= $ENV{GIT_TEXTDOMAINDIR} || '@LOCALEDIR@';
die "NO_GETTEXT=" . NO_GETTEXT_STR if NO_GETTEXT;
require POSIX;
diff --git a/perl/Git/LoadCPAN.pm b/perl/Git/LoadCPAN.pm
index 8c7fa805f97390a47366b0d0058966ee391b9df1..6be99840f84fb2fe945f969fb23f73454c6b171b 100644
--- a/perl/Git/LoadCPAN.pm
+++ b/perl/Git/LoadCPAN.pm
@@ -31,11 +31,11 @@ =head1 DESCRIPTION
# Makefile, and allows for detecting whether the module is loaded from
# perl/Git as opposed to perl/build/Git, which is useful for one-off
# testing without having Error.pm et al installed.
-use constant NO_PERL_CPAN_FALLBACKS_STR => '@@' . 'NO_PERL_CPAN_FALLBACKS' . '@@';
+use constant NO_PERL_CPAN_FALLBACKS_STR => '@' . 'NO_PERL_CPAN_FALLBACKS' . '@';
use constant NO_PERL_CPAN_FALLBACKS => (
- q[@@NO_PERL_CPAN_FALLBACKS@@] ne ''
+ q[@NO_PERL_CPAN_FALLBACKS@] ne ''
and
- q[@@NO_PERL_CPAN_FALLBACKS@@] ne NO_PERL_CPAN_FALLBACKS_STR
+ q[@NO_PERL_CPAN_FALLBACKS@] ne NO_PERL_CPAN_FALLBACKS_STR
);
sub import {
--git a/perl/header_templates/fixed_prefix.template.pl b/perl/header_templates/fixed_prefix.template.pl
index 857b4391a499394ea788a6b56773aecd5afd53c3..d571ca5cde513a98cc25e7acb52b5415b98ffe10 100644
--- a/perl/header_templates/fixed_prefix.template.pl
+++ b/perl/header_templates/fixed_prefix.template.pl
@@ -1 +1 @@
-use lib (split(/@@PATHSEP@@/, $ENV{GITPERLLIB} || '@@INSTLIBDIR@@'));
+use lib (split(/@PATHSEP@/, $ENV{GITPERLLIB} || '@INSTLIBDIR@'));
--git a/perl/header_templates/runtime_prefix.template.pl b/perl/header_templates/runtime_prefix.template.pl
index 9d28b3d8636c6c6d48ea287a5fef0f7833f6c08c..e6f8e661a164519d4fdb55429746380e84ae3fcb 100644
--- a/perl/header_templates/runtime_prefix.template.pl
+++ b/perl/header_templates/runtime_prefix.template.pl
@@ -3,7 +3,7 @@
# This finds our Git::* libraries relative to the script's runtime path.
sub __git_system_path {
my ($relpath) = @_;
- my $gitexecdir_relative = '@@GITEXECDIR_REL@@';
+ my $gitexecdir_relative = '@GITEXECDIR_REL@';
# GIT_EXEC_PATH is supplied by `git` or the test suite.
my $exec_path;
@@ -24,11 +24,11 @@ sub __git_system_path {
}
BEGIN {
- use lib split /@@PATHSEP@@/,
+ use lib split /@PATHSEP@/,
(
$ENV{GITPERLLIB} ||
do {
- my $perllibdir = __git_system_path('@@PERLLIBDIR_REL@@');
+ my $perllibdir = __git_system_path('@PERLLIBDIR_REL@');
(-e $perllibdir) || die("Invalid system path ($relpath): $path");
$perllibdir;
}
@@ -36,7 +36,7 @@ BEGIN
# Export the system locale directory to the I18N module. The locale directory
# is only installed if NO_GETTEXT is set.
- $Git::I18N::TEXTDOMAINDIR = __git_system_path('@@LOCALEDIR_REL@@');
+ $Git::I18N::TEXTDOMAINDIR = __git_system_path('@LOCALEDIR_REL@');
}
# END RUNTIME_PREFIX generated code.
diff --git a/unimplemented.sh b/unimplemented.sh
index fee21d24e8ab89208b4aa0af7007b7c033b753bc..41776b279d4263ae6a9034b30f1bd26ac9b792bd 100644
--- a/unimplemented.sh
+++ b/unimplemented.sh
@@ -1,4 +1,4 @@
#!/bin/sh
-echo >&2 "fatal: git was built without support for $(basename $0) (@@REASON@@)."
+echo >&2 "fatal: git was built without support for $(basename $0) (@REASON@)."
exit 128
diff --git a/wrap-for-bin.sh b/wrap-for-bin.sh
index 95851b85b6b7181130f0cd441c2bd7ac0bfb89da..7898a1c238dde20617cf96d144930dc59f67feab 100644
--- a/wrap-for-bin.sh
+++ b/wrap-for-bin.sh
@@ -4,33 +4,33 @@
# to run test suite against sandbox, but with only bindir-installed
# executables in PATH. The Makefile copies this into various
# files in bin-wrappers, substituting
-# @@BUILD_DIR@@ and @@PROG@@.
+# @BUILD_DIR@ and @PROG@.
-GIT_EXEC_PATH='@@BUILD_DIR@@'
+GIT_EXEC_PATH='@BUILD_DIR@'
if test -n "$NO_SET_GIT_TEMPLATE_DIR"
then
unset GIT_TEMPLATE_DIR
else
- GIT_TEMPLATE_DIR='@@BUILD_DIR@@/templates/blt'
+ GIT_TEMPLATE_DIR='@BUILD_DIR@/templates/blt'
export GIT_TEMPLATE_DIR
fi
-GITPERLLIB='@@BUILD_DIR@@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}"
-GIT_TEXTDOMAINDIR='@@BUILD_DIR@@/po/build/locale'
-PATH='@@BUILD_DIR@@/bin-wrappers:'"$PATH"
+GITPERLLIB='@BUILD_DIR@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}"
+GIT_TEXTDOMAINDIR='@BUILD_DIR@/po/build/locale'
+PATH='@BUILD_DIR@/bin-wrappers:'"$PATH"
export GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
case "$GIT_DEBUGGER" in
'')
- exec "${GIT_EXEC_PATH}/@@PROG@@" "$@"
+ exec "${GIT_EXEC_PATH}/@PROG@" "$@"
;;
1)
unset GIT_DEBUGGER
- exec gdb --args "${GIT_EXEC_PATH}/@@PROG@@" "$@"
+ exec gdb --args "${GIT_EXEC_PATH}/@PROG@" "$@"
;;
*)
GIT_DEBUGGER_ARGS="$GIT_DEBUGGER"
unset GIT_DEBUGGER
- exec ${GIT_DEBUGGER_ARGS} "${GIT_EXEC_PATH}/@@PROG@@" "$@"
+ exec ${GIT_DEBUGGER_ARGS} "${GIT_EXEC_PATH}/@PROG@" "$@"
;;
esac
--
2.47.0.274.g962d0b743d.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v9 03/23] Makefile: refactor GIT-VERSION-GEN to be reusable
2024-11-25 9:56 ` [PATCH v9 " Patrick Steinhardt
2024-11-25 9:56 ` [PATCH v9 01/23] Makefile: use common template for GIT-BUILD-OPTIONS Patrick Steinhardt
2024-11-25 9:56 ` [PATCH v9 02/23] Makefile: consistently use @PLACEHOLDER@ to substitute Patrick Steinhardt
@ 2024-11-25 9:56 ` Patrick Steinhardt
2024-11-25 9:56 ` [PATCH v9 04/23] Makefile: propagate Git version via generated header Patrick Steinhardt
` (19 subsequent siblings)
22 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-25 9:56 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
Our "GIT-VERSION-GEN" script always writes the "GIT-VERSION-FILE" into
the current directory, where the expectation is that it should exist in
the source directory. But other build systems that support out-of-tree
builds may not want to do that to keep the source directory pristine,
even though CMake currently doesn't care.
Refactor the script such that it won't write the "GIT-VERSION-FILE"
directly anymore, but instead knows to replace @PLACEHOLDERS@ in an
arbitrary input file. This allows us to simplify the logic in CMake to
determine the project version, but can also be reused later on in order
to generate other files that need to contain version information like
our "git.rc" file.
While at it, change the format of the version file by removing the
spaces around the equals sign. Like this we can continue to include the
file in our Makefiles, but can also start to source it in shell scripts
in subsequent steps.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-VERSION-FILE.in | 1 +
GIT-VERSION-GEN | 61 ++++++++++++++++++++++++++++---------
Makefile | 5 ++-
ci/test-documentation.sh | 2 +-
contrib/buildsystems/CMakeLists.txt | 23 ++++----------
contrib/buildsystems/git-version.in | 1 +
6 files changed, 59 insertions(+), 34 deletions(-)
diff --git a/GIT-VERSION-FILE.in b/GIT-VERSION-FILE.in
new file mode 100644
index 0000000000000000000000000000000000000000..3789a48a34a3f9e37531fc24b577ffe3c657a3e9
--- /dev/null
+++ b/GIT-VERSION-FILE.in
@@ -0,0 +1 @@
+GIT_VERSION=@GIT_VERSION@
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index 78e8631f677bbebe8f18d83191f0fd014465563e..7afc7aad1413d552cbadc68b7582ba639faa4d8a 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -1,23 +1,48 @@
#!/bin/sh
-GVF=GIT-VERSION-FILE
DEF_VER=v2.47.GIT
LF='
'
+if test "$#" -ne 3
+then
+ echo >&2 "USAGE: $0 <SOURCE_DIR> <INPUT> <OUTPUT>"
+ exit 1
+fi
+
+SOURCE_DIR="$1"
+INPUT="$2"
+OUTPUT="$3"
+
+if ! test -f "$INPUT"
+then
+ echo >&2 "Input is not a file: $INPUT"
+ exit 1
+fi
+
+# Protect us from reading Git version information outside of the Git directory
+# in case it is not a repository itself, but embedded in an unrelated
+# repository.
+GIT_CEILING_DIRECTORIES="$SOURCE_DIR/.."
+export GIT_CEILING_DIRECTORIES
+
# First see if there is a version file (included in release tarballs),
# then try git-describe, then default.
-if test -f version
+if test -f "$SOURCE_DIR"/version
then
- VN=$(cat version) || VN="$DEF_VER"
-elif { test -d "${GIT_DIR:-.git}" || test -f .git; } &&
- VN=$(git describe --match "v[0-9]*" HEAD 2>/dev/null) &&
+ VN=$(cat "$SOURCE_DIR"/version) || VN="$DEF_VER"
+elif {
+ test -d "$SOURCE_DIR/.git" ||
+ test -d "${GIT_DIR:-.git}" ||
+ test -f "$SOURCE_DIR"/.git;
+ } &&
+ VN=$(git -C "$SOURCE_DIR" describe --match "v[0-9]*" HEAD 2>/dev/null) &&
case "$VN" in
*$LF*) (exit 1) ;;
v[0-9]*)
- git update-index -q --refresh
- test -z "$(git diff-index --name-only HEAD --)" ||
+ git -C "$SOURCE_DIR" update-index -q --refresh
+ test -z "$(git -C "$SOURCE_DIR" diff-index --name-only HEAD --)" ||
VN="$VN-dirty" ;;
esac
then
@@ -26,15 +51,21 @@ else
VN="$DEF_VER"
fi
-VN=$(expr "$VN" : v*'\(.*\)')
+GIT_VERSION=$(expr "$VN" : v*'\(.*\)')
+
+read GIT_MAJOR_VERSION GIT_MINOR_VERSION GIT_MICRO_VERSION trailing <<EOF
+$(echo "$GIT_VERSION" 0 0 0 | tr '.a-zA-Z-' ' ')
+EOF
+
+sed -e "s|@GIT_VERSION@|$GIT_VERSION|" \
+ -e "s|@GIT_MAJOR_VERSION@|$GIT_MAJOR_VERSION|" \
+ -e "s|@GIT_MINOR_VERSION@|$GIT_MINOR_VERSION|" \
+ -e "s|@GIT_MICRO_VERSION@|$GIT_MICRO_VERSION|" \
+ "$INPUT" >"$OUTPUT"+
-if test -r $GVF
+if ! test -f "$OUTPUT" || ! cmp "$OUTPUT"+ "$OUTPUT" >/dev/null
then
- VC=$(sed -e 's/^GIT_VERSION = //' <$GVF)
+ mv "$OUTPUT"+ "$OUTPUT"
else
- VC=unset
+ rm "$OUTPUT"+
fi
-test "$VN" = "$VC" || {
- echo >&2 "GIT_VERSION = $VN"
- echo "GIT_VERSION = $VN" >$GVF
-}
diff --git a/Makefile b/Makefile
index 75e26d2e312f186bd5a0e3b48fb38850613bca4b..73510d6bcbc9ca60d45b70459f9e1c79f19b4c09 100644
--- a/Makefile
+++ b/Makefile
@@ -592,7 +592,10 @@ include shared.mak
# Disable -pedantic compilation.
GIT-VERSION-FILE: FORCE
- @$(SHELL_PATH) ./GIT-VERSION-GEN
+ @OLD=$$(cat $@ 2>/dev/null || :) && \
+ $(SHELL_PATH) ./GIT-VERSION-GEN "$(shell pwd)" GIT-VERSION-FILE.in $@ && \
+ NEW=$$(cat $@ 2>/dev/null || :) && \
+ if test "$$OLD" != "$$NEW"; then echo "$$NEW" >&2; fi
-include GIT-VERSION-FILE
# Set our default configuration.
diff --git a/ci/test-documentation.sh b/ci/test-documentation.sh
index 02b3af394117f840e078479ca60030141e47f998..6c018b673e0563fa5589195a77804c91deb93515 100755
--- a/ci/test-documentation.sh
+++ b/ci/test-documentation.sh
@@ -6,7 +6,7 @@
. ${0%/*}/lib.sh
filter_log () {
- sed -e '/^GIT_VERSION = /d' \
+ sed -e '/^GIT_VERSION=/d' \
-e "/constant Gem::ConfigMap is deprecated/d" \
-e '/^ \* new asciidoc flags$/d' \
-e '/stripped namespace before processing/d' \
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 1abf5f099c1c6735ae7aec345de96bf623e2aa18..376d748ce9021710eb72258ab3b9bac52950a933 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -83,23 +83,12 @@ if(NOT SH_EXE)
"On Windows, you can get it as part of 'Git for Windows' install at https://gitforwindows.org/")
endif()
-#Create GIT-VERSION-FILE using GIT-VERSION-GEN
-if(NOT EXISTS ${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE)
- message("Generating GIT-VERSION-FILE")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
-endif()
-
-#Parse GIT-VERSION-FILE to get the version
-file(STRINGS ${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE git_version REGEX "GIT_VERSION = (.*)")
-string(REPLACE "GIT_VERSION = " "" git_version ${git_version})
-string(FIND ${git_version} "GIT" location)
-if(location EQUAL -1)
- string(REGEX MATCH "[0-9]*\\.[0-9]*\\.[0-9]*" git_version ${git_version})
-else()
- string(REGEX MATCH "[0-9]*\\.[0-9]*" git_version ${git_version})
- string(APPEND git_version ".0") #for building from a snapshot
-endif()
+message("Generating Git version")
+execute_process(COMMAND ${SH_EXE} "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_SOURCE_DIR}/contrib/buildsystems/git-version.in"
+ "${CMAKE_BINARY_DIR}/git-version")
+file(STRINGS "${CMAKE_BINARY_DIR}/git-version" git_version)
project(git
VERSION ${git_version}
diff --git a/contrib/buildsystems/git-version.in b/contrib/buildsystems/git-version.in
new file mode 100644
index 0000000000000000000000000000000000000000..9750505ae77685ebb31a38468caaf13501b6739d
--- /dev/null
+++ b/contrib/buildsystems/git-version.in
@@ -0,0 +1 @@
+@GIT_MAJOR_VERSION@.@GIT_MINOR_VERSION@.@GIT_MICRO_VERSION@
--
2.47.0.274.g962d0b743d.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v9 04/23] Makefile: propagate Git version via generated header
2024-11-25 9:56 ` [PATCH v9 " Patrick Steinhardt
` (2 preceding siblings ...)
2024-11-25 9:56 ` [PATCH v9 03/23] Makefile: refactor GIT-VERSION-GEN to be reusable Patrick Steinhardt
@ 2024-11-25 9:56 ` Patrick Steinhardt
2024-11-25 9:56 ` [PATCH v9 05/23] Makefile: generate "git.rc" via GIT-VERSION-GEN Patrick Steinhardt
` (18 subsequent siblings)
22 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-25 9:56 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
We set up a couple of preprocessor macros when compiling Git that
propagate the version that Git was built from to `git version` et al.
The way this is set up makes it harder than necessary to reuse the
infrastructure across the different build systems.
Refactor this such that we generate a "version-def.h" header via
`GIT-VERSION-GEN` instead.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
.gitignore | 1 +
GIT-VERSION-GEN | 7 +++++++
Makefile | 13 ++++++-------
contrib/buildsystems/CMakeLists.txt | 16 ++++++++++++----
version-def.h.in | 8 ++++++++
version.c | 1 +
6 files changed, 35 insertions(+), 11 deletions(-)
diff --git a/.gitignore b/.gitignore
index 6687bd6db4c0a6adf02292a9cb545d3e5270e2b0..e17963e84252fa094c10f5e84c0e3724153c819c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -195,6 +195,7 @@
/config-list.h
/command-list.h
/hook-list.h
+/version-def.h
*.tar.gz
*.dsc
*.deb
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index 7afc7aad1413d552cbadc68b7582ba639faa4d8a..c18f24e515436b71ef40120b88b6fbb0b5621c01 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -52,6 +52,11 @@ else
fi
GIT_VERSION=$(expr "$VN" : v*'\(.*\)')
+GIT_BUILT_FROM_COMMIT=$(git -C "$SOURCE_DIR" rev-parse -q --verify HEAD 2>/dev/null)
+if test -z "$GIT_USER_AGENT"
+then
+ GIT_USER_AGENT="git/$GIT_VERSION"
+fi
read GIT_MAJOR_VERSION GIT_MINOR_VERSION GIT_MICRO_VERSION trailing <<EOF
$(echo "$GIT_VERSION" 0 0 0 | tr '.a-zA-Z-' ' ')
@@ -61,6 +66,8 @@ sed -e "s|@GIT_VERSION@|$GIT_VERSION|" \
-e "s|@GIT_MAJOR_VERSION@|$GIT_MAJOR_VERSION|" \
-e "s|@GIT_MINOR_VERSION@|$GIT_MINOR_VERSION|" \
-e "s|@GIT_MICRO_VERSION@|$GIT_MICRO_VERSION|" \
+ -e "s|@GIT_BUILT_FROM_COMMIT@|$GIT_BUILT_FROM_COMMIT|" \
+ -e "s|@GIT_USER_AGENT@|$GIT_USER_AGENT|" \
"$INPUT" >"$OUTPUT"+
if ! test -f "$OUTPUT" || ! cmp "$OUTPUT"+ "$OUTPUT" >/dev/null
diff --git a/Makefile b/Makefile
index 73510d6bcbc9ca60d45b70459f9e1c79f19b4c09..7150ffc39c1b444a2c4775382f943c603490d54e 100644
--- a/Makefile
+++ b/Makefile
@@ -2508,13 +2508,11 @@ PAGER_ENV_CQ_SQ = $(subst ','\'',$(PAGER_ENV_CQ))
pager.sp pager.s pager.o: EXTRA_CPPFLAGS = \
-DPAGER_ENV='$(PAGER_ENV_CQ_SQ)'
-version.sp version.s version.o: GIT-VERSION-FILE GIT-USER-AGENT
-version.sp version.s version.o: EXTRA_CPPFLAGS = \
- '-DGIT_VERSION="$(GIT_VERSION)"' \
- '-DGIT_USER_AGENT=$(GIT_USER_AGENT_CQ_SQ)' \
- '-DGIT_BUILT_FROM_COMMIT="$(shell \
- GIT_CEILING_DIRECTORIES="$(CURDIR)/.." \
- git rev-parse -q --verify HEAD 2>/dev/null)"'
+version-def.h: version-def.h.in GIT-VERSION-GEN GIT-VERSION-FILE GIT-USER-AGENT
+ $(QUIET_GEN)GIT_USER_AGENT="$(GIT_USER_AGENT)" $(SHELL_PATH) ./GIT-VERSION-GEN "$(shell pwd)" $< $@+
+ @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
+
+version.sp version.s version.o: version-def.h
$(BUILT_INS): git$X
$(QUIET_BUILT_IN)$(RM) $@ && \
@@ -3728,6 +3726,7 @@ clean: profile-clean coverage-clean cocciclean
$(RM) $(FUZZ_PROGRAMS)
$(RM) $(SP_OBJ)
$(RM) $(HCC)
+ $(RM) version-def.h
$(RM) -r bin-wrappers $(dep_dirs) $(compdb_dir) compile_commands.json
$(RM) -r po/build/
$(RM) *.pyc *.pyo */*.pyc */*.pyo $(GENERATED_H) $(ETAGS_TARGET) tags cscope*
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 376d748ce9021710eb72258ab3b9bac52950a933..3cc5e318190292dd66981aa8593e7bd2739eea1d 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -229,10 +229,7 @@ add_compile_definitions(PAGER_ENV="LESS=FRX LV=-c"
GIT_HTML_PATH="share/doc/git-doc"
DEFAULT_HELP_FORMAT="html"
DEFAULT_GIT_TEMPLATE_DIR="share/git-core/templates"
- GIT_VERSION="${PROJECT_VERSION}.GIT"
- GIT_USER_AGENT="git/${PROJECT_VERSION}.GIT"
- BINDIR="bin"
- GIT_BUILT_FROM_COMMIT="")
+ BINDIR="bin")
if(WIN32)
set(FALLBACK_RUNTIME_PREFIX /mingw64)
@@ -668,6 +665,17 @@ parse_makefile_for_sources(libgit_SOURCES "LIB_OBJS")
list(TRANSFORM libgit_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
list(TRANSFORM compat_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
+
+add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/version-def.h"
+ COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_SOURCE_DIR}/version-def.h.in"
+ "${CMAKE_BINARY_DIR}/version-def.h"
+ DEPENDS "${SH_EXE}" "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
+ "${CMAKE_SOURCE_DIR}/version-def.h.in"
+ VERBATIM)
+list(APPEND libgit_SOURCES "${CMAKE_BINARY_DIR}/version-def.h")
+
add_library(libgit ${libgit_SOURCES} ${compat_SOURCES})
#libxdiff
diff --git a/version-def.h.in b/version-def.h.in
new file mode 100644
index 0000000000000000000000000000000000000000..347995df0611e19428cf96ec9539f0dcfea999d2
--- /dev/null
+++ b/version-def.h.in
@@ -0,0 +1,8 @@
+#ifndef VERSION_DEF_H
+#define VERSION_DEF_H
+
+#define GIT_VERSION "@GIT_VERSION@"
+#define GIT_BUILT_FROM_COMMIT "@GIT_BUILT_FROM_COMMIT@"
+#define GIT_USER_AGENT "@GIT_USER_AGENT@"
+
+#endif /* VERSION_DEF_H */
diff --git a/version.c b/version.c
index 41b718c29e1b9fc2981d7d14a3d25e69c31a3030..7adc4d51ff25a0841607c21807deaf20721252de 100644
--- a/version.c
+++ b/version.c
@@ -1,5 +1,6 @@
#include "git-compat-util.h"
#include "version.h"
+#include "version-def.h"
#include "strbuf.h"
const char git_version_string[] = GIT_VERSION;
--
2.47.0.274.g962d0b743d.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v9 05/23] Makefile: generate "git.rc" via GIT-VERSION-GEN
2024-11-25 9:56 ` [PATCH v9 " Patrick Steinhardt
` (3 preceding siblings ...)
2024-11-25 9:56 ` [PATCH v9 04/23] Makefile: propagate Git version via generated header Patrick Steinhardt
@ 2024-11-25 9:56 ` Patrick Steinhardt
2024-11-25 9:56 ` [PATCH v9 06/23] Makefile: generate doc versions " Patrick Steinhardt
` (17 subsequent siblings)
22 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-25 9:56 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
The "git.rc" is used on Windows to embed information like the project
name and version into the resulting executables. As such we need to
inject the version information, which we do by using preprocessor
defines. The logic to do so is non-trivial and needs to be kept in sync
with the different build systems.
Refactor the logic so that we generate "git.rc" via `GIT-VERSION-GEN`.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
.gitignore | 1 +
GIT-VERSION-GEN | 8 ++++++--
Makefile | 13 +++++++------
contrib/buildsystems/CMakeLists.txt | 19 +++++++++++++------
git.rc => git.rc.in | 6 +++---
5 files changed, 30 insertions(+), 17 deletions(-)
diff --git a/.gitignore b/.gitignore
index e17963e84252fa094c10f5e84c0e3724153c819c..d3be460040c6120d862a25dff1abd325b93b37fd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -199,6 +199,7 @@
*.tar.gz
*.dsc
*.deb
+/git.rc
/git.spec
*.exe
*.[aos]
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index c18f24e515436b71ef40120b88b6fbb0b5621c01..a1c8146f05cfa7fbc6c47804aec5fb848e67c69c 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -58,14 +58,18 @@ then
GIT_USER_AGENT="git/$GIT_VERSION"
fi
-read GIT_MAJOR_VERSION GIT_MINOR_VERSION GIT_MICRO_VERSION trailing <<EOF
-$(echo "$GIT_VERSION" 0 0 0 | tr '.a-zA-Z-' ' ')
+# While released Git versions only have three numbers, development builds also
+# have a fourth number that corresponds to the number of patches since the last
+# release.
+read GIT_MAJOR_VERSION GIT_MINOR_VERSION GIT_MICRO_VERSION GIT_PATCH_LEVEL trailing <<EOF
+$(echo "$GIT_VERSION" 0 0 0 0 | tr '.a-zA-Z-' ' ')
EOF
sed -e "s|@GIT_VERSION@|$GIT_VERSION|" \
-e "s|@GIT_MAJOR_VERSION@|$GIT_MAJOR_VERSION|" \
-e "s|@GIT_MINOR_VERSION@|$GIT_MINOR_VERSION|" \
-e "s|@GIT_MICRO_VERSION@|$GIT_MICRO_VERSION|" \
+ -e "s|@GIT_PATCH_LEVEL@|$GIT_PATCH_LEVEL|" \
-e "s|@GIT_BUILT_FROM_COMMIT@|$GIT_BUILT_FROM_COMMIT|" \
-e "s|@GIT_USER_AGENT@|$GIT_USER_AGENT|" \
"$INPUT" >"$OUTPUT"+
diff --git a/Makefile b/Makefile
index 7150ffc39c1b444a2c4775382f943c603490d54e..1255d222c2dec9a034dee2621192bf97afe905ee 100644
--- a/Makefile
+++ b/Makefile
@@ -2568,11 +2568,12 @@ $(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEFINES
$(QUIET_GEN)$(cmd_munge_script) && \
mv $@+ $@
-git.res: git.rc GIT-VERSION-FILE GIT-PREFIX
- $(QUIET_RC)$(RC) \
- $(join -DMAJOR= -DMINOR= -DMICRO= -DPATCHLEVEL=, $(wordlist 1, 4, \
- $(shell echo $(GIT_VERSION) 0 0 0 0 | tr '.a-zA-Z-' ' '))) \
- -DGIT_VERSION="\\\"$(GIT_VERSION)\\\"" -i $< -o $@
+git.rc: git.rc.in GIT-VERSION-GEN GIT-VERSION-FILE
+ $(QUIET_GEN)$(SHELL_PATH) ./GIT-VERSION-GEN "$(shell pwd)" $< $@+
+ @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
+
+git.res: git.rc GIT-PREFIX
+ $(QUIET_RC)$(RC) -i $< -o $@
# This makes sure we depend on the NO_PERL setting itself.
$(SCRIPT_PERL_GEN): GIT-BUILD-OPTIONS
@@ -3717,7 +3718,7 @@ clean: profile-clean coverage-clean cocciclean
$(RM) -r .build $(UNIT_TEST_BIN)
$(RM) GIT-TEST-SUITES
$(RM) po/git.pot po/git-core.pot
- $(RM) git.res
+ $(RM) git.rc git.res
$(RM) $(OBJECTS)
$(RM) headless-git.o
$(RM) $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB)
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 3cc5e318190292dd66981aa8593e7bd2739eea1d..865b3af9fb2c1e7bdc1e7cecd0f021ee460971dd 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -691,18 +691,25 @@ list(TRANSFORM reftable_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
add_library(reftable STATIC ${reftable_SOURCES})
if(WIN32)
+ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/git.rc
+ COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_SOURCE_DIR}/git.rc.in"
+ "${CMAKE_BINARY_DIR}/git.rc"
+ DEPENDS "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
+ "${CMAKE_SOURCE_DIR}/git.rc.in"
+ VERBATIM)
+
if(NOT MSVC)#use windres when compiling with gcc and clang
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/git.res
- COMMAND ${WINDRES_EXE} -O coff -DMAJOR=${PROJECT_VERSION_MAJOR} -DMINOR=${PROJECT_VERSION_MINOR}
- -DMICRO=${PROJECT_VERSION_PATCH} -DPATCHLEVEL=0 -DGIT_VERSION="\\\"${PROJECT_VERSION}.GIT\\\""
- -i ${CMAKE_SOURCE_DIR}/git.rc -o ${CMAKE_BINARY_DIR}/git.res
+ COMMAND ${WINDRES_EXE} -O coff -i ${CMAKE_BINARY_DIR}/git.rc -o ${CMAKE_BINARY_DIR}/git.res
+ DEPENDS "${CMAKE_BINARY_DIR}/git.rc"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
VERBATIM)
else()#MSVC use rc
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/git.res
- COMMAND ${CMAKE_RC_COMPILER} /d MAJOR=${PROJECT_VERSION_MAJOR} /d MINOR=${PROJECT_VERSION_MINOR}
- /d MICRO=${PROJECT_VERSION_PATCH} /d PATCHLEVEL=0 /d GIT_VERSION="${PROJECT_VERSION}.GIT"
- /fo ${CMAKE_BINARY_DIR}/git.res ${CMAKE_SOURCE_DIR}/git.rc
+ COMMAND ${CMAKE_RC_COMPILER} /fo ${CMAKE_BINARY_DIR}/git.res ${CMAKE_BINARY_DIR}/git.rc
+ DEPENDS "${CMAKE_BINARY_DIR}/git.rc"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
VERBATIM)
endif()
diff --git a/git.rc b/git.rc.in
similarity index 67%
rename from git.rc
rename to git.rc.in
index cc3fdc6cc6cb83b084eebe2ad49f3c78c981789b..e69444eef3f0c558707e067d52820668d2116308 100644
--- a/git.rc
+++ b/git.rc.in
@@ -1,6 +1,6 @@
1 VERSIONINFO
-FILEVERSION MAJOR,MINOR,MICRO,PATCHLEVEL
-PRODUCTVERSION MAJOR,MINOR,MICRO,PATCHLEVEL
+FILEVERSION @GIT_MAJOR_VERSION@,@GIT_MINOR_VERSION@,@GIT_MICRO_VERSION@,@GIT_PATCH_LEVEL@
+PRODUCTVERSION @GIT_MAJOR_VERSION@,@GIT_MINOR_VERSION@,@GIT_MICRO_VERSION@,@GIT_PATCH_LEVEL@
BEGIN
BLOCK "StringFileInfo"
BEGIN
@@ -11,7 +11,7 @@ BEGIN
VALUE "InternalName", "git\0"
VALUE "OriginalFilename", "git.exe\0"
VALUE "ProductName", "Git\0"
- VALUE "ProductVersion", GIT_VERSION "\0"
+ VALUE "ProductVersion", "@GIT_VERSION@\0"
END
END
--
2.47.0.274.g962d0b743d.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v9 06/23] Makefile: generate doc versions via GIT-VERSION-GEN
2024-11-25 9:56 ` [PATCH v9 " Patrick Steinhardt
` (4 preceding siblings ...)
2024-11-25 9:56 ` [PATCH v9 05/23] Makefile: generate "git.rc" via GIT-VERSION-GEN Patrick Steinhardt
@ 2024-11-25 9:56 ` Patrick Steinhardt
2025-01-13 20:17 ` Renato Botelho
2024-11-25 9:56 ` [PATCH v9 07/23] Makefile: consistently use PERL_PATH Patrick Steinhardt
` (16 subsequent siblings)
22 siblings, 1 reply; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-25 9:56 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
The documentation we generate embeds information for the exact Git
version used as well as the date of the commit. This information is
injected by injecting attributes into the build process via command line
argument.
Refactor the logic so that we write the information into "asciidoc.conf"
and "asciidoctor-extensions.rb" via `GIT-VERSION-GEN` for AsciiDoc and
AsciiDoctor, respectively.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Documentation/.gitignore | 2 ++
Documentation/Makefile | 21 ++++++++++++++-------
Documentation/{asciidoc.conf => asciidoc.conf.in} | 3 +++
...r-extensions.rb => asciidoctor-extensions.rb.in} | 8 ++------
GIT-VERSION-GEN | 2 ++
5 files changed, 23 insertions(+), 13 deletions(-)
diff --git a/Documentation/.gitignore b/Documentation/.gitignore
index a48448de32f98b1a054b36e886ea920bccebc494..649df89474d357ccc91109b5c35fe2d0910f968a 100644
--- a/Documentation/.gitignore
+++ b/Documentation/.gitignore
@@ -15,3 +15,5 @@ tmp-doc-diff/
GIT-ASCIIDOCFLAGS
/.build/
/GIT-EXCLUDED-PROGRAMS
+/asciidoc.conf
+/asciidoctor-extensions.rb
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 0f55baa252fffbcd506f0c6f410b26b37f2e9b11..495c61c85ed18bc9c4643f9e5478e5146bb5f196 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -1,6 +1,8 @@
# Import tree-wide shared Makefile behavior and libraries
include ../shared.mak
+.PHONY: FORCE
+
# Guard against environment variables
MAN1_TXT =
MAN5_TXT =
@@ -148,16 +150,12 @@ man5dir = $(mandir)/man5
man7dir = $(mandir)/man7
# DESTDIR =
-GIT_DATE := $(shell git show --quiet --pretty='%as')
-
ASCIIDOC = asciidoc
ASCIIDOC_EXTRA =
ASCIIDOC_HTML = xhtml11
ASCIIDOC_DOCBOOK = docbook
ASCIIDOC_CONF = -f asciidoc.conf
-ASCIIDOC_COMMON = $(ASCIIDOC) $(ASCIIDOC_EXTRA) $(ASCIIDOC_CONF) \
- -amanmanual='Git Manual' -amansource='Git $(GIT_VERSION)' \
- -arevdate='$(GIT_DATE)'
+ASCIIDOC_COMMON = $(ASCIIDOC) $(ASCIIDOC_EXTRA) $(ASCIIDOC_CONF)
ASCIIDOC_DEPS = asciidoc.conf GIT-ASCIIDOCFLAGS
TXT_TO_HTML = $(ASCIIDOC_COMMON) -b $(ASCIIDOC_HTML)
TXT_TO_XML = $(ASCIIDOC_COMMON) -b $(ASCIIDOC_DOCBOOK)
@@ -210,6 +208,14 @@ ASCIIDOC_DEPS = asciidoctor-extensions.rb GIT-ASCIIDOCFLAGS
DBLATEX_COMMON =
XMLTO_EXTRA += --skip-validation
XMLTO_EXTRA += -x manpage.xsl
+
+asciidoctor-extensions.rb: asciidoctor-extensions.rb.in FORCE
+ $(QUIET_GEN)GIT_USER_AGENT="$(GIT_USER_AGENT)" $(SHELL_PATH) ../GIT-VERSION-GEN "$(shell pwd)/.." $< $@+
+ @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
+else
+asciidoc.conf: asciidoc.conf.in FORCE
+ $(QUIET_GEN)GIT_USER_AGENT="$(GIT_USER_AGENT)" $(SHELL_PATH) ../GIT-VERSION-GEN "$(shell pwd)/.." $< $@+
+ @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
endif
ASCIIDOC_DEPS += docinfo.html
@@ -341,6 +347,7 @@ clean:
$(RM) SubmittingPatches.txt
$(RM) $(cmds_txt) $(mergetools_txt) *.made
$(RM) GIT-ASCIIDOCFLAGS
+ $(RM) asciidoc.conf asciidoctor-extensions.rb
docinfo.html: docinfo-html.in
$(QUIET_GEN)$(RM) $@ && cat $< >$@
@@ -364,7 +371,7 @@ manpage-cmd = $(QUIET_XMLTO)$(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
%.xml : %.txt $(ASCIIDOC_DEPS)
$(QUIET_ASCIIDOC)$(TXT_TO_XML) -d manpage -o $@ $<
-user-manual.xml: user-manual.txt user-manual.conf asciidoctor-extensions.rb GIT-ASCIIDOCFLAGS
+user-manual.xml: user-manual.txt user-manual.conf $(ASCIIDOC_DEPS)
$(QUIET_ASCIIDOC)$(TXT_TO_XML) -d book -o $@ $<
technical/api-index.txt: technical/api-index-skel.txt \
@@ -373,7 +380,7 @@ technical/api-index.txt: technical/api-index-skel.txt \
technical/%.html: ASCIIDOC_EXTRA += -a git-relative-html-prefix=../
$(patsubst %,%.html,$(API_DOCS) technical/api-index $(TECH_DOCS)): %.html : %.txt \
- asciidoc.conf GIT-ASCIIDOCFLAGS
+ $(ASCIIDOC_DEPS)
$(QUIET_ASCIIDOC)$(TXT_TO_HTML) $*.txt
SubmittingPatches.txt: SubmittingPatches
diff --git a/Documentation/asciidoc.conf b/Documentation/asciidoc.conf.in
similarity index 97%
rename from Documentation/asciidoc.conf
rename to Documentation/asciidoc.conf.in
index f6da6d1fbd2b208b072c1158dfcfb29c6c01f93a..dbe36a52eabfabef59e31d3be6518549e4f90206 100644
--- a/Documentation/asciidoc.conf
+++ b/Documentation/asciidoc.conf.in
@@ -21,6 +21,9 @@ tilde=~
apostrophe='
backtick=`
litdd=--
+manmanual='Git Manual'
+mansource='Git @GIT_VERSION@'
+revdate='@GIT_DATE@'
ifdef::backend-docbook[]
[linkgit-inlinemacro]
diff --git a/Documentation/asciidoctor-extensions.rb b/Documentation/asciidoctor-extensions.rb.in
similarity index 92%
rename from Documentation/asciidoctor-extensions.rb
rename to Documentation/asciidoctor-extensions.rb.in
index cb24480b63d2ecc5c4ef267f4c501da53fc5b5be..c4c200dace85cf0a89dbc0f54ef25e4d1b6fec4d 100644
--- a/Documentation/asciidoctor-extensions.rb
+++ b/Documentation/asciidoctor-extensions.rb.in
@@ -29,13 +29,9 @@ module Git
class DocumentPostProcessor < Asciidoctor::Extensions::Postprocessor
def process document, output
if document.basebackend? 'docbook'
- mansource = document.attributes['mansource']
- manversion = document.attributes['manversion']
- manmanual = document.attributes['manmanual']
new_tags = "" \
- "<refmiscinfo class=\"source\">#{mansource}</refmiscinfo>\n" \
- "<refmiscinfo class=\"version\">#{manversion}</refmiscinfo>\n" \
- "<refmiscinfo class=\"manual\">#{manmanual}</refmiscinfo>\n"
+ "<refmiscinfo class=\"source\">@GIT_VERSION@</refmiscinfo>\n" \
+ "<refmiscinfo class=\"manual\">Git Manual</refmiscinfo>\n"
output = output.sub(/<\/refmeta>/, new_tags + "</refmeta>")
end
output
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index a1c8146f05cfa7fbc6c47804aec5fb848e67c69c..b4687784c1c348b6efb110c5e8b935b788723f59 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -53,6 +53,7 @@ fi
GIT_VERSION=$(expr "$VN" : v*'\(.*\)')
GIT_BUILT_FROM_COMMIT=$(git -C "$SOURCE_DIR" rev-parse -q --verify HEAD 2>/dev/null)
+GIT_DATE=$(git -C "$SOURCE_DIR" show --quiet --format='%as' 2>/dev/null)
if test -z "$GIT_USER_AGENT"
then
GIT_USER_AGENT="git/$GIT_VERSION"
@@ -72,6 +73,7 @@ sed -e "s|@GIT_VERSION@|$GIT_VERSION|" \
-e "s|@GIT_PATCH_LEVEL@|$GIT_PATCH_LEVEL|" \
-e "s|@GIT_BUILT_FROM_COMMIT@|$GIT_BUILT_FROM_COMMIT|" \
-e "s|@GIT_USER_AGENT@|$GIT_USER_AGENT|" \
+ -e "s|@GIT_DATE@|$GIT_DATE|" \
"$INPUT" >"$OUTPUT"+
if ! test -f "$OUTPUT" || ! cmp "$OUTPUT"+ "$OUTPUT" >/dev/null
--
2.47.0.274.g962d0b743d.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v9 07/23] Makefile: consistently use PERL_PATH
2024-11-25 9:56 ` [PATCH v9 " Patrick Steinhardt
` (5 preceding siblings ...)
2024-11-25 9:56 ` [PATCH v9 06/23] Makefile: generate doc versions " Patrick Steinhardt
@ 2024-11-25 9:56 ` Patrick Steinhardt
2024-11-25 9:56 ` [PATCH v9 08/23] Makefile: extract script to massage Perl scripts Patrick Steinhardt
` (15 subsequent siblings)
22 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-25 9:56 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
When injecting the Perl path into our scripts we sometimes use '@PERL@'
while we othertimes use '@PERL_PATH@'. Refactor the code use the latter
consistently, which makes it easier to reuse the same logic for multiple
scripts.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 2 +-
contrib/buildsystems/CMakeLists.txt | 2 +-
git-instaweb.sh | 4 ++--
git-request-pull.sh | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile
index 1255d222c2dec9a034dee2621192bf97afe905ee..0e289d1dbcbfa48e4566fb3e6d4eedd87ae2d141 100644
--- a/Makefile
+++ b/Makefile
@@ -2554,7 +2554,7 @@ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's/@USE_GETTEXT_SCHEME@/$(USE_GETTEXT_SCHEME)/g' \
-e $(BROKEN_PATH_FIX) \
-e 's|@GITWEBDIR@|$(gitwebdir_SQ)|g' \
- -e 's|@PERL@|$(PERL_PATH_SQ)|g' \
+ -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' \
-e 's|@PAGER_ENV@|$(PAGER_ENV_SQ)|g' \
$@.sh >$@+
endef
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 865b3af9fb2c1e7bdc1e7cecd0f021ee460971dd..ecaae8965cd43d4a5a36201b8760296b52147dc2 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -846,7 +846,7 @@ foreach(script ${git_shell_scripts})
string(REPLACE "@NO_CURL@" "" content "${content}")
string(REPLACE "@USE_GETTEXT_SCHEME@" "" content "${content}")
string(REPLACE "# @BROKEN_PATH_FIX@" "" content "${content}")
- string(REPLACE "@PERL@" "${PERL_PATH}" content "${content}")
+ string(REPLACE "@PERL_PATH@" "${PERL_PATH}" content "${content}")
string(REPLACE "@PAGER_ENV@" "LESS=FRX LV=-c" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
endforeach()
diff --git a/git-instaweb.sh b/git-instaweb.sh
index c8efb1205a8e2a66a6aced840980978897e122bc..5ad50160bb035885d8c180bee3ebb0a8e9622abc 100755
--- a/git-instaweb.sh
+++ b/git-instaweb.sh
@@ -3,7 +3,7 @@
# Copyright (c) 2006 Eric Wong
#
-PERL='@PERL@'
+PERL='@PERL_PATH@'
OPTIONS_KEEPDASHDASH=
OPTIONS_STUCKLONG=
OPTIONS_SPEC="\
@@ -716,7 +716,7 @@ EOF
gitweb_conf() {
cat > "$fqgitdir/gitweb/gitweb_config.perl" <<EOF
-#!@PERL@
+#!@PERL_PATH@
our \$projectroot = "$(dirname "$fqgitdir")";
our \$git_temp = "$fqgitdir/gitweb/tmp";
our \$projects_list = \$projectroot;
diff --git a/git-request-pull.sh b/git-request-pull.sh
index 10c88639e28c02650ffea3d4671afa9a9f0bb182..775ba8ea11aa0fce90ae9bfaea8eac5b8bc584a4 100755
--- a/git-request-pull.sh
+++ b/git-request-pull.sh
@@ -112,7 +112,7 @@ find_matching_ref='
}
'
-set fnord $(git ls-remote "$url" | @PERL@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
+set fnord $(git ls-remote "$url" | @PERL_PATH@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
remote_sha1=$2
ref=$3
--
2.47.0.274.g962d0b743d.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v9 08/23] Makefile: extract script to massage Perl scripts
2024-11-25 9:56 ` [PATCH v9 " Patrick Steinhardt
` (6 preceding siblings ...)
2024-11-25 9:56 ` [PATCH v9 07/23] Makefile: consistently use PERL_PATH Patrick Steinhardt
@ 2024-11-25 9:56 ` Patrick Steinhardt
2024-11-25 9:56 ` [PATCH v9 09/23] Makefile: use "generate-perl.sh" to massage Perl library Patrick Steinhardt
` (14 subsequent siblings)
22 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-25 9:56 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
Extract the script to inject various build-time parameters into our Perl
scripts into a standalone script. This is done such that we can reuse it
in other build systems.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 12 ++----------
contrib/buildsystems/CMakeLists.txt | 32 +++++++++++++++++++++++++++-----
generate-perl.sh | 27 +++++++++++++++++++++++++++
3 files changed, 56 insertions(+), 15 deletions(-)
diff --git a/Makefile b/Makefile
index 0e289d1dbcbfa48e4566fb3e6d4eedd87ae2d141..e33c5b966c7c6cc9ea5d8a072458f11221a21513 100644
--- a/Makefile
+++ b/Makefile
@@ -2606,16 +2606,8 @@ endif
PERL_DEFINES += $(gitexecdir) $(perllibdir) $(localedir)
-$(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
- $(QUIET_GEN) \
- sed -e '1{' \
- -e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \
- -e ' r GIT-PERL-HEADER' \
- -e ' G' \
- -e '}' \
- -e 's/@GIT_VERSION@/$(GIT_VERSION)/g' \
- $< >$@+ && \
- chmod +x $@+ && \
+$(SCRIPT_PERL_GEN): % : %.perl generate-perl.sh GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
+ $(QUIET_GEN)$(SHELL_PATH) generate-perl.sh ./GIT-BUILD-OPTIONS ./GIT-VERSION-FILE GIT-PERL-HEADER "$<" "$@+" && \
mv $@+ $@
PERL_DEFINES := $(subst $(space),:,$(PERL_DEFINES))
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index ecaae8965cd43d4a5a36201b8760296b52147dc2..5cb9a209366e80ef141c6349fea9ddedb2f83d1a 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -852,19 +852,41 @@ foreach(script ${git_shell_scripts})
endforeach()
#perl scripts
-parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" ".perl")
+parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" "")
#create perl header
file(STRINGS ${CMAKE_SOURCE_DIR}/perl/header_templates/fixed_prefix.template.pl perl_header )
string(REPLACE "@PATHSEP@" ":" perl_header "${perl_header}")
string(REPLACE "@INSTLIBDIR@" "${INSTLIBDIR}" perl_header "${perl_header}")
+file(WRITE ${CMAKE_BINARY_DIR}/PERL-HEADER ${perl_header})
+
+add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/GIT-VERSION-FILE"
+ COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE.in"
+ "${CMAKE_BINARY_DIR}/GIT-VERSION-FILE"
+ DEPENDS ${SH_EXE} "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
+ "${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE.in"
+ VERBATIM)
foreach(script ${git_perl_scripts})
- file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.perl content NEWLINE_CONSUME)
- string(REPLACE "#!/usr/bin/perl" "#!/usr/bin/perl\n${perl_header}\n" content "${content}")
- string(REPLACE "@GIT_VERSION@" "${PROJECT_VERSION}" content "${content}")
- file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
+ string(REPLACE ".perl" "" perl_gen_path "${script}")
+
+ add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/${perl_gen_path}"
+ COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-perl.sh"
+ "${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS"
+ "${CMAKE_BINARY_DIR}/GIT-VERSION-FILE"
+ "${CMAKE_BINARY_DIR}/PERL-HEADER"
+ "${CMAKE_SOURCE_DIR}/${script}"
+ "${CMAKE_BINARY_DIR}/${perl_gen_path}"
+ DEPENDS "${CMAKE_SOURCE_DIR}/generate-perl.sh"
+ "${CMAKE_SOURCE_DIR}/${script}"
+ "${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS"
+ "${CMAKE_BINARY_DIR}/GIT-VERSION-FILE"
+ VERBATIM)
+ list(APPEND perl_gen ${CMAKE_BINARY_DIR}/${perl_gen_path})
endforeach()
+add_custom_target(perl-gen ALL DEPENDS ${perl_gen})
#python script
file(STRINGS ${CMAKE_SOURCE_DIR}/git-p4.py content NEWLINE_CONSUME)
diff --git a/generate-perl.sh b/generate-perl.sh
new file mode 100755
index 0000000000000000000000000000000000000000..95072522da4aaabc74164737b72568ccfe4962fc
--- /dev/null
+++ b/generate-perl.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+set -e
+
+if test $# -ne 5
+then
+ echo >&2 "USAGE: $0 <GIT_BUILD_OPTIONS> <GIT_VERSION_FILE> <PERL_HEADER> <INPUT> <OUTPUT>"
+ exit 1
+fi
+
+GIT_BUILD_OPTIONS="$1"
+GIT_VERSION_FILE="$2"
+PERL_HEADER="$3"
+INPUT="$4"
+OUTPUT="$5"
+
+. "$GIT_BUILD_OPTIONS"
+. "$GIT_VERSION_FILE"
+
+sed -e '1{' \
+ -e " s|#!.*perl|#!$PERL_PATH|" \
+ -e " r $PERL_HEADER" \
+ -e ' G' \
+ -e '}' \
+ -e "s/@GIT_VERSION@/$GIT_VERSION/g" \
+ "$INPUT" >"$OUTPUT"
+chmod a+x "$OUTPUT"
--
2.47.0.274.g962d0b743d.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v9 09/23] Makefile: use "generate-perl.sh" to massage Perl library
2024-11-25 9:56 ` [PATCH v9 " Patrick Steinhardt
` (7 preceding siblings ...)
2024-11-25 9:56 ` [PATCH v9 08/23] Makefile: extract script to massage Perl scripts Patrick Steinhardt
@ 2024-11-25 9:56 ` Patrick Steinhardt
2024-11-25 9:56 ` [PATCH v9 10/23] Makefile: extract script to massage Shell scripts Patrick Steinhardt
` (13 subsequent siblings)
22 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-25 9:56 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
Extend "generate-perl.sh" such that it knows to also massage the Perl
library files. There are two major differences:
- We do not read in the Perl header. This is handled by matching on
whether or not we have a Perl shebang.
- We substitute some more variables, which we read in via our
GIT-BUILD-OPTIONS.
Adapt both our Makefile and the CMake build instructions to use this.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-BUILD-OPTIONS.in | 2 ++
Makefile | 10 ++++------
contrib/buildsystems/CMakeLists.txt | 23 +++++++++--------------
generate-perl.sh | 14 ++++++++++++--
4 files changed, 27 insertions(+), 22 deletions(-)
diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in
index f0ca240493c94aa41a6b6241a8474e42f7cdc8b9..050432f9fc49f93d0f6ed98c1307405c52761be0 100644
--- a/GIT-BUILD-OPTIONS.in
+++ b/GIT-BUILD-OPTIONS.in
@@ -1,6 +1,8 @@
SHELL_PATH=@SHELL_PATH@
TEST_SHELL_PATH=@TEST_SHELL_PATH@
PERL_PATH=@PERL_PATH@
+PERL_LOCALEDIR=@PERL_LOCALEDIR@
+NO_PERL_CPAN_FALLBACKS=@NO_PERL_CPAN_FALLBACKS@
DIFF=@DIFF@
PYTHON_PATH=@PYTHON_PATH@
TAR=@TAR@
diff --git a/Makefile b/Makefile
index e33c5b966c7c6cc9ea5d8a072458f11221a21513..b8f96581097d7a29a745afd81de2f58b703da7da 100644
--- a/Makefile
+++ b/Makefile
@@ -3095,13 +3095,9 @@ endif
NO_PERL_CPAN_FALLBACKS_SQ = $(subst ','\'',$(NO_PERL_CPAN_FALLBACKS))
endif
-perl/build/lib/%.pm: perl/%.pm GIT-PERL-DEFINES
+perl/build/lib/%.pm: perl/%.pm generate-perl.sh GIT-BUILD-OPTIONS GIT-VERSION-FILE GIT-PERL-DEFINES
$(call mkdir_p_parent_template)
- $(QUIET_GEN) \
- sed -e 's|@LOCALEDIR@|$(perl_localedir_SQ)|g' \
- -e 's|@NO_GETTEXT@|$(NO_GETTEXT_SQ)|g' \
- -e 's|@NO_PERL_CPAN_FALLBACKS@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \
- < $< > $@
+ $(QUIET_GEN)$(SHELL_PATH) generate-perl.sh ./GIT-BUILD-OPTIONS ./GIT-VERSION-FILE GIT-PERL-HEADER "$<" "$@"
perl/build/man/man3/Git.3pm: perl/Git.pm
$(call mkdir_p_parent_template)
@@ -3168,6 +3164,8 @@ GIT-BUILD-OPTIONS: FORCE
-e "s|@SHELL_PATH@|\'$(SHELL_PATH_SQ)\'|" \
-e "s|@TEST_SHELL_PATH@|\'$(TEST_SHELL_PATH_SQ)\'|" \
-e "s|@PERL_PATH@|\'$(PERL_PATH_SQ)\'|" \
+ -e "s|@PERL_LOCALEDIR@|\'$(perl_localedir_SQ)\'|" \
+ -e "s|@NO_PERL_CPAN_FALLBACKS@|\'$(NO_PERL_CPAN_FALLBACKS_SQ)\'|" \
-e "s|@DIFF@|\'$(DIFF)\'|" \
-e "s|@PYTHON_PATH@|\'$(PYTHON_PATH_SQ)\'|" \
-e "s|@TAR@|\'$(TAR)\'|" \
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 5cb9a209366e80ef141c6349fea9ddedb2f83d1a..52b479e2e5342c3a08c83ecf77a83504778f16a0 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -853,6 +853,9 @@ endforeach()
#perl scripts
parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" "")
+#perl modules
+file(GLOB_RECURSE perl_modules "${CMAKE_SOURCE_DIR}/perl/*.pm")
+list(TRANSFORM perl_modules REPLACE "${CMAKE_SOURCE_DIR}/" "")
#create perl header
file(STRINGS ${CMAKE_SOURCE_DIR}/perl/header_templates/fixed_prefix.template.pl perl_header )
@@ -869,9 +872,12 @@ add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/GIT-VERSION-FILE"
"${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE.in"
VERBATIM)
-foreach(script ${git_perl_scripts})
+foreach(script ${git_perl_scripts} ${perl_modules})
string(REPLACE ".perl" "" perl_gen_path "${script}")
+ get_filename_component(perl_gen_dir "${perl_gen_path}" DIRECTORY)
+ file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/${perl_gen_dir}")
+
add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/${perl_gen_path}"
COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-perl.sh"
"${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS"
@@ -893,19 +899,6 @@ file(STRINGS ${CMAKE_SOURCE_DIR}/git-p4.py content NEWLINE_CONSUME)
string(REPLACE "#!/usr/bin/env python" "#!/usr/bin/python" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/git-p4 ${content})
-#perl modules
-file(GLOB_RECURSE perl_modules "${CMAKE_SOURCE_DIR}/perl/*.pm")
-
-foreach(pm ${perl_modules})
- string(REPLACE "${CMAKE_SOURCE_DIR}/perl/" "" file_path ${pm})
- file(STRINGS ${pm} content NEWLINE_CONSUME)
- string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}")
- string(REPLACE "@NO_PERL_CPAN_FALLBACKS@" "" content "${content}")
- file(WRITE ${CMAKE_BINARY_DIR}/perl/build/lib/${file_path} ${content})
-#test-lib.sh requires perl/build/lib to be the build directory of perl modules
-endforeach()
-
-
#templates
file(GLOB templates "${CMAKE_SOURCE_DIR}/templates/*")
list(TRANSFORM templates REPLACE "${CMAKE_SOURCE_DIR}/templates/" "")
@@ -1155,6 +1148,8 @@ file(STRINGS ${CMAKE_SOURCE_DIR}/GIT-BUILD-OPTIONS.in git_build_options NEWLINE_
string(REPLACE "@SHELL_PATH@" "'${SHELL_PATH}'" git_build_options "${git_build_options}")
string(REPLACE "@TEST_SHELL_PATH@" "'${TEST_SHELL_PATH}'" git_build_options "${git_build_options}")
string(REPLACE "@PERL_PATH@" "'${PERL_PATH}'" git_build_options "${git_build_options}")
+string(REPLACE "@PERL_LOCALEDIR@" "'${LOCALEDIR}'" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PERL_CPAN_FALLBACKS@" "" git_build_options "${git_build_options}")
string(REPLACE "@DIFF@" "'${DIFF}'" git_build_options "${git_build_options}")
string(REPLACE "@PYTHON_PATH@" "'${PYTHON_PATH}'" git_build_options "${git_build_options}")
string(REPLACE "@TAR@" "'${TAR}'" git_build_options "${git_build_options}")
diff --git a/generate-perl.sh b/generate-perl.sh
index 95072522da4aaabc74164737b72568ccfe4962fc..65f122ebfc76dcce607aca07fdbd9dc9e65a6b19 100755
--- a/generate-perl.sh
+++ b/generate-perl.sh
@@ -18,10 +18,20 @@ OUTPUT="$5"
. "$GIT_VERSION_FILE"
sed -e '1{' \
+ -e " /^#!.*perl/!b" \
-e " s|#!.*perl|#!$PERL_PATH|" \
-e " r $PERL_HEADER" \
-e ' G' \
-e '}' \
- -e "s/@GIT_VERSION@/$GIT_VERSION/g" \
+ -e "s|@GIT_VERSION@|$GIT_VERSION|g" \
+ -e "s|@LOCALEDIR@|$PERL_LOCALEDIR|g" \
+ -e "s|@NO_GETTEXT@|$NO_GETTEXT|g" \
+ -e "s|@NO_PERL_CPAN_FALLBACKS@|$NO_PERL_CPAN_FALLBACKS|g" \
"$INPUT" >"$OUTPUT"
-chmod a+x "$OUTPUT"
+
+case "$INPUT" in
+*.perl)
+ chmod a+x "$OUTPUT";;
+*)
+ ;;
+esac
--
2.47.0.274.g962d0b743d.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v9 10/23] Makefile: extract script to massage Shell scripts
2024-11-25 9:56 ` [PATCH v9 " Patrick Steinhardt
` (8 preceding siblings ...)
2024-11-25 9:56 ` [PATCH v9 09/23] Makefile: use "generate-perl.sh" to massage Perl library Patrick Steinhardt
@ 2024-11-25 9:56 ` Patrick Steinhardt
2024-11-25 9:56 ` [PATCH v9 11/23] Makefile: extract script to generate gitweb.cgi Patrick Steinhardt
` (12 subsequent siblings)
22 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-25 9:56 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
Same as in the preceding commits, extract a script that allows us to
unify how we massage shell scripts.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-BUILD-OPTIONS.in | 4 ++++
Makefile | 34 ++++++++++------------------------
contrib/buildsystems/CMakeLists.txt | 31 ++++++++++++++++++++-----------
generate-script.sh | 34 ++++++++++++++++++++++++++++++++++
4 files changed, 68 insertions(+), 35 deletions(-)
diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in
index 050432f9fc49f93d0f6ed98c1307405c52761be0..9b95a6b3eee334b6f691702696ca9d92201b6bac 100644
--- a/GIT-BUILD-OPTIONS.in
+++ b/GIT-BUILD-OPTIONS.in
@@ -36,3 +36,7 @@ GIT_INTEROP_MAKE_OPTS=@GIT_INTEROP_MAKE_OPTS@
GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@
GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@
RUNTIME_PREFIX=@RUNTIME_PREFIX@
+GITWEBDIR=@GITWEBDIR@
+USE_GETTEXT_SCHEME=@USE_GETTEXT_SCHEME@
+LOCALEDIR=@LOCALEDIR@
+BROKEN_PATH_FIX=@BROKEN_PATH_FIX@
diff --git a/Makefile b/Makefile
index b8f96581097d7a29a745afd81de2f58b703da7da..c898720861b6aad04610b43b33244234dafaee4d 100644
--- a/Makefile
+++ b/Makefile
@@ -1558,10 +1558,10 @@ endif
ifdef SANE_TOOL_PATH
SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH))
-BROKEN_PATH_FIX = 's|^\# @BROKEN_PATH_FIX@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|'
+BROKEN_PATH_FIX = s|^\# @BROKEN_PATH_FIX@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|
PATH := $(SANE_TOOL_PATH):${PATH}
else
-BROKEN_PATH_FIX = '/^\# @BROKEN_PATH_FIX@$$/d'
+BROKEN_PATH_FIX = /^\# @BROKEN_PATH_FIX@$$/d
endif
ifeq (,$(HOST_CPU))
@@ -2546,26 +2546,8 @@ GIT-SCRIPT-DEFINES: FORCE
echo "$$FLAGS" >$@; \
fi
-define cmd_munge_script
-sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
- -e 's|@DIFF@|$(DIFF_SQ)|' \
- -e 's|@LOCALEDIR@|$(localedir_SQ)|g' \
- -e 's/@USE_GETTEXT_SCHEME@/$(USE_GETTEXT_SCHEME)/g' \
- -e $(BROKEN_PATH_FIX) \
- -e 's|@GITWEBDIR@|$(gitwebdir_SQ)|g' \
- -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' \
- -e 's|@PAGER_ENV@|$(PAGER_ENV_SQ)|g' \
- $@.sh >$@+
-endef
-
-$(SCRIPT_SH_GEN) : % : %.sh GIT-SCRIPT-DEFINES
- $(QUIET_GEN)$(cmd_munge_script) && \
- chmod +x $@+ && \
- mv $@+ $@
-
-$(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEFINES
- $(QUIET_GEN)$(cmd_munge_script) && \
+$(SCRIPT_SH_GEN) $(SCRIPT_LIB) : % : %.sh generate-script.sh GIT-BUILD-OPTIONS GIT-SCRIPT-DEFINES
+ $(QUIET_GEN)./generate-script.sh "$<" "$@+" ./GIT-BUILD-OPTIONS && \
mv $@+ $@
git.rc: git.rc.in GIT-VERSION-GEN GIT-VERSION-FILE
@@ -2635,8 +2617,8 @@ GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile
perllibdir:
@echo '$(perllibdir_SQ)'
-git-instaweb: git-instaweb.sh GIT-SCRIPT-DEFINES
- $(QUIET_GEN)$(cmd_munge_script) && \
+git-instaweb: git-instaweb.sh generate-script.sh GIT-BUILD-OPTIONS GIT-SCRIPT-DEFINES
+ $(QUIET_GEN)./generate-script.sh "$<" "$@+" ./GIT-BUILD-OPTIONS && \
chmod +x $@+ && \
mv $@+ $@
else # NO_PERL
@@ -3199,6 +3181,10 @@ GIT-BUILD-OPTIONS: FORCE
-e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \
-e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \
-e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX_OPTION)\'|" \
+ -e "s|@GITWEBDIR@|\'$(gitwebdir_SQ)\'|" \
+ -e "s|@USE_GETTEXT_SCHEME@|\'$(USE_GETTEXT_SCHEME)\'|" \
+ -e "s|@LOCALEDIR@|\'$(localedir_SQ)\'|" \
+ -e "s!@BROKEN_PATH_FIX@!\'$(BROKEN_PATH_FIX)\'!" \
GIT-BUILD-OPTIONS.in >$@+
@if grep -q '^[A-Z][A-Z_]*=@.*@$$' $@+; then echo "Unsubstituted build options in $@" >&2 && exit 1; fi
@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 52b479e2e5342c3a08c83ecf77a83504778f16a0..defdd958bb64906489482b77752b1a137282824f 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -838,18 +838,23 @@ set(git_shell_scripts
${git_sh_scripts} ${git_shlib_scripts} git-instaweb)
foreach(script ${git_shell_scripts})
- file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.sh content NEWLINE_CONSUME)
- string(REPLACE "@SHELL_PATH@" "${SHELL_PATH}" content "${content}")
- string(REPLACE "@DIFF@" "diff" content "${content}")
- string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}")
- string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" content "${content}")
- string(REPLACE "@NO_CURL@" "" content "${content}")
- string(REPLACE "@USE_GETTEXT_SCHEME@" "" content "${content}")
- string(REPLACE "# @BROKEN_PATH_FIX@" "" content "${content}")
- string(REPLACE "@PERL_PATH@" "${PERL_PATH}" content "${content}")
- string(REPLACE "@PAGER_ENV@" "LESS=FRX LV=-c" content "${content}")
- file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
+ if ("${script}" IN_LIST git_sh_scripts)
+ string(REPLACE ".sh" "" shell_gen_path "${script}")
+ else()
+ set(shell_gen_path "${script}")
+ endif()
+
+ add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/${shell_gen_path}"
+ COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-script.sh"
+ "${CMAKE_SOURCE_DIR}/${script}.sh"
+ "${CMAKE_BINARY_DIR}/${shell_gen_path}"
+ "${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS"
+ DEPENDS "${CMAKE_SOURCE_DIR}/generate-script.sh"
+ "${CMAKE_SOURCE_DIR}/${script}.sh"
+ VERBATIM)
+ list(APPEND shell_gen ${CMAKE_BINARY_DIR}/${shell_gen_path})
endforeach()
+add_custom_target(shell-gen ALL DEPENDS ${shell_gen})
#perl scripts
parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" "")
@@ -1183,6 +1188,10 @@ string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_optio
string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}")
string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}")
string(REPLACE "@RUNTIME_PREFIX@" "'${RUNTIME_PREFIX}'" git_build_options "${git_build_options}")
+string(REPLACE "@GITWEBDIR@" "'${GITWEBDIR}'" git_build_options "${git_build_options}")
+string(REPLACE "@USE_GETTEXT_SCHEME@" "" git_build_options "${git_build_options}")
+string(REPLACE "@LOCALEDIR@" "'${LOCALEDIR}'" git_build_options "${git_build_options}")
+string(REPLACE "@BROKEN_PATH_FIX@" "" git_build_options "${git_build_options}")
if(USE_VCPKG)
string(APPEND git_build_options "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
endif()
diff --git a/generate-script.sh b/generate-script.sh
new file mode 100755
index 0000000000000000000000000000000000000000..a149e4f0ba348e62b963a2a95e1b250e8732fc20
--- /dev/null
+++ b/generate-script.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+set -e
+
+if test $# -ne 3
+then
+ echo >&2 "USAGE: $0 <INPUT> <OUTPUT> <GIT-BUILD-OPTIONS>"
+ exit 1
+fi
+
+INPUT="$1"
+OUTPUT="$2"
+BUILD_OPTIONS="$3"
+
+. "$BUILD_OPTIONS"
+
+sed -e "1s|#!.*/sh|#!$SHELL_PATH|" \
+ -e "s|@SHELL_PATH@|$SHELL_PATH|" \
+ -e "s|@DIFF@|$DIFF|" \
+ -e "s|@LOCALEDIR@|$LOCALEDIR|g" \
+ -e "s/@USE_GETTEXT_SCHEME@/$USE_GETTEXT_SCHEME/g" \
+ -e "$BROKEN_PATH_FIX" \
+ -e "s|@GITWEBDIR@|$GITWEBDIR|g" \
+ -e "s|@PERL_PATH@|$PERL_PATH|g" \
+ -e "s|@PAGER_ENV@|$PAGER_ENV|g" \
+ "$INPUT" >"$OUTPUT"
+
+case "$(basename "$INPUT")" in
+git-mergetool--lib.sh|git-sh-i18n.sh|git-sh-setup.sh)
+ ;;
+*)
+ chmod a+x "$OUTPUT"
+ ;;
+esac
--
2.47.0.274.g962d0b743d.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v9 11/23] Makefile: extract script to generate gitweb.cgi
2024-11-25 9:56 ` [PATCH v9 " Patrick Steinhardt
` (9 preceding siblings ...)
2024-11-25 9:56 ` [PATCH v9 10/23] Makefile: extract script to massage Shell scripts Patrick Steinhardt
@ 2024-11-25 9:56 ` Patrick Steinhardt
2024-11-25 9:57 ` [PATCH v9 12/23] Makefile: extract script to generate gitweb.js Patrick Steinhardt
` (11 subsequent siblings)
22 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-25 9:56 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
In order to generate "gitweb.cgi" we have to replace various different
placeholders. This is done ad-hoc and is thus not easily reusable across
different build systems.
Introduce a new GITWEB-BUILD-OPTIONS.in template that we populate at
configuration time with the expected options. This script is then used
as input for a new "generate-gitweb.sh" script that generates the final
"gitweb.cgi" file. While this requires us to repeat the options multiple
times, it is in line to how we generate other build options like our
GIT-BUILD-OPTIONS file.
While at it, refactor how we replace the GITWEB_PROJECT_MAXDEPTH. Even
though this variable is supposed to be an integer, the source file has
the value quoted. The quotes are eventually stripped via sed(1), which
replaces `"@GITWEB_PROJECT_MAXDEPTH@"` with the actual value, which is
rather nonsensical. This is made clearer by just dropping the quotes in
the source file.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
gitweb/GITWEB-BUILD-OPTIONS.in | 24 +++++++++++++++++
gitweb/Makefile | 59 +++++++++++++++++++++---------------------
gitweb/generate-gitweb-cgi.sh | 47 +++++++++++++++++++++++++++++++++
gitweb/gitweb.perl | 2 +-
4 files changed, 101 insertions(+), 31 deletions(-)
diff --git a/gitweb/GITWEB-BUILD-OPTIONS.in b/gitweb/GITWEB-BUILD-OPTIONS.in
new file mode 100644
index 0000000000000000000000000000000000000000..41ac20654c4f79917993bafa8f7e447669552b9d
--- /dev/null
+++ b/gitweb/GITWEB-BUILD-OPTIONS.in
@@ -0,0 +1,24 @@
+PERL_PATH=@PERL_PATH@
+JSMIN=@JSMIN@
+CSSMIN=@CSSMIN@
+GIT_BINDIR=@GIT_BINDIR@
+GITWEB_CONFIG=@GITWEB_CONFIG@
+GITWEB_CONFIG_SYSTEM=@GITWEB_CONFIG_SYSTEM@
+GITWEB_CONFIG_COMMON=@GITWEB_CONFIG_COMMON@
+GITWEB_HOME_LINK_STR=@GITWEB_HOME_LINK_STR@
+GITWEB_SITENAME=@GITWEB_SITENAME@
+GITWEB_PROJECTROOT=@GITWEB_PROJECTROOT@
+GITWEB_PROJECT_MAXDEPTH=@GITWEB_PROJECT_MAXDEPTH@
+GITWEB_EXPORT_OK=@GITWEB_EXPORT_OK@
+GITWEB_STRICT_EXPORT=@GITWEB_STRICT_EXPORT@
+GITWEB_BASE_URL=@GITWEB_BASE_URL@
+GITWEB_LIST=@GITWEB_LIST@
+GITWEB_HOMETEXT=@GITWEB_HOMETEXT@
+GITWEB_CSS=@GITWEB_CSS@
+GITWEB_LOGO=@GITWEB_LOGO@
+GITWEB_FAVICON=@GITWEB_FAVICON@
+GITWEB_JS=@GITWEB_JS@
+GITWEB_SITE_HTML_HEAD_STRING=@GITWEB_SITE_HTML_HEAD_STRING@
+GITWEB_SITE_HEADER=@GITWEB_SITE_HEADER@
+GITWEB_SITE_FOOTER=@GITWEB_SITE_FOOTER@
+HIGHLIGHT_BIN=@HIGHLIGHT_BIN@
diff --git a/gitweb/Makefile b/gitweb/Makefile
index 164c8d53757f98599ad14eeb22ca8d542eb7502a..16a2ef2d1e5664d99f6f1d8ff4224c36769c55fb 100644
--- a/gitweb/Makefile
+++ b/gitweb/Makefile
@@ -77,43 +77,42 @@ GITWEB_JSLIB_FILES += static/js/javascript-detection.js
GITWEB_JSLIB_FILES += static/js/adjust-timezone.js
GITWEB_JSLIB_FILES += static/js/blame_incremental.js
-
-GITWEB_REPLACE = \
- -e 's|@GIT_VERSION@|$(GIT_VERSION)|g' \
- -e 's|@GIT_BINDIR@|$(bindir)|g' \
- -e 's|@GITWEB_CONFIG@|$(GITWEB_CONFIG)|g' \
- -e 's|@GITWEB_CONFIG_SYSTEM@|$(GITWEB_CONFIG_SYSTEM)|g' \
- -e 's|@GITWEB_CONFIG_COMMON@|$(GITWEB_CONFIG_COMMON)|g' \
- -e 's|@GITWEB_HOME_LINK_STR@|$(GITWEB_HOME_LINK_STR)|g' \
- -e 's|@GITWEB_SITENAME@|$(GITWEB_SITENAME)|g' \
- -e 's|@GITWEB_PROJECTROOT@|$(GITWEB_PROJECTROOT)|g' \
- -e 's|"@GITWEB_PROJECT_MAXDEPTH@"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
- -e 's|@GITWEB_EXPORT_OK@|$(GITWEB_EXPORT_OK)|g' \
- -e 's|@GITWEB_STRICT_EXPORT@|$(GITWEB_STRICT_EXPORT)|g' \
- -e 's|@GITWEB_BASE_URL@|$(GITWEB_BASE_URL)|g' \
- -e 's|@GITWEB_LIST@|$(GITWEB_LIST)|g' \
- -e 's|@GITWEB_HOMETEXT@|$(GITWEB_HOMETEXT)|g' \
- -e 's|@GITWEB_CSS@|$(GITWEB_CSS)|g' \
- -e 's|@GITWEB_LOGO@|$(GITWEB_LOGO)|g' \
- -e 's|@GITWEB_FAVICON@|$(GITWEB_FAVICON)|g' \
- -e 's|@GITWEB_JS@|$(GITWEB_JS)|g' \
- -e 's|@GITWEB_SITE_HTML_HEAD_STRING@|$(GITWEB_SITE_HTML_HEAD_STRING)|g' \
- -e 's|@GITWEB_SITE_HEADER@|$(GITWEB_SITE_HEADER)|g' \
- -e 's|@GITWEB_SITE_FOOTER@|$(GITWEB_SITE_FOOTER)|g' \
- -e 's|@HIGHLIGHT_BIN@|$(HIGHLIGHT_BIN)|g'
-
.PHONY: FORCE
$(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS: FORCE
- @rm -f $@+
- @echo "x" '$(PERL_PATH_SQ)' $(GITWEB_REPLACE) "$(JSMIN)|$(CSSMIN)" >$@+
+ @sed -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|' \
+ -e 's|@JSMIN@|$(JSMIN)|' \
+ -e 's|@CSSMIN@|$(CSSMIN)|' \
+ -e 's|@GIT_VERSION@|$(GIT_VERSION)|' \
+ -e 's|@GIT_BINDIR@|$(bindir)|' \
+ -e 's|@GITWEB_CONFIG@|$(GITWEB_CONFIG)|' \
+ -e 's|@GITWEB_CONFIG_SYSTEM@|$(GITWEB_CONFIG_SYSTEM)|' \
+ -e 's|@GITWEB_CONFIG_COMMON@|$(GITWEB_CONFIG_COMMON)|' \
+ -e 's|@GITWEB_HOME_LINK_STR@|$(GITWEB_HOME_LINK_STR)|' \
+ -e 's|@GITWEB_SITENAME@|$(GITWEB_SITENAME)|' \
+ -e 's|@GITWEB_PROJECTROOT@|$(GITWEB_PROJECTROOT)|' \
+ -e 's|@GITWEB_PROJECT_MAXDEPTH@|$(GITWEB_PROJECT_MAXDEPTH)|' \
+ -e 's|@GITWEB_EXPORT_OK@|$(GITWEB_EXPORT_OK)|' \
+ -e 's|@GITWEB_STRICT_EXPORT@|$(GITWEB_STRICT_EXPORT)|' \
+ -e 's|@GITWEB_BASE_URL@|$(GITWEB_BASE_URL)|' \
+ -e 's|@GITWEB_LIST@|$(GITWEB_LIST)|' \
+ -e 's|@GITWEB_HOMETEXT@|$(GITWEB_HOMETEXT)|' \
+ -e 's|@GITWEB_CSS@|$(GITWEB_CSS)|' \
+ -e 's|@GITWEB_LOGO@|$(GITWEB_LOGO)|' \
+ -e 's|@GITWEB_FAVICON@|$(GITWEB_FAVICON)|' \
+ -e 's|@GITWEB_JS@|$(GITWEB_JS)|' \
+ -e 's|@GITWEB_SITE_HTML_HEAD_STRING@|$(GITWEB_SITE_HTML_HEAD_STRING)|' \
+ -e 's|@GITWEB_SITE_HEADER@|$(GITWEB_SITE_HEADER)|' \
+ -e 's|@GITWEB_SITE_FOOTER@|$(GITWEB_SITE_FOOTER)|' \
+ -e 's|@HIGHLIGHT_BIN@|$(HIGHLIGHT_BIN)|' \
+ $(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS.in >"$@+"
@cmp -s $@+ $@ && rm -f $@+ || mv -f $@+ $@
+$(MAK_DIR_GITWEB)gitweb.cgi: $(MAK_DIR_GITWEB)generate-gitweb-cgi.sh
$(MAK_DIR_GITWEB)gitweb.cgi: $(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS
+$(MAK_DIR_GITWEB)gitweb.cgi: GIT-VERSION-FILE
$(MAK_DIR_GITWEB)gitweb.cgi: $(MAK_DIR_GITWEB)gitweb.perl
$(QUIET_GEN)$(RM) $@ $@+ && \
- sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
- $(GITWEB_REPLACE) $< >$@+ && \
- chmod +x $@+ && \
+ $(MAK_DIR_GITWEB)generate-gitweb-cgi.sh $(MAK_DIR_GITWEB)/GITWEB-BUILD-OPTIONS ./GIT-VERSION-FILE $< $@+ && \
mv $@+ $@
$(MAK_DIR_GITWEB)static/gitweb.js: $(addprefix $(MAK_DIR_GITWEB),$(GITWEB_JSLIB_FILES))
diff --git a/gitweb/generate-gitweb-cgi.sh b/gitweb/generate-gitweb-cgi.sh
new file mode 100755
index 0000000000000000000000000000000000000000..ede9038c3352d2155340c7fb1c62c467f8ce96ab
--- /dev/null
+++ b/gitweb/generate-gitweb-cgi.sh
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+set -e
+
+if test $# -ne 4
+then
+ echo >&2 "USAGE: $0 <GITWEB-BUILD-OPTIONS> <GIT-VERSION-FILE> <INPUT> <OUTPUT>"
+ exit 1
+fi
+
+GITWEB_BUILD_OPTIONS="$1"
+GIT_VERSION_FILE="$2"
+INPUT="$3"
+OUTPUT="$4"
+
+. "$GITWEB_BUILD_OPTIONS"
+. "$GIT_VERSION_FILE"
+
+sed -e "1s|#!/usr/bin/perl|#!$PERL_PATH|" \
+ -e "s|@PERL_PATH@|$PERL_PATH|" \
+ -e "s|@JSMIN@|$JSMIN|" \
+ -e "s|@CSSMIN@|$CSSMIN|" \
+ -e "s|@GIT_VERSION@|$GIT_VERSION|" \
+ -e "s|@GIT_BINDIR@|$GIT_BINDIR|" \
+ -e "s|@GITWEB_CONFIG@|$GITWEB_CONFIG|" \
+ -e "s|@GITWEB_CONFIG_SYSTEM@|$GITWEB_CONFIG_SYSTEM|" \
+ -e "s|@GITWEB_CONFIG_COMMON@|$GITWEB_CONFIG_COMMON|" \
+ -e "s|@GITWEB_HOME_LINK_STR@|$GITWEB_HOME_LINK_STR|" \
+ -e "s|@GITWEB_SITENAME@|$GITWEB_SITENAME|" \
+ -e "s|@GITWEB_PROJECTROOT@|$GITWEB_PROJECTROOT|" \
+ -e "s|@GITWEB_PROJECT_MAXDEPTH@|$GITWEB_PROJECT_MAXDEPTH|" \
+ -e "s|@GITWEB_EXPORT_OK@|$GITWEB_EXPORT_OK|" \
+ -e "s|@GITWEB_STRICT_EXPORT@|$GITWEB_STRICT_EXPORT|" \
+ -e "s|@GITWEB_BASE_URL@|$GITWEB_BASE_URL|" \
+ -e "s|@GITWEB_LIST@|$GITWEB_LIST|" \
+ -e "s|@GITWEB_HOMETEXT@|$GITWEB_HOMETEXT|" \
+ -e "s|@GITWEB_CSS@|$GITWEB_CSS|" \
+ -e "s|@GITWEB_LOGO@|$GITWEB_LOGO|" \
+ -e "s|@GITWEB_FAVICON@|$GITWEB_FAVICON|" \
+ -e "s|@GITWEB_JS@|$GITWEB_JS|" \
+ -e "s|@GITWEB_SITE_HTML_HEAD_STRING@|$GITWEB_SITE_HTML_HEAD_STRING|" \
+ -e "s|@GITWEB_SITE_HEADER@|$GITWEB_SITE_HEADER|" \
+ -e "s|@GITWEB_SITE_FOOTER@|$GITWEB_SITE_FOOTER|" \
+ -e "s|@HIGHLIGHT_BIN@|$HIGHLIGHT_BIN|" \
+ "$INPUT" >"$OUTPUT"
+
+chmod a+x "$OUTPUT"
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 76e1f4e244fd23dd29b935e83753efa9c6d5bb5e..41bc64ec73f9f05666480025c3b70650607b4cd8 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -88,7 +88,7 @@ sub evaluate_uri {
# fs traversing limit for getting project list
# the number is relative to the projectroot
-our $project_maxdepth = "@GITWEB_PROJECT_MAXDEPTH@";
+our $project_maxdepth = @GITWEB_PROJECT_MAXDEPTH@;
# string of the home link on top of all pages
our $home_link_str = "@GITWEB_HOME_LINK_STR@";
--
2.47.0.274.g962d0b743d.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v9 12/23] Makefile: extract script to generate gitweb.js
2024-11-25 9:56 ` [PATCH v9 " Patrick Steinhardt
` (10 preceding siblings ...)
2024-11-25 9:56 ` [PATCH v9 11/23] Makefile: extract script to generate gitweb.cgi Patrick Steinhardt
@ 2024-11-25 9:57 ` Patrick Steinhardt
2024-11-25 9:57 ` [PATCH v9 13/23] Makefile: refactor generators to be PWD-independent Patrick Steinhardt
` (10 subsequent siblings)
22 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-25 9:57 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
Similar to the preceding commit, also extract the script to generate the
"gitweb.js" file. While the logic itself is trivial, it helps us avoid
duplication of logic across build systems and ensures that the build
systems will remain in sync with each other in case the logic ever needs
to change.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
gitweb/Makefile | 3 ++-
gitweb/generate-gitweb-js.sh | 12 ++++++++++++
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/gitweb/Makefile b/gitweb/Makefile
index 16a2ef2d1e5664d99f6f1d8ff4224c36769c55fb..d5748e93594eb6181269c2fe272bf7ef980cbe68 100644
--- a/gitweb/Makefile
+++ b/gitweb/Makefile
@@ -115,9 +115,10 @@ $(MAK_DIR_GITWEB)gitweb.cgi: $(MAK_DIR_GITWEB)gitweb.perl
$(MAK_DIR_GITWEB)generate-gitweb-cgi.sh $(MAK_DIR_GITWEB)/GITWEB-BUILD-OPTIONS ./GIT-VERSION-FILE $< $@+ && \
mv $@+ $@
+$(MAK_DIR_GITWEB)static/gitweb.js: $(MAK_DIR_GITWEB)generate-gitweb-js.sh
$(MAK_DIR_GITWEB)static/gitweb.js: $(addprefix $(MAK_DIR_GITWEB),$(GITWEB_JSLIB_FILES))
$(QUIET_GEN)$(RM) $@ $@+ && \
- cat $^ >$@+ && \
+ $(MAK_DIR_GITWEB)generate-gitweb-js.sh $@+ $^ && \
mv $@+ $@
### Installation rules
diff --git a/gitweb/generate-gitweb-js.sh b/gitweb/generate-gitweb-js.sh
new file mode 100755
index 0000000000000000000000000000000000000000..01bb22b04b8d8910608fec6376f07d570ab02a33
--- /dev/null
+++ b/gitweb/generate-gitweb-js.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+if test "$#" -lt 2
+then
+ echo >&2 "USAGE: $0 <OUTPUT> <INPUT>..."
+ exit 1
+fi
+
+OUTPUT="$1"
+shift
+
+cat "$@" >"$OUTPUT"
--
2.47.0.274.g962d0b743d.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v9 13/23] Makefile: refactor generators to be PWD-independent
2024-11-25 9:56 ` [PATCH v9 " Patrick Steinhardt
` (11 preceding siblings ...)
2024-11-25 9:57 ` [PATCH v9 12/23] Makefile: extract script to generate gitweb.js Patrick Steinhardt
@ 2024-11-25 9:57 ` Patrick Steinhardt
2024-11-25 9:57 ` [PATCH v9 14/23] Makefile: allow "bin-wrappers/" directory to exist Patrick Steinhardt
` (9 subsequent siblings)
22 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-25 9:57 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
We have multiple scripts that generate headers from other data. All of
these scripts have the assumption built-in that they are executed in the
current source directory, which makes them a bit unwieldy to use during
out-of-tree builds.
Refactor them to instead take the source directory as well as the output
file as arguments.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 6 +++---
contrib/buildsystems/CMakeLists.txt | 19 +++++++++--------
generate-cmdlist.sh | 42 +++++++++++++++++++++++--------------
generate-configlist.sh | 20 +++++++++++++-----
generate-hooklist.sh | 15 ++++++++++++-
5 files changed, 68 insertions(+), 34 deletions(-)
diff --git a/Makefile b/Makefile
index c898720861b6aad04610b43b33244234dafaee4d..61639d17dc364acf30ffd2d317015d8db440acc1 100644
--- a/Makefile
+++ b/Makefile
@@ -2523,17 +2523,17 @@ $(BUILT_INS): git$X
config-list.h: generate-configlist.sh
config-list.h: Documentation/*config.txt Documentation/config/*.txt
- $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh >$@
+ $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh . $@
command-list.h: generate-cmdlist.sh command-list.txt
command-list.h: $(wildcard Documentation/git*.txt)
$(QUIET_GEN)$(SHELL_PATH) ./generate-cmdlist.sh \
$(patsubst %,--exclude-program %,$(EXCLUDED_PROGRAMS)) \
- command-list.txt >$@
+ . $@
hook-list.h: generate-hooklist.sh Documentation/githooks.txt
- $(QUIET_GEN)$(SHELL_PATH) ./generate-hooklist.sh >$@
+ $(QUIET_GEN)$(SHELL_PATH) ./generate-hooklist.sh . $@
SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):\
$(localedir_SQ):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index defdd958bb64906489482b77752b1a137282824f..de2c24e66b5b94e18368aba576fc11418e2aa049 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -638,23 +638,24 @@ set(EXCLUSION_PROGS_CACHE ${EXCLUSION_PROGS} CACHE STRING "Programs not built" F
if(NOT EXISTS ${CMAKE_BINARY_DIR}/command-list.h OR NOT EXCLUSION_PROGS_CACHE STREQUAL EXCLUSION_PROGS)
list(REMOVE_ITEM EXCLUSION_PROGS empty)
message("Generating command-list.h")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-cmdlist.sh ${EXCLUSION_PROGS} command-list.txt
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_FILE ${CMAKE_BINARY_DIR}/command-list.h)
+ execute_process(COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-cmdlist.sh"
+ ${EXCLUSION_PROGS}
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_BINARY_DIR}/command-list.h")
endif()
if(NOT EXISTS ${CMAKE_BINARY_DIR}/config-list.h)
message("Generating config-list.h")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-configlist.sh
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_FILE ${CMAKE_BINARY_DIR}/config-list.h)
+ execute_process(COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-configlist.sh"
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_BINARY_DIR}/config-list.h")
endif()
if(NOT EXISTS ${CMAKE_BINARY_DIR}/hook-list.h)
message("Generating hook-list.h")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-hooklist.sh
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_FILE ${CMAKE_BINARY_DIR}/hook-list.h)
+ execute_process(COMMAND "${SH_EXE}" ${CMAKE_SOURCE_DIR}/generate-hooklist.sh
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_BINARY_DIR}/hook-list.h")
endif()
include_directories(${CMAKE_BINARY_DIR})
diff --git a/generate-cmdlist.sh b/generate-cmdlist.sh
index 205541e0f7f81b1df4061215ae34a2742a45475d..b923a5aab80dfa571a40a4f6fa3d860fcf8f8dd1 100755
--- a/generate-cmdlist.sh
+++ b/generate-cmdlist.sh
@@ -64,7 +64,7 @@ define_category_names () {
print_command_list () {
echo "static struct cmdname_help command_list[] = {"
- echo "$1" |
+ echo "$2" |
while read cmd rest
do
synopsis=
@@ -76,7 +76,7 @@ print_command_list () {
break
;;
esac
- done <"Documentation/$cmd.txt"
+ done <"$1/Documentation/$cmd.txt"
printf '\t{ "%s", N_("%s"), 0' "$cmd" "$synopsis"
printf " | CAT_%s" $rest
@@ -93,18 +93,28 @@ do
shift
done
-commands="$(command_list "$1")"
-categories="$(category_list "$commands")"
+if test "$#" -ne 2
+then
+ die "USAGE: $0 <SOURCE_DIR> <OUTPUT>"
+fi
+
+SOURCE_DIR="$1"
+OUTPUT="$2"
+
+{
+ commands="$(command_list "$SOURCE_DIR"/command-list.txt)"
+ categories="$(category_list "$commands")"
-echo "/* Automatically generated by generate-cmdlist.sh */
-struct cmdname_help {
- const char *name;
- const char *help;
- uint32_t category;
-};
-"
-define_categories "$categories"
-echo
-define_category_names "$categories"
-echo
-print_command_list "$commands"
+ echo "/* Automatically generated by generate-cmdlist.sh */
+ struct cmdname_help {
+ const char *name;
+ const char *help;
+ uint32_t category;
+ };
+ "
+ define_categories "$categories"
+ echo
+ define_category_names "$categories"
+ echo
+ print_command_list "$SOURCE_DIR" "$commands"
+} >"$OUTPUT"
diff --git a/generate-configlist.sh b/generate-configlist.sh
index 8692fe5cf4d5e4025265e6110254b05640615fea..579422619cc777ff597523a4db81b99912aac3aa 100755
--- a/generate-configlist.sh
+++ b/generate-configlist.sh
@@ -1,13 +1,19 @@
#!/bin/sh
-echo "/* Automatically generated by generate-configlist.sh */"
-echo
+SOURCE_DIR="$1"
+OUTPUT="$2"
+
+if test -z "$SOURCE_DIR" || ! test -d "$SOURCE_DIR" || test -z "$OUTPUT"
+then
+ echo >&2 "USAGE: $0 <SOURCE_DIR> <OUTPUT>"
+ exit 1
+fi
print_config_list () {
cat <<EOF
static const char *config_name_list[] = {
EOF
- grep -h '^[a-zA-Z].*\..*::$' Documentation/*config.txt Documentation/config/*.txt |
+ grep -h '^[a-zA-Z].*\..*::$' "$SOURCE_DIR"/Documentation/*config.txt "$SOURCE_DIR"/Documentation/config/*.txt |
sed '/deprecated/d; s/::$//; s/, */\n/g' |
sort |
sed 's/^.*$/ "&",/'
@@ -17,5 +23,9 @@ EOF
EOF
}
-echo
-print_config_list
+{
+ echo "/* Automatically generated by generate-configlist.sh */"
+ echo
+ echo
+ print_config_list
+} >"$OUTPUT"
diff --git a/generate-hooklist.sh b/generate-hooklist.sh
index 2f9f54eb545be2bd79c37a868dbeef96d2ddfb9f..e22068c2fa4139983d685fd3bcd78e3e2a52beb0 100755
--- a/generate-hooklist.sh
+++ b/generate-hooklist.sh
@@ -2,6 +2,17 @@
#
# Usage: ./generate-hooklist.sh >hook-list.h
+SOURCE_DIR="$1"
+OUTPUT="$2"
+
+if test -z "$SOURCE_DIR" || ! test -d "$SOURCE_DIR" || test -z "$OUTPUT"
+then
+ echo >&2 "USAGE: $0 <SOURCE_DIR> <OUTPUT>"
+ exit 1
+fi
+
+{
+
cat <<EOF
/* Automatically generated by generate-hooklist.sh */
@@ -11,10 +22,12 @@ EOF
sed -n \
-e '/^~~~~*$/ {x; s/^.*$/ "&",/; p;}' \
-e 'x' \
- <Documentation/githooks.txt |
+ <"$SOURCE_DIR"/Documentation/githooks.txt |
LC_ALL=C sort
cat <<EOF
NULL,
};
EOF
+
+} >"$OUTPUT"
--
2.47.0.274.g962d0b743d.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v9 14/23] Makefile: allow "bin-wrappers/" directory to exist
2024-11-25 9:56 ` [PATCH v9 " Patrick Steinhardt
` (12 preceding siblings ...)
2024-11-25 9:57 ` [PATCH v9 13/23] Makefile: refactor generators to be PWD-independent Patrick Steinhardt
@ 2024-11-25 9:57 ` Patrick Steinhardt
2024-11-25 9:57 ` [PATCH v9 15/23] Makefile: simplify building of templates Patrick Steinhardt
` (8 subsequent siblings)
22 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-25 9:57 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
The "bin-wrappers/" directory gets created by our build system and is
populated with one script for each of our binaries. There isn't anything
inherently wrong with the current layout, but it is somewhat hard to
adapt for out-of-tree build systems.
Adapt the layout such that our "bin-wrappers/" directory always exists
and contains our "wrap-for-bin.sh" script to make things a little bit
easier for subsequent steps.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
.gitignore | 1 -
Documentation/CodingGuidelines | 2 +-
Makefile | 6 +++---
bin-wrappers/.gitignore | 9 +++++++++
wrap-for-bin.sh => bin-wrappers/wrap-for-bin.sh | 0
contrib/buildsystems/CMakeLists.txt | 6 +++---
6 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/.gitignore b/.gitignore
index d3be460040c6120d862a25dff1abd325b93b37fd..e82aa19df03fc865eaa0468f12b734cec0c48a2c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,7 +12,6 @@
/GIT-TEST-SUITES
/GIT-USER-AGENT
/GIT-VERSION-FILE
-/bin-wrappers/
/git
/git-add
/git-am
diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
index 87904791cbcea6e57d0fb3c7d4e27f2b0d80b95f..1df9d0c42f1ee7b16ecd7abc22d2653dbf9bae2e 100644
--- a/Documentation/CodingGuidelines
+++ b/Documentation/CodingGuidelines
@@ -583,7 +583,7 @@ For C programs:
Run `GIT_DEBUGGER=1 ./bin-wrappers/git foo` to simply use gdb as is, or
run `GIT_DEBUGGER="<debugger> <debugger-args>" ./bin-wrappers/git foo` to
use your own debugger and arguments. Example: `GIT_DEBUGGER="ddd --gdb"
- ./bin-wrappers/git log` (See `wrap-for-bin.sh`.)
+ ./bin-wrappers/git log` (See `bin-wrappers/wrap-for-bin.sh`.)
- The primary data structure that a subsystem 'S' deals with is called
`struct S`. Functions that operate on `struct S` are named
diff --git a/Makefile b/Makefile
index 61639d17dc364acf30ffd2d317015d8db440acc1..14ee6817cf9d9d03312a9cbd93b8ee218241d3d4 100644
--- a/Makefile
+++ b/Makefile
@@ -3206,8 +3206,7 @@ test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $(
all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PROG)
-bin-wrappers/%: wrap-for-bin.sh
- $(call mkdir_p_parent_template)
+$(test_bindir_programs): bin-wrappers/%: bin-wrappers/wrap-for-bin.sh
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@BUILD_DIR@|$(shell pwd)|' \
-e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
@@ -3704,7 +3703,8 @@ clean: profile-clean coverage-clean cocciclean
$(RM) $(SP_OBJ)
$(RM) $(HCC)
$(RM) version-def.h
- $(RM) -r bin-wrappers $(dep_dirs) $(compdb_dir) compile_commands.json
+ $(RM) -r $(dep_dirs) $(compdb_dir) compile_commands.json
+ $(RM) $(test_bindir_programs)
$(RM) -r po/build/
$(RM) *.pyc *.pyo */*.pyc */*.pyo $(GENERATED_H) $(ETAGS_TARGET) tags cscope*
$(RM) -r .dist-tmp-dir .doc-tmp-dir
diff --git a/bin-wrappers/.gitignore b/bin-wrappers/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..1c6c90458b758641d0311e812563b32dd4656b48
--- /dev/null
+++ b/bin-wrappers/.gitignore
@@ -0,0 +1,9 @@
+/git
+/git-cvsserver
+/git-receive-pack
+/git-shell
+/git-upload-archive
+/git-upload-pack
+/scalar
+/test-fake-ssh
+/test-tool
diff --git a/wrap-for-bin.sh b/bin-wrappers/wrap-for-bin.sh
old mode 100644
new mode 100755
similarity index 100%
rename from wrap-for-bin.sh
rename to bin-wrappers/wrap-for-bin.sh
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index de2c24e66b5b94e18368aba576fc11418e2aa049..259dc838b73dcda6ab98776fab61788d90754e03 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -1088,20 +1088,20 @@ set(wrapper_test_scripts
foreach(script ${wrapper_scripts})
- file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
+ file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
string(REPLACE "@PROG@" "${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
foreach(script ${wrapper_test_scripts})
- file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
+ file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
string(REPLACE "@PROG@" "t/helper/${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
-file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
+file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
string(REPLACE "@PROG@" "git-cvsserver" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})
--
2.47.0.274.g962d0b743d.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v9 15/23] Makefile: simplify building of templates
2024-11-25 9:56 ` [PATCH v9 " Patrick Steinhardt
` (13 preceding siblings ...)
2024-11-25 9:57 ` [PATCH v9 14/23] Makefile: allow "bin-wrappers/" directory to exist Patrick Steinhardt
@ 2024-11-25 9:57 ` Patrick Steinhardt
2024-11-25 9:57 ` [PATCH v9 16/23] Documentation: allow sourcing generated includes from separate dir Patrick Steinhardt
` (7 subsequent siblings)
22 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-25 9:57 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
When we install Git we also install a set of default templates that both
git-init(1) and git-clone(1) populate into our build directories. The
way the pristine templates are laid out in our source directory is
somewhat weird though: instead of reconstructing the actual directory
hierarchy in "templates/", we represent directory separators with "--".
The only reason I could come up with for why we have this is the
"branches/" directory, which is supposed to be empty when installing it.
And as Git famously doesn't store empty directories at all we have to
work around this limitation.
Now the thing is that the "branches/" directory is a leftover to how
branches used to be stored in the dark ages. gitrepository-layout(5)
lists this directory as "slightly deprecated", which I would claim is a
strong understatement. I have never encountered anybody using it today
and would be surprised if it even works as expected. So having the "--"
hack in place for an item that is basically unused, unmaintained and
deprecated doesn't only feel unreasonable, but installing that entry by
default may also cause confusion for users that do not know what this is
supposed to be in the first place.
Remove this directory from our templates and, now that we do not require
the workaround anymore, restructure the templates to form a proper
hierarchy. This makes it way easier for build systems to install these
templates into place.
We should likely think about removing support for "branch/" altogether,
but that is outside of the scope of this patch series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
contrib/buildsystems/CMakeLists.txt | 34 +++++++------------
templates/Makefile | 39 ++++++++++++++--------
templates/branches-- | 1 -
templates/{this--description => description} | 0
.../applypatch-msg.sample} | 0
.../commit-msg.sample} | 0
.../fsmonitor-watchman.sample} | 0
.../post-update.sample} | 0
.../pre-applypatch.sample} | 0
.../pre-commit.sample} | 0
.../pre-merge-commit.sample} | 0
.../pre-push.sample} | 0
.../pre-rebase.sample} | 0
.../pre-receive.sample} | 0
.../prepare-commit-msg.sample} | 0
.../push-to-checkout.sample} | 0
.../sendemail-validate.sample} | 0
.../{hooks--update.sample => hooks/update.sample} | 0
templates/{info--exclude => info/exclude} | 0
19 files changed, 37 insertions(+), 37 deletions(-)
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 259dc838b73dcda6ab98776fab61788d90754e03..21dc90ef9a83e5d751f251c9eefbdf43c989bf53 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -99,8 +99,8 @@ project(git
#TODO Enable NLS on windows natively
#macros for parsing the Makefile for sources and scripts
-macro(parse_makefile_for_sources list_var regex)
- file(STRINGS ${CMAKE_SOURCE_DIR}/Makefile ${list_var} REGEX "^${regex} \\+=(.*)")
+macro(parse_makefile_for_sources list_var makefile regex)
+ file(STRINGS ${makefile} ${list_var} REGEX "^${regex} \\+=(.*)")
string(REPLACE "${regex} +=" "" ${list_var} ${${list_var}})
string(REPLACE "$(COMPAT_OBJS)" "" ${list_var} ${${list_var}}) #remove "$(COMPAT_OBJS)" This is only for libgit.
string(STRIP ${${list_var}} ${list_var}) #remove trailing/leading whitespaces
@@ -662,7 +662,7 @@ include_directories(${CMAKE_BINARY_DIR})
#build
#libgit
-parse_makefile_for_sources(libgit_SOURCES "LIB_OBJS")
+parse_makefile_for_sources(libgit_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "LIB_OBJS")
list(TRANSFORM libgit_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
list(TRANSFORM compat_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
@@ -680,13 +680,13 @@ list(APPEND libgit_SOURCES "${CMAKE_BINARY_DIR}/version-def.h")
add_library(libgit ${libgit_SOURCES} ${compat_SOURCES})
#libxdiff
-parse_makefile_for_sources(libxdiff_SOURCES "XDIFF_OBJS")
+parse_makefile_for_sources(libxdiff_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "XDIFF_OBJS")
list(TRANSFORM libxdiff_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
add_library(xdiff STATIC ${libxdiff_SOURCES})
#reftable
-parse_makefile_for_sources(reftable_SOURCES "REFTABLE_OBJS")
+parse_makefile_for_sources(reftable_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "REFTABLE_OBJS")
list(TRANSFORM reftable_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
add_library(reftable STATIC ${reftable_SOURCES})
@@ -757,7 +757,7 @@ elseif(UNIX)
endif()
#git
-parse_makefile_for_sources(git_SOURCES "BUILTIN_OBJS")
+parse_makefile_for_sources(git_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "BUILTIN_OBJS")
list(TRANSFORM git_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
add_executable(git ${CMAKE_SOURCE_DIR}/git.c ${git_SOURCES})
@@ -905,24 +905,14 @@ file(STRINGS ${CMAKE_SOURCE_DIR}/git-p4.py content NEWLINE_CONSUME)
string(REPLACE "#!/usr/bin/env python" "#!/usr/bin/python" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/git-p4 ${content})
-#templates
-file(GLOB templates "${CMAKE_SOURCE_DIR}/templates/*")
-list(TRANSFORM templates REPLACE "${CMAKE_SOURCE_DIR}/templates/" "")
-list(REMOVE_ITEM templates ".gitignore")
-list(REMOVE_ITEM templates "Makefile")
-list(REMOVE_ITEM templates "blt")# Prevents an error when reconfiguring for in source builds
-
-list(REMOVE_ITEM templates "branches--")
-file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/templates/blt/branches) #create branches
-
+#${CMAKE_SOURCE_DIR}/Makefile templates
+parse_makefile_for_sources(templates ${CMAKE_SOURCE_DIR}/templates/Makefile "TEMPLATES")
+string(REPLACE " " ";" templates ${templates})
#templates have @.*@ replacement so use configure_file instead
foreach(tm ${templates})
- string(REPLACE "--" "/" blt_tm ${tm})
- string(REPLACE "this" "" blt_tm ${blt_tm})# for this--
- configure_file(${CMAKE_SOURCE_DIR}/templates/${tm} ${CMAKE_BINARY_DIR}/templates/blt/${blt_tm} @ONLY)
+ configure_file(${CMAKE_SOURCE_DIR}/templates/${tm} ${CMAKE_BINARY_DIR}/templates/blt/${tm} @ONLY)
endforeach()
-
#translations
if(MSGFMT_EXE)
file(GLOB po_files "${CMAKE_SOURCE_DIR}/po/*.po")
@@ -996,7 +986,7 @@ add_executable(test-fake-ssh ${CMAKE_SOURCE_DIR}/t/helper/test-fake-ssh.c)
target_link_libraries(test-fake-ssh common-main)
#unit-tests
-parse_makefile_for_sources(unit-test_SOURCES "UNIT_TEST_OBJS")
+parse_makefile_for_sources(unit-test_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "UNIT_TEST_OBJS")
list(TRANSFORM unit-test_SOURCES REPLACE "\\$\\(UNIT_TEST_DIR\\)/" "${CMAKE_SOURCE_DIR}/t/unit-tests/")
add_library(unit-test-lib STATIC ${unit-test_SOURCES})
@@ -1062,7 +1052,7 @@ if(MSVC)
endif()
#test-tool
-parse_makefile_for_sources(test-tool_SOURCES "TEST_BUILTINS_OBJS")
+parse_makefile_for_sources(test-tool_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "TEST_BUILTINS_OBJS")
add_library(test-lib OBJECT ${CMAKE_SOURCE_DIR}/t/unit-tests/test-lib.c)
list(TRANSFORM test-tool_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/t/helper/")
diff --git a/templates/Makefile b/templates/Makefile
index 367ad00c24cb34c0668eb5236dc3b08a477a65b7..bd1e9e30c120032b209fb1d221b9d93eea31c649 100644
--- a/templates/Makefile
+++ b/templates/Makefile
@@ -29,24 +29,35 @@ all: boilerplates.made custom
# in a file direc--tory--file in the source. They will be
# just copied to the destination.
-bpsrc = $(filter-out %~,$(wildcard *--*))
-boilerplates.made : $(bpsrc)
- $(QUIET)umask 022 && ls *--* 2>/dev/null | \
- while read boilerplate; \
+TEMPLATES =
+TEMPLATES += description
+TEMPLATES += hooks/applypatch-msg.sample
+TEMPLATES += hooks/commit-msg.sample
+TEMPLATES += hooks/fsmonitor-watchman.sample
+TEMPLATES += hooks/post-update.sample
+TEMPLATES += hooks/pre-applypatch.sample
+TEMPLATES += hooks/pre-commit.sample
+TEMPLATES += hooks/pre-merge-commit.sample
+TEMPLATES += hooks/prepare-commit-msg.sample
+TEMPLATES += hooks/pre-push.sample
+TEMPLATES += hooks/pre-rebase.sample
+TEMPLATES += hooks/pre-receive.sample
+TEMPLATES += hooks/push-to-checkout.sample
+TEMPLATES += hooks/sendemail-validate.sample
+TEMPLATES += hooks/update.sample
+TEMPLATES += info/exclude
+
+boilerplates.made: $(TEMPLATES)
+ $(QUIET)umask 022 && for template in $(TEMPLATES); \
do \
- case "$$boilerplate" in *~) continue ;; esac && \
- dst=`echo "$$boilerplate" | sed -e 's|^this|.|;s|--|/|g'` && \
- dir=`expr "$$dst" : '\(.*\)/'` && \
+ dir=$$(dirname "$$template") && \
mkdir -p blt/$$dir && \
- case "$$boilerplate" in \
- *--) continue;; \
- esac && \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
- -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' $$boilerplate > \
- blt/$$dst && \
- if test -x "$$boilerplate"; then rx=rx; else rx=r; fi && \
- chmod a+$$rx "blt/$$dst" || exit; \
+ -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' $$template > \
+ blt/$$template && \
+ if test -x "$$template"; then rx=rx; else rx=r; fi && \
+ chmod a+$$rx "blt/$$template" || exit; \
done && \
date >$@
diff --git a/templates/branches-- b/templates/branches--
deleted file mode 100644
index fae88709a636f3a06cc813dd64b28bfee7fa2073..0000000000000000000000000000000000000000
--- a/templates/branches--
+++ /dev/null
@@ -1 +0,0 @@
-: this is just to ensure the directory exists.
diff --git a/templates/this--description b/templates/description
similarity index 100%
rename from templates/this--description
rename to templates/description
diff --git a/templates/hooks--applypatch-msg.sample b/templates/hooks/applypatch-msg.sample
similarity index 100%
rename from templates/hooks--applypatch-msg.sample
rename to templates/hooks/applypatch-msg.sample
diff --git a/templates/hooks--commit-msg.sample b/templates/hooks/commit-msg.sample
similarity index 100%
rename from templates/hooks--commit-msg.sample
rename to templates/hooks/commit-msg.sample
diff --git a/templates/hooks--fsmonitor-watchman.sample b/templates/hooks/fsmonitor-watchman.sample
similarity index 100%
rename from templates/hooks--fsmonitor-watchman.sample
rename to templates/hooks/fsmonitor-watchman.sample
diff --git a/templates/hooks--post-update.sample b/templates/hooks/post-update.sample
similarity index 100%
rename from templates/hooks--post-update.sample
rename to templates/hooks/post-update.sample
diff --git a/templates/hooks--pre-applypatch.sample b/templates/hooks/pre-applypatch.sample
similarity index 100%
rename from templates/hooks--pre-applypatch.sample
rename to templates/hooks/pre-applypatch.sample
diff --git a/templates/hooks--pre-commit.sample b/templates/hooks/pre-commit.sample
similarity index 100%
rename from templates/hooks--pre-commit.sample
rename to templates/hooks/pre-commit.sample
diff --git a/templates/hooks--pre-merge-commit.sample b/templates/hooks/pre-merge-commit.sample
similarity index 100%
rename from templates/hooks--pre-merge-commit.sample
rename to templates/hooks/pre-merge-commit.sample
diff --git a/templates/hooks--pre-push.sample b/templates/hooks/pre-push.sample
similarity index 100%
rename from templates/hooks--pre-push.sample
rename to templates/hooks/pre-push.sample
diff --git a/templates/hooks--pre-rebase.sample b/templates/hooks/pre-rebase.sample
similarity index 100%
rename from templates/hooks--pre-rebase.sample
rename to templates/hooks/pre-rebase.sample
diff --git a/templates/hooks--pre-receive.sample b/templates/hooks/pre-receive.sample
similarity index 100%
rename from templates/hooks--pre-receive.sample
rename to templates/hooks/pre-receive.sample
diff --git a/templates/hooks--prepare-commit-msg.sample b/templates/hooks/prepare-commit-msg.sample
similarity index 100%
rename from templates/hooks--prepare-commit-msg.sample
rename to templates/hooks/prepare-commit-msg.sample
diff --git a/templates/hooks--push-to-checkout.sample b/templates/hooks/push-to-checkout.sample
similarity index 100%
rename from templates/hooks--push-to-checkout.sample
rename to templates/hooks/push-to-checkout.sample
diff --git a/templates/hooks--sendemail-validate.sample b/templates/hooks/sendemail-validate.sample
similarity index 100%
rename from templates/hooks--sendemail-validate.sample
rename to templates/hooks/sendemail-validate.sample
diff --git a/templates/hooks--update.sample b/templates/hooks/update.sample
similarity index 100%
rename from templates/hooks--update.sample
rename to templates/hooks/update.sample
diff --git a/templates/info--exclude b/templates/info/exclude
similarity index 100%
rename from templates/info--exclude
rename to templates/info/exclude
--
2.47.0.274.g962d0b743d.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v9 16/23] Documentation: allow sourcing generated includes from separate dir
2024-11-25 9:56 ` [PATCH v9 " Patrick Steinhardt
` (14 preceding siblings ...)
2024-11-25 9:57 ` [PATCH v9 15/23] Makefile: simplify building of templates Patrick Steinhardt
@ 2024-11-25 9:57 ` Patrick Steinhardt
2024-11-25 9:57 ` [PATCH v9 17/23] Documentation: teach "cmd-list.perl" about out-of-tree builds Patrick Steinhardt
` (6 subsequent siblings)
22 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-25 9:57 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
Our documentation uses "include::" directives to include parts that are
either reused across multiple documents or parts that we generate at
build time. Unfortunately, top-level includes are only ever resolved
relative to the base directory, which is typically the directory of the
including document. Most importantly, it is not possible to have either
asciidoc or asciidoctor search multiple directories.
It follows that both kinds of includes must live in the same directory.
This is of course a bummer for out-of-tree builds, because here the
dynamically-built includes live in the build directory whereas the
static includes live in the source directory.
Introduce a `build_dir` attribute and prepend it to all of our includes
for dynamically-built files. This attribute gets set to the build
directory and thus converts the include path to an absolute path, which
asciidoc and asciidoctor know how to resolve.
Note that this change also requires us to update "build-docdep.perl",
which tries to figure out included files such our Makefile can set up
proper build-time dependencies. This script simply scans through the
source files for any lines that match "^include::" and treats the
remainder of the line as included file path. But given that those may
now contain the "{build_dir}" variable we have to teach the script to
replace that attribute with the actual build directory.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Documentation/Makefile | 3 ++-
Documentation/build-docdep.perl | 2 ++
Documentation/config/diff.txt | 2 +-
Documentation/config/merge.txt | 2 +-
Documentation/git.txt | 24 ++++++++++++------------
5 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 495c61c85ed18bc9c4643f9e5478e5146bb5f196..c3d5ea1d46a57744bcacdc63b6c97911607e9fec 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -224,6 +224,7 @@ SHELL_PATH ?= $(SHELL)
# Shell quote;
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
+ASCIIDOC_EXTRA += -abuild_dir='$(shell pwd)'
ifdef DEFAULT_PAGER
DEFAULT_PAGER_SQ = $(subst ','\'',$(DEFAULT_PAGER))
ASCIIDOC_EXTRA += -a 'git-default-pager=$(DEFAULT_PAGER_SQ)'
@@ -289,7 +290,7 @@ docdep_prereqs = \
cmd-list.made $(cmds_txt)
doc.dep : $(docdep_prereqs) $(DOC_DEP_TXT) build-docdep.perl
- $(QUIET_GEN)$(PERL_PATH) ./build-docdep.perl >$@ $(QUIET_STDERR)
+ $(QUIET_GEN)$(PERL_PATH) ./build-docdep.perl "$(shell pwd)" >$@ $(QUIET_STDERR)
ifneq ($(MAKECMDGOALS),clean)
-include doc.dep
diff --git a/Documentation/build-docdep.perl b/Documentation/build-docdep.perl
index 1b3ac8fdd95fa1d57afbdffb1a9743f36ed22fdd..315efaa2fa2f2efc89b2c8073cc97cd2cc83611c 100755
--- a/Documentation/build-docdep.perl
+++ b/Documentation/build-docdep.perl
@@ -1,5 +1,6 @@
#!/usr/bin/perl
+my ($build_dir) = @ARGV;
my %include = ();
my %included = ();
@@ -10,6 +11,7 @@
chomp;
s/^include::\s*//;
s/\[\]//;
+ s/{build_dir}/${build_dir}/;
$include{$text}{$_} = 1;
$included{$_} = 1;
}
diff --git a/Documentation/config/diff.txt b/Documentation/config/diff.txt
index 190bda17e51c57a00b25bf98afa038b8a89e4ea5..9575af91fa53d3f67925d31e77b81222e737fc3a 100644
--- a/Documentation/config/diff.txt
+++ b/Documentation/config/diff.txt
@@ -206,7 +206,7 @@ diff.<driver>.cachetextconv::
Set this option to true to make the diff driver cache the text
conversion outputs. See linkgit:gitattributes[5] for details.
-include::../mergetools-diff.txt[]
+include::{build_dir}/mergetools-diff.txt[]
diff.indentHeuristic::
Set this option to `false` to disable the default heuristics
diff --git a/Documentation/config/merge.txt b/Documentation/config/merge.txt
index 8851b6cedef980c106b9e86541862b517aa1f2ad..82554d65a0aa0826fdb53c5d834389d38f308e3e 100644
--- a/Documentation/config/merge.txt
+++ b/Documentation/config/merge.txt
@@ -101,7 +101,7 @@ merge.guitool::
Any other value is treated as a custom merge tool and requires that a
corresponding mergetool.<guitool>.cmd variable is defined.
-include::../mergetools-merge.txt[]
+include::{build_dir}/mergetools-merge.txt[]
merge.verbosity::
Controls the amount of output shown by the recursive merge
diff --git a/Documentation/git.txt b/Documentation/git.txt
index d15a8697625d6b6c598a2bc774bf243675ab68ea..44f0797ccffb1a7359bee9c20182953293b70d6d 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -245,17 +245,17 @@ ancillary user utilities.
Main porcelain commands
~~~~~~~~~~~~~~~~~~~~~~~
-include::cmds-mainporcelain.txt[]
+include::{build_dir}/cmds-mainporcelain.txt[]
Ancillary Commands
~~~~~~~~~~~~~~~~~~
Manipulators:
-include::cmds-ancillarymanipulators.txt[]
+include::{build_dir}/cmds-ancillarymanipulators.txt[]
Interrogators:
-include::cmds-ancillaryinterrogators.txt[]
+include::{build_dir}/cmds-ancillaryinterrogators.txt[]
Interacting with Others
@@ -264,7 +264,7 @@ Interacting with Others
These commands are to interact with foreign SCM and with other
people via patch over e-mail.
-include::cmds-foreignscminterface.txt[]
+include::{build_dir}/cmds-foreignscminterface.txt[]
Reset, restore and revert
~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -313,13 +313,13 @@ repositories.
Manipulation commands
~~~~~~~~~~~~~~~~~~~~~
-include::cmds-plumbingmanipulators.txt[]
+include::{build_dir}/cmds-plumbingmanipulators.txt[]
Interrogation commands
~~~~~~~~~~~~~~~~~~~~~~
-include::cmds-plumbinginterrogators.txt[]
+include::{build_dir}/cmds-plumbinginterrogators.txt[]
In general, the interrogate commands do not touch the files in
the working tree.
@@ -328,12 +328,12 @@ the working tree.
Syncing repositories
~~~~~~~~~~~~~~~~~~~~
-include::cmds-synchingrepositories.txt[]
+include::{build_dir}/cmds-synchingrepositories.txt[]
The following are helper commands used by the above; end users
typically do not use them directly.
-include::cmds-synchelpers.txt[]
+include::{build_dir}/cmds-synchelpers.txt[]
Internal helper commands
@@ -342,14 +342,14 @@ Internal helper commands
These are internal helper commands used by other commands; end
users typically do not use them directly.
-include::cmds-purehelpers.txt[]
+include::{build_dir}/cmds-purehelpers.txt[]
Guides
------
The following documentation pages are guides about Git concepts.
-include::cmds-guide.txt[]
+include::{build_dir}/cmds-guide.txt[]
Repository, command and file interfaces
---------------------------------------
@@ -358,7 +358,7 @@ This documentation discusses repository and command interfaces which
users are expected to interact with directly. See `--user-formats` in
linkgit:git-help[1] for more details on the criteria.
-include::cmds-userinterfaces.txt[]
+include::{build_dir}/cmds-userinterfaces.txt[]
File formats, protocols and other developer interfaces
------------------------------------------------------
@@ -367,7 +367,7 @@ This documentation discusses file formats, over-the-wire protocols and
other git developer interfaces. See `--developer-interfaces` in
linkgit:git-help[1].
-include::cmds-developerinterfaces.txt[]
+include::{build_dir}/cmds-developerinterfaces.txt[]
Configuration Mechanism
-----------------------
--
2.47.0.274.g962d0b743d.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v9 17/23] Documentation: teach "cmd-list.perl" about out-of-tree builds
2024-11-25 9:56 ` [PATCH v9 " Patrick Steinhardt
` (15 preceding siblings ...)
2024-11-25 9:57 ` [PATCH v9 16/23] Documentation: allow sourcing generated includes from separate dir Patrick Steinhardt
@ 2024-11-25 9:57 ` Patrick Steinhardt
2024-11-25 9:57 ` [PATCH v9 18/23] Documentation: extract script to generate a list of mergetools Patrick Steinhardt
` (5 subsequent siblings)
22 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-25 9:57 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
The "cmd-list.perl" script generates a list of commands that can be
included into our manpages. The script doesn't know about out-of-tree
builds and instead writes resulting files into the source directory.
Adapt it such that we can read data from the source directory and write
data into the build directory.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Documentation/Makefile | 2 +-
Documentation/cmd-list.perl | 23 ++++++++++++-----------
2 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/Documentation/Makefile b/Documentation/Makefile
index c3d5ea1d46a57744bcacdc63b6c97911607e9fec..6c3f9b5ed13ab0b0ceae05128ec4086a7f61ca34 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -312,7 +312,7 @@ cmds_txt = cmds-ancillaryinterrogators.txt \
$(cmds_txt): cmd-list.made
cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
- $(QUIET_GEN)$(PERL_PATH) ./cmd-list.perl ../command-list.txt $(cmds_txt) $(QUIET_STDERR) && \
+ $(QUIET_GEN)$(PERL_PATH) ./cmd-list.perl .. . $(cmds_txt) && \
date >$@
mergetools_txt = mergetools-diff.txt mergetools-merge.txt
diff --git a/Documentation/cmd-list.perl b/Documentation/cmd-list.perl
index 755a110bc48d7e2b596651ca13664c01192d966c..e260a989774071b66d2b56c56c5045b84a508c5c 100755
--- a/Documentation/cmd-list.perl
+++ b/Documentation/cmd-list.perl
@@ -3,12 +3,13 @@
use File::Compare qw(compare);
sub format_one {
- my ($out, $nameattr) = @_;
+ my ($source_dir, $out, $nameattr) = @_;
my ($name, $attr) = @$nameattr;
+ my ($path) = "$source_dir/Documentation/$name.txt";
my ($state, $description);
my $mansection;
$state = 0;
- open I, '<', "$name.txt" or die "No such file $name.txt";
+ open I, '<', "$path" or die "No such file $path.txt";
while (<I>) {
if (/^(?:git|scalar)[a-z0-9-]*\(([0-9])\)$/) {
$mansection = $1;
@@ -29,7 +30,7 @@ sub format_one {
}
close I;
if (!defined $description) {
- die "No description found in $name.txt";
+ die "No description found in $path.txt";
}
if (my ($verify_name, $text) = ($description =~ /^($name) - (.*)/)) {
print $out "linkgit:$name\[$mansection\]::\n\t";
@@ -43,9 +44,9 @@ sub format_one {
}
}
-my ($input, @categories) = @ARGV;
+my ($source_dir, $build_dir, @categories) = @ARGV;
-open IN, "<$input";
+open IN, "<$source_dir/command-list.txt";
while (<IN>) {
last if /^### command list/;
}
@@ -63,17 +64,17 @@ sub format_one {
for my $out (@categories) {
my ($cat) = $out =~ /^cmds-(.*)\.txt$/;
- open O, '>', "$out+" or die "Cannot open output file $out+";
+ my ($path) = "$build_dir/$out";
+ open O, '>', "$path+" or die "Cannot open output file $out+";
for (@{$cmds{$cat}}) {
- format_one(\*O, $_);
+ format_one($source_dir, \*O, $_);
}
close O;
- if (-f "$out" && compare("$out", "$out+") == 0) {
- unlink "$out+";
+ if (-f "$path" && compare("$path", "$path+") == 0) {
+ unlink "$path+";
}
else {
- print STDERR "$out\n";
- rename "$out+", "$out";
+ rename "$path+", "$path";
}
}
--
2.47.0.274.g962d0b743d.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v9 18/23] Documentation: extract script to generate a list of mergetools
2024-11-25 9:56 ` [PATCH v9 " Patrick Steinhardt
` (16 preceding siblings ...)
2024-11-25 9:57 ` [PATCH v9 17/23] Documentation: teach "cmd-list.perl" about out-of-tree builds Patrick Steinhardt
@ 2024-11-25 9:57 ` Patrick Steinhardt
2024-11-25 9:57 ` [PATCH v9 19/23] t: better support for out-of-tree builds Patrick Steinhardt
` (4 subsequent siblings)
22 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-25 9:57 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
We include the list of available mergetools into our manpages. Extract
the script that performs this logic such that we can reuse it in other
build systems.
While at it, refactor the Makefile targets such that we don't create
"mergetools-list.made" anymore. It shouldn't be necessary, as we can
instead have other targets depend on "mergetools-{diff,merge}.txt"
directly.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Documentation/Makefile | 22 ++++++++--------------
Documentation/generate-mergetool-list.sh | 17 +++++++++++++++++
2 files changed, 25 insertions(+), 14 deletions(-)
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 6c3f9b5ed13ab0b0ceae05128ec4086a7f61ca34..d19ee3c399f337ea9ac7c9a1b595ac760ebed095 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -282,11 +282,13 @@ ifneq ($(filter-out lint-docs clean,$(MAKECMDGOALS)),)
-include ../GIT-VERSION-FILE
endif
+mergetools_txt = mergetools-diff.txt mergetools-merge.txt
+
#
# Determine "include::" file references in asciidoc files.
#
docdep_prereqs = \
- mergetools-list.made $(mergetools_txt) \
+ $(mergetools_txt) \
cmd-list.made $(cmds_txt)
doc.dep : $(docdep_prereqs) $(DOC_DEP_TXT) build-docdep.perl
@@ -315,19 +317,11 @@ cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
$(QUIET_GEN)$(PERL_PATH) ./cmd-list.perl .. . $(cmds_txt) && \
date >$@
-mergetools_txt = mergetools-diff.txt mergetools-merge.txt
-
-$(mergetools_txt): mergetools-list.made
-
-mergetools-list.made: ../git-mergetool--lib.sh $(wildcard ../mergetools/*)
- $(QUIET_GEN) \
- $(SHELL_PATH) -c 'MERGE_TOOLS_DIR=../mergetools && TOOL_MODE=diff && \
- . ../git-mergetool--lib.sh && \
- show_tool_names can_diff' | sed -e "s/\([a-z0-9]*\)/\`\1\`;;/" >mergetools-diff.txt && \
- $(SHELL_PATH) -c 'MERGE_TOOLS_DIR=../mergetools && TOOL_MODE=merge && \
- . ../git-mergetool--lib.sh && \
- show_tool_names can_merge' | sed -e "s/\([a-z0-9]*\)/\`\1\`;;/" >mergetools-merge.txt && \
- date >$@
+mergetools-%.txt: generate-mergetool-list.sh ../git-mergetool--lib.sh $(wildcard ../mergetools/*)
+mergetools-diff.txt:
+ $(QUIET_GEN)$(SHELL_PATH) ./generate-mergetool-list.sh .. diff $@
+mergetools-merge.txt:
+ $(QUIET_GEN)$(SHELL_PATH) ./generate-mergetool-list.sh .. merge $@
TRACK_ASCIIDOCFLAGS = $(subst ','\'',$(ASCIIDOC_COMMON):$(ASCIIDOC_HTML):$(ASCIIDOC_DOCBOOK))
diff --git a/Documentation/generate-mergetool-list.sh b/Documentation/generate-mergetool-list.sh
new file mode 100755
index 0000000000000000000000000000000000000000..6700498b93be5358d992530b8dee39c08f02bd8d
--- /dev/null
+++ b/Documentation/generate-mergetool-list.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+if test "$#" -ne 3
+then
+ echo >&2 "USAGE: $0 <SOURCE_DIR> <MODE> <OUTPUT>"
+ exit 1
+fi
+
+SOURCE_DIR="$1"
+TOOL_MODE="$2"
+OUTPUT="$3"
+MERGE_TOOLS_DIR="$SOURCE_DIR/mergetools"
+
+(
+ . "$SOURCE_DIR"/git-mergetool--lib.sh &&
+ show_tool_names can_$TOOL_MODE
+) | sed -e "s/\([a-z0-9]*\)/\`\1\`;;/" >"$OUTPUT"
--
2.47.0.274.g962d0b743d.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v9 19/23] t: better support for out-of-tree builds
2024-11-25 9:56 ` [PATCH v9 " Patrick Steinhardt
` (17 preceding siblings ...)
2024-11-25 9:57 ` [PATCH v9 18/23] Documentation: extract script to generate a list of mergetools Patrick Steinhardt
@ 2024-11-25 9:57 ` Patrick Steinhardt
2024-11-25 9:57 ` [PATCH v9 20/23] t: allow overriding build dir Patrick Steinhardt
` (3 subsequent siblings)
22 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-25 9:57 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
Our in-tree builds used by the Makefile use various different build
directories scattered around different locations. The paths to those
build directories have to be propagated to our tests such that they can
find the contained files. This is done via a mixture of hardcoded paths
in our test library and injected variables in our bin-wrappers or
"GIT-BUILD-OPTIONS".
The latter two mechanisms are preferable over using hardcoded paths. For
one, we have all paths which are subject to change stored in a small set
of central files instead of having the knowledge of build paths in many
files. And second, it allows build systems which build files elsewhere
to adapt those paths based on their own needs. This is especially nice
in the context of build systems that use out-of-tree builds like CMake
or Meson.
Remove hardcoded knowledge of build paths from our test library and move
it into our bin-wrappers and "GIT-BUILD-OPTIONS".
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-BUILD-OPTIONS.in | 5 +++++
Makefile | 9 +++++++++
bin-wrappers/wrap-for-bin.sh | 11 ++++++-----
contrib/buildsystems/CMakeLists.txt | 8 ++++++++
t/lib-gettext.sh | 4 ++--
t/t7609-mergetool--lib.sh | 2 +-
t/test-lib.sh | 6 +++---
7 files changed, 34 insertions(+), 11 deletions(-)
diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in
index 9b95a6b3eee334b6f691702696ca9d92201b6bac..f651116102ae2977622dccd12b199fe7ad65af99 100644
--- a/GIT-BUILD-OPTIONS.in
+++ b/GIT-BUILD-OPTIONS.in
@@ -35,6 +35,11 @@ GIT_PERF_MAKE_COMMAND=@GIT_PERF_MAKE_COMMAND@
GIT_INTEROP_MAKE_OPTS=@GIT_INTEROP_MAKE_OPTS@
GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@
GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@
+GIT_TEST_TEXTDOMAINDIR=@GIT_TEST_TEXTDOMAINDIR@
+GIT_TEST_POPATH=@GIT_TEST_POPATH@
+GIT_TEST_TEMPLATE_DIR=@GIT_TEST_TEMPLATE_DIR@
+GIT_TEST_GITPERLLIB=@GIT_TEST_GITPERLLIB@
+GIT_TEST_MERGE_TOOLS_DIR=@GIT_TEST_MERGE_TOOLS_DIR@
RUNTIME_PREFIX=@RUNTIME_PREFIX@
GITWEBDIR=@GITWEBDIR@
USE_GETTEXT_SCHEME=@USE_GETTEXT_SCHEME@
diff --git a/Makefile b/Makefile
index 14ee6817cf9d9d03312a9cbd93b8ee218241d3d4..2ef2f4928cab04253d1b3094be6ac83f9de9002b 100644
--- a/Makefile
+++ b/Makefile
@@ -3180,6 +3180,11 @@ GIT-BUILD-OPTIONS: FORCE
-e "s|@GIT_INTEROP_MAKE_OPTS@|\'$(GIT_INTEROP_MAKE_OPTS)\'|" \
-e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \
-e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \
+ -e "s|@GIT_TEST_TEXTDOMAINDIR@|\'$(shell pwd)/po/build/locale\'|" \
+ -e "s|@GIT_TEST_POPATH@|\'$(shell pwd)/po\'|" \
+ -e "s|@GIT_TEST_TEMPLATE_DIR@|\'$(shell pwd)/templates/blt\'|" \
+ -e "s|@GIT_TEST_GITPERLLIB@|\'$(shell pwd)/perl/build/lib\'|" \
+ -e "s|@GIT_TEST_MERGE_TOOLS_DIR@|\'$(shell pwd)/mergetools\'|" \
-e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX_OPTION)\'|" \
-e "s|@GITWEBDIR@|\'$(gitwebdir_SQ)\'|" \
-e "s|@USE_GETTEXT_SCHEME@|\'$(USE_GETTEXT_SCHEME)\'|" \
@@ -3209,6 +3214,10 @@ all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PR
$(test_bindir_programs): bin-wrappers/%: bin-wrappers/wrap-for-bin.sh
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@BUILD_DIR@|$(shell pwd)|' \
+ -e 's|@GIT_TEXTDOMAINDIR@|$(shell pwd)/po/build/locale|' \
+ -e 's|@GITPERLLIB@|$(shell pwd)/perl/build/lib|' \
+ -e 's|@MERGE_TOOLS_DIR@|$(shell pwd)/mergetools|' \
+ -e 's|@TEMPLATE_DIR@|$(shell pwd)/templates/blt|' \
-e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
chmod +x $@
diff --git a/bin-wrappers/wrap-for-bin.sh b/bin-wrappers/wrap-for-bin.sh
index 7898a1c238dde20617cf96d144930dc59f67feab..1d3a59a0081e1fc6066af187093cb1d11d01a929 100755
--- a/bin-wrappers/wrap-for-bin.sh
+++ b/bin-wrappers/wrap-for-bin.sh
@@ -4,21 +4,22 @@
# to run test suite against sandbox, but with only bindir-installed
# executables in PATH. The Makefile copies this into various
# files in bin-wrappers, substituting
-# @BUILD_DIR@ and @PROG@.
+# @BUILD_DIR@, @TEMPLATE_DIR@ and @PROG@.
GIT_EXEC_PATH='@BUILD_DIR@'
if test -n "$NO_SET_GIT_TEMPLATE_DIR"
then
unset GIT_TEMPLATE_DIR
else
- GIT_TEMPLATE_DIR='@BUILD_DIR@/templates/blt'
+ GIT_TEMPLATE_DIR='@TEMPLATE_DIR@'
export GIT_TEMPLATE_DIR
fi
-GITPERLLIB='@BUILD_DIR@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}"
-GIT_TEXTDOMAINDIR='@BUILD_DIR@/po/build/locale'
+MERGE_TOOLS_DIR='@MERGE_TOOLS_DIR@'
+GITPERLLIB='@GITPERLLIB@'"${GITPERLLIB:+:$GITPERLLIB}"
+GIT_TEXTDOMAINDIR='@GIT_TEXTDOMAINDIR@'
PATH='@BUILD_DIR@/bin-wrappers:'"$PATH"
-export GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
+export MERGE_TOOLS_DIR GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
case "$GIT_DEBUGGER" in
'')
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 21dc90ef9a83e5d751f251c9eefbdf43c989bf53..2ccc0aa7a7bd35c40a800bed397f7f70093c83de 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -1093,6 +1093,9 @@ endforeach()
file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+string(REPLACE "@GIT_TEXTDOMAINDIR@" "${CMAKE_BINARY_DIR}/po/build/locale" content "${content}")
+string(REPLACE "@GITPERLLIB@" "${CMAKE_BINARY_DIR}/perl/build/lib" content "${content}")
+string(REPLACE "@MERGE_TOOLS_DIR@" "${CMAKE_SOURCE_DIR}/mergetools" content "${content}")
string(REPLACE "@PROG@" "git-cvsserver" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})
@@ -1178,6 +1181,11 @@ string(REPLACE "@GIT_PERF_MAKE_COMMAND@" "" git_build_options "${git_build_optio
string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_options}")
string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}")
string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_TEXTDOMAINDIR@" "'${CMAKE_BINARY_DIR}/po/build/locale'" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_POPATH@" "'${CMAKE_BINARY_DIR}/po'" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_TEMPLATE_DIR@" "'${CMAKE_BINARY_DIR}/templates/blt'" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_GITPERLLIB@" "'${CMAKE_BINARY_DIR}/perl/build/lib'" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_MERGE_TOOLS_DIR@" "'${RUNTIME_PREFIX}'" git_build_options "${git_build_options}")
string(REPLACE "@RUNTIME_PREFIX@" "'${RUNTIME_PREFIX}'" git_build_options "${git_build_options}")
string(REPLACE "@GITWEBDIR@" "'${GITWEBDIR}'" git_build_options "${git_build_options}")
string(REPLACE "@USE_GETTEXT_SCHEME@" "" git_build_options "${git_build_options}")
diff --git a/t/lib-gettext.sh b/t/lib-gettext.sh
index cc6bb2cdeaae7b5bb23211c0d9c37c9deb39e14f..7a734c6973e65995d3403a26cc9e5c1a5a1ce074 100644
--- a/t/lib-gettext.sh
+++ b/t/lib-gettext.sh
@@ -6,8 +6,8 @@
. ./test-lib.sh
-GIT_TEXTDOMAINDIR="$GIT_BUILD_DIR/po/build/locale"
-GIT_PO_PATH="$GIT_BUILD_DIR/po"
+GIT_TEXTDOMAINDIR="$GIT_TEST_TEXTDOMAINDIR"
+GIT_PO_PATH="$GIT_TEST_POPATH"
export GIT_TEXTDOMAINDIR GIT_PO_PATH
if test -n "$GIT_TEST_INSTALLED"
diff --git a/t/t7609-mergetool--lib.sh b/t/t7609-mergetool--lib.sh
index 8b1c3bd39f2249417099ea2f24218268925909af..a9273ba58d76333c74d0072794ed0d95b966f16f 100755
--- a/t/t7609-mergetool--lib.sh
+++ b/t/t7609-mergetool--lib.sh
@@ -8,7 +8,7 @@ TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'mergetool --tool=vimdiff creates the expected layout' '
- . "$GIT_BUILD_DIR"/mergetools/vimdiff &&
+ . "$GIT_TEST_MERGE_TOOLS_DIR"/vimdiff &&
run_unit_tests
'
diff --git a/t/test-lib.sh b/t/test-lib.sh
index cca6a09c68cb9d08c37b0ded3150118767153b9f..13ae044808f28067a67cd2e02674b4add14ad9f4 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1440,7 +1440,7 @@ else # normal case, use ../bin-wrappers only unless $with_dashes:
PATH="$GIT_BUILD_DIR:$GIT_BUILD_DIR/t/helper:$PATH"
fi
fi
-GIT_TEMPLATE_DIR="$GIT_BUILD_DIR"/templates/blt
+GIT_TEMPLATE_DIR="$GIT_TEST_TEMPLATE_DIR"
GIT_CONFIG_NOSYSTEM=1
GIT_ATTR_NOSYSTEM=1
GIT_CEILING_DIRECTORIES="$TRASH_DIRECTORY/.."
@@ -1506,9 +1506,9 @@ then
fi
fi
-GITPERLLIB="$GIT_BUILD_DIR"/perl/build/lib
+GITPERLLIB="$GIT_TEST_GITPERLLIB"
export GITPERLLIB
-test -d "$GIT_BUILD_DIR"/templates/blt || {
+test -d "$GIT_TEMPLATE_DIR" || {
BAIL_OUT "You haven't built things yet, have you?"
}
--
2.47.0.274.g962d0b743d.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v9 20/23] t: allow overriding build dir
2024-11-25 9:56 ` [PATCH v9 " Patrick Steinhardt
` (18 preceding siblings ...)
2024-11-25 9:57 ` [PATCH v9 19/23] t: better support for out-of-tree builds Patrick Steinhardt
@ 2024-11-25 9:57 ` Patrick Steinhardt
2024-11-25 9:57 ` [PATCH v9 21/23] Documentation: add comparison of build systems Patrick Steinhardt
` (2 subsequent siblings)
22 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-25 9:57 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
Our "test-lib.sh" assumes that our build directory is the parent
directory of "t/". While true when using our Makefile, it's not when
using build systems that support out-of-tree builds.
In commit ee9e66e4e7 (cmake: avoid editing t/test-lib.sh, 2022-10-18),
we have introduce support for overriding the GIT_BUILD_DIR by creating
the file "$GIT_BUILD_DIR/GIT-BUILD-DIR" with its contents pointing to
the location of the build directory. The intent was to stop modifying
"t/test-lib.sh" with the CMake build systems while allowing out-of-tree
builds. But "$GIT_BUILD_DIR" is somewhat misleadingly named, as it in
fact points to the _source_ directory. So while that commit solved part
of the problem for out-of-tree builds, CMake still has to write files
into the source tree.
Solve the second part of the problem, namely not having to write any
data into the source directory at all, by also supporting an environment
variable that allows us to point to a different build directory. This
allows us to perform properly self-contained out-of-tree builds.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
t/test-lib.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 13ae044808f28067a67cd2e02674b4add14ad9f4..570be8de059283084ddb3acff1d9efe1278ee730 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -35,7 +35,7 @@ else
# needing to exist.
TEST_DIRECTORY=$(cd "$TEST_DIRECTORY" && pwd) || exit 1
fi
-GIT_BUILD_DIR="${TEST_DIRECTORY%/t}"
+GIT_BUILD_DIR="${GIT_BUILD_DIR:-${TEST_DIRECTORY%/t}}"
if test "$TEST_DIRECTORY" = "$GIT_BUILD_DIR"
then
echo "PANIC: Running in a $TEST_DIRECTORY that doesn't end in '/t'?" >&2
@@ -522,6 +522,7 @@ unset VISUAL EMAIL LANGUAGE $("$PERL_PATH" -e '
PERF_
CURL_VERBOSE
TRACE_CURL
+ BUILD_DIR
));
my @vars = grep(/^GIT_/ && !/^GIT_($ok)/o, @env);
print join("\n", @vars);
--
2.47.0.274.g962d0b743d.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v9 21/23] Documentation: add comparison of build systems
2024-11-25 9:56 ` [PATCH v9 " Patrick Steinhardt
` (19 preceding siblings ...)
2024-11-25 9:57 ` [PATCH v9 20/23] t: allow overriding build dir Patrick Steinhardt
@ 2024-11-25 9:57 ` Patrick Steinhardt
2024-11-25 9:57 ` [PATCH v9 22/23] Introduce support for the Meson build system Patrick Steinhardt
2024-11-25 9:57 ` [PATCH v9 23/23] meson: fix conflicts with in-flight topics Patrick Steinhardt
22 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-25 9:57 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
We're contemplating whether to eventually replace our build systems with
a build system that is easier to use. Add a comparison of build systems
to our technical documentation as a baseline for discussion.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Documentation/Makefile | 1 +
Documentation/technical/build-systems.txt | 224 ++++++++++++++++++++++++++++++
2 files changed, 225 insertions(+)
diff --git a/Documentation/Makefile b/Documentation/Makefile
index d19ee3c399f337ea9ac7c9a1b595ac760ebed095..d18603ed50c654f1c7f2ef44140a00840557747e 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -113,6 +113,7 @@ TECH_DOCS += MyFirstObjectWalk
TECH_DOCS += SubmittingPatches
TECH_DOCS += ToolsForGit
TECH_DOCS += technical/bitmap-format
+TECH_DOCS += technical/build-systems
TECH_DOCS += technical/bundle-uri
TECH_DOCS += technical/hash-function-transition
TECH_DOCS += technical/long-running-process-protocol
diff --git a/Documentation/technical/build-systems.txt b/Documentation/technical/build-systems.txt
new file mode 100644
index 0000000000000000000000000000000000000000..d9dafb407c40902756ca0bde9d9dad8ced8788dd
--- /dev/null
+++ b/Documentation/technical/build-systems.txt
@@ -0,0 +1,224 @@
+= Build Systems
+
+The build system is the primary way for both developers and system integrators
+to interact with the Git project. As such, being easy to use and extend for
+those who are not directly developing Git itself is just as important as other
+requirements we have on any potential build system.
+
+This document outlines the different requirements that we have for the build
+system and then compares available build systems using these criteria.
+
+== Requirements
+
+The following subsections present a list of requirements that we have for any
+potential build system. Sections are sorted by decreasing priority.
+
+=== Platform support
+
+The build system must have support for all of our platforms that we continually
+test against as outlined by our platform support policy. These platforms are:
+
+ - Linux
+ - Windows
+ - macOS
+
+Furthermore, the build system should have support for the following platforms
+that generally have somebody running test pipelines against regularly:
+
+ - AIX
+ - FreeBSD
+ - NetBSD
+ - NonStop
+ - OpenBSD
+
+The platforms which must be supported by the tool should be aligned with our
+[platform support policy](platform-support.txt).
+
+=== Auto-detection of supported features
+
+The build system must support auto-detection of features which are or aren't
+available on the current platform. Platform maintainers should not be required
+to manually configure the complete build.
+
+Auto-detection of the following items is considered to be important:
+
+ - Check for the existence of headers.
+ - Check for the existence of libraries.
+ - Check for the existence of exectuables.
+ - Check for the runtime behavior of specific functions.
+ - Check for specific link order requirements when multiple libraries are
+ involved.
+
+=== Ease of use
+
+The build system should be both easy to use and easy to extend. While this is
+naturally a subjective metric it is likely not controversial to say that some
+build systems are considerably harder to use than others.
+
+=== IDE support
+
+The build system should integrate with well-known IDEs. Well-known IDEs include:
+
+ - Microsoft Visual Studio
+ - Visual Studio Code
+ - Xcode
+
+There are four levels of support:
+
+ - Native integration into the IDE.
+ - Integration into the IDE via a plugin.
+ - Integration into the IDE via generating a project description with the build
+ system.
+ - No integration.
+
+Native integration is preferable, but integration via either a plugin or by
+generating a project description via the build system are considered feasible
+alternatives.
+
+Another important distinction is the level of integration. There are two
+features that one generally wants to have:
+
+ - Integration of build targets.
+ - Automatic setup of features like code completion with detected build
+ dependencies.
+
+The first bullet point is the bare minimum, but is not sufficient to be
+considered proper integration.
+
+=== Out-of-tree builds
+
+The build system should support out-of-tree builds. Out-of-tree builds allow a
+developer to configure multiple different build directories with different
+configuration, e.g. one "debug" build and one "release" build.
+
+=== Cross-platform builds
+
+The build system should support cross-platform builds, e.g. building for arm on
+an x86-64 host.
+
+=== Language support
+
+The following languages and toolchains are of relevance and should be supported
+by the build system:
+
+ - C: the primary compiled language used by Git, must be supported. Relevant
+ toolchains are GCC, Clang and MSVC.
+ - Rust: candidate as a second compiled lanugage, should be supported. Relevant
+ toolchains is the LLVM-based rustc.
+
+Built-in support for the respective languages is preferred over support that
+needs to be wired up manually to avoid unnecessary complexity. Native support
+includes the following features:
+
+ - Compiling objects.
+ - Dependency tracking.
+ - Detection of available features.
+ - Discovery of relevant toolchains.
+ - Linking libraries and executables.
+ - Templating placeholders in scripts.
+
+=== Test integration
+
+It should be possible to integrate tests into the build system such that it is
+possible to build and test Git within the build system. Features which are nice
+to have:
+
+ - Track build-time dependencies for respective tests. Unit tests have
+ different requirements than integration tests.
+ - Allow filtering of which tests to run.
+ - Allow running tests such that utilities like `test_pause` or `debug` work.
+
+== Comparison
+
+The following list of build systems are considered:
+
+- GNU Make
+- autoconf
+- CMake
+- Meson
+
+=== GNU Make
+
+- Platform support: ubitquitous on all platforms, but not well-integrated into Windows.
+- Auto-detection: no built-in support for auto-detection of features.
+- Ease of use: easy to use, but discovering available options is hard. Makefile
+ rules can quickly get out of hand once reaching a certain scope.
+- IDE support: execution of Makefile targets is supported by many IDEs
+- Out-of-tree builds: supported in theory, not wired up in practice.
+- Cross-platform builds: supported in theory, not wired up in practice.
+- Language support:
+ - C: Limited built-in support, many parts need to be wired up manually.
+ - Rust: No built-in support, needs to be wired up manually.
+- Test integration: partially supported, many parts need to be wired up
+ manually.
+
+=== autoconf
+
+- Platform support: ubiquitous on all platforms, but not well-integrated into Windows.
+- Auto-detection: supported.
+- Ease of use: easy to use, discovering available options is comparatively
+ easy. The autoconf syntax is prohibitively hard to extend though due to its
+ complex set of interacting files and the hard-to-understand M4 language.
+- IDE support: no integration into IDEs at generation time. The generated
+ Makefiles have the same level of support as GNU Make.
+- Out-of-tree builds: supported in theory, not wired up in practice.
+- Cross-platform builds: supported.
+- Language support:
+ - C: Limited built-in support, many parts need to be wired up manually.
+ - Rust: No built-in support, needs to be wired up manually.
+- Test integration: partially supported, many parts need to be wired up
+ manually.
+
+=== CMake
+
+- Platform support: not as extensive as GNU Make or autoconf, but all major
+ platforms are supported.
+ - AIX
+ - Cygwin
+ - FreeBSD
+ - Linux
+ - OpenBSD
+ - Solaris
+ - Windows
+ - macOS
+- Ease of use: easy to use, discovering available options is not always
+ trivial. The scripting language used by CMake is somewhat cumbersome to use,
+ but extending CMake build instructions is doable.
+- IDE support: natively integrated into Microsoft Visual Studio. Can generate
+ project descriptions for Xcode. An extension is available for Visual Studio
+ Code. Many other IDEs have plugins for CMake.
+- Out-of-tree builds: supported.
+- Cross-platform builds: supported.
+- Language support:
+ - C: Supported for GCC, Clang, MSVC and other toolchains.
+ - Rust: No built-in support, needs to be wired up manually.
+- Test integration: supported, even though test dependencies are a bit
+ cumbersome to use via "test fixtures". Interactive test runs are not
+ supported.
+
+=== Meson
+
+- Platform: not as extensive as GNU Make or autoconf, but all major platforms
+ and some smaller ones are supported.
+ - AIX
+ - Cygwin
+ - DragonflyBSD
+ - FreeBSD
+ - Haiku
+ - Linux
+ - NetBSD
+ - OpenBSD
+ - Solaris
+ - Windows
+ - macOS
+- Ease of use: easy to use, discovering available options is easy. The
+ scripting language is straight-forward to use.
+- IDE support: Supports generating build instructions for Xcode and Microsoft
+ Visual Studio, a plugin exists for Visual Studio Code.
+- Out-of-tree builds: supported.
+- Cross-platform builds: supported.
+- Language support:
+ - C: Supported for GCC, Clang, MSVC and other toolchains.
+ - Rust: Supported for rustc.
+- Test integration: supported. Interactive tests are supported starting with
+ Meson 1.5.0 via the `--interactive` flag.
--
2.47.0.274.g962d0b743d.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v9 22/23] Introduce support for the Meson build system
2024-11-25 9:56 ` [PATCH v9 " Patrick Steinhardt
` (20 preceding siblings ...)
2024-11-25 9:57 ` [PATCH v9 21/23] Documentation: add comparison of build systems Patrick Steinhardt
@ 2024-11-25 9:57 ` Patrick Steinhardt
2024-11-25 9:57 ` [PATCH v9 23/23] meson: fix conflicts with in-flight topics Patrick Steinhardt
22 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-25 9:57 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
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>
---
Documentation/meson.build | 324 +++++++
bin-wrappers/meson.build | 28 +
contrib/completion/meson.build | 8 +
contrib/meson.build | 1 +
gitweb/meson.build | 79 ++
meson.build | 1888 ++++++++++++++++++++++++++++++++++++
meson_options.txt | 81 ++
perl/FromCPAN/Mail/meson.build | 7 +
perl/FromCPAN/meson.build | 9 +
perl/Git/LoadCPAN/Mail/meson.build | 7 +
perl/Git/LoadCPAN/meson.build | 9 +
perl/Git/SVN/Memoize/meson.build | 7 +
perl/Git/SVN/meson.build | 20 +
perl/Git/meson.build | 18 +
perl/meson.build | 12 +
po/meson.build | 27 +
subprojects/.gitignore | 1 +
subprojects/curl.wrap | 13 +
subprojects/expat.wrap | 13 +
subprojects/openssl.wrap | 15 +
subprojects/pcre2.wrap | 16 +
subprojects/zlib.wrap | 13 +
t/helper/meson.build | 91 ++
t/meson.build | 1115 +++++++++++++++++++++
templates/hooks/meson.build | 26 +
templates/info/meson.build | 7 +
templates/meson.build | 15 +
27 files changed, 3850 insertions(+)
diff --git a/Documentation/meson.build b/Documentation/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..f2426ccaa30c29bd60b850eb0a9a4ab77c66a629
--- /dev/null
+++ b/Documentation/meson.build
@@ -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
diff --git a/bin-wrappers/meson.build b/bin-wrappers/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..6d03a19d7b8e3cf78ac0499b6cedf47e0c6cb441
--- /dev/null
+++ b/bin-wrappers/meson.build
@@ -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', fs.relative_to(executable.full_path(), meson.project_build_root()))
+
+ configure_file(
+ input: 'wrap-for-bin.sh',
+ output: fs.stem(executable.full_path()),
+ configuration: executable_config,
+ )
+endforeach
diff --git a/contrib/completion/meson.build b/contrib/completion/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..a9bfe2da312ac9764367b656bd8a4099b575ad72
--- /dev/null
+++ b/contrib/completion/meson.build
@@ -0,0 +1,8 @@
+foreach script : [
+ 'git-completion.bash',
+ 'git-completion.tcsh',
+ 'git-completion.zsh',
+ 'git-prompt.sh'
+]
+ test_dependencies += fs.copyfile(script)
+endforeach
diff --git a/contrib/meson.build b/contrib/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..a7b77b87c22c8f1d8a86faaafc2b647b94651db8
--- /dev/null
+++ b/contrib/meson.build
@@ -0,0 +1 @@
+subdir('completion')
diff --git a/gitweb/meson.build b/gitweb/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..ef868bd7dbcbcb5b69c2e73fc40c374435205c9c
--- /dev/null
+++ b/gitweb/meson.build
@@ -0,0 +1,79 @@
+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',
+]
+ fs.copyfile(asset,
+ install: true,
+ install_dir: get_option('datadir') / 'gitweb' / fs.parent(asset),
+ )
+endforeach
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..6531c9b67ed2cb8cb5eac9b0be4654ddd14fbe1d
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,1888 @@
+# Meson build system
+# ==================
+#
+# The Meson build system is an alternative to our Makefile that you can use to
+# build, test and install Git. Using Meson results in a couple of benefits:
+#
+# - Out-of-tree builds.
+# - Better integration into IDEs.
+# - Easy-to-use autoconfiguration of available features on your system.
+#
+# To use Meson from the command line you need to have both Meson and Ninja
+# installed. Alternatively, if you do not have Python available on your system,
+# you can also use Muon instead of Meson and Samurai instead of Ninja, both of
+# which are drop-ins replacement that only depend on C.
+#
+# Basic usage
+# ===========
+#
+# In the most trivial case, you can configure, build and install Git like this:
+#
+# 1. Set up the build directory. This only needs to happen once per build
+# directory you want to have. You can also configure multiple different
+# build directories with different configurations.
+#
+# $ meson setup build/
+#
+# The build directory gets ignored by Git automatically as Meson will write
+# a ".gitignore" file into it. From hereon, we will assume that you execute
+# commands inside this build directory.
+#
+# 2. Compile Git. You can either use Meson, Ninja or Samurai to do this, so all
+# of the following invocations are equivalent:
+#
+# $ meson compile
+# $ ninja
+# $ samu
+#
+# The different invocations should ultimately not make much of a difference.
+# Using Meson also works with other generators though, like when the build
+# directory has been set up for use with Microsoft Visual Studio.
+#
+# Ninja and Samurai use multiple jobs by default, scaling with the number of
+# processor cores available. You can pass the `-jN` flag to change this.
+#
+# Meson automatically picks up ccache and sccache when these are installed
+# when setting up the build directory. You can override this behaviour when
+# setting up the build directory by setting the `CC` environment variable to
+# your desired compiler.
+#
+# 3. Execute tests. Again, you can either use Meson, Ninja or Samurai to do this:
+#
+# $ meson test
+# $ ninja test
+# $ samu test
+#
+# It is recommended to use Meson in this case though as it also provides you
+# additional features that the other build systems don't have available.
+# You can e.g. pass additional arguments to the test executables or run
+# individual tests:
+#
+# # Execute the t0000-basic integration test and t-reftable-stack unit test.
+# $ meson test t0000-basic t-reftable-stack
+#
+# # Execute all reftable unit tests.
+# $ meson test t-reftable-*
+#
+# # Execute all tests and stop with the first failure.
+# $ meson test --maxfail 1
+#
+# # Execute single test interactively such that features like `debug ()` work.
+# $ meson test -i --test-args='-ix' t1400-update-ref
+#
+# Test execution is parallelized by default and scales with the number of
+# processor cores available. You can change the number of processes by passing
+# the `-jN` flag to `meson test`.
+#
+# 4. Install the Git distribution. Again, this can be done via Meson, Ninja or
+# Samurai:
+#
+# $ meson install
+# $ ninja install
+# $ samu install
+#
+# The prefix into which Git shall be installed is defined when setting up
+# the build directory. More on that in the "Configuration" section.
+#
+# Meson supports multiple backends. The default backend generates Ninja build
+# instructions, but it also supports the generation of Microsoft Visual
+# Studio solutions as well as Xcode projects by passing the `--backend` option
+# to `meson setup`. IDEs like Eclipse and Visual Studio Code provide plugins to
+# import Meson files directly.
+#
+# Configuration
+# =============
+#
+# The exact configuration of Git is determined when setting up the build
+# directory via `meson setup`. Unless told otherwise, Meson will automatically
+# detect the availability of various bits and pieces. There are two different
+# kinds of options that can be used to further tweak the build:
+#
+# - Built-in options provided by Meson.
+#
+# - Options defined by the project in the "meson_options.txt" file.
+#
+# Both kinds of options can be inspected by running `meson configure` in the
+# build directory, which will give you a list of the current value for all
+# options.
+#
+# Options can be configured either when setting up the build directory or can
+# be changed in preexisting build directories:
+#
+# # Set up a new build directory with optimized settings that will be
+# # installed into an alternative prefix.
+# $ meson setup --buildtype release --optimization 3 --strip --prefix=/home/$USER build
+#
+# # Set up a new build directory with a higher warning level. Level 2 is
+# # mostly equivalent to setting DEVELOPER=1, level 3 and "everything"
+# # will enable even more warnings.
+# $ meson setup -Dwarning_level=2 build
+#
+# # Set up a new build directory with 'address' and 'undefined' sanitizers
+# # using Clang.
+# $ CC=clang meson setup -Db_sanitize=address,undefined build
+#
+# # Disable tests in a preexisting build directory.
+# $ meson configure -Dtests=false
+#
+# # Disable features based on Python
+# $ meson configure -Dpython=disabled
+#
+# Options have a type like booleans, choices, strings or features. Features are
+# somewhat special as they can have one of three values: enabled, disabled or
+# auto. While the first two values are self-explanatory, "auto" will enable or
+# disable the feature based on the availability of prerequisites to support it.
+# Python-based features for example will be enabled automatically when a Python
+# interpreter could be found. The default value of such features can be changed
+# via `meson setup --auto-features={enabled,disabled,auto}`, which will set the
+# value of all features with a value of "auto" to the provided one by default.
+#
+# It is also possible to store a set of configuration options in machine files.
+# This can be useful in case you regularly want to reuse the same set of options:
+#
+# [binaries]
+# c = ['clang']
+# ar = ['ar']
+#
+# [project options]
+# gettext = 'disabled'
+# default_editor = 'vim'
+#
+# [built-in options]
+# b_lto = true
+# b_sanitize = 'address,undefined'
+#
+# These machine files can be passed to `meson setup` via the `--native-file`
+# option.
+#
+# Subproject wrappers
+# ===================
+#
+# Subproject wrappers are a feature provided by Meson that allows the automatic
+# fallback to a "wrapped" dependency in case the dependency is not provided by
+# the system. For example if the system is lacking curl, then Meson will use
+# "subprojects/curl.wrap" to set up curl as a subproject and compile and link
+# the dependency into Git itself. This is especially helpful on systems like
+# Windows, where you typically don't have such dependencies installed.
+#
+# The use of subproject wrappers can be disabled by executing `meson setup`
+# with the `--wrap-mode nofallback` option.
+
+project('git', 'c',
+ meson_version: '>=1.3.0',
+ # MSVC does not support GNU99, and C99 does not define __STDC_VERSION__
+ # on MSVC. So we instead fall back to C11 there.
+ default_options: ['c_std=gnu99,c11'],
+ version: 'v2.47.GIT',
+)
+
+fs = import('fs')
+
+program_path = []
+# Git for Windows provides all the tools we need to build Git.
+if host_machine.system() == 'windows'
+ program_path += [ 'C:/Program Files/Git/bin', 'C:/Program Files/Git/usr/bin' ]
+endif
+
+cygpath = find_program('cygpath', dirs: program_path, required: false)
+diff = find_program('diff', dirs: program_path)
+shell = find_program('sh', dirs: program_path)
+tar = find_program('tar', dirs: program_path)
+
+script_environment = environment()
+foreach tool : ['cat', 'cut', 'grep', 'sed', 'sort', 'tr', 'uname']
+ program = find_program(tool, dirs: program_path)
+ script_environment.prepend('PATH', fs.parent(program.full_path()))
+endforeach
+
+git = find_program('git', dirs: program_path, required: false)
+if git.found()
+ script_environment.prepend('PATH', fs.parent(git.full_path()))
+endif
+
+if get_option('sane_tool_path') != ''
+ script_environment.prepend('PATH', get_option('sane_tool_path'))
+endif
+
+compiler = meson.get_compiler('c')
+
+libgit_sources = [
+ 'abspath.c',
+ 'add-interactive.c',
+ 'add-patch.c',
+ 'advice.c',
+ 'alias.c',
+ 'alloc.c',
+ 'apply.c',
+ 'archive-tar.c',
+ 'archive-zip.c',
+ 'archive.c',
+ 'attr.c',
+ 'base85.c',
+ 'bisect.c',
+ 'blame.c',
+ 'blob.c',
+ 'bloom.c',
+ 'branch.c',
+ 'bulk-checkin.c',
+ 'bundle-uri.c',
+ 'bundle.c',
+ 'cache-tree.c',
+ 'cbtree.c',
+ 'chdir-notify.c',
+ 'checkout.c',
+ 'chunk-format.c',
+ 'color.c',
+ 'column.c',
+ 'combine-diff.c',
+ 'commit-graph.c',
+ 'commit-reach.c',
+ 'commit.c',
+ 'compat/nonblock.c',
+ 'compat/obstack.c',
+ 'compat/terminal.c',
+ 'compat/zlib-uncompress2.c',
+ 'config.c',
+ 'connect.c',
+ 'connected.c',
+ 'convert.c',
+ 'copy.c',
+ 'credential.c',
+ 'csum-file.c',
+ 'ctype.c',
+ 'date.c',
+ 'decorate.c',
+ 'delta-islands.c',
+ 'diagnose.c',
+ 'diff-delta.c',
+ 'diff-merges.c',
+ 'diff-lib.c',
+ 'diff-no-index.c',
+ 'diff.c',
+ 'diffcore-break.c',
+ 'diffcore-delta.c',
+ 'diffcore-order.c',
+ 'diffcore-pickaxe.c',
+ 'diffcore-rename.c',
+ 'diffcore-rotate.c',
+ 'dir-iterator.c',
+ 'dir.c',
+ 'editor.c',
+ 'entry.c',
+ 'environment.c',
+ 'ewah/bitmap.c',
+ 'ewah/ewah_bitmap.c',
+ 'ewah/ewah_io.c',
+ 'ewah/ewah_rlw.c',
+ 'exec-cmd.c',
+ 'fetch-negotiator.c',
+ 'fetch-pack.c',
+ 'fmt-merge-msg.c',
+ 'fsck.c',
+ 'fsmonitor.c',
+ 'fsmonitor-ipc.c',
+ 'fsmonitor-settings.c',
+ 'gettext.c',
+ 'git-zlib.c',
+ 'gpg-interface.c',
+ 'graph.c',
+ 'grep.c',
+ 'hash-lookup.c',
+ 'hashmap.c',
+ 'help.c',
+ 'hex.c',
+ 'hex-ll.c',
+ 'hook.c',
+ 'ident.c',
+ 'json-writer.c',
+ 'kwset.c',
+ 'levenshtein.c',
+ 'line-log.c',
+ 'line-range.c',
+ 'linear-assignment.c',
+ 'list-objects-filter-options.c',
+ 'list-objects-filter.c',
+ 'list-objects.c',
+ 'lockfile.c',
+ 'log-tree.c',
+ 'loose.c',
+ 'ls-refs.c',
+ 'mailinfo.c',
+ 'mailmap.c',
+ 'match-trees.c',
+ 'mem-pool.c',
+ 'merge-blobs.c',
+ 'merge-ll.c',
+ 'merge-ort.c',
+ 'merge-ort-wrappers.c',
+ 'merge-recursive.c',
+ 'merge.c',
+ 'midx.c',
+ 'midx-write.c',
+ 'name-hash.c',
+ 'negotiator/default.c',
+ 'negotiator/noop.c',
+ 'negotiator/skipping.c',
+ 'notes-cache.c',
+ 'notes-merge.c',
+ 'notes-utils.c',
+ 'notes.c',
+ 'object-file-convert.c',
+ 'object-file.c',
+ 'object-name.c',
+ 'object.c',
+ 'oid-array.c',
+ 'oidmap.c',
+ 'oidset.c',
+ 'oidtree.c',
+ 'pack-bitmap-write.c',
+ 'pack-bitmap.c',
+ 'pack-check.c',
+ 'pack-mtimes.c',
+ 'pack-objects.c',
+ 'pack-revindex.c',
+ 'pack-write.c',
+ 'packfile.c',
+ 'pager.c',
+ 'parallel-checkout.c',
+ 'parse.c',
+ 'parse-options-cb.c',
+ 'parse-options.c',
+ 'patch-delta.c',
+ 'patch-ids.c',
+ 'path.c',
+ 'pathspec.c',
+ 'pkt-line.c',
+ 'preload-index.c',
+ 'pretty.c',
+ 'prio-queue.c',
+ 'progress.c',
+ 'promisor-remote.c',
+ 'prompt.c',
+ 'protocol.c',
+ 'protocol-caps.c',
+ 'prune-packed.c',
+ 'pseudo-merge.c',
+ 'quote.c',
+ 'range-diff.c',
+ 'reachable.c',
+ 'read-cache.c',
+ 'rebase-interactive.c',
+ 'rebase.c',
+ 'ref-filter.c',
+ 'reflog-walk.c',
+ 'reflog.c',
+ 'refs.c',
+ 'refs/debug.c',
+ 'refs/files-backend.c',
+ 'refs/reftable-backend.c',
+ 'refs/iterator.c',
+ 'refs/packed-backend.c',
+ 'refs/ref-cache.c',
+ 'refspec.c',
+ 'reftable/basics.c',
+ 'reftable/error.c',
+ 'reftable/block.c',
+ 'reftable/blocksource.c',
+ 'reftable/iter.c',
+ 'reftable/merged.c',
+ 'reftable/pq.c',
+ 'reftable/reader.c',
+ 'reftable/record.c',
+ 'reftable/stack.c',
+ 'reftable/tree.c',
+ 'reftable/writer.c',
+ 'remote.c',
+ 'replace-object.c',
+ 'repo-settings.c',
+ 'repository.c',
+ 'rerere.c',
+ 'reset.c',
+ 'resolve-undo.c',
+ 'revision.c',
+ 'run-command.c',
+ 'send-pack.c',
+ 'sequencer.c',
+ 'serve.c',
+ 'server-info.c',
+ 'setup.c',
+ 'shallow.c',
+ 'sideband.c',
+ 'sigchain.c',
+ 'sparse-index.c',
+ 'split-index.c',
+ 'stable-qsort.c',
+ 'statinfo.c',
+ 'strbuf.c',
+ 'streaming.c',
+ 'string-list.c',
+ 'strmap.c',
+ 'strvec.c',
+ 'sub-process.c',
+ 'submodule-config.c',
+ 'submodule.c',
+ 'symlinks.c',
+ 'tag.c',
+ 'tempfile.c',
+ 'thread-utils.c',
+ 'tmp-objdir.c',
+ 'trace.c',
+ 'trace2.c',
+ 'trace2/tr2_cfg.c',
+ 'trace2/tr2_cmd_name.c',
+ 'trace2/tr2_ctr.c',
+ 'trace2/tr2_dst.c',
+ 'trace2/tr2_sid.c',
+ 'trace2/tr2_sysenv.c',
+ 'trace2/tr2_tbuf.c',
+ 'trace2/tr2_tgt_event.c',
+ 'trace2/tr2_tgt_normal.c',
+ 'trace2/tr2_tgt_perf.c',
+ 'trace2/tr2_tls.c',
+ 'trace2/tr2_tmr.c',
+ 'trailer.c',
+ 'transport-helper.c',
+ 'transport.c',
+ 'tree-diff.c',
+ 'tree-walk.c',
+ 'tree.c',
+ 'unpack-trees.c',
+ 'upload-pack.c',
+ 'url.c',
+ 'urlmatch.c',
+ 'usage.c',
+ 'userdiff.c',
+ 'utf8.c',
+ 'varint.c',
+ 'versioncmp.c',
+ 'walker.c',
+ 'wildmatch.c',
+ 'worktree.c',
+ 'wrapper.c',
+ 'write-or-die.c',
+ 'ws.c',
+ 'wt-status.c',
+ 'xdiff-interface.c',
+ 'xdiff/xdiffi.c',
+ 'xdiff/xemit.c',
+ 'xdiff/xhistogram.c',
+ 'xdiff/xmerge.c',
+ 'xdiff/xpatience.c',
+ 'xdiff/xprepare.c',
+ 'xdiff/xutils.c',
+]
+
+builtin_sources = [
+ 'builtin/add.c',
+ 'builtin/am.c',
+ 'builtin/annotate.c',
+ 'builtin/apply.c',
+ 'builtin/archive.c',
+ 'builtin/bisect.c',
+ 'builtin/blame.c',
+ 'builtin/branch.c',
+ 'builtin/bugreport.c',
+ 'builtin/bundle.c',
+ 'builtin/cat-file.c',
+ 'builtin/check-attr.c',
+ 'builtin/check-ignore.c',
+ 'builtin/check-mailmap.c',
+ 'builtin/check-ref-format.c',
+ 'builtin/checkout--worker.c',
+ 'builtin/checkout-index.c',
+ 'builtin/checkout.c',
+ 'builtin/clean.c',
+ 'builtin/clone.c',
+ 'builtin/column.c',
+ 'builtin/commit-graph.c',
+ 'builtin/commit-tree.c',
+ 'builtin/commit.c',
+ 'builtin/config.c',
+ 'builtin/count-objects.c',
+ 'builtin/credential-cache--daemon.c',
+ 'builtin/credential-cache.c',
+ 'builtin/credential-store.c',
+ 'builtin/credential.c',
+ 'builtin/describe.c',
+ 'builtin/diagnose.c',
+ 'builtin/diff-files.c',
+ 'builtin/diff-index.c',
+ 'builtin/diff-tree.c',
+ 'builtin/diff.c',
+ 'builtin/difftool.c',
+ 'builtin/fast-export.c',
+ 'builtin/fast-import.c',
+ 'builtin/fetch-pack.c',
+ 'builtin/fetch.c',
+ 'builtin/fmt-merge-msg.c',
+ 'builtin/for-each-ref.c',
+ 'builtin/for-each-repo.c',
+ 'builtin/fsck.c',
+ 'builtin/fsmonitor--daemon.c',
+ 'builtin/gc.c',
+ 'builtin/get-tar-commit-id.c',
+ 'builtin/grep.c',
+ 'builtin/hash-object.c',
+ 'builtin/help.c',
+ 'builtin/hook.c',
+ 'builtin/index-pack.c',
+ 'builtin/init-db.c',
+ 'builtin/interpret-trailers.c',
+ 'builtin/log.c',
+ 'builtin/ls-files.c',
+ 'builtin/ls-remote.c',
+ 'builtin/ls-tree.c',
+ 'builtin/mailinfo.c',
+ 'builtin/mailsplit.c',
+ 'builtin/merge-base.c',
+ 'builtin/merge-file.c',
+ 'builtin/merge-index.c',
+ 'builtin/merge-ours.c',
+ 'builtin/merge-recursive.c',
+ 'builtin/merge-tree.c',
+ 'builtin/merge.c',
+ 'builtin/mktag.c',
+ 'builtin/mktree.c',
+ 'builtin/multi-pack-index.c',
+ 'builtin/mv.c',
+ 'builtin/name-rev.c',
+ 'builtin/notes.c',
+ 'builtin/pack-objects.c',
+ 'builtin/pack-redundant.c',
+ 'builtin/pack-refs.c',
+ 'builtin/patch-id.c',
+ 'builtin/prune-packed.c',
+ 'builtin/prune.c',
+ 'builtin/pull.c',
+ 'builtin/push.c',
+ 'builtin/range-diff.c',
+ 'builtin/read-tree.c',
+ 'builtin/rebase.c',
+ 'builtin/receive-pack.c',
+ 'builtin/reflog.c',
+ 'builtin/refs.c',
+ 'builtin/remote-ext.c',
+ 'builtin/remote-fd.c',
+ 'builtin/remote.c',
+ 'builtin/repack.c',
+ 'builtin/replace.c',
+ 'builtin/replay.c',
+ 'builtin/rerere.c',
+ 'builtin/reset.c',
+ 'builtin/rev-list.c',
+ 'builtin/rev-parse.c',
+ 'builtin/revert.c',
+ 'builtin/rm.c',
+ 'builtin/send-pack.c',
+ 'builtin/shortlog.c',
+ 'builtin/show-branch.c',
+ 'builtin/show-index.c',
+ 'builtin/show-ref.c',
+ 'builtin/sparse-checkout.c',
+ 'builtin/stash.c',
+ 'builtin/stripspace.c',
+ 'builtin/submodule--helper.c',
+ 'builtin/symbolic-ref.c',
+ 'builtin/tag.c',
+ 'builtin/unpack-file.c',
+ 'builtin/unpack-objects.c',
+ 'builtin/update-index.c',
+ 'builtin/update-ref.c',
+ 'builtin/update-server-info.c',
+ 'builtin/upload-archive.c',
+ 'builtin/upload-pack.c',
+ 'builtin/var.c',
+ 'builtin/verify-commit.c',
+ 'builtin/verify-pack.c',
+ 'builtin/verify-tag.c',
+ 'builtin/worktree.c',
+ 'builtin/write-tree.c',
+]
+
+libgit_sources += custom_target(
+ input: 'command-list.txt',
+ output: 'command-list.h',
+ command: [shell, meson.current_source_dir() + '/generate-cmdlist.sh', meson.current_source_dir(), '@OUTPUT@'],
+ env: script_environment,
+)
+
+libgit_sources += custom_target(
+ output: 'config-list.h',
+ command: [
+ shell,
+ meson.current_source_dir() + '/generate-configlist.sh',
+ meson.current_source_dir(),
+ '@OUTPUT@',
+ ],
+ env: script_environment,
+)
+
+libgit_sources += custom_target(
+ input: 'Documentation/githooks.txt',
+ output: 'hook-list.h',
+ command: [
+ shell,
+ meson.current_source_dir() + '/generate-hooklist.sh',
+ meson.current_source_dir(),
+ '@OUTPUT@',
+ ],
+ env: script_environment,
+)
+
+# This contains the variables for GIT-BUILD-OPTIONS, which we use to propagate
+# build options to our tests.
+build_options_config = configuration_data()
+build_options_config.set('GIT_INTEROP_MAKE_OPTS', '')
+build_options_config.set('GIT_PERF_LARGE_REPO', '')
+build_options_config.set('GIT_PERF_MAKE_COMMAND', '')
+build_options_config.set('GIT_PERF_MAKE_OPTS', '')
+build_options_config.set('GIT_PERF_REPEAT_COUNT', '')
+build_options_config.set('GIT_PERF_REPO', '')
+build_options_config.set('GIT_TEST_CMP_USE_COPIED_CONTEXT', '')
+build_options_config.set('GIT_TEST_INDEX_VERSION', '')
+build_options_config.set('GIT_TEST_OPTS', '')
+build_options_config.set('GIT_TEST_PERL_FATAL_WARNINGS', '')
+build_options_config.set('GIT_TEST_UTF8_LOCALE', '')
+build_options_config.set_quoted('LOCALEDIR', fs.as_posix(get_option('prefix') / get_option('localedir')))
+build_options_config.set('GITWEBDIR', fs.as_posix(get_option('prefix') / get_option('datadir') / 'gitweb'))
+
+if get_option('sane_tool_path') != ''
+ build_options_config.set_quoted('BROKEN_PATH_FIX', 's|^\# @BROKEN_PATH_FIX@$|git_broken_path_fix "' + get_option('sane_tool_path') + '"|')
+else
+ build_options_config.set_quoted('BROKEN_PATH_FIX', '/^\# @BROKEN_PATH_FIX@$/d')
+endif
+
+test_output_directory = get_option('test_output_directory')
+if test_output_directory == ''
+ test_output_directory = meson.project_build_root() / 'test-output'
+endif
+
+# These variables are used for building libgit.a.
+libgit_c_args = [
+ '-DBINDIR="' + get_option('bindir') + '"',
+ '-DDEFAULT_EDITOR="' + get_option('default_editor') + '"',
+ '-DDEFAULT_GIT_TEMPLATE_DIR="' + get_option('datadir') / 'git-core/templates' + '"',
+ '-DDEFAULT_HELP_FORMAT="' + get_option('default_help_format') + '"',
+ '-DDEFAULT_PAGER="' + get_option('default_pager') + '"',
+ '-DETC_GITATTRIBUTES="' + get_option('gitattributes') + '"',
+ '-DETC_GITCONFIG="' + get_option('gitconfig') + '"',
+ '-DFALLBACK_RUNTIME_PREFIX="' + get_option('prefix') + '"',
+ '-DGIT_EXEC_PATH="' + get_option('prefix') / get_option('libexecdir') / 'git-core"',
+ '-DGIT_HOST_CPU="' + host_machine.cpu_family() + '"',
+ '-DGIT_HTML_PATH="' + get_option('datadir') / 'doc/git-doc"',
+ '-DGIT_INFO_PATH="' + get_option('infodir') + '"',
+ '-DGIT_LOCALE_PATH="' + get_option('localedir') + '"',
+ '-DGIT_MAN_PATH="' + get_option('mandir') + '"',
+ '-DPAGER_ENV="' + get_option('pager_environment') + '"',
+ '-DSHELL_PATH="' + fs.as_posix(shell.full_path()) + '"',
+]
+libgit_include_directories = [ '.' ]
+libgit_dependencies = [ ]
+
+# Treat any warning level above 1 the same as we treat DEVELOPER=1 in our
+# Makefile.
+if get_option('warning_level') in ['2','3', 'everything'] and compiler.get_argument_syntax() == 'gcc'
+ foreach cflag : [
+ '-Wdeclaration-after-statement',
+ '-Wformat-security',
+ '-Wold-style-definition',
+ '-Woverflow',
+ '-Wpointer-arith',
+ '-Wstrict-prototypes',
+ '-Wunused',
+ '-Wvla',
+ '-Wwrite-strings',
+ '-fno-common',
+ '-Wtautological-constant-out-of-range-compare',
+ # If a function is public, there should be a prototype and the right
+ # header file should be included. If not, it should be static.
+ '-Wmissing-prototypes',
+ # These are disabled because we have these all over the place.
+ '-Wno-empty-body',
+ '-Wno-missing-field-initializers',
+ '-Wno-sign-compare',
+ ]
+ if compiler.has_argument(cflag)
+ libgit_c_args += cflag
+ endif
+ endforeach
+endif
+
+if get_option('b_sanitize').contains('address')
+ build_options_config.set('SANITIZE_ADDRESS', 'YesCompiledWithIt')
+else
+ build_options_config.set('SANITIZE_ADDRESS', '')
+endif
+if get_option('b_sanitize').contains('leak')
+ libgit_c_args += '-DSUPPRESS_ANNOTATED_LEAKS'
+ build_options_config.set('SANITIZE_LEAK', 'YesCompiledWithIt')
+else
+ build_options_config.set('SANITIZE_LEAK', '')
+endif
+if get_option('b_sanitize').contains('undefined')
+ libgit_c_args += '-DSHA1DC_FORCE_ALIGNED_ACCESS'
+endif
+
+executable_suffix = ''
+if host_machine.system() == 'cygwin' or host_machine.system() == 'windows'
+ executable_suffix = '.exe'
+ libgit_c_args += '-DSTRIP_EXTENSION="' + executable_suffix + '"'
+endif
+build_options_config.set_quoted('X', executable_suffix)
+
+python = import('python').find_installation('python3', required: get_option('python'))
+if python.found()
+ build_options_config.set('NO_PYTHON', '')
+else
+ libgit_c_args += '-DNO_PYTHON'
+ build_options_config.set('NO_PYTHON', '1')
+endif
+
+# Perl is used for two different things: our test harness and to provide some
+# features. It is optional if you want to neither execute tests nor use any of
+# these optional features.
+perl_required = get_option('perl')
+if get_option('tests')
+ perl_required = true
+endif
+
+# Note that we only set NO_PERL if the Perl features were disabled by the user.
+# It may not be set when we have found Perl, but only use it to run tests.
+perl = find_program('perl', version: '>=5.8.1', dirs: program_path, required: perl_required)
+perl_features_enabled = perl.found() and get_option('perl').allowed()
+if perl_features_enabled
+ build_options_config.set('NO_PERL', '')
+
+ if get_option('runtime_prefix')
+ build_options_config.set('PERL_LOCALEDIR', '')
+ else
+ build_options_config.set_quoted('PERL_LOCALEDIR', fs.as_posix(get_option('prefix') / get_option('localedir')))
+ endif
+
+ if get_option('perl_cpan_fallback')
+ build_options_config.set('NO_PERL_CPAN_FALLBACKS', '')
+ else
+ build_options_config.set_quoted('NO_PERL_CPAN_FALLBACKS', 'YesPlease')
+ endif
+else
+ libgit_c_args += '-DNO_PERL'
+ build_options_config.set('NO_PERL', '1')
+ build_options_config.set('PERL_LOCALEDIR', '')
+ build_options_config.set('NO_PERL_CPAN_FALLBACKS', '')
+endif
+
+zlib = dependency('zlib', default_options: ['default_library=static', 'tests=disabled'])
+if zlib.version().version_compare('<1.2.0')
+ libgit_c_args += '-DNO_DEFLATE_BOUND'
+endif
+libgit_dependencies += zlib
+
+threads = dependency('threads', required: false)
+if threads.found()
+ libgit_dependencies += threads
+ build_options_config.set('NO_PTHREADS', '')
+else
+ libgit_c_args += '-DNO_PTHREADS'
+ build_options_config.set('NO_PTHREADS', '1')
+endif
+
+msgfmt = find_program('msgfmt', dirs: program_path, required: false)
+gettext_option = get_option('gettext').disable_auto_if(not msgfmt.found())
+if not msgfmt.found() and gettext_option.enabled()
+ error('Internationalization via libintl requires msgfmt')
+endif
+
+if gettext_option.allowed() and host_machine.system() == 'darwin' and get_option('macos_use_homebrew_gettext')
+ if host_machine.cpu_family() == 'x86_64'
+ libintl_prefix = '/usr/local'
+ elif host_machine.cpu_family() == 'aarch64'
+ libintl_prefix = '/opt/homebrew'
+ else
+ error('Homebrew workaround not supported on current architecture')
+ endif
+
+ intl = compiler.find_library('intl', dirs: libintl_prefix / 'lib', required: gettext_option)
+ if intl.found()
+ intl = declare_dependency(
+ dependencies: intl,
+ include_directories: libintl_prefix / 'include',
+ )
+ endif
+else
+ intl = dependency('intl', required: gettext_option)
+endif
+if intl.found()
+ libgit_dependencies += intl
+ build_options_config.set('NO_GETTEXT', '')
+ build_options_config.set('USE_GETTEXT_SCHEME', '')
+else
+ libgit_c_args += '-DNO_GETTEXT'
+ build_options_config.set('NO_GETTEXT', '1')
+ build_options_config.set('USE_GETTEXT_SCHEME', 'fallthrough')
+endif
+
+iconv = dependency('iconv', required: get_option('iconv'))
+if iconv.found()
+ libgit_dependencies += iconv
+ build_options_config.set('NO_ICONV', '')
+
+ have_old_iconv = false
+ if not compiler.compiles('''
+ #include <iconv.h>
+
+ extern size_t iconv(iconv_t cd,
+ char **inbuf, size_t *inbytesleft,
+ char **outbuf, size_t *outbytesleft);
+ ''', name: 'old iconv interface', dependencies: [iconv])
+ libgit_c_args += '-DOLD_ICONV'
+ have_old_iconv = true
+ endif
+
+ iconv_omits_bom_source = '''#
+ #include <iconv.h>
+
+ int main(int argc, const char **argv)
+ {
+ '''
+ if have_old_iconv
+ iconv_omits_bom_source += '''
+ typedef const char *iconv_ibp;
+ '''
+ else
+ iconv_omits_bom_source += '''
+ typedef char *iconv_ibp;
+ '''
+ endif
+ iconv_omits_bom_source += '''
+ int v;
+ iconv_t conv;
+ char in[] = "a"; iconv_ibp pin = in;
+ char out[20] = ""; char *pout = out;
+ size_t isz = sizeof in;
+ size_t osz = sizeof out;
+
+ conv = iconv_open("UTF-16", "UTF-8");
+ iconv(conv, &pin, &isz, &pout, &osz);
+ iconv_close(conv);
+ v = (unsigned char)(out[0]) + (unsigned char)(out[1]);
+ return v != 0xfe + 0xff;
+ }
+ '''
+
+ if compiler.run(iconv_omits_bom_source,
+ dependencies: iconv,
+ name: 'iconv omits BOM',
+ ).returncode() != 0
+ libgit_c_args += '-DICONV_OMITS_BOM'
+ endif
+else
+ libgit_c_args += '-DNO_ICONV'
+ build_options_config.set('NO_ICONV', '1')
+endif
+
+pcre2 = dependency('libpcre2-8', required: get_option('pcre2'), default_options: ['default_library=static', 'test=false'])
+if pcre2.found()
+ libgit_dependencies += pcre2
+ libgit_c_args += '-DUSE_LIBPCRE2'
+ build_options_config.set('USE_LIBPCRE2', '1')
+else
+ build_options_config.set('USE_LIBPCRE2', '')
+endif
+
+curl = dependency('libcurl', version: '>=7.21.3', required: get_option('curl'), default_options: ['default_library=static', 'tests=disabled', 'tool=disabled'])
+use_curl_for_imap_send = false
+if curl.found()
+ if curl.version().version_compare('>=7.34.0')
+ libgit_c_args += '-DUSE_CURL_FOR_IMAP_SEND'
+ use_curl_for_imap_send = true
+ endif
+
+ libgit_dependencies += curl
+ libgit_c_args += '-DCURL_DISABLE_TYPECHECK'
+ build_options_config.set('NO_CURL', '')
+else
+ libgit_c_args += '-DNO_CURL'
+ build_options_config.set('NO_CURL', '1')
+endif
+
+expat = dependency('expat', required: get_option('expat'), default_options: ['default_library=static', 'build_tests=false'])
+if expat.found()
+ libgit_dependencies += expat
+
+ if expat.version().version_compare('<=1.2')
+ libgit_c_args += '-DEXPAT_NEEDS_XMLPARSE_H'
+ endif
+ build_options_config.set('NO_EXPAT', '')
+else
+ libgit_c_args += '-DNO_EXPAT'
+ build_options_config.set('NO_EXPAT', '1')
+endif
+
+if not compiler.has_header('sys/select.h')
+ libgit_c_args += '-DNO_SYS_SELECT_H'
+endif
+
+has_poll_h = compiler.has_header('poll.h')
+if not has_poll_h
+ libgit_c_args += '-DNO_POLL_H'
+endif
+
+has_sys_poll_h = compiler.has_header('sys/poll.h')
+if not has_sys_poll_h
+ libgit_c_args += '-DNO_SYS_POLL_H'
+endif
+
+if not has_poll_h and not has_sys_poll_h
+ libgit_c_args += '-DNO_POLL'
+ libgit_sources += 'compat/poll/poll.c'
+ libgit_include_directories += 'compat/poll'
+endif
+
+if not compiler.has_header('inttypes.h')
+ libgit_c_args += '-DNO_INTTYPES_H'
+endif
+
+if compiler.has_header('libcharset.h')
+ libcharset = compiler.find_library('charset')
+
+ if compiler.has_function('locale_charset',
+ prefix: '#include <libcharset.h>',
+ dependencies: iconv,
+ )
+ libgit_c_args += '-DHAVE_LIBCHARSET_H'
+ elif compiler.has_function('locale_charset',
+ prefix: '#include <libcharset.h>',
+ dependencies: libcharset,
+ )
+ libgit_c_args += '-DHAVE_LIBCHARSET_H'
+ endif
+endif
+
+if compiler.has_header('alloca.h')
+ libgit_c_args += '-DHAVE_ALLOCA_H'
+endif
+
+if compiler.has_header('sys/sysinfo.h')
+ libgit_c_args += '-DHAVE_SYSINFO'
+endif
+
+# Windows has libgen.h and a basename implementation, but we still need our own
+# implementation to threat things like drive prefixes specially.
+if host_machine.system() == 'windows' or not compiler.has_header('libgen.h')
+ libgit_c_args += '-DNO_LIBGEN_H'
+ libgit_sources += 'compat/basename.c'
+endif
+
+if compiler.has_header('paths.h')
+ libgit_c_args += '-DHAVE_PATHS_H'
+endif
+
+if compiler.has_header('strings.h')
+ libgit_c_args += '-DHAVE_STRINGS_H'
+endif
+
+networking_dependencies = [ ]
+if host_machine.system() == 'windows'
+ winsock = compiler.find_library('ws2_32', required: false)
+ if winsock.found()
+ networking_dependencies += winsock
+ endif
+else
+ libresolv = compiler.find_library('resolv', required: false)
+ if libresolv.found()
+ networking_dependencies += libresolv
+ endif
+endif
+libgit_dependencies += networking_dependencies
+
+foreach symbol : ['inet_ntop', 'inet_pton', 'strerror']
+ if not compiler.has_function(symbol, dependencies: networking_dependencies)
+ libgit_c_args += '-DNO_' + symbol.to_upper()
+ endif
+endforeach
+
+has_ipv6 = compiler.has_function('getaddrinfo', dependencies: networking_dependencies)
+if not has_ipv6
+ libgit_c_args += '-DNO_IPV6'
+endif
+
+if not compiler.compiles('''
+ #ifdef _WIN32
+ # include <winsock2.h>
+ #else
+ # include <sys/types.h>
+ # include <sys/socket.h>
+ #endif
+
+ void func(void)
+ {
+ struct sockaddr_storage x;
+ }
+''', name: 'struct sockaddr_storage')
+ if has_ipv6
+ libgit_c_args += '-Dsockaddr_storage=sockaddr_in6'
+ else
+ libgit_c_args += '-Dsockaddr_storage=sockaddr_in'
+ endif
+endif
+
+if compiler.has_function('socket', dependencies: networking_dependencies)
+ libgit_sources += [
+ 'unix-socket.c',
+ 'unix-stream-server.c',
+ ]
+ build_options_config.set('NO_UNIX_SOCKETS', '')
+else
+ libgit_c_args += '-DNO_UNIX_SOCKETS'
+ build_options_config.set('NO_UNIX_SOCKETS', '1')
+endif
+
+if not compiler.has_function('pread')
+ libgit_c_args += '-DNO_PREAD'
+ libgit_sources += 'compat/pread.c'
+endif
+
+if host_machine.system() == 'darwin'
+ libgit_sources += 'compat/precompose_utf8.c'
+ libgit_c_args += '-DPRECOMPOSE_UNICODE'
+ libgit_c_args += '-DPROTECT_HFS_DEFAULT'
+endif
+
+# Configure general compatibility wrappers.
+if host_machine.system() == 'cygwin'
+ libgit_sources += [
+ 'compat/win32/path-utils.c',
+ ]
+elif host_machine.system() == 'windows'
+ libgit_sources += [
+ 'compat/mingw.c',
+ 'compat/winansi.c',
+ 'compat/win32/flush.c',
+ 'compat/win32/path-utils.c',
+ 'compat/win32/pthread.c',
+ 'compat/win32/syslog.c',
+ 'compat/win32/dirent.c',
+ 'compat/win32mmap.c',
+ 'compat/nedmalloc/nedmalloc.c',
+ ]
+
+ libgit_c_args += [
+ '-DDETECT_MSYS_TTY',
+ '-DENSURE_MSYSTEM_IS_SET',
+ '-DNATIVE_CRLF',
+ '-DNOGDI',
+ '-DNO_POSIX_GOODIES',
+ '-DWIN32',
+ '-D_CONSOLE',
+ '-D_CONSOLE_DETECT_MSYS_TTY',
+ '-D__USE_MINGW_ANSI_STDIO=0',
+ ]
+
+ libgit_dependencies += compiler.find_library('ntdll')
+ libgit_include_directories += 'compat/win32'
+ if compiler.get_id() == 'msvc'
+ libgit_include_directories += 'compat/vcbuild/include'
+ endif
+endif
+
+if host_machine.system() == 'linux'
+ libgit_sources += 'compat/linux/procinfo.c'
+elif host_machine.system() == 'windows'
+ libgit_sources += 'compat/win32/trace2_win32_process_info.c'
+else
+ libgit_sources += 'compat/stub/procinfo.c'
+endif
+
+if host_machine.system() == 'cygwin' or host_machine.system() == 'windows'
+ libgit_c_args += [
+ '-DUNRELIABLE_FSTAT',
+ '-DMMAP_PREVENTS_DELETE',
+ '-DOBJECT_CREATION_MODE=1',
+ ]
+endif
+
+# Configure the simple-ipc subsystem required fro the fsmonitor.
+if host_machine.system() == 'windows'
+ libgit_sources += [
+ 'compat/simple-ipc/ipc-shared.c',
+ 'compat/simple-ipc/ipc-win32.c',
+ ]
+ libgit_c_args += '-DSUPPORTS_SIMPLE_IPC'
+else
+ libgit_sources += [
+ 'compat/simple-ipc/ipc-shared.c',
+ 'compat/simple-ipc/ipc-unix-socket.c',
+ ]
+ libgit_c_args += '-DSUPPORTS_SIMPLE_IPC'
+endif
+
+fsmonitor_backend = ''
+if host_machine.system() == 'windows'
+ fsmonitor_backend = 'win32'
+elif host_machine.system() == 'darwin'
+ fsmonitor_backend = 'darwin'
+ libgit_dependencies += dependency('CoreServices')
+endif
+if fsmonitor_backend != ''
+ libgit_c_args += '-DHAVE_FSMONITOR_DAEMON_BACKEND'
+ libgit_c_args += '-DHAVE_FSMONITOR_OS_SETTINGS'
+
+ libgit_sources += [
+ 'compat/fsmonitor/fsm-health-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-ipc-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-listen-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-path-utils-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-settings-' + fsmonitor_backend + '.c',
+ ]
+endif
+build_options_config.set_quoted('FSMONITOR_DAEMON_BACKEND', fsmonitor_backend)
+build_options_config.set_quoted('FSMONITOR_OS_SETTINGS', fsmonitor_backend)
+
+if not get_option('b_sanitize').contains('address') and get_option('regex').allowed() and compiler.has_header('regex.h') and compiler.get_define('REG_STARTEND', prefix: '#include <regex.h>') != ''
+ build_options_config.set('NO_REGEX', '')
+
+ if compiler.get_define('REG_ENHANCED', prefix: '#include <regex.h>') != ''
+ libgit_c_args += '-DUSE_ENHANCED_BASIC_REGULAR_EXPRESSIONS'
+ libgit_sources += 'compat/regcomp_enhanced.c'
+ endif
+elif not get_option('regex').enabled()
+ libgit_c_args += [
+ '-DNO_REGEX',
+ '-DGAWK',
+ '-DNO_MBSUPPORT',
+ ]
+ build_options_config.set('NO_REGEX', '1')
+ libgit_sources += 'compat/regex/regex.c'
+ libgit_include_directories += 'compat/regex'
+else
+ error('Native regex support requested but not found')
+endif
+
+# setitimer and friends are provided by compat/mingw.c.
+if host_machine.system() != 'windows'
+ if not compiler.compiles('''
+ #include <sys/time.h>
+ void func(void)
+ {
+ struct itimerval value;
+ }
+ ''', name: 'struct itimerval')
+ libgit_c_args += '-DNO_STRUCT_ITIMERVAL'
+ libgit_c_args += '-DNO_SETITIMER'
+ elif not compiler.has_function('setitimer')
+ libgit_c_args += '-DNO_SETITIMER'
+ endif
+endif
+
+if compiler.has_member('struct stat', 'st_mtimespec.tv_nsec', prefix: '#include <sys/stat.h>')
+ libgit_c_args += '-DUSE_ST_TIMESPEC'
+elif not compiler.has_member('struct stat', 'st_mtim.tv_nsec', prefix: '#include <sys/stat.h>')
+ libgit_c_args += '-DNO_NSEC'
+endif
+
+if not compiler.has_member('struct stat', 'st_blocks', prefix: '#include <sys/stat.h>')
+ libgit_c_args += '-DNO_ST_BLOCKS_IN_STRUCT_STAT'
+endif
+
+if not compiler.has_member('struct dirent', 'd_type', prefix: '#include <dirent.h>')
+ libgit_c_args += '-DNO_D_TYPE_IN_DIRENT'
+endif
+
+if not compiler.has_member('struct passwd', 'pw_gecos', prefix: '#include <pwd.h>')
+ libgit_c_args += '-DNO_GECOS_IN_PWENT'
+endif
+
+if compiler.has_function('sync_file_range')
+ libgit_c_args += '-DHAVE_SYNC_FILE_RANGE'
+endif
+
+if not compiler.has_function('strcasestr')
+ libgit_c_args += '-DNO_STRCASESTR'
+ libgit_sources += 'compat/strcasestr.c'
+endif
+
+if not compiler.has_function('memmem')
+ libgit_c_args += '-DNO_MEMMEM'
+ libgit_sources += 'compat/memmem.c'
+endif
+
+if not compiler.has_function('strlcpy')
+ libgit_c_args += '-DNO_STRLCPY'
+ libgit_sources += 'compat/strlcpy.c'
+endif
+
+if not compiler.has_function('strdup')
+ libgit_c_args += '-DOVERRIDE_STRDUP'
+ libgit_sources += 'compat/strdup.c'
+endif
+
+if not compiler.has_function('strtoumax')
+ libgit_c_args += '-DNO_STRTOUMAX'
+ libgit_sources += [
+ 'compat/strtoumax.c',
+ 'compat/strtoimax.c',
+ ]
+endif
+
+if not compiler.has_function('strtoull')
+ libgit_c_args += '-DNO_STRTOULL'
+endif
+
+if not compiler.has_function('setenv')
+ libgit_c_args += '-DNO_SETENV'
+ libgit_sources += 'compat/setenv.c'
+endif
+
+if not compiler.has_function('qsort')
+ libgit_c_args += '-DINTERNAL_QSORT'
+endif
+libgit_sources += 'compat/qsort_s.c'
+
+# unsetenv is provided by compat/mingw.c.
+if host_machine.system() != 'windows' and not compiler.has_function('unsetenv')
+ libgit_c_args += '-DNO_UNSETENV'
+ libgit_sources += 'compat/unsetenv.c'
+endif
+
+if not compiler.has_function('mkdtemp')
+ libgit_c_args += '-DNO_MKDTEMP'
+ libgit_sources += 'compat/mkdtemp.c'
+endif
+
+if not compiler.has_function('initgroups')
+ libgit_c_args += '-DNO_INITGROUPS'
+endif
+
+if compiler.has_function('getdelim')
+ libgit_c_args += '-DHAVE_GETDELIM'
+endif
+
+if host_machine.system() == 'windows'
+ libgit_c_args += '-DUSE_WIN32_MMAP'
+elif not compiler.has_function('mmap')
+ libgit_c_args += '-DNO_MMAP'
+ libgit_sources += 'compat/mmap.c'
+endif
+
+if compiler.has_function('clock_gettime')
+ libgit_c_args += '-DHAVE_CLOCK_GETTIME'
+endif
+
+if compiler.compiles('''
+ #include <time.h>
+
+ void func(void)
+ {
+ clockid_t id = CLOCK_MONOTONIC;
+ }
+''', name: 'monotonic clock')
+ libgit_c_args += '-DHAVE_CLOCK_MONOTONIC'
+endif
+
+if not compiler.compiles('''
+ #include <inttypes.h>
+
+ void func(void)
+ {
+ uintmax_t x = 0;
+ }
+''', name: 'uintmax_t')
+ libgit_c_args += '-DNO_UINTMAX_T'
+endif
+
+has_bsd_sysctl = false
+if compiler.has_header('sys/sysctl.h')
+ if compiler.compiles('''
+ #include <stddef.h>
+ #include <sys/sysctl.h>
+
+ void func(void)
+ {
+ int val, mib[2] = { 0 };
+ size_t len = sizeof(val);
+ sysctl(mib, 2, &val, &len, NULL, 0);
+ }
+ ''', name: 'BSD sysctl')
+ libgit_c_args += '-DHAVE_BSD_SYSCTL'
+ has_bsd_sysctl = true
+ endif
+endif
+
+if not meson.is_cross_build() and compiler.run('''
+ #include <stdio.h>
+
+ int main(int argc, const char **argv)
+ {
+ FILE *f = fopen(".", "r");
+ return f ? 0 : 1;
+ }
+''', name: 'fread reads directories').returncode() == 0
+ libgit_c_args += '-DFREAD_READS_DIRECTORIES'
+ libgit_sources += 'compat/fopen.c'
+endif
+
+if not meson.is_cross_build() and fs.exists('/dev/tty')
+ libgit_c_args += '-DHAVE_DEV_TTY'
+endif
+
+https_backend = get_option('https_backend')
+
+security_framework = dependency('Security', required: https_backend == 'CommonCrypto')
+core_foundation_framework = dependency('CoreFoundation', required: security_framework.found())
+if https_backend == 'auto' and security_framework.found()
+ https_backend = 'CommonCrypto'
+endif
+
+openssl_required = https_backend == 'openssl' or get_option('sha1_backend') == 'openssl' or get_option('sha256_backend') == 'openssl'
+openssl = dependency('openssl', required: openssl_required, default_options: ['default_library=static'])
+if https_backend == 'auto' and openssl.found()
+ https_backend = 'openssl'
+endif
+
+if https_backend == 'CommonCrypto'
+ libgit_dependencies += security_framework
+ libgit_dependencies += core_foundation_framework
+ libgit_c_args += '-DAPPLE_COMMON_CRYPTO'
+elif https_backend == 'openssl'
+ libgit_dependencies += openssl
+else
+ # We either couldn't find any dependencies with 'auto' or the user requested
+ # 'none'. Both cases are benign.
+endif
+
+if https_backend != 'openssl'
+ libgit_c_args += '-DNO_OPENSSL'
+endif
+
+sha1_backend = get_option('sha1_backend')
+if sha1_backend == 'sha1dc'
+ libgit_c_args += '-DSHA1_DC'
+ libgit_c_args += '-DSHA1DC_NO_STANDARD_INCLUDES=1'
+ libgit_c_args += '-DSHA1DC_INIT_SAFE_HASH_DEFAULT=0'
+ libgit_c_args += '-DSHA1DC_CUSTOM_INCLUDE_SHA1_C="git-compat-util.h"'
+ libgit_c_args += '-DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="git-compat-util.h"'
+
+ libgit_sources += [
+ 'sha1dc_git.c',
+ 'sha1dc/sha1.c',
+ 'sha1dc/ubc_check.c',
+ ]
+elif sha1_backend == 'common-crypto'
+ libgit_c_args += '-DCOMMON_DIGEST_FOR_OPENSSL'
+ libgit_c_args += '-DSHA1_APPLE'
+ # Apple CommonCrypto requires chunking
+ libgit_c_args += '-DSHA1_MAX_BLOCK_SIZE=1024L*1024L*1024L'
+elif sha1_backend == 'openssl'
+ libgit_c_args += '-DSHA1_OPENSSL'
+ libgit_dependencies += openssl
+elif sha1_backend == 'block'
+ libgit_c_args += '-DSHA1_BLK'
+ libgit_sources += 'block-sha1/sha1.c'
+else
+ error('Unhandled SHA1 backend ' + sha1_backend)
+endif
+
+sha256_backend = get_option('sha256_backend')
+if sha256_backend == 'openssl'
+ libgit_c_args += '-DSHA256_OPENSSL'
+ libgit_dependencies += openssl
+elif sha256_backend == 'nettle'
+ nettle = dependency('nettle')
+ libgit_dependencies += nettle
+ libgit_c_args += '-DSHA256_NETTLE'
+elif sha256_backend == 'gcrypt'
+ gcrypt = dependency('gcrypt')
+ libgit_dependencies += gcrypt
+ libgit_c_args += '-DSHA256_GCRYPT'
+elif sha256_backend == 'block'
+ libgit_c_args += '-DSHA256_BLK'
+ libgit_sources += 'sha256/block/sha256.c'
+else
+ error('Unhandled SHA256 backend ' + sha256_backend)
+endif
+
+if compiler.has_header_symbol('stdlib.h', 'arc4random_buf')
+ libgit_c_args += '-DHAVE_ARC4RANDOM'
+elif compiler.has_header_symbol('bsd/stdlib.h', 'arc4random_buf')
+ libgit_c_args += '-DHAVE_ARC4RANDOM_BSD'
+elif compiler.has_function('getrandom', prefix: '#include <sys/random.h>')
+ libgit_c_args += '-DHAVE_GETRANDOM'
+elif compiler.has_function('getentropy', prefix: '#include <unistd.h>')
+ libgit_c_args += '-DHAVE_GETENTROPY'
+elif compiler.has_function('RtlGenRandom', prefix: '#include <windows.h>\n#include <ntsecapi.h>')
+ libgit_c_args += '-DHAVE_RTLGENRANDOM'
+elif openssl.found()
+ libgit_c_args += '-DHAVE_OPENSSL_CSPRNG'
+endif
+
+if get_option('runtime_prefix')
+ libgit_c_args += '-DRUNTIME_PREFIX'
+ build_options_config.set('RUNTIME_PREFIX', 'true')
+
+ if compiler.has_header('mach-o/dyld.h')
+ libgit_c_args += '-DHAVE_NS_GET_EXECUTABLE_PATH'
+ endif
+
+ if has_bsd_sysctl and compiler.compiles('''
+ #include <sys/sysctl.h>
+
+ void func(void)
+ {
+ KERN_PROC_PATHNAME; KERN_PROC;
+ }
+ ''', name: 'BSD KERN_PROC_PATHNAME')
+ libgit_c_args += '-DHAVE_NS_GET_EXECUTABLE_PATH'
+ endif
+
+ if host_machine.system() == 'linux'
+ libgit_c_args += '-DPROCFS_EXECUTABLE_PATH="/proc/self/exe' + '"'
+ elif host_machine.system() == 'openbsd'
+ libgit_c_args += '-DPROCFS_EXECUTABLE_PATH="' + '/proc/curproc/file' + '"'
+ elif host_machine.system() == 'netbsd'
+ libgit_c_args += '-DPROCFS_EXECUTABLE_PATH="' + '/proc/curproc/exe' + '"'
+ endif
+
+ if host_machine.system() == 'windows' and compiler.compiles('''
+ #include <stdlib.h>
+
+ void func(void)
+ {
+ _wpgmptr;
+ }
+ ''', name: 'Win32 _wpgmptr')
+ libgit_c_args += '-DHAVE_WPGMPTR'
+ endif
+else
+ build_options_config.set('RUNTIME_PREFIX', 'false')
+endif
+
+foreach key, value : {
+ 'DIFF': diff.full_path(),
+ 'GIT_TEST_CMP': diff.full_path() + ' -u',
+ 'GIT_TEST_GITPERLLIB': meson.project_build_root() / 'perl',
+ 'GIT_TEST_MERGE_TOOLS_DIR': meson.project_source_root() / 'mergetools',
+ 'GIT_TEST_POPATH': meson.project_source_root() / 'po',
+ 'GIT_TEST_TEMPLATE_DIR': meson.project_build_root() / 'templates',
+ 'GIT_TEST_TEXTDOMAINDIR': meson.project_build_root() / 'po',
+ 'PAGER_ENV': get_option('pager_environment'),
+ 'PERL_PATH': perl.found() ? perl.full_path() : '',
+ 'PYTHON_PATH': python.found () ? python.full_path() : '',
+ 'SHELL_PATH': shell.full_path(),
+ 'TAR': tar.full_path(),
+ 'TEST_OUTPUT_DIRECTORY': test_output_directory,
+ 'TEST_SHELL_PATH': shell.full_path(),
+}
+ if value != '' and cygpath.found()
+ value = run_command(cygpath, value, check: true).stdout().strip()
+ endif
+ build_options_config.set_quoted(key, value)
+endforeach
+
+configure_file(
+ input: 'GIT-BUILD-OPTIONS.in',
+ output: 'GIT-BUILD-OPTIONS',
+ configuration: build_options_config,
+)
+
+git_version_file = custom_target(
+ command: [
+ shell,
+ meson.current_source_dir() / 'GIT-VERSION-GEN',
+ meson.current_source_dir(),
+ '@INPUT@',
+ '@OUTPUT@',
+ ],
+ input: meson.current_source_dir() / 'GIT-VERSION-FILE.in',
+ output: 'GIT-VERSION-FILE',
+ build_always_stale: true,
+)
+
+version_def_h = custom_target(
+ command: [
+ shell,
+ meson.current_source_dir() / 'GIT-VERSION-GEN',
+ meson.current_source_dir(),
+ '@INPUT@',
+ '@OUTPUT@',
+ ],
+ input: meson.current_source_dir() / 'version-def.h.in',
+ output: 'version-def.h',
+ # Depend on GIT-VERSION-FILE so that we don't always try to rebuild this
+ # target for the same commit.
+ depends: [git_version_file],
+)
+
+# Build a separate library for "version.c" so that we do not have to rebuild
+# everything when the current Git commit changes.
+libgit_version_library = static_library('git-version',
+ sources: [
+ 'version.c',
+ version_def_h,
+ ],
+ c_args: libgit_c_args,
+ dependencies: libgit_dependencies,
+ include_directories: libgit_include_directories,
+)
+
+libgit_library = static_library('git',
+ sources: libgit_sources,
+ c_args: libgit_c_args,
+ link_with: libgit_version_library,
+ dependencies: libgit_dependencies,
+ include_directories: libgit_include_directories,
+)
+
+libgit = declare_dependency(
+ compile_args: libgit_c_args,
+ link_with: libgit_library,
+ dependencies: libgit_dependencies,
+ include_directories: libgit_include_directories,
+)
+
+common_main_sources = ['common-main.c']
+common_main_link_args = [ ]
+if host_machine.system() == 'windows'
+ git_rc = custom_target(
+ command: [
+ shell,
+ meson.current_source_dir() / 'GIT-VERSION-GEN',
+ meson.current_source_dir(),
+ '@INPUT@',
+ '@OUTPUT@',
+ ],
+ input: meson.current_source_dir() / 'git.rc.in',
+ output: 'git.rc',
+ depends: [git_version_file],
+ )
+
+ common_main_sources += import('windows').compile_resources(git_rc,
+ include_directories: [meson.current_source_dir()],
+ )
+ if compiler.get_argument_syntax() == 'gcc'
+ common_main_link_args += [
+ '-municode',
+ '-Wl,-nxcompat',
+ '-Wl,-dynamicbase',
+ '-Wl,-pic-executable,-e,mainCRTStartup',
+ ]
+ elif compiler.get_argument_syntax() == 'msvc'
+ common_main_link_args += [
+ '/ENTRY:wmainCRTStartup',
+ 'invalidcontinue.obj',
+ ]
+ else
+ error('Unsupported compiler ' + compiler.get_id())
+ endif
+endif
+common_main_library = static_library('common-main',
+ 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,
+ link_args: common_main_link_args,
+)
+
+bin_wrappers = [ ]
+test_dependencies = [ ]
+
+git = executable('git',
+ sources: builtin_sources + 'git.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+bin_wrappers += git
+
+test_dependencies += executable('git-daemon',
+ sources: 'daemon.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+test_dependencies += executable('git-sh-i18n--envsubst',
+ sources: 'sh-i18n--envsubst.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+bin_wrappers += executable('git-shell',
+ sources: 'shell.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+test_dependencies += executable('git-http-backend',
+ sources: 'http-backend.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+bin_wrappers += executable('scalar',
+ sources: 'scalar.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+if get_option('curl').enabled()
+ curl_sources = [
+ 'http.c',
+ 'http-walker.c',
+ ]
+
+ git_remote_http = executable('git-remote-http',
+ sources: curl_sources + 'remote-curl.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+ test_dependencies += git_remote_http
+
+ test_dependencies += executable('git-http-fetch',
+ sources: curl_sources + 'http-fetch.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+
+ if expat.found()
+ test_dependencies += executable('git-http-push',
+ sources: curl_sources + 'http-push.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+ endif
+
+ 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, common_main],
+ )
+
+ install_symlink(alias + executable_suffix,
+ install_dir: get_option('libexecdir') / 'git-core',
+ pointing_to: 'git-remote-http',
+ )
+ endforeach
+endif
+
+imap_send_sources = ['imap-send.c']
+if use_curl_for_imap_send
+ imap_send_sources += curl_sources
+endif
+
+test_dependencies += executable('git-imap-send',
+ sources: imap_send_sources,
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+foreach alias : [ 'git-receive-pack', 'git-upload-archive', 'git-upload-pack' ]
+ bin_wrappers += executable(alias,
+ objects: git.extract_all_objects(recursive: false),
+ dependencies: [libgit, common_main],
+ )
+
+ install_symlink(alias + executable_suffix,
+ install_dir: get_option('libexecdir') / 'git-core',
+ pointing_to: 'git-remote-http',
+ )
+endforeach
+
+foreach symlink : [
+ 'git',
+ 'git-receive-pack',
+ 'git-shell',
+ 'git-upload-archive',
+ 'git-upload-pack',
+ 'scalar',
+]
+ install_symlink(symlink,
+ install_dir: get_option('bindir'),
+ pointing_to: fs.relative_to(get_option('libexecdir') / 'git-core' / symlink, get_option('bindir')),
+ )
+endforeach
+
+scripts_sh = [
+ 'git-difftool--helper.sh',
+ 'git-filter-branch.sh',
+ 'git-merge-octopus.sh',
+ 'git-merge-one-file.sh',
+ 'git-merge-resolve.sh',
+ 'git-mergetool--lib.sh',
+ 'git-mergetool.sh',
+ 'git-quiltimport.sh',
+ 'git-request-pull.sh',
+ 'git-sh-i18n.sh',
+ 'git-sh-setup.sh',
+ 'git-submodule.sh',
+ 'git-web--browse.sh',
+]
+if perl_features_enabled
+ scripts_sh += 'git-instaweb.sh'
+endif
+
+foreach script : scripts_sh
+ test_dependencies += custom_target(
+ input: script,
+ output: fs.stem(script),
+ command: [
+ shell,
+ meson.project_source_root() / 'generate-script.sh',
+ '@INPUT@',
+ '@OUTPUT@',
+ meson.project_build_root() / 'GIT-BUILD-OPTIONS',
+ ],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+endforeach
+
+if perl_features_enabled
+ scripts_perl = [
+ 'git-archimport.perl',
+ 'git-cvsexportcommit.perl',
+ 'git-cvsimport.perl',
+ 'git-cvsserver.perl',
+ 'git-send-email.perl',
+ 'git-svn.perl',
+ ]
+
+ pathsep = ':'
+ if host_machine.system() == 'windows'
+ pathsep = ';'
+ endif
+
+ perl_header_template = 'perl/header_templates/fixed_prefix.template.pl'
+ if get_option('runtime_prefix')
+ perl_header_template = 'perl/header_templates/runtime_prefix.template.pl'
+ endif
+
+ perl_header = configure_file(
+ input: perl_header_template,
+ output: 'GIT-PERL-HEADER',
+ configuration: {
+ 'GITEXECDIR_REL': get_option('libexecdir') / 'git-core',
+ 'PERLLIBDIR_REL': get_option('datadir') / 'perl5',
+ 'LOCALEDIR_REL': get_option('datadir') / 'locale',
+ 'INSTLIBDIR': get_option('datadir') / 'perl5',
+ 'PATHSEP': pathsep,
+ },
+ )
+
+ generate_perl_command = [
+ shell,
+ meson.project_source_root() / 'generate-perl.sh',
+ meson.project_build_root() / 'GIT-BUILD-OPTIONS',
+ git_version_file.full_path(),
+ perl_header,
+ '@INPUT@',
+ '@OUTPUT@',
+ ]
+
+ foreach script : scripts_perl
+ generated_script = custom_target(
+ input: script,
+ output: fs.stem(script),
+ command: generate_perl_command,
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ depends: [git_version_file],
+ )
+ test_dependencies += generated_script
+
+ if script == 'git-cvsserver.perl'
+ bin_wrappers += generated_script
+
+ install_symlink(fs.stem(script),
+ install_dir: get_option('bindir'),
+ pointing_to: fs.relative_to(get_option('libexecdir') / 'git-core' / fs.stem(script), get_option('bindir')),
+ )
+ endif
+ endforeach
+
+ subdir('perl')
+endif
+
+if python.found()
+ scripts_python = [
+ 'git-p4.py'
+ ]
+
+ foreach script : scripts_python
+ fs.copyfile(script, fs.stem(script),
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+ endforeach
+endif
+
+mergetools = [
+ 'mergetools/araxis',
+ 'mergetools/bc',
+ 'mergetools/codecompare',
+ 'mergetools/deltawalker',
+ 'mergetools/diffmerge',
+ 'mergetools/diffuse',
+ 'mergetools/ecmerge',
+ 'mergetools/emerge',
+ 'mergetools/examdiff',
+ 'mergetools/guiffy',
+ 'mergetools/gvimdiff',
+ 'mergetools/kdiff3',
+ 'mergetools/kompare',
+ 'mergetools/meld',
+ 'mergetools/nvimdiff',
+ 'mergetools/opendiff',
+ 'mergetools/p4merge',
+ 'mergetools/smerge',
+ 'mergetools/tkdiff',
+ 'mergetools/tortoisemerge',
+ 'mergetools/vimdiff',
+ 'mergetools/vscode',
+ 'mergetools/winmerge',
+ 'mergetools/xxdiff',
+]
+
+foreach mergetool : mergetools
+ install_data(mergetool, install_dir: get_option('libexecdir') / 'git-core' / 'mergetools')
+endforeach
+
+if intl.found()
+ subdir('po')
+endif
+subdir('contrib')
+subdir('gitweb')
+subdir('templates')
+
+# Everything but the bin-wrappers need to come before this target such that we
+# can properly set up test dependencies. The bin-wrappers themselves are set up
+# at configuration time, so these are fine.
+if get_option('tests')
+ subdir('t')
+endif
+
+subdir('bin-wrappers')
+if get_option('docs') != []
+ subdir('Documentation')
+endif
+
+summary({
+ 'curl': curl.found(),
+ 'expat': expat.found(),
+ 'gettext': intl.found(),
+ 'https': https_backend,
+ 'iconv': iconv.found(),
+ 'pcre2': pcre2.found(),
+ 'perl': perl_features_enabled,
+ 'python': python.found(),
+}, section: 'Auto-detected features')
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000000000000000000000000000000000000..32a72139bae870745d9131cc9086a4594826be91
--- /dev/null
+++ b/meson_options.txt
@@ -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')
diff --git a/perl/FromCPAN/Mail/meson.build b/perl/FromCPAN/Mail/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..129cff161c585645c111af0386bafe136258e3db
--- /dev/null
+++ b/perl/FromCPAN/Mail/meson.build
@@ -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',
+)
diff --git a/perl/FromCPAN/meson.build b/perl/FromCPAN/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..4e7ea909df3593fb65facb4bf6a1c42e954d6f70
--- /dev/null
+++ b/perl/FromCPAN/meson.build
@@ -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')
diff --git a/perl/Git/LoadCPAN/Mail/meson.build b/perl/Git/LoadCPAN/Mail/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..7da5b37adb278b4e13f41ea5ebc762bb4d78b64b
--- /dev/null
+++ b/perl/Git/LoadCPAN/Mail/meson.build
@@ -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',
+)
diff --git a/perl/Git/LoadCPAN/meson.build b/perl/Git/LoadCPAN/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..9468c073aeb5ae1980f88b4c7f2c7fe69355ea37
--- /dev/null
+++ b/perl/Git/LoadCPAN/meson.build
@@ -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')
diff --git a/perl/Git/SVN/Memoize/meson.build b/perl/Git/SVN/Memoize/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..515ab3dd926618f6c46b030e1f283d637fdddedf
--- /dev/null
+++ b/perl/Git/SVN/Memoize/meson.build
@@ -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',
+)
diff --git a/perl/Git/SVN/meson.build b/perl/Git/SVN/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..8338531041d8e5cd4e8c2c8a0c3dcfc8b2d23cc9
--- /dev/null
+++ b/perl/Git/SVN/meson.build
@@ -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')
diff --git a/perl/Git/meson.build b/perl/Git/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..259209d7302809b6c1d3249d9d21548515c31c77
--- /dev/null
+++ b/perl/Git/meson.build
@@ -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')
diff --git a/perl/meson.build b/perl/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..c22d6f8a1a3266ded27c43c43c88620f9b4badcf
--- /dev/null
+++ b/perl/meson.build
@@ -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
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..d7154b6395b2bf4a27110aad65aa1f51f979a1e9
--- /dev/null
+++ b/po/meson.build
@@ -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]
diff --git a/subprojects/.gitignore b/subprojects/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..63ea916ef5f30255aef0c0b0b63f37b0e1d99fb2
--- /dev/null
+++ b/subprojects/.gitignore
@@ -0,0 +1 @@
+/*/
diff --git a/subprojects/curl.wrap b/subprojects/curl.wrap
new file mode 100644
index 0000000000000000000000000000000000000000..f7e384b85cf5ee98672e4409e1d30f8f6f0e5735
--- /dev/null
+++ b/subprojects/curl.wrap
@@ -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
diff --git a/subprojects/expat.wrap b/subprojects/expat.wrap
new file mode 100644
index 0000000000000000000000000000000000000000..2e0427dcfd144c22d8c0bfd333e3cf31f14855a7
--- /dev/null
+++ b/subprojects/expat.wrap
@@ -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
diff --git a/subprojects/openssl.wrap b/subprojects/openssl.wrap
new file mode 100644
index 0000000000000000000000000000000000000000..873d55106e9b83c487a88dfbb85eaf73429464d7
--- /dev/null
+++ b/subprojects/openssl.wrap
@@ -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
diff --git a/subprojects/pcre2.wrap b/subprojects/pcre2.wrap
new file mode 100644
index 0000000000000000000000000000000000000000..7e184472543bde1572b9e780ae29318fe01e72bc
--- /dev/null
+++ b/subprojects/pcre2.wrap
@@ -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
diff --git a/subprojects/zlib.wrap b/subprojects/zlib.wrap
new file mode 100644
index 0000000000000000000000000000000000000000..aa14de17740728cecdb7431fb101e55e9b022273
--- /dev/null
+++ b/subprojects/zlib.wrap
@@ -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
diff --git a/t/helper/meson.build b/t/helper/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..5e83884246edc7841738de5085f3255aa1fa3fbe
--- /dev/null
+++ b/t/helper/meson.build
@@ -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
diff --git a/t/meson.build b/t/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..86076b77d2005529f58fb402e86bc95048071342
--- /dev/null
+++ b/t/meson.build
@@ -0,0 +1,1115 @@
+clar_test_suites = [
+ 'unit-tests/ctype.c',
+ 'unit-tests/strvec.c',
+]
+
+clar_sources = [
+ 'unit-tests/clar/clar.c',
+ 'unit-tests/unit-test.c',
+]
+
+clar_decls_h = custom_target(
+ input: clar_test_suites,
+ output: 'clar-decls.h',
+ command : [
+ shell,
+ meson.current_source_dir() + '/unit-tests/generate-clar-decls.sh',
+ '@OUTPUT@',
+ '@INPUT@',
+ ],
+ env: script_environment,
+)
+clar_sources += clar_decls_h
+
+clar_sources += custom_target(
+ input: clar_decls_h,
+ output: 'clar.suite',
+ command : [
+ shell,
+ meson.current_source_dir() + '/unit-tests/generate-clar-suites.sh',
+ '@INPUT@',
+ '@OUTPUT@',
+ ],
+ env: script_environment,
+)
+
+clar_unit_tests = executable('unit-tests',
+ sources: clar_sources + clar_test_suites,
+ dependencies: [libgit, common_main],
+)
+test('unit-tests', clar_unit_tests)
+
+unit_test_programs = [
+ 'unit-tests/t-example-decorate.c',
+ 'unit-tests/t-hash.c',
+ 'unit-tests/t-hashmap.c',
+ 'unit-tests/t-mem-pool.c',
+ 'unit-tests/t-oid-array.c',
+ 'unit-tests/t-oidmap.c',
+ 'unit-tests/t-oidtree.c',
+ 'unit-tests/t-prio-queue.c',
+ 'unit-tests/t-reftable-basics.c',
+ 'unit-tests/t-reftable-block.c',
+ 'unit-tests/t-reftable-merged.c',
+ 'unit-tests/t-reftable-pq.c',
+ 'unit-tests/t-reftable-reader.c',
+ 'unit-tests/t-reftable-readwrite.c',
+ 'unit-tests/t-reftable-record.c',
+ 'unit-tests/t-reftable-stack.c',
+ 'unit-tests/t-reftable-tree.c',
+ 'unit-tests/t-strbuf.c',
+ 'unit-tests/t-strcmp-offset.c',
+ 'unit-tests/t-trailer.c',
+ 'unit-tests/t-urlmatch-normalization.c',
+]
+
+foreach unit_test_program : unit_test_programs
+ unit_test_name = fs.stem(unit_test_program)
+ unit_test = executable(unit_test_name,
+ sources: [
+ 'unit-tests/test-lib.c',
+ 'unit-tests/lib-oid.c',
+ 'unit-tests/lib-reftable.c',
+ unit_test_program,
+ ],
+ dependencies: [libgit, common_main],
+ )
+ test(unit_test_name, unit_test,
+ workdir: meson.current_source_dir(),
+ timeout: 0,
+ )
+endforeach
+
+subdir('helper')
+
+integration_tests = [
+ 't0000-basic.sh',
+ 't0001-init.sh',
+ 't0002-gitfile.sh',
+ 't0003-attributes.sh',
+ 't0004-unwritable.sh',
+ 't0005-signals.sh',
+ 't0006-date.sh',
+ 't0007-git-var.sh',
+ 't0008-ignores.sh',
+ 't0010-racy-git.sh',
+ 't0012-help.sh',
+ 't0013-sha1dc.sh',
+ 't0014-alias.sh',
+ 't0017-env-helper.sh',
+ 't0018-advice.sh',
+ 't0019-json-writer.sh',
+ 't0020-crlf.sh',
+ 't0021-conversion.sh',
+ 't0022-crlf-rename.sh',
+ 't0023-crlf-am.sh',
+ 't0024-crlf-archive.sh',
+ 't0025-crlf-renormalize.sh',
+ 't0026-eol-config.sh',
+ 't0027-auto-crlf.sh',
+ 't0028-working-tree-encoding.sh',
+ 't0029-core-unsetenvvars.sh',
+ 't0030-stripspace.sh',
+ 't0033-safe-directory.sh',
+ 't0034-root-safe-directory.sh',
+ 't0035-safe-bare-repository.sh',
+ 't0040-parse-options.sh',
+ 't0041-usage.sh',
+ 't0050-filesystem.sh',
+ 't0051-windows-named-pipe.sh',
+ 't0052-simple-ipc.sh',
+ 't0055-beyond-symlinks.sh',
+ 't0056-git-C.sh',
+ 't0060-path-utils.sh',
+ 't0061-run-command.sh',
+ 't0062-revision-walking.sh',
+ 't0063-string-list.sh',
+ 't0066-dir-iterator.sh',
+ 't0067-parse_pathspec_file.sh',
+ 't0068-for-each-repo.sh',
+ 't0070-fundamental.sh',
+ 't0071-sort.sh',
+ 't0080-unit-test-output.sh',
+ 't0081-find-pack.sh',
+ 't0090-cache-tree.sh',
+ 't0091-bugreport.sh',
+ 't0092-diagnose.sh',
+ 't0095-bloom.sh',
+ 't0100-previous.sh',
+ 't0101-at-syntax.sh',
+ 't0200-gettext-basic.sh',
+ 't0201-gettext-fallbacks.sh',
+ 't0202-gettext-perl.sh',
+ 't0203-gettext-setlocale-sanity.sh',
+ 't0204-gettext-reencode-sanity.sh',
+ 't0210-trace2-normal.sh',
+ 't0211-trace2-perf.sh',
+ 't0212-trace2-event.sh',
+ 't0300-credentials.sh',
+ 't0301-credential-cache.sh',
+ 't0302-credential-store.sh',
+ 't0303-credential-external.sh',
+ 't0410-partial-clone.sh',
+ 't0411-clone-from-partial.sh',
+ 't0450-txt-doc-vs-help.sh',
+ 't0500-progress-display.sh',
+ 't0600-reffiles-backend.sh',
+ 't0601-reffiles-pack-refs.sh',
+ 't0602-reffiles-fsck.sh',
+ 't0610-reftable-basics.sh',
+ 't0611-reftable-httpd.sh',
+ 't0612-reftable-jgit-compatibility.sh',
+ 't0613-reftable-write-options.sh',
+ 't1000-read-tree-m-3way.sh',
+ 't1001-read-tree-m-2way.sh',
+ 't1002-read-tree-m-u-2way.sh',
+ 't1003-read-tree-prefix.sh',
+ 't1004-read-tree-m-u-wf.sh',
+ 't1005-read-tree-reset.sh',
+ 't1006-cat-file.sh',
+ 't1007-hash-object.sh',
+ 't1008-read-tree-overlay.sh',
+ 't1009-read-tree-new-index.sh',
+ 't1010-mktree.sh',
+ 't1011-read-tree-sparse-checkout.sh',
+ 't1012-read-tree-df.sh',
+ 't1013-read-tree-submodule.sh',
+ 't1014-read-tree-confusing.sh',
+ 't1015-read-index-unmerged.sh',
+ 't1016-compatObjectFormat.sh',
+ 't1020-subdirectory.sh',
+ 't1021-rerere-in-workdir.sh',
+ 't1022-read-tree-partial-clone.sh',
+ 't1050-large.sh',
+ 't1051-large-conversion.sh',
+ 't1060-object-corruption.sh',
+ 't1090-sparse-checkout-scope.sh',
+ 't1091-sparse-checkout-builtin.sh',
+ 't1092-sparse-checkout-compatibility.sh',
+ 't1100-commit-tree-options.sh',
+ 't1300-config.sh',
+ 't1301-shared-repo.sh',
+ 't1302-repo-version.sh',
+ 't1303-wacky-config.sh',
+ 't1304-default-acl.sh',
+ 't1305-config-include.sh',
+ 't1306-xdg-files.sh',
+ 't1307-config-blob.sh',
+ 't1308-config-set.sh',
+ 't1309-early-config.sh',
+ 't1310-config-default.sh',
+ 't1350-config-hooks-path.sh',
+ 't1400-update-ref.sh',
+ 't1401-symbolic-ref.sh',
+ 't1402-check-ref-format.sh',
+ 't1403-show-ref.sh',
+ 't1404-update-ref-errors.sh',
+ 't1405-main-ref-store.sh',
+ 't1406-submodule-ref-store.sh',
+ 't1407-worktree-ref-store.sh',
+ 't1408-packed-refs.sh',
+ 't1409-avoid-packing-refs.sh',
+ 't1410-reflog.sh',
+ 't1411-reflog-show.sh',
+ 't1412-reflog-loop.sh',
+ 't1413-reflog-detach.sh',
+ 't1414-reflog-walk.sh',
+ 't1415-worktree-refs.sh',
+ 't1416-ref-transaction-hooks.sh',
+ 't1417-reflog-updateref.sh',
+ 't1418-reflog-exists.sh',
+ 't1419-exclude-refs.sh',
+ 't1420-lost-found.sh',
+ 't1430-bad-ref-name.sh',
+ 't1450-fsck.sh',
+ 't1451-fsck-buffer.sh',
+ 't1460-refs-migrate.sh',
+ 't1500-rev-parse.sh',
+ 't1501-work-tree.sh',
+ 't1502-rev-parse-parseopt.sh',
+ 't1503-rev-parse-verify.sh',
+ 't1504-ceiling-dirs.sh',
+ 't1505-rev-parse-last.sh',
+ 't1506-rev-parse-diagnosis.sh',
+ 't1507-rev-parse-upstream.sh',
+ 't1508-at-combinations.sh',
+ 't1509-root-work-tree.sh',
+ 't1510-repo-setup.sh',
+ 't1511-rev-parse-caret.sh',
+ 't1512-rev-parse-disambiguation.sh',
+ 't1513-rev-parse-prefix.sh',
+ 't1514-rev-parse-push.sh',
+ 't1515-rev-parse-outside-repo.sh',
+ 't1517-outside-repo.sh',
+ 't1600-index.sh',
+ 't1601-index-bogus.sh',
+ 't1700-split-index.sh',
+ 't1701-racy-split-index.sh',
+ 't1800-hook.sh',
+ 't2000-conflict-when-checking-files-out.sh',
+ 't2002-checkout-cache-u.sh',
+ 't2003-checkout-cache-mkdir.sh',
+ 't2004-checkout-cache-temp.sh',
+ 't2005-checkout-index-symlinks.sh',
+ 't2006-checkout-index-basic.sh',
+ 't2007-checkout-symlink.sh',
+ 't2008-checkout-subdir.sh',
+ 't2009-checkout-statinfo.sh',
+ 't2010-checkout-ambiguous.sh',
+ 't2011-checkout-invalid-head.sh',
+ 't2012-checkout-last.sh',
+ 't2013-checkout-submodule.sh',
+ 't2014-checkout-switch.sh',
+ 't2015-checkout-unborn.sh',
+ 't2016-checkout-patch.sh',
+ 't2017-checkout-orphan.sh',
+ 't2018-checkout-branch.sh',
+ 't2019-checkout-ambiguous-ref.sh',
+ 't2020-checkout-detach.sh',
+ 't2021-checkout-overwrite.sh',
+ 't2022-checkout-paths.sh',
+ 't2023-checkout-m.sh',
+ 't2024-checkout-dwim.sh',
+ 't2025-checkout-no-overlay.sh',
+ 't2026-checkout-pathspec-file.sh',
+ 't2027-checkout-track.sh',
+ 't2030-unresolve-info.sh',
+ 't2050-git-dir-relative.sh',
+ 't2060-switch.sh',
+ 't2070-restore.sh',
+ 't2071-restore-patch.sh',
+ 't2072-restore-pathspec-file.sh',
+ 't2080-parallel-checkout-basics.sh',
+ 't2081-parallel-checkout-collisions.sh',
+ 't2082-parallel-checkout-attributes.sh',
+ 't2100-update-cache-badpath.sh',
+ 't2101-update-index-reupdate.sh',
+ 't2102-update-index-symlinks.sh',
+ 't2103-update-index-ignore-missing.sh',
+ 't2104-update-index-skip-worktree.sh',
+ 't2105-update-index-gitfile.sh',
+ 't2106-update-index-assume-unchanged.sh',
+ 't2107-update-index-basic.sh',
+ 't2108-update-index-refresh-racy.sh',
+ 't2200-add-update.sh',
+ 't2201-add-update-typechange.sh',
+ 't2202-add-addremove.sh',
+ 't2203-add-intent.sh',
+ 't2204-add-ignored.sh',
+ 't2205-add-worktree-config.sh',
+ 't2300-cd-to-toplevel.sh',
+ 't2400-worktree-add.sh',
+ 't2401-worktree-prune.sh',
+ 't2402-worktree-list.sh',
+ 't2403-worktree-move.sh',
+ 't2404-worktree-config.sh',
+ 't2405-worktree-submodule.sh',
+ 't2406-worktree-repair.sh',
+ 't2407-worktree-heads.sh',
+ 't2408-worktree-relative.sh',
+ 't2500-untracked-overwriting.sh',
+ 't2501-cwd-empty.sh',
+ 't3000-ls-files-others.sh',
+ 't3001-ls-files-others-exclude.sh',
+ 't3002-ls-files-dashpath.sh',
+ 't3003-ls-files-exclude.sh',
+ 't3004-ls-files-basic.sh',
+ 't3005-ls-files-relative.sh',
+ 't3006-ls-files-long.sh',
+ 't3007-ls-files-recurse-submodules.sh',
+ 't3008-ls-files-lazy-init-name-hash.sh',
+ 't3009-ls-files-others-nonsubmodule.sh',
+ 't3010-ls-files-killed-modified.sh',
+ 't3011-common-prefixes-and-directory-traversal.sh',
+ 't3012-ls-files-dedup.sh',
+ 't3013-ls-files-format.sh',
+ 't3020-ls-files-error-unmatch.sh',
+ 't3040-subprojects-basic.sh',
+ 't3050-subprojects-fetch.sh',
+ 't3060-ls-files-with-tree.sh',
+ 't3070-wildmatch.sh',
+ 't3100-ls-tree-restrict.sh',
+ 't3101-ls-tree-dirname.sh',
+ 't3102-ls-tree-wildcards.sh',
+ 't3103-ls-tree-misc.sh',
+ 't3104-ls-tree-format.sh',
+ 't3105-ls-tree-output.sh',
+ 't3200-branch.sh',
+ 't3201-branch-contains.sh',
+ 't3202-show-branch.sh',
+ 't3203-branch-output.sh',
+ 't3204-branch-name-interpretation.sh',
+ 't3205-branch-color.sh',
+ 't3206-range-diff.sh',
+ 't3207-branch-submodule.sh',
+ 't3211-peel-ref.sh',
+ 't3300-funny-names.sh',
+ 't3301-notes.sh',
+ 't3302-notes-index-expensive.sh',
+ 't3303-notes-subtrees.sh',
+ 't3304-notes-mixed.sh',
+ 't3305-notes-fanout.sh',
+ 't3306-notes-prune.sh',
+ 't3307-notes-man.sh',
+ 't3308-notes-merge.sh',
+ 't3309-notes-merge-auto-resolve.sh',
+ 't3310-notes-merge-manual-resolve.sh',
+ 't3311-notes-merge-fanout.sh',
+ 't3320-notes-merge-worktrees.sh',
+ 't3321-notes-stripspace.sh',
+ 't3400-rebase.sh',
+ 't3401-rebase-and-am-rename.sh',
+ 't3402-rebase-merge.sh',
+ 't3403-rebase-skip.sh',
+ 't3404-rebase-interactive.sh',
+ 't3405-rebase-malformed.sh',
+ 't3406-rebase-message.sh',
+ 't3407-rebase-abort.sh',
+ 't3408-rebase-multi-line.sh',
+ 't3409-rebase-environ.sh',
+ 't3412-rebase-root.sh',
+ 't3413-rebase-hook.sh',
+ 't3415-rebase-autosquash.sh',
+ 't3416-rebase-onto-threedots.sh',
+ 't3417-rebase-whitespace-fix.sh',
+ 't3418-rebase-continue.sh',
+ 't3419-rebase-patch-id.sh',
+ 't3420-rebase-autostash.sh',
+ 't3421-rebase-topology-linear.sh',
+ 't3422-rebase-incompatible-options.sh',
+ 't3423-rebase-reword.sh',
+ 't3424-rebase-empty.sh',
+ 't3425-rebase-topology-merges.sh',
+ 't3426-rebase-submodule.sh',
+ 't3427-rebase-subtree.sh',
+ 't3428-rebase-signoff.sh',
+ 't3429-rebase-edit-todo.sh',
+ 't3430-rebase-merges.sh',
+ 't3431-rebase-fork-point.sh',
+ 't3432-rebase-fast-forward.sh',
+ 't3433-rebase-across-mode-change.sh',
+ 't3434-rebase-i18n.sh',
+ 't3435-rebase-gpg-sign.sh',
+ 't3436-rebase-more-options.sh',
+ 't3437-rebase-fixup-options.sh',
+ 't3438-rebase-broken-files.sh',
+ 't3500-cherry.sh',
+ 't3501-revert-cherry-pick.sh',
+ 't3502-cherry-pick-merge.sh',
+ 't3503-cherry-pick-root.sh',
+ 't3504-cherry-pick-rerere.sh',
+ 't3505-cherry-pick-empty.sh',
+ 't3506-cherry-pick-ff.sh',
+ 't3507-cherry-pick-conflict.sh',
+ 't3508-cherry-pick-many-commits.sh',
+ 't3509-cherry-pick-merge-df.sh',
+ 't3510-cherry-pick-sequence.sh',
+ 't3511-cherry-pick-x.sh',
+ 't3512-cherry-pick-submodule.sh',
+ 't3513-revert-submodule.sh',
+ 't3514-cherry-pick-revert-gpg.sh',
+ 't3600-rm.sh',
+ 't3601-rm-pathspec-file.sh',
+ 't3602-rm-sparse-checkout.sh',
+ 't3650-replay-basics.sh',
+ 't3700-add.sh',
+ 't3701-add-interactive.sh',
+ 't3702-add-edit.sh',
+ 't3703-add-magic-pathspec.sh',
+ 't3704-add-pathspec-file.sh',
+ 't3705-add-sparse-checkout.sh',
+ 't3800-mktag.sh',
+ 't3900-i18n-commit.sh',
+ 't3901-i18n-patch.sh',
+ 't3902-quoted.sh',
+ 't3903-stash.sh',
+ 't3904-stash-patch.sh',
+ 't3905-stash-include-untracked.sh',
+ 't3906-stash-submodule.sh',
+ 't3907-stash-show-config.sh',
+ 't3908-stash-in-worktree.sh',
+ 't3909-stash-pathspec-file.sh',
+ 't3910-mac-os-precompose.sh',
+ 't3920-crlf-messages.sh',
+ 't4000-diff-format.sh',
+ 't4001-diff-rename.sh',
+ 't4002-diff-basic.sh',
+ 't4003-diff-rename-1.sh',
+ 't4004-diff-rename-symlink.sh',
+ 't4005-diff-rename-2.sh',
+ 't4006-diff-mode.sh',
+ 't4007-rename-3.sh',
+ 't4008-diff-break-rewrite.sh',
+ 't4009-diff-rename-4.sh',
+ 't4010-diff-pathspec.sh',
+ 't4011-diff-symlink.sh',
+ 't4012-diff-binary.sh',
+ 't4013-diff-various.sh',
+ 't4014-format-patch.sh',
+ 't4015-diff-whitespace.sh',
+ 't4016-diff-quote.sh',
+ 't4017-diff-retval.sh',
+ 't4018-diff-funcname.sh',
+ 't4019-diff-wserror.sh',
+ 't4020-diff-external.sh',
+ 't4021-format-patch-numbered.sh',
+ 't4022-diff-rewrite.sh',
+ 't4023-diff-rename-typechange.sh',
+ 't4024-diff-optimize-common.sh',
+ 't4025-hunk-header.sh',
+ 't4026-color.sh',
+ 't4027-diff-submodule.sh',
+ 't4028-format-patch-mime-headers.sh',
+ 't4029-diff-trailing-space.sh',
+ 't4030-diff-textconv.sh',
+ 't4031-diff-rewrite-binary.sh',
+ 't4032-diff-inter-hunk-context.sh',
+ 't4033-diff-patience.sh',
+ 't4034-diff-words.sh',
+ 't4035-diff-quiet.sh',
+ 't4036-format-patch-signer-mime.sh',
+ 't4037-diff-r-t-dirs.sh',
+ 't4038-diff-combined.sh',
+ 't4039-diff-assume-unchanged.sh',
+ 't4040-whitespace-status.sh',
+ 't4041-diff-submodule-option.sh',
+ 't4042-diff-textconv-caching.sh',
+ 't4043-diff-rename-binary.sh',
+ 't4044-diff-index-unique-abbrev.sh',
+ 't4045-diff-relative.sh',
+ 't4046-diff-unmerged.sh',
+ 't4047-diff-dirstat.sh',
+ 't4048-diff-combined-binary.sh',
+ 't4049-diff-stat-count.sh',
+ 't4050-diff-histogram.sh',
+ 't4051-diff-function-context.sh',
+ 't4052-stat-output.sh',
+ 't4053-diff-no-index.sh',
+ 't4054-diff-bogus-tree.sh',
+ 't4055-diff-context.sh',
+ 't4056-diff-order.sh',
+ 't4057-diff-combined-paths.sh',
+ 't4058-diff-duplicates.sh',
+ 't4059-diff-submodule-not-initialized.sh',
+ 't4060-diff-submodule-option-diff-format.sh',
+ 't4061-diff-indent.sh',
+ 't4062-diff-pickaxe.sh',
+ 't4063-diff-blobs.sh',
+ 't4064-diff-oidfind.sh',
+ 't4065-diff-anchored.sh',
+ 't4066-diff-emit-delay.sh',
+ 't4067-diff-partial-clone.sh',
+ 't4068-diff-symmetric-merge-base.sh',
+ 't4069-remerge-diff.sh',
+ 't4100-apply-stat.sh',
+ 't4101-apply-nonl.sh',
+ 't4102-apply-rename.sh',
+ 't4103-apply-binary.sh',
+ 't4104-apply-boundary.sh',
+ 't4105-apply-fuzz.sh',
+ 't4106-apply-stdin.sh',
+ 't4107-apply-ignore-whitespace.sh',
+ 't4108-apply-threeway.sh',
+ 't4109-apply-multifrag.sh',
+ 't4110-apply-scan.sh',
+ 't4111-apply-subdir.sh',
+ 't4112-apply-renames.sh',
+ 't4113-apply-ending.sh',
+ 't4114-apply-typechange.sh',
+ 't4115-apply-symlink.sh',
+ 't4116-apply-reverse.sh',
+ 't4117-apply-reject.sh',
+ 't4118-apply-empty-context.sh',
+ 't4119-apply-config.sh',
+ 't4120-apply-popt.sh',
+ 't4121-apply-diffs.sh',
+ 't4122-apply-symlink-inside.sh',
+ 't4123-apply-shrink.sh',
+ 't4124-apply-ws-rule.sh',
+ 't4125-apply-ws-fuzz.sh',
+ 't4126-apply-empty.sh',
+ 't4127-apply-same-fn.sh',
+ 't4128-apply-root.sh',
+ 't4129-apply-samemode.sh',
+ 't4130-apply-criss-cross-rename.sh',
+ 't4131-apply-fake-ancestor.sh',
+ 't4132-apply-removal.sh',
+ 't4133-apply-filenames.sh',
+ 't4134-apply-submodule.sh',
+ 't4135-apply-weird-filenames.sh',
+ 't4136-apply-check.sh',
+ 't4137-apply-submodule.sh',
+ 't4138-apply-ws-expansion.sh',
+ 't4139-apply-escape.sh',
+ 't4140-apply-ita.sh',
+ 't4141-apply-too-large.sh',
+ 't4150-am.sh',
+ 't4151-am-abort.sh',
+ 't4152-am-subjects.sh',
+ 't4153-am-resume-override-opts.sh',
+ 't4200-rerere.sh',
+ 't4201-shortlog.sh',
+ 't4202-log.sh',
+ 't4203-mailmap.sh',
+ 't4204-patch-id.sh',
+ 't4205-log-pretty-formats.sh',
+ 't4206-log-follow-harder-copies.sh',
+ 't4207-log-decoration-colors.sh',
+ 't4208-log-magic-pathspec.sh',
+ 't4209-log-pickaxe.sh',
+ 't4210-log-i18n.sh',
+ 't4211-line-log.sh',
+ 't4212-log-corrupt.sh',
+ 't4213-log-tabexpand.sh',
+ 't4214-log-graph-octopus.sh',
+ 't4215-log-skewed-merges.sh',
+ 't4216-log-bloom.sh',
+ 't4217-log-limit.sh',
+ 't4252-am-options.sh',
+ 't4253-am-keep-cr-dos.sh',
+ 't4254-am-corrupt.sh',
+ 't4255-am-submodule.sh',
+ 't4256-am-format-flowed.sh',
+ 't4257-am-interactive.sh',
+ 't4258-am-quoted-cr.sh',
+ 't4300-merge-tree.sh',
+ 't4301-merge-tree-write-tree.sh',
+ 't5000-tar-tree.sh',
+ 't5001-archive-attr.sh',
+ 't5002-archive-attr-pattern.sh',
+ 't5003-archive-zip.sh',
+ 't5004-archive-corner-cases.sh',
+ 't5100-mailinfo.sh',
+ 't5150-request-pull.sh',
+ 't5200-update-server-info.sh',
+ 't5300-pack-object.sh',
+ 't5301-sliding-window.sh',
+ 't5302-pack-index.sh',
+ 't5303-pack-corruption-resilience.sh',
+ 't5304-prune.sh',
+ 't5305-include-tag.sh',
+ 't5306-pack-nobase.sh',
+ 't5307-pack-missing-commit.sh',
+ 't5308-pack-detect-duplicates.sh',
+ 't5309-pack-delta-cycles.sh',
+ 't5310-pack-bitmaps.sh',
+ 't5311-pack-bitmaps-shallow.sh',
+ 't5312-prune-corruption.sh',
+ 't5313-pack-bounds-checks.sh',
+ 't5314-pack-cycle-detection.sh',
+ 't5315-pack-objects-compression.sh',
+ 't5316-pack-delta-depth.sh',
+ 't5317-pack-objects-filter-objects.sh',
+ 't5318-commit-graph.sh',
+ 't5319-multi-pack-index.sh',
+ 't5320-delta-islands.sh',
+ 't5321-pack-large-objects.sh',
+ 't5322-pack-objects-sparse.sh',
+ 't5323-pack-redundant.sh',
+ 't5324-split-commit-graph.sh',
+ 't5325-reverse-index.sh',
+ 't5326-multi-pack-bitmaps.sh',
+ 't5327-multi-pack-bitmaps-rev.sh',
+ 't5328-commit-graph-64bit-time.sh',
+ 't5329-pack-objects-cruft.sh',
+ 't5330-no-lazy-fetch-with-commit-graph.sh',
+ 't5331-pack-objects-stdin.sh',
+ 't5332-multi-pack-reuse.sh',
+ 't5333-pseudo-merge-bitmaps.sh',
+ 't5334-incremental-multi-pack-index.sh',
+ 't5351-unpack-large-objects.sh',
+ 't5400-send-pack.sh',
+ 't5401-update-hooks.sh',
+ 't5402-post-merge-hook.sh',
+ 't5403-post-checkout-hook.sh',
+ 't5404-tracking-branches.sh',
+ 't5405-send-pack-rewind.sh',
+ 't5406-remote-rejects.sh',
+ 't5407-post-rewrite-hook.sh',
+ 't5408-send-pack-stdin.sh',
+ 't5409-colorize-remote-messages.sh',
+ 't5410-receive-pack-alternates.sh',
+ 't5411-proc-receive-hook.sh',
+ 't5500-fetch-pack.sh',
+ 't5501-fetch-push-alternates.sh',
+ 't5502-quickfetch.sh',
+ 't5503-tagfollow.sh',
+ 't5504-fetch-receive-strict.sh',
+ 't5505-remote.sh',
+ 't5506-remote-groups.sh',
+ 't5507-remote-environment.sh',
+ 't5509-fetch-push-namespaces.sh',
+ 't5510-fetch.sh',
+ 't5511-refspec.sh',
+ 't5512-ls-remote.sh',
+ 't5513-fetch-track.sh',
+ 't5514-fetch-multiple.sh',
+ 't5515-fetch-merge-logic.sh',
+ 't5516-fetch-push.sh',
+ 't5517-push-mirror.sh',
+ 't5518-fetch-exit-status.sh',
+ 't5519-push-alternates.sh',
+ 't5520-pull.sh',
+ 't5521-pull-options.sh',
+ 't5522-pull-symlink.sh',
+ 't5523-push-upstream.sh',
+ 't5524-pull-msg.sh',
+ 't5525-fetch-tagopt.sh',
+ 't5526-fetch-submodules.sh',
+ 't5527-fetch-odd-refs.sh',
+ 't5528-push-default.sh',
+ 't5529-push-errors.sh',
+ 't5530-upload-pack-error.sh',
+ 't5531-deep-submodule-push.sh',
+ 't5532-fetch-proxy.sh',
+ 't5533-push-cas.sh',
+ 't5534-push-signed.sh',
+ 't5535-fetch-push-symref.sh',
+ 't5536-fetch-conflicts.sh',
+ 't5537-fetch-shallow.sh',
+ 't5538-push-shallow.sh',
+ 't5539-fetch-http-shallow.sh',
+ 't5540-http-push-webdav.sh',
+ 't5541-http-push-smart.sh',
+ 't5542-push-http-shallow.sh',
+ 't5543-atomic-push.sh',
+ 't5544-pack-objects-hook.sh',
+ 't5545-push-options.sh',
+ 't5546-receive-limits.sh',
+ 't5547-push-quarantine.sh',
+ 't5548-push-porcelain.sh',
+ 't5549-fetch-push-http.sh',
+ 't5550-http-fetch-dumb.sh',
+ 't5551-http-fetch-smart.sh',
+ 't5552-skipping-fetch-negotiator.sh',
+ 't5553-set-upstream.sh',
+ 't5554-noop-fetch-negotiator.sh',
+ 't5555-http-smart-common.sh',
+ 't5557-http-get.sh',
+ 't5558-clone-bundle-uri.sh',
+ 't5559-http-fetch-smart-http2.sh',
+ 't5560-http-backend-noserver.sh',
+ 't5561-http-backend.sh',
+ 't5562-http-backend-content-length.sh',
+ 't5563-simple-http-auth.sh',
+ 't5564-http-proxy.sh',
+ 't5570-git-daemon.sh',
+ 't5571-pre-push-hook.sh',
+ 't5572-pull-submodule.sh',
+ 't5573-pull-verify-signatures.sh',
+ 't5574-fetch-output.sh',
+ 't5580-unc-paths.sh',
+ 't5581-http-curl-verbose.sh',
+ 't5582-fetch-negative-refspec.sh',
+ 't5583-push-branches.sh',
+ 't5600-clone-fail-cleanup.sh',
+ 't5601-clone.sh',
+ 't5602-clone-remote-exec.sh',
+ 't5603-clone-dirname.sh',
+ 't5604-clone-reference.sh',
+ 't5605-clone-local.sh',
+ 't5606-clone-options.sh',
+ 't5607-clone-bundle.sh',
+ 't5608-clone-2gb.sh',
+ 't5609-clone-branch.sh',
+ 't5610-clone-detached.sh',
+ 't5611-clone-config.sh',
+ 't5612-clone-refspec.sh',
+ 't5613-info-alternate.sh',
+ 't5614-clone-submodules-shallow.sh',
+ 't5615-alternate-env.sh',
+ 't5616-partial-clone.sh',
+ 't5617-clone-submodules-remote.sh',
+ 't5618-alternate-refs.sh',
+ 't5619-clone-local-ambiguous-transport.sh',
+ 't5700-protocol-v1.sh',
+ 't5701-git-serve.sh',
+ 't5702-protocol-v2.sh',
+ 't5703-upload-pack-ref-in-want.sh',
+ 't5704-protocol-violations.sh',
+ 't5705-session-id-in-capabilities.sh',
+ 't5730-protocol-v2-bundle-uri-file.sh',
+ 't5731-protocol-v2-bundle-uri-git.sh',
+ 't5732-protocol-v2-bundle-uri-http.sh',
+ 't5750-bundle-uri-parse.sh',
+ 't5801-remote-helpers.sh',
+ 't5802-connect-helper.sh',
+ 't5810-proto-disable-local.sh',
+ 't5811-proto-disable-git.sh',
+ 't5812-proto-disable-http.sh',
+ 't5813-proto-disable-ssh.sh',
+ 't5814-proto-disable-ext.sh',
+ 't5815-submodule-protos.sh',
+ 't5900-repo-selection.sh',
+ 't6000-rev-list-misc.sh',
+ 't6001-rev-list-graft.sh',
+ 't6002-rev-list-bisect.sh',
+ 't6003-rev-list-topo-order.sh',
+ 't6004-rev-list-path-optim.sh',
+ 't6005-rev-list-count.sh',
+ 't6006-rev-list-format.sh',
+ 't6007-rev-list-cherry-pick-file.sh',
+ 't6008-rev-list-submodule.sh',
+ 't6009-rev-list-parent.sh',
+ 't6010-merge-base.sh',
+ 't6011-rev-list-with-bad-commit.sh',
+ 't6012-rev-list-simplify.sh',
+ 't6013-rev-list-reverse-parents.sh',
+ 't6014-rev-list-all.sh',
+ 't6016-rev-list-graph-simplify-history.sh',
+ 't6017-rev-list-stdin.sh',
+ 't6018-rev-list-glob.sh',
+ 't6019-rev-list-ancestry-path.sh',
+ 't6020-bundle-misc.sh',
+ 't6021-rev-list-exclude-hidden.sh',
+ 't6022-rev-list-missing.sh',
+ 't6030-bisect-porcelain.sh',
+ 't6040-tracking-info.sh',
+ 't6041-bisect-submodule.sh',
+ 't6050-replace.sh',
+ 't6060-merge-index.sh',
+ 't6100-rev-list-in-order.sh',
+ 't6101-rev-parse-parents.sh',
+ 't6102-rev-list-unexpected-objects.sh',
+ 't6110-rev-list-sparse.sh',
+ 't6111-rev-list-treesame.sh',
+ 't6112-rev-list-filters-objects.sh',
+ 't6113-rev-list-bitmap-filters.sh',
+ 't6114-keep-packs.sh',
+ 't6115-rev-list-du.sh',
+ 't6120-describe.sh',
+ 't6130-pathspec-noglob.sh',
+ 't6131-pathspec-icase.sh',
+ 't6132-pathspec-exclude.sh',
+ 't6133-pathspec-rev-dwim.sh',
+ 't6134-pathspec-in-submodule.sh',
+ 't6135-pathspec-with-attrs.sh',
+ 't6136-pathspec-in-bare.sh',
+ 't6200-fmt-merge-msg.sh',
+ 't6300-for-each-ref.sh',
+ 't6301-for-each-ref-errors.sh',
+ 't6302-for-each-ref-filter.sh',
+ 't6400-merge-df.sh',
+ 't6401-merge-criss-cross.sh',
+ 't6402-merge-rename.sh',
+ 't6403-merge-file.sh',
+ 't6404-recursive-merge.sh',
+ 't6405-merge-symlinks.sh',
+ 't6406-merge-attr.sh',
+ 't6407-merge-binary.sh',
+ 't6408-merge-up-to-date.sh',
+ 't6409-merge-subtree.sh',
+ 't6411-merge-filemode.sh',
+ 't6412-merge-large-rename.sh',
+ 't6413-merge-crlf.sh',
+ 't6414-merge-rename-nocruft.sh',
+ 't6415-merge-dir-to-symlink.sh',
+ 't6416-recursive-corner-cases.sh',
+ 't6417-merge-ours-theirs.sh',
+ 't6418-merge-text-auto.sh',
+ 't6419-merge-ignorecase.sh',
+ 't6421-merge-partial-clone.sh',
+ 't6422-merge-rename-corner-cases.sh',
+ 't6423-merge-rename-directories.sh',
+ 't6424-merge-unrelated-index-changes.sh',
+ 't6425-merge-rename-delete.sh',
+ 't6426-merge-skip-unneeded-updates.sh',
+ 't6427-diff3-conflict-markers.sh',
+ 't6428-merge-conflicts-sparse.sh',
+ 't6429-merge-sequence-rename-caching.sh',
+ 't6430-merge-recursive.sh',
+ 't6431-merge-criscross.sh',
+ 't6432-merge-recursive-space-options.sh',
+ 't6433-merge-toplevel.sh',
+ 't6434-merge-recursive-rename-options.sh',
+ 't6435-merge-sparse.sh',
+ 't6436-merge-overwrite.sh',
+ 't6437-submodule-merge.sh',
+ 't6438-submodule-directory-file-conflicts.sh',
+ 't6439-merge-co-error-msgs.sh',
+ 't6500-gc.sh',
+ 't6501-freshen-objects.sh',
+ 't6600-test-reach.sh',
+ 't6700-tree-depth.sh',
+ 't7001-mv.sh',
+ 't7002-mv-sparse-checkout.sh',
+ 't7003-filter-branch.sh',
+ 't7004-tag.sh',
+ 't7005-editor.sh',
+ 't7006-pager.sh',
+ 't7007-show.sh',
+ 't7008-filter-branch-null-sha1.sh',
+ 't7010-setup.sh',
+ 't7011-skip-worktree-reading.sh',
+ 't7012-skip-worktree-writing.sh',
+ 't7030-verify-tag.sh',
+ 't7031-verify-tag-signed-ssh.sh',
+ 't7060-wtstatus.sh',
+ 't7061-wtstatus-ignore.sh',
+ 't7062-wtstatus-ignorecase.sh',
+ 't7063-status-untracked-cache.sh',
+ 't7064-wtstatus-pv2.sh',
+ 't7101-reset-empty-subdirs.sh',
+ 't7102-reset.sh',
+ 't7103-reset-bare.sh',
+ 't7104-reset-hard.sh',
+ 't7105-reset-patch.sh',
+ 't7106-reset-unborn-branch.sh',
+ 't7107-reset-pathspec-file.sh',
+ 't7110-reset-merge.sh',
+ 't7111-reset-table.sh',
+ 't7112-reset-submodule.sh',
+ 't7113-post-index-change-hook.sh',
+ 't7201-co.sh',
+ 't7300-clean.sh',
+ 't7301-clean-interactive.sh',
+ 't7400-submodule-basic.sh',
+ 't7401-submodule-summary.sh',
+ 't7402-submodule-rebase.sh',
+ 't7403-submodule-sync.sh',
+ 't7406-submodule-update.sh',
+ 't7407-submodule-foreach.sh',
+ 't7408-submodule-reference.sh',
+ 't7409-submodule-detached-work-tree.sh',
+ 't7411-submodule-config.sh',
+ 't7412-submodule-absorbgitdirs.sh',
+ 't7413-submodule-is-active.sh',
+ 't7414-submodule-mistakes.sh',
+ 't7416-submodule-dash-url.sh',
+ 't7417-submodule-path-url.sh',
+ 't7418-submodule-sparse-gitmodules.sh',
+ 't7419-submodule-set-branch.sh',
+ 't7420-submodule-set-url.sh',
+ 't7421-submodule-summary-add.sh',
+ 't7422-submodule-output.sh',
+ 't7423-submodule-symlinks.sh',
+ 't7424-submodule-mixed-ref-formats.sh',
+ 't7450-bad-git-dotfiles.sh',
+ 't7500-commit-template-squash-signoff.sh',
+ 't7501-commit-basic-functionality.sh',
+ 't7502-commit-porcelain.sh',
+ 't7503-pre-commit-and-pre-merge-commit-hooks.sh',
+ 't7504-commit-msg-hook.sh',
+ 't7505-prepare-commit-msg-hook.sh',
+ 't7506-status-submodule.sh',
+ 't7507-commit-verbose.sh',
+ 't7508-status.sh',
+ 't7509-commit-authorship.sh',
+ 't7510-signed-commit.sh',
+ 't7511-status-index.sh',
+ 't7512-status-help.sh',
+ 't7513-interpret-trailers.sh',
+ 't7514-commit-patch.sh',
+ 't7515-status-symlinks.sh',
+ 't7516-commit-races.sh',
+ 't7517-per-repo-email.sh',
+ 't7518-ident-corner-cases.sh',
+ 't7519-status-fsmonitor.sh',
+ 't7520-ignored-hook-warning.sh',
+ 't7521-ignored-mode.sh',
+ 't7524-commit-summary.sh',
+ 't7525-status-rename.sh',
+ 't7526-commit-pathspec-file.sh',
+ 't7527-builtin-fsmonitor.sh',
+ 't7528-signed-commit-ssh.sh',
+ 't7600-merge.sh',
+ 't7601-merge-pull-config.sh',
+ 't7602-merge-octopus-many.sh',
+ 't7603-merge-reduce-heads.sh',
+ 't7604-merge-custom-message.sh',
+ 't7605-merge-resolve.sh',
+ 't7606-merge-custom.sh',
+ 't7607-merge-state.sh',
+ 't7608-merge-messages.sh',
+ 't7609-mergetool--lib.sh',
+ 't7610-mergetool.sh',
+ 't7611-merge-abort.sh',
+ 't7612-merge-verify-signatures.sh',
+ 't7614-merge-signoff.sh',
+ 't7615-diff-algo-with-mergy-operations.sh',
+ 't7700-repack.sh',
+ 't7701-repack-unpack-unreachable.sh',
+ 't7702-repack-cyclic-alternate.sh',
+ 't7703-repack-geometric.sh',
+ 't7704-repack-cruft.sh',
+ 't7800-difftool.sh',
+ 't7810-grep.sh',
+ 't7811-grep-open.sh',
+ 't7812-grep-icase-non-ascii.sh',
+ 't7813-grep-icase-iso.sh',
+ 't7814-grep-recurse-submodules.sh',
+ 't7815-grep-binary.sh',
+ 't7816-grep-binary-pattern.sh',
+ 't7817-grep-sparse-checkout.sh',
+ 't7900-maintenance.sh',
+ 't8001-annotate.sh',
+ 't8002-blame.sh',
+ 't8003-blame-corner-cases.sh',
+ 't8004-blame-with-conflicts.sh',
+ 't8005-blame-i18n.sh',
+ 't8006-blame-textconv.sh',
+ 't8007-cat-file-textconv.sh',
+ 't8008-blame-formats.sh',
+ 't8009-blame-vs-topicbranches.sh',
+ 't8010-cat-file-filters.sh',
+ 't8011-blame-split-file.sh',
+ 't8012-blame-colors.sh',
+ 't8013-blame-ignore-revs.sh',
+ 't8014-blame-ignore-fuzzy.sh',
+ 't9001-send-email.sh',
+ 't9002-column.sh',
+ 't9003-help-autocorrect.sh',
+ 't9100-git-svn-basic.sh',
+ 't9101-git-svn-props.sh',
+ 't9102-git-svn-deep-rmdir.sh',
+ 't9103-git-svn-tracked-directory-removed.sh',
+ 't9104-git-svn-follow-parent.sh',
+ 't9105-git-svn-commit-diff.sh',
+ 't9106-git-svn-commit-diff-clobber.sh',
+ 't9107-git-svn-migrate.sh',
+ 't9108-git-svn-glob.sh',
+ 't9109-git-svn-multi-glob.sh',
+ 't9110-git-svn-use-svm-props.sh',
+ 't9111-git-svn-use-svnsync-props.sh',
+ 't9112-git-svn-md5less-file.sh',
+ 't9113-git-svn-dcommit-new-file.sh',
+ 't9114-git-svn-dcommit-merge.sh',
+ 't9115-git-svn-dcommit-funky-renames.sh',
+ 't9116-git-svn-log.sh',
+ 't9117-git-svn-init-clone.sh',
+ 't9118-git-svn-funky-branch-names.sh',
+ 't9119-git-svn-info.sh',
+ 't9120-git-svn-clone-with-percent-escapes.sh',
+ 't9121-git-svn-fetch-renamed-dir.sh',
+ 't9122-git-svn-author.sh',
+ 't9123-git-svn-rebuild-with-rewriteroot.sh',
+ 't9124-git-svn-dcommit-auto-props.sh',
+ 't9125-git-svn-multi-glob-branch-names.sh',
+ 't9126-git-svn-follow-deleted-readded-directory.sh',
+ 't9127-git-svn-partial-rebuild.sh',
+ 't9128-git-svn-cmd-branch.sh',
+ 't9129-git-svn-i18n-commitencoding.sh',
+ 't9130-git-svn-authors-file.sh',
+ 't9131-git-svn-empty-symlink.sh',
+ 't9132-git-svn-broken-symlink.sh',
+ 't9133-git-svn-nested-git-repo.sh',
+ 't9134-git-svn-ignore-paths.sh',
+ 't9135-git-svn-moved-branch-empty-file.sh',
+ 't9136-git-svn-recreated-branch-empty-file.sh',
+ 't9137-git-svn-dcommit-clobber-series.sh',
+ 't9138-git-svn-authors-prog.sh',
+ 't9139-git-svn-non-utf8-commitencoding.sh',
+ 't9140-git-svn-reset.sh',
+ 't9141-git-svn-multiple-branches.sh',
+ 't9142-git-svn-shallow-clone.sh',
+ 't9143-git-svn-gc.sh',
+ 't9144-git-svn-old-rev_map.sh',
+ 't9145-git-svn-master-branch.sh',
+ 't9146-git-svn-empty-dirs.sh',
+ 't9147-git-svn-include-paths.sh',
+ 't9148-git-svn-propset.sh',
+ 't9150-svk-mergetickets.sh',
+ 't9151-svn-mergeinfo.sh',
+ 't9152-svn-empty-dirs-after-gc.sh',
+ 't9153-git-svn-rewrite-uuid.sh',
+ 't9154-git-svn-fancy-glob.sh',
+ 't9155-git-svn-fetch-deleted-tag.sh',
+ 't9156-git-svn-fetch-deleted-tag-2.sh',
+ 't9157-git-svn-fetch-merge.sh',
+ 't9158-git-svn-mergeinfo.sh',
+ 't9159-git-svn-no-parent-mergeinfo.sh',
+ 't9160-git-svn-preserve-empty-dirs.sh',
+ 't9161-git-svn-mergeinfo-push.sh',
+ 't9162-git-svn-dcommit-interactive.sh',
+ 't9163-git-svn-reset-clears-caches.sh',
+ 't9164-git-svn-dcommit-concurrent.sh',
+ 't9165-git-svn-fetch-merge-branch-of-branch.sh',
+ 't9166-git-svn-fetch-merge-branch-of-branch2.sh',
+ 't9167-git-svn-cmd-branch-subproject.sh',
+ 't9168-git-svn-partially-globbed-names.sh',
+ 't9169-git-svn-dcommit-crlf.sh',
+ 't9200-git-cvsexportcommit.sh',
+ 't9210-scalar.sh',
+ 't9211-scalar-clone.sh',
+ 't9300-fast-import.sh',
+ 't9301-fast-import-notes.sh',
+ 't9302-fast-import-unpack-limit.sh',
+ 't9303-fast-import-compression.sh',
+ 't9304-fast-import-marks.sh',
+ 't9350-fast-export.sh',
+ 't9351-fast-export-anonymize.sh',
+ 't9400-git-cvsserver-server.sh',
+ 't9401-git-cvsserver-crlf.sh',
+ 't9402-git-cvsserver-refs.sh',
+ 't9500-gitweb-standalone-no-errors.sh',
+ 't9501-gitweb-standalone-http-status.sh',
+ 't9502-gitweb-standalone-parse-output.sh',
+ 't9600-cvsimport.sh',
+ 't9601-cvsimport-vendor-branch.sh',
+ 't9602-cvsimport-branches-tags.sh',
+ 't9603-cvsimport-patchsets.sh',
+ 't9604-cvsimport-timestamps.sh',
+ 't9700-perl-git.sh',
+ 't9800-git-p4-basic.sh',
+ 't9801-git-p4-branch.sh',
+ 't9802-git-p4-filetype.sh',
+ 't9803-git-p4-shell-metachars.sh',
+ 't9804-git-p4-label.sh',
+ 't9805-git-p4-skip-submit-edit.sh',
+ 't9806-git-p4-options.sh',
+ 't9807-git-p4-submit.sh',
+ 't9808-git-p4-chdir.sh',
+ 't9809-git-p4-client-view.sh',
+ 't9810-git-p4-rcs.sh',
+ 't9811-git-p4-label-import.sh',
+ 't9812-git-p4-wildcards.sh',
+ 't9813-git-p4-preserve-users.sh',
+ 't9814-git-p4-rename.sh',
+ 't9815-git-p4-submit-fail.sh',
+ 't9816-git-p4-locked.sh',
+ 't9817-git-p4-exclude.sh',
+ 't9818-git-p4-block.sh',
+ 't9819-git-p4-case-folding.sh',
+ 't9820-git-p4-editor-handling.sh',
+ 't9821-git-p4-path-variations.sh',
+ 't9822-git-p4-path-encoding.sh',
+ 't9823-git-p4-mock-lfs.sh',
+ 't9824-git-p4-git-lfs.sh',
+ 't9825-git-p4-handle-utf16-without-bom.sh',
+ 't9826-git-p4-keep-empty-commits.sh',
+ 't9827-git-p4-change-filetype.sh',
+ 't9828-git-p4-map-user.sh',
+ 't9829-git-p4-jobs.sh',
+ 't9830-git-p4-symlink-dir.sh',
+ 't9831-git-p4-triggers.sh',
+ 't9832-unshelve.sh',
+ 't9833-errors.sh',
+ 't9834-git-p4-file-dir-bug.sh',
+ 't9835-git-p4-metadata-encoding-python2.sh',
+ 't9836-git-p4-metadata-encoding-python3.sh',
+ 't9850-shell.sh',
+ 't9901-git-web--browse.sh',
+ 't9902-completion.sh',
+ 't9903-bash-prompt.sh',
+]
+
+# GIT_BUILD_DIR needs to be Unix-style without drive prefixes as it 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 it.
+git_build_dir = meson.project_build_root()
+if cygpath.found()
+ git_build_dir = run_command(cygpath, git_build_dir, check: true).stdout().strip()
+endif
+
+test_environment = script_environment
+test_environment.set('GIT_BUILD_DIR', git_build_dir)
+
+foreach integration_test : integration_tests
+ test(fs.stem(integration_test), shell,
+ args: [ integration_test ],
+ workdir: meson.current_source_dir(),
+ env: test_environment,
+ depends: test_dependencies + bin_wrappers,
+ timeout: 0,
+ )
+endforeach
diff --git a/templates/hooks/meson.build b/templates/hooks/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..5bbb1bd483f24e05f826918fe63391ef72334e11
--- /dev/null
+++ b/templates/hooks/meson.build
@@ -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',
+ )
+endforeach
diff --git a/templates/info/meson.build b/templates/info/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..7af5ddd24985fc0a5888961939ae3b2758f2aaa8
--- /dev/null
+++ b/templates/info/meson.build
@@ -0,0 +1,7 @@
+configure_file(
+ input: 'exclude',
+ output: 'exclude',
+ configuration: template_config,
+ install: true,
+ install_dir: get_option('datadir') / 'git-core/templates',
+)
diff --git a/templates/meson.build b/templates/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..1faf9a44ceaa5a6eee673e66c9d5448c08dbc7d5
--- /dev/null
+++ b/templates/meson.build
@@ -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')
--
2.47.0.274.g962d0b743d.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v9 23/23] meson: fix conflicts with in-flight topics
2024-11-25 9:56 ` [PATCH v9 " Patrick Steinhardt
` (21 preceding siblings ...)
2024-11-25 9:57 ` [PATCH v9 22/23] Introduce support for the Meson build system Patrick Steinhardt
@ 2024-11-25 9:57 ` Patrick Steinhardt
22 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-25 9:57 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
As support for Meson is still in-flight we have to accommodate for
conflicts with topics in "seen". The following conflicts are being
addressed in this commit:
- ej/cat-file-remote-object-info adds t1017 and "fetch-object-info.c".
- cc/promisor-remote-capability adds t5710.
- ds/path-walk-1 adds t6601 as well as "path-walk.c" and
"test-path-walk.c".
- ps/reftable-detach adds "reftable/system.c".
- js/libgit-rust adds "common-exit.c" and "common-init.c".
- ds/full-name-hash adds "t/helper/test-name-hash.c".
- cw/worktree-extension deletes t2408.
This is somewhat painful in the current state where Meson is not yet
part of the main tree, but we'll have to live with that for the time
being.
I've split this commit out into a separate fixup-style commit such that
it is possible to test this topic both with and without "seen" merged
into it. You can simply revert this commit to test without "seen".
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
meson.build | 5 +++++
t/helper/meson.build | 2 ++
t/meson.build | 4 +++-
3 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/meson.build b/meson.build
index 6531c9b67ed2cb8cb5eac9b0be4654ddd14fbe1d..37b5ae2ece41e2ed145754f9920ed106e151ed52 100644
--- a/meson.build
+++ b/meson.build
@@ -238,6 +238,8 @@ libgit_sources = [
'commit-graph.c',
'commit-reach.c',
'commit.c',
+ 'common-exit.c',
+ 'common-init.c',
'compat/nonblock.c',
'compat/obstack.c',
'compat/terminal.c',
@@ -276,6 +278,7 @@ libgit_sources = [
'ewah/ewah_rlw.c',
'exec-cmd.c',
'fetch-negotiator.c',
+ 'fetch-object-info.c',
'fetch-pack.c',
'fmt-merge-msg.c',
'fsck.c',
@@ -350,6 +353,7 @@ libgit_sources = [
'parse-options.c',
'patch-delta.c',
'patch-ids.c',
+ 'path-walk.c',
'path.c',
'pathspec.c',
'pkt-line.c',
@@ -390,6 +394,7 @@ libgit_sources = [
'reftable/reader.c',
'reftable/record.c',
'reftable/stack.c',
+ 'reftable/system.c',
'reftable/tree.c',
'reftable/writer.c',
'remote.c',
diff --git a/t/helper/meson.build b/t/helper/meson.build
index 5e83884246edc7841738de5085f3255aa1fa3fbe..1d6154ce9756db17bc9f69bc3cd71a32b93857c5 100644
--- a/t/helper/meson.build
+++ b/t/helper/meson.build
@@ -34,12 +34,14 @@ test_tool_sources = [
'test-match-trees.c',
'test-mergesort.c',
'test-mktemp.c',
+ 'test-name-hash.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-path-walk.c',
'test-pcre2-config.c',
'test-pkt-line.c',
'test-proc-receive.c',
diff --git a/t/meson.build b/t/meson.build
index 86076b77d2005529f58fb402e86bc95048071342..7b4f878bbdee9ae2156ff921c821e5f0db9cd6bc 100644
--- a/t/meson.build
+++ b/t/meson.build
@@ -177,6 +177,7 @@ integration_tests = [
't1014-read-tree-confusing.sh',
't1015-read-index-unmerged.sh',
't1016-compatObjectFormat.sh',
+ 't1017-cat-file-remote-object-info.sh',
't1020-subdirectory.sh',
't1021-rerere-in-workdir.sh',
't1022-read-tree-partial-clone.sh',
@@ -306,7 +307,6 @@ integration_tests = [
't2405-worktree-submodule.sh',
't2406-worktree-repair.sh',
't2407-worktree-heads.sh',
- 't2408-worktree-relative.sh',
't2500-untracked-overwriting.sh',
't2501-cwd-empty.sh',
't3000-ls-files-others.sh',
@@ -728,6 +728,7 @@ integration_tests = [
't5703-upload-pack-ref-in-want.sh',
't5704-protocol-violations.sh',
't5705-session-id-in-capabilities.sh',
+ 't5710-promisor-remote-capability.sh',
't5730-protocol-v2-bundle-uri-file.sh',
't5731-protocol-v2-bundle-uri-git.sh',
't5732-protocol-v2-bundle-uri-http.sh',
@@ -830,6 +831,7 @@ integration_tests = [
't6500-gc.sh',
't6501-freshen-objects.sh',
't6600-test-reach.sh',
+ 't6601-path-walk.sh',
't6700-tree-depth.sh',
't7001-mv.sh',
't7002-mv-sparse-checkout.sh',
--
2.47.0.274.g962d0b743d.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v10 00/23] Modernize the build system
2024-10-02 15:15 [RFC PATCH 00/21] Modernize the build system Patrick Steinhardt
` (29 preceding siblings ...)
2024-11-25 9:56 ` [PATCH v9 " Patrick Steinhardt
@ 2024-11-28 16:12 ` Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 01/23] Makefile: use common template for GIT-BUILD-OPTIONS Patrick Steinhardt
` (22 more replies)
2024-12-06 13:24 ` [PATCH v11 00/26] Modernize the build system Patrick Steinhardt
31 siblings, 23 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-28 16:12 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
Hi,
this patch series modernizes our build infrasturcture. It refactors
various parts of it to make it possible to perform out-of-tree builds in
theory.
The series then continues to wire up Meson as a proposed alternative as
a modern replacement for our current build systems. It provides better
integration into IDEs than our Makefiles, better usability than our
Makefiles and CMake, better configuration and discoverability thereof
than autoconf and CMake (which is of course my personal opinion).
The intent is to have Meson replace autoconf, which is mostly unused and
broken. Eventually, the plan is to also replace CMake and our Makefiles
in case we figure out that this replacement is indeed a net benefit for
the project, but all of this would happen over the course of multiple
releases.
Changes in v10:
- Fix installation of templates, which all installed into the template
root directory by accident.
- Fix symlinks for git-receive-pack and git-upload-{archive,pack}.
- Dropped the compatibility fix with cc/promisor-remote-capability,
which has been removed from "seen".
As before, the tip of this patch series catches up with what is
happening in "seen" and should thus not be merged to "next". If you want
to test it without topics in "seen" you have to revert it.
Thanks!
Patrick
---
Patrick Steinhardt (23):
Makefile: use common template for GIT-BUILD-OPTIONS
Makefile: consistently use @PLACEHOLDER@ to substitute
Makefile: refactor GIT-VERSION-GEN to be reusable
Makefile: propagate Git version via generated header
Makefile: generate "git.rc" via GIT-VERSION-GEN
Makefile: generate doc versions via GIT-VERSION-GEN
Makefile: consistently use PERL_PATH
Makefile: extract script to massage Perl scripts
Makefile: use "generate-perl.sh" to massage Perl library
Makefile: extract script to massage Shell scripts
Makefile: extract script to generate gitweb.cgi
Makefile: extract script to generate gitweb.js
Makefile: refactor generators to be PWD-independent
Makefile: allow "bin-wrappers/" directory to exist
Makefile: simplify building of templates
Documentation: allow sourcing generated includes from separate dir
Documentation: teach "cmd-list.perl" about out-of-tree builds
Documentation: extract script to generate a list of mergetools
t: better support for out-of-tree builds
t: allow overriding build dir
Documentation: add comparison of build systems
Introduce support for the Meson build system
meson: fix conflicts with in-flight topics
.gitignore | 3 +-
Documentation/.gitignore | 2 +
Documentation/CodingGuidelines | 2 +-
Documentation/Makefile | 49 +-
Documentation/{asciidoc.conf => asciidoc.conf.in} | 3 +
...-extensions.rb => asciidoctor-extensions.rb.in} | 8 +-
Documentation/build-docdep.perl | 2 +
Documentation/cmd-list.perl | 23 +-
Documentation/config/diff.txt | 2 +-
Documentation/config/merge.txt | 2 +-
Documentation/generate-mergetool-list.sh | 17 +
Documentation/git.txt | 24 +-
Documentation/meson.build | 324 ++++
Documentation/technical/build-systems.txt | 224 +++
GIT-BUILD-OPTIONS.in | 47 +
GIT-VERSION-FILE.in | 1 +
GIT-VERSION-GEN | 74 +-
Makefile | 241 ++-
bin-wrappers/.gitignore | 9 +
bin-wrappers/meson.build | 28 +
bin-wrappers/wrap-for-bin.sh | 37 +
ci/test-documentation.sh | 2 +-
configure.ac | 2 +-
contrib/buildsystems/CMakeLists.txt | 287 +--
contrib/buildsystems/git-version.in | 1 +
contrib/completion/meson.build | 8 +
contrib/meson.build | 1 +
generate-cmdlist.sh | 42 +-
generate-configlist.sh | 20 +-
generate-hooklist.sh | 15 +-
generate-perl.sh | 37 +
generate-script.sh | 34 +
git-cvsserver.perl | 2 +-
git-instaweb.sh | 8 +-
git-request-pull.sh | 2 +-
git-send-email.perl | 2 +-
git-sh-i18n.sh | 6 +-
git-sh-setup.sh | 6 +-
git-svn.perl | 2 +-
git.rc => git.rc.in | 6 +-
gitweb/GITWEB-BUILD-OPTIONS.in | 24 +
gitweb/Makefile | 62 +-
gitweb/generate-gitweb-cgi.sh | 47 +
gitweb/generate-gitweb-js.sh | 12 +
gitweb/gitweb.perl | 44 +-
gitweb/meson.build | 79 +
meson.build | 1893 ++++++++++++++++++++
meson_options.txt | 81 +
perl/FromCPAN/Mail/meson.build | 7 +
perl/FromCPAN/meson.build | 9 +
perl/Git/I18N.pm | 6 +-
perl/Git/LoadCPAN.pm | 6 +-
perl/Git/LoadCPAN/Mail/meson.build | 7 +
perl/Git/LoadCPAN/meson.build | 9 +
perl/Git/SVN/Memoize/meson.build | 7 +
perl/Git/SVN/meson.build | 20 +
perl/Git/meson.build | 18 +
perl/header_templates/fixed_prefix.template.pl | 2 +-
perl/header_templates/runtime_prefix.template.pl | 8 +-
perl/meson.build | 12 +
po/meson.build | 27 +
subprojects/.gitignore | 1 +
subprojects/curl.wrap | 13 +
subprojects/expat.wrap | 13 +
subprojects/openssl.wrap | 15 +
subprojects/pcre2.wrap | 16 +
subprojects/zlib.wrap | 13 +
t/helper/meson.build | 93 +
t/lib-gettext.sh | 4 +-
t/meson.build | 1116 ++++++++++++
t/t7609-mergetool--lib.sh | 2 +-
t/test-lib.sh | 31 +-
templates/Makefile | 39 +-
templates/branches-- | 1 -
templates/{this--description => description} | 0
.../applypatch-msg.sample} | 0
.../commit-msg.sample} | 0
.../fsmonitor-watchman.sample} | 0
templates/hooks/meson.build | 26 +
.../post-update.sample} | 0
.../pre-applypatch.sample} | 0
.../pre-commit.sample} | 0
.../pre-merge-commit.sample} | 0
.../pre-push.sample} | 0
.../pre-rebase.sample} | 0
.../pre-receive.sample} | 0
.../prepare-commit-msg.sample} | 0
.../push-to-checkout.sample} | 0
.../sendemail-validate.sample} | 0
.../{hooks--update.sample => hooks/update.sample} | 0
templates/{info--exclude => info/exclude} | 0
templates/info/meson.build | 7 +
templates/meson.build | 15 +
unimplemented.sh | 2 +-
version-def.h.in | 8 +
version.c | 1 +
wrap-for-bin.sh | 36 -
97 files changed, 4938 insertions(+), 499 deletions(-)
Range-diff versus v9:
1: b2615d9610 = 1: da33c9c584 Makefile: use common template for GIT-BUILD-OPTIONS
2: afba38c430 = 2: 65a99e0be3 Makefile: consistently use @PLACEHOLDER@ to substitute
3: 1f5dcbb860 = 3: cae4617b14 Makefile: refactor GIT-VERSION-GEN to be reusable
4: 1b2da30065 = 4: 7ae8540ae5 Makefile: propagate Git version via generated header
5: d88a943419 = 5: 79fe87e027 Makefile: generate "git.rc" via GIT-VERSION-GEN
6: 0ad3eb80a7 = 6: ad3b326a61 Makefile: generate doc versions via GIT-VERSION-GEN
7: d615b64ebf = 7: 21cd6d1751 Makefile: consistently use PERL_PATH
8: 788b49edca = 8: 3bda1aaf94 Makefile: extract script to massage Perl scripts
9: 3ade250267 = 9: 406c0e8769 Makefile: use "generate-perl.sh" to massage Perl library
10: ec30fe9652 = 10: 90796b17b9 Makefile: extract script to massage Shell scripts
11: 69eb45ea9f = 11: 7b5e7fc222 Makefile: extract script to generate gitweb.cgi
12: ab8c2e7369 = 12: eda2a5fafa Makefile: extract script to generate gitweb.js
13: c88ee27d88 = 13: 709ab3b5f5 Makefile: refactor generators to be PWD-independent
14: 105bb4c1bd = 14: e79f104d7f Makefile: allow "bin-wrappers/" directory to exist
15: f3f7db5c82 = 15: aa816a6cb9 Makefile: simplify building of templates
16: 1262542641 = 16: 864296d108 Documentation: allow sourcing generated includes from separate dir
17: 31f53f3570 = 17: 960d1782a7 Documentation: teach "cmd-list.perl" about out-of-tree builds
18: 9f4fdec5dc = 18: fc803341f4 Documentation: extract script to generate a list of mergetools
19: 8a88e5fb35 = 19: 17f0e185df t: better support for out-of-tree builds
20: 296db4ba81 = 20: 60d746f329 t: allow overriding build dir
21: f47bc0535b = 21: 3f7df3af22 Documentation: add comparison of build systems
22: 99258d7e4f = 22: 7db23c5fdb Introduce support for the Meson build system
23: 584b0ef151 ! 23: 1a0c47c47f meson: fix conflicts with in-flight topics
@@ Commit message
- ej/cat-file-remote-object-info adds t1017 and "fetch-object-info.c".
- - cc/promisor-remote-capability adds t5710.
-
- ds/path-walk-1 adds t6601 as well as "path-walk.c" and
"test-path-walk.c".
@@ meson.build: libgit_sources = [
'reftable/tree.c',
'reftable/writer.c',
'remote.c',
+@@ meson.build: foreach alias : [ 'git-receive-pack', 'git-upload-archive', 'git-upload-pack' ]
+
+ install_symlink(alias + executable_suffix,
+ install_dir: get_option('libexecdir') / 'git-core',
+- pointing_to: 'git-remote-http',
++ pointing_to: 'git',
+ )
+ endforeach
+
## t/helper/meson.build ##
@@ t/helper/meson.build: test_tool_sources = [
@@ t/meson.build: integration_tests = [
't2500-untracked-overwriting.sh',
't2501-cwd-empty.sh',
't3000-ls-files-others.sh',
-@@ t/meson.build: integration_tests = [
- 't5703-upload-pack-ref-in-want.sh',
- 't5704-protocol-violations.sh',
- 't5705-session-id-in-capabilities.sh',
-+ 't5710-promisor-remote-capability.sh',
- 't5730-protocol-v2-bundle-uri-file.sh',
- 't5731-protocol-v2-bundle-uri-git.sh',
- 't5732-protocol-v2-bundle-uri-http.sh',
@@ t/meson.build: integration_tests = [
't6500-gc.sh',
't6501-freshen-objects.sh',
@@ t/meson.build: integration_tests = [
't6700-tree-depth.sh',
't7001-mv.sh',
't7002-mv-sparse-checkout.sh',
+
+ ## templates/hooks/meson.build ##
+@@ templates/hooks/meson.build: foreach hook : hooks
+ output: hook,
+ configuration: template_config,
+ install: true,
+- install_dir: get_option('datadir') / 'git-core/templates',
++ install_dir: get_option('datadir') / 'git-core/templates/hooks',
+ )
+ endforeach
+
+ ## templates/info/meson.build ##
+@@ templates/info/meson.build: configure_file(
+ output: 'exclude',
+ configuration: template_config,
+ install: true,
+- install_dir: get_option('datadir') / 'git-core/templates',
++ install_dir: get_option('datadir') / 'git-core/templates/info',
+ )
---
base-commit: dbfa873276ccefac0b426e46f31101ecdbcf4f40
change-id: 20241112-pks-meson-95b665c08f06
^ permalink raw reply [flat|nested] 386+ messages in thread
* [PATCH v10 01/23] Makefile: use common template for GIT-BUILD-OPTIONS
2024-11-28 16:12 ` [PATCH v10 00/23] Modernize the build system Patrick Steinhardt
@ 2024-11-28 16:12 ` Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 02/23] Makefile: consistently use @PLACEHOLDER@ to substitute Patrick Steinhardt
` (21 subsequent siblings)
22 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-28 16:12 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
The "GIT-BUILD-OPTIONS" file is generated by our build systems to
propagate built-in features and paths to our tests. The generation is
done ad-hoc, where both our Makefile and the CMake build instructions
simply echo a bunch of strings into the file. This makes it very hard to
figure out what variables are expected to exist and what format they
have, and the written variables can easily get out of sync between build
systems.
Introduce a new "GIT-BUILD-OPTIONS.in" template to address this issue.
This has multiple advantages:
- It demonstrates which built options exist in the first place.
- It can serve as a spot to document the build options.
- Some build systems complain when not all variables could be
substituted, alerting us of mismatches. Others don't, but if we
forgot to substitute such variables we now have a bogus string that
will likely cause our tests to fail, if they have any meaning in the
first place.
Backfill values that we didn't yet set in our CMake build instructions.
While at it, remove the `SUPPORTS_SIMPLE_IPC` variable that we only set
up in CMake as it isn't used anywhere.
This change requires us to adapt the setup of TEST_OUTPUT_DIRECTORY in
"test-lib.sh" such that it does not get overwritten after sourcing when
it has been set up via the environment. This is the only instance I
could find where we rely on ordering on variables.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-BUILD-OPTIONS.in | 36 +++++++++++
Makefile | 115 ++++++++++++++----------------------
contrib/buildsystems/CMakeLists.txt | 58 ++++++++++++------
t/test-lib.sh | 22 +++++--
4 files changed, 136 insertions(+), 95 deletions(-)
diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in
new file mode 100644
index 0000000000000000000000000000000000000000..f0ca240493c94aa41a6b6241a8474e42f7cdc8b9
--- /dev/null
+++ b/GIT-BUILD-OPTIONS.in
@@ -0,0 +1,36 @@
+SHELL_PATH=@SHELL_PATH@
+TEST_SHELL_PATH=@TEST_SHELL_PATH@
+PERL_PATH=@PERL_PATH@
+DIFF=@DIFF@
+PYTHON_PATH=@PYTHON_PATH@
+TAR=@TAR@
+NO_CURL=@NO_CURL@
+NO_ICONV=@NO_ICONV@
+NO_EXPAT=@NO_EXPAT@
+USE_LIBPCRE2=@USE_LIBPCRE2@
+NO_PERL=@NO_PERL@
+NO_PTHREADS=@NO_PTHREADS@
+NO_PYTHON=@NO_PYTHON@
+NO_REGEX=@NO_REGEX@
+NO_UNIX_SOCKETS=@NO_UNIX_SOCKETS@
+PAGER_ENV=@PAGER_ENV@
+SANITIZE_LEAK=@SANITIZE_LEAK@
+SANITIZE_ADDRESS=@SANITIZE_ADDRESS@
+X=@X@
+FSMONITOR_DAEMON_BACKEND=@FSMONITOR_DAEMON_BACKEND@
+FSMONITOR_OS_SETTINGS=@FSMONITOR_OS_SETTINGS@
+TEST_OUTPUT_DIRECTORY=@TEST_OUTPUT_DIRECTORY@
+GIT_TEST_OPTS=@GIT_TEST_OPTS@
+GIT_TEST_CMP=@GIT_TEST_CMP@
+GIT_TEST_CMP_USE_COPIED_CONTEXT=@GIT_TEST_CMP_USE_COPIED_CONTEXT@
+GIT_TEST_UTF8_LOCALE=@GIT_TEST_UTF8_LOCALE@
+NO_GETTEXT=@NO_GETTEXT@
+GIT_PERF_REPEAT_COUNT=@GIT_PERF_REPEAT_COUNT@
+GIT_PERF_REPO=@GIT_PERF_REPO@
+GIT_PERF_LARGE_REPO=@GIT_PERF_LARGE_REPO@
+GIT_PERF_MAKE_OPTS=@GIT_PERF_MAKE_OPTS@
+GIT_PERF_MAKE_COMMAND=@GIT_PERF_MAKE_COMMAND@
+GIT_INTEROP_MAKE_OPTS=@GIT_INTEROP_MAKE_OPTS@
+GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@
+GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@
+RUNTIME_PREFIX=@RUNTIME_PREFIX@
diff --git a/Makefile b/Makefile
index 549b24e7fdbbdc173dfec79cdaddf67ccba52e14..1f8434a902fa50035c29aecd0ac64c68e0f5db4f 100644
--- a/Makefile
+++ b/Makefile
@@ -3160,80 +3160,55 @@ GIT-LDFLAGS: FORCE
echo "$$FLAGS" >GIT-LDFLAGS; \
fi
+ifdef RUNTIME_PREFIX
+RUNTIME_PREFIX_OPTION = true
+else
+RUNTIME_PREFIX_OPTION = false
+endif
+
# We need to apply sq twice, once to protect from the shell
# that runs GIT-BUILD-OPTIONS, and then again to protect it
# and the first level quoting from the shell that runs "echo".
GIT-BUILD-OPTIONS: FORCE
- @echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@+
- @echo TEST_SHELL_PATH=\''$(subst ','\'',$(TEST_SHELL_PATH_SQ))'\' >>$@+
- @echo PERL_PATH=\''$(subst ','\'',$(PERL_PATH_SQ))'\' >>$@+
- @echo DIFF=\''$(subst ','\'',$(subst ','\'',$(DIFF)))'\' >>$@+
- @echo PYTHON_PATH=\''$(subst ','\'',$(PYTHON_PATH_SQ))'\' >>$@+
- @echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@+
- @echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@+
- @echo NO_ICONV=\''$(subst ','\'',$(subst ','\'',$(NO_ICONV)))'\' >>$@+
- @echo NO_EXPAT=\''$(subst ','\'',$(subst ','\'',$(NO_EXPAT)))'\' >>$@+
- @echo USE_LIBPCRE2=\''$(subst ','\'',$(subst ','\'',$(USE_LIBPCRE2)))'\' >>$@+
- @echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@+
- @echo NO_PTHREADS=\''$(subst ','\'',$(subst ','\'',$(NO_PTHREADS)))'\' >>$@+
- @echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@+
- @echo NO_REGEX=\''$(subst ','\'',$(subst ','\'',$(NO_REGEX)))'\' >>$@+
- @echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@+
- @echo PAGER_ENV=\''$(subst ','\'',$(subst ','\'',$(PAGER_ENV)))'\' >>$@+
- @echo SANITIZE_LEAK=\''$(subst ','\'',$(subst ','\'',$(SANITIZE_LEAK)))'\' >>$@+
- @echo SANITIZE_ADDRESS=\''$(subst ','\'',$(subst ','\'',$(SANITIZE_ADDRESS)))'\' >>$@+
- @echo X=\'$(X)\' >>$@+
-ifdef FSMONITOR_DAEMON_BACKEND
- @echo FSMONITOR_DAEMON_BACKEND=\''$(subst ','\'',$(subst ','\'',$(FSMONITOR_DAEMON_BACKEND)))'\' >>$@+
-endif
-ifdef FSMONITOR_OS_SETTINGS
- @echo FSMONITOR_OS_SETTINGS=\''$(subst ','\'',$(subst ','\'',$(FSMONITOR_OS_SETTINGS)))'\' >>$@+
-endif
-ifdef TEST_OUTPUT_DIRECTORY
- @echo TEST_OUTPUT_DIRECTORY=\''$(subst ','\'',$(subst ','\'',$(TEST_OUTPUT_DIRECTORY)))'\' >>$@+
-endif
-ifdef GIT_TEST_OPTS
- @echo GIT_TEST_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_OPTS)))'\' >>$@+
-endif
-ifdef GIT_TEST_CMP
- @echo GIT_TEST_CMP=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_CMP)))'\' >>$@+
-endif
-ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
- @echo GIT_TEST_CMP_USE_COPIED_CONTEXT=YesPlease >>$@+
-endif
-ifdef GIT_TEST_UTF8_LOCALE
- @echo GIT_TEST_UTF8_LOCALE=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_UTF8_LOCALE)))'\' >>$@+
-endif
- @echo NO_GETTEXT=\''$(subst ','\'',$(subst ','\'',$(NO_GETTEXT)))'\' >>$@+
-ifdef GIT_PERF_REPEAT_COUNT
- @echo GIT_PERF_REPEAT_COUNT=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPEAT_COUNT)))'\' >>$@+
-endif
-ifdef GIT_PERF_REPO
- @echo GIT_PERF_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPO)))'\' >>$@+
-endif
-ifdef GIT_PERF_LARGE_REPO
- @echo GIT_PERF_LARGE_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_LARGE_REPO)))'\' >>$@+
-endif
-ifdef GIT_PERF_MAKE_OPTS
- @echo GIT_PERF_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_OPTS)))'\' >>$@+
-endif
-ifdef GIT_PERF_MAKE_COMMAND
- @echo GIT_PERF_MAKE_COMMAND=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_COMMAND)))'\' >>$@+
-endif
-ifdef GIT_INTEROP_MAKE_OPTS
- @echo GIT_INTEROP_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_INTEROP_MAKE_OPTS)))'\' >>$@+
-endif
-ifdef GIT_TEST_INDEX_VERSION
- @echo GIT_TEST_INDEX_VERSION=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_INDEX_VERSION)))'\' >>$@+
-endif
-ifdef GIT_TEST_PERL_FATAL_WARNINGS
- @echo GIT_TEST_PERL_FATAL_WARNINGS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_PERL_FATAL_WARNINGS)))'\' >>$@+
-endif
-ifdef RUNTIME_PREFIX
- @echo RUNTIME_PREFIX=\'true\' >>$@+
-else
- @echo RUNTIME_PREFIX=\'false\' >>$@+
-endif
+ @sed \
+ -e "s|@SHELL_PATH@|\'$(SHELL_PATH_SQ)\'|" \
+ -e "s|@TEST_SHELL_PATH@|\'$(TEST_SHELL_PATH_SQ)\'|" \
+ -e "s|@PERL_PATH@|\'$(PERL_PATH_SQ)\'|" \
+ -e "s|@DIFF@|\'$(DIFF)\'|" \
+ -e "s|@PYTHON_PATH@|\'$(PYTHON_PATH_SQ)\'|" \
+ -e "s|@TAR@|\'$(TAR)\'|" \
+ -e "s|@NO_CURL@|\'$(NO_CURL)\'|" \
+ -e "s|@NO_ICONV@|\'$(NO_ICONV)\'|" \
+ -e "s|@NO_EXPAT@|\'$(NO_EXPAT)\'|" \
+ -e "s|@USE_LIBPCRE2@|\'$(USE_LIBPCRE2)\'|" \
+ -e "s|@NO_PERL@|\'$(NO_PERL)\'|" \
+ -e "s|@NO_PTHREADS@|\'$(NO_PTHREADS)\'|" \
+ -e "s|@NO_PYTHON@|\'$(NO_PYTHON)\'|" \
+ -e "s|@NO_REGEX@|\'$(NO_REGEX)\'|" \
+ -e "s|@NO_UNIX_SOCKETS@|\'$(NO_UNIX_SOCKETS)\'|" \
+ -e "s|@PAGER_ENV@|\'$(PAGER_ENV)\'|" \
+ -e "s|@SANITIZE_LEAK@|\'$(SANITIZE_LEAK)\'|" \
+ -e "s|@SANITIZE_ADDRESS@|\'$(SANITIZE_ADDRESS)\'|" \
+ -e "s|@X@|\'$(X)\'|" \
+ -e "s|@FSMONITOR_DAEMON_BACKEND@|\'$(FSMONITOR_DAEMON_BACKEND)\'|" \
+ -e "s|@FSMONITOR_OS_SETTINGS@|\'$(FSMONITOR_OS_SETTINGS)\'|" \
+ -e "s|@TEST_OUTPUT_DIRECTORY@|\'$(TEST_OUTPUT_DIRECTORY)\'|" \
+ -e "s|@GIT_TEST_OPTS@|\'$(GIT_TEST_OPTS)\'|" \
+ -e "s|@GIT_TEST_CMP@|\'$(GIT_TEST_CMP)\'|" \
+ -e "s|@GIT_TEST_CMP_USE_COPIED_CONTEXT@|\'$(GIT_TEST_CMP_USE_COPIED_CONTEXT)\'|" \
+ -e "s|@GIT_TEST_UTF8_LOCALE@|\'$(GIT_TEST_UTF8_LOCALE)\'|" \
+ -e "s|@NO_GETTEXT@|\'$(NO_GETTEXT)\'|" \
+ -e "s|@GIT_PERF_REPEAT_COUNT@|\'$(GIT_PERF_REPEAT_COUNT)\'|" \
+ -e "s|@GIT_PERF_REPO@|\'$(GIT_PERF_REPO)\'|" \
+ -e "s|@GIT_PERF_LARGE_REPO@|\'$(GIT_PERF_LARGE_REPO)\'|" \
+ -e "s|@GIT_PERF_MAKE_OPTS@|\'$(GIT_PERF_MAKE_OPTS)\'|" \
+ -e "s|@GIT_PERF_MAKE_COMMAND@|\'$(GIT_PERF_MAKE_COMMAND)\'|" \
+ -e "s|@GIT_INTEROP_MAKE_OPTS@|\'$(GIT_INTEROP_MAKE_OPTS)\'|" \
+ -e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \
+ -e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \
+ -e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX_OPTION)\'|" \
+ GIT-BUILD-OPTIONS.in >$@+
+ @if grep -q '^[A-Z][A-Z_]*=@.*@$$' $@+; then echo "Unsubstituted build options in $@" >&2 && exit 1; fi
@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
@if test -f GIT-BUILD-DIR; then rm GIT-BUILD-DIR; fi
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 8c71f5a1d0290c9204e094fb266f10c7b70af9fb..985004f5943128483e2138cd61aca8bd8ccbd240 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -1125,27 +1125,47 @@ if(NOT PYTHON_TESTS)
set(NO_PYTHON 1)
endif()
-file(WRITE ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "SHELL_PATH='${SHELL_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "TEST_SHELL_PATH='${TEST_SHELL_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PERL_PATH='${PERL_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "DIFF='${DIFF}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PYTHON_PATH='${PYTHON_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "TAR='${TAR}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_CURL='${NO_CURL}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_ICONV='${NO_ICONV}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_EXPAT='${NO_EXPAT}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PERL='${NO_PERL}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PTHREADS='${NO_PTHREADS}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_UNIX_SOCKETS='${NO_UNIX_SOCKETS}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PAGER_ENV='${PAGER_ENV}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "X='${EXE_EXTENSION}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_GETTEXT='${NO_GETTEXT}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "RUNTIME_PREFIX='${RUNTIME_PREFIX}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PYTHON='${NO_PYTHON}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "SUPPORTS_SIMPLE_IPC='${SUPPORTS_SIMPLE_IPC}'\n")
+file(STRINGS ${CMAKE_SOURCE_DIR}/GIT-BUILD-OPTIONS.in git_build_options NEWLINE_CONSUME)
+string(REPLACE "@SHELL_PATH@" "'${SHELL_PATH}'" git_build_options "${git_build_options}")
+string(REPLACE "@TEST_SHELL_PATH@" "'${TEST_SHELL_PATH}'" git_build_options "${git_build_options}")
+string(REPLACE "@PERL_PATH@" "'${PERL_PATH}'" git_build_options "${git_build_options}")
+string(REPLACE "@DIFF@" "'${DIFF}'" git_build_options "${git_build_options}")
+string(REPLACE "@PYTHON_PATH@" "'${PYTHON_PATH}'" git_build_options "${git_build_options}")
+string(REPLACE "@TAR@" "'${TAR}'" git_build_options "${git_build_options}")
+string(REPLACE "@NO_CURL@" "${NO_CURL}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_ICONV@" "${NO_ICONV}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_EXPAT@" "${NO_EXPAT}" git_build_options "${git_build_options}")
+string(REPLACE "@USE_LIBPCRE2@" "" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PERL@" "${NO_PERL}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PTHREADS@" "${NO_PTHREADS}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PYTHON@" "${NO_PYTHON}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_REGEX@" "" git_build_options "${git_build_options}")
+string(REPLACE "@NO_UNIX_SOCKETS@" "${NO_UNIX_SOCKETS}" git_build_options "${git_build_options}")
+string(REPLACE "@PAGER_ENV@" "'${PAGER_ENV}'" git_build_options "${git_build_options}")
+string(REPLACE "@SANITIZE_LEAK@" "" git_build_options "${git_build_options}")
+string(REPLACE "@SANITIZE_ADDRESS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@X@" "${EXE_EXTENSION}" git_build_options "${git_build_options}")
+string(REPLACE "@FSMONITOR_DAEMON_BACKEND@" "win32" git_build_options "${git_build_options}")
+string(REPLACE "@FSMONITOR_OS_SETTINGS@" "win32" git_build_options "${git_build_options}")
+string(REPLACE "@TEST_OUTPUT_DIRECTORY@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_OPTS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_CMP@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_CMP_USE_COPIED_CONTEXT@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_UTF8_LOCALE@" "" git_build_options "${git_build_options}")
+string(REPLACE "@NO_GETTEXT@" "${NO_GETTEXT}" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_REPEAT_COUNT@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_REPO@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_LARGE_REPO@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_MAKE_OPTS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_MAKE_COMMAND@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@RUNTIME_PREFIX@" "'${RUNTIME_PREFIX}'" git_build_options "${git_build_options}")
if(USE_VCPKG)
- file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
+ string(APPEND git_build_options "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
endif()
+file(WRITE ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS ${git_build_options})
#Make the tests work when building out of the source tree
get_filename_component(CACHE_PATH ${CMAKE_CURRENT_LIST_DIR}/../../CMakeCache.txt ABSOLUTE)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 6c60e8adae8c3daf39ceb8afc8c4938fa7fc48a4..cca6a09c68cb9d08c37b0ded3150118767153b9f 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -35,12 +35,6 @@ else
# needing to exist.
TEST_DIRECTORY=$(cd "$TEST_DIRECTORY" && pwd) || exit 1
fi
-if test -z "$TEST_OUTPUT_DIRECTORY"
-then
- # Similarly, override this to store the test-results subdir
- # elsewhere
- TEST_OUTPUT_DIRECTORY=$TEST_DIRECTORY
-fi
GIT_BUILD_DIR="${TEST_DIRECTORY%/t}"
if test "$TEST_DIRECTORY" = "$GIT_BUILD_DIR"
then
@@ -92,6 +86,15 @@ export LSAN_OPTIONS
prepend_var UBSAN_OPTIONS : $GIT_SAN_OPTIONS
export UBSAN_OPTIONS
+# The TEST_OUTPUT_DIRECTORY will be overwritten via GIT-BUILD-OPTIONS. So in
+# case the caller has manually set up this variable via the environment we must
+# make sure to not overwrite that value, and thus we save it into
+# TEST_OUTPUT_DIRECTORY_OVERRIDE here.
+if test -n "$TEST_OUTPUT_DIRECTORY" && test -z "$TEST_OUTPUT_DIRECTORY_OVERRIDE"
+then
+ TEST_OUTPUT_DIRECTORY_OVERRIDE=$TEST_OUTPUT_DIRECTORY
+fi
+
if test ! -f "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
then
echo >&2 'error: GIT-BUILD-OPTIONS missing (has Git been built?).'
@@ -100,6 +103,13 @@ fi
. "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
export PERL_PATH SHELL_PATH
+if test -z "$TEST_OUTPUT_DIRECTORY"
+then
+ # Similarly, override this to store the test-results subdir
+ # elsewhere
+ TEST_OUTPUT_DIRECTORY=$TEST_DIRECTORY
+fi
+
# In t0000, we need to override test directories of nested testcases. In case
# the developer has TEST_OUTPUT_DIRECTORY part of his build options, then we'd
# reset this value to instead contain what the developer has specified. We thus
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v10 02/23] Makefile: consistently use @PLACEHOLDER@ to substitute
2024-11-28 16:12 ` [PATCH v10 00/23] Modernize the build system Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 01/23] Makefile: use common template for GIT-BUILD-OPTIONS Patrick Steinhardt
@ 2024-11-28 16:12 ` Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 03/23] Makefile: refactor GIT-VERSION-GEN to be reusable Patrick Steinhardt
` (20 subsequent siblings)
22 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-28 16:12 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
We have a bunch of placeholders in our scripts that we replace at build
time, for example by using sed(1). These placeholders come in three
different formats: @PLACEHOLDER@, @@PLACEHOLDER@@ and ++PLACEHOLDER++.
Next to being inconsistent it also creates a bit of a problem with
CMake, which only supports the first syntax in its `configure_file()`
function. To work around that we instead manually replace placeholders
via string operations, which is a hassle and removes safeguards that
CMake has to verify that we didn't forget to replace any placeholders.
Besides that, other build systems like Meson also support the CMake
syntax.
Unify our codebase to consistently use the syntax supported by such
build systems.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 44 ++++++++++++------------
configure.ac | 2 +-
contrib/buildsystems/CMakeLists.txt | 34 +++++++++---------
git-cvsserver.perl | 2 +-
git-instaweb.sh | 8 ++---
git-request-pull.sh | 2 +-
git-send-email.perl | 2 +-
git-sh-i18n.sh | 6 ++--
git-sh-setup.sh | 6 ++--
git-svn.perl | 2 +-
gitweb/Makefile | 44 ++++++++++++------------
gitweb/gitweb.perl | 44 ++++++++++++------------
perl/Git/I18N.pm | 6 ++--
perl/Git/LoadCPAN.pm | 6 ++--
| 2 +-
| 8 ++---
unimplemented.sh | 2 +-
wrap-for-bin.sh | 18 +++++-----
18 files changed, 119 insertions(+), 119 deletions(-)
diff --git a/Makefile b/Makefile
index 1f8434a902fa50035c29aecd0ac64c68e0f5db4f..75e26d2e312f186bd5a0e3b48fb38850613bca4b 100644
--- a/Makefile
+++ b/Makefile
@@ -1555,10 +1555,10 @@ endif
ifdef SANE_TOOL_PATH
SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH))
-BROKEN_PATH_FIX = 's|^\# @@BROKEN_PATH_FIX@@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|'
+BROKEN_PATH_FIX = 's|^\# @BROKEN_PATH_FIX@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|'
PATH := $(SANE_TOOL_PATH):${PATH}
else
-BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d'
+BROKEN_PATH_FIX = '/^\# @BROKEN_PATH_FIX@$$/d'
endif
ifeq (,$(HOST_CPU))
@@ -2548,13 +2548,13 @@ GIT-SCRIPT-DEFINES: FORCE
define cmd_munge_script
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
- -e 's|@@DIFF@@|$(DIFF_SQ)|' \
- -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' \
- -e 's/@@USE_GETTEXT_SCHEME@@/$(USE_GETTEXT_SCHEME)/g' \
+ -e 's|@DIFF@|$(DIFF_SQ)|' \
+ -e 's|@LOCALEDIR@|$(localedir_SQ)|g' \
+ -e 's/@USE_GETTEXT_SCHEME@/$(USE_GETTEXT_SCHEME)/g' \
-e $(BROKEN_PATH_FIX) \
- -e 's|@@GITWEBDIR@@|$(gitwebdir_SQ)|g' \
- -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
- -e 's|@@PAGER_ENV@@|$(PAGER_ENV_SQ)|g' \
+ -e 's|@GITWEBDIR@|$(gitwebdir_SQ)|g' \
+ -e 's|@PERL@|$(PERL_PATH_SQ)|g' \
+ -e 's|@PAGER_ENV@|$(PAGER_ENV_SQ)|g' \
$@.sh >$@+
endef
@@ -2611,7 +2611,7 @@ $(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
-e ' r GIT-PERL-HEADER' \
-e ' G' \
-e '}' \
- -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
+ -e 's/@GIT_VERSION@/$(GIT_VERSION)/g' \
$< >$@+ && \
chmod +x $@+ && \
mv $@+ $@
@@ -2629,11 +2629,11 @@ GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile
INSTLIBDIR='$(perllibdir_SQ)' && \
INSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \
INSTLIBDIR="$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}" && \
- sed -e 's=@@PATHSEP@@=$(pathsep)=g' \
- -e "s=@@INSTLIBDIR@@=$$INSTLIBDIR=g" \
- -e 's=@@PERLLIBDIR_REL@@=$(perllibdir_relative_SQ)=g' \
- -e 's=@@GITEXECDIR_REL@@=$(gitexecdir_relative_SQ)=g' \
- -e 's=@@LOCALEDIR_REL@@=$(localedir_relative_SQ)=g' \
+ sed -e 's=@PATHSEP@=$(pathsep)=g' \
+ -e "s=@INSTLIBDIR@=$$INSTLIBDIR=g" \
+ -e 's=@PERLLIBDIR_REL@=$(perllibdir_relative_SQ)=g' \
+ -e 's=@GITEXECDIR_REL@=$(gitexecdir_relative_SQ)=g' \
+ -e 's=@LOCALEDIR_REL@=$(localedir_relative_SQ)=g' \
$< >$@+ && \
mv $@+ $@
@@ -2649,7 +2649,7 @@ else # NO_PERL
$(SCRIPT_PERL_GEN) git-instaweb: % : unimplemented.sh
$(QUIET_GEN) \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@@REASON@@|NO_PERL=$(NO_PERL)|g' \
+ -e 's|@REASON@|NO_PERL=$(NO_PERL)|g' \
unimplemented.sh >$@+ && \
chmod +x $@+ && \
mv $@+ $@
@@ -2670,13 +2670,13 @@ else # NO_PYTHON
$(SCRIPT_PYTHON_GEN): % : unimplemented.sh
$(QUIET_GEN) \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@@REASON@@|NO_PYTHON=$(NO_PYTHON)|g' \
+ -e 's|@REASON@|NO_PYTHON=$(NO_PYTHON)|g' \
unimplemented.sh >$@+ && \
chmod +x $@+ && \
mv $@+ $@
endif # NO_PYTHON
-CONFIGURE_RECIPE = sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
+CONFIGURE_RECIPE = sed -e 's/@GIT_VERSION@/$(GIT_VERSION)/g' \
configure.ac >configure.ac+ && \
autoconf -o configure configure.ac+ && \
$(RM) configure.ac+
@@ -3104,9 +3104,9 @@ endif
perl/build/lib/%.pm: perl/%.pm GIT-PERL-DEFINES
$(call mkdir_p_parent_template)
$(QUIET_GEN) \
- sed -e 's|@@LOCALEDIR@@|$(perl_localedir_SQ)|g' \
- -e 's|@@NO_GETTEXT@@|$(NO_GETTEXT_SQ)|g' \
- -e 's|@@NO_PERL_CPAN_FALLBACKS@@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \
+ sed -e 's|@LOCALEDIR@|$(perl_localedir_SQ)|g' \
+ -e 's|@NO_GETTEXT@|$(NO_GETTEXT_SQ)|g' \
+ -e 's|@NO_PERL_CPAN_FALLBACKS@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \
< $< > $@
perl/build/man/man3/Git.3pm: perl/Git.pm
@@ -3231,8 +3231,8 @@ all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PR
bin-wrappers/%: wrap-for-bin.sh
$(call mkdir_p_parent_template)
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@@BUILD_DIR@@|$(shell pwd)|' \
- -e 's|@@PROG@@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
+ -e 's|@BUILD_DIR@|$(shell pwd)|' \
+ -e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
chmod +x $@
# GNU make supports exporting all variables by "export" without parameters.
diff --git a/configure.ac b/configure.ac
index d1a96da14eb56766e1538da80ab97ed8a99b24f6..5923edc44aa7b6cc355fa6589b6d075b0c0a7772 100644
--- a/configure.ac
+++ b/configure.ac
@@ -142,7 +142,7 @@ fi
## Configure body starts here.
AC_PREREQ(2.59)
-AC_INIT([git], [@@GIT_VERSION@@], [git@vger.kernel.org])
+AC_INIT([git], [@GIT_VERSION@], [git@vger.kernel.org])
AC_CONFIG_SRCDIR([git.c])
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 985004f5943128483e2138cd61aca8bd8ccbd240..1abf5f099c1c6735ae7aec345de96bf623e2aa18 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -836,14 +836,14 @@ set(git_shell_scripts
foreach(script ${git_shell_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.sh content NEWLINE_CONSUME)
string(REPLACE "@SHELL_PATH@" "${SHELL_PATH}" content "${content}")
- string(REPLACE "@@DIFF@@" "diff" content "${content}")
+ string(REPLACE "@DIFF@" "diff" content "${content}")
string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}")
string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" content "${content}")
- string(REPLACE "@@NO_CURL@@" "" content "${content}")
- string(REPLACE "@@USE_GETTEXT_SCHEME@@" "" content "${content}")
- string(REPLACE "# @@BROKEN_PATH_FIX@@" "" content "${content}")
- string(REPLACE "@@PERL@@" "${PERL_PATH}" content "${content}")
- string(REPLACE "@@PAGER_ENV@@" "LESS=FRX LV=-c" content "${content}")
+ string(REPLACE "@NO_CURL@" "" content "${content}")
+ string(REPLACE "@USE_GETTEXT_SCHEME@" "" content "${content}")
+ string(REPLACE "# @BROKEN_PATH_FIX@" "" content "${content}")
+ string(REPLACE "@PERL@" "${PERL_PATH}" content "${content}")
+ string(REPLACE "@PAGER_ENV@" "LESS=FRX LV=-c" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
endforeach()
@@ -852,13 +852,13 @@ parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" ".perl")
#create perl header
file(STRINGS ${CMAKE_SOURCE_DIR}/perl/header_templates/fixed_prefix.template.pl perl_header )
-string(REPLACE "@@PATHSEP@@" ":" perl_header "${perl_header}")
-string(REPLACE "@@INSTLIBDIR@@" "${INSTLIBDIR}" perl_header "${perl_header}")
+string(REPLACE "@PATHSEP@" ":" perl_header "${perl_header}")
+string(REPLACE "@INSTLIBDIR@" "${INSTLIBDIR}" perl_header "${perl_header}")
foreach(script ${git_perl_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.perl content NEWLINE_CONSUME)
string(REPLACE "#!/usr/bin/perl" "#!/usr/bin/perl\n${perl_header}\n" content "${content}")
- string(REPLACE "@@GIT_VERSION@@" "${PROJECT_VERSION}" content "${content}")
+ string(REPLACE "@GIT_VERSION@" "${PROJECT_VERSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
endforeach()
@@ -873,8 +873,8 @@ file(GLOB_RECURSE perl_modules "${CMAKE_SOURCE_DIR}/perl/*.pm")
foreach(pm ${perl_modules})
string(REPLACE "${CMAKE_SOURCE_DIR}/perl/" "" file_path ${pm})
file(STRINGS ${pm} content NEWLINE_CONSUME)
- string(REPLACE "@@LOCALEDIR@@" "${LOCALEDIR}" content "${content}")
- string(REPLACE "@@NO_PERL_CPAN_FALLBACKS@@" "" content "${content}")
+ string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}")
+ string(REPLACE "@NO_PERL_CPAN_FALLBACKS@" "" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/perl/build/lib/${file_path} ${content})
#test-lib.sh requires perl/build/lib to be the build directory of perl modules
endforeach()
@@ -1064,21 +1064,21 @@ set(wrapper_test_scripts
foreach(script ${wrapper_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
- string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
- string(REPLACE "@@PROG@@" "${script}${EXE_EXTENSION}" content "${content}")
+ string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+ string(REPLACE "@PROG@" "${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
foreach(script ${wrapper_test_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
- string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
- string(REPLACE "@@PROG@@" "t/helper/${script}${EXE_EXTENSION}" content "${content}")
+ string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+ string(REPLACE "@PROG@" "t/helper/${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
-string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
-string(REPLACE "@@PROG@@" "git-cvsserver" content "${content}")
+string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+string(REPLACE "@PROG@" "git-cvsserver" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})
#options for configuring test options
diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index 124f598bdc07058b139f8dcbf8245128c52d9176..70ae7cb8e456885ddf2b13a70d21831cdaa7bf06 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -26,7 +26,7 @@
use File::Basename;
use Getopt::Long qw(:config require_order no_ignore_case);
-my $VERSION = '@@GIT_VERSION@@';
+my $VERSION = '@GIT_VERSION@';
my $log = GITCVS::log->new();
my $cfg;
diff --git a/git-instaweb.sh b/git-instaweb.sh
index 8dbe21d5887595352bc0159ea9befdf296b8105f..c8efb1205a8e2a66a6aced840980978897e122bc 100755
--- a/git-instaweb.sh
+++ b/git-instaweb.sh
@@ -3,7 +3,7 @@
# Copyright (c) 2006 Eric Wong
#
-PERL='@@PERL@@'
+PERL='@PERL@'
OPTIONS_KEEPDASHDASH=
OPTIONS_STUCKLONG=
OPTIONS_SPEC="\
@@ -38,8 +38,8 @@ conf="$GIT_DIR/gitweb/httpd.conf"
# if installed, it doesn't need further configuration (module_path)
test -z "$httpd" && httpd='lighttpd -f'
-# Default is @@GITWEBDIR@@
-test -z "$root" && root='@@GITWEBDIR@@'
+# Default is @GITWEBDIR@
+test -z "$root" && root='@GITWEBDIR@'
# any untaken local port will do...
test -z "$port" && port=1234
@@ -716,7 +716,7 @@ EOF
gitweb_conf() {
cat > "$fqgitdir/gitweb/gitweb_config.perl" <<EOF
-#!@@PERL@@
+#!@PERL@
our \$projectroot = "$(dirname "$fqgitdir")";
our \$git_temp = "$fqgitdir/gitweb/tmp";
our \$projects_list = \$projectroot;
diff --git a/git-request-pull.sh b/git-request-pull.sh
index 01640a044bb10f4167338fca957c43a240e1b6c0..10c88639e28c02650ffea3d4671afa9a9f0bb182 100755
--- a/git-request-pull.sh
+++ b/git-request-pull.sh
@@ -112,7 +112,7 @@ find_matching_ref='
}
'
-set fnord $(git ls-remote "$url" | @@PERL@@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
+set fnord $(git ls-remote "$url" | @PERL@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
remote_sha1=$2
ref=$3
diff --git a/git-send-email.perl b/git-send-email.perl
index c835d4c11af259242f1128101a15b237302c7f42..02805c43e52570fe5ae5432fb9343ce9165cc16b 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1501,7 +1501,7 @@ sub gen_header {
@recipients = unique_email_list(@recipients,@cc,@initial_bcc);
@recipients = (map { extract_valid_address_or_die($_) } @recipients);
my $date = format_2822_time($time++);
- my $gitversion = '@@GIT_VERSION@@';
+ my $gitversion = '@GIT_VERSION@';
if ($gitversion =~ m/..GIT_VERSION../) {
$gitversion = Git::version();
}
diff --git a/git-sh-i18n.sh b/git-sh-i18n.sh
index a15c0620db6893898152b1c9e363a0af7f1b304e..ae4b2d6ba9dc061ef40ef1867f0cd5e975df8fe5 100644
--- a/git-sh-i18n.sh
+++ b/git-sh-i18n.sh
@@ -9,7 +9,7 @@ TEXTDOMAIN=git
export TEXTDOMAIN
if test -z "$GIT_TEXTDOMAINDIR"
then
- TEXTDOMAINDIR="@@LOCALEDIR@@"
+ TEXTDOMAINDIR="@LOCALEDIR@"
else
TEXTDOMAINDIR="$GIT_TEXTDOMAINDIR"
fi
@@ -17,9 +17,9 @@ export TEXTDOMAINDIR
# First decide what scheme to use...
GIT_INTERNAL_GETTEXT_SH_SCHEME=fallthrough
-if test -n "@@USE_GETTEXT_SCHEME@@"
+if test -n "@USE_GETTEXT_SCHEME@"
then
- GIT_INTERNAL_GETTEXT_SH_SCHEME="@@USE_GETTEXT_SCHEME@@"
+ GIT_INTERNAL_GETTEXT_SH_SCHEME="@USE_GETTEXT_SCHEME@"
elif test -n "$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS"
then
: no probing necessary
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index ce273fe0e48d997cb067e77707026616a9302eb2..19aef72ec2553027bb25a5968d4e428ba986fdb2 100644
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -41,7 +41,7 @@ git_broken_path_fix () {
esac
}
-# @@BROKEN_PATH_FIX@@
+# @BROKEN_PATH_FIX@
# Source git-sh-i18n for gettext support.
. "$(git --exec-path)/git-sh-i18n"
@@ -154,7 +154,7 @@ git_pager() {
else
GIT_PAGER=cat
fi
- for vardef in @@PAGER_ENV@@
+ for vardef in @PAGER_ENV@
do
var=${vardef%%=*}
eval ": \"\${$vardef}\" && export $var"
@@ -280,7 +280,7 @@ get_author_ident_from_commit () {
# remove lines from $1 that are not in $2, leaving only common lines.
create_virtual_base() {
sz0=$(wc -c <"$1")
- @@DIFF@@ -u -La/"$1" -Lb/"$1" "$1" "$2" | git apply --no-add
+ @DIFF@ -u -La/"$1" -Lb/"$1" "$1" "$2" | git apply --no-add
sz1=$(wc -c <"$1")
# If we do not have enough common material, it is not
diff --git a/git-svn.perl b/git-svn.perl
index 01e7a70de1c0eb37b3feefe364ad78d4c8973097..dcf65cf1d1d4dc53b9f813f931ecff1a387c2657 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -9,7 +9,7 @@
$_revision $_repository
$_q $_authors $_authors_prog %users/;
$AUTHOR = 'Eric Wong <normalperson@yhbt.net>';
-$VERSION = '@@GIT_VERSION@@';
+$VERSION = '@GIT_VERSION@';
use Carp qw/croak/;
use File::Basename qw/dirname basename/;
diff --git a/gitweb/Makefile b/gitweb/Makefile
index 3b68ab2d672c4afae62f8f4dc024e0911027b58d..164c8d53757f98599ad14eeb22ca8d542eb7502a 100644
--- a/gitweb/Makefile
+++ b/gitweb/Makefile
@@ -79,28 +79,28 @@ GITWEB_JSLIB_FILES += static/js/blame_incremental.js
GITWEB_REPLACE = \
- -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
- -e 's|++GIT_BINDIR++|$(bindir)|g' \
- -e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \
- -e 's|++GITWEB_CONFIG_SYSTEM++|$(GITWEB_CONFIG_SYSTEM)|g' \
- -e 's|++GITWEB_CONFIG_COMMON++|$(GITWEB_CONFIG_COMMON)|g' \
- -e 's|++GITWEB_HOME_LINK_STR++|$(GITWEB_HOME_LINK_STR)|g' \
- -e 's|++GITWEB_SITENAME++|$(GITWEB_SITENAME)|g' \
- -e 's|++GITWEB_PROJECTROOT++|$(GITWEB_PROJECTROOT)|g' \
- -e 's|"++GITWEB_PROJECT_MAXDEPTH++"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
- -e 's|++GITWEB_EXPORT_OK++|$(GITWEB_EXPORT_OK)|g' \
- -e 's|++GITWEB_STRICT_EXPORT++|$(GITWEB_STRICT_EXPORT)|g' \
- -e 's|++GITWEB_BASE_URL++|$(GITWEB_BASE_URL)|g' \
- -e 's|++GITWEB_LIST++|$(GITWEB_LIST)|g' \
- -e 's|++GITWEB_HOMETEXT++|$(GITWEB_HOMETEXT)|g' \
- -e 's|++GITWEB_CSS++|$(GITWEB_CSS)|g' \
- -e 's|++GITWEB_LOGO++|$(GITWEB_LOGO)|g' \
- -e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \
- -e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \
- -e 's|++GITWEB_SITE_HTML_HEAD_STRING++|$(GITWEB_SITE_HTML_HEAD_STRING)|g' \
- -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \
- -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \
- -e 's|++HIGHLIGHT_BIN++|$(HIGHLIGHT_BIN)|g'
+ -e 's|@GIT_VERSION@|$(GIT_VERSION)|g' \
+ -e 's|@GIT_BINDIR@|$(bindir)|g' \
+ -e 's|@GITWEB_CONFIG@|$(GITWEB_CONFIG)|g' \
+ -e 's|@GITWEB_CONFIG_SYSTEM@|$(GITWEB_CONFIG_SYSTEM)|g' \
+ -e 's|@GITWEB_CONFIG_COMMON@|$(GITWEB_CONFIG_COMMON)|g' \
+ -e 's|@GITWEB_HOME_LINK_STR@|$(GITWEB_HOME_LINK_STR)|g' \
+ -e 's|@GITWEB_SITENAME@|$(GITWEB_SITENAME)|g' \
+ -e 's|@GITWEB_PROJECTROOT@|$(GITWEB_PROJECTROOT)|g' \
+ -e 's|"@GITWEB_PROJECT_MAXDEPTH@"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
+ -e 's|@GITWEB_EXPORT_OK@|$(GITWEB_EXPORT_OK)|g' \
+ -e 's|@GITWEB_STRICT_EXPORT@|$(GITWEB_STRICT_EXPORT)|g' \
+ -e 's|@GITWEB_BASE_URL@|$(GITWEB_BASE_URL)|g' \
+ -e 's|@GITWEB_LIST@|$(GITWEB_LIST)|g' \
+ -e 's|@GITWEB_HOMETEXT@|$(GITWEB_HOMETEXT)|g' \
+ -e 's|@GITWEB_CSS@|$(GITWEB_CSS)|g' \
+ -e 's|@GITWEB_LOGO@|$(GITWEB_LOGO)|g' \
+ -e 's|@GITWEB_FAVICON@|$(GITWEB_FAVICON)|g' \
+ -e 's|@GITWEB_JS@|$(GITWEB_JS)|g' \
+ -e 's|@GITWEB_SITE_HTML_HEAD_STRING@|$(GITWEB_SITE_HTML_HEAD_STRING)|g' \
+ -e 's|@GITWEB_SITE_HEADER@|$(GITWEB_SITE_HEADER)|g' \
+ -e 's|@GITWEB_SITE_FOOTER@|$(GITWEB_SITE_FOOTER)|g' \
+ -e 's|@HIGHLIGHT_BIN@|$(HIGHLIGHT_BIN)|g'
.PHONY: FORCE
$(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS: FORCE
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index b09a8d052383fdf1190f1fab008ddef99290e1f0..76e1f4e244fd23dd29b935e83753efa9c6d5bb5e 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -35,7 +35,7 @@ BEGIN
CGI->compile() if $ENV{'MOD_PERL'};
}
-our $version = "++GIT_VERSION++";
+our $version = "@GIT_VERSION@";
our ($my_url, $my_uri, $base_url, $path_info, $home_link);
sub evaluate_uri {
@@ -80,46 +80,46 @@ sub evaluate_uri {
# core git executable to use
# this can just be "git" if your webserver has a sensible PATH
-our $GIT = "++GIT_BINDIR++/git";
+our $GIT = "@GIT_BINDIR@/git";
# absolute fs-path which will be prepended to the project path
#our $projectroot = "/pub/scm";
-our $projectroot = "++GITWEB_PROJECTROOT++";
+our $projectroot = "@GITWEB_PROJECTROOT@";
# fs traversing limit for getting project list
# the number is relative to the projectroot
-our $project_maxdepth = "++GITWEB_PROJECT_MAXDEPTH++";
+our $project_maxdepth = "@GITWEB_PROJECT_MAXDEPTH@";
# string of the home link on top of all pages
-our $home_link_str = "++GITWEB_HOME_LINK_STR++";
+our $home_link_str = "@GITWEB_HOME_LINK_STR@";
# extra breadcrumbs preceding the home link
our @extra_breadcrumbs = ();
# name of your site or organization to appear in page titles
# replace this with something more descriptive for clearer bookmarks
-our $site_name = "++GITWEB_SITENAME++"
+our $site_name = "@GITWEB_SITENAME@"
|| ($ENV{'SERVER_NAME'} || "Untitled") . " Git";
# html snippet to include in the <head> section of each page
-our $site_html_head_string = "++GITWEB_SITE_HTML_HEAD_STRING++";
+our $site_html_head_string = "@GITWEB_SITE_HTML_HEAD_STRING@";
# filename of html text to include at top of each page
-our $site_header = "++GITWEB_SITE_HEADER++";
+our $site_header = "@GITWEB_SITE_HEADER@";
# html text to include at home page
-our $home_text = "++GITWEB_HOMETEXT++";
+our $home_text = "@GITWEB_HOMETEXT@";
# filename of html text to include at bottom of each page
-our $site_footer = "++GITWEB_SITE_FOOTER++";
+our $site_footer = "@GITWEB_SITE_FOOTER@";
# URI of stylesheets
-our @stylesheets = ("++GITWEB_CSS++");
+our @stylesheets = ("@GITWEB_CSS@");
# URI of a single stylesheet, which can be overridden in GITWEB_CONFIG.
our $stylesheet = undef;
# URI of GIT logo (72x27 size)
-our $logo = "++GITWEB_LOGO++";
+our $logo = "@GITWEB_LOGO@";
# URI of GIT favicon, assumed to be image/png type
-our $favicon = "++GITWEB_FAVICON++";
+our $favicon = "@GITWEB_FAVICON@";
# URI of gitweb.js (JavaScript code for gitweb)
-our $javascript = "++GITWEB_JS++";
+our $javascript = "@GITWEB_JS@";
# URI and label (title) of GIT logo link
#our $logo_url = "https://www.kernel.org/pub/software/scm/git/docs/";
@@ -128,7 +128,7 @@ sub evaluate_uri {
our $logo_label = "git homepage";
# source of projects list
-our $projects_list = "++GITWEB_LIST++";
+our $projects_list = "@GITWEB_LIST@";
# the width (in characters) of the projects list "Description" column
our $projects_list_description_width = 25;
@@ -147,7 +147,7 @@ sub evaluate_uri {
# show repository only if this file exists
# (only effective if this variable evaluates to true)
-our $export_ok = "++GITWEB_EXPORT_OK++";
+our $export_ok = "@GITWEB_EXPORT_OK@";
# don't generate age column on the projects list page
our $omit_age_column = 0;
@@ -161,11 +161,11 @@ sub evaluate_uri {
our $export_auth_hook = undef;
# only allow viewing of repositories also shown on the overview page
-our $strict_export = "++GITWEB_STRICT_EXPORT++";
+our $strict_export = "@GITWEB_STRICT_EXPORT@";
# list of git base URLs used for URL to where fetch project from,
# i.e. full URL is "$git_base_url/$project"
-our @git_base_url_list = grep { $_ ne '' } ("++GITWEB_BASE_URL++");
+our @git_base_url_list = grep { $_ ne '' } ("@GITWEB_BASE_URL@");
# default blob_plain mimetype and default charset for text/plain blob
our $default_blob_plain_mimetype = 'text/plain';
@@ -200,7 +200,7 @@ sub evaluate_uri {
# http://andre-simon.de/zip/download.php due to assumptions about parameters and output).
# Useful if highlight is not installed on your webserver's PATH.
# [Default: highlight]
-our $highlight_bin = "++HIGHLIGHT_BIN++";
+our $highlight_bin = "@HIGHLIGHT_BIN@";
# information about snapshot formats that gitweb is capable of serving
our %known_snapshot_formats = (
@@ -741,9 +741,9 @@ sub read_config_file {
our ($GITWEB_CONFIG, $GITWEB_CONFIG_SYSTEM, $GITWEB_CONFIG_COMMON);
sub evaluate_gitweb_config {
- our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "++GITWEB_CONFIG++";
- our $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || "++GITWEB_CONFIG_SYSTEM++";
- our $GITWEB_CONFIG_COMMON = $ENV{'GITWEB_CONFIG_COMMON'} || "++GITWEB_CONFIG_COMMON++";
+ our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "@GITWEB_CONFIG@";
+ our $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || "@GITWEB_CONFIG_SYSTEM@";
+ our $GITWEB_CONFIG_COMMON = $ENV{'GITWEB_CONFIG_COMMON'} || "@GITWEB_CONFIG_COMMON@";
# Protect against duplications of file names, to not read config twice.
# Only one of $GITWEB_CONFIG and $GITWEB_CONFIG_SYSTEM is used, so
diff --git a/perl/Git/I18N.pm b/perl/Git/I18N.pm
index 475e90a6df5a272d6b4d557d8d37d68e3f77dfa8..f8f0ca312543ce2d099f16354e62acbc205abe5a 100644
--- a/perl/Git/I18N.pm
+++ b/perl/Git/I18N.pm
@@ -20,14 +20,14 @@ BEGIN
# this "'@@' [...] '@@'" pattern.
use constant NO_GETTEXT_STR => '@@' . 'NO_GETTEXT' . '@@';
use constant NO_GETTEXT => (
- q[@@NO_GETTEXT@@] ne ''
+ q[@NO_GETTEXT@] ne ''
and
- q[@@NO_GETTEXT@@] ne NO_GETTEXT_STR
+ q[@NO_GETTEXT@] ne NO_GETTEXT_STR
);
sub __bootstrap_locale_messages {
our $TEXTDOMAIN = 'git';
- our $TEXTDOMAINDIR ||= $ENV{GIT_TEXTDOMAINDIR} || '@@LOCALEDIR@@';
+ our $TEXTDOMAINDIR ||= $ENV{GIT_TEXTDOMAINDIR} || '@LOCALEDIR@';
die "NO_GETTEXT=" . NO_GETTEXT_STR if NO_GETTEXT;
require POSIX;
diff --git a/perl/Git/LoadCPAN.pm b/perl/Git/LoadCPAN.pm
index 8c7fa805f97390a47366b0d0058966ee391b9df1..6be99840f84fb2fe945f969fb23f73454c6b171b 100644
--- a/perl/Git/LoadCPAN.pm
+++ b/perl/Git/LoadCPAN.pm
@@ -31,11 +31,11 @@ =head1 DESCRIPTION
# Makefile, and allows for detecting whether the module is loaded from
# perl/Git as opposed to perl/build/Git, which is useful for one-off
# testing without having Error.pm et al installed.
-use constant NO_PERL_CPAN_FALLBACKS_STR => '@@' . 'NO_PERL_CPAN_FALLBACKS' . '@@';
+use constant NO_PERL_CPAN_FALLBACKS_STR => '@' . 'NO_PERL_CPAN_FALLBACKS' . '@';
use constant NO_PERL_CPAN_FALLBACKS => (
- q[@@NO_PERL_CPAN_FALLBACKS@@] ne ''
+ q[@NO_PERL_CPAN_FALLBACKS@] ne ''
and
- q[@@NO_PERL_CPAN_FALLBACKS@@] ne NO_PERL_CPAN_FALLBACKS_STR
+ q[@NO_PERL_CPAN_FALLBACKS@] ne NO_PERL_CPAN_FALLBACKS_STR
);
sub import {
--git a/perl/header_templates/fixed_prefix.template.pl b/perl/header_templates/fixed_prefix.template.pl
index 857b4391a499394ea788a6b56773aecd5afd53c3..d571ca5cde513a98cc25e7acb52b5415b98ffe10 100644
--- a/perl/header_templates/fixed_prefix.template.pl
+++ b/perl/header_templates/fixed_prefix.template.pl
@@ -1 +1 @@
-use lib (split(/@@PATHSEP@@/, $ENV{GITPERLLIB} || '@@INSTLIBDIR@@'));
+use lib (split(/@PATHSEP@/, $ENV{GITPERLLIB} || '@INSTLIBDIR@'));
--git a/perl/header_templates/runtime_prefix.template.pl b/perl/header_templates/runtime_prefix.template.pl
index 9d28b3d8636c6c6d48ea287a5fef0f7833f6c08c..e6f8e661a164519d4fdb55429746380e84ae3fcb 100644
--- a/perl/header_templates/runtime_prefix.template.pl
+++ b/perl/header_templates/runtime_prefix.template.pl
@@ -3,7 +3,7 @@
# This finds our Git::* libraries relative to the script's runtime path.
sub __git_system_path {
my ($relpath) = @_;
- my $gitexecdir_relative = '@@GITEXECDIR_REL@@';
+ my $gitexecdir_relative = '@GITEXECDIR_REL@';
# GIT_EXEC_PATH is supplied by `git` or the test suite.
my $exec_path;
@@ -24,11 +24,11 @@ sub __git_system_path {
}
BEGIN {
- use lib split /@@PATHSEP@@/,
+ use lib split /@PATHSEP@/,
(
$ENV{GITPERLLIB} ||
do {
- my $perllibdir = __git_system_path('@@PERLLIBDIR_REL@@');
+ my $perllibdir = __git_system_path('@PERLLIBDIR_REL@');
(-e $perllibdir) || die("Invalid system path ($relpath): $path");
$perllibdir;
}
@@ -36,7 +36,7 @@ BEGIN
# Export the system locale directory to the I18N module. The locale directory
# is only installed if NO_GETTEXT is set.
- $Git::I18N::TEXTDOMAINDIR = __git_system_path('@@LOCALEDIR_REL@@');
+ $Git::I18N::TEXTDOMAINDIR = __git_system_path('@LOCALEDIR_REL@');
}
# END RUNTIME_PREFIX generated code.
diff --git a/unimplemented.sh b/unimplemented.sh
index fee21d24e8ab89208b4aa0af7007b7c033b753bc..41776b279d4263ae6a9034b30f1bd26ac9b792bd 100644
--- a/unimplemented.sh
+++ b/unimplemented.sh
@@ -1,4 +1,4 @@
#!/bin/sh
-echo >&2 "fatal: git was built without support for $(basename $0) (@@REASON@@)."
+echo >&2 "fatal: git was built without support for $(basename $0) (@REASON@)."
exit 128
diff --git a/wrap-for-bin.sh b/wrap-for-bin.sh
index 95851b85b6b7181130f0cd441c2bd7ac0bfb89da..7898a1c238dde20617cf96d144930dc59f67feab 100644
--- a/wrap-for-bin.sh
+++ b/wrap-for-bin.sh
@@ -4,33 +4,33 @@
# to run test suite against sandbox, but with only bindir-installed
# executables in PATH. The Makefile copies this into various
# files in bin-wrappers, substituting
-# @@BUILD_DIR@@ and @@PROG@@.
+# @BUILD_DIR@ and @PROG@.
-GIT_EXEC_PATH='@@BUILD_DIR@@'
+GIT_EXEC_PATH='@BUILD_DIR@'
if test -n "$NO_SET_GIT_TEMPLATE_DIR"
then
unset GIT_TEMPLATE_DIR
else
- GIT_TEMPLATE_DIR='@@BUILD_DIR@@/templates/blt'
+ GIT_TEMPLATE_DIR='@BUILD_DIR@/templates/blt'
export GIT_TEMPLATE_DIR
fi
-GITPERLLIB='@@BUILD_DIR@@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}"
-GIT_TEXTDOMAINDIR='@@BUILD_DIR@@/po/build/locale'
-PATH='@@BUILD_DIR@@/bin-wrappers:'"$PATH"
+GITPERLLIB='@BUILD_DIR@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}"
+GIT_TEXTDOMAINDIR='@BUILD_DIR@/po/build/locale'
+PATH='@BUILD_DIR@/bin-wrappers:'"$PATH"
export GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
case "$GIT_DEBUGGER" in
'')
- exec "${GIT_EXEC_PATH}/@@PROG@@" "$@"
+ exec "${GIT_EXEC_PATH}/@PROG@" "$@"
;;
1)
unset GIT_DEBUGGER
- exec gdb --args "${GIT_EXEC_PATH}/@@PROG@@" "$@"
+ exec gdb --args "${GIT_EXEC_PATH}/@PROG@" "$@"
;;
*)
GIT_DEBUGGER_ARGS="$GIT_DEBUGGER"
unset GIT_DEBUGGER
- exec ${GIT_DEBUGGER_ARGS} "${GIT_EXEC_PATH}/@@PROG@@" "$@"
+ exec ${GIT_DEBUGGER_ARGS} "${GIT_EXEC_PATH}/@PROG@" "$@"
;;
esac
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v10 03/23] Makefile: refactor GIT-VERSION-GEN to be reusable
2024-11-28 16:12 ` [PATCH v10 00/23] Modernize the build system Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 01/23] Makefile: use common template for GIT-BUILD-OPTIONS Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 02/23] Makefile: consistently use @PLACEHOLDER@ to substitute Patrick Steinhardt
@ 2024-11-28 16:12 ` Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 04/23] Makefile: propagate Git version via generated header Patrick Steinhardt
` (19 subsequent siblings)
22 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-28 16:12 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
Our "GIT-VERSION-GEN" script always writes the "GIT-VERSION-FILE" into
the current directory, where the expectation is that it should exist in
the source directory. But other build systems that support out-of-tree
builds may not want to do that to keep the source directory pristine,
even though CMake currently doesn't care.
Refactor the script such that it won't write the "GIT-VERSION-FILE"
directly anymore, but instead knows to replace @PLACEHOLDERS@ in an
arbitrary input file. This allows us to simplify the logic in CMake to
determine the project version, but can also be reused later on in order
to generate other files that need to contain version information like
our "git.rc" file.
While at it, change the format of the version file by removing the
spaces around the equals sign. Like this we can continue to include the
file in our Makefiles, but can also start to source it in shell scripts
in subsequent steps.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-VERSION-FILE.in | 1 +
GIT-VERSION-GEN | 61 ++++++++++++++++++++++++++++---------
Makefile | 5 ++-
ci/test-documentation.sh | 2 +-
contrib/buildsystems/CMakeLists.txt | 23 ++++----------
contrib/buildsystems/git-version.in | 1 +
6 files changed, 59 insertions(+), 34 deletions(-)
diff --git a/GIT-VERSION-FILE.in b/GIT-VERSION-FILE.in
new file mode 100644
index 0000000000000000000000000000000000000000..3789a48a34a3f9e37531fc24b577ffe3c657a3e9
--- /dev/null
+++ b/GIT-VERSION-FILE.in
@@ -0,0 +1 @@
+GIT_VERSION=@GIT_VERSION@
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index 78e8631f677bbebe8f18d83191f0fd014465563e..7afc7aad1413d552cbadc68b7582ba639faa4d8a 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -1,23 +1,48 @@
#!/bin/sh
-GVF=GIT-VERSION-FILE
DEF_VER=v2.47.GIT
LF='
'
+if test "$#" -ne 3
+then
+ echo >&2 "USAGE: $0 <SOURCE_DIR> <INPUT> <OUTPUT>"
+ exit 1
+fi
+
+SOURCE_DIR="$1"
+INPUT="$2"
+OUTPUT="$3"
+
+if ! test -f "$INPUT"
+then
+ echo >&2 "Input is not a file: $INPUT"
+ exit 1
+fi
+
+# Protect us from reading Git version information outside of the Git directory
+# in case it is not a repository itself, but embedded in an unrelated
+# repository.
+GIT_CEILING_DIRECTORIES="$SOURCE_DIR/.."
+export GIT_CEILING_DIRECTORIES
+
# First see if there is a version file (included in release tarballs),
# then try git-describe, then default.
-if test -f version
+if test -f "$SOURCE_DIR"/version
then
- VN=$(cat version) || VN="$DEF_VER"
-elif { test -d "${GIT_DIR:-.git}" || test -f .git; } &&
- VN=$(git describe --match "v[0-9]*" HEAD 2>/dev/null) &&
+ VN=$(cat "$SOURCE_DIR"/version) || VN="$DEF_VER"
+elif {
+ test -d "$SOURCE_DIR/.git" ||
+ test -d "${GIT_DIR:-.git}" ||
+ test -f "$SOURCE_DIR"/.git;
+ } &&
+ VN=$(git -C "$SOURCE_DIR" describe --match "v[0-9]*" HEAD 2>/dev/null) &&
case "$VN" in
*$LF*) (exit 1) ;;
v[0-9]*)
- git update-index -q --refresh
- test -z "$(git diff-index --name-only HEAD --)" ||
+ git -C "$SOURCE_DIR" update-index -q --refresh
+ test -z "$(git -C "$SOURCE_DIR" diff-index --name-only HEAD --)" ||
VN="$VN-dirty" ;;
esac
then
@@ -26,15 +51,21 @@ else
VN="$DEF_VER"
fi
-VN=$(expr "$VN" : v*'\(.*\)')
+GIT_VERSION=$(expr "$VN" : v*'\(.*\)')
+
+read GIT_MAJOR_VERSION GIT_MINOR_VERSION GIT_MICRO_VERSION trailing <<EOF
+$(echo "$GIT_VERSION" 0 0 0 | tr '.a-zA-Z-' ' ')
+EOF
+
+sed -e "s|@GIT_VERSION@|$GIT_VERSION|" \
+ -e "s|@GIT_MAJOR_VERSION@|$GIT_MAJOR_VERSION|" \
+ -e "s|@GIT_MINOR_VERSION@|$GIT_MINOR_VERSION|" \
+ -e "s|@GIT_MICRO_VERSION@|$GIT_MICRO_VERSION|" \
+ "$INPUT" >"$OUTPUT"+
-if test -r $GVF
+if ! test -f "$OUTPUT" || ! cmp "$OUTPUT"+ "$OUTPUT" >/dev/null
then
- VC=$(sed -e 's/^GIT_VERSION = //' <$GVF)
+ mv "$OUTPUT"+ "$OUTPUT"
else
- VC=unset
+ rm "$OUTPUT"+
fi
-test "$VN" = "$VC" || {
- echo >&2 "GIT_VERSION = $VN"
- echo "GIT_VERSION = $VN" >$GVF
-}
diff --git a/Makefile b/Makefile
index 75e26d2e312f186bd5a0e3b48fb38850613bca4b..73510d6bcbc9ca60d45b70459f9e1c79f19b4c09 100644
--- a/Makefile
+++ b/Makefile
@@ -592,7 +592,10 @@ include shared.mak
# Disable -pedantic compilation.
GIT-VERSION-FILE: FORCE
- @$(SHELL_PATH) ./GIT-VERSION-GEN
+ @OLD=$$(cat $@ 2>/dev/null || :) && \
+ $(SHELL_PATH) ./GIT-VERSION-GEN "$(shell pwd)" GIT-VERSION-FILE.in $@ && \
+ NEW=$$(cat $@ 2>/dev/null || :) && \
+ if test "$$OLD" != "$$NEW"; then echo "$$NEW" >&2; fi
-include GIT-VERSION-FILE
# Set our default configuration.
diff --git a/ci/test-documentation.sh b/ci/test-documentation.sh
index 02b3af394117f840e078479ca60030141e47f998..6c018b673e0563fa5589195a77804c91deb93515 100755
--- a/ci/test-documentation.sh
+++ b/ci/test-documentation.sh
@@ -6,7 +6,7 @@
. ${0%/*}/lib.sh
filter_log () {
- sed -e '/^GIT_VERSION = /d' \
+ sed -e '/^GIT_VERSION=/d' \
-e "/constant Gem::ConfigMap is deprecated/d" \
-e '/^ \* new asciidoc flags$/d' \
-e '/stripped namespace before processing/d' \
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 1abf5f099c1c6735ae7aec345de96bf623e2aa18..376d748ce9021710eb72258ab3b9bac52950a933 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -83,23 +83,12 @@ if(NOT SH_EXE)
"On Windows, you can get it as part of 'Git for Windows' install at https://gitforwindows.org/")
endif()
-#Create GIT-VERSION-FILE using GIT-VERSION-GEN
-if(NOT EXISTS ${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE)
- message("Generating GIT-VERSION-FILE")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
-endif()
-
-#Parse GIT-VERSION-FILE to get the version
-file(STRINGS ${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE git_version REGEX "GIT_VERSION = (.*)")
-string(REPLACE "GIT_VERSION = " "" git_version ${git_version})
-string(FIND ${git_version} "GIT" location)
-if(location EQUAL -1)
- string(REGEX MATCH "[0-9]*\\.[0-9]*\\.[0-9]*" git_version ${git_version})
-else()
- string(REGEX MATCH "[0-9]*\\.[0-9]*" git_version ${git_version})
- string(APPEND git_version ".0") #for building from a snapshot
-endif()
+message("Generating Git version")
+execute_process(COMMAND ${SH_EXE} "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_SOURCE_DIR}/contrib/buildsystems/git-version.in"
+ "${CMAKE_BINARY_DIR}/git-version")
+file(STRINGS "${CMAKE_BINARY_DIR}/git-version" git_version)
project(git
VERSION ${git_version}
diff --git a/contrib/buildsystems/git-version.in b/contrib/buildsystems/git-version.in
new file mode 100644
index 0000000000000000000000000000000000000000..9750505ae77685ebb31a38468caaf13501b6739d
--- /dev/null
+++ b/contrib/buildsystems/git-version.in
@@ -0,0 +1 @@
+@GIT_MAJOR_VERSION@.@GIT_MINOR_VERSION@.@GIT_MICRO_VERSION@
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v10 04/23] Makefile: propagate Git version via generated header
2024-11-28 16:12 ` [PATCH v10 00/23] Modernize the build system Patrick Steinhardt
` (2 preceding siblings ...)
2024-11-28 16:12 ` [PATCH v10 03/23] Makefile: refactor GIT-VERSION-GEN to be reusable Patrick Steinhardt
@ 2024-11-28 16:12 ` Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 05/23] Makefile: generate "git.rc" via GIT-VERSION-GEN Patrick Steinhardt
` (18 subsequent siblings)
22 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-28 16:12 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
We set up a couple of preprocessor macros when compiling Git that
propagate the version that Git was built from to `git version` et al.
The way this is set up makes it harder than necessary to reuse the
infrastructure across the different build systems.
Refactor this such that we generate a "version-def.h" header via
`GIT-VERSION-GEN` instead.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
.gitignore | 1 +
GIT-VERSION-GEN | 7 +++++++
Makefile | 13 ++++++-------
contrib/buildsystems/CMakeLists.txt | 16 ++++++++++++----
version-def.h.in | 8 ++++++++
version.c | 1 +
6 files changed, 35 insertions(+), 11 deletions(-)
diff --git a/.gitignore b/.gitignore
index 6687bd6db4c0a6adf02292a9cb545d3e5270e2b0..e17963e84252fa094c10f5e84c0e3724153c819c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -195,6 +195,7 @@
/config-list.h
/command-list.h
/hook-list.h
+/version-def.h
*.tar.gz
*.dsc
*.deb
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index 7afc7aad1413d552cbadc68b7582ba639faa4d8a..c18f24e515436b71ef40120b88b6fbb0b5621c01 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -52,6 +52,11 @@ else
fi
GIT_VERSION=$(expr "$VN" : v*'\(.*\)')
+GIT_BUILT_FROM_COMMIT=$(git -C "$SOURCE_DIR" rev-parse -q --verify HEAD 2>/dev/null)
+if test -z "$GIT_USER_AGENT"
+then
+ GIT_USER_AGENT="git/$GIT_VERSION"
+fi
read GIT_MAJOR_VERSION GIT_MINOR_VERSION GIT_MICRO_VERSION trailing <<EOF
$(echo "$GIT_VERSION" 0 0 0 | tr '.a-zA-Z-' ' ')
@@ -61,6 +66,8 @@ sed -e "s|@GIT_VERSION@|$GIT_VERSION|" \
-e "s|@GIT_MAJOR_VERSION@|$GIT_MAJOR_VERSION|" \
-e "s|@GIT_MINOR_VERSION@|$GIT_MINOR_VERSION|" \
-e "s|@GIT_MICRO_VERSION@|$GIT_MICRO_VERSION|" \
+ -e "s|@GIT_BUILT_FROM_COMMIT@|$GIT_BUILT_FROM_COMMIT|" \
+ -e "s|@GIT_USER_AGENT@|$GIT_USER_AGENT|" \
"$INPUT" >"$OUTPUT"+
if ! test -f "$OUTPUT" || ! cmp "$OUTPUT"+ "$OUTPUT" >/dev/null
diff --git a/Makefile b/Makefile
index 73510d6bcbc9ca60d45b70459f9e1c79f19b4c09..7150ffc39c1b444a2c4775382f943c603490d54e 100644
--- a/Makefile
+++ b/Makefile
@@ -2508,13 +2508,11 @@ PAGER_ENV_CQ_SQ = $(subst ','\'',$(PAGER_ENV_CQ))
pager.sp pager.s pager.o: EXTRA_CPPFLAGS = \
-DPAGER_ENV='$(PAGER_ENV_CQ_SQ)'
-version.sp version.s version.o: GIT-VERSION-FILE GIT-USER-AGENT
-version.sp version.s version.o: EXTRA_CPPFLAGS = \
- '-DGIT_VERSION="$(GIT_VERSION)"' \
- '-DGIT_USER_AGENT=$(GIT_USER_AGENT_CQ_SQ)' \
- '-DGIT_BUILT_FROM_COMMIT="$(shell \
- GIT_CEILING_DIRECTORIES="$(CURDIR)/.." \
- git rev-parse -q --verify HEAD 2>/dev/null)"'
+version-def.h: version-def.h.in GIT-VERSION-GEN GIT-VERSION-FILE GIT-USER-AGENT
+ $(QUIET_GEN)GIT_USER_AGENT="$(GIT_USER_AGENT)" $(SHELL_PATH) ./GIT-VERSION-GEN "$(shell pwd)" $< $@+
+ @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
+
+version.sp version.s version.o: version-def.h
$(BUILT_INS): git$X
$(QUIET_BUILT_IN)$(RM) $@ && \
@@ -3728,6 +3726,7 @@ clean: profile-clean coverage-clean cocciclean
$(RM) $(FUZZ_PROGRAMS)
$(RM) $(SP_OBJ)
$(RM) $(HCC)
+ $(RM) version-def.h
$(RM) -r bin-wrappers $(dep_dirs) $(compdb_dir) compile_commands.json
$(RM) -r po/build/
$(RM) *.pyc *.pyo */*.pyc */*.pyo $(GENERATED_H) $(ETAGS_TARGET) tags cscope*
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 376d748ce9021710eb72258ab3b9bac52950a933..3cc5e318190292dd66981aa8593e7bd2739eea1d 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -229,10 +229,7 @@ add_compile_definitions(PAGER_ENV="LESS=FRX LV=-c"
GIT_HTML_PATH="share/doc/git-doc"
DEFAULT_HELP_FORMAT="html"
DEFAULT_GIT_TEMPLATE_DIR="share/git-core/templates"
- GIT_VERSION="${PROJECT_VERSION}.GIT"
- GIT_USER_AGENT="git/${PROJECT_VERSION}.GIT"
- BINDIR="bin"
- GIT_BUILT_FROM_COMMIT="")
+ BINDIR="bin")
if(WIN32)
set(FALLBACK_RUNTIME_PREFIX /mingw64)
@@ -668,6 +665,17 @@ parse_makefile_for_sources(libgit_SOURCES "LIB_OBJS")
list(TRANSFORM libgit_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
list(TRANSFORM compat_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
+
+add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/version-def.h"
+ COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_SOURCE_DIR}/version-def.h.in"
+ "${CMAKE_BINARY_DIR}/version-def.h"
+ DEPENDS "${SH_EXE}" "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
+ "${CMAKE_SOURCE_DIR}/version-def.h.in"
+ VERBATIM)
+list(APPEND libgit_SOURCES "${CMAKE_BINARY_DIR}/version-def.h")
+
add_library(libgit ${libgit_SOURCES} ${compat_SOURCES})
#libxdiff
diff --git a/version-def.h.in b/version-def.h.in
new file mode 100644
index 0000000000000000000000000000000000000000..347995df0611e19428cf96ec9539f0dcfea999d2
--- /dev/null
+++ b/version-def.h.in
@@ -0,0 +1,8 @@
+#ifndef VERSION_DEF_H
+#define VERSION_DEF_H
+
+#define GIT_VERSION "@GIT_VERSION@"
+#define GIT_BUILT_FROM_COMMIT "@GIT_BUILT_FROM_COMMIT@"
+#define GIT_USER_AGENT "@GIT_USER_AGENT@"
+
+#endif /* VERSION_DEF_H */
diff --git a/version.c b/version.c
index 41b718c29e1b9fc2981d7d14a3d25e69c31a3030..7adc4d51ff25a0841607c21807deaf20721252de 100644
--- a/version.c
+++ b/version.c
@@ -1,5 +1,6 @@
#include "git-compat-util.h"
#include "version.h"
+#include "version-def.h"
#include "strbuf.h"
const char git_version_string[] = GIT_VERSION;
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v10 05/23] Makefile: generate "git.rc" via GIT-VERSION-GEN
2024-11-28 16:12 ` [PATCH v10 00/23] Modernize the build system Patrick Steinhardt
` (3 preceding siblings ...)
2024-11-28 16:12 ` [PATCH v10 04/23] Makefile: propagate Git version via generated header Patrick Steinhardt
@ 2024-11-28 16:12 ` Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 06/23] Makefile: generate doc versions " Patrick Steinhardt
` (17 subsequent siblings)
22 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-28 16:12 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
The "git.rc" is used on Windows to embed information like the project
name and version into the resulting executables. As such we need to
inject the version information, which we do by using preprocessor
defines. The logic to do so is non-trivial and needs to be kept in sync
with the different build systems.
Refactor the logic so that we generate "git.rc" via `GIT-VERSION-GEN`.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
.gitignore | 1 +
GIT-VERSION-GEN | 8 ++++++--
Makefile | 13 +++++++------
contrib/buildsystems/CMakeLists.txt | 19 +++++++++++++------
git.rc => git.rc.in | 6 +++---
5 files changed, 30 insertions(+), 17 deletions(-)
diff --git a/.gitignore b/.gitignore
index e17963e84252fa094c10f5e84c0e3724153c819c..d3be460040c6120d862a25dff1abd325b93b37fd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -199,6 +199,7 @@
*.tar.gz
*.dsc
*.deb
+/git.rc
/git.spec
*.exe
*.[aos]
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index c18f24e515436b71ef40120b88b6fbb0b5621c01..a1c8146f05cfa7fbc6c47804aec5fb848e67c69c 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -58,14 +58,18 @@ then
GIT_USER_AGENT="git/$GIT_VERSION"
fi
-read GIT_MAJOR_VERSION GIT_MINOR_VERSION GIT_MICRO_VERSION trailing <<EOF
-$(echo "$GIT_VERSION" 0 0 0 | tr '.a-zA-Z-' ' ')
+# While released Git versions only have three numbers, development builds also
+# have a fourth number that corresponds to the number of patches since the last
+# release.
+read GIT_MAJOR_VERSION GIT_MINOR_VERSION GIT_MICRO_VERSION GIT_PATCH_LEVEL trailing <<EOF
+$(echo "$GIT_VERSION" 0 0 0 0 | tr '.a-zA-Z-' ' ')
EOF
sed -e "s|@GIT_VERSION@|$GIT_VERSION|" \
-e "s|@GIT_MAJOR_VERSION@|$GIT_MAJOR_VERSION|" \
-e "s|@GIT_MINOR_VERSION@|$GIT_MINOR_VERSION|" \
-e "s|@GIT_MICRO_VERSION@|$GIT_MICRO_VERSION|" \
+ -e "s|@GIT_PATCH_LEVEL@|$GIT_PATCH_LEVEL|" \
-e "s|@GIT_BUILT_FROM_COMMIT@|$GIT_BUILT_FROM_COMMIT|" \
-e "s|@GIT_USER_AGENT@|$GIT_USER_AGENT|" \
"$INPUT" >"$OUTPUT"+
diff --git a/Makefile b/Makefile
index 7150ffc39c1b444a2c4775382f943c603490d54e..1255d222c2dec9a034dee2621192bf97afe905ee 100644
--- a/Makefile
+++ b/Makefile
@@ -2568,11 +2568,12 @@ $(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEFINES
$(QUIET_GEN)$(cmd_munge_script) && \
mv $@+ $@
-git.res: git.rc GIT-VERSION-FILE GIT-PREFIX
- $(QUIET_RC)$(RC) \
- $(join -DMAJOR= -DMINOR= -DMICRO= -DPATCHLEVEL=, $(wordlist 1, 4, \
- $(shell echo $(GIT_VERSION) 0 0 0 0 | tr '.a-zA-Z-' ' '))) \
- -DGIT_VERSION="\\\"$(GIT_VERSION)\\\"" -i $< -o $@
+git.rc: git.rc.in GIT-VERSION-GEN GIT-VERSION-FILE
+ $(QUIET_GEN)$(SHELL_PATH) ./GIT-VERSION-GEN "$(shell pwd)" $< $@+
+ @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
+
+git.res: git.rc GIT-PREFIX
+ $(QUIET_RC)$(RC) -i $< -o $@
# This makes sure we depend on the NO_PERL setting itself.
$(SCRIPT_PERL_GEN): GIT-BUILD-OPTIONS
@@ -3717,7 +3718,7 @@ clean: profile-clean coverage-clean cocciclean
$(RM) -r .build $(UNIT_TEST_BIN)
$(RM) GIT-TEST-SUITES
$(RM) po/git.pot po/git-core.pot
- $(RM) git.res
+ $(RM) git.rc git.res
$(RM) $(OBJECTS)
$(RM) headless-git.o
$(RM) $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB)
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 3cc5e318190292dd66981aa8593e7bd2739eea1d..865b3af9fb2c1e7bdc1e7cecd0f021ee460971dd 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -691,18 +691,25 @@ list(TRANSFORM reftable_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
add_library(reftable STATIC ${reftable_SOURCES})
if(WIN32)
+ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/git.rc
+ COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_SOURCE_DIR}/git.rc.in"
+ "${CMAKE_BINARY_DIR}/git.rc"
+ DEPENDS "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
+ "${CMAKE_SOURCE_DIR}/git.rc.in"
+ VERBATIM)
+
if(NOT MSVC)#use windres when compiling with gcc and clang
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/git.res
- COMMAND ${WINDRES_EXE} -O coff -DMAJOR=${PROJECT_VERSION_MAJOR} -DMINOR=${PROJECT_VERSION_MINOR}
- -DMICRO=${PROJECT_VERSION_PATCH} -DPATCHLEVEL=0 -DGIT_VERSION="\\\"${PROJECT_VERSION}.GIT\\\""
- -i ${CMAKE_SOURCE_DIR}/git.rc -o ${CMAKE_BINARY_DIR}/git.res
+ COMMAND ${WINDRES_EXE} -O coff -i ${CMAKE_BINARY_DIR}/git.rc -o ${CMAKE_BINARY_DIR}/git.res
+ DEPENDS "${CMAKE_BINARY_DIR}/git.rc"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
VERBATIM)
else()#MSVC use rc
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/git.res
- COMMAND ${CMAKE_RC_COMPILER} /d MAJOR=${PROJECT_VERSION_MAJOR} /d MINOR=${PROJECT_VERSION_MINOR}
- /d MICRO=${PROJECT_VERSION_PATCH} /d PATCHLEVEL=0 /d GIT_VERSION="${PROJECT_VERSION}.GIT"
- /fo ${CMAKE_BINARY_DIR}/git.res ${CMAKE_SOURCE_DIR}/git.rc
+ COMMAND ${CMAKE_RC_COMPILER} /fo ${CMAKE_BINARY_DIR}/git.res ${CMAKE_BINARY_DIR}/git.rc
+ DEPENDS "${CMAKE_BINARY_DIR}/git.rc"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
VERBATIM)
endif()
diff --git a/git.rc b/git.rc.in
similarity index 67%
rename from git.rc
rename to git.rc.in
index cc3fdc6cc6cb83b084eebe2ad49f3c78c981789b..e69444eef3f0c558707e067d52820668d2116308 100644
--- a/git.rc
+++ b/git.rc.in
@@ -1,6 +1,6 @@
1 VERSIONINFO
-FILEVERSION MAJOR,MINOR,MICRO,PATCHLEVEL
-PRODUCTVERSION MAJOR,MINOR,MICRO,PATCHLEVEL
+FILEVERSION @GIT_MAJOR_VERSION@,@GIT_MINOR_VERSION@,@GIT_MICRO_VERSION@,@GIT_PATCH_LEVEL@
+PRODUCTVERSION @GIT_MAJOR_VERSION@,@GIT_MINOR_VERSION@,@GIT_MICRO_VERSION@,@GIT_PATCH_LEVEL@
BEGIN
BLOCK "StringFileInfo"
BEGIN
@@ -11,7 +11,7 @@ BEGIN
VALUE "InternalName", "git\0"
VALUE "OriginalFilename", "git.exe\0"
VALUE "ProductName", "Git\0"
- VALUE "ProductVersion", GIT_VERSION "\0"
+ VALUE "ProductVersion", "@GIT_VERSION@\0"
END
END
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v10 06/23] Makefile: generate doc versions via GIT-VERSION-GEN
2024-11-28 16:12 ` [PATCH v10 00/23] Modernize the build system Patrick Steinhardt
` (4 preceding siblings ...)
2024-11-28 16:12 ` [PATCH v10 05/23] Makefile: generate "git.rc" via GIT-VERSION-GEN Patrick Steinhardt
@ 2024-11-28 16:12 ` Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 07/23] Makefile: consistently use PERL_PATH Patrick Steinhardt
` (16 subsequent siblings)
22 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-28 16:12 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
The documentation we generate embeds information for the exact Git
version used as well as the date of the commit. This information is
injected by injecting attributes into the build process via command line
argument.
Refactor the logic so that we write the information into "asciidoc.conf"
and "asciidoctor-extensions.rb" via `GIT-VERSION-GEN` for AsciiDoc and
AsciiDoctor, respectively.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Documentation/.gitignore | 2 ++
Documentation/Makefile | 21 ++++++++++++++-------
Documentation/{asciidoc.conf => asciidoc.conf.in} | 3 +++
...r-extensions.rb => asciidoctor-extensions.rb.in} | 8 ++------
GIT-VERSION-GEN | 2 ++
5 files changed, 23 insertions(+), 13 deletions(-)
diff --git a/Documentation/.gitignore b/Documentation/.gitignore
index a48448de32f98b1a054b36e886ea920bccebc494..649df89474d357ccc91109b5c35fe2d0910f968a 100644
--- a/Documentation/.gitignore
+++ b/Documentation/.gitignore
@@ -15,3 +15,5 @@ tmp-doc-diff/
GIT-ASCIIDOCFLAGS
/.build/
/GIT-EXCLUDED-PROGRAMS
+/asciidoc.conf
+/asciidoctor-extensions.rb
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 0f55baa252fffbcd506f0c6f410b26b37f2e9b11..495c61c85ed18bc9c4643f9e5478e5146bb5f196 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -1,6 +1,8 @@
# Import tree-wide shared Makefile behavior and libraries
include ../shared.mak
+.PHONY: FORCE
+
# Guard against environment variables
MAN1_TXT =
MAN5_TXT =
@@ -148,16 +150,12 @@ man5dir = $(mandir)/man5
man7dir = $(mandir)/man7
# DESTDIR =
-GIT_DATE := $(shell git show --quiet --pretty='%as')
-
ASCIIDOC = asciidoc
ASCIIDOC_EXTRA =
ASCIIDOC_HTML = xhtml11
ASCIIDOC_DOCBOOK = docbook
ASCIIDOC_CONF = -f asciidoc.conf
-ASCIIDOC_COMMON = $(ASCIIDOC) $(ASCIIDOC_EXTRA) $(ASCIIDOC_CONF) \
- -amanmanual='Git Manual' -amansource='Git $(GIT_VERSION)' \
- -arevdate='$(GIT_DATE)'
+ASCIIDOC_COMMON = $(ASCIIDOC) $(ASCIIDOC_EXTRA) $(ASCIIDOC_CONF)
ASCIIDOC_DEPS = asciidoc.conf GIT-ASCIIDOCFLAGS
TXT_TO_HTML = $(ASCIIDOC_COMMON) -b $(ASCIIDOC_HTML)
TXT_TO_XML = $(ASCIIDOC_COMMON) -b $(ASCIIDOC_DOCBOOK)
@@ -210,6 +208,14 @@ ASCIIDOC_DEPS = asciidoctor-extensions.rb GIT-ASCIIDOCFLAGS
DBLATEX_COMMON =
XMLTO_EXTRA += --skip-validation
XMLTO_EXTRA += -x manpage.xsl
+
+asciidoctor-extensions.rb: asciidoctor-extensions.rb.in FORCE
+ $(QUIET_GEN)GIT_USER_AGENT="$(GIT_USER_AGENT)" $(SHELL_PATH) ../GIT-VERSION-GEN "$(shell pwd)/.." $< $@+
+ @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
+else
+asciidoc.conf: asciidoc.conf.in FORCE
+ $(QUIET_GEN)GIT_USER_AGENT="$(GIT_USER_AGENT)" $(SHELL_PATH) ../GIT-VERSION-GEN "$(shell pwd)/.." $< $@+
+ @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
endif
ASCIIDOC_DEPS += docinfo.html
@@ -341,6 +347,7 @@ clean:
$(RM) SubmittingPatches.txt
$(RM) $(cmds_txt) $(mergetools_txt) *.made
$(RM) GIT-ASCIIDOCFLAGS
+ $(RM) asciidoc.conf asciidoctor-extensions.rb
docinfo.html: docinfo-html.in
$(QUIET_GEN)$(RM) $@ && cat $< >$@
@@ -364,7 +371,7 @@ manpage-cmd = $(QUIET_XMLTO)$(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
%.xml : %.txt $(ASCIIDOC_DEPS)
$(QUIET_ASCIIDOC)$(TXT_TO_XML) -d manpage -o $@ $<
-user-manual.xml: user-manual.txt user-manual.conf asciidoctor-extensions.rb GIT-ASCIIDOCFLAGS
+user-manual.xml: user-manual.txt user-manual.conf $(ASCIIDOC_DEPS)
$(QUIET_ASCIIDOC)$(TXT_TO_XML) -d book -o $@ $<
technical/api-index.txt: technical/api-index-skel.txt \
@@ -373,7 +380,7 @@ technical/api-index.txt: technical/api-index-skel.txt \
technical/%.html: ASCIIDOC_EXTRA += -a git-relative-html-prefix=../
$(patsubst %,%.html,$(API_DOCS) technical/api-index $(TECH_DOCS)): %.html : %.txt \
- asciidoc.conf GIT-ASCIIDOCFLAGS
+ $(ASCIIDOC_DEPS)
$(QUIET_ASCIIDOC)$(TXT_TO_HTML) $*.txt
SubmittingPatches.txt: SubmittingPatches
diff --git a/Documentation/asciidoc.conf b/Documentation/asciidoc.conf.in
similarity index 97%
rename from Documentation/asciidoc.conf
rename to Documentation/asciidoc.conf.in
index f6da6d1fbd2b208b072c1158dfcfb29c6c01f93a..dbe36a52eabfabef59e31d3be6518549e4f90206 100644
--- a/Documentation/asciidoc.conf
+++ b/Documentation/asciidoc.conf.in
@@ -21,6 +21,9 @@ tilde=~
apostrophe='
backtick=`
litdd=--
+manmanual='Git Manual'
+mansource='Git @GIT_VERSION@'
+revdate='@GIT_DATE@'
ifdef::backend-docbook[]
[linkgit-inlinemacro]
diff --git a/Documentation/asciidoctor-extensions.rb b/Documentation/asciidoctor-extensions.rb.in
similarity index 92%
rename from Documentation/asciidoctor-extensions.rb
rename to Documentation/asciidoctor-extensions.rb.in
index cb24480b63d2ecc5c4ef267f4c501da53fc5b5be..c4c200dace85cf0a89dbc0f54ef25e4d1b6fec4d 100644
--- a/Documentation/asciidoctor-extensions.rb
+++ b/Documentation/asciidoctor-extensions.rb.in
@@ -29,13 +29,9 @@ module Git
class DocumentPostProcessor < Asciidoctor::Extensions::Postprocessor
def process document, output
if document.basebackend? 'docbook'
- mansource = document.attributes['mansource']
- manversion = document.attributes['manversion']
- manmanual = document.attributes['manmanual']
new_tags = "" \
- "<refmiscinfo class=\"source\">#{mansource}</refmiscinfo>\n" \
- "<refmiscinfo class=\"version\">#{manversion}</refmiscinfo>\n" \
- "<refmiscinfo class=\"manual\">#{manmanual}</refmiscinfo>\n"
+ "<refmiscinfo class=\"source\">@GIT_VERSION@</refmiscinfo>\n" \
+ "<refmiscinfo class=\"manual\">Git Manual</refmiscinfo>\n"
output = output.sub(/<\/refmeta>/, new_tags + "</refmeta>")
end
output
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index a1c8146f05cfa7fbc6c47804aec5fb848e67c69c..b4687784c1c348b6efb110c5e8b935b788723f59 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -53,6 +53,7 @@ fi
GIT_VERSION=$(expr "$VN" : v*'\(.*\)')
GIT_BUILT_FROM_COMMIT=$(git -C "$SOURCE_DIR" rev-parse -q --verify HEAD 2>/dev/null)
+GIT_DATE=$(git -C "$SOURCE_DIR" show --quiet --format='%as' 2>/dev/null)
if test -z "$GIT_USER_AGENT"
then
GIT_USER_AGENT="git/$GIT_VERSION"
@@ -72,6 +73,7 @@ sed -e "s|@GIT_VERSION@|$GIT_VERSION|" \
-e "s|@GIT_PATCH_LEVEL@|$GIT_PATCH_LEVEL|" \
-e "s|@GIT_BUILT_FROM_COMMIT@|$GIT_BUILT_FROM_COMMIT|" \
-e "s|@GIT_USER_AGENT@|$GIT_USER_AGENT|" \
+ -e "s|@GIT_DATE@|$GIT_DATE|" \
"$INPUT" >"$OUTPUT"+
if ! test -f "$OUTPUT" || ! cmp "$OUTPUT"+ "$OUTPUT" >/dev/null
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v10 07/23] Makefile: consistently use PERL_PATH
2024-11-28 16:12 ` [PATCH v10 00/23] Modernize the build system Patrick Steinhardt
` (5 preceding siblings ...)
2024-11-28 16:12 ` [PATCH v10 06/23] Makefile: generate doc versions " Patrick Steinhardt
@ 2024-11-28 16:12 ` Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 08/23] Makefile: extract script to massage Perl scripts Patrick Steinhardt
` (15 subsequent siblings)
22 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-28 16:12 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
When injecting the Perl path into our scripts we sometimes use '@PERL@'
while we othertimes use '@PERL_PATH@'. Refactor the code use the latter
consistently, which makes it easier to reuse the same logic for multiple
scripts.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 2 +-
contrib/buildsystems/CMakeLists.txt | 2 +-
git-instaweb.sh | 4 ++--
git-request-pull.sh | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile
index 1255d222c2dec9a034dee2621192bf97afe905ee..0e289d1dbcbfa48e4566fb3e6d4eedd87ae2d141 100644
--- a/Makefile
+++ b/Makefile
@@ -2554,7 +2554,7 @@ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's/@USE_GETTEXT_SCHEME@/$(USE_GETTEXT_SCHEME)/g' \
-e $(BROKEN_PATH_FIX) \
-e 's|@GITWEBDIR@|$(gitwebdir_SQ)|g' \
- -e 's|@PERL@|$(PERL_PATH_SQ)|g' \
+ -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' \
-e 's|@PAGER_ENV@|$(PAGER_ENV_SQ)|g' \
$@.sh >$@+
endef
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 865b3af9fb2c1e7bdc1e7cecd0f021ee460971dd..ecaae8965cd43d4a5a36201b8760296b52147dc2 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -846,7 +846,7 @@ foreach(script ${git_shell_scripts})
string(REPLACE "@NO_CURL@" "" content "${content}")
string(REPLACE "@USE_GETTEXT_SCHEME@" "" content "${content}")
string(REPLACE "# @BROKEN_PATH_FIX@" "" content "${content}")
- string(REPLACE "@PERL@" "${PERL_PATH}" content "${content}")
+ string(REPLACE "@PERL_PATH@" "${PERL_PATH}" content "${content}")
string(REPLACE "@PAGER_ENV@" "LESS=FRX LV=-c" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
endforeach()
diff --git a/git-instaweb.sh b/git-instaweb.sh
index c8efb1205a8e2a66a6aced840980978897e122bc..5ad50160bb035885d8c180bee3ebb0a8e9622abc 100755
--- a/git-instaweb.sh
+++ b/git-instaweb.sh
@@ -3,7 +3,7 @@
# Copyright (c) 2006 Eric Wong
#
-PERL='@PERL@'
+PERL='@PERL_PATH@'
OPTIONS_KEEPDASHDASH=
OPTIONS_STUCKLONG=
OPTIONS_SPEC="\
@@ -716,7 +716,7 @@ EOF
gitweb_conf() {
cat > "$fqgitdir/gitweb/gitweb_config.perl" <<EOF
-#!@PERL@
+#!@PERL_PATH@
our \$projectroot = "$(dirname "$fqgitdir")";
our \$git_temp = "$fqgitdir/gitweb/tmp";
our \$projects_list = \$projectroot;
diff --git a/git-request-pull.sh b/git-request-pull.sh
index 10c88639e28c02650ffea3d4671afa9a9f0bb182..775ba8ea11aa0fce90ae9bfaea8eac5b8bc584a4 100755
--- a/git-request-pull.sh
+++ b/git-request-pull.sh
@@ -112,7 +112,7 @@ find_matching_ref='
}
'
-set fnord $(git ls-remote "$url" | @PERL@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
+set fnord $(git ls-remote "$url" | @PERL_PATH@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
remote_sha1=$2
ref=$3
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v10 08/23] Makefile: extract script to massage Perl scripts
2024-11-28 16:12 ` [PATCH v10 00/23] Modernize the build system Patrick Steinhardt
` (6 preceding siblings ...)
2024-11-28 16:12 ` [PATCH v10 07/23] Makefile: consistently use PERL_PATH Patrick Steinhardt
@ 2024-11-28 16:12 ` Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 09/23] Makefile: use "generate-perl.sh" to massage Perl library Patrick Steinhardt
` (14 subsequent siblings)
22 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-28 16:12 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
Extract the script to inject various build-time parameters into our Perl
scripts into a standalone script. This is done such that we can reuse it
in other build systems.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 12 ++----------
contrib/buildsystems/CMakeLists.txt | 32 +++++++++++++++++++++++++++-----
generate-perl.sh | 27 +++++++++++++++++++++++++++
3 files changed, 56 insertions(+), 15 deletions(-)
diff --git a/Makefile b/Makefile
index 0e289d1dbcbfa48e4566fb3e6d4eedd87ae2d141..e33c5b966c7c6cc9ea5d8a072458f11221a21513 100644
--- a/Makefile
+++ b/Makefile
@@ -2606,16 +2606,8 @@ endif
PERL_DEFINES += $(gitexecdir) $(perllibdir) $(localedir)
-$(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
- $(QUIET_GEN) \
- sed -e '1{' \
- -e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \
- -e ' r GIT-PERL-HEADER' \
- -e ' G' \
- -e '}' \
- -e 's/@GIT_VERSION@/$(GIT_VERSION)/g' \
- $< >$@+ && \
- chmod +x $@+ && \
+$(SCRIPT_PERL_GEN): % : %.perl generate-perl.sh GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
+ $(QUIET_GEN)$(SHELL_PATH) generate-perl.sh ./GIT-BUILD-OPTIONS ./GIT-VERSION-FILE GIT-PERL-HEADER "$<" "$@+" && \
mv $@+ $@
PERL_DEFINES := $(subst $(space),:,$(PERL_DEFINES))
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index ecaae8965cd43d4a5a36201b8760296b52147dc2..5cb9a209366e80ef141c6349fea9ddedb2f83d1a 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -852,19 +852,41 @@ foreach(script ${git_shell_scripts})
endforeach()
#perl scripts
-parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" ".perl")
+parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" "")
#create perl header
file(STRINGS ${CMAKE_SOURCE_DIR}/perl/header_templates/fixed_prefix.template.pl perl_header )
string(REPLACE "@PATHSEP@" ":" perl_header "${perl_header}")
string(REPLACE "@INSTLIBDIR@" "${INSTLIBDIR}" perl_header "${perl_header}")
+file(WRITE ${CMAKE_BINARY_DIR}/PERL-HEADER ${perl_header})
+
+add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/GIT-VERSION-FILE"
+ COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE.in"
+ "${CMAKE_BINARY_DIR}/GIT-VERSION-FILE"
+ DEPENDS ${SH_EXE} "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
+ "${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE.in"
+ VERBATIM)
foreach(script ${git_perl_scripts})
- file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.perl content NEWLINE_CONSUME)
- string(REPLACE "#!/usr/bin/perl" "#!/usr/bin/perl\n${perl_header}\n" content "${content}")
- string(REPLACE "@GIT_VERSION@" "${PROJECT_VERSION}" content "${content}")
- file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
+ string(REPLACE ".perl" "" perl_gen_path "${script}")
+
+ add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/${perl_gen_path}"
+ COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-perl.sh"
+ "${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS"
+ "${CMAKE_BINARY_DIR}/GIT-VERSION-FILE"
+ "${CMAKE_BINARY_DIR}/PERL-HEADER"
+ "${CMAKE_SOURCE_DIR}/${script}"
+ "${CMAKE_BINARY_DIR}/${perl_gen_path}"
+ DEPENDS "${CMAKE_SOURCE_DIR}/generate-perl.sh"
+ "${CMAKE_SOURCE_DIR}/${script}"
+ "${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS"
+ "${CMAKE_BINARY_DIR}/GIT-VERSION-FILE"
+ VERBATIM)
+ list(APPEND perl_gen ${CMAKE_BINARY_DIR}/${perl_gen_path})
endforeach()
+add_custom_target(perl-gen ALL DEPENDS ${perl_gen})
#python script
file(STRINGS ${CMAKE_SOURCE_DIR}/git-p4.py content NEWLINE_CONSUME)
diff --git a/generate-perl.sh b/generate-perl.sh
new file mode 100755
index 0000000000000000000000000000000000000000..95072522da4aaabc74164737b72568ccfe4962fc
--- /dev/null
+++ b/generate-perl.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+set -e
+
+if test $# -ne 5
+then
+ echo >&2 "USAGE: $0 <GIT_BUILD_OPTIONS> <GIT_VERSION_FILE> <PERL_HEADER> <INPUT> <OUTPUT>"
+ exit 1
+fi
+
+GIT_BUILD_OPTIONS="$1"
+GIT_VERSION_FILE="$2"
+PERL_HEADER="$3"
+INPUT="$4"
+OUTPUT="$5"
+
+. "$GIT_BUILD_OPTIONS"
+. "$GIT_VERSION_FILE"
+
+sed -e '1{' \
+ -e " s|#!.*perl|#!$PERL_PATH|" \
+ -e " r $PERL_HEADER" \
+ -e ' G' \
+ -e '}' \
+ -e "s/@GIT_VERSION@/$GIT_VERSION/g" \
+ "$INPUT" >"$OUTPUT"
+chmod a+x "$OUTPUT"
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v10 09/23] Makefile: use "generate-perl.sh" to massage Perl library
2024-11-28 16:12 ` [PATCH v10 00/23] Modernize the build system Patrick Steinhardt
` (7 preceding siblings ...)
2024-11-28 16:12 ` [PATCH v10 08/23] Makefile: extract script to massage Perl scripts Patrick Steinhardt
@ 2024-11-28 16:12 ` Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 10/23] Makefile: extract script to massage Shell scripts Patrick Steinhardt
` (13 subsequent siblings)
22 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-28 16:12 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
Extend "generate-perl.sh" such that it knows to also massage the Perl
library files. There are two major differences:
- We do not read in the Perl header. This is handled by matching on
whether or not we have a Perl shebang.
- We substitute some more variables, which we read in via our
GIT-BUILD-OPTIONS.
Adapt both our Makefile and the CMake build instructions to use this.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-BUILD-OPTIONS.in | 2 ++
Makefile | 10 ++++------
contrib/buildsystems/CMakeLists.txt | 23 +++++++++--------------
generate-perl.sh | 14 ++++++++++++--
4 files changed, 27 insertions(+), 22 deletions(-)
diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in
index f0ca240493c94aa41a6b6241a8474e42f7cdc8b9..050432f9fc49f93d0f6ed98c1307405c52761be0 100644
--- a/GIT-BUILD-OPTIONS.in
+++ b/GIT-BUILD-OPTIONS.in
@@ -1,6 +1,8 @@
SHELL_PATH=@SHELL_PATH@
TEST_SHELL_PATH=@TEST_SHELL_PATH@
PERL_PATH=@PERL_PATH@
+PERL_LOCALEDIR=@PERL_LOCALEDIR@
+NO_PERL_CPAN_FALLBACKS=@NO_PERL_CPAN_FALLBACKS@
DIFF=@DIFF@
PYTHON_PATH=@PYTHON_PATH@
TAR=@TAR@
diff --git a/Makefile b/Makefile
index e33c5b966c7c6cc9ea5d8a072458f11221a21513..b8f96581097d7a29a745afd81de2f58b703da7da 100644
--- a/Makefile
+++ b/Makefile
@@ -3095,13 +3095,9 @@ endif
NO_PERL_CPAN_FALLBACKS_SQ = $(subst ','\'',$(NO_PERL_CPAN_FALLBACKS))
endif
-perl/build/lib/%.pm: perl/%.pm GIT-PERL-DEFINES
+perl/build/lib/%.pm: perl/%.pm generate-perl.sh GIT-BUILD-OPTIONS GIT-VERSION-FILE GIT-PERL-DEFINES
$(call mkdir_p_parent_template)
- $(QUIET_GEN) \
- sed -e 's|@LOCALEDIR@|$(perl_localedir_SQ)|g' \
- -e 's|@NO_GETTEXT@|$(NO_GETTEXT_SQ)|g' \
- -e 's|@NO_PERL_CPAN_FALLBACKS@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \
- < $< > $@
+ $(QUIET_GEN)$(SHELL_PATH) generate-perl.sh ./GIT-BUILD-OPTIONS ./GIT-VERSION-FILE GIT-PERL-HEADER "$<" "$@"
perl/build/man/man3/Git.3pm: perl/Git.pm
$(call mkdir_p_parent_template)
@@ -3168,6 +3164,8 @@ GIT-BUILD-OPTIONS: FORCE
-e "s|@SHELL_PATH@|\'$(SHELL_PATH_SQ)\'|" \
-e "s|@TEST_SHELL_PATH@|\'$(TEST_SHELL_PATH_SQ)\'|" \
-e "s|@PERL_PATH@|\'$(PERL_PATH_SQ)\'|" \
+ -e "s|@PERL_LOCALEDIR@|\'$(perl_localedir_SQ)\'|" \
+ -e "s|@NO_PERL_CPAN_FALLBACKS@|\'$(NO_PERL_CPAN_FALLBACKS_SQ)\'|" \
-e "s|@DIFF@|\'$(DIFF)\'|" \
-e "s|@PYTHON_PATH@|\'$(PYTHON_PATH_SQ)\'|" \
-e "s|@TAR@|\'$(TAR)\'|" \
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 5cb9a209366e80ef141c6349fea9ddedb2f83d1a..52b479e2e5342c3a08c83ecf77a83504778f16a0 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -853,6 +853,9 @@ endforeach()
#perl scripts
parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" "")
+#perl modules
+file(GLOB_RECURSE perl_modules "${CMAKE_SOURCE_DIR}/perl/*.pm")
+list(TRANSFORM perl_modules REPLACE "${CMAKE_SOURCE_DIR}/" "")
#create perl header
file(STRINGS ${CMAKE_SOURCE_DIR}/perl/header_templates/fixed_prefix.template.pl perl_header )
@@ -869,9 +872,12 @@ add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/GIT-VERSION-FILE"
"${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE.in"
VERBATIM)
-foreach(script ${git_perl_scripts})
+foreach(script ${git_perl_scripts} ${perl_modules})
string(REPLACE ".perl" "" perl_gen_path "${script}")
+ get_filename_component(perl_gen_dir "${perl_gen_path}" DIRECTORY)
+ file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/${perl_gen_dir}")
+
add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/${perl_gen_path}"
COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-perl.sh"
"${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS"
@@ -893,19 +899,6 @@ file(STRINGS ${CMAKE_SOURCE_DIR}/git-p4.py content NEWLINE_CONSUME)
string(REPLACE "#!/usr/bin/env python" "#!/usr/bin/python" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/git-p4 ${content})
-#perl modules
-file(GLOB_RECURSE perl_modules "${CMAKE_SOURCE_DIR}/perl/*.pm")
-
-foreach(pm ${perl_modules})
- string(REPLACE "${CMAKE_SOURCE_DIR}/perl/" "" file_path ${pm})
- file(STRINGS ${pm} content NEWLINE_CONSUME)
- string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}")
- string(REPLACE "@NO_PERL_CPAN_FALLBACKS@" "" content "${content}")
- file(WRITE ${CMAKE_BINARY_DIR}/perl/build/lib/${file_path} ${content})
-#test-lib.sh requires perl/build/lib to be the build directory of perl modules
-endforeach()
-
-
#templates
file(GLOB templates "${CMAKE_SOURCE_DIR}/templates/*")
list(TRANSFORM templates REPLACE "${CMAKE_SOURCE_DIR}/templates/" "")
@@ -1155,6 +1148,8 @@ file(STRINGS ${CMAKE_SOURCE_DIR}/GIT-BUILD-OPTIONS.in git_build_options NEWLINE_
string(REPLACE "@SHELL_PATH@" "'${SHELL_PATH}'" git_build_options "${git_build_options}")
string(REPLACE "@TEST_SHELL_PATH@" "'${TEST_SHELL_PATH}'" git_build_options "${git_build_options}")
string(REPLACE "@PERL_PATH@" "'${PERL_PATH}'" git_build_options "${git_build_options}")
+string(REPLACE "@PERL_LOCALEDIR@" "'${LOCALEDIR}'" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PERL_CPAN_FALLBACKS@" "" git_build_options "${git_build_options}")
string(REPLACE "@DIFF@" "'${DIFF}'" git_build_options "${git_build_options}")
string(REPLACE "@PYTHON_PATH@" "'${PYTHON_PATH}'" git_build_options "${git_build_options}")
string(REPLACE "@TAR@" "'${TAR}'" git_build_options "${git_build_options}")
diff --git a/generate-perl.sh b/generate-perl.sh
index 95072522da4aaabc74164737b72568ccfe4962fc..65f122ebfc76dcce607aca07fdbd9dc9e65a6b19 100755
--- a/generate-perl.sh
+++ b/generate-perl.sh
@@ -18,10 +18,20 @@ OUTPUT="$5"
. "$GIT_VERSION_FILE"
sed -e '1{' \
+ -e " /^#!.*perl/!b" \
-e " s|#!.*perl|#!$PERL_PATH|" \
-e " r $PERL_HEADER" \
-e ' G' \
-e '}' \
- -e "s/@GIT_VERSION@/$GIT_VERSION/g" \
+ -e "s|@GIT_VERSION@|$GIT_VERSION|g" \
+ -e "s|@LOCALEDIR@|$PERL_LOCALEDIR|g" \
+ -e "s|@NO_GETTEXT@|$NO_GETTEXT|g" \
+ -e "s|@NO_PERL_CPAN_FALLBACKS@|$NO_PERL_CPAN_FALLBACKS|g" \
"$INPUT" >"$OUTPUT"
-chmod a+x "$OUTPUT"
+
+case "$INPUT" in
+*.perl)
+ chmod a+x "$OUTPUT";;
+*)
+ ;;
+esac
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v10 10/23] Makefile: extract script to massage Shell scripts
2024-11-28 16:12 ` [PATCH v10 00/23] Modernize the build system Patrick Steinhardt
` (8 preceding siblings ...)
2024-11-28 16:12 ` [PATCH v10 09/23] Makefile: use "generate-perl.sh" to massage Perl library Patrick Steinhardt
@ 2024-11-28 16:12 ` Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 11/23] Makefile: extract script to generate gitweb.cgi Patrick Steinhardt
` (12 subsequent siblings)
22 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-28 16:12 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
Same as in the preceding commits, extract a script that allows us to
unify how we massage shell scripts.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-BUILD-OPTIONS.in | 4 ++++
Makefile | 34 ++++++++++------------------------
contrib/buildsystems/CMakeLists.txt | 31 ++++++++++++++++++++-----------
generate-script.sh | 34 ++++++++++++++++++++++++++++++++++
4 files changed, 68 insertions(+), 35 deletions(-)
diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in
index 050432f9fc49f93d0f6ed98c1307405c52761be0..9b95a6b3eee334b6f691702696ca9d92201b6bac 100644
--- a/GIT-BUILD-OPTIONS.in
+++ b/GIT-BUILD-OPTIONS.in
@@ -36,3 +36,7 @@ GIT_INTEROP_MAKE_OPTS=@GIT_INTEROP_MAKE_OPTS@
GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@
GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@
RUNTIME_PREFIX=@RUNTIME_PREFIX@
+GITWEBDIR=@GITWEBDIR@
+USE_GETTEXT_SCHEME=@USE_GETTEXT_SCHEME@
+LOCALEDIR=@LOCALEDIR@
+BROKEN_PATH_FIX=@BROKEN_PATH_FIX@
diff --git a/Makefile b/Makefile
index b8f96581097d7a29a745afd81de2f58b703da7da..c898720861b6aad04610b43b33244234dafaee4d 100644
--- a/Makefile
+++ b/Makefile
@@ -1558,10 +1558,10 @@ endif
ifdef SANE_TOOL_PATH
SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH))
-BROKEN_PATH_FIX = 's|^\# @BROKEN_PATH_FIX@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|'
+BROKEN_PATH_FIX = s|^\# @BROKEN_PATH_FIX@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|
PATH := $(SANE_TOOL_PATH):${PATH}
else
-BROKEN_PATH_FIX = '/^\# @BROKEN_PATH_FIX@$$/d'
+BROKEN_PATH_FIX = /^\# @BROKEN_PATH_FIX@$$/d
endif
ifeq (,$(HOST_CPU))
@@ -2546,26 +2546,8 @@ GIT-SCRIPT-DEFINES: FORCE
echo "$$FLAGS" >$@; \
fi
-define cmd_munge_script
-sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
- -e 's|@DIFF@|$(DIFF_SQ)|' \
- -e 's|@LOCALEDIR@|$(localedir_SQ)|g' \
- -e 's/@USE_GETTEXT_SCHEME@/$(USE_GETTEXT_SCHEME)/g' \
- -e $(BROKEN_PATH_FIX) \
- -e 's|@GITWEBDIR@|$(gitwebdir_SQ)|g' \
- -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' \
- -e 's|@PAGER_ENV@|$(PAGER_ENV_SQ)|g' \
- $@.sh >$@+
-endef
-
-$(SCRIPT_SH_GEN) : % : %.sh GIT-SCRIPT-DEFINES
- $(QUIET_GEN)$(cmd_munge_script) && \
- chmod +x $@+ && \
- mv $@+ $@
-
-$(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEFINES
- $(QUIET_GEN)$(cmd_munge_script) && \
+$(SCRIPT_SH_GEN) $(SCRIPT_LIB) : % : %.sh generate-script.sh GIT-BUILD-OPTIONS GIT-SCRIPT-DEFINES
+ $(QUIET_GEN)./generate-script.sh "$<" "$@+" ./GIT-BUILD-OPTIONS && \
mv $@+ $@
git.rc: git.rc.in GIT-VERSION-GEN GIT-VERSION-FILE
@@ -2635,8 +2617,8 @@ GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile
perllibdir:
@echo '$(perllibdir_SQ)'
-git-instaweb: git-instaweb.sh GIT-SCRIPT-DEFINES
- $(QUIET_GEN)$(cmd_munge_script) && \
+git-instaweb: git-instaweb.sh generate-script.sh GIT-BUILD-OPTIONS GIT-SCRIPT-DEFINES
+ $(QUIET_GEN)./generate-script.sh "$<" "$@+" ./GIT-BUILD-OPTIONS && \
chmod +x $@+ && \
mv $@+ $@
else # NO_PERL
@@ -3199,6 +3181,10 @@ GIT-BUILD-OPTIONS: FORCE
-e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \
-e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \
-e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX_OPTION)\'|" \
+ -e "s|@GITWEBDIR@|\'$(gitwebdir_SQ)\'|" \
+ -e "s|@USE_GETTEXT_SCHEME@|\'$(USE_GETTEXT_SCHEME)\'|" \
+ -e "s|@LOCALEDIR@|\'$(localedir_SQ)\'|" \
+ -e "s!@BROKEN_PATH_FIX@!\'$(BROKEN_PATH_FIX)\'!" \
GIT-BUILD-OPTIONS.in >$@+
@if grep -q '^[A-Z][A-Z_]*=@.*@$$' $@+; then echo "Unsubstituted build options in $@" >&2 && exit 1; fi
@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 52b479e2e5342c3a08c83ecf77a83504778f16a0..defdd958bb64906489482b77752b1a137282824f 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -838,18 +838,23 @@ set(git_shell_scripts
${git_sh_scripts} ${git_shlib_scripts} git-instaweb)
foreach(script ${git_shell_scripts})
- file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.sh content NEWLINE_CONSUME)
- string(REPLACE "@SHELL_PATH@" "${SHELL_PATH}" content "${content}")
- string(REPLACE "@DIFF@" "diff" content "${content}")
- string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}")
- string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" content "${content}")
- string(REPLACE "@NO_CURL@" "" content "${content}")
- string(REPLACE "@USE_GETTEXT_SCHEME@" "" content "${content}")
- string(REPLACE "# @BROKEN_PATH_FIX@" "" content "${content}")
- string(REPLACE "@PERL_PATH@" "${PERL_PATH}" content "${content}")
- string(REPLACE "@PAGER_ENV@" "LESS=FRX LV=-c" content "${content}")
- file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
+ if ("${script}" IN_LIST git_sh_scripts)
+ string(REPLACE ".sh" "" shell_gen_path "${script}")
+ else()
+ set(shell_gen_path "${script}")
+ endif()
+
+ add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/${shell_gen_path}"
+ COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-script.sh"
+ "${CMAKE_SOURCE_DIR}/${script}.sh"
+ "${CMAKE_BINARY_DIR}/${shell_gen_path}"
+ "${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS"
+ DEPENDS "${CMAKE_SOURCE_DIR}/generate-script.sh"
+ "${CMAKE_SOURCE_DIR}/${script}.sh"
+ VERBATIM)
+ list(APPEND shell_gen ${CMAKE_BINARY_DIR}/${shell_gen_path})
endforeach()
+add_custom_target(shell-gen ALL DEPENDS ${shell_gen})
#perl scripts
parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" "")
@@ -1183,6 +1188,10 @@ string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_optio
string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}")
string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}")
string(REPLACE "@RUNTIME_PREFIX@" "'${RUNTIME_PREFIX}'" git_build_options "${git_build_options}")
+string(REPLACE "@GITWEBDIR@" "'${GITWEBDIR}'" git_build_options "${git_build_options}")
+string(REPLACE "@USE_GETTEXT_SCHEME@" "" git_build_options "${git_build_options}")
+string(REPLACE "@LOCALEDIR@" "'${LOCALEDIR}'" git_build_options "${git_build_options}")
+string(REPLACE "@BROKEN_PATH_FIX@" "" git_build_options "${git_build_options}")
if(USE_VCPKG)
string(APPEND git_build_options "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
endif()
diff --git a/generate-script.sh b/generate-script.sh
new file mode 100755
index 0000000000000000000000000000000000000000..a149e4f0ba348e62b963a2a95e1b250e8732fc20
--- /dev/null
+++ b/generate-script.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+set -e
+
+if test $# -ne 3
+then
+ echo >&2 "USAGE: $0 <INPUT> <OUTPUT> <GIT-BUILD-OPTIONS>"
+ exit 1
+fi
+
+INPUT="$1"
+OUTPUT="$2"
+BUILD_OPTIONS="$3"
+
+. "$BUILD_OPTIONS"
+
+sed -e "1s|#!.*/sh|#!$SHELL_PATH|" \
+ -e "s|@SHELL_PATH@|$SHELL_PATH|" \
+ -e "s|@DIFF@|$DIFF|" \
+ -e "s|@LOCALEDIR@|$LOCALEDIR|g" \
+ -e "s/@USE_GETTEXT_SCHEME@/$USE_GETTEXT_SCHEME/g" \
+ -e "$BROKEN_PATH_FIX" \
+ -e "s|@GITWEBDIR@|$GITWEBDIR|g" \
+ -e "s|@PERL_PATH@|$PERL_PATH|g" \
+ -e "s|@PAGER_ENV@|$PAGER_ENV|g" \
+ "$INPUT" >"$OUTPUT"
+
+case "$(basename "$INPUT")" in
+git-mergetool--lib.sh|git-sh-i18n.sh|git-sh-setup.sh)
+ ;;
+*)
+ chmod a+x "$OUTPUT"
+ ;;
+esac
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v10 11/23] Makefile: extract script to generate gitweb.cgi
2024-11-28 16:12 ` [PATCH v10 00/23] Modernize the build system Patrick Steinhardt
` (9 preceding siblings ...)
2024-11-28 16:12 ` [PATCH v10 10/23] Makefile: extract script to massage Shell scripts Patrick Steinhardt
@ 2024-11-28 16:12 ` Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 12/23] Makefile: extract script to generate gitweb.js Patrick Steinhardt
` (11 subsequent siblings)
22 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-28 16:12 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
In order to generate "gitweb.cgi" we have to replace various different
placeholders. This is done ad-hoc and is thus not easily reusable across
different build systems.
Introduce a new GITWEB-BUILD-OPTIONS.in template that we populate at
configuration time with the expected options. This script is then used
as input for a new "generate-gitweb.sh" script that generates the final
"gitweb.cgi" file. While this requires us to repeat the options multiple
times, it is in line to how we generate other build options like our
GIT-BUILD-OPTIONS file.
While at it, refactor how we replace the GITWEB_PROJECT_MAXDEPTH. Even
though this variable is supposed to be an integer, the source file has
the value quoted. The quotes are eventually stripped via sed(1), which
replaces `"@GITWEB_PROJECT_MAXDEPTH@"` with the actual value, which is
rather nonsensical. This is made clearer by just dropping the quotes in
the source file.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
gitweb/GITWEB-BUILD-OPTIONS.in | 24 +++++++++++++++++
gitweb/Makefile | 59 +++++++++++++++++++++---------------------
gitweb/generate-gitweb-cgi.sh | 47 +++++++++++++++++++++++++++++++++
gitweb/gitweb.perl | 2 +-
4 files changed, 101 insertions(+), 31 deletions(-)
diff --git a/gitweb/GITWEB-BUILD-OPTIONS.in b/gitweb/GITWEB-BUILD-OPTIONS.in
new file mode 100644
index 0000000000000000000000000000000000000000..41ac20654c4f79917993bafa8f7e447669552b9d
--- /dev/null
+++ b/gitweb/GITWEB-BUILD-OPTIONS.in
@@ -0,0 +1,24 @@
+PERL_PATH=@PERL_PATH@
+JSMIN=@JSMIN@
+CSSMIN=@CSSMIN@
+GIT_BINDIR=@GIT_BINDIR@
+GITWEB_CONFIG=@GITWEB_CONFIG@
+GITWEB_CONFIG_SYSTEM=@GITWEB_CONFIG_SYSTEM@
+GITWEB_CONFIG_COMMON=@GITWEB_CONFIG_COMMON@
+GITWEB_HOME_LINK_STR=@GITWEB_HOME_LINK_STR@
+GITWEB_SITENAME=@GITWEB_SITENAME@
+GITWEB_PROJECTROOT=@GITWEB_PROJECTROOT@
+GITWEB_PROJECT_MAXDEPTH=@GITWEB_PROJECT_MAXDEPTH@
+GITWEB_EXPORT_OK=@GITWEB_EXPORT_OK@
+GITWEB_STRICT_EXPORT=@GITWEB_STRICT_EXPORT@
+GITWEB_BASE_URL=@GITWEB_BASE_URL@
+GITWEB_LIST=@GITWEB_LIST@
+GITWEB_HOMETEXT=@GITWEB_HOMETEXT@
+GITWEB_CSS=@GITWEB_CSS@
+GITWEB_LOGO=@GITWEB_LOGO@
+GITWEB_FAVICON=@GITWEB_FAVICON@
+GITWEB_JS=@GITWEB_JS@
+GITWEB_SITE_HTML_HEAD_STRING=@GITWEB_SITE_HTML_HEAD_STRING@
+GITWEB_SITE_HEADER=@GITWEB_SITE_HEADER@
+GITWEB_SITE_FOOTER=@GITWEB_SITE_FOOTER@
+HIGHLIGHT_BIN=@HIGHLIGHT_BIN@
diff --git a/gitweb/Makefile b/gitweb/Makefile
index 164c8d53757f98599ad14eeb22ca8d542eb7502a..16a2ef2d1e5664d99f6f1d8ff4224c36769c55fb 100644
--- a/gitweb/Makefile
+++ b/gitweb/Makefile
@@ -77,43 +77,42 @@ GITWEB_JSLIB_FILES += static/js/javascript-detection.js
GITWEB_JSLIB_FILES += static/js/adjust-timezone.js
GITWEB_JSLIB_FILES += static/js/blame_incremental.js
-
-GITWEB_REPLACE = \
- -e 's|@GIT_VERSION@|$(GIT_VERSION)|g' \
- -e 's|@GIT_BINDIR@|$(bindir)|g' \
- -e 's|@GITWEB_CONFIG@|$(GITWEB_CONFIG)|g' \
- -e 's|@GITWEB_CONFIG_SYSTEM@|$(GITWEB_CONFIG_SYSTEM)|g' \
- -e 's|@GITWEB_CONFIG_COMMON@|$(GITWEB_CONFIG_COMMON)|g' \
- -e 's|@GITWEB_HOME_LINK_STR@|$(GITWEB_HOME_LINK_STR)|g' \
- -e 's|@GITWEB_SITENAME@|$(GITWEB_SITENAME)|g' \
- -e 's|@GITWEB_PROJECTROOT@|$(GITWEB_PROJECTROOT)|g' \
- -e 's|"@GITWEB_PROJECT_MAXDEPTH@"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
- -e 's|@GITWEB_EXPORT_OK@|$(GITWEB_EXPORT_OK)|g' \
- -e 's|@GITWEB_STRICT_EXPORT@|$(GITWEB_STRICT_EXPORT)|g' \
- -e 's|@GITWEB_BASE_URL@|$(GITWEB_BASE_URL)|g' \
- -e 's|@GITWEB_LIST@|$(GITWEB_LIST)|g' \
- -e 's|@GITWEB_HOMETEXT@|$(GITWEB_HOMETEXT)|g' \
- -e 's|@GITWEB_CSS@|$(GITWEB_CSS)|g' \
- -e 's|@GITWEB_LOGO@|$(GITWEB_LOGO)|g' \
- -e 's|@GITWEB_FAVICON@|$(GITWEB_FAVICON)|g' \
- -e 's|@GITWEB_JS@|$(GITWEB_JS)|g' \
- -e 's|@GITWEB_SITE_HTML_HEAD_STRING@|$(GITWEB_SITE_HTML_HEAD_STRING)|g' \
- -e 's|@GITWEB_SITE_HEADER@|$(GITWEB_SITE_HEADER)|g' \
- -e 's|@GITWEB_SITE_FOOTER@|$(GITWEB_SITE_FOOTER)|g' \
- -e 's|@HIGHLIGHT_BIN@|$(HIGHLIGHT_BIN)|g'
-
.PHONY: FORCE
$(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS: FORCE
- @rm -f $@+
- @echo "x" '$(PERL_PATH_SQ)' $(GITWEB_REPLACE) "$(JSMIN)|$(CSSMIN)" >$@+
+ @sed -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|' \
+ -e 's|@JSMIN@|$(JSMIN)|' \
+ -e 's|@CSSMIN@|$(CSSMIN)|' \
+ -e 's|@GIT_VERSION@|$(GIT_VERSION)|' \
+ -e 's|@GIT_BINDIR@|$(bindir)|' \
+ -e 's|@GITWEB_CONFIG@|$(GITWEB_CONFIG)|' \
+ -e 's|@GITWEB_CONFIG_SYSTEM@|$(GITWEB_CONFIG_SYSTEM)|' \
+ -e 's|@GITWEB_CONFIG_COMMON@|$(GITWEB_CONFIG_COMMON)|' \
+ -e 's|@GITWEB_HOME_LINK_STR@|$(GITWEB_HOME_LINK_STR)|' \
+ -e 's|@GITWEB_SITENAME@|$(GITWEB_SITENAME)|' \
+ -e 's|@GITWEB_PROJECTROOT@|$(GITWEB_PROJECTROOT)|' \
+ -e 's|@GITWEB_PROJECT_MAXDEPTH@|$(GITWEB_PROJECT_MAXDEPTH)|' \
+ -e 's|@GITWEB_EXPORT_OK@|$(GITWEB_EXPORT_OK)|' \
+ -e 's|@GITWEB_STRICT_EXPORT@|$(GITWEB_STRICT_EXPORT)|' \
+ -e 's|@GITWEB_BASE_URL@|$(GITWEB_BASE_URL)|' \
+ -e 's|@GITWEB_LIST@|$(GITWEB_LIST)|' \
+ -e 's|@GITWEB_HOMETEXT@|$(GITWEB_HOMETEXT)|' \
+ -e 's|@GITWEB_CSS@|$(GITWEB_CSS)|' \
+ -e 's|@GITWEB_LOGO@|$(GITWEB_LOGO)|' \
+ -e 's|@GITWEB_FAVICON@|$(GITWEB_FAVICON)|' \
+ -e 's|@GITWEB_JS@|$(GITWEB_JS)|' \
+ -e 's|@GITWEB_SITE_HTML_HEAD_STRING@|$(GITWEB_SITE_HTML_HEAD_STRING)|' \
+ -e 's|@GITWEB_SITE_HEADER@|$(GITWEB_SITE_HEADER)|' \
+ -e 's|@GITWEB_SITE_FOOTER@|$(GITWEB_SITE_FOOTER)|' \
+ -e 's|@HIGHLIGHT_BIN@|$(HIGHLIGHT_BIN)|' \
+ $(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS.in >"$@+"
@cmp -s $@+ $@ && rm -f $@+ || mv -f $@+ $@
+$(MAK_DIR_GITWEB)gitweb.cgi: $(MAK_DIR_GITWEB)generate-gitweb-cgi.sh
$(MAK_DIR_GITWEB)gitweb.cgi: $(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS
+$(MAK_DIR_GITWEB)gitweb.cgi: GIT-VERSION-FILE
$(MAK_DIR_GITWEB)gitweb.cgi: $(MAK_DIR_GITWEB)gitweb.perl
$(QUIET_GEN)$(RM) $@ $@+ && \
- sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
- $(GITWEB_REPLACE) $< >$@+ && \
- chmod +x $@+ && \
+ $(MAK_DIR_GITWEB)generate-gitweb-cgi.sh $(MAK_DIR_GITWEB)/GITWEB-BUILD-OPTIONS ./GIT-VERSION-FILE $< $@+ && \
mv $@+ $@
$(MAK_DIR_GITWEB)static/gitweb.js: $(addprefix $(MAK_DIR_GITWEB),$(GITWEB_JSLIB_FILES))
diff --git a/gitweb/generate-gitweb-cgi.sh b/gitweb/generate-gitweb-cgi.sh
new file mode 100755
index 0000000000000000000000000000000000000000..ede9038c3352d2155340c7fb1c62c467f8ce96ab
--- /dev/null
+++ b/gitweb/generate-gitweb-cgi.sh
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+set -e
+
+if test $# -ne 4
+then
+ echo >&2 "USAGE: $0 <GITWEB-BUILD-OPTIONS> <GIT-VERSION-FILE> <INPUT> <OUTPUT>"
+ exit 1
+fi
+
+GITWEB_BUILD_OPTIONS="$1"
+GIT_VERSION_FILE="$2"
+INPUT="$3"
+OUTPUT="$4"
+
+. "$GITWEB_BUILD_OPTIONS"
+. "$GIT_VERSION_FILE"
+
+sed -e "1s|#!/usr/bin/perl|#!$PERL_PATH|" \
+ -e "s|@PERL_PATH@|$PERL_PATH|" \
+ -e "s|@JSMIN@|$JSMIN|" \
+ -e "s|@CSSMIN@|$CSSMIN|" \
+ -e "s|@GIT_VERSION@|$GIT_VERSION|" \
+ -e "s|@GIT_BINDIR@|$GIT_BINDIR|" \
+ -e "s|@GITWEB_CONFIG@|$GITWEB_CONFIG|" \
+ -e "s|@GITWEB_CONFIG_SYSTEM@|$GITWEB_CONFIG_SYSTEM|" \
+ -e "s|@GITWEB_CONFIG_COMMON@|$GITWEB_CONFIG_COMMON|" \
+ -e "s|@GITWEB_HOME_LINK_STR@|$GITWEB_HOME_LINK_STR|" \
+ -e "s|@GITWEB_SITENAME@|$GITWEB_SITENAME|" \
+ -e "s|@GITWEB_PROJECTROOT@|$GITWEB_PROJECTROOT|" \
+ -e "s|@GITWEB_PROJECT_MAXDEPTH@|$GITWEB_PROJECT_MAXDEPTH|" \
+ -e "s|@GITWEB_EXPORT_OK@|$GITWEB_EXPORT_OK|" \
+ -e "s|@GITWEB_STRICT_EXPORT@|$GITWEB_STRICT_EXPORT|" \
+ -e "s|@GITWEB_BASE_URL@|$GITWEB_BASE_URL|" \
+ -e "s|@GITWEB_LIST@|$GITWEB_LIST|" \
+ -e "s|@GITWEB_HOMETEXT@|$GITWEB_HOMETEXT|" \
+ -e "s|@GITWEB_CSS@|$GITWEB_CSS|" \
+ -e "s|@GITWEB_LOGO@|$GITWEB_LOGO|" \
+ -e "s|@GITWEB_FAVICON@|$GITWEB_FAVICON|" \
+ -e "s|@GITWEB_JS@|$GITWEB_JS|" \
+ -e "s|@GITWEB_SITE_HTML_HEAD_STRING@|$GITWEB_SITE_HTML_HEAD_STRING|" \
+ -e "s|@GITWEB_SITE_HEADER@|$GITWEB_SITE_HEADER|" \
+ -e "s|@GITWEB_SITE_FOOTER@|$GITWEB_SITE_FOOTER|" \
+ -e "s|@HIGHLIGHT_BIN@|$HIGHLIGHT_BIN|" \
+ "$INPUT" >"$OUTPUT"
+
+chmod a+x "$OUTPUT"
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 76e1f4e244fd23dd29b935e83753efa9c6d5bb5e..41bc64ec73f9f05666480025c3b70650607b4cd8 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -88,7 +88,7 @@ sub evaluate_uri {
# fs traversing limit for getting project list
# the number is relative to the projectroot
-our $project_maxdepth = "@GITWEB_PROJECT_MAXDEPTH@";
+our $project_maxdepth = @GITWEB_PROJECT_MAXDEPTH@;
# string of the home link on top of all pages
our $home_link_str = "@GITWEB_HOME_LINK_STR@";
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v10 12/23] Makefile: extract script to generate gitweb.js
2024-11-28 16:12 ` [PATCH v10 00/23] Modernize the build system Patrick Steinhardt
` (10 preceding siblings ...)
2024-11-28 16:12 ` [PATCH v10 11/23] Makefile: extract script to generate gitweb.cgi Patrick Steinhardt
@ 2024-11-28 16:12 ` Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 13/23] Makefile: refactor generators to be PWD-independent Patrick Steinhardt
` (10 subsequent siblings)
22 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-28 16:12 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
Similar to the preceding commit, also extract the script to generate the
"gitweb.js" file. While the logic itself is trivial, it helps us avoid
duplication of logic across build systems and ensures that the build
systems will remain in sync with each other in case the logic ever needs
to change.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
gitweb/Makefile | 3 ++-
gitweb/generate-gitweb-js.sh | 12 ++++++++++++
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/gitweb/Makefile b/gitweb/Makefile
index 16a2ef2d1e5664d99f6f1d8ff4224c36769c55fb..d5748e93594eb6181269c2fe272bf7ef980cbe68 100644
--- a/gitweb/Makefile
+++ b/gitweb/Makefile
@@ -115,9 +115,10 @@ $(MAK_DIR_GITWEB)gitweb.cgi: $(MAK_DIR_GITWEB)gitweb.perl
$(MAK_DIR_GITWEB)generate-gitweb-cgi.sh $(MAK_DIR_GITWEB)/GITWEB-BUILD-OPTIONS ./GIT-VERSION-FILE $< $@+ && \
mv $@+ $@
+$(MAK_DIR_GITWEB)static/gitweb.js: $(MAK_DIR_GITWEB)generate-gitweb-js.sh
$(MAK_DIR_GITWEB)static/gitweb.js: $(addprefix $(MAK_DIR_GITWEB),$(GITWEB_JSLIB_FILES))
$(QUIET_GEN)$(RM) $@ $@+ && \
- cat $^ >$@+ && \
+ $(MAK_DIR_GITWEB)generate-gitweb-js.sh $@+ $^ && \
mv $@+ $@
### Installation rules
diff --git a/gitweb/generate-gitweb-js.sh b/gitweb/generate-gitweb-js.sh
new file mode 100755
index 0000000000000000000000000000000000000000..01bb22b04b8d8910608fec6376f07d570ab02a33
--- /dev/null
+++ b/gitweb/generate-gitweb-js.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+if test "$#" -lt 2
+then
+ echo >&2 "USAGE: $0 <OUTPUT> <INPUT>..."
+ exit 1
+fi
+
+OUTPUT="$1"
+shift
+
+cat "$@" >"$OUTPUT"
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v10 13/23] Makefile: refactor generators to be PWD-independent
2024-11-28 16:12 ` [PATCH v10 00/23] Modernize the build system Patrick Steinhardt
` (11 preceding siblings ...)
2024-11-28 16:12 ` [PATCH v10 12/23] Makefile: extract script to generate gitweb.js Patrick Steinhardt
@ 2024-11-28 16:12 ` Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 14/23] Makefile: allow "bin-wrappers/" directory to exist Patrick Steinhardt
` (9 subsequent siblings)
22 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-28 16:12 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
We have multiple scripts that generate headers from other data. All of
these scripts have the assumption built-in that they are executed in the
current source directory, which makes them a bit unwieldy to use during
out-of-tree builds.
Refactor them to instead take the source directory as well as the output
file as arguments.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 6 +++---
contrib/buildsystems/CMakeLists.txt | 19 +++++++++--------
generate-cmdlist.sh | 42 +++++++++++++++++++++++--------------
generate-configlist.sh | 20 +++++++++++++-----
generate-hooklist.sh | 15 ++++++++++++-
5 files changed, 68 insertions(+), 34 deletions(-)
diff --git a/Makefile b/Makefile
index c898720861b6aad04610b43b33244234dafaee4d..61639d17dc364acf30ffd2d317015d8db440acc1 100644
--- a/Makefile
+++ b/Makefile
@@ -2523,17 +2523,17 @@ $(BUILT_INS): git$X
config-list.h: generate-configlist.sh
config-list.h: Documentation/*config.txt Documentation/config/*.txt
- $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh >$@
+ $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh . $@
command-list.h: generate-cmdlist.sh command-list.txt
command-list.h: $(wildcard Documentation/git*.txt)
$(QUIET_GEN)$(SHELL_PATH) ./generate-cmdlist.sh \
$(patsubst %,--exclude-program %,$(EXCLUDED_PROGRAMS)) \
- command-list.txt >$@
+ . $@
hook-list.h: generate-hooklist.sh Documentation/githooks.txt
- $(QUIET_GEN)$(SHELL_PATH) ./generate-hooklist.sh >$@
+ $(QUIET_GEN)$(SHELL_PATH) ./generate-hooklist.sh . $@
SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):\
$(localedir_SQ):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index defdd958bb64906489482b77752b1a137282824f..de2c24e66b5b94e18368aba576fc11418e2aa049 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -638,23 +638,24 @@ set(EXCLUSION_PROGS_CACHE ${EXCLUSION_PROGS} CACHE STRING "Programs not built" F
if(NOT EXISTS ${CMAKE_BINARY_DIR}/command-list.h OR NOT EXCLUSION_PROGS_CACHE STREQUAL EXCLUSION_PROGS)
list(REMOVE_ITEM EXCLUSION_PROGS empty)
message("Generating command-list.h")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-cmdlist.sh ${EXCLUSION_PROGS} command-list.txt
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_FILE ${CMAKE_BINARY_DIR}/command-list.h)
+ execute_process(COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-cmdlist.sh"
+ ${EXCLUSION_PROGS}
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_BINARY_DIR}/command-list.h")
endif()
if(NOT EXISTS ${CMAKE_BINARY_DIR}/config-list.h)
message("Generating config-list.h")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-configlist.sh
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_FILE ${CMAKE_BINARY_DIR}/config-list.h)
+ execute_process(COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-configlist.sh"
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_BINARY_DIR}/config-list.h")
endif()
if(NOT EXISTS ${CMAKE_BINARY_DIR}/hook-list.h)
message("Generating hook-list.h")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-hooklist.sh
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_FILE ${CMAKE_BINARY_DIR}/hook-list.h)
+ execute_process(COMMAND "${SH_EXE}" ${CMAKE_SOURCE_DIR}/generate-hooklist.sh
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_BINARY_DIR}/hook-list.h")
endif()
include_directories(${CMAKE_BINARY_DIR})
diff --git a/generate-cmdlist.sh b/generate-cmdlist.sh
index 205541e0f7f81b1df4061215ae34a2742a45475d..b923a5aab80dfa571a40a4f6fa3d860fcf8f8dd1 100755
--- a/generate-cmdlist.sh
+++ b/generate-cmdlist.sh
@@ -64,7 +64,7 @@ define_category_names () {
print_command_list () {
echo "static struct cmdname_help command_list[] = {"
- echo "$1" |
+ echo "$2" |
while read cmd rest
do
synopsis=
@@ -76,7 +76,7 @@ print_command_list () {
break
;;
esac
- done <"Documentation/$cmd.txt"
+ done <"$1/Documentation/$cmd.txt"
printf '\t{ "%s", N_("%s"), 0' "$cmd" "$synopsis"
printf " | CAT_%s" $rest
@@ -93,18 +93,28 @@ do
shift
done
-commands="$(command_list "$1")"
-categories="$(category_list "$commands")"
+if test "$#" -ne 2
+then
+ die "USAGE: $0 <SOURCE_DIR> <OUTPUT>"
+fi
+
+SOURCE_DIR="$1"
+OUTPUT="$2"
+
+{
+ commands="$(command_list "$SOURCE_DIR"/command-list.txt)"
+ categories="$(category_list "$commands")"
-echo "/* Automatically generated by generate-cmdlist.sh */
-struct cmdname_help {
- const char *name;
- const char *help;
- uint32_t category;
-};
-"
-define_categories "$categories"
-echo
-define_category_names "$categories"
-echo
-print_command_list "$commands"
+ echo "/* Automatically generated by generate-cmdlist.sh */
+ struct cmdname_help {
+ const char *name;
+ const char *help;
+ uint32_t category;
+ };
+ "
+ define_categories "$categories"
+ echo
+ define_category_names "$categories"
+ echo
+ print_command_list "$SOURCE_DIR" "$commands"
+} >"$OUTPUT"
diff --git a/generate-configlist.sh b/generate-configlist.sh
index 8692fe5cf4d5e4025265e6110254b05640615fea..579422619cc777ff597523a4db81b99912aac3aa 100755
--- a/generate-configlist.sh
+++ b/generate-configlist.sh
@@ -1,13 +1,19 @@
#!/bin/sh
-echo "/* Automatically generated by generate-configlist.sh */"
-echo
+SOURCE_DIR="$1"
+OUTPUT="$2"
+
+if test -z "$SOURCE_DIR" || ! test -d "$SOURCE_DIR" || test -z "$OUTPUT"
+then
+ echo >&2 "USAGE: $0 <SOURCE_DIR> <OUTPUT>"
+ exit 1
+fi
print_config_list () {
cat <<EOF
static const char *config_name_list[] = {
EOF
- grep -h '^[a-zA-Z].*\..*::$' Documentation/*config.txt Documentation/config/*.txt |
+ grep -h '^[a-zA-Z].*\..*::$' "$SOURCE_DIR"/Documentation/*config.txt "$SOURCE_DIR"/Documentation/config/*.txt |
sed '/deprecated/d; s/::$//; s/, */\n/g' |
sort |
sed 's/^.*$/ "&",/'
@@ -17,5 +23,9 @@ EOF
EOF
}
-echo
-print_config_list
+{
+ echo "/* Automatically generated by generate-configlist.sh */"
+ echo
+ echo
+ print_config_list
+} >"$OUTPUT"
diff --git a/generate-hooklist.sh b/generate-hooklist.sh
index 2f9f54eb545be2bd79c37a868dbeef96d2ddfb9f..e22068c2fa4139983d685fd3bcd78e3e2a52beb0 100755
--- a/generate-hooklist.sh
+++ b/generate-hooklist.sh
@@ -2,6 +2,17 @@
#
# Usage: ./generate-hooklist.sh >hook-list.h
+SOURCE_DIR="$1"
+OUTPUT="$2"
+
+if test -z "$SOURCE_DIR" || ! test -d "$SOURCE_DIR" || test -z "$OUTPUT"
+then
+ echo >&2 "USAGE: $0 <SOURCE_DIR> <OUTPUT>"
+ exit 1
+fi
+
+{
+
cat <<EOF
/* Automatically generated by generate-hooklist.sh */
@@ -11,10 +22,12 @@ EOF
sed -n \
-e '/^~~~~*$/ {x; s/^.*$/ "&",/; p;}' \
-e 'x' \
- <Documentation/githooks.txt |
+ <"$SOURCE_DIR"/Documentation/githooks.txt |
LC_ALL=C sort
cat <<EOF
NULL,
};
EOF
+
+} >"$OUTPUT"
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v10 14/23] Makefile: allow "bin-wrappers/" directory to exist
2024-11-28 16:12 ` [PATCH v10 00/23] Modernize the build system Patrick Steinhardt
` (12 preceding siblings ...)
2024-11-28 16:12 ` [PATCH v10 13/23] Makefile: refactor generators to be PWD-independent Patrick Steinhardt
@ 2024-11-28 16:12 ` Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 15/23] Makefile: simplify building of templates Patrick Steinhardt
` (8 subsequent siblings)
22 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-28 16:12 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
The "bin-wrappers/" directory gets created by our build system and is
populated with one script for each of our binaries. There isn't anything
inherently wrong with the current layout, but it is somewhat hard to
adapt for out-of-tree build systems.
Adapt the layout such that our "bin-wrappers/" directory always exists
and contains our "wrap-for-bin.sh" script to make things a little bit
easier for subsequent steps.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
.gitignore | 1 -
Documentation/CodingGuidelines | 2 +-
Makefile | 6 +++---
bin-wrappers/.gitignore | 9 +++++++++
wrap-for-bin.sh => bin-wrappers/wrap-for-bin.sh | 0
contrib/buildsystems/CMakeLists.txt | 6 +++---
6 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/.gitignore b/.gitignore
index d3be460040c6120d862a25dff1abd325b93b37fd..e82aa19df03fc865eaa0468f12b734cec0c48a2c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,7 +12,6 @@
/GIT-TEST-SUITES
/GIT-USER-AGENT
/GIT-VERSION-FILE
-/bin-wrappers/
/git
/git-add
/git-am
diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
index 87904791cbcea6e57d0fb3c7d4e27f2b0d80b95f..1df9d0c42f1ee7b16ecd7abc22d2653dbf9bae2e 100644
--- a/Documentation/CodingGuidelines
+++ b/Documentation/CodingGuidelines
@@ -583,7 +583,7 @@ For C programs:
Run `GIT_DEBUGGER=1 ./bin-wrappers/git foo` to simply use gdb as is, or
run `GIT_DEBUGGER="<debugger> <debugger-args>" ./bin-wrappers/git foo` to
use your own debugger and arguments. Example: `GIT_DEBUGGER="ddd --gdb"
- ./bin-wrappers/git log` (See `wrap-for-bin.sh`.)
+ ./bin-wrappers/git log` (See `bin-wrappers/wrap-for-bin.sh`.)
- The primary data structure that a subsystem 'S' deals with is called
`struct S`. Functions that operate on `struct S` are named
diff --git a/Makefile b/Makefile
index 61639d17dc364acf30ffd2d317015d8db440acc1..14ee6817cf9d9d03312a9cbd93b8ee218241d3d4 100644
--- a/Makefile
+++ b/Makefile
@@ -3206,8 +3206,7 @@ test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $(
all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PROG)
-bin-wrappers/%: wrap-for-bin.sh
- $(call mkdir_p_parent_template)
+$(test_bindir_programs): bin-wrappers/%: bin-wrappers/wrap-for-bin.sh
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@BUILD_DIR@|$(shell pwd)|' \
-e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
@@ -3704,7 +3703,8 @@ clean: profile-clean coverage-clean cocciclean
$(RM) $(SP_OBJ)
$(RM) $(HCC)
$(RM) version-def.h
- $(RM) -r bin-wrappers $(dep_dirs) $(compdb_dir) compile_commands.json
+ $(RM) -r $(dep_dirs) $(compdb_dir) compile_commands.json
+ $(RM) $(test_bindir_programs)
$(RM) -r po/build/
$(RM) *.pyc *.pyo */*.pyc */*.pyo $(GENERATED_H) $(ETAGS_TARGET) tags cscope*
$(RM) -r .dist-tmp-dir .doc-tmp-dir
diff --git a/bin-wrappers/.gitignore b/bin-wrappers/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..1c6c90458b758641d0311e812563b32dd4656b48
--- /dev/null
+++ b/bin-wrappers/.gitignore
@@ -0,0 +1,9 @@
+/git
+/git-cvsserver
+/git-receive-pack
+/git-shell
+/git-upload-archive
+/git-upload-pack
+/scalar
+/test-fake-ssh
+/test-tool
diff --git a/wrap-for-bin.sh b/bin-wrappers/wrap-for-bin.sh
old mode 100644
new mode 100755
similarity index 100%
rename from wrap-for-bin.sh
rename to bin-wrappers/wrap-for-bin.sh
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index de2c24e66b5b94e18368aba576fc11418e2aa049..259dc838b73dcda6ab98776fab61788d90754e03 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -1088,20 +1088,20 @@ set(wrapper_test_scripts
foreach(script ${wrapper_scripts})
- file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
+ file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
string(REPLACE "@PROG@" "${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
foreach(script ${wrapper_test_scripts})
- file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
+ file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
string(REPLACE "@PROG@" "t/helper/${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
-file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
+file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
string(REPLACE "@PROG@" "git-cvsserver" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v10 15/23] Makefile: simplify building of templates
2024-11-28 16:12 ` [PATCH v10 00/23] Modernize the build system Patrick Steinhardt
` (13 preceding siblings ...)
2024-11-28 16:12 ` [PATCH v10 14/23] Makefile: allow "bin-wrappers/" directory to exist Patrick Steinhardt
@ 2024-11-28 16:12 ` Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 16/23] Documentation: allow sourcing generated includes from separate dir Patrick Steinhardt
` (7 subsequent siblings)
22 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-28 16:12 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
When we install Git we also install a set of default templates that both
git-init(1) and git-clone(1) populate into our build directories. The
way the pristine templates are laid out in our source directory is
somewhat weird though: instead of reconstructing the actual directory
hierarchy in "templates/", we represent directory separators with "--".
The only reason I could come up with for why we have this is the
"branches/" directory, which is supposed to be empty when installing it.
And as Git famously doesn't store empty directories at all we have to
work around this limitation.
Now the thing is that the "branches/" directory is a leftover to how
branches used to be stored in the dark ages. gitrepository-layout(5)
lists this directory as "slightly deprecated", which I would claim is a
strong understatement. I have never encountered anybody using it today
and would be surprised if it even works as expected. So having the "--"
hack in place for an item that is basically unused, unmaintained and
deprecated doesn't only feel unreasonable, but installing that entry by
default may also cause confusion for users that do not know what this is
supposed to be in the first place.
Remove this directory from our templates and, now that we do not require
the workaround anymore, restructure the templates to form a proper
hierarchy. This makes it way easier for build systems to install these
templates into place.
We should likely think about removing support for "branch/" altogether,
but that is outside of the scope of this patch series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
contrib/buildsystems/CMakeLists.txt | 34 +++++++------------
templates/Makefile | 39 ++++++++++++++--------
templates/branches-- | 1 -
templates/{this--description => description} | 0
.../applypatch-msg.sample} | 0
.../commit-msg.sample} | 0
.../fsmonitor-watchman.sample} | 0
.../post-update.sample} | 0
.../pre-applypatch.sample} | 0
.../pre-commit.sample} | 0
.../pre-merge-commit.sample} | 0
.../pre-push.sample} | 0
.../pre-rebase.sample} | 0
.../pre-receive.sample} | 0
.../prepare-commit-msg.sample} | 0
.../push-to-checkout.sample} | 0
.../sendemail-validate.sample} | 0
.../{hooks--update.sample => hooks/update.sample} | 0
templates/{info--exclude => info/exclude} | 0
19 files changed, 37 insertions(+), 37 deletions(-)
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 259dc838b73dcda6ab98776fab61788d90754e03..21dc90ef9a83e5d751f251c9eefbdf43c989bf53 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -99,8 +99,8 @@ project(git
#TODO Enable NLS on windows natively
#macros for parsing the Makefile for sources and scripts
-macro(parse_makefile_for_sources list_var regex)
- file(STRINGS ${CMAKE_SOURCE_DIR}/Makefile ${list_var} REGEX "^${regex} \\+=(.*)")
+macro(parse_makefile_for_sources list_var makefile regex)
+ file(STRINGS ${makefile} ${list_var} REGEX "^${regex} \\+=(.*)")
string(REPLACE "${regex} +=" "" ${list_var} ${${list_var}})
string(REPLACE "$(COMPAT_OBJS)" "" ${list_var} ${${list_var}}) #remove "$(COMPAT_OBJS)" This is only for libgit.
string(STRIP ${${list_var}} ${list_var}) #remove trailing/leading whitespaces
@@ -662,7 +662,7 @@ include_directories(${CMAKE_BINARY_DIR})
#build
#libgit
-parse_makefile_for_sources(libgit_SOURCES "LIB_OBJS")
+parse_makefile_for_sources(libgit_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "LIB_OBJS")
list(TRANSFORM libgit_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
list(TRANSFORM compat_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
@@ -680,13 +680,13 @@ list(APPEND libgit_SOURCES "${CMAKE_BINARY_DIR}/version-def.h")
add_library(libgit ${libgit_SOURCES} ${compat_SOURCES})
#libxdiff
-parse_makefile_for_sources(libxdiff_SOURCES "XDIFF_OBJS")
+parse_makefile_for_sources(libxdiff_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "XDIFF_OBJS")
list(TRANSFORM libxdiff_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
add_library(xdiff STATIC ${libxdiff_SOURCES})
#reftable
-parse_makefile_for_sources(reftable_SOURCES "REFTABLE_OBJS")
+parse_makefile_for_sources(reftable_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "REFTABLE_OBJS")
list(TRANSFORM reftable_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
add_library(reftable STATIC ${reftable_SOURCES})
@@ -757,7 +757,7 @@ elseif(UNIX)
endif()
#git
-parse_makefile_for_sources(git_SOURCES "BUILTIN_OBJS")
+parse_makefile_for_sources(git_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "BUILTIN_OBJS")
list(TRANSFORM git_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
add_executable(git ${CMAKE_SOURCE_DIR}/git.c ${git_SOURCES})
@@ -905,24 +905,14 @@ file(STRINGS ${CMAKE_SOURCE_DIR}/git-p4.py content NEWLINE_CONSUME)
string(REPLACE "#!/usr/bin/env python" "#!/usr/bin/python" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/git-p4 ${content})
-#templates
-file(GLOB templates "${CMAKE_SOURCE_DIR}/templates/*")
-list(TRANSFORM templates REPLACE "${CMAKE_SOURCE_DIR}/templates/" "")
-list(REMOVE_ITEM templates ".gitignore")
-list(REMOVE_ITEM templates "Makefile")
-list(REMOVE_ITEM templates "blt")# Prevents an error when reconfiguring for in source builds
-
-list(REMOVE_ITEM templates "branches--")
-file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/templates/blt/branches) #create branches
-
+#${CMAKE_SOURCE_DIR}/Makefile templates
+parse_makefile_for_sources(templates ${CMAKE_SOURCE_DIR}/templates/Makefile "TEMPLATES")
+string(REPLACE " " ";" templates ${templates})
#templates have @.*@ replacement so use configure_file instead
foreach(tm ${templates})
- string(REPLACE "--" "/" blt_tm ${tm})
- string(REPLACE "this" "" blt_tm ${blt_tm})# for this--
- configure_file(${CMAKE_SOURCE_DIR}/templates/${tm} ${CMAKE_BINARY_DIR}/templates/blt/${blt_tm} @ONLY)
+ configure_file(${CMAKE_SOURCE_DIR}/templates/${tm} ${CMAKE_BINARY_DIR}/templates/blt/${tm} @ONLY)
endforeach()
-
#translations
if(MSGFMT_EXE)
file(GLOB po_files "${CMAKE_SOURCE_DIR}/po/*.po")
@@ -996,7 +986,7 @@ add_executable(test-fake-ssh ${CMAKE_SOURCE_DIR}/t/helper/test-fake-ssh.c)
target_link_libraries(test-fake-ssh common-main)
#unit-tests
-parse_makefile_for_sources(unit-test_SOURCES "UNIT_TEST_OBJS")
+parse_makefile_for_sources(unit-test_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "UNIT_TEST_OBJS")
list(TRANSFORM unit-test_SOURCES REPLACE "\\$\\(UNIT_TEST_DIR\\)/" "${CMAKE_SOURCE_DIR}/t/unit-tests/")
add_library(unit-test-lib STATIC ${unit-test_SOURCES})
@@ -1062,7 +1052,7 @@ if(MSVC)
endif()
#test-tool
-parse_makefile_for_sources(test-tool_SOURCES "TEST_BUILTINS_OBJS")
+parse_makefile_for_sources(test-tool_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "TEST_BUILTINS_OBJS")
add_library(test-lib OBJECT ${CMAKE_SOURCE_DIR}/t/unit-tests/test-lib.c)
list(TRANSFORM test-tool_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/t/helper/")
diff --git a/templates/Makefile b/templates/Makefile
index 367ad00c24cb34c0668eb5236dc3b08a477a65b7..bd1e9e30c120032b209fb1d221b9d93eea31c649 100644
--- a/templates/Makefile
+++ b/templates/Makefile
@@ -29,24 +29,35 @@ all: boilerplates.made custom
# in a file direc--tory--file in the source. They will be
# just copied to the destination.
-bpsrc = $(filter-out %~,$(wildcard *--*))
-boilerplates.made : $(bpsrc)
- $(QUIET)umask 022 && ls *--* 2>/dev/null | \
- while read boilerplate; \
+TEMPLATES =
+TEMPLATES += description
+TEMPLATES += hooks/applypatch-msg.sample
+TEMPLATES += hooks/commit-msg.sample
+TEMPLATES += hooks/fsmonitor-watchman.sample
+TEMPLATES += hooks/post-update.sample
+TEMPLATES += hooks/pre-applypatch.sample
+TEMPLATES += hooks/pre-commit.sample
+TEMPLATES += hooks/pre-merge-commit.sample
+TEMPLATES += hooks/prepare-commit-msg.sample
+TEMPLATES += hooks/pre-push.sample
+TEMPLATES += hooks/pre-rebase.sample
+TEMPLATES += hooks/pre-receive.sample
+TEMPLATES += hooks/push-to-checkout.sample
+TEMPLATES += hooks/sendemail-validate.sample
+TEMPLATES += hooks/update.sample
+TEMPLATES += info/exclude
+
+boilerplates.made: $(TEMPLATES)
+ $(QUIET)umask 022 && for template in $(TEMPLATES); \
do \
- case "$$boilerplate" in *~) continue ;; esac && \
- dst=`echo "$$boilerplate" | sed -e 's|^this|.|;s|--|/|g'` && \
- dir=`expr "$$dst" : '\(.*\)/'` && \
+ dir=$$(dirname "$$template") && \
mkdir -p blt/$$dir && \
- case "$$boilerplate" in \
- *--) continue;; \
- esac && \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
- -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' $$boilerplate > \
- blt/$$dst && \
- if test -x "$$boilerplate"; then rx=rx; else rx=r; fi && \
- chmod a+$$rx "blt/$$dst" || exit; \
+ -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' $$template > \
+ blt/$$template && \
+ if test -x "$$template"; then rx=rx; else rx=r; fi && \
+ chmod a+$$rx "blt/$$template" || exit; \
done && \
date >$@
diff --git a/templates/branches-- b/templates/branches--
deleted file mode 100644
index fae88709a636f3a06cc813dd64b28bfee7fa2073..0000000000000000000000000000000000000000
--- a/templates/branches--
+++ /dev/null
@@ -1 +0,0 @@
-: this is just to ensure the directory exists.
diff --git a/templates/this--description b/templates/description
similarity index 100%
rename from templates/this--description
rename to templates/description
diff --git a/templates/hooks--applypatch-msg.sample b/templates/hooks/applypatch-msg.sample
similarity index 100%
rename from templates/hooks--applypatch-msg.sample
rename to templates/hooks/applypatch-msg.sample
diff --git a/templates/hooks--commit-msg.sample b/templates/hooks/commit-msg.sample
similarity index 100%
rename from templates/hooks--commit-msg.sample
rename to templates/hooks/commit-msg.sample
diff --git a/templates/hooks--fsmonitor-watchman.sample b/templates/hooks/fsmonitor-watchman.sample
similarity index 100%
rename from templates/hooks--fsmonitor-watchman.sample
rename to templates/hooks/fsmonitor-watchman.sample
diff --git a/templates/hooks--post-update.sample b/templates/hooks/post-update.sample
similarity index 100%
rename from templates/hooks--post-update.sample
rename to templates/hooks/post-update.sample
diff --git a/templates/hooks--pre-applypatch.sample b/templates/hooks/pre-applypatch.sample
similarity index 100%
rename from templates/hooks--pre-applypatch.sample
rename to templates/hooks/pre-applypatch.sample
diff --git a/templates/hooks--pre-commit.sample b/templates/hooks/pre-commit.sample
similarity index 100%
rename from templates/hooks--pre-commit.sample
rename to templates/hooks/pre-commit.sample
diff --git a/templates/hooks--pre-merge-commit.sample b/templates/hooks/pre-merge-commit.sample
similarity index 100%
rename from templates/hooks--pre-merge-commit.sample
rename to templates/hooks/pre-merge-commit.sample
diff --git a/templates/hooks--pre-push.sample b/templates/hooks/pre-push.sample
similarity index 100%
rename from templates/hooks--pre-push.sample
rename to templates/hooks/pre-push.sample
diff --git a/templates/hooks--pre-rebase.sample b/templates/hooks/pre-rebase.sample
similarity index 100%
rename from templates/hooks--pre-rebase.sample
rename to templates/hooks/pre-rebase.sample
diff --git a/templates/hooks--pre-receive.sample b/templates/hooks/pre-receive.sample
similarity index 100%
rename from templates/hooks--pre-receive.sample
rename to templates/hooks/pre-receive.sample
diff --git a/templates/hooks--prepare-commit-msg.sample b/templates/hooks/prepare-commit-msg.sample
similarity index 100%
rename from templates/hooks--prepare-commit-msg.sample
rename to templates/hooks/prepare-commit-msg.sample
diff --git a/templates/hooks--push-to-checkout.sample b/templates/hooks/push-to-checkout.sample
similarity index 100%
rename from templates/hooks--push-to-checkout.sample
rename to templates/hooks/push-to-checkout.sample
diff --git a/templates/hooks--sendemail-validate.sample b/templates/hooks/sendemail-validate.sample
similarity index 100%
rename from templates/hooks--sendemail-validate.sample
rename to templates/hooks/sendemail-validate.sample
diff --git a/templates/hooks--update.sample b/templates/hooks/update.sample
similarity index 100%
rename from templates/hooks--update.sample
rename to templates/hooks/update.sample
diff --git a/templates/info--exclude b/templates/info/exclude
similarity index 100%
rename from templates/info--exclude
rename to templates/info/exclude
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v10 16/23] Documentation: allow sourcing generated includes from separate dir
2024-11-28 16:12 ` [PATCH v10 00/23] Modernize the build system Patrick Steinhardt
` (14 preceding siblings ...)
2024-11-28 16:12 ` [PATCH v10 15/23] Makefile: simplify building of templates Patrick Steinhardt
@ 2024-11-28 16:12 ` Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 17/23] Documentation: teach "cmd-list.perl" about out-of-tree builds Patrick Steinhardt
` (6 subsequent siblings)
22 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-28 16:12 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
Our documentation uses "include::" directives to include parts that are
either reused across multiple documents or parts that we generate at
build time. Unfortunately, top-level includes are only ever resolved
relative to the base directory, which is typically the directory of the
including document. Most importantly, it is not possible to have either
asciidoc or asciidoctor search multiple directories.
It follows that both kinds of includes must live in the same directory.
This is of course a bummer for out-of-tree builds, because here the
dynamically-built includes live in the build directory whereas the
static includes live in the source directory.
Introduce a `build_dir` attribute and prepend it to all of our includes
for dynamically-built files. This attribute gets set to the build
directory and thus converts the include path to an absolute path, which
asciidoc and asciidoctor know how to resolve.
Note that this change also requires us to update "build-docdep.perl",
which tries to figure out included files such our Makefile can set up
proper build-time dependencies. This script simply scans through the
source files for any lines that match "^include::" and treats the
remainder of the line as included file path. But given that those may
now contain the "{build_dir}" variable we have to teach the script to
replace that attribute with the actual build directory.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Documentation/Makefile | 3 ++-
Documentation/build-docdep.perl | 2 ++
Documentation/config/diff.txt | 2 +-
Documentation/config/merge.txt | 2 +-
Documentation/git.txt | 24 ++++++++++++------------
5 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 495c61c85ed18bc9c4643f9e5478e5146bb5f196..c3d5ea1d46a57744bcacdc63b6c97911607e9fec 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -224,6 +224,7 @@ SHELL_PATH ?= $(SHELL)
# Shell quote;
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
+ASCIIDOC_EXTRA += -abuild_dir='$(shell pwd)'
ifdef DEFAULT_PAGER
DEFAULT_PAGER_SQ = $(subst ','\'',$(DEFAULT_PAGER))
ASCIIDOC_EXTRA += -a 'git-default-pager=$(DEFAULT_PAGER_SQ)'
@@ -289,7 +290,7 @@ docdep_prereqs = \
cmd-list.made $(cmds_txt)
doc.dep : $(docdep_prereqs) $(DOC_DEP_TXT) build-docdep.perl
- $(QUIET_GEN)$(PERL_PATH) ./build-docdep.perl >$@ $(QUIET_STDERR)
+ $(QUIET_GEN)$(PERL_PATH) ./build-docdep.perl "$(shell pwd)" >$@ $(QUIET_STDERR)
ifneq ($(MAKECMDGOALS),clean)
-include doc.dep
diff --git a/Documentation/build-docdep.perl b/Documentation/build-docdep.perl
index 1b3ac8fdd95fa1d57afbdffb1a9743f36ed22fdd..315efaa2fa2f2efc89b2c8073cc97cd2cc83611c 100755
--- a/Documentation/build-docdep.perl
+++ b/Documentation/build-docdep.perl
@@ -1,5 +1,6 @@
#!/usr/bin/perl
+my ($build_dir) = @ARGV;
my %include = ();
my %included = ();
@@ -10,6 +11,7 @@
chomp;
s/^include::\s*//;
s/\[\]//;
+ s/{build_dir}/${build_dir}/;
$include{$text}{$_} = 1;
$included{$_} = 1;
}
diff --git a/Documentation/config/diff.txt b/Documentation/config/diff.txt
index 190bda17e51c57a00b25bf98afa038b8a89e4ea5..9575af91fa53d3f67925d31e77b81222e737fc3a 100644
--- a/Documentation/config/diff.txt
+++ b/Documentation/config/diff.txt
@@ -206,7 +206,7 @@ diff.<driver>.cachetextconv::
Set this option to true to make the diff driver cache the text
conversion outputs. See linkgit:gitattributes[5] for details.
-include::../mergetools-diff.txt[]
+include::{build_dir}/mergetools-diff.txt[]
diff.indentHeuristic::
Set this option to `false` to disable the default heuristics
diff --git a/Documentation/config/merge.txt b/Documentation/config/merge.txt
index 8851b6cedef980c106b9e86541862b517aa1f2ad..82554d65a0aa0826fdb53c5d834389d38f308e3e 100644
--- a/Documentation/config/merge.txt
+++ b/Documentation/config/merge.txt
@@ -101,7 +101,7 @@ merge.guitool::
Any other value is treated as a custom merge tool and requires that a
corresponding mergetool.<guitool>.cmd variable is defined.
-include::../mergetools-merge.txt[]
+include::{build_dir}/mergetools-merge.txt[]
merge.verbosity::
Controls the amount of output shown by the recursive merge
diff --git a/Documentation/git.txt b/Documentation/git.txt
index d15a8697625d6b6c598a2bc774bf243675ab68ea..44f0797ccffb1a7359bee9c20182953293b70d6d 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -245,17 +245,17 @@ ancillary user utilities.
Main porcelain commands
~~~~~~~~~~~~~~~~~~~~~~~
-include::cmds-mainporcelain.txt[]
+include::{build_dir}/cmds-mainporcelain.txt[]
Ancillary Commands
~~~~~~~~~~~~~~~~~~
Manipulators:
-include::cmds-ancillarymanipulators.txt[]
+include::{build_dir}/cmds-ancillarymanipulators.txt[]
Interrogators:
-include::cmds-ancillaryinterrogators.txt[]
+include::{build_dir}/cmds-ancillaryinterrogators.txt[]
Interacting with Others
@@ -264,7 +264,7 @@ Interacting with Others
These commands are to interact with foreign SCM and with other
people via patch over e-mail.
-include::cmds-foreignscminterface.txt[]
+include::{build_dir}/cmds-foreignscminterface.txt[]
Reset, restore and revert
~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -313,13 +313,13 @@ repositories.
Manipulation commands
~~~~~~~~~~~~~~~~~~~~~
-include::cmds-plumbingmanipulators.txt[]
+include::{build_dir}/cmds-plumbingmanipulators.txt[]
Interrogation commands
~~~~~~~~~~~~~~~~~~~~~~
-include::cmds-plumbinginterrogators.txt[]
+include::{build_dir}/cmds-plumbinginterrogators.txt[]
In general, the interrogate commands do not touch the files in
the working tree.
@@ -328,12 +328,12 @@ the working tree.
Syncing repositories
~~~~~~~~~~~~~~~~~~~~
-include::cmds-synchingrepositories.txt[]
+include::{build_dir}/cmds-synchingrepositories.txt[]
The following are helper commands used by the above; end users
typically do not use them directly.
-include::cmds-synchelpers.txt[]
+include::{build_dir}/cmds-synchelpers.txt[]
Internal helper commands
@@ -342,14 +342,14 @@ Internal helper commands
These are internal helper commands used by other commands; end
users typically do not use them directly.
-include::cmds-purehelpers.txt[]
+include::{build_dir}/cmds-purehelpers.txt[]
Guides
------
The following documentation pages are guides about Git concepts.
-include::cmds-guide.txt[]
+include::{build_dir}/cmds-guide.txt[]
Repository, command and file interfaces
---------------------------------------
@@ -358,7 +358,7 @@ This documentation discusses repository and command interfaces which
users are expected to interact with directly. See `--user-formats` in
linkgit:git-help[1] for more details on the criteria.
-include::cmds-userinterfaces.txt[]
+include::{build_dir}/cmds-userinterfaces.txt[]
File formats, protocols and other developer interfaces
------------------------------------------------------
@@ -367,7 +367,7 @@ This documentation discusses file formats, over-the-wire protocols and
other git developer interfaces. See `--developer-interfaces` in
linkgit:git-help[1].
-include::cmds-developerinterfaces.txt[]
+include::{build_dir}/cmds-developerinterfaces.txt[]
Configuration Mechanism
-----------------------
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v10 17/23] Documentation: teach "cmd-list.perl" about out-of-tree builds
2024-11-28 16:12 ` [PATCH v10 00/23] Modernize the build system Patrick Steinhardt
` (15 preceding siblings ...)
2024-11-28 16:12 ` [PATCH v10 16/23] Documentation: allow sourcing generated includes from separate dir Patrick Steinhardt
@ 2024-11-28 16:12 ` Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 18/23] Documentation: extract script to generate a list of mergetools Patrick Steinhardt
` (5 subsequent siblings)
22 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-28 16:12 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
The "cmd-list.perl" script generates a list of commands that can be
included into our manpages. The script doesn't know about out-of-tree
builds and instead writes resulting files into the source directory.
Adapt it such that we can read data from the source directory and write
data into the build directory.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Documentation/Makefile | 2 +-
Documentation/cmd-list.perl | 23 ++++++++++++-----------
2 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/Documentation/Makefile b/Documentation/Makefile
index c3d5ea1d46a57744bcacdc63b6c97911607e9fec..6c3f9b5ed13ab0b0ceae05128ec4086a7f61ca34 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -312,7 +312,7 @@ cmds_txt = cmds-ancillaryinterrogators.txt \
$(cmds_txt): cmd-list.made
cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
- $(QUIET_GEN)$(PERL_PATH) ./cmd-list.perl ../command-list.txt $(cmds_txt) $(QUIET_STDERR) && \
+ $(QUIET_GEN)$(PERL_PATH) ./cmd-list.perl .. . $(cmds_txt) && \
date >$@
mergetools_txt = mergetools-diff.txt mergetools-merge.txt
diff --git a/Documentation/cmd-list.perl b/Documentation/cmd-list.perl
index 755a110bc48d7e2b596651ca13664c01192d966c..e260a989774071b66d2b56c56c5045b84a508c5c 100755
--- a/Documentation/cmd-list.perl
+++ b/Documentation/cmd-list.perl
@@ -3,12 +3,13 @@
use File::Compare qw(compare);
sub format_one {
- my ($out, $nameattr) = @_;
+ my ($source_dir, $out, $nameattr) = @_;
my ($name, $attr) = @$nameattr;
+ my ($path) = "$source_dir/Documentation/$name.txt";
my ($state, $description);
my $mansection;
$state = 0;
- open I, '<', "$name.txt" or die "No such file $name.txt";
+ open I, '<', "$path" or die "No such file $path.txt";
while (<I>) {
if (/^(?:git|scalar)[a-z0-9-]*\(([0-9])\)$/) {
$mansection = $1;
@@ -29,7 +30,7 @@ sub format_one {
}
close I;
if (!defined $description) {
- die "No description found in $name.txt";
+ die "No description found in $path.txt";
}
if (my ($verify_name, $text) = ($description =~ /^($name) - (.*)/)) {
print $out "linkgit:$name\[$mansection\]::\n\t";
@@ -43,9 +44,9 @@ sub format_one {
}
}
-my ($input, @categories) = @ARGV;
+my ($source_dir, $build_dir, @categories) = @ARGV;
-open IN, "<$input";
+open IN, "<$source_dir/command-list.txt";
while (<IN>) {
last if /^### command list/;
}
@@ -63,17 +64,17 @@ sub format_one {
for my $out (@categories) {
my ($cat) = $out =~ /^cmds-(.*)\.txt$/;
- open O, '>', "$out+" or die "Cannot open output file $out+";
+ my ($path) = "$build_dir/$out";
+ open O, '>', "$path+" or die "Cannot open output file $out+";
for (@{$cmds{$cat}}) {
- format_one(\*O, $_);
+ format_one($source_dir, \*O, $_);
}
close O;
- if (-f "$out" && compare("$out", "$out+") == 0) {
- unlink "$out+";
+ if (-f "$path" && compare("$path", "$path+") == 0) {
+ unlink "$path+";
}
else {
- print STDERR "$out\n";
- rename "$out+", "$out";
+ rename "$path+", "$path";
}
}
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v10 18/23] Documentation: extract script to generate a list of mergetools
2024-11-28 16:12 ` [PATCH v10 00/23] Modernize the build system Patrick Steinhardt
` (16 preceding siblings ...)
2024-11-28 16:12 ` [PATCH v10 17/23] Documentation: teach "cmd-list.perl" about out-of-tree builds Patrick Steinhardt
@ 2024-11-28 16:12 ` Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 19/23] t: better support for out-of-tree builds Patrick Steinhardt
` (4 subsequent siblings)
22 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-28 16:12 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
We include the list of available mergetools into our manpages. Extract
the script that performs this logic such that we can reuse it in other
build systems.
While at it, refactor the Makefile targets such that we don't create
"mergetools-list.made" anymore. It shouldn't be necessary, as we can
instead have other targets depend on "mergetools-{diff,merge}.txt"
directly.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Documentation/Makefile | 22 ++++++++--------------
Documentation/generate-mergetool-list.sh | 17 +++++++++++++++++
2 files changed, 25 insertions(+), 14 deletions(-)
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 6c3f9b5ed13ab0b0ceae05128ec4086a7f61ca34..d19ee3c399f337ea9ac7c9a1b595ac760ebed095 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -282,11 +282,13 @@ ifneq ($(filter-out lint-docs clean,$(MAKECMDGOALS)),)
-include ../GIT-VERSION-FILE
endif
+mergetools_txt = mergetools-diff.txt mergetools-merge.txt
+
#
# Determine "include::" file references in asciidoc files.
#
docdep_prereqs = \
- mergetools-list.made $(mergetools_txt) \
+ $(mergetools_txt) \
cmd-list.made $(cmds_txt)
doc.dep : $(docdep_prereqs) $(DOC_DEP_TXT) build-docdep.perl
@@ -315,19 +317,11 @@ cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
$(QUIET_GEN)$(PERL_PATH) ./cmd-list.perl .. . $(cmds_txt) && \
date >$@
-mergetools_txt = mergetools-diff.txt mergetools-merge.txt
-
-$(mergetools_txt): mergetools-list.made
-
-mergetools-list.made: ../git-mergetool--lib.sh $(wildcard ../mergetools/*)
- $(QUIET_GEN) \
- $(SHELL_PATH) -c 'MERGE_TOOLS_DIR=../mergetools && TOOL_MODE=diff && \
- . ../git-mergetool--lib.sh && \
- show_tool_names can_diff' | sed -e "s/\([a-z0-9]*\)/\`\1\`;;/" >mergetools-diff.txt && \
- $(SHELL_PATH) -c 'MERGE_TOOLS_DIR=../mergetools && TOOL_MODE=merge && \
- . ../git-mergetool--lib.sh && \
- show_tool_names can_merge' | sed -e "s/\([a-z0-9]*\)/\`\1\`;;/" >mergetools-merge.txt && \
- date >$@
+mergetools-%.txt: generate-mergetool-list.sh ../git-mergetool--lib.sh $(wildcard ../mergetools/*)
+mergetools-diff.txt:
+ $(QUIET_GEN)$(SHELL_PATH) ./generate-mergetool-list.sh .. diff $@
+mergetools-merge.txt:
+ $(QUIET_GEN)$(SHELL_PATH) ./generate-mergetool-list.sh .. merge $@
TRACK_ASCIIDOCFLAGS = $(subst ','\'',$(ASCIIDOC_COMMON):$(ASCIIDOC_HTML):$(ASCIIDOC_DOCBOOK))
diff --git a/Documentation/generate-mergetool-list.sh b/Documentation/generate-mergetool-list.sh
new file mode 100755
index 0000000000000000000000000000000000000000..6700498b93be5358d992530b8dee39c08f02bd8d
--- /dev/null
+++ b/Documentation/generate-mergetool-list.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+if test "$#" -ne 3
+then
+ echo >&2 "USAGE: $0 <SOURCE_DIR> <MODE> <OUTPUT>"
+ exit 1
+fi
+
+SOURCE_DIR="$1"
+TOOL_MODE="$2"
+OUTPUT="$3"
+MERGE_TOOLS_DIR="$SOURCE_DIR/mergetools"
+
+(
+ . "$SOURCE_DIR"/git-mergetool--lib.sh &&
+ show_tool_names can_$TOOL_MODE
+) | sed -e "s/\([a-z0-9]*\)/\`\1\`;;/" >"$OUTPUT"
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v10 19/23] t: better support for out-of-tree builds
2024-11-28 16:12 ` [PATCH v10 00/23] Modernize the build system Patrick Steinhardt
` (17 preceding siblings ...)
2024-11-28 16:12 ` [PATCH v10 18/23] Documentation: extract script to generate a list of mergetools Patrick Steinhardt
@ 2024-11-28 16:12 ` Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 20/23] t: allow overriding build dir Patrick Steinhardt
` (3 subsequent siblings)
22 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-28 16:12 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
Our in-tree builds used by the Makefile use various different build
directories scattered around different locations. The paths to those
build directories have to be propagated to our tests such that they can
find the contained files. This is done via a mixture of hardcoded paths
in our test library and injected variables in our bin-wrappers or
"GIT-BUILD-OPTIONS".
The latter two mechanisms are preferable over using hardcoded paths. For
one, we have all paths which are subject to change stored in a small set
of central files instead of having the knowledge of build paths in many
files. And second, it allows build systems which build files elsewhere
to adapt those paths based on their own needs. This is especially nice
in the context of build systems that use out-of-tree builds like CMake
or Meson.
Remove hardcoded knowledge of build paths from our test library and move
it into our bin-wrappers and "GIT-BUILD-OPTIONS".
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-BUILD-OPTIONS.in | 5 +++++
Makefile | 9 +++++++++
bin-wrappers/wrap-for-bin.sh | 11 ++++++-----
contrib/buildsystems/CMakeLists.txt | 8 ++++++++
t/lib-gettext.sh | 4 ++--
t/t7609-mergetool--lib.sh | 2 +-
t/test-lib.sh | 6 +++---
7 files changed, 34 insertions(+), 11 deletions(-)
diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in
index 9b95a6b3eee334b6f691702696ca9d92201b6bac..f651116102ae2977622dccd12b199fe7ad65af99 100644
--- a/GIT-BUILD-OPTIONS.in
+++ b/GIT-BUILD-OPTIONS.in
@@ -35,6 +35,11 @@ GIT_PERF_MAKE_COMMAND=@GIT_PERF_MAKE_COMMAND@
GIT_INTEROP_MAKE_OPTS=@GIT_INTEROP_MAKE_OPTS@
GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@
GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@
+GIT_TEST_TEXTDOMAINDIR=@GIT_TEST_TEXTDOMAINDIR@
+GIT_TEST_POPATH=@GIT_TEST_POPATH@
+GIT_TEST_TEMPLATE_DIR=@GIT_TEST_TEMPLATE_DIR@
+GIT_TEST_GITPERLLIB=@GIT_TEST_GITPERLLIB@
+GIT_TEST_MERGE_TOOLS_DIR=@GIT_TEST_MERGE_TOOLS_DIR@
RUNTIME_PREFIX=@RUNTIME_PREFIX@
GITWEBDIR=@GITWEBDIR@
USE_GETTEXT_SCHEME=@USE_GETTEXT_SCHEME@
diff --git a/Makefile b/Makefile
index 14ee6817cf9d9d03312a9cbd93b8ee218241d3d4..2ef2f4928cab04253d1b3094be6ac83f9de9002b 100644
--- a/Makefile
+++ b/Makefile
@@ -3180,6 +3180,11 @@ GIT-BUILD-OPTIONS: FORCE
-e "s|@GIT_INTEROP_MAKE_OPTS@|\'$(GIT_INTEROP_MAKE_OPTS)\'|" \
-e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \
-e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \
+ -e "s|@GIT_TEST_TEXTDOMAINDIR@|\'$(shell pwd)/po/build/locale\'|" \
+ -e "s|@GIT_TEST_POPATH@|\'$(shell pwd)/po\'|" \
+ -e "s|@GIT_TEST_TEMPLATE_DIR@|\'$(shell pwd)/templates/blt\'|" \
+ -e "s|@GIT_TEST_GITPERLLIB@|\'$(shell pwd)/perl/build/lib\'|" \
+ -e "s|@GIT_TEST_MERGE_TOOLS_DIR@|\'$(shell pwd)/mergetools\'|" \
-e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX_OPTION)\'|" \
-e "s|@GITWEBDIR@|\'$(gitwebdir_SQ)\'|" \
-e "s|@USE_GETTEXT_SCHEME@|\'$(USE_GETTEXT_SCHEME)\'|" \
@@ -3209,6 +3214,10 @@ all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PR
$(test_bindir_programs): bin-wrappers/%: bin-wrappers/wrap-for-bin.sh
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@BUILD_DIR@|$(shell pwd)|' \
+ -e 's|@GIT_TEXTDOMAINDIR@|$(shell pwd)/po/build/locale|' \
+ -e 's|@GITPERLLIB@|$(shell pwd)/perl/build/lib|' \
+ -e 's|@MERGE_TOOLS_DIR@|$(shell pwd)/mergetools|' \
+ -e 's|@TEMPLATE_DIR@|$(shell pwd)/templates/blt|' \
-e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
chmod +x $@
diff --git a/bin-wrappers/wrap-for-bin.sh b/bin-wrappers/wrap-for-bin.sh
index 7898a1c238dde20617cf96d144930dc59f67feab..1d3a59a0081e1fc6066af187093cb1d11d01a929 100755
--- a/bin-wrappers/wrap-for-bin.sh
+++ b/bin-wrappers/wrap-for-bin.sh
@@ -4,21 +4,22 @@
# to run test suite against sandbox, but with only bindir-installed
# executables in PATH. The Makefile copies this into various
# files in bin-wrappers, substituting
-# @BUILD_DIR@ and @PROG@.
+# @BUILD_DIR@, @TEMPLATE_DIR@ and @PROG@.
GIT_EXEC_PATH='@BUILD_DIR@'
if test -n "$NO_SET_GIT_TEMPLATE_DIR"
then
unset GIT_TEMPLATE_DIR
else
- GIT_TEMPLATE_DIR='@BUILD_DIR@/templates/blt'
+ GIT_TEMPLATE_DIR='@TEMPLATE_DIR@'
export GIT_TEMPLATE_DIR
fi
-GITPERLLIB='@BUILD_DIR@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}"
-GIT_TEXTDOMAINDIR='@BUILD_DIR@/po/build/locale'
+MERGE_TOOLS_DIR='@MERGE_TOOLS_DIR@'
+GITPERLLIB='@GITPERLLIB@'"${GITPERLLIB:+:$GITPERLLIB}"
+GIT_TEXTDOMAINDIR='@GIT_TEXTDOMAINDIR@'
PATH='@BUILD_DIR@/bin-wrappers:'"$PATH"
-export GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
+export MERGE_TOOLS_DIR GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
case "$GIT_DEBUGGER" in
'')
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 21dc90ef9a83e5d751f251c9eefbdf43c989bf53..2ccc0aa7a7bd35c40a800bed397f7f70093c83de 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -1093,6 +1093,9 @@ endforeach()
file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+string(REPLACE "@GIT_TEXTDOMAINDIR@" "${CMAKE_BINARY_DIR}/po/build/locale" content "${content}")
+string(REPLACE "@GITPERLLIB@" "${CMAKE_BINARY_DIR}/perl/build/lib" content "${content}")
+string(REPLACE "@MERGE_TOOLS_DIR@" "${CMAKE_SOURCE_DIR}/mergetools" content "${content}")
string(REPLACE "@PROG@" "git-cvsserver" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})
@@ -1178,6 +1181,11 @@ string(REPLACE "@GIT_PERF_MAKE_COMMAND@" "" git_build_options "${git_build_optio
string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_options}")
string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}")
string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_TEXTDOMAINDIR@" "'${CMAKE_BINARY_DIR}/po/build/locale'" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_POPATH@" "'${CMAKE_BINARY_DIR}/po'" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_TEMPLATE_DIR@" "'${CMAKE_BINARY_DIR}/templates/blt'" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_GITPERLLIB@" "'${CMAKE_BINARY_DIR}/perl/build/lib'" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_MERGE_TOOLS_DIR@" "'${RUNTIME_PREFIX}'" git_build_options "${git_build_options}")
string(REPLACE "@RUNTIME_PREFIX@" "'${RUNTIME_PREFIX}'" git_build_options "${git_build_options}")
string(REPLACE "@GITWEBDIR@" "'${GITWEBDIR}'" git_build_options "${git_build_options}")
string(REPLACE "@USE_GETTEXT_SCHEME@" "" git_build_options "${git_build_options}")
diff --git a/t/lib-gettext.sh b/t/lib-gettext.sh
index cc6bb2cdeaae7b5bb23211c0d9c37c9deb39e14f..7a734c6973e65995d3403a26cc9e5c1a5a1ce074 100644
--- a/t/lib-gettext.sh
+++ b/t/lib-gettext.sh
@@ -6,8 +6,8 @@
. ./test-lib.sh
-GIT_TEXTDOMAINDIR="$GIT_BUILD_DIR/po/build/locale"
-GIT_PO_PATH="$GIT_BUILD_DIR/po"
+GIT_TEXTDOMAINDIR="$GIT_TEST_TEXTDOMAINDIR"
+GIT_PO_PATH="$GIT_TEST_POPATH"
export GIT_TEXTDOMAINDIR GIT_PO_PATH
if test -n "$GIT_TEST_INSTALLED"
diff --git a/t/t7609-mergetool--lib.sh b/t/t7609-mergetool--lib.sh
index 8b1c3bd39f2249417099ea2f24218268925909af..a9273ba58d76333c74d0072794ed0d95b966f16f 100755
--- a/t/t7609-mergetool--lib.sh
+++ b/t/t7609-mergetool--lib.sh
@@ -8,7 +8,7 @@ TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'mergetool --tool=vimdiff creates the expected layout' '
- . "$GIT_BUILD_DIR"/mergetools/vimdiff &&
+ . "$GIT_TEST_MERGE_TOOLS_DIR"/vimdiff &&
run_unit_tests
'
diff --git a/t/test-lib.sh b/t/test-lib.sh
index cca6a09c68cb9d08c37b0ded3150118767153b9f..13ae044808f28067a67cd2e02674b4add14ad9f4 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1440,7 +1440,7 @@ else # normal case, use ../bin-wrappers only unless $with_dashes:
PATH="$GIT_BUILD_DIR:$GIT_BUILD_DIR/t/helper:$PATH"
fi
fi
-GIT_TEMPLATE_DIR="$GIT_BUILD_DIR"/templates/blt
+GIT_TEMPLATE_DIR="$GIT_TEST_TEMPLATE_DIR"
GIT_CONFIG_NOSYSTEM=1
GIT_ATTR_NOSYSTEM=1
GIT_CEILING_DIRECTORIES="$TRASH_DIRECTORY/.."
@@ -1506,9 +1506,9 @@ then
fi
fi
-GITPERLLIB="$GIT_BUILD_DIR"/perl/build/lib
+GITPERLLIB="$GIT_TEST_GITPERLLIB"
export GITPERLLIB
-test -d "$GIT_BUILD_DIR"/templates/blt || {
+test -d "$GIT_TEMPLATE_DIR" || {
BAIL_OUT "You haven't built things yet, have you?"
}
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v10 20/23] t: allow overriding build dir
2024-11-28 16:12 ` [PATCH v10 00/23] Modernize the build system Patrick Steinhardt
` (18 preceding siblings ...)
2024-11-28 16:12 ` [PATCH v10 19/23] t: better support for out-of-tree builds Patrick Steinhardt
@ 2024-11-28 16:12 ` Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 21/23] Documentation: add comparison of build systems Patrick Steinhardt
` (2 subsequent siblings)
22 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-28 16:12 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
Our "test-lib.sh" assumes that our build directory is the parent
directory of "t/". While true when using our Makefile, it's not when
using build systems that support out-of-tree builds.
In commit ee9e66e4e7 (cmake: avoid editing t/test-lib.sh, 2022-10-18),
we have introduce support for overriding the GIT_BUILD_DIR by creating
the file "$GIT_BUILD_DIR/GIT-BUILD-DIR" with its contents pointing to
the location of the build directory. The intent was to stop modifying
"t/test-lib.sh" with the CMake build systems while allowing out-of-tree
builds. But "$GIT_BUILD_DIR" is somewhat misleadingly named, as it in
fact points to the _source_ directory. So while that commit solved part
of the problem for out-of-tree builds, CMake still has to write files
into the source tree.
Solve the second part of the problem, namely not having to write any
data into the source directory at all, by also supporting an environment
variable that allows us to point to a different build directory. This
allows us to perform properly self-contained out-of-tree builds.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
t/test-lib.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 13ae044808f28067a67cd2e02674b4add14ad9f4..570be8de059283084ddb3acff1d9efe1278ee730 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -35,7 +35,7 @@ else
# needing to exist.
TEST_DIRECTORY=$(cd "$TEST_DIRECTORY" && pwd) || exit 1
fi
-GIT_BUILD_DIR="${TEST_DIRECTORY%/t}"
+GIT_BUILD_DIR="${GIT_BUILD_DIR:-${TEST_DIRECTORY%/t}}"
if test "$TEST_DIRECTORY" = "$GIT_BUILD_DIR"
then
echo "PANIC: Running in a $TEST_DIRECTORY that doesn't end in '/t'?" >&2
@@ -522,6 +522,7 @@ unset VISUAL EMAIL LANGUAGE $("$PERL_PATH" -e '
PERF_
CURL_VERBOSE
TRACE_CURL
+ BUILD_DIR
));
my @vars = grep(/^GIT_/ && !/^GIT_($ok)/o, @env);
print join("\n", @vars);
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v10 21/23] Documentation: add comparison of build systems
2024-11-28 16:12 ` [PATCH v10 00/23] Modernize the build system Patrick Steinhardt
` (19 preceding siblings ...)
2024-11-28 16:12 ` [PATCH v10 20/23] t: allow overriding build dir Patrick Steinhardt
@ 2024-11-28 16:12 ` Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 22/23] Introduce support for the Meson build system Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 23/23] meson: fix conflicts with in-flight topics Patrick Steinhardt
22 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-28 16:12 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
We're contemplating whether to eventually replace our build systems with
a build system that is easier to use. Add a comparison of build systems
to our technical documentation as a baseline for discussion.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Documentation/Makefile | 1 +
Documentation/technical/build-systems.txt | 224 ++++++++++++++++++++++++++++++
2 files changed, 225 insertions(+)
diff --git a/Documentation/Makefile b/Documentation/Makefile
index d19ee3c399f337ea9ac7c9a1b595ac760ebed095..d18603ed50c654f1c7f2ef44140a00840557747e 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -113,6 +113,7 @@ TECH_DOCS += MyFirstObjectWalk
TECH_DOCS += SubmittingPatches
TECH_DOCS += ToolsForGit
TECH_DOCS += technical/bitmap-format
+TECH_DOCS += technical/build-systems
TECH_DOCS += technical/bundle-uri
TECH_DOCS += technical/hash-function-transition
TECH_DOCS += technical/long-running-process-protocol
diff --git a/Documentation/technical/build-systems.txt b/Documentation/technical/build-systems.txt
new file mode 100644
index 0000000000000000000000000000000000000000..d9dafb407c40902756ca0bde9d9dad8ced8788dd
--- /dev/null
+++ b/Documentation/technical/build-systems.txt
@@ -0,0 +1,224 @@
+= Build Systems
+
+The build system is the primary way for both developers and system integrators
+to interact with the Git project. As such, being easy to use and extend for
+those who are not directly developing Git itself is just as important as other
+requirements we have on any potential build system.
+
+This document outlines the different requirements that we have for the build
+system and then compares available build systems using these criteria.
+
+== Requirements
+
+The following subsections present a list of requirements that we have for any
+potential build system. Sections are sorted by decreasing priority.
+
+=== Platform support
+
+The build system must have support for all of our platforms that we continually
+test against as outlined by our platform support policy. These platforms are:
+
+ - Linux
+ - Windows
+ - macOS
+
+Furthermore, the build system should have support for the following platforms
+that generally have somebody running test pipelines against regularly:
+
+ - AIX
+ - FreeBSD
+ - NetBSD
+ - NonStop
+ - OpenBSD
+
+The platforms which must be supported by the tool should be aligned with our
+[platform support policy](platform-support.txt).
+
+=== Auto-detection of supported features
+
+The build system must support auto-detection of features which are or aren't
+available on the current platform. Platform maintainers should not be required
+to manually configure the complete build.
+
+Auto-detection of the following items is considered to be important:
+
+ - Check for the existence of headers.
+ - Check for the existence of libraries.
+ - Check for the existence of exectuables.
+ - Check for the runtime behavior of specific functions.
+ - Check for specific link order requirements when multiple libraries are
+ involved.
+
+=== Ease of use
+
+The build system should be both easy to use and easy to extend. While this is
+naturally a subjective metric it is likely not controversial to say that some
+build systems are considerably harder to use than others.
+
+=== IDE support
+
+The build system should integrate with well-known IDEs. Well-known IDEs include:
+
+ - Microsoft Visual Studio
+ - Visual Studio Code
+ - Xcode
+
+There are four levels of support:
+
+ - Native integration into the IDE.
+ - Integration into the IDE via a plugin.
+ - Integration into the IDE via generating a project description with the build
+ system.
+ - No integration.
+
+Native integration is preferable, but integration via either a plugin or by
+generating a project description via the build system are considered feasible
+alternatives.
+
+Another important distinction is the level of integration. There are two
+features that one generally wants to have:
+
+ - Integration of build targets.
+ - Automatic setup of features like code completion with detected build
+ dependencies.
+
+The first bullet point is the bare minimum, but is not sufficient to be
+considered proper integration.
+
+=== Out-of-tree builds
+
+The build system should support out-of-tree builds. Out-of-tree builds allow a
+developer to configure multiple different build directories with different
+configuration, e.g. one "debug" build and one "release" build.
+
+=== Cross-platform builds
+
+The build system should support cross-platform builds, e.g. building for arm on
+an x86-64 host.
+
+=== Language support
+
+The following languages and toolchains are of relevance and should be supported
+by the build system:
+
+ - C: the primary compiled language used by Git, must be supported. Relevant
+ toolchains are GCC, Clang and MSVC.
+ - Rust: candidate as a second compiled lanugage, should be supported. Relevant
+ toolchains is the LLVM-based rustc.
+
+Built-in support for the respective languages is preferred over support that
+needs to be wired up manually to avoid unnecessary complexity. Native support
+includes the following features:
+
+ - Compiling objects.
+ - Dependency tracking.
+ - Detection of available features.
+ - Discovery of relevant toolchains.
+ - Linking libraries and executables.
+ - Templating placeholders in scripts.
+
+=== Test integration
+
+It should be possible to integrate tests into the build system such that it is
+possible to build and test Git within the build system. Features which are nice
+to have:
+
+ - Track build-time dependencies for respective tests. Unit tests have
+ different requirements than integration tests.
+ - Allow filtering of which tests to run.
+ - Allow running tests such that utilities like `test_pause` or `debug` work.
+
+== Comparison
+
+The following list of build systems are considered:
+
+- GNU Make
+- autoconf
+- CMake
+- Meson
+
+=== GNU Make
+
+- Platform support: ubitquitous on all platforms, but not well-integrated into Windows.
+- Auto-detection: no built-in support for auto-detection of features.
+- Ease of use: easy to use, but discovering available options is hard. Makefile
+ rules can quickly get out of hand once reaching a certain scope.
+- IDE support: execution of Makefile targets is supported by many IDEs
+- Out-of-tree builds: supported in theory, not wired up in practice.
+- Cross-platform builds: supported in theory, not wired up in practice.
+- Language support:
+ - C: Limited built-in support, many parts need to be wired up manually.
+ - Rust: No built-in support, needs to be wired up manually.
+- Test integration: partially supported, many parts need to be wired up
+ manually.
+
+=== autoconf
+
+- Platform support: ubiquitous on all platforms, but not well-integrated into Windows.
+- Auto-detection: supported.
+- Ease of use: easy to use, discovering available options is comparatively
+ easy. The autoconf syntax is prohibitively hard to extend though due to its
+ complex set of interacting files and the hard-to-understand M4 language.
+- IDE support: no integration into IDEs at generation time. The generated
+ Makefiles have the same level of support as GNU Make.
+- Out-of-tree builds: supported in theory, not wired up in practice.
+- Cross-platform builds: supported.
+- Language support:
+ - C: Limited built-in support, many parts need to be wired up manually.
+ - Rust: No built-in support, needs to be wired up manually.
+- Test integration: partially supported, many parts need to be wired up
+ manually.
+
+=== CMake
+
+- Platform support: not as extensive as GNU Make or autoconf, but all major
+ platforms are supported.
+ - AIX
+ - Cygwin
+ - FreeBSD
+ - Linux
+ - OpenBSD
+ - Solaris
+ - Windows
+ - macOS
+- Ease of use: easy to use, discovering available options is not always
+ trivial. The scripting language used by CMake is somewhat cumbersome to use,
+ but extending CMake build instructions is doable.
+- IDE support: natively integrated into Microsoft Visual Studio. Can generate
+ project descriptions for Xcode. An extension is available for Visual Studio
+ Code. Many other IDEs have plugins for CMake.
+- Out-of-tree builds: supported.
+- Cross-platform builds: supported.
+- Language support:
+ - C: Supported for GCC, Clang, MSVC and other toolchains.
+ - Rust: No built-in support, needs to be wired up manually.
+- Test integration: supported, even though test dependencies are a bit
+ cumbersome to use via "test fixtures". Interactive test runs are not
+ supported.
+
+=== Meson
+
+- Platform: not as extensive as GNU Make or autoconf, but all major platforms
+ and some smaller ones are supported.
+ - AIX
+ - Cygwin
+ - DragonflyBSD
+ - FreeBSD
+ - Haiku
+ - Linux
+ - NetBSD
+ - OpenBSD
+ - Solaris
+ - Windows
+ - macOS
+- Ease of use: easy to use, discovering available options is easy. The
+ scripting language is straight-forward to use.
+- IDE support: Supports generating build instructions for Xcode and Microsoft
+ Visual Studio, a plugin exists for Visual Studio Code.
+- Out-of-tree builds: supported.
+- Cross-platform builds: supported.
+- Language support:
+ - C: Supported for GCC, Clang, MSVC and other toolchains.
+ - Rust: Supported for rustc.
+- Test integration: supported. Interactive tests are supported starting with
+ Meson 1.5.0 via the `--interactive` flag.
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v10 22/23] Introduce support for the Meson build system
2024-11-28 16:12 ` [PATCH v10 00/23] Modernize the build system Patrick Steinhardt
` (20 preceding siblings ...)
2024-11-28 16:12 ` [PATCH v10 21/23] Documentation: add comparison of build systems Patrick Steinhardt
@ 2024-11-28 16:12 ` Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 23/23] meson: fix conflicts with in-flight topics Patrick Steinhardt
22 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-28 16:12 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
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>
---
Documentation/meson.build | 324 +++++++
bin-wrappers/meson.build | 28 +
contrib/completion/meson.build | 8 +
contrib/meson.build | 1 +
gitweb/meson.build | 79 ++
meson.build | 1888 ++++++++++++++++++++++++++++++++++++
meson_options.txt | 81 ++
perl/FromCPAN/Mail/meson.build | 7 +
perl/FromCPAN/meson.build | 9 +
perl/Git/LoadCPAN/Mail/meson.build | 7 +
perl/Git/LoadCPAN/meson.build | 9 +
perl/Git/SVN/Memoize/meson.build | 7 +
perl/Git/SVN/meson.build | 20 +
perl/Git/meson.build | 18 +
perl/meson.build | 12 +
po/meson.build | 27 +
subprojects/.gitignore | 1 +
subprojects/curl.wrap | 13 +
subprojects/expat.wrap | 13 +
subprojects/openssl.wrap | 15 +
subprojects/pcre2.wrap | 16 +
subprojects/zlib.wrap | 13 +
t/helper/meson.build | 91 ++
t/meson.build | 1115 +++++++++++++++++++++
templates/hooks/meson.build | 26 +
templates/info/meson.build | 7 +
templates/meson.build | 15 +
27 files changed, 3850 insertions(+)
diff --git a/Documentation/meson.build b/Documentation/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..f2426ccaa30c29bd60b850eb0a9a4ab77c66a629
--- /dev/null
+++ b/Documentation/meson.build
@@ -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
diff --git a/bin-wrappers/meson.build b/bin-wrappers/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..6d03a19d7b8e3cf78ac0499b6cedf47e0c6cb441
--- /dev/null
+++ b/bin-wrappers/meson.build
@@ -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', fs.relative_to(executable.full_path(), meson.project_build_root()))
+
+ configure_file(
+ input: 'wrap-for-bin.sh',
+ output: fs.stem(executable.full_path()),
+ configuration: executable_config,
+ )
+endforeach
diff --git a/contrib/completion/meson.build b/contrib/completion/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..a9bfe2da312ac9764367b656bd8a4099b575ad72
--- /dev/null
+++ b/contrib/completion/meson.build
@@ -0,0 +1,8 @@
+foreach script : [
+ 'git-completion.bash',
+ 'git-completion.tcsh',
+ 'git-completion.zsh',
+ 'git-prompt.sh'
+]
+ test_dependencies += fs.copyfile(script)
+endforeach
diff --git a/contrib/meson.build b/contrib/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..a7b77b87c22c8f1d8a86faaafc2b647b94651db8
--- /dev/null
+++ b/contrib/meson.build
@@ -0,0 +1 @@
+subdir('completion')
diff --git a/gitweb/meson.build b/gitweb/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..ef868bd7dbcbcb5b69c2e73fc40c374435205c9c
--- /dev/null
+++ b/gitweb/meson.build
@@ -0,0 +1,79 @@
+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',
+]
+ fs.copyfile(asset,
+ install: true,
+ install_dir: get_option('datadir') / 'gitweb' / fs.parent(asset),
+ )
+endforeach
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..6531c9b67ed2cb8cb5eac9b0be4654ddd14fbe1d
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,1888 @@
+# Meson build system
+# ==================
+#
+# The Meson build system is an alternative to our Makefile that you can use to
+# build, test and install Git. Using Meson results in a couple of benefits:
+#
+# - Out-of-tree builds.
+# - Better integration into IDEs.
+# - Easy-to-use autoconfiguration of available features on your system.
+#
+# To use Meson from the command line you need to have both Meson and Ninja
+# installed. Alternatively, if you do not have Python available on your system,
+# you can also use Muon instead of Meson and Samurai instead of Ninja, both of
+# which are drop-ins replacement that only depend on C.
+#
+# Basic usage
+# ===========
+#
+# In the most trivial case, you can configure, build and install Git like this:
+#
+# 1. Set up the build directory. This only needs to happen once per build
+# directory you want to have. You can also configure multiple different
+# build directories with different configurations.
+#
+# $ meson setup build/
+#
+# The build directory gets ignored by Git automatically as Meson will write
+# a ".gitignore" file into it. From hereon, we will assume that you execute
+# commands inside this build directory.
+#
+# 2. Compile Git. You can either use Meson, Ninja or Samurai to do this, so all
+# of the following invocations are equivalent:
+#
+# $ meson compile
+# $ ninja
+# $ samu
+#
+# The different invocations should ultimately not make much of a difference.
+# Using Meson also works with other generators though, like when the build
+# directory has been set up for use with Microsoft Visual Studio.
+#
+# Ninja and Samurai use multiple jobs by default, scaling with the number of
+# processor cores available. You can pass the `-jN` flag to change this.
+#
+# Meson automatically picks up ccache and sccache when these are installed
+# when setting up the build directory. You can override this behaviour when
+# setting up the build directory by setting the `CC` environment variable to
+# your desired compiler.
+#
+# 3. Execute tests. Again, you can either use Meson, Ninja or Samurai to do this:
+#
+# $ meson test
+# $ ninja test
+# $ samu test
+#
+# It is recommended to use Meson in this case though as it also provides you
+# additional features that the other build systems don't have available.
+# You can e.g. pass additional arguments to the test executables or run
+# individual tests:
+#
+# # Execute the t0000-basic integration test and t-reftable-stack unit test.
+# $ meson test t0000-basic t-reftable-stack
+#
+# # Execute all reftable unit tests.
+# $ meson test t-reftable-*
+#
+# # Execute all tests and stop with the first failure.
+# $ meson test --maxfail 1
+#
+# # Execute single test interactively such that features like `debug ()` work.
+# $ meson test -i --test-args='-ix' t1400-update-ref
+#
+# Test execution is parallelized by default and scales with the number of
+# processor cores available. You can change the number of processes by passing
+# the `-jN` flag to `meson test`.
+#
+# 4. Install the Git distribution. Again, this can be done via Meson, Ninja or
+# Samurai:
+#
+# $ meson install
+# $ ninja install
+# $ samu install
+#
+# The prefix into which Git shall be installed is defined when setting up
+# the build directory. More on that in the "Configuration" section.
+#
+# Meson supports multiple backends. The default backend generates Ninja build
+# instructions, but it also supports the generation of Microsoft Visual
+# Studio solutions as well as Xcode projects by passing the `--backend` option
+# to `meson setup`. IDEs like Eclipse and Visual Studio Code provide plugins to
+# import Meson files directly.
+#
+# Configuration
+# =============
+#
+# The exact configuration of Git is determined when setting up the build
+# directory via `meson setup`. Unless told otherwise, Meson will automatically
+# detect the availability of various bits and pieces. There are two different
+# kinds of options that can be used to further tweak the build:
+#
+# - Built-in options provided by Meson.
+#
+# - Options defined by the project in the "meson_options.txt" file.
+#
+# Both kinds of options can be inspected by running `meson configure` in the
+# build directory, which will give you a list of the current value for all
+# options.
+#
+# Options can be configured either when setting up the build directory or can
+# be changed in preexisting build directories:
+#
+# # Set up a new build directory with optimized settings that will be
+# # installed into an alternative prefix.
+# $ meson setup --buildtype release --optimization 3 --strip --prefix=/home/$USER build
+#
+# # Set up a new build directory with a higher warning level. Level 2 is
+# # mostly equivalent to setting DEVELOPER=1, level 3 and "everything"
+# # will enable even more warnings.
+# $ meson setup -Dwarning_level=2 build
+#
+# # Set up a new build directory with 'address' and 'undefined' sanitizers
+# # using Clang.
+# $ CC=clang meson setup -Db_sanitize=address,undefined build
+#
+# # Disable tests in a preexisting build directory.
+# $ meson configure -Dtests=false
+#
+# # Disable features based on Python
+# $ meson configure -Dpython=disabled
+#
+# Options have a type like booleans, choices, strings or features. Features are
+# somewhat special as they can have one of three values: enabled, disabled or
+# auto. While the first two values are self-explanatory, "auto" will enable or
+# disable the feature based on the availability of prerequisites to support it.
+# Python-based features for example will be enabled automatically when a Python
+# interpreter could be found. The default value of such features can be changed
+# via `meson setup --auto-features={enabled,disabled,auto}`, which will set the
+# value of all features with a value of "auto" to the provided one by default.
+#
+# It is also possible to store a set of configuration options in machine files.
+# This can be useful in case you regularly want to reuse the same set of options:
+#
+# [binaries]
+# c = ['clang']
+# ar = ['ar']
+#
+# [project options]
+# gettext = 'disabled'
+# default_editor = 'vim'
+#
+# [built-in options]
+# b_lto = true
+# b_sanitize = 'address,undefined'
+#
+# These machine files can be passed to `meson setup` via the `--native-file`
+# option.
+#
+# Subproject wrappers
+# ===================
+#
+# Subproject wrappers are a feature provided by Meson that allows the automatic
+# fallback to a "wrapped" dependency in case the dependency is not provided by
+# the system. For example if the system is lacking curl, then Meson will use
+# "subprojects/curl.wrap" to set up curl as a subproject and compile and link
+# the dependency into Git itself. This is especially helpful on systems like
+# Windows, where you typically don't have such dependencies installed.
+#
+# The use of subproject wrappers can be disabled by executing `meson setup`
+# with the `--wrap-mode nofallback` option.
+
+project('git', 'c',
+ meson_version: '>=1.3.0',
+ # MSVC does not support GNU99, and C99 does not define __STDC_VERSION__
+ # on MSVC. So we instead fall back to C11 there.
+ default_options: ['c_std=gnu99,c11'],
+ version: 'v2.47.GIT',
+)
+
+fs = import('fs')
+
+program_path = []
+# Git for Windows provides all the tools we need to build Git.
+if host_machine.system() == 'windows'
+ program_path += [ 'C:/Program Files/Git/bin', 'C:/Program Files/Git/usr/bin' ]
+endif
+
+cygpath = find_program('cygpath', dirs: program_path, required: false)
+diff = find_program('diff', dirs: program_path)
+shell = find_program('sh', dirs: program_path)
+tar = find_program('tar', dirs: program_path)
+
+script_environment = environment()
+foreach tool : ['cat', 'cut', 'grep', 'sed', 'sort', 'tr', 'uname']
+ program = find_program(tool, dirs: program_path)
+ script_environment.prepend('PATH', fs.parent(program.full_path()))
+endforeach
+
+git = find_program('git', dirs: program_path, required: false)
+if git.found()
+ script_environment.prepend('PATH', fs.parent(git.full_path()))
+endif
+
+if get_option('sane_tool_path') != ''
+ script_environment.prepend('PATH', get_option('sane_tool_path'))
+endif
+
+compiler = meson.get_compiler('c')
+
+libgit_sources = [
+ 'abspath.c',
+ 'add-interactive.c',
+ 'add-patch.c',
+ 'advice.c',
+ 'alias.c',
+ 'alloc.c',
+ 'apply.c',
+ 'archive-tar.c',
+ 'archive-zip.c',
+ 'archive.c',
+ 'attr.c',
+ 'base85.c',
+ 'bisect.c',
+ 'blame.c',
+ 'blob.c',
+ 'bloom.c',
+ 'branch.c',
+ 'bulk-checkin.c',
+ 'bundle-uri.c',
+ 'bundle.c',
+ 'cache-tree.c',
+ 'cbtree.c',
+ 'chdir-notify.c',
+ 'checkout.c',
+ 'chunk-format.c',
+ 'color.c',
+ 'column.c',
+ 'combine-diff.c',
+ 'commit-graph.c',
+ 'commit-reach.c',
+ 'commit.c',
+ 'compat/nonblock.c',
+ 'compat/obstack.c',
+ 'compat/terminal.c',
+ 'compat/zlib-uncompress2.c',
+ 'config.c',
+ 'connect.c',
+ 'connected.c',
+ 'convert.c',
+ 'copy.c',
+ 'credential.c',
+ 'csum-file.c',
+ 'ctype.c',
+ 'date.c',
+ 'decorate.c',
+ 'delta-islands.c',
+ 'diagnose.c',
+ 'diff-delta.c',
+ 'diff-merges.c',
+ 'diff-lib.c',
+ 'diff-no-index.c',
+ 'diff.c',
+ 'diffcore-break.c',
+ 'diffcore-delta.c',
+ 'diffcore-order.c',
+ 'diffcore-pickaxe.c',
+ 'diffcore-rename.c',
+ 'diffcore-rotate.c',
+ 'dir-iterator.c',
+ 'dir.c',
+ 'editor.c',
+ 'entry.c',
+ 'environment.c',
+ 'ewah/bitmap.c',
+ 'ewah/ewah_bitmap.c',
+ 'ewah/ewah_io.c',
+ 'ewah/ewah_rlw.c',
+ 'exec-cmd.c',
+ 'fetch-negotiator.c',
+ 'fetch-pack.c',
+ 'fmt-merge-msg.c',
+ 'fsck.c',
+ 'fsmonitor.c',
+ 'fsmonitor-ipc.c',
+ 'fsmonitor-settings.c',
+ 'gettext.c',
+ 'git-zlib.c',
+ 'gpg-interface.c',
+ 'graph.c',
+ 'grep.c',
+ 'hash-lookup.c',
+ 'hashmap.c',
+ 'help.c',
+ 'hex.c',
+ 'hex-ll.c',
+ 'hook.c',
+ 'ident.c',
+ 'json-writer.c',
+ 'kwset.c',
+ 'levenshtein.c',
+ 'line-log.c',
+ 'line-range.c',
+ 'linear-assignment.c',
+ 'list-objects-filter-options.c',
+ 'list-objects-filter.c',
+ 'list-objects.c',
+ 'lockfile.c',
+ 'log-tree.c',
+ 'loose.c',
+ 'ls-refs.c',
+ 'mailinfo.c',
+ 'mailmap.c',
+ 'match-trees.c',
+ 'mem-pool.c',
+ 'merge-blobs.c',
+ 'merge-ll.c',
+ 'merge-ort.c',
+ 'merge-ort-wrappers.c',
+ 'merge-recursive.c',
+ 'merge.c',
+ 'midx.c',
+ 'midx-write.c',
+ 'name-hash.c',
+ 'negotiator/default.c',
+ 'negotiator/noop.c',
+ 'negotiator/skipping.c',
+ 'notes-cache.c',
+ 'notes-merge.c',
+ 'notes-utils.c',
+ 'notes.c',
+ 'object-file-convert.c',
+ 'object-file.c',
+ 'object-name.c',
+ 'object.c',
+ 'oid-array.c',
+ 'oidmap.c',
+ 'oidset.c',
+ 'oidtree.c',
+ 'pack-bitmap-write.c',
+ 'pack-bitmap.c',
+ 'pack-check.c',
+ 'pack-mtimes.c',
+ 'pack-objects.c',
+ 'pack-revindex.c',
+ 'pack-write.c',
+ 'packfile.c',
+ 'pager.c',
+ 'parallel-checkout.c',
+ 'parse.c',
+ 'parse-options-cb.c',
+ 'parse-options.c',
+ 'patch-delta.c',
+ 'patch-ids.c',
+ 'path.c',
+ 'pathspec.c',
+ 'pkt-line.c',
+ 'preload-index.c',
+ 'pretty.c',
+ 'prio-queue.c',
+ 'progress.c',
+ 'promisor-remote.c',
+ 'prompt.c',
+ 'protocol.c',
+ 'protocol-caps.c',
+ 'prune-packed.c',
+ 'pseudo-merge.c',
+ 'quote.c',
+ 'range-diff.c',
+ 'reachable.c',
+ 'read-cache.c',
+ 'rebase-interactive.c',
+ 'rebase.c',
+ 'ref-filter.c',
+ 'reflog-walk.c',
+ 'reflog.c',
+ 'refs.c',
+ 'refs/debug.c',
+ 'refs/files-backend.c',
+ 'refs/reftable-backend.c',
+ 'refs/iterator.c',
+ 'refs/packed-backend.c',
+ 'refs/ref-cache.c',
+ 'refspec.c',
+ 'reftable/basics.c',
+ 'reftable/error.c',
+ 'reftable/block.c',
+ 'reftable/blocksource.c',
+ 'reftable/iter.c',
+ 'reftable/merged.c',
+ 'reftable/pq.c',
+ 'reftable/reader.c',
+ 'reftable/record.c',
+ 'reftable/stack.c',
+ 'reftable/tree.c',
+ 'reftable/writer.c',
+ 'remote.c',
+ 'replace-object.c',
+ 'repo-settings.c',
+ 'repository.c',
+ 'rerere.c',
+ 'reset.c',
+ 'resolve-undo.c',
+ 'revision.c',
+ 'run-command.c',
+ 'send-pack.c',
+ 'sequencer.c',
+ 'serve.c',
+ 'server-info.c',
+ 'setup.c',
+ 'shallow.c',
+ 'sideband.c',
+ 'sigchain.c',
+ 'sparse-index.c',
+ 'split-index.c',
+ 'stable-qsort.c',
+ 'statinfo.c',
+ 'strbuf.c',
+ 'streaming.c',
+ 'string-list.c',
+ 'strmap.c',
+ 'strvec.c',
+ 'sub-process.c',
+ 'submodule-config.c',
+ 'submodule.c',
+ 'symlinks.c',
+ 'tag.c',
+ 'tempfile.c',
+ 'thread-utils.c',
+ 'tmp-objdir.c',
+ 'trace.c',
+ 'trace2.c',
+ 'trace2/tr2_cfg.c',
+ 'trace2/tr2_cmd_name.c',
+ 'trace2/tr2_ctr.c',
+ 'trace2/tr2_dst.c',
+ 'trace2/tr2_sid.c',
+ 'trace2/tr2_sysenv.c',
+ 'trace2/tr2_tbuf.c',
+ 'trace2/tr2_tgt_event.c',
+ 'trace2/tr2_tgt_normal.c',
+ 'trace2/tr2_tgt_perf.c',
+ 'trace2/tr2_tls.c',
+ 'trace2/tr2_tmr.c',
+ 'trailer.c',
+ 'transport-helper.c',
+ 'transport.c',
+ 'tree-diff.c',
+ 'tree-walk.c',
+ 'tree.c',
+ 'unpack-trees.c',
+ 'upload-pack.c',
+ 'url.c',
+ 'urlmatch.c',
+ 'usage.c',
+ 'userdiff.c',
+ 'utf8.c',
+ 'varint.c',
+ 'versioncmp.c',
+ 'walker.c',
+ 'wildmatch.c',
+ 'worktree.c',
+ 'wrapper.c',
+ 'write-or-die.c',
+ 'ws.c',
+ 'wt-status.c',
+ 'xdiff-interface.c',
+ 'xdiff/xdiffi.c',
+ 'xdiff/xemit.c',
+ 'xdiff/xhistogram.c',
+ 'xdiff/xmerge.c',
+ 'xdiff/xpatience.c',
+ 'xdiff/xprepare.c',
+ 'xdiff/xutils.c',
+]
+
+builtin_sources = [
+ 'builtin/add.c',
+ 'builtin/am.c',
+ 'builtin/annotate.c',
+ 'builtin/apply.c',
+ 'builtin/archive.c',
+ 'builtin/bisect.c',
+ 'builtin/blame.c',
+ 'builtin/branch.c',
+ 'builtin/bugreport.c',
+ 'builtin/bundle.c',
+ 'builtin/cat-file.c',
+ 'builtin/check-attr.c',
+ 'builtin/check-ignore.c',
+ 'builtin/check-mailmap.c',
+ 'builtin/check-ref-format.c',
+ 'builtin/checkout--worker.c',
+ 'builtin/checkout-index.c',
+ 'builtin/checkout.c',
+ 'builtin/clean.c',
+ 'builtin/clone.c',
+ 'builtin/column.c',
+ 'builtin/commit-graph.c',
+ 'builtin/commit-tree.c',
+ 'builtin/commit.c',
+ 'builtin/config.c',
+ 'builtin/count-objects.c',
+ 'builtin/credential-cache--daemon.c',
+ 'builtin/credential-cache.c',
+ 'builtin/credential-store.c',
+ 'builtin/credential.c',
+ 'builtin/describe.c',
+ 'builtin/diagnose.c',
+ 'builtin/diff-files.c',
+ 'builtin/diff-index.c',
+ 'builtin/diff-tree.c',
+ 'builtin/diff.c',
+ 'builtin/difftool.c',
+ 'builtin/fast-export.c',
+ 'builtin/fast-import.c',
+ 'builtin/fetch-pack.c',
+ 'builtin/fetch.c',
+ 'builtin/fmt-merge-msg.c',
+ 'builtin/for-each-ref.c',
+ 'builtin/for-each-repo.c',
+ 'builtin/fsck.c',
+ 'builtin/fsmonitor--daemon.c',
+ 'builtin/gc.c',
+ 'builtin/get-tar-commit-id.c',
+ 'builtin/grep.c',
+ 'builtin/hash-object.c',
+ 'builtin/help.c',
+ 'builtin/hook.c',
+ 'builtin/index-pack.c',
+ 'builtin/init-db.c',
+ 'builtin/interpret-trailers.c',
+ 'builtin/log.c',
+ 'builtin/ls-files.c',
+ 'builtin/ls-remote.c',
+ 'builtin/ls-tree.c',
+ 'builtin/mailinfo.c',
+ 'builtin/mailsplit.c',
+ 'builtin/merge-base.c',
+ 'builtin/merge-file.c',
+ 'builtin/merge-index.c',
+ 'builtin/merge-ours.c',
+ 'builtin/merge-recursive.c',
+ 'builtin/merge-tree.c',
+ 'builtin/merge.c',
+ 'builtin/mktag.c',
+ 'builtin/mktree.c',
+ 'builtin/multi-pack-index.c',
+ 'builtin/mv.c',
+ 'builtin/name-rev.c',
+ 'builtin/notes.c',
+ 'builtin/pack-objects.c',
+ 'builtin/pack-redundant.c',
+ 'builtin/pack-refs.c',
+ 'builtin/patch-id.c',
+ 'builtin/prune-packed.c',
+ 'builtin/prune.c',
+ 'builtin/pull.c',
+ 'builtin/push.c',
+ 'builtin/range-diff.c',
+ 'builtin/read-tree.c',
+ 'builtin/rebase.c',
+ 'builtin/receive-pack.c',
+ 'builtin/reflog.c',
+ 'builtin/refs.c',
+ 'builtin/remote-ext.c',
+ 'builtin/remote-fd.c',
+ 'builtin/remote.c',
+ 'builtin/repack.c',
+ 'builtin/replace.c',
+ 'builtin/replay.c',
+ 'builtin/rerere.c',
+ 'builtin/reset.c',
+ 'builtin/rev-list.c',
+ 'builtin/rev-parse.c',
+ 'builtin/revert.c',
+ 'builtin/rm.c',
+ 'builtin/send-pack.c',
+ 'builtin/shortlog.c',
+ 'builtin/show-branch.c',
+ 'builtin/show-index.c',
+ 'builtin/show-ref.c',
+ 'builtin/sparse-checkout.c',
+ 'builtin/stash.c',
+ 'builtin/stripspace.c',
+ 'builtin/submodule--helper.c',
+ 'builtin/symbolic-ref.c',
+ 'builtin/tag.c',
+ 'builtin/unpack-file.c',
+ 'builtin/unpack-objects.c',
+ 'builtin/update-index.c',
+ 'builtin/update-ref.c',
+ 'builtin/update-server-info.c',
+ 'builtin/upload-archive.c',
+ 'builtin/upload-pack.c',
+ 'builtin/var.c',
+ 'builtin/verify-commit.c',
+ 'builtin/verify-pack.c',
+ 'builtin/verify-tag.c',
+ 'builtin/worktree.c',
+ 'builtin/write-tree.c',
+]
+
+libgit_sources += custom_target(
+ input: 'command-list.txt',
+ output: 'command-list.h',
+ command: [shell, meson.current_source_dir() + '/generate-cmdlist.sh', meson.current_source_dir(), '@OUTPUT@'],
+ env: script_environment,
+)
+
+libgit_sources += custom_target(
+ output: 'config-list.h',
+ command: [
+ shell,
+ meson.current_source_dir() + '/generate-configlist.sh',
+ meson.current_source_dir(),
+ '@OUTPUT@',
+ ],
+ env: script_environment,
+)
+
+libgit_sources += custom_target(
+ input: 'Documentation/githooks.txt',
+ output: 'hook-list.h',
+ command: [
+ shell,
+ meson.current_source_dir() + '/generate-hooklist.sh',
+ meson.current_source_dir(),
+ '@OUTPUT@',
+ ],
+ env: script_environment,
+)
+
+# This contains the variables for GIT-BUILD-OPTIONS, which we use to propagate
+# build options to our tests.
+build_options_config = configuration_data()
+build_options_config.set('GIT_INTEROP_MAKE_OPTS', '')
+build_options_config.set('GIT_PERF_LARGE_REPO', '')
+build_options_config.set('GIT_PERF_MAKE_COMMAND', '')
+build_options_config.set('GIT_PERF_MAKE_OPTS', '')
+build_options_config.set('GIT_PERF_REPEAT_COUNT', '')
+build_options_config.set('GIT_PERF_REPO', '')
+build_options_config.set('GIT_TEST_CMP_USE_COPIED_CONTEXT', '')
+build_options_config.set('GIT_TEST_INDEX_VERSION', '')
+build_options_config.set('GIT_TEST_OPTS', '')
+build_options_config.set('GIT_TEST_PERL_FATAL_WARNINGS', '')
+build_options_config.set('GIT_TEST_UTF8_LOCALE', '')
+build_options_config.set_quoted('LOCALEDIR', fs.as_posix(get_option('prefix') / get_option('localedir')))
+build_options_config.set('GITWEBDIR', fs.as_posix(get_option('prefix') / get_option('datadir') / 'gitweb'))
+
+if get_option('sane_tool_path') != ''
+ build_options_config.set_quoted('BROKEN_PATH_FIX', 's|^\# @BROKEN_PATH_FIX@$|git_broken_path_fix "' + get_option('sane_tool_path') + '"|')
+else
+ build_options_config.set_quoted('BROKEN_PATH_FIX', '/^\# @BROKEN_PATH_FIX@$/d')
+endif
+
+test_output_directory = get_option('test_output_directory')
+if test_output_directory == ''
+ test_output_directory = meson.project_build_root() / 'test-output'
+endif
+
+# These variables are used for building libgit.a.
+libgit_c_args = [
+ '-DBINDIR="' + get_option('bindir') + '"',
+ '-DDEFAULT_EDITOR="' + get_option('default_editor') + '"',
+ '-DDEFAULT_GIT_TEMPLATE_DIR="' + get_option('datadir') / 'git-core/templates' + '"',
+ '-DDEFAULT_HELP_FORMAT="' + get_option('default_help_format') + '"',
+ '-DDEFAULT_PAGER="' + get_option('default_pager') + '"',
+ '-DETC_GITATTRIBUTES="' + get_option('gitattributes') + '"',
+ '-DETC_GITCONFIG="' + get_option('gitconfig') + '"',
+ '-DFALLBACK_RUNTIME_PREFIX="' + get_option('prefix') + '"',
+ '-DGIT_EXEC_PATH="' + get_option('prefix') / get_option('libexecdir') / 'git-core"',
+ '-DGIT_HOST_CPU="' + host_machine.cpu_family() + '"',
+ '-DGIT_HTML_PATH="' + get_option('datadir') / 'doc/git-doc"',
+ '-DGIT_INFO_PATH="' + get_option('infodir') + '"',
+ '-DGIT_LOCALE_PATH="' + get_option('localedir') + '"',
+ '-DGIT_MAN_PATH="' + get_option('mandir') + '"',
+ '-DPAGER_ENV="' + get_option('pager_environment') + '"',
+ '-DSHELL_PATH="' + fs.as_posix(shell.full_path()) + '"',
+]
+libgit_include_directories = [ '.' ]
+libgit_dependencies = [ ]
+
+# Treat any warning level above 1 the same as we treat DEVELOPER=1 in our
+# Makefile.
+if get_option('warning_level') in ['2','3', 'everything'] and compiler.get_argument_syntax() == 'gcc'
+ foreach cflag : [
+ '-Wdeclaration-after-statement',
+ '-Wformat-security',
+ '-Wold-style-definition',
+ '-Woverflow',
+ '-Wpointer-arith',
+ '-Wstrict-prototypes',
+ '-Wunused',
+ '-Wvla',
+ '-Wwrite-strings',
+ '-fno-common',
+ '-Wtautological-constant-out-of-range-compare',
+ # If a function is public, there should be a prototype and the right
+ # header file should be included. If not, it should be static.
+ '-Wmissing-prototypes',
+ # These are disabled because we have these all over the place.
+ '-Wno-empty-body',
+ '-Wno-missing-field-initializers',
+ '-Wno-sign-compare',
+ ]
+ if compiler.has_argument(cflag)
+ libgit_c_args += cflag
+ endif
+ endforeach
+endif
+
+if get_option('b_sanitize').contains('address')
+ build_options_config.set('SANITIZE_ADDRESS', 'YesCompiledWithIt')
+else
+ build_options_config.set('SANITIZE_ADDRESS', '')
+endif
+if get_option('b_sanitize').contains('leak')
+ libgit_c_args += '-DSUPPRESS_ANNOTATED_LEAKS'
+ build_options_config.set('SANITIZE_LEAK', 'YesCompiledWithIt')
+else
+ build_options_config.set('SANITIZE_LEAK', '')
+endif
+if get_option('b_sanitize').contains('undefined')
+ libgit_c_args += '-DSHA1DC_FORCE_ALIGNED_ACCESS'
+endif
+
+executable_suffix = ''
+if host_machine.system() == 'cygwin' or host_machine.system() == 'windows'
+ executable_suffix = '.exe'
+ libgit_c_args += '-DSTRIP_EXTENSION="' + executable_suffix + '"'
+endif
+build_options_config.set_quoted('X', executable_suffix)
+
+python = import('python').find_installation('python3', required: get_option('python'))
+if python.found()
+ build_options_config.set('NO_PYTHON', '')
+else
+ libgit_c_args += '-DNO_PYTHON'
+ build_options_config.set('NO_PYTHON', '1')
+endif
+
+# Perl is used for two different things: our test harness and to provide some
+# features. It is optional if you want to neither execute tests nor use any of
+# these optional features.
+perl_required = get_option('perl')
+if get_option('tests')
+ perl_required = true
+endif
+
+# Note that we only set NO_PERL if the Perl features were disabled by the user.
+# It may not be set when we have found Perl, but only use it to run tests.
+perl = find_program('perl', version: '>=5.8.1', dirs: program_path, required: perl_required)
+perl_features_enabled = perl.found() and get_option('perl').allowed()
+if perl_features_enabled
+ build_options_config.set('NO_PERL', '')
+
+ if get_option('runtime_prefix')
+ build_options_config.set('PERL_LOCALEDIR', '')
+ else
+ build_options_config.set_quoted('PERL_LOCALEDIR', fs.as_posix(get_option('prefix') / get_option('localedir')))
+ endif
+
+ if get_option('perl_cpan_fallback')
+ build_options_config.set('NO_PERL_CPAN_FALLBACKS', '')
+ else
+ build_options_config.set_quoted('NO_PERL_CPAN_FALLBACKS', 'YesPlease')
+ endif
+else
+ libgit_c_args += '-DNO_PERL'
+ build_options_config.set('NO_PERL', '1')
+ build_options_config.set('PERL_LOCALEDIR', '')
+ build_options_config.set('NO_PERL_CPAN_FALLBACKS', '')
+endif
+
+zlib = dependency('zlib', default_options: ['default_library=static', 'tests=disabled'])
+if zlib.version().version_compare('<1.2.0')
+ libgit_c_args += '-DNO_DEFLATE_BOUND'
+endif
+libgit_dependencies += zlib
+
+threads = dependency('threads', required: false)
+if threads.found()
+ libgit_dependencies += threads
+ build_options_config.set('NO_PTHREADS', '')
+else
+ libgit_c_args += '-DNO_PTHREADS'
+ build_options_config.set('NO_PTHREADS', '1')
+endif
+
+msgfmt = find_program('msgfmt', dirs: program_path, required: false)
+gettext_option = get_option('gettext').disable_auto_if(not msgfmt.found())
+if not msgfmt.found() and gettext_option.enabled()
+ error('Internationalization via libintl requires msgfmt')
+endif
+
+if gettext_option.allowed() and host_machine.system() == 'darwin' and get_option('macos_use_homebrew_gettext')
+ if host_machine.cpu_family() == 'x86_64'
+ libintl_prefix = '/usr/local'
+ elif host_machine.cpu_family() == 'aarch64'
+ libintl_prefix = '/opt/homebrew'
+ else
+ error('Homebrew workaround not supported on current architecture')
+ endif
+
+ intl = compiler.find_library('intl', dirs: libintl_prefix / 'lib', required: gettext_option)
+ if intl.found()
+ intl = declare_dependency(
+ dependencies: intl,
+ include_directories: libintl_prefix / 'include',
+ )
+ endif
+else
+ intl = dependency('intl', required: gettext_option)
+endif
+if intl.found()
+ libgit_dependencies += intl
+ build_options_config.set('NO_GETTEXT', '')
+ build_options_config.set('USE_GETTEXT_SCHEME', '')
+else
+ libgit_c_args += '-DNO_GETTEXT'
+ build_options_config.set('NO_GETTEXT', '1')
+ build_options_config.set('USE_GETTEXT_SCHEME', 'fallthrough')
+endif
+
+iconv = dependency('iconv', required: get_option('iconv'))
+if iconv.found()
+ libgit_dependencies += iconv
+ build_options_config.set('NO_ICONV', '')
+
+ have_old_iconv = false
+ if not compiler.compiles('''
+ #include <iconv.h>
+
+ extern size_t iconv(iconv_t cd,
+ char **inbuf, size_t *inbytesleft,
+ char **outbuf, size_t *outbytesleft);
+ ''', name: 'old iconv interface', dependencies: [iconv])
+ libgit_c_args += '-DOLD_ICONV'
+ have_old_iconv = true
+ endif
+
+ iconv_omits_bom_source = '''#
+ #include <iconv.h>
+
+ int main(int argc, const char **argv)
+ {
+ '''
+ if have_old_iconv
+ iconv_omits_bom_source += '''
+ typedef const char *iconv_ibp;
+ '''
+ else
+ iconv_omits_bom_source += '''
+ typedef char *iconv_ibp;
+ '''
+ endif
+ iconv_omits_bom_source += '''
+ int v;
+ iconv_t conv;
+ char in[] = "a"; iconv_ibp pin = in;
+ char out[20] = ""; char *pout = out;
+ size_t isz = sizeof in;
+ size_t osz = sizeof out;
+
+ conv = iconv_open("UTF-16", "UTF-8");
+ iconv(conv, &pin, &isz, &pout, &osz);
+ iconv_close(conv);
+ v = (unsigned char)(out[0]) + (unsigned char)(out[1]);
+ return v != 0xfe + 0xff;
+ }
+ '''
+
+ if compiler.run(iconv_omits_bom_source,
+ dependencies: iconv,
+ name: 'iconv omits BOM',
+ ).returncode() != 0
+ libgit_c_args += '-DICONV_OMITS_BOM'
+ endif
+else
+ libgit_c_args += '-DNO_ICONV'
+ build_options_config.set('NO_ICONV', '1')
+endif
+
+pcre2 = dependency('libpcre2-8', required: get_option('pcre2'), default_options: ['default_library=static', 'test=false'])
+if pcre2.found()
+ libgit_dependencies += pcre2
+ libgit_c_args += '-DUSE_LIBPCRE2'
+ build_options_config.set('USE_LIBPCRE2', '1')
+else
+ build_options_config.set('USE_LIBPCRE2', '')
+endif
+
+curl = dependency('libcurl', version: '>=7.21.3', required: get_option('curl'), default_options: ['default_library=static', 'tests=disabled', 'tool=disabled'])
+use_curl_for_imap_send = false
+if curl.found()
+ if curl.version().version_compare('>=7.34.0')
+ libgit_c_args += '-DUSE_CURL_FOR_IMAP_SEND'
+ use_curl_for_imap_send = true
+ endif
+
+ libgit_dependencies += curl
+ libgit_c_args += '-DCURL_DISABLE_TYPECHECK'
+ build_options_config.set('NO_CURL', '')
+else
+ libgit_c_args += '-DNO_CURL'
+ build_options_config.set('NO_CURL', '1')
+endif
+
+expat = dependency('expat', required: get_option('expat'), default_options: ['default_library=static', 'build_tests=false'])
+if expat.found()
+ libgit_dependencies += expat
+
+ if expat.version().version_compare('<=1.2')
+ libgit_c_args += '-DEXPAT_NEEDS_XMLPARSE_H'
+ endif
+ build_options_config.set('NO_EXPAT', '')
+else
+ libgit_c_args += '-DNO_EXPAT'
+ build_options_config.set('NO_EXPAT', '1')
+endif
+
+if not compiler.has_header('sys/select.h')
+ libgit_c_args += '-DNO_SYS_SELECT_H'
+endif
+
+has_poll_h = compiler.has_header('poll.h')
+if not has_poll_h
+ libgit_c_args += '-DNO_POLL_H'
+endif
+
+has_sys_poll_h = compiler.has_header('sys/poll.h')
+if not has_sys_poll_h
+ libgit_c_args += '-DNO_SYS_POLL_H'
+endif
+
+if not has_poll_h and not has_sys_poll_h
+ libgit_c_args += '-DNO_POLL'
+ libgit_sources += 'compat/poll/poll.c'
+ libgit_include_directories += 'compat/poll'
+endif
+
+if not compiler.has_header('inttypes.h')
+ libgit_c_args += '-DNO_INTTYPES_H'
+endif
+
+if compiler.has_header('libcharset.h')
+ libcharset = compiler.find_library('charset')
+
+ if compiler.has_function('locale_charset',
+ prefix: '#include <libcharset.h>',
+ dependencies: iconv,
+ )
+ libgit_c_args += '-DHAVE_LIBCHARSET_H'
+ elif compiler.has_function('locale_charset',
+ prefix: '#include <libcharset.h>',
+ dependencies: libcharset,
+ )
+ libgit_c_args += '-DHAVE_LIBCHARSET_H'
+ endif
+endif
+
+if compiler.has_header('alloca.h')
+ libgit_c_args += '-DHAVE_ALLOCA_H'
+endif
+
+if compiler.has_header('sys/sysinfo.h')
+ libgit_c_args += '-DHAVE_SYSINFO'
+endif
+
+# Windows has libgen.h and a basename implementation, but we still need our own
+# implementation to threat things like drive prefixes specially.
+if host_machine.system() == 'windows' or not compiler.has_header('libgen.h')
+ libgit_c_args += '-DNO_LIBGEN_H'
+ libgit_sources += 'compat/basename.c'
+endif
+
+if compiler.has_header('paths.h')
+ libgit_c_args += '-DHAVE_PATHS_H'
+endif
+
+if compiler.has_header('strings.h')
+ libgit_c_args += '-DHAVE_STRINGS_H'
+endif
+
+networking_dependencies = [ ]
+if host_machine.system() == 'windows'
+ winsock = compiler.find_library('ws2_32', required: false)
+ if winsock.found()
+ networking_dependencies += winsock
+ endif
+else
+ libresolv = compiler.find_library('resolv', required: false)
+ if libresolv.found()
+ networking_dependencies += libresolv
+ endif
+endif
+libgit_dependencies += networking_dependencies
+
+foreach symbol : ['inet_ntop', 'inet_pton', 'strerror']
+ if not compiler.has_function(symbol, dependencies: networking_dependencies)
+ libgit_c_args += '-DNO_' + symbol.to_upper()
+ endif
+endforeach
+
+has_ipv6 = compiler.has_function('getaddrinfo', dependencies: networking_dependencies)
+if not has_ipv6
+ libgit_c_args += '-DNO_IPV6'
+endif
+
+if not compiler.compiles('''
+ #ifdef _WIN32
+ # include <winsock2.h>
+ #else
+ # include <sys/types.h>
+ # include <sys/socket.h>
+ #endif
+
+ void func(void)
+ {
+ struct sockaddr_storage x;
+ }
+''', name: 'struct sockaddr_storage')
+ if has_ipv6
+ libgit_c_args += '-Dsockaddr_storage=sockaddr_in6'
+ else
+ libgit_c_args += '-Dsockaddr_storage=sockaddr_in'
+ endif
+endif
+
+if compiler.has_function('socket', dependencies: networking_dependencies)
+ libgit_sources += [
+ 'unix-socket.c',
+ 'unix-stream-server.c',
+ ]
+ build_options_config.set('NO_UNIX_SOCKETS', '')
+else
+ libgit_c_args += '-DNO_UNIX_SOCKETS'
+ build_options_config.set('NO_UNIX_SOCKETS', '1')
+endif
+
+if not compiler.has_function('pread')
+ libgit_c_args += '-DNO_PREAD'
+ libgit_sources += 'compat/pread.c'
+endif
+
+if host_machine.system() == 'darwin'
+ libgit_sources += 'compat/precompose_utf8.c'
+ libgit_c_args += '-DPRECOMPOSE_UNICODE'
+ libgit_c_args += '-DPROTECT_HFS_DEFAULT'
+endif
+
+# Configure general compatibility wrappers.
+if host_machine.system() == 'cygwin'
+ libgit_sources += [
+ 'compat/win32/path-utils.c',
+ ]
+elif host_machine.system() == 'windows'
+ libgit_sources += [
+ 'compat/mingw.c',
+ 'compat/winansi.c',
+ 'compat/win32/flush.c',
+ 'compat/win32/path-utils.c',
+ 'compat/win32/pthread.c',
+ 'compat/win32/syslog.c',
+ 'compat/win32/dirent.c',
+ 'compat/win32mmap.c',
+ 'compat/nedmalloc/nedmalloc.c',
+ ]
+
+ libgit_c_args += [
+ '-DDETECT_MSYS_TTY',
+ '-DENSURE_MSYSTEM_IS_SET',
+ '-DNATIVE_CRLF',
+ '-DNOGDI',
+ '-DNO_POSIX_GOODIES',
+ '-DWIN32',
+ '-D_CONSOLE',
+ '-D_CONSOLE_DETECT_MSYS_TTY',
+ '-D__USE_MINGW_ANSI_STDIO=0',
+ ]
+
+ libgit_dependencies += compiler.find_library('ntdll')
+ libgit_include_directories += 'compat/win32'
+ if compiler.get_id() == 'msvc'
+ libgit_include_directories += 'compat/vcbuild/include'
+ endif
+endif
+
+if host_machine.system() == 'linux'
+ libgit_sources += 'compat/linux/procinfo.c'
+elif host_machine.system() == 'windows'
+ libgit_sources += 'compat/win32/trace2_win32_process_info.c'
+else
+ libgit_sources += 'compat/stub/procinfo.c'
+endif
+
+if host_machine.system() == 'cygwin' or host_machine.system() == 'windows'
+ libgit_c_args += [
+ '-DUNRELIABLE_FSTAT',
+ '-DMMAP_PREVENTS_DELETE',
+ '-DOBJECT_CREATION_MODE=1',
+ ]
+endif
+
+# Configure the simple-ipc subsystem required fro the fsmonitor.
+if host_machine.system() == 'windows'
+ libgit_sources += [
+ 'compat/simple-ipc/ipc-shared.c',
+ 'compat/simple-ipc/ipc-win32.c',
+ ]
+ libgit_c_args += '-DSUPPORTS_SIMPLE_IPC'
+else
+ libgit_sources += [
+ 'compat/simple-ipc/ipc-shared.c',
+ 'compat/simple-ipc/ipc-unix-socket.c',
+ ]
+ libgit_c_args += '-DSUPPORTS_SIMPLE_IPC'
+endif
+
+fsmonitor_backend = ''
+if host_machine.system() == 'windows'
+ fsmonitor_backend = 'win32'
+elif host_machine.system() == 'darwin'
+ fsmonitor_backend = 'darwin'
+ libgit_dependencies += dependency('CoreServices')
+endif
+if fsmonitor_backend != ''
+ libgit_c_args += '-DHAVE_FSMONITOR_DAEMON_BACKEND'
+ libgit_c_args += '-DHAVE_FSMONITOR_OS_SETTINGS'
+
+ libgit_sources += [
+ 'compat/fsmonitor/fsm-health-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-ipc-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-listen-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-path-utils-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-settings-' + fsmonitor_backend + '.c',
+ ]
+endif
+build_options_config.set_quoted('FSMONITOR_DAEMON_BACKEND', fsmonitor_backend)
+build_options_config.set_quoted('FSMONITOR_OS_SETTINGS', fsmonitor_backend)
+
+if not get_option('b_sanitize').contains('address') and get_option('regex').allowed() and compiler.has_header('regex.h') and compiler.get_define('REG_STARTEND', prefix: '#include <regex.h>') != ''
+ build_options_config.set('NO_REGEX', '')
+
+ if compiler.get_define('REG_ENHANCED', prefix: '#include <regex.h>') != ''
+ libgit_c_args += '-DUSE_ENHANCED_BASIC_REGULAR_EXPRESSIONS'
+ libgit_sources += 'compat/regcomp_enhanced.c'
+ endif
+elif not get_option('regex').enabled()
+ libgit_c_args += [
+ '-DNO_REGEX',
+ '-DGAWK',
+ '-DNO_MBSUPPORT',
+ ]
+ build_options_config.set('NO_REGEX', '1')
+ libgit_sources += 'compat/regex/regex.c'
+ libgit_include_directories += 'compat/regex'
+else
+ error('Native regex support requested but not found')
+endif
+
+# setitimer and friends are provided by compat/mingw.c.
+if host_machine.system() != 'windows'
+ if not compiler.compiles('''
+ #include <sys/time.h>
+ void func(void)
+ {
+ struct itimerval value;
+ }
+ ''', name: 'struct itimerval')
+ libgit_c_args += '-DNO_STRUCT_ITIMERVAL'
+ libgit_c_args += '-DNO_SETITIMER'
+ elif not compiler.has_function('setitimer')
+ libgit_c_args += '-DNO_SETITIMER'
+ endif
+endif
+
+if compiler.has_member('struct stat', 'st_mtimespec.tv_nsec', prefix: '#include <sys/stat.h>')
+ libgit_c_args += '-DUSE_ST_TIMESPEC'
+elif not compiler.has_member('struct stat', 'st_mtim.tv_nsec', prefix: '#include <sys/stat.h>')
+ libgit_c_args += '-DNO_NSEC'
+endif
+
+if not compiler.has_member('struct stat', 'st_blocks', prefix: '#include <sys/stat.h>')
+ libgit_c_args += '-DNO_ST_BLOCKS_IN_STRUCT_STAT'
+endif
+
+if not compiler.has_member('struct dirent', 'd_type', prefix: '#include <dirent.h>')
+ libgit_c_args += '-DNO_D_TYPE_IN_DIRENT'
+endif
+
+if not compiler.has_member('struct passwd', 'pw_gecos', prefix: '#include <pwd.h>')
+ libgit_c_args += '-DNO_GECOS_IN_PWENT'
+endif
+
+if compiler.has_function('sync_file_range')
+ libgit_c_args += '-DHAVE_SYNC_FILE_RANGE'
+endif
+
+if not compiler.has_function('strcasestr')
+ libgit_c_args += '-DNO_STRCASESTR'
+ libgit_sources += 'compat/strcasestr.c'
+endif
+
+if not compiler.has_function('memmem')
+ libgit_c_args += '-DNO_MEMMEM'
+ libgit_sources += 'compat/memmem.c'
+endif
+
+if not compiler.has_function('strlcpy')
+ libgit_c_args += '-DNO_STRLCPY'
+ libgit_sources += 'compat/strlcpy.c'
+endif
+
+if not compiler.has_function('strdup')
+ libgit_c_args += '-DOVERRIDE_STRDUP'
+ libgit_sources += 'compat/strdup.c'
+endif
+
+if not compiler.has_function('strtoumax')
+ libgit_c_args += '-DNO_STRTOUMAX'
+ libgit_sources += [
+ 'compat/strtoumax.c',
+ 'compat/strtoimax.c',
+ ]
+endif
+
+if not compiler.has_function('strtoull')
+ libgit_c_args += '-DNO_STRTOULL'
+endif
+
+if not compiler.has_function('setenv')
+ libgit_c_args += '-DNO_SETENV'
+ libgit_sources += 'compat/setenv.c'
+endif
+
+if not compiler.has_function('qsort')
+ libgit_c_args += '-DINTERNAL_QSORT'
+endif
+libgit_sources += 'compat/qsort_s.c'
+
+# unsetenv is provided by compat/mingw.c.
+if host_machine.system() != 'windows' and not compiler.has_function('unsetenv')
+ libgit_c_args += '-DNO_UNSETENV'
+ libgit_sources += 'compat/unsetenv.c'
+endif
+
+if not compiler.has_function('mkdtemp')
+ libgit_c_args += '-DNO_MKDTEMP'
+ libgit_sources += 'compat/mkdtemp.c'
+endif
+
+if not compiler.has_function('initgroups')
+ libgit_c_args += '-DNO_INITGROUPS'
+endif
+
+if compiler.has_function('getdelim')
+ libgit_c_args += '-DHAVE_GETDELIM'
+endif
+
+if host_machine.system() == 'windows'
+ libgit_c_args += '-DUSE_WIN32_MMAP'
+elif not compiler.has_function('mmap')
+ libgit_c_args += '-DNO_MMAP'
+ libgit_sources += 'compat/mmap.c'
+endif
+
+if compiler.has_function('clock_gettime')
+ libgit_c_args += '-DHAVE_CLOCK_GETTIME'
+endif
+
+if compiler.compiles('''
+ #include <time.h>
+
+ void func(void)
+ {
+ clockid_t id = CLOCK_MONOTONIC;
+ }
+''', name: 'monotonic clock')
+ libgit_c_args += '-DHAVE_CLOCK_MONOTONIC'
+endif
+
+if not compiler.compiles('''
+ #include <inttypes.h>
+
+ void func(void)
+ {
+ uintmax_t x = 0;
+ }
+''', name: 'uintmax_t')
+ libgit_c_args += '-DNO_UINTMAX_T'
+endif
+
+has_bsd_sysctl = false
+if compiler.has_header('sys/sysctl.h')
+ if compiler.compiles('''
+ #include <stddef.h>
+ #include <sys/sysctl.h>
+
+ void func(void)
+ {
+ int val, mib[2] = { 0 };
+ size_t len = sizeof(val);
+ sysctl(mib, 2, &val, &len, NULL, 0);
+ }
+ ''', name: 'BSD sysctl')
+ libgit_c_args += '-DHAVE_BSD_SYSCTL'
+ has_bsd_sysctl = true
+ endif
+endif
+
+if not meson.is_cross_build() and compiler.run('''
+ #include <stdio.h>
+
+ int main(int argc, const char **argv)
+ {
+ FILE *f = fopen(".", "r");
+ return f ? 0 : 1;
+ }
+''', name: 'fread reads directories').returncode() == 0
+ libgit_c_args += '-DFREAD_READS_DIRECTORIES'
+ libgit_sources += 'compat/fopen.c'
+endif
+
+if not meson.is_cross_build() and fs.exists('/dev/tty')
+ libgit_c_args += '-DHAVE_DEV_TTY'
+endif
+
+https_backend = get_option('https_backend')
+
+security_framework = dependency('Security', required: https_backend == 'CommonCrypto')
+core_foundation_framework = dependency('CoreFoundation', required: security_framework.found())
+if https_backend == 'auto' and security_framework.found()
+ https_backend = 'CommonCrypto'
+endif
+
+openssl_required = https_backend == 'openssl' or get_option('sha1_backend') == 'openssl' or get_option('sha256_backend') == 'openssl'
+openssl = dependency('openssl', required: openssl_required, default_options: ['default_library=static'])
+if https_backend == 'auto' and openssl.found()
+ https_backend = 'openssl'
+endif
+
+if https_backend == 'CommonCrypto'
+ libgit_dependencies += security_framework
+ libgit_dependencies += core_foundation_framework
+ libgit_c_args += '-DAPPLE_COMMON_CRYPTO'
+elif https_backend == 'openssl'
+ libgit_dependencies += openssl
+else
+ # We either couldn't find any dependencies with 'auto' or the user requested
+ # 'none'. Both cases are benign.
+endif
+
+if https_backend != 'openssl'
+ libgit_c_args += '-DNO_OPENSSL'
+endif
+
+sha1_backend = get_option('sha1_backend')
+if sha1_backend == 'sha1dc'
+ libgit_c_args += '-DSHA1_DC'
+ libgit_c_args += '-DSHA1DC_NO_STANDARD_INCLUDES=1'
+ libgit_c_args += '-DSHA1DC_INIT_SAFE_HASH_DEFAULT=0'
+ libgit_c_args += '-DSHA1DC_CUSTOM_INCLUDE_SHA1_C="git-compat-util.h"'
+ libgit_c_args += '-DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="git-compat-util.h"'
+
+ libgit_sources += [
+ 'sha1dc_git.c',
+ 'sha1dc/sha1.c',
+ 'sha1dc/ubc_check.c',
+ ]
+elif sha1_backend == 'common-crypto'
+ libgit_c_args += '-DCOMMON_DIGEST_FOR_OPENSSL'
+ libgit_c_args += '-DSHA1_APPLE'
+ # Apple CommonCrypto requires chunking
+ libgit_c_args += '-DSHA1_MAX_BLOCK_SIZE=1024L*1024L*1024L'
+elif sha1_backend == 'openssl'
+ libgit_c_args += '-DSHA1_OPENSSL'
+ libgit_dependencies += openssl
+elif sha1_backend == 'block'
+ libgit_c_args += '-DSHA1_BLK'
+ libgit_sources += 'block-sha1/sha1.c'
+else
+ error('Unhandled SHA1 backend ' + sha1_backend)
+endif
+
+sha256_backend = get_option('sha256_backend')
+if sha256_backend == 'openssl'
+ libgit_c_args += '-DSHA256_OPENSSL'
+ libgit_dependencies += openssl
+elif sha256_backend == 'nettle'
+ nettle = dependency('nettle')
+ libgit_dependencies += nettle
+ libgit_c_args += '-DSHA256_NETTLE'
+elif sha256_backend == 'gcrypt'
+ gcrypt = dependency('gcrypt')
+ libgit_dependencies += gcrypt
+ libgit_c_args += '-DSHA256_GCRYPT'
+elif sha256_backend == 'block'
+ libgit_c_args += '-DSHA256_BLK'
+ libgit_sources += 'sha256/block/sha256.c'
+else
+ error('Unhandled SHA256 backend ' + sha256_backend)
+endif
+
+if compiler.has_header_symbol('stdlib.h', 'arc4random_buf')
+ libgit_c_args += '-DHAVE_ARC4RANDOM'
+elif compiler.has_header_symbol('bsd/stdlib.h', 'arc4random_buf')
+ libgit_c_args += '-DHAVE_ARC4RANDOM_BSD'
+elif compiler.has_function('getrandom', prefix: '#include <sys/random.h>')
+ libgit_c_args += '-DHAVE_GETRANDOM'
+elif compiler.has_function('getentropy', prefix: '#include <unistd.h>')
+ libgit_c_args += '-DHAVE_GETENTROPY'
+elif compiler.has_function('RtlGenRandom', prefix: '#include <windows.h>\n#include <ntsecapi.h>')
+ libgit_c_args += '-DHAVE_RTLGENRANDOM'
+elif openssl.found()
+ libgit_c_args += '-DHAVE_OPENSSL_CSPRNG'
+endif
+
+if get_option('runtime_prefix')
+ libgit_c_args += '-DRUNTIME_PREFIX'
+ build_options_config.set('RUNTIME_PREFIX', 'true')
+
+ if compiler.has_header('mach-o/dyld.h')
+ libgit_c_args += '-DHAVE_NS_GET_EXECUTABLE_PATH'
+ endif
+
+ if has_bsd_sysctl and compiler.compiles('''
+ #include <sys/sysctl.h>
+
+ void func(void)
+ {
+ KERN_PROC_PATHNAME; KERN_PROC;
+ }
+ ''', name: 'BSD KERN_PROC_PATHNAME')
+ libgit_c_args += '-DHAVE_NS_GET_EXECUTABLE_PATH'
+ endif
+
+ if host_machine.system() == 'linux'
+ libgit_c_args += '-DPROCFS_EXECUTABLE_PATH="/proc/self/exe' + '"'
+ elif host_machine.system() == 'openbsd'
+ libgit_c_args += '-DPROCFS_EXECUTABLE_PATH="' + '/proc/curproc/file' + '"'
+ elif host_machine.system() == 'netbsd'
+ libgit_c_args += '-DPROCFS_EXECUTABLE_PATH="' + '/proc/curproc/exe' + '"'
+ endif
+
+ if host_machine.system() == 'windows' and compiler.compiles('''
+ #include <stdlib.h>
+
+ void func(void)
+ {
+ _wpgmptr;
+ }
+ ''', name: 'Win32 _wpgmptr')
+ libgit_c_args += '-DHAVE_WPGMPTR'
+ endif
+else
+ build_options_config.set('RUNTIME_PREFIX', 'false')
+endif
+
+foreach key, value : {
+ 'DIFF': diff.full_path(),
+ 'GIT_TEST_CMP': diff.full_path() + ' -u',
+ 'GIT_TEST_GITPERLLIB': meson.project_build_root() / 'perl',
+ 'GIT_TEST_MERGE_TOOLS_DIR': meson.project_source_root() / 'mergetools',
+ 'GIT_TEST_POPATH': meson.project_source_root() / 'po',
+ 'GIT_TEST_TEMPLATE_DIR': meson.project_build_root() / 'templates',
+ 'GIT_TEST_TEXTDOMAINDIR': meson.project_build_root() / 'po',
+ 'PAGER_ENV': get_option('pager_environment'),
+ 'PERL_PATH': perl.found() ? perl.full_path() : '',
+ 'PYTHON_PATH': python.found () ? python.full_path() : '',
+ 'SHELL_PATH': shell.full_path(),
+ 'TAR': tar.full_path(),
+ 'TEST_OUTPUT_DIRECTORY': test_output_directory,
+ 'TEST_SHELL_PATH': shell.full_path(),
+}
+ if value != '' and cygpath.found()
+ value = run_command(cygpath, value, check: true).stdout().strip()
+ endif
+ build_options_config.set_quoted(key, value)
+endforeach
+
+configure_file(
+ input: 'GIT-BUILD-OPTIONS.in',
+ output: 'GIT-BUILD-OPTIONS',
+ configuration: build_options_config,
+)
+
+git_version_file = custom_target(
+ command: [
+ shell,
+ meson.current_source_dir() / 'GIT-VERSION-GEN',
+ meson.current_source_dir(),
+ '@INPUT@',
+ '@OUTPUT@',
+ ],
+ input: meson.current_source_dir() / 'GIT-VERSION-FILE.in',
+ output: 'GIT-VERSION-FILE',
+ build_always_stale: true,
+)
+
+version_def_h = custom_target(
+ command: [
+ shell,
+ meson.current_source_dir() / 'GIT-VERSION-GEN',
+ meson.current_source_dir(),
+ '@INPUT@',
+ '@OUTPUT@',
+ ],
+ input: meson.current_source_dir() / 'version-def.h.in',
+ output: 'version-def.h',
+ # Depend on GIT-VERSION-FILE so that we don't always try to rebuild this
+ # target for the same commit.
+ depends: [git_version_file],
+)
+
+# Build a separate library for "version.c" so that we do not have to rebuild
+# everything when the current Git commit changes.
+libgit_version_library = static_library('git-version',
+ sources: [
+ 'version.c',
+ version_def_h,
+ ],
+ c_args: libgit_c_args,
+ dependencies: libgit_dependencies,
+ include_directories: libgit_include_directories,
+)
+
+libgit_library = static_library('git',
+ sources: libgit_sources,
+ c_args: libgit_c_args,
+ link_with: libgit_version_library,
+ dependencies: libgit_dependencies,
+ include_directories: libgit_include_directories,
+)
+
+libgit = declare_dependency(
+ compile_args: libgit_c_args,
+ link_with: libgit_library,
+ dependencies: libgit_dependencies,
+ include_directories: libgit_include_directories,
+)
+
+common_main_sources = ['common-main.c']
+common_main_link_args = [ ]
+if host_machine.system() == 'windows'
+ git_rc = custom_target(
+ command: [
+ shell,
+ meson.current_source_dir() / 'GIT-VERSION-GEN',
+ meson.current_source_dir(),
+ '@INPUT@',
+ '@OUTPUT@',
+ ],
+ input: meson.current_source_dir() / 'git.rc.in',
+ output: 'git.rc',
+ depends: [git_version_file],
+ )
+
+ common_main_sources += import('windows').compile_resources(git_rc,
+ include_directories: [meson.current_source_dir()],
+ )
+ if compiler.get_argument_syntax() == 'gcc'
+ common_main_link_args += [
+ '-municode',
+ '-Wl,-nxcompat',
+ '-Wl,-dynamicbase',
+ '-Wl,-pic-executable,-e,mainCRTStartup',
+ ]
+ elif compiler.get_argument_syntax() == 'msvc'
+ common_main_link_args += [
+ '/ENTRY:wmainCRTStartup',
+ 'invalidcontinue.obj',
+ ]
+ else
+ error('Unsupported compiler ' + compiler.get_id())
+ endif
+endif
+common_main_library = static_library('common-main',
+ 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,
+ link_args: common_main_link_args,
+)
+
+bin_wrappers = [ ]
+test_dependencies = [ ]
+
+git = executable('git',
+ sources: builtin_sources + 'git.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+bin_wrappers += git
+
+test_dependencies += executable('git-daemon',
+ sources: 'daemon.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+test_dependencies += executable('git-sh-i18n--envsubst',
+ sources: 'sh-i18n--envsubst.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+bin_wrappers += executable('git-shell',
+ sources: 'shell.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+test_dependencies += executable('git-http-backend',
+ sources: 'http-backend.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+bin_wrappers += executable('scalar',
+ sources: 'scalar.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+if get_option('curl').enabled()
+ curl_sources = [
+ 'http.c',
+ 'http-walker.c',
+ ]
+
+ git_remote_http = executable('git-remote-http',
+ sources: curl_sources + 'remote-curl.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+ test_dependencies += git_remote_http
+
+ test_dependencies += executable('git-http-fetch',
+ sources: curl_sources + 'http-fetch.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+
+ if expat.found()
+ test_dependencies += executable('git-http-push',
+ sources: curl_sources + 'http-push.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+ endif
+
+ 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, common_main],
+ )
+
+ install_symlink(alias + executable_suffix,
+ install_dir: get_option('libexecdir') / 'git-core',
+ pointing_to: 'git-remote-http',
+ )
+ endforeach
+endif
+
+imap_send_sources = ['imap-send.c']
+if use_curl_for_imap_send
+ imap_send_sources += curl_sources
+endif
+
+test_dependencies += executable('git-imap-send',
+ sources: imap_send_sources,
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+foreach alias : [ 'git-receive-pack', 'git-upload-archive', 'git-upload-pack' ]
+ bin_wrappers += executable(alias,
+ objects: git.extract_all_objects(recursive: false),
+ dependencies: [libgit, common_main],
+ )
+
+ install_symlink(alias + executable_suffix,
+ install_dir: get_option('libexecdir') / 'git-core',
+ pointing_to: 'git-remote-http',
+ )
+endforeach
+
+foreach symlink : [
+ 'git',
+ 'git-receive-pack',
+ 'git-shell',
+ 'git-upload-archive',
+ 'git-upload-pack',
+ 'scalar',
+]
+ install_symlink(symlink,
+ install_dir: get_option('bindir'),
+ pointing_to: fs.relative_to(get_option('libexecdir') / 'git-core' / symlink, get_option('bindir')),
+ )
+endforeach
+
+scripts_sh = [
+ 'git-difftool--helper.sh',
+ 'git-filter-branch.sh',
+ 'git-merge-octopus.sh',
+ 'git-merge-one-file.sh',
+ 'git-merge-resolve.sh',
+ 'git-mergetool--lib.sh',
+ 'git-mergetool.sh',
+ 'git-quiltimport.sh',
+ 'git-request-pull.sh',
+ 'git-sh-i18n.sh',
+ 'git-sh-setup.sh',
+ 'git-submodule.sh',
+ 'git-web--browse.sh',
+]
+if perl_features_enabled
+ scripts_sh += 'git-instaweb.sh'
+endif
+
+foreach script : scripts_sh
+ test_dependencies += custom_target(
+ input: script,
+ output: fs.stem(script),
+ command: [
+ shell,
+ meson.project_source_root() / 'generate-script.sh',
+ '@INPUT@',
+ '@OUTPUT@',
+ meson.project_build_root() / 'GIT-BUILD-OPTIONS',
+ ],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+endforeach
+
+if perl_features_enabled
+ scripts_perl = [
+ 'git-archimport.perl',
+ 'git-cvsexportcommit.perl',
+ 'git-cvsimport.perl',
+ 'git-cvsserver.perl',
+ 'git-send-email.perl',
+ 'git-svn.perl',
+ ]
+
+ pathsep = ':'
+ if host_machine.system() == 'windows'
+ pathsep = ';'
+ endif
+
+ perl_header_template = 'perl/header_templates/fixed_prefix.template.pl'
+ if get_option('runtime_prefix')
+ perl_header_template = 'perl/header_templates/runtime_prefix.template.pl'
+ endif
+
+ perl_header = configure_file(
+ input: perl_header_template,
+ output: 'GIT-PERL-HEADER',
+ configuration: {
+ 'GITEXECDIR_REL': get_option('libexecdir') / 'git-core',
+ 'PERLLIBDIR_REL': get_option('datadir') / 'perl5',
+ 'LOCALEDIR_REL': get_option('datadir') / 'locale',
+ 'INSTLIBDIR': get_option('datadir') / 'perl5',
+ 'PATHSEP': pathsep,
+ },
+ )
+
+ generate_perl_command = [
+ shell,
+ meson.project_source_root() / 'generate-perl.sh',
+ meson.project_build_root() / 'GIT-BUILD-OPTIONS',
+ git_version_file.full_path(),
+ perl_header,
+ '@INPUT@',
+ '@OUTPUT@',
+ ]
+
+ foreach script : scripts_perl
+ generated_script = custom_target(
+ input: script,
+ output: fs.stem(script),
+ command: generate_perl_command,
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ depends: [git_version_file],
+ )
+ test_dependencies += generated_script
+
+ if script == 'git-cvsserver.perl'
+ bin_wrappers += generated_script
+
+ install_symlink(fs.stem(script),
+ install_dir: get_option('bindir'),
+ pointing_to: fs.relative_to(get_option('libexecdir') / 'git-core' / fs.stem(script), get_option('bindir')),
+ )
+ endif
+ endforeach
+
+ subdir('perl')
+endif
+
+if python.found()
+ scripts_python = [
+ 'git-p4.py'
+ ]
+
+ foreach script : scripts_python
+ fs.copyfile(script, fs.stem(script),
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+ endforeach
+endif
+
+mergetools = [
+ 'mergetools/araxis',
+ 'mergetools/bc',
+ 'mergetools/codecompare',
+ 'mergetools/deltawalker',
+ 'mergetools/diffmerge',
+ 'mergetools/diffuse',
+ 'mergetools/ecmerge',
+ 'mergetools/emerge',
+ 'mergetools/examdiff',
+ 'mergetools/guiffy',
+ 'mergetools/gvimdiff',
+ 'mergetools/kdiff3',
+ 'mergetools/kompare',
+ 'mergetools/meld',
+ 'mergetools/nvimdiff',
+ 'mergetools/opendiff',
+ 'mergetools/p4merge',
+ 'mergetools/smerge',
+ 'mergetools/tkdiff',
+ 'mergetools/tortoisemerge',
+ 'mergetools/vimdiff',
+ 'mergetools/vscode',
+ 'mergetools/winmerge',
+ 'mergetools/xxdiff',
+]
+
+foreach mergetool : mergetools
+ install_data(mergetool, install_dir: get_option('libexecdir') / 'git-core' / 'mergetools')
+endforeach
+
+if intl.found()
+ subdir('po')
+endif
+subdir('contrib')
+subdir('gitweb')
+subdir('templates')
+
+# Everything but the bin-wrappers need to come before this target such that we
+# can properly set up test dependencies. The bin-wrappers themselves are set up
+# at configuration time, so these are fine.
+if get_option('tests')
+ subdir('t')
+endif
+
+subdir('bin-wrappers')
+if get_option('docs') != []
+ subdir('Documentation')
+endif
+
+summary({
+ 'curl': curl.found(),
+ 'expat': expat.found(),
+ 'gettext': intl.found(),
+ 'https': https_backend,
+ 'iconv': iconv.found(),
+ 'pcre2': pcre2.found(),
+ 'perl': perl_features_enabled,
+ 'python': python.found(),
+}, section: 'Auto-detected features')
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000000000000000000000000000000000000..32a72139bae870745d9131cc9086a4594826be91
--- /dev/null
+++ b/meson_options.txt
@@ -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')
diff --git a/perl/FromCPAN/Mail/meson.build b/perl/FromCPAN/Mail/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..129cff161c585645c111af0386bafe136258e3db
--- /dev/null
+++ b/perl/FromCPAN/Mail/meson.build
@@ -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',
+)
diff --git a/perl/FromCPAN/meson.build b/perl/FromCPAN/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..4e7ea909df3593fb65facb4bf6a1c42e954d6f70
--- /dev/null
+++ b/perl/FromCPAN/meson.build
@@ -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')
diff --git a/perl/Git/LoadCPAN/Mail/meson.build b/perl/Git/LoadCPAN/Mail/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..7da5b37adb278b4e13f41ea5ebc762bb4d78b64b
--- /dev/null
+++ b/perl/Git/LoadCPAN/Mail/meson.build
@@ -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',
+)
diff --git a/perl/Git/LoadCPAN/meson.build b/perl/Git/LoadCPAN/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..9468c073aeb5ae1980f88b4c7f2c7fe69355ea37
--- /dev/null
+++ b/perl/Git/LoadCPAN/meson.build
@@ -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')
diff --git a/perl/Git/SVN/Memoize/meson.build b/perl/Git/SVN/Memoize/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..515ab3dd926618f6c46b030e1f283d637fdddedf
--- /dev/null
+++ b/perl/Git/SVN/Memoize/meson.build
@@ -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',
+)
diff --git a/perl/Git/SVN/meson.build b/perl/Git/SVN/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..8338531041d8e5cd4e8c2c8a0c3dcfc8b2d23cc9
--- /dev/null
+++ b/perl/Git/SVN/meson.build
@@ -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')
diff --git a/perl/Git/meson.build b/perl/Git/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..259209d7302809b6c1d3249d9d21548515c31c77
--- /dev/null
+++ b/perl/Git/meson.build
@@ -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')
diff --git a/perl/meson.build b/perl/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..c22d6f8a1a3266ded27c43c43c88620f9b4badcf
--- /dev/null
+++ b/perl/meson.build
@@ -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
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..d7154b6395b2bf4a27110aad65aa1f51f979a1e9
--- /dev/null
+++ b/po/meson.build
@@ -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]
diff --git a/subprojects/.gitignore b/subprojects/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..63ea916ef5f30255aef0c0b0b63f37b0e1d99fb2
--- /dev/null
+++ b/subprojects/.gitignore
@@ -0,0 +1 @@
+/*/
diff --git a/subprojects/curl.wrap b/subprojects/curl.wrap
new file mode 100644
index 0000000000000000000000000000000000000000..f7e384b85cf5ee98672e4409e1d30f8f6f0e5735
--- /dev/null
+++ b/subprojects/curl.wrap
@@ -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
diff --git a/subprojects/expat.wrap b/subprojects/expat.wrap
new file mode 100644
index 0000000000000000000000000000000000000000..2e0427dcfd144c22d8c0bfd333e3cf31f14855a7
--- /dev/null
+++ b/subprojects/expat.wrap
@@ -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
diff --git a/subprojects/openssl.wrap b/subprojects/openssl.wrap
new file mode 100644
index 0000000000000000000000000000000000000000..873d55106e9b83c487a88dfbb85eaf73429464d7
--- /dev/null
+++ b/subprojects/openssl.wrap
@@ -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
diff --git a/subprojects/pcre2.wrap b/subprojects/pcre2.wrap
new file mode 100644
index 0000000000000000000000000000000000000000..7e184472543bde1572b9e780ae29318fe01e72bc
--- /dev/null
+++ b/subprojects/pcre2.wrap
@@ -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
diff --git a/subprojects/zlib.wrap b/subprojects/zlib.wrap
new file mode 100644
index 0000000000000000000000000000000000000000..aa14de17740728cecdb7431fb101e55e9b022273
--- /dev/null
+++ b/subprojects/zlib.wrap
@@ -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
diff --git a/t/helper/meson.build b/t/helper/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..5e83884246edc7841738de5085f3255aa1fa3fbe
--- /dev/null
+++ b/t/helper/meson.build
@@ -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
diff --git a/t/meson.build b/t/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..86076b77d2005529f58fb402e86bc95048071342
--- /dev/null
+++ b/t/meson.build
@@ -0,0 +1,1115 @@
+clar_test_suites = [
+ 'unit-tests/ctype.c',
+ 'unit-tests/strvec.c',
+]
+
+clar_sources = [
+ 'unit-tests/clar/clar.c',
+ 'unit-tests/unit-test.c',
+]
+
+clar_decls_h = custom_target(
+ input: clar_test_suites,
+ output: 'clar-decls.h',
+ command : [
+ shell,
+ meson.current_source_dir() + '/unit-tests/generate-clar-decls.sh',
+ '@OUTPUT@',
+ '@INPUT@',
+ ],
+ env: script_environment,
+)
+clar_sources += clar_decls_h
+
+clar_sources += custom_target(
+ input: clar_decls_h,
+ output: 'clar.suite',
+ command : [
+ shell,
+ meson.current_source_dir() + '/unit-tests/generate-clar-suites.sh',
+ '@INPUT@',
+ '@OUTPUT@',
+ ],
+ env: script_environment,
+)
+
+clar_unit_tests = executable('unit-tests',
+ sources: clar_sources + clar_test_suites,
+ dependencies: [libgit, common_main],
+)
+test('unit-tests', clar_unit_tests)
+
+unit_test_programs = [
+ 'unit-tests/t-example-decorate.c',
+ 'unit-tests/t-hash.c',
+ 'unit-tests/t-hashmap.c',
+ 'unit-tests/t-mem-pool.c',
+ 'unit-tests/t-oid-array.c',
+ 'unit-tests/t-oidmap.c',
+ 'unit-tests/t-oidtree.c',
+ 'unit-tests/t-prio-queue.c',
+ 'unit-tests/t-reftable-basics.c',
+ 'unit-tests/t-reftable-block.c',
+ 'unit-tests/t-reftable-merged.c',
+ 'unit-tests/t-reftable-pq.c',
+ 'unit-tests/t-reftable-reader.c',
+ 'unit-tests/t-reftable-readwrite.c',
+ 'unit-tests/t-reftable-record.c',
+ 'unit-tests/t-reftable-stack.c',
+ 'unit-tests/t-reftable-tree.c',
+ 'unit-tests/t-strbuf.c',
+ 'unit-tests/t-strcmp-offset.c',
+ 'unit-tests/t-trailer.c',
+ 'unit-tests/t-urlmatch-normalization.c',
+]
+
+foreach unit_test_program : unit_test_programs
+ unit_test_name = fs.stem(unit_test_program)
+ unit_test = executable(unit_test_name,
+ sources: [
+ 'unit-tests/test-lib.c',
+ 'unit-tests/lib-oid.c',
+ 'unit-tests/lib-reftable.c',
+ unit_test_program,
+ ],
+ dependencies: [libgit, common_main],
+ )
+ test(unit_test_name, unit_test,
+ workdir: meson.current_source_dir(),
+ timeout: 0,
+ )
+endforeach
+
+subdir('helper')
+
+integration_tests = [
+ 't0000-basic.sh',
+ 't0001-init.sh',
+ 't0002-gitfile.sh',
+ 't0003-attributes.sh',
+ 't0004-unwritable.sh',
+ 't0005-signals.sh',
+ 't0006-date.sh',
+ 't0007-git-var.sh',
+ 't0008-ignores.sh',
+ 't0010-racy-git.sh',
+ 't0012-help.sh',
+ 't0013-sha1dc.sh',
+ 't0014-alias.sh',
+ 't0017-env-helper.sh',
+ 't0018-advice.sh',
+ 't0019-json-writer.sh',
+ 't0020-crlf.sh',
+ 't0021-conversion.sh',
+ 't0022-crlf-rename.sh',
+ 't0023-crlf-am.sh',
+ 't0024-crlf-archive.sh',
+ 't0025-crlf-renormalize.sh',
+ 't0026-eol-config.sh',
+ 't0027-auto-crlf.sh',
+ 't0028-working-tree-encoding.sh',
+ 't0029-core-unsetenvvars.sh',
+ 't0030-stripspace.sh',
+ 't0033-safe-directory.sh',
+ 't0034-root-safe-directory.sh',
+ 't0035-safe-bare-repository.sh',
+ 't0040-parse-options.sh',
+ 't0041-usage.sh',
+ 't0050-filesystem.sh',
+ 't0051-windows-named-pipe.sh',
+ 't0052-simple-ipc.sh',
+ 't0055-beyond-symlinks.sh',
+ 't0056-git-C.sh',
+ 't0060-path-utils.sh',
+ 't0061-run-command.sh',
+ 't0062-revision-walking.sh',
+ 't0063-string-list.sh',
+ 't0066-dir-iterator.sh',
+ 't0067-parse_pathspec_file.sh',
+ 't0068-for-each-repo.sh',
+ 't0070-fundamental.sh',
+ 't0071-sort.sh',
+ 't0080-unit-test-output.sh',
+ 't0081-find-pack.sh',
+ 't0090-cache-tree.sh',
+ 't0091-bugreport.sh',
+ 't0092-diagnose.sh',
+ 't0095-bloom.sh',
+ 't0100-previous.sh',
+ 't0101-at-syntax.sh',
+ 't0200-gettext-basic.sh',
+ 't0201-gettext-fallbacks.sh',
+ 't0202-gettext-perl.sh',
+ 't0203-gettext-setlocale-sanity.sh',
+ 't0204-gettext-reencode-sanity.sh',
+ 't0210-trace2-normal.sh',
+ 't0211-trace2-perf.sh',
+ 't0212-trace2-event.sh',
+ 't0300-credentials.sh',
+ 't0301-credential-cache.sh',
+ 't0302-credential-store.sh',
+ 't0303-credential-external.sh',
+ 't0410-partial-clone.sh',
+ 't0411-clone-from-partial.sh',
+ 't0450-txt-doc-vs-help.sh',
+ 't0500-progress-display.sh',
+ 't0600-reffiles-backend.sh',
+ 't0601-reffiles-pack-refs.sh',
+ 't0602-reffiles-fsck.sh',
+ 't0610-reftable-basics.sh',
+ 't0611-reftable-httpd.sh',
+ 't0612-reftable-jgit-compatibility.sh',
+ 't0613-reftable-write-options.sh',
+ 't1000-read-tree-m-3way.sh',
+ 't1001-read-tree-m-2way.sh',
+ 't1002-read-tree-m-u-2way.sh',
+ 't1003-read-tree-prefix.sh',
+ 't1004-read-tree-m-u-wf.sh',
+ 't1005-read-tree-reset.sh',
+ 't1006-cat-file.sh',
+ 't1007-hash-object.sh',
+ 't1008-read-tree-overlay.sh',
+ 't1009-read-tree-new-index.sh',
+ 't1010-mktree.sh',
+ 't1011-read-tree-sparse-checkout.sh',
+ 't1012-read-tree-df.sh',
+ 't1013-read-tree-submodule.sh',
+ 't1014-read-tree-confusing.sh',
+ 't1015-read-index-unmerged.sh',
+ 't1016-compatObjectFormat.sh',
+ 't1020-subdirectory.sh',
+ 't1021-rerere-in-workdir.sh',
+ 't1022-read-tree-partial-clone.sh',
+ 't1050-large.sh',
+ 't1051-large-conversion.sh',
+ 't1060-object-corruption.sh',
+ 't1090-sparse-checkout-scope.sh',
+ 't1091-sparse-checkout-builtin.sh',
+ 't1092-sparse-checkout-compatibility.sh',
+ 't1100-commit-tree-options.sh',
+ 't1300-config.sh',
+ 't1301-shared-repo.sh',
+ 't1302-repo-version.sh',
+ 't1303-wacky-config.sh',
+ 't1304-default-acl.sh',
+ 't1305-config-include.sh',
+ 't1306-xdg-files.sh',
+ 't1307-config-blob.sh',
+ 't1308-config-set.sh',
+ 't1309-early-config.sh',
+ 't1310-config-default.sh',
+ 't1350-config-hooks-path.sh',
+ 't1400-update-ref.sh',
+ 't1401-symbolic-ref.sh',
+ 't1402-check-ref-format.sh',
+ 't1403-show-ref.sh',
+ 't1404-update-ref-errors.sh',
+ 't1405-main-ref-store.sh',
+ 't1406-submodule-ref-store.sh',
+ 't1407-worktree-ref-store.sh',
+ 't1408-packed-refs.sh',
+ 't1409-avoid-packing-refs.sh',
+ 't1410-reflog.sh',
+ 't1411-reflog-show.sh',
+ 't1412-reflog-loop.sh',
+ 't1413-reflog-detach.sh',
+ 't1414-reflog-walk.sh',
+ 't1415-worktree-refs.sh',
+ 't1416-ref-transaction-hooks.sh',
+ 't1417-reflog-updateref.sh',
+ 't1418-reflog-exists.sh',
+ 't1419-exclude-refs.sh',
+ 't1420-lost-found.sh',
+ 't1430-bad-ref-name.sh',
+ 't1450-fsck.sh',
+ 't1451-fsck-buffer.sh',
+ 't1460-refs-migrate.sh',
+ 't1500-rev-parse.sh',
+ 't1501-work-tree.sh',
+ 't1502-rev-parse-parseopt.sh',
+ 't1503-rev-parse-verify.sh',
+ 't1504-ceiling-dirs.sh',
+ 't1505-rev-parse-last.sh',
+ 't1506-rev-parse-diagnosis.sh',
+ 't1507-rev-parse-upstream.sh',
+ 't1508-at-combinations.sh',
+ 't1509-root-work-tree.sh',
+ 't1510-repo-setup.sh',
+ 't1511-rev-parse-caret.sh',
+ 't1512-rev-parse-disambiguation.sh',
+ 't1513-rev-parse-prefix.sh',
+ 't1514-rev-parse-push.sh',
+ 't1515-rev-parse-outside-repo.sh',
+ 't1517-outside-repo.sh',
+ 't1600-index.sh',
+ 't1601-index-bogus.sh',
+ 't1700-split-index.sh',
+ 't1701-racy-split-index.sh',
+ 't1800-hook.sh',
+ 't2000-conflict-when-checking-files-out.sh',
+ 't2002-checkout-cache-u.sh',
+ 't2003-checkout-cache-mkdir.sh',
+ 't2004-checkout-cache-temp.sh',
+ 't2005-checkout-index-symlinks.sh',
+ 't2006-checkout-index-basic.sh',
+ 't2007-checkout-symlink.sh',
+ 't2008-checkout-subdir.sh',
+ 't2009-checkout-statinfo.sh',
+ 't2010-checkout-ambiguous.sh',
+ 't2011-checkout-invalid-head.sh',
+ 't2012-checkout-last.sh',
+ 't2013-checkout-submodule.sh',
+ 't2014-checkout-switch.sh',
+ 't2015-checkout-unborn.sh',
+ 't2016-checkout-patch.sh',
+ 't2017-checkout-orphan.sh',
+ 't2018-checkout-branch.sh',
+ 't2019-checkout-ambiguous-ref.sh',
+ 't2020-checkout-detach.sh',
+ 't2021-checkout-overwrite.sh',
+ 't2022-checkout-paths.sh',
+ 't2023-checkout-m.sh',
+ 't2024-checkout-dwim.sh',
+ 't2025-checkout-no-overlay.sh',
+ 't2026-checkout-pathspec-file.sh',
+ 't2027-checkout-track.sh',
+ 't2030-unresolve-info.sh',
+ 't2050-git-dir-relative.sh',
+ 't2060-switch.sh',
+ 't2070-restore.sh',
+ 't2071-restore-patch.sh',
+ 't2072-restore-pathspec-file.sh',
+ 't2080-parallel-checkout-basics.sh',
+ 't2081-parallel-checkout-collisions.sh',
+ 't2082-parallel-checkout-attributes.sh',
+ 't2100-update-cache-badpath.sh',
+ 't2101-update-index-reupdate.sh',
+ 't2102-update-index-symlinks.sh',
+ 't2103-update-index-ignore-missing.sh',
+ 't2104-update-index-skip-worktree.sh',
+ 't2105-update-index-gitfile.sh',
+ 't2106-update-index-assume-unchanged.sh',
+ 't2107-update-index-basic.sh',
+ 't2108-update-index-refresh-racy.sh',
+ 't2200-add-update.sh',
+ 't2201-add-update-typechange.sh',
+ 't2202-add-addremove.sh',
+ 't2203-add-intent.sh',
+ 't2204-add-ignored.sh',
+ 't2205-add-worktree-config.sh',
+ 't2300-cd-to-toplevel.sh',
+ 't2400-worktree-add.sh',
+ 't2401-worktree-prune.sh',
+ 't2402-worktree-list.sh',
+ 't2403-worktree-move.sh',
+ 't2404-worktree-config.sh',
+ 't2405-worktree-submodule.sh',
+ 't2406-worktree-repair.sh',
+ 't2407-worktree-heads.sh',
+ 't2408-worktree-relative.sh',
+ 't2500-untracked-overwriting.sh',
+ 't2501-cwd-empty.sh',
+ 't3000-ls-files-others.sh',
+ 't3001-ls-files-others-exclude.sh',
+ 't3002-ls-files-dashpath.sh',
+ 't3003-ls-files-exclude.sh',
+ 't3004-ls-files-basic.sh',
+ 't3005-ls-files-relative.sh',
+ 't3006-ls-files-long.sh',
+ 't3007-ls-files-recurse-submodules.sh',
+ 't3008-ls-files-lazy-init-name-hash.sh',
+ 't3009-ls-files-others-nonsubmodule.sh',
+ 't3010-ls-files-killed-modified.sh',
+ 't3011-common-prefixes-and-directory-traversal.sh',
+ 't3012-ls-files-dedup.sh',
+ 't3013-ls-files-format.sh',
+ 't3020-ls-files-error-unmatch.sh',
+ 't3040-subprojects-basic.sh',
+ 't3050-subprojects-fetch.sh',
+ 't3060-ls-files-with-tree.sh',
+ 't3070-wildmatch.sh',
+ 't3100-ls-tree-restrict.sh',
+ 't3101-ls-tree-dirname.sh',
+ 't3102-ls-tree-wildcards.sh',
+ 't3103-ls-tree-misc.sh',
+ 't3104-ls-tree-format.sh',
+ 't3105-ls-tree-output.sh',
+ 't3200-branch.sh',
+ 't3201-branch-contains.sh',
+ 't3202-show-branch.sh',
+ 't3203-branch-output.sh',
+ 't3204-branch-name-interpretation.sh',
+ 't3205-branch-color.sh',
+ 't3206-range-diff.sh',
+ 't3207-branch-submodule.sh',
+ 't3211-peel-ref.sh',
+ 't3300-funny-names.sh',
+ 't3301-notes.sh',
+ 't3302-notes-index-expensive.sh',
+ 't3303-notes-subtrees.sh',
+ 't3304-notes-mixed.sh',
+ 't3305-notes-fanout.sh',
+ 't3306-notes-prune.sh',
+ 't3307-notes-man.sh',
+ 't3308-notes-merge.sh',
+ 't3309-notes-merge-auto-resolve.sh',
+ 't3310-notes-merge-manual-resolve.sh',
+ 't3311-notes-merge-fanout.sh',
+ 't3320-notes-merge-worktrees.sh',
+ 't3321-notes-stripspace.sh',
+ 't3400-rebase.sh',
+ 't3401-rebase-and-am-rename.sh',
+ 't3402-rebase-merge.sh',
+ 't3403-rebase-skip.sh',
+ 't3404-rebase-interactive.sh',
+ 't3405-rebase-malformed.sh',
+ 't3406-rebase-message.sh',
+ 't3407-rebase-abort.sh',
+ 't3408-rebase-multi-line.sh',
+ 't3409-rebase-environ.sh',
+ 't3412-rebase-root.sh',
+ 't3413-rebase-hook.sh',
+ 't3415-rebase-autosquash.sh',
+ 't3416-rebase-onto-threedots.sh',
+ 't3417-rebase-whitespace-fix.sh',
+ 't3418-rebase-continue.sh',
+ 't3419-rebase-patch-id.sh',
+ 't3420-rebase-autostash.sh',
+ 't3421-rebase-topology-linear.sh',
+ 't3422-rebase-incompatible-options.sh',
+ 't3423-rebase-reword.sh',
+ 't3424-rebase-empty.sh',
+ 't3425-rebase-topology-merges.sh',
+ 't3426-rebase-submodule.sh',
+ 't3427-rebase-subtree.sh',
+ 't3428-rebase-signoff.sh',
+ 't3429-rebase-edit-todo.sh',
+ 't3430-rebase-merges.sh',
+ 't3431-rebase-fork-point.sh',
+ 't3432-rebase-fast-forward.sh',
+ 't3433-rebase-across-mode-change.sh',
+ 't3434-rebase-i18n.sh',
+ 't3435-rebase-gpg-sign.sh',
+ 't3436-rebase-more-options.sh',
+ 't3437-rebase-fixup-options.sh',
+ 't3438-rebase-broken-files.sh',
+ 't3500-cherry.sh',
+ 't3501-revert-cherry-pick.sh',
+ 't3502-cherry-pick-merge.sh',
+ 't3503-cherry-pick-root.sh',
+ 't3504-cherry-pick-rerere.sh',
+ 't3505-cherry-pick-empty.sh',
+ 't3506-cherry-pick-ff.sh',
+ 't3507-cherry-pick-conflict.sh',
+ 't3508-cherry-pick-many-commits.sh',
+ 't3509-cherry-pick-merge-df.sh',
+ 't3510-cherry-pick-sequence.sh',
+ 't3511-cherry-pick-x.sh',
+ 't3512-cherry-pick-submodule.sh',
+ 't3513-revert-submodule.sh',
+ 't3514-cherry-pick-revert-gpg.sh',
+ 't3600-rm.sh',
+ 't3601-rm-pathspec-file.sh',
+ 't3602-rm-sparse-checkout.sh',
+ 't3650-replay-basics.sh',
+ 't3700-add.sh',
+ 't3701-add-interactive.sh',
+ 't3702-add-edit.sh',
+ 't3703-add-magic-pathspec.sh',
+ 't3704-add-pathspec-file.sh',
+ 't3705-add-sparse-checkout.sh',
+ 't3800-mktag.sh',
+ 't3900-i18n-commit.sh',
+ 't3901-i18n-patch.sh',
+ 't3902-quoted.sh',
+ 't3903-stash.sh',
+ 't3904-stash-patch.sh',
+ 't3905-stash-include-untracked.sh',
+ 't3906-stash-submodule.sh',
+ 't3907-stash-show-config.sh',
+ 't3908-stash-in-worktree.sh',
+ 't3909-stash-pathspec-file.sh',
+ 't3910-mac-os-precompose.sh',
+ 't3920-crlf-messages.sh',
+ 't4000-diff-format.sh',
+ 't4001-diff-rename.sh',
+ 't4002-diff-basic.sh',
+ 't4003-diff-rename-1.sh',
+ 't4004-diff-rename-symlink.sh',
+ 't4005-diff-rename-2.sh',
+ 't4006-diff-mode.sh',
+ 't4007-rename-3.sh',
+ 't4008-diff-break-rewrite.sh',
+ 't4009-diff-rename-4.sh',
+ 't4010-diff-pathspec.sh',
+ 't4011-diff-symlink.sh',
+ 't4012-diff-binary.sh',
+ 't4013-diff-various.sh',
+ 't4014-format-patch.sh',
+ 't4015-diff-whitespace.sh',
+ 't4016-diff-quote.sh',
+ 't4017-diff-retval.sh',
+ 't4018-diff-funcname.sh',
+ 't4019-diff-wserror.sh',
+ 't4020-diff-external.sh',
+ 't4021-format-patch-numbered.sh',
+ 't4022-diff-rewrite.sh',
+ 't4023-diff-rename-typechange.sh',
+ 't4024-diff-optimize-common.sh',
+ 't4025-hunk-header.sh',
+ 't4026-color.sh',
+ 't4027-diff-submodule.sh',
+ 't4028-format-patch-mime-headers.sh',
+ 't4029-diff-trailing-space.sh',
+ 't4030-diff-textconv.sh',
+ 't4031-diff-rewrite-binary.sh',
+ 't4032-diff-inter-hunk-context.sh',
+ 't4033-diff-patience.sh',
+ 't4034-diff-words.sh',
+ 't4035-diff-quiet.sh',
+ 't4036-format-patch-signer-mime.sh',
+ 't4037-diff-r-t-dirs.sh',
+ 't4038-diff-combined.sh',
+ 't4039-diff-assume-unchanged.sh',
+ 't4040-whitespace-status.sh',
+ 't4041-diff-submodule-option.sh',
+ 't4042-diff-textconv-caching.sh',
+ 't4043-diff-rename-binary.sh',
+ 't4044-diff-index-unique-abbrev.sh',
+ 't4045-diff-relative.sh',
+ 't4046-diff-unmerged.sh',
+ 't4047-diff-dirstat.sh',
+ 't4048-diff-combined-binary.sh',
+ 't4049-diff-stat-count.sh',
+ 't4050-diff-histogram.sh',
+ 't4051-diff-function-context.sh',
+ 't4052-stat-output.sh',
+ 't4053-diff-no-index.sh',
+ 't4054-diff-bogus-tree.sh',
+ 't4055-diff-context.sh',
+ 't4056-diff-order.sh',
+ 't4057-diff-combined-paths.sh',
+ 't4058-diff-duplicates.sh',
+ 't4059-diff-submodule-not-initialized.sh',
+ 't4060-diff-submodule-option-diff-format.sh',
+ 't4061-diff-indent.sh',
+ 't4062-diff-pickaxe.sh',
+ 't4063-diff-blobs.sh',
+ 't4064-diff-oidfind.sh',
+ 't4065-diff-anchored.sh',
+ 't4066-diff-emit-delay.sh',
+ 't4067-diff-partial-clone.sh',
+ 't4068-diff-symmetric-merge-base.sh',
+ 't4069-remerge-diff.sh',
+ 't4100-apply-stat.sh',
+ 't4101-apply-nonl.sh',
+ 't4102-apply-rename.sh',
+ 't4103-apply-binary.sh',
+ 't4104-apply-boundary.sh',
+ 't4105-apply-fuzz.sh',
+ 't4106-apply-stdin.sh',
+ 't4107-apply-ignore-whitespace.sh',
+ 't4108-apply-threeway.sh',
+ 't4109-apply-multifrag.sh',
+ 't4110-apply-scan.sh',
+ 't4111-apply-subdir.sh',
+ 't4112-apply-renames.sh',
+ 't4113-apply-ending.sh',
+ 't4114-apply-typechange.sh',
+ 't4115-apply-symlink.sh',
+ 't4116-apply-reverse.sh',
+ 't4117-apply-reject.sh',
+ 't4118-apply-empty-context.sh',
+ 't4119-apply-config.sh',
+ 't4120-apply-popt.sh',
+ 't4121-apply-diffs.sh',
+ 't4122-apply-symlink-inside.sh',
+ 't4123-apply-shrink.sh',
+ 't4124-apply-ws-rule.sh',
+ 't4125-apply-ws-fuzz.sh',
+ 't4126-apply-empty.sh',
+ 't4127-apply-same-fn.sh',
+ 't4128-apply-root.sh',
+ 't4129-apply-samemode.sh',
+ 't4130-apply-criss-cross-rename.sh',
+ 't4131-apply-fake-ancestor.sh',
+ 't4132-apply-removal.sh',
+ 't4133-apply-filenames.sh',
+ 't4134-apply-submodule.sh',
+ 't4135-apply-weird-filenames.sh',
+ 't4136-apply-check.sh',
+ 't4137-apply-submodule.sh',
+ 't4138-apply-ws-expansion.sh',
+ 't4139-apply-escape.sh',
+ 't4140-apply-ita.sh',
+ 't4141-apply-too-large.sh',
+ 't4150-am.sh',
+ 't4151-am-abort.sh',
+ 't4152-am-subjects.sh',
+ 't4153-am-resume-override-opts.sh',
+ 't4200-rerere.sh',
+ 't4201-shortlog.sh',
+ 't4202-log.sh',
+ 't4203-mailmap.sh',
+ 't4204-patch-id.sh',
+ 't4205-log-pretty-formats.sh',
+ 't4206-log-follow-harder-copies.sh',
+ 't4207-log-decoration-colors.sh',
+ 't4208-log-magic-pathspec.sh',
+ 't4209-log-pickaxe.sh',
+ 't4210-log-i18n.sh',
+ 't4211-line-log.sh',
+ 't4212-log-corrupt.sh',
+ 't4213-log-tabexpand.sh',
+ 't4214-log-graph-octopus.sh',
+ 't4215-log-skewed-merges.sh',
+ 't4216-log-bloom.sh',
+ 't4217-log-limit.sh',
+ 't4252-am-options.sh',
+ 't4253-am-keep-cr-dos.sh',
+ 't4254-am-corrupt.sh',
+ 't4255-am-submodule.sh',
+ 't4256-am-format-flowed.sh',
+ 't4257-am-interactive.sh',
+ 't4258-am-quoted-cr.sh',
+ 't4300-merge-tree.sh',
+ 't4301-merge-tree-write-tree.sh',
+ 't5000-tar-tree.sh',
+ 't5001-archive-attr.sh',
+ 't5002-archive-attr-pattern.sh',
+ 't5003-archive-zip.sh',
+ 't5004-archive-corner-cases.sh',
+ 't5100-mailinfo.sh',
+ 't5150-request-pull.sh',
+ 't5200-update-server-info.sh',
+ 't5300-pack-object.sh',
+ 't5301-sliding-window.sh',
+ 't5302-pack-index.sh',
+ 't5303-pack-corruption-resilience.sh',
+ 't5304-prune.sh',
+ 't5305-include-tag.sh',
+ 't5306-pack-nobase.sh',
+ 't5307-pack-missing-commit.sh',
+ 't5308-pack-detect-duplicates.sh',
+ 't5309-pack-delta-cycles.sh',
+ 't5310-pack-bitmaps.sh',
+ 't5311-pack-bitmaps-shallow.sh',
+ 't5312-prune-corruption.sh',
+ 't5313-pack-bounds-checks.sh',
+ 't5314-pack-cycle-detection.sh',
+ 't5315-pack-objects-compression.sh',
+ 't5316-pack-delta-depth.sh',
+ 't5317-pack-objects-filter-objects.sh',
+ 't5318-commit-graph.sh',
+ 't5319-multi-pack-index.sh',
+ 't5320-delta-islands.sh',
+ 't5321-pack-large-objects.sh',
+ 't5322-pack-objects-sparse.sh',
+ 't5323-pack-redundant.sh',
+ 't5324-split-commit-graph.sh',
+ 't5325-reverse-index.sh',
+ 't5326-multi-pack-bitmaps.sh',
+ 't5327-multi-pack-bitmaps-rev.sh',
+ 't5328-commit-graph-64bit-time.sh',
+ 't5329-pack-objects-cruft.sh',
+ 't5330-no-lazy-fetch-with-commit-graph.sh',
+ 't5331-pack-objects-stdin.sh',
+ 't5332-multi-pack-reuse.sh',
+ 't5333-pseudo-merge-bitmaps.sh',
+ 't5334-incremental-multi-pack-index.sh',
+ 't5351-unpack-large-objects.sh',
+ 't5400-send-pack.sh',
+ 't5401-update-hooks.sh',
+ 't5402-post-merge-hook.sh',
+ 't5403-post-checkout-hook.sh',
+ 't5404-tracking-branches.sh',
+ 't5405-send-pack-rewind.sh',
+ 't5406-remote-rejects.sh',
+ 't5407-post-rewrite-hook.sh',
+ 't5408-send-pack-stdin.sh',
+ 't5409-colorize-remote-messages.sh',
+ 't5410-receive-pack-alternates.sh',
+ 't5411-proc-receive-hook.sh',
+ 't5500-fetch-pack.sh',
+ 't5501-fetch-push-alternates.sh',
+ 't5502-quickfetch.sh',
+ 't5503-tagfollow.sh',
+ 't5504-fetch-receive-strict.sh',
+ 't5505-remote.sh',
+ 't5506-remote-groups.sh',
+ 't5507-remote-environment.sh',
+ 't5509-fetch-push-namespaces.sh',
+ 't5510-fetch.sh',
+ 't5511-refspec.sh',
+ 't5512-ls-remote.sh',
+ 't5513-fetch-track.sh',
+ 't5514-fetch-multiple.sh',
+ 't5515-fetch-merge-logic.sh',
+ 't5516-fetch-push.sh',
+ 't5517-push-mirror.sh',
+ 't5518-fetch-exit-status.sh',
+ 't5519-push-alternates.sh',
+ 't5520-pull.sh',
+ 't5521-pull-options.sh',
+ 't5522-pull-symlink.sh',
+ 't5523-push-upstream.sh',
+ 't5524-pull-msg.sh',
+ 't5525-fetch-tagopt.sh',
+ 't5526-fetch-submodules.sh',
+ 't5527-fetch-odd-refs.sh',
+ 't5528-push-default.sh',
+ 't5529-push-errors.sh',
+ 't5530-upload-pack-error.sh',
+ 't5531-deep-submodule-push.sh',
+ 't5532-fetch-proxy.sh',
+ 't5533-push-cas.sh',
+ 't5534-push-signed.sh',
+ 't5535-fetch-push-symref.sh',
+ 't5536-fetch-conflicts.sh',
+ 't5537-fetch-shallow.sh',
+ 't5538-push-shallow.sh',
+ 't5539-fetch-http-shallow.sh',
+ 't5540-http-push-webdav.sh',
+ 't5541-http-push-smart.sh',
+ 't5542-push-http-shallow.sh',
+ 't5543-atomic-push.sh',
+ 't5544-pack-objects-hook.sh',
+ 't5545-push-options.sh',
+ 't5546-receive-limits.sh',
+ 't5547-push-quarantine.sh',
+ 't5548-push-porcelain.sh',
+ 't5549-fetch-push-http.sh',
+ 't5550-http-fetch-dumb.sh',
+ 't5551-http-fetch-smart.sh',
+ 't5552-skipping-fetch-negotiator.sh',
+ 't5553-set-upstream.sh',
+ 't5554-noop-fetch-negotiator.sh',
+ 't5555-http-smart-common.sh',
+ 't5557-http-get.sh',
+ 't5558-clone-bundle-uri.sh',
+ 't5559-http-fetch-smart-http2.sh',
+ 't5560-http-backend-noserver.sh',
+ 't5561-http-backend.sh',
+ 't5562-http-backend-content-length.sh',
+ 't5563-simple-http-auth.sh',
+ 't5564-http-proxy.sh',
+ 't5570-git-daemon.sh',
+ 't5571-pre-push-hook.sh',
+ 't5572-pull-submodule.sh',
+ 't5573-pull-verify-signatures.sh',
+ 't5574-fetch-output.sh',
+ 't5580-unc-paths.sh',
+ 't5581-http-curl-verbose.sh',
+ 't5582-fetch-negative-refspec.sh',
+ 't5583-push-branches.sh',
+ 't5600-clone-fail-cleanup.sh',
+ 't5601-clone.sh',
+ 't5602-clone-remote-exec.sh',
+ 't5603-clone-dirname.sh',
+ 't5604-clone-reference.sh',
+ 't5605-clone-local.sh',
+ 't5606-clone-options.sh',
+ 't5607-clone-bundle.sh',
+ 't5608-clone-2gb.sh',
+ 't5609-clone-branch.sh',
+ 't5610-clone-detached.sh',
+ 't5611-clone-config.sh',
+ 't5612-clone-refspec.sh',
+ 't5613-info-alternate.sh',
+ 't5614-clone-submodules-shallow.sh',
+ 't5615-alternate-env.sh',
+ 't5616-partial-clone.sh',
+ 't5617-clone-submodules-remote.sh',
+ 't5618-alternate-refs.sh',
+ 't5619-clone-local-ambiguous-transport.sh',
+ 't5700-protocol-v1.sh',
+ 't5701-git-serve.sh',
+ 't5702-protocol-v2.sh',
+ 't5703-upload-pack-ref-in-want.sh',
+ 't5704-protocol-violations.sh',
+ 't5705-session-id-in-capabilities.sh',
+ 't5730-protocol-v2-bundle-uri-file.sh',
+ 't5731-protocol-v2-bundle-uri-git.sh',
+ 't5732-protocol-v2-bundle-uri-http.sh',
+ 't5750-bundle-uri-parse.sh',
+ 't5801-remote-helpers.sh',
+ 't5802-connect-helper.sh',
+ 't5810-proto-disable-local.sh',
+ 't5811-proto-disable-git.sh',
+ 't5812-proto-disable-http.sh',
+ 't5813-proto-disable-ssh.sh',
+ 't5814-proto-disable-ext.sh',
+ 't5815-submodule-protos.sh',
+ 't5900-repo-selection.sh',
+ 't6000-rev-list-misc.sh',
+ 't6001-rev-list-graft.sh',
+ 't6002-rev-list-bisect.sh',
+ 't6003-rev-list-topo-order.sh',
+ 't6004-rev-list-path-optim.sh',
+ 't6005-rev-list-count.sh',
+ 't6006-rev-list-format.sh',
+ 't6007-rev-list-cherry-pick-file.sh',
+ 't6008-rev-list-submodule.sh',
+ 't6009-rev-list-parent.sh',
+ 't6010-merge-base.sh',
+ 't6011-rev-list-with-bad-commit.sh',
+ 't6012-rev-list-simplify.sh',
+ 't6013-rev-list-reverse-parents.sh',
+ 't6014-rev-list-all.sh',
+ 't6016-rev-list-graph-simplify-history.sh',
+ 't6017-rev-list-stdin.sh',
+ 't6018-rev-list-glob.sh',
+ 't6019-rev-list-ancestry-path.sh',
+ 't6020-bundle-misc.sh',
+ 't6021-rev-list-exclude-hidden.sh',
+ 't6022-rev-list-missing.sh',
+ 't6030-bisect-porcelain.sh',
+ 't6040-tracking-info.sh',
+ 't6041-bisect-submodule.sh',
+ 't6050-replace.sh',
+ 't6060-merge-index.sh',
+ 't6100-rev-list-in-order.sh',
+ 't6101-rev-parse-parents.sh',
+ 't6102-rev-list-unexpected-objects.sh',
+ 't6110-rev-list-sparse.sh',
+ 't6111-rev-list-treesame.sh',
+ 't6112-rev-list-filters-objects.sh',
+ 't6113-rev-list-bitmap-filters.sh',
+ 't6114-keep-packs.sh',
+ 't6115-rev-list-du.sh',
+ 't6120-describe.sh',
+ 't6130-pathspec-noglob.sh',
+ 't6131-pathspec-icase.sh',
+ 't6132-pathspec-exclude.sh',
+ 't6133-pathspec-rev-dwim.sh',
+ 't6134-pathspec-in-submodule.sh',
+ 't6135-pathspec-with-attrs.sh',
+ 't6136-pathspec-in-bare.sh',
+ 't6200-fmt-merge-msg.sh',
+ 't6300-for-each-ref.sh',
+ 't6301-for-each-ref-errors.sh',
+ 't6302-for-each-ref-filter.sh',
+ 't6400-merge-df.sh',
+ 't6401-merge-criss-cross.sh',
+ 't6402-merge-rename.sh',
+ 't6403-merge-file.sh',
+ 't6404-recursive-merge.sh',
+ 't6405-merge-symlinks.sh',
+ 't6406-merge-attr.sh',
+ 't6407-merge-binary.sh',
+ 't6408-merge-up-to-date.sh',
+ 't6409-merge-subtree.sh',
+ 't6411-merge-filemode.sh',
+ 't6412-merge-large-rename.sh',
+ 't6413-merge-crlf.sh',
+ 't6414-merge-rename-nocruft.sh',
+ 't6415-merge-dir-to-symlink.sh',
+ 't6416-recursive-corner-cases.sh',
+ 't6417-merge-ours-theirs.sh',
+ 't6418-merge-text-auto.sh',
+ 't6419-merge-ignorecase.sh',
+ 't6421-merge-partial-clone.sh',
+ 't6422-merge-rename-corner-cases.sh',
+ 't6423-merge-rename-directories.sh',
+ 't6424-merge-unrelated-index-changes.sh',
+ 't6425-merge-rename-delete.sh',
+ 't6426-merge-skip-unneeded-updates.sh',
+ 't6427-diff3-conflict-markers.sh',
+ 't6428-merge-conflicts-sparse.sh',
+ 't6429-merge-sequence-rename-caching.sh',
+ 't6430-merge-recursive.sh',
+ 't6431-merge-criscross.sh',
+ 't6432-merge-recursive-space-options.sh',
+ 't6433-merge-toplevel.sh',
+ 't6434-merge-recursive-rename-options.sh',
+ 't6435-merge-sparse.sh',
+ 't6436-merge-overwrite.sh',
+ 't6437-submodule-merge.sh',
+ 't6438-submodule-directory-file-conflicts.sh',
+ 't6439-merge-co-error-msgs.sh',
+ 't6500-gc.sh',
+ 't6501-freshen-objects.sh',
+ 't6600-test-reach.sh',
+ 't6700-tree-depth.sh',
+ 't7001-mv.sh',
+ 't7002-mv-sparse-checkout.sh',
+ 't7003-filter-branch.sh',
+ 't7004-tag.sh',
+ 't7005-editor.sh',
+ 't7006-pager.sh',
+ 't7007-show.sh',
+ 't7008-filter-branch-null-sha1.sh',
+ 't7010-setup.sh',
+ 't7011-skip-worktree-reading.sh',
+ 't7012-skip-worktree-writing.sh',
+ 't7030-verify-tag.sh',
+ 't7031-verify-tag-signed-ssh.sh',
+ 't7060-wtstatus.sh',
+ 't7061-wtstatus-ignore.sh',
+ 't7062-wtstatus-ignorecase.sh',
+ 't7063-status-untracked-cache.sh',
+ 't7064-wtstatus-pv2.sh',
+ 't7101-reset-empty-subdirs.sh',
+ 't7102-reset.sh',
+ 't7103-reset-bare.sh',
+ 't7104-reset-hard.sh',
+ 't7105-reset-patch.sh',
+ 't7106-reset-unborn-branch.sh',
+ 't7107-reset-pathspec-file.sh',
+ 't7110-reset-merge.sh',
+ 't7111-reset-table.sh',
+ 't7112-reset-submodule.sh',
+ 't7113-post-index-change-hook.sh',
+ 't7201-co.sh',
+ 't7300-clean.sh',
+ 't7301-clean-interactive.sh',
+ 't7400-submodule-basic.sh',
+ 't7401-submodule-summary.sh',
+ 't7402-submodule-rebase.sh',
+ 't7403-submodule-sync.sh',
+ 't7406-submodule-update.sh',
+ 't7407-submodule-foreach.sh',
+ 't7408-submodule-reference.sh',
+ 't7409-submodule-detached-work-tree.sh',
+ 't7411-submodule-config.sh',
+ 't7412-submodule-absorbgitdirs.sh',
+ 't7413-submodule-is-active.sh',
+ 't7414-submodule-mistakes.sh',
+ 't7416-submodule-dash-url.sh',
+ 't7417-submodule-path-url.sh',
+ 't7418-submodule-sparse-gitmodules.sh',
+ 't7419-submodule-set-branch.sh',
+ 't7420-submodule-set-url.sh',
+ 't7421-submodule-summary-add.sh',
+ 't7422-submodule-output.sh',
+ 't7423-submodule-symlinks.sh',
+ 't7424-submodule-mixed-ref-formats.sh',
+ 't7450-bad-git-dotfiles.sh',
+ 't7500-commit-template-squash-signoff.sh',
+ 't7501-commit-basic-functionality.sh',
+ 't7502-commit-porcelain.sh',
+ 't7503-pre-commit-and-pre-merge-commit-hooks.sh',
+ 't7504-commit-msg-hook.sh',
+ 't7505-prepare-commit-msg-hook.sh',
+ 't7506-status-submodule.sh',
+ 't7507-commit-verbose.sh',
+ 't7508-status.sh',
+ 't7509-commit-authorship.sh',
+ 't7510-signed-commit.sh',
+ 't7511-status-index.sh',
+ 't7512-status-help.sh',
+ 't7513-interpret-trailers.sh',
+ 't7514-commit-patch.sh',
+ 't7515-status-symlinks.sh',
+ 't7516-commit-races.sh',
+ 't7517-per-repo-email.sh',
+ 't7518-ident-corner-cases.sh',
+ 't7519-status-fsmonitor.sh',
+ 't7520-ignored-hook-warning.sh',
+ 't7521-ignored-mode.sh',
+ 't7524-commit-summary.sh',
+ 't7525-status-rename.sh',
+ 't7526-commit-pathspec-file.sh',
+ 't7527-builtin-fsmonitor.sh',
+ 't7528-signed-commit-ssh.sh',
+ 't7600-merge.sh',
+ 't7601-merge-pull-config.sh',
+ 't7602-merge-octopus-many.sh',
+ 't7603-merge-reduce-heads.sh',
+ 't7604-merge-custom-message.sh',
+ 't7605-merge-resolve.sh',
+ 't7606-merge-custom.sh',
+ 't7607-merge-state.sh',
+ 't7608-merge-messages.sh',
+ 't7609-mergetool--lib.sh',
+ 't7610-mergetool.sh',
+ 't7611-merge-abort.sh',
+ 't7612-merge-verify-signatures.sh',
+ 't7614-merge-signoff.sh',
+ 't7615-diff-algo-with-mergy-operations.sh',
+ 't7700-repack.sh',
+ 't7701-repack-unpack-unreachable.sh',
+ 't7702-repack-cyclic-alternate.sh',
+ 't7703-repack-geometric.sh',
+ 't7704-repack-cruft.sh',
+ 't7800-difftool.sh',
+ 't7810-grep.sh',
+ 't7811-grep-open.sh',
+ 't7812-grep-icase-non-ascii.sh',
+ 't7813-grep-icase-iso.sh',
+ 't7814-grep-recurse-submodules.sh',
+ 't7815-grep-binary.sh',
+ 't7816-grep-binary-pattern.sh',
+ 't7817-grep-sparse-checkout.sh',
+ 't7900-maintenance.sh',
+ 't8001-annotate.sh',
+ 't8002-blame.sh',
+ 't8003-blame-corner-cases.sh',
+ 't8004-blame-with-conflicts.sh',
+ 't8005-blame-i18n.sh',
+ 't8006-blame-textconv.sh',
+ 't8007-cat-file-textconv.sh',
+ 't8008-blame-formats.sh',
+ 't8009-blame-vs-topicbranches.sh',
+ 't8010-cat-file-filters.sh',
+ 't8011-blame-split-file.sh',
+ 't8012-blame-colors.sh',
+ 't8013-blame-ignore-revs.sh',
+ 't8014-blame-ignore-fuzzy.sh',
+ 't9001-send-email.sh',
+ 't9002-column.sh',
+ 't9003-help-autocorrect.sh',
+ 't9100-git-svn-basic.sh',
+ 't9101-git-svn-props.sh',
+ 't9102-git-svn-deep-rmdir.sh',
+ 't9103-git-svn-tracked-directory-removed.sh',
+ 't9104-git-svn-follow-parent.sh',
+ 't9105-git-svn-commit-diff.sh',
+ 't9106-git-svn-commit-diff-clobber.sh',
+ 't9107-git-svn-migrate.sh',
+ 't9108-git-svn-glob.sh',
+ 't9109-git-svn-multi-glob.sh',
+ 't9110-git-svn-use-svm-props.sh',
+ 't9111-git-svn-use-svnsync-props.sh',
+ 't9112-git-svn-md5less-file.sh',
+ 't9113-git-svn-dcommit-new-file.sh',
+ 't9114-git-svn-dcommit-merge.sh',
+ 't9115-git-svn-dcommit-funky-renames.sh',
+ 't9116-git-svn-log.sh',
+ 't9117-git-svn-init-clone.sh',
+ 't9118-git-svn-funky-branch-names.sh',
+ 't9119-git-svn-info.sh',
+ 't9120-git-svn-clone-with-percent-escapes.sh',
+ 't9121-git-svn-fetch-renamed-dir.sh',
+ 't9122-git-svn-author.sh',
+ 't9123-git-svn-rebuild-with-rewriteroot.sh',
+ 't9124-git-svn-dcommit-auto-props.sh',
+ 't9125-git-svn-multi-glob-branch-names.sh',
+ 't9126-git-svn-follow-deleted-readded-directory.sh',
+ 't9127-git-svn-partial-rebuild.sh',
+ 't9128-git-svn-cmd-branch.sh',
+ 't9129-git-svn-i18n-commitencoding.sh',
+ 't9130-git-svn-authors-file.sh',
+ 't9131-git-svn-empty-symlink.sh',
+ 't9132-git-svn-broken-symlink.sh',
+ 't9133-git-svn-nested-git-repo.sh',
+ 't9134-git-svn-ignore-paths.sh',
+ 't9135-git-svn-moved-branch-empty-file.sh',
+ 't9136-git-svn-recreated-branch-empty-file.sh',
+ 't9137-git-svn-dcommit-clobber-series.sh',
+ 't9138-git-svn-authors-prog.sh',
+ 't9139-git-svn-non-utf8-commitencoding.sh',
+ 't9140-git-svn-reset.sh',
+ 't9141-git-svn-multiple-branches.sh',
+ 't9142-git-svn-shallow-clone.sh',
+ 't9143-git-svn-gc.sh',
+ 't9144-git-svn-old-rev_map.sh',
+ 't9145-git-svn-master-branch.sh',
+ 't9146-git-svn-empty-dirs.sh',
+ 't9147-git-svn-include-paths.sh',
+ 't9148-git-svn-propset.sh',
+ 't9150-svk-mergetickets.sh',
+ 't9151-svn-mergeinfo.sh',
+ 't9152-svn-empty-dirs-after-gc.sh',
+ 't9153-git-svn-rewrite-uuid.sh',
+ 't9154-git-svn-fancy-glob.sh',
+ 't9155-git-svn-fetch-deleted-tag.sh',
+ 't9156-git-svn-fetch-deleted-tag-2.sh',
+ 't9157-git-svn-fetch-merge.sh',
+ 't9158-git-svn-mergeinfo.sh',
+ 't9159-git-svn-no-parent-mergeinfo.sh',
+ 't9160-git-svn-preserve-empty-dirs.sh',
+ 't9161-git-svn-mergeinfo-push.sh',
+ 't9162-git-svn-dcommit-interactive.sh',
+ 't9163-git-svn-reset-clears-caches.sh',
+ 't9164-git-svn-dcommit-concurrent.sh',
+ 't9165-git-svn-fetch-merge-branch-of-branch.sh',
+ 't9166-git-svn-fetch-merge-branch-of-branch2.sh',
+ 't9167-git-svn-cmd-branch-subproject.sh',
+ 't9168-git-svn-partially-globbed-names.sh',
+ 't9169-git-svn-dcommit-crlf.sh',
+ 't9200-git-cvsexportcommit.sh',
+ 't9210-scalar.sh',
+ 't9211-scalar-clone.sh',
+ 't9300-fast-import.sh',
+ 't9301-fast-import-notes.sh',
+ 't9302-fast-import-unpack-limit.sh',
+ 't9303-fast-import-compression.sh',
+ 't9304-fast-import-marks.sh',
+ 't9350-fast-export.sh',
+ 't9351-fast-export-anonymize.sh',
+ 't9400-git-cvsserver-server.sh',
+ 't9401-git-cvsserver-crlf.sh',
+ 't9402-git-cvsserver-refs.sh',
+ 't9500-gitweb-standalone-no-errors.sh',
+ 't9501-gitweb-standalone-http-status.sh',
+ 't9502-gitweb-standalone-parse-output.sh',
+ 't9600-cvsimport.sh',
+ 't9601-cvsimport-vendor-branch.sh',
+ 't9602-cvsimport-branches-tags.sh',
+ 't9603-cvsimport-patchsets.sh',
+ 't9604-cvsimport-timestamps.sh',
+ 't9700-perl-git.sh',
+ 't9800-git-p4-basic.sh',
+ 't9801-git-p4-branch.sh',
+ 't9802-git-p4-filetype.sh',
+ 't9803-git-p4-shell-metachars.sh',
+ 't9804-git-p4-label.sh',
+ 't9805-git-p4-skip-submit-edit.sh',
+ 't9806-git-p4-options.sh',
+ 't9807-git-p4-submit.sh',
+ 't9808-git-p4-chdir.sh',
+ 't9809-git-p4-client-view.sh',
+ 't9810-git-p4-rcs.sh',
+ 't9811-git-p4-label-import.sh',
+ 't9812-git-p4-wildcards.sh',
+ 't9813-git-p4-preserve-users.sh',
+ 't9814-git-p4-rename.sh',
+ 't9815-git-p4-submit-fail.sh',
+ 't9816-git-p4-locked.sh',
+ 't9817-git-p4-exclude.sh',
+ 't9818-git-p4-block.sh',
+ 't9819-git-p4-case-folding.sh',
+ 't9820-git-p4-editor-handling.sh',
+ 't9821-git-p4-path-variations.sh',
+ 't9822-git-p4-path-encoding.sh',
+ 't9823-git-p4-mock-lfs.sh',
+ 't9824-git-p4-git-lfs.sh',
+ 't9825-git-p4-handle-utf16-without-bom.sh',
+ 't9826-git-p4-keep-empty-commits.sh',
+ 't9827-git-p4-change-filetype.sh',
+ 't9828-git-p4-map-user.sh',
+ 't9829-git-p4-jobs.sh',
+ 't9830-git-p4-symlink-dir.sh',
+ 't9831-git-p4-triggers.sh',
+ 't9832-unshelve.sh',
+ 't9833-errors.sh',
+ 't9834-git-p4-file-dir-bug.sh',
+ 't9835-git-p4-metadata-encoding-python2.sh',
+ 't9836-git-p4-metadata-encoding-python3.sh',
+ 't9850-shell.sh',
+ 't9901-git-web--browse.sh',
+ 't9902-completion.sh',
+ 't9903-bash-prompt.sh',
+]
+
+# GIT_BUILD_DIR needs to be Unix-style without drive prefixes as it 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 it.
+git_build_dir = meson.project_build_root()
+if cygpath.found()
+ git_build_dir = run_command(cygpath, git_build_dir, check: true).stdout().strip()
+endif
+
+test_environment = script_environment
+test_environment.set('GIT_BUILD_DIR', git_build_dir)
+
+foreach integration_test : integration_tests
+ test(fs.stem(integration_test), shell,
+ args: [ integration_test ],
+ workdir: meson.current_source_dir(),
+ env: test_environment,
+ depends: test_dependencies + bin_wrappers,
+ timeout: 0,
+ )
+endforeach
diff --git a/templates/hooks/meson.build b/templates/hooks/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..5bbb1bd483f24e05f826918fe63391ef72334e11
--- /dev/null
+++ b/templates/hooks/meson.build
@@ -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',
+ )
+endforeach
diff --git a/templates/info/meson.build b/templates/info/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..7af5ddd24985fc0a5888961939ae3b2758f2aaa8
--- /dev/null
+++ b/templates/info/meson.build
@@ -0,0 +1,7 @@
+configure_file(
+ input: 'exclude',
+ output: 'exclude',
+ configuration: template_config,
+ install: true,
+ install_dir: get_option('datadir') / 'git-core/templates',
+)
diff --git a/templates/meson.build b/templates/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..1faf9a44ceaa5a6eee673e66c9d5448c08dbc7d5
--- /dev/null
+++ b/templates/meson.build
@@ -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')
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v10 23/23] meson: fix conflicts with in-flight topics
2024-11-28 16:12 ` [PATCH v10 00/23] Modernize the build system Patrick Steinhardt
` (21 preceding siblings ...)
2024-11-28 16:12 ` [PATCH v10 22/23] Introduce support for the Meson build system Patrick Steinhardt
@ 2024-11-28 16:12 ` Patrick Steinhardt
22 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-11-28 16:12 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
As support for Meson is still in-flight we have to accommodate for
conflicts with topics in "seen". The following conflicts are being
addressed in this commit:
- ej/cat-file-remote-object-info adds t1017 and "fetch-object-info.c".
- ds/path-walk-1 adds t6601 as well as "path-walk.c" and
"test-path-walk.c".
- ps/reftable-detach adds "reftable/system.c".
- js/libgit-rust adds "common-exit.c" and "common-init.c".
- ds/full-name-hash adds "t/helper/test-name-hash.c".
- cw/worktree-extension deletes t2408.
This is somewhat painful in the current state where Meson is not yet
part of the main tree, but we'll have to live with that for the time
being.
I've split this commit out into a separate fixup-style commit such that
it is possible to test this topic both with and without "seen" merged
into it. You can simply revert this commit to test without "seen".
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
meson.build | 7 ++++++-
t/helper/meson.build | 2 ++
t/meson.build | 3 ++-
templates/hooks/meson.build | 2 +-
templates/info/meson.build | 2 +-
5 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/meson.build b/meson.build
index 6531c9b67ed2cb8cb5eac9b0be4654ddd14fbe1d..055c0671e9bc834062aff99e1e4e3ea3e54ad088 100644
--- a/meson.build
+++ b/meson.build
@@ -238,6 +238,8 @@ libgit_sources = [
'commit-graph.c',
'commit-reach.c',
'commit.c',
+ 'common-exit.c',
+ 'common-init.c',
'compat/nonblock.c',
'compat/obstack.c',
'compat/terminal.c',
@@ -276,6 +278,7 @@ libgit_sources = [
'ewah/ewah_rlw.c',
'exec-cmd.c',
'fetch-negotiator.c',
+ 'fetch-object-info.c',
'fetch-pack.c',
'fmt-merge-msg.c',
'fsck.c',
@@ -350,6 +353,7 @@ libgit_sources = [
'parse-options.c',
'patch-delta.c',
'patch-ids.c',
+ 'path-walk.c',
'path.c',
'pathspec.c',
'pkt-line.c',
@@ -390,6 +394,7 @@ libgit_sources = [
'reftable/reader.c',
'reftable/record.c',
'reftable/stack.c',
+ 'reftable/system.c',
'reftable/tree.c',
'reftable/writer.c',
'remote.c',
@@ -1694,7 +1699,7 @@ foreach alias : [ 'git-receive-pack', 'git-upload-archive', 'git-upload-pack' ]
install_symlink(alias + executable_suffix,
install_dir: get_option('libexecdir') / 'git-core',
- pointing_to: 'git-remote-http',
+ pointing_to: 'git',
)
endforeach
diff --git a/t/helper/meson.build b/t/helper/meson.build
index 5e83884246edc7841738de5085f3255aa1fa3fbe..1d6154ce9756db17bc9f69bc3cd71a32b93857c5 100644
--- a/t/helper/meson.build
+++ b/t/helper/meson.build
@@ -34,12 +34,14 @@ test_tool_sources = [
'test-match-trees.c',
'test-mergesort.c',
'test-mktemp.c',
+ 'test-name-hash.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-path-walk.c',
'test-pcre2-config.c',
'test-pkt-line.c',
'test-proc-receive.c',
diff --git a/t/meson.build b/t/meson.build
index 86076b77d2005529f58fb402e86bc95048071342..1c82e27a1d48dd6a163d7b26c74b5ebf6f258d41 100644
--- a/t/meson.build
+++ b/t/meson.build
@@ -177,6 +177,7 @@ integration_tests = [
't1014-read-tree-confusing.sh',
't1015-read-index-unmerged.sh',
't1016-compatObjectFormat.sh',
+ 't1017-cat-file-remote-object-info.sh',
't1020-subdirectory.sh',
't1021-rerere-in-workdir.sh',
't1022-read-tree-partial-clone.sh',
@@ -306,7 +307,6 @@ integration_tests = [
't2405-worktree-submodule.sh',
't2406-worktree-repair.sh',
't2407-worktree-heads.sh',
- 't2408-worktree-relative.sh',
't2500-untracked-overwriting.sh',
't2501-cwd-empty.sh',
't3000-ls-files-others.sh',
@@ -830,6 +830,7 @@ integration_tests = [
't6500-gc.sh',
't6501-freshen-objects.sh',
't6600-test-reach.sh',
+ 't6601-path-walk.sh',
't6700-tree-depth.sh',
't7001-mv.sh',
't7002-mv-sparse-checkout.sh',
diff --git a/templates/hooks/meson.build b/templates/hooks/meson.build
index 5bbb1bd483f24e05f826918fe63391ef72334e11..ef85e10a16ccd6c5569b8fc25210d6481025f33f 100644
--- a/templates/hooks/meson.build
+++ b/templates/hooks/meson.build
@@ -21,6 +21,6 @@ foreach hook : hooks
output: hook,
configuration: template_config,
install: true,
- install_dir: get_option('datadir') / 'git-core/templates',
+ install_dir: get_option('datadir') / 'git-core/templates/hooks',
)
endforeach
diff --git a/templates/info/meson.build b/templates/info/meson.build
index 7af5ddd24985fc0a5888961939ae3b2758f2aaa8..026f2313858c24e30a9bf115ee0f58144a593729 100644
--- a/templates/info/meson.build
+++ b/templates/info/meson.build
@@ -3,5 +3,5 @@ configure_file(
output: 'exclude',
configuration: template_config,
install: true,
- install_dir: get_option('datadir') / 'git-core/templates',
+ install_dir: get_option('datadir') / 'git-core/templates/info',
)
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v11 00/26] Modernize the build system
2024-10-02 15:15 [RFC PATCH 00/21] Modernize the build system Patrick Steinhardt
` (30 preceding siblings ...)
2024-11-28 16:12 ` [PATCH v10 00/23] Modernize the build system Patrick Steinhardt
@ 2024-12-06 13:24 ` Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 01/26] Makefile: use common template for GIT-BUILD-OPTIONS Patrick Steinhardt
` (25 more replies)
31 siblings, 26 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-12-06 13:24 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
Hi,
this patch series modernizes our build infrasturcture. It refactors
various parts of it to make it possible to perform out-of-tree builds in
theory.
The series then continues to wire up Meson as a proposed alternative as
a modern replacement for our current build systems. It provides better
integration into IDEs than our Makefiles, better usability than our
Makefiles and CMake, better configuration and discoverability thereof
than autoconf and CMake (which is of course my personal opinion).
The intent is to have Meson replace autoconf, which is mostly unused and
broken. Eventually, the plan is to also replace CMake and our Makefiles
in case we figure out that this replacement is indeed a net benefit for
the project, but all of this would happen over the course of multiple
releases.
Changes in v11:
- The patch series is now based on e66fd72e97 (The fourteenth batch,
2024-12-06) with junio/ps/reftable-detach at 988e7f5e95
(reftable/system: provide thin wrapper for lockfile subsystem,
2024-11-18) and junio/cw/worktree-extension at 2037ca85ad (worktree:
refactor `repair_worktree_after_gitdir_move()`, 2024-11-29) merged
into it. This is done to fix semantic merge conflicts.
- Fix an issue on macOS where we started to pull in `libcharset` for
`locale_charset()` instead of using `nl_langinfo()` provided by
libc. This was discovered while wiring up a follow-up patch series
that introduces Meson into our CI.
- Introduce a couple of fallbacks so that we can compile with an older
version of Meson. We now support Meson 0.64.0 and newer, where we
only support 1.3.0 and newer before.
- Adapt bin-wrappers such that we inject the full @PATH@. This was
done to drop one usage of `fs.relative_to()`.
- Drop the C standard option. We don't use it in our Makefile, either,
- Massage Python scripts via a new `generate_python.sh` script. This
makes both Meson and CMake replace the shebang correctly.
- Link to v10: https://lore.kernel.org/r/20241128-pks-meson-v10-0-79a3fb0cb3a6@pks.im
As before, the tip of this patch series catches up with what is
happening in "seen" and should thus not be merged to "next". If you want
to test it without topics in "seen" you have to revert it.
Thanks!
Patrick
---
Patrick Steinhardt (26):
Makefile: use common template for GIT-BUILD-OPTIONS
Makefile: consistently use @PLACEHOLDER@ to substitute
Makefile: refactor GIT-VERSION-GEN to be reusable
Makefile: propagate Git version via generated header
Makefile: generate "git.rc" via GIT-VERSION-GEN
Makefile: generate doc versions via GIT-VERSION-GEN
Makefile: consistently use PERL_PATH
Makefile: extract script to massage Perl scripts
Makefile: use "generate-perl.sh" to massage Perl library
Makefile: extract script to massage Shell scripts
Makefile: extract script to massage Python scripts
Makefile: extract script to generate gitweb.cgi
Makefile: extract script to generate gitweb.js
Makefile: refactor generators to be PWD-independent
Makefile: allow "bin-wrappers/" directory to exist
Makefile: write absolute program path into bin-wrappers
Makefile: simplify building of templates
Documentation: allow sourcing generated includes from separate dir
Documentation: teach "cmd-list.perl" about out-of-tree builds
Documentation: extract script to generate a list of mergetools
t: better support for out-of-tree builds
t: allow overriding build dir
Documentation: add comparison of build systems
Introduce support for the Meson build system
meson: fix conflicts with in-flight topics
Revert "meson: fix conflicts with in-flight topics"
.gitignore | 3 +-
Documentation/.gitignore | 2 +
Documentation/CodingGuidelines | 2 +-
Documentation/Makefile | 53 +-
Documentation/{asciidoc.conf => asciidoc.conf.in} | 3 +
...-extensions.rb => asciidoctor-extensions.rb.in} | 8 +-
Documentation/build-docdep.perl | 2 +
Documentation/cmd-list.perl | 23 +-
Documentation/config/diff.txt | 2 +-
Documentation/config/merge.txt | 2 +-
Documentation/generate-mergetool-list.sh | 17 +
Documentation/git.txt | 24 +-
Documentation/meson.build | 324 ++++
Documentation/technical/build-systems.txt | 224 +++
GIT-BUILD-OPTIONS.in | 47 +
GIT-VERSION-FILE.in | 1 +
GIT-VERSION-GEN | 74 +-
Makefile | 249 ++-
bin-wrappers/.gitignore | 9 +
bin-wrappers/meson.build | 28 +
bin-wrappers/wrap-for-bin.sh | 37 +
ci/test-documentation.sh | 2 +-
configure.ac | 2 +-
contrib/buildsystems/CMakeLists.txt | 302 ++--
contrib/buildsystems/git-version.in | 1 +
contrib/completion/meson.build | 16 +
contrib/meson.build | 1 +
generate-cmdlist.sh | 42 +-
generate-configlist.sh | 20 +-
generate-hooklist.sh | 15 +-
generate-perl.sh | 37 +
generate-python.sh | 20 +
generate-script.sh | 34 +
git-cvsserver.perl | 2 +-
git-instaweb.sh | 8 +-
git-request-pull.sh | 2 +-
git-send-email.perl | 2 +-
git-sh-i18n.sh | 6 +-
git-sh-setup.sh | 6 +-
git-svn.perl | 2 +-
git.rc => git.rc.in | 6 +-
gitweb/GITWEB-BUILD-OPTIONS.in | 24 +
gitweb/Makefile | 62 +-
gitweb/generate-gitweb-cgi.sh | 47 +
gitweb/generate-gitweb-js.sh | 12 +
gitweb/gitweb.perl | 44 +-
gitweb/meson.build | 89 +
meson.build | 1901 ++++++++++++++++++++
meson_options.txt | 81 +
perl/FromCPAN/Mail/meson.build | 7 +
perl/FromCPAN/meson.build | 9 +
perl/Git/I18N.pm | 6 +-
perl/Git/LoadCPAN.pm | 6 +-
perl/Git/LoadCPAN/Mail/meson.build | 7 +
perl/Git/LoadCPAN/meson.build | 9 +
perl/Git/SVN/Memoize/meson.build | 7 +
perl/Git/SVN/meson.build | 20 +
perl/Git/meson.build | 18 +
perl/header_templates/fixed_prefix.template.pl | 2 +-
perl/header_templates/runtime_prefix.template.pl | 8 +-
perl/meson.build | 12 +
po/meson.build | 27 +
subprojects/.gitignore | 1 +
subprojects/curl.wrap | 13 +
subprojects/expat.wrap | 13 +
subprojects/openssl.wrap | 15 +
subprojects/pcre2.wrap | 16 +
subprojects/zlib.wrap | 13 +
t/helper/meson.build | 91 +
t/lib-gettext.sh | 4 +-
t/meson.build | 1114 ++++++++++++
t/t7609-mergetool--lib.sh | 2 +-
t/test-lib.sh | 31 +-
templates/Makefile | 39 +-
templates/branches-- | 1 -
templates/{this--description => description} | 0
.../applypatch-msg.sample} | 0
.../commit-msg.sample} | 0
.../fsmonitor-watchman.sample} | 0
templates/hooks/meson.build | 26 +
.../post-update.sample} | 0
.../pre-applypatch.sample} | 0
.../pre-commit.sample} | 0
.../pre-merge-commit.sample} | 0
.../pre-push.sample} | 0
.../pre-rebase.sample} | 0
.../pre-receive.sample} | 0
.../prepare-commit-msg.sample} | 0
.../push-to-checkout.sample} | 0
.../sendemail-validate.sample} | 0
.../{hooks--update.sample => hooks/update.sample} | 0
templates/{info--exclude => info/exclude} | 0
templates/info/meson.build | 7 +
templates/meson.build | 15 +
unimplemented.sh | 2 +-
version-def.h.in | 8 +
version.c | 1 +
wrap-for-bin.sh | 36 -
98 files changed, 4995 insertions(+), 511 deletions(-)
Range-diff versus v10:
1: 7a33c0685f = 1: 4d68af4c11 Makefile: use common template for GIT-BUILD-OPTIONS
2: ea7d458802 = 2: 7767a7aee1 Makefile: consistently use @PLACEHOLDER@ to substitute
3: b845f92c62 = 3: 03b526488e Makefile: refactor GIT-VERSION-GEN to be reusable
4: 6db891f835 = 4: 6291479642 Makefile: propagate Git version via generated header
5: 66865f3dd0 = 5: 39c4fbfd15 Makefile: generate "git.rc" via GIT-VERSION-GEN
6: d24acc74a7 ! 6: c5be33f77a Makefile: generate doc versions via GIT-VERSION-GEN
@@ Documentation/Makefile: technical/api-index.txt: technical/api-index-skel.txt \
$(QUIET_ASCIIDOC)$(TXT_TO_HTML) $*.txt
SubmittingPatches.txt: SubmittingPatches
+@@ Documentation/Makefile: $(patsubst %.txt,%.texi,$(MAN_TXT)): %.texi : %.xml
+ howto-index.txt: howto-index.sh $(HOWTO_TXT)
+ $(QUIET_GEN)'$(SHELL_PATH_SQ)' ./howto-index.sh $(sort $(HOWTO_TXT)) >$@
+
+-$(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
++$(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt $(ASCIIDOC_DEPS)
+ $(QUIET_ASCIIDOC)$(TXT_TO_HTML) $*.txt
+
+ WEBDOC_DEST = /pub/software/scm/git/docs
+
+ howto/%.html: ASCIIDOC_EXTRA += -a git-relative-html-prefix=../
+-$(patsubst %.txt,%.html,$(HOWTO_TXT)): %.html : %.txt GIT-ASCIIDOCFLAGS
++$(patsubst %.txt,%.html,$(HOWTO_TXT)): %.html : %.txt $(ASCIIDOC_DEPS)
+ $(QUIET_ASCIIDOC) \
+ sed -e '1,/^$$/d' $< | \
+ $(TXT_TO_HTML) - >$@
## Documentation/asciidoc.conf => Documentation/asciidoc.conf.in ##
@@ Documentation/asciidoc.conf.in: tilde=~
7: cbac1c334a = 7: 4f785adbfa Makefile: consistently use PERL_PATH
8: 055831a146 = 8: 79b087821a Makefile: extract script to massage Perl scripts
9: d8b0047981 = 9: 7c93d8d2fe Makefile: use "generate-perl.sh" to massage Perl library
10: 5d9e5ed89f = 10: 17e203b4ee Makefile: extract script to massage Shell scripts
-: ---------- > 11: 52b294f78d Makefile: extract script to massage Python scripts
11: 6eed6d43c1 = 12: e14816f6d1 Makefile: extract script to generate gitweb.cgi
12: 6cedddb117 = 13: 0ad32eeb2a Makefile: extract script to generate gitweb.js
13: 7eb985e35d = 14: df5ea3f507 Makefile: refactor generators to be PWD-independent
14: 5153718ee1 = 15: d54dd05a74 Makefile: allow "bin-wrappers/" directory to exist
-: ---------- > 16: 486b781ed6 Makefile: write absolute program path into bin-wrappers
15: 978d732272 ! 17: 2cdc2917a8 Makefile: simplify building of templates
@@ contrib/buildsystems/CMakeLists.txt: elseif(UNIX)
list(TRANSFORM git_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
add_executable(git ${CMAKE_SOURCE_DIR}/git.c ${git_SOURCES})
-@@ contrib/buildsystems/CMakeLists.txt: file(STRINGS ${CMAKE_SOURCE_DIR}/git-p4.py content NEWLINE_CONSUME)
- string(REPLACE "#!/usr/bin/env python" "#!/usr/bin/python" content "${content}")
- file(WRITE ${CMAKE_BINARY_DIR}/git-p4 ${content})
+@@ contrib/buildsystems/CMakeLists.txt: add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/git-p4"
+ VERBATIM)
+ add_custom_target(python-gen ALL DEPENDS "${CMAKE_BINARY_DIR}/git-p4")
-#templates
-file(GLOB templates "${CMAKE_SOURCE_DIR}/templates/*")
16: c6638309d5 ! 18: cce9066332 Documentation: allow sourcing generated includes from separate dir
@@ Documentation/build-docdep.perl
}
## Documentation/config/diff.txt ##
-@@ Documentation/config/diff.txt: diff.<driver>.cachetextconv::
- Set this option to true to make the diff driver cache the text
+@@ Documentation/config/diff.txt: endif::git-diff[]
+ Set this option to `true` to make the diff driver cache the text
conversion outputs. See linkgit:gitattributes[5] for details.
-include::../mergetools-diff.txt[]
+include::{build_dir}/mergetools-diff.txt[]
- diff.indentHeuristic::
+ `diff.indentHeuristic`::
Set this option to `false` to disable the default heuristics
## Documentation/config/merge.txt ##
17: 2fe7d3df33 = 19: 36007aaec7 Documentation: teach "cmd-list.perl" about out-of-tree builds
18: b2a334716c = 20: 7e1188316f Documentation: extract script to generate a list of mergetools
19: 77b1d45cf5 ! 21: 3ae68bfcb6 t: better support for out-of-tree builds
@@ Makefile: all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CL
+ -e 's|@GITPERLLIB@|$(shell pwd)/perl/build/lib|' \
+ -e 's|@MERGE_TOOLS_DIR@|$(shell pwd)/mergetools|' \
+ -e 's|@TEMPLATE_DIR@|$(shell pwd)/templates/blt|' \
- -e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
+ -e 's|@PROG@|$(shell pwd)/$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
chmod +x $@
@@ contrib/buildsystems/CMakeLists.txt: endforeach()
+string(REPLACE "@GIT_TEXTDOMAINDIR@" "${CMAKE_BINARY_DIR}/po/build/locale" content "${content}")
+string(REPLACE "@GITPERLLIB@" "${CMAKE_BINARY_DIR}/perl/build/lib" content "${content}")
+string(REPLACE "@MERGE_TOOLS_DIR@" "${CMAKE_SOURCE_DIR}/mergetools" content "${content}")
- string(REPLACE "@PROG@" "git-cvsserver" content "${content}")
+ string(REPLACE "@PROG@" "${CMAKE_BINARY_DIR}/git-cvsserver" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})
@@ contrib/buildsystems/CMakeLists.txt: string(REPLACE "@GIT_PERF_MAKE_COMMAND@" "" git_build_options "${git_build_optio
@@ t/lib-gettext.sh
if test -n "$GIT_TEST_INSTALLED"
## t/t7609-mergetool--lib.sh ##
-@@ t/t7609-mergetool--lib.sh: TEST_PASSES_SANITIZE_LEAK=true
+@@ t/t7609-mergetool--lib.sh: Testing basic merge tools options'
. ./test-lib.sh
test_expect_success 'mergetool --tool=vimdiff creates the expected layout' '
20: 9de1c8c8e7 = 22: 98db2ae158 t: allow overriding build dir
21: d0374d6d52 = 23: 78919a351a Documentation: add comparison of build systems
22: 77529b002c ! 24: 934594206e Introduce support for the Meson build system
@@ bin-wrappers/meson.build (new)
+foreach executable : bin_wrappers
+ executable_config = configuration_data()
+ executable_config.merge_from(bin_wrappers_config)
-+ executable_config.set('PROG', fs.relative_to(executable.full_path(), meson.project_build_root()))
++ executable_config.set('PROG', executable.full_path())
+
+ configure_file(
+ input: 'wrap-for-bin.sh',
@@ contrib/completion/meson.build (new)
+ 'git-completion.zsh',
+ 'git-prompt.sh'
+]
-+ test_dependencies += fs.copyfile(script)
++ if meson.version().version_compare('>=1.3.0')
++ test_dependencies += fs.copyfile(script)
++ else
++ configure_file(
++ input: script,
++ output: script,
++ copy: true,
++ )
++ endif
+endforeach
## contrib/meson.build (new) ##
@@ gitweb/meson.build (new)
+ 'static/git-logo.png',
+ 'static/gitweb.css',
+]
-+ fs.copyfile(asset,
-+ install: true,
-+ install_dir: get_option('datadir') / 'gitweb' / fs.parent(asset),
-+ )
++ 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
## meson.build (new) ##
@@ meson.build (new)
+# with the `--wrap-mode nofallback` option.
+
+project('git', 'c',
-+ meson_version: '>=1.3.0',
-+ # MSVC does not support GNU99, and C99 does not define __STDC_VERSION__
-+ # on MSVC. So we instead fall back to C11 there.
-+ default_options: ['c_std=gnu99,c11'],
++ meson_version: '>=0.61.0',
+ version: 'v2.47.GIT',
+)
+
@@ meson.build (new)
+ 'reftable/reader.c',
+ 'reftable/record.c',
+ 'reftable/stack.c',
++ 'reftable/system.c',
+ 'reftable/tree.c',
+ 'reftable/writer.c',
+ 'remote.c',
@@ meson.build (new)
+ libgit_dependencies += intl
+ build_options_config.set('NO_GETTEXT', '')
+ build_options_config.set('USE_GETTEXT_SCHEME', '')
++
++ # POSIX nowadays requires `nl_langinfo()`, but some systems still don't have
++ # the function available. On such systems we instead fall back to libcharset.
++ # On native Windows systems we use our own emulation.
++ if host_machine.system() != 'windows' and not compiler.has_function('nl_langinfo')
++ libcharset = compiler.find_library('charset', required: true)
++ libgit_dependencies += libcharset
++ libgit_c_args += '-DHAVE_LIBCHARSET_H'
++ endif
+else
+ libgit_c_args += '-DNO_GETTEXT'
+ build_options_config.set('NO_GETTEXT', '1')
@@ meson.build (new)
+ libgit_c_args += '-DNO_INTTYPES_H'
+endif
+
-+if compiler.has_header('libcharset.h')
-+ libcharset = compiler.find_library('charset')
-+
-+ if compiler.has_function('locale_charset',
-+ prefix: '#include <libcharset.h>',
-+ dependencies: iconv,
-+ )
-+ libgit_c_args += '-DHAVE_LIBCHARSET_H'
-+ elif compiler.has_function('locale_charset',
-+ prefix: '#include <libcharset.h>',
-+ dependencies: libcharset,
-+ )
-+ libgit_c_args += '-DHAVE_LIBCHARSET_H'
-+ endif
-+endif
-+
+if compiler.has_header('alloca.h')
+ libgit_c_args += '-DHAVE_ALLOCA_H'
+endif
@@ meson.build (new)
+
+ install_symlink(alias + executable_suffix,
+ install_dir: get_option('libexecdir') / 'git-core',
-+ pointing_to: 'git-remote-http',
++ pointing_to: 'git',
+ )
+endforeach
+
@@ meson.build (new)
+ 'git-upload-pack',
+ 'scalar',
+]
++ if meson.version().version_compare('>=1.3.0')
++ pointing_to = fs.relative_to(get_option('libexecdir') / 'git-core' / symlink, get_option('bindir'))
++ else
++ pointing_to = '../libexec/git-core' / symlink
++ endif
++
+ install_symlink(symlink,
+ install_dir: get_option('bindir'),
-+ pointing_to: fs.relative_to(get_option('libexecdir') / 'git-core' / symlink, get_option('bindir')),
++ pointing_to: pointing_to,
+ )
+endforeach
+
@@ meson.build (new)
+ if script == 'git-cvsserver.perl'
+ bin_wrappers += generated_script
+
++ if meson.version().version_compare('>=1.3.0')
++ pointing_to = fs.relative_to(get_option('libexecdir') / 'git-core' / fs.stem(script), get_option('bindir'))
++ else
++ pointing_to = '../libexec/git-core' / fs.stem(script)
++ endif
++
+ install_symlink(fs.stem(script),
+ install_dir: get_option('bindir'),
-+ pointing_to: fs.relative_to(get_option('libexecdir') / 'git-core' / fs.stem(script), get_option('bindir')),
++ pointing_to: pointing_to,
+ )
+ endif
+ endforeach
@@ meson.build (new)
+ ]
+
+ foreach script : scripts_python
-+ fs.copyfile(script, fs.stem(script),
++ generated_python = custom_target(
++ input: script,
++ output: fs.stem(script),
++ command: [
++ shell,
++ meson.project_source_root() / 'generate-python.sh',
++ meson.project_build_root() / 'GIT-BUILD-OPTIONS',
++ '@INPUT@',
++ '@OUTPUT@',
++ ],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
++ test_dependencies += generated_python
+ endforeach
+endif
+
@@ t/meson.build (new)
+ 't2405-worktree-submodule.sh',
+ 't2406-worktree-repair.sh',
+ 't2407-worktree-heads.sh',
-+ 't2408-worktree-relative.sh',
+ 't2500-untracked-overwriting.sh',
+ 't2501-cwd-empty.sh',
+ 't3000-ls-files-others.sh',
@@ templates/hooks/meson.build (new)
+ output: hook,
+ configuration: template_config,
+ install: true,
-+ install_dir: get_option('datadir') / 'git-core/templates',
++ install_dir: get_option('datadir') / 'git-core/templates/hooks',
+ )
+endforeach
@@ templates/info/meson.build (new)
+ output: 'exclude',
+ configuration: template_config,
+ install: true,
-+ install_dir: get_option('datadir') / 'git-core/templates',
++ install_dir: get_option('datadir') / 'git-core/templates/info',
+)
## templates/meson.build (new) ##
23: 3fc4c85635 ! 25: f5e9b17ebc meson: fix conflicts with in-flight topics
@@ Commit message
- ds/path-walk-1 adds t6601 as well as "path-walk.c" and
"test-path-walk.c".
- - ps/reftable-detach adds "reftable/system.c".
-
- js/libgit-rust adds "common-exit.c" and "common-init.c".
- - ds/full-name-hash adds "t/helper/test-name-hash.c".
-
- - cw/worktree-extension deletes t2408.
+ - ds/name-hash-tweaks adds "t/helper/test-name-hash.c".
This is somewhat painful in the current state where Meson is not yet
part of the main tree, but we'll have to live with that for the time
@@ meson.build: libgit_sources = [
'path.c',
'pathspec.c',
'pkt-line.c',
-@@ meson.build: libgit_sources = [
- 'reftable/reader.c',
- 'reftable/record.c',
- 'reftable/stack.c',
-+ 'reftable/system.c',
- 'reftable/tree.c',
- 'reftable/writer.c',
- 'remote.c',
-@@ meson.build: foreach alias : [ 'git-receive-pack', 'git-upload-archive', 'git-upload-pack' ]
-
- install_symlink(alias + executable_suffix,
- install_dir: get_option('libexecdir') / 'git-core',
-- pointing_to: 'git-remote-http',
-+ pointing_to: 'git',
- )
- endforeach
-
## t/helper/meson.build ##
@@ t/helper/meson.build: test_tool_sources = [
@@ t/meson.build: integration_tests = [
't1020-subdirectory.sh',
't1021-rerere-in-workdir.sh',
't1022-read-tree-partial-clone.sh',
-@@ t/meson.build: integration_tests = [
- 't2405-worktree-submodule.sh',
- 't2406-worktree-repair.sh',
- 't2407-worktree-heads.sh',
-- 't2408-worktree-relative.sh',
- 't2500-untracked-overwriting.sh',
- 't2501-cwd-empty.sh',
- 't3000-ls-files-others.sh',
@@ t/meson.build: integration_tests = [
't6500-gc.sh',
't6501-freshen-objects.sh',
@@ t/meson.build: integration_tests = [
't6700-tree-depth.sh',
't7001-mv.sh',
't7002-mv-sparse-checkout.sh',
-
- ## templates/hooks/meson.build ##
-@@ templates/hooks/meson.build: foreach hook : hooks
- output: hook,
- configuration: template_config,
- install: true,
-- install_dir: get_option('datadir') / 'git-core/templates',
-+ install_dir: get_option('datadir') / 'git-core/templates/hooks',
- )
- endforeach
-
- ## templates/info/meson.build ##
-@@ templates/info/meson.build: configure_file(
- output: 'exclude',
- configuration: template_config,
- install: true,
-- install_dir: get_option('datadir') / 'git-core/templates',
-+ install_dir: get_option('datadir') / 'git-core/templates/info',
- )
-: ---------- > 26: c03e0c8c98 Revert "meson: fix conflicts with in-flight topics"
---
base-commit: ca19fa60fe4a7f23d7b8303f68ca82d19839f287
change-id: 20241112-pks-meson-95b665c08f06
^ permalink raw reply [flat|nested] 386+ messages in thread
* [PATCH v11 01/26] Makefile: use common template for GIT-BUILD-OPTIONS
2024-12-06 13:24 ` [PATCH v11 00/26] Modernize the build system Patrick Steinhardt
@ 2024-12-06 13:24 ` Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 02/26] Makefile: consistently use @PLACEHOLDER@ to substitute Patrick Steinhardt
` (24 subsequent siblings)
25 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-12-06 13:24 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
The "GIT-BUILD-OPTIONS" file is generated by our build systems to
propagate built-in features and paths to our tests. The generation is
done ad-hoc, where both our Makefile and the CMake build instructions
simply echo a bunch of strings into the file. This makes it very hard to
figure out what variables are expected to exist and what format they
have, and the written variables can easily get out of sync between build
systems.
Introduce a new "GIT-BUILD-OPTIONS.in" template to address this issue.
This has multiple advantages:
- It demonstrates which built options exist in the first place.
- It can serve as a spot to document the build options.
- Some build systems complain when not all variables could be
substituted, alerting us of mismatches. Others don't, but if we
forgot to substitute such variables we now have a bogus string that
will likely cause our tests to fail, if they have any meaning in the
first place.
Backfill values that we didn't yet set in our CMake build instructions.
While at it, remove the `SUPPORTS_SIMPLE_IPC` variable that we only set
up in CMake as it isn't used anywhere.
This change requires us to adapt the setup of TEST_OUTPUT_DIRECTORY in
"test-lib.sh" such that it does not get overwritten after sourcing when
it has been set up via the environment. This is the only instance I
could find where we rely on ordering on variables.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-BUILD-OPTIONS.in | 36 +++++++++++
Makefile | 115 ++++++++++++++----------------------
contrib/buildsystems/CMakeLists.txt | 58 ++++++++++++------
t/test-lib.sh | 22 +++++--
4 files changed, 136 insertions(+), 95 deletions(-)
diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in
new file mode 100644
index 0000000000000000000000000000000000000000..f0ca240493c94aa41a6b6241a8474e42f7cdc8b9
--- /dev/null
+++ b/GIT-BUILD-OPTIONS.in
@@ -0,0 +1,36 @@
+SHELL_PATH=@SHELL_PATH@
+TEST_SHELL_PATH=@TEST_SHELL_PATH@
+PERL_PATH=@PERL_PATH@
+DIFF=@DIFF@
+PYTHON_PATH=@PYTHON_PATH@
+TAR=@TAR@
+NO_CURL=@NO_CURL@
+NO_ICONV=@NO_ICONV@
+NO_EXPAT=@NO_EXPAT@
+USE_LIBPCRE2=@USE_LIBPCRE2@
+NO_PERL=@NO_PERL@
+NO_PTHREADS=@NO_PTHREADS@
+NO_PYTHON=@NO_PYTHON@
+NO_REGEX=@NO_REGEX@
+NO_UNIX_SOCKETS=@NO_UNIX_SOCKETS@
+PAGER_ENV=@PAGER_ENV@
+SANITIZE_LEAK=@SANITIZE_LEAK@
+SANITIZE_ADDRESS=@SANITIZE_ADDRESS@
+X=@X@
+FSMONITOR_DAEMON_BACKEND=@FSMONITOR_DAEMON_BACKEND@
+FSMONITOR_OS_SETTINGS=@FSMONITOR_OS_SETTINGS@
+TEST_OUTPUT_DIRECTORY=@TEST_OUTPUT_DIRECTORY@
+GIT_TEST_OPTS=@GIT_TEST_OPTS@
+GIT_TEST_CMP=@GIT_TEST_CMP@
+GIT_TEST_CMP_USE_COPIED_CONTEXT=@GIT_TEST_CMP_USE_COPIED_CONTEXT@
+GIT_TEST_UTF8_LOCALE=@GIT_TEST_UTF8_LOCALE@
+NO_GETTEXT=@NO_GETTEXT@
+GIT_PERF_REPEAT_COUNT=@GIT_PERF_REPEAT_COUNT@
+GIT_PERF_REPO=@GIT_PERF_REPO@
+GIT_PERF_LARGE_REPO=@GIT_PERF_LARGE_REPO@
+GIT_PERF_MAKE_OPTS=@GIT_PERF_MAKE_OPTS@
+GIT_PERF_MAKE_COMMAND=@GIT_PERF_MAKE_COMMAND@
+GIT_INTEROP_MAKE_OPTS=@GIT_INTEROP_MAKE_OPTS@
+GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@
+GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@
+RUNTIME_PREFIX=@RUNTIME_PREFIX@
diff --git a/Makefile b/Makefile
index 2a7a0c9d107afb230b7324219c67cc1daa248f01..be91a0e44b322f001e98be69f32bc015626c806e 100644
--- a/Makefile
+++ b/Makefile
@@ -3161,80 +3161,55 @@ GIT-LDFLAGS: FORCE
echo "$$FLAGS" >GIT-LDFLAGS; \
fi
+ifdef RUNTIME_PREFIX
+RUNTIME_PREFIX_OPTION = true
+else
+RUNTIME_PREFIX_OPTION = false
+endif
+
# We need to apply sq twice, once to protect from the shell
# that runs GIT-BUILD-OPTIONS, and then again to protect it
# and the first level quoting from the shell that runs "echo".
GIT-BUILD-OPTIONS: FORCE
- @echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@+
- @echo TEST_SHELL_PATH=\''$(subst ','\'',$(TEST_SHELL_PATH_SQ))'\' >>$@+
- @echo PERL_PATH=\''$(subst ','\'',$(PERL_PATH_SQ))'\' >>$@+
- @echo DIFF=\''$(subst ','\'',$(subst ','\'',$(DIFF)))'\' >>$@+
- @echo PYTHON_PATH=\''$(subst ','\'',$(PYTHON_PATH_SQ))'\' >>$@+
- @echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@+
- @echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@+
- @echo NO_ICONV=\''$(subst ','\'',$(subst ','\'',$(NO_ICONV)))'\' >>$@+
- @echo NO_EXPAT=\''$(subst ','\'',$(subst ','\'',$(NO_EXPAT)))'\' >>$@+
- @echo USE_LIBPCRE2=\''$(subst ','\'',$(subst ','\'',$(USE_LIBPCRE2)))'\' >>$@+
- @echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@+
- @echo NO_PTHREADS=\''$(subst ','\'',$(subst ','\'',$(NO_PTHREADS)))'\' >>$@+
- @echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@+
- @echo NO_REGEX=\''$(subst ','\'',$(subst ','\'',$(NO_REGEX)))'\' >>$@+
- @echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@+
- @echo PAGER_ENV=\''$(subst ','\'',$(subst ','\'',$(PAGER_ENV)))'\' >>$@+
- @echo SANITIZE_LEAK=\''$(subst ','\'',$(subst ','\'',$(SANITIZE_LEAK)))'\' >>$@+
- @echo SANITIZE_ADDRESS=\''$(subst ','\'',$(subst ','\'',$(SANITIZE_ADDRESS)))'\' >>$@+
- @echo X=\'$(X)\' >>$@+
-ifdef FSMONITOR_DAEMON_BACKEND
- @echo FSMONITOR_DAEMON_BACKEND=\''$(subst ','\'',$(subst ','\'',$(FSMONITOR_DAEMON_BACKEND)))'\' >>$@+
-endif
-ifdef FSMONITOR_OS_SETTINGS
- @echo FSMONITOR_OS_SETTINGS=\''$(subst ','\'',$(subst ','\'',$(FSMONITOR_OS_SETTINGS)))'\' >>$@+
-endif
-ifdef TEST_OUTPUT_DIRECTORY
- @echo TEST_OUTPUT_DIRECTORY=\''$(subst ','\'',$(subst ','\'',$(TEST_OUTPUT_DIRECTORY)))'\' >>$@+
-endif
-ifdef GIT_TEST_OPTS
- @echo GIT_TEST_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_OPTS)))'\' >>$@+
-endif
-ifdef GIT_TEST_CMP
- @echo GIT_TEST_CMP=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_CMP)))'\' >>$@+
-endif
-ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
- @echo GIT_TEST_CMP_USE_COPIED_CONTEXT=YesPlease >>$@+
-endif
-ifdef GIT_TEST_UTF8_LOCALE
- @echo GIT_TEST_UTF8_LOCALE=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_UTF8_LOCALE)))'\' >>$@+
-endif
- @echo NO_GETTEXT=\''$(subst ','\'',$(subst ','\'',$(NO_GETTEXT)))'\' >>$@+
-ifdef GIT_PERF_REPEAT_COUNT
- @echo GIT_PERF_REPEAT_COUNT=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPEAT_COUNT)))'\' >>$@+
-endif
-ifdef GIT_PERF_REPO
- @echo GIT_PERF_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPO)))'\' >>$@+
-endif
-ifdef GIT_PERF_LARGE_REPO
- @echo GIT_PERF_LARGE_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_LARGE_REPO)))'\' >>$@+
-endif
-ifdef GIT_PERF_MAKE_OPTS
- @echo GIT_PERF_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_OPTS)))'\' >>$@+
-endif
-ifdef GIT_PERF_MAKE_COMMAND
- @echo GIT_PERF_MAKE_COMMAND=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_COMMAND)))'\' >>$@+
-endif
-ifdef GIT_INTEROP_MAKE_OPTS
- @echo GIT_INTEROP_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_INTEROP_MAKE_OPTS)))'\' >>$@+
-endif
-ifdef GIT_TEST_INDEX_VERSION
- @echo GIT_TEST_INDEX_VERSION=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_INDEX_VERSION)))'\' >>$@+
-endif
-ifdef GIT_TEST_PERL_FATAL_WARNINGS
- @echo GIT_TEST_PERL_FATAL_WARNINGS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_PERL_FATAL_WARNINGS)))'\' >>$@+
-endif
-ifdef RUNTIME_PREFIX
- @echo RUNTIME_PREFIX=\'true\' >>$@+
-else
- @echo RUNTIME_PREFIX=\'false\' >>$@+
-endif
+ @sed \
+ -e "s|@SHELL_PATH@|\'$(SHELL_PATH_SQ)\'|" \
+ -e "s|@TEST_SHELL_PATH@|\'$(TEST_SHELL_PATH_SQ)\'|" \
+ -e "s|@PERL_PATH@|\'$(PERL_PATH_SQ)\'|" \
+ -e "s|@DIFF@|\'$(DIFF)\'|" \
+ -e "s|@PYTHON_PATH@|\'$(PYTHON_PATH_SQ)\'|" \
+ -e "s|@TAR@|\'$(TAR)\'|" \
+ -e "s|@NO_CURL@|\'$(NO_CURL)\'|" \
+ -e "s|@NO_ICONV@|\'$(NO_ICONV)\'|" \
+ -e "s|@NO_EXPAT@|\'$(NO_EXPAT)\'|" \
+ -e "s|@USE_LIBPCRE2@|\'$(USE_LIBPCRE2)\'|" \
+ -e "s|@NO_PERL@|\'$(NO_PERL)\'|" \
+ -e "s|@NO_PTHREADS@|\'$(NO_PTHREADS)\'|" \
+ -e "s|@NO_PYTHON@|\'$(NO_PYTHON)\'|" \
+ -e "s|@NO_REGEX@|\'$(NO_REGEX)\'|" \
+ -e "s|@NO_UNIX_SOCKETS@|\'$(NO_UNIX_SOCKETS)\'|" \
+ -e "s|@PAGER_ENV@|\'$(PAGER_ENV)\'|" \
+ -e "s|@SANITIZE_LEAK@|\'$(SANITIZE_LEAK)\'|" \
+ -e "s|@SANITIZE_ADDRESS@|\'$(SANITIZE_ADDRESS)\'|" \
+ -e "s|@X@|\'$(X)\'|" \
+ -e "s|@FSMONITOR_DAEMON_BACKEND@|\'$(FSMONITOR_DAEMON_BACKEND)\'|" \
+ -e "s|@FSMONITOR_OS_SETTINGS@|\'$(FSMONITOR_OS_SETTINGS)\'|" \
+ -e "s|@TEST_OUTPUT_DIRECTORY@|\'$(TEST_OUTPUT_DIRECTORY)\'|" \
+ -e "s|@GIT_TEST_OPTS@|\'$(GIT_TEST_OPTS)\'|" \
+ -e "s|@GIT_TEST_CMP@|\'$(GIT_TEST_CMP)\'|" \
+ -e "s|@GIT_TEST_CMP_USE_COPIED_CONTEXT@|\'$(GIT_TEST_CMP_USE_COPIED_CONTEXT)\'|" \
+ -e "s|@GIT_TEST_UTF8_LOCALE@|\'$(GIT_TEST_UTF8_LOCALE)\'|" \
+ -e "s|@NO_GETTEXT@|\'$(NO_GETTEXT)\'|" \
+ -e "s|@GIT_PERF_REPEAT_COUNT@|\'$(GIT_PERF_REPEAT_COUNT)\'|" \
+ -e "s|@GIT_PERF_REPO@|\'$(GIT_PERF_REPO)\'|" \
+ -e "s|@GIT_PERF_LARGE_REPO@|\'$(GIT_PERF_LARGE_REPO)\'|" \
+ -e "s|@GIT_PERF_MAKE_OPTS@|\'$(GIT_PERF_MAKE_OPTS)\'|" \
+ -e "s|@GIT_PERF_MAKE_COMMAND@|\'$(GIT_PERF_MAKE_COMMAND)\'|" \
+ -e "s|@GIT_INTEROP_MAKE_OPTS@|\'$(GIT_INTEROP_MAKE_OPTS)\'|" \
+ -e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \
+ -e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \
+ -e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX_OPTION)\'|" \
+ GIT-BUILD-OPTIONS.in >$@+
+ @if grep -q '^[A-Z][A-Z_]*=@.*@$$' $@+; then echo "Unsubstituted build options in $@" >&2 && exit 1; fi
@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
@if test -f GIT-BUILD-DIR; then rm GIT-BUILD-DIR; fi
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 8c71f5a1d0290c9204e094fb266f10c7b70af9fb..985004f5943128483e2138cd61aca8bd8ccbd240 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -1125,27 +1125,47 @@ if(NOT PYTHON_TESTS)
set(NO_PYTHON 1)
endif()
-file(WRITE ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "SHELL_PATH='${SHELL_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "TEST_SHELL_PATH='${TEST_SHELL_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PERL_PATH='${PERL_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "DIFF='${DIFF}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PYTHON_PATH='${PYTHON_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "TAR='${TAR}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_CURL='${NO_CURL}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_ICONV='${NO_ICONV}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_EXPAT='${NO_EXPAT}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PERL='${NO_PERL}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PTHREADS='${NO_PTHREADS}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_UNIX_SOCKETS='${NO_UNIX_SOCKETS}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PAGER_ENV='${PAGER_ENV}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "X='${EXE_EXTENSION}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_GETTEXT='${NO_GETTEXT}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "RUNTIME_PREFIX='${RUNTIME_PREFIX}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PYTHON='${NO_PYTHON}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "SUPPORTS_SIMPLE_IPC='${SUPPORTS_SIMPLE_IPC}'\n")
+file(STRINGS ${CMAKE_SOURCE_DIR}/GIT-BUILD-OPTIONS.in git_build_options NEWLINE_CONSUME)
+string(REPLACE "@SHELL_PATH@" "'${SHELL_PATH}'" git_build_options "${git_build_options}")
+string(REPLACE "@TEST_SHELL_PATH@" "'${TEST_SHELL_PATH}'" git_build_options "${git_build_options}")
+string(REPLACE "@PERL_PATH@" "'${PERL_PATH}'" git_build_options "${git_build_options}")
+string(REPLACE "@DIFF@" "'${DIFF}'" git_build_options "${git_build_options}")
+string(REPLACE "@PYTHON_PATH@" "'${PYTHON_PATH}'" git_build_options "${git_build_options}")
+string(REPLACE "@TAR@" "'${TAR}'" git_build_options "${git_build_options}")
+string(REPLACE "@NO_CURL@" "${NO_CURL}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_ICONV@" "${NO_ICONV}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_EXPAT@" "${NO_EXPAT}" git_build_options "${git_build_options}")
+string(REPLACE "@USE_LIBPCRE2@" "" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PERL@" "${NO_PERL}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PTHREADS@" "${NO_PTHREADS}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PYTHON@" "${NO_PYTHON}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_REGEX@" "" git_build_options "${git_build_options}")
+string(REPLACE "@NO_UNIX_SOCKETS@" "${NO_UNIX_SOCKETS}" git_build_options "${git_build_options}")
+string(REPLACE "@PAGER_ENV@" "'${PAGER_ENV}'" git_build_options "${git_build_options}")
+string(REPLACE "@SANITIZE_LEAK@" "" git_build_options "${git_build_options}")
+string(REPLACE "@SANITIZE_ADDRESS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@X@" "${EXE_EXTENSION}" git_build_options "${git_build_options}")
+string(REPLACE "@FSMONITOR_DAEMON_BACKEND@" "win32" git_build_options "${git_build_options}")
+string(REPLACE "@FSMONITOR_OS_SETTINGS@" "win32" git_build_options "${git_build_options}")
+string(REPLACE "@TEST_OUTPUT_DIRECTORY@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_OPTS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_CMP@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_CMP_USE_COPIED_CONTEXT@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_UTF8_LOCALE@" "" git_build_options "${git_build_options}")
+string(REPLACE "@NO_GETTEXT@" "${NO_GETTEXT}" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_REPEAT_COUNT@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_REPO@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_LARGE_REPO@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_MAKE_OPTS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_MAKE_COMMAND@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@RUNTIME_PREFIX@" "'${RUNTIME_PREFIX}'" git_build_options "${git_build_options}")
if(USE_VCPKG)
- file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
+ string(APPEND git_build_options "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
endif()
+file(WRITE ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS ${git_build_options})
#Make the tests work when building out of the source tree
get_filename_component(CACHE_PATH ${CMAKE_CURRENT_LIST_DIR}/../../CMakeCache.txt ABSOLUTE)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 426036b33aefcdb6f2a3848583d2ba441c9257d8..20012f6f474c96afdcf66a240dd6b6b573073e46 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -35,12 +35,6 @@ else
# needing to exist.
TEST_DIRECTORY=$(cd "$TEST_DIRECTORY" && pwd) || exit 1
fi
-if test -z "$TEST_OUTPUT_DIRECTORY"
-then
- # Similarly, override this to store the test-results subdir
- # elsewhere
- TEST_OUTPUT_DIRECTORY=$TEST_DIRECTORY
-fi
GIT_BUILD_DIR="${TEST_DIRECTORY%/t}"
if test "$TEST_DIRECTORY" = "$GIT_BUILD_DIR"
then
@@ -92,6 +86,15 @@ export LSAN_OPTIONS
prepend_var UBSAN_OPTIONS : $GIT_SAN_OPTIONS
export UBSAN_OPTIONS
+# The TEST_OUTPUT_DIRECTORY will be overwritten via GIT-BUILD-OPTIONS. So in
+# case the caller has manually set up this variable via the environment we must
+# make sure to not overwrite that value, and thus we save it into
+# TEST_OUTPUT_DIRECTORY_OVERRIDE here.
+if test -n "$TEST_OUTPUT_DIRECTORY" && test -z "$TEST_OUTPUT_DIRECTORY_OVERRIDE"
+then
+ TEST_OUTPUT_DIRECTORY_OVERRIDE=$TEST_OUTPUT_DIRECTORY
+fi
+
if test ! -f "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
then
echo >&2 'error: GIT-BUILD-OPTIONS missing (has Git been built?).'
@@ -100,6 +103,13 @@ fi
. "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
export PERL_PATH SHELL_PATH
+if test -z "$TEST_OUTPUT_DIRECTORY"
+then
+ # Similarly, override this to store the test-results subdir
+ # elsewhere
+ TEST_OUTPUT_DIRECTORY=$TEST_DIRECTORY
+fi
+
# In t0000, we need to override test directories of nested testcases. In case
# the developer has TEST_OUTPUT_DIRECTORY part of his build options, then we'd
# reset this value to instead contain what the developer has specified. We thus
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v11 02/26] Makefile: consistently use @PLACEHOLDER@ to substitute
2024-12-06 13:24 ` [PATCH v11 00/26] Modernize the build system Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 01/26] Makefile: use common template for GIT-BUILD-OPTIONS Patrick Steinhardt
@ 2024-12-06 13:24 ` Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 03/26] Makefile: refactor GIT-VERSION-GEN to be reusable Patrick Steinhardt
` (23 subsequent siblings)
25 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-12-06 13:24 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
We have a bunch of placeholders in our scripts that we replace at build
time, for example by using sed(1). These placeholders come in three
different formats: @PLACEHOLDER@, @@PLACEHOLDER@@ and ++PLACEHOLDER++.
Next to being inconsistent it also creates a bit of a problem with
CMake, which only supports the first syntax in its `configure_file()`
function. To work around that we instead manually replace placeholders
via string operations, which is a hassle and removes safeguards that
CMake has to verify that we didn't forget to replace any placeholders.
Besides that, other build systems like Meson also support the CMake
syntax.
Unify our codebase to consistently use the syntax supported by such
build systems.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 44 ++++++++++++------------
configure.ac | 2 +-
contrib/buildsystems/CMakeLists.txt | 34 +++++++++---------
git-cvsserver.perl | 2 +-
git-instaweb.sh | 8 ++---
git-request-pull.sh | 2 +-
git-send-email.perl | 2 +-
git-sh-i18n.sh | 6 ++--
git-sh-setup.sh | 6 ++--
git-svn.perl | 2 +-
gitweb/Makefile | 44 ++++++++++++------------
gitweb/gitweb.perl | 44 ++++++++++++------------
perl/Git/I18N.pm | 6 ++--
perl/Git/LoadCPAN.pm | 6 ++--
| 2 +-
| 8 ++---
unimplemented.sh | 2 +-
wrap-for-bin.sh | 18 +++++-----
18 files changed, 119 insertions(+), 119 deletions(-)
diff --git a/Makefile b/Makefile
index be91a0e44b322f001e98be69f32bc015626c806e..45c38088535fbb10fae7ea17eda44bd6fb6c91aa 100644
--- a/Makefile
+++ b/Makefile
@@ -1555,10 +1555,10 @@ endif
ifdef SANE_TOOL_PATH
SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH))
-BROKEN_PATH_FIX = 's|^\# @@BROKEN_PATH_FIX@@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|'
+BROKEN_PATH_FIX = 's|^\# @BROKEN_PATH_FIX@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|'
PATH := $(SANE_TOOL_PATH):${PATH}
else
-BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d'
+BROKEN_PATH_FIX = '/^\# @BROKEN_PATH_FIX@$$/d'
endif
ifeq (,$(HOST_CPU))
@@ -2548,13 +2548,13 @@ GIT-SCRIPT-DEFINES: FORCE
define cmd_munge_script
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
- -e 's|@@DIFF@@|$(DIFF_SQ)|' \
- -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' \
- -e 's/@@USE_GETTEXT_SCHEME@@/$(USE_GETTEXT_SCHEME)/g' \
+ -e 's|@DIFF@|$(DIFF_SQ)|' \
+ -e 's|@LOCALEDIR@|$(localedir_SQ)|g' \
+ -e 's/@USE_GETTEXT_SCHEME@/$(USE_GETTEXT_SCHEME)/g' \
-e $(BROKEN_PATH_FIX) \
- -e 's|@@GITWEBDIR@@|$(gitwebdir_SQ)|g' \
- -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
- -e 's|@@PAGER_ENV@@|$(PAGER_ENV_SQ)|g' \
+ -e 's|@GITWEBDIR@|$(gitwebdir_SQ)|g' \
+ -e 's|@PERL@|$(PERL_PATH_SQ)|g' \
+ -e 's|@PAGER_ENV@|$(PAGER_ENV_SQ)|g' \
$@.sh >$@+
endef
@@ -2611,7 +2611,7 @@ $(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
-e ' r GIT-PERL-HEADER' \
-e ' G' \
-e '}' \
- -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
+ -e 's/@GIT_VERSION@/$(GIT_VERSION)/g' \
$< >$@+ && \
chmod +x $@+ && \
mv $@+ $@
@@ -2629,11 +2629,11 @@ GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile
INSTLIBDIR='$(perllibdir_SQ)' && \
INSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \
INSTLIBDIR="$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}" && \
- sed -e 's=@@PATHSEP@@=$(pathsep)=g' \
- -e "s=@@INSTLIBDIR@@=$$INSTLIBDIR=g" \
- -e 's=@@PERLLIBDIR_REL@@=$(perllibdir_relative_SQ)=g' \
- -e 's=@@GITEXECDIR_REL@@=$(gitexecdir_relative_SQ)=g' \
- -e 's=@@LOCALEDIR_REL@@=$(localedir_relative_SQ)=g' \
+ sed -e 's=@PATHSEP@=$(pathsep)=g' \
+ -e "s=@INSTLIBDIR@=$$INSTLIBDIR=g" \
+ -e 's=@PERLLIBDIR_REL@=$(perllibdir_relative_SQ)=g' \
+ -e 's=@GITEXECDIR_REL@=$(gitexecdir_relative_SQ)=g' \
+ -e 's=@LOCALEDIR_REL@=$(localedir_relative_SQ)=g' \
$< >$@+ && \
mv $@+ $@
@@ -2649,7 +2649,7 @@ else # NO_PERL
$(SCRIPT_PERL_GEN) git-instaweb: % : unimplemented.sh
$(QUIET_GEN) \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@@REASON@@|NO_PERL=$(NO_PERL)|g' \
+ -e 's|@REASON@|NO_PERL=$(NO_PERL)|g' \
unimplemented.sh >$@+ && \
chmod +x $@+ && \
mv $@+ $@
@@ -2670,13 +2670,13 @@ else # NO_PYTHON
$(SCRIPT_PYTHON_GEN): % : unimplemented.sh
$(QUIET_GEN) \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@@REASON@@|NO_PYTHON=$(NO_PYTHON)|g' \
+ -e 's|@REASON@|NO_PYTHON=$(NO_PYTHON)|g' \
unimplemented.sh >$@+ && \
chmod +x $@+ && \
mv $@+ $@
endif # NO_PYTHON
-CONFIGURE_RECIPE = sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
+CONFIGURE_RECIPE = sed -e 's/@GIT_VERSION@/$(GIT_VERSION)/g' \
configure.ac >configure.ac+ && \
autoconf -o configure configure.ac+ && \
$(RM) configure.ac+
@@ -3105,9 +3105,9 @@ endif
perl/build/lib/%.pm: perl/%.pm GIT-PERL-DEFINES
$(call mkdir_p_parent_template)
$(QUIET_GEN) \
- sed -e 's|@@LOCALEDIR@@|$(perl_localedir_SQ)|g' \
- -e 's|@@NO_GETTEXT@@|$(NO_GETTEXT_SQ)|g' \
- -e 's|@@NO_PERL_CPAN_FALLBACKS@@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \
+ sed -e 's|@LOCALEDIR@|$(perl_localedir_SQ)|g' \
+ -e 's|@NO_GETTEXT@|$(NO_GETTEXT_SQ)|g' \
+ -e 's|@NO_PERL_CPAN_FALLBACKS@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \
< $< > $@
perl/build/man/man3/Git.3pm: perl/Git.pm
@@ -3232,8 +3232,8 @@ all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PR
bin-wrappers/%: wrap-for-bin.sh
$(call mkdir_p_parent_template)
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@@BUILD_DIR@@|$(shell pwd)|' \
- -e 's|@@PROG@@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
+ -e 's|@BUILD_DIR@|$(shell pwd)|' \
+ -e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
chmod +x $@
# GNU make supports exporting all variables by "export" without parameters.
diff --git a/configure.ac b/configure.ac
index d1a96da14eb56766e1538da80ab97ed8a99b24f6..5923edc44aa7b6cc355fa6589b6d075b0c0a7772 100644
--- a/configure.ac
+++ b/configure.ac
@@ -142,7 +142,7 @@ fi
## Configure body starts here.
AC_PREREQ(2.59)
-AC_INIT([git], [@@GIT_VERSION@@], [git@vger.kernel.org])
+AC_INIT([git], [@GIT_VERSION@], [git@vger.kernel.org])
AC_CONFIG_SRCDIR([git.c])
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 985004f5943128483e2138cd61aca8bd8ccbd240..1abf5f099c1c6735ae7aec345de96bf623e2aa18 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -836,14 +836,14 @@ set(git_shell_scripts
foreach(script ${git_shell_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.sh content NEWLINE_CONSUME)
string(REPLACE "@SHELL_PATH@" "${SHELL_PATH}" content "${content}")
- string(REPLACE "@@DIFF@@" "diff" content "${content}")
+ string(REPLACE "@DIFF@" "diff" content "${content}")
string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}")
string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" content "${content}")
- string(REPLACE "@@NO_CURL@@" "" content "${content}")
- string(REPLACE "@@USE_GETTEXT_SCHEME@@" "" content "${content}")
- string(REPLACE "# @@BROKEN_PATH_FIX@@" "" content "${content}")
- string(REPLACE "@@PERL@@" "${PERL_PATH}" content "${content}")
- string(REPLACE "@@PAGER_ENV@@" "LESS=FRX LV=-c" content "${content}")
+ string(REPLACE "@NO_CURL@" "" content "${content}")
+ string(REPLACE "@USE_GETTEXT_SCHEME@" "" content "${content}")
+ string(REPLACE "# @BROKEN_PATH_FIX@" "" content "${content}")
+ string(REPLACE "@PERL@" "${PERL_PATH}" content "${content}")
+ string(REPLACE "@PAGER_ENV@" "LESS=FRX LV=-c" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
endforeach()
@@ -852,13 +852,13 @@ parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" ".perl")
#create perl header
file(STRINGS ${CMAKE_SOURCE_DIR}/perl/header_templates/fixed_prefix.template.pl perl_header )
-string(REPLACE "@@PATHSEP@@" ":" perl_header "${perl_header}")
-string(REPLACE "@@INSTLIBDIR@@" "${INSTLIBDIR}" perl_header "${perl_header}")
+string(REPLACE "@PATHSEP@" ":" perl_header "${perl_header}")
+string(REPLACE "@INSTLIBDIR@" "${INSTLIBDIR}" perl_header "${perl_header}")
foreach(script ${git_perl_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.perl content NEWLINE_CONSUME)
string(REPLACE "#!/usr/bin/perl" "#!/usr/bin/perl\n${perl_header}\n" content "${content}")
- string(REPLACE "@@GIT_VERSION@@" "${PROJECT_VERSION}" content "${content}")
+ string(REPLACE "@GIT_VERSION@" "${PROJECT_VERSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
endforeach()
@@ -873,8 +873,8 @@ file(GLOB_RECURSE perl_modules "${CMAKE_SOURCE_DIR}/perl/*.pm")
foreach(pm ${perl_modules})
string(REPLACE "${CMAKE_SOURCE_DIR}/perl/" "" file_path ${pm})
file(STRINGS ${pm} content NEWLINE_CONSUME)
- string(REPLACE "@@LOCALEDIR@@" "${LOCALEDIR}" content "${content}")
- string(REPLACE "@@NO_PERL_CPAN_FALLBACKS@@" "" content "${content}")
+ string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}")
+ string(REPLACE "@NO_PERL_CPAN_FALLBACKS@" "" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/perl/build/lib/${file_path} ${content})
#test-lib.sh requires perl/build/lib to be the build directory of perl modules
endforeach()
@@ -1064,21 +1064,21 @@ set(wrapper_test_scripts
foreach(script ${wrapper_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
- string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
- string(REPLACE "@@PROG@@" "${script}${EXE_EXTENSION}" content "${content}")
+ string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+ string(REPLACE "@PROG@" "${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
foreach(script ${wrapper_test_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
- string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
- string(REPLACE "@@PROG@@" "t/helper/${script}${EXE_EXTENSION}" content "${content}")
+ string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+ string(REPLACE "@PROG@" "t/helper/${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
-string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
-string(REPLACE "@@PROG@@" "git-cvsserver" content "${content}")
+string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+string(REPLACE "@PROG@" "git-cvsserver" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})
#options for configuring test options
diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index a4ad9a5d2db9e99ae0c4a5f26524ef344543aaa3..a4e1bad33ca2a3d4d6704b8d781a58be623b1100 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -26,7 +26,7 @@
use File::Basename;
use Getopt::Long qw(:config require_order no_ignore_case);
-my $VERSION = '@@GIT_VERSION@@';
+my $VERSION = '@GIT_VERSION@';
my $log = GITCVS::log->new();
my $cfg;
diff --git a/git-instaweb.sh b/git-instaweb.sh
index 8dbe21d5887595352bc0159ea9befdf296b8105f..c8efb1205a8e2a66a6aced840980978897e122bc 100755
--- a/git-instaweb.sh
+++ b/git-instaweb.sh
@@ -3,7 +3,7 @@
# Copyright (c) 2006 Eric Wong
#
-PERL='@@PERL@@'
+PERL='@PERL@'
OPTIONS_KEEPDASHDASH=
OPTIONS_STUCKLONG=
OPTIONS_SPEC="\
@@ -38,8 +38,8 @@ conf="$GIT_DIR/gitweb/httpd.conf"
# if installed, it doesn't need further configuration (module_path)
test -z "$httpd" && httpd='lighttpd -f'
-# Default is @@GITWEBDIR@@
-test -z "$root" && root='@@GITWEBDIR@@'
+# Default is @GITWEBDIR@
+test -z "$root" && root='@GITWEBDIR@'
# any untaken local port will do...
test -z "$port" && port=1234
@@ -716,7 +716,7 @@ EOF
gitweb_conf() {
cat > "$fqgitdir/gitweb/gitweb_config.perl" <<EOF
-#!@@PERL@@
+#!@PERL@
our \$projectroot = "$(dirname "$fqgitdir")";
our \$git_temp = "$fqgitdir/gitweb/tmp";
our \$projects_list = \$projectroot;
diff --git a/git-request-pull.sh b/git-request-pull.sh
index 01640a044bb10f4167338fca957c43a240e1b6c0..10c88639e28c02650ffea3d4671afa9a9f0bb182 100755
--- a/git-request-pull.sh
+++ b/git-request-pull.sh
@@ -112,7 +112,7 @@ find_matching_ref='
}
'
-set fnord $(git ls-remote "$url" | @@PERL@@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
+set fnord $(git ls-remote "$url" | @PERL@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
remote_sha1=$2
ref=$3
diff --git a/git-send-email.perl b/git-send-email.perl
index c4d12bebc8f7ed1f40c886656af2e294790fab45..798d59b84f1d6068261d65329ab4dde9b6ff8145 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1501,7 +1501,7 @@ sub gen_header {
@recipients = unique_email_list(@recipients,@cc,@initial_bcc);
@recipients = (map { extract_valid_address_or_die($_) } @recipients);
my $date = format_2822_time($time++);
- my $gitversion = '@@GIT_VERSION@@';
+ my $gitversion = '@GIT_VERSION@';
if ($gitversion =~ m/..GIT_VERSION../) {
$gitversion = Git::version();
}
diff --git a/git-sh-i18n.sh b/git-sh-i18n.sh
index a15c0620db6893898152b1c9e363a0af7f1b304e..ae4b2d6ba9dc061ef40ef1867f0cd5e975df8fe5 100644
--- a/git-sh-i18n.sh
+++ b/git-sh-i18n.sh
@@ -9,7 +9,7 @@ TEXTDOMAIN=git
export TEXTDOMAIN
if test -z "$GIT_TEXTDOMAINDIR"
then
- TEXTDOMAINDIR="@@LOCALEDIR@@"
+ TEXTDOMAINDIR="@LOCALEDIR@"
else
TEXTDOMAINDIR="$GIT_TEXTDOMAINDIR"
fi
@@ -17,9 +17,9 @@ export TEXTDOMAINDIR
# First decide what scheme to use...
GIT_INTERNAL_GETTEXT_SH_SCHEME=fallthrough
-if test -n "@@USE_GETTEXT_SCHEME@@"
+if test -n "@USE_GETTEXT_SCHEME@"
then
- GIT_INTERNAL_GETTEXT_SH_SCHEME="@@USE_GETTEXT_SCHEME@@"
+ GIT_INTERNAL_GETTEXT_SH_SCHEME="@USE_GETTEXT_SCHEME@"
elif test -n "$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS"
then
: no probing necessary
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index ce273fe0e48d997cb067e77707026616a9302eb2..19aef72ec2553027bb25a5968d4e428ba986fdb2 100644
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -41,7 +41,7 @@ git_broken_path_fix () {
esac
}
-# @@BROKEN_PATH_FIX@@
+# @BROKEN_PATH_FIX@
# Source git-sh-i18n for gettext support.
. "$(git --exec-path)/git-sh-i18n"
@@ -154,7 +154,7 @@ git_pager() {
else
GIT_PAGER=cat
fi
- for vardef in @@PAGER_ENV@@
+ for vardef in @PAGER_ENV@
do
var=${vardef%%=*}
eval ": \"\${$vardef}\" && export $var"
@@ -280,7 +280,7 @@ get_author_ident_from_commit () {
# remove lines from $1 that are not in $2, leaving only common lines.
create_virtual_base() {
sz0=$(wc -c <"$1")
- @@DIFF@@ -u -La/"$1" -Lb/"$1" "$1" "$2" | git apply --no-add
+ @DIFF@ -u -La/"$1" -Lb/"$1" "$1" "$2" | git apply --no-add
sz1=$(wc -c <"$1")
# If we do not have enough common material, it is not
diff --git a/git-svn.perl b/git-svn.perl
index 9c7c62993245fae5e6c95cfe4d231477795b9610..32c648c3956fa466491e21053ec56014b4284d92 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -9,7 +9,7 @@
$_revision $_repository
$_q $_authors $_authors_prog %users/;
$AUTHOR = 'Eric Wong <normalperson@yhbt.net>';
-$VERSION = '@@GIT_VERSION@@';
+$VERSION = '@GIT_VERSION@';
use Carp qw/croak/;
use File::Basename qw/dirname basename/;
diff --git a/gitweb/Makefile b/gitweb/Makefile
index 3b68ab2d672c4afae62f8f4dc024e0911027b58d..164c8d53757f98599ad14eeb22ca8d542eb7502a 100644
--- a/gitweb/Makefile
+++ b/gitweb/Makefile
@@ -79,28 +79,28 @@ GITWEB_JSLIB_FILES += static/js/blame_incremental.js
GITWEB_REPLACE = \
- -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
- -e 's|++GIT_BINDIR++|$(bindir)|g' \
- -e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \
- -e 's|++GITWEB_CONFIG_SYSTEM++|$(GITWEB_CONFIG_SYSTEM)|g' \
- -e 's|++GITWEB_CONFIG_COMMON++|$(GITWEB_CONFIG_COMMON)|g' \
- -e 's|++GITWEB_HOME_LINK_STR++|$(GITWEB_HOME_LINK_STR)|g' \
- -e 's|++GITWEB_SITENAME++|$(GITWEB_SITENAME)|g' \
- -e 's|++GITWEB_PROJECTROOT++|$(GITWEB_PROJECTROOT)|g' \
- -e 's|"++GITWEB_PROJECT_MAXDEPTH++"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
- -e 's|++GITWEB_EXPORT_OK++|$(GITWEB_EXPORT_OK)|g' \
- -e 's|++GITWEB_STRICT_EXPORT++|$(GITWEB_STRICT_EXPORT)|g' \
- -e 's|++GITWEB_BASE_URL++|$(GITWEB_BASE_URL)|g' \
- -e 's|++GITWEB_LIST++|$(GITWEB_LIST)|g' \
- -e 's|++GITWEB_HOMETEXT++|$(GITWEB_HOMETEXT)|g' \
- -e 's|++GITWEB_CSS++|$(GITWEB_CSS)|g' \
- -e 's|++GITWEB_LOGO++|$(GITWEB_LOGO)|g' \
- -e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \
- -e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \
- -e 's|++GITWEB_SITE_HTML_HEAD_STRING++|$(GITWEB_SITE_HTML_HEAD_STRING)|g' \
- -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \
- -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \
- -e 's|++HIGHLIGHT_BIN++|$(HIGHLIGHT_BIN)|g'
+ -e 's|@GIT_VERSION@|$(GIT_VERSION)|g' \
+ -e 's|@GIT_BINDIR@|$(bindir)|g' \
+ -e 's|@GITWEB_CONFIG@|$(GITWEB_CONFIG)|g' \
+ -e 's|@GITWEB_CONFIG_SYSTEM@|$(GITWEB_CONFIG_SYSTEM)|g' \
+ -e 's|@GITWEB_CONFIG_COMMON@|$(GITWEB_CONFIG_COMMON)|g' \
+ -e 's|@GITWEB_HOME_LINK_STR@|$(GITWEB_HOME_LINK_STR)|g' \
+ -e 's|@GITWEB_SITENAME@|$(GITWEB_SITENAME)|g' \
+ -e 's|@GITWEB_PROJECTROOT@|$(GITWEB_PROJECTROOT)|g' \
+ -e 's|"@GITWEB_PROJECT_MAXDEPTH@"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
+ -e 's|@GITWEB_EXPORT_OK@|$(GITWEB_EXPORT_OK)|g' \
+ -e 's|@GITWEB_STRICT_EXPORT@|$(GITWEB_STRICT_EXPORT)|g' \
+ -e 's|@GITWEB_BASE_URL@|$(GITWEB_BASE_URL)|g' \
+ -e 's|@GITWEB_LIST@|$(GITWEB_LIST)|g' \
+ -e 's|@GITWEB_HOMETEXT@|$(GITWEB_HOMETEXT)|g' \
+ -e 's|@GITWEB_CSS@|$(GITWEB_CSS)|g' \
+ -e 's|@GITWEB_LOGO@|$(GITWEB_LOGO)|g' \
+ -e 's|@GITWEB_FAVICON@|$(GITWEB_FAVICON)|g' \
+ -e 's|@GITWEB_JS@|$(GITWEB_JS)|g' \
+ -e 's|@GITWEB_SITE_HTML_HEAD_STRING@|$(GITWEB_SITE_HTML_HEAD_STRING)|g' \
+ -e 's|@GITWEB_SITE_HEADER@|$(GITWEB_SITE_HEADER)|g' \
+ -e 's|@GITWEB_SITE_FOOTER@|$(GITWEB_SITE_FOOTER)|g' \
+ -e 's|@HIGHLIGHT_BIN@|$(HIGHLIGHT_BIN)|g'
.PHONY: FORCE
$(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS: FORCE
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index c4e0008d597dc07c1043074c9fd1db0bd35653d2..dfb66fdd2aaf4df7d8aec4c70167bad6b0fee5e9 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -35,7 +35,7 @@ BEGIN
CGI->compile() if $ENV{'MOD_PERL'};
}
-our $version = "++GIT_VERSION++";
+our $version = "@GIT_VERSION@";
our ($my_url, $my_uri, $base_url, $path_info, $home_link);
sub evaluate_uri {
@@ -80,46 +80,46 @@ sub evaluate_uri {
# core git executable to use
# this can just be "git" if your webserver has a sensible PATH
-our $GIT = "++GIT_BINDIR++/git";
+our $GIT = "@GIT_BINDIR@/git";
# absolute fs-path which will be prepended to the project path
#our $projectroot = "/pub/scm";
-our $projectroot = "++GITWEB_PROJECTROOT++";
+our $projectroot = "@GITWEB_PROJECTROOT@";
# fs traversing limit for getting project list
# the number is relative to the projectroot
-our $project_maxdepth = "++GITWEB_PROJECT_MAXDEPTH++";
+our $project_maxdepth = "@GITWEB_PROJECT_MAXDEPTH@";
# string of the home link on top of all pages
-our $home_link_str = "++GITWEB_HOME_LINK_STR++";
+our $home_link_str = "@GITWEB_HOME_LINK_STR@";
# extra breadcrumbs preceding the home link
our @extra_breadcrumbs = ();
# name of your site or organization to appear in page titles
# replace this with something more descriptive for clearer bookmarks
-our $site_name = "++GITWEB_SITENAME++"
+our $site_name = "@GITWEB_SITENAME@"
|| ($ENV{'SERVER_NAME'} || "Untitled") . " Git";
# html snippet to include in the <head> section of each page
-our $site_html_head_string = "++GITWEB_SITE_HTML_HEAD_STRING++";
+our $site_html_head_string = "@GITWEB_SITE_HTML_HEAD_STRING@";
# filename of html text to include at top of each page
-our $site_header = "++GITWEB_SITE_HEADER++";
+our $site_header = "@GITWEB_SITE_HEADER@";
# html text to include at home page
-our $home_text = "++GITWEB_HOMETEXT++";
+our $home_text = "@GITWEB_HOMETEXT@";
# filename of html text to include at bottom of each page
-our $site_footer = "++GITWEB_SITE_FOOTER++";
+our $site_footer = "@GITWEB_SITE_FOOTER@";
# URI of stylesheets
-our @stylesheets = ("++GITWEB_CSS++");
+our @stylesheets = ("@GITWEB_CSS@");
# URI of a single stylesheet, which can be overridden in GITWEB_CONFIG.
our $stylesheet = undef;
# URI of GIT logo (72x27 size)
-our $logo = "++GITWEB_LOGO++";
+our $logo = "@GITWEB_LOGO@";
# URI of GIT favicon, assumed to be image/png type
-our $favicon = "++GITWEB_FAVICON++";
+our $favicon = "@GITWEB_FAVICON@";
# URI of gitweb.js (JavaScript code for gitweb)
-our $javascript = "++GITWEB_JS++";
+our $javascript = "@GITWEB_JS@";
# URI and label (title) of GIT logo link
#our $logo_url = "https://www.kernel.org/pub/software/scm/git/docs/";
@@ -128,7 +128,7 @@ sub evaluate_uri {
our $logo_label = "git homepage";
# source of projects list
-our $projects_list = "++GITWEB_LIST++";
+our $projects_list = "@GITWEB_LIST@";
# the width (in characters) of the projects list "Description" column
our $projects_list_description_width = 25;
@@ -147,7 +147,7 @@ sub evaluate_uri {
# show repository only if this file exists
# (only effective if this variable evaluates to true)
-our $export_ok = "++GITWEB_EXPORT_OK++";
+our $export_ok = "@GITWEB_EXPORT_OK@";
# don't generate age column on the projects list page
our $omit_age_column = 0;
@@ -161,11 +161,11 @@ sub evaluate_uri {
our $export_auth_hook = undef;
# only allow viewing of repositories also shown on the overview page
-our $strict_export = "++GITWEB_STRICT_EXPORT++";
+our $strict_export = "@GITWEB_STRICT_EXPORT@";
# list of git base URLs used for URL to where fetch project from,
# i.e. full URL is "$git_base_url/$project"
-our @git_base_url_list = grep { $_ ne '' } ("++GITWEB_BASE_URL++");
+our @git_base_url_list = grep { $_ ne '' } ("@GITWEB_BASE_URL@");
# default blob_plain mimetype and default charset for text/plain blob
our $default_blob_plain_mimetype = 'text/plain';
@@ -200,7 +200,7 @@ sub evaluate_uri {
# http://andre-simon.de/zip/download.php due to assumptions about parameters and output).
# Useful if highlight is not installed on your webserver's PATH.
# [Default: highlight]
-our $highlight_bin = "++HIGHLIGHT_BIN++";
+our $highlight_bin = "@HIGHLIGHT_BIN@";
# information about snapshot formats that gitweb is capable of serving
our %known_snapshot_formats = (
@@ -741,9 +741,9 @@ sub read_config_file {
our ($GITWEB_CONFIG, $GITWEB_CONFIG_SYSTEM, $GITWEB_CONFIG_COMMON);
sub evaluate_gitweb_config {
- our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "++GITWEB_CONFIG++";
- our $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || "++GITWEB_CONFIG_SYSTEM++";
- our $GITWEB_CONFIG_COMMON = $ENV{'GITWEB_CONFIG_COMMON'} || "++GITWEB_CONFIG_COMMON++";
+ our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "@GITWEB_CONFIG@";
+ our $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || "@GITWEB_CONFIG_SYSTEM@";
+ our $GITWEB_CONFIG_COMMON = $ENV{'GITWEB_CONFIG_COMMON'} || "@GITWEB_CONFIG_COMMON@";
# Protect against duplications of file names, to not read config twice.
# Only one of $GITWEB_CONFIG and $GITWEB_CONFIG_SYSTEM is used, so
diff --git a/perl/Git/I18N.pm b/perl/Git/I18N.pm
index ab46edb608c711d3774ae117e7ab097fc1a156bf..162230af817722c8fe17fb11fcd1acd76add84b7 100644
--- a/perl/Git/I18N.pm
+++ b/perl/Git/I18N.pm
@@ -20,14 +20,14 @@ BEGIN
# this "'@@' [...] '@@'" pattern.
use constant NO_GETTEXT_STR => '@@' . 'NO_GETTEXT' . '@@';
use constant NO_GETTEXT => (
- q[@@NO_GETTEXT@@] ne ''
+ q[@NO_GETTEXT@] ne ''
and
- q[@@NO_GETTEXT@@] ne NO_GETTEXT_STR
+ q[@NO_GETTEXT@] ne NO_GETTEXT_STR
);
sub __bootstrap_locale_messages {
our $TEXTDOMAIN = 'git';
- our $TEXTDOMAINDIR ||= $ENV{GIT_TEXTDOMAINDIR} || '@@LOCALEDIR@@';
+ our $TEXTDOMAINDIR ||= $ENV{GIT_TEXTDOMAINDIR} || '@LOCALEDIR@';
die "NO_GETTEXT=" . NO_GETTEXT_STR if NO_GETTEXT;
require POSIX;
diff --git a/perl/Git/LoadCPAN.pm b/perl/Git/LoadCPAN.pm
index 61254fddbbb5059c52e517b74c76103d6c081426..92d63c71d24b65ff768a35b16a7f12c193d4d0eb 100644
--- a/perl/Git/LoadCPAN.pm
+++ b/perl/Git/LoadCPAN.pm
@@ -31,11 +31,11 @@ =head1 DESCRIPTION
# Makefile, and allows for detecting whether the module is loaded from
# perl/Git as opposed to perl/build/Git, which is useful for one-off
# testing without having Error.pm et al installed.
-use constant NO_PERL_CPAN_FALLBACKS_STR => '@@' . 'NO_PERL_CPAN_FALLBACKS' . '@@';
+use constant NO_PERL_CPAN_FALLBACKS_STR => '@' . 'NO_PERL_CPAN_FALLBACKS' . '@';
use constant NO_PERL_CPAN_FALLBACKS => (
- q[@@NO_PERL_CPAN_FALLBACKS@@] ne ''
+ q[@NO_PERL_CPAN_FALLBACKS@] ne ''
and
- q[@@NO_PERL_CPAN_FALLBACKS@@] ne NO_PERL_CPAN_FALLBACKS_STR
+ q[@NO_PERL_CPAN_FALLBACKS@] ne NO_PERL_CPAN_FALLBACKS_STR
);
sub import {
--git a/perl/header_templates/fixed_prefix.template.pl b/perl/header_templates/fixed_prefix.template.pl
index 857b4391a499394ea788a6b56773aecd5afd53c3..d571ca5cde513a98cc25e7acb52b5415b98ffe10 100644
--- a/perl/header_templates/fixed_prefix.template.pl
+++ b/perl/header_templates/fixed_prefix.template.pl
@@ -1 +1 @@
-use lib (split(/@@PATHSEP@@/, $ENV{GITPERLLIB} || '@@INSTLIBDIR@@'));
+use lib (split(/@PATHSEP@/, $ENV{GITPERLLIB} || '@INSTLIBDIR@'));
--git a/perl/header_templates/runtime_prefix.template.pl b/perl/header_templates/runtime_prefix.template.pl
index 9d28b3d8636c6c6d48ea287a5fef0f7833f6c08c..e6f8e661a164519d4fdb55429746380e84ae3fcb 100644
--- a/perl/header_templates/runtime_prefix.template.pl
+++ b/perl/header_templates/runtime_prefix.template.pl
@@ -3,7 +3,7 @@
# This finds our Git::* libraries relative to the script's runtime path.
sub __git_system_path {
my ($relpath) = @_;
- my $gitexecdir_relative = '@@GITEXECDIR_REL@@';
+ my $gitexecdir_relative = '@GITEXECDIR_REL@';
# GIT_EXEC_PATH is supplied by `git` or the test suite.
my $exec_path;
@@ -24,11 +24,11 @@ sub __git_system_path {
}
BEGIN {
- use lib split /@@PATHSEP@@/,
+ use lib split /@PATHSEP@/,
(
$ENV{GITPERLLIB} ||
do {
- my $perllibdir = __git_system_path('@@PERLLIBDIR_REL@@');
+ my $perllibdir = __git_system_path('@PERLLIBDIR_REL@');
(-e $perllibdir) || die("Invalid system path ($relpath): $path");
$perllibdir;
}
@@ -36,7 +36,7 @@ BEGIN
# Export the system locale directory to the I18N module. The locale directory
# is only installed if NO_GETTEXT is set.
- $Git::I18N::TEXTDOMAINDIR = __git_system_path('@@LOCALEDIR_REL@@');
+ $Git::I18N::TEXTDOMAINDIR = __git_system_path('@LOCALEDIR_REL@');
}
# END RUNTIME_PREFIX generated code.
diff --git a/unimplemented.sh b/unimplemented.sh
index fee21d24e8ab89208b4aa0af7007b7c033b753bc..41776b279d4263ae6a9034b30f1bd26ac9b792bd 100644
--- a/unimplemented.sh
+++ b/unimplemented.sh
@@ -1,4 +1,4 @@
#!/bin/sh
-echo >&2 "fatal: git was built without support for $(basename $0) (@@REASON@@)."
+echo >&2 "fatal: git was built without support for $(basename $0) (@REASON@)."
exit 128
diff --git a/wrap-for-bin.sh b/wrap-for-bin.sh
index 95851b85b6b7181130f0cd441c2bd7ac0bfb89da..7898a1c238dde20617cf96d144930dc59f67feab 100644
--- a/wrap-for-bin.sh
+++ b/wrap-for-bin.sh
@@ -4,33 +4,33 @@
# to run test suite against sandbox, but with only bindir-installed
# executables in PATH. The Makefile copies this into various
# files in bin-wrappers, substituting
-# @@BUILD_DIR@@ and @@PROG@@.
+# @BUILD_DIR@ and @PROG@.
-GIT_EXEC_PATH='@@BUILD_DIR@@'
+GIT_EXEC_PATH='@BUILD_DIR@'
if test -n "$NO_SET_GIT_TEMPLATE_DIR"
then
unset GIT_TEMPLATE_DIR
else
- GIT_TEMPLATE_DIR='@@BUILD_DIR@@/templates/blt'
+ GIT_TEMPLATE_DIR='@BUILD_DIR@/templates/blt'
export GIT_TEMPLATE_DIR
fi
-GITPERLLIB='@@BUILD_DIR@@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}"
-GIT_TEXTDOMAINDIR='@@BUILD_DIR@@/po/build/locale'
-PATH='@@BUILD_DIR@@/bin-wrappers:'"$PATH"
+GITPERLLIB='@BUILD_DIR@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}"
+GIT_TEXTDOMAINDIR='@BUILD_DIR@/po/build/locale'
+PATH='@BUILD_DIR@/bin-wrappers:'"$PATH"
export GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
case "$GIT_DEBUGGER" in
'')
- exec "${GIT_EXEC_PATH}/@@PROG@@" "$@"
+ exec "${GIT_EXEC_PATH}/@PROG@" "$@"
;;
1)
unset GIT_DEBUGGER
- exec gdb --args "${GIT_EXEC_PATH}/@@PROG@@" "$@"
+ exec gdb --args "${GIT_EXEC_PATH}/@PROG@" "$@"
;;
*)
GIT_DEBUGGER_ARGS="$GIT_DEBUGGER"
unset GIT_DEBUGGER
- exec ${GIT_DEBUGGER_ARGS} "${GIT_EXEC_PATH}/@@PROG@@" "$@"
+ exec ${GIT_DEBUGGER_ARGS} "${GIT_EXEC_PATH}/@PROG@" "$@"
;;
esac
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v11 03/26] Makefile: refactor GIT-VERSION-GEN to be reusable
2024-12-06 13:24 ` [PATCH v11 00/26] Modernize the build system Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 01/26] Makefile: use common template for GIT-BUILD-OPTIONS Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 02/26] Makefile: consistently use @PLACEHOLDER@ to substitute Patrick Steinhardt
@ 2024-12-06 13:24 ` Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 04/26] Makefile: propagate Git version via generated header Patrick Steinhardt
` (22 subsequent siblings)
25 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-12-06 13:24 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
Our "GIT-VERSION-GEN" script always writes the "GIT-VERSION-FILE" into
the current directory, where the expectation is that it should exist in
the source directory. But other build systems that support out-of-tree
builds may not want to do that to keep the source directory pristine,
even though CMake currently doesn't care.
Refactor the script such that it won't write the "GIT-VERSION-FILE"
directly anymore, but instead knows to replace @PLACEHOLDERS@ in an
arbitrary input file. This allows us to simplify the logic in CMake to
determine the project version, but can also be reused later on in order
to generate other files that need to contain version information like
our "git.rc" file.
While at it, change the format of the version file by removing the
spaces around the equals sign. Like this we can continue to include the
file in our Makefiles, but can also start to source it in shell scripts
in subsequent steps.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-VERSION-FILE.in | 1 +
GIT-VERSION-GEN | 61 ++++++++++++++++++++++++++++---------
Makefile | 5 ++-
ci/test-documentation.sh | 2 +-
contrib/buildsystems/CMakeLists.txt | 23 ++++----------
contrib/buildsystems/git-version.in | 1 +
6 files changed, 59 insertions(+), 34 deletions(-)
diff --git a/GIT-VERSION-FILE.in b/GIT-VERSION-FILE.in
new file mode 100644
index 0000000000000000000000000000000000000000..3789a48a34a3f9e37531fc24b577ffe3c657a3e9
--- /dev/null
+++ b/GIT-VERSION-FILE.in
@@ -0,0 +1 @@
+GIT_VERSION=@GIT_VERSION@
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index 78e8631f677bbebe8f18d83191f0fd014465563e..7afc7aad1413d552cbadc68b7582ba639faa4d8a 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -1,23 +1,48 @@
#!/bin/sh
-GVF=GIT-VERSION-FILE
DEF_VER=v2.47.GIT
LF='
'
+if test "$#" -ne 3
+then
+ echo >&2 "USAGE: $0 <SOURCE_DIR> <INPUT> <OUTPUT>"
+ exit 1
+fi
+
+SOURCE_DIR="$1"
+INPUT="$2"
+OUTPUT="$3"
+
+if ! test -f "$INPUT"
+then
+ echo >&2 "Input is not a file: $INPUT"
+ exit 1
+fi
+
+# Protect us from reading Git version information outside of the Git directory
+# in case it is not a repository itself, but embedded in an unrelated
+# repository.
+GIT_CEILING_DIRECTORIES="$SOURCE_DIR/.."
+export GIT_CEILING_DIRECTORIES
+
# First see if there is a version file (included in release tarballs),
# then try git-describe, then default.
-if test -f version
+if test -f "$SOURCE_DIR"/version
then
- VN=$(cat version) || VN="$DEF_VER"
-elif { test -d "${GIT_DIR:-.git}" || test -f .git; } &&
- VN=$(git describe --match "v[0-9]*" HEAD 2>/dev/null) &&
+ VN=$(cat "$SOURCE_DIR"/version) || VN="$DEF_VER"
+elif {
+ test -d "$SOURCE_DIR/.git" ||
+ test -d "${GIT_DIR:-.git}" ||
+ test -f "$SOURCE_DIR"/.git;
+ } &&
+ VN=$(git -C "$SOURCE_DIR" describe --match "v[0-9]*" HEAD 2>/dev/null) &&
case "$VN" in
*$LF*) (exit 1) ;;
v[0-9]*)
- git update-index -q --refresh
- test -z "$(git diff-index --name-only HEAD --)" ||
+ git -C "$SOURCE_DIR" update-index -q --refresh
+ test -z "$(git -C "$SOURCE_DIR" diff-index --name-only HEAD --)" ||
VN="$VN-dirty" ;;
esac
then
@@ -26,15 +51,21 @@ else
VN="$DEF_VER"
fi
-VN=$(expr "$VN" : v*'\(.*\)')
+GIT_VERSION=$(expr "$VN" : v*'\(.*\)')
+
+read GIT_MAJOR_VERSION GIT_MINOR_VERSION GIT_MICRO_VERSION trailing <<EOF
+$(echo "$GIT_VERSION" 0 0 0 | tr '.a-zA-Z-' ' ')
+EOF
+
+sed -e "s|@GIT_VERSION@|$GIT_VERSION|" \
+ -e "s|@GIT_MAJOR_VERSION@|$GIT_MAJOR_VERSION|" \
+ -e "s|@GIT_MINOR_VERSION@|$GIT_MINOR_VERSION|" \
+ -e "s|@GIT_MICRO_VERSION@|$GIT_MICRO_VERSION|" \
+ "$INPUT" >"$OUTPUT"+
-if test -r $GVF
+if ! test -f "$OUTPUT" || ! cmp "$OUTPUT"+ "$OUTPUT" >/dev/null
then
- VC=$(sed -e 's/^GIT_VERSION = //' <$GVF)
+ mv "$OUTPUT"+ "$OUTPUT"
else
- VC=unset
+ rm "$OUTPUT"+
fi
-test "$VN" = "$VC" || {
- echo >&2 "GIT_VERSION = $VN"
- echo "GIT_VERSION = $VN" >$GVF
-}
diff --git a/Makefile b/Makefile
index 45c38088535fbb10fae7ea17eda44bd6fb6c91aa..a529df85ad4c68f6db981c8dc05540e9e4991995 100644
--- a/Makefile
+++ b/Makefile
@@ -592,7 +592,10 @@ include shared.mak
# Disable -pedantic compilation.
GIT-VERSION-FILE: FORCE
- @$(SHELL_PATH) ./GIT-VERSION-GEN
+ @OLD=$$(cat $@ 2>/dev/null || :) && \
+ $(SHELL_PATH) ./GIT-VERSION-GEN "$(shell pwd)" GIT-VERSION-FILE.in $@ && \
+ NEW=$$(cat $@ 2>/dev/null || :) && \
+ if test "$$OLD" != "$$NEW"; then echo "$$NEW" >&2; fi
-include GIT-VERSION-FILE
# Set our default configuration.
diff --git a/ci/test-documentation.sh b/ci/test-documentation.sh
index 02b3af394117f840e078479ca60030141e47f998..6c018b673e0563fa5589195a77804c91deb93515 100755
--- a/ci/test-documentation.sh
+++ b/ci/test-documentation.sh
@@ -6,7 +6,7 @@
. ${0%/*}/lib.sh
filter_log () {
- sed -e '/^GIT_VERSION = /d' \
+ sed -e '/^GIT_VERSION=/d' \
-e "/constant Gem::ConfigMap is deprecated/d" \
-e '/^ \* new asciidoc flags$/d' \
-e '/stripped namespace before processing/d' \
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 1abf5f099c1c6735ae7aec345de96bf623e2aa18..376d748ce9021710eb72258ab3b9bac52950a933 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -83,23 +83,12 @@ if(NOT SH_EXE)
"On Windows, you can get it as part of 'Git for Windows' install at https://gitforwindows.org/")
endif()
-#Create GIT-VERSION-FILE using GIT-VERSION-GEN
-if(NOT EXISTS ${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE)
- message("Generating GIT-VERSION-FILE")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
-endif()
-
-#Parse GIT-VERSION-FILE to get the version
-file(STRINGS ${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE git_version REGEX "GIT_VERSION = (.*)")
-string(REPLACE "GIT_VERSION = " "" git_version ${git_version})
-string(FIND ${git_version} "GIT" location)
-if(location EQUAL -1)
- string(REGEX MATCH "[0-9]*\\.[0-9]*\\.[0-9]*" git_version ${git_version})
-else()
- string(REGEX MATCH "[0-9]*\\.[0-9]*" git_version ${git_version})
- string(APPEND git_version ".0") #for building from a snapshot
-endif()
+message("Generating Git version")
+execute_process(COMMAND ${SH_EXE} "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_SOURCE_DIR}/contrib/buildsystems/git-version.in"
+ "${CMAKE_BINARY_DIR}/git-version")
+file(STRINGS "${CMAKE_BINARY_DIR}/git-version" git_version)
project(git
VERSION ${git_version}
diff --git a/contrib/buildsystems/git-version.in b/contrib/buildsystems/git-version.in
new file mode 100644
index 0000000000000000000000000000000000000000..9750505ae77685ebb31a38468caaf13501b6739d
--- /dev/null
+++ b/contrib/buildsystems/git-version.in
@@ -0,0 +1 @@
+@GIT_MAJOR_VERSION@.@GIT_MINOR_VERSION@.@GIT_MICRO_VERSION@
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v11 04/26] Makefile: propagate Git version via generated header
2024-12-06 13:24 ` [PATCH v11 00/26] Modernize the build system Patrick Steinhardt
` (2 preceding siblings ...)
2024-12-06 13:24 ` [PATCH v11 03/26] Makefile: refactor GIT-VERSION-GEN to be reusable Patrick Steinhardt
@ 2024-12-06 13:24 ` Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 05/26] Makefile: generate "git.rc" via GIT-VERSION-GEN Patrick Steinhardt
` (21 subsequent siblings)
25 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-12-06 13:24 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
We set up a couple of preprocessor macros when compiling Git that
propagate the version that Git was built from to `git version` et al.
The way this is set up makes it harder than necessary to reuse the
infrastructure across the different build systems.
Refactor this such that we generate a "version-def.h" header via
`GIT-VERSION-GEN` instead.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
.gitignore | 1 +
GIT-VERSION-GEN | 7 +++++++
Makefile | 13 ++++++-------
contrib/buildsystems/CMakeLists.txt | 16 ++++++++++++----
version-def.h.in | 8 ++++++++
version.c | 1 +
6 files changed, 35 insertions(+), 11 deletions(-)
diff --git a/.gitignore b/.gitignore
index 6687bd6db4c0a6adf02292a9cb545d3e5270e2b0..e17963e84252fa094c10f5e84c0e3724153c819c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -195,6 +195,7 @@
/config-list.h
/command-list.h
/hook-list.h
+/version-def.h
*.tar.gz
*.dsc
*.deb
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index 7afc7aad1413d552cbadc68b7582ba639faa4d8a..c18f24e515436b71ef40120b88b6fbb0b5621c01 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -52,6 +52,11 @@ else
fi
GIT_VERSION=$(expr "$VN" : v*'\(.*\)')
+GIT_BUILT_FROM_COMMIT=$(git -C "$SOURCE_DIR" rev-parse -q --verify HEAD 2>/dev/null)
+if test -z "$GIT_USER_AGENT"
+then
+ GIT_USER_AGENT="git/$GIT_VERSION"
+fi
read GIT_MAJOR_VERSION GIT_MINOR_VERSION GIT_MICRO_VERSION trailing <<EOF
$(echo "$GIT_VERSION" 0 0 0 | tr '.a-zA-Z-' ' ')
@@ -61,6 +66,8 @@ sed -e "s|@GIT_VERSION@|$GIT_VERSION|" \
-e "s|@GIT_MAJOR_VERSION@|$GIT_MAJOR_VERSION|" \
-e "s|@GIT_MINOR_VERSION@|$GIT_MINOR_VERSION|" \
-e "s|@GIT_MICRO_VERSION@|$GIT_MICRO_VERSION|" \
+ -e "s|@GIT_BUILT_FROM_COMMIT@|$GIT_BUILT_FROM_COMMIT|" \
+ -e "s|@GIT_USER_AGENT@|$GIT_USER_AGENT|" \
"$INPUT" >"$OUTPUT"+
if ! test -f "$OUTPUT" || ! cmp "$OUTPUT"+ "$OUTPUT" >/dev/null
diff --git a/Makefile b/Makefile
index a529df85ad4c68f6db981c8dc05540e9e4991995..53b98eccbacb8ddd65020d9aebfee532e92d2196 100644
--- a/Makefile
+++ b/Makefile
@@ -2508,13 +2508,11 @@ PAGER_ENV_CQ_SQ = $(subst ','\'',$(PAGER_ENV_CQ))
pager.sp pager.s pager.o: EXTRA_CPPFLAGS = \
-DPAGER_ENV='$(PAGER_ENV_CQ_SQ)'
-version.sp version.s version.o: GIT-VERSION-FILE GIT-USER-AGENT
-version.sp version.s version.o: EXTRA_CPPFLAGS = \
- '-DGIT_VERSION="$(GIT_VERSION)"' \
- '-DGIT_USER_AGENT=$(GIT_USER_AGENT_CQ_SQ)' \
- '-DGIT_BUILT_FROM_COMMIT="$(shell \
- GIT_CEILING_DIRECTORIES="$(CURDIR)/.." \
- git rev-parse -q --verify HEAD 2>/dev/null)"'
+version-def.h: version-def.h.in GIT-VERSION-GEN GIT-VERSION-FILE GIT-USER-AGENT
+ $(QUIET_GEN)GIT_USER_AGENT="$(GIT_USER_AGENT)" $(SHELL_PATH) ./GIT-VERSION-GEN "$(shell pwd)" $< $@+
+ @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
+
+version.sp version.s version.o: version-def.h
$(BUILT_INS): git$X
$(QUIET_BUILT_IN)$(RM) $@ && \
@@ -3729,6 +3727,7 @@ clean: profile-clean coverage-clean cocciclean
$(RM) $(FUZZ_PROGRAMS)
$(RM) $(SP_OBJ)
$(RM) $(HCC)
+ $(RM) version-def.h
$(RM) -r bin-wrappers $(dep_dirs) $(compdb_dir) compile_commands.json
$(RM) -r po/build/
$(RM) *.pyc *.pyo */*.pyc */*.pyo $(GENERATED_H) $(ETAGS_TARGET) tags cscope*
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 376d748ce9021710eb72258ab3b9bac52950a933..3cc5e318190292dd66981aa8593e7bd2739eea1d 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -229,10 +229,7 @@ add_compile_definitions(PAGER_ENV="LESS=FRX LV=-c"
GIT_HTML_PATH="share/doc/git-doc"
DEFAULT_HELP_FORMAT="html"
DEFAULT_GIT_TEMPLATE_DIR="share/git-core/templates"
- GIT_VERSION="${PROJECT_VERSION}.GIT"
- GIT_USER_AGENT="git/${PROJECT_VERSION}.GIT"
- BINDIR="bin"
- GIT_BUILT_FROM_COMMIT="")
+ BINDIR="bin")
if(WIN32)
set(FALLBACK_RUNTIME_PREFIX /mingw64)
@@ -668,6 +665,17 @@ parse_makefile_for_sources(libgit_SOURCES "LIB_OBJS")
list(TRANSFORM libgit_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
list(TRANSFORM compat_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
+
+add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/version-def.h"
+ COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_SOURCE_DIR}/version-def.h.in"
+ "${CMAKE_BINARY_DIR}/version-def.h"
+ DEPENDS "${SH_EXE}" "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
+ "${CMAKE_SOURCE_DIR}/version-def.h.in"
+ VERBATIM)
+list(APPEND libgit_SOURCES "${CMAKE_BINARY_DIR}/version-def.h")
+
add_library(libgit ${libgit_SOURCES} ${compat_SOURCES})
#libxdiff
diff --git a/version-def.h.in b/version-def.h.in
new file mode 100644
index 0000000000000000000000000000000000000000..347995df0611e19428cf96ec9539f0dcfea999d2
--- /dev/null
+++ b/version-def.h.in
@@ -0,0 +1,8 @@
+#ifndef VERSION_DEF_H
+#define VERSION_DEF_H
+
+#define GIT_VERSION "@GIT_VERSION@"
+#define GIT_BUILT_FROM_COMMIT "@GIT_BUILT_FROM_COMMIT@"
+#define GIT_USER_AGENT "@GIT_USER_AGENT@"
+
+#endif /* VERSION_DEF_H */
diff --git a/version.c b/version.c
index 41b718c29e1b9fc2981d7d14a3d25e69c31a3030..7adc4d51ff25a0841607c21807deaf20721252de 100644
--- a/version.c
+++ b/version.c
@@ -1,5 +1,6 @@
#include "git-compat-util.h"
#include "version.h"
+#include "version-def.h"
#include "strbuf.h"
const char git_version_string[] = GIT_VERSION;
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v11 05/26] Makefile: generate "git.rc" via GIT-VERSION-GEN
2024-12-06 13:24 ` [PATCH v11 00/26] Modernize the build system Patrick Steinhardt
` (3 preceding siblings ...)
2024-12-06 13:24 ` [PATCH v11 04/26] Makefile: propagate Git version via generated header Patrick Steinhardt
@ 2024-12-06 13:24 ` Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 06/26] Makefile: generate doc versions " Patrick Steinhardt
` (20 subsequent siblings)
25 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-12-06 13:24 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
The "git.rc" is used on Windows to embed information like the project
name and version into the resulting executables. As such we need to
inject the version information, which we do by using preprocessor
defines. The logic to do so is non-trivial and needs to be kept in sync
with the different build systems.
Refactor the logic so that we generate "git.rc" via `GIT-VERSION-GEN`.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
.gitignore | 1 +
GIT-VERSION-GEN | 8 ++++++--
Makefile | 13 +++++++------
contrib/buildsystems/CMakeLists.txt | 19 +++++++++++++------
git.rc => git.rc.in | 6 +++---
5 files changed, 30 insertions(+), 17 deletions(-)
diff --git a/.gitignore b/.gitignore
index e17963e84252fa094c10f5e84c0e3724153c819c..d3be460040c6120d862a25dff1abd325b93b37fd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -199,6 +199,7 @@
*.tar.gz
*.dsc
*.deb
+/git.rc
/git.spec
*.exe
*.[aos]
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index c18f24e515436b71ef40120b88b6fbb0b5621c01..a1c8146f05cfa7fbc6c47804aec5fb848e67c69c 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -58,14 +58,18 @@ then
GIT_USER_AGENT="git/$GIT_VERSION"
fi
-read GIT_MAJOR_VERSION GIT_MINOR_VERSION GIT_MICRO_VERSION trailing <<EOF
-$(echo "$GIT_VERSION" 0 0 0 | tr '.a-zA-Z-' ' ')
+# While released Git versions only have three numbers, development builds also
+# have a fourth number that corresponds to the number of patches since the last
+# release.
+read GIT_MAJOR_VERSION GIT_MINOR_VERSION GIT_MICRO_VERSION GIT_PATCH_LEVEL trailing <<EOF
+$(echo "$GIT_VERSION" 0 0 0 0 | tr '.a-zA-Z-' ' ')
EOF
sed -e "s|@GIT_VERSION@|$GIT_VERSION|" \
-e "s|@GIT_MAJOR_VERSION@|$GIT_MAJOR_VERSION|" \
-e "s|@GIT_MINOR_VERSION@|$GIT_MINOR_VERSION|" \
-e "s|@GIT_MICRO_VERSION@|$GIT_MICRO_VERSION|" \
+ -e "s|@GIT_PATCH_LEVEL@|$GIT_PATCH_LEVEL|" \
-e "s|@GIT_BUILT_FROM_COMMIT@|$GIT_BUILT_FROM_COMMIT|" \
-e "s|@GIT_USER_AGENT@|$GIT_USER_AGENT|" \
"$INPUT" >"$OUTPUT"+
diff --git a/Makefile b/Makefile
index 53b98eccbacb8ddd65020d9aebfee532e92d2196..f8ae750ffdb1dc4c4ad547029799710841665d1e 100644
--- a/Makefile
+++ b/Makefile
@@ -2568,11 +2568,12 @@ $(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEFINES
$(QUIET_GEN)$(cmd_munge_script) && \
mv $@+ $@
-git.res: git.rc GIT-VERSION-FILE GIT-PREFIX
- $(QUIET_RC)$(RC) \
- $(join -DMAJOR= -DMINOR= -DMICRO= -DPATCHLEVEL=, $(wordlist 1, 4, \
- $(shell echo $(GIT_VERSION) 0 0 0 0 | tr '.a-zA-Z-' ' '))) \
- -DGIT_VERSION="\\\"$(GIT_VERSION)\\\"" -i $< -o $@
+git.rc: git.rc.in GIT-VERSION-GEN GIT-VERSION-FILE
+ $(QUIET_GEN)$(SHELL_PATH) ./GIT-VERSION-GEN "$(shell pwd)" $< $@+
+ @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
+
+git.res: git.rc GIT-PREFIX
+ $(QUIET_RC)$(RC) -i $< -o $@
# This makes sure we depend on the NO_PERL setting itself.
$(SCRIPT_PERL_GEN): GIT-BUILD-OPTIONS
@@ -3718,7 +3719,7 @@ clean: profile-clean coverage-clean cocciclean
$(RM) -r .build $(UNIT_TEST_BIN)
$(RM) GIT-TEST-SUITES
$(RM) po/git.pot po/git-core.pot
- $(RM) git.res
+ $(RM) git.rc git.res
$(RM) $(OBJECTS)
$(RM) headless-git.o
$(RM) $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB)
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 3cc5e318190292dd66981aa8593e7bd2739eea1d..865b3af9fb2c1e7bdc1e7cecd0f021ee460971dd 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -691,18 +691,25 @@ list(TRANSFORM reftable_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
add_library(reftable STATIC ${reftable_SOURCES})
if(WIN32)
+ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/git.rc
+ COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_SOURCE_DIR}/git.rc.in"
+ "${CMAKE_BINARY_DIR}/git.rc"
+ DEPENDS "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
+ "${CMAKE_SOURCE_DIR}/git.rc.in"
+ VERBATIM)
+
if(NOT MSVC)#use windres when compiling with gcc and clang
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/git.res
- COMMAND ${WINDRES_EXE} -O coff -DMAJOR=${PROJECT_VERSION_MAJOR} -DMINOR=${PROJECT_VERSION_MINOR}
- -DMICRO=${PROJECT_VERSION_PATCH} -DPATCHLEVEL=0 -DGIT_VERSION="\\\"${PROJECT_VERSION}.GIT\\\""
- -i ${CMAKE_SOURCE_DIR}/git.rc -o ${CMAKE_BINARY_DIR}/git.res
+ COMMAND ${WINDRES_EXE} -O coff -i ${CMAKE_BINARY_DIR}/git.rc -o ${CMAKE_BINARY_DIR}/git.res
+ DEPENDS "${CMAKE_BINARY_DIR}/git.rc"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
VERBATIM)
else()#MSVC use rc
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/git.res
- COMMAND ${CMAKE_RC_COMPILER} /d MAJOR=${PROJECT_VERSION_MAJOR} /d MINOR=${PROJECT_VERSION_MINOR}
- /d MICRO=${PROJECT_VERSION_PATCH} /d PATCHLEVEL=0 /d GIT_VERSION="${PROJECT_VERSION}.GIT"
- /fo ${CMAKE_BINARY_DIR}/git.res ${CMAKE_SOURCE_DIR}/git.rc
+ COMMAND ${CMAKE_RC_COMPILER} /fo ${CMAKE_BINARY_DIR}/git.res ${CMAKE_BINARY_DIR}/git.rc
+ DEPENDS "${CMAKE_BINARY_DIR}/git.rc"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
VERBATIM)
endif()
diff --git a/git.rc b/git.rc.in
similarity index 67%
rename from git.rc
rename to git.rc.in
index cc3fdc6cc6cb83b084eebe2ad49f3c78c981789b..e69444eef3f0c558707e067d52820668d2116308 100644
--- a/git.rc
+++ b/git.rc.in
@@ -1,6 +1,6 @@
1 VERSIONINFO
-FILEVERSION MAJOR,MINOR,MICRO,PATCHLEVEL
-PRODUCTVERSION MAJOR,MINOR,MICRO,PATCHLEVEL
+FILEVERSION @GIT_MAJOR_VERSION@,@GIT_MINOR_VERSION@,@GIT_MICRO_VERSION@,@GIT_PATCH_LEVEL@
+PRODUCTVERSION @GIT_MAJOR_VERSION@,@GIT_MINOR_VERSION@,@GIT_MICRO_VERSION@,@GIT_PATCH_LEVEL@
BEGIN
BLOCK "StringFileInfo"
BEGIN
@@ -11,7 +11,7 @@ BEGIN
VALUE "InternalName", "git\0"
VALUE "OriginalFilename", "git.exe\0"
VALUE "ProductName", "Git\0"
- VALUE "ProductVersion", GIT_VERSION "\0"
+ VALUE "ProductVersion", "@GIT_VERSION@\0"
END
END
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v11 06/26] Makefile: generate doc versions via GIT-VERSION-GEN
2024-12-06 13:24 ` [PATCH v11 00/26] Modernize the build system Patrick Steinhardt
` (4 preceding siblings ...)
2024-12-06 13:24 ` [PATCH v11 05/26] Makefile: generate "git.rc" via GIT-VERSION-GEN Patrick Steinhardt
@ 2024-12-06 13:24 ` Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 07/26] Makefile: consistently use PERL_PATH Patrick Steinhardt
` (19 subsequent siblings)
25 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-12-06 13:24 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
The documentation we generate embeds information for the exact Git
version used as well as the date of the commit. This information is
injected by injecting attributes into the build process via command line
argument.
Refactor the logic so that we write the information into "asciidoc.conf"
and "asciidoctor-extensions.rb" via `GIT-VERSION-GEN` for AsciiDoc and
AsciiDoctor, respectively.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Documentation/.gitignore | 2 ++
Documentation/Makefile | 25 ++++++++++++++--------
Documentation/{asciidoc.conf => asciidoc.conf.in} | 3 +++
...-extensions.rb => asciidoctor-extensions.rb.in} | 8 ++-----
GIT-VERSION-GEN | 2 ++
5 files changed, 25 insertions(+), 15 deletions(-)
diff --git a/Documentation/.gitignore b/Documentation/.gitignore
index a48448de32f98b1a054b36e886ea920bccebc494..649df89474d357ccc91109b5c35fe2d0910f968a 100644
--- a/Documentation/.gitignore
+++ b/Documentation/.gitignore
@@ -15,3 +15,5 @@ tmp-doc-diff/
GIT-ASCIIDOCFLAGS
/.build/
/GIT-EXCLUDED-PROGRAMS
+/asciidoc.conf
+/asciidoctor-extensions.rb
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 0f55baa252fffbcd506f0c6f410b26b37f2e9b11..9371f294254fb77c08a695daff0dd35f4073db4f 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -1,6 +1,8 @@
# Import tree-wide shared Makefile behavior and libraries
include ../shared.mak
+.PHONY: FORCE
+
# Guard against environment variables
MAN1_TXT =
MAN5_TXT =
@@ -148,16 +150,12 @@ man5dir = $(mandir)/man5
man7dir = $(mandir)/man7
# DESTDIR =
-GIT_DATE := $(shell git show --quiet --pretty='%as')
-
ASCIIDOC = asciidoc
ASCIIDOC_EXTRA =
ASCIIDOC_HTML = xhtml11
ASCIIDOC_DOCBOOK = docbook
ASCIIDOC_CONF = -f asciidoc.conf
-ASCIIDOC_COMMON = $(ASCIIDOC) $(ASCIIDOC_EXTRA) $(ASCIIDOC_CONF) \
- -amanmanual='Git Manual' -amansource='Git $(GIT_VERSION)' \
- -arevdate='$(GIT_DATE)'
+ASCIIDOC_COMMON = $(ASCIIDOC) $(ASCIIDOC_EXTRA) $(ASCIIDOC_CONF)
ASCIIDOC_DEPS = asciidoc.conf GIT-ASCIIDOCFLAGS
TXT_TO_HTML = $(ASCIIDOC_COMMON) -b $(ASCIIDOC_HTML)
TXT_TO_XML = $(ASCIIDOC_COMMON) -b $(ASCIIDOC_DOCBOOK)
@@ -210,6 +208,14 @@ ASCIIDOC_DEPS = asciidoctor-extensions.rb GIT-ASCIIDOCFLAGS
DBLATEX_COMMON =
XMLTO_EXTRA += --skip-validation
XMLTO_EXTRA += -x manpage.xsl
+
+asciidoctor-extensions.rb: asciidoctor-extensions.rb.in FORCE
+ $(QUIET_GEN)GIT_USER_AGENT="$(GIT_USER_AGENT)" $(SHELL_PATH) ../GIT-VERSION-GEN "$(shell pwd)/.." $< $@+
+ @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
+else
+asciidoc.conf: asciidoc.conf.in FORCE
+ $(QUIET_GEN)GIT_USER_AGENT="$(GIT_USER_AGENT)" $(SHELL_PATH) ../GIT-VERSION-GEN "$(shell pwd)/.." $< $@+
+ @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
endif
ASCIIDOC_DEPS += docinfo.html
@@ -341,6 +347,7 @@ clean:
$(RM) SubmittingPatches.txt
$(RM) $(cmds_txt) $(mergetools_txt) *.made
$(RM) GIT-ASCIIDOCFLAGS
+ $(RM) asciidoc.conf asciidoctor-extensions.rb
docinfo.html: docinfo-html.in
$(QUIET_GEN)$(RM) $@ && cat $< >$@
@@ -364,7 +371,7 @@ manpage-cmd = $(QUIET_XMLTO)$(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
%.xml : %.txt $(ASCIIDOC_DEPS)
$(QUIET_ASCIIDOC)$(TXT_TO_XML) -d manpage -o $@ $<
-user-manual.xml: user-manual.txt user-manual.conf asciidoctor-extensions.rb GIT-ASCIIDOCFLAGS
+user-manual.xml: user-manual.txt user-manual.conf $(ASCIIDOC_DEPS)
$(QUIET_ASCIIDOC)$(TXT_TO_XML) -d book -o $@ $<
technical/api-index.txt: technical/api-index-skel.txt \
@@ -373,7 +380,7 @@ technical/api-index.txt: technical/api-index-skel.txt \
technical/%.html: ASCIIDOC_EXTRA += -a git-relative-html-prefix=../
$(patsubst %,%.html,$(API_DOCS) technical/api-index $(TECH_DOCS)): %.html : %.txt \
- asciidoc.conf GIT-ASCIIDOCFLAGS
+ $(ASCIIDOC_DEPS)
$(QUIET_ASCIIDOC)$(TXT_TO_HTML) $*.txt
SubmittingPatches.txt: SubmittingPatches
@@ -416,13 +423,13 @@ $(patsubst %.txt,%.texi,$(MAN_TXT)): %.texi : %.xml
howto-index.txt: howto-index.sh $(HOWTO_TXT)
$(QUIET_GEN)'$(SHELL_PATH_SQ)' ./howto-index.sh $(sort $(HOWTO_TXT)) >$@
-$(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
+$(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt $(ASCIIDOC_DEPS)
$(QUIET_ASCIIDOC)$(TXT_TO_HTML) $*.txt
WEBDOC_DEST = /pub/software/scm/git/docs
howto/%.html: ASCIIDOC_EXTRA += -a git-relative-html-prefix=../
-$(patsubst %.txt,%.html,$(HOWTO_TXT)): %.html : %.txt GIT-ASCIIDOCFLAGS
+$(patsubst %.txt,%.html,$(HOWTO_TXT)): %.html : %.txt $(ASCIIDOC_DEPS)
$(QUIET_ASCIIDOC) \
sed -e '1,/^$$/d' $< | \
$(TXT_TO_HTML) - >$@
diff --git a/Documentation/asciidoc.conf b/Documentation/asciidoc.conf.in
similarity index 97%
rename from Documentation/asciidoc.conf
rename to Documentation/asciidoc.conf.in
index f6da6d1fbd2b208b072c1158dfcfb29c6c01f93a..dbe36a52eabfabef59e31d3be6518549e4f90206 100644
--- a/Documentation/asciidoc.conf
+++ b/Documentation/asciidoc.conf.in
@@ -21,6 +21,9 @@ tilde=~
apostrophe='
backtick=`
litdd=--
+manmanual='Git Manual'
+mansource='Git @GIT_VERSION@'
+revdate='@GIT_DATE@'
ifdef::backend-docbook[]
[linkgit-inlinemacro]
diff --git a/Documentation/asciidoctor-extensions.rb b/Documentation/asciidoctor-extensions.rb.in
similarity index 92%
rename from Documentation/asciidoctor-extensions.rb
rename to Documentation/asciidoctor-extensions.rb.in
index cb24480b63d2ecc5c4ef267f4c501da53fc5b5be..c4c200dace85cf0a89dbc0f54ef25e4d1b6fec4d 100644
--- a/Documentation/asciidoctor-extensions.rb
+++ b/Documentation/asciidoctor-extensions.rb.in
@@ -29,13 +29,9 @@ module Git
class DocumentPostProcessor < Asciidoctor::Extensions::Postprocessor
def process document, output
if document.basebackend? 'docbook'
- mansource = document.attributes['mansource']
- manversion = document.attributes['manversion']
- manmanual = document.attributes['manmanual']
new_tags = "" \
- "<refmiscinfo class=\"source\">#{mansource}</refmiscinfo>\n" \
- "<refmiscinfo class=\"version\">#{manversion}</refmiscinfo>\n" \
- "<refmiscinfo class=\"manual\">#{manmanual}</refmiscinfo>\n"
+ "<refmiscinfo class=\"source\">@GIT_VERSION@</refmiscinfo>\n" \
+ "<refmiscinfo class=\"manual\">Git Manual</refmiscinfo>\n"
output = output.sub(/<\/refmeta>/, new_tags + "</refmeta>")
end
output
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index a1c8146f05cfa7fbc6c47804aec5fb848e67c69c..b4687784c1c348b6efb110c5e8b935b788723f59 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -53,6 +53,7 @@ fi
GIT_VERSION=$(expr "$VN" : v*'\(.*\)')
GIT_BUILT_FROM_COMMIT=$(git -C "$SOURCE_DIR" rev-parse -q --verify HEAD 2>/dev/null)
+GIT_DATE=$(git -C "$SOURCE_DIR" show --quiet --format='%as' 2>/dev/null)
if test -z "$GIT_USER_AGENT"
then
GIT_USER_AGENT="git/$GIT_VERSION"
@@ -72,6 +73,7 @@ sed -e "s|@GIT_VERSION@|$GIT_VERSION|" \
-e "s|@GIT_PATCH_LEVEL@|$GIT_PATCH_LEVEL|" \
-e "s|@GIT_BUILT_FROM_COMMIT@|$GIT_BUILT_FROM_COMMIT|" \
-e "s|@GIT_USER_AGENT@|$GIT_USER_AGENT|" \
+ -e "s|@GIT_DATE@|$GIT_DATE|" \
"$INPUT" >"$OUTPUT"+
if ! test -f "$OUTPUT" || ! cmp "$OUTPUT"+ "$OUTPUT" >/dev/null
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v11 07/26] Makefile: consistently use PERL_PATH
2024-12-06 13:24 ` [PATCH v11 00/26] Modernize the build system Patrick Steinhardt
` (5 preceding siblings ...)
2024-12-06 13:24 ` [PATCH v11 06/26] Makefile: generate doc versions " Patrick Steinhardt
@ 2024-12-06 13:24 ` Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 08/26] Makefile: extract script to massage Perl scripts Patrick Steinhardt
` (18 subsequent siblings)
25 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-12-06 13:24 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
When injecting the Perl path into our scripts we sometimes use '@PERL@'
while we othertimes use '@PERL_PATH@'. Refactor the code use the latter
consistently, which makes it easier to reuse the same logic for multiple
scripts.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 2 +-
contrib/buildsystems/CMakeLists.txt | 2 +-
git-instaweb.sh | 4 ++--
git-request-pull.sh | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile
index f8ae750ffdb1dc4c4ad547029799710841665d1e..c0815b8fff297020a25deb73b2dc15d3bea2852e 100644
--- a/Makefile
+++ b/Makefile
@@ -2554,7 +2554,7 @@ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's/@USE_GETTEXT_SCHEME@/$(USE_GETTEXT_SCHEME)/g' \
-e $(BROKEN_PATH_FIX) \
-e 's|@GITWEBDIR@|$(gitwebdir_SQ)|g' \
- -e 's|@PERL@|$(PERL_PATH_SQ)|g' \
+ -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' \
-e 's|@PAGER_ENV@|$(PAGER_ENV_SQ)|g' \
$@.sh >$@+
endef
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 865b3af9fb2c1e7bdc1e7cecd0f021ee460971dd..ecaae8965cd43d4a5a36201b8760296b52147dc2 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -846,7 +846,7 @@ foreach(script ${git_shell_scripts})
string(REPLACE "@NO_CURL@" "" content "${content}")
string(REPLACE "@USE_GETTEXT_SCHEME@" "" content "${content}")
string(REPLACE "# @BROKEN_PATH_FIX@" "" content "${content}")
- string(REPLACE "@PERL@" "${PERL_PATH}" content "${content}")
+ string(REPLACE "@PERL_PATH@" "${PERL_PATH}" content "${content}")
string(REPLACE "@PAGER_ENV@" "LESS=FRX LV=-c" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
endforeach()
diff --git a/git-instaweb.sh b/git-instaweb.sh
index c8efb1205a8e2a66a6aced840980978897e122bc..5ad50160bb035885d8c180bee3ebb0a8e9622abc 100755
--- a/git-instaweb.sh
+++ b/git-instaweb.sh
@@ -3,7 +3,7 @@
# Copyright (c) 2006 Eric Wong
#
-PERL='@PERL@'
+PERL='@PERL_PATH@'
OPTIONS_KEEPDASHDASH=
OPTIONS_STUCKLONG=
OPTIONS_SPEC="\
@@ -716,7 +716,7 @@ EOF
gitweb_conf() {
cat > "$fqgitdir/gitweb/gitweb_config.perl" <<EOF
-#!@PERL@
+#!@PERL_PATH@
our \$projectroot = "$(dirname "$fqgitdir")";
our \$git_temp = "$fqgitdir/gitweb/tmp";
our \$projects_list = \$projectroot;
diff --git a/git-request-pull.sh b/git-request-pull.sh
index 10c88639e28c02650ffea3d4671afa9a9f0bb182..775ba8ea11aa0fce90ae9bfaea8eac5b8bc584a4 100755
--- a/git-request-pull.sh
+++ b/git-request-pull.sh
@@ -112,7 +112,7 @@ find_matching_ref='
}
'
-set fnord $(git ls-remote "$url" | @PERL@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
+set fnord $(git ls-remote "$url" | @PERL_PATH@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
remote_sha1=$2
ref=$3
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v11 08/26] Makefile: extract script to massage Perl scripts
2024-12-06 13:24 ` [PATCH v11 00/26] Modernize the build system Patrick Steinhardt
` (6 preceding siblings ...)
2024-12-06 13:24 ` [PATCH v11 07/26] Makefile: consistently use PERL_PATH Patrick Steinhardt
@ 2024-12-06 13:24 ` Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 09/26] Makefile: use "generate-perl.sh" to massage Perl library Patrick Steinhardt
` (17 subsequent siblings)
25 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-12-06 13:24 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
Extract the script to inject various build-time parameters into our Perl
scripts into a standalone script. This is done such that we can reuse it
in other build systems.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 12 ++----------
contrib/buildsystems/CMakeLists.txt | 32 +++++++++++++++++++++++++++-----
generate-perl.sh | 27 +++++++++++++++++++++++++++
3 files changed, 56 insertions(+), 15 deletions(-)
diff --git a/Makefile b/Makefile
index c0815b8fff297020a25deb73b2dc15d3bea2852e..714f1284010d4bb0c0daff0db3052a4cdf9a08f1 100644
--- a/Makefile
+++ b/Makefile
@@ -2606,16 +2606,8 @@ endif
PERL_DEFINES += $(gitexecdir) $(perllibdir) $(localedir)
-$(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
- $(QUIET_GEN) \
- sed -e '1{' \
- -e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \
- -e ' r GIT-PERL-HEADER' \
- -e ' G' \
- -e '}' \
- -e 's/@GIT_VERSION@/$(GIT_VERSION)/g' \
- $< >$@+ && \
- chmod +x $@+ && \
+$(SCRIPT_PERL_GEN): % : %.perl generate-perl.sh GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
+ $(QUIET_GEN)$(SHELL_PATH) generate-perl.sh ./GIT-BUILD-OPTIONS ./GIT-VERSION-FILE GIT-PERL-HEADER "$<" "$@+" && \
mv $@+ $@
PERL_DEFINES := $(subst $(space),:,$(PERL_DEFINES))
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index ecaae8965cd43d4a5a36201b8760296b52147dc2..5cb9a209366e80ef141c6349fea9ddedb2f83d1a 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -852,19 +852,41 @@ foreach(script ${git_shell_scripts})
endforeach()
#perl scripts
-parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" ".perl")
+parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" "")
#create perl header
file(STRINGS ${CMAKE_SOURCE_DIR}/perl/header_templates/fixed_prefix.template.pl perl_header )
string(REPLACE "@PATHSEP@" ":" perl_header "${perl_header}")
string(REPLACE "@INSTLIBDIR@" "${INSTLIBDIR}" perl_header "${perl_header}")
+file(WRITE ${CMAKE_BINARY_DIR}/PERL-HEADER ${perl_header})
+
+add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/GIT-VERSION-FILE"
+ COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE.in"
+ "${CMAKE_BINARY_DIR}/GIT-VERSION-FILE"
+ DEPENDS ${SH_EXE} "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
+ "${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE.in"
+ VERBATIM)
foreach(script ${git_perl_scripts})
- file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.perl content NEWLINE_CONSUME)
- string(REPLACE "#!/usr/bin/perl" "#!/usr/bin/perl\n${perl_header}\n" content "${content}")
- string(REPLACE "@GIT_VERSION@" "${PROJECT_VERSION}" content "${content}")
- file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
+ string(REPLACE ".perl" "" perl_gen_path "${script}")
+
+ add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/${perl_gen_path}"
+ COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-perl.sh"
+ "${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS"
+ "${CMAKE_BINARY_DIR}/GIT-VERSION-FILE"
+ "${CMAKE_BINARY_DIR}/PERL-HEADER"
+ "${CMAKE_SOURCE_DIR}/${script}"
+ "${CMAKE_BINARY_DIR}/${perl_gen_path}"
+ DEPENDS "${CMAKE_SOURCE_DIR}/generate-perl.sh"
+ "${CMAKE_SOURCE_DIR}/${script}"
+ "${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS"
+ "${CMAKE_BINARY_DIR}/GIT-VERSION-FILE"
+ VERBATIM)
+ list(APPEND perl_gen ${CMAKE_BINARY_DIR}/${perl_gen_path})
endforeach()
+add_custom_target(perl-gen ALL DEPENDS ${perl_gen})
#python script
file(STRINGS ${CMAKE_SOURCE_DIR}/git-p4.py content NEWLINE_CONSUME)
diff --git a/generate-perl.sh b/generate-perl.sh
new file mode 100755
index 0000000000000000000000000000000000000000..95072522da4aaabc74164737b72568ccfe4962fc
--- /dev/null
+++ b/generate-perl.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+set -e
+
+if test $# -ne 5
+then
+ echo >&2 "USAGE: $0 <GIT_BUILD_OPTIONS> <GIT_VERSION_FILE> <PERL_HEADER> <INPUT> <OUTPUT>"
+ exit 1
+fi
+
+GIT_BUILD_OPTIONS="$1"
+GIT_VERSION_FILE="$2"
+PERL_HEADER="$3"
+INPUT="$4"
+OUTPUT="$5"
+
+. "$GIT_BUILD_OPTIONS"
+. "$GIT_VERSION_FILE"
+
+sed -e '1{' \
+ -e " s|#!.*perl|#!$PERL_PATH|" \
+ -e " r $PERL_HEADER" \
+ -e ' G' \
+ -e '}' \
+ -e "s/@GIT_VERSION@/$GIT_VERSION/g" \
+ "$INPUT" >"$OUTPUT"
+chmod a+x "$OUTPUT"
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v11 09/26] Makefile: use "generate-perl.sh" to massage Perl library
2024-12-06 13:24 ` [PATCH v11 00/26] Modernize the build system Patrick Steinhardt
` (7 preceding siblings ...)
2024-12-06 13:24 ` [PATCH v11 08/26] Makefile: extract script to massage Perl scripts Patrick Steinhardt
@ 2024-12-06 13:24 ` Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 10/26] Makefile: extract script to massage Shell scripts Patrick Steinhardt
` (16 subsequent siblings)
25 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-12-06 13:24 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
Extend "generate-perl.sh" such that it knows to also massage the Perl
library files. There are two major differences:
- We do not read in the Perl header. This is handled by matching on
whether or not we have a Perl shebang.
- We substitute some more variables, which we read in via our
GIT-BUILD-OPTIONS.
Adapt both our Makefile and the CMake build instructions to use this.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-BUILD-OPTIONS.in | 2 ++
Makefile | 10 ++++------
contrib/buildsystems/CMakeLists.txt | 23 +++++++++--------------
generate-perl.sh | 14 ++++++++++++--
4 files changed, 27 insertions(+), 22 deletions(-)
diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in
index f0ca240493c94aa41a6b6241a8474e42f7cdc8b9..050432f9fc49f93d0f6ed98c1307405c52761be0 100644
--- a/GIT-BUILD-OPTIONS.in
+++ b/GIT-BUILD-OPTIONS.in
@@ -1,6 +1,8 @@
SHELL_PATH=@SHELL_PATH@
TEST_SHELL_PATH=@TEST_SHELL_PATH@
PERL_PATH=@PERL_PATH@
+PERL_LOCALEDIR=@PERL_LOCALEDIR@
+NO_PERL_CPAN_FALLBACKS=@NO_PERL_CPAN_FALLBACKS@
DIFF=@DIFF@
PYTHON_PATH=@PYTHON_PATH@
TAR=@TAR@
diff --git a/Makefile b/Makefile
index 714f1284010d4bb0c0daff0db3052a4cdf9a08f1..b6221a027aa0a093b75c278a68771d97eb387751 100644
--- a/Makefile
+++ b/Makefile
@@ -3096,13 +3096,9 @@ endif
NO_PERL_CPAN_FALLBACKS_SQ = $(subst ','\'',$(NO_PERL_CPAN_FALLBACKS))
endif
-perl/build/lib/%.pm: perl/%.pm GIT-PERL-DEFINES
+perl/build/lib/%.pm: perl/%.pm generate-perl.sh GIT-BUILD-OPTIONS GIT-VERSION-FILE GIT-PERL-DEFINES
$(call mkdir_p_parent_template)
- $(QUIET_GEN) \
- sed -e 's|@LOCALEDIR@|$(perl_localedir_SQ)|g' \
- -e 's|@NO_GETTEXT@|$(NO_GETTEXT_SQ)|g' \
- -e 's|@NO_PERL_CPAN_FALLBACKS@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \
- < $< > $@
+ $(QUIET_GEN)$(SHELL_PATH) generate-perl.sh ./GIT-BUILD-OPTIONS ./GIT-VERSION-FILE GIT-PERL-HEADER "$<" "$@"
perl/build/man/man3/Git.3pm: perl/Git.pm
$(call mkdir_p_parent_template)
@@ -3169,6 +3165,8 @@ GIT-BUILD-OPTIONS: FORCE
-e "s|@SHELL_PATH@|\'$(SHELL_PATH_SQ)\'|" \
-e "s|@TEST_SHELL_PATH@|\'$(TEST_SHELL_PATH_SQ)\'|" \
-e "s|@PERL_PATH@|\'$(PERL_PATH_SQ)\'|" \
+ -e "s|@PERL_LOCALEDIR@|\'$(perl_localedir_SQ)\'|" \
+ -e "s|@NO_PERL_CPAN_FALLBACKS@|\'$(NO_PERL_CPAN_FALLBACKS_SQ)\'|" \
-e "s|@DIFF@|\'$(DIFF)\'|" \
-e "s|@PYTHON_PATH@|\'$(PYTHON_PATH_SQ)\'|" \
-e "s|@TAR@|\'$(TAR)\'|" \
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 5cb9a209366e80ef141c6349fea9ddedb2f83d1a..52b479e2e5342c3a08c83ecf77a83504778f16a0 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -853,6 +853,9 @@ endforeach()
#perl scripts
parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" "")
+#perl modules
+file(GLOB_RECURSE perl_modules "${CMAKE_SOURCE_DIR}/perl/*.pm")
+list(TRANSFORM perl_modules REPLACE "${CMAKE_SOURCE_DIR}/" "")
#create perl header
file(STRINGS ${CMAKE_SOURCE_DIR}/perl/header_templates/fixed_prefix.template.pl perl_header )
@@ -869,9 +872,12 @@ add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/GIT-VERSION-FILE"
"${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE.in"
VERBATIM)
-foreach(script ${git_perl_scripts})
+foreach(script ${git_perl_scripts} ${perl_modules})
string(REPLACE ".perl" "" perl_gen_path "${script}")
+ get_filename_component(perl_gen_dir "${perl_gen_path}" DIRECTORY)
+ file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/${perl_gen_dir}")
+
add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/${perl_gen_path}"
COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-perl.sh"
"${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS"
@@ -893,19 +899,6 @@ file(STRINGS ${CMAKE_SOURCE_DIR}/git-p4.py content NEWLINE_CONSUME)
string(REPLACE "#!/usr/bin/env python" "#!/usr/bin/python" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/git-p4 ${content})
-#perl modules
-file(GLOB_RECURSE perl_modules "${CMAKE_SOURCE_DIR}/perl/*.pm")
-
-foreach(pm ${perl_modules})
- string(REPLACE "${CMAKE_SOURCE_DIR}/perl/" "" file_path ${pm})
- file(STRINGS ${pm} content NEWLINE_CONSUME)
- string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}")
- string(REPLACE "@NO_PERL_CPAN_FALLBACKS@" "" content "${content}")
- file(WRITE ${CMAKE_BINARY_DIR}/perl/build/lib/${file_path} ${content})
-#test-lib.sh requires perl/build/lib to be the build directory of perl modules
-endforeach()
-
-
#templates
file(GLOB templates "${CMAKE_SOURCE_DIR}/templates/*")
list(TRANSFORM templates REPLACE "${CMAKE_SOURCE_DIR}/templates/" "")
@@ -1155,6 +1148,8 @@ file(STRINGS ${CMAKE_SOURCE_DIR}/GIT-BUILD-OPTIONS.in git_build_options NEWLINE_
string(REPLACE "@SHELL_PATH@" "'${SHELL_PATH}'" git_build_options "${git_build_options}")
string(REPLACE "@TEST_SHELL_PATH@" "'${TEST_SHELL_PATH}'" git_build_options "${git_build_options}")
string(REPLACE "@PERL_PATH@" "'${PERL_PATH}'" git_build_options "${git_build_options}")
+string(REPLACE "@PERL_LOCALEDIR@" "'${LOCALEDIR}'" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PERL_CPAN_FALLBACKS@" "" git_build_options "${git_build_options}")
string(REPLACE "@DIFF@" "'${DIFF}'" git_build_options "${git_build_options}")
string(REPLACE "@PYTHON_PATH@" "'${PYTHON_PATH}'" git_build_options "${git_build_options}")
string(REPLACE "@TAR@" "'${TAR}'" git_build_options "${git_build_options}")
diff --git a/generate-perl.sh b/generate-perl.sh
index 95072522da4aaabc74164737b72568ccfe4962fc..65f122ebfc76dcce607aca07fdbd9dc9e65a6b19 100755
--- a/generate-perl.sh
+++ b/generate-perl.sh
@@ -18,10 +18,20 @@ OUTPUT="$5"
. "$GIT_VERSION_FILE"
sed -e '1{' \
+ -e " /^#!.*perl/!b" \
-e " s|#!.*perl|#!$PERL_PATH|" \
-e " r $PERL_HEADER" \
-e ' G' \
-e '}' \
- -e "s/@GIT_VERSION@/$GIT_VERSION/g" \
+ -e "s|@GIT_VERSION@|$GIT_VERSION|g" \
+ -e "s|@LOCALEDIR@|$PERL_LOCALEDIR|g" \
+ -e "s|@NO_GETTEXT@|$NO_GETTEXT|g" \
+ -e "s|@NO_PERL_CPAN_FALLBACKS@|$NO_PERL_CPAN_FALLBACKS|g" \
"$INPUT" >"$OUTPUT"
-chmod a+x "$OUTPUT"
+
+case "$INPUT" in
+*.perl)
+ chmod a+x "$OUTPUT";;
+*)
+ ;;
+esac
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v11 10/26] Makefile: extract script to massage Shell scripts
2024-12-06 13:24 ` [PATCH v11 00/26] Modernize the build system Patrick Steinhardt
` (8 preceding siblings ...)
2024-12-06 13:24 ` [PATCH v11 09/26] Makefile: use "generate-perl.sh" to massage Perl library Patrick Steinhardt
@ 2024-12-06 13:24 ` Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 11/26] Makefile: extract script to massage Python scripts Patrick Steinhardt
` (15 subsequent siblings)
25 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-12-06 13:24 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
Same as in the preceding commits, extract a script that allows us to
unify how we massage shell scripts.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-BUILD-OPTIONS.in | 4 ++++
Makefile | 34 ++++++++++------------------------
contrib/buildsystems/CMakeLists.txt | 31 ++++++++++++++++++++-----------
generate-script.sh | 34 ++++++++++++++++++++++++++++++++++
4 files changed, 68 insertions(+), 35 deletions(-)
diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in
index 050432f9fc49f93d0f6ed98c1307405c52761be0..9b95a6b3eee334b6f691702696ca9d92201b6bac 100644
--- a/GIT-BUILD-OPTIONS.in
+++ b/GIT-BUILD-OPTIONS.in
@@ -36,3 +36,7 @@ GIT_INTEROP_MAKE_OPTS=@GIT_INTEROP_MAKE_OPTS@
GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@
GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@
RUNTIME_PREFIX=@RUNTIME_PREFIX@
+GITWEBDIR=@GITWEBDIR@
+USE_GETTEXT_SCHEME=@USE_GETTEXT_SCHEME@
+LOCALEDIR=@LOCALEDIR@
+BROKEN_PATH_FIX=@BROKEN_PATH_FIX@
diff --git a/Makefile b/Makefile
index b6221a027aa0a093b75c278a68771d97eb387751..2ad644e85649f7bdea391ead6356ecee1e9e737a 100644
--- a/Makefile
+++ b/Makefile
@@ -1558,10 +1558,10 @@ endif
ifdef SANE_TOOL_PATH
SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH))
-BROKEN_PATH_FIX = 's|^\# @BROKEN_PATH_FIX@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|'
+BROKEN_PATH_FIX = s|^\# @BROKEN_PATH_FIX@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|
PATH := $(SANE_TOOL_PATH):${PATH}
else
-BROKEN_PATH_FIX = '/^\# @BROKEN_PATH_FIX@$$/d'
+BROKEN_PATH_FIX = /^\# @BROKEN_PATH_FIX@$$/d
endif
ifeq (,$(HOST_CPU))
@@ -2546,26 +2546,8 @@ GIT-SCRIPT-DEFINES: FORCE
echo "$$FLAGS" >$@; \
fi
-define cmd_munge_script
-sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
- -e 's|@DIFF@|$(DIFF_SQ)|' \
- -e 's|@LOCALEDIR@|$(localedir_SQ)|g' \
- -e 's/@USE_GETTEXT_SCHEME@/$(USE_GETTEXT_SCHEME)/g' \
- -e $(BROKEN_PATH_FIX) \
- -e 's|@GITWEBDIR@|$(gitwebdir_SQ)|g' \
- -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' \
- -e 's|@PAGER_ENV@|$(PAGER_ENV_SQ)|g' \
- $@.sh >$@+
-endef
-
-$(SCRIPT_SH_GEN) : % : %.sh GIT-SCRIPT-DEFINES
- $(QUIET_GEN)$(cmd_munge_script) && \
- chmod +x $@+ && \
- mv $@+ $@
-
-$(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEFINES
- $(QUIET_GEN)$(cmd_munge_script) && \
+$(SCRIPT_SH_GEN) $(SCRIPT_LIB) : % : %.sh generate-script.sh GIT-BUILD-OPTIONS GIT-SCRIPT-DEFINES
+ $(QUIET_GEN)./generate-script.sh "$<" "$@+" ./GIT-BUILD-OPTIONS && \
mv $@+ $@
git.rc: git.rc.in GIT-VERSION-GEN GIT-VERSION-FILE
@@ -2635,8 +2617,8 @@ GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile
perllibdir:
@echo '$(perllibdir_SQ)'
-git-instaweb: git-instaweb.sh GIT-SCRIPT-DEFINES
- $(QUIET_GEN)$(cmd_munge_script) && \
+git-instaweb: git-instaweb.sh generate-script.sh GIT-BUILD-OPTIONS GIT-SCRIPT-DEFINES
+ $(QUIET_GEN)./generate-script.sh "$<" "$@+" ./GIT-BUILD-OPTIONS && \
chmod +x $@+ && \
mv $@+ $@
else # NO_PERL
@@ -3200,6 +3182,10 @@ GIT-BUILD-OPTIONS: FORCE
-e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \
-e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \
-e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX_OPTION)\'|" \
+ -e "s|@GITWEBDIR@|\'$(gitwebdir_SQ)\'|" \
+ -e "s|@USE_GETTEXT_SCHEME@|\'$(USE_GETTEXT_SCHEME)\'|" \
+ -e "s|@LOCALEDIR@|\'$(localedir_SQ)\'|" \
+ -e "s!@BROKEN_PATH_FIX@!\'$(BROKEN_PATH_FIX)\'!" \
GIT-BUILD-OPTIONS.in >$@+
@if grep -q '^[A-Z][A-Z_]*=@.*@$$' $@+; then echo "Unsubstituted build options in $@" >&2 && exit 1; fi
@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 52b479e2e5342c3a08c83ecf77a83504778f16a0..defdd958bb64906489482b77752b1a137282824f 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -838,18 +838,23 @@ set(git_shell_scripts
${git_sh_scripts} ${git_shlib_scripts} git-instaweb)
foreach(script ${git_shell_scripts})
- file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.sh content NEWLINE_CONSUME)
- string(REPLACE "@SHELL_PATH@" "${SHELL_PATH}" content "${content}")
- string(REPLACE "@DIFF@" "diff" content "${content}")
- string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}")
- string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" content "${content}")
- string(REPLACE "@NO_CURL@" "" content "${content}")
- string(REPLACE "@USE_GETTEXT_SCHEME@" "" content "${content}")
- string(REPLACE "# @BROKEN_PATH_FIX@" "" content "${content}")
- string(REPLACE "@PERL_PATH@" "${PERL_PATH}" content "${content}")
- string(REPLACE "@PAGER_ENV@" "LESS=FRX LV=-c" content "${content}")
- file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
+ if ("${script}" IN_LIST git_sh_scripts)
+ string(REPLACE ".sh" "" shell_gen_path "${script}")
+ else()
+ set(shell_gen_path "${script}")
+ endif()
+
+ add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/${shell_gen_path}"
+ COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-script.sh"
+ "${CMAKE_SOURCE_DIR}/${script}.sh"
+ "${CMAKE_BINARY_DIR}/${shell_gen_path}"
+ "${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS"
+ DEPENDS "${CMAKE_SOURCE_DIR}/generate-script.sh"
+ "${CMAKE_SOURCE_DIR}/${script}.sh"
+ VERBATIM)
+ list(APPEND shell_gen ${CMAKE_BINARY_DIR}/${shell_gen_path})
endforeach()
+add_custom_target(shell-gen ALL DEPENDS ${shell_gen})
#perl scripts
parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" "")
@@ -1183,6 +1188,10 @@ string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_optio
string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}")
string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}")
string(REPLACE "@RUNTIME_PREFIX@" "'${RUNTIME_PREFIX}'" git_build_options "${git_build_options}")
+string(REPLACE "@GITWEBDIR@" "'${GITWEBDIR}'" git_build_options "${git_build_options}")
+string(REPLACE "@USE_GETTEXT_SCHEME@" "" git_build_options "${git_build_options}")
+string(REPLACE "@LOCALEDIR@" "'${LOCALEDIR}'" git_build_options "${git_build_options}")
+string(REPLACE "@BROKEN_PATH_FIX@" "" git_build_options "${git_build_options}")
if(USE_VCPKG)
string(APPEND git_build_options "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
endif()
diff --git a/generate-script.sh b/generate-script.sh
new file mode 100755
index 0000000000000000000000000000000000000000..a149e4f0ba348e62b963a2a95e1b250e8732fc20
--- /dev/null
+++ b/generate-script.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+set -e
+
+if test $# -ne 3
+then
+ echo >&2 "USAGE: $0 <INPUT> <OUTPUT> <GIT-BUILD-OPTIONS>"
+ exit 1
+fi
+
+INPUT="$1"
+OUTPUT="$2"
+BUILD_OPTIONS="$3"
+
+. "$BUILD_OPTIONS"
+
+sed -e "1s|#!.*/sh|#!$SHELL_PATH|" \
+ -e "s|@SHELL_PATH@|$SHELL_PATH|" \
+ -e "s|@DIFF@|$DIFF|" \
+ -e "s|@LOCALEDIR@|$LOCALEDIR|g" \
+ -e "s/@USE_GETTEXT_SCHEME@/$USE_GETTEXT_SCHEME/g" \
+ -e "$BROKEN_PATH_FIX" \
+ -e "s|@GITWEBDIR@|$GITWEBDIR|g" \
+ -e "s|@PERL_PATH@|$PERL_PATH|g" \
+ -e "s|@PAGER_ENV@|$PAGER_ENV|g" \
+ "$INPUT" >"$OUTPUT"
+
+case "$(basename "$INPUT")" in
+git-mergetool--lib.sh|git-sh-i18n.sh|git-sh-setup.sh)
+ ;;
+*)
+ chmod a+x "$OUTPUT"
+ ;;
+esac
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v11 11/26] Makefile: extract script to massage Python scripts
2024-12-06 13:24 ` [PATCH v11 00/26] Modernize the build system Patrick Steinhardt
` (9 preceding siblings ...)
2024-12-06 13:24 ` [PATCH v11 10/26] Makefile: extract script to massage Shell scripts Patrick Steinhardt
@ 2024-12-06 13:24 ` Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 12/26] Makefile: extract script to generate gitweb.cgi Patrick Steinhardt
` (14 subsequent siblings)
25 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-12-06 13:24 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
Extract a script that massages Python scripts. This provides a couple of
benefits:
- The build logic is deduplicated across Make, CMake and Meson.
- CMake learns to rewrite scripts as-needed at build time instead of
only writing them at configure time.
Furthermore, we will use this script when introducing Meson to
deduplicate the logic across build systems.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 8 ++------
contrib/buildsystems/CMakeLists.txt | 15 +++++++++++----
generate-python.sh | 20 ++++++++++++++++++++
3 files changed, 33 insertions(+), 10 deletions(-)
diff --git a/Makefile b/Makefile
index 2ad644e85649f7bdea391ead6356ecee1e9e737a..32648a1c92d378820873c50fd799f7d4614395d7 100644
--- a/Makefile
+++ b/Makefile
@@ -2635,13 +2635,9 @@ endif # NO_PERL
$(SCRIPT_PYTHON_GEN): GIT-BUILD-OPTIONS
ifndef NO_PYTHON
-$(SCRIPT_PYTHON_GEN): GIT-CFLAGS GIT-PREFIX GIT-PYTHON-VARS
+$(SCRIPT_PYTHON_GEN): generate-python.sh
$(SCRIPT_PYTHON_GEN): % : %.py
- $(QUIET_GEN) \
- sed -e '1s|#!.*python|#!$(PYTHON_PATH_SQ)|' \
- $< >$@+ && \
- chmod +x $@+ && \
- mv $@+ $@
+ $(QUIET_GEN)$(SHELL_PATH) generate-python.sh ./GIT-BUILD-OPTIONS "$<" "$@"
else # NO_PYTHON
$(SCRIPT_PYTHON_GEN): % : unimplemented.sh
$(QUIET_GEN) \
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index defdd958bb64906489482b77752b1a137282824f..93c865ee2bf0fc7eb42f21a2c015a2e1ea5cd737 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -899,10 +899,17 @@ foreach(script ${git_perl_scripts} ${perl_modules})
endforeach()
add_custom_target(perl-gen ALL DEPENDS ${perl_gen})
-#python script
-file(STRINGS ${CMAKE_SOURCE_DIR}/git-p4.py content NEWLINE_CONSUME)
-string(REPLACE "#!/usr/bin/env python" "#!/usr/bin/python" content "${content}")
-file(WRITE ${CMAKE_BINARY_DIR}/git-p4 ${content})
+# Python script
+add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/git-p4"
+ COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-python.sh"
+ "${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS"
+ "${CMAKE_SOURCE_DIR}/git-p4.py"
+ "${CMAKE_BINARY_DIR}/git-p4"
+ DEPENDS "${CMAKE_SOURCE_DIR}/generate-python.sh"
+ "${CMAKE_SOURCE_DIR}/git-p4.py"
+ "${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS"
+ VERBATIM)
+add_custom_target(python-gen ALL DEPENDS "${CMAKE_BINARY_DIR}/git-p4")
#templates
file(GLOB templates "${CMAKE_SOURCE_DIR}/templates/*")
diff --git a/generate-python.sh b/generate-python.sh
new file mode 100755
index 0000000000000000000000000000000000000000..31ac115689d9cb1736f170c3b8215592bd7baf3f
--- /dev/null
+++ b/generate-python.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+set -e
+
+if test $# -ne 3
+then
+ echo >&2 "USAGE: $0 <GIT_BUILD_OPTIONS> <INPUT> <OUTPUT>"
+ exit 1
+fi
+
+GIT_BUILD_OPTIONS="$1"
+INPUT="$2"
+OUTPUT="$3"
+
+. "$GIT_BUILD_OPTIONS"
+
+sed -e "1s|#!.*python|#!$PYTHON_PATH|" \
+ "$INPUT" >"$OUTPUT+"
+chmod a+x "$OUTPUT+"
+mv "$OUTPUT+" "$OUTPUT"
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v11 12/26] Makefile: extract script to generate gitweb.cgi
2024-12-06 13:24 ` [PATCH v11 00/26] Modernize the build system Patrick Steinhardt
` (10 preceding siblings ...)
2024-12-06 13:24 ` [PATCH v11 11/26] Makefile: extract script to massage Python scripts Patrick Steinhardt
@ 2024-12-06 13:24 ` Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 13/26] Makefile: extract script to generate gitweb.js Patrick Steinhardt
` (13 subsequent siblings)
25 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-12-06 13:24 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
In order to generate "gitweb.cgi" we have to replace various different
placeholders. This is done ad-hoc and is thus not easily reusable across
different build systems.
Introduce a new GITWEB-BUILD-OPTIONS.in template that we populate at
configuration time with the expected options. This script is then used
as input for a new "generate-gitweb.sh" script that generates the final
"gitweb.cgi" file. While this requires us to repeat the options multiple
times, it is in line to how we generate other build options like our
GIT-BUILD-OPTIONS file.
While at it, refactor how we replace the GITWEB_PROJECT_MAXDEPTH. Even
though this variable is supposed to be an integer, the source file has
the value quoted. The quotes are eventually stripped via sed(1), which
replaces `"@GITWEB_PROJECT_MAXDEPTH@"` with the actual value, which is
rather nonsensical. This is made clearer by just dropping the quotes in
the source file.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
gitweb/GITWEB-BUILD-OPTIONS.in | 24 +++++++++++++++++
gitweb/Makefile | 59 +++++++++++++++++++++---------------------
gitweb/generate-gitweb-cgi.sh | 47 +++++++++++++++++++++++++++++++++
gitweb/gitweb.perl | 2 +-
4 files changed, 101 insertions(+), 31 deletions(-)
diff --git a/gitweb/GITWEB-BUILD-OPTIONS.in b/gitweb/GITWEB-BUILD-OPTIONS.in
new file mode 100644
index 0000000000000000000000000000000000000000..41ac20654c4f79917993bafa8f7e447669552b9d
--- /dev/null
+++ b/gitweb/GITWEB-BUILD-OPTIONS.in
@@ -0,0 +1,24 @@
+PERL_PATH=@PERL_PATH@
+JSMIN=@JSMIN@
+CSSMIN=@CSSMIN@
+GIT_BINDIR=@GIT_BINDIR@
+GITWEB_CONFIG=@GITWEB_CONFIG@
+GITWEB_CONFIG_SYSTEM=@GITWEB_CONFIG_SYSTEM@
+GITWEB_CONFIG_COMMON=@GITWEB_CONFIG_COMMON@
+GITWEB_HOME_LINK_STR=@GITWEB_HOME_LINK_STR@
+GITWEB_SITENAME=@GITWEB_SITENAME@
+GITWEB_PROJECTROOT=@GITWEB_PROJECTROOT@
+GITWEB_PROJECT_MAXDEPTH=@GITWEB_PROJECT_MAXDEPTH@
+GITWEB_EXPORT_OK=@GITWEB_EXPORT_OK@
+GITWEB_STRICT_EXPORT=@GITWEB_STRICT_EXPORT@
+GITWEB_BASE_URL=@GITWEB_BASE_URL@
+GITWEB_LIST=@GITWEB_LIST@
+GITWEB_HOMETEXT=@GITWEB_HOMETEXT@
+GITWEB_CSS=@GITWEB_CSS@
+GITWEB_LOGO=@GITWEB_LOGO@
+GITWEB_FAVICON=@GITWEB_FAVICON@
+GITWEB_JS=@GITWEB_JS@
+GITWEB_SITE_HTML_HEAD_STRING=@GITWEB_SITE_HTML_HEAD_STRING@
+GITWEB_SITE_HEADER=@GITWEB_SITE_HEADER@
+GITWEB_SITE_FOOTER=@GITWEB_SITE_FOOTER@
+HIGHLIGHT_BIN=@HIGHLIGHT_BIN@
diff --git a/gitweb/Makefile b/gitweb/Makefile
index 164c8d53757f98599ad14eeb22ca8d542eb7502a..16a2ef2d1e5664d99f6f1d8ff4224c36769c55fb 100644
--- a/gitweb/Makefile
+++ b/gitweb/Makefile
@@ -77,43 +77,42 @@ GITWEB_JSLIB_FILES += static/js/javascript-detection.js
GITWEB_JSLIB_FILES += static/js/adjust-timezone.js
GITWEB_JSLIB_FILES += static/js/blame_incremental.js
-
-GITWEB_REPLACE = \
- -e 's|@GIT_VERSION@|$(GIT_VERSION)|g' \
- -e 's|@GIT_BINDIR@|$(bindir)|g' \
- -e 's|@GITWEB_CONFIG@|$(GITWEB_CONFIG)|g' \
- -e 's|@GITWEB_CONFIG_SYSTEM@|$(GITWEB_CONFIG_SYSTEM)|g' \
- -e 's|@GITWEB_CONFIG_COMMON@|$(GITWEB_CONFIG_COMMON)|g' \
- -e 's|@GITWEB_HOME_LINK_STR@|$(GITWEB_HOME_LINK_STR)|g' \
- -e 's|@GITWEB_SITENAME@|$(GITWEB_SITENAME)|g' \
- -e 's|@GITWEB_PROJECTROOT@|$(GITWEB_PROJECTROOT)|g' \
- -e 's|"@GITWEB_PROJECT_MAXDEPTH@"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
- -e 's|@GITWEB_EXPORT_OK@|$(GITWEB_EXPORT_OK)|g' \
- -e 's|@GITWEB_STRICT_EXPORT@|$(GITWEB_STRICT_EXPORT)|g' \
- -e 's|@GITWEB_BASE_URL@|$(GITWEB_BASE_URL)|g' \
- -e 's|@GITWEB_LIST@|$(GITWEB_LIST)|g' \
- -e 's|@GITWEB_HOMETEXT@|$(GITWEB_HOMETEXT)|g' \
- -e 's|@GITWEB_CSS@|$(GITWEB_CSS)|g' \
- -e 's|@GITWEB_LOGO@|$(GITWEB_LOGO)|g' \
- -e 's|@GITWEB_FAVICON@|$(GITWEB_FAVICON)|g' \
- -e 's|@GITWEB_JS@|$(GITWEB_JS)|g' \
- -e 's|@GITWEB_SITE_HTML_HEAD_STRING@|$(GITWEB_SITE_HTML_HEAD_STRING)|g' \
- -e 's|@GITWEB_SITE_HEADER@|$(GITWEB_SITE_HEADER)|g' \
- -e 's|@GITWEB_SITE_FOOTER@|$(GITWEB_SITE_FOOTER)|g' \
- -e 's|@HIGHLIGHT_BIN@|$(HIGHLIGHT_BIN)|g'
-
.PHONY: FORCE
$(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS: FORCE
- @rm -f $@+
- @echo "x" '$(PERL_PATH_SQ)' $(GITWEB_REPLACE) "$(JSMIN)|$(CSSMIN)" >$@+
+ @sed -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|' \
+ -e 's|@JSMIN@|$(JSMIN)|' \
+ -e 's|@CSSMIN@|$(CSSMIN)|' \
+ -e 's|@GIT_VERSION@|$(GIT_VERSION)|' \
+ -e 's|@GIT_BINDIR@|$(bindir)|' \
+ -e 's|@GITWEB_CONFIG@|$(GITWEB_CONFIG)|' \
+ -e 's|@GITWEB_CONFIG_SYSTEM@|$(GITWEB_CONFIG_SYSTEM)|' \
+ -e 's|@GITWEB_CONFIG_COMMON@|$(GITWEB_CONFIG_COMMON)|' \
+ -e 's|@GITWEB_HOME_LINK_STR@|$(GITWEB_HOME_LINK_STR)|' \
+ -e 's|@GITWEB_SITENAME@|$(GITWEB_SITENAME)|' \
+ -e 's|@GITWEB_PROJECTROOT@|$(GITWEB_PROJECTROOT)|' \
+ -e 's|@GITWEB_PROJECT_MAXDEPTH@|$(GITWEB_PROJECT_MAXDEPTH)|' \
+ -e 's|@GITWEB_EXPORT_OK@|$(GITWEB_EXPORT_OK)|' \
+ -e 's|@GITWEB_STRICT_EXPORT@|$(GITWEB_STRICT_EXPORT)|' \
+ -e 's|@GITWEB_BASE_URL@|$(GITWEB_BASE_URL)|' \
+ -e 's|@GITWEB_LIST@|$(GITWEB_LIST)|' \
+ -e 's|@GITWEB_HOMETEXT@|$(GITWEB_HOMETEXT)|' \
+ -e 's|@GITWEB_CSS@|$(GITWEB_CSS)|' \
+ -e 's|@GITWEB_LOGO@|$(GITWEB_LOGO)|' \
+ -e 's|@GITWEB_FAVICON@|$(GITWEB_FAVICON)|' \
+ -e 's|@GITWEB_JS@|$(GITWEB_JS)|' \
+ -e 's|@GITWEB_SITE_HTML_HEAD_STRING@|$(GITWEB_SITE_HTML_HEAD_STRING)|' \
+ -e 's|@GITWEB_SITE_HEADER@|$(GITWEB_SITE_HEADER)|' \
+ -e 's|@GITWEB_SITE_FOOTER@|$(GITWEB_SITE_FOOTER)|' \
+ -e 's|@HIGHLIGHT_BIN@|$(HIGHLIGHT_BIN)|' \
+ $(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS.in >"$@+"
@cmp -s $@+ $@ && rm -f $@+ || mv -f $@+ $@
+$(MAK_DIR_GITWEB)gitweb.cgi: $(MAK_DIR_GITWEB)generate-gitweb-cgi.sh
$(MAK_DIR_GITWEB)gitweb.cgi: $(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS
+$(MAK_DIR_GITWEB)gitweb.cgi: GIT-VERSION-FILE
$(MAK_DIR_GITWEB)gitweb.cgi: $(MAK_DIR_GITWEB)gitweb.perl
$(QUIET_GEN)$(RM) $@ $@+ && \
- sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
- $(GITWEB_REPLACE) $< >$@+ && \
- chmod +x $@+ && \
+ $(MAK_DIR_GITWEB)generate-gitweb-cgi.sh $(MAK_DIR_GITWEB)/GITWEB-BUILD-OPTIONS ./GIT-VERSION-FILE $< $@+ && \
mv $@+ $@
$(MAK_DIR_GITWEB)static/gitweb.js: $(addprefix $(MAK_DIR_GITWEB),$(GITWEB_JSLIB_FILES))
diff --git a/gitweb/generate-gitweb-cgi.sh b/gitweb/generate-gitweb-cgi.sh
new file mode 100755
index 0000000000000000000000000000000000000000..ede9038c3352d2155340c7fb1c62c467f8ce96ab
--- /dev/null
+++ b/gitweb/generate-gitweb-cgi.sh
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+set -e
+
+if test $# -ne 4
+then
+ echo >&2 "USAGE: $0 <GITWEB-BUILD-OPTIONS> <GIT-VERSION-FILE> <INPUT> <OUTPUT>"
+ exit 1
+fi
+
+GITWEB_BUILD_OPTIONS="$1"
+GIT_VERSION_FILE="$2"
+INPUT="$3"
+OUTPUT="$4"
+
+. "$GITWEB_BUILD_OPTIONS"
+. "$GIT_VERSION_FILE"
+
+sed -e "1s|#!/usr/bin/perl|#!$PERL_PATH|" \
+ -e "s|@PERL_PATH@|$PERL_PATH|" \
+ -e "s|@JSMIN@|$JSMIN|" \
+ -e "s|@CSSMIN@|$CSSMIN|" \
+ -e "s|@GIT_VERSION@|$GIT_VERSION|" \
+ -e "s|@GIT_BINDIR@|$GIT_BINDIR|" \
+ -e "s|@GITWEB_CONFIG@|$GITWEB_CONFIG|" \
+ -e "s|@GITWEB_CONFIG_SYSTEM@|$GITWEB_CONFIG_SYSTEM|" \
+ -e "s|@GITWEB_CONFIG_COMMON@|$GITWEB_CONFIG_COMMON|" \
+ -e "s|@GITWEB_HOME_LINK_STR@|$GITWEB_HOME_LINK_STR|" \
+ -e "s|@GITWEB_SITENAME@|$GITWEB_SITENAME|" \
+ -e "s|@GITWEB_PROJECTROOT@|$GITWEB_PROJECTROOT|" \
+ -e "s|@GITWEB_PROJECT_MAXDEPTH@|$GITWEB_PROJECT_MAXDEPTH|" \
+ -e "s|@GITWEB_EXPORT_OK@|$GITWEB_EXPORT_OK|" \
+ -e "s|@GITWEB_STRICT_EXPORT@|$GITWEB_STRICT_EXPORT|" \
+ -e "s|@GITWEB_BASE_URL@|$GITWEB_BASE_URL|" \
+ -e "s|@GITWEB_LIST@|$GITWEB_LIST|" \
+ -e "s|@GITWEB_HOMETEXT@|$GITWEB_HOMETEXT|" \
+ -e "s|@GITWEB_CSS@|$GITWEB_CSS|" \
+ -e "s|@GITWEB_LOGO@|$GITWEB_LOGO|" \
+ -e "s|@GITWEB_FAVICON@|$GITWEB_FAVICON|" \
+ -e "s|@GITWEB_JS@|$GITWEB_JS|" \
+ -e "s|@GITWEB_SITE_HTML_HEAD_STRING@|$GITWEB_SITE_HTML_HEAD_STRING|" \
+ -e "s|@GITWEB_SITE_HEADER@|$GITWEB_SITE_HEADER|" \
+ -e "s|@GITWEB_SITE_FOOTER@|$GITWEB_SITE_FOOTER|" \
+ -e "s|@HIGHLIGHT_BIN@|$HIGHLIGHT_BIN|" \
+ "$INPUT" >"$OUTPUT"
+
+chmod a+x "$OUTPUT"
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index dfb66fdd2aaf4df7d8aec4c70167bad6b0fee5e9..1c0a0adce43f1189088df6ebd0a2aeaee5cf459e 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -88,7 +88,7 @@ sub evaluate_uri {
# fs traversing limit for getting project list
# the number is relative to the projectroot
-our $project_maxdepth = "@GITWEB_PROJECT_MAXDEPTH@";
+our $project_maxdepth = @GITWEB_PROJECT_MAXDEPTH@;
# string of the home link on top of all pages
our $home_link_str = "@GITWEB_HOME_LINK_STR@";
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v11 13/26] Makefile: extract script to generate gitweb.js
2024-12-06 13:24 ` [PATCH v11 00/26] Modernize the build system Patrick Steinhardt
` (11 preceding siblings ...)
2024-12-06 13:24 ` [PATCH v11 12/26] Makefile: extract script to generate gitweb.cgi Patrick Steinhardt
@ 2024-12-06 13:24 ` Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 14/26] Makefile: refactor generators to be PWD-independent Patrick Steinhardt
` (12 subsequent siblings)
25 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-12-06 13:24 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
Similar to the preceding commit, also extract the script to generate the
"gitweb.js" file. While the logic itself is trivial, it helps us avoid
duplication of logic across build systems and ensures that the build
systems will remain in sync with each other in case the logic ever needs
to change.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
gitweb/Makefile | 3 ++-
gitweb/generate-gitweb-js.sh | 12 ++++++++++++
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/gitweb/Makefile b/gitweb/Makefile
index 16a2ef2d1e5664d99f6f1d8ff4224c36769c55fb..d5748e93594eb6181269c2fe272bf7ef980cbe68 100644
--- a/gitweb/Makefile
+++ b/gitweb/Makefile
@@ -115,9 +115,10 @@ $(MAK_DIR_GITWEB)gitweb.cgi: $(MAK_DIR_GITWEB)gitweb.perl
$(MAK_DIR_GITWEB)generate-gitweb-cgi.sh $(MAK_DIR_GITWEB)/GITWEB-BUILD-OPTIONS ./GIT-VERSION-FILE $< $@+ && \
mv $@+ $@
+$(MAK_DIR_GITWEB)static/gitweb.js: $(MAK_DIR_GITWEB)generate-gitweb-js.sh
$(MAK_DIR_GITWEB)static/gitweb.js: $(addprefix $(MAK_DIR_GITWEB),$(GITWEB_JSLIB_FILES))
$(QUIET_GEN)$(RM) $@ $@+ && \
- cat $^ >$@+ && \
+ $(MAK_DIR_GITWEB)generate-gitweb-js.sh $@+ $^ && \
mv $@+ $@
### Installation rules
diff --git a/gitweb/generate-gitweb-js.sh b/gitweb/generate-gitweb-js.sh
new file mode 100755
index 0000000000000000000000000000000000000000..01bb22b04b8d8910608fec6376f07d570ab02a33
--- /dev/null
+++ b/gitweb/generate-gitweb-js.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+if test "$#" -lt 2
+then
+ echo >&2 "USAGE: $0 <OUTPUT> <INPUT>..."
+ exit 1
+fi
+
+OUTPUT="$1"
+shift
+
+cat "$@" >"$OUTPUT"
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v11 14/26] Makefile: refactor generators to be PWD-independent
2024-12-06 13:24 ` [PATCH v11 00/26] Modernize the build system Patrick Steinhardt
` (12 preceding siblings ...)
2024-12-06 13:24 ` [PATCH v11 13/26] Makefile: extract script to generate gitweb.js Patrick Steinhardt
@ 2024-12-06 13:24 ` Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 15/26] Makefile: allow "bin-wrappers/" directory to exist Patrick Steinhardt
` (11 subsequent siblings)
25 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-12-06 13:24 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
We have multiple scripts that generate headers from other data. All of
these scripts have the assumption built-in that they are executed in the
current source directory, which makes them a bit unwieldy to use during
out-of-tree builds.
Refactor them to instead take the source directory as well as the output
file as arguments.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 6 +++---
contrib/buildsystems/CMakeLists.txt | 19 +++++++++--------
generate-cmdlist.sh | 42 +++++++++++++++++++++++--------------
generate-configlist.sh | 20 +++++++++++++-----
generate-hooklist.sh | 15 ++++++++++++-
5 files changed, 68 insertions(+), 34 deletions(-)
diff --git a/Makefile b/Makefile
index 32648a1c92d378820873c50fd799f7d4614395d7..884da0d42a1b7860364aae98216ad6e7134179c9 100644
--- a/Makefile
+++ b/Makefile
@@ -2523,17 +2523,17 @@ $(BUILT_INS): git$X
config-list.h: generate-configlist.sh
config-list.h: Documentation/*config.txt Documentation/config/*.txt
- $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh >$@
+ $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh . $@
command-list.h: generate-cmdlist.sh command-list.txt
command-list.h: $(wildcard Documentation/git*.txt)
$(QUIET_GEN)$(SHELL_PATH) ./generate-cmdlist.sh \
$(patsubst %,--exclude-program %,$(EXCLUDED_PROGRAMS)) \
- command-list.txt >$@
+ . $@
hook-list.h: generate-hooklist.sh Documentation/githooks.txt
- $(QUIET_GEN)$(SHELL_PATH) ./generate-hooklist.sh >$@
+ $(QUIET_GEN)$(SHELL_PATH) ./generate-hooklist.sh . $@
SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):\
$(localedir_SQ):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 93c865ee2bf0fc7eb42f21a2c015a2e1ea5cd737..e7bd45cbb68d1a313227cc6c335bba137d9d9458 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -638,23 +638,24 @@ set(EXCLUSION_PROGS_CACHE ${EXCLUSION_PROGS} CACHE STRING "Programs not built" F
if(NOT EXISTS ${CMAKE_BINARY_DIR}/command-list.h OR NOT EXCLUSION_PROGS_CACHE STREQUAL EXCLUSION_PROGS)
list(REMOVE_ITEM EXCLUSION_PROGS empty)
message("Generating command-list.h")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-cmdlist.sh ${EXCLUSION_PROGS} command-list.txt
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_FILE ${CMAKE_BINARY_DIR}/command-list.h)
+ execute_process(COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-cmdlist.sh"
+ ${EXCLUSION_PROGS}
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_BINARY_DIR}/command-list.h")
endif()
if(NOT EXISTS ${CMAKE_BINARY_DIR}/config-list.h)
message("Generating config-list.h")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-configlist.sh
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_FILE ${CMAKE_BINARY_DIR}/config-list.h)
+ execute_process(COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-configlist.sh"
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_BINARY_DIR}/config-list.h")
endif()
if(NOT EXISTS ${CMAKE_BINARY_DIR}/hook-list.h)
message("Generating hook-list.h")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-hooklist.sh
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_FILE ${CMAKE_BINARY_DIR}/hook-list.h)
+ execute_process(COMMAND "${SH_EXE}" ${CMAKE_SOURCE_DIR}/generate-hooklist.sh
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_BINARY_DIR}/hook-list.h")
endif()
include_directories(${CMAKE_BINARY_DIR})
diff --git a/generate-cmdlist.sh b/generate-cmdlist.sh
index 205541e0f7f81b1df4061215ae34a2742a45475d..b923a5aab80dfa571a40a4f6fa3d860fcf8f8dd1 100755
--- a/generate-cmdlist.sh
+++ b/generate-cmdlist.sh
@@ -64,7 +64,7 @@ define_category_names () {
print_command_list () {
echo "static struct cmdname_help command_list[] = {"
- echo "$1" |
+ echo "$2" |
while read cmd rest
do
synopsis=
@@ -76,7 +76,7 @@ print_command_list () {
break
;;
esac
- done <"Documentation/$cmd.txt"
+ done <"$1/Documentation/$cmd.txt"
printf '\t{ "%s", N_("%s"), 0' "$cmd" "$synopsis"
printf " | CAT_%s" $rest
@@ -93,18 +93,28 @@ do
shift
done
-commands="$(command_list "$1")"
-categories="$(category_list "$commands")"
+if test "$#" -ne 2
+then
+ die "USAGE: $0 <SOURCE_DIR> <OUTPUT>"
+fi
+
+SOURCE_DIR="$1"
+OUTPUT="$2"
+
+{
+ commands="$(command_list "$SOURCE_DIR"/command-list.txt)"
+ categories="$(category_list "$commands")"
-echo "/* Automatically generated by generate-cmdlist.sh */
-struct cmdname_help {
- const char *name;
- const char *help;
- uint32_t category;
-};
-"
-define_categories "$categories"
-echo
-define_category_names "$categories"
-echo
-print_command_list "$commands"
+ echo "/* Automatically generated by generate-cmdlist.sh */
+ struct cmdname_help {
+ const char *name;
+ const char *help;
+ uint32_t category;
+ };
+ "
+ define_categories "$categories"
+ echo
+ define_category_names "$categories"
+ echo
+ print_command_list "$SOURCE_DIR" "$commands"
+} >"$OUTPUT"
diff --git a/generate-configlist.sh b/generate-configlist.sh
index 8692fe5cf4d5e4025265e6110254b05640615fea..579422619cc777ff597523a4db81b99912aac3aa 100755
--- a/generate-configlist.sh
+++ b/generate-configlist.sh
@@ -1,13 +1,19 @@
#!/bin/sh
-echo "/* Automatically generated by generate-configlist.sh */"
-echo
+SOURCE_DIR="$1"
+OUTPUT="$2"
+
+if test -z "$SOURCE_DIR" || ! test -d "$SOURCE_DIR" || test -z "$OUTPUT"
+then
+ echo >&2 "USAGE: $0 <SOURCE_DIR> <OUTPUT>"
+ exit 1
+fi
print_config_list () {
cat <<EOF
static const char *config_name_list[] = {
EOF
- grep -h '^[a-zA-Z].*\..*::$' Documentation/*config.txt Documentation/config/*.txt |
+ grep -h '^[a-zA-Z].*\..*::$' "$SOURCE_DIR"/Documentation/*config.txt "$SOURCE_DIR"/Documentation/config/*.txt |
sed '/deprecated/d; s/::$//; s/, */\n/g' |
sort |
sed 's/^.*$/ "&",/'
@@ -17,5 +23,9 @@ EOF
EOF
}
-echo
-print_config_list
+{
+ echo "/* Automatically generated by generate-configlist.sh */"
+ echo
+ echo
+ print_config_list
+} >"$OUTPUT"
diff --git a/generate-hooklist.sh b/generate-hooklist.sh
index 2f9f54eb545be2bd79c37a868dbeef96d2ddfb9f..e22068c2fa4139983d685fd3bcd78e3e2a52beb0 100755
--- a/generate-hooklist.sh
+++ b/generate-hooklist.sh
@@ -2,6 +2,17 @@
#
# Usage: ./generate-hooklist.sh >hook-list.h
+SOURCE_DIR="$1"
+OUTPUT="$2"
+
+if test -z "$SOURCE_DIR" || ! test -d "$SOURCE_DIR" || test -z "$OUTPUT"
+then
+ echo >&2 "USAGE: $0 <SOURCE_DIR> <OUTPUT>"
+ exit 1
+fi
+
+{
+
cat <<EOF
/* Automatically generated by generate-hooklist.sh */
@@ -11,10 +22,12 @@ EOF
sed -n \
-e '/^~~~~*$/ {x; s/^.*$/ "&",/; p;}' \
-e 'x' \
- <Documentation/githooks.txt |
+ <"$SOURCE_DIR"/Documentation/githooks.txt |
LC_ALL=C sort
cat <<EOF
NULL,
};
EOF
+
+} >"$OUTPUT"
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v11 15/26] Makefile: allow "bin-wrappers/" directory to exist
2024-12-06 13:24 ` [PATCH v11 00/26] Modernize the build system Patrick Steinhardt
` (13 preceding siblings ...)
2024-12-06 13:24 ` [PATCH v11 14/26] Makefile: refactor generators to be PWD-independent Patrick Steinhardt
@ 2024-12-06 13:24 ` Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 16/26] Makefile: write absolute program path into bin-wrappers Patrick Steinhardt
` (10 subsequent siblings)
25 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-12-06 13:24 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
The "bin-wrappers/" directory gets created by our build system and is
populated with one script for each of our binaries. There isn't anything
inherently wrong with the current layout, but it is somewhat hard to
adapt for out-of-tree build systems.
Adapt the layout such that our "bin-wrappers/" directory always exists
and contains our "wrap-for-bin.sh" script to make things a little bit
easier for subsequent steps.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
.gitignore | 1 -
Documentation/CodingGuidelines | 2 +-
Makefile | 6 +++---
bin-wrappers/.gitignore | 9 +++++++++
wrap-for-bin.sh => bin-wrappers/wrap-for-bin.sh | 0
contrib/buildsystems/CMakeLists.txt | 6 +++---
6 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/.gitignore b/.gitignore
index d3be460040c6120d862a25dff1abd325b93b37fd..e82aa19df03fc865eaa0468f12b734cec0c48a2c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,7 +12,6 @@
/GIT-TEST-SUITES
/GIT-USER-AGENT
/GIT-VERSION-FILE
-/bin-wrappers/
/git
/git-add
/git-am
diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
index 87904791cbcea6e57d0fb3c7d4e27f2b0d80b95f..1df9d0c42f1ee7b16ecd7abc22d2653dbf9bae2e 100644
--- a/Documentation/CodingGuidelines
+++ b/Documentation/CodingGuidelines
@@ -583,7 +583,7 @@ For C programs:
Run `GIT_DEBUGGER=1 ./bin-wrappers/git foo` to simply use gdb as is, or
run `GIT_DEBUGGER="<debugger> <debugger-args>" ./bin-wrappers/git foo` to
use your own debugger and arguments. Example: `GIT_DEBUGGER="ddd --gdb"
- ./bin-wrappers/git log` (See `wrap-for-bin.sh`.)
+ ./bin-wrappers/git log` (See `bin-wrappers/wrap-for-bin.sh`.)
- The primary data structure that a subsystem 'S' deals with is called
`struct S`. Functions that operate on `struct S` are named
diff --git a/Makefile b/Makefile
index 884da0d42a1b7860364aae98216ad6e7134179c9..ed9bae0f2ed692c910cb7e5956694f72d557eb9b 100644
--- a/Makefile
+++ b/Makefile
@@ -3203,8 +3203,7 @@ test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $(
all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PROG)
-bin-wrappers/%: wrap-for-bin.sh
- $(call mkdir_p_parent_template)
+$(test_bindir_programs): bin-wrappers/%: bin-wrappers/wrap-for-bin.sh
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@BUILD_DIR@|$(shell pwd)|' \
-e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
@@ -3701,7 +3700,8 @@ clean: profile-clean coverage-clean cocciclean
$(RM) $(SP_OBJ)
$(RM) $(HCC)
$(RM) version-def.h
- $(RM) -r bin-wrappers $(dep_dirs) $(compdb_dir) compile_commands.json
+ $(RM) -r $(dep_dirs) $(compdb_dir) compile_commands.json
+ $(RM) $(test_bindir_programs)
$(RM) -r po/build/
$(RM) *.pyc *.pyo */*.pyc */*.pyo $(GENERATED_H) $(ETAGS_TARGET) tags cscope*
$(RM) -r .dist-tmp-dir .doc-tmp-dir
diff --git a/bin-wrappers/.gitignore b/bin-wrappers/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..1c6c90458b758641d0311e812563b32dd4656b48
--- /dev/null
+++ b/bin-wrappers/.gitignore
@@ -0,0 +1,9 @@
+/git
+/git-cvsserver
+/git-receive-pack
+/git-shell
+/git-upload-archive
+/git-upload-pack
+/scalar
+/test-fake-ssh
+/test-tool
diff --git a/wrap-for-bin.sh b/bin-wrappers/wrap-for-bin.sh
old mode 100644
new mode 100755
similarity index 100%
rename from wrap-for-bin.sh
rename to bin-wrappers/wrap-for-bin.sh
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index e7bd45cbb68d1a313227cc6c335bba137d9d9458..9348665f226e21dd94e0b832b938b4521e79bfbe 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -1095,20 +1095,20 @@ set(wrapper_test_scripts
foreach(script ${wrapper_scripts})
- file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
+ file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
string(REPLACE "@PROG@" "${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
foreach(script ${wrapper_test_scripts})
- file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
+ file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
string(REPLACE "@PROG@" "t/helper/${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
-file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
+file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
string(REPLACE "@PROG@" "git-cvsserver" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v11 16/26] Makefile: write absolute program path into bin-wrappers
2024-12-06 13:24 ` [PATCH v11 00/26] Modernize the build system Patrick Steinhardt
` (14 preceding siblings ...)
2024-12-06 13:24 ` [PATCH v11 15/26] Makefile: allow "bin-wrappers/" directory to exist Patrick Steinhardt
@ 2024-12-06 13:24 ` Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 17/26] Makefile: simplify building of templates Patrick Steinhardt
` (9 subsequent siblings)
25 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-12-06 13:24 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
Write the absolute program path into our bin-wrappers. This allows us to
simplify the Meson build instructions we are about to introduce a bit.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Makefile | 2 +-
bin-wrappers/wrap-for-bin.sh | 6 +++---
contrib/buildsystems/CMakeLists.txt | 6 +++---
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/Makefile b/Makefile
index ed9bae0f2ed692c910cb7e5956694f72d557eb9b..5ce4c09c3862499e83c5d50780e581a77c56ecb9 100644
--- a/Makefile
+++ b/Makefile
@@ -3206,7 +3206,7 @@ all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PR
$(test_bindir_programs): bin-wrappers/%: bin-wrappers/wrap-for-bin.sh
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@BUILD_DIR@|$(shell pwd)|' \
- -e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
+ -e 's|@PROG@|$(shell pwd)/$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
chmod +x $@
# GNU make supports exporting all variables by "export" without parameters.
diff --git a/bin-wrappers/wrap-for-bin.sh b/bin-wrappers/wrap-for-bin.sh
index 7898a1c238dde20617cf96d144930dc59f67feab..2feaec81f2bd8e908346358654c1234be34f9a06 100755
--- a/bin-wrappers/wrap-for-bin.sh
+++ b/bin-wrappers/wrap-for-bin.sh
@@ -22,15 +22,15 @@ export GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
case "$GIT_DEBUGGER" in
'')
- exec "${GIT_EXEC_PATH}/@PROG@" "$@"
+ exec "@PROG@" "$@"
;;
1)
unset GIT_DEBUGGER
- exec gdb --args "${GIT_EXEC_PATH}/@PROG@" "$@"
+ exec gdb --args "@PROG@" "$@"
;;
*)
GIT_DEBUGGER_ARGS="$GIT_DEBUGGER"
unset GIT_DEBUGGER
- exec ${GIT_DEBUGGER_ARGS} "${GIT_EXEC_PATH}/@PROG@" "$@"
+ exec ${GIT_DEBUGGER_ARGS} "@PROG@" "$@"
;;
esac
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 9348665f226e21dd94e0b832b938b4521e79bfbe..849d6b3765fd6df5ed6206ac82cc32825d43cd97 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -1097,20 +1097,20 @@ set(wrapper_test_scripts
foreach(script ${wrapper_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
- string(REPLACE "@PROG@" "${script}${EXE_EXTENSION}" content "${content}")
+ string(REPLACE "@PROG@" "${CMAKE_BINARY_DIR}/${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
foreach(script ${wrapper_test_scripts})
file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
- string(REPLACE "@PROG@" "t/helper/${script}${EXE_EXTENSION}" content "${content}")
+ string(REPLACE "@PROG@" "${CMAKE_BINARY_DIR}/t/helper/${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
-string(REPLACE "@PROG@" "git-cvsserver" content "${content}")
+string(REPLACE "@PROG@" "${CMAKE_BINARY_DIR}/git-cvsserver" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})
#options for configuring test options
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v11 17/26] Makefile: simplify building of templates
2024-12-06 13:24 ` [PATCH v11 00/26] Modernize the build system Patrick Steinhardt
` (15 preceding siblings ...)
2024-12-06 13:24 ` [PATCH v11 16/26] Makefile: write absolute program path into bin-wrappers Patrick Steinhardt
@ 2024-12-06 13:24 ` Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 18/26] Documentation: allow sourcing generated includes from separate dir Patrick Steinhardt
` (8 subsequent siblings)
25 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-12-06 13:24 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
When we install Git we also install a set of default templates that both
git-init(1) and git-clone(1) populate into our build directories. The
way the pristine templates are laid out in our source directory is
somewhat weird though: instead of reconstructing the actual directory
hierarchy in "templates/", we represent directory separators with "--".
The only reason I could come up with for why we have this is the
"branches/" directory, which is supposed to be empty when installing it.
And as Git famously doesn't store empty directories at all we have to
work around this limitation.
Now the thing is that the "branches/" directory is a leftover to how
branches used to be stored in the dark ages. gitrepository-layout(5)
lists this directory as "slightly deprecated", which I would claim is a
strong understatement. I have never encountered anybody using it today
and would be surprised if it even works as expected. So having the "--"
hack in place for an item that is basically unused, unmaintained and
deprecated doesn't only feel unreasonable, but installing that entry by
default may also cause confusion for users that do not know what this is
supposed to be in the first place.
Remove this directory from our templates and, now that we do not require
the workaround anymore, restructure the templates to form a proper
hierarchy. This makes it way easier for build systems to install these
templates into place.
We should likely think about removing support for "branch/" altogether,
but that is outside of the scope of this patch series.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
contrib/buildsystems/CMakeLists.txt | 34 +++++++------------
templates/Makefile | 39 ++++++++++++++--------
templates/branches-- | 1 -
templates/{this--description => description} | 0
.../applypatch-msg.sample} | 0
.../commit-msg.sample} | 0
.../fsmonitor-watchman.sample} | 0
.../post-update.sample} | 0
.../pre-applypatch.sample} | 0
.../pre-commit.sample} | 0
.../pre-merge-commit.sample} | 0
.../pre-push.sample} | 0
.../pre-rebase.sample} | 0
.../pre-receive.sample} | 0
.../prepare-commit-msg.sample} | 0
.../push-to-checkout.sample} | 0
.../sendemail-validate.sample} | 0
.../{hooks--update.sample => hooks/update.sample} | 0
templates/{info--exclude => info/exclude} | 0
19 files changed, 37 insertions(+), 37 deletions(-)
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 849d6b3765fd6df5ed6206ac82cc32825d43cd97..c643a444277e606313df759c9082bf3aa47e2b2b 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -99,8 +99,8 @@ project(git
#TODO Enable NLS on windows natively
#macros for parsing the Makefile for sources and scripts
-macro(parse_makefile_for_sources list_var regex)
- file(STRINGS ${CMAKE_SOURCE_DIR}/Makefile ${list_var} REGEX "^${regex} \\+=(.*)")
+macro(parse_makefile_for_sources list_var makefile regex)
+ file(STRINGS ${makefile} ${list_var} REGEX "^${regex} \\+=(.*)")
string(REPLACE "${regex} +=" "" ${list_var} ${${list_var}})
string(REPLACE "$(COMPAT_OBJS)" "" ${list_var} ${${list_var}}) #remove "$(COMPAT_OBJS)" This is only for libgit.
string(STRIP ${${list_var}} ${list_var}) #remove trailing/leading whitespaces
@@ -662,7 +662,7 @@ include_directories(${CMAKE_BINARY_DIR})
#build
#libgit
-parse_makefile_for_sources(libgit_SOURCES "LIB_OBJS")
+parse_makefile_for_sources(libgit_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "LIB_OBJS")
list(TRANSFORM libgit_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
list(TRANSFORM compat_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
@@ -680,13 +680,13 @@ list(APPEND libgit_SOURCES "${CMAKE_BINARY_DIR}/version-def.h")
add_library(libgit ${libgit_SOURCES} ${compat_SOURCES})
#libxdiff
-parse_makefile_for_sources(libxdiff_SOURCES "XDIFF_OBJS")
+parse_makefile_for_sources(libxdiff_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "XDIFF_OBJS")
list(TRANSFORM libxdiff_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
add_library(xdiff STATIC ${libxdiff_SOURCES})
#reftable
-parse_makefile_for_sources(reftable_SOURCES "REFTABLE_OBJS")
+parse_makefile_for_sources(reftable_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "REFTABLE_OBJS")
list(TRANSFORM reftable_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
add_library(reftable STATIC ${reftable_SOURCES})
@@ -757,7 +757,7 @@ elseif(UNIX)
endif()
#git
-parse_makefile_for_sources(git_SOURCES "BUILTIN_OBJS")
+parse_makefile_for_sources(git_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "BUILTIN_OBJS")
list(TRANSFORM git_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
add_executable(git ${CMAKE_SOURCE_DIR}/git.c ${git_SOURCES})
@@ -912,24 +912,14 @@ add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/git-p4"
VERBATIM)
add_custom_target(python-gen ALL DEPENDS "${CMAKE_BINARY_DIR}/git-p4")
-#templates
-file(GLOB templates "${CMAKE_SOURCE_DIR}/templates/*")
-list(TRANSFORM templates REPLACE "${CMAKE_SOURCE_DIR}/templates/" "")
-list(REMOVE_ITEM templates ".gitignore")
-list(REMOVE_ITEM templates "Makefile")
-list(REMOVE_ITEM templates "blt")# Prevents an error when reconfiguring for in source builds
-
-list(REMOVE_ITEM templates "branches--")
-file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/templates/blt/branches) #create branches
-
+#${CMAKE_SOURCE_DIR}/Makefile templates
+parse_makefile_for_sources(templates ${CMAKE_SOURCE_DIR}/templates/Makefile "TEMPLATES")
+string(REPLACE " " ";" templates ${templates})
#templates have @.*@ replacement so use configure_file instead
foreach(tm ${templates})
- string(REPLACE "--" "/" blt_tm ${tm})
- string(REPLACE "this" "" blt_tm ${blt_tm})# for this--
- configure_file(${CMAKE_SOURCE_DIR}/templates/${tm} ${CMAKE_BINARY_DIR}/templates/blt/${blt_tm} @ONLY)
+ configure_file(${CMAKE_SOURCE_DIR}/templates/${tm} ${CMAKE_BINARY_DIR}/templates/blt/${tm} @ONLY)
endforeach()
-
#translations
if(MSGFMT_EXE)
file(GLOB po_files "${CMAKE_SOURCE_DIR}/po/*.po")
@@ -1003,7 +993,7 @@ add_executable(test-fake-ssh ${CMAKE_SOURCE_DIR}/t/helper/test-fake-ssh.c)
target_link_libraries(test-fake-ssh common-main)
#unit-tests
-parse_makefile_for_sources(unit-test_SOURCES "UNIT_TEST_OBJS")
+parse_makefile_for_sources(unit-test_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "UNIT_TEST_OBJS")
list(TRANSFORM unit-test_SOURCES REPLACE "\\$\\(UNIT_TEST_DIR\\)/" "${CMAKE_SOURCE_DIR}/t/unit-tests/")
add_library(unit-test-lib STATIC ${unit-test_SOURCES})
@@ -1069,7 +1059,7 @@ if(MSVC)
endif()
#test-tool
-parse_makefile_for_sources(test-tool_SOURCES "TEST_BUILTINS_OBJS")
+parse_makefile_for_sources(test-tool_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "TEST_BUILTINS_OBJS")
add_library(test-lib OBJECT ${CMAKE_SOURCE_DIR}/t/unit-tests/test-lib.c)
list(TRANSFORM test-tool_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/t/helper/")
diff --git a/templates/Makefile b/templates/Makefile
index 367ad00c24cb34c0668eb5236dc3b08a477a65b7..bd1e9e30c120032b209fb1d221b9d93eea31c649 100644
--- a/templates/Makefile
+++ b/templates/Makefile
@@ -29,24 +29,35 @@ all: boilerplates.made custom
# in a file direc--tory--file in the source. They will be
# just copied to the destination.
-bpsrc = $(filter-out %~,$(wildcard *--*))
-boilerplates.made : $(bpsrc)
- $(QUIET)umask 022 && ls *--* 2>/dev/null | \
- while read boilerplate; \
+TEMPLATES =
+TEMPLATES += description
+TEMPLATES += hooks/applypatch-msg.sample
+TEMPLATES += hooks/commit-msg.sample
+TEMPLATES += hooks/fsmonitor-watchman.sample
+TEMPLATES += hooks/post-update.sample
+TEMPLATES += hooks/pre-applypatch.sample
+TEMPLATES += hooks/pre-commit.sample
+TEMPLATES += hooks/pre-merge-commit.sample
+TEMPLATES += hooks/prepare-commit-msg.sample
+TEMPLATES += hooks/pre-push.sample
+TEMPLATES += hooks/pre-rebase.sample
+TEMPLATES += hooks/pre-receive.sample
+TEMPLATES += hooks/push-to-checkout.sample
+TEMPLATES += hooks/sendemail-validate.sample
+TEMPLATES += hooks/update.sample
+TEMPLATES += info/exclude
+
+boilerplates.made: $(TEMPLATES)
+ $(QUIET)umask 022 && for template in $(TEMPLATES); \
do \
- case "$$boilerplate" in *~) continue ;; esac && \
- dst=`echo "$$boilerplate" | sed -e 's|^this|.|;s|--|/|g'` && \
- dir=`expr "$$dst" : '\(.*\)/'` && \
+ dir=$$(dirname "$$template") && \
mkdir -p blt/$$dir && \
- case "$$boilerplate" in \
- *--) continue;; \
- esac && \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
- -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' $$boilerplate > \
- blt/$$dst && \
- if test -x "$$boilerplate"; then rx=rx; else rx=r; fi && \
- chmod a+$$rx "blt/$$dst" || exit; \
+ -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' $$template > \
+ blt/$$template && \
+ if test -x "$$template"; then rx=rx; else rx=r; fi && \
+ chmod a+$$rx "blt/$$template" || exit; \
done && \
date >$@
diff --git a/templates/branches-- b/templates/branches--
deleted file mode 100644
index fae88709a636f3a06cc813dd64b28bfee7fa2073..0000000000000000000000000000000000000000
--- a/templates/branches--
+++ /dev/null
@@ -1 +0,0 @@
-: this is just to ensure the directory exists.
diff --git a/templates/this--description b/templates/description
similarity index 100%
rename from templates/this--description
rename to templates/description
diff --git a/templates/hooks--applypatch-msg.sample b/templates/hooks/applypatch-msg.sample
similarity index 100%
rename from templates/hooks--applypatch-msg.sample
rename to templates/hooks/applypatch-msg.sample
diff --git a/templates/hooks--commit-msg.sample b/templates/hooks/commit-msg.sample
similarity index 100%
rename from templates/hooks--commit-msg.sample
rename to templates/hooks/commit-msg.sample
diff --git a/templates/hooks--fsmonitor-watchman.sample b/templates/hooks/fsmonitor-watchman.sample
similarity index 100%
rename from templates/hooks--fsmonitor-watchman.sample
rename to templates/hooks/fsmonitor-watchman.sample
diff --git a/templates/hooks--post-update.sample b/templates/hooks/post-update.sample
similarity index 100%
rename from templates/hooks--post-update.sample
rename to templates/hooks/post-update.sample
diff --git a/templates/hooks--pre-applypatch.sample b/templates/hooks/pre-applypatch.sample
similarity index 100%
rename from templates/hooks--pre-applypatch.sample
rename to templates/hooks/pre-applypatch.sample
diff --git a/templates/hooks--pre-commit.sample b/templates/hooks/pre-commit.sample
similarity index 100%
rename from templates/hooks--pre-commit.sample
rename to templates/hooks/pre-commit.sample
diff --git a/templates/hooks--pre-merge-commit.sample b/templates/hooks/pre-merge-commit.sample
similarity index 100%
rename from templates/hooks--pre-merge-commit.sample
rename to templates/hooks/pre-merge-commit.sample
diff --git a/templates/hooks--pre-push.sample b/templates/hooks/pre-push.sample
similarity index 100%
rename from templates/hooks--pre-push.sample
rename to templates/hooks/pre-push.sample
diff --git a/templates/hooks--pre-rebase.sample b/templates/hooks/pre-rebase.sample
similarity index 100%
rename from templates/hooks--pre-rebase.sample
rename to templates/hooks/pre-rebase.sample
diff --git a/templates/hooks--pre-receive.sample b/templates/hooks/pre-receive.sample
similarity index 100%
rename from templates/hooks--pre-receive.sample
rename to templates/hooks/pre-receive.sample
diff --git a/templates/hooks--prepare-commit-msg.sample b/templates/hooks/prepare-commit-msg.sample
similarity index 100%
rename from templates/hooks--prepare-commit-msg.sample
rename to templates/hooks/prepare-commit-msg.sample
diff --git a/templates/hooks--push-to-checkout.sample b/templates/hooks/push-to-checkout.sample
similarity index 100%
rename from templates/hooks--push-to-checkout.sample
rename to templates/hooks/push-to-checkout.sample
diff --git a/templates/hooks--sendemail-validate.sample b/templates/hooks/sendemail-validate.sample
similarity index 100%
rename from templates/hooks--sendemail-validate.sample
rename to templates/hooks/sendemail-validate.sample
diff --git a/templates/hooks--update.sample b/templates/hooks/update.sample
similarity index 100%
rename from templates/hooks--update.sample
rename to templates/hooks/update.sample
diff --git a/templates/info--exclude b/templates/info/exclude
similarity index 100%
rename from templates/info--exclude
rename to templates/info/exclude
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v11 18/26] Documentation: allow sourcing generated includes from separate dir
2024-12-06 13:24 ` [PATCH v11 00/26] Modernize the build system Patrick Steinhardt
` (16 preceding siblings ...)
2024-12-06 13:24 ` [PATCH v11 17/26] Makefile: simplify building of templates Patrick Steinhardt
@ 2024-12-06 13:24 ` Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 19/26] Documentation: teach "cmd-list.perl" about out-of-tree builds Patrick Steinhardt
` (7 subsequent siblings)
25 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-12-06 13:24 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
Our documentation uses "include::" directives to include parts that are
either reused across multiple documents or parts that we generate at
build time. Unfortunately, top-level includes are only ever resolved
relative to the base directory, which is typically the directory of the
including document. Most importantly, it is not possible to have either
asciidoc or asciidoctor search multiple directories.
It follows that both kinds of includes must live in the same directory.
This is of course a bummer for out-of-tree builds, because here the
dynamically-built includes live in the build directory whereas the
static includes live in the source directory.
Introduce a `build_dir` attribute and prepend it to all of our includes
for dynamically-built files. This attribute gets set to the build
directory and thus converts the include path to an absolute path, which
asciidoc and asciidoctor know how to resolve.
Note that this change also requires us to update "build-docdep.perl",
which tries to figure out included files such our Makefile can set up
proper build-time dependencies. This script simply scans through the
source files for any lines that match "^include::" and treats the
remainder of the line as included file path. But given that those may
now contain the "{build_dir}" variable we have to teach the script to
replace that attribute with the actual build directory.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Documentation/Makefile | 3 ++-
Documentation/build-docdep.perl | 2 ++
Documentation/config/diff.txt | 2 +-
Documentation/config/merge.txt | 2 +-
Documentation/git.txt | 24 ++++++++++++------------
5 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 9371f294254fb77c08a695daff0dd35f4073db4f..a74fc0ff3d3721daa991c675b3f1f212e6e1e243 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -224,6 +224,7 @@ SHELL_PATH ?= $(SHELL)
# Shell quote;
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
+ASCIIDOC_EXTRA += -abuild_dir='$(shell pwd)'
ifdef DEFAULT_PAGER
DEFAULT_PAGER_SQ = $(subst ','\'',$(DEFAULT_PAGER))
ASCIIDOC_EXTRA += -a 'git-default-pager=$(DEFAULT_PAGER_SQ)'
@@ -289,7 +290,7 @@ docdep_prereqs = \
cmd-list.made $(cmds_txt)
doc.dep : $(docdep_prereqs) $(DOC_DEP_TXT) build-docdep.perl
- $(QUIET_GEN)$(PERL_PATH) ./build-docdep.perl >$@ $(QUIET_STDERR)
+ $(QUIET_GEN)$(PERL_PATH) ./build-docdep.perl "$(shell pwd)" >$@ $(QUIET_STDERR)
ifneq ($(MAKECMDGOALS),clean)
-include doc.dep
diff --git a/Documentation/build-docdep.perl b/Documentation/build-docdep.perl
index 1b3ac8fdd95fa1d57afbdffb1a9743f36ed22fdd..315efaa2fa2f2efc89b2c8073cc97cd2cc83611c 100755
--- a/Documentation/build-docdep.perl
+++ b/Documentation/build-docdep.perl
@@ -1,5 +1,6 @@
#!/usr/bin/perl
+my ($build_dir) = @ARGV;
my %include = ();
my %included = ();
@@ -10,6 +11,7 @@
chomp;
s/^include::\s*//;
s/\[\]//;
+ s/{build_dir}/${build_dir}/;
$include{$text}{$_} = 1;
$included{$_} = 1;
}
diff --git a/Documentation/config/diff.txt b/Documentation/config/diff.txt
index 45f3fe855c5bb41472281d49d6b09f98dd374529..fdae13a2122935f549874b4d0af95f94d61fc886 100644
--- a/Documentation/config/diff.txt
+++ b/Documentation/config/diff.txt
@@ -218,7 +218,7 @@ endif::git-diff[]
Set this option to `true` to make the diff driver cache the text
conversion outputs. See linkgit:gitattributes[5] for details.
-include::../mergetools-diff.txt[]
+include::{build_dir}/mergetools-diff.txt[]
`diff.indentHeuristic`::
Set this option to `false` to disable the default heuristics
diff --git a/Documentation/config/merge.txt b/Documentation/config/merge.txt
index 8851b6cedef980c106b9e86541862b517aa1f2ad..82554d65a0aa0826fdb53c5d834389d38f308e3e 100644
--- a/Documentation/config/merge.txt
+++ b/Documentation/config/merge.txt
@@ -101,7 +101,7 @@ merge.guitool::
Any other value is treated as a custom merge tool and requires that a
corresponding mergetool.<guitool>.cmd variable is defined.
-include::../mergetools-merge.txt[]
+include::{build_dir}/mergetools-merge.txt[]
merge.verbosity::
Controls the amount of output shown by the recursive merge
diff --git a/Documentation/git.txt b/Documentation/git.txt
index d15a8697625d6b6c598a2bc774bf243675ab68ea..44f0797ccffb1a7359bee9c20182953293b70d6d 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -245,17 +245,17 @@ ancillary user utilities.
Main porcelain commands
~~~~~~~~~~~~~~~~~~~~~~~
-include::cmds-mainporcelain.txt[]
+include::{build_dir}/cmds-mainporcelain.txt[]
Ancillary Commands
~~~~~~~~~~~~~~~~~~
Manipulators:
-include::cmds-ancillarymanipulators.txt[]
+include::{build_dir}/cmds-ancillarymanipulators.txt[]
Interrogators:
-include::cmds-ancillaryinterrogators.txt[]
+include::{build_dir}/cmds-ancillaryinterrogators.txt[]
Interacting with Others
@@ -264,7 +264,7 @@ Interacting with Others
These commands are to interact with foreign SCM and with other
people via patch over e-mail.
-include::cmds-foreignscminterface.txt[]
+include::{build_dir}/cmds-foreignscminterface.txt[]
Reset, restore and revert
~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -313,13 +313,13 @@ repositories.
Manipulation commands
~~~~~~~~~~~~~~~~~~~~~
-include::cmds-plumbingmanipulators.txt[]
+include::{build_dir}/cmds-plumbingmanipulators.txt[]
Interrogation commands
~~~~~~~~~~~~~~~~~~~~~~
-include::cmds-plumbinginterrogators.txt[]
+include::{build_dir}/cmds-plumbinginterrogators.txt[]
In general, the interrogate commands do not touch the files in
the working tree.
@@ -328,12 +328,12 @@ the working tree.
Syncing repositories
~~~~~~~~~~~~~~~~~~~~
-include::cmds-synchingrepositories.txt[]
+include::{build_dir}/cmds-synchingrepositories.txt[]
The following are helper commands used by the above; end users
typically do not use them directly.
-include::cmds-synchelpers.txt[]
+include::{build_dir}/cmds-synchelpers.txt[]
Internal helper commands
@@ -342,14 +342,14 @@ Internal helper commands
These are internal helper commands used by other commands; end
users typically do not use them directly.
-include::cmds-purehelpers.txt[]
+include::{build_dir}/cmds-purehelpers.txt[]
Guides
------
The following documentation pages are guides about Git concepts.
-include::cmds-guide.txt[]
+include::{build_dir}/cmds-guide.txt[]
Repository, command and file interfaces
---------------------------------------
@@ -358,7 +358,7 @@ This documentation discusses repository and command interfaces which
users are expected to interact with directly. See `--user-formats` in
linkgit:git-help[1] for more details on the criteria.
-include::cmds-userinterfaces.txt[]
+include::{build_dir}/cmds-userinterfaces.txt[]
File formats, protocols and other developer interfaces
------------------------------------------------------
@@ -367,7 +367,7 @@ This documentation discusses file formats, over-the-wire protocols and
other git developer interfaces. See `--developer-interfaces` in
linkgit:git-help[1].
-include::cmds-developerinterfaces.txt[]
+include::{build_dir}/cmds-developerinterfaces.txt[]
Configuration Mechanism
-----------------------
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v11 19/26] Documentation: teach "cmd-list.perl" about out-of-tree builds
2024-12-06 13:24 ` [PATCH v11 00/26] Modernize the build system Patrick Steinhardt
` (17 preceding siblings ...)
2024-12-06 13:24 ` [PATCH v11 18/26] Documentation: allow sourcing generated includes from separate dir Patrick Steinhardt
@ 2024-12-06 13:24 ` Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 20/26] Documentation: extract script to generate a list of mergetools Patrick Steinhardt
` (6 subsequent siblings)
25 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-12-06 13:24 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
The "cmd-list.perl" script generates a list of commands that can be
included into our manpages. The script doesn't know about out-of-tree
builds and instead writes resulting files into the source directory.
Adapt it such that we can read data from the source directory and write
data into the build directory.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Documentation/Makefile | 2 +-
Documentation/cmd-list.perl | 23 ++++++++++++-----------
2 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/Documentation/Makefile b/Documentation/Makefile
index a74fc0ff3d3721daa991c675b3f1f212e6e1e243..e853d89eb5d6c89eb7e7bf10c5b75e5ad0db531b 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -312,7 +312,7 @@ cmds_txt = cmds-ancillaryinterrogators.txt \
$(cmds_txt): cmd-list.made
cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
- $(QUIET_GEN)$(PERL_PATH) ./cmd-list.perl ../command-list.txt $(cmds_txt) $(QUIET_STDERR) && \
+ $(QUIET_GEN)$(PERL_PATH) ./cmd-list.perl .. . $(cmds_txt) && \
date >$@
mergetools_txt = mergetools-diff.txt mergetools-merge.txt
diff --git a/Documentation/cmd-list.perl b/Documentation/cmd-list.perl
index 755a110bc48d7e2b596651ca13664c01192d966c..e260a989774071b66d2b56c56c5045b84a508c5c 100755
--- a/Documentation/cmd-list.perl
+++ b/Documentation/cmd-list.perl
@@ -3,12 +3,13 @@
use File::Compare qw(compare);
sub format_one {
- my ($out, $nameattr) = @_;
+ my ($source_dir, $out, $nameattr) = @_;
my ($name, $attr) = @$nameattr;
+ my ($path) = "$source_dir/Documentation/$name.txt";
my ($state, $description);
my $mansection;
$state = 0;
- open I, '<', "$name.txt" or die "No such file $name.txt";
+ open I, '<', "$path" or die "No such file $path.txt";
while (<I>) {
if (/^(?:git|scalar)[a-z0-9-]*\(([0-9])\)$/) {
$mansection = $1;
@@ -29,7 +30,7 @@ sub format_one {
}
close I;
if (!defined $description) {
- die "No description found in $name.txt";
+ die "No description found in $path.txt";
}
if (my ($verify_name, $text) = ($description =~ /^($name) - (.*)/)) {
print $out "linkgit:$name\[$mansection\]::\n\t";
@@ -43,9 +44,9 @@ sub format_one {
}
}
-my ($input, @categories) = @ARGV;
+my ($source_dir, $build_dir, @categories) = @ARGV;
-open IN, "<$input";
+open IN, "<$source_dir/command-list.txt";
while (<IN>) {
last if /^### command list/;
}
@@ -63,17 +64,17 @@ sub format_one {
for my $out (@categories) {
my ($cat) = $out =~ /^cmds-(.*)\.txt$/;
- open O, '>', "$out+" or die "Cannot open output file $out+";
+ my ($path) = "$build_dir/$out";
+ open O, '>', "$path+" or die "Cannot open output file $out+";
for (@{$cmds{$cat}}) {
- format_one(\*O, $_);
+ format_one($source_dir, \*O, $_);
}
close O;
- if (-f "$out" && compare("$out", "$out+") == 0) {
- unlink "$out+";
+ if (-f "$path" && compare("$path", "$path+") == 0) {
+ unlink "$path+";
}
else {
- print STDERR "$out\n";
- rename "$out+", "$out";
+ rename "$path+", "$path";
}
}
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v11 20/26] Documentation: extract script to generate a list of mergetools
2024-12-06 13:24 ` [PATCH v11 00/26] Modernize the build system Patrick Steinhardt
` (18 preceding siblings ...)
2024-12-06 13:24 ` [PATCH v11 19/26] Documentation: teach "cmd-list.perl" about out-of-tree builds Patrick Steinhardt
@ 2024-12-06 13:24 ` Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 21/26] t: better support for out-of-tree builds Patrick Steinhardt
` (5 subsequent siblings)
25 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-12-06 13:24 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
We include the list of available mergetools into our manpages. Extract
the script that performs this logic such that we can reuse it in other
build systems.
While at it, refactor the Makefile targets such that we don't create
"mergetools-list.made" anymore. It shouldn't be necessary, as we can
instead have other targets depend on "mergetools-{diff,merge}.txt"
directly.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Documentation/Makefile | 22 ++++++++--------------
Documentation/generate-mergetool-list.sh | 17 +++++++++++++++++
2 files changed, 25 insertions(+), 14 deletions(-)
diff --git a/Documentation/Makefile b/Documentation/Makefile
index e853d89eb5d6c89eb7e7bf10c5b75e5ad0db531b..f0e5bc9c0c64ddf83b2d9fde0bf877a4f4b847f3 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -282,11 +282,13 @@ ifneq ($(filter-out lint-docs clean,$(MAKECMDGOALS)),)
-include ../GIT-VERSION-FILE
endif
+mergetools_txt = mergetools-diff.txt mergetools-merge.txt
+
#
# Determine "include::" file references in asciidoc files.
#
docdep_prereqs = \
- mergetools-list.made $(mergetools_txt) \
+ $(mergetools_txt) \
cmd-list.made $(cmds_txt)
doc.dep : $(docdep_prereqs) $(DOC_DEP_TXT) build-docdep.perl
@@ -315,19 +317,11 @@ cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
$(QUIET_GEN)$(PERL_PATH) ./cmd-list.perl .. . $(cmds_txt) && \
date >$@
-mergetools_txt = mergetools-diff.txt mergetools-merge.txt
-
-$(mergetools_txt): mergetools-list.made
-
-mergetools-list.made: ../git-mergetool--lib.sh $(wildcard ../mergetools/*)
- $(QUIET_GEN) \
- $(SHELL_PATH) -c 'MERGE_TOOLS_DIR=../mergetools && TOOL_MODE=diff && \
- . ../git-mergetool--lib.sh && \
- show_tool_names can_diff' | sed -e "s/\([a-z0-9]*\)/\`\1\`;;/" >mergetools-diff.txt && \
- $(SHELL_PATH) -c 'MERGE_TOOLS_DIR=../mergetools && TOOL_MODE=merge && \
- . ../git-mergetool--lib.sh && \
- show_tool_names can_merge' | sed -e "s/\([a-z0-9]*\)/\`\1\`;;/" >mergetools-merge.txt && \
- date >$@
+mergetools-%.txt: generate-mergetool-list.sh ../git-mergetool--lib.sh $(wildcard ../mergetools/*)
+mergetools-diff.txt:
+ $(QUIET_GEN)$(SHELL_PATH) ./generate-mergetool-list.sh .. diff $@
+mergetools-merge.txt:
+ $(QUIET_GEN)$(SHELL_PATH) ./generate-mergetool-list.sh .. merge $@
TRACK_ASCIIDOCFLAGS = $(subst ','\'',$(ASCIIDOC_COMMON):$(ASCIIDOC_HTML):$(ASCIIDOC_DOCBOOK))
diff --git a/Documentation/generate-mergetool-list.sh b/Documentation/generate-mergetool-list.sh
new file mode 100755
index 0000000000000000000000000000000000000000..6700498b93be5358d992530b8dee39c08f02bd8d
--- /dev/null
+++ b/Documentation/generate-mergetool-list.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+if test "$#" -ne 3
+then
+ echo >&2 "USAGE: $0 <SOURCE_DIR> <MODE> <OUTPUT>"
+ exit 1
+fi
+
+SOURCE_DIR="$1"
+TOOL_MODE="$2"
+OUTPUT="$3"
+MERGE_TOOLS_DIR="$SOURCE_DIR/mergetools"
+
+(
+ . "$SOURCE_DIR"/git-mergetool--lib.sh &&
+ show_tool_names can_$TOOL_MODE
+) | sed -e "s/\([a-z0-9]*\)/\`\1\`;;/" >"$OUTPUT"
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v11 21/26] t: better support for out-of-tree builds
2024-12-06 13:24 ` [PATCH v11 00/26] Modernize the build system Patrick Steinhardt
` (19 preceding siblings ...)
2024-12-06 13:24 ` [PATCH v11 20/26] Documentation: extract script to generate a list of mergetools Patrick Steinhardt
@ 2024-12-06 13:24 ` Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 22/26] t: allow overriding build dir Patrick Steinhardt
` (4 subsequent siblings)
25 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-12-06 13:24 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
Our in-tree builds used by the Makefile use various different build
directories scattered around different locations. The paths to those
build directories have to be propagated to our tests such that they can
find the contained files. This is done via a mixture of hardcoded paths
in our test library and injected variables in our bin-wrappers or
"GIT-BUILD-OPTIONS".
The latter two mechanisms are preferable over using hardcoded paths. For
one, we have all paths which are subject to change stored in a small set
of central files instead of having the knowledge of build paths in many
files. And second, it allows build systems which build files elsewhere
to adapt those paths based on their own needs. This is especially nice
in the context of build systems that use out-of-tree builds like CMake
or Meson.
Remove hardcoded knowledge of build paths from our test library and move
it into our bin-wrappers and "GIT-BUILD-OPTIONS".
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
GIT-BUILD-OPTIONS.in | 5 +++++
Makefile | 9 +++++++++
bin-wrappers/wrap-for-bin.sh | 11 ++++++-----
contrib/buildsystems/CMakeLists.txt | 8 ++++++++
t/lib-gettext.sh | 4 ++--
t/t7609-mergetool--lib.sh | 2 +-
t/test-lib.sh | 6 +++---
7 files changed, 34 insertions(+), 11 deletions(-)
diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in
index 9b95a6b3eee334b6f691702696ca9d92201b6bac..f651116102ae2977622dccd12b199fe7ad65af99 100644
--- a/GIT-BUILD-OPTIONS.in
+++ b/GIT-BUILD-OPTIONS.in
@@ -35,6 +35,11 @@ GIT_PERF_MAKE_COMMAND=@GIT_PERF_MAKE_COMMAND@
GIT_INTEROP_MAKE_OPTS=@GIT_INTEROP_MAKE_OPTS@
GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@
GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@
+GIT_TEST_TEXTDOMAINDIR=@GIT_TEST_TEXTDOMAINDIR@
+GIT_TEST_POPATH=@GIT_TEST_POPATH@
+GIT_TEST_TEMPLATE_DIR=@GIT_TEST_TEMPLATE_DIR@
+GIT_TEST_GITPERLLIB=@GIT_TEST_GITPERLLIB@
+GIT_TEST_MERGE_TOOLS_DIR=@GIT_TEST_MERGE_TOOLS_DIR@
RUNTIME_PREFIX=@RUNTIME_PREFIX@
GITWEBDIR=@GITWEBDIR@
USE_GETTEXT_SCHEME=@USE_GETTEXT_SCHEME@
diff --git a/Makefile b/Makefile
index 5ce4c09c3862499e83c5d50780e581a77c56ecb9..06f01149ecf399ae4bb1932188a007948d767283 100644
--- a/Makefile
+++ b/Makefile
@@ -3177,6 +3177,11 @@ GIT-BUILD-OPTIONS: FORCE
-e "s|@GIT_INTEROP_MAKE_OPTS@|\'$(GIT_INTEROP_MAKE_OPTS)\'|" \
-e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \
-e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \
+ -e "s|@GIT_TEST_TEXTDOMAINDIR@|\'$(shell pwd)/po/build/locale\'|" \
+ -e "s|@GIT_TEST_POPATH@|\'$(shell pwd)/po\'|" \
+ -e "s|@GIT_TEST_TEMPLATE_DIR@|\'$(shell pwd)/templates/blt\'|" \
+ -e "s|@GIT_TEST_GITPERLLIB@|\'$(shell pwd)/perl/build/lib\'|" \
+ -e "s|@GIT_TEST_MERGE_TOOLS_DIR@|\'$(shell pwd)/mergetools\'|" \
-e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX_OPTION)\'|" \
-e "s|@GITWEBDIR@|\'$(gitwebdir_SQ)\'|" \
-e "s|@USE_GETTEXT_SCHEME@|\'$(USE_GETTEXT_SCHEME)\'|" \
@@ -3206,6 +3211,10 @@ all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PR
$(test_bindir_programs): bin-wrappers/%: bin-wrappers/wrap-for-bin.sh
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@BUILD_DIR@|$(shell pwd)|' \
+ -e 's|@GIT_TEXTDOMAINDIR@|$(shell pwd)/po/build/locale|' \
+ -e 's|@GITPERLLIB@|$(shell pwd)/perl/build/lib|' \
+ -e 's|@MERGE_TOOLS_DIR@|$(shell pwd)/mergetools|' \
+ -e 's|@TEMPLATE_DIR@|$(shell pwd)/templates/blt|' \
-e 's|@PROG@|$(shell pwd)/$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
chmod +x $@
diff --git a/bin-wrappers/wrap-for-bin.sh b/bin-wrappers/wrap-for-bin.sh
index 2feaec81f2bd8e908346358654c1234be34f9a06..4b658ffd2d09609b6622903bcdf470780f33e6cc 100755
--- a/bin-wrappers/wrap-for-bin.sh
+++ b/bin-wrappers/wrap-for-bin.sh
@@ -4,21 +4,22 @@
# to run test suite against sandbox, but with only bindir-installed
# executables in PATH. The Makefile copies this into various
# files in bin-wrappers, substituting
-# @BUILD_DIR@ and @PROG@.
+# @BUILD_DIR@, @TEMPLATE_DIR@ and @PROG@.
GIT_EXEC_PATH='@BUILD_DIR@'
if test -n "$NO_SET_GIT_TEMPLATE_DIR"
then
unset GIT_TEMPLATE_DIR
else
- GIT_TEMPLATE_DIR='@BUILD_DIR@/templates/blt'
+ GIT_TEMPLATE_DIR='@TEMPLATE_DIR@'
export GIT_TEMPLATE_DIR
fi
-GITPERLLIB='@BUILD_DIR@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}"
-GIT_TEXTDOMAINDIR='@BUILD_DIR@/po/build/locale'
+MERGE_TOOLS_DIR='@MERGE_TOOLS_DIR@'
+GITPERLLIB='@GITPERLLIB@'"${GITPERLLIB:+:$GITPERLLIB}"
+GIT_TEXTDOMAINDIR='@GIT_TEXTDOMAINDIR@'
PATH='@BUILD_DIR@/bin-wrappers:'"$PATH"
-export GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
+export MERGE_TOOLS_DIR GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
case "$GIT_DEBUGGER" in
'')
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index c643a444277e606313df759c9082bf3aa47e2b2b..49904ca8a93981c514540bad5efa6833ddd14426 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -1100,6 +1100,9 @@ endforeach()
file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+string(REPLACE "@GIT_TEXTDOMAINDIR@" "${CMAKE_BINARY_DIR}/po/build/locale" content "${content}")
+string(REPLACE "@GITPERLLIB@" "${CMAKE_BINARY_DIR}/perl/build/lib" content "${content}")
+string(REPLACE "@MERGE_TOOLS_DIR@" "${CMAKE_SOURCE_DIR}/mergetools" content "${content}")
string(REPLACE "@PROG@" "${CMAKE_BINARY_DIR}/git-cvsserver" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})
@@ -1185,6 +1188,11 @@ string(REPLACE "@GIT_PERF_MAKE_COMMAND@" "" git_build_options "${git_build_optio
string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_options}")
string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}")
string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_TEXTDOMAINDIR@" "'${CMAKE_BINARY_DIR}/po/build/locale'" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_POPATH@" "'${CMAKE_BINARY_DIR}/po'" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_TEMPLATE_DIR@" "'${CMAKE_BINARY_DIR}/templates/blt'" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_GITPERLLIB@" "'${CMAKE_BINARY_DIR}/perl/build/lib'" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_MERGE_TOOLS_DIR@" "'${RUNTIME_PREFIX}'" git_build_options "${git_build_options}")
string(REPLACE "@RUNTIME_PREFIX@" "'${RUNTIME_PREFIX}'" git_build_options "${git_build_options}")
string(REPLACE "@GITWEBDIR@" "'${GITWEBDIR}'" git_build_options "${git_build_options}")
string(REPLACE "@USE_GETTEXT_SCHEME@" "" git_build_options "${git_build_options}")
diff --git a/t/lib-gettext.sh b/t/lib-gettext.sh
index cc6bb2cdeaae7b5bb23211c0d9c37c9deb39e14f..7a734c6973e65995d3403a26cc9e5c1a5a1ce074 100644
--- a/t/lib-gettext.sh
+++ b/t/lib-gettext.sh
@@ -6,8 +6,8 @@
. ./test-lib.sh
-GIT_TEXTDOMAINDIR="$GIT_BUILD_DIR/po/build/locale"
-GIT_PO_PATH="$GIT_BUILD_DIR/po"
+GIT_TEXTDOMAINDIR="$GIT_TEST_TEXTDOMAINDIR"
+GIT_PO_PATH="$GIT_TEST_POPATH"
export GIT_TEXTDOMAINDIR GIT_PO_PATH
if test -n "$GIT_TEST_INSTALLED"
diff --git a/t/t7609-mergetool--lib.sh b/t/t7609-mergetool--lib.sh
index 330d6d603d77236788ee932cdcc288731a7aa388..e8e205707e4ef7cdbdd73633961822911af4fd0a 100755
--- a/t/t7609-mergetool--lib.sh
+++ b/t/t7609-mergetool--lib.sh
@@ -7,7 +7,7 @@ Testing basic merge tools options'
. ./test-lib.sh
test_expect_success 'mergetool --tool=vimdiff creates the expected layout' '
- . "$GIT_BUILD_DIR"/mergetools/vimdiff &&
+ . "$GIT_TEST_MERGE_TOOLS_DIR"/vimdiff &&
run_unit_tests
'
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 20012f6f474c96afdcf66a240dd6b6b573073e46..fe688a3fce7a7bbbe92bf721ee483cabd87e4654 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1419,7 +1419,7 @@ else # normal case, use ../bin-wrappers only unless $with_dashes:
PATH="$GIT_BUILD_DIR:$GIT_BUILD_DIR/t/helper:$PATH"
fi
fi
-GIT_TEMPLATE_DIR="$GIT_BUILD_DIR"/templates/blt
+GIT_TEMPLATE_DIR="$GIT_TEST_TEMPLATE_DIR"
GIT_CONFIG_NOSYSTEM=1
GIT_ATTR_NOSYSTEM=1
GIT_CEILING_DIRECTORIES="$TRASH_DIRECTORY/.."
@@ -1485,9 +1485,9 @@ then
fi
fi
-GITPERLLIB="$GIT_BUILD_DIR"/perl/build/lib
+GITPERLLIB="$GIT_TEST_GITPERLLIB"
export GITPERLLIB
-test -d "$GIT_BUILD_DIR"/templates/blt || {
+test -d "$GIT_TEMPLATE_DIR" || {
BAIL_OUT "You haven't built things yet, have you?"
}
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v11 22/26] t: allow overriding build dir
2024-12-06 13:24 ` [PATCH v11 00/26] Modernize the build system Patrick Steinhardt
` (20 preceding siblings ...)
2024-12-06 13:24 ` [PATCH v11 21/26] t: better support for out-of-tree builds Patrick Steinhardt
@ 2024-12-06 13:24 ` Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 23/26] Documentation: add comparison of build systems Patrick Steinhardt
` (3 subsequent siblings)
25 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-12-06 13:24 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
Our "test-lib.sh" assumes that our build directory is the parent
directory of "t/". While true when using our Makefile, it's not when
using build systems that support out-of-tree builds.
In commit ee9e66e4e7 (cmake: avoid editing t/test-lib.sh, 2022-10-18),
we have introduce support for overriding the GIT_BUILD_DIR by creating
the file "$GIT_BUILD_DIR/GIT-BUILD-DIR" with its contents pointing to
the location of the build directory. The intent was to stop modifying
"t/test-lib.sh" with the CMake build systems while allowing out-of-tree
builds. But "$GIT_BUILD_DIR" is somewhat misleadingly named, as it in
fact points to the _source_ directory. So while that commit solved part
of the problem for out-of-tree builds, CMake still has to write files
into the source tree.
Solve the second part of the problem, namely not having to write any
data into the source directory at all, by also supporting an environment
variable that allows us to point to a different build directory. This
allows us to perform properly self-contained out-of-tree builds.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
t/test-lib.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index fe688a3fce7a7bbbe92bf721ee483cabd87e4654..62dfcc4aaf959d0cf066d07663d939e14f92485c 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -35,7 +35,7 @@ else
# needing to exist.
TEST_DIRECTORY=$(cd "$TEST_DIRECTORY" && pwd) || exit 1
fi
-GIT_BUILD_DIR="${TEST_DIRECTORY%/t}"
+GIT_BUILD_DIR="${GIT_BUILD_DIR:-${TEST_DIRECTORY%/t}}"
if test "$TEST_DIRECTORY" = "$GIT_BUILD_DIR"
then
echo "PANIC: Running in a $TEST_DIRECTORY that doesn't end in '/t'?" >&2
@@ -522,6 +522,7 @@ unset VISUAL EMAIL LANGUAGE $("$PERL_PATH" -e '
PERF_
CURL_VERBOSE
TRACE_CURL
+ BUILD_DIR
));
my @vars = grep(/^GIT_/ && !/^GIT_($ok)/o, @env);
print join("\n", @vars);
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v11 23/26] Documentation: add comparison of build systems
2024-12-06 13:24 ` [PATCH v11 00/26] Modernize the build system Patrick Steinhardt
` (21 preceding siblings ...)
2024-12-06 13:24 ` [PATCH v11 22/26] t: allow overriding build dir Patrick Steinhardt
@ 2024-12-06 13:24 ` Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 24/26] Introduce support for the Meson build system Patrick Steinhardt
` (2 subsequent siblings)
25 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-12-06 13:24 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
We're contemplating whether to eventually replace our build systems with
a build system that is easier to use. Add a comparison of build systems
to our technical documentation as a baseline for discussion.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Documentation/Makefile | 1 +
Documentation/technical/build-systems.txt | 224 ++++++++++++++++++++++++++++++
2 files changed, 225 insertions(+)
diff --git a/Documentation/Makefile b/Documentation/Makefile
index f0e5bc9c0c64ddf83b2d9fde0bf877a4f4b847f3..3392e1ce7ebc540784912476847380d9c1775ac8 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -113,6 +113,7 @@ TECH_DOCS += MyFirstObjectWalk
TECH_DOCS += SubmittingPatches
TECH_DOCS += ToolsForGit
TECH_DOCS += technical/bitmap-format
+TECH_DOCS += technical/build-systems
TECH_DOCS += technical/bundle-uri
TECH_DOCS += technical/hash-function-transition
TECH_DOCS += technical/long-running-process-protocol
diff --git a/Documentation/technical/build-systems.txt b/Documentation/technical/build-systems.txt
new file mode 100644
index 0000000000000000000000000000000000000000..d9dafb407c40902756ca0bde9d9dad8ced8788dd
--- /dev/null
+++ b/Documentation/technical/build-systems.txt
@@ -0,0 +1,224 @@
+= Build Systems
+
+The build system is the primary way for both developers and system integrators
+to interact with the Git project. As such, being easy to use and extend for
+those who are not directly developing Git itself is just as important as other
+requirements we have on any potential build system.
+
+This document outlines the different requirements that we have for the build
+system and then compares available build systems using these criteria.
+
+== Requirements
+
+The following subsections present a list of requirements that we have for any
+potential build system. Sections are sorted by decreasing priority.
+
+=== Platform support
+
+The build system must have support for all of our platforms that we continually
+test against as outlined by our platform support policy. These platforms are:
+
+ - Linux
+ - Windows
+ - macOS
+
+Furthermore, the build system should have support for the following platforms
+that generally have somebody running test pipelines against regularly:
+
+ - AIX
+ - FreeBSD
+ - NetBSD
+ - NonStop
+ - OpenBSD
+
+The platforms which must be supported by the tool should be aligned with our
+[platform support policy](platform-support.txt).
+
+=== Auto-detection of supported features
+
+The build system must support auto-detection of features which are or aren't
+available on the current platform. Platform maintainers should not be required
+to manually configure the complete build.
+
+Auto-detection of the following items is considered to be important:
+
+ - Check for the existence of headers.
+ - Check for the existence of libraries.
+ - Check for the existence of exectuables.
+ - Check for the runtime behavior of specific functions.
+ - Check for specific link order requirements when multiple libraries are
+ involved.
+
+=== Ease of use
+
+The build system should be both easy to use and easy to extend. While this is
+naturally a subjective metric it is likely not controversial to say that some
+build systems are considerably harder to use than others.
+
+=== IDE support
+
+The build system should integrate with well-known IDEs. Well-known IDEs include:
+
+ - Microsoft Visual Studio
+ - Visual Studio Code
+ - Xcode
+
+There are four levels of support:
+
+ - Native integration into the IDE.
+ - Integration into the IDE via a plugin.
+ - Integration into the IDE via generating a project description with the build
+ system.
+ - No integration.
+
+Native integration is preferable, but integration via either a plugin or by
+generating a project description via the build system are considered feasible
+alternatives.
+
+Another important distinction is the level of integration. There are two
+features that one generally wants to have:
+
+ - Integration of build targets.
+ - Automatic setup of features like code completion with detected build
+ dependencies.
+
+The first bullet point is the bare minimum, but is not sufficient to be
+considered proper integration.
+
+=== Out-of-tree builds
+
+The build system should support out-of-tree builds. Out-of-tree builds allow a
+developer to configure multiple different build directories with different
+configuration, e.g. one "debug" build and one "release" build.
+
+=== Cross-platform builds
+
+The build system should support cross-platform builds, e.g. building for arm on
+an x86-64 host.
+
+=== Language support
+
+The following languages and toolchains are of relevance and should be supported
+by the build system:
+
+ - C: the primary compiled language used by Git, must be supported. Relevant
+ toolchains are GCC, Clang and MSVC.
+ - Rust: candidate as a second compiled lanugage, should be supported. Relevant
+ toolchains is the LLVM-based rustc.
+
+Built-in support for the respective languages is preferred over support that
+needs to be wired up manually to avoid unnecessary complexity. Native support
+includes the following features:
+
+ - Compiling objects.
+ - Dependency tracking.
+ - Detection of available features.
+ - Discovery of relevant toolchains.
+ - Linking libraries and executables.
+ - Templating placeholders in scripts.
+
+=== Test integration
+
+It should be possible to integrate tests into the build system such that it is
+possible to build and test Git within the build system. Features which are nice
+to have:
+
+ - Track build-time dependencies for respective tests. Unit tests have
+ different requirements than integration tests.
+ - Allow filtering of which tests to run.
+ - Allow running tests such that utilities like `test_pause` or `debug` work.
+
+== Comparison
+
+The following list of build systems are considered:
+
+- GNU Make
+- autoconf
+- CMake
+- Meson
+
+=== GNU Make
+
+- Platform support: ubitquitous on all platforms, but not well-integrated into Windows.
+- Auto-detection: no built-in support for auto-detection of features.
+- Ease of use: easy to use, but discovering available options is hard. Makefile
+ rules can quickly get out of hand once reaching a certain scope.
+- IDE support: execution of Makefile targets is supported by many IDEs
+- Out-of-tree builds: supported in theory, not wired up in practice.
+- Cross-platform builds: supported in theory, not wired up in practice.
+- Language support:
+ - C: Limited built-in support, many parts need to be wired up manually.
+ - Rust: No built-in support, needs to be wired up manually.
+- Test integration: partially supported, many parts need to be wired up
+ manually.
+
+=== autoconf
+
+- Platform support: ubiquitous on all platforms, but not well-integrated into Windows.
+- Auto-detection: supported.
+- Ease of use: easy to use, discovering available options is comparatively
+ easy. The autoconf syntax is prohibitively hard to extend though due to its
+ complex set of interacting files and the hard-to-understand M4 language.
+- IDE support: no integration into IDEs at generation time. The generated
+ Makefiles have the same level of support as GNU Make.
+- Out-of-tree builds: supported in theory, not wired up in practice.
+- Cross-platform builds: supported.
+- Language support:
+ - C: Limited built-in support, many parts need to be wired up manually.
+ - Rust: No built-in support, needs to be wired up manually.
+- Test integration: partially supported, many parts need to be wired up
+ manually.
+
+=== CMake
+
+- Platform support: not as extensive as GNU Make or autoconf, but all major
+ platforms are supported.
+ - AIX
+ - Cygwin
+ - FreeBSD
+ - Linux
+ - OpenBSD
+ - Solaris
+ - Windows
+ - macOS
+- Ease of use: easy to use, discovering available options is not always
+ trivial. The scripting language used by CMake is somewhat cumbersome to use,
+ but extending CMake build instructions is doable.
+- IDE support: natively integrated into Microsoft Visual Studio. Can generate
+ project descriptions for Xcode. An extension is available for Visual Studio
+ Code. Many other IDEs have plugins for CMake.
+- Out-of-tree builds: supported.
+- Cross-platform builds: supported.
+- Language support:
+ - C: Supported for GCC, Clang, MSVC and other toolchains.
+ - Rust: No built-in support, needs to be wired up manually.
+- Test integration: supported, even though test dependencies are a bit
+ cumbersome to use via "test fixtures". Interactive test runs are not
+ supported.
+
+=== Meson
+
+- Platform: not as extensive as GNU Make or autoconf, but all major platforms
+ and some smaller ones are supported.
+ - AIX
+ - Cygwin
+ - DragonflyBSD
+ - FreeBSD
+ - Haiku
+ - Linux
+ - NetBSD
+ - OpenBSD
+ - Solaris
+ - Windows
+ - macOS
+- Ease of use: easy to use, discovering available options is easy. The
+ scripting language is straight-forward to use.
+- IDE support: Supports generating build instructions for Xcode and Microsoft
+ Visual Studio, a plugin exists for Visual Studio Code.
+- Out-of-tree builds: supported.
+- Cross-platform builds: supported.
+- Language support:
+ - C: Supported for GCC, Clang, MSVC and other toolchains.
+ - Rust: Supported for rustc.
+- Test integration: supported. Interactive tests are supported starting with
+ Meson 1.5.0 via the `--interactive` flag.
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v11 24/26] Introduce support for the Meson build system
2024-12-06 13:24 ` [PATCH v11 00/26] Modernize the build system Patrick Steinhardt
` (22 preceding siblings ...)
2024-12-06 13:24 ` [PATCH v11 23/26] Documentation: add comparison of build systems Patrick Steinhardt
@ 2024-12-06 13:24 ` Patrick Steinhardt
2024-12-06 13:25 ` [PATCH v11 25/26] meson: fix conflicts with in-flight topics Patrick Steinhardt
2024-12-06 13:25 ` [PATCH v11 26/26] Revert "meson: fix conflicts with in-flight topics" Patrick Steinhardt
25 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-12-06 13:24 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
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>
---
Documentation/meson.build | 324 ++++++
bin-wrappers/meson.build | 28 +
contrib/completion/meson.build | 16 +
contrib/meson.build | 1 +
gitweb/meson.build | 89 ++
meson.build | 1901 ++++++++++++++++++++++++++++++++++++
meson_options.txt | 81 ++
perl/FromCPAN/Mail/meson.build | 7 +
perl/FromCPAN/meson.build | 9 +
perl/Git/LoadCPAN/Mail/meson.build | 7 +
perl/Git/LoadCPAN/meson.build | 9 +
perl/Git/SVN/Memoize/meson.build | 7 +
perl/Git/SVN/meson.build | 20 +
perl/Git/meson.build | 18 +
perl/meson.build | 12 +
po/meson.build | 27 +
subprojects/.gitignore | 1 +
subprojects/curl.wrap | 13 +
subprojects/expat.wrap | 13 +
subprojects/openssl.wrap | 15 +
subprojects/pcre2.wrap | 16 +
subprojects/zlib.wrap | 13 +
t/helper/meson.build | 91 ++
t/meson.build | 1114 +++++++++++++++++++++
templates/hooks/meson.build | 26 +
templates/info/meson.build | 7 +
templates/meson.build | 15 +
27 files changed, 3880 insertions(+)
diff --git a/Documentation/meson.build b/Documentation/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..f2426ccaa30c29bd60b850eb0a9a4ab77c66a629
--- /dev/null
+++ b/Documentation/meson.build
@@ -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
diff --git a/bin-wrappers/meson.build b/bin-wrappers/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..8a4e910c9be7da4f8ef1d5234323c2abbb6fa64d
--- /dev/null
+++ b/bin-wrappers/meson.build
@@ -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
diff --git a/contrib/completion/meson.build b/contrib/completion/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..3a9ddab5940d84dfd7f3a75e9225d1cd7669245e
--- /dev/null
+++ b/contrib/completion/meson.build
@@ -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
diff --git a/contrib/meson.build b/contrib/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..a7b77b87c22c8f1d8a86faaafc2b647b94651db8
--- /dev/null
+++ b/contrib/meson.build
@@ -0,0 +1 @@
+subdir('completion')
diff --git a/gitweb/meson.build b/gitweb/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..89b403dc9de76888e84ad24a080284a202dbb24b
--- /dev/null
+++ b/gitweb/meson.build
@@ -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
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..0dccebcdf16b07650d943e53643f0e09e2975cc9
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,1901 @@
+# Meson build system
+# ==================
+#
+# The Meson build system is an alternative to our Makefile that you can use to
+# build, test and install Git. Using Meson results in a couple of benefits:
+#
+# - Out-of-tree builds.
+# - Better integration into IDEs.
+# - Easy-to-use autoconfiguration of available features on your system.
+#
+# To use Meson from the command line you need to have both Meson and Ninja
+# installed. Alternatively, if you do not have Python available on your system,
+# you can also use Muon instead of Meson and Samurai instead of Ninja, both of
+# which are drop-ins replacement that only depend on C.
+#
+# Basic usage
+# ===========
+#
+# In the most trivial case, you can configure, build and install Git like this:
+#
+# 1. Set up the build directory. This only needs to happen once per build
+# directory you want to have. You can also configure multiple different
+# build directories with different configurations.
+#
+# $ meson setup build/
+#
+# The build directory gets ignored by Git automatically as Meson will write
+# a ".gitignore" file into it. From hereon, we will assume that you execute
+# commands inside this build directory.
+#
+# 2. Compile Git. You can either use Meson, Ninja or Samurai to do this, so all
+# of the following invocations are equivalent:
+#
+# $ meson compile
+# $ ninja
+# $ samu
+#
+# The different invocations should ultimately not make much of a difference.
+# Using Meson also works with other generators though, like when the build
+# directory has been set up for use with Microsoft Visual Studio.
+#
+# Ninja and Samurai use multiple jobs by default, scaling with the number of
+# processor cores available. You can pass the `-jN` flag to change this.
+#
+# Meson automatically picks up ccache and sccache when these are installed
+# when setting up the build directory. You can override this behaviour when
+# setting up the build directory by setting the `CC` environment variable to
+# your desired compiler.
+#
+# 3. Execute tests. Again, you can either use Meson, Ninja or Samurai to do this:
+#
+# $ meson test
+# $ ninja test
+# $ samu test
+#
+# It is recommended to use Meson in this case though as it also provides you
+# additional features that the other build systems don't have available.
+# You can e.g. pass additional arguments to the test executables or run
+# individual tests:
+#
+# # Execute the t0000-basic integration test and t-reftable-stack unit test.
+# $ meson test t0000-basic t-reftable-stack
+#
+# # Execute all reftable unit tests.
+# $ meson test t-reftable-*
+#
+# # Execute all tests and stop with the first failure.
+# $ meson test --maxfail 1
+#
+# # Execute single test interactively such that features like `debug ()` work.
+# $ meson test -i --test-args='-ix' t1400-update-ref
+#
+# Test execution is parallelized by default and scales with the number of
+# processor cores available. You can change the number of processes by passing
+# the `-jN` flag to `meson test`.
+#
+# 4. Install the Git distribution. Again, this can be done via Meson, Ninja or
+# Samurai:
+#
+# $ meson install
+# $ ninja install
+# $ samu install
+#
+# The prefix into which Git shall be installed is defined when setting up
+# the build directory. More on that in the "Configuration" section.
+#
+# Meson supports multiple backends. The default backend generates Ninja build
+# instructions, but it also supports the generation of Microsoft Visual
+# Studio solutions as well as Xcode projects by passing the `--backend` option
+# to `meson setup`. IDEs like Eclipse and Visual Studio Code provide plugins to
+# import Meson files directly.
+#
+# Configuration
+# =============
+#
+# The exact configuration of Git is determined when setting up the build
+# directory via `meson setup`. Unless told otherwise, Meson will automatically
+# detect the availability of various bits and pieces. There are two different
+# kinds of options that can be used to further tweak the build:
+#
+# - Built-in options provided by Meson.
+#
+# - Options defined by the project in the "meson_options.txt" file.
+#
+# Both kinds of options can be inspected by running `meson configure` in the
+# build directory, which will give you a list of the current value for all
+# options.
+#
+# Options can be configured either when setting up the build directory or can
+# be changed in preexisting build directories:
+#
+# # Set up a new build directory with optimized settings that will be
+# # installed into an alternative prefix.
+# $ meson setup --buildtype release --optimization 3 --strip --prefix=/home/$USER build
+#
+# # Set up a new build directory with a higher warning level. Level 2 is
+# # mostly equivalent to setting DEVELOPER=1, level 3 and "everything"
+# # will enable even more warnings.
+# $ meson setup -Dwarning_level=2 build
+#
+# # Set up a new build directory with 'address' and 'undefined' sanitizers
+# # using Clang.
+# $ CC=clang meson setup -Db_sanitize=address,undefined build
+#
+# # Disable tests in a preexisting build directory.
+# $ meson configure -Dtests=false
+#
+# # Disable features based on Python
+# $ meson configure -Dpython=disabled
+#
+# Options have a type like booleans, choices, strings or features. Features are
+# somewhat special as they can have one of three values: enabled, disabled or
+# auto. While the first two values are self-explanatory, "auto" will enable or
+# disable the feature based on the availability of prerequisites to support it.
+# Python-based features for example will be enabled automatically when a Python
+# interpreter could be found. The default value of such features can be changed
+# via `meson setup --auto-features={enabled,disabled,auto}`, which will set the
+# value of all features with a value of "auto" to the provided one by default.
+#
+# It is also possible to store a set of configuration options in machine files.
+# This can be useful in case you regularly want to reuse the same set of options:
+#
+# [binaries]
+# c = ['clang']
+# ar = ['ar']
+#
+# [project options]
+# gettext = 'disabled'
+# default_editor = 'vim'
+#
+# [built-in options]
+# b_lto = true
+# b_sanitize = 'address,undefined'
+#
+# These machine files can be passed to `meson setup` via the `--native-file`
+# option.
+#
+# Subproject wrappers
+# ===================
+#
+# Subproject wrappers are a feature provided by Meson that allows the automatic
+# fallback to a "wrapped" dependency in case the dependency is not provided by
+# the system. For example if the system is lacking curl, then Meson will use
+# "subprojects/curl.wrap" to set up curl as a subproject and compile and link
+# the dependency into Git itself. This is especially helpful on systems like
+# Windows, where you typically don't have such dependencies installed.
+#
+# The use of subproject wrappers can be disabled by executing `meson setup`
+# with the `--wrap-mode nofallback` option.
+
+project('git', 'c',
+ meson_version: '>=0.61.0',
+ version: 'v2.47.GIT',
+)
+
+fs = import('fs')
+
+program_path = []
+# Git for Windows provides all the tools we need to build Git.
+if host_machine.system() == 'windows'
+ program_path += [ 'C:/Program Files/Git/bin', 'C:/Program Files/Git/usr/bin' ]
+endif
+
+cygpath = find_program('cygpath', dirs: program_path, required: false)
+diff = find_program('diff', dirs: program_path)
+shell = find_program('sh', dirs: program_path)
+tar = find_program('tar', dirs: program_path)
+
+script_environment = environment()
+foreach tool : ['cat', 'cut', 'grep', 'sed', 'sort', 'tr', 'uname']
+ program = find_program(tool, dirs: program_path)
+ script_environment.prepend('PATH', fs.parent(program.full_path()))
+endforeach
+
+git = find_program('git', dirs: program_path, required: false)
+if git.found()
+ script_environment.prepend('PATH', fs.parent(git.full_path()))
+endif
+
+if get_option('sane_tool_path') != ''
+ script_environment.prepend('PATH', get_option('sane_tool_path'))
+endif
+
+compiler = meson.get_compiler('c')
+
+libgit_sources = [
+ 'abspath.c',
+ 'add-interactive.c',
+ 'add-patch.c',
+ 'advice.c',
+ 'alias.c',
+ 'alloc.c',
+ 'apply.c',
+ 'archive-tar.c',
+ 'archive-zip.c',
+ 'archive.c',
+ 'attr.c',
+ 'base85.c',
+ 'bisect.c',
+ 'blame.c',
+ 'blob.c',
+ 'bloom.c',
+ 'branch.c',
+ 'bulk-checkin.c',
+ 'bundle-uri.c',
+ 'bundle.c',
+ 'cache-tree.c',
+ 'cbtree.c',
+ 'chdir-notify.c',
+ 'checkout.c',
+ 'chunk-format.c',
+ 'color.c',
+ 'column.c',
+ 'combine-diff.c',
+ 'commit-graph.c',
+ 'commit-reach.c',
+ 'commit.c',
+ 'compat/nonblock.c',
+ 'compat/obstack.c',
+ 'compat/terminal.c',
+ 'compat/zlib-uncompress2.c',
+ 'config.c',
+ 'connect.c',
+ 'connected.c',
+ 'convert.c',
+ 'copy.c',
+ 'credential.c',
+ 'csum-file.c',
+ 'ctype.c',
+ 'date.c',
+ 'decorate.c',
+ 'delta-islands.c',
+ 'diagnose.c',
+ 'diff-delta.c',
+ 'diff-merges.c',
+ 'diff-lib.c',
+ 'diff-no-index.c',
+ 'diff.c',
+ 'diffcore-break.c',
+ 'diffcore-delta.c',
+ 'diffcore-order.c',
+ 'diffcore-pickaxe.c',
+ 'diffcore-rename.c',
+ 'diffcore-rotate.c',
+ 'dir-iterator.c',
+ 'dir.c',
+ 'editor.c',
+ 'entry.c',
+ 'environment.c',
+ 'ewah/bitmap.c',
+ 'ewah/ewah_bitmap.c',
+ 'ewah/ewah_io.c',
+ 'ewah/ewah_rlw.c',
+ 'exec-cmd.c',
+ 'fetch-negotiator.c',
+ 'fetch-pack.c',
+ 'fmt-merge-msg.c',
+ 'fsck.c',
+ 'fsmonitor.c',
+ 'fsmonitor-ipc.c',
+ 'fsmonitor-settings.c',
+ 'gettext.c',
+ 'git-zlib.c',
+ 'gpg-interface.c',
+ 'graph.c',
+ 'grep.c',
+ 'hash-lookup.c',
+ 'hashmap.c',
+ 'help.c',
+ 'hex.c',
+ 'hex-ll.c',
+ 'hook.c',
+ 'ident.c',
+ 'json-writer.c',
+ 'kwset.c',
+ 'levenshtein.c',
+ 'line-log.c',
+ 'line-range.c',
+ 'linear-assignment.c',
+ 'list-objects-filter-options.c',
+ 'list-objects-filter.c',
+ 'list-objects.c',
+ 'lockfile.c',
+ 'log-tree.c',
+ 'loose.c',
+ 'ls-refs.c',
+ 'mailinfo.c',
+ 'mailmap.c',
+ 'match-trees.c',
+ 'mem-pool.c',
+ 'merge-blobs.c',
+ 'merge-ll.c',
+ 'merge-ort.c',
+ 'merge-ort-wrappers.c',
+ 'merge-recursive.c',
+ 'merge.c',
+ 'midx.c',
+ 'midx-write.c',
+ 'name-hash.c',
+ 'negotiator/default.c',
+ 'negotiator/noop.c',
+ 'negotiator/skipping.c',
+ 'notes-cache.c',
+ 'notes-merge.c',
+ 'notes-utils.c',
+ 'notes.c',
+ 'object-file-convert.c',
+ 'object-file.c',
+ 'object-name.c',
+ 'object.c',
+ 'oid-array.c',
+ 'oidmap.c',
+ 'oidset.c',
+ 'oidtree.c',
+ 'pack-bitmap-write.c',
+ 'pack-bitmap.c',
+ 'pack-check.c',
+ 'pack-mtimes.c',
+ 'pack-objects.c',
+ 'pack-revindex.c',
+ 'pack-write.c',
+ 'packfile.c',
+ 'pager.c',
+ 'parallel-checkout.c',
+ 'parse.c',
+ 'parse-options-cb.c',
+ 'parse-options.c',
+ 'patch-delta.c',
+ 'patch-ids.c',
+ 'path.c',
+ 'pathspec.c',
+ 'pkt-line.c',
+ 'preload-index.c',
+ 'pretty.c',
+ 'prio-queue.c',
+ 'progress.c',
+ 'promisor-remote.c',
+ 'prompt.c',
+ 'protocol.c',
+ 'protocol-caps.c',
+ 'prune-packed.c',
+ 'pseudo-merge.c',
+ 'quote.c',
+ 'range-diff.c',
+ 'reachable.c',
+ 'read-cache.c',
+ 'rebase-interactive.c',
+ 'rebase.c',
+ 'ref-filter.c',
+ 'reflog-walk.c',
+ 'reflog.c',
+ 'refs.c',
+ 'refs/debug.c',
+ 'refs/files-backend.c',
+ 'refs/reftable-backend.c',
+ 'refs/iterator.c',
+ 'refs/packed-backend.c',
+ 'refs/ref-cache.c',
+ 'refspec.c',
+ 'reftable/basics.c',
+ 'reftable/error.c',
+ 'reftable/block.c',
+ 'reftable/blocksource.c',
+ 'reftable/iter.c',
+ 'reftable/merged.c',
+ 'reftable/pq.c',
+ 'reftable/reader.c',
+ 'reftable/record.c',
+ 'reftable/stack.c',
+ 'reftable/system.c',
+ 'reftable/tree.c',
+ 'reftable/writer.c',
+ 'remote.c',
+ 'replace-object.c',
+ 'repo-settings.c',
+ 'repository.c',
+ 'rerere.c',
+ 'reset.c',
+ 'resolve-undo.c',
+ 'revision.c',
+ 'run-command.c',
+ 'send-pack.c',
+ 'sequencer.c',
+ 'serve.c',
+ 'server-info.c',
+ 'setup.c',
+ 'shallow.c',
+ 'sideband.c',
+ 'sigchain.c',
+ 'sparse-index.c',
+ 'split-index.c',
+ 'stable-qsort.c',
+ 'statinfo.c',
+ 'strbuf.c',
+ 'streaming.c',
+ 'string-list.c',
+ 'strmap.c',
+ 'strvec.c',
+ 'sub-process.c',
+ 'submodule-config.c',
+ 'submodule.c',
+ 'symlinks.c',
+ 'tag.c',
+ 'tempfile.c',
+ 'thread-utils.c',
+ 'tmp-objdir.c',
+ 'trace.c',
+ 'trace2.c',
+ 'trace2/tr2_cfg.c',
+ 'trace2/tr2_cmd_name.c',
+ 'trace2/tr2_ctr.c',
+ 'trace2/tr2_dst.c',
+ 'trace2/tr2_sid.c',
+ 'trace2/tr2_sysenv.c',
+ 'trace2/tr2_tbuf.c',
+ 'trace2/tr2_tgt_event.c',
+ 'trace2/tr2_tgt_normal.c',
+ 'trace2/tr2_tgt_perf.c',
+ 'trace2/tr2_tls.c',
+ 'trace2/tr2_tmr.c',
+ 'trailer.c',
+ 'transport-helper.c',
+ 'transport.c',
+ 'tree-diff.c',
+ 'tree-walk.c',
+ 'tree.c',
+ 'unpack-trees.c',
+ 'upload-pack.c',
+ 'url.c',
+ 'urlmatch.c',
+ 'usage.c',
+ 'userdiff.c',
+ 'utf8.c',
+ 'varint.c',
+ 'versioncmp.c',
+ 'walker.c',
+ 'wildmatch.c',
+ 'worktree.c',
+ 'wrapper.c',
+ 'write-or-die.c',
+ 'ws.c',
+ 'wt-status.c',
+ 'xdiff-interface.c',
+ 'xdiff/xdiffi.c',
+ 'xdiff/xemit.c',
+ 'xdiff/xhistogram.c',
+ 'xdiff/xmerge.c',
+ 'xdiff/xpatience.c',
+ 'xdiff/xprepare.c',
+ 'xdiff/xutils.c',
+]
+
+builtin_sources = [
+ 'builtin/add.c',
+ 'builtin/am.c',
+ 'builtin/annotate.c',
+ 'builtin/apply.c',
+ 'builtin/archive.c',
+ 'builtin/bisect.c',
+ 'builtin/blame.c',
+ 'builtin/branch.c',
+ 'builtin/bugreport.c',
+ 'builtin/bundle.c',
+ 'builtin/cat-file.c',
+ 'builtin/check-attr.c',
+ 'builtin/check-ignore.c',
+ 'builtin/check-mailmap.c',
+ 'builtin/check-ref-format.c',
+ 'builtin/checkout--worker.c',
+ 'builtin/checkout-index.c',
+ 'builtin/checkout.c',
+ 'builtin/clean.c',
+ 'builtin/clone.c',
+ 'builtin/column.c',
+ 'builtin/commit-graph.c',
+ 'builtin/commit-tree.c',
+ 'builtin/commit.c',
+ 'builtin/config.c',
+ 'builtin/count-objects.c',
+ 'builtin/credential-cache--daemon.c',
+ 'builtin/credential-cache.c',
+ 'builtin/credential-store.c',
+ 'builtin/credential.c',
+ 'builtin/describe.c',
+ 'builtin/diagnose.c',
+ 'builtin/diff-files.c',
+ 'builtin/diff-index.c',
+ 'builtin/diff-tree.c',
+ 'builtin/diff.c',
+ 'builtin/difftool.c',
+ 'builtin/fast-export.c',
+ 'builtin/fast-import.c',
+ 'builtin/fetch-pack.c',
+ 'builtin/fetch.c',
+ 'builtin/fmt-merge-msg.c',
+ 'builtin/for-each-ref.c',
+ 'builtin/for-each-repo.c',
+ 'builtin/fsck.c',
+ 'builtin/fsmonitor--daemon.c',
+ 'builtin/gc.c',
+ 'builtin/get-tar-commit-id.c',
+ 'builtin/grep.c',
+ 'builtin/hash-object.c',
+ 'builtin/help.c',
+ 'builtin/hook.c',
+ 'builtin/index-pack.c',
+ 'builtin/init-db.c',
+ 'builtin/interpret-trailers.c',
+ 'builtin/log.c',
+ 'builtin/ls-files.c',
+ 'builtin/ls-remote.c',
+ 'builtin/ls-tree.c',
+ 'builtin/mailinfo.c',
+ 'builtin/mailsplit.c',
+ 'builtin/merge-base.c',
+ 'builtin/merge-file.c',
+ 'builtin/merge-index.c',
+ 'builtin/merge-ours.c',
+ 'builtin/merge-recursive.c',
+ 'builtin/merge-tree.c',
+ 'builtin/merge.c',
+ 'builtin/mktag.c',
+ 'builtin/mktree.c',
+ 'builtin/multi-pack-index.c',
+ 'builtin/mv.c',
+ 'builtin/name-rev.c',
+ 'builtin/notes.c',
+ 'builtin/pack-objects.c',
+ 'builtin/pack-redundant.c',
+ 'builtin/pack-refs.c',
+ 'builtin/patch-id.c',
+ 'builtin/prune-packed.c',
+ 'builtin/prune.c',
+ 'builtin/pull.c',
+ 'builtin/push.c',
+ 'builtin/range-diff.c',
+ 'builtin/read-tree.c',
+ 'builtin/rebase.c',
+ 'builtin/receive-pack.c',
+ 'builtin/reflog.c',
+ 'builtin/refs.c',
+ 'builtin/remote-ext.c',
+ 'builtin/remote-fd.c',
+ 'builtin/remote.c',
+ 'builtin/repack.c',
+ 'builtin/replace.c',
+ 'builtin/replay.c',
+ 'builtin/rerere.c',
+ 'builtin/reset.c',
+ 'builtin/rev-list.c',
+ 'builtin/rev-parse.c',
+ 'builtin/revert.c',
+ 'builtin/rm.c',
+ 'builtin/send-pack.c',
+ 'builtin/shortlog.c',
+ 'builtin/show-branch.c',
+ 'builtin/show-index.c',
+ 'builtin/show-ref.c',
+ 'builtin/sparse-checkout.c',
+ 'builtin/stash.c',
+ 'builtin/stripspace.c',
+ 'builtin/submodule--helper.c',
+ 'builtin/symbolic-ref.c',
+ 'builtin/tag.c',
+ 'builtin/unpack-file.c',
+ 'builtin/unpack-objects.c',
+ 'builtin/update-index.c',
+ 'builtin/update-ref.c',
+ 'builtin/update-server-info.c',
+ 'builtin/upload-archive.c',
+ 'builtin/upload-pack.c',
+ 'builtin/var.c',
+ 'builtin/verify-commit.c',
+ 'builtin/verify-pack.c',
+ 'builtin/verify-tag.c',
+ 'builtin/worktree.c',
+ 'builtin/write-tree.c',
+]
+
+libgit_sources += custom_target(
+ input: 'command-list.txt',
+ output: 'command-list.h',
+ command: [shell, meson.current_source_dir() + '/generate-cmdlist.sh', meson.current_source_dir(), '@OUTPUT@'],
+ env: script_environment,
+)
+
+libgit_sources += custom_target(
+ output: 'config-list.h',
+ command: [
+ shell,
+ meson.current_source_dir() + '/generate-configlist.sh',
+ meson.current_source_dir(),
+ '@OUTPUT@',
+ ],
+ env: script_environment,
+)
+
+libgit_sources += custom_target(
+ input: 'Documentation/githooks.txt',
+ output: 'hook-list.h',
+ command: [
+ shell,
+ meson.current_source_dir() + '/generate-hooklist.sh',
+ meson.current_source_dir(),
+ '@OUTPUT@',
+ ],
+ env: script_environment,
+)
+
+# This contains the variables for GIT-BUILD-OPTIONS, which we use to propagate
+# build options to our tests.
+build_options_config = configuration_data()
+build_options_config.set('GIT_INTEROP_MAKE_OPTS', '')
+build_options_config.set('GIT_PERF_LARGE_REPO', '')
+build_options_config.set('GIT_PERF_MAKE_COMMAND', '')
+build_options_config.set('GIT_PERF_MAKE_OPTS', '')
+build_options_config.set('GIT_PERF_REPEAT_COUNT', '')
+build_options_config.set('GIT_PERF_REPO', '')
+build_options_config.set('GIT_TEST_CMP_USE_COPIED_CONTEXT', '')
+build_options_config.set('GIT_TEST_INDEX_VERSION', '')
+build_options_config.set('GIT_TEST_OPTS', '')
+build_options_config.set('GIT_TEST_PERL_FATAL_WARNINGS', '')
+build_options_config.set('GIT_TEST_UTF8_LOCALE', '')
+build_options_config.set_quoted('LOCALEDIR', fs.as_posix(get_option('prefix') / get_option('localedir')))
+build_options_config.set('GITWEBDIR', fs.as_posix(get_option('prefix') / get_option('datadir') / 'gitweb'))
+
+if get_option('sane_tool_path') != ''
+ build_options_config.set_quoted('BROKEN_PATH_FIX', 's|^\# @BROKEN_PATH_FIX@$|git_broken_path_fix "' + get_option('sane_tool_path') + '"|')
+else
+ build_options_config.set_quoted('BROKEN_PATH_FIX', '/^\# @BROKEN_PATH_FIX@$/d')
+endif
+
+test_output_directory = get_option('test_output_directory')
+if test_output_directory == ''
+ test_output_directory = meson.project_build_root() / 'test-output'
+endif
+
+# These variables are used for building libgit.a.
+libgit_c_args = [
+ '-DBINDIR="' + get_option('bindir') + '"',
+ '-DDEFAULT_EDITOR="' + get_option('default_editor') + '"',
+ '-DDEFAULT_GIT_TEMPLATE_DIR="' + get_option('datadir') / 'git-core/templates' + '"',
+ '-DDEFAULT_HELP_FORMAT="' + get_option('default_help_format') + '"',
+ '-DDEFAULT_PAGER="' + get_option('default_pager') + '"',
+ '-DETC_GITATTRIBUTES="' + get_option('gitattributes') + '"',
+ '-DETC_GITCONFIG="' + get_option('gitconfig') + '"',
+ '-DFALLBACK_RUNTIME_PREFIX="' + get_option('prefix') + '"',
+ '-DGIT_EXEC_PATH="' + get_option('prefix') / get_option('libexecdir') / 'git-core"',
+ '-DGIT_HOST_CPU="' + host_machine.cpu_family() + '"',
+ '-DGIT_HTML_PATH="' + get_option('datadir') / 'doc/git-doc"',
+ '-DGIT_INFO_PATH="' + get_option('infodir') + '"',
+ '-DGIT_LOCALE_PATH="' + get_option('localedir') + '"',
+ '-DGIT_MAN_PATH="' + get_option('mandir') + '"',
+ '-DPAGER_ENV="' + get_option('pager_environment') + '"',
+ '-DSHELL_PATH="' + fs.as_posix(shell.full_path()) + '"',
+]
+libgit_include_directories = [ '.' ]
+libgit_dependencies = [ ]
+
+# Treat any warning level above 1 the same as we treat DEVELOPER=1 in our
+# Makefile.
+if get_option('warning_level') in ['2','3', 'everything'] and compiler.get_argument_syntax() == 'gcc'
+ foreach cflag : [
+ '-Wdeclaration-after-statement',
+ '-Wformat-security',
+ '-Wold-style-definition',
+ '-Woverflow',
+ '-Wpointer-arith',
+ '-Wstrict-prototypes',
+ '-Wunused',
+ '-Wvla',
+ '-Wwrite-strings',
+ '-fno-common',
+ '-Wtautological-constant-out-of-range-compare',
+ # If a function is public, there should be a prototype and the right
+ # header file should be included. If not, it should be static.
+ '-Wmissing-prototypes',
+ # These are disabled because we have these all over the place.
+ '-Wno-empty-body',
+ '-Wno-missing-field-initializers',
+ '-Wno-sign-compare',
+ ]
+ if compiler.has_argument(cflag)
+ libgit_c_args += cflag
+ endif
+ endforeach
+endif
+
+if get_option('b_sanitize').contains('address')
+ build_options_config.set('SANITIZE_ADDRESS', 'YesCompiledWithIt')
+else
+ build_options_config.set('SANITIZE_ADDRESS', '')
+endif
+if get_option('b_sanitize').contains('leak')
+ libgit_c_args += '-DSUPPRESS_ANNOTATED_LEAKS'
+ build_options_config.set('SANITIZE_LEAK', 'YesCompiledWithIt')
+else
+ build_options_config.set('SANITIZE_LEAK', '')
+endif
+if get_option('b_sanitize').contains('undefined')
+ libgit_c_args += '-DSHA1DC_FORCE_ALIGNED_ACCESS'
+endif
+
+executable_suffix = ''
+if host_machine.system() == 'cygwin' or host_machine.system() == 'windows'
+ executable_suffix = '.exe'
+ libgit_c_args += '-DSTRIP_EXTENSION="' + executable_suffix + '"'
+endif
+build_options_config.set_quoted('X', executable_suffix)
+
+python = import('python').find_installation('python3', required: get_option('python'))
+if python.found()
+ build_options_config.set('NO_PYTHON', '')
+else
+ libgit_c_args += '-DNO_PYTHON'
+ build_options_config.set('NO_PYTHON', '1')
+endif
+
+# Perl is used for two different things: our test harness and to provide some
+# features. It is optional if you want to neither execute tests nor use any of
+# these optional features.
+perl_required = get_option('perl')
+if get_option('tests')
+ perl_required = true
+endif
+
+# Note that we only set NO_PERL if the Perl features were disabled by the user.
+# It may not be set when we have found Perl, but only use it to run tests.
+perl = find_program('perl', version: '>=5.8.1', dirs: program_path, required: perl_required)
+perl_features_enabled = perl.found() and get_option('perl').allowed()
+if perl_features_enabled
+ build_options_config.set('NO_PERL', '')
+
+ if get_option('runtime_prefix')
+ build_options_config.set('PERL_LOCALEDIR', '')
+ else
+ build_options_config.set_quoted('PERL_LOCALEDIR', fs.as_posix(get_option('prefix') / get_option('localedir')))
+ endif
+
+ if get_option('perl_cpan_fallback')
+ build_options_config.set('NO_PERL_CPAN_FALLBACKS', '')
+ else
+ build_options_config.set_quoted('NO_PERL_CPAN_FALLBACKS', 'YesPlease')
+ endif
+else
+ libgit_c_args += '-DNO_PERL'
+ build_options_config.set('NO_PERL', '1')
+ build_options_config.set('PERL_LOCALEDIR', '')
+ build_options_config.set('NO_PERL_CPAN_FALLBACKS', '')
+endif
+
+zlib = dependency('zlib', default_options: ['default_library=static', 'tests=disabled'])
+if zlib.version().version_compare('<1.2.0')
+ libgit_c_args += '-DNO_DEFLATE_BOUND'
+endif
+libgit_dependencies += zlib
+
+threads = dependency('threads', required: false)
+if threads.found()
+ libgit_dependencies += threads
+ build_options_config.set('NO_PTHREADS', '')
+else
+ libgit_c_args += '-DNO_PTHREADS'
+ build_options_config.set('NO_PTHREADS', '1')
+endif
+
+msgfmt = find_program('msgfmt', dirs: program_path, required: false)
+gettext_option = get_option('gettext').disable_auto_if(not msgfmt.found())
+if not msgfmt.found() and gettext_option.enabled()
+ error('Internationalization via libintl requires msgfmt')
+endif
+
+if gettext_option.allowed() and host_machine.system() == 'darwin' and get_option('macos_use_homebrew_gettext')
+ if host_machine.cpu_family() == 'x86_64'
+ libintl_prefix = '/usr/local'
+ elif host_machine.cpu_family() == 'aarch64'
+ libintl_prefix = '/opt/homebrew'
+ else
+ error('Homebrew workaround not supported on current architecture')
+ endif
+
+ intl = compiler.find_library('intl', dirs: libintl_prefix / 'lib', required: gettext_option)
+ if intl.found()
+ intl = declare_dependency(
+ dependencies: intl,
+ include_directories: libintl_prefix / 'include',
+ )
+ endif
+else
+ intl = dependency('intl', required: gettext_option)
+endif
+if intl.found()
+ libgit_dependencies += intl
+ build_options_config.set('NO_GETTEXT', '')
+ build_options_config.set('USE_GETTEXT_SCHEME', '')
+
+ # POSIX nowadays requires `nl_langinfo()`, but some systems still don't have
+ # the function available. On such systems we instead fall back to libcharset.
+ # On native Windows systems we use our own emulation.
+ if host_machine.system() != 'windows' and not compiler.has_function('nl_langinfo')
+ libcharset = compiler.find_library('charset', required: true)
+ libgit_dependencies += libcharset
+ libgit_c_args += '-DHAVE_LIBCHARSET_H'
+ endif
+else
+ libgit_c_args += '-DNO_GETTEXT'
+ build_options_config.set('NO_GETTEXT', '1')
+ build_options_config.set('USE_GETTEXT_SCHEME', 'fallthrough')
+endif
+
+iconv = dependency('iconv', required: get_option('iconv'))
+if iconv.found()
+ libgit_dependencies += iconv
+ build_options_config.set('NO_ICONV', '')
+
+ have_old_iconv = false
+ if not compiler.compiles('''
+ #include <iconv.h>
+
+ extern size_t iconv(iconv_t cd,
+ char **inbuf, size_t *inbytesleft,
+ char **outbuf, size_t *outbytesleft);
+ ''', name: 'old iconv interface', dependencies: [iconv])
+ libgit_c_args += '-DOLD_ICONV'
+ have_old_iconv = true
+ endif
+
+ iconv_omits_bom_source = '''#
+ #include <iconv.h>
+
+ int main(int argc, const char **argv)
+ {
+ '''
+ if have_old_iconv
+ iconv_omits_bom_source += '''
+ typedef const char *iconv_ibp;
+ '''
+ else
+ iconv_omits_bom_source += '''
+ typedef char *iconv_ibp;
+ '''
+ endif
+ iconv_omits_bom_source += '''
+ int v;
+ iconv_t conv;
+ char in[] = "a"; iconv_ibp pin = in;
+ char out[20] = ""; char *pout = out;
+ size_t isz = sizeof in;
+ size_t osz = sizeof out;
+
+ conv = iconv_open("UTF-16", "UTF-8");
+ iconv(conv, &pin, &isz, &pout, &osz);
+ iconv_close(conv);
+ v = (unsigned char)(out[0]) + (unsigned char)(out[1]);
+ return v != 0xfe + 0xff;
+ }
+ '''
+
+ if compiler.run(iconv_omits_bom_source,
+ dependencies: iconv,
+ name: 'iconv omits BOM',
+ ).returncode() != 0
+ libgit_c_args += '-DICONV_OMITS_BOM'
+ endif
+else
+ libgit_c_args += '-DNO_ICONV'
+ build_options_config.set('NO_ICONV', '1')
+endif
+
+pcre2 = dependency('libpcre2-8', required: get_option('pcre2'), default_options: ['default_library=static', 'test=false'])
+if pcre2.found()
+ libgit_dependencies += pcre2
+ libgit_c_args += '-DUSE_LIBPCRE2'
+ build_options_config.set('USE_LIBPCRE2', '1')
+else
+ build_options_config.set('USE_LIBPCRE2', '')
+endif
+
+curl = dependency('libcurl', version: '>=7.21.3', required: get_option('curl'), default_options: ['default_library=static', 'tests=disabled', 'tool=disabled'])
+use_curl_for_imap_send = false
+if curl.found()
+ if curl.version().version_compare('>=7.34.0')
+ libgit_c_args += '-DUSE_CURL_FOR_IMAP_SEND'
+ use_curl_for_imap_send = true
+ endif
+
+ libgit_dependencies += curl
+ libgit_c_args += '-DCURL_DISABLE_TYPECHECK'
+ build_options_config.set('NO_CURL', '')
+else
+ libgit_c_args += '-DNO_CURL'
+ build_options_config.set('NO_CURL', '1')
+endif
+
+expat = dependency('expat', required: get_option('expat'), default_options: ['default_library=static', 'build_tests=false'])
+if expat.found()
+ libgit_dependencies += expat
+
+ if expat.version().version_compare('<=1.2')
+ libgit_c_args += '-DEXPAT_NEEDS_XMLPARSE_H'
+ endif
+ build_options_config.set('NO_EXPAT', '')
+else
+ libgit_c_args += '-DNO_EXPAT'
+ build_options_config.set('NO_EXPAT', '1')
+endif
+
+if not compiler.has_header('sys/select.h')
+ libgit_c_args += '-DNO_SYS_SELECT_H'
+endif
+
+has_poll_h = compiler.has_header('poll.h')
+if not has_poll_h
+ libgit_c_args += '-DNO_POLL_H'
+endif
+
+has_sys_poll_h = compiler.has_header('sys/poll.h')
+if not has_sys_poll_h
+ libgit_c_args += '-DNO_SYS_POLL_H'
+endif
+
+if not has_poll_h and not has_sys_poll_h
+ libgit_c_args += '-DNO_POLL'
+ libgit_sources += 'compat/poll/poll.c'
+ libgit_include_directories += 'compat/poll'
+endif
+
+if not compiler.has_header('inttypes.h')
+ libgit_c_args += '-DNO_INTTYPES_H'
+endif
+
+if compiler.has_header('alloca.h')
+ libgit_c_args += '-DHAVE_ALLOCA_H'
+endif
+
+if compiler.has_header('sys/sysinfo.h')
+ libgit_c_args += '-DHAVE_SYSINFO'
+endif
+
+# Windows has libgen.h and a basename implementation, but we still need our own
+# implementation to threat things like drive prefixes specially.
+if host_machine.system() == 'windows' or not compiler.has_header('libgen.h')
+ libgit_c_args += '-DNO_LIBGEN_H'
+ libgit_sources += 'compat/basename.c'
+endif
+
+if compiler.has_header('paths.h')
+ libgit_c_args += '-DHAVE_PATHS_H'
+endif
+
+if compiler.has_header('strings.h')
+ libgit_c_args += '-DHAVE_STRINGS_H'
+endif
+
+networking_dependencies = [ ]
+if host_machine.system() == 'windows'
+ winsock = compiler.find_library('ws2_32', required: false)
+ if winsock.found()
+ networking_dependencies += winsock
+ endif
+else
+ libresolv = compiler.find_library('resolv', required: false)
+ if libresolv.found()
+ networking_dependencies += libresolv
+ endif
+endif
+libgit_dependencies += networking_dependencies
+
+foreach symbol : ['inet_ntop', 'inet_pton', 'strerror']
+ if not compiler.has_function(symbol, dependencies: networking_dependencies)
+ libgit_c_args += '-DNO_' + symbol.to_upper()
+ endif
+endforeach
+
+has_ipv6 = compiler.has_function('getaddrinfo', dependencies: networking_dependencies)
+if not has_ipv6
+ libgit_c_args += '-DNO_IPV6'
+endif
+
+if not compiler.compiles('''
+ #ifdef _WIN32
+ # include <winsock2.h>
+ #else
+ # include <sys/types.h>
+ # include <sys/socket.h>
+ #endif
+
+ void func(void)
+ {
+ struct sockaddr_storage x;
+ }
+''', name: 'struct sockaddr_storage')
+ if has_ipv6
+ libgit_c_args += '-Dsockaddr_storage=sockaddr_in6'
+ else
+ libgit_c_args += '-Dsockaddr_storage=sockaddr_in'
+ endif
+endif
+
+if compiler.has_function('socket', dependencies: networking_dependencies)
+ libgit_sources += [
+ 'unix-socket.c',
+ 'unix-stream-server.c',
+ ]
+ build_options_config.set('NO_UNIX_SOCKETS', '')
+else
+ libgit_c_args += '-DNO_UNIX_SOCKETS'
+ build_options_config.set('NO_UNIX_SOCKETS', '1')
+endif
+
+if not compiler.has_function('pread')
+ libgit_c_args += '-DNO_PREAD'
+ libgit_sources += 'compat/pread.c'
+endif
+
+if host_machine.system() == 'darwin'
+ libgit_sources += 'compat/precompose_utf8.c'
+ libgit_c_args += '-DPRECOMPOSE_UNICODE'
+ libgit_c_args += '-DPROTECT_HFS_DEFAULT'
+endif
+
+# Configure general compatibility wrappers.
+if host_machine.system() == 'cygwin'
+ libgit_sources += [
+ 'compat/win32/path-utils.c',
+ ]
+elif host_machine.system() == 'windows'
+ libgit_sources += [
+ 'compat/mingw.c',
+ 'compat/winansi.c',
+ 'compat/win32/flush.c',
+ 'compat/win32/path-utils.c',
+ 'compat/win32/pthread.c',
+ 'compat/win32/syslog.c',
+ 'compat/win32/dirent.c',
+ 'compat/win32mmap.c',
+ 'compat/nedmalloc/nedmalloc.c',
+ ]
+
+ libgit_c_args += [
+ '-DDETECT_MSYS_TTY',
+ '-DENSURE_MSYSTEM_IS_SET',
+ '-DNATIVE_CRLF',
+ '-DNOGDI',
+ '-DNO_POSIX_GOODIES',
+ '-DWIN32',
+ '-D_CONSOLE',
+ '-D_CONSOLE_DETECT_MSYS_TTY',
+ '-D__USE_MINGW_ANSI_STDIO=0',
+ ]
+
+ libgit_dependencies += compiler.find_library('ntdll')
+ libgit_include_directories += 'compat/win32'
+ if compiler.get_id() == 'msvc'
+ libgit_include_directories += 'compat/vcbuild/include'
+ endif
+endif
+
+if host_machine.system() == 'linux'
+ libgit_sources += 'compat/linux/procinfo.c'
+elif host_machine.system() == 'windows'
+ libgit_sources += 'compat/win32/trace2_win32_process_info.c'
+else
+ libgit_sources += 'compat/stub/procinfo.c'
+endif
+
+if host_machine.system() == 'cygwin' or host_machine.system() == 'windows'
+ libgit_c_args += [
+ '-DUNRELIABLE_FSTAT',
+ '-DMMAP_PREVENTS_DELETE',
+ '-DOBJECT_CREATION_MODE=1',
+ ]
+endif
+
+# Configure the simple-ipc subsystem required fro the fsmonitor.
+if host_machine.system() == 'windows'
+ libgit_sources += [
+ 'compat/simple-ipc/ipc-shared.c',
+ 'compat/simple-ipc/ipc-win32.c',
+ ]
+ libgit_c_args += '-DSUPPORTS_SIMPLE_IPC'
+else
+ libgit_sources += [
+ 'compat/simple-ipc/ipc-shared.c',
+ 'compat/simple-ipc/ipc-unix-socket.c',
+ ]
+ libgit_c_args += '-DSUPPORTS_SIMPLE_IPC'
+endif
+
+fsmonitor_backend = ''
+if host_machine.system() == 'windows'
+ fsmonitor_backend = 'win32'
+elif host_machine.system() == 'darwin'
+ fsmonitor_backend = 'darwin'
+ libgit_dependencies += dependency('CoreServices')
+endif
+if fsmonitor_backend != ''
+ libgit_c_args += '-DHAVE_FSMONITOR_DAEMON_BACKEND'
+ libgit_c_args += '-DHAVE_FSMONITOR_OS_SETTINGS'
+
+ libgit_sources += [
+ 'compat/fsmonitor/fsm-health-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-ipc-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-listen-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-path-utils-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-settings-' + fsmonitor_backend + '.c',
+ ]
+endif
+build_options_config.set_quoted('FSMONITOR_DAEMON_BACKEND', fsmonitor_backend)
+build_options_config.set_quoted('FSMONITOR_OS_SETTINGS', fsmonitor_backend)
+
+if not get_option('b_sanitize').contains('address') and get_option('regex').allowed() and compiler.has_header('regex.h') and compiler.get_define('REG_STARTEND', prefix: '#include <regex.h>') != ''
+ build_options_config.set('NO_REGEX', '')
+
+ if compiler.get_define('REG_ENHANCED', prefix: '#include <regex.h>') != ''
+ libgit_c_args += '-DUSE_ENHANCED_BASIC_REGULAR_EXPRESSIONS'
+ libgit_sources += 'compat/regcomp_enhanced.c'
+ endif
+elif not get_option('regex').enabled()
+ libgit_c_args += [
+ '-DNO_REGEX',
+ '-DGAWK',
+ '-DNO_MBSUPPORT',
+ ]
+ build_options_config.set('NO_REGEX', '1')
+ libgit_sources += 'compat/regex/regex.c'
+ libgit_include_directories += 'compat/regex'
+else
+ error('Native regex support requested but not found')
+endif
+
+# setitimer and friends are provided by compat/mingw.c.
+if host_machine.system() != 'windows'
+ if not compiler.compiles('''
+ #include <sys/time.h>
+ void func(void)
+ {
+ struct itimerval value;
+ }
+ ''', name: 'struct itimerval')
+ libgit_c_args += '-DNO_STRUCT_ITIMERVAL'
+ libgit_c_args += '-DNO_SETITIMER'
+ elif not compiler.has_function('setitimer')
+ libgit_c_args += '-DNO_SETITIMER'
+ endif
+endif
+
+if compiler.has_member('struct stat', 'st_mtimespec.tv_nsec', prefix: '#include <sys/stat.h>')
+ libgit_c_args += '-DUSE_ST_TIMESPEC'
+elif not compiler.has_member('struct stat', 'st_mtim.tv_nsec', prefix: '#include <sys/stat.h>')
+ libgit_c_args += '-DNO_NSEC'
+endif
+
+if not compiler.has_member('struct stat', 'st_blocks', prefix: '#include <sys/stat.h>')
+ libgit_c_args += '-DNO_ST_BLOCKS_IN_STRUCT_STAT'
+endif
+
+if not compiler.has_member('struct dirent', 'd_type', prefix: '#include <dirent.h>')
+ libgit_c_args += '-DNO_D_TYPE_IN_DIRENT'
+endif
+
+if not compiler.has_member('struct passwd', 'pw_gecos', prefix: '#include <pwd.h>')
+ libgit_c_args += '-DNO_GECOS_IN_PWENT'
+endif
+
+if compiler.has_function('sync_file_range')
+ libgit_c_args += '-DHAVE_SYNC_FILE_RANGE'
+endif
+
+if not compiler.has_function('strcasestr')
+ libgit_c_args += '-DNO_STRCASESTR'
+ libgit_sources += 'compat/strcasestr.c'
+endif
+
+if not compiler.has_function('memmem')
+ libgit_c_args += '-DNO_MEMMEM'
+ libgit_sources += 'compat/memmem.c'
+endif
+
+if not compiler.has_function('strlcpy')
+ libgit_c_args += '-DNO_STRLCPY'
+ libgit_sources += 'compat/strlcpy.c'
+endif
+
+if not compiler.has_function('strdup')
+ libgit_c_args += '-DOVERRIDE_STRDUP'
+ libgit_sources += 'compat/strdup.c'
+endif
+
+if not compiler.has_function('strtoumax')
+ libgit_c_args += '-DNO_STRTOUMAX'
+ libgit_sources += [
+ 'compat/strtoumax.c',
+ 'compat/strtoimax.c',
+ ]
+endif
+
+if not compiler.has_function('strtoull')
+ libgit_c_args += '-DNO_STRTOULL'
+endif
+
+if not compiler.has_function('setenv')
+ libgit_c_args += '-DNO_SETENV'
+ libgit_sources += 'compat/setenv.c'
+endif
+
+if not compiler.has_function('qsort')
+ libgit_c_args += '-DINTERNAL_QSORT'
+endif
+libgit_sources += 'compat/qsort_s.c'
+
+# unsetenv is provided by compat/mingw.c.
+if host_machine.system() != 'windows' and not compiler.has_function('unsetenv')
+ libgit_c_args += '-DNO_UNSETENV'
+ libgit_sources += 'compat/unsetenv.c'
+endif
+
+if not compiler.has_function('mkdtemp')
+ libgit_c_args += '-DNO_MKDTEMP'
+ libgit_sources += 'compat/mkdtemp.c'
+endif
+
+if not compiler.has_function('initgroups')
+ libgit_c_args += '-DNO_INITGROUPS'
+endif
+
+if compiler.has_function('getdelim')
+ libgit_c_args += '-DHAVE_GETDELIM'
+endif
+
+if host_machine.system() == 'windows'
+ libgit_c_args += '-DUSE_WIN32_MMAP'
+elif not compiler.has_function('mmap')
+ libgit_c_args += '-DNO_MMAP'
+ libgit_sources += 'compat/mmap.c'
+endif
+
+if compiler.has_function('clock_gettime')
+ libgit_c_args += '-DHAVE_CLOCK_GETTIME'
+endif
+
+if compiler.compiles('''
+ #include <time.h>
+
+ void func(void)
+ {
+ clockid_t id = CLOCK_MONOTONIC;
+ }
+''', name: 'monotonic clock')
+ libgit_c_args += '-DHAVE_CLOCK_MONOTONIC'
+endif
+
+if not compiler.compiles('''
+ #include <inttypes.h>
+
+ void func(void)
+ {
+ uintmax_t x = 0;
+ }
+''', name: 'uintmax_t')
+ libgit_c_args += '-DNO_UINTMAX_T'
+endif
+
+has_bsd_sysctl = false
+if compiler.has_header('sys/sysctl.h')
+ if compiler.compiles('''
+ #include <stddef.h>
+ #include <sys/sysctl.h>
+
+ void func(void)
+ {
+ int val, mib[2] = { 0 };
+ size_t len = sizeof(val);
+ sysctl(mib, 2, &val, &len, NULL, 0);
+ }
+ ''', name: 'BSD sysctl')
+ libgit_c_args += '-DHAVE_BSD_SYSCTL'
+ has_bsd_sysctl = true
+ endif
+endif
+
+if not meson.is_cross_build() and compiler.run('''
+ #include <stdio.h>
+
+ int main(int argc, const char **argv)
+ {
+ FILE *f = fopen(".", "r");
+ return f ? 0 : 1;
+ }
+''', name: 'fread reads directories').returncode() == 0
+ libgit_c_args += '-DFREAD_READS_DIRECTORIES'
+ libgit_sources += 'compat/fopen.c'
+endif
+
+if not meson.is_cross_build() and fs.exists('/dev/tty')
+ libgit_c_args += '-DHAVE_DEV_TTY'
+endif
+
+https_backend = get_option('https_backend')
+
+security_framework = dependency('Security', required: https_backend == 'CommonCrypto')
+core_foundation_framework = dependency('CoreFoundation', required: security_framework.found())
+if https_backend == 'auto' and security_framework.found()
+ https_backend = 'CommonCrypto'
+endif
+
+openssl_required = https_backend == 'openssl' or get_option('sha1_backend') == 'openssl' or get_option('sha256_backend') == 'openssl'
+openssl = dependency('openssl', required: openssl_required, default_options: ['default_library=static'])
+if https_backend == 'auto' and openssl.found()
+ https_backend = 'openssl'
+endif
+
+if https_backend == 'CommonCrypto'
+ libgit_dependencies += security_framework
+ libgit_dependencies += core_foundation_framework
+ libgit_c_args += '-DAPPLE_COMMON_CRYPTO'
+elif https_backend == 'openssl'
+ libgit_dependencies += openssl
+else
+ # We either couldn't find any dependencies with 'auto' or the user requested
+ # 'none'. Both cases are benign.
+endif
+
+if https_backend != 'openssl'
+ libgit_c_args += '-DNO_OPENSSL'
+endif
+
+sha1_backend = get_option('sha1_backend')
+if sha1_backend == 'sha1dc'
+ libgit_c_args += '-DSHA1_DC'
+ libgit_c_args += '-DSHA1DC_NO_STANDARD_INCLUDES=1'
+ libgit_c_args += '-DSHA1DC_INIT_SAFE_HASH_DEFAULT=0'
+ libgit_c_args += '-DSHA1DC_CUSTOM_INCLUDE_SHA1_C="git-compat-util.h"'
+ libgit_c_args += '-DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="git-compat-util.h"'
+
+ libgit_sources += [
+ 'sha1dc_git.c',
+ 'sha1dc/sha1.c',
+ 'sha1dc/ubc_check.c',
+ ]
+elif sha1_backend == 'common-crypto'
+ libgit_c_args += '-DCOMMON_DIGEST_FOR_OPENSSL'
+ libgit_c_args += '-DSHA1_APPLE'
+ # Apple CommonCrypto requires chunking
+ libgit_c_args += '-DSHA1_MAX_BLOCK_SIZE=1024L*1024L*1024L'
+elif sha1_backend == 'openssl'
+ libgit_c_args += '-DSHA1_OPENSSL'
+ libgit_dependencies += openssl
+elif sha1_backend == 'block'
+ libgit_c_args += '-DSHA1_BLK'
+ libgit_sources += 'block-sha1/sha1.c'
+else
+ error('Unhandled SHA1 backend ' + sha1_backend)
+endif
+
+sha256_backend = get_option('sha256_backend')
+if sha256_backend == 'openssl'
+ libgit_c_args += '-DSHA256_OPENSSL'
+ libgit_dependencies += openssl
+elif sha256_backend == 'nettle'
+ nettle = dependency('nettle')
+ libgit_dependencies += nettle
+ libgit_c_args += '-DSHA256_NETTLE'
+elif sha256_backend == 'gcrypt'
+ gcrypt = dependency('gcrypt')
+ libgit_dependencies += gcrypt
+ libgit_c_args += '-DSHA256_GCRYPT'
+elif sha256_backend == 'block'
+ libgit_c_args += '-DSHA256_BLK'
+ libgit_sources += 'sha256/block/sha256.c'
+else
+ error('Unhandled SHA256 backend ' + sha256_backend)
+endif
+
+if compiler.has_header_symbol('stdlib.h', 'arc4random_buf')
+ libgit_c_args += '-DHAVE_ARC4RANDOM'
+elif compiler.has_header_symbol('bsd/stdlib.h', 'arc4random_buf')
+ libgit_c_args += '-DHAVE_ARC4RANDOM_BSD'
+elif compiler.has_function('getrandom', prefix: '#include <sys/random.h>')
+ libgit_c_args += '-DHAVE_GETRANDOM'
+elif compiler.has_function('getentropy', prefix: '#include <unistd.h>')
+ libgit_c_args += '-DHAVE_GETENTROPY'
+elif compiler.has_function('RtlGenRandom', prefix: '#include <windows.h>\n#include <ntsecapi.h>')
+ libgit_c_args += '-DHAVE_RTLGENRANDOM'
+elif openssl.found()
+ libgit_c_args += '-DHAVE_OPENSSL_CSPRNG'
+endif
+
+if get_option('runtime_prefix')
+ libgit_c_args += '-DRUNTIME_PREFIX'
+ build_options_config.set('RUNTIME_PREFIX', 'true')
+
+ if compiler.has_header('mach-o/dyld.h')
+ libgit_c_args += '-DHAVE_NS_GET_EXECUTABLE_PATH'
+ endif
+
+ if has_bsd_sysctl and compiler.compiles('''
+ #include <sys/sysctl.h>
+
+ void func(void)
+ {
+ KERN_PROC_PATHNAME; KERN_PROC;
+ }
+ ''', name: 'BSD KERN_PROC_PATHNAME')
+ libgit_c_args += '-DHAVE_NS_GET_EXECUTABLE_PATH'
+ endif
+
+ if host_machine.system() == 'linux'
+ libgit_c_args += '-DPROCFS_EXECUTABLE_PATH="/proc/self/exe' + '"'
+ elif host_machine.system() == 'openbsd'
+ libgit_c_args += '-DPROCFS_EXECUTABLE_PATH="' + '/proc/curproc/file' + '"'
+ elif host_machine.system() == 'netbsd'
+ libgit_c_args += '-DPROCFS_EXECUTABLE_PATH="' + '/proc/curproc/exe' + '"'
+ endif
+
+ if host_machine.system() == 'windows' and compiler.compiles('''
+ #include <stdlib.h>
+
+ void func(void)
+ {
+ _wpgmptr;
+ }
+ ''', name: 'Win32 _wpgmptr')
+ libgit_c_args += '-DHAVE_WPGMPTR'
+ endif
+else
+ build_options_config.set('RUNTIME_PREFIX', 'false')
+endif
+
+foreach key, value : {
+ 'DIFF': diff.full_path(),
+ 'GIT_TEST_CMP': diff.full_path() + ' -u',
+ 'GIT_TEST_GITPERLLIB': meson.project_build_root() / 'perl',
+ 'GIT_TEST_MERGE_TOOLS_DIR': meson.project_source_root() / 'mergetools',
+ 'GIT_TEST_POPATH': meson.project_source_root() / 'po',
+ 'GIT_TEST_TEMPLATE_DIR': meson.project_build_root() / 'templates',
+ 'GIT_TEST_TEXTDOMAINDIR': meson.project_build_root() / 'po',
+ 'PAGER_ENV': get_option('pager_environment'),
+ 'PERL_PATH': perl.found() ? perl.full_path() : '',
+ 'PYTHON_PATH': python.found () ? python.full_path() : '',
+ 'SHELL_PATH': shell.full_path(),
+ 'TAR': tar.full_path(),
+ 'TEST_OUTPUT_DIRECTORY': test_output_directory,
+ 'TEST_SHELL_PATH': shell.full_path(),
+}
+ if value != '' and cygpath.found()
+ value = run_command(cygpath, value, check: true).stdout().strip()
+ endif
+ build_options_config.set_quoted(key, value)
+endforeach
+
+configure_file(
+ input: 'GIT-BUILD-OPTIONS.in',
+ output: 'GIT-BUILD-OPTIONS',
+ configuration: build_options_config,
+)
+
+git_version_file = custom_target(
+ command: [
+ shell,
+ meson.current_source_dir() / 'GIT-VERSION-GEN',
+ meson.current_source_dir(),
+ '@INPUT@',
+ '@OUTPUT@',
+ ],
+ input: meson.current_source_dir() / 'GIT-VERSION-FILE.in',
+ output: 'GIT-VERSION-FILE',
+ build_always_stale: true,
+)
+
+version_def_h = custom_target(
+ command: [
+ shell,
+ meson.current_source_dir() / 'GIT-VERSION-GEN',
+ meson.current_source_dir(),
+ '@INPUT@',
+ '@OUTPUT@',
+ ],
+ input: meson.current_source_dir() / 'version-def.h.in',
+ output: 'version-def.h',
+ # Depend on GIT-VERSION-FILE so that we don't always try to rebuild this
+ # target for the same commit.
+ depends: [git_version_file],
+)
+
+# Build a separate library for "version.c" so that we do not have to rebuild
+# everything when the current Git commit changes.
+libgit_version_library = static_library('git-version',
+ sources: [
+ 'version.c',
+ version_def_h,
+ ],
+ c_args: libgit_c_args,
+ dependencies: libgit_dependencies,
+ include_directories: libgit_include_directories,
+)
+
+libgit_library = static_library('git',
+ sources: libgit_sources,
+ c_args: libgit_c_args,
+ link_with: libgit_version_library,
+ dependencies: libgit_dependencies,
+ include_directories: libgit_include_directories,
+)
+
+libgit = declare_dependency(
+ compile_args: libgit_c_args,
+ link_with: libgit_library,
+ dependencies: libgit_dependencies,
+ include_directories: libgit_include_directories,
+)
+
+common_main_sources = ['common-main.c']
+common_main_link_args = [ ]
+if host_machine.system() == 'windows'
+ git_rc = custom_target(
+ command: [
+ shell,
+ meson.current_source_dir() / 'GIT-VERSION-GEN',
+ meson.current_source_dir(),
+ '@INPUT@',
+ '@OUTPUT@',
+ ],
+ input: meson.current_source_dir() / 'git.rc.in',
+ output: 'git.rc',
+ depends: [git_version_file],
+ )
+
+ common_main_sources += import('windows').compile_resources(git_rc,
+ include_directories: [meson.current_source_dir()],
+ )
+ if compiler.get_argument_syntax() == 'gcc'
+ common_main_link_args += [
+ '-municode',
+ '-Wl,-nxcompat',
+ '-Wl,-dynamicbase',
+ '-Wl,-pic-executable,-e,mainCRTStartup',
+ ]
+ elif compiler.get_argument_syntax() == 'msvc'
+ common_main_link_args += [
+ '/ENTRY:wmainCRTStartup',
+ 'invalidcontinue.obj',
+ ]
+ else
+ error('Unsupported compiler ' + compiler.get_id())
+ endif
+endif
+common_main_library = static_library('common-main',
+ 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,
+ link_args: common_main_link_args,
+)
+
+bin_wrappers = [ ]
+test_dependencies = [ ]
+
+git = executable('git',
+ sources: builtin_sources + 'git.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+bin_wrappers += git
+
+test_dependencies += executable('git-daemon',
+ sources: 'daemon.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+test_dependencies += executable('git-sh-i18n--envsubst',
+ sources: 'sh-i18n--envsubst.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+bin_wrappers += executable('git-shell',
+ sources: 'shell.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+test_dependencies += executable('git-http-backend',
+ sources: 'http-backend.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+bin_wrappers += executable('scalar',
+ sources: 'scalar.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+if get_option('curl').enabled()
+ curl_sources = [
+ 'http.c',
+ 'http-walker.c',
+ ]
+
+ git_remote_http = executable('git-remote-http',
+ sources: curl_sources + 'remote-curl.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+ test_dependencies += git_remote_http
+
+ test_dependencies += executable('git-http-fetch',
+ sources: curl_sources + 'http-fetch.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+
+ if expat.found()
+ test_dependencies += executable('git-http-push',
+ sources: curl_sources + 'http-push.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+ endif
+
+ 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, common_main],
+ )
+
+ install_symlink(alias + executable_suffix,
+ install_dir: get_option('libexecdir') / 'git-core',
+ pointing_to: 'git-remote-http',
+ )
+ endforeach
+endif
+
+imap_send_sources = ['imap-send.c']
+if use_curl_for_imap_send
+ imap_send_sources += curl_sources
+endif
+
+test_dependencies += executable('git-imap-send',
+ sources: imap_send_sources,
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+foreach alias : [ 'git-receive-pack', 'git-upload-archive', 'git-upload-pack' ]
+ bin_wrappers += executable(alias,
+ objects: git.extract_all_objects(recursive: false),
+ dependencies: [libgit, common_main],
+ )
+
+ install_symlink(alias + executable_suffix,
+ install_dir: get_option('libexecdir') / 'git-core',
+ pointing_to: 'git',
+ )
+endforeach
+
+foreach symlink : [
+ 'git',
+ 'git-receive-pack',
+ 'git-shell',
+ 'git-upload-archive',
+ 'git-upload-pack',
+ 'scalar',
+]
+ if meson.version().version_compare('>=1.3.0')
+ pointing_to = fs.relative_to(get_option('libexecdir') / 'git-core' / symlink, get_option('bindir'))
+ else
+ pointing_to = '../libexec/git-core' / symlink
+ endif
+
+ install_symlink(symlink,
+ install_dir: get_option('bindir'),
+ pointing_to: pointing_to,
+ )
+endforeach
+
+scripts_sh = [
+ 'git-difftool--helper.sh',
+ 'git-filter-branch.sh',
+ 'git-merge-octopus.sh',
+ 'git-merge-one-file.sh',
+ 'git-merge-resolve.sh',
+ 'git-mergetool--lib.sh',
+ 'git-mergetool.sh',
+ 'git-quiltimport.sh',
+ 'git-request-pull.sh',
+ 'git-sh-i18n.sh',
+ 'git-sh-setup.sh',
+ 'git-submodule.sh',
+ 'git-web--browse.sh',
+]
+if perl_features_enabled
+ scripts_sh += 'git-instaweb.sh'
+endif
+
+foreach script : scripts_sh
+ test_dependencies += custom_target(
+ input: script,
+ output: fs.stem(script),
+ command: [
+ shell,
+ meson.project_source_root() / 'generate-script.sh',
+ '@INPUT@',
+ '@OUTPUT@',
+ meson.project_build_root() / 'GIT-BUILD-OPTIONS',
+ ],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+endforeach
+
+if perl_features_enabled
+ scripts_perl = [
+ 'git-archimport.perl',
+ 'git-cvsexportcommit.perl',
+ 'git-cvsimport.perl',
+ 'git-cvsserver.perl',
+ 'git-send-email.perl',
+ 'git-svn.perl',
+ ]
+
+ pathsep = ':'
+ if host_machine.system() == 'windows'
+ pathsep = ';'
+ endif
+
+ perl_header_template = 'perl/header_templates/fixed_prefix.template.pl'
+ if get_option('runtime_prefix')
+ perl_header_template = 'perl/header_templates/runtime_prefix.template.pl'
+ endif
+
+ perl_header = configure_file(
+ input: perl_header_template,
+ output: 'GIT-PERL-HEADER',
+ configuration: {
+ 'GITEXECDIR_REL': get_option('libexecdir') / 'git-core',
+ 'PERLLIBDIR_REL': get_option('datadir') / 'perl5',
+ 'LOCALEDIR_REL': get_option('datadir') / 'locale',
+ 'INSTLIBDIR': get_option('datadir') / 'perl5',
+ 'PATHSEP': pathsep,
+ },
+ )
+
+ generate_perl_command = [
+ shell,
+ meson.project_source_root() / 'generate-perl.sh',
+ meson.project_build_root() / 'GIT-BUILD-OPTIONS',
+ git_version_file.full_path(),
+ perl_header,
+ '@INPUT@',
+ '@OUTPUT@',
+ ]
+
+ foreach script : scripts_perl
+ generated_script = custom_target(
+ input: script,
+ output: fs.stem(script),
+ command: generate_perl_command,
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ depends: [git_version_file],
+ )
+ test_dependencies += generated_script
+
+ if script == 'git-cvsserver.perl'
+ bin_wrappers += generated_script
+
+ if meson.version().version_compare('>=1.3.0')
+ pointing_to = fs.relative_to(get_option('libexecdir') / 'git-core' / fs.stem(script), get_option('bindir'))
+ else
+ pointing_to = '../libexec/git-core' / fs.stem(script)
+ endif
+
+ install_symlink(fs.stem(script),
+ install_dir: get_option('bindir'),
+ pointing_to: pointing_to,
+ )
+ endif
+ endforeach
+
+ subdir('perl')
+endif
+
+if python.found()
+ scripts_python = [
+ 'git-p4.py'
+ ]
+
+ foreach script : scripts_python
+ generated_python = custom_target(
+ input: script,
+ output: fs.stem(script),
+ command: [
+ shell,
+ meson.project_source_root() / 'generate-python.sh',
+ meson.project_build_root() / 'GIT-BUILD-OPTIONS',
+ '@INPUT@',
+ '@OUTPUT@',
+ ],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+ test_dependencies += generated_python
+ endforeach
+endif
+
+mergetools = [
+ 'mergetools/araxis',
+ 'mergetools/bc',
+ 'mergetools/codecompare',
+ 'mergetools/deltawalker',
+ 'mergetools/diffmerge',
+ 'mergetools/diffuse',
+ 'mergetools/ecmerge',
+ 'mergetools/emerge',
+ 'mergetools/examdiff',
+ 'mergetools/guiffy',
+ 'mergetools/gvimdiff',
+ 'mergetools/kdiff3',
+ 'mergetools/kompare',
+ 'mergetools/meld',
+ 'mergetools/nvimdiff',
+ 'mergetools/opendiff',
+ 'mergetools/p4merge',
+ 'mergetools/smerge',
+ 'mergetools/tkdiff',
+ 'mergetools/tortoisemerge',
+ 'mergetools/vimdiff',
+ 'mergetools/vscode',
+ 'mergetools/winmerge',
+ 'mergetools/xxdiff',
+]
+
+foreach mergetool : mergetools
+ install_data(mergetool, install_dir: get_option('libexecdir') / 'git-core' / 'mergetools')
+endforeach
+
+if intl.found()
+ subdir('po')
+endif
+subdir('contrib')
+subdir('gitweb')
+subdir('templates')
+
+# Everything but the bin-wrappers need to come before this target such that we
+# can properly set up test dependencies. The bin-wrappers themselves are set up
+# at configuration time, so these are fine.
+if get_option('tests')
+ subdir('t')
+endif
+
+subdir('bin-wrappers')
+if get_option('docs') != []
+ subdir('Documentation')
+endif
+
+summary({
+ 'curl': curl.found(),
+ 'expat': expat.found(),
+ 'gettext': intl.found(),
+ 'https': https_backend,
+ 'iconv': iconv.found(),
+ 'pcre2': pcre2.found(),
+ 'perl': perl_features_enabled,
+ 'python': python.found(),
+}, section: 'Auto-detected features')
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000000000000000000000000000000000000..32a72139bae870745d9131cc9086a4594826be91
--- /dev/null
+++ b/meson_options.txt
@@ -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')
diff --git a/perl/FromCPAN/Mail/meson.build b/perl/FromCPAN/Mail/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..129cff161c585645c111af0386bafe136258e3db
--- /dev/null
+++ b/perl/FromCPAN/Mail/meson.build
@@ -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',
+)
diff --git a/perl/FromCPAN/meson.build b/perl/FromCPAN/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..4e7ea909df3593fb65facb4bf6a1c42e954d6f70
--- /dev/null
+++ b/perl/FromCPAN/meson.build
@@ -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')
diff --git a/perl/Git/LoadCPAN/Mail/meson.build b/perl/Git/LoadCPAN/Mail/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..7da5b37adb278b4e13f41ea5ebc762bb4d78b64b
--- /dev/null
+++ b/perl/Git/LoadCPAN/Mail/meson.build
@@ -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',
+)
diff --git a/perl/Git/LoadCPAN/meson.build b/perl/Git/LoadCPAN/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..9468c073aeb5ae1980f88b4c7f2c7fe69355ea37
--- /dev/null
+++ b/perl/Git/LoadCPAN/meson.build
@@ -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')
diff --git a/perl/Git/SVN/Memoize/meson.build b/perl/Git/SVN/Memoize/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..515ab3dd926618f6c46b030e1f283d637fdddedf
--- /dev/null
+++ b/perl/Git/SVN/Memoize/meson.build
@@ -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',
+)
diff --git a/perl/Git/SVN/meson.build b/perl/Git/SVN/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..8338531041d8e5cd4e8c2c8a0c3dcfc8b2d23cc9
--- /dev/null
+++ b/perl/Git/SVN/meson.build
@@ -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')
diff --git a/perl/Git/meson.build b/perl/Git/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..259209d7302809b6c1d3249d9d21548515c31c77
--- /dev/null
+++ b/perl/Git/meson.build
@@ -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')
diff --git a/perl/meson.build b/perl/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..c22d6f8a1a3266ded27c43c43c88620f9b4badcf
--- /dev/null
+++ b/perl/meson.build
@@ -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
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..d7154b6395b2bf4a27110aad65aa1f51f979a1e9
--- /dev/null
+++ b/po/meson.build
@@ -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]
diff --git a/subprojects/.gitignore b/subprojects/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..63ea916ef5f30255aef0c0b0b63f37b0e1d99fb2
--- /dev/null
+++ b/subprojects/.gitignore
@@ -0,0 +1 @@
+/*/
diff --git a/subprojects/curl.wrap b/subprojects/curl.wrap
new file mode 100644
index 0000000000000000000000000000000000000000..f7e384b85cf5ee98672e4409e1d30f8f6f0e5735
--- /dev/null
+++ b/subprojects/curl.wrap
@@ -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
diff --git a/subprojects/expat.wrap b/subprojects/expat.wrap
new file mode 100644
index 0000000000000000000000000000000000000000..2e0427dcfd144c22d8c0bfd333e3cf31f14855a7
--- /dev/null
+++ b/subprojects/expat.wrap
@@ -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
diff --git a/subprojects/openssl.wrap b/subprojects/openssl.wrap
new file mode 100644
index 0000000000000000000000000000000000000000..873d55106e9b83c487a88dfbb85eaf73429464d7
--- /dev/null
+++ b/subprojects/openssl.wrap
@@ -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
diff --git a/subprojects/pcre2.wrap b/subprojects/pcre2.wrap
new file mode 100644
index 0000000000000000000000000000000000000000..7e184472543bde1572b9e780ae29318fe01e72bc
--- /dev/null
+++ b/subprojects/pcre2.wrap
@@ -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
diff --git a/subprojects/zlib.wrap b/subprojects/zlib.wrap
new file mode 100644
index 0000000000000000000000000000000000000000..aa14de17740728cecdb7431fb101e55e9b022273
--- /dev/null
+++ b/subprojects/zlib.wrap
@@ -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
diff --git a/t/helper/meson.build b/t/helper/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..5e83884246edc7841738de5085f3255aa1fa3fbe
--- /dev/null
+++ b/t/helper/meson.build
@@ -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
diff --git a/t/meson.build b/t/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..13fe854ba0a18f9b83dbc48651f581198042ffd3
--- /dev/null
+++ b/t/meson.build
@@ -0,0 +1,1114 @@
+clar_test_suites = [
+ 'unit-tests/ctype.c',
+ 'unit-tests/strvec.c',
+]
+
+clar_sources = [
+ 'unit-tests/clar/clar.c',
+ 'unit-tests/unit-test.c',
+]
+
+clar_decls_h = custom_target(
+ input: clar_test_suites,
+ output: 'clar-decls.h',
+ command : [
+ shell,
+ meson.current_source_dir() + '/unit-tests/generate-clar-decls.sh',
+ '@OUTPUT@',
+ '@INPUT@',
+ ],
+ env: script_environment,
+)
+clar_sources += clar_decls_h
+
+clar_sources += custom_target(
+ input: clar_decls_h,
+ output: 'clar.suite',
+ command : [
+ shell,
+ meson.current_source_dir() + '/unit-tests/generate-clar-suites.sh',
+ '@INPUT@',
+ '@OUTPUT@',
+ ],
+ env: script_environment,
+)
+
+clar_unit_tests = executable('unit-tests',
+ sources: clar_sources + clar_test_suites,
+ dependencies: [libgit, common_main],
+)
+test('unit-tests', clar_unit_tests)
+
+unit_test_programs = [
+ 'unit-tests/t-example-decorate.c',
+ 'unit-tests/t-hash.c',
+ 'unit-tests/t-hashmap.c',
+ 'unit-tests/t-mem-pool.c',
+ 'unit-tests/t-oid-array.c',
+ 'unit-tests/t-oidmap.c',
+ 'unit-tests/t-oidtree.c',
+ 'unit-tests/t-prio-queue.c',
+ 'unit-tests/t-reftable-basics.c',
+ 'unit-tests/t-reftable-block.c',
+ 'unit-tests/t-reftable-merged.c',
+ 'unit-tests/t-reftable-pq.c',
+ 'unit-tests/t-reftable-reader.c',
+ 'unit-tests/t-reftable-readwrite.c',
+ 'unit-tests/t-reftable-record.c',
+ 'unit-tests/t-reftable-stack.c',
+ 'unit-tests/t-reftable-tree.c',
+ 'unit-tests/t-strbuf.c',
+ 'unit-tests/t-strcmp-offset.c',
+ 'unit-tests/t-trailer.c',
+ 'unit-tests/t-urlmatch-normalization.c',
+]
+
+foreach unit_test_program : unit_test_programs
+ unit_test_name = fs.stem(unit_test_program)
+ unit_test = executable(unit_test_name,
+ sources: [
+ 'unit-tests/test-lib.c',
+ 'unit-tests/lib-oid.c',
+ 'unit-tests/lib-reftable.c',
+ unit_test_program,
+ ],
+ dependencies: [libgit, common_main],
+ )
+ test(unit_test_name, unit_test,
+ workdir: meson.current_source_dir(),
+ timeout: 0,
+ )
+endforeach
+
+subdir('helper')
+
+integration_tests = [
+ 't0000-basic.sh',
+ 't0001-init.sh',
+ 't0002-gitfile.sh',
+ 't0003-attributes.sh',
+ 't0004-unwritable.sh',
+ 't0005-signals.sh',
+ 't0006-date.sh',
+ 't0007-git-var.sh',
+ 't0008-ignores.sh',
+ 't0010-racy-git.sh',
+ 't0012-help.sh',
+ 't0013-sha1dc.sh',
+ 't0014-alias.sh',
+ 't0017-env-helper.sh',
+ 't0018-advice.sh',
+ 't0019-json-writer.sh',
+ 't0020-crlf.sh',
+ 't0021-conversion.sh',
+ 't0022-crlf-rename.sh',
+ 't0023-crlf-am.sh',
+ 't0024-crlf-archive.sh',
+ 't0025-crlf-renormalize.sh',
+ 't0026-eol-config.sh',
+ 't0027-auto-crlf.sh',
+ 't0028-working-tree-encoding.sh',
+ 't0029-core-unsetenvvars.sh',
+ 't0030-stripspace.sh',
+ 't0033-safe-directory.sh',
+ 't0034-root-safe-directory.sh',
+ 't0035-safe-bare-repository.sh',
+ 't0040-parse-options.sh',
+ 't0041-usage.sh',
+ 't0050-filesystem.sh',
+ 't0051-windows-named-pipe.sh',
+ 't0052-simple-ipc.sh',
+ 't0055-beyond-symlinks.sh',
+ 't0056-git-C.sh',
+ 't0060-path-utils.sh',
+ 't0061-run-command.sh',
+ 't0062-revision-walking.sh',
+ 't0063-string-list.sh',
+ 't0066-dir-iterator.sh',
+ 't0067-parse_pathspec_file.sh',
+ 't0068-for-each-repo.sh',
+ 't0070-fundamental.sh',
+ 't0071-sort.sh',
+ 't0080-unit-test-output.sh',
+ 't0081-find-pack.sh',
+ 't0090-cache-tree.sh',
+ 't0091-bugreport.sh',
+ 't0092-diagnose.sh',
+ 't0095-bloom.sh',
+ 't0100-previous.sh',
+ 't0101-at-syntax.sh',
+ 't0200-gettext-basic.sh',
+ 't0201-gettext-fallbacks.sh',
+ 't0202-gettext-perl.sh',
+ 't0203-gettext-setlocale-sanity.sh',
+ 't0204-gettext-reencode-sanity.sh',
+ 't0210-trace2-normal.sh',
+ 't0211-trace2-perf.sh',
+ 't0212-trace2-event.sh',
+ 't0300-credentials.sh',
+ 't0301-credential-cache.sh',
+ 't0302-credential-store.sh',
+ 't0303-credential-external.sh',
+ 't0410-partial-clone.sh',
+ 't0411-clone-from-partial.sh',
+ 't0450-txt-doc-vs-help.sh',
+ 't0500-progress-display.sh',
+ 't0600-reffiles-backend.sh',
+ 't0601-reffiles-pack-refs.sh',
+ 't0602-reffiles-fsck.sh',
+ 't0610-reftable-basics.sh',
+ 't0611-reftable-httpd.sh',
+ 't0612-reftable-jgit-compatibility.sh',
+ 't0613-reftable-write-options.sh',
+ 't1000-read-tree-m-3way.sh',
+ 't1001-read-tree-m-2way.sh',
+ 't1002-read-tree-m-u-2way.sh',
+ 't1003-read-tree-prefix.sh',
+ 't1004-read-tree-m-u-wf.sh',
+ 't1005-read-tree-reset.sh',
+ 't1006-cat-file.sh',
+ 't1007-hash-object.sh',
+ 't1008-read-tree-overlay.sh',
+ 't1009-read-tree-new-index.sh',
+ 't1010-mktree.sh',
+ 't1011-read-tree-sparse-checkout.sh',
+ 't1012-read-tree-df.sh',
+ 't1013-read-tree-submodule.sh',
+ 't1014-read-tree-confusing.sh',
+ 't1015-read-index-unmerged.sh',
+ 't1016-compatObjectFormat.sh',
+ 't1020-subdirectory.sh',
+ 't1021-rerere-in-workdir.sh',
+ 't1022-read-tree-partial-clone.sh',
+ 't1050-large.sh',
+ 't1051-large-conversion.sh',
+ 't1060-object-corruption.sh',
+ 't1090-sparse-checkout-scope.sh',
+ 't1091-sparse-checkout-builtin.sh',
+ 't1092-sparse-checkout-compatibility.sh',
+ 't1100-commit-tree-options.sh',
+ 't1300-config.sh',
+ 't1301-shared-repo.sh',
+ 't1302-repo-version.sh',
+ 't1303-wacky-config.sh',
+ 't1304-default-acl.sh',
+ 't1305-config-include.sh',
+ 't1306-xdg-files.sh',
+ 't1307-config-blob.sh',
+ 't1308-config-set.sh',
+ 't1309-early-config.sh',
+ 't1310-config-default.sh',
+ 't1350-config-hooks-path.sh',
+ 't1400-update-ref.sh',
+ 't1401-symbolic-ref.sh',
+ 't1402-check-ref-format.sh',
+ 't1403-show-ref.sh',
+ 't1404-update-ref-errors.sh',
+ 't1405-main-ref-store.sh',
+ 't1406-submodule-ref-store.sh',
+ 't1407-worktree-ref-store.sh',
+ 't1408-packed-refs.sh',
+ 't1409-avoid-packing-refs.sh',
+ 't1410-reflog.sh',
+ 't1411-reflog-show.sh',
+ 't1412-reflog-loop.sh',
+ 't1413-reflog-detach.sh',
+ 't1414-reflog-walk.sh',
+ 't1415-worktree-refs.sh',
+ 't1416-ref-transaction-hooks.sh',
+ 't1417-reflog-updateref.sh',
+ 't1418-reflog-exists.sh',
+ 't1419-exclude-refs.sh',
+ 't1420-lost-found.sh',
+ 't1430-bad-ref-name.sh',
+ 't1450-fsck.sh',
+ 't1451-fsck-buffer.sh',
+ 't1460-refs-migrate.sh',
+ 't1500-rev-parse.sh',
+ 't1501-work-tree.sh',
+ 't1502-rev-parse-parseopt.sh',
+ 't1503-rev-parse-verify.sh',
+ 't1504-ceiling-dirs.sh',
+ 't1505-rev-parse-last.sh',
+ 't1506-rev-parse-diagnosis.sh',
+ 't1507-rev-parse-upstream.sh',
+ 't1508-at-combinations.sh',
+ 't1509-root-work-tree.sh',
+ 't1510-repo-setup.sh',
+ 't1511-rev-parse-caret.sh',
+ 't1512-rev-parse-disambiguation.sh',
+ 't1513-rev-parse-prefix.sh',
+ 't1514-rev-parse-push.sh',
+ 't1515-rev-parse-outside-repo.sh',
+ 't1517-outside-repo.sh',
+ 't1600-index.sh',
+ 't1601-index-bogus.sh',
+ 't1700-split-index.sh',
+ 't1701-racy-split-index.sh',
+ 't1800-hook.sh',
+ 't2000-conflict-when-checking-files-out.sh',
+ 't2002-checkout-cache-u.sh',
+ 't2003-checkout-cache-mkdir.sh',
+ 't2004-checkout-cache-temp.sh',
+ 't2005-checkout-index-symlinks.sh',
+ 't2006-checkout-index-basic.sh',
+ 't2007-checkout-symlink.sh',
+ 't2008-checkout-subdir.sh',
+ 't2009-checkout-statinfo.sh',
+ 't2010-checkout-ambiguous.sh',
+ 't2011-checkout-invalid-head.sh',
+ 't2012-checkout-last.sh',
+ 't2013-checkout-submodule.sh',
+ 't2014-checkout-switch.sh',
+ 't2015-checkout-unborn.sh',
+ 't2016-checkout-patch.sh',
+ 't2017-checkout-orphan.sh',
+ 't2018-checkout-branch.sh',
+ 't2019-checkout-ambiguous-ref.sh',
+ 't2020-checkout-detach.sh',
+ 't2021-checkout-overwrite.sh',
+ 't2022-checkout-paths.sh',
+ 't2023-checkout-m.sh',
+ 't2024-checkout-dwim.sh',
+ 't2025-checkout-no-overlay.sh',
+ 't2026-checkout-pathspec-file.sh',
+ 't2027-checkout-track.sh',
+ 't2030-unresolve-info.sh',
+ 't2050-git-dir-relative.sh',
+ 't2060-switch.sh',
+ 't2070-restore.sh',
+ 't2071-restore-patch.sh',
+ 't2072-restore-pathspec-file.sh',
+ 't2080-parallel-checkout-basics.sh',
+ 't2081-parallel-checkout-collisions.sh',
+ 't2082-parallel-checkout-attributes.sh',
+ 't2100-update-cache-badpath.sh',
+ 't2101-update-index-reupdate.sh',
+ 't2102-update-index-symlinks.sh',
+ 't2103-update-index-ignore-missing.sh',
+ 't2104-update-index-skip-worktree.sh',
+ 't2105-update-index-gitfile.sh',
+ 't2106-update-index-assume-unchanged.sh',
+ 't2107-update-index-basic.sh',
+ 't2108-update-index-refresh-racy.sh',
+ 't2200-add-update.sh',
+ 't2201-add-update-typechange.sh',
+ 't2202-add-addremove.sh',
+ 't2203-add-intent.sh',
+ 't2204-add-ignored.sh',
+ 't2205-add-worktree-config.sh',
+ 't2300-cd-to-toplevel.sh',
+ 't2400-worktree-add.sh',
+ 't2401-worktree-prune.sh',
+ 't2402-worktree-list.sh',
+ 't2403-worktree-move.sh',
+ 't2404-worktree-config.sh',
+ 't2405-worktree-submodule.sh',
+ 't2406-worktree-repair.sh',
+ 't2407-worktree-heads.sh',
+ 't2500-untracked-overwriting.sh',
+ 't2501-cwd-empty.sh',
+ 't3000-ls-files-others.sh',
+ 't3001-ls-files-others-exclude.sh',
+ 't3002-ls-files-dashpath.sh',
+ 't3003-ls-files-exclude.sh',
+ 't3004-ls-files-basic.sh',
+ 't3005-ls-files-relative.sh',
+ 't3006-ls-files-long.sh',
+ 't3007-ls-files-recurse-submodules.sh',
+ 't3008-ls-files-lazy-init-name-hash.sh',
+ 't3009-ls-files-others-nonsubmodule.sh',
+ 't3010-ls-files-killed-modified.sh',
+ 't3011-common-prefixes-and-directory-traversal.sh',
+ 't3012-ls-files-dedup.sh',
+ 't3013-ls-files-format.sh',
+ 't3020-ls-files-error-unmatch.sh',
+ 't3040-subprojects-basic.sh',
+ 't3050-subprojects-fetch.sh',
+ 't3060-ls-files-with-tree.sh',
+ 't3070-wildmatch.sh',
+ 't3100-ls-tree-restrict.sh',
+ 't3101-ls-tree-dirname.sh',
+ 't3102-ls-tree-wildcards.sh',
+ 't3103-ls-tree-misc.sh',
+ 't3104-ls-tree-format.sh',
+ 't3105-ls-tree-output.sh',
+ 't3200-branch.sh',
+ 't3201-branch-contains.sh',
+ 't3202-show-branch.sh',
+ 't3203-branch-output.sh',
+ 't3204-branch-name-interpretation.sh',
+ 't3205-branch-color.sh',
+ 't3206-range-diff.sh',
+ 't3207-branch-submodule.sh',
+ 't3211-peel-ref.sh',
+ 't3300-funny-names.sh',
+ 't3301-notes.sh',
+ 't3302-notes-index-expensive.sh',
+ 't3303-notes-subtrees.sh',
+ 't3304-notes-mixed.sh',
+ 't3305-notes-fanout.sh',
+ 't3306-notes-prune.sh',
+ 't3307-notes-man.sh',
+ 't3308-notes-merge.sh',
+ 't3309-notes-merge-auto-resolve.sh',
+ 't3310-notes-merge-manual-resolve.sh',
+ 't3311-notes-merge-fanout.sh',
+ 't3320-notes-merge-worktrees.sh',
+ 't3321-notes-stripspace.sh',
+ 't3400-rebase.sh',
+ 't3401-rebase-and-am-rename.sh',
+ 't3402-rebase-merge.sh',
+ 't3403-rebase-skip.sh',
+ 't3404-rebase-interactive.sh',
+ 't3405-rebase-malformed.sh',
+ 't3406-rebase-message.sh',
+ 't3407-rebase-abort.sh',
+ 't3408-rebase-multi-line.sh',
+ 't3409-rebase-environ.sh',
+ 't3412-rebase-root.sh',
+ 't3413-rebase-hook.sh',
+ 't3415-rebase-autosquash.sh',
+ 't3416-rebase-onto-threedots.sh',
+ 't3417-rebase-whitespace-fix.sh',
+ 't3418-rebase-continue.sh',
+ 't3419-rebase-patch-id.sh',
+ 't3420-rebase-autostash.sh',
+ 't3421-rebase-topology-linear.sh',
+ 't3422-rebase-incompatible-options.sh',
+ 't3423-rebase-reword.sh',
+ 't3424-rebase-empty.sh',
+ 't3425-rebase-topology-merges.sh',
+ 't3426-rebase-submodule.sh',
+ 't3427-rebase-subtree.sh',
+ 't3428-rebase-signoff.sh',
+ 't3429-rebase-edit-todo.sh',
+ 't3430-rebase-merges.sh',
+ 't3431-rebase-fork-point.sh',
+ 't3432-rebase-fast-forward.sh',
+ 't3433-rebase-across-mode-change.sh',
+ 't3434-rebase-i18n.sh',
+ 't3435-rebase-gpg-sign.sh',
+ 't3436-rebase-more-options.sh',
+ 't3437-rebase-fixup-options.sh',
+ 't3438-rebase-broken-files.sh',
+ 't3500-cherry.sh',
+ 't3501-revert-cherry-pick.sh',
+ 't3502-cherry-pick-merge.sh',
+ 't3503-cherry-pick-root.sh',
+ 't3504-cherry-pick-rerere.sh',
+ 't3505-cherry-pick-empty.sh',
+ 't3506-cherry-pick-ff.sh',
+ 't3507-cherry-pick-conflict.sh',
+ 't3508-cherry-pick-many-commits.sh',
+ 't3509-cherry-pick-merge-df.sh',
+ 't3510-cherry-pick-sequence.sh',
+ 't3511-cherry-pick-x.sh',
+ 't3512-cherry-pick-submodule.sh',
+ 't3513-revert-submodule.sh',
+ 't3514-cherry-pick-revert-gpg.sh',
+ 't3600-rm.sh',
+ 't3601-rm-pathspec-file.sh',
+ 't3602-rm-sparse-checkout.sh',
+ 't3650-replay-basics.sh',
+ 't3700-add.sh',
+ 't3701-add-interactive.sh',
+ 't3702-add-edit.sh',
+ 't3703-add-magic-pathspec.sh',
+ 't3704-add-pathspec-file.sh',
+ 't3705-add-sparse-checkout.sh',
+ 't3800-mktag.sh',
+ 't3900-i18n-commit.sh',
+ 't3901-i18n-patch.sh',
+ 't3902-quoted.sh',
+ 't3903-stash.sh',
+ 't3904-stash-patch.sh',
+ 't3905-stash-include-untracked.sh',
+ 't3906-stash-submodule.sh',
+ 't3907-stash-show-config.sh',
+ 't3908-stash-in-worktree.sh',
+ 't3909-stash-pathspec-file.sh',
+ 't3910-mac-os-precompose.sh',
+ 't3920-crlf-messages.sh',
+ 't4000-diff-format.sh',
+ 't4001-diff-rename.sh',
+ 't4002-diff-basic.sh',
+ 't4003-diff-rename-1.sh',
+ 't4004-diff-rename-symlink.sh',
+ 't4005-diff-rename-2.sh',
+ 't4006-diff-mode.sh',
+ 't4007-rename-3.sh',
+ 't4008-diff-break-rewrite.sh',
+ 't4009-diff-rename-4.sh',
+ 't4010-diff-pathspec.sh',
+ 't4011-diff-symlink.sh',
+ 't4012-diff-binary.sh',
+ 't4013-diff-various.sh',
+ 't4014-format-patch.sh',
+ 't4015-diff-whitespace.sh',
+ 't4016-diff-quote.sh',
+ 't4017-diff-retval.sh',
+ 't4018-diff-funcname.sh',
+ 't4019-diff-wserror.sh',
+ 't4020-diff-external.sh',
+ 't4021-format-patch-numbered.sh',
+ 't4022-diff-rewrite.sh',
+ 't4023-diff-rename-typechange.sh',
+ 't4024-diff-optimize-common.sh',
+ 't4025-hunk-header.sh',
+ 't4026-color.sh',
+ 't4027-diff-submodule.sh',
+ 't4028-format-patch-mime-headers.sh',
+ 't4029-diff-trailing-space.sh',
+ 't4030-diff-textconv.sh',
+ 't4031-diff-rewrite-binary.sh',
+ 't4032-diff-inter-hunk-context.sh',
+ 't4033-diff-patience.sh',
+ 't4034-diff-words.sh',
+ 't4035-diff-quiet.sh',
+ 't4036-format-patch-signer-mime.sh',
+ 't4037-diff-r-t-dirs.sh',
+ 't4038-diff-combined.sh',
+ 't4039-diff-assume-unchanged.sh',
+ 't4040-whitespace-status.sh',
+ 't4041-diff-submodule-option.sh',
+ 't4042-diff-textconv-caching.sh',
+ 't4043-diff-rename-binary.sh',
+ 't4044-diff-index-unique-abbrev.sh',
+ 't4045-diff-relative.sh',
+ 't4046-diff-unmerged.sh',
+ 't4047-diff-dirstat.sh',
+ 't4048-diff-combined-binary.sh',
+ 't4049-diff-stat-count.sh',
+ 't4050-diff-histogram.sh',
+ 't4051-diff-function-context.sh',
+ 't4052-stat-output.sh',
+ 't4053-diff-no-index.sh',
+ 't4054-diff-bogus-tree.sh',
+ 't4055-diff-context.sh',
+ 't4056-diff-order.sh',
+ 't4057-diff-combined-paths.sh',
+ 't4058-diff-duplicates.sh',
+ 't4059-diff-submodule-not-initialized.sh',
+ 't4060-diff-submodule-option-diff-format.sh',
+ 't4061-diff-indent.sh',
+ 't4062-diff-pickaxe.sh',
+ 't4063-diff-blobs.sh',
+ 't4064-diff-oidfind.sh',
+ 't4065-diff-anchored.sh',
+ 't4066-diff-emit-delay.sh',
+ 't4067-diff-partial-clone.sh',
+ 't4068-diff-symmetric-merge-base.sh',
+ 't4069-remerge-diff.sh',
+ 't4100-apply-stat.sh',
+ 't4101-apply-nonl.sh',
+ 't4102-apply-rename.sh',
+ 't4103-apply-binary.sh',
+ 't4104-apply-boundary.sh',
+ 't4105-apply-fuzz.sh',
+ 't4106-apply-stdin.sh',
+ 't4107-apply-ignore-whitespace.sh',
+ 't4108-apply-threeway.sh',
+ 't4109-apply-multifrag.sh',
+ 't4110-apply-scan.sh',
+ 't4111-apply-subdir.sh',
+ 't4112-apply-renames.sh',
+ 't4113-apply-ending.sh',
+ 't4114-apply-typechange.sh',
+ 't4115-apply-symlink.sh',
+ 't4116-apply-reverse.sh',
+ 't4117-apply-reject.sh',
+ 't4118-apply-empty-context.sh',
+ 't4119-apply-config.sh',
+ 't4120-apply-popt.sh',
+ 't4121-apply-diffs.sh',
+ 't4122-apply-symlink-inside.sh',
+ 't4123-apply-shrink.sh',
+ 't4124-apply-ws-rule.sh',
+ 't4125-apply-ws-fuzz.sh',
+ 't4126-apply-empty.sh',
+ 't4127-apply-same-fn.sh',
+ 't4128-apply-root.sh',
+ 't4129-apply-samemode.sh',
+ 't4130-apply-criss-cross-rename.sh',
+ 't4131-apply-fake-ancestor.sh',
+ 't4132-apply-removal.sh',
+ 't4133-apply-filenames.sh',
+ 't4134-apply-submodule.sh',
+ 't4135-apply-weird-filenames.sh',
+ 't4136-apply-check.sh',
+ 't4137-apply-submodule.sh',
+ 't4138-apply-ws-expansion.sh',
+ 't4139-apply-escape.sh',
+ 't4140-apply-ita.sh',
+ 't4141-apply-too-large.sh',
+ 't4150-am.sh',
+ 't4151-am-abort.sh',
+ 't4152-am-subjects.sh',
+ 't4153-am-resume-override-opts.sh',
+ 't4200-rerere.sh',
+ 't4201-shortlog.sh',
+ 't4202-log.sh',
+ 't4203-mailmap.sh',
+ 't4204-patch-id.sh',
+ 't4205-log-pretty-formats.sh',
+ 't4206-log-follow-harder-copies.sh',
+ 't4207-log-decoration-colors.sh',
+ 't4208-log-magic-pathspec.sh',
+ 't4209-log-pickaxe.sh',
+ 't4210-log-i18n.sh',
+ 't4211-line-log.sh',
+ 't4212-log-corrupt.sh',
+ 't4213-log-tabexpand.sh',
+ 't4214-log-graph-octopus.sh',
+ 't4215-log-skewed-merges.sh',
+ 't4216-log-bloom.sh',
+ 't4217-log-limit.sh',
+ 't4252-am-options.sh',
+ 't4253-am-keep-cr-dos.sh',
+ 't4254-am-corrupt.sh',
+ 't4255-am-submodule.sh',
+ 't4256-am-format-flowed.sh',
+ 't4257-am-interactive.sh',
+ 't4258-am-quoted-cr.sh',
+ 't4300-merge-tree.sh',
+ 't4301-merge-tree-write-tree.sh',
+ 't5000-tar-tree.sh',
+ 't5001-archive-attr.sh',
+ 't5002-archive-attr-pattern.sh',
+ 't5003-archive-zip.sh',
+ 't5004-archive-corner-cases.sh',
+ 't5100-mailinfo.sh',
+ 't5150-request-pull.sh',
+ 't5200-update-server-info.sh',
+ 't5300-pack-object.sh',
+ 't5301-sliding-window.sh',
+ 't5302-pack-index.sh',
+ 't5303-pack-corruption-resilience.sh',
+ 't5304-prune.sh',
+ 't5305-include-tag.sh',
+ 't5306-pack-nobase.sh',
+ 't5307-pack-missing-commit.sh',
+ 't5308-pack-detect-duplicates.sh',
+ 't5309-pack-delta-cycles.sh',
+ 't5310-pack-bitmaps.sh',
+ 't5311-pack-bitmaps-shallow.sh',
+ 't5312-prune-corruption.sh',
+ 't5313-pack-bounds-checks.sh',
+ 't5314-pack-cycle-detection.sh',
+ 't5315-pack-objects-compression.sh',
+ 't5316-pack-delta-depth.sh',
+ 't5317-pack-objects-filter-objects.sh',
+ 't5318-commit-graph.sh',
+ 't5319-multi-pack-index.sh',
+ 't5320-delta-islands.sh',
+ 't5321-pack-large-objects.sh',
+ 't5322-pack-objects-sparse.sh',
+ 't5323-pack-redundant.sh',
+ 't5324-split-commit-graph.sh',
+ 't5325-reverse-index.sh',
+ 't5326-multi-pack-bitmaps.sh',
+ 't5327-multi-pack-bitmaps-rev.sh',
+ 't5328-commit-graph-64bit-time.sh',
+ 't5329-pack-objects-cruft.sh',
+ 't5330-no-lazy-fetch-with-commit-graph.sh',
+ 't5331-pack-objects-stdin.sh',
+ 't5332-multi-pack-reuse.sh',
+ 't5333-pseudo-merge-bitmaps.sh',
+ 't5334-incremental-multi-pack-index.sh',
+ 't5351-unpack-large-objects.sh',
+ 't5400-send-pack.sh',
+ 't5401-update-hooks.sh',
+ 't5402-post-merge-hook.sh',
+ 't5403-post-checkout-hook.sh',
+ 't5404-tracking-branches.sh',
+ 't5405-send-pack-rewind.sh',
+ 't5406-remote-rejects.sh',
+ 't5407-post-rewrite-hook.sh',
+ 't5408-send-pack-stdin.sh',
+ 't5409-colorize-remote-messages.sh',
+ 't5410-receive-pack-alternates.sh',
+ 't5411-proc-receive-hook.sh',
+ 't5500-fetch-pack.sh',
+ 't5501-fetch-push-alternates.sh',
+ 't5502-quickfetch.sh',
+ 't5503-tagfollow.sh',
+ 't5504-fetch-receive-strict.sh',
+ 't5505-remote.sh',
+ 't5506-remote-groups.sh',
+ 't5507-remote-environment.sh',
+ 't5509-fetch-push-namespaces.sh',
+ 't5510-fetch.sh',
+ 't5511-refspec.sh',
+ 't5512-ls-remote.sh',
+ 't5513-fetch-track.sh',
+ 't5514-fetch-multiple.sh',
+ 't5515-fetch-merge-logic.sh',
+ 't5516-fetch-push.sh',
+ 't5517-push-mirror.sh',
+ 't5518-fetch-exit-status.sh',
+ 't5519-push-alternates.sh',
+ 't5520-pull.sh',
+ 't5521-pull-options.sh',
+ 't5522-pull-symlink.sh',
+ 't5523-push-upstream.sh',
+ 't5524-pull-msg.sh',
+ 't5525-fetch-tagopt.sh',
+ 't5526-fetch-submodules.sh',
+ 't5527-fetch-odd-refs.sh',
+ 't5528-push-default.sh',
+ 't5529-push-errors.sh',
+ 't5530-upload-pack-error.sh',
+ 't5531-deep-submodule-push.sh',
+ 't5532-fetch-proxy.sh',
+ 't5533-push-cas.sh',
+ 't5534-push-signed.sh',
+ 't5535-fetch-push-symref.sh',
+ 't5536-fetch-conflicts.sh',
+ 't5537-fetch-shallow.sh',
+ 't5538-push-shallow.sh',
+ 't5539-fetch-http-shallow.sh',
+ 't5540-http-push-webdav.sh',
+ 't5541-http-push-smart.sh',
+ 't5542-push-http-shallow.sh',
+ 't5543-atomic-push.sh',
+ 't5544-pack-objects-hook.sh',
+ 't5545-push-options.sh',
+ 't5546-receive-limits.sh',
+ 't5547-push-quarantine.sh',
+ 't5548-push-porcelain.sh',
+ 't5549-fetch-push-http.sh',
+ 't5550-http-fetch-dumb.sh',
+ 't5551-http-fetch-smart.sh',
+ 't5552-skipping-fetch-negotiator.sh',
+ 't5553-set-upstream.sh',
+ 't5554-noop-fetch-negotiator.sh',
+ 't5555-http-smart-common.sh',
+ 't5557-http-get.sh',
+ 't5558-clone-bundle-uri.sh',
+ 't5559-http-fetch-smart-http2.sh',
+ 't5560-http-backend-noserver.sh',
+ 't5561-http-backend.sh',
+ 't5562-http-backend-content-length.sh',
+ 't5563-simple-http-auth.sh',
+ 't5564-http-proxy.sh',
+ 't5570-git-daemon.sh',
+ 't5571-pre-push-hook.sh',
+ 't5572-pull-submodule.sh',
+ 't5573-pull-verify-signatures.sh',
+ 't5574-fetch-output.sh',
+ 't5580-unc-paths.sh',
+ 't5581-http-curl-verbose.sh',
+ 't5582-fetch-negative-refspec.sh',
+ 't5583-push-branches.sh',
+ 't5600-clone-fail-cleanup.sh',
+ 't5601-clone.sh',
+ 't5602-clone-remote-exec.sh',
+ 't5603-clone-dirname.sh',
+ 't5604-clone-reference.sh',
+ 't5605-clone-local.sh',
+ 't5606-clone-options.sh',
+ 't5607-clone-bundle.sh',
+ 't5608-clone-2gb.sh',
+ 't5609-clone-branch.sh',
+ 't5610-clone-detached.sh',
+ 't5611-clone-config.sh',
+ 't5612-clone-refspec.sh',
+ 't5613-info-alternate.sh',
+ 't5614-clone-submodules-shallow.sh',
+ 't5615-alternate-env.sh',
+ 't5616-partial-clone.sh',
+ 't5617-clone-submodules-remote.sh',
+ 't5618-alternate-refs.sh',
+ 't5619-clone-local-ambiguous-transport.sh',
+ 't5700-protocol-v1.sh',
+ 't5701-git-serve.sh',
+ 't5702-protocol-v2.sh',
+ 't5703-upload-pack-ref-in-want.sh',
+ 't5704-protocol-violations.sh',
+ 't5705-session-id-in-capabilities.sh',
+ 't5730-protocol-v2-bundle-uri-file.sh',
+ 't5731-protocol-v2-bundle-uri-git.sh',
+ 't5732-protocol-v2-bundle-uri-http.sh',
+ 't5750-bundle-uri-parse.sh',
+ 't5801-remote-helpers.sh',
+ 't5802-connect-helper.sh',
+ 't5810-proto-disable-local.sh',
+ 't5811-proto-disable-git.sh',
+ 't5812-proto-disable-http.sh',
+ 't5813-proto-disable-ssh.sh',
+ 't5814-proto-disable-ext.sh',
+ 't5815-submodule-protos.sh',
+ 't5900-repo-selection.sh',
+ 't6000-rev-list-misc.sh',
+ 't6001-rev-list-graft.sh',
+ 't6002-rev-list-bisect.sh',
+ 't6003-rev-list-topo-order.sh',
+ 't6004-rev-list-path-optim.sh',
+ 't6005-rev-list-count.sh',
+ 't6006-rev-list-format.sh',
+ 't6007-rev-list-cherry-pick-file.sh',
+ 't6008-rev-list-submodule.sh',
+ 't6009-rev-list-parent.sh',
+ 't6010-merge-base.sh',
+ 't6011-rev-list-with-bad-commit.sh',
+ 't6012-rev-list-simplify.sh',
+ 't6013-rev-list-reverse-parents.sh',
+ 't6014-rev-list-all.sh',
+ 't6016-rev-list-graph-simplify-history.sh',
+ 't6017-rev-list-stdin.sh',
+ 't6018-rev-list-glob.sh',
+ 't6019-rev-list-ancestry-path.sh',
+ 't6020-bundle-misc.sh',
+ 't6021-rev-list-exclude-hidden.sh',
+ 't6022-rev-list-missing.sh',
+ 't6030-bisect-porcelain.sh',
+ 't6040-tracking-info.sh',
+ 't6041-bisect-submodule.sh',
+ 't6050-replace.sh',
+ 't6060-merge-index.sh',
+ 't6100-rev-list-in-order.sh',
+ 't6101-rev-parse-parents.sh',
+ 't6102-rev-list-unexpected-objects.sh',
+ 't6110-rev-list-sparse.sh',
+ 't6111-rev-list-treesame.sh',
+ 't6112-rev-list-filters-objects.sh',
+ 't6113-rev-list-bitmap-filters.sh',
+ 't6114-keep-packs.sh',
+ 't6115-rev-list-du.sh',
+ 't6120-describe.sh',
+ 't6130-pathspec-noglob.sh',
+ 't6131-pathspec-icase.sh',
+ 't6132-pathspec-exclude.sh',
+ 't6133-pathspec-rev-dwim.sh',
+ 't6134-pathspec-in-submodule.sh',
+ 't6135-pathspec-with-attrs.sh',
+ 't6136-pathspec-in-bare.sh',
+ 't6200-fmt-merge-msg.sh',
+ 't6300-for-each-ref.sh',
+ 't6301-for-each-ref-errors.sh',
+ 't6302-for-each-ref-filter.sh',
+ 't6400-merge-df.sh',
+ 't6401-merge-criss-cross.sh',
+ 't6402-merge-rename.sh',
+ 't6403-merge-file.sh',
+ 't6404-recursive-merge.sh',
+ 't6405-merge-symlinks.sh',
+ 't6406-merge-attr.sh',
+ 't6407-merge-binary.sh',
+ 't6408-merge-up-to-date.sh',
+ 't6409-merge-subtree.sh',
+ 't6411-merge-filemode.sh',
+ 't6412-merge-large-rename.sh',
+ 't6413-merge-crlf.sh',
+ 't6414-merge-rename-nocruft.sh',
+ 't6415-merge-dir-to-symlink.sh',
+ 't6416-recursive-corner-cases.sh',
+ 't6417-merge-ours-theirs.sh',
+ 't6418-merge-text-auto.sh',
+ 't6419-merge-ignorecase.sh',
+ 't6421-merge-partial-clone.sh',
+ 't6422-merge-rename-corner-cases.sh',
+ 't6423-merge-rename-directories.sh',
+ 't6424-merge-unrelated-index-changes.sh',
+ 't6425-merge-rename-delete.sh',
+ 't6426-merge-skip-unneeded-updates.sh',
+ 't6427-diff3-conflict-markers.sh',
+ 't6428-merge-conflicts-sparse.sh',
+ 't6429-merge-sequence-rename-caching.sh',
+ 't6430-merge-recursive.sh',
+ 't6431-merge-criscross.sh',
+ 't6432-merge-recursive-space-options.sh',
+ 't6433-merge-toplevel.sh',
+ 't6434-merge-recursive-rename-options.sh',
+ 't6435-merge-sparse.sh',
+ 't6436-merge-overwrite.sh',
+ 't6437-submodule-merge.sh',
+ 't6438-submodule-directory-file-conflicts.sh',
+ 't6439-merge-co-error-msgs.sh',
+ 't6500-gc.sh',
+ 't6501-freshen-objects.sh',
+ 't6600-test-reach.sh',
+ 't6700-tree-depth.sh',
+ 't7001-mv.sh',
+ 't7002-mv-sparse-checkout.sh',
+ 't7003-filter-branch.sh',
+ 't7004-tag.sh',
+ 't7005-editor.sh',
+ 't7006-pager.sh',
+ 't7007-show.sh',
+ 't7008-filter-branch-null-sha1.sh',
+ 't7010-setup.sh',
+ 't7011-skip-worktree-reading.sh',
+ 't7012-skip-worktree-writing.sh',
+ 't7030-verify-tag.sh',
+ 't7031-verify-tag-signed-ssh.sh',
+ 't7060-wtstatus.sh',
+ 't7061-wtstatus-ignore.sh',
+ 't7062-wtstatus-ignorecase.sh',
+ 't7063-status-untracked-cache.sh',
+ 't7064-wtstatus-pv2.sh',
+ 't7101-reset-empty-subdirs.sh',
+ 't7102-reset.sh',
+ 't7103-reset-bare.sh',
+ 't7104-reset-hard.sh',
+ 't7105-reset-patch.sh',
+ 't7106-reset-unborn-branch.sh',
+ 't7107-reset-pathspec-file.sh',
+ 't7110-reset-merge.sh',
+ 't7111-reset-table.sh',
+ 't7112-reset-submodule.sh',
+ 't7113-post-index-change-hook.sh',
+ 't7201-co.sh',
+ 't7300-clean.sh',
+ 't7301-clean-interactive.sh',
+ 't7400-submodule-basic.sh',
+ 't7401-submodule-summary.sh',
+ 't7402-submodule-rebase.sh',
+ 't7403-submodule-sync.sh',
+ 't7406-submodule-update.sh',
+ 't7407-submodule-foreach.sh',
+ 't7408-submodule-reference.sh',
+ 't7409-submodule-detached-work-tree.sh',
+ 't7411-submodule-config.sh',
+ 't7412-submodule-absorbgitdirs.sh',
+ 't7413-submodule-is-active.sh',
+ 't7414-submodule-mistakes.sh',
+ 't7416-submodule-dash-url.sh',
+ 't7417-submodule-path-url.sh',
+ 't7418-submodule-sparse-gitmodules.sh',
+ 't7419-submodule-set-branch.sh',
+ 't7420-submodule-set-url.sh',
+ 't7421-submodule-summary-add.sh',
+ 't7422-submodule-output.sh',
+ 't7423-submodule-symlinks.sh',
+ 't7424-submodule-mixed-ref-formats.sh',
+ 't7450-bad-git-dotfiles.sh',
+ 't7500-commit-template-squash-signoff.sh',
+ 't7501-commit-basic-functionality.sh',
+ 't7502-commit-porcelain.sh',
+ 't7503-pre-commit-and-pre-merge-commit-hooks.sh',
+ 't7504-commit-msg-hook.sh',
+ 't7505-prepare-commit-msg-hook.sh',
+ 't7506-status-submodule.sh',
+ 't7507-commit-verbose.sh',
+ 't7508-status.sh',
+ 't7509-commit-authorship.sh',
+ 't7510-signed-commit.sh',
+ 't7511-status-index.sh',
+ 't7512-status-help.sh',
+ 't7513-interpret-trailers.sh',
+ 't7514-commit-patch.sh',
+ 't7515-status-symlinks.sh',
+ 't7516-commit-races.sh',
+ 't7517-per-repo-email.sh',
+ 't7518-ident-corner-cases.sh',
+ 't7519-status-fsmonitor.sh',
+ 't7520-ignored-hook-warning.sh',
+ 't7521-ignored-mode.sh',
+ 't7524-commit-summary.sh',
+ 't7525-status-rename.sh',
+ 't7526-commit-pathspec-file.sh',
+ 't7527-builtin-fsmonitor.sh',
+ 't7528-signed-commit-ssh.sh',
+ 't7600-merge.sh',
+ 't7601-merge-pull-config.sh',
+ 't7602-merge-octopus-many.sh',
+ 't7603-merge-reduce-heads.sh',
+ 't7604-merge-custom-message.sh',
+ 't7605-merge-resolve.sh',
+ 't7606-merge-custom.sh',
+ 't7607-merge-state.sh',
+ 't7608-merge-messages.sh',
+ 't7609-mergetool--lib.sh',
+ 't7610-mergetool.sh',
+ 't7611-merge-abort.sh',
+ 't7612-merge-verify-signatures.sh',
+ 't7614-merge-signoff.sh',
+ 't7615-diff-algo-with-mergy-operations.sh',
+ 't7700-repack.sh',
+ 't7701-repack-unpack-unreachable.sh',
+ 't7702-repack-cyclic-alternate.sh',
+ 't7703-repack-geometric.sh',
+ 't7704-repack-cruft.sh',
+ 't7800-difftool.sh',
+ 't7810-grep.sh',
+ 't7811-grep-open.sh',
+ 't7812-grep-icase-non-ascii.sh',
+ 't7813-grep-icase-iso.sh',
+ 't7814-grep-recurse-submodules.sh',
+ 't7815-grep-binary.sh',
+ 't7816-grep-binary-pattern.sh',
+ 't7817-grep-sparse-checkout.sh',
+ 't7900-maintenance.sh',
+ 't8001-annotate.sh',
+ 't8002-blame.sh',
+ 't8003-blame-corner-cases.sh',
+ 't8004-blame-with-conflicts.sh',
+ 't8005-blame-i18n.sh',
+ 't8006-blame-textconv.sh',
+ 't8007-cat-file-textconv.sh',
+ 't8008-blame-formats.sh',
+ 't8009-blame-vs-topicbranches.sh',
+ 't8010-cat-file-filters.sh',
+ 't8011-blame-split-file.sh',
+ 't8012-blame-colors.sh',
+ 't8013-blame-ignore-revs.sh',
+ 't8014-blame-ignore-fuzzy.sh',
+ 't9001-send-email.sh',
+ 't9002-column.sh',
+ 't9003-help-autocorrect.sh',
+ 't9100-git-svn-basic.sh',
+ 't9101-git-svn-props.sh',
+ 't9102-git-svn-deep-rmdir.sh',
+ 't9103-git-svn-tracked-directory-removed.sh',
+ 't9104-git-svn-follow-parent.sh',
+ 't9105-git-svn-commit-diff.sh',
+ 't9106-git-svn-commit-diff-clobber.sh',
+ 't9107-git-svn-migrate.sh',
+ 't9108-git-svn-glob.sh',
+ 't9109-git-svn-multi-glob.sh',
+ 't9110-git-svn-use-svm-props.sh',
+ 't9111-git-svn-use-svnsync-props.sh',
+ 't9112-git-svn-md5less-file.sh',
+ 't9113-git-svn-dcommit-new-file.sh',
+ 't9114-git-svn-dcommit-merge.sh',
+ 't9115-git-svn-dcommit-funky-renames.sh',
+ 't9116-git-svn-log.sh',
+ 't9117-git-svn-init-clone.sh',
+ 't9118-git-svn-funky-branch-names.sh',
+ 't9119-git-svn-info.sh',
+ 't9120-git-svn-clone-with-percent-escapes.sh',
+ 't9121-git-svn-fetch-renamed-dir.sh',
+ 't9122-git-svn-author.sh',
+ 't9123-git-svn-rebuild-with-rewriteroot.sh',
+ 't9124-git-svn-dcommit-auto-props.sh',
+ 't9125-git-svn-multi-glob-branch-names.sh',
+ 't9126-git-svn-follow-deleted-readded-directory.sh',
+ 't9127-git-svn-partial-rebuild.sh',
+ 't9128-git-svn-cmd-branch.sh',
+ 't9129-git-svn-i18n-commitencoding.sh',
+ 't9130-git-svn-authors-file.sh',
+ 't9131-git-svn-empty-symlink.sh',
+ 't9132-git-svn-broken-symlink.sh',
+ 't9133-git-svn-nested-git-repo.sh',
+ 't9134-git-svn-ignore-paths.sh',
+ 't9135-git-svn-moved-branch-empty-file.sh',
+ 't9136-git-svn-recreated-branch-empty-file.sh',
+ 't9137-git-svn-dcommit-clobber-series.sh',
+ 't9138-git-svn-authors-prog.sh',
+ 't9139-git-svn-non-utf8-commitencoding.sh',
+ 't9140-git-svn-reset.sh',
+ 't9141-git-svn-multiple-branches.sh',
+ 't9142-git-svn-shallow-clone.sh',
+ 't9143-git-svn-gc.sh',
+ 't9144-git-svn-old-rev_map.sh',
+ 't9145-git-svn-master-branch.sh',
+ 't9146-git-svn-empty-dirs.sh',
+ 't9147-git-svn-include-paths.sh',
+ 't9148-git-svn-propset.sh',
+ 't9150-svk-mergetickets.sh',
+ 't9151-svn-mergeinfo.sh',
+ 't9152-svn-empty-dirs-after-gc.sh',
+ 't9153-git-svn-rewrite-uuid.sh',
+ 't9154-git-svn-fancy-glob.sh',
+ 't9155-git-svn-fetch-deleted-tag.sh',
+ 't9156-git-svn-fetch-deleted-tag-2.sh',
+ 't9157-git-svn-fetch-merge.sh',
+ 't9158-git-svn-mergeinfo.sh',
+ 't9159-git-svn-no-parent-mergeinfo.sh',
+ 't9160-git-svn-preserve-empty-dirs.sh',
+ 't9161-git-svn-mergeinfo-push.sh',
+ 't9162-git-svn-dcommit-interactive.sh',
+ 't9163-git-svn-reset-clears-caches.sh',
+ 't9164-git-svn-dcommit-concurrent.sh',
+ 't9165-git-svn-fetch-merge-branch-of-branch.sh',
+ 't9166-git-svn-fetch-merge-branch-of-branch2.sh',
+ 't9167-git-svn-cmd-branch-subproject.sh',
+ 't9168-git-svn-partially-globbed-names.sh',
+ 't9169-git-svn-dcommit-crlf.sh',
+ 't9200-git-cvsexportcommit.sh',
+ 't9210-scalar.sh',
+ 't9211-scalar-clone.sh',
+ 't9300-fast-import.sh',
+ 't9301-fast-import-notes.sh',
+ 't9302-fast-import-unpack-limit.sh',
+ 't9303-fast-import-compression.sh',
+ 't9304-fast-import-marks.sh',
+ 't9350-fast-export.sh',
+ 't9351-fast-export-anonymize.sh',
+ 't9400-git-cvsserver-server.sh',
+ 't9401-git-cvsserver-crlf.sh',
+ 't9402-git-cvsserver-refs.sh',
+ 't9500-gitweb-standalone-no-errors.sh',
+ 't9501-gitweb-standalone-http-status.sh',
+ 't9502-gitweb-standalone-parse-output.sh',
+ 't9600-cvsimport.sh',
+ 't9601-cvsimport-vendor-branch.sh',
+ 't9602-cvsimport-branches-tags.sh',
+ 't9603-cvsimport-patchsets.sh',
+ 't9604-cvsimport-timestamps.sh',
+ 't9700-perl-git.sh',
+ 't9800-git-p4-basic.sh',
+ 't9801-git-p4-branch.sh',
+ 't9802-git-p4-filetype.sh',
+ 't9803-git-p4-shell-metachars.sh',
+ 't9804-git-p4-label.sh',
+ 't9805-git-p4-skip-submit-edit.sh',
+ 't9806-git-p4-options.sh',
+ 't9807-git-p4-submit.sh',
+ 't9808-git-p4-chdir.sh',
+ 't9809-git-p4-client-view.sh',
+ 't9810-git-p4-rcs.sh',
+ 't9811-git-p4-label-import.sh',
+ 't9812-git-p4-wildcards.sh',
+ 't9813-git-p4-preserve-users.sh',
+ 't9814-git-p4-rename.sh',
+ 't9815-git-p4-submit-fail.sh',
+ 't9816-git-p4-locked.sh',
+ 't9817-git-p4-exclude.sh',
+ 't9818-git-p4-block.sh',
+ 't9819-git-p4-case-folding.sh',
+ 't9820-git-p4-editor-handling.sh',
+ 't9821-git-p4-path-variations.sh',
+ 't9822-git-p4-path-encoding.sh',
+ 't9823-git-p4-mock-lfs.sh',
+ 't9824-git-p4-git-lfs.sh',
+ 't9825-git-p4-handle-utf16-without-bom.sh',
+ 't9826-git-p4-keep-empty-commits.sh',
+ 't9827-git-p4-change-filetype.sh',
+ 't9828-git-p4-map-user.sh',
+ 't9829-git-p4-jobs.sh',
+ 't9830-git-p4-symlink-dir.sh',
+ 't9831-git-p4-triggers.sh',
+ 't9832-unshelve.sh',
+ 't9833-errors.sh',
+ 't9834-git-p4-file-dir-bug.sh',
+ 't9835-git-p4-metadata-encoding-python2.sh',
+ 't9836-git-p4-metadata-encoding-python3.sh',
+ 't9850-shell.sh',
+ 't9901-git-web--browse.sh',
+ 't9902-completion.sh',
+ 't9903-bash-prompt.sh',
+]
+
+# GIT_BUILD_DIR needs to be Unix-style without drive prefixes as it 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 it.
+git_build_dir = meson.project_build_root()
+if cygpath.found()
+ git_build_dir = run_command(cygpath, git_build_dir, check: true).stdout().strip()
+endif
+
+test_environment = script_environment
+test_environment.set('GIT_BUILD_DIR', git_build_dir)
+
+foreach integration_test : integration_tests
+ test(fs.stem(integration_test), shell,
+ args: [ integration_test ],
+ workdir: meson.current_source_dir(),
+ env: test_environment,
+ depends: test_dependencies + bin_wrappers,
+ timeout: 0,
+ )
+endforeach
diff --git a/templates/hooks/meson.build b/templates/hooks/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..ef85e10a16ccd6c5569b8fc25210d6481025f33f
--- /dev/null
+++ b/templates/hooks/meson.build
@@ -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
diff --git a/templates/info/meson.build b/templates/info/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..026f2313858c24e30a9bf115ee0f58144a593729
--- /dev/null
+++ b/templates/info/meson.build
@@ -0,0 +1,7 @@
+configure_file(
+ input: 'exclude',
+ output: 'exclude',
+ configuration: template_config,
+ install: true,
+ install_dir: get_option('datadir') / 'git-core/templates/info',
+)
diff --git a/templates/meson.build b/templates/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..1faf9a44ceaa5a6eee673e66c9d5448c08dbc7d5
--- /dev/null
+++ b/templates/meson.build
@@ -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')
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v11 25/26] meson: fix conflicts with in-flight topics
2024-12-06 13:24 ` [PATCH v11 00/26] Modernize the build system Patrick Steinhardt
` (23 preceding siblings ...)
2024-12-06 13:24 ` [PATCH v11 24/26] Introduce support for the Meson build system Patrick Steinhardt
@ 2024-12-06 13:25 ` Patrick Steinhardt
2024-12-08 3:00 ` Junio C Hamano
2024-12-06 13:25 ` [PATCH v11 26/26] Revert "meson: fix conflicts with in-flight topics" Patrick Steinhardt
25 siblings, 1 reply; 386+ messages in thread
From: Patrick Steinhardt @ 2024-12-06 13:25 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
As support for Meson is still in-flight we have to accommodate for
conflicts with topics in "seen". The following conflicts are being
addressed in this commit:
- ej/cat-file-remote-object-info adds t1017 and "fetch-object-info.c".
- ds/path-walk-1 adds t6601 as well as "path-walk.c" and
"test-path-walk.c".
- js/libgit-rust adds "common-exit.c" and "common-init.c".
- ds/name-hash-tweaks adds "t/helper/test-name-hash.c".
This is somewhat painful in the current state where Meson is not yet
part of the main tree, but we'll have to live with that for the time
being.
I've split this commit out into a separate fixup-style commit such that
it is possible to test this topic both with and without "seen" merged
into it. You can simply revert this commit to test without "seen".
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
meson.build | 4 ++++
t/helper/meson.build | 2 ++
t/meson.build | 2 ++
3 files changed, 8 insertions(+)
diff --git a/meson.build b/meson.build
index 0dccebcdf16b07650d943e53643f0e09e2975cc9..442d7bbabf407aee00cce280f40a4d5527f18d9c 100644
--- a/meson.build
+++ b/meson.build
@@ -235,6 +235,8 @@ libgit_sources = [
'commit-graph.c',
'commit-reach.c',
'commit.c',
+ 'common-exit.c',
+ 'common-init.c',
'compat/nonblock.c',
'compat/obstack.c',
'compat/terminal.c',
@@ -273,6 +275,7 @@ libgit_sources = [
'ewah/ewah_rlw.c',
'exec-cmd.c',
'fetch-negotiator.c',
+ 'fetch-object-info.c',
'fetch-pack.c',
'fmt-merge-msg.c',
'fsck.c',
@@ -347,6 +350,7 @@ libgit_sources = [
'parse-options.c',
'patch-delta.c',
'patch-ids.c',
+ 'path-walk.c',
'path.c',
'pathspec.c',
'pkt-line.c',
diff --git a/t/helper/meson.build b/t/helper/meson.build
index 5e83884246edc7841738de5085f3255aa1fa3fbe..1d6154ce9756db17bc9f69bc3cd71a32b93857c5 100644
--- a/t/helper/meson.build
+++ b/t/helper/meson.build
@@ -34,12 +34,14 @@ test_tool_sources = [
'test-match-trees.c',
'test-mergesort.c',
'test-mktemp.c',
+ 'test-name-hash.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-path-walk.c',
'test-pcre2-config.c',
'test-pkt-line.c',
'test-proc-receive.c',
diff --git a/t/meson.build b/t/meson.build
index 13fe854ba0a18f9b83dbc48651f581198042ffd3..1c82e27a1d48dd6a163d7b26c74b5ebf6f258d41 100644
--- a/t/meson.build
+++ b/t/meson.build
@@ -177,6 +177,7 @@ integration_tests = [
't1014-read-tree-confusing.sh',
't1015-read-index-unmerged.sh',
't1016-compatObjectFormat.sh',
+ 't1017-cat-file-remote-object-info.sh',
't1020-subdirectory.sh',
't1021-rerere-in-workdir.sh',
't1022-read-tree-partial-clone.sh',
@@ -829,6 +830,7 @@ integration_tests = [
't6500-gc.sh',
't6501-freshen-objects.sh',
't6600-test-reach.sh',
+ 't6601-path-walk.sh',
't6700-tree-depth.sh',
't7001-mv.sh',
't7002-mv-sparse-checkout.sh',
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* [PATCH v11 26/26] Revert "meson: fix conflicts with in-flight topics"
2024-12-06 13:24 ` [PATCH v11 00/26] Modernize the build system Patrick Steinhardt
` (24 preceding siblings ...)
2024-12-06 13:25 ` [PATCH v11 25/26] meson: fix conflicts with in-flight topics Patrick Steinhardt
@ 2024-12-06 13:25 ` Patrick Steinhardt
2024-12-06 16:10 ` Patrick Steinhardt
25 siblings, 1 reply; 386+ messages in thread
From: Patrick Steinhardt @ 2024-12-06 13:25 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
This reverts commit f5e9b17ebcc547ecfb14c542c06e30e95aa80b1a.
---
meson.build | 4 ----
t/helper/meson.build | 2 --
t/meson.build | 2 --
3 files changed, 8 deletions(-)
diff --git a/meson.build b/meson.build
index 442d7bbabf407aee00cce280f40a4d5527f18d9c..0dccebcdf16b07650d943e53643f0e09e2975cc9 100644
--- a/meson.build
+++ b/meson.build
@@ -235,8 +235,6 @@ libgit_sources = [
'commit-graph.c',
'commit-reach.c',
'commit.c',
- 'common-exit.c',
- 'common-init.c',
'compat/nonblock.c',
'compat/obstack.c',
'compat/terminal.c',
@@ -275,7 +273,6 @@ libgit_sources = [
'ewah/ewah_rlw.c',
'exec-cmd.c',
'fetch-negotiator.c',
- 'fetch-object-info.c',
'fetch-pack.c',
'fmt-merge-msg.c',
'fsck.c',
@@ -350,7 +347,6 @@ libgit_sources = [
'parse-options.c',
'patch-delta.c',
'patch-ids.c',
- 'path-walk.c',
'path.c',
'pathspec.c',
'pkt-line.c',
diff --git a/t/helper/meson.build b/t/helper/meson.build
index 1d6154ce9756db17bc9f69bc3cd71a32b93857c5..5e83884246edc7841738de5085f3255aa1fa3fbe 100644
--- a/t/helper/meson.build
+++ b/t/helper/meson.build
@@ -34,14 +34,12 @@ test_tool_sources = [
'test-match-trees.c',
'test-mergesort.c',
'test-mktemp.c',
- 'test-name-hash.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-path-walk.c',
'test-pcre2-config.c',
'test-pkt-line.c',
'test-proc-receive.c',
diff --git a/t/meson.build b/t/meson.build
index 1c82e27a1d48dd6a163d7b26c74b5ebf6f258d41..13fe854ba0a18f9b83dbc48651f581198042ffd3 100644
--- a/t/meson.build
+++ b/t/meson.build
@@ -177,7 +177,6 @@ integration_tests = [
't1014-read-tree-confusing.sh',
't1015-read-index-unmerged.sh',
't1016-compatObjectFormat.sh',
- 't1017-cat-file-remote-object-info.sh',
't1020-subdirectory.sh',
't1021-rerere-in-workdir.sh',
't1022-read-tree-partial-clone.sh',
@@ -830,7 +829,6 @@ integration_tests = [
't6500-gc.sh',
't6501-freshen-objects.sh',
't6600-test-reach.sh',
- 't6601-path-walk.sh',
't6700-tree-depth.sh',
't7001-mv.sh',
't7002-mv-sparse-checkout.sh',
--
2.47.0.366.g5daf58cba8.dirty
^ permalink raw reply related [flat|nested] 386+ messages in thread
* Re: [PATCH v11 26/26] Revert "meson: fix conflicts with in-flight topics"
2024-12-06 13:25 ` [PATCH v11 26/26] Revert "meson: fix conflicts with in-flight topics" Patrick Steinhardt
@ 2024-12-06 16:10 ` Patrick Steinhardt
0 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2024-12-06 16:10 UTC (permalink / raw)
To: git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
On Fri, Dec 06, 2024 at 02:25:01PM +0100, Patrick Steinhardt wrote:
> This reverts commit f5e9b17ebcc547ecfb14c542c06e30e95aa80b1a.
Oops, this last patch shouldn't have been sent out as part of this
series. It's what I have locally and push to CI systems so that they
pass on `master`. Please drop this last patch.
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [PATCH v11 25/26] meson: fix conflicts with in-flight topics
2024-12-06 13:25 ` [PATCH v11 25/26] meson: fix conflicts with in-flight topics Patrick Steinhardt
@ 2024-12-08 3:00 ` Junio C Hamano
2024-12-09 1:20 ` Junio C Hamano
2024-12-09 6:16 ` Patrick Steinhardt
0 siblings, 2 replies; 386+ messages in thread
From: Junio C Hamano @ 2024-12-08 3:00 UTC (permalink / raw)
To: Patrick Steinhardt
Cc: git, Eli Schwartz, Eric Sunshine, Phillip Wood, Ramsay Jones,
Taylor Blau, David Aguilar, Jeff King, Johannes Sixt,
Christian Couder
Patrick Steinhardt <ps@pks.im> writes:
> As support for Meson is still in-flight we have to accommodate for
> conflicts with topics in "seen". The following conflicts are being
> addressed in this commit:
>
> - ej/cat-file-remote-object-info adds t1017 and "fetch-object-info.c".
>
> - ds/path-walk-1 adds t6601 as well as "path-walk.c" and
> "test-path-walk.c".
>
> - js/libgit-rust adds "common-exit.c" and "common-init.c".
>
> - ds/name-hash-tweaks adds "t/helper/test-name-hash.c".
>
> This is somewhat painful in the current state where Meson is not yet
> part of the main tree, but we'll have to live with that for the time
> being.
>
> I've split this commit out into a separate fixup-style commit such that
> it is possible to test this topic both with and without "seen" merged
> into it. You can simply revert this commit to test without "seen".
Now I had to reconstruct these "fixup-style" commits and they appear
under ref/merge-fix/ hierarchy in my broken-out repository published
at https://github.com/gitster/git.git/ (and no other fallback URLs;
it might make sense to have another repository for redundancy, but
it is an unrelated tangent). In addition to these listed four, a
newly added ds/backfill also needs refs/merge-fix/ds/backfill to
adjust.
What I noticed while performing this exercise to place ps/build~1
(i.e. the series without this step) immediately on top of where the
history leading to 'seen' has a commit whose tree matches that of
'next' is that we need some "distributed" (read: put the burden on
topic authors, not on the onwer of ps/build topic, and not on the
maintainer) way to make sure various list of files in meson.build,
t/meson.build, and t/helper/meson.build are in sync with
corresponding list of files in the Makefile world. It _should_ be
automatable in theory, and to help those who develop against the
current practice of treating Makefile as the authoritative build
system, a Makefile target that tells them that they added a new file
to Makefile and removed a file from t/Makefile but they forgot to
make corresponding changes to meson.build and t/meson.build files
would be very beneficial. We could run that target as a part of
"make test".
Of course, those who care about keeping CMake build up to date can
add something similar hooked up to help others help themselves.
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [PATCH v11 25/26] meson: fix conflicts with in-flight topics
2024-12-08 3:00 ` Junio C Hamano
@ 2024-12-09 1:20 ` Junio C Hamano
2024-12-09 6:16 ` Patrick Steinhardt
1 sibling, 0 replies; 386+ messages in thread
From: Junio C Hamano @ 2024-12-09 1:20 UTC (permalink / raw)
To: Patrick Steinhardt
Cc: git, Eli Schwartz, Eric Sunshine, Phillip Wood, Ramsay Jones,
Taylor Blau, David Aguilar, Jeff King, Johannes Sixt,
Christian Couder
Junio C Hamano <gitster@pobox.com> writes:
> Patrick Steinhardt <ps@pks.im> writes:
>
>> I've split this commit out into a separate fixup-style commit such that
>> it is possible to test this topic both with and without "seen" merged
>> into it. You can simply revert this commit to test without "seen".
>
> Now I had to reconstruct these "fixup-style" commits and they appear
> under ref/merge-fix/ hierarchy in my broken-out repository published
> at https://github.com/gitster/git.git/ (and no other fallback URLs;
> it might make sense to have another repository for redundancy, but
> it is an unrelated tangent). In addition to these listed four, a
> newly added ds/backfill also needs refs/merge-fix/ds/backfill to
> adjust.
I now have merge-fix changes for the topics that add new sources and
test scripts that are not covered by [01-24/26] of this series, and
dropped [26/26] (the reversion of [25/26]). The [25/26], adjustment
for topics in flight in 'seen', is still at the tip of ps/build but
the merge of ps/build into 'seen' is now a no-op, which is a good
sign, as these merge-fix changes for each topic are designed to make
resulting merge of each of these topics successfully work with the
meson build infrastructure, and ps/build~1 [01-24/26] is merged a
lot earlier on the master..seen chain in preparation for merging
them to 'next'.
The next step for me is to see if we want v12 of the series, and if
not, merge [01-24/26] down to 'next'.
Thanks.
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [PATCH v11 25/26] meson: fix conflicts with in-flight topics
2024-12-08 3:00 ` Junio C Hamano
2024-12-09 1:20 ` Junio C Hamano
@ 2024-12-09 6:16 ` Patrick Steinhardt
2024-12-09 7:58 ` Junio C Hamano
1 sibling, 1 reply; 386+ messages in thread
From: Patrick Steinhardt @ 2024-12-09 6:16 UTC (permalink / raw)
To: Junio C Hamano
Cc: git, Eli Schwartz, Eric Sunshine, Phillip Wood, Ramsay Jones,
Taylor Blau, David Aguilar, Jeff King, Johannes Sixt,
Christian Couder
On Sun, Dec 08, 2024 at 12:00:46PM +0900, Junio C Hamano wrote:
> Patrick Steinhardt <ps@pks.im> writes:
>
> > As support for Meson is still in-flight we have to accommodate for
> > conflicts with topics in "seen". The following conflicts are being
> > addressed in this commit:
> >
> > - ej/cat-file-remote-object-info adds t1017 and "fetch-object-info.c".
> >
> > - ds/path-walk-1 adds t6601 as well as "path-walk.c" and
> > "test-path-walk.c".
> >
> > - js/libgit-rust adds "common-exit.c" and "common-init.c".
> >
> > - ds/name-hash-tweaks adds "t/helper/test-name-hash.c".
> >
> > This is somewhat painful in the current state where Meson is not yet
> > part of the main tree, but we'll have to live with that for the time
> > being.
> >
> > I've split this commit out into a separate fixup-style commit such that
> > it is possible to test this topic both with and without "seen" merged
> > into it. You can simply revert this commit to test without "seen".
>
> Now I had to reconstruct these "fixup-style" commits and they appear
> under ref/merge-fix/ hierarchy in my broken-out repository published
> at https://github.com/gitster/git.git/ (and no other fallback URLs;
> it might make sense to have another repository for redundancy, but
> it is an unrelated tangent). In addition to these listed four, a
> newly added ds/backfill also needs refs/merge-fix/ds/backfill to
> adjust.
Okay.
> What I noticed while performing this exercise to place ps/build~1
> (i.e. the series without this step) immediately on top of where the
> history leading to 'seen' has a commit whose tree matches that of
> 'next' is that we need some "distributed" (read: put the burden on
> topic authors, not on the onwer of ps/build topic, and not on the
> maintainer) way to make sure various list of files in meson.build,
> t/meson.build, and t/helper/meson.build are in sync with
> corresponding list of files in the Makefile world. It _should_ be
> automatable in theory, and to help those who develop against the
> current practice of treating Makefile as the authoritative build
> system, a Makefile target that tells them that they added a new file
> to Makefile and removed a file from t/Makefile but they forgot to
> make corresponding changes to meson.build and t/meson.build files
> would be very beneficial. We could run that target as a part of
> "make test".
>
> Of course, those who care about keeping CMake build up to date can
> add something similar hooked up to help others help themselves.
I have the following change queued up in a local patch series:
# Sanity check that we are not missing any tests present in 't/'. This check
# only runs once at configure time and is thus best-effort, only. It is
# sufficient to catch missing test suites in our CI though.
actual_tests = run_command(shell, '-c', 'ls t[0-9][0-9][0-9][0-9]-*.sh', check: true).stdout().strip().split('\n')
if integration_tests != actual_tests
missing_tests = [ ]
foreach actual_test : actual_tests
if actual_test not in integration_tests
missing_tests += actual_test
endif
endforeach
if missing_tests.length() > 0
error('Missing tests:\n\n - ' + '\n - '.join(missing_tests))
endif
superfluous_tests = [ ]
foreach integration_test : integration_tests
if integration_test not in actual_tests
superfluous_tests += integration_test
endif
endforeach
if superfluous_tests.length() > 0
error('Superfluous tests:\n\n - ' + '\n - '.join(superfluous_tests))
endif
endif
What it does is to verify that test suites wired up in Meson are
up-to-date, and if they aren't `meson setup` will fail and print all
missing or extraneous test suites. For code it's a bit harder to do as a
lot of it only compiles conditionally, so I don't have a solution for
that yet.
It also doesn't execute as part of `make test` -- if we want that I'd
have to implement it via a separate shell script instead. Which isn't
too bad, we'll simply have to agree on a direction. But the logic will
execute as part of CI so that any discrepancies will be flagged.
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [PATCH v11 25/26] meson: fix conflicts with in-flight topics
2024-12-09 6:16 ` Patrick Steinhardt
@ 2024-12-09 7:58 ` Junio C Hamano
2024-12-10 11:20 ` Patrick Steinhardt
0 siblings, 1 reply; 386+ messages in thread
From: Junio C Hamano @ 2024-12-09 7:58 UTC (permalink / raw)
To: Patrick Steinhardt
Cc: git, Eli Schwartz, Eric Sunshine, Phillip Wood, Ramsay Jones,
Taylor Blau, David Aguilar, Jeff King, Johannes Sixt,
Christian Couder
Patrick Steinhardt <ps@pks.im> writes:
> I have the following change queued up in a local patch series:
> ...
> What it does is to verify that test suites wired up in Meson are
> up-to-date, and if they aren't `meson setup` will fail and print all
> missing or extraneous test suites. For code it's a bit harder to do as a
> lot of it only compiles conditionally, so I don't have a solution for
> that yet.
It would certaionly help those who build work "meson" to remind
themselves that they need to make matching changes to Makefile world
when they update their meson.build files.
> It also doesn't execute as part of `make test` -- if we want that I'd
> have to implement it via a separate shell script instead. Which isn't
> too bad, we'll simply have to agree on a direction. But the logic will
> execute as part of CI so that any discrepancies will be flagged.
And catching a breakage as part of CI is a good first step
nevertheless.
Having said all that, with a longer term evolution of the build
systems in mind:
- Currently, anybody who is working on our codebase is expected to
make "make all doc test" succeed before even running format-patch
and/or send-email. But unless you are testing with ps/build
topic, you won't be checking "meson test". The same is likely be
true for CMake (I am not encouraging folks to send a change that
is OK only for "make" and deliberatly breaks "meson" and "cmake";
but for those who are used to build with "make", having to _also_
check with "meson" and "cmake" is additional barriers.
- The ideal world, at least from the point of view of those
advocate ps/build topic, should be that "meson" is treated at
least as another build system with equal footing as "make". With
even longer timeframe, the effort may even aim to supersede and
deprecate "make", but before that happens, it has to at least
become build system with equal importance.
- In the longer timeframe where many more folks work with "meson"
than "make", check implemented on the "meson" side to make sure
that "make" world will not left rotting would be helpful before
we finally kill off "make" support (if that is what we are aiming
for). But until then, I think the pay off would be larger if we
helped "make" population to avoid leaving "meson" and "cmake"
builds out of sync when they update Makefile.
And that is why I suggested "make test" as that is currently what is
run by everybody. It is like &&-check that helps individual developers
with their test before even submitting their changes.
I am unlikely to run the check locally before pushing them out,
simply because meson build is not yet part of my everyday workflow,
but even after I made it part of my workflow to check, in a sense,
it it too late. Once we adopt ps/build~1 as a part of our official
world, if a developer, who builds on top of the 'master' in the not
so distant future, does not pay attention when they touch Makefile
without making matching changes to meson.build files, I'd want to be
able to scold them for not running "make test"; otherwise the
process will not scale.
I also had to wonder if we can share the common list of files and
have both make and meson worlds include them from the same source,
but if the eventual goal is to migrate into a single system, it is
not all that great an idea. After giving up on one of the systems,
we would not want to keep a system where we keep a list of source
files in a separate file (possibly in a separate syntax), which is
not how either world would normally work.
Thanks.
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [PATCH v11 25/26] meson: fix conflicts with in-flight topics
2024-12-09 7:58 ` Junio C Hamano
@ 2024-12-10 11:20 ` Patrick Steinhardt
2024-12-10 12:03 ` Junio C Hamano
0 siblings, 1 reply; 386+ messages in thread
From: Patrick Steinhardt @ 2024-12-10 11:20 UTC (permalink / raw)
To: Junio C Hamano
Cc: git, Eli Schwartz, Eric Sunshine, Phillip Wood, Ramsay Jones,
Taylor Blau, David Aguilar, Jeff King, Johannes Sixt,
Christian Couder
On Mon, Dec 09, 2024 at 04:58:59PM +0900, Junio C Hamano wrote:
> Patrick Steinhardt <ps@pks.im> writes:
>
> > I have the following change queued up in a local patch series:
> > ...
> > What it does is to verify that test suites wired up in Meson are
> > up-to-date, and if they aren't `meson setup` will fail and print all
> > missing or extraneous test suites. For code it's a bit harder to do as a
> > lot of it only compiles conditionally, so I don't have a solution for
> > that yet.
>
> It would certaionly help those who build work "meson" to remind
> themselves that they need to make matching changes to Makefile world
> when they update their meson.build files.
>
> > It also doesn't execute as part of `make test` -- if we want that I'd
> > have to implement it via a separate shell script instead. Which isn't
> > too bad, we'll simply have to agree on a direction. But the logic will
> > execute as part of CI so that any discrepancies will be flagged.
>
> And catching a breakage as part of CI is a good first step
> nevertheless.
>
> Having said all that, with a longer term evolution of the build
> systems in mind:
>
> - Currently, anybody who is working on our codebase is expected to
> make "make all doc test" succeed before even running format-patch
> and/or send-email. But unless you are testing with ps/build
> topic, you won't be checking "meson test". The same is likely be
> true for CMake (I am not encouraging folks to send a change that
> is OK only for "make" and deliberatly breaks "meson" and "cmake";
> but for those who are used to build with "make", having to _also_
> check with "meson" and "cmake" is additional barriers.
Fair.
> - The ideal world, at least from the point of view of those
> advocate ps/build topic, should be that "meson" is treated at
> least as another build system with equal footing as "make". With
> even longer timeframe, the effort may even aim to supersede and
> deprecate "make", but before that happens, it has to at least
> become build system with equal importance.
Agreed, feature parity is a necessary requirement and I'll of course
continue to iterate on it once Meson has landed. We might get away with
removing the autoconf framework without feature parity as users can
still use "make" without it, and because it's seldomly used and broken.
But replacing "make", if it happens at all, is a much larger undertaking
that will require many releases.
I'll also align with Dscho to figure out what to do with CMake.
> - In the longer timeframe where many more folks work with "meson"
> than "make", check implemented on the "meson" side to make sure
> that "make" world will not left rotting would be helpful before
> we finally kill off "make" support (if that is what we are aiming
> for). But until then, I think the pay off would be larger if we
> helped "make" population to avoid leaving "meson" and "cmake"
> builds out of sync when they update Makefile.
>
> And that is why I suggested "make test" as that is currently what is
> run by everybody. It is like &&-check that helps individual developers
> with their test before even submitting their changes.
>
> I am unlikely to run the check locally before pushing them out,
> simply because meson build is not yet part of my everyday workflow,
> but even after I made it part of my workflow to check, in a sense,
> it it too late. Once we adopt ps/build~1 as a part of our official
> world, if a developer, who builds on top of the 'master' in the not
> so distant future, does not pay attention when they touch Makefile
> without making matching changes to meson.build files, I'd want to be
> able to scold them for not running "make test"; otherwise the
> process will not scale.
Fair.
> I also had to wonder if we can share the common list of files and
> have both make and meson worlds include them from the same source,
> but if the eventual goal is to migrate into a single system, it is
> not all that great an idea. After giving up on one of the systems,
> we would not want to keep a system where we keep a list of source
> files in a separate file (possibly in a separate syntax), which is
> not how either world would normally work.
That would be great indeed, but it's somewhat incompatible with how
higher-level build systems work. We do it in CMake by parsing our
Makefile and extracting source files, but the problem is that this only
happens at configuration time. So the set of source files would not be
updated properly when your Makefile changes. An alternative would be to
use globbing, but that is not recommended, either. Quoting CMake docs:
We do not recommend using GLOB to collect a list of source files
from your source tree. If no CMakeLists.txt file changes when a
source is added or removed then the generated build system cannot
know when to ask CMake to regenerate. The CONFIGURE_DEPENDS flag may
not work reliably on all generators, or if a new generator is added
in the future that cannot support it, projects using it will be
stuck. Even if CONFIGURE_DEPENDS works reliably, there is still a
cost to perform the check on every rebuild.
The same is true for Meson:
Meson does not support this syntax and the reason for this is
simple. This cannot be made both reliable and fast. By reliable we
mean that if the user adds a new source file to the subdirectory,
Meson should detect that and make it part of the build
automatically.
One of the main requirements of Meson is that it must be fast. This
means that a no-op build in a tree of 10 000 source files must take
no more than a fraction of a second. This is only possible because
Meson knows the exact list of files to check. If any target is
specified as a wildcard glob, this is no longer possible. Meson
would need to re-evaluate the glob every time and compare the list
of files produced against the previous list. This means inspecting
the entire source tree (because the glob pattern could be
src/\*/\*/\*/\*.cpp or something like that). This is impossible to
do efficiently.
We could of course eventually reverse the logic and have Makefiles parse
files from Meson. But as mentioned already, the biggest issue is that we
have lots of source files that get compiled conditionally, and properly
parsing these would be non-trivial.
I guess we'll see over time how much of a problem it is to keep build
systems in sync. Proper tooling is a first step to make things a bit
less tedious, but if this still proves to be too painful I'll have a
look for how to further automate things.
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [PATCH v11 25/26] meson: fix conflicts with in-flight topics
2024-12-10 11:20 ` Patrick Steinhardt
@ 2024-12-10 12:03 ` Junio C Hamano
0 siblings, 0 replies; 386+ messages in thread
From: Junio C Hamano @ 2024-12-10 12:03 UTC (permalink / raw)
To: Patrick Steinhardt
Cc: git, Eli Schwartz, Eric Sunshine, Phillip Wood, Ramsay Jones,
Taylor Blau, David Aguilar, Jeff King, Johannes Sixt,
Christian Couder
Patrick Steinhardt <ps@pks.im> writes:
>> I also had to wonder if we can share the common list of files and
>> have both make and meson worlds include them from the same source,
>> but if the eventual goal is to migrate into a single system, it is
>> not all that great an idea. After giving up on one of the systems,
>> we would not want to keep a system where we keep a list of source
>> files in a separate file (possibly in a separate syntax), which is
>> not how either world would normally work.
>
> That would be great indeed,
Well, what I wanted to say is that it is not a good idea, especially
if our eventual goal were to ditch either one of these systems, so
we are on the same page.
After ps/build~1 graduates to 'master', it may be sufficient to add
a Makefile target that runs the check script you sent earlier to
this thread as a part of "make test". That way, those developers
who work primarily with "make" can minimally install "meson" and do
nothing else and we make sure that their changes in the "make" world
would not make "meson" (and possibly "cmake") world stale.
Those who do not have "meson" may skip the check during their "make
test" without any negative (perhaps other than a message to nag them
to install "meson") consequences, or even a hard failure may be
acceptable, if the necessary adjustment is trivial (like "I added a
command in builtin/ and listed it in Makefile---add it to this list
in meson.build file"). After all, we are talking about developers
who are willing to run "make test", so requiring them to have a
build system if they want to develop for this project may not be too
bad. I dunno.
> I guess we'll see over time how much of a problem it is to keep build
> systems in sync. Proper tooling is a first step to make things a bit
> less tedious, but if this still proves to be too painful I'll have a
> look for how to further automate things.
With very small set of topics between 'next' and 'seen', we know
that we already needed 4 or 5 merge-fix changes. The authors of
these topics would have wanted all the help making sure their
updates are good in both "make" and "meson" world, if they started
their topic in a not-so-distant future where ps/build~1 has
graduated to 'master'.
Thanks.
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [PATCH v9 06/23] Makefile: generate doc versions via GIT-VERSION-GEN
2024-11-25 9:56 ` [PATCH v9 06/23] Makefile: generate doc versions " Patrick Steinhardt
@ 2025-01-13 20:17 ` Renato Botelho
2025-01-17 9:04 ` Patrick Steinhardt
0 siblings, 1 reply; 386+ messages in thread
From: Renato Botelho @ 2025-01-13 20:17 UTC (permalink / raw)
To: Patrick Steinhardt, git
Cc: Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
On 25/11/24 06:56, Patrick Steinhardt wrote:
> The documentation we generate embeds information for the exact Git
> version used as well as the date of the commit. This information is
> injected by injecting attributes into the build process via command line
> argument.
>
> Refactor the logic so that we write the information into "asciidoc.conf"
> and "asciidoctor-extensions.rb" via `GIT-VERSION-GEN` for AsciiDoc and
> AsciiDoctor, respectively.
>
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
> Documentation/.gitignore | 2 ++
> Documentation/Makefile | 21 ++++++++++++++-------
> Documentation/{asciidoc.conf => asciidoc.conf.in} | 3 +++
> ...r-extensions.rb => asciidoctor-extensions.rb.in} | 8 ++------
> GIT-VERSION-GEN | 2 ++
> 5 files changed, 23 insertions(+), 13 deletions(-)
>
> diff --git a/Documentation/.gitignore b/Documentation/.gitignore
> index a48448de32f98b1a054b36e886ea920bccebc494..649df89474d357ccc91109b5c35fe2d0910f968a 100644
> --- a/Documentation/.gitignore
> +++ b/Documentation/.gitignore
> @@ -15,3 +15,5 @@ tmp-doc-diff/
> GIT-ASCIIDOCFLAGS
> /.build/
> /GIT-EXCLUDED-PROGRAMS
> +/asciidoc.conf
> +/asciidoctor-extensions.rb
> diff --git a/Documentation/Makefile b/Documentation/Makefile
> index 0f55baa252fffbcd506f0c6f410b26b37f2e9b11..495c61c85ed18bc9c4643f9e5478e5146bb5f196 100644
> --- a/Documentation/Makefile
> +++ b/Documentation/Makefile
> @@ -1,6 +1,8 @@
> # Import tree-wide shared Makefile behavior and libraries
> include ../shared.mak
>
> +.PHONY: FORCE
> +
> # Guard against environment variables
> MAN1_TXT =
> MAN5_TXT =
> @@ -148,16 +150,12 @@ man5dir = $(mandir)/man5
> man7dir = $(mandir)/man7
> # DESTDIR =
>
> -GIT_DATE := $(shell git show --quiet --pretty='%as')
> -
> ASCIIDOC = asciidoc
> ASCIIDOC_EXTRA =
> ASCIIDOC_HTML = xhtml11
> ASCIIDOC_DOCBOOK = docbook
> ASCIIDOC_CONF = -f asciidoc.conf
> -ASCIIDOC_COMMON = $(ASCIIDOC) $(ASCIIDOC_EXTRA) $(ASCIIDOC_CONF) \
> - -amanmanual='Git Manual' -amansource='Git $(GIT_VERSION)' \
> - -arevdate='$(GIT_DATE)'
> +ASCIIDOC_COMMON = $(ASCIIDOC) $(ASCIIDOC_EXTRA) $(ASCIIDOC_CONF)
> ASCIIDOC_DEPS = asciidoc.conf GIT-ASCIIDOCFLAGS
> TXT_TO_HTML = $(ASCIIDOC_COMMON) -b $(ASCIIDOC_HTML)
> TXT_TO_XML = $(ASCIIDOC_COMMON) -b $(ASCIIDOC_DOCBOOK)
> @@ -210,6 +208,14 @@ ASCIIDOC_DEPS = asciidoctor-extensions.rb GIT-ASCIIDOCFLAGS
> DBLATEX_COMMON =
> XMLTO_EXTRA += --skip-validation
> XMLTO_EXTRA += -x manpage.xsl
> +
> +asciidoctor-extensions.rb: asciidoctor-extensions.rb.in FORCE
> + $(QUIET_GEN)GIT_USER_AGENT="$(GIT_USER_AGENT)" $(SHELL_PATH) ../GIT-VERSION-GEN "$(shell pwd)/.." $< $@+
> + @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
> +else
> +asciidoc.conf: asciidoc.conf.in FORCE
> + $(QUIET_GEN)GIT_USER_AGENT="$(GIT_USER_AGENT)" $(SHELL_PATH) ../GIT-VERSION-GEN "$(shell pwd)/.." $< $@+
> + @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
> endif
Hi Patrick!
contrib/subtree/Makefile rely on asciidoc.conf or
asciidoctor-extensions.rb to build, it would be nice if it could trigger
the build of the appropriate file during its build.
--
Renato Botelho
^ permalink raw reply [flat|nested] 386+ messages in thread
* Re: [PATCH v9 06/23] Makefile: generate doc versions via GIT-VERSION-GEN
2025-01-13 20:17 ` Renato Botelho
@ 2025-01-17 9:04 ` Patrick Steinhardt
0 siblings, 0 replies; 386+ messages in thread
From: Patrick Steinhardt @ 2025-01-17 9:04 UTC (permalink / raw)
To: Renato Botelho
Cc: git, Eli Schwartz, Eric Sunshine, Phillip Wood, Junio C Hamano,
Ramsay Jones, Taylor Blau, David Aguilar, Jeff King,
Johannes Sixt, Christian Couder
On Mon, Jan 13, 2025 at 05:17:50PM -0300, Renato Botelho wrote:
> contrib/subtree/Makefile rely on asciidoc.conf or asciidoctor-extensions.rb
> to build, it would be nice if it could trigger the build of the appropriate
> file during its build.
True indeed, thanks for the report! I've got a patch series cooking that
fixes it and also wires it up via Meson.
Patrick
^ permalink raw reply [flat|nested] 386+ messages in thread
end of thread, other threads:[~2025-01-17 9:05 UTC | newest]
Thread overview: 386+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-02 15:15 [RFC PATCH 00/21] Modernize the build system Patrick Steinhardt
2024-10-02 15:15 ` [RFC PATCH 01/21] Documentation: add comparison of build systems Patrick Steinhardt
2024-10-02 18:14 ` Junio C Hamano
2024-10-06 20:14 ` Eli Schwartz
2024-10-07 10:18 ` Patrick Steinhardt
2024-10-07 21:08 ` Junio C Hamano
2024-10-02 20:24 ` Eric Sunshine
2024-10-07 10:17 ` Patrick Steinhardt
2024-10-02 15:15 ` [RFC PATCH 02/21] t/test-lib: fix quoting of TEST_RESULTS_SAN_FILE Patrick Steinhardt
2024-10-02 15:15 ` [RFC PATCH 03/21] t/lib-gitweb: test against the build version of gitweb Patrick Steinhardt
2024-10-02 15:15 ` [RFC PATCH 04/21] t/lib-gpg: fix setup of GNUPGHOME in MinGW Patrick Steinhardt
2024-10-02 21:49 ` Eric Sunshine
2024-10-07 10:18 ` Patrick Steinhardt
2024-10-02 15:15 ` [RFC PATCH 05/21] t3404: work around platform-specific behaviour on macOS 10.15 Patrick Steinhardt
2024-10-02 21:43 ` Eric Sunshine
2024-10-03 15:15 ` Phillip Wood
2024-10-03 22:22 ` Eric Sunshine
2024-10-03 23:19 ` Junio C Hamano
2024-10-07 10:18 ` Patrick Steinhardt
2024-10-07 10:18 ` Patrick Steinhardt
2024-10-07 10:18 ` Patrick Steinhardt
2024-10-02 15:15 ` [RFC PATCH 06/21] t/unit-tests: update clar unit test framework Patrick Steinhardt
2024-10-02 15:15 ` [RFC PATCH 07/21] t/clar: simplify how the clar derives `struct stat` Patrick Steinhardt
2024-10-02 15:16 ` [RFC PATCH 08/21] builtin/credential-cache: fix missing parameter for stub function Patrick Steinhardt
2024-10-02 15:16 ` [RFC PATCH 09/21] http: fix build error on FreeBSD Patrick Steinhardt
2024-10-02 15:16 ` [RFC PATCH 10/21] Makefile: extract script to generate clar declarations Patrick Steinhardt
2024-10-02 15:16 ` [RFC PATCH 11/21] Makefile: extract script to massage Perl scripts Patrick Steinhardt
2024-10-02 15:16 ` [RFC PATCH 12/21] Makefile: refactor GIT-VERSION-GEN to be reusable Patrick Steinhardt
2024-10-02 15:16 ` [RFC PATCH 13/21] Makefile: refactor generators to be PWD-independent Patrick Steinhardt
2024-10-02 15:16 ` [RFC PATCH 14/21] Makefile: use common template for GIT-BUILD-OPTIONS Patrick Steinhardt
2024-10-02 15:16 ` [RFC PATCH 15/21] Makefile: consistently use @PLACEHOLDER@ to substitute Patrick Steinhardt
2024-10-08 14:04 ` Phillip Wood
2024-10-08 14:23 ` Patrick Steinhardt
2024-10-02 15:16 ` [RFC PATCH 16/21] Makefile: consistently use PERL_PATH Patrick Steinhardt
2024-10-02 15:16 ` [RFC PATCH 17/21] Makefile: allow "bin-wrappers/" directory to exist Patrick Steinhardt
2024-10-02 15:16 ` [RFC PATCH 18/21] Makefile: simplify building of templates Patrick Steinhardt
2024-10-02 15:16 ` [RFC PATCH 19/21] t: better support for out-of-tree builds Patrick Steinhardt
2024-10-02 15:16 ` [RFC PATCH 20/21] t: allow overriding build dir Patrick Steinhardt
2024-10-08 14:04 ` Phillip Wood
2024-10-08 14:23 ` Patrick Steinhardt
2024-10-02 15:16 ` [RFC PATCH 21/21] Introduce support for the Meson build system Patrick Steinhardt
2024-10-08 14:11 ` [RFC PATCH 00/21] Modernize the " Phillip Wood
2024-10-08 14:23 ` Patrick Steinhardt
2024-10-09 14:56 ` [RFC PATCH v2 00/24] Modernize our " Patrick Steinhardt
2024-10-09 14:56 ` [RFC PATCH v2 01/24] t/test-lib: fix quoting of TEST_RESULTS_SAN_FILE Patrick Steinhardt
2024-10-09 14:56 ` [RFC PATCH v2 02/24] t/test-lib: wire up NO_ICONV prerequisite Patrick Steinhardt
2024-10-09 14:56 ` [RFC PATCH v2 03/24] t/lib-gitweb: test against the build version of gitweb Patrick Steinhardt
2024-10-09 14:56 ` [RFC PATCH v2 04/24] t/lib-gpg: fix setup of GNUPGHOME in MinGW Patrick Steinhardt
2024-10-09 14:56 ` [RFC PATCH v2 05/24] t1401: make invocation of tar(1) work with Win32-provided one Patrick Steinhardt
2024-10-09 14:56 ` [RFC PATCH v2 06/24] t3404: work around platform-specific behaviour on macOS 10.15 Patrick Steinhardt
2024-10-09 14:56 ` [RFC PATCH v2 07/24] t5500, t5601: skip tests which exercise paths with '[::1]' on Cygwin Patrick Steinhardt
2024-10-09 14:56 ` [RFC PATCH v2 08/24] t7300: work around platform-specific behaviour with long paths on MinGW Patrick Steinhardt
2024-10-09 14:56 ` [RFC PATCH v2 09/24] t/unit-tests: update clar unit test framework Patrick Steinhardt
2024-10-09 14:56 ` [RFC PATCH v2 10/24] builtin/credential-cache: fix missing parameter for stub function Patrick Steinhardt
2024-10-09 14:56 ` [RFC PATCH v2 11/24] http: fix build error on FreeBSD Patrick Steinhardt
2024-10-09 14:56 ` [RFC PATCH v2 12/24] Makefile: extract script to generate clar declarations Patrick Steinhardt
2024-10-09 14:56 ` [RFC PATCH v2 13/24] Makefile: extract script to massage Perl scripts Patrick Steinhardt
2024-10-09 14:56 ` [RFC PATCH v2 14/24] Makefile: refactor GIT-VERSION-GEN to be reusable Patrick Steinhardt
2024-10-09 14:56 ` [RFC PATCH v2 15/24] Makefile: refactor generators to be PWD-independent Patrick Steinhardt
2024-10-09 14:56 ` [RFC PATCH v2 16/24] Makefile: use common template for GIT-BUILD-OPTIONS Patrick Steinhardt
2024-10-09 14:56 ` [RFC PATCH v2 17/24] Makefile: consistently use @PLACEHOLDER@ to substitute Patrick Steinhardt
2024-10-09 14:56 ` [RFC PATCH v2 18/24] Makefile: consistently use PERL_PATH Patrick Steinhardt
2024-10-09 14:57 ` [RFC PATCH v2 19/24] Makefile: allow "bin-wrappers/" directory to exist Patrick Steinhardt
2024-10-09 14:57 ` [RFC PATCH v2 20/24] Makefile: simplify building of templates Patrick Steinhardt
2024-10-09 14:57 ` [RFC PATCH v2 21/24] t: better support for out-of-tree builds Patrick Steinhardt
2024-10-09 14:57 ` [RFC PATCH v2 22/24] t: allow overriding build dir Patrick Steinhardt
2024-10-09 14:57 ` [RFC PATCH v2 23/24] Documentation: add comparison of build systems Patrick Steinhardt
2024-10-14 15:23 ` Phillip Wood
2024-10-15 12:12 ` Patrick Steinhardt
2024-10-16 13:36 ` phillip.wood123
2024-10-17 9:36 ` Patrick Steinhardt
2024-10-17 10:58 ` Patrick Steinhardt
2024-10-09 14:57 ` [RFC PATCH v2 24/24] Introduce support for the Meson build system Patrick Steinhardt
2024-10-14 2:07 ` Eli Schwartz
2024-10-14 5:20 ` Patrick Steinhardt
2024-10-10 5:26 ` [RFC PATCH v2 00/24] Modernize our " Junio C Hamano
2024-10-10 5:28 ` Patrick Steinhardt
2024-10-10 5:49 ` Patrick Steinhardt
2024-10-12 2:04 ` Junio C Hamano
2024-10-12 15:58 ` Taylor Blau
2024-10-18 12:23 ` [RFC PATCH v3 00/15] Modernize the " Patrick Steinhardt
2024-10-18 12:23 ` [RFC PATCH v3 01/15] Makefile: use common template for GIT-BUILD-OPTIONS Patrick Steinhardt
2024-10-19 5:00 ` Eric Sunshine
2024-10-23 12:04 ` Patrick Steinhardt
2024-10-18 12:23 ` [RFC PATCH v3 02/15] Makefile: consistently use @PLACEHOLDER@ to substitute Patrick Steinhardt
2024-10-18 12:23 ` [RFC PATCH v3 03/15] Makefile: consistently use PERL_PATH Patrick Steinhardt
2024-10-18 12:23 ` [RFC PATCH v3 04/15] Makefile: extract script to massage Perl scripts Patrick Steinhardt
2024-10-18 12:24 ` [RFC PATCH v3 05/15] Makefile: use "generate-perl.sh" to massage Perl library Patrick Steinhardt
2024-10-18 12:24 ` [RFC PATCH v3 06/15] Makefile: extract script to massage Shell scripts Patrick Steinhardt
2024-10-18 12:24 ` [RFC PATCH v3 07/15] Makefile: extract script to generate gitweb.cgi Patrick Steinhardt
2024-10-18 12:24 ` [RFC PATCH v3 08/15] Makefile: refactor GIT-VERSION-GEN to be reusable Patrick Steinhardt
2024-10-18 12:24 ` [RFC PATCH v3 09/15] Makefile: refactor generators to be PWD-independent Patrick Steinhardt
2024-10-19 5:06 ` Eric Sunshine
2024-10-18 12:24 ` [RFC PATCH v3 10/15] Makefile: allow "bin-wrappers/" directory to exist Patrick Steinhardt
2024-10-18 12:24 ` [RFC PATCH v3 11/15] Makefile: simplify building of templates Patrick Steinhardt
2024-10-19 5:09 ` Eric Sunshine
2024-10-18 12:24 ` [RFC PATCH v3 12/15] t: better support for out-of-tree builds Patrick Steinhardt
2024-10-18 12:24 ` [RFC PATCH v3 13/15] t: allow overriding build dir Patrick Steinhardt
2024-10-19 5:11 ` Eric Sunshine
2024-10-18 12:24 ` [RFC PATCH v3 14/15] Documentation: add comparison of build systems Patrick Steinhardt
2024-10-18 12:24 ` [RFC PATCH v3 15/15] Introduce support for the Meson build system Patrick Steinhardt
2024-10-19 5:21 ` Eric Sunshine
2024-10-18 16:08 ` [RFC PATCH v3 00/15] Modernize the " Ramsay Jones
2024-10-20 8:51 ` Eli Schwartz
2024-10-21 22:56 ` Ramsay Jones
2024-10-23 12:04 ` Patrick Steinhardt
2024-10-23 14:38 ` Ramsay Jones
2024-10-23 15:58 ` Eli Schwartz
2024-10-24 1:43 ` Ramsay Jones
2024-10-24 7:19 ` Patrick Steinhardt
2024-10-24 7:19 ` Patrick Steinhardt
2024-10-24 17:34 ` Ramsay Jones
2024-10-25 5:20 ` Patrick Steinhardt
2024-10-25 16:36 ` Ramsay Jones
2024-11-04 12:16 ` Patrick Steinhardt
2024-10-23 12:04 ` Patrick Steinhardt
2024-10-18 21:09 ` Taylor Blau
2024-10-23 12:04 ` Patrick Steinhardt
2024-10-23 20:15 ` Taylor Blau
2024-10-24 7:20 ` Patrick Steinhardt
2024-10-21 22:10 ` Taylor Blau
2024-10-23 12:04 ` Patrick Steinhardt
2024-10-23 20:12 ` Taylor Blau
2024-10-24 12:39 ` [RFC PATCH v4 00/19] " Patrick Steinhardt
2024-10-24 12:39 ` [RFC PATCH v4 01/19] Makefile: use common template for GIT-BUILD-OPTIONS Patrick Steinhardt
2024-10-24 12:39 ` [RFC PATCH v4 02/19] Makefile: consistently use @PLACEHOLDER@ to substitute Patrick Steinhardt
2024-10-24 12:39 ` [RFC PATCH v4 03/19] Makefile: consistently use PERL_PATH Patrick Steinhardt
2024-10-24 12:39 ` [RFC PATCH v4 04/19] Makefile: extract script to massage Perl scripts Patrick Steinhardt
2024-11-10 14:36 ` Phillip Wood
2024-11-11 10:36 ` Patrick Steinhardt
2024-10-24 12:39 ` [RFC PATCH v4 05/19] Makefile: use "generate-perl.sh" to massage Perl library Patrick Steinhardt
2024-11-11 10:53 ` Phillip Wood
2024-11-11 14:13 ` Patrick Steinhardt
2024-11-11 14:18 ` Paul Smith
2024-11-11 14:48 ` Patrick Steinhardt
2024-10-24 12:40 ` [RFC PATCH v4 06/19] Makefile: extract script to massage Shell scripts Patrick Steinhardt
2024-11-10 14:42 ` Phillip Wood
2024-10-24 12:40 ` [RFC PATCH v4 07/19] Makefile: extract script to generate gitweb.cgi Patrick Steinhardt
2024-10-24 12:40 ` [RFC PATCH v4 08/19] Makefile: refactor GIT-VERSION-GEN to be reusable Patrick Steinhardt
2024-10-24 12:40 ` [RFC PATCH v4 09/19] Makefile: refactor generators to be PWD-independent Patrick Steinhardt
2024-10-24 12:40 ` [RFC PATCH v4 10/19] Makefile: allow "bin-wrappers/" directory to exist Patrick Steinhardt
2024-10-24 12:40 ` [RFC PATCH v4 11/19] Makefile: simplify building of templates Patrick Steinhardt
2024-10-24 12:40 ` [RFC PATCH v4 12/19] Documentation: allow sourcing generated includes from separate dir Patrick Steinhardt
2024-10-24 12:40 ` [RFC PATCH v4 13/19] Documentation: teach "cmd-list.perl" about out-of-tree builds Patrick Steinhardt
2024-10-24 12:40 ` [RFC PATCH v4 14/19] Documentation: extract script to generate a list of mergetools Patrick Steinhardt
2024-10-24 12:40 ` [RFC PATCH v4 15/19] t: better support for out-of-tree builds Patrick Steinhardt
2024-10-24 12:40 ` [RFC PATCH v4 16/19] t: allow overriding build dir Patrick Steinhardt
2024-10-24 12:40 ` [RFC PATCH v4 17/19] Documentation: add comparison of build systems Patrick Steinhardt
2024-10-24 12:40 ` [RFC PATCH v4 18/19] Introduce support for the Meson build system Patrick Steinhardt
2024-10-24 12:40 ` [RFC PATCH v4 19/19] meson: fix conflicts with in-flight topics Patrick Steinhardt
2024-10-24 16:02 ` [RFC PATCH v4 00/19] Modernize the build system Taylor Blau
2024-10-25 19:59 ` Taylor Blau
2024-11-04 12:17 ` Patrick Steinhardt
2024-11-04 15:03 ` Eli Schwartz
2024-11-11 10:36 ` Patrick Steinhardt
2024-11-04 15:18 ` Taylor Blau
2024-11-09 12:58 ` David Aguilar
2024-11-10 1:07 ` Eli Schwartz
2024-11-11 10:36 ` Patrick Steinhardt
2024-11-11 21:48 ` Eli Schwartz
2024-11-12 10:48 ` Patrick Steinhardt
2024-11-12 15:56 ` Patrick Steinhardt
2024-11-13 9:21 ` David Aguilar
2024-11-13 13:29 ` Patrick Steinhardt
2024-11-13 14:57 ` Eli Schwartz
2024-11-14 8:15 ` Patrick Steinhardt
2024-11-14 4:24 ` Junio C Hamano
2024-11-14 4:46 ` Eli Schwartz
2024-11-14 8:15 ` Patrick Steinhardt
2024-11-14 23:06 ` Junio C Hamano
2024-11-13 14:57 ` Eli Schwartz
2024-11-14 8:15 ` Patrick Steinhardt
2024-11-11 10:36 ` Patrick Steinhardt
2024-11-11 21:06 ` Jeff King
2024-11-11 21:39 ` Eli Schwartz
2024-11-11 22:13 ` Jeff King
2024-11-11 23:55 ` Eli Schwartz
2024-11-12 2:21 ` Jeff King
2024-11-12 2:36 ` Eli Schwartz
2024-11-12 4:52 ` Jeff King
2024-11-12 5:07 ` Junio C Hamano
2024-11-12 10:48 ` Patrick Steinhardt
2024-11-12 5:29 ` Eli Schwartz
2024-11-04 15:11 ` Eli Schwartz
2024-10-28 21:34 ` Ramsay Jones
2024-11-04 12:16 ` Patrick Steinhardt
2024-11-11 15:30 ` [RFC PATCH v5 " Patrick Steinhardt
2024-11-11 15:30 ` [RFC PATCH v5 01/19] Makefile: use common template for GIT-BUILD-OPTIONS Patrick Steinhardt
2024-11-11 15:30 ` [RFC PATCH v5 02/19] Makefile: consistently use @PLACEHOLDER@ to substitute Patrick Steinhardt
2024-11-11 15:30 ` [RFC PATCH v5 03/19] Makefile: consistently use PERL_PATH Patrick Steinhardt
2024-11-11 15:30 ` [RFC PATCH v5 04/19] Makefile: extract script to massage Perl scripts Patrick Steinhardt
2024-11-11 15:30 ` [RFC PATCH v5 05/19] Makefile: use "generate-perl.sh" to massage Perl library Patrick Steinhardt
2024-11-11 15:30 ` [RFC PATCH v5 06/19] Makefile: extract script to massage Shell scripts Patrick Steinhardt
2024-11-11 15:30 ` [RFC PATCH v5 07/19] Makefile: extract script to generate gitweb.cgi Patrick Steinhardt
2024-11-11 15:30 ` [RFC PATCH v5 08/19] Makefile: refactor GIT-VERSION-GEN to be reusable Patrick Steinhardt
2024-11-11 15:30 ` [RFC PATCH v5 09/19] Makefile: refactor generators to be PWD-independent Patrick Steinhardt
2024-11-11 15:31 ` [RFC PATCH v5 10/19] Makefile: allow "bin-wrappers/" directory to exist Patrick Steinhardt
2024-11-11 15:31 ` [RFC PATCH v5 11/19] Makefile: simplify building of templates Patrick Steinhardt
2024-11-11 15:31 ` [RFC PATCH v5 12/19] Documentation: allow sourcing generated includes from separate dir Patrick Steinhardt
2024-11-11 15:31 ` [RFC PATCH v5 13/19] Documentation: teach "cmd-list.perl" about out-of-tree builds Patrick Steinhardt
2024-11-11 15:31 ` [RFC PATCH v5 14/19] Documentation: extract script to generate a list of mergetools Patrick Steinhardt
2024-11-11 15:31 ` [RFC PATCH v5 15/19] t: better support for out-of-tree builds Patrick Steinhardt
2024-11-11 15:31 ` [RFC PATCH v5 16/19] t: allow overriding build dir Patrick Steinhardt
2024-11-11 15:31 ` [RFC PATCH v5 17/19] Documentation: add comparison of build systems Patrick Steinhardt
2024-11-11 15:31 ` [RFC PATCH v5 18/19] Introduce support for the Meson build system Patrick Steinhardt
2024-11-11 15:31 ` [RFC PATCH v5 19/19] meson: fix conflicts with in-flight topics Patrick Steinhardt
2024-11-13 3:10 ` [RFC PATCH v5 00/19] Modernize the build system Ramsay Jones
2024-11-12 17:02 ` [PATCH RFC v6 " Patrick Steinhardt
2024-11-12 17:02 ` [PATCH RFC v6 01/19] Makefile: use common template for GIT-BUILD-OPTIONS Patrick Steinhardt
2024-11-13 7:13 ` Junio C Hamano
2024-11-13 13:24 ` Patrick Steinhardt
2024-11-12 17:02 ` [PATCH RFC v6 02/19] Makefile: consistently use @PLACEHOLDER@ to substitute Patrick Steinhardt
2024-11-12 17:02 ` [PATCH RFC v6 03/19] Makefile: consistently use PERL_PATH Patrick Steinhardt
2024-11-12 17:02 ` [PATCH RFC v6 04/19] Makefile: extract script to massage Perl scripts Patrick Steinhardt
2024-11-12 17:02 ` [PATCH RFC v6 05/19] Makefile: use "generate-perl.sh" to massage Perl library Patrick Steinhardt
2024-11-12 17:02 ` [PATCH RFC v6 06/19] Makefile: extract script to massage Shell scripts Patrick Steinhardt
2024-11-12 17:02 ` [PATCH RFC v6 07/19] Makefile: extract script to generate gitweb.cgi Patrick Steinhardt
2024-11-12 17:02 ` [PATCH RFC v6 08/19] Makefile: refactor GIT-VERSION-GEN to be reusable Patrick Steinhardt
2024-11-13 16:30 ` Phillip Wood
2024-11-14 9:10 ` Patrick Steinhardt
2024-11-14 23:12 ` Junio C Hamano
2024-11-12 17:02 ` [PATCH RFC v6 09/19] Makefile: refactor generators to be PWD-independent Patrick Steinhardt
2024-11-12 17:02 ` [PATCH RFC v6 10/19] Makefile: allow "bin-wrappers/" directory to exist Patrick Steinhardt
2024-11-12 17:02 ` [PATCH RFC v6 11/19] Makefile: simplify building of templates Patrick Steinhardt
2024-11-12 17:02 ` [PATCH RFC v6 12/19] Documentation: allow sourcing generated includes from separate dir Patrick Steinhardt
2024-11-12 17:02 ` [PATCH RFC v6 13/19] Documentation: teach "cmd-list.perl" about out-of-tree builds Patrick Steinhardt
2024-11-12 17:02 ` [PATCH RFC v6 14/19] Documentation: extract script to generate a list of mergetools Patrick Steinhardt
2024-11-12 17:02 ` [PATCH RFC v6 15/19] t: better support for out-of-tree builds Patrick Steinhardt
2024-11-12 17:02 ` [PATCH RFC v6 16/19] t: allow overriding build dir Patrick Steinhardt
2024-11-12 17:03 ` [PATCH RFC v6 17/19] Documentation: add comparison of build systems Patrick Steinhardt
2024-11-12 17:03 ` [PATCH RFC v6 18/19] Introduce support for the Meson build system Patrick Steinhardt
2024-11-13 6:47 ` Junio C Hamano
2024-11-13 13:24 ` Patrick Steinhardt
2024-11-13 16:30 ` Phillip Wood
2024-11-12 17:03 ` [PATCH RFC v6 19/19] meson: fix conflicts with in-flight topics Patrick Steinhardt
2024-11-13 3:30 ` [-SPAM-] [PATCH RFC v6 00/19] Modernize the build system Ramsay Jones
2024-11-13 13:24 ` Patrick Steinhardt
2024-11-13 10:45 ` Christian Couder
2024-11-13 13:24 ` Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 00/22] " Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 01/22] Makefile: use common template for GIT-BUILD-OPTIONS Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 02/22] Makefile: consistently use @PLACEHOLDER@ to substitute Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 03/22] Makefile: refactor GIT-VERSION-GEN to be reusable Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 04/22] Makefile: propagate Git version via generated header Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 05/22] Makefile: generate "git.rc" via GIT-VERSION-GEN Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 06/22] Makefile: consistently use PERL_PATH Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 07/22] Makefile: extract script to massage Perl scripts Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 08/22] Makefile: use "generate-perl.sh" to massage Perl library Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 09/22] Makefile: extract script to massage Shell scripts Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 10/22] Makefile: extract script to generate gitweb.cgi Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 11/22] Makefile: extract script to generate gitweb.js Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 12/22] Makefile: refactor generators to be PWD-independent Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 13/22] Makefile: allow "bin-wrappers/" directory to exist Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 14/22] Makefile: simplify building of templates Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 15/22] Documentation: allow sourcing generated includes from separate dir Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 16/22] Documentation: teach "cmd-list.perl" about out-of-tree builds Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 17/22] Documentation: extract script to generate a list of mergetools Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 18/22] t: better support for out-of-tree builds Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 19/22] t: allow overriding build dir Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 20/22] Documentation: add comparison of build systems Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 21/22] Introduce support for the Meson build system Patrick Steinhardt
2024-11-15 12:20 ` Christian Couder
2024-11-18 9:29 ` Patrick Steinhardt
2024-11-15 7:21 ` [PATCH RFC v7 22/22] meson: fix conflicts with in-flight topics Patrick Steinhardt
2024-11-15 11:17 ` [PATCH RFC v7 00/22] Modernize the build system Patrick Steinhardt
2024-11-16 1:23 ` [-SPAM-] " Ramsay Jones
2024-11-18 9:30 ` Patrick Steinhardt
2024-11-18 12:48 ` Junio C Hamano
2024-11-18 13:05 ` Patrick Steinhardt
2024-11-18 23:39 ` Junio C Hamano
2024-11-19 11:50 ` [PATCH v8 00/23] " Patrick Steinhardt
2024-11-19 11:50 ` [PATCH v8 01/23] Makefile: use common template for GIT-BUILD-OPTIONS Patrick Steinhardt
2024-11-19 11:50 ` [PATCH v8 02/23] Makefile: consistently use @PLACEHOLDER@ to substitute Patrick Steinhardt
2024-11-19 19:23 ` Johannes Sixt
2024-11-20 8:35 ` Patrick Steinhardt
2024-11-19 11:50 ` [PATCH v8 03/23] Makefile: refactor GIT-VERSION-GEN to be reusable Patrick Steinhardt
2024-11-20 3:47 ` Junio C Hamano
2024-11-20 9:44 ` Patrick Steinhardt
2024-11-21 0:03 ` Junio C Hamano
2024-11-25 9:03 ` Patrick Steinhardt
2024-11-19 11:50 ` [PATCH v8 04/23] Makefile: propagate Git version via generated header Patrick Steinhardt
2024-11-19 11:50 ` [PATCH v8 05/23] Makefile: generate "git.rc" via GIT-VERSION-GEN Patrick Steinhardt
2024-11-19 11:50 ` [PATCH v8 06/23] Makefile: generate doc versions " Patrick Steinhardt
2024-11-19 11:50 ` [PATCH v8 07/23] Makefile: consistently use PERL_PATH Patrick Steinhardt
2024-11-19 11:50 ` [PATCH v8 08/23] Makefile: extract script to massage Perl scripts Patrick Steinhardt
2024-11-19 11:50 ` [PATCH v8 09/23] Makefile: use "generate-perl.sh" to massage Perl library Patrick Steinhardt
2024-11-19 11:50 ` [PATCH v8 10/23] Makefile: extract script to massage Shell scripts Patrick Steinhardt
2024-11-19 11:50 ` [PATCH v8 11/23] Makefile: extract script to generate gitweb.cgi Patrick Steinhardt
2024-11-19 11:50 ` [PATCH v8 12/23] Makefile: extract script to generate gitweb.js Patrick Steinhardt
2024-11-19 11:50 ` [PATCH v8 13/23] Makefile: refactor generators to be PWD-independent Patrick Steinhardt
2024-11-19 11:50 ` [PATCH v8 14/23] Makefile: allow "bin-wrappers/" directory to exist Patrick Steinhardt
2024-11-19 11:50 ` [PATCH v8 15/23] Makefile: simplify building of templates Patrick Steinhardt
2024-11-19 11:50 ` [PATCH v8 16/23] Documentation: allow sourcing generated includes from separate dir Patrick Steinhardt
2024-11-19 11:50 ` [PATCH v8 17/23] Documentation: teach "cmd-list.perl" about out-of-tree builds Patrick Steinhardt
2024-11-19 11:50 ` [PATCH v8 18/23] Documentation: extract script to generate a list of mergetools Patrick Steinhardt
2024-11-19 11:50 ` [PATCH v8 19/23] t: better support for out-of-tree builds Patrick Steinhardt
2024-11-19 11:50 ` [PATCH v8 20/23] t: allow overriding build dir Patrick Steinhardt
2024-11-19 11:50 ` [PATCH v8 21/23] Documentation: add comparison of build systems Patrick Steinhardt
2024-11-19 11:50 ` [PATCH v8 22/23] Introduce support for the Meson build system Patrick Steinhardt
2024-11-19 11:51 ` [PATCH v8 23/23] meson: fix conflicts with in-flight topics Patrick Steinhardt
2024-11-20 5:15 ` [PATCH v8 00/23] Modernize the build system Junio C Hamano
2024-11-20 8:56 ` Patrick Steinhardt
2024-11-25 9:56 ` [PATCH v9 " Patrick Steinhardt
2024-11-25 9:56 ` [PATCH v9 01/23] Makefile: use common template for GIT-BUILD-OPTIONS Patrick Steinhardt
2024-11-25 9:56 ` [PATCH v9 02/23] Makefile: consistently use @PLACEHOLDER@ to substitute Patrick Steinhardt
2024-11-25 9:56 ` [PATCH v9 03/23] Makefile: refactor GIT-VERSION-GEN to be reusable Patrick Steinhardt
2024-11-25 9:56 ` [PATCH v9 04/23] Makefile: propagate Git version via generated header Patrick Steinhardt
2024-11-25 9:56 ` [PATCH v9 05/23] Makefile: generate "git.rc" via GIT-VERSION-GEN Patrick Steinhardt
2024-11-25 9:56 ` [PATCH v9 06/23] Makefile: generate doc versions " Patrick Steinhardt
2025-01-13 20:17 ` Renato Botelho
2025-01-17 9:04 ` Patrick Steinhardt
2024-11-25 9:56 ` [PATCH v9 07/23] Makefile: consistently use PERL_PATH Patrick Steinhardt
2024-11-25 9:56 ` [PATCH v9 08/23] Makefile: extract script to massage Perl scripts Patrick Steinhardt
2024-11-25 9:56 ` [PATCH v9 09/23] Makefile: use "generate-perl.sh" to massage Perl library Patrick Steinhardt
2024-11-25 9:56 ` [PATCH v9 10/23] Makefile: extract script to massage Shell scripts Patrick Steinhardt
2024-11-25 9:56 ` [PATCH v9 11/23] Makefile: extract script to generate gitweb.cgi Patrick Steinhardt
2024-11-25 9:57 ` [PATCH v9 12/23] Makefile: extract script to generate gitweb.js Patrick Steinhardt
2024-11-25 9:57 ` [PATCH v9 13/23] Makefile: refactor generators to be PWD-independent Patrick Steinhardt
2024-11-25 9:57 ` [PATCH v9 14/23] Makefile: allow "bin-wrappers/" directory to exist Patrick Steinhardt
2024-11-25 9:57 ` [PATCH v9 15/23] Makefile: simplify building of templates Patrick Steinhardt
2024-11-25 9:57 ` [PATCH v9 16/23] Documentation: allow sourcing generated includes from separate dir Patrick Steinhardt
2024-11-25 9:57 ` [PATCH v9 17/23] Documentation: teach "cmd-list.perl" about out-of-tree builds Patrick Steinhardt
2024-11-25 9:57 ` [PATCH v9 18/23] Documentation: extract script to generate a list of mergetools Patrick Steinhardt
2024-11-25 9:57 ` [PATCH v9 19/23] t: better support for out-of-tree builds Patrick Steinhardt
2024-11-25 9:57 ` [PATCH v9 20/23] t: allow overriding build dir Patrick Steinhardt
2024-11-25 9:57 ` [PATCH v9 21/23] Documentation: add comparison of build systems Patrick Steinhardt
2024-11-25 9:57 ` [PATCH v9 22/23] Introduce support for the Meson build system Patrick Steinhardt
2024-11-25 9:57 ` [PATCH v9 23/23] meson: fix conflicts with in-flight topics Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 00/23] Modernize the build system Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 01/23] Makefile: use common template for GIT-BUILD-OPTIONS Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 02/23] Makefile: consistently use @PLACEHOLDER@ to substitute Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 03/23] Makefile: refactor GIT-VERSION-GEN to be reusable Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 04/23] Makefile: propagate Git version via generated header Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 05/23] Makefile: generate "git.rc" via GIT-VERSION-GEN Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 06/23] Makefile: generate doc versions " Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 07/23] Makefile: consistently use PERL_PATH Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 08/23] Makefile: extract script to massage Perl scripts Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 09/23] Makefile: use "generate-perl.sh" to massage Perl library Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 10/23] Makefile: extract script to massage Shell scripts Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 11/23] Makefile: extract script to generate gitweb.cgi Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 12/23] Makefile: extract script to generate gitweb.js Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 13/23] Makefile: refactor generators to be PWD-independent Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 14/23] Makefile: allow "bin-wrappers/" directory to exist Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 15/23] Makefile: simplify building of templates Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 16/23] Documentation: allow sourcing generated includes from separate dir Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 17/23] Documentation: teach "cmd-list.perl" about out-of-tree builds Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 18/23] Documentation: extract script to generate a list of mergetools Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 19/23] t: better support for out-of-tree builds Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 20/23] t: allow overriding build dir Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 21/23] Documentation: add comparison of build systems Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 22/23] Introduce support for the Meson build system Patrick Steinhardt
2024-11-28 16:12 ` [PATCH v10 23/23] meson: fix conflicts with in-flight topics Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 00/26] Modernize the build system Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 01/26] Makefile: use common template for GIT-BUILD-OPTIONS Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 02/26] Makefile: consistently use @PLACEHOLDER@ to substitute Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 03/26] Makefile: refactor GIT-VERSION-GEN to be reusable Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 04/26] Makefile: propagate Git version via generated header Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 05/26] Makefile: generate "git.rc" via GIT-VERSION-GEN Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 06/26] Makefile: generate doc versions " Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 07/26] Makefile: consistently use PERL_PATH Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 08/26] Makefile: extract script to massage Perl scripts Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 09/26] Makefile: use "generate-perl.sh" to massage Perl library Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 10/26] Makefile: extract script to massage Shell scripts Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 11/26] Makefile: extract script to massage Python scripts Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 12/26] Makefile: extract script to generate gitweb.cgi Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 13/26] Makefile: extract script to generate gitweb.js Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 14/26] Makefile: refactor generators to be PWD-independent Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 15/26] Makefile: allow "bin-wrappers/" directory to exist Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 16/26] Makefile: write absolute program path into bin-wrappers Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 17/26] Makefile: simplify building of templates Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 18/26] Documentation: allow sourcing generated includes from separate dir Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 19/26] Documentation: teach "cmd-list.perl" about out-of-tree builds Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 20/26] Documentation: extract script to generate a list of mergetools Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 21/26] t: better support for out-of-tree builds Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 22/26] t: allow overriding build dir Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 23/26] Documentation: add comparison of build systems Patrick Steinhardt
2024-12-06 13:24 ` [PATCH v11 24/26] Introduce support for the Meson build system Patrick Steinhardt
2024-12-06 13:25 ` [PATCH v11 25/26] meson: fix conflicts with in-flight topics Patrick Steinhardt
2024-12-08 3:00 ` Junio C Hamano
2024-12-09 1:20 ` Junio C Hamano
2024-12-09 6:16 ` Patrick Steinhardt
2024-12-09 7:58 ` Junio C Hamano
2024-12-10 11:20 ` Patrick Steinhardt
2024-12-10 12:03 ` Junio C Hamano
2024-12-06 13:25 ` [PATCH v11 26/26] Revert "meson: fix conflicts with in-flight topics" Patrick Steinhardt
2024-12-06 16:10 ` Patrick Steinhardt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).