diff options
author | Joey Hess <joey@kitenet.net> | 2013-12-10 13:51:52 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-12-10 13:51:52 -0400 |
commit | ebf27dd68f0e99f5aeca73918c0539fdf390d699 (patch) | |
tree | dd1cd89e99cd61bd7e66627818496ac8ce6df737 /Build/EvilLinker.hs | |
parent | e14639faf20556a6bafe8d27e60d0e8dc7f2f548 (diff) |
parse out additional env vars when running collect2
Diffstat (limited to 'Build/EvilLinker.hs')
-rw-r--r-- | Build/EvilLinker.hs | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/Build/EvilLinker.hs b/Build/EvilLinker.hs index 9dbd2c4c6..de3d2fc7a 100644 --- a/Build/EvilLinker.hs +++ b/Build/EvilLinker.hs @@ -48,7 +48,6 @@ parseGhcLink = do {- Find where gcc calls collect2. -} parseGccLink :: Parser CmdParams parseGccLink = do - void $ many preenv cenv <- collectenv void $ try $ char ' ' path <- manyTill anyChar (try $ string collectcmd) @@ -57,10 +56,24 @@ parseGccLink = do return $ CmdParams (path ++ collectcmd) (escapeDosPaths collect2params) cenv where collectcmd = "collect2.exe" + collectgccenv = "COLLECT_GCC" + collectltoenv = "COLLECT_LTO_WRAPPER" pathenv = "COMPILER_PATH" libpathenv = "LIBRARY_PATH" optenv = "COLLECT_GCC_OPTIONS" collectenv = do + void $ many1 $ do + notFollowedBy $ string collectgccenv + restOfLine + void $ string collectgccenv + void $ char '=' + g <- restOfLine + void $ string collectltoenv + void $ char '=' + lt <- restOfLine + void $ many1 $ do + notFollowedBy $ string pathenv + restOfLine void $ string pathenv void $ char '=' p <- restOfLine @@ -70,10 +83,7 @@ parseGccLink = do void $ string optenv void $ char '=' o <- restOfLine - return $ Just [(pathenv, p), (libpathenv, lp), (optenv, o)] - preenv = do - void $ notFollowedBy collectenv - restOfLine + return $ Just [(collectgccenv, g), (collectltoenv, lt), (pathenv, p), (libpathenv, lp), (optenv, o)] {- Find where collect2 calls ld. -} parseCollect2 :: Parser CmdParams |