summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-07-21 19:15:59 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-07-25 00:45:08 -0400
commit7721b923d53fb9eb93f80bb93b4c3bd976c05b4c (patch)
treeedc61b1ed9885e442c7327460052f10d1ca589fa /utils
parent73145d57f961c73b5853da7881d6a21e48e05909 (diff)
downloadhaskell-7721b923d53fb9eb93f80bb93b4c3bd976c05b4c.tar.gz
Move GHC.Platform into the compiler
Previously it was in ghc-boot so that ghc-pkg could use it. However it wasn't necessary because ghc-pkg only uses a subset of it: reading target arch and OS from the settings file. This is now done via GHC.Platform.ArchOS (was called PlatformMini before).
Diffstat (limited to 'utils')
-rw-r--r--utils/ghc-pkg/Main.hs21
1 files changed, 7 insertions, 14 deletions
diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs
index 91637f5fab..3c7a65ddf6 100644
--- a/utils/ghc-pkg/Main.hs
+++ b/utils/ghc-pkg/Main.hs
@@ -34,10 +34,8 @@ import qualified GHC.Unit.Database as GhcPkg
import GHC.Unit.Database
import GHC.HandleEncoding
import GHC.BaseDir (getBaseDir)
-import GHC.Settings.Platform (getTargetPlatform)
-import GHC.Settings.Utils (maybeReadFuzzy)
-import GHC.Platform (platformMini)
-import GHC.Platform.Host (cHostPlatformMini)
+import GHC.Settings.Utils (getTargetArchOS, maybeReadFuzzy)
+import GHC.Platform.Host (hostPlatformArchOS)
import GHC.UniqueSubdir (uniqueSubdir)
import GHC.Version ( cProjectVersion )
import qualified Distribution.Simple.PackageIndex as PackageIndex
@@ -643,13 +641,12 @@ getPkgDatabases verbosity mode use_user use_cache expand_vars my_flags = do
Right appdir -> do
-- See Note [Settings File] about this file, and why we need GHC to share it with us.
let settingsFile = top_dir </> "settings"
- let constantsFile = top_dir </> "platformConstants"
exists_settings_file <- doesFileExist settingsFile
- targetPlatformMini <- case exists_settings_file of
+ targetArchOS <- case exists_settings_file of
False -> do
warn $ "WARNING: settings file doesn't exist " ++ show settingsFile
warn "cannot know target platform so guessing target == host (native compiler)."
- pure cHostPlatformMini
+ pure hostPlatformArchOS
True -> do
settingsStr <- readFile settingsFile
mySettings <- case maybeReadFuzzy settingsStr of
@@ -657,14 +654,10 @@ getPkgDatabases verbosity mode use_user use_cache expand_vars my_flags = do
-- It's excusable to not have a settings file (for now at
-- least) but completely inexcusable to have a malformed one.
Nothing -> die $ "Can't parse settings file " ++ show settingsFile
- constantsStr <- readFile constantsFile
- constants <- case maybeReadFuzzy constantsStr of
- Just s -> pure s
- Nothing -> die $ "Can't parse platform constants file " ++ show constantsFile
- case getTargetPlatform settingsFile mySettings constants of
- Right platform -> pure $ platformMini platform
+ case getTargetArchOS settingsFile mySettings of
+ Right archOS -> pure archOS
Left e -> die e
- let subdir = uniqueSubdir targetPlatformMini
+ let subdir = uniqueSubdir targetArchOS
dir = appdir </> subdir
r <- lookForPackageDBIn dir
case r of