Re: [msysGit] [PATCH 07/14] Fix BASIC_LDFLAGS and COMPAT_CFLAGS for 64bit MinGW-w64

2014-10-14 Thread Marat Radchenko
On Thu, Oct 09, 2014 at 09:22:19PM +0200, Johannes Schindelin wrote:
 Hi,
 
 On Wed, 8 Oct 2014, Marat Radchenko wrote:
 
  +CC_MACH := $(shell sh -c '$(CC) -dumpmachine 2/dev/null || echo not')
 
 There is a rather huge problem with that. The latest mingw-w64 release,
 4.9.1, does not do what you expect here: while '.../mingw32/bin/gcc -m32
 -o 32.exe test.c' and '.../mingw32/bin/gcc -m64 -o 64.exe test.c' work
 fine, producing i686 and x86_64 executables respectively,
 '.../mingw32/bin/gcc -dumpmachine' prints i686-w64-mingw32 *always*, even
 when specifying the -m64 option.
 
 So unfortunately, the test introduced by this patch (intended to figure
 out whether the build targets i686, and skip a compiler and a linker
 option otherwise) is incorrect.

According to [1], it is by design. For now, I suggest using separate
gcc binaries for 32/64, without messing with -m32. Of course we can
fallback to `./configure` that will determine bitness by compiling something.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52096#c1
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 14/14] MINGW: config.mak.uname: auto-detect MinGW build from compiler

2014-10-09 Thread Marat Radchenko
On Thu, Oct 09, 2014 at 12:34:25AM -0700, Junio C Hamano wrote:
 No, and I do not quite see why you even need to look at -dumbmachine
 output when your goal is to make this command line
 
 $ make uname_O=MINGW uname_S=MINGW
 
 work sensibly.  Wouldn't it be more like a series of
 
   ifndef uname_O
 uname_O := $(shell uname -o)
   endif
 
 or something like that?

I don't want to tell `make` my system name several times. It should be
possible to infer system type from CC.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [msysGit] [PATCH v5] MinGW(-W64) compilation

2014-10-09 Thread Marat Radchenko
On Thu, Oct 09, 2014 at 12:11:01PM +0200, Johannes Schindelin wrote:
 I also added one patch I find highly convenient:
 
 https://github.com/dscho/git/commit/29749c7d7b4638c63369d6cf067f5d524d0092f9

There already were two attempts to this issue:

 1. http://www.spinics.net/lists/git/msg230028.html
 2. http://www.spinics.net/lists/git/msg229822.html

Neither of them was accepted to git.git. I doubt your one will be.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [msysGit] Re: [PATCH v4] MinGW(-W64) compilation

2014-10-08 Thread Marat Radchenko
On Wed, Oct 08, 2014 at 10:59:57AM +0200, Johannes Schindelin wrote:
 Hi Marat,
 
 On Wed, 8 Oct 2014, Marat Radchenko wrote:
 
 That's not what msysgit folks say (they say that msysgit is the
 development environment to build Git for Windows [*1*]).

Aaargh! msys != msysgit != Git for Windows SDK != Git for Windows != 
mingwGitDevEnv
and possibly != git-for-windows.

Oh, there's also mingw-w64-git from msys2 [1].

  I tested my patches by applying them to git.git/master and building
  inside msysgit.
 
 So the idea would be to rebase from git/git/master onto
 msysgit/git/master. Did you do that yet?

No, what for? Windows flavors of Git are already fragmented too much,
my patchset is deliberately targeted at Git upstream.

[1] https://github.com/Alexpux/MINGW-packages/tree/master/mingw-w64-git
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [msysGit] [PATCH v4] MinGW(-W64) compilation

2014-10-08 Thread Marat Radchenko
On Wed, Oct 08, 2014 at 11:40:17AM +0200, Johannes Schindelin wrote:
 To make it easier to review and substantially easier to work on this patch
 series with Git, I opened a pull request on GitHub:

   https://github.com/msysgit/git/pull/264


1. I fail to see how using a tool that doesn't send emails about review
   comments is *easier* than just sending emails.

2. Please, do not hijack patchset discussion by moving it from git@ ML to 
   GitHub comments.

3. And I repeat, my goal is to push this stuff in git.git,
   not in msysgit.git, not in git-for-windows.git, not in msys2.git, not in 
other
   4k+ forks on GitHub.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 06/14] MINGW: compat/winansi.c: do not redefine CONSOLE_FONT_INFOEX

2014-10-08 Thread Marat Radchenko
Unlike MinGW, MinGW-W64 has CONSOLE_FONT_INFOEX already properly defined
in wincon.h.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 compat/winansi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/compat/winansi.c b/compat/winansi.c
index efc5bb3..0ac3297 100644
--- a/compat/winansi.c
+++ b/compat/winansi.c
@@ -22,7 +22,7 @@ static int non_ascii_used = 0;
 static HANDLE hthread, hread, hwrite;
 static HANDLE hconsole1, hconsole2;
 
-#ifdef __MINGW32__
+#if defined(__MINGW32__)  !defined(__MINGW64_VERSION_MAJOR)
 typedef struct _CONSOLE_FONT_INFOEX {
ULONG cbSize;
DWORD nFont;
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 09/14] MINGW: config.mak.uname: reorganize MinGW settings

2014-10-08 Thread Marat Radchenko
HAVE_LIBCHARSET_H and NO_R_TO_GCC_LINKER are not specific to
msysGit, they're general MinGW settings.

Logic behind HAVE_LIBCHARSET_H: if user is on MinGW and has iconv,
we expect him to have libcharset.h. If user doesn't have iconv,
he has to explicitly say so via NO_ICONV=1 regardless of this
commit.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 config.mak.uname | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/config.mak.uname b/config.mak.uname
index c7aaa1c..f79c0e0 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -532,11 +532,11 @@ ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
prefix =
INSTALL = /bin/install
EXTLIBS += /mingw/lib/libz.a
-   NO_R_TO_GCC_LINKER = YesPlease
INTERNAL_QSORT = YesPlease
-   HAVE_LIBCHARSET_H = YesPlease
NO_GETTEXT = YesPlease
 endif
+   HAVE_LIBCHARSET_H = YesPlease
+   NO_R_TO_GCC_LINKER = YesPlease
 endif
 ifeq ($(uname_S),QNX)
COMPAT_CFLAGS += -DSA_RESTART=0
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 04/14] MINGW: do not fail at redefining pid_t on MinGW-W64

2014-10-08 Thread Marat Radchenko
pid_t is available in sys/types.h on both MinGW and MinGW-W64

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
Acked-by: Eric Faye-Lund kusmab...@gmail.com
---
 compat/mingw.h | 1 -
 compat/msvc.h  | 2 ++
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/compat/mingw.h b/compat/mingw.h
index 1ddd663..ba05044 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -5,7 +5,6 @@
  * things that are not available in header files
  */
 
-typedef int pid_t;
 typedef int uid_t;
 typedef int socklen_t;
 #define hstrerror strerror
diff --git a/compat/msvc.h b/compat/msvc.h
index 580bb55..a63d878 100644
--- a/compat/msvc.h
+++ b/compat/msvc.h
@@ -15,6 +15,8 @@
 #define strtoull _strtoui64
 #define strtoll  _strtoi64
 
+typedef int pid_t;
+
 static __inline int strcasecmp (const char *s1, const char *s2)
 {
int size1 = strlen(s1);
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 08/14] MINGW: git-compat-util.h: use inttypes.h for printf macros

2014-10-08 Thread Marat Radchenko
All MinGW flavors have inttypes.h, so just include it.

However, we need to pass -D__USE_MINGW_ANSI_STDIO=1 to select
GNU-compatible macro definitions on MinGW-W64:
http://sourceforge.net/p/mingw-w64/wiki2/gnu%20printf/

As a side-effect, Git no longer builds with MSVC  2010 due to
its lack of stdint.h but hopefully that is not a problem.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 compat/mingw.h|  2 --
 compat/msvc.h |  3 +++
 config.mak.uname  |  3 ++-
 git-compat-util.h | 11 ++-
 4 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/compat/mingw.h b/compat/mingw.h
index ba05044..59a50fc 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -358,8 +358,6 @@ static inline char *mingw_find_last_dir_sep(const char 
*path)
 int mingw_offset_1st_component(const char *path);
 #define offset_1st_component mingw_offset_1st_component
 #define PATH_SEP ';'
-#define PRIuMAX I64u
-#define PRId64 I64d
 
 void mingw_open_html(const char *path);
 #define open_html mingw_open_html
diff --git a/compat/msvc.h b/compat/msvc.h
index a63d878..84a03f9 100644
--- a/compat/msvc.h
+++ b/compat/msvc.h
@@ -17,6 +17,9 @@
 
 typedef int pid_t;
 
+#define PRIuMAX I64u
+#define PRId64 I64d
+
 static __inline int strcasecmp (const char *s1, const char *s2)
 {
int size1 = strlen(s1);
diff --git a/config.mak.uname b/config.mak.uname
index 4470a928..c7aaa1c 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -328,6 +328,7 @@ ifeq ($(uname_S),Windows)
NO_PREAD = YesPlease
NEEDS_CRYPTO_WITH_SSL = YesPlease
NO_LIBGEN_H = YesPlease
+   NO_INTTYPES_H = UnfortunatelyYes
NO_POLL = YesPlease
NO_SYMLINK_HEAD = YesPlease
NO_IPV6 = YesPlease
@@ -510,7 +511,7 @@ 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 -DNOGDI -Icompat -Icompat/win32
+   COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -D__USE_MINGW_ANSI_STDIO=1 
-DNOGDI -Icompat -Icompat/win32
ifneq (,$(findstring i686,$(CC_MACH)))
COMPAT_CFLAGS += -D_USE_32BIT_TIME_T
BASIC_LDFLAGS += -Wl,--large-address-aware
diff --git a/git-compat-util.h b/git-compat-util.h
index fb41118..b338277 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -96,6 +96,12 @@
 #define GIT_WINDOWS_NATIVE
 #endif
 
+#ifndef NO_INTTYPES_H
+#include inttypes.h
+#else
+#include stdint.h
+#endif
+
 #include unistd.h
 #include stdio.h
 #include sys/stat.h
@@ -147,11 +153,6 @@
 #include netdb.h
 #include pwd.h
 #include sys/un.h
-#ifndef NO_INTTYPES_H
-#include inttypes.h
-#else
-#include stdint.h
-#endif
 #ifdef NO_INTPTR_T
 /*
  * On I16LP32, ILP32 and LP64 long is the save bet, however
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 07/14] Fix BASIC_LDFLAGS and COMPAT_CFLAGS for 64bit MinGW-w64

2014-10-08 Thread Marat Radchenko
From: Ray Donnelly mingw.andr...@gmail.com

Signed-off-by: Ray Donnelly mingw.andr...@gmail.com
Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 config.mak.uname | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/config.mak.uname b/config.mak.uname
index 324a7fc..4470a928 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
@@ -509,12 +510,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
-   BASIC_LDFLAGS += -Wl,--large-address-aware
EXTLIBS += -lws2_32
GITLIBS += git.res
PTHREAD_LIBS =
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 01/14] MINGW: compat/mingw.h: do not attempt to redefine lseek on mingw-w64

2014-10-08 Thread Marat Radchenko
Unlike MinGW, MinGW-W64 has lseek already properly defined in io.h.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
Acked-by: Eric Faye-Lund kusmab...@gmail.com
---
 compat/mingw.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/compat/mingw.h b/compat/mingw.h
index 5e499cf..36a47cb 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -286,7 +286,9 @@ static inline int getrlimit(int resource, struct rlimit 
*rlp)
  * Use mingw specific stat()/lstat()/fstat() implementations on Windows.
  */
 #define off_t off64_t
+#ifndef lseek
 #define lseek _lseeki64
+#endif
 
 /* use struct stat with 64 bit st_size */
 #ifdef stat
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 03/14] MINGW: compat/mingw.h: drop fork() definition

2014-10-08 Thread Marat Radchenko
fork() is not used in MinGW builds but causes a compiler warning
on x86_64 MinGW-W64: conflicting types for built-in function 'fork'

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
Acked-by: Eric Faye-Lund kusmab...@gmail.com
---
 compat/mingw.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/compat/mingw.h b/compat/mingw.h
index 36a47cb..1ddd663 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -92,8 +92,6 @@ static inline int symlink(const char *oldpath, const char 
*newpath)
 { errno = ENOSYS; return -1; }
 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 unsigned int alarm(unsigned int seconds)
 { return 0; }
 static inline int fsync(int fd)
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v5] MinGW(-W64) compilation

2014-10-08 Thread Marat Radchenko
This patch series fixes building on modern MinGW and MinGW-W64 (including 
x86_64).

*Compilation* tested on:
 - MSVC
 - msysGit environment (twice)
 - Linux cross-toolchain i686-pc-mingw32
 - Linux cross-toolchain i686-w64-mingw32
 - Linux cross-toolchain x86_64-w64-mingw32

Also, this patchset is confirmed to pass msysgit testsuite.

Attention: in order to build on MinGW-W64, you need a version that has
https://sourceforge.net/p/mingw-w64/bugs/397 fixed. Otherwise, you'll get:

  compat/poll/poll.c: In function 'poll':
  compat/poll/poll.c:541:7: warning: implicit declaration of function 
'MsgWaitForMultipleObjects'
  compat/poll/poll.c:542:26: error 'QS_ALLINPUT' undeclared (first use in this 
function)

---

Cosmetic changes since v4:

 * Reworded 'MSVC: config.mak.uname: drop -D__USE_MINGW_ACCESS from CFLAGS'
   (added note about MinGW section)
 * Reworded 'MINGW: config.mak.uname: reorganize MinGW settings'
   (now uses gender-neutral singular 'they')
 * Reworded 'Fix pointer - integer casts on IL32P64 systems'
   (added references to Gnulib commits)

---

Additional note:

todays git.git/master is broken on both MSVC and MinGW-W64 because of 7559a1be 
+ 4e6d207c:
MSVC doesn't have sigset_t at all, MinGW-W64 has it in sys/types.h, but it is 
only
available with -D_POSIX. I hope this can be resolved separately as a regression 
for MSVC.


--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 05/14] MINGW: config.mak.uname: allow using cURL for non-msysGit builds

2014-10-08 Thread Marat Radchenko
Is it absolutely valid and possible to have cURL in generic
MinGW environment. Building Git without cURL is still possible
by passing NO_CURL=1

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
Acked-by: Eric Faye-Lund kusmab...@gmail.com
---
 config.mak.uname | 2 --
 1 file changed, 2 deletions(-)

diff --git a/config.mak.uname b/config.mak.uname
index 20cbdcf..324a7fc 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -531,8 +531,6 @@ ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
INTERNAL_QSORT = YesPlease
HAVE_LIBCHARSET_H = YesPlease
NO_GETTEXT = YesPlease
-else
-   NO_CURL = YesPlease
 endif
 endif
 ifeq ($(uname_S),QNX)
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 02/14] MSVC: config.mak.uname: drop -D__USE_MINGW_ACCESS from CFLAGS

2014-10-08 Thread Marat Radchenko
-D__USE_MINGW_ACCESS only affects MinGW and does nothing when
MSVC is used.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
Acked-by: Eric Faye-Lund kusmab...@gmail.com
---
 config.mak.uname | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/config.mak.uname b/config.mak.uname
index a2f380f..20cbdcf 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -368,7 +368,7 @@ ifeq ($(uname_S),Windows)
COMPAT_OBJS = compat/msvc.o compat/winansi.o \
compat/win32/pthread.o compat/win32/syslog.o \
compat/win32/dirent.o
-   COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DNOGDI -DHAVE_STRING_H -Icompat 
-Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\.exe\
+   COMPAT_CFLAGS = -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex 
-Icompat/win32 -DSTRIP_EXTENSION=\.exe\
BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -SUBSYSTEM:CONSOLE
EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib 
invalidcontinue.obj
PTHREAD_LIBS =
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 10/14] Makefile: introduce CROSS_COMPILE variable

2014-10-08 Thread Marat Radchenko
To ease cross-compilation process, introduce a single variable
with the prefix to all compiler-related executables.

Define CROSS_COMPILE=foo- if your compiler and binary utilities
are foo-cc, foo-ar, foo-strip, etc.  More specific variables
override this, so if you set CC=gcc CROSS_COMPILE=ia64-linux-gnu-
then the compiler will be 'gcc', not 'ia64-linux-gnu-gcc'.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 Makefile | 19 +--
 config.mak.uname |  2 +-
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index f34a2d4..c412996 100644
--- a/Makefile
+++ b/Makefile
@@ -339,6 +339,11 @@ all::
 # return NULL when it receives a bogus time_t.
 #
 # Define HAVE_CLOCK_GETTIME if your platform has clock_gettime in librt.
+#
+# Define CROSS_COMPILE=foo- if your compiler and binary utilities
+# are foo-cc, foo-ar, foo-strip, etc.  More specific variables
+# override this, so if you set CC=gcc CROSS_COMPILE=ia64-linux-gnu-
+# then the compiler will be 'gcc', not 'ia64-linux-gnu-gcc'.
 
 GIT-VERSION-FILE: FORCE
@$(SHELL_PATH) ./GIT-VERSION-GEN
@@ -350,7 +355,6 @@ CFLAGS = -g -O2 -Wall
 LDFLAGS =
 ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS)
 ALL_LDFLAGS = $(LDFLAGS)
-STRIP ?= strip
 
 # Among the variables below, these:
 #   gitexecdir
@@ -390,8 +394,12 @@ htmldir_relative = $(patsubst $(prefix)/%,%,$(htmldir))
 
 export prefix bindir sharedir sysconfdir gitwebdir localedir
 
-CC = cc
-AR = ar
+AR = $(CROSS_COMPILE)ar
+CC = $(CROSS_COMPILE)cc
+GCOV = $(CROSS_COMPILE)gcov
+RC = $(CROSS_COMPILE)windres
+STRIP = $(CROSS_COMPILE)strip
+
 RM = rm -f
 DIFF = diff
 TAR = tar
@@ -404,13 +412,12 @@ XGETTEXT = xgettext
 MSGFMT = msgfmt
 PTHREAD_LIBS = -lpthread
 PTHREAD_CFLAGS =
-GCOV = gcov
 
 export TCL_PATH TCLTK_PATH
 
 SPARSE_FLAGS =
 
-
+RCFLAGS =
 
 ### --- END CONFIGURATION SECTION ---
 
@@ -1669,7 +1676,7 @@ $(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEFINES
mv $@+ $@
 
 git.res: git.rc GIT-VERSION-FILE
-   $(QUIET_RC)$(RC) \
+   $(QUIET_RC)$(RC) $(RCFLAGS) \
  $(join -DMAJOR= -DMINOR=, $(wordlist 1,2,$(subst -, ,$(subst ., 
,$(GIT_VERSION) \
  -DGIT_VERSION=\\\$(GIT_VERSION)\\\ $ -o $@
 
diff --git a/config.mak.uname b/config.mak.uname
index f79c0e0..9f7037e 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -523,7 +523,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
EXTLIBS += -lws2_32
GITLIBS += git.res
PTHREAD_LIBS =
-   RC = windres -O coff
+   RCFLAGS += -O coff
NATIVE_CRLF = YesPlease
X = .exe
SPARSE_FLAGS = -Wno-one-bit-signed-bitfield
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 12/14] Fix pointer - integer casts on IL32P64 systems

2014-10-08 Thread Marat Radchenko
This commit touches regcomp.c from Gnulib,
was fixed upstream in 3a4836d1.

This commit also touches poll.c from Gnulib,
was fixed upstream in d295f6c5.

This commit also touches regex_internal.h from Gnulib,
was fixed upstream in 8335a4d6.

Wrt ShellExecute in winansi.c, quoting [1]:

  MSDN says you can cast the result to an integer and compare the result
  against 32... You could cast in the other direction, comparing the return
  value against (HINSTANCE)32... Or you could cast the result to an INT_PTR
  and compare the result against 32.

We use the third option: cast HINSTANCE to intptr_t.

[1]: http://blogs.msdn.com/b/oldnewthing/archive/2006/11/08/1035971.aspx

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 compat/mingw.c| 8 
 compat/poll/poll.c| 2 +-
 compat/regex/regcomp.c| 4 ++--
 compat/regex/regex_internal.h | 1 +
 compat/win32/pthread.h| 2 +-
 compat/winansi.c  | 2 +-
 pack-revindex.c   | 2 +-
 sha1_file.c   | 8 
 8 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/compat/mingw.c b/compat/mingw.c
index c5c37e5..27925d9 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -674,13 +674,13 @@ int pipe(int filedes[2])
errno = err_win_to_posix(GetLastError());
return -1;
}
-   filedes[0] = _open_osfhandle((int)h[0], O_NOINHERIT);
+   filedes[0] = _open_osfhandle((intptr_t)h[0], O_NOINHERIT);
if (filedes[0]  0) {
CloseHandle(h[0]);
CloseHandle(h[1]);
return -1;
}
-   filedes[1] = _open_osfhandle((int)h[1], O_NOINHERIT);
+   filedes[1] = _open_osfhandle((intptr_t)h[1], O_NOINHERIT);
if (filedes[0]  0) {
close(filedes[0]);
CloseHandle(h[1]);
@@ -1819,7 +1819,7 @@ void mingw_open_html(const char *unixpath)
const char *, const char *, const char *, INT);
T ShellExecute;
HMODULE shell32;
-   int r;
+   intptr_t r;
 
shell32 = LoadLibrary(shell32.dll);
if (!shell32)
@@ -1829,7 +1829,7 @@ void mingw_open_html(const char *unixpath)
die(cannot run browser);
 
printf(Launching default browser to display HTML ...\n);
-   r = (int)ShellExecute(NULL, open, htmlpath, NULL, \\, 
SW_SHOWNORMAL);
+   r = (intptr_t)ShellExecute(NULL, open, htmlpath, NULL, \\, 
SW_SHOWNORMAL);
FreeLibrary(shell32);
/* see the MSDN documentation referring to the result codes here */
if (r = 32) {
diff --git a/compat/poll/poll.c b/compat/poll/poll.c
index a9b41d8..8941249 100644
--- a/compat/poll/poll.c
+++ b/compat/poll/poll.c
@@ -76,7 +76,7 @@
 
 #ifdef WIN32_NATIVE
 
-#define IsConsoleHandle(h) (((long) (h)  3) == 3)
+#define IsConsoleHandle(h) (((intptr_t) (h)  3) == 3)
 
 static BOOL
 IsSocketHandle (HANDLE h)
diff --git a/compat/regex/regcomp.c b/compat/regex/regcomp.c
index 06f3088..d8bde06 100644
--- a/compat/regex/regcomp.c
+++ b/compat/regex/regcomp.c
@@ -2577,7 +2577,7 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, 
re_dfa_t *dfa,
 old_tree = NULL;
 
   if (elem-token.type == SUBEXP)
-postorder (elem, mark_opt_subexp, (void *) (long) elem-token.opr.idx);
+postorder (elem, mark_opt_subexp, (void *) (intptr_t) elem-token.opr.idx);
 
   tree = create_tree (dfa, elem, NULL, (end == -1 ? OP_DUP_ASTERISK : OP_ALT));
   if (BE (tree == NULL, 0))
@@ -3806,7 +3806,7 @@ create_token_tree (re_dfa_t *dfa, bin_tree_t *left, 
bin_tree_t *right,
 static reg_errcode_t
 mark_opt_subexp (void *extra, bin_tree_t *node)
 {
-  int idx = (int) (long) extra;
+  int idx = (int) (intptr_t) extra;
   if (node-token.type == SUBEXP  node-token.opr.idx == idx)
 node-token.opt_subexp = 1;
 
diff --git a/compat/regex/regex_internal.h b/compat/regex/regex_internal.h
index 4184d7f..da12670 100644
--- a/compat/regex/regex_internal.h
+++ b/compat/regex/regex_internal.h
@@ -26,6 +26,7 @@
 #include stdio.h
 #include stdlib.h
 #include string.h
+#include stdint.h
 
 #if defined HAVE_LANGINFO_H || defined HAVE_LANGINFO_CODESET || defined _LIBC
 # include langinfo.h
diff --git a/compat/win32/pthread.h b/compat/win32/pthread.h
index 8ad1873..6ccfb7b 100644
--- a/compat/win32/pthread.h
+++ b/compat/win32/pthread.h
@@ -77,7 +77,7 @@ extern pthread_t pthread_self(void);
 
 static inline int pthread_exit(void *ret)
 {
-   ExitThread((DWORD)ret);
+   ExitThread((DWORD)(uintptr_t)ret);
 }
 
 typedef DWORD pthread_key_t;
diff --git a/compat/winansi.c b/compat/winansi.c
index 0ac3297..ca4c295 100644
--- a/compat/winansi.c
+++ b/compat/winansi.c
@@ -452,7 +452,7 @@ static HANDLE duplicate_handle(HANDLE hnd)
HANDLE hresult, hproc = GetCurrentProcess();
if (!DuplicateHandle(hproc, hnd, hproc, hresult, 0, TRUE,
DUPLICATE_SAME_ACCESS))
-   die_lasterr(DuplicateHandle(%li) failed, (long) hnd

[PATCH 13/14] git-compat-util.h: fix integer overflow on IL32P64 systems

2014-10-08 Thread Marat Radchenko
Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 git-compat-util.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/git-compat-util.h b/git-compat-util.h
index b338277..101c9d7 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -474,7 +474,7 @@ extern int git_munmap(void *start, size_t length);
 #endif
 
 #define DEFAULT_PACKED_GIT_LIMIT \
-   ((1024L * 1024L) * (sizeof(void*) = 8 ? 8192 : 256))
+   ((size_t)(1024L * 1024L) * (sizeof(void*) = 8 ? 8192 : 256))
 
 #ifdef NO_PREAD
 #define pread git_pread
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 11/14] compat/nedmalloc/malloc.c.h: fix compilation under MinGW-W64

2014-10-08 Thread Marat Radchenko
1. Unlike MinGW, MinGW-W64 already provides _ReadWriteBarrier macro,
   so don't try to redefine it.

2. MinGW-W64 has a strange definition FORCEINLINE as
   extern __inline__ __attribute__((__always_inline__,__gnu_inline__))

   'extern' doesn't work together with 'static', so #undef MinGW-W64
   version of FORCEINLINE.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 compat/nedmalloc/malloc.c.h | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/compat/nedmalloc/malloc.c.h b/compat/nedmalloc/malloc.c.h
index f216a2a..a6c8cac 100644
--- a/compat/nedmalloc/malloc.c.h
+++ b/compat/nedmalloc/malloc.c.h
@@ -715,6 +715,10 @@ struct mallinfo {
 #endif /* HAVE_USR_INCLUDE_MALLOC_H */
 #endif /* NO_MALLINFO */
 
+#ifdef __MINGW64_VERSION_MAJOR
+  #undef FORCEINLINE
+#endif
+
 /*
   Try to persuade compilers to inline. The most critical functions for
   inlining are defined as macros, so these aren't used for them.
@@ -1382,7 +1386,9 @@ LONG __cdecl _InterlockedExchange(LONG volatile *Target, 
LONG Value);
 
   /*** Atomic operations ***/
   #if (__GNUC__ * 1 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)  40100
-#define _ReadWriteBarrier() __sync_synchronize()
+#ifndef _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.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 14/14] MINGW: config.mak.uname: auto-detect MinGW build from compiler

2014-10-08 Thread Marat Radchenko
When crosscompiling, one cannot rely on `uname` from host system.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 config.mak.uname | 5 +
 1 file changed, 5 insertions(+)

diff --git a/config.mak.uname b/config.mak.uname
index 9f7037e..182da50 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -14,6 +14,11 @@ ifdef MSVC
uname_O := Windows
 endif
 
+ifneq (,$(findstring mingw,$(CC_MACH)))
+   uname_S := MINGW
+   uname_O := MINGW
+endif
+
 # We choose to avoid if .. else if .. else .. endif endif
 # because maintaining the nesting to match is a pain.  If
 # we had elif things would have been much nicer...
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 14/14] MINGW: config.mak.uname: auto-detect MinGW build from compiler

2014-10-08 Thread Marat Radchenko
On Wed, Oct 08, 2014 at 12:26:52PM -0700, Junio C Hamano wrote:
 Marat Radchenko ma...@slonopotamus.org writes:
 
  When crosscompiling, one cannot rely on `uname` from host system.
 
 That may well be true, but is that limited to cross-compiling to
 mingw?   Would it be generally true for any cross compilation,
 wouldn't it?
 
 What I am wondering is if it is a better solution to make it easier
 to allow somebody who is cross compiling to express Mr.  Makefile,
 we know better than you and want you to do a MINGW build for us
 without checking with `uname -?` yourself, i.e.
 
   $ make uname_O=MINGW uname_S=MINGW
 
 which would hopefully allow cross-compilation into other
 environments, not just MINGW.

So, do you really want this patch to be changed from 5-liner into
a full-blow system detection rewrite based on `cc -dumpmachine`
instead of `uname`?
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 13/14] git-compat-util.h: fix integer overflow on IL32P64 systems

2014-10-08 Thread Marat Radchenko
On Wed, Oct 08, 2014 at 01:02:10PM -0700, Junio C Hamano wrote:
 Junio C Hamano gits...@pobox.com writes:
 
  Marat Radchenko ma...@slonopotamus.org writes:
 
  Signed-off-by: Marat Radchenko ma...@slonopotamus.org
  ---
   git-compat-util.h | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
 
  diff --git a/git-compat-util.h b/git-compat-util.h
  index b338277..101c9d7 100644
  --- a/git-compat-util.h
  +++ b/git-compat-util.h
  @@ -474,7 +474,7 @@ extern int git_munmap(void *start, size_t length);
   #endif
   
   #define DEFAULT_PACKED_GIT_LIMIT \
  -  ((1024L * 1024L) * (sizeof(void*) = 8 ? 8192 : 256))
  +  ((size_t)(1024L * 1024L) * (sizeof(void*) = 8 ? 8192 : 256))
 
  1024 * 1024 * 8192 overflows 32-bit unsigned, but is size_t always
  large enough?  Just checking.
 
 Heh, I was being silly.  This gives the default value for a variable
 whose type is size_t, so it would better fit.  So please throw 13 in
 the list of changes I found sensible in the other message.

Is it an Acked-by?
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4] MinGW(-W64) compilation

2014-10-07 Thread Marat Radchenko
On Wed, Oct 08, 2014 at 01:09:20AM +0200, Thomas Braun wrote:
 Am 30.09.2014 um 09:02 schrieb Marat Radchenko:
  This patch series fixes building on modern MinGW and MinGW-W64 (including 
  x86_64!).
  
  *Compilation* tested on:
   - MSVC
   - msysGit environment (twice)
 
 Hi Marat,
 
 I wanted to verify that on msysgit but some patches fail to apply
 cleanly. Did you also had to tweak the patches?
 If yes, are these tweaked patches still available somewhere?

msysgit != git-for-windows, as msysgit folks say. msysgit is a development
environment for git-for-windows.

I tested my patches by applying them to git.git/master and building
inside msysgit.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4] MinGW(-W64) compilation

2014-10-05 Thread Marat Radchenko
On Tue, Sep 30, 2014 at 11:02:29AM +0400, Marat Radchenko wrote:
 This patch series fixes building on modern MinGW and MinGW-W64 (including 
 x86_64!).

Junio, ping?
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [msysGit] [PATCH 12/14] Fix pointer - integer casts on IL32P64 systems

2014-09-30 Thread Marat Radchenko
On Mon, Sep 29, 2014 at 10:43:41PM +0200, Johannes Sixt wrote:
 Am 28.09.2014 um 15:24 schrieb Marat Radchenko:
  This commit touches regcomp.c and poll.c from Gnulib,
  both were fixed upstream in 2012 the same way.
  
  Wrt ShellExecute, see [1].
  
  [1]: http://blogs.msdn.com/b/oldnewthing/archive/2006/11/08/1035971.aspx
 
 Please do not force readers to visit a web site; provide at least a summary.

No problem, will expand commit message.

 This breaks with
 
 In file included from compat/regex/regex.c:77:
 compat/regex/regcomp.c: In function 'parse_dup_op':
 compat/regex/regcomp.c:2580: error: 'intptr_t' undeclared (first use in
 this function)
 
 when compiled using the msysgit environment.

Aargh! No idea how this slipped through. Will reroll.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4] MinGW(-W64) compilation

2014-09-30 Thread Marat Radchenko
This patch series fixes building on modern MinGW and MinGW-W64 (including 
x86_64!).

*Compilation* tested on:
 - MSVC
 - msysGit environment (twice)
 - Linux cross-toolchain i686-pc-mingw32
 - Linux cross-toolchain i686-w64-mingw32
 - Linux cross-toolchain x86_64-w64-mingw32

Attention: in order to build on MinGW-W64, you need to use 'v1.x', 'v2.x' or 
'sf/v3.x'
branches from MinGW-W64 repo because MinGW-W64 releases do not yet have a fix
for https://sourceforge.net/p/mingw-w64/bugs/397

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 09/14] MINGW: config.mak.uname: reorganize MinGW settings

2014-09-30 Thread Marat Radchenko
HAVE_LIBCHARSET_H and NO_R_TO_GCC_LINKER are not specific to
msysGit, they're general MinGW settings.

Logic behind HAVE_LIBCHARSET_H: if user is on MinGW and has iconv,
we expect him to have libcharset.h. If user doesn't have iconv,
he has to explicitly say so via NO_ICONV=1 regardless of this
commit.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 config.mak.uname | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/config.mak.uname b/config.mak.uname
index c7aaa1c..f79c0e0 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -532,11 +532,11 @@ ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
prefix =
INSTALL = /bin/install
EXTLIBS += /mingw/lib/libz.a
-   NO_R_TO_GCC_LINKER = YesPlease
INTERNAL_QSORT = YesPlease
-   HAVE_LIBCHARSET_H = YesPlease
NO_GETTEXT = YesPlease
 endif
+   HAVE_LIBCHARSET_H = YesPlease
+   NO_R_TO_GCC_LINKER = YesPlease
 endif
 ifeq ($(uname_S),QNX)
COMPAT_CFLAGS += -DSA_RESTART=0
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 01/14] MINGW: compat/mingw.h: do not attempt to redefine lseek on mingw-w64

2014-09-30 Thread Marat Radchenko
Unlike MinGW, MinGW-W64 has lseek already properly defined in io.h.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
Acked-by: Eric Faye-Lund kusmab...@gmail.com
---
 compat/mingw.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/compat/mingw.h b/compat/mingw.h
index df0e320..ed79368 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -281,7 +281,9 @@ static inline int getrlimit(int resource, struct rlimit 
*rlp)
  * Use mingw specific stat()/lstat()/fstat() implementations on Windows.
  */
 #define off_t off64_t
+#ifndef lseek
 #define lseek _lseeki64
+#endif
 
 /* use struct stat with 64 bit st_size */
 #ifdef stat
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 05/14] MINGW: config.mak.uname: allow using cURL for non-msysGit builds

2014-09-30 Thread Marat Radchenko
Is it absolutely valid and possible to have cURL in generic
MinGW environment. Building Git without cURL is still possible
by passing NO_CURL=1

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
Acked-by: Eric Faye-Lund kusmab...@gmail.com
---
 config.mak.uname | 2 --
 1 file changed, 2 deletions(-)

diff --git a/config.mak.uname b/config.mak.uname
index 20cbdcf..324a7fc 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -531,8 +531,6 @@ ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
INTERNAL_QSORT = YesPlease
HAVE_LIBCHARSET_H = YesPlease
NO_GETTEXT = YesPlease
-else
-   NO_CURL = YesPlease
 endif
 endif
 ifeq ($(uname_S),QNX)
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 06/14] MINGW: compat/winansi.c: do not redefine CONSOLE_FONT_INFOEX

2014-09-30 Thread Marat Radchenko
Unlike MinGW, MinGW-W64 has CONSOLE_FONT_INFOEX already properly defined
in wincon.h.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 compat/winansi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/compat/winansi.c b/compat/winansi.c
index efc5bb3..0ac3297 100644
--- a/compat/winansi.c
+++ b/compat/winansi.c
@@ -22,7 +22,7 @@ static int non_ascii_used = 0;
 static HANDLE hthread, hread, hwrite;
 static HANDLE hconsole1, hconsole2;
 
-#ifdef __MINGW32__
+#if defined(__MINGW32__)  !defined(__MINGW64_VERSION_MAJOR)
 typedef struct _CONSOLE_FONT_INFOEX {
ULONG cbSize;
DWORD nFont;
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 03/14] MINGW: compat/mingw.h: drop fork() definition

2014-09-30 Thread Marat Radchenko
fork() is not used in MinGW builds but causes a compiler warning
on x86_64 MinGW-W64: conflicting types for built-in function 'fork'

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
Acked-by: Eric Faye-Lund kusmab...@gmail.com
---
 compat/mingw.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/compat/mingw.h b/compat/mingw.h
index ed79368..948a174 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -93,8 +93,6 @@ static inline int symlink(const char *oldpath, const char 
*newpath)
 { errno = ENOSYS; return -1; }
 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 unsigned int alarm(unsigned int seconds)
 { return 0; }
 static inline int fsync(int fd)
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 07/14] Fix BASIC_LDFLAGS and COMPAT_CFLAGS for 64bit MinGW-w64

2014-09-30 Thread Marat Radchenko
From: Ray Donnelly mingw.andr...@gmail.com

Signed-off-by: Ray Donnelly mingw.andr...@gmail.com
Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 config.mak.uname | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/config.mak.uname b/config.mak.uname
index 324a7fc..4470a928 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
@@ -509,12 +510,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
-   BASIC_LDFLAGS += -Wl,--large-address-aware
EXTLIBS += -lws2_32
GITLIBS += git.res
PTHREAD_LIBS =
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 08/14] MINGW: git-compat-util.h: use inttypes.h for printf macros

2014-09-30 Thread Marat Radchenko
All MinGW flavors have inttypes.h, so just include it.

However, we need to pass -D__USE_MINGW_ANSI_STDIO=1 to select
GNU-compatible macro definitions on MinGW-W64:
http://sourceforge.net/p/mingw-w64/wiki2/gnu%20printf/

As a side-effect, Git no longer builds with MSVC  2010 due to
its lack of stdint.h but hopefully that is not a problem.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 compat/mingw.h|  2 --
 compat/msvc.h |  3 +++
 config.mak.uname  |  3 ++-
 git-compat-util.h | 11 ++-
 4 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/compat/mingw.h b/compat/mingw.h
index d113b19..4bae842 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -353,8 +353,6 @@ static inline char *mingw_find_last_dir_sep(const char 
*path)
 int mingw_offset_1st_component(const char *path);
 #define offset_1st_component mingw_offset_1st_component
 #define PATH_SEP ';'
-#define PRIuMAX I64u
-#define PRId64 I64d
 
 void mingw_open_html(const char *path);
 #define open_html mingw_open_html
diff --git a/compat/msvc.h b/compat/msvc.h
index a63d878..84a03f9 100644
--- a/compat/msvc.h
+++ b/compat/msvc.h
@@ -17,6 +17,9 @@
 
 typedef int pid_t;
 
+#define PRIuMAX I64u
+#define PRId64 I64d
+
 static __inline int strcasecmp (const char *s1, const char *s2)
 {
int size1 = strlen(s1);
diff --git a/config.mak.uname b/config.mak.uname
index 4470a928..c7aaa1c 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -328,6 +328,7 @@ ifeq ($(uname_S),Windows)
NO_PREAD = YesPlease
NEEDS_CRYPTO_WITH_SSL = YesPlease
NO_LIBGEN_H = YesPlease
+   NO_INTTYPES_H = UnfortunatelyYes
NO_POLL = YesPlease
NO_SYMLINK_HEAD = YesPlease
NO_IPV6 = YesPlease
@@ -510,7 +511,7 @@ 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 -DNOGDI -Icompat -Icompat/win32
+   COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -D__USE_MINGW_ANSI_STDIO=1 
-DNOGDI -Icompat -Icompat/win32
ifneq (,$(findstring i686,$(CC_MACH)))
COMPAT_CFLAGS += -D_USE_32BIT_TIME_T
BASIC_LDFLAGS += -Wl,--large-address-aware
diff --git a/git-compat-util.h b/git-compat-util.h
index 0c4e663..9d2d5ab 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -96,6 +96,12 @@
 #define GIT_WINDOWS_NATIVE
 #endif
 
+#ifndef NO_INTTYPES_H
+#include inttypes.h
+#else
+#include stdint.h
+#endif
+
 #include unistd.h
 #include stdio.h
 #include sys/stat.h
@@ -147,11 +153,6 @@
 #include netdb.h
 #include pwd.h
 #include sys/un.h
-#ifndef NO_INTTYPES_H
-#include inttypes.h
-#else
-#include stdint.h
-#endif
 #ifdef NO_INTPTR_T
 /*
  * On I16LP32, ILP32 and LP64 long is the save bet, however
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 04/14] MINGW: do not fail at redefining pid_t on MinGW-W64

2014-09-30 Thread Marat Radchenko
pid_t is available in sys/types.h on both MinGW and MinGW-W64

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
Acked-by: Eric Faye-Lund kusmab...@gmail.com
---
 compat/mingw.h | 1 -
 compat/msvc.h  | 2 ++
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/compat/mingw.h b/compat/mingw.h
index 948a174..d113b19 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -5,7 +5,6 @@
  * things that are not available in header files
  */
 
-typedef int pid_t;
 typedef int uid_t;
 typedef int socklen_t;
 #define hstrerror strerror
diff --git a/compat/msvc.h b/compat/msvc.h
index 580bb55..a63d878 100644
--- a/compat/msvc.h
+++ b/compat/msvc.h
@@ -15,6 +15,8 @@
 #define strtoull _strtoui64
 #define strtoll  _strtoi64
 
+typedef int pid_t;
+
 static __inline int strcasecmp (const char *s1, const char *s2)
 {
int size1 = strlen(s1);
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 02/14] MSVC: config.mak.uname: drop -D__USE_MINGW_ACCESS from CFLAGS

2014-09-30 Thread Marat Radchenko
-D__USE_MINGW_ACCESS only affects MinGW and does nothing when
MSVC is used.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
Acked-by: Eric Faye-Lund kusmab...@gmail.com
---
 config.mak.uname | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/config.mak.uname b/config.mak.uname
index a2f380f..20cbdcf 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -368,7 +368,7 @@ ifeq ($(uname_S),Windows)
COMPAT_OBJS = compat/msvc.o compat/winansi.o \
compat/win32/pthread.o compat/win32/syslog.o \
compat/win32/dirent.o
-   COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DNOGDI -DHAVE_STRING_H -Icompat 
-Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\.exe\
+   COMPAT_CFLAGS = -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex 
-Icompat/win32 -DSTRIP_EXTENSION=\.exe\
BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -SUBSYSTEM:CONSOLE
EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib 
invalidcontinue.obj
PTHREAD_LIBS =
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 12/14] Fix pointer - integer casts on IL32P64 systems

2014-09-30 Thread Marat Radchenko
This commit touches regcomp.c and poll.c from Gnulib,
both were fixed upstream in 2012 the same way.

Also, this commit touches regex_internal.h from Gnulib,
which was fixed upstream in 2005.

Wrt ShellExecute in winansi.c, quoting [1]:

  MSDN says you can cast the result to an integer and compare the result
  against 32... You could cast in the other direction, comparing the return
  value against (HINSTANCE)32... Or you could cast the result to an INT_PTR
  and compare the result against 32.

We use the third option: cast HINSTANCE to intptr_t.

[1]: http://blogs.msdn.com/b/oldnewthing/archive/2006/11/08/1035971.aspx

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 compat/mingw.c| 8 
 compat/poll/poll.c| 2 +-
 compat/regex/regcomp.c| 4 ++--
 compat/regex/regex_internal.h | 1 +
 compat/win32/pthread.h| 2 +-
 compat/winansi.c  | 2 +-
 pack-revindex.c   | 2 +-
 sha1_file.c   | 8 
 8 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/compat/mingw.c b/compat/mingw.c
index c5c37e5..27925d9 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -674,13 +674,13 @@ int pipe(int filedes[2])
errno = err_win_to_posix(GetLastError());
return -1;
}
-   filedes[0] = _open_osfhandle((int)h[0], O_NOINHERIT);
+   filedes[0] = _open_osfhandle((intptr_t)h[0], O_NOINHERIT);
if (filedes[0]  0) {
CloseHandle(h[0]);
CloseHandle(h[1]);
return -1;
}
-   filedes[1] = _open_osfhandle((int)h[1], O_NOINHERIT);
+   filedes[1] = _open_osfhandle((intptr_t)h[1], O_NOINHERIT);
if (filedes[0]  0) {
close(filedes[0]);
CloseHandle(h[1]);
@@ -1819,7 +1819,7 @@ void mingw_open_html(const char *unixpath)
const char *, const char *, const char *, INT);
T ShellExecute;
HMODULE shell32;
-   int r;
+   intptr_t r;
 
shell32 = LoadLibrary(shell32.dll);
if (!shell32)
@@ -1829,7 +1829,7 @@ void mingw_open_html(const char *unixpath)
die(cannot run browser);
 
printf(Launching default browser to display HTML ...\n);
-   r = (int)ShellExecute(NULL, open, htmlpath, NULL, \\, 
SW_SHOWNORMAL);
+   r = (intptr_t)ShellExecute(NULL, open, htmlpath, NULL, \\, 
SW_SHOWNORMAL);
FreeLibrary(shell32);
/* see the MSDN documentation referring to the result codes here */
if (r = 32) {
diff --git a/compat/poll/poll.c b/compat/poll/poll.c
index a9b41d8..8941249 100644
--- a/compat/poll/poll.c
+++ b/compat/poll/poll.c
@@ -76,7 +76,7 @@
 
 #ifdef WIN32_NATIVE
 
-#define IsConsoleHandle(h) (((long) (h)  3) == 3)
+#define IsConsoleHandle(h) (((intptr_t) (h)  3) == 3)
 
 static BOOL
 IsSocketHandle (HANDLE h)
diff --git a/compat/regex/regcomp.c b/compat/regex/regcomp.c
index 06f3088..d8bde06 100644
--- a/compat/regex/regcomp.c
+++ b/compat/regex/regcomp.c
@@ -2577,7 +2577,7 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, 
re_dfa_t *dfa,
 old_tree = NULL;
 
   if (elem-token.type == SUBEXP)
-postorder (elem, mark_opt_subexp, (void *) (long) elem-token.opr.idx);
+postorder (elem, mark_opt_subexp, (void *) (intptr_t) elem-token.opr.idx);
 
   tree = create_tree (dfa, elem, NULL, (end == -1 ? OP_DUP_ASTERISK : OP_ALT));
   if (BE (tree == NULL, 0))
@@ -3806,7 +3806,7 @@ create_token_tree (re_dfa_t *dfa, bin_tree_t *left, 
bin_tree_t *right,
 static reg_errcode_t
 mark_opt_subexp (void *extra, bin_tree_t *node)
 {
-  int idx = (int) (long) extra;
+  int idx = (int) (intptr_t) extra;
   if (node-token.type == SUBEXP  node-token.opr.idx == idx)
 node-token.opt_subexp = 1;
 
diff --git a/compat/regex/regex_internal.h b/compat/regex/regex_internal.h
index 4184d7f..da12670 100644
--- a/compat/regex/regex_internal.h
+++ b/compat/regex/regex_internal.h
@@ -26,6 +26,7 @@
 #include stdio.h
 #include stdlib.h
 #include string.h
+#include stdint.h
 
 #if defined HAVE_LANGINFO_H || defined HAVE_LANGINFO_CODESET || defined _LIBC
 # include langinfo.h
diff --git a/compat/win32/pthread.h b/compat/win32/pthread.h
index 8ad1873..6ccfb7b 100644
--- a/compat/win32/pthread.h
+++ b/compat/win32/pthread.h
@@ -77,7 +77,7 @@ extern pthread_t pthread_self(void);
 
 static inline int pthread_exit(void *ret)
 {
-   ExitThread((DWORD)ret);
+   ExitThread((DWORD)(uintptr_t)ret);
 }
 
 typedef DWORD pthread_key_t;
diff --git a/compat/winansi.c b/compat/winansi.c
index 0ac3297..ca4c295 100644
--- a/compat/winansi.c
+++ b/compat/winansi.c
@@ -452,7 +452,7 @@ static HANDLE duplicate_handle(HANDLE hnd)
HANDLE hresult, hproc = GetCurrentProcess();
if (!DuplicateHandle(hproc, hnd, hproc, hresult, 0, TRUE,
DUPLICATE_SAME_ACCESS))
-   die_lasterr(DuplicateHandle(%li) failed, (long) hnd);
+   die_lasterr(DuplicateHandle(%p

[PATCH 14/14] MINGW: config.mak.uname: auto-detect MinGW build from compiler

2014-09-30 Thread Marat Radchenko
When crosscompiling, one cannot rely on `uname` from host system.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 config.mak.uname | 5 +
 1 file changed, 5 insertions(+)

diff --git a/config.mak.uname b/config.mak.uname
index 9f7037e..182da50 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -14,6 +14,11 @@ ifdef MSVC
uname_O := Windows
 endif
 
+ifneq (,$(findstring mingw,$(CC_MACH)))
+   uname_S := MINGW
+   uname_O := MINGW
+endif
+
 # We choose to avoid if .. else if .. else .. endif endif
 # because maintaining the nesting to match is a pain.  If
 # we had elif things would have been much nicer...
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 13/14] git-compat-util.h: fix integer overflow on IL32P64 systems

2014-09-30 Thread Marat Radchenko
Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 git-compat-util.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/git-compat-util.h b/git-compat-util.h
index 9d2d5ab..5f6659c 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -474,7 +474,7 @@ extern int git_munmap(void *start, size_t length);
 #endif
 
 #define DEFAULT_PACKED_GIT_LIMIT \
-   ((1024L * 1024L) * (sizeof(void*) = 8 ? 8192 : 256))
+   ((size_t)(1024L * 1024L) * (sizeof(void*) = 8 ? 8192 : 256))
 
 #ifdef NO_PREAD
 #define pread git_pread
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 10/14] Makefile: introduce CROSS_COMPILE variable

2014-09-30 Thread Marat Radchenko
To ease cross-compilation process, introduce a single variable
with the prefix to all compiler-related executables.

Define CROSS_COMPILE=foo- if your compiler and binary utilities
are foo-cc, foo-ar, foo-strip, etc.  More specific variables
override this, so if you set CC=gcc CROSS_COMPILE=ia64-linux-gnu-
then the compiler will be 'gcc', not 'ia64-linux-gnu-gcc'.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 Makefile | 19 +--
 config.mak.uname |  2 +-
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index f34a2d4..c412996 100644
--- a/Makefile
+++ b/Makefile
@@ -339,6 +339,11 @@ all::
 # return NULL when it receives a bogus time_t.
 #
 # Define HAVE_CLOCK_GETTIME if your platform has clock_gettime in librt.
+#
+# Define CROSS_COMPILE=foo- if your compiler and binary utilities
+# are foo-cc, foo-ar, foo-strip, etc.  More specific variables
+# override this, so if you set CC=gcc CROSS_COMPILE=ia64-linux-gnu-
+# then the compiler will be 'gcc', not 'ia64-linux-gnu-gcc'.
 
 GIT-VERSION-FILE: FORCE
@$(SHELL_PATH) ./GIT-VERSION-GEN
@@ -350,7 +355,6 @@ CFLAGS = -g -O2 -Wall
 LDFLAGS =
 ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS)
 ALL_LDFLAGS = $(LDFLAGS)
-STRIP ?= strip
 
 # Among the variables below, these:
 #   gitexecdir
@@ -390,8 +394,12 @@ htmldir_relative = $(patsubst $(prefix)/%,%,$(htmldir))
 
 export prefix bindir sharedir sysconfdir gitwebdir localedir
 
-CC = cc
-AR = ar
+AR = $(CROSS_COMPILE)ar
+CC = $(CROSS_COMPILE)cc
+GCOV = $(CROSS_COMPILE)gcov
+RC = $(CROSS_COMPILE)windres
+STRIP = $(CROSS_COMPILE)strip
+
 RM = rm -f
 DIFF = diff
 TAR = tar
@@ -404,13 +412,12 @@ XGETTEXT = xgettext
 MSGFMT = msgfmt
 PTHREAD_LIBS = -lpthread
 PTHREAD_CFLAGS =
-GCOV = gcov
 
 export TCL_PATH TCLTK_PATH
 
 SPARSE_FLAGS =
 
-
+RCFLAGS =
 
 ### --- END CONFIGURATION SECTION ---
 
@@ -1669,7 +1676,7 @@ $(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEFINES
mv $@+ $@
 
 git.res: git.rc GIT-VERSION-FILE
-   $(QUIET_RC)$(RC) \
+   $(QUIET_RC)$(RC) $(RCFLAGS) \
  $(join -DMAJOR= -DMINOR=, $(wordlist 1,2,$(subst -, ,$(subst ., 
,$(GIT_VERSION) \
  -DGIT_VERSION=\\\$(GIT_VERSION)\\\ $ -o $@
 
diff --git a/config.mak.uname b/config.mak.uname
index f79c0e0..9f7037e 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -523,7 +523,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
EXTLIBS += -lws2_32
GITLIBS += git.res
PTHREAD_LIBS =
-   RC = windres -O coff
+   RCFLAGS += -O coff
NATIVE_CRLF = YesPlease
X = .exe
SPARSE_FLAGS = -Wno-one-bit-signed-bitfield
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 11/14] compat/nedmalloc/malloc.c.h: fix compilation under MinGW-W64

2014-09-30 Thread Marat Radchenko
1. Unlike MinGW, MinGW-W64 already provides _ReadWriteBarrier macro,
   so don't try to redefine it.

2. MinGW-W64 has a strange definition FORCEINLINE as
   extern __inline__ __attribute__((__always_inline__,__gnu_inline__))

   'extern' doesn't work together with 'static', so #undef MinGW-W64
   version of FORCEINLINE.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 compat/nedmalloc/malloc.c.h | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/compat/nedmalloc/malloc.c.h b/compat/nedmalloc/malloc.c.h
index f216a2a..a6c8cac 100644
--- a/compat/nedmalloc/malloc.c.h
+++ b/compat/nedmalloc/malloc.c.h
@@ -715,6 +715,10 @@ struct mallinfo {
 #endif /* HAVE_USR_INCLUDE_MALLOC_H */
 #endif /* NO_MALLINFO */
 
+#ifdef __MINGW64_VERSION_MAJOR
+  #undef FORCEINLINE
+#endif
+
 /*
   Try to persuade compilers to inline. The most critical functions for
   inlining are defined as macros, so these aren't used for them.
@@ -1382,7 +1386,9 @@ LONG __cdecl _InterlockedExchange(LONG volatile *Target, 
LONG Value);
 
   /*** Atomic operations ***/
   #if (__GNUC__ * 1 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)  40100
-#define _ReadWriteBarrier() __sync_synchronize()
+#ifndef _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.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 07/14] Fix BASIC_LDFLAGS and COMPAT_CFLAGS for 64bit MinGW-w64

2014-09-28 Thread Marat Radchenko
From: Ray Donnelly mingw.andr...@gmail.com

Signed-off-by: Ray Donnelly mingw.andr...@gmail.com
Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 config.mak.uname | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/config.mak.uname b/config.mak.uname
index 324a7fc..4470a928 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
@@ -509,12 +510,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
-   BASIC_LDFLAGS += -Wl,--large-address-aware
EXTLIBS += -lws2_32
GITLIBS += git.res
PTHREAD_LIBS =
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 08/14] MINGW: git-compat-util.h: use inttypes.h for printf macros

2014-09-28 Thread Marat Radchenko
All MinGW flavors have inttypes.h, so just include it.

However, we need to pass -D__USE_MINGW_ANSI_STDIO=1 to select
GNU-compatible macro definitions on MinGW-W64:
http://sourceforge.net/p/mingw-w64/wiki2/gnu%20printf/

As a side-effect, Git no longer builds with MSVC  2010 due to
its lack of stdint.h but hopefully that is not a problem.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 compat/mingw.h|  2 --
 compat/msvc.h |  3 +++
 config.mak.uname  |  3 ++-
 git-compat-util.h | 11 ++-
 4 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/compat/mingw.h b/compat/mingw.h
index d113b19..4bae842 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -353,8 +353,6 @@ static inline char *mingw_find_last_dir_sep(const char 
*path)
 int mingw_offset_1st_component(const char *path);
 #define offset_1st_component mingw_offset_1st_component
 #define PATH_SEP ';'
-#define PRIuMAX I64u
-#define PRId64 I64d
 
 void mingw_open_html(const char *path);
 #define open_html mingw_open_html
diff --git a/compat/msvc.h b/compat/msvc.h
index a63d878..84a03f9 100644
--- a/compat/msvc.h
+++ b/compat/msvc.h
@@ -17,6 +17,9 @@
 
 typedef int pid_t;
 
+#define PRIuMAX I64u
+#define PRId64 I64d
+
 static __inline int strcasecmp (const char *s1, const char *s2)
 {
int size1 = strlen(s1);
diff --git a/config.mak.uname b/config.mak.uname
index 4470a928..c7aaa1c 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -328,6 +328,7 @@ ifeq ($(uname_S),Windows)
NO_PREAD = YesPlease
NEEDS_CRYPTO_WITH_SSL = YesPlease
NO_LIBGEN_H = YesPlease
+   NO_INTTYPES_H = UnfortunatelyYes
NO_POLL = YesPlease
NO_SYMLINK_HEAD = YesPlease
NO_IPV6 = YesPlease
@@ -510,7 +511,7 @@ 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 -DNOGDI -Icompat -Icompat/win32
+   COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -D__USE_MINGW_ANSI_STDIO=1 
-DNOGDI -Icompat -Icompat/win32
ifneq (,$(findstring i686,$(CC_MACH)))
COMPAT_CFLAGS += -D_USE_32BIT_TIME_T
BASIC_LDFLAGS += -Wl,--large-address-aware
diff --git a/git-compat-util.h b/git-compat-util.h
index 0c4e663..9d2d5ab 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -96,6 +96,12 @@
 #define GIT_WINDOWS_NATIVE
 #endif
 
+#ifndef NO_INTTYPES_H
+#include inttypes.h
+#else
+#include stdint.h
+#endif
+
 #include unistd.h
 #include stdio.h
 #include sys/stat.h
@@ -147,11 +153,6 @@
 #include netdb.h
 #include pwd.h
 #include sys/un.h
-#ifndef NO_INTTYPES_H
-#include inttypes.h
-#else
-#include stdint.h
-#endif
 #ifdef NO_INTPTR_T
 /*
  * On I16LP32, ILP32 and LP64 long is the save bet, however
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 05/14] MINGW: config.mak.uname: allow using cURL for non-msysGit builds

2014-09-28 Thread Marat Radchenko
Is it absolutely valid and possible to have cURL in generic
MinGW environment. Building Git without cURL is still possible
by passing NO_CURL=1

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
Acked-by: Eric Faye-Lund kusmab...@gmail.com
---
 config.mak.uname | 2 --
 1 file changed, 2 deletions(-)

diff --git a/config.mak.uname b/config.mak.uname
index 20cbdcf..324a7fc 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -531,8 +531,6 @@ ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
INTERNAL_QSORT = YesPlease
HAVE_LIBCHARSET_H = YesPlease
NO_GETTEXT = YesPlease
-else
-   NO_CURL = YesPlease
 endif
 endif
 ifeq ($(uname_S),QNX)
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


MinGW(-W64) compilation

2014-09-28 Thread Marat Radchenko
This patch series fixes building on modern MinGW and MinGW-W64 (including 
x86_64!).

*Compilation* tested on:
 - MSVC (via WinGit environment)
 - msysGit environment
 - Linux cross-toolchain i686-pc-mingw32
 - Linux cross-toolchain i686-w64-mingw32
 - Linux cross-toolchain x86_64-w64-mingw32

Attention: in order to build on MinGW-W64, you need to use 'sf/v3.x' branch
from MinGW-W64 repo because MinGW-W64 releases do not yet have a fix
for https://sourceforge.net/p/mingw-w64/bugs/397

Workaround that allows to also build on older MinGW-W64 is currently
pending [1] on gnulib ML. If it is accepted, same fix [2] can be applied
to Git copy of poll.c.

[1]: http://lists.gnu.org/archive/html/bug-gnulib/2014-09/msg00076.html
[2]: 
http://git.661346.n2.nabble.com/PATCH-v2-MinGW-W64-cross-compilation-tp7609085p7609093.html

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 02/14] MSVC: config.mak.uname: drop -D__USE_MINGW_ACCESS from CFLAGS

2014-09-28 Thread Marat Radchenko
-D__USE_MINGW_ACCESS only affects MinGW and does nothing when
MSVC is used.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
Acked-by: Eric Faye-Lund kusmab...@gmail.com
---
 config.mak.uname | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/config.mak.uname b/config.mak.uname
index a2f380f..20cbdcf 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -368,7 +368,7 @@ ifeq ($(uname_S),Windows)
COMPAT_OBJS = compat/msvc.o compat/winansi.o \
compat/win32/pthread.o compat/win32/syslog.o \
compat/win32/dirent.o
-   COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DNOGDI -DHAVE_STRING_H -Icompat 
-Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\.exe\
+   COMPAT_CFLAGS = -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex 
-Icompat/win32 -DSTRIP_EXTENSION=\.exe\
BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -SUBSYSTEM:CONSOLE
EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib 
invalidcontinue.obj
PTHREAD_LIBS =
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 06/14] MINGW: compat/winansi.c: do not redefine CONSOLE_FONT_INFOEX

2014-09-28 Thread Marat Radchenko
Unlike MinGW, MinGW-W64 has CONSOLE_FONT_INFOEX already properly defined
in wincon.h.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 compat/winansi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/compat/winansi.c b/compat/winansi.c
index efc5bb3..0ac3297 100644
--- a/compat/winansi.c
+++ b/compat/winansi.c
@@ -22,7 +22,7 @@ static int non_ascii_used = 0;
 static HANDLE hthread, hread, hwrite;
 static HANDLE hconsole1, hconsole2;
 
-#ifdef __MINGW32__
+#if defined(__MINGW32__)  !defined(__MINGW64_VERSION_MAJOR)
 typedef struct _CONSOLE_FONT_INFOEX {
ULONG cbSize;
DWORD nFont;
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 01/14] MINGW: compat/mingw.h: do not attempt to redefine lseek on mingw-w64

2014-09-28 Thread Marat Radchenko
Unlike MinGW, MinGW-W64 has lseek already properly defined in io.h.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
Acked-by: Eric Faye-Lund kusmab...@gmail.com
---
 compat/mingw.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/compat/mingw.h b/compat/mingw.h
index df0e320..ed79368 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -281,7 +281,9 @@ static inline int getrlimit(int resource, struct rlimit 
*rlp)
  * Use mingw specific stat()/lstat()/fstat() implementations on Windows.
  */
 #define off_t off64_t
+#ifndef lseek
 #define lseek _lseeki64
+#endif
 
 /* use struct stat with 64 bit st_size */
 #ifdef stat
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 04/14] MINGW: do not fail at redefining pid_t on MinGW-W64

2014-09-28 Thread Marat Radchenko
pid_t is available in sys/types.h on both MinGW and MinGW-W64

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
Acked-by: Eric Faye-Lund kusmab...@gmail.com
---
 compat/mingw.h | 1 -
 compat/msvc.h  | 2 ++
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/compat/mingw.h b/compat/mingw.h
index 948a174..d113b19 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -5,7 +5,6 @@
  * things that are not available in header files
  */
 
-typedef int pid_t;
 typedef int uid_t;
 typedef int socklen_t;
 #define hstrerror strerror
diff --git a/compat/msvc.h b/compat/msvc.h
index 580bb55..a63d878 100644
--- a/compat/msvc.h
+++ b/compat/msvc.h
@@ -15,6 +15,8 @@
 #define strtoull _strtoui64
 #define strtoll  _strtoi64
 
+typedef int pid_t;
+
 static __inline int strcasecmp (const char *s1, const char *s2)
 {
int size1 = strlen(s1);
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 09/14] MINGW: config.mak.uname: reorganize MinGW settings

2014-09-28 Thread Marat Radchenko
HAVE_LIBCHARSET_H and NO_R_TO_GCC_LINKER are not specific to
msysGit, they're general MinGW settings.

Logic behind HAVE_LIBCHARSET_H: if user is on MinGW and has iconv,
we expect him to have libcharset.h. If user doesn't have iconv,
he has to explicitly say so via NO_ICONV=1 regardless of this
commit.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 config.mak.uname | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/config.mak.uname b/config.mak.uname
index c7aaa1c..f79c0e0 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -532,11 +532,11 @@ ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
prefix =
INSTALL = /bin/install
EXTLIBS += /mingw/lib/libz.a
-   NO_R_TO_GCC_LINKER = YesPlease
INTERNAL_QSORT = YesPlease
-   HAVE_LIBCHARSET_H = YesPlease
NO_GETTEXT = YesPlease
 endif
+   HAVE_LIBCHARSET_H = YesPlease
+   NO_R_TO_GCC_LINKER = YesPlease
 endif
 ifeq ($(uname_S),QNX)
COMPAT_CFLAGS += -DSA_RESTART=0
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 03/14] MINGW: compat/mingw.h: drop fork() definition

2014-09-28 Thread Marat Radchenko
fork() is not used in MinGW builds but causes a compiler warning
on x86_64 MinGW-W64: conflicting types for built-in function 'fork'

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
Acked-by: Eric Faye-Lund kusmab...@gmail.com
---
 compat/mingw.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/compat/mingw.h b/compat/mingw.h
index ed79368..948a174 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -93,8 +93,6 @@ static inline int symlink(const char *oldpath, const char 
*newpath)
 { errno = ENOSYS; return -1; }
 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 unsigned int alarm(unsigned int seconds)
 { return 0; }
 static inline int fsync(int fd)
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 10/14] Makefile: introduce CROSS_COMPILE variable

2014-09-28 Thread Marat Radchenko
To ease cross-compilation process, introduce a single variable
with the prefix to all compiler-related executables.

Define CROSS_COMPILE=foo- if your compiler and binary utilities
are foo-cc, foo-ar, foo-strip, etc.  More specific variables
override this, so if you set CC=gcc CROSS_COMPILE=ia64-linux-gnu-
then the compiler will be 'gcc', not 'ia64-linux-gnu-gcc'.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 Makefile | 19 +--
 config.mak.uname |  2 +-
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index f34a2d4..c412996 100644
--- a/Makefile
+++ b/Makefile
@@ -339,6 +339,11 @@ all::
 # return NULL when it receives a bogus time_t.
 #
 # Define HAVE_CLOCK_GETTIME if your platform has clock_gettime in librt.
+#
+# Define CROSS_COMPILE=foo- if your compiler and binary utilities
+# are foo-cc, foo-ar, foo-strip, etc.  More specific variables
+# override this, so if you set CC=gcc CROSS_COMPILE=ia64-linux-gnu-
+# then the compiler will be 'gcc', not 'ia64-linux-gnu-gcc'.
 
 GIT-VERSION-FILE: FORCE
@$(SHELL_PATH) ./GIT-VERSION-GEN
@@ -350,7 +355,6 @@ CFLAGS = -g -O2 -Wall
 LDFLAGS =
 ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS)
 ALL_LDFLAGS = $(LDFLAGS)
-STRIP ?= strip
 
 # Among the variables below, these:
 #   gitexecdir
@@ -390,8 +394,12 @@ htmldir_relative = $(patsubst $(prefix)/%,%,$(htmldir))
 
 export prefix bindir sharedir sysconfdir gitwebdir localedir
 
-CC = cc
-AR = ar
+AR = $(CROSS_COMPILE)ar
+CC = $(CROSS_COMPILE)cc
+GCOV = $(CROSS_COMPILE)gcov
+RC = $(CROSS_COMPILE)windres
+STRIP = $(CROSS_COMPILE)strip
+
 RM = rm -f
 DIFF = diff
 TAR = tar
@@ -404,13 +412,12 @@ XGETTEXT = xgettext
 MSGFMT = msgfmt
 PTHREAD_LIBS = -lpthread
 PTHREAD_CFLAGS =
-GCOV = gcov
 
 export TCL_PATH TCLTK_PATH
 
 SPARSE_FLAGS =
 
-
+RCFLAGS =
 
 ### --- END CONFIGURATION SECTION ---
 
@@ -1669,7 +1676,7 @@ $(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEFINES
mv $@+ $@
 
 git.res: git.rc GIT-VERSION-FILE
-   $(QUIET_RC)$(RC) \
+   $(QUIET_RC)$(RC) $(RCFLAGS) \
  $(join -DMAJOR= -DMINOR=, $(wordlist 1,2,$(subst -, ,$(subst ., 
,$(GIT_VERSION) \
  -DGIT_VERSION=\\\$(GIT_VERSION)\\\ $ -o $@
 
diff --git a/config.mak.uname b/config.mak.uname
index f79c0e0..9f7037e 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -523,7 +523,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
EXTLIBS += -lws2_32
GITLIBS += git.res
PTHREAD_LIBS =
-   RC = windres -O coff
+   RCFLAGS += -O coff
NATIVE_CRLF = YesPlease
X = .exe
SPARSE_FLAGS = -Wno-one-bit-signed-bitfield
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 11/14] compat/nedmalloc/malloc.c.h: fix compilation under MinGW-W64

2014-09-28 Thread Marat Radchenko
1. Unlike MinGW, MinGW-W64 already provides _ReadWriteBarrier macro,
   so don't try to redefine it.

2. MinGW-W64 has a strange definition FORCEINLINE as
   extern __inline__ __attribute__((__always_inline__,__gnu_inline__))

   'extern' doesn't work together with 'static', so #undef MinGW-W64
   version of FORCEINLINE.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 compat/nedmalloc/malloc.c.h | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/compat/nedmalloc/malloc.c.h b/compat/nedmalloc/malloc.c.h
index f216a2a..a6c8cac 100644
--- a/compat/nedmalloc/malloc.c.h
+++ b/compat/nedmalloc/malloc.c.h
@@ -715,6 +715,10 @@ struct mallinfo {
 #endif /* HAVE_USR_INCLUDE_MALLOC_H */
 #endif /* NO_MALLINFO */
 
+#ifdef __MINGW64_VERSION_MAJOR
+  #undef FORCEINLINE
+#endif
+
 /*
   Try to persuade compilers to inline. The most critical functions for
   inlining are defined as macros, so these aren't used for them.
@@ -1382,7 +1386,9 @@ LONG __cdecl _InterlockedExchange(LONG volatile *Target, 
LONG Value);
 
   /*** Atomic operations ***/
   #if (__GNUC__ * 1 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)  40100
-#define _ReadWriteBarrier() __sync_synchronize()
+#ifndef _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.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 14/14] MINGW: config.mak.uname: auto-detect MinGW build from compiler

2014-09-28 Thread Marat Radchenko
When crosscompiling, one cannot rely on `uname` from host system.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 config.mak.uname | 5 +
 1 file changed, 5 insertions(+)

diff --git a/config.mak.uname b/config.mak.uname
index 9f7037e..182da50 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -14,6 +14,11 @@ ifdef MSVC
uname_O := Windows
 endif
 
+ifneq (,$(findstring mingw,$(CC_MACH)))
+   uname_S := MINGW
+   uname_O := MINGW
+endif
+
 # We choose to avoid if .. else if .. else .. endif endif
 # because maintaining the nesting to match is a pain.  If
 # we had elif things would have been much nicer...
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 12/14] Fix pointer - integer casts on IL32P64 systems

2014-09-28 Thread Marat Radchenko
This commit touches regcomp.c and poll.c from Gnulib,
both were fixed upstream in 2012 the same way.

Wrt ShellExecute, see [1].

[1]: http://blogs.msdn.com/b/oldnewthing/archive/2006/11/08/1035971.aspx

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 compat/mingw.c | 8 
 compat/poll/poll.c | 2 +-
 compat/regex/regcomp.c | 4 ++--
 compat/win32/pthread.h | 2 +-
 compat/winansi.c   | 2 +-
 pack-revindex.c| 2 +-
 sha1_file.c| 8 
 7 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/compat/mingw.c b/compat/mingw.c
index c5c37e5..27925d9 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -674,13 +674,13 @@ int pipe(int filedes[2])
errno = err_win_to_posix(GetLastError());
return -1;
}
-   filedes[0] = _open_osfhandle((int)h[0], O_NOINHERIT);
+   filedes[0] = _open_osfhandle((intptr_t)h[0], O_NOINHERIT);
if (filedes[0]  0) {
CloseHandle(h[0]);
CloseHandle(h[1]);
return -1;
}
-   filedes[1] = _open_osfhandle((int)h[1], O_NOINHERIT);
+   filedes[1] = _open_osfhandle((intptr_t)h[1], O_NOINHERIT);
if (filedes[0]  0) {
close(filedes[0]);
CloseHandle(h[1]);
@@ -1819,7 +1819,7 @@ void mingw_open_html(const char *unixpath)
const char *, const char *, const char *, INT);
T ShellExecute;
HMODULE shell32;
-   int r;
+   intptr_t r;
 
shell32 = LoadLibrary(shell32.dll);
if (!shell32)
@@ -1829,7 +1829,7 @@ void mingw_open_html(const char *unixpath)
die(cannot run browser);
 
printf(Launching default browser to display HTML ...\n);
-   r = (int)ShellExecute(NULL, open, htmlpath, NULL, \\, 
SW_SHOWNORMAL);
+   r = (intptr_t)ShellExecute(NULL, open, htmlpath, NULL, \\, 
SW_SHOWNORMAL);
FreeLibrary(shell32);
/* see the MSDN documentation referring to the result codes here */
if (r = 32) {
diff --git a/compat/poll/poll.c b/compat/poll/poll.c
index a9b41d8..8941249 100644
--- a/compat/poll/poll.c
+++ b/compat/poll/poll.c
@@ -76,7 +76,7 @@
 
 #ifdef WIN32_NATIVE
 
-#define IsConsoleHandle(h) (((long) (h)  3) == 3)
+#define IsConsoleHandle(h) (((intptr_t) (h)  3) == 3)
 
 static BOOL
 IsSocketHandle (HANDLE h)
diff --git a/compat/regex/regcomp.c b/compat/regex/regcomp.c
index 06f3088..d8bde06 100644
--- a/compat/regex/regcomp.c
+++ b/compat/regex/regcomp.c
@@ -2577,7 +2577,7 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, 
re_dfa_t *dfa,
 old_tree = NULL;
 
   if (elem-token.type == SUBEXP)
-postorder (elem, mark_opt_subexp, (void *) (long) elem-token.opr.idx);
+postorder (elem, mark_opt_subexp, (void *) (intptr_t) elem-token.opr.idx);
 
   tree = create_tree (dfa, elem, NULL, (end == -1 ? OP_DUP_ASTERISK : OP_ALT));
   if (BE (tree == NULL, 0))
@@ -3806,7 +3806,7 @@ create_token_tree (re_dfa_t *dfa, bin_tree_t *left, 
bin_tree_t *right,
 static reg_errcode_t
 mark_opt_subexp (void *extra, bin_tree_t *node)
 {
-  int idx = (int) (long) extra;
+  int idx = (int) (intptr_t) extra;
   if (node-token.type == SUBEXP  node-token.opr.idx == idx)
 node-token.opt_subexp = 1;
 
diff --git a/compat/win32/pthread.h b/compat/win32/pthread.h
index 8ad1873..6ccfb7b 100644
--- a/compat/win32/pthread.h
+++ b/compat/win32/pthread.h
@@ -77,7 +77,7 @@ extern pthread_t pthread_self(void);
 
 static inline int pthread_exit(void *ret)
 {
-   ExitThread((DWORD)ret);
+   ExitThread((DWORD)(uintptr_t)ret);
 }
 
 typedef DWORD pthread_key_t;
diff --git a/compat/winansi.c b/compat/winansi.c
index 0ac3297..ca4c295 100644
--- a/compat/winansi.c
+++ b/compat/winansi.c
@@ -452,7 +452,7 @@ static HANDLE duplicate_handle(HANDLE hnd)
HANDLE hresult, hproc = GetCurrentProcess();
if (!DuplicateHandle(hproc, hnd, hproc, hresult, 0, TRUE,
DUPLICATE_SAME_ACCESS))
-   die_lasterr(DuplicateHandle(%li) failed, (long) hnd);
+   die_lasterr(DuplicateHandle(%p) failed, hnd);
return hresult;
 }
 
diff --git a/pack-revindex.c b/pack-revindex.c
index 5c8376e..df02e9f 100644
--- a/pack-revindex.c
+++ b/pack-revindex.c
@@ -21,7 +21,7 @@ static int pack_revindex_hashsz;
 
 static int pack_revindex_ix(struct packed_git *p)
 {
-   unsigned long ui = (unsigned long)p;
+   uintptr_t ui = (uintptr_t)p;
int i;
 
ui = ui ^ (ui  16); /* defeat structure alignment */
diff --git a/sha1_file.c b/sha1_file.c
index c08c0cb..a534fda 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -1966,11 +1966,11 @@ static struct delta_base_cache_entry {
enum object_type type;
 } delta_base_cache[MAX_DELTA_CACHE];
 
-static unsigned long pack_entry_hash(struct packed_git *p, off_t base_offset)
+static uintptr_t pack_entry_hash(struct packed_git *p, off_t base_offset)
 {
-   unsigned long hash;
+   uintptr_t hash

[PATCH 13/14] git-compat-util.h: fix integer overflow on IL32P64 systems

2014-09-28 Thread Marat Radchenko
Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 git-compat-util.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/git-compat-util.h b/git-compat-util.h
index 9d2d5ab..5f6659c 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -474,7 +474,7 @@ extern int git_munmap(void *start, size_t length);
 #endif
 
 #define DEFAULT_PACKED_GIT_LIMIT \
-   ((1024L * 1024L) * (sizeof(void*) = 8 ? 8192 : 256))
+   ((size_t)(1024L * 1024L) * (sizeof(void*) = 8 ? 8192 : 256))
 
 #ifdef NO_PREAD
 #define pread git_pread
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[ANNOUNCE] git-as-svn: subversion frontend server for git repository

2014-09-09 Thread Marat Radchenko
Some time ago I complained [1] about troubles using Git
on a project with high ratio of non-programmers.

Since then, a conclusion was made: Git is too complex.
While Git provides many nice advanced stuff, its simplest
workflow isn't simple enough.

So we examined other options:

  * Splitting project in two repos (Git + SVN). It was
thought to be the worst idea because we lost commit
atomicity

  * Use GitHub SVN integration [2]. Rejected due to security
considerations: our closed-source project isn't allowed to be
hosted outside.

  * Use GitHub Enterprise: rejected due to pricing

  * Use SubGit [3]: rejected because of its architecture.

Then, a lost'n'forgotten git_svn_server [4] was found. After playing
with it, we found out that its approach can work, though several
decisions (Python and extensive forking of `git`) made it very slow.

So we thought we're programmers, after all.

And that's when *git-as-svn* [5] was born. It is a daemon that sits
on top of Git repository and talks svn:// protocol.

Features supported:

  * checkout/update

  * log

  * blame

 
  * commit (!)  
 

 
  * rename detection (though a bit slow yet)
 

 
  * svn:eol-style   
 

 
  * Git pre-receive hooks   
 

 
  * simple or LDAP authentication   
 

 
  * partial checkout
 

 
  * sparse working copy (svn --depth/--set-depth)   
 

 
  * git submodules  
 

 
Current limitations:
 

 
  * Only a single Git branch from a single repository

  * Needs at least one commit in Git

  * Parses whole history on startup and doesn't cache it anywhere

  * You must not do 'inverted merges'. Old HEAD must be reachable from
new HEAD by first-parent traversal.

[1]: http://marc.info/?l=gitm=13980018802
[2]: https://help.github.com/articles/support-for-subversion-clients
[3]: http://subgit.com/
[4]: http://git.q42.co.uk/git_svn_server.git
[5]: https://github.com/bozaro/git-as-svn/
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [ANNOUNCE] git-as-svn: subversion frontend server for git repository

2014-09-09 Thread Marat Radchenko
On Tue, Sep 09, 2014 at 09:49:03AM -0700, Junio C Hamano wrote:
 Marat Radchenko ma...@slonopotamus.org writes:
 
  Some time ago I complained [1] about troubles using Git
  on a project with high ratio of non-programmers.
  ...
  Then, a lost'n'forgotten git_svn_server [4] was found.
  ...
 
 Interesting.

Actually, no. As I said, git_svn_server made several ineffective
architectural choices. It can be viewed as a proof-of-concept work though.

  Current limitations:
  ...
* You must not do 'inverted merges'. Old HEAD must be reachable from
  new HEAD by first-parent traversal.
 
 I am not sure what you mean by this to properly assess how
 significant this limitation is.  Care to draw a simple picture?

SVN doesn't support nonlinear history (except merge-info crutch).

Thus, we only expose main history line to SVN where main means
reachable through first-parent traversal from branch tip.

To keep SVN history consistent, commits that once became visible to SVN
have to remain visible. This limitation will be removed when git-as-svn
gets persistent storage and will be able to remember what *was* main line.

Imagine you had following history:

--- time ---

A -- B -- C

Now you merge (via Git) a feature branch:

A -- B -- C -- G
 \/
  D -- E --- F

For SVN, history will look this way:

A -- B -- C -- F

We might introduce merge-info support for this one day.

And now the *bad* case. You have the same initial history but do *inverted 
merge*:

A -- D -- E -- F -- G'
 \ /
  B -- C -/
   ^
   |
Previous branch tip

That's where things brake because for SVN, history transforms from

A -- B -- C

to

A -- D -- E -- F -- G'

And all users who checked out revisions B  C get their working copies screwed.

This also means that push --force also must not be performed.

Quoting my initial post [1] about inverted merges (you might call them
merges with swapped parents).

 I call it swapped/reverse merge problem.

 In short:
 1. Hack, hack, hack
 2. Commit
 3. Push, woops, reject (non-ff)
 4. Pull
 5. Push

 The root of evil is step #4 that creates a merge commit with swapped 
 parents - 
 local commits become first parent, remote commits become second. If one would 
 want to 
 make proper parent order, he would have to: 1. git fetch
 2. git checkout origin/master -b tmp
 3. git merge master
 4. git push
 5. git checkout master
 6. git merge origin/master
 7. git branch -d tmp
 
 And all this branch dance produces exactly the same commit (content-wise) as 
 simple
 pull, push sequence with the only difference in parent order. And things 
 become
 even worse if comeone pushes more commits to remote repo while you perform 
 this
 dance.

 We can't expect all developers (especially, designers and artist) to do it. 
 They
 don't want to use branches and just work on mainline. This is especially 
 important on
 early development stages when new features (that designers' work depends 
 upon) are
 added every day.

 Additionally, many git-related tools depend on first-parent convention and 
 show wrong
 graphs/diffs.

[1] http://marc.info/?l=gitm=13980018802
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[BUG] git push writes to stderr instead of stdout on success

2014-05-19 Thread Marat Radchenko
`git push` writes to stderr instead of stdout

Steps to reproduce:

  mkdir foo
  cd foo
  git init
  echo foo  fo
  git add -A
  git commit -am foo
  git push . HEAD:refs/heads/newbranch 2out

Expected: `out` file is empty

Actual: `out` file contents:

To .
 * [new branch]  HEAD - newbranch
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [BUG] git push writes to stderr instead of stdout on success

2014-05-19 Thread Marat Radchenko
On Mon, May 19, 2014 at 11:49:09AM -0400, Jeff King wrote:
 On Mon, May 19, 2014 at 07:03:58PM +0400, Marat Radchenko wrote:
 
  `git push` writes to stderr instead of stdout
 
 That's by design.
 
 Which one is correct is largely a matter of philosophy / mental model.
 This case has been discussed before:
 
   http://thread.gmane.org/gmane.comp.version-control.git/180673
 
 Keep in mind also that git push --porcelain does go to stdout and is
 machine-parsed, so no other messages can go to stdout when that option
 is enabled.

Oh, missed --porcelain switch. Thanks.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 10/12] MINGW: compat/poll/poll.c: undef NOGDI

2014-05-04 Thread Marat Radchenko
On Sun, May 04, 2014 at 08:52:44PM +0200, Stepan Kasal wrote:
 Thank you very much for this analysis.
 It enables us to redirect you the third time: to report this as a
 bug in MinGW-W64 !  ;-)

I'll report this to MinGW-W64 soon, though even if/when they fix
the issue on their side, I'd still like to have a workaround in
Git to be able to use older MinGW-W64 versions that didn't
receive a fix.

 Seriously, it looks you found the best description of the problem,
 and it would be nice if you could modify your patch so that it
 is really a work around: it would be in effect only for MinGW-W64,
 and the comment would explain that this is a hack to work around the
 bug.  

Workarounds do not have to be ugly and full of #ifdef's.

 If you manage to change the defs for poll.c without changing its
 content, no one could tell you to report to gnulib first.

v1 does exactly this.

 OTOH, if MsgWaitForMultipleObjects is present ustream (in gnulib's
 poll.c, sorry that I cannot check right now), it still might be
 better to submit the work-around there first.

Workaround is just don't pass -DNOGDI on MinGW-W64 if you want
MsgWaitForMultipleObjects, there's nothing to send to gnulib.
After all, was there a strong reason why Git started passing it?
What is there was no option to disable part of windows.h?
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] MSVC: link dynamically to the CRT

2014-05-03 Thread Marat Radchenko
On Wed, Apr 30, 2014 at 12:54:15PM -0700, Junio C Hamano wrote:
 Sebastian Schuberth sschube...@gmail.com writes:
 
  On 30.04.2014 20:36, Junio C Hamano wrote:
 
  I am not intimate with the msysgit developer community, and I do not
  know if it is appropriate for me to respond with a
 
 Does this look OK with msysgit folks?
 
  This patch has been carried in the msysgit tree since more than 3
  years, although strictly speaking it does not affect the msysgit build
  but only the MSVC build. Stefan is just bringing Karsten's patch
  upstream with this patch.
 
  So yes, this is fine.
 
  cc'ed to the usual suspects (Erik Faye-Lund, Dscho and J6t).  Just
  like I do not have to ask does this look ok? question when seeing
  a patch from Erik or J6t, is it unnecessary for me to do so for a
  patch from you?
 
  I'm putting Marat in CC who has been recently active in building Git
  with MSVC.
 
 Thanks, very much appreciated.

Ack from me, sorry for delay.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 10/12] MINGW: compat/poll/poll.c: undef NOGDI

2014-05-03 Thread Marat Radchenko
On Wed, Apr 30, 2014 at 01:41:25PM +0200, Stepan Kasal wrote:
 Hello,
 
 On Tue, Apr 29, 2014 at 01:12:04PM +0400, Marat Radchenko wrote:
  On MinGW-W64, MsgWaitForMultipleObjects is guarded with #ifndef NOGDI.
  
  Removal -DNOGDI=1 from config.mak.uname has an undesirable effect of
  bringing in wingdi.h with weird #define ERROR 0 that conflicts with
  internal Git enums. So, just #undef NOGDI in compat/poll/poll.c.
 
 compat/poll/poll.c comes from Gnulib, so it would be better to submit
 the patch there and then backport so that the divergence of the two
 versions does not get worse.

That's why v1 of this patch [1] didn't touch poll.c at all.
I don't think it's gnulib problem that combination of two third-parties
(git and mingw-w64) set up such conditions where poll.c fails to compile.

If one wants to dig deeper, I'd say the problem is in MinGW-W64 headers
because their behavior of hiding MsgWaitForMultipleObjects doesn't
match behavior of MSVC headers.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 08/12] MINGW: fix main() signature in http-fetch.c and remote-curl.c

2014-05-03 Thread Marat Radchenko
On Wed, Apr 30, 2014 at 10:35:56AM +0200, Karsten Blees wrote:
 Am 29.04.2014 11:12, schrieb Marat Radchenko:
  On MinGW, compat/mingw.h defines a 'mingw_main' wrapper function.
  Fix `warning: passing argument 2 of 'mingw_main' from incompatible
  pointer type` in http-fetch.c and remote-curl.c by dropping 'const'.
  
 
 Would you mind cross checking your changes with the msysgit fork?
 Fixing the same thing in a slightly different manner will just cause
 unnecessary conflicts (i.e. unnecessary work for the Git for Windows
 maintainers, as well as for you to come up with an alternate solution
 for something that's long been fixed).

 See https://github.com/msysgit/git/commit/9206e7fd (squashed from
 https://github.com/msysgit/git/commit/0115ef83 and
 https://github.com/msysgit/git/commit/6949537a). 

6949537a is just an unnecessary hack and would have to be rewritten
no matter who would try to submit it upstream.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 10/12] MINGW: config.mak.uname: drop USE_NED_ALLOCATOR

2014-04-29 Thread Marat Radchenko
On Mon, Apr 28, 2014 at 05:23:25PM +0200, Erik Faye-Lund wrote:
 On Mon, Apr 28, 2014 at 3:51 PM, Marat Radchenko ma...@slonopotamus.org 
 wrote:
  nedalloc was initially added in f0ed82 to fix slowness of standard WinXP
  memory allocator. Since WinXP is EOLed, this point is no longer valid.
 
  The actual reason behind this commit is incompatibility of malloc.c.h
  with MinGW-W64 headers. Alternative solution implies updating nedalloc
  to something newer.
 
 Did you measure that malloc on newer Windows-versions are actually
 faster? AFAIK, malloc does a lot more inside the CRT than in the
 kernel...

Windows 8, msysGit.

git repack -adf on msysgit/git (best of 3 runs)

+ nedalloc: 10.5s
- nedalloc: 11s

git repack -adf on torvalds/linux (best of 3 runs)

+ nedalloc: 3m 24s
- nedalloc: 3m 47s

We need to make a decision: drop nedalloc, update nedalloc to later release,
patch nedalloc to make it work under MinGW-W64 or disable nedalloc under
MinGW-W64 (still leaving it enabled under MinGW).

P.S. Waiting for Resolving deltas when cloning torvalds/linux is a pain,
perhaps someone should run gprof on it.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 01/12] MINGW: compat/mingw.h: do not attempt to redefine lseek on mingw-w64

2014-04-29 Thread Marat Radchenko
Unlike MinGW, MinGW-W64 has lseek already properly defined in io.h.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
Acked-by: Eric Faye-Lund kusmab...@gmail.com
---
 compat/mingw.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/compat/mingw.h b/compat/mingw.h
index e033e72..262b300 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -265,7 +265,9 @@ static inline int getrlimit(int resource, struct rlimit 
*rlp)
  * Use mingw specific stat()/lstat()/fstat() implementations on Windows.
  */
 #define off_t off64_t
+#ifndef lseek
 #define lseek _lseeki64
+#endif
 
 /* use struct stat with 64 bit st_size */
 #ifdef stat
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] MinGW(-W64) cross-compilation

2014-04-29 Thread Marat Radchenko
Differences with v1:
 - Dropped MINGW: compat/bswap.h: include stdint.h, it isn't needed after
   MINGW: git-compat-util.h: use inttypes.h for printf macros
 - Split MINGW: config.mak.uname allow using CURL for non-msysGit builds
   into MINGW: config.mak.uname: allow using cURL for non-msysGit builds
   and MINGW: fix main() signature in http-fetch.c and remote-curl.c
 - Reworded MINGW: git-compat-util.h: use inttypes.h for printf macros
 - Reworded MINGW: config.mak.uname: reorganize MINGW settings
 - Rewrote MINGW: config.mak.uname: drop -DNOGDI into
   MINGW: compat/poll/poll.c: undef NOGDI
 - Rewrote MINGW: config.mak.uname: drop USE_NED_ALLOCATOR into
   compat/nedmalloc/malloc.c.h: fix compilation under MinGW-W64
 - Reworded Makefile: introduce CROSS_COMPILE variable
 - Reordeder commits (1-5 are Acked by: Eric Faye-Lund kusmab...@gmail.com)

=

This patch series fixes building on modern MinGW and (32bit only yet) MinGW-W64.

*Compilation* tested on:
 - MSVC (via WinGit environment)
 - msysGit environment
 - Linux cross-toolchain i686-pc-mingw32 (4.8.2) with mingw-runtime-3.20.2
 - Linux cross-toolchain i686-w64-mingw32 (4.8.2) with mingw64-runtime-3.1.0

Stuff still required to make Git build with x86_64 MinGW-W64 toolchain:

1. Drop -D_USE_32BIT_TIME_T that was added in fa93bb to config.mak.uname
because time_t cannot be 32bit on x86_64. I haven't yet figured out what
should break if this define is removed (pointers are welcome) and why it was
added in the first place.

2. Stop passing --large-address-aware to linker. I wonder if it does anything
for 32bit MinGW builds.

3. Fix several places with mismatched pointer size casts.

Building it from Gentoo Linux:

MinGW:

  crossdev -t i686-pc-mingw32
  ARCH=x86 emerge-i686-pc-mingw32 -u dev-libs/libiconv sys-libs/zlib 
net-misc/curl sys-devel/gettext expat
  cd git
  make CROSS_COMPILE=i686-pc-mingw32- NO_OPENSSL=1 MINGW=1 
CURLDIR=/usr/i686-pc-mingw32/usr

MinGW-W64 (32 bit):

  crossdev -t i686-w64-mingw32
  ARCH=x86 emerge-i686-w64-mingw32 -u dev-libs/libiconv sys-libs/zlib 
net-misc/curl sys-devel/gettext expat
  cd git
  make CROSS_COMPILE=i686-w64-mingw32- NO_OPENSSL=1 MINGW=1 
CURLDIR=/usr/i686-w64-mingw32/usr

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 09/12] Makefile: introduce CROSS_COMPILE variable

2014-04-29 Thread Marat Radchenko
To ease cross-compilation process, introduce a single variable
with the prefix to all compiler-related executables.

Define CROSS_COMPILE=foo- if your compiler and binary utilities
are foo-cc, foo-ar, foo-strip, etc.  More specific variables
override this, so if you set CC=gcc CROSS_COMPILE=ia64-linux-gnu-
then the compiler will be 'gcc', not 'ia64-linux-gnu-gcc'.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 Makefile | 19 +--
 config.mak.uname |  2 +-
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index 74a929b..8406b94 100644
--- a/Makefile
+++ b/Makefile
@@ -350,6 +350,11 @@ all::
 #
 # Define GMTIME_UNRELIABLE_ERRORS if your gmtime() function does not
 # return NULL when it receives a bogus time_t.
+#
+# Define CROSS_COMPILE=foo- if your compiler and binary utilities
+# are foo-cc, foo-ar, foo-strip, etc.  More specific variables
+# override this, so if you set CC=gcc CROSS_COMPILE=ia64-linux-gnu-
+# then the compiler will be 'gcc', not 'ia64-linux-gnu-gcc'.
 
 GIT-VERSION-FILE: FORCE
@$(SHELL_PATH) ./GIT-VERSION-GEN
@@ -361,7 +366,6 @@ CFLAGS = -g -O2 -Wall
 LDFLAGS =
 ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS)
 ALL_LDFLAGS = $(LDFLAGS)
-STRIP ?= strip
 
 # Among the variables below, these:
 #   gitexecdir
@@ -401,8 +405,12 @@ htmldir_relative = $(patsubst $(prefix)/%,%,$(htmldir))
 
 export prefix bindir sharedir sysconfdir gitwebdir localedir
 
-CC = cc
-AR = ar
+AR = $(CROSS_COMPILE)ar
+CC = $(CROSS_COMPILE)cc
+GCOV = $(CROSS_COMPILE)gcov
+RC = $(CROSS_COMPILE)windres
+STRIP = $(CROSS_COMPILE)strip
+
 RM = rm -f
 DIFF = diff
 TAR = tar
@@ -415,13 +423,12 @@ XGETTEXT = xgettext
 MSGFMT = msgfmt
 PTHREAD_LIBS = -lpthread
 PTHREAD_CFLAGS =
-GCOV = gcov
 
 export TCL_PATH TCLTK_PATH
 
 SPARSE_FLAGS =
 
-
+RCFLAGS =
 
 ### --- END CONFIGURATION SECTION ---
 
@@ -1796,7 +1803,7 @@ $(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEFINES
mv $@+ $@
 
 git.res: git.rc GIT-VERSION-FILE
-   $(QUIET_RC)$(RC) \
+   $(QUIET_RC)$(RC) $(RCFLAGS) \
  $(join -DMAJOR= -DMINOR=, $(wordlist 1,2,$(subst -, ,$(subst ., 
,$(GIT_VERSION) \
  -DGIT_VERSION=\\\$(GIT_VERSION)\\\ $ -o $@
 
diff --git a/config.mak.uname b/config.mak.uname
index b68a7d1..d5f7953 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -507,7 +507,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
EXTLIBS += -lws2_32
GITLIBS += git.res
PTHREAD_LIBS =
-   RC = windres -O coff
+   RCFLAGS += -O coff
NATIVE_CRLF = YesPlease
X = .exe
SPARSE_FLAGS = -Wno-one-bit-signed-bitfield
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 02/12] MSVC: config.mak.uname: drop -D__USE_MINGW_ACCESS from CFLAGS

2014-04-29 Thread Marat Radchenko
-D__USE_MINGW_ACCESS only affects MinGW and does nothing when
MSVC is used.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
Acked-by: Eric Faye-Lund kusmab...@gmail.com
---
 config.mak.uname | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/config.mak.uname b/config.mak.uname
index 23a8803..faddb82 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -357,7 +357,7 @@ ifeq ($(uname_S),Windows)
COMPAT_OBJS = compat/msvc.o compat/winansi.o \
compat/win32/pthread.o compat/win32/syslog.o \
compat/win32/dirent.o
-   COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DNOGDI -DHAVE_STRING_H 
-DHAVE_ALLOCA_H -Icompat -Icompat/regex -Icompat/win32 
-DSTRIP_EXTENSION=\.exe\
+   COMPAT_CFLAGS = -DNOGDI -DHAVE_STRING_H -DHAVE_ALLOCA_H -Icompat 
-Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\.exe\
BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -SUBSYSTEM:CONSOLE 
-NODEFAULTLIB:MSVCRT.lib
EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib 
invalidcontinue.obj
PTHREAD_LIBS =
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 03/12] MINGW: compat/mingw.h: drop fork() definition

2014-04-29 Thread Marat Radchenko
fork() is not used in MinGW builds but causes a compiler warning
on x86_64 MinGW-W64: conflicting types for built-in function 'fork'

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
Acked-by: Eric Faye-Lund kusmab...@gmail.com
---
 compat/mingw.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/compat/mingw.h b/compat/mingw.h
index 262b300..87d58ba 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -90,8 +90,6 @@ static inline int symlink(const char *oldpath, const char 
*newpath)
 { errno = ENOSYS; return -1; }
 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 unsigned int alarm(unsigned int seconds)
 { return 0; }
 static inline int fsync(int fd)
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 08/12] MINGW: fix main() signature in http-fetch.c and remote-curl.c

2014-04-29 Thread Marat Radchenko
On MinGW, compat/mingw.h defines a 'mingw_main' wrapper function.
Fix `warning: passing argument 2 of 'mingw_main' from incompatible
pointer type` in http-fetch.c and remote-curl.c by dropping 'const'.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 http-fetch.c  | 5 +++--
 remote-curl.c | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/http-fetch.c b/http-fetch.c
index ba3ea10..a6a9a2f 100644
--- a/http-fetch.c
+++ b/http-fetch.c
@@ -6,7 +6,7 @@
 static const char http_fetch_usage[] = git http-fetch 
 [-c] [-t] [-a] [-v] [--recover] [-w ref] [--stdin] commit-id url;
 
-int main(int argc, const char **argv)
+int main(int argc, char **argv)
 {
struct walker *walker;
int commits_on_stdin = 0;
@@ -38,7 +38,8 @@ int main(int argc, const char **argv)
} else if (argv[arg][1] == 'v') {
get_verbosely = 1;
} else if (argv[arg][1] == 'w') {
-   write_ref = argv[arg + 1];
+   const char *ref = argv[arg + 1];
+   write_ref = ref;
arg++;
} else if (argv[arg][1] == 'h') {
usage(http_fetch_usage);
diff --git a/remote-curl.c b/remote-curl.c
index 52c2d96..565b6c9 100644
--- a/remote-curl.c
+++ b/remote-curl.c
@@ -938,7 +938,7 @@ static void parse_push(struct strbuf *buf)
free(specs);
 }
 
-int main(int argc, const char **argv)
+int main(int argc, char **argv)
 {
struct strbuf buf = STRBUF_INIT;
int nongit;
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 04/12] MINGW: do not fail at redefining pid_t on MinGW-W64

2014-04-29 Thread Marat Radchenko
pid_t is available in sys/types.h on both MinGW and MinGW-W64

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
Acked-by: Eric Faye-Lund kusmab...@gmail.com
---
 compat/mingw.h | 1 -
 compat/msvc.h  | 2 ++
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/compat/mingw.h b/compat/mingw.h
index 87d58ba..7e3d038 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -5,7 +5,6 @@
  * things that are not available in header files
  */
 
-typedef int pid_t;
 typedef int uid_t;
 typedef int socklen_t;
 #define hstrerror strerror
diff --git a/compat/msvc.h b/compat/msvc.h
index 580bb55..a63d878 100644
--- a/compat/msvc.h
+++ b/compat/msvc.h
@@ -15,6 +15,8 @@
 #define strtoull _strtoui64
 #define strtoll  _strtoi64
 
+typedef int pid_t;
+
 static __inline int strcasecmp (const char *s1, const char *s2)
 {
int size1 = strlen(s1);
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 11/12] compat/nedmalloc/malloc.c.h: fix compilation under MinGW-W64

2014-04-29 Thread Marat Radchenko
1. Unlike MinGW, MinGW-W64 already provides _ReadWriteBarrier macro,
   so don't try to redefine it.

2. MinGW-W64 has a strange definition FORCEINLINE as
   extern __inline__ __attribute__((__always_inline__,__gnu_inline__))

   'extern' doesn't work together with 'static', so #undef MinGW-W64
   version of FORCEINLINE.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 compat/nedmalloc/malloc.c.h | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/compat/nedmalloc/malloc.c.h b/compat/nedmalloc/malloc.c.h
index f216a2a..a6c8cac 100644
--- a/compat/nedmalloc/malloc.c.h
+++ b/compat/nedmalloc/malloc.c.h
@@ -715,6 +715,10 @@ struct mallinfo {
 #endif /* HAVE_USR_INCLUDE_MALLOC_H */
 #endif /* NO_MALLINFO */
 
+#ifdef __MINGW64_VERSION_MAJOR
+  #undef FORCEINLINE
+#endif
+
 /*
   Try to persuade compilers to inline. The most critical functions for
   inlining are defined as macros, so these aren't used for them.
@@ -1382,7 +1386,9 @@ LONG __cdecl _InterlockedExchange(LONG volatile *Target, 
LONG Value);
 
   /*** Atomic operations ***/
   #if (__GNUC__ * 1 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)  40100
-#define _ReadWriteBarrier() __sync_synchronize()
+#ifndef _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)
 {
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 10/12] MINGW: compat/poll/poll.c: undef NOGDI

2014-04-29 Thread Marat Radchenko
On MinGW-W64, MsgWaitForMultipleObjects is guarded with #ifndef NOGDI.

Removal -DNOGDI=1 from config.mak.uname has an undesirable effect of
bringing in wingdi.h with weird #define ERROR 0 that conflicts with
internal Git enums. So, just #undef NOGDI in compat/poll/poll.c.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 compat/poll/poll.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/compat/poll/poll.c b/compat/poll/poll.c
index 31163f2..e38cba8 100644
--- a/compat/poll/poll.c
+++ b/compat/poll/poll.c
@@ -38,6 +38,7 @@
 #include assert.h
 
 #if (defined _WIN32 || defined __WIN32__)  ! defined __CYGWIN__
+# undef NOGDI
 # define WIN32_NATIVE
 # if defined (_MSC_VER)  !defined(_WIN32_WINNT)
 #  define _WIN32_WINNT 0x0502
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 07/12] MINGW: config.mak.uname: reorganize MINGW settings

2014-04-29 Thread Marat Radchenko
HAVE_LIBCHARSET_H and NO_R_TO_GCC_LINKER are not specific to
msysGit, they're general MinGW settings.

Logic behind HAVE_LIBCHARSET_H: if user is on MinGW and has iconv,
we expect him to have libcharset.h. If user doesn't have iconv,
he has to explicitly say so via NO_ICONV=1.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 config.mak.uname | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/config.mak.uname b/config.mak.uname
index 50c1114..b68a7d1 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -516,11 +516,11 @@ ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
prefix =
INSTALL = /bin/install
EXTLIBS += /mingw/lib/libz.a
-   NO_R_TO_GCC_LINKER = YesPlease
INTERNAL_QSORT = YesPlease
-   HAVE_LIBCHARSET_H = YesPlease
NO_GETTEXT = YesPlease
 endif
+   HAVE_LIBCHARSET_H = YesPlease
+   NO_R_TO_GCC_LINKER = YesPlease
 endif
 ifeq ($(uname_S),QNX)
COMPAT_CFLAGS += -DSA_RESTART=0
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 05/12] MINGW: config.mak.uname: allow using cURL for non-msysGit builds

2014-04-29 Thread Marat Radchenko
Is it absolutely valid and possible to have cURL in generic
MinGW environment. Building Git without cURL is still possible
by passing NO_CURL=1

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
Acked-by: Eric Faye-Lund kusmab...@gmail.com
---
 config.mak.uname | 2 --
 1 file changed, 2 deletions(-)

diff --git a/config.mak.uname b/config.mak.uname
index faddb82..a626410 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -519,8 +519,6 @@ ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
INTERNAL_QSORT = YesPlease
HAVE_LIBCHARSET_H = YesPlease
NO_GETTEXT = YesPlease
-else
-   NO_CURL = YesPlease
 endif
 endif
 ifeq ($(uname_S),QNX)
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v5 1/6] pull: rename pull.rename to pull.mode

2014-04-29 Thread Marat Radchenko
Felipe Contreras wrote
 [PATCH v5 1/6] pull: rename pull.rename to pull.mode

s/pull.rename/pull.rebase/



--
View this message in context: 
http://git.661346.n2.nabble.com/PATCH-v5-0-6-Reject-non-ff-pulls-by-default-tp7609118p7609129.html
Sent from the git mailing list archive at Nabble.com.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


A failing attempt to use Git in a centralized environment

2014-04-28 Thread Marat Radchenko
Setup:
20 people (programmers, artists, designers) with prior SVN knowledge and a 
desire to use Git for a new project (mostly on programmers side). 
Non-programmers used TortoiseSVN before so choosing TortoiseGit as a GUI was an 
obvios step.

We made an in-house presentation introducing basic Git concepts and how it is 
different from SVN. Also, individual training was done for each person who 
didn't have Git experience. During this training, they tried everyday tasks of 
updating, committing, pushing changes and viewing history on a toy repository. 

Problem #1: TortoiseGit GUI windows for common tasks have a heck lots of 
controls that a common Git user will never need. Just look at a monstrosity of 
its push dialog [1]. This was kinda fixed by training users to use Git Sync 
dialog [2].

Autoload PuTTY key? What the hell is this? Why I can switch it on/off in Git 
Push but it is disabled in Git Sync? What is PuTTY doing here at all, I'm using 
OpenSSH.

Problem #2 occured the first day we started using Git on real project. It is 
explained in detail in older post to Git ML [3]. I call it swapped/reverse 
merge problem.

In short:
1. Hack, hack, hack
2. Commit
3. Push, woops, reject (non-ff)
4. Pull
5. Push

The root of evil is step #4 that creates a merge commit with swapped parents 
- local commits become first parent, remote commits become second. If one would 
want to make proper parent order, he would have to:
1. git fetch
2. git checkout origin/master -b tmp
3. git merge master
4. git push
5. git checkout master
6. git merge origin/master
7. git branch -d tmp

And all this branch dance produces exactly the same commit (content-wise) as 
simple pull, push sequence with the only difference in parent order. And 
things become even worse if comeone pushes more commits to remote repo while 
you perform this dance.

We can't expect all developers (especially, designers and artist) to do it. 
They don't want to use branches and just work on mainline. This is especially 
important on early development stages when new features (that designers' work 
depends upon) are added every day.

Additionally, many git-related tools depend on first-parent convention and show 
wrong graphs/diffs.

Problem #3: on conflicts, user ends up with a working copy that marks all 
remote-changed files as modified. Luckily, nobody has problems with conflict 
resolution process, it's just confusing to see changes other way round.

Okay, then, let's try rebase workflow. git config pull.rebase true and go.

Problem #4: when conflict happens during rebase, mergetool shows user own 
changes as theirs and remote changes as mine. And believe me, explaining 
this to users doesn't increase their willingness to adopt Git.

Problem #5 (TortoiseGit-related): for some dumb reason, TortoiseGit's rebase is 
not a git rebase! Worse, TortoiseGit doesn't have any button to say 'git rebase 
--continue. So we had to cancel pull.rebase=true approach and teach users to 
use FetchRebase button. It would be usable if only TortoiseGit didn't show 
rebase dialog even when everything was already up-to-date. And even git-aware 
developers don't understand the idea behind Force rebase checkbox in rebase 
dialog and why anyone would ever want to have it disabled (and it is disabled 
by default).

Problem #6: push - reject - pull - push sequence sometimes transforms into a 
loop with several iterations and doesn't add happiness.

So... Any suggestions how to make life easier are welcome.

[1] http://tortoisegit.googlecode.com/git/doc/images/en/GitPush.png
[2] http://tortoisegit.googlecode.com/git/doc/images/en/GitSync.png
[3] 
http://git.661346.n2.nabble.com/first-parent-commit-graph-layout-and-pull-merge-direction-td7586671.html

Re: git version 1.9.0 missing git-http-push?

2014-04-28 Thread Marat Radchenko
Silvola Tuomas wrote
 Hello,
 
 I installed git for windows 1.9.0 but any push operation I tried with it
 produced an error message saying git: 'http-push' is not a git command.
 Other commands like pull, add, and commit worked just fine.
 At the end of this day I noticed that C:\Program Files
 (x86)\Git\libexec\git-core just didn't have the file git-http-push. There
 were git-http-backend, git-http-fetch and git-imap-send and such but no
 git-http-push.
 
 I resolved my issue by uninstalling 1.9.0, installing an older version
 instead (1.8.1.2; this is when push started working) and 1.9.0 right on
 top of the older version. Now git push command works as expected.
 
 Br,
 Tuomas Silvola

From Makefile:

curl_check := $(shell (echo 070908; curl-config --vernum) 2/dev/null |
sort -r | sed -ne 2p)
ifeq $(curl_check) 070908
ifndef NO_EXPAT
PROGRAM_OBJS += http-push.o
endif
endif

if there's no curl-config, http-push.c is silently skipped. This check also
doesn't play with cross-compiling when you cannot call curl-config because
it is for other arch.

There's also a mystic git-http-push$X that is not referenced from anywhere.



--
View this message in context: 
http://git.661346.n2.nabble.com/git-version-1-9-0-missing-git-http-push-tp7608787p7608792.html
Sent from the git mailing list archive at Nabble.com.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [msysGit] Re: git version 1.9.0 missing git-http-push?

2014-04-28 Thread Marat Radchenko
On Mon, Apr 28, 2014 at 03:20:46PM +0200, Johannes Schindelin wrote:
 That way, upstream Git does not have anything to change (and we avoid
 discussing five versions of essentially the same patch :-P).

This bug isn't specific to msysGit but also affects all environments
where curl-config is not available or cannot be run for some reason,
for example during cross-compilation.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 01/12] MINGW: config.mak.uname: add explicit way to request MinGW-build

2014-04-28 Thread Marat Radchenko
When crosscompiling, one cannot rely on `uname` from host system.
Thus, add an option to use `make MINGW=1` for building MinGW build
from non-MinGW host (Linux, for example).

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 config.mak.uname | 5 +
 1 file changed, 5 insertions(+)

diff --git a/config.mak.uname b/config.mak.uname
index 23a8803..5d301da 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -13,6 +13,11 @@ ifdef MSVC
uname_O := Windows
 endif
 
+ifdef MINGW
+   uname_S := MINGW
+   uname_O := MINGW
+endif
+
 # We choose to avoid if .. else if .. else .. endif endif
 # because maintaining the nesting to match is a pain.  If
 # we had elif things would have been much nicer...
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 02/12] MINGW: compat/bswap.h: include stdint.h

2014-04-28 Thread Marat Radchenko
bswap.h uses uint32_t type which might not be defined.
This patch adds direct include so bswap.h can be safely included.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 compat/bswap.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/compat/bswap.h b/compat/bswap.h
index 120c6c1..d170447 100644
--- a/compat/bswap.h
+++ b/compat/bswap.h
@@ -5,6 +5,8 @@
  * operation.
  */
 
+#include stdint.h
+
 /*
  * Default version that the compiler ought to optimize properly with
  * constant values.
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 05/12] MINGW: git-compat-util.h: use inttypes.h for printf macros.

2014-04-28 Thread Marat Radchenko
Also, pass -D__USE_MINGW_ANSI_STDIO=0 to select MSVCRT-compatible
macro definitions.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 compat/mingw.h|  2 --
 compat/msvc.h |  3 +++
 config.mak.uname  |  3 ++-
 git-compat-util.h | 11 ++-
 4 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/compat/mingw.h b/compat/mingw.h
index 262b300..c502a22 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -342,8 +342,6 @@ static inline char *mingw_find_last_dir_sep(const char 
*path)
 }
 #define find_last_dir_sep mingw_find_last_dir_sep
 #define PATH_SEP ';'
-#define PRIuMAX I64u
-#define PRId64 I64d
 
 void mingw_open_html(const char *path);
 #define open_html mingw_open_html
diff --git a/compat/msvc.h b/compat/msvc.h
index 580bb55..cb41ce3 100644
--- a/compat/msvc.h
+++ b/compat/msvc.h
@@ -15,6 +15,9 @@
 #define strtoull _strtoui64
 #define strtoll  _strtoi64
 
+#define PRIuMAX I64u
+#define PRId64 I64d
+
 static __inline int strcasecmp (const char *s1, const char *s2)
 {
int size1 = strlen(s1);
diff --git a/config.mak.uname b/config.mak.uname
index 6c2e6df..e5edae6 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -321,6 +321,7 @@ ifeq ($(uname_S),Windows)
NO_PREAD = YesPlease
NEEDS_CRYPTO_WITH_SSL = YesPlease
NO_LIBGEN_H = YesPlease
+   NO_INTTYPES_H = UnfortunatelyYes
NO_POLL = YesPlease
NO_SYMLINK_HEAD = YesPlease
NO_IPV6 = YesPlease
@@ -502,7 +503,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
NO_INET_NTOP = YesPlease
NO_POSIX_GOODIES = UnfortunatelyYes
DEFAULT_HELP_FORMAT = html
-   COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -D_USE_32BIT_TIME_T -DNOGDI 
-Icompat -Icompat/win32
+   COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -D__USE_MINGW_ACCESS 
-D_USE_32BIT_TIME_T -DNOGDI -Icompat -Icompat/win32
COMPAT_CFLAGS += -DSTRIP_EXTENSION=\.exe\
COMPAT_OBJS += compat/mingw.o compat/winansi.o \
compat/win32/pthread.o compat/win32/syslog.o \
diff --git a/git-compat-util.h b/git-compat-util.h
index f6d3a46..aa57a04 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -85,6 +85,12 @@
 #define _NETBSD_SOURCE 1
 #define _SGI_SOURCE 1
 
+#ifndef NO_INTTYPES_H
+#include inttypes.h
+#else
+#include stdint.h
+#endif
+
 #if defined(WIN32)  !defined(__CYGWIN__) /* Both MinGW and MSVC */
 # if defined (_MSC_VER)  !defined(_WIN32_WINNT)
 #  define _WIN32_WINNT 0x0502
@@ -146,11 +152,6 @@
 #include netdb.h
 #include pwd.h
 #include sys/un.h
-#ifndef NO_INTTYPES_H
-#include inttypes.h
-#else
-#include stdint.h
-#endif
 #ifdef NO_INTPTR_T
 /*
  * On I16LP32, ILP32 and LP64 long is the save bet, however
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 07/12] MINGW: config.mak.uname: reorganize MINGW settings

2014-04-28 Thread Marat Radchenko
HAVE_LIBCHARSET_H and NO_R_TO_GCC_LINKER are not specific to
msysGit, they're general MinGW settings.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 config.mak.uname | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/config.mak.uname b/config.mak.uname
index dc87e21..2f1939e 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -521,13 +521,13 @@ ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
prefix =
INSTALL = /bin/install
EXTLIBS += /mingw/lib/libz.a
-   NO_R_TO_GCC_LINKER = YesPlease
INTERNAL_QSORT = YesPlease
-   HAVE_LIBCHARSET_H = YesPlease
NO_GETTEXT = YesPlease
 else
NO_CURL = YesPlease
 endif
+   HAVE_LIBCHARSET_H = YesPlease
+   NO_R_TO_GCC_LINKER = YesPlease
 endif
 ifeq ($(uname_S),QNX)
COMPAT_CFLAGS += -DSA_RESTART=0
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 09/12] MINGW: config.mak.uname: drop -DNOGDI

2014-04-28 Thread Marat Radchenko
On MinGW-W64, MsgWaitForMultipleObjects is guarded with #ifndef NOGDI.

Unfortunately, including wingdi.h brings in #define ERROR 0 which
conflicts with several Git internal enums. So, #undef ERROR.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 config.mak.uname  | 4 ++--
 git-compat-util.h | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/config.mak.uname b/config.mak.uname
index a376b32..4883fd5 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -363,7 +363,7 @@ ifeq ($(uname_S),Windows)
COMPAT_OBJS = compat/msvc.o compat/winansi.o \
compat/win32/pthread.o compat/win32/syslog.o \
compat/win32/dirent.o
-   COMPAT_CFLAGS = -DNOGDI -DHAVE_STRING_H -DHAVE_ALLOCA_H -Icompat 
-Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\.exe\
+   COMPAT_CFLAGS = -DHAVE_STRING_H -DHAVE_ALLOCA_H -Icompat -Icompat/regex 
-Icompat/win32 -DSTRIP_EXTENSION=\.exe\
BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -SUBSYSTEM:CONSOLE 
-NODEFAULTLIB:MSVCRT.lib
EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib 
invalidcontinue.obj
PTHREAD_LIBS =
@@ -503,7 +503,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
NO_INET_NTOP = YesPlease
NO_POSIX_GOODIES = UnfortunatelyYes
DEFAULT_HELP_FORMAT = html
-   COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -D__USE_MINGW_ACCESS 
-D_USE_32BIT_TIME_T -DNOGDI -Icompat -Icompat/win32
+   COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -D__USE_MINGW_ACCESS 
-D_USE_32BIT_TIME_T -Icompat -Icompat/win32
COMPAT_CFLAGS += -DSTRIP_EXTENSION=\.exe\
COMPAT_OBJS += compat/mingw.o compat/winansi.o \
compat/win32/pthread.o compat/win32/syslog.o \
diff --git a/git-compat-util.h b/git-compat-util.h
index aa57a04..48bf0f7 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -98,6 +98,8 @@
 #define WIN32_LEAN_AND_MEAN  /* stops windows.h including winsock.h */
 #include winsock2.h
 #include windows.h
+/* wingdi.h defines ERROR=0, undef it to avoid conflicts */
+#undef ERROR
 #define GIT_WINDOWS_NATIVE
 #endif
 
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 08/12] MINGW: config.mak.uname allow using CURL for non-msysGit builds

2014-04-28 Thread Marat Radchenko
Also, fix `warning: passing argument 2 of 'mingw_main' from
incompatible pointer type` in http-fetch.c and remote-curl.c.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 config.mak.uname | 2 --
 http-fetch.c | 5 +++--
 remote-curl.c| 2 +-
 3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/config.mak.uname b/config.mak.uname
index 2f1939e..a376b32 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -523,8 +523,6 @@ ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
EXTLIBS += /mingw/lib/libz.a
INTERNAL_QSORT = YesPlease
NO_GETTEXT = YesPlease
-else
-   NO_CURL = YesPlease
 endif
HAVE_LIBCHARSET_H = YesPlease
NO_R_TO_GCC_LINKER = YesPlease
diff --git a/http-fetch.c b/http-fetch.c
index ba3ea10..a6a9a2f 100644
--- a/http-fetch.c
+++ b/http-fetch.c
@@ -6,7 +6,7 @@
 static const char http_fetch_usage[] = git http-fetch 
 [-c] [-t] [-a] [-v] [--recover] [-w ref] [--stdin] commit-id url;
 
-int main(int argc, const char **argv)
+int main(int argc, char **argv)
 {
struct walker *walker;
int commits_on_stdin = 0;
@@ -38,7 +38,8 @@ int main(int argc, const char **argv)
} else if (argv[arg][1] == 'v') {
get_verbosely = 1;
} else if (argv[arg][1] == 'w') {
-   write_ref = argv[arg + 1];
+   const char *ref = argv[arg + 1];
+   write_ref = ref;
arg++;
} else if (argv[arg][1] == 'h') {
usage(http_fetch_usage);
diff --git a/remote-curl.c b/remote-curl.c
index 52c2d96..565b6c9 100644
--- a/remote-curl.c
+++ b/remote-curl.c
@@ -938,7 +938,7 @@ static void parse_push(struct strbuf *buf)
free(specs);
 }
 
-int main(int argc, const char **argv)
+int main(int argc, char **argv)
 {
struct strbuf buf = STRBUF_INIT;
int nongit;
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 06/12] MSVC: config.mak.uname: drop -D__USE_MINGW_ACCESS from compile definitions

2014-04-28 Thread Marat Radchenko
-D__USE_MINGW_ACCESS only affects MinGW and does nothing when
MSVC is used.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 config.mak.uname | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/config.mak.uname b/config.mak.uname
index e5edae6..dc87e21 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -363,7 +363,7 @@ ifeq ($(uname_S),Windows)
COMPAT_OBJS = compat/msvc.o compat/winansi.o \
compat/win32/pthread.o compat/win32/syslog.o \
compat/win32/dirent.o
-   COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DNOGDI -DHAVE_STRING_H 
-DHAVE_ALLOCA_H -Icompat -Icompat/regex -Icompat/win32 
-DSTRIP_EXTENSION=\.exe\
+   COMPAT_CFLAGS = -DNOGDI -DHAVE_STRING_H -DHAVE_ALLOCA_H -Icompat 
-Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\.exe\
BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -SUBSYSTEM:CONSOLE 
-NODEFAULTLIB:MSVCRT.lib
EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib 
invalidcontinue.obj
PTHREAD_LIBS =
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 04/12] Makefile: introduce CROSS_COMPILE variable

2014-04-28 Thread Marat Radchenko
To ease cross-compilation process, introduce a single variable
with the prefix to all compiler-related executables.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 Makefile | 13 +
 config.mak.uname |  2 +-
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index 74a929b..24befc2 100644
--- a/Makefile
+++ b/Makefile
@@ -350,6 +350,10 @@ all::
 #
 # Define GMTIME_UNRELIABLE_ERRORS if your gmtime() function does not
 # return NULL when it receives a bogus time_t.
+#
+# Define CROSS_COMPILE to specify the prefix used for all executables used
+# during compilation. Only gcc and related bin-utils executables
+# are prefixed with $(CROSS_COMPILE).
 
 GIT-VERSION-FILE: FORCE
@$(SHELL_PATH) ./GIT-VERSION-GEN
@@ -361,7 +365,6 @@ CFLAGS = -g -O2 -Wall
 LDFLAGS =
 ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS)
 ALL_LDFLAGS = $(LDFLAGS)
-STRIP ?= strip
 
 # Among the variables below, these:
 #   gitexecdir
@@ -401,8 +404,11 @@ htmldir_relative = $(patsubst $(prefix)/%,%,$(htmldir))
 
 export prefix bindir sharedir sysconfdir gitwebdir localedir
 
-CC = cc
-AR = ar
+AR = $(CROSS_COMPILE)ar
+CC = $(CROSS_COMPILE)cc
+GCOV = $(CROSS_COMPILE)gcov
+STRIP = $(CROSS_COMPILE)strip
+
 RM = rm -f
 DIFF = diff
 TAR = tar
@@ -415,7 +421,6 @@ XGETTEXT = xgettext
 MSGFMT = msgfmt
 PTHREAD_LIBS = -lpthread
 PTHREAD_CFLAGS =
-GCOV = gcov
 
 export TCL_PATH TCLTK_PATH
 
diff --git a/config.mak.uname b/config.mak.uname
index 5d301da..6c2e6df 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -511,7 +511,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
EXTLIBS += -lws2_32
GITLIBS += git.res
PTHREAD_LIBS =
-   RC = windres -O coff
+   RC = $(CROSS_COMPILE)windres -O coff
NATIVE_CRLF = YesPlease
X = .exe
SPARSE_FLAGS = -Wno-one-bit-signed-bitfield
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 03/12] MINGW: compat/mingw.h: do not attempt to redefine lseek on mingw-w64

2014-04-28 Thread Marat Radchenko
mingw-w64 has lseek defined in io.h.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 compat/mingw.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/compat/mingw.h b/compat/mingw.h
index e033e72..262b300 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -265,7 +265,9 @@ static inline int getrlimit(int resource, struct rlimit 
*rlp)
  * Use mingw specific stat()/lstat()/fstat() implementations on Windows.
  */
 #define off_t off64_t
+#ifndef lseek
 #define lseek _lseeki64
+#endif
 
 /* use struct stat with 64 bit st_size */
 #ifdef stat
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 10/12] MINGW: config.mak.uname: drop USE_NED_ALLOCATOR

2014-04-28 Thread Marat Radchenko
nedalloc was initially added in f0ed82 to fix slowness of standard WinXP
memory allocator. Since WinXP is EOLed, this point is no longer valid.

The actual reason behind this commit is incompatibility of malloc.c.h
with MinGW-W64 headers. Alternative solution implies updating nedalloc
to something newer.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 config.mak.uname | 2 --
 1 file changed, 2 deletions(-)

diff --git a/config.mak.uname b/config.mak.uname
index 4883fd5..3fea7a8 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -342,7 +342,6 @@ ifeq ($(uname_S),Windows)
NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
NO_NSEC = YesPlease
USE_WIN32_MMAP = YesPlease
-   # USE_NED_ALLOCATOR = YesPlease
UNRELIABLE_FSTAT = UnfortunatelyYes
OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
NO_REGEX = YesPlease
@@ -492,7 +491,6 @@ ifneq (,$(findstring MINGW,$(uname_S)))
NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
NO_NSEC = YesPlease
USE_WIN32_MMAP = YesPlease
-   USE_NED_ALLOCATOR = YesPlease
UNRELIABLE_FSTAT = UnfortunatelyYes
OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
NO_REGEX = YesPlease
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 11/12] MINGW: do not fail at redefining pid_t on MinGW-W64

2014-04-28 Thread Marat Radchenko
pid_t is available in sys/types.h on both MinGW and MinGW-W64

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 compat/mingw.h | 1 -
 compat/msvc.h  | 2 ++
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/compat/mingw.h b/compat/mingw.h
index c502a22..8850109 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -5,7 +5,6 @@
  * things that are not available in header files
  */
 
-typedef int pid_t;
 typedef int uid_t;
 typedef int socklen_t;
 #define hstrerror strerror
diff --git a/compat/msvc.h b/compat/msvc.h
index cb41ce3..e2fda48 100644
--- a/compat/msvc.h
+++ b/compat/msvc.h
@@ -18,6 +18,8 @@
 #define PRIuMAX I64u
 #define PRId64 I64d
 
+typedef int pid_t;
+
 static __inline int strcasecmp (const char *s1, const char *s2)
 {
int size1 = strlen(s1);
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 12/12] MINGW: compat/mingw.h: drop fork() definition

2014-04-28 Thread Marat Radchenko
fork() is not used in MinGW builds but causes a compiler warning
on x86_64 MinGW-W64: conflicting types for built-in function 'fork'

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 compat/mingw.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/compat/mingw.h b/compat/mingw.h
index 8850109..2fbc8ea 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -89,8 +89,6 @@ static inline int symlink(const char *oldpath, const char 
*newpath)
 { errno = ENOSYS; return -1; }
 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 unsigned int alarm(unsigned int seconds)
 { return 0; }
 static inline int fsync(int fd)
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC/PATCH v1] Towards MinGW(-W64) cross-compilation

2014-04-28 Thread Marat Radchenko
This patch series fixes building on modern MinGW and (32bit only yet) MinGW-W64.

*Compilation* tested on:
 - MSVC (via WinGit environment)
 - msysGit environment
 - Linux cross-toolchain i686-pc-mingw32 (4.8.2) with mingw-runtime-3.20.2
 - Linux cross-toolchain i686-w64-mingw32 (4.8.2) with mingw64-runtime-3.1.0

Stuff still required to make Git build with x86_64 MinGW-W64 toolchain:

1. Drop -D_USE_32BIT_TIME_T that was added in fa93bb to config.mak.uname
because time_t cannot be 32bit on x86_64. I haven't yet figured out what
should break if this define is removed (pointers are welcome) and why it was
added in the first place.

2. Stop passing --large-address-aware to linker. I wonder if it does anything
for 32bit MinGW builds.

3. Fix several places with mismatched pointer size casts.

Building it from Gentoo Linux:

MinGW:

  crossdev -t i686-pc-mingw32
  ARCH=x86 emerge-i686-pc-mingw32 -u dev-libs/libiconv sys-libs/zlib 
net-misc/curl sys-devel/gettext expat
  cd git
  make CROSS_COMPILE=i686-pc-mingw32- CC=i686-pc-mingw32-gcc NO_OPENSSL=1 
MINGW=1 CURLDIR=/usr/i686-pc-mingw32/usr

MinGW-W64 (32 bit):

  crossdev -t i686-w64-mingw32
  ARCH=x86 emerge-i686-w64-mingw32 -u dev-libs/libiconv sys-libs/zlib 
net-misc/curl sys-devel/gettext expat
  cd git
  make CROSS_COMPILE=i686-w64-mingw32- CC=i686-w64-mingw32-gcc NO_OPENSSL=1 
MINGW=1 CURLDIR=/usr/i686-w64-mingw32/usr

Debian/Ubuntu build instructions are WIP (xdeb is non-trivial at all).

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 02/12] MINGW: compat/bswap.h: include stdint.h

2014-04-28 Thread Marat Radchenko
On Mon, Apr 28, 2014 at 04:45:43PM +0200, Erik Faye-Lund wrote:
 bswap.h is included after stdint.h from git-compat-util.h anyway...

That only becomes true after PATCH 05 when talking about MinGW.

Will drop this one.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 05/12] MINGW: git-compat-util.h: use inttypes.h for printf macros.

2014-04-28 Thread Marat Radchenko
On Mon, Apr 28, 2014 at 04:53:52PM +0200, Erik Faye-Lund wrote:
 Just checking that I understand: Does this mean that we now require an
 MSVC-version that has stdint.h? If so, I'm not against such a case.
 IMO, the biggest benefit of using MSVC is not building on legacy
 systems, but being able to use it's debugger. And for that purpose
 it's probably OK to increase the required version.

Ouch, that was not intentional. What minimal MSVC version is currently
supported and who decides if it is OK to increase required one?
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 07/12] MINGW: config.mak.uname: reorganize MINGW settings

2014-04-28 Thread Marat Radchenko
On Mon, Apr 28, 2014 at 04:58:11PM +0200, Erik Faye-Lund wrote:
 On Mon, Apr 28, 2014 at 3:51 PM, Marat Radchenko ma...@slonopotamus.org 
 wrote:
  HAVE_LIBCHARSET_H and NO_R_TO_GCC_LINKER are not specific to
  msysGit, they're general MinGW settings.
 
 Actually, HAVE_LIBCHARSET_H is. It's only present because we have
 libiconv installed.

1. What are other ways to provide iconv on MinGW?
2. One can still completely disable iconv with NO_ICONV=1
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 03/12] MINGW: compat/mingw.h: do not attempt to redefine lseek on mingw-w64

2014-04-28 Thread Marat Radchenko
On Mon, Apr 28, 2014 at 05:02:09PM +0200, Erik Faye-Lund wrote:
 msysGit has a declaration of it in io.h as well. But it's not a
 preprocessor-definition... Are you saying that it's a
 preprocessor-define in mingw-w64, that points to a 64-bit version? If
 so, looks good.

MinGW is x86 only.

MinGW-W64, a separate project, provides both x86 and x86_64.

And here's relevant part of io.h from MingW-W64:
http://sourceforge.net/apps/trac/mingw-w64/browser/trunk/mingw-w64-headers/crt/io.h?rev=5437#L321
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 10/12] MINGW: config.mak.uname: drop USE_NED_ALLOCATOR

2014-04-28 Thread Marat Radchenko
 Did you measure that malloc on newer Windows-versions are actually faster?

No, I didn't. As I said, real reason for this patch is that Git version of 
nedalloc fails to compile under MinGW-W64. If we still want to use nedalloc 
under MinGW, this patch should be replaced with:

 a) Updating nedalloc to newer release that succeeds to compile under MinGW-W64 
(I'd prefer this option). As a bonus point, we can drop most (if not all) fixes 
that Git currently has on top of nedallox.

 OR

 b) Patching specific problems that prevent compilation.

 OR

 c) Introducing separate MinGW/MinGW-W64 behavior to compat.mak.uname, least 
preferred 
option.N�r��yb�X��ǧv�^�)޺{.n�+ا���ܨ}���Ơz�j:+v���zZ+��+zf���h���~i���z��w���?��)ߢf

Re: [PATCH 08/12] MINGW: config.mak.uname allow using CURL for non-msysGit builds

2014-04-28 Thread Marat Radchenko
On Mon, Apr 28, 2014 at 05:26:38PM +0200, Erik Faye-Lund wrote:
 On Mon, Apr 28, 2014 at 3:51 PM, Marat Radchenko ma...@slonopotamus.org 
 wrote:
  Also, fix `warning: passing argument 2 of 'mingw_main' from
  incompatible pointer type` in http-fetch.c and remote-curl.c.
 
 These seems completely unrelated, perhaps it should be split in two?

Okay, will split. Though there is a connection - until this patch,
http-fetch.c and remote-curl.c never built for MinGW.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 07/12] MINGW: config.mak.uname: reorganize MINGW settings

2014-04-28 Thread Marat Radchenko
On Mon, Apr 28, 2014 at 05:17:25PM +0200, Erik Faye-Lund wrote:
  1. What are other ways to provide iconv on MinGW?
 
 I'm not sure I understand. To set HAVE_LIBCHARSET_H, we need to have
 libcharset.h. MinGW doesn't supply by default to my knowledge, so we
 get it from iconv. The THIS_IS_MSYSGIT file is there for us to be able
 to pick the right defaults for msysGit, and us having libcharset is
 indeed a msysGit-detail. Not all iconv-flavors supply libcharset.h, so
 this tells a particularity about the one we have in msysGit.

  2. One can still completely disable iconv with NO_ICONV=1
 
 Sure. And it does seem like the current setup assumes that anyone
 building for MinGW has iconv. But perhaps that's a mistake?

This patch assumes that if user has iconv under MinGW, he has
libcharset.h. Without it, we assume if user has iconv under MinGW,
he has langinfo.h. If user doesn't have iconv, he needs to say this
via NO_ICONV=1 in both cases. Anyway, if it is a questionable change,
I'll drop it and only keep NO_R_TO_GCC_LINKER change.

 To be honest, I think the whole THIS_IS_MSYSGIT-block should have
 stayed downstream.

That's a completely different story.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 04/12] Makefile: introduce CROSS_COMPILE variable

2014-04-28 Thread Marat Radchenko
On Mon, Apr 28, 2014 at 12:37:42PM -0500, Felipe Contreras wrote:
  +CC = $(CROSS_COMPILE)cc
 
 Nice.

Actually, not. You still have to override CC because it is
$(CROSS_COMPILE)*g*cc. Any thoughts how to handle this?

  -   RC = windres -O coff
  +   RC = $(CROSS_COMPILE)windres -O coff
 
 I don't think this is the best.
 
 We should probably have this in the Makefile:
 
   RC = $(CROSS_COMPILE)windres
 
 And then config.mak.uname should have
 
   RCFLAGS += -O coff

Okay, will do in v2.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


  1   2   >