]> cygwin.com Git - cygwin-apps/setup.git/commitdiff
Fix build with mingw-w64 headers.
authorYaakov Selkowitz <yselkowi@redhat.com>
Tue, 4 Sep 2012 13:55:17 +0000 (13:55 +0000)
committerYaakov Selkowitz <yselkowi@redhat.com>
Tue, 4 Sep 2012 13:55:17 +0000 (13:55 +0000)
* autoload.c: Define DECLSPEC_IMPORT for mingw-w64 headers.
* filemanip.h: Include <sys/types.h> to fix missing mode_t typedef
error with mingw-w64 headers.
* gpg-packet.cc: Include "win32.h" to avoid macro redefinition
errors with mingw-w64 headers.
(ARRAYSIZE): Do not redefine.
* main.cc (_argv): Declare if using mingw-w64 headers.
(WinMain): Move up _argv definition to before it is first used.
* ntdll.h: Include PSDK headers with mingw-w64 instead of DDK.
* package_message.h: Include "win32.h" instead of <windows.h>.
* propsheet.cc (PROPSHEETHEADER_V1_SIZE): Do not redefine.
* win32.h: Include <sys/types.h> to fix missing mode_t typedef
error with mingw-w64 headers.
Define DECLSPEC_IMPORT for mingw-w64 headers.

ChangeLog
autoload.c
filemanip.h
gpg-packet.cc
main.cc
ntdll.h
package_message.h
propsheet.cc
win32.h

index 1ae3590792046fecd998a441ef65a2c25133eca7..2092883051cd1daf7d150189f9ca82ca8b36e2b6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2012-09-04  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
+
+       Fix build with mingw-w64 headers.
+       * autoload.c: Define DECLSPEC_IMPORT for mingw-w64 headers.
+       * filemanip.h: Include <sys/types.h> to fix missing mode_t typedef
+       error with mingw-w64 headers.
+       * gpg-packet.cc: Include "win32.h" to avoid macro redefinition
+       errors with mingw-w64 headers.
+       (ARRAYSIZE): Do not redefine.
+       * main.cc (_argv): Declare if using mingw-w64 headers.
+       (WinMain): Move up _argv definition to before it is first used.
+       * ntdll.h: Include PSDK headers with mingw-w64 instead of DDK.
+       * package_message.h: Include "win32.h" instead of <windows.h>.
+       * propsheet.cc (PROPSHEETHEADER_V1_SIZE): Do not redefine.
+       * win32.h: Include <sys/types.h> to fix missing mode_t typedef
+       error with mingw-w64 headers.
+       Define DECLSPEC_IMPORT for mingw-w64 headers.
+
 2012-08-30  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
 
        First step towards X86-64 compatibility.
index 366018ca555be09cab3c1dd0bd746c4b0c540bf0..d1779ae8e04081a2bd9c297e28c58fee9c330986 100644 (file)
@@ -17,6 +17,7 @@ static const char *cvsid = "\n%%% $Id$\n";
 #endif
 
 #define WIN32_LEAN_AND_MEAN
+#define DECLSPEC_IMPORT
 #include <windows.h>
 
 typedef struct {
index 346c4f7659a00f88f6a0e7ca39d51c9cdee2dfa9..6a7fb030fe9a770b859e062e203b8c60663ed00d 100644 (file)
@@ -16,6 +16,7 @@
 #ifndef SETUP_FILEMANIP_H
 #define SETUP_FILEMANIP_H
 
+#include <sys/types.h>
 #include <string>
 
 extern int find_tar_ext (const char *path);
index fa9e55bf350e38e38b44f5d60f0a6ac88cf03843..3a3bef484bafbc4a9380ce0c49b31731f99df882 100755 (executable)
@@ -26,6 +26,7 @@ static const char *cvsid =
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
+#include "win32.h"
 #include "io_stream.h"
 #include "gcrypt.h"
 #include "gpg-packet.h"
@@ -42,7 +43,9 @@ static const char *cvsid =
 #define MESSAGE while (0) msg
 #endif /* CRYPTODEBUGGING */
 
+#ifndef ARRAYSIZE
 #define ARRAYSIZE(_ar) (sizeof (_ar) / sizeof (_ar[0]))
+#endif
 
 static const struct { char from; char to; } RFC4880HashCodesToGPGHashCodes[] =
 {
diff --git a/main.cc b/main.cc
index e731d2ff1ccf28273951de52fee7829ad417247a..9f36c6289799863dba71b9372d95ae1783165839 100644 (file)
--- a/main.cc
+++ b/main.cc
@@ -79,6 +79,10 @@ static const char *cvsid =
 #include <wincon.h>
 #include <fstream>
 
+#ifdef __MINGW64_VERSION_MAJOR
+extern char **_argv;
+#endif
+
 using namespace std;
 
 HINSTANCE hinstance;
@@ -239,6 +243,12 @@ WinMain (HINSTANCE h,
   snprintf(locale, sizeof locale, ".%u", GetACP());
   setlocale(LC_ALL, locale);
 
+  char **_argv;
+  int argc;
+  for (argc = 0, _argv = __argv; *_argv; _argv++)
+    ++argc;
+  _argv = __argv;
+
   set_legacy (_argv[0]);
 
   if (is_legacy && IsWindowsNT ())
@@ -270,13 +280,6 @@ WinMain (HINSTANCE h,
     GetCurrentDirectory (MAX_PATH, cwd);
     local_dir = std::string (cwd);
 
-    // TODO: make an equivalent for __argv under cygwin.
-    char **_argv;
-    int argc;
-    for (argc = 0, _argv = __argv; *_argv; _argv++)
-      ++argc;
-    _argv = __argv;
-
     if (!GetOption::GetInstance ().Process (argc,_argv, NULL))
       exit (1);
 
diff --git a/ntdll.h b/ntdll.h
index a6d1cd6b705563c1037f336689da224a8617e22a..3378ad083714be8e3ed5bd6b94bad8edb15a5196 100644 (file)
--- a/ntdll.h
+++ b/ntdll.h
 
 #define NTOSAPI
 
+#ifdef __MINGW64_VERSION_MAJOR
+#include <winternl.h>
+#include <ntdef.h>
+#include <ntstatus.h>
+#define DDKAPI __stdcall
+#else
 #include "ddk/ntapi.h"
 #include "ddk/ntifs.h"
+#endif
 
 extern "C" {
 NTSTATUS DDKAPI NtCreateFile (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
index 97e9f346d079d1f43ea2b7bf888e49c304f12f93..7ff7d1554810beeaf29c4c898805e346c0380687 100644 (file)
@@ -16,7 +16,7 @@
 #include "UserSettings.h"
 #include "state.h"
 #include <stdlib.h>
-#include <windows.h>
+#include "win32.h"
 
 class packagemessage
 {
index 082b69f299e04436586e52cf10e2fb83b558e92e..976aefb90c305ba85eaf5f03a8c7cd6c36b57c40 100644 (file)
@@ -37,7 +37,10 @@ typedef struct _DllVersionInfo
 }
 DLLVERSIONINFO;
 typedef HRESULT CALLBACK (*DLLGETVERSIONPROC) (DLLVERSIONINFO * pdvi);
+
+#ifndef PROPSHEETHEADER_V1_SIZE
 #define PROPSHEETHEADER_V1_SIZE 40
+#endif
 
 // Sort of a "hidden" Windows structure.  Used in the PropSheetCallback.
 #include <pshpack1.h>
diff --git a/win32.h b/win32.h
index 08f45566bc835f735a55c0aab8df536c185bbbf7..bb3e74c8a82b505fe406d855c3b25bbe1a40943c 100644 (file)
--- a/win32.h
+++ b/win32.h
@@ -17,6 +17,7 @@
 #ifndef SETUP_WIN32_H
 #define SETUP_WIN32_H
 
+#include <sys/types.h>
 #include <string>
 
 /* Any include of <windows.h> should be through this file, which wraps it in
@@ -42,6 +43,7 @@
  * multiple declaration errors at link time. This define turns that off again.
  * It will default to off again in later w32api versions, but we need to work
  * with 3.1 for now. */
+#define DECLSPEC_IMPORT
 #define WINBASEAPI
 
 /* Require at least Internet Explorer 3, in order to have access to
This page took 0.04851 seconds and 5 git commands to generate.