Guest User

Fix build Git for Windows in mingw32

a guest
Jun 24th, 2018
607
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. diff --git a/compat/nedmalloc/malloc.c.h b/compat/nedmalloc/malloc.c.h
  2. index b833ff9225..c7e0e757ed 100644
  3. --- a/compat/nedmalloc/malloc.c.h
  4. +++ b/compat/nedmalloc/malloc.c.h
  5. @@ -502,6 +502,8 @@ MAX_RELEASE_CHECK_RATE   default: 4095 unless not HAVE_MMAP
  6.  #ifndef _WIN32_WINNT
  7.  #define _WIN32_WINNT 0x403
  8.  #endif
  9. +#undef  _WIN32_WINNT
  10. +#define _WIN32_WINNT 0x0501
  11.  #include <windows.h>
  12.  #define HAVE_MMAP 1
  13.  #define HAVE_MORECORE 0
  14. diff --git a/compat/poll/poll.c b/compat/poll/poll.c
  15. index b10adc780f..b182e25c52 100644
  16. --- a/compat/poll/poll.c
  17. +++ b/compat/poll/poll.c
  18. @@ -42,6 +42,8 @@
  19.  # if defined (_MSC_VER) && !defined(_WIN32_WINNT)
  20.  #  define _WIN32_WINNT 0x0502
  21.  # endif
  22. +#undef  _WIN32_WINNT
  23. +#define _WIN32_WINNT 0x0501
  24.  # include <winsock2.h>
  25.  # include <windows.h>
  26.  # include <io.h>
  27. diff --git a/git-compat-util.h b/git-compat-util.h
  28. index c1e9bb0170..b215faff9d 100644
  29. --- a/git-compat-util.h
  30. +++ b/git-compat-util.h
  31. @@ -149,6 +149,8 @@
  32.  # if defined (_MSC_VER) && !defined(_WIN32_WINNT)
  33.  #  define _WIN32_WINNT 0x0502
  34.  # endif
  35. +#undef  _WIN32_WINNT
  36. +#define _WIN32_WINNT 0x0501
  37.  #define WIN32_LEAN_AND_MEAN  /* stops windows.h including winsock.h */
  38.  #include <winsock2.h>
  39.  #include <windows.h>
  40. diff --git a/http.c b/http.c
  41. index cc6f7ca11b..9d1e76e7f1 100644
  42. --- a/http.c
  43. +++ b/http.c
  44. @@ -1,3 +1,10 @@
  45. +#ifdef __MINGW32__
  46. +#include <io.h>
  47. +#ifndef HAVE_FSEEKO
  48. +#define ftello ftell
  49. +#define fseeko fseek
  50. +#endif
  51. +#endif
  52.  #include "git-compat-util.h"
  53.  #include "http.h"
  54.  #include "pack.h"
RAW Paste Data