+------------------------
+-- The PackageConfigMap is read in from the configuration file
+-- It doesn't change during a run
+GLOBAL_VAR(v_Package_details, emptyPkgMap, PackageConfigMap)
+
+readPackageConf :: String -> IO ()
+readPackageConf conf_file = do
+ proto_pkg_configs <- loadPackageConfig conf_file
+ top_dir <- getTopDir
+ old_pkg_map <- readIORef v_Package_details
+
+ let pkg_configs = mungePackagePaths top_dir proto_pkg_configs
+ new_pkg_map = extendPkgMap old_pkg_map pkg_configs
+
+ writeIORef v_Package_details new_pkg_map
+
+getPackageConfigMap :: IO PackageConfigMap
+getPackageConfigMap = readIORef v_Package_details
+
+
+------------------------
+-- The package list reflects what was given as command-line options,
+-- plus their dependent packages.
+-- It is maintained in dependency order;
+-- earlier ones depend on later ones, but not vice versa
+GLOBAL_VAR(v_Packages, initPackageList, [PackageName])
+
+getPackages :: IO [PackageName]
+getPackages = readIORef v_Packages
+
+initPackageList = [haskell98Package,
+ basePackage,
+ rtsPackage]