Skip to content

Commit 8bcc0f2

Browse files
committed
config.mak.uname: support MSys2
Git for Windows lags a little bit behind with the 2.x releases because the Git for Windows developers wanted to let that big jump coincide with a well-needed overhaul of the context within which Git for Windows is developed. To understand why this is such a big issue, it needs to be noted that many parts of Git are not written in portable C, but instead relies on a POSIX shell and Perl to be available. Even in the portable C part, there is the ingrained notion that we can work with UTF-8 encoded strings. To support the scripts, Git for Windows has to ship a minimal POSIX emulation layer with Bash and Perl thrown in, and when the Git for Windows effort started originally, in August 2007, we settled on using MSys, a stripped down version of Cygwin. Consequently, the original name of the project was "msysGit" (which, sadly, caused a *lot* of confusion because few Windows users know about MSys, and even less care). To compile the C code of Git for Windows, we used MSys, too: it sports an additional version of the GNU C Compiler that targets the plain Win32 API (with a few convenience functions thrown in) instead of the POSIX emulation layer that would require the MSys runtime to run the compiled programs. That way, Git for Windows' executable(s) are really just Win32 programs. To discern executables requiring the POSIX emulation layer from the ones that do not, the latter are called MinGW (Minimal GNU for Windows) when the former are called MSys executables. This reliance on MSys incurred challenges, too, though: some of our changes to the MSys runtime -- necessary to support Git for Windows better -- were not accepted upstream, the MSys runtime was not developed further to support e.g. UTF-8 or 64-bit, and apart from not having a package management system until much later (when mingw-get was introduced), many packages provided by the MSys/MinGW project lag behind the respective source code versions, in particular Bash and OpenSSL. For a while, the Git for Windows project tried to remedy the situation by trying to build newer versions of those packages, but the situation quickly became untenable, especially with problems like the Heartbleed bug requiring swift action and Git for Windows contributors being scarce -- despite millions of downloads suggesting that there are many users. After a brief push in the direction of mingw-get, thanks to the long-time contributor and co-maintainer Sebastian Schuberth, it became clear that we need to look for alternatives. Happily, in the meantime the MSys2 project (https://msys2.github.io/) emerged, and was chosen to be the base of the Git for Windows 2.x. MSys2 is a rewrite of the spirit of MSys: it is again a stripped down version of Cygwin, but it is actively kept up-to-date with Cygwin's source code. Thereby, it already supports Unicode internally, and it also offers the 64-bit support that we yearned for since the beginning of the Git for Windows project. MSys2 also ported the Pacman package management system from Arch Linux and uses it heavily. This brings the same convenience to which Linux users are used to from `yum` or `apt-get`, and to which MacOSX users are used to from Homebrew or MacPorts, or BSD users from the Ports system, to MSys2: a simple `pacman -Syu` will update all installed packages to the newest versions currently available. MSys2 is also *very* active, typically providing package updates multiple times per week. It still required a two-month effort to bring everything to a state where Git's test suite passes, and a couple of patches await their submission to the respective upstream projects. Yet without MSys2, the modernization of Git for Windows would simply not have happened. This commit lays the ground work to supporting MSys2-based Git builds. Assisted-by: Waldek Maleska <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]> squash! config.mak.uname: support MSys2 Make sure that the nedmalloc patch is applied before.
1 parent 4ad4110 commit 8bcc0f2

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

config.mak.uname

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
516516
NO_POSIX_GOODIES = UnfortunatelyYes
517517
DEFAULT_HELP_FORMAT = html
518518
NO_D_INO_IN_DIRENT = YesPlease
519-
COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -D_USE_32BIT_TIME_T -DNOGDI -Icompat -Icompat/win32
519+
COMPAT_CFLAGS += -D_USE_32BIT_TIME_T -DNOGDI -Icompat -Icompat/win32
520520
COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
521521
COMPAT_OBJS += compat/mingw.o compat/winansi.o \
522522
compat/win32/pthread.o compat/win32/syslog.o \
@@ -539,9 +539,25 @@ ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
539539
INTERNAL_QSORT = YesPlease
540540
HAVE_LIBCHARSET_H = YesPlease
541541
NO_GETTEXT = YesPlease
542-
USE_LIBPCRE= YesPlease
542+
COMPAT_CLFAGS += -D__USE_MINGW_ACCESS
543543
else
544-
NO_CURL = YesPlease
544+
ifeq ($(shell expr "$(uname_R)" : '2\.'),2)
545+
# MSys2
546+
CC = gcc
547+
prefix = /mingw32
548+
COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0
549+
INSTALL = /bin/install
550+
NO_R_TO_GCC_LINKER = YesPlease
551+
INTERNAL_QSORT = YesPlease
552+
HAVE_LIBCHARSET_H = YesPlease
553+
NO_GETTEXT = YesPlease
554+
USE_LIBPCRE= YesPlease
555+
NO_CURL =
556+
USE_NED_ALLOCATOR = YesPlease
557+
else
558+
COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO
559+
NO_CURL = YesPlease
560+
endif
545561
endif
546562
endif
547563
ifeq ($(uname_S),QNX)

0 commit comments

Comments
 (0)