Commit a511dcd3 authored by Ian Lynagh's avatar Ian Lynagh

Fix the way we find the path to 'ar'

Fixes ghcilink001 on Windows
parent b806bd2d
......@@ -116,10 +116,6 @@ ifeq "$(shell test -x '$(HPC)' && echo exists)" ""
$(error Cannot find hpc: $(HPC))
endif
ifeq "$(AR)" ""
AR = ar
endif
# Be careful when using this. On Windows it ends up looking like
# c:/foo/bar which confuses make, as make thinks that the : is Makefile
# syntax
......
......@@ -22,7 +22,7 @@ main = do
getGhcField fields "GhcUnregisterised" "Unregisterised"
getGhcField fields "GhcWithSMP" "Support SMP"
getGhcField fields "GhcRTSWays" "RTS ways"
getGhcFieldWithDefault fields "AR" "ar command" "ar"
getGhcFieldProgWithDefault fields "AR" "ar command" "ar"
getGhcField :: [(String,String)] -> String -> String -> IO ()
getGhcField fields mkvar key =
......@@ -30,12 +30,12 @@ getGhcField fields mkvar key =
Nothing -> fail ("No field: " ++ key)
Just val -> putStrLn (mkvar ++ '=':val)
getGhcFieldWithDefault :: [(String,String)]
-> String -> String -> String -> IO ()
getGhcFieldWithDefault fields mkvar key deflt = do
getGhcFieldProgWithDefault :: [(String,String)]
-> String -> String -> String -> IO ()
getGhcFieldProgWithDefault fields mkvar key deflt = do
case lookup key fields of
Nothing -> putStrLn (mkvar ++ '=':deflt)
Just val -> putStrLn (mkvar ++ '=': fixTopdir topdir val)
Nothing -> putStrLn (mkvar ++ '=' : deflt)
Just val -> putStrLn (mkvar ++ '=' : fixSlashes (fixTopdir topdir val))
where
topdir = fromMaybe "" (lookup "LibDir" fields)
......@@ -43,3 +43,9 @@ 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
fixSlashes :: FilePath -> FilePath
fixSlashes = map f
where f '\\' = '/'
f c = c
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment