Skip to content

Commit 7a4383c

Browse files
committed
Merge branch 'rj/cygwin-msvc'
* rj/cygwin-msvc: MSVC: Add support for building with NO_MMAP Makefile: keep MSVC and Cygwin configuration separate
2 parents 8102453 + b1b9520 commit 7a4383c

File tree

4 files changed

+21
-16
lines changed

4 files changed

+21
-16
lines changed

Makefile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,12 @@ uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')
216216
uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not')
217217
uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not')
218218

219+
ifdef MSVC
220+
# avoid the MingW and Cygwin configuration sections
221+
uname_S := Windows
222+
uname_O := Windows
223+
endif
224+
219225
# CFLAGS and LDFLAGS are for the users to override from the command line.
220226

221227
CFLAGS = -g -O2 -Wall
@@ -900,7 +906,7 @@ ifeq ($(uname_S),HP-UX)
900906
NO_SYS_SELECT_H = YesPlease
901907
SNPRINTF_RETURNS_BOGUS = YesPlease
902908
endif
903-
ifdef MSVC
909+
ifeq ($(uname_S),Windows)
904910
GIT_VERSION := $(GIT_VERSION).MSVC
905911
pathsep = ;
906912
NO_PREAD = YesPlease
@@ -953,7 +959,7 @@ else
953959
BASIC_CFLAGS += -Zi -MTd
954960
endif
955961
X = .exe
956-
else
962+
endif
957963
ifneq (,$(findstring MINGW,$(uname_S)))
958964
pathsep = ;
959965
NO_PREAD = YesPlease
@@ -1003,7 +1009,6 @@ else
10031009
NO_PTHREADS = YesPlease
10041010
endif
10051011
endif
1006-
endif
10071012

10081013
-include config.mak.autogen
10091014
-include config.mak

compat/mingw.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,6 +1000,18 @@ int mingw_rename(const char *pold, const char *pnew)
10001000
return -1;
10011001
}
10021002

1003+
/*
1004+
* Note that this doesn't return the actual pagesize, but
1005+
* the allocation granularity. If future Windows specific git code
1006+
* needs the real getpagesize function, we need to find another solution.
1007+
*/
1008+
int mingw_getpagesize(void)
1009+
{
1010+
SYSTEM_INFO si;
1011+
GetSystemInfo(&si);
1012+
return si.dwAllocationGranularity;
1013+
}
1014+
10031015
struct passwd *getpwuid(int uid)
10041016
{
10051017
static char user_name[100];

compat/mingw.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ int mingw_connect(int sockfd, struct sockaddr *sa, size_t sz);
187187
int mingw_rename(const char*, const char*);
188188
#define rename mingw_rename
189189

190-
#ifdef USE_WIN32_MMAP
190+
#if defined(USE_WIN32_MMAP) || defined(_MSC_VER)
191191
int mingw_getpagesize(void);
192192
#define getpagesize mingw_getpagesize
193193
#endif

compat/win32mmap.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
11
#include "../git-compat-util.h"
22

3-
/*
4-
* Note that this doesn't return the actual pagesize, but
5-
* the allocation granularity. If future Windows specific git code
6-
* needs the real getpagesize function, we need to find another solution.
7-
*/
8-
int mingw_getpagesize(void)
9-
{
10-
SYSTEM_INFO si;
11-
GetSystemInfo(&si);
12-
return si.dwAllocationGranularity;
13-
}
14-
153
void *git_mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset)
164
{
175
HANDLE hmap;

0 commit comments

Comments
 (0)