threads / patch / 49771

patchWindows: force-recompile git.res for differing architectures

Subject: [PATCH 0/1] Windows: force-recompile git.res for differing architectures

## tl;dr

7 messages between Nov 6, 2018 and Nov 7, 2018. Diffs are folded; open one to read it.

replies: 6people: 3as markdown or json

Johannes Schindelin via GitGitGadget· Nov 6, 2018, 14:55 UTC · lore

This is a patch designed to help maintaining Git for Windows better: when the same source code is "cross-compiled" for i686 as well as x86_64, we want to rebuild the whole thing, including the resource file git.res.

Note: regular C files are re-compiled appropriately, as the default prefix
in Git for Windows is /mingw32 or /mingw64 depending on the architecture,
and this difference is manifested in the CFLAGS (which, upon change, trigger
a complete rebuild).

As non-Windows platforms do not even compile these .res files, this patch should have exactly no effect on non-Windows builds.

Johannes Schindelin (1):
  Windows: force-recompile git.res for differing architectures
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
base-commit: cd69ec8cde54af1817630331fc441f493866f0d4
Published-As: https://github.com/gitgitgadget/git/releases/tags/pr-67%2Fdscho%2Fmingw-git.res-bitness-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-67/dscho/mingw-git.res-bitness-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/67
-- 
gitgitgadget
Johannes Schindelin via GitGitGadget· Nov 6, 2018, 14:55 UTC · re: Johannes Schindelin via GitGitGadget · lore

[PATCH 1/1] Windows: force-recompile git.res for differing architectures

From: Johannes Schindelin <johannes.schindelin@gmx.de>

When git.rc is compiled into git.res, the result is actually dependent on the architecture. That is, you cannot simply link a 32-bit git.res into a 64-bit git.exe.

Therefore, to allow 32-bit and 64-bit builds in the same directory, we let git.res depend on GIT-PREFIX so that it gets recompiled when compiling for a different architecture (this works because the exec path changes based on the architecture: /mingw32/libexec/git-core for 32-bit and /mingw64/libexec/git-core for 64-bit).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Show changes to Makefile +1 −1
diff --git a/Makefile b/Makefile
index bbfbb4292d..8375736c32 100644
--- a/Makefile
+++ b/Makefile
@@ -2110,7 +2110,7 @@ $(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEFINES
 	$(QUIET_GEN)$(cmd_munge_script) && \
 	mv $@+ $@
 
-git.res: git.rc GIT-VERSION-FILE
+git.res: git.rc GIT-VERSION-FILE GIT-PREFIX
 	$(QUIET_RC)$(RC) \
 	  $(join -DMAJOR= -DMINOR= -DMICRO= -DPATCHLEVEL=, $(wordlist 1, 4, \
 	    $(shell echo $(GIT_VERSION) 0 0 0 0 | tr '.a-zA-Z-' ' '))) \
-- 
gitgitgadget
Johannes Sixt· Nov 6, 2018, 21:44 UTC · re: Johannes Schindelin via GitGitGadget · lore

Re: [PATCH 1/1] Windows: force-recompile git.res for differing architectures

Am 06.11.18 um 15:55 schrieb Johannes Schindelin via GitGitGadget:
Show 11 quoted lines
> From: Johannes Schindelin <johannes.schindelin@gmx.de>
> 
> When git.rc is compiled into git.res, the result is actually dependent
> on the architecture. That is, you cannot simply link a 32-bit git.res
> into a 64-bit git.exe.
> 
> Therefore, to allow 32-bit and 64-bit builds in the same directory, we
> let git.res depend on GIT-PREFIX so that it gets recompiled when
> compiling for a different architecture (this works because the exec path
> changes based on the architecture: /mingw32/libexec/git-core for 32-bit
> and /mingw64/libexec/git-core for 64-bit).

On Linux, when I recompile for a different architecture, CFLAGS would change, so I would have thought that GIT-CFLAGS were the natural choice for a dependency. Don't they change in this case on Windows, too?

Show 20 quoted lines
> 
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
>   Makefile | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Makefile b/Makefile
> index bbfbb4292d..8375736c32 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -2110,7 +2110,7 @@ $(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEFINES
>   	$(QUIET_GEN)$(cmd_munge_script) && \
>   	mv $@+ $@
>   
> -git.res: git.rc GIT-VERSION-FILE
> +git.res: git.rc GIT-VERSION-FILE GIT-PREFIX
>   	$(QUIET_RC)$(RC) \
>   	  $(join -DMAJOR= -DMINOR= -DMICRO= -DPATCHLEVEL=, $(wordlist 1, 4, \
>   	    $(shell echo $(GIT_VERSION) 0 0 0 0 | tr '.a-zA-Z-' ' '))) \
> 
Junio C Hamano· Nov 7, 2018, 01:32 UTC · re: Johannes Sixt · lore

Re: [PATCH 1/1] Windows: force-recompile git.res for differing architectures

Johannes Sixt <j6t@kdbg.org> writes:
Show 17 quoted lines
> Am 06.11.18 um 15:55 schrieb Johannes Schindelin via GitGitGadget:
>> From: Johannes Schindelin <johannes.schindelin@gmx.de>
>>
>> When git.rc is compiled into git.res, the result is actually dependent
>> on the architecture. That is, you cannot simply link a 32-bit git.res
>> into a 64-bit git.exe.
>>
>> Therefore, to allow 32-bit and 64-bit builds in the same directory, we
>> let git.res depend on GIT-PREFIX so that it gets recompiled when
>> compiling for a different architecture (this works because the exec path
>> changes based on the architecture: /mingw32/libexec/git-core for 32-bit
>> and /mingw64/libexec/git-core for 64-bit).
>
> On Linux, when I recompile for a different architecture, CFLAGS would
> change, so I would have thought that GIT-CFLAGS were the natural
> choice for a dependency. Don't they change in this case on Windows,
> too?

Depending on GIT-CFLAGS would have a better chance of being safe, I guess, even though it can at times be overly safe, than GIT-PREFIX, I suspect. As a single user target in Makefile, which is only used by Dscho, who intends to stick to /mingw(32|64)/ convention til the end of time, I think the posted patch is OK, though.

Johannes Sixt· Nov 7, 2018, 06:55 UTC · re: Junio C Hamano · lore

Re: [PATCH 1/1] Windows: force-recompile git.res for differing architectures

Am 07.11.18 um 02:32 schrieb Junio C Hamano:
Show 11 quoted lines
> Johannes Sixt <j6t@kdbg.org> writes:
>> On Linux, when I recompile for a different architecture, CFLAGS would
>> change, so I would have thought that GIT-CFLAGS were the natural
>> choice for a dependency. Don't they change in this case on Windows,
>> too?
> 
> Depending on GIT-CFLAGS would have a better chance of being safe, I
> guess, even though it can at times be overly safe, than GIT-PREFIX,
> I suspect.  As a single user target in Makefile, which is only used
> by Dscho, who intends to stick to /mingw(32|64)/ convention til the
> end of time, I think the posted patch is OK, though.

I think that it's not only Dscho who uses the target (my build environment, for example, is different from Dscho's and compiles git.res, too). But since the patch helps him most and doesn't hurt others, it is good to go. No objection from my side.

-- Hannes
Junio C Hamano· Nov 7, 2018, 09:03 UTC · re: Johannes Sixt · lore

Re: [PATCH 1/1] Windows: force-recompile git.res for differing architectures

Johannes Sixt <j6t@kdbg.org> writes:
Show 17 quoted lines
> Am 07.11.18 um 02:32 schrieb Junio C Hamano:
>> Johannes Sixt <j6t@kdbg.org> writes:
>>> On Linux, when I recompile for a different architecture, CFLAGS would
>>> change, so I would have thought that GIT-CFLAGS were the natural
>>> choice for a dependency. Don't they change in this case on Windows,
>>> too?
>>
>> Depending on GIT-CFLAGS would have a better chance of being safe, I
>> guess, even though it can at times be overly safe, than GIT-PREFIX,
>> I suspect.  As a single user target in Makefile, which is only used
>> by Dscho, who intends to stick to /mingw(32|64)/ convention til the
>> end of time, I think the posted patch is OK, though.
>
> I think that it's not only Dscho who uses the target (my build
> environment, for example, is different from Dscho's and compiles
> git.res, too). But since the patch helps him most and doesn't hurt
> others, it is good to go. No objection from my side.

Yeah, that was phrased poorly. What I meant was by "only by Dscho" was "only by those who share the convention that GIT-PREFIX is changed if and only if targetting a different arch".

Anyway, I just wanted to say that GIT-PREFIX may not be precise enough but would give sufficient signal; GIT-CFLAGS may be a more cautious choice, but it may change a bit too often ;-).

Johannes Schindelin· Nov 7, 2018, 11:25 UTC · re: Junio C Hamano · lore

Re: [PATCH 1/1] Windows: force-recompile git.res for differing architectures

Hi,
On Wed, 7 Nov 2018, Junio C Hamano wrote:
Show 27 quoted lines
> Johannes Sixt <j6t@kdbg.org> writes:
> 
> > Am 07.11.18 um 02:32 schrieb Junio C Hamano:
> >> Johannes Sixt <j6t@kdbg.org> writes:
> >>> On Linux, when I recompile for a different architecture, CFLAGS would
> >>> change, so I would have thought that GIT-CFLAGS were the natural
> >>> choice for a dependency. Don't they change in this case on Windows,
> >>> too?
> >>
> >> Depending on GIT-CFLAGS would have a better chance of being safe, I
> >> guess, even though it can at times be overly safe, than GIT-PREFIX,
> >> I suspect.  As a single user target in Makefile, which is only used
> >> by Dscho, who intends to stick to /mingw(32|64)/ convention til the
> >> end of time, I think the posted patch is OK, though.
> >
> > I think that it's not only Dscho who uses the target (my build
> > environment, for example, is different from Dscho's and compiles
> > git.res, too). But since the patch helps him most and doesn't hurt
> > others, it is good to go. No objection from my side.
> 
> Yeah, that was phrased poorly.  What I meant was by "only by Dscho"
> was "only by those who share the convention that GIT-PREFIX is
> changed if and only if targetting a different arch".
> 
> Anyway, I just wanted to say that GIT-PREFIX may not be precise
> enough but would give sufficient signal; GIT-CFLAGS may be a more
> cautious choice, but it may change a bit too often ;-).
I am fine with GIT-CFLAGS, too. Do you want me to "rick-roll" a v2?

Ciao, Dscho

← back to recent threads