-----------------------------------------------------------------------------
--- $Id: DriverPipeline.hs,v 1.89 2001/07/11 19:48:07 sof Exp $
+-- $Id: DriverPipeline.hs,v 1.90 2001/07/17 14:48:04 rrt Exp $
--
-- GHC Driver
--
import DriverMkDepend
import DriverPhases
import DriverFlags
-import SysTools ( newTempName, addFilesToClean, getSysMan )
+import SysTools ( newTempName, addFilesToClean, getSysMan, unDosifyPath )
import qualified SysTools
import HscMain
import Finder
run_phase Unlit _basename _suff input_fn output_fn
= do unlit_flags <- getOpts opt_L
- SysTools.runUnlit (unlit_flags ++ ["-h", input_fn, input_fn, output_fn])
+ -- The -h option passes the file name for unlit to put in a #line directive;
+ -- we undosify it so that it doesn't contain backslashes in Windows, which
+ -- would disappear in error messages
+ SysTools.runUnlit (unlit_flags ++ ["-h", unDosifyPath input_fn, input_fn, output_fn])
return (Just output_fn)
-------------------------------------------------------------------------------
++ extra_ld_opts
++ if static && not no_hs_main then
#ifdef LEADING_UNDERSCORE
- [ "-u _PrelMain_mainIO_closure" ,
- "-u ___init_PrelMain"]
+ [ "-u", "_PrelMain_mainIO_closure" ,
+ "-u", "___init_PrelMain"]
#else
- [ "-u PrelMain_mainIO_closure" ,
- "-u __init_PrelMain"]
+ [ "-u", "PrelMain_mainIO_closure" ,
+ "-u", "__init_PrelMain"]
#endif
else [])
touch, -- String -> String -> IO ()
copy, -- String -> String -> String -> IO ()
+ unDosifyPath, -- String -> String
-- Temporary-file management
setTmpDir,
import qualified Posix
#else
import Win32DLL
-import List ( isPrefixOf )
+import List ( isPrefixOf, isSuffixOf )
#endif
-import List ( isSuffixOf )
-
#include "HsVersions.h"
\end{code}
-- pick up whatever happens to be lying around in the path,
-- possibly including those from a cygwin install on the target,
-- which is exactly what we're trying to avoid.
- ; let gcc_path | am_installed = installed_bin ("gcc -B" ++ installed "gcc-lib/")
+ ; let gcc_path | am_installed = installed_bin ("gcc -B" ++ "\"" ++ (installed "gcc-lib/") ++ "\"")
| otherwise = cGCC
perl_path | am_installed = installed_bin cGHC_PERL
| otherwise = cGHC_PERL
; return (am_installed, top_dir)
}
where
- -- get_proto returns a Unix-format path
+ -- get_proto returns a Unix-format path (relying on getExecDir to do so too)
get_proto | not (null minusbs)
= return (unDosifyPath (drop 2 (last minusbs))) -- 2 for "-B"
| otherwise
; case maybe_exec_dir of -- (only works on Windows;
-- returns Nothing on Unix)
Nothing -> throwDyn (InstallationError "missing -B<dir> option")
- Just dir -> return (unDosifyPath dir)
+ Just dir -> return dir
}
\end{code}
else return ()
}
where
- cmd_line = unwords (pgm : dosifyPaths args)
+ cmd_line = unwords (pgm : dosifyPaths (map quote args))
-- The pgm is already in native format (appropriate dir separators)
+ quote "" = ""
+ quote s = "\"" ++ s ++ "\""
traceCmd :: String -> String -> IO () -> IO ()
-- a) trace the command (at two levels of verbosity)
getExecDir :: IO (Maybe String)
getExecDir = do h <- getModuleHandle Nothing
n <- getModuleFileName h
- return (Just (reverse (tail (dropWhile (not . isSlash) (reverse (unDosifyPath n))))))
+ return (Just (reverse (drop (length "/bin/ghc.exe") (reverse (unDosifyPath n)))))
#else
getExecDir :: IO (Maybe String) = do return Nothing
#endif