[project @ 2004-05-06 08:53:01 by simonmar]
authorsimonmar <unknown>
Thu, 6 May 2004 08:53:01 +0000 (08:53 +0000)
committersimonmar <unknown>
Thu, 6 May 2004 08:53:01 +0000 (08:53 +0000)
Make this work with GHC 5.04.x, by slurping in rawSystem from the libraries.

ghc/utils/runghc/Makefile
ghc/utils/runghc/rawSystem.c [new file with mode: 0644]
ghc/utils/runghc/runghc.hs

index 5792902..dd643db 100644 (file)
@@ -4,4 +4,7 @@ include $(TOP)/mk/boilerplate.mk
 HS_PROG                = runghc
 INSTALL_PROGS   += $(HS_PROG)
 
+UseGhcForCc = YES
+SRC_MKDEPENDC_OPTS += -I$(GHC_INCLUDE_DIR)
+
 include $(TOP)/mk/target.mk
diff --git a/ghc/utils/runghc/rawSystem.c b/ghc/utils/runghc/rawSystem.c
new file mode 100644 (file)
index 0000000..f35ace3
--- /dev/null
@@ -0,0 +1,6 @@
+/* Grab rawSystem from the library sources iff we're bootstrapping with an
+ * old version of GHC.
+ */
+#if __GLASGOW_HASKELL__ < 601
+#include "../../../libraries/base/cbits/rawSystem.c"
+#endif
index a79f411..8adf9e9 100644 (file)
@@ -1,4 +1,4 @@
-{-# OPTIONS -cpp #-}
+{-# OPTIONS -cpp -fffi #-}
 #include "config.h"
 -----------------------------------------------------------------------------
 --
@@ -20,12 +20,18 @@ module Main where
 
 import System.Environment
 import System.IO
-import System.Cmd
 import Data.List
 import System.Directory
 import System.Exit
 import Data.Char
 
+#if __GLASGOW_HASKELL__ < 603
+import Foreign         ( withMany, withArray0, nullPtr, Ptr )
+import Foreign.C       ( CString, withCString, throwErrnoIfMinus1 )
+#else
+import System.Cmd      ( rawSystem )
+#endif
+
 main = do 
   args <- getArgs
   case args of
@@ -77,3 +83,6 @@ die msg = do hPutStr stderr msg; exitWith (ExitFailure 1)
 dieProg :: String -> IO a
 dieProg msg = do p <- getProgName; die (p ++ ": " ++ msg)
 
+#if __GLASGOW_HASKELL__ < 603
+#include "../../../libraries/base/System/RawSystem.hs-inc"
+#endif