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
This commit is contained in:
Junio C Hamano 2013-06-11 13:30:20 -07:00
commit e936318aa6
12 changed files with 15 additions and 27 deletions

View File

@ -297,10 +297,6 @@ all::
#
# Define NO_REGEX if you have no or inferior regex support in your C library.
#
# Define CYGWIN_V15_WIN32API if you are using Cygwin v1.7.x but are not
# using the current w32api packages. The recommended approach, however,
# is to update your installation if compilation errors occur.
#
# Define HAVE_DEV_TTY if your system can open /dev/tty to interact with the
# user.
#
@ -1476,9 +1472,6 @@ ifdef NO_REGEX
COMPAT_CFLAGS += -Icompat/regex
COMPAT_OBJS += compat/regex/regex.o
endif
ifdef CYGWIN_V15_WIN32API
COMPAT_CFLAGS += -DCYGWIN_V15_WIN32API
endif
ifdef USE_NED_ALLOCATOR
COMPAT_CFLAGS += -Icompat/nedmalloc

View File

@ -216,7 +216,7 @@ const char *absolute_path(const char *path)
const char *prefix_filename(const char *pfx, int pfx_len, const char *arg)
{
static char path[PATH_MAX];
#ifndef WIN32
#ifndef GIT_WINDOWS_NATIVE
if (!pfx_len || is_absolute_path(arg))
return arg;
memcpy(path, pfx, pfx_len);

View File

@ -1,14 +1,9 @@
#define CYGWIN_C
#define WIN32_LEAN_AND_MEAN
#ifdef CYGWIN_V15_WIN32API
#include "../git-compat-util.h"
#include "win32.h"
#else
#include <sys/stat.h>
#include <sys/errno.h>
#include "win32.h"
#include "../git-compat-util.h"
#endif
#include "../cache.h" /* to read configuration */
/*

View File

@ -3,7 +3,7 @@
#include "sigchain.h"
#include "strbuf.h"
#if defined(HAVE_DEV_TTY) || defined(WIN32)
#if defined(HAVE_DEV_TTY) || defined(GIT_WINDOWS_NATIVE)
static void restore_term(void);
@ -53,7 +53,7 @@ error:
return -1;
}
#elif defined(WIN32)
#elif defined(GIT_WINDOWS_NATIVE)
#define INPUT_PATH "CONIN$"
#define OUTPUT_PATH "CONOUT$"

View File

@ -2,7 +2,7 @@
#define WIN32_H
/* common Win32 functions for MinGW and Cygwin */
#ifndef WIN32 /* Not defined by Cygwin */
#ifndef GIT_WINDOWS_NATIVE /* Not defined for Cygwin */
#include <windows.h>
#endif

View File

@ -159,7 +159,6 @@ ifeq ($(uname_O),Cygwin)
NO_SYMLINK_HEAD = YesPlease
NO_IPV6 = YesPlease
OLD_ICONV = UnfortunatelyYes
CYGWIN_V15_WIN32API = YesPlease
endif
NO_THREAD_SAFE_PREAD = YesPlease
NEEDS_LIBICONV = YesPlease

View File

@ -45,7 +45,7 @@ static int get_mode(const char *path, int *mode)
if (!path || !strcmp(path, "/dev/null"))
*mode = 0;
#ifdef _WIN32
#ifdef GIT_WINDOWS_NATIVE
else if (!strcasecmp(path, "nul"))
*mode = 0;
#endif

View File

@ -85,13 +85,14 @@
#define _NETBSD_SOURCE 1
#define _SGI_SOURCE 1
#ifdef WIN32 /* Both MinGW and MSVC */
#if defined(WIN32) && !defined(__CYGWIN__) /* Both MinGW and MSVC */
# if defined (_MSC_VER)
# define _WIN32_WINNT 0x0502
# endif
#define WIN32_LEAN_AND_MEAN /* stops windows.h including winsock.h */
#include <winsock2.h>
#include <windows.h>
#define GIT_WINDOWS_NATIVE
#endif
#include <unistd.h>

2
help.c
View File

@ -107,7 +107,7 @@ static int is_executable(const char *name)
!S_ISREG(st.st_mode))
return 0;
#if defined(WIN32) || defined(__CYGWIN__)
#if defined(GIT_WINDOWS_NATIVE) || defined(__CYGWIN__)
#if defined(__CYGWIN__)
if ((st.st_mode & S_IXUSR) == 0)
#endif

View File

@ -72,7 +72,7 @@ static inline void close_pair(int fd[2])
close(fd[1]);
}
#ifndef WIN32
#ifndef GIT_WINDOWS_NATIVE
static inline void dup_devnull(int to)
{
int fd = open("/dev/null", O_RDWR);
@ -159,7 +159,7 @@ static const char **prepare_shell_cmd(const char **argv)
die("BUG: shell command is empty");
if (strcspn(argv[0], "|&;<>()$`\\\"' \t\n*?[#~=%") != strlen(argv[0])) {
#ifndef WIN32
#ifndef GIT_WINDOWS_NATIVE
nargv[nargc++] = SHELL_PATH;
#else
nargv[nargc++] = "sh";
@ -182,7 +182,7 @@ static const char **prepare_shell_cmd(const char **argv)
return nargv;
}
#ifndef WIN32
#ifndef GIT_WINDOWS_NATIVE
static int execv_shell_cmd(const char **argv)
{
const char **nargv = prepare_shell_cmd(argv);
@ -193,7 +193,7 @@ static int execv_shell_cmd(const char **argv)
}
#endif
#ifndef WIN32
#ifndef GIT_WINDOWS_NATIVE
static int child_err = 2;
static int child_notifier = -1;
@ -334,7 +334,7 @@ fail_pipe:
trace_argv_printf(cmd->argv, "trace: run_command:");
fflush(NULL);
#ifndef WIN32
#ifndef GIT_WINDOWS_NATIVE
{
int notify_pipe[2];
if (pipe(notify_pipe))

View File

@ -87,7 +87,7 @@ int main(int argc, char *argv[])
return -1;
}
#ifdef WIN32
#ifdef GIT_WINDOWS_NATIVE
if (!(sb.st_mode & S_IWUSR) &&
chmod(argv[i], sb.st_mode | S_IWUSR)) {
fprintf(stderr, "Could not make user-writable %s: %s",

View File

@ -24,7 +24,7 @@ int online_cpus(void)
long ncpus;
#endif
#ifdef _WIN32
#ifdef GIT_WINDOWS_NATIVE
SYSTEM_INFO info;
GetSystemInfo(&info);