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

[PATCH/RFC] Makefile: Fix compilation of windows resource file

From
Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Date
Jan 20, 2014, 20:22 UTC
Message-ID
<52DD857C.6060005@ramsay1.demon.co.uk>

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]

In order to fix the syntax error, we replace any rcX with zero and include some additional 'zero' padding to the version number list.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
Hi Junio,

This patch is marked RFC because, as I was just about to send this email, I realized it wouldn't always work:

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

I suspect it would be easier to change GIT-VERSION-GEN to also set, say, GIT_VERSION_MAJOR, GIT_VERSION_MINOR and GIT_VERSION_PATCH ...

ATB, Ramsay Jones

 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index b4af1e2..308baaa 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= -DPATCH=, $(wordlist 1,3,$(patsubst rc%,0,$(subst -, ,$(subst ., ,$(GIT_VERSION))) 0 0))) \
 	  -DGIT_VERSION="\\\"$(GIT_VERSION)\\\"" $< -o $@
 
 ifndef NO_PERL
-- 
1.8.5
Next: Junio C Hamano
Message 1 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.