- -- grab the last -B option on the command line, and
- -- set topDir to its value.
-getTopDir :: [String] -> (String, [String])
-getTopDir args
- | null minusbs = throwDyn (InstallationError ("missing -B<dir> option"))
- | otherwise = (drop 2 (last minusbs), others)
- where
- (minusbs, others) = partition (prefixMatch "-B") args
-
-
--- replace the string "$libdir" at the beginning of a path with the
--- current libdir (obtained from the -B option).
-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