Repository : ssh://darcs.haskell.org//srv/darcs/testsuite

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/386ff6e111cd1d53435abdc715728165046de4b2

>---------------------------------------------------------------

commit 386ff6e111cd1d53435abdc715728165046de4b2
Author: Simon Marlow <[email protected]>
Date:   Tue May 1 09:17:37 2012 +0100

    substitute for $topdir in $(AR)
    
    Fixes ghcilink001, ghcilink004 on Windows

>---------------------------------------------------------------

 mk/ghc-config.hs |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/mk/ghc-config.hs b/mk/ghc-config.hs
index e0b8954..7bdc6d6 100644
--- a/mk/ghc-config.hs
+++ b/mk/ghc-config.hs
@@ -1,5 +1,6 @@
 import System.Environment
 import System.Process
+import Data.Maybe
 
 main = do
   [ghc] <- getArgs
@@ -14,6 +15,7 @@ main = do
 
   info <- readProcess ghc ["--info"] ""
   let fields = read info :: [(String,String)]
+
   getGhcField fields "GhcStage" "Stage"
   getGhcField fields "GhcWithNativeCodeGen" "Have native code generator"
   getGhcField fields "GhcWithInterpreter" "Have interpreter"
@@ -28,8 +30,16 @@ getGhcField fields mkvar key =
       Nothing  -> fail ("No field: " ++ key)
       Just val -> putStrLn (mkvar ++ '=':val)
 
-getGhcFieldWithDefault :: [(String,String)] -> String -> String -> String -> 
IO ()
+getGhcFieldWithDefault :: [(String,String)]
+                       -> String -> String -> String -> IO ()
 getGhcFieldWithDefault fields mkvar key deflt = do
    case lookup key fields of
       Nothing  -> putStrLn (mkvar ++ '=':deflt)
-      Just val -> putStrLn (mkvar ++ '=':val)
+      Just val -> putStrLn (mkvar ++ '=': fixTopdir topdir val)
+ where
+  topdir = fromMaybe "" (lookup "LibDir" fields)
+
+fixTopdir :: String -> String -> String
+fixTopdir t "" = ""
+fixTopdir t ('$':'t':'o':'p':'d':'i':'r':s) = t ++ s
+fixTopdir t (c:s) = c : fixTopdir t s



_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to