Skip to content

Commit e936318

Browse files
committed
Merge branch 'rj/mingw-cygwin'
Update build for Cygwin 1.[57]. Torsten Bögershausen reports that this is fine with Cygwin 1.7 ($gmane/225824) so let's try moving it ahead. * rj/mingw-cygwin: cygwin: Remove the CYGWIN_V15_WIN32API build variable mingw: rename WIN32 cpp macro to GIT_WINDOWS_NATIVE
2 parents a62d73e + 83ff1da commit e936318

File tree

12 files changed

+15
-27
lines changed

12 files changed

+15
-27
lines changed

Makefile

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -297,10 +297,6 @@ all::
297297
#
298298
# Define NO_REGEX if you have no or inferior regex support in your C library.
299299
#
300-
# Define CYGWIN_V15_WIN32API if you are using Cygwin v1.7.x but are not
301-
# using the current w32api packages. The recommended approach, however,
302-
# is to update your installation if compilation errors occur.
303-
#
304300
# Define HAVE_DEV_TTY if your system can open /dev/tty to interact with the
305301
# user.
306302
#
@@ -1476,9 +1472,6 @@ ifdef NO_REGEX
14761472
COMPAT_CFLAGS += -Icompat/regex
14771473
COMPAT_OBJS += compat/regex/regex.o
14781474
endif
1479-
ifdef CYGWIN_V15_WIN32API
1480-
COMPAT_CFLAGS += -DCYGWIN_V15_WIN32API
1481-
endif
14821475

14831476
ifdef USE_NED_ALLOCATOR
14841477
COMPAT_CFLAGS += -Icompat/nedmalloc

abspath.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ const char *absolute_path(const char *path)
216216
const char *prefix_filename(const char *pfx, int pfx_len, const char *arg)
217217
{
218218
static char path[PATH_MAX];
219-
#ifndef WIN32
219+
#ifndef GIT_WINDOWS_NATIVE
220220
if (!pfx_len || is_absolute_path(arg))
221221
return arg;
222222
memcpy(path, pfx, pfx_len);

compat/cygwin.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
#define CYGWIN_C
22
#define WIN32_LEAN_AND_MEAN
3-
#ifdef CYGWIN_V15_WIN32API
4-
#include "../git-compat-util.h"
5-
#include "win32.h"
6-
#else
73
#include <sys/stat.h>
84
#include <sys/errno.h>
95
#include "win32.h"
106
#include "../git-compat-util.h"
11-
#endif
127
#include "../cache.h" /* to read configuration */
138

149
/*

compat/terminal.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include "sigchain.h"
44
#include "strbuf.h"
55

6-
#if defined(HAVE_DEV_TTY) || defined(WIN32)
6+
#if defined(HAVE_DEV_TTY) || defined(GIT_WINDOWS_NATIVE)
77

88
static void restore_term(void);
99

@@ -53,7 +53,7 @@ static int disable_echo(void)
5353
return -1;
5454
}
5555

56-
#elif defined(WIN32)
56+
#elif defined(GIT_WINDOWS_NATIVE)
5757

5858
#define INPUT_PATH "CONIN$"
5959
#define OUTPUT_PATH "CONOUT$"

compat/win32.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define WIN32_H
33

44
/* common Win32 functions for MinGW and Cygwin */
5-
#ifndef WIN32 /* Not defined by Cygwin */
5+
#ifndef GIT_WINDOWS_NATIVE/* Not defined for Cygwin */
66
#include <windows.h>
77
#endif
88

config.mak.uname

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ ifeq ($(uname_O),Cygwin)
159159
NO_SYMLINK_HEAD = YesPlease
160160
NO_IPV6 = YesPlease
161161
OLD_ICONV = UnfortunatelyYes
162-
CYGWIN_V15_WIN32API = YesPlease
163162
endif
164163
NO_THREAD_SAFE_PREAD = YesPlease
165164
NEEDS_LIBICONV = YesPlease

diff-no-index.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ static int get_mode(const char *path, int *mode)
4545

4646
if (!path || !strcmp(path, "/dev/null"))
4747
*mode = 0;
48-
#ifdef _WIN32
48+
#ifdef GIT_WINDOWS_NATIVE
4949
else if (!strcasecmp(path, "nul"))
5050
*mode = 0;
5151
#endif

git-compat-util.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,14 @@
8585
#define _NETBSD_SOURCE 1
8686
#define _SGI_SOURCE 1
8787

88-
#ifdef WIN32 /* Both MinGW and MSVC */
88+
#if defined(WIN32) && !defined(__CYGWIN__) /* Both MinGW and MSVC */
8989
# if defined (_MSC_VER)
9090
# define _WIN32_WINNT 0x0502
9191
# endif
9292
#define WIN32_LEAN_AND_MEAN /* stops windows.h including winsock.h */
9393
#include <winsock2.h>
9494
#include <windows.h>
95+
#define GIT_WINDOWS_NATIVE
9596
#endif
9697

9798
#include <unistd.h>

help.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ static int is_executable(const char *name)
107107
!S_ISREG(st.st_mode))
108108
return 0;
109109

110-
#if defined(WIN32) || defined(__CYGWIN__)
110+
#if defined(GIT_WINDOWS_NATIVE) || defined(__CYGWIN__)
111111
#if defined(__CYGWIN__)
112112
if ((st.st_mode & S_IXUSR) == 0)
113113
#endif

run-command.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ static inline void close_pair(int fd[2])
7272
close(fd[1]);
7373
}
7474

75-
#ifndef WIN32
75+
#ifndef GIT_WINDOWS_NATIVE
7676
static inline void dup_devnull(int to)
7777
{
7878
int fd = open("/dev/null", O_RDWR);
@@ -159,7 +159,7 @@ static const char **prepare_shell_cmd(const char **argv)
159159
die("BUG: shell command is empty");
160160

161161
if (strcspn(argv[0], "|&;<>()$`\\\"' \t\n*?[#~=%") != strlen(argv[0])) {
162-
#ifndef WIN32
162+
#ifndef GIT_WINDOWS_NATIVE
163163
nargv[nargc++] = SHELL_PATH;
164164
#else
165165
nargv[nargc++] = "sh";
@@ -182,7 +182,7 @@ static const char **prepare_shell_cmd(const char **argv)
182182
return nargv;
183183
}
184184

185-
#ifndef WIN32
185+
#ifndef GIT_WINDOWS_NATIVE
186186
static int execv_shell_cmd(const char **argv)
187187
{
188188
const char **nargv = prepare_shell_cmd(argv);
@@ -193,7 +193,7 @@ static int execv_shell_cmd(const char **argv)
193193
}
194194
#endif
195195

196-
#ifndef WIN32
196+
#ifndef GIT_WINDOWS_NATIVE
197197
static int child_err = 2;
198198
static int child_notifier = -1;
199199

@@ -334,7 +334,7 @@ int start_command(struct child_process *cmd)
334334
trace_argv_printf(cmd->argv, "trace: run_command:");
335335
fflush(NULL);
336336

337-
#ifndef WIN32
337+
#ifndef GIT_WINDOWS_NATIVE
338338
{
339339
int notify_pipe[2];
340340
if (pipe(notify_pipe))

0 commit comments

Comments
 (0)