summaryrefslogtreecommitdiff
path: root/compiler/main/SysTools.hs
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2017-06-29 15:34:39 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2017-06-29 15:34:39 +0100
commit58c781da4861faab11e4c5804e07e6892908ef72 (patch)
tree3eee171fbd5756b479b4dab6ce7f4e3328b9d64c /compiler/main/SysTools.hs
parent3b0e7555fafe73b157a96ca48d8ddc04ad81b231 (diff)
downloadhaskell-58c781da4861faab11e4c5804e07e6892908ef72.tar.gz
Revert "Remove the Windows GCC driver."
This reverts commit d6cecde585b0980ed8e0050c5a1d315789fb6356. The patch broke Simon PJ's Windows build, becuase he didn't have (and should not need) a separate msys2 gcc. Following an exchange on the ghc-devs list, Tamar wrote Oops, sorry, didn’t notice it because both mine and harbormaster’s msys2 have separate GCCs installed as well. I don’t see an easy fix that would also work for end user Configure based cabal installs. So I think I’ll have to go back to the drawing board for this one. You can just leave it reverted.
Diffstat (limited to 'compiler/main/SysTools.hs')
-rw-r--r--compiler/main/SysTools.hs38
1 files changed, 13 insertions, 25 deletions
diff --git a/compiler/main/SysTools.hs b/compiler/main/SysTools.hs
index f2878b0e7b..0a19feb2ce 100644
--- a/compiler/main/SysTools.hs
+++ b/compiler/main/SysTools.hs
@@ -202,10 +202,17 @@ initSysTools mbMinusB
Nothing ->
pgmError ("Can't parse " ++
show platformConstantsFile)
- let getSettingRaw key = case lookup key mySettings of
- Just xs -> return xs
- Nothing -> pgmError ("No entry for " ++ show key ++ " in " ++ show settingsFile)
- getSetting key = resolveTopDir top_dir <$> getSettingRaw key
+ let getSetting key = case lookup key mySettings of
+ Just xs ->
+ return $ case stripPrefix "$topdir" xs of
+ Just [] ->
+ top_dir
+ Just xs'@(c:_)
+ | isPathSeparator c ->
+ top_dir ++ xs'
+ _ ->
+ xs
+ Nothing -> pgmError ("No entry for " ++ show key ++ " in " ++ show settingsFile)
getBooleanSetting key = case lookup key mySettings of
Just "YES" -> return True
Just "NO" -> return False
@@ -232,11 +239,7 @@ initSysTools mbMinusB
-- with the settings file, but it would be a little fiddly
-- to make that possible, so for now you can't.
gcc_prog <- getSetting "C compiler command"
- -- TopDir can expand to something that contains spaces
- -- for the argument string we apply words to the string in order to
- -- break it up. So defer the expansion of $TopDir till after the words
- -- call here.
- gcc_args_str <- getSettingRaw "C compiler flags"
+ gcc_args_str <- getSetting "C compiler flags"
gccSupportsNoPie <- getBooleanSetting "C compiler supports -no-pie"
cpp_prog <- getSetting "Haskell CPP command"
cpp_args_str <- getSetting "Haskell CPP flags"
@@ -249,7 +252,7 @@ initSysTools mbMinusB
= ["-DTABLES_NEXT_TO_CODE"]
| otherwise = []
cpp_args= map Option (words cpp_args_str)
- gcc_args = map (Option . resolveTopDir top_dir) (words gcc_args_str
+ gcc_args = map Option (words gcc_args_str
++ unreg_gcc_args
++ tntc_gcc_args)
ldSupportsCompactUnwind <- getBooleanSetting "ld supports compact unwind"
@@ -360,21 +363,6 @@ initSysTools mbMinusB
sPlatformConstants = platformConstants
}
--- | This function will replace any usage of $TopDir in the given string
--- regardless of it's location within the string.
-resolveTopDir :: String -- ^ The value of $TopDir
- -> String -- ^ The string to perform substitutions in
- -> String -- ^ The resulting string with all subs done.
-resolveTopDir top_dir str
- = case break (=='$') str of
- (_, []) -> str
- (x, xs) -> let rst = case stripPrefix "$topdir" xs of
- Just [] -> top_dir
- Just xs'@(c:_) | isPathSeparator c
- -> top_dir ++ xs'
- _ -> xs
- in x ++ resolveTopDir top_dir rst
-
-- returns a Unix-format path (relying on getBaseDir to do so too)
findTopDir :: Maybe String -- Maybe TopDir path (without the '-B' prefix).
-> IO String -- TopDir (in Unix format '/' separated)