[Pkg-haskell-commits] [SCM] haskell-testpack branch, master, updated. debian/1.0.2-1-4-gb0d6b36

John Goerzen jgoerzen at complete.org
Fri Apr 23 15:23:26 UTC 2010


The following commit has been merged in the master branch:
commit c059976df98336840f5765420580b439e17361f7
Author: John Goerzen <jgoerzen at complete.org>
Date:   Fri May 2 00:01:00 2008 -0500

    Make Windows building more robust -- mingw32 ifdefs more expansive
    
    Uses same approach as commit e84cd13ef2292e681193cb4f684f100ba23c3e3e
    in hdbc-odbc

diff --git a/src/Network/Email/Sendmail.hs b/src/Network/Email/Sendmail.hs
index d08f702..b08ba97 100644
--- a/src/Network/Email/Sendmail.hs
+++ b/src/Network/Email/Sendmail.hs
@@ -33,7 +33,7 @@ This is not compatible with Windows at this time.
 Written by John Goerzen, jgoerzen\@complete.org
 -}
 
-#ifdef mingw32_HOST_OS
+#if (defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__))
 module Network.Email.Sendmail
 where
 #else
diff --git a/src/Network/Utils.hs b/src/Network/Utils.hs
index d0100fe..54cdd64 100644
--- a/src/Network/Utils.hs
+++ b/src/Network/Utils.hs
@@ -53,7 +53,7 @@ Example:
 
 niceSocketsDo :: IO a -> IO a
 niceSocketsDo func = do
-#ifndef mingw32_HOST_OS
+#if !(defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__))
                 -- No signals on Windows anyway
                 System.Posix.Signals.installHandler
                       System.Posix.Signals.sigPIPE
@@ -83,7 +83,7 @@ listenTCPAddr addr queuelen = do
                      return s
 
 showSockAddr :: SockAddr -> IO String
-#ifndef mingw32_HOST_OS
+#if !(defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__))
 showSockAddr (SockAddrUnix x) = return $ "UNIX socket at " ++ x
 #endif
 showSockAddr (SockAddrInet port host) =
diff --git a/src/System/Cmd/Utils.hs b/src/System/Cmd/Utils.hs
index b64cef2..d01a16b 100644
--- a/src/System/Cmd/Utils.hs
+++ b/src/System/Cmd/Utils.hs
@@ -76,7 +76,7 @@ Most of this module will be incompatible with Windows.
 module System.Cmd.Utils(-- * High-Level Tools
                     PipeHandle(..),
                     safeSystem,
-#ifndef mingw32_HOST_OS
+#if !(defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__))
                     forceSuccess,
 #ifndef __HUGS__
                     posixRawSystem,
@@ -94,7 +94,7 @@ module System.Cmd.Utils(-- * High-Level Tools
 #endif
                     -- * Low-Level Tools
                     PipeMode(..),
-#ifndef mingw32_HOST_OS
+#if !(defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__))
 #ifndef __HUGS__
                     pOpen, pOpen3, pOpen3Raw
 #endif
@@ -107,7 +107,7 @@ where
 import System.Exit
 import System.Cmd
 import System.Log.Logger
-#ifndef mingw32_HOST_OS
+#if !(defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__))
 import System.Posix.IO
 import System.Posix.Process
 import System.Posix.Signals
@@ -138,7 +138,7 @@ data PipeHandle =
                }
     deriving (Eq, Show)
 
-#ifndef mingw32_HOST_OS
+#if !(defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__))
 #ifndef __HUGS__
 {- | Like 'pipeFrom', but returns data in lines instead of just a String.
 Shortcut for calling lines on the result from 'pipeFrom'.
@@ -162,7 +162,7 @@ warnFail funcname fp args msg =
         in do warningM (logbase ++ "." ++ funcname) m
               fail m
 
-#ifndef mingw32_HOST_OS
+#if !(defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__))
 #ifndef __HUGS__
 {- | Read data from a pipe.  Returns a Handle and a 'PipeHandle'.
 
@@ -192,7 +192,7 @@ hPipeFrom fp args =
 #endif
 #endif
 
-#ifndef mingw32_HOST_OS
+#if !(defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__))
 #ifndef __HUGS__
 {- | Read data from a pipe.  Returns a lazy string and a 'PipeHandle'.
 
@@ -210,7 +210,7 @@ pipeFrom fp args =
 #endif
 #endif
 
-#ifndef mingw32_HOST_OS
+#if !(defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__))
 #ifndef __HUGS__
 {- | Write data to a pipe.  Returns a 'PipeHandle' and a new Handle to write
 to.
@@ -241,7 +241,7 @@ hPipeTo fp args =
 #endif
 #endif
 
-#ifndef mingw32_HOST_OS
+#if !(defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__))
 #ifndef __HUGS__
 {- | Write data to a pipe.  Returns a ProcessID.
 
@@ -260,7 +260,7 @@ pipeTo fp args message =
 #endif
 #endif
 
-#ifndef mingw32_HOST_OS
+#if !(defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__))
 #ifndef __HUGS__
 {- | Like a combination of 'hPipeTo' and 'hPipeFrom'; returns
 a 3-tuple of ('PipeHandle', Data From Pipe, Data To Pipe).
@@ -299,7 +299,7 @@ hPipeBoth fp args =
 #endif
 #endif
 
-#ifndef mingw32_HOST_OS
+#if !(defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__))
 #ifndef __HUGS__
 {- | Like a combination of 'pipeTo' and 'pipeFrom'; forks an IO thread
 to send data to the piped program, and simultaneously returns its output
@@ -318,7 +318,7 @@ pipeBoth fp args message =
 #endif
 #endif
 
-#ifndef mingw32_HOST_OS
+#if !(defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__))
 {- | Uses 'System.Posix.Process.getProcessStatus' to obtain the exit status
 of the given process ID.  If the process terminated normally, does nothing.
 Otherwise, raises an exception with an appropriate error message.
@@ -351,7 +351,7 @@ safeSystem :: FilePath -> [String] -> IO ()
 safeSystem command args =
     do debugM (logbase ++ ".safeSystem")
                ("Running: " ++ command ++ " " ++ (show args))
-#if defined(__HUGS__) || defined(mingw32_HOST_OS)
+#if defined(__HUGS__) || defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__)
        ec <- rawSystem command args
        case ec of
             ExitSuccess -> return ()
@@ -365,7 +365,7 @@ safeSystem command args =
             Stopped s -> cmdsignalled "safeSystem" command args s
 #endif
 
-#ifndef mingw32_HOST_OS
+#if !(defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__))
 #ifndef __HUGS__
 {- | Invokes the specified command in a subprocess, waiting for the result.
 Return the result status.  Never raises an exception.  Only available
@@ -407,7 +407,7 @@ posixRawSystem program args =
 #endif
 #endif
 
-#ifndef mingw32_HOST_OS
+#if !(defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__))
 #ifndef __HUGS__
 {- | Invokes the specified command in a subprocess, without waiting for
 the result.  Returns the PID of the subprocess -- it is YOUR responsibility
@@ -436,7 +436,7 @@ cmdfailed funcname command args failcode = do
     warningM (logbase ++ "." ++ funcname) errormsg
     ioError e
 
-#ifndef mingw32_HOST_OS
+#if !(defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__))
 #ifndef __HUGS__
 cmdsignalled :: String -> FilePath -> [String] -> Signal -> IO a
 cmdsignalled funcname command args failcode = do
@@ -448,7 +448,7 @@ cmdsignalled funcname command args failcode = do
 #endif
 #endif
 
-#ifndef mingw32_HOST_OS
+#if !(defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__))
 #ifndef __HUGS__
 {- | Open a pipe to the specified command.
 
@@ -488,7 +488,7 @@ pOpen pm fp args func =
 #endif
 #endif
 
-#ifndef mingw32_HOST_OS
+#if !(defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__))
 #ifndef __HUGS__
 {- | Runs a command, redirecting things to pipes.
 
@@ -514,7 +514,7 @@ pOpen3 pin pout perr fp args func childfunc =
 #endif
 #endif
 
-#ifndef mingw32_HOST_OS
+#if !(defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__))
 #ifndef __HUGS__
 {- | Runs a command, redirecting things to pipes.
 
diff --git a/src/System/Daemon.hs b/src/System/Daemon.hs
index c603984..4e6732a 100644
--- a/src/System/Daemon.hs
+++ b/src/System/Daemon.hs
@@ -44,12 +44,12 @@ This module is not available on Windows.
 
 module System.Daemon (
 
-#ifndef mingw32_HOST_OS
+#if !(defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__))
         detachDaemon
 #endif
                    )
                        where
-#ifndef mingw32_HOST_OS
+#if !(defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__))
 
 import System.Posix.Process
 import System.Posix.IO
diff --git a/src/System/IO/HVFS.hs b/src/System/IO/HVFS.hs
index e151076..955877a 100644
--- a/src/System/IO/HVFS.hs
+++ b/src/System/IO/HVFS.hs
@@ -307,7 +307,7 @@ instance HVFS SystemFS where
     vRemoveFile _ = removeFile
     vRenameFile _ = renameFile
     vGetFileStatus _ fp = getFileStatus fp >>= return . HVFSStatEncap
-#ifndef mingw32_HOST_OS
+#if !(defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__))
     vGetSymbolicLinkStatus _ fp = getSymbolicLinkStatus fp >>= return . HVFSStatEncap
 #else
     -- No symlinks on Windows; just get the file status directly
@@ -315,7 +315,7 @@ instance HVFS SystemFS where
 #endif
 
     vGetModificationTime _ = getModificationTime
-#ifndef mingw32_HOST_OS
+#if !(defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__))
     vCreateSymbolicLink _ = createSymbolicLink
     vReadSymbolicLink _ = readSymbolicLink
     vCreateLink _ = createLink
diff --git a/src/System/IO/HVFS/Combinators.hs b/src/System/IO/HVFS/Combinators.hs
index 62b6b2a..64877b6 100644
--- a/src/System/IO/HVFS/Combinators.hs
+++ b/src/System/IO/HVFS/Combinators.hs
@@ -40,7 +40,7 @@ import System.IO
 import System.IO.Error
 import System.IO.HVFS
 import System.IO.HVFS.InstanceHelpers (getFullPath)
-#ifndef mingw32_HOST_OS
+#if !(defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__))
 import System.Posix.Files -- This actually needed? -Wall doesn't seem to think
                           -- so, but I'm not sure...
 #endif
diff --git a/src/System/IO/PlafCompat.hs b/src/System/IO/PlafCompat.hs
index dee8f89..f27591f 100644
--- a/src/System/IO/PlafCompat.hs
+++ b/src/System/IO/PlafCompat.hs
@@ -36,7 +36,7 @@ The result should be roughly the same set of defined variables and types.
 
 module System.IO.PlafCompat
     (nullFileName,
-#ifdef mingw32_HOST_OS
+#if (defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__))
      module System.IO.WindowsCompat,
 #else
      module System.Posix.Files,
@@ -45,7 +45,7 @@ module System.IO.PlafCompat
 where
 
 import System.Posix.Types
-#ifdef mingw32_HOST_OS
+#if (defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__))
 import System.IO.WindowsCompat
 #else
 import System.Posix.Files
@@ -55,7 +55,7 @@ import System.Posix.Files
 -}
 
 nullFileName :: String
-#ifdef mingw32_HOST_OS
+#if (defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__))
 nullFileName = "NUL:"
 #else
 nullFileName = "/dev/null"
diff --git a/src/System/IO/StatCompat.hs b/src/System/IO/StatCompat.hs
index c8479a3..ec381d0 100644
--- a/src/System/IO/StatCompat.hs
+++ b/src/System/IO/StatCompat.hs
@@ -36,12 +36,12 @@ module System.IO.StatCompat
 where
 import System.Posix.Types
 import System.Posix.Consts
-#ifndef mingw32_HOST_OS
+#if !(defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__))
 import System.Posix.Files(intersectFileModes)
 #endif
 import Data.Bits ((.&.))
 
-#ifdef mingw32_HOST_OS
+#if (defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__))
 type LinkCount = Int
 type UserID = Int
 type GroupID = Int
@@ -74,7 +74,7 @@ isDirectory = sc_helper directoryMode
 isSymbolicLink = sc_helper symbolicLinkMode
 isSocket = sc_helper socketMode
 
-#ifdef mingw32_HOST_OS
+#if (defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__))
 intersectFileModes :: FileMode -> FileMode -> FileMode
 intersectFileModes m1 m2 = m1 .&. m2
 #endif
diff --git a/src/System/IO/WindowsCompat.hs b/src/System/IO/WindowsCompat.hs
index 22fd97c..3f838d3 100644
--- a/src/System/IO/WindowsCompat.hs
+++ b/src/System/IO/WindowsCompat.hs
@@ -44,7 +44,7 @@ to stat(2).
 Common usage might be like this:
 
 >import System.Posix.Types
->#ifdef mingw32_HOST_OS
+>#if (defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__))
 >import System.IO.WindowsCompat
 >#else
 >import System.Posix.Files
@@ -56,7 +56,7 @@ Or, to avoid having to use CPP and make things even easier, just import
 -}
 
 module System.IO.WindowsCompat
-#ifndef mingw32_HOST_OS
+#if !(defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__))
 where
 #else
        (module System.IO.StatCompat, module System.IO.WindowsCompat)
diff --git a/src/System/Path.hs b/src/System/Path.hs
index cd09c2f..b128e41 100644
--- a/src/System/Path.hs
+++ b/src/System/Path.hs
@@ -43,7 +43,7 @@ module System.Path(-- * Name processing
 where
 import Data.List
 import Data.List.Utils
-#ifndef mingw32_HOST_OS
+#if !(defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__))
 import System.Posix.Files
 import System.Posix.Directory (createDirectory)
 import System.Posix.Temp
@@ -111,7 +111,7 @@ System.Directory.getTemporaryDirectory.
 The name of the directory created will be returned.
 -}
 mktmpdir :: String -> IO String
-#ifndef mingw32_HOST_OS
+#if !(defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__))
 mktmpdir x =
     do y <- mkstemp x
        let (dirname, h) = y
diff --git a/testsrc/Globtest.hs b/testsrc/Globtest.hs
index 7ab5f84..b77a0e1 100644
--- a/testsrc/Globtest.hs
+++ b/testsrc/Globtest.hs
@@ -24,7 +24,7 @@ import System.Path
 import Test.HUnit.Utils
 import System.IO.HVFS
 import System.Directory(createDirectory)
-#ifndef mingw32_HOST_OS
+#if !(defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__))
 import System.Posix.Directory hiding (createDirectory)
 import System.Posix.Files
 #endif
@@ -47,7 +47,7 @@ globtest thetest =
                               bp ++ "/a/bcd/EF", bp ++ "/a/bcd/efg/ha",
                              bp ++ "/a/foo", bp ++ "/a/afoo",
                              bp ++ "/a/a-foo", bp ++ "/a/a.foo"]
-#ifndef mingw32_HOST_OS
+#if !(defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__))
                  createSymbolicLink (preppath "broken") (preppath "sym1")
                  createSymbolicLink (preppath "broken") (preppath "sym2")
 #endif
@@ -91,7 +91,7 @@ test_dirnames =
         ]
 
 test_brokensymlinks =
-#ifndef mingw32_HOST_OS
+#if !(defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__))
     map f
         [glob (preppath "sym*") >>= eq "sym*" (map preppath ["sym1", "sym2"]),
          glob (preppath "sym1") >>= eq "sym1" [preppath "sym1"],

-- 
haskell-testpack



More information about the Pkg-haskell-commits mailing list