summaryrefslogtreecommitdiff
path: root/dev-lang/ghc/files/ghc-8.2.1_rc1-win32-cross-1.patch
blob: 79751e1ecbdaf6a79d4dfa34d20823bec71af04d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
commit a691f6a7a191a268380805481d8e63134764a4a1
Author: Sergei Trofimovich <slyfox@inbox.ru>
Date:   Sat Apr 29 22:02:24 2017 +0100

    add basic cross-compilation support (#87)
    
    * fix include case: s/#include <Lmcons.h>/#include <lmcons.h>
    
    Noticed when cross-compiling win32 on linux to i686-w64-mingw32-gcc.
    i686-w64-mingw32 provides all headers in lowercase.
    
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
    
    * Pen.hsc: don't use c99-style comments in enum declarations
    
    Ths change workarounds hsc2hs bug in cross-compile mode:
    https://ghc.haskell.org/trac/ghc/ticket/13619
    
    To reproduce the build failure it's enough to run
      $ cabal configure --hsc2hs-options='--cross-safe --cross-compile'
      $ cabal build     --hsc2hs-options='--cross-safe --cross-compile'
    
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
    
    * SimpleMAPI.hsc: don't use #ifdef in enum declarations
    
    This change workarounds hsc2hs bug in cross-compile mode:
    https://ghc.haskell.org/trac/ghc/ticket/13620
    
    To reproduce the build failure it's enough to run
      $ cabal configure --hsc2hs-options='--cross-safe --cross-compile'
      $ cabal build     --hsc2hs-options='--cross-safe --cross-compile'
    
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

diff --git a/Graphics/Win32/GDI/Pen.hsc b/Graphics/Win32/GDI/Pen.hsc
index c880170..8d8df5d 100644
--- a/Graphics/Win32/GDI/Pen.hsc
+++ b/Graphics/Win32/GDI/Pen.hsc
@@ -56,7 +56,7 @@ foreign import WINDOWS_CCONV unsafe "windows.h DeleteObject"
 
 type PenStyle   = INT
 
-#{enum PenStyle,                              // Pick one of these
+#{enum PenStyle,
  , pS_SOLID             = PS_SOLID            // default
  , pS_DASH              = PS_DASH             // -------
  , pS_DOT               = PS_DOT              // .......
@@ -69,14 +69,14 @@ type PenStyle   = INT
  , pS_STYLE_MASK        = PS_STYLE_MASK       // all the above
  }
 
-#{enum PenStyle ,                             // "or" with one of these
+#{enum PenStyle,
  , pS_ENDCAP_ROUND      = PS_ENDCAP_ROUND     // default
  , pS_ENDCAP_SQUARE     = PS_ENDCAP_SQUARE
  , pS_ENDCAP_FLAT       = PS_ENDCAP_FLAT
  , pS_ENDCAP_MASK       = PS_ENDCAP_MASK      // all the above
  }
 
-#{enum PenStyle,                              // "or" with one of these
+#{enum PenStyle,
  , pS_JOIN_ROUND        = PS_JOIN_ROUND       // default
  , pS_JOIN_BEVEL        = PS_JOIN_BEVEL
  , pS_JOIN_MITER        = PS_JOIN_MITER
@@ -87,7 +87,7 @@ If PS_JOIN_MASK is not defined with your GNU Windows32 header files,
 you'll have to define it.
 -}
 
-#{enum PenStyle,                              // "or" with one of these
+#{enum PenStyle,
  , pS_COSMETIC          = PS_COSMETIC         // default
  , pS_GEOMETRIC         = PS_GEOMETRIC
  , pS_TYPE_MASK         = PS_TYPE_MASK        // all the above
diff --git a/System/Win32/Info/Computer.hsc b/System/Win32/Info/Computer.hsc
index bb2eb72..65ae8dc 100644
--- a/System/Win32/Info/Computer.hsc
+++ b/System/Win32/Info/Computer.hsc
@@ -65,7 +65,7 @@ import System.Win32.Utils    ( tryWithoutNull )
 import System.Win32.Word     ( DWORD, LPDWORD )
 
 #include <windows.h>
-#include <Lmcons.h>
+#include <lmcons.h>
 #include "alignment.h"
 ##include "windows_cconv.h"
 
diff --git a/System/Win32/SimpleMAPI.hsc b/System/Win32/SimpleMAPI.hsc
index 9727cfc..5ebf06b 100644
--- a/System/Win32/SimpleMAPI.hsc
+++ b/System/Win32/SimpleMAPI.hsc
@@ -53,12 +53,6 @@ type MapiFlag = ULONG
     , mAPI_LOGON_UI         = MAPI_LOGON_UI
     , mAPI_NEW_SESSION      = MAPI_NEW_SESSION
     , mAPI_FORCE_DOWNLOAD   = MAPI_FORCE_DOWNLOAD
-#ifdef MAPI_LOGOFF_SHARED
-    , mAPI_LOGOFF_SHARED    = MAPI_LOGOFF_SHARED
-#endif
-#ifdef MAPI_LOGOFF_UI
-    , mAPI_LOGOFF_UI        = MAPI_LOGOFF_UI
-#endif
     , mAPI_DIALOG           = MAPI_DIALOG
     , mAPI_UNREAD_ONLY      = MAPI_UNREAD_ONLY
     , mAPI_LONG_MSGID       = MAPI_LONG_MSGID
@@ -74,6 +68,19 @@ type MapiFlag = ULONG
     , mAPI_RECEIPT_REQUESTED = MAPI_RECEIPT_REQUESTED
     , mAPI_SENT             = MAPI_SENT
     }
+-- Have to define enum values outside previous declaration due to
+-- hsc2hs bug in --cross-compile mode:
+--    https://ghc.haskell.org/trac/ghc/ticket/13620
+#ifdef MAPI_LOGOFF_SHARED
+#{enum MapiFlag,
+    , mAPI_LOGOFF_SHARED    = MAPI_LOGOFF_SHARED
+}
+#endif
+#ifdef MAPI_LOGOFF_UI
+#{enum MapiFlag,
+    , mAPI_LOGOFF_UI        = MAPI_LOGOFF_UI
+}
+#endif
 
 mapiErrors :: [(ULONG,String)]
 mapiErrors =