Use rawSystem where appropriate.
{-# OPTIONS -fffi -cpp #-}
------------------------------------------------------------------------
{-# OPTIONS -fffi -cpp #-}
------------------------------------------------------------------------
--- $Id: Main.hs,v 1.60 2004/08/13 13:11:21 simonmar Exp $
+-- $Id: Main.hs,v 1.61 2005/01/05 10:26:45 simonmar Exp $
--
-- Program for converting .hsc files to .hs files, by converting the
-- file into a C program which is run to generate the Haskell source.
--
-- Program for converting .hsc files to .hs files, by converting the
-- file into a C program which is run to generate the Haskell source.
+import Compat.RawSystem ( rawSystem )
+
import System (getProgName, getArgs, ExitCode(..), exitWith, system)
import Directory (removeFile,doesFileExist)
import Monad (MonadPlus(..), liftM, liftM2, when)
import System (getProgName, getArgs, ExitCode(..), exitWith, system)
import Directory (removeFile,doesFileExist)
import Monad (MonadPlus(..), liftM, liftM2, when)
- compilerStatus <- systemL beVerbose $
- compiler++
- " -c"++
- concat [" "++f | CompFlag f <- flags]++
- " "++cProgName++
- " -o "++oProgName
+ compilerStatus <- rawSystemL beVerbose compiler
+ ( ["-c"]
+ ++ [f | CompFlag f <- flags]
+ ++ [cProgName]
+ ++ ["-o", oProgName]
+ )
+
case compilerStatus of
e@(ExitFailure _) -> exitWith e
_ -> return ()
removeFile cProgName
case compilerStatus of
e@(ExitFailure _) -> exitWith e
_ -> return ()
removeFile cProgName
- linkerStatus <- systemL beVerbose $
- linker++
- concat [" "++f | LinkFlag f <- flags]++
- " "++oProgName++
- " -o "++progName
+ linkerStatus <- rawSystemL beVerbose linker
+ ( [f | LinkFlag f <- flags]
+ ++ [oProgName]
+ ++ ["-o", progName]
+ )
+
case linkerStatus of
e@(ExitFailure _) -> exitWith e
_ -> return ()
case linkerStatus of
e@(ExitFailure _) -> exitWith e
_ -> return ()
-- NB. outHFile not outHName; works better when processed
-- by gcc or mkdependC.
-- NB. outHFile not outHName; works better when processed
-- by gcc or mkdependC.
+rawSystemL :: Bool -> String -> [String] -> IO ExitCode
+rawSystemL flg prog args = do
+ when flg $ hPutStrLn stderr ("Executing: " ++ prog ++ concat (map (' ':) args))
+ rawSystem prog args
+
systemL :: Bool -> String -> IO ExitCode
systemL flg s = do
when flg (hPutStrLn stderr ("Executing: " ++ s))
systemL :: Bool -> String -> IO ExitCode
systemL flg s = do
when flg (hPutStrLn stderr ("Executing: " ++ s))
+SRC_HC_OPTS += -i$(GHC_LIB_COMPAT_DIR)
+SRC_LD_OPTS += -L$(GHC_LIB_COMPAT_DIR) -lghccompat
+
HS_PROG = hsc2hs-bin
ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
HS_PROG = hsc2hs$(exeext)
HS_PROG = hsc2hs-bin
ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
HS_PROG = hsc2hs$(exeext)