Merge branch 'js/mingw-host-cpu'
authorJunio C Hamano <gitster@pobox.com>
Thu, 14 Feb 2019 02:18:43 +0000 (18:18 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 14 Feb 2019 02:18:43 +0000 (18:18 -0800)
Windows update.

* js/mingw-host-cpu:
mingw: use a more canonical method to fix the CPU reporting

1  2 
compat/mingw.h
config.mak.uname
diff --combined compat/mingw.h
index 98407744f2ce9aaeb4aed77e0a4e19493ca2789c,8c24ddaa3efc20e4454ebc87c51fa30316f64a22..30d9fb3e36274657e5d2a63ef2f5eb3e1c55ce61
@@@ -6,25 -6,6 +6,6 @@@ typedef _sigset_t sigset_t
  #include <winsock2.h>
  #include <ws2tcpip.h>
  
- #ifdef __MINGW64_VERSION_MAJOR
- /*
-  * In Git for Windows, we cannot rely on `uname -m` to report the correct
-  * architecture: /usr/bin/uname.exe will report the architecture with which the
-  * current MSYS2 runtime was built, not the architecture for which we are
-  * currently compiling (both 32-bit and 64-bit `git.exe` is built in the 64-bit
-  * Git for Windows SDK).
-  */
- #undef GIT_HOST_CPU
- /* This was figured out by looking at `cpp -dM </dev/null`'s output */
- #if defined(__x86_64__)
- #define GIT_HOST_CPU "x86_64"
- #elif defined(__i686__)
- #define GIT_HOST_CPU "i686"
- #else
- #error "Unknown architecture"
- #endif
- #endif
  /* MinGW-w64 reports to have flockfile, but it does not actually have it. */
  #ifdef __MINGW64_VERSION_MAJOR
  #undef _POSIX_THREAD_SAFE_FUNCTIONS
@@@ -462,12 -443,32 +443,12 @@@ HANDLE winansi_get_osfhandle(int fd)
   * git specific compatibility
   */
  
 -#define has_dos_drive_prefix(path) \
 -      (isalpha(*(path)) && (path)[1] == ':' ? 2 : 0)
 -int mingw_skip_dos_drive_prefix(char **path);
 -#define skip_dos_drive_prefix mingw_skip_dos_drive_prefix
 -static inline int mingw_is_dir_sep(int c)
 -{
 -      return c == '/' || c == '\\';
 -}
 -#define is_dir_sep mingw_is_dir_sep
 -static inline char *mingw_find_last_dir_sep(const char *path)
 -{
 -      char *ret = NULL;
 -      for (; *path; ++path)
 -              if (is_dir_sep(*path))
 -                      ret = (char *)path;
 -      return ret;
 -}
  static inline void convert_slashes(char *path)
  {
        for (; *path; path++)
                if (*path == '\\')
                        *path = '/';
  }
 -#define find_last_dir_sep mingw_find_last_dir_sep
 -int mingw_offset_1st_component(const char *path);
 -#define offset_1st_component mingw_offset_1st_component
  #define PATH_SEP ';'
  extern char *mingw_query_user_email(void);
  #define query_user_email mingw_query_user_email
diff --combined config.mak.uname
index bd55e828cabd2a4b17ebf8a8735027c5c8d950f7,194f20a8b30823084a3e089311a79e9d0f5eace4..29ed39475f8fc5d00c172860e103b97871e51b1c
@@@ -187,7 -187,7 +187,7 @@@ ifeq ($(uname_O),Cygwin
        UNRELIABLE_FSTAT = UnfortunatelyYes
        OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
        MMAP_PREVENTS_DELETE = UnfortunatelyYes
 -      COMPAT_OBJS += compat/cygwin.o
 +      COMPAT_OBJS += compat/win32/path-utils.o
        FREAD_READS_DIRECTORIES = UnfortunatelyYes
  endif
  ifeq ($(uname_S),FreeBSD)
        HAVE_BSD_KERN_PROC_SYSCTL = YesPlease
        PAGER_ENV = LESS=FRX LV=-c MORE=FRX
        FREAD_READS_DIRECTORIES = UnfortunatelyYes
 +      FILENO_IS_A_MACRO = UnfortunatelyYes
  endif
  ifeq ($(uname_S),OpenBSD)
        NO_STRCASESTR = YesPlease
        HAVE_BSD_SYSCTL = YesPlease
        HAVE_BSD_KERN_PROC_SYSCTL = YesPlease
        PROCFS_EXECUTABLE_PATH = /proc/curproc/file
 +      FREAD_READS_DIRECTORIES = UnfortunatelyYes
 +      FILENO_IS_A_MACRO = UnfortunatelyYes
  endif
  ifeq ($(uname_S),MirBSD)
        NO_STRCASESTR = YesPlease
@@@ -444,43 -441,26 +444,43 @@@ ifeq ($(uname_S),NONSTOP_KERNEL
        # INLINE='' would just replace one set of warnings with another and
        # still not compile in c89 mode, due to non-const array initializations.
        CC = cc -c99
 +      # Build down-rev compatible objects that don't use our new getopt_long.
 +      ifeq ($(uname_R).$(uname_V),J06.21)
 +              CC += -WRVU=J06.20
 +      endif
 +      ifeq ($(uname_R).$(uname_V),L17.02)
 +              CC += -WRVU=L16.05
 +      endif
        # Disable all optimization, seems to result in bad code, with -O or -O2
        # or even -O1 (default), /usr/local/libexec/git-core/git-pack-objects
        # abends on "git push". Needs more investigation.
 -      CFLAGS = -g -O0
 +      CFLAGS = -g -O0 -Winline
        # We'd want it to be here.
        prefix = /usr/local
 -      # Our's are in ${prefix}/bin (perl might also be in /usr/bin/perl).
 -      PERL_PATH = ${prefix}/bin/perl
 -      PYTHON_PATH = ${prefix}/bin/python
 -
 +      # perl and python must be in /usr/bin on NonStop - supplied by HPE
 +      # with operating system in that managed directory.
 +      PERL_PATH = /usr/bin/perl
 +      PYTHON_PATH = /usr/bin/python
 +      # The current /usr/coreutils/rm at lowest support level does not work
 +      # with the git test structure. Long paths as in
 +      # 'trash directory...' cause rm to terminate prematurely without fully
 +      # removing the directory at OS releases J06.21 and L17.02.
 +      # Default to the older rm until those two releases are deprecated.
 +      RM = /bin/rm -f
        # As detected by './configure'.
        # Missdetected, hence commented out, see below.
        #NO_CURL = YesPlease
        # Added manually, see above.
 +      NEEDS_SSL_WITH_CURL = YesPlease
 +      NEEDS_CRYPTO_WITH_SSL = YesPlease
 +      HAVE_DEV_TTY = YesPlease
        HAVE_LIBCHARSET_H = YesPlease
        HAVE_STRINGS_H = YesPlease
        NEEDS_LIBICONV = YesPlease
        NEEDS_LIBINTL_BEFORE_LIBICONV = YesPlease
        NO_SYS_SELECT_H = UnfortunatelyYes
        NO_D_TYPE_IN_DIRENT = YesPlease
 +      NO_GETTEXT = YesPlease
        NO_HSTRERROR = YesPlease
        NO_STRCASESTR = YesPlease
        NO_MEMMEM = YesPlease
        NO_MKDTEMP = YesPlease
        # Currently libiconv-1.9.1.
        OLD_ICONV = UnfortunatelyYes
 -      NO_REGEX = YesPlease
 +      NO_REGEX = NeedsStartEnd
        NO_PTHREADS = UnfortunatelyYes
 +      FREAD_READS_DIRECTORIES = UnfortunatelyYes
  
        # Not detected (nor checked for) by './configure'.
        # We don't have SA_RESTART on NonStop, unfortunalety.
@@@ -548,7 -527,6 +548,7 @@@ ifneq (,$(findstring MINGW,$(uname_S))
        COMPAT_CFLAGS += -DNOGDI -Icompat -Icompat/win32
        COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
        COMPAT_OBJS += compat/mingw.o compat/winansi.o \
 +              compat/win32/path-utils.o \
                compat/win32/pthread.o compat/win32/syslog.o \
                compat/win32/dirent.o
        BASIC_CFLAGS += -DWIN32 -DPROTECT_NTFS_DEFAULT=1
        RC = windres -O coff
        NATIVE_CRLF = YesPlease
        X = .exe
 -      SPARSE_FLAGS = -Wno-one-bit-signed-bitfield
  ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
        htmldir = doc/git/html/
        prefix =
@@@ -574,9 -553,11 +574,11 @@@ els
                prefix = /usr/
                ifeq (MINGW32,$(MSYSTEM))
                        prefix = /mingw32
+                       HOST_CPU = i686
                endif
                ifeq (MINGW64,$(MSYSTEM))
                        prefix = /mingw64
+                       HOST_CPU = x86_64
                else
                        COMPAT_CFLAGS += -D_USE_32BIT_TIME_T
                        BASIC_LDFLAGS += -Wl,--large-address-aware