[project @ 2005-01-05 10:26:45 by simonmar]
authorsimonmar <unknown>
Wed, 5 Jan 2005 10:26:46 +0000 (10:26 +0000)
committersimonmar <unknown>
Wed, 5 Jan 2005 10:26:46 +0000 (10:26 +0000)
Use rawSystem where appropriate.

ghc/utils/hsc2hs/Main.hs
ghc/utils/hsc2hs/Makefile

index e2cfbb7..0ad0a03 100644 (file)
@@ -1,7 +1,7 @@
 {-# 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.
@@ -17,6 +17,8 @@ import System.Console.GetOpt
 import GetOpt
 #endif
 
 import GetOpt
 #endif
 
+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)
@@ -570,22 +572,24 @@ output flags name toks = do
 
 
     
 
 
     
-    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 ()
@@ -618,6 +622,11 @@ output flags name toks = do
        -- 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))
index 2ea5786..dee4085 100644 (file)
@@ -10,6 +10,9 @@ INCLUDE_DIR=ghc/includes
 
 INSTALLING=1
 
 
 INSTALLING=1
 
+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)