-{-# OPTIONS -fno-warn-incomplete-patterns #-}
+{-# OPTIONS -fno-warn-incomplete-patterns -optc-DNON_POSIX_SOURCE #-}
+
-----------------------------------------------------------------------------
--- $Id: Main.hs,v 1.83 2001/08/03 23:38:50 ken Exp $
+-- $Id: Main.hs,v 1.88 2001/10/22 13:45:15 simonmar Exp $
--
-- GHC Driver program
--
import CompManager ( cmInit, cmLoadModule )
import HscTypes ( GhciMode(..) )
import Config ( cBooterVersion, cGhcUnregisterised, cProjectVersion )
-import SysTools ( packageConfigPath, initSysTools, cleanTempFiles )
-import Packages ( showPackages, mungePackagePaths )
-import ParsePkgConf ( loadPackageConfig )
+import SysTools ( getPackageConfigPath, initSysTools, cleanTempFiles )
+import Packages ( showPackages )
import DriverPipeline ( GhcMode(..), doLink, doMkDLL, genPipeline,
getGhcMode, pipeLoop, v_GhcMode
findBuildTag, getPackageInfo, unregFlags,
v_Cmdline_libraries, v_Keep_tmp_files, v_Ld_inputs,
v_OptLevel, v_Output_file, v_Output_hi,
- v_Package_details, v_Ways, getPackageExtraGhcOpts
+ v_Package_details, v_Ways, getPackageExtraGhcOpts,
+ readPackageConf
)
import DriverFlags ( dynFlag, buildStaticHscOpts, dynamic_flags,
processArgs, static_flags)
handle (\exception -> do
case exception of
-- an IO exception probably isn't our fault, so don't panic
- IOException _ -> hPutStr stderr (show exception)
-#if __GLASGOW_HASKELL__ >= 501
- -- let exit exceptions bubble all the way out.
- ExitException e -> exitWith e
-#endif
- _other -> hPutStr stderr (show (Panic (show exception)))
+ IOException _ -> hPutStr stderr (show exception)
+ _other -> hPutStr stderr (show (Panic (show exception)))
exitWith (ExitFailure 1)
) $ do
-- all error messages are propagated as exceptions
handleDyn (\dyn -> case dyn of
- PhaseFailed _phase code -> do
- hPutStr stderr "\nCompilation had errors\n"
- exitWith code
+ PhaseFailed _phase code -> exitWith code
Interrupted -> exitWith (ExitFailure 1)
_ -> do hPutStrLn stderr (show (dyn :: GhcException))
exitWith (ExitFailure 1)
top_dir <- initSysTools minusB_args
-- Read the package configuration
- conf_file <- packageConfigPath
- proto_pkg_details <- loadPackageConfig conf_file
- let pkg_details = mungePackagePaths top_dir proto_pkg_details
- writeIORef v_Package_details pkg_details
+ conf_file <- getPackageConfigPath
+ readPackageConf conf_file
-- find the phase to stop after (i.e. -E, -C, -c, -S flags)
(flags2, mode, stop_flag) <- getGhcMode argv'
-- leave out hscOutName for now
hscOutName = panic "Main.main:hscOutName not set",
- verbosity = case mode of
- DoInteractive -> 1
- DoMake -> 1
- _other -> 0,
+ verbosity = 1
})
-- the rest of the arguments are "dynamic"
when (verb >= 2)
(hPutStrLn stderr ("Using package config file: " ++ conf_file))
+ pkg_details <- readIORef v_Package_details
+ showPackages pkg_details
+
when (verb >= 3)
(hPutStrLn stderr ("Hsc static flags: " ++ unwords static_opts))
- showPackages pkg_details
-
-- initialise the finder
pkg_avails <- getPackageInfo
initFinder pkg_avails