aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Waern <david.waern@gmail.com>2008-06-26 20:26:49 +0000
committerDavid Waern <david.waern@gmail.com>2008-06-26 20:26:49 +0000
commitcce29e9a0e7063122a116f96746378e564c582ae (patch)
tree7fdc036ddf08cf79a424d0a6786de316a08c0989 /src
parentfce984a0a20bde33a3b8d72a23844c8f104b8c38 (diff)
Use ghc-paths to get the lib dir
The path can still be overridden using the -B flag. It's not longer required to pass the lib dir to the program that runs the test suite.
Diffstat (limited to 'src')
-rw-r--r--src/Haddock/Options.hs2
-rw-r--r--src/Main.hs11
2 files changed, 9 insertions, 4 deletions
diff --git a/src/Haddock/Options.hs b/src/Haddock/Options.hs
index 6e5514cf..d1b20d3a 100644
--- a/src/Haddock/Options.hs
+++ b/src/Haddock/Options.hs
@@ -91,7 +91,7 @@ options :: Bool -> [OptDescr Flag]
options backwardsCompat =
[
Option ['B'] [] (ReqArg Flag_GhcLibDir "DIR")
- "path to the GHC lib dir, e.g /usr/lib/ghc",
+ "path to the GHC lib dir, to override the default path",
Option ['o'] ["odir"] (ReqArg Flag_OutputDir "DIR")
"directory in which to put the output files",
Option ['l'] ["lib"] (ReqArg Flag_Lib "DIR")
diff --git a/src/Main.hs b/src/Main.hs
index f19ae659..3626abe4 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -34,6 +34,7 @@ import System.Exit
import System.Environment
import GHC
+import GHC.Paths
import DynFlags
import Bag
import Util (handleDyn)
@@ -111,8 +112,12 @@ main = handleTopExceptions $ do
if not (null fileArgs)
then do
+
+ let libDir
+ | Just dir <- getGhcLibDir flags = dir
+ | otherwise = libdir -- from GHC.Paths
+
-- initialize GHC
- libDir <- getGhcLibDir flags
(session, dynflags) <- startGhc libDir (ghcFlags flags)
-- get packages supplied with --read-interface
@@ -275,8 +280,8 @@ dumpInterfaceFile ifaces homeLinks flags =
getGhcLibDir flags =
case [ dir | Flag_GhcLibDir dir <- flags ] of
- [] -> throwE "no GHC lib dir specified"
- xs -> return $ last xs
+ [] -> Nothing
+ xs -> Just $ last xs
handleEasyFlags flags fileArgs = do