git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH/RFC] Makefile: Fix compilation of windows resource file
@ 2014-01-20 20:22 Ramsay Jones
  2014-01-21 21:04 ` Junio C Hamano
  0 siblings, 1 reply; 15+ messages in thread
From: Ramsay Jones @ 2014-01-20 20:22 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: GIT Mailing-list


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

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2014-01-23 18:02 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-20 20:22 [PATCH/RFC] Makefile: Fix compilation of windows resource file Ramsay Jones
2014-01-21 21:04 ` Junio C Hamano
2014-01-21 21:36   ` Junio C Hamano
2014-01-21 22:51     ` Ramsay Jones
2014-01-21 23:48       ` Junio C Hamano
2014-01-22  6:55         ` Johannes Sixt
2014-01-22 16:12           ` Junio C Hamano
2014-01-22 16:42             ` Johannes Sixt
2014-01-22 17:38               ` Junio C Hamano
2014-01-22 20:14                 ` Junio C Hamano
2014-01-23  7:28                   ` [PATCH v2] Makefile: Fix compilation of Windows " Johannes Sixt
2014-01-23 12:02                     ` Pat Thoyts
2014-01-23 14:16                       ` Johannes Sixt
2014-01-23 15:19                         ` Pat Thoyts
2014-01-23 18:02                           ` Junio C Hamano

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).