summaryrefslogtreecommitdiffstats
path: root/GIT-VERSION-GEN
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-12-06 14:24:40 +0100
committerJunio C Hamano <gitster@pobox.com>2024-12-06 23:52:09 +0100
commit9bb10d27e7072cec919d38f0b987c70e598039ad (patch)
tree6205bc645b9a140470614e3dd8b3183f0b8c4703 /GIT-VERSION-GEN
parentMakefile: propagate Git version via generated header (diff)
downloadgit-9bb10d27e7072cec919d38f0b987c70e598039ad.tar.xz
git-9bb10d27e7072cec919d38f0b987c70e598039ad.zip
Makefile: generate "git.rc" via GIT-VERSION-GEN
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'GIT-VERSION-GEN')
-rwxr-xr-xGIT-VERSION-GEN8
1 files changed, 6 insertions, 2 deletions
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index c18f24e515..a1c8146f05 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"+