summaryrefslogtreecommitdiff
path: root/ghc/utils
diff options
context:
space:
mode:
authorSimon Marlow <simonmar@microsoft.com>2006-03-13 13:32:11 +0000
committerSimon Marlow <simonmar@microsoft.com>2006-03-13 13:32:11 +0000
commit50bc39808cd5b483a048a4d387f937963bd0e00f (patch)
tree3f2cf46a5701b7b0401a4deda77c6f7badad0ab6 /ghc/utils
parentccdb6d4be0204ee3cb88a5a3831582c73e1600bb (diff)
downloadhaskell-50bc39808cd5b483a048a4d387f937963bd0e00f.tar.gz
Look for a package.conf.d directory containing per-package .conf files
Contributed by Duncan Coutts, with changes to merge into the HEAD. This isn't the full deal, ghc-pkg still modifies files only, but it's enough to help the Gentoo folk along.
Diffstat (limited to 'ghc/utils')
-rw-r--r--ghc/utils/ghc-pkg/Main.hs14
1 files changed, 12 insertions, 2 deletions
diff --git a/ghc/utils/ghc-pkg/Main.hs b/ghc/utils/ghc-pkg/Main.hs
index a734636f2e..fb3ef07c3f 100644
--- a/ghc/utils/ghc-pkg/Main.hs
+++ b/ghc/utils/ghc-pkg/Main.hs
@@ -290,6 +290,16 @@ getPkgDatabases modify flags = do
Just dir -> return (dir `joinFileName` "package.conf")
fs -> return (last fs)
+ let global_conf_dir = global_conf ++ ".d"
+ global_conf_dir_exists <- doesDirectoryExist global_conf_dir
+ global_confs <-
+ if global_conf_dir_exists
+ then do files <- getDirectoryContents global_conf_dir
+ return [ global_conf_dir ++ '/' : file
+ | file <- files
+ , isSuffixOf ".conf" file]
+ else return []
+
-- get the location of the user package database, and create it if necessary
appdir <- getAppUserDataDirectory "ghc"
@@ -302,8 +312,8 @@ getPkgDatabases modify flags = do
-- If the user database doesn't exist, and this command isn't a
-- "modify" command, then we won't attempt to create or use it.
let sys_databases
- | modify || user_exists = [user_conf,global_conf]
- | otherwise = [global_conf]
+ | modify || user_exists = user_conf : global_confs ++ [global_conf]
+ | otherwise = global_confs ++ [global_conf]
e_pkg_path <- try (getEnv "GHC_PACKAGE_PATH")
let env_stack =