From: simonmar Date: Wed, 13 Jun 2001 10:23:23 +0000 (+0000) Subject: [project @ 2001-06-13 10:23:23 by simonmar] X-Git-Tag: Approximately_9120_patches~1768 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=b23b59f1918884c16cd8f1357f999f48521294b3;p=ghc-hetmet.git [project @ 2001-06-13 10:23:23 by simonmar] re-do package path munging that I b?rked yesterday --- diff --git a/ghc/compiler/main/DriverState.hs b/ghc/compiler/main/DriverState.hs index a31f171..8cad99c 100644 --- a/ghc/compiler/main/DriverState.hs +++ b/ghc/compiler/main/DriverState.hs @@ -1,5 +1,5 @@ ----------------------------------------------------------------------------- --- $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 diff --git a/ghc/compiler/main/Main.hs b/ghc/compiler/main/Main.hs index e9bc928..1b9f220 100644 --- a/ghc/compiler/main/Main.hs +++ b/ghc/compiler/main/Main.hs @@ -1,6 +1,6 @@ {-# 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