commit a691f6a7a191a268380805481d8e63134764a4a1 Author: Sergei Trofimovich Date: Sat Apr 29 22:02:24 2017 +0100 add basic cross-compilation support (#87) * fix include case: s/#include /#include 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 * 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 * 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 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 -#include +#include #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 =