Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org,  Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: Re: [PATCH 08/12] mingw: rely on MSYS2's metadata instead of hard-coding it
Date: Wed, 05 Aug 2026 10:29:49 -0700	[thread overview]
Message-ID: <xmqq7bm4qxv6.fsf@gitster.g> (raw)
In-Reply-To: <1593d1d1a0dceb58640cfa56b49bf30d8a2c6365.1785939999.git.gitgitgadget@gmail.com> (Johannes Schindelin via GitGitGadget's message of "Wed, 05 Aug 2026 14:26:34 +0000")

"Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
writes:

> -                ifeq (CLANGARM64,$(MSYSTEM))
> -			prefix = /clangarm64
> -                else
> -			prefix = /mingw64
> -                endif
> +        ifneq (,$(MSYSTEM))
> +		prefix = $(MINGW_PREFIX)
>          endif

Mental note: if $(MSYSTEM) is not an empty string, we set prefix to
$(MINGW_PREFIX).

> @@ -755,6 +749,10 @@ ifeq ($(uname_S),MINGW)
>  		BASIC_LDFLAGS += -Wl,--dynamicbase
>          endif
>          ifneq (,$(MSYSTEM))
> +                ifeq ($(MINGW_PREFIX),$(filter-out /%,$(MINGW_PREFIX)))
> +			# Override if empty or does not start with a slash
> +			MINGW_PREFIX := /$(shell echo '$(MSYSTEM)' | tr A-Z a-z)
> +                endif

Mental note: MINGW_PREFIX that does not begin with a slash is forced
to begin with a slash.

>  		prefix = $(MINGW_PREFIX)

And that becomes $(prefix).

> diff --git a/meson.build b/meson.build
> index 7073d5844d..6ddc461873 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -1318,7 +1318,6 @@ elif host_machine.system() == 'windows'
>  
>    libgit_c_args += [
>      '-DDETECT_MSYS_TTY',
> -    '-DENSURE_MSYSTEM_IS_SET',
>      '-DNATIVE_CRLF',
>      '-DNOGDI',
>      '-DNO_POSIX_GOODIES',
> @@ -1328,6 +1327,18 @@ elif host_machine.system() == 'windows'
>      '-D__USE_MINGW_ANSI_STDIO=0',
>    ]
>  
> +  msystem = get_option('msystem')
> +  if msystem != ''
> +    mingw_prefix = get_option('mingw_prefix')
> +    if mingw_prefix == ''
> +      mingw_prefix = '/' + msystem.to_lower()
> +    endif
> +    libgit_c_args += [
> +      '-DENSURE_MSYSTEM_IS_SET="' + msystem + '"',
> +      '-DMINGW_PREFIX="' + mingw_prefix + '"'
> +    ]
> +  endif

Lowercase mingw_prefix in Meson world corresponds to MINGW_PREFIX in
Make world, I guess.  -DMINGW_PRFIX gets mingw_prefix which begins
with a slash.

I do not do Windows or Meson, but doesn't this contradict with what
we have in [12/12], part of which says:

diff --git a/config.mak.uname b/config.mak.uname
index 2f7d445eb3..0b63be10b7 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -535,7 +535,9 @@ endif
 		compat/win32/pthread.o compat/win32/syslog.o \
 		compat/win32/trace2_win32_process_info.o \
 		compat/win32/dirent.o
-	COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
+	COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY \
+		-DENSURE_MSYSTEM_IS_SET="\"$(MSYSTEM)\"" -DMINGW_PREFIX="\"$(patsubst /%,%,$(MINGW_PREFIX))\"" \
+		-DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
 	BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -ENTRY:wmainCRTStartup -SUBSYSTEM:CONSOLE
 	# invalidcontinue.obj allows Git's source code to close the same file
 	# handle twice, or to access the osfhandle of an already-closed stdout


IOW, -DMINGW_PREFIX passed to the compiler strips leading slash from
$(MINGW_PREFIX).

Isn't it necessary to strip the leading slash from ming_prefix also
on the Meson side?

  reply	other threads:[~2026-08-05 17:29 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-05 14:26 [PATCH 00/12] Upstream some more Git for Windows' patches Johannes Schindelin via GitGitGadget
2026-08-05 14:26 ` [PATCH 01/12] mingw: include the Python parts in the build Johannes Schindelin via GitGitGadget
2026-08-05 14:26 ` [PATCH 02/12] mingw: stop hard-coding `CC = gcc` Johannes Schindelin via GitGitGadget
2026-08-05 14:26 ` [PATCH 03/12] mingw: drop the -D_USE_32BIT_TIME_T option Johannes Schindelin via GitGitGadget
2026-08-05 14:26 ` [PATCH 04/12] mingw: only use -Wl,--large-address-aware for 32-bit builds Johannes Schindelin via GitGitGadget
2026-08-05 14:26 ` [PATCH 05/12] mingw: avoid over-specifying `--pic-executable` Johannes Schindelin via GitGitGadget
2026-08-05 14:26 ` [PATCH 06/12] mingw: set the prefix and HOST_CPU as per MSYS2's settings Johannes Schindelin via GitGitGadget
2026-08-05 14:26 ` [PATCH 07/12] mingw: only enable the MSYS2-specific stuff when compiling in MSYS2 Johannes Schindelin via GitGitGadget
2026-08-05 14:26 ` [PATCH 08/12] mingw: rely on MSYS2's metadata instead of hard-coding it Johannes Schindelin via GitGitGadget
2026-08-05 17:29   ` Junio C Hamano [this message]
2026-08-06 12:50     ` Johannes Schindelin
2026-08-05 14:26 ` [PATCH 09/12] windows: skip linking `git-<command>` for built-ins Johannes Schindelin via GitGitGadget
2026-08-05 17:12   ` Junio C Hamano
2026-08-05 14:26 ` [PATCH 10/12] mingw: always define `ETC_*` for MSYS2 environments Johannes Schindelin via GitGitGadget
2026-08-05 14:26 ` [PATCH 11/12] mingw: ensure valid CTYPE Johannes Schindelin via GitGitGadget
2026-08-05 14:26 ` [PATCH 12/12] mingw: allow `git.exe` to be used instead of the "Git wrapper" Johannes Schindelin via GitGitGadget
2026-08-06 17:26   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq7bm4qxv6.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=johannes.schindelin@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox