git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2] Makefile: Fix compilation of Windows resource file

From
Johannes Sixt <j.sixt@viscovery.net>
Date
Jan 23, 2014, 07:28 UTC
Message-ID
<52E0C4BA.4080405@viscovery.net>
In-Reply-To
<xmqqeh3zydrz.fsf@gitster.dls.corp.google.com>
From: Johannes Sixt <j6t@kdbg.org>

If the git version number consists of less than three period separated numbers, then the Windows resource file compilation issues a syntax error:

  $ touch git.rc
  $ make V=1 git.res
  GIT_VERSION = 1.9.rc0
  windres -O coff \
            -DMAJOR=1 -DMINOR=9 -DPATCH=rc0 \
            -DGIT_VERSION="\\\"1.9.rc0\\\"" git.rc -o git.res
  C:\msysgit\msysgit\mingw\bin\windres.exe: git.rc:2: syntax error
  make: *** [git.res] Error 1
  $
Note that -DPATCH=rc0.

The values passed via -DMAJOR=, -DMINOR=, and -DPATCH= are used in FILEVERSION and PRODUCTVERSION statements, which expect up to four numeric values. These version numbers are intended for machine consumption. They are typically inspected by installers to decide whether a file to be installed is newer than one that exists on the system, but are not used for much else.

We can be pretty certain that there are no tools that look at these version numbers, not even the installer of Git for Windows does. Therefore, to fix the syntax error, fill in only the first two numbers, which we are guaranteed to find in Git version numbers.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
 That "not even the installer of Git for Windows uses" the FILEVERSION
 numbers is a bold statement of mine (I did not check). If I am wrong,
 this approach for a fix is not viable, and a better fix would be
 needed. Otherwise, an Acked-By would be appreciated so that we can
 have this fix in upstream ASAP.
 Makefile | 2 +-
 git.rc   | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
index b4af1e2..99b2b89 100644
--- a/Makefile
+++ b/Makefile
@@ -1773,7 +1773,7 @@ $(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEFINES
 
 git.res: git.rc GIT-VERSION-FILE
 	$(QUIET_RC)$(RC) \
-	  $(join -DMAJOR= -DMINOR= -DPATCH=, $(wordlist 1,3,$(subst -, ,$(subst ., ,$(GIT_VERSION))))) \
+	  $(join -DMAJOR= -DMINOR=, $(wordlist 1,2,$(subst -, ,$(subst ., ,$(GIT_VERSION))))) \
 	  -DGIT_VERSION="\\\"$(GIT_VERSION)\\\"" $< -o $@
 
 ifndef NO_PERL
diff --git a/git.rc b/git.rc
index bce6db9..33aafb7 100644
--- a/git.rc
+++ b/git.rc
@@ -1,6 +1,6 @@
 1 VERSIONINFO
-FILEVERSION     MAJOR,MINOR,PATCH,0
-PRODUCTVERSION  MAJOR,MINOR,PATCH,0
+FILEVERSION     MAJOR,MINOR,0,0
+PRODUCTVERSION  MAJOR,MINOR,0,0
 BEGIN
   BLOCK "StringFileInfo"
   BEGIN
-- 
1.9.rc0.1179.g5088b55

-- 
-- 
*** Please reply-to-all at all times ***
*** (do not pretend to know who is subscribed and who is not) ***
*** Please avoid top-posting. ***
The msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.

You received this message because you are subscribed to the Google
Groups "msysGit" group.
To post to this group, send email to msysgit@googlegroups.com
To unsubscribe from this group, send email to
msysgit+unsubscribe@googlegroups.com
For more options, and view previous threads, visit this group at
http://groups.google.com/group/msysgit?hl=en_US?hl=en

--- 
You received this message because you are subscribed to the Google Groups "msysGit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Previous: Junio C HamanoNext: Pat Thoyts
Message 11 of 15 in “Makefile: Fix compilation of windows resource file”
  1. Makefile: Fix compilation of windows resource fileRamsay Jones, Jan 20, 2014
  2. Junio C HamanoJan 21, 2014
  3. Junio C HamanoJan 21, 2014
  4. Ramsay JonesJan 21, 2014
  5. Junio C HamanoJan 21, 2014
  6. Johannes SixtJan 22, 2014
  7. Junio C HamanoJan 22, 2014
  8. Johannes SixtJan 22, 2014
  9. Junio C HamanoJan 22, 2014
  10. Junio C HamanoJan 22, 2014
  11. Makefile: Fix compilation of Windows resource fileJohannes Sixt, Jan 23, 2014
  12. Pat ThoytsJan 23, 2014
  13. Johannes SixtJan 23, 2014
  14. Pat ThoytsJan 23, 2014
  15. Junio C HamanoJan 23, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.