Provide a Windows version resource for the git executables.
authorPat Thoyts <patthoyts@users.sourceforge.net>
Wed, 23 May 2012 23:56:24 +0000 (00:56 +0100)
committerPat Thoyts <patthoyts@users.sourceforge.net>
Tue, 4 Jun 2013 09:11:08 +0000 (10:11 +0100)
Embeds the git version and description into the git executable thus
implementing the request in issue #5.

Acked-by: Heiko Voigt <hvoigt@hvoigt.net>
Acked-by: Sebastian Schuberth <sschuberth@gmail.com>
Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
.gitignore
Makefile
config.mak.uname
git.rc [new file with mode: 0644]

index 10aee94760bca452935ac5c0dfc337a0f6b58a30..1640c3ad005adbeecf4b90f92e5d3369c6490697 100644 (file)
 /cscope*
 *.obj
 *.lib
+*.res
 *.sln
 *.suo
 *.ncb
index 985598b01471428b81525a92fa2cfbf55c147bf3..7ba8640e18528fe5f20c32839888c95e7ea34ce2 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1529,6 +1529,7 @@ ifndef V
        QUIET_MSGFMT   = @echo '   ' MSGFMT $@;
        QUIET_GCOV     = @echo '   ' GCOV $@;
        QUIET_SP       = @echo '   ' SP $<;
+       QUIET_RC       = @echo '   ' RC $@;
        QUIET_SUBDIR0  = +@subdir=
        QUIET_SUBDIR1  = ;$(NO_SUBDIR) echo '   ' SUBDIR $$subdir; \
                         $(MAKE) $(PRINT_DIR) -C $$subdir
@@ -1774,6 +1775,11 @@ $(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEFINES
        $(QUIET_GEN)$(cmd_munge_script) && \
        mv $@+ $@
 
+git.res: git.rc
+       $(QUIET_RC)$(RC) \
+         $(join -DMAJOR= -DMINOR= -DPATCH=, $(wordlist 1,3,$(subst ., ,$(GIT_VERSION)))) \
+         -DGIT_VERSION="\\\"$(GIT_VERSION)\\\"" $< -o $@
+
 ifndef NO_PERL
 $(patsubst %.perl,%,$(SCRIPT_PERL)): perl/perl.mak
 
@@ -2474,7 +2480,7 @@ profile-clean:
        $(RM) $(addsuffix *.gcno,$(addprefix $(PROFILE_DIR)/, $(object_dirs)))
 
 clean: profile-clean coverage-clean
-       $(RM) *.o block-sha1/*.o ppc/*.o compat/*.o compat/*/*.o xdiff/*.o vcs-svn/*.o \
+       $(RM) *.o *.res block-sha1/*.o ppc/*.o compat/*.o compat/*/*.o xdiff/*.o vcs-svn/*.o \
                builtin/*.o $(LIB_FILE) $(XDIFF_LIB) $(VCSSVN_LIB)
        $(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git$X
        $(RM) $(TEST_PROGRAMS)
index c5518fe330a4c3377785d16e014747ab21afa7db..04b97486a21b87c148e827bb0167e72b4a24c8a8 100644 (file)
@@ -507,7 +507,9 @@ ifneq (,$(findstring MINGW,$(uname_S)))
                compat/win32/dirent.o
        BASIC_LDFLAGS += -Wl,--large-address-aware
        EXTLIBS += -lws2_32
+       GITLIBS += git.res
        PTHREAD_LIBS =
+       RC = windres -O coff
        NATIVE_CRLF = YesPlease
        X = .exe
        SPARSE_FLAGS = -Wno-one-bit-signed-bitfield
diff --git a/git.rc b/git.rc
new file mode 100644 (file)
index 0000000..bce6db9
--- /dev/null
+++ b/git.rc
@@ -0,0 +1,22 @@
+1 VERSIONINFO
+FILEVERSION     MAJOR,MINOR,PATCH,0
+PRODUCTVERSION  MAJOR,MINOR,PATCH,0
+BEGIN
+  BLOCK "StringFileInfo"
+  BEGIN
+    BLOCK "040904b0"   /* LANG_ENGLISH/SUBLANG_ENGLISH_US, Unicode CP */
+    BEGIN
+      VALUE "CompanyName", "The Git Development Community\0"
+      VALUE "FileDescription", "Git for Windows\0"
+      VALUE "InternalName", "git\0"
+      VALUE "OriginalFilename", "git.exe\0"
+      VALUE "ProductName", "Git\0"
+      VALUE "ProductVersion", GIT_VERSION "\0"
+    END
+  END
+
+  BLOCK "VarFileInfo"
+  BEGIN
+    VALUE "Translation", 0x409, 1200
+  END
+END