This commit is contained in:
martell
2014-09-11 01:44:27 +01:00
parent 17219f1af4
commit 5ebec9ae13
16 changed files with 1201 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
From 3dd7eee7588b65e5fbea60469f4eee9eb771109c Mon Sep 17 00:00:00 2001
From: Ray Donnelly <mingw.android@gmail.com>
Date: Tue, 22 Jul 2014 00:58:19 +0100
Subject: [PATCH 01/15] Don't redefine _ReadWriteBarrier in malloc.c.h
---
compat/nedmalloc/malloc.c.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/compat/nedmalloc/malloc.c.h b/compat/nedmalloc/malloc.c.h
index f216a2a..6aeac26 100644
--- a/compat/nedmalloc/malloc.c.h
+++ b/compat/nedmalloc/malloc.c.h
@@ -1382,7 +1382,9 @@ LONG __cdecl _InterlockedExchange(LONG volatile *Target, LONG Value);
/*** Atomic operations ***/
#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) > 40100
- #define _ReadWriteBarrier() __sync_synchronize()
+ #if !defined(_ReadWriteBarrier)
+ #define _ReadWriteBarrier() __sync_synchronize()
+ #endif
#else
static __inline__ __attribute__((always_inline)) long __sync_lock_test_and_set(volatile long * const Target, const long Value)
{
--
2.0.1

View File

@@ -0,0 +1,32 @@
From 26ff7ec8dec78317563afa69f368820e8e5fefd0 Mon Sep 17 00:00:00 2001
From: Ray Donnelly <mingw.android@gmail.com>
Date: Tue, 22 Jul 2014 00:56:51 +0100
Subject: [PATCH 02/15] Undefine FORCEINLINE on MinGW-w64 in malloc.c.h
.. it contains extern and when combined with static leads to
'multiple storage classes in declaration specifiers'
---
compat/nedmalloc/malloc.c.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/compat/nedmalloc/malloc.c.h b/compat/nedmalloc/malloc.c.h
index 6aeac26..22f3496 100644
--- a/compat/nedmalloc/malloc.c.h
+++ b/compat/nedmalloc/malloc.c.h
@@ -720,6 +720,13 @@ struct mallinfo {
inlining are defined as macros, so these aren't used for them.
*/
+/* MinGW-w64 defines FORCEINLINE with extern, and when combined with
+ static, there's multiple storage classes in declaration specifiers.
+*/
+#if defined(__MINGW64_VERSION_MAJOR) && defined(FORCEINLINE)
+ #undef FORCEINLINE
+#endif
+
#ifndef FORCEINLINE
#if defined(__GNUC__)
#define FORCEINLINE __inline __attribute__ ((always_inline))
--
2.0.1

View File

@@ -0,0 +1,42 @@
From 48e52671ed63a1897b52e060334dc911d256050d Mon Sep 17 00:00:00 2001
From: Ray Donnelly <mingw.android@gmail.com>
Date: Tue, 22 Jul 2014 00:20:01 +0100
Subject: [PATCH 03/15] Fix BASIC_LDFLAGS and COMPAT_CFLAGS for 64bit MinGW-w64
---
config.mak.uname | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/config.mak.uname b/config.mak.uname
index bb4ddab..d5132bb 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -6,6 +6,7 @@ uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')
uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')
uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not')
uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not')
+CC_MACH := $(shell sh -c '$(CC) -dumpmachine 2>/dev/null || echo not')
ifdef MSVC
# avoid the MingW and Cygwin configuration sections
@@ -497,12 +498,15 @@ ifneq (,$(findstring MINGW,$(uname_S)))
NO_POSIX_GOODIES = UnfortunatelyYes
DEFAULT_HELP_FORMAT = html
NO_D_INO_IN_DIRENT = YesPlease
- COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -D_USE_32BIT_TIME_T -DNOGDI -Icompat -Icompat/win32
+ COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat -Icompat/win32
+ ifneq (,$(findstring i686,$(CC_MACH)))
+ COMPAT_CFLAGS += -D_USE_32BIT_TIME_T
+ BASIC_LDFLAGS += -Wl,--large-address-aware
+ endif
COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
COMPAT_OBJS += compat/mingw.o compat/winansi.o \
compat/win32/pthread.o compat/win32/syslog.o \
compat/win32/dirent.o compat/win32/fscache.o
- BASIC_LDFLAGS += -Wl,--large-address-aware
EXTLIBS += -lws2_32
GITLIBS += git.res
PTHREAD_LIBS =
--
2.0.1

View File

@@ -0,0 +1,72 @@
From 5d667f96df35b16a217d901384d238aaca540165 Mon Sep 17 00:00:00 2001
From: Ray Donnelly <mingw.android@gmail.com>
Date: Mon, 21 Jul 2014 21:33:08 +0100
Subject: [PATCH 04/15] Also look in winsock2.h for sockaddr_storage and look
in ws2tcpip.h for socklen_t
---
aclocal.m4 | 7 ++++++-
configure.ac | 15 +++++++++++++++
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/aclocal.m4 b/aclocal.m4
index f11bc7e..91322f1 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -36,5 +36,10 @@ AC_DEFUN([TYPE_SOCKLEN_T],
AC_DEFINE_UNQUOTED(socklen_t, $git_cv_socklen_t_equiv,
[type to use in place of socklen_t if not defined])],
[#include <sys/types.h>
-#include <sys/socket.h>])
+ #ifdef HAVE_SYS_SOCKET_H
+ #include <sys/socket.h>
+ #endif
+ #ifdef HAVE_WS2TCPIP_H
+ #include <ws2tcpip.h>
+ #endif])
])
diff --git a/configure.ac b/configure.ac
index 5a3d531..752db3d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -382,6 +382,11 @@ AS_HELP_STRING([],[Tcl/Tk interpreter will be found in a system.]),
GIT_PARSE_WITH(tcltk))
#
+AC_LANG_PUSH([C])
+AC_CHECK_HEADERS([sys/socket.h])
+AC_CHECK_HEADERS([winsock2.h])
+AC_CHECK_HEADERS([ws2tcpip.h])
+AC_LANG_POP([C])
## Checks for programs.
AC_MSG_NOTICE([CHECKS for programs])
@@ -778,7 +783,12 @@ AC_CHECK_TYPE(struct sockaddr_storage,
[NO_SOCKADDR_STORAGE=],
[NO_SOCKADDR_STORAGE=YesPlease],[
#include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
+#endif
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif
])
GIT_CONF_SUBST([NO_SOCKADDR_STORAGE])
#
@@ -789,7 +799,12 @@ AC_CHECK_TYPE([struct addrinfo],[
[NO_IPV6=YesPlease])
],[NO_IPV6=YesPlease],[
#include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
+#endif
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif
#include <netdb.h>
])
GIT_CONF_SUBST([NO_IPV6])
--
2.0.1

View File

@@ -0,0 +1,53 @@
From 9dba7d3853bd8e273fcf58e0c6047931785d75a9 Mon Sep 17 00:00:00 2001
From: Ray Donnelly <mingw.android@gmail.com>
Date: Mon, 21 Jul 2014 23:39:44 +0100
Subject: [PATCH 05/15] Don't redefine some things MinGW-w64 provides
off64_t, _lseeki64, _CONSOLE_FONT_INFOEX
and (probably incorrectly, unsetenv)
---
compat/mingw.h | 4 ++++
compat/winansi.c | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/compat/mingw.h b/compat/mingw.h
index 9dbba85..2dd1279 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -212,7 +212,9 @@ char *mingw_getenv(const char *name);
#define getenv mingw_getenv
int mingw_putenv(const char *namevalue);
#define putenv mingw_putenv
+#ifndef __MINGW64_VERSION_MAJOR
#define unsetenv mingw_putenv
+#endif
int mingw_gethostname(char *host, int namelen);
#define gethostname mingw_gethostname
@@ -296,8 +298,10 @@ static inline time_t filetime_to_time_t(const FILETIME *ft)
/*
* Use mingw specific stat()/lstat()/fstat() implementations on Windows.
*/
+#ifndef __MINGW64_VERSION_MAJOR
#define off_t off64_t
#define lseek _lseeki64
+#endif
/* use struct stat with 64 bit st_size */
#ifdef stat
diff --git a/compat/winansi.c b/compat/winansi.c
index 13bc28d..5682af1 100644
--- a/compat/winansi.c
+++ b/compat/winansi.c
@@ -23,7 +23,7 @@ static HANDLE hthread, hread, hwrite;
static HANDLE hwrite1 = INVALID_HANDLE_VALUE, hwrite2 = INVALID_HANDLE_VALUE;
static HANDLE hconsole1, hconsole2;
-#ifdef __MINGW32__
+#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)
typedef struct _CONSOLE_FONT_INFOEX {
ULONG cbSize;
DWORD nFont;
--
2.0.1

View File

@@ -0,0 +1,27 @@
From a7ba6c2d6478c30dc89d2bbb8e5afd9fdc0b5d5a Mon Sep 17 00:00:00 2001
From: Ray Donnelly <mingw.android@gmail.com>
Date: Mon, 21 Jul 2014 23:52:34 +0100
Subject: [PATCH 06/15] Include ntdef.h on MinGW-w64 for REPARSE_DATA_BUFFER
---
compat/mingw.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/compat/mingw.c b/compat/mingw.c
index 69f3c39..69ea532 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -7,6 +7,10 @@
#include "../run-command.h"
#include "../cache.h"
+#ifdef __MINGW64_VERSION_MAJOR
+#include <ntdef.h>
+#endif
+
static const int delay[] = { 0, 1, 10, 20, 40 };
unsigned int _CRT_fmode = _O_BINARY;
--
2.0.1

View File

@@ -0,0 +1,27 @@
From aa45dfb88ff50ac8117060e5a27037eba3cbb58b Mon Sep 17 00:00:00 2001
From: Ray Donnelly <mingw.android@gmail.com>
Date: Tue, 22 Jul 2014 00:29:15 +0100
Subject: [PATCH 07/15] Include winsock2.h and not netdb.h on MinGW-w64
---
compat/hstrerror.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/compat/hstrerror.c b/compat/hstrerror.c
index 069c555..d37ad25 100644
--- a/compat/hstrerror.c
+++ b/compat/hstrerror.c
@@ -1,6 +1,10 @@
#include <string.h>
#include <stdio.h>
+#ifdef __MINGW64_VERSION_MAJOR
+#include <winsock2.h>
+#else
#include <netdb.h>
+#endif
const char *githstrerror(int err)
{
--
2.0.1

View File

@@ -0,0 +1,33 @@
From 0ff43214bcc835dc089a866685852ae0e4faf37f Mon Sep 17 00:00:00 2001
From: martell <martellmalone@gmail.com>
Date: Mon, 21 Jul 2014 21:10:25 +0100
Subject: [PATCH 08/15] fix mingw64 compat wide char
---
compat/mingw.h | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/compat/mingw.h b/compat/mingw.h
index 2dd1279..1b07f17 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -1,14 +1,13 @@
+#include <stdint.h>
+#include <wchar.h>
#include <winsock2.h>
#include <ws2tcpip.h>
-
/*
* things that are not available in header files
*/
-typedef int pid_t;
typedef int uid_t;
typedef int socklen_t;
-#define hstrerror strerror
#define S_IFLNK 0120000 /* Symbolic link */
#define S_ISLNK(x) (((x) & S_IFMT) == S_IFLNK)
--
2.0.1

View File

@@ -0,0 +1,27 @@
From c1fd988200845617cabbdcdfbc99ef3e0db57bca Mon Sep 17 00:00:00 2001
From: martell <martellmalone@gmail.com>
Date: Mon, 21 Jul 2014 21:11:03 +0100
Subject: [PATCH 09/15] fix fork for mingw64
---
compat/mingw.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/compat/mingw.h b/compat/mingw.h
index 1b07f17..1f9b4ef 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -85,8 +85,8 @@ struct itimerval {
static inline int fchmod(int fildes, mode_t mode)
{ errno = ENOSYS; return -1; }
-static inline pid_t fork(void)
-{ errno = ENOSYS; return -1; }
+//static inline pid_t fork(void)
+//{ errno = ENOSYS; return -1; }
static inline unsigned int alarm(unsigned int seconds)
{ return 0; }
static inline int fsync(int fd)
--
2.0.1

View File

@@ -0,0 +1,182 @@
From 9be43f639705a55cd82b893e96d323d4690e4395 Mon Sep 17 00:00:00 2001
From: Ray Donnelly <mingw.android@gmail.com>
Date: Wed, 23 Jul 2014 20:31:15 +0100
Subject: [PATCH 10/15] Use GIT_CHECK_FUNC for socket and basename
.. and look in c, socket, ws2_32 and c, gen respectively.
---
Makefile | 13 ++++++-------
config.mak.uname | 19 ++++++++++---------
configure.ac | 20 ++++++++------------
3 files changed, 24 insertions(+), 28 deletions(-)
diff --git a/Makefile b/Makefile
index 203945d..bf2e8ea 100644
--- a/Makefile
+++ b/Makefile
@@ -106,7 +106,7 @@ all::
#
# Define NO_LIBGEN_H if you don't have libgen.h.
#
-# Define NEEDS_LIBGEN if your libgen needs -lgen when linking
+# Define BASENAME_LIB to the LIB flag for linking the library containing basename.
#
# Define NO_SYS_SELECT_H if you don't have sys/select.h.
#
@@ -155,8 +155,7 @@ all::
#
# Define NO_UINTMAX_T if you don't have uintmax_t.
#
-# Define NEEDS_SOCKET if linking with libc is not enough (SunOS,
-# Patrick Mauritz).
+# Define SOCKET_LIB to the LIB flag for linking the library containing socket.
#
# Define NEEDS_RESOLV if linking with -lnsl and/or -lsocket is not enough.
# Notably on Solaris hstrerror resides in libresolv and on Solaris 7
@@ -1202,16 +1201,16 @@ ifdef NEEDS_LIBICONV
endif
EXTLIBS += $(ICONV_LINK) -liconv
endif
-ifdef NEEDS_LIBGEN
- EXTLIBS += -lgen
+ifdef BASENAME_LIB
+ EXTLIBS += $(BASENAME_LIB)
endif
ifndef NO_GETTEXT
ifndef LIBC_CONTAINS_LIBINTL
EXTLIBS += -lintl
endif
endif
-ifdef NEEDS_SOCKET
- EXTLIBS += -lsocket
+ifdef SOCKET_LIB
+ EXTLIBS += $(SOCKET_LIB)
endif
ifdef NEEDS_NSL
EXTLIBS += -lnsl
diff --git a/config.mak.uname b/config.mak.uname
index d5132bb..76f3ca5 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -44,7 +44,7 @@
endif
ifeq ($(uname_S),UnixWare)
CC = cc
- NEEDS_SOCKET = YesPlease
+ SOCKET_LIB = -lsocket
NEEDS_NSL = YesPlease
NEEDS_SSL_WITH_CRYPTO = YesPlease
NEEDS_LIBICONV = YesPlease
@@ -68,7 +68,7 @@
CC = cc
BASIC_CFLAGS += -Kthread
endif
- NEEDS_SOCKET = YesPlease
+ SOCKET_LIB = -lsocket
NEEDS_NSL = YesPlease
NEEDS_SSL_WITH_CRYPTO = YesPlease
NEEDS_LIBICONV = YesPlease
@@ -100,7 +100,7 @@
BASIC_CFLAGS += -DPRECOMPOSE_UNICODE
endif
ifeq ($(uname_S),SunOS)
- NEEDS_SOCKET = YesPlease
+ SOCKET_LIB = -lsocket
NEEDS_NSL = YesPlease
SHELL_PATH = /bin/bash
SANE_TOOL_PATH = /usr/xpg6/bin:/usr/xpg4/bin
@@ -264,7 +264,7 @@
NO_FNMATCH_CASEFOLD = YesPlease
SNPRINTF_RETURNS_BOGUS = YesPlease
SHELL_PATH = /usr/gnu/bin/bash
- NEEDS_LIBGEN = YesPlease
+ BASENAME_LIB = -lgen
endif
ifeq ($(uname_S),IRIX64)
NO_SETENV = YesPlease
@@ -284,7 +284,7 @@
NO_FNMATCH_CASEFOLD = YesPlease
SNPRINTF_RETURNS_BOGUS = YesPlease
SHELL_PATH = /usr/gnu/bin/bash
- NEEDS_LIBGEN = YesPlease
+ BASENAME_LIB = -lgen
endif
ifeq ($(uname_S),HP-UX)
INLINE = __inline
@@ -404,7 +404,7 @@
NO_IPV6 = YesPlease
NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
NO_NSEC = YesPlease
- NEEDS_LIBGEN =
+ BASENAME_LIB =
NEEDS_CRYPTO_WITH_SSL = YesPlease
NEEDS_IDN_WITH_CURL = YesPlease
NEEDS_SSL_WITH_CURL = YesPlease
@@ -518,7 +518,7 @@
COMPAT_OBJS += compat/mingw.o compat/winansi.o \
compat/win32/pthread.o compat/win32/syslog.o \
compat/win32/dirent.o compat/win32/fscache.o
- EXTLIBS += -lws2_32
+ SOCKET_LIB = -lws2_32
GITLIBS += git.res
PTHREAD_LIBS =
RC = windres -O coff
@@ -535,14 +535,15 @@
HAVE_LIBCHARSET_H = YesPlease
NO_GETTEXT = YesPlease
else
- NO_CURL = YesPlease
+ # MinGW-w64 then?
+ EXTLIBS += -lz -lcurl
endif
endif
ifeq ($(uname_S),QNX)
COMPAT_CFLAGS += -DSA_RESTART=0
EXPAT_NEEDS_XMLPARSE_H = YesPlease
HAVE_STRINGS_H = YesPlease
- NEEDS_SOCKET = YesPlease
+ SOCKET_LIB = -lsocket
NO_FNMATCH_CASEFOLD = YesPlease
NO_GETPAGESIZE = YesPlease
NO_ICONV = YesPlease
diff --git a/configure.ac b/configure.ac
index 752db3d..9c75131 100644
--- a/configure.ac
+++ b/configure.ac
@@ -622,13 +622,11 @@ GIT_UNSTASH_FLAGS($ZLIB_PATH)
GIT_CONF_SUBST([NO_DEFLATE_BOUND])
#
-# Define NEEDS_SOCKET if linking with libc is not enough (SunOS,
-# Patrick Mauritz).
-AC_CHECK_LIB([c], [socket],
-[NEEDS_SOCKET=],
-[NEEDS_SOCKET=YesPlease])
-GIT_CONF_SUBST([NEEDS_SOCKET])
-test -n "$NEEDS_SOCKET" && LIBS="$LIBS -lsocket"
+# Find the library needed for
+# the socket function.
+GIT_CHECK_FUNC([socket], [c socket ws2_32],
+[SOCKET_LIB=],
+[SOCKET_LIB=$ac_cv_search_socket])
#
# The next few tests will define NEEDS_RESOLV if linking with
@@ -677,11 +675,9 @@ GIT_CONF_SUBST([NEEDS_RESOLV])
# build-time, also set it here for remaining configure-time checks.
test -n "$NEEDS_RESOLV" && LIBS="$LIBS -lresolv"
-AC_CHECK_LIB([c], [basename],
-[NEEDS_LIBGEN=],
-[NEEDS_LIBGEN=YesPlease])
-GIT_CONF_SUBST([NEEDS_LIBGEN])
-test -n "$NEEDS_LIBGEN" && LIBS="$LIBS -lgen"
+GIT_CHECK_FUNC([basename], [c gen],
+[BASENAME_LIB=],
+[BASENAME_LIB=$ac_cv_search_basename])
AC_CHECK_LIB([c], [gettext],
[LIBC_CONTAINS_LIBINTL=YesPlease],
--
2.0.1

View File

@@ -0,0 +1,65 @@
From 5148c72c231ae0a2c96c6dc0ee591abaad3c0d90 Mon Sep 17 00:00:00 2001
From: Ray Donnelly <mingw.android@gmail.com>
Date: Wed, 23 Jul 2014 22:06:44 +0100
Subject: [PATCH 11/15] Use GIT_CHECK_FUNC for regcomp (regex)
---
Makefile | 3 +++
config.mak.uname | 3 ---
configure.ac | 12 +++++++-----
3 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/Makefile b/Makefile
index bf2e8ea..1c5d360 100644
--- a/Makefile
+++ b/Makefile
@@ -1471,6 +1471,9 @@ ifdef NO_REGEX
COMPAT_CFLAGS += -Icompat/regex
COMPAT_OBJS += compat/regex/regex.o
endif
+ifdef REGEX_LIB
+ EXTLIBS += $(REGEX_LIB)
+endif
ifdef NATIVE_CRLF
BASIC_CFLAGS += -DNATIVE_CRLF
endif
diff --git a/config.mak.uname b/config.mak.uname
index 76f3ca5..cef8974 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -523,9 +523,6 @@ ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
INTERNAL_QSORT = YesPlease
HAVE_LIBCHARSET_H = YesPlease
NO_GETTEXT = YesPlease
-else
- # MinGW-w64 then?
- EXTLIBS += -lz -lcurl
endif
endif
ifeq ($(uname_S),QNX)
diff --git a/configure.ac b/configure.ac
index 9c75131..2c88c92 100644
--- a/configure.ac
+++ b/configure.ac
@@ -819,11 +819,13 @@ yippeeyeswehaveit
[ac_cv_c_excellent_regex=yes],
[ac_cv_c_excellent_regex=no])
])
-if test $ac_cv_c_excellent_regex = yes; then
- NO_REGEX=
-else
- NO_REGEX=YesPlease
-fi
+AS_IF([test "x$ac_cv_c_excellent_regex" = "xyes"],
+ [GIT_CHECK_FUNC([regcomp], [regex gnurx],
+ [REGEX_LIB=],
+ [REGEX_LIB=$ac_cv_search_regcomp])]
+ NO_REGEX=],
+ [NO_REGEX=YesPlease])
+GIT_CONF_SUBST([REGEX_LIB])
GIT_CONF_SUBST([NO_REGEX])
#
# Define FREAD_READS_DIRECTORIES if your are on a system which succeeds
--
2.0.1

View File

@@ -0,0 +1,109 @@
From d6ec653a8e04e9303458d3c8021b665090a9334e Mon Sep 17 00:00:00 2001
From: Ray Donnelly <mingw.android@gmail.com>
Date: Wed, 23 Jul 2014 22:46:32 +0100
Subject: [PATCH 12/15] Use system dirent.h on MinGW-w64
.. and rename the mingw one to dirent-mingw.h
---
compat/win32/dirent-mingw.h | 32 ++++++++++++++++++++++++++++++++
compat/win32/dirent.h | 32 --------------------------------
git-compat-util.h | 4 ++++
3 files changed, 36 insertions(+), 32 deletions(-)
create mode 100644 compat/win32/dirent-mingw.h
delete mode 100644 compat/win32/dirent.h
diff --git a/compat/win32/dirent-mingw.h b/compat/win32/dirent-mingw.h
new file mode 100644
index 0000000..6b3ddee
--- /dev/null
+++ b/compat/win32/dirent-mingw.h
@@ -0,0 +1,32 @@
+#ifndef DIRENT_H
+#define DIRENT_H
+
+#define DT_UNKNOWN 0
+#define DT_DIR 1
+#define DT_REG 2
+#define DT_LNK 3
+
+struct dirent {
+ unsigned char d_type; /* file type to prevent lstat after readdir */
+ char *d_name; /* file name */
+};
+
+/*
+ * Base DIR structure, contains pointers to readdir/closedir implementations so
+ * that opendir may choose a concrete implementation on a call-by-call basis.
+ */
+typedef struct DIR {
+ struct dirent *(*preaddir)(struct DIR *dir);
+ int (*pclosedir)(struct DIR *dir);
+} DIR;
+
+/* default dirent implementation */
+extern DIR *dirent_opendir(const char *dirname);
+
+/* current dirent implementation */
+extern DIR *(*opendir)(const char *dirname);
+
+#define readdir(dir) (dir->preaddir(dir))
+#define closedir(dir) (dir->pclosedir(dir))
+
+#endif /* DIRENT_H */
diff --git a/compat/win32/dirent.h b/compat/win32/dirent.h
deleted file mode 100644
index 6b3ddee..0000000
--- a/compat/win32/dirent.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef DIRENT_H
-#define DIRENT_H
-
-#define DT_UNKNOWN 0
-#define DT_DIR 1
-#define DT_REG 2
-#define DT_LNK 3
-
-struct dirent {
- unsigned char d_type; /* file type to prevent lstat after readdir */
- char *d_name; /* file name */
-};
-
-/*
- * Base DIR structure, contains pointers to readdir/closedir implementations so
- * that opendir may choose a concrete implementation on a call-by-call basis.
- */
-typedef struct DIR {
- struct dirent *(*preaddir)(struct DIR *dir);
- int (*pclosedir)(struct DIR *dir);
-} DIR;
-
-/* default dirent implementation */
-extern DIR *dirent_opendir(const char *dirname);
-
-/* current dirent implementation */
-extern DIR *(*opendir)(const char *dirname);
-
-#define readdir(dir) (dir->preaddir(dir))
-#define closedir(dir) (dir->pclosedir(dir))
-
-#endif /* DIRENT_H */
diff --git a/git-compat-util.h b/git-compat-util.h
index e0f258c..7a238fe 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -122,7 +122,11 @@ enum git_target_type {
#include <sys/param.h>
#endif
#include <sys/types.h>
+#ifdef __MINGW64_VERSION_MAJOR
#include <dirent.h>
+#else
+#include <dirent-mingw.h>
+#endif
#include <sys/time.h>
#include <time.h>
#include <signal.h>
--
2.0.1

View File

@@ -0,0 +1,266 @@
From b551d6199014c99982e121f4948bf1db7147ca1d Mon Sep 17 00:00:00 2001
From: martell <martellmalone@gmail.com>
Date: Thu, 24 Jul 2014 01:29:13 +0100
Subject: [PATCH 13/15] Remove custom pthread layer
---
compat/mingw.c | 5 +++
compat/win32/pthread-mingw.h | 104 +++++++++++++++++++++++++++++++++++++++++++
compat/win32/pthread.h | 104 -------------------------------------------
config.mak.uname | 2 +-
4 files changed, 110 insertions(+), 105 deletions(-)
create mode 100644 compat/win32/pthread-mingw.h
delete mode 100644 compat/win32/pthread.h
diff --git a/compat/mingw.c b/compat/mingw.c
index 69ea532..d21fc56 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -1074,6 +1074,11 @@ int pipe(int filedes[2])
return 0;
}
+#ifdef __MINGW64_VERSION_MAJOR
+#undef gmtime_r
+#undef localtime_r
+#endif
+
struct tm *gmtime_r(const time_t *timep, struct tm *result)
{
/* gmtime() in MSVCRT.DLL is thread-safe, but not reentrant */
diff --git a/compat/win32/pthread-mingw.h b/compat/win32/pthread-mingw.h
new file mode 100644
index 0000000..8ad1873
--- /dev/null
+++ b/compat/win32/pthread-mingw.h
@@ -0,0 +1,104 @@
+/*
+ * Header used to adapt pthread-based POSIX code to Windows API threads.
+ *
+ * Copyright (C) 2009 Andrzej K. Haczewski <ahaczewski@gmail.com>
+ */
+
+#ifndef PTHREAD_H
+#define PTHREAD_H
+
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
+
+#include <windows.h>
+
+/*
+ * Defines that adapt Windows API threads to pthreads API
+ */
+#define pthread_mutex_t CRITICAL_SECTION
+
+#define pthread_mutex_init(a,b) (InitializeCriticalSection((a)), 0)
+#define pthread_mutex_destroy(a) DeleteCriticalSection((a))
+#define pthread_mutex_lock EnterCriticalSection
+#define pthread_mutex_unlock LeaveCriticalSection
+
+typedef int pthread_mutexattr_t;
+#define pthread_mutexattr_init(a) (*(a) = 0)
+#define pthread_mutexattr_destroy(a) do {} while (0)
+#define pthread_mutexattr_settype(a, t) 0
+#define PTHREAD_MUTEX_RECURSIVE 0
+
+/*
+ * Implement simple condition variable for Windows threads, based on ACE
+ * implementation.
+ *
+ * See original implementation: http://bit.ly/1vkDjo
+ * ACE homepage: http://www.cse.wustl.edu/~schmidt/ACE.html
+ * See also: http://www.cse.wustl.edu/~schmidt/win32-cv-1.html
+ */
+typedef struct {
+ LONG waiters;
+ int was_broadcast;
+ CRITICAL_SECTION waiters_lock;
+ HANDLE sema;
+ HANDLE continue_broadcast;
+} pthread_cond_t;
+
+extern int pthread_cond_init(pthread_cond_t *cond, const void *unused);
+extern int pthread_cond_destroy(pthread_cond_t *cond);
+extern int pthread_cond_wait(pthread_cond_t *cond, CRITICAL_SECTION *mutex);
+extern int pthread_cond_signal(pthread_cond_t *cond);
+extern int pthread_cond_broadcast(pthread_cond_t *cond);
+
+/*
+ * Simple thread creation implementation using pthread API
+ */
+typedef struct {
+ HANDLE handle;
+ void *(*start_routine)(void*);
+ void *arg;
+ DWORD tid;
+} pthread_t;
+
+extern int pthread_create(pthread_t *thread, const void *unused,
+ void *(*start_routine)(void*), void *arg);
+
+/*
+ * To avoid the need of copying a struct, we use small macro wrapper to pass
+ * pointer to win32_pthread_join instead.
+ */
+#define pthread_join(a, b) win32_pthread_join(&(a), (b))
+
+extern int win32_pthread_join(pthread_t *thread, void **value_ptr);
+
+#define pthread_equal(t1, t2) ((t1).tid == (t2).tid)
+extern pthread_t pthread_self(void);
+
+static inline int pthread_exit(void *ret)
+{
+ ExitThread((DWORD)ret);
+}
+
+typedef DWORD pthread_key_t;
+static inline int pthread_key_create(pthread_key_t *keyp, void (*destructor)(void *value))
+{
+ return (*keyp = TlsAlloc()) == TLS_OUT_OF_INDEXES ? EAGAIN : 0;
+}
+
+static inline int pthread_key_delete(pthread_key_t key)
+{
+ return TlsFree(key) ? 0 : EINVAL;
+}
+
+static inline int pthread_setspecific(pthread_key_t key, const void *value)
+{
+ return TlsSetValue(key, (void *)value) ? 0 : EINVAL;
+}
+
+static inline void *pthread_getspecific(pthread_key_t key)
+{
+ return TlsGetValue(key);
+}
+
+#endif /* PTHREAD_H */
diff --git a/compat/win32/pthread.h b/compat/win32/pthread.h
deleted file mode 100644
index 8ad1873..0000000
--- a/compat/win32/pthread.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Header used to adapt pthread-based POSIX code to Windows API threads.
- *
- * Copyright (C) 2009 Andrzej K. Haczewski <ahaczewski@gmail.com>
- */
-
-#ifndef PTHREAD_H
-#define PTHREAD_H
-
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
-
-#include <windows.h>
-
-/*
- * Defines that adapt Windows API threads to pthreads API
- */
-#define pthread_mutex_t CRITICAL_SECTION
-
-#define pthread_mutex_init(a,b) (InitializeCriticalSection((a)), 0)
-#define pthread_mutex_destroy(a) DeleteCriticalSection((a))
-#define pthread_mutex_lock EnterCriticalSection
-#define pthread_mutex_unlock LeaveCriticalSection
-
-typedef int pthread_mutexattr_t;
-#define pthread_mutexattr_init(a) (*(a) = 0)
-#define pthread_mutexattr_destroy(a) do {} while (0)
-#define pthread_mutexattr_settype(a, t) 0
-#define PTHREAD_MUTEX_RECURSIVE 0
-
-/*
- * Implement simple condition variable for Windows threads, based on ACE
- * implementation.
- *
- * See original implementation: http://bit.ly/1vkDjo
- * ACE homepage: http://www.cse.wustl.edu/~schmidt/ACE.html
- * See also: http://www.cse.wustl.edu/~schmidt/win32-cv-1.html
- */
-typedef struct {
- LONG waiters;
- int was_broadcast;
- CRITICAL_SECTION waiters_lock;
- HANDLE sema;
- HANDLE continue_broadcast;
-} pthread_cond_t;
-
-extern int pthread_cond_init(pthread_cond_t *cond, const void *unused);
-extern int pthread_cond_destroy(pthread_cond_t *cond);
-extern int pthread_cond_wait(pthread_cond_t *cond, CRITICAL_SECTION *mutex);
-extern int pthread_cond_signal(pthread_cond_t *cond);
-extern int pthread_cond_broadcast(pthread_cond_t *cond);
-
-/*
- * Simple thread creation implementation using pthread API
- */
-typedef struct {
- HANDLE handle;
- void *(*start_routine)(void*);
- void *arg;
- DWORD tid;
-} pthread_t;
-
-extern int pthread_create(pthread_t *thread, const void *unused,
- void *(*start_routine)(void*), void *arg);
-
-/*
- * To avoid the need of copying a struct, we use small macro wrapper to pass
- * pointer to win32_pthread_join instead.
- */
-#define pthread_join(a, b) win32_pthread_join(&(a), (b))
-
-extern int win32_pthread_join(pthread_t *thread, void **value_ptr);
-
-#define pthread_equal(t1, t2) ((t1).tid == (t2).tid)
-extern pthread_t pthread_self(void);
-
-static inline int pthread_exit(void *ret)
-{
- ExitThread((DWORD)ret);
-}
-
-typedef DWORD pthread_key_t;
-static inline int pthread_key_create(pthread_key_t *keyp, void (*destructor)(void *value))
-{
- return (*keyp = TlsAlloc()) == TLS_OUT_OF_INDEXES ? EAGAIN : 0;
-}
-
-static inline int pthread_key_delete(pthread_key_t key)
-{
- return TlsFree(key) ? 0 : EINVAL;
-}
-
-static inline int pthread_setspecific(pthread_key_t key, const void *value)
-{
- return TlsSetValue(key, (void *)value) ? 0 : EINVAL;
-}
-
-static inline void *pthread_getspecific(pthread_key_t key)
-{
- return TlsGetValue(key);
-}
-
-#endif /* PTHREAD_H */
diff --git a/config.mak.uname b/config.mak.uname
index cef8974..acd4f19 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -505,7 +505,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
endif
COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
COMPAT_OBJS += compat/mingw.o compat/winansi.o \
- compat/win32/pthread.o compat/win32/syslog.o \
+ compat/win32/syslog.o \
compat/win32/dirent.o compat/win32/fscache.o
SOCKET_LIB = -lws2_32
GITLIBS += git.res
--
2.0.1

View File

@@ -0,0 +1,26 @@
From 1d95b331707b4dc1b1353fd889b5b8f35159d262 Mon Sep 17 00:00:00 2001
From: martell <martellmalone@gmail.com>
Date: Thu, 24 Jul 2014 00:15:28 +0100
Subject: [PATCH 14/15] Do not compile dirent on mingw64
---
config.mak.uname | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/config.mak.uname b/config.mak.uname
index acd4f19..34e7797 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -505,8 +505,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
endif
COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
COMPAT_OBJS += compat/mingw.o compat/winansi.o \
- compat/win32/syslog.o \
- compat/win32/dirent.o compat/win32/fscache.o
+ compat/win32/syslog.o compat/win32/fscache.o
SOCKET_LIB = -lws2_32
GITLIBS += git.res
PTHREAD_LIBS =
--
2.0.1

View File

@@ -0,0 +1,107 @@
From 78b17b48cf4e4767c45cc1ce8728b9880dcb1349 Mon Sep 17 00:00:00 2001
From: martell <martellmalone@gmail.com>
Date: Thu, 24 Jul 2014 01:04:02 +0100
Subject: [PATCH 15/15] Alter fscache for mingw64
---
compat/win32/fscache.c | 26 +++++++++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)
diff --git a/compat/win32/fscache.c b/compat/win32/fscache.c
index da3bb2c..8a00bc2 100644
--- a/compat/win32/fscache.c
+++ b/compat/win32/fscache.c
@@ -317,6 +317,10 @@ static struct fsentry *fscache_get(struct fsentry *key)
*/
int fscache_enable(int enable)
{
+#ifdef __MINGW64_VERSION_MAJOR
+ lstat = mingw_lstat;
+ return 0;
+#else
int result;
if (!initialized) {
@@ -345,6 +349,7 @@ int fscache_enable(int enable)
LeaveCriticalSection(&mutex);
}
return result;
+#endif
}
/*
@@ -393,17 +398,22 @@ int fscache_lstat(const char *filename, struct stat *st)
return 0;
}
-typedef struct fscache_DIR {
+
+#ifndef __MINGW64_VERSION_MAJOR
+typedef struct {
struct DIR base_dir; /* extend base struct DIR */
struct fsentry *pfsentry;
struct dirent dirent;
} fscache_DIR;
-
+#endif
/*
* Readdir replacement.
*/
static struct dirent *fscache_readdir(DIR *base_dir)
{
+#ifdef __MINGW64_VERSION_MAJOR
+ return readdir(base_dir);
+#else
fscache_DIR *dir = (fscache_DIR*) base_dir;
struct fsentry *next = dir->pfsentry->next;
if (!next)
@@ -412,6 +422,7 @@ static struct dirent *fscache_readdir(DIR *base_dir)
dir->dirent.d_type = S_ISDIR(next->st_mode) ? DT_DIR : DT_REG;
dir->dirent.d_name = (char*) next->name;
return &(dir->dirent);
+#endif
}
/*
@@ -419,10 +430,14 @@ static struct dirent *fscache_readdir(DIR *base_dir)
*/
static int fscache_closedir(DIR *base_dir)
{
+#ifdef __MINGW64_VERSION_MAJOR
+ return closedir(base_dir);
+#else
fscache_DIR *dir = (fscache_DIR*) base_dir;
fsentry_release(dir->pfsentry);
free(dir);
return 0;
+#endif
}
/*
@@ -431,12 +446,16 @@ static int fscache_closedir(DIR *base_dir)
*/
DIR *fscache_opendir(const char *dirname)
{
+#ifdef __MINGW64_VERSION_MAJOR
+ return opendir(dirname);
+#else
+
struct fsentry key, *list;
fscache_DIR *dir;
int len;
if (!fscache_enabled(dirname))
- return dirent_opendir(dirname);
+ return dirent_opendir(dirname);
/* prepare name (strip trailing '/', replace '.') */
len = strlen(dirname);
@@ -456,4 +475,5 @@ DIR *fscache_opendir(const char *dirname)
dir->base_dir.pclosedir = fscache_closedir;
dir->pfsentry = list;
return (DIR*) dir;
+#endif
}
--
2.0.1

106
mingw-w64-git/PKGBUILD Normal file
View File

@@ -0,0 +1,106 @@
# Maintainer: Martell Malone <martellmalone@gmail.com>
_realname=git
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.9.4
pkgrel=1
pkgdesc="The fast distributed version control system (mingw-w64)"
arch=('any')
url="http://git-scm.com/"
license=('GPL2')
#makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
# "python2"
# "ca-certificates"
# )
depends=("${MINGW_PACKAGE_PREFIX}-libiconv" "${MINGW_PACKAGE_PREFIX}-tcl")
options=(!libtool strip staticlibs)
_sillyname=$pkgver.msysgit.1
source=("https://github.com/msysgit/git/archive/v$_sillyname.tar.gz"
"0001-Don-t-redefine-_ReadWriteBarrier-in-malloc.c.h.patch"
"0002-Undefine-FORCEINLINE-on-MinGW-w64-in-malloc.c.h.patch"
"0003-Fix-BASIC_LDFLAGS-and-COMPAT_CFLAGS-for-64bit-MinGW-.patch"
"0004-Also-look-in-winsock2.h-for-sockaddr_storage-and-loo.patch"
"0005-Don-t-redefine-some-things-MinGW-w64-provides.patch"
"0006-Include-ntdef.h-on-MinGW-w64-for-REPARSE_DATA_BUFFER.patch"
"0007-Include-winsock2.h-and-not-netdb.h-on-MinGW-w64.patch"
"0008-fix-mingw64-compat-wide-char.patch"
"0009-fix-fork-for-mingw64.patch"
"0010-Use-GIT_CHECK_FUNC-for-socket-and-basename.patch"
"0011-Use-GIT_CHECK_FUNC-for-regcomp-regex.patch"
"0012-Use-system-dirent.h-on-MinGW-w64.patch"
"0013-Remove-custom-pthread-layer.patch"
"0014-Do-not-compile-dirent-on-mingw64.patch"
"0015-Alter-fscache-for-mingw64.patch")
md5sums=('SKIP'
'cd1574d3529aac3f0c9f4194939ac23f'
'2383167c26c29fe7af9b3c73758a8b55'
'04f800e290884b8d4659f5ebdc9456ca'
'3e986d42aa12f0b54c59d02638aa4068'
'14ff828b1d7c771d2da2977dbb018f09'
'b2a58b49e186aa43758584b77a8b47e1'
'970e1ee0021779dd646a81536d42bcef'
'62b8a45fa280082bb73be75a82aa44c7'
'fd874a1c65f2e2040d486054e46d252c'
'43d160e878841cb5642683a060c39c1f'
'157fb4de7db3b3b53025c103780da2f2'
'1aacf732e02da4cb6604b4496ba24ff9'
'c6a4066fb670e95ed102b543e7d67c01'
'c594da89c1d029abdc2d85eb61fc6bea'
'185c2096bf376b056445d57d92dbe3a0')
prepare() {
export PYTHON_PATH='/usr/bin/python2'
cd "$srcdir/$_realname-$_sillyname"
patch -p1 < "${srcdir}"/0001-Don-t-redefine-_ReadWriteBarrier-in-malloc.c.h.patch
patch -p1 < "${srcdir}"/0002-Undefine-FORCEINLINE-on-MinGW-w64-in-malloc.c.h.patch
patch -p1 < "${srcdir}"/0003-Fix-BASIC_LDFLAGS-and-COMPAT_CFLAGS-for-64bit-MinGW-.patch
patch -p1 < "${srcdir}"/0004-Also-look-in-winsock2.h-for-sockaddr_storage-and-loo.patch
patch -p1 < "${srcdir}"/0005-Don-t-redefine-some-things-MinGW-w64-provides.patch
patch -p1 < "${srcdir}"/0006-Include-ntdef.h-on-MinGW-w64-for-REPARSE_DATA_BUFFER.patch
patch -p1 < "${srcdir}"/0007-Include-winsock2.h-and-not-netdb.h-on-MinGW-w64.patch
patch -p1 < "${srcdir}"/0008-fix-mingw64-compat-wide-char.patch
patch -p1 < "${srcdir}"/0009-fix-fork-for-mingw64.patch
patch -p1 < "${srcdir}"/0010-Use-GIT_CHECK_FUNC-for-socket-and-basename.patch
patch -p1 < "${srcdir}"/0011-Use-GIT_CHECK_FUNC-for-regcomp-regex.patch
patch -p1 < "${srcdir}"/0012-Use-system-dirent.h-on-MinGW-w64.patch
patch -p1 < "${srcdir}"/0013-Remove-custom-pthread-layer.patch
patch -p1 < "${srcdir}"/0014-Do-not-compile-dirent-on-mingw64.patch
patch -p1 < "${srcdir}"/0015-Alter-fscache-for-mingw64.patch
autoreconf -fi
}
build() {
export PYTHON_PATH='/usr/bin/python2'
cd "$srcdir/$_realname-$_sillyname"
./configure \
--build=${MINGW_CHOST} \
--host=${MINGW_CHOST} \
--prefix=${MINGW_PREFIX} \
--libexecdir=${MINGW_PREFIX}/lib \
--with-editor=vim \
--with-shell=/usr/bin/sh \
--htmldir=${MINGW_PREFIX}/share/doc/git/html \
--mandir=${MINGW_PREFIX}/share/man \
--with-curl=${MINGW_PREFIX}
make INSTALLDIRS=vendor -j1 all V=1
make -C contrib/subtree prefix=/usr all V=1
}
package() {
export PYTHON_PATH='/usr/bin/python2'
cd "$srcdir/$_realname-$_sillyname"
make INSTALLDIRS=vendor DESTDIR="$pkgdir" install
}