Commit b23b59f1 authored by simonmar's avatar simonmar
Browse files

[project @ 2001-06-13 10:23:23 by simonmar]

re-do package path munging that I b?rked yesterday
parent a1948ea1
-----------------------------------------------------------------------------
-- $Id: DriverState.hs,v 1.42 2001/06/12 17:07:23 simonmar Exp $
-- $Id: DriverState.hs,v 1.43 2001/06/13 10:23:23 simonmar Exp $
--
-- Settings for the driver
--
......@@ -346,12 +346,12 @@ addPackage package
getPackageImportPath :: IO [String]
getPackageImportPath = do
ps <- getPackageInfo
munge_paths (concatMap import_dirs ps)
return (nub (filter (not.null) (concatMap import_dirs ps)))
getPackageIncludePath :: IO [String]
getPackageIncludePath = do
ps <- getPackageInfo
munge_paths (concatMap include_dirs ps)
return (nub (filter (not.null) (concatMap include_dirs ps)))
-- includes are in reverse dependency order (i.e. rts first)
getPackageCIncludes :: IO [String]
......@@ -362,7 +362,7 @@ getPackageCIncludes = do
getPackageLibraryPath :: IO [String]
getPackageLibraryPath = do
ps <- getPackageInfo
munge_paths (concatMap library_dirs ps)
return (nub (filter (not.null) (concatMap library_dirs ps)))
getPackageLibraries :: IO [String]
getPackageLibraries = do
......@@ -406,13 +406,6 @@ lookupPkg nm ps
[] -> Nothing
(p:_) -> Just p
munge_paths ps = do
topdir <- readIORef v_TopDir
return (nub (filter (not.null) (map (munge_path topdir) ps)))
where munge_path topdir p
| Just p' <- my_prefix_match "$libdir" p = topdir ++ p'
| otherwise = p
-----------------------------------------------------------------------------
-- Ways
......
{-# OPTIONS -fno-warn-incomplete-patterns #-}
-----------------------------------------------------------------------------
-- $Id: Main.hs,v 1.67 2001/05/31 11:32:25 simonmar Exp $
-- $Id: Main.hs,v 1.68 2001/06/13 10:23:23 simonmar Exp $
--
-- GHC Driver program
--
......@@ -167,7 +167,7 @@ main =
Left err -> throwDyn (InstallationError (showSDoc err));
Right pkg_details -> do
writeIORef v_Package_details pkg_details
writeIORef v_Package_details (mungePackagePaths top_dir pkg_details)
-- find the phase to stop after (i.e. -E, -C, -c, -S flags)
(flags2, mode, stop_flag) <- getGhcMode argv'
......@@ -317,8 +317,10 @@ main =
when (mode == DoLink) (doLink o_files)
when (mode == DoMkDLL) (doMkDLL o_files)
}
-- grab the last -B option on the command line, and
-- set topDir to its value.
-- grab the last -B option on the command line, and
-- set topDir to its value.
setTopDir :: [String] -> IO [String]
setTopDir args = do
let (minusbs, others) = partition (prefixMatch "-B") args
......@@ -327,6 +329,23 @@ setTopDir args = do
some -> writeIORef v_TopDir (drop 2 (last some)))
return others
-- replace the string "$libdir" at the beginning of a path with the
-- current TOPDIR (obtained from the -B option if present, or the
-- wired-in libdir otherwise).
mungePackagePaths top_dir ps = map munge_pkg ps
where
munge_pkg p = p{ import_dirs = munge_paths (import_dirs p),
include_dirs = munge_paths (include_dirs p),
library_dirs = munge_paths (library_dirs p) }
munge_paths = map munge_path
munge_path p
| Just p' <- my_prefix_match "$libdir" p = top_dir ++ p'
| otherwise = trace ("not: " ++ p) p
beginMake :: [String] -> IO ()
beginMake fileish_args
= do let (objs, mods) = partition objish_file fileish_args
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment